@anuma/sdk 6.11.0 → 6.12.1

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.
@@ -1539,6 +1539,20 @@ function clientToolToCompletionsFormat(tool) {
1539
1539
  }
1540
1540
  var TOOL_SEARCH_TOOL_TYPE = "tool_search_tool_regex_20251119";
1541
1541
  var TOOL_SEARCH_TOOL_NAME = "tool_search_tool_regex";
1542
+ function resolveDeferredServerTools(allServerTools, serverToolsFilter, config) {
1543
+ const allowed = serverToolsFilter === void 0 || typeof serverToolsFilter === "function" ? allServerTools : filterServerTools(allServerTools, [...serverToolsFilter]);
1544
+ const excluded = new Set(config.excludeTools ?? []);
1545
+ if (typeof serverToolsFilter === "function") {
1546
+ for (const name of serverToolsFilter.excludeTools ?? []) excluded.add(name);
1547
+ }
1548
+ if (excluded.size === 0) return allowed;
1549
+ return allowed.filter((tool) => !excluded.has(tool.name));
1550
+ }
1551
+ function deferFormattingConfig(serverToolsFilter, config) {
1552
+ if (!config?.enabled) return config;
1553
+ const isExplicitList = serverToolsFilter !== void 0 && typeof serverToolsFilter !== "function";
1554
+ return isExplicitList ? void 0 : config;
1555
+ }
1542
1556
  function byNameAscending(a, b) {
1543
1557
  if (a.name < b.name) return -1;
1544
1558
  if (a.name > b.name) return 1;
@@ -1894,7 +1908,7 @@ function createServerToolsFilter(options = {}) {
1894
1908
  const exclude = new Set(options.excludeTools ?? []);
1895
1909
  const sets = options.toolSets ?? [];
1896
1910
  const matchOpts = options.matchOptions;
1897
- return (embeddings, tools) => {
1911
+ const filter = (embeddings, tools) => {
1898
1912
  const matches = findMatchingTools(embeddings, tools, matchOpts);
1899
1913
  if (matches.length === 0) return [];
1900
1914
  const matchedNames = new Set(matches.map((m) => m.tool.name));
@@ -1912,6 +1926,10 @@ function createServerToolsFilter(options = {}) {
1912
1926
  for (const name of exclude) finalNames.delete(name);
1913
1927
  return [...finalNames];
1914
1928
  };
1929
+ return Object.defineProperty(filter, "excludeTools", {
1930
+ value: Object.freeze([...exclude]),
1931
+ enumerable: false
1932
+ });
1915
1933
  }
1916
1934
  var DEFAULT_EXCLUDED_SERVER_TOOLS = [
1917
1935
  "AnumaVisionMCP-anuma_analyze_image",
@@ -1993,7 +2011,8 @@ async function selectServerToolsForPrompt(options) {
1993
2011
  return [];
1994
2012
  }
1995
2013
  if (allServerTools.length === 0) return [];
1996
- if (deferLoading?.enabled) return allServerTools;
2014
+ if (deferLoading?.enabled)
2015
+ return resolveDeferredServerTools(allServerTools, serverToolsFilter, deferLoading);
1997
2016
  if (typeof serverToolsFilter === "function") {
1998
2017
  if (prompt.length < MIN_CONTENT_LENGTH_FOR_TOOLS) return [];
1999
2018
  let promptEmbedding;
@@ -2618,6 +2637,7 @@ export {
2618
2637
  computeToolGuidance,
2619
2638
  createServerToolsFilter,
2620
2639
  defaultServerToolsFilter,
2640
+ deferFormattingConfig,
2621
2641
  deriveActiveToolSets,
2622
2642
  expandToolSetsAdditive,
2623
2643
  filterAssembledClientTools,
@@ -2637,6 +2657,7 @@ export {
2637
2657
  mergeTools,
2638
2658
  resolveCouncilPlan,
2639
2659
  resolveCouncilServerTools,
2660
+ resolveDeferredServerTools,
2640
2661
  resolvePlan,
2641
2662
  resolveServerTools,
2642
2663
  resolveToolChoice,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "6.11.0",
3
+ "version": "6.12.1",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",