@wix/mcp 1.0.74 → 1.0.76

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 (283) hide show
  1. package/build/bin-standalone.js +83500 -12272
  2. package/build/cjs/index.cjs +41 -14
  3. package/build/cjs/toolkit.cjs +41 -14
  4. package/build/dts/docs/searchFormatting.d.ts +1 -0
  5. package/build/dts/docs/searchFormatting.js +49 -14
  6. package/build/dts/index.d.ts +1 -0
  7. package/build/dts/index.js +0 -1
  8. package/build/dts/infra/tool-bi.d.ts +4 -4
  9. package/build/dts/infra/tool-bi.js +1 -1
  10. package/build/dts/toolkit-entry.d.cts +410 -0
  11. package/build/dts/toolkit-entry.d.ts +409 -19
  12. package/build/dts/toolkit-entry.js +0 -1
  13. package/build/dts/toolkit-types.d.ts +31 -0
  14. package/build/dts/toolkit-types.js +12 -0
  15. package/build/dts/toolkit.d.ts +5 -5
  16. package/build/esm/index.js +41 -14
  17. package/build/esm/toolkit.js +41 -14
  18. package/package.json +26 -19
  19. package/build/bin-standalone.js.map +0 -7
  20. package/build/cjs/index.cjs.map +0 -7
  21. package/build/cjs/toolkit.cjs.map +0 -7
  22. package/build/dts/api-call/index.d.ts.map +0 -1
  23. package/build/dts/api-call/index.js.map +0 -1
  24. package/build/dts/api-call/upload-image-tool.d.ts.map +0 -1
  25. package/build/dts/api-call/upload-image-tool.js.map +0 -1
  26. package/build/dts/api-call/upload-image-tool.test.d.ts +0 -2
  27. package/build/dts/api-call/upload-image-tool.test.d.ts.map +0 -1
  28. package/build/dts/api-call/upload-image-tool.test.js +0 -217
  29. package/build/dts/api-call/upload-image-tool.test.js.map +0 -1
  30. package/build/dts/api-call/upload-image-utils.d.ts.map +0 -1
  31. package/build/dts/api-call/upload-image-utils.js.map +0 -1
  32. package/build/dts/api-call/upload-image-utils.test.d.ts +0 -2
  33. package/build/dts/api-call/upload-image-utils.test.d.ts.map +0 -1
  34. package/build/dts/api-call/upload-image-utils.test.js +0 -121
  35. package/build/dts/api-call/upload-image-utils.test.js.map +0 -1
  36. package/build/dts/api-call/validation.d.ts.map +0 -1
  37. package/build/dts/api-call/validation.js.map +0 -1
  38. package/build/dts/api-call/validation.test.d.ts +0 -2
  39. package/build/dts/api-call/validation.test.d.ts.map +0 -1
  40. package/build/dts/api-call/validation.test.js +0 -42
  41. package/build/dts/api-call/validation.test.js.map +0 -1
  42. package/build/dts/auth/auth-error-handling.test.d.ts +0 -2
  43. package/build/dts/auth/auth-error-handling.test.d.ts.map +0 -1
  44. package/build/dts/auth/auth-error-handling.test.js +0 -347
  45. package/build/dts/auth/auth-error-handling.test.js.map +0 -1
  46. package/build/dts/auth/index.d.ts.map +0 -1
  47. package/build/dts/auth/index.js.map +0 -1
  48. package/build/dts/bin.d.ts.map +0 -1
  49. package/build/dts/bin.js.map +0 -1
  50. package/build/dts/cli-tools/account-auth-strategy.d.ts.map +0 -1
  51. package/build/dts/cli-tools/account-auth-strategy.js.map +0 -1
  52. package/build/dts/cli-tools/account-token-store.d.ts.map +0 -1
  53. package/build/dts/cli-tools/account-token-store.js.map +0 -1
  54. package/build/dts/cli-tools/cli.d.ts.map +0 -1
  55. package/build/dts/cli-tools/cli.js.map +0 -1
  56. package/build/dts/cli-tools/utils.d.ts.map +0 -1
  57. package/build/dts/cli-tools/utils.js.map +0 -1
  58. package/build/dts/code-mode/index.d.ts.map +0 -1
  59. package/build/dts/code-mode/index.js.map +0 -1
  60. package/build/dts/code-mode/index.test.d.ts +0 -2
  61. package/build/dts/code-mode/index.test.d.ts.map +0 -1
  62. package/build/dts/code-mode/index.test.js +0 -342
  63. package/build/dts/code-mode/index.test.js.map +0 -1
  64. package/build/dts/code-mode/truncate-response.d.ts.map +0 -1
  65. package/build/dts/code-mode/truncate-response.js.map +0 -1
  66. package/build/dts/code-mode/truncate-response.test.d.ts +0 -2
  67. package/build/dts/code-mode/truncate-response.test.d.ts.map +0 -1
  68. package/build/dts/code-mode/truncate-response.test.js +0 -32
  69. package/build/dts/code-mode/truncate-response.test.js.map +0 -1
  70. package/build/dts/code-mode/validation.d.ts.map +0 -1
  71. package/build/dts/code-mode/validation.js.map +0 -1
  72. package/build/dts/code-mode/validation.test.d.ts +0 -2
  73. package/build/dts/code-mode/validation.test.d.ts.map +0 -1
  74. package/build/dts/code-mode/validation.test.js +0 -72
  75. package/build/dts/code-mode/validation.test.js.map +0 -1
  76. package/build/dts/config/default-config.bulk-preference.test.d.ts +0 -2
  77. package/build/dts/config/default-config.bulk-preference.test.d.ts.map +0 -1
  78. package/build/dts/config/default-config.bulk-preference.test.js +0 -42
  79. package/build/dts/config/default-config.bulk-preference.test.js.map +0 -1
  80. package/build/dts/config/default-config.d.ts.map +0 -1
  81. package/build/dts/config/default-config.execute-orchestration.test.d.ts +0 -2
  82. package/build/dts/config/default-config.execute-orchestration.test.d.ts.map +0 -1
  83. package/build/dts/config/default-config.execute-orchestration.test.js +0 -40
  84. package/build/dts/config/default-config.execute-orchestration.test.js.map +0 -1
  85. package/build/dts/config/default-config.js.map +0 -1
  86. package/build/dts/config/default-config.readme.test.d.ts +0 -2
  87. package/build/dts/config/default-config.readme.test.d.ts.map +0 -1
  88. package/build/dts/config/default-config.readme.test.js +0 -84
  89. package/build/dts/config/default-config.readme.test.js.map +0 -1
  90. package/build/dts/config/default-config.searchspec-goal.test.d.ts +0 -2
  91. package/build/dts/config/default-config.searchspec-goal.test.d.ts.map +0 -1
  92. package/build/dts/config/default-config.searchspec-goal.test.js +0 -30
  93. package/build/dts/config/default-config.searchspec-goal.test.js.map +0 -1
  94. package/build/dts/config/param-descriptions.d.ts.map +0 -1
  95. package/build/dts/config/param-descriptions.js.map +0 -1
  96. package/build/dts/constants.d.ts.map +0 -1
  97. package/build/dts/constants.js.map +0 -1
  98. package/build/dts/docs/browse-menu.d.ts.map +0 -1
  99. package/build/dts/docs/browse-menu.js.map +0 -1
  100. package/build/dts/docs/browse-menu.test.d.ts +0 -2
  101. package/build/dts/docs/browse-menu.test.d.ts.map +0 -1
  102. package/build/dts/docs/browse-menu.test.js +0 -66
  103. package/build/dts/docs/browse-menu.test.js.map +0 -1
  104. package/build/dts/docs/browse-tool.test.d.ts +0 -2
  105. package/build/dts/docs/browse-tool.test.d.ts.map +0 -1
  106. package/build/dts/docs/browse-tool.test.js +0 -77
  107. package/build/dts/docs/browse-tool.test.js.map +0 -1
  108. package/build/dts/docs/create-site-guide.d.ts.map +0 -1
  109. package/build/dts/docs/create-site-guide.js.map +0 -1
  110. package/build/dts/docs/docs.d.ts.map +0 -1
  111. package/build/dts/docs/docs.js.map +0 -1
  112. package/build/dts/docs/fetch-article.d.ts.map +0 -1
  113. package/build/dts/docs/fetch-article.js.map +0 -1
  114. package/build/dts/docs/fetch-article.test.d.ts +0 -2
  115. package/build/dts/docs/fetch-article.test.d.ts.map +0 -1
  116. package/build/dts/docs/fetch-article.test.js +0 -93
  117. package/build/dts/docs/fetch-article.test.js.map +0 -1
  118. package/build/dts/docs/fetch-skills.d.ts.map +0 -1
  119. package/build/dts/docs/fetch-skills.js.map +0 -1
  120. package/build/dts/docs/fetch-skills.test.d.ts +0 -2
  121. package/build/dts/docs/fetch-skills.test.d.ts.map +0 -1
  122. package/build/dts/docs/fetch-skills.test.js +0 -140
  123. package/build/dts/docs/fetch-skills.test.js.map +0 -1
  124. package/build/dts/docs/get-to-know.d.ts.map +0 -1
  125. package/build/dts/docs/get-to-know.js.map +0 -1
  126. package/build/dts/docs/get-to-know.test.d.ts +0 -2
  127. package/build/dts/docs/get-to-know.test.d.ts.map +0 -1
  128. package/build/dts/docs/get-to-know.test.js +0 -152
  129. package/build/dts/docs/get-to-know.test.js.map +0 -1
  130. package/build/dts/docs/long-content.d.ts.map +0 -1
  131. package/build/dts/docs/long-content.js.map +0 -1
  132. package/build/dts/docs/normalize-menu-content.d.ts.map +0 -1
  133. package/build/dts/docs/normalize-menu-content.js.map +0 -1
  134. package/build/dts/docs/searchFormatting.d.ts.map +0 -1
  135. package/build/dts/docs/searchFormatting.js.map +0 -1
  136. package/build/dts/docs/searchFormatting.test.d.ts +0 -2
  137. package/build/dts/docs/searchFormatting.test.d.ts.map +0 -1
  138. package/build/dts/docs/searchFormatting.test.js +0 -39
  139. package/build/dts/docs/searchFormatting.test.js.map +0 -1
  140. package/build/dts/docs/semanticSearch.d.ts.map +0 -1
  141. package/build/dts/docs/semanticSearch.js.map +0 -1
  142. package/build/dts/docs/semanticSearch.test.d.ts +0 -2
  143. package/build/dts/docs/semanticSearch.test.d.ts.map +0 -1
  144. package/build/dts/docs/semanticSearch.test.js +0 -923
  145. package/build/dts/docs/semanticSearch.test.js.map +0 -1
  146. package/build/dts/docs/velo-readme.d.ts.map +0 -1
  147. package/build/dts/docs/velo-readme.js.map +0 -1
  148. package/build/dts/import-claude-design-tool/banner.d.ts.map +0 -1
  149. package/build/dts/import-claude-design-tool/banner.js.map +0 -1
  150. package/build/dts/import-claude-design-tool/constants.d.ts.map +0 -1
  151. package/build/dts/import-claude-design-tool/constants.js.map +0 -1
  152. package/build/dts/import-claude-design-tool/index.d.ts.map +0 -1
  153. package/build/dts/import-claude-design-tool/index.js.map +0 -1
  154. package/build/dts/import-claude-design-tool/index.test.d.ts +0 -2
  155. package/build/dts/import-claude-design-tool/index.test.d.ts.map +0 -1
  156. package/build/dts/import-claude-design-tool/index.test.js +0 -329
  157. package/build/dts/import-claude-design-tool/index.test.js.map +0 -1
  158. package/build/dts/import-claude-design-tool/sanitize.d.ts.map +0 -1
  159. package/build/dts/import-claude-design-tool/sanitize.js.map +0 -1
  160. package/build/dts/import-claude-design-tool/wixstro-client.d.ts.map +0 -1
  161. package/build/dts/import-claude-design-tool/wixstro-client.js.map +0 -1
  162. package/build/dts/index.d.ts.map +0 -1
  163. package/build/dts/index.js.map +0 -1
  164. package/build/dts/infra/bi-logger.d.ts.map +0 -1
  165. package/build/dts/infra/bi-logger.js.map +0 -1
  166. package/build/dts/infra/environment.d.ts.map +0 -1
  167. package/build/dts/infra/environment.js.map +0 -1
  168. package/build/dts/infra/file-logger.d.ts.map +0 -1
  169. package/build/dts/infra/file-logger.js.map +0 -1
  170. package/build/dts/infra/logger.d.ts.map +0 -1
  171. package/build/dts/infra/logger.js.map +0 -1
  172. package/build/dts/infra/panorama.d.ts.map +0 -1
  173. package/build/dts/infra/panorama.js.map +0 -1
  174. package/build/dts/infra/response-size-limits.d.ts.map +0 -1
  175. package/build/dts/infra/response-size-limits.js.map +0 -1
  176. package/build/dts/infra/sentry.d.ts.map +0 -1
  177. package/build/dts/infra/sentry.js.map +0 -1
  178. package/build/dts/infra/tool-bi.d.ts.map +0 -1
  179. package/build/dts/infra/tool-bi.js.map +0 -1
  180. package/build/dts/infra/widget-payload.d.ts.map +0 -1
  181. package/build/dts/infra/widget-payload.js.map +0 -1
  182. package/build/dts/resources/docs.d.ts.map +0 -1
  183. package/build/dts/resources/docs.js.map +0 -1
  184. package/build/dts/site-widget-tools/claim-site-tool/index.d.ts.map +0 -1
  185. package/build/dts/site-widget-tools/claim-site-tool/index.js.map +0 -1
  186. package/build/dts/site-widget-tools/constants.d.ts.map +0 -1
  187. package/build/dts/site-widget-tools/constants.js.map +0 -1
  188. package/build/dts/site-widget-tools/create-site-from-template-tool/index.d.ts.map +0 -1
  189. package/build/dts/site-widget-tools/create-site-from-template-tool/index.js.map +0 -1
  190. package/build/dts/site-widget-tools/edit-site-tool/index.d.ts.map +0 -1
  191. package/build/dts/site-widget-tools/edit-site-tool/index.js.map +0 -1
  192. package/build/dts/site-widget-tools/index.d.ts.map +0 -1
  193. package/build/dts/site-widget-tools/index.js.map +0 -1
  194. package/build/dts/site-widget-tools/pull-site-creation-job-tool/index.d.ts.map +0 -1
  195. package/build/dts/site-widget-tools/pull-site-creation-job-tool/index.js.map +0 -1
  196. package/build/dts/site-widget-tools/search-site-templates-tool/index.d.ts.map +0 -1
  197. package/build/dts/site-widget-tools/search-site-templates-tool/index.js.map +0 -1
  198. package/build/dts/site-widget-tools/site-builder-tool/index.d.ts.map +0 -1
  199. package/build/dts/site-widget-tools/site-builder-tool/index.js.map +0 -1
  200. package/build/dts/site-widget-tools/site-builder-tool/index.test.d.ts +0 -2
  201. package/build/dts/site-widget-tools/site-builder-tool/index.test.d.ts.map +0 -1
  202. package/build/dts/site-widget-tools/site-builder-tool/index.test.js +0 -46
  203. package/build/dts/site-widget-tools/site-builder-tool/index.test.js.map +0 -1
  204. package/build/dts/site-widget-tools/site-creation-tool/index.d.ts.map +0 -1
  205. package/build/dts/site-widget-tools/site-creation-tool/index.js.map +0 -1
  206. package/build/dts/site-widget-tools/site-creation-tool/index.test.d.ts +0 -2
  207. package/build/dts/site-widget-tools/site-creation-tool/index.test.d.ts.map +0 -1
  208. package/build/dts/site-widget-tools/site-creation-tool/index.test.js +0 -57
  209. package/build/dts/site-widget-tools/site-creation-tool/index.test.js.map +0 -1
  210. package/build/dts/site-widget-tools/suggested-domain-tool/index.d.ts.map +0 -1
  211. package/build/dts/site-widget-tools/suggested-domain-tool/index.js.map +0 -1
  212. package/build/dts/site-widget-tools/types.d.ts.map +0 -1
  213. package/build/dts/site-widget-tools/types.js.map +0 -1
  214. package/build/dts/site-widget-tools/utils.d.ts.map +0 -1
  215. package/build/dts/site-widget-tools/utils.js.map +0 -1
  216. package/build/dts/support/index.d.ts.map +0 -1
  217. package/build/dts/support/index.js.map +0 -1
  218. package/build/dts/tool-bi-reporting.test.d.ts +0 -2
  219. package/build/dts/tool-bi-reporting.test.d.ts.map +0 -1
  220. package/build/dts/tool-bi-reporting.test.js +0 -219
  221. package/build/dts/tool-bi-reporting.test.js.map +0 -1
  222. package/build/dts/tool-utils.d.ts.map +0 -1
  223. package/build/dts/tool-utils.js.map +0 -1
  224. package/build/dts/tool-utils.spec.d.ts +0 -2
  225. package/build/dts/tool-utils.spec.d.ts.map +0 -1
  226. package/build/dts/tool-utils.spec.js +0 -98
  227. package/build/dts/tool-utils.spec.js.map +0 -1
  228. package/build/dts/toolkit-entry.d.ts.map +0 -1
  229. package/build/dts/toolkit-entry.js.map +0 -1
  230. package/build/dts/toolkit-json-schema.test.d.ts +0 -2
  231. package/build/dts/toolkit-json-schema.test.d.ts.map +0 -1
  232. package/build/dts/toolkit-json-schema.test.js +0 -36
  233. package/build/dts/toolkit-json-schema.test.js.map +0 -1
  234. package/build/dts/toolkit.d.ts.map +0 -1
  235. package/build/dts/toolkit.js.map +0 -1
  236. package/build/dts/toolkit.test.d.ts +0 -2
  237. package/build/dts/toolkit.test.d.ts.map +0 -1
  238. package/build/dts/toolkit.test.js +0 -691
  239. package/build/dts/toolkit.test.js.map +0 -1
  240. package/build/dts/widget-manifest.d.ts.map +0 -1
  241. package/build/dts/widget-manifest.js.map +0 -1
  242. package/build/dts/wix-fetch-error.d.ts.map +0 -1
  243. package/build/dts/wix-fetch-error.js.map +0 -1
  244. package/build/dts/wix-mcp-server.d.ts.map +0 -1
  245. package/build/dts/wix-mcp-server.js.map +0 -1
  246. package/build/dts/wixel/api.d.ts.map +0 -1
  247. package/build/dts/wixel/api.js.map +0 -1
  248. package/build/dts/wixel/constants.d.ts.map +0 -1
  249. package/build/dts/wixel/constants.js.map +0 -1
  250. package/build/dts/wixel/external-agent-api.d.ts.map +0 -1
  251. package/build/dts/wixel/external-agent-api.js.map +0 -1
  252. package/build/dts/wixel/get-wixel-asset-tool.d.ts.map +0 -1
  253. package/build/dts/wixel/get-wixel-asset-tool.js.map +0 -1
  254. package/build/dts/wixel/get-wixel-job-status-tool.d.ts.map +0 -1
  255. package/build/dts/wixel/get-wixel-job-status-tool.js.map +0 -1
  256. package/build/dts/wixel/get-wixel-project-assets-tool.d.ts.map +0 -1
  257. package/build/dts/wixel/get-wixel-project-assets-tool.js.map +0 -1
  258. package/build/dts/wixel/index.d.ts.map +0 -1
  259. package/build/dts/wixel/index.js.map +0 -1
  260. package/build/dts/wixel/mark-wixel-job-as-fulfilled-tool.d.ts.map +0 -1
  261. package/build/dts/wixel/mark-wixel-job-as-fulfilled-tool.js.map +0 -1
  262. package/build/dts/wixel/open-headless-wixel-project-tool.d.ts.map +0 -1
  263. package/build/dts/wixel/open-headless-wixel-project-tool.js.map +0 -1
  264. package/build/dts/wixel/pull-headless-wixel-job-tool.d.ts.map +0 -1
  265. package/build/dts/wixel/pull-headless-wixel-job-tool.js.map +0 -1
  266. package/build/dts/wixel/update-headless-wixel-job-tool.d.ts.map +0 -1
  267. package/build/dts/wixel/update-headless-wixel-job-tool.js.map +0 -1
  268. package/build/dts/wixel/utils.d.ts.map +0 -1
  269. package/build/dts/wixel/utils.js.map +0 -1
  270. package/build/dts/wixel/wixel-bi.d.ts.map +0 -1
  271. package/build/dts/wixel/wixel-bi.js.map +0 -1
  272. package/build/dts/wixel/wixel-bi.test.d.ts +0 -2
  273. package/build/dts/wixel/wixel-bi.test.d.ts.map +0 -1
  274. package/build/dts/wixel/wixel-bi.test.js +0 -35
  275. package/build/dts/wixel/wixel-bi.test.js.map +0 -1
  276. package/build/dts/wixel/wixel-session-tools.d.ts.map +0 -1
  277. package/build/dts/wixel/wixel-session-tools.js.map +0 -1
  278. package/build/dts/wixel/wixel-session-tools.test.d.ts +0 -2
  279. package/build/dts/wixel/wixel-session-tools.test.d.ts.map +0 -1
  280. package/build/dts/wixel/wixel-session-tools.test.js +0 -143
  281. package/build/dts/wixel/wixel-session-tools.test.js.map +0 -1
  282. package/build/esm/index.js.map +0 -7
  283. package/build/esm/toolkit.js.map +0 -7
