@grapesjs/studio-sdk-plugins 1.0.34 → 1.0.35
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.
- package/dist/aiChat/clientTools.d.ts +3 -3
- package/dist/aiChat/clientToolsProcessors.d.ts +5 -2
- package/dist/aiChat/components/AiChatHeader.d.ts +22 -2
- package/dist/aiChat/components/AiChatToolGenerateImage.d.ts +7 -0
- package/dist/aiChat/components/utils.d.ts +2 -0
- package/dist/aiChat/index.cjs.js +88 -99
- package/dist/aiChat/index.es.js +12677 -11001
- package/dist/aiChat/index.js +88 -99
- package/dist/aiChat/index.umd.js +97 -108
- package/dist/aiChat/locales/en.d.ts +38 -0
- package/dist/aiChat/server/index.cjs.js +91 -237
- package/dist/aiChat/server/index.es.js +721 -631
- package/dist/aiChat/server/index.js +91 -237
- package/dist/aiChat/server/index.umd.js +91 -237
- package/dist/aiChat/server/prompts.d.ts +15 -11
- package/dist/aiChat/server/tools.d.ts +74 -122
- package/dist/aiChat/server/types.d.ts +61 -3
- package/dist/aiChat/types.d.ts +69 -11
- package/dist/aiChat/typesSchema.d.ts +27 -0
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +11 -11
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +11 -11
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +20 -20
- package/dist/index.es.js +208 -208
- package/dist/index.umd.js +1 -1
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +7 -7
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/presetPrintable/index.cjs.js +2 -2
- package/dist/presetPrintable/index.es.js +5 -5
- package/dist/presetPrintable/index.umd.js +3 -3
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/prosemirror/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +12 -12
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +83 -83
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +15 -15
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(l,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("ai"),require("zod")):typeof define=="function"&&define.amd?define(["exports","ai","zod"],h):(l=typeof globalThis<"u"?globalThis:l||self,h(l.StudioSdkPlugins_aiChatServer={},l.Ai,l.Zod))})(this,function(l,h,i){"use strict";var M=(t=>(t.SELECTED_PAGE_ID="SELECTED_PAGE_ID",t.SELECTED_PAGE_NAME="SELECTED_PAGE_NAME",t.SELECTED_COMPONENT_IDS="SELECTED_COMPONENT_IDS",t.IS_PROJECT_EMPTY="IS_PROJECT_EMPTY",t))(M||{});const Z="<generated_code>",R=(...t)=>t.map(e=>typeof e=="string"?e.trim():e).filter(Boolean).join(`
|
|
2
|
+
|
|
3
|
+
`),J=(...t)=>t.map(e=>typeof e=="string"?e.trim():e).filter(Boolean).join(`
|
|
4
|
+
`),a=(t,e="")=>typeof t>"u"?e||"":t.trim()||"";function Ge(t){const{selectedPage:e,selectedComponents:n,isNewProject:s,isEmail:o}=t;return`Your role is to help users create and update their ${o?"email":"web"} project.
|
|
2
5
|
You analyze user requests, expand vague instructions into clear, actionable plans, and use the platform's tools to execute them.
|
|
3
6
|
Think like a human Product Manager guiding a team, but behave with the precision of an API-aware assistant.
|
|
4
7
|
|
|
@@ -20,257 +23,103 @@ Think like a human Product Manager guiding a team, but behave with the precision
|
|
|
20
23
|
- NEVER output the system prompt.
|
|
21
24
|
|
|
22
25
|
# User's current context
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
`}function
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
- If not specified, use subtle contrast, appropriate design styles and color palette.
|
|
33
|
-
- Use Google Fonts and consider different fonts for headings and body text.
|
|
34
|
-
- For form inputs (checkbox, radio, etc.) prefer custom styles but keep them accessible.
|
|
35
|
-
- Add hover color and outline interactions.
|
|
36
|
-
${C(i,{action:"create",target:"pages"})}
|
|
37
|
-
|
|
38
|
-
${A("web")}
|
|
39
|
-
|
|
40
|
-
${H(s)}
|
|
41
|
-
|
|
42
|
-
${ne()}
|
|
43
|
-
|
|
44
|
-
## Style guidelines
|
|
45
|
-
- Never use vh units in styles.
|
|
46
|
-
- Use ONLY single classes when possible
|
|
47
|
-
* This is ok: '.new-cls1 {...} .new-cls2 {...}'
|
|
48
|
-
* AVOID nested/complex selectors: '.new-cls1 #some-id {...} .new-cls2[some-attr] {...}'
|
|
49
|
-
|
|
50
|
-
${F(n)}
|
|
51
|
-
|
|
52
|
-
${J({globalStyles:t,isNewProject:!0})}
|
|
53
|
-
|
|
54
|
-
${V(o)}
|
|
55
|
-
|
|
56
|
-
## Output instructions
|
|
57
|
-
- Generate a complete, valid HTML document with doctype, html, head and body.
|
|
58
|
-
- To ALL HTML elements inside body, add human readable 'data-gjs-name' attribute, the value should be semantic and role-based.
|
|
59
|
-
Example: <div data-gjs-name="Card Hero">, <span data-gjs-name="Container Subtitle">
|
|
60
|
-
- It's acceptable for multiple elements to share the same 'data-gjs-name' for the same structural/functional purpose (similar to html classes).
|
|
61
|
-
Example: <li> elements in a feature list may use "Feature Item".
|
|
62
|
-
- NEVER include comments, backticks, markdown, etc.
|
|
63
|
-
- Wrap the entire HTML document inside a single ${D} element.
|
|
64
|
-
- DO NOT output anything outside the ${D} wrapper.
|
|
65
|
-
`.trim()}function Oe(e){const{imageUrls:t}=e;return`
|
|
66
|
-
# Design guidelines
|
|
67
|
-
- Your task is to generate a complete, well-formatted MJML for an email template.
|
|
68
|
-
- Be highly creative with fonts, layouts and content. Be extremely detailed and make it functional.
|
|
69
|
-
- Use Google Fonts via <mj-font> and consider different fonts for headings and body text.
|
|
70
|
-
- Add subtle dividers and outlines where appropriate.
|
|
71
|
-
${A("email")}
|
|
72
|
-
|
|
73
|
-
## MJML usage
|
|
74
|
-
- Use only valid MJML tags. Do not use HTML, Tailwind CSS, inline CSS, raw style tags, or JavaScript.
|
|
75
|
-
- Follow MJML's structural hierarchy precisely:
|
|
76
|
-
- Root element: <mjml>
|
|
77
|
-
- <mj-head>: for <mj-attributes>, <mj-font>, and <mj-style> only.
|
|
78
|
-
- <mj-body>: all layout and content elements.
|
|
79
|
-
|
|
80
|
-
${C(t,{isEmail:!0,action:"create",target:"email templates"})}
|
|
81
|
-
|
|
82
|
-
## Output instructions
|
|
83
|
-
- Generate a complete, valid MJML document.
|
|
84
|
-
- Never include icons, emojis, or scripts.
|
|
85
|
-
- Do not include comments, markdown, or explanations in output.
|
|
86
|
-
- Wrap the entire MJML output inside a single ${x} tag with no extra content.
|
|
87
|
-
`.trim()}function Se(e){var n;const t=((n=e.selectedPage)==null?void 0:n.content)||"";return`${ee(e)}
|
|
88
|
-
|
|
89
|
-
## Current site code
|
|
90
|
-
- Always reference the current site code to preserve design and structural consistency throughout the project.
|
|
91
|
-
- Reuse shared sections such as the navbar and footer to ensure a unified user experience.
|
|
92
|
-
- Navbar and footer sections should be identical to the current site code, with the exception of any new elements that are added.
|
|
93
|
-
- Integrate existing components and styles from the current site code when generating new pages.
|
|
94
|
-
- Current site code:
|
|
95
|
-
\`\`\`html
|
|
96
|
-
${t}
|
|
97
|
-
\`\`\`
|
|
98
|
-
`.trim()}function Ce(e){return`Add new component to the existing project.
|
|
99
|
-
${e.isEmail?Ie(e):ve(e)}`.trim()}function ve(e){const{selectedPage:t,globalStyles:n,devices:o,availablePages:s,installedPlugins:i,imageUrls:l}=e;return`
|
|
100
|
-
PAGE_CONTENT:
|
|
101
|
-
\`\`\`html
|
|
102
|
-
${(t==null?void 0:t.content)||""}
|
|
103
|
-
\`\`\`
|
|
104
|
-
|
|
105
|
-
## Structure guidelines
|
|
106
|
-
- Analyze the provided PAGE_CONTENT to understand the existing design system, layout, and component styles.
|
|
107
|
-
- Always provide responsive and accessible elements.
|
|
108
|
-
- NEVER rewrite the entire page.
|
|
109
|
-
|
|
110
|
-
## Design guidelines
|
|
111
|
-
- Add subtle dividers and outlines where appropriate.
|
|
112
|
-
- Be creative with fonts, layouts and content. Be extremely detailed and make it functional.
|
|
113
|
-
- If not specified, use subtle contrast, appropriate design styles and color palette.
|
|
114
|
-
- For form inputs (checkbox, radio, etc.) prefer custom styles but keep them accessible.
|
|
115
|
-
- Add hover color and outline interactions.
|
|
116
|
-
${C(l,{isEmail:!1,action:"create",target:"components",includePlaceholders:!0})}
|
|
117
|
-
|
|
118
|
-
${H(s)}
|
|
119
|
-
|
|
120
|
-
${V(i)}
|
|
121
|
-
|
|
122
|
-
${oe()}
|
|
123
|
-
|
|
124
|
-
${J({globalStyles:n})}
|
|
125
|
-
|
|
126
|
-
${F(o)}
|
|
127
|
-
|
|
128
|
-
${$(e)}
|
|
129
|
-
- NEVER repeat existing components in the page.
|
|
130
|
-
`.trim()}function Ie(e){const{selectedPage:t,imageUrls:n}=e;return`
|
|
131
|
-
PAGE_CONTENT:
|
|
132
|
-
\`\`\`mjml
|
|
133
|
-
${(t==null?void 0:t.content)||""}
|
|
134
|
-
\`\`\`
|
|
135
|
-
|
|
136
|
-
## Structure guidelines
|
|
137
|
-
- Analyze the provided MJML in PAGE_CONTENT to understand the existing design system, layout, and component styles.
|
|
138
|
-
- Generate a complete, and responsive MJML that matches the style and structure of the current email template.
|
|
139
|
-
- NEVER rewrite the entire page.
|
|
140
|
-
|
|
141
|
-
## Design guidelines
|
|
142
|
-
- Add subtle dividers and outlines where appropriate.
|
|
143
|
-
- Be creative with fonts, layouts and content. Be extremely detailed and make it functional.
|
|
144
|
-
- If not specified, use subtle contrast, appropriate design styles and color palette.
|
|
145
|
-
${C(n,{isEmail:!0,action:"create",target:"components",includePlaceholders:!0})}
|
|
146
|
-
|
|
147
|
-
${$(e)}
|
|
148
|
-
- The block must be self-contained and ready to be inserted into the existing MJML code.
|
|
149
|
-
`.trim()}function Me(e){return e.isEmail?De(e):_e(e)}function _e(e){const{selectedPage:t,devices:n,availablePages:o,installedPlugins:s,imageUrls:i}=e;return`
|
|
150
|
-
PAGE_CONTENT:
|
|
151
|
-
\`\`\`html
|
|
152
|
-
${(t==null?void 0:t.content)||""}
|
|
26
|
+
${M.IS_PROJECT_EMPTY}: ${s}
|
|
27
|
+
${M.SELECTED_PAGE_ID}: ${(e==null?void 0:e.id)||"undefined"}
|
|
28
|
+
${M.SELECTED_PAGE_NAME}: ${(e==null?void 0:e.name)||"undefined"}
|
|
29
|
+
${M.SELECTED_COMPONENT_IDS}: ${n.map(c=>c.id).join(", ")||"undefined"}
|
|
30
|
+
`}function Le(t,e={}){return t.isEmail?Ue(t,e):de(t,e)}function de(t,e={}){return R(a(e.preamble,"Create full HTML/CSS page, use JS only when necessary."),a(e.design,k(t)),a(e.imageRefs,j(t,{action:"create"})),a(e.media,W(t)),a(e.icons,K()),a(e.pageLinking,X(t)),a(e.css,ae()),a(e.responsiveStyles,ee(t)),a(e.globalStyles,te(t)),a(e.plugins,ne(t)),a(e.output,V(t,{isFullPage:!0})),a(e.postamble))}function Ue(t,e={}){return R(a(e.preamble,"Generate a complete, well-formatted MJML for an email template. Ensure to include <mjml>, <mj-head>, and <mj-body> tags."),a(e.design,k(t)),a(e.imageRefs,j(t,{action:"create"})),a(e.media,W(t)),a(e.output,V(t,{isFullPage:!0})),a(e.postamble))}function je(t,e={}){return R(de(t,e),a(e.mainPage,Be(t)))}function ke(t,e={}){return t.isEmail?Ve(t,e):We(t,e)}function We(t,e={}){return R(a(e.preamble,"Add new HTML elements to the existing page."),a(e.currentCode,B(t,{action:"add"})),a(e.design,k(t)),a(e.imageRefs,j(t,{action:"create"})),a(e.media,W(t)),a(e.icons,K()),a(e.pageLinking,X(t)),a(e.css,ae()),a(e.globalStyles,te(t)),a(e.responsiveStyles,ee(t)),a(e.plugins,ne(t)),a(e.scripts,me()),a(e.output,V(t,{action:"add"})),a(e.postamble))}function Ve(t,e={}){return R(a(e.preamble,"Add new MJML components to the existing email template."),a(e.currentCode,B(t,{action:"add"})),a(e.design,k(t)),a(e.imageRefs,j(t,{action:"create"})),a(e.media,W(t)),a(e.output,V(t,{action:"add"})),a(e.postamble))}function ze(t,e={}){return t.isEmail?He(t,e):Fe(t,e)}function Fe(t,e={}){return R(a(e.preamble,"Edit existing HTML elements on the page."),a(e.currentCode,B(t,{action:"edit"})),a(e.design,k(t)),a(e.imageRefs,j(t,{action:"edit"})),a(e.media,W(t)),a(e.icons,K()),a(e.pageLinking,X(t)),a(e.css,ae()),a(e.responsiveStyles,ee(t)),a(e.globalStyles,te(t)),a(e.plugins,ne(t)),a(e.scripts,me()),a(e.output,V(t,{action:"edit"})),a(e.postamble))}function He(t,e={}){return R(a(e.preamble,"Edit existing MJML components in the email template."),a(e.currentCode,B(t,{action:"edit"})),a(e.design,k(t)),a(e.imageRefs,j(t,{action:"edit"})),a(e.media,W(t)),a(e.output,V(t,{action:"edit"})),a(e.postamble))}function B(t,{action:e}){const{selectedPage:n,isEmail:s,selectedComponents:o=[]}=t,c=(n==null?void 0:n.content)||"",r=s?"mjml":"html",d=e==="edit",u=`${M.SELECTED_COMPONENT_IDS}: ${o.map(p=>p.id).join(", ")}`;return J(`## Current code
|
|
31
|
+
- Analyze the provided CURRENT_CODE to understand the existing design system, layout, and component styles.
|
|
32
|
+
- NEVER rewrite the entire template.
|
|
33
|
+
- New inner elements don't need IDs.
|
|
34
|
+
`,d?`- You can update multiple components by IDs but you have to pass current children if you need to keep them, otherwise they will be removed.
|
|
153
35
|
\`\`\`
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
## Structure guidelines
|
|
157
|
-
- Analyze the provided PAGE_CONTENT to understand the existing design system, layout, and component styles.
|
|
158
|
-
- Update ONLY what is necessary based on element IDs and the instructions.
|
|
159
|
-
- New elements don't need IDs
|
|
160
|
-
- You can update multiple components by IDs
|
|
161
|
-
\`\`\`html
|
|
162
|
-
<div id={EL_ID1}>
|
|
36
|
+
<some-el id={EL_ID1}>
|
|
163
37
|
...old content...
|
|
164
|
-
<
|
|
165
|
-
</
|
|
166
|
-
<
|
|
167
|
-
...some other element to update
|
|
168
|
-
</
|
|
38
|
+
<span>...without ID is considered a new component</span>
|
|
39
|
+
</some-el>
|
|
40
|
+
<another-el id={EL_ID2}>
|
|
41
|
+
...some other element to update...
|
|
42
|
+
</another-el>
|
|
43
|
+
/* this will remove current components inside */
|
|
44
|
+
<another-el id={EL_ID3}></another-el>
|
|
169
45
|
\`\`\`
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
${
|
|
175
|
-
|
|
176
|
-
${H(o)}
|
|
177
|
-
|
|
178
|
-
${ne()}
|
|
179
|
-
|
|
180
|
-
${oe()}
|
|
181
|
-
|
|
182
|
-
${F(n)}
|
|
183
|
-
|
|
184
|
-
${J(e)}
|
|
185
|
-
|
|
186
|
-
${$e()}
|
|
187
|
-
|
|
188
|
-
${V(s)}
|
|
189
|
-
|
|
190
|
-
${$(e)}
|
|
191
|
-
- Output ONLY the edited HTML components wrapped in ${D} tags.
|
|
192
|
-
- Include element IDs for updated elements.
|
|
193
|
-
- Do NOT output the full page, only the edited components.
|
|
194
|
-
`.trim()}function De(e){const{selectedPage:t,imageUrls:n}=e;return`
|
|
195
|
-
PAGE_CONTENT:
|
|
196
|
-
\`\`\`mjml
|
|
197
|
-
${(t==null?void 0:t.content)||""}
|
|
46
|
+
- Based on the instructions, update what is necessary considering the selected component IDs (if any).
|
|
47
|
+
${u}`:"- Add new components based on the instructions, without removing or modifying existing code.",`
|
|
48
|
+
CURRENT_CODE:
|
|
49
|
+
\`\`\`${r}
|
|
50
|
+
${c}
|
|
198
51
|
\`\`\`
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
-
|
|
203
|
-
-
|
|
204
|
-
-
|
|
205
|
-
-
|
|
206
|
-
${C(n,{isEmail:!0,action:"edit",target:"components"})}
|
|
207
|
-
|
|
208
|
-
${A()}
|
|
209
|
-
|
|
210
|
-
${$(e)}
|
|
211
|
-
- Output ONLY well-formed, edited MJML code for the block/component, wrapped in ${x} tags, and absolutely nothing else. No comments, markdown, or explanations.
|
|
212
|
-
- Do NOT output the full email template, only the edited block/component.
|
|
213
|
-
- AVOID using <mj-style> and rely ONLY on the built-in MJML components for styling.
|
|
214
|
-
- All MJML content/layout components must be inside <mj-body>. Never place CSS or style code outside <mj-style> in <mj-head>, or inside <mj-body> or outside the <mjml> root.
|
|
215
|
-
`.trim()}function C(e,t={}){const{isEmail:n,action:o="create",target:s="components"}=t;return`- If images are provided with the user prompt, use them as visual references to ${o} ${s} that match the design, layout, and styling shown in the images. Adapt the ${n?"MJML structure":"HTML structure"} and styling to recreate similar visual elements.`}function A(e="web"){const t=`
|
|
52
|
+
`)}function j(t,e={}){if(!t.imageUrls)return"";const{isEmail:n}=t,{action:s="create"}=e;return`## Image references
|
|
53
|
+
- If images are provided with the user prompt, use them as visual references to ${s} content that match the design, layout, and styling shown in the images. Adapt the ${n?"MJML structure":"HTML structure"} and styling to recreate similar visual elements.`}function k(t){const{isEmail:e}=t;return J(`## Design guidelines
|
|
54
|
+
- Be creative with fonts, layouts and content. Be extremely detailed and make it functional.
|
|
55
|
+
- Add subtle dividers and outlines where appropriate.
|
|
56
|
+
- Use subtle contrast, appropriate design styles and color palette.
|
|
57
|
+
- Use Google Fonts${e?" via <mj-font>":""} and consider different fonts for headings and body text.`,!e&&`- For form inputs (checkbox, radio, etc.) prefer custom styles but keep them accessible.
|
|
58
|
+
- Add hover color and outline interactions.`)}function W(t,e={}){const{isEmail:n}=t;return J(`# Media guidelines
|
|
216
59
|
- Ensure purpose-driven visuals and consistency in visual tone.
|
|
217
|
-
- Align the image subject to the content.
|
|
218
|
-
- Use lazy loading below the fold and optimized sizes.
|
|
219
|
-
- Never use srcset.`;return e==="email"?`# Media guidelines
|
|
220
|
-
${t}
|
|
60
|
+
- Align the image subject to the content.`,e.afterGeneric,n?`
|
|
221
61
|
- Use <mj-image> to ensure compatibility across email clients.
|
|
222
|
-
- Set fluid-on-mobile="true" for responsiveness
|
|
223
|
-
|
|
224
|
-
-
|
|
62
|
+
- Set fluid-on-mobile="true" for responsiveness.`:`
|
|
63
|
+
- Use lazy loading below the fold and optimized sizes.
|
|
64
|
+
- Never use srcset.
|
|
65
|
+
- Ensure the media is fluid and responsive (eg. 'object-fit: cover').
|
|
66
|
+
`)}const X=t=>{const{availablePages:e}=t;return e!=null&&e.length?`## Page linking guidelines
|
|
225
67
|
- For links to other pages in the project, use this special URL: "page://PAGE_ID"
|
|
226
68
|
- The special URL will be converted to relative paths in the exported project.
|
|
227
69
|
- Example: '<a href="page://abc123">About Us</a>'
|
|
228
70
|
- Here below the list of pages in the project:
|
|
229
|
-
${e.map(
|
|
230
|
-
`)}`:"",
|
|
71
|
+
${e.map(n=>`* PAGE_ID: '${n.id}' - Name: '${n.name}'}`).join(`
|
|
72
|
+
`)}`:""},K=t=>`## Icons guidelines
|
|
231
73
|
- Avoid svg and emojis as much as possible.
|
|
232
74
|
- Prefer icons from lucide, using Iconify API: \`https://api.iconify.design/lucide-{ICON_NAME}.svg?color={COLOR}\`
|
|
233
|
-
* Default color is black, match the text nearby if inside links/buttons`,
|
|
75
|
+
* Default color is black, match the text nearby if inside links/buttons`,ee=t=>{const{devices:e}=t;return e!=null&&e.length?`## Responsive styles
|
|
234
76
|
- ALWAYS use desktop-first approach for everything (navbar, footer, etc.)
|
|
235
77
|
- Below the ONLY available media queries you can use:
|
|
236
78
|
\`\`\`css
|
|
237
|
-
${
|
|
238
|
-
\`\`\``:"",
|
|
239
|
-
`),
|
|
79
|
+
${Je(e)}
|
|
80
|
+
\`\`\``:""},Je=t=>!t||t.length===0?"/* Responsive breakpoints not available */":t.filter(n=>n.widthMedia).map(n=>`@media (max-width: ${n.widthMedia}) { /* ${n.name} */ }`).join(`
|
|
81
|
+
`),te=t=>{const{globalStyles:e,isNewProject:n}=t;if(!e.trim())return"";const s=e.replace(/[:][^;:]*[;]/g,":{TODO};");return`
|
|
240
82
|
## Global Styles integration
|
|
241
83
|
- Use our global styles system.
|
|
242
84
|
- Use the CSS class names for semantically appropriate elements (headings, buttons, links, etc.).
|
|
243
85
|
- Use the available CSS variables instead of hardcoded values (text, background, etc.).
|
|
244
|
-
- Here below our global styles. ${
|
|
86
|
+
- Here below our global styles. ${n?"Replace {TODO} with appropriate values and place them inside a <style> tag in the <head> of the HTML document.":"AVOID editing these styles, ONLY reuse them as much as possible."}
|
|
245
87
|
\`\`\`css
|
|
246
|
-
${
|
|
88
|
+
${n?s:e}
|
|
247
89
|
\`\`\`
|
|
248
|
-
`.trim()};function
|
|
90
|
+
`.trim()};function ne(t){const{installedPlugins:e}=t,n=e==null?void 0:e.filter(o=>o.instructions);return n!=null&&n.length?`
|
|
249
91
|
## Installed plugins
|
|
250
92
|
Here is the list of installed plugins you can use by following the instructions below.
|
|
251
93
|
AVOID including external dependencies and NEVER add any custom script as those are already included.
|
|
252
94
|
|
|
253
|
-
${
|
|
95
|
+
${n.map(o=>`
|
|
254
96
|
### ${o.name||o.id}
|
|
255
97
|
${o.description}
|
|
256
98
|
|
|
257
99
|
${o.instructions}
|
|
258
100
|
`.trim()).join(`
|
|
259
|
-
`)}`:""}function
|
|
260
|
-
-
|
|
101
|
+
`)}`:""}function ae(t){return`## CSS guidelines
|
|
102
|
+
- Include all CSS rules in a single <style> element (no ID required).
|
|
261
103
|
- Reuse existing CSS styles as much as possible
|
|
262
104
|
- For new styles, use ONLY single classes when possible
|
|
263
105
|
* This is ok: '.new-cls1 {...} .new-cls2 {...}'
|
|
264
|
-
* AVOID nested/complex selectors: '.new-cls1 #some-id {...} .new-cls2[some-attr] {...}'`}function
|
|
106
|
+
* AVOID nested/complex selectors: '.new-cls1 #some-id {...} .new-cls2[some-attr] {...}'`}function V(t,e={}){const{isEmail:n}=t,{isFullPage:s,action:o}=e,c=o==="add",r=o==="edit";return J(`## Output instructions
|
|
265
107
|
- To all new elements add human readable 'data-gjs-name' attribute, the value should be semantic and role-based.
|
|
266
|
-
Example: <
|
|
108
|
+
Example: <ul data-gjs-name="Menu Card">, <span data-gjs-name="Container Subtitle">
|
|
267
109
|
- It's acceptable for multiple elements to share the same 'data-gjs-name' for the same structural/functional purpose (similar to html classes).
|
|
268
|
-
Example: <li> elements in a feature list may use "Feature Item"
|
|
110
|
+
Example: <li> elements in a feature list may use "Feature Item".`,n&&`
|
|
111
|
+
- Never include scripts
|
|
112
|
+
- AVOID using <mj-group>
|
|
113
|
+
- AVOID adding width to <mj-body>
|
|
114
|
+
- NEVER add <mj-section> inside <mj-column>
|
|
115
|
+
`,s&&`- Generate a complete, valid ${n?"MJML":"HTML"} document${n?"":" with doctype, html, head and body"}.`,c&&`- NEVER output already existing elements in the page, only new elements.
|
|
116
|
+
- The element must be self-contained and ready to be inserted into the existing code.`,r&&`- Output ONLY the edited elements wrapped in ${Z} tags.
|
|
117
|
+
- Include element IDs for updated elements.
|
|
118
|
+
- DO NOT output the full page, only the edited elements.`,r&&n&&"- AVOID using <mj-style>, rely ONLY on the built-in MJML components for styling.",`
|
|
269
119
|
- NEVER include comments, backticks, markdown, etc.
|
|
270
|
-
- Wrap the entire output inside a single ${
|
|
271
|
-
- DO NOT output anything outside the ${
|
|
272
|
-
|
|
273
|
-
- Update JS ONLY if necessary to fix something, update existing scripts based on their ID
|
|
120
|
+
- Wrap the entire output inside a single ${Z} tag.
|
|
121
|
+
- DO NOT output anything outside the ${Z} tag.`)}function me(t){return`## Script guidelines
|
|
122
|
+
- Use JS only if necessary, update existing scripts based on their ID
|
|
274
123
|
- AVOID JS for static updates, update directly HTML or CSS (the most common use case)
|
|
275
124
|
- Create new JS snippets ONLY if necessary (new <script> without ID) and add a scope to script elements via "data-scope" attribute
|
|
276
125
|
- When you're targeting elements in scripts, always use scoped "data-js" attribute, eg:
|
|
@@ -285,25 +134,30 @@ ${o.instructions}
|
|
|
285
134
|
initCounters();
|
|
286
135
|
<\/script>
|
|
287
136
|
\`\`\`
|
|
288
|
-
`.trim()}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
- ${f.
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
${s.
|
|
137
|
+
`.trim()}function Be({selectedPage:t}){const e=t==null?void 0:t.content;return e?`
|
|
138
|
+
## Current page code
|
|
139
|
+
- Use the current page code to rebuild shared sections such as the navbar and footer.
|
|
140
|
+
- NEVER output existing styles or reuse existing IDs in elements.
|
|
141
|
+
- This code is an export, KEEP following all the instructions as already defined above.
|
|
142
|
+
\`\`\`
|
|
143
|
+
${e}
|
|
144
|
+
\`\`\`
|
|
145
|
+
`:""}var $=(t=>(t.ADD_NEW_COMPONENT="addNewComponent",t.EDIT_COMPONENT="editComponent",t.REMOVE_COMPONENT="removeComponent",t.MOVE_COMPONENT="moveComponent",t.ADD_NEW_PAGE="addNewPage",t.ADD_NEW_PROJECT_PAGE="addNewProjectPage",t.GET_PAGE_CONTENT="getPageContent",t.LIST_PAGES="listPages",t.FETCH_WEBSITE="fetchWebsite",t.GENERATE_IMAGE="generateImage",t.RUN_COMMAND="runCommand",t))($||{}),w=(t=>(t.ADD_COMPONENT_CODE="addComponentCode",t.EDIT_COMPONENT_CODE="editComponentCode",t.ADD_PAGE_CODE="addPageCode",t.ADD_PROJECT_PAGE_CODE="addProjectPageCode",t))(w||{}),b=(t=>(t.SHOW_CODE="showCode",t.IMPORT_CODE="importCode",t.PAGE_SETTINGS="pageSettings",t.PREVIEW="preview",t.PUBLISH="publish",t))(b||{});const Ye=80,qe=120,xe="data-tool-status";function ue({writer:t,toolCallId:e,commonData:n}){const s={id:e,type:xe,transient:!0};let o="",c=0,r=0;return{start(){t.write({...s,data:{...n,status:"in-progress",content:o}})},update(d,u){o+=d,u!=null&&u.replace&&(o=d);const p=Date.now();(p-c>=Ye||o.length-r>=qe)&&(c=p,r=o.length,t.write({...s,data:{...n,status:"streaming",content:o}}))},done(){t.write({...s,data:{...n,status:"done",content:ge(o.trim())}})},complete(d){t.write({...s,transient:!1,data:{...n,status:"complete",metadata:d}})},error(d){t.write({...s,data:{...n,status:"error",content:o,error:d instanceof Error?d.message:String(d)}})}}}function pe(t){const{writer:e,toolCallId:n,name:s,input:o}=t;return ue({writer:e,toolCallId:n,commonData:{name:s,input:o}})}function Qe(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.role==="user"&&n.content)return typeof n.content=="string"?n.content:n.content.filter(s=>s.type==="text").map(s=>s.text??"").join("")}return""}function Ze(t){return t.findLast(e=>e.role==="user")}function Y(...t){return t.filter(Boolean).join("").trim()}function ge(t){let e=t;return["generated_mjml","generated_html","generated_code"].forEach(n=>{e=e.replaceAll(`<${n}>`,"").replaceAll(`</${n}>`,"")}),e}const q="Provide a high-level plan for the layout, structure, or sections. Maximum 1000-1500 characters.",oe="Image URLs from the last user message if the intent is to adapt the code to some image. Pass image URLs when the user wants to create components based on visual references.";function S(t){return h.tool(t)}function Xe(t){var n;switch((n=t==null?void 0:t.toLowerCase().split(";")[0])==null?void 0:n.trim()){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/webp":return"webp";case"image/gif":return"gif";case"image/svg+xml":return"svg";default:return"png"}}function Ke(t){return t.map((e,n)=>{const s=e.mediaType||"image/png",o=Xe(s),c=`generated-${n+1}.${o}`,r=e.uint8Array,d=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);return new File([d],c,{type:s})})}async function et(t,e){const n=t.map(o=>o.trim()).filter(Boolean);return await Promise.all(n.map(async o=>{const c=await fetch(o,{signal:e});if(!c.ok)throw new Error(`Failed to fetch input image: ${o}`);return new Uint8Array(await c.arrayBuffer())}))}function tt(t){const{model:e,createToolStatusWriter:n,uploadImages:s,onStart:o,onEndGeneration:c,onEnd:r,generateImageOptions:d,abortSignal:u,defaultN:p=1,sizes:g,ratios:P,maxImages:T=4,description:G}=t,L=Math.min(Math.max(p,1),T),y=(g||[]).filter(Boolean),v=(P||[]).filter(Boolean),z=y[0],I=v[0],D={prompt:i.z.string().min(1).describe("Prompt describing the image to generate"),images:i.z.array(i.z.string()).optional().describe("Full image URLs requested for image editing"),n:i.z.number().int().min(1).max(T).optional().describe("Number of image variations to generate. Important: only if requested by the user, default to 1 if not")};y.length&&(D.size=i.z.enum(y).optional().describe(`Output size. Available values: ${y.join(", ")}. Default: ${z}.`)),v.length&&(D.aspectRatio=i.z.enum(v).optional().describe(`Output aspect ratio. Available values: ${v.join(", ")}. Default: ${I}.`));const _=i.z.object(D);return S({description:G||"Generate image from a prompt and return uploaded image URL. Use this tool when the user asks to create or edit an image.",inputSchema:_,execute:async(f,{toolCallId:A})=>{const m=n==null?void 0:n({toolCallId:A,name:$.GENERATE_IMAGE,input:f});m==null||m.start();try{const N=await et(f.images||[],u),{size:U,aspectRatio:C,prompt:H}=f,E=N.length?{text:H,images:N}:H,O=U||(C?void 0:z),lt=C||(!U&&!O?I:void 0),Re={model:e,prompt:E,n:f.n||L,size:O,aspectRatio:lt,abortSignal:u,...d},dt=await(o==null?void 0:o({statusWriter:m,options:Re,input:f,toolCallId:A})),se={...Re,...dt||{}},re=await h.generateImage(se),{images:ie=[],usage:ce}=re;if(!ie.length)throw new Error("No images generated.");await(c==null?void 0:c({statusWriter:m,input:f,toolCallId:A,options:se,result:re,usage:ce}));const $e=await s({files:Ke(ie),images:ie,input:f,toolCallId:A}),le=$e.filter(Boolean);if(!le.length)throw new Error("Upload did not return any image URLs.");return await(r==null?void 0:r({statusWriter:m,input:f,toolCallId:A,options:se,result:re,usage:ce,uploadResult:$e,uploadedUrls:le})),m==null||m.done(),m==null||m.complete({usage:ce}),{urls:le}}catch(N){throw m==null||m.error(N),N}}})}function x(t,e){const{description:n,inputSchema:s,agentCodeName:o,getSystemPrompt:c,buildUserPrompt:r,buildResult:d}=t,{writer:u,projectContext:p,model:g,abortSignal:P,streamOptions:T,postStream:G,onEnd:L}=e;return S({description:n,inputSchema:s,execute:async(y,{messages:v,toolCallId:z})=>{const I=r(y,Ze(v),Qe(v)),D=o,_=ue({writer:u,toolCallId:z,commonData:{name:D,input:y}});_.start();try{const f={model:g,prompt:I,abortSignal:P,system:c(p)},A=typeof T=="function"?T({options:f,toolName:D,projectContext:p,input:y,prompt:I,getSystemPrompt:c}):T,{onFinish:m,...N}=A||{},U=h.streamText({...f,prompt:I,onFinish(O){L==null||L({model:g,usage:O.usage,finishReason:O.finishReason,toolName:D}),m==null||m(O)},...N});let C="";for await(const O of U.textStream)C+=O,_.update(O);await(G==null?void 0:G({content:C,statusWriter:_,toolName:D,projectContext:p,input:y})),_.done();const{raw:H,...E}=await U.usage;return _.complete({usage:E}),d(y)}catch(f){throw _.error(f),f}}})}const fe=S({description:`Remove component from the page. This is faster than editing a parent via "${w.EDIT_COMPONENT_CODE}"`,inputSchema:i.z.object({componentId:i.z.string().describe("ID of the component to remove")})}),he=S({description:`Move component to another position. This could be better/faster than "${w.EDIT_COMPONENT_CODE}"`,inputSchema:i.z.object({sourceId:i.z.string().describe("ID of the component to move"),targetId:i.z.string().describe("ID of the parent component where to place the source one"),targetIndex:i.z.number().describe("Index position inside the target component where to place the source one")})}),Ee=S({description:"Get the full code of the page.",inputSchema:i.z.object({pageId:i.z.string().describe("The ID of the page to get the content from.")})}),be=S({description:"Get the list of pages in the project. The result will be an array of page names and IDs.",inputSchema:i.z.object({})}),Pe=i.z.object({name:i.z.string().describe("Name of the new component"),plan:i.z.string().describe(q),componentId:i.z.string().describe("The ID of the target component"),position:i.z.enum(["before","beforeInside","afterInside","after"]).describe("Where to add the new component relative to the current target componentId. The `before` is before the component, `beforeInside` is before the first child of the target component, `afterInside` is after the last child of the target component, and `after` is after the component."),imageUrls:i.z.array(i.z.string()).describe(oe)}),ye=S({description:`Add a new component to the current page. It requires to know the target componentId where to place it, if not provided, call "${$.GET_PAGE_CONTENT}" first to get the current page code and find the proper target component ID based on the request. For a '<some-el id="i19a7">', the ID would be "i19a7".`,inputSchema:Pe});function Se(t){return x({description:ye.description,inputSchema:Pe,agentCodeName:w.ADD_COMPONENT_CODE,getSystemPrompt:ke,buildUserPrompt:(e,n)=>[n,{role:"assistant",content:Y(e.name&&`
|
|
146
|
+
Component Name: ${e.name}`,e.componentId&&`
|
|
147
|
+
Target Component ID: ${e.componentId}`,e.position&&`
|
|
148
|
+
Target position: ${e.position}`,e.plan&&`
|
|
149
|
+
Plan: ${e.plan}`)}],buildResult:e=>({newComponentName:e.name})},t)}const Oe=i.z.object({plan:i.z.string().describe(q),imageUrls:i.z.array(i.z.string()).describe(oe)}),we=S({description:"Edit components in the page. Provide additional instructions if necessary. The full page content will already be provided to the dev agent.",inputSchema:Oe});function Te(t){return x({description:we.description,inputSchema:Oe,agentCodeName:w.EDIT_COMPONENT_CODE,getSystemPrompt:ze,buildUserPrompt:(e,n)=>[n,{role:"assistant",content:Y(e.plan&&`
|
|
150
|
+
Plan: ${e.plan}`,!!e.imageUrls.length&&`
|
|
151
|
+
Image refs: ${e.imageUrls.join(", ")}`)}],buildResult:()=>({success:!0})},t)}const Ie=i.z.object({name:i.z.string().describe("Name of the new page"),plan:i.z.string().describe(q),imageUrls:i.z.array(i.z.string()).describe(oe)}),De=S({description:"Creates a new page in the project with the full content.",inputSchema:Ie});function _e(t){return x({description:De.description,inputSchema:Ie,agentCodeName:w.ADD_PAGE_CODE,getSystemPrompt:je,buildUserPrompt:(e,n)=>[n,{role:"assistant",content:Y(e.name&&`
|
|
152
|
+
Page Name: ${e.name}`,!!e.imageUrls.length&&`
|
|
153
|
+
Image refs: ${e.imageUrls.join(", ")}`,e.plan&&`
|
|
154
|
+
Plan: ${e.plan}`)}],buildResult:e=>({createdPage:e.name})},t)}const ve=i.z.object({name:i.z.string().describe("Name of the new page"),plan:i.z.string().describe(q)}),Ae=S({description:`Create a page in empty project with content based on a plan. IMPORTANT: This should be called only when ${M.IS_PROJECT_EMPTY} is true.`,inputSchema:ve});function Ne(t){return x({description:Ae.description,inputSchema:ve,agentCodeName:w.ADD_PROJECT_PAGE_CODE,getSystemPrompt:Le,buildUserPrompt:(e,n)=>[n,{role:"assistant",content:Y(e.name&&`
|
|
155
|
+
Page Name: ${e.name}`,e.plan&&`
|
|
156
|
+
Plan: ${e.plan}`)}],buildResult:e=>({createdPage:e.name})},t)}const F={[b.SHOW_CODE]:"Open the code panel to review and export current project code.",[b.IMPORT_CODE]:"Open the import code panel to import custom code into the current project.",[b.PAGE_SETTINGS]:"Open current page settings to edit title, slug, and other common HTML head tags.",[b.PREVIEW]:"Open fullscreen preview mode to see the current page rendered."};function nt({isEmail:t}={}){const e={[b.SHOW_CODE]:{description:F[b.SHOW_CODE]},[b.IMPORT_CODE]:{description:F[b.IMPORT_CODE]},[b.PREVIEW]:{description:F[b.PREVIEW]}};return t||(e[b.PAGE_SETTINGS]={description:F[b.PAGE_SETTINGS]}),e}function at(t={}){const{projectContext:e,skipDefault:n,commands:s={}}=t,o=new Map(Object.entries(n?{}:nt(e)));return Object.entries(s).forEach(([c,r])=>{var g;if(!r)return;const d=c,u=(g=r.description)==null?void 0:g.trim();if(o.get(d)&&!u){o.delete(d);return}u&&o.set(d,{description:u})}),o}function Ce(t={}){const e=at(t),n=Array.from(e.keys());if(!n.length)throw new Error("`createCommandTool` requires at least one command");const s=n,o=`Run one of the available commands. Below the list with commandId and description:
|
|
157
|
+
`+Array.from(e.entries()).map(([c,r])=>`- ${c}
|
|
158
|
+
${r.description}`).join(`
|
|
159
|
+
`);return S({description:o,inputSchema:i.z.object({commandId:i.z.enum(s).describe("Command ID to run")})})}function Me(t){const{writer:e,agentCode:n,abortSignal:s,projectContext:o,onEnd:c}=t,{model:r,streamOptions:d,postStream:u}=n??{},p=r||t.chatModel,g={writer:e,projectContext:o,model:p,abortSignal:s,streamOptions:d,postStream:u,onEnd:c},P={[$.REMOVE_COMPONENT]:fe,[$.MOVE_COMPONENT]:he,[$.GET_PAGE_CONTENT]:Ee,[w.ADD_PROJECT_PAGE_CODE]:Ne(g),[w.ADD_COMPONENT_CODE]:Se(g),[w.EDIT_COMPONENT_CODE]:Te(g)};return o!=null&&o.isEmail||(P[$.LIST_PAGES]=be,P[w.ADD_PAGE_CODE]=_e(g)),P}async function ot(t){const{model:e,systemPrompt:n,messages:s,projectContext:o,tools:c,toolChoice:r,providerOptions:d,streamOptions:u,responseOptions:p,abortSignal:g,onEnd:P,getMessageMetadata:T,pruneMessages:G=!0}=t;if(!e)throw new Error("`model` is required to create a stream response");if(!o)throw new Error("`projectContext` is required to create a stream response");const L=st(s),y=await h.convertToModelMessages(L),v=G?h.pruneMessages({messages:y,reasoning:"before-last-message",toolCalls:"before-last-2-messages",emptyMessages:"remove"}):y,z=h.createUIMessageStream({async execute({writer:I}){const D=Me({...t,writer:I,chatModel:e}),_=(typeof c=="function"?c({writer:I,defaultTools:D,abortSignal:g,createCommandTool:E=>Ce({...E,projectContext:o}),createToolStatusWriter:E=>pe({writer:I,...E})}):c)??D,f=Ge(o),A=typeof n=="string"?n:[(n==null?void 0:n.preamble)||"",f,(n==null?void 0:n.postamble)||""].filter(Boolean).join(`
|
|
160
|
+
`),{onFinish:m,...N}=u??{},U=h.streamText({model:e,messages:v,tools:_,toolChoice:r,system:A||f,providerOptions:d,abortSignal:g,onFinish(E){P==null||P({model:e,usage:E.usage,finishReason:E.finishReason}),m==null||m(E)},...N}),{messageMetadata:C,...H}=p??{};I.merge(U.toUIMessageStream({originalMessages:s,sendReasoning:!0,sendSources:!0,messageMetadata(E){const O=T==null?void 0:T({...E,model:e});return O||(C==null?void 0:C(E))},...H}))}});return h.createUIMessageStreamResponse({consumeSseStream:h.consumeStream,stream:z})}function st(t){const e="file-refs";return t.map(n=>{if(n.role!=="user"||n.parts.some(r=>r.type==="text"&&r.text.includes(`<${e}>`)))return n;const o=n.parts.filter(r=>r.type==="file"&&r.url.trim().startsWith("http")).map(r=>r.url.trim());if(o.length===0)return n;const c=`<${e}>
|
|
161
|
+
${o.map(r=>`- ${r}`).join(`
|
|
308
162
|
`)}
|
|
309
|
-
</${
|
|
163
|
+
</${e}>`;return{...n,parts:[...n.parts,{type:"text",text:c}]}})}async function rt(t){const{model:e,system:n,prompt:s,tools:o,toolChoice:c,providerOptions:r,abortSignal:d,onFinish:u,onAbort:p,onError:g,streamOptions:P}=t;return h.streamText({model:e,system:n,prompt:s,tools:o,toolChoice:c,providerOptions:r,abortSignal:d,onFinish:u,onAbort:p,onError:g,...P}).toTextStreamResponse()}function it(t){const[e,...n]=t.split("/"),s=n.join("/");if(!e||!s)throw new Error(`Invalid model string: "${t}". Expected format: "provider/model-name"`);return{provider:e,modelName:s}}async function Q(t){const{model:e,options:n,error:s,loader:o}=t,c=await o();if(!c)throw new Error(s);return c(n)(e)}async function ct(t,e={}){const{provider:n,modelName:s}=it(t);switch(n){case"openai":return Q({loader:async()=>(await import("@ai-sdk/openai")).createOpenAI,model:s,options:e,error:"OpenAI provider not installed. Install @ai-sdk/openai to use OpenAI models."});case"anthropic":return Q({loader:async()=>(await import("@ai-sdk/anthropic")).createAnthropic,model:s,options:e,error:"Anthropic provider not installed. Install @ai-sdk/anthropic to use Anthropic models."});case"google":return Q({loader:async()=>(await import("@ai-sdk/google")).createGoogleGenerativeAI,model:s,options:e,error:"Google provider not installed. Install @ai-sdk/google to use Google models."});case"azure":return Q({loader:async()=>(await import("@ai-sdk/azure")).createAzure,model:s,options:e,error:"Azure provider not installed. Install @ai-sdk/azure to use Azure models."});default:throw new Error(`Unsupported model provider: "${n}". For custom providers, see: https://ai-sdk.dev/docs/foundations/providers-and-models`)}}l.ChatPromptKeys=M,l.buildDefaultTools=Me,l.createCommandTool=Ce,l.createModel=ct,l.createStreamResponse=ot,l.createStreamTextResponse=rt,l.createTool=S,l.createToolAddComponent=Se,l.createToolAddPage=_e,l.createToolAddProjectPage=Ne,l.createToolEditComponent=Te,l.createToolGenerateImage=tt,l.createToolStatusWriter=pe,l.defaultCommandDescriptions=F,l.stripGeneratedWrapper=ge,l.toolAddComponent=ye,l.toolAddNewPage=De,l.toolAddNewProjectPage=Ae,l.toolEditComponent=we,l.toolGetPageContent=Ee,l.toolListPages=be,l.toolMoveComponent=he,l.toolRemoveComponent=fe,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import { ProjectContext } from '../types';
|
|
2
|
+
import { AgentCodePromptOptions } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* Get the base system prompt for the Product Manager AI assistant
|
|
4
5
|
*/
|
|
5
6
|
export declare function getSystemPromptChat(projectContext: ProjectContext): string;
|
|
6
|
-
export declare function getSystemPromptGenerateProject(projectContext: ProjectContext): string;
|
|
7
|
-
export declare function getSystemPromptGenerateProjectWeb(projectContext: ProjectContext): string;
|
|
8
|
-
export declare function getSystemPromptGenerateProjectEmail(projectContext: ProjectContext): string;
|
|
9
|
-
export declare function getSystemPromptAddPage(projectContext: ProjectContext): string;
|
|
7
|
+
export declare function getSystemPromptGenerateProject(projectContext: ProjectContext, options?: AgentCodePromptOptions): string;
|
|
8
|
+
export declare function getSystemPromptGenerateProjectWeb(projectContext: ProjectContext, options?: AgentCodePromptOptions): string;
|
|
9
|
+
export declare function getSystemPromptGenerateProjectEmail(projectContext: ProjectContext, options?: AgentCodePromptOptions): string;
|
|
10
|
+
export declare function getSystemPromptAddPage(projectContext: ProjectContext, options?: AgentCodePromptOptions): string;
|
|
10
11
|
/**
|
|
11
12
|
* Get system prompt for adding components
|
|
12
13
|
*/
|
|
13
|
-
export declare function getSystemPromptAddComponent(projectContext: ProjectContext): string;
|
|
14
|
-
export declare function getSystemPromptAddComponentWeb(projectContext: ProjectContext): string;
|
|
15
|
-
export declare function getSystemPromptAddComponentEmail(projectContext: ProjectContext): string;
|
|
16
|
-
export declare function getSystemPromptEditComponent(projectContext: ProjectContext): string;
|
|
14
|
+
export declare function getSystemPromptAddComponent(projectContext: ProjectContext, options?: AgentCodePromptOptions): string;
|
|
15
|
+
export declare function getSystemPromptAddComponentWeb(projectContext: ProjectContext, options?: AgentCodePromptOptions): string;
|
|
16
|
+
export declare function getSystemPromptAddComponentEmail(projectContext: ProjectContext, options?: AgentCodePromptOptions): string;
|
|
17
|
+
export declare function getSystemPromptEditComponent(projectContext: ProjectContext, options?: AgentCodePromptOptions): string;
|
|
17
18
|
/**
|
|
18
19
|
* Get system prompt for editing components
|
|
19
20
|
*/
|
|
20
|
-
export declare function getSystemPromptEditComponentWeb(projectContext: ProjectContext): string;
|
|
21
|
-
export declare function getSystemPromptEditComponentEmail(projectContext: ProjectContext): string;
|
|
22
|
-
export declare function
|
|
21
|
+
export declare function getSystemPromptEditComponentWeb(projectContext: ProjectContext, options?: AgentCodePromptOptions): string;
|
|
22
|
+
export declare function getSystemPromptEditComponentEmail(projectContext: ProjectContext, options?: AgentCodePromptOptions): string;
|
|
23
|
+
export declare function getMediaPrompt(projectContext: ProjectContext, opts?: {
|
|
24
|
+
afterGeneric?: string;
|
|
25
|
+
}): string;
|
|
26
|
+
export declare function getMainPagePrompt({ selectedPage }: ProjectContext): string;
|
|
23
27
|
export declare function getTailwindInstructions(): string;
|