@wix/ditto-codegen-public 1.0.75 → 1.0.77

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 +75 -69
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -120402,7 +120402,7 @@ var require_utils14 = __commonJS({
120402
120402
  return loadRelevantFiles(srcOnlyPaths, basePath).join("\n\n---\n\n");
120403
120403
  }
120404
120404
  var buildUserPromptForCodeGenerationAgent = (params, primaryAction) => {
120405
- const { extension, blueprint, scaffold, userRequestSummary, relevantFilePaths, planAndResources, basePath } = params;
120405
+ const { extension, blueprint, scaffold, userRequestSummary, relevantFilePaths, plan, basePath } = params;
120406
120406
  const contextSections = [];
120407
120407
  if (extension.name)
120408
120408
  contextSections.push(`Extension Name: ${extension.name}`);
@@ -120430,20 +120430,20 @@ Path: ${scaffold.path}
120430
120430
  ${scaffold.content}
120431
120431
  \`\`\``);
120432
120432
  }
120433
- if (planAndResources?.collections) {
120433
+ if (plan?.collections) {
120434
120434
  contextSections.push(`
120435
120435
  ## CREATED COLLECTIONS
120436
- ${JSON.stringify(planAndResources.collections, null, 2)}`);
120436
+ ${JSON.stringify(plan.collections, null, 2)}`);
120437
120437
  }
120438
- if (planAndResources?.apiSpec) {
120438
+ if (plan?.apiSpec) {
120439
120439
  contextSections.push(`
120440
120440
  ## API SPEC
120441
- ${JSON.stringify(planAndResources.apiSpec, null, 2)}`);
120441
+ ${JSON.stringify(plan.apiSpec, null, 2)}`);
120442
120442
  }
