@wix/ditto-codegen-public 1.0.387 → 1.0.389

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 +76 -14
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -10417,6 +10417,7 @@ var require_ErrorTypes = __commonJS({
10417
10417
  ErrorType2["PROCESS_EXECUTION_ERROR"] = "PROCESS_EXECUTION_ERROR";
10418
10418
  ErrorType2["UNEXPECTED_ERROR"] = "UNEXPECTED_ERROR";
10419
10419
  ErrorType2["MISSING_JOB_ID_ERROR"] = "MISSING_JOB_ID_ERROR";
10420
+ ErrorType2["USER_DECISION_TIMEOUT_ERROR"] = "USER_DECISION_TIMEOUT_ERROR";
10420
10421
  })(ErrorType || (exports2.ErrorType = ErrorType = {}));
10421
10422
  }
10422
10423
  });
@@ -10584,6 +10585,35 @@ var require_MissingJobIdError = __commonJS({
10584
10585
  }
10585
10586
  });
10586
10587
 
10588
+ // ../codegen-types/dist/errors/UserDecisionTimeoutError.js
10589
+ var require_UserDecisionTimeoutError = __commonJS({
10590
+ "../codegen-types/dist/errors/UserDecisionTimeoutError.js"(exports2) {
10591
+ "use strict";
10592
+ Object.defineProperty(exports2, "__esModule", { value: true });
10593
+ exports2.UserDecisionTimeoutError = void 0;
10594
+ var BaseCodegenError_1 = require_BaseCodegenError();
10595
+ var ErrorTypes_1 = require_ErrorTypes();
10596
+ var UserDecisionTimeoutError = class extends BaseCodegenError_1.BaseCodegenError {
10597
+ constructor(jobId, decisionId) {
10598
+ super(`User decision ${decisionId} timed out for job ${jobId}`);
10599
+ this.jobId = jobId;
10600
+ this.decisionId = decisionId;
10601
+ this.name = "UserDecisionTimeoutError";
10602
+ this.errorType = ErrorTypes_1.ErrorType.USER_DECISION_TIMEOUT_ERROR;
10603
+ this.expected = true;
10604
+ this.retryable = false;
10605
+ }
10606
+ getAdditionalProperties() {
10607
+ return {
10608
+ jobId: this.jobId,
10609
+ decisionId: this.decisionId
10610
+ };
10611
+ }
10612
+ };
10613
+ exports2.UserDecisionTimeoutError = UserDecisionTimeoutError;
10614
+ }
10615
+ });
10616
+
10587
10617
  // ../codegen-types/dist/errors/helpers.js
