@wix/mcp 1.0.94 → 1.0.95

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.
Files changed (79) hide show
  1. package/README.md +2 -2
  2. package/build/bin-standalone.js +1116 -321
  3. package/build/cjs/index.cjs +2813 -1147
  4. package/build/cjs/toolkit.cjs +1788 -362
  5. package/build/dts/api-call/headless-release.d.ts +56 -0
  6. package/build/dts/api-call/headless-release.js +135 -0
  7. package/build/dts/api-call/index.d.ts +9 -1
  8. package/build/dts/api-call/index.js +13 -7
  9. package/build/dts/api-call/site-files.d.ts +14 -0
  10. package/build/dts/api-call/site-files.js +106 -10
  11. package/build/dts/api-call/upload-headless-website-files.d.ts +88 -5
  12. package/build/dts/api-call/upload-headless-website-files.js +473 -20
  13. package/build/dts/api-call/upload-image-tool.d.ts +2 -0
  14. package/build/dts/api-call/upload-image-tool.js +8 -4
  15. package/build/dts/bin.d.ts +1 -1
  16. package/build/dts/bin.js +3 -1
  17. package/build/dts/code-mode/index.d.ts +6 -1
  18. package/build/dts/code-mode/index.js +30 -10
  19. package/build/dts/code-mode/truncate-response.js +5 -1
  20. package/build/dts/config/default-config.d.ts +35 -5
  21. package/build/dts/config/default-config.js +334 -178
  22. package/build/dts/config/file-params.d.ts +22 -0
  23. package/build/dts/config/file-params.js +24 -0
  24. package/build/dts/config/param-descriptions.d.ts +14 -2
  25. package/build/dts/config/param-descriptions.js +33 -14
  26. package/build/dts/constants.d.ts +1 -0
  27. package/build/dts/constants.js +1 -0
  28. package/build/dts/docs/docs.d.ts +12 -1
  29. package/build/dts/docs/docs.js +210 -42
  30. package/build/dts/docs/fetch-article.d.ts +21 -0
  31. package/build/dts/docs/fetch-article.js +66 -4
  32. package/build/dts/docs/get-to-know.d.ts +7 -2
  33. package/build/dts/docs/get-to-know.js +36 -14
  34. package/build/dts/docs/mintlify-docs.d.ts +121 -0
  35. package/build/dts/docs/mintlify-docs.js +391 -0
  36. package/build/dts/docs/semanticSearch.d.ts +2 -1
  37. package/build/dts/docs/semanticSearch.js +14 -7
  38. package/build/dts/docs/start-deploy-website.d.ts +7 -6
  39. package/build/dts/docs/start-deploy-website.js +13 -8
  40. package/build/dts/docs/start-headless-build.d.ts +8 -10
  41. package/build/dts/docs/start-headless-build.js +14 -28
  42. package/build/dts/index.d.ts +2 -2
  43. package/build/dts/index.js +2 -2
  44. package/build/dts/infra/redact-personal-data.d.ts +4 -0
  45. package/build/dts/infra/redact-personal-data.js +79 -0
  46. package/build/dts/site-widget-tools/constants.d.ts +49 -1
  47. package/build/dts/site-widget-tools/constants.js +64 -7
  48. package/build/dts/site-widget-tools/index.d.ts +1 -0
  49. package/build/dts/site-widget-tools/index.js +1 -0
  50. package/build/dts/site-widget-tools/pick-images-tool/index.d.ts +14 -0
  51. package/build/dts/site-widget-tools/pick-images-tool/index.js +138 -0
  52. package/build/dts/site-widget-tools/search-site-templates-tool/index.js +16 -2
  53. package/build/dts/site-widget-tools/site-builder-tool/index.js +22 -2
  54. package/build/dts/site-widget-tools/site-creation-tool/index.d.ts +7 -1
  55. package/build/dts/site-widget-tools/site-creation-tool/index.js +22 -51
  56. package/build/dts/site-widget-tools/suggested-domain-tool/index.js +6 -3
  57. package/build/dts/support/index.d.ts +4 -0
  58. package/build/dts/support/index.js +13 -7
  59. package/build/dts/toolkit-entry.d.cts +15 -10
  60. package/build/dts/toolkit-entry.d.ts +15 -10
  61. package/build/dts/toolkit.d.ts +2 -2
  62. package/build/dts/toolkit.js +14 -7
  63. package/build/dts/wix-mcp-server.d.ts +10 -1
  64. package/build/dts/wix-mcp-server.js +25 -7
  65. package/build/dts/wixel/constants.d.ts +8 -1
  66. package/build/dts/wixel/constants.js +8 -1
  67. package/build/dts/wixel/index.d.ts +1 -1
  68. package/build/dts/wixel/index.js +2 -2
  69. package/build/dts/wixel/wixel-a2a-client.d.ts +83 -0
  70. package/build/dts/wixel/wixel-a2a-client.js +166 -0
  71. package/build/dts/wixel/wixel-bi.d.ts +2 -1
  72. package/build/dts/wixel/wixel-bi.js +2 -1
  73. package/build/dts/wixel/{external-agent-api.d.ts → wixel-session-entries.d.ts} +11 -33
  74. package/build/dts/wixel/{external-agent-api.js → wixel-session-entries.js} +33 -54
  75. package/build/dts/wixel/wixel-session-tools.d.ts +21 -26
  76. package/build/dts/wixel/wixel-session-tools.js +494 -599
  77. package/build/esm/index.js +2824 -1170
  78. package/build/esm/toolkit.js +1786 -360
  79. package/package.json +4 -4
@@ -16257,6 +16257,8 @@ var runSemanticSearch = async (toolName, toolParams, maxResults = 20, rerank = f
16257
16257
  kbNames.push("VELO_DOCS_KB_ID", "VELO_METHODS_KB_ID");
16258
16258
  } else if (toolName === "CLI") {
16259
16259
  kbNames.push("CLI_KB_ID");
16260
+ } else if (toolName === "HELP_CENTER") {
16261
+ kbNames.push("HELP_CENTER_KB_ID");
16260
16262
  }
16261
16263
  logger.log(
16262
16264
  `[SemanticSearch] Tool: ${toolName}, KBs: [${kbNames.join(", ")}], Query: "${toolParams.searchTerm}"`
@@ -16289,9 +16291,9 @@ var runSemanticSearch = async (toolName, toolParams, maxResults = 20, rerank = f
16289
16291
  );
16290
16292
  return data?.results;
16291
16293
  };
