@wix/ditto-codegen-public 1.0.308 → 1.0.309

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 +88 -10
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -13966,6 +13966,66 @@ var require_codegen_flow_helpers = __commonJS({
13966
13966
  }
13967
13967
  });
13968
13968
 
13969
+ // dist/flows/agent-io.js
13970
+ var require_agent_io = __commonJS({
13971
+ "dist/flows/agent-io.js"(exports2) {
13972
+ "use strict";
13973
+ var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
13974
+ return mod && mod.__esModule ? mod : { "default": mod };
13975
+ };
13976
+ Object.defineProperty(exports2, "__esModule", { value: true });
13977
+ exports2.writeAgentInput = writeAgentInput;
13978
+ exports2.readAgentOutput = readAgentOutput;
13979
+ var fs_1 = __importDefault2(require("fs"));
13980
+ var path_1 = __importDefault2(require("path"));
13981
+ var logger_12 = require_logger();
13982
+ var AGENT_INPUT_DIR = path_1.default.join(".wix", "agentInput");
13983
+ var AGENT_OUTPUT_DIR = path_1.default.join(".wix", "agentOutput");
13984
+ function ensureEmptyJsonDir(dir) {
13985
+ fs_1.default.mkdirSync(dir, { recursive: true });
13986
+ for (const file of fs_1.default.readdirSync(dir)) {
13987
+ if (file.endsWith(".json")) {
13988
+ fs_1.default.unlinkSync(path_1.default.join(dir, file));
13989
+ }
13990
+ }
13991
+ }
13992
+ function writeAgentInput(outputPath, agentData) {
13993
+ const inputDir = path_1.default.join(outputPath, AGENT_INPUT_DIR);
13994
+ const outputDir = path_1.default.join(outputPath, AGENT_OUTPUT_DIR);
13995
+ ensureEmptyJsonDir(inputDir);
13996
+ ensureEmptyJsonDir(outputDir);
13997
+ if (!agentData)
13998
+ return;
13999
+ for (const [key, value] of Object.entries(agentData)) {
14000
+ fs_1.default.writeFileSync(path_1.default.join(inputDir, `${key}.json`), JSON.stringify({ [key]: value }));
14001
+ }
14002
+ }
14003
+ function readAgentOutput(outputPath) {
14004
+ const outputDir = path_1.default.join(outputPath, AGENT_OUTPUT_DIR);
14005
+ if (!fs_1.default.existsSync(outputDir))
14006
+ return {};
14007
+ const merged = {};
14008
+ for (const file of fs_1.default.readdirSync(outputDir)) {
14009
+ if (!file.endsWith(".json"))
14010
+ continue;
14011
+ const filePath = path_1.default.join(outputDir, file);
14012
+ const raw = fs_1.default.readFileSync(filePath, "utf-8").trim();
14013
+ if (!raw)
14014
+ continue;
14015
+ try {
14016
+ Object.assign(merged, JSON.parse(raw));
14017
+ } catch (error) {
14018
+ logger_12.logger.warn("[agentOutput] Skipping malformed entry", {
14019
+ file,
14020
+ error: error instanceof Error ? error.message : String(error)
14021
+ });
14022
+ }
14023
+ }
14024
+ return merged;
14025
+ }
14026
+ }
14027
+ });
14028
+
13969
14029
  // ../../node_modules/@wix/bi-logger-dev-tools-data/dist/cjs/v2/index.js