@@ -36336,26 +36336,54 @@ var getTruncatedResultHint = ({
36336
36336
  ].join("\n");
36337
36337
  };
36338
36338
  var SECTION_DELIMITER_RE = /^--- .+ ---$/;
36339
- var SECTION_LINE_LIMITS = {
36339
+ var SECTION_LINE_FLOORS = {
36340
36340
  first_example: 15,
36341
36341
  response_shape: 15,
36342
36342
  description: 15,
36343
36343
  other: 5
36344
36344
  };
36345
+ var CODE_FENCE_RE = /^(`{3,}|~{3,})/;
36346
+ var findOpenFence = (lines) => {
36347
+ let openFence = null;
36348
+ for (const line of lines) {
36349
+ const match = line.match(CODE_FENCE_RE);
36350
+ if (match) {
36351
+ if (!openFence) {
36352
+ openFence = match[1];
36353
+ } else if (line.trim() === openFence) {
36354
+ openFence = null;
36355
+ }
36356
+ }
36357
+ }
36358
+ return openFence;
36359
+ };
36360
+ var INCOMPLETE_SNIPPET_MARKER = "... snippet cut here \u2014 INCOMPLETE example, do not use as-is; read the full doc for the complete example ...";
36361
+ var truncateLines = (lines, limit) => {
36362
+ const kept = lines.slice(0, limit);
36363
+ const moreCount = lines.length - kept.length;
36364
+ const openFence = findOpenFence(kept);
36365
+ if (!openFence) return { lines: kept, moreCount };
36366
+ return {
36367
+ lines: moreCount > 0 ? [...kept, INCOMPLETE_SNIPPET_MARKER, openFence] : [...kept, openFence],
36368
+ moreCount
36369
+ };
36370
+ };
36345
36371
  var getSectionType = (header, isFirstExample) => {
36346
36372
  if (isFirstExample && /code example/i.test(header)) return "first_example";
36347
36373
  if (/response shape/i.test(header)) return "response_shape";
36348
36374
  if (/description/i.test(header)) return "description";
36349
36375
  return "other";
36350
36376
  };
36351
- var formatMethodContent = (content, sourceUrl, fallbackLineLimit) => {
36377
+ var formatMethodContent = (content, sourceUrl, requestedLineLimit) => {
36352
36378
  const lines = content.split("\n");
36353
36379
  const firstDelimiterIdx = lines.findIndex(
36354
36380
  (line) => SECTION_DELIMITER_RE.test(line)
36355
36381
  );
36356
36382
  if (firstDelimiterIdx === -1) {
36357
- const truncated = lines.slice(0, fallbackLineLimit);
36358
- const moreCount = lines.length - truncated.length;
36383
+ const { lines: truncated, moreCount } = truncateLines(
36384
+ lines,
36385
+ requestedLineLimit
36386
+ );
36359
36387
  const hint2 = sourceUrl ? ["", ...methodHintLines(sourceUrl)].join("\n") : "";
36360
36388
  const suffix = moreCount > 0 ? `
36361
36389
 
@@ -36373,9 +36401,8 @@ var formatMethodContent = (content, sourceUrl, fallbackLineLimit) => {
36373
36401
  if (!currentHeader) return;
36374
36402
  const type = getSectionType(currentHeader, isFirstExample);
36375
36403
  if (type === "first_example") isFirstExample = false;
36376
- const limit = SECTION_LINE_LIMITS[type];
36377
- const truncated = currentLines.slice(0, limit);
36378
- const moreCount = currentLines.length - truncated.length;
36404
+ const limit = Math.max(SECTION_LINE_FLOORS[type], requestedLineLimit);
36405
+ const { lines: truncated, moreCount } = truncateLines(currentLines, limit);
36379
36406
  let out = currentHeader + "\n" + truncated.join("\n");
36380
36407
  if (moreCount > 0) {
36381
36408
  out += `
@@ -36422,21 +36449,21 @@ var formatResultsContent = (resultsFromKbs, maxResults, linesInEachResult = void
36422
36449
  linesInEachResult
36423
36450
  );
36424
36451
  } else {
36425
- const totalLines = newContent.split("\n").length;
36426
- const linesToTake = Math.min(linesInEachResult, totalLines);
36427
- newContent = newContent.split("\n").slice(0, linesToTake).join("\n");
36428
- const moreLines = totalLines - linesToTake;
36429
- const moreLinesText = moreLines > 0 ? [
36452
+ const { lines: truncated, moreCount } = truncateLines(
36453
+ newContent.split("\n"),
36454
+ linesInEachResult
36455
+ );
36456
+ const moreLinesText = moreCount > 0 ? [
36430
36457
  `
36431
36458
 
36432
- ... ${moreLines} more lines ...`,
36459
+ ... ${moreCount} more lines ...`,
36433
36460
  getTruncatedResultHint({
36434
36461
  kbName: result.kbName,
36435
36462
  content: result.entry.content,
36436
36463
  url: sourceUrl
36437
36464
  })
36438
36465
  ].join("") : "";
36439
- newContent = `${newContent}${moreLinesText}`;
36466
+ newContent = `${truncated.join("\n")}${moreLinesText}`;
36440
36467
  }
36441
36468
  }
36442
36469
  return {
@@ -16067,26 +16067,54 @@ var getTruncatedResultHint = ({
16067
16067
  ].join("\n");
16068
16068
  };
16069
16069
  var SECTION_DELIMITER_RE = /^--- .+ ---$/;
16070
- var SECTION_LINE_LIMITS = {
16070
+ var SECTION_LINE_FLOORS = {
16071
16071
  first_example: 15,
16072
16072
  response_shape: 15,
16073
16073
  description: 15,
16074
16074
  other: 5
16075
16075
  };
16076
+ var CODE_FENCE_RE = /^(`{3,}|~{3,})/;
16077
+ var findOpenFence = (lines) => {
16078
+ let openFence = null;
16079
+ for (const line of lines) {
16080
+ const match = line.match(CODE_FENCE_RE);
16081
+ if (match) {
16082
+ if (!openFence) {
16083
+ openFence = match[1];
16084
+ } else if (line.trim() === openFence) {
16085
+ openFence = null;
16086
+ }
16087
+ }
16088
+ }
16089
+ return openFence;
16090
+ };
16091
+ var INCOMPLETE_SNIPPET_MARKER = "... snippet cut here \u2014 INCOMPLETE example, do not use as-is; read the full doc for the complete example ...";
16092
+ var truncateLines = (lines, limit) => {
16093
+ const kept = lines.slice(0, limit);
16094
+ const moreCount = lines.length - kept.length;
16095
+ const openFence = findOpenFence(kept);
16096
+ if (!openFence) return { lines: kept, moreCount };
16097
+ return {
16098
+ lines: moreCount > 0 ? [...kept, INCOMPLETE_SNIPPET_MARKER, openFence] : [...kept, openFence],
16099
+ moreCount
16100
+ };
16101
+ };
16076
16102
  var getSectionType = (header, isFirstExample) => {
16077
16103
  if (isFirstExample && /code example/i.test(header)) return "first_example";
16078
16104
  if (/response shape/i.test(header)) return "response_shape";
16079
16105
  if (/description/i.test(header)) return "description";
16080
16106
  return "other";
16081
16107
  };
16082
- var formatMethodContent = (content, sourceUrl, fallbackLineLimit) => {
16108
+ var formatMethodContent = (content, sourceUrl, requestedLineLimit) => {
16083
16109
  const lines = content.split("\n");
16084
16110
  const firstDelimiterIdx = lines.findIndex(
16085
16111
  (line) => SECTION_DELIMITER_RE.test(line)
16086
16112
  );
16087
16113
  if (firstDelimiterIdx === -1) {
16088
- const truncated = lines.slice(0, fallbackLineLimit);
16089
- const moreCount = lines.length - truncated.length;
16114
+ const { lines: truncated, moreCount } = truncateLines(
16115
+ lines,
16116
+ requestedLineLimit
16117
+ );
16090
16118
  const hint2 = sourceUrl ? ["", ...methodHintLines(sourceUrl)].join("\n") : "";
16091
16119
  const suffix = moreCount > 0 ? `
16092
16120
 
@@ -16104,9 +16132,8 @@ var formatMethodContent = (content, sourceUrl, fallbackLineLimit) => {
16104
16132
  if (!currentHeader) return;
16105
16133
  const type = getSectionType(currentHeader, isFirstExample);
16106
16134
  if (type === "first_example") isFirstExample = false;
16107
- const limit = SECTION_LINE_LIMITS[type];
16108
- const truncated = currentLines.slice(0, limit);
16109
- const moreCount = currentLines.length - truncated.length;
16135
+ const limit = Math.max(SECTION_LINE_FLOORS[type], requestedLineLimit);
16136
+ const { lines: truncated, moreCount } = truncateLines(currentLines, limit);
16110
16137
  let out = currentHeader + "\n" + truncated.join("\n");
16111
16138
  if (moreCount > 0) {
16112
16139
  out += `
@@ -16153,21 +16180,21 @@ var formatResultsContent = (resultsFromKbs, maxResults, linesInEachResult = void
16153
16180
  linesInEachResult
16154
16181
  );
16155
16182
  } else {
16156
- const totalLines = newContent.split("\n").length;
16157
- const linesToTake = Math.min(linesInEachResult, totalLines);
16158
- newContent = newContent.split("\n").slice(0, linesToTake).join("\n");
16159
- const moreLines = totalLines - linesToTake;
16160
- const moreLinesText = moreLines > 0 ? [
16183
+ const { lines: truncated, moreCount } = truncateLines(
16184
+ newContent.split("\n"),
16185
+ linesInEachResult
16186
+ );
16187
+ const moreLinesText = moreCount > 0 ? [
16161
16188
  `
16162
16189
 
16163
- ... ${moreLines} more lines ...`,
16190
+ ... ${moreCount} more lines ...`,
16164
16191
  getTruncatedResultHint({
16165
16192
  kbName: result.kbName,
16166
16193
  content: result.entry.content,
16167
16194
  url: sourceUrl
16168
16195
  })
16169
16196
  ].join("") : "";
16170
- newContent = `${newContent}${moreLinesText}`;
16197
+ newContent = `${truncated.join("\n")}${moreLinesText}`;
16171
16198
  }
16172
16199
  }
16173
16200
  return {
@@ -17,6 +17,7 @@ export type RankedSearchResult = {
17
17
  overallMatchScore: number;
18
18
  };
19
19
  };
20
+ export declare const INCOMPLETE_SNIPPET_MARKER = "... snippet cut here \u2014 INCOMPLETE example, do not use as-is; read the full doc for the complete example ...";
20
21
  export declare const formatResultsContent: (resultsFromKbs: Record<string, {
21
22
  results: Omit<RankedSearchResult, "kbName">[];
22
23
  }>, maxResults: number, linesInEachResult?: number | undefined) => string;
@@ -77,12 +77,52 @@ const getTruncatedResultHint = ({ kbName, content, url }) => {
77
77
  ].join('\n');
78
78
  };
79
79
  const SECTION_DELIMITER_RE = /^--- .+ ---$/;
80
- const SECTION_LINE_LIMITS = {
80
+ // Budget contract (mirrors docs-search-server's format-utils): each section
81
+ // gets up to the caller's requested lines-per-result, but never less than its
82
+ // floor — a tiny budget can't cut the one thing a section exists for, and a
83
+ // larger budget exposes more of every section.
84
+ const SECTION_LINE_FLOORS = {
81
85
  first_example: 15,
82
86
  response_shape: 15,
83
87
  description: 15,
84
88
  other: 5
85
89
  };
90
+ const CODE_FENCE_RE = /^(`{3,}|~{3,})/;
91
+ const findOpenFence = (lines) => {
92
+ let openFence = null;
93
+ for (const line of lines) {
94
+ const match = line.match(CODE_FENCE_RE);
95
+ if (match) {
96
+ if (!openFence) {
97
+ openFence = match[1];
98
+ }
99
+ else if (line.trim() === openFence) {
100
+ openFence = null;
101
+ }
102
+ }
103
+ }
104
+ return openFence;
105
+ };
106
+ // A fence left open by truncation means the snippet inside is NOT the complete
107
+ // example — closing it silently produces a runnable-looking fragment with
108
+ // required inputs missing. Say so inside the fence, where anyone copying the
109
+ // block will see it.
110
+ export const INCOMPLETE_SNIPPET_MARKER = '... snippet cut here — INCOMPLETE example, do not use as-is; read the full doc for the complete example ...';
111
+ const truncateLines = (lines, limit) => {
112
+ const kept = lines.slice(0, limit);
113
+ const moreCount = lines.length - kept.length;
114
+ const openFence = findOpenFence(kept);
115
+ if (!openFence)
116
+ return { lines: kept, moreCount };
117
+ // moreCount > 0 means the cut landed inside the fence; otherwise the source
118
+ // itself left the fence open and it just needs closing.
119
+ return {
120
+ lines: moreCount > 0
121
+ ? [...kept, INCOMPLETE_SNIPPET_MARKER, openFence]
122
+ : [...kept, openFence],
123
+ moreCount
124
+ };
125
+ };
86
126
  const getSectionType = (header, isFirstExample) => {
87
127
  if (isFirstExample && /code example/i.test(header))
88
128
  return 'first_example';
@@ -92,12 +132,11 @@ const getSectionType = (header, isFirstExample) => {
92
132
  return 'description';
93
133
  return 'other';
94
134
  };
95
- const formatMethodContent = (content, sourceUrl, fallbackLineLimit) => {
135
+ const formatMethodContent = (content, sourceUrl, requestedLineLimit) => {
96
136
  const lines = content.split('\n');
97
137
  const firstDelimiterIdx = lines.findIndex((line) => SECTION_DELIMITER_RE.test(line));
98
138
  if (firstDelimiterIdx === -1) {
99
- const truncated = lines.slice(0, fallbackLineLimit);
100
- const moreCount = lines.length - truncated.length;
139
+ const { lines: truncated, moreCount } = truncateLines(lines, requestedLineLimit);
101
140
  const hint = sourceUrl
102
141
  ? ['', ...methodHintLines(sourceUrl)].join('\n')
103
142
  : '';
@@ -117,9 +156,8 @@ const formatMethodContent = (content, sourceUrl, fallbackLineLimit) => {
117
156
  const type = getSectionType(currentHeader, isFirstExample);
118
157
  if (type === 'first_example')
119
158
  isFirstExample = false;
120
- const limit = SECTION_LINE_LIMITS[type];
121
- const truncated = currentLines.slice(0, limit);
122
- const moreCount = currentLines.length - truncated.length;
159
+ const limit = Math.max(SECTION_LINE_FLOORS[type], requestedLineLimit);
160
+ const { lines: truncated, moreCount } = truncateLines(currentLines, limit);
123
161
  let out = currentHeader + '\n' + truncated.join('\n');
124
162
  if (moreCount > 0) {
125
163
  out += `\n\n... ${moreCount} more lines ...`;
@@ -156,13 +194,10 @@ export const formatResultsContent = (resultsFromKbs, maxResults, linesInEachResu
156
194
  newContent = formatMethodContent(newContent, sourceUrl, linesInEachResult);
157
195
  }
158
196
  else {
159
- const totalLines = newContent.split('\n').length;
160
- const linesToTake = Math.min(linesInEachResult, totalLines);
161
- newContent = newContent.split('\n').slice(0, linesToTake).join('\n');
162
- const moreLines = totalLines - linesToTake;
163
- const moreLinesText = moreLines > 0
197
+ const { lines: truncated, moreCount } = truncateLines(newContent.split('\n'), linesInEachResult);
198
+ const moreLinesText = moreCount > 0
164
199
  ? [
165
- `\n\n... ${moreLines} more lines ...`,
200
+ `\n\n... ${moreCount} more lines ...`,
166
201
  getTruncatedResultHint({
167
202
  kbName: result.kbName,
168
203
  content: result.entry.content,
@@ -170,7 +205,7 @@ export const formatResultsContent = (resultsFromKbs, maxResults, linesInEachResu
170
205
  })
171
206
  ].join('')
172
207
  : '';
173
- newContent = `${newContent}${moreLinesText}`;
208
+ newContent = `${truncated.join('\n')}${moreLinesText}`;
174
209
  }
175
210
  }
176
211
  return {
@@ -16,6 +16,7 @@ export type { Logger } from './infra/logger.js';
16
16
  export { attachConsoleLogger } from './infra/logger.js';
17
17
  export { createBiLogger } from './infra/bi-logger.js';
18
18
  export { createToolBiEvent, createExecuteWixAPICallToolBiEvent } from './infra/tool-bi.js';
19
+ export type { WixToolCallResult, WixToolContentBlock, WixToolAnnotations } from './toolkit-types.js';
19
20
  export { createWixToolkit, extractText, type WixTool, type WixToolkit, type WixToolkitOptions, type WixToolkitHooks, type WixToolkitAuth, type WixToolkitDocsConfig, type WixToolkitApiConfig } from './toolkit.js';
20
21
  export { fetchRecipesIndex, fetchArticle, RECIPES_INDEX_URL } from './docs/fetch-article.js';
21
22
  export { generateDocsNavigationTree, fetchMenuContent, MENU_CONTENT_THRESHOLD, normalizeMenuContent, summarizeLargeMenu, parseDirectChildren } from './docs/normalize-menu-content.js';
@@ -18,7 +18,6 @@ export { attachConsoleLogger } from './infra/logger.js';
18
18
  // logger defaults instead of wiring their own.
19
19
  export { createBiLogger } from './infra/bi-logger.js';
20
20
  export { createToolBiEvent, createExecuteWixAPICallToolBiEvent } from './infra/tool-bi.js';
21
- // Toolkit exports
22
21
  export { createWixToolkit, extractText } from './toolkit.js';
23
22
  // Docs fetch utilities
24
23
  export { fetchRecipesIndex, fetchArticle, RECIPES_INDEX_URL } from './docs/fetch-article.js';
@@ -1,12 +1,12 @@
1
- import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
1
+ import type { WixToolCallResult } from '../toolkit-types.js';
2
2
  import { wixMcpRequestSrc39Evid1607, executeWixApiToolRequestSrc39Evid1612 } from '@wix/bi-logger-api-infra-data/v2';
3
3
  /**
4
- * Safely extract all text content from a CallToolResult.
4
+ * Safely extract all text content from a WixToolCallResult.
5
5
  * Filters out non-text content blocks (images, audio, resources)
6
6
  * and concatenates text blocks with newlines.
7
7
  */
8
- export declare function extractText(result: CallToolResult): string;
9
- export declare function formatToolResultAdditionalFields(result: CallToolResult): string | undefined;
8
+ export declare function extractText(result: WixToolCallResult): string;
9
+ export declare function formatToolResultAdditionalFields(result: WixToolCallResult): string | undefined;
10
10
  export declare function createToolBiEvent(params: Parameters<typeof wixMcpRequestSrc39Evid1607>[0]): import("@wix/bi-logger-api-infra-data/v2/types").LogObject<import("@wix/bi-logger-api-infra-data/v2/types").wixMcpRequestSrc39Evid1607Params>;
11
11
  export declare function createExecuteWixAPICallToolBiEvent(params: Parameters<typeof executeWixApiToolRequestSrc39Evid1612>[0]): import("@wix/bi-logger-api-infra-data/v2/types").LogObject<import("@wix/bi-logger-api-infra-data/v2/types").executeWixApiToolRequestSrc39Evid1612Params>;
12
12
  //# sourceMappingURL=tool-bi.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { wixMcpRequestSrc39Evid1607, executeWixApiToolRequestSrc39Evid1612 } from '@wix/bi-logger-api-infra-data/v2';
2
2
  /**
3
- * Safely extract all text content from a CallToolResult.
3
+ * Safely extract all text content from a WixToolCallResult.
4
4
  * Filters out non-text content blocks (images, audio, resources)
5
5
  * and concatenates text blocks with newlines.
6
6
  */