@blockrun/clawrouter 0.12.264 → 0.12.266
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/README.md +15 -1
- package/dist/cli.js +1396 -388
- package/dist/index.d.ts +52 -16
- package/dist/index.js +1114 -359
- package/docs/clawrouter-cuts-llm-api-costs-500x.md +1 -1
- package/docs/configuration.md +26 -24
- package/docs/troubleshooting.md +6 -2
- package/openclaw.plugin.json +7 -6
- package/package.json +4 -2
- package/scripts/reinstall.sh +181 -77
- package/scripts/uninstall.sh +53 -8
- package/scripts/update.ps1 +215 -33
- package/scripts/update.sh +223 -86
- package/scripts/sync-brand-numbers.mjs +0 -270
package/dist/index.d.ts
CHANGED
|
@@ -359,6 +359,9 @@ type OpenClawPluginDefinition = {
|
|
|
359
359
|
};
|
|
360
360
|
};
|
|
361
361
|
|
|
362
|
+
/** OpenClaw's bundled router owns `clawrouter`; BlockRun must never claim it. */
|
|
363
|
+
declare const BLOCKRUN_PLUGIN_ID = "blockrun-clawrouter";
|
|
364
|
+
|
|
362
365
|
/**
|
|
363
366
|
* Response Cache for LLM Completions
|
|
364
367
|
*
|
|
@@ -617,6 +620,13 @@ type PolicyList = "allowedPayees" | "blockedPayees" | "allowedNetworks" | "allow
|
|
|
617
620
|
declare const CAIP2_BASE = "eip155:8453";
|
|
618
621
|
/** Solana mainnet genesis, as carried on x402 `selectedRequirements.network`. */
|
|
619
622
|
declare const CAIP2_SOLANA_MAINNET = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d";
|
|
623
|
+
/**
|
|
624
|
+
* Every network the proxy can pay on, as carried on x402
|
|
625
|
+
* `selectedRequirements.network`. Single source of truth for surfaces that
|
|
626
|
+
* validate `allowedNetworks` entries: an entry outside this set can never
|
|
627
|
+
* match a quote and would only block payments.
|
|
628
|
+
*/
|
|
629
|
+
declare const PAYABLE_NETWORKS: readonly string[];
|
|
620
630
|
/**
|
|
621
631
|
* A policy list on disk is present but unusable. Thrown rather than swallowed:
|
|
622
632
|
* silently dropping a corrupted allow/deny list would widen what the agent may
|
|
@@ -694,6 +704,14 @@ interface SpendControlStorage {
|
|
|
694
704
|
* back to save() when absent.
|
|
695
705
|
*/
|
|
696
706
|
saveHistory?(history: SpendRecord[]): void;
|
|
707
|
+
/**
|
|
708
|
+
* Optional: persist limits without touching stored history — the mirror of
|
|
709
|
+
* saveHistory(). A policy edit from a second process (the CLI) must not
|
|
710
|
+
* write its own stale history snapshot back over spend the proxy recorded
|
|
711
|
+
* since, which would reopen a rolling window. Falls back to save() when
|
|
712
|
+
* absent.
|
|
713
|
+
*/
|
|
714
|
+
saveLimits?(limits: SpendLimits, expect?: SpendLimits): void;
|
|
697
715
|
}
|
|
698
716
|
declare class FileSpendControlStorage implements SpendControlStorage {
|
|
699
717
|
private readonly spendingFile;
|
|
@@ -713,6 +731,14 @@ declare class FileSpendControlStorage implements SpendControlStorage {
|
|
|
713
731
|
* erase an operator's hand-edit to spending.json seconds after they made it.
|
|
714
732
|
*/
|
|
715
733
|
saveHistory(history: SpendRecord[]): void;
|
|
734
|
+
/**
|
|
735
|
+
* Persist limits while leaving the stored history exactly as it is on disk.
|
|
736
|
+
* With `expect`, refuse when the stored limits are no longer the ones the
|
|
737
|
+
* writer read — a stale instance must not replace another writer's edit.
|
|
738
|
+
* The re-read happens immediately before the atomic rename, so the race
|
|
739
|
+
* window is the write itself, not the whole command.
|
|
740
|
+
*/
|
|
741
|
+
saveLimits(limits: SpendLimits, expect?: SpendLimits): void;
|
|
716
742
|
}
|
|
717
743
|
declare class InMemorySpendControlStorage implements SpendControlStorage {
|
|
718
744
|
private data;
|
|
@@ -724,6 +750,7 @@ declare class InMemorySpendControlStorage implements SpendControlStorage {
|
|
|
724
750
|
limits: SpendLimits;
|
|
725
751
|
history: SpendRecord[];
|
|
726
752
|
}): void;
|
|
753
|
+
saveLimits(limits: SpendLimits, expect?: SpendLimits): void;
|
|
727
754
|
}
|
|
728
755
|
interface SpendControlOptions {
|
|
729
756
|
storage?: SpendControlStorage;
|
|
@@ -738,6 +765,8 @@ declare class SpendControl {
|
|
|
738
765
|
private reservationSeq;
|
|
739
766
|
/** Limits we loaded and have not changed; history-only saves must not clobber operator edits. */
|
|
740
767
|
private limitsDirty;
|
|
768
|
+
/** The limits this instance last read from or wrote to storage — the compare-and-swap baseline. */
|
|
769
|
+
private diskLimits;
|
|
741
770
|
/** Set when spending.json held an unusable policy list: refuse every payment. */
|
|
742
771
|
private policyFileBroken?;
|
|
743
772
|
private readonly storage;
|
|
@@ -748,6 +777,13 @@ declare class SpendControl {
|
|
|
748
777
|
setPolicy(list: PolicyList, values: string[]): void;
|
|
749
778
|
clearPolicy(list: PolicyList): void;
|
|
750
779
|
getLimits(): SpendLimits;
|
|
780
|
+
/**
|
|
781
|
+
* Why spending.json could not be loaded, or undefined when it is usable.
|
|
782
|
+
* While set, every setter mutates memory only: save() refuses to rewrite a
|
|
783
|
+
* file it could not fully parse, so callers must check this before
|
|
784
|
+
* reporting a change as applied.
|
|
785
|
+
*/
|
|
786
|
+
getPolicyFileError(): string | undefined;
|
|
751
787
|
check(estimatedCost: number, counterparty?: CounterpartyInfo): CheckResult;
|
|
752
788
|
record(amount: number, metadata?: {
|
|
753
789
|
model?: string;
|
|
@@ -1004,6 +1040,12 @@ type ProxyOptions = {
|
|
|
1004
1040
|
paymentChain?: PaymentChain;
|
|
1005
1041
|
/** Port to listen on (default: 8402) */
|
|
1006
1042
|
port?: number;
|
|
1043
|
+
/**
|
|
1044
|
+
* Reuse a compatible process already listening on the requested port.
|
|
1045
|
+
* Desktop disables this because it must only configure agents against a
|
|
1046
|
+
* process whose lifecycle it owns.
|
|
1047
|
+
*/
|
|
1048
|
+
allowExistingProxy?: boolean;
|
|
1007
1049
|
routingConfig?: Partial<RoutingConfig>;
|
|
1008
1050
|
/** Request timeout in ms (default: 180000 = 3 minutes). Covers on-chain tx + LLM response. */
|
|
1009
1051
|
requestTimeoutMs?: number;
|
|
@@ -1106,21 +1148,21 @@ type ProxyHandle = {
|
|
|
1106
1148
|
declare function startProxy(options: ProxyOptions): Promise<ProxyHandle>;
|
|
1107
1149
|
|
|
1108
1150
|
/**
|
|
1109
|
-
* Resolve wallet key:
|
|
1110
|
-
* Also loads
|
|
1151
|
+
* Resolve wallet key: migrate legacy files → explicit env → Core → legacy → generate.
|
|
1152
|
+
* Also loads Core Solana material or a legacy mnemonic-derived key when available.
|
|
1111
1153
|
* Called by index.ts before the auth wizard runs.
|
|
1112
1154
|
*/
|
|
1113
1155
|
type WalletResolution = {
|
|
1114
1156
|
key: string;
|
|
1115
1157
|
address: string;
|
|
1116
|
-
source: "saved" | "env" | "config" | "generated";
|
|
1158
|
+
source: "core" | "saved" | "env" | "config" | "generated";
|
|
1117
1159
|
mnemonic?: string;
|
|
1118
1160
|
solanaPrivateKeyBytes?: Uint8Array;
|
|
1119
1161
|
};
|
|
1120
1162
|
/**
|
|
1121
1163
|
* Set up Solana wallet for existing EVM-only users.
|
|
1122
1164
|
* Generates a new mnemonic for Solana key derivation.
|
|
1123
|
-
* NEVER
|
|
1165
|
+
* NEVER changes the existing Base wallet.
|
|
1124
1166
|
*/
|
|
1125
1167
|
declare function setupSolana(): Promise<{
|
|
1126
1168
|
mnemonic: string;
|
|
@@ -1324,6 +1366,9 @@ declare class RequestDeduplicator {
|
|
|
1324
1366
|
private prune;
|
|
1325
1367
|
}
|
|
1326
1368
|
|
|
1369
|
+
/** Derive the Solana seed at m/44'/501'/0'/0' using SLIP-0010 Ed25519. */
|
|
1370
|
+
declare function deriveSolanaKeyBytes(mnemonic: string): Uint8Array;
|
|
1371
|
+
|
|
1327
1372
|
/**
|
|
1328
1373
|
* Wallet Key Derivation
|
|
1329
1374
|
*
|
|
@@ -1355,17 +1400,7 @@ declare function deriveEvmKey(mnemonic: string): {
|
|
|
1355
1400
|
privateKey: `0x${string}`;
|
|
1356
1401
|
address: string;
|
|
1357
1402
|
};
|
|
1358
|
-
|
|
1359
|
-
* Derive 32-byte Solana private key using SLIP-10 Ed25519 derivation.
|
|
1360
|
-
* Path: m/44'/501'/0'/0' (Phantom / Solflare / Backpack compatible)
|
|
1361
|
-
*
|
|
1362
|
-
* Algorithm (SLIP-0010 for Ed25519):
|
|
1363
|
-
* 1. Master: HMAC-SHA512(key="ed25519 seed", data=bip39_seed) → IL=key, IR=chainCode
|
|
1364
|
-
* 2. For each hardened child index:
|
|
1365
|
-
* HMAC-SHA512(key=chainCode, data=0x00 || key || ser32(index)) → split again
|
|
1366
|
-
* 3. Final IL (32 bytes) = Ed25519 private key seed
|
|
1367
|
-
*/
|
|
1368
|
-
declare function deriveSolanaKeyBytes(mnemonic: string): Uint8Array;
|
|
1403
|
+
|
|
1369
1404
|
/**
|
|
1370
1405
|
* Derive both EVM and Solana keys from a single mnemonic.
|
|
1371
1406
|
*/
|
|
@@ -1729,6 +1764,7 @@ declare function parseCallArgs(raw: string): {
|
|
|
1729
1764
|
* Delegates to the local proxy (which handles x402 payment).
|
|
1730
1765
|
*/
|
|
1731
1766
|
declare function buildImageGenerationProvider(): ImageGenerationProviderPlugin;
|
|
1767
|
+
|
|
1732
1768
|
declare const plugin: OpenClawPluginDefinition;
|
|
1733
1769
|
|
|
1734
|
-
export { type AggregatedStats, BALANCE_THRESHOLDS, BLOCKRUN_MODELS, type BalanceInfo, BalanceMonitor, CAIP2_BASE, CAIP2_SOLANA_MAINNET, type CachedLLMResponse, type CachedResponse, type CheckResult, type CounterpartyInfo, DEFAULT_RETRY_CONFIG, DEFAULT_SESSION_CONFIG, type DailyStats, type DerivedKeys, EmptyWalletError, FileSpendControlStorage, InMemorySpendControlStorage, InsufficientFundsError, type InsufficientFundsInfo, type LowBalanceInfo, MODEL_ALIASES, MalformedSpendPolicyError, OPENCLAW_MODELS, PARTNER_SERVICES, type PartnerServiceDefinition, type PartnerToolDefinition, type PaymentChain, type PolicyList, type ProxyHandle, type ProxyOptions, RequestDeduplicator, ResponseCache, type ResponseCacheConfig, type RetryConfig, RpcError, type SessionConfig, type SessionEntry, SessionStore, type SolanaBalanceInfo, SolanaBalanceMonitor, SpendControl, type SpendControlOptions, type SpendControlStorage, type SpendLimits, SpendPolicyError, type SpendRecord, type SpendWindow, type SpendingStatus, type SufficiencyResult, type UsageEntry, VISIBLE_OPENCLAW_MODELS, type WalletConfig, type WalletResolution, blockrunProvider, buildImageGenerationProvider, buildPartnerTools, buildProviderModels, clearStats, plugin as default, deriveAllKeys, deriveEvmKey, deriveSolanaKeyBytes, fetchWithRetry, formatDuration, formatStatsAscii, generateWalletMnemonic, getAgenticModels, getModelContextWindow, getPartnerService, getProxyPort, getSessionId, getStats, hashRequestContent, injectAuthProfile, injectModelsConfig, isAgenticModel, isBalanceError, isBlockrunWebSearchDisabled, isEmptyWalletError, isInsufficientFundsError, isRetryable, isRpcError, isValidMnemonic, loadPaymentChain, logUsage, parseCallArgs, registerSpendPolicyHook, resolveModelAlias, resolvePaymentChain, savePaymentChain, setupSolana, startProxy, syncAgentModelCache };
|
|
1770
|
+
export { type AggregatedStats, BALANCE_THRESHOLDS, BLOCKRUN_MODELS, BLOCKRUN_PLUGIN_ID, type BalanceInfo, BalanceMonitor, CAIP2_BASE, CAIP2_SOLANA_MAINNET, type CachedLLMResponse, type CachedResponse, type CheckResult, type CounterpartyInfo, DEFAULT_RETRY_CONFIG, DEFAULT_SESSION_CONFIG, type DailyStats, type DerivedKeys, EmptyWalletError, FileSpendControlStorage, InMemorySpendControlStorage, InsufficientFundsError, type InsufficientFundsInfo, type LowBalanceInfo, MODEL_ALIASES, MalformedSpendPolicyError, OPENCLAW_MODELS, PARTNER_SERVICES, PAYABLE_NETWORKS, type PartnerServiceDefinition, type PartnerToolDefinition, type PaymentChain, type PolicyList, type ProxyHandle, type ProxyOptions, RequestDeduplicator, ResponseCache, type ResponseCacheConfig, type RetryConfig, RpcError, type SessionConfig, type SessionEntry, SessionStore, type SolanaBalanceInfo, SolanaBalanceMonitor, SpendControl, type SpendControlOptions, type SpendControlStorage, type SpendLimits, SpendPolicyError, type SpendRecord, type SpendWindow, type SpendingStatus, type SufficiencyResult, type UsageEntry, VISIBLE_OPENCLAW_MODELS, type WalletConfig, type WalletResolution, blockrunProvider, buildImageGenerationProvider, buildPartnerTools, buildProviderModels, clearStats, plugin as default, deriveAllKeys, deriveEvmKey, deriveSolanaKeyBytes, fetchWithRetry, formatDuration, formatStatsAscii, generateWalletMnemonic, getAgenticModels, getModelContextWindow, getPartnerService, getProxyPort, getSessionId, getStats, hashRequestContent, injectAuthProfile, injectModelsConfig, isAgenticModel, isBalanceError, isBlockrunWebSearchDisabled, isEmptyWalletError, isInsufficientFundsError, isRetryable, isRpcError, isValidMnemonic, loadPaymentChain, logUsage, parseCallArgs, registerSpendPolicyHook, resolveModelAlias, resolvePaymentChain, savePaymentChain, setupSolana, startProxy, syncAgentModelCache };
|