@wix/ditto-codegen-public 1.0.128 → 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.
Files changed (2) hide show
  1. package/dist/out.js +89 -9
  2. 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
  });
@@ -121799,7 +121822,6 @@ When relevant existing extensions are identified:
121799
121822
  </extension_selection_logic>
121800
121823
 
121801
121824
  <constraints>
121802
- - Return a JSON object with currentExtensions, additionalExtensions, and summary fields
121803
121825
  - **CRITICAL**: Only propose additional extensions if existing ones cannot fulfill the user's request. Review "Relevant Existing Extensions" carefully before creating duplicates.
121804
121826
  - Be specific about which file paths are relevant for each current extension (all extension types)
121805
121827
  - Consider the full chat history context when making decisions
@@ -121828,7 +121850,6 @@ When relevant existing extensions are identified:
121828
121850
  - "relatedSpis" field: ONLY for SERVICE_PLUGIN extensions - specify the SPI name
121829
121851
  - "paths" field: For ALL extension types - specify relevant file paths to modify
121830
121852
  - For currentExtensions, always include paths; for additionalExtensions, paths are not needed
121831
- </output_format>
121832
121853
 
121833
121854
  </WIXCLI_ITERATION_AGENT_SYSTEM_PROMPT>
121834
121855
  `;
@@ -121901,8 +121922,8 @@ var require_IterationAgent = __commonJS({
121901
121922
  relevantUserRequest: zod_1.z.string().describe("What part of the user request this extension should do, do not reference other extensions.")
121902
121923
  });
121903
121924
  var IterationPlanSchema = zod_1.z.object({
121904
- currentExtensions: zod_1.z.array(CurrentExtensionSchema).describe("Existing extensions to be triggered"),
121905
- additionalExtensions: zod_1.z.array(AdditionalExtensionSchema).describe("New extensions to be created"),
121925
+ currentExtensions: zod_1.z.array(CurrentExtensionSchema).describe("Existing extensions to be triggered, return [] if no existing extensions are needed"),
121926
+ additionalExtensions: zod_1.z.array(AdditionalExtensionSchema).describe("New extensions to be created, return [] if no new extensions are needed"),
121906
121927
  summary: zod_1.z.string().describe("Summary of the chat with the user request")
121907
121928
  });
121908
121929
  var IterationAgent = class {
@@ -121934,7 +121955,7 @@ var require_IterationAgent = __commonJS({
121934
121955
  };
121935
121956
  }
121936
121957
  async generate(currentUserRequest, chatHistory, relevantExtensions = []) {
121937
- const model = (0, anthropic_1.createAnthropic)({ apiKey: this.apiKey })("claude-sonnet-4-5-20250929");
121958
+ const model = (0, anthropic_1.createAnthropic)({ apiKey: this.apiKey })("claude-3-5-haiku-latest");
121938
121959
  const historyStr = (chatHistory || []).map((m) => `${m.role.toUpperCase()}: ${m.text}`).join("\n\n");
121939
121960
  const userContent = [
121940
121961
  `
