@wix/mcp 1.0.92 → 1.0.93
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 +38 -20
- package/build/cjs/index.cjs +257 -23
- package/build/cjs/toolkit.cjs +257 -23
- package/build/dts/code-mode/attachments.d.ts +37 -0
- package/build/dts/code-mode/attachments.js +218 -0
- package/build/dts/code-mode/index.js +36 -3
- package/build/dts/config/default-config.js +13 -6
- package/build/dts/config/param-descriptions.js +3 -3
- package/build/dts/docs/docs.js +14 -8
- package/build/dts/docs/semanticSearch.d.ts +2 -1
- package/build/dts/docs/semanticSearch.js +12 -5
- package/build/esm/index.js +257 -23
- package/build/esm/toolkit.js +257 -23
- package/package.json +2 -2
package/build/bin-standalone.js
CHANGED
|
@@ -71098,9 +71098,12 @@ var runSemanticSearch = async (toolName, toolParams, maxResults = 20, rerank = f
|
|
|
71098
71098
|
);
|
|
71099
71099
|
return data?.results;
|
|
71100
71100
|
};
|
|
71101
|
-
var runPlatformizedSemanticSearch = async (toolName, searchTerm, maxResults = 20, linesInEachResult) => {
|
|
71101
|
+
var runPlatformizedSemanticSearch = async (toolName, searchTerm, maxResults = 20, linesInEachResult, extraDocumentTypes) => {
|
|
71102
71102
|
const startTime = Date.now();
|
|
71103
|
-
|
|
71103
|
+
const documentTypes = extraDocumentTypes?.length ? [toolName, ...extraDocumentTypes] : void 0;
|
|
71104
|
+
logger2.log(
|
|
71105
|
+
`[SemanticSearch/v2] Tool: ${documentTypes ? documentTypes.join("+") : toolName}, Query: "${searchTerm}"`
|
|
71106
|
+
);
|
|
71104
71107
|
const response = await fetch(
|
|
71105
71108
|
"https://www.wixapis.com/mcp-docs-search/v1/docs/search/markdown",
|
|
71106
71109
|
{
|
|
@@ -71111,7 +71114,7 @@ var runPlatformizedSemanticSearch = async (toolName, searchTerm, maxResults = 20
|
|
|
71111
71114
|
},
|
|
71112
71115
|
body: JSON.stringify({
|
|
71113
71116
|
search_term: searchTerm,
|
|
71114
|
-
document_type: toolName,
|
|
71117
|
+
...documentTypes ? { document_types: documentTypes } : { document_type: toolName },
|
|
71115
71118
|
maximum_results: maxResults,
|
|
71116
71119
|
lines_in_each_result: linesInEachResult
|
|
71117
71120
|
})
|
|
@@ -71140,14 +71143,16 @@ var runSemanticSearchAndFormat = async ({
|
|
|
71140
71143
|
maxResults = DEFAULT_MAX_RESULTS,
|
|
71141
71144
|
rerank,
|
|
71142
71145
|
linesInEachResult,
|
|
71143
|
-
usePlatformizedSearch = true
|
|
71146
|
+
usePlatformizedSearch = true,
|
|
71147
|
+
extraDocumentTypes
|
|
71144
71148
|
}) => {
|
|
71145
71149
|
if (usePlatformizedSearch) {
|
|
71146
71150
|
return runPlatformizedSemanticSearch(
|
|
71147
71151
|
toolName,
|
|
71148
71152
|
toolParams.searchTerm,
|
|
71149
71153
|
maxResults,
|
|
71150
|
-
linesInEachResult
|
|
71154
|
+
linesInEachResult,
|
|
71155
|
+
extraDocumentTypes
|
|
71151
71156
|
);
|
|
71152
71157
|
} else {
|
|
71153
71158
|
const results = await runSemanticSearch(
|
|
@@ -71780,13 +71785,14 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
71780
71785
|
unzip(input: string | Uint8Array): Promise<Array<{ path: string; bytes: Uint8Array; text(): string }>>;
|
|
71781
71786
|
};
|
|
71782
71787
|
declare const siteId: string | undefined;
|
|
71783
|
-
// Files from the ExecuteWixAPI \`files\` param
|
|
71784
|
-
//
|
|
71785
|
-
//
|
|
71788
|
+
// Files from the ExecuteWixAPI \`files\` param, followed by the resolved
|
|
71789
|
+
// \`attachments\`. Text entries have \`content\`; an entry tagged
|
|
71790
|
+
// \`=== FILE: <path> base64 ===\` — and every attachment, path = its file name —
|
|
71791
|
+
// has encoding:'base64' and base64 \`content\`.
|
|
71786
71792
|
declare const files: Array<{ path: string; content: string; encoding?: "base64" }>;
|
|
71787
71793
|
\`\`\`
|
|
71788
71794
|
|
|
71789
|
-
FILE UPLOADS:
|
|
71795
|
+
FILE UPLOADS: files never go inline in \`code\`; two params feed the \`files\` global. \`attachments\` takes files attached in the chat or created in your file sandbox, of any type and size up to 10 MB per call (a zip of a whole site, HTML, images, PDFs): pass the files themselves, all in one call, and the platform resolves each into \`{ download_url, file_id, file_name?, mime_type? }\` — the bytes are fetched for you and arrive as base64 entries named by file name. The \`files\` param takes content you have as text here: text goes raw; a small binary (icon, logo, font) rides as a \`base64\`-tagged entry — large images/video are referenced by URL (\`<img src="https://...">\`), not bundled. \`wix.multipart()\` turns the whole set into one upload body (bytes, so binary is safe):
|
|
71790
71796
|
\`\`\`javascript
|
|
71791
71797
|
// files param:
|
|
71792
71798
|
// === FILE: index.html ===
|
|
@@ -71801,6 +71807,12 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
71801
71807
|
return res.data;
|
|
71802
71808
|
}
|
|
71803
71809
|
\`\`\`
|
|
71810
|
+
A site zip passed through \`attachments\` is one base64 entry; unzip it and upload the entries:
|
|
71811
|
+
\`\`\`javascript
|
|
71812
|
+
// attachments: [site.zip] → files = [{ path: "site.zip", content: "<base64>", encoding: "base64" }]
|
|
71813
|
+
const entries = await wix.unzip(files[0].content); // [{ path, bytes, text() }]
|
|
71814
|
+
const mp = wix.multipart(entries);
|
|
71815
|
+
\`\`\`
|
|
71804
71816
|
DOWNLOAD + EDIT + RE-UPLOAD: fetch the zip as base64, \`wix.unzip()\` it, edit text via \`entry.text()\`, keep binary as bytes, and hand the entries back to \`wix.multipart()\`:
|
|
71805
71817
|
\`\`\`javascript
|
|
71806
71818
|
const r = await wix.request({ scope: "account", method: "GET", responseType: "base64", url: zipUrl });
|
|
@@ -72005,12 +72017,12 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
72005
72017
|
NEVER call this tool with a missing, empty, or guessed siteId — ask first instead.
|
|
72006
72018
|
|
|
72007
72019
|
Parameters — provide image input via image and/or imageUrls, OR imageBase64:
|
|
72008
|
-
• image (array): chat file ATTACHMENTS. Each item is an object with download_url and file_id (both required), plus optional file_name and mime_type. Pass ALL attachments in one call.
|
|
72020
|
+
• image (array): chat file ATTACHMENTS — files the user attached, or files you created in your own file sandbox. Each item is an object with download_url and file_id (both required), plus optional file_name and mime_type. Pass ALL attachments in one call.
|
|
72009
72021
|
• imageUrls (array): plain public image URLs the user pasted or other tools produced (no file_id). Pass ALL URLs in one call. Can be combined with image.
|
|
72010
72022
|
• imageBase64 (string): base64-encoded image + mimeType. One image at a time. Do NOT combine with image/imageUrls.
|
|
72011
72023
|
|
|
72012
72024
|
Delivering the bytes — this is where uploads most often fail:
|
|
72013
|
-
•
|
|
72025
|
+
• Pass a file as a file, in image: the platform resolves it into download_url and file_id before it reaches this tool — this includes files you created in your sandbox. This server does not share your filesystem, so a bare path string (e.g. /mnt/..., /home/user/..., /Users/...) is not a file. Without a file to pass, use a public http(s) URL (imageUrls) or the complete base64 (imageBase64).
|
|
72014
72026
|
• imageBase64 must be the WHOLE file, not truncated. For large images prefer imageUrls, since long base64 is easily cut off and will be rejected as unreadable.
|
|
72015
72027
|
`,
|
|
72016
72028
|
SupportAndFeedback: dedent_default`
|
|
@@ -73224,7 +73236,7 @@ var paramDescriptions = {
|
|
|
73224
73236
|
},
|
|
73225
73237
|
SearchWixRESTDocumentation: {
|
|
73226
73238
|
searchTerm: `The search term to look up in the Wix REST API Documentation \u2014 a natural-language description of the endpoint, resource, or action you need across any Wix domain (Stores, eCommerce, Bookings, CRM, Members, CMS, Events, Blog, Forms, Media, site settings, etc.), e.g. "create a catalog item with inventory", "book a service", "update data collection items". Match the wording to how many entities you will act on: a plural term ("update products") surfaces the resource's bulk methods, which a singular term ("update a product") ranks lower or leaves out. Results are ranked by relevance, so describe the goal rather than guessing an exact API name.`,
|
|
73227
|
-
maxResults: "The maximum number of results to return, default
|
|
73239
|
+
maxResults: "The maximum number of results to return (1\u201317, default 17). Results mix REST API documentation with matching recipes and skills.",
|
|
73228
73240
|
reason: "One sentence describing the original user request and the task you are trying to accomplish with this search."
|
|
73229
73241
|
},
|
|
73230
73242
|
WixBusinessFlowsDocumentation: {
|
|
@@ -73245,7 +73257,7 @@ var paramDescriptions = {
|
|
|
73245
73257
|
},
|
|
73246
73258
|
SearchWixHeadlessDocumentation: {
|
|
73247
73259
|
searchTerm: "The search term to search for in the Headless Documentation",
|
|
73248
|
-
maxResults: "The maximum number of results to return, default
|
|
73260
|
+
maxResults: "The maximum number of results to return (1\u201317, default 17). Results mix Headless documentation with matching recipes and skills."
|
|
73249
73261
|
},
|
|
73250
73262
|
SearchWixVeloDocumentation: {
|
|
73251
73263
|
searchTerm: "The search term to search for in the Velo Documentation",
|
|
@@ -73273,7 +73285,7 @@ var paramDescriptions = {
|
|
|
73273
73285
|
},
|
|
73274
73286
|
UploadImageToWixSite: {
|
|
73275
73287
|
siteId: "The ID (UUID) of the Wix site to upload to. REQUIRED. If the user has not clearly specified which site, ASK them which site to upload to (or use ListWixSites to help them pick) BEFORE calling this tool. NEVER call this tool with a missing, empty, placeholder, or guessed siteId \u2014 ask first instead.",
|
|
73276
|
-
image: "Array of file ATTACHMENTS the user uploaded in the chat. Each item requires download_url and file_id, and may optionally include file_name and mime_type \u2014
|
|
73288
|
+
image: "Array of file ATTACHMENTS: files the user uploaded in the chat, or files you created in your own file sandbox. Each item requires download_url and file_id, and may optionally include file_name and mime_type \u2014 the platform resolves a file passed here into these fields automatically, so just include the files. For plain image URLs the user pasted, use imageUrls instead. ALWAYS pass ALL attachments together in a single call \u2014 NEVER call this tool once per image. Do NOT use together with imageBase64.",
|
|
73277
73289
|
imageUrls: "Array of publicly accessible image URLs (e.g. links the user pasted or URLs produced by other tools). Use this for plain URLs that are NOT chat attachments \u2014 no file_id is needed. ALWAYS pass ALL URLs together in a single call. Can be combined with image; do NOT use together with imageBase64.",
|
|
73278
73290
|
imageBase64: 'Base64-encoded image data. Use when the client can read a file and encode it as base64. May include a data URL prefix (e.g. "data:image/jpeg;base64,...") or be raw base64. Do NOT use together with image.',
|
|
73279
73291
|
mimeType: 'MIME type of the image (e.g. "image/jpeg", "image/png", "image/webp"). Required when imageBase64 does not include a data URL prefix.',
|
|
@@ -73943,7 +73955,7 @@ var addDocsTools = (server2, allowedTools = [
|
|
|
73943
73955
|
const d = desc("SearchWixRESTDocumentation");
|
|
73944
73956
|
return {
|
|
73945
73957
|
searchTerm: external_exports.string().describe(d.searchTerm),
|
|
73946
|
-
maxResults: external_exports.number().describe(d.maxResults).min(1).max(
|
|
73958
|
+
maxResults: external_exports.number().describe(d.maxResults).min(1).max(17).optional().default(17),
|
|
73947
73959
|
reason: external_exports.string().describe(d.reason)
|
|
73948
73960
|
};
|
|
73949
73961
|
})(),
|
|
@@ -73958,9 +73970,12 @@ var addDocsTools = (server2, allowedTools = [
|
|
|
73958
73970
|
toolParams: {
|
|
73959
73971
|
searchTerm
|
|
73960
73972
|
},
|
|
73961
|
-
maxResults: Math.max(1, Math.min(maxResults ??
|
|
73973
|
+
maxResults: Math.max(1, Math.min(maxResults ?? 17, 17)),
|
|
73962
73974
|
linesInEachResult: 30,
|
|
73963
|
-
usePlatformizedSearch
|
|
73975
|
+
usePlatformizedSearch,
|
|
73976
|
+
// Merge recipes/skills into the REST ranking — they live in a
|
|
73977
|
+
// separate corpus the REST document_type doesn't cover on its own.
|
|
73978
|
+
extraDocumentTypes: ["SKILLS"]
|
|
73964
73979
|
});
|
|
73965
73980
|
const grounding = result.includes(QUERY_CAPABILITY_MARKER) ? [
|
|
73966
73981
|
REST_SEARCH_API_GROUNDING_REMINDER,
|
|
@@ -74223,7 +74238,7 @@ var addDocsTools = (server2, allowedTools = [
|
|
|
74223
74238
|
const d = desc("SearchWixHeadlessDocumentation");
|
|
74224
74239
|
return {
|
|
74225
74240
|
searchTerm: external_exports.string().describe(d.searchTerm),
|
|
74226
|
-
maxResults: external_exports.number().describe(d.maxResults).min(1).max(
|
|
74241
|
+
maxResults: external_exports.number().describe(d.maxResults).min(1).max(17).optional().default(17)
|
|
74227
74242
|
};
|
|
74228
74243
|
})(),
|
|
74229
74244
|
{ readOnlyHint: true, destructiveHint: false, openWorldHint: false },
|
|
@@ -74235,8 +74250,11 @@ var addDocsTools = (server2, allowedTools = [
|
|
|
74235
74250
|
toolParams: {
|
|
74236
74251
|
searchTerm
|
|
74237
74252
|
},
|
|
74238
|
-
maxResults: Math.max(1, Math.min(maxResults ??
|
|
74239
|
-
usePlatformizedSearch
|
|
74253
|
+
maxResults: Math.max(1, Math.min(maxResults ?? 17, 17)),
|
|
74254
|
+
usePlatformizedSearch,
|
|
74255
|
+
// Merge recipes/skills into the headless ranking — same separate
|
|
74256
|
+
// corpus the WIX_HEADLESS document_type doesn't cover on its own.
|
|
74257
|
+
extraDocumentTypes: ["SKILLS"]
|
|
74240
74258
|
});
|
|
74241
74259
|
return {
|
|
74242
74260
|
content: [
|
package/build/cjs/index.cjs
CHANGED
|
@@ -36655,9 +36655,12 @@ var runSemanticSearch = async (toolName, toolParams, maxResults = 20, rerank = f
|
|
|
36655
36655
|
);
|
|
36656
36656
|
return data?.results;
|
|
36657
36657
|
};
|
|
36658
|
-
var runPlatformizedSemanticSearch = async (toolName, searchTerm, maxResults = 20, linesInEachResult) => {
|
|
36658
|
+
var runPlatformizedSemanticSearch = async (toolName, searchTerm, maxResults = 20, linesInEachResult, extraDocumentTypes) => {
|
|
36659
36659
|
const startTime = Date.now();
|
|
36660
|
-
|
|
36660
|
+
const documentTypes = extraDocumentTypes?.length ? [toolName, ...extraDocumentTypes] : void 0;
|
|
36661
|
+
logger2.log(
|
|
36662
|
+
`[SemanticSearch/v2] Tool: ${documentTypes ? documentTypes.join("+") : toolName}, Query: "${searchTerm}"`
|
|
36663
|
+
);
|
|
36661
36664
|
const response = await fetch(
|
|
36662
36665
|
"https://www.wixapis.com/mcp-docs-search/v1/docs/search/markdown",
|
|
36663
36666
|
{
|
|
@@ -36668,7 +36671,7 @@ var runPlatformizedSemanticSearch = async (toolName, searchTerm, maxResults = 20
|
|
|
36668
36671
|
},
|
|
36669
36672
|
body: JSON.stringify({
|
|
36670
36673
|
search_term: searchTerm,
|
|
36671
|
-
document_type: toolName,
|
|
36674
|
+
...documentTypes ? { document_types: documentTypes } : { document_type: toolName },
|
|
36672
36675
|
maximum_results: maxResults,
|
|
36673
36676
|
lines_in_each_result: linesInEachResult
|
|
36674
36677
|
})
|
|
@@ -36697,14 +36700,16 @@ var runSemanticSearchAndFormat = async ({
|
|
|
36697
36700
|
maxResults = DEFAULT_MAX_RESULTS,
|
|
36698
36701
|
rerank,
|
|
36699
36702
|
linesInEachResult,
|
|
36700
|
-
usePlatformizedSearch = true
|
|
36703
|
+
usePlatformizedSearch = true,
|
|
36704
|
+
extraDocumentTypes
|
|
36701
36705
|
}) => {
|
|
36702
36706
|
if (usePlatformizedSearch) {
|
|
36703
36707
|
return runPlatformizedSemanticSearch(
|
|
36704
36708
|
toolName,
|
|
36705
36709
|
toolParams.searchTerm,
|
|
36706
36710
|
maxResults,
|
|
36707
|
-
linesInEachResult
|
|
36711
|
+
linesInEachResult,
|
|
36712
|
+
extraDocumentTypes
|
|
36708
36713
|
);
|
|
36709
36714
|
} else {
|
|
36710
36715
|
const results = await runSemanticSearch(
|
|
@@ -37396,13 +37401,14 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
37396
37401
|
unzip(input: string | Uint8Array): Promise<Array<{ path: string; bytes: Uint8Array; text(): string }>>;
|
|
37397
37402
|
};
|
|
37398
37403
|
declare const siteId: string | undefined;
|
|
37399
|
-
// Files from the ExecuteWixAPI \`files\` param
|
|
37400
|
-
//
|
|
37401
|
-
//
|
|
37404
|
+
// Files from the ExecuteWixAPI \`files\` param, followed by the resolved
|
|
37405
|
+
// \`attachments\`. Text entries have \`content\`; an entry tagged
|
|
37406
|
+
// \`=== FILE: <path> base64 ===\` — and every attachment, path = its file name —
|
|
37407
|
+
// has encoding:'base64' and base64 \`content\`.
|
|
37402
37408
|
declare const files: Array<{ path: string; content: string; encoding?: "base64" }>;
|
|
37403
37409
|
\`\`\`
|
|
37404
37410
|
|
|
37405
|
-
FILE UPLOADS:
|
|
37411
|
+
FILE UPLOADS: files never go inline in \`code\`; two params feed the \`files\` global. \`attachments\` takes files attached in the chat or created in your file sandbox, of any type and size up to 10 MB per call (a zip of a whole site, HTML, images, PDFs): pass the files themselves, all in one call, and the platform resolves each into \`{ download_url, file_id, file_name?, mime_type? }\` — the bytes are fetched for you and arrive as base64 entries named by file name. The \`files\` param takes content you have as text here: text goes raw; a small binary (icon, logo, font) rides as a \`base64\`-tagged entry — large images/video are referenced by URL (\`<img src="https://...">\`), not bundled. \`wix.multipart()\` turns the whole set into one upload body (bytes, so binary is safe):
|
|
37406
37412
|
\`\`\`javascript
|
|
37407
37413
|
// files param:
|
|
37408
37414
|
// === FILE: index.html ===
|
|
@@ -37417,6 +37423,12 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
37417
37423
|
return res.data;
|
|
37418
37424
|
}
|
|
37419
37425
|
\`\`\`
|
|
37426
|
+
A site zip passed through \`attachments\` is one base64 entry; unzip it and upload the entries:
|
|
37427
|
+
\`\`\`javascript
|
|
37428
|
+
// attachments: [site.zip] → files = [{ path: "site.zip", content: "<base64>", encoding: "base64" }]
|
|
37429
|
+
const entries = await wix.unzip(files[0].content); // [{ path, bytes, text() }]
|
|
37430
|
+
const mp = wix.multipart(entries);
|
|
37431
|
+
\`\`\`
|
|
37420
37432
|
DOWNLOAD + EDIT + RE-UPLOAD: fetch the zip as base64, \`wix.unzip()\` it, edit text via \`entry.text()\`, keep binary as bytes, and hand the entries back to \`wix.multipart()\`:
|
|
37421
37433
|
\`\`\`javascript
|
|
37422
37434
|
const r = await wix.request({ scope: "account", method: "GET", responseType: "base64", url: zipUrl });
|
|
@@ -37621,12 +37633,12 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
37621
37633
|
NEVER call this tool with a missing, empty, or guessed siteId — ask first instead.
|
|
37622
37634
|
|
|
37623
37635
|
Parameters — provide image input via image and/or imageUrls, OR imageBase64:
|
|
37624
|
-
• image (array): chat file ATTACHMENTS. Each item is an object with download_url and file_id (both required), plus optional file_name and mime_type. Pass ALL attachments in one call.
|
|
37636
|
+
• image (array): chat file ATTACHMENTS — files the user attached, or files you created in your own file sandbox. Each item is an object with download_url and file_id (both required), plus optional file_name and mime_type. Pass ALL attachments in one call.
|
|
37625
37637
|
• imageUrls (array): plain public image URLs the user pasted or other tools produced (no file_id). Pass ALL URLs in one call. Can be combined with image.
|
|
37626
37638
|
• imageBase64 (string): base64-encoded image + mimeType. One image at a time. Do NOT combine with image/imageUrls.
|
|
37627
37639
|
|
|
37628
37640
|
Delivering the bytes — this is where uploads most often fail:
|
|
37629
|
-
•
|
|
37641
|
+
• Pass a file as a file, in image: the platform resolves it into download_url and file_id before it reaches this tool — this includes files you created in your sandbox. This server does not share your filesystem, so a bare path string (e.g. /mnt/..., /home/user/..., /Users/...) is not a file. Without a file to pass, use a public http(s) URL (imageUrls) or the complete base64 (imageBase64).
|
|
37630
37642
|
• imageBase64 must be the WHOLE file, not truncated. For large images prefer imageUrls, since long base64 is easily cut off and will be rejected as unreadable.
|
|
37631
37643
|
`,
|
|
37632
37644
|
SupportAndFeedback: dedent_default`
|
|
@@ -38878,7 +38890,7 @@ var paramDescriptions = {
|
|
|
38878
38890
|
},
|
|
38879
38891
|
SearchWixRESTDocumentation: {
|
|
38880
38892
|
searchTerm: `The search term to look up in the Wix REST API Documentation \u2014 a natural-language description of the endpoint, resource, or action you need across any Wix domain (Stores, eCommerce, Bookings, CRM, Members, CMS, Events, Blog, Forms, Media, site settings, etc.), e.g. "create a catalog item with inventory", "book a service", "update data collection items". Match the wording to how many entities you will act on: a plural term ("update products") surfaces the resource's bulk methods, which a singular term ("update a product") ranks lower or leaves out. Results are ranked by relevance, so describe the goal rather than guessing an exact API name.`,
|
|
38881
|
-
maxResults: "The maximum number of results to return, default
|
|
38893
|
+
maxResults: "The maximum number of results to return (1\u201317, default 17). Results mix REST API documentation with matching recipes and skills.",
|
|
38882
38894
|
reason: "One sentence describing the original user request and the task you are trying to accomplish with this search."
|
|
38883
38895
|
},
|
|
38884
38896
|
WixBusinessFlowsDocumentation: {
|
|
@@ -38899,7 +38911,7 @@ var paramDescriptions = {
|
|
|
38899
38911
|
},
|
|
38900
38912
|
SearchWixHeadlessDocumentation: {
|
|
38901
38913
|
searchTerm: "The search term to search for in the Headless Documentation",
|
|
38902
|
-
maxResults: "The maximum number of results to return, default
|
|
38914
|
+
maxResults: "The maximum number of results to return (1\u201317, default 17). Results mix Headless documentation with matching recipes and skills."
|
|
38903
38915
|
},
|
|
38904
38916
|
SearchWixVeloDocumentation: {
|
|
38905
38917
|
searchTerm: "The search term to search for in the Velo Documentation",
|
|
@@ -38927,7 +38939,7 @@ var paramDescriptions = {
|
|
|
38927
38939
|
},
|
|
38928
38940
|
UploadImageToWixSite: {
|
|
38929
38941
|
siteId: "The ID (UUID) of the Wix site to upload to. REQUIRED. If the user has not clearly specified which site, ASK them which site to upload to (or use ListWixSites to help them pick) BEFORE calling this tool. NEVER call this tool with a missing, empty, placeholder, or guessed siteId \u2014 ask first instead.",
|
|
38930
|
-
image: "Array of file ATTACHMENTS the user uploaded in the chat. Each item requires download_url and file_id, and may optionally include file_name and mime_type \u2014
|
|
38942
|
+
image: "Array of file ATTACHMENTS: files the user uploaded in the chat, or files you created in your own file sandbox. Each item requires download_url and file_id, and may optionally include file_name and mime_type \u2014 the platform resolves a file passed here into these fields automatically, so just include the files. For plain image URLs the user pasted, use imageUrls instead. ALWAYS pass ALL attachments together in a single call \u2014 NEVER call this tool once per image. Do NOT use together with imageBase64.",
|
|
38931
38943
|
imageUrls: "Array of publicly accessible image URLs (e.g. links the user pasted or URLs produced by other tools). Use this for plain URLs that are NOT chat attachments \u2014 no file_id is needed. ALWAYS pass ALL URLs together in a single call. Can be combined with image; do NOT use together with imageBase64.",
|
|
38932
38944
|
imageBase64: 'Base64-encoded image data. Use when the client can read a file and encode it as base64. May include a data URL prefix (e.g. "data:image/jpeg;base64,...") or be raw base64. Do NOT use together with image.',
|
|
38933
38945
|
mimeType: 'MIME type of the image (e.g. "image/jpeg", "image/png", "image/webp"). Required when imageBase64 does not include a data URL prefix.',
|
|
@@ -39597,7 +39609,7 @@ var addDocsTools = (server, allowedTools = [
|
|
|
39597
39609
|
const d2 = desc("SearchWixRESTDocumentation");
|
|
39598
39610
|
return {
|
|
39599
39611
|
searchTerm: external_exports.string().describe(d2.searchTerm),
|
|
39600
|
-
maxResults: external_exports.number().describe(d2.maxResults).min(1).max(
|
|
39612
|
+
maxResults: external_exports.number().describe(d2.maxResults).min(1).max(17).optional().default(17),
|
|
39601
39613
|
reason: external_exports.string().describe(d2.reason)
|
|
39602
39614
|
};
|
|
39603
39615
|
})(),
|
|
@@ -39612,9 +39624,12 @@ var addDocsTools = (server, allowedTools = [
|
|
|
39612
39624
|
toolParams: {
|
|
39613
39625
|
searchTerm
|
|
39614
39626
|
},
|
|
39615
|
-
maxResults: Math.max(1, Math.min(maxResults ??
|
|
39627
|
+
maxResults: Math.max(1, Math.min(maxResults ?? 17, 17)),
|
|
39616
39628
|
linesInEachResult: 30,
|
|
39617
|
-
usePlatformizedSearch
|
|
39629
|
+
usePlatformizedSearch,
|
|
39630
|
+
// Merge recipes/skills into the REST ranking — they live in a
|
|
39631
|
+
// separate corpus the REST document_type doesn't cover on its own.
|
|
39632
|
+
extraDocumentTypes: ["SKILLS"]
|
|
39618
39633
|
});
|
|
39619
39634
|
const grounding = result.includes(QUERY_CAPABILITY_MARKER) ? [
|
|
39620
39635
|
REST_SEARCH_API_GROUNDING_REMINDER,
|
|
@@ -39877,7 +39892,7 @@ var addDocsTools = (server, allowedTools = [
|
|
|
39877
39892
|
const d2 = desc("SearchWixHeadlessDocumentation");
|
|
39878
39893
|
return {
|
|
39879
39894
|
searchTerm: external_exports.string().describe(d2.searchTerm),
|
|
39880
|
-
maxResults: external_exports.number().describe(d2.maxResults).min(1).max(
|
|
39895
|
+
maxResults: external_exports.number().describe(d2.maxResults).min(1).max(17).optional().default(17)
|
|
39881
39896
|
};
|
|
39882
39897
|
})(),
|
|
39883
39898
|
{ readOnlyHint: true, destructiveHint: false, openWorldHint: false },
|
|
@@ -39889,8 +39904,11 @@ var addDocsTools = (server, allowedTools = [
|
|
|
39889
39904
|
toolParams: {
|
|
39890
39905
|
searchTerm
|
|
39891
39906
|
},
|
|
39892
|
-
maxResults: Math.max(1, Math.min(maxResults ??
|
|
39893
|
-
usePlatformizedSearch
|
|
39907
|
+
maxResults: Math.max(1, Math.min(maxResults ?? 17, 17)),
|
|
39908
|
+
usePlatformizedSearch,
|
|
39909
|
+
// Merge recipes/skills into the headless ranking — same separate
|
|
39910
|
+
// corpus the WIX_HEADLESS document_type doesn't cover on its own.
|
|
39911
|
+
extraDocumentTypes: ["SKILLS"]
|
|
39894
39912
|
});
|
|
39895
39913
|
return {
|
|
39896
39914
|
content: [
|
|
@@ -53122,6 +53140,189 @@ ${text.slice(0, 2e3)}`
|
|
|
53122
53140
|
);
|
|
53123
53141
|
}
|
|
53124
53142
|
|
|
53143
|
+
// src/code-mode/attachments.ts
|
|
53144
|
+
var MAX_ATTACHMENTS_BYTES = 10 * 1024 * 1024;
|
|
53145
|
+
var MAX_REDIRECTS = 4;
|
|
53146
|
+
var OAI_USERCONTENT_HOST = /^[a-z0-9-]+\.oaiusercontent\.com$/;
|
|
53147
|
+
var OAI_BLOB_ACCOUNTS = new Set(
|
|
53148
|
+
[
|
|
53149
|
+
"australiaeast",
|
|
53150
|
+
"brazilsouth",
|
|
53151
|
+
"cacentral",
|
|
53152
|
+
"centralindia",
|
|
53153
|
+
"centralus",
|
|
53154
|
+
"centralusdr",
|
|
53155
|
+
"denmarkeast",
|
|
53156
|
+
"eastus",
|
|
53157
|
+
"eastus2",
|
|
53158
|
+
"indiasocentral",
|
|
53159
|
+
"italynorth",
|
|
53160
|
+
"japaneast",
|
|
53161
|
+
"koreacentral",
|
|
53162
|
+
"northcentralus",
|
|
53163
|
+
"northeu",
|
|
53164
|
+
"nznorth",
|
|
53165
|
+
"polandcentral",
|
|
53166
|
+
"seasia",
|
|
53167
|
+
"southcentralus",
|
|
53168
|
+
"southeastus3",
|
|
53169
|
+
"ukwest",
|
|
53170
|
+
"westcentralus",
|
|
53171
|
+
"westus",
|
|
53172
|
+
"westus2",
|
|
53173
|
+
"westus3"
|
|
53174
|
+
].map((region) => `oaisdmntpr${region}.blob.core.windows.net`)
|
|
53175
|
+
);
|
|
53176
|
+
function isAllowedAttachmentHost(hostname2) {
|
|
53177
|
+
const h2 = hostname2.toLowerCase();
|
|
53178
|
+
return OAI_USERCONTENT_HOST.test(h2) || OAI_BLOB_ACCOUNTS.has(h2);
|
|
53179
|
+
}
|
|
53180
|
+
function checkAttachmentUrl(url) {
|
|
53181
|
+
if (url.protocol !== "https:") return "is not an https URL";
|
|
53182
|
+
if (url.port) return "uses a non-default port";
|
|
53183
|
+
if (!isAllowedAttachmentHost(url.hostname)) {
|
|
53184
|
+
return `host "${url.hostname}" is not a ChatGPT file host`;
|
|
53185
|
+
}
|
|
53186
|
+
return void 0;
|
|
53187
|
+
}
|
|
53188
|
+
var AttachmentError = class extends Error {
|
|
53189
|
+
};
|
|
53190
|
+
function attachmentPath(a2, url) {
|
|
53191
|
+
let fromUrl = "";
|
|
53192
|
+
try {
|
|
53193
|
+
fromUrl = decodeURIComponent(
|
|
53194
|
+
url.pathname.split("/").filter(Boolean).pop() ?? ""
|
|
53195
|
+
);
|
|
53196
|
+
} catch {
|
|
53197
|
+
fromUrl = "";
|
|
53198
|
+
}
|
|
53199
|
+
const raw = (a2.file_name?.trim() || fromUrl || a2.file_id).replace(/\\/g, "/");
|
|
53200
|
+
const segments = raw.split("/").filter((s2) => s2 && s2 !== "." && s2 !== "..");
|
|
53201
|
+
return segments.join("/") || a2.file_id;
|
|
53202
|
+
}
|
|
53203
|
+
function toBase64(bytes2) {
|
|
53204
|
+
let binary = "";
|
|
53205
|
+
const chunk = 32768;
|
|
53206
|
+
for (let i = 0; i < bytes2.length; i += chunk) {
|
|
53207
|
+
binary += String.fromCharCode(...bytes2.subarray(i, i + chunk));
|
|
53208
|
+
}
|
|
53209
|
+
return btoa(binary);
|
|
53210
|
+
}
|
|
53211
|
+
async function fetchAllowed(start, fetchImpl, label) {
|
|
53212
|
+
let url = start;
|
|
53213
|
+
for (let hop = 0; ; hop++) {
|
|
53214
|
+
const res = await fetchImpl(url.toString(), { redirect: "manual" });
|
|
53215
|
+
const location = res.headers.get("location");
|
|
53216
|
+
const isRedirect = res.status >= 300 && res.status < 400 && location;
|
|
53217
|
+
if (!isRedirect) return res;
|
|
53218
|
+
await res.body?.cancel().catch(() => void 0);
|
|
53219
|
+
if (hop >= MAX_REDIRECTS) {
|
|
53220
|
+
throw new AttachmentError(`${label}: too many redirects.`);
|
|
53221
|
+
}
|
|
53222
|
+
let next;
|
|
53223
|
+
try {
|
|
53224
|
+
next = new URL(location, url);
|
|
53225
|
+
} catch {
|
|
53226
|
+
throw new AttachmentError(`${label}: redirect to an invalid URL.`);
|
|
53227
|
+
}
|
|
53228
|
+
const problem = checkAttachmentUrl(next);
|
|
53229
|
+
if (problem) {
|
|
53230
|
+
throw new AttachmentError(
|
|
53231
|
+
`${label}: the download redirected to a URL that ${problem}; refused.`
|
|
53232
|
+
);
|
|
53233
|
+
}
|
|
53234
|
+
url = next;
|
|
53235
|
+
}
|
|
53236
|
+
}
|
|
53237
|
+
async function readWithin(res, budget, overBudget) {
|
|
53238
|
+
const declared = Number(res.headers.get("content-length") ?? 0);
|
|
53239
|
+
if (declared > budget) throw overBudget();
|
|
53240
|
+
if (!res.body) {
|
|
53241
|
+
const bytes2 = new Uint8Array(await res.arrayBuffer());
|
|
53242
|
+
if (bytes2.byteLength > budget) throw overBudget();
|
|
53243
|
+
return bytes2;
|
|
53244
|
+
}
|
|
53245
|
+
const reader = res.body.getReader();
|
|
53246
|
+
const chunks = [];
|
|
53247
|
+
let total = 0;
|
|
53248
|
+
for (; ; ) {
|
|
53249
|
+
const { done, value } = await reader.read();
|
|
53250
|
+
if (done) break;
|
|
53251
|
+
total += value.byteLength;
|
|
53252
|
+
if (total > budget) {
|
|
53253
|
+
await reader.cancel().catch(() => void 0);
|
|
53254
|
+
throw overBudget();
|
|
53255
|
+
}
|
|
53256
|
+
chunks.push(value);
|
|
53257
|
+
}
|
|
53258
|
+
const out = new Uint8Array(total);
|
|
53259
|
+
let offset = 0;
|
|
53260
|
+
for (const c of chunks) {
|
|
53261
|
+
out.set(c, offset);
|
|
53262
|
+
offset += c.byteLength;
|
|
53263
|
+
}
|
|
53264
|
+
return out;
|
|
53265
|
+
}
|
|
53266
|
+
async function resolveAttachments(attachments, fetchImpl = fetch) {
|
|
53267
|
+
if (!Array.isArray(attachments) || attachments.length === 0) return [];
|
|
53268
|
+
const items = [];
|
|
53269
|
+
attachments.forEach((raw, i) => {
|
|
53270
|
+
const a2 = typeof raw === "object" && raw;
|
|
53271
|
+
const downloadUrl = a2 && typeof a2.download_url === "string" ? a2.download_url : "";
|
|
53272
|
+
let url;
|
|
53273
|
+
try {
|
|
53274
|
+
url = /^https?:\/\//i.test(downloadUrl) ? new URL(downloadUrl) : void 0;
|
|
53275
|
+
} catch {
|
|
53276
|
+
url = void 0;
|
|
53277
|
+
}
|
|
53278
|
+
if (!a2 || !url) {
|
|
53279
|
+
throw new AttachmentError(
|
|
53280
|
+
`attachments[${i}] was not resolved to a download URL (got ${JSON.stringify(
|
|
53281
|
+
typeof raw === "string" ? raw : (a2 && a2.download_url) ?? raw
|
|
53282
|
+
)}). The platform did not hydrate this attachment; retry once, and if it still arrives like this put the file in the \`files\` bundle instead (\`=== FILE: <path> base64 ===\` for binary).`
|
|
53283
|
+
);
|
|
53284
|
+
}
|
|
53285
|
+
const problem = checkAttachmentUrl(url);
|
|
53286
|
+
if (problem) {
|
|
53287
|
+
throw new AttachmentError(
|
|
53288
|
+
`attachments[${i}].download_url ${problem}. Only platform-resolved attachments are accepted here; for any other URL fetch it in \`code\` via wix.request or put the bytes in the \`files\` bundle.`
|
|
53289
|
+
);
|
|
53290
|
+
}
|
|
53291
|
+
items.push({ a: a2, url });
|
|
53292
|
+
});
|
|
53293
|
+
let remaining = MAX_ATTACHMENTS_BYTES;
|
|
53294
|
+
const out = [];
|
|
53295
|
+
for (const [i, { a: a2, url }] of items.entries()) {
|
|
53296
|
+
const path = attachmentPath(a2, url);
|
|
53297
|
+
const label = `attachments[${i}] (${path})`;
|
|
53298
|
+
let res;
|
|
53299
|
+
try {
|
|
53300
|
+
res = await fetchAllowed(url, fetchImpl, label);
|
|
53301
|
+
} catch (e) {
|
|
53302
|
+
if (e instanceof AttachmentError) throw e;
|
|
53303
|
+
throw new AttachmentError(
|
|
53304
|
+
`${label}: download failed (${e.message}).`
|
|
53305
|
+
);
|
|
53306
|
+
}
|
|
53307
|
+
if (!res.ok) {
|
|
53308
|
+
await res.body?.cancel().catch(() => void 0);
|
|
53309
|
+
throw new AttachmentError(
|
|
53310
|
+
`${label}: download returned HTTP ${res.status}. The download_url may have expired; attach the file again.`
|
|
53311
|
+
);
|
|
53312
|
+
}
|
|
53313
|
+
const bytes2 = await readWithin(
|
|
53314
|
+
res,
|
|
53315
|
+
remaining,
|
|
53316
|
+
() => new AttachmentError(
|
|
53317
|
+
`${label} pushes the attachments past ${MAX_ATTACHMENTS_BYTES} bytes in total for this call; split the upload across calls.`
|
|
53318
|
+
)
|
|
53319
|
+
);
|
|
53320
|
+
remaining -= bytes2.byteLength;
|
|
53321
|
+
out.push({ path, content: toBase64(bytes2), encoding: "base64" });
|
|
53322
|
+
}
|
|
53323
|
+
return out;
|
|
53324
|
+
}
|
|
53325
|
+
|
|
53125
53326
|
// src/code-mode/validation.ts
|
|
53126
53327
|
var EXECUTE_FUNCTION_EXPRESSION_HINT = 'ExecuteWixAPI code must be a function expression, not a script body. Pass code like: async () => { const response = await wix.request({ scope: "site", method: "GET", url: "https://www.wixapis.com/..." }); return response.data; }. Do not write top-level const/await/return outside the function and do not invoke the function yourself.';
|
|
53127
53328
|
function validateExecuteCode(code) {
|
|
@@ -53354,7 +53555,7 @@ function addExecuteTool(server, options) {
|
|
|
53354
53555
|
} = options;
|
|
53355
53556
|
const executeUrl = `${codeModeBaseUrl}/api/code-mode/execute`;
|
|
53356
53557
|
const d2 = desc("ExecuteWixAPI");
|
|
53357
|
-
server.tool(
|
|
53558
|
+
const registered = server.tool(
|
|
53358
53559
|
EXECUTE_TOOL_NAME,
|
|
53359
53560
|
toolDescriptions?.[EXECUTE_TOOL_NAME] ?? defaultToolDescriptions.ExecuteWixAPI,
|
|
53360
53561
|
{
|
|
@@ -53383,6 +53584,20 @@ function addExecuteTool(server, options) {
|
|
|
53383
53584
|
'Use base64 entries for small assets (icons, logos, fonts) and for files you downloaded and are re-uploading; large images/video go in by URL (`<img src="https://...">`), not in the bundle. A file containing a line exactly like the delimiter is not supported.'
|
|
53384
53585
|
].join(" ")
|
|
53385
53586
|
),
|
|
53587
|
+
// ChatGPT file attachments (`openai/fileParams`). Item shape must match
|
|
53588
|
+
// OpenAI's file schema: download_url + file_id required, the rest optional.
|
|
53589
|
+
// Declaring it is what makes the platform hand us a download URL instead
|
|
53590
|
+
// of a sandbox path. Resolved host-side into base64 `files` entries.
|
|
53591
|
+
attachments: external_exports.array(
|
|
53592
|
+
external_exports.object({
|
|
53593
|
+
download_url: external_exports.string(),
|
|
53594
|
+
file_id: external_exports.string(),
|
|
53595
|
+
file_name: external_exports.string().optional(),
|
|
53596
|
+
mime_type: external_exports.string().optional()
|
|
53597
|
+
})
|
|
53598
|
+
).optional().describe(
|
|
53599
|
+
'Files attached in this chat, or files you created in your own file sandbox (any type: a zip of a site, HTML, images, PDFs). Pass the files themselves and the platform resolves each into { download_url, file_id, file_name?, mime_type? }; the bytes are fetched here and appended to the `files` global as { path, content, encoding: "base64" } entries (path = file_name), so `wix.multipart()` and `wix.unzip()` work on them unchanged. Prefer this over base64 in `files` whenever you have a file handle. Up to 10 MB per call.'
|
|
53600
|
+
),
|
|
53386
53601
|
// Visitor mode takes an agent-supplied token and pins the site; account/site
|
|
53387
53602
|
// mode lets the agent pick the site.
|
|
53388
53603
|
...visitor ? {
|
|
@@ -53397,7 +53612,15 @@ function addExecuteTool(server, options) {
|
|
|
53397
53612
|
},
|
|
53398
53613
|
{ readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
53399
53614
|
async (rawArgs, extra) => {
|
|
53400
|
-
const {
|
|
53615
|
+
const {
|
|
53616
|
+
code,
|
|
53617
|
+
reason,
|
|
53618
|
+
hasMutations,
|
|
53619
|
+
sourceDocUrls,
|
|
53620
|
+
visitorToken,
|
|
53621
|
+
files,
|
|
53622
|
+
attachments
|
|
53623
|
+
} = rawArgs;
|
|
53401
53624
|
const siteId = visitor ? visitor.siteId : rawArgs.siteId;
|
|
53402
53625
|
logger2.log(
|
|
53403
53626
|
`[ExecuteWixAPI]${visitor ? " (visitor)" : ""} Executing code (${code.length} chars), siteId=${siteId ?? "none"}, hasMutations=${hasMutations}, sourceDocUrls=${JSON.stringify(sourceDocUrls)}, reason="${reason}"`
|
|
@@ -53409,6 +53632,13 @@ function addExecuteTool(server, options) {
|
|
|
53409
53632
|
);
|
|
53410
53633
|
return executeTextResult(validation.error);
|
|
53411
53634
|
}
|
|
53635
|
+
let attachmentFiles = [];
|
|
53636
|
+
try {
|
|
53637
|
+
attachmentFiles = await resolveAttachments(attachments);
|
|
53638
|
+
} catch (e) {
|
|
53639
|
+
if (e instanceof AttachmentError) return executeErrorResult(e.message);
|
|
53640
|
+
throw e;
|
|
53641
|
+
}
|
|
53412
53642
|
const accountHeaders = await authStrategy?.getAccountAuthHeaders();
|
|
53413
53643
|
const siteAuthContext = !visitor && authStrategy?.getSiteAuthContext ? await authStrategy.getSiteAuthContext() : void 0;
|
|
53414
53644
|
let siteHeaders;
|
|
@@ -53443,7 +53673,8 @@ function addExecuteTool(server, options) {
|
|
|
53443
53673
|
accountToken: visitor ? visitorToken : accountHeaders?.Authorization,
|
|
53444
53674
|
accountId: accountHeaders?.["wix-account-id"],
|
|
53445
53675
|
siteAuthContext,
|
|
53446
|
-
...files ? { files } : {}
|
|
53676
|
+
...files ? { files } : {},
|
|
53677
|
+
...attachmentFiles.length ? { attachmentFiles } : {}
|
|
53447
53678
|
},
|
|
53448
53679
|
visitor ? visitorToken : accountHeaders?.Authorization ?? siteHeaders?.Authorization,
|
|
53449
53680
|
codeModeFetch
|
|
@@ -53474,6 +53705,9 @@ function addExecuteTool(server, options) {
|
|
|
53474
53705
|
}
|
|
53475
53706
|
}
|
|
53476
53707
|
);
|
|
53708
|
+
registered?.update?.({
|
|
53709
|
+
_meta: { ...registered._meta, "openai/fileParams": ["attachments"] }
|
|
53710
|
+
});
|
|
53477
53711
|
}
|
|
53478
53712
|
|
|
53479
53713
|
// src/toolkit.ts
|