@wix/ditto-codegen-public 1.0.389 → 1.0.390

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 +21 -14
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -80,6 +80,7 @@ var require_types_impl = __commonJS({
80
80
  ErrorType2["PROCESS_EXECUTION_ERROR"] = "PROCESS_EXECUTION_ERROR";
81
81
  ErrorType2["UNEXPECTED_ERROR"] = "UNEXPECTED_ERROR";
82
82
  ErrorType2["MISSING_JOB_ID_ERROR"] = "MISSING_JOB_ID_ERROR";
83
+ ErrorType2["USER_DECISION_TIMEOUT_ERROR"] = "USER_DECISION_TIMEOUT_ERROR";
83
84
  })(ErrorType || (exports2.ErrorType = ErrorType = {}));
84
85
  var FileOperation;
85
86
  (function(FileOperation2) {
@@ -10845,22 +10846,13 @@ var require_CodeGenService = __commonJS({
10845
10846
  [ditto_codegen_types_12.ProcessType.EXECUTION]: types_1.ProcessType.EXECUTION,
10846
10847
  [ditto_codegen_types_12.ProcessType.INITIALIZATION]: types_1.ProcessType.INITIALIZATION
10847
10848
  };
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
- };
10857
10849
  function toApiError(error) {
10858
10850
  if (!error)
10859
10851
  return void 0;
10860
10852
  return {
10861
10853
  name: error.name,
10862
10854
  message: error.message,
10863
- errorType: ERROR_TYPE[error.errorType],
10855
+ errorType: error.errorType,
10864
10856
  retryable: error.retryable,
10865
10857
  expected: error.expected,
10866
10858
  ..."processType" in error && error.processType && { processType: PROCESS_TYPE[error.processType] },
@@ -21993,10 +21985,11 @@ var require_job_timeout_monitor = __commonJS({
21993
21985
  });
21994
21986
  try {
21995
21987
  logger_12.logger.info("[Job] Timeout detected, exiting", logContext);
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`));
21988
+ const codegenError = await this.resolveTimeoutError(jobId);
21989
+ await (0, utils_1.updateAllRunningTasks)(jobId, ditto_codegen_types_12.Status.FAILED, codegenError);
21997
21990
  await this.codeGenerationService.markJobAsCompleted(jobId);
21998
21991
  logger_12.logger.info("[Job] Marked job as completed, failed all running tasks", logContext);
21999
- await this.reportTimeoutBi(jobId);
21992
+ await this.reportTimeoutBi(jobId, codegenError);
22000
21993
  process.exit();
22001
21994
  } catch (error) {
22002
21995
  logger_12.logger.error("[Job] Failed to mark timed-out job as completed", {
@@ -22005,7 +21998,22 @@ var require_job_timeout_monitor = __commonJS({
22005
21998
  });
22006
21999
  }
22007
22000
  }
22008
- async reportTimeoutBi(jobId) {
22001
+ async resolveTimeoutError(jobId) {
22002
+ try {
22003
+ const job = await this.codeGenerationService.getJob(jobId);
22004
+ const pendingDecision = job?.pendingUserDecisions?.find((decision) => !decision.response?.selectedOptionId);
22005
+ if (pendingDecision?.id) {
22006
+ return new ditto_codegen_types_12.UserDecisionTimeoutError(jobId, pendingDecision.id);
22007
+ }
22008
+ } catch (error) {
22009
+ logger_12.logger.warn("[Job] Could not determine timeout error type", {
22010
+ jobId,
22011
+ error: error instanceof Error ? error.message : String(error)
22012
+ });
22013
+ }
22014
+ return new ditto_codegen_types_12.TimeoutError(`Job exceeded timeout of ${exports2.JOB_TIMEOUT_MS}ms`);
22015
+ }
22016
+ async reportTimeoutBi(jobId, codegenError) {
22009
22017
  const store = job_context_storage_12.jobContextStorage.getStore();
22010
22018
  if (!store)
22011
22019
  return;
@@ -22019,7 +22027,6 @@ var require_job_timeout_monitor = __commonJS({
22019
22027
  runKind: store.kind,
22020
22028
  environment
22021
22029
  };
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
22030
  await (0, biEvents_1.reportSessionEnd)({
22024
22031
  ...biBase,
22025
22032
  taskStatus: ditto_codegen_types_12.Status.FAILED,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.389",
3
+ "version": "1.0.390",
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": "1f2c19ad8ba834649254819e388cb4feb7516e76da78903eee56d3d2"
32
+ "falconPackageHash": "9b45bb2de4fcb1d63f7931a7b9b7c5dddc0550f7215b0e50ae0cb030"
33
33
  }