@anuma/sdk 6.31.0 → 6.31.2

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.
@@ -2383,14 +2383,14 @@ async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embed
2383
2383
  const alwaysInclude = clientTools.filter(isAlwaysIncluded);
2384
2384
  const filterCandidates = clientTools.filter((t) => !isAlwaysIncluded(t));
2385
2385
  if (filterCandidates.length === 0) {
2386
- return { tools: clientTools, activatedSetNames: /* @__PURE__ */ new Set() };
2386
+ return { tools: clientTools, activatedSetNames: /* @__PURE__ */ new Set(), matchedSetNames: /* @__PURE__ */ new Set() };
2387
2387
  }
2388
2388
  if (!promptEmbeddings && noEmbeddingsReason === "error") {
2389
- return { tools: clientTools, activatedSetNames: /* @__PURE__ */ new Set() };
2389
+ return { tools: clientTools, activatedSetNames: /* @__PURE__ */ new Set(), matchedSetNames: /* @__PURE__ */ new Set() };
2390
2390
  }
2391
2391
  if (!promptEmbeddings) {
2392
2392
  if (activeToolSets.length === 0) {
2393
- return { tools: [], activatedSetNames: /* @__PURE__ */ new Set() };
2393
+ return { tools: [], activatedSetNames: /* @__PURE__ */ new Set(), matchedSetNames: /* @__PURE__ */ new Set() };
2394
2394
  }
2395
2395
  const allSets = extraToolSets.length > 0 ? [...BUILT_IN_TOOL_SETS, ...extraToolSets] : BUILT_IN_TOOL_SETS;
2396
2396
  const activeSets = allSets.filter((s) => activeToolSets.includes(s.name));
@@ -2400,7 +2400,8 @@ async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embed
2400
2400
  ...alwaysInclude,
2401
2401
  ...filterCandidates.filter((t) => stickyMembers.has(getToolName(t)))
2402
2402
  ],
2403
- activatedSetNames: new Set(activeSets.map((s) => s.name))
2403
+ activatedSetNames: new Set(activeSets.map((s) => s.name)),
2404
+ matchedSetNames: /* @__PURE__ */ new Set()
2404
2405
  };
2405
2406
  }
2406
2407
  const toolsNeedingEmbeddings = [];
@@ -2418,7 +2419,7 @@ async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embed
2418
2419
  cache.set(toolsNeedingEmbeddings[i].name, embeddings[i]);
2419
2420
  }
2420
2421
  } catch {
2421
- return { tools: clientTools, activatedSetNames: /* @__PURE__ */ new Set() };
2422
+ return { tools: clientTools, activatedSetNames: /* @__PURE__ */ new Set(), matchedSetNames: /* @__PURE__ */ new Set() };
2422
2423
  }
2423
2424
  }
2424
2425
  const pseudoServerTools = [];
@@ -2464,14 +2465,15 @@ async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embed
2464
2465
  activeSetNames
2465
2466
  );
2466
2467
  const activatedSetNames = activatedToolSetNames(scores, toolSets, activeSetNames);
2468
+ const matchedSetNames = activatedToolSetNames(scores, toolSets);
2467
2469
  if (finalNames.size === 0) {
2468
- return { tools: alwaysInclude, activatedSetNames };
2470
+ return { tools: alwaysInclude, activatedSetNames, matchedSetNames };
2469
2471
  }
2470
2472
  const filtered = filterCandidates.filter((t) => {
2471
2473
  const name = getToolName(t);
2472
2474
  return name && finalNames.has(name);
2473
2475
  });
2474
- return { tools: [...alwaysInclude, ...filtered], activatedSetNames };
2476
+ return { tools: [...alwaysInclude, ...filtered], activatedSetNames, matchedSetNames };
2475
2477
  }
2476
2478
 
2477
2479
  // src/lib/tools/toolCatalog.ts
