@wix/ditto-codegen-public 1.0.232 → 1.0.234

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 +216 -96
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -7760,40 +7760,13 @@ var require_errors2 = __commonJS({
7760
7760
  }
7761
7761
  });
7762
7762
 
7763
- // ../codegen-types/node_modules/@wix/ambassador-ctp-codegen-job-service-v1-job/build/cjs/types.impl.js
7764
- var require_types_impl2 = __commonJS({
7765
- "../codegen-types/node_modules/@wix/ambassador-ctp-codegen-job-service-v1-job/build/cjs/types.impl.js"(exports2) {
7766
- "use strict";
7767
- Object.defineProperty(exports2, "__esModule", { value: true });
7768
- exports2.Status = exports2.TaskKind = void 0;
7769
- var TaskKind;
7770
- (function(TaskKind2) {
7771
- TaskKind2["UNKNOWN_TASK_KIND"] = "UNKNOWN_TASK_KIND";
7772
- TaskKind2["INIT_CODEGEN"] = "INIT_CODEGEN";
7773
- TaskKind2["ITERATE_CODEGEN"] = "ITERATE_CODEGEN";
7774
- TaskKind2["RUN_AGENT"] = "RUN_AGENT";
7775
- TaskKind2["FIX_CODE"] = "FIX_CODE";
7776
- })(TaskKind || (exports2.TaskKind = TaskKind = {}));
7777
- var Status;
7778
- (function(Status2) {
7779
- Status2["UNKNOWN_STATUS"] = "UNKNOWN_STATUS";
7780
- Status2["PENDING"] = "PENDING";
7781
- Status2["RUNNING"] = "RUNNING";
7782
- Status2["COMPLETED"] = "COMPLETED";
7783
- Status2["FAILED"] = "FAILED";
7784
- Status2["CANCELLED"] = "CANCELLED";
7785
- Status2["PENDING_CANCEL"] = "PENDING_CANCEL";
7786
- })(Status || (exports2.Status = Status = {}));
7787
- }
7788
- });
7789
-
7790
7763
  // ../codegen-types/dist/types/status.js
