@blockrun/clawrouter 0.12.3 → 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
@@ -742,6 +742,7 @@ import {
742
742
  setTransactionMessageLifetimeUsingBlockhash,
743
743
  appendTransactionMessageInstructions,
744
744
  signTransactionMessageWithSigners,
745
+ addSignersToTransactionMessage,
745
746
  getSignatureFromTransaction,
746
747
  sendAndConfirmTransactionFactory,
747
748
  getProgramDerivedAddress,
@@ -913,7 +914,11 @@ async function sweepSolanaWallet(oldKeyBytes, newKeyBytes, rpcUrl) {
913
914
  (msg) => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, msg),
914
915
  (msg) => appendTransactionMessageInstructions([createAtaIx, ...transferIxs], msg)
915
916
  );
916
- const signedTx = await signTransactionMessageWithSigners(txMessage);
917
+ const txMessageWithSigners = addSignersToTransactionMessage(
918
+ [newSigner, oldSigner],
919
+ txMessage
920
+ );
921
+ const signedTx = await signTransactionMessageWithSigners(txMessageWithSigners);
917
922
  const txSignature = getSignatureFromTransaction(signedTx);
918
923
  const wsUrl = url.replace("https://", "wss://").replace("http://", "ws://");
919
924
  const rpcSubscriptions = createSolanaRpcSubscriptions(wsUrl);
@@ -3199,9 +3204,10 @@ function route(prompt, systemPrompt, maxOutputTokens, options) {
3199
3204
  const agenticScore = ruleResult.agenticScore ?? 0;
3200
3205
  const isAutoAgentic = agenticScore >= 0.5;
3201
3206
  const isExplicitAgentic = config.overrides.agenticMode ?? false;
3202
- const useAgenticTiers = (isAutoAgentic || isExplicitAgentic) && config.agenticTiers != null;
3207
+ const hasToolsInRequest = options.hasTools ?? false;
3208
+ const useAgenticTiers = (hasToolsInRequest || isAutoAgentic || isExplicitAgentic) && config.agenticTiers != null;
3203
3209
  tierConfigs = useAgenticTiers ? config.agenticTiers : config.tiers;
3204
- profileSuffix = useAgenticTiers ? " | agentic" : "";
3210
+ profileSuffix = useAgenticTiers ? ` | agentic${hasToolsInRequest ? " (tools)" : ""}` : "";
3205
3211
  }
3206
3212
  const agenticScoreValue = ruleResult.agenticScore;
3207
3213
  if (estimatedTokens > config.overrides.maxTokensForceComplex) {
@@ -6778,7 +6784,7 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
6778
6784
  const tools = parsed.tools;
6779
6785
  hasTools = Array.isArray(tools) && tools.length > 0;
6780
6786
  if (hasTools && tools) {
6781
- console.log(`[ClawRouter] Tools detected (${tools.length}), agentic mode via keywords`);
6787
+ console.log(`[ClawRouter] Tools detected (${tools.length}), forcing agentic tiers`);
6782
6788
  }
6783
6789
  hasVision = parsedMessages.some((m) => {
6784
6790
  if (Array.isArray(m.content)) {
@@ -6791,7 +6797,8 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
6791
6797
  }
6792
6798
  routingDecision = route(prompt, systemPrompt, maxTokens, {
6793
6799
  ...routerOpts,
6794
- routingProfile: routingProfile ?? void 0
6800
+ routingProfile: routingProfile ?? void 0,
6801
+ hasTools
6795
6802
  });
6796
6803
  if (existingSession) {
6797
6804
  const tierRank = {