@wix/ditto-codegen-public 1.0.245 → 1.0.246
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 +9 -32
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -45320,36 +45320,22 @@ var require_executor = __commonJS({
|
|
|
45320
45320
|
var prompt_builder_1 = require_prompt_builder();
|
|
45321
45321
|
var task_tracker_1 = require_task_tracker();
|
|
45322
45322
|
var process_manager_1 = require_process_manager();
|
|
45323
|
-
var result_builder_1 = require_result_builder();
|
|
45324
45323
|
var process_handlers_1 = require_process_handlers();
|
|
45325
45324
|
var MAX_RETRIES = 5;
|
|
45326
45325
|
async function executeOpenCode(options) {
|
|
45327
45326
|
let lastResult = null;
|
|
45328
45327
|
let accumulatedStdout = "";
|
|
45329
45328
|
let accumulatedUsage = (0, parser_1.createEmptyUsageStats)();
|
|
45329
|
+
let currentPrompt = options.prompt;
|
|
45330
45330
|
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
45331
45331
|
if (attempt > 1) {
|
|
45332
|
-
console.log(`[OpenCode] Retry attempt ${attempt}/${MAX_RETRIES} -
|
|
45332
|
+
console.log(`[OpenCode] Retry attempt ${attempt}/${MAX_RETRIES} - starting fresh session with recovery context`);
|
|
45333
|
+
const filesChanged = (0, parser_1.parseFilesChanged)(accumulatedStdout);
|
|
45334
|
+
currentPrompt = (0, prompt_builder_1.buildRecoveryPrompt)(options.prompt, filesChanged, lastResult?.error?.message || lastResult?.stderr || "Process timed out");
|
|
45333
45335
|
}
|
|
45334
|
-
const result = await executeOpenCodeOnce(options, attempt);
|
|
45336
|
+
const result = await executeOpenCodeOnce({ ...options, prompt: currentPrompt }, attempt);
|
|
45335
45337
|
accumulatedStdout += result.stdout;
|
|
45336
45338
|
accumulatedUsage = (0, parser_1.mergeUsageStats)(accumulatedUsage, result.usage);
|
|
45337
|
-
if (attempt > 1 && (0, result_builder_1.isCorruptedSessionError)(result)) {
|
|
45338
|
-
console.log(`[OpenCode] Corrupted session detected on --continue attempt ${attempt}. Starting fresh session with recovery context.`);
|
|
45339
|
-
const filesChanged = (0, parser_1.parseFilesChanged)(accumulatedStdout);
|
|
45340
|
-
const recoveryPrompt = (0, prompt_builder_1.buildRecoveryPrompt)(options.prompt, filesChanged, result.error?.message || result.stderr);
|
|
45341
|
-
const recoveryResult = await executeOpenCodeOnce({ ...options, prompt: recoveryPrompt }, 1);
|
|
45342
|
-
accumulatedStdout += recoveryResult.stdout;
|
|
45343
|
-
accumulatedUsage = (0, parser_1.mergeUsageStats)(accumulatedUsage, recoveryResult.usage);
|
|
45344
|
-
const finalResult2 = {
|
|
45345
|
-
...recoveryResult,
|
|
45346
|
-
filesChanged: (0, parser_1.parseFilesChanged)(accumulatedStdout),
|
|
45347
|
-
usage: accumulatedUsage
|
|
45348
|
-
};
|
|
45349
|
-
console.log(`
|
|
45350
|
-
${(0, parser_1.formatUsageStats)(finalResult2.usage)}`);
|
|
45351
|
-
return finalResult2;
|
|
45352
|
-
}
|
|
45353
45339
|
const errorMsg = result.error?.message.toLowerCase() ?? "";
|
|
45354
45340
|
const isRetryableFailure = !result.success && errorMsg.includes("idle timeout");
|
|
45355
45341
|
if (result.success || !isRetryableFailure) {
|
|
@@ -45363,7 +45349,7 @@ ${(0, parser_1.formatUsageStats)(finalResult2.usage)}`);
|
|
|
45363
45349
|
return finalResult2;
|
|
45364
45350
|
}
|
|
45365
45351
|
lastResult = result;
|
|
45366
|
-
console.log(`[OpenCode] Attempt ${attempt}/${MAX_RETRIES} failed due to idle timeout \u2014 will retry with
|
|
45352
|
+
console.log(`[OpenCode] Attempt ${attempt}/${MAX_RETRIES} failed due to idle timeout \u2014 will retry with recovery prompt`);
|
|
45367
45353
|
}
|
|
45368
45354
|
console.log(`[OpenCode] All ${MAX_RETRIES} retry attempts exhausted`);
|
|
45369
45355
|
const finalResult = {
|
|
@@ -45375,16 +45361,7 @@ ${(0, parser_1.formatUsageStats)(finalResult2.usage)}`);
|
|
|
45375
45361
|
${(0, parser_1.formatUsageStats)(finalResult.usage)}`);
|
|
45376
45362
|
return finalResult;
|
|
45377
45363
|
}
|
|
45378
|
-
function buildArgs(
|
|
45379
|
-
if (attempt > 1) {
|
|
45380
|
-
return [
|
|
45381
|
-
"run",
|
|
45382
|
-
"--continue",
|
|
45383
|
-
"--format",
|
|
45384
|
-
"json",
|
|
45385
|
-
"Continue from where you left off. The previous attempt may have been interrupted."
|
|
45386
|
-
];
|
|
45387
|
-
}
|
|
45364
|
+
function buildArgs(prompt) {
|
|
45388
45365
|
return ["run", "--format", "json", prompt];
|
|
45389
45366
|
}
|
|
45390
45367
|
async function executeOpenCodeOnce(options, attempt) {
|
|
@@ -45424,8 +45401,8 @@ ${(0, parser_1.formatUsageStats)(finalResult.usage)}`);
|
|
|
45424
45401
|
finalize: finalize2
|
|
45425
45402
|
};
|
|
45426
45403
|
try {
|
|
45427
|
-
const args = buildArgs(
|
|
45428
|
-
console.log(`[OpenCode] Executing (attempt ${attempt}/${MAX_RETRIES}): opencode run
|
|
45404
|
+
const args = buildArgs(prompt);
|
|
45405
|
+
console.log(`[OpenCode] Executing (attempt ${attempt}/${MAX_RETRIES}): opencode run --format json <prompt>`);
|
|
45429
45406
|
console.log(`[OpenCode] Working directory: ${outputPath}`);
|
|
45430
45407
|
ctx.child = (0, child_process_1.spawn)("opencode", args, {
|
|
45431
45408
|
cwd: outputPath,
|
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.246",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"@wix/ditto-codegen": "1.0.0",
|
|
29
29
|
"esbuild": "^0.27.2"
|
|
30
30
|
},
|
|
31
|
-
"falconPackageHash": "
|
|
31
|
+
"falconPackageHash": "54aee6086f8c14810a73a32f78183ca7213e34d07eb7301d1aa17b45"
|
|
32
32
|
}
|