@wix/ditto-codegen-public 1.0.81 → 1.0.82

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 (2) hide show
  1. package/dist/out.js +27 -5
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -117225,22 +117225,27 @@ var require_PlannerAgent = __commonJS({
117225
117225
  buildSystemPrompt(hasEmbeddedScriptExtensions, hasBackendApiExtensions) {
117226
117226
  return (0, planner_1.plannerPrompt)(hasEmbeddedScriptExtensions, hasBackendApiExtensions);
117227
117227
  }
117228
- async generate(blueprint) {
117228
+ async generatePlan(systemPrompt, blueprint, error) {
117229
117229
  const model = (0, anthropic_1.createAnthropic)({ apiKey: this.apiKey })("claude-3-5-haiku-latest");
117230
- const hasEmbeddedScriptExtensions = blueprint?.extensions?.some((ext) => ext.type === types_1.ExtensionType.EMBEDDED_SCRIPT) ?? false;
117231
- const hasBackendApiExtensions = blueprint?.extensions?.some((ext) => ext.type === types_1.ExtensionType.BACKEND_API) ?? false;
117230
+ const userContent = `
117231
+ ${JSON.stringify(blueprint, null, 2)}
117232
+ ${error ? `
117233
+
117234
+ The previous attempt failed with the following error:
117235
+ ${error}` : ""}
117236
+ `;
117232
117237
  const result = await (0, ai_1.generateObject)({
117233
117238
  model,
117234
117239
  schema: exports2.PlannerOutputSchema,
117235
117240
  messages: [
117236
117241
  {
117237
117242
  role: "system",
117238
- content: this.buildSystemPrompt(hasEmbeddedScriptExtensions, hasBackendApiExtensions),
117243
+ content: systemPrompt,
117239
117244
  providerOptions: (0, utils_1.withCaching)("1h")
117240
117245
  },
117241
117246
  {
117242
117247
  role: "user",
117243
- content: JSON.stringify(blueprint ?? {}, null, 2)
117248
+ content: userContent
117244
117249
  }
117245
117250
  ],
117246
117251
  maxRetries: 3,
@@ -117252,6 +117257,23 @@ var require_PlannerAgent = __commonJS({
117252
117257
  });
117253
117258
  return result.object;
117254
117259
  }
117260
+ async generate(blueprint) {
117261
+ const hasEmbeddedScriptExtensions = blueprint?.extensions?.some((ext) => ext.type === types_1.ExtensionType.EMBEDDED_SCRIPT) ?? false;
117262
+ const hasBackendApiExtensions = blueprint?.extensions?.some((ext) => ext.type === types_1.ExtensionType.BACKEND_API) ?? false;
117263
+ const systemPrompt = this.buildSystemPrompt(hasEmbeddedScriptExtensions, hasBackendApiExtensions);
117264
+ let lastError;
117265
+ for (let i = 0; i < 3; i++) {
117266
+ try {
117267
+ const result = await this.generatePlan(systemPrompt, blueprint, lastError);
117268
+ return result;
117269
+ } catch (error) {
117270
+ lastError = JSON.stringify(error);
117271
+ console.error(`Error generating plan (attempt ${i + 1}): ${error}`);
117272
+ continue;
117273
+ }
117274
+ }
117275
+ throw new Error("Failed to generate plan after 3 attempts");
117276
+ }
117255
117277
  };
117256
117278
  exports2.PlannerAgent = PlannerAgent;
117257
117279
  exports2.default = PlannerAgent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.81",
3
+ "version": "1.0.82",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -24,5 +24,5 @@
24
24
  "@wix/ditto-codegen": "1.0.0",
25
25
  "esbuild": "^0.25.9"
26
26
  },
27
- "falconPackageHash": "2aebcac759bbd4ac3c62996647812ea539fd3a3a3afd3ea322df2c92"
27
+ "falconPackageHash": "bebe8a998a17363ae3f2de3f1d27892e5fab98ae892c11027d5d1aa0"
28
28
  }