16292
- var runPlatformizedSemanticSearch = async (toolName, searchTerm, maxResults = 20, linesInEachResult, extraDocumentTypes) => {
16294
+ var runPlatformizedSemanticSearch = async (toolName, searchTerm, maxResults = 20, linesInEachResult, extraDocumentTypes, documentTypesOverride) => {
16293
16295
  const startTime = Date.now();
16294
- const documentTypes = extraDocumentTypes?.length ? [toolName, ...extraDocumentTypes] : void 0;
16296
+ const documentTypes = documentTypesOverride?.length ? documentTypesOverride : extraDocumentTypes?.length ? [toolName, ...extraDocumentTypes] : void 0;
16295
16297
  logger.log(
16296
16298
  `[SemanticSearch/v2] Tool: ${documentTypes ? documentTypes.join("+") : toolName}, Query: "${searchTerm}"`
16297
16299
  );
@@ -16335,15 +16337,17 @@ var runSemanticSearchAndFormat = async ({
16335
16337
  rerank,
16336
16338
  linesInEachResult,
16337
16339
  usePlatformizedSearch = true,
16338
- extraDocumentTypes
16340
+ extraDocumentTypes,
16341
+ documentTypes
16339
16342
  }) => {
16340
- if (usePlatformizedSearch) {
16343
+ if (usePlatformizedSearch || documentTypes?.length) {
16341
16344
  return runPlatformizedSemanticSearch(
16342
16345
  toolName,
16343
16346
  toolParams.searchTerm,
16344
16347
  maxResults,
16345
16348
  linesInEachResult,
16346
- extraDocumentTypes
16349
+ extraDocumentTypes,
16350
+ documentTypes
16347
16351
  );
16348
16352
  } else {
16349
16353
  const results = await runSemanticSearch(
@@ -17263,6 +17267,7 @@ var import_http_client = __toESM(require_index_node(), 1);
17263
17267
  // src/constants.ts
17264
17268
  var RAW_DOCS_API_URL = "https://dev.wix.com/rawdocs/api";
17265
17269
  var GET_ARTICLE_CONTENT_URL = `${RAW_DOCS_API_URL}/get-article-content`;
17270
+ var GET_SOURCE_CONTENT_URL = `${RAW_DOCS_API_URL}/get-source-content`;
17266
17271
  var PORTAL_INDEX_URL = `${RAW_DOCS_API_URL}/portal-index`;
17267
17272
  var DOCS_API_BASE_URL = "https://dev.wix.com/docs/api/v1";
17268
17273
  var GET_SKILLS_BY_PORTAL_URL = `${DOCS_API_BASE_URL}/docs-web-app/menu-node/get-skills-by-portal`;
@@ -17283,7 +17288,13 @@ var SKILLS_REGISTRY_URL = new RegExp(
17283
17288
  "^https://(?:dev\\.wix\\.com(?:/docs)?|www\\.wix\\.com(?:/velo/reference)?)/skills(?:[/.?#]|$)|^https://www\\.wix\\.com/headless/"
17284
17289
  );
17285
17290
  function isSkillsRegistryUrl(url) {
17286
- return SKILLS_REGISTRY_URL.test(url.trim());
17291
+ return SKILLS_REGISTRY_URL.test(normalizeSkillsUrl(url));
17292
+ }
17293
+ var GITHUB_SKILLS_URL = /^https:\/\/(?:www\.)?github\.com\/wix\/skills\/(?:blob|raw|tree)\/[^/]+\/skills\/([^#?]+)/;
17294
+ function normalizeSkillsUrl(url) {
17295
+ const apex = url.trim().replace(/^https:\/\/wix\.com\//, "https://www.wix.com/");
17296
+ const gh = apex.match(GITHUB_SKILLS_URL);
17297
+ return gh ? `https://www.wix.com/skills/${gh[1]}` : apex;
17287
17298
  }
17288
17299
  async function fetchSkillsRegistryPage(httpClient, url) {
17289
17300
  let data;
@@ -17381,6 +17392,40 @@ async function fetchArticleContentFromDigor(httpClient, articleUrl, mode, stripH
17381
17392
  }
17382
17393
  return articleContent;
17383
17394
  }
17395
+ function parseSourceContentUrl(url) {
17396
+ let parsed;
17397
+ try {
17398
+ parsed = new URL(url);
17399
+ } catch {
17400
+ return void 0;
17401
+ }
17402
+ if (`${parsed.origin}${parsed.pathname}` !== GET_SOURCE_CONTENT_URL) {
17403
+ return void 0;
17404
+ }
17405
+ const repo = parsed.searchParams.get("repo");
17406
+ const path = parsed.searchParams.get("path");
17407
+ const commitHash = parsed.searchParams.get("commitHash");
17408
+ if (!repo || !path) return void 0;
17409
+ return commitHash ? { repo, path, commitHash } : { repo, path };
17410
+ }
17411
+ async function fetchSourceContent(httpClient, repo, path, commitHash) {
17412
+ const url = new URL(GET_SOURCE_CONTENT_URL);
17413
+ url.searchParams.set("repo", repo);
17414
+ url.searchParams.set("path", path);
17415
+ if (commitHash) url.searchParams.set("commitHash", commitHash);
17416
+ let data;
17417
+ try {
17418
+ ({ data } = await httpClient.get(url.toString()));
17419
+ } catch (error) {
17420
+ const { message, status } = getHttpErrorDetails(error);
17421
+ const statusSuffix = status ? ` (status ${status})` : "";
17422
+ throw new Error(`${message}${statusSuffix}`);
17423
+ }
17424
+ if (!data?.content) {
17425
+ throw new Error("Source content is empty");
17426
+ }
17427
+ return data.content;
17428
+ }
17384
17429
  async function fetchArticleContent(httpClient, articleUrl, mode, stripHeader = false, skillsPortalUrl, repo, commitHash, fetchMcpWhiteList) {
17385
17430
  const effectiveUrl = applyPortalUrlOverride(articleUrl, skillsPortalUrl);
17386
17431
  const isOverridden = effectiveUrl !== articleUrl;
@@ -17394,7 +17439,10 @@ async function fetchArticleContent(httpClient, articleUrl, mode, stripHeader = f
17394
17439
  `[fetch] Override failed for ${effectiveUrl}, falling back to ${articleUrl}:`,
17395
17440
  error instanceof Error ? error.message : error
17396
17441
  );
17397
- content = isSkillsRegistryUrl(articleUrl) ? await fetchSkillsRegistryPage(httpClient, articleUrl) : await fetchArticleContentFromDigor(
17442
+ content = isSkillsRegistryUrl(articleUrl) ? await fetchSkillsRegistryPage(
17443
+ httpClient,
17444
+ normalizeSkillsUrl(articleUrl)
17445
+ ) : await fetchArticleContentFromDigor(
17398
17446
  httpClient,
17399
17447
  articleUrl,
17400
17448
  mode,
@@ -17402,7 +17450,10 @@ async function fetchArticleContent(httpClient, articleUrl, mode, stripHeader = f
17402
17450
  );
17403
17451
  }
17404
17452
  } else if (isSkillsRegistryUrl(articleUrl)) {
17405
- content = await fetchSkillsRegistryPage(httpClient, articleUrl);
17453
+ content = await fetchSkillsRegistryPage(
17454
+ httpClient,
17455
+ normalizeSkillsUrl(articleUrl)
17456
+ );
17406
17457
  } else if (mode === "raw") {
17407
17458
  let parsedUrl;
17408
17459
  try {
@@ -17689,54 +17740,96 @@ function rethrowIfUnauthorized(error) {
17689
17740
  var ARRAY_QUERY_PARAMS_RULE = "Repeat array query params once per value: `?fieldsets=URL&fieldsets=RICH_CONTENT`. Do NOT comma-join values (`fieldsets=URL,RICH_CONTENT`), do NOT leave a trailing comma, and do NOT use a value the method schema does not list, even if a sibling method accepts it (draft posts have no `SEO` fieldset).";
17690
17741
  var WQL_FILTER_RULE = "Query and search filters are written in WQL: each field takes a single operator, so combine conditions with the logical operators \u2014 `$and` and `$or` take an array of expressions, `$not` takes one, and they can nest.";
17691
17742
 
17743
+ // src/config/file-params.ts
17744
+ var FILE_PARAM_CLIENTS = "OpenAI clients (ChatGPT, Codex)";
17745
+ function fileParamNote(otherwise) {
17746
+ return `${FILE_PARAM_CLIENTS} only: pass each file as you have it (attached in the chat or created in your sandbox, by its file id or path) and the client swaps it for { download_url, file_id, file_name?, mime_type? } before the call reaches Wix. No other client does this swap, so elsewhere a path or file:// URL here fails at once; leave this out and ${otherwise}.`;
17747
+ }
17748
+
17749
+ // src/site-widget-tools/constants.ts
17750
+ var WIX_BUSINESS_FEATURES = "a store, bookings or appointments, rentals, events and tickets, a restaurant menu with online orders or reservations, a blog, a portfolio, pricing plans and memberships, donations, Wix Forms, members and login, a CMS, payments";
17751
+ var SITE_CREATION_DEFAULT_ACTIONS = "add products, set up bookings, and adjust your content";
17752
+ var SITE_CREATION_CUSTOM_ACTIONS_GUIDANCE = `2\u20133 specific, high-value setup actions for the site's industry, written as a comma-separated phrase (it slots into "\u2026ask me to ___ right here in the chat"). Use the following domain patterns as guidance:
17753
+ * E-commerce / Retail: "add products, set up payment methods, and organize collections"
17754
+ * Restaurants / Food / Bakeries: "add menu items, set up online ordering, and collect table reservations"
17755
+ * Services / Fitness / Salons / Consultants: "set up booking slots, add service pricing, and manage appointments"
17756
+ * Creative / Portfolios / Photographers: "upload project galleries, feature client reviews, and customize contact forms"
17757
+ * Events / Weddings / Real Estate: "add event schedules, display listings, and manage RSVP forms"
17758
+ * General / Unspecified: "${SITE_CREATION_DEFAULT_ACTIONS}"
17759
+ If none of these patterns fit the site, infer 2\u20133 actions that suit what that kind of business would manage on its site.`;
17760
+ var SITE_BUILDER_CHOICE = {
17761
+ here: {
17762
+ label: "Build it here with me",
17763
+ pitch: "I build it in code right here, and you change anything by asking me"
17764
+ },
17765
+ editor: {
17766
+ label: "Design it in Wix's editor",
17767
+ pitch: "Wix designs a first version or you start from a template, then you edit it in Wix"
17768
+ },
17769
+ /** The editor's second step, in the widget and its reply. */
17770
+ editorStart: {
17771
+ wix: {
17772
+ label: "Let Wix design it",
17773
+ pitch: "Wix designs a first version from your description for you to edit"
17774
+ },
17775
+ template: {
17776
+ label: "Browse templates",
17777
+ pitch: "start from a ready-made design and edit it in Wix"
17778
+ }
17779
+ },
17780
+ /** Asked in chat when no widget is shown: who builds it. */
17781
+ whoQuestion: "Do you want me to build it here, so you can change anything just by asking me, or do you want to design it yourself in Wix's editor?",
17782
+ /** Asked next, only when the user chose Wix's editor. */
17783
+ editorQuestion: "Should Wix design a first version for you to edit, or do you want to start from a template?",
17784
+ /** What the widget sends as the user's message when they pick "Build it here with me". */
17785
+ hereFollowUp: "Build it here with me, in code, so I can keep changing it by asking you."
17786
+ };
17787
+
17692
17788
  // src/config/default-config.ts
17693
17789
  var AGENT_GOAL = dedent_default`
17694
- You are an agent that helps the user manage their Wix site.
17695
- Your goal is to get the user's prompt/task and execute it by using the appropriate tools eventually calling the correct Wix APIs with the correct parameters until the task is completed.
17790
+ You help the user with their Wix sites and account.
17791
+ Work out what the task needs and do it: read the Wix skills, docs and API schemas that cover it, and write and run the code that calls Wix APIs, until the task is done.
17696
17792
  `;
17793
+ var CALL_WIX_SITE_API_RECONNECT_LINE = "If the Wix MCP offers no ExecuteWixAPI at all, your Wix connection is likely an old or cached version: tell the user once to reconnect the Wix connector or restart the client, and use this tool until then.";
17794
+ var CALL_WIX_SITE_API_NO_EXECUTE_LINE = "If ExecuteWixAPI isn't in your tool list, use this tool.";
17697
17795
  var DISCOVERY_FLOWS = [
17698
- "- CONVERSATION CONTEXT BASED: find relevant docs article or API example for the user's prompt/task in the conversation context -> call API using CallWixSiteAPI() based on the docs article or API example",
17699
- "- METHOD CODE EXAMPLE BASED: BrowseWixRESTDocsMenu() or SearchWixRESTDocumentation() -> find relevant method -> read method article using ReadFullDocsArticle() to get method code examples -> call API using CallWixSiteAPI() based on the method code examples",
17700
- "- FULL SCHEMA BASED: BrowseWixRESTDocsMenu() or SearchWixRESTDocumentation() -> find relevant method -> read method article using ReadFullDocsArticle() -> no method code examples found -> inspect the method schema using SearchWixAPISpec or ReadFullDocsMethodSchema -> call API using CallWixSiteAPI() based on the schema"
17796
+ "- CONVERSATION CONTEXT BASED: find relevant docs article or API example for the user's prompt/task in the conversation context -> call the API with ExecuteWixAPI based on the docs article or API example",
17797
+ "- METHOD CODE EXAMPLE BASED: BrowseWixRESTDocsMenu() or SearchWixRESTDocumentation() -> find relevant method -> read method article using ReadFullDocsArticle() to get method code examples -> call the API with ExecuteWixAPI based on the method code examples",
17798
+ "- FULL SCHEMA BASED: BrowseWixRESTDocsMenu() or SearchWixRESTDocumentation() -> find relevant method -> read method article using ReadFullDocsArticle() -> no method code examples found -> inspect the method schema using SearchWixAPISpec or ReadFullDocsMethodSchema -> call the API with ExecuteWixAPI based on the schema"
17701
17799
  ];
17800
+ function directRouteLines(includeReadme, includeImageUploadGuidance) {
17801
+ return [
17802
+ ...includeReadme ? [
17803
+ `- **Creating a new site.** Skip the docs too. A site is written in code and uploaded: StartDeployWebsite returns the upload guide; StartHeadlessBuild returns the headless guide, for a site that needs Wix business features (${WIX_BUSINESS_FEATURES}). Call one right away, without asking the user anything first: StartHeadlessBuild when the site needs Wix business features, otherwise StartDeployWebsite. WixSiteBuilder or SearchSiteTemplates only when the user asked for Wix's editor, the Wix Harmony Editor, a template, Wix Studio or the Classic Editor. Never create a site through ManageWixSite, CallWixSiteAPI or ExecuteWixAPI.`
17804
+ ] : [],
17805
+ "- **Listing, showing or finding their Wix sites**: call ListWixSites directly.",
17806
+ ...includeImageUploadGuidance ? [
17807
+ "- **Uploading local or attached image files to a Wix site**: call UploadImageToWixSite directly, with no docs, schema or API calls. Do NOT use ExecuteWixAPI, SearchWixAPISpec, or any Media Manager REST API for image uploads."
17808
+ ] : []
17809
+ ];
17810
+ }
17702
17811
  function buildSystemReminderGuidelines(includeReadme, includeImageUploadGuidance) {
17703
- const exception = includeReadme ? "**Exception:** " : "";
17704
17812
  const lines = [];
17705
- if (includeReadme) {
17706
- lines.push(
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
- "**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."
17710
- );
17711
- }
17712
17813
  lines.push(
17713
- `${exception}If the user asks to list, show, or find their Wix sites, ${includeReadme ? "skip WixREADME and " : ""}call ListWixSites directly.`
17814
+ includeReadme ? "Start every Wix task with WixREADME, questions included, then use the other tools and the Wix APIs until the task is done. If WixREADME is not available, follow the flows without it. These requests skip it and go straight to their own tool:" : "These requests go straight to their own tool, with no docs or API calls first:"
17714
17815
  );
17715
- if (includeImageUploadGuidance) {
17716
- lines.push(
17717
- `${exception}If the user wants to upload local or attached image files to a Wix site, skip ${includeReadme ? "WixREADME and " : ""}all docs/schema/API flows \u2014 call UploadImageToWixSite directly. Do NOT use ExecuteWixAPI, SearchWixAPISpec, or any Media Manager REST API for image uploads.`
17718
- );
17719
- }
17720
- if (includeReadme) {
17721
- lines.push(
17722
- "If the WixREADME tool is not available to you, you should use the other flows as described without using the WixREADME tool until the task is completed."
17723
- );
17724
- }
17816
+ lines.push(...directRouteLines(includeReadme, includeImageUploadGuidance));
17725
17817
  lines.push(
17726
- `This applies to QUESTIONS too, not only action tasks (the ${includeReadme ? "exceptions" : "direct-tool routes"} above still apply \u2014 question-shaped variants of those intents, e.g. "can you show my sites?", follow their ${includeReadme ? "exception's " : ""}direct tool): never answer a Wix-specific question from memory, and never reply that you lack the tools or APIs to answer, without first ${includeReadme ? "calling the WixREADME tool (if available) and checking its recipes index, searching the docs," : "searching the docs"} and reading the matching docs articles \u2014 many questions (including ones that need no API call) are answered by a ${includeReadme ? "recipe or docs article" : "docs article"}.`,
17727
- "If the user prompt / task is an instruction to do something in Wix, You should not tell the user what Docs to read or what API to call, your task is to do the work and complete the task in minimal steps and time with minimal back and forth with the user, unless absolutely necessary."
17818
+ `A question follows the same routes: one about those requests goes to its tool ("can you show my sites?" is ListWixSites). Any other Wix question is answered from ${includeReadme ? "WixREADME, the Wix skills, " : ""}the docs search and the matching docs articles, never from memory, and never with a reply that you lack the tools or APIs to answer. Many questions, including ones that need no API call, are answered by a ${includeReadme ? "Wix skill or docs article" : "docs article"}.`,
17819
+ "When the user asks you to do something in Wix, do it, in as few steps and questions as you can; don't tell them which docs to read or which API to call."
17728
17820
  );
17729
17821
  return lines.join("\n");
17730
17822
  }
17731
17823
  function buildSystemReminderFlows(includeReadme) {
17732
17824
  const lines = ["Wix MCP Site Management Flows"];
17825
+ const noSkill = "no Wix skill covers the user's prompt/task -> ";
17733
17826
  if (includeReadme) {
17734
17827
  lines.push(
17735
17828
  "With WixREADME tool:",
17736
- "- RECIPE BASED (PREFERRED!): WixREADME() -> find relevant recipe for the user's prompt/task -> read recipe using ReadFullDocsArticle() -> call Wix API using CallWixSiteAPI() based on the recipe",
17829
+ "- SKILL BASED (PREFERRED!): WixREADME() -> find the Wix skill for the user's prompt/task (WixREADME says how to read one) -> follow it -> call the API with ExecuteWixAPI based on it",
17737
17830
  DISCOVERY_FLOWS[0],
17738
- "- EXAMPLE BASED: WixREADME() -> no relevant recipe found for user's prompt/task -> BrowseWixRESTDocsMenu() or SearchWixRESTDocumentation() -> find relevant method -> read method article using ReadFullDocsArticle() to get method code examples -> call API using CallWixSiteAPI() based on the method code examples",
17739
- "- SCHEMA BASED, FALLBACK: WixREADME() -> no relevant recipe found for user's prompt/task -> BrowseWixRESTDocsMenu() or SearchWixRESTDocumentation() -> find relevant method -> read method article using ReadFullDocsArticle() -> no method code examples found -> inspect the method schema using SearchWixAPISpec or ReadFullDocsMethodSchema -> call API using CallWixSiteAPI() based on the schema",
17831
+ `- EXAMPLE BASED: WixREADME() -> ${noSkill}BrowseWixRESTDocsMenu() or SearchWixRESTDocumentation() -> find relevant method -> read method article using ReadFullDocsArticle() to get method code examples -> call the API with ExecuteWixAPI based on the method code examples`,
17832
+ `- SCHEMA BASED, FALLBACK: WixREADME() -> ${noSkill}BrowseWixRESTDocsMenu() or SearchWixRESTDocumentation() -> find relevant method -> read method article using ReadFullDocsArticle() -> no method code examples found -> inspect the method schema using SearchWixAPISpec or ReadFullDocsMethodSchema -> call the API with ExecuteWixAPI based on the schema`,
17740
17833
  "Without WixREADME tool:"
17741
17834
  );
17742
17835
  }
@@ -17769,41 +17862,22 @@ function buildSystemReminder(includeReadme, includeImageUploadGuidance = true) {
17769
17862
  `;
17770
17863
  }
17771
17864
  var SYSTEM_REMINDER = buildSystemReminder(true);
17865
+ var HELP_CENTER_IS_FOR_PEOPLE = "The Help Center is written for people doing things by hand in Wix's dashboard and editors. To act on a site yourself, the Wix developer docs come first: find the method with SearchWixRESTDocumentation or BrowseWixRESTDocsMenu.";
17772
17866
  var SITE_CREATION_COPY = {
17773
17867
  templatePick: {
17774
17868
  nonWidget: "After the user selects a template, call `CreateSiteFromTemplate`.",
17775
17869
  widget: "The gallery creates the site when the user picks one."
17776
- },
17777
- unstatedMethod: {
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",
17779
- widget: "you MUST call `WixSiteCreation` and let them choose"
17780
17870
  }
17781
17871
  };
17782
- var SITE_GUIDANCE = dedent_default`
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.
17786
-
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.
17788
-
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.
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.
17791
- Once the purpose is clear, unless the user already named a method, ${SITE_CREATION_COPY.unstatedMethod.nonWidget}. A method they named is settled — never re-open it. Never default to AI or to templates, and never ask the user to choose between Harmony and Wix Studio; infer that from their words.
17792
- With the purpose and the method known, that's enough to begin — route and refine the specifics with the user afterward.
17793
-
17794
- Preferred question when the user has given no site context at all:
17795
- Happy to help. To give you the right starting point, tell me a bit more about what you have in mind:
17796
- - What's the site for? (e.g. an online clothing store, a yoga studio that takes bookings, a restaurant)
17797
- - What's the vibe? (e.g. sleek and modern, cozy and rustic, bold and energetic)
17798
- Give me a quick summary and I'll take it from there
17799
-
17800
- Tone: helpful, practical, short. Speak about the user's site — what you're making and what comes next — not the tools, payloads, or routing behind it.`;
17872
+ var EDITOR_TAIL = `When the user wants Wix's editor, or to design the site themselves, without saying how to start, ask them first: "${SITE_BUILDER_CHOICE.editorQuestion}" A new site is otherwise written in code and uploaded: call StartDeployWebsite, or StartHeadlessBuild when it needs Wix business features, right away and without asking the user anything first.`;
17801
17873
  var toWidget = (text) => Object.values(SITE_CREATION_COPY).reduce(
17802
17874
  (acc, { nonWidget, widget }) => acc.replaceAll(nonWidget, widget),
17803
17875
  text
17804
17876
  );
17877
+ var WIX_API_DATA = "products, inventory, carts, checkouts, orders, bookings, services, staff, time slots, rentals, restaurant menus, online orders, reservations, events, tickets, RSVPs, blog posts, CMS collections and items, pricing plans, subscriptions, portfolios, gift cards, coupons, donations, forms, form submissions, contacts, members, loyalty points, groups, reviews, inbox messages, CRM tasks, automations, email campaigns, payments, invoices, SEO, redirects, translations, locations, analytics, media files, site properties, installed apps, and the account's sites and domains";
17805
17878
  var EXECUTE_WIX_API_INTRO = dedent_default`
17806
- Execute JavaScript code against the Wix REST API when code is useful for chaining related calls, pagination, loops, branching, or in-memory transformation.
17879
+ Reads and changes the data of a Wix site or account: query, list, count, create, update and delete it with one JavaScript function over the Wix REST API.
17880
+ One function holds the whole task: chained calls, pagination, loops, branching, and the reads that feed its writes.
17807
17881
  Putting a site live or changing a headless site's files starts with StartDeployWebsite; building a new site in code with StartHeadlessBuild.
17808
17882
 
17809
17883
  CODE CONTRACT:
@@ -17889,7 +17963,7 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
17889
17963
  declare const files: Array<{ path: string; content: string; encoding?: "base64" }>;
17890
17964
  \`\`\`
17891
17965
 
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):
17966
+ FILE UPLOADS: files never go inline in \`code\`; two params feed the \`files\` global. \`attachments\`: ${fileParamNote("upload from your shell if it reaches the internet")} Any type, up to 10 MB per call, all in one call: a zip of a whole site, HTML, images, PDFs; the bytes 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):
17893
17967
  \`\`\`javascript
17894
17968
  // files param:
17895
17969
  // === FILE: index.html ===
@@ -17904,6 +17978,7 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
17904
17978
  return res.data;
17905
17979
  }
17906
17980
  \`\`\`
17981
+ HEADLESS SITE EDITS: \`wix.headless.files.list({siteId, prefix?, offset?, limit?})\` returns file metadata; \`read({siteId, path})\` returns UTF-8 text (up to 256 KB); \`patch({siteId, files?, deletePaths?, agent?})\` applies changed files and explicit deletions while preserving everything else. Patch defaults to the Execute \`files\` global (including resolved attachments and ZIPs). Paths are literal site-relative paths; no wrapping-folder stripping. It returns added/replaced/deleted/unchanged/missingDeletes path lists. List/read reuse one downloaded ZIP snapshot for the current site within an Execute call; switching sites discards the previous snapshot, and a new call downloads afresh. Patch downloads a fresh ZIP, then drops the full merged site and clears the read snapshot. Serialize edits to the same site; there is no atomic concurrency guarantee. For a full replacement, use the existing upload/drop path. See the upload-static-site recipe for examples and older-server fallback.
17907
17982
  A site zip passed through \`attachments\` is one base64 entry; unzip it and upload the entries:
17908
17983
  \`\`\`javascript
17909
17984
  // attachments: [site.zip] → files = [{ path: "site.zip", content: "<base64>", encoding: "base64" }]
@@ -18027,22 +18102,37 @@ var executeWixApiDescription = dedent_default`
18027
18102
 
18028
18103
  ${EXECUTE_WIX_API_MULTI_SITE_EXAMPLE}
18029
18104
  `;
18030
- function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true) {
18031
- const reminder = buildSystemReminder(
18105
+ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true, { usageGuideOnce = false } = {}) {
18106
+ const usageGuide = buildSystemReminder(
18032
18107
  includeReadme,
18033
18108
  includeImageUploadGuidance
18034
18109
  );
18035
- return {
18110
+ const reminder = includeReadme && usageGuideOnce ? "" : usageGuide;
18111
+ const descriptions = {
18112
+ // Named in SERVER_INSTRUCTIONS: when this tool's name or what it is for changes, update them to match.
18036
18113
  WixREADME: dedent_default`
18037
18114
  # Tool: WixREADME
18038
- **Directive:** \`WixREADME\` is the **MANDATORY FIRST STEP** for all Wix-related tasks. Its output (including relevant linked documents) provides foundational context for all other Wix tools. Adherence to this protocol is **NON-NEGOTIABLE**.
18039
-
18040
- **Mid-conversation site switching:** If the user references a different site by name or ID after WixREADME has already been called, use \`GetSiteContext\` directly — no need to call WixREADME again.
18041
- ${reminder}
18115
+ The context every other Wix tool assumes. Call it first, once per conversation, for any Wix task or question; for another site later in the conversation, call \`GetSiteContext\` instead of calling this again.
18116
+ A Wix task includes reading or changing a site's or account's data: ${WIX_API_DATA}.
18117
+ These requests skip it and go straight to their own tool:
18118
+ ${directRouteLines(includeReadme, includeImageUploadGuidance).join("\n")}
18119
+ A question about one of those goes to the same tool ("can you show my sites?" is ListWixSites). Any other Wix question is answered from a Wix skill or the docs, never from memory, and never with a reply that you lack the tools to answer.
18120
+ It returns, in full:
18121
+ - **Source of truth**: nothing Wix-specific from memory. Every URL, ID, setting location, product fact, request shape and field name comes from the docs tools, a Wix skill, an earlier tool result in the conversation, or the user.
18122
+ - **The site**: the account's sites with their properties and installed apps. The \`siteId\` comes from there (ask when several fit); a business solution's API works only on a site with its app installed, and an app's version changes its endpoints.
18123
+ - **Find the method**: an earlier tool result, else a Wix skill's recipe (wix-manage to manage a site, wix-headless-kit to build a headless one), else the docs: SearchWixRESTDocumentation or BrowseWixRESTDocsMenu, then ReadFullDocsArticle; the SDK, CLI, headless and apps docs for code.
18124
+ - **The exact shape**: model a call only on an example that matches the case; fill the rest with SearchWixAPISpec on the method's docs URL (request and response schemas, \`method.publicUrl\` for REST, \`method.sdk\` for the JavaScript SDK). A query's filter and sort fields and operators are a closed list per method.
18125
+ - **The call, or the code**: ExecuteWixAPI runs one async function holding every step code can resolve, the reads and the writes they feed together, \`hasMutations: true\` when anything writes. Code the user keeps (an app, a headless site, a script over REST or the JavaScript SDK) is written from the same shapes; the headless skills are a shortcut on that path.
18126
+ - **When a call fails**: the error says what was wrong and carries a Wix request id; fix that, never resend unchanged or guess.
18127
+ - **Wix skills**, what each is for and how to read one: from disk when installed (the Wix plugin, or \`npx skills add wix/skills\`, \`--skill <name>\` for one, \`-g\` for the user's home, into \`.agents/skills/<skill>/\` or a similar folder the client reads, such as \`.claude/skills/<skill>/\`), else online with ReadFullDocsArticle at \`https://www.wix.com/skills/<skill>/<path>\`.
18128
+ - **wix-manage**: REST recipes for managing a site's business solutions, one per task; follow the recipe and make its calls with ExecuteWixAPI, its docs URL in \`sourceDocUrls\`. Its list of recipes is \`SKILL.md\` in the installed skill, or online https://dev.wix.com/docs/api-reference/articles/ai-tools/wix-mcp/skills/wix-management-recipes-index.md, and each API area has its own \`<API section>/skills.md\` (for example https://dev.wix.com/docs/api-reference/business-solutions/bookings/skills.md).
18129
+ - **wix-headless-kit**: builds a Wix Headless site on shipped, verified code from wix-headless-templates, a \`@wix/sdk\` React core or the same data layer as plain REST calls: scaffold with the CLI, deploy, seed, design on the shipped hooks, release. https://www.wix.com/skills/headless-kit/SKILL.md
18130
+ - **wix-headless-templates**: the code wix-headless-kit builds from, one folder per Wix Business Solution. https://www.wix.com/skills/headless-templates/
18131
+ When the user asks you to do something in Wix, do it yourself, in as few steps and questions as you can; don't tell them which docs to read or which API to call.
18042
18132
  `,
18043
18133
  SearchWixRESTDocumentation: dedent_default`
18044
18134
  **Searches the official Wix REST API documentation — the starting point for any Wix REST API task.** Unless you already have the exact method \`docsUrl\` in context, begin the task here; this is how you discover the right endpoint. Reach for it before \`SearchWixAPISpec\`, and avoid writing code that scans or filters \`lightIndex\` to find an endpoint (e.g. \`lightIndex.filter(...)\`, \`lightIndex.flatMap(...)\`, or substring-matching on \`docsUrl\`/\`name\`/\`summary\`) — that has no relevance ranking and silently misses composite and method-level operations. This is the ranked semantic-search discovery tool over the Wix REST API docs: describe your intent in natural language and it returns the matching REST endpoints/methods (with their \`docsUrl\`) ranked by relevance. It is the first step whenever you need to do something on a Wix site via HTTP and don't already have the exact \`docsUrl\` in context — for creating, reading, updating, or deleting any kind of Wix entity, across every business domain.
18045
- It covers all Wix REST domains equally — Stores, eCommerce/orders, Bookings, CRM/contacts, Members, CMS/data collections, Events, Blog, Forms, Marketing, Media, site settings, SEO, and the rest. Just describe the resource, action, or goal in plain words (e.g. 'add a catalog item with inventory', 'book a service', 'update a data collection item', 'create a discount', 'list contacts', 'get site details endpoint', 'REST authentication'); the ranking handles matching your wording to the right API regardless of domain.
18135
+ It covers all Wix REST domains equally, every product's data: ${WIX_API_DATA}, and the rest. Just describe the resource, action, or goal in plain words (e.g. 'add a catalog item with inventory', 'book a service', 'update a data collection item', 'create a discount', 'list contacts', 'get site details endpoint', 'REST authentication'); the ranking handles matching your wording to the right API regardless of domain.
18046
18136
  **Next step after this tool:** take the \`docsUrl\` it returns and inspect that method's exact request/response schema with \`SearchWixAPISpec\` (\`getResourceSchemaByUrl(docsUrl)\`), then execute. \`SearchWixAPISpec\` is only for INSPECTING a \`docsUrl\` you already have — it is NOT a discovery tool. Skipping this step to hand-search \`lightIndex\` yourself is a mistake: raw index filtering has no relevance ranking and misses operations this ranked search finds. Discover here first, every time.
18047
18137
  If you can't find what you need, rephrase your search term or use a bigger maxResults value.
18048
18138
  ${reminder}
@@ -18064,6 +18154,7 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
18064
18154
  `,
18065
18155
  CallWixSiteAPI: dedent_default`
18066
18156
  Call Wix apis on a business or site. Use this to create, read, update, and delete data and other Wix entities in your Wix site.
18157
+ ExecuteWixAPI is the preferred tool for Wix API calls: one function holds every call of the task, the reads and the writes they feed together, where this tool makes one call per invocation. If your client loads tools on demand (tool search, deferred tools), load ExecuteWixAPI before using this tool. ${CALL_WIX_SITE_API_RECONNECT_LINE}
18067
18158
  Site-level: this tool reads and writes inside the single site named by the required \`siteId\`.
18068
18159
  **Prefer using the "ListWixSites" tool when the user asks to list or show their sites.** Only use this tool for site listing if the user needs advanced filtering or specific site details beyond what ListWixSites provides.
18069
18160
  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"}]).
@@ -18078,6 +18169,7 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
18078
18169
  Docs urls like https://dev.wix.com/docs/... are not api urls, if you want to read the docs, use the "ReadFullDocsArticle" tool
18079
18170
  ${reminder}
18080
18171
  `,
18172
+ // Named in SERVER_INSTRUCTIONS: when this tool's name or what it is for changes, update them to match.
18081
18173
  ListWixSites: dedent_default`
18082
18174
  **Use this tool whenever the user asks to list, show, get, or find their Wix sites.** This is the dedicated tool for listing Wix sites for the current user. By default it returns all sites, but you can filter by name.${includeReadme ? "\n\n**Do NOT use WixREADME before this tool.** When the user asks to list their sites, call this tool directly \u2014 no need to read documentation first." : ""}
18083
18175
 
@@ -18105,6 +18197,7 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
18105
18197
  By conversation context we mean the endpoint url was given in the user prompt or got into the conversation context ${includeReadme ? 'by the "WixREADME" tool or ' : ""}by the "SearchWixRESTDocumentation" tool or by the "BrowseWixRESTDocsMenu" tool or by the "ReadFullDocsArticle" tool.
18106
18198
  ${reminder}
18107
18199
  `,
18200
+ // Named in SERVER_INSTRUCTIONS: when this tool's name or what it is for changes, update them to match.
18108
18201
  UploadImageToWixSite: dedent_default`
18109
18202
  Upload one or more images to a Wix site's Media Manager. Returns wixstatic.com URL and media ID.
18110
18203
  Do NOT use ExecuteWixAPI or code execution for image uploads — use this tool directly.
@@ -18114,34 +18207,39 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
18114
18207
  NEVER call this tool with a missing, empty, or guessed siteId — ask first instead.
18115
18208
 
18116
18209
  Parameters — provide image input via image and/or imageUrls, OR imageBase64:
18117
- • 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.
18210
+ • image (array): ${fileParamNote("send the image as imageBase64 (the whole file, one per call) or as a public URL in imageUrls")} Pass ALL of them in one call.
18118
18211
  • 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.
18119
18212
  • imageBase64 (string): base64-encoded image + mimeType. One image at a time. Do NOT combine with image/imageUrls.
18120
18213
 
18121
18214
  Delivering the bytes — this is where uploads most often fail:
18122
- • 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).
18215
+ • This server does not share your filesystem: outside image's clients, a file you can only reach by path (e.g. /mnt/..., /home/user/..., /Users/...) goes as imageBase64 (the whole file, one per call) or, if it is public, as imageUrls.
18123
18216
  • 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.
18124
18217
  `,
18125
- SupportAndFeedback: dedent_default`
18126
- Send the user's feedback about the experience of building with Wix — the Wix MCP tools, APIs, docs, and tooling — to Wix, attributed to the authenticated user.
18127
- This is meta-feedback about building with Wix; it is NOT a support channel and not for the user's own site content.
18218
+ // Registered for Claude clients only, beside UploadImageToWixSite.
18219
+ PickImagesForWixMedia: dedent_default`
18220
+ Shows a file picker where the user selects images from their device; they upload to the site's Media Manager and the result (each image's media ID and wixstatic URL) comes back in the conversation.
18221
+ Use it only when you can't deliver the image yourself with UploadImageToWixSite: the image is on the user's device and not in your files, or it is a file in your sandbox that you can't pass as a file, a public URL or base64. When UploadImageToWixSite can take it, use that.
18222
+ `,
18223
+ ReportIssueToWix: dedent_default`
18224
+ Report one specific problem with Wix's tools, APIs or docs to the Wix team, attributed to the authenticated user: an API error or a confusing API, wrong or missing docs, a Wix MCP tool or auth dead end. It is NOT a support channel and not for the user's own site content.
18128
18225
 
18129
18226
  When to offer it (user-approved only — NEVER auto-send):
18130
- - The user explicitly asks to send feedback / report something to Wix ("tell Wix that...", "report this", "send feedback"). Then just confirm the wording and send.
18131
- - The user complains, is frustrated, or reports a Wix bug in the course of the work ("this API is broken", "the docs are wrong", "why is this so hard"). Acknowledge, then offer to pass it on.
18132
- - The session hit substantial friction — repeated API failures, wrong/missing docs, a tooling dead end, or a workaround you had to invent. When you notice the pattern, offer: "This tripped us up a few times — want me to send it to Wix as feedback?"
18133
-
18134
- When you offer, invite the user to add anything in their own words — whatever they give you goes into the message verbatim.
18135
-
18136
- What to send — a summary of the whole run, not just the last error. Structure it in four layers:
18137
- 1. Provenance — agent/model; Wix tooling used; platform/hosting; Wix areas/APIs touched; Wix products; project type/frontend; site id; relevant links (dashboard, docs pages, live site, repos); skill areas/recipes involved; other ids created this run.
18138
- 2. Narrative — user intent and run summary (what they set out to build, what worked vs. what fought back); a condensed play-by-play of the session (key exchanges, tool calls, decisions, course-corrections).
18139
- 3. Friction points — for each friction point: the step/endpoint, HTTP status and error message, the gap, the workaround you had to invent, and what you expected instead. Include ones you recovered from silently — a retry that eventually worked is exactly the signal Wix wants.
18140
- 4. Attribution — per friction point, where the fault likely lives: API behavior / API schema / API reference docs / docs articles or examples / Wix tooling / other/unsure. Don't force a tag; "unsure" beats a wrong route.
18141
- End with a bottom line: one or two sentences on the single most important problem and its impact — a plain engineering assessment, not softened or hedged.
18142
-
18143
- **IMPORTANT**: This tool actually sends the message to Wix. Confirm the final wording with the user and call it only after an explicit yes.
18144
- Do not send on a single transient error, and never more than once for the same issue. Feedback cannot be replied to or tracked by the user.
18227
+ - The user asks to report something to Wix ("tell Wix that...", "report this", "send feedback"). Then confirm the wording and send.
18228
+ - The user complains or reports a Wix bug in the course of the work ("this API is broken", "the docs are wrong"). Acknowledge, then offer to pass it on.
18229
+ - A Wix API, tool or doc kept failing, or you had to invent a workaround for it. Offer: "This tripped us up — want me to report it to Wix?"
18230
+
18231
+ When you offer, invite the user to add anything in their own words — whatever they give you goes into the report verbatim.
18232
+
18233
+ What to send — that one issue, not the session:
18234
+ - What was being attempted, in a sentence.
18235
+ - Where it failed: the tool or endpoint, the HTTP status and error message, and the request id if there is one (pass it as requestId).
18236
+ - What you expected instead, and the workaround if you found one.
18237
+ - Where the fault likely lives: API behavior / API schema / API reference docs / docs articles or examples / Wix tooling / unsure.
18238
+ - Only the context needed to reproduce it: agent/model, site id, the Wix area or API.
18239
+ No session summary or play-by-play, and nothing unrelated to the issue. Several distinct issues are separate reports, each approved by the user.
18240
+
18241
+ **IMPORTANT**: This tool actually sends the report to Wix. Confirm the final wording with the user and call it only after an explicit yes.
18242
+ Do not send on a single transient error, and never more than once for the same issue. Reports cannot be replied to or tracked by the user.
18145
18243
  `,
18146
18244
  BrowseWixRESTDocsMenu: dedent_default`
18147
18245
  Browse the Wix REST API documentation menu hierarchy.
@@ -18163,25 +18261,7 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
18163
18261
  ${reminder}
18164
18262
  `,
18165
18263
  WixSiteCreation: dedent_default`
18166
- ${SITE_GUIDANCE}
18167
-
18168
- Opens the in-chat Wix site creation chooser as an interactive widget where the user chooses between "Build with AI" and "Pick a template."
18169
-
18170
- **Once you can tell what the site is for, call this tool directly** — no ${includeReadme ? "WixREADME, skill," : "skill"} or docs search first.${includeReadme ? " Any other Wix request still starts with WixREADME as usual." : ""}
18171
-
18172
- Call this for normal new Wix site creation requests when the user's site intent is clear, but they have not chosen AI, templates, or Wix Studio.
18173
- Do not guess, and never default to AI — even after the user answers a clarifying question about the site's purpose or features.
18174
- This chooser is how the builder choice gets made — never ask in chat whether they want AI or a template; that choice is made in the widget.
18175
- The widget also does the creating: once the user picks, it runs that path itself and the site is created there, so never call \`WixSiteBuilder\`, \`SearchSiteTemplates\`, or \`CreateSiteFromTemplate\` yourself after opening it.
18176
- After calling, reply with the message it returns, which presents both options and the next steps.
18177
-
18178
- Do not call this if the user explicitly asks to build with AI; call \`WixSiteBuilder\` instead.
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\`.
18181
-
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).
18183
-
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.
18264
+ A new Wix site is written in code and uploaded: call StartDeployWebsite for the upload guide, or StartHeadlessBuild when the site needs Wix business features. WixSiteBuilder or SearchSiteTemplates only when the user asked for the Wix Harmony Editor, a template, Wix Studio or the Classic Editor.
18185
18265
  `,
18186
18266
  "import-claude-design-from-url": dedent_default`
18187
18267
  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.
@@ -18211,6 +18291,13 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
18211
18291
  `,
18212
18292
  SearchWixWDSDocumentation: dedent_default`
18213
18293
  Searches the Wix Design System (WDS) documentation.
18294
+ `,
18295
+ SearchWixHelpCenter: dedent_default`
18296
+ Searches the Wix Help Center (support.wix.com): how site owners do things in the Wix dashboard and editors, such as connecting a domain, managing a Premium plan, setting up a store or bookings, and fixing account or site issues.
18297
+ ${HELP_CENTER_IS_FOR_PEOPLE}
18298
+ Use it for "how do I ... in Wix" questions about the product, or to give the user click-by-click steps for something no API covers.
18299
+ Not for building with code: for Wix APIs, SDK, CLI, apps, or Headless, use the matching developer documentation search.
18300
+ Results are excerpts; read a full article by passing its support.wix.com link to \`ReadFullDocsArticle\`.
18214
18301
  `,
18215
18302
  SearchWixSDKDocumentation: dedent_default`
18216
18303
  Searches the Wix JavaScript SDK documentation.
@@ -18221,7 +18308,7 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
18221
18308
  `,
18222
18309
  SearchDevelopmentDocumentation: dedent_default`
18223
18310
  Broad Wix development documentation (platform concepts, developer guides, getting started). **Last resort — development tasks only.**
18224
- Skip it entirely for general, business, support, or Wix-editor questions.
18311
+ Skip it entirely for general, business, support, or Wix-editor questions; for those, use \`SearchWixHelpCenter\`.
18225
18312
  Call it only after the specific search for your task returned nothing useful: \`SearchWixRESTDocumentation\` (REST), \`SearchWixSDKDocumentation\` (JS SDK), \`SearchWixCLIDocumentation\` (CLI), \`SearchBuildAppsDocumentation\` (apps), \`SearchWixHeadlessDocumentation\` (Headless), \`SearchWixWDSDocumentation\` (WDS). Never use it as a first search.
18226
18313
  `,
18227
18314
  SearchWixHeadlessDocumentation: dedent_default`
@@ -18233,7 +18320,8 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
18233
18320
  // `sdk` is simply absent on methods the SDK docs don't list.
18234
18321
  SearchWixAPISpec: dedent_default`
18235
18322
  Inspect the Wix REST API spec, and the JavaScript SDK call for each method, by writing JavaScript code that runs in a sandboxed read-only environment.
18236
- **Precondition:** you already have a method \`docsUrl\` — from \`SearchWixRESTDocumentation\`, \`SearchWixSDKDocumentation\` (its \`?apiView=SDK\` URLs work here as-is), \`BrowseWixRESTDocsMenu\`, \`ReadFullDocsArticle\`, ${includeReadme ? "a `WixREADME` recipe, " : ""}or a prior tool result / the user's message in this conversation. If you don't have one yet, call \`SearchWixRESTDocumentation\` (or \`SearchWixSDKDocumentation\` when writing SDK code) FIRST to discover it; do not use this tool to search for or choose an endpoint.
18323
+ The spec covers every Wix product's methods and their data: ${WIX_API_DATA}.
18324
+ **Precondition:** you already have a method \`docsUrl\` — from \`SearchWixRESTDocumentation\`, \`SearchWixSDKDocumentation\` (its \`?apiView=SDK\` URLs work here as-is), \`BrowseWixRESTDocsMenu\`, \`ReadFullDocsArticle\`, ${includeReadme ? "a Wix skill, " : ""}or a prior tool result / the user's message in this conversation. If you don't have one yet, call \`SearchWixRESTDocumentation\` (or \`SearchWixSDKDocumentation\` when writing SDK code) FIRST to discover it; do not use this tool to search for or choose an endpoint.
18237
18325
  **Never pass a \`docsUrl\` you produced from memory.** If the exact URL you are about to pass to \`getResourceSchemaByUrl\` did not appear verbatim in an earlier tool result (or the user's message), it is a guess — call \`SearchWixRESTDocumentation\` first and use a URL from its ranked results. A guessed URL that merely looks plausible routinely resolves to the WRONG sibling method (e.g. \`.../products-v3/create-product\` when the task needs \`.../products-v3/create-product-with-inventory\`), sending the whole turn down a dead end. When in doubt, discover — don't guess.
18238
18326
  **This tool's job is to INSPECT the exact schema of a method you have ALREADY located — its request/response shape, nested types, and enums, and its SDK call (\`method.sdk\`). It is NOT a discovery tool for choosing which method to use.**
18239
18327
  With a method \`docsUrl\` in hand, call \`getResourceSchemaByUrl(methodDocsUrl)\` to get the resource schema, then read the target method from \`schema.methods\` and resolve any nested \`{ $circular: name }\` types via \`schema.components.schemas[name]\`.
@@ -18614,27 +18702,18 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
18614
18702
  \`\`\`
18615
18703
  `,
18616
18704
  ExecuteWixAPI: executeWixApiDescription,
18705
+ // Named in SERVER_INSTRUCTIONS: when this tool's name or what it is for changes, update them to match.
18617
18706
  WixSiteBuilder: dedent_default`
18618
- ${SITE_GUIDANCE}
18619
-
18620
- Tool for generating a Wix site with AI (creating / building a site in Wix Harmony) from a description. It does not take pages or files you already have — those go to StartDeployWebsite.
18621
-
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.
18623
- Never default to this tool: if the user hasn't explicitly named AI, don't call this tool — ${SITE_CREATION_COPY.unstatedMethod.nonWidget}.
18624
-
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\`.
18626
-
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.)
18707
+ A secondary site-creation tool, only for a user who asked for the Wix Harmony Editor or for Wix to design the site. Don't call it for any other site request, not even to check with the flag false. A new site is otherwise written in code and uploaded, with StartDeployWebsite, or StartHeadlessBuild when it needs Wix business features.
18708
+ Builds a site with the Wix Harmony Editor: Wix designs a first version from the user's description, and the user keeps designing it in Wix's editor. Shows the build's progress and a preview.
18709
+ Call it when the user asked for the Wix Harmony Editor, or for Wix to design the site, in their own words or as their answer to your question. ${EDITOR_TAIL}
18628
18710
  `,
18711
+ // Named in SERVER_INSTRUCTIONS: when this tool's name or what it is for changes, update them to match.
18629
18712
  SearchSiteTemplates: dedent_default`
18630
- ${SITE_GUIDANCE}
18631
-
18632
- Searches Wix templates and shows the template gallery, from the Harmony, the Studio or the Classic Editor template source.
18633
-
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.
18635
- ${SITE_CREATION_COPY.templatePick.nonWidget}
18636
-
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}.`,
18713
+ A secondary site-creation tool, only for a user who asked for a template, Wix Studio or the Classic Editor. Don't call it for any other site request, not even to check with the flag false. A new site is otherwise written in code and uploaded, with StartDeployWebsite, or StartHeadlessBuild when it needs Wix business features.
18714
+ Shows a gallery of Wix templates, from Harmony, Wix Studio or the Classic Editor, for a site the user will design in Wix's editor. Wix templates come with Wix's business features (a store, online ordering, bookings, forms), so a request for a template comes here even when the site needs them.
18715
+ Call it when the user asked for a template, Wix Studio or the Classic Editor, in their own words or as their answer to your question. ${EDITOR_TAIL} ${SITE_CREATION_COPY.templatePick.nonWidget}
18716
+ `,
18638
18717
  CreateSiteFromTemplate: dedent_default`
18639
18718
  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.
18640
18719
 
@@ -18668,102 +18747,211 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
18668
18747
  Set \`hasMutations: true\` for any document containing a mutation root field.
18669
18748
  `,
18670
18749
  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).
18750
+ The upload step of the StartDeployWebsite and StartHeadlessBuild guides, and nothing else: puts a finished website's files — a static site (index.html plus its CSS/JS/images, a static build, or a zip of the site) or a Wix Astro build — 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.
18751
+ Pass the files themselves: in ${FILE_PARAM_CLIENTS} as \`attachments\` (any type, a zip is unpacked), elsewhere as the \`files\` text bundle (\`=== FILE: <path> ===\` sections, \`base64\` tag for small binaries). A static site must contain index.html at its root. A Wix Astro build with no file handle, from a shell that reaches the internet, goes in two calls: zip the build, call with \`prepare: true\` and the zip's \`size\` in bytes, PUT the zips it names with the \`curl\` commands it returns (the build, and the project source when the site's repository accepts it), then call again with the \`uploadKey\` it returned; that releases the build. The two calls, literally: {siteId, prepare: true, size} then {siteId, uploadKey, sourceUploadId?, expectedHeadRevisionId?, releaseNotes?}. A sandbox whose network is limited to a few hosts cannot upload to those URLs. A static site does not use the two calls. A Wix Astro build (the project's .wix/ and dist/ after \`astro build\` with the Wix hosting adapter, zipped from the project root) needs no index.html: it is released to the site's Wix hosting instead, server-rendered pages, the same site and URL. The project's source is stored with the release when the upload holds the project and the site's repository accepts it.
18752
+ NOT a site-creation tool: a request to create, build, design or generate a site — with or without a description — never comes here first. Unless the user asked for Wix's editor or a template (WixSiteBuilder, SearchSiteTemplates), call StartDeployWebsite right away, without asking the user anything: it also takes files the user brought, uploaded first even when the site needs business features. StartHeadlessBuild instead for a new site with no files that needs Wix business features. Also NOT for media uploads to an existing site (UploadImageToWixSite) or any other API call (ExecuteWixAPI).
18674
18753
  `,
18754
+ // Named in SERVER_INSTRUCTIONS: when this tool's name or what it is for changes, update them to match.
18675
18755
  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, 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
- 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
- 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. 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).
18756
+ Creates a website on Wix and puts it live, or replaces the files of one deployed earlier. You write the site's code, or take the files the user brought (HTML/CSS/JS, a static build, a zip, another builder's export), and this returns the guide to create the site and upload them. Updates keep the same site and URL. Works with or without a Wix login (anonymous deploy with a save link), through the Wix MCP alone or from a shell. Call it right away, without asking the user anything first.
18757
+ When a new site needs Wix business features (${WIX_BUSINESS_FEATURES}), call StartHeadlessBuild instead. When the user brought files and the site needs those features, upload the files here first; the upload's result then points to StartHeadlessBuild to connect them.
18758
+ Returns the guide; follow it and do the work yourself. Upload with UploadHeadlessWebsiteFiles once the site exists; the drop page is only the fallback.
18759
+ NOT for: a user who asked for Wix's editor, the Wix Harmony Editor, a template, Wix Studio or the Classic Editor (WixSiteBuilder, SearchSiteTemplates); 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 editor site; uploading images or documents to a site's media (UploadImageToWixSite).
18681
18760
  `,
18761
+ // Named in SERVER_INSTRUCTIONS: when this tool's name or what it is for changes, update them to match.
18682
18762
  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).
18763
+ Returns Wix's headless guide, for a site that needs Wix business features (${WIX_BUSINESS_FEATURES}), run by Wix as a Wix Headless site. You write the site; the guide creates it, connects the features, and uploads it. Also to add those features to an existing Wix Headless site (one deployed from files is one), from a project download link, or to move a Wix site to code.
18764
+ Call it right away: it only returns the guide, and the site's details are not needed first.
18765
+ NOT for: a site that needs no Wix business feature, or files the user brought that are not live yet (StartDeployWebsite: upload them first, then come back here for the features); a user who asked for Wix's editor, the Wix Harmony Editor, a template, Wix Studio or the Classic Editor, even when the site needs business features (WixSiteBuilder, SearchSiteTemplates); a Claude Design URL (import-claude-design-from-url).
18686
18766
  `
18687
18767
  };
18768
+ descriptions.SupportAndFeedback = descriptions.ReportIssueToWix;
18769
+ return descriptions;
18688
18770
  }
18689
- var defaultToolDescriptions = buildToolDescriptions(true);
18771
+ var defaultToolDescriptions = buildToolDescriptions(true, true, { usageGuideOnce: true });
18690
18772
  var executeCodeModeToolDescriptions = {
18691
18773
  ExecuteWixAPI: executeWixApiDescription
18692
18774
  };
18775
+ var WIX_SKILLS_README_SECTION = dedent_default`
18776
+ ## Wix skills
18777
+
18778
+ Wix publishes agent skills: folders of instructions, scripts and shipped code for building on Wix, each with a \`SKILL.md\` at its root that says what the skill does and which of its files to read when. The source is https://github.com/wix/skills. Three of them matter here:
18779
+
18780
+ - **wix-headless-kit**: builds a Wix Headless site on shipped, verified code. In the Wix plugin. Its contents are below.
18781
+ - **wix-headless-templates**: the code wix-headless-kit builds from, one folder per Wix Business Solution. In the Wix plugin for Codex and Cursor. Its contents are below.
18782
+ - **wix-manage**: REST recipes to configure and manage a site's business solutions. In the Wix plugin. Its \`SKILL.md\` is the index of every recipe by area, with what it does and a link to read it.
18783
+
18784
+ On a site built in code (one deployed through StartDeployWebsite, started through StartHeadlessBuild, or any Wix Headless project), wix-headless-kit carries the work, with wix-headless-templates as its code, and it names the wix-manage recipes it uses as steps.
18785
+
18786
+ ### How to read a skill
18787
+
18788
+ A skill is a folder, and every file in it has a path inside that folder (\`SKILL.md\`, \`guides/api-run.md\`). The same path finds the file on disk and online, so the paths below work either way.
18789
+
18790
+ 1. **From disk, when it is already there.** This is the preferred way: the files are complete and need no network. The Wix plugin loads its skills into the client; \`npx skills add\` puts them under \`.agents/skills/<skill>/\` in the project, or in the user's home with \`-g\`; an earlier install may have left them wherever the client keeps skills (for example \`.claude/skills/\` or the plugin's folder). Open \`<skill folder>/SKILL.md\` and the files it names. An installed copy can be an older snapshot. A file whose byte size differs from the one in the skill's manifest (below) is out of date, so read it online; a matching size makes a file likely current, not certain, so when a file decides the work, read it online too.
18791
+ 2. **Install them, with a shell that reaches the internet.** \`npx skills add wix/skills\` installs every skill; \`npx skills add wix/skills --skill wix-headless-kit\` installs one. Then read them from disk. To keep them across projects, the user can install the Wix plugin instead (in Claude Code: \`/plugin marketplace add wix/skills\`, then \`/plugin install wix@wix\`).
18792
+ 3. **Read them online, with ReadFullDocsArticle**, when neither works: no shell, or a sandbox without internet. Call ReadFullDocsArticle with the URL as \`articleUrl\`; it returns the file whole, where a client's own web tool often cannot reach www.wix.com or summarizes what it fetches. The skills registry mirrors every skill from the main branch of wix/skills:
18793
+ - **A file**: \`https://www.wix.com/skills/<skill>/<path>\`, with \`<path>\` its path inside the skill folder. Start with \`<path>\` = \`SKILL.md\`, then read the files it names.
18794
+ - **A folder**: \`https://www.wix.com/skills/<skill>/<folder>\` returns the full URL of every file under it, at any depth. \`https://www.wix.com/skills/<skill>/<folder>/_content\` returns those files' contents in one response, each under a heading with its URL, Markdown first; binary files and lockfiles are left out, and past 150K characters the rest are named by URL, to read one by one.
18795
+ - **The skill's file list**: \`https://www.wix.com/skills/<skill>/\`, with the trailing slash, returns the full URL of every file in the skill; without the slash it returns the SKILL.md.
18796
+ - **Every file in the skill**: \`https://www.wix.com/skills/<skill>.manifest.json\` lists each path with its size, under a \`base\` URL.
18797
+ - **Names and hosts**: \`<skill>\` is the folder name with or without its \`wix-\` prefix (\`wix-headless-kit\` or \`headless-kit\`), and \`dev.wix.com\` works in place of \`www.wix.com\`.
18798
+ - **What comes back**: a Markdown file comes with a short note on top (it is mirrored from the main branch of wix/skills; the skill's manifest, folder listings, \`_content\`, and ReadFullDocsArticle) and its relative links turned into full URLs; code, scripts and JSON come as they are.
18799
+ - **A wrong path**: the answer names the files with that name elsewhere in the skill and the manifest URL, so one more call reaches the right file. ReadFullDocsArticle shows that answer as an error.
18800
+ - **Not served**: a whole skill as one page (\`<skill>-full\`) returns 404; read the skill's files instead.
18801
+
18802
+ The wix-manage recipes are also published in the Wix docs, as articles at \`…/skills/<recipe>\` under each API's section. Find the one that matches the task in the skill's recipe index (\`SKILL.md\`) or with SearchWixRESTDocumentation, and read it with ReadFullDocsArticle. Only wix-manage is in the docs. For example, one recipe in all three places:
18803
+ - on disk: \`<wix-manage folder>/references/sites/upload-static-site.md\`;
18804
+ - in the registry: https://www.wix.com/skills/manage/references/sites/upload-static-site.md;
18805
+ - in the docs: https://dev.wix.com/docs/api-reference/account-level/sites/skills/upload-a-website-or-html-files.
18806
+
18807
+ ### wix-manage
18808
+
18809
+ REST recipes for managing a site's business solutions: one recipe per task (installing apps, products, booking services, CMS items, SEO, domains and more), each with the exact endpoints, request bodies and order of steps. Open the recipe for a task before calling its APIs.
18810
+
18811
+ Ways to find and read a recipe, in this order:
18812
+ 1. **On disk**: the Wix plugin's wix-manage folder, or \`.agents/skills/wix-manage/\` after \`npx skills add wix/skills --skill wix-manage\`. \`SKILL.md\` lists every recipe by area with what it does; the recipe itself is under \`references/<area>/\` (ecommerce nests one more folder, such as \`references/ecommerce/shipping/\`), so open the path \`SKILL.md\` gives rather than building it. An installed copy can be an older snapshot: when a recipe decides the work, read it online too.
18813
+ 2. **Online**: the list of every recipe by area, each a link to its docs article, is https://dev.wix.com/docs/api-reference/articles/ai-tools/wix-mcp/skills/wix-management-recipes-index.md. Read it with ReadFullDocsArticle, or with \`curl\` from a shell, then read the recipe for the task the same way. It is public: no sign-in or token.
18814
+
18815
+ Using a recipe: follow its steps, and make its calls with ExecuteWixAPI, passing the recipe's docs URL in \`sourceDocUrls\`. When a recipe's example doesn't fit a call, read that method's schema with SearchWixAPISpec first. When no recipe matches the task, find the method with SearchWixRESTDocumentation or BrowseWixRESTDocsMenu, read it with ReadFullDocsArticle, and call it the same way.
18816
+ Each API area also has a page that lists only its own recipes: the area's docs section with \`/skills.md\` appended. These are the ones today, but it is not a closed list: areas are added, so look a task up in the full list first, and for an API not named here try its section URL with \`/skills.md\` appended.
18817
+ - Accessibility: https://dev.wix.com/docs/api-reference/site/accessibility/skills.md
18818
+ - Analytics: https://dev.wix.com/docs/api-reference/business-management/analytics/skills.md
18819
+ - App Installation: https://dev.wix.com/docs/api-reference/business-management/app-installation/skills.md
18820
+ - App tools: https://dev.wix.com/docs/api-reference/app-management/app-tools/skills.md
18821
+ - Automations: https://dev.wix.com/docs/api-reference/business-management/automations/skills.md
18822
+ - Blog: https://dev.wix.com/docs/api-reference/business-solutions/blog/skills.md
18823
+ - Bookings: https://dev.wix.com/docs/api-reference/business-solutions/bookings/skills.md
18824
+ - Calendar: https://dev.wix.com/docs/api-reference/business-management/calendar/skills.md
18825
+ - CMS: https://dev.wix.com/docs/api-reference/business-solutions/cms/skills.md
18826
+ - Contacts: https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/skills.md
18827
+ - Domains: https://dev.wix.com/docs/api-reference/account-level/domains/skills.md
18828
+ - eCommerce: https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills.md
18829
+ - Events: https://dev.wix.com/docs/api-reference/business-solutions/events/skills.md
18830
+ - Forms: https://dev.wix.com/docs/api-reference/crm/forms/skills.md
18831
+ - Get Paid: https://dev.wix.com/docs/api-reference/business-management/get-paid/skills.md
18832
+ - Google Ads: https://dev.wix.com/docs/api-reference/business-management/marketing/ads/google-ads/skills.md
18833
+ - Google Business Profile: https://dev.wix.com/docs/api-reference/business-management/google-business-profile/skills.md
18834
+ - Google Search Console: https://dev.wix.com/docs/api-reference/business-management/seo/google-search-console/skills.md
18835
+ - Headless: https://dev.wix.com/docs/api-reference/business-management/headless/skills.md
18836
+ - Marketing: https://dev.wix.com/docs/api-reference/business-management/marketing/skills.md
18837
+ - Media: https://dev.wix.com/docs/api-reference/assets/media/skills.md
18838
+ - Pricing Plans: https://dev.wix.com/docs/api-reference/business-solutions/pricing-plans/skills.md
18839
+ - Restaurants: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/skills.md
18840
+ - Rich Content: https://dev.wix.com/docs/api-reference/assets/rich-content/skills.md
18841
+ - SEO: https://dev.wix.com/docs/api-reference/business-management/seo/skills.md
18842
+ - SEO redirects: https://dev.wix.com/docs/api-reference/business-management/seo/redirects/skills.md
18843
+ - Site Properties: https://dev.wix.com/docs/api-reference/business-management/site-properties/skills.md
18844
+ - Sites: https://dev.wix.com/docs/api-reference/account-level/sites/skills.md
18845
+ - Stores: https://dev.wix.com/docs/api-reference/business-solutions/stores/skills.md
18846
+ - Wix MCP: https://dev.wix.com/docs/api-reference/articles/ai-tools/wix-mcp/skills.md
18847
+
18848
+ ### wix-headless-kit
18849
+
18850
+ Builds a Wix Headless site on shipped, verified code instead of writing the integration: each Wix Business Solution comes with a typed data layer, hooks, components, pages and a seed script that are already correct. The data layer ships twice, on \`@wix/sdk\` for the React core and as plain REST calls for a stack that cannot run it (\`guides/reference-mode.md\`), and the agent's work narrows to brand, layout, copy and wiring. It runs as a CLI flow from a shell that reaches Wix, and as Wix API calls through this MCP when it cannot.
18851
+
18852
+ Paths are inside the skill folder; online, each is \`https://www.wix.com/skills/headless-kit/<path>\`.
18853
+ - Before the skill: the cold start installs it, signs in and hands off. It is another skill's file, https://www.wix.com/skills/headless-cold-start/headless-kit.md, and StartHeadlessBuild returns it.
18854
+ - \`SKILL.md\`: the steps of a build and the table of Business Solutions the kit ships.
18855
+ - \`guides/api-run.md\`: the whole run as Wix API calls through this MCP, for an agent whose shell cannot reach Wix or that has no shell.
18856
+ - \`guides/capabilities.md\`: which Wix product owns which feature, and what the kit ships for it.
18857
+ - \`guides/existing-site.md\`: a new frontend for a Wix site that already has its content.
18858
+ - \`guides/migration.md\`: a site moving to code after "Go Headless" in its dashboard.
18859
+ - \`guides/reference-mode.md\`: a stack that cannot run the shipped React code (a static site, a server-rendered app in another language).
18860
+ - \`guides/feedback.md\`: sending the user's building-with-Wix feedback to Wix.
18861
+ - \`install/\`: the bootstrap, setup, deploy and templates scripts, and \`install/pins.json\` with the pinned CLI and templates versions.
18862
+
18863
+ ### wix-headless-templates
18864
+
18865
+ The code wix-headless-kit builds from, one folder per Wix Business Solution: \`storefront\`, \`bookings\`, \`rentals\`, \`blog\`, \`cms\`, \`forms\`, \`members\`, \`events\`, \`restaurants\`, \`donations\`, \`pricing-plans\`, \`portfolio\`, \`faq\`. It holds no flow of its own; wix-headless-kit fetches it and copies, deploys and seeds from it.
18866
+
18867
+ Paths are inside the skill folder; online, each is \`https://www.wix.com/skills/headless-templates/<path>\`. Every Business Solution folder has the same parts, with \`<solution>\` one of the names above:
18868
+ - \`<solution>/INSTRUCTIONS.md\`: the playbook, covering what ships, what you build, and each page's contract.
18869
+ - \`<solution>/app/\`: the typed React core: the data layer under \`wix/<solution>/\`, hooks and components.
18870
+ - \`<solution>/app-astro/\`: the Astro page skeletons for Wix-managed Astro sites (every solution but \`forms\`).
18871
+ - \`<solution>/project/\`: the whole runnable project for that solution.
18872
+ - \`<solution>/rest/\`: the same data layer as plain REST calls, for stacks that cannot run the React core.
18873
+ - \`<solution>/seed/SEED.md\`: how to seed that solution's content, with the script that creates it in the right order.
18874
+
18875
+ Shared by every solution:
18876
+ - \`shared/DESIGN.md\`: the design floor when the brief gives no design direction.
18877
+ - \`shared/CONTENT.md\`: the copy floor for every page written.
18878
+ - \`shared/SUPPLIED-CONTENT.md\`: content the user brings (a CSV, a menu, a folder of photos) as the seed plan.
18879
+ - \`shared/CUSTOM_OPERATIONS.md\`: operations beyond what the shipped code covers.
18880
+ - \`shared/rest/client.ts\`: the REST client the \`rest/\` layers use.
18881
+
18882
+ Online, a solution's folder lists everything it ships: https://www.wix.com/skills/headless-templates/storefront returns the URLs of the store's files, and \`…/storefront/app\` those of its React core. A part is often small enough to read whole in one call: https://www.wix.com/skills/headless-templates/storefront/seed/_content returns the store's seeding guide and scripts together. A whole solution passes the 150K cap, so read it part by part.
18883
+ `;
18693
18884
  var recipesIndexDoc = {
18694
18885
  url: "https://dev.wix.com/docs/api-reference/articles/ai-tools/wix-mcp/skills/wix-management-recipes-index",
18695
18886
  action: "include"
18696
18887
  };
18697
18888
  var README_INTRO = dedent_default`
18698
- <wix-usage-guide>
18889
+ # How to work with Wix through these tools
18699
18890
 
18700
- How to work with Wix through these tools:
18891
+ ## Source of truth
18701
18892
 
18702
- <source-of-truth>
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.
18704
- </source-of-truth>
18893
+ 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, a Wix skill (installed, or read online as the Wix skills section below explains), 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). When a Wix skill covers 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.
18705
18894
 
18706
- <management-flow>
18707
- <goal>
18895
+ ## Goal
18708
18896
  `;
18709
- var README_FLOWS_HEADING = dedent_default`
18710
- </goal>
18897
+ var README_FLOWS_HEADING = "## Wix MCP Flows";
18898
+ var README_FLOWS_SITE = dedent_default`
18899
+ ### The site
18711
18900
 
18712
- ## Wix MCP Site Management Flows
18901
+ The site context below lists the account's sites with their installed apps. Take the \`siteId\` from there; when more than one site fits and the user's words don't pick one, ask which before any read or write. A business solution's API (Stores, Bookings, CMS and the rest) works only on a site with that app installed, and some apps have versions with different endpoints (Wix Stores V1 vs V3): check the site's apps first, and when the app is missing, install it (a Wix skill has the steps) before using its API.
18713
18902
  `;
18714
- var README_BODY = dedent_default`
18715
- ### Discovery & Call Flow
18903
+ var README_FIND_SOURCES = dedent_default`
18904
+ ### Find the method
18716
18905
 
18717
- Common paths (use the highest you can satisfy for each method you'll call):
18718
- - Already have what you need from previous tool results in this conversation (not from memory) → ExecuteWixAPI
18719
- - Pick a matching article from the Recipes index below → ReadFullDocsArticle (find relevant code examples) → (probe SearchWixAPISpec for response shapes if needed) → ExecuteWixAPI
18720
- - SearchWixRESTDocumentation or BrowseWixRESTDocsMenu → ReadFullDocsArticle (find relevant code examples) → (probe SearchWixAPISpec for response shapes if needed) → ExecuteWixAPI
18721
- - SearchWixRESTDocumentation or BrowseWixRESTDocsMenu → ReadFullDocsArticle (no usable example) → SearchWixAPISpec for request schemas → ExecuteWixAPI
18906
+ A task may need several API methods. For each, take the first source that gives it:
18907
+ - A previous tool result in this conversation (not memory) already shows its request: go straight to the call.
18908
+ - A Wix skill that covers the task (the Wix skills section below says what each is for): follow it, from disk or online. When its example for a call matches your case, that is the source: pass its docs URL in \`sourceDocUrls\` instead of searching for the method pages (when it has no docs URL, one SearchWixRESTDocumentation call on its title finds the article).
18909
+ - The docs: SearchWixRESTDocumentation (semantic search) or BrowseWixRESTDocsMenu (menu hierarchy), then ReadFullDocsArticle on the method's article for its code examples. For SDK code, the CLI, a headless site or an app, start from those docs instead: SearchWixSDKDocumentation, SearchWixCLIDocumentation, SearchWixHeadlessDocumentation, SearchBuildAppsDocumentation.
18722
18910
 
18723
- Fallbacks: use ReadFullDocsMethodSchema in place of SearchWixAPISpec when SearchWixAPISpec is unavailable or didn't return enough detail; use CallWixSiteAPI in place of ExecuteWixAPI when a single REST call is enough and code adds no value.
18911
+ Keep each method's docs URL even when no source gives a usable example: the shape comes from its schema, as the next section says.
18912
+ `;
18913
+ var README_FLOWS_BODY = dedent_default`
18914
+ ### The exact shape
18724
18915
 
18725
- Tools (relevant for the management flow):
18726
- - SearchWixRESTDocumentation — semantic search over the Wix REST docs by keywords or natural-language queries.
18727
- - BrowseWixRESTDocsMenu — navigate the Wix REST docs by menu hierarchy; alternative to keyword search.
18728
- - ReadFullDocsArticle — fetch a full docs article by its docs URL; returns prose, fields, and code examples.
18729
- - SearchWixAPISpec — JS-sandboxed query over the REST API spec; returns request schema, response schema, and the executable \`method.publicUrl\`.
18730
- - ExecuteWixAPI — runs an async JS function in a sandbox with \`wix.request()\`; a single invocation can chain multiple API calls, paginate, loop, transform, and branch.
18916
+ A code example is the model for your call only when it matches your case, with every field your case needs. Fill the rest from the method's schema: SearchWixAPISpec on its docs URL (REST or SDK) returns the request and response schemas, \`method.publicUrl\` and \`method.sdk\`; ReadFullDocsMethodSchema when SearchWixAPISpec isn't available. A query's filter and sort fields and operators are a closed list per method: use only what its schema declares.
18731
18917
 
18732
- Steps:
18918
+ None of this comes from memory.
18733
18919
 
18734
- 1. A single user task may need one or more API methods. For each method you'll call, find a code example that fits the user's intent — you'll model the API call (URL, method, body) on it. An example only "fits" if it is **complete** (not truncated) AND matches your exact case — same operation and same variant/shape (e.g. the same \`productType\`), with every field your case needs actually shown. **If the closest example is truncated (it shows a \`... N more lines ...\` marker), do NOT call the API off it; continue discovery first: \`ReadFullDocsArticle\` for the complete example, or \`SearchWixAPISpec\` for the exact request schema.** Never fill in required fields from memory. Skip this step for any method you already have from a previous tool result in this conversation (not from memory):
18735
- a. First try the WixREADME Recipes index below (pre-curated guides for common tasks). If a recipe matches, ReadFullDocsArticle on its docs URL to find relevant code examples; many recipes cover multi-step flows and supply code examples for several methods in one article.
18736
- b. If no recipe matches the user's intent, or the matched recipe didn't yield the code examples you need, discover each missing method's docs URL via SearchWixRESTDocumentation (semantic search) or BrowseWixRESTDocsMenu (menu hierarchy), then ReadFullDocsArticle on each to find relevant code examples.
18737
- c. If neither path turns up a usable code example for some method, continue without one for that method — step 2 will derive its request directly from the schema. Make sure you've still captured the docs URL of each method.
18920
+ ### The call, or the code that makes it
18738
18921
 
18739
- 2. Before calling, fill any remaining gaps with SearchWixAPISpec on each method's docs URL. It returns both request and response schemas. For each method, check:
18740
- - **Request** (URL, HTTP method, body fields) — skip the probe if a code example already shows them; otherwise SearchWixAPISpec returns publicUrl + exact request shape.
18741
- - **Response shape** (field paths your code will read) — only relevant if your code reads response fields; skip the probe if the article(s) already made it clear; otherwise probe SearchWixAPISpec for the response schema.
18742
- - **Filter and sort** (query/search methods only) — an example proves only the fields and operators it uses. Each method declares which fields it can filter and sort by, and with which operators; that list is closed for fields and their operators and covers that method only — \`$and\`/\`$or\`/\`$not\` are filter syntax and never appear in it. Anything else errors or silently returns the wrong rows. A listed operator is valid on its own, since a field takes a single operator; to combine conditions, use the logical operators instead — \`$and\` and \`$or\` take an array of expressions, \`$not\` takes one, and they can nest.
18743
- - Never guess any of this from memory.
18922
+ **Call it with ExecuteWixAPI**: one async JS function with \`wix.request()\`, holding every step of the task that code can resolve. The reads that fetch an ID, check whether a record exists or list items to choose from go in the same function as the writes they feed; step numbers in a guide or skill give logical order, not separate calls. Set \`hasMutations: true\` when any step writes. Return the write's response as is and report from it; don't read again to confirm. A new invocation only for what code can't resolve: the user's answer, or a job that finishes later. One function chains calls, paginates, lists all, loops, transforms and branches. Without ExecuteWixAPI, make each call with CallWixSiteAPI (a site's APIs) or ManageWixSite (the account's), from the same exact shape.
18744
18923
 
18745
- 3. Before calling: collapse ALL planned steps — preliminary reads AND mutations — into a single async function. Step numbers in any guide or skill doc describe logical order for human comprehension — they do NOT define invocation boundaries. Steps that feed into each other belong in a single invocation: read, use the result, write, and return. A read that fetches IDs or checks existence before a create/update is part of that mutation's invocation, not a separate preceding call. This includes any read whose result feeds directly into a subsequent write — fetching a required ID, checking whether a record already exists, listing items to choose one — all belong in the same invocation as the write that follows. Set hasMutations: true whenever any step in the function writes. Return the mutation response directly — do not follow up with a read to confirm what was just created or updated; trust the response. Only split into multiple invocations when a later step genuinely depends on information you cannot resolve in code (e.g. a user decision or an out-of-band event). A single invocation can chain several related calls, paginate, "list all", loop, transform, and branch on responses.
18924
+ **Write the code** when the task is code the user keeps: an app (built and run with the Wix CLI), a headless site, or a script that calls the REST API or the JavaScript SDK. The path is the same: find the method, learn its exact shape, then write the call from \`method.publicUrl\` (REST) or \`method.sdk\` (the JavaScript SDK), never from memory. Every way of building against Wix in code is this path; the headless skills are a shortcut on it, not a different one. wix-headless-kit builds a Wix Headless site from shipped, verified code (wix-headless-templates holds it, one folder per business solution: a \`@wix/sdk\` React core, and the same data layer as plain REST calls for a stack that cannot run it): scaffold with the CLI, deploy, seed, design the presentation on the shipped code, release. What no shipped solution covers is written from the docs, as above. A new site is written in code and uploaded: StartDeployWebsite returns the upload guide (create the site, upload its files, change them later); StartHeadlessBuild returns the headless guide, for a site that needs Wix business features: you write the site, and the guide creates it, connects the features and uploads it, through the cold start that hands off to the kit (or the same run as API calls when there is no shell).
18746
18925
 
18747
- </management-flow>
18926
+ ### When a call fails
18748
18927
 
18749
- <other-uses>
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.
18751
- </other-uses>
18752
- </wix-usage-guide>
18928
+ The error carries the failed call's status and message and a Wix request id. Read it: it says what was wrong, and that is what to fix before calling again, whether the request (from the schema), the site and what is installed on it, or what the account is allowed to do. Never resend the same request unchanged, and never guess a fix. When you report the failure to the user, include the request id.
18753
18929
  `;
18754
- var defaultReadmeDocs = [
18755
- {
18756
- action: "text",
18757
- content: [
18758
- README_INTRO,
18759
- AGENT_GOAL,
18760
- README_FLOWS_HEADING,
18761
- "",
18762
- README_BODY
18763
- ].join("\n")
18764
- },
18765
- recipesIndexDoc
18766
- ];
18930
+ function buildReadmeDocs({
18931
+ recipesIndex = true
18932
+ } = {}) {
18933
+ return [
18934
+ {
18935
+ action: "text",
18936
+ content: [
18937
+ README_INTRO,
18938
+ "",
18939
+ AGENT_GOAL,
18940
+ "",
18941
+ README_FLOWS_HEADING,
18942
+ "",
18943
+ README_FLOWS_SITE,
18944
+ "",
18945
+ README_FIND_SOURCES,
18946
+ "",
18947
+ README_FLOWS_BODY
18948
+ ].join("\n")
18949
+ },
18950
+ { action: "text", content: WIX_SKILLS_README_SECTION },
18951
+ ...recipesIndex ? [recipesIndexDoc] : []
18952
+ ];
18953
+ }
18954
+ var defaultReadmeDocs = buildReadmeDocs();
18767
18955
  function mergeConfig(base, overrides) {
18768
18956
  return {
18769
18957
  toolDescriptions: {
@@ -18949,6 +19137,9 @@ function renderApps(apps, knownApps) {
18949
19137
  if (app.catalogVersion) {
18950
19138
  line += ` \u2014 Catalog app version: **${app.catalogVersion}**`;
18951
19139
  }
19140
+ if (app.invoicesVersion) {
19141
+ line += ` \u2014 Invoices app version: **${app.invoicesVersion}**`;
19142
+ }
18952
19143
  lines.push(line);
18953
19144
  }
18954
19145
  return lines.join("\n");
@@ -18969,6 +19160,11 @@ function renderCustomAppsWithSkillsTools(apps) {
18969
19160
  }
18970
19161
  return lines.join("\n");
18971
19162
  }
19163
+ function renderCompanionApp(installedApps) {
19164
+ const appId = installedApps.find((app) => app.companionApp === true)?.appId;
19165
+ if (!appId || !GUID_PATTERN.test(appId)) return "";
19166
+ return `The site's code lives in its companion app (ID: \`${appId}\`).`;
19167
+ }
18972
19168
  function renderProperties(props) {
18973
19169
  const sections = [];
18974
19170
  const regionalFormat = [];
@@ -18995,7 +19191,7 @@ ${contact.join("\n")}`);
18995
19191
  }
18996
19192
  return sections.join("\n\n");
18997
19193
  }
18998
- function renderSite(site, index, knownApps) {
19194
+ function renderSite(site, index, knownApps, includeCompanionApp) {
18999
19195
  const lines = [];
19000
19196
  const heading = site.displayName ?? `Site ${index}`;
19001
19197
  lines.push(`## ${index}. ${heading}`);
@@ -19040,6 +19236,13 @@ function renderSite(site, index, knownApps) {
19040
19236
  lines.push("");
19041
19237
  lines.push(customAppsWithSkillsToolsContent);
19042
19238
  }
19239
+ const companionAppContent = includeCompanionApp ? renderCompanionApp(site.installedApps ?? []) : "";
19240
+ if (companionAppContent) {
19241
+ lines.push("");
19242
+ lines.push("### Site code (companion app)");
19243
+ lines.push("");
19244
+ lines.push(companionAppContent);
19245
+ }
19043
19246
  lines.push("");
19044
19247
  lines.push("---");
19045
19248
  lines.push("");
@@ -19059,6 +19262,7 @@ function enrichDynamicContext(data, knownApps = {}, options = {}) {
19059
19262
  const response = snakeToCamel(parsed);
19060
19263
  const includePartnerContext = options.includePartnerContext ?? false;
19061
19264
  const includeAccountContext = options.includeAccountContext ?? false;
19265
+ const includeCompanionApp = options.includeCompanionApp ?? false;
19062
19266
  const sections = [];
19063
19267
  const allSites = response.sites ?? [];
19064
19268
  const maxSites = options.maxSites ?? Infinity;
@@ -19111,9 +19315,18 @@ function enrichDynamicContext(data, knownApps = {}, options = {}) {
19111
19315
  );
19112
19316
  sections.push("");
19113
19317
  }
19318
+ const hasInvoicesVersion = sitesToRender.some(
19319
+ (site) => site.installedApps?.some((app) => app.appId && knownApps[app.appId] && app.invoicesVersion)
19320
+ );
19321
+ if (hasInvoicesVersion) {
19322
+ sections.push(
19323
+ "> **Wix Invoices \u2014 Version**: Some sites below have Wix Invoices installed and show their Invoices version (V1/V2). When working on an Invoices task, check the version for that site \u2014 only read recipes and call endpoints that match its version. Never use an Invoices V2 skill or API on a V1 site, and vice versa."
19324
+ );
19325
+ sections.push("");
19326
+ }
19114
19327
  if (sitesToRender.length) {
19115
19328
  for (let i = 0; i < sitesToRender.length; i++) {
19116
- sections.push(renderSite(sitesToRender[i], i + 1, knownApps));
19329
+ sections.push(renderSite(sitesToRender[i], i + 1, knownApps, includeCompanionApp));
19117
19330
  }
19118
19331
  }
19119
19332
  if (!response.account && !siteCount && (!includePartnerContext || !hasPartnerContext(response.partnerContext))) {
@@ -19121,9 +19334,11 @@ function enrichDynamicContext(data, knownApps = {}, options = {}) {
19121
19334
  }
19122
19335
  return sections.join("\n");
19123
19336
  }
19337
+ var GUID_PATTERN;
19124
19338
  var init_enrich = __esm2({
19125
19339
  "src/enrich.ts"() {
19126
19340
  "use strict";
19341
+ GUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
19127
19342
  }
19128
19343
  });
19129
19344
  init_enrich();
@@ -19186,6 +19401,7 @@ async function getDynamicContext(auth, httpClient, filter, options) {
19186
19401
  } : options;
19187
19402
  const includePartnerContext = contextOptions?.partnerContextEnabled ?? true;
19188
19403
  const includeAccountContext = contextOptions?.includeAccountContext ?? true;
19404
+ const includeCompanionApp = contextOptions?.includeCompanionApp ?? false;
19189
19405
  try {
19190
19406
  const accountHeaders = await auth.getAccountAuthHeaders();
19191
19407
  const noFilter = !filter?.siteId && !filter?.siteName;
@@ -19239,6 +19455,7 @@ async function getDynamicContext(auth, httpClient, filter, options) {
19239
19455
  const context = enrichDynamicContext2(response.data, known_apps_default, {
19240
19456
  includePartnerContext,
19241
19457
  includeAccountContext,
19458
+ includeCompanionApp,
19242
19459
  // Cap the account-wide view to the first N sites; a targeted fetch returns one site.
19243
19460
  ...noFilter ? { maxSites: MAX_SITES_FOR_DYNAMIC_CONTEXT, totalSiteCount } : {}
19244
19461
  });
@@ -19292,6 +19509,21 @@ function isApiUrlAllowed(url) {
19292
19509
  }
19293
19510
 
19294
19511
  // src/config/param-descriptions.ts
19512
+ var REPORT_ISSUE_TO_WIX_PARAMS = {
19513
+ message: [
19514
+ "The report of one issue, sent to Wix as free text. Only this issue \u2014 no session summary, play-by-play or unrelated problems:",
19515
+ "- What was being attempted, in a sentence.",
19516
+ "- The tool or endpoint, the HTTP status and the error message.",
19517
+ "- What you expected instead, and the workaround if any.",
19518
+ "- Where the fault likely lives (API behavior / API schema / docs / Wix tooling / unsure), and whether you confirmed it.",
19519
+ "- The context needed to reproduce it: agent/model, site id, the Wix area or API.",
19520
+ "- The user's own words, verbatim, if they added any.",
19521
+ "NEVER include secrets \u2014 no bearer tokens, API keys, or credentials \u2014 and no personal data beyond what the report needs."
19522
+ ].join("\n"),
19523
+ requestId: "Optional request id (x-wix-request-id) of the failed Wix API call this report is about."
19524
+ };
19525
+ var WHY_NOT_EXECUTE_RECONNECT = "if the Wix MCP doesn't offer it at all, say so here, and tell the user once that their Wix connection may be an old or cached version that a reconnect refreshes.";
19526
+ var WHY_NOT_EXECUTE_NO_EXECUTE = "if it isn't in your tool list, say so.";
19295
19527
  var paramDescriptions = {
19296
19528
  CallWixSiteAPI: {
19297
19529
  siteId: "The id of the site selected using site selection tool",
@@ -19308,6 +19540,7 @@ var paramDescriptions = {
19308
19540
  WQL_FILTER_RULE
19309
19541
  ].join("\n"),
19310
19542
  reason: "One sentence explaining the original user request and why you are calling this API to complete it.",
19543
+ whyNotExecuteWixAPI: `One sentence: why this call goes through CallWixSiteAPI and not ExecuteWixAPI, the preferred tool. If ExecuteWixAPI isn't loaded, load it through your client's tool search before calling this tool; ${WHY_NOT_EXECUTE_RECONNECT}`,
19311
19544
  sourceDocUrl: [
19312
19545
  "The URL of the documentation or recipe where you found this API endpoint.",
19313
19546
  "MAKE SURE THE ENDPOINT URL IS REALLY THERE AND YOUR ARE NOT GUESSING IT !!!",
@@ -19343,18 +19576,9 @@ var paramDescriptions = {
19343
19576
  'Use ["other"] ONLY IF YOU HAVE A VERY GOOD REASON TO DO SO'
19344
19577
  ].join("\n")
19345
19578
  },
19346
- SupportAndFeedback: {
19347
- message: [
19348
- "The composed feedback message to send to Wix. Wix receives only free text, so a bare sentence is low-signal \u2014 send a summary of the whole session, not just the last error. Structure it in three layers:",
19349
- "1. Provenance \u2014 labelled lines (omit ones that do not apply): agent/model, Wix tooling used, Wix areas/APIs touched, Wix products (stores, bookings, ...), site id, relevant links (dashboard, docs pages read, live site) and other ids created this run.",
19350
- `2. Narrative \u2014 "In the user's words": anything the user added when you offered, quoted verbatim (redact secrets only). Then user intent + run summary (what they set out to build, what worked vs. what fought back), a condensed play-by-play of the session (key exchanges, tool calls, decisions), and the friction points \u2014 every place something got in the way, each with specifics: the step/endpoint, HTTP status and error message, the gap, the workaround, and what you expected instead. Include issues you recovered from.`,
19351
- '3. Attribution \u2014 for each significant friction point, your best diagnosis of where the fault lives: API behavior / API schema / API reference docs / docs articles or examples / Wix tooling (MCP tools, auth flow) / other-unsure \u2014 plus whether you confirmed it or are assuming. Do not force a tag; "unsure" beats a wrong route.',
19352
- "End with a bottom line: one or two sentences naming the single most important problem and its impact \u2014 a concise engineering assessment, not softened or hedged.",
19353
- "Write it as a scannable few paragraphs or a short bulleted list \u2014 thorough on the friction, distilled rather than a transcript dump.",
19354
- "NEVER include secrets \u2014 no bearer tokens, API keys, or credentials \u2014 and no personal data beyond what the feedback needs."
19355
- ].join("\n"),
19356
- requestId: "Optional request id (x-wix-request-id) returned from a failed Wix API call this feedback relates to."
19357
- },
19579
+ ReportIssueToWix: REPORT_ISSUE_TO_WIX_PARAMS,
19580
+ // The tool's former name, kept for importers that read it by that key.
19581
+ SupportAndFeedback: REPORT_ISSUE_TO_WIX_PARAMS,
19358
19582
  SearchWixWDSDocumentation: {
19359
19583
  searchTerm: "The search term to search for in the Wix Design System Documentation",
19360
19584
  maxResults: "The maximum number of results to return, default is 10, max is 15"
@@ -19393,8 +19617,13 @@ var paramDescriptions = {
19393
19617
  maxResults: "The maximum number of results to return, default is 10, max is 15",
19394
19618
  reason: "One sentence describing the original user request and the task you are trying to accomplish with this search."
19395
19619
  },
19620
+ SearchWixHelpCenter: {
19621
+ searchTerm: 'What the site owner wants to do or fix, in plain words (e.g. "connect a domain bought elsewhere", "cancel a Premium plan")',
19622
+ maxResults: "The maximum number of articles to return (1\u201315, default 15). Each article is returned with up to 60 lines.",
19623
+ reason: "One sentence describing the original user request and the task you are trying to accomplish with this search."
19624
+ },
19396
19625
  ReadFullDocsArticle: {
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."
19626
+ 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 Help Center articles (https://support.wix.com/en/article/...) are read as-is. 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. Source links (https://dev.wix.com/rawdocs/api/get-source-content?repo=...&path=...) found in skills and recipes are read as-is."
19398
19627
  },
19399
19628
  ReadFullDocsMethodSchema: {
19400
19629
  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).",
@@ -19410,7 +19639,7 @@ var paramDescriptions = {
19410
19639
  },
19411
19640
  UploadImageToWixSite: {
19412
19641
  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.",
19413
- 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.",
19642
+ image: `${fileParamNote("send the image as imageBase64 (the whole file, one per call) or as a public URL in imageUrls")} For plain image URLs the user pasted, use imageUrls instead. ALWAYS pass ALL files together in a single call \u2014 NEVER call this tool once per image. Do NOT use together with imageBase64.`,
19414
19643
  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.",
19415
19644
  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.',
19416
19645
  mimeType: 'MIME type of the image (e.g. "image/jpeg", "image/png", "image/webp"). Required when imageBase64 does not include a data URL prefix.',
@@ -19447,10 +19676,315 @@ var paramDescriptions = {
19447
19676
  };
19448
19677
  var desc = (toolName) => paramDescriptions[toolName];
19449
19678
 
19679
+ // src/docs/mintlify-docs.ts
19680
+ var MINTLIFY_LINKS_DOCS_SITE = "mintlify-links";
19681
+ var MINTLIFY_DOCS_SITE = "mintlify";
19682
+ var MINTLIFY_HOST = "https://wix-internal.mintlify.site";
19683
+ var MINTLIFY_HOSTNAMES = /* @__PURE__ */ new Set([
19684
+ "wix-internal.mintlify.site",
19685
+ "wix-internal.mintlify.app"
19686
+ ]);
19687
+ var DEV_WIX_DOCS = "https://dev.wix.com/docs";
19688
+ var PORTAL_SLUG_TO_TAB = {
19689
+ rest: "api-reference",
19690
+ "mintlify-sandbox": "sandbox"
19691
+ };
19692
+ var TAB_TO_PORTAL_SLUG = {
19693
+ sandbox: "mintlify-sandbox"
19694
+ };
19695
+ var MINTLIFY_TABS = /* @__PURE__ */ new Set(["api-reference", "sandbox", "kb"]);
19696
+ var NON_DOCS_SLUGS = /* @__PURE__ */ new Set(["skills", "kb-only", "api"]);
19697
+ var CHECK_TTL_MS = 10 * 60 * 1e3;
19698
+ var MAX_CHECK_ENTRIES = 5e3;
19699
+ var CHECK_TIMEOUT_MS = 5e3;
19700
+ var MAX_REDIRECTS = 3;
19701
+ var CHECK_CONCURRENCY = 8;
19702
+ function isMintlifyDocsSite(docsSite) {
19703
+ return docsSite === MINTLIFY_LINKS_DOCS_SITE || docsSite === MINTLIFY_DOCS_SITE;
19704
+ }
19705
+ var MINTLIFY_DOCUMENT_TYPES = {
19706
+ REST: ["MINTLIFY_REST"],
19707
+ // includes the skills, as REST + SKILLS does today
19708
+ SDK: ["MINTLIFY_SDK"]
19709
+ };
19710
+ function mintlifyDocumentTypes(docsSite, toolName) {
19711
+ return docsSite === MINTLIFY_DOCS_SITE ? MINTLIFY_DOCUMENT_TYPES[toolName] : void 0;
19712
+ }
19713
+ function isMintlifyUrl(url) {
19714
+ try {
19715
+ return MINTLIFY_HOSTNAMES.has(new URL(url).hostname);
19716
+ } catch {
19717
+ return false;
19718
+ }
19719
+ }
19720
+ var MINTLIFY_URL_PREFIXES = [...MINTLIFY_HOSTNAMES].map(
19721
+ (host) => `https://${host}/`
19722
+ );
19723
+ function cleanPath(pathname) {
19724
+ const path = pathname.replace(/\.md$/, "").replace(/\/+$/, "");
19725
+ return path === "" ? "/" : path;
19726
+ }
19727
+ function flavourOf(url) {
19728
+ return url.searchParams.get("apiView")?.toUpperCase() === "SDK" ? "sdk" : "rest";
19729
+ }
19730
+ function toMintlifyCandidate(rawUrl) {
19731
+ let url;
19732
+ try {
19733
+ url = new URL(rawUrl);
19734
+ } catch {
19735
+ return null;
19736
+ }
19737
+ if (MINTLIFY_HOSTNAMES.has(url.hostname)) {
19738
+ const path2 = cleanPath(url.pathname);
19739
+ return { url: `${MINTLIFY_HOST}${path2}`, path: path2, flavour: flavourOf(url) };
19740
+ }
19741
+ if (url.hostname !== "dev.wix.com" || !url.pathname.startsWith("/docs/")) {
19742
+ return null;
19743
+ }
19744
+ const segments = cleanPath(url.pathname.slice("/docs".length)).split("/").filter(Boolean);
19745
+ if (segments.length === 0 || NON_DOCS_SLUGS.has(segments[0])) {
19746
+ return null;
19747
+ }
19748
+ segments[0] = PORTAL_SLUG_TO_TAB[segments[0]] ?? segments[0];
19749
+ const path = `/${segments.join("/")}`;
19750
+ return { url: `${MINTLIFY_HOST}${path}`, path, flavour: flavourOf(url) };
19751
+ }
19752
+ function toDevWixUrl(rawUrl) {
19753
+ const url = new URL(rawUrl);
19754
+ const segments = cleanPath(url.pathname).split("/").filter(Boolean);
19755
+ if (segments.length > 0) {
19756
+ segments[0] = TAB_TO_PORTAL_SLUG[segments[0]] ?? segments[0];
19757
+ }
19758
+ const query = flavourOf(url) === "sdk" ? "?apiView=SDK" : "";
19759
+ return `${DEV_WIX_DOCS}/${segments.join("/")}${query}`;
19760
+ }
19761
+ var checkCache = /* @__PURE__ */ new Map();
19762
+ function rememberCheck(path, result) {
19763
+ const now = Date.now();
19764
+ checkCache.delete(path);
19765
+ if (checkCache.size >= MAX_CHECK_ENTRIES) {
19766
+ for (const [key, entry] of checkCache) {
19767
+ if (entry.expires <= now) checkCache.delete(key);
19768
+ }
19769
+ }
19770
+ while (checkCache.size >= MAX_CHECK_ENTRIES) {
19771
+ const oldest = checkCache.keys().next().value;
19772
+ if (oldest === void 0) break;
19773
+ checkCache.delete(oldest);
19774
+ }
19775
+ checkCache.set(path, { result, expires: now + CHECK_TTL_MS });
19776
+ }
19777
+ async function headOnce(url) {
19778
+ return fetch(url, {
19779
+ method: "HEAD",
19780
+ redirect: "manual",
19781
+ signal: AbortSignal.timeout(CHECK_TIMEOUT_MS)
19782
+ });
19783
+ }
19784
+ async function checkMintlifyPage(path) {
19785
+ const cached = checkCache.get(path);
19786
+ if (cached && cached.expires > Date.now()) {
19787
+ return cached.result;
19788
+ }
19789
+ if (cached) checkCache.delete(path);
19790
+ let result;
19791
+ try {
19792
+ let current = path;
19793
+ let hops = 0;
19794
+ for (; ; ) {
19795
+ const response = await headOnce(`${MINTLIFY_HOST}${current}`);
19796
+ if (response.status === 200) {
19797
+ result = {
19798
+ outcome: hops === 0 ? "identity" : "redirect",
19799
+ path: current
19800
+ };
19801
+ break;
19802
+ }
19803
+ const location = response.headers.get("location");
19804
+ if (response.status >= 300 && response.status < 400 && location && hops < MAX_REDIRECTS) {
19805
+ current = cleanPath(new URL(location, MINTLIFY_HOST).pathname);
19806
+ hops++;
19807
+ continue;
19808
+ }
19809
+ result = { outcome: response.status === 404 ? "missing" : "error" };
19810
+ break;
19811
+ }
19812
+ } catch (error) {
19813
+ logger.error(`[mintlify] page check failed for ${path}: ${error}`);
19814
+ result = { outcome: "error" };
19815
+ }
19816
+ rememberCheck(path, result);
19817
+ return result;
19818
+ }
19819
+ async function resolveDocsLink(rawUrl, { verify = true } = {}) {
19820
+ const candidate = toMintlifyCandidate(rawUrl);
19821
+ if (!candidate) {
19822
+ return { outcome: "not-docs", url: rawUrl };
19823
+ }
19824
+ const tab = candidate.path.split("/")[1];
19825
+ if (!MINTLIFY_TABS.has(tab)) {
19826
+ return { outcome: "other-portal", url: rawUrl };
19827
+ }
19828
+ const query = candidate.flavour === "sdk" ? "?apiView=SDK" : "";
19829
+ if (!verify) {
19830
+ return { outcome: "identity", url: `${candidate.url}${query}` };
19831
+ }
19832
+ const check = await checkMintlifyPage(candidate.path);
19833
+ if (check.path) {
19834
+ return {
19835
+ outcome: check.outcome,
19836
+ url: `${MINTLIFY_HOST}${check.path}${query}`
19837
+ };
19838
+ }
19839
+ return { outcome: check.outcome, url: rawUrl };
19840
+ }
19841
+ var DOCS_LINK_PATTERN = /https:\/\/(?:dev\.wix\.com\/docs|wix-internal\.mintlify\.(?:site|app))\/[^\s)\]"'<>`]*/g;
19842
+ function trimTrailingPunctuation(url) {
19843
+ return url.replace(/[.,;:!?*]+$/, "");
19844
+ }
19845
+ var MINTLIFY_LINK_PATTERN = /https:\/\/wix-internal\.mintlify\.(?:site|app)\/[^\s)\]"'<>`]*/g;
19846
+ function toDevWixHostText(text) {
19847
+ return text.replace(MINTLIFY_LINK_PATTERN, (match) => {
19848
+ const link = trimTrailingPunctuation(match);
19849
+ let url;
19850
+ try {
19851
+ url = new URL(link);
19852
+ } catch {
19853
+ return match;
19854
+ }
19855
+ if (!MINTLIFY_TABS.has(url.pathname.split("/")[1] ?? "")) return match;
19856
+ return toDevWixUrl(link) + url.hash + match.slice(link.length);
19857
+ });
19858
+ }
19859
+ async function mapWithConcurrency(items, limit, fn) {
19860
+ const results = new Array(items.length);
19861
+ let next = 0;
19862
+ const workers = Array.from(
19863
+ { length: Math.min(limit, items.length) },
19864
+ async () => {
19865
+ while (next < items.length) {
19866
+ const index = next++;
19867
+ results[index] = await fn(items[index]);
19868
+ }
19869
+ }
19870
+ );
19871
+ await Promise.all(workers);
19872
+ return results;
19873
+ }
19874
+ async function rewriteDocsLinks(text, { verify = true, label = "text" } = {}) {
19875
+ const found = [
19876
+ ...new Set(
19877
+ (text.match(DOCS_LINK_PATTERN) ?? []).map(trimTrailingPunctuation)
19878
+ )
19879
+ ];
19880
+ const stats = {
19881
+ links: found.length,
19882
+ byOutcome: {},
19883
+ misses: []
19884
+ };
19885
+ if (found.length === 0) {
19886
+ return { text, stats };
19887
+ }
19888
+ const resolved = await mapWithConcurrency(
19889
+ found,
19890
+ CHECK_CONCURRENCY,
19891
+ (url) => resolveDocsLink(url, { verify })
19892
+ );
19893
+ const replacements = /* @__PURE__ */ new Map();
19894
+ found.forEach((url, i) => {
19895
+ const { outcome, url: target } = resolved[i];
19896
+ stats.byOutcome[outcome] = (stats.byOutcome[outcome] ?? 0) + 1;
19897
+ if (outcome === "identity" || outcome === "redirect") {
19898
+ if (target !== url) replacements.set(url, target);
19899
+ } else if (outcome !== "not-docs") {
19900
+ stats.misses.push(`${outcome} ${url}`);
19901
+ }
19902
+ });
19903
+ const rewritten = text.replace(DOCS_LINK_PATTERN, (match) => {
19904
+ const url = trimTrailingPunctuation(match);
19905
+ const target = replacements.get(url);
19906
+ return target ? target + match.slice(url.length) : match;
19907
+ });
19908
+ logger.log(
19909
+ `[mintlify] ${label}: ${stats.links} links ${JSON.stringify(stats.byOutcome)}` + (stats.misses.length ? ` misses: ${stats.misses.slice(0, 10).join(" | ")}` : "")
19910
+ );
19911
+ return { text: rewritten, stats };
19912
+ }
19913
+ var INDEX_BANNER = /^> ## Documentation Index\n(?:>.*\n)*\n?/;
19914
+ var INLINED_SNIPPET = /^export const \w+ = [\s\S]*?^};\n/gm;
19915
+ var REST_TAB = /<Tab title="REST">([\s\S]*?)<\/Tab>/;
19916
+ var SDK_TAB = /<Tab title="SDK">([\s\S]*?)<\/Tab>/;
19917
+ function cleanMintlifyMarkdown(markdown, flavour) {
19918
+ const text = markdown.replace(INLINED_SNIPPET, "");
19919
+ const rest = text.match(REST_TAB);
19920
+ const sdk = text.match(SDK_TAB);
19921
+ if (!rest || !sdk || (text.match(/<Tab title=/g) ?? []).length !== 2) {
19922
+ return text;
19923
+ }
19924
+ const start = text.lastIndexOf("<Tabs>", rest.index);
19925
+ const end = text.indexOf("</Tabs>", sdk.index);
19926
+ if (start === -1 || end === -1) {
19927
+ return text;
19928
+ }
19929
+ const kept = (flavour === "sdk" ? sdk : rest)[1];
19930
+ const note = flavour === "sdk" ? "_This is the SDK view. Drop `?apiView=SDK` from the URL for the REST view._" : "_This is the REST view. Add `?apiView=SDK` to the URL for the JavaScript SDK view._";
19931
+ return `${text.slice(0, start)}${note}
19932
+
19933
+ ${kept.trim()}
19934
+ ${text.slice(end + "</Tabs>".length)}`;
19935
+ }
19936
+ var DOCS_URL_IN_TEXT = /https:\/\/dev\.wix\.com\/docs\/(?=api-reference\b|\.\.\.)/g;
19937
+ function toMintlifyHostText(text) {
19938
+ return text.replace(DOCS_URL_IN_TEXT, `${MINTLIFY_HOST}/`);
19939
+ }
19940
+ var SITE_RELATIVE_LINK = /(\]\(|href=["'])\/(?!\/)/g;
19941
+ function absolutizeSiteLinks(markdown) {
19942
+ return markdown.replace(
19943
+ SITE_RELATIVE_LINK,
19944
+ (_, open) => `${open}${MINTLIFY_HOST}/`
19945
+ );
19946
+ }
19947
+ async function readMintlifyMarkdown(rawUrl) {
19948
+ const resolved = await resolveDocsLink(rawUrl);
19949
+ if (resolved.outcome !== "identity" && resolved.outcome !== "redirect") {
19950
+ return null;
19951
+ }
19952
+ const pageUrl = new URL(resolved.url);
19953
+ const response = await fetch(`${MINTLIFY_HOST}${pageUrl.pathname}.md`, {
19954
+ headers: { accept: "text/markdown" },
19955
+ redirect: "follow",
19956
+ signal: AbortSignal.timeout(15e3)
19957
+ });
19958
+ if (response.status === 404) {
19959
+ return null;
19960
+ }
19961
+ if (!response.ok) {
19962
+ throw new Error(
19963
+ `Mintlify returned ${response.status} for ${pageUrl.pathname}.md`
19964
+ );
19965
+ }
19966
+ const flavour = toMintlifyCandidate(rawUrl)?.flavour ?? "rest";
19967
+ const cleaned = cleanMintlifyMarkdown(
19968
+ (await response.text()).replace(INDEX_BANNER, ""),
19969
+ flavour
19970
+ );
19971
+ const { text: rewritten } = await rewriteDocsLinks(cleaned, {
19972
+ label: `read ${pageUrl.pathname}`
19973
+ });
19974
+ const markdown = absolutizeSiteLinks(rewritten);
19975
+ logger.log(
19976
+ `[mintlify] read ${pageUrl.pathname}.md (${markdown.length} chars) for ${rawUrl}`
19977
+ );
19978
+ return { url: `${MINTLIFY_HOST}${pageUrl.pathname}`, markdown };
19979
+ }
19980
+
19450
19981
  // src/docs/get-to-know.ts
19982
+ var AX_SKILLS_REPO = "wix-private/ax-skills";
19983
+ var AX_SKILLS_INDEX_PATH = "skills/wix-manage/SKILL.md";
19451
19984
  function addGetSiteContextTool({
19452
19985
  server,
19453
19986
  authStrategy,
19987
+ includeCompanionApp = false,
19454
19988
  toolDescriptions
19455
19989
  }) {
19456
19990
  const d = desc("GetSiteContext");
@@ -19480,7 +20014,8 @@ function addGetSiteContextTool({
19480
20014
  try {
19481
20015
  context = await getDynamicContext(authStrategy, httpClient, filter, {
19482
20016
  partnerContextEnabled: false,
19483
- includeAccountContext: false
20017
+ includeAccountContext: false,
20018
+ includeCompanionApp
19484
20019
  });
19485
20020
  } catch (err) {
19486
20021
  rethrowIfUnauthorized(err);
@@ -19516,15 +20051,17 @@ async function addGetToKnowTools({
19516
20051
  dynamicContextEnabled,
19517
20052
  repo,
19518
20053
  commitHash,
19519
- skillsTags
20054
+ skillsTags,
20055
+ readmeRecipesIndexEnabled = true,
20056
+ docsSite
19520
20057
  }) {
19521
20058
  if (disableTools.includes("WixREADME")) {
19522
20059
  return;
19523
20060
  }
19524
20061
  const baseDocs = readmeDocs ?? defaultReadmeDocs;
19525
- const baseDocsWithoutRecipes = baseDocs.filter(
19526
- (doc) => doc.url !== RECIPES_INDEX_URL
19527
- );
20062
+ const isRecipesIndex = (doc) => doc.url?.replace(/\.md$/, "") === RECIPES_INDEX_URL;
20063
+ const baseDocsWithoutRecipes = baseDocs.filter((doc) => !isRecipesIndex(doc));
20064
+ const recipesIndexDocs = readmeRecipesIndexEnabled ? baseDocs.filter(isRecipesIndex) : [];
19528
20065
  server.tool(
19529
20066
  "WixREADME",
19530
20067
  toolDescriptions?.["WixREADME"] ?? defaultToolDescriptions.WixREADME,
@@ -19596,6 +20133,18 @@ ${responseText}` : responseText;
19596
20133
  if (!url) {
19597
20134
  throw new Error('URL is required for "include" action');
19598
20135
  }
20136
+ const readsAxSkills = isRecipesIndex({ action, url }) && !skillsPortalUrl && (repo ? repo === AX_SKILLS_REPO : !commitHash);
20137
+ if (readsAxSkills) {
20138
+ return {
20139
+ type: "text",
20140
+ text: await fetchSourceContent(
20141
+ httpClient,
20142
+ AX_SKILLS_REPO,
20143
+ AX_SKILLS_INDEX_PATH,
20144
+ repo === AX_SKILLS_REPO ? commitHash : void 0
20145
+ )
20146
+ };
20147
+ }
19599
20148
  const fetchedContent = await fetchArticleContent(
19600
20149
  httpClient,
19601
20150
  url,
@@ -19638,9 +20187,9 @@ Failed to fetch content: ${errorMsg}`
19638
20187
  }).catch((err) => {
19639
20188
  console.error("[WixREADME] Failed to fetch skills by portal:", err);
19640
20189
  return null;
19641
- }) : fetchDoc({ action: "include", url: RECIPES_INDEX_URL }).then(
20190
+ }) : readmeRecipesIndexEnabled ? fetchDoc({ action: "include", url: RECIPES_INDEX_URL }).then(
19642
20191
  (doc) => doc?.text ?? null
19643
- );
20192
+ ) : Promise.resolve(null);
19644
20193
  const filter = {};
19645
20194
  if (siteId) filter.siteId = siteId;
19646
20195
  else if (siteName) filter.siteName = siteName;
@@ -19660,7 +20209,7 @@ Failed to fetch content: ${errorMsg}`
19660
20209
  const recipesIntro = dedent_default`
19661
20210
  Reusable how-to guides for common ${isVisitorFlow ? "Wix site visitor" : "Wix management"} tasks, grouped by product area. Each recipe is a Wix docs article that bundles the right endpoints, request shapes, field names, and step ordering for one real-world use case.
19662
20211
 
19663
- Scan the index below and open any relevant article with \`ReadFullDocsArticle\`. If the article contains a code example that fits the user's intent — a **complete** example (not a truncated \`... N more lines ...\` snippet) that matches your exact case, same variant/shape — call the API directly. If the closest example is truncated or omits a field your case needs, do NOT call the API off it — continue discovery first: \`ReadFullDocsArticle\` for the complete example, or \`SearchWixAPISpec\` for the exact schema. On query and search methods an example proves only the fields and operators it uses; the endpoint's own declared list covers the rest. Otherwise (no fitting recipe, no usable code example, or persistent errors after retrying), fall back to docs discovery: \`SearchWixRESTDocumentation\` or \`BrowseWixRESTDocsMenu\` to find the right method, then \`SearchWixAPISpec\` for the exact schema.
20212
+ Open the recipe that matches the task with \`ReadFullDocsArticle\` and follow it. When its example for a call matches your case (the same variant and shape), call from it; when it doesn't, or leaves out a field your case needs, read the method's schema with \`SearchWixAPISpec\` first. On query and search methods an example proves only the fields and operators it uses; the method's own declared list covers the rest. When no recipe fits, find the method with \`SearchWixRESTDocumentation\` or \`BrowseWixRESTDocsMenu\`, then \`SearchWixAPISpec\` for its schema.
19664
20213
  `;
19665
20214
  const recipesContents = skillsContent !== null ? [
19666
20215
  await fetchDoc({
@@ -19670,9 +20219,7 @@ Failed to fetch content: ${errorMsg}`
19670
20219
 
19671
20220
  ${skillsContent}`
19672
20221
  })
19673
- ] : await Promise.all(
19674
- baseDocs.filter((doc) => doc.url === RECIPES_INDEX_URL).map(fetchDoc)
19675
- );
20222
+ ] : await Promise.all(recipesIndexDocs.map(fetchDoc));
19676
20223
  const recipeNotes = !skillsContent?.includes("Dashboard Navigation") ? [] : [
19677
20224
  await fetchDoc({
19678
20225
  action: "text",
@@ -19690,7 +20237,8 @@ ${skillsContent}`
19690
20237
  ).map((item) => item.text),
19691
20238
  ...dynamicContext ? [dynamicContext] : []
19692
20239
  ];
19693
- const text = parts.join("\n\n");
20240
+ const joined = parts.join("\n\n");
20241
+ const text = isMintlifyDocsSite(docsSite) ? (await rewriteDocsLinks(joined, { label: "readme WixREADME" })).text : joined;
19694
20242
  return {
19695
20243
  content: [{ type: "text", text }]
19696
20244
  };
@@ -19699,13 +20247,14 @@ ${skillsContent}`
19699
20247
  }
19700
20248
 
19701
20249
  // src/docs/start-deploy-website.ts
20250
+ var NO_PERSONAL_DATA = "No personal data: no names, emails, phones, passwords, keys or local paths.";
19702
20251
  var START_DEPLOY_WEBSITE_PARAM_DESCRIPTIONS = {
19703
- userRequest: "The user's request that led here, quoted if short, otherwise summarized in a sentence.",
19704
- siteDescription: "What the site is: its purpose and who it is for. One or two sentences.",
19705
- siteForm: "The form the site exists in right now (HTML/CSS/JS files, a static build, a zip, another builder's export, a design created in this conversation, or something else), roughly how many files, and whether it includes images.",
19706
- siteFunctionality: "What the site must be able to do for its visitors beyond showing pages, if anything (for example selling, bookings or reservations, tickets, menus and orders, rentals, forms, memberships or paid plans, donations, a blog, or anything else the user expects to work), in your own words. If it is a plain static site with no such needs, say so.",
19707
- agentIdentity: "Which agent or product you are and the harness you run in.",
19708
- wixAccess: "How you can reach Wix from where you run: through this MCP only, or also from a shell whose network can reach wixapis.com; whether you can run the Wix CLI (npx @wix/cli) there and whether it is logged in; and which Wix identity you act with \u2014 the user's login through this MCP, a CLI login, or none."
20252
+ userRequest: `A short summary of what the user asked for and the context that led here, in a sentence or two, including whether this is a new site or an edit or new version of a site already on Wix. ${NO_PERSONAL_DATA}`,
20253
+ siteDescription: `What the site is: its purpose and who it is for. One or two sentences. ${NO_PERSONAL_DATA}`,
20254
+ siteForm: `The form the site exists in right now (HTML/CSS/JS files, a static build, a zip, a framework project, another builder's export, a design created in this conversation, or something else), roughly how many files, and whether it includes images. For a framework project: which framework, whether you have its built static output (for example dist/) or only the source, and whether it needs a server at runtime (SSR, API routes, a backend), or that you don't know. Also where it came from: built in this conversation, the user's own project or repo, another builder (which one), or a Wix skill or template (which one). ${NO_PERSONAL_DATA}`,
20255
+ siteFunctionality: `What the site must be able to do for its visitors beyond showing pages, if anything (for example selling, bookings or reservations, tickets, menus and orders, rentals, forms, memberships or paid plans, donations, a blog, or anything else the user expects to work), in your own words. If it is a plain static site with no such needs, say so. ${NO_PERSONAL_DATA}`,
20256
+ agentIdentity: `Which agent or product you are, which model if you know it, and the harness you run in. ${NO_PERSONAL_DATA}`,
20257
+ wixAccess: `How you can reach Wix from where you run: through this MCP only, or also from a shell whose network can reach wixapis.com; whether you can run the Wix CLI (npx @wix/cli) there and whether it is logged in; which Wix identity you act with \u2014 the user's login through this MCP, a CLI login, or none; and which Wix skills you have (for example wix-headless-kit or wix-manage), by name and where they come from (installed on disk, a plugin, read online), or none. Name the kind of identity, not the account or its email. ${NO_PERSONAL_DATA}`
19709
20258
  };
19710
20259
  var START_DEPLOY_WEBSITE_PARAMS = Object.keys(
19711
20260
  START_DEPLOY_WEBSITE_PARAM_DESCRIPTIONS
@@ -19713,10 +20262,11 @@ var START_DEPLOY_WEBSITE_PARAMS = Object.keys(
19713
20262
  var START_DEPLOY_WEBSITE_TOOL_NAME = "StartDeployWebsite";
19714
20263
  var START_DEPLOY_WEBSITE_RECIPE_URL = "https://dev.wix.com/docs/api-reference/account-level/sites/skills/upload-a-website-or-html-files.md";
19715
20264
  var DROP_PAGE_URL = "https://www.wix.com/headless/drop?utm_campaign=mcp";
20265
+ var WRITE_THE_CODE_LINE = "When the user brought no files, write the site's code yourself, then upload it as the guide shows.";
19716
20266
  var FALLBACK_LINE = `Only if you cannot run it (you can't reach the file bytes, or a step fails and you can't fix it): send the user to ${DROP_PAGE_URL} \u2014 give that URL exactly as written, keeping the utm_campaign=mcp parameter.`;
19717
20267
  function startDeployWebsiteResponse(recipe) {
19718
20268
  return [
19719
- `The following is the content of ${START_DEPLOY_WEBSITE_RECIPE_URL}. Follow it end to end and do the publishing yourself \u2014 do not hand the user instructions.`,
20269
+ `The following is the content of ${START_DEPLOY_WEBSITE_RECIPE_URL}. Follow it end to end and do the publishing yourself \u2014 do not hand the user instructions. ${WRITE_THE_CODE_LINE}`,
19720
20270
  FALLBACK_LINE,
19721
20271
  "---",
19722
20272
  recipe.trim()
@@ -19724,7 +20274,7 @@ function startDeployWebsiteResponse(recipe) {
19724
20274
  }
19725
20275
  var START_DEPLOY_WEBSITE_POINTER_RESPONSE = [
19726
20276
  `Read and follow this recipe end to end: ${START_DEPLOY_WEBSITE_RECIPE_URL}`,
19727
- "It covers creating the site and uploading the files (with or without a Wix login), updating a site deployed this way, and implementing a backend on it (stores, bookings, CMS, members) as a Wix Headless project. Do the publishing yourself \u2014 do not hand the user instructions.",
20277
+ `It covers creating the site and uploading the files (with or without a Wix login), updating a site deployed this way, and implementing a backend on it (stores, bookings, CMS, members) as a Wix Headless project. Do the publishing yourself \u2014 do not hand the user instructions. ${WRITE_THE_CODE_LINE}`,
19728
20278
  FALLBACK_LINE
19729
20279
  ].join("\n\n");
19730
20280
  function addStartDeployWebsiteTool(server, disableTools = [], toolDescriptions, fetchOptions = {}) {
@@ -19772,36 +20322,21 @@ function addStartDeployWebsiteTool(server, disableTools = [], toolDescriptions,
19772
20322
  // src/docs/start-headless-build.ts
19773
20323
  var START_HEADLESS_BUILD_TOOL_NAME = "StartHeadlessBuild";
19774
20324
  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
20325
  var START_HEADLESS_BUILD_PARAM_DESCRIPTIONS = {
19783
20326
  userRequest: START_DEPLOY_WEBSITE_PARAM_DESCRIPTIONS.userRequest,
19784
20327
  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.",
20328
+ startingPoint: `What the site starts from, in your own words: a new site; an existing Wix Headless site (a site deployed from files is one), with its metaSiteId if you have it; a project download link (a download.zip from Wix); a Wix site moving to code; or something else. ${NO_PERSONAL_DATA}`,
19786
20329
  siteFunctionality: START_DEPLOY_WEBSITE_PARAM_DESCRIPTIONS.siteFunctionality,
19787
20330
  agentIdentity: START_DEPLOY_WEBSITE_PARAM_DESCRIPTIONS.agentIdentity,
19788
20331
  wixAccess: START_DEPLOY_WEBSITE_PARAM_DESCRIPTIONS.wixAccess
19789
20332
  };
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
- }
20333
+ var BUILT_HERE = "The site is built here, in code: don't offer Wix's editor or a template instead.";
20334
+ var PREFIX2 = `The following is Wix's headless guide. Follow it end to end and do the work yourself: you write the site, and the guide creates it, connects its Wix business features, and uploads it. ${BUILT_HERE}`;
20335
+ function startHeadlessBuildResponse(guide) {
19797
20336
  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
- );
20337
+ return [PREFIX2, "---", guide.trim()].join("\n\n");
19803
20338
  }
19804
- return lines.join("\n\n");
20339
+ return `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. ${BUILT_HERE}`;
19805
20340
  }
19806
20341
  function addStartHeadlessBuildTool(server, disableTools = [], toolDescriptions, fetchOptions = {}) {
19807
20342
  if (disableTools.includes(START_HEADLESS_BUILD_TOOL_NAME)) {
@@ -19814,13 +20349,13 @@ function addStartHeadlessBuildTool(server, disableTools = [], toolDescriptions,
19814
20349
  {
19815
20350
  userRequest: external_exports.string().min(1).describe(d.userRequest),
19816
20351
  siteDescription: external_exports.string().min(1).describe(d.siteDescription),
19817
- startingPoint: external_exports.enum(START_HEADLESS_BUILD_STARTING_POINTS).describe(d.startingPoint),
20352
+ startingPoint: external_exports.string().optional().describe(d.startingPoint),
19818
20353
  siteFunctionality: external_exports.string().min(1).describe(d.siteFunctionality),
19819
20354
  agentIdentity: external_exports.string().min(1).describe(d.agentIdentity),
19820
20355
  wixAccess: external_exports.string().min(1).describe(d.wixAccess)
19821
20356
  },
19822
20357
  { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
19823
- async (args, { httpClient }) => {
20358
+ async (_args, { httpClient }) => {
19824
20359
  let guide;
19825
20360
  try {
19826
20361
  guide = await fetchArticleContent(
@@ -19842,7 +20377,7 @@ function addStartHeadlessBuildTool(server, disableTools = [], toolDescriptions,
19842
20377
  content: [
19843
20378
  {
19844
20379
  type: "text",
19845
- text: startHeadlessBuildResponse(guide, args.startingPoint)
20380
+ text: startHeadlessBuildResponse(guide)
19846
20381
  }
19847
20382
  ]
19848
20383
  };
@@ -19893,7 +20428,8 @@ var addDocsTools = (server, allowedTools = [
19893
20428
  "WIX_HEADLESS",
19894
20429
  "BUSINESS_SOLUTIONS",
19895
20430
  "CLI",
19896
- "OVERVIEW"
20431
+ "OVERVIEW",
20432
+ "HELP_CENTER"
19897
20433
  ], options = {}) => {
19898
20434
  const {
19899
20435
  getToKnowWixEnabled = false,
@@ -19909,14 +20445,47 @@ var addDocsTools = (server, allowedTools = [
19909
20445
  skillsPr,
19910
20446
  commitHash,
19911
20447
  skillsTags,
20448
+ readmeRecipesIndexEnabled,
19912
20449
  dynamicContextEnabled,
20450
+ includeCompanionApp,
19913
20451
  usePlatformizedSearch = true,
19914
- usePlatformizedBrowse = true
20452
+ usePlatformizedBrowse = true,
20453
+ docsSite
19915
20454
  } = options;
19916
20455
  const effectiveRepo = repo ?? skillsRepo;
19917
20456
  const effectiveCommitHash = commitHash ?? skillsPr;
19918
- const getDescription = (toolName, defaultDesc) => toolDescriptions?.[toolName] ?? defaultDesc;
20457
+ const mintlifyDocs = isMintlifyDocsSite(docsSite);
20458
+ const runSearch = mintlifyDocs ? async (params) => {
20459
+ const documentTypes = mintlifyDocumentTypes(docsSite, params.toolName);
20460
+ const result = await runSemanticSearchAndFormat(
20461
+ documentTypes ? { ...params, documentTypes } : params
20462
+ );
20463
+ return (await rewriteDocsLinks(result, { label: `search ${params.toolName}` })).text;
20464
+ } : runSemanticSearchAndFormat;
20465
+ const docsUrlPrefixes = mintlifyDocs ? ["https://dev.wix.com/docs/", ...MINTLIFY_URL_PREFIXES] : ["https://dev.wix.com/docs/"];
20466
+ const toBackendUrl = (url) => mintlifyDocs && isMintlifyUrl(url) ? toDevWixUrl(url) : url;
20467
+ const sourceNote = (source) => mintlifyDocs ? [{ type: "text", text: `[docs source] ${source}` }] : [];
20468
+ const docsText = (text) => mintlifyDocs ? toMintlifyHostText(text) : text;
20469
+ const desc2 = (toolName) => {
20470
+ const descriptions = desc(toolName);
20471
+ if (!mintlifyDocs) return descriptions;
20472
+ return Object.fromEntries(
20473
+ Object.entries(descriptions).map(([param, text]) => [
20474
+ param,
20475
+ docsText(text)
20476
+ ])
20477
+ );
20478
+ };
20479
+ const getDescription = (toolName, defaultDesc) => docsText(toolDescriptions?.[toolName] ?? defaultDesc);
19919
20480
  const fetchMenuTextForUrl = async (httpClient, url) => {
20481
+ const text = await fetchMenuTextForBackendUrl(
20482
+ httpClient,
20483
+ toBackendUrl(url)
20484
+ );
20485
+ if (!text || !mintlifyDocs) return text;
20486
+ return (await rewriteDocsLinks(text, { verify: false, label: "menu" })).text;
20487
+ };
20488
+ const fetchMenuTextForBackendUrl = async (httpClient, url) => {
19920
20489
  if (usePlatformizedBrowse) {
19921
20490
  try {
19922
20491
  return await fetchPlatformizedMenu(url);
@@ -19933,10 +20502,25 @@ var addDocsTools = (server, allowedTools = [
19933
20502
  }
19934
20503
  return menuContent.length > MENU_CONTENT_THRESHOLD ? summarizeLargeMenu(menuContent, url) : normalizeMenuContent(menuContent);
19935
20504
  };
20505
+ if (startDeployWebsiteEnabled) {
20506
+ addStartDeployWebsiteTool(server, disableTools || [], toolDescriptions, {
20507
+ skillsPortalUrl,
20508
+ repo: effectiveRepo,
20509
+ commitHash: effectiveCommitHash
20510
+ });
20511
+ }
20512
+ if (startHeadlessBuildEnabled) {
20513
+ addStartHeadlessBuildTool(server, disableTools || [], toolDescriptions, {
20514
+ skillsPortalUrl,
20515
+ repo: effectiveRepo,
20516
+ commitHash: effectiveCommitHash
20517
+ });
20518
+ }
19936
20519
  if (dynamicContextEnabled && authStrategy && !disableTools?.includes("GetSiteContext")) {
19937
20520
  addGetSiteContextTool({
19938
20521
  server,
19939
20522
  authStrategy,
20523
+ includeCompanionApp,
19940
20524
  toolDescriptions,
19941
20525
  disableTools: disableTools || []
19942
20526
  });
@@ -19952,21 +20536,9 @@ var addDocsTools = (server, allowedTools = [
19952
20536
  dynamicContextEnabled,
19953
20537
  repo: effectiveRepo,
19954
20538
  commitHash: effectiveCommitHash,
19955
- skillsTags
19956
- });
19957
- }
19958
- if (startDeployWebsiteEnabled) {
19959
- addStartDeployWebsiteTool(server, disableTools || [], toolDescriptions, {
19960
- skillsPortalUrl,
19961
- repo: effectiveRepo,
19962
- commitHash: effectiveCommitHash
19963
- });
19964
- }
19965
- if (startHeadlessBuildEnabled) {
19966
- addStartHeadlessBuildTool(server, disableTools || [], toolDescriptions, {
19967
- skillsPortalUrl,
19968
- repo: effectiveRepo,
19969
- commitHash: effectiveCommitHash
20539
+ skillsTags,
20540
+ readmeRecipesIndexEnabled,
20541
+ docsSite
19970
20542
  });
19971
20543
  }
19972
20544
  if (allowedTools.includes("WDS") && !disableTools?.includes("SearchWixWDSDocumentation")) {
@@ -19977,7 +20549,7 @@ var addDocsTools = (server, allowedTools = [
19977
20549
  defaultToolDescriptions.SearchWixWDSDocumentation ?? ""
19978
20550
  ),
19979
20551
  (() => {
19980
- const d = desc("SearchWixWDSDocumentation");
20552
+ const d = desc2("SearchWixWDSDocumentation");
19981
20553
  return {
19982
20554
  searchTerm: external_exports.string().describe(d.searchTerm),
19983
20555
  maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(15)
@@ -19987,7 +20559,7 @@ var addDocsTools = (server, allowedTools = [
19987
20559
  async ({ searchTerm, maxResults }, { panorama }) => {
19988
20560
  try {
19989
20561
  logger.log(`Searching for ${searchTerm} in Wix WDS`);
19990
- const result = await runSemanticSearchAndFormat({
20562
+ const result = await runSearch({
19991
20563
  toolName: "WDS",
19992
20564
  toolParams: {
19993
20565
  searchTerm
@@ -20030,7 +20602,7 @@ var addDocsTools = (server, allowedTools = [
20030
20602
  defaultToolDescriptions.SearchWixRESTDocumentation
20031
20603
  ),
20032
20604
  (() => {
20033
- const d = desc("SearchWixRESTDocumentation");
20605
+ const d = desc2("SearchWixRESTDocumentation");
20034
20606
  return {
20035
20607
  searchTerm: external_exports.string().describe(d.searchTerm),
20036
20608
  maxResults: external_exports.number().describe(d.maxResults).min(1).max(17).optional().default(17),
@@ -20043,7 +20615,7 @@ var addDocsTools = (server, allowedTools = [
20043
20615
  logger.log(
20044
20616
  `[SearchWixRESTDocumentation] searchTerm="${searchTerm}", reason="${reason}"`
20045
20617
  );
20046
- const result = await runSemanticSearchAndFormat({
20618
+ const result = await runSearch({
20047
20619
  toolName: "REST",
20048
20620
  toolParams: {
20049
20621
  searchTerm
@@ -20094,7 +20666,7 @@ var addDocsTools = (server, allowedTools = [
20094
20666
  defaultToolDescriptions.WixBusinessFlowsDocumentation ?? ""
20095
20667
  ),
20096
20668
  (() => {
20097
- const d = desc("WixBusinessFlowsDocumentation");
20669
+ const d = desc2("WixBusinessFlowsDocumentation");
20098
20670
  return {
20099
20671
  searchTerm: external_exports.string().describe(d.searchTerm),
20100
20672
  maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(15)
@@ -20104,7 +20676,7 @@ var addDocsTools = (server, allowedTools = [
20104
20676
  async ({ searchTerm, maxResults }, { panorama }) => {
20105
20677
  try {
20106
20678
  logger.log(`Searching for ${searchTerm} in Wix Sample Flows`);
20107
- const result = await runSemanticSearchAndFormat({
20679
+ const result = await runSearch({
20108
20680
  toolName: "BUSINESS_SOLUTIONS",
20109
20681
  toolParams: {
20110
20682
  searchTerm: "**RECIPE**: Business Recipes - full setup flow for::: " + searchTerm
@@ -20150,7 +20722,7 @@ var addDocsTools = (server, allowedTools = [
20150
20722
  defaultToolDescriptions.SearchWixSDKDocumentation ?? ""
20151
20723
  ),
20152
20724
  (() => {
20153
- const d = desc("SearchWixSDKDocumentation");
20725
+ const d = desc2("SearchWixSDKDocumentation");
20154
20726
  return {
20155
20727
  searchTerm: external_exports.string().describe(d.searchTerm),
20156
20728
  maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(15)
@@ -20161,7 +20733,7 @@ var addDocsTools = (server, allowedTools = [
20161
20733
  try {
20162
20734
  logger.log(`Searching for ${searchTerm} in Wix SDK`);
20163
20735
  panorama.transaction("SearchWixSDKDocumentation").start({ maxResults });
20164
- const result = await runSemanticSearchAndFormat({
20736
+ const result = await runSearch({
20165
20737
  toolName: "SDK",
20166
20738
  toolParams: {
20167
20739
  searchTerm
@@ -20209,7 +20781,7 @@ var addDocsTools = (server, allowedTools = [
20209
20781
  defaultToolDescriptions.SearchBuildAppsDocumentation ?? ""
20210
20782
  ),
20211
20783
  (() => {
20212
- const d = desc("SearchBuildAppsDocumentation");
20784
+ const d = desc2("SearchBuildAppsDocumentation");
20213
20785
  return {
20214
20786
  searchTerm: external_exports.string().describe(d.searchTerm),
20215
20787
  maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(15)
@@ -20219,7 +20791,7 @@ var addDocsTools = (server, allowedTools = [
20219
20791
  async ({ searchTerm, maxResults }, { panorama }) => {
20220
20792
  try {
20221
20793
  logger.log(`Searching for ${searchTerm} in Build Apps`);
20222
- const result = await runSemanticSearchAndFormat({
20794
+ const result = await runSearch({
20223
20795
  toolName: "BUILD_APPS",
20224
20796
  toolParams: {
20225
20797
  searchTerm: `wix cli docs for ${searchTerm}`
@@ -20261,7 +20833,7 @@ var addDocsTools = (server, allowedTools = [
20261
20833
  defaultToolDescriptions.SearchDevelopmentDocumentation ?? ""
20262
20834
  ),
20263
20835
  (() => {
20264
- const d = desc("SearchDevelopmentDocumentation");
20836
+ const d = desc2("SearchDevelopmentDocumentation");
20265
20837
  return {
20266
20838
  searchTerm: external_exports.string().describe(d.searchTerm),
20267
20839
  maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(15)
@@ -20271,7 +20843,7 @@ var addDocsTools = (server, allowedTools = [
20271
20843
  async ({ searchTerm, maxResults }, { panorama }) => {
20272
20844
  try {
20273
20845
  logger.log(`Searching for ${searchTerm} in Wix Overview`);
20274
- const result = await runSemanticSearchAndFormat({
20846
+ const result = await runSearch({
20275
20847
  toolName: "OVERVIEW",
20276
20848
  toolParams: {
20277
20849
  searchTerm
@@ -20313,7 +20885,7 @@ var addDocsTools = (server, allowedTools = [
20313
20885
  defaultToolDescriptions.SearchWixHeadlessDocumentation ?? ""
20314
20886
  ),
20315
20887
  (() => {
20316
- const d = desc("SearchWixHeadlessDocumentation");
20888
+ const d = desc2("SearchWixHeadlessDocumentation");
20317
20889
  return {
20318
20890
  searchTerm: external_exports.string().describe(d.searchTerm),
20319
20891
  maxResults: external_exports.number().describe(d.maxResults).min(1).max(17).optional().default(17)
@@ -20323,7 +20895,7 @@ var addDocsTools = (server, allowedTools = [
20323
20895
  async ({ searchTerm, maxResults }, { panorama }) => {
20324
20896
  try {
20325
20897
  logger.log(`Searching for ${searchTerm} in Headless`);
20326
- const result = await runSemanticSearchAndFormat({
20898
+ const result = await runSearch({
20327
20899
  toolName: "WIX_HEADLESS",
20328
20900
  toolParams: {
20329
20901
  searchTerm
@@ -20368,7 +20940,7 @@ var addDocsTools = (server, allowedTools = [
20368
20940
  defaultToolDescriptions.SearchWixVeloDocumentation ?? ""
20369
20941
  ),
20370
20942
  (() => {
20371
- const d = desc("SearchWixVeloDocumentation");
20943
+ const d = desc2("SearchWixVeloDocumentation");
20372
20944
  return {
20373
20945
  searchTerm: external_exports.string().describe(d.searchTerm),
20374
20946
  maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(15)
@@ -20377,26 +20949,83 @@ var addDocsTools = (server, allowedTools = [
20377
20949
  { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
20378
20950
  async ({ searchTerm, maxResults }, { panorama }) => {
20379
20951
  try {
20380
- logger.log(`Searching for ${searchTerm} in Velo`);
20381
- panorama.transaction("SearchWixVeloDocumentation").start({ maxResults });
20952
+ logger.log(`Searching for ${searchTerm} in Velo`);
20953
+ panorama.transaction("SearchWixVeloDocumentation").start({ maxResults });
20954
+ const result = await runSearch({
20955
+ toolName: "VELO",
20956
+ toolParams: {
20957
+ searchTerm
20958
+ },
20959
+ maxResults: Math.max(1, Math.min(maxResults ?? 15, 15)),
20960
+ linesInEachResult: 30,
20961
+ usePlatformizedSearch
20962
+ });
20963
+ panorama.transaction("SearchWixVeloDocumentation").finish({ maxResults });
20964
+ return {
20965
+ content: [
20966
+ {
20967
+ type: "text",
20968
+ text: [
20969
+ result,
20970
+ "you should use ReadFullDocsArticle tool if you want to read full documentation for a specific article or method."
20971
+ ].join("\n---\n")
20972
+ }
20973
+ ]
20974
+ };
20975
+ } catch (error) {
20976
+ panorama.errorMonitor().reportError(error);
20977
+ captureException(error, {
20978
+ tags: {
20979
+ componentId: "SearchWixVeloDocumentation",
20980
+ toolName: "SearchWixVeloDocumentation"
20981
+ }
20982
+ });
20983
+ logger.error(`Error searching for ${searchTerm} in Velo: ${error}`);
20984
+ return {
20985
+ isError: true,
20986
+ content: [{ type: "text", text: "Error: " + error.message }]
20987
+ };
20988
+ }
20989
+ }
20990
+ );
20991
+ }
20992
+ if (allowedTools.includes("HELP_CENTER") && !disableTools?.includes("SearchWixHelpCenter")) {
20993
+ server.tool(
20994
+ "SearchWixHelpCenter",
20995
+ getDescription(
20996
+ "SearchWixHelpCenter",
20997
+ defaultToolDescriptions.SearchWixHelpCenter ?? ""
20998
+ ),
20999
+ (() => {
21000
+ const d = desc2("SearchWixHelpCenter");
21001
+ return {
21002
+ searchTerm: external_exports.string().describe(d.searchTerm),
21003
+ maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(15),
21004
+ reason: external_exports.string().describe(d.reason)
21005
+ };
21006
+ })(),
21007
+ { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
21008
+ async ({ searchTerm, maxResults, reason }, { panorama }) => {
21009
+ try {
21010
+ logger.log(
21011
+ `[SearchWixHelpCenter] searchTerm="${searchTerm}", reason="${reason}"`
21012
+ );
20382
21013
  const result = await runSemanticSearchAndFormat({
20383
- toolName: "VELO",
21014
+ toolName: "HELP_CENTER",
20384
21015
  toolParams: {
20385
21016
  searchTerm
20386
21017
  },
20387
21018
  maxResults: Math.max(1, Math.min(maxResults ?? 15, 15)),
20388
- linesInEachResult: 30,
21019
+ linesInEachResult: 60,
20389
21020
  usePlatformizedSearch
20390
21021
  });
20391
- panorama.transaction("SearchWixVeloDocumentation").finish({ maxResults });
20392
21022
  return {
20393
21023
  content: [
20394
21024
  {
20395
21025
  type: "text",
20396
- text: [
20397
- result,
20398
- "you should use ReadFullDocsArticle tool if you want to read full documentation for a specific article or method."
20399
- ].join("\n---\n")
21026
+ text: `${HELP_CENTER_IS_FOR_PEOPLE}
21027
+
21028
+ ${result}`
20400
21029
  }
20401
21030
  ]
20402
21031
  };
@@ -20404,14 +21033,23 @@ var addDocsTools = (server, allowedTools = [
20404
21033
  panorama.errorMonitor().reportError(error);
20405
21034
  captureException(error, {
20406
21035
  tags: {
20407
- componentId: "SearchWixVeloDocumentation",
20408
- toolName: "SearchWixVeloDocumentation"
21036
+ componentId: "SearchWixHelpCenter",
21037
+ toolName: "SearchWixHelpCenter"
20409
21038
  }
20410
21039
  });
20411
- logger.error(`Error searching for ${searchTerm} in Velo: ${error}`);
21040
+ logger.error(
21041
+ `Error searching for ${searchTerm} in the Wix Help Center: ${error}`
21042
+ );
20412
21043
  return {
20413
21044
  isError: true,
20414
- content: [{ type: "text", text: "Error: " + error.message }]
21045
+ content: [
21046
+ {
21047
+ type: "text",
21048
+ text: `Error: ${error.message}
21049
+
21050
+ ${HELP_CENTER_IS_FOR_PEOPLE}`
21051
+ }
21052
+ ]
20415
21053
  };
20416
21054
  }
20417
21055
  }
@@ -20425,7 +21063,7 @@ var addDocsTools = (server, allowedTools = [
20425
21063
  defaultToolDescriptions.SearchWixCLIDocumentation ?? ""
20426
21064
  ),
20427
21065
  (() => {
20428
- const d = desc("SearchWixCLIDocumentation");
21066
+ const d = desc2("SearchWixCLIDocumentation");
20429
21067
  return {
20430
21068
  searchTerm: external_exports.string().describe(d.searchTerm),
20431
21069
  maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(15),
@@ -20438,7 +21076,7 @@ var addDocsTools = (server, allowedTools = [
20438
21076
  logger.log(
20439
21077
  `[SearchWixCLIDocumentation] searchTerm="${searchTerm}", reason="${reason}"`
20440
21078
  );
20441
- const result = await runSemanticSearchAndFormat({
21079
+ const result = await runSearch({
20442
21080
  toolName: "CLI",
20443
21081
  toolParams: {
20444
21082
  searchTerm
@@ -20482,14 +21120,39 @@ var addDocsTools = (server, allowedTools = [
20482
21120
  defaultToolDescriptions.ReadFullDocsArticle
20483
21121
  ),
20484
21122
  (() => {
20485
- const d = desc("ReadFullDocsArticle");
21123
+ const d = desc2("ReadFullDocsArticle");
20486
21124
  return {
20487
21125
  articleUrl: external_exports.string().url().describe(d.articleUrl)
20488
21126
  };
20489
21127
  })(),
20490
21128
  { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
20491
21129
  async ({ articleUrl }, { httpClient }) => {
20492
- const validPrefixes = ["https://dev.wix.com/docs/"];
21130
+ const source = parseSourceContentUrl(articleUrl);
21131
+ if (source) {
21132
+ try {
21133
+ const text = await fetchSourceContent(
21134
+ httpClient,
21135
+ source.repo,
21136
+ source.path,
21137
+ source.commitHash
21138
+ );
21139
+ return { content: [{ type: "text", text }] };
21140
+ } catch (error) {
21141
+ logger.error(
21142
+ `Error fetching source content for ${articleUrl}: ${error}`
21143
+ );
21144
+ return {
21145
+ isError: true,
21146
+ content: [
21147
+ {
21148
+ type: "text",
21149
+ text: formatDocsReadError("source content", error)
21150
+ }
21151
+ ]
21152
+ };
21153
+ }
21154
+ }
21155
+ const validPrefixes = [...docsUrlPrefixes, "https://support.wix.com/"];
20493
21156
  if (skillsPortalUrl) validPrefixes.push(skillsPortalUrl);
20494
21157
  const isSkillsPage = isSkillsRegistryUrl(articleUrl);
20495
21158
  if (!isSkillsPage && !validPrefixes.some((p) => articleUrl.startsWith(p))) {
@@ -20498,7 +21161,7 @@ var addDocsTools = (server, allowedTools = [
20498
21161
  content: [
20499
21162
  {
20500
21163
  type: "text",
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}"`
21164
+ text: `Invalid article URL: must start with https://dev.wix.com/docs/ or https://support.wix.com/, or be a Wix skills page (https://www.wix.com/skills/..., https://www.wix.com/headless/..., or that file's github.com/wix/skills source). Got: "${articleUrl}"`
20502
21165
  }
20503
21166
  ]
20504
21167
  };
@@ -20506,6 +21169,27 @@ var addDocsTools = (server, allowedTools = [
20506
21169
  if (!isSkillsPage && articleUrl.startsWith("https://dev.wix.com/docs/")) {
20507
21170
  articleUrl = articleUrl.replace(/\.md$/, "");
20508
21171
  }
21172
+ if (mintlifyDocs && !isSkillsPage) {
21173
+ try {
21174
+ const page = await readMintlifyMarkdown(articleUrl);
21175
+ if (page) {
21176
+ return {
21177
+ content: [
21178
+ {
21179
+ type: "text",
21180
+ text: isQueryOrSearchEndpoint(page.url) ? [page.markdown, ARTICLE_CAPABILITY_NOTE].join("\n\n") : page.markdown
21181
+ },
21182
+ ...sourceNote(`Mintlify site: ${page.url}.md`)
21183
+ ]
21184
+ };
21185
+ }
21186
+ } catch (error) {
21187
+ logger.error(
21188
+ `[mintlify] reading ${articleUrl} from Mintlify failed, falling back: ${error}`
21189
+ );
21190
+ }
21191
+ articleUrl = toBackendUrl(articleUrl);
21192
+ }
20509
21193
  try {
20510
21194
  const articleContent = await fetchArticleContent(
20511
21195
  httpClient,
@@ -20526,7 +21210,10 @@ var addDocsTools = (server, allowedTools = [
20526
21210
  // The article's own URL, never its body — a filter/sort reference page links query
20527
21211
  // methods in its prose but isn't one.
20528
21212
  text: isQueryOrSearchEndpoint(articleUrl) ? [articleContent, ARTICLE_CAPABILITY_NOTE].join("\n\n") : articleContent
20529
- }
21213
+ },
21214
+ ...sourceNote(
21215
+ isSkillsPage ? `skills registry: ${articleUrl}` : `today's backend (dev.wix.com/rawdocs, ingvar), not on the Mintlify site: ${articleUrl}`
21216
+ )
20530
21217
  ]
20531
21218
  };
20532
21219
  } catch (error) {
@@ -20572,7 +21259,7 @@ ${text}`
20572
21259
  defaultToolDescriptions.ReadFullDocsMethodSchema
20573
21260
  ),
20574
21261
  (() => {
20575
- const d = desc("ReadFullDocsMethodSchema");
21262
+ const d = desc2("ReadFullDocsMethodSchema");
20576
21263
  return {
20577
21264
  articleUrl: external_exports.string().url().describe(d.articleUrl),
20578
21265
  reason: external_exports.string().describe(d.reason)
@@ -20580,7 +21267,7 @@ ${text}`
20580
21267
  })(),
20581
21268
  { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
20582
21269
  async ({ articleUrl, reason }, { httpClient }) => {
20583
- const validPrefixes = ["https://dev.wix.com/docs/"];
21270
+ const validPrefixes = [...docsUrlPrefixes];
20584
21271
  if (skillsPortalUrl) validPrefixes.push(skillsPortalUrl);
20585
21272
  if (!validPrefixes.some((p) => articleUrl.startsWith(p))) {
20586
21273
  return {
@@ -20596,6 +21283,7 @@ ${text}`
20596
21283
  if (articleUrl.startsWith("https://dev.wix.com/docs/")) {
20597
21284
  articleUrl = articleUrl.replace(/\.md$/, "");
20598
21285
  }
21286
+ articleUrl = toBackendUrl(articleUrl);
20599
21287
  try {
20600
21288
  logger.log(
20601
21289
  `[ReadFullDocsMethodSchema] url="${articleUrl}", reason="${reason}"`
@@ -20613,12 +21301,18 @@ ${text}`
20613
21301
  if (!articleContent) {
20614
21302
  throw new Error("Method schema is empty");
20615
21303
  }
21304
+ const schemaText = mintlifyDocs ? (await rewriteDocsLinks(articleContent, {
21305
+ label: "schema ReadFullDocsMethodSchema"
21306
+ })).text : articleContent;
20616
21307
  return {
20617
21308
  content: [
20618
21309
  {
20619
21310
  type: "text",
20620
- text: articleContent
20621
- }
21311
+ text: schemaText
21312
+ },
21313
+ ...sourceNote(
21314
+ `PAPI, through today's backend (dev.wix.com/rawdocs, ingvar): ${articleUrl}`
21315
+ )
20622
21316
  ]
20623
21317
  };
20624
21318
  } catch (error) {
@@ -20664,7 +21358,7 @@ ${text}`
20664
21358
  defaultToolDescriptions.BrowseWixRESTDocsMenu
20665
21359
  ),
20666
21360
  (() => {
20667
- const d = desc("BrowseWixRESTDocsMenu");
21361
+ const d = desc2("BrowseWixRESTDocsMenu");
20668
21362
  return {
20669
21363
  menuUrl: external_exports.string().optional().describe(d.menuUrl),
20670
21364
  reason: external_exports.string().describe(d.reason)
@@ -20673,7 +21367,7 @@ ${text}`
20673
21367
  { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
20674
21368
  async ({ menuUrl, reason }, { httpClient }) => {
20675
21369
  try {
20676
- if (menuUrl && !menuUrl.startsWith("https://dev.wix.com/docs/")) {
21370
+ if (menuUrl && !docsUrlPrefixes.some((p) => menuUrl.startsWith(p))) {
20677
21371
  return {
20678
21372
  content: [
20679
21373
  {
@@ -20956,7 +21650,7 @@ function resolveBase64Image(imageBase64, mimeType) {
20956
21650
  function errorResponse(text) {
20957
21651
  return { isError: true, content: [{ type: "text", text }] };
20958
21652
  }
20959
- async function uploadFromUrl(item, authHeaders, displayName) {
21653
+ async function uploadFromUrl(item, authHeaders, displayName, imagePickerToolName) {
20960
21654
  if (!item.download_url) {
20961
21655
  return {
20962
21656
  success: false,
@@ -20966,7 +21660,7 @@ async function uploadFromUrl(item, authHeaders, displayName) {
20966
21660
  if (!/^https?:\/\//i.test(item.download_url)) {
20967
21661
  return {
20968
21662
  success: false,
20969
- error: `download_url must be a publicly accessible http(s) URL, not a local or sandbox file path (got: "${item.download_url}"). For a user-attached file, pass the file so the platform resolves it to a real download_url; if you only have the raw bytes, use imageBase64 instead.`
21663
+ error: `This server can't read files on your machine or sandbox (got: "${item.download_url}"). Send this image as imageBase64 (the whole file, one per call) or as a public URL in imageUrls${imagePickerToolName ? `, or call ${imagePickerToolName} so the user picks it` : ""}.`
20970
21664
  };
20971
21665
  }
20972
21666
  try {
@@ -21064,7 +21758,10 @@ function formatBatchResults(results) {
21064
21758
  };
21065
21759
  }
21066
21760
  function addUploadImageTool(server, strategy, options) {
21067
- const description = options?.description ?? defaultToolDescriptions.UploadImageToWixSite;
21761
+ const imagePickerToolName = options?.imagePickerToolName;
21762
+ const baseDescription = options?.description || defaultToolDescriptions.UploadImageToWixSite;
21763
+ const description = imagePickerToolName ? `${baseDescription}
21764
+ If you can't deliver the image any of these ways, call ${imagePickerToolName} so the user picks it.` : baseDescription;
21068
21765
  const hints = {
21069
21766
  readOnlyHint: options?.hints?.readOnlyHint ?? false,
21070
21767
  destructiveHint: options?.hints?.destructiveHint ?? false,
@@ -21131,7 +21828,9 @@ function addUploadImageTool(server, strategy, options) {
21131
21828
  try {
21132
21829
  const authHeaders = await strategy.getSiteAuthHeaders(siteId);
21133
21830
  const urlResults = await Promise.all(
21134
- urlItems.map((item) => uploadFromUrl(item, authHeaders, displayName))
21831
+ urlItems.map(
21832
+ (item) => uploadFromUrl(item, authHeaders, displayName, imagePickerToolName)
21833
+ )
21135
21834
  );
21136
21835
  let base64Result = null;
21137
21836
  if (imageBase64) {
@@ -21198,7 +21897,8 @@ function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_
21198
21897
  }
21199
21898
  return { text: responseText, isError: false, originalLength, returnedRows };
21200
21899
  }
21201
- function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "ListWixSites", "ManageWixSite"], disableTools = [], enableTools = [], toolDescriptions, toolHints, maxResponseSize) {
21900
+ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "ListWixSites", "ManageWixSite"], disableTools = [], enableTools = [], toolDescriptions, toolHints, maxResponseSize, options) {
21901
+ const executeAdvice = (text, reconnect, plain) => options?.executeWixAPIServed ? text : text.replace(reconnect, plain);
21202
21902
  const effectiveAllowedTools = [
21203
21903
  .../* @__PURE__ */ new Set([...allowedTools, ...enableTools])
21204
21904
  ].filter((tool) => !disableTools.includes(tool));
@@ -21211,7 +21911,14 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
21211
21911
  if (effectiveAllowedTools.includes("CallWixSiteAPI") && !disableTools.includes("CallWixSiteAPI")) {
21212
21912
  server.tool(
21213
21913
  "CallWixSiteAPI",
21214
- getDescription("CallWixSiteAPI", defaultToolDescriptions.CallWixSiteAPI),
21914
+ executeAdvice(
21915
+ getDescription(
21916
+ "CallWixSiteAPI",
21917
+ defaultToolDescriptions.CallWixSiteAPI
21918
+ ),
21919
+ CALL_WIX_SITE_API_RECONNECT_LINE,
21920
+ CALL_WIX_SITE_API_NO_EXECUTE_LINE
21921
+ ),
21215
21922
  (() => {
21216
21923
  const d = desc("CallWixSiteAPI");
21217
21924
  return {
@@ -21220,6 +21927,13 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
21220
21927
  method: external_exports.string().describe(d.method),
21221
21928
  body: external_exports.union([external_exports.object({}).passthrough(), external_exports.array(external_exports.unknown())]).optional().describe(d.body),
21222
21929
  reason: external_exports.string().describe(d.reason),
21930
+ whyNotExecuteWixAPI: external_exports.string().optional().describe(
21931
+ executeAdvice(
21932
+ d.whyNotExecuteWixAPI,
21933
+ WHY_NOT_EXECUTE_RECONNECT,
21934
+ WHY_NOT_EXECUTE_NO_EXECUTE
21935
+ )
21936
+ ),
21223
21937
  sourceDocUrl: external_exports.string().describe(d.sourceDocUrl)
21224
21938
  };
21225
21939
  })(),
@@ -21230,9 +21944,17 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
21230
21944
  destructiveHint: true,
21231
21945
  openWorldHint: true
21232
21946
  }),
21233
- async ({ url, body, method, siteId, reason, sourceDocUrl }, { httpClient, setToolBiParams }) => {
21947
+ async ({
21948
+ url,
21949
+ body,
21950
+ method,
21951
+ siteId,
21952
+ reason,
21953
+ whyNotExecuteWixAPI,
21954
+ sourceDocUrl
21955
+ }, { httpClient, setToolBiParams }) => {
21234
21956
  logger.log(
21235
- `[CallWixSiteAPI] siteId=${siteId}, method=${method}, url=${url}, sourceDocUrl=${sourceDocUrl}, reason="${reason}", body=${JSON.stringify(body)}`
21957
+ `[CallWixSiteAPI] siteId=${siteId}, method=${method}, url=${url}, sourceDocUrl=${sourceDocUrl}, reason="${reason}", whyNotExecuteWixAPI="${whyNotExecuteWixAPI ?? ""}", body=${JSON.stringify(body)}`
21236
21958
  );
21237
21959
  const requestHeaders = {
21238
21960
  // Ask the Wix API edge for JSON error bodies (it serves a branded HTML
@@ -21475,7 +22197,8 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
21475
22197
  if (effectiveAllowedTools.includes("UploadImageToWixSite") && !disableTools.includes("UploadImageToWixSite")) {
21476
22198
  addUploadImageTool(server, strategy, {
21477
22199
  description: getDescription("UploadImageToWixSite", ""),
21478
- hints: toolHints?.["UploadImageToWixSite"]
22200
+ hints: toolHints?.["UploadImageToWixSite"],
22201
+ imagePickerToolName: options?.imagePickerToolName
21479
22202
  });
21480
22203
  }
21481
22204
  }
@@ -21493,10 +22216,14 @@ function truncateResponse(content, maxChars = DEFAULT_MAX_CHARS) {
21493
22216
  const truncated = text.slice(0, effectiveMax);
21494
22217
  const estimatedTokens = Math.ceil(text.length / CHARS_PER_TOKEN);
21495
22218
  const limitTokens = Math.ceil(effectiveMax / CHARS_PER_TOKEN);
21496
- return `${truncated}
22219
+ const cutChars = text.length - effectiveMax;
22220
+ const note = `Response was ~${estimatedTokens.toLocaleString()} tokens (limit: ${limitTokens.toLocaleString()}). Showing the first ${effectiveMax.toLocaleString()} of ${text.length.toLocaleString()} characters; the last ${cutChars.toLocaleString()} were cut. To get the rest, run again and return less per call \u2014 only the fields you need, the next page (cursor or offset), or the next slice of a large array \u2014 and repeat until you have it all.`;
22221
+ return `[TRUNCATED: ${note}]
22222
+
22223
+ ${truncated}
21497
22224
 
21498
22225
  --- TRUNCATED ---
21499
- Response was ~${estimatedTokens.toLocaleString()} tokens (limit: ${limitTokens.toLocaleString()}). Refine your code to return less data.`;
22226
+ ${note}`;
21500
22227
  }
21501
22228
 
21502
22229
  // src/graphql/constants.ts
@@ -22257,7 +22984,7 @@ ${text.slice(0, 2e3)}`
22257
22984
 
22258
22985
  // src/code-mode/attachments.ts
22259
22986
  var MAX_ATTACHMENTS_BYTES = 10 * 1024 * 1024;
22260
- var MAX_REDIRECTS = 4;
22987
+ var MAX_REDIRECTS2 = 4;
22261
22988
  var OAI_USERCONTENT_HOST = /^[a-z0-9-]+\.oaiusercontent\.com$/;
22262
22989
  var OAI_BLOB_ACCOUNTS = new Set(
22263
22990
  [
@@ -22331,7 +23058,7 @@ async function fetchAllowed(start, fetchImpl, label) {
22331
23058
  const isRedirect = res.status >= 300 && res.status < 400 && location;
22332
23059
  if (!isRedirect) return res;
22333
23060
  await res.body?.cancel().catch(() => void 0);
22334
- if (hop >= MAX_REDIRECTS) {
23061
+ if (hop >= MAX_REDIRECTS2) {
22335
23062
  throw new AttachmentError(`${label}: too many redirects.`);
22336
23063
  }
22337
23064
  let next;
@@ -22497,7 +23224,13 @@ async function unzip(z) {
22497
23224
  let p = u32(end + 16);
22498
23225
  let total = 0;
22499
23226
  const decoder = new TextDecoder();
22500
- for (let i = 0, n = u16(end + 10); i < n; i++) {
23227
+ const n = u16(end + 10);
23228
+ if (n > MAX_SITE_FILES) {
23229
+ throw new Error(
23230
+ `zip holds ${n} entries; a site upload is at most ${MAX_SITE_FILES} files`
23231
+ );
23232
+ }
23233
+ for (let i = 0; i < n; i++) {
22501
23234
  const path = decoder.decode(z.slice(p + 46, p + 46 + u16(p + 28)));
22502
23235
  const method = u16(p + 10);
22503
23236
  const size = u32(p + 24);
@@ -22533,20 +23266,106 @@ async function unzip(z) {
22533
23266
  }
22534
23267
  return out;
22535
23268
  }
23269
+ var CRC_TABLE = (() => {
23270
+ const t = new Uint32Array(256);
23271
+ for (let n = 0; n < 256; n++) {
23272
+ let c = n;
23273
+ for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
23274
+ t[n] = c >>> 0;
23275
+ }
23276
+ return t;
23277
+ })();
23278
+ function crc32(bytes) {
23279
+ let c = 4294967295;
23280
+ for (let i = 0; i < bytes.length; i++)
23281
+ c = CRC_TABLE[(c ^ bytes[i]) & 255] ^ c >>> 8;
23282
+ return (c ^ 4294967295) >>> 0;
23283
+ }
23284
+ function zipStored(files) {
23285
+ const encoder = new TextEncoder();
23286
+ const entries = files.map((f) => ({
23287
+ name: encoder.encode(f.path),
23288
+ bytes: f.bytes,
23289
+ crc: crc32(f.bytes)
23290
+ }));
23291
+ const localSize = entries.reduce(
23292
+ (sum, e) => sum + 30 + e.name.length + e.bytes.length,
23293
+ 0
23294
+ );
23295
+ const centralSize = entries.reduce((sum, e) => sum + 46 + e.name.length, 0);
23296
+ const out = new Uint8Array(localSize + centralSize + 22);
23297
+ const view = new DataView(out.buffer);
23298
+ const UTF8_FLAG = 2048;
23299
+ let p = 0;
23300
+ const offsets = [];
23301
+ for (const e of entries) {
23302
+ offsets.push(p);
23303
+ view.setUint32(p, 67324752, true);
23304
+ view.setUint16(p + 4, 20, true);
23305
+ view.setUint16(p + 6, UTF8_FLAG, true);
23306
+ view.setUint16(p + 8, 0, true);
23307
+ view.setUint32(p + 10, 0, true);
23308
+ view.setUint32(p + 14, e.crc, true);
23309
+ view.setUint32(p + 18, e.bytes.length, true);
23310
+ view.setUint32(p + 22, e.bytes.length, true);
23311
+ view.setUint16(p + 26, e.name.length, true);
23312
+ view.setUint16(p + 28, 0, true);
23313
+ out.set(e.name, p + 30);
23314
+ out.set(e.bytes, p + 30 + e.name.length);
23315
+ p += 30 + e.name.length + e.bytes.length;
23316
+ }
23317
+ const centralStart = p;
23318
+ entries.forEach((e, i) => {
23319
+ view.setUint32(p, 33639248, true);
23320
+ view.setUint16(p + 4, 20, true);
23321
+ view.setUint16(p + 6, 20, true);
23322
+ view.setUint16(p + 8, UTF8_FLAG, true);
23323
+ view.setUint16(p + 10, 0, true);
23324
+ view.setUint32(p + 12, 0, true);
23325
+ view.setUint32(p + 16, e.crc, true);
23326
+ view.setUint32(p + 20, e.bytes.length, true);
23327
+ view.setUint32(p + 24, e.bytes.length, true);
23328
+ view.setUint16(p + 28, e.name.length, true);
23329
+ view.setUint32(p + 42, offsets[i], true);
23330
+ out.set(e.name, p + 46);
23331
+ p += 46 + e.name.length;
23332
+ });
23333
+ view.setUint32(p, 101010256, true);
23334
+ view.setUint16(p + 8, entries.length, true);
23335
+ view.setUint16(p + 10, entries.length, true);
23336
+ view.setUint32(p + 12, p - centralStart, true);
23337
+ view.setUint32(p + 16, centralStart, true);
23338
+ return out;
23339
+ }
22536
23340
  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
23341
  var isRootIndex = (p) => /^index\.html?$/i.test(p);
22538
- async function normalizeSiteFiles(input) {
22539
- let list = [];
23342
+ async function expandSiteFiles(input) {
23343
+ const list = [];
23344
+ let bytes = 0;
22540
23345
  for (const f of input) {
22541
- if (isZip(f)) list.push(...await unzip(f.bytes));
22542
- else list.push(f);
23346
+ const added = isZip(f) ? await unzip(f.bytes) : [f];
23347
+ list.push(...added);
23348
+ bytes += added.reduce((sum, a) => sum + a.bytes.byteLength, 0);
23349
+ if (list.length > MAX_SITE_FILES) {
23350
+ throw new Error(
23351
+ `Too many files (more than ${MAX_SITE_FILES}); a site upload is at most ${MAX_SITE_FILES}.`
23352
+ );
23353
+ }
23354
+ if (bytes > MAX_UNZIP_BYTES) {
23355
+ throw new Error(
23356
+ `The upload expands past ${MAX_UNZIP_BYTES} bytes; send only the site's files.`
23357
+ );
23358
+ }
22543
23359
  }
22544
- list = list.map((f) => ({
23360
+ return list.map((f) => ({
22545
23361
  ...f,
22546
23362
  path: f.path.replace(/\\/g, "/").replace(/^\.?\//, "")
22547
23363
  })).filter(
22548
23364
  (f) => f.path && !f.path.startsWith("__MACOSX/") && !/(^|\/)\.DS_Store$/.test(f.path) && !f.path.split("/").includes("..")
22549
23365
  );
23366
+ }
23367
+ function staticSiteFiles(expanded) {
23368
+ let list = expanded;
22550
23369
  if (list.length === 0) {
22551
23370
  throw new Error(
22552
23371
  "No files to upload: pass the site in `files` or `attachments`."
@@ -22626,21 +23445,210 @@ function buildFormData(files) {
22626
23445
  return fd;
22627
23446
  }
22628
23447
 
23448
+ // src/api-call/headless-release.ts
23449
+ var BUILD_METADATA_SUFFIX = ".wix/build-metadata.json";
23450
+ function withoutEmptyStatics(files, build) {
23451
+ const dir = build.clientDir;
23452
+ if (dir === void 0) return { files, dropped: [] };
23453
+ const dropped = [];
23454
+ const kept = files.filter((f) => {
23455
+ const path = normalizePath(f.path);
23456
+ if (f.bytes.byteLength === 0 && path.startsWith(dir)) {
23457
+ dropped.push(path.slice(dir.length));
23458
+ return false;
23459
+ }
23460
+ return true;
23461
+ });
23462
+ return { files: kept, dropped };
23463
+ }
23464
+ var normalizePath = (p) => p.replace(/\\/g, "/").replace(/^\.?\//, "");
23465
+ function findHeadlessBuild(files) {
23466
+ const entries = new Map(files.map((f) => [normalizePath(f.path), f.bytes]));
23467
+ const metadataEntry = [...entries.keys()].find(
23468
+ (name) => name === BUILD_METADATA_SUFFIX || name.endsWith(`/${BUILD_METADATA_SUFFIX}`)
23469
+ );
23470
+ if (metadataEntry === void 0) return null;
23471
+ const zipRoot = metadataEntry.slice(
23472
+ 0,
23473
+ metadataEntry.length - BUILD_METADATA_SUFFIX.length
23474
+ );
23475
+ let metadata;
23476
+ try {
23477
+ metadata = JSON.parse(
23478
+ new TextDecoder().decode(entries.get(metadataEntry))
23479
+ );
23480
+ } catch {
23481
+ throw new Error(`${BUILD_METADATA_SUFFIX} is not valid JSON.`);
23482
+ }
23483
+ if (typeof metadata.appManifestPath !== "string") {
23484
+ throw new Error(
23485
+ `${BUILD_METADATA_SUFFIX} has no appManifestPath; send the build as the Wix hosting adapter wrote it (.wix/ and dist/ zipped from the project root).`
23486
+ );
23487
+ }
23488
+ const manifestPath = resolveZipPath(
23489
+ metadata.appManifestPath,
23490
+ zipRoot,
23491
+ entries
23492
+ );
23493
+ if (manifestPath === void 0) {
23494
+ throw new Error(
23495
+ `The build's app manifest (${metadata.appManifestPath}) is not in the upload; zip .wix/ and dist/ together from the project root after \`astro build\`.`
23496
+ );
23497
+ }
23498
+ const builderRoot = metadata.appManifestPath.slice(
23499
+ 0,
23500
+ metadata.appManifestPath.length - (manifestPath.length - zipRoot.length)
23501
+ );
23502
+ const clientDir = metadata.clientDir === void 0 ? void 0 : toZipDir(metadata.clientDir, builderRoot, zipRoot);
23503
+ const serverDir = metadata.serverDir === void 0 ? void 0 : toZipDir(metadata.serverDir, builderRoot, zipRoot);
23504
+ const clientFiles = [];
23505
+ const serverFiles = [];
23506
+ for (const [name, bytes] of entries) {
23507
+ if (name === manifestPath) continue;
23508
+ if (serverDir !== void 0 && name.startsWith(serverDir)) {
23509
+ serverFiles.push({ path: name.slice(serverDir.length), bytes });
23510
+ } else if (clientDir !== void 0 && name.startsWith(clientDir)) {
23511
+ clientFiles.push({ path: name.slice(clientDir.length), bytes });
23512
+ }
23513
+ }
23514
+ if (clientFiles.length + serverFiles.length === 0) {
23515
+ throw new Error(
23516
+ "The build has no client or server output files; run `astro build` first and zip .wix/ and dist/ from the project root."
23517
+ );
23518
+ }
23519
+ if (serverFiles.length > 0 && !serverFiles.some((f) => f.path === "entry.mjs")) {
23520
+ throw new Error(
23521
+ "The server build has no entry.mjs, which the Wix hosting adapter (@wix/astro-wix-hosting-adapter) writes into the server folder on every build. Build with the project's own `astro build` (the adapter in astro.config) and zip .wix/ and dist/ from the project root as the build left them."
23522
+ );
23523
+ }
23524
+ const manifestText = new TextDecoder().decode(entries.get(manifestPath));
23525
+ return {
23526
+ metadata,
23527
+ root: zipRoot,
23528
+ manifestText,
23529
+ clientFiles,
23530
+ serverFiles,
23531
+ clientDir
23532
+ };
23533
+ }
23534
+ var NOT_SOURCE_TOP = /* @__PURE__ */ new Set(["dist", ".wix", ".astro", ".agents"]);
23535
+ var isSourcePath = (relative) => {
23536
+ const segments = relative.split("/");
23537
+ return !NOT_SOURCE_TOP.has(segments[0]) && !segments.some((s) => s === "node_modules" || s.startsWith(".env"));
23538
+ };
23539
+ function buildSourceFiles(files, build) {
23540
+ return files.flatMap((f) => {
23541
+ const path = normalizePath(f.path);
23542
+ if (!path.startsWith(build.root)) return [];
23543
+ const relative = path.slice(build.root.length);
23544
+ return relative && isSourcePath(relative) ? [{ path: relative, bytes: f.bytes }] : [];
23545
+ });
23546
+ }
23547
+ function resolveZipPath(builderPath, zipRoot, entries) {
23548
+ const segments = normalizePath(builderPath).split("/").filter((s) => s.length > 0);
23549
+ for (let k = 0; k < segments.length; k++) {
23550
+ const candidate = zipRoot + segments.slice(k).join("/");
23551
+ if (entries.has(candidate)) return candidate;
23552
+ }
23553
+ return void 0;
23554
+ }
23555
+ function toZipDir(builderDir, builderRoot, zipRoot) {
23556
+ const normalized = normalizePath(builderDir);
23557
+ const normalizedRoot = normalizePath(builderRoot);
23558
+ const relative = builderDir.startsWith(builderRoot) ? builderDir.slice(builderRoot.length) : normalized.startsWith(normalizedRoot) ? normalized.slice(normalizedRoot.length) : normalized;
23559
+ const dir = zipRoot + normalizePath(relative);
23560
+ return dir.endsWith("/") ? dir : `${dir}/`;
23561
+ }
23562
+
23563
+ // src/infra/redact-personal-data.ts
23564
+ var FREE_TEXT_INFO_PARAMS = [
23565
+ "userRequest",
23566
+ "siteDescription",
23567
+ "siteForm",
23568
+ "siteFunctionality",
23569
+ "agentIdentity",
23570
+ "wixAccess",
23571
+ "reason",
23572
+ "whyNotExecuteWixAPI"
23573
+ ];
23574
+ var EMAIL = /[A-Z0-9._%+-]+@[A-Z0-9-]+(?:\.[A-Z0-9-]+)*\.[A-Z]{2,}/gi;
23575
+ var NAMED_SECRET = /\b(passwords?|passwd|pwd|passcodes?|secrets?|tokens?|api[ _-]?keys?|access[ _-]?keys?|credentials?)(\s*[:=]\s*|\s+(?:is|was|to)\s+)(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s"'`,;][^,;\n]*?(?=[.!?]\s|[,;\n]|$))/gi;
23576
+ var BEARER = /\bBearer\s+[A-Za-z0-9._~+/=-]+/gi;
23577
+ var JWT = /\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
23578
+ var KEY_PREFIXES = /\b(?:sk-[A-Za-z0-9_-]{16,}|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_\w{20,}|xox[abprs]-[A-Za-z0-9-]{10,}|AKIA[0-9A-Z]{16}|AIza[0-9A-Za-z_-]{35})\b/g;
23579
+ var BACKTICK = "`";
23580
+ var UNIX_ROOT = String.raw`(?<![\w.:/~-])(?:~|/(?:Users|home|root|mnt|tmp|private|var|Volumes|workspace|work))`;
23581
+ var WINDOWS_ROOT = String.raw`(?<!\w)[A-Za-z]:(?=\\\w)`;
23582
+ var PATH_ROOT = `(?:${UNIX_ROOT}|${WINDOWS_ROOT})`;
23583
+ var QUOTED_PATH = new RegExp(
23584
+ String.raw`(?<![\w])(["'${BACKTICK}])${PATH_ROOT}[^"'${BACKTICK}\n]*\1`,
23585
+ "g"
23586
+ );
23587
+ var FOLDER = String.raw`[^\s/\\"'${BACKTICK},;()<>]+(?: [^\s/\\"'${BACKTICK},;()<>]+)*`;
23588
+ var LOCAL_PATH = new RegExp(
23589
+ String.raw`${PATH_ROOT}(?:[/\\]${FOLDER}(?=[/\\]))*[/\\][^\s"'${BACKTICK},;()<>]*`,
23590
+ "g"
23591
+ );
23592
+ var PHONE_CANDIDATE = /(?<![\w-])\+?\(?\d[\d\s().-]{7,}\d(?![\w-])/g;
23593
+ var DATE_START = /^\d{4}-\d{2}-\d{2}/;
23594
+ function redactPhone(match, offset, text) {
23595
+ if (DATE_START.test(match) || /^:\d{2}\b/.test(text.slice(offset + match.length))) {
23596
+ return match;
23597
+ }
23598
+ const digits = match.replace(/\D/g, "").length;
23599
+ return digits >= 9 && digits <= 15 ? "[phone]" : match;
23600
+ }
23601
+ function redactPersonalData(text) {
23602
+ return text.replace(EMAIL, "[email]").replace(BEARER, "Bearer [secret]").replace(JWT, "[secret]").replace(KEY_PREFIXES, "[secret]").replace(NAMED_SECRET, "$1$2[secret]").replace(QUOTED_PATH, "$1[path]$1").replace(LOCAL_PATH, "[path]").replace(PHONE_CANDIDATE, redactPhone);
23603
+ }
23604
+ function redactInfoParams(value) {
23605
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
23606
+ return value;
23607
+ }
23608
+ const record = value;
23609
+ if (!FREE_TEXT_INFO_PARAMS.some((key) => typeof record[key] === "string")) {
23610
+ return value;
23611
+ }
23612
+ const redacted = { ...record };
23613
+ for (const key of FREE_TEXT_INFO_PARAMS) {
23614
+ if (typeof redacted[key] === "string") {
23615
+ redacted[key] = redactPersonalData(redacted[key]);
23616
+ }
23617
+ }
23618
+ return redacted;
23619
+ }
23620
+ function serializeToolParamsForBi(args) {
23621
+ return JSON.stringify(
23622
+ Array.isArray(args) ? args.map(redactInfoParams) : redactInfoParams(args)
23623
+ );
23624
+ }
23625
+
22629
23626
  // src/api-call/upload-headless-website-files.ts
22630
23627
  var UPLOAD_HEADLESS_WEBSITE_FILES_TOOL_NAME = "UploadHeadlessWebsiteFiles";
22631
23628
  var HEADLESS_BUSINESS = "https://www.wixapis.com/headless-business-setup/v1/headless-business";
23629
+ var MAX_BUNDLE_BYTES = 100 * 1024 * 1024;
22632
23630
  function dropAttribution(clientName) {
22633
23631
  const slug = (clientName ?? "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64);
22634
23632
  return `?campaign=mcp&agent=${encodeURIComponent(slug || "wix-mcp")}`;
22635
23633
  }
22636
23634
  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.",
23635
+ 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; a static site 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. A Wix Astro build (`.wix/build-metadata.json` and `dist/` as `astro build` with the Wix hosting adapter wrote them, zipped from the project root) needs no `index.html`: it is released to the site's Wix hosting instead of dropped, and the project's other files in the upload are stored as its source when the site's repository accepts it.",
23636
+ attachments: fileParamNote(
23637
+ "for a static site use `files`, or drop the files as the StartDeployWebsite recipe shows; for a Wix Astro build from a shell that reaches the internet, zip it, call with `prepare: true` and its `size` and PUT the zips with curl"
23638
+ ) + " Any type: a zip of the whole site, HTML, CSS, JS, images. A zip is unpacked; a top-level folder wrapping the site is stripped. A Wix Astro build zipped with the whole project (minus `node_modules`) is released with its source stored when the site's repository accepts it. Prefer this over base64 in `files` whenever you have a file handle. Up to 10 MB per call.",
23639
+ prepare: "Phase one of the two-call upload of a Wix Astro build, for a shell that reaches the internet and no file handle (a sandbox whose network is limited to a few hosts cannot upload to the URLs): zip the build first, then `true` with its `size` returns presigned upload URLs for the build zip and, when the site's repository takes it, the project source zip, as `curl` commands to run verbatim, with the exact second call. The two calls: {siteId, prepare: true, size}, then {siteId, uploadKey, sourceUploadId?, expectedHeadRevisionId?, releaseNotes?}. No `files`, `attachments`, `uploadKey` or `sourceUploadId` on the first; `expectedHeadRevisionId` and `releaseNotes` given on the first are echoed into the second. Not for a static site: send its files in `files` or `attachments`, or drop them as the StartDeployWebsite recipe shows.",
23640
+ size: `Phase one, with \`prepare: true\` only, and required there: the build zip's length in bytes (\`wc -c < build.zip\`), 1 to ${MAX_BUNDLE_BYTES} (100 MB). The upload URL takes a body of exactly this length; a zip changed after the prepare needs a new prepare.`,
23641
+ uploadKey: "Phase two of the two-call upload: the `uploadKey` the `prepare` call returned, after the build zip was PUT to its URL. Releases that build to the site: {siteId, uploadKey, sourceUploadId?, expectedHeadRevisionId?, releaseNotes?}. Excludes `files` and `attachments`.",
23642
+ sourceUploadId: "Phase two: the `sourceUploadId` the `prepare` call returned, after the source zip was PUT to its URL. Stores the project source with the release. Needs `uploadKey`; leave it out when the prepare returned no source upload.",
23643
+ expectedHeadRevisionId: "The repository revision your project started from, so the source replaces only that and a commit made since (another chat, a Dev Machine) is never dropped unseen: the revision you downloaded the project at; for a project started here, the `headRevisionId` the `prepare` call returned. Leave it out only for a repository with nothing in it yet. Goes with `uploadKey`, or with `files`/`attachments` holding a build.",
23644
+ releaseNotes: "Optional: one line on what this release changes, at most 200 characters, kept with the deployment of a Wix Astro build, whether it comes in `files`/`attachments` or as the second call with `uploadKey` (given on the `prepare` call it is echoed into the second). A static drop keeps no notes.",
23645
+ 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. A build released here replaces static pages dropped earlier, at the same URL.",
22640
23646
  calledStartDeployWebsite: "Whether you called StartDeployWebsite earlier in this conversation and are following the recipe it returned. Answer truthfully; it is recorded, not checked.",
22641
23647
  agentIdentity: START_DEPLOY_WEBSITE_PARAM_DESCRIPTIONS.agentIdentity,
22642
- reason: "One sentence: the user request that led here and what is being published."
23648
+ reason: `One sentence: the user request that led here and what is being published. ${NO_PERSONAL_DATA}`
22643
23649
  };
23650
+ var UPLOAD_RECIPE_SKILL_URL = "https://www.wix.com/skills/wix-manage/references/sites/upload-static-site.md";
23651
+ var DOMAIN_RECIPE_SKILL_URL = "https://www.wix.com/skills/wix-manage/references/domains/domain-search-purchase-and-connect.md";
22644
23652
  function formatDropResult(r) {
22645
23653
  const shown = r.files.slice(0, 60);
22646
23654
  return [
@@ -22650,10 +23658,177 @@ function formatDropResult(r) {
22650
23658
  `Dashboard: https://manage.wix.com/dashboard/${r.metaSiteId}`,
22651
23659
  `${r.files.length} file(s): ${shown.join(", ")}${r.files.length > shown.length ? ", \u2026" : ""}`,
22652
23660
  "",
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}).`
23661
+ `Give the user both links, each on its own line and named for what it is: the live site, and the site's dashboard. Then offer a custom domain, bought through Wix or one they already own (${DOMAIN_RECIPE_SKILL_URL}).`,
23662
+ "",
23663
+ `- To change this site later: "Change it later" in ${UPLOAD_RECIPE_SKILL_URL}, with this metaSiteId (${r.metaSiteId}). The same site every time, never a new one.`,
23664
+ `- Wix business features (${WIX_BUSINESS_FEATURES}): call StartHeadlessBuild with startingPoint "an existing Wix Headless site"; this site is one.`
23665
+ ].join("\n");
23666
+ }
23667
+ function curlPut(zipName, put, fallback) {
23668
+ const headers = Object.entries(
23669
+ put.headers && Object.keys(put.headers).length ? put.headers : fallback
23670
+ );
23671
+ return [
23672
+ "curl -X PUT",
23673
+ ...headers.map(([k, v]) => `-H "${k}: ${v}"`),
23674
+ `--data-binary @${zipName} "${put.putUrl}"`
23675
+ ].join(" ");
23676
+ }
23677
+ var BUILD_ZIP_CONTENTS = "Build zip, from the project root after `astro build` with the Wix hosting adapter: `dist/` (with `dist/_wix/app-manifest.json`) and `.wix/build-metadata.json`.";
23678
+ var SOURCE_ZIP_CONTENTS = "Source zip, from the project root: the project minus `node_modules`, `dist`, `.wix`, `.astro`, `.env*` and `.agents`.";
23679
+ function formatPrepareResult(siteId, urls, size, given = {}) {
23680
+ const expiry = urls.expiresAt ? ` They expire at ${urls.expiresAt}.` : "";
23681
+ const secondCall = {
23682
+ siteId,
23683
+ uploadKey: urls.uploadKey
23684
+ };
23685
+ const zipHeaders = {
23686
+ "content-type": "application/zip",
23687
+ ...size ? { "content-length": String(size) } : {}
23688
+ };
23689
+ const lines = [
23690
+ `Upload URLs ready for site ${siteId}.${expiry} Two steps, then call this tool again.`,
23691
+ "",
23692
+ `1. ${BUILD_ZIP_CONTENTS} Upload the zip you measured${size ? ` (${size} bytes)` : ""}; the URL takes a body of exactly that length, so a zip changed since needs a new prepare with its size:`,
23693
+ ` ${curlPut("build.zip", urls, zipHeaders)}`
23694
+ ];
23695
+ if (given.expectedHeadRevisionId)
23696
+ secondCall.expectedHeadRevisionId = given.expectedHeadRevisionId;
23697
+ if (urls.source) {
23698
+ const s = urls.source;
23699
+ secondCall.sourceUploadId = s.uploadId;
23700
+ if (!secondCall.expectedHeadRevisionId && s.headRevisionId)
23701
+ secondCall.expectedHeadRevisionId = s.headRevisionId;
23702
+ lines.push(
23703
+ "",
23704
+ `2. ${SOURCE_ZIP_CONTENTS} Upload it:`,
23705
+ ` ${curlPut("source.zip", s, { "content-type": "application/zip" })}`,
23706
+ ...s.expiresAt && s.expiresAt !== urls.expiresAt ? [` This URL expires at ${s.expiresAt}.`] : [],
23707
+ ...s.headRevisionId ? [
23708
+ ` The repository's head revision is ${s.headRevisionId}. The second call passes \`expectedHeadRevisionId\`: this head for a project started here; if you downloaded the project from the repository, the revision you downloaded it at instead, so a commit made since is never dropped.`
23709
+ ] : []
23710
+ );
23711
+ } else {
23712
+ lines.push(
23713
+ "",
23714
+ "2. The site's repository takes no source this time: the project's source is not uploaded, and the second call carries no `sourceUploadId`."
23715
+ );
23716
+ }
23717
+ if (given.releaseNotes)
23718
+ secondCall.releaseNotes = releaseNotesForService(given.releaseNotes);
23719
+ lines.push(
23720
+ "",
23721
+ `3. Call UploadHeadlessWebsiteFiles again with ${JSON.stringify(secondCall)} (plus \`calledStartDeployWebsite\`, \`agentIdentity\`, \`reason\`). No \`files\` or \`attachments\` on that call.`
23722
+ );
23723
+ return lines.join("\n");
23724
+ }
23725
+ function formatBundleReleaseResult(siteId, r, notes = []) {
23726
+ return [
23727
+ "Released; the site is live.",
23728
+ `Live URL: ${r.siteUrl ?? "(not returned)"}`,
23729
+ `metaSiteId: ${siteId} \u2014 pass it as \`siteId\` to release this site again, the same way. The URL stays.`,
23730
+ `Dashboard: https://manage.wix.com/dashboard/${siteId}`,
23731
+ `Deployment ${r.deploymentId ?? "(id not returned)"}.${r.revision?.id ? ` Source stored as revision ${r.revision.id}.` : ""}`,
23732
+ ...notes,
23733
+ "",
23734
+ "This release replaced whatever the site served before, at the same URL. A change to the site is a change to the project: edit, build if it is an Astro project, upload again.",
23735
+ "Give the user both links, each on its own line and named for what it is: the live site, and the site's dashboard."
22655
23736
  ].join("\n");
22656
23737
  }
23738
+ var startOver = (retry) => retry === "prepare" ? "call with `prepare: true` and the zip's `size` again, upload the zips to the new URLs, and release with the new `uploadKey`" : "call this tool again with the same files";
23739
+ var apiBody = (err) => err.response.data ? ` (${err.response.data.slice(0, 300)})` : "";
23740
+ function describeBundleUploadUrlError(err) {
23741
+ if (!(err instanceof WixFetchError)) {
23742
+ return err instanceof Error ? err.message : String(err);
23743
+ }
23744
+ const body = apiBody(err);
23745
+ switch (err.status) {
23746
+ case 400:
23747
+ return `The upload URL was refused: \`size\` is the build zip's length in bytes, an integer from 1 to ${MAX_BUNDLE_BYTES} (100 MB). A larger build: leave out what the site does not serve (source maps, unused assets).${body}`;
23748
+ case 429:
23749
+ return `Too many unreleased uploads are waiting for this site: release one with its \`uploadKey\`, or wait for a running release to finish, then ask again.${body}`;
23750
+ default:
23751
+ return err.message;
23752
+ }
23753
+ }
23754
+ function deployAuthorization(siteHeaders) {
23755
+ const authorization = siteHeaders.Authorization ?? siteHeaders.authorization;
23756
+ return authorization ? { deployAuthorization: authorization } : {};
23757
+ }
23758
+ var RELEASE_NOTES_MAX_CHARS = 200;
23759
+ function releaseNotesForService(notes) {
23760
+ const chars = [...notes.replace(/\s+/g, " ").trim()];
23761
+ return chars.length <= RELEASE_NOTES_MAX_CHARS ? chars.join("") : `${chars.slice(0, RELEASE_NOTES_MAX_CHARS - 1).join("").trimEnd()}\u2026`;
23762
+ }
23763
+ function describeBundleReleaseError(err, uploadKey, retry = "prepare") {
23764
+ if (!(err instanceof WixFetchError)) {
23765
+ return err instanceof Error ? err.message : String(err);
23766
+ }
23767
+ const body = apiBody(err);
23768
+ const code = err.response.data ?? "";
23769
+ switch (err.status) {
23770
+ case 404:
23771
+ return `Nothing uploaded for uploadKey ${uploadKey}: the build zip was not PUT to its URL, or the URL expired. To try again, ${startOver(retry)}.${body}`;
23772
+ case 409:
23773
+ return `The project's source repository moved since the upload URLs were made; nothing was released. ${retry === "prepare" ? "Call with `prepare: true` and the zip's `size` again, re-upload the source zip to the new URL, and release with the new `uploadKey`, `sourceUploadId` and `expectedHeadRevisionId`." : "Download the project again from the repository, carry your change over, and upload with `expectedHeadRevisionId` set to the revision you downloaded."}${body}`;
23774
+ case 403:
23775
+ return `Wix refused to deploy this build onto the site's project; nothing was released, and the same call will be refused again. Do not call \`prepare\` again. Tell the user the release is blocked on Wix's side and give them the request id from the error.${body}`;
23776
+ case 413:
23777
+ case 428:
23778
+ return `The build's server code is larger than the release can carry from here; nothing was released. Do not call \`prepare\` again. Tell the user the release is blocked on Wix's side and give them the request id from the error.${body}`;
23779
+ case 400:
23780
+ if (code.includes("EXPECTED_HEAD_REQUIRED")) {
23781
+ return `The site's repository already holds work, and the source replaces only what you started from; nothing was released. ${retry === "prepare" ? "Call with `prepare: true` and the zip's `size` again and pass the `headRevisionId` it returns as `expectedHeadRevisionId` (with its new `uploadKey` and `sourceUploadId`)." : "Call again with `expectedHeadRevisionId`: the revision you downloaded the project at, so the source replaces only that. To replace the repository with this upload on purpose, pass its current head."}${body}`;
23782
+ }
23783
+ if (code.includes("BUNDLE_TOO_LARGE")) {
23784
+ return `The build zip is over ${MAX_BUNDLE_BYTES} bytes (100 MB): leave out what the site does not serve (source maps, unused assets), then ${startOver(retry)}.${body}`;
23785
+ }
23786
+ if (code.includes("INVALID_RELEASE")) {
23787
+ return `The release was refused by Wix's deployment service; nothing was released. The staged upload is kept: call again with the same \`uploadKey\` and the field the message names fixed (release notes are cut to ${RELEASE_NOTES_MAX_CHARS} characters here).${body}`;
23788
+ }
23789
+ if (code.includes("INVALID_UPLOAD_KEY")) {
23790
+ return `\`uploadKey\` is the lowercase UUID the \`prepare\` call returned; pass it as it came.${body}`;
23791
+ }
23792
+ return `The uploaded zip was not accepted. Zip \`dist/\` and \`.wix/build-metadata.json\` from the project root after \`astro build\` with the Wix hosting adapter, then ${startOver(retry)}. A static site goes in \`files\` or \`attachments\` instead, or is dropped as the StartDeployWebsite recipe shows.${body}`;
23793
+ default:
23794
+ if (err.status >= 500) {
23795
+ const what = err.status === 503 ? "The release could not hold its upload" : `Wix's release step failed on its side (HTTP ${err.status})`;
23796
+ return `${what}; nothing was released. The staged upload is kept under uploadKey ${uploadKey}, so do not call \`prepare\` again and do not send the files again: every upload staged and not released counts against the site, which refuses new ones after a few. Retry once, after a minute, by calling with \`uploadKey: "${uploadKey}"\`${retry === "resend" ? " (plus the `expectedHeadRevisionId` and `releaseNotes` you passed, if any; the source is stored with the next release)" : " and the same ids and `releaseNotes`"}. If that fails too, stop and tell the user the release is blocked on Wix's side, with the request id from the error.${body}`;
23797
+ }
23798
+ return err.message;
23799
+ }
23800
+ }
23801
+ function validateBundleArgs(a) {
23802
+ const hasContent = !!a.files?.trim() || !!(a.attachments && a.attachments.length);
23803
+ if (a.prepare) {
23804
+ if (hasContent || a.uploadKey || a.sourceUploadId) {
23805
+ return "`prepare: true` goes with `siteId` and `size`: no `files`, `attachments`, `uploadKey` or `sourceUploadId` on that call. Example: {siteId, prepare: true, size}, then {siteId, uploadKey, sourceUploadId?, expectedHeadRevisionId?, releaseNotes?}.";
23806
+ }
23807
+ if (a.size === void 0) {
23808
+ return "`prepare: true` needs `size`: zip the build first and pass the zip's length in bytes (`wc -c < build.zip`).";
23809
+ }
23810
+ if (!Number.isInteger(a.size) || a.size < 1 || a.size > MAX_BUNDLE_BYTES) {
23811
+ return `\`size\` is the build zip's length in bytes, an integer from 1 to ${MAX_BUNDLE_BYTES} (100 MB); got ${a.size}.`;
23812
+ }
23813
+ return null;
23814
+ }
23815
+ if (a.size !== void 0) {
23816
+ return "`size` goes only with `prepare: true`: it is the length of the build zip that call makes an upload URL for.";
23817
+ }
23818
+ if (a.uploadKey) {
23819
+ if (hasContent) {
23820
+ return "`uploadKey` releases a build zip already uploaded to its URL: pass no `files` or `attachments` with it.";
23821
+ }
23822
+ return null;
23823
+ }
23824
+ if (a.sourceUploadId) {
23825
+ return "`sourceUploadId` goes with the `uploadKey` the `prepare` call returned.";
23826
+ }
23827
+ if (a.expectedHeadRevisionId && !hasContent) {
23828
+ return "`expectedHeadRevisionId` goes with `uploadKey`, or with `files`/`attachments` holding a build.";
23829
+ }
23830
+ return null;
23831
+ }
22657
23832
  async function readJson(res, what) {
22658
23833
  const text = await res.text();
22659
23834
  if (!res.ok)
@@ -22664,6 +23839,65 @@ async function readJson(res, what) {
22664
23839
  throw new Error(`${what} returned a non-JSON body: ${text.slice(0, 200)}`);
22665
23840
  }
22666
23841
  }
23842
+ async function putZip(fetchImpl, put, bytes, what) {
23843
+ const headers = Object.fromEntries(
23844
+ Object.entries(put.headers ?? { "content-type": "application/zip" }).filter(
23845
+ ([k]) => k.toLowerCase() !== "content-length"
23846
+ )
23847
+ );
23848
+ const res = await fetchImpl(put.putUrl, {
23849
+ method: "PUT",
23850
+ headers,
23851
+ body: bytes
23852
+ });
23853
+ if (!res.ok) {
23854
+ const text = await res.text().catch(() => "");
23855
+ throw new Error(
23856
+ `The ${what} upload was refused (${res.status}${text ? `: ${text.slice(0, 200)}` : ""}); call this tool again with the same files.`
23857
+ );
23858
+ }
23859
+ }
23860
+ async function releaseBuildByUrl(o) {
23861
+ const log = o.log ?? (() => {
23862
+ });
23863
+ const headers = { ...o.siteHeaders, "Content-Type": "application/json" };
23864
+ const urls = await readJson(
23865
+ await o.fetchImpl(`${HEADLESS_BUSINESS}/${o.siteId}/bundle-upload-url`, {
23866
+ method: "POST",
23867
+ headers,
23868
+ body: JSON.stringify({ size: o.siteZip.byteLength })
23869
+ }),
23870
+ "bundle-upload-url"
23871
+ );
23872
+ if (!urls.uploadKey || !urls.putUrl) {
23873
+ throw new Error("bundle-upload-url returned no uploadKey or putUrl.");
23874
+ }
23875
+ await putZip(o.fetchImpl, urls, o.siteZip, "site zip");
23876
+ o.onStaged?.(urls.uploadKey);
23877
+ log(
23878
+ `staged ${urls.uploadKey} (${o.siteZip.byteLength} bytes), source ${urls.source ? `offered, ${o.sourceFiles.length} file(s)` : "not offered"}`
23879
+ );
23880
+ const source = urls.source && o.sourceFiles.length > 0 ? urls.source : void 0;
23881
+ if (source) {
23882
+ await putZip(o.fetchImpl, source, zipStored(o.sourceFiles), "source zip");
23883
+ }
23884
+ return await readJson(
23885
+ await o.fetchImpl(`${HEADLESS_BUSINESS}/${o.siteId}/release-bundle`, {
23886
+ method: "POST",
23887
+ headers,
23888
+ body: JSON.stringify({
23889
+ uploadKey: urls.uploadKey,
23890
+ ...deployAuthorization(o.siteHeaders),
23891
+ ...o.releaseNotes ? { releaseNotes: releaseNotesForService(o.releaseNotes) } : {},
23892
+ ...source ? {
23893
+ sourceUploadId: source.uploadId,
23894
+ ...o.expectedHeadRevisionId ? { expectedHeadRevisionId: o.expectedHeadRevisionId } : {}
23895
+ } : {}
23896
+ })
23897
+ }),
23898
+ "release-bundle"
23899
+ );
23900
+ }
22667
23901
  function errorResult2(message) {
22668
23902
  return {
22669
23903
  isError: true,
@@ -22693,6 +23927,12 @@ function addUploadHeadlessWebsiteFilesTool(server, options) {
22693
23927
  mime_type: external_exports.string().optional()
22694
23928
  })
22695
23929
  ).optional().describe(d.attachments),
23930
+ prepare: external_exports.boolean().optional().describe(d.prepare),
23931
+ size: external_exports.number().int().optional().describe(d.size),
23932
+ uploadKey: external_exports.string().min(1).optional().describe(d.uploadKey),
23933
+ sourceUploadId: external_exports.string().min(1).optional().describe(d.sourceUploadId),
23934
+ expectedHeadRevisionId: external_exports.string().min(1).optional().describe(d.expectedHeadRevisionId),
23935
+ releaseNotes: external_exports.string().optional().describe(d.releaseNotes),
22696
23936
  siteId: external_exports.string().uuid("siteId must be a Wix metaSiteId (UUID)").describe(d.siteId),
22697
23937
  calledStartDeployWebsite: external_exports.boolean().describe(d.calledStartDeployWebsite),
22698
23938
  agentIdentity: external_exports.string().min(1).describe(d.agentIdentity),
@@ -22705,31 +23945,185 @@ function addUploadHeadlessWebsiteFilesTool(server, options) {
22705
23945
  const {
22706
23946
  files,
22707
23947
  attachments,
23948
+ prepare,
23949
+ size,
23950
+ uploadKey,
23951
+ sourceUploadId,
23952
+ expectedHeadRevisionId,
23953
+ releaseNotes,
22708
23954
  siteId,
22709
23955
  calledStartDeployWebsite,
22710
23956
  agentIdentity,
22711
23957
  reason
22712
23958
  } = rawArgs;
23959
+ const phase = prepare ? "prepare" : uploadKey ? "release-bundle" : "files";
22713
23960
  logger.log(
22714
- `[UploadHeadlessWebsiteFiles] siteId=${siteId} calledStartDeployWebsite=${calledStartDeployWebsite} agent="${agentIdentity}" files=${files?.length ?? 0} chars attachments=${attachments?.length ?? 0} reason="${reason}"`
23961
+ `[UploadHeadlessWebsiteFiles] siteId=${siteId} phase=${phase} calledStartDeployWebsite=${calledStartDeployWebsite} agent="${redactPersonalData(agentIdentity)}" files=${files?.length ?? 0} chars attachments=${attachments?.length ?? 0} reason="${redactPersonalData(reason)}"`
22715
23962
  );
23963
+ const invalid = validateBundleArgs(rawArgs);
23964
+ if (invalid) return errorResult2(invalid);
23965
+ if (prepare || uploadKey) {
23966
+ const siteHeaders = await authStrategy.getSiteAuthHeaders(siteId);
23967
+ const headers = {
23968
+ ...siteHeaders,
23969
+ "Content-Type": "application/json"
23970
+ };
23971
+ try {
23972
+ extra?.setToolBiParams?.({ siteId });
23973
+ if (prepare) {
23974
+ const urls = await readJson(
23975
+ await fetchImpl(
23976
+ `${HEADLESS_BUSINESS}/${siteId}/bundle-upload-url`,
23977
+ {
23978
+ method: "POST",
23979
+ headers,
23980
+ body: JSON.stringify({ size })
23981
+ }
23982
+ ),
23983
+ "bundle-upload-url"
23984
+ );
23985
+ if (!urls.uploadKey || !urls.putUrl) {
23986
+ throw new Error(
23987
+ "bundle-upload-url returned no uploadKey or putUrl."
23988
+ );
23989
+ }
23990
+ extra?.setToolBiParams?.({
23991
+ siteId,
23992
+ upload: { path: "prepare", sourceOffered: Boolean(urls.source) }
23993
+ });
23994
+ return {
23995
+ content: [
23996
+ {
23997
+ type: "text",
23998
+ text: formatPrepareResult(siteId, urls, size, {
23999
+ expectedHeadRevisionId,
24000
+ releaseNotes
24001
+ })
24002
+ }
24003
+ ]
24004
+ };
24005
+ }
24006
+ const released = await readJson(
24007
+ await fetchImpl(`${HEADLESS_BUSINESS}/${siteId}/release-bundle`, {
24008
+ method: "POST",
24009
+ headers,
24010
+ body: JSON.stringify({
24011
+ uploadKey,
24012
+ ...deployAuthorization(siteHeaders),
24013
+ ...sourceUploadId ? { sourceUploadId } : {},
24014
+ ...expectedHeadRevisionId ? { expectedHeadRevisionId } : {},
24015
+ ...releaseNotes ? { releaseNotes: releaseNotesForService(releaseNotes) } : {}
24016
+ })
24017
+ }),
24018
+ "release-bundle"
24019
+ );
24020
+ extra?.setToolBiParams?.({
24021
+ siteId,
24022
+ upload: {
24023
+ path: "release-bundle",
24024
+ sourceStored: Boolean(released.revision?.id)
24025
+ }
24026
+ });
24027
+ return {
24028
+ content: [
24029
+ {
24030
+ type: "text",
24031
+ text: formatBundleReleaseResult(siteId, released)
24032
+ }
24033
+ ]
24034
+ };
24035
+ } catch (err) {
24036
+ const message = err instanceof Error ? err.message : String(err);
24037
+ logger.log(`[UploadHeadlessWebsiteFiles] ${phase} error: ${message}`);
24038
+ rethrowIfUnauthorized(err);
24039
+ await authStrategy.enforceValidWixToken?.(err);
24040
+ return errorResult2(
24041
+ uploadKey ? describeBundleReleaseError(err, uploadKey) : describeBundleUploadUrlError(err)
24042
+ );
24043
+ }
24044
+ }
22716
24045
  if (!files?.trim() && !(attachments && attachments.length)) {
22717
24046
  return errorResult2(
22718
- "Nothing to publish: pass the site in `files` (text bundle) or `attachments` (files from this chat or your sandbox)."
24047
+ "Nothing to publish: pass the site in `files` (text bundle) or `attachments` (files from this chat or your sandbox), or, for a Wix Astro build from a shell that reaches the internet, zip it and call with `prepare: true` and its `size`."
22719
24048
  );
22720
24049
  }
22721
- let siteFiles;
24050
+ let siteFiles = [];
24051
+ let uploaded = [];
24052
+ let given = [];
24053
+ let build = null;
22722
24054
  try {
22723
24055
  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
- ]);
24056
+ given = [...parseFileBundle(files), ...fromAttachments];
24057
+ uploaded = await expandSiteFiles(given);
24058
+ build = findHeadlessBuild(uploaded);
24059
+ if (!build) siteFiles = staticSiteFiles(uploaded);
22728
24060
  } catch (e) {
22729
24061
  if (e instanceof AttachmentError || e instanceof Error)
22730
24062
  return errorResult2(e.message);
22731
24063
  throw e;
22732
24064
  }
24065
+ if (!build && expectedHeadRevisionId) {
24066
+ return errorResult2(
24067
+ "`expectedHeadRevisionId` applies to a Wix Astro build, whose source is stored in the site's repository; these files are a static site, which has none. Call again without it."
24068
+ );
24069
+ }
24070
+ if (build) {
24071
+ const siteHeaders = await authStrategy.getSiteAuthHeaders(siteId);
24072
+ let stagedKey;
24073
+ try {
24074
+ extra?.setToolBiParams?.({ siteId });
24075
+ const sourceFiles = buildSourceFiles(uploaded, build);
24076
+ const statics = withoutEmptyStatics(uploaded, build);
24077
+ const released = await releaseBuildByUrl({
24078
+ siteId,
24079
+ // One zip as given goes as is; anything else is zipped from the expanded files.
24080
+ siteZip: given.length === 1 && isZip(given[0]) && statics.dropped.length === 0 ? given[0].bytes : zipStored(statics.files),
24081
+ sourceFiles,
24082
+ expectedHeadRevisionId,
24083
+ releaseNotes,
24084
+ siteHeaders,
24085
+ fetchImpl,
24086
+ onStaged: (key) => {
24087
+ stagedKey = key;
24088
+ },
24089
+ log: (line) => logger.log(`[UploadHeadlessWebsiteFiles] release ${line}`)
24090
+ });
24091
+ const sourceStored = Boolean(released.revision?.id);
24092
+ extra?.setToolBiParams?.({
24093
+ siteId,
24094
+ upload: {
24095
+ path: "build",
24096
+ sourceStored,
24097
+ sourceFiles: sourceFiles.length,
24098
+ emptyStaticsDropped: statics.dropped.length
24099
+ }
24100
+ });
24101
+ const notes = [
24102
+ ...statics.dropped.length ? [
24103
+ `Left out, empty: ${statics.dropped.slice(0, 20).join(", ")} (the hosting serves no file of size 0).`
24104
+ ] : [],
24105
+ ...sourceStored ? [] : [
24106
+ sourceFiles.length ? "The project's source was not stored: the site's repository took none this time." : "The project's source was not stored: the upload held only the build. A later chat can continue this site only from its source; next time zip the whole project from its root, leaving out node_modules, .env files and the caches."
24107
+ ]
24108
+ ];
24109
+ return {
24110
+ content: [
24111
+ {
24112
+ type: "text",
24113
+ text: formatBundleReleaseResult(siteId, released, notes)
24114
+ }
24115
+ ]
24116
+ };
24117
+ } catch (err) {
24118
+ const message = err instanceof Error ? err.message : String(err);
24119
+ logger.log(`[UploadHeadlessWebsiteFiles] release error: ${message}`);
24120
+ rethrowIfUnauthorized(err);
24121
+ await authStrategy.enforceValidWixToken?.(err);
24122
+ return errorResult2(
24123
+ stagedKey ? describeBundleReleaseError(err, stagedKey, "resend") : describeBundleUploadUrlError(err)
24124
+ );
24125
+ }
24126
+ }
22733
24127
  const authHeaders = await authStrategy.getAccountAuthHeaders();
22734
24128
  try {
22735
24129
  const metaSiteId = siteId;
@@ -22746,6 +24140,10 @@ function addUploadHeadlessWebsiteFilesTool(server, options) {
22746
24140
  ),
22747
24141
  "drop"
22748
24142
  );
24143
+ extra?.setToolBiParams?.({
24144
+ siteId: metaSiteId,
24145
+ upload: { path: "drop", files: siteFiles.length }
24146
+ });
22749
24147
  return {
22750
24148
  content: [
22751
24149
  {
@@ -22755,7 +24153,7 @@ function addUploadHeadlessWebsiteFilesTool(server, options) {
22755
24153
  siteUrl: dropped.siteUrl,
22756
24154
  uploadId: dropped.uploadId,
22757
24155
  files: siteFiles.map((f) => f.path)
22758
- })
24156
+ }) + (releaseNotes ? "\n\nRelease notes are kept for a Wix Astro build only; a static drop has none, so yours were not stored." : "")
22759
24157
  }
22760
24158
  ]
22761
24159
  };
@@ -22784,7 +24182,8 @@ function addSearchCodeModeTool(server, options) {
22784
24182
  authStrategy,
22785
24183
  disableTools = [],
22786
24184
  toolDescriptions,
22787
- maxResponseSize
24185
+ maxResponseSize,
24186
+ docsSite
22788
24187
  } = options;
22789
24188
  if (disableTools.includes(SEARCH_TOOL_NAME)) {
22790
24189
  return;
@@ -22796,7 +24195,8 @@ function addSearchCodeModeTool(server, options) {
22796
24195
  description,
22797
24196
  maxResponseSize,
22798
24197
  authStrategy,
22799
- codeModeFetch
24198
+ codeModeFetch,
24199
+ docsSite
22800
24200
  );
22801
24201
  }
22802
24202
  function addExecuteCodeModeTool(server, options) {
@@ -22822,6 +24222,7 @@ function addExecuteCodeModeTool(server, options) {
22822
24222
  });
22823
24223
  }
22824
24224
  var SEARCH_MAX_RESPONSE_CHARS = 64e3;
24225
+ var EXECUTE_MAX_RESPONSE_CHARS = 1e5;
22825
24226
  async function resolveLoopbackAuthorization(authStrategy) {
22826
24227
  try {
22827
24228
  return (await authStrategy?.getAccountAuthHeaders())?.Authorization;
@@ -22829,7 +24230,7 @@ async function resolveLoopbackAuthorization(authStrategy) {
22829
24230
  return void 0;
22830
24231
  }
22831
24232
  }
22832
- function registerSearchTool(server, codeModeBaseUrl, description, maxResponseSize, authStrategy, codeModeFetch = defaultCodeModeFetch) {
24233
+ function registerSearchTool(server, codeModeBaseUrl, description, maxResponseSize, authStrategy, codeModeFetch = defaultCodeModeFetch, docsSite) {
22833
24234
  const searchUrl = `${codeModeBaseUrl}/api/code-mode/search`;
22834
24235
  server.tool(
22835
24236
  SEARCH_TOOL_NAME,
@@ -22855,7 +24256,8 @@ function registerSearchTool(server, codeModeBaseUrl, description, maxResponseSiz
22855
24256
  "Content-Type": "application/json",
22856
24257
  ...authorization ? { Authorization: authorization } : {}
22857
24258
  },
22858
- body: JSON.stringify({ code })
24259
+ // docsSite only when set: without it the request is as before.
24260
+ body: JSON.stringify(docsSite ? { code, docsSite } : { code })
22859
24261
  });
22860
24262
  if (!resp.ok) {
22861
24263
  const errorBody = await resp.text();
@@ -22882,8 +24284,14 @@ function registerSearchTool(server, codeModeBaseUrl, description, maxResponseSiz
22882
24284
  ]
22883
24285
  };
22884
24286
  }
24287
+ const result = isMintlifyDocsSite(docsSite) && data.result !== void 0 ? JSON.parse(
24288
+ (await rewriteDocsLinks(
24289
+ toDevWixHostText(JSON.stringify(data.result)),
24290
+ { label: "search SearchWixAPISpec" }
24291
+ )).text
24292
+ ) : data.result;
22885
24293
  const text = truncateResponse(
22886
- data.result,
24294
+ result,
22887
24295
  maxResponseSize ?? SEARCH_MAX_RESPONSE_CHARS
22888
24296
  );
22889
24297
  return {
@@ -22916,10 +24324,13 @@ async function postExecute(executeUrl, body, authorization, codeModeFetch = defa
22916
24324
  }
22917
24325
  return await resp.json();
22918
24326
  }
22919
- function executeErrorResult(message) {
24327
+ function executeErrorResult(message, failedCalls) {
22920
24328
  return {
22921
24329
  isError: true,
22922
- content: [{ type: "text", text: `Execute error: ${message}` }]
24330
+ content: [{ type: "text", text: `Execute error: ${message}` }],
24331
+ // The failed calls as fields, request ids included. The text carries the
24332
+ // ids too, for clients that don't read structured results.
24333
+ ...failedCalls?.length ? { structuredContent: { failedCalls } } : {}
22923
24334
  };
22924
24335
  }
22925
24336
  function executeTextResult(message) {
@@ -22929,7 +24340,7 @@ function executeTextResult(message) {
22929
24340
  }
22930
24341
  function formatExecuteResult(data, maxResponseSize, reportBi) {
22931
24342
  if (data.error) {
22932
- return executeErrorResult(data.error);
24343
+ return executeErrorResult(data.error, data.failedCalls);
22933
24344
  }
22934
24345
  reportBi?.({
22935
24346
  originalLength: typeof data.result === "string" ? data.result.length : JSON.stringify(data.result)?.length
@@ -22949,7 +24360,13 @@ function formatExecuteResult(data, maxResponseSize, reportBi) {
22949
24360
  }
22950
24361
  return {
22951
24362
  content: [
22952
- { type: "text", text: truncateResponse(data.result, maxResponseSize) }
24363
+ {
24364
+ type: "text",
24365
+ text: truncateResponse(
24366
+ data.result,
24367
+ maxResponseSize ?? EXECUTE_MAX_RESPONSE_CHARS
24368
+ )
24369
+ }
22953
24370
  ]
22954
24371
  };
22955
24372
  }
@@ -23011,7 +24428,9 @@ function addExecuteTool(server, options) {
23011
24428
  mime_type: external_exports.string().optional()
23012
24429
  })
23013
24430
  ).optional().describe(
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.'
24431
+ fileParamNote(
24432
+ "use `files`, or upload from your shell if it reaches the internet"
24433
+ ) + ' Any type: a zip of a site, HTML, images, PDFs. 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.'
23015
24434
  ),
23016
24435
  // Visitor mode takes an agent-supplied token and pins the site; account/site
23017
24436
  // mode lets the agent pick the site.
@@ -23084,6 +24503,7 @@ function addExecuteTool(server, options) {
23084
24503
  sessionId,
23085
24504
  toolInvocationId,
23086
24505
  clientName: server.server?.getClientVersion?.()?.name,
24506
+ ...visitor ? { visitorMode: true } : {},
23087
24507
  // A visitor token is a site-scoped bearer token: sent as siteToken
23088
24508
  // (→ Authorization + wix-site-id) and as accountToken only to satisfy
23089
24509
  // the runtime's required field. Account/site mode uses strategy tokens.
@@ -23358,6 +24778,7 @@ function createWixToolkit(options) {
23358
24778
  readmeDocs,
23359
24779
  authStrategy,
23360
24780
  dynamicContextEnabled: true,
24781
+ includeCompanionApp: true,
23361
24782
  // README-free defaults first so consumer overrides still win.
23362
24783
  toolDescriptions: {
23363
24784
  ...descriptionsWithoutReadme,
@@ -23368,6 +24789,7 @@ function createWixToolkit(options) {
23368
24789
  addDocsTools(server, void 0, {
23369
24790
  authStrategy,
23370
24791
  dynamicContextEnabled: true,
24792
+ includeCompanionApp: true,
23371
24793
  toolDescriptions: descriptionsWithoutReadme
23372
24794
  });
23373
24795
  }
@@ -23408,7 +24830,9 @@ function createWixToolkit(options) {
23408
24830
  authStrategy,
23409
24831
  disableTools,
23410
24832
  toolDescriptions: effectiveToolDescriptions,
23411
- maxResponseSize
24833
+ maxResponseSize,
24834
+ // The connection's docs site (`docs.docsSite`) applies to spec search too.
24835
+ docsSite: docs?.docsSite
23412
24836
  });
23413
24837
  }
23414
24838
  if (requestedTools.has("ExecuteWixAPI") && !disableTools?.includes("ExecuteWixAPI")) {
@@ -23488,7 +24912,7 @@ function createWixToolkit(options) {
23488
24912
  biLogger.updateDefaults({ _uuid: "" });
23489
24913
  panorama.transaction(toolName).start({
23490
24914
  toolInvocationId,
23491
- params: JSON.stringify(mergedArgs)
24915
+ params: serializeToolParamsForBi(mergedArgs)
23492
24916
  });
23493
24917
  }
23494
24918
  const startTime = performance.now();
@@ -23508,7 +24932,8 @@ function createWixToolkit(options) {
23508
24932
  cbResult,
23509
24933
  {
23510
24934
  returnedRows: toolBiParams.returnedRows,
23511
- originalLength: toolBiParams.originalLength
24935
+ originalLength: toolBiParams.originalLength,
24936
+ upload: toolBiParams.upload
23512
24937
  },
23513
24938
  { name: clientName }
23514
24939
  );
@@ -23523,7 +24948,7 @@ function createWixToolkit(options) {
23523
24948
  context: {
23524
24949
  toolName,
23525
24950
  toolInvocationId,
23526
- params: JSON.stringify(mergedArgs),
24951
+ params: serializeToolParamsForBi(mergedArgs),
23527
24952
  error: JSON.stringify(cbResult, null, 2)
23528
24953
  }
23529
24954
  }
@@ -23541,7 +24966,7 @@ function createWixToolkit(options) {
23541
24966
  context: {
23542
24967
  toolName,
23543
24968
  toolInvocationId,
23544
- params: JSON.stringify(mergedArgs),
24969
+ params: serializeToolParamsForBi(mergedArgs),
23545
24970
  error: errorBody
23546
24971
  }
23547
24972
  });
@@ -23569,7 +24994,7 @@ function createWixToolkit(options) {
23569
24994
  errorBody,
23570
24995
  toolInvocationId,
23571
24996
  toolName,
23572
- params: JSON.stringify(mergedArgs),
24997
+ params: serializeToolParamsForBi(mergedArgs),
23573
24998
  origin: nodeEnv,
23574
24999
  sessionId,
23575
25000
  executionResult: toolSucceeded ? "Success" : "Error",
@@ -23617,7 +25042,8 @@ function createWixToolkit(options) {
23617
25042
  const httpClient = new import_http_client3.HttpClient();
23618
25043
  return await getDynamicContext(authStrategy, httpClient, defaults, {
23619
25044
  partnerContextEnabled: true,
23620
- includeAccountContext: true
25045
+ includeAccountContext: true,
25046
+ includeCompanionApp: true
23621
25047
  }) || null;
23622
25048
  } catch {
23623
25049
  return null;