7791
7764
  var require_status = __commonJS({
7792
7765
  "../codegen-types/dist/types/status.js"(exports2) {
7793
7766
  "use strict";
7794
7767
  Object.defineProperty(exports2, "__esModule", { value: true });
7795
7768
  exports2.Status = void 0;
7796
- var types_1 = require_types_impl2();
7769
+ var types_1 = require_types_impl();
7797
7770
  Object.defineProperty(exports2, "Status", { enumerable: true, get: function() {
7798
7771
  return types_1.Status;
7799
7772
  } });
@@ -7806,7 +7779,7 @@ var require_task = __commonJS({
7806
7779
  "use strict";
7807
7780
  Object.defineProperty(exports2, "__esModule", { value: true });
7808
7781
  exports2.TaskKind = void 0;
7809
- var types_1 = require_types_impl2();
7782
+ var types_1 = require_types_impl();
7810
7783
  Object.defineProperty(exports2, "TaskKind", { enumerable: true, get: function() {
7811
7784
  return types_1.TaskKind;
7812
7785
  } });
@@ -44474,7 +44447,7 @@ var require_codeGenerationService = __commonJS({
44474
44447
  });
44475
44448
 
44476
44449
  // ../../node_modules/@wix/ambassador-ctp-ditto-v1-blueprint/build/cjs/types.impl.js
44477
- var require_types_impl3 = __commonJS({
44450
+ var require_types_impl2 = __commonJS({
44478
44451
  "../../node_modules/@wix/ambassador-ctp-ditto-v1-blueprint/build/cjs/types.impl.js"(exports2) {
44479
44452
  "use strict";
44480
44453
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -44503,7 +44476,7 @@ var require_extensions = __commonJS({
44503
44476
  "use strict";
44504
44477
  Object.defineProperty(exports2, "__esModule", { value: true });
44505
44478
  exports2.codeGenerationExtensionTypes = void 0;
44506
- var types_1 = require_types_impl3();
44479
+ var types_1 = require_types_impl2();
44507
44480
  exports2.codeGenerationExtensionTypes = [
44508
44481
  types_1.ExtensionType.SERVICE_PLUGIN,
44509
44482
  types_1.ExtensionType.DASHBOARD_PAGE,
@@ -45923,7 +45896,7 @@ var require_extension_type_documentation = __commonJS({
45923
45896
  "use strict";
45924
45897
  Object.defineProperty(exports2, "__esModule", { value: true });
45925
45898
  exports2.getExtensionTypeDocumentation = getExtensionTypeDocumentation;
45926
- var types_1 = require_types_impl3();
45899
+ var types_1 = require_types_impl2();
45927
45900
  var DashboardPageAgent_1 = require_DashboardPageAgent();
45928
45901
  var SiteComponentAgent_1 = require_SiteComponentAgent();
45929
45902
  var CustomElementAgent_1 = require_CustomElementAgent();
@@ -46247,7 +46220,7 @@ async function updateTodo(id: string, todo: Partial<Todo>): Promise<Todo> {
46247
46220
  });
46248
46221
 
46249
46222
  // ../../node_modules/@wix/ambassador-data-v2-data-collection/build/cjs/types.impl.js
46250
- var require_types_impl4 = __commonJS({
46223
+ var require_types_impl3 = __commonJS({
46251
46224
  "../../node_modules/@wix/ambassador-data-v2-data-collection/build/cjs/types.impl.js"(exports2) {
46252
46225
  "use strict";
46253
46226
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -46460,7 +46433,7 @@ var require_cms_planner_instructions = __commonJS({
46460
46433
  "use strict";
46461
46434
  Object.defineProperty(exports2, "__esModule", { value: true });
46462
46435
  exports2.cmsPlannerInstructions = void 0;
46463
- var types_1 = require_types_impl4();
46436
+ var types_1 = require_types_impl3();
46464
46437
  var ditto_codegen_types_12 = require_dist4();
46465
46438
  var handlingFeesExample = {
46466
46439
  operation: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT,
@@ -47546,7 +47519,7 @@ var require_PlannerAgent = __commonJS({
47546
47519
  "use strict";
47547
47520
  Object.defineProperty(exports2, "__esModule", { value: true });
47548
47521
  exports2.PlannerAgent = void 0;
47549
- var types_1 = require_types_impl3();
47522
+ var types_1 = require_types_impl2();
47550
47523
  var planner_prompt_1 = require_planner_prompt();
47551
47524
  var ditto_codegen_types_12 = require_dist4();
47552
47525
  var PlannerAgentSchema_1 = require_PlannerAgentSchema();
@@ -76141,7 +76114,7 @@ var require_load_examples = __commonJS({
76141
76114
  exports2.loadExamples = void 0;
76142
76115
  var fs_1 = __importDefault2(require("fs"));
76143
76116
  var path_1 = __importDefault2(require("path"));
76144
- var types_1 = require_types_impl3();
76117
+ var types_1 = require_types_impl2();
76145
76118
  var appsExamples = {
76146
76119
  AIChatbot: {
76147
76120
  path: "ai-chatbot",
@@ -76474,7 +76447,7 @@ var require_dashboard_page_prompt = __commonJS({
76474
76447
  "use strict";
76475
76448
  Object.defineProperty(exports2, "__esModule", { value: true });
76476
76449
  exports2.dashboardPagePrompt = exports2.dashboardPageCorePrompt = void 0;
76477
- var types_1 = require_types_impl3();
76450
+ var types_1 = require_types_impl2();
76478
76451
  var dashboard_page_instructions_1 = require_dashboard_page_instructions();
76479
76452
  var CodeGenerationSystemPromptBuilder_1 = require_CodeGenerationSystemPromptBuilder();
76480
76453
  var createCoreBuilder = ({ useData, useIteration, apiDocumentation, useApiSpec, useDynamicParameters }) => {
@@ -76528,7 +76501,7 @@ var require_prompt_selectors = __commonJS({
76528
76501
  exports2.hasUnsupportedCollectionFieldsTypes = hasUnsupportedCollectionFieldsTypes;
76529
76502
  exports2.hasUnsupportedCollectionTypes = hasUnsupportedCollectionTypes;
76530
76503
  exports2.shouldUseDynamicParametersPrompt = shouldUseDynamicParametersPrompt;
76531
- var types_1 = require_types_impl4();
76504
+ var types_1 = require_types_impl3();
76532
76505
  var ditto_codegen_types_12 = require_dist4();
76533
76506
  function shouldUseDataPrompt(params) {
76534
76507
  const { plan, previousResources } = params;
@@ -91734,7 +91707,7 @@ var require_userPrompt = __commonJS({
91734
91707
  exports2.formatEmbeddedScriptParameters = exports2.formatCollections = exports2.buildUserPromptForCodeGenerationAgent = void 0;
91735
91708
  exports2.formatExistingCollections = formatExistingCollections;
91736
91709
  exports2.formatExistingEmbeddedScriptParameters = formatExistingEmbeddedScriptParameters;
91737
- var types_1 = require_types_impl3();
91710
+ var types_1 = require_types_impl2();
91738
91711
  var ditto_codegen_types_12 = require_dist4();
91739
91712
  var buildUserPromptForCodeGenerationAgent = (params, primaryAction) => {
91740
91713
  const { extension, blueprint, scaffolds, userRequestSummary, plan, previousResources } = params;
@@ -92510,7 +92483,7 @@ var require_site_component_prompt = __commonJS({
92510
92483
  "use strict";
92511
92484
  Object.defineProperty(exports2, "__esModule", { value: true });
92512
92485
  exports2.siteComponentPrompt = exports2.siteComponentCorePrompt = void 0;
92513
- var types_1 = require_types_impl3();
92486
+ var types_1 = require_types_impl2();
92514
92487
  var site_component_instructions_1 = require_site_component_instructions();
92515
92488
  var CodeGenerationSystemPromptBuilder_1 = require_CodeGenerationSystemPromptBuilder();
92516
92489
  var createCoreBuilder = ({ useData, useIteration, apiDocumentation }) => {
@@ -92666,7 +92639,7 @@ var require_custom_element_prompt = __commonJS({
92666
92639
  "use strict";
92667
92640
  Object.defineProperty(exports2, "__esModule", { value: true });
92668
92641
  exports2.customElementPrompt = exports2.customElementCorePrompt = void 0;
92669
- var types_1 = require_types_impl3();
92642
+ var types_1 = require_types_impl2();
92670
92643
  var custom_element_instructions_1 = require_custom_element_instructions();
92671
92644
  var CodeGenerationSystemPromptBuilder_1 = require_CodeGenerationSystemPromptBuilder();
92672
92645
  var createCoreBuilder = ({ useData, useIteration, apiDocumentation }) => {
@@ -92834,7 +92807,7 @@ var require_service_plugin_prompt = __commonJS({
92834
92807
  return servicePluginDocLoader_1.fetchServicePluginDocumentation;
92835
92808
  } });
92836
92809
  var service_plugin_instructions_1 = require_service_plugin_instructions();
92837
- var types_1 = require_types_impl3();
92810
+ var types_1 = require_types_impl2();
92838
92811
  var CodeGenerationSystemPromptBuilder_1 = require_CodeGenerationSystemPromptBuilder();
92839
92812
  var createCoreBuilder = ({ useData, useIteration, apiDocumentation }) => {
92840
92813
  return (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
@@ -92958,7 +92931,7 @@ var require_backend_event_prompt = __commonJS({
92958
92931
  "use strict";
92959
92932
  Object.defineProperty(exports2, "__esModule", { value: true });
92960
92933
  exports2.backendEventPrompt = exports2.backendEventCorePrompt = void 0;
92961
- var types_1 = require_types_impl3();
92934
+ var types_1 = require_types_impl2();
92962
92935
  var backend_event_instructions_1 = require_backend_event_instructions();
92963
92936
  var CodeGenerationSystemPromptBuilder_1 = require_CodeGenerationSystemPromptBuilder();
92964
92937
  var createCoreBuilder = ({ useData, useIteration, apiDocumentation }) => {
@@ -93121,7 +93094,7 @@ var require_backend_api_prompt = __commonJS({
93121
93094
  "use strict";
93122
93095
  Object.defineProperty(exports2, "__esModule", { value: true });
93123
93096
  exports2.backendApiPrompt = exports2.backendApiCorePrompt = void 0;
93124
- var types_1 = require_types_impl3();
93097
+ var types_1 = require_types_impl2();
93125
93098
  var backend_api_instructions_1 = require_backend_api_instructions();
93126
93099
  var CodeGenerationSystemPromptBuilder_1 = require_CodeGenerationSystemPromptBuilder();
93127
93100
  var createCoreBuilder = ({ useData, useIteration, apiDocumentation }) => {
@@ -93399,7 +93372,7 @@ var require_embedded_script_prompt = __commonJS({
93399
93372
  Object.defineProperty(exports2, "__esModule", { value: true });
93400
93373
  exports2.embeddedScriptPrompt = exports2.embeddedScriptCorePrompt = void 0;
93401
93374
  var dynamicParameters_1 = require_dynamicParameters2();
93402
- var types_1 = require_types_impl3();
93375
+ var types_1 = require_types_impl2();
93403
93376
  var embedded_script_instructions_1 = require_embedded_script_instructions();
93404
93377
  var CodeGenerationSystemPromptBuilder_1 = require_CodeGenerationSystemPromptBuilder();
93405
93378
  var createCoreBuilder = ({ useData, useIteration, apiDocumentation, hasDynamicParameters }) => {
@@ -93522,7 +93495,7 @@ var require_AgentsRegistry = __commonJS({
93522
93495
  exports2.generateSupportedExtensionsSection = generateSupportedExtensionsSection;
93523
93496
  exports2.getAgentDocumentation = getAgentDocumentation;
93524
93497
  exports2.getAgentCoreSystemPrompt = getAgentCoreSystemPrompt;
93525
- var types_1 = require_types_impl3();
93498
+ var types_1 = require_types_impl2();
93526
93499
  var DashboardPageAgent_1 = require_DashboardPageAgent2();
93527
93500
  var SiteComponentAgent_1 = require_SiteComponentAgent2();
93528
93501
  var CustomElementAgent_1 = require_CustomElementAgent2();
@@ -93594,7 +93567,7 @@ var require_iteration_examples = __commonJS({
93594
93567
  "use strict";
93595
93568
  Object.defineProperty(exports2, "__esModule", { value: true });
93596
93569
  exports2.iterationAgentExamples = void 0;
93597
- var types_1 = require_types_impl3();
93570
+ var types_1 = require_types_impl2();
93598
93571
  var simpleWidgetExample = {
93599
93572
  currentExtensions: [],
93600
93573
  additionalExtensions: [
@@ -101746,12 +101719,101 @@ var require_submitPlanIteration = __commonJS({
101746
101719
  }
101747
101720
  });
101748
101721
 
101722
+ // dist/tools/bash.js
101723
+ var require_bash = __commonJS({
101724
+ "dist/tools/bash.js"(exports2) {
101725
+ "use strict";
101726
+ Object.defineProperty(exports2, "__esModule", { value: true });
101727
+ exports2.createBashTool = createBashTool;
101728
+ var child_process_1 = require("child_process");
101729
+ var zod_1 = require_zod();
101730
+ var ALLOWED_BASH_PATTERNS = [
101731
+ /^npm install(\s+[\w@./-]+)*$/
101732
+ // npm install, npm install @wix/stores @wix/ecom
101733
+ ];
101734
+ var bashSchema = zod_1.z.object({
101735
+ command: zod_1.z.string().describe("The shell command to execute")
101736
+ });
101737
+ function isCommandAllowed(command) {
101738
+ return ALLOWED_BASH_PATTERNS.some((pattern) => pattern.test(command.trim()));
101739
+ }
101740
+ function createBashTool(basePath, options) {
101741
+ const { onActivity } = options ?? {};
101742
+ return {
101743
+ description: `Execute allowed shell commands in the project directory.
101744
+ Currently allowed commands:
101745
+ - npm install [packages] - Install npm packages
101746
+
101747
+ Example: bash({ command: "npm install @wix/stores @wix/ecom" })`,
101748
+ inputSchema: bashSchema,
101749
+ execute: async ({ command }) => {
101750
+ const trimmedCommand = command.trim();
101751
+ if (!isCommandAllowed(trimmedCommand)) {
101752
+ return {
101753
+ success: false,
101754
+ error: `Command not allowed: "${trimmedCommand}". Allowed patterns: npm install [packages]`
101755
+ };
101756
+ }
101757
+ await onActivity?.({ type: "bash:start", command: trimmedCommand });
101758
+ const result = (0, child_process_1.spawnSync)("sh", ["-c", trimmedCommand], {
101759
+ cwd: basePath,
101760
+ stdio: "pipe",
101761
+ env: process.env
101762
+ });
101763
+ const stdout = result.stdout?.toString().trim() || "";
101764
+ const stderr = result.stderr?.toString().trim() || "";
101765
+ const success2 = result.status === 0;
101766
+ await onActivity?.({
101767
+ type: "bash:done",
101768
+ command: trimmedCommand,
101769
+ success: success2
101770
+ });
101771
+ if (success2) {
101772
+ console.log(`\u{1F527} Executed: ${trimmedCommand}`);
101773
+ return { success: true, stdout, stderr };
101774
+ }
101775
+ return {
101776
+ success: false,
101777
+ stdout,
101778
+ stderr,
101779
+ error: `Command failed with exit code ${result.status}`
101780
+ };
101781
+ }
101782
+ };
101783
+ }
101784
+ }
101785
+ });
101786
+
101787
+ // dist/tools/submitFix.js
101788
+ var require_submitFix = __commonJS({
101789
+ "dist/tools/submitFix.js"(exports2) {
101790
+ "use strict";
101791
+ Object.defineProperty(exports2, "__esModule", { value: true });
101792
+ exports2.SUBMIT_FIX_TOOL_NAME = exports2.FixSchema = void 0;
101793
+ exports2.createSubmitFixTool = createSubmitFixTool;
101794
+ var zod_1 = require_zod();
101795
+ exports2.FixSchema = zod_1.z.object({
101796
+ filePath: zod_1.z.string().describe("Relative path to the file that was fixed"),
101797
+ fixedContent: zod_1.z.string().describe("The complete fixed file content with all errors resolved"),
101798
+ summary: zod_1.z.string().describe("Brief summary of what was fixed")
101799
+ });
101800
+ exports2.SUBMIT_FIX_TOOL_NAME = "submit_fix";
101801
+ function createSubmitFixTool() {
101802
+ return {
101803
+ description: "Submit the fix after resolving all errors. Call this ONLY after you have successfully fixed all errors in the file.",
101804
+ inputSchema: exports2.FixSchema,
101805
+ execute: async (input) => input
101806
+ };
101807
+ }
101808
+ }
101809
+ });
101810
+
101749
101811
  // dist/tools/index.js
101750
101812
  var require_tools2 = __commonJS({
101751
101813
  "dist/tools/index.js"(exports2) {
101752
101814
  "use strict";
101753
101815
  Object.defineProperty(exports2, "__esModule", { value: true });
101754
- exports2.TOOL_NAMES = exports2.createSubmitPlanTool = exports2.createListDirTool = exports2.createDeleteFileTool = exports2.createEditFileTool = exports2.createCreateFileTool = exports2.createGlobTool = exports2.createGrepTool = exports2.createReadFileTool = void 0;
101816
+ 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;
101755
101817
  var readFile_1 = require_readFile();
101756
101818
  Object.defineProperty(exports2, "createReadFileTool", { enumerable: true, get: function() {
101757
101819
  return readFile_1.createReadFileTool;
@@ -101784,6 +101846,20 @@ var require_tools2 = __commonJS({
101784
101846
  Object.defineProperty(exports2, "createSubmitPlanTool", { enumerable: true, get: function() {
101785
101847
  return submitPlanIteration_1.createSubmitIterationPlanTool;
101786
101848
  } });
101849
+ var bash_1 = require_bash();
101850
+ Object.defineProperty(exports2, "createBashTool", { enumerable: true, get: function() {
101851
+ return bash_1.createBashTool;
101852
+ } });
101853
+ var submitFix_1 = require_submitFix();
101854
+ Object.defineProperty(exports2, "createSubmitFixTool", { enumerable: true, get: function() {
101855
+ return submitFix_1.createSubmitFixTool;
101856
+ } });
101857
+ Object.defineProperty(exports2, "FixSchema", { enumerable: true, get: function() {
101858
+ return submitFix_1.FixSchema;
101859
+ } });
101860
+ Object.defineProperty(exports2, "SUBMIT_FIX_TOOL_NAME", { enumerable: true, get: function() {
101861
+ return submitFix_1.SUBMIT_FIX_TOOL_NAME;
101862
+ } });
101787
101863
  var TOOL_NAMES;
101788
101864
  (function(TOOL_NAMES2) {
101789
101865
  TOOL_NAMES2["READ_FILE"] = "read_file";
@@ -101793,6 +101869,7 @@ var require_tools2 = __commonJS({
101793
101869
  TOOL_NAMES2["LIST_DIR"] = "list_dir";
101794
101870
  TOOL_NAMES2["GREP"] = "grep";
101795
101871
  TOOL_NAMES2["GLOB"] = "glob";
101872
+ TOOL_NAMES2["BASH"] = "bash";
101796
101873
  })(TOOL_NAMES || (exports2.TOOL_NAMES = TOOL_NAMES = {}));
101797
101874
  }
101798
101875
  });
@@ -101903,7 +101980,7 @@ var require_DashboardDecisionAgent = __commonJS({
101903
101980
  var zod_1 = require_zod();
101904
101981
  var codegen_dashboard_agents_1 = require_dist14();
101905
101982
  var prompt_selectors_1 = require_prompt_selectors();
101906
- var types_1 = require_types_impl3();
101983
+ var types_1 = require_types_impl2();
101907
101984
  var userPrompt_1 = require_userPrompt();
101908
101985
  var codeGenerationService_12 = require_codeGenerationService();
101909
101986
  var constants_1 = require_constants2();
@@ -102082,7 +102159,7 @@ var require_scaffolding = __commonJS({
102082
102159
  exports2.toKebabCase = toKebabCase;
102083
102160
  var tools_1 = require_tools3();
102084
102161
  var constants_1 = require_constants6();
102085
- var types_1 = require_types_impl3();
102162
+ var types_1 = require_types_impl2();
102086
102163
  var fs_1 = __importDefault2(require("fs"));
102087
102164
  var path_1 = __importDefault2(require("path"));
102088
102165
  async function copyScaffoldingTemplate(extension, outputPath) {
@@ -103127,7 +103204,7 @@ var require_UpdateExtensionAgent = __commonJS({
103127
103204
  var userPrompt_1 = require_userPrompt();
103128
103205
  var codegen_dashboard_agents_1 = require_dist14();
103129
103206
  var codeGenerationService_12 = require_codeGenerationService();
103130
- var types_1 = require_types_impl3();
103207
+ var types_1 = require_types_impl2();
103131
103208
  var UpdateExtensionAgent = class {
103132
103209
  constructor() {
103133
103210
  this.name = "UpdateExtensionAgent";
@@ -103311,7 +103388,7 @@ var require_AgentsFactory = __commonJS({
103311
103388
  "use strict";
103312
103389
  Object.defineProperty(exports2, "__esModule", { value: true });
103313
103390
  exports2.AgentsFactory = void 0;
103314
- var types_1 = require_types_impl3();
103391
+ var types_1 = require_types_impl2();
103315
103392
  var PlannerAgent_1 = require_PlannerAgent();
103316
103393
  var IterationAgent_1 = require_IterationAgent();
103317
103394
  var DashboardDecisionAgent_1 = require_DashboardDecisionAgent();
@@ -120967,18 +121044,15 @@ var require_NaiveFixerAgent = __commonJS({
120967
121044
  };
120968
121045
  Object.defineProperty(exports2, "__esModule", { value: true });
120969
121046
  exports2.NaiveFixerAgent = void 0;
120970
- var zod_1 = require_zod();
120971
121047
  var ditto_codegen_types_12 = require_dist4();
121048
+ var codegen_common_logic_1 = require_dist12();
120972
121049
  var dedent_1 = __importDefault2(require_dedent());
120973
- var codeGenerationService_12 = require_codeGenerationService();
120974
121050
  var constants_1 = require_constants2();
120975
- var BatchFixSchema = zod_1.z.object({
120976
- fixedContent: zod_1.z.string().describe("The complete fixed file content with all errors resolved"),
120977
- summary: zod_1.z.string().describe("Brief summary of what was fixed in the file")
120978
- });
121051
+ var customAnthropicProvider_1 = require_customAnthropicProvider();
121052
+ var tools_1 = require_tools2();
120979
121053
  var NaiveFixerAgent = class {
120980
121054
  constructor() {
120981
- this.name = "BatchFixAgent";
121055
+ this.name = "NaiveFixerAgent";
120982
121056
  }
120983
121057
  formatErrors(errors) {
120984
121058
  return errors.map((error48, index) => `${index + 1}. Line ${error48.line}, Column ${error48.column}${error48.errorCode ? ` (${error48.errorCode})` : ""}: ${error48.message}`).join("\n");
@@ -120987,52 +121061,97 @@ var require_NaiveFixerAgent = __commonJS({
120987
121061
  if (!previousErrors || previousErrors.length === 0) {
120988
121062
  return "";
120989
121063
  }
120990
- return `The following errors persisted after your last fix attempt.
120991
- Please try a DIFFERENT approach to solve them:
120992
- ${previousErrors.map((err) => `- ${err}`).join("\n")}`;
121064
+ return (0, dedent_1.default)`
121065
+ The following errors persisted after your last fix attempt.
121066
+ Please try a DIFFERENT approach to solve them:
121067
+ ${previousErrors.map((err) => `- ${err}`).join("\n")}
121068
+ `;
120993
121069
  }
120994
- async fixFileWithMultipleErrors(input) {
120995
- const systemPrompt = (0, dedent_1.default)`You are an expert TypeScript/JavaScript developer. Your task is to fix ALL compilation errors in a file by providing the complete corrected file content.
121070
+ buildSystemPrompt() {
121071
+ return (0, dedent_1.default)`You are an expert TypeScript/JavaScript developer. Your task is to fix ALL compilation errors in a file.
120996
121072
 
120997
121073
  Key principles:
120998
121074
  1. Fix ALL errors listed in the input
120999
121075
  2. Make minimal changes - only fix what's broken
121000
121076
  3. Preserve code style and formatting as much as possible
121001
121077
  4. Return the COMPLETE file content, not just diffs
121002
- 5. Use block replacements instead of line-by-line changes
121003
- 6. Think like Cursor - analyze the context and make intelligent fixes
121078
+ 5. Think like Cursor - analyze the context and make intelligent fixes
121079
+
121080
+ HANDLING TS2307 "Cannot find module" ERRORS:
121081
+ - When you see error code TS2307 with message "Cannot find module 'X'":
121082
+ 1. FIRST, use the bash tool to run: npm install <package-name>
121083
+ 2. Example: For "Cannot find module '@wix/stores'", run: npm install @wix/stores
121084
+ 3. After installing, the error should be resolved
121085
+ 4. If the package name is unclear, extract it from the import statement
121086
+ - DO NOT try to fix TS2307 by changing import paths - install the package instead!
121087
+
121088
+ WORKFLOW:
121089
+ 1. Analyze the errors to understand what needs fixing
121090
+ 2. For TS2307 errors: Use bash tool to npm install the missing package(s)
121091
+ 3. For other errors: Read the file if needed, then determine the fix
121092
+ 4. Submit your fix using the submit_fix tool
121093
+
121094
+ Common TypeScript errors and fixes:
121095
+ - TS2307 (Cannot find module): Use npm install
121096
+ - Type mismatches: Fix the type annotation or value
121097
+ - Missing imports: Add the import statement
121098
+ - Undefined variables: Declare or import the variable
121099
+ - Syntax errors: Fix the syntax
121004
121100
 
121005
- Focus on common TypeScript errors:
121006
- - Missing imports
121007
- - Type mismatches
121008
- - Undefined variables
121009
- - Syntax errors
121010
- - Missing semicolons or brackets
121011
- - Incorrect component props`;
121101
+ IMPORTANT:
121102
+ - ALWAYS call submit_fix when done, even if you only ran npm install
121103
+ - If npm install was the only action needed, return the original file content unchanged
121104
+ - Be efficient - don't read files unnecessarily if you have the content`;
121105
+ }
121106
+ async fixFileWithMultipleErrors(input) {
121012
121107
  const errorsList = this.formatErrors(input.errors);
121013
121108
  const previousErrorsSection = this.formatPreviousErrors(input.previousErrors);
121014
- const userMessage = `File: ${input.filePath}
121015
- Language: ${input.language}
121109
+ const userMessage = (0, dedent_1.default)`
121110
+ File: ${input.filePath}
121111
+ Language: ${input.language}
121016
121112
 
121017
- ERRORS TO FIX:
121018
- ${errorsList}
121113
+ ERRORS TO FIX:
121114
+ ${errorsList}
121019
121115
 
121020
- CURRENT FILE CONTENT:
121021
- ${input.content}
121116
+ CURRENT FILE CONTENT:
121117
+ ${input.content}
121022
121118
 
121023
- ${previousErrorsSection}
121119
+ ${previousErrorsSection}
121024
121120
 
121025
- Please provide the complete fixed file content that resolves ALL the errors listed above.`;
121121
+ Instructions:
121122
+ 1. Analyze the errors above
121123
+ 2. For TS2307 errors, use npm install via the bash tool
121124
+ 3. For other errors, fix the code
121125
+ 4. Call submit_fix with the complete fixed file content
121126
+ `;
121026
121127
  try {
121027
- const result = await codeGenerationService_12.codegenAIProxyService.generateCodegenObject({
121028
- userMessage,
121029
- systemPrompt,
121030
- provider: constants_1.LLM_PROVIDERS.ANTHROPIC,
121031
- model: constants_1.LLM_MODELS.CLAUDE_SONNET_4_5_20250929,
121032
- schema: BatchFixSchema,
121128
+ console.log(`\u{1F527} NaiveFixerAgent starting fix for ${input.filePath}...`);
121129
+ const model = (0, customAnthropicProvider_1.createCustomTextModel)()(constants_1.LLM_MODELS.CLAUDE_SONNET_4_5_20250929, {
121033
121130
  agentName: this.name
121034
121131
  });
121035
- return result.object;
121132
+ const result = await (0, codegen_common_logic_1.generateAgentText)({
121133
+ agentName: this.name,
121134
+ model,
121135
+ tools: {
121136
+ [tools_1.TOOL_NAMES.READ_FILE]: (0, tools_1.createReadFileTool)(input.projectDir),
121137
+ [tools_1.TOOL_NAMES.EDIT_FILE]: (0, tools_1.createEditFileTool)(input.projectDir),
121138
+ [tools_1.TOOL_NAMES.BASH]: (0, tools_1.createBashTool)(input.projectDir),
121139
+ [tools_1.SUBMIT_FIX_TOOL_NAME]: (0, tools_1.createSubmitFixTool)()
121140
+ },
121141
+ systemPrompt: this.buildSystemPrompt(),
121142
+ userMessage,
121143
+ stopWhen: (0, codegen_common_logic_1.stopOnToolCall)(tools_1.SUBMIT_FIX_TOOL_NAME)
121144
+ });
121145
+ const fixResult = (0, codegen_common_logic_1.extractToolResult)(result.toolCalls, tools_1.SUBMIT_FIX_TOOL_NAME);
121146
+ if (!fixResult) {
121147
+ const toolCallsMade = result.toolCalls.map((tc) => tc.toolName).join(", ");
121148
+ throw new Error(`NaiveFixerAgent did not submit a fix. Tool calls made: ${toolCallsMade || "none"}. Agent response: ${result.text?.slice(0, 200) || "no response"}`);
121149
+ }
121150
+ console.log(`\u{1F527} NaiveFixerAgent fix submitted for: ${fixResult.filePath}`);
121151
+ return {
121152
+ fixedContent: fixResult.fixedContent,
121153
+ summary: fixResult.summary
121154
+ };
121036
121155
  } catch (error48) {
121037
121156
  const isTokenLimitError = error48.response?.body?.stop_reason === "max_tokens" || error48.finishReason === "length" || error48.cause?.response?.body?.stop_reason === "max_tokens";
121038
121157
  if (isTokenLimitError) {
@@ -121220,6 +121339,7 @@ var require_NaiveErrorFixer = __commonJS({
121220
121339
  const fixerAgent = new NaiveFixerAgent_1.NaiveFixerAgent();
121221
121340
  try {
121222
121341
  const batchResult = await fixerAgent.fixFileWithMultipleErrors({
121342
+ projectDir,
121223
121343
  filePath,
121224
121344
  content: originalContent,
121225
121345
  errors: errors.map((error48) => ({
@@ -121631,7 +121751,7 @@ var require_extensionGenerators = __commonJS({
121631
121751
  var fs_extra_1 = __importDefault2(require_lib2());
121632
121752
  var crypto_12 = require("crypto");
121633
121753
  var ditto_scaffolding_1 = require_dist17();
121634
- var types_1 = require_types_impl3();
121754
+ var types_1 = require_types_impl2();
121635
121755
  var ditto_scaffolding_2 = require_dist17();
121636
121756
  var EmbeddedScriptAgent_1 = require_EmbeddedScriptAgent2();
121637
121757
  var ditto_codegen_types_12 = require_dist4();
@@ -122314,7 +122434,7 @@ var require_servicePlugin = __commonJS({
122314
122434
  "use strict";
122315
122435
  Object.defineProperty(exports2, "__esModule", { value: true });
122316
122436
  exports2.processServicePluginExtension = processServicePluginExtension;
122317
- var types_1 = require_types_impl3();
122437
+ var types_1 = require_types_impl2();
122318
122438
  var orchestrator_error_helpers_1 = require_orchestrator_error_helpers();
122319
122439
  var finalize_extension_generation_1 = require_finalize_extension_generation();
122320
122440
  var create_scaffolding_1 = require_create_scaffolding();
@@ -122402,7 +122522,7 @@ var require_embeddedScript = __commonJS({
122402
122522
  "use strict";
122403
122523
  Object.defineProperty(exports2, "__esModule", { value: true });
122404
122524
  exports2.processEmbeddedScriptExtension = processEmbeddedScriptExtension;
122405
- var types_1 = require_types_impl3();
122525
+ var types_1 = require_types_impl2();
122406
122526
  var finalize_extension_generation_1 = require_finalize_extension_generation();
122407
122527
  var create_scaffolding_1 = require_create_scaffolding();
122408
122528
  var codegen_flow_helpers_1 = require_codegen_flow_helpers();
@@ -122607,7 +122727,7 @@ var require_orchestrator = __commonJS({
122607
122727
  "use strict";
122608
122728
  Object.defineProperty(exports2, "__esModule", { value: true });
122609
122729
  exports2.DittoOrchestrator = void 0;
122610
- var types_1 = require_types_impl3();
122730
+ var types_1 = require_types_impl2();
122611
122731
  var extensionIndexer_1 = require_extensionIndexer();
122612
122732
  var orchestrator_error_helpers_1 = require_orchestrator_error_helpers();
122613
122733
  var fixFlow_1 = require_fixFlow();
@@ -336195,7 +336315,7 @@ var require_extensionAst = __commonJS({
336195
336315
  Object.defineProperty(exports2, "__esModule", { value: true });
336196
336316
  exports2.parseExtensionFileAST = parseExtensionFileAST;
336197
336317
  var ts = __importStar2(require_typescript());
336198
- var types_1 = require_types_impl3();
336318
+ var types_1 = require_types_impl2();
336199
336319
  var cms_1 = require_cms();
336200
336320
  var BUILDER_TO_EXTENSION_TYPE = {
336201
336321
  dashboardPage: types_1.ExtensionType.DASHBOARD_PAGE,
@@ -336475,7 +336595,7 @@ var require_embeddedScript2 = __commonJS({
336475
336595
  exports2.getEmbeddedScriptParameters = getEmbeddedScriptParameters;
336476
336596
  var path_1 = __importDefault2(require("path"));
336477
336597
  var fs_1 = __importDefault2(require("fs"));
336478
- var types_1 = require_types_impl3();
336598
+ var types_1 = require_types_impl2();
336479
336599
  var PARAMETER_REGEX = /\{\{(\w+)\}\}/g;
336480
336600
  async function getEmbeddedScriptParameters(extensions, outputPath) {
336481
336601
  const embeddedScripts = extensions.filter((ext) => ext.type === types_1.ExtensionType.EMBEDDED_SCRIPT);
@@ -336523,7 +336643,7 @@ var require_projectContext = __commonJS({
336523
336643
  var extension_1 = require_extension();
336524
336644
  var cms_1 = require_cms2();
336525
336645
  var embeddedScript_1 = require_embeddedScript2();
336526
- var types_1 = require_types_impl3();
336646
+ var types_1 = require_types_impl2();
336527
336647
  async function getProjectContext(outputPath) {
336528
336648
  const allBuilders = await (0, extension_1.getExtensions)(outputPath);
336529
336649
  const extensions = allBuilders.filter((ext) => ext.type !== null && ext.type !== types_1.ExtensionType.UNDEFINED_EXTENSION_TYPE);
@@ -336546,7 +336666,7 @@ var require_IterationOrchestrator = __commonJS({
336546
336666
  "use strict";
336547
336667
  Object.defineProperty(exports2, "__esModule", { value: true });
336548
336668
  exports2.IterationOrchestrator = void 0;
336549
- var types_1 = require_types_impl3();
336669
+ var types_1 = require_types_impl2();
336550
336670
  var sdkEnricher_1 = require_sdkEnricher2();
336551
336671
  var orchestrator_error_helpers_1 = require_orchestrator_error_helpers();
336552
336672
  var fixFlow_1 = require_fixFlow();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.232",
3
+ "version": "1.0.234",
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": "dc475beaff405832fd326b7ccbc45bb3e5c7649c72d572553aeae35f"
31
+ "falconPackageHash": "f2b144b85739248671d0347b8952d7ee8702bd0076e2df5cde88a4e9"
32
32
  }