@wix/ditto-codegen-public 1.0.435 → 1.0.436

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 +71 -68
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -17449,36 +17449,6 @@ var require_OpenCodeOrchestrator = __commonJS({
17449
17449
  }
17450
17450
  });
17451
17451
 
17452
- // dist/flows/codegen-flow-helpers.js
17453
- var require_codegen_flow_helpers = __commonJS({
17454
- "dist/flows/codegen-flow-helpers.js"(exports2) {
17455
- "use strict";
17456
- var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
17457
- return mod && mod.__esModule ? mod : { "default": mod };
17458
- };
17459
- Object.defineProperty(exports2, "__esModule", { value: true });
17460
- exports2.updateJobPayload = updateJobPayload;
17461
- exports2.updateParentTaskStatus = updateParentTaskStatus;
17462
- exports2.getOutputPath = getOutputPath;
17463
- var path_1 = __importDefault2(require("path"));
17464
- var codeGenerationService_12 = require_codeGenerationService();
17465
- var utils_1 = require_utils9();
17466
- var DEFAULT_OUTPUT_PATH = "generated-app";
17467
- async function updateJobPayload(jobContext, payload) {
17468
- await codeGenerationService_12.codeGenerationService.updateJob(jobContext.jobId, payload);
17469
- }
17470
- async function updateParentTaskStatus(jobContext, status, error) {
17471
- await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, jobContext.taskId, status, {
17472
- ...error ? { error: (0, utils_1.serializeError)(error) } : {}
17473
- });
17474
- }
17475
- function getOutputPath() {
17476
- const outputDir = process.env.OUTPUT_PATH || DEFAULT_OUTPUT_PATH;
17477
- return outputDir.startsWith("/") ? outputDir : path_1.default.join(process.cwd(), outputDir);
17478
- }
17479
- }
17480
- });
17481
-
17482
17452
  // dist/flows/agent-io.js
17483
17453
  var require_agent_io = __commonJS({
17484
17454
  "dist/flows/agent-io.js"(exports2) {
@@ -17539,6 +17509,51 @@ var require_agent_io = __commonJS({
17539
17509
  }
17540
17510
  });
17541
17511
 
17512
+ // dist/flows/codegen-flow-helpers.js
17513
+ var require_codegen_flow_helpers = __commonJS({
17514
+ "dist/flows/codegen-flow-helpers.js"(exports2) {
17515
+ "use strict";
17516
+ var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
17517
+ return mod && mod.__esModule ? mod : { "default": mod };
17518
+ };
17519
+ Object.defineProperty(exports2, "__esModule", { value: true });
17520
+ exports2.updateJobPayload = updateJobPayload;
17521
+ exports2.buildFailedRunPayload = buildFailedRunPayload;
17522
+ exports2.updateParentTaskStatus = updateParentTaskStatus;
17523
+ exports2.getOutputPath = getOutputPath;
17524
+ var path_1 = __importDefault2(require("path"));
17525
+ var codeGenerationService_12 = require_codeGenerationService();
17526
+ var git_file_changes_1 = require_git_file_changes();
17527
+ var collect_extensions_created_1 = require_collect_extensions_created();
17528
+ var agent_io_1 = require_agent_io();
17529
+ var utils_1 = require_utils9();
17530
+ var DEFAULT_OUTPUT_PATH = "generated-app";
17531
+ async function updateJobPayload(jobContext, payload) {
17532
+ await codeGenerationService_12.codeGenerationService.updateJob(jobContext.jobId, payload);
17533
+ }
17534
+ async function buildFailedRunPayload(error, outputPath, gitBaseline) {
17535
+ const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
17536
+ const extensions = await (0, collect_extensions_created_1.buildExtensionsJobPayload)(outputPath, files);
17537
+ return {
17538
+ requiredPermissions: [],
17539
+ error,
17540
+ files,
17541
+ ...(0, agent_io_1.readAgentOutput)(outputPath),
17542
+ extensions
17543
+ };
17544
+ }
17545
+ async function updateParentTaskStatus(jobContext, status, error) {
17546
+ await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, jobContext.taskId, status, {
17547
+ ...error ? { error: (0, utils_1.serializeError)(error) } : {}
17548
+ });
17549
+ }
17550
+ function getOutputPath() {
17551
+ const outputDir = process.env.OUTPUT_PATH || DEFAULT_OUTPUT_PATH;
17552
+ return outputDir.startsWith("/") ? outputDir : path_1.default.join(process.cwd(), outputDir);
17553
+ }
17554
+ }
17555
+ });
17556
+
17542
17557
  // dist/opencode-integration/inject-created-by.js
