@wix/ditto-codegen-public 1.0.433 → 1.0.435

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 +227 -35
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -39,7 +39,7 @@ var require_types_impl = __commonJS({
39
39
  "../../node_modules/@wix/ambassador-ctp-codegen-job-service-v1-job/cjs/build/types.impl.js"(exports2) {
40
40
  "use strict";
41
41
  Object.defineProperty(exports2, "__esModule", { value: true });
42
- exports2.WebhookIdentityType = exports2.UserDecisionQuestionType = exports2.TaskKind = exports2.Status = exports2.ProcessType = exports2.FileOperation = exports2.ErrorType = exports2.Environment = exports2.ChatMessageRole = exports2.ExtensionType = void 0;
42
+ exports2.WebhookIdentityType = exports2.UserDecisionQuestionType = exports2.TaskKind = exports2.Status = exports2.ProcessType = exports2.JobsSortOrder = exports2.FileOperation = exports2.ErrorType = exports2.Environment = exports2.ChatMessageRole = exports2.ExtensionType = void 0;
43
43
  var ExtensionType;
44
44
  (function(ExtensionType2) {
45
45
  ExtensionType2["UNDEFINED_EXTENSION_TYPE"] = "UNDEFINED_EXTENSION_TYPE";
@@ -89,6 +89,12 @@ var require_types_impl = __commonJS({
89
89
  FileOperation2["DELETE"] = "DELETE";
90
90
  FileOperation2["EDIT"] = "EDIT";
91
91
  })(FileOperation || (exports2.FileOperation = FileOperation = {}));
92
+ var JobsSortOrder;
93
+ (function(JobsSortOrder2) {
94
+ JobsSortOrder2["UNKNOWN_SORT_ORDER"] = "UNKNOWN_SORT_ORDER";
95
+ JobsSortOrder2["CREATED_AT_ASC"] = "CREATED_AT_ASC";
96
+ JobsSortOrder2["CREATED_AT_DESC"] = "CREATED_AT_DESC";
97
+ })(JobsSortOrder || (exports2.JobsSortOrder = JobsSortOrder = {}));
92
98
  var ProcessType;
93
99
  (function(ProcessType2) {
94
100
  ProcessType2["UNKNOWN_PROCESS_TYPE"] = "UNKNOWN_PROCESS_TYPE";
@@ -5836,7 +5842,7 @@ var require_utils4 = __commonJS({
5836
5842
  "../../node_modules/@wix/metro-runtime/cjs/build/serialization/utils.js"(exports2) {
5837
5843
  "use strict";
5838
5844
  Object.defineProperty(exports2, "__esModule", { value: true });
5839
- exports2.parseLeanSchemaRef = void 0;
5845
+ exports2.parseLeanSchemaRef = parseLeanSchemaRef;
5840
5846
  function parseLeanSchemaRef(renderedSchemaName = "") {
5841
5847
  const [typeOrName, schemaName] = getSchemaNameAndType(renderedSchemaName);
5842
5848
  if (schemaName) {
@@ -5849,7 +5855,6 @@ var require_utils4 = __commonJS({
5849
5855
  schemaName: typeOrName
5850
5856
  };
5851
5857
  }
5852
- exports2.parseLeanSchemaRef = parseLeanSchemaRef;
5853
5858
  var getSchemaNameAndType = (leanSchema) => leanSchema.split("#");
5854
5859
  }
5855
5860
  });
@@ -5884,7 +5889,7 @@ var require_utils5 = __commonJS({
5884
5889
  "../../node_modules/@wix/metro-runtime/cjs/build/utils.js"(exports2) {
5885
5890
  "use strict";
5886
5891
  Object.defineProperty(exports2, "__esModule", { value: true });
5887
- exports2.findByPath = void 0;
5892
+ exports2.findByPath = findByPath;
5888
5893
  function findByPath(obj, path, defaultValue, suffix) {
5889
5894
  let result = obj;
5890
5895
  for (const field of path.split(".")) {
@@ -5895,7 +5900,6 @@ var require_utils5 = __commonJS({
5895
5900
  }
5896
5901
  return `${result}${suffix}`;
5897
5902
  }
5898
- exports2.findByPath = findByPath;
5899
5903
  }
5900
5904
  });
5901
5905
 
@@ -5904,12 +5908,24 @@ var require_url_resolver = __commonJS({
5904
5908
  "../../node_modules/@wix/metro-runtime/cjs/build/url-resolver.js"(exports2) {
5905
5909
  "use strict";
5906
5910
  Object.defineProperty(exports2, "__esModule", { value: true });
5907
- exports2.resolveUrl = void 0;
5911
+ exports2.resolveUrl = resolveUrl;
5908
5912
  var utils_js_1 = require_utils5();
5909
5913
  var USER_DOMAIN = "_";
5914
+ var WWW_BASE_DOMAIN = "www._base_domain_";
5915
+ var WILDCARD_PREFIX = "*.";
5910
5916
  var DOMAINS = ["wix.com", "editorx.com"];
5911
- var WIX_API_DOMAINS = ["42.wixprod.net", "uw2-edt-1.wixprod.net"];
5917
+ var WIX_API_DOMAINS = [
5918
+ "42.wixprod.net",
5919
+ "uw2-edt-1.wixprod.net",
5920
+ "virginia-edt.wixprod.net"
5921
+ ];
5912
5922
  var DEV_WIX_CODE_DOMAIN = "dev.wix-code.com";
5923
+ var HOST_ALIASES = {
5924
+ // payments.base44.com runs customised Business Manager, which needs to work exactly the same as normal BM on manage.wix.com
5925
+ "payments.base44.com": "manage.wix.com",
5926
+ // https://system-kb.wixanswers.com/kb/en/article/editorx-domains-matching-to-wixcom
5927
+ "create.editorx.com": "editor.editorx.com"
5928
+ };
5913
5929
  var REGEX_CAPTURE_PROTO_FIELD = /{(.*)}/;
5914
5930
  var REGEX_CAPTURE_DOMAINS = new RegExp(`\\.(${DOMAINS.join("|")})$`);
5915
5931
  var REGEX_CAPTURE_API_DOMAINS = new RegExp(`\\.(${WIX_API_DOMAINS.join("|")})$`);
@@ -5920,7 +5936,6 @@ var require_url_resolver = __commonJS({
5920
5936
  const path = injectDataIntoProtoPath(opts.protoPath, opts.data || {});
5921
5937
  return resolvePath(path, mappings);
5922
5938
  }
5923
- exports2.resolveUrl = resolveUrl;
5924
5939
  function injectDataIntoProtoPath(protoPath, data) {
5925
5940
  return protoPath.split("/").map((path) => maybeProtoPathToData(path, data)).join("/");
5926
5941
  }
@@ -5938,24 +5953,27 @@ var require_url_resolver = __commonJS({
5938
5953
  return resolvedHost.replace(REGEX_CAPTURE_DOMAINS, "._base_domain_").replace(REGEX_CAPTURE_API_DOMAINS, "._api_base_domain_").replace(REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN, "*.dev.wix-code.com");
5939
5954
  }
5940
5955
  function fixHostExceptions(host) {
5941
- return host.replace("create.editorx.com", "editor.editorx.com");
5956
+ return HOST_ALIASES[host] ?? host;
5942
5957
  }
5943
5958
  function resolveMappingsByDomain(domain, domainToMappings) {
5944
5959
  const mappings = domainToMappings[domain];
5945
5960
  if (mappings) {
5946
5961
  return mappings;
5947
5962
  }
5948
- const rootDomainMappings = resolveRootDomain(domain, domainToMappings);
5949
- if (!rootDomainMappings) {
5963
+ const matchedMappings = resolveRootDomain(domain, domainToMappings) ?? resolveWildcardDomain(domain, domainToMappings);
5964
+ if (!matchedMappings) {
5965
+ if (isBaseDomain(domain)) {
5966
+ const wwwMappings = domainToMappings[WWW_BASE_DOMAIN];
5967
+ if (wwwMappings) {
5968
+ return wwwMappings;
5969
+ }
5970
+ }
5950
5971
  const userMappings = domainToMappings[USER_DOMAIN];
5951
5972
  if (userMappings) {
5952
5973
  return userMappings;
5953
5974
  }
5954
- if (isBaseDomain(domain)) {
5955
- return domainToMappings[wwwBaseDomain];
5956
- }
5957
5975
  }
5958
- return rootDomainMappings ?? [];
5976
+ return matchedMappings ?? [];
5959
5977
  }
5960
5978
  function resolveRootDomain(domain, domainToMappings) {
5961
5979
  return Object.entries(domainToMappings).find(([entryDomain]) => {
@@ -5963,6 +5981,22 @@ var require_url_resolver = __commonJS({
5963
5981
  return rooDomainSegments.join(".") === entryDomain;
5964
5982
  })?.[1];
5965
5983
  }
5984
+ function resolveWildcardDomain(domain, domainToMappings) {
5985
+ const matchingEntries = Object.entries(domainToMappings).filter(([entryDomain]) => matchesWildcardDomain(domain, entryDomain));
5986
+ const [mostSpecificEntry] = matchingEntries.sort(([entryDomainA], [entryDomainB]) => entryDomainB.length - entryDomainA.length);
5987
+ if (!mostSpecificEntry) {
5988
+ return void 0;
5989
+ }
5990
+ const [, mappings] = mostSpecificEntry;
5991
+ return mappings;
5992
+ }
5993
+ function matchesWildcardDomain(domain, entryDomain) {
5994
+ if (!entryDomain.startsWith(WILDCARD_PREFIX)) {
5995
+ return false;
5996
+ }
5997
+ const suffix = entryDomain.slice(WILDCARD_PREFIX.length - 1);
5998
+ return domain.length > suffix.length && domain.endsWith(suffix);
5999
+ }
5966
6000
  function resolvePath(protoPath, mappings) {
5967
6001
  const mapping = mappings?.find((m) => protoPath.startsWith(m.destPath));
5968
6002
  if (!mapping) {
@@ -5973,7 +6007,6 @@ var require_url_resolver = __commonJS({
5973
6007
  function isBaseDomain(domain) {
5974
6008
  return !!domain.match(/\._base_domain_$/);
5975
6009
  }
5976
- var wwwBaseDomain = "www._base_domain_";
5977
6010
  }
5978
6011
  });
5979
6012
 
@@ -6238,7 +6271,7 @@ var require_flatten_params = __commonJS({
6238
6271
  "../../node_modules/@wix/metro-runtime/cjs/build/flatten-params.js"(exports2) {
6239
6272
  "use strict";
6240
6273
  Object.defineProperty(exports2, "__esModule", { value: true });
6241
- exports2.toURLSearchParams = void 0;
6274
+ exports2.toURLSearchParams = toURLSearchParams;
6242
6275
  var js_base64_1 = require_base642();
6243
6276
  function flattenParams(data, path = "") {
6244
6277
  const params = {};
@@ -6276,7 +6309,6 @@ var require_flatten_params = __commonJS({
6276
6309
  }, new URLSearchParams());
6277
6310
  }
6278
6311
  }
6279
- exports2.toURLSearchParams = toURLSearchParams;
6280
6312
  }
6281
6313
  });
6282
6314
 
@@ -6317,7 +6349,7 @@ var require_domain2 = __commonJS({
6317
6349
  (function(ConverterType2) {
6318
6350
  ConverterType2[ConverterType2["TO_JSON"] = 0] = "TO_JSON";
6319
6351
  ConverterType2[ConverterType2["FROM_JSON"] = 1] = "FROM_JSON";
6320
- })(ConverterType = exports2.ConverterType || (exports2.ConverterType = {}));
6352
+ })(ConverterType || (exports2.ConverterType = ConverterType = {}));
6321
6353
  }
6322
6354
  });
6323
6355
 
@@ -6326,7 +6358,7 @@ var require_serializer = __commonJS({
6326
6358
  "../../node_modules/@wix/metro-runtime/cjs/build/serializer/serializer.js"(exports2) {
6327
6359
  "use strict";
6328
6360
  Object.defineProperty(exports2, "__esModule", { value: true });
6329
- exports2.schemaSerializer = void 0;
6361
+ exports2.schemaSerializer = schemaSerializer;
6330
6362
  var index_js_1 = require_build();
6331
6363
  function schemaSerializer(rootSchema, depSchemas = {}, converterSets) {
6332
6364
  return function serialize(json = {}, converterType) {
@@ -6377,7 +6409,6 @@ var require_serializer = __commonJS({
6377
6409
  }
6378
6410
  };
6379
6411
  }
6380
- exports2.schemaSerializer = schemaSerializer;
6381
6412
  }
6382
6413
  });
6383
6414
 
@@ -6572,7 +6603,7 @@ var require_utils6 = __commonJS({
6572
6603
  "../../node_modules/@wix/metro-runtime/cjs/build/serializer/utils.js"(exports2) {
6573
6604
  "use strict";
6574
6605
  Object.defineProperty(exports2, "__esModule", { value: true });
6575
- exports2.typeToConverterSet = void 0;
6606
+ exports2.typeToConverterSet = typeToConverterSet;
6576
6607
  function typeToConverterSet(converterSets) {
6577
6608
  return converterSets.reduce((result, converterSet) => {
6578
6609
  const types = converterSet.types.reduce((typeResult, type) => {
@@ -6587,7 +6618,6 @@ var require_utils6 = __commonJS({
6587
6618
  };
6588
6619
  }, {});
6589
6620
  }
6590
- exports2.typeToConverterSet = typeToConverterSet;
6591
6621
  }
6592
6622
  });
6593
6623
 
@@ -6596,7 +6626,7 @@ var require_ambassador_index = __commonJS({
6596
6626
  "../../node_modules/@wix/metro-runtime/cjs/build/ambassador-index.js"(exports2) {
6597
6627
  "use strict";
6598
6628
  Object.defineProperty(exports2, "__esModule", { value: true });
6599
- exports2.serializer = void 0;
6629
+ exports2.serializer = serializer;
6600
6630
  var domain_js_1 = require_domain2();
6601
6631
  var serializer_js_1 = require_serializer();
6602
6632
  var converters_js_1 = require_converters();
@@ -6614,7 +6644,6 @@ var require_ambassador_index = __commonJS({
6614
6644
  }
6615
6645
  };
6616
6646
  }
6617
- exports2.serializer = serializer;
6618
6647
  function safeJsonParse(someString) {
6619
6648
  try {
6620
6649
  return JSON.parse(someString);
@@ -10540,6 +10569,41 @@ var require_wixTokenRefresh = __commonJS({
10540
10569
  }
10541
10570
  });
10542
10571
 
10572
+ // dist/experiments.js
10573
+ var require_experiments = __commonJS({
10574
+ "dist/experiments.js"(exports2) {
10575
+ "use strict";
10576
+ Object.defineProperty(exports2, "__esModule", { value: true });
10577
+ exports2.FILTERED_JOB_POLLING = void 0;
10578
+ exports2.isExperimentEnabled = isExperimentEnabled;
10579
+ var logger_12 = require_logger();
10580
+ exports2.FILTERED_JOB_POLLING = "codegenFilteredJobPolling";
10581
+ var parsedExperiments = null;
10582
+ function getExperiments() {
10583
+ if (parsedExperiments !== null) {
10584
+ return parsedExperiments;
10585
+ }
10586
+ const raw = process.env.CODEGEN_EXPERIMENTS;
10587
+ if (!raw) {
10588
+ parsedExperiments = {};
10589
+ return parsedExperiments;
10590
+ }
10591
+ try {
10592
+ parsedExperiments = JSON.parse(raw);
10593
+ } catch (error) {
10594
+ logger_12.logger.error("[Experiments] Failed to parse CODEGEN_EXPERIMENTS", {
10595
+ error: error instanceof Error ? error.message : String(error)
10596
+ });
10597
+ parsedExperiments = {};
10598
+ }
10599
+ return parsedExperiments;
10600
+ }
10601
+ function isExperimentEnabled(specName) {
10602
+ return getExperiments()[specName] === "true";
10603
+ }
10604
+ }
10605
+ });
10606
+
10543
10607
  // ../codegen-types/dist/errors/ErrorTypes.js
10544
10608
  var require_ErrorTypes = __commonJS({
10545
10609
  "../codegen-types/dist/errors/ErrorTypes.js"(exports2) {
@@ -10957,7 +11021,7 @@ var require_CodeGenService = __commonJS({
10957
11021
  "dist/services/CodeGenService.js"(exports2) {
10958
11022
  "use strict";
10959
11023
  Object.defineProperty(exports2, "__esModule", { value: true });
10960
- exports2.CodeGenService = exports2.TaskKind = exports2.Status = void 0;
11024
+ exports2.CodeGenService = exports2.JobsSortOrder = exports2.TaskKind = exports2.Status = void 0;
10961
11025
  exports2.createCodeGenErrorHandler = createCodeGenErrorHandler;
10962
11026
  var http_client_1 = require_index_node();
10963
11027
  var http_1 = require_http_impl();
@@ -10969,7 +11033,11 @@ var require_CodeGenService = __commonJS({
10969
11033
  Object.defineProperty(exports2, "TaskKind", { enumerable: true, get: function() {
10970
11034
  return types_1.TaskKind;
10971
11035
  } });
11036
+ Object.defineProperty(exports2, "JobsSortOrder", { enumerable: true, get: function() {
11037
+ return types_1.JobsSortOrder;
11038
+ } });
10972
11039
  var logger_12 = require_logger();
11040
+ var experiments_1 = require_experiments();
10973
11041
  var ditto_codegen_types_12 = require_dist4();
10974
11042
  var FILE_OPERATION = {
10975
11043
  [ditto_codegen_types_12.ExtensionGenerationOperation.INSERT]: types_1.FileOperation.INSERT,
@@ -11059,11 +11127,16 @@ var require_CodeGenService = __commonJS({
11059
11127
  }
11060
11128
  };
11061
11129
  this.fetchPendingJobs = async () => {
11062
- const resp = await this.request((0, http_1.listProjectJobs)({
11063
- projectId: this.projectId
11064
- }));
11130
+ const { sandboxId } = this;
11131
+ const filtered = sandboxId && (0, experiments_1.isExperimentEnabled)(experiments_1.FILTERED_JOB_POLLING) ? {
11132
+ projectId: this.projectId,
11133
+ filter: { status: types_1.Status.PENDING, sandboxId },
11134
+ paging: { limit: 1 },
11135
+ sortOrder: types_1.JobsSortOrder.CREATED_AT_ASC
11136
+ } : void 0;
11137
+ const resp = await this.request((0, http_1.listProjectJobs)(filtered ?? { projectId: this.projectId }));
11065
11138
  const jobs = resp.data?.jobs ?? [];
11066
- return jobs.filter(this.shouldProcessJob);
11139
+ return filtered ? jobs : jobs.filter(this.shouldProcessJob);
11067
11140
  };
11068
11141
  this.shouldProcessJob = (job) => {
11069
11142
  if (job.status !== types_1.Status.PENDING)
@@ -11523,7 +11596,7 @@ var require_git_conflicts_prompt = __commonJS({
11523
11596
  var prompt_utils_1 = require_prompt_utils();
11524
11597
  function buildGitConflictsPrompt(history) {
11525
11598
  const { currentUserRequest } = (0, prompt_utils_1.extractUserRequestAndFilteredHistory)(history);
11526
- const base = "Fix all Git merge conflicts in the current project. Resolve every conflict marker (<<<<<<<, =======, >>>>>>>) so the code compiles correctly.";
11599
+ const base = "Fix all Git merge conflicts in the current project. Resolve every git conflict marker so the code compiles correctly.";
11527
11600
  const sections = [
11528
11601
  base,
11529
11602
  currentUserRequest ? `Additional context from user: "${currentUserRequest}"` : "",
@@ -13124,6 +13197,59 @@ var require_http_impl3 = __commonJS({
13124
13197
  }
13125
13198
  });
13126
13199
 
13200
+ // ../../node_modules/@wix/ambassador-code-project-orchestrator-v1-code-project/cjs/build/types.impl.js
13201
+ var require_types_impl3 = __commonJS({
13202
+ "../../node_modules/@wix/ambassador-code-project-orchestrator-v1-code-project/cjs/build/types.impl.js"(exports2) {
13203
+ "use strict";
13204
+ Object.defineProperty(exports2, "__esModule", { value: true });
13205
+ exports2.TaskStatus = exports2.SyncStatus = exports2.DeploymentStatus = exports2.ConflictResolutionStrategy = exports2.CodeDeploymentStatus = exports2.CheckpointErrorType = void 0;
13206
+ var CheckpointErrorType;
13207
+ (function(CheckpointErrorType2) {
13208
+ CheckpointErrorType2["CHECKPOINT_ERROR_TYPE_UNKNOWN"] = "CHECKPOINT_ERROR_TYPE_UNKNOWN";
13209
+ CheckpointErrorType2["CHECKPOINT_ERROR_TYPE_USER"] = "CHECKPOINT_ERROR_TYPE_USER";
13210
+ CheckpointErrorType2["CHECKPOINT_ERROR_TYPE_SYSTEM"] = "CHECKPOINT_ERROR_TYPE_SYSTEM";
13211
+ })(CheckpointErrorType || (exports2.CheckpointErrorType = CheckpointErrorType = {}));
13212
+ var CodeDeploymentStatus;
13213
+ (function(CodeDeploymentStatus2) {
13214
+ CodeDeploymentStatus2["CODE_DEPLOYMENT_STATUS_UNKNOWN"] = "CODE_DEPLOYMENT_STATUS_UNKNOWN";
13215
+ CodeDeploymentStatus2["CODE_DEPLOYMENT_STATUS_IN_PROGRESS"] = "CODE_DEPLOYMENT_STATUS_IN_PROGRESS";
13216
+ CodeDeploymentStatus2["CODE_DEPLOYMENT_STATUS_COMPLETED"] = "CODE_DEPLOYMENT_STATUS_COMPLETED";
13217
+ CodeDeploymentStatus2["CODE_DEPLOYMENT_STATUS_FAILED"] = "CODE_DEPLOYMENT_STATUS_FAILED";
13218
+ })(CodeDeploymentStatus || (exports2.CodeDeploymentStatus = CodeDeploymentStatus = {}));
13219
+ var ConflictResolutionStrategy;
13220
+ (function(ConflictResolutionStrategy2) {
13221
+ ConflictResolutionStrategy2["CONFLICT_RESOLUTION_STRATEGY_UNKNOWN"] = "CONFLICT_RESOLUTION_STRATEGY_UNKNOWN";
13222
+ ConflictResolutionStrategy2["OURS"] = "OURS";
13223
+ ConflictResolutionStrategy2["THEIRS"] = "THEIRS";
13224
+ ConflictResolutionStrategy2["AI"] = "AI";
13225
+ })(ConflictResolutionStrategy || (exports2.ConflictResolutionStrategy = ConflictResolutionStrategy = {}));
13226
+ var DeploymentStatus;
13227
+ (function(DeploymentStatus2) {
13228
+ DeploymentStatus2["UNKNOWN"] = "UNKNOWN";
13229
+ DeploymentStatus2["BUILD_IN_PROGRESS"] = "BUILD_IN_PROGRESS";
13230
+ DeploymentStatus2["BUILD_COMPLETED"] = "BUILD_COMPLETED";
13231
+ DeploymentStatus2["BUILD_FAILED"] = "BUILD_FAILED";
13232
+ DeploymentStatus2["ARCHIVED"] = "ARCHIVED";
13233
+ })(DeploymentStatus || (exports2.DeploymentStatus = DeploymentStatus = {}));
13234
+ var SyncStatus;
13235
+ (function(SyncStatus2) {
13236
+ SyncStatus2["SYNC_STATUS_UNKNOWN"] = "SYNC_STATUS_UNKNOWN";
13237
+ SyncStatus2["SYNC_STATUS_IN_SYNC"] = "SYNC_STATUS_IN_SYNC";
13238
+ SyncStatus2["SYNC_STATUS_OUT_OF_SYNC"] = "SYNC_STATUS_OUT_OF_SYNC";
13239
+ })(SyncStatus || (exports2.SyncStatus = SyncStatus = {}));
13240
+ var TaskStatus;
13241
+ (function(TaskStatus2) {
13242
+ TaskStatus2["UNKNOWN_TASK_STATUS"] = "UNKNOWN_TASK_STATUS";
13243
+ TaskStatus2["NOT_STARTED"] = "NOT_STARTED";
13244
+ TaskStatus2["RUNNING"] = "RUNNING";
13245
+ TaskStatus2["COMPLETED"] = "COMPLETED";
13246
+ TaskStatus2["FAILED"] = "FAILED";
13247
+ TaskStatus2["CANCELLED"] = "CANCELLED";
13248
+ TaskStatus2["NOT_EXECUTED"] = "NOT_EXECUTED";
13249
+ })(TaskStatus || (exports2.TaskStatus = TaskStatus = {}));
13250
+ }
13251
+ });
13252
+
13127
13253
  // ../codegen-checkpoint-plugin/dist/checkpoint.js
13128
13254
  var require_checkpoint = __commonJS({
13129
13255
  "../codegen-checkpoint-plugin/dist/checkpoint.js"(exports2) {
@@ -13134,6 +13260,7 @@ var require_checkpoint = __commonJS({
13134
13260
  var path_1 = require("path");
13135
13261
  var http_1 = require_http_impl2();
13136
13262
  var http_2 = require_http_impl3();
13263
+ var types_1 = require_types_impl3();
13137
13264
  var http_client_1 = require_index_node();
13138
13265
  var FALLBACK_COMMIT_MESSAGE = "Auto-save";
13139
13266
  var EML_MARKER = "generate-eml.ts";
@@ -13166,7 +13293,24 @@ var require_checkpoint = __commonJS({
13166
13293
  return message;
13167
13294
  return message.slice(0, MAX_COMMIT_MESSAGE_LENGTH - TRUNCATION_SUFFIX.length) + TRUNCATION_SUFFIX;
13168
13295
  };
13296
+ var CHECKPOINT_CONFLICT_CODE = "CHECKPOINT_CONFLICT";
13169
13297
  var useCodeProjectOrchestrator = () => process.env.USE_CODE_PROJECT_ORCHESTRATOR === "true";
13298
+ var collaboratorLiveSyncEnabled = () => process.env.STUDIO2_COLLABORATOR_LIVE_SYNC === "true";
13299
+ var readApplicationErrorCode = (error) => {
13300
+ if (!http_client_1.HttpClient.isHttpError(error))
13301
+ return void 0;
13302
+ const data = error.response?.data;
13303
+ const code = data?.details?.applicationError?.code;
13304
+ return typeof code === "string" ? code : void 0;
13305
+ };
13306
+ var isCheckpointConflict = (error) => readApplicationErrorCode(error) === CHECKPOINT_CONFLICT_CODE;
13307
+ var readConflictedFiles = (error) => {
13308
+ if (!http_client_1.HttpClient.isHttpError(error))
13309
+ return [];
13310
+ const data = error.response?.data;
13311
+ const files = data?.details?.applicationError?.data?.files;
13312
+ return Array.isArray(files) ? files.filter((file) => typeof file === "string") : [];
13313
+ };
13170
13314
  var wasAuthorizationHeaderSent = (requestHeaders) => {
13171
13315
  if (typeof requestHeaders !== "object" || requestHeaders === null)
13172
13316
  return false;
@@ -13213,6 +13357,13 @@ var require_checkpoint = __commonJS({
13213
13357
  commitHash: resp.data?.checkpointId
13214
13358
  };
13215
13359
  };
13360
+ var callResolveCheckpointConflict = async (client, siteBranchId) => {
13361
+ const resp = await client.request((0, http_2.resolveCheckpointConflict)({
13362
+ siteBranchId,
13363
+ strategy: types_1.ConflictResolutionStrategy.AI
13364
+ }));
13365
+ return resp.data?.jobId ?? void 0;
13366
+ };
13216
13367
  var readToolCommitMessage = (input) => {
13217
13368
  if (typeof input !== "object" || input === null)
13218
13369
  return void 0;
@@ -13257,6 +13408,45 @@ var require_checkpoint = __commonJS({
13257
13408
  commitMessage
13258
13409
  });
13259
13410
  } catch (error) {
13411
+ if (useCodeProjectOrchestrator() && collaboratorLiveSyncEnabled() && job.siteBranchId && isCheckpointConflict(error)) {
13412
+ const files = readConflictedFiles(error);
13413
+ try {
13414
+ const conflictResolutionJobId = await callResolveCheckpointConflict(orchestratorHttpClient, job.siteBranchId);
13415
+ if (!conflictResolutionJobId) {
13416
+ throw new Error("resolveCheckpointConflict returned no conflict resolution job id");
13417
+ }
13418
+ outcome = {
13419
+ status: "resolvingGitConflicts",
13420
+ conflictResolutionJobId,
13421
+ conflictedFiles: files
13422
+ };
13423
+ await host.jobs.updatePayload({ jobId: job.jobId, taskId: job.taskId }, {
13424
+ checkpointStatus: "resolvingGitConflicts",
13425
+ conflictResolutionJobId,
13426
+ conflictedFiles: files
13427
+ }).catch((payloadError) => {
13428
+ host.logger.warn("[Checkpoint] failed to publish the resolving-conflicts state", {
13429
+ projectId: job.projectId,
13430
+ conflictResolutionJobId,
13431
+ error: payloadError instanceof Error ? payloadError.message : String(payloadError)
13432
+ });
13433
+ });
13434
+ host.logger.info("[Checkpoint] git conflicts handed to AI resolution", {
13435
+ projectId: job.projectId,
13436
+ siteBranchId: job.siteBranchId,
13437
+ conflictResolutionJobId,
13438
+ files
13439
+ });
13440
+ return;
13441
+ } catch (resolveError) {
13442
+ host.logger.error("[Checkpoint] git conflict resolution dispatch failed", {
13443
+ projectId: job.projectId,
13444
+ siteBranchId: job.siteBranchId,
13445
+ files,
13446
+ error: resolveError instanceof Error ? resolveError.message : String(resolveError)
13447
+ });
13448
+ }
13449
+ }
13260
13450
  outcome = { status: "failed", error };
13261
13451
  host.logger.error("[Checkpoint] create failed", {
13262
13452
  projectId: job.projectId,
@@ -13302,6 +13492,8 @@ var require_checkpoint = __commonJS({
13302
13492
  throw outcome.error;
13303
13493
  if (outcome?.status === "created")
13304
13494
  return;
13495
+ if (outcome?.status === "resolvingGitConflicts")
13496
+ return;
13305
13497
  if (codegenFailed)
13306
13498
  return;
13307
13499
  const commitMessage = capturedCommitMessage ?? FALLBACK_COMMIT_MESSAGE;
@@ -15148,9 +15340,9 @@ UNDERSTAND INTENT FIRST:
15148
15340
  - When the change is non-trivial, inspect recent history to learn what the incoming branch refactored: \`git log -p -n 3 -- <file>\` and \`git diff\` are READ-ONLY and safe. NEVER run \`git merge\`, \`git rebase\`, \`git checkout\`, \`git reset\`, \`git add\`, or \`git commit\` \u2014 only the agent's edit tools change files; git state is managed by the host.
15149
15341
 
15150
15342
  CONFLICT RESOLUTION STRATEGY:
15151
- - Identify all files containing conflict markers: <<<<<<<, =======, >>>>>>>
15152
- - The HEAD (OURS) section (between <<<<<<< and =======) represents the current branch's changes \u2014 preserve this code.
15153
- - The incoming (THEIRS) section (between ======= and >>>>>>>) represents the changes being merged in.
15343
+ - Identify all files containing git conflict markers.
15344
+ - The HEAD (OURS) section \u2014 the first side of the conflict \u2014 represents the current branch's changes; preserve this code.
15345
+ - The incoming (THEIRS) section \u2014 the second side \u2014 represents the changes being merged in.
15154
15346
  - Resolve each conflict by merging both sides logically \u2014 judge by SEMANTIC meaning, not line-by-line text:
15155
15347
  - If both sides add independent, non-overlapping code \u2014 include both.
15156
15348
  - If they modify the same logic \u2014 prefer HEAD (OURS) and incorporate non-conflicting parts from THEIRS.
@@ -15173,7 +15365,7 @@ ${(0, shared_rules_1.buildFileOperationsRules)("resolving conflicts")}
15173
15365
  - NEVER run preview, dev, release, or promote commands.
15174
15366
 
15175
15367
  WORKFLOW:
15176
- 1. **Find**: Use \`grep\` to locate all files containing "<<<<<<<".
15368
+ 1. **Find**: Use \`grep\` to locate every file containing git conflict markers, searching the whole project \u2014 any files named in the request are only a hint.
15177
15369
  2. **Resolve**: Read (\`batch-read\`) and fix all conflicts using \`multi-edit\`. Do NOT add new logic \u2014 only remove markers and merge the two sides.
15178
15370
  3. **Verify markers**: Run \`grep\` again to confirm zero conflict markers remain.
15179
15371
  4. **Validate**: Run \`validate\` (typecheck only). Fix any errors and re-validate until tsc passes, then run \`validate({ runBuild: true })\` ONCE to confirm the resolution did not break the build. Pass \`installDeps: true\` ONLY when \`package.json\` changed without already running \`npm install <package-name>\` in this iteration; otherwise omit it (node_modules is pre-installed).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.433",
3
+ "version": "1.0.435",
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": "1601a0c2e0fc0a29a1d23a9101dd1760a021d72adbd91767267f436d"
32
+ "falconPackageHash": "c800cf38305a8152baff949db90fba6913ed33954d9af629d14ee2a5"
33
33
  }