@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.
- package/build/bin-standalone.js +83500 -12272
- package/build/cjs/index.cjs +41 -14
- package/build/cjs/toolkit.cjs +41 -14
- package/build/dts/docs/searchFormatting.d.ts +1 -0
- package/build/dts/docs/searchFormatting.js +49 -14
- package/build/dts/index.d.ts +1 -0
- package/build/dts/index.js +0 -1
- package/build/dts/infra/tool-bi.d.ts +4 -4
- package/build/dts/infra/tool-bi.js +1 -1
- package/build/dts/toolkit-entry.d.cts +410 -0
- package/build/dts/toolkit-entry.d.ts +409 -19
- package/build/dts/toolkit-entry.js +0 -1
- package/build/dts/toolkit-types.d.ts +31 -0
- package/build/dts/toolkit-types.js +12 -0
- package/build/dts/toolkit.d.ts +5 -5
- package/build/esm/index.js +41 -14
- package/build/esm/toolkit.js +41 -14
- package/package.json +26 -19
- package/build/bin-standalone.js.map +0 -7
- package/build/cjs/index.cjs.map +0 -7
- package/build/cjs/toolkit.cjs.map +0 -7
- package/build/dts/api-call/index.d.ts.map +0 -1
- package/build/dts/api-call/index.js.map +0 -1
- package/build/dts/api-call/upload-image-tool.d.ts.map +0 -1
- package/build/dts/api-call/upload-image-tool.js.map +0 -1
- package/build/dts/api-call/upload-image-tool.test.d.ts +0 -2
- package/build/dts/api-call/upload-image-tool.test.d.ts.map +0 -1
- package/build/dts/api-call/upload-image-tool.test.js +0 -217
- package/build/dts/api-call/upload-image-tool.test.js.map +0 -1
- package/build/dts/api-call/upload-image-utils.d.ts.map +0 -1
- package/build/dts/api-call/upload-image-utils.js.map +0 -1
- package/build/dts/api-call/upload-image-utils.test.d.ts +0 -2
- package/build/dts/api-call/upload-image-utils.test.d.ts.map +0 -1
- package/build/dts/api-call/upload-image-utils.test.js +0 -121
- package/build/dts/api-call/upload-image-utils.test.js.map +0 -1
- package/build/dts/api-call/validation.d.ts.map +0 -1
- package/build/dts/api-call/validation.js.map +0 -1
- package/build/dts/api-call/validation.test.d.ts +0 -2
- package/build/dts/api-call/validation.test.d.ts.map +0 -1
- package/build/dts/api-call/validation.test.js +0 -42
- package/build/dts/api-call/validation.test.js.map +0 -1
- package/build/dts/auth/auth-error-handling.test.d.ts +0 -2
- package/build/dts/auth/auth-error-handling.test.d.ts.map +0 -1
- package/build/dts/auth/auth-error-handling.test.js +0 -347
- package/build/dts/auth/auth-error-handling.test.js.map +0 -1
- package/build/dts/auth/index.d.ts.map +0 -1
- package/build/dts/auth/index.js.map +0 -1
- package/build/dts/bin.d.ts.map +0 -1
- package/build/dts/bin.js.map +0 -1
- package/build/dts/cli-tools/account-auth-strategy.d.ts.map +0 -1
- package/build/dts/cli-tools/account-auth-strategy.js.map +0 -1
- package/build/dts/cli-tools/account-token-store.d.ts.map +0 -1
- package/build/dts/cli-tools/account-token-store.js.map +0 -1
- package/build/dts/cli-tools/cli.d.ts.map +0 -1
- package/build/dts/cli-tools/cli.js.map +0 -1
- package/build/dts/cli-tools/utils.d.ts.map +0 -1
- package/build/dts/cli-tools/utils.js.map +0 -1
- package/build/dts/code-mode/index.d.ts.map +0 -1
- package/build/dts/code-mode/index.js.map +0 -1
- package/build/dts/code-mode/index.test.d.ts +0 -2
- package/build/dts/code-mode/index.test.d.ts.map +0 -1
- package/build/dts/code-mode/index.test.js +0 -342
- package/build/dts/code-mode/index.test.js.map +0 -1
- package/build/dts/code-mode/truncate-response.d.ts.map +0 -1
- package/build/dts/code-mode/truncate-response.js.map +0 -1
- package/build/dts/code-mode/truncate-response.test.d.ts +0 -2
- package/build/dts/code-mode/truncate-response.test.d.ts.map +0 -1
- package/build/dts/code-mode/truncate-response.test.js +0 -32
- package/build/dts/code-mode/truncate-response.test.js.map +0 -1
- package/build/dts/code-mode/validation.d.ts.map +0 -1
- package/build/dts/code-mode/validation.js.map +0 -1
- package/build/dts/code-mode/validation.test.d.ts +0 -2
- package/build/dts/code-mode/validation.test.d.ts.map +0 -1
- package/build/dts/code-mode/validation.test.js +0 -72
- package/build/dts/code-mode/validation.test.js.map +0 -1
- package/build/dts/config/default-config.bulk-preference.test.d.ts +0 -2
- package/build/dts/config/default-config.bulk-preference.test.d.ts.map +0 -1
- package/build/dts/config/default-config.bulk-preference.test.js +0 -42
- package/build/dts/config/default-config.bulk-preference.test.js.map +0 -1
- package/build/dts/config/default-config.d.ts.map +0 -1
- package/build/dts/config/default-config.execute-orchestration.test.d.ts +0 -2
- package/build/dts/config/default-config.execute-orchestration.test.d.ts.map +0 -1
- package/build/dts/config/default-config.execute-orchestration.test.js +0 -40
- package/build/dts/config/default-config.execute-orchestration.test.js.map +0 -1
- package/build/dts/config/default-config.js.map +0 -1
- package/build/dts/config/default-config.readme.test.d.ts +0 -2
- package/build/dts/config/default-config.readme.test.d.ts.map +0 -1
- package/build/dts/config/default-config.readme.test.js +0 -84
- package/build/dts/config/default-config.readme.test.js.map +0 -1
- package/build/dts/config/default-config.searchspec-goal.test.d.ts +0 -2
- package/build/dts/config/default-config.searchspec-goal.test.d.ts.map +0 -1
- package/build/dts/config/default-config.searchspec-goal.test.js +0 -30
- package/build/dts/config/default-config.searchspec-goal.test.js.map +0 -1
- package/build/dts/config/param-descriptions.d.ts.map +0 -1
- package/build/dts/config/param-descriptions.js.map +0 -1
- package/build/dts/constants.d.ts.map +0 -1
- package/build/dts/constants.js.map +0 -1
- package/build/dts/docs/browse-menu.d.ts.map +0 -1
- package/build/dts/docs/browse-menu.js.map +0 -1
- package/build/dts/docs/browse-menu.test.d.ts +0 -2
- package/build/dts/docs/browse-menu.test.d.ts.map +0 -1
- package/build/dts/docs/browse-menu.test.js +0 -66
- package/build/dts/docs/browse-menu.test.js.map +0 -1
- package/build/dts/docs/browse-tool.test.d.ts +0 -2
- package/build/dts/docs/browse-tool.test.d.ts.map +0 -1
- package/build/dts/docs/browse-tool.test.js +0 -77
- package/build/dts/docs/browse-tool.test.js.map +0 -1
- package/build/dts/docs/create-site-guide.d.ts.map +0 -1
- package/build/dts/docs/create-site-guide.js.map +0 -1
- package/build/dts/docs/docs.d.ts.map +0 -1
- package/build/dts/docs/docs.js.map +0 -1
- package/build/dts/docs/fetch-article.d.ts.map +0 -1
- package/build/dts/docs/fetch-article.js.map +0 -1
- package/build/dts/docs/fetch-article.test.d.ts +0 -2
- package/build/dts/docs/fetch-article.test.d.ts.map +0 -1
- package/build/dts/docs/fetch-article.test.js +0 -93
- package/build/dts/docs/fetch-article.test.js.map +0 -1
- package/build/dts/docs/fetch-skills.d.ts.map +0 -1
- package/build/dts/docs/fetch-skills.js.map +0 -1
- package/build/dts/docs/fetch-skills.test.d.ts +0 -2
- package/build/dts/docs/fetch-skills.test.d.ts.map +0 -1
- package/build/dts/docs/fetch-skills.test.js +0 -140
- package/build/dts/docs/fetch-skills.test.js.map +0 -1
- package/build/dts/docs/get-to-know.d.ts.map +0 -1
- package/build/dts/docs/get-to-know.js.map +0 -1
- package/build/dts/docs/get-to-know.test.d.ts +0 -2
- package/build/dts/docs/get-to-know.test.d.ts.map +0 -1
- package/build/dts/docs/get-to-know.test.js +0 -152
- package/build/dts/docs/get-to-know.test.js.map +0 -1
- package/build/dts/docs/long-content.d.ts.map +0 -1
- package/build/dts/docs/long-content.js.map +0 -1
- package/build/dts/docs/normalize-menu-content.d.ts.map +0 -1
- package/build/dts/docs/normalize-menu-content.js.map +0 -1
- package/build/dts/docs/searchFormatting.d.ts.map +0 -1
- package/build/dts/docs/searchFormatting.js.map +0 -1
- package/build/dts/docs/searchFormatting.test.d.ts +0 -2
- package/build/dts/docs/searchFormatting.test.d.ts.map +0 -1
- package/build/dts/docs/searchFormatting.test.js +0 -39
- package/build/dts/docs/searchFormatting.test.js.map +0 -1
- package/build/dts/docs/semanticSearch.d.ts.map +0 -1
- package/build/dts/docs/semanticSearch.js.map +0 -1
- package/build/dts/docs/semanticSearch.test.d.ts +0 -2
- package/build/dts/docs/semanticSearch.test.d.ts.map +0 -1
- package/build/dts/docs/semanticSearch.test.js +0 -923
- package/build/dts/docs/semanticSearch.test.js.map +0 -1
- package/build/dts/docs/velo-readme.d.ts.map +0 -1
- package/build/dts/docs/velo-readme.js.map +0 -1
- package/build/dts/import-claude-design-tool/banner.d.ts.map +0 -1
- package/build/dts/import-claude-design-tool/banner.js.map +0 -1
- package/build/dts/import-claude-design-tool/constants.d.ts.map +0 -1
- package/build/dts/import-claude-design-tool/constants.js.map +0 -1
- package/build/dts/import-claude-design-tool/index.d.ts.map +0 -1
- package/build/dts/import-claude-design-tool/index.js.map +0 -1
- package/build/dts/import-claude-design-tool/index.test.d.ts +0 -2
- package/build/dts/import-claude-design-tool/index.test.d.ts.map +0 -1
- package/build/dts/import-claude-design-tool/index.test.js +0 -329
- package/build/dts/import-claude-design-tool/index.test.js.map +0 -1
- package/build/dts/import-claude-design-tool/sanitize.d.ts.map +0 -1
- package/build/dts/import-claude-design-tool/sanitize.js.map +0 -1
- package/build/dts/import-claude-design-tool/wixstro-client.d.ts.map +0 -1
- package/build/dts/import-claude-design-tool/wixstro-client.js.map +0 -1
- package/build/dts/index.d.ts.map +0 -1
- package/build/dts/index.js.map +0 -1
- package/build/dts/infra/bi-logger.d.ts.map +0 -1
- package/build/dts/infra/bi-logger.js.map +0 -1
- package/build/dts/infra/environment.d.ts.map +0 -1
- package/build/dts/infra/environment.js.map +0 -1
- package/build/dts/infra/file-logger.d.ts.map +0 -1
- package/build/dts/infra/file-logger.js.map +0 -1
- package/build/dts/infra/logger.d.ts.map +0 -1
- package/build/dts/infra/logger.js.map +0 -1
- package/build/dts/infra/panorama.d.ts.map +0 -1
- package/build/dts/infra/panorama.js.map +0 -1
- package/build/dts/infra/response-size-limits.d.ts.map +0 -1
- package/build/dts/infra/response-size-limits.js.map +0 -1
- package/build/dts/infra/sentry.d.ts.map +0 -1
- package/build/dts/infra/sentry.js.map +0 -1
- package/build/dts/infra/tool-bi.d.ts.map +0 -1
- package/build/dts/infra/tool-bi.js.map +0 -1
- package/build/dts/infra/widget-payload.d.ts.map +0 -1
- package/build/dts/infra/widget-payload.js.map +0 -1
- package/build/dts/resources/docs.d.ts.map +0 -1
- package/build/dts/resources/docs.js.map +0 -1
- package/build/dts/site-widget-tools/claim-site-tool/index.d.ts.map +0 -1
- package/build/dts/site-widget-tools/claim-site-tool/index.js.map +0 -1
- package/build/dts/site-widget-tools/constants.d.ts.map +0 -1
- package/build/dts/site-widget-tools/constants.js.map +0 -1
- package/build/dts/site-widget-tools/create-site-from-template-tool/index.d.ts.map +0 -1
- package/build/dts/site-widget-tools/create-site-from-template-tool/index.js.map +0 -1
- package/build/dts/site-widget-tools/edit-site-tool/index.d.ts.map +0 -1
- package/build/dts/site-widget-tools/edit-site-tool/index.js.map +0 -1
- package/build/dts/site-widget-tools/index.d.ts.map +0 -1
- package/build/dts/site-widget-tools/index.js.map +0 -1
- package/build/dts/site-widget-tools/pull-site-creation-job-tool/index.d.ts.map +0 -1
- package/build/dts/site-widget-tools/pull-site-creation-job-tool/index.js.map +0 -1
- package/build/dts/site-widget-tools/search-site-templates-tool/index.d.ts.map +0 -1
- package/build/dts/site-widget-tools/search-site-templates-tool/index.js.map +0 -1
- package/build/dts/site-widget-tools/site-builder-tool/index.d.ts.map +0 -1
- package/build/dts/site-widget-tools/site-builder-tool/index.js.map +0 -1
- package/build/dts/site-widget-tools/site-builder-tool/index.test.d.ts +0 -2
- package/build/dts/site-widget-tools/site-builder-tool/index.test.d.ts.map +0 -1
- package/build/dts/site-widget-tools/site-builder-tool/index.test.js +0 -46
- package/build/dts/site-widget-tools/site-builder-tool/index.test.js.map +0 -1
- package/build/dts/site-widget-tools/site-creation-tool/index.d.ts.map +0 -1
- package/build/dts/site-widget-tools/site-creation-tool/index.js.map +0 -1
- package/build/dts/site-widget-tools/site-creation-tool/index.test.d.ts +0 -2
- package/build/dts/site-widget-tools/site-creation-tool/index.test.d.ts.map +0 -1
- package/build/dts/site-widget-tools/site-creation-tool/index.test.js +0 -57
- package/build/dts/site-widget-tools/site-creation-tool/index.test.js.map +0 -1
- package/build/dts/site-widget-tools/suggested-domain-tool/index.d.ts.map +0 -1
- package/build/dts/site-widget-tools/suggested-domain-tool/index.js.map +0 -1
- package/build/dts/site-widget-tools/types.d.ts.map +0 -1
- package/build/dts/site-widget-tools/types.js.map +0 -1
- package/build/dts/site-widget-tools/utils.d.ts.map +0 -1
- package/build/dts/site-widget-tools/utils.js.map +0 -1
- package/build/dts/support/index.d.ts.map +0 -1
- package/build/dts/support/index.js.map +0 -1
- package/build/dts/tool-bi-reporting.test.d.ts +0 -2
- package/build/dts/tool-bi-reporting.test.d.ts.map +0 -1
- package/build/dts/tool-bi-reporting.test.js +0 -219
- package/build/dts/tool-bi-reporting.test.js.map +0 -1
- package/build/dts/tool-utils.d.ts.map +0 -1
- package/build/dts/tool-utils.js.map +0 -1
- package/build/dts/tool-utils.spec.d.ts +0 -2
- package/build/dts/tool-utils.spec.d.ts.map +0 -1
- package/build/dts/tool-utils.spec.js +0 -98
- package/build/dts/tool-utils.spec.js.map +0 -1
- package/build/dts/toolkit-entry.d.ts.map +0 -1
- package/build/dts/toolkit-entry.js.map +0 -1
- package/build/dts/toolkit-json-schema.test.d.ts +0 -2
- package/build/dts/toolkit-json-schema.test.d.ts.map +0 -1
- package/build/dts/toolkit-json-schema.test.js +0 -36
- package/build/dts/toolkit-json-schema.test.js.map +0 -1
- package/build/dts/toolkit.d.ts.map +0 -1
- package/build/dts/toolkit.js.map +0 -1
- package/build/dts/toolkit.test.d.ts +0 -2
- package/build/dts/toolkit.test.d.ts.map +0 -1
- package/build/dts/toolkit.test.js +0 -691
- package/build/dts/toolkit.test.js.map +0 -1
- package/build/dts/widget-manifest.d.ts.map +0 -1
- package/build/dts/widget-manifest.js.map +0 -1
- package/build/dts/wix-fetch-error.d.ts.map +0 -1
- package/build/dts/wix-fetch-error.js.map +0 -1
- package/build/dts/wix-mcp-server.d.ts.map +0 -1
- package/build/dts/wix-mcp-server.js.map +0 -1
- package/build/dts/wixel/api.d.ts.map +0 -1
- package/build/dts/wixel/api.js.map +0 -1
- package/build/dts/wixel/constants.d.ts.map +0 -1
- package/build/dts/wixel/constants.js.map +0 -1
- package/build/dts/wixel/external-agent-api.d.ts.map +0 -1
- package/build/dts/wixel/external-agent-api.js.map +0 -1
- package/build/dts/wixel/get-wixel-asset-tool.d.ts.map +0 -1
- package/build/dts/wixel/get-wixel-asset-tool.js.map +0 -1
- package/build/dts/wixel/get-wixel-job-status-tool.d.ts.map +0 -1
- package/build/dts/wixel/get-wixel-job-status-tool.js.map +0 -1
- package/build/dts/wixel/get-wixel-project-assets-tool.d.ts.map +0 -1
- package/build/dts/wixel/get-wixel-project-assets-tool.js.map +0 -1
- package/build/dts/wixel/index.d.ts.map +0 -1
- package/build/dts/wixel/index.js.map +0 -1
- package/build/dts/wixel/mark-wixel-job-as-fulfilled-tool.d.ts.map +0 -1
- package/build/dts/wixel/mark-wixel-job-as-fulfilled-tool.js.map +0 -1
- package/build/dts/wixel/open-headless-wixel-project-tool.d.ts.map +0 -1
- package/build/dts/wixel/open-headless-wixel-project-tool.js.map +0 -1
- package/build/dts/wixel/pull-headless-wixel-job-tool.d.ts.map +0 -1
- package/build/dts/wixel/pull-headless-wixel-job-tool.js.map +0 -1
- package/build/dts/wixel/update-headless-wixel-job-tool.d.ts.map +0 -1
- package/build/dts/wixel/update-headless-wixel-job-tool.js.map +0 -1
- package/build/dts/wixel/utils.d.ts.map +0 -1
- package/build/dts/wixel/utils.js.map +0 -1
- package/build/dts/wixel/wixel-bi.d.ts.map +0 -1
- package/build/dts/wixel/wixel-bi.js.map +0 -1
- package/build/dts/wixel/wixel-bi.test.d.ts +0 -2
- package/build/dts/wixel/wixel-bi.test.d.ts.map +0 -1
- package/build/dts/wixel/wixel-bi.test.js +0 -35
- package/build/dts/wixel/wixel-bi.test.js.map +0 -1
- package/build/dts/wixel/wixel-session-tools.d.ts.map +0 -1
- package/build/dts/wixel/wixel-session-tools.js.map +0 -1
- package/build/dts/wixel/wixel-session-tools.test.d.ts +0 -2
- package/build/dts/wixel/wixel-session-tools.test.d.ts.map +0 -1
- package/build/dts/wixel/wixel-session-tools.test.js +0 -143
- package/build/dts/wixel/wixel-session-tools.test.js.map +0 -1
- package/build/esm/index.js.map +0 -7
- package/build/esm/toolkit.js.map +0 -7
package/build/cjs/index.cjs
CHANGED
|
@@ -36336,26 +36336,54 @@ var getTruncatedResultHint = ({
|
|
|
36336
36336
|
].join("\n");
|
|
36337
36337
|
};
|
|
36338
36338
|
var SECTION_DELIMITER_RE = /^--- .+ ---$/;
|
|
36339
|
-
var
|
|
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,
|
|
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 =
|
|
36358
|
-
|
|
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 =
|
|
36377
|
-
const truncated = currentLines
|
|
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
|
|
36426
|
-
|
|
36427
|
-
|
|
36428
|
-
|
|
36429
|
-
const moreLinesText =
|
|
36452
|
+
const { lines: truncated, moreCount } = truncateLines(
|
|
36453
|
+
newContent.split("\n"),
|
|
36454
|
+
linesInEachResult
|
|
36455
|
+
);
|
|
36456
|
+
const moreLinesText = moreCount > 0 ? [
|
|
36430
36457
|
`
|
|
36431
36458
|
|
|
36432
|
-
... ${
|
|
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 = `${
|
|
36466
|
+
newContent = `${truncated.join("\n")}${moreLinesText}`;
|
|
36440
36467
|
}
|
|
36441
36468
|
}
|
|
36442
36469
|
return {
|
package/build/cjs/toolkit.cjs
CHANGED
|
@@ -16067,26 +16067,54 @@ var getTruncatedResultHint = ({
|
|
|
16067
16067
|
].join("\n");
|
|
16068
16068
|
};
|
|
16069
16069
|
var SECTION_DELIMITER_RE = /^--- .+ ---$/;
|
|
16070
|
-
var
|
|
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,
|
|
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 =
|
|
16089
|
-
|
|
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 =
|
|
16108
|
-
const truncated = currentLines
|
|
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
|
|
16157
|
-
|
|
16158
|
-
|
|
16159
|
-
|
|
16160
|
-
const moreLinesText =
|
|
16183
|
+
const { lines: truncated, moreCount } = truncateLines(
|
|
16184
|
+
newContent.split("\n"),
|
|
16185
|
+
linesInEachResult
|
|
16186
|
+
);
|
|
16187
|
+
const moreLinesText = moreCount > 0 ? [
|
|
16161
16188
|
`
|
|
16162
16189
|
|
|
16163
|
-
... ${
|
|
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 = `${
|
|
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
|
-
|
|
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,
|
|
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
|
|
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 =
|
|
121
|
-
const truncated = currentLines
|
|
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
|
|
160
|
-
const
|
|
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... ${
|
|
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 = `${
|
|
208
|
+
newContent = `${truncated.join('\n')}${moreLinesText}`;
|
|
174
209
|
}
|
|
175
210
|
}
|
|
176
211
|
return {
|
package/build/dts/index.d.ts
CHANGED
|
@@ -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';
|
package/build/dts/index.js
CHANGED
|
@@ -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 {
|
|
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
|
|
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:
|
|
9
|
-
export declare function formatToolResultAdditionalFields(result:
|
|
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
|
|
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
|
*/
|