@wix/ditto-codegen-public 1.0.457 → 1.0.459

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 +79 -13
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -13081,9 +13081,11 @@ var require_checkpoint = __commonJS({
13081
13081
  }
13082
13082
  outcome = { status: "failed", error };
13083
13083
  const checkpointError = readCheckpointErrorMessage(error);
13084
+ if (checkpointError && error instanceof Error)
13085
+ error.message = checkpointError;
13084
13086
  host.logger.error("[Checkpoint] create failed", {
13085
13087
  projectId: job.projectId,
13086
- error: error instanceof Error ? error.message : String(error)
13088
+ error: checkpointError
13087
13089
  });
13088
13090
  if (!checkpointExists) {
13089
13091
  await host.jobs.updatePayload({ jobId: job.jobId, taskId: job.taskId }, {
@@ -15334,7 +15336,7 @@ var require_config = __commonJS({
15334
15336
  "dist/opencode-integration/configuration/config.js"(exports2) {
15335
15337
  "use strict";
15336
15338
  Object.defineProperty(exports2, "__esModule", { value: true });
15337
- exports2.DEFAULT_TIMEOUT_MS = void 0;
15339
+ exports2.PROVIDER_CHUNK_TIMEOUT_MS = exports2.DEFAULT_TIMEOUT_MS = void 0;
15338
15340
  exports2.getAnthropicBaseUrl = getAnthropicBaseUrl;
15339
15341
  exports2.getOpenAiBaseUrl = getOpenAiBaseUrl;
15340
15342
  exports2.getGoogleBaseUrl = getGoogleBaseUrl;
@@ -15380,6 +15382,7 @@ var require_config = __commonJS({
15380
15382
  ".git/**",
15381
15383
  ".astro/**"
15382
15384
  ];
15385
+ exports2.PROVIDER_CHUNK_TIMEOUT_MS = 9e4;
15383
15386
  function getProviderConfig(projectId) {
15384
15387
  const environment = (0, environments_12.getValidatedCodegenEnvironment)();
15385
15388
  const chargingMode = (0, environments_12.getCodegenEnvironmentConfig)().chargingMode ?? "app";
@@ -15398,7 +15401,8 @@ var require_config = __commonJS({
15398
15401
  options: {
15399
15402
  apiKey: "proxy-handled",
15400
15403
  cacheControl: true,
15401
- headers
15404
+ headers,
15405
+ chunkTimeout: exports2.PROVIDER_CHUNK_TIMEOUT_MS
15402
15406
  }
15403
15407
  }
15404
15408
  };
@@ -15410,7 +15414,8 @@ var require_config = __commonJS({
15410
15414
  // don't "clean up" apiKey — removing it 403s every openai request.
15411
15415
  apiKey: "proxy-handled",
15412
15416
  baseURL: getOpenAiBaseUrl(projectId),
15413
- headers
15417
+ headers,
15418
+ chunkTimeout: exports2.PROVIDER_CHUNK_TIMEOUT_MS
15414
15419
  }
15415
15420
  };
15416
15421
  }
@@ -15419,7 +15424,8 @@ var require_config = __commonJS({
15419
15424
  options: {
15420
15425
  apiKey: "proxy-handled",
15421
15426
  baseURL: getGoogleBaseUrl(projectId),
15422
- headers
15427
+ headers,
15428
+ chunkTimeout: exports2.PROVIDER_CHUNK_TIMEOUT_MS
15423
15429
  },
15424
15430
  // Wix AI proxy aliases not in models.dev — opencode would reject them
15425
15431
  // with ModelNotFoundError without these stubs. Empty records are enough;
@@ -15629,18 +15635,20 @@ var require_subagent_tool_logger = __commonJS({
15629
15635
  "dist/opencode-integration/plugins/subagent-tool-logger.js"(exports2) {
15630
15636
  "use strict";
15631
15637
  Object.defineProperty(exports2, "__esModule", { value: true });
15632
- exports2.SUBAGENT_TOOL_LOGGER_FILENAME = exports2.SUBAGENT_STARTED_EVENT_TYPE = exports2.SUBAGENT_TOOL_EVENT_TYPE = void 0;
15638
+ exports2.SUBAGENT_TOOL_LOGGER_FILENAME = exports2.TOOL_STARTED_EVENT_TYPE = exports2.SUBAGENT_STARTED_EVENT_TYPE = exports2.SUBAGENT_TOOL_EVENT_TYPE = void 0;
15633
15639
  exports2.buildSubagentToolLoggerPluginSource = buildSubagentToolLoggerPluginSource;
15634
15640
  exports2.writeSubagentToolLoggerPlugin = writeSubagentToolLoggerPlugin;
15635
15641
  var write_plugin_1 = require_write_plugin();
15636
15642
  var subagents_1 = require_subagents();
15637
15643
  exports2.SUBAGENT_TOOL_EVENT_TYPE = "subagent_tool_use";
15638
15644
  exports2.SUBAGENT_STARTED_EVENT_TYPE = "subagent_started";
15645
+ exports2.TOOL_STARTED_EVENT_TYPE = "tool_started";
15639
15646
  exports2.SUBAGENT_TOOL_LOGGER_FILENAME = "subagent-tool-logger.ts";
15640
15647
  function buildSubagentToolLoggerPluginSource() {
15641
15648
  return `// Generated by @wix/ditto-codegen (subagent-tool-logger) \u2014 do not edit.
15642
15649
  const EVENT_TYPE = ${JSON.stringify(exports2.SUBAGENT_TOOL_EVENT_TYPE)};
15643
15650
  const STARTED_EVENT_TYPE = ${JSON.stringify(exports2.SUBAGENT_STARTED_EVENT_TYPE)};
15651
+ const TOOL_STARTED_EVENT_TYPE = ${JSON.stringify(exports2.TOOL_STARTED_EVENT_TYPE)};
15644
15652
  const SUBAGENT_AGENTS = new Set(${JSON.stringify(subagents_1.SUBAGENT_AGENT_NAMES)});
15645
15653
 
15646
15654
  export const SubagentToolLogger = async () => {
@@ -15652,6 +15660,8 @@ export const SubagentToolLogger = async () => {
15652
15660
  const emitted = new Set();
15653
15661
  // sessions we've already emitted a start marker for (events repeat).
15654
15662
  const started = new Set();
15663
+ // callIDs we've announced as started \u2014 a running part updates repeatedly.
15664
+ const toolStarted = new Set();
15655
15665
 
15656
15666
  // Emit the start marker once per subagent session, stamped with opencode's
15657
15667
  // own creation time \u2014 NOT the plugin's observation time (Date.now), which
@@ -15708,6 +15718,25 @@ export const SubagentToolLogger = async () => {
15708
15718
  if (part?.type !== "tool") return;
15709
15719
 
15710
15720
  const status = part.state?.status;
15721
+
15722
+ // Before the subagent filter: root parts are never in agentBySession.
15723
+ if (status === "running") {
15724
+ if (!part.callID || toolStarted.has(part.callID)) return;
15725
+ toolStarted.add(part.callID);
15726
+ const startedAt = part.state?.time?.start;
15727
+ process.stdout.write(
15728
+ JSON.stringify({
15729
+ type: TOOL_STARTED_EVENT_TYPE,
15730
+ timestamp: startedAt || Date.now(),
15731
+ exactTime: startedAt != null,
15732
+ sessionID: part.sessionID,
15733
+ callID: part.callID,
15734
+ tool: part.tool,
15735
+ }) + "\\n",
15736
+ );
15737
+ return;
15738
+ }
15739
+
15711
15740
  if (status !== "completed" && status !== "error") return;
15712
15741
 
15713
15742
  const agent = agentBySession.get(part.sessionID);
@@ -16499,7 +16528,7 @@ var require_plugins_runtime = __commonJS({
16499
16528
  const requestId = http_client_1.HttpClient.isHttpError(pluginError) && pluginError.requestId || void 0;
16500
16529
  await codeGenerationService_12.codeGenerationService.handlePluginFailure({
16501
16530
  pluginName,
16502
- error: (0, utils_12.errorStack)(pluginError),
16531
+ error: http_client_1.HttpClient.isHttpError(pluginError) ? errorMessage(pluginError) : (0, utils_12.errorStack)(pluginError),
16503
16532
  requestId,
16504
16533
  jobId: store?.jobId,
16505
16534
  metasiteId: store?.metasiteId,
@@ -16702,11 +16731,12 @@ var require_process_manager = __commonJS({
16702
16731
  "dist/opencode-integration/execution/process-manager.js"(exports2) {
16703
16732
  "use strict";
16704
16733
  Object.defineProperty(exports2, "__esModule", { value: true });
16705
- exports2.MAX_STARTS_WITHOUT_FINISH = exports2.IDLE_CHECK_INTERVAL_MS = exports2.IDLE_TIMEOUT_MS = void 0;
16734
+ exports2.MAX_STARTS_WITHOUT_FINISH = exports2.IDLE_CHECK_INTERVAL_MS = exports2.GENERATING_IDLE_TIMEOUT_MS = exports2.IDLE_TIMEOUT_MS = void 0;
16706
16735
  exports2.clearTimers = clearTimers;
16707
16736
  exports2.killProcess = killProcess;
16708
16737
  var logger_12 = require_logger();
16709
16738
  exports2.IDLE_TIMEOUT_MS = 6e5;
16739
+ exports2.GENERATING_IDLE_TIMEOUT_MS = 18e4;
16710
16740
  exports2.IDLE_CHECK_INTERVAL_MS = 15e3;
16711
16741
  var KILL_GRACE_PERIOD_MS = 5e3;
16712
16742
  exports2.MAX_STARTS_WITHOUT_FINISH = 3;
@@ -16825,6 +16855,8 @@ var require_process_handlers = __commonJS({
16825
16855
  "use strict";
16826
16856
  Object.defineProperty(exports2, "__esModule", { value: true });
16827
16857
  exports2.setupTotalTimeout = setupTotalTimeout;
16858
+ exports2.trackToolActivity = trackToolActivity;
16859
+ exports2.idleBudgetMs = idleBudgetMs;
16828
16860
  exports2.setupIdleWatchdog = setupIdleWatchdog;
16829
16861
  exports2.trackTurnProgress = trackTurnProgress;
16830
16862
  exports2.setupStdoutHandler = setupStdoutHandler;
@@ -16834,6 +16866,7 @@ var require_process_handlers = __commonJS({
16834
16866
  var parser_1 = require_parser();
16835
16867
  var config_12 = require_config();
16836
16868
  var ditto_codegen_types_12 = require_dist4();
16869
+ var subagent_tool_logger_1 = require_subagent_tool_logger();
16837
16870
  var process_manager_1 = require_process_manager();
16838
16871
  var result_builder_1 = require_result_builder();
16839
16872
  var logger_12 = require_logger();
@@ -16846,15 +16879,43 @@ var require_process_handlers = __commonJS({
16846
16879
  }
16847
16880
  }, config_12.DEFAULT_TIMEOUT_MS);
16848
16881
  }
16882
+ function trackToolActivity(state, event) {
16883
+ if (event.type === subagent_tool_logger_1.TOOL_STARTED_EVENT_TYPE) {
16884
+ state.toolActivitySeen = true;
16885
+ const { callID } = event;
16886
+ if (callID)
16887
+ state.inFlightToolCalls.add(callID);
16888
+ return;
16889
+ }
16890
+ if (event.type === "tool_use" || event.type === subagent_tool_logger_1.SUBAGENT_TOOL_EVENT_TYPE) {
16891
+ const callID = event.part?.callID;
16892
+ if (callID)
16893
+ state.inFlightToolCalls.delete(callID);
16894
+ return;
16895
+ }
16896
+ if (event.type === "step_finish")
16897
+ state.inFlightToolCalls.clear();
16898
+ }
16899
+ function idleBudgetMs(state) {
16900
+ if (!state.toolActivitySeen)
16901
+ return process_manager_1.IDLE_TIMEOUT_MS;
16902
+ return state.inFlightToolCalls.size > 0 ? process_manager_1.IDLE_TIMEOUT_MS : process_manager_1.GENERATING_IDLE_TIMEOUT_MS;
16903
+ }
16849
16904
  function setupIdleWatchdog(ctx) {
16850
16905
  return setInterval(() => {
16851
16906
  if (ctx.state.resolved)
16852
16907
  return;
16853
16908
  const idleTime = Date.now() - ctx.state.lastOutputTime;
16854
- if (idleTime >= process_manager_1.IDLE_TIMEOUT_MS) {
16855
- logger_12.logger.warn(`[OpenCode] Process appears stuck - no output for ${Math.round(idleTime / 1e3)}s. Killing process.`);
16909
+ const budget = idleBudgetMs(ctx.state);
16910
+ if (idleTime >= budget) {
16911
+ const seconds = Math.round(idleTime / 1e3);
16912
+ logger_12.logger.warn(`[OpenCode] Process appears stuck - no output for ${seconds}s. Killing process.`, {
16913
+ budgetMs: budget,
16914
+ inFlightToolCalls: ctx.state.inFlightToolCalls.size,
16915
+ toolActivitySeen: ctx.state.toolActivitySeen
16916
+ });
16856
16917
  (0, process_manager_1.killProcess)(ctx.child, ctx.state.resolved);
16857
- ctx.finalize((0, result_builder_1.createTimeoutResult)(`Process stuck - no output for ${Math.round(idleTime / 1e3)} seconds (idle timeout)`, ctx.state.stdout, ctx.state.stderr, ctx.startTime));
16918
+ ctx.finalize((0, result_builder_1.createTimeoutResult)(`Process stuck - no output for ${seconds} seconds (idle timeout)`, ctx.state.stdout, ctx.state.stderr, ctx.startTime));
16858
16919
  }
16859
16920
  }, process_manager_1.IDLE_CHECK_INTERVAL_MS);
16860
16921
  }
@@ -16881,7 +16942,10 @@ var require_process_handlers = __commonJS({
16881
16942
  } catch {
16882
16943
  logger_12.logger.debug("[OpenCode] stdout", { line: line.slice(0, 200) });
16883
16944
  }
16884
- if (!event || !trackProgress)
16945
+ if (!event)
16946
+ return null;
16947
+ trackToolActivity(ctx.state, event);
16948
+ if (!trackProgress)
16885
16949
  return null;
16886
16950
  try {
16887
16951
  trackTurnProgress(ctx.state, event);
@@ -17096,7 +17160,9 @@ var require_executor = __commonJS({
17096
17160
  lineBuffer: "",
17097
17161
  lastOutputTime: Date.now(),
17098
17162
  resolved: false,
17099
- startsWithoutFinish: 0
17163
+ startsWithoutFinish: 0,
17164
+ inFlightToolCalls: /* @__PURE__ */ new Set(),
17165
+ toolActivitySeen: false
17100
17166
  };
17101
17167
  const timers = {
17102
17168
  timeoutId: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.457",
3
+ "version": "1.0.459",
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": "ca4eb489e9a1029b7b98a4af11bfdc27fed6489f43aa896bd4252489"
32
+ "falconPackageHash": "970e850b808573512383361f099e1a46fb60d2fd18b3c2b39a735c14"
33
33
  }