@wix/mcp 1.0.80 → 1.0.81

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 (34) hide show
  1. package/README.md +1 -1
  2. package/build/bin-standalone.js +72 -28
  3. package/build/cjs/index.cjs +90 -361
  4. package/build/cjs/toolkit.cjs +81 -30
  5. package/build/dts/api-call/index.js +41 -3
  6. package/build/dts/code-mode/index.js +8 -2
  7. package/build/dts/config/api-request-rules.d.ts +11 -0
  8. package/build/dts/config/api-request-rules.js +11 -0
  9. package/build/dts/config/default-config.js +8 -2
  10. package/build/dts/config/param-descriptions.d.ts +1 -1
  11. package/build/dts/config/param-descriptions.js +5 -3
  12. package/build/dts/docs/docs.js +6 -6
  13. package/build/dts/infra/tool-bi.d.ts +1 -1
  14. package/build/dts/infra/tool-bi.js +3 -2
  15. package/build/dts/toolkit-entry.d.cts +1 -1
  16. package/build/dts/toolkit-entry.d.ts +1 -1
  17. package/build/dts/toolkit.js +4 -1
  18. package/build/dts/wix-mcp-server.d.ts +2 -0
  19. package/build/dts/wix-mcp-server.js +4 -1
  20. package/build/dts/wixel/api.d.ts +0 -60
  21. package/build/dts/wixel/api.js +1 -50
  22. package/build/dts/wixel/constants.d.ts +0 -1
  23. package/build/dts/wixel/constants.js +0 -1
  24. package/build/dts/wixel/index.d.ts +0 -3
  25. package/build/dts/wixel/index.js +0 -9
  26. package/build/esm/index.js +90 -358
  27. package/build/esm/toolkit.js +81 -30
  28. package/package.json +3 -3
  29. package/build/dts/wixel/open-headless-wixel-project-tool.d.ts +0 -6
  30. package/build/dts/wixel/open-headless-wixel-project-tool.js +0 -84
  31. package/build/dts/wixel/pull-headless-wixel-job-tool.d.ts +0 -6
  32. package/build/dts/wixel/pull-headless-wixel-job-tool.js +0 -61
  33. package/build/dts/wixel/update-headless-wixel-job-tool.d.ts +0 -6
  34. package/build/dts/wixel/update-headless-wixel-job-tool.js +0 -106
@@ -29740,7 +29740,7 @@ function extractText(result) {
29740
29740
  return result.content.filter((content) => content.type === "text" && content.text != null).map((content) => content.text).join("\n");
29741
29741
  }
29742
29742
  var TOOL_RESULT_PREVIEW_MAX_CHARS = 4e3;