13970
14030
  var require_v2 = __commonJS({
13971
14031
  "../../node_modules/@wix/bi-logger-dev-tools-data/dist/cjs/v2/index.js"(exports2) {
@@ -18286,6 +18346,7 @@ var require_opencode_init = __commonJS({
18286
18346
  var OpenCodeOrchestrator_1 = require_OpenCodeOrchestrator();
18287
18347
  var ditto_codegen_types_12 = require_dist4();
18288
18348
  var codegen_flow_helpers_12 = require_codegen_flow_helpers();
18349
+ var agent_io_1 = require_agent_io();
18289
18350
  var ditto_codegen_types_2 = require_dist4();
18290
18351
  var context_12 = require_context();
18291
18352
  var logger_12 = require_logger();
@@ -18295,7 +18356,7 @@ var require_opencode_init = __commonJS({
18295
18356
  var experiments_1 = require_experiments();
18296
18357
  var environments_12 = require_environments();
18297
18358
  var dev_override_fallback_1 = require_dev_override_fallback();
18298
- var runOpencodeInitFlow = async (blueprint, history) => {
18359
+ var runOpencodeInitFlow = async (blueprint, history, agentData) => {
18299
18360
  const store = job_context_storage_12.jobContextStorage.getStore();
18300
18361
  if (!store?.jobId || !store?.taskId) {
18301
18362
  throw new Error("Job context not available - jobId and taskId are required");
@@ -18318,8 +18379,9 @@ var require_opencode_init = __commonJS({
18318
18379
  Task_model: config_1.DEFAULT_MODEL,
18319
18380
  Task_type: kind
18320
18381
  });
18382
+ const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
18321
18383
  try {
18322
- const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
18384
+ (0, agent_io_1.writeAgentInput)(outputPath, agentData);
18323
18385
  let finalBlueprint = blueprint;
18324
18386
  if ((0, experiments_1.isUserDecisionsEnabled)()) {
18325
18387
  const envConfig = (0, environments_12.getCodegenEnvironmentConfig)();
@@ -18341,12 +18403,14 @@ var require_opencode_init = __commonJS({
18341
18403
  chatHistory: history
18342
18404
  });
18343
18405
  await (0, dev_override_fallback_1.ensureDevOverrideCommitted)(context_12.ctx.projectId);
18406
+ const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
18344
18407
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
18345
18408
  requiredPermissions: result.requiredPermissions,
18346
18409
  history,
18347
18410
  ...store.componentsOverrideId && {
18348
18411
  componentsOverrideId: store.componentsOverrideId
18349
- }
18412
+ },
18413
+ ...agentOutput
18350
18414
  });
18351
18415
  if (!store.isCompleted) {
18352
18416
  await codeGenerationService_12.codeGenerationService.updateTask(jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, {});
@@ -18369,13 +18433,15 @@ var require_opencode_init = __commonJS({
18369
18433
  logger_12.logger.info("[OpenCode Init] Completed task", { taskId });
18370
18434
  } catch (error) {
18371
18435
  const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
18436
+ const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
18372
18437
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
18373
18438
  requiredPermissions: [],
18374
18439
  requiredPermissionsErrors: codegenError,
18375
18440
  history,
18376
18441
  ...store.componentsOverrideId && {
18377
18442
  componentsOverrideId: store.componentsOverrideId
18378
- }
18443
+ },
18444
+ ...agentOutput
18379
18445
  });
18380
18446
  await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
18381
18447
  (0, biEvents_1.reportSessionEnd)({
@@ -18469,13 +18535,14 @@ var require_opencode_iterate = __commonJS({
18469
18535
  var ditto_codegen_types_12 = require_dist4();
18470
18536
  var OpenCodeIterationOrchestrator_1 = require_OpenCodeIterationOrchestrator();
18471
18537
  var codegen_flow_helpers_12 = require_codegen_flow_helpers();
18538
+ var agent_io_1 = require_agent_io();
18472
18539
  var ditto_codegen_types_2 = require_dist4();
18473
18540
  var context_12 = require_context();
18474
18541
  var logger_12 = require_logger();
18475
18542
  var config_1 = require_config();
18476
18543
  var biEvents_1 = require_biEvents();
18477
18544
  var dev_override_fallback_1 = require_dev_override_fallback();
18478
- var runOpencodeIterateFlow = async (chatHistory) => {
18545
+ var runOpencodeIterateFlow = async (chatHistory, agentData) => {
18479
18546
  const store = job_context_storage_12.jobContextStorage.getStore();
18480
18547
  if (!store?.jobId || !store?.taskId) {
18481
18548
  throw new Error("Job context not available - jobId and taskId are required");
@@ -18498,8 +18565,9 @@ var require_opencode_iterate = __commonJS({
18498
18565
  Task_model: config_1.DEFAULT_MODEL,
18499
18566
  Task_type: kind
18500
18567
  });
18568
+ const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
18501
18569
  try {
18502
- const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
18570
+ (0, agent_io_1.writeAgentInput)(outputPath, agentData);
18503
18571
  const iterationOrchestrator = new OpenCodeIterationOrchestrator_1.OpenCodeIterationOrchestrator();
18504
18572
  (0, cli_listeners_1.attachOrchestratorListeners)(iterationOrchestrator);
18505
18573
  const result = await iterationOrchestrator.generateIterationCode({
@@ -18508,11 +18576,13 @@ var require_opencode_iterate = __commonJS({
18508
18576
  chatHistory
18509
18577
  });
18510
18578
  await (0, dev_override_fallback_1.ensureDevOverrideCommitted)(context_12.ctx.projectId);
18579
+ const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
18511
18580
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
18512
18581
  requiredPermissions: result.requiredPermissions,
18513
18582
  ...store.componentsOverrideId && {
18514
18583
  componentsOverrideId: store.componentsOverrideId
18515
- }
18584
+ },
18585
+ ...agentOutput
18516
18586
  });
18517
18587
  const taskOutput = {
18518
18588
  files: result.filesChanged.map((file) => ({
@@ -18536,12 +18606,14 @@ var require_opencode_iterate = __commonJS({
18536
18606
  logger_12.logger.info("[OpenCode Iterate] Completed task", { taskId });
18537
18607
  } catch (error) {
18538
18608
  const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
18609
+ const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
18539
18610
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
18540
18611
  requiredPermissions: [],
18541
18612
  requiredPermissionsErrors: codegenError,
18542
18613
  ...store.componentsOverrideId && {
18543
18614
  componentsOverrideId: store.componentsOverrideId
18544
- }
18615
+ },
18616
+ ...agentOutput
18545
18617
  });
18546
18618
  await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
18547
18619
  (0, biEvents_1.reportSessionEnd)({
@@ -19071,18 +19143,24 @@ async function processJob(job) {
19071
19143
  const payload = task.payload ?? {};
19072
19144
  const history = payload.history ?? [];
19073
19145
  const blueprint = payload.blueprint;
19146
+ const agentData = payload.agentData;
19074
19147
  if (blueprint) {
19075
19148
  logger_1.logger.info("Task blueprint", { blueprint });
19076
19149
  }
19077
19150
  if (history.length > 0) {
19078
19151
  logger_1.logger.info("Task history", { history: history.slice(-5) });
19079
19152
  }
19153
+ if (agentData) {
19154
+ logger_1.logger.info("Task agentData keys", {
19155
+ keys: Object.keys(agentData)
19156
+ });
19157
+ }
19080
19158
  if (task.kind === CodeGenService_1.TaskKind.ASK_CODEGEN) {
19081
19159
  await (0, opencode_ask_1.runOpencodeAskFlow)(history);
19082
19160
  } else if (task.kind === CodeGenService_1.TaskKind.ITERATE_CODEGEN) {
19083
- await (0, opencode_iterate_1.runOpencodeIterateFlow)(history);
19161
+ await (0, opencode_iterate_1.runOpencodeIterateFlow)(history, agentData);
19084
19162
  } else if (task.kind === CodeGenService_1.TaskKind.INIT_CODEGEN && blueprint) {
19085
- await (0, opencode_init_1.runOpencodeInitFlow)(blueprint, history);
19163
+ await (0, opencode_init_1.runOpencodeInitFlow)(blueprint, history, agentData);
19086
19164
  }
19087
19165
  } finally {
19088
19166
  jobCancellationMonitor.stop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.308",
3
+ "version": "1.0.309",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -27,5 +27,5 @@
27
27
  "@wix/ditto-codegen": "1.0.0",
28
28
  "esbuild": "^0.27.2"
29
29
  },
30
- "falconPackageHash": "86abe43a4f9a5cfc0584d42be59aae11d34b42b6f2c96aad165e51ee"
30
+ "falconPackageHash": "4acd64f6af57d3fef8d56f6a18da4b692f95086df19401b18e42a97c"
31
31
  }