@wix/mcp 1.0.25 → 1.0.26
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 +54 -11
- package/build/bin-standalone.js.map +3 -3
- package/build/cjs/index.cjs +298 -180
- package/build/cjs/index.cjs.map +4 -4
- package/build/dts/docs/docs.d.ts.map +1 -1
- package/build/dts/docs/docs.js +4 -2
- package/build/dts/docs/docs.js.map +1 -1
- package/build/dts/docs/normalize-menu-content.d.ts +13 -0
- package/build/dts/docs/normalize-menu-content.d.ts.map +1 -0
- package/build/dts/docs/normalize-menu-content.js +40 -0
- package/build/dts/docs/normalize-menu-content.js.map +1 -0
- package/build/dts/docs/semanticSearch.d.ts.map +1 -1
- package/build/dts/docs/semanticSearch.js +13 -10
- package/build/dts/docs/semanticSearch.js.map +1 -1
- package/build/dts/docs/semanticSearch.test.js +3 -2
- package/build/dts/docs/semanticSearch.test.js.map +1 -1
- package/build/dts/index.d.ts +1 -1
- package/build/dts/index.d.ts.map +1 -1
- package/build/dts/index.js.map +1 -1
- package/build/dts/site-widget-tools/index.d.ts +2 -2
- package/build/dts/site-widget-tools/index.d.ts.map +1 -1
- package/build/dts/site-widget-tools/index.js.map +1 -1
- package/build/dts/site-widget-tools/pull-site-creation-job-tool/index.d.ts +10 -1
- package/build/dts/site-widget-tools/pull-site-creation-job-tool/index.d.ts.map +1 -1
- package/build/dts/site-widget-tools/pull-site-creation-job-tool/index.js +22 -8
- package/build/dts/site-widget-tools/pull-site-creation-job-tool/index.js.map +1 -1
- package/build/dts/site-widget-tools/site-builder-tool/index.d.ts +10 -1
- 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 +25 -5
- package/build/dts/site-widget-tools/site-builder-tool/index.js.map +1 -1
- package/build/dts/wixel/api.d.ts +10 -2
- package/build/dts/wixel/api.d.ts.map +1 -1
- package/build/dts/wixel/api.js +16 -5
- package/build/dts/wixel/api.js.map +1 -1
- package/build/dts/wixel/index.d.ts.map +1 -1
- package/build/dts/wixel/index.js +15 -4
- package/build/dts/wixel/index.js.map +1 -1
- package/build/dts/wixel/utils.d.ts +2 -0
- package/build/dts/wixel/utils.d.ts.map +1 -0
- package/build/dts/wixel/utils.js +5 -0
- package/build/dts/wixel/utils.js.map +1 -0
- package/build/esm/index.js +145 -46
- package/build/esm/index.js.map +4 -4
- package/package.json +2 -2
package/build/esm/index.js
CHANGED
|
@@ -28700,23 +28700,32 @@ var runSemanticSearch = async (toolName, toolParams, maxResults = 20, rerank = f
|
|
|
28700
28700
|
const url = new URL(
|
|
28701
28701
|
`https://www.wixapis.com/mcp-docs-search/v1/search?maxResults=${maxResults}&rerank=${rerank}`
|
|
28702
28702
|
);
|
|
28703
|
+
const kbNames = [];
|
|
28703
28704
|
if (toolName === "SDK") {
|
|
28704
|
-
|
|
28705
|
-
|
|
28705
|
+
kbNames.push(
|
|
28706
|
+
"API_REFERENCE_SDK_KB_ID",
|
|
28707
|
+
"FRONTEND_SDK_AND_EXTENSIONS_KB_ID",
|
|
28708
|
+
"REST_DOCS_KB_ID"
|
|
28709
|
+
);
|
|
28706
28710
|
} else if (toolName === "REST" || toolName === "BUSINESS_SOLUTIONS") {
|
|
28707
28711
|
if (toolName === "REST") {
|
|
28708
|
-
|
|
28712
|
+
kbNames.push("REST_METHODS_KB_ID");
|
|
28709
28713
|
}
|
|
28710
|
-
|
|
28714
|
+
kbNames.push("REST_DOCS_KB_ID");
|
|
28711
28715
|
} else if (toolName === "WDS") {
|
|
28712
|
-
|
|
28716
|
+
kbNames.push("WDS_DOCS_KB_ID");
|
|
28713
28717
|
} else if (toolName === "BUILD_APPS") {
|
|
28714
|
-
|
|
28718
|
+
kbNames.push("BUILD_APPS_KB_ID");
|
|
28715
28719
|
} else if (toolName === "WIX_HEADLESS") {
|
|
28716
|
-
|
|
28720
|
+
kbNames.push("HEADLESS_KB_ID");
|
|
28717
28721
|
} else if (toolName === "VELO") {
|
|
28718
|
-
|
|
28719
|
-
|
|
28722
|
+
kbNames.push("VELO_DOCS_KB_ID", "VELO_METHODS_KB_ID");
|
|
28723
|
+
}
|
|
28724
|
+
logger2.log(
|
|
28725
|
+
`[SemanticSearch] Tool: ${toolName}, KBs: [${kbNames.join(", ")}], Query: "${toolParams.searchTerm}"`
|
|
28726
|
+
);
|
|
28727
|
+
for (const kbName of kbNames) {
|
|
28728
|
+
url.searchParams.append("kbName", kbName);
|
|
28720
28729
|
}
|
|
28721
28730
|
for (const [key, value] of Object.entries(toolParams)) {
|
|
28722
28731
|
url.searchParams.append(key, value);
|
|
@@ -28905,6 +28914,39 @@ ${preview}${truncated}`);
|
|
|
28905
28914
|
return content;
|
|
28906
28915
|
}
|
|
28907
28916
|
|
|
28917
|
+
// src/docs/normalize-menu-content.ts
|
|
28918
|
+
var SCHEMA_HINT = "use ReadFullDocsMethodSchema to get the method full schema";
|
|
28919
|
+
var ARTICLE_HINT = "use ReadFullDocsArticle to see method code examples";
|
|
28920
|
+
var MENU_HINT = "use BrowseWixRESTDocsMenu to browse this category";
|
|
28921
|
+
function safeDecode(encoded) {
|
|
28922
|
+
try {
|
|
28923
|
+
return decodeURIComponent(encoded);
|
|
28924
|
+
} catch {
|
|
28925
|
+
return encoded;
|
|
28926
|
+
}
|
|
28927
|
+
}
|
|
28928
|
+
function normalizeMenuContent(content) {
|
|
28929
|
+
try {
|
|
28930
|
+
content = content.replace(
|
|
28931
|
+
/\[([^\]]+)\]\(https:\/\/[^)]*get-article-content\?articleUrl=([^&)]+)[^)]*schema=true[^)]*\)/g,
|
|
28932
|
+
(_, title, encoded) => `[${title} (${SCHEMA_HINT})](${safeDecode(encoded)})`
|
|
28933
|
+
);
|
|
28934
|
+
content = content.replace(
|
|
28935
|
+
/\[([^\]]+)\]\(https:\/\/[^)]*get-article-content\?articleUrl=([^&)]+)[^)]*\)/g,
|
|
28936
|
+
(_, title, encoded) => `[${title} (${ARTICLE_HINT})](${safeDecode(encoded)})`
|
|
28937
|
+
);
|
|
28938
|
+
content = content.replace(
|
|
28939
|
+
/\[([^\]]+)\]\(https:\/\/[^)]*get-menu-content\?url=([^&)]+)[^)]*\)/g,
|
|
28940
|
+
(_, title, encoded) => `[${title} (${MENU_HINT})](${safeDecode(encoded)})`
|
|
28941
|
+
);
|
|
28942
|
+
} catch (error2) {
|
|
28943
|
+
logger2.error(
|
|
28944
|
+
`[BrowseWixRESTDocsMenu] Failed to normalize menu content: ${error2}`
|
|
28945
|
+
);
|
|
28946
|
+
}
|
|
28947
|
+
return content;
|
|
28948
|
+
}
|
|
28949
|
+
|
|
28908
28950
|
// ../../node_modules/dedent/dist/dedent.mjs
|
|
28909
28951
|
function ownKeys(object3, enumerableOnly) {
|
|
28910
28952
|
var keys = Object.keys(object3);
|
|
@@ -29813,7 +29855,8 @@ var addDocsTools = (server, allowedTools = [
|
|
|
29813
29855
|
type: "text",
|
|
29814
29856
|
text: [
|
|
29815
29857
|
result,
|
|
29816
|
-
"you should use ReadFullDocsArticle tool if you want to read full documentation for a specific article or method."
|
|
29858
|
+
"you should use ReadFullDocsArticle tool if you want to read full documentation for a specific article or method.",
|
|
29859
|
+
"IMPORTANT: When sharing dev.wix.com/docs/rest or dev.wix.com/docs/api-reference links with the user, add ?apiView=SDK suffix to each link (or &apiView=SDK if the URL already has query params). for other prefix (dev.wix.com/docs/sdk) - no need to add the suffix."
|
|
29817
29860
|
].join("\n---\n")
|
|
29818
29861
|
}
|
|
29819
29862
|
]
|
|
@@ -30141,7 +30184,7 @@ var addDocsTools = (server, allowedTools = [
|
|
|
30141
30184
|
content: [
|
|
30142
30185
|
{
|
|
30143
30186
|
type: "text",
|
|
30144
|
-
text: content
|
|
30187
|
+
text: normalizeMenuContent(content)
|
|
30145
30188
|
}
|
|
30146
30189
|
]
|
|
30147
30190
|
};
|
|
@@ -30718,7 +30761,7 @@ var PULL_SITE_JOB_TOOL_NAME = "pullSiteCreationJob";
|
|
|
30718
30761
|
// src/site-widget-tools/site-builder-tool/index.ts
|
|
30719
30762
|
var httpClient = createHttpClient2();
|
|
30720
30763
|
var CREATE_SITE_WIDGET_URI = "ui://widget/site-builder.html";
|
|
30721
|
-
function addCreateSiteWidgetTool(server, authStrategy) {
|
|
30764
|
+
function addCreateSiteWidgetTool(server, authStrategy, options) {
|
|
30722
30765
|
const { getAccountAuthHeaders } = authStrategy;
|
|
30723
30766
|
const toolMeta = (widgetPayload) => {
|
|
30724
30767
|
return {
|
|
@@ -30827,18 +30870,35 @@ function addCreateSiteWidgetTool(server, authStrategy) {
|
|
|
30827
30870
|
jobId = newJobId;
|
|
30828
30871
|
console.log(`[${SITE_BUILDER_TOOL_NAME}] Created new job:`, jobId);
|
|
30829
30872
|
}
|
|
30873
|
+
const isWidgetClient = options?.widgetSupported ?? true;
|
|
30874
|
+
const responseText = isWidgetClient ? "Website build started successfully." : [
|
|
30875
|
+
"Website build started successfully.",
|
|
30876
|
+
"",
|
|
30877
|
+
"<agent_instruction>",
|
|
30878
|
+
"IMPORTANT: The website is now being built. You MUST now poll for the build status by calling the",
|
|
30879
|
+
`"${PULL_SITE_JOB_TOOL_NAME}" tool with jobId: "${jobId}".`,
|
|
30880
|
+
"",
|
|
30881
|
+
"Polling instructions:",
|
|
30882
|
+
`1. Call ${PULL_SITE_JOB_TOOL_NAME} with { "jobId": "${jobId}" }`,
|
|
30883
|
+
'2. If the job status is "IN_PROGRESS" or "STARTED", wait approximately 10 seconds, then call again.',
|
|
30884
|
+
'3. Repeat polling until the job status is "COMPLETED" or "FAILED".',
|
|
30885
|
+
"4. When COMPLETED, share the previewUrl with the user so they can see their new website.",
|
|
30886
|
+
"5. If FAILED, inform the user that the site build failed and suggest they try again.",
|
|
30887
|
+
"",
|
|
30888
|
+
"Do NOT mention the jobId to the user. Just confirm the build has started, then begin polling.",
|
|
30889
|
+
"</agent_instruction>"
|
|
30890
|
+
].join("\n");
|
|
30830
30891
|
return {
|
|
30831
30892
|
content: [
|
|
30832
30893
|
{
|
|
30833
30894
|
type: "text",
|
|
30834
|
-
text:
|
|
30895
|
+
text: responseText
|
|
30835
30896
|
}
|
|
30836
30897
|
],
|
|
30837
30898
|
structuredContent: {
|
|
30838
30899
|
success: true,
|
|
30839
|
-
status: "
|
|
30900
|
+
status: "Website build started successfully.",
|
|
30840
30901
|
jobId
|
|
30841
|
-
// Return jobId so model can use it in future calls
|
|
30842
30902
|
},
|
|
30843
30903
|
_meta: toolMeta({ jobId, extras: server.getWidgetExtras() })
|
|
30844
30904
|
};
|
|
@@ -31079,13 +31139,13 @@ function siteCreatedUsingWixMcpSrc39Evid1608(params) {
|
|
|
31079
31139
|
|
|
31080
31140
|
// src/site-widget-tools/pull-site-creation-job-tool/index.ts
|
|
31081
31141
|
var httpClient3 = createHttpClient2();
|
|
31082
|
-
function addPullSiteJobTool(server, authStrategy) {
|
|
31142
|
+
function addPullSiteJobTool(server, authStrategy, options) {
|
|
31083
31143
|
const { getAccountAuthHeaders, getSiteAuthHeaders } = authStrategy;
|
|
31084
31144
|
server.registerTool(
|
|
31085
31145
|
PULL_SITE_JOB_TOOL_NAME,
|
|
31086
31146
|
{
|
|
31087
31147
|
title: "Pull Site Job",
|
|
31088
|
-
description: "
|
|
31148
|
+
description: "Poll the status of a site creation or editing job. Call this tool with the jobId returned by WixSiteBuilder or EditSite to check if the site build is complete. When the job status is COMPLETED, the response includes the previewUrl and editorUrl. Continue polling every 10 seconds until the job reaches COMPLETED or FAILED status.",
|
|
31089
31149
|
inputSchema: {
|
|
31090
31150
|
jobId: zod_default.string().describe("The job ID to pull")
|
|
31091
31151
|
},
|
|
@@ -31096,8 +31156,7 @@ function addPullSiteJobTool(server, authStrategy) {
|
|
|
31096
31156
|
},
|
|
31097
31157
|
_meta: {
|
|
31098
31158
|
"openai/toolInvocation/invoking": "Fetching codegen job",
|
|
31099
|
-
"openai/toolInvocation/invoked": "Jobs retrieved"
|
|
31100
|
-
"openai/visibility": "private"
|
|
31159
|
+
"openai/toolInvocation/invoked": "Jobs retrieved"
|
|
31101
31160
|
}
|
|
31102
31161
|
},
|
|
31103
31162
|
async (args, { biLogger, setToolBiParams }) => {
|
|
@@ -31130,7 +31189,7 @@ function addPullSiteJobTool(server, authStrategy) {
|
|
|
31130
31189
|
}
|
|
31131
31190
|
const job = response.data.job;
|
|
31132
31191
|
const isEditJob = job.type === "EDIT_SITE";
|
|
31133
|
-
const
|
|
31192
|
+
const isWidgetClient = options?.widgetSupported ?? true;
|
|
31134
31193
|
if (job.status === "COMPLETED" && job.data?.siteId) {
|
|
31135
31194
|
console.log(`[pullSiteJob] job is completed ${jobId}`);
|
|
31136
31195
|
try {
|
|
@@ -31189,12 +31248,26 @@ function addPullSiteJobTool(server, authStrategy) {
|
|
|
31189
31248
|
);
|
|
31190
31249
|
}
|
|
31191
31250
|
}
|
|
31251
|
+
const isInProgress = job.status === "IN_PROGRESS" || job.status === "STARTED";
|
|
31252
|
+
let responseText;
|
|
31253
|
+
if (job.status === "COMPLETED") {
|
|
31254
|
+
responseText = isWidgetClient ? "Site successfully created." : `Site successfully created!
|
|
31255
|
+
|
|
31256
|
+
Site URL: ${job.data?.previewUrl}
|
|
31257
|
+
Editor URL: ${job.data?.editorUrl}`;
|
|
31258
|
+
} else if (isInProgress) {
|
|
31259
|
+
const pollingHint = !isWidgetClient ? `
|
|
31260
|
+
|
|
31261
|
+
<agent_instruction>The job is still in progress. Wait approximately 10 seconds and then call ${PULL_SITE_JOB_TOOL_NAME} again with { "jobId": "${jobId}" }. Do not tell the user about polling details.</agent_instruction>` : "";
|
|
31262
|
+
responseText = `Job in progress.${pollingHint}`;
|
|
31263
|
+
} else {
|
|
31264
|
+
responseText = `Job status: ${job.status}`;
|
|
31265
|
+
}
|
|
31192
31266
|
return {
|
|
31193
31267
|
content: [
|
|
31194
31268
|
{
|
|
31195
31269
|
type: "text",
|
|
31196
|
-
text:
|
|
31197
|
-
${pullJobMessage}`
|
|
31270
|
+
text: responseText
|
|
31198
31271
|
}
|
|
31199
31272
|
],
|
|
31200
31273
|
structuredContent: { job: response.data.job }
|
|
@@ -31274,7 +31347,7 @@ async function getPublishedSiteUrl({
|
|
|
31274
31347
|
return;
|
|
31275
31348
|
}
|
|
31276
31349
|
|
|
31277
|
-
// ../../node_modules/@wix/metro-runtime/
|
|
31350
|
+
// ../../node_modules/@wix/metro-runtime/es/build/serialization/utils.js
|
|
31278
31351
|
function parseLeanSchemaRef(renderedSchemaName = "") {
|
|
31279
31352
|
const [typeOrName, schemaName] = getSchemaNameAndType(renderedSchemaName);
|
|
31280
31353
|
if (schemaName) {
|
|
@@ -31289,7 +31362,7 @@ function parseLeanSchemaRef(renderedSchemaName = "") {
|
|
|
31289
31362
|
}
|
|
31290
31363
|
var getSchemaNameAndType = (leanSchema) => leanSchema.split("#");
|
|
31291
31364
|
|
|
31292
|
-
// ../../node_modules/@wix/metro-runtime/
|
|
31365
|
+
// ../../node_modules/@wix/metro-runtime/es/build/utils.js
|
|
31293
31366
|
function findByPath(obj, path2, defaultValue, suffix) {
|
|
31294
31367
|
let result = obj;
|
|
31295
31368
|
for (const field of path2.split(".")) {
|
|
@@ -31301,7 +31374,7 @@ function findByPath(obj, path2, defaultValue, suffix) {
|
|
|
31301
31374
|
return `${result}${suffix}`;
|
|
31302
31375
|
}
|
|
31303
31376
|
|
|
31304
|
-
// ../../node_modules/@wix/metro-runtime/
|
|
31377
|
+
// ../../node_modules/@wix/metro-runtime/es/build/url-resolver.js
|
|
31305
31378
|
var USER_DOMAIN = "_";
|
|
31306
31379
|
var DOMAINS = ["wix.com", "editorx.com"];
|
|
31307
31380
|
var WIX_API_DOMAINS = ["42.wixprod.net", "uw2-edt-1.wixprod.net"];
|
|
@@ -31418,7 +31491,7 @@ var utob = (u) => u.replace(re_utob, cb_utob);
|
|
|
31418
31491
|
var _encode = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
|
|
31419
31492
|
var encode = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src);
|
|
31420
31493
|
|
|
31421
|
-
// ../../node_modules/@wix/metro-runtime/
|
|
31494
|
+
// ../../node_modules/@wix/metro-runtime/es/build/flatten-params.js
|
|
31422
31495
|
function flattenParams(data, path2 = "") {
|
|
31423
31496
|
const params = {};
|
|
31424
31497
|
Object.entries(data).forEach(([key, value]) => {
|
|
@@ -31456,14 +31529,14 @@ function toURLSearchParams(params, isComplexRequest) {
|
|
|
31456
31529
|
}
|
|
31457
31530
|
}
|
|
31458
31531
|
|
|
31459
|
-
// ../../node_modules/@wix/metro-runtime/
|
|
31532
|
+
// ../../node_modules/@wix/metro-runtime/es/build/serializer/domain.js
|
|
31460
31533
|
var ConverterType;
|
|
31461
31534
|
(function(ConverterType2) {
|
|
31462
31535
|
ConverterType2[ConverterType2["TO_JSON"] = 0] = "TO_JSON";
|
|
31463
31536
|
ConverterType2[ConverterType2["FROM_JSON"] = 1] = "FROM_JSON";
|
|
31464
|
-
})(ConverterType || (ConverterType = {}));
|
|
31537
|
+
})(ConverterType = ConverterType || (ConverterType = {}));
|
|
31465
31538
|
|
|
31466
|
-
// ../../node_modules/@wix/metro-runtime/
|
|
31539
|
+
// ../../node_modules/@wix/metro-runtime/es/build/serializer/serializer.js
|
|
31467
31540
|
function schemaSerializer(rootSchema, depSchemas = {}, converterSets) {
|
|
31468
31541
|
return function serialize(json = {}, converterType) {
|
|
31469
31542
|
return typeof json === "string" ? json : transformSchema(rootSchema, json);
|
|
@@ -31514,7 +31587,7 @@ function schemaSerializer(rootSchema, depSchemas = {}, converterSets) {
|
|
|
31514
31587
|
};
|
|
31515
31588
|
}
|
|
31516
31589
|
|
|
31517
|
-
// ../../node_modules/@wix/metro-runtime/
|
|
31590
|
+
// ../../node_modules/@wix/metro-runtime/es/build/serializer/protobuf-converters/timestamp.js
|
|
31518
31591
|
var timestamp = {
|
|
31519
31592
|
types: ["google.protobuf.Timestamp"],
|
|
31520
31593
|
[ConverterType.TO_JSON]: {
|
|
@@ -31530,7 +31603,7 @@ var timestamp = {
|
|
|
31530
31603
|
}
|
|
31531
31604
|
};
|
|
31532
31605
|
|
|
31533
|
-
// ../../node_modules/@wix/metro-runtime/
|
|
31606
|
+
// ../../node_modules/@wix/metro-runtime/es/build/serializer/protobuf-converters/field-mask.js
|
|
31534
31607
|
var fieldMask = {
|
|
31535
31608
|
types: ["google.protobuf.FieldMask"],
|
|
31536
31609
|
[ConverterType.TO_JSON]: {
|
|
@@ -31563,7 +31636,7 @@ var fieldMask = {
|
|
|
31563
31636
|
}
|
|
31564
31637
|
};
|
|
31565
31638
|
|
|
31566
|
-
// ../../node_modules/@wix/metro-runtime/
|
|
31639
|
+
// ../../node_modules/@wix/metro-runtime/es/build/serializer/protobuf-converters/bytes.js
|
|
31567
31640
|
var bytes = {
|
|
31568
31641
|
types: ["google.protobuf.BytesValue", "BYTES"],
|
|
31569
31642
|
[ConverterType.TO_JSON]: {
|
|
@@ -31579,7 +31652,7 @@ var bytes = {
|
|
|
31579
31652
|
}
|
|
31580
31653
|
};
|
|
31581
31654
|
|
|
31582
|
-
// ../../node_modules/@wix/metro-runtime/
|
|
31655
|
+
// ../../node_modules/@wix/metro-runtime/es/build/serializer/protobuf-converters/duration.js
|
|
31583
31656
|
var duration3 = {
|
|
31584
31657
|
types: ["google.protobuf.Duration"],
|
|
31585
31658
|
[ConverterType.TO_JSON]: {
|
|
@@ -31610,7 +31683,7 @@ function nanosForString(nanos) {
|
|
|
31610
31683
|
return res;
|
|
31611
31684
|
}
|
|
31612
31685
|
|
|
31613
|
-
// ../../node_modules/@wix/metro-runtime/
|
|
31686
|
+
// ../../node_modules/@wix/metro-runtime/es/build/serializer/protobuf-converters/float.js
|
|
31614
31687
|
var float = {
|
|
31615
31688
|
types: [
|
|
31616
31689
|
"FLOAT",
|
|
@@ -31639,7 +31712,7 @@ var float = {
|
|
|
31639
31712
|
}
|
|
31640
31713
|
};
|
|
31641
31714
|
|
|
31642
|
-
// ../../node_modules/@wix/metro-runtime/
|
|
31715
|
+
// ../../node_modules/@wix/metro-runtime/es/build/serializer/protobuf-converters/converters.js
|
|
31643
31716
|
var protobufConverters = [
|
|
31644
31717
|
timestamp,
|
|
31645
31718
|
fieldMask,
|
|
@@ -31648,7 +31721,7 @@ var protobufConverters = [
|
|
|
31648
31721
|
float
|
|
31649
31722
|
];
|
|
31650
31723
|
|
|
31651
|
-
// ../../node_modules/@wix/metro-runtime/
|
|
31724
|
+
// ../../node_modules/@wix/metro-runtime/es/build/serializer/utils.js
|
|
31652
31725
|
function typeToConverterSet(converterSets) {
|
|
31653
31726
|
return converterSets.reduce((result, converterSet) => {
|
|
31654
31727
|
const types = converterSet.types.reduce((typeResult, type) => {
|
|
@@ -31664,7 +31737,7 @@ function typeToConverterSet(converterSets) {
|
|
|
31664
31737
|
}, {});
|
|
31665
31738
|
}
|
|
31666
31739
|
|
|
31667
|
-
// ../../node_modules/@wix/metro-runtime/
|
|
31740
|
+
// ../../node_modules/@wix/metro-runtime/es/build/ambassador-index.js
|
|
31668
31741
|
var ambassadorConverters = typeToConverterSet([...protobufConverters]);
|
|
31669
31742
|
function serializer(rootSchema, depSchemas = {}) {
|
|
31670
31743
|
const transform2 = schemaSerializer(rootSchema, depSchemas, ambassadorConverters);
|
|
@@ -32336,7 +32409,7 @@ var WWW_PROJECT_V1_PROJECT_API_BASE_URL = "https://manage.wix.com/";
|
|
|
32336
32409
|
var WWW_ASSET_V1_ASSET_API_BASE_URL = "https://manage.wix.com/";
|
|
32337
32410
|
|
|
32338
32411
|
// src/wixel/api.ts
|
|
32339
|
-
var CONDUCTOR_OVERRIDE = "
|
|
32412
|
+
var CONDUCTOR_OVERRIDE = "f14cea3d-0f6b-448b-9093-d424ab8073b1";
|
|
32340
32413
|
var COMMON_HEADERS = {};
|
|
32341
32414
|
function parseWidget(content) {
|
|
32342
32415
|
const match = content?.match(/<<(.+?)>>/s);
|
|
@@ -32522,7 +32595,8 @@ async function sendMessageToWix({
|
|
|
32522
32595
|
message,
|
|
32523
32596
|
wixelAssistantId = WIXEL_ASSISTANT_ID,
|
|
32524
32597
|
apiBaseURL = GENIE_CHAT_SERVICE_V1_NO_ENTITY_API_BASE_URL,
|
|
32525
|
-
conductorOverride = CONDUCTOR_OVERRIDE
|
|
32598
|
+
conductorOverride = CONDUCTOR_OVERRIDE,
|
|
32599
|
+
images
|
|
32526
32600
|
}) {
|
|
32527
32601
|
const httpClient4 = createHttpClient2({
|
|
32528
32602
|
headers: {
|
|
@@ -32537,6 +32611,13 @@ async function sendMessageToWix({
|
|
|
32537
32611
|
messageLength: message.length,
|
|
32538
32612
|
messagePreview: message.substring(0, 300) + (message.length > 300 ? "..." : "")
|
|
32539
32613
|
});
|
|
32614
|
+
const attachments = images && images.length > 0 ? {
|
|
32615
|
+
attachments: images.map((image, index) => ({
|
|
32616
|
+
fileName: `Image ${index + 1}`,
|
|
32617
|
+
mimeType: "image/png",
|
|
32618
|
+
url: image.download_url
|
|
32619
|
+
}))
|
|
32620
|
+
} : {};
|
|
32540
32621
|
const response = await httpClient4.request(
|
|
32541
32622
|
createConversationUserMessage({
|
|
32542
32623
|
conversationId,
|
|
@@ -32548,7 +32629,8 @@ async function sendMessageToWix({
|
|
|
32548
32629
|
value: projectId
|
|
32549
32630
|
}
|
|
32550
32631
|
]
|
|
32551
|
-
}
|
|
32632
|
+
},
|
|
32633
|
+
...attachments
|
|
32552
32634
|
})
|
|
32553
32635
|
);
|
|
32554
32636
|
const userMessage = response.data.userMessage;
|
|
@@ -32604,7 +32686,8 @@ async function sendMessageToWixWithAutoConfirmation({
|
|
|
32604
32686
|
message,
|
|
32605
32687
|
wixelAssistantId = WIXEL_ASSISTANT_ID,
|
|
32606
32688
|
apiBaseURL = GENIE_CHAT_SERVICE_V1_NO_ENTITY_API_BASE_URL,
|
|
32607
|
-
conductorOverride = CONDUCTOR_OVERRIDE
|
|
32689
|
+
conductorOverride = CONDUCTOR_OVERRIDE,
|
|
32690
|
+
images
|
|
32608
32691
|
}) {
|
|
32609
32692
|
const { completedMsg, widget, messageText } = await sendMessageToWix({
|
|
32610
32693
|
siteAuthHeaders,
|
|
@@ -32613,7 +32696,8 @@ async function sendMessageToWixWithAutoConfirmation({
|
|
|
32613
32696
|
message,
|
|
32614
32697
|
wixelAssistantId,
|
|
32615
32698
|
apiBaseURL,
|
|
32616
|
-
conductorOverride
|
|
32699
|
+
conductorOverride,
|
|
32700
|
+
images
|
|
32617
32701
|
});
|
|
32618
32702
|
if (widget?.widget === "SINGLE_SELECT_WIDGET" && widget.data?.primaryButton?.respondText) {
|
|
32619
32703
|
console.log("Auto-confirm SINGLE_SELECT_WIDGET", widget);
|
|
@@ -32694,6 +32778,12 @@ async function getAsset2({
|
|
|
32694
32778
|
return asset;
|
|
32695
32779
|
}
|
|
32696
32780
|
|
|
32781
|
+
// src/wixel/utils.ts
|
|
32782
|
+
var UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
32783
|
+
function isValidUuid(value) {
|
|
32784
|
+
return typeof value === "string" && UUID_REGEX.test(value);
|
|
32785
|
+
}
|
|
32786
|
+
|
|
32697
32787
|
// src/wixel/index.ts
|
|
32698
32788
|
var SEND_MESSAGE_TO_WIXEL_TOOL_NAME = "SendMessageToWixel";
|
|
32699
32789
|
var GET_WIXEL_JOB_STATUS_TOOL_NAME = "getWixelJobStatus";
|
|
@@ -32749,7 +32839,8 @@ function addSendMessageToWixelTool(server, authStrategy) {
|
|
|
32749
32839
|
const toolMeta = {
|
|
32750
32840
|
...widgetMeta,
|
|
32751
32841
|
"openai/toolInvocation/invoking": "Sending message to Wixel...",
|
|
32752
|
-
"openai/toolInvocation/invoked": "Response from Wixel received"
|
|
32842
|
+
"openai/toolInvocation/invoked": "Response from Wixel received",
|
|
32843
|
+
"openai/fileParams": ["images"]
|
|
32753
32844
|
};
|
|
32754
32845
|
server.registerResource(
|
|
32755
32846
|
`${WIDGET_NAME}_RESOURCE`,
|
|
@@ -32792,18 +32883,25 @@ You can also use this tool to:
|
|
|
32792
32883
|
metaSiteId: external_exports.string().optional().describe("Wixel site ID (auto-creates if not provided)"),
|
|
32793
32884
|
projectId: external_exports.string().optional().describe("Wixel project ID (auto-creates if not provided)"),
|
|
32794
32885
|
conversationId: external_exports.string().optional().describe("Existing conversation ID (auto-creates if not provided)"),
|
|
32795
|
-
message: external_exports.string().describe("The message to send to Wixel")
|
|
32886
|
+
message: external_exports.string().describe("The message to send to Wixel"),
|
|
32887
|
+
images: external_exports.array(
|
|
32888
|
+
external_exports.object({
|
|
32889
|
+
download_url: external_exports.string().url(),
|
|
32890
|
+
file_id: external_exports.string()
|
|
32891
|
+
})
|
|
32892
|
+
).optional().describe("Attached image files provided by the user")
|
|
32796
32893
|
},
|
|
32797
32894
|
annotations: { readOnlyHint: true },
|
|
32798
32895
|
_meta: toolMeta
|
|
32799
32896
|
},
|
|
32800
32897
|
async (args) => {
|
|
32801
32898
|
try {
|
|
32899
|
+
console.log(`[Wixel] \u{1F680} Start Building Your asset`, { ...args });
|
|
32802
32900
|
const accountAuthHeaders = await getAccountAuthHeaders();
|
|
32803
32901
|
let metaSiteId;
|
|
32804
32902
|
let projectId;
|
|
32805
32903
|
let messageHint = "";
|
|
32806
|
-
if (args.metaSiteId && args.projectId) {
|
|
32904
|
+
if (isValidUuid(args.metaSiteId) && isValidUuid(args.projectId)) {
|
|
32807
32905
|
metaSiteId = args.metaSiteId;
|
|
32808
32906
|
projectId = args.projectId;
|
|
32809
32907
|
} else {
|
|
@@ -32854,7 +32952,8 @@ You can also use this tool to:
|
|
|
32854
32952
|
siteAuthHeaders,
|
|
32855
32953
|
projectId,
|
|
32856
32954
|
conversationId,
|
|
32857
|
-
message: messageWithHint
|
|
32955
|
+
message: messageWithHint,
|
|
32956
|
+
images: args.images
|
|
32858
32957
|
});
|
|
32859
32958
|
let widget = parsedWidget;
|
|
32860
32959
|
let textContent = messageText.replaceAll("**", "");
|