@blockrun/clawrouter 0.12.4 → 0.12.6

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
@@ -658,6 +658,7 @@ __export(wallet_exports, {
658
658
  deriveSolanaKeyBytes: () => deriveSolanaKeyBytes,
659
659
  deriveSolanaKeyBytesLegacy: () => deriveSolanaKeyBytesLegacy,
660
660
  generateWalletMnemonic: () => generateWalletMnemonic,
661
+ getSolanaAddress: () => getSolanaAddress,
661
662
  isValidMnemonic: () => isValidMnemonic
662
663
  });
663
664
  import { HDKey } from "@scure/bip32";
@@ -710,6 +711,11 @@ function deriveAllKeys(mnemonic) {
710
711
  const solanaPrivateKeyBytes = deriveSolanaKeyBytes(mnemonic);
711
712
  return { mnemonic, evmPrivateKey, evmAddress, solanaPrivateKeyBytes };
712
713
  }
714
+ async function getSolanaAddress(privateKeyBytes) {
715
+ const { createKeyPairSignerFromPrivateKeyBytes: createKeyPairSignerFromPrivateKeyBytes2 } = await import("@solana/kit");
716
+ const signer = await createKeyPairSignerFromPrivateKeyBytes2(privateKeyBytes);
717
+ return signer.address;
718
+ }
713
719
  var ETH_DERIVATION_PATH, SOLANA_HARDENED_INDICES;
714
720
  var init_wallet = __esm({
715
721
  "src/wallet.ts"() {
@@ -3204,9 +3210,10 @@ function route(prompt, systemPrompt, maxOutputTokens, options) {
3204
3210
  const agenticScore = ruleResult.agenticScore ?? 0;
3205
3211
  const isAutoAgentic = agenticScore >= 0.5;
3206
3212
  const isExplicitAgentic = config.overrides.agenticMode ?? false;
3207
- const useAgenticTiers = (isAutoAgentic || isExplicitAgentic) && config.agenticTiers != null;
3213
+ const hasToolsInRequest = options.hasTools ?? false;
3214
+ const useAgenticTiers = (hasToolsInRequest || isAutoAgentic || isExplicitAgentic) && config.agenticTiers != null;
3208
3215
  tierConfigs = useAgenticTiers ? config.agenticTiers : config.tiers;
3209
- profileSuffix = useAgenticTiers ? " | agentic" : "";
3216
+ profileSuffix = useAgenticTiers ? ` | agentic${hasToolsInRequest ? " (tools)" : ""}` : "";
3210
3217
  }
3211
3218
  const agenticScoreValue = ruleResult.agenticScore;
3212
3219
  if (estimatedTokens > config.overrides.maxTokensForceComplex) {
@@ -4115,13 +4122,21 @@ async function generateAndSaveWallet() {
4115
4122
  { cause: err }
4116
4123
  );
4117
4124
  }
4125
+ let solanaAddress;
4126
+ try {
4127
+ solanaAddress = await getSolanaAddress(derived.solanaPrivateKeyBytes);
4128
+ } catch {
4129
+ }
4118
4130
  console.log(`[ClawRouter]`);
4119
4131
  console.log(`[ClawRouter] \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`);
4120
4132
  console.log(`[ClawRouter] NEW WALLET GENERATED \u2014 BACK UP YOUR KEY NOW`);
4121
4133
  console.log(`[ClawRouter] \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`);
4122
- console.log(`[ClawRouter] EVM Address : ${derived.evmAddress}`);
4123
- console.log(`[ClawRouter] Key file : ${WALLET_FILE}`);
4124
- console.log(`[ClawRouter] Mnemonic : ${MNEMONIC_FILE}`);
4134
+ console.log(`[ClawRouter] EVM Address : ${derived.evmAddress}`);
4135
+ if (solanaAddress) {
4136
+ console.log(`[ClawRouter] Solana Address : ${solanaAddress}`);
4137
+ }
4138
+ console.log(`[ClawRouter] Key file : ${WALLET_FILE}`);
4139
+ console.log(`[ClawRouter] Mnemonic : ${MNEMONIC_FILE}`);
4125
4140
  console.log(`[ClawRouter]`);
4126
4141
  console.log(`[ClawRouter] Both EVM (Base) and Solana wallets are ready.`);
4127
4142
  console.log(`[ClawRouter] To back up, run in OpenClaw:`);
@@ -6783,7 +6798,7 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
6783
6798
  const tools = parsed.tools;
6784
6799
  hasTools = Array.isArray(tools) && tools.length > 0;
6785
6800
  if (hasTools && tools) {
6786
- console.log(`[ClawRouter] Tools detected (${tools.length}), agentic mode via keywords`);
6801
+ console.log(`[ClawRouter] Tools detected (${tools.length}), forcing agentic tiers`);
6787
6802
  }
6788
6803
  hasVision = parsedMessages.some((m) => {
6789
6804
  if (Array.isArray(m.content)) {
@@ -6796,7 +6811,8 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
6796
6811
  }
6797
6812
  routingDecision = route(prompt, systemPrompt, maxTokens, {
6798
6813
  ...routerOpts,
6799
- routingProfile: routingProfile ?? void 0
6814
+ routingProfile: routingProfile ?? void 0,
6815
+ hasTools
6800
6816
  });
6801
6817
  if (existingSession) {
6802
6818
  const tierRank = {