@@ -132371,6 +132392,9 @@ var require_utils18 = __commonJS({
132371
132392
  Object.defineProperty(exports2, "__esModule", { value: true });
132372
132393
  exports2.serializeError = serializeError;
132373
132394
  exports2.mapGroupBy = mapGroupBy;
132395
+ exports2.updateAllRunningTasks = updateAllRunningTasks;
132396
+ var ditto_codegen_types_12 = require_dist();
132397
+ var codeGenerationService_1 = require_codeGenerationService();
132374
132398
  function serializeError(error) {
132375
132399
  if (error instanceof Error) {
132376
132400
  const base = {
@@ -132423,6 +132447,13 @@ var require_utils18 = __commonJS({
132423
132447
  }
132424
132448
  return groups;
132425
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
+ }
132426
132457
  }
132427
132458
  });
132428
132459
 
@@ -353365,6 +353396,7 @@ var require_job_cancellation_monitor = __commonJS({
353365
353396
  Object.defineProperty(exports2, "__esModule", { value: true });
353366
353397
  exports2.JobCancellationMonitor = void 0;
353367
353398
  var ditto_codegen_types_12 = require_dist();
353399
+ var utils_1 = require_utils18();
353368
353400
  var STATUS_CHECK_INTERVAL_MS = 2e3;
353369
353401
  var JobCancellationMonitor = class {
353370
353402
  constructor(codeGenerationService) {
@@ -353391,6 +353423,8 @@ var require_job_cancellation_monitor = __commonJS({
353391
353423
  if (job.status === ditto_codegen_types_12.Status.PENDING_CANCEL) {
353392
353424
  console.log(`[Job] Detected cancellation request. Exiting.`);
353393
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.`);
353394
353428
  process.exit();
353395
353429
  }
353396
353430
  this.start(jobId);
@@ -353404,9 +353438,51 @@ var require_job_cancellation_monitor = __commonJS({
353404
353438
  }
353405
353439
  });
353406
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
+
353407
353483
  // dist/index.js
353408
353484
  Object.defineProperty(exports, "__esModule", { value: true });
353409
- exports.jobCancellationMonitor = exports.codeGenerationService = void 0;
353485
+ exports.codeGenerationService = void 0;
353410
353486
  exports.processJob = processJob;
353411
353487
  var instrumentation_1 = require_instrumentation3();
353412
353488
  var context_1 = require_context();
@@ -353416,6 +353492,7 @@ var job_context_storage_1 = require_job_context_storage();
353416
353492
  var init_codegen_1 = require_init_codegen();
353417
353493
  var iterate_codegen_1 = require_iterate_codegen();
353418
353494
  var job_cancellation_monitor_1 = require_job_cancellation_monitor();
353495
+ var job_timeout_monitor_1 = require_job_timeout_monitor();
353419
353496
  var initializeTracing = async () => {
353420
353497
  try {
353421
353498
  await instrumentation_1.tracingReady;
@@ -353426,7 +353503,8 @@ var initializeTracing = async () => {
353426
353503
  };
353427
353504
  var baseUrl = process.env.CODEGEN_BASE_URL || "http://localhost:3000";
353428
353505
  exports.codeGenerationService = new CodeGenService_1.CodeGenService(baseUrl, context_1.ctx.projectId);
353429
- exports.jobCancellationMonitor = new job_cancellation_monitor_1.JobCancellationMonitor(exports.codeGenerationService);
353506
+ var jobCancellationMonitor = new job_cancellation_monitor_1.JobCancellationMonitor(exports.codeGenerationService);
353507
+ var jobTimeoutMonitor = new job_timeout_monitor_1.JobTimeoutMonitor(exports.codeGenerationService);
353430
353508
  var delay = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
353431
353509
  var ACTIVE_JOB_SLEEP_MS = 1e3;
353432
353510
  var NO_JOBS_SLEEP_MS = 5e3;
@@ -353476,7 +353554,8 @@ async function processJob(job) {
353476
353554
  console.log(`[Job] jobId=${job.jobId}, taskKind=${task.kind} - start processing`);
353477
353555
  context_1.ctx.setJobStatus(job.jobId, ditto_codegen_types_1.Status.RUNNING);
353478
353556
  console.log(`[Job] Marked job RUNNING: jobId=${job.jobId}, initTaskId=${task.id}`);
353479
- exports.jobCancellationMonitor.start(job.jobId);
353557
+ jobCancellationMonitor.start(job.jobId);
353558
+ jobTimeoutMonitor.start(job.jobId);
353480
353559
  try {
353481
353560
  console.log("Task Payload", JSON.stringify(task.payload, null, 2));
353482
353561
  await job_context_storage_1.jobContextStorage.run({ jobId: job.jobId, taskId: task.id, kind: task.kind }, async () => {
@@ -353489,7 +353568,8 @@ async function processJob(job) {
353489
353568
  }
353490
353569
  });
353491
353570
  } finally {
353492
- exports.jobCancellationMonitor.stop();
353571
+ jobCancellationMonitor.stop();
353572
+ jobTimeoutMonitor.stop();
353493
353573
  }
353494
353574
  }
353495
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.128",
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": "12e7dff1ae096376b0361ff041381787492ced0624ffae8cb99fbc79"
27
+ "falconPackageHash": "78942b69a46cc63f99bb94dc7ed14bdc1baa5a580f9184768d55c969"
28
28
  }