17543
17558
  var require_inject_created_by = __commonJS({
17544
17559
  "dist/opencode-integration/inject-created-by.js"(exports2) {
@@ -22692,6 +22707,7 @@ var require_opencode_init = __commonJS({
22692
22707
  });
22693
22708
  const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
22694
22709
  const gitBaseline = await (0, git_file_changes_1.captureGitBaseline)(outputPath);
22710
+ store.gitBaseline = gitBaseline;
22695
22711
  const orchestrator = new OpenCodeOrchestrator_1.OpenCodeOrchestrator();
22696
22712
  let caughtError;
22697
22713
  try {
@@ -22752,16 +22768,8 @@ var require_opencode_init = __commonJS({
22752
22768
  } catch (error) {
22753
22769
  caughtError = error;
22754
22770
  const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
22755
- const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
22756
- const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
22757
- const extensions = await (0, collect_extensions_created_1.buildExtensionsJobPayload)(outputPath, files);
22758
- await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
22759
- requiredPermissions: [],
22760
- error: codegenError,
22761
- files,
22762
- ...agentOutput,
22763
- extensions
22764
- });
22771
+ const failedRunPayload = await (0, codegen_flow_helpers_12.buildFailedRunPayload)(codegenError, outputPath, gitBaseline);
22772
+ await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, failedRunPayload);
22765
22773
  await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
22766
22774
  const taskCost = orchestrator.lastUsage ? Math.round(orchestrator.lastUsage.cost * 1e6) : void 0;
22767
22775
  await (0, biEvents_1.reportSessionEnd)({
@@ -22770,7 +22778,7 @@ var require_opencode_init = __commonJS({
22770
22778
  taskType: kind,
22771
22779
  taskCost,
22772
22780
  taskStatus: ditto_codegen_types_12.Status.FAILED,
22773
- agentOutput: JSON.stringify({ files }),
22781
+ agentOutput: JSON.stringify({ files: failedRunPayload.files }),
22774
22782
  jobDuration: String(Date.now() - flowStartTime)
22775
22783
  });
22776
22784
  await (0, biEvents_1.reportSessionError)({
@@ -22906,6 +22914,7 @@ var require_opencode_iterate = __commonJS({
22906
22914
  });
22907
22915
  const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
22908
22916
  const gitBaseline = await (0, git_file_changes_1.captureGitBaseline)(outputPath);
22917
+ store.gitBaseline = gitBaseline;
22909
22918
  const iterationOrchestrator = new OpenCodeIterationOrchestrator_1.OpenCodeIterationOrchestrator();
22910
22919
  let caughtError;
22911
22920
  try {
@@ -22956,16 +22965,8 @@ var require_opencode_iterate = __commonJS({
22956
22965
  } catch (error) {
22957
22966
  caughtError = error;
22958
22967
  const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
22959
- const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
22960
- const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
22961
- const extensions = await (0, collect_extensions_created_1.buildExtensionsJobPayload)(outputPath, files);
22962
- await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
22963
- requiredPermissions: [],
22964
- error: codegenError,
22965
- files,
22966
- ...agentOutput,
22967
- extensions
22968
- });
22968
+ const failedRunPayload = await (0, codegen_flow_helpers_12.buildFailedRunPayload)(codegenError, outputPath, gitBaseline);
22969
+ await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, failedRunPayload);
22969
22970
  await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
22970
22971
  const taskCost = iterationOrchestrator.lastUsage ? Math.round(iterationOrchestrator.lastUsage.cost * 1e6) : void 0;
22971
22972
  await (0, biEvents_1.reportSessionEnd)({
@@ -22974,7 +22975,7 @@ var require_opencode_iterate = __commonJS({
22974
22975
  taskType: kind,
22975
22976
  taskCost,
22976
22977
  taskStatus: ditto_codegen_types_12.Status.FAILED,
22977
- agentOutput: JSON.stringify({ files }),
22978
+ agentOutput: JSON.stringify({ files: failedRunPayload.files }),
22978
22979
  jobDuration: String(Date.now() - flowStartTime)
22979
22980
  });
22980
22981
  await (0, biEvents_1.reportSessionError)({
@@ -23104,6 +23105,7 @@ var require_opencode_ask = __commonJS({
23104
23105
  });
23105
23106
  const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
23106
23107
  const gitBaseline = await (0, git_file_changes_1.captureGitBaseline)(outputPath);
23108
+ store.gitBaseline = gitBaseline;
23107
23109
  const askOrchestrator = new OpenCodeAskOrchestrator_1.OpenCodeAskOrchestrator();
23108
23110
  try {
23109
23111
  (0, cli_listeners_1.attachOrchestratorListeners)(askOrchestrator);
@@ -23284,6 +23286,7 @@ var require_opencode_fix_git_conflicts = __commonJS({
23284
23286
  });
23285
23287
  const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
23286
23288
  const gitBaseline = await (0, git_file_changes_1.captureGitBaseline)(outputPath);
23289
+ store.gitBaseline = gitBaseline;
23287
23290
  const orchestrator = new OpenCodeGitConflictsOrchestrator_1.OpenCodeGitConflictsOrchestrator();
23288
23291
  let caughtError;
23289
23292
  try {
@@ -23459,6 +23462,7 @@ var require_job_timeout_monitor = __commonJS({
23459
23462
  var logger_12 = require_logger();
23460
23463
  var context_12 = require_context();
23461
23464
  var job_context_storage_12 = require_job_context_storage();
23465
+ var codegen_flow_helpers_12 = require_codegen_flow_helpers();
23462
23466
  var types_1 = require_types_impl();
23463
23467
  var biEvents_1 = require_biEvents();
23464
23468
  exports2.JOB_TIMEOUT_MS = 1e3 * 60 * 20;
@@ -23486,31 +23490,30 @@ var require_job_timeout_monitor = __commonJS({
23486
23490
  });
23487
23491
  try {
23488
23492
  logger_12.logger.info("[Job] Timeout detected, exiting", logContext);
23489
- const codegenError = await this.resolveTimeoutError(jobId);
23493
+ const job = await this.codeGenerationService.getJob(jobId);
23494
+ const codegenError = this.resolveTimeoutError(jobId, job);
23490
23495
  await (0, utils_1.updateAllRunningTasks)(jobId, ditto_codegen_types_12.Status.FAILED, codegenError);
23491
- await this.codeGenerationService.markJobAsCompleted(jobId);
23492
- logger_12.logger.info("[Job] Marked job as completed, failed all running tasks", logContext);
23496
+ await this.codeGenerationService.updateJobStatus(jobId, ditto_codegen_types_12.Status.FAILED);
23497
+ const failedRunPayload = await (0, codegen_flow_helpers_12.buildFailedRunPayload)(codegenError, (0, codegen_flow_helpers_12.getOutputPath)(), job_context_storage_12.jobContextStorage.getStore()?.gitBaseline ?? "");
23498
+ await this.codeGenerationService.updateJob(jobId, {
23499
+ ...job?.payload,
23500
+ ...failedRunPayload
23501
+ });
23502
+ logger_12.logger.info("[Job] Marked job as failed, failed all running tasks", logContext);
23493
23503
  await this.reportTimeoutBi(jobId, codegenError);
23494
23504
  process.exit();
23495
23505
  } catch (error) {
23496
- logger_12.logger.error("[Job] Failed to mark timed-out job as completed", {
23506
+ logger_12.logger.error("[Job] Failed to mark timed-out job as failed", {
23497
23507
  ...logContext,
23498
23508
  error: error instanceof Error ? error.message : String(error)
23499
23509
  });
23510
+ throw error;
23500
23511
  }
23501
23512
  }
23502
- async resolveTimeoutError(jobId) {
23503
- try {
23504
- const job = await this.codeGenerationService.getJob(jobId);
23505
- const pendingDecision = job?.pendingUserDecisions?.find((decision) => !decision.response?.selectedOptionId);
23506
- if (pendingDecision?.id) {
23507
- return new ditto_codegen_types_12.UserDecisionTimeoutError(jobId, pendingDecision.id);
23508
- }
23509
- } catch (error) {
23510
- logger_12.logger.warn("[Job] Could not determine timeout error type", {
23511
- jobId,
23512
- error: error instanceof Error ? error.message : String(error)
23513
- });
23513
+ resolveTimeoutError(jobId, job) {
23514
+ const pendingDecision = job?.pendingUserDecisions?.find((decision) => !decision.response?.selectedOptionId);
23515
+ if (pendingDecision?.id) {
23516
+ return new ditto_codegen_types_12.UserDecisionTimeoutError(jobId, pendingDecision.id);
23514
23517
  }
23515
23518
  return new ditto_codegen_types_12.TimeoutError(`Job exceeded timeout of ${exports2.JOB_TIMEOUT_MS}ms`);
23516
23519
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.435",
3
+ "version": "1.0.436",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -29,5 +29,5 @@
29
29
  "esbuild": "^0.27.2",
30
30
  "vitest": "^4.0.16"
31
31
  },
32
- "falconPackageHash": "c800cf38305a8152baff949db90fba6913ed33954d9af629d14ee2a5"
32
+ "falconPackageHash": "41733ebfdb6e0790cdf0ddfb2bf8ab3c16812a1d07a04394b28d2553"
33
33
  }