@wix/ditto-codegen-public 1.0.190 → 1.0.192

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 +61 -3
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -36576,6 +36576,7 @@ var require_CodegenAIProxyService = __commonJS({
36576
36576
  isEnabled: true,
36577
36577
  functionId: payload.agentName
36578
36578
  },
36579
+ ...payload.experimental_repairText ? { experimental_repairText: payload.experimental_repairText } : {},
36579
36580
  maxOutputTokens: 1e4,
36580
36581
  maxRetries: 3,
36581
36582
  temperature: 0
@@ -71547,8 +71548,13 @@ To modify a file, you can either use the 'edit' operation to replace a specific
71547
71548
  var require_DashboardPageAgent2 = __commonJS({
71548
71549
  "dist/agents/DashboardPageAgent.js"(exports2) {
71549
71550
  "use strict";
71551
+ var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
71552
+ return mod && mod.__esModule ? mod : { "default": mod };
71553
+ };
71550
71554
  Object.defineProperty(exports2, "__esModule", { value: true });
71551
71555
  exports2.DashboardPageAgent = void 0;
71556
+ var fs_1 = __importDefault2(require("fs"));
71557
+ var path_1 = __importDefault2(require("path"));
71552
71558
  var dashboard_page_prompt_1 = require_dashboard_page_prompt();
71553
71559
  var api_1 = require_api2();
71554
71560
  var prompt_selectors_1 = require_prompt_selectors();
@@ -71591,6 +71597,24 @@ var require_DashboardPageAgent2 = __commonJS({
71591
71597
  const result = await autoPatternsDocSelector.generate(userRequestSummary);
71592
71598
  return result.selectedSectionIds;
71593
71599
  }
71600
+ // temporary fix to add all files in the auto patterns directory as relevant files
71601
+ addAutoPatternsRelevantFiles(params) {
71602
+ const relevantFilePaths = params.relevantFilePaths ?? [];
71603
+ const patternsJsonPath = relevantFilePaths.find((p) => p.endsWith("patterns.json"));
71604
+ if (patternsJsonPath) {
71605
+ const patternsDir = path_1.default.dirname(patternsJsonPath);
71606
+ const absoluteDir = path_1.default.join(params.basePath, patternsDir);
71607
+ try {
71608
+ 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));
71609
+ const newPaths = filesInDir.filter((filePath) => !relevantFilePaths.includes(filePath));
71610
+ if (newPaths.length > 0) {
71611
+ params.relevantFilePaths = [...relevantFilePaths, ...newPaths];
71612
+ }
71613
+ } catch {
71614
+ console.error(`Error reading auto patterns directory: ${absoluteDir}`);
71615
+ }
71616
+ }
71617
+ }
71594
71618
  async generate(params) {
71595
71619
  const { blueprint, plan, userRequestSummary } = params;
71596
71620
  const useData = (0, prompt_selectors_1.shouldUseDataPrompt)(params);
@@ -71598,6 +71622,9 @@ var require_DashboardPageAgent2 = __commonJS({
71598
71622
  const useApiSpec = Boolean(plan?.apiSpec);
71599
71623
  const useDynamicParameters = (0, prompt_selectors_1.shouldUseDynamicParametersPrompt)(params);
71600
71624
  const autoPatternsSectionIds = await this.getAutoPatternsSectionIds(useAutoPatterns, userRequestSummary);
71625
+ if (useAutoPatterns) {
71626
+ this.addAutoPatternsRelevantFiles(params);
71627
+ }
71601
71628
  const apiNames = (0, api_1.extractApiNames)(params.extension);
71602
71629
  const systemPrompt = await this.buildSystemPrompt(useData, useAutoPatterns, useApiSpec, useDynamicParameters, apiNames, autoPatternsSectionIds);
71603
71630
  const appName = blueprint?.appName ? `'${blueprint.appName}'` : "";
@@ -72960,6 +72987,7 @@ var require_IterationAgent = __commonJS({
72960
72987
  Object.defineProperty(exports2, "__esModule", { value: true });
72961
72988
  exports2.IterationAgent = void 0;
72962
72989
  var zod_1 = require_zod();
72990
+ var ai_1 = require_dist8();
72963
72991
  var iteration_agent_prompt_1 = require_iteration_agent_prompt();
72964
72992
  var AgentsRegistry_1 = require_AgentsRegistry();
72965
72993
  var codegen_common_logic_1 = require_dist9();
@@ -72968,16 +72996,17 @@ var require_IterationAgent = __commonJS({
72968
72996
  var codeGenerationService_12 = require_codeGenerationService();
72969
72997
  var extensionFormatters_1 = require_extensionFormatters();
72970
72998
  var contextBuilders_1 = require_contextBuilders();
72999
+ var MAX_NAME_LENGTH = 30;
72971
73000
  var CurrentExtensionSchema = zod_1.z.object({
72972
73001
  extensionType: zod_1.z.enum(codegen_common_logic_1.codeGenerationExtensionTypes).describe("The extension kind to trigger"),
72973
- name: zod_1.z.string().min(2).describe("Short, human-readable name for the extension. Less than 30 chars."),
73002
+ name: zod_1.z.string().min(2).max(MAX_NAME_LENGTH).describe(`Short, human-readable name for the extension. Less than ${MAX_NAME_LENGTH} chars.`),
72974
73003
  relatedSpis: zod_1.z.array(zod_1.z.string()).optional().describe("Optional value, only for SPI extensions - specify the SPI types"),
72975
73004
  paths: zod_1.z.array(zod_1.z.string()).describe("Paths relevant for this extension"),
72976
73005
  relevantUserRequest: zod_1.z.string().describe("What part of the user request this extension should do, do not reference other extensions.")
72977
73006
  });
72978
73007
  var AdditionalExtensionSchema = zod_1.z.object({
72979
73008
  extensionType: zod_1.z.enum(codegen_common_logic_1.codeGenerationExtensionTypes).describe("The extension kind to add"),
72980
- name: zod_1.z.string().min(2).max(30).describe("Short, human-readable name for the extension. Less than 30 chars."),
73009
+ name: zod_1.z.string().min(2).max(MAX_NAME_LENGTH).describe(`Short, human-readable name for the extension. Less than ${MAX_NAME_LENGTH} chars.`),
72981
73010
  relatedSpis: zod_1.z.array(zod_1.z.string()).optional().describe("Optional value, only for SPI extensions - specify the SPI types"),
72982
73011
  relevantUserRequest: zod_1.z.string().describe("What part of the user request this extension should do, do not reference other extensions.")
72983
73012
  });
@@ -73014,6 +73043,34 @@ var require_IterationAgent = __commonJS({
73014
73043
  })) || []
73015
73044
  };
73016
73045
  }
73046
+ async repairNameTooLong({ text, error }) {
73047
+ if (!ai_1.TypeValidationError.isInstance(error)) {
73048
+ return text;
73049
+ }
73050
+ const cause = error.cause;
73051
+ const hasNameTooLongIssue = cause?.issues?.some((issue) => issue.code === "too_big" && issue.path?.at(-1) === "name");
73052
+ if (!hasNameTooLongIssue) {
73053
+ return text;
73054
+ }
73055
+ const parsed = JSON.parse(text);
73056
+ const hasCurrentExtensionsIssue = parsed.currentExtensions && cause?.issues?.some((issue) => issue.path?.includes("currentExtensions"));
73057
+ const hasAdditionalExtensionsIssue = parsed.additionalExtensions && cause?.issues?.some((issue) => issue.path?.includes("additionalExtensions"));
73058
+ if (hasCurrentExtensionsIssue) {
73059
+ for (const ext of parsed.currentExtensions) {
73060
+ if (ext.name && ext.name.length > MAX_NAME_LENGTH) {
73061
+ ext.name = ext.name.slice(0, MAX_NAME_LENGTH);
73062
+ }
73063
+ }
73064
+ }
73065
+ if (hasAdditionalExtensionsIssue) {
73066
+ for (const ext of parsed.additionalExtensions) {
73067
+ if (ext.name && ext.name.length > MAX_NAME_LENGTH) {
73068
+ ext.name = ext.name.slice(0, MAX_NAME_LENGTH);
73069
+ }
73070
+ }
73071
+ }
73072
+ return JSON.stringify(parsed);
73073
+ }
73017
73074
  buildUserPrompt({ chatHistory, currentUserRequest, previousResources, extensionSelectorResult }) {
73018
73075
  const sections = (0, contextBuilders_1.buildContextSections)(chatHistory, currentUserRequest, previousResources);
73019
73076
  sections.push(`
@@ -73037,7 +73094,8 @@ ${(0, extensionFormatters_1.formatContextExtensions)(extensionSelectorResult.con
73037
73094
  provider: constants_1.LLM_PROVIDERS.ANTHROPIC,
73038
73095
  model: constants_1.LLM_MODELS.CLAUDE_3_5_HAIKU_LATEST,
73039
73096
  schema: IterationPlanSchema,
73040
- agentName: this.name
73097
+ agentName: this.name,
73098
+ experimental_repairText: this.repairNameTooLong
73041
73099
  });
73042
73100
  const resultObject = {
73043
73101
  currentExtensions: result.object.currentExtensions.map((ext) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.190",
3
+ "version": "1.0.192",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -24,5 +24,5 @@
24
24
  "@wix/ditto-codegen": "1.0.0",
25
25
  "esbuild": "^0.25.9"
26
26
  },
27
- "falconPackageHash": "d79ae87ab10ef8b0861bc38ae03f70e3b0e247fd1f25cae734c0ad1d"
27
+ "falconPackageHash": "63e456b352799d738ee7c3c7beebe3b1adb2c0db877a801ef24a15f4"
28
28
  }