29743
- function formatToolResultAdditionalFields(result) {
29743
+ function formatToolResultAdditionalFields(result, extras) {
29744
29744
  const resultText = extractText(result);
29745
29745
  const contentTypes = [
29746
29746
  ...new Set(
@@ -29756,7 +29756,8 @@ function formatToolResultAdditionalFields(result) {
29756
29756
  resultPreview: resultText.slice(0, TOOL_RESULT_PREVIEW_MAX_CHARS),
29757
29757
  resultTextLength: resultText.length,
29758
29758
  resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
29759
- resultContentTypes: contentTypes
29759
+ resultContentTypes: contentTypes,
29760
+ ...extras
29760
29761
  });
29761
29762
  }
29762
29763
  function createToolBiEvent(params) {
@@ -29932,7 +29933,10 @@ var WixMcpServer = class extends McpServer {
29932
29933
  if (!toolSucceeded) {
29933
29934
  errorBody = extractText(cbResult);
29934
29935
  } else {
29935
- additionalFields = formatToolResultAdditionalFields(cbResult);
29936
+ additionalFields = formatToolResultAdditionalFields(cbResult, {
29937
+ returnedRows: toolBiParams.returnedRows,
29938
+ originalLength: toolBiParams.originalLength
29939
+ });
29936
29940
  }
29937
29941
  if (toolSucceeded && !isDevEnvironment) {
29938
29942
  panorama.transaction(toolName).finish({ toolInvocationId });
@@ -30836,6 +30840,9 @@ function rethrowIfUnauthorized(error2) {
30836
30840
  }
30837
30841
  }
30838
30842
 
30843
+ // src/config/api-request-rules.ts
30844
+ 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).";
30845
+
30839
30846
  // src/config/default-config.ts
30840
30847
  var AGENT_GOAL = dedent_default`
30841
30848
  You are an agent that helps the user manage their Wix site.
@@ -30957,11 +30964,13 @@ var EXECUTE_WIX_API_INTRO = dedent_default`
30957
30964
  CODE CONTRACT:
30958
30965
  - Pass an async function expression: \`async function() { ... }\` or \`async () => { ... }\`. Put every declaration, \`await\`, and \`return\` inside it, and do not invoke it yourself.
30959
30966
  - Use only \`wix.request({ method, url, body })\` and in-memory JavaScript. Node.js modules, filesystem access, and downloadable-file creation are unavailable.
30967
+ - Do not minify the code. Put each object property on its own line, with spaces after colons and commas, and declare deep literals (request bodies, filters, patch lists) as a named \`const\` before use so each \`wix.request({ ... })\` argument stays short.
30960
30968
 
30961
30969
  CONFIRM API CONTRACTS:
30962
30970
  - Do not rely on memory for endpoints, methods, bodies, response paths, filters, enum values, or auth scope. Confirm every method from conversation-provided details, a complete matching docs example, or the schema/docs tools before executing.
30963
30971
  - Prefer \`method.publicUrl\` from SearchWixAPISpec; never use \`method.servers[0]\`. Pass all supporting documentation URLs through \`sourceDocUrls\`.
30964
30972
  - A response field is not automatically filterable or sortable. Use only capabilities declared for that exact query/search method. If an unsupported filter is unavoidable, fetch a bounded result set and filter it in code.
30973
+ - ${ARRAY_QUERY_PARAMS_RULE}
30965
30974
  - Read-only probes may inspect state or resolve IDs. Never use speculative create/update/delete calls to discover request or response shapes, and never repeat a successful mutation merely to obtain more response data.
30966
30975
  `;
30967
30976
  var EXECUTE_WIX_API_OUTPUT_AND_ERRORS = dedent_default`
@@ -30977,6 +30986,7 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
30977
30986
  SCOPE AND SITE TARGETING:
30978
30987
  - Set \`scope: "site"\` for site-level APIs and \`scope: "account"\` for account-level APIs. Account-level acts on the account itself, or on sites as objects within it; anything that reads or writes inside a site is site-level.
30979
30988
  - If \`scope\` is omitted it defaults to site when either the ExecuteWixAPI call or \`wix.request\` provides a \`siteId\`; otherwise it defaults to account.
30989
+ - Site-level calls need a site ID; there is no implicit current site. Before any \`scope: "site"\` call, pass the site's ID as the ExecuteWixAPI \`siteId\` parameter or per request. \`scope: "site"\` without a \`siteId\` fails.
30980
30990
  - \`scope: "account"\` ignores any \`siteId\` you pass, so a site-level endpoint called that way fails.
30981
30991
  - Authentication is injected automatically; never set Authorization, wix-site-id, or wix-account-id headers.
30982
30992
  - For one named site, prefer GetSiteContext. If it is unavailable, resolve the exact site and perform the action in the same invocation.
@@ -31297,8 +31307,10 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
31297
31307
  SearchBuildAppsDocumentation: dedent_default`
31298
31308
  Searches the Wix Build Apps documentation.
31299
31309
  `,
31300
- SearchOverviewDocumentation: dedent_default`
31301
- Searches high-level Wix platform and business overview documentation.
31310
+ SearchDevelopmentDocumentation: dedent_default`
31311
+ Broad Wix development documentation (platform concepts, developer guides, getting started). **Last resort — development tasks only.**
31312
+ Skip it entirely for general, business, support, or Wix-editor questions.
31313
+ 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.
31302
31314
  `,
31303
31315
  SearchWixHeadlessDocumentation: dedent_default`
31304
31316
  Searches the Wix Headless documentation.
@@ -31950,14 +31962,20 @@ function renderApps(apps, knownApps) {
31950
31962
  }
31951
31963
  function renderProperties(props) {
31952
31964
  const sections = [];
31953
- const locale = [];
31954
- if (props.language) locale.push(`- Language: **${props.language}**`);
31955
- if (props.locale?.country) locale.push(`- Country: **${props.locale.country}**`);
31956
- if (props.timeZone) locale.push(`- Timezone: **${props.timeZone}**`);
31957
- if (props.paymentCurrency) locale.push(`- Currency: **${props.paymentCurrency}**`);
31958
- if (locale.length) {
31959
- sections.push(`**Locale & Region**
31960
- ${locale.join("\n")}`);
31965
+ const regionalFormat = [];
31966
+ if (props.language) regionalFormat.push(`- Language: **${props.language}**`);
31967
+ if (props.locale?.country)
31968
+ regionalFormat.push(`- Locale region: **${props.locale.country}**`);
31969
+ if (props.timeZone) regionalFormat.push(`- Timezone: **${props.timeZone}**`);
31970
+ if (props.paymentCurrency)
31971
+ regionalFormat.push(`- Currency: **${props.paymentCurrency}**`);
31972
+ if (regionalFormat.length) {
31973
+ sections.push(`**Regional Format**
31974
+ ${regionalFormat.join("\n")}`);
31975
+ }
31976
+ if (props.address?.country) {
31977
+ sections.push(`**Location**
31978
+ - Country: **${props.address.country}**`);
31961
31979
  }
31962
31980
  const contact = [];
31963
31981
  if (props.email) contact.push(`- Email: **${props.email}**`);
@@ -32104,6 +32122,7 @@ var known_apps_default = {
32104
32122
  "225dd912-7dea-4738-8688-4b8c6955ffc2": "Wix Forms",
32105
32123
  "d80111c5-a0f4-47a8-b63a-65b54d774a27": "Wix Gift Cards",
32106
32124
  "148c2287-c669-d849-d153-463c7486a694": "Wix Groups",
32125
+ "14bca956-e09f-f4d6-14d7-466cb3f09103": "Wix Hotels",
32107
32126
  "13ee94c1-b635-8505-3391-97919052c16f": "Wix Invoices",
32108
32127
  "14cc59bc-f0b7-15b8-e1c7-89ce41d0e0c9": "Wix Members Area",
32109
32128
  "14d84998-ae09-1abf-c6fc-3f3cace5bf19": "Wix Multilingual",
@@ -32138,8 +32157,8 @@ async function getDynamicContext(auth, httpClient6, filter, options) {
32138
32157
  partnerContextEnabled: options,
32139
32158
  includeAccountContext: options
32140
32159
  } : options;
32141
- const includePartnerContext = contextOptions?.partnerContextEnabled ?? false;
32142
- const includeAccountContext = contextOptions?.includeAccountContext ?? false;
32160
+ const includePartnerContext = contextOptions?.partnerContextEnabled ?? true;
32161
+ const includeAccountContext = contextOptions?.includeAccountContext ?? true;
32143
32162
  try {
32144
32163
  const accountHeaders = await auth.getAccountAuthHeaders();
32145
32164
  const noFilter = !filter?.siteId && !filter?.siteName;
@@ -32253,7 +32272,8 @@ var paramDescriptions = {
32253
32272
  "The url of the api to call - ALWAYS get the API url from the Wix REST docs or from the conversation context, the URL MUST BE ABSOLUTE URL",
32254
32273
  'NEVER guess the API url, ALWAYS get it from the conversation context, i.e from the user prompt or from the "WixREADME" tool or from the "SearchWixRESTDocumentation" tool or from the "BrowseWixRESTDocsMenu" tool or from the "ReadFullDocsArticle" tool',
32255
32274
  `Allowed API urls are: ${ALLOWED_HOSTNAMES.join(", ")}`,
32256
- `Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool`
32275
+ `Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool`,
32276
+ ARRAY_QUERY_PARAMS_RULE
32257
32277
  ].join("\n"),
32258
32278
  method: "The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)",
32259
32279
  body: 'The request body as a JSON object or array with all the required fields and values, including nested objects. Pass the actual value (object or array), NOT a JSON string. YOU MUST NEVER MAKE UP A BODY - the body should be based on the conversation context, i.e from the user prompt OR got into the conversation context by the "ReadFullDocsArticle" tool OR by the "SearchWixAPISpec" tool OR by the "ReadFullDocsMethodSchema" tool - i.e based on the API docs, a relevant recipe you read (preferably), a code example you found in the docs, a schema you read etc.. YOU MUST NEVER ASSUME YOU KNOW WHAT THE BODY SCHEMA IS WITHOUT CONCRETE EXAMPLES OR SCHEMA DEFINITIONS FROM THE CONVERSATION CONTEXT. Prefer reading relevant recipes if you have them in context for understand the body schema for API calls.',
@@ -32326,8 +32346,8 @@ var paramDescriptions = {
32326
32346
  searchTerm: "The search term to search for in the Build Apps Documentation",
32327
32347
  maxResults: "The maximum number of results to return, default is 10, max is 15"
32328
32348
  },
32329
- SearchOverviewDocumentation: {
32330
- searchTerm: "The search term to search for in the Wix Overview Documentation",
32349
+ SearchDevelopmentDocumentation: {
32350
+ searchTerm: "The development-related search term. Use only after a more specific docs search (REST/SDK/CLI/Build Apps/Headless/WDS) came back empty.",
32331
32351
  maxResults: "The maximum number of results to return, default is 10, max is 15"
32332
32352
  },
32333
32353
  SearchWixHeadlessDocumentation: {
@@ -33134,15 +33154,15 @@ var addDocsTools = (server, allowedTools = [
33134
33154
  }
33135
33155
  );
33136
33156
  }
33137
- if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("SearchOverviewDocumentation")) {
33157
+ if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("SearchDevelopmentDocumentation")) {
33138
33158
  server.tool(
33139
- "SearchOverviewDocumentation",
33159
+ "SearchDevelopmentDocumentation",
33140
33160
  getDescription(
33141
- "SearchOverviewDocumentation",
33142
- defaultToolDescriptions.SearchOverviewDocumentation ?? ""
33161
+ "SearchDevelopmentDocumentation",
33162
+ defaultToolDescriptions.SearchDevelopmentDocumentation ?? ""
33143
33163
  ),
33144
33164
  (() => {
33145
- const d2 = desc("SearchOverviewDocumentation");
33165
+ const d2 = desc("SearchDevelopmentDocumentation");
33146
33166
  return {
33147
33167
  searchTerm: external_exports.string().describe(d2.searchTerm),
33148
33168
  maxResults: external_exports.number().describe(d2.maxResults).min(1).max(15).optional().default(15)
@@ -33172,8 +33192,8 @@ var addDocsTools = (server, allowedTools = [
33172
33192
  panorama.errorMonitor().reportError(error2);
33173
33193
  captureException(error2, {
33174
33194
  tags: {
33175
- componentId: "SearchOverviewDocumentation",
33176
- toolName: "SearchOverviewDocumentation"
33195
+ componentId: "SearchDevelopmentDocumentation",
33196
+ toolName: "SearchDevelopmentDocumentation"
33177
33197
  }
33178
33198
  });
33179
33199
  logger2.error(
@@ -33992,6 +34012,19 @@ var MAX_ALLOWED_RESPONSE_CHARS = 2e6;
33992
34012
 
33993
34013
  // src/api-call/index.ts
33994
34014
  var DEFAULT_MAX_RESPONSE_SIZE = 5e4;
34015
+ function extractReturnedRows(responseData) {
34016
+ if (responseData === null || typeof responseData !== "object") {
34017
+ return void 0;
34018
+ }
34019
+ const data = responseData;
34020
+ const block = data.pagingMetadata ?? data.cursorPagingMetadata ?? data.pagingOffsetMetadata ?? data.metaData ?? data.metadata;
34021
+ const raw = block?.count;
34022
+ if (typeof raw !== "number" && (typeof raw !== "string" || raw.trim() === "")) {
34023
+ return void 0;
34024
+ }
34025
+ const count = Number(raw);
34026
+ return Number.isFinite(count) ? count : void 0;
34027
+ }
33995
34028
  function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_SIZE) {
33996
34029
  if (typeof responseData === "string" && responseData.trim().startsWith("<!DOCTYPE")) {
33997
34030
  return {
@@ -33999,13 +34032,15 @@ function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_
33999
34032
  isError: true
34000
34033
  };
34001
34034
  }
34035
+ const returnedRows = extractReturnedRows(responseData);
34002
34036
  let responseText = JSON.stringify(responseData);
34037
+ const originalLength = responseText.length;
34003
34038
  const effectiveMax = Math.min(maxResponseSize, MAX_ALLOWED_RESPONSE_CHARS);
34004
34039
  if (responseText.length > effectiveMax) {
34005
34040
  responseText = responseText.slice(0, effectiveMax) + `
34006
34041
  ...[TRUNCATED - response was ${responseText.length} chars, showing first ${effectiveMax}]`;
34007
34042
  }
34008
- return { text: responseText, isError: false };
34043
+ return { text: responseText, isError: false, originalLength, returnedRows };
34009
34044
  }
34010
34045
  function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "ListWixSites", "ManageWixSite"], disableTools = [], enableTools = [], toolDescriptions, toolHints, maxResponseSize) {
34011
34046
  const effectiveAllowedTools = [
@@ -34068,9 +34103,14 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
34068
34103
  data: method === "GET" ? void 0 : body
34069
34104
  });
34070
34105
  const requestId = response.headers?.["x-wix-request-id"];
34071
- setToolBiParams({ requestId, siteId });
34072
34106
  const responseData = await handleWixAPIResponse(response);
34073
34107
  const formatted = formatApiResponse(responseData, maxResponseSize);
34108
+ setToolBiParams({
34109
+ requestId,
34110
+ siteId,
34111
+ returnedRows: formatted.returnedRows,
34112
+ originalLength: formatted.originalLength
34113
+ });
34074
34114
  if (formatted.isError) {
34075
34115
  return {
34076
34116
  content: [
@@ -34209,7 +34249,7 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
34209
34249
  destructiveHint: true,
34210
34250
  openWorldHint: false
34211
34251
  }),
34212
- async ({ url, body, method, reason }, { httpClient: httpClient6 }) => {
34252
+ async ({ url, body, method, reason }, { httpClient: httpClient6, setToolBiParams }) => {
34213
34253
  logger2.log(
34214
34254
  `Calling Wix Account level API: ${url}, reason="${reason}", body: ${JSON.stringify(body)}`
34215
34255
  );
@@ -34238,6 +34278,10 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
34238
34278
  });
34239
34279
  const responseData = await handleWixAPIResponse(response);
34240
34280
  const formatted = formatApiResponse(responseData, maxResponseSize);
34281
+ setToolBiParams({
34282
+ returnedRows: formatted.returnedRows,
34283
+ originalLength: formatted.originalLength
34284
+ });
34241
34285
  if (formatted.isError) {
34242
34286
  return {
34243
34287
  content: [
@@ -43232,7 +43276,6 @@ function listAssetsByProjectId(payload) {
43232
43276
  // src/wixel/constants.ts
43233
43277
  var WIXEL_ASSISTANT_V1_NO_ENTITY_API_BASE_URL = "https://manage.wix.com/";
43234
43278
  var WWW_ASSET_V1_ASSET_API_BASE_URL = "https://manage.wix.com/";
43235
- var HARMONY_SITE_BUILDER_API_BASE_URL = "https://manage.wix.com/";
43236
43279
  var WIXEL_AGENT_EXTERNAL_API_BASE_URL = "https://manage.wix.com/";
43237
43280
  var WIXEL_WIDGET_URI = "ui://widget/wixel-widget.html";
43238
43281
  var WIXEL_ICON_PNG_URL = "https://wixmp-e9a92e1fa066d7bc836e4d31.wixmp.com/logos/wixel-icon-180.png";
@@ -43349,87 +43392,6 @@ async function queryAssets({
43349
43392
  } = await httpClient6.request(listAssetsByProjectId({ projectId }));
43350
43393
  return { assets };
43351
43394
  }
43352
- async function openHeadlessWixelProject({
43353
- accountAuthHeaders,
43354
- apiBaseURL = HARMONY_SITE_BUILDER_API_BASE_URL,
43355
- url,
43356
- userPrompt,
43357
- jobId,
43358
- siteId,
43359
- projectId,
43360
- conversationId,
43361
- withScreenshots,
43362
- useProvidedCookies,
43363
- timeout,
43364
- conductorOverride
43365
- }) {
43366
- const httpClient6 = createHttpClient2({
43367
- headers: {
43368
- ...COMMON_HEADERS,
43369
- ...accountAuthHeaders,
43370
- ...conductorOverride ? { ...CONDUCTOR_OVERRIDE_HEADERS } : {},
43371
- "Content-Type": "application/json"
43372
- },
43373
- baseURL: apiBaseURL
43374
- });
43375
- const response = await httpClient6.post(
43376
- "/_api/harmony-site-builder/open-wixel-project",
43377
- {
43378
- url,
43379
- userPrompt,
43380
- jobId,
43381
- siteId,
43382
- projectId,
43383
- conversationId,
43384
- withScreenshots,
43385
- useProvidedCookies,
43386
- timeout
43387
- }
43388
- );
43389
- return response.data;
43390
- }
43391
- async function updateHeadlessWixelJob({
43392
- accountAuthHeaders,
43393
- job,
43394
- apiBaseURL = HARMONY_SITE_BUILDER_API_BASE_URL,
43395
- conductorOverride
43396
- }) {
43397
- const httpClient6 = createHttpClient2({
43398
- headers: {
43399
- ...COMMON_HEADERS,
43400
- ...accountAuthHeaders,
43401
- ...conductorOverride ? { ...CONDUCTOR_OVERRIDE_HEADERS } : {},
43402
- "Content-Type": "application/json"
43403
- },
43404
- baseURL: apiBaseURL
43405
- });
43406
- const response = await httpClient6.post(
43407
- "/_api/harmony-site-builder/update-wixel-job",
43408
- { job }
43409
- );
43410
- return response.data;
43411
- }
43412
- async function pullHeadlessWixelJob({
43413
- accountAuthHeaders,
43414
- apiBaseURL = HARMONY_SITE_BUILDER_API_BASE_URL,
43415
- jobId,
43416
- conductorOverride
43417
- }) {
43418
- const httpClient6 = createHttpClient2({
43419
- headers: {
43420
- ...COMMON_HEADERS,
43421
- ...accountAuthHeaders,
43422
- ...conductorOverride ? { ...CONDUCTOR_OVERRIDE_HEADERS } : {},
43423
- "Content-Type": "application/json"
43424
- },
43425
- baseURL: apiBaseURL
43426
- });
43427
- const response = await httpClient6.post(
43428
- "/_api/harmony-site-builder/pull-wixel-job",
43429
- { jobId }
43430
- );
43431
- return response.data;
43432
- }
43433
43395
  async function getStylePresetsByIds2({
43434
43396
  siteAuthHeaders,
43435
43397
  stylePresetIds,
@@ -43749,240 +43711,6 @@ function addGetWixelProjectAssetsTool(server, authStrategy, options = {}) {
43749
43711
  );
43750
43712
  }
43751
43713
 
43752
- // src/wixel/update-headless-wixel-job-tool.ts
43753
- var TOOL_NAME5 = "updateHeadlessWixelJob";
43754
- var TOOL_TITLE5 = "Update Headless Wixel Job";
43755
- var TOOL_DESCRIPTION5 = `Update the status and data of a headless Wixel job.`;
43756
- var TOOL_META5 = {
43757
- ui: { visibility: ["app"] }
43758
- };
43759
- var wixelJobStatusSchema = external_exports.enum([
43760
- "STARTED",
43761
- "IN_PROGRESS",
43762
- "COMPLETED",
43763
- "FAILED",
43764
- "CANCELLED"
43765
- ]);
43766
- function addUpdateHeadlessWixelJobTool(server, authStrategy, options = {}) {
43767
- const { getAccountAuthHeaders } = authStrategy;
43768
- vD(
43769
- server,
43770
- TOOL_NAME5,
43771
- {
43772
- title: TOOL_TITLE5,
43773
- description: TOOL_DESCRIPTION5,
43774
- inputSchema: {
43775
- id: external_exports.string().describe("The job ID"),
43776
- status: wixelJobStatusSchema.describe("The job status"),
43777
- userPrompt: external_exports.string().optional().describe("The user prompt for the job"),
43778
- shouldRefresh: external_exports.boolean().optional().describe("Whether the job should refresh"),
43779
- errorMessage: external_exports.string().optional().describe("Error message if the job failed"),
43780
- type: external_exports.string().optional().describe("The type of asset being created"),
43781
- data: external_exports.object({
43782
- siteId: external_exports.string().optional().describe("The site ID"),
43783
- assetId: external_exports.string().optional().describe("The asset ID"),
43784
- projectId: external_exports.string().optional().describe("The project ID"),
43785
- conversationId: external_exports.string().optional().describe("The conversation ID")
43786
- }).optional().describe("Additional job data"),
43787
- userId: external_exports.string().optional().describe("The user ID"),
43788
- accountId: external_exports.string().optional().describe("The account ID")
43789
- },
43790
- annotations: {
43791
- readOnlyHint: false,
43792
- destructiveHint: true,
43793
- openWorldHint: false
43794
- },
43795
- _meta: TOOL_META5
43796
- },
43797
- async (args) => {
43798
- try {
43799
- const accountAuthHeaders = await getAccountAuthHeaders();
43800
- const result = await updateHeadlessWixelJob({
43801
- accountAuthHeaders,
43802
- conductorOverride: options.conductorOverride,
43803
- job: {
43804
- id: args.id,
43805
- status: args.status,
43806
- userPrompt: args.userPrompt,
43807
- shouldRefresh: args.shouldRefresh,
43808
- errorMessage: args.errorMessage,
43809
- type: args.type,
43810
- data: args.data,
43811
- userId: args.userId,
43812
- accountId: args.accountId
43813
- }
43814
- });
43815
- return {
43816
- isError: false,
43817
- content: [
43818
- {
43819
- type: "text",
43820
- text: `Headless Wixel job ${args.id} updated to status: ${args.status}`
43821
- }
43822
- ],
43823
- structuredContent: {
43824
- jobId: args.id,
43825
- status: args.status,
43826
- ...result
43827
- }
43828
- };
43829
- } catch (error2) {
43830
- console.error("\u274C Error updating headless Wixel job:", error2);
43831
- const errorMessage = error2.message;
43832
- return {
43833
- isError: true,
43834
- content: [{ type: "text", text: errorMessage }],
43835
- structuredContent: {
43836
- success: false,
43837
- error: errorMessage
43838
- }
43839
- };
43840
- }
43841
- }
43842
- );
43843
- }
43844
-
43845
- // src/wixel/pull-headless-wixel-job-tool.ts
43846
- var TOOL_NAME6 = "pullHeadlessWixelJob";
43847
- var TOOL_TITLE6 = "Pull Headless Wixel Job";
43848
- var TOOL_DESCRIPTION6 = `Pull the next available headless Wixel job.`;
43849
- var TOOL_META6 = {
43850
- ui: { visibility: ["app"] }
43851
- };
43852
- function addPullHeadlessWixelJobTool(server, authStrategy, options = {}) {
43853
- const { getAccountAuthHeaders } = authStrategy;
43854
- vD(
43855
- server,
43856
- TOOL_NAME6,
43857
- {
43858
- title: TOOL_TITLE6,
43859
- description: TOOL_DESCRIPTION6,
43860
- inputSchema: {
43861
- jobId: external_exports.string().describe("The job ID")
43862
- },
43863
- annotations: {
43864
- readOnlyHint: false,
43865
- destructiveHint: false,
43866
- openWorldHint: false
43867
- },
43868
- _meta: TOOL_META6
43869
- },
43870
- async (args) => {
43871
- try {
43872
- const accountAuthHeaders = await getAccountAuthHeaders();
43873
- const result = await pullHeadlessWixelJob({
43874
- accountAuthHeaders,
43875
- jobId: args.jobId,
43876
- conductorOverride: options.conductorOverride
43877
- });
43878
- return {
43879
- isError: false,
43880
- content: [
43881
- {
43882
- type: "text",
43883
- text: result.job ? `Pulled headless Wixel job: ${result.job.id}` : "No headless Wixel job available"
43884
- }
43885
- ],
43886
- structuredContent: {
43887
- ...result
43888
- }
43889
- };
43890
- } catch (error2) {
43891
- console.error("\u274C Error pulling headless Wixel job:", error2);
43892
- const errorMessage = error2.message;
43893
- return {
43894
- isError: true,
43895
- content: [{ type: "text", text: errorMessage }],
43896
- structuredContent: {
43897
- success: false,
43898
- error: errorMessage
43899
- }
43900
- };
43901
- }
43902
- }
43903
- );
43904
- }
43905
-
43906
- // src/wixel/open-headless-wixel-project-tool.ts
43907
- var TOOL_NAME7 = "openHeadlessWixelProject";
43908
- var TOOL_TITLE7 = "Open Headless Wixel Project";
43909
- var TOOL_DESCRIPTION7 = `Open a headless Wixel project for background asset generation.`;
43910
- var TOOL_META7 = {
43911
- ui: { visibility: ["app"] }
43912
- };
43913
- function addOpenHeadlessWixelProjectTool(server, authStrategy, options = {}) {
43914
- const { getAccountAuthHeaders } = authStrategy;
43915
- vD(
43916
- server,
43917
- TOOL_NAME7,
43918
- {
43919
- title: TOOL_TITLE7,
43920
- description: TOOL_DESCRIPTION7,
43921
- inputSchema: {
43922
- url: external_exports.string().describe("The URL of the Wixel project"),
43923
- userPrompt: external_exports.string().describe("The user prompt for the project"),
43924
- jobId: external_exports.string().describe("The job ID"),
43925
- siteId: external_exports.string().describe("The site ID"),
43926
- projectId: external_exports.string().describe("The project ID"),
43927
- conversationId: external_exports.string().describe("The conversation ID"),
43928
- withScreenshots: external_exports.boolean().optional().describe("Whether to include screenshots"),
43929
- useProvidedCookies: external_exports.boolean().optional().describe("Whether to use provided cookies"),
43930
- timeout: external_exports.number().optional().describe("Timeout in milliseconds")
43931
- },
43932
- annotations: {
43933
- readOnlyHint: false,
43934
- destructiveHint: true,
43935
- openWorldHint: false
43936
- },
43937
- _meta: TOOL_META7
43938
- },
43939
- async (args) => {
43940
- try {
43941
- const accountAuthHeaders = await getAccountAuthHeaders();
43942
- const result = await openHeadlessWixelProject({
43943
- accountAuthHeaders,
43944
- url: args.url,
43945
- userPrompt: args.userPrompt,
43946
- jobId: args.jobId,
43947
- siteId: args.siteId,
43948
- projectId: args.projectId,
43949
- conversationId: args.conversationId,
43950
- withScreenshots: args.withScreenshots,
43951
- useProvidedCookies: args.useProvidedCookies,
43952
- timeout: args.timeout,
43953
- conductorOverride: options.conductorOverride
43954
- });
43955
- return {
43956
- isError: false,
43957
- content: [
43958
- {
43959
- type: "text",
43960
- text: `Headless Wixel project opened for job ${args.jobId}`
43961
- }
43962
- ],
43963
- structuredContent: {
43964
- success: true,
43965
- jobId: args.jobId,
43966
- projectId: args.projectId,
43967
- ...result
43968
- }
43969
- };
43970
- } catch (error2) {
43971
- console.error("\u274C Error opening headless Wixel project:", error2);
43972
- const errorMessage = error2.message;
43973
- return {
43974
- isError: true,
43975
- content: [{ type: "text", text: errorMessage }],
43976
- structuredContent: {
43977
- success: false,
43978
- error: errorMessage
43979
- }
43980
- };
43981
- }
43982
- }
43983
- );
43984
- }
43985
-
43986
43714
  // ../../node_modules/@wix/ambassador-www-wixel-agent-v1-external-agent/es/build/http.impl.js
43987
43715
  init_ambassador_index();
43988
43716
  init_build();
@@ -44321,7 +44049,7 @@ async function getWixelPendingQuestion({
44321
44049
  }
44322
44050
 
44323
44051
  // src/wixel/wixel-session-tools.ts
44324
- var TOOL_META8 = {
44052
+ var TOOL_META5 = {
44325
44053
  ui: { visibility: ["app", "model"] }
44326
44054
  };
44327
44055
  function buildWixelEditorUrl(metaSiteId, projectId) {
@@ -44630,7 +44358,7 @@ Without arguments Wixel provisions a new project and session. Pass metaSiteId to
44630
44358
  destructiveHint: false,
44631
44359
  openWorldHint: false
44632
44360
  },
44633
- _meta: TOOL_META8
44361
+ _meta: TOOL_META5
44634
44362
  },
44635
44363
  async (args, extra) => {
44636
44364
  setWixelToolBi(extra, {
@@ -44724,7 +44452,7 @@ Send the user's request as THEY phrased it. Do NOT add creative direction they d
44724
44452
  destructiveHint: true,
44725
44453
  openWorldHint: false
44726
44454
  },
44727
- _meta: TOOL_META8
44455
+ _meta: TOOL_META5
44728
44456
  },
44729
44457
  async (args, extra) => {
44730
44458
  setWixelToolBi(extra, {
@@ -44825,7 +44553,7 @@ Event types: "reply" (the agent's answer), "failed" (the turn failed), and "user
44825
44553
  destructiveHint: false,
44826
44554
  openWorldHint: false
44827
44555
  },
44828
- _meta: TOOL_META8
44556
+ _meta: TOOL_META5
44829
44557
  },
44830
44558
  async (args, extra) => {
44831
44559
  setWixelToolBi(extra, {
@@ -44995,7 +44723,7 @@ function addGetWixelStylePresetsTool(server, authStrategy, options = {}) {
44995
44723
  destructiveHint: false,
44996
44724
  openWorldHint: false
44997
44725
  },
44998
- _meta: TOOL_META8
44726
+ _meta: TOOL_META5
44999
44727
  },
45000
44728
  async (args, extra) => {
45001
44729
  setWixelToolBi(extra, { siteId: args.metaSiteId });
@@ -45298,9 +45026,6 @@ function addWixelTools(server, authStrategy, options = {}) {
45298
45026
  addMarkWixelJobAsFulfilledTool(server, authStrategy, options);
45299
45027
  addGetWixelAssetTool(server, authStrategy, options);
45300
45028
  addGetWixelProjectAssetsTool(server, authStrategy, options);
45301
- addUpdateHeadlessWixelJobTool(server, authStrategy, options);
45302
- addOpenHeadlessWixelProjectTool(server, authStrategy, options);
45303
- addPullHeadlessWixelJobTool(server, authStrategy, options);
45304
45029
  addWixelSessionTools(server, authStrategy, options);
45305
45030
  }
45306
45031
 
@@ -45737,10 +45462,13 @@ function executeTextResult(message) {
45737
45462
  content: [{ type: "text", text: message }]
45738
45463
  };
45739
45464
  }
45740
- function formatExecuteResult(data, maxResponseSize) {
45465
+ function formatExecuteResult(data, maxResponseSize, reportBi) {
45741
45466
  if (data.error) {
45742
45467
  return executeErrorResult(data.error);
45743
45468
  }
45469
+ reportBi?.({
45470
+ originalLength: typeof data.result === "string" ? data.result.length : JSON.stringify(data.result)?.length
45471
+ });
45744
45472
  return {
45745
45473
  content: [
45746
45474
  { type: "text", text: truncateResponse(data.result, maxResponseSize) }
@@ -45850,7 +45578,11 @@ function addExecuteTool(server, options) {
45850
45578
  status: data.authErrorStatus
45851
45579
  });
45852
45580
  }
45853
- return formatExecuteResult(data, maxResponseSize);
45581
+ return formatExecuteResult(
45582
+ data,
45583
+ maxResponseSize,
45584
+ extra?.setToolBiParams
45585
+ );
45854
45586
  } catch (err) {
45855
45587
  const message = err instanceof Error ? err.message : String(err);
45856
45588
  logger2.log(
@@ -46095,7 +45827,10 @@ function createWixToolkit(options) {
46095
45827
  if (!toolSucceeded) {
46096
45828
  errorBody = extractText(cbResult);
46097
45829
  } else {
46098
- additionalFields = formatToolResultAdditionalFields(cbResult);
45830
+ additionalFields = formatToolResultAdditionalFields(cbResult, {
45831
+ returnedRows: toolBiParams.returnedRows,
45832
+ originalLength: toolBiParams.originalLength
45833
+ });
46099
45834
  }
46100
45835
  if (!isDevEnvironment) {
46101
45836
  if (toolSucceeded) {
@@ -46253,8 +45988,6 @@ export {
46253
45988
  addImportClaudeDesignTool,
46254
45989
  addListWixelEventsTool,
46255
45990
  addMarkWixelJobAsFulfilledTool,
46256
- addOpenHeadlessWixelProjectTool,
46257
- addPullHeadlessWixelJobTool,
46258
45991
  addPullSiteJobTool,
46259
45992
  addSearchCodeModeTool,
46260
45993
  addSearchSiteTemplatesTool,
@@ -46262,7 +45995,6 @@ export {
46262
45995
  addSiteCreationWidgetTools,
46263
45996
  addStartWixelSessionTool,
46264
45997
  addSupportTool,
46265
- addUpdateHeadlessWixelJobTool,
46266
45998
  addWixSiteCreationTool,
46267
45999
  addWixelSessionTools,
46268
46000
  addWixelTools,