@wix/ditto-codegen-public 1.0.207 → 1.0.209

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 +869 -302
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -38490,12 +38490,12 @@ var require_SystemPromptBuilder = __commonJS({
38490
38490
  (function(GeneralAgentType2) {
38491
38491
  GeneralAgentType2["CMS_PLANNER"] = "CMS_PLANNER";
38492
38492
  GeneralAgentType2["PLANNER"] = "PLANNER";
38493
- GeneralAgentType2["EXTENSION_SELECTOR"] = "EXTENSION_SELECTOR";
38494
38493
  GeneralAgentType2["ITERATION_AGENT"] = "ITERATION_AGENT";
38495
38494
  GeneralAgentType2["AUTO_PATTERN_DECISION"] = "AUTO_PATTERN_DECISION";
38496
38495
  GeneralAgentType2["AUTO_PATTERN_CONTEXT"] = "AUTO_PATTERN_CONTEXT";
38497
38496
  GeneralAgentType2["SDK_PICKER"] = "SDK_PICKER";
38498
38497
  GeneralAgentType2["EXTENSION_INDEXER"] = "EXTENSION_INDEXER";
38498
+ GeneralAgentType2["UPDATE_EXTENSION_AGENT"] = "UPDATE_EXTENSION_AGENT";
38499
38499
  })(GeneralAgentType || (exports2.GeneralAgentType = GeneralAgentType = {}));
38500
38500
  var toPromptTag = (fromPromptType) => {
38501
38501
  return `${fromPromptType}_PROMPT`;
@@ -39128,9 +39128,9 @@ var require_iterationScenarios = __commonJS({
39128
39128
  ];
39129
39129
  if (hasEmbeddedScriptExtensions) {
39130
39130
  scenarios.push(``, `### Embedded Script Parameters Mismatch`, `**User Request**: "Dashboard page not using correct params" / "embedded script params wrong"`, `**How to Handle**: CODE FIX - Ensure dashboard page and embedded script use SAME parameter keys`, `**Requires Extensions**: Yes (modify existing code)`, `**Requires Planner**: No`);
39131
- scenarios.push(``, `### Add/Remove Embedded Script Parameters`, `**User Request**: "Add parameter to embedded script" / "remove parameter" / "update script params"`, `**How to Handle**: BOTH - PlannerAgent updates parameters + CodeAgent updates dashboard and script code`, `**Requires Extensions**: Yes (modify code)`, `**Requires Planner**: Yes (update params)`);
39131
+ scenarios.push(``, `### Add/Remove Embedded Script Parameters`, `**User Request**: "Add parameter to embedded script" / "remove parameter" / "update script params"`, `**How to Handle**: BOTH - PlannerAgent updates parameters + UpdateExtensionAgent updates dashboard and script code`, `**Requires Extensions**: Yes (modify code)`, `**Requires Planner**: Yes (update params)`);
39132
39132
  }
39133
- scenarios.push(``, `### Modify Existing Code`, `**User Request**: "Change/update/modify existing functionality" / "fix bug" / "update logic"`, `**How to Handle**: CODE CHANGE - Modify relevant existing extension files`, `**Requires Extensions**: Yes (modify existing code)`, `**Requires Planner**: No`, ``, `### Add New Extension`, `**User Request**: "Create new dashboard" / "add new widget" / "build new component" / "add new feature"`, `**How to Handle**: CODE + PLANNER - Create new extension(s) and may need new collections/params`, `**Requires Extensions**: Yes (create new)`, `**Requires Planner**: Maybe (if needs new data structures)`, ``, `### Extension Using Existing Collection`, `**User Request**: "Create dashboard/widget/component that uses existing collection"`, `**How to Handle**: CODE ONLY - Create new extension, reuse existing collection`, `**Requires Extensions**: Yes (create new)`, `**Requires Planner**: No`, ``, `### Add Feature Using Different SPI`, `**User Request**: "Add shipping rates" (when additional fees exist) / "add X additionally to existing Y" / "also add X"`, `**How to Handle**: CREATE NEW EXTENSIONS - Different SPIs require separate service plugins, even if functionally similar`, `**Requires Extensions**: Yes (create new - DO NOT modify existing)`, `**Requires Planner**: Maybe (if needs new data structures)`, `**Important Guidelines**:`, ` - Different SPI = Different SERVICE_PLUGIN (e.g., ecom.shippingRates.getShippingRates \u2260 ecom.additionalFees.calculateAdditionalFees)`, ` - User says "additionally" or "also add" \u2192 Usually means NEW extensions, not modifications`, ` - Don't merge different business logic into same extension just because they seem related`, `**Examples**:`, ` - "Add shipping rates additionally to existing fees" \u2192 NEW SERVICE_PLUGIN + NEW DASHBOARD_PAGE (if needed to manage the shipping rates collection)`, ` - "Add tax calculator alongside fees" \u2192 NEW SERVICE_PLUGIN (different SPI)`, ` - "Also add discount system" \u2192 NEW extensions (separate business logic)`, ``, `### Add/Remove Collection Fields`, `**User Request**: "Add field to collection" / "remove field from collection" / "update collection schema"`, `**How to Handle**: BOTH - PlannerAgent updates schema + CodeAgent updates code to use new/removed fields`, `**Requires Extensions**: Yes (modify code)`, `**Requires Planner**: Yes (update schema)`);
39133
+ scenarios.push(``, `### Modify Existing Code`, `**User Request**: "Change/update/modify existing functionality" / "fix bug" / "update logic"`, `**How to Handle**: CODE CHANGE - Modify relevant existing extension files`, `**Requires Extensions**: Yes (modify existing code)`, `**Requires Planner**: No`, ``, `### Add New Extension`, `**User Request**: "Create new dashboard" / "add new widget" / "build new component" / "add new feature"`, `**How to Handle**: CODE + PLANNER - Create new extension(s) and may need new collections/params`, `**Requires Extensions**: Yes (create new)`, `**Requires Planner**: Maybe (if needs new data structures)`, ``, `### Extension Using Existing Collection`, `**User Request**: "Create dashboard/widget/component that uses existing collection"`, `**How to Handle**: CODE ONLY - Create new extension, reuse existing collection`, `**Requires Extensions**: Yes (create new)`, `**Requires Planner**: No`, ``, `### Add Feature Using Different SPI`, `**User Request**: "Add shipping rates" (when additional fees exist) / "add X additionally to existing Y" / "also add X"`, `**How to Handle**: CREATE NEW EXTENSIONS - Different SPIs require separate service plugins, even if functionally similar`, `**Requires Extensions**: Yes (create new - DO NOT modify existing)`, `**Requires Planner**: Maybe (if needs new data structures)`, `**Important Guidelines**:`, ` - Different SPI = Different SERVICE_PLUGIN (e.g., ecom.shippingRates.getShippingRates \u2260 ecom.additionalFees.calculateAdditionalFees)`, ` - User says "additionally" or "also add" \u2192 Usually means NEW extensions, not modifications`, ` - Don't merge different business logic into same extension just because they seem related`, `**Examples**:`, ` - "Add shipping rates additionally to existing fees" \u2192 NEW SERVICE_PLUGIN + NEW DASHBOARD_PAGE (if needed to manage the shipping rates collection)`, ` - "Add tax calculator alongside fees" \u2192 NEW SERVICE_PLUGIN (different SPI)`, ` - "Also add discount system" \u2192 NEW extensions (separate business logic)`, ``, `### Add/Remove Collection Fields`, `**User Request**: "Add field to collection" / "remove field from collection" / "update collection schema"`, `**How to Handle**: BOTH - PlannerAgent updates schema + UpdateExtensionAgent updates code to use new/removed fields`, `**Requires Extensions**: Yes (modify code)`, `**Requires Planner**: Yes (update schema)`);
39134
39134
  scenarios.push(``, `### Add Initial Data to Collection`, `**User Request**: "Add initial data" / "populate collection with data" / "seed collection" / "add default items"`, `**How to Handle**: PLANNER OPERATION - Add/Update data to collection's initialData field`, `**Requires Extensions**: No`, `**Requires Planner**: Yes`, `**Important Guidelines**:`, ` - Initial data is NOT added by modifying in any code files`, ` - Initial data is added by PlannerAgent through collection configuration`, ` - DO NOT return any other extensions for initial data requests`, `**Examples**:`, ` - "Add some sample products to the collection"`, ` - "Populate the collection with initial data"`, ` - "Seed the collection with default values"`, ``, `**Legend**:`, `- **CODE FIX/CHANGE**: Modify existing extensions`, `- **PLANNER OPERATION**: Update collections, permissions, or params (no code changes)`, `- **BOTH**: Requires planner updates (data) AND code changes (extensions)`, ``);
39135
39135
  return scenarios.join("\n");
39136
39136
  };
@@ -72563,30 +72563,49 @@ var require_dashboard_page_prompt = __commonJS({
72563
72563
  "dist/system-prompts/dashboardPage/dashboard-page-prompt.js"(exports2) {
72564
72564
  "use strict";
72565
72565
  Object.defineProperty(exports2, "__esModule", { value: true });
72566
- exports2.dashboardPagePrompt = void 0;
72566
+ exports2.dashboardPagePrompt = exports2.dashboardPageCorePrompt = void 0;
72567
72567
  var types_1 = require_types_impl();
72568
72568
  var dashboard_page_instructions_1 = require_dashboard_page_instructions();
72569
72569
  var CodeGenerationSystemPromptBuilder_1 = require_CodeGenerationSystemPromptBuilder();
72570
- var dashboardPagePrompt = async ({ useData, useAutoPatterns, useApiSpec, useDynamicParameters, apiNames, apiDocumentation, useIteration, autoPatternsSectionIds }) => {
72571
- const systemPrompt = (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
72570
+ var createCoreBuilder = ({ apiNames, useData, useIteration, apiDocumentation, useApiSpec, useDynamicParameters }) => {
72571
+ const coreSystemPrompt = (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
72572
72572
  agentType: types_1.ExtensionType.DASHBOARD_PAGE,
72573
72573
  apiNames,
72574
72574
  apiDocumentation,
72575
72575
  useData,
72576
72576
  useIteration
72577
- }).withRole(dashboard_page_instructions_1.dashboardPageInstructions.role).withSection("dashboard_page_extension_files_and_code", dashboard_page_instructions_1.dashboardPageInstructions.filesAndCode).withSection("wds_provider_usage", dashboard_page_instructions_1.dashboardPageInstructions.wdsProviderUsage).withSection("hard_constraints", dashboard_page_instructions_1.dashboardPageInstructions.hardConstraints).withSection("api_references", dashboard_page_instructions_1.dashboardPageInstructions.apiReferences).withSection("wds_reference", dashboard_page_instructions_1.dashboardPageInstructions.wdsReference()).withContextExplanation().withApiDocs().withCorePrinciples().withOutputConstraints().withImplementationGuidelines(dashboard_page_instructions_1.dashboardPageInstructions.typescriptQualityGuidelines).withExamples();
72577
+ }).withRole(dashboard_page_instructions_1.dashboardPageInstructions.role).withSection("dashboard_page_extension_files_and_code", dashboard_page_instructions_1.dashboardPageInstructions.filesAndCode).withSection("wds_provider_usage", dashboard_page_instructions_1.dashboardPageInstructions.wdsProviderUsage).withSection("hard_constraints", dashboard_page_instructions_1.dashboardPageInstructions.hardConstraints).withSection("api_references", dashboard_page_instructions_1.dashboardPageInstructions.apiReferences).withSection("wds_reference", dashboard_page_instructions_1.dashboardPageInstructions.wdsReference()).withImplementationGuidelines(dashboard_page_instructions_1.dashboardPageInstructions.typescriptQualityGuidelines);
72578
72578
  if (useData) {
72579
- systemPrompt.withSection("data_prompt", dashboard_page_instructions_1.dashboardPageInstructions.dataPrompt);
72580
- }
72581
- if (useAutoPatterns && useIteration) {
72582
- systemPrompt.withSection("auto_patterns_content", dashboard_page_instructions_1.dashboardPageInstructions.autoPatternsContent(autoPatternsSectionIds));
72579
+ coreSystemPrompt.withSection("data_prompt", dashboard_page_instructions_1.dashboardPageInstructions.dataPrompt);
72583
72580
  }
72584
72581
  if (useApiSpec) {
72585
- systemPrompt.withSection("api_spec", dashboard_page_instructions_1.dashboardPageInstructions.apiSpecPrompt);
72582
+ coreSystemPrompt.withSection("api_spec", dashboard_page_instructions_1.dashboardPageInstructions.apiSpecPrompt);
72586
72583
  }
72587
72584
  if (useDynamicParameters) {
72588
- systemPrompt.withSection("dynamic_parameters_management", dashboard_page_instructions_1.dashboardPageInstructions.dynamicParametersManagementPrompt);
72589
- }
72585
+ coreSystemPrompt.withSection("dynamic_parameters_management", dashboard_page_instructions_1.dashboardPageInstructions.dynamicParametersManagementPrompt);
72586
+ }
72587
+ return coreSystemPrompt;
72588
+ };
72589
+ var dashboardPageCorePrompt = () => {
72590
+ return createCoreBuilder({
72591
+ apiNames: [],
72592
+ useData: true,
72593
+ useIteration: true,
72594
+ apiDocumentation: "",
72595
+ useApiSpec: true,
72596
+ useDynamicParameters: true
72597
+ }).compose();
72598
+ };
72599
+ exports2.dashboardPageCorePrompt = dashboardPageCorePrompt;
72600
+ var dashboardPagePrompt = async ({ useData, useApiSpec, useDynamicParameters, apiNames, apiDocumentation, useIteration }) => {
72601
+ const systemPrompt = createCoreBuilder({
72602
+ apiNames,
72603
+ useData,
72604
+ useIteration,
72605
+ apiDocumentation,
72606
+ useApiSpec,
72607
+ useDynamicParameters
72608
+ }).withContextExplanation().withApiDocs().withCorePrinciples().withOutputConstraints().withExamples();
72590
72609
  return systemPrompt.compose();
72591
72610
  };
72592
72611
  exports2.dashboardPagePrompt = dashboardPagePrompt;
@@ -72599,7 +72618,6 @@ var require_prompt_selectors = __commonJS({
72599
72618
  "use strict";
72600
72619
  Object.defineProperty(exports2, "__esModule", { value: true });
72601
72620
  exports2.shouldUseDataPrompt = shouldUseDataPrompt;
72602
- exports2.shouldUseAutoPatterns = shouldUseAutoPatterns;
72603
72621
  exports2.hasUnsupportedCollectionFieldsTypes = hasUnsupportedCollectionFieldsTypes;
72604
72622
  exports2.hasUnsupportedCollectionTypes = hasUnsupportedCollectionTypes;
72605
72623
  exports2.shouldUseDynamicParametersPrompt = shouldUseDynamicParametersPrompt;
@@ -72609,10 +72627,6 @@ var require_prompt_selectors = __commonJS({
72609
72627
  const { plan, previousResources } = params;
72610
72628
  return Boolean(plan?.collections?.length || previousResources?.collections?.length);
72611
72629
  }
72612
- function shouldUseAutoPatterns(params) {
72613
- const { relevantFilePaths } = params;
72614
- return (relevantFilePaths ?? []).some((path4) => path4.includes("patterns.json"));
72615
- }
72616
72630
  var unsupportedCollectionTypesInAutoPatterns = [
72617
72631
  types_1.FieldType.MULTI_REFERENCE,
72618
72632
  types_1.FieldType.OBJECT,
@@ -72750,64 +72764,18 @@ To modify a file, you can either use the 'edit' operation to replace a specific
72750
72764
  }
72751
72765
  });
72752
72766
 
72753
- // dist/agents/utils/file-loading.js
72754
- var require_file_loading = __commonJS({
72755
- "dist/agents/utils/file-loading.js"(exports2) {
72756
- "use strict";
72757
- var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
72758
- return mod && mod.__esModule ? mod : { "default": mod };
72759
- };
72760
- Object.defineProperty(exports2, "__esModule", { value: true });
72761
- exports2.loadRelevantFilesAsString = loadRelevantFilesAsString;
72762
- var fs_1 = __importDefault2(require("fs"));
72763
- var path_1 = __importDefault2(require("path"));
72764
- function loadRelevantFiles(relevantFilePaths = [], basePath) {
72765
- return relevantFilePaths.map((filePath) => {
72766
- const fullPath = path_1.default.isAbsolute(basePath) ? path_1.default.join(basePath, filePath) : path_1.default.join(process.cwd(), basePath, filePath);
72767
- try {
72768
- if (!fs_1.default.existsSync(fullPath)) {
72769
- return `Path: ${filePath}
72770
-
72771
- [File does not exist]`;
72772
- }
72773
- const stats = fs_1.default.statSync(fullPath);
72774
- if (stats.isDirectory()) {
72775
- return `Path: ${filePath}
72776
-
72777
- [Path is a directory, not a file]`;
72778
- }
72779
- const content = fs_1.default.readFileSync(fullPath, "utf8");
72780
- return `Path: ${filePath}
72781
-
72782
- ${content}`;
72783
- } catch (error) {
72784
- return `Path: ${filePath}
72785
-
72786
- [Could not read file: ${error instanceof Error ? error.message : "Unknown error"}]`;
72787
- }
72788
- });
72789
- }
72790
- function loadRelevantFilesAsString(relevantFilePaths = [], basePath) {
72791
- const srcOnlyPaths = relevantFilePaths.filter((p) => {
72792
- const normalized = path_1.default.normalize(p);
72793
- return normalized.startsWith("src" + path_1.default.sep);
72794
- });
72795
- return loadRelevantFiles(srcOnlyPaths, basePath).join("\n\n---\n\n");
72796
- }
72797
- }
72798
- });
72799
-
72800
72767
  // dist/agents/userPrompt.js
72801
72768
  var require_userPrompt = __commonJS({
72802
72769
  "dist/agents/userPrompt.js"(exports2) {
72803
72770
  "use strict";
72804
72771
  Object.defineProperty(exports2, "__esModule", { value: true });
72805
- exports2.buildUserPromptForCodeGenerationAgent = void 0;
72772
+ exports2.formatEmbeddedScriptParameters = exports2.formatCollections = exports2.buildUserPromptForCodeGenerationAgent = void 0;
72773
+ exports2.formatExistingCollections = formatExistingCollections;
72774
+ exports2.formatExistingEmbeddedScriptParameters = formatExistingEmbeddedScriptParameters;
72806
72775
  var types_1 = require_types_impl();
72807
72776
  var ditto_codegen_types_12 = require_dist();
72808
- var file_loading_1 = require_file_loading();
72809
72777
  var buildUserPromptForCodeGenerationAgent = (params, primaryAction) => {
72810
- const { extension, blueprint, scaffolds, userRequestSummary, relevantFilePaths, plan, basePath, previousResources } = params;
72778
+ const { extension, blueprint, scaffolds, userRequestSummary, plan, previousResources } = params;
72811
72779
  const contextSections = [];
72812
72780
  if (extension.name)
72813
72781
  contextSections.push(`Extension Name: ${extension.name}`);
@@ -72820,12 +72788,6 @@ var require_userPrompt = __commonJS({
72820
72788
  contextSections.push(`
72821
72789
  ## USER REQUEST
72822
72790
  ${userRequestSummary}`);
72823
- }
72824
- if (relevantFilePaths) {
72825
- const relevantFiles = (0, file_loading_1.loadRelevantFilesAsString)(relevantFilePaths, basePath);
72826
- contextSections.push(`
72827
- ## RELEVANT FILES
72828
- ${relevantFiles}`);
72829
72791
  }
72830
72792
  if (scaffolds) {
72831
72793
  scaffolds.forEach((s) => {
@@ -72838,23 +72800,15 @@ ${s.content}
72838
72800
  });
72839
72801
  }
72840
72802
  if (previousResources?.collections && previousResources.collections.length > 0) {
72841
- const formattedPreviousCollections = previousResources.collections.map((c) => ({
72842
- ...c,
72843
- id: c.idSuffix
72844
- }));
72845
- contextSections.push(`
72846
- ## EXISTING COLLECTIONS FROM PROJECT
72847
- These collections already exist in the project:
72848
- ${JSON.stringify(formattedPreviousCollections, null, 2)}`);
72803
+ const existingCollections = formatExistingCollections(previousResources.collections);
72804
+ contextSections.push(existingCollections);
72849
72805
  }
72850
72806
  if (previousResources?.embeddedScriptParameters && extensionSupportsEmbeddedScriptParameters(extension.type) && previousResources.embeddedScriptParameters.length > 0) {
72851
- contextSections.push(`
72852
- ## EXISTING EMBEDDED SCRIPT PARAMETERS FROM PROJECT
72853
- These embedded script parameters already exist:
72854
- ${JSON.stringify(previousResources.embeddedScriptParameters, null, 2)}`);
72807
+ const existingParams = formatExistingEmbeddedScriptParameters(previousResources.embeddedScriptParameters);
72808
+ contextSections.push(existingParams);
72855
72809
  }
72856
72810
  if (plan?.collections && plan.collections.length > 0) {
72857
- contextSections.push(formatCollections(plan.collections));
72811
+ contextSections.push((0, exports2.formatCollections)(plan.collections));
72858
72812
  }
72859
72813
  if (plan?.apiSpec) {
72860
72814
  contextSections.push(`
@@ -72862,7 +72816,7 @@ ${JSON.stringify(previousResources.embeddedScriptParameters, null, 2)}`);
72862
72816
  ${JSON.stringify(plan.apiSpec, null, 2)}`);
72863
72817
  }
72864
72818
  if (extensionSupportsEmbeddedScriptParameters(extension.type) && plan?.embeddedScriptParameters && plan.embeddedScriptParameters.length > 0) {
72865
- contextSections.push(formatEmbeddedScriptParameters(plan.embeddedScriptParameters));
72819
+ contextSections.push((0, exports2.formatEmbeddedScriptParameters)(plan.embeddedScriptParameters));
72866
72820
  }
72867
72821
  const userMessage = `${primaryAction}:
72868
72822
  ${contextSections.join("\n")}`;
@@ -72890,6 +72844,7 @@ Operations Guide:
72890
72844
  ${instructions}
72891
72845
  ${JSON.stringify(formattedOps, null, 2)}`;
72892
72846
  };
72847
+ exports2.formatCollections = formatCollections;
72893
72848
  var formatEmbeddedScriptParameters = (operations) => {
72894
72849
  const instructions = `
72895
72850
  Operations Guide:
@@ -72906,6 +72861,23 @@ Operations Guide:
72906
72861
  ${instructions}
72907
72862
  ${JSON.stringify(formattedOps, null, 2)}`;
72908
72863
  };
72864
+ exports2.formatEmbeddedScriptParameters = formatEmbeddedScriptParameters;
72865
+ function formatExistingCollections(collections) {
72866
+ const formatted = collections.map((c) => ({
72867
+ ...c,
72868
+ id: c.idSuffix
72869
+ }));
72870
+ return `
72871
+ ## EXISTING COLLECTIONS FROM PROJECT
72872
+ These collections already exist in the project:
72873
+ ${JSON.stringify(formatted, null, 2)}`;
72874
+ }
72875
+ function formatExistingEmbeddedScriptParameters(parameters) {
72876
+ return `
72877
+ ## EXISTING EMBEDDED SCRIPT PARAMETERS FROM PROJECT
72878
+ These embedded script parameters already exist:
72879
+ ${JSON.stringify(parameters, null, 2)}`;
72880
+ }
72909
72881
  function extensionSupportsEmbeddedScriptParameters(extensionType) {
72910
72882
  const PARAMETER_EXTENSIONS = [
72911
72883
  types_1.ExtensionType.EMBEDDED_SCRIPT,
@@ -72960,19 +72932,11 @@ var require_BaseCodeGenerationAgent = __commonJS({
72960
72932
  var require_DashboardPageAgent2 = __commonJS({
72961
72933
  "dist/agents/DashboardPageAgent.js"(exports2) {
72962
72934
  "use strict";
72963
- var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
72964
- return mod && mod.__esModule ? mod : { "default": mod };
72965
- };
72966
72935
  Object.defineProperty(exports2, "__esModule", { value: true });
72967
72936
  exports2.DashboardPageAgent = void 0;
72968
- var fs_1 = __importDefault2(require("fs"));
72969
- var path_1 = __importDefault2(require("path"));
72970
72937
  var dashboard_page_prompt_1 = require_dashboard_page_prompt();
72971
72938
  var prompt_selectors_1 = require_prompt_selectors();
72972
72939
  var codegen_common_logic_1 = require_dist9();
72973
- var codeGenerationService_12 = require_codeGenerationService();
72974
- var constants_1 = require_constants();
72975
- var codegen_dashboard_agents_1 = require_dist11();
72976
72940
  var api_1 = require_api2();
72977
72941
  var BaseCodeGenerationAgent_1 = require_BaseCodeGenerationAgent();
72978
72942
  var DashboardPageAgent = class extends BaseCodeGenerationAgent_1.BaseCodeGenerationAgent {
@@ -72983,57 +72947,22 @@ var require_DashboardPageAgent2 = __commonJS({
72983
72947
  getAgentDocumentation() {
72984
72948
  return (0, codegen_common_logic_1.getDashboardPageAgentDocumentation)();
72985
72949
  }
72986
- async getAutoPatternsSectionIds(useAutoPatterns, userRequestSummary) {
72987
- if (!useAutoPatterns || !this.useIteration || !userRequestSummary) {
72988
- return void 0;
72989
- }
72990
- const autoPatternsDocSelector = new codegen_dashboard_agents_1.AutoPatternsContextAgent({
72991
- aiService: codeGenerationService_12.codegenAIProxyService,
72992
- provider: constants_1.LLM_PROVIDERS.ANTHROPIC,
72993
- model: constants_1.LLM_MODELS.CLAUDE_HAIKU_4_5,
72994
- buildSystemPrompt: codegen_dashboard_agents_1.autoPatternsContextPrompt
72995
- });
72996
- const result = await autoPatternsDocSelector.generate(userRequestSummary);
72997
- return result.selectedSectionIds;
72998
- }
72999
- // Temporary fix to add all files in the auto patterns directory as relevant files
73000
- addAutoPatternsRelevantFiles(params) {
73001
- const relevantFilePaths = params.relevantFilePaths ?? [];
73002
- const patternsJsonPath = relevantFilePaths.find((p) => p.endsWith("patterns.json"));
73003
- if (patternsJsonPath) {
73004
- const patternsDir = path_1.default.dirname(patternsJsonPath);
73005
- const absoluteDir = path_1.default.join(params.basePath, patternsDir);
73006
- try {
73007
- const filesInDir = fs_1.default.readdirSync(absoluteDir).filter((file) => fs_1.default.statSync(path_1.default.join(absoluteDir, file)).isFile()).map((file) => path_1.default.join(patternsDir, file));
73008
- const newPaths = filesInDir.filter((filePath) => !relevantFilePaths.includes(filePath));
73009
- if (newPaths.length > 0) {
73010
- params.relevantFilePaths = [...relevantFilePaths, ...newPaths];
73011
- }
73012
- } catch {
73013
- console.error(`Error reading auto patterns directory: ${absoluteDir}`);
73014
- }
73015
- }
72950
+ getCoreSystemPrompt() {
72951
+ return (0, dashboard_page_prompt_1.dashboardPageCorePrompt)();
73016
72952
  }
73017
72953
  async buildSystemPrompt(params) {
73018
- const { plan, userRequestSummary } = params;
72954
+ const { plan } = params;
73019
72955
  const useData = (0, prompt_selectors_1.shouldUseDataPrompt)(params);
73020
- const useAutoPatterns = (0, prompt_selectors_1.shouldUseAutoPatterns)(params);
73021
72956
  const useApiSpec = Boolean(plan?.apiSpec);
73022
72957
  const useDynamicParameters = (0, prompt_selectors_1.shouldUseDynamicParametersPrompt)(params);
73023
- const autoPatternsSectionIds = await this.getAutoPatternsSectionIds(useAutoPatterns, userRequestSummary);
73024
- if (useAutoPatterns) {
73025
- this.addAutoPatternsRelevantFiles(params);
73026
- }
73027
72958
  const { apiDocumentation, apiNames } = (0, api_1.extractApiDocumentation)(params.extension);
73028
72959
  return (0, dashboard_page_prompt_1.dashboardPagePrompt)({
73029
72960
  useData,
73030
- useAutoPatterns,
73031
72961
  useApiSpec,
73032
72962
  useDynamicParameters,
73033
72963
  apiNames,
73034
72964
  apiDocumentation,
73035
- useIteration: this.useIteration,
73036
- autoPatternsSectionIds
72965
+ useIteration: this.useIteration
73037
72966
  });
73038
72967
  }
73039
72968
  getPrimaryAction(params) {
@@ -73088,19 +73017,35 @@ var require_site_component_prompt = __commonJS({
73088
73017
  "dist/system-prompts/siteComponent/site-component-prompt.js"(exports2) {
73089
73018
  "use strict";
73090
73019
  Object.defineProperty(exports2, "__esModule", { value: true });
73091
- exports2.siteComponentPrompt = void 0;
73020
+ exports2.siteComponentPrompt = exports2.siteComponentCorePrompt = void 0;
73092
73021
  var types_1 = require_types_impl();
73093
73022
  var site_component_instructions_1 = require_site_component_instructions();
73094
73023
  var CodeGenerationSystemPromptBuilder_1 = require_CodeGenerationSystemPromptBuilder();
73095
- var siteComponentPrompt = ({ apiNames, useData, useIteration, apiDocumentation }) => {
73096
- const siteComponentPromptBuilder = (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
73024
+ var createCoreBuilder = ({ apiNames, useData, useIteration, apiDocumentation }) => {
73025
+ return (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
73097
73026
  agentType: types_1.ExtensionType.SITE_COMPONENT,
73098
73027
  apiNames,
73099
- apiDocumentation,
73100
73028
  useData,
73101
- useIteration
73102
- }).withRole(site_component_instructions_1.siteComponentInstructions.role).withContextExplanation().withCorePrinciples().withOutputConstraints().withImplementationGuidelines(site_component_instructions_1.siteComponentInstructions.implementationGuidelines).withApiDocs().withExamples();
73103
- return siteComponentPromptBuilder.compose();
73029
+ useIteration,
73030
+ apiDocumentation
73031
+ }).withRole(site_component_instructions_1.siteComponentInstructions.role).withImplementationGuidelines(site_component_instructions_1.siteComponentInstructions.implementationGuidelines);
73032
+ };
73033
+ var siteComponentCorePrompt = () => {
73034
+ return createCoreBuilder({
73035
+ apiNames: [],
73036
+ useData: true,
73037
+ useIteration: true,
73038
+ apiDocumentation: ""
73039
+ }).compose();
73040
+ };
73041
+ exports2.siteComponentCorePrompt = siteComponentCorePrompt;
73042
+ var siteComponentPrompt = ({ apiNames, useData, useIteration, apiDocumentation }) => {
73043
+ return createCoreBuilder({
73044
+ apiNames,
73045
+ useData,
73046
+ useIteration,
73047
+ apiDocumentation
73048
+ }).withContextExplanation().withCorePrinciples().withOutputConstraints().withApiDocs().withExamples().compose();
73104
73049
  };
73105
73050
  exports2.siteComponentPrompt = siteComponentPrompt;
73106
73051
  }
@@ -73124,6 +73069,9 @@ var require_SiteComponentAgent2 = __commonJS({
73124
73069
  getAgentDocumentation() {
73125
73070
  return (0, codegen_common_logic_1.getSiteComponentAgentDocumentation)();
73126
73071
  }
73072
+ getCoreSystemPrompt() {
73073
+ return (0, site_component_prompt_1.siteComponentCorePrompt)();
73074
+ }
73127
73075
  buildSystemPrompt(params) {
73128
73076
  const { apiDocumentation, apiNames } = (0, api_1.extractApiDocumentation)(params.extension);
73129
73077
  const useData = Boolean(params.plan?.collections?.length);
@@ -73229,21 +73177,39 @@ var require_custom_element_prompt = __commonJS({
73229
73177
  "dist/system-prompts/customElement/custom-element-prompt.js"(exports2) {
73230
73178
  "use strict";
73231
73179
  Object.defineProperty(exports2, "__esModule", { value: true });
73232
- exports2.customElementPrompt = void 0;
73180
+ exports2.customElementPrompt = exports2.customElementCorePrompt = void 0;
73233
73181
  var types_1 = require_types_impl();
73234
73182
  var custom_element_instructions_1 = require_custom_element_instructions();
73235
73183
  var CodeGenerationSystemPromptBuilder_1 = require_CodeGenerationSystemPromptBuilder();
73236
- var customElementPrompt = ({ apiNames, useData, useIteration, apiDocumentation }) => {
73237
- const systemPrompt = (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
73184
+ var createCoreBuilder = ({ apiNames, useData, useIteration, apiDocumentation }) => {
73185
+ const coreSystemPrompt = (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
73238
73186
  agentType: types_1.ExtensionType.SITE_WIDGET,
73239
73187
  apiNames,
73240
73188
  apiDocumentation,
73241
73189
  useData,
73242
73190
  useIteration
73243
- }).withRole(custom_element_instructions_1.customElementInstructions.role).withContextExplanation().withCorePrinciples().withOutputConstraints().withImplementationGuidelines(custom_element_instructions_1.customElementInstructions.implementationGuidelines).withSection("wds_reference", custom_element_instructions_1.customElementInstructions.wdsReference()).withApiDocs().withExamples();
73191
+ }).withRole(custom_element_instructions_1.customElementInstructions.role).withImplementationGuidelines(custom_element_instructions_1.customElementInstructions.implementationGuidelines).withSection("wds_reference", custom_element_instructions_1.customElementInstructions.wdsReference());
73244
73192
  if (useData) {
73245
- systemPrompt.withSection("implementation_requirements", custom_element_instructions_1.customElementInstructions.implementationRequirements);
73193
+ coreSystemPrompt.withSection("implementation_requirements", custom_element_instructions_1.customElementInstructions.implementationRequirements);
73246
73194
  }
73195
+ return coreSystemPrompt;
73196
+ };
73197
+ var customElementCorePrompt = () => {
73198
+ return createCoreBuilder({
73199
+ apiNames: [],
73200
+ useData: true,
73201
+ useIteration: true,
73202
+ apiDocumentation: ""
73203
+ }).compose();
73204
+ };
73205
+ exports2.customElementCorePrompt = customElementCorePrompt;
73206
+ var customElementPrompt = ({ apiNames, useData, useIteration, apiDocumentation }) => {
73207
+ const systemPrompt = createCoreBuilder({
73208
+ apiNames,
73209
+ useData,
73210
+ useIteration,
73211
+ apiDocumentation
73212
+ }).withContextExplanation().withCorePrinciples().withOutputConstraints().withApiDocs().withExamples();
73247
73213
  return systemPrompt.compose();
73248
73214
  };
73249
73215
  exports2.customElementPrompt = customElementPrompt;
@@ -73268,6 +73234,9 @@ var require_CustomElementAgent2 = __commonJS({
73268
73234
  getAgentDocumentation() {
73269
73235
  return (0, codegen_common_logic_1.getCustomElementAgentDocumentation)();
73270
73236
  }
73237
+ getCoreSystemPrompt() {
73238
+ return (0, custom_element_prompt_1.customElementCorePrompt)();
73239
+ }
73271
73240
  buildSystemPrompt(params) {
73272
73241
  const { apiDocumentation, apiNames } = (0, api_1.extractApiDocumentation)(params.extension);
73273
73242
  const useData = Boolean(params.plan?.collections?.length);
@@ -73451,24 +73420,41 @@ var require_service_plugin_prompt = __commonJS({
73451
73420
  "dist/system-prompts/servicePlugin/service-plugin-prompt.js"(exports2) {
73452
73421
  "use strict";
73453
73422
  Object.defineProperty(exports2, "__esModule", { value: true });
73454
- exports2.servicePluginPrompt = void 0;
73423
+ exports2.servicePluginPrompt = exports2.servicePluginCorePrompt = void 0;
73455
73424
  var servicePluginDocLoader_1 = require_servicePluginDocLoader();
73456
73425
  var service_plugin_instructions_1 = require_service_plugin_instructions();
73457
73426
  var types_1 = require_types_impl();
73458
73427
  var CodeGenerationSystemPromptBuilder_1 = require_CodeGenerationSystemPromptBuilder();
73459
- var servicePluginPrompt = ({ apiNames, useData, useIteration, spiNames = [], apiDocumentation }) => {
73460
- const servicePluginDocs = (0, servicePluginDocLoader_1.loadServicePluginDocumentation)(spiNames);
73461
- const servicePluginPromptBuilder = (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
73428
+ var createCoreBuilder = ({ apiNames, useData, useIteration, apiDocumentation }) => {
73429
+ return (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
73462
73430
  agentType: types_1.ExtensionType.SERVICE_PLUGIN,
73463
73431
  apiNames,
73464
73432
  apiDocumentation,
73465
73433
  useData,
73466
73434
  useIteration
73467
- }).withRole(service_plugin_instructions_1.servicePluginInstructions.role).withContextExplanation().withImplementationPatterns(service_plugin_instructions_1.servicePluginInstructions.implementationPatterns).withImplementationGuidelines(service_plugin_instructions_1.servicePluginInstructions.implementationGuidelines).withCorePrinciples().withOutputConstraints().withAuthenticationElevationRequirement().withApiDocs().withExamples().withSection("available_service_plugins", servicePluginDocs);
73435
+ }).withRole(service_plugin_instructions_1.servicePluginInstructions.role).withImplementationPatterns(service_plugin_instructions_1.servicePluginInstructions.implementationPatterns).withImplementationGuidelines(service_plugin_instructions_1.servicePluginInstructions.implementationGuidelines);
73436
+ };
73437
+ var servicePluginCorePrompt = () => {
73438
+ return createCoreBuilder({
73439
+ apiNames: [],
73440
+ useData: true,
73441
+ useIteration: true,
73442
+ apiDocumentation: ""
73443
+ }).compose();
73444
+ };
73445
+ exports2.servicePluginCorePrompt = servicePluginCorePrompt;
73446
+ var servicePluginPrompt = ({ apiNames, useData, useIteration, spiNames = [], apiDocumentation }) => {
73447
+ const servicePluginDocs = (0, servicePluginDocLoader_1.loadServicePluginDocumentation)(spiNames);
73448
+ const systemPrompt = createCoreBuilder({
73449
+ apiNames,
73450
+ useData,
73451
+ useIteration,
73452
+ apiDocumentation
73453
+ }).withContextExplanation().withCorePrinciples().withOutputConstraints().withAuthenticationElevationRequirement().withApiDocs().withExamples();
73468
73454
  if (servicePluginDocs) {
73469
- servicePluginPromptBuilder.withSection("available_service_plugins", servicePluginDocs);
73455
+ systemPrompt.withSection("available_service_plugins", servicePluginDocs);
73470
73456
  }
73471
- return servicePluginPromptBuilder.compose();
73457
+ return systemPrompt.compose();
73472
73458
  };
73473
73459
  exports2.servicePluginPrompt = servicePluginPrompt;
73474
73460
  }
@@ -73493,6 +73479,9 @@ var require_SPIAgent2 = __commonJS({
73493
73479
  getAgentDocumentation() {
73494
73480
  return (0, codegen_common_logic_1.getSPIAgentDocumentation)();
73495
73481
  }
73482
+ getCoreSystemPrompt() {
73483
+ return (0, service_plugin_prompt_1.servicePluginCorePrompt)();
73484
+ }
73496
73485
  buildSystemPrompt(params) {
73497
73486
  const { extension } = params;
73498
73487
  const spiNames = extension.relatedSpis?.map((spi) => spi.name).filter((name) => !!name) || [];
@@ -73559,19 +73548,35 @@ var require_backend_event_prompt = __commonJS({
73559
73548
  "dist/system-prompts/backendEvent/backend-event-prompt.js"(exports2) {
73560
73549
  "use strict";
73561
73550
  Object.defineProperty(exports2, "__esModule", { value: true });
73562
- exports2.backendEventPrompt = void 0;
73551
+ exports2.backendEventPrompt = exports2.backendEventCorePrompt = void 0;
73563
73552
  var types_1 = require_types_impl();
73564
73553
  var backend_event_instructions_1 = require_backend_event_instructions();
73565
73554
  var CodeGenerationSystemPromptBuilder_1 = require_CodeGenerationSystemPromptBuilder();
73566
- var backendEventPrompt = ({ apiNames, useData, useIteration, apiDocumentation }) => {
73567
- const backendEventPromptBuilder = (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
73555
+ var createCoreBuilder = ({ apiNames, useData, useIteration, apiDocumentation }) => {
73556
+ return (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
73568
73557
  agentType: types_1.ExtensionType.BACKEND_EVENT,
73569
73558
  apiNames,
73570
73559
  apiDocumentation,
73571
73560
  useData,
73572
73561
  useIteration
73573
- }).withRole(backend_event_instructions_1.backendEventInstructions.role).withContextExplanation().withCorePrinciples().withOutputConstraints().withImplementationPatterns(backend_event_instructions_1.backendEventInstructions.implementationPatterns).withImplementationGuidelines(backend_event_instructions_1.backendEventInstructions.implementationGuidelines).withAuthenticationElevationRequirement().withApiDocs().withExamples();
73574
- return backendEventPromptBuilder.compose();
73562
+ }).withRole(backend_event_instructions_1.backendEventInstructions.role).withImplementationPatterns(backend_event_instructions_1.backendEventInstructions.implementationPatterns).withImplementationGuidelines(backend_event_instructions_1.backendEventInstructions.implementationGuidelines);
73563
+ };
73564
+ var backendEventCorePrompt = () => {
73565
+ return createCoreBuilder({
73566
+ apiNames: [],
73567
+ useData: true,
73568
+ useIteration: true,
73569
+ apiDocumentation: ""
73570
+ }).compose();
73571
+ };
73572
+ exports2.backendEventCorePrompt = backendEventCorePrompt;
73573
+ var backendEventPrompt = ({ apiNames, useData, useIteration, apiDocumentation }) => {
73574
+ return createCoreBuilder({
73575
+ apiNames,
73576
+ useData,
73577
+ useIteration,
73578
+ apiDocumentation
73579
+ }).withContextExplanation().withCorePrinciples().withOutputConstraints().withAuthenticationElevationRequirement().withApiDocs().withExamples().compose();
73575
73580
  };
73576
73581
  exports2.backendEventPrompt = backendEventPrompt;
73577
73582
  }
@@ -73596,6 +73601,9 @@ var require_BackendEventAgent2 = __commonJS({
73596
73601
  getAgentDocumentation() {
73597
73602
  return (0, codegen_common_logic_1.getBackendEventAgentDocumentation)();
73598
73603
  }
73604
+ getCoreSystemPrompt() {
73605
+ return (0, backend_event_prompt_1.backendEventCorePrompt)();
73606
+ }
73599
73607
  buildSystemPrompt(params) {
73600
73608
  const { apiDocumentation, apiNames } = (0, api_1.extractApiDocumentation)(params.extension);
73601
73609
  const useData = (0, prompt_selectors_1.shouldUseDataPrompt)(params);
@@ -73707,19 +73715,35 @@ var require_backend_api_prompt = __commonJS({
73707
73715
  "dist/system-prompts/backendApi/backend-api-prompt.js"(exports2) {
73708
73716
  "use strict";
73709
73717
  Object.defineProperty(exports2, "__esModule", { value: true });
73710
- exports2.backendApiPrompt = void 0;
73718
+ exports2.backendApiPrompt = exports2.backendApiCorePrompt = void 0;
73711
73719
  var types_1 = require_types_impl();
73712
73720
  var backend_api_instructions_1 = require_backend_api_instructions();
73713
73721
  var CodeGenerationSystemPromptBuilder_1 = require_CodeGenerationSystemPromptBuilder();
73714
- var backendApiPrompt = ({ apiNames, useData, useIteration, apiDocumentation }) => {
73715
- const systemPrompt = (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
73722
+ var createCoreBuilder = ({ apiNames, useData, useIteration, apiDocumentation }) => {
73723
+ return (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
73716
73724
  agentType: types_1.ExtensionType.BACKEND_API,
73717
73725
  apiNames,
73718
73726
  apiDocumentation,
73719
73727
  useData,
73720
73728
  useIteration
73721
- }).withRole(backend_api_instructions_1.backendApiInstructions.role).withContextExplanation().withCorePrinciples().withOutputConstraints().withImplementationGuidelines(backend_api_instructions_1.backendApiInstructions.implementationGuidelines).withCoreKnowledge(backend_api_instructions_1.backendApiInstructions.coreKnowledge).withApiDocs().withExamples();
73722
- return systemPrompt.compose();
73729
+ }).withRole(backend_api_instructions_1.backendApiInstructions.role).withImplementationGuidelines(backend_api_instructions_1.backendApiInstructions.implementationGuidelines).withCoreKnowledge(backend_api_instructions_1.backendApiInstructions.coreKnowledge);
73730
+ };
73731
+ var backendApiCorePrompt = () => {
73732
+ return createCoreBuilder({
73733
+ apiNames: [],
73734
+ useData: true,
73735
+ useIteration: true,
73736
+ apiDocumentation: ""
73737
+ }).compose();
73738
+ };
73739
+ exports2.backendApiCorePrompt = backendApiCorePrompt;
73740
+ var backendApiPrompt = ({ apiNames, useData, useIteration, apiDocumentation }) => {
73741
+ return createCoreBuilder({
73742
+ apiNames,
73743
+ useData,
73744
+ useIteration,
73745
+ apiDocumentation
73746
+ }).withContextExplanation().withCorePrinciples().withOutputConstraints().withApiDocs().withExamples().compose();
73723
73747
  };
73724
73748
  exports2.backendApiPrompt = backendApiPrompt;
73725
73749
  }
@@ -73744,6 +73768,9 @@ var require_BackendApiAgent2 = __commonJS({
73744
73768
  getAgentDocumentation() {
73745
73769
  return (0, codegen_common_logic_1.getBackendApiAgentDocumentation)();
73746
73770
  }
73771
+ getCoreSystemPrompt() {
73772
+ return (0, backend_api_prompt_1.backendApiCorePrompt)();
73773
+ }
73747
73774
  buildSystemPrompt(params) {
73748
73775
  const { apiDocumentation, apiNames } = (0, api_1.extractApiDocumentation)(params.extension);
73749
73776
  const useData = (0, prompt_selectors_1.shouldUseDataPrompt)(params);
@@ -73969,21 +73996,40 @@ var require_embedded_script_prompt = __commonJS({
73969
73996
  "dist/system-prompts/embeddedScript/embedded-script-prompt.js"(exports2) {
73970
73997
  "use strict";
73971
73998
  Object.defineProperty(exports2, "__esModule", { value: true });
73972
- exports2.embeddedScriptPrompt = void 0;
73999
+ exports2.embeddedScriptPrompt = exports2.embeddedScriptCorePrompt = void 0;
73973
74000
  var dynamicParameters_1 = require_dynamicParameters2();
73974
74001
  var types_1 = require_types_impl();
73975
74002
  var embedded_script_instructions_1 = require_embedded_script_instructions();
73976
74003
  var CodeGenerationSystemPromptBuilder_1 = require_CodeGenerationSystemPromptBuilder();
73977
- var embeddedScriptPrompt = ({ apiNames, hasDynamicParameters, useData, useIteration, apiDocumentation }) => {
74004
+ var createCoreBuilder = ({ apiNames, useData, useIteration, apiDocumentation, hasDynamicParameters }) => {
73978
74005
  const embeddedScriptImplementationGuidelines = hasDynamicParameters ? `${embedded_script_instructions_1.embeddedScriptInstructions.embeddedScriptImplementationGuidelines}
73979
74006
  ${(0, dynamicParameters_1.dynamicParametersPrompt)()}` : embedded_script_instructions_1.embeddedScriptInstructions.embeddedScriptImplementationGuidelines;
73980
- const systemPrompt = (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
74007
+ return (0, CodeGenerationSystemPromptBuilder_1.codeGenerationSystemPromptBuilder)({
73981
74008
  agentType: types_1.ExtensionType.EMBEDDED_SCRIPT,
73982
74009
  apiNames,
73983
74010
  apiDocumentation,
73984
74011
  useData,
73985
74012
  useIteration
73986
- }).withRole(embedded_script_instructions_1.embeddedScriptInstructions.role).withContextExplanation().withSection("embedded_script_extension_files_and_code", embedded_script_instructions_1.embeddedScriptInstructions.embeddedScriptFilesAndCode).withImplementationGuidelines(embeddedScriptImplementationGuidelines).withImplementationPatterns(embedded_script_instructions_1.embeddedScriptInstructions.embeddedScriptImplementationPatterns).withCorePrinciples().withOutputConstraints().withApiDocs().withExamples();
74013
+ }).withRole(embedded_script_instructions_1.embeddedScriptInstructions.role).withSection("embedded_script_extension_files_and_code", embedded_script_instructions_1.embeddedScriptInstructions.embeddedScriptFilesAndCode).withImplementationGuidelines(embeddedScriptImplementationGuidelines).withImplementationPatterns(embedded_script_instructions_1.embeddedScriptInstructions.embeddedScriptImplementationPatterns);
74014
+ };
74015
+ var embeddedScriptCorePrompt = () => {
74016
+ return createCoreBuilder({
74017
+ apiNames: [],
74018
+ useData: true,
74019
+ useIteration: true,
74020
+ hasDynamicParameters: true,
74021
+ apiDocumentation: ""
74022
+ }).compose();
74023
+ };
74024
+ exports2.embeddedScriptCorePrompt = embeddedScriptCorePrompt;
74025
+ var embeddedScriptPrompt = ({ apiNames, hasDynamicParameters, useData, useIteration, apiDocumentation }) => {
74026
+ const systemPrompt = createCoreBuilder({
74027
+ apiNames,
74028
+ useData,
74029
+ useIteration,
74030
+ apiDocumentation,
74031
+ hasDynamicParameters
74032
+ }).withContextExplanation().withCorePrinciples().withOutputConstraints().withApiDocs().withExamples();
73987
74033
  return systemPrompt.compose();
73988
74034
  };
73989
74035
  exports2.embeddedScriptPrompt = embeddedScriptPrompt;
@@ -74032,6 +74078,9 @@ var require_EmbeddedScriptAgent2 = __commonJS({
74032
74078
  getAgentDocumentation() {
74033
74079
  return (0, codegen_common_logic_1.getEmbeddedScriptAgentDocumentation)();
74034
74080
  }
74081
+ getCoreSystemPrompt() {
74082
+ return (0, embedded_script_prompt_1.embeddedScriptCorePrompt)();
74083
+ }
74035
74084
  buildSystemPrompt(params) {
74036
74085
  const hasDynamicParameters = (0, prompt_selectors_1.shouldUseDynamicParametersPrompt)(params);
74037
74086
  const { apiDocumentation, apiNames } = (0, api_1.extractApiDocumentation)(params.extension);
@@ -74075,6 +74124,7 @@ var require_AgentsRegistry = __commonJS({
74075
74124
  exports2.getSupportedExtensionTypes = getSupportedExtensionTypes;
74076
74125
  exports2.generateSupportedExtensionsSection = generateSupportedExtensionsSection;
74077
74126
  exports2.getAgentDocumentation = getAgentDocumentation;
74127
+ exports2.getAgentCoreSystemPrompt = getAgentCoreSystemPrompt;
74078
74128
  var types_1 = require_types_impl();
74079
74129
  var DashboardPageAgent_1 = require_DashboardPageAgent2();
74080
74130
  var SiteComponentAgent_1 = require_SiteComponentAgent2();
@@ -74130,6 +74180,14 @@ var require_AgentsRegistry = __commonJS({
74130
74180
  const instance = new entry.agentClass();
74131
74181
  return instance.getAgentDocumentation();
74132
74182
  }
74183
+ function getAgentCoreSystemPrompt(extensionType) {
74184
+ const entry = exports2.CODE_GENERATION_AGENTS_REGISTRY.find((e) => e.extensionType === extensionType);
74185
+ if (!entry) {
74186
+ throw new Error(`No agent registered for extension type: ${extensionType}`);
74187
+ }
74188
+ const instance = new entry.agentClass();
74189
+ return instance.getCoreSystemPrompt();
74190
+ }
74133
74191
  }
74134
74192
  });
74135
74193
 
@@ -74665,6 +74723,7 @@ var require_contextBuilders = __commonJS({
74665
74723
  Object.defineProperty(exports2, "__esModule", { value: true });
74666
74724
  exports2.generateSrcFolderStructure = generateSrcFolderStructure;
74667
74725
  exports2.buildContextSections = buildContextSections;
74726
+ exports2.formatExtensionsToEdit = formatExtensionsToEdit;
74668
74727
  var fs_1 = __importDefault2(require("fs"));
74669
74728
  var path_1 = __importDefault2(require("path"));
74670
74729
  var tree_node_cli_1 = __importDefault2(require_src());
@@ -74725,6 +74784,24 @@ ${JSON.stringify(previousResources.embeddedScriptParameters, null, 2)}`);
74725
74784
  }
74726
74785
  return sections;
74727
74786
  }
74787
+ function formatExtension(ext, index) {
74788
+ const lines = [
74789
+ `Extension ${index + 1}:`,
74790
+ ` - Type: ${ext.extension.type}`,
74791
+ ` - Name: ${ext.extension.name}`,
74792
+ ` - Description: ${ext.extension.description || "N/A"}`
74793
+ ];
74794
+ if (ext.extension.relatedSpis && ext.extension.relatedSpis.length > 0) {
74795
+ lines.push(` - Related SPIs: ${ext.extension.relatedSpis.map((s) => s.name).join(", ")}`);
74796
+ }
74797
+ lines.push(` - Paths: ${ext.paths?.join(", ") || "N/A"}`);
74798
+ return lines.join("\n");
74799
+ }
74800
+ function formatExtensionsToEdit(extensions) {
74801
+ const header = "## Extensions to Edit\n";
74802
+ const content = extensions.map((ext, idx) => formatExtension(ext, idx)).join("\n\n");
74803
+ return header + content;
74804
+ }
74728
74805
  }
74729
74806
  });
74730
74807
 
@@ -74737,15 +74814,25 @@ var require_srcValidator = __commonJS({
74737
74814
  };
74738
74815
  Object.defineProperty(exports2, "__esModule", { value: true });
74739
74816
  exports2.resolveSrcPath = resolveSrcPath;
74740
- exports2.validateFilePathExists = validateFilePathExists;
74817
+ exports2.validatePathExists = validatePathExists;
74741
74818
  var fs_1 = __importDefault2(require("fs"));
74742
74819
  var path_1 = __importDefault2(require("path"));
74820
+ function containsPercentEncoding(input) {
74821
+ return /%[0-9a-fA-F]/i.test(input);
74822
+ }
74743
74823
  function resolveSrcPath(basePath, filePath) {
74824
+ if (containsPercentEncoding(filePath)) {
74825
+ return {
74826
+ isValid: false,
74827
+ fullPath: path_1.default.resolve(path_1.default.join(basePath, filePath)),
74828
+ error: "Access denied: URL-encoded characters in paths are not allowed"
74829
+ };
74830
+ }
74744
74831
  const fullPath = path_1.default.join(basePath, filePath);
74745
74832
  const srcPath = path_1.default.join(basePath, "src");
74746
74833
  const normalizedFullPath = path_1.default.resolve(fullPath);
74747
74834
  const normalizedSrcPath = path_1.default.resolve(srcPath);
74748
- if (!normalizedFullPath.startsWith(normalizedSrcPath)) {
74835
+ if (!normalizedFullPath.startsWith(normalizedSrcPath + path_1.default.sep) && normalizedFullPath !== normalizedSrcPath) {
74749
74836
  return {
74750
74837
  isValid: false,
74751
74838
  fullPath: normalizedFullPath,
@@ -74757,8 +74844,8 @@ var require_srcValidator = __commonJS({
74757
74844
  fullPath: normalizedFullPath
74758
74845
  };
74759
74846
  }
74760
- function validateFilePathExists(basePath, filePath) {
74761
- const result = resolveSrcPath(basePath, filePath);
74847
+ function validatePathExists(basePath, targetPath) {
74848
+ const result = resolveSrcPath(basePath, targetPath);
74762
74849
  if (!result.isValid) {
74763
74850
  return result;
74764
74851
  }
@@ -74766,7 +74853,7 @@ var require_srcValidator = __commonJS({
74766
74853
  return {
74767
74854
  isValid: false,
74768
74855
  fullPath: result.fullPath,
74769
- error: `File not found: ${filePath}`
74856
+ error: `Path not found: ${targetPath}`
74770
74857
  };
74771
74858
  }
74772
74859
  return result;
@@ -74791,7 +74878,7 @@ var require_readFile = __commonJS({
74791
74878
  });
74792
74879
  function readFile(basePath, filePath) {
74793
74880
  try {
74794
- const validation = (0, srcValidator_1.validateFilePathExists)(basePath, filePath);
74881
+ const validation = (0, srcValidator_1.validatePathExists)(basePath, filePath);
74795
74882
  if (!validation.isValid) {
74796
74883
  return { error: validation.error };
74797
74884
  }
@@ -82033,7 +82120,7 @@ var require_editFile = __commonJS({
82033
82120
  }
82034
82121
  }
82035
82122
  function editFile(basePath, filePath, edits) {
82036
- const validation = (0, srcValidator_1.validateFilePathExists)(basePath, filePath);
82123
+ const validation = (0, srcValidator_1.validatePathExists)(basePath, filePath);
82037
82124
  if (!validation.isValid) {
82038
82125
  return {
82039
82126
  filePath,
@@ -82090,6 +82177,136 @@ var require_editFile = __commonJS({
82090
82177
  }
82091
82178
  });
82092
82179
 
82180
+ // dist/tools/deleteFile.js
82181
+ var require_deleteFile = __commonJS({
82182
+ "dist/tools/deleteFile.js"(exports2) {
82183
+ "use strict";
82184
+ var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
82185
+ return mod && mod.__esModule ? mod : { "default": mod };
82186
+ };
82187
+ Object.defineProperty(exports2, "__esModule", { value: true });
82188
+ exports2.createDeleteFileTool = createDeleteFileTool;
82189
+ var zod_1 = require_zod();
82190
+ var fs_1 = __importDefault2(require("fs"));
82191
+ var srcValidator_1 = require_srcValidator();
82192
+ var deleteSchema = zod_1.z.object({
82193
+ path: zod_1.z.string().describe("Relative path from project root to the file or directory to delete (e.g., 'src/utils/helper.ts' or 'src/old-feature')"),
82194
+ recursive: zod_1.z.boolean().optional().describe("If true, recursively delete directory contents (like rm -r). Required for non-empty directories. Default: false")
82195
+ });
82196
+ function deletePath(basePath, targetPath, recursive = false) {
82197
+ try {
82198
+ const validation = (0, srcValidator_1.validatePathExists)(basePath, targetPath);
82199
+ if (!validation.isValid) {
82200
+ return {
82201
+ path: targetPath,
82202
+ type: "file",
82203
+ success: false,
82204
+ error: validation.error
82205
+ };
82206
+ }
82207
+ const stats = fs_1.default.statSync(validation.fullPath);
82208
+ const isDirectory2 = stats.isDirectory();
82209
+ if (isDirectory2) {
82210
+ if (recursive) {
82211
+ fs_1.default.rmSync(validation.fullPath, { recursive: true, force: true });
82212
+ console.log(`\u{1F5D1}\uFE0F Deleted: ${targetPath}`);
82213
+ } else {
82214
+ try {
82215
+ fs_1.default.rmdirSync(validation.fullPath);
82216
+ console.log(`\u{1F5D1}\uFE0F Deleted: ${targetPath}`);
82217
+ } catch {
82218
+ return {
82219
+ path: targetPath,
82220
+ type: "directory",
82221
+ success: false,
82222
+ error: "Directory is not empty. Use recursive: true to delete non-empty directories."
82223
+ };
82224
+ }
82225
+ }
82226
+ return { path: targetPath, type: "directory", success: true };
82227
+ } else {
82228
+ fs_1.default.unlinkSync(validation.fullPath);
82229
+ console.log(`\u{1F5D1}\uFE0F Deleted: ${targetPath}`);
82230
+ return { path: targetPath, type: "file", success: true };
82231
+ }
82232
+ } catch (error) {
82233
+ return {
82234
+ path: targetPath,
82235
+ type: "file",
82236
+ success: false,
82237
+ error: `Failed to delete: ${JSON.stringify(error)}`
82238
+ };
82239
+ }
82240
+ }
82241
+ function createDeleteFileTool(basePath) {
82242
+ return {
82243
+ description: "Delete a file or directory from the project (like rm). Use recursive: true for non-empty directories (like rm -r). Only paths within the src directory can be deleted.",
82244
+ inputSchema: deleteSchema,
82245
+ execute: async ({ path: path4, recursive }) => deletePath(basePath, path4, recursive)
82246
+ };
82247
+ }
82248
+ }
82249
+ });
82250
+
82251
+ // dist/tools/listDir.js
82252
+ var require_listDir = __commonJS({
82253
+ "dist/tools/listDir.js"(exports2) {
82254
+ "use strict";
82255
+ var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
82256
+ return mod && mod.__esModule ? mod : { "default": mod };
82257
+ };
82258
+ Object.defineProperty(exports2, "__esModule", { value: true });
82259
+ exports2.createListDirTool = createListDirTool;
82260
+ var zod_1 = require_zod();
82261
+ var fs_1 = __importDefault2(require("fs"));
82262
+ var tree_node_cli_1 = __importDefault2(require_src());
82263
+ var srcValidator_1 = require_srcValidator();
82264
+ var listDirSchema = zod_1.z.object({
82265
+ dirPath: zod_1.z.string().describe("Relative path from project root to the directory to list (e.g., 'src/dashboard'). Must be within src.")
82266
+ });
82267
+ function listDir(basePath, dirPath) {
82268
+ try {
82269
+ const validation = (0, srcValidator_1.resolveSrcPath)(basePath, dirPath);
82270
+ if (!validation.isValid) {
82271
+ return { dirPath, tree: "", error: validation.error };
82272
+ }
82273
+ if (!fs_1.default.existsSync(validation.fullPath)) {
82274
+ return {
82275
+ dirPath,
82276
+ tree: "",
82277
+ error: `Directory not found: ${dirPath}`
82278
+ };
82279
+ }
82280
+ const stats = fs_1.default.statSync(validation.fullPath);
82281
+ if (!stats.isDirectory()) {
82282
+ return {
82283
+ dirPath,
82284
+ tree: "",
82285
+ error: `Path is not a directory: ${dirPath}`
82286
+ };
82287
+ }
82288
+ const treeOutput = (0, tree_node_cli_1.default)(validation.fullPath, {
82289
+ maxDepth: 10
82290
+ });
82291
+ return { dirPath, tree: treeOutput };
82292
+ } catch (error) {
82293
+ return {
82294
+ dirPath,
82295
+ tree: "",
82296
+ error: `Failed to list directory: ${JSON.stringify(error)}`
82297
+ };
82298
+ }
82299
+ }
82300
+ function createListDirTool(basePath) {
82301
+ return {
82302
+ description: "List files and directories in a tree structure within the src folder. Returns a hierarchical view of the directory contents. Hidden files (starting with .) are excluded.",
82303
+ inputSchema: listDirSchema,
82304
+ execute: async ({ dirPath }) => listDir(basePath, dirPath)
82305
+ };
82306
+ }
82307
+ }
82308
+ });
82309
+
82093
82310
  // dist/tools/submitPlanIteration.js
82094
82311
  var require_submitPlanIteration = __commonJS({
82095
82312
  "dist/tools/submitPlanIteration.js"(exports2) {
@@ -82132,7 +82349,7 @@ var require_tools = __commonJS({
82132
82349
  "dist/tools/index.js"(exports2) {
82133
82350
  "use strict";
82134
82351
  Object.defineProperty(exports2, "__esModule", { value: true });
82135
- exports2.TOOL_NAMES = exports2.createSubmitPlanTool = exports2.createEditFileTool = exports2.createCreateFileTool = exports2.createGlobTool = exports2.createGrepTool = exports2.createReadFileTool = void 0;
82352
+ exports2.TOOL_NAMES = exports2.createSubmitPlanTool = exports2.createListDirTool = exports2.createDeleteFileTool = exports2.createEditFileTool = exports2.createCreateFileTool = exports2.createGlobTool = exports2.createGrepTool = exports2.createReadFileTool = void 0;
82136
82353
  var readFile_1 = require_readFile();
82137
82354
  Object.defineProperty(exports2, "createReadFileTool", { enumerable: true, get: function() {
82138
82355
  return readFile_1.createReadFileTool;
@@ -82153,6 +82370,14 @@ var require_tools = __commonJS({
82153
82370
  Object.defineProperty(exports2, "createEditFileTool", { enumerable: true, get: function() {
82154
82371
  return editFile_1.createEditFileTool;
82155
82372
  } });
82373
+ var deleteFile_1 = require_deleteFile();
82374
+ Object.defineProperty(exports2, "createDeleteFileTool", { enumerable: true, get: function() {
82375
+ return deleteFile_1.createDeleteFileTool;
82376
+ } });
82377
+ var listDir_1 = require_listDir();
82378
+ Object.defineProperty(exports2, "createListDirTool", { enumerable: true, get: function() {
82379
+ return listDir_1.createListDirTool;
82380
+ } });
82156
82381
  var submitPlanIteration_1 = require_submitPlanIteration();
82157
82382
  Object.defineProperty(exports2, "createSubmitPlanTool", { enumerable: true, get: function() {
82158
82383
  return submitPlanIteration_1.createSubmitIterationPlanTool;
@@ -82162,6 +82387,8 @@ var require_tools = __commonJS({
82162
82387
  TOOL_NAMES2["READ_FILE"] = "read_file";
82163
82388
  TOOL_NAMES2["CREATE_FILE"] = "create_file";
82164
82389
  TOOL_NAMES2["EDIT_FILE"] = "edit_file";
82390
+ TOOL_NAMES2["DELETE_FILE"] = "delete_file";
82391
+ TOOL_NAMES2["LIST_DIR"] = "list_dir";
82165
82392
  TOOL_NAMES2["GREP"] = "grep";
82166
82393
  TOOL_NAMES2["GLOB"] = "glob";
82167
82394
  })(TOOL_NAMES || (exports2.TOOL_NAMES = TOOL_NAMES = {}));
@@ -97139,7 +97366,7 @@ var require_WixMCPClient = __commonJS({
97139
97366
  command: "npx",
97140
97367
  args: [
97141
97368
  "-y",
97142
- "@wix/mcp",
97369
+ "@wix/mcp@1.0.22",
97143
97370
  "--experimental",
97144
97371
  "GET_TO_KNOW_WIX,WIX_API_THROUGH_FS"
97145
97372
  ]
@@ -98131,6 +98358,352 @@ ${srcFolderStructure}
98131
98358
  }
98132
98359
  });
98133
98360
 
98361
+ // dist/system-prompts/updateExtensionAgent/update-extension-agent-instructions.js
98362
+ var require_update_extension_agent_instructions = __commonJS({
98363
+ "dist/system-prompts/updateExtensionAgent/update-extension-agent-instructions.js"(exports2) {
98364
+ "use strict";
98365
+ Object.defineProperty(exports2, "__esModule", { value: true });
98366
+ exports2.updateExtensionAgentConstraints = exports2.updateExtensionAgentGuidelines = exports2.updateExtensionAgentWorkflow = exports2.updateExtensionAgentAvailableTools = exports2.updateExtensionAgentRole = void 0;
98367
+ exports2.updateExtensionAgentRole = `You are a specialized code editing agent for Wix CLI applications. Your job is to modify existing extension code based on user requests.
98368
+
98369
+ You may be given ONE or MULTIPLE extensions to edit. When editing multiple extensions, ensure your changes are coordinated and consistent across all of them.
98370
+
98371
+ You have access to tools that allow you to:
98372
+ - Read files to understand the current implementation
98373
+ - List directory contents to explore folder structure
98374
+ - Search for patterns using grep
98375
+ - Find files using glob patterns
98376
+ - Write changes to files
98377
+ - Delete files when removal is requested
98378
+
98379
+ You must understand the current code structure before making changes, and apply modifications carefully to fulfill the user's request across all specified extensions.`;
98380
+ exports2.updateExtensionAgentAvailableTools = `<tool name="read_file">
98381
+ Read the contents of a file. Use this to understand existing code before making changes.
98382
+ Output includes line numbers for reference.
98383
+ Parameters:
98384
+ - filePath: Relative path from project root (e.g., 'src/dashboard/pages/my-page/page.tsx')
98385
+ </tool>
98386
+
98387
+ <tool name="create_file">
98388
+ Create a NEW file with content. Use this only for files that don't exist yet.
98389
+ Will fail if the file already exists.
98390
+ Parameters:
98391
+ - filePath: Relative path from project root
98392
+ - content: The content for the new file
98393
+ </tool>
98394
+
98395
+ <tool name="delete_file">
98396
+ Delete a file or directory (like rm). Use recursive for non-empty directories (like rm -r).
98397
+ Parameters:
98398
+ - path: Relative path from project root to the file or directory
98399
+ - recursive: Optional boolean - if true, recursively delete directory contents (default: false)
98400
+ </tool>
98401
+
98402
+ <tool name="edit_file">
98403
+ Edit an existing file by applying one or more string replacements. Each edit's oldString must match EXACTLY.
98404
+ Use read_file first to see the exact content including whitespace/indentation.
98405
+ Edits are applied sequentially, so later edits can reference content created by earlier edits.
98406
+ Parameters:
98407
+ - filePath: Relative path from project root
98408
+ - edits: Array of edit operations, each containing:
98409
+ - oldString: The exact text to find and replace (must match exactly)
98410
+ - newString: The replacement text (can be empty to delete)
98411
+ - replaceAll: Optional boolean - if true, replace all occurrences (default: false)
98412
+ </tool>
98413
+
98414
+ <tool name="grep">
98415
+ Search for text patterns in files. Use this to find where specific code patterns exist.
98416
+ Parameters:
98417
+ - pattern: The regex pattern to search for
98418
+ - include: Optional glob pattern to filter files (e.g., '*.tsx')
98419
+ </tool>
98420
+
98421
+ <tool name="glob">
98422
+ Find files matching a pattern. Use this to discover file locations.
98423
+ Parameters:
98424
+ - pattern: Glob pattern to match (e.g., 'src/**/*.tsx')
98425
+ </tool>
98426
+
98427
+ <tool name="list_dir">
98428
+ List files and directories in a tree structure. Use this to explore and visualize folder hierarchy.
98429
+ Returns a tree view showing nested directories and files.
98430
+ Parameters:
98431
+ - dirPath: Relative path from project root to the directory (e.g., 'src/dashboard')
98432
+ </tool>`;
98433
+ exports2.updateExtensionAgentWorkflow = `1. UNDERSTAND: First, read the relevant files to understand the current implementation
98434
+ - Use list_dir to explore folder structure and understand project organization
98435
+ - Use glob to find files related to ALL extensions that need editing
98436
+ - Use read_file to examine the code structure of each extension
98437
+ - Use grep to find specific patterns across the codebase if needed
98438
+
98439
+ 2. PLAN: Identify what changes are needed to fulfill the user's request
98440
+ - Consider all files across all extensions that need modification
98441
+ - Ensure changes are consistent and coordinated across extensions
98442
+ - If extensions share data structures or APIs, plan changes holistically
98443
+
98444
+ 3. EXECUTE: Make the necessary changes
98445
+ - Use edit_file for modifying existing code - batch multiple edits to the same file in one call
98446
+ - Use create_file ONLY for new files that don't exist yet
98447
+ - Use delete_file to remove files or directories when the request involves deletion
98448
+ - Edit all extensions as needed to fulfill the request
98449
+ - Ensure changes in one extension are compatible with others
98450
+
98451
+ 4. COMPLETE: When all edits are done, respond with a brief summary of the changes made`;
98452
+ exports2.updateExtensionAgentGuidelines = `- Always read_file BEFORE editing to understand the current state and see exact content
98453
+ - Use edit_file for modifying existing code - batch multiple edits to the same file in one call
98454
+ - Each edit's oldString must match EXACTLY including whitespace and indentation
98455
+ - Use create_file ONLY for new files that don't exist yet
98456
+ - Use delete_file to remove files or directories - use recursive: true for non-empty directories
98457
+ - When deleting files, also remove related exports/imports
98458
+ - Preserve existing code style and formatting
98459
+ - Keep imports organized - add new imports near existing ones
98460
+ - Ensure TypeScript types are maintained correctly
98461
+ - Do NOT invent or assume new types, modules, functions, or imports
98462
+ - Use only entities explicitly present in the existing code or standard libraries
98463
+ - Make targeted, minimal edits - don't rewrite entire files unnecessarily`;
98464
+ exports2.updateExtensionAgentConstraints = `- You can ONLY modify files within the src/ folder
98465
+ - Delete files when the request explicitly asks for deletion (e.g., "delete", "remove", or similar)
98466
+ - Do NOT add new dependencies or imports that don't exist in the project
98467
+ - Maintain backward compatibility unless breaking changes are explicitly requested
98468
+ - Keep changes minimal and focused on the user's request`;
98469
+ }
98470
+ });
98471
+
98472
+ // dist/system-prompts/updateExtensionAgent/update-extension-agent-prompt.js
98473
+ var require_update_extension_agent_prompt = __commonJS({
98474
+ "dist/system-prompts/updateExtensionAgent/update-extension-agent-prompt.js"(exports2) {
98475
+ "use strict";
98476
+ Object.defineProperty(exports2, "__esModule", { value: true });
98477
+ exports2.updateExtensionAgentPrompt = void 0;
98478
+ var update_extension_agent_instructions_1 = require_update_extension_agent_instructions();
98479
+ var codegen_common_logic_1 = require_dist9();
98480
+ var AgentsRegistry_1 = require_AgentsRegistry();
98481
+ var api_1 = require_api2();
98482
+ var codegen_dashboard_agents_1 = require_dist11();
98483
+ function getExtensionSpecificPrompt(extensions) {
98484
+ const corePrompts = [];
98485
+ const allApiDocumentation = /* @__PURE__ */ new Set();
98486
+ for (const extension of extensions) {
98487
+ const agentCorePrompt = (0, AgentsRegistry_1.getAgentCoreSystemPrompt)(extension.type);
98488
+ const { apiDocumentation } = (0, api_1.extractApiDocumentation)(extension);
98489
+ if (apiDocumentation && apiDocumentation.length > 0) {
98490
+ allApiDocumentation.add(apiDocumentation);
98491
+ }
98492
+ corePrompts.push(agentCorePrompt);
98493
+ }
98494
+ return {
98495
+ extensionPrompts: corePrompts.join("\n\n"),
98496
+ apiDocumentation: Array.from(allApiDocumentation).join("\n\n")
98497
+ };
98498
+ }
98499
+ var updateExtensionAgentPrompt = ({ extensions, autoPatternsSectionIds }) => {
98500
+ const { extensionPrompts, apiDocumentation } = getExtensionSpecificPrompt(extensions);
98501
+ const systemPrompt = new codegen_common_logic_1.SystemPromptBuilder({
98502
+ agentType: codegen_common_logic_1.GeneralAgentType.UPDATE_EXTENSION_AGENT
98503
+ }).withRole(update_extension_agent_instructions_1.updateExtensionAgentRole).withSection("available_tools", update_extension_agent_instructions_1.updateExtensionAgentAvailableTools).withSection("workflow", update_extension_agent_instructions_1.updateExtensionAgentWorkflow).withSection("editing_guidelines", update_extension_agent_instructions_1.updateExtensionAgentGuidelines).withSection("extension_domain_knowledge", extensionPrompts).withSection("api_documentation", apiDocumentation).withSection("constraints", update_extension_agent_instructions_1.updateExtensionAgentConstraints);
98504
+ if (autoPatternsSectionIds && autoPatternsSectionIds.length > 0) {
98505
+ systemPrompt.withSection("auto_patterns_content", (0, codegen_dashboard_agents_1.getAutoPatternsContent)(autoPatternsSectionIds));
98506
+ }
98507
+ return systemPrompt.compose();
98508
+ };
98509
+ exports2.updateExtensionAgentPrompt = updateExtensionAgentPrompt;
98510
+ }
98511
+ });
98512
+
98513
+ // dist/agents/Iteration/UpdateExtensionAgent.js
98514
+ var require_UpdateExtensionAgent = __commonJS({
98515
+ "dist/agents/Iteration/UpdateExtensionAgent.js"(exports2) {
98516
+ "use strict";
98517
+ Object.defineProperty(exports2, "__esModule", { value: true });
98518
+ exports2.UpdateExtensionAgent = void 0;
98519
+ var ai_1 = require_dist8();
98520
+ var ditto_codegen_types_12 = require_dist();
98521
+ var constants_1 = require_constants();
98522
+ var customAnthropicProvider_1 = require_customAnthropicProvider();
98523
+ var tools_1 = require_tools();
98524
+ var update_extension_agent_prompt_1 = require_update_extension_agent_prompt();
98525
+ var contextBuilders_1 = require_contextBuilders();
98526
+ var userPrompt_1 = require_userPrompt();
98527
+ var codegen_dashboard_agents_1 = require_dist11();
98528
+ var codeGenerationService_12 = require_codeGenerationService();
98529
+ var types_1 = require_types_impl();
98530
+ var UpdateExtensionAgent = class {
98531
+ constructor() {
98532
+ this.name = "UpdateExtensionAgent";
98533
+ }
98534
+ shouldUseAutoPatterns(currentExtensions) {
98535
+ const dashboardPagesExtensions = currentExtensions.filter((extension) => extension.extension.type === types_1.ExtensionType.DASHBOARD_PAGE);
98536
+ if (dashboardPagesExtensions.length === 0) {
98537
+ return false;
98538
+ }
98539
+ const hasPatterns = dashboardPagesExtensions.find((extension) => extension.paths.some((path4) => path4.includes("patterns.json")));
98540
+ return Boolean(hasPatterns);
98541
+ }
98542
+ async getAutoPatternsSectionIds(useAutoPatterns, userRequestSummary) {
98543
+ if (!useAutoPatterns) {
98544
+ return void 0;
98545
+ }
98546
+ const autoPatternsDocSelector = new codegen_dashboard_agents_1.AutoPatternsContextAgent({
98547
+ aiService: codeGenerationService_12.codegenAIProxyService,
98548
+ provider: constants_1.LLM_PROVIDERS.ANTHROPIC,
98549
+ model: constants_1.LLM_MODELS.CLAUDE_HAIKU_4_5,
98550
+ buildSystemPrompt: codegen_dashboard_agents_1.autoPatternsContextPrompt
98551
+ });
98552
+ const result = await autoPatternsDocSelector.generate(userRequestSummary);
98553
+ return result.selectedSectionIds;
98554
+ }
98555
+ extractModifiedFilesFromToolCalls(toolCalls) {
98556
+ const filesMap = /* @__PURE__ */ new Map();
98557
+ for (const call of toolCalls) {
98558
+ const input = call.input;
98559
+ if (!input)
98560
+ continue;
98561
+ const filePath = input.filePath ?? input.path;
98562
+ if (!filePath)
98563
+ continue;
98564
+ switch (call.toolName) {
98565
+ case tools_1.TOOL_NAMES.CREATE_FILE: {
98566
+ const { content } = call.input;
98567
+ filesMap.set(filePath, {
98568
+ operation: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT,
98569
+ path: filePath,
98570
+ content: content || ""
98571
+ });
98572
+ break;
98573
+ }
98574
+ case tools_1.TOOL_NAMES.EDIT_FILE: {
98575
+ const { edits } = call.input;
98576
+ const newReplacements = edits.map(({ oldString, newString, replaceAll }) => ({
98577
+ oldString,
98578
+ newString,
98579
+ replaceAll
98580
+ }));
98581
+ const existing = filesMap.get(filePath);
98582
+ if (existing?.operation === ditto_codegen_types_12.ExtensionGenerationOperation.EDIT) {
98583
+ existing.replacements.push(...newReplacements);
98584
+ } else {
98585
+ filesMap.set(filePath, {
98586
+ operation: ditto_codegen_types_12.ExtensionGenerationOperation.EDIT,
98587
+ path: filePath,
98588
+ replacements: newReplacements
98589
+ });
98590
+ }
98591
+ break;
98592
+ }
98593
+ case tools_1.TOOL_NAMES.DELETE_FILE: {
98594
+ filesMap.set(filePath, {
98595
+ operation: ditto_codegen_types_12.ExtensionGenerationOperation.DELETE,
98596
+ path: filePath
98597
+ });
98598
+ break;
98599
+ }
98600
+ }
98601
+ }
98602
+ return [...filesMap.values()];
98603
+ }
98604
+ buildUserPrompt({ currentExtensions, userRequestSummary, srcFolderStructure, plan, previousResources }) {
98605
+ const sections = [
98606
+ `## User Request
98607
+
98608
+ ${userRequestSummary}`,
98609
+ (0, contextBuilders_1.formatExtensionsToEdit)(currentExtensions)
98610
+ ];
98611
+ if (srcFolderStructure) {
98612
+ sections.push(`## Project Structure
98613
+
98614
+ \`\`\`
98615
+ ${srcFolderStructure}
98616
+ \`\`\``);
98617
+ }
98618
+ const existingCollections = (0, userPrompt_1.formatExistingCollections)(previousResources?.collections ?? []);
98619
+ if (existingCollections) {
98620
+ sections.push(existingCollections);
98621
+ }
98622
+ if (plan?.collections && plan.collections.length > 0) {
98623
+ sections.push((0, userPrompt_1.formatCollections)(plan.collections));
98624
+ }
98625
+ const existingParams = (0, userPrompt_1.formatExistingEmbeddedScriptParameters)(previousResources?.embeddedScriptParameters ?? []);
98626
+ if (existingParams) {
98627
+ sections.push(existingParams);
98628
+ }
98629
+ if (plan?.embeddedScriptParameters && plan.embeddedScriptParameters.length > 0) {
98630
+ sections.push((0, userPrompt_1.formatEmbeddedScriptParameters)(plan.embeddedScriptParameters));
98631
+ }
98632
+ return sections.join("\n\n");
98633
+ }
98634
+ async generate(params) {
98635
+ const { currentExtensions, outputPath, userRequestSummary, plan, previousResources } = params;
98636
+ if (currentExtensions.length === 0) {
98637
+ return {
98638
+ filesModified: []
98639
+ };
98640
+ }
98641
+ const srcFolderStructure = (0, contextBuilders_1.generateSrcFolderStructure)(outputPath);
98642
+ const extensions = currentExtensions.map((ext) => ext.extension);
98643
+ const useAutoPatterns = this.shouldUseAutoPatterns(currentExtensions);
98644
+ const autoPatternsSectionIds = await this.getAutoPatternsSectionIds(useAutoPatterns, userRequestSummary);
98645
+ const systemPrompt = (0, update_extension_agent_prompt_1.updateExtensionAgentPrompt)({
98646
+ extensions,
98647
+ autoPatternsSectionIds
98648
+ });
98649
+ const userMessage = this.buildUserPrompt({
98650
+ currentExtensions,
98651
+ userRequestSummary,
98652
+ srcFolderStructure,
98653
+ plan,
98654
+ previousResources
98655
+ });
98656
+ try {
98657
+ const model = (0, customAnthropicProvider_1.createCustomTextModel)()(constants_1.LLM_MODELS.CLAUDE_SONNET_4_5_20250929, {
98658
+ agentName: this.name
98659
+ });
98660
+ const MAX_STEPS = 50;
98661
+ const result = await (0, ai_1.generateText)({
98662
+ model,
98663
+ tools: {
98664
+ [tools_1.TOOL_NAMES.READ_FILE]: (0, tools_1.createReadFileTool)(outputPath),
98665
+ [tools_1.TOOL_NAMES.CREATE_FILE]: (0, tools_1.createCreateFileTool)(outputPath),
98666
+ [tools_1.TOOL_NAMES.EDIT_FILE]: (0, tools_1.createEditFileTool)(outputPath),
98667
+ [tools_1.TOOL_NAMES.DELETE_FILE]: (0, tools_1.createDeleteFileTool)(outputPath),
98668
+ [tools_1.TOOL_NAMES.LIST_DIR]: (0, tools_1.createListDirTool)(outputPath),
98669
+ [tools_1.TOOL_NAMES.GREP]: (0, tools_1.createGrepTool)(outputPath),
98670
+ [tools_1.TOOL_NAMES.GLOB]: (0, tools_1.createGlobTool)(outputPath)
98671
+ },
98672
+ stopWhen: ({ steps }) => {
98673
+ if (steps.length >= MAX_STEPS) {
98674
+ return true;
98675
+ }
98676
+ const lastStep = steps[steps.length - 1];
98677
+ return lastStep?.toolCalls.length === 0;
98678
+ },
98679
+ messages: [
98680
+ {
98681
+ role: "system",
98682
+ content: systemPrompt,
98683
+ providerOptions: (0, ditto_codegen_types_12.withCaching)("1h")
98684
+ },
98685
+ { role: "user", content: userMessage }
98686
+ ],
98687
+ maxRetries: 3,
98688
+ temperature: 0,
98689
+ experimental_telemetry: { isEnabled: true, functionId: this.name }
98690
+ });
98691
+ const allToolCalls = result.steps.flatMap((step) => step.toolCalls);
98692
+ const filesModified = this.extractModifiedFilesFromToolCalls(allToolCalls);
98693
+ const summary = result.text;
98694
+ console.log("UpdateExtensionAgent result:", JSON.stringify({ summary, filesModified }, null, 2));
98695
+ return {
98696
+ filesModified
98697
+ };
98698
+ } catch (error) {
98699
+ throw (0, ditto_codegen_types_12.toCodegenError)(error);
98700
+ }
98701
+ }
98702
+ };
98703
+ exports2.UpdateExtensionAgent = UpdateExtensionAgent;
98704
+ }
98705
+ });
98706
+
98134
98707
  // dist/agents/AgentsFactory.js
98135
98708
  var require_AgentsFactory = __commonJS({
98136
98709
  "dist/agents/AgentsFactory.js"(exports2) {
@@ -98146,6 +98719,7 @@ var require_AgentsFactory = __commonJS({
98146
98719
  var ditto_codegen_types_12 = require_dist();
98147
98720
  var SDKPickerAgent_1 = require_SDKPickerAgent2();
98148
98721
  var ExtensionIndexerAgent_1 = require_ExtensionIndexerAgent();
98722
+ var UpdateExtensionAgent_1 = require_UpdateExtensionAgent();
98149
98723
  var AgentsFactory = class {
98150
98724
  constructor(useIteration = false) {
98151
98725
  this.useIteration = useIteration;
@@ -98177,6 +98751,8 @@ var require_AgentsFactory = __commonJS({
98177
98751
  return new AutoPatternsGenerator_1.AutoPatternsGenerator();
98178
98752
  case "SDK_PICKER":
98179
98753
  return new SDKPickerAgent_1.SDKPickerAgent();
98754
+ case "UPDATE_EXTENSION_AGENT":
98755
+ return new UpdateExtensionAgent_1.UpdateExtensionAgent();
98180
98756
  case "EXTENSION_INDEXER":
98181
98757
  return new ExtensionIndexerAgent_1.ExtensionIndexerAgent();
98182
98758
  default:
@@ -98223,6 +98799,15 @@ var require_cli_listeners = __commonJS({
98223
98799
  timer.delete(name);
98224
98800
  console.log(`\u{1F916}\u2714\uFE0F Generated ${extId(extension)} (${name}) \u2192 ${files.map((f) => f.path).join(", ")} in ${duration / 1e3}s`);
98225
98801
  });
98802
+ eventEmitter.onEvent("updateExtensionAgent:start", () => {
98803
+ timer.set("UpdateExtensionAgent", Date.now());
98804
+ console.log(`\u{1F916} Iterating existing code (UpdateExtensionAgent)...`);
98805
+ });
98806
+ eventEmitter.onEvent("updateExtensionAgent:done", ({ files }) => {
98807
+ const duration = Date.now() - timer.get("UpdateExtensionAgent");
98808
+ timer.delete("UpdateExtensionAgent");
98809
+ console.log(`\u{1F916}\u2714\uFE0F Iterated existing code (UpdateExtensionAgent) \u2192 ${files.length} files in ${duration / 1e3}s`);
98810
+ });
98226
98811
  eventEmitter.onEvent("planner:start", () => {
98227
98812
  timer.set("PlannerAgent", Date.now());
98228
98813
  console.log("\u{1F916} Generating plan...");
@@ -101639,11 +102224,8 @@ var require_extensionProcessors = __commonJS({
101639
102224
  "use strict";
101640
102225
  Object.defineProperty(exports2, "__esModule", { value: true });
101641
102226
  exports2.processStandardExtension = processStandardExtension;
101642
- exports2.processExistingExtension = processExistingExtension;
101643
- var types_1 = require_types_impl();
101644
102227
  var finalize_extension_generation_1 = require_finalize_extension_generation();
101645
102228
  var create_scaffolding_1 = require_create_scaffolding();
101646
- var write_file_1 = require_write_file();
101647
102229
  async function processStandardExtension(params) {
101648
102230
  const { extension, outputPath, plan, agentsFactory, eventEmitter, blueprint, userRequestSummary, previousResources } = params;
101649
102231
  const scaffolds = await (0, create_scaffolding_1.createScaffolding)(extension, outputPath, eventEmitter);
@@ -101670,47 +102252,6 @@ var require_extensionProcessors = __commonJS({
101670
102252
  outputPath
101671
102253
  }, eventEmitter);
101672
102254
  }
101673
- async function processExistingExtension(params) {
101674
- const { extension, outputPath, plan, agentsFactory, eventEmitter, userRequestSummary, relevantFilePaths, previousResources } = params;
101675
- if (extension.type === types_1.ExtensionType.EMBEDDED_SCRIPT) {
101676
- const embeddedScriptAgent = agentsFactory.getAgent(extension);
101677
- eventEmitter.emitEvent("agent:start", {
101678
- extension,
101679
- name: embeddedScriptAgent.name
101680
- });
101681
- const result = await embeddedScriptAgent.generate({
101682
- extension,
101683
- userRequestSummary,
101684
- relevantFilePaths,
101685
- basePath: outputPath,
101686
- plan,
101687
- ...previousResources && { previousResources }
101688
- });
101689
- (0, write_file_1.writeFile)(result.files, outputPath);
101690
- eventEmitter.emitEvent("agent:done", {
101691
- extension,
101692
- name: embeddedScriptAgent.name,
101693
- files: result.files
101694
- });
101695
- } else {
101696
- const agent = agentsFactory.getAgent(extension);
101697
- eventEmitter.emitEvent("agent:start", { extension, name: agent.name });
101698
- const files = await agent.generate({
101699
- extension,
101700
- userRequestSummary,
101701
- relevantFilePaths,
101702
- basePath: outputPath,
101703
- plan,
101704
- ...previousResources && { previousResources }
101705
- });
101706
- (0, write_file_1.writeFile)(files, outputPath);
101707
- eventEmitter.emitEvent("agent:done", {
101708
- extension,
101709
- name: agent.name,
101710
- files
101711
- });
101712
- }
101713
- }
101714
102255
  }
101715
102256
  });
101716
102257
 
@@ -108367,6 +108908,28 @@ var require_codegen_flow_helpers = __commonJS({
108367
108908
  error: (0, utils_1.serializeError)(error)
108368
108909
  });
108369
108910
  });
108911
+ const updateExtensionAgentTaskId = `${jobContext.taskId}-update-extension-agent`;
108912
+ eventEmitter.onEvent("updateExtensionAgent:start", () => {
108913
+ console.log(`[Agent] start: iterating existing code`);
108914
+ codeGenerationService_12.codeGenerationService.addTask(jobContext.jobId, {
108915
+ id: updateExtensionAgentTaskId,
108916
+ kind: ditto_codegen_types_12.TaskKind.RUN_AGENT,
108917
+ status: ditto_codegen_types_12.Status.RUNNING,
108918
+ name: "run_agent",
108919
+ description: "Iterating existing code",
108920
+ agentName: "UpdateExtensionAgent"
108921
+ });
108922
+ });
108923
+ eventEmitter.onEvent("updateExtensionAgent:done", ({ files }) => {
108924
+ console.log(`[Agent] done: iterating existing code`);
108925
+ codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, updateExtensionAgentTaskId, ditto_codegen_types_12.Status.COMPLETED, { taskOutput: { files } });
108926
+ });
108927
+ eventEmitter.onEvent("updateExtensionAgent:error", async ({ error }) => {
108928
+ console.error(`[Agent] error: iterating existing code`, error);
108929
+ await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, updateExtensionAgentTaskId, ditto_codegen_types_12.Status.FAILED, {
108930
+ error: (0, utils_1.serializeError)(error)
108931
+ });
108932
+ });
108370
108933
  }
108371
108934
  async function updateJobPayload(jobContext, payload) {
108372
108935
  await codeGenerationService_12.codeGenerationService.updateJob(jobContext.jobId, payload);
@@ -322284,26 +322847,20 @@ var require_IterationOrchestrator = __commonJS({
322284
322847
  };
322285
322848
  const parallelTasks = [];
322286
322849
  if (iterationPlan?.currentExtensions && iterationPlan.currentExtensions.length > 0) {
322287
- parallelTasks.push(...iterationPlan.currentExtensions.map((currentExtension) => {
322288
- return this.processIterationExtension({
322289
- extension: currentExtension.extension,
322290
- paths: currentExtension.paths,
322291
- relevantUserRequest: iterationPlan.summary,
322292
- outputPath,
322293
- newExtension: false,
322294
- plan: processedPlan,
322295
- previousResources: previousResourcesForAgents
322296
- }).catch((0, orchestrator_error_helpers_1.createExtensionErrorHandler)(this, currentExtension.extension));
322850
+ parallelTasks.push(this.processExistingExtensions({
322851
+ currentExtensions: iterationPlan.currentExtensions,
322852
+ userRequestSummary: iterationPlan.summary,
322853
+ outputPath,
322854
+ plan: processedPlan,
322855
+ previousResources: previousResourcesForAgents
322297
322856
  }));
322298
322857
  }
322299
322858
  if (iterationPlan?.additionalExtensions && iterationPlan?.additionalExtensions.length > 0) {
322300
322859
  parallelTasks.push(...iterationPlan.additionalExtensions.map((additionalExtension) => {
322301
322860
  return this.processIterationExtension({
322302
322861
  extension: additionalExtension.extension,
322303
- paths: [],
322304
322862
  relevantUserRequest: iterationPlan.summary,
322305
322863
  outputPath,
322306
- newExtension: true,
322307
322864
  plan: processedPlan,
322308
322865
  previousResources: previousResourcesForAgents
322309
322866
  }).catch((0, orchestrator_error_helpers_1.createExtensionErrorHandler)(this, additionalExtension.extension));
@@ -322332,6 +322889,29 @@ var require_IterationOrchestrator = __commonJS({
322332
322889
  this.emitEvent("finish:iteration", { outputPath, durationMs });
322333
322890
  return iterationPlan;
322334
322891
  }
322892
+ async processExistingExtensions({ currentExtensions, userRequestSummary, outputPath, plan, previousResources }) {
322893
+ this.emitEvent("updateExtensionAgent:start", {});
322894
+ try {
322895
+ const updateExtensionAgent = this.agentsFactory.getAgent({
322896
+ type: "UPDATE_EXTENSION_AGENT"
322897
+ });
322898
+ const result = await updateExtensionAgent.generate({
322899
+ currentExtensions,
322900
+ outputPath,
322901
+ userRequestSummary,
322902
+ plan,
322903
+ previousResources
322904
+ });
322905
+ this.emitEvent("updateExtensionAgent:done", {
322906
+ files: result.filesModified
322907
+ });
322908
+ } catch (error) {
322909
+ this.emitEvent("updateExtensionAgent:error", {
322910
+ error: error instanceof Error ? error : new Error(String(error))
322911
+ });
322912
+ throw error;
322913
+ }
322914
+ }
322335
322915
  /**
322336
322916
  * Run iteration planning to determine which extensions to create/update
322337
322917
  */
@@ -322390,74 +322970,61 @@ var require_IterationOrchestrator = __commonJS({
322390
322970
  /**
322391
322971
  * Process an extension during iteration
322392
322972
  */
322393
- async processIterationExtension({ extension, paths, relevantUserRequest, outputPath, newExtension, plan, previousResources }) {
322394
- if (newExtension) {
322395
- switch (extension.type) {
322396
- case types_1.ExtensionType.EMBEDDED_SCRIPT:
322397
- return (0, embeddedScript_1.processEmbeddedScriptExtension)({
322398
- extension,
322399
- outputPath,
322400
- plan,
322401
- agentsFactory: this.agentsFactory,
322402
- eventEmitter: this,
322403
- userRequestSummary: relevantUserRequest,
322404
- previousResources
322405
- });
322406
- case types_1.ExtensionType.SERVICE_PLUGIN:
322407
- return (0, servicePlugin_1.processServicePluginExtension)({
322408
- extension,
322409
- outputPath,
322410
- plan,
322411
- agentsFactory: this.agentsFactory,
322412
- eventEmitter: this,
322413
- userRequestSummary: relevantUserRequest,
322414
- previousResources
322415
- });
322416
- case types_1.ExtensionType.DASHBOARD_PAGE:
322417
- return (0, dashboardPage_1.processDashboardPage)({
322418
- extension,
322419
- outputPath,
322420
- plan,
322421
- agentsFactory: this.agentsFactory,
322422
- eventEmitter: this,
322423
- userRequestSummary: relevantUserRequest,
322424
- previousResources
322425
- });
322426
- case types_1.ExtensionType.BACKEND_API:
322427
- return (0, backendApi_1.processBackendApiExtension)({
322428
- extension,
322429
- outputPath,
322430
- plan,
322431
- agentsFactory: this.agentsFactory,
322432
- eventEmitter: this,
322433
- userRequestSummary: relevantUserRequest,
322434
- previousResources
322435
- });
322436
- case types_1.ExtensionType.BACKEND_EVENT:
322437
- case types_1.ExtensionType.SITE_COMPONENT:
322438
- case types_1.ExtensionType.SITE_WIDGET:
322439
- default:
322440
- return (0, extensionProcessors_1.processStandardExtension)({
322441
- extension,
322442
- outputPath,
322443
- plan,
322444
- agentsFactory: this.agentsFactory,
322445
- eventEmitter: this,
322446
- userRequestSummary: relevantUserRequest,
322447
- previousResources
322448
- });
322449
- }
322450
- } else {
322451
- return (0, extensionProcessors_1.processExistingExtension)({
322452
- extension,
322453
- outputPath,
322454
- plan,
322455
- agentsFactory: this.agentsFactory,
322456
- eventEmitter: this,
322457
- userRequestSummary: relevantUserRequest,
322458
- relevantFilePaths: paths,
322459
- previousResources
322460
- });
322973
+ async processIterationExtension({ extension, relevantUserRequest, outputPath, plan, previousResources }) {
322974
+ switch (extension.type) {
322975
+ case types_1.ExtensionType.EMBEDDED_SCRIPT:
322976
+ return (0, embeddedScript_1.processEmbeddedScriptExtension)({
322977
+ extension,
322978
+ outputPath,
322979
+ plan,
322980
+ agentsFactory: this.agentsFactory,
322981
+ eventEmitter: this,
322982
+ userRequestSummary: relevantUserRequest,
322983
+ previousResources
322984
+ });
322985
+ case types_1.ExtensionType.SERVICE_PLUGIN:
322986
+ return (0, servicePlugin_1.processServicePluginExtension)({
322987
+ extension,
322988
+ outputPath,
322989
+ plan,
322990
+ agentsFactory: this.agentsFactory,
322991
+ eventEmitter: this,
322992
+ userRequestSummary: relevantUserRequest,
322993
+ previousResources
322994
+ });
322995
+ case types_1.ExtensionType.DASHBOARD_PAGE:
322996
+ return (0, dashboardPage_1.processDashboardPage)({
322997
+ extension,
322998
+ outputPath,
322999
+ plan,
323000
+ agentsFactory: this.agentsFactory,
323001
+ eventEmitter: this,
323002
+ userRequestSummary: relevantUserRequest,
323003
+ previousResources
323004
+ });
323005
+ case types_1.ExtensionType.BACKEND_API:
323006
+ return (0, backendApi_1.processBackendApiExtension)({
323007
+ extension,
323008
+ outputPath,
323009
+ plan,
323010
+ agentsFactory: this.agentsFactory,
323011
+ eventEmitter: this,
323012
+ userRequestSummary: relevantUserRequest,
323013
+ previousResources
323014
+ });
323015
+ case types_1.ExtensionType.BACKEND_EVENT:
323016
+ case types_1.ExtensionType.SITE_COMPONENT:
323017
+ case types_1.ExtensionType.SITE_WIDGET:
323018
+ default:
323019
+ return (0, extensionProcessors_1.processStandardExtension)({
323020
+ extension,
323021
+ outputPath,
323022
+ plan,
323023
+ agentsFactory: this.agentsFactory,
323024
+ eventEmitter: this,
323025
+ userRequestSummary: relevantUserRequest,
323026
+ previousResources
323027
+ });
322461
323028
  }
322462
323029
  }
322463
323030
  };