@wix/ditto-codegen-public 1.0.503 → 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.
- package/dist/out.js +68 -6
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -16328,6 +16328,7 @@ var require_validation_state = __commonJS({
|
|
|
16328
16328
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
16329
16329
|
exports2.VALIDATION_NUDGE = exports2.USER_SOURCE_SCAN = exports2.USER_ATTACHMENTS_LIST = exports2.VALIDATION_STATE_PLUGIN_FILENAME = exports2.VALIDATION_LOADED_EVENT_TYPE = exports2.VALIDATION_STATE_EVENT_TYPE = void 0;
|
|
16330
16330
|
exports2.isReadOnlyShellCommand = isReadOnlyShellCommand;
|
|
16331
|
+
exports2.validationFailureDetail = validationFailureDetail;
|
|
16331
16332
|
exports2.buildValidationStateSource = buildValidationStateSource;
|
|
16332
16333
|
exports2.writeValidationStatePlugin = writeValidationStatePlugin;
|
|
16333
16334
|
var write_plugin_1 = require_write_plugin();
|
|
@@ -16345,6 +16346,17 @@ var require_validation_state = __commonJS({
|
|
|
16345
16346
|
exports2.USER_ATTACHMENTS_LIST = ".wix/agentInput/userAttachments.json";
|
|
16346
16347
|
exports2.USER_SOURCE_SCAN = `${skills_override_12.SKILLS_DIR}/wix-app/scripts/scan-user-source.cjs`;
|
|
16347
16348
|
exports2.VALIDATION_NUDGE = "Project files need validation. Follow your validation workflow (delegate to codegen-validator if your instructions require it), run validate({ runBuild: true }), and fix any errors before finishing. Your last message is shown to the user: once validation passes, end with a short plain-language summary for them: what changed, and if there is something you could not do, why and what they need to do next. Do not mention validation.";
|
|
16349
|
+
function validationFailureDetail(output) {
|
|
16350
|
+
const MAX_FAILURE_DETAIL_CHARS = 1800;
|
|
16351
|
+
const TRUNCATED_MARKER = "\n[truncated]";
|
|
16352
|
+
if (typeof output !== "string")
|
|
16353
|
+
return void 0;
|
|
16354
|
+
const start = output.search(/^FAILED at/m);
|
|
16355
|
+
if (start === -1)
|
|
16356
|
+
return void 0;
|
|
16357
|
+
const detail = output.slice(start).trim();
|
|
16358
|
+
return detail.length > MAX_FAILURE_DETAIL_CHARS ? detail.slice(0, MAX_FAILURE_DETAIL_CHARS - TRUNCATED_MARKER.length) + TRUNCATED_MARKER : detail;
|
|
16359
|
+
}
|
|
16348
16360
|
function buildValidationStateSource() {
|
|
16349
16361
|
return String.raw`// Generated by @wix/ditto-codegen (validation-state). Do not edit.
|
|
16350
16362
|
const EVENT_TYPE = ${JSON.stringify(exports2.VALIDATION_STATE_EVENT_TYPE)};
|
|
@@ -16355,6 +16367,7 @@ const injectCreatedBy = ${detect_1.injectCreatedBy.toString()};
|
|
|
16355
16367
|
const prepareCreatedExtensionFiles = ${prepare_created_by_1.prepareCreatedExtensionFiles.toString()};
|
|
16356
16368
|
const isMissingGitRepository = ${repository_status_1.isMissingGitRepository.toString()};
|
|
16357
16369
|
const isReadOnlyShellCommand = ${isReadOnlyShellCommand.toString()};
|
|
16370
|
+
const validationFailureDetail = ${validationFailureDetail.toString()};
|
|
16358
16371
|
const USER_ATTACHMENTS_LIST = ${JSON.stringify(exports2.USER_ATTACHMENTS_LIST)};
|
|
16359
16372
|
const USER_SOURCE_SCAN = ${JSON.stringify(exports2.USER_SOURCE_SCAN)};
|
|
16360
16373
|
const changedEditorComponents = ${user_source_port_1.changedEditorComponents.toString()};
|
|
@@ -16440,7 +16453,8 @@ export const ValidationState = async ({ client, directory, $ }) => {
|
|
|
16440
16453
|
let currentFingerprint = cleanFingerprint;
|
|
16441
16454
|
let hasValidationFailure = process.env.CODEGEN_REQUIRE_VALIDATION === "1";
|
|
16442
16455
|
let hasUnvalidatedMutation = false;
|
|
16443
|
-
let
|
|
16456
|
+
let lastRow;
|
|
16457
|
+
let currentFailure;
|
|
16444
16458
|
let mutationEpoch = 0;
|
|
16445
16459
|
let revisionNudges = 0;
|
|
16446
16460
|
let totalNudges = 0;
|
|
@@ -16449,9 +16463,11 @@ export const ValidationState = async ({ client, directory, $ }) => {
|
|
|
16449
16463
|
const activeMutations = new Set();
|
|
16450
16464
|
const key = (input) => input.sessionID + ":" + input.callID;
|
|
16451
16465
|
const emit = (sessionID, clean) => {
|
|
16452
|
-
|
|
16453
|
-
|
|
16454
|
-
|
|
16466
|
+
const failure = clean ? undefined : currentFailure;
|
|
16467
|
+
const rowKey = JSON.stringify([clean, failure]);
|
|
16468
|
+
if (lastRow === rowKey) return;
|
|
16469
|
+
lastRow = rowKey;
|
|
16470
|
+
process.stdout.write(JSON.stringify({ type: EVENT_TYPE, sessionID, clean, ...(failure ? { failure } : {}) }) + "\n");
|
|
16455
16471
|
};
|
|
16456
16472
|
const refresh = async (sessionID) => {
|
|
16457
16473
|
const fingerprint = await snapshot();
|
|
@@ -16488,6 +16504,7 @@ export const ValidationState = async ({ client, directory, $ }) => {
|
|
|
16488
16504
|
// discarded that validation. The after hook still compares fingerprints.
|
|
16489
16505
|
if (input.tool === "bash" && typeof args.command === "string" && isReadOnlyShellCommand(args.command)) return;
|
|
16490
16506
|
hasUnvalidatedMutation = true;
|
|
16507
|
+
currentFailure = undefined;
|
|
16491
16508
|
revisionNudges = 0;
|
|
16492
16509
|
mutationEpoch += 1;
|
|
16493
16510
|
activeMutations.add(key(input));
|
|
@@ -16504,6 +16521,9 @@ export const ValidationState = async ({ client, directory, $ }) => {
|
|
|
16504
16521
|
validations.delete(key(input));
|
|
16505
16522
|
const passed = typeof output.output === "string" && !/^FAILED at/m.test(output.output);
|
|
16506
16523
|
if (!passed) hasValidationFailure = true;
|
|
16524
|
+
if (input.args?.runBuild === true && epoch !== undefined && epoch === mutationEpoch && activeMutations.size === 0) {
|
|
16525
|
+
currentFailure = passed ? undefined : validationFailureDetail(output.output);
|
|
16526
|
+
}
|
|
16507
16527
|
if (passed && input.args?.runBuild === true) {
|
|
16508
16528
|
const fingerprint = await snapshot();
|
|
16509
16529
|
if (epoch === mutationEpoch && activeMutations.size === 0 && validations.size === 0) {
|
|
@@ -16568,6 +16588,7 @@ var require_parser = __commonJS({
|
|
|
16568
16588
|
exports2.createEmptyUsageStats = createEmptyUsageStats;
|
|
16569
16589
|
exports2.parseUsageStats = parseUsageStats;
|
|
16570
16590
|
exports2.mergeUsageStats = mergeUsageStats;
|
|
16591
|
+
exports2.hasRequestTooLargeError = hasRequestTooLargeError;
|
|
16571
16592
|
exports2.hasSessionError = hasSessionError;
|
|
16572
16593
|
exports2.summarizeOpenCodeLine = summarizeOpenCodeLine;
|
|
16573
16594
|
var types_1 = require_types4();
|
|
@@ -16586,7 +16607,7 @@ var require_parser = __commonJS({
|
|
|
16586
16607
|
if (event?.type !== validation_state_1.VALIDATION_STATE_EVENT_TYPE || typeof event.sessionID !== "string" || typeof event.clean !== "boolean") {
|
|
16587
16608
|
continue;
|
|
16588
16609
|
}
|
|
16589
|
-
validationState = event;
|
|
16610
|
+
validationState = typeof event.failure === "string" ? event : { ...event, failure: void 0 };
|
|
16590
16611
|
}
|
|
16591
16612
|
return validationState;
|
|
16592
16613
|
}
|
|
@@ -16664,6 +16685,20 @@ var require_parser = __commonJS({
|
|
|
16664
16685
|
stepCount: a.stepCount + b.stepCount
|
|
16665
16686
|
};
|
|
16666
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
|
+
}
|
|
16667
16702
|
function hasSessionError(output) {
|
|
16668
16703
|
const lines = output.split("\n");
|
|
16669
16704
|
let foundError = false;
|
|
@@ -17969,6 +18004,7 @@ var require_executor = __commonJS({
|
|
|
17969
18004
|
"dist/opencode-integration/execution/executor.js"(exports2) {
|
|
17970
18005
|
"use strict";
|
|
17971
18006
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18007
|
+
exports2.REQUEST_TOO_LARGE_MESSAGE = void 0;
|
|
17972
18008
|
exports2.reserveHostValidationRepairAttempt = reserveHostValidationRepairAttempt;
|
|
17973
18009
|
exports2.updateRequiredPermissions = updateRequiredPermissions;
|
|
17974
18010
|
exports2.classifyAttempt = classifyAttempt;
|
|
@@ -17994,12 +18030,18 @@ var require_executor = __commonJS({
|
|
|
17994
18030
|
var MAX_RETRIES = 5;
|
|
17995
18031
|
var MAX_HOST_VALIDATION_FAILURES = 2;
|
|
17996
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
|
+
}
|
|
17997
18037
|
function failureReason(result) {
|
|
17998
18038
|
if (result.stalled)
|
|
17999
18039
|
return "stall";
|
|
18000
18040
|
if (result.error instanceof host_validation_1.HostValidationError) {
|
|
18001
18041
|
return "host validation failure";
|
|
18002
18042
|
}
|
|
18043
|
+
if (isRequestTooLarge(result))
|
|
18044
|
+
return "request too large";
|
|
18003
18045
|
if ((0, parser_1.hasSessionError)(result.stdout))
|
|
18004
18046
|
return "session error";
|
|
18005
18047
|
if (result.error instanceof ditto_codegen_types_12.ProcessExecutionError) {
|
|
@@ -18022,6 +18064,9 @@ var require_executor = __commonJS({
|
|
|
18022
18064
|
const reason = failureReason(result);
|
|
18023
18065
|
if (!reason)
|
|
18024
18066
|
return { retryable: false, reason: null };
|
|
18067
|
+
if (reason === "request too large") {
|
|
18068
|
+
return { retryable: false, reason };
|
|
18069
|
+
}
|
|
18025
18070
|
if (reason === "host validation failure") {
|
|
18026
18071
|
if (result.error instanceof host_validation_1.HostValidationError && result.error.stage === "agent validation state") {
|
|
18027
18072
|
return { retryable: false, reason };
|
|
@@ -18033,6 +18078,19 @@ var require_executor = __commonJS({
|
|
|
18033
18078
|
}
|
|
18034
18079
|
return { retryable: stalls < MAX_STALL_ATTEMPTS, reason };
|
|
18035
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
|
+
}
|
|
18036
18094
|
async function applyPostRunValidation(result, postRunValidation) {
|
|
18037
18095
|
if (!result.success || !postRunValidation)
|
|
18038
18096
|
return result;
|
|
@@ -18097,6 +18155,9 @@ var require_executor = __commonJS({
|
|
|
18097
18155
|
stalls
|
|
18098
18156
|
});
|
|
18099
18157
|
}
|
|
18158
|
+
if (reason === "request too large") {
|
|
18159
|
+
result = explainRequestTooLarge(result);
|
|
18160
|
+
}
|
|
18100
18161
|
accumulatedUsage = await resolveFinalRunCost(accumulatedUsage, options, baselineCost);
|
|
18101
18162
|
const finalResult2 = {
|
|
18102
18163
|
...result,
|
|
@@ -18288,7 +18349,8 @@ var require_session_validation = __commonJS({
|
|
|
18288
18349
|
}
|
|
18289
18350
|
throw new host_validation_1.HostValidationError("agent validation state", "validate({ runBuild: true })", {
|
|
18290
18351
|
exitCode: 1,
|
|
18291
|
-
stderr:
|
|
18352
|
+
stderr: validationState.failure ? `The last validate({ runBuild: true }) failed and no file changed after it:
|
|
18353
|
+
${validationState.failure}` : "Project files remain unvalidated after the in-session validation reminders."
|
|
18292
18354
|
});
|
|
18293
18355
|
}
|
|
18294
18356
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/ditto-codegen-public",
|
|
3
|
-
"version": "1.0.
|
|
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": "
|
|
32
|
+
"falconPackageHash": "8759f1eea369ec862c67056534b5821642a84f374ae8421d0c0fb16f"
|
|
33
33
|
}
|