@wix/ditto-codegen-public 1.0.387 → 1.0.388
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.
- package/dist/out.js +76 -13
- 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
|
|
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,
|
|
@@ -21936,6 +21966,9 @@ var require_job_timeout_monitor = __commonJS({
|
|
|
21936
21966
|
var utils_1 = require_utils9();
|
|
21937
21967
|
var logger_12 = require_logger();
|
|
21938
21968
|
var context_12 = require_context();
|
|
21969
|
+
var job_context_storage_12 = require_job_context_storage();
|
|
21970
|
+
var types_1 = require_types_impl();
|
|
21971
|
+
var biEvents_1 = require_biEvents();
|
|
21939
21972
|
exports2.JOB_TIMEOUT_MS = 1e3 * 60 * 20;
|
|
21940
21973
|
var JobTimeoutMonitor = class {
|
|
21941
21974
|
constructor(codeGenerationService) {
|
|
@@ -21964,6 +21997,7 @@ var require_job_timeout_monitor = __commonJS({
|
|
|
21964
21997
|
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
21998
|
await this.codeGenerationService.markJobAsCompleted(jobId);
|
|
21966
21999
|
logger_12.logger.info("[Job] Marked job as completed, failed all running tasks", logContext);
|
|
22000
|
+
await this.reportTimeoutBi(jobId);
|
|
21967
22001
|
process.exit();
|
|
21968
22002
|
} catch (error) {
|
|
21969
22003
|
logger_12.logger.error("[Job] Failed to mark timed-out job as completed", {
|
|
@@ -21972,6 +22006,35 @@ var require_job_timeout_monitor = __commonJS({
|
|
|
21972
22006
|
});
|
|
21973
22007
|
}
|
|
21974
22008
|
}
|
|
22009
|
+
async reportTimeoutBi(jobId) {
|
|
22010
|
+
const store = job_context_storage_12.jobContextStorage.getStore();
|
|
22011
|
+
if (!store)
|
|
22012
|
+
return;
|
|
22013
|
+
const jobDuration = store.flowStartTime ? String(Date.now() - store.flowStartTime) : void 0;
|
|
22014
|
+
const environment = process.env.CODEGEN_ENVIRONMENT ?? types_1.Environment.UNKNOWN_ENVIRONMENT;
|
|
22015
|
+
const biBase = {
|
|
22016
|
+
jobId,
|
|
22017
|
+
taskId: store.taskId,
|
|
22018
|
+
appId: context_12.ctx.projectId,
|
|
22019
|
+
devMachineSessionId: process.env.CODEGEN_SESSION_ID,
|
|
22020
|
+
runKind: store.kind,
|
|
22021
|
+
environment
|
|
22022
|
+
};
|
|
22023
|
+
const codegenError = (0, ditto_codegen_types_12.toCodegenError)(new ditto_codegen_types_12.TimeoutError(`Job exceeded timeout of ${exports2.JOB_TIMEOUT_MS}ms`));
|
|
22024
|
+
await (0, biEvents_1.reportSessionEnd)({
|
|
22025
|
+
...biBase,
|
|
22026
|
+
taskStatus: ditto_codegen_types_12.Status.FAILED,
|
|
22027
|
+
jobDuration
|
|
22028
|
+
});
|
|
22029
|
+
await (0, biEvents_1.reportSessionError)({
|
|
22030
|
+
...biBase,
|
|
22031
|
+
errorDesc: codegenError.errorType,
|
|
22032
|
+
errorMessage: codegenError.message,
|
|
22033
|
+
errorJson: JSON.stringify(codegenError),
|
|
22034
|
+
isRetryable: codegenError.retryable,
|
|
22035
|
+
isExpected: codegenError.expected
|
|
22036
|
+
});
|
|
22037
|
+
}
|
|
21975
22038
|
};
|
|
21976
22039
|
exports2.JobTimeoutMonitor = JobTimeoutMonitor;
|
|
21977
22040
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/ditto-codegen-public",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.388",
|
|
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": "
|
|
32
|
+
"falconPackageHash": "64069c3bda8af1ad407213767631155ecbf28c5254c28024c98de0ae"
|
|
33
33
|
}
|