clodds 1.6.16 → 1.6.17

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.
@@ -16692,9 +16692,22 @@ async function createAgentManager(config, feeds, db, sessionManager, sendMessage
16692
16692
  };
16693
16693
  // Strip internal metadata before sending to API — Anthropic rejects extra fields
16694
16694
  const toApiTools = (defs) => defs.map(({ metadata: _, ...rest }) => rest);
16695
+ // Smart tool gating: zero-intent messages ("hi", "thanks") don't need 22 tools.
16696
+ // Send only tool_search so Claude can discover tools if the conversation turns trading.
16697
+ // But keep full tools if: any platform/category hint, deep conversation (follow-up),
16698
+ // or tool search is disabled (legacy mode).
16699
+ const isZeroIntent = !hints.hasIntent // no trading/defi/portfolio keywords
16700
+ && hints.platforms.length === 0 // no platform keywords
16701
+ && !skillContext // no skill matches
16702
+ && messages.length <= 1; // first message only (no history)
16703
+ const minimalTools = isZeroIntent && TOOL_SEARCH_ENABLED;
16704
+ if (minimalTools) {
16705
+ logger_1.logger.info('Zero-intent message — using minimal tools (tool_search only)');
16706
+ }
16695
16707
  let response;
16696
16708
  try {
16697
- const apiTools = toApiTools(getActiveTools());
16709
+ const fullTools = getActiveTools();
16710
+ const apiTools = toApiTools(minimalTools ? fullTools.filter(t => t.name === 'tool_search') : fullTools);
16698
16711
  // Add cache_control to last tool for tool definition caching
16699
16712
  if (apiTools.length > 0) {
16700
16713
  apiTools[apiTools.length - 1].cache_control = { type: 'ephemeral' };