@wix/ditto-codegen-public 1.0.433 → 1.0.434

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 +124 -5
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -11523,7 +11523,7 @@ var require_git_conflicts_prompt = __commonJS({
11523
11523
  var prompt_utils_1 = require_prompt_utils();
11524
11524
  function buildGitConflictsPrompt(history) {
11525
11525
  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.";
11526
+ const base = "Fix all Git merge conflicts in the current project. Resolve every git conflict marker so the code compiles correctly.";
11527
11527
  const sections = [
11528
11528
  base,
11529
11529
  currentUserRequest ? `Additional context from user: "${currentUserRequest}"` : "",
@@ -13124,6 +13124,59 @@ var require_http_impl3 = __commonJS({
13124
13124
  }
13125
13125
  });
13126
13126
 
13127
+ // ../../node_modules/@wix/ambassador-code-project-orchestrator-v1-code-project/cjs/build/types.impl.js
13128
+ var require_types_impl3 = __commonJS({
13129
+ "../../node_modules/@wix/ambassador-code-project-orchestrator-v1-code-project/cjs/build/types.impl.js"(exports2) {
13130
+ "use strict";
13131
+ Object.defineProperty(exports2, "__esModule", { value: true });
13132
+ exports2.TaskStatus = exports2.SyncStatus = exports2.DeploymentStatus = exports2.ConflictResolutionStrategy = exports2.CodeDeploymentStatus = exports2.CheckpointErrorType = void 0;
13133
+ var CheckpointErrorType;
13134
+ (function(CheckpointErrorType2) {
13135
+ CheckpointErrorType2["CHECKPOINT_ERROR_TYPE_UNKNOWN"] = "CHECKPOINT_ERROR_TYPE_UNKNOWN";
13136
+ CheckpointErrorType2["CHECKPOINT_ERROR_TYPE_USER"] = "CHECKPOINT_ERROR_TYPE_USER";
13137
+ CheckpointErrorType2["CHECKPOINT_ERROR_TYPE_SYSTEM"] = "CHECKPOINT_ERROR_TYPE_SYSTEM";
13138
+ })(CheckpointErrorType || (exports2.CheckpointErrorType = CheckpointErrorType = {}));
13139
+ var CodeDeploymentStatus;
13140
+ (function(CodeDeploymentStatus2) {
13141
+ CodeDeploymentStatus2["CODE_DEPLOYMENT_STATUS_UNKNOWN"] = "CODE_DEPLOYMENT_STATUS_UNKNOWN";
13142
+ CodeDeploymentStatus2["CODE_DEPLOYMENT_STATUS_IN_PROGRESS"] = "CODE_DEPLOYMENT_STATUS_IN_PROGRESS";
13143
+ CodeDeploymentStatus2["CODE_DEPLOYMENT_STATUS_COMPLETED"] = "CODE_DEPLOYMENT_STATUS_COMPLETED";
13144
+ CodeDeploymentStatus2["CODE_DEPLOYMENT_STATUS_FAILED"] = "CODE_DEPLOYMENT_STATUS_FAILED";
13145
+ })(CodeDeploymentStatus || (exports2.CodeDeploymentStatus = CodeDeploymentStatus = {}));
13146
+ var ConflictResolutionStrategy;
13147
+ (function(ConflictResolutionStrategy2) {
13148
+ ConflictResolutionStrategy2["CONFLICT_RESOLUTION_STRATEGY_UNKNOWN"] = "CONFLICT_RESOLUTION_STRATEGY_UNKNOWN";
13149
+ ConflictResolutionStrategy2["OURS"] = "OURS";
13150
+ ConflictResolutionStrategy2["THEIRS"] = "THEIRS";
13151
+ ConflictResolutionStrategy2["AI"] = "AI";
13152
+ })(ConflictResolutionStrategy || (exports2.ConflictResolutionStrategy = ConflictResolutionStrategy = {}));
13153
+ var DeploymentStatus;
13154
+ (function(DeploymentStatus2) {
13155
+ DeploymentStatus2["UNKNOWN"] = "UNKNOWN";
13156
+ DeploymentStatus2["BUILD_IN_PROGRESS"] = "BUILD_IN_PROGRESS";
13157
+ DeploymentStatus2["BUILD_COMPLETED"] = "BUILD_COMPLETED";
13158
+ DeploymentStatus2["BUILD_FAILED"] = "BUILD_FAILED";
13159
+ DeploymentStatus2["ARCHIVED"] = "ARCHIVED";
13160
+ })(DeploymentStatus || (exports2.DeploymentStatus = DeploymentStatus = {}));
13161
+ var SyncStatus;
13162
+ (function(SyncStatus2) {
13163
+ SyncStatus2["SYNC_STATUS_UNKNOWN"] = "SYNC_STATUS_UNKNOWN";
13164
+ SyncStatus2["SYNC_STATUS_IN_SYNC"] = "SYNC_STATUS_IN_SYNC";
13165
+ SyncStatus2["SYNC_STATUS_OUT_OF_SYNC"] = "SYNC_STATUS_OUT_OF_SYNC";
13166
+ })(SyncStatus || (exports2.SyncStatus = SyncStatus = {}));
13167
+ var TaskStatus;
13168
+ (function(TaskStatus2) {
13169
+ TaskStatus2["UNKNOWN_TASK_STATUS"] = "UNKNOWN_TASK_STATUS";
13170
+ TaskStatus2["NOT_STARTED"] = "NOT_STARTED";
13171
+ TaskStatus2["RUNNING"] = "RUNNING";
13172
+ TaskStatus2["COMPLETED"] = "COMPLETED";
13173
+ TaskStatus2["FAILED"] = "FAILED";
13174
+ TaskStatus2["CANCELLED"] = "CANCELLED";
13175
+ TaskStatus2["NOT_EXECUTED"] = "NOT_EXECUTED";
13176
+ })(TaskStatus || (exports2.TaskStatus = TaskStatus = {}));
13177
+ }
13178
+ });
13179
+
13127
13180
  // ../codegen-checkpoint-plugin/dist/checkpoint.js
13128
13181
  var require_checkpoint = __commonJS({
13129
13182
  "../codegen-checkpoint-plugin/dist/checkpoint.js"(exports2) {
@@ -13134,6 +13187,7 @@ var require_checkpoint = __commonJS({
13134
13187
  var path_1 = require("path");
13135
13188
  var http_1 = require_http_impl2();
13136
13189
  var http_2 = require_http_impl3();
13190
+ var types_1 = require_types_impl3();
13137
13191
  var http_client_1 = require_index_node();
13138
13192
  var FALLBACK_COMMIT_MESSAGE = "Auto-save";
13139
13193
  var EML_MARKER = "generate-eml.ts";
@@ -13166,7 +13220,24 @@ var require_checkpoint = __commonJS({
13166
13220
  return message;
13167
13221
  return message.slice(0, MAX_COMMIT_MESSAGE_LENGTH - TRUNCATION_SUFFIX.length) + TRUNCATION_SUFFIX;
13168
13222
  };
13223
+ var CHECKPOINT_CONFLICT_CODE = "CHECKPOINT_CONFLICT";
13169
13224
  var useCodeProjectOrchestrator = () => process.env.USE_CODE_PROJECT_ORCHESTRATOR === "true";
13225
+ var collaboratorLiveSyncEnabled = () => process.env.STUDIO2_COLLABORATOR_LIVE_SYNC === "true";
13226
+ var readApplicationErrorCode = (error) => {
13227
+ if (!http_client_1.HttpClient.isHttpError(error))
13228
+ return void 0;
13229
+ const data = error.response?.data;
13230
+ const code = data?.details?.applicationError?.code;
13231
+ return typeof code === "string" ? code : void 0;
13232
+ };
13233
+ var isCheckpointConflict = (error) => readApplicationErrorCode(error) === CHECKPOINT_CONFLICT_CODE;
13234
+ var readConflictedFiles = (error) => {
13235
+ if (!http_client_1.HttpClient.isHttpError(error))
13236
+ return [];
13237
+ const data = error.response?.data;
13238
+ const files = data?.details?.applicationError?.data?.files;
13239
+ return Array.isArray(files) ? files.filter((file) => typeof file === "string") : [];
13240
+ };
13170
13241
  var wasAuthorizationHeaderSent = (requestHeaders) => {
13171
13242
  if (typeof requestHeaders !== "object" || requestHeaders === null)
13172
13243
  return false;
@@ -13213,6 +13284,13 @@ var require_checkpoint = __commonJS({
13213
13284
  commitHash: resp.data?.checkpointId
13214
13285
  };
13215
13286
  };
13287
+ var callResolveCheckpointConflict = async (client, siteBranchId) => {
13288
+ const resp = await client.request((0, http_2.resolveCheckpointConflict)({
13289
+ siteBranchId,
13290
+ strategy: types_1.ConflictResolutionStrategy.AI
13291
+ }));
13292
+ return resp.data?.jobId ?? void 0;
13293
+ };
13216
13294
  var readToolCommitMessage = (input) => {
13217
13295
  if (typeof input !== "object" || input === null)
13218
13296
  return void 0;
@@ -13257,6 +13335,45 @@ var require_checkpoint = __commonJS({
13257
13335
  commitMessage
13258
13336
  });
13259
13337
  } catch (error) {
13338
+ if (useCodeProjectOrchestrator() && collaboratorLiveSyncEnabled() && job.siteBranchId && isCheckpointConflict(error)) {
13339
+ const files = readConflictedFiles(error);
13340
+ try {
13341
+ const conflictResolutionJobId = await callResolveCheckpointConflict(orchestratorHttpClient, job.siteBranchId);
13342
+ if (!conflictResolutionJobId) {
13343
+ throw new Error("resolveCheckpointConflict returned no conflict resolution job id");
13344
+ }
13345
+ outcome = {
13346
+ status: "resolvingGitConflicts",
13347
+ conflictResolutionJobId,
13348
+ conflictedFiles: files
13349
+ };
13350
+ await host.jobs.updatePayload({ jobId: job.jobId, taskId: job.taskId }, {
13351
+ checkpointStatus: "resolvingGitConflicts",
13352
+ conflictResolutionJobId,
13353
+ conflictedFiles: files
13354
+ }).catch((payloadError) => {
13355
+ host.logger.warn("[Checkpoint] failed to publish the resolving-conflicts state", {
13356
+ projectId: job.projectId,
13357
+ conflictResolutionJobId,
13358
+ error: payloadError instanceof Error ? payloadError.message : String(payloadError)
13359
+ });
13360
+ });
13361
+ host.logger.info("[Checkpoint] git conflicts handed to AI resolution", {
13362
+ projectId: job.projectId,
13363
+ siteBranchId: job.siteBranchId,
13364
+ conflictResolutionJobId,
13365
+ files
13366
+ });
13367
+ return;
13368
+ } catch (resolveError) {
13369
+ host.logger.error("[Checkpoint] git conflict resolution dispatch failed", {
13370
+ projectId: job.projectId,
13371
+ siteBranchId: job.siteBranchId,
13372
+ files,
13373
+ error: resolveError instanceof Error ? resolveError.message : String(resolveError)
13374
+ });
13375
+ }
13376
+ }
13260
13377
  outcome = { status: "failed", error };
13261
13378
  host.logger.error("[Checkpoint] create failed", {
13262
13379
  projectId: job.projectId,
@@ -13302,6 +13419,8 @@ var require_checkpoint = __commonJS({
13302
13419
  throw outcome.error;
13303
13420
  if (outcome?.status === "created")
13304
13421
  return;
13422
+ if (outcome?.status === "resolvingGitConflicts")
13423
+ return;
13305
13424
  if (codegenFailed)
13306
13425
  return;
13307
13426
  const commitMessage = capturedCommitMessage ?? FALLBACK_COMMIT_MESSAGE;
@@ -15148,9 +15267,9 @@ UNDERSTAND INTENT FIRST:
15148
15267
  - 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
15268
 
15150
15269
  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.
15270
+ - Identify all files containing git conflict markers.
15271
+ - The HEAD (OURS) section \u2014 the first side of the conflict \u2014 represents the current branch's changes; preserve this code.
15272
+ - The incoming (THEIRS) section \u2014 the second side \u2014 represents the changes being merged in.
15154
15273
  - Resolve each conflict by merging both sides logically \u2014 judge by SEMANTIC meaning, not line-by-line text:
15155
15274
  - If both sides add independent, non-overlapping code \u2014 include both.
15156
15275
  - If they modify the same logic \u2014 prefer HEAD (OURS) and incorporate non-conflicting parts from THEIRS.
@@ -15173,7 +15292,7 @@ ${(0, shared_rules_1.buildFileOperationsRules)("resolving conflicts")}
15173
15292
  - NEVER run preview, dev, release, or promote commands.
15174
15293
 
15175
15294
  WORKFLOW:
15176
- 1. **Find**: Use \`grep\` to locate all files containing "<<<<<<<".
15295
+ 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
15296
  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
15297
  3. **Verify markers**: Run \`grep\` again to confirm zero conflict markers remain.
15179
15298
  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.434",
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": "b849b4780b251c081a437506b4ded2164211e1e078b19bd3e61e64b7"
33
33
  }