@wix/mcp 1.0.93 → 1.0.94
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 +143 -193
- package/build/cjs/index.cjs +503 -196
- package/build/cjs/toolkit.cjs +471 -189
- package/build/dts/api-call/index.js +6 -3
- package/build/dts/api-call/site-files.d.ts +28 -0
- package/build/dts/api-call/site-files.js +194 -0
- package/build/dts/api-call/upload-headless-website-files.d.ts +35 -0
- package/build/dts/api-call/upload-headless-website-files.js +171 -0
- package/build/dts/bin.js +3 -6
- package/build/dts/code-mode/attachments.js +1 -1
- package/build/dts/code-mode/index.js +18 -4
- package/build/dts/config/default-config.d.ts +0 -4
- package/build/dts/config/default-config.js +36 -51
- package/build/dts/config/param-descriptions.js +2 -2
- package/build/dts/docs/docs.d.ts +4 -2
- package/build/dts/docs/docs.js +11 -7
- package/build/dts/docs/fetch-article.js +4 -1
- package/build/dts/docs/get-to-know.js +1 -1
- package/build/dts/docs/start-headless-build.d.ts +19 -0
- package/build/dts/docs/start-headless-build.js +74 -0
- package/build/dts/graphql/index.js +3 -1
- package/build/dts/import-claude-design-tool/index.js +2 -2
- package/build/dts/index.d.ts +1 -0
- package/build/dts/index.js +1 -0
- package/build/dts/site-widget-tools/search-site-templates-tool/index.js +17 -7
- package/build/dts/toolkit-entry.d.cts +4 -2
- package/build/dts/toolkit-entry.d.ts +4 -2
- package/build/dts/toolkit.js +9 -0
- package/build/dts/wix-mcp-server.d.ts +2 -0
- package/build/dts/wix-mcp-server.js +4 -0
- package/build/esm/index.js +501 -196
- package/build/esm/toolkit.js +471 -189
- package/package.json +2 -2
- package/build/dts/docs/create-site-guide.d.ts +0 -3
- package/build/dts/docs/create-site-guide.js +0 -109
package/build/cjs/toolkit.cjs
CHANGED
|
@@ -17280,7 +17280,7 @@ async function fetchArticle(articleUrl) {
|
|
|
17280
17280
|
}
|
|
17281
17281
|
var DOCS_URL_PREFIX = "https://dev.wix.com/docs/";
|
|
17282
17282
|
var SKILLS_REGISTRY_URL = new RegExp(
|
|
17283
|
-
"^https://(?:dev\\.wix\\.com(?:/docs)?|www\\.wix\\.com(?:/velo/reference)?)/skills(?:[/.?#]|$)"
|
|
17283
|
+
"^https://(?:dev\\.wix\\.com(?:/docs)?|www\\.wix\\.com(?:/velo/reference)?)/skills(?:[/.?#]|$)|^https://www\\.wix\\.com/headless/"
|
|
17284
17284
|
);
|
|
17285
17285
|
function isSkillsRegistryUrl(url) {
|
|
17286
17286
|
return SKILLS_REGISTRY_URL.test(url.trim());
|
|
@@ -17705,10 +17705,8 @@ function buildSystemReminderGuidelines(includeReadme, includeImageUploadGuidance
|
|
|
17705
17705
|
if (includeReadme) {
|
|
17706
17706
|
lines.push(
|
|
17707
17707
|
"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.",
|
|
17708
|
-
"**
|
|
17709
|
-
"
|
|
17710
|
-
"If the user \u2014 or you, earlier in this conversation \u2014 already have a finished page or site in any form (HTML/CSS/JS files, a static build, a zip, another builder's export, a design you can export to HTML) and want it live on Wix, call StartDeployWebsite right away \u2014 not a site-creation tool, not the docs.",
|
|
17711
|
-
"Never default to AI or search templates unless the user explicitly requests it. When the user named no creation method - let the user make that choice as the site-creation tools' descriptions direct. Never route normal site creation through ManageWixSite, CallWixSiteAPI, or ExecuteWixAPI."
|
|
17708
|
+
"**Creating a new Wix site \u2014 and only then \u2014 skip WixREADME and the docs.** First settle one thing: will the user keep working on this site with you, in code, or design it themselves in Wix's editor? In code \u2014 you or the user have code, the two of you designed it here, they asked you to build it, they asked for a headless site, or it is an app: StartDeployWebsite if the code exists in any form, StartHeadlessBuild if not, called right away (it only returns the guide; the site's purpose is not needed first). In Wix's editor: the site-creation tools; their descriptions carry the rules. Everything else starts with WixREADME as usual.",
|
|
17709
|
+
"Never default to AI or search templates unless the user explicitly requests it. When the user named no creation method - let the user make that choice as the site-creation tools' descriptions direct. Never route site creation through ManageWixSite, CallWixSiteAPI, or ExecuteWixAPI."
|
|
17712
17710
|
);
|
|
17713
17711
|
}
|
|
17714
17712
|
lines.push(
|
|
@@ -17756,9 +17754,8 @@ function buildSystemReminder(includeReadme, includeImageUploadGuidance = true) {
|
|
|
17756
17754
|
);
|
|
17757
17755
|
const flows = buildSystemReminderFlows(includeReadme);
|
|
17758
17756
|
return dedent_default`
|
|
17759
|
-
<
|
|
17760
|
-
|
|
17761
|
-
A FAILURE TO DO SO WILL RESULT IN ERRORS AND CRITICAL ISSUES.
|
|
17757
|
+
<wix-usage-guide>
|
|
17758
|
+
How to work with Wix through these tools. Following these steps avoids failed or incorrect API calls.
|
|
17762
17759
|
<goal>
|
|
17763
17760
|
${AGENT_GOAL}
|
|
17764
17761
|
</goal>
|
|
@@ -17768,7 +17765,7 @@ function buildSystemReminder(includeReadme, includeImageUploadGuidance = true) {
|
|
|
17768
17765
|
<flow-description>
|
|
17769
17766
|
${flows}
|
|
17770
17767
|
</flow-description>
|
|
17771
|
-
</
|
|
17768
|
+
</wix-usage-guide>
|
|
17772
17769
|
`;
|
|
17773
17770
|
}
|
|
17774
17771
|
var SYSTEM_REMINDER = buildSystemReminder(true);
|
|
@@ -17780,18 +17777,14 @@ var SITE_CREATION_COPY = {
|
|
|
17780
17777
|
unstatedMethod: {
|
|
17781
17778
|
nonWidget: "you MUST ask whether they want to build with AI or start from a template, and create nothing and show nothing until they answer",
|
|
17782
17779
|
widget: "you MUST call `WixSiteCreation` and let them choose"
|
|
17783
|
-
},
|
|
17784
|
-
normalCreationRoute: {
|
|
17785
|
-
nonWidget: "route those through `WixSiteBuilder` or `SearchSiteTemplates`",
|
|
17786
|
-
widget: "route those through `WixSiteCreation`"
|
|
17787
17780
|
}
|
|
17788
17781
|
};
|
|
17789
17782
|
var SITE_GUIDANCE = dedent_default`
|
|
17790
|
-
First decide
|
|
17791
|
-
-
|
|
17792
|
-
-
|
|
17783
|
+
First decide who keeps building the site:
|
|
17784
|
+
- **You, in code**: a Wix Headless site, with full control of the design, changed and redeployed from this conversation, Wix business features added as a backend. This is the case when you or the user have code (hand-written files, a static build, a zip, another builder's export, a page you made here): call StartDeployWebsite. It is also the case when nothing is coded yet but the user asked you to build it or asked for a headless site, the two of you worked out its design in this conversation, or it is an app (a game, a dashboard, a tool): call StartHeadlessBuild right away, before asking what the site is for. Do not offer AI or templates for either.
|
|
17785
|
+
- **The user, in Wix's editor**: Wix generates it with AI or starts it from a template, and the user designs it in Wix. That is what the site-creation tools do; they never take files you already have.
|
|
17793
17786
|
|
|
17794
|
-
For a new site there are two things to settle: what the site is for, and how to build it. The how is AI generation vs. starting from a template, so naming templates, a template id or Wix Studio (Wix Studio is also the template side) already settles it.
|
|
17787
|
+
For a new site in Wix's editor there are two things to settle: what the site is for, and how to build it. The how is AI generation vs. starting from a template, so naming templates, a template id or Wix Studio (Wix Studio is also the template side) already settles it.
|
|
17795
17788
|
|
|
17796
17789
|
Settle what the site is for first: its purpose, topic, business type, audience, or main visitor action. Naming a method is not a description of the site, and neither is the business or industry on its own.
|
|
17797
17790
|
If you can't tell yet, ask the preferred question below and nothing else — one question, no creation-method question in the same reply, and no internal tool names.
|
|
@@ -17811,6 +17804,7 @@ var toWidget = (text) => Object.values(SITE_CREATION_COPY).reduce(
|
|
|
17811
17804
|
);
|
|
17812
17805
|
var EXECUTE_WIX_API_INTRO = dedent_default`
|
|
17813
17806
|
Execute JavaScript code against the Wix REST API when code is useful for chaining related calls, pagination, loops, branching, or in-memory transformation.
|
|
17807
|
+
Putting a site live or changing a headless site's files starts with StartDeployWebsite; building a new site in code with StartHeadlessBuild.
|
|
17814
17808
|
|
|
17815
17809
|
CODE CONTRACT:
|
|
17816
17810
|
- Pass an async function expression: \`async function() { ... }\` or \`async () => { ... }\`. Put every declaration, \`await\`, and \`return\` inside it, and do not invoke it yourself.
|
|
@@ -17895,7 +17889,7 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
17895
17889
|
declare const files: Array<{ path: string; content: string; encoding?: "base64" }>;
|
|
17896
17890
|
\`\`\`
|
|
17897
17891
|
|
|
17898
|
-
FILE UPLOADS: files never go inline in \`code\`; two params feed the \`files\` global. \`attachments\`
|
|
17892
|
+
FILE UPLOADS: files never go inline in \`code\`; two params feed the \`files\` global. \`attachments\` works in ChatGPT only: pass files attached in the chat or created in your sandbox (any type, up to 10 MB per call: a zip of a whole site, HTML, images, PDFs) as you have them, by file id or /mnt/data path, all in one call. ChatGPT swaps each for \`{ download_url, file_id, file_name?, mime_type? }\` before the call reaches Wix, and the bytes arrive as base64 entries named by file name. Other clients send the value unchanged and the call fails before running; there, leave \`attachments\` out, or upload from your shell if it reaches the internet. 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):
|
|
17899
17893
|
\`\`\`javascript
|
|
17900
17894
|
// files param:
|
|
17901
17895
|
// === FILE: index.html ===
|
|
@@ -18056,7 +18050,7 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
18056
18050
|
ReadFullDocsArticle: dedent_default`
|
|
18057
18051
|
Fetches the full Wix docs article or method article with code examples for using the method.
|
|
18058
18052
|
Docs articles looks like this: https://dev.wix.com/docs/... and they can either be general docs articles or method articles.
|
|
18059
|
-
Also reads Wix skills pages — https://www.wix.com/skills/<skill>, https://dev.wix.com/docs/skills/<skill>, and the files they link (e.g. .../<skill>/references/<file>.md) — exactly as served.
|
|
18053
|
+
Also reads Wix skills pages — https://www.wix.com/skills/<skill>, https://dev.wix.com/docs/skills/<skill>, and the files they link (e.g. .../<skill>/references/<file>.md) — and Wix Headless agent pages under https://www.wix.com/headless/ (e.g. https://www.wix.com/headless/skill.md), exactly as served.
|
|
18060
18054
|
Take the URL from the user's message or an earlier tool result. To reach an article you have no URL for, search or browse the docs first.
|
|
18061
18055
|
For REST docs, use the URL as-is. For SDK docs, the URL SHOULD include ?apiView=SDK.
|
|
18062
18056
|
${reminder}
|
|
@@ -18104,7 +18098,7 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
18104
18098
|
${reminder}
|
|
18105
18099
|
`,
|
|
18106
18100
|
ManageWixSite: dedent_default`
|
|
18107
|
-
Use account level API in order to
|
|
18101
|
+
Use account level API in order to update a site.
|
|
18108
18102
|
Account-level only: this tool acts on the account itself, or on sites as objects within it, and sends no site context. Anything that reads or writes inside a site is site-level and does not belong here — use a site-level tool with that site's \`siteId\`.
|
|
18109
18103
|
For POST/PATCH/PUT requests, pass the request body as a JSON object or array 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"}} or body: [{"key": "value"}]).
|
|
18110
18104
|
The API endpoint url param MUST ALWAYS be taken from the conversation context.
|
|
@@ -18183,14 +18177,15 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
18183
18177
|
|
|
18184
18178
|
Do not call this if the user explicitly asks to build with AI; call \`WixSiteBuilder\` instead.
|
|
18185
18179
|
Do not call this if the user asks for templates or Wix Studio; call \`SearchSiteTemplates\` instead.
|
|
18180
|
+
Not for a site the user wants you to build in code, a design you worked out together, or an app: call \`StartHeadlessBuild\`.
|
|
18186
18181
|
|
|
18187
18182
|
When calling this tool, infer \`customActions\` from the user's request so the reply can be tailored — 2-3 concrete, industry-specific setup actions for the site (see the input's guidance).
|
|
18188
18183
|
|
|
18189
18184
|
After calling, you MUST speak the message provided in the tool result to the user as your reply — do not stay silent and do not replace it with a one-line pointer to the widget. Write out ALL of it, word for word: its opening line (the "Ready to set up your … site?" question INCLUDING "Choose your path in the widget above:"), BOTH of its option bullets, and its "Next up:" line, each on its own line and in that order. Do not summarize, shorten, drop any line, invent your own opener, rename the options, or add an intro or outro.
|
|
18190
18185
|
`,
|
|
18191
18186
|
"import-claude-design-from-url": dedent_default`
|
|
18192
|
-
Import a design created in Claude's design tool into Wix.
|
|
18193
|
-
NOT for
|
|
18187
|
+
Import a design created in Claude's design tool into Wix. Only for the signed \`claudeusercontent.com\` bundle URL Claude Design's "Send to Wix" produces (a self-contained HTML bundle with all images, fonts, and styles inlined). Creates a live Wix-hosted site and returns its URL.
|
|
18188
|
+
NOT for claude.ai share or artifact links, GitHub, Drive, chatgpt.com or any other URL, and not for files: those go to StartDeployWebsite, which returns the recipe to publish the files yourself.
|
|
18194
18189
|
`,
|
|
18195
18190
|
RunWixCliCommand: dedent_default`
|
|
18196
18191
|
Executes Wix CLI commands for Wix app development and management.
|
|
@@ -18627,23 +18622,23 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
18627
18622
|
Call this ONLY when the user's own words name AI (for example "create a site using AI" or "build it with AI") and the site intent is clear. A description of what the site should do — reservations, online ordering, a store, bookings, menus, a portfolio, and the like — is NOT a request for AI and NOT enough to call this tool; never infer AI from features or industry.
|
|
18628
18623
|
Never default to this tool: if the user hasn't explicitly named AI, don't call this tool — ${SITE_CREATION_COPY.unstatedMethod.nonWidget}.
|
|
18629
18624
|
|
|
18630
|
-
For templates or Wix Studio, call \`SearchSiteTemplates
|
|
18625
|
+
For templates or Wix Studio, call \`SearchSiteTemplates\` (\`builder: classic\` for the Classic Editor); for a template id, \`CreateSiteFromTemplate\`. A site the user wants you to build in code, or an app: \`StartHeadlessBuild\`.
|
|
18631
18626
|
|
|
18632
18627
|
Do NOT suggest HTML code, prompt templates, or alternative approaches instead of building — actually build the site through this tool. (HTML the user already has is the StartDeployWebsite case, not a reason to build.)
|
|
18633
18628
|
`,
|
|
18634
18629
|
SearchSiteTemplates: dedent_default`
|
|
18635
18630
|
${SITE_GUIDANCE}
|
|
18636
18631
|
|
|
18637
|
-
Searches Wix templates and shows the template gallery, from the Harmony or the
|
|
18632
|
+
Searches Wix templates and shows the template gallery, from the Harmony, the Studio or the Classic Editor template source.
|
|
18638
18633
|
|
|
18639
|
-
Call this ONLY when the user's own words ask for a template
|
|
18634
|
+
Call this ONLY when the user's own words ask for a template, for Wix Studio or for the Classic Editor (for example "start from a template", "show me some templates", "build it in Wix Studio", "the old Wix editor") and you can already tell what the site is for. If they mention Wix Studio, search Studio templates; if they ask for the Classic Editor (the Wix Editor), search \`classic\`; otherwise search Harmony templates.
|
|
18640
18635
|
${SITE_CREATION_COPY.templatePick.nonWidget}
|
|
18641
18636
|
|
|
18642
18637
|
A description of what the site should do — bookings, a store, a menu, a portfolio, and the like — is NOT a request for templates or for Wix Studio; never infer either from features or industry. Templates are not the default: if the site intent is clear but no method is named, do not guess — ${SITE_CREATION_COPY.unstatedMethod.nonWidget}.`,
|
|
18643
18638
|
CreateSiteFromTemplate: dedent_default`
|
|
18644
18639
|
Creates a Wix site from a specific template (by \`metaSiteId\` or \`templateId\`), publishes it when possible, and shows a live preview with links to the editor and the published site.
|
|
18645
18640
|
|
|
18646
|
-
Call this when the user provides a specific template by \`metaSiteId\` or \`templateId\`. Use this only when the user gives a valid \`metaSiteId\` or \`templateId\` directly. To browse or choose a template first, call \`SearchSiteTemplates
|
|
18641
|
+
Call this when the user provides a specific template by \`metaSiteId\` or \`templateId\`. Use this only when the user gives a valid \`metaSiteId\` or \`templateId\` directly. To browse or choose a template first, call \`SearchSiteTemplates\` (\`builder: classic\` for a Classic Editor site).
|
|
18647
18642
|
|
|
18648
18643
|
`,
|
|
18649
18644
|
SearchWixGraphQLOperations: dedent_default`
|
|
@@ -18671,34 +18666,24 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
18671
18666
|
Compose: put independent reads in one document as several root fields, and use related-entity fields (e.g. \`inventoryItems\`, \`collections\`, \`fulfillments\`) instead of extra round-trips. Select only the fields you need; every object field needs a selection set. Variables: use them for \`JSON\` scalars (filter, sort) and plain scalars (String, Int, ID), declared in the document (e.g. \`query Q($f: JSON) { ... filter: $f ... }\`). Write mutation inputs and any object that contains an enum INLINE as GraphQL literals with enum values unquoted (e.g. \`input: { product: { name: "Mug", productType: PHYSICAL } }\`) — this endpoint fails with 503 when an enum value arrives inside an object-typed variable. For lists page with \`cursorPaging\` or \`paging\` exactly as the input type declares (never the other one), and request \`pageInfo { hasNext total }\`; \`total\` is only populated with offset \`paging\`, so for a cursor-paged list count by walking pages or use a count operation.
|
|
18672
18667
|
Results: each root field fails independently — \`errors[].path\` names the failing field and \`errors[].extensions.message\` the cause (e.g. PERMISSION_DENIED); \`data\` still holds the fields that succeeded. Mutations return the created/updated entity — read the IDs from it and do not re-query to verify. Large results are truncated: narrow the selection or page size instead of re-running.
|
|
18673
18668
|
Set \`hasMutations: true\` for any document containing a mutation root field.
|
|
18669
|
+
`,
|
|
18670
|
+
UploadHeadlessWebsiteFiles: dedent_default`
|
|
18671
|
+
The upload step of the StartDeployWebsite and StartHeadlessBuild guides, and nothing else: puts a finished static website's files — index.html plus its CSS/JS/images, a static build, or a zip of the site — onto an existing Wix Headless site by its metaSiteId. Call it ONLY after one of them has returned its guide in this conversation and the site exists: for a new site, first run the recipe's provision call and pass the metaSiteId it returns; for a site deployed earlier, pass its metaSiteId. It does not create sites. Every upload replaces the whole file set and the URL stays. Returns the live URL and the dashboard link, and points back to the recipe for what comes next.
|
|
18672
|
+
Pass the files themselves: in ChatGPT as \`attachments\` (any type, a zip is unpacked), elsewhere as the \`files\` text bundle (\`=== FILE: <path> ===\` sections, \`base64\` tag for small binaries). The site must contain index.html at its root.
|
|
18673
|
+
NOT a site-creation tool: a request to create, build, design or generate a site — with or without a description — never comes here (those are the site-creation tools, after their own questions). Also NOT for media uploads to an existing site (UploadImageToWixSite) or any other API call (ExecuteWixAPI).
|
|
18674
18674
|
`,
|
|
18675
18675
|
StartDeployWebsite: dedent_default`
|
|
18676
|
-
The user — or you, earlier in this conversation — ALREADY HAVE a finished page or site, in any form, and it should be live on Wix — or an already-deployed Wix Headless site whose files should be replaced. The site can be HTML/CSS/JS files, a static build (dist/, out/), a zip, another AI builder's export, or a page/design you created in this conversation (export it to HTML first — a finished design IS a finished page). Call this when the user says deploy, host,
|
|
18676
|
+
The user — or you, earlier in this conversation — ALREADY HAVE a finished page or site, in any form, and it should be live on Wix — or an already-deployed Wix Headless site whose files should be replaced. The site can be HTML/CSS/JS files, a static build (dist/, out/), a zip, another AI builder's export, or a page/design you created in this conversation (export it to HTML first — a finished design IS a finished page). Call this when the user says deploy, host, put online, make it live, get a URL, upload my site / index.html, or wants to update or redeploy the files of a site you or the user deployed as code.
|
|
18677
18677
|
Updates keep the same site and URL. Also for implementing a backend on such a site as a Wix Headless project — same site, same URL. Works with or without a Wix login (anonymous deploy with a save link), through the Wix MCP alone or from a shell.
|
|
18678
18678
|
Missing real functionality — a fake checkout, a form that goes nowhere, bookings — is NOT a reason to rebuild the site with a site-creation tool: deploy the page as is, then add the backend afterwards (the recipe covers it).
|
|
18679
|
-
Returns the full recipe; follow it and run the flow yourself. The drop page is only the fallback when you can't.
|
|
18680
|
-
NOT for: a screenshot
|
|
18679
|
+
Returns the full recipe; follow it and run the flow yourself. When the UploadHeadlessWebsiteFiles tool is available, use it for the recipe's upload step — after the site exists (the recipe's provision call, or a metaSiteId from an earlier deploy) — instead of building the multipart body in code; never before this tool. The drop page is only the fallback when you can't.
|
|
18680
|
+
NOT for: a screenshot or reference of a site the user wants Wix to generate (the site-creation tools); a site described in words with no code yet (StartHeadlessBuild); a Wix editor site's content or settings (WixSiteBuilder's edit mode, or WixREADME); a Claude Design bundle URL (import-claude-design-from-url); migrating a live site by URL or CSV exports; adding HTML or code into an existing Wix site; uploading images or documents to a site's media (UploadImageToWixSite).
|
|
18681
18681
|
`,
|
|
18682
|
-
|
|
18683
|
-
|
|
18684
|
-
Call
|
|
18685
|
-
|
|
18686
|
-
|
|
18687
|
-
## What This Tool Contains
|
|
18688
|
-
|
|
18689
|
-
This tool provides complete documentation including:
|
|
18690
|
-
- Template selection (empty sites or designed templates)
|
|
18691
|
-
- Wix Editor vs Wix Studio options
|
|
18692
|
-
- Regular vs Headless site creation (CLI-based; returns setup instructions)
|
|
18693
|
-
- API endpoint details and parameters
|
|
18694
|
-
- Post-creation steps (OAuth for headless, publishing for regular sites)
|
|
18695
|
-
- App installation instructions
|
|
18696
|
-
|
|
18697
|
-
## After Reading This Documentation
|
|
18698
|
-
|
|
18699
|
-
**After reading this documentation:**
|
|
18700
|
-
1. Use ManageWixSite for account-level site creation API calls
|
|
18701
|
-
2. Use CallWixSiteAPI / ExecuteWixAPI for site-level follow-up API calls (like install apps if needed)`
|
|
18682
|
+
StartHeadlessBuild: dedent_default`
|
|
18683
|
+
The user wants a site or web app that you build and keep changing in code, here with them, and no code exists yet. Wix runs its business side (store, bookings, CMS, forms, members, payments) as a Wix Headless site. Call this when the user asks you to build it yourself rather than Wix's AI or a template; when the two of you worked out a design in this conversation and nothing is coded yet; when it is an app (a game, a dashboard, a tool); when the user asks for a headless site; when a prompt links \`wix.com/headless/skill.md\` or a project's \`download.zip\`; or to move a Wix site to code.
|
|
18684
|
+
Call it right away: it only returns the guide, and the site's purpose is not needed first (pass "not stated yet" for what you don't know). Returns the full guide; follow it and do the work yourself, choosing its route by what you can reach (a shell that reaches Wix, or this MCP alone).
|
|
18685
|
+
NOT for: files, a build, a zip or a page that already exist (StartDeployWebsite); a site the user will design in Wix's editor (the site-creation tools); a Claude Design URL (import-claude-design-from-url).
|
|
18686
|
+
`
|
|
18702
18687
|
};
|
|
18703
18688
|
}
|
|
18704
18689
|
var defaultToolDescriptions = buildToolDescriptions(true);
|
|
@@ -18710,9 +18695,9 @@ var recipesIndexDoc = {
|
|
|
18710
18695
|
action: "include"
|
|
18711
18696
|
};
|
|
18712
18697
|
var README_INTRO = dedent_default`
|
|
18713
|
-
<
|
|
18698
|
+
<wix-usage-guide>
|
|
18714
18699
|
|
|
18715
|
-
|
|
18700
|
+
How to work with Wix through these tools:
|
|
18716
18701
|
|
|
18717
18702
|
<source-of-truth>
|
|
18718
18703
|
Do not answer from memory about anything Wix-specific — this covers every part of your answer, not only API calls: any URL, link, ID, setting location, or product fact you give the user must come from the docs tools, the recipes below, a previous tool result in this conversation, or the user's own message (identifiers and URLs the user supplies are fine to use as given). If a recipe in the index below matches what the user asked for, read it before answering. For APIs, use the search, browse, read-docs, and schema tools as the source of truth for the exact URL, HTTP method, request body shape, response shape, field names, required fields, and enum values before calling an API.
|
|
@@ -18764,7 +18749,7 @@ var README_BODY = dedent_default`
|
|
|
18764
18749
|
<other-uses>
|
|
18765
18750
|
Beyond managing user sites, the Wix MCP tools can be used for any other purpose they support — for example, reading Wix SDK docs to write code against the SDK, using the Wix CLI to create apps, answering documentation questions, and so on.
|
|
18766
18751
|
</other-uses>
|
|
18767
|
-
</
|
|
18752
|
+
</wix-usage-guide>
|
|
18768
18753
|
`;
|
|
18769
18754
|
var defaultReadmeDocs = [
|
|
18770
18755
|
{
|
|
@@ -18820,8 +18805,7 @@ var widgetSiteCreationConfig = {
|
|
|
18820
18805
|
"WixSiteBuilder",
|
|
18821
18806
|
"WixSiteCreation",
|
|
18822
18807
|
"SearchSiteTemplates",
|
|
18823
|
-
"CreateSiteFromTemplate"
|
|
18824
|
-
"CreateWixBusinessGuide"
|
|
18808
|
+
"CreateSiteFromTemplate"
|
|
18825
18809
|
].map((tool) => [tool, toWidget(defaultToolDescriptions[tool])])
|
|
18826
18810
|
)
|
|
18827
18811
|
};
|
|
@@ -19410,7 +19394,7 @@ var paramDescriptions = {
|
|
|
19410
19394
|
reason: "One sentence describing the original user request and the task you are trying to accomplish with this search."
|
|
19411
19395
|
},
|
|
19412
19396
|
ReadFullDocsArticle: {
|
|
19413
|
-
articleUrl: "The URL of the docs article or method article to fetch. Should be something like https://dev.wix.com/docs/.../... For REST docs, use the URL as-is. For SDK docs, the URL SHOULD include the query param ?apiView=SDK (e.g. https://dev.wix.com/docs/...?apiView=SDK). Wix skills pages (https://www.wix.com/skills/..., https://dev.wix.com/docs/skills/...) are read as-is, including their referenced files."
|
|
19397
|
+
articleUrl: "The URL of the docs article or method article to fetch. Should be something like https://dev.wix.com/docs/.../... For REST docs, use the URL as-is. For SDK docs, the URL SHOULD include the query param ?apiView=SDK (e.g. https://dev.wix.com/docs/...?apiView=SDK). Wix skills pages (https://www.wix.com/skills/..., https://dev.wix.com/docs/skills/...) and Wix Headless agent pages (https://www.wix.com/headless/..., e.g. https://www.wix.com/headless/skill.md) are read as-is, including their referenced files."
|
|
19414
19398
|
},
|
|
19415
19399
|
ReadFullDocsMethodSchema: {
|
|
19416
19400
|
articleUrl: "The URL of the documentation to fetch. Should be something like https://dev.wix.com/docs/.../... For REST docs, use the URL as-is. For SDK docs, the URL SHOULD include the query param ?apiView=SDK (e.g. https://dev.wix.com/docs/...?apiView=SDK).",
|
|
@@ -19450,7 +19434,7 @@ var paramDescriptions = {
|
|
|
19450
19434
|
operationName: "Operation to run when the document defines more than one named operation.",
|
|
19451
19435
|
siteId: "The Wix site to run against. Required for site-level operations (anything reading or writing inside a site \u2014 products, orders, contacts, bookings, CMS, blog, members ...). Resolve it with GetSiteContext or ListWixSites; never pass a guessed value.",
|
|
19452
19436
|
scope: '"site" (default when siteId is given) runs with a site-scoped credential; "account" runs account-level operations (sites, account settings) and ignores siteId.',
|
|
19453
|
-
hasMutations: "
|
|
19437
|
+
hasMutations: "True if the document contains a mutation root field in any of its operations; false if it contains only queries. A transient server error is retried only when this is false.",
|
|
19454
19438
|
reason: "One sentence explaining the original user request and why you are running this GraphQL operation to complete it."
|
|
19455
19439
|
},
|
|
19456
19440
|
RunWixCliCommand: {
|
|
@@ -19714,121 +19698,6 @@ ${skillsContent}`
|
|
|
19714
19698
|
);
|
|
19715
19699
|
}
|
|
19716
19700
|
|
|
19717
|
-
// src/docs/create-site-guide.ts
|
|
19718
|
-
function isHeadlessRequest(prompt) {
|
|
19719
|
-
return !!prompt && /headless/i.test(prompt);
|
|
19720
|
-
}
|
|
19721
|
-
var HEADLESS_NON_CLI_INSTRUCTIONS = `# Creating a Wix Headless Site
|
|
19722
|
-
|
|
19723
|
-
Wix Headless sites require the **Wix CLI** and cannot be created from the Wix dashboard or via REST API alone. Let the user know they need to set up a local development environment with the Wix CLI before proceeding.
|
|
19724
|
-
|
|
19725
|
-
## Prerequisites
|
|
19726
|
-
- Node.js 18+
|
|
19727
|
-
- A terminal / command-line environment
|
|
19728
|
-
|
|
19729
|
-
## Steps to Get Started
|
|
19730
|
-
|
|
19731
|
-
1. **Install and authenticate the Wix CLI:**
|
|
19732
|
-
\`\`\`
|
|
19733
|
-
npx @wix/cli login
|
|
19734
|
-
\`\`\`
|
|
19735
|
-
2. **Follow the quick-start guide:** https://dev.wix.com/docs/go-headless
|
|
19736
|
-
3. **For a complete orchestrated setup** (commerce, CMS, bookings, identity), use the Wix Headless skill: https://www.wix-headless.dev/skill.md`;
|
|
19737
|
-
var HEADLESS_CLI_INSTRUCTIONS = `# Creating a Wix Headless Site (CLI Flow)
|
|
19738
|
-
|
|
19739
|
-
Follow these steps using the \`RunWixCliCommand\` tool to scaffold and configure a Wix Headless site.
|
|
19740
|
-
|
|
19741
|
-
## Before You Start
|
|
19742
|
-
Ask the user:
|
|
19743
|
-
1. What is the brand/site name?
|
|
19744
|
-
2. Which local directory should the project be created in?
|
|
19745
|
-
|
|
19746
|
-
## Steps
|
|
19747
|
-
|
|
19748
|
-
### Step 1 \u2014 Authenticate (if not already done)
|
|
19749
|
-
Run: \`npx @wix/cli login\`
|
|
19750
|
-
Skip if the user is already authenticated.
|
|
19751
|
-
|
|
19752
|
-
### Step 2 \u2014 Scaffold the project
|
|
19753
|
-
Use a Wix headless starter template. Ask the user which starter they prefer, or use the default Next.js starter. Follow the scaffolding instructions at: https://dev.wix.com/docs/go-headless
|
|
19754
|
-
|
|
19755
|
-
### Step 3 \u2014 Install dependencies
|
|
19756
|
-
Run: \`npm install\` in the project directory.
|
|
19757
|
-
|
|
19758
|
-
### Step 4 \u2014 Pull environment variables
|
|
19759
|
-
Run: \`npx @wix/cli env pull\`
|
|
19760
|
-
This writes the \`.env.local\` file with the site's environment variables.
|
|
19761
|
-
|
|
19762
|
-
### Step 5 \u2014 Build and verify
|
|
19763
|
-
Run: \`npx @wix/cli build\`
|
|
19764
|
-
|
|
19765
|
-
### Step 6 \u2014 Release (optional)
|
|
19766
|
-
Run: \`npx @wix/cli release\` to deploy.
|
|
19767
|
-
|
|
19768
|
-
## Full Orchestration
|
|
19769
|
-
For a complete multi-wave headless setup (commerce, CMS, bookings, design system, content seeding), refer to the Wix Headless skill: https://www.wix-headless.dev/skill.md
|
|
19770
|
-
|
|
19771
|
-
Use \`RunWixCliCommand\` for each CLI step above.`;
|
|
19772
|
-
var CREATE_SITE_DOCS = [
|
|
19773
|
-
{
|
|
19774
|
-
url: "https://dev.wix.com/docs/kb-only/MCP_REST_RECIPES_KB_ID/TRAIN_create_a_new_site_from_template",
|
|
19775
|
-
title: "How to Create a New Wix Site",
|
|
19776
|
-
nextSteps: "\n\n**Next Steps:** Use the ManageWixSite tool to make the API call for creating the Wix site."
|
|
19777
|
-
},
|
|
19778
|
-
{
|
|
19779
|
-
url: "https://dev.wix.com/docs/kb-only/MCP_REST_RECIPES_KB_ID/TRAIN_wix.devcenter.apps.installer.v1.AppsInstallerService.InstallApp",
|
|
19780
|
-
title: "How to Install App on a Wix Site",
|
|
19781
|
-
nextSteps: "\n\n**Next Steps:** Use the CallWixSiteAPI tool to make the API call for installing apps on the Wix site."
|
|
19782
|
-
}
|
|
19783
|
-
];
|
|
19784
|
-
async function addCreateWixBusinessGuideTools(server, disableTools = [], toolDescriptions, cliEnabled = false) {
|
|
19785
|
-
if (disableTools.includes("CreateWixBusinessGuide")) {
|
|
19786
|
-
return;
|
|
19787
|
-
}
|
|
19788
|
-
server.tool(
|
|
19789
|
-
"CreateWixBusinessGuide",
|
|
19790
|
-
toolDescriptions?.["CreateWixBusinessGuide"] ?? defaultToolDescriptions.CreateWixBusinessGuide,
|
|
19791
|
-
{
|
|
19792
|
-
userPrompt: external_exports.string().optional().describe("The user prompt that triggered this tool")
|
|
19793
|
-
},
|
|
19794
|
-
{ readOnlyHint: true, destructiveHint: false, openWorldHint: false },
|
|
19795
|
-
async (args, { httpClient }) => {
|
|
19796
|
-
if (isHeadlessRequest(args.userPrompt)) {
|
|
19797
|
-
const isCli = typeof cliEnabled === "function" ? cliEnabled() : cliEnabled;
|
|
19798
|
-
const text = isCli ? HEADLESS_CLI_INSTRUCTIONS : HEADLESS_NON_CLI_INSTRUCTIONS;
|
|
19799
|
-
return { content: [{ type: "text", text }] };
|
|
19800
|
-
}
|
|
19801
|
-
try {
|
|
19802
|
-
const contents = await Promise.all(
|
|
19803
|
-
CREATE_SITE_DOCS.map(async ({ url, title, nextSteps }) => {
|
|
19804
|
-
const articleContent = await fetchArticleContent(
|
|
19805
|
-
httpClient,
|
|
19806
|
-
url,
|
|
19807
|
-
"article",
|
|
19808
|
-
true
|
|
19809
|
-
);
|
|
19810
|
-
const fullContent = `# ${title}
|
|
19811
|
-
|
|
19812
|
-
${articleContent}${nextSteps}`;
|
|
19813
|
-
return { type: "text", text: fullContent };
|
|
19814
|
-
})
|
|
19815
|
-
);
|
|
19816
|
-
return { content: contents };
|
|
19817
|
-
} catch (error) {
|
|
19818
|
-
return {
|
|
19819
|
-
isError: true,
|
|
19820
|
-
content: [
|
|
19821
|
-
{
|
|
19822
|
-
type: "text",
|
|
19823
|
-
text: `Error fetching create site documentation: ${error.message}`
|
|
19824
|
-
}
|
|
19825
|
-
]
|
|
19826
|
-
};
|
|
19827
|
-
}
|
|
19828
|
-
}
|
|
19829
|
-
);
|
|
19830
|
-
}
|
|
19831
|
-
|
|
19832
19701
|
// src/docs/start-deploy-website.ts
|
|
19833
19702
|
var START_DEPLOY_WEBSITE_PARAM_DESCRIPTIONS = {
|
|
19834
19703
|
userRequest: "The user's request that led here, quoted if short, otherwise summarized in a sentence.",
|
|
@@ -19900,6 +19769,87 @@ function addStartDeployWebsiteTool(server, disableTools = [], toolDescriptions,
|
|
|
19900
19769
|
);
|
|
19901
19770
|
}
|
|
19902
19771
|
|
|
19772
|
+
// src/docs/start-headless-build.ts
|
|
19773
|
+
var START_HEADLESS_BUILD_TOOL_NAME = "StartHeadlessBuild";
|
|
19774
|
+
var HEADLESS_GUIDE_URL = "https://www.wix.com/skills/headless-cold-start/headless-kit.md";
|
|
19775
|
+
var START_HEADLESS_BUILD_STARTING_POINTS = [
|
|
19776
|
+
"nothing yet",
|
|
19777
|
+
"a design worked out in this conversation",
|
|
19778
|
+
"an existing Wix Headless site",
|
|
19779
|
+
"a project download link",
|
|
19780
|
+
"a Wix site to move to code"
|
|
19781
|
+
];
|
|
19782
|
+
var START_HEADLESS_BUILD_PARAM_DESCRIPTIONS = {
|
|
19783
|
+
userRequest: START_DEPLOY_WEBSITE_PARAM_DESCRIPTIONS.userRequest,
|
|
19784
|
+
siteDescription: START_DEPLOY_WEBSITE_PARAM_DESCRIPTIONS.siteDescription,
|
|
19785
|
+
startingPoint: "What the build starts from: nothing yet; a design worked out in this conversation; an existing Wix Headless site; a project download link (a download.zip from Wix); or a Wix site to move to code.",
|
|
19786
|
+
siteFunctionality: START_DEPLOY_WEBSITE_PARAM_DESCRIPTIONS.siteFunctionality,
|
|
19787
|
+
agentIdentity: START_DEPLOY_WEBSITE_PARAM_DESCRIPTIONS.agentIdentity,
|
|
19788
|
+
wixAccess: START_DEPLOY_WEBSITE_PARAM_DESCRIPTIONS.wixAccess
|
|
19789
|
+
};
|
|
19790
|
+
var PREFIX2 = "The following is Wix's headless guide. Follow it end to end and do the work yourself. If you find the user already has the site's code, call StartDeployWebsite instead.";
|
|
19791
|
+
var MOVE_TO_CODE_LINE = `Moving a Wix site to code starts from the site's dashboard (Headless settings, "Go Headless"), which hands the owner a prompt with the project's download link. Ask the user for that prompt, then follow the guide with it.`;
|
|
19792
|
+
function startHeadlessBuildResponse(guide, startingPoint) {
|
|
19793
|
+
const lines = [];
|
|
19794
|
+
if (startingPoint === "a Wix site to move to code") {
|
|
19795
|
+
lines.push(MOVE_TO_CODE_LINE);
|
|
19796
|
+
}
|
|
19797
|
+
if (guide && guide.trim()) {
|
|
19798
|
+
lines.push(PREFIX2, "---", guide.trim());
|
|
19799
|
+
} else {
|
|
19800
|
+
lines.push(
|
|
19801
|
+
`Wix's headless guide could not be loaded here. It is at ${HEADLESS_GUIDE_URL}: read it whole with ReadFullDocsArticle if you have that tool, otherwise fetch it with curl or your web tool, then follow it end to end and do the work yourself. If you find the user already has the site's code, call StartDeployWebsite instead.`
|
|
19802
|
+
);
|
|
19803
|
+
}
|
|
19804
|
+
return lines.join("\n\n");
|
|
19805
|
+
}
|
|
19806
|
+
function addStartHeadlessBuildTool(server, disableTools = [], toolDescriptions, fetchOptions = {}) {
|
|
19807
|
+
if (disableTools.includes(START_HEADLESS_BUILD_TOOL_NAME)) {
|
|
19808
|
+
return;
|
|
19809
|
+
}
|
|
19810
|
+
const d = START_HEADLESS_BUILD_PARAM_DESCRIPTIONS;
|
|
19811
|
+
server.tool(
|
|
19812
|
+
START_HEADLESS_BUILD_TOOL_NAME,
|
|
19813
|
+
toolDescriptions?.[START_HEADLESS_BUILD_TOOL_NAME] ?? defaultToolDescriptions[START_HEADLESS_BUILD_TOOL_NAME],
|
|
19814
|
+
{
|
|
19815
|
+
userRequest: external_exports.string().min(1).describe(d.userRequest),
|
|
19816
|
+
siteDescription: external_exports.string().min(1).describe(d.siteDescription),
|
|
19817
|
+
startingPoint: external_exports.enum(START_HEADLESS_BUILD_STARTING_POINTS).describe(d.startingPoint),
|
|
19818
|
+
siteFunctionality: external_exports.string().min(1).describe(d.siteFunctionality),
|
|
19819
|
+
agentIdentity: external_exports.string().min(1).describe(d.agentIdentity),
|
|
19820
|
+
wixAccess: external_exports.string().min(1).describe(d.wixAccess)
|
|
19821
|
+
},
|
|
19822
|
+
{ readOnlyHint: true, destructiveHint: false, openWorldHint: false },
|
|
19823
|
+
async (args, { httpClient }) => {
|
|
19824
|
+
let guide;
|
|
19825
|
+
try {
|
|
19826
|
+
guide = await fetchArticleContent(
|
|
19827
|
+
httpClient,
|
|
19828
|
+
HEADLESS_GUIDE_URL,
|
|
19829
|
+
"article",
|
|
19830
|
+
true,
|
|
19831
|
+
fetchOptions.skillsPortalUrl,
|
|
19832
|
+
fetchOptions.repo,
|
|
19833
|
+
fetchOptions.commitHash
|
|
19834
|
+
);
|
|
19835
|
+
} catch (error) {
|
|
19836
|
+
console.warn(
|
|
19837
|
+
"[StartHeadlessBuild] guide fetch failed, returning the pointer:",
|
|
19838
|
+
error instanceof Error ? error.message : error
|
|
19839
|
+
);
|
|
19840
|
+
}
|
|
19841
|
+
return {
|
|
19842
|
+
content: [
|
|
19843
|
+
{
|
|
19844
|
+
type: "text",
|
|
19845
|
+
text: startHeadlessBuildResponse(guide, args.startingPoint)
|
|
19846
|
+
}
|
|
19847
|
+
]
|
|
19848
|
+
};
|
|
19849
|
+
}
|
|
19850
|
+
);
|
|
19851
|
+
}
|
|
19852
|
+
|
|
19903
19853
|
// src/docs/docs.ts
|
|
19904
19854
|
var REST_SEARCH_API_GROUNDING_REMINDER = dedent_default`
|
|
19905
19855
|
# Before calling a Wix API
|
|
@@ -19947,8 +19897,8 @@ var addDocsTools = (server, allowedTools = [
|
|
|
19947
19897
|
], options = {}) => {
|
|
19948
19898
|
const {
|
|
19949
19899
|
getToKnowWixEnabled = false,
|
|
19950
|
-
createWixBusinessGuideEnabled = true,
|
|
19951
19900
|
startDeployWebsiteEnabled = true,
|
|
19901
|
+
startHeadlessBuildEnabled = true,
|
|
19952
19902
|
disableTools,
|
|
19953
19903
|
toolDescriptions,
|
|
19954
19904
|
readmeDocs,
|
|
@@ -19960,7 +19910,6 @@ var addDocsTools = (server, allowedTools = [
|
|
|
19960
19910
|
commitHash,
|
|
19961
19911
|
skillsTags,
|
|
19962
19912
|
dynamicContextEnabled,
|
|
19963
|
-
cliEnabled = false,
|
|
19964
19913
|
usePlatformizedSearch = true,
|
|
19965
19914
|
usePlatformizedBrowse = true
|
|
19966
19915
|
} = options;
|
|
@@ -20006,14 +19955,6 @@ var addDocsTools = (server, allowedTools = [
|
|
|
20006
19955
|
skillsTags
|
|
20007
19956
|
});
|
|
20008
19957
|
}
|
|
20009
|
-
if (createWixBusinessGuideEnabled && !disableTools?.includes("CreateWixBusinessGuide")) {
|
|
20010
|
-
addCreateWixBusinessGuideTools(
|
|
20011
|
-
server,
|
|
20012
|
-
disableTools || [],
|
|
20013
|
-
toolDescriptions,
|
|
20014
|
-
cliEnabled
|
|
20015
|
-
);
|
|
20016
|
-
}
|
|
20017
19958
|
if (startDeployWebsiteEnabled) {
|
|
20018
19959
|
addStartDeployWebsiteTool(server, disableTools || [], toolDescriptions, {
|
|
20019
19960
|
skillsPortalUrl,
|
|
@@ -20021,6 +19962,13 @@ var addDocsTools = (server, allowedTools = [
|
|
|
20021
19962
|
commitHash: effectiveCommitHash
|
|
20022
19963
|
});
|
|
20023
19964
|
}
|
|
19965
|
+
if (startHeadlessBuildEnabled) {
|
|
19966
|
+
addStartHeadlessBuildTool(server, disableTools || [], toolDescriptions, {
|
|
19967
|
+
skillsPortalUrl,
|
|
19968
|
+
repo: effectiveRepo,
|
|
19969
|
+
commitHash: effectiveCommitHash
|
|
19970
|
+
});
|
|
19971
|
+
}
|
|
20024
19972
|
if (allowedTools.includes("WDS") && !disableTools?.includes("SearchWixWDSDocumentation")) {
|
|
20025
19973
|
server.tool(
|
|
20026
19974
|
"SearchWixWDSDocumentation",
|
|
@@ -20550,7 +20498,7 @@ var addDocsTools = (server, allowedTools = [
|
|
|
20550
20498
|
content: [
|
|
20551
20499
|
{
|
|
20552
20500
|
type: "text",
|
|
20553
|
-
text: `Invalid article URL: must start with https://dev.wix.com/docs/, or be a Wix skills page (https://www.wix.com/skills/...). Got: "${articleUrl}"`
|
|
20501
|
+
text: `Invalid article URL: must start with https://dev.wix.com/docs/, or be a Wix skills page (https://www.wix.com/skills/..., https://www.wix.com/headless/...). Got: "${articleUrl}"`
|
|
20554
20502
|
}
|
|
20555
20503
|
]
|
|
20556
20504
|
};
|
|
@@ -21275,10 +21223,12 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
|
|
|
21275
21223
|
sourceDocUrl: external_exports.string().describe(d.sourceDocUrl)
|
|
21276
21224
|
};
|
|
21277
21225
|
})(),
|
|
21226
|
+
// openWorldHint true: a free-form URL into the whole Wix REST surface is an
|
|
21227
|
+
// open-ended target, even though auth is bounded to the user's account.
|
|
21278
21228
|
getHints("CallWixSiteAPI", {
|
|
21279
21229
|
readOnlyHint: false,
|
|
21280
21230
|
destructiveHint: true,
|
|
21281
|
-
openWorldHint:
|
|
21231
|
+
openWorldHint: true
|
|
21282
21232
|
}),
|
|
21283
21233
|
async ({ url, body, method, siteId, reason, sourceDocUrl }, { httpClient, setToolBiParams }) => {
|
|
21284
21234
|
logger.log(
|
|
@@ -21455,7 +21405,7 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
|
|
|
21455
21405
|
getHints("ManageWixSite", {
|
|
21456
21406
|
readOnlyHint: false,
|
|
21457
21407
|
destructiveHint: true,
|
|
21458
|
-
openWorldHint:
|
|
21408
|
+
openWorldHint: true
|
|
21459
21409
|
}),
|
|
21460
21410
|
async ({ url, body, method, reason }, { httpClient, setToolBiParams }) => {
|
|
21461
21411
|
logger.log(
|
|
@@ -22211,7 +22161,8 @@ function addExecuteGraphqlTool(server, description, authStrategy, options) {
|
|
|
22211
22161
|
hasMutations: external_exports.boolean().describe(d.hasMutations),
|
|
22212
22162
|
reason: external_exports.string().describe(d.reason)
|
|
22213
22163
|
},
|
|
22214
|
-
|
|
22164
|
+
// openWorldHint true: any operation in the Wix GraphQL schema, chosen at call time.
|
|
22165
|
+
{ readOnlyHint: false, destructiveHint: true, openWorldHint: true },
|
|
22215
22166
|
async ({ query, variables, operationName, siteId, scope, hasMutations, reason }, extra) => {
|
|
22216
22167
|
const effectiveScope = scope ?? (siteId ? "site" : "account");
|
|
22217
22168
|
logger.log(
|
|
@@ -22443,7 +22394,7 @@ async function resolveAttachments(attachments, fetchImpl = fetch) {
|
|
|
22443
22394
|
throw new AttachmentError(
|
|
22444
22395
|
`attachments[${i}] was not resolved to a download URL (got ${JSON.stringify(
|
|
22445
22396
|
typeof raw === "string" ? raw : (a && a.download_url) ?? raw
|
|
22446
|
-
)}).
|
|
22397
|
+
)}). \`attachments\` works only in ChatGPT, which swaps each file for a download URL before the call reaches Wix. Here it arrived as written, and Wix cannot read a path on your machine, so retrying the same value fails the same way. Upload another way. With a shell that reaches the internet, send the file from there (for a site, the StartDeployWebsite recipe's curl drop). Otherwise leave \`attachments\` out and put the files in \`files\`: text as is, and a binary as a \`=== FILE: <path> base64 ===\` entry only when it is a few KB (an icon, a logo), since a larger base64 payload does not survive your own output. A larger image goes in by public URL or through the user (the Media Manager).`
|
|
22447
22398
|
);
|
|
22448
22399
|
}
|
|
22449
22400
|
const problem = checkAttachmentUrl(url);
|
|
@@ -22501,6 +22452,327 @@ function validateExecuteCode(code) {
|
|
|
22501
22452
|
return { isValid: true };
|
|
22502
22453
|
}
|
|
22503
22454
|
|
|
22455
|
+
// src/api-call/site-files.ts
|
|
22456
|
+
var MAX_FILES_BUNDLE_CHARS = 4e6;
|
|
22457
|
+
var MAX_UNZIP_BYTES = 64 * 1024 * 1024;
|
|
22458
|
+
var MAX_SITE_FILES = 2e3;
|
|
22459
|
+
var textEncoder = new TextEncoder();
|
|
22460
|
+
function base64ToBytes(b64) {
|
|
22461
|
+
const clean = b64.replace(/^data:[^,]*,/, "").replace(/\s+/g, "");
|
|
22462
|
+
return Uint8Array.from(atob(clean), (c) => c.charCodeAt(0));
|
|
22463
|
+
}
|
|
22464
|
+
function parseFileBundle(bundle) {
|
|
22465
|
+
if (!bundle || !bundle.trim()) return [];
|
|
22466
|
+
if (bundle.length > MAX_FILES_BUNDLE_CHARS) {
|
|
22467
|
+
throw new Error(
|
|
22468
|
+
`files bundle is too large (${bundle.length} chars; max ${MAX_FILES_BUNDLE_CHARS}). Keep it to text and small base64 assets; pass larger files through attachments or reference media by URL.`
|
|
22469
|
+
);
|
|
22470
|
+
}
|
|
22471
|
+
const delimiter = /^=== FILE: (.+?)(?: (base64))? ===[ \t]*$/gm;
|
|
22472
|
+
const matches = [...bundle.matchAll(delimiter)];
|
|
22473
|
+
if (matches.length === 0) {
|
|
22474
|
+
throw new Error(
|
|
22475
|
+
"files bundle has no `=== FILE: <path> ===` sections. Start each file with that line (add ` base64` before the closing === for binary content)."
|
|
22476
|
+
);
|
|
22477
|
+
}
|
|
22478
|
+
return matches.map((match, i) => {
|
|
22479
|
+
const path = match[1].trim();
|
|
22480
|
+
const start = (match.index ?? 0) + match[0].length;
|
|
22481
|
+
const end = i + 1 < matches.length ? matches[i + 1].index ?? bundle.length : bundle.length;
|
|
22482
|
+
const content = bundle.slice(start, end).replace(/^\r?\n/, "").replace(/\r?\n$/, "");
|
|
22483
|
+
return {
|
|
22484
|
+
path,
|
|
22485
|
+
bytes: match[2] === "base64" ? base64ToBytes(content) : textEncoder.encode(content)
|
|
22486
|
+
};
|
|
22487
|
+
});
|
|
22488
|
+
}
|
|
22489
|
+
async function unzip(z) {
|
|
22490
|
+
const u16 = (o) => z[o] | z[o + 1] << 8;
|
|
22491
|
+
const u32 = (o) => (u16(o) | u16(o + 2) << 16) >>> 0;
|
|
22492
|
+
let end = z.length - 22;
|
|
22493
|
+
while (end >= 0 && !(u32(end) === 101010256 && end + 22 + u16(end + 20) === z.length))
|
|
22494
|
+
end--;
|
|
22495
|
+
if (end < 0) throw new Error("not a zip file (no end-of-central-directory)");
|
|
22496
|
+
const out = [];
|
|
22497
|
+
let p = u32(end + 16);
|
|
22498
|
+
let total = 0;
|
|
22499
|
+
const decoder = new TextDecoder();
|
|
22500
|
+
for (let i = 0, n = u16(end + 10); i < n; i++) {
|
|
22501
|
+
const path = decoder.decode(z.slice(p + 46, p + 46 + u16(p + 28)));
|
|
22502
|
+
const method = u16(p + 10);
|
|
22503
|
+
const size = u32(p + 24);
|
|
22504
|
+
total += size;
|
|
22505
|
+
if (total > MAX_UNZIP_BYTES) {
|
|
22506
|
+
throw new Error(
|
|
22507
|
+
`zip expands past ${MAX_UNZIP_BYTES} bytes; a static site is at most 20 MB`
|
|
22508
|
+
);
|
|
22509
|
+
}
|
|
22510
|
+
const at = u32(p + 42);
|
|
22511
|
+
const start = at + 30 + u16(at + 26) + u16(at + 28);
|
|
22512
|
+
const comp = z.slice(start, start + u32(p + 20));
|
|
22513
|
+
p += 46 + u16(p + 28) + u16(p + 30) + u16(p + 32);
|
|
22514
|
+
if (path.endsWith("/")) continue;
|
|
22515
|
+
let bytes;
|
|
22516
|
+
if (method === 0) bytes = comp;
|
|
22517
|
+
else if (method === 8) {
|
|
22518
|
+
bytes = new Uint8Array(
|
|
22519
|
+
await new Response(
|
|
22520
|
+
new Blob([comp]).stream().pipeThrough(new DecompressionStream("deflate-raw"))
|
|
22521
|
+
).arrayBuffer()
|
|
22522
|
+
);
|
|
22523
|
+
} else
|
|
22524
|
+
throw new Error(
|
|
22525
|
+
`zip entry '${path}' uses unsupported compression method ${method}`
|
|
22526
|
+
);
|
|
22527
|
+
if (bytes.length !== size) {
|
|
22528
|
+
throw new Error(
|
|
22529
|
+
`zip entry '${path}' declares ${size} bytes but holds ${bytes.length}`
|
|
22530
|
+
);
|
|
22531
|
+
}
|
|
22532
|
+
out.push({ path, bytes });
|
|
22533
|
+
}
|
|
22534
|
+
return out;
|
|
22535
|
+
}
|
|
22536
|
+
var isZip = (f) => f.bytes.length >= 4 && f.bytes[0] === 80 && f.bytes[1] === 75 && (f.bytes[2] === 3 && f.bytes[3] === 4 || f.bytes[2] === 5 && f.bytes[3] === 6) || /\.zip$/i.test(f.path);
|
|
22537
|
+
var isRootIndex = (p) => /^index\.html?$/i.test(p);
|
|
22538
|
+
async function normalizeSiteFiles(input) {
|
|
22539
|
+
let list = [];
|
|
22540
|
+
for (const f of input) {
|
|
22541
|
+
if (isZip(f)) list.push(...await unzip(f.bytes));
|
|
22542
|
+
else list.push(f);
|
|
22543
|
+
}
|
|
22544
|
+
list = list.map((f) => ({
|
|
22545
|
+
...f,
|
|
22546
|
+
path: f.path.replace(/\\/g, "/").replace(/^\.?\//, "")
|
|
22547
|
+
})).filter(
|
|
22548
|
+
(f) => f.path && !f.path.startsWith("__MACOSX/") && !/(^|\/)\.DS_Store$/.test(f.path) && !f.path.split("/").includes("..")
|
|
22549
|
+
);
|
|
22550
|
+
if (list.length === 0) {
|
|
22551
|
+
throw new Error(
|
|
22552
|
+
"No files to upload: pass the site in `files` or `attachments`."
|
|
22553
|
+
);
|
|
22554
|
+
}
|
|
22555
|
+
if (list.length > MAX_SITE_FILES) {
|
|
22556
|
+
throw new Error(
|
|
22557
|
+
`Too many files (${list.length}); a site upload is at most ${MAX_SITE_FILES}.`
|
|
22558
|
+
);
|
|
22559
|
+
}
|
|
22560
|
+
if (!list.some((f) => isRootIndex(f.path))) {
|
|
22561
|
+
const first = list[0].path.split("/")[0];
|
|
22562
|
+
if (list.every((f) => f.path.includes("/") && f.path.split("/")[0] === first)) {
|
|
22563
|
+
list = list.map((f) => ({
|
|
22564
|
+
...f,
|
|
22565
|
+
path: f.path.split("/").slice(1).join("/")
|
|
22566
|
+
}));
|
|
22567
|
+
}
|
|
22568
|
+
}
|
|
22569
|
+
const rootHtml = list.filter(
|
|
22570
|
+
(f) => !f.path.includes("/") && /\.html?$/i.test(f.path)
|
|
22571
|
+
);
|
|
22572
|
+
if (!list.some((f) => isRootIndex(f.path)) && rootHtml.length === 1) {
|
|
22573
|
+
list = list.map(
|
|
22574
|
+
(f) => f === rootHtml[0] ? { ...f, path: "index.html" } : f
|
|
22575
|
+
);
|
|
22576
|
+
}
|
|
22577
|
+
if (!list.some((f) => isRootIndex(f.path))) {
|
|
22578
|
+
const shown = list.slice(0, 8).map((f) => f.path).join(", ");
|
|
22579
|
+
throw new Error(
|
|
22580
|
+
`The site needs an index.html at its root. Files received: ${shown}${list.length > 8 ? ", \u2026" : ""}`
|
|
22581
|
+
);
|
|
22582
|
+
}
|
|
22583
|
+
return list;
|
|
22584
|
+
}
|
|
22585
|
+
function guessContentType(path) {
|
|
22586
|
+
const ext = (/\.([a-zA-Z0-9]+)$/.exec(path)?.[1] ?? "").toLowerCase();
|
|
22587
|
+
const map = {
|
|
22588
|
+
html: "text/html",
|
|
22589
|
+
htm: "text/html",
|
|
22590
|
+
css: "text/css",
|
|
22591
|
+
js: "text/javascript",
|
|
22592
|
+
mjs: "text/javascript",
|
|
22593
|
+
json: "application/json",
|
|
22594
|
+
svg: "image/svg+xml",
|
|
22595
|
+
txt: "text/plain",
|
|
22596
|
+
md: "text/markdown",
|
|
22597
|
+
xml: "application/xml",
|
|
22598
|
+
webmanifest: "application/manifest+json",
|
|
22599
|
+
ico: "image/x-icon",
|
|
22600
|
+
png: "image/png",
|
|
22601
|
+
jpg: "image/jpeg",
|
|
22602
|
+
jpeg: "image/jpeg",
|
|
22603
|
+
gif: "image/gif",
|
|
22604
|
+
webp: "image/webp",
|
|
22605
|
+
avif: "image/avif",
|
|
22606
|
+
woff: "font/woff",
|
|
22607
|
+
woff2: "font/woff2",
|
|
22608
|
+
ttf: "font/ttf",
|
|
22609
|
+
otf: "font/otf",
|
|
22610
|
+
pdf: "application/pdf",
|
|
22611
|
+
mp4: "video/mp4",
|
|
22612
|
+
webm: "video/webm",
|
|
22613
|
+
mp3: "audio/mpeg"
|
|
22614
|
+
};
|
|
22615
|
+
return map[ext] ?? "application/octet-stream";
|
|
22616
|
+
}
|
|
22617
|
+
function buildFormData(files) {
|
|
22618
|
+
const fd = new FormData();
|
|
22619
|
+
for (const f of files) {
|
|
22620
|
+
fd.append(
|
|
22621
|
+
"files",
|
|
22622
|
+
new Blob([f.bytes], { type: guessContentType(f.path) }),
|
|
22623
|
+
f.path
|
|
22624
|
+
);
|
|
22625
|
+
}
|
|
22626
|
+
return fd;
|
|
22627
|
+
}
|
|
22628
|
+
|
|
22629
|
+
// src/api-call/upload-headless-website-files.ts
|
|
22630
|
+
var UPLOAD_HEADLESS_WEBSITE_FILES_TOOL_NAME = "UploadHeadlessWebsiteFiles";
|
|
22631
|
+
var HEADLESS_BUSINESS = "https://www.wixapis.com/headless-business-setup/v1/headless-business";
|
|
22632
|
+
function dropAttribution(clientName) {
|
|
22633
|
+
const slug = (clientName ?? "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64);
|
|
22634
|
+
return `?campaign=mcp&agent=${encodeURIComponent(slug || "wix-mcp")}`;
|
|
22635
|
+
}
|
|
22636
|
+
var UPLOAD_HEADLESS_WEBSITE_FILES_PARAM_DESCRIPTIONS = {
|
|
22637
|
+
files: "The site files as text, so file bytes never pass through a code string. Sections delimited by a line `=== FILE: <path> ===` (text, raw) or `=== FILE: <path> base64 ===` (binary, base64); `<path>` is relative to the site root and must include `index.html`. Use base64 for small binaries (icons, logos, fonts); large images/video belong behind a URL in the HTML, not in the bundle. Optional when `attachments` carries the files.",
|
|
22638
|
+
attachments: "ChatGPT only. Files attached in the chat or created in your sandbox \u2014 any type: a zip of the whole site, HTML, CSS, JS, images. Pass each file as you have it, its file id or its /mnt/data path, and ChatGPT swaps it for { download_url, file_id, file_name?, mime_type? } before the call reaches Wix. No other client does this swap, so outside ChatGPT a path or file:// URL here fails at once; leave this out and use `files`, or, with a shell that reaches the internet, drop the files with curl as the StartDeployWebsite recipe shows. A zip is unpacked; a top-level folder wrapping the site is stripped. Prefer this over base64 in `files` whenever you have a file handle. Up to 10 MB per call.",
|
|
22639
|
+
siteId: "The metaSiteId of the Wix Headless site to upload into: the one returned by the provision call of the StartDeployWebsite recipe for a new site, or of a site deployed earlier to replace its files. Every upload replaces the whole file set, so send all files; the URL stays the same.",
|
|
22640
|
+
calledStartDeployWebsite: "Whether you called StartDeployWebsite earlier in this conversation and are following the recipe it returned. Answer truthfully; it is recorded, not checked.",
|
|
22641
|
+
agentIdentity: START_DEPLOY_WEBSITE_PARAM_DESCRIPTIONS.agentIdentity,
|
|
22642
|
+
reason: "One sentence: the user request that led here and what is being published."
|
|
22643
|
+
};
|
|
22644
|
+
function formatDropResult(r) {
|
|
22645
|
+
const shown = r.files.slice(0, 60);
|
|
22646
|
+
return [
|
|
22647
|
+
"Uploaded; the site is live with this file set.",
|
|
22648
|
+
`Live URL: ${r.siteUrl ?? "(not returned)"}`,
|
|
22649
|
+
`metaSiteId: ${r.metaSiteId} \u2014 pass it as \`siteId\` to update this site later; every upload replaces the whole file set.`,
|
|
22650
|
+
`Dashboard: https://manage.wix.com/dashboard/${r.metaSiteId}`,
|
|
22651
|
+
`${r.files.length} file(s): ${shown.join(", ")}${r.files.length > shown.length ? ", \u2026" : ""}`,
|
|
22652
|
+
"",
|
|
22653
|
+
"Give the user the live URL and the dashboard link.",
|
|
22654
|
+
`The upload step is done. For what comes next \u2014 changing the site later, connecting a domain, or adding a Wix backend (forms, bookings, a store) to this same site \u2014 continue with the guide you are following, from where it left off: the StartDeployWebsite recipe (${START_DEPLOY_WEBSITE_RECIPE_URL}) or, for a site built through StartHeadlessBuild, the headless guide (${HEADLESS_GUIDE_URL}).`
|
|
22655
|
+
].join("\n");
|
|
22656
|
+
}
|
|
22657
|
+
async function readJson(res, what) {
|
|
22658
|
+
const text = await res.text();
|
|
22659
|
+
if (!res.ok)
|
|
22660
|
+
throw new WixFetchError(res.status, res.statusText, `${what}: ${text}`);
|
|
22661
|
+
try {
|
|
22662
|
+
return JSON.parse(text);
|
|
22663
|
+
} catch {
|
|
22664
|
+
throw new Error(`${what} returned a non-JSON body: ${text.slice(0, 200)}`);
|
|
22665
|
+
}
|
|
22666
|
+
}
|
|
22667
|
+
function errorResult2(message) {
|
|
22668
|
+
return {
|
|
22669
|
+
isError: true,
|
|
22670
|
+
content: [
|
|
22671
|
+
{
|
|
22672
|
+
type: "text",
|
|
22673
|
+
text: `UploadHeadlessWebsiteFiles error: ${message}`
|
|
22674
|
+
}
|
|
22675
|
+
]
|
|
22676
|
+
};
|
|
22677
|
+
}
|
|
22678
|
+
function addUploadHeadlessWebsiteFilesTool(server, options) {
|
|
22679
|
+
const { authStrategy, toolDescriptions } = options;
|
|
22680
|
+
const clientName = () => options.clientName ?? server.clientName?.() ?? server.server?.getClientVersion?.()?.name;
|
|
22681
|
+
const fetchImpl = options.fetchImpl ?? ((u, i) => fetch(u, i));
|
|
22682
|
+
const d = UPLOAD_HEADLESS_WEBSITE_FILES_PARAM_DESCRIPTIONS;
|
|
22683
|
+
const registered = server.tool(
|
|
22684
|
+
UPLOAD_HEADLESS_WEBSITE_FILES_TOOL_NAME,
|
|
22685
|
+
toolDescriptions?.[UPLOAD_HEADLESS_WEBSITE_FILES_TOOL_NAME] ?? defaultToolDescriptions.UploadHeadlessWebsiteFiles,
|
|
22686
|
+
{
|
|
22687
|
+
files: external_exports.string().optional().describe(d.files),
|
|
22688
|
+
attachments: external_exports.array(
|
|
22689
|
+
external_exports.object({
|
|
22690
|
+
download_url: external_exports.string(),
|
|
22691
|
+
file_id: external_exports.string(),
|
|
22692
|
+
file_name: external_exports.string().optional(),
|
|
22693
|
+
mime_type: external_exports.string().optional()
|
|
22694
|
+
})
|
|
22695
|
+
).optional().describe(d.attachments),
|
|
22696
|
+
siteId: external_exports.string().uuid("siteId must be a Wix metaSiteId (UUID)").describe(d.siteId),
|
|
22697
|
+
calledStartDeployWebsite: external_exports.boolean().describe(d.calledStartDeployWebsite),
|
|
22698
|
+
agentIdentity: external_exports.string().min(1).describe(d.agentIdentity),
|
|
22699
|
+
reason: external_exports.string().describe(d.reason)
|
|
22700
|
+
},
|
|
22701
|
+
// openWorldHint true: it fetches agent-supplied attachment URLs and publishes a
|
|
22702
|
+
// public website.
|
|
22703
|
+
{ readOnlyHint: false, destructiveHint: true, openWorldHint: true },
|
|
22704
|
+
async (rawArgs, extra) => {
|
|
22705
|
+
const {
|
|
22706
|
+
files,
|
|
22707
|
+
attachments,
|
|
22708
|
+
siteId,
|
|
22709
|
+
calledStartDeployWebsite,
|
|
22710
|
+
agentIdentity,
|
|
22711
|
+
reason
|
|
22712
|
+
} = rawArgs;
|
|
22713
|
+
logger.log(
|
|
22714
|
+
`[UploadHeadlessWebsiteFiles] siteId=${siteId} calledStartDeployWebsite=${calledStartDeployWebsite} agent="${agentIdentity}" files=${files?.length ?? 0} chars attachments=${attachments?.length ?? 0} reason="${reason}"`
|
|
22715
|
+
);
|
|
22716
|
+
if (!files?.trim() && !(attachments && attachments.length)) {
|
|
22717
|
+
return errorResult2(
|
|
22718
|
+
"Nothing to publish: pass the site in `files` (text bundle) or `attachments` (files from this chat or your sandbox)."
|
|
22719
|
+
);
|
|
22720
|
+
}
|
|
22721
|
+
let siteFiles;
|
|
22722
|
+
try {
|
|
22723
|
+
const fromAttachments = (await resolveAttachments(attachments, fetchImpl)).map((a) => ({ path: a.path, bytes: base64ToBytes(a.content) }));
|
|
22724
|
+
siteFiles = await normalizeSiteFiles([
|
|
22725
|
+
...parseFileBundle(files),
|
|
22726
|
+
...fromAttachments
|
|
22727
|
+
]);
|
|
22728
|
+
} catch (e) {
|
|
22729
|
+
if (e instanceof AttachmentError || e instanceof Error)
|
|
22730
|
+
return errorResult2(e.message);
|
|
22731
|
+
throw e;
|
|
22732
|
+
}
|
|
22733
|
+
const authHeaders = await authStrategy.getAccountAuthHeaders();
|
|
22734
|
+
try {
|
|
22735
|
+
const metaSiteId = siteId;
|
|
22736
|
+
extra?.setToolBiParams?.({ siteId: metaSiteId });
|
|
22737
|
+
const dropped = await readJson(
|
|
22738
|
+
await fetchImpl(
|
|
22739
|
+
`${HEADLESS_BUSINESS}/${metaSiteId}/drop${dropAttribution(clientName())}`,
|
|
22740
|
+
{
|
|
22741
|
+
method: "POST",
|
|
22742
|
+
headers: { ...authHeaders },
|
|
22743
|
+
// fetch sets the multipart boundary itself
|
|
22744
|
+
body: buildFormData(siteFiles)
|
|
22745
|
+
}
|
|
22746
|
+
),
|
|
22747
|
+
"drop"
|
|
22748
|
+
);
|
|
22749
|
+
return {
|
|
22750
|
+
content: [
|
|
22751
|
+
{
|
|
22752
|
+
type: "text",
|
|
22753
|
+
text: formatDropResult({
|
|
22754
|
+
metaSiteId,
|
|
22755
|
+
siteUrl: dropped.siteUrl,
|
|
22756
|
+
uploadId: dropped.uploadId,
|
|
22757
|
+
files: siteFiles.map((f) => f.path)
|
|
22758
|
+
})
|
|
22759
|
+
}
|
|
22760
|
+
]
|
|
22761
|
+
};
|
|
22762
|
+
} catch (err) {
|
|
22763
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
22764
|
+
logger.log(`[UploadHeadlessWebsiteFiles] Error: ${message}`);
|
|
22765
|
+
rethrowIfUnauthorized(err);
|
|
22766
|
+
await authStrategy.enforceValidWixToken?.(err);
|
|
22767
|
+
return errorResult2(message);
|
|
22768
|
+
}
|
|
22769
|
+
}
|
|
22770
|
+
);
|
|
22771
|
+
registered?.update?.({
|
|
22772
|
+
_meta: { ...registered._meta, "openai/fileParams": ["attachments"] }
|
|
22773
|
+
});
|
|
22774
|
+
}
|
|
22775
|
+
|
|
22504
22776
|
// src/code-mode/index.ts
|
|
22505
22777
|
var defaultCodeModeFetch = (url, init) => fetch(url, init);
|
|
22506
22778
|
var SEARCH_TOOL_NAME = "SearchWixAPISpec";
|
|
@@ -22715,7 +22987,7 @@ function addExecuteTool(server, options) {
|
|
|
22715
22987
|
"One sentence explaining the original user request and why you are executing code to complete it."
|
|
22716
22988
|
),
|
|
22717
22989
|
hasMutations: external_exports.boolean().describe(
|
|
22718
|
-
visitor ? "
|
|
22990
|
+
visitor ? "True if the code changes site data on the visitor\u2019s behalf (create, update, delete, import, upload); false if it only reads (get, query, list, search)." : "True if the code changes anything in the Wix account or a site (create, update, delete, publish, install, import, upload); false if it only reads (get, query, list, search)."
|
|
22719
22991
|
),
|
|
22720
22992
|
sourceDocUrls: external_exports.array(external_exports.string()).describe(d.sourceDocUrls),
|
|
22721
22993
|
files: external_exports.string().optional().describe(
|
|
@@ -22739,7 +23011,7 @@ function addExecuteTool(server, options) {
|
|
|
22739
23011
|
mime_type: external_exports.string().optional()
|
|
22740
23012
|
})
|
|
22741
23013
|
).optional().describe(
|
|
22742
|
-
'Files attached in
|
|
23014
|
+
'ChatGPT only. Files attached in the chat or created in your sandbox (any type: a zip of a site, HTML, images, PDFs): pass each file as you have it, its file id or its /mnt/data path, and ChatGPT swaps it for { download_url, file_id, file_name?, mime_type? } before the call reaches Wix. No other client does this swap, so outside ChatGPT a path or file:// URL here fails at once; leave this out and use `files`, or upload from your shell if it reaches the internet. 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.'
|
|
22743
23015
|
),
|
|
22744
23016
|
// Visitor mode takes an agent-supplied token and pins the site; account/site
|
|
22745
23017
|
// mode lets the agent pick the site.
|
|
@@ -22753,7 +23025,10 @@ function addExecuteTool(server, options) {
|
|
|
22753
23025
|
)
|
|
22754
23026
|
}
|
|
22755
23027
|
},
|
|
22756
|
-
|
|
23028
|
+
// openWorldHint true: agent code picks the Wix endpoints at run time (and may
|
|
23029
|
+
// receive platform-resolved attachment URLs); the sandbox's host allowlist
|
|
23030
|
+
// bounds it, but the operation set is open-ended, which is what the hint means.
|
|
23031
|
+
{ readOnlyHint: false, destructiveHint: true, openWorldHint: true },
|
|
22757
23032
|
async (rawArgs, extra) => {
|
|
22758
23033
|
const {
|
|
22759
23034
|
code,
|
|
@@ -23146,6 +23421,13 @@ function createWixToolkit(options) {
|
|
|
23146
23421
|
maxResponseSize
|
|
23147
23422
|
});
|
|
23148
23423
|
}
|
|
23424
|
+
if (requestedTools.has("UploadHeadlessWebsiteFiles") && !disableTools?.includes("UploadHeadlessWebsiteFiles")) {
|
|
23425
|
+
addUploadHeadlessWebsiteFilesTool(server, {
|
|
23426
|
+
authStrategy,
|
|
23427
|
+
toolDescriptions: effectiveToolDescriptions,
|
|
23428
|
+
clientName
|
|
23429
|
+
});
|
|
23430
|
+
}
|
|
23149
23431
|
const requestedGraphqlTools = GRAPHQL_TOOL_NAMES.filter(
|
|
23150
23432
|
(name) => requestedTools.has(name)
|
|
23151
23433
|
);
|