@blockrun/clawrouter 0.12.4 → 0.12.5

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/dist/index.d.ts CHANGED
@@ -270,6 +270,7 @@ type RouterOptions = {
270
270
  config: RoutingConfig;
271
271
  modelPricing: Map<string, ModelPricing>;
272
272
  routingProfile?: "free" | "eco" | "auto" | "premium";
273
+ hasTools?: boolean;
273
274
  };
274
275
  /**
275
276
  * Route a request to the cheapest capable model.
package/dist/index.js CHANGED
@@ -3204,9 +3204,10 @@ function route(prompt, systemPrompt, maxOutputTokens, options) {
3204
3204
  const agenticScore = ruleResult.agenticScore ?? 0;
3205
3205
  const isAutoAgentic = agenticScore >= 0.5;
3206
3206
  const isExplicitAgentic = config.overrides.agenticMode ?? false;
3207
- const useAgenticTiers = (isAutoAgentic || isExplicitAgentic) && config.agenticTiers != null;
3207
+ const hasToolsInRequest = options.hasTools ?? false;
3208
+ const useAgenticTiers = (hasToolsInRequest || isAutoAgentic || isExplicitAgentic) && config.agenticTiers != null;
3208
3209
  tierConfigs = useAgenticTiers ? config.agenticTiers : config.tiers;
3209
- profileSuffix = useAgenticTiers ? " | agentic" : "";
3210
+ profileSuffix = useAgenticTiers ? ` | agentic${hasToolsInRequest ? " (tools)" : ""}` : "";
3210
3211
  }
3211
3212
  const agenticScoreValue = ruleResult.agenticScore;
3212
3213
  if (estimatedTokens > config.overrides.maxTokensForceComplex) {
@@ -6783,7 +6784,7 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
6783
6784
  const tools = parsed.tools;
6784
6785
  hasTools = Array.isArray(tools) && tools.length > 0;
6785
6786
  if (hasTools && tools) {
6786
- console.log(`[ClawRouter] Tools detected (${tools.length}), agentic mode via keywords`);
6787
+ console.log(`[ClawRouter] Tools detected (${tools.length}), forcing agentic tiers`);
6787
6788
  }
6788
6789
  hasVision = parsedMessages.some((m) => {
6789
6790
  if (Array.isArray(m.content)) {
@@ -6796,7 +6797,8 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
6796
6797
  }
6797
6798
  routingDecision = route(prompt, systemPrompt, maxTokens, {
6798
6799
  ...routerOpts,
6799
- routingProfile: routingProfile ?? void 0
6800
+ routingProfile: routingProfile ?? void 0,
6801
+ hasTools
6800
6802
  });
6801
6803
  if (existingSession) {
6802
6804
  const tierRank = {