@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
@@ -20911,8 +20911,6 @@ __export(index_exports, {
20911
20911
  addImportClaudeDesignTool: () => addImportClaudeDesignTool,
20912
20912
  addListWixelEventsTool: () => addListWixelEventsTool,
20913
20913
  addMarkWixelJobAsFulfilledTool: () => addMarkWixelJobAsFulfilledTool,
20914
- addOpenHeadlessWixelProjectTool: () => addOpenHeadlessWixelProjectTool,
20915
- addPullHeadlessWixelJobTool: () => addPullHeadlessWixelJobTool,
20916
20914
  addPullSiteJobTool: () => addPullSiteJobTool,
20917
20915
  addSearchCodeModeTool: () => addSearchCodeModeTool,
20918
20916
  addSearchSiteTemplatesTool: () => addSearchSiteTemplatesTool,
@@ -20920,7 +20918,6 @@ __export(index_exports, {
20920
20918
  addSiteCreationWidgetTools: () => addSiteCreationWidgetTools,
20921
20919
  addStartWixelSessionTool: () => addStartWixelSessionTool,
20922
20920
  addSupportTool: () => addSupportTool,
20923
- addUpdateHeadlessWixelJobTool: () => addUpdateHeadlessWixelJobTool,
20924
20921
  addWixSiteCreationTool: () => addWixSiteCreationTool,
20925
20922
  addWixelSessionTools: () => addWixelSessionTools,
20926
20923
  addWixelTools: () => addWixelTools,
@@ -36019,7 +36016,7 @@ function extractText(result) {
36019
36016
  return result.content.filter((content) => content.type === "text" && content.text != null).map((content) => content.text).join("\n");
36020
36017
  }
36021
36018
  var TOOL_RESULT_PREVIEW_MAX_CHARS = 4e3;
36022
- function formatToolResultAdditionalFields(result) {
36019
+ function formatToolResultAdditionalFields(result, extras) {
36023
36020
  const resultText = extractText(result);
36024
36021
  const contentTypes = [
36025
36022
  ...new Set(
@@ -36035,7 +36032,8 @@ function formatToolResultAdditionalFields(result) {
36035
36032
  resultPreview: resultText.slice(0, TOOL_RESULT_PREVIEW_MAX_CHARS),
36036
36033
  resultTextLength: resultText.length,
36037
36034
  resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
36038
- resultContentTypes: contentTypes
36035
+ resultContentTypes: contentTypes,
36036
+ ...extras
36039
36037
  });
36040
36038
  }
36041
36039
  function createToolBiEvent(params) {
@@ -36211,7 +36209,10 @@ var WixMcpServer = class extends McpServer {
36211
36209
  if (!toolSucceeded) {
36212
36210
  errorBody = extractText(cbResult);
36213
36211
  } else {
36214
- additionalFields = formatToolResultAdditionalFields(cbResult);
36212
+ additionalFields = formatToolResultAdditionalFields(cbResult, {
36213
+ returnedRows: toolBiParams.returnedRows,
36214
+ originalLength: toolBiParams.originalLength
36215
+ });
36215
36216
  }
36216
36217
  if (toolSucceeded && !isDevEnvironment) {
36217
36218
  panorama.transaction(toolName).finish({ toolInvocationId });
@@ -37118,6 +37119,9 @@ function rethrowIfUnauthorized(error2) {
37118
37119
  }
37119
37120
  }
37120
37121
 
37122
+ // src/config/api-request-rules.ts
37123
+ 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).";
37124
+
37121
37125
  // src/config/default-config.ts
37122
37126
  var AGENT_GOAL = dedent_default`
37123
37127
  You are an agent that helps the user manage their Wix site.
@@ -37239,11 +37243,13 @@ var EXECUTE_WIX_API_INTRO = dedent_default`
37239
37243
  CODE CONTRACT:
37240
37244
  - Pass an async function expression: \`async function() { ... }\` or \`async () => { ... }\`. Put every declaration, \`await\`, and \`return\` inside it, and do not invoke it yourself.
37241
37245
  - Use only \`wix.request({ method, url, body })\` and in-memory JavaScript. Node.js modules, filesystem access, and downloadable-file creation are unavailable.
37246
+ - 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.
37242
37247
 
37243
37248
  CONFIRM API CONTRACTS:
37244
37249
  - 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.
37245
37250
  - Prefer \`method.publicUrl\` from SearchWixAPISpec; never use \`method.servers[0]\`. Pass all supporting documentation URLs through \`sourceDocUrls\`.
37246
37251
  - 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.
37252
+ - ${ARRAY_QUERY_PARAMS_RULE}
37247
37253
  - 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.
37248
37254
  `;
37249
37255
  var EXECUTE_WIX_API_OUTPUT_AND_ERRORS = dedent_default`
@@ -37259,6 +37265,7 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
37259
37265
  SCOPE AND SITE TARGETING:
37260
37266
  - 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.
37261
37267
  - If \`scope\` is omitted it defaults to site when either the ExecuteWixAPI call or \`wix.request\` provides a \`siteId\`; otherwise it defaults to account.
37268
+ - 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.
37262
37269
  - \`scope: "account"\` ignores any \`siteId\` you pass, so a site-level endpoint called that way fails.
37263
37270
  - Authentication is injected automatically; never set Authorization, wix-site-id, or wix-account-id headers.
37264
37271
  - For one named site, prefer GetSiteContext. If it is unavailable, resolve the exact site and perform the action in the same invocation.
@@ -37579,8 +37586,10 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
37579
37586
  SearchBuildAppsDocumentation: dedent_default`
37580
37587
  Searches the Wix Build Apps documentation.
37581
37588
  `,
37582
- SearchOverviewDocumentation: dedent_default`
37583
- Searches high-level Wix platform and business overview documentation.
37589
+ SearchDevelopmentDocumentation: dedent_default`
37590
+ Broad Wix development documentation (platform concepts, developer guides, getting started). **Last resort — development tasks only.**
37591
+ Skip it entirely for general, business, support, or Wix-editor questions.
37592
+ 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.
37584
37593
  `,
37585
37594
  SearchWixHeadlessDocumentation: dedent_default`
37586
37595
  Searches the Wix Headless documentation.
@@ -38232,14 +38241,20 @@ function renderApps(apps, knownApps) {
38232
38241
  }
38233
38242
  function renderProperties(props) {
38234
38243
  const sections = [];
38235
- const locale = [];
38236
- if (props.language) locale.push(`- Language: **${props.language}**`);
38237
- if (props.locale?.country) locale.push(`- Country: **${props.locale.country}**`);
38238
- if (props.timeZone) locale.push(`- Timezone: **${props.timeZone}**`);
38239
- if (props.paymentCurrency) locale.push(`- Currency: **${props.paymentCurrency}**`);
38240
- if (locale.length) {
38241
- sections.push(`**Locale & Region**
38242
- ${locale.join("\n")}`);
38244
+ const regionalFormat = [];
38245
+ if (props.language) regionalFormat.push(`- Language: **${props.language}**`);
38246
+ if (props.locale?.country)
38247
+ regionalFormat.push(`- Locale region: **${props.locale.country}**`);
38248
+ if (props.timeZone) regionalFormat.push(`- Timezone: **${props.timeZone}**`);
38249
+ if (props.paymentCurrency)
38250
+ regionalFormat.push(`- Currency: **${props.paymentCurrency}**`);
38251
+ if (regionalFormat.length) {
38252
+ sections.push(`**Regional Format**
38253
+ ${regionalFormat.join("\n")}`);
38254
+ }
38255
+ if (props.address?.country) {
38256
+ sections.push(`**Location**
38257
+ - Country: **${props.address.country}**`);
38243
38258
  }
38244
38259
  const contact = [];
38245
38260
  if (props.email) contact.push(`- Email: **${props.email}**`);
@@ -38386,6 +38401,7 @@ var known_apps_default = {
38386
38401
  "225dd912-7dea-4738-8688-4b8c6955ffc2": "Wix Forms",
38387
38402
  "d80111c5-a0f4-47a8-b63a-65b54d774a27": "Wix Gift Cards",
38388
38403
  "148c2287-c669-d849-d153-463c7486a694": "Wix Groups",
38404
+ "14bca956-e09f-f4d6-14d7-466cb3f09103": "Wix Hotels",
38389
38405
  "13ee94c1-b635-8505-3391-97919052c16f": "Wix Invoices",
38390
38406
  "14cc59bc-f0b7-15b8-e1c7-89ce41d0e0c9": "Wix Members Area",
38391
38407
  "14d84998-ae09-1abf-c6fc-3f3cace5bf19": "Wix Multilingual",
@@ -38420,8 +38436,8 @@ async function getDynamicContext(auth, httpClient6, filter, options) {
38420
38436
  partnerContextEnabled: options,
38421
38437
  includeAccountContext: options
38422
38438
  } : options;
38423
- const includePartnerContext = contextOptions?.partnerContextEnabled ?? false;
38424
- const includeAccountContext = contextOptions?.includeAccountContext ?? false;
38439
+ const includePartnerContext = contextOptions?.partnerContextEnabled ?? true;
38440
+ const includeAccountContext = contextOptions?.includeAccountContext ?? true;
38425
38441
  try {
38426
38442
  const accountHeaders = await auth.getAccountAuthHeaders();
38427
38443
  const noFilter = !filter?.siteId && !filter?.siteName;
@@ -38535,7 +38551,8 @@ var paramDescriptions = {
38535
38551
  "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",
38536
38552
  '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',
38537
38553
  `Allowed API urls are: ${ALLOWED_HOSTNAMES.join(", ")}`,
38538
- `Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool`
38554
+ `Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool`,
38555
+ ARRAY_QUERY_PARAMS_RULE
38539
38556
  ].join("\n"),
38540
38557
  method: "The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)",
38541
38558
  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.',
@@ -38608,8 +38625,8 @@ var paramDescriptions = {
38608
38625
  searchTerm: "The search term to search for in the Build Apps Documentation",
38609
38626
  maxResults: "The maximum number of results to return, default is 10, max is 15"
38610
38627
  },
38611
- SearchOverviewDocumentation: {
38612
- searchTerm: "The search term to search for in the Wix Overview Documentation",
38628
+ SearchDevelopmentDocumentation: {
38629
+ searchTerm: "The development-related search term. Use only after a more specific docs search (REST/SDK/CLI/Build Apps/Headless/WDS) came back empty.",
38613
38630
  maxResults: "The maximum number of results to return, default is 10, max is 15"
38614
38631
  },
38615
38632
  SearchWixHeadlessDocumentation: {
@@ -39416,15 +39433,15 @@ var addDocsTools = (server, allowedTools = [
39416
39433
  }
39417
39434
  );
39418
39435
  }
39419
- if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("SearchOverviewDocumentation")) {
39436
+ if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("SearchDevelopmentDocumentation")) {
39420
39437
  server.tool(
39421
- "SearchOverviewDocumentation",
39438
+ "SearchDevelopmentDocumentation",
39422
39439
  getDescription(
39423
- "SearchOverviewDocumentation",
39424
- defaultToolDescriptions.SearchOverviewDocumentation ?? ""
39440
+ "SearchDevelopmentDocumentation",
39441
+ defaultToolDescriptions.SearchDevelopmentDocumentation ?? ""
39425
39442
  ),
39426
39443
  (() => {
39427
- const d2 = desc("SearchOverviewDocumentation");
39444
+ const d2 = desc("SearchDevelopmentDocumentation");
39428
39445
  return {
39429
39446
  searchTerm: external_exports.string().describe(d2.searchTerm),
39430
39447
  maxResults: external_exports.number().describe(d2.maxResults).min(1).max(15).optional().default(15)
@@ -39454,8 +39471,8 @@ var addDocsTools = (server, allowedTools = [
39454
39471
  panorama.errorMonitor().reportError(error2);
39455
39472
  captureException(error2, {
39456
39473
  tags: {
39457
- componentId: "SearchOverviewDocumentation",
39458
- toolName: "SearchOverviewDocumentation"
39474
+ componentId: "SearchDevelopmentDocumentation",
39475
+ toolName: "SearchDevelopmentDocumentation"
39459
39476
  }
39460
39477
  });
39461
39478
  logger2.error(
@@ -40277,6 +40294,19 @@ var MAX_ALLOWED_RESPONSE_CHARS = 2e6;
40277
40294
 
40278
40295
  // src/api-call/index.ts
40279
40296
  var DEFAULT_MAX_RESPONSE_SIZE = 5e4;
40297
+ function extractReturnedRows(responseData) {
40298
+ if (responseData === null || typeof responseData !== "object") {
40299
+ return void 0;
40300
+ }
40301
+ const data = responseData;
40302
+ const block = data.pagingMetadata ?? data.cursorPagingMetadata ?? data.pagingOffsetMetadata ?? data.metaData ?? data.metadata;
40303
+ const raw = block?.count;
40304
+ if (typeof raw !== "number" && (typeof raw !== "string" || raw.trim() === "")) {
40305
+ return void 0;
40306
+ }
40307
+ const count = Number(raw);
40308
+ return Number.isFinite(count) ? count : void 0;
40309
+ }
40280
40310
  function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_SIZE) {
40281
40311
  if (typeof responseData === "string" && responseData.trim().startsWith("<!DOCTYPE")) {
40282
40312
  return {
@@ -40284,13 +40314,15 @@ function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_
40284
40314
  isError: true
40285
40315
  };
40286
40316
  }
40317
+ const returnedRows = extractReturnedRows(responseData);
40287
40318
  let responseText = JSON.stringify(responseData);
40319
+ const originalLength = responseText.length;
40288
40320
  const effectiveMax = Math.min(maxResponseSize, MAX_ALLOWED_RESPONSE_CHARS);
40289
40321
  if (responseText.length > effectiveMax) {
40290
40322
  responseText = responseText.slice(0, effectiveMax) + `
40291
40323
  ...[TRUNCATED - response was ${responseText.length} chars, showing first ${effectiveMax}]`;
40292
40324
  }
40293
- return { text: responseText, isError: false };
40325
+ return { text: responseText, isError: false, originalLength, returnedRows };
40294
40326
  }
40295
40327
  function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "ListWixSites", "ManageWixSite"], disableTools = [], enableTools = [], toolDescriptions, toolHints, maxResponseSize) {
40296
40328
  const effectiveAllowedTools = [
@@ -40353,9 +40385,14 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
40353
40385
  data: method === "GET" ? void 0 : body
40354
40386
  });
40355
40387
  const requestId = response.headers?.["x-wix-request-id"];
40356
- setToolBiParams({ requestId, siteId });
40357
40388
  const responseData = await handleWixAPIResponse(response);
40358
40389
  const formatted = formatApiResponse(responseData, maxResponseSize);
40390
+ setToolBiParams({
40391
+ requestId,
40392
+ siteId,
40393
+ returnedRows: formatted.returnedRows,
40394
+ originalLength: formatted.originalLength
40395
+ });
40359
40396
  if (formatted.isError) {
40360
40397
  return {
40361
40398
  content: [
@@ -40494,7 +40531,7 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
40494
40531
  destructiveHint: true,
40495
40532
  openWorldHint: false
40496
40533
  }),
40497
- async ({ url, body, method, reason }, { httpClient: httpClient6 }) => {
40534
+ async ({ url, body, method, reason }, { httpClient: httpClient6, setToolBiParams }) => {
40498
40535
  logger2.log(
40499
40536
  `Calling Wix Account level API: ${url}, reason="${reason}", body: ${JSON.stringify(body)}`
40500
40537
  );
@@ -40523,6 +40560,10 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
40523
40560
  });
40524
40561
  const responseData = await handleWixAPIResponse(response);
40525
40562
  const formatted = formatApiResponse(responseData, maxResponseSize);
40563
+ setToolBiParams({
40564
+ returnedRows: formatted.returnedRows,
40565
+ originalLength: formatted.originalLength
40566
+ });
40526
40567
  if (formatted.isError) {
40527
40568
  return {
40528
40569
  content: [
@@ -49457,7 +49498,6 @@ function listAssetsByProjectId(payload) {
49457
49498
  // src/wixel/constants.ts
49458
49499
  var WIXEL_ASSISTANT_V1_NO_ENTITY_API_BASE_URL = "https://manage.wix.com/";
49459
49500
  var WWW_ASSET_V1_ASSET_API_BASE_URL = "https://manage.wix.com/";
49460
- var HARMONY_SITE_BUILDER_API_BASE_URL = "https://manage.wix.com/";
49461
49501
  var WIXEL_AGENT_EXTERNAL_API_BASE_URL = "https://manage.wix.com/";
49462
49502
  var WIXEL_WIDGET_URI = "ui://widget/wixel-widget.html";
49463
49503
  var WIXEL_ICON_PNG_URL = "https://wixmp-e9a92e1fa066d7bc836e4d31.wixmp.com/logos/wixel-icon-180.png";
@@ -49574,87 +49614,6 @@ async function queryAssets({
49574
49614
  } = await httpClient6.request(listAssetsByProjectId({ projectId }));
49575
49615
  return { assets };
49576
49616
  }
49577
- async function openHeadlessWixelProject({
49578
- accountAuthHeaders,
49579
- apiBaseURL = HARMONY_SITE_BUILDER_API_BASE_URL,
49580
- url,
49581
- userPrompt,
49582
- jobId,
49583
- siteId,
49584
- projectId,
49585
- conversationId,
49586
- withScreenshots,
49587
- useProvidedCookies,
49588
- timeout,
49589
- conductorOverride
49590
- }) {
49591
- const httpClient6 = (0, import_http_client13.createHttpClient)({
49592
- headers: {
49593
- ...COMMON_HEADERS,
49594
- ...accountAuthHeaders,
49595
- ...conductorOverride ? { ...CONDUCTOR_OVERRIDE_HEADERS } : {},
49596
- "Content-Type": "application/json"
49597
- },
49598
- baseURL: apiBaseURL
49599
- });
49600
- const response = await httpClient6.post(
49601
- "/_api/harmony-site-builder/open-wixel-project",
49602
- {
49603
- url,
49604
- userPrompt,
49605
- jobId,
49606
- siteId,
49607
- projectId,
49608
- conversationId,
49609
- withScreenshots,
49610
- useProvidedCookies,
49611
- timeout
49612
- }
49613
- );
49614
- return response.data;
49615
- }
49616
- async function updateHeadlessWixelJob({
49617
- accountAuthHeaders,
49618
- job,
49619
- apiBaseURL = HARMONY_SITE_BUILDER_API_BASE_URL,
49620
- conductorOverride
49621
- }) {
49622
- const httpClient6 = (0, import_http_client13.createHttpClient)({
49623
- headers: {
49624
- ...COMMON_HEADERS,
49625
- ...accountAuthHeaders,
49626
- ...conductorOverride ? { ...CONDUCTOR_OVERRIDE_HEADERS } : {},
49627
- "Content-Type": "application/json"
49628
- },
49629
- baseURL: apiBaseURL
49630
- });
49631
- const response = await httpClient6.post(
49632
- "/_api/harmony-site-builder/update-wixel-job",
49633
- { job }
49634
- );
49635
- return response.data;
49636
- }
49637
- async function pullHeadlessWixelJob({
49638
- accountAuthHeaders,
49639
- apiBaseURL = HARMONY_SITE_BUILDER_API_BASE_URL,
49640
- jobId,
49641
- conductorOverride
49642
- }) {
49643
- const httpClient6 = (0, import_http_client13.createHttpClient)({
49644
- headers: {
49645
- ...COMMON_HEADERS,
49646
- ...accountAuthHeaders,
49647
- ...conductorOverride ? { ...CONDUCTOR_OVERRIDE_HEADERS } : {},
49648
- "Content-Type": "application/json"
49649
- },
49650
- baseURL: apiBaseURL
49651
- });
49652
- const response = await httpClient6.post(
49653
- "/_api/harmony-site-builder/pull-wixel-job",
49654
- { jobId }
49655
- );
49656
- return response.data;
49657
- }
49658
49617
  async function getStylePresetsByIds2({
49659
49618
  siteAuthHeaders,
49660
49619
  stylePresetIds,
@@ -49974,240 +49933,6 @@ function addGetWixelProjectAssetsTool(server, authStrategy, options = {}) {
49974
49933
  );
49975
49934
  }
49976
49935
 
49977
- // src/wixel/update-headless-wixel-job-tool.ts
49978
- var TOOL_NAME5 = "updateHeadlessWixelJob";
49979
- var TOOL_TITLE5 = "Update Headless Wixel Job";
49980
- var TOOL_DESCRIPTION5 = `Update the status and data of a headless Wixel job.`;
49981
- var TOOL_META5 = {
49982
- ui: { visibility: ["app"] }
49983
- };
49984
- var wixelJobStatusSchema = external_exports.enum([
49985
- "STARTED",
49986
- "IN_PROGRESS",
49987
- "COMPLETED",
49988
- "FAILED",
49989
- "CANCELLED"
49990
- ]);
49991
- function addUpdateHeadlessWixelJobTool(server, authStrategy, options = {}) {
49992
- const { getAccountAuthHeaders } = authStrategy;
49993
- vD(
49994
- server,
49995
- TOOL_NAME5,
49996
- {
49997
- title: TOOL_TITLE5,
49998
- description: TOOL_DESCRIPTION5,
49999
- inputSchema: {
50000
- id: external_exports.string().describe("The job ID"),
50001
- status: wixelJobStatusSchema.describe("The job status"),
50002
- userPrompt: external_exports.string().optional().describe("The user prompt for the job"),
50003
- shouldRefresh: external_exports.boolean().optional().describe("Whether the job should refresh"),
50004
- errorMessage: external_exports.string().optional().describe("Error message if the job failed"),
50005
- type: external_exports.string().optional().describe("The type of asset being created"),
50006
- data: external_exports.object({
50007
- siteId: external_exports.string().optional().describe("The site ID"),
50008
- assetId: external_exports.string().optional().describe("The asset ID"),
50009
- projectId: external_exports.string().optional().describe("The project ID"),
50010
- conversationId: external_exports.string().optional().describe("The conversation ID")
50011
- }).optional().describe("Additional job data"),
50012
- userId: external_exports.string().optional().describe("The user ID"),
50013
- accountId: external_exports.string().optional().describe("The account ID")
50014
- },
50015
- annotations: {
50016
- readOnlyHint: false,
50017
- destructiveHint: true,
50018
- openWorldHint: false
50019
- },
50020
- _meta: TOOL_META5
50021
- },
50022
- async (args) => {
50023
- try {
50024
- const accountAuthHeaders = await getAccountAuthHeaders();
50025
- const result = await updateHeadlessWixelJob({
50026
- accountAuthHeaders,
50027
- conductorOverride: options.conductorOverride,
50028
- job: {
50029
- id: args.id,
50030
- status: args.status,
50031
- userPrompt: args.userPrompt,
50032
- shouldRefresh: args.shouldRefresh,
50033
- errorMessage: args.errorMessage,
50034
- type: args.type,
50035
- data: args.data,
50036
- userId: args.userId,
50037
- accountId: args.accountId
50038
- }
50039
- });
50040
- return {
50041
- isError: false,
50042
- content: [
50043
- {
50044
- type: "text",
50045
- text: `Headless Wixel job ${args.id} updated to status: ${args.status}`
50046
- }
50047
- ],
50048
- structuredContent: {
50049
- jobId: args.id,
50050
- status: args.status,
50051
- ...result
50052
- }
50053
- };
50054
- } catch (error2) {
50055
- console.error("\u274C Error updating headless Wixel job:", error2);
50056
- const errorMessage = error2.message;
50057
- return {
50058
- isError: true,
50059
- content: [{ type: "text", text: errorMessage }],
50060
- structuredContent: {
50061
- success: false,
50062
- error: errorMessage
50063
- }
50064
- };
50065
- }
50066
- }
50067
- );
50068
- }
50069
-
50070
- // src/wixel/pull-headless-wixel-job-tool.ts
50071
- var TOOL_NAME6 = "pullHeadlessWixelJob";
50072
- var TOOL_TITLE6 = "Pull Headless Wixel Job";
50073
- var TOOL_DESCRIPTION6 = `Pull the next available headless Wixel job.`;
50074
- var TOOL_META6 = {
50075
- ui: { visibility: ["app"] }
50076
- };
50077
- function addPullHeadlessWixelJobTool(server, authStrategy, options = {}) {
50078
- const { getAccountAuthHeaders } = authStrategy;
50079
- vD(
50080
- server,
50081
- TOOL_NAME6,
50082
- {
50083
- title: TOOL_TITLE6,
50084
- description: TOOL_DESCRIPTION6,
50085
- inputSchema: {
50086
- jobId: external_exports.string().describe("The job ID")
50087
- },
50088
- annotations: {
50089
- readOnlyHint: false,
50090
- destructiveHint: false,
50091
- openWorldHint: false
50092
- },
50093
- _meta: TOOL_META6
50094
- },
50095
- async (args) => {
50096
- try {
50097
- const accountAuthHeaders = await getAccountAuthHeaders();
50098
- const result = await pullHeadlessWixelJob({
50099
- accountAuthHeaders,
50100
- jobId: args.jobId,
50101
- conductorOverride: options.conductorOverride
50102
- });
50103
- return {
50104
- isError: false,
50105
- content: [
50106
- {
50107
- type: "text",
50108
- text: result.job ? `Pulled headless Wixel job: ${result.job.id}` : "No headless Wixel job available"
50109
- }
50110
- ],
50111
- structuredContent: {
50112
- ...result
50113
- }
50114
- };
50115
- } catch (error2) {
50116
- console.error("\u274C Error pulling headless Wixel job:", error2);
50117
- const errorMessage = error2.message;
50118
- return {
50119
- isError: true,
50120
- content: [{ type: "text", text: errorMessage }],
50121
- structuredContent: {
50122
- success: false,
50123
- error: errorMessage
50124
- }
50125
- };
50126
- }
50127
- }
50128
- );
50129
- }
50130
-
50131
- // src/wixel/open-headless-wixel-project-tool.ts
50132
- var TOOL_NAME7 = "openHeadlessWixelProject";
50133
- var TOOL_TITLE7 = "Open Headless Wixel Project";
50134
- var TOOL_DESCRIPTION7 = `Open a headless Wixel project for background asset generation.`;
50135
- var TOOL_META7 = {
50136
- ui: { visibility: ["app"] }
50137
- };
50138
- function addOpenHeadlessWixelProjectTool(server, authStrategy, options = {}) {
50139
- const { getAccountAuthHeaders } = authStrategy;
50140
- vD(
50141
- server,
50142
- TOOL_NAME7,
50143
- {
50144
- title: TOOL_TITLE7,
50145
- description: TOOL_DESCRIPTION7,
50146
- inputSchema: {
50147
- url: external_exports.string().describe("The URL of the Wixel project"),
50148
- userPrompt: external_exports.string().describe("The user prompt for the project"),
50149
- jobId: external_exports.string().describe("The job ID"),
50150
- siteId: external_exports.string().describe("The site ID"),
50151
- projectId: external_exports.string().describe("The project ID"),
50152
- conversationId: external_exports.string().describe("The conversation ID"),
50153
- withScreenshots: external_exports.boolean().optional().describe("Whether to include screenshots"),
50154
- useProvidedCookies: external_exports.boolean().optional().describe("Whether to use provided cookies"),
50155
- timeout: external_exports.number().optional().describe("Timeout in milliseconds")
50156
- },
50157
- annotations: {
50158
- readOnlyHint: false,
50159
- destructiveHint: true,
50160
- openWorldHint: false
50161
- },
50162
- _meta: TOOL_META7
50163
- },
50164
- async (args) => {
50165
- try {
50166
- const accountAuthHeaders = await getAccountAuthHeaders();
50167
- const result = await openHeadlessWixelProject({
50168
- accountAuthHeaders,
50169
- url: args.url,
50170
- userPrompt: args.userPrompt,
50171
- jobId: args.jobId,
50172
- siteId: args.siteId,
50173
- projectId: args.projectId,
50174
- conversationId: args.conversationId,
50175
- withScreenshots: args.withScreenshots,
50176
- useProvidedCookies: args.useProvidedCookies,
50177
- timeout: args.timeout,
50178
- conductorOverride: options.conductorOverride
50179
- });
50180
- return {
50181
- isError: false,
50182
- content: [
50183
- {
50184
- type: "text",
50185
- text: `Headless Wixel project opened for job ${args.jobId}`
50186
- }
50187
- ],
50188
- structuredContent: {
50189
- success: true,
50190
- jobId: args.jobId,
50191
- projectId: args.projectId,
50192
- ...result
50193
- }
50194
- };
50195
- } catch (error2) {
50196
- console.error("\u274C Error opening headless Wixel project:", error2);
50197
- const errorMessage = error2.message;
50198
- return {
50199
- isError: true,
50200
- content: [{ type: "text", text: errorMessage }],
50201
- structuredContent: {
50202
- success: false,
50203
- error: errorMessage
50204
- }
50205
- };
50206
- }
50207
- }
50208
- );
50209
- }
50210
-
50211
49936
  // src/wixel/external-agent-api.ts
50212
49937
  var import_http_client14 = __toESM(require_index_node2(), 1);
50213
49938
 
@@ -50549,7 +50274,7 @@ async function getWixelPendingQuestion({
50549
50274
  }
50550
50275
 
50551
50276
  // src/wixel/wixel-session-tools.ts
50552
- var TOOL_META8 = {
50277
+ var TOOL_META5 = {
50553
50278
  ui: { visibility: ["app", "model"] }
50554
50279
  };
50555
50280
  function buildWixelEditorUrl(metaSiteId, projectId) {
@@ -50858,7 +50583,7 @@ Without arguments Wixel provisions a new project and session. Pass metaSiteId to
50858
50583
  destructiveHint: false,
50859
50584
  openWorldHint: false
50860
50585
  },
50861
- _meta: TOOL_META8
50586
+ _meta: TOOL_META5
50862
50587
  },
50863
50588
  async (args, extra) => {
50864
50589
  setWixelToolBi(extra, {
@@ -50952,7 +50677,7 @@ Send the user's request as THEY phrased it. Do NOT add creative direction they d
50952
50677
  destructiveHint: true,
50953
50678
  openWorldHint: false
50954
50679
  },
50955
- _meta: TOOL_META8
50680
+ _meta: TOOL_META5
50956
50681
  },
50957
50682
  async (args, extra) => {
50958
50683
  setWixelToolBi(extra, {
@@ -51053,7 +50778,7 @@ Event types: "reply" (the agent's answer), "failed" (the turn failed), and "user
51053
50778
  destructiveHint: false,
51054
50779
  openWorldHint: false
51055
50780
  },
51056
- _meta: TOOL_META8
50781
+ _meta: TOOL_META5
51057
50782
  },
51058
50783
  async (args, extra) => {
51059
50784
  setWixelToolBi(extra, {
@@ -51223,7 +50948,7 @@ function addGetWixelStylePresetsTool(server, authStrategy, options = {}) {
51223
50948
  destructiveHint: false,
51224
50949
  openWorldHint: false
51225
50950
  },
51226
- _meta: TOOL_META8
50951
+ _meta: TOOL_META5
51227
50952
  },
51228
50953
  async (args, extra) => {
51229
50954
  setWixelToolBi(extra, { siteId: args.metaSiteId });
@@ -51526,9 +51251,6 @@ function addWixelTools(server, authStrategy, options = {}) {
51526
51251
  addMarkWixelJobAsFulfilledTool(server, authStrategy, options);
51527
51252
  addGetWixelAssetTool(server, authStrategy, options);
51528
51253
  addGetWixelProjectAssetsTool(server, authStrategy, options);
51529
- addUpdateHeadlessWixelJobTool(server, authStrategy, options);
51530
- addOpenHeadlessWixelProjectTool(server, authStrategy, options);
51531
- addPullHeadlessWixelJobTool(server, authStrategy, options);
51532
51254
  addWixelSessionTools(server, authStrategy, options);
51533
51255
  }
51534
51256
 
@@ -51968,10 +51690,13 @@ function executeTextResult(message) {
51968
51690
  content: [{ type: "text", text: message }]
51969
51691
  };
51970
51692
  }
51971
- function formatExecuteResult(data, maxResponseSize) {
51693
+ function formatExecuteResult(data, maxResponseSize, reportBi) {
51972
51694
  if (data.error) {
51973
51695
  return executeErrorResult(data.error);
51974
51696
  }
51697
+ reportBi?.({
51698
+ originalLength: typeof data.result === "string" ? data.result.length : JSON.stringify(data.result)?.length
51699
+ });
51975
51700
  return {
51976
51701
  content: [
51977
51702
  { type: "text", text: truncateResponse(data.result, maxResponseSize) }
@@ -52081,7 +51806,11 @@ function addExecuteTool(server, options) {
52081
51806
  status: data.authErrorStatus
52082
51807
  });
52083
51808
  }
52084
- return formatExecuteResult(data, maxResponseSize);
51809
+ return formatExecuteResult(
51810
+ data,
51811
+ maxResponseSize,
51812
+ extra?.setToolBiParams
51813
+ );
52085
51814
  } catch (err) {
52086
51815
  const message = err instanceof Error ? err.message : String(err);
52087
51816
  logger2.log(
@@ -52326,7 +52055,10 @@ function createWixToolkit(options) {
52326
52055
  if (!toolSucceeded) {
52327
52056
  errorBody = extractText(cbResult);
52328
52057
  } else {
52329
- additionalFields = formatToolResultAdditionalFields(cbResult);
52058
+ additionalFields = formatToolResultAdditionalFields(cbResult, {
52059
+ returnedRows: toolBiParams.returnedRows,
52060
+ originalLength: toolBiParams.originalLength
52061
+ });
52330
52062
  }
52331
52063
  if (!isDevEnvironment) {
52332
52064
  if (toolSucceeded) {
@@ -52485,8 +52217,6 @@ function createWixToolkit(options) {
52485
52217
  addImportClaudeDesignTool,
52486
52218
  addListWixelEventsTool,
52487
52219
  addMarkWixelJobAsFulfilledTool,
52488
- addOpenHeadlessWixelProjectTool,
52489
- addPullHeadlessWixelJobTool,
52490
52220
  addPullSiteJobTool,
52491
52221
  addSearchCodeModeTool,
52492
52222
  addSearchSiteTemplatesTool,
@@ -52494,7 +52224,6 @@ function createWixToolkit(options) {
52494
52224
  addSiteCreationWidgetTools,
52495
52225
  addStartWixelSessionTool,
52496
52226
  addSupportTool,
52497
- addUpdateHeadlessWixelJobTool,
52498
52227
  addWixSiteCreationTool,
52499
52228
  addWixelSessionTools,
52500
52229
  addWixelTools,