@@ -846,6 +846,9 @@ declare function computeToolGuidance(selectedServerTools: ServerTool[], selected
846
846
  * definitions that eat up the context window.
847
847
  *
848
848
  * @returns Filtered client tools, or the original array if filtering fails/skips.
849
+ * `activatedSetNames` is every set that activated, forced ones included.
850
+ * `matchedSetNames` is only the sets whose anchors cleared their floor on THIS
851
+ * prompt, ignoring `activeToolSets`; it is empty whenever no scoring ran.
849
852
  */
850
853
  declare function autoFilterClientTools(clientTools: LlmapiChatCompletionTool[], promptEmbeddings: number[] | number[][] | null, cache: Map<string, number[]>, embeddingOptions: {
851
854
  getToken?: () => Promise<string | null>;
@@ -862,6 +865,7 @@ declare function autoFilterClientTools(clientTools: LlmapiChatCompletionTool[],
862
865
  noEmbeddingsReason?: "short-prompt" | "error"): Promise<{
863
866
  tools: LlmapiChatCompletionTool[];
864
867
  activatedSetNames?: ReadonlySet<string>;
868
+ matchedSetNames: ReadonlySet<string>;
865
869
  }>;
866
870
 
867
871
  /**
@@ -846,6 +846,9 @@ declare function computeToolGuidance(selectedServerTools: ServerTool[], selected
846
846
  * definitions that eat up the context window.
847
847
  *
848
848
  * @returns Filtered client tools, or the original array if filtering fails/skips.
849
+ * `activatedSetNames` is every set that activated, forced ones included.
850
+ * `matchedSetNames` is only the sets whose anchors cleared their floor on THIS
851
+ * prompt, ignoring `activeToolSets`; it is empty whenever no scoring ran.
849
852
  */
850
853
  declare function autoFilterClientTools(clientTools: LlmapiChatCompletionTool[], promptEmbeddings: number[] | number[][] | null, cache: Map<string, number[]>, embeddingOptions: {
851
854
  getToken?: () => Promise<string | null>;
@@ -862,6 +865,7 @@ declare function autoFilterClientTools(clientTools: LlmapiChatCompletionTool[],
862
865
  noEmbeddingsReason?: "short-prompt" | "error"): Promise<{
863
866
  tools: LlmapiChatCompletionTool[];
864
867
  activatedSetNames?: ReadonlySet<string>;
868
+ matchedSetNames: ReadonlySet<string>;
865
869
  }>;
866
870
 
867
871
  /**
@@ -2261,14 +2261,14 @@ async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embed
2261
2261
  const alwaysInclude = clientTools.filter(isAlwaysIncluded);
2262
2262
  const filterCandidates = clientTools.filter((t) => !isAlwaysIncluded(t));
2263
2263
  if (filterCandidates.length === 0) {
2264
- return { tools: clientTools, activatedSetNames: /* @__PURE__ */ new Set() };
2264
+ return { tools: clientTools, activatedSetNames: /* @__PURE__ */ new Set(), matchedSetNames: /* @__PURE__ */ new Set() };
2265
2265
  }
2266
2266
  if (!promptEmbeddings && noEmbeddingsReason === "error") {
2267
- return { tools: clientTools, activatedSetNames: /* @__PURE__ */ new Set() };
2267
+ return { tools: clientTools, activatedSetNames: /* @__PURE__ */ new Set(), matchedSetNames: /* @__PURE__ */ new Set() };
2268
2268
  }
2269
2269
  if (!promptEmbeddings) {
2270
2270
  if (activeToolSets.length === 0) {
2271
- return { tools: [], activatedSetNames: /* @__PURE__ */ new Set() };
2271
+ return { tools: [], activatedSetNames: /* @__PURE__ */ new Set(), matchedSetNames: /* @__PURE__ */ new Set() };
2272
2272
  }
2273
2273
  const allSets = extraToolSets.length > 0 ? [...BUILT_IN_TOOL_SETS, ...extraToolSets] : BUILT_IN_TOOL_SETS;
2274
2274
  const activeSets = allSets.filter((s) => activeToolSets.includes(s.name));
@@ -2278,7 +2278,8 @@ async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embed
2278
2278
  ...alwaysInclude,
2279
2279
  ...filterCandidates.filter((t) => stickyMembers.has(getToolName(t)))
2280
2280
  ],
2281
- activatedSetNames: new Set(activeSets.map((s) => s.name))
2281
+ activatedSetNames: new Set(activeSets.map((s) => s.name)),
2282
+ matchedSetNames: /* @__PURE__ */ new Set()
2282
2283
  };
2283
2284
  }
2284
2285
  const toolsNeedingEmbeddings = [];
@@ -2296,7 +2297,7 @@ async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embed
2296
2297
  cache.set(toolsNeedingEmbeddings[i].name, embeddings[i]);
2297
2298
  }
2298
2299
  } catch {
2299
- return { tools: clientTools, activatedSetNames: /* @__PURE__ */ new Set() };
2300
+ return { tools: clientTools, activatedSetNames: /* @__PURE__ */ new Set(), matchedSetNames: /* @__PURE__ */ new Set() };
2300
2301
  }
2301
2302
  }
2302
2303
  const pseudoServerTools = [];
@@ -2342,14 +2343,15 @@ async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embed
2342
2343
  activeSetNames
2343
2344
  );
2344
2345
  const activatedSetNames = activatedToolSetNames(scores, toolSets, activeSetNames);
2346
+ const matchedSetNames = activatedToolSetNames(scores, toolSets);
2345
2347
  if (finalNames.size === 0) {
2346
- return { tools: alwaysInclude, activatedSetNames };
2348
+ return { tools: alwaysInclude, activatedSetNames, matchedSetNames };
2347
2349
  }
2348
2350
  const filtered = filterCandidates.filter((t) => {
2349
2351
  const name = getToolName(t);
2350
2352
  return name && finalNames.has(name);
2351
2353
  });
2352
- return { tools: [...alwaysInclude, ...filtered], activatedSetNames };
2354
+ return { tools: [...alwaysInclude, ...filtered], activatedSetNames, matchedSetNames };
2353
2355
  }
2354
2356
 
2355
2357
  // src/lib/tools/toolCatalog.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "6.31.0",
3
+ "version": "6.31.2",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",