@wix/ditto-codegen-public 1.0.504 → 1.0.505

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 +41 -0
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -16588,6 +16588,7 @@ var require_parser = __commonJS({
16588
16588
  exports2.createEmptyUsageStats = createEmptyUsageStats;
16589
16589
  exports2.parseUsageStats = parseUsageStats;
16590
16590
  exports2.mergeUsageStats = mergeUsageStats;
16591
+ exports2.hasRequestTooLargeError = hasRequestTooLargeError;
16591
16592
  exports2.hasSessionError = hasSessionError;
16592
16593
  exports2.summarizeOpenCodeLine = summarizeOpenCodeLine;
16593
16594
  var types_1 = require_types4();
@@ -16684,6 +16685,20 @@ var require_parser = __commonJS({
16684
16685
  stepCount: a.stepCount + b.stepCount
16685
16686
  };
16686
16687
  }
16688
+ var REQUEST_TOO_LARGE = /request entity too large|payload too large/i;
16689
+ var HTTP_PAYLOAD_TOO_LARGE = 413;
16690
+ function hasRequestTooLargeError(output) {
16691
+ let lastError;
16692
+ for (const line of output.split("\n")) {
16693
+ if (!line.trim())
16694
+ continue;
16695
+ const event = (0, types_1.tryParseJson)(line);
16696
+ if (event?.type === "error")
16697
+ lastError = event;
16698
+ }
16699
+ const data = lastError?.error?.data;
16700
+ return data?.statusCode === HTTP_PAYLOAD_TOO_LARGE || typeof data?.message === "string" && REQUEST_TOO_LARGE.test(data.message);
16701
+ }
16687
16702
  function hasSessionError(output) {
16688
16703
  const lines = output.split("\n");
16689
16704
  let foundError = false;
@@ -17989,6 +18004,7 @@ var require_executor = __commonJS({
17989
18004
  "dist/opencode-integration/execution/executor.js"(exports2) {
17990
18005
  "use strict";
17991
18006
  Object.defineProperty(exports2, "__esModule", { value: true });
18007
+ exports2.REQUEST_TOO_LARGE_MESSAGE = void 0;
17992
18008
  exports2.reserveHostValidationRepairAttempt = reserveHostValidationRepairAttempt;
17993
18009
  exports2.updateRequiredPermissions = updateRequiredPermissions;
17994
18010
  exports2.classifyAttempt = classifyAttempt;
@@ -18014,12 +18030,18 @@ var require_executor = __commonJS({
18014
18030
  var MAX_RETRIES = 5;
18015
18031
  var MAX_HOST_VALIDATION_FAILURES = 2;
18016
18032
  var MAX_STALL_ATTEMPTS = 2;
18033
+ var OPENCODE_ERROR_EXIT_CODE = 1;
18034
+ function isRequestTooLarge(result) {
18035
+ return !result.success && result.exitCode === OPENCODE_ERROR_EXIT_CODE && (0, parser_1.hasRequestTooLargeError)(result.stdout);
18036
+ }
18017
18037
  function failureReason(result) {
18018
18038
  if (result.stalled)
18019
18039
  return "stall";
18020
18040
  if (result.error instanceof host_validation_1.HostValidationError) {
18021
18041
  return "host validation failure";
18022
18042
  }
18043
+ if (isRequestTooLarge(result))
18044
+ return "request too large";
18023
18045
  if ((0, parser_1.hasSessionError)(result.stdout))
18024
18046
  return "session error";
18025
18047
  if (result.error instanceof ditto_codegen_types_12.ProcessExecutionError) {
@@ -18042,6 +18064,9 @@ var require_executor = __commonJS({
18042
18064
  const reason = failureReason(result);
18043
18065
  if (!reason)
18044
18066
  return { retryable: false, reason: null };
18067
+ if (reason === "request too large") {
18068
+ return { retryable: false, reason };
18069
+ }
18045
18070
  if (reason === "host validation failure") {
18046
18071
  if (result.error instanceof host_validation_1.HostValidationError && result.error.stage === "agent validation state") {
18047
18072
  return { retryable: false, reason };
@@ -18053,6 +18078,19 @@ var require_executor = __commonJS({
18053
18078
  }
18054
18079
  return { retryable: stalls < MAX_STALL_ATTEMPTS, reason };
18055
18080
  }
18081
+ exports2.REQUEST_TOO_LARGE_MESSAGE = "The request to the model was too large, most likely because of the attached images. Try again with fewer or smaller images.";
18082
+ function explainRequestTooLarge(result) {
18083
+ return {
18084
+ ...result,
18085
+ success: false,
18086
+ error: new ditto_codegen_types_12.ProcessExecutionError(exports2.REQUEST_TOO_LARGE_MESSAGE, {
18087
+ processType: ditto_codegen_types_12.ProcessType.EXECUTION,
18088
+ exitCode: result.exitCode ?? void 0,
18089
+ stderr: result.stderr,
18090
+ cause: result.error
18091
+ })
18092
+ };
18093
+ }
18056
18094
  async function applyPostRunValidation(result, postRunValidation) {
18057
18095
  if (!result.success || !postRunValidation)
18058
18096
  return result;
@@ -18117,6 +18155,9 @@ var require_executor = __commonJS({
18117
18155
  stalls
18118
18156
  });
18119
18157
  }
18158
+ if (reason === "request too large") {
18159
+ result = explainRequestTooLarge(result);
18160
+ }
18120
18161
  accumulatedUsage = await resolveFinalRunCost(accumulatedUsage, options, baselineCost);
18121
18162
  const finalResult2 = {
18122
18163
  ...result,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.504",
3
+ "version": "1.0.505",
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": "aaff4b292f969433a252c3409ae065214add5e83b52dfd2c9634273a"
32
+ "falconPackageHash": "8759f1eea369ec862c67056534b5821642a84f374ae8421d0c0fb16f"
33
33
  }