@vedangiitb/qwintly-core 1.2.0 → 1.3.0

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 (143) hide show
  1. package/dist/ai/prompts/codegen.prompt.d.ts +9 -0
  2. package/dist/ai/prompts/codegen.prompt.d.ts.map +1 -0
  3. package/dist/ai/prompts/codegen.prompt.js +53 -0
  4. package/dist/ai/prompts/codegen.prompt.js.map +1 -0
  5. package/dist/ai/prompts/examples/codegen.examples.d.ts +2 -0
  6. package/dist/ai/prompts/examples/codegen.examples.d.ts.map +1 -0
  7. package/dist/ai/prompts/examples/codegen.examples.js +81 -0
  8. package/dist/ai/prompts/examples/codegen.examples.js.map +1 -0
  9. package/dist/ai/prompts/examples/planner.examples.d.ts +2 -0
  10. package/dist/ai/prompts/examples/planner.examples.d.ts.map +1 -0
  11. package/dist/ai/prompts/examples/planner.examples.js +3 -0
  12. package/dist/ai/prompts/examples/planner.examples.js.map +1 -0
  13. package/dist/ai/prompts/helpers/promptParts.helper.d.ts +8 -0
  14. package/dist/ai/prompts/helpers/promptParts.helper.d.ts.map +1 -0
  15. package/dist/ai/prompts/helpers/promptParts.helper.js +37 -0
  16. package/dist/ai/prompts/helpers/promptParts.helper.js.map +1 -0
  17. package/dist/ai/prompts/planner.prompt.d.ts +10 -0
  18. package/dist/ai/prompts/planner.prompt.d.ts.map +1 -0
  19. package/dist/ai/prompts/planner.prompt.js +49 -0
  20. package/dist/ai/prompts/planner.prompt.js.map +1 -0
  21. package/dist/ai/prompts/prompts.d.ts +4 -0
  22. package/dist/ai/prompts/prompts.d.ts.map +1 -0
  23. package/dist/ai/prompts/prompts.js +4 -0
  24. package/dist/ai/prompts/prompts.js.map +1 -0
  25. package/dist/ai/prompts/validator.prompt.d.ts +15 -0
  26. package/dist/ai/prompts/validator.prompt.d.ts.map +1 -0
  27. package/dist/ai/prompts/validator.prompt.js +55 -0
  28. package/dist/ai/prompts/validator.prompt.js.map +1 -0
  29. package/dist/ai/tools/helpers/elementid.helpers.d.ts +4 -0
  30. package/dist/ai/tools/helpers/elementid.helpers.d.ts.map +1 -0
  31. package/dist/ai/tools/helpers/elementid.helpers.js +19 -0
  32. package/dist/ai/tools/helpers/elementid.helpers.js.map +1 -0
  33. package/dist/ai/tools/helpers/getImage.helper.d.ts +2 -0
  34. package/dist/ai/tools/helpers/getImage.helper.d.ts.map +1 -0
  35. package/dist/ai/tools/helpers/getImage.helper.js +2 -0
  36. package/dist/ai/tools/helpers/getImage.helper.js.map +1 -0
  37. package/dist/ai/tools/helpers/pageConfigJson.helpers.d.ts +15 -0
  38. package/dist/ai/tools/helpers/pageConfigJson.helpers.d.ts.map +1 -0
  39. package/dist/ai/tools/helpers/pageConfigJson.helpers.js +172 -0
  40. package/dist/ai/tools/helpers/pageConfigJson.helpers.js.map +1 -0
  41. package/dist/ai/tools/implementations/createNewRoute.impl.d.ts +5 -0
  42. package/dist/ai/tools/implementations/createNewRoute.impl.d.ts.map +1 -0
  43. package/dist/ai/tools/implementations/createNewRoute.impl.js +101 -0
  44. package/dist/ai/tools/implementations/createNewRoute.impl.js.map +1 -0
  45. package/dist/ai/tools/implementations/deleteElement.impl.d.ts +18 -0
  46. package/dist/ai/tools/implementations/deleteElement.impl.d.ts.map +1 -0
  47. package/dist/ai/tools/implementations/deleteElement.impl.js +60 -0
  48. package/dist/ai/tools/implementations/deleteElement.impl.js.map +1 -0
  49. package/dist/ai/tools/implementations/factories.d.ts +72 -0
  50. package/dist/ai/tools/implementations/factories.d.ts.map +1 -1
  51. package/dist/ai/tools/implementations/factories.js +20 -0
  52. package/dist/ai/tools/implementations/factories.js.map +1 -1
  53. package/dist/ai/tools/implementations/insertElement.impl.d.ts +14 -0
  54. package/dist/ai/tools/implementations/insertElement.impl.d.ts.map +1 -0
  55. package/dist/ai/tools/implementations/insertElement.impl.js +73 -0
  56. package/dist/ai/tools/implementations/insertElement.impl.js.map +1 -0
  57. package/dist/ai/tools/implementations/updateClassName.impl.d.ts +13 -0
  58. package/dist/ai/tools/implementations/updateClassName.impl.d.ts.map +1 -0
  59. package/dist/ai/tools/implementations/updateClassName.impl.js +61 -0
  60. package/dist/ai/tools/implementations/updateClassName.impl.js.map +1 -0
  61. package/dist/ai/tools/implementations/updateProps.impl.d.ts +33 -0
  62. package/dist/ai/tools/implementations/updateProps.impl.d.ts.map +1 -0
  63. package/dist/ai/tools/implementations/updateProps.impl.js +90 -0
  64. package/dist/ai/tools/implementations/updateProps.impl.js.map +1 -0
  65. package/dist/ai/tools/schemas/createNewRoute.schema.d.ts +20 -0
  66. package/dist/ai/tools/schemas/createNewRoute.schema.d.ts.map +1 -0
  67. package/dist/ai/tools/schemas/createNewRoute.schema.js +20 -0
  68. package/dist/ai/tools/schemas/createNewRoute.schema.js.map +1 -0
  69. package/dist/ai/tools/schemas/deleteElement.schema.d.ts +20 -0
  70. package/dist/ai/tools/schemas/deleteElement.schema.d.ts.map +1 -0
  71. package/dist/ai/tools/schemas/deleteElement.schema.js +20 -0
  72. package/dist/ai/tools/schemas/deleteElement.schema.js.map +1 -0
  73. package/dist/ai/tools/schemas/insertElement.schema.d.ts +23 -0
  74. package/dist/ai/tools/schemas/insertElement.schema.d.ts.map +1 -0
  75. package/dist/ai/tools/schemas/insertElement.schema.js +133 -0
  76. package/dist/ai/tools/schemas/insertElement.schema.js.map +1 -0
  77. package/dist/ai/tools/schemas/updateClassName.schema.d.ts +23 -0
  78. package/dist/ai/tools/schemas/updateClassName.schema.d.ts.map +1 -0
  79. package/dist/ai/tools/schemas/updateClassName.schema.js +21 -0
  80. package/dist/ai/tools/schemas/updateClassName.schema.js.map +1 -0
  81. package/dist/ai/tools/schemas/updateProps.schema.d.ts +91 -0
  82. package/dist/ai/tools/schemas/updateProps.schema.d.ts.map +1 -0
  83. package/dist/ai/tools/schemas/updateProps.schema.js +87 -0
  84. package/dist/ai/tools/schemas/updateProps.schema.js.map +1 -0
  85. package/dist/ai/tools/toolsets/codegenTools.d.ts.map +1 -1
  86. package/dist/ai/tools/toolsets/codegenTools.js +12 -4
  87. package/dist/ai/tools/toolsets/codegenTools.js.map +1 -1
  88. package/dist/core.d.ts +5 -1
  89. package/dist/core.d.ts.map +1 -1
  90. package/dist/core.js +9 -2
  91. package/dist/core.js.map +1 -1
  92. package/dist/image/unsplash.service.d.ts +22 -0
  93. package/dist/image/unsplash.service.d.ts.map +1 -0
  94. package/dist/image/unsplash.service.js +120 -0
  95. package/dist/image/unsplash.service.js.map +1 -0
  96. package/dist/indexer/codegenIndex.d.ts.map +1 -1
  97. package/dist/indexer/codegenIndex.js +2 -5
  98. package/dist/indexer/codegenIndex.js.map +1 -1
  99. package/dist/indexer/data/configs.constants.d.ts +32 -56
  100. package/dist/indexer/data/configs.constants.d.ts.map +1 -1
  101. package/dist/indexer/data/configs.constants.js +61 -88
  102. package/dist/indexer/data/configs.constants.js.map +1 -1
  103. package/dist/indexer/plannerIndex.d.ts.map +1 -1
  104. package/dist/indexer/plannerIndex.js +2 -7
  105. package/dist/indexer/plannerIndex.js.map +1 -1
  106. package/dist/indexer/validatorIndex.d.ts.map +1 -1
  107. package/dist/indexer/validatorIndex.js +1 -0
  108. package/dist/indexer/validatorIndex.js.map +1 -1
  109. package/dist/logging/genStatus.service.d.ts +2 -2
  110. package/dist/logging/genStatus.service.d.ts.map +1 -1
  111. package/dist/logging/genStatus.service.js +2 -2
  112. package/dist/logging/genStatus.service.js.map +1 -1
  113. package/dist/repository/genStatus.repository.d.ts +1 -1
  114. package/dist/repository/genStatus.repository.d.ts.map +1 -1
  115. package/dist/repository/genStatus.repository.js +2 -1
  116. package/dist/repository/genStatus.repository.js.map +1 -1
  117. package/dist/tests/createNewRoute.impl.test.d.ts +2 -0
  118. package/dist/tests/createNewRoute.impl.test.d.ts.map +1 -0
  119. package/dist/tests/createNewRoute.impl.test.js +72 -0
  120. package/dist/tests/createNewRoute.impl.test.js.map +1 -0
  121. package/dist/tests/deleteElement.impl.test.d.ts +2 -0
  122. package/dist/tests/deleteElement.impl.test.d.ts.map +1 -0
  123. package/dist/tests/deleteElement.impl.test.js +88 -0
  124. package/dist/tests/deleteElement.impl.test.js.map +1 -0
  125. package/dist/tests/insertUpdate.impl.test.d.ts +2 -0
  126. package/dist/tests/insertUpdate.impl.test.d.ts.map +1 -0
  127. package/dist/tests/insertUpdate.impl.test.js +68 -0
  128. package/dist/tests/insertUpdate.impl.test.js.map +1 -0
  129. package/dist/types/elements.d.ts +43 -0
  130. package/dist/types/elements.d.ts.map +1 -0
  131. package/dist/types/elements.js +13 -0
  132. package/dist/types/elements.js.map +1 -0
  133. package/dist/types/image.d.ts +19 -0
  134. package/dist/types/image.d.ts.map +1 -0
  135. package/dist/types/image.js +3 -0
  136. package/dist/types/image.js.map +1 -0
  137. package/dist/types/index/configs.types.d.ts +2 -3
  138. package/dist/types/index/configs.types.d.ts.map +1 -1
  139. package/dist/types/index/configs.types.js.map +1 -1
  140. package/dist/types/index/index.types.d.ts +4 -6
  141. package/dist/types/index/index.types.d.ts.map +1 -1
  142. package/dist/types/index/index.types.js.map +1 -1
  143. package/package.json +2 -1