120443
- if (planAndResources?.embeddedScriptParameters) {
120443
+ if (plan?.embeddedScriptParameters) {
120444
120444
  contextSections.push(`
120445
120445
  ## EMBEDDED SCRIPT PARAMETERS
120446
- ${JSON.stringify(planAndResources.embeddedScriptParameters, null, 2)}`);
120446
+ ${JSON.stringify(plan.embeddedScriptParameters, null, 2)}`);
120447
120447
  }
120448
120448
  const userMessage = `${primaryAction}:
120449
120449
  ${contextSections.join("\n")}`;
@@ -120771,11 +120771,11 @@ var require_SPIAgent = __commonJS({
120771
120771
  return (0, servicePluginPrompt_1.getServicePluginPrompt)(spiNames, apiNames, useData);
120772
120772
  }
120773
120773
  async generate(params) {
120774
- const { extension, blueprint, planAndResources } = params;
120774
+ const { extension, blueprint, plan } = params;
120775
120775
  const examples = (0, load_examples_1.loadExamples)([load_examples_1.types.ServicePluginExtension]);
120776
120776
  const allSpiNames = extension.relatedSpis?.map((spi) => spi.name).filter((name) => !!name) || [];
120777
120777
  const apiNames = (0, utils_1.extractApiNames)(params.extension);
120778
- const useData = Boolean(planAndResources?.collections?.length);
120778
+ const useData = Boolean(plan?.collections?.length);
120779
120779
  const systemPrompt = `${this.buildSystemPrompt(allSpiNames, apiNames, useData)}
120780
120780
  ${examples}
120781
120781
  `;
@@ -121009,6 +121009,31 @@ var require_data = __commonJS({
121009
121009
  "use strict";
121010
121010
  Object.defineProperty(exports2, "__esModule", { value: true });
121011
121011
  exports2.cmsPlannerPrompt = void 0;
121012
+ var handlingFeesExample = {
121013
+ id: "handling-fees-rules",
121014
+ displayName: "Handling Fees Rules",
121015
+ displayField: "productId",
121016
+ fields: [
121017
+ {
121018
+ key: "productId",
121019
+ displayName: "Product",
121020
+ type: "REFERENCE",
121021
+ typeMetadata: {
121022
+ reference: {
121023
+ referencedCollectionId: "Stores/Products"
121024
+ }
121025
+ }
121026
+ },
121027
+ { key: "oversizedFee", displayName: "Oversized Fee", type: "NUMBER" },
121028
+ { key: "fragileFee", displayName: "Fragile Fee", type: "NUMBER" }
121029
+ ],
121030
+ dataPermissions: {
121031
+ itemRead: "ADMIN",
121032
+ itemInsert: "ADMIN",
121033
+ itemUpdate: "ADMIN",
121034
+ itemRemove: "ADMIN"
121035
+ }
121036
+ };
121012
121037
  var cmsPlannerPrompt = () => `
121013
121038
  <CMS_PLANNER_SYSTEM_PROMPT>
121014
121039
 
@@ -121059,29 +121084,9 @@ Your output must be strictly JSON that conforms to the provided schema (no markd
121059
121084
  Blueprint indicates a handling fees system for products.
121060
121085
 
121061
121086
  For the collections field, return:
121062
- [
121063
- {
121064
- "id": "handling-fees-rules",
121065
- "displayName": "Handling Fees Rules",
121066
- "displayField": "productId",
121067
- "fields": [
121068
- {
121069
- "key": "productId",
121070
- "displayName": "Product",
121071
- "type": "REFERENCE",
121072
- "typeMetadata": {
121073
- "reference": {
121074
- "referencedCollectionId": "Stores/Products"
121075
- }
121076
- }
121077
- },
121078
- { "key": "oversizedFee", "displayName": "Oversized Fee", "type": "NUMBER" },
121079
- { "key": "fragileFee", "displayName": "Fragile Fee", "type": "NUMBER" }
121080
- ],
121081
- "permissions": { "read": "ADMIN", "insert": "ADMIN", "update": "ADMIN", "remove": "ADMIN" },
121082
- "plugins": []
121083
- }
121084
- ]
121087
+ \`\`\`
121088
+ ${JSON.stringify(handlingFeesExample, null, 2)}
121089
+ \`\`\`
121085
121090
  </example>
121086
121091
 
121087
121092
  <approach>
@@ -121394,6 +121399,7 @@ var require_types_impl2 = __commonJS({
121394
121399
  FieldType2["LEGACY_IMAGE"] = "LEGACY_IMAGE";
121395
121400
  FieldType2["LEGACY_COLOR"] = "LEGACY_COLOR";
121396
121401
  FieldType2["LEGACY_EXTERNAL_VIDEO"] = "LEGACY_EXTERNAL_VIDEO";
121402
+ FieldType2["SLUG"] = "SLUG";
121397
121403
  })(FieldType = exports2.FieldType || (exports2.FieldType = {}));
121398
121404
  var QueryOperator;
121399
121405
  (function(QueryOperator2) {
@@ -121922,10 +121928,10 @@ var require_BackendEventAgent = __commonJS({
121922
121928
  return (0, backendEventPrompt_1.backendEventPrompt)(apiNames, useData);
121923
121929
  }
121924
121930
  async generate(params) {
121925
- const { blueprint, planAndResources } = params;
121931
+ const { blueprint, plan } = params;
121926
121932
  const examples = (0, load_examples_1.default)([load_examples_1.types.BackendEvent]);
121927
121933
  const allApiNames = (0, utils_1.extractApiNames)(params.extension);
121928
- const useData = Boolean(planAndResources?.collections?.length);
121934
+ const useData = Boolean(plan?.collections?.length);
121929
121935
  const systemPrompt = `${this.buildSystemPrompt(allApiNames, useData)}
121930
121936
  ${examples}
121931
121937
  `;
@@ -124070,11 +124076,11 @@ var require_DashboardPageAgent = __commonJS({
124070
124076
  return (0, dashboardPagePrompt_1.dashboardPagePrompt)(opts);
124071
124077
  }
124072
124078
  async generate(params) {
124073
- const { blueprint, planAndResources } = params;
124079
+ const { blueprint, plan } = params;
124074
124080
  const examples = (0, load_examples_1.loadExamples)([load_examples_1.types.DashboardPage]);
124075
- const useData = Boolean(planAndResources?.collections?.length);
124076
- const useApiSpec = Boolean(planAndResources?.apiSpec);
124077
- const useDynamicParameters = Boolean(planAndResources?.embeddedScriptParameters?.length);
124081
+ const useData = Boolean(plan?.collections?.length);
124082
+ const useApiSpec = Boolean(plan?.apiSpec);
124083
+ const useDynamicParameters = Boolean(plan?.embeddedScriptParameters?.length);
124078
124084
  const apiNames = (0, utils_1.extractApiNames)(params.extension);
124079
124085
  const systemPrompt = `${await this.buildSystemPrompt({ useData, useApiSpec, useDynamicParameters, apiNames })}
124080
124086
  ${examples}
@@ -124384,11 +124390,11 @@ var require_DashboardDecisionAgent = __commonJS({
124384
124390
  return (0, autoPatternPrompt_1.autoPatternDecisionPrompt)();
124385
124391
  }
124386
124392
  shouldNotUseAutoPatterns(params) {
124387
- const { blueprint, planAndResources } = params;
124393
+ const { blueprint, plan } = params;
124388
124394
  const hasEmbeddedScriptExtension = blueprint?.extensions?.some((ext) => ext.type === types_1.ExtensionType.EMBEDDED_SCRIPT) ?? false;
124389
124395
  const hasOneDashboardPageExtension = blueprint?.extensions?.filter((ext) => ext.type === types_1.ExtensionType.DASHBOARD_PAGE).length === 1;
124390
124396
  const shouldImplementEmbeddedScriptParameters = hasOneDashboardPageExtension && hasEmbeddedScriptExtension;
124391
- if (!planAndResources?.collections?.length || shouldImplementEmbeddedScriptParameters) {
124397
+ if (!plan?.collections?.length || shouldImplementEmbeddedScriptParameters) {
124392
124398
  return true;
124393
124399
  }
124394
124400
  return false;
@@ -125268,11 +125274,11 @@ var require_EmbeddedScriptAgent = __commonJS({
125268
125274
  return (0, embededScript_1.embeddedScriptPrompt)(hasDynamicParameters, apiNames, useData);
125269
125275
  }
125270
125276
  async generate(params) {
125271
- const { blueprint, planAndResources } = params;
125277
+ const { blueprint, plan } = params;
125272
125278
  const examples = (0, load_examples_1.loadExamples)([load_examples_1.types.EmbeddedScript]);
125273
- const hasDynamicParameters = Boolean(planAndResources?.embeddedScriptParameters && planAndResources.embeddedScriptParameters.length > 0);
125279
+ const hasDynamicParameters = Boolean(plan?.embeddedScriptParameters && plan.embeddedScriptParameters.length > 0);
125274
125280
  const apiNames = (0, utils_1.extractApiNames)(params.extension);
125275
- const useData = Boolean(planAndResources?.collections?.length);
125281
+ const useData = Boolean(plan?.collections?.length);
125276
125282
  const systemPrompt = `${this.buildSystemPrompt(hasDynamicParameters, apiNames, useData)}
125277
125283
  ${examples}
125278
125284
  `;
@@ -134836,8 +134842,8 @@ var require_cms = __commonJS({
134836
134842
  exports2.getDataExtensionAndCollectionsFiles = void 0;
134837
134843
  var path_1 = __importDefault2(require("path"));
134838
134844
  var crypto_1 = require("crypto");
134839
- var getDataExtensionAndCollectionsFiles = ({ planAndResources, appNamespace }) => {
134840
- if (!planAndResources.collections?.length) {
134845
+ var getDataExtensionAndCollectionsFiles = ({ plan, appNamespace }) => {
134846
+ if (!plan.collections?.length) {
134841
134847
  return [];
134842
134848
  }
134843
134849
  const files = [];
@@ -134851,7 +134857,7 @@ export const dataExtension = genericExtension({
134851
134857
  compType: 'DATA_COMPONENT',
134852
134858
  compData: {
134853
134859
  dataComponent: {
134854
- collections: [${planAndResources.collections.map((collection) => `{
134860
+ collections: [${plan.collections.map((collection) => `{
134855
134861
  id: '${path_1.default.join(appNamespace, collection.id ?? "no-collection-id")}',
134856
134862
  schemaUrl: '{{BASE_URL}}/collections/${collection.id}/schema.json',
134857
134863
  }`).join(",\n")}]
@@ -134860,7 +134866,7 @@ export const dataExtension = genericExtension({
134860
134866
  })
134861
134867
  `
134862
134868
  });
134863
- planAndResources.collections.forEach((collection) => {
134869
+ plan.collections.forEach((collection) => {
134864
134870
  if (!collection.id) {
134865
134871
  return;
134866
134872
  }
@@ -135047,7 +135053,7 @@ var require_orchestrator = __commonJS({
135047
135053
  }
135048
135054
  }
135049
135055
  }
135050
- async generatePlanAndResources(request) {
135056
+ async generatePlan(request) {
135051
135057
  const { blueprint } = request;
135052
135058
  this.emitEvent("planner:start", {});
135053
135059
  const planner = this.agentsFactory.getAgent({ type: "PLANNER" });
@@ -135065,14 +135071,14 @@ var require_orchestrator = __commonJS({
135065
135071
  const iterationPlan = await iterationAgent.generate(outputPath, candidateFiles, currentUserRequest, chatHistory);
135066
135072
  return iterationPlan;
135067
135073
  }
135068
- async processExtension({ extension, blueprint, outputPath, planAndResources, appNamespace }) {
135074
+ async processExtension({ extension, blueprint, outputPath, plan, appNamespace }) {
135069
135075
  switch (extension.type) {
135070
135076
  case types_1.ExtensionType.DASHBOARD_PAGE:
135071
135077
  return this.processDashboardPage({
135072
135078
  extension,
135073
135079
  blueprint,
135074
135080
  outputPath,
135075
- planAndResources,
135081
+ plan,
135076
135082
  appNamespace
135077
135083
  });
135078
135084
  case types_1.ExtensionType.SERVICE_PLUGIN:
@@ -135080,26 +135086,26 @@ var require_orchestrator = __commonJS({
135080
135086
  extension,
135081
135087
  blueprint,
135082
135088
  outputPath,
135083
- planAndResources
135089
+ plan
135084
135090
  });
135085
135091
  case types_1.ExtensionType.EMBEDDED_SCRIPT:
135086
135092
  return this.processEmbeddedScript({
135087
135093
  extension,
135088
135094
  blueprint,
135089
135095
  outputPath,
135090
- planAndResources
135096
+ plan
135091
135097
  });
135092
135098
  default:
135093
135099
  return this.processStandardExtension({
135094
135100
  extension,
135095
135101
  blueprint,
135096
135102
  outputPath,
135097
- planAndResources
135103
+ plan
135098
135104
  });
135099
135105
  }
135100
135106
  }
135101
135107
  async processEmbeddedScript(opts) {
135102
- const { extension, blueprint, outputPath, planAndResources } = opts;
135108
+ const { extension, blueprint, outputPath, plan } = opts;
135103
135109
  this.emitEvent("scaffold:start", { extension });
135104
135110
  const scaffolds = await (0, ditto_scaffolding_1.copyScaffoldingTemplate)(extension, outputPath);
135105
135111
  if (!scaffolds || scaffolds.length === 0) {
@@ -135122,7 +135128,7 @@ var require_orchestrator = __commonJS({
135122
135128
  blueprint,
135123
135129
  scaffold,
135124
135130
  basePath: outputPath,
135125
- planAndResources
135131
+ plan
135126
135132
  });
135127
135133
  this.finalizeExtensionGeneration({
135128
135134
  extension,
@@ -135139,14 +135145,14 @@ var require_orchestrator = __commonJS({
135139
135145
  });
135140
135146
  }
135141
135147
  async processDashboardPage(opts) {
135142
- const { extension, blueprint, outputPath, planAndResources, appNamespace } = opts;
135148
+ const { extension, blueprint, outputPath, plan, appNamespace } = opts;
135143
135149
  const decisionAgent = this.agentsFactory.getAgent({
135144
135150
  type: "DASHBOARD_DECISION"
135145
135151
  });
135146
135152
  const decision = await decisionAgent.generate({
135147
135153
  extension,
135148
135154
  blueprint,
135149
- planAndResources,
135155
+ plan,
135150
135156
  basePath: outputPath
135151
135157
  });
135152
135158
  const useAutoPatterns = decision.useAutoPatterns && decision.schema && decision.relevantCollectionId;
@@ -135156,7 +135162,7 @@ var require_orchestrator = __commonJS({
135156
135162
  return;
135157
135163
  }
135158
135164
  console.log("\u{1F3AF} Using auto-patterns for dashboard generation");
135159
- const relevantCollection = planAndResources.collections?.find((c) => c.id === decision.relevantCollectionId);
135165
+ const relevantCollection = plan.collections?.find((c) => c.id === decision.relevantCollectionId);
135160
135166
  if (!relevantCollection) {
135161
135167
  throw new Error(`\u274C Collection with ID ${decision.relevantCollectionId} not found in created collections`);
135162
135168
  }
@@ -135182,7 +135188,7 @@ var require_orchestrator = __commonJS({
135182
135188
  outputPath
135183
135189
  });
135184
135190
  }
135185
- async processServicePlugin({ extension, blueprint, outputPath, planAndResources }) {
135191
+ async processServicePlugin({ extension, blueprint, outputPath, plan }) {
135186
135192
  this.emitEvent("scaffold:start", { extension });
135187
135193
  const scaffolds = await (0, ditto_scaffolding_1.copyScaffoldingTemplate)(extension, outputPath);
135188
135194
  if (!scaffolds || scaffolds.length === 0) {
@@ -135197,7 +135203,7 @@ var require_orchestrator = __commonJS({
135197
135203
  extension,
135198
135204
  blueprint,
135199
135205
  outputPath,
135200
- planAndResources,
135206
+ plan,
135201
135207
  scaffolds
135202
135208
  });
135203
135209
  }
@@ -135208,7 +135214,7 @@ var require_orchestrator = __commonJS({
135208
135214
  extension,
135209
135215
  blueprint,
135210
135216
  scaffold,
135211
- planAndResources,
135217
+ plan,
135212
135218
  basePath: outputPath
135213
135219
  });
135214
135220
  this.finalizeExtensionGeneration({
@@ -135220,7 +135226,7 @@ var require_orchestrator = __commonJS({
135220
135226
  outputPath
135221
135227
  });
135222
135228
  }
135223
- async processStandardExtension({ extension, blueprint, outputPath, planAndResources }) {
135229
+ async processStandardExtension({ extension, blueprint, outputPath, plan }) {
135224
135230
  this.emitEvent("scaffold:start", { extension });
135225
135231
  const scaffolds = await (0, ditto_scaffolding_1.copyScaffoldingTemplate)(extension, outputPath);
135226
135232
  if (!scaffolds || scaffolds.length === 0) {
@@ -135237,7 +135243,7 @@ var require_orchestrator = __commonJS({
135237
135243
  extension,
135238
135244
  blueprint,
135239
135245
  scaffold,
135240
- planAndResources,
135246
+ plan,
135241
135247
  basePath: outputPath
135242
135248
  });
135243
135249
  this.finalizeExtensionGeneration({
@@ -135249,7 +135255,7 @@ var require_orchestrator = __commonJS({
135249
135255
  outputPath
135250
135256
  });
135251
135257
  }
135252
- async processMultipleServicePluginScaffolds({ extension, blueprint, outputPath, planAndResources, scaffolds }) {
135258
+ async processMultipleServicePluginScaffolds({ extension, blueprint, outputPath, plan, scaffolds }) {
135253
135259
  if (!extension.relatedSpis || extension.relatedSpis.length === 0) {
135254
135260
  throw new Error("Service plugin extension must have related SPIs");
135255
135261
  }
@@ -135271,7 +135277,7 @@ var require_orchestrator = __commonJS({
135271
135277
  extension: spiExtension,
135272
135278
  blueprint,
135273
135279
  scaffold,
135274
- planAndResources,
135280
+ plan,
135275
135281
  basePath: outputPath
135276
135282
  });
135277
135283
  this.finalizeExtensionGeneration({
@@ -135303,7 +135309,7 @@ var require_orchestrator = __commonJS({
135303
135309
  blueprint: { extensions: [], appName: "", summary: "" },
135304
135310
  // Minimal blueprint for iteration
135305
135311
  outputPath,
135306
- planAndResources: { collections: [] },
135312
+ plan: { collections: [], embeddedScriptParameters: [] },
135307
135313
  scaffolds
135308
135314
  });
135309
135315
  return;
@@ -135353,9 +135359,9 @@ var require_orchestrator = __commonJS({
135353
135359
  });
135354
135360
  const start = Date.now();
135355
135361
  const { extensions = [] } = blueprint;
135356
- const planAndResources = await this.generatePlanAndResources(request);
135362
+ const plan = await this.generatePlan(request);
135357
135363
  const cmsFiles = (0, cms_1.getDataExtensionAndCollectionsFiles)({
135358
- planAndResources,
135364
+ plan,
135359
135365
  appNamespace
135360
135366
  });
135361
135367
  if (cmsFiles.length > 0) {
@@ -135365,7 +135371,7 @@ var require_orchestrator = __commonJS({
135365
135371
  extension,
135366
135372
  blueprint,
135367
135373
  outputPath,
135368
- planAndResources,
135374
+ plan,
135369
135375
  appNamespace
135370
135376
  }));
135371
135377
  const results = await Promise.allSettled(parallelTasks.filter(Boolean));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.75",
3
+ "version": "1.0.77",
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": "17f10120e0b81b15a7617e0788e6295b4163b23a8d404d6680cfa78a"
27
+ "falconPackageHash": "39de4b253a03dacd49bae35c389b55f137b38470f98561f2505f8053"
28
28
  }