@wix/ditto-codegen-public 1.0.106 → 1.0.107

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.
@@ -63372,12 +63372,12 @@ function attachOrchestratorListeners(eventEmitter) {
63372
63372
  timer.delete("PlannerAgent");
63373
63373
  console.log(`\u{1F916}\u2714\uFE0F Generated plan in ${duration3 / 1e3}s`);
63374
63374
  });
63375
- eventEmitter.onEvent("iterationAgent:start", () => {
63375
+ eventEmitter.onEvent("iterationPlanAgent:start", () => {
63376
63376
  timer.set("IterationAgent", Date.now());
63377
63377
  console.log("\u{1F916} Generating iteration plan...");
63378
63378
  });
63379
63379
  eventEmitter.onEvent(
63380
- "iterationAgent:done",
63380
+ "iterationPlanAgent:done",
63381
63381
  ({ newExtensions, currentExtensions }) => {
63382
63382
  const duration3 = Date.now() - timer.get("IterationAgent");
63383
63383
  timer.delete("IterationAgent");
@@ -65072,22 +65072,27 @@ var IterationOrchestrator = class extends DittoEventEmitter {
65072
65072
  this.agentsFactory = agentsFactory;
65073
65073
  this.apiKey = apiKey;
65074
65074
  }
65075
- /**
65076
- * Main entry point for iteration code generation
65077
- */
65078
- async generateIterationCode(request) {
65075
+ async getIterationPlan(request) {
65079
65076
  this.emitEvent("start:iteration", {});
65080
- const { outputPath, chatHistory, appNamespace } = request;
65081
- const start = Date.now();
65082
- this.emitEvent("iterationAgent:start", {});
65077
+ const { outputPath, chatHistory } = request;
65078
+ this.emitEvent("iterationPlanAgent:start", {});
65083
65079
  const iterationPlan = await this.runIterationPlanning(
65084
65080
  outputPath,
65085
65081
  chatHistory
65086
65082
  );
65087
- this.emitEvent("iterationAgent:done", {
65083
+ this.emitEvent("iterationPlanAgent:done", {
65088
65084
  newExtensions: iterationPlan?.additionalExtensions?.length || 0,
65089
65085
  currentExtensions: iterationPlan?.currentExtensions?.length || 0
65090
65086
  });
65087
+ return iterationPlan;
65088
+ }
65089
+ /**
65090
+ * Main entry point for iteration code generation
65091
+ */
65092
+ async generateIterationCode(request) {
65093
+ const startTime = Date.now();
65094
+ const { outputPath, appNamespace, iterationPlan } = request;
65095
+ this.emitEvent("start:code-generation", {});
65091
65096
  const newExtensions = iterationPlan?.additionalExtensions?.map((ext) => ext.extension) || [];
65092
65097
  const currentExtensions = iterationPlan?.currentExtensions?.map((ext) => ext.extension) || [];
65093
65098
  const plan = await this.generatePlan(
@@ -65143,7 +65148,7 @@ var IterationOrchestrator = class extends DittoEventEmitter {
65143
65148
  const results = await Promise.allSettled(parallelTasks.filter(Boolean));
65144
65149
  throwIfFailures(results);
65145
65150
  await generateMainExtensionsFile(outputPath);
65146
- const durationMsCodeGeneration = Date.now() - start;
65151
+ const durationMsCodeGeneration = Date.now() - startTime;
65147
65152
  this.emitEvent("finish:code-generation", {
65148
65153
  outputPath,
65149
65154
  durationMs: durationMsCodeGeneration
@@ -65155,9 +65160,8 @@ var IterationOrchestrator = class extends DittoEventEmitter {
65155
65160
  },
65156
65161
  this
65157
65162
  );
65158
- const durationMs = Date.now() - start;
65163
+ const durationMs = Date.now() - startTime;
65159
65164
  this.emitEvent("finish:iteration", { outputPath, durationMs });
65160
- return iterationPlan;
65161
65165
  }
65162
65166
  /**
65163
65167
  * Run iteration planning to determine which extensions to create/update
@@ -65314,36 +65318,18 @@ var runIterateCodegenFlow = async (chatHistory) => {
65314
65318
  );
65315
65319
  setupAgentTaskTracking(iterationOrchestrator, localJobContext);
65316
65320
  attachOrchestratorListeners(iterationOrchestrator);
65317
- const iterationPlan = await iterationOrchestrator.generateIterationCode({
65318
- chatHistory,
65321
+ const iterationPlan = await iterationOrchestrator.getIterationPlan({
65322
+ outputPath,
65323
+ chatHistory
65324
+ });
65325
+ await updateRequiredPermissions(iterationPlan, localJobContext);
65326
+ await iterationOrchestrator.generateIterationCode({
65319
65327
  outputPath,
65320
65328
  siteId: ctx.siteId,
65321
65329
  accessToken: ctx.accessToken,
65322
- appNamespace: ctx.appNamespace
65330
+ appNamespace: ctx.appNamespace,
65331
+ iterationPlan
65323
65332
  });
65324
- try {
65325
- const requiredPermissionsResponse = await getRequiredPermissions([
65326
- ...iterationPlan.additionalExtensions.map(
65327
- (extension) => extension.extension
65328
- ),
65329
- ...iterationPlan.currentExtensions.map(
65330
- (extension) => extension.extension
65331
- )
65332
- ]);
65333
- await updateJobPayload(localJobContext, {
65334
- requiredPermissions: requiredPermissionsResponse?.data?.requiredPermissions ?? []
65335
- });
65336
- } catch (error46) {
65337
- const codegenError = (0, import_ditto_codegen_types24.toCodegenError)(error46);
65338
- console.error(
65339
- `\u274C [Iterate] Failed to get required permissions: jobId=${localJobContext.jobId}, taskId=${localJobContext.taskId}`,
65340
- error46
65341
- );
65342
- await updateJobPayload(localJobContext, {
65343
- requiredPermissions: [],
65344
- requiredPermissionsErrors: codegenError
65345
- });
65346
- }
65347
65333
  await updateParentTaskStatus(localJobContext, import_ditto_codegen_types23.Status.COMPLETED);
65348
65334
  console.log(
65349
65335
  `[Init] Completed iterate codegen task: jobId=${localJobContext.jobId}, taskId=${localJobContext.taskId}`
@@ -65357,6 +65343,31 @@ var runIterateCodegenFlow = async (chatHistory) => {
65357
65343
  );
65358
65344
  }
65359
65345
  };
65346
+ async function updateRequiredPermissions(iterationPlan, localJobContext) {
65347
+ try {
65348
+ const requiredPermissionsResponse = await getRequiredPermissions([
65349
+ ...iterationPlan.additionalExtensions.map(
65350
+ (extension) => extension.extension
65351
+ ),
65352
+ ...iterationPlan.currentExtensions.map(
65353
+ (extension) => extension.extension
65354
+ )
65355
+ ]);
65356
+ await updateJobPayload(localJobContext, {
65357
+ requiredPermissions: requiredPermissionsResponse?.data?.requiredPermissions ?? []
65358
+ });
65359
+ } catch (error46) {
65360
+ const codegenError = (0, import_ditto_codegen_types24.toCodegenError)(error46);
65361
+ console.error(
65362
+ `\u274C [Iterate] Failed to get required permissions: jobId=${localJobContext.jobId}, taskId=${localJobContext.taskId}`,
65363
+ error46
65364
+ );
65365
+ await updateJobPayload(localJobContext, {
65366
+ requiredPermissions: [],
65367
+ requiredPermissionsErrors: codegenError
65368
+ });
65369
+ }
65370
+ }
65360
65371
 
65361
65372
  // src/runCodegenFlow.ts
65362
65373
  async function runCodegenFlow() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.106",
3
+ "version": "1.0.107",
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": "bd5e3a8ebc7655e138d99a8a9832e011637e7344963d6886d5840e88"
27
+ "falconPackageHash": "8ee39d55939afdd14344a74a7a4f50e452e76710f780631012bf636b"
28
28
  }