10588
10618
  var require_helpers2 = __commonJS({
10589
10619
  "../codegen-types/dist/errors/helpers.js"(exports2) {
@@ -10646,6 +10676,7 @@ var require_errors2 = __commonJS({
10646
10676
  __exportStar2(require_UnexpectedError(), exports2);
10647
10677
  __exportStar2(require_TimeoutError(), exports2);
10648
10678
  __exportStar2(require_MissingJobIdError(), exports2);
10679
+ __exportStar2(require_UserDecisionTimeoutError(), exports2);
10649
10680
  __exportStar2(require_helpers2(), exports2);
10650
10681
  }
10651
10682
  });
@@ -10814,13 +10845,22 @@ var require_CodeGenService = __commonJS({
10814
10845
  [ditto_codegen_types_12.ProcessType.EXECUTION]: types_1.ProcessType.EXECUTION,
10815
10846
  [ditto_codegen_types_12.ProcessType.INITIALIZATION]: types_1.ProcessType.INITIALIZATION
10816
10847
  };
10848
+ var ERROR_TYPE = {
10849
+ [ditto_codegen_types_12.ErrorType.TIMEOUT_ERROR]: types_1.ErrorType.TIMEOUT_ERROR,
10850
+ [ditto_codegen_types_12.ErrorType.PROCESS_EXECUTION_ERROR]: types_1.ErrorType.PROCESS_EXECUTION_ERROR,
10851
+ [ditto_codegen_types_12.ErrorType.UNEXPECTED_ERROR]: types_1.ErrorType.UNEXPECTED_ERROR,
10852
+ [ditto_codegen_types_12.ErrorType.MISSING_JOB_ID_ERROR]: types_1.ErrorType.MISSING_JOB_ID_ERROR,
10853
+ // TODO: map to ApiErrorType.USER_DECISION_TIMEOUT_ERROR once the proto change (PR #938)
10854
+ // is GA'd and the generated API enum includes it. For now report it as TIMEOUT_ERROR.
10855
+ [ditto_codegen_types_12.ErrorType.USER_DECISION_TIMEOUT_ERROR]: types_1.ErrorType.TIMEOUT_ERROR
10856
+ };
10817
10857
  function toApiError(error) {
10818
10858
  if (!error)
10819
10859
  return void 0;
10820
10860
  return {
10821
10861
  name: error.name,
10822
10862
  message: error.message,
10823
- errorType: error.errorType,
10863
+ errorType: ERROR_TYPE[error.errorType],
10824
10864
  retryable: error.retryable,
10825
10865
  expected: error.expected,
10826
10866
  ..."processType" in error && error.processType && { processType: PROCESS_TYPE[error.processType] },
@@ -14479,24 +14519,15 @@ var require_job_decision_manager = __commonJS({
14479
14519
  "dist/job-decision-manager.js"(exports2) {
14480
14520
  "use strict";
14481
14521
  Object.defineProperty(exports2, "__esModule", { value: true });
14482
- exports2.UserDecisionCancelledError = void 0;
14483
14522
  exports2.pauseForUserDecision = pauseForUserDecision;
14484
14523
  exports2.askJobChoice = askJobChoice;
14485
14524
  exports2.askJobConfirmation = askJobConfirmation;
14486
14525
  var types_1 = require_types_impl();
14487
14526
  var codeGenerationService_12 = require_codeGenerationService();
14488
14527
  var types_2 = require_types_impl();
14528
+ var ditto_codegen_types_12 = require_dist4();
14489
14529
  var logger_12 = require_logger();
14490
14530
  var DECISION_POLL_INTERVAL_MS = 2e3;
14491
- var UserDecisionCancelledError = class extends Error {
14492
- constructor(jobId, decisionId) {
14493
- super(`User decision ${decisionId} cancelled for job ${jobId}`);
14494
- this.jobId = jobId;
14495
- this.decisionId = decisionId;
14496
- this.name = "UserDecisionCancelledError";
14497
- }
14498
- };
14499
- exports2.UserDecisionCancelledError = UserDecisionCancelledError;
14500
14531
  async function pauseForUserDecision(jobId, request) {
14501
14532
  const decisionId = crypto.randomUUID();
14502
14533
  const userDecision = {
@@ -14531,7 +14562,7 @@ var require_job_decision_manager = __commonJS({
14531
14562
  }
14532
14563
  if (job.status === types_2.Status.CANCELLED || job.status === types_2.Status.PENDING_CANCEL) {
14533
14564
  logger_12.logger.warn("[JobDecision] Job cancelled while waiting for user decision", { decisionId });
14534
- throw new UserDecisionCancelledError(jobId, decisionId);
14565
+ throw new ditto_codegen_types_12.UserDecisionTimeoutError(jobId, decisionId);
14535
14566
  }
14536
14567
  const decision = job.pendingUserDecisions?.find((d) => d.id === decisionId) ?? job.userDecisionHistory?.find((d) => d.id === decisionId);
14537
14568
  if (decision?.response?.selectedOptionId) {
@@ -21003,7 +21034,6 @@ var require_biEvents = __commonJS({
21003
21034
  app_id: report.appId,
21004
21035
  Dev_machine_session_id: report.devMachineSessionId,
21005
21036
  run_kind: report.runKind,
21006
- job_input: report.jobInput,
21007
21037
  Extra_data: report.extraData,
21008
21038
  Job_cost: report.jobCost,
21009
21039
  Task_model: report.taskModel,
@@ -21042,7 +21072,6 @@ var require_biEvents = __commonJS({
21042
21072
  app_id: report.appId,
21043
21073
  Dev_machine_session_id: report.devMachineSessionId,
21044
21074
  run_kind: report.runKind,
21045
- job_input: report.jobInput,
21046
21075
  Extra_data: report.extraData,
21047
21076
  Task_model: report.taskModel,
21048
21077
  Task_type: report.taskType,
@@ -21936,6 +21965,9 @@ var require_job_timeout_monitor = __commonJS({
21936
21965
  var utils_1 = require_utils9();
21937
21966
  var logger_12 = require_logger();
21938
21967
  var context_12 = require_context();
21968
+ var job_context_storage_12 = require_job_context_storage();
21969
+ var types_1 = require_types_impl();
21970
+ var biEvents_1 = require_biEvents();
21939
21971
  exports2.JOB_TIMEOUT_MS = 1e3 * 60 * 20;
21940
21972
  var JobTimeoutMonitor = class {
21941
21973
  constructor(codeGenerationService) {
@@ -21964,6 +21996,7 @@ var require_job_timeout_monitor = __commonJS({
21964
21996
  await (0, utils_1.updateAllRunningTasks)(jobId, ditto_codegen_types_12.Status.FAILED, new ditto_codegen_types_12.TimeoutError(`Job exceeded timeout of ${exports2.JOB_TIMEOUT_MS}ms`));
21965
21997
  await this.codeGenerationService.markJobAsCompleted(jobId);
21966
21998
  logger_12.logger.info("[Job] Marked job as completed, failed all running tasks", logContext);
21999
+ await this.reportTimeoutBi(jobId);
21967
22000
  process.exit();
21968
22001
  } catch (error) {
21969
22002
  logger_12.logger.error("[Job] Failed to mark timed-out job as completed", {
@@ -21972,6 +22005,35 @@ var require_job_timeout_monitor = __commonJS({
21972
22005
  });
21973
22006
  }
21974
22007
  }
22008
+ async reportTimeoutBi(jobId) {
22009
+ const store = job_context_storage_12.jobContextStorage.getStore();
22010
+ if (!store)
22011
+ return;
22012
+ const jobDuration = store.flowStartTime ? String(Date.now() - store.flowStartTime) : void 0;
22013
+ const environment = process.env.CODEGEN_ENVIRONMENT ?? types_1.Environment.UNKNOWN_ENVIRONMENT;
22014
+ const biBase = {
22015
+ jobId,
22016
+ taskId: store.taskId,
22017
+ appId: context_12.ctx.projectId,
22018
+ devMachineSessionId: process.env.CODEGEN_SESSION_ID,
22019
+ runKind: store.kind,
22020
+ environment
22021
+ };
22022
+ const codegenError = (0, ditto_codegen_types_12.toCodegenError)(new ditto_codegen_types_12.TimeoutError(`Job exceeded timeout of ${exports2.JOB_TIMEOUT_MS}ms`));
22023
+ await (0, biEvents_1.reportSessionEnd)({
22024
+ ...biBase,
22025
+ taskStatus: ditto_codegen_types_12.Status.FAILED,
22026
+ jobDuration
22027
+ });
22028
+ await (0, biEvents_1.reportSessionError)({
22029
+ ...biBase,
22030
+ errorDesc: codegenError.errorType,
22031
+ errorMessage: codegenError.message,
22032
+ errorJson: JSON.stringify(codegenError),
22033
+ isRetryable: codegenError.retryable,
22034
+ isExpected: codegenError.expected
22035
+ });
22036
+ }
21975
22037
  };
21976
22038
  exports2.JobTimeoutMonitor = JobTimeoutMonitor;
21977
22039
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.387",
3
+ "version": "1.0.389",
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": "c2d472a39560b5c18258f85ccc22cac3a672412ae104a381b052b9b8"
32
+ "falconPackageHash": "1f2c19ad8ba834649254819e388cb4feb7516e76da78903eee56d3d2"
33
33
  }