@@ -0,0 +1,9 @@
1
+ import { CodegenIndex, CollectedContext } from "../../types/public.js";
2
+ export type CodegenNodePromptParams = {
3
+ task: string;
4
+ codegenIndex: CodegenIndex;
5
+ collectedContext: CollectedContext;
6
+ isNewProject: boolean;
7
+ };
8
+ export declare const codegenPrompt: (params: CodegenNodePromptParams) => string;
9
+ //# sourceMappingURL=codegen.prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegen.prompt.d.ts","sourceRoot":"","sources":["../../../src/ai/prompts/codegen.prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAQvE,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,YAAY,CAAC;IAC3B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ,uBAAuB,WA8E5D,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { codegenExamples } from "./examples/codegen.examples.js";
2
+ import { jsonBlock, mdSection, projectStateNote, } from "./helpers/promptParts.helper.js";
3
+ export const codegenPrompt = (params) => {
4
+ const { task, codegenIndex, collectedContext, isNewProject } = params;
5
+ const intialPrompt = `You are a senior software engineer responsible for implementing ONE coding task precisely and safely within an existing codebase.
6
+ ${projectStateNote(isNewProject, "codegen")}
7
+ `;
8
+ const context = mdSection("Context (Authoritative)", [
9
+ jsonBlock("Project Context (User preferences etc.)", collectedContext ?? {}),
10
+ ].join("\n"));
11
+ const projectConfiguration = mdSection("Project Configuration", [
12
+ jsonBlock("FRAMEWORK CONFIG", codegenIndex.projectConfigs.frameworkConfig),
13
+ jsonBlock("RUNTIME CONFIG", codegenIndex.projectConfigs.runtimeConfig),
14
+ jsonBlock("RENDERING CONFIGURATION", codegenIndex.projectConfigs.renderingConfig),
15
+ ].join("\n"));
16
+ const toolsInfo = mdSection("Tool Usage", `
17
+ You are provided access to the following tools and use them to implement coding tasks.
18
+
19
+ read_file: Use when you want to read a file from the codebase.
20
+
21
+ list_dir: Use when you want to list the directory structure of a given path.
22
+
23
+ create_new_route: Use when you want to create a new route. It will create a new route with a page.tsx and pageConfig.json (initial contents) file.
24
+
25
+ insert_element: Use when you want to insert a new element in the config
26
+
27
+ delete_element: Use when you want to delete an element from the config.
28
+
29
+ update_classname: Use when you want to update the className of an element.
30
+
31
+ update_props: Use when you want to update the props of an element.
32
+
33
+ submit_codegen_done: Use when you are done with the task and want to submit the codegen to the backend for validation.
34
+
35
+ Important things to note:
36
+ 1. If a route doesn't exists, please create it using the create_new_route tool.
37
+ 2. When you are adding an image, just give the alt, which should be clear description of the image. The src of the image will be taken care by us.
38
+ 3. For icons use only lucide-react icons.
39
+
40
+ `);
41
+ const taskInfo = mdSection("Task (Authoritative)", jsonBlock("TASK (You need to implement)", task ?? null));
42
+ const examples = codegenExamples;
43
+ const sections = [
44
+ intialPrompt,
45
+ context,
46
+ projectConfiguration,
47
+ toolsInfo,
48
+ examples,
49
+ taskInfo,
50
+ ];
51
+ return sections.join("\n\n---\n\n");
52
+ };
53
+ //# sourceMappingURL=codegen.prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegen.prompt.js","sourceRoot":"","sources":["../../../src/ai/prompts/codegen.prompt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EACL,SAAS,EACT,SAAS,EACT,gBAAgB,GACjB,MAAM,iCAAiC,CAAC;AASzC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAA+B,EAAE,EAAE;IAC/D,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IAEtE,MAAM,YAAY,GAAG;EACrB,gBAAgB,CAAC,YAAY,EAAE,SAAS,CAAC;KACtC,CAAC;IAEJ,MAAM,OAAO,GAAG,SAAS,CACvB,yBAAyB,EACzB;QACE,SAAS,CACP,yCAAyC,EACzC,gBAAgB,IAAI,EAAE,CACvB;KACF,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;IAEF,MAAM,oBAAoB,GAAG,SAAS,CACpC,uBAAuB,EACvB;QACE,SAAS,CACP,kBAAkB,EAClB,YAAY,CAAC,cAAc,CAAC,eAAe,CAC5C;QACD,SAAS,CAAC,gBAAgB,EAAE,YAAY,CAAC,cAAc,CAAC,aAAa,CAAC;QACtE,SAAS,CACP,yBAAyB,EACzB,YAAY,CAAC,cAAc,CAAC,eAAe,CAC5C;KACF,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;IAEF,MAAM,SAAS,GAAG,SAAS,CACzB,YAAY,EAEZ;;;;;;;;;;;;;;;;;;;;;;;;GAwBD,CACA,CAAC;IAEF,MAAM,QAAQ,GAAG,SAAS,CACxB,sBAAsB,EACtB,SAAS,CAAC,8BAA8B,EAAE,IAAI,IAAI,IAAI,CAAC,CACxD,CAAC;IAEF,MAAM,QAAQ,GAAG,eAAe,CAAC;IAEjC,MAAM,QAAQ,GAAG;QACf,YAAY;QACZ,OAAO;QACP,oBAAoB;QACpB,SAAS;QACT,QAAQ;QACR,QAAQ;KACT,CAAC;IACF,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACtC,CAAC,CAAC","sourcesContent":["import { CodegenIndex, CollectedContext } from \"../../types/public.js\";\r\nimport { codegenExamples } from \"./examples/codegen.examples.js\";\r\nimport {\r\n jsonBlock,\r\n mdSection,\r\n projectStateNote,\r\n} from \"./helpers/promptParts.helper.js\";\r\n\r\nexport type CodegenNodePromptParams = {\r\n task: string;\r\n codegenIndex: CodegenIndex;\r\n collectedContext: CollectedContext;\r\n isNewProject: boolean;\r\n};\r\n\r\nexport const codegenPrompt = (params: CodegenNodePromptParams) => {\r\n const { task, codegenIndex, collectedContext, isNewProject } = params;\r\n\r\n const intialPrompt = `You are a senior software engineer responsible for implementing ONE coding task precisely and safely within an existing codebase.\r\n${projectStateNote(isNewProject, \"codegen\")}\r\n `;\r\n\r\n const context = mdSection(\r\n \"Context (Authoritative)\",\r\n [\r\n jsonBlock(\r\n \"Project Context (User preferences etc.)\",\r\n collectedContext ?? {},\r\n ),\r\n ].join(\"\\n\"),\r\n );\r\n\r\n const projectConfiguration = mdSection(\r\n \"Project Configuration\",\r\n [\r\n jsonBlock(\r\n \"FRAMEWORK CONFIG\",\r\n codegenIndex.projectConfigs.frameworkConfig,\r\n ),\r\n jsonBlock(\"RUNTIME CONFIG\", codegenIndex.projectConfigs.runtimeConfig),\r\n jsonBlock(\r\n \"RENDERING CONFIGURATION\",\r\n codegenIndex.projectConfigs.renderingConfig,\r\n ),\r\n ].join(\"\\n\"),\r\n );\r\n\r\n const toolsInfo = mdSection(\r\n \"Tool Usage\",\r\n\r\n `\r\n You are provided access to the following tools and use them to implement coding tasks.\r\n\r\n read_file: Use when you want to read a file from the codebase.\r\n\r\n list_dir: Use when you want to list the directory structure of a given path.\r\n\r\n create_new_route: Use when you want to create a new route. It will create a new route with a page.tsx and pageConfig.json (initial contents) file.\r\n \r\n insert_element: Use when you want to insert a new element in the config\r\n \r\n delete_element: Use when you want to delete an element from the config.\r\n\r\n update_classname: Use when you want to update the className of an element.\r\n \r\n update_props: Use when you want to update the props of an element.\r\n\r\n submit_codegen_done: Use when you are done with the task and want to submit the codegen to the backend for validation.\r\n\r\n Important things to note:\r\n 1. If a route doesn't exists, please create it using the create_new_route tool.\r\n 2. When you are adding an image, just give the alt, which should be clear description of the image. The src of the image will be taken care by us.\r\n 3. For icons use only lucide-react icons.\r\n\r\n `,\r\n );\r\n\r\n const taskInfo = mdSection(\r\n \"Task (Authoritative)\",\r\n jsonBlock(\"TASK (You need to implement)\", task ?? null),\r\n );\r\n\r\n const examples = codegenExamples;\r\n\r\n const sections = [\r\n intialPrompt,\r\n context,\r\n projectConfiguration,\r\n toolsInfo,\r\n examples,\r\n taskInfo,\r\n ];\r\n return sections.join(\"\\n\\n---\\n\\n\");\r\n};\r\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const codegenExamples: string;
2
+ //# sourceMappingURL=codegen.examples.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegen.examples.d.ts","sourceRoot":"","sources":["../../../../src/ai/prompts/examples/codegen.examples.ts"],"names":[],"mappings":"AAkFA,eAAO,MAAM,eAAe,QAAsB,CAAC"}
@@ -0,0 +1,81 @@
1
+ const examples = [
2
+ `## Examples of tool calls
3
+
4
+ ### Example: \`insert_element\` (add a CTA section)
5
+ Goal: Insert a new section under the page root on route \`/\`.
6
+
7
+ Tool call:
8
+ \`\`\`json
9
+ {
10
+ "route": "/",
11
+ "parent_id": "root",
12
+ "element": {
13
+ "type": "div",
14
+ "className": "mt-10 flex items-center justify-between gap-6 rounded-2xl border border-slate-200 bg-white p-6",
15
+ "children": [
16
+ {
17
+ "type": "div",
18
+ "className": "flex flex-col gap-1",
19
+ "children": [
20
+ { "type": "text", "className": "text-lg font-semibold text-slate-900", "props": { "text": "Ready to get started?" } },
21
+ { "type": "text", "className": "text-sm text-slate-600", "props": { "text": "Create your first project in under a minute." } }
22
+ ]
23
+ },
24
+ {
25
+ "type": "button",
26
+ "className": "inline-flex items-center justify-center rounded-xl bg-slate-900 px-4 py-2 text-sm font-medium text-white hover:bg-slate-800",
27
+ "props": {
28
+ "text": "Get Started",
29
+ "onClick": { "kind": "route", "href": "/signup" }
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ }
35
+ \`\`\`
36
+
37
+ Notes:
38
+ - Always pass a complete \`className\` string (Tailwind only).
39
+ - Use the returned \`inserted_id\` for follow-up updates.`,
40
+ `### Example: \`update_classname\` (replace className fully)
41
+ Goal: Update styling on an existing element.
42
+
43
+ Tool call:
44
+ \`\`\`json
45
+ {
46
+ "route": "/",
47
+ "element_id": "el_123abc",
48
+ "className": "mt-8 grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3"
49
+ }
50
+ \`\`\`
51
+
52
+ Notes:
53
+ - Provide the full \`className\`; do not send partial patches.`,
54
+ `### Example: \`update_props\` (update element props)
55
+ Goal: Update the text and click action for a button.
56
+
57
+ Tool call (function name in tool schema is \`update_element\`):
58
+ \`\`\`json
59
+ {
60
+ "route": "/",
61
+ "element_id": "el_123abc",
62
+ "text": "Start free trial",
63
+ "onClick": { "kind": "route", "href": "/pricing", "replace": false }
64
+ }
65
+ \`\`\`
66
+
67
+ Other common prop updates:
68
+ \`\`\`json
69
+ {
70
+ "route": "/",
71
+ "element_id": "el_img_001",
72
+ "alt": "A person collaborating on a laptop in a bright office"
73
+ }
74
+ \`\`\`
75
+
76
+ Notes:
77
+ - Only include props you want to change; omitted fields remain unchanged.
78
+ - For images, \`alt\` is also used to fetch a suitable Unsplash image (src is auto-resolved).`,
79
+ ];
80
+ export const codegenExamples = examples.join("\n");
81
+ //# sourceMappingURL=codegen.examples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegen.examples.js","sourceRoot":"","sources":["../../../../src/ai/prompts/examples/codegen.examples.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG;IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0DAqCwD;IAExD;;;;;;;;;;;;;+DAa6D;IAE7D;;;;;;;;;;;;;;;;;;;;;;;;8FAwB4F;CAC7F,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC","sourcesContent":["const examples = [\n `## Examples of tool calls\n\n### Example: \\`insert_element\\` (add a CTA section)\nGoal: Insert a new section under the page root on route \\`/\\`.\n\nTool call:\n\\`\\`\\`json\n{\n \"route\": \"/\",\n \"parent_id\": \"root\",\n \"element\": {\n \"type\": \"div\",\n \"className\": \"mt-10 flex items-center justify-between gap-6 rounded-2xl border border-slate-200 bg-white p-6\",\n \"children\": [\n {\n \"type\": \"div\",\n \"className\": \"flex flex-col gap-1\",\n \"children\": [\n { \"type\": \"text\", \"className\": \"text-lg font-semibold text-slate-900\", \"props\": { \"text\": \"Ready to get started?\" } },\n { \"type\": \"text\", \"className\": \"text-sm text-slate-600\", \"props\": { \"text\": \"Create your first project in under a minute.\" } }\n ]\n },\n {\n \"type\": \"button\",\n \"className\": \"inline-flex items-center justify-center rounded-xl bg-slate-900 px-4 py-2 text-sm font-medium text-white hover:bg-slate-800\",\n \"props\": {\n \"text\": \"Get Started\",\n \"onClick\": { \"kind\": \"route\", \"href\": \"/signup\" }\n }\n }\n ]\n }\n}\n\\`\\`\\`\n\nNotes:\n- Always pass a complete \\`className\\` string (Tailwind only).\n- Use the returned \\`inserted_id\\` for follow-up updates.`,\n\n `### Example: \\`update_classname\\` (replace className fully)\nGoal: Update styling on an existing element.\n\nTool call:\n\\`\\`\\`json\n{\n \"route\": \"/\",\n \"element_id\": \"el_123abc\",\n \"className\": \"mt-8 grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3\"\n}\n\\`\\`\\`\n\nNotes:\n- Provide the full \\`className\\`; do not send partial patches.`,\n\n `### Example: \\`update_props\\` (update element props)\nGoal: Update the text and click action for a button.\n\nTool call (function name in tool schema is \\`update_element\\`):\n\\`\\`\\`json\n{\n \"route\": \"/\",\n \"element_id\": \"el_123abc\",\n \"text\": \"Start free trial\",\n \"onClick\": { \"kind\": \"route\", \"href\": \"/pricing\", \"replace\": false }\n}\n\\`\\`\\`\n\nOther common prop updates:\n\\`\\`\\`json\n{\n \"route\": \"/\",\n \"element_id\": \"el_img_001\",\n \"alt\": \"A person collaborating on a laptop in a bright office\"\n}\n\\`\\`\\`\n\nNotes:\n- Only include props you want to change; omitted fields remain unchanged.\n- For images, \\`alt\\` is also used to fetch a suitable Unsplash image (src is auto-resolved).`,\n];\n\nexport const codegenExamples = examples.join(\"\\n\");\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const plannerExamples: string;
2
+ //# sourceMappingURL=planner.examples.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner.examples.d.ts","sourceRoot":"","sources":["../../../../src/ai/prompts/examples/planner.examples.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,QAAsB,CAAC"}
@@ -0,0 +1,3 @@
1
+ const examples = [''];
2
+ export const plannerExamples = examples.join("\n");
3
+ //# sourceMappingURL=planner.examples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner.examples.js","sourceRoot":"","sources":["../../../../src/ai/prompts/examples/planner.examples.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,CAAC,EAAE,CAAC,CAAC;AAEtB,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC","sourcesContent":["const examples = [''];\n\nexport const plannerExamples = examples.join(\"\\n\");\n"]}
@@ -0,0 +1,8 @@
1
+ export type PromptRole = "planner" | "codegen" | "validator";
2
+ export declare const mdDivider: () => string;
3
+ export declare const mdSection: (title: string, body: string) => string;
4
+ export declare const jsonBlock: (label: string, value: unknown) => string;
5
+ export declare const projectStateNote: (isNewProject: boolean, role: PromptRole) => "The project you are given is currently a boilerplate project that contains some existing code. Create tasks to modify it per the PM plan; ensure there are no traces of boilerplate in the final project." | "The project has already gone through some stages of modification. Create tasks only for the latest PM recommendations and avoid rework." | "The project is currently a boilerplate. Implement the task cleanly while removing unnecessary boilerplate patterns." | "The project has existing modifications. Implement the task incrementally without breaking existing architecture.";
6
+ export declare const renderPlannerTaskFormatSection: () => string;
7
+ export declare const plannerObjectives: (target: PromptRole) => string;
8
+ //# sourceMappingURL=promptParts.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promptParts.helper.d.ts","sourceRoot":"","sources":["../../../../src/ai/prompts/helpers/promptParts.helper.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;AAE7D,eAAO,MAAM,SAAS,cAAkB,CAAC;AAEzC,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,EAAE,MAAM,MAAM,WAGpD,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,EAAE,OAAO,OAAO,WACG,CAAC;AAE3D,eAAO,MAAM,gBAAgB,GAAI,cAAc,OAAO,EAAE,MAAM,UAAU,ykBAUvE,CAAC;AAEF,eAAO,MAAM,8BAA8B,cAexC,CAAC;AAEJ,eAAO,MAAM,iBAAiB,GAAI,QAAQ,UAAU,WAWjD,CAAC"}
@@ -0,0 +1,37 @@
1
+ export const mdDivider = () => `\n---\n`;
2
+ export const mdSection = (title, body) => {
3
+ const trimmed = body.trim();
4
+ return trimmed.length === 0 ? `## ${title}\n` : `## ${title}\n${trimmed}\n`;
5
+ };
6
+ export const jsonBlock = (label, value) => `${label}:\n${JSON.stringify(value ?? null, null, 2)}\n`;
7
+ export const projectStateNote = (isNewProject, role) => {
8
+ if (role === "planner") {
9
+ return isNewProject
10
+ ? "The project you are given is currently a boilerplate project that contains some existing code. Create tasks to modify it per the PM plan; ensure there are no traces of boilerplate in the final project."
11
+ : "The project has already gone through some stages of modification. Create tasks only for the latest PM recommendations and avoid rework.";
12
+ }
13
+ return isNewProject
14
+ ? "The project is currently a boilerplate. Implement the task cleanly while removing unnecessary boilerplate patterns."
15
+ : "The project has existing modifications. Implement the task incrementally without breaking existing architecture.";
16
+ };
17
+ export const renderPlannerTaskFormatSection = () => mdSection("Task Format (STRICT)", `
18
+ When you are done planning, you MUST call submit_planner_tasks with:
19
+
20
+ {
21
+ "planner_tasks": [
22
+ {
23
+ "description": "DETAILED instruction. Include exact paths + expected end state. No code blocks.",
24
+ "targets": ["Paths that WILL be modified or MUST be referred to."]
25
+ }
26
+ ]
27
+ }
28
+ `.trim());
29
+ export const plannerObjectives = (target) => mdSection("Objectives", `
30
+ 1) Create atomic, deterministic tasks to ${target == "validator" ? "resolve ALL validation errors" : "implement PM Plan"} which should include exact file paths to create/modify
31
+ 2) Ensure instructions are foolproof for code-gen execution.
32
+ 3) Use incremental updates; minimize full rewrites.
33
+ 4) Use existing code context wherever possible.
34
+ 5) Be token-efficient: concise but technically complete.
35
+ 6) DO NOT write code, you have to just plan the tasks
36
+ `.trim());
37
+ //# sourceMappingURL=promptParts.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promptParts.helper.js","sourceRoot":"","sources":["../../../../src/ai/prompts/helpers/promptParts.helper.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC;AAEzC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;IACvD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,KAAK,OAAO,IAAI,CAAC;AAC9E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,KAAc,EAAE,EAAE,CACzD,GAAG,KAAK,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AAE3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,YAAqB,EAAE,IAAgB,EAAE,EAAE;IAC1E,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,YAAY;YACjB,CAAC,CAAC,2MAA2M;YAC7M,CAAC,CAAC,yIAAyI,CAAC;IAChJ,CAAC;IAED,OAAO,YAAY;QACjB,CAAC,CAAC,qHAAqH;QACvH,CAAC,CAAC,kHAAkH,CAAC;AACzH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,EAAE,CACjD,SAAS,CACP,sBAAsB,EACtB;;;;;;;;;;;KAWC,CAAC,IAAI,EAAE,CACT,CAAC;AAEJ,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAkB,EAAE,EAAE,CACtD,SAAS,CACP,YAAY,EACZ;2CACuC,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,mBAAmB;;;;;;OAMjH,CAAC,IAAI,EAAE,CACX,CAAC","sourcesContent":["export type PromptRole = \"planner\" | \"codegen\" | \"validator\";\n\nexport const mdDivider = () => `\\n---\\n`;\n\nexport const mdSection = (title: string, body: string) => {\n const trimmed = body.trim();\n return trimmed.length === 0 ? `## ${title}\\n` : `## ${title}\\n${trimmed}\\n`;\n};\n\nexport const jsonBlock = (label: string, value: unknown) =>\n `${label}:\\n${JSON.stringify(value ?? null, null, 2)}\\n`;\n\nexport const projectStateNote = (isNewProject: boolean, role: PromptRole) => {\n if (role === \"planner\") {\n return isNewProject\n ? \"The project you are given is currently a boilerplate project that contains some existing code. Create tasks to modify it per the PM plan; ensure there are no traces of boilerplate in the final project.\"\n : \"The project has already gone through some stages of modification. Create tasks only for the latest PM recommendations and avoid rework.\";\n }\n\n return isNewProject\n ? \"The project is currently a boilerplate. Implement the task cleanly while removing unnecessary boilerplate patterns.\"\n : \"The project has existing modifications. Implement the task incrementally without breaking existing architecture.\";\n};\n\nexport const renderPlannerTaskFormatSection = () =>\n mdSection(\n \"Task Format (STRICT)\",\n `\nWhen you are done planning, you MUST call submit_planner_tasks with:\n\n{\n \"planner_tasks\": [\n {\n \"description\": \"DETAILED instruction. Include exact paths + expected end state. No code blocks.\",\n \"targets\": [\"Paths that WILL be modified or MUST be referred to.\"]\n }\n ]\n}\n `.trim(),\n );\n\nexport const plannerObjectives = (target: PromptRole) =>\n mdSection(\n \"Objectives\",\n `\n1) Create atomic, deterministic tasks to ${target == \"validator\" ? \"resolve ALL validation errors\" : \"implement PM Plan\"} which should include exact file paths to create/modify \n2) Ensure instructions are foolproof for code-gen execution.\n3) Use incremental updates; minimize full rewrites.\n4) Use existing code context wherever possible.\n5) Be token-efficient: concise but technically complete.\n6) DO NOT write code, you have to just plan the tasks\n `.trim(),\n );\n"]}
@@ -0,0 +1,10 @@
1
+ import { CollectedContext } from "../../types/context.types.js";
2
+ import { PlannerIndex } from "../../types/public.js";
3
+ export type PlanNodePromptParams = {
4
+ planTasks: unknown[];
5
+ collectedContext: CollectedContext;
6
+ plannerIndex: PlannerIndex;
7
+ isNewProject: boolean;
8
+ };
9
+ export declare const plannerPrompt: (params: PlanNodePromptParams) => string;
10
+ //# sourceMappingURL=planner.prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner.prompt.d.ts","sourceRoot":"","sources":["../../../src/ai/prompts/planner.prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAUrD,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,OAAO,EAAE,CAAC;IACrB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ,oBAAoB,WA+EzD,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { plannerExamples } from "./examples/planner.examples.js";
2
+ import { jsonBlock, mdSection, plannerObjectives, projectStateNote, renderPlannerTaskFormatSection, } from "./helpers/promptParts.helper.js";
3
+ export const plannerPrompt = (params) => {
4
+ const { planTasks, collectedContext, plannerIndex, isNewProject } = params;
5
+ const intialPrompt = `
6
+ You are a senior software architect.
7
+ Based on the provided PM plan and code context, generate a detailed technical implementation plan.
8
+ Provide precise, step-by-step instructions for a code-generation agent; ensure tasks are explicit, atomic, and ordered.
9
+ ${projectStateNote(isNewProject, "planner")}
10
+ `.trim();
11
+ const objectives = plannerObjectives("planner");
12
+ const context = mdSection("Inputs (Authoritative)", [
13
+ jsonBlock("Project Context (User preferences etc.)", collectedContext ?? {}),
14
+ ].join("\n"));
15
+ const projectConfiguration = mdSection("Project Configuration", [
16
+ jsonBlock("FRAMEWORK CONFIG", plannerIndex.projectConfigs.frameworkConfig),
17
+ jsonBlock("RUNTIME CONFIG", plannerIndex.projectConfigs.runtimeConfig),
18
+ jsonBlock("TOOLING CONFIG", plannerIndex.projectConfigs.toolingConfig),
19
+ jsonBlock("RENDERING CONFIGURATION", plannerIndex.projectConfigs.renderingConfig),
20
+ ].join("\n"));
21
+ const toolsInfo = mdSection("Tools", `
22
+ You are provided access to the following tools and use them to plan coding tasks.
23
+
24
+ read_file: Use it to read a file from the codebase.
25
+
26
+ search: Use it to search for code in the codebase.
27
+
28
+ list_dir: Use it to list the directory structure of the codebase.
29
+
30
+ submit_planner_tasks: Use it to finalize and return the planner tasks for the code-generation agent.
31
+ `);
32
+ const planTasksInfo = mdSection("Plan Tasks", jsonBlock("Plan Tasks", planTasks ?? []));
33
+ const rendering = renderPlannerTaskFormatSection();
34
+ const examples = plannerExamples;
35
+ const plannerClosingNote = "Focus on clarity, minimalism, and correctness. Your plan will directly determine the success of the system.";
36
+ const sections = [
37
+ intialPrompt,
38
+ objectives,
39
+ context,
40
+ projectConfiguration,
41
+ toolsInfo,
42
+ rendering,
43
+ examples,
44
+ planTasksInfo,
45
+ plannerClosingNote,
46
+ ];
47
+ return sections.join("\n\n---\n\n");
48
+ };
49
+ //# sourceMappingURL=planner.prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner.prompt.js","sourceRoot":"","sources":["../../../src/ai/prompts/planner.prompt.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EACL,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,8BAA8B,GAC/B,MAAM,iCAAiC,CAAC;AASzC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAA4B,EAAE,EAAE;IAC5D,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IAE3E,MAAM,YAAY,GAAG;;;;EAIrB,gBAAgB,CAAC,YAAY,EAAE,SAAS,CAAC;KACtC,CAAC,IAAI,EAAE,CAAC;IAEX,MAAM,UAAU,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAEhD,MAAM,OAAO,GAAG,SAAS,CACvB,wBAAwB,EACxB;QACE,SAAS,CACP,yCAAyC,EACzC,gBAAgB,IAAI,EAAE,CACvB;KACF,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;IAEF,MAAM,oBAAoB,GAAG,SAAS,CACpC,uBAAuB,EACvB;QACE,SAAS,CACP,kBAAkB,EAClB,YAAY,CAAC,cAAc,CAAC,eAAe,CAC5C;QACD,SAAS,CAAC,gBAAgB,EAAE,YAAY,CAAC,cAAc,CAAC,aAAa,CAAC;QACtE,SAAS,CAAC,gBAAgB,EAAE,YAAY,CAAC,cAAc,CAAC,aAAa,CAAC;QACtE,SAAS,CACP,yBAAyB,EACzB,YAAY,CAAC,cAAc,CAAC,eAAe,CAC5C;KACF,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;IAEF,MAAM,SAAS,GAAG,SAAS,CACzB,OAAO,EAEP;;;;;;;;;;KAUC,CACF,CAAC;IAEF,MAAM,aAAa,GAAG,SAAS,CAC7B,YAAY,EACZ,SAAS,CAAC,YAAY,EAAE,SAAS,IAAI,EAAE,CAAC,CACzC,CAAC;IAEF,MAAM,SAAS,GAAG,8BAA8B,EAAE,CAAC;IAEnD,MAAM,QAAQ,GAAG,eAAe,CAAC;IAEjC,MAAM,kBAAkB,GACtB,6GAA6G,CAAC;IAEhH,MAAM,QAAQ,GAAG;QACf,YAAY;QACZ,UAAU;QACV,OAAO;QACP,oBAAoB;QACpB,SAAS;QACT,SAAS;QACT,QAAQ;QACR,aAAa;QACb,kBAAkB;KACnB,CAAC;IAEF,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACtC,CAAC,CAAC","sourcesContent":["import { CollectedContext } from \"../../types/context.types.js\";\r\nimport { PlannerIndex } from \"../../types/public.js\";\r\nimport { plannerExamples } from \"./examples/planner.examples.js\";\r\nimport {\r\n jsonBlock,\r\n mdSection,\r\n plannerObjectives,\r\n projectStateNote,\r\n renderPlannerTaskFormatSection,\r\n} from \"./helpers/promptParts.helper.js\";\r\n\r\nexport type PlanNodePromptParams = {\r\n planTasks: unknown[];\r\n collectedContext: CollectedContext;\r\n plannerIndex: PlannerIndex;\r\n isNewProject: boolean;\r\n};\r\n\r\nexport const plannerPrompt = (params: PlanNodePromptParams) => {\r\n const { planTasks, collectedContext, plannerIndex, isNewProject } = params;\r\n\r\n const intialPrompt = `\r\nYou are a senior software architect.\r\nBased on the provided PM plan and code context, generate a detailed technical implementation plan.\r\nProvide precise, step-by-step instructions for a code-generation agent; ensure tasks are explicit, atomic, and ordered.\r\n${projectStateNote(isNewProject, \"planner\")}\r\n `.trim();\r\n\r\n const objectives = plannerObjectives(\"planner\");\r\n\r\n const context = mdSection(\r\n \"Inputs (Authoritative)\",\r\n [\r\n jsonBlock(\r\n \"Project Context (User preferences etc.)\",\r\n collectedContext ?? {},\r\n ),\r\n ].join(\"\\n\"),\r\n );\r\n\r\n const projectConfiguration = mdSection(\r\n \"Project Configuration\",\r\n [\r\n jsonBlock(\r\n \"FRAMEWORK CONFIG\",\r\n plannerIndex.projectConfigs.frameworkConfig,\r\n ),\r\n jsonBlock(\"RUNTIME CONFIG\", plannerIndex.projectConfigs.runtimeConfig),\r\n jsonBlock(\"TOOLING CONFIG\", plannerIndex.projectConfigs.toolingConfig),\r\n jsonBlock(\r\n \"RENDERING CONFIGURATION\",\r\n plannerIndex.projectConfigs.renderingConfig,\r\n ),\r\n ].join(\"\\n\"),\r\n );\r\n\r\n const toolsInfo = mdSection(\r\n \"Tools\",\r\n\r\n `\r\n You are provided access to the following tools and use them to plan coding tasks.\r\n \r\n read_file: Use it to read a file from the codebase.\r\n\r\n search: Use it to search for code in the codebase.\r\n \r\n list_dir: Use it to list the directory structure of the codebase.\r\n \r\n submit_planner_tasks: Use it to finalize and return the planner tasks for the code-generation agent.\r\n `,\r\n );\r\n\r\n const planTasksInfo = mdSection(\r\n \"Plan Tasks\",\r\n jsonBlock(\"Plan Tasks\", planTasks ?? []),\r\n );\r\n\r\n const rendering = renderPlannerTaskFormatSection();\r\n\r\n const examples = plannerExamples;\r\n\r\n const plannerClosingNote =\r\n \"Focus on clarity, minimalism, and correctness. Your plan will directly determine the success of the system.\";\r\n\r\n const sections = [\r\n intialPrompt,\r\n objectives,\r\n context,\r\n projectConfiguration,\r\n toolsInfo,\r\n rendering,\r\n examples,\r\n planTasksInfo,\r\n plannerClosingNote,\r\n ];\r\n\r\n return sections.join(\"\\n\\n---\\n\\n\");\r\n};\r\n"]}
@@ -0,0 +1,4 @@
1
+ export * from "./codegen.prompt.js";
2
+ export * from "./planner.prompt.js";
3
+ export * from "./validator.prompt.js";
4
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/ai/prompts/prompts.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./codegen.prompt.js";
2
+ export * from "./planner.prompt.js";
3
+ export * from "./validator.prompt.js";
4
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/ai/prompts/prompts.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC","sourcesContent":["export * from \"./codegen.prompt.js\";\r\nexport * from \"./planner.prompt.js\";\r\nexport * from \"./validator.prompt.js\";\r\n"]}
@@ -0,0 +1,15 @@
1
+ import { ValidatorIndex } from "../../types/public.js";
2
+ export type ValidationNodePromptParams = {
3
+ errors: Array<{
4
+ type?: string | null;
5
+ filePath?: string | null;
6
+ message?: string | null;
7
+ }>;
8
+ history: Array<{
9
+ file?: string;
10
+ fix?: string;
11
+ }>;
12
+ validatorIndex: ValidatorIndex;
13
+ };
14
+ export declare const validatorPrompt: (params: ValidationNodePromptParams) => string;
15
+ //# sourceMappingURL=validator.prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.prompt.d.ts","sourceRoot":"","sources":["../../../src/ai/prompts/validator.prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAQvD,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,KAAK,CAAC;QACZ,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,CAAC,CAAC;IACH,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,QAAQ,0BAA0B,WAmFjE,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { jsonBlock, mdSection, plannerObjectives, renderPlannerTaskFormatSection, } from "./helpers/promptParts.helper.js";
2
+ export const validatorPrompt = (params) => {
3
+ const { errors, history, validatorIndex } = params;
4
+ const initialPrompt = `You are a senior software engineer.
5
+ Based on the provided validation errors and fix history, generate a detailed technical implementation plan.
6
+ Provide precise, step-by-step instructions for a code-generation agent; ensure tasks are explicit and highly granular.
7
+ `.trim();
8
+ const objectives = plannerObjectives("validator");
9
+ const projectConfiguration = mdSection("Project Configuration", [
10
+ jsonBlock("FRAMEWORK CONFIG", validatorIndex.projectConfigs.frameworkConfig),
11
+ jsonBlock("RUNTIME CONFIG", validatorIndex.projectConfigs.runtimeConfig),
12
+ jsonBlock("TOOLING CONFIG", validatorIndex.projectConfigs.toolingConfig),
13
+ jsonBlock("RENDERING CONFIGURATION", validatorIndex.projectConfigs.renderingConfig),
14
+ ].join("\n"));
15
+ const renderedErrors = errors.length === 0
16
+ ? "- No validation errors were provided."
17
+ : errors
18
+ .map((error) => `- Type: ${error.type}\n File: ${error.filePath}\n Message: ${error.message}`)
19
+ .join("\n");
20
+ const renderedHistory = history.length === 0
21
+ ? "- No previous fixes attempted."
22
+ : history
23
+ .map((h) => `- File: ${h.file}\n Fix Attempted: ${h.fix}`)
24
+ .join("\n");
25
+ const errorsInfo = mdSection("Inputs (Authoritative)", `
26
+ Validation Errors:
27
+ ${renderedErrors}
28
+
29
+ Fix History:
30
+ ${renderedHistory}
31
+
32
+ `.trim());
33
+ const toolsInfo = mdSection("Tools", `
34
+ You are provided access to the following tools and use them to plan coding tasks.
35
+
36
+ read_file: Use it to read a file from the codebase.
37
+
38
+ search: Use it to search for code in the codebase.
39
+
40
+ list_dir: Use it to list the directory structure of the codebase.
41
+
42
+ submit_planner_tasks: Use it to finalize and return the planner tasks for the code-generation agent.
43
+ `);
44
+ const rendering = renderPlannerTaskFormatSection();
45
+ const sections = [
46
+ initialPrompt,
47
+ objectives,
48
+ projectConfiguration,
49
+ toolsInfo,
50
+ rendering,
51
+ errorsInfo,
52
+ ];
53
+ return sections.join("\n\n---\n\n");
54
+ };
55
+ //# sourceMappingURL=validator.prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.prompt.js","sourceRoot":"","sources":["../../../src/ai/prompts/validator.prompt.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,8BAA8B,GAC/B,MAAM,iCAAiC,CAAC;AAYzC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAkC,EAAE,EAAE;IACpE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IAEnD,MAAM,aAAa,GAAG;;;KAGnB,CAAC,IAAI,EAAE,CAAC;IAEX,MAAM,UAAU,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAElD,MAAM,oBAAoB,GAAG,SAAS,CACpC,uBAAuB,EACvB;QACE,SAAS,CACP,kBAAkB,EAClB,cAAc,CAAC,cAAc,CAAC,eAAe,CAC9C;QACD,SAAS,CAAC,gBAAgB,EAAE,cAAc,CAAC,cAAc,CAAC,aAAa,CAAC;QACxE,SAAS,CAAC,gBAAgB,EAAE,cAAc,CAAC,cAAc,CAAC,aAAa,CAAC;QACxE,SAAS,CACP,yBAAyB,EACzB,cAAc,CAAC,cAAc,CAAC,eAAe,CAC9C;KACF,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;IAEF,MAAM,cAAc,GAClB,MAAM,CAAC,MAAM,KAAK,CAAC;QACjB,CAAC,CAAC,uCAAuC;QACzC,CAAC,CAAC,MAAM;aACH,GAAG,CACF,CAAC,KAAK,EAAE,EAAE,CACR,WAAW,KAAK,CAAC,IAAI,aAAa,KAAK,CAAC,QAAQ,gBAAgB,KAAK,CAAC,OAAO,EAAE,CAClF;aACA,IAAI,CAAC,IAAI,CAAC,CAAC;IAEpB,MAAM,eAAe,GACnB,OAAO,CAAC,MAAM,KAAK,CAAC;QAClB,CAAC,CAAC,gCAAgC;QAClC,CAAC,CAAC,OAAO;aACJ,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,IAAI,sBAAsB,CAAC,CAAC,GAAG,EAAE,CAAC;aAC1D,IAAI,CAAC,IAAI,CAAC,CAAC;IAEpB,MAAM,UAAU,GAAG,SAAS,CAC1B,wBAAwB,EACxB;;EAEF,cAAc;;;EAGd,eAAe;;OAEV,CAAC,IAAI,EAAE,CACX,CAAC;IAEF,MAAM,SAAS,GAAG,SAAS,CACzB,OAAO,EAEP;;;;;;;;;;KAUC,CACF,CAAC;IAEF,MAAM,SAAS,GAAG,8BAA8B,EAAE,CAAC;IAEnD,MAAM,QAAQ,GAAG;QACf,aAAa;QACb,UAAU;QACV,oBAAoB;QACpB,SAAS;QACT,SAAS;QACT,UAAU;KACX,CAAC;IAEF,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACtC,CAAC,CAAC","sourcesContent":["import { ValidatorIndex } from \"../../types/public.js\";\r\nimport {\r\n jsonBlock,\r\n mdSection,\r\n plannerObjectives,\r\n renderPlannerTaskFormatSection,\r\n} from \"./helpers/promptParts.helper.js\";\r\n\r\nexport type ValidationNodePromptParams = {\r\n errors: Array<{\r\n type?: string | null;\r\n filePath?: string | null;\r\n message?: string | null;\r\n }>;\r\n history: Array<{ file?: string; fix?: string }>;\r\n validatorIndex: ValidatorIndex;\r\n};\r\n\r\nexport const validatorPrompt = (params: ValidationNodePromptParams) => {\r\n const { errors, history, validatorIndex } = params;\r\n\r\n const initialPrompt = `You are a senior software engineer.\r\nBased on the provided validation errors and fix history, generate a detailed technical implementation plan.\r\nProvide precise, step-by-step instructions for a code-generation agent; ensure tasks are explicit and highly granular.\r\n `.trim();\r\n\r\n const objectives = plannerObjectives(\"validator\");\r\n\r\n const projectConfiguration = mdSection(\r\n \"Project Configuration\",\r\n [\r\n jsonBlock(\r\n \"FRAMEWORK CONFIG\",\r\n validatorIndex.projectConfigs.frameworkConfig,\r\n ),\r\n jsonBlock(\"RUNTIME CONFIG\", validatorIndex.projectConfigs.runtimeConfig),\r\n jsonBlock(\"TOOLING CONFIG\", validatorIndex.projectConfigs.toolingConfig),\r\n jsonBlock(\r\n \"RENDERING CONFIGURATION\",\r\n validatorIndex.projectConfigs.renderingConfig,\r\n ),\r\n ].join(\"\\n\"),\r\n );\r\n\r\n const renderedErrors =\r\n errors.length === 0\r\n ? \"- No validation errors were provided.\"\r\n : errors\r\n .map(\r\n (error) =>\r\n `- Type: ${error.type}\\n File: ${error.filePath}\\n Message: ${error.message}`,\r\n )\r\n .join(\"\\n\");\r\n\r\n const renderedHistory =\r\n history.length === 0\r\n ? \"- No previous fixes attempted.\"\r\n : history\r\n .map((h) => `- File: ${h.file}\\n Fix Attempted: ${h.fix}`)\r\n .join(\"\\n\");\r\n\r\n const errorsInfo = mdSection(\r\n \"Inputs (Authoritative)\",\r\n `\r\nValidation Errors:\r\n${renderedErrors}\r\n\r\nFix History:\r\n${renderedHistory}\r\n\r\n `.trim(),\r\n );\r\n\r\n const toolsInfo = mdSection(\r\n \"Tools\",\r\n\r\n `\r\n You are provided access to the following tools and use them to plan coding tasks.\r\n \r\n read_file: Use it to read a file from the codebase.\r\n\r\n search: Use it to search for code in the codebase.\r\n \r\n list_dir: Use it to list the directory structure of the codebase.\r\n \r\n submit_planner_tasks: Use it to finalize and return the planner tasks for the code-generation agent.\r\n `,\r\n );\r\n\r\n const rendering = renderPlannerTaskFormatSection();\r\n\r\n const sections = [\r\n initialPrompt,\r\n objectives,\r\n projectConfiguration,\r\n toolsInfo,\r\n rendering,\r\n errorsInfo,\r\n ];\r\n\r\n return sections.join(\"\\n\\n---\\n\\n\");\r\n};\r\n"]}
@@ -0,0 +1,4 @@
1
+ import { BuilderElement } from "../../../types/elements.js";
2
+ export declare function createElementId(existingIds: Set<string>): string;
3
+ export declare function extractAllIds(elements: BuilderElement[]): Set<string>;
4
+ //# sourceMappingURL=elementid.helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elementid.helpers.d.ts","sourceRoot":"","sources":["../../../../src/ai/tools/helpers/elementid.helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,wBAAgB,eAAe,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,UAQvD;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,cAAc,EAAE,eASvD"}
@@ -0,0 +1,19 @@
1
+ import { nanoid } from "nanoid";
2
+ export function createElementId(existingIds) {
3
+ let id;
4
+ do {
5
+ id = `el_${nanoid(10)}`;
6
+ } while (existingIds.has(id));
7
+ return id;
8
+ }
9
+ export function extractAllIds(elements) {
10
+ const ids = new Set();
11
+ elements.forEach((el) => {
12
+ ids.add(el.id);
13
+ if (el.children) {
14
+ extractAllIds(el.children).forEach((id) => ids.add(id));
15
+ }
16
+ });
17
+ return ids;
18
+ }
19
+ //# sourceMappingURL=elementid.helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elementid.helpers.js","sourceRoot":"","sources":["../../../../src/ai/tools/helpers/elementid.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,MAAM,UAAU,eAAe,CAAC,WAAwB;IACtD,IAAI,EAAU,CAAC;IAEf,GAAG,CAAC;QACF,EAAE,GAAG,MAAM,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1B,CAAC,QAAQ,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;IAE9B,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,QAA0B;IACtD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QACtB,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACf,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC;YAChB,aAAa,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { nanoid } from \"nanoid\";\r\nimport { BuilderElement } from \"../../../types/elements.js\";\r\n\r\nexport function createElementId(existingIds: Set<string>) {\r\n let id: string;\r\n\r\n do {\r\n id = `el_${nanoid(10)}`;\r\n } while (existingIds.has(id));\r\n\r\n return id;\r\n}\r\n\r\nexport function extractAllIds(elements: BuilderElement[]) {\n const ids = new Set<string>();\n elements.forEach((el) => {\n ids.add(el.id);\n if (el.children) {\n extractAllIds(el.children).forEach((id) => ids.add(id));\n }\n });\n return ids;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const getImage: () => void;
2
+ //# sourceMappingURL=getImage.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getImage.helper.d.ts","sourceRoot":"","sources":["../../../../src/ai/tools/helpers/getImage.helper.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,YAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const getImage = () => { };
2
+ //# sourceMappingURL=getImage.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getImage.helper.js","sourceRoot":"","sources":["../../../../src/ai/tools/helpers/getImage.helper.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC","sourcesContent":["export const getImage = () => {};\r\n"]}
@@ -0,0 +1,15 @@
1
+ import type { BuilderElement } from "../../../types/elements.js";
2
+ export type PageConfigJson = {
3
+ elements: BuilderElement[];
4
+ };
5
+ export declare const normalizeRouteSegments: (route: string) => string[];
6
+ export declare const isSafeSegment: (segment: string) => boolean;
7
+ export declare const getPageConfigJsonPath: (workspaceRoot: string, route: string) => string;
8
+ export declare const parsePageConfigJson: (content: string) => PageConfigJson;
9
+ export declare const stringifyPageConfigJson: (config: PageConfigJson) => string;
10
+ export declare const extractAllIdsDeep: (elements: BuilderElement[]) => Set<string>;
11
+ export declare const ensureElementIds: (elements: BuilderElement[], existingIds: Set<string>) => void;
12
+ export declare const findElementById: (elements: BuilderElement[], elementId: string) => BuilderElement | null;
13
+ export declare const deleteElementById: (elements: BuilderElement[], id: string) => boolean;
14
+ export declare const writeFileAtomic: (filePath: string, content: string) => Promise<void>;
15
+ //# sourceMappingURL=pageConfigJson.helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pageConfigJson.helpers.d.ts","sourceRoot":"","sources":["../../../../src/ai/tools/helpers/pageConfigJson.helpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIjE,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,OAAO,MAAM,KAAG,MAAM,EAQ5D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,YAM5C,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,eAAe,MAAM,EAAE,OAAO,MAAM,WAOzE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,cAkBrD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,QAAQ,cAAc,WACO,CAAC;AAEtE,eAAO,MAAM,iBAAiB,GAAI,UAAU,cAAc,EAAE,gBAa3D,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,UAAU,cAAc,EAAE,EAC1B,aAAa,GAAG,CAAC,MAAM,CAAC,SA0BzB,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,UAAU,cAAc,EAAE,EAC1B,WAAW,MAAM,KAChB,cAAc,GAAG,IAkBnB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,UAAU,cAAc,EAAE,EAC1B,IAAI,MAAM,KACT,OAkBF,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,UAAU,MAAM,EAAE,SAAS,MAAM,kBAwCtE,CAAC"}