@wix/ditto-codegen-public 1.0.210 → 1.0.211
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/out.js +81 -21
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -39046,6 +39046,35 @@ var require_generate_text_helpers = __commonJS({
|
|
|
39046
39046
|
}
|
|
39047
39047
|
});
|
|
39048
39048
|
|
|
39049
|
+
// ../codegen-common-logic/dist/extension-type-documentation.js
|
|
39050
|
+
var require_extension_type_documentation = __commonJS({
|
|
39051
|
+
"../codegen-common-logic/dist/extension-type-documentation.js"(exports2) {
|
|
39052
|
+
"use strict";
|
|
39053
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
39054
|
+
exports2.getExtensionTypeDocumentation = getExtensionTypeDocumentation;
|
|
39055
|
+
var types_1 = require_types_impl();
|
|
39056
|
+
var DashboardPageAgent_1 = require_DashboardPageAgent();
|
|
39057
|
+
var SiteComponentAgent_1 = require_SiteComponentAgent();
|
|
39058
|
+
var CustomElementAgent_1 = require_CustomElementAgent();
|
|
39059
|
+
var SPIAgent_1 = require_SPIAgent();
|
|
39060
|
+
var BackendEventAgent_1 = require_BackendEventAgent();
|
|
39061
|
+
var BackendApiAgent_1 = require_BackendApiAgent();
|
|
39062
|
+
var EmbeddedScriptAgent_1 = require_EmbeddedScriptAgent();
|
|
39063
|
+
var EXTENSION_TYPE_TO_DOCUMENTATION = {
|
|
39064
|
+
[types_1.ExtensionType.DASHBOARD_PAGE]: DashboardPageAgent_1.getDashboardPageAgentDocumentation,
|
|
39065
|
+
[types_1.ExtensionType.SITE_COMPONENT]: SiteComponentAgent_1.getSiteComponentAgentDocumentation,
|
|
39066
|
+
[types_1.ExtensionType.SITE_WIDGET]: CustomElementAgent_1.getCustomElementAgentDocumentation,
|
|
39067
|
+
[types_1.ExtensionType.SERVICE_PLUGIN]: SPIAgent_1.getSPIAgentDocumentation,
|
|
39068
|
+
[types_1.ExtensionType.BACKEND_EVENT]: BackendEventAgent_1.getBackendEventAgentDocumentation,
|
|
39069
|
+
[types_1.ExtensionType.BACKEND_API]: BackendApiAgent_1.getBackendApiAgentDocumentation,
|
|
39070
|
+
[types_1.ExtensionType.EMBEDDED_SCRIPT]: EmbeddedScriptAgent_1.getEmbeddedScriptAgentDocumentation
|
|
39071
|
+
};
|
|
39072
|
+
function getExtensionTypeDocumentation(type) {
|
|
39073
|
+
return EXTENSION_TYPE_TO_DOCUMENTATION[type]();
|
|
39074
|
+
}
|
|
39075
|
+
}
|
|
39076
|
+
});
|
|
39077
|
+
|
|
39049
39078
|
// ../codegen-common-logic/dist/index.js
|
|
39050
39079
|
var require_dist9 = __commonJS({
|
|
39051
39080
|
"../codegen-common-logic/dist/index.js"(exports2) {
|
|
@@ -39086,6 +39115,7 @@ var require_dist9 = __commonJS({
|
|
|
39086
39115
|
__exportStar2(require_system_prompts(), exports2);
|
|
39087
39116
|
__exportStar2(require_sdkConfig(), exports2);
|
|
39088
39117
|
__exportStar2(require_generate_text_helpers(), exports2);
|
|
39118
|
+
__exportStar2(require_extension_type_documentation(), exports2);
|
|
39089
39119
|
}
|
|
39090
39120
|
});
|
|
39091
39121
|
|
|
@@ -94767,16 +94797,25 @@ var require_sdkEnricher = __commonJS({
|
|
|
94767
94797
|
"../sdk-picker/dist/sdkEnricher.js"(exports2) {
|
|
94768
94798
|
"use strict";
|
|
94769
94799
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
94800
|
+
exports2.filterApisByScore = filterApisByScore;
|
|
94770
94801
|
exports2.fetchDocumentationForApis = fetchDocumentationForApis;
|
|
94771
94802
|
var MAX_APIS_PER_EXTENSION = 10;
|
|
94772
94803
|
var MIN_API_SCORE = 50;
|
|
94804
|
+
function filterApisByScore(apiResult) {
|
|
94805
|
+
return {
|
|
94806
|
+
extensions: apiResult.extensions.map((ext) => ({
|
|
94807
|
+
id: ext.id,
|
|
94808
|
+
relatedApis: (ext.relatedApis ?? []).filter((api) => api.score >= MIN_API_SCORE).sort((a, b) => b.score - a.score).slice(0, MAX_APIS_PER_EXTENSION)
|
|
94809
|
+
}))
|
|
94810
|
+
};
|
|
94811
|
+
}
|
|
94773
94812
|
async function fetchDocumentationForApis(apiResult, mcpClient) {
|
|
94774
|
-
const
|
|
94813
|
+
const filtered = filterApisByScore(apiResult);
|
|
94814
|
+
const enrichedExtensions = await Promise.all(filtered.extensions.map(async (ext) => {
|
|
94775
94815
|
if (!ext.relatedApis || ext.relatedApis.length === 0) {
|
|
94776
94816
|
return { id: ext.id, relatedApis: [] };
|
|
94777
94817
|
}
|
|
94778
|
-
const
|
|
94779
|
-
const enrichedApis = await Promise.all(topApis.map((api) => fetchApiDocumentation(api, mcpClient)));
|
|
94818
|
+
const enrichedApis = await Promise.all(ext.relatedApis.map((api) => fetchApiDocumentation(api, mcpClient)));
|
|
94780
94819
|
return { id: ext.id, relatedApis: enrichedApis };
|
|
94781
94820
|
}));
|
|
94782
94821
|
return { extensions: enrichedExtensions };
|
|
@@ -94865,6 +94904,7 @@ Given an array of extensions (each with a unique ID):
|
|
|
94865
94904
|
**When to Add relatedApis:**
|
|
94866
94905
|
- **Only add relatedApis when the extension needs to interact with Wix platform data/services**
|
|
94867
94906
|
- Extensions that need to query/modify Wix data (products, orders, collections, members, etc.) NEED relatedApis
|
|
94907
|
+
- For SERVICE_PLUGIN: usually just 1 SPI (the handler)
|
|
94868
94908
|
|
|
94869
94909
|
**When NOT to Add relatedApis (leave empty array):**
|
|
94870
94910
|
- **Simple code/text changes** - Changing strings, labels, titles in source code (e.g., "change title from X to Y")
|
|
@@ -94897,10 +94937,8 @@ Given an array of extensions (each with a unique ID):
|
|
|
94897
94937
|
**Output Format:**
|
|
94898
94938
|
- Return an array of objects with 'id' and 'relatedApis' fields
|
|
94899
94939
|
- Each relatedApi must include: api (name), reason (why it's needed), score (0-100), and docsUrl (REQUIRED)
|
|
94900
|
-
- Use the exact IDs provided in the input (e.g., '
|
|
94901
|
-
- Only include extensions that need APIs
|
|
94902
|
-
- **The system will automatically select the top 10 highest-scoring APIs per extension**
|
|
94903
|
-
- **Suggest at least 5 relevant APIs per extension** (unless it's a pure UI/styling change)`;
|
|
94940
|
+
- Use the exact IDs provided in the input (e.g., 'ext-0', 'ext-1', 'current-0', 'additional-0')
|
|
94941
|
+
- Only include extensions that need APIs`;
|
|
94904
94942
|
exports2.sdkPickerAgentCriticalRules = `**docsUrl Requirements:**
|
|
94905
94943
|
- **NEVER use introduction/overview pages** - URLs ending in /introduction, /overview, /about are NOT useful for code generation
|
|
94906
94944
|
- **ALWAYS provide specific method documentation URLs** that contain actual implementation details
|
|
@@ -94921,6 +94959,11 @@ Given an array of extensions (each with a unique ID):
|
|
|
94921
94959
|
- \`data.items.bulkInsert\`, \`data.items.bulkUpdate\`
|
|
94922
94960
|
- **Exception:** Only suggest collection creation if the use case EXPLICITLY requires dynamic collection creation at runtime
|
|
94923
94961
|
|
|
94962
|
+
**Service Plugins (SPIs) - BE MINIMAL:**
|
|
94963
|
+
- **For SERVICE_PLUGIN extensions, suggest ONLY the primary SPI handler**
|
|
94964
|
+
- **DO NOT suggest unrelated SPIs**
|
|
94965
|
+
- **One SPI per service plugin is usually enough** - the SPI handler is the core functionality
|
|
94966
|
+
|
|
94924
94967
|
**Use V3 APIs:**
|
|
94925
94968
|
- **ALWAYS use V3 versions for products** - our platform uses V3 exclusively
|
|
94926
94969
|
- **For products:** \`stores.productsV3.queryProducts\`, \`stores.productsV3.getProduct\`, \`stores.productsV3.createProduct\`, etc.
|
|
@@ -95016,6 +95059,29 @@ var require_sdk_picker_agent_prompt = __commonJS({
|
|
|
95016
95059
|
}
|
|
95017
95060
|
});
|
|
95018
95061
|
|
|
95062
|
+
// ../sdk-picker/dist/extension-documentation.js
|
|
95063
|
+
var require_extension_documentation = __commonJS({
|
|
95064
|
+
"../sdk-picker/dist/extension-documentation.js"(exports2) {
|
|
95065
|
+
"use strict";
|
|
95066
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
95067
|
+
exports2.getExtensionTypesDocumentation = getExtensionTypesDocumentation;
|
|
95068
|
+
var codegen_common_logic_1 = require_dist9();
|
|
95069
|
+
function getExtensionTypesDocumentation(types) {
|
|
95070
|
+
if (types.length === 0) {
|
|
95071
|
+
return "";
|
|
95072
|
+
}
|
|
95073
|
+
const supportedTypes = types.filter((type) => codegen_common_logic_1.codeGenerationExtensionTypes.includes(type));
|
|
95074
|
+
const extensionDocs = supportedTypes.map((type) => (0, codegen_common_logic_1.getExtensionTypeDocumentation)(type)).join("\n\n");
|
|
95075
|
+
if (!extensionDocs) {
|
|
95076
|
+
return "";
|
|
95077
|
+
}
|
|
95078
|
+
return `Understanding what each extension type does will help you find the right APIs:
|
|
95079
|
+
|
|
95080
|
+
${extensionDocs}`;
|
|
95081
|
+
}
|
|
95082
|
+
}
|
|
95083
|
+
});
|
|
95084
|
+
|
|
95019
95085
|
// ../sdk-picker/dist/SDKPickerAgent.js
|
|
95020
95086
|
var require_SDKPickerAgent = __commonJS({
|
|
95021
95087
|
"../sdk-picker/dist/SDKPickerAgent.js"(exports2) {
|
|
@@ -95028,13 +95094,14 @@ var require_SDKPickerAgent = __commonJS({
|
|
|
95028
95094
|
var tools_1 = require_tools3();
|
|
95029
95095
|
var sdkEnricher_1 = require_sdkEnricher();
|
|
95030
95096
|
var sdk_picker_agent_prompt_1 = require_sdk_picker_agent_prompt();
|
|
95097
|
+
var extension_documentation_1 = require_extension_documentation();
|
|
95031
95098
|
var SDKPickerAgent = class {
|
|
95032
95099
|
constructor(model) {
|
|
95033
95100
|
this.name = "SDKPickerAgent";
|
|
95034
95101
|
this.mcpClient = new WixMCPClient_1.WixMCPClient();
|
|
95035
95102
|
this.model = model;
|
|
95036
95103
|
}
|
|
95037
|
-
async generate({ validIds,
|
|
95104
|
+
async generate({ validIds, extensionTypes, userPrompt, skipDocumentationFetch = false }) {
|
|
95038
95105
|
if (validIds.length === 0) {
|
|
95039
95106
|
return { extensions: [] };
|
|
95040
95107
|
}
|
|
@@ -95044,6 +95111,7 @@ var require_SDKPickerAgent = __commonJS({
|
|
|
95044
95111
|
mcpClient: this.mcpClient,
|
|
95045
95112
|
validIds
|
|
95046
95113
|
});
|
|
95114
|
+
const extensionDocumentation = (0, extension_documentation_1.getExtensionTypesDocumentation)(extensionTypes);
|
|
95047
95115
|
const result = await (0, codegen_common_logic_1.generateAgentText)({
|
|
95048
95116
|
agentName: this.name,
|
|
95049
95117
|
model: this.model,
|
|
@@ -95056,6 +95124,9 @@ var require_SDKPickerAgent = __commonJS({
|
|
|
95056
95124
|
if (!apiResult) {
|
|
95057
95125
|
throw new Error("Failed to extract SDK picker result from tool calls");
|
|
95058
95126
|
}
|
|
95127
|
+
if (skipDocumentationFetch) {
|
|
95128
|
+
return (0, sdkEnricher_1.filterApisByScore)(apiResult);
|
|
95129
|
+
}
|
|
95059
95130
|
return await (0, sdkEnricher_1.fetchDocumentationForApis)(apiResult, this.mcpClient);
|
|
95060
95131
|
} catch (error) {
|
|
95061
95132
|
throw (0, ditto_codegen_types_12.toCodegenError)(error);
|
|
@@ -95196,20 +95267,9 @@ var require_SDKPickerAgent2 = __commonJS({
|
|
|
95196
95267
|
var constants_1 = require_constants();
|
|
95197
95268
|
var customAnthropicProvider_1 = require_customAnthropicProvider();
|
|
95198
95269
|
var extensionFormatters_1 = require_extensionFormatters();
|
|
95199
|
-
var AgentsRegistry_1 = require_AgentsRegistry();
|
|
95200
95270
|
var SDKPickerAgent = class {
|
|
95201
95271
|
constructor() {
|
|
95202
95272
|
this.name = "SDKPickerAgent";
|
|
95203
|
-
this.getExtensionTypeDocumentation = (iterationPlan) => {
|
|
95204
|
-
const extensionTypes = this.extractExtensionTypes(iterationPlan);
|
|
95205
|
-
if (extensionTypes.length === 0) {
|
|
95206
|
-
return "";
|
|
95207
|
-
}
|
|
95208
|
-
const extensionDocs = extensionTypes.map((type) => (0, AgentsRegistry_1.getAgentDocumentation)(type)).join("\n\n");
|
|
95209
|
-
return `Understanding what each extension type does will help you find the right APIs:
|
|
95210
|
-
|
|
95211
|
-
${extensionDocs}`;
|
|
95212
|
-
};
|
|
95213
95273
|
}
|
|
95214
95274
|
buildValidIds(iterationPlan) {
|
|
95215
95275
|
const ids = [];
|
|
@@ -95272,13 +95332,13 @@ ${iterationPlan.summary}
|
|
|
95272
95332
|
const model = (0, customAnthropicProvider_1.createCustomTextModel)()(constants_1.LLM_MODELS.CLAUDE_HAIKU_4_5, {
|
|
95273
95333
|
agentName: this.name
|
|
95274
95334
|
});
|
|
95275
|
-
const
|
|
95335
|
+
const extensionTypes = this.extractExtensionTypes(iterationPlan);
|
|
95276
95336
|
const userPrompt = this.buildUserPrompt({ iterationPlan, outputPath });
|
|
95277
95337
|
const agent = new ditto_sdk_picker_1.SDKPickerAgent(model);
|
|
95278
95338
|
try {
|
|
95279
95339
|
const apiResult = await agent.generate({
|
|
95280
95340
|
validIds,
|
|
95281
|
-
|
|
95341
|
+
extensionTypes,
|
|
95282
95342
|
userPrompt
|
|
95283
95343
|
});
|
|
95284
95344
|
return apiResult;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/ditto-codegen-public",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.211",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@wix/ditto-codegen": "1.0.0",
|
|
25
25
|
"esbuild": "^0.27.2"
|
|
26
26
|
},
|
|
27
|
-
"falconPackageHash": "
|
|
27
|
+
"falconPackageHash": "28f61ae966170c9695138b56544ff9a1b9d9f35c6e8b68320142432d"
|
|
28
28
|
}
|