@vedangiitb/qwintly-core 1.3.2 → 1.3.4
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/ai/prompts/codegen.prompt.d.ts +1 -1
- package/dist/ai/prompts/codegen.prompt.d.ts.map +1 -1
- package/dist/ai/prompts/codegen.prompt.js.map +1 -1
- package/dist/ai/tools/schemas/insertElement.schema.d.ts.map +1 -1
- package/dist/ai/tools/schemas/insertElement.schema.js +3 -2
- package/dist/ai/tools/schemas/insertElement.schema.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"codegen.prompt.d.ts","sourceRoot":"","sources":["../../../src/ai/prompts/codegen.prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAY,MAAM,uBAAuB,CAAC;AAQjF,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,GAAG,CAAC;IACV,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"}
|
|
@@ -1 +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: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AAQ;QACR,QAAQ;KACT,CAAC;IACF,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACtC,CAAC,CAAC","sourcesContent":["import { CodegenIndex, CollectedContext, PlanTask } 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: any;\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertElement.schema.d.ts","sourceRoot":"","sources":["../../../../src/ai/tools/schemas/insertElement.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,eAAO,MAAM,aAAa,8FAUhB,CAAC;AA6BX,eAAO,MAAM,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"insertElement.schema.d.ts","sourceRoot":"","sources":["../../../../src/ai/tools/schemas/insertElement.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,eAAO,MAAM,aAAa,8FAUhB,CAAC;AA6BX,eAAO,MAAM,oBAAoB,EAAE,GAoFlC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;CAuB/B,CAAC"}
|
|
@@ -102,12 +102,13 @@ export const BuilderElementSchema = {
|
|
|
102
102
|
children: {
|
|
103
103
|
type: Type.ARRAY,
|
|
104
104
|
description: "Nested children. Used by 'fragment' and 'div' directly, and by 'button'/'link' when present (otherwise they use props.text).",
|
|
105
|
-
items: {
|
|
105
|
+
items: {
|
|
106
|
+
type: Type.OBJECT,
|
|
107
|
+
},
|
|
106
108
|
},
|
|
107
109
|
},
|
|
108
110
|
required: ["type"],
|
|
109
111
|
};
|
|
110
|
-
BuilderElementSchema.properties.children.items = BuilderElementSchema;
|
|
111
112
|
export const InsertElementSchema = {
|
|
112
113
|
name: "insert_element",
|
|
113
114
|
description: "Inserts element code. The element should be valid following the BuilderElement schema.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertElement.schema.js","sourceRoot":"","sources":["../../../../src/ai/tools/schemas/insertElement.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,UAAU;IACV,KAAK;IACL,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;IACP,UAAU;IACV,MAAM;IACN,MAAM;CACE,CAAC;AAEX,MAAM,mBAAmB,GAAG;IAC1B,IAAI,EAAE,IAAI,CAAC,MAAM;IACjB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,IAAI,EAAE,IAAI,CAAC,MAAM;YACjB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC;YAC7C,WAAW,EACT,2IAA2I;SAC9I;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,IAAI,CAAC,MAAM;YACjB,WAAW,EACT,iEAAiE;SACpE;QACD,OAAO,EAAE;YACP,IAAI,EAAE,IAAI,CAAC,OAAO;YAClB,WAAW,EAAE,uDAAuD;SACrE;QACD,MAAM,EAAE;YACN,IAAI,EAAE,IAAI,CAAC,OAAO;YAClB,WAAW,EAAE,8CAA8C;SAC5D;KACF;IACD,QAAQ,EAAE,CAAC,MAAM,CAAC;CACnB,CAAC;AAEF,mEAAmE;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAQ;IACvC,IAAI,EAAE,IAAI,C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,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,yBAAyB,EAAE;gBACnE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,2BAA2B,EAAE;gBACtE,WAAW,EAAE;oBACX,IAAI,EAAE,IAAI,CAAC,MAAM;oBACjB,WAAW,EAAE,2BAA2B;iBACzC;aACF;SACF;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,WAAW,EACT,8HAA8H;YAChI,KAAK,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"insertElement.schema.js","sourceRoot":"","sources":["../../../../src/ai/tools/schemas/insertElement.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,UAAU;IACV,KAAK;IACL,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;IACP,UAAU;IACV,MAAM;IACN,MAAM;CACE,CAAC;AAEX,MAAM,mBAAmB,GAAG;IAC1B,IAAI,EAAE,IAAI,CAAC,MAAM;IACjB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,IAAI,EAAE,IAAI,CAAC,MAAM;YACjB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC;YAC7C,WAAW,EACT,2IAA2I;SAC9I;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,IAAI,CAAC,MAAM;YACjB,WAAW,EACT,iEAAiE;SACpE;QACD,OAAO,EAAE;YACP,IAAI,EAAE,IAAI,CAAC,OAAO;YAClB,WAAW,EAAE,uDAAuD;SACrE;QACD,MAAM,EAAE;YACN,IAAI,EAAE,IAAI,CAAC,OAAO;YAClB,WAAW,EAAE,8CAA8C;SAC5D;KACF;IACD,QAAQ,EAAE,CAAC,MAAM,CAAC;CACnB,CAAC;AAEF,mEAAmE;AACnE,M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CAAC,MAAM;oBACjB,WAAW,EACT,2DAA2D;iBAC9D;gBACD,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,yBAAyB,EAAE;gBACnE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,2BAA2B,EAAE;gBACtE,WAAW,EAAE;oBACX,IAAI,EAAE,IAAI,CAAC,MAAM;oBACjB,WAAW,EAAE,2BAA2B;iBACzC;aACF;SACF;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,WAAW,EACT,8HAA8H;YAChI,KAAK,EAAE;gBACL,IAAI,EAAE,IAAI,CAAC,MAAM;aAClB;SACF;KACF;IACD,QAAQ,EAAE,CAAC,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EACT,wFAAwF;IAC1F,UAAU,EAAE;QACV,IAAI,EAAE,IAAI,CAAC,MAAM;QACjB,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,IAAI,CAAC,MAAM;gBACjB,WAAW,EACT,mEAAmE;aACtE;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,IAAI,CAAC,MAAM;gBACjB,WAAW,EAAE,yCAAyC;aACvD;YACD,OAAO,EAAE;gBACP,GAAG,oBAAoB;gBACvB,WAAW,EAAE,wBAAwB;aACtC;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC;KAC5C;CACF,CAAC","sourcesContent":["import { Type } from \"@google/genai\";\n\nexport const ELEMENT_TYPES = [\n \"fragment\",\n \"div\",\n \"text\",\n \"image\",\n \"button\",\n \"input\",\n \"textarea\",\n \"link\",\n \"icon\",\n] as const;\n\nconst OnClickActionSchema = {\n type: Type.OBJECT,\n properties: {\n kind: {\n type: Type.STRING,\n enum: [\"route\", \"back\", \"reload\", \"external\"],\n description:\n \"What happens when the element is clicked. 'route' navigates within the app, 'external' opens a URL, 'back' goes back, 'reload' refreshes.\",\n },\n href: {\n type: Type.STRING,\n description:\n \"URL to navigate to (used for kind='route' and kind='external').\",\n },\n replace: {\n type: Type.BOOLEAN,\n description: \"For kind='route': replace history instead of pushing.\",\n },\n newTab: {\n type: Type.BOOLEAN,\n description: \"For kind='external': open link in a new tab.\",\n },\n },\n required: [\"kind\"],\n};\n\n// Self-referential schema (children.items -> BuilderElementSchema)\nexport const BuilderElementSchema: any = {\n type: Type.OBJECT,\n properties: {\n type: {\n type: Type.STRING,\n enum: ELEMENT_TYPES,\n description:\n \"Element type to render. 'text' renders a <p>, 'image' renders an <img>, 'link' renders an <a>, 'icon' renders a Lucide icon, 'fragment' renders children only.\",\n },\n className: {\n type: Type.STRING,\n description:\n \"Tailwind CSS className applied to the rendered element (Tailwind only).\",\n },\n visible: {\n type: Type.BOOLEAN,\n description: \"Whether the element should be shown.\",\n },\n props: {\n type: Type.OBJECT,\n properties: {\n onClick: OnClickActionSchema,\n text: {\n type: Type.STRING,\n description:\n \"Text content used by 'text' (<p>), 'button' (label), and as a fallback for 'link' when it has no children.\",\n },\n href: {\n type: Type.STRING,\n description: \"For 'link': the href attribute (defaults to '#').\",\n },\n placeholder: {\n type: Type.STRING,\n description:\n \"For 'input' and 'textarea': placeholder shown when empty.\",\n },\n alt: {\n type: Type.STRING,\n description:\n \"For 'image': alt text for accessibility AND the query used to fetch a suitable Unsplash image (src is auto-resolved from alt).\",\n },\n target: {\n type: Type.STRING,\n description: \"For 'link': target attribute (e.g. '_blank').\",\n },\n rel: {\n type: Type.STRING,\n description: \"For 'link': rel attribute (e.g. 'noreferrer').\",\n },\n value: {\n type: Type.STRING,\n description:\n \"For 'input' and 'textarea': default value (maps to defaultValue).\",\n },\n type: {\n type: Type.STRING,\n description:\n \"For 'input': input type (e.g. 'text', 'email', 'password'). Defaults to 'text'.\",\n },\n\n // icon\n name: {\n type: Type.STRING,\n description:\n \"For 'icon': Lucide icon name (e.g. 'ArrowRight', 'Menu').\",\n },\n size: { type: Type.NUMBER, description: \"For 'icon': size in px.\" },\n color: { type: Type.STRING, description: \"For 'icon': stroke color.\" },\n strokeWidth: {\n type: Type.NUMBER,\n description: \"For 'icon': stroke width.\",\n },\n },\n },\n children: {\n type: Type.ARRAY,\n description:\n \"Nested children. Used by 'fragment' and 'div' directly, and by 'button'/'link' when present (otherwise they use props.text).\",\n items: {\n type: Type.OBJECT,\n },\n },\n },\n required: [\"type\"],\n};\n\nexport const InsertElementSchema = {\n name: \"insert_element\",\n description:\n \"Inserts element code. The element should be valid following the BuilderElement schema.\",\n parameters: {\n type: Type.OBJECT,\n properties: {\n route: {\n type: Type.STRING,\n description:\n \"The route to insert the element at. Example. '/' or '/about' etc.\",\n },\n parent_id: {\n type: Type.STRING,\n description: \"The parent id to insert the element at.\",\n },\n element: {\n ...BuilderElementSchema,\n description: \"The element to insert.\",\n },\n },\n required: [\"route\", \"parent_id\", \"element\"],\n },\n};\n"]}
|