@blockrun/clawrouter 0.10.4 → 0.10.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/README.md +14 -14
- package/dist/cli.js +587 -21
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +80 -1
- package/dist/index.js +663 -18
- package/dist/index.js.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -738,6 +738,10 @@ type UsageEntry = {
|
|
|
738
738
|
baselineCost: number;
|
|
739
739
|
savings: number;
|
|
740
740
|
latencyMs: number;
|
|
741
|
+
/** Partner service ID (e.g., "x_users_lookup") — only set for partner API calls */
|
|
742
|
+
partnerId?: string;
|
|
743
|
+
/** Partner service name (e.g., "AttentionVC") — only set for partner API calls */
|
|
744
|
+
service?: string;
|
|
741
745
|
};
|
|
742
746
|
/**
|
|
743
747
|
* Log a usage entry as a JSON line.
|
|
@@ -991,6 +995,81 @@ declare function getStats(days?: number): Promise<AggregatedStats>;
|
|
|
991
995
|
*/
|
|
992
996
|
declare function formatStatsAscii(stats: AggregatedStats): string;
|
|
993
997
|
|
|
998
|
+
/**
|
|
999
|
+
* Partner Service Registry
|
|
1000
|
+
*
|
|
1001
|
+
* Defines available partner APIs that can be called through ClawRouter's proxy.
|
|
1002
|
+
* Partners provide specialized data (Twitter/X, etc.) via x402 micropayments.
|
|
1003
|
+
* The same wallet used for LLM calls pays for partner API calls — zero extra setup.
|
|
1004
|
+
*/
|
|
1005
|
+
type PartnerServiceParam = {
|
|
1006
|
+
name: string;
|
|
1007
|
+
type: "string" | "string[]" | "number";
|
|
1008
|
+
description: string;
|
|
1009
|
+
required: boolean;
|
|
1010
|
+
};
|
|
1011
|
+
type PartnerServiceDefinition = {
|
|
1012
|
+
/** Unique service ID used in tool names: blockrun_{id} */
|
|
1013
|
+
id: string;
|
|
1014
|
+
/** Human-readable name */
|
|
1015
|
+
name: string;
|
|
1016
|
+
/** Partner providing this service */
|
|
1017
|
+
partner: string;
|
|
1018
|
+
/** Short description for tool listing */
|
|
1019
|
+
description: string;
|
|
1020
|
+
/** Proxy path (relative to /v1) */
|
|
1021
|
+
proxyPath: string;
|
|
1022
|
+
/** HTTP method */
|
|
1023
|
+
method: "GET" | "POST";
|
|
1024
|
+
/** Parameters for the tool's JSON Schema */
|
|
1025
|
+
params: PartnerServiceParam[];
|
|
1026
|
+
/** Pricing info for display */
|
|
1027
|
+
pricing: {
|
|
1028
|
+
perUnit: string;
|
|
1029
|
+
unit: string;
|
|
1030
|
+
minimum: string;
|
|
1031
|
+
maximum: string;
|
|
1032
|
+
};
|
|
1033
|
+
/** Example usage for help text */
|
|
1034
|
+
example: {
|
|
1035
|
+
input: Record<string, unknown>;
|
|
1036
|
+
description: string;
|
|
1037
|
+
};
|
|
1038
|
+
};
|
|
1039
|
+
/**
|
|
1040
|
+
* All registered partner services.
|
|
1041
|
+
* New partners are added here — the rest of the system picks them up automatically.
|
|
1042
|
+
*/
|
|
1043
|
+
declare const PARTNER_SERVICES: PartnerServiceDefinition[];
|
|
1044
|
+
/**
|
|
1045
|
+
* Get a partner service by ID.
|
|
1046
|
+
*/
|
|
1047
|
+
declare function getPartnerService(id: string): PartnerServiceDefinition | undefined;
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Partner Tool Builder
|
|
1051
|
+
*
|
|
1052
|
+
* Converts partner service definitions into OpenClaw tool definitions.
|
|
1053
|
+
* Each tool's execute() calls through the local proxy which handles
|
|
1054
|
+
* x402 payment transparently using the same wallet.
|
|
1055
|
+
*/
|
|
1056
|
+
/** OpenClaw tool definition shape (duck-typed) */
|
|
1057
|
+
type PartnerToolDefinition = {
|
|
1058
|
+
name: string;
|
|
1059
|
+
description: string;
|
|
1060
|
+
inputSchema: {
|
|
1061
|
+
type: "object";
|
|
1062
|
+
properties: Record<string, unknown>;
|
|
1063
|
+
required: string[];
|
|
1064
|
+
};
|
|
1065
|
+
execute: (args: Record<string, unknown>) => Promise<unknown>;
|
|
1066
|
+
};
|
|
1067
|
+
/**
|
|
1068
|
+
* Build OpenClaw tool definitions for all registered partner services.
|
|
1069
|
+
* @param proxyBaseUrl - Local proxy base URL (e.g., "http://127.0.0.1:8402")
|
|
1070
|
+
*/
|
|
1071
|
+
declare function buildPartnerTools(proxyBaseUrl: string): PartnerToolDefinition[];
|
|
1072
|
+
|
|
994
1073
|
/**
|
|
995
1074
|
* @blockrun/clawrouter
|
|
996
1075
|
*
|
|
@@ -1012,4 +1091,4 @@ declare function formatStatsAscii(stats: AggregatedStats): string;
|
|
|
1012
1091
|
|
|
1013
1092
|
declare const plugin: OpenClawPluginDefinition;
|
|
1014
1093
|
|
|
1015
|
-
export { type AggregatedStats, BALANCE_THRESHOLDS, BLOCKRUN_MODELS, type BalanceInfo, BalanceMonitor, type CachedLLMResponse, type CachedPaymentParams, type CachedResponse, DEFAULT_RETRY_CONFIG, DEFAULT_ROUTING_CONFIG, DEFAULT_SESSION_CONFIG, type DailyStats, EmptyWalletError, InsufficientFundsError, type InsufficientFundsInfo, type LowBalanceInfo, MODEL_ALIASES, OPENCLAW_MODELS, PaymentCache, type PaymentFetchResult, type PreAuthParams, type ProxyHandle, type ProxyOptions, RequestDeduplicator, ResponseCache, type ResponseCacheConfig, type RetryConfig, type RoutingConfig, type RoutingDecision, RpcError, type SessionConfig, type SessionEntry, SessionStore, type SufficiencyResult, type Tier, type UsageEntry, blockrunProvider, buildProviderModels, calculateModelCost, createPaymentFetch, plugin as default, fetchWithRetry, formatStatsAscii, getAgenticModels, getFallbackChain, getFallbackChainFiltered, getModelContextWindow, getProxyPort, getSessionId, getStats, isAgenticModel, isBalanceError, isEmptyWalletError, isInsufficientFundsError, isRetryable, isRpcError, logUsage, resolveModelAlias, route, startProxy };
|
|
1094
|
+
export { type AggregatedStats, BALANCE_THRESHOLDS, BLOCKRUN_MODELS, type BalanceInfo, BalanceMonitor, type CachedLLMResponse, type CachedPaymentParams, type CachedResponse, DEFAULT_RETRY_CONFIG, DEFAULT_ROUTING_CONFIG, DEFAULT_SESSION_CONFIG, type DailyStats, EmptyWalletError, InsufficientFundsError, type InsufficientFundsInfo, type LowBalanceInfo, MODEL_ALIASES, OPENCLAW_MODELS, PARTNER_SERVICES, type PartnerServiceDefinition, type PartnerToolDefinition, PaymentCache, type PaymentFetchResult, type PreAuthParams, type ProxyHandle, type ProxyOptions, RequestDeduplicator, ResponseCache, type ResponseCacheConfig, type RetryConfig, type RoutingConfig, type RoutingDecision, RpcError, type SessionConfig, type SessionEntry, SessionStore, type SufficiencyResult, type Tier, type UsageEntry, blockrunProvider, buildPartnerTools, buildProviderModels, calculateModelCost, createPaymentFetch, plugin as default, fetchWithRetry, formatStatsAscii, getAgenticModels, getFallbackChain, getFallbackChainFiltered, getModelContextWindow, getPartnerService, getProxyPort, getSessionId, getStats, isAgenticModel, isBalanceError, isEmptyWalletError, isInsufficientFundsError, isRetryable, isRpcError, logUsage, resolveModelAlias, route, startProxy };
|