@blockrun/clawrouter 0.12.5 → 0.12.7
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/cli.js +90 -17
- package/dist/cli.js.map +1 -1
- package/dist/index.js +66 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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"() {
|
|
@@ -717,12 +723,7 @@ var init_wallet = __esm({
|
|
|
717
723
|
init_hmac();
|
|
718
724
|
init_sha512();
|
|
719
725
|
ETH_DERIVATION_PATH = "m/44'/60'/0'/0/0";
|
|
720
|
-
SOLANA_HARDENED_INDICES = [
|
|
721
|
-
44 + 2147483648,
|
|
722
|
-
501 + 2147483648,
|
|
723
|
-
0 + 2147483648,
|
|
724
|
-
0 + 2147483648
|
|
725
|
-
];
|
|
726
|
+
SOLANA_HARDENED_INDICES = [44 + 2147483648, 501 + 2147483648, 0 + 2147483648, 0 + 2147483648];
|
|
726
727
|
}
|
|
727
728
|
});
|
|
728
729
|
|
|
@@ -846,11 +847,7 @@ async function sweepSolanaWallet(oldKeyBytes, newKeyBytes, rpcUrl) {
|
|
|
846
847
|
let usdcBalance = 0n;
|
|
847
848
|
const oldTokenAccounts = [];
|
|
848
849
|
try {
|
|
849
|
-
const response = await rpc.getTokenAccountsByOwner(
|
|
850
|
-
solAddress2(oldAddress),
|
|
851
|
-
{ mint },
|
|
852
|
-
{ encoding: "jsonParsed" }
|
|
853
|
-
).send();
|
|
850
|
+
const response = await rpc.getTokenAccountsByOwner(solAddress2(oldAddress), { mint }, { encoding: "jsonParsed" }).send();
|
|
854
851
|
if (response.value.length > 0) {
|
|
855
852
|
for (const account of response.value) {
|
|
856
853
|
const parsed = account.account.data;
|
|
@@ -914,10 +911,7 @@ async function sweepSolanaWallet(oldKeyBytes, newKeyBytes, rpcUrl) {
|
|
|
914
911
|
(msg) => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, msg),
|
|
915
912
|
(msg) => appendTransactionMessageInstructions([createAtaIx, ...transferIxs], msg)
|
|
916
913
|
);
|
|
917
|
-
const txMessageWithSigners = addSignersToTransactionMessage(
|
|
918
|
-
[newSigner, oldSigner],
|
|
919
|
-
txMessage
|
|
920
|
-
);
|
|
914
|
+
const txMessageWithSigners = addSignersToTransactionMessage([newSigner, oldSigner], txMessage);
|
|
921
915
|
const signedTx = await signTransactionMessageWithSigners(txMessageWithSigners);
|
|
922
916
|
const txSignature = getSignatureFromTransaction(signedTx);
|
|
923
917
|
const wsUrl = url.replace("https://", "wss://").replace("http://", "ws://");
|
|
@@ -983,7 +977,9 @@ var MODEL_ALIASES = {
|
|
|
983
977
|
// OpenAI
|
|
984
978
|
gpt: "openai/gpt-4o",
|
|
985
979
|
gpt4: "openai/gpt-4o",
|
|
986
|
-
gpt5: "openai/gpt-5.
|
|
980
|
+
gpt5: "openai/gpt-5.4",
|
|
981
|
+
"gpt-5.4": "openai/gpt-5.4",
|
|
982
|
+
"gpt-5.4-pro": "openai/gpt-5.4-pro",
|
|
987
983
|
codex: "openai/gpt-5.2-codex",
|
|
988
984
|
mini: "openai/gpt-4o-mini",
|
|
989
985
|
o1: "openai/o1",
|
|
@@ -1107,6 +1103,31 @@ var BLOCKRUN_MODELS = [
|
|
|
1107
1103
|
reasoning: true,
|
|
1108
1104
|
toolCalling: true
|
|
1109
1105
|
},
|
|
1106
|
+
// GPT-5.4 — newest flagship, same input price as 4o but much more capable
|
|
1107
|
+
{
|
|
1108
|
+
id: "openai/gpt-5.4",
|
|
1109
|
+
name: "GPT-5.4",
|
|
1110
|
+
version: "5.4",
|
|
1111
|
+
inputPrice: 2.5,
|
|
1112
|
+
outputPrice: 15,
|
|
1113
|
+
contextWindow: 4e5,
|
|
1114
|
+
maxOutput: 128e3,
|
|
1115
|
+
reasoning: true,
|
|
1116
|
+
vision: true,
|
|
1117
|
+
agentic: true,
|
|
1118
|
+
toolCalling: true
|
|
1119
|
+
},
|
|
1120
|
+
{
|
|
1121
|
+
id: "openai/gpt-5.4-pro",
|
|
1122
|
+
name: "GPT-5.4 Pro",
|
|
1123
|
+
version: "5.4",
|
|
1124
|
+
inputPrice: 30,
|
|
1125
|
+
outputPrice: 180,
|
|
1126
|
+
contextWindow: 4e5,
|
|
1127
|
+
maxOutput: 128e3,
|
|
1128
|
+
reasoning: true,
|
|
1129
|
+
toolCalling: true
|
|
1130
|
+
},
|
|
1110
1131
|
// OpenAI Codex Family
|
|
1111
1132
|
{
|
|
1112
1133
|
id: "openai/gpt-5.2-codex",
|
|
@@ -3046,8 +3067,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
3046
3067
|
"google/gemini-2.5-pro",
|
|
3047
3068
|
"deepseek/deepseek-chat",
|
|
3048
3069
|
"xai/grok-4-0709",
|
|
3049
|
-
"openai/gpt-5.
|
|
3050
|
-
//
|
|
3070
|
+
"openai/gpt-5.4",
|
|
3071
|
+
// Newest flagship, same price as 4o
|
|
3051
3072
|
"openai/gpt-4o",
|
|
3052
3073
|
"anthropic/claude-sonnet-4.6"
|
|
3053
3074
|
]
|
|
@@ -3113,6 +3134,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
3113
3134
|
primary: "anthropic/claude-opus-4.6",
|
|
3114
3135
|
// Best quality for complex tasks
|
|
3115
3136
|
fallback: [
|
|
3137
|
+
"openai/gpt-5.4",
|
|
3138
|
+
// Newest flagship
|
|
3116
3139
|
"openai/gpt-5.2-codex",
|
|
3117
3140
|
"anthropic/claude-opus-4.6",
|
|
3118
3141
|
"anthropic/claude-sonnet-4.6",
|
|
@@ -3160,7 +3183,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
3160
3183
|
fallback: [
|
|
3161
3184
|
"anthropic/claude-opus-4.6",
|
|
3162
3185
|
// Latest Opus - best agentic
|
|
3163
|
-
"openai/gpt-5.
|
|
3186
|
+
"openai/gpt-5.4",
|
|
3187
|
+
// Newest flagship
|
|
3164
3188
|
"google/gemini-3.1-pro",
|
|
3165
3189
|
// Newest Gemini
|
|
3166
3190
|
"google/gemini-3-pro-preview",
|
|
@@ -4116,13 +4140,21 @@ async function generateAndSaveWallet() {
|
|
|
4116
4140
|
{ cause: err }
|
|
4117
4141
|
);
|
|
4118
4142
|
}
|
|
4143
|
+
let solanaAddress;
|
|
4144
|
+
try {
|
|
4145
|
+
solanaAddress = await getSolanaAddress(derived.solanaPrivateKeyBytes);
|
|
4146
|
+
} catch {
|
|
4147
|
+
}
|
|
4119
4148
|
console.log(`[ClawRouter]`);
|
|
4120
4149
|
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`);
|
|
4121
4150
|
console.log(`[ClawRouter] NEW WALLET GENERATED \u2014 BACK UP YOUR KEY NOW`);
|
|
4122
4151
|
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`);
|
|
4123
|
-
console.log(`[ClawRouter] EVM Address
|
|
4124
|
-
|
|
4125
|
-
|
|
4152
|
+
console.log(`[ClawRouter] EVM Address : ${derived.evmAddress}`);
|
|
4153
|
+
if (solanaAddress) {
|
|
4154
|
+
console.log(`[ClawRouter] Solana Address : ${solanaAddress}`);
|
|
4155
|
+
}
|
|
4156
|
+
console.log(`[ClawRouter] Key file : ${WALLET_FILE}`);
|
|
4157
|
+
console.log(`[ClawRouter] Mnemonic : ${MNEMONIC_FILE}`);
|
|
4126
4158
|
console.log(`[ClawRouter]`);
|
|
4127
4159
|
console.log(`[ClawRouter] Both EVM (Base) and Solana wallets are ready.`);
|
|
4128
4160
|
console.log(`[ClawRouter] To back up, run in OpenClaw:`);
|
|
@@ -7090,13 +7122,24 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
7090
7122
|
`[ClawRouter] Context filter (~${estimatedTotalTokens} tokens): excluded ${contextExcluded.join(", ")}`
|
|
7091
7123
|
);
|
|
7092
7124
|
}
|
|
7093
|
-
|
|
7125
|
+
let toolFiltered = filterByToolCalling(contextFiltered, hasTools, supportsToolCalling);
|
|
7094
7126
|
const toolExcluded = contextFiltered.filter((m) => !toolFiltered.includes(m));
|
|
7095
7127
|
if (toolExcluded.length > 0) {
|
|
7096
7128
|
console.log(
|
|
7097
7129
|
`[ClawRouter] Tool-calling filter: excluded ${toolExcluded.join(", ")} (no structured function call support)`
|
|
7098
7130
|
);
|
|
7099
7131
|
}
|
|
7132
|
+
const TOOL_NONCOMPLIANT_MODELS = ["google/gemini-2.5-flash-lite"];
|
|
7133
|
+
if (hasTools && toolFiltered.length > 1) {
|
|
7134
|
+
const compliant = toolFiltered.filter((m) => !TOOL_NONCOMPLIANT_MODELS.includes(m));
|
|
7135
|
+
if (compliant.length > 0 && compliant.length < toolFiltered.length) {
|
|
7136
|
+
const dropped = toolFiltered.filter((m) => TOOL_NONCOMPLIANT_MODELS.includes(m));
|
|
7137
|
+
console.log(
|
|
7138
|
+
`[ClawRouter] Tool-compliance filter: excluded ${dropped.join(", ")} (unreliable tool schema handling)`
|
|
7139
|
+
);
|
|
7140
|
+
toolFiltered = compliant;
|
|
7141
|
+
}
|
|
7142
|
+
}
|
|
7100
7143
|
const visionFiltered = filterByVision(toolFiltered, hasVision, supportsVision);
|
|
7101
7144
|
const visionExcluded = toolFiltered.filter((m) => !visionFiltered.includes(m));
|
|
7102
7145
|
if (visionExcluded.length > 0) {
|