@wix/ditto-codegen-public 1.0.460 → 1.0.462

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 +57 -9
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -13133,7 +13133,7 @@ var require_checkpoint = __commonJS({
13133
13133
  },
13134
13134
  // Flow-end fallback: only fires if onToolUse didn't already create the
13135
13135
  // checkpoint. Re-throws an earlier failure so the task is marked failed.
13136
- async onFlowEnd({ codegenFailed }) {
13136
+ async onFlowEnd({ codegenFailed, filesChanged }) {
13137
13137
  if (outcome?.status === "failed")
13138
13138
  throw outcome.error;
13139
13139
  if (outcome?.status === "created")
@@ -13142,6 +13142,8 @@ var require_checkpoint = __commonJS({
13142
13142
  return;
13143
13143
  if (codegenFailed)
13144
13144
  return;
13145
+ if (!filesChanged)
13146
+ return;
13145
13147
  const commitMessage = capturedCommitMessage ?? FALLBACK_COMMIT_MESSAGE;
13146
13148
  await commitCheckpoint(commitMessage);
13147
13149
  }
@@ -15186,6 +15188,31 @@ WORKFLOW:
15186
15188
  }
15187
15189
  });
15188
15190
 
15191
+ // dist/opencode-integration/install-manifest.js
15192
+ var require_install_manifest = __commonJS({
15193
+ "dist/opencode-integration/install-manifest.js"(exports2) {
15194
+ "use strict";
15195
+ Object.defineProperty(exports2, "__esModule", { value: true });
15196
+ exports2.SHARED_CODEGEN_RULE_FILENAME = exports2.OPENCODE_TOOLS_DIR = void 0;
15197
+ exports2.listAlwaysOnToolFiles = listAlwaysOnToolFiles;
15198
+ exports2.getCodegenRuleFilenames = getCodegenRuleFilenames;
15199
+ var promises_1 = require("fs/promises");
15200
+ var path_12 = require("path");
15201
+ exports2.OPENCODE_TOOLS_DIR = (0, path_12.join)(__dirname, "opencode-tools");
15202
+ exports2.SHARED_CODEGEN_RULE_FILENAME = "codegen-instructions.md";
15203
+ async function listAlwaysOnToolFiles() {
15204
+ const entries = await (0, promises_1.readdir)(exports2.OPENCODE_TOOLS_DIR);
15205
+ return entries.filter((file) => file.endsWith(".ts"));
15206
+ }
15207
+ function getCodegenRuleFilenames(config) {
15208
+ return [
15209
+ exports2.SHARED_CODEGEN_RULE_FILENAME,
15210
+ ...config.codegenRules.map((rule) => rule.filename)
15211
+ ];
15212
+ }
15213
+ }
15214
+ });
15215
+
15189
15216
  // dist/jobs/job-decision-manager.js
15190
15217
  var require_job_decision_manager = __commonJS({
15191
15218
  "dist/jobs/job-decision-manager.js"(exports2) {
@@ -15274,6 +15301,7 @@ var require_environments = __commonJS({
15274
15301
  var codegen_rules_1 = require_codegen_rules();
15275
15302
  var ask_rules_1 = require_ask_rules();
15276
15303
  var git_conflicts_rules_1 = require_git_conflicts_rules();
15304
+ var install_manifest_1 = require_install_manifest();
15277
15305
  var job_decision_manager_1 = require_job_decision_manager();
15278
15306
  var logger_12 = require_logger();
15279
15307
  var SHARED_GIT_CONFLICTS_RULE = {
@@ -15282,7 +15310,7 @@ var require_environments = __commonJS({
15282
15310
  };
15283
15311
  var withSharedRules = (env) => {
15284
15312
  const sharedCodegenRule = {
15285
- filename: "codegen-instructions.md",
15313
+ filename: install_manifest_1.SHARED_CODEGEN_RULE_FILENAME,
15286
15314
  content: (0, codegen_rules_1.buildCodegenRules)(env.environmentIdentity)
15287
15315
  };
15288
15316
  const sharedAskRule = {
@@ -22882,6 +22910,7 @@ var require_opencode_init = __commonJS({
22882
22910
  store.gitBaseline = gitBaseline;
22883
22911
  const orchestrator = new opencode_orchestrator_1.OpenCodeOrchestrator();
22884
22912
  let caughtError;
22913
+ let filesChanged = false;
22885
22914
  try {
22886
22915
  (0, agent_io_1.writeAgentInput)(outputPath, agentData);
22887
22916
  const envConfig = (0, environments_12.getCodegenEnvironmentConfig)();
@@ -22903,6 +22932,7 @@ var require_opencode_init = __commonJS({
22903
22932
  });
22904
22933
  store.lastAgentMessage = result.agentMessage;
22905
22934
  const files = await (0, file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
22935
+ filesChanged = files.length > 0;
22906
22936
  const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
22907
22937
  const extensions = await (0, job_payload_1.buildExtensionsJobPayload)(outputPath, files);
22908
22938
  await (0, inject_created_by_1.injectCreatedByIntoExtensionFiles)(outputPath, extensions.created);
@@ -22947,6 +22977,7 @@ var require_opencode_init = __commonJS({
22947
22977
  caughtError = error;
22948
22978
  const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
22949
22979
  const failedRunPayload = await (0, codegen_flow_helpers_12.buildFailedRunPayload)(codegenError, outputPath, gitBaseline);
22980
+ filesChanged = (failedRunPayload.files?.length ?? 0) > 0;
22950
22981
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, failedRunPayload);
22951
22982
  await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
22952
22983
  const taskCost = orchestrator.lastUsage ? Math.round(orchestrator.lastUsage.cost * 1e6) : void 0;
@@ -22976,7 +23007,11 @@ var require_opencode_init = __commonJS({
22976
23007
  error: error instanceof Error ? error.message : String(error)
22977
23008
  });
22978
23009
  } finally {
22979
- await (0, plugins_runtime_1.runOnFlowEnd)((0, plugins_runtime_1.getActivePlugins)(), { codegenFailed: caughtError !== void 0, codegenError: caughtError }, logger_12.logger);
23010
+ await (0, plugins_runtime_1.runOnFlowEnd)((0, plugins_runtime_1.getActivePlugins)(), {
23011
+ codegenFailed: caughtError !== void 0,
23012
+ codegenError: caughtError,
23013
+ filesChanged
23014
+ }, logger_12.logger);
22980
23015
  }
22981
23016
  };
22982
23017
  exports2.runOpencodeInitFlow = runOpencodeInitFlow;
@@ -23096,6 +23131,7 @@ var require_opencode_iterate = __commonJS({
23096
23131
  store.gitBaseline = gitBaseline;
23097
23132
  const iterationOrchestrator = new opencode_iteration_orchestrator_1.OpenCodeIterationOrchestrator();
23098
23133
  let caughtError;
23134
+ let filesChanged = false;
23099
23135
  try {
23100
23136
  (0, agent_io_1.writeAgentInput)(outputPath, agentData);
23101
23137
  (0, cli_listeners_1.attachOrchestratorListeners)(iterationOrchestrator);
@@ -23107,6 +23143,7 @@ var require_opencode_iterate = __commonJS({
23107
23143
  });
23108
23144
  store.lastAgentMessage = result.agentMessage;
23109
23145
  const files = await (0, file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
23146
+ filesChanged = files.length > 0;
23110
23147
  const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
23111
23148
  const extensions = await (0, job_payload_1.buildExtensionsJobPayload)(outputPath, files);
23112
23149
  await (0, inject_created_by_1.injectCreatedByIntoExtensionFiles)(outputPath, extensions.created);
@@ -23151,6 +23188,7 @@ var require_opencode_iterate = __commonJS({
23151
23188
  caughtError = error;
23152
23189
  const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
23153
23190
  const failedRunPayload = await (0, codegen_flow_helpers_12.buildFailedRunPayload)(codegenError, outputPath, gitBaseline);
23191
+ filesChanged = (failedRunPayload.files?.length ?? 0) > 0;
23154
23192
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, failedRunPayload);
23155
23193
  await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
23156
23194
  const taskCost = iterationOrchestrator.lastUsage ? Math.round(iterationOrchestrator.lastUsage.cost * 1e6) : void 0;
@@ -23180,7 +23218,11 @@ var require_opencode_iterate = __commonJS({
23180
23218
  error: error instanceof Error ? error.message : String(error)
23181
23219
  });
23182
23220
  } finally {
23183
- await (0, plugins_runtime_1.runOnFlowEnd)((0, plugins_runtime_1.getActivePlugins)(), { codegenFailed: caughtError !== void 0, codegenError: caughtError }, logger_12.logger);
23221
+ await (0, plugins_runtime_1.runOnFlowEnd)((0, plugins_runtime_1.getActivePlugins)(), {
23222
+ codegenFailed: caughtError !== void 0,
23223
+ codegenError: caughtError,
23224
+ filesChanged
23225
+ }, logger_12.logger);
23184
23226
  }
23185
23227
  };
23186
23228
  exports2.runOpencodeIterateFlow = runOpencodeIterateFlow;
@@ -23476,6 +23518,7 @@ var require_opencode_fix_git_conflicts = __commonJS({
23476
23518
  store.gitBaseline = gitBaseline;
23477
23519
  const orchestrator = new opencode_git_conflicts_orchestrator_1.OpenCodeGitConflictsOrchestrator();
23478
23520
  let caughtError;
23521
+ let filesChanged = false;
23479
23522
  try {
23480
23523
  (0, cli_listeners_1.attachOrchestratorListeners)(orchestrator);
23481
23524
  const result = await orchestrator.fixConflicts({
@@ -23486,6 +23529,7 @@ var require_opencode_fix_git_conflicts = __commonJS({
23486
23529
  });
23487
23530
  store.lastAgentMessage = result.agentMessage;
23488
23531
  const files = await (0, file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
23532
+ filesChanged = files.length > 0;
23489
23533
  const extensions = await (0, job_payload_1.buildExtensionsJobPayload)(outputPath, files);
23490
23534
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
23491
23535
  requiredPermissions: result.requiredPermissions,
@@ -23526,6 +23570,7 @@ var require_opencode_fix_git_conflicts = __commonJS({
23526
23570
  caughtError = error;
23527
23571
  const codegenError = (0, ditto_codegen_types_12.toCodegenError)(error);
23528
23572
  const files = await (0, file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
23573
+ filesChanged = files.length > 0;
23529
23574
  const extensions = await (0, job_payload_1.buildExtensionsJobPayload)(outputPath, files);
23530
23575
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
23531
23576
  requiredPermissions: [],
@@ -23561,7 +23606,11 @@ var require_opencode_fix_git_conflicts = __commonJS({
23561
23606
  error: error instanceof Error ? error.message : String(error)
23562
23607
  });
23563
23608
  } finally {
23564
- await (0, plugins_runtime_1.runOnFlowEnd)((0, plugins_runtime_1.getActivePlugins)(), { codegenFailed: caughtError !== void 0, codegenError: caughtError }, logger_12.logger);
23609
+ await (0, plugins_runtime_1.runOnFlowEnd)((0, plugins_runtime_1.getActivePlugins)(), {
23610
+ codegenFailed: caughtError !== void 0,
23611
+ codegenError: caughtError,
23612
+ filesChanged
23613
+ }, logger_12.logger);
23565
23614
  }
23566
23615
  };
23567
23616
  exports2.runOpencodeGitConflictsFlow = runOpencodeGitConflictsFlow;
@@ -23927,14 +23976,13 @@ var require_tools_writer = __commonJS({
23927
23976
  var os_1 = require("os");
23928
23977
  var path_12 = require("path");
23929
23978
  var logger_12 = require_logger();
23979
+ var install_manifest_1 = require_install_manifest();
23930
23980
  var GLOBAL_TOOLS_DIR = (0, path_12.join)((0, os_1.homedir)(), ".config", "opencode", "tools");
23931
- var OPENCODE_TOOLS_DIR = (0, path_12.join)(__dirname, "opencode-tools");
23932
23981
  async function writeToolFiles(pluginTools = []) {
23933
23982
  await (0, promises_1.mkdir)(GLOBAL_TOOLS_DIR, { recursive: true });
23934
- const entries = await (0, promises_1.readdir)(OPENCODE_TOOLS_DIR);
23935
- const alwaysOnTools = entries.filter((f) => f.endsWith(".ts"));
23983
+ const alwaysOnTools = await (0, install_manifest_1.listAlwaysOnToolFiles)();
23936
23984
  await Promise.all([
23937
- ...alwaysOnTools.map((file) => (0, promises_1.copyFile)((0, path_12.join)(OPENCODE_TOOLS_DIR, file), (0, path_12.join)(GLOBAL_TOOLS_DIR, file))),
23985
+ ...alwaysOnTools.map((file) => (0, promises_1.copyFile)((0, path_12.join)(install_manifest_1.OPENCODE_TOOLS_DIR, file), (0, path_12.join)(GLOBAL_TOOLS_DIR, file))),
23938
23986
  ...pluginTools.map((tool) => (0, promises_1.writeFile)((0, path_12.join)(GLOBAL_TOOLS_DIR, tool.filename), tool.source, "utf-8"))
23939
23987
  ]);
23940
23988
  logger_12.logger.info("[OpenCode] Wrote global tool files", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.460",
3
+ "version": "1.0.462",
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": "e6561e5a727b55a245386f362f90a3b9067acd7032132ad063fdcbc5"
32
+ "falconPackageHash": "d0ead5d9d6a2d1c1d936e9fffcda2faef1bca6e18f0115a19388fc3b"
33
33
  }