@wix/ditto-codegen-public 1.0.233 → 1.0.235
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.
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
+
"installation": {
|
|
3
|
+
"staticContainer": "HOMEPAGE",
|
|
4
|
+
"initialSize": {
|
|
5
|
+
"width": {
|
|
6
|
+
"sizingType": "pixels",
|
|
7
|
+
"pixels": 400
|
|
8
|
+
},
|
|
9
|
+
"height": {
|
|
10
|
+
"sizingType": "stretched"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
2
14
|
"editorElement": {
|
|
3
15
|
"selector": ".perfect-example",
|
|
4
16
|
"displayName": "Perfect Example",
|
package/dist/out.js
CHANGED
|
@@ -92401,8 +92401,45 @@ All animations: pure CSS, smooth, purposeful.
|
|
|
92401
92401
|
- Emojis or decorative shapes \u2192 Avoid unless core to request
|
|
92402
92402
|
- Looping animations \u2192 Only for loading states
|
|
92403
92403
|
- Center-aligned multi-line body text \u2192 Hard to read`;
|
|
92404
|
+
var installationDocumentation = `The installation property defines how the component is initially placed and sized when added to a page.
|
|
92405
|
+
|
|
92406
|
+
### Installation Fields
|
|
92407
|
+
- **staticContainer**: Specifies automatic installation location. Use "HOMEPAGE" to auto-install on homepage
|
|
92408
|
+
- **initialSize**: Defines the initial dimensions when the component is added
|
|
92409
|
+
- **width**: Width configuration (InitialSizeSetting)
|
|
92410
|
+
- sizingType: "content" | "stretched" | "pixels"
|
|
92411
|
+
- pixels: number (only usable when sizingType is "pixels")
|
|
92412
|
+
- **height**: Height configuration (InitialSizeSetting)
|
|
92413
|
+
- sizingType: "content" | "stretched" | "pixels"
|
|
92414
|
+
- pixels: number (only usable when sizingType is "pixels")
|
|
92415
|
+
|
|
92416
|
+
### SizingType Values
|
|
92417
|
+
- **content**: Component auto-sizes based on its content
|
|
92418
|
+
- **stretched**: Component stretches to fill available space
|
|
92419
|
+
- **pixels**: Component has a fixed pixel dimension (requires pixels property)
|
|
92420
|
+
|
|
92421
|
+
### Examples:
|
|
92422
|
+
\`\`\`json
|
|
92423
|
+
// Fixed width, content-based height
|
|
92424
|
+
{
|
|
92425
|
+
"installation": {
|
|
92426
|
+
"staticContainer": "HOMEPAGE",
|
|
92427
|
+
"initialSize": {
|
|
92428
|
+
"width": { "sizingType": "pixels", "pixels": 300 },
|
|
92429
|
+
"height": { "sizingType": "content" }
|
|
92430
|
+
}
|
|
92431
|
+
}
|
|
92432
|
+
}
|
|
92433
|
+
\`\`\`
|
|
92434
|
+
|
|
92435
|
+
**Guidelines**:
|
|
92436
|
+
- Always include "staticContainer": "HOMEPAGE" for automatic installation on Harmony editor
|
|
92437
|
+
- Use "content" for height when the component should auto-size based on its content
|
|
92438
|
+
- Use "stretched" when the component should fill available space
|
|
92439
|
+
- Use "pixels" for fixed dimensions (buttons: 120-200px, cards: 300-400px)`;
|
|
92404
92440
|
var responseFormat = `Output as JSON with files array containing:
|
|
92405
92441
|
1. **manifest.json** - Component manifest (JSON) containing:
|
|
92442
|
+
- installation: initial size and placement configuration
|
|
92406
92443
|
- editorElement: full editor element configuration (selector, displayName, archetype, layout, cssProperties, data, elements, behaviors)
|
|
92407
92444
|
2. **component.tsx** - React component implementation
|
|
92408
92445
|
3. **style.css** - CSS styles
|
|
@@ -92413,6 +92450,13 @@ Each file: { path: string, content: string, operation: "insert" }
|
|
|
92413
92450
|
### manifest.json Structure Example:
|
|
92414
92451
|
\`\`\`json
|
|
92415
92452
|
{
|
|
92453
|
+
"installation": {
|
|
92454
|
+
"staticContainer": "HOMEPAGE",
|
|
92455
|
+
"initialSize": {
|
|
92456
|
+
"width": { "sizingType": "pixels", "pixels": 300 },
|
|
92457
|
+
"height": { "sizingType": "content" }
|
|
92458
|
+
}
|
|
92459
|
+
},
|
|
92416
92460
|
"editorElement": {
|
|
92417
92461
|
"selector": ".component-name",
|
|
92418
92462
|
"displayName": "Component Name",
|
|
@@ -92466,6 +92510,7 @@ import { heroImage } from './assets/defaultImages'
|
|
|
92466
92510
|
props: propsDocumentation,
|
|
92467
92511
|
componentElementsGuidelines,
|
|
92468
92512
|
manifestGuidelines: componentManifestGuidelines,
|
|
92513
|
+
installation: installationDocumentation,
|
|
92469
92514
|
reactGuidelines: componentReactGuidelines,
|
|
92470
92515
|
cssGuidelines: componentCssGuidelines,
|
|
92471
92516
|
designGuidelines,
|
|
@@ -92492,7 +92537,7 @@ var require_site_component_prompt = __commonJS({
|
|
|
92492
92537
|
apiDocumentation,
|
|
92493
92538
|
useData,
|
|
92494
92539
|
useIteration
|
|
92495
|
-
}).withRole(site_component_instructions_1.siteComponentInstructions.role).withSection("core_documentation", site_component_instructions_1.siteComponentInstructions.coreDocumentation).withSection("data_types", site_component_instructions_1.siteComponentInstructions.dataTypes).withSection("css_properties", site_component_instructions_1.siteComponentInstructions.cssProperties).withSection("editor_element", site_component_instructions_1.siteComponentInstructions.editorElement).withSection("layout", site_component_instructions_1.siteComponentInstructions.layout).withSection("elements", site_component_instructions_1.siteComponentInstructions.elements).withSection("props", site_component_instructions_1.siteComponentInstructions.props).withSection("component_elements_guidelines", site_component_instructions_1.siteComponentInstructions.componentElementsGuidelines).withSection("manifest_guidelines", site_component_instructions_1.siteComponentInstructions.manifestGuidelines).withSection("react_guidelines", site_component_instructions_1.siteComponentInstructions.reactGuidelines).withSection("css_guidelines", site_component_instructions_1.siteComponentInstructions.cssGuidelines).withSection("design_guidelines", site_component_instructions_1.siteComponentInstructions.designGuidelines).withSection("asset_guidelines", site_component_instructions_1.siteComponentInstructions.assetGuidelines).withSection("response_format", site_component_instructions_1.siteComponentInstructions.responseFormat).withSection("hard_constraints", site_component_instructions_1.siteComponentInstructions.hardConstraints).withImplementationGuidelines(site_component_instructions_1.siteComponentInstructions.typescriptQualityGuidelines);
|
|
92540
|
+
}).withRole(site_component_instructions_1.siteComponentInstructions.role).withSection("core_documentation", site_component_instructions_1.siteComponentInstructions.coreDocumentation).withSection("data_types", site_component_instructions_1.siteComponentInstructions.dataTypes).withSection("css_properties", site_component_instructions_1.siteComponentInstructions.cssProperties).withSection("editor_element", site_component_instructions_1.siteComponentInstructions.editorElement).withSection("layout", site_component_instructions_1.siteComponentInstructions.layout).withSection("elements", site_component_instructions_1.siteComponentInstructions.elements).withSection("props", site_component_instructions_1.siteComponentInstructions.props).withSection("component_elements_guidelines", site_component_instructions_1.siteComponentInstructions.componentElementsGuidelines).withSection("manifest_guidelines", site_component_instructions_1.siteComponentInstructions.manifestGuidelines).withSection("installation", site_component_instructions_1.siteComponentInstructions.installation).withSection("react_guidelines", site_component_instructions_1.siteComponentInstructions.reactGuidelines).withSection("css_guidelines", site_component_instructions_1.siteComponentInstructions.cssGuidelines).withSection("design_guidelines", site_component_instructions_1.siteComponentInstructions.designGuidelines).withSection("asset_guidelines", site_component_instructions_1.siteComponentInstructions.assetGuidelines).withSection("response_format", site_component_instructions_1.siteComponentInstructions.responseFormat).withSection("hard_constraints", site_component_instructions_1.siteComponentInstructions.hardConstraints).withImplementationGuidelines(site_component_instructions_1.siteComponentInstructions.typescriptQualityGuidelines);
|
|
92496
92541
|
};
|
|
92497
92542
|
var siteComponentCorePrompt = () => {
|
|
92498
92543
|
return createCoreBuilder({
|
|
@@ -101719,12 +101764,101 @@ var require_submitPlanIteration = __commonJS({
|
|
|
101719
101764
|
}
|
|
101720
101765
|
});
|
|
101721
101766
|
|
|
101767
|
+
// dist/tools/bash.js
|
|
101768
|
+
var require_bash = __commonJS({
|
|
101769
|
+
"dist/tools/bash.js"(exports2) {
|
|
101770
|
+
"use strict";
|
|
101771
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
101772
|
+
exports2.createBashTool = createBashTool;
|
|
101773
|
+
var child_process_1 = require("child_process");
|
|
101774
|
+
var zod_1 = require_zod();
|
|
101775
|
+
var ALLOWED_BASH_PATTERNS = [
|
|
101776
|
+
/^npm install(\s+[\w@./-]+)*$/
|
|
101777
|
+
// npm install, npm install @wix/stores @wix/ecom
|
|
101778
|
+
];
|
|
101779
|
+
var bashSchema = zod_1.z.object({
|
|
101780
|
+
command: zod_1.z.string().describe("The shell command to execute")
|
|
101781
|
+
});
|
|
101782
|
+
function isCommandAllowed(command) {
|
|
101783
|
+
return ALLOWED_BASH_PATTERNS.some((pattern) => pattern.test(command.trim()));
|
|
101784
|
+
}
|
|
101785
|
+
function createBashTool(basePath, options) {
|
|
101786
|
+
const { onActivity } = options ?? {};
|
|
101787
|
+
return {
|
|
101788
|
+
description: `Execute allowed shell commands in the project directory.
|
|
101789
|
+
Currently allowed commands:
|
|
101790
|
+
- npm install [packages] - Install npm packages
|
|
101791
|
+
|
|
101792
|
+
Example: bash({ command: "npm install @wix/stores @wix/ecom" })`,
|
|
101793
|
+
inputSchema: bashSchema,
|
|
101794
|
+
execute: async ({ command }) => {
|
|
101795
|
+
const trimmedCommand = command.trim();
|
|
101796
|
+
if (!isCommandAllowed(trimmedCommand)) {
|
|
101797
|
+
return {
|
|
101798
|
+
success: false,
|
|
101799
|
+
error: `Command not allowed: "${trimmedCommand}". Allowed patterns: npm install [packages]`
|
|
101800
|
+
};
|
|
101801
|
+
}
|
|
101802
|
+
await onActivity?.({ type: "bash:start", command: trimmedCommand });
|
|
101803
|
+
const result = (0, child_process_1.spawnSync)("sh", ["-c", trimmedCommand], {
|
|
101804
|
+
cwd: basePath,
|
|
101805
|
+
stdio: "pipe",
|
|
101806
|
+
env: process.env
|
|
101807
|
+
});
|
|
101808
|
+
const stdout = result.stdout?.toString().trim() || "";
|
|
101809
|
+
const stderr = result.stderr?.toString().trim() || "";
|
|
101810
|
+
const success2 = result.status === 0;
|
|
101811
|
+
await onActivity?.({
|
|
101812
|
+
type: "bash:done",
|
|
101813
|
+
command: trimmedCommand,
|
|
101814
|
+
success: success2
|
|
101815
|
+
});
|
|
101816
|
+
if (success2) {
|
|
101817
|
+
console.log(`\u{1F527} Executed: ${trimmedCommand}`);
|
|
101818
|
+
return { success: true, stdout, stderr };
|
|
101819
|
+
}
|
|
101820
|
+
return {
|
|
101821
|
+
success: false,
|
|
101822
|
+
stdout,
|
|
101823
|
+
stderr,
|
|
101824
|
+
error: `Command failed with exit code ${result.status}`
|
|
101825
|
+
};
|
|
101826
|
+
}
|
|
101827
|
+
};
|
|
101828
|
+
}
|
|
101829
|
+
}
|
|
101830
|
+
});
|
|
101831
|
+
|
|
101832
|
+
// dist/tools/submitFix.js
|
|
101833
|
+
var require_submitFix = __commonJS({
|
|
101834
|
+
"dist/tools/submitFix.js"(exports2) {
|
|
101835
|
+
"use strict";
|
|
101836
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
101837
|
+
exports2.SUBMIT_FIX_TOOL_NAME = exports2.FixSchema = void 0;
|
|
101838
|
+
exports2.createSubmitFixTool = createSubmitFixTool;
|
|
101839
|
+
var zod_1 = require_zod();
|
|
101840
|
+
exports2.FixSchema = zod_1.z.object({
|
|
101841
|
+
filePath: zod_1.z.string().describe("Relative path to the file that was fixed"),
|
|
101842
|
+
fixedContent: zod_1.z.string().describe("The complete fixed file content with all errors resolved"),
|
|
101843
|
+
summary: zod_1.z.string().describe("Brief summary of what was fixed")
|
|
101844
|
+
});
|
|
101845
|
+
exports2.SUBMIT_FIX_TOOL_NAME = "submit_fix";
|
|
101846
|
+
function createSubmitFixTool() {
|
|
101847
|
+
return {
|
|
101848
|
+
description: "Submit the fix after resolving all errors. Call this ONLY after you have successfully fixed all errors in the file.",
|
|
101849
|
+
inputSchema: exports2.FixSchema,
|
|
101850
|
+
execute: async (input) => input
|
|
101851
|
+
};
|
|
101852
|
+
}
|
|
101853
|
+
}
|
|
101854
|
+
});
|
|
101855
|
+
|
|
101722
101856
|
// dist/tools/index.js
|
|
101723
101857
|
var require_tools2 = __commonJS({
|
|
101724
101858
|
"dist/tools/index.js"(exports2) {
|
|
101725
101859
|
"use strict";
|
|
101726
101860
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
101727
|
-
exports2.TOOL_NAMES = exports2.createSubmitPlanTool = exports2.createListDirTool = exports2.createDeleteFileTool = exports2.createEditFileTool = exports2.createCreateFileTool = exports2.createGlobTool = exports2.createGrepTool = exports2.createReadFileTool = void 0;
|
|
101861
|
+
exports2.TOOL_NAMES = exports2.SUBMIT_FIX_TOOL_NAME = exports2.FixSchema = exports2.createSubmitFixTool = exports2.createBashTool = exports2.createSubmitPlanTool = exports2.createListDirTool = exports2.createDeleteFileTool = exports2.createEditFileTool = exports2.createCreateFileTool = exports2.createGlobTool = exports2.createGrepTool = exports2.createReadFileTool = void 0;
|
|
101728
101862
|
var readFile_1 = require_readFile();
|
|
101729
101863
|
Object.defineProperty(exports2, "createReadFileTool", { enumerable: true, get: function() {
|
|
101730
101864
|
return readFile_1.createReadFileTool;
|
|
@@ -101757,6 +101891,20 @@ var require_tools2 = __commonJS({
|
|
|
101757
101891
|
Object.defineProperty(exports2, "createSubmitPlanTool", { enumerable: true, get: function() {
|
|
101758
101892
|
return submitPlanIteration_1.createSubmitIterationPlanTool;
|
|
101759
101893
|
} });
|
|
101894
|
+
var bash_1 = require_bash();
|
|
101895
|
+
Object.defineProperty(exports2, "createBashTool", { enumerable: true, get: function() {
|
|
101896
|
+
return bash_1.createBashTool;
|
|
101897
|
+
} });
|
|
101898
|
+
var submitFix_1 = require_submitFix();
|
|
101899
|
+
Object.defineProperty(exports2, "createSubmitFixTool", { enumerable: true, get: function() {
|
|
101900
|
+
return submitFix_1.createSubmitFixTool;
|
|
101901
|
+
} });
|
|
101902
|
+
Object.defineProperty(exports2, "FixSchema", { enumerable: true, get: function() {
|
|
101903
|
+
return submitFix_1.FixSchema;
|
|
101904
|
+
} });
|
|
101905
|
+
Object.defineProperty(exports2, "SUBMIT_FIX_TOOL_NAME", { enumerable: true, get: function() {
|
|
101906
|
+
return submitFix_1.SUBMIT_FIX_TOOL_NAME;
|
|
101907
|
+
} });
|
|
101760
101908
|
var TOOL_NAMES;
|
|
101761
101909
|
(function(TOOL_NAMES2) {
|
|
101762
101910
|
TOOL_NAMES2["READ_FILE"] = "read_file";
|
|
@@ -101766,6 +101914,7 @@ var require_tools2 = __commonJS({
|
|
|
101766
101914
|
TOOL_NAMES2["LIST_DIR"] = "list_dir";
|
|
101767
101915
|
TOOL_NAMES2["GREP"] = "grep";
|
|
101768
101916
|
TOOL_NAMES2["GLOB"] = "glob";
|
|
101917
|
+
TOOL_NAMES2["BASH"] = "bash";
|
|
101769
101918
|
})(TOOL_NAMES || (exports2.TOOL_NAMES = TOOL_NAMES = {}));
|
|
101770
101919
|
}
|
|
101771
101920
|
});
|
|
@@ -120940,18 +121089,15 @@ var require_NaiveFixerAgent = __commonJS({
|
|
|
120940
121089
|
};
|
|
120941
121090
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
120942
121091
|
exports2.NaiveFixerAgent = void 0;
|
|
120943
|
-
var zod_1 = require_zod();
|
|
120944
121092
|
var ditto_codegen_types_12 = require_dist4();
|
|
121093
|
+
var codegen_common_logic_1 = require_dist12();
|
|
120945
121094
|
var dedent_1 = __importDefault2(require_dedent());
|
|
120946
|
-
var codeGenerationService_12 = require_codeGenerationService();
|
|
120947
121095
|
var constants_1 = require_constants2();
|
|
120948
|
-
var
|
|
120949
|
-
|
|
120950
|
-
summary: zod_1.z.string().describe("Brief summary of what was fixed in the file")
|
|
120951
|
-
});
|
|
121096
|
+
var customAnthropicProvider_1 = require_customAnthropicProvider();
|
|
121097
|
+
var tools_1 = require_tools2();
|
|
120952
121098
|
var NaiveFixerAgent = class {
|
|
120953
121099
|
constructor() {
|
|
120954
|
-
this.name = "
|
|
121100
|
+
this.name = "NaiveFixerAgent";
|
|
120955
121101
|
}
|
|
120956
121102
|
formatErrors(errors) {
|
|
120957
121103
|
return errors.map((error48, index) => `${index + 1}. Line ${error48.line}, Column ${error48.column}${error48.errorCode ? ` (${error48.errorCode})` : ""}: ${error48.message}`).join("\n");
|
|
@@ -120960,52 +121106,97 @@ var require_NaiveFixerAgent = __commonJS({
|
|
|
120960
121106
|
if (!previousErrors || previousErrors.length === 0) {
|
|
120961
121107
|
return "";
|
|
120962
121108
|
}
|
|
120963
|
-
return
|
|
120964
|
-
|
|
120965
|
-
|
|
121109
|
+
return (0, dedent_1.default)`
|
|
121110
|
+
The following errors persisted after your last fix attempt.
|
|
121111
|
+
Please try a DIFFERENT approach to solve them:
|
|
121112
|
+
${previousErrors.map((err) => `- ${err}`).join("\n")}
|
|
121113
|
+
`;
|
|
120966
121114
|
}
|
|
120967
|
-
|
|
120968
|
-
|
|
121115
|
+
buildSystemPrompt() {
|
|
121116
|
+
return (0, dedent_1.default)`You are an expert TypeScript/JavaScript developer. Your task is to fix ALL compilation errors in a file.
|
|
120969
121117
|
|
|
120970
121118
|
Key principles:
|
|
120971
121119
|
1. Fix ALL errors listed in the input
|
|
120972
121120
|
2. Make minimal changes - only fix what's broken
|
|
120973
121121
|
3. Preserve code style and formatting as much as possible
|
|
120974
121122
|
4. Return the COMPLETE file content, not just diffs
|
|
120975
|
-
5.
|
|
120976
|
-
|
|
121123
|
+
5. Think like Cursor - analyze the context and make intelligent fixes
|
|
121124
|
+
|
|
121125
|
+
HANDLING TS2307 "Cannot find module" ERRORS:
|
|
121126
|
+
- When you see error code TS2307 with message "Cannot find module 'X'":
|
|
121127
|
+
1. FIRST, use the bash tool to run: npm install <package-name>
|
|
121128
|
+
2. Example: For "Cannot find module '@wix/stores'", run: npm install @wix/stores
|
|
121129
|
+
3. After installing, the error should be resolved
|
|
121130
|
+
4. If the package name is unclear, extract it from the import statement
|
|
121131
|
+
- DO NOT try to fix TS2307 by changing import paths - install the package instead!
|
|
121132
|
+
|
|
121133
|
+
WORKFLOW:
|
|
121134
|
+
1. Analyze the errors to understand what needs fixing
|
|
121135
|
+
2. For TS2307 errors: Use bash tool to npm install the missing package(s)
|
|
121136
|
+
3. For other errors: Read the file if needed, then determine the fix
|
|
121137
|
+
4. Submit your fix using the submit_fix tool
|
|
121138
|
+
|
|
121139
|
+
Common TypeScript errors and fixes:
|
|
121140
|
+
- TS2307 (Cannot find module): Use npm install
|
|
121141
|
+
- Type mismatches: Fix the type annotation or value
|
|
121142
|
+
- Missing imports: Add the import statement
|
|
121143
|
+
- Undefined variables: Declare or import the variable
|
|
121144
|
+
- Syntax errors: Fix the syntax
|
|
120977
121145
|
|
|
120978
|
-
|
|
120979
|
-
-
|
|
120980
|
-
-
|
|
120981
|
-
-
|
|
120982
|
-
|
|
120983
|
-
|
|
120984
|
-
- Incorrect component props`;
|
|
121146
|
+
IMPORTANT:
|
|
121147
|
+
- ALWAYS call submit_fix when done, even if you only ran npm install
|
|
121148
|
+
- If npm install was the only action needed, return the original file content unchanged
|
|
121149
|
+
- Be efficient - don't read files unnecessarily if you have the content`;
|
|
121150
|
+
}
|
|
121151
|
+
async fixFileWithMultipleErrors(input) {
|
|
120985
121152
|
const errorsList = this.formatErrors(input.errors);
|
|
120986
121153
|
const previousErrorsSection = this.formatPreviousErrors(input.previousErrors);
|
|
120987
|
-
const userMessage =
|
|
120988
|
-
|
|
121154
|
+
const userMessage = (0, dedent_1.default)`
|
|
121155
|
+
File: ${input.filePath}
|
|
121156
|
+
Language: ${input.language}
|
|
120989
121157
|
|
|
120990
|
-
ERRORS TO FIX:
|
|
120991
|
-
${errorsList}
|
|
121158
|
+
ERRORS TO FIX:
|
|
121159
|
+
${errorsList}
|
|
120992
121160
|
|
|
120993
|
-
CURRENT FILE CONTENT:
|
|
120994
|
-
${input.content}
|
|
121161
|
+
CURRENT FILE CONTENT:
|
|
121162
|
+
${input.content}
|
|
120995
121163
|
|
|
120996
|
-
${previousErrorsSection}
|
|
121164
|
+
${previousErrorsSection}
|
|
120997
121165
|
|
|
120998
|
-
|
|
121166
|
+
Instructions:
|
|
121167
|
+
1. Analyze the errors above
|
|
121168
|
+
2. For TS2307 errors, use npm install via the bash tool
|
|
121169
|
+
3. For other errors, fix the code
|
|
121170
|
+
4. Call submit_fix with the complete fixed file content
|
|
121171
|
+
`;
|
|
120999
121172
|
try {
|
|
121000
|
-
|
|
121001
|
-
|
|
121002
|
-
systemPrompt,
|
|
121003
|
-
provider: constants_1.LLM_PROVIDERS.ANTHROPIC,
|
|
121004
|
-
model: constants_1.LLM_MODELS.CLAUDE_SONNET_4_5_20250929,
|
|
121005
|
-
schema: BatchFixSchema,
|
|
121173
|
+
console.log(`\u{1F527} NaiveFixerAgent starting fix for ${input.filePath}...`);
|
|
121174
|
+
const model = (0, customAnthropicProvider_1.createCustomTextModel)()(constants_1.LLM_MODELS.CLAUDE_SONNET_4_5_20250929, {
|
|
121006
121175
|
agentName: this.name
|
|
121007
121176
|
});
|
|
121008
|
-
|
|
121177
|
+
const result = await (0, codegen_common_logic_1.generateAgentText)({
|
|
121178
|
+
agentName: this.name,
|
|
121179
|
+
model,
|
|
121180
|
+
tools: {
|
|
121181
|
+
[tools_1.TOOL_NAMES.READ_FILE]: (0, tools_1.createReadFileTool)(input.projectDir),
|
|
121182
|
+
[tools_1.TOOL_NAMES.EDIT_FILE]: (0, tools_1.createEditFileTool)(input.projectDir),
|
|
121183
|
+
[tools_1.TOOL_NAMES.BASH]: (0, tools_1.createBashTool)(input.projectDir),
|
|
121184
|
+
[tools_1.SUBMIT_FIX_TOOL_NAME]: (0, tools_1.createSubmitFixTool)()
|
|
121185
|
+
},
|
|
121186
|
+
systemPrompt: this.buildSystemPrompt(),
|
|
121187
|
+
userMessage,
|
|
121188
|
+
stopWhen: (0, codegen_common_logic_1.stopOnToolCall)(tools_1.SUBMIT_FIX_TOOL_NAME)
|
|
121189
|
+
});
|
|
121190
|
+
const fixResult = (0, codegen_common_logic_1.extractToolResult)(result.toolCalls, tools_1.SUBMIT_FIX_TOOL_NAME);
|
|
121191
|
+
if (!fixResult) {
|
|
121192
|
+
const toolCallsMade = result.toolCalls.map((tc) => tc.toolName).join(", ");
|
|
121193
|
+
throw new Error(`NaiveFixerAgent did not submit a fix. Tool calls made: ${toolCallsMade || "none"}. Agent response: ${result.text?.slice(0, 200) || "no response"}`);
|
|
121194
|
+
}
|
|
121195
|
+
console.log(`\u{1F527} NaiveFixerAgent fix submitted for: ${fixResult.filePath}`);
|
|
121196
|
+
return {
|
|
121197
|
+
fixedContent: fixResult.fixedContent,
|
|
121198
|
+
summary: fixResult.summary
|
|
121199
|
+
};
|
|
121009
121200
|
} catch (error48) {
|
|
121010
121201
|
const isTokenLimitError = error48.response?.body?.stop_reason === "max_tokens" || error48.finishReason === "length" || error48.cause?.response?.body?.stop_reason === "max_tokens";
|
|
121011
121202
|
if (isTokenLimitError) {
|
|
@@ -121193,6 +121384,7 @@ var require_NaiveErrorFixer = __commonJS({
|
|
|
121193
121384
|
const fixerAgent = new NaiveFixerAgent_1.NaiveFixerAgent();
|
|
121194
121385
|
try {
|
|
121195
121386
|
const batchResult = await fixerAgent.fixFileWithMultipleErrors({
|
|
121387
|
+
projectDir,
|
|
121196
121388
|
filePath,
|
|
121197
121389
|
content: originalContent,
|
|
121198
121390
|
errors: errors.map((error48) => ({
|
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.235",
|
|
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": "6b7a1cb4911d370c9363bfcfe9d315a2e67475c115ea6ecae8c33fcf"
|
|
32
32
|
}
|