@wix/ditto-codegen-public 1.0.457 → 1.0.458

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