@wix/ditto-codegen-public 1.0.129 → 1.0.130
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 +86 -4
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -65668,6 +65668,7 @@ var require_ErrorTypes = __commonJS({
|
|
|
65668
65668
|
ErrorType2["AI_RATE_LIMIT_ERROR"] = "AI_RATE_LIMIT_ERROR";
|
|
65669
65669
|
ErrorType2["AI_NETWORK_ERROR"] = "AI_NETWORK_ERROR";
|
|
65670
65670
|
ErrorType2["FILE_SYSTEM_ERROR"] = "FILE_SYSTEM_ERROR";
|
|
65671
|
+
ErrorType2["TIMEOUT_ERROR"] = "TIMEOUT_ERROR";
|
|
65671
65672
|
ErrorType2["PROCESS_EXECUTION_ERROR"] = "PROCESS_EXECUTION_ERROR";
|
|
65672
65673
|
ErrorType2["AGENT_CONFIGURATION_ERROR"] = "AGENT_CONFIGURATION_ERROR";
|
|
65673
65674
|
ErrorType2["SCAFFOLDING_ERROR"] = "SCAFFOLDING_ERROR";
|
|
@@ -66198,6 +66199,27 @@ var require_UnexpectedError = __commonJS({
|
|
|
66198
66199
|
}
|
|
66199
66200
|
});
|
|
66200
66201
|
|
|
66202
|
+
// ../codegen-types/dist/errors/TimeoutError.js
|
|
66203
|
+
var require_TimeoutError = __commonJS({
|
|
66204
|
+
"../codegen-types/dist/errors/TimeoutError.js"(exports2) {
|
|
66205
|
+
"use strict";
|
|
66206
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
66207
|
+
exports2.TimeoutError = void 0;
|
|
66208
|
+
var BaseCodegenError_1 = require_BaseCodegenError();
|
|
66209
|
+
var ErrorTypes_1 = require_ErrorTypes();
|
|
66210
|
+
var TimeoutError = class extends BaseCodegenError_1.BaseCodegenError {
|
|
66211
|
+
constructor(message) {
|
|
66212
|
+
super(message);
|
|
66213
|
+
this.name = "TimeoutError";
|
|
66214
|
+
this.errorType = ErrorTypes_1.ErrorType.TIMEOUT_ERROR;
|
|
66215
|
+
this.expected = false;
|
|
66216
|
+
this.retryable = true;
|
|
66217
|
+
}
|
|
66218
|
+
};
|
|
66219
|
+
exports2.TimeoutError = TimeoutError;
|
|
66220
|
+
}
|
|
66221
|
+
});
|
|
66222
|
+
|
|
66201
66223
|
// ../codegen-types/dist/errors/helpers.js
|
|
66202
66224
|
var require_helpers = __commonJS({
|
|
66203
66225
|
"../codegen-types/dist/errors/helpers.js"(exports2) {
|
|
@@ -66293,6 +66315,7 @@ var require_errors = __commonJS({
|
|
|
66293
66315
|
__exportStar2(require_ExtensionGenerationError(), exports2);
|
|
66294
66316
|
__exportStar2(require_ValidationConfigurationError(), exports2);
|
|
66295
66317
|
__exportStar2(require_UnexpectedError(), exports2);
|
|
66318
|
+
__exportStar2(require_TimeoutError(), exports2);
|
|
66296
66319
|
__exportStar2(require_helpers(), exports2);
|
|
66297
66320
|
}
|
|
66298
66321
|
});
|
|
@@ -132369,6 +132392,9 @@ var require_utils18 = __commonJS({
|
|
|
132369
132392
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
132370
132393
|
exports2.serializeError = serializeError;
|
|
132371
132394
|
exports2.mapGroupBy = mapGroupBy;
|
|
132395
|
+
exports2.updateAllRunningTasks = updateAllRunningTasks;
|
|
132396
|
+
var ditto_codegen_types_12 = require_dist();
|
|
132397
|
+
var codeGenerationService_1 = require_codeGenerationService();
|
|
132372
132398
|
function serializeError(error) {
|
|
132373
132399
|
if (error instanceof Error) {
|
|
132374
132400
|
const base = {
|
|
@@ -132421,6 +132447,13 @@ var require_utils18 = __commonJS({
|
|
|
132421
132447
|
}
|
|
132422
132448
|
return groups;
|
|
132423
132449
|
}
|
|
132450
|
+
async function updateAllRunningTasks(jobId, status, error) {
|
|
132451
|
+
const job = await codeGenerationService_1.codeGenerationService.getJob(jobId);
|
|
132452
|
+
const tasks = job?.tasks.filter((task) => task.status === ditto_codegen_types_12.Status.RUNNING || task.status === ditto_codegen_types_12.Status.PENDING) || [];
|
|
132453
|
+
for (const task of tasks) {
|
|
132454
|
+
await codeGenerationService_1.codeGenerationService.updateTask(jobId, task.id, status, error ? { error: serializeError(error) } : {});
|
|
132455
|
+
}
|
|
132456
|
+
}
|
|
132424
132457
|
}
|
|
132425
132458
|
});
|
|
132426
132459
|
|
|
@@ -353363,6 +353396,7 @@ var require_job_cancellation_monitor = __commonJS({
|
|
|
353363
353396
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
353364
353397
|
exports2.JobCancellationMonitor = void 0;
|
|
353365
353398
|
var ditto_codegen_types_12 = require_dist();
|
|
353399
|
+
var utils_1 = require_utils18();
|
|
353366
353400
|
var STATUS_CHECK_INTERVAL_MS = 2e3;
|
|
353367
353401
|
var JobCancellationMonitor = class {
|
|
353368
353402
|
constructor(codeGenerationService) {
|
|
@@ -353389,6 +353423,8 @@ var require_job_cancellation_monitor = __commonJS({
|
|
|
353389
353423
|
if (job.status === ditto_codegen_types_12.Status.PENDING_CANCEL) {
|
|
353390
353424
|
console.log(`[Job] Detected cancellation request. Exiting.`);
|
|
353391
353425
|
await this.codeGenerationService.markJobAsCancelled(jobId);
|
|
353426
|
+
await (0, utils_1.updateAllRunningTasks)(jobId, ditto_codegen_types_12.Status.CANCELLED);
|
|
353427
|
+
console.log(`[Job] Marked job ${jobId} as CANCELLED and cancelled all running and pending tasks.`);
|
|
353392
353428
|
process.exit();
|
|
353393
353429
|
}
|
|
353394
353430
|
this.start(jobId);
|
|
@@ -353402,9 +353438,51 @@ var require_job_cancellation_monitor = __commonJS({
|
|
|
353402
353438
|
}
|
|
353403
353439
|
});
|
|
353404
353440
|
|
|
353441
|
+
// dist/job-timeout-monitor.js
|
|
353442
|
+
var require_job_timeout_monitor = __commonJS({
|
|
353443
|
+
"dist/job-timeout-monitor.js"(exports2) {
|
|
353444
|
+
"use strict";
|
|
353445
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
353446
|
+
exports2.JobTimeoutMonitor = exports2.JOB_TIMEOUT_MS = void 0;
|
|
353447
|
+
var ditto_codegen_types_12 = require_dist();
|
|
353448
|
+
var utils_1 = require_utils18();
|
|
353449
|
+
exports2.JOB_TIMEOUT_MS = 1e3 * 60 * 10;
|
|
353450
|
+
var JobTimeoutMonitor = class {
|
|
353451
|
+
constructor(codeGenerationService) {
|
|
353452
|
+
this.codeGenerationService = codeGenerationService;
|
|
353453
|
+
this.jobTimeout = null;
|
|
353454
|
+
}
|
|
353455
|
+
start(jobId) {
|
|
353456
|
+
this.jobTimeout = setTimeout(() => {
|
|
353457
|
+
this.handleTimeout(jobId);
|
|
353458
|
+
}, exports2.JOB_TIMEOUT_MS);
|
|
353459
|
+
}
|
|
353460
|
+
stop() {
|
|
353461
|
+
if (this.jobTimeout) {
|
|
353462
|
+
clearTimeout(this.jobTimeout);
|
|
353463
|
+
this.jobTimeout = null;
|
|
353464
|
+
}
|
|
353465
|
+
}
|
|
353466
|
+
async handleTimeout(jobId) {
|
|
353467
|
+
console.error(`[Job] Job ${jobId} exceeded timeout of ${exports2.JOB_TIMEOUT_MS}ms`);
|
|
353468
|
+
try {
|
|
353469
|
+
console.log(`[Job] Timeout detected. Exiting.`);
|
|
353470
|
+
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`));
|
|
353471
|
+
await this.codeGenerationService.markJobAsCompleted(jobId);
|
|
353472
|
+
console.log(`[Job] Marked job ${jobId} as completed and failed all running and pending tasks.`);
|
|
353473
|
+
process.exit();
|
|
353474
|
+
} catch (error) {
|
|
353475
|
+
console.error(`[Job] Failed to mark job ${jobId} as completed and failed all running and pending tasks:`, error);
|
|
353476
|
+
}
|
|
353477
|
+
}
|
|
353478
|
+
};
|
|
353479
|
+
exports2.JobTimeoutMonitor = JobTimeoutMonitor;
|
|
353480
|
+
}
|
|
353481
|
+
});
|
|
353482
|
+
|
|
353405
353483
|
// dist/index.js
|
|
353406
353484
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
353407
|
-
exports.
|
|
353485
|
+
exports.codeGenerationService = void 0;
|
|
353408
353486
|
exports.processJob = processJob;
|
|
353409
353487
|
var instrumentation_1 = require_instrumentation3();
|
|
353410
353488
|
var context_1 = require_context();
|
|
@@ -353414,6 +353492,7 @@ var job_context_storage_1 = require_job_context_storage();
|
|
|
353414
353492
|
var init_codegen_1 = require_init_codegen();
|
|
353415
353493
|
var iterate_codegen_1 = require_iterate_codegen();
|
|
353416
353494
|
var job_cancellation_monitor_1 = require_job_cancellation_monitor();
|
|
353495
|
+
var job_timeout_monitor_1 = require_job_timeout_monitor();
|
|
353417
353496
|
var initializeTracing = async () => {
|
|
353418
353497
|
try {
|
|
353419
353498
|
await instrumentation_1.tracingReady;
|
|
@@ -353424,7 +353503,8 @@ var initializeTracing = async () => {
|
|
|
353424
353503
|
};
|
|
353425
353504
|
var baseUrl = process.env.CODEGEN_BASE_URL || "http://localhost:3000";
|
|
353426
353505
|
exports.codeGenerationService = new CodeGenService_1.CodeGenService(baseUrl, context_1.ctx.projectId);
|
|
353427
|
-
|
|
353506
|
+
var jobCancellationMonitor = new job_cancellation_monitor_1.JobCancellationMonitor(exports.codeGenerationService);
|
|
353507
|
+
var jobTimeoutMonitor = new job_timeout_monitor_1.JobTimeoutMonitor(exports.codeGenerationService);
|
|
353428
353508
|
var delay = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
353429
353509
|
var ACTIVE_JOB_SLEEP_MS = 1e3;
|
|
353430
353510
|
var NO_JOBS_SLEEP_MS = 5e3;
|
|
@@ -353474,7 +353554,8 @@ async function processJob(job) {
|
|
|
353474
353554
|
console.log(`[Job] jobId=${job.jobId}, taskKind=${task.kind} - start processing`);
|
|
353475
353555
|
context_1.ctx.setJobStatus(job.jobId, ditto_codegen_types_1.Status.RUNNING);
|
|
353476
353556
|
console.log(`[Job] Marked job RUNNING: jobId=${job.jobId}, initTaskId=${task.id}`);
|
|
353477
|
-
|
|
353557
|
+
jobCancellationMonitor.start(job.jobId);
|
|
353558
|
+
jobTimeoutMonitor.start(job.jobId);
|
|
353478
353559
|
try {
|
|
353479
353560
|
console.log("Task Payload", JSON.stringify(task.payload, null, 2));
|
|
353480
353561
|
await job_context_storage_1.jobContextStorage.run({ jobId: job.jobId, taskId: task.id, kind: task.kind }, async () => {
|
|
@@ -353487,7 +353568,8 @@ async function processJob(job) {
|
|
|
353487
353568
|
}
|
|
353488
353569
|
});
|
|
353489
353570
|
} finally {
|
|
353490
|
-
|
|
353571
|
+
jobCancellationMonitor.stop();
|
|
353572
|
+
jobTimeoutMonitor.stop();
|
|
353491
353573
|
}
|
|
353492
353574
|
}
|
|
353493
353575
|
(0, context_1.initCtx)().then((ctx) => {
|
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.130",
|
|
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": "
|
|
27
|
+
"falconPackageHash": "78942b69a46cc63f99bb94dc7ed14bdc1baa5a580f9184768d55c969"
|
|
28
28
|
}
|