@wix/mcp 1.0.31 → 1.0.33
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/build/bin-standalone.js +308 -19
- package/build/bin-standalone.js.map +4 -4
- package/build/cjs/index.cjs +353 -27
- package/build/cjs/index.cjs.map +4 -4
- package/build/dts/bin.js +3 -1
- package/build/dts/bin.js.map +1 -1
- package/build/dts/config/default-config.d.ts +1 -0
- package/build/dts/config/default-config.d.ts.map +1 -1
- package/build/dts/config/default-config.js +27 -4
- package/build/dts/config/default-config.js.map +1 -1
- package/build/dts/docs/docs.d.ts +2 -0
- package/build/dts/docs/docs.d.ts.map +1 -1
- package/build/dts/docs/docs.js +10 -2
- package/build/dts/docs/docs.js.map +1 -1
- package/build/dts/docs/get-to-know.d.ts +12 -1
- package/build/dts/docs/get-to-know.d.ts.map +1 -1
- package/build/dts/docs/get-to-know.js +20 -8
- package/build/dts/docs/get-to-know.js.map +1 -1
- package/build/dts/docs/get-to-know.test.d.ts +2 -0
- package/build/dts/docs/get-to-know.test.d.ts.map +1 -0
- package/build/dts/docs/get-to-know.test.js +89 -0
- package/build/dts/docs/get-to-know.test.js.map +1 -0
- package/build/dts/site-widget-tools/edit-site-tool/index.d.ts.map +1 -1
- package/build/dts/site-widget-tools/edit-site-tool/index.js +4 -2
- package/build/dts/site-widget-tools/edit-site-tool/index.js.map +1 -1
- package/build/dts/site-widget-tools/site-builder-tool/index.d.ts +4 -0
- package/build/dts/site-widget-tools/site-builder-tool/index.d.ts.map +1 -1
- package/build/dts/site-widget-tools/site-builder-tool/index.js +26 -3
- package/build/dts/site-widget-tools/site-builder-tool/index.js.map +1 -1
- package/build/dts/toolkit.d.ts +5 -1
- package/build/dts/toolkit.d.ts.map +1 -1
- package/build/dts/toolkit.js +13 -1
- package/build/dts/toolkit.js.map +1 -1
- package/build/dts/toolkit.test.js +41 -0
- package/build/dts/toolkit.test.js.map +1 -1
- package/build/dts/wixel/index.d.ts.map +1 -1
- package/build/dts/wixel/index.js +4 -2
- package/build/dts/wixel/index.js.map +1 -1
- package/build/esm/index.js +349 -23
- package/build/esm/index.js.map +4 -4
- package/package.json +3 -2
package/build/bin-standalone.js
CHANGED
|
@@ -3616,9 +3616,9 @@ var require_dist2 = __commonJS({
|
|
|
3616
3616
|
}
|
|
3617
3617
|
});
|
|
3618
3618
|
|
|
3619
|
-
// ../../node_modules
|
|
3619
|
+
// ../../node_modules/https-proxy-agent/dist/parse-proxy-response.js
|
|
3620
3620
|
var require_parse_proxy_response = __commonJS({
|
|
3621
|
-
"../../node_modules
|
|
3621
|
+
"../../node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports) {
|
|
3622
3622
|
"use strict";
|
|
3623
3623
|
var __importDefault2 = exports && exports.__importDefault || function(mod) {
|
|
3624
3624
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
@@ -3712,9 +3712,9 @@ var require_parse_proxy_response = __commonJS({
|
|
|
3712
3712
|
}
|
|
3713
3713
|
});
|
|
3714
3714
|
|
|
3715
|
-
// ../../node_modules
|
|
3715
|
+
// ../../node_modules/https-proxy-agent/dist/index.js
|
|
3716
3716
|
var require_dist3 = __commonJS({
|
|
3717
|
-
"../../node_modules
|
|
3717
|
+
"../../node_modules/https-proxy-agent/dist/index.js"(exports) {
|
|
3718
3718
|
"use strict";
|
|
3719
3719
|
var __createBinding2 = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
3720
3720
|
if (k2 === void 0) k2 = k;
|
|
@@ -10742,6 +10742,8 @@ var SYSTEM_REMINDER = dedent_default`
|
|
|
10742
10742
|
</goal>
|
|
10743
10743
|
<guidelines>
|
|
10744
10744
|
if the WixREADME tool is available to you, YOU MUST USE IT AT THE BEGINNING OF ANY CONVERSATION and then continue with calling the other tools and calling the Wix APIs until the task is completed.
|
|
10745
|
+
**Exception:** If the user asks to create, build, or generate a new Wix site/website, skip WixREADME and call WixSiteBuilder directly if it is available.
|
|
10746
|
+
**Exception:** If the user asks to list, show, or find their Wix sites, skip WixREADME and call ListWixSites directly.
|
|
10745
10747
|
If the WixREADME tool is not available to you, you should use the other flows as described without using the WixREADME tool until the task is completed.
|
|
10746
10748
|
If the user prompt / task is an instruction to do something in Wix, You should not tell the user what Docs to read or what API to call, your task is to do the work and complete the task in minimal steps and time with minimal back and forth with the user, unless absolutely necessary.
|
|
10747
10749
|
</guidelines>
|
|
@@ -10784,6 +10786,7 @@ var defaultToolDescriptions = {
|
|
|
10784
10786
|
`,
|
|
10785
10787
|
CallWixSiteAPI: dedent_default`
|
|
10786
10788
|
Call Wix apis on a business or site. Use this to create, read, update, and delete data and other Wix entities in your Wix site.
|
|
10789
|
+
**Prefer using the "ListWixSites" tool when the user asks to list or show their sites.** Only use this tool for site listing if the user needs advanced filtering or specific site details beyond what ListWixSites provides.
|
|
10787
10790
|
For POST/PATCH/PUT requests, pass the request body as a JSON object in the "body" parameter with all the required fields and values as described in the API schema, code examples, or docs you retrieved (e.g. body: {"name": "value", "nested": {"key": "value"}}).
|
|
10788
10791
|
The API endpoint url param MUST ALWAYS be taken from the conversation context.
|
|
10789
10792
|
By conversation context we mean the endpoint url was given in the user prompt OR got into the conversation context by the "WixREADME" tool OR by the "SearchWixRESTDocumentation" tool OR by the "BrowseWixRESTDocsMenu" tool OR by the "ReadFullDocsArticle" tool.
|
|
@@ -10796,7 +10799,11 @@ var defaultToolDescriptions = {
|
|
|
10796
10799
|
${SYSTEM_REMINDER}
|
|
10797
10800
|
`,
|
|
10798
10801
|
ListWixSites: dedent_default`
|
|
10799
|
-
|
|
10802
|
+
**Use this tool whenever the user asks to list, show, get, or find their Wix sites.** This is the dedicated tool for listing Wix sites for the current user. By default it returns all sites, but you can filter by name.
|
|
10803
|
+
|
|
10804
|
+
**Do NOT use WixREADME before this tool.** When the user asks to list their sites, call this tool directly — no need to read documentation first.
|
|
10805
|
+
|
|
10806
|
+
**Prefer this tool over CallWixSiteAPI for listing sites.** Call this tool directly — it already knows the correct API and handles everything needed. Only fall back to CallWixSiteAPI if the user needs advanced filtering or specific site details beyond what this tool provides.
|
|
10800
10807
|
${SYSTEM_REMINDER}
|
|
10801
10808
|
`,
|
|
10802
10809
|
ManageWixSite: dedent_default`
|
|
@@ -10838,6 +10845,15 @@ var defaultToolDescriptions = {
|
|
|
10838
10845
|
- Site Properties: "https://dev.wix.com/docs/api-reference/business-management/site-properties"
|
|
10839
10846
|
${SYSTEM_REMINDER}
|
|
10840
10847
|
`,
|
|
10848
|
+
WixSiteBuilder: dedent_default`
|
|
10849
|
+
**PRIMARY tool for creating/building/generating a Wix site or website.** This is the preferred and recommended way to create a new Wix site. Use this tool whenever the user asks to build, create, or generate a site/website/application. Do NOT use CreateWixBusinessGuide for site creation — use this tool instead.
|
|
10850
|
+
|
|
10851
|
+
**Do NOT use WixREADME or SearchWixRESTDocumentation before this tool.** When the user asks to build, create, or generate a site, call this tool directly. It handles everything needed for site creation.
|
|
10852
|
+
|
|
10853
|
+
**IMPORTANT: You MUST call this tool to build the site.** Do NOT suggest HTML code, prompt templates, or alternative approaches instead of actually building the site. When a user asks to create a site, your job is to call this tool and build it — not to describe how to build it or suggest alternatives.
|
|
10854
|
+
|
|
10855
|
+
**IMPORTANT: The sitePrompt must be under 6000 characters.** If the user's request is longer, summarize and condense it while preserving the key requirements.
|
|
10856
|
+
`,
|
|
10841
10857
|
CreateWixBusinessGuide: dedent_default`
|
|
10842
10858
|
Provides comprehensive documentation for creating a new Wix Business (i.e site, app, etc.)
|
|
10843
10859
|
|
|
@@ -11133,7 +11149,12 @@ var defaultReadmeDocs = [
|
|
|
11133
11149
|
|
|
11134
11150
|
<flow-description>
|
|
11135
11151
|
Wix MCP Site Management Flows:
|
|
11136
|
-
|
|
11152
|
+
|
|
11153
|
+
Site Creation flow (highest priority for site creation requests):
|
|
11154
|
+
1. User asks to create, build, or generate a Wix site/website,
|
|
11155
|
+
2. Call the "WixSiteBuilder" tool directly with the user's prompt. Do NOT call WixREADME first.
|
|
11156
|
+
3. Do NOT suggest HTML code or alternative approaches — actually build the site.
|
|
11157
|
+
|
|
11137
11158
|
"Recipe" based flow (The most preferred flow):
|
|
11138
11159
|
1. User asks you to do something,
|
|
11139
11160
|
2. You use the "WixREADME" tool to get the context, it will return a list of "recipes" which are essentially Wix docs articles that describe how to do something in Wix.
|
|
@@ -11189,8 +11210,260 @@ var defaultReadmeDocs = [
|
|
|
11189
11210
|
}
|
|
11190
11211
|
];
|
|
11191
11212
|
|
|
11213
|
+
// ../dynamic-context-enricher/build/index.mjs
|
|
11214
|
+
var __defProp2 = Object.defineProperty;
|
|
11215
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
11216
|
+
var __esm2 = (fn, res) => function __init() {
|
|
11217
|
+
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
|
|
11218
|
+
};
|
|
11219
|
+
var __export2 = (target, all) => {
|
|
11220
|
+
for (var name in all)
|
|
11221
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
11222
|
+
};
|
|
11223
|
+
var enrich_exports = {};
|
|
11224
|
+
__export2(enrich_exports, {
|
|
11225
|
+
enrichDynamicContext: () => enrichDynamicContext
|
|
11226
|
+
});
|
|
11227
|
+
function snakeToCamel(obj) {
|
|
11228
|
+
if (Array.isArray(obj)) return obj.map(snakeToCamel);
|
|
11229
|
+
if (obj !== null && typeof obj === "object") {
|
|
11230
|
+
const result = {};
|
|
11231
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
11232
|
+
const camelKey = key.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
|
|
11233
|
+
result[camelKey] = snakeToCamel(value);
|
|
11234
|
+
}
|
|
11235
|
+
return result;
|
|
11236
|
+
}
|
|
11237
|
+
return obj;
|
|
11238
|
+
}
|
|
11239
|
+
function formatTimestamp(value) {
|
|
11240
|
+
if (!value) return "";
|
|
11241
|
+
try {
|
|
11242
|
+
const date = new Date(value);
|
|
11243
|
+
return date.toLocaleDateString("en-US", {
|
|
11244
|
+
month: "short",
|
|
11245
|
+
day: "2-digit",
|
|
11246
|
+
year: "numeric",
|
|
11247
|
+
hour: "2-digit",
|
|
11248
|
+
minute: "2-digit",
|
|
11249
|
+
hour12: false,
|
|
11250
|
+
timeZone: "UTC"
|
|
11251
|
+
});
|
|
11252
|
+
} catch {
|
|
11253
|
+
return value;
|
|
11254
|
+
}
|
|
11255
|
+
}
|
|
11256
|
+
function capitalize(s) {
|
|
11257
|
+
if (!s) return s;
|
|
11258
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
11259
|
+
}
|
|
11260
|
+
function renderAccountHeader(account) {
|
|
11261
|
+
const lines = [];
|
|
11262
|
+
if (account.displayName) {
|
|
11263
|
+
lines.push(`**Account**: ${account.displayName}`);
|
|
11264
|
+
}
|
|
11265
|
+
if (account.id) {
|
|
11266
|
+
lines.push(`**Account ID**: \`${account.id}\``);
|
|
11267
|
+
}
|
|
11268
|
+
const meta = [];
|
|
11269
|
+
if (account.status) meta.push(`Status: **${account.status}**`);
|
|
11270
|
+
if (account.coBranding && account.coBranding !== "None" && account.coBranding !== "CO_BRANDING_UNSPECIFIED") {
|
|
11271
|
+
meta.push("Co-branded");
|
|
11272
|
+
}
|
|
11273
|
+
if (meta.length) lines.push(meta.join(" \xB7 "));
|
|
11274
|
+
if (account.createdDate) {
|
|
11275
|
+
let dateLine = `**Created**: ${formatTimestamp(account.createdDate)}`;
|
|
11276
|
+
if (account.updatedDate) {
|
|
11277
|
+
dateLine += ` \xB7 **Updated**: ${formatTimestamp(account.updatedDate)}`;
|
|
11278
|
+
}
|
|
11279
|
+
lines.push(dateLine);
|
|
11280
|
+
}
|
|
11281
|
+
return lines.length ? lines.join("\n") : "";
|
|
11282
|
+
}
|
|
11283
|
+
function renderStatusBadges(site) {
|
|
11284
|
+
const tags = [];
|
|
11285
|
+
tags.push(site.published ? "Published" : "Draft");
|
|
11286
|
+
if (site.premium) tags.push("Premium");
|
|
11287
|
+
if (site.domainConnected) tags.push("Custom Domain");
|
|
11288
|
+
if (site.editorType && site.editorType !== "EDITOR_TYPE_UNSPECIFIED" && site.editorType !== "UNKNOWN") {
|
|
11289
|
+
tags.push(capitalize(site.editorType.replace(/_/g, " ").toLowerCase()));
|
|
11290
|
+
}
|
|
11291
|
+
return tags.join(" \xB7 ");
|
|
11292
|
+
}
|
|
11293
|
+
function renderApps(apps) {
|
|
11294
|
+
const relevant = apps.filter((a) => a.appId && KNOWN_APPS[a.appId]).sort(
|
|
11295
|
+
(a, b) => (KNOWN_APPS[a.appId] ?? "").localeCompare(KNOWN_APPS[b.appId] ?? "")
|
|
11296
|
+
);
|
|
11297
|
+
if (!relevant.length) return "";
|
|
11298
|
+
const lines = [];
|
|
11299
|
+
for (const app of relevant) {
|
|
11300
|
+
let line = `- **${KNOWN_APPS[app.appId]}** (ID: \`${app.appId}\`)`;
|
|
11301
|
+
if (app.catalogVersion) {
|
|
11302
|
+
line += ` \u2014 Catalog app version: **${app.catalogVersion}**`;
|
|
11303
|
+
}
|
|
11304
|
+
lines.push(line);
|
|
11305
|
+
}
|
|
11306
|
+
return lines.join("\n");
|
|
11307
|
+
}
|
|
11308
|
+
function renderProperties(props) {
|
|
11309
|
+
const sections = [];
|
|
11310
|
+
const locale = [];
|
|
11311
|
+
if (props.language) locale.push(`- Language: **${props.language}**`);
|
|
11312
|
+
if (props.locale?.country) locale.push(`- Country: **${props.locale.country}**`);
|
|
11313
|
+
if (props.timeZone) locale.push(`- Timezone: **${props.timeZone}**`);
|
|
11314
|
+
if (props.paymentCurrency) locale.push(`- Currency: **${props.paymentCurrency}**`);
|
|
11315
|
+
if (locale.length) {
|
|
11316
|
+
sections.push(`**Locale & Region**
|
|
11317
|
+
${locale.join("\n")}`);
|
|
11318
|
+
}
|
|
11319
|
+
const contact = [];
|
|
11320
|
+
if (props.email) contact.push(`- Email: **${props.email}**`);
|
|
11321
|
+
if (props.phone) contact.push(`- Phone: **${props.phone}**`);
|
|
11322
|
+
if (contact.length) {
|
|
11323
|
+
sections.push(`**Contact**
|
|
11324
|
+
${contact.join("\n")}`);
|
|
11325
|
+
}
|
|
11326
|
+
return sections.join("\n\n");
|
|
11327
|
+
}
|
|
11328
|
+
function renderSite(site, index) {
|
|
11329
|
+
const lines = [];
|
|
11330
|
+
const heading = site.displayName ?? `Site ${index}`;
|
|
11331
|
+
lines.push(`## ${index}. ${heading}`);
|
|
11332
|
+
lines.push("");
|
|
11333
|
+
if (site.id) lines.push(`**ID**: \`${site.id}\``);
|
|
11334
|
+
if (site.url) lines.push(`**URL**: [${site.url}](${site.url})`);
|
|
11335
|
+
lines.push(`**Status**: ${renderStatusBadges(site)}`);
|
|
11336
|
+
if (site.createdDate) {
|
|
11337
|
+
let dateLine = `**Created**: ${formatTimestamp(site.createdDate)}`;
|
|
11338
|
+
if (site.updatedDate) {
|
|
11339
|
+
dateLine += ` \xB7 **Updated**: ${formatTimestamp(site.updatedDate)}`;
|
|
11340
|
+
}
|
|
11341
|
+
lines.push(dateLine);
|
|
11342
|
+
}
|
|
11343
|
+
if (site.veloEnabled !== void 0 && site.veloEnabled !== null) {
|
|
11344
|
+
lines.push(`**Velo**: ${site.veloEnabled ? "Enabled" : "Disabled"}`);
|
|
11345
|
+
}
|
|
11346
|
+
if (site.properties) {
|
|
11347
|
+
const propsContent = renderProperties(site.properties);
|
|
11348
|
+
if (propsContent) {
|
|
11349
|
+
lines.push("");
|
|
11350
|
+
lines.push("### Properties");
|
|
11351
|
+
lines.push("");
|
|
11352
|
+
lines.push(propsContent);
|
|
11353
|
+
}
|
|
11354
|
+
}
|
|
11355
|
+
const appsContent = renderApps(site.installedApps ?? []);
|
|
11356
|
+
if (appsContent) {
|
|
11357
|
+
lines.push("");
|
|
11358
|
+
lines.push("### Apps");
|
|
11359
|
+
lines.push("");
|
|
11360
|
+
lines.push(appsContent);
|
|
11361
|
+
}
|
|
11362
|
+
lines.push("");
|
|
11363
|
+
lines.push("---");
|
|
11364
|
+
lines.push("");
|
|
11365
|
+
return lines.join("\n");
|
|
11366
|
+
}
|
|
11367
|
+
function enrichDynamicContext(data) {
|
|
11368
|
+
let parsed = data;
|
|
11369
|
+
if (typeof data === "string") {
|
|
11370
|
+
try {
|
|
11371
|
+
parsed = JSON.parse(data);
|
|
11372
|
+
} catch {
|
|
11373
|
+
return data;
|
|
11374
|
+
}
|
|
11375
|
+
}
|
|
11376
|
+
if (parsed === null || parsed === void 0) return "";
|
|
11377
|
+
if (typeof parsed !== "object") return "";
|
|
11378
|
+
const response = snakeToCamel(parsed);
|
|
11379
|
+
const sections = [];
|
|
11380
|
+
sections.push("# My Wix Sites Context");
|
|
11381
|
+
sections.push("");
|
|
11382
|
+
if (response.account) {
|
|
11383
|
+
const accountSection = renderAccountHeader(response.account);
|
|
11384
|
+
if (accountSection) {
|
|
11385
|
+
sections.push(accountSection);
|
|
11386
|
+
}
|
|
11387
|
+
}
|
|
11388
|
+
const siteCount = response.sites?.length ?? 0;
|
|
11389
|
+
const hasNext = Boolean(response.pagingMetadata?.cursors?.next);
|
|
11390
|
+
let countLine = `_Showing ${siteCount} sites`;
|
|
11391
|
+
if (hasNext) countLine += " (more available)";
|
|
11392
|
+
countLine += "_";
|
|
11393
|
+
sections.push(countLine);
|
|
11394
|
+
sections.push("");
|
|
11395
|
+
sections.push("---");
|
|
11396
|
+
sections.push("");
|
|
11397
|
+
const hasCatalogVersion = response.sites?.some(
|
|
11398
|
+
(site) => site.installedApps?.some(
|
|
11399
|
+
(app) => app.appId && KNOWN_APPS[app.appId] && app.catalogVersion
|
|
11400
|
+
)
|
|
11401
|
+
);
|
|
11402
|
+
if (hasCatalogVersion) {
|
|
11403
|
+
sections.push(
|
|
11404
|
+
"> **Catalog Version**: When a site shows a Catalog app version (V1/V3), always use the APIs matching that version."
|
|
11405
|
+
);
|
|
11406
|
+
sections.push("");
|
|
11407
|
+
}
|
|
11408
|
+
if (response.sites?.length) {
|
|
11409
|
+
for (let i = 0; i < response.sites.length; i++) {
|
|
11410
|
+
sections.push(renderSite(response.sites[i], i + 1));
|
|
11411
|
+
}
|
|
11412
|
+
}
|
|
11413
|
+
if (!response.account && !siteCount) return "";
|
|
11414
|
+
return sections.join("\n");
|
|
11415
|
+
}
|
|
11416
|
+
var KNOWN_APPS;
|
|
11417
|
+
var init_enrich = __esm2({
|
|
11418
|
+
"src/enrich.ts"() {
|
|
11419
|
+
"use strict";
|
|
11420
|
+
KNOWN_APPS = {
|
|
11421
|
+
"14bcded7-0066-7c35-14d7-466cb3f09103": "Wix Bookings",
|
|
11422
|
+
"215238eb-22a5-4c36-9e7b-e7c08025e04e": "Wix Stores",
|
|
11423
|
+
"9a5d83fd-8570-482e-81ab-cfa88942ee60": "Wix Restaurants (Orders)",
|
|
11424
|
+
"b278a256-2757-4f19-9313-c05c783bec92": "Wix Restaurants (Menus)"
|
|
11425
|
+
};
|
|
11426
|
+
}
|
|
11427
|
+
});
|
|
11428
|
+
init_enrich();
|
|
11429
|
+
var DYNAMIC_CONTEXT_URL = "https://dev.wix.com/_api/dynamic-context/v1/dynamic-context";
|
|
11430
|
+
async function getDynamicContext(auth, httpClient, filter) {
|
|
11431
|
+
const { enrichDynamicContext: enrichDynamicContext2 } = await Promise.resolve().then(() => (init_enrich(), enrich_exports));
|
|
11432
|
+
try {
|
|
11433
|
+
const accountHeaders = await auth.getAccountAuthHeaders();
|
|
11434
|
+
const body = {};
|
|
11435
|
+
if (filter?.siteId) body.site_id = filter.siteId;
|
|
11436
|
+
else if (filter?.siteName) body.site_name = filter.siteName;
|
|
11437
|
+
const response = await httpClient.request({
|
|
11438
|
+
url: DYNAMIC_CONTEXT_URL,
|
|
11439
|
+
method: "POST",
|
|
11440
|
+
headers: {
|
|
11441
|
+
...accountHeaders,
|
|
11442
|
+
"Content-Type": "application/json",
|
|
11443
|
+
"Petri_ovr": "shouldReturnDynamicContextInMCP#B",
|
|
11444
|
+
"X-Wix-Office": "1"
|
|
11445
|
+
},
|
|
11446
|
+
data: body
|
|
11447
|
+
});
|
|
11448
|
+
return enrichDynamicContext2(response.data);
|
|
11449
|
+
} catch (error) {
|
|
11450
|
+
console.error(
|
|
11451
|
+
`[dynamic-context-enricher] Fetch failed: ${error.message}`
|
|
11452
|
+
);
|
|
11453
|
+
return "";
|
|
11454
|
+
}
|
|
11455
|
+
}
|
|
11456
|
+
|
|
11192
11457
|
// src/docs/get-to-know.ts
|
|
11193
|
-
async function addGetToKnowTools(
|
|
11458
|
+
async function addGetToKnowTools({
|
|
11459
|
+
server: server2,
|
|
11460
|
+
disableTools = [],
|
|
11461
|
+
toolDescriptions,
|
|
11462
|
+
readmeDocs,
|
|
11463
|
+
authStrategy,
|
|
11464
|
+
picassoPortalUrl,
|
|
11465
|
+
dynamicContextEnabled
|
|
11466
|
+
}) {
|
|
11194
11467
|
if (disableTools.includes("WixREADME")) {
|
|
11195
11468
|
return;
|
|
11196
11469
|
}
|
|
@@ -11201,6 +11474,7 @@ async function addGetToKnowTools(server2, disableTools = [], toolDescriptions, r
|
|
|
11201
11474
|
{},
|
|
11202
11475
|
{ readOnlyHint: true, destructiveHint: false, openWorldHint: false },
|
|
11203
11476
|
async (_, { httpClient }) => {
|
|
11477
|
+
const { siteId, siteName } = _;
|
|
11204
11478
|
const contents = await Promise.all(
|
|
11205
11479
|
docsToUse.map(
|
|
11206
11480
|
async ({
|
|
@@ -11297,12 +11571,23 @@ Failed to fetch content: ${errorMsg}`
|
|
|
11297
11571
|
}
|
|
11298
11572
|
)
|
|
11299
11573
|
);
|
|
11300
|
-
const
|
|
11301
|
-
|
|
11302
|
-
);
|
|
11303
|
-
const
|
|
11574
|
+
const filter = {};
|
|
11575
|
+
if (siteId) filter.siteId = siteId;
|
|
11576
|
+
if (siteName) filter.siteName = siteName;
|
|
11577
|
+
const dynamicContext = dynamicContextEnabled && authStrategy ? await getDynamicContext(
|
|
11578
|
+
authStrategy,
|
|
11579
|
+
httpClient,
|
|
11580
|
+
Object.keys(filter).length ? filter : void 0
|
|
11581
|
+
) : "";
|
|
11582
|
+
const parts = [
|
|
11583
|
+
...contents.filter(
|
|
11584
|
+
(item) => item !== null
|
|
11585
|
+
).map((item) => item.text),
|
|
11586
|
+
...dynamicContext ? [dynamicContext] : []
|
|
11587
|
+
];
|
|
11588
|
+
const text = parts.join("\n\n");
|
|
11304
11589
|
return {
|
|
11305
|
-
content: [{ type: "text", text
|
|
11590
|
+
content: [{ type: "text", text }]
|
|
11306
11591
|
};
|
|
11307
11592
|
}
|
|
11308
11593
|
);
|
|
@@ -11522,18 +11807,20 @@ var addDocsTools = (server2, allowedTools = [
|
|
|
11522
11807
|
toolDescriptions,
|
|
11523
11808
|
readmeDocs,
|
|
11524
11809
|
authStrategy,
|
|
11525
|
-
picassoPortalUrl
|
|
11810
|
+
picassoPortalUrl,
|
|
11811
|
+
dynamicContextEnabled
|
|
11526
11812
|
} = options;
|
|
11527
11813
|
const getDescription = (toolName, defaultDesc) => toolDescriptions?.[toolName] ?? defaultDesc;
|
|
11528
11814
|
if (getToKnowWixEnabled && !disableTools?.includes("WixREADME")) {
|
|
11529
|
-
addGetToKnowTools(
|
|
11530
|
-
server2,
|
|
11531
|
-
disableTools || [],
|
|
11815
|
+
addGetToKnowTools({
|
|
11816
|
+
server: server2,
|
|
11817
|
+
disableTools: disableTools || [],
|
|
11532
11818
|
toolDescriptions,
|
|
11533
11819
|
readmeDocs,
|
|
11534
11820
|
authStrategy,
|
|
11535
|
-
picassoPortalUrl
|
|
11536
|
-
|
|
11821
|
+
picassoPortalUrl,
|
|
11822
|
+
dynamicContextEnabled
|
|
11823
|
+
});
|
|
11537
11824
|
}
|
|
11538
11825
|
if (createWixBusinessGuideEnabled && !disableTools?.includes("CreateWixBusinessGuide")) {
|
|
11539
11826
|
addCreateWixBusinessGuideTools(
|
|
@@ -13238,11 +13525,13 @@ var hasGetToKnowWix = activeTools.includes("GET_TO_KNOW_WIX");
|
|
|
13238
13525
|
var hasCreateWixBusinessGuide = activeTools.includes(
|
|
13239
13526
|
"CREATE_WIX_BUSINESS_GUIDE"
|
|
13240
13527
|
);
|
|
13528
|
+
var hasDynamicContext = Boolean(parsedArgs["dynamicContext"]);
|
|
13241
13529
|
if (docsTools.length > 0 || hasGetToKnowWix || hasCreateWixBusinessGuide) {
|
|
13242
13530
|
logger.log("Adding docs tools:", docsTools);
|
|
13243
13531
|
addDocsTools(server, docsTools, {
|
|
13244
13532
|
getToKnowWixEnabled: hasGetToKnowWix,
|
|
13245
|
-
createWixBusinessGuideEnabled: hasCreateWixBusinessGuide
|
|
13533
|
+
createWixBusinessGuideEnabled: hasCreateWixBusinessGuide,
|
|
13534
|
+
dynamicContextEnabled: hasDynamicContext
|
|
13246
13535
|
});
|
|
13247
13536
|
}
|
|
13248
13537
|
if (activeTools.includes("VELO_README")) {
|