@wix/ditto-codegen-public 1.0.225 → 1.0.227
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 +13 -196
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -7641,6 +7641,16 @@ var require_CodeGenService = __commonJS({
|
|
|
7641
7641
|
}
|
|
7642
7642
|
}));
|
|
7643
7643
|
};
|
|
7644
|
+
this.markJobAsRuninng = async (jobId) => {
|
|
7645
|
+
await this.httpClient.request((0, http_1.updateJob)({
|
|
7646
|
+
projectId: this.projectId,
|
|
7647
|
+
job: {
|
|
7648
|
+
id: jobId,
|
|
7649
|
+
projectId: this.projectId,
|
|
7650
|
+
status: types_1.Status.RUNNING
|
|
7651
|
+
}
|
|
7652
|
+
}));
|
|
7653
|
+
};
|
|
7644
7654
|
this.markJobAsCancelled = async (jobId) => {
|
|
7645
7655
|
await this.httpClient.request((0, http_1.updateJob)({
|
|
7646
7656
|
projectId: this.projectId,
|
|
@@ -105678,124 +105688,6 @@ Please provide the complete fixed file content that resolves ALL the errors list
|
|
|
105678
105688
|
}
|
|
105679
105689
|
});
|
|
105680
105690
|
|
|
105681
|
-
// dist/agents/BuildFixerAgent.js
|
|
105682
|
-
var require_BuildFixerAgent = __commonJS({
|
|
105683
|
-
"dist/agents/BuildFixerAgent.js"(exports2) {
|
|
105684
|
-
"use strict";
|
|
105685
|
-
var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
|
|
105686
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
105687
|
-
};
|
|
105688
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
105689
|
-
exports2.BuildFixerAgent = void 0;
|
|
105690
|
-
var zod_1 = require_zod();
|
|
105691
|
-
var ditto_codegen_types_12 = require_dist();
|
|
105692
|
-
var codegen_common_logic_1 = require_dist12();
|
|
105693
|
-
var dedent_1 = __importDefault2(require_dedent());
|
|
105694
|
-
var constants_1 = require_constants2();
|
|
105695
|
-
var customAnthropicProvider_1 = require_customAnthropicProvider();
|
|
105696
|
-
var tools_1 = require_tools2();
|
|
105697
|
-
var BuildFixSchema = zod_1.z.object({
|
|
105698
|
-
filePath: zod_1.z.string().describe("Relative path to the file to fix"),
|
|
105699
|
-
fixedContent: zod_1.z.string().describe("The complete fixed file content"),
|
|
105700
|
-
summary: zod_1.z.string().describe("Brief summary of what was fixed")
|
|
105701
|
-
});
|
|
105702
|
-
var SUBMIT_FIX_TOOL_NAME = "submit_fix";
|
|
105703
|
-
function createSubmitFixTool() {
|
|
105704
|
-
return {
|
|
105705
|
-
description: "Submit the fix for a build error. Use this after reading the file and understanding what needs to be fixed.",
|
|
105706
|
-
inputSchema: BuildFixSchema,
|
|
105707
|
-
execute: async (input) => input
|
|
105708
|
-
};
|
|
105709
|
-
}
|
|
105710
|
-
var BuildFixerAgent = class {
|
|
105711
|
-
constructor() {
|
|
105712
|
-
this.name = "BuildFixerAgent";
|
|
105713
|
-
}
|
|
105714
|
-
buildSystemPrompt() {
|
|
105715
|
-
return (0, dedent_1.default)`You are an expert TypeScript/JavaScript developer. Your task is to fix build errors.
|
|
105716
|
-
|
|
105717
|
-
WORKFLOW:
|
|
105718
|
-
1. Analyze the build output to identify the error type and files involved
|
|
105719
|
-
2. Read the relevant file(s) to understand the context
|
|
105720
|
-
3. ALWAYS call submit_fix with your fix - this is REQUIRED
|
|
105721
|
-
|
|
105722
|
-
EXTENSION-VALIDATOR ERRORS (most common):
|
|
105723
|
-
Format: "[field] message (... → ./path/source.ts)"
|
|
105724
|
-
- Look for the arrow (→) - it points to a source file path
|
|
105725
|
-
- The extension.ts config is in the SAME FOLDER as that source file
|
|
105726
|
-
- Example: "→ ./backend/spi/foo/plugin.ts" means read:
|
|
105727
|
-
- ./backend/spi/foo/plugin.ts (source)
|
|
105728
|
-
- ./backend/spi/foo/extension.ts (config)
|
|
105729
|
-
- READ BOTH files before deciding which one needs the fix
|
|
105730
|
-
|
|
105731
|
-
OTHER BUILD ERRORS:
|
|
105732
|
-
- Read the file mentioned in the error
|
|
105733
|
-
- Use the error message and file content to determine the fix
|
|
105734
|
-
|
|
105735
|
-
CRITICAL RULES:
|
|
105736
|
-
- You MUST call submit_fix at the end - never respond with just text
|
|
105737
|
-
- Read files FIRST, then submit the fix
|
|
105738
|
-
- Read only 1-2 files maximum
|
|
105739
|
-
- Make minimal changes - only fix what's broken
|
|
105740
|
-
- Preserve code style and formatting`;
|
|
105741
|
-
}
|
|
105742
|
-
formatPreviousBuildOutput(previousBuildOutput) {
|
|
105743
|
-
if (!previousBuildOutput) {
|
|
105744
|
-
return "";
|
|
105745
|
-
}
|
|
105746
|
-
return (0, dedent_1.default)`
|
|
105747
|
-
The following build output was from the previous fix attempt.
|
|
105748
|
-
Please try a DIFFERENT approach to solve the remaining errors:
|
|
105749
|
-
|
|
105750
|
-
${previousBuildOutput}
|
|
105751
|
-
`;
|
|
105752
|
-
}
|
|
105753
|
-
async fixBuildErrors(input) {
|
|
105754
|
-
const previousErrorsSection = this.formatPreviousBuildOutput(input.previousBuildOutput);
|
|
105755
|
-
const userMessage = (0, dedent_1.default)`
|
|
105756
|
-
BUILD OUTPUT:
|
|
105757
|
-
${input.buildOutput}
|
|
105758
|
-
|
|
105759
|
-
${previousErrorsSection}
|
|
105760
|
-
|
|
105761
|
-
Instructions:
|
|
105762
|
-
1. Identify the error type and files involved
|
|
105763
|
-
2. Read the relevant file(s) first to understand the context
|
|
105764
|
-
3. After reading, submit the fix for the file that needs changing
|
|
105765
|
-
`;
|
|
105766
|
-
console.log(`\u{1F527} BuildFixerAgent starting with tools...`);
|
|
105767
|
-
const model = (0, customAnthropicProvider_1.createCustomTextModel)()(constants_1.LLM_MODELS.CLAUDE_HAIKU_4_5, {
|
|
105768
|
-
agentName: this.name
|
|
105769
|
-
});
|
|
105770
|
-
try {
|
|
105771
|
-
const result = await (0, codegen_common_logic_1.generateAgentText)({
|
|
105772
|
-
agentName: this.name,
|
|
105773
|
-
model,
|
|
105774
|
-
tools: {
|
|
105775
|
-
[tools_1.TOOL_NAMES.READ_FILE]: (0, tools_1.createReadFileTool)(input.projectDir),
|
|
105776
|
-
[SUBMIT_FIX_TOOL_NAME]: createSubmitFixTool()
|
|
105777
|
-
},
|
|
105778
|
-
systemPrompt: this.buildSystemPrompt(),
|
|
105779
|
-
userMessage,
|
|
105780
|
-
stopWhen: (0, codegen_common_logic_1.stopOnToolCall)(SUBMIT_FIX_TOOL_NAME)
|
|
105781
|
-
});
|
|
105782
|
-
const fixResult = (0, codegen_common_logic_1.extractToolResult)(result.toolCalls, SUBMIT_FIX_TOOL_NAME);
|
|
105783
|
-
if (!fixResult) {
|
|
105784
|
-
throw new ditto_codegen_types_12.AutoFixError("BuildFixerAgent did not submit a fix", {
|
|
105785
|
-
validationType: ditto_codegen_types_12.ValidationType.BUILD
|
|
105786
|
-
});
|
|
105787
|
-
}
|
|
105788
|
-
console.log(`\u{1F527} BuildFixerAgent fix submitted for: ${fixResult.filePath}`);
|
|
105789
|
-
return fixResult;
|
|
105790
|
-
} catch (error) {
|
|
105791
|
-
throw (0, ditto_codegen_types_12.toCodegenError)(error);
|
|
105792
|
-
}
|
|
105793
|
-
}
|
|
105794
|
-
};
|
|
105795
|
-
exports2.BuildFixerAgent = BuildFixerAgent;
|
|
105796
|
-
}
|
|
105797
|
-
});
|
|
105798
|
-
|
|
105799
105691
|
// dist/fixers/NaiveErrorFixer.js
|
|
105800
105692
|
var require_NaiveErrorFixer = __commonJS({
|
|
105801
105693
|
"dist/fixers/NaiveErrorFixer.js"(exports2) {
|
|
@@ -105807,7 +105699,6 @@ var require_NaiveErrorFixer = __commonJS({
|
|
|
105807
105699
|
var fs_1 = __importDefault2(require("fs"));
|
|
105808
105700
|
var path_1 = __importDefault2(require("path"));
|
|
105809
105701
|
var NaiveFixerAgent_1 = require_NaiveFixerAgent();
|
|
105810
|
-
var BuildFixerAgent_1 = require_BuildFixerAgent();
|
|
105811
105702
|
var ditto_codegen_types_12 = require_dist();
|
|
105812
105703
|
var NaiveErrorFixer = class {
|
|
105813
105704
|
constructor() {
|
|
@@ -105850,30 +105741,6 @@ var require_NaiveErrorFixer = __commonJS({
|
|
|
105850
105741
|
throw (0, ditto_codegen_types_12.toCodegenError)(error);
|
|
105851
105742
|
}
|
|
105852
105743
|
}
|
|
105853
|
-
async fixBuildErrors(projectDir, buildOutput, previousBuildOutput) {
|
|
105854
|
-
const buildFixerAgent = new BuildFixerAgent_1.BuildFixerAgent();
|
|
105855
|
-
try {
|
|
105856
|
-
const result = await buildFixerAgent.fixBuildErrors({
|
|
105857
|
-
projectDir,
|
|
105858
|
-
buildOutput,
|
|
105859
|
-
previousBuildOutput
|
|
105860
|
-
});
|
|
105861
|
-
const absolutePath = path_1.default.join(projectDir, result.filePath);
|
|
105862
|
-
if (!fs_1.default.existsSync(absolutePath)) {
|
|
105863
|
-
console.warn(`\u26A0\uFE0F File not found: ${absolutePath}`);
|
|
105864
|
-
return { fixed: false, summary: result.summary };
|
|
105865
|
-
}
|
|
105866
|
-
fs_1.default.writeFileSync(absolutePath, result.fixedContent, "utf8");
|
|
105867
|
-
console.log(`\u2705 Applied build fix to ${result.filePath}`);
|
|
105868
|
-
if (result.summary) {
|
|
105869
|
-
console.log(`\u{1F4CB} Build fix summary: ${result.summary}`);
|
|
105870
|
-
}
|
|
105871
|
-
return { fixed: true, summary: result.summary };
|
|
105872
|
-
} catch (error) {
|
|
105873
|
-
console.error(`\u274C Build fix failed:`, error);
|
|
105874
|
-
throw (0, ditto_codegen_types_12.toCodegenError)(error);
|
|
105875
|
-
}
|
|
105876
|
-
}
|
|
105877
105744
|
};
|
|
105878
105745
|
exports2.default = NaiveErrorFixer;
|
|
105879
105746
|
var formatErrorToString = (err) => {
|
|
@@ -105917,7 +105784,6 @@ var require_fixFlow = __commonJS({
|
|
|
105917
105784
|
};
|
|
105918
105785
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
105919
105786
|
exports2.startFixFlow = startFixFlow;
|
|
105920
|
-
var child_process_1 = require("child_process");
|
|
105921
105787
|
var utils_1 = require_utils15();
|
|
105922
105788
|
var ValidatorFactory_1 = __importDefault2(require_ValidatorFactory());
|
|
105923
105789
|
var FixerFactory_1 = __importDefault2(require_FixerFactory());
|
|
@@ -105926,41 +105792,6 @@ var require_fixFlow = __commonJS({
|
|
|
105926
105792
|
var codeGenerationService_12 = require_codeGenerationService();
|
|
105927
105793
|
var MAX_ERRORS_PER_BATCH = 20;
|
|
105928
105794
|
var MAX_FIX_ATTEMPTS = 3;
|
|
105929
|
-
var MAX_BUILD_FIX_ATTEMPTS = 3;
|
|
105930
|
-
var runBuild = (projectDir) => {
|
|
105931
|
-
const result = (0, child_process_1.spawnSync)("npm", ["run", "build"], {
|
|
105932
|
-
cwd: projectDir,
|
|
105933
|
-
stdio: "pipe",
|
|
105934
|
-
shell: true,
|
|
105935
|
-
env: process.env
|
|
105936
|
-
});
|
|
105937
|
-
return {
|
|
105938
|
-
status: result.status ?? 1,
|
|
105939
|
-
output: (result.stdout?.toString() || "") + (result.stderr?.toString() || "")
|
|
105940
|
-
};
|
|
105941
|
-
};
|
|
105942
|
-
var runBuildFixLoop = async (projectDir, fixer, attempt = 1, previousBuildOutput) => {
|
|
105943
|
-
if (attempt > MAX_BUILD_FIX_ATTEMPTS) {
|
|
105944
|
-
return false;
|
|
105945
|
-
}
|
|
105946
|
-
const buildResult = runBuild(projectDir);
|
|
105947
|
-
if (buildResult.status === 0) {
|
|
105948
|
-
console.log(`\u2705 Build passed`);
|
|
105949
|
-
return true;
|
|
105950
|
-
}
|
|
105951
|
-
console.log(`\u274C Build failed (attempt ${attempt}/${MAX_BUILD_FIX_ATTEMPTS}), trying to fix...`);
|
|
105952
|
-
try {
|
|
105953
|
-
const buildFixResult = await fixer.fixBuildErrors(projectDir, buildResult.output, previousBuildOutput);
|
|
105954
|
-
if (!buildFixResult.fixed) {
|
|
105955
|
-
console.log(`\u26A0\uFE0F No fixes generated for build errors`);
|
|
105956
|
-
return false;
|
|
105957
|
-
}
|
|
105958
|
-
return runBuildFixLoop(projectDir, fixer, attempt + 1, buildResult.output);
|
|
105959
|
-
} catch (fixError) {
|
|
105960
|
-
console.error(`\u274C Failed to fix build errors: ${fixError instanceof Error ? fixError.message : String(fixError)}`);
|
|
105961
|
-
return false;
|
|
105962
|
-
}
|
|
105963
|
-
};
|
|
105964
105795
|
var toErrorSummary = (error) => ({
|
|
105965
105796
|
filePath: error.filePath,
|
|
105966
105797
|
line: error.line,
|
|
@@ -106046,22 +105877,9 @@ var require_fixFlow = __commonJS({
|
|
|
106046
105877
|
const isLastAttempt = attempt === MAX_FIX_ATTEMPTS;
|
|
106047
105878
|
if (validationPassed) {
|
|
106048
105879
|
const fixedErrors = getFixedErrors([]);
|
|
106049
|
-
console.log(`\u2705 ${validator.type} validation passed
|
|
106050
|
-
const buildPassed = await runBuildFixLoop(projectDir, fixer);
|
|
106051
|
-
if (!buildPassed) {
|
|
106052
|
-
const finalBuildResult = runBuild(projectDir);
|
|
106053
|
-
await updateFixTask(ditto_codegen_types_12.Status.COMPLETED, {
|
|
106054
|
-
description: `Fixed ${fixedErrors.length} TypeScript errors, but build still failing`,
|
|
106055
|
-
warning: `Build error: ${finalBuildResult.output.slice(0, 500)}`,
|
|
106056
|
-
fixedErrors: fixedErrors.map(toErrorSummary)
|
|
106057
|
-
});
|
|
106058
|
-
throw new ditto_codegen_types_12.CodeValidationError("Build failed after TypeScript passed", {
|
|
106059
|
-
validationType: ditto_codegen_types_12.ValidationType.BUILD,
|
|
106060
|
-
errors: []
|
|
106061
|
-
});
|
|
106062
|
-
}
|
|
105880
|
+
console.log(`\u2705 ${validator.type} validation passed`);
|
|
106063
105881
|
await updateFixTask(ditto_codegen_types_12.Status.COMPLETED, {
|
|
106064
|
-
description: `Fixed ${fixedErrors.length} TypeScript errors
|
|
105882
|
+
description: `Fixed ${fixedErrors.length} TypeScript errors.`,
|
|
106065
105883
|
fixedErrors: fixedErrors.map(toErrorSummary)
|
|
106066
105884
|
});
|
|
106067
105885
|
return;
|
|
@@ -107288,7 +107106,6 @@ var require_init_codegen = __commonJS({
|
|
|
107288
107106
|
var runInitCodegenFlow = async (blueprint, history) => {
|
|
107289
107107
|
const localJobContext = job_context_storage_12.jobContextStorage.getStore();
|
|
107290
107108
|
console.log(`[Init] Starting init codegen task: jobId=${localJobContext?.jobId}, taskId=${localJobContext?.taskId}`);
|
|
107291
|
-
await codeGenerationService_12.codeGenerationService.updateJobStatus(localJobContext.jobId, ditto_codegen_types_12.Status.RUNNING);
|
|
107292
107109
|
await codeGenerationService_12.codeGenerationService.updateTask(localJobContext.jobId, localJobContext.taskId, ditto_codegen_types_12.Status.RUNNING, {});
|
|
107293
107110
|
console.log(`[Init] Marked task RUNNING: jobId=${localJobContext.jobId}, taskId=${localJobContext.taskId}`);
|
|
107294
107111
|
try {
|
|
@@ -321362,7 +321179,6 @@ var require_iterate_codegen = __commonJS({
|
|
|
321362
321179
|
var runIterateCodegenFlow = async (chatHistory) => {
|
|
321363
321180
|
const localJobContext = job_context_storage_12.jobContextStorage.getStore();
|
|
321364
321181
|
console.log(`[Iterate] Starting iterate codegen task: jobId=${localJobContext?.jobId}, taskId=${localJobContext?.taskId}`);
|
|
321365
|
-
await codeGenerationService_12.codeGenerationService.updateJobStatus(localJobContext.jobId, ditto_codegen_types_12.Status.RUNNING);
|
|
321366
321182
|
await codeGenerationService_12.codeGenerationService.updateTask(localJobContext.jobId, localJobContext.taskId, ditto_codegen_types_12.Status.RUNNING, {});
|
|
321367
321183
|
console.log(`[Init] Marked task RUNNING: jobId=${localJobContext.jobId}, taskId=${localJobContext.taskId}`);
|
|
321368
321184
|
try {
|
|
@@ -321538,6 +321354,7 @@ var alwaysOnLoop = async () => {
|
|
|
321538
321354
|
}
|
|
321539
321355
|
const job = jobs[0];
|
|
321540
321356
|
console.log(`[Loop] Selected job: jobId=${job.jobId}`);
|
|
321357
|
+
await codeGenerationService_1.codeGenerationService.markJobAsRuninng(job.jobId);
|
|
321541
321358
|
await processJob(job);
|
|
321542
321359
|
await codeGenerationService_1.codeGenerationService.markJobAsCompleted(job.jobId);
|
|
321543
321360
|
console.log(`[Loop] Processed job: jobId=${job.jobId}. Sleeping ${POST_JOB_SLEEP_MS}ms`);
|
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.227",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@wix/ditto-codegen": "1.0.0",
|
|
25
25
|
"esbuild": "^0.27.2"
|
|
26
26
|
},
|
|
27
|
-
"falconPackageHash": "
|
|
27
|
+
"falconPackageHash": "f3db2e05872ddc73fb7e494b1a002fb4a6c59424cdaf9bd7b60e5af9"
|
|
28
28
|
}
|