@wix/ditto-codegen-public 1.0.76 → 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 +74 -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>
@@ -121923,10 +121928,10 @@ var require_BackendEventAgent = __commonJS({
121923
121928
  return (0, backendEventPrompt_1.backendEventPrompt)(apiNames, useData);
121924
121929
  }
121925
121930
  async generate(params) {
121926
- const { blueprint, planAndResources } = params;
121931
+ const { blueprint, plan } = params;
121927
121932
  const examples = (0, load_examples_1.default)([load_examples_1.types.BackendEvent]);
121928
121933
  const allApiNames = (0, utils_1.extractApiNames)(params.extension);
121929
- const useData = Boolean(planAndResources?.collections?.length);
121934
+ const useData = Boolean(plan?.collections?.length);
121930
121935
  const systemPrompt = `${this.buildSystemPrompt(allApiNames, useData)}
121931
121936
  ${examples}
121932
121937
  `;
@@ -124071,11 +124076,11 @@ var require_DashboardPageAgent = __commonJS({
124071
124076
  return (0, dashboardPagePrompt_1.dashboardPagePrompt)(opts);
124072
124077
  }
124073
124078
  async generate(params) {
124074
- const { blueprint, planAndResources } = params;
124079
+ const { blueprint, plan } = params;
124075
124080
  const examples = (0, load_examples_1.loadExamples)([load_examples_1.types.DashboardPage]);
124076
- const useData = Boolean(planAndResources?.collections?.length);
124077
- const useApiSpec = Boolean(planAndResources?.apiSpec);
124078
- 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);
124079
124084
  const apiNames = (0, utils_1.extractApiNames)(params.extension);
124080
124085
  const systemPrompt = `${await this.buildSystemPrompt({ useData, useApiSpec, useDynamicParameters, apiNames })}
124081
124086
  ${examples}
@@ -124385,11 +124390,11 @@ var require_DashboardDecisionAgent = __commonJS({
124385
124390
  return (0, autoPatternPrompt_1.autoPatternDecisionPrompt)();
124386
124391
  }
124387
124392
  shouldNotUseAutoPatterns(params) {
124388
- const { blueprint, planAndResources } = params;
124393
+ const { blueprint, plan } = params;
124389
124394
  const hasEmbeddedScriptExtension = blueprint?.extensions?.some((ext) => ext.type === types_1.ExtensionType.EMBEDDED_SCRIPT) ?? false;
124390
124395
  const hasOneDashboardPageExtension = blueprint?.extensions?.filter((ext) => ext.type === types_1.ExtensionType.DASHBOARD_PAGE).length === 1;
124391
124396
  const shouldImplementEmbeddedScriptParameters = hasOneDashboardPageExtension && hasEmbeddedScriptExtension;
124392
- if (!planAndResources?.collections?.length || shouldImplementEmbeddedScriptParameters) {
124397
+ if (!plan?.collections?.length || shouldImplementEmbeddedScriptParameters) {
124393
124398
  return true;
124394
124399
  }
124395
124400
  return false;
@@ -125269,11 +125274,11 @@ var require_EmbeddedScriptAgent = __commonJS({
125269
125274
  return (0, embededScript_1.embeddedScriptPrompt)(hasDynamicParameters, apiNames, useData);
125270
125275
  }
125271
125276
  async generate(params) {
125272
- const { blueprint, planAndResources } = params;
125277
+ const { blueprint, plan } = params;
125273
125278
  const examples = (0, load_examples_1.loadExamples)([load_examples_1.types.EmbeddedScript]);
125274
- const hasDynamicParameters = Boolean(planAndResources?.embeddedScriptParameters && planAndResources.embeddedScriptParameters.length > 0);
125279
+ const hasDynamicParameters = Boolean(plan?.embeddedScriptParameters && plan.embeddedScriptParameters.length > 0);
125275
125280
  const apiNames = (0, utils_1.extractApiNames)(params.extension);
125276
- const useData = Boolean(planAndResources?.collections?.length);
125281
+ const useData = Boolean(plan?.collections?.length);
125277
125282
  const systemPrompt = `${this.buildSystemPrompt(hasDynamicParameters, apiNames, useData)}
125278
125283
  ${examples}
125279
125284
  `;
@@ -134837,8 +134842,8 @@ var require_cms = __commonJS({
134837
134842
  exports2.getDataExtensionAndCollectionsFiles = void 0;
134838
134843
  var path_1 = __importDefault2(require("path"));
134839
134844
  var crypto_1 = require("crypto");
134840
- var getDataExtensionAndCollectionsFiles = ({ planAndResources, appNamespace }) => {
134841
- if (!planAndResources.collections?.length) {
134845
+ var getDataExtensionAndCollectionsFiles = ({ plan, appNamespace }) => {
134846
+ if (!plan.collections?.length) {
134842
134847
  return [];
134843
134848
  }
134844
134849
  const files = [];
@@ -134852,7 +134857,7 @@ export const dataExtension = genericExtension({
134852
134857
  compType: 'DATA_COMPONENT',
134853
134858
  compData: {
134854
134859
  dataComponent: {
134855
- collections: [${planAndResources.collections.map((collection) => `{
134860
+ collections: [${plan.collections.map((collection) => `{
134856
134861
  id: '${path_1.default.join(appNamespace, collection.id ?? "no-collection-id")}',
134857
134862
  schemaUrl: '{{BASE_URL}}/collections/${collection.id}/schema.json',
134858
134863
  }`).join(",\n")}]
@@ -134861,7 +134866,7 @@ export const dataExtension = genericExtension({
134861
134866
  })
134862
134867
  `
134863
134868
  });
134864
- planAndResources.collections.forEach((collection) => {
134869
+ plan.collections.forEach((collection) => {
134865
134870
  if (!collection.id) {
134866
134871
  return;
134867
134872
  }
@@ -135048,7 +135053,7 @@ var require_orchestrator = __commonJS({
135048
135053
  }
135049
135054
  }
135050
135055
  }
135051
- async generatePlanAndResources(request) {
135056
+ async generatePlan(request) {
135052
135057
  const { blueprint } = request;
135053
135058
  this.emitEvent("planner:start", {});
135054
135059
  const planner = this.agentsFactory.getAgent({ type: "PLANNER" });
@@ -135066,14 +135071,14 @@ var require_orchestrator = __commonJS({
135066
135071
  const iterationPlan = await iterationAgent.generate(outputPath, candidateFiles, currentUserRequest, chatHistory);
135067
135072
  return iterationPlan;
135068
135073
  }
135069
- async processExtension({ extension, blueprint, outputPath, planAndResources, appNamespace }) {
135074
+ async processExtension({ extension, blueprint, outputPath, plan, appNamespace }) {
135070
135075
  switch (extension.type) {
135071
135076
  case types_1.ExtensionType.DASHBOARD_PAGE:
135072
135077
  return this.processDashboardPage({
135073
135078
  extension,
135074
135079
  blueprint,
135075
135080
  outputPath,
135076
- planAndResources,
135081
+ plan,
135077
135082
  appNamespace
135078
135083
  });
135079
135084
  case types_1.ExtensionType.SERVICE_PLUGIN:
@@ -135081,26 +135086,26 @@ var require_orchestrator = __commonJS({
135081
135086
  extension,
135082
135087
  blueprint,
135083
135088
  outputPath,
135084
- planAndResources
135089
+ plan
135085
135090
  });
135086
135091
  case types_1.ExtensionType.EMBEDDED_SCRIPT:
135087
135092
  return this.processEmbeddedScript({
135088
135093
  extension,
135089
135094
  blueprint,
135090
135095
  outputPath,
135091
- planAndResources
135096
+ plan
135092
135097
  });
135093
135098
  default:
135094
135099
  return this.processStandardExtension({
135095
135100
  extension,
135096
135101
  blueprint,
135097
135102
  outputPath,
135098
- planAndResources
135103
+ plan
135099
135104
  });
135100
135105
  }
135101
135106
  }
135102
135107
  async processEmbeddedScript(opts) {
135103
- const { extension, blueprint, outputPath, planAndResources } = opts;
135108
+ const { extension, blueprint, outputPath, plan } = opts;
135104
135109
  this.emitEvent("scaffold:start", { extension });
135105
135110
  const scaffolds = await (0, ditto_scaffolding_1.copyScaffoldingTemplate)(extension, outputPath);
135106
135111
  if (!scaffolds || scaffolds.length === 0) {
@@ -135123,7 +135128,7 @@ var require_orchestrator = __commonJS({
135123
135128
  blueprint,
135124
135129
  scaffold,
135125
135130
  basePath: outputPath,
135126
- planAndResources
135131
+ plan
135127
135132
  });
135128
135133
  this.finalizeExtensionGeneration({
135129
135134
  extension,
@@ -135140,14 +135145,14 @@ var require_orchestrator = __commonJS({
135140
135145
  });
135141
135146
  }
135142
135147
  async processDashboardPage(opts) {
135143
- const { extension, blueprint, outputPath, planAndResources, appNamespace } = opts;
135148
+ const { extension, blueprint, outputPath, plan, appNamespace } = opts;
135144
135149
  const decisionAgent = this.agentsFactory.getAgent({
135145
135150
  type: "DASHBOARD_DECISION"
135146
135151
  });
135147
135152
  const decision = await decisionAgent.generate({
135148
135153
  extension,
135149
135154
  blueprint,
135150
- planAndResources,
135155
+ plan,
135151
135156
  basePath: outputPath
135152
135157
  });
135153
135158
  const useAutoPatterns = decision.useAutoPatterns && decision.schema && decision.relevantCollectionId;
@@ -135157,7 +135162,7 @@ var require_orchestrator = __commonJS({
135157
135162
  return;
135158
135163
  }
135159
135164
  console.log("\u{1F3AF} Using auto-patterns for dashboard generation");
135160
- const relevantCollection = planAndResources.collections?.find((c) => c.id === decision.relevantCollectionId);
135165
+ const relevantCollection = plan.collections?.find((c) => c.id === decision.relevantCollectionId);
135161
135166
  if (!relevantCollection) {
135162
135167
  throw new Error(`\u274C Collection with ID ${decision.relevantCollectionId} not found in created collections`);
135163
135168
  }
@@ -135183,7 +135188,7 @@ var require_orchestrator = __commonJS({
135183
135188
  outputPath
135184
135189
  });
135185
135190
  }
135186
- async processServicePlugin({ extension, blueprint, outputPath, planAndResources }) {
135191
+ async processServicePlugin({ extension, blueprint, outputPath, plan }) {
135187
135192
  this.emitEvent("scaffold:start", { extension });
135188
135193
  const scaffolds = await (0, ditto_scaffolding_1.copyScaffoldingTemplate)(extension, outputPath);
135189
135194
  if (!scaffolds || scaffolds.length === 0) {
@@ -135198,7 +135203,7 @@ var require_orchestrator = __commonJS({
135198
135203
  extension,
135199
135204
  blueprint,
135200
135205
  outputPath,
135201
- planAndResources,
135206
+ plan,
135202
135207
  scaffolds
135203
135208
  });
135204
135209
  }
@@ -135209,7 +135214,7 @@ var require_orchestrator = __commonJS({
135209
135214
  extension,
135210
135215
  blueprint,
135211
135216
  scaffold,
135212
- planAndResources,
135217
+ plan,
135213
135218
  basePath: outputPath
135214
135219
  });
135215
135220
  this.finalizeExtensionGeneration({
@@ -135221,7 +135226,7 @@ var require_orchestrator = __commonJS({
135221
135226
  outputPath
135222
135227
  });
135223
135228
  }
135224
- async processStandardExtension({ extension, blueprint, outputPath, planAndResources }) {
135229
+ async processStandardExtension({ extension, blueprint, outputPath, plan }) {
135225
135230
  this.emitEvent("scaffold:start", { extension });
135226
135231
  const scaffolds = await (0, ditto_scaffolding_1.copyScaffoldingTemplate)(extension, outputPath);
135227
135232
  if (!scaffolds || scaffolds.length === 0) {
@@ -135238,7 +135243,7 @@ var require_orchestrator = __commonJS({
135238
135243
  extension,
135239
135244
  blueprint,
135240
135245
  scaffold,
135241
- planAndResources,
135246
+ plan,
135242
135247
  basePath: outputPath
135243
135248
  });
135244
135249
  this.finalizeExtensionGeneration({
@@ -135250,7 +135255,7 @@ var require_orchestrator = __commonJS({
135250
135255
  outputPath
135251
135256
  });
135252
135257
  }
135253
- async processMultipleServicePluginScaffolds({ extension, blueprint, outputPath, planAndResources, scaffolds }) {
135258
+ async processMultipleServicePluginScaffolds({ extension, blueprint, outputPath, plan, scaffolds }) {
135254
135259
  if (!extension.relatedSpis || extension.relatedSpis.length === 0) {
135255
135260
  throw new Error("Service plugin extension must have related SPIs");
135256
135261
  }
@@ -135272,7 +135277,7 @@ var require_orchestrator = __commonJS({
135272
135277
  extension: spiExtension,
135273
135278
  blueprint,
135274
135279
  scaffold,
135275
- planAndResources,
135280
+ plan,
135276
135281
  basePath: outputPath
135277
135282
  });
135278
135283
  this.finalizeExtensionGeneration({
@@ -135304,7 +135309,7 @@ var require_orchestrator = __commonJS({
135304
135309
  blueprint: { extensions: [], appName: "", summary: "" },
135305
135310
  // Minimal blueprint for iteration
135306
135311
  outputPath,
135307
- planAndResources: { collections: [] },
135312
+ plan: { collections: [], embeddedScriptParameters: [] },
135308
135313
  scaffolds
135309
135314
  });
135310
135315
  return;
@@ -135354,9 +135359,9 @@ var require_orchestrator = __commonJS({
135354
135359
  });
135355
135360
  const start = Date.now();
135356
135361
  const { extensions = [] } = blueprint;
135357
- const planAndResources = await this.generatePlanAndResources(request);
135362
+ const plan = await this.generatePlan(request);
135358
135363
  const cmsFiles = (0, cms_1.getDataExtensionAndCollectionsFiles)({
135359
- planAndResources,
135364
+ plan,
135360
135365
  appNamespace
135361
135366
  });
135362
135367
  if (cmsFiles.length > 0) {
@@ -135366,7 +135371,7 @@ var require_orchestrator = __commonJS({
135366
135371
  extension,
135367
135372
  blueprint,
135368
135373
  outputPath,
135369
- planAndResources,
135374
+ plan,
135370
135375
  appNamespace
135371
135376
  }));
135372
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.76",
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": "b762e36552a30039ed74798d01c90105e5218b4685beb87b5a7c61f5"
27
+ "falconPackageHash": "39de4b253a03dacd49bae35c389b55f137b38470f98561f2505f8053"
28
28
  }