@blockrun/franklin 3.30.1 → 3.32.0
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/agent/commands.js +72 -2
- package/dist/agent/compact.js +1 -1
- package/dist/agent/evaluator.js +1 -1
- package/dist/agent/llm.d.ts +1 -1
- package/dist/agent/llm.js +64 -19
- package/dist/agent/loop.js +23 -4
- package/dist/agent/optimize.js +10 -0
- package/dist/agent/permissions.js +17 -0
- package/dist/agent/tokens.js +23 -2
- package/dist/agent/turn-analyzer.js +1 -1
- package/dist/agent/types.d.ts +24 -0
- package/dist/agent/verification.js +1 -1
- package/dist/commands/predict.d.ts +10 -0
- package/dist/commands/predict.js +143 -0
- package/dist/commands/slack.js +1 -1
- package/dist/commands/social.js +1 -1
- package/dist/commands/start.js +24 -7
- package/dist/commands/telegram.js +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +6 -0
- package/dist/index.js +12 -0
- package/dist/learnings/extractor.js +2 -2
- package/dist/market/client.d.ts +69 -0
- package/dist/market/client.js +230 -0
- package/dist/plugin-sdk/workflow.js +3 -3
- package/dist/pricing.js +27 -6
- package/dist/proxy/fallback.js +1 -1
- package/dist/proxy/server.js +6 -86
- package/dist/router/index.js +14 -13
- package/dist/router/vision.js +15 -3
- package/dist/serve/server.js +4 -1
- package/dist/tools/agent-talent.d.ts +15 -0
- package/dist/tools/agent-talent.js +116 -0
- package/dist/tools/defillama.js +6 -5
- package/dist/tools/index.d.ts +15 -0
- package/dist/tools/index.js +28 -0
- package/dist/tools/moa.js +3 -3
- package/dist/tools/prediction.js +11 -10
- package/dist/tools/subagent.js +1 -1
- package/dist/tools/trading.js +3 -2
- package/dist/ui/model-picker.d.ts +26 -1
- package/dist/ui/model-picker.js +107 -38
- package/package.json +2 -2
package/dist/pricing.js
CHANGED
|
@@ -8,36 +8,53 @@ export const MODEL_PRICING = {
|
|
|
8
8
|
// their parser mapping promotes them to Auto upstream of cost estimation.
|
|
9
9
|
'blockrun/auto': { input: 0.8, output: 4.0 },
|
|
10
10
|
'blockrun/free': { input: 0, output: 0 },
|
|
11
|
-
// FREE — BlockRun gateway free tier (refreshed 2026-
|
|
12
|
-
|
|
11
|
+
// FREE — BlockRun gateway free tier (refreshed 2026-07-11 to match live /v1/models).
|
|
12
|
+
// qwen3-next-80b-a3b-instruct is the current free default (cleanest instruction-
|
|
13
|
+
// following — verified live: no thinking leak, no markdown fences, reliable).
|
|
14
|
+
'nvidia/qwen3-next-80b-a3b-instruct': { input: 0, output: 0 },
|
|
15
|
+
'nvidia/qwen3.5-122b-a10b': { input: 0, output: 0 },
|
|
13
16
|
'nvidia/nemotron-3-nano-omni-30b-a3b-reasoning': { input: 0, output: 0 },
|
|
17
|
+
'nvidia/mistral-nemotron': { input: 0, output: 0 },
|
|
18
|
+
'nvidia/step-3.7-flash': { input: 0, output: 0 },
|
|
19
|
+
'nvidia/seed-oss-36b': { input: 0, output: 0 },
|
|
20
|
+
'nvidia/nemotron-nano-9b-v2': { input: 0, output: 0 },
|
|
21
|
+
'nvidia/nemotron-nano-12b-v2-vl': { input: 0, output: 0 },
|
|
22
|
+
'nvidia/llama-4-maverick': { input: 0, output: 0 },
|
|
23
|
+
'nvidia/mistral-large-3-675b': { input: 0, output: 0 },
|
|
24
|
+
// Retired free models (kept at 0 for legacy session-cost records; gateway no
|
|
25
|
+
// longer serves these — do NOT route to them).
|
|
26
|
+
'nvidia/deepseek-v4-flash': { input: 0, output: 0 },
|
|
14
27
|
'nvidia/glm-4.7': { input: 0, output: 0 },
|
|
15
28
|
'nvidia/qwen3-next-80b-a3b-thinking': { input: 0, output: 0 },
|
|
16
29
|
'nvidia/qwen3-coder-480b': { input: 0, output: 0 },
|
|
17
30
|
'nvidia/mistral-small-4-119b': { input: 0, output: 0 },
|
|
18
|
-
'nvidia/llama-4-maverick': { input: 0, output: 0 },
|
|
19
31
|
'nvidia/deepseek-v3.2': { input: 0, output: 0 },
|
|
20
|
-
// Retired (kept at 0 for legacy session-cost records; gateway no longer serves these).
|
|
21
32
|
'nvidia/gpt-oss-120b': { input: 0, output: 0 },
|
|
22
33
|
'nvidia/gpt-oss-20b': { input: 0, output: 0 },
|
|
23
34
|
'nvidia/nemotron-ultra-253b': { input: 0, output: 0 },
|
|
24
35
|
'nvidia/devstral-2-123b': { input: 0, output: 0 },
|
|
25
36
|
'nvidia/nemotron-3-super-120b': { input: 0, output: 0 },
|
|
26
37
|
'nvidia/nemotron-super-49b': { input: 0, output: 0 },
|
|
27
|
-
'nvidia/mistral-large-3-675b': { input: 0, output: 0 },
|
|
28
38
|
// Anthropic
|
|
29
|
-
'anthropic/claude-
|
|
39
|
+
'anthropic/claude-fable-5': { input: 10.0, output: 50.0 }, // Mythos-class tier above Opus, 1M ctx
|
|
30
40
|
'anthropic/claude-opus-4.8': { input: 5.0, output: 25.0 },
|
|
31
41
|
'anthropic/claude-opus-4.7': { input: 5.0, output: 25.0 },
|
|
32
42
|
'anthropic/claude-opus-4.6': { input: 5.0, output: 25.0 },
|
|
43
|
+
'anthropic/claude-opus-4.5': { input: 5.0, output: 25.0 },
|
|
44
|
+
'anthropic/claude-sonnet-5': { input: 3.0, output: 15.0 }, // near-Opus at Sonnet cost, 1M ctx
|
|
45
|
+
'anthropic/claude-sonnet-4.6': { input: 3.0, output: 15.0 },
|
|
46
|
+
'anthropic/claude-sonnet-4.5': { input: 3.0, output: 15.0 },
|
|
33
47
|
'anthropic/claude-haiku-4.5': { input: 1.0, output: 5.0 },
|
|
34
48
|
'anthropic/claude-haiku-4.5-20251001': { input: 1.0, output: 5.0 },
|
|
35
49
|
// OpenAI
|
|
36
50
|
'openai/gpt-5-nano': { input: 0.05, output: 0.4 },
|
|
37
51
|
'openai/gpt-4.1-nano': { input: 0.1, output: 0.4 },
|
|
38
52
|
'openai/gpt-4o-mini': { input: 0.15, output: 0.6 },
|
|
53
|
+
'openai/gpt-5.4-nano': { input: 0.2, output: 1.25 },
|
|
39
54
|
'openai/gpt-5-mini': { input: 0.25, output: 2.0 },
|
|
40
55
|
'openai/gpt-4.1-mini': { input: 0.4, output: 1.6 },
|
|
56
|
+
'openai/gpt-5.4-mini': { input: 0.75, output: 4.5 },
|
|
57
|
+
'openai/gpt-5.6-luna': { input: 1.0, output: 6.0 }, // cost-efficient GPT-5.6 tier, 1M ctx
|
|
41
58
|
'openai/gpt-5.2': { input: 1.75, output: 14.0 },
|
|
42
59
|
'openai/gpt-5.3': { input: 1.75, output: 14.0 },
|
|
43
60
|
'openai/gpt-5.3-codex': { input: 1.75, output: 14.0 },
|
|
@@ -45,17 +62,21 @@ export const MODEL_PRICING = {
|
|
|
45
62
|
'openai/o3': { input: 2.0, output: 8.0 },
|
|
46
63
|
'openai/gpt-4o': { input: 2.5, output: 10.0 },
|
|
47
64
|
'openai/gpt-5.4': { input: 2.5, output: 15.0 },
|
|
65
|
+
'openai/gpt-5.6-terra': { input: 2.5, output: 15.0 }, // balanced GPT-5.6 tier, 1M ctx
|
|
48
66
|
'openai/o1-mini': { input: 1.1, output: 4.4 },
|
|
49
67
|
'openai/o3-mini': { input: 1.1, output: 4.4 },
|
|
50
68
|
'openai/o4-mini': { input: 1.1, output: 4.4 },
|
|
51
69
|
'openai/o1': { input: 15.0, output: 60.0 },
|
|
52
70
|
'openai/gpt-5.5': { input: 5.0, output: 30.0 },
|
|
71
|
+
'openai/gpt-5.6-sol': { input: 5.0, output: 30.0 }, // GPT-5.6 flagship, deepest reasoning, 1M ctx
|
|
53
72
|
'openai/gpt-5.2-pro': { input: 21.0, output: 168.0 },
|
|
54
73
|
'openai/gpt-5.4-pro': { input: 30.0, output: 180.0 },
|
|
55
74
|
// Google
|
|
56
75
|
'google/gemini-2.5-flash-lite': { input: 0.1, output: 0.4 },
|
|
76
|
+
'google/gemini-3.1-flash-lite': { input: 0.25, output: 1.5 },
|
|
57
77
|
'google/gemini-2.5-flash': { input: 0.3, output: 2.5 },
|
|
58
78
|
'google/gemini-3-flash-preview': { input: 0.5, output: 3.0 },
|
|
79
|
+
'google/gemini-3.5-flash': { input: 0.5, output: 3.0 }, // latest Flash w/ thinking, 1M ctx
|
|
59
80
|
'google/gemini-2.5-pro': { input: 1.25, output: 10.0 },
|
|
60
81
|
'google/gemini-3-pro-preview': { input: 2.0, output: 12.0 },
|
|
61
82
|
'google/gemini-3.1-pro': { input: 2.0, output: 12.0 },
|
package/dist/proxy/fallback.js
CHANGED
|
@@ -7,7 +7,7 @@ export const DEFAULT_FALLBACK_CONFIG = {
|
|
|
7
7
|
chain: [
|
|
8
8
|
'deepseek/deepseek-chat', // Direct fallback — cheap & reliable
|
|
9
9
|
'google/gemini-2.5-flash', // Fast & capable
|
|
10
|
-
'nvidia/
|
|
10
|
+
'nvidia/qwen3-next-80b-a3b-instruct', // Free model as ultimate fallback (reliable instruction-follower)
|
|
11
11
|
],
|
|
12
12
|
retryOn: [429, 500, 502, 503, 504, 529],
|
|
13
13
|
maxRetries: 5,
|
package/dist/proxy/server.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
2
|
import { getOrCreateWallet, getOrCreateSolanaWallet, createPaymentPayload, createSolanaPaymentPayload, parsePaymentRequired, extractPaymentDetails, solanaKeyToBytes, SOLANA_NETWORK, } from '@blockrun/llm';
|
|
3
3
|
import { recordUsage } from '../stats/tracker.js';
|
|
4
|
+
// Single source of truth for shortcuts — shared with the /model picker so the
|
|
5
|
+
// proxy can never drift from the interactive UI (it did before: grok→grok-3).
|
|
6
|
+
import { MODEL_SHORTCUTS } from '../ui/model-picker.js';
|
|
4
7
|
import { appendSettlementRow } from '../stats/cost-log.js';
|
|
5
8
|
import { appendAudit } from '../stats/audit.js';
|
|
6
9
|
import { buildFallbackChain, DEFAULT_FALLBACK_CONFIG, ROUTING_PROFILES, } from './fallback.js';
|
|
@@ -87,92 +90,9 @@ function trackOutputTokens(model, tokens) {
|
|
|
87
90
|
}
|
|
88
91
|
lastOutputByModel.set(model, tokens);
|
|
89
92
|
}
|
|
90
|
-
// Model shortcuts for quick switching
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// `eco` / `premium` aliases retained for back-compat with proxy clients;
|
|
94
|
-
// they parse to Auto downstream.
|
|
95
|
-
auto: 'blockrun/auto',
|
|
96
|
-
smart: 'blockrun/auto',
|
|
97
|
-
eco: 'blockrun/auto',
|
|
98
|
-
premium: 'blockrun/auto',
|
|
99
|
-
// Anthropic
|
|
100
|
-
sonnet: 'anthropic/claude-sonnet-4.6',
|
|
101
|
-
claude: 'anthropic/claude-sonnet-4.6',
|
|
102
|
-
'sonnet-4.6': 'anthropic/claude-sonnet-4.6',
|
|
103
|
-
opus: 'anthropic/claude-opus-4.8',
|
|
104
|
-
'opus-4.8': 'anthropic/claude-opus-4.8',
|
|
105
|
-
'opus-4.7': 'anthropic/claude-opus-4.7',
|
|
106
|
-
'opus-4.6': 'anthropic/claude-opus-4.6',
|
|
107
|
-
haiku: 'anthropic/claude-haiku-4.5-20251001',
|
|
108
|
-
'haiku-4.5': 'anthropic/claude-haiku-4.5-20251001',
|
|
109
|
-
// OpenAI
|
|
110
|
-
// `gpt` / `gpt5` / `gpt-5` follow the gateway's flagship — currently 5.5.
|
|
111
|
-
gpt: 'openai/gpt-5.5',
|
|
112
|
-
gpt5: 'openai/gpt-5.5',
|
|
113
|
-
'gpt-5': 'openai/gpt-5.5',
|
|
114
|
-
'gpt-5.5': 'openai/gpt-5.5',
|
|
115
|
-
'gpt-5.4': 'openai/gpt-5.4',
|
|
116
|
-
'gpt-5.4-pro': 'openai/gpt-5.4-pro',
|
|
117
|
-
'gpt-5.3': 'openai/gpt-5.3',
|
|
118
|
-
'gpt-5.2': 'openai/gpt-5.2',
|
|
119
|
-
'gpt-5.2-pro': 'openai/gpt-5.2-pro',
|
|
120
|
-
'gpt-4.1': 'openai/gpt-4.1',
|
|
121
|
-
codex: 'openai/gpt-5.3-codex',
|
|
122
|
-
nano: 'openai/gpt-5-nano',
|
|
123
|
-
mini: 'openai/gpt-5-mini',
|
|
124
|
-
o3: 'openai/o3',
|
|
125
|
-
o4: 'openai/o4-mini',
|
|
126
|
-
'o4-mini': 'openai/o4-mini',
|
|
127
|
-
o1: 'openai/o1',
|
|
128
|
-
// Google
|
|
129
|
-
gemini: 'google/gemini-2.5-pro',
|
|
130
|
-
'gemini-2.5': 'google/gemini-2.5-pro',
|
|
131
|
-
flash: 'google/gemini-2.5-flash',
|
|
132
|
-
'gemini-3': 'google/gemini-3.1-pro',
|
|
133
|
-
'gemini-3.1': 'google/gemini-3.1-pro',
|
|
134
|
-
// xAI
|
|
135
|
-
grok: 'xai/grok-3',
|
|
136
|
-
'grok-3': 'xai/grok-3',
|
|
137
|
-
'grok-4': 'xai/grok-4-0709',
|
|
138
|
-
'grok-fast': 'xai/grok-4-1-fast-reasoning',
|
|
139
|
-
'grok-4.1': 'xai/grok-4-1-fast-reasoning',
|
|
140
|
-
// DeepSeek
|
|
141
|
-
deepseek: 'deepseek/deepseek-chat',
|
|
142
|
-
r1: 'deepseek/deepseek-reasoner',
|
|
143
|
-
// Free models (agent-tested gateway free tier — refreshed 2026-04)
|
|
144
|
-
free: 'nvidia/llama-4-maverick',
|
|
145
|
-
glm4: 'nvidia/llama-4-maverick',
|
|
146
|
-
'deepseek-free': 'nvidia/llama-4-maverick',
|
|
147
|
-
'qwen-coder': 'nvidia/llama-4-maverick',
|
|
148
|
-
'qwen-think': 'nvidia/llama-4-maverick',
|
|
149
|
-
maverick: 'nvidia/llama-4-maverick',
|
|
150
|
-
'gpt-oss': 'nvidia/llama-4-maverick',
|
|
151
|
-
'gpt-oss-small': 'nvidia/llama-4-maverick',
|
|
152
|
-
'mistral-small': 'nvidia/llama-4-maverick',
|
|
153
|
-
// Retired/unreliable gateway-model aliases (map to closest agent-tested current).
|
|
154
|
-
nemotron: 'nvidia/llama-4-maverick',
|
|
155
|
-
devstral: 'nvidia/llama-4-maverick',
|
|
156
|
-
// Minimax
|
|
157
|
-
minimax: 'minimax/minimax-m3',
|
|
158
|
-
'm3': 'minimax/minimax-m3',
|
|
159
|
-
'm2.7': 'minimax/minimax-m2.7',
|
|
160
|
-
// Others
|
|
161
|
-
glm: 'zai/glm-5.2',
|
|
162
|
-
'glm-5.2': 'zai/glm-5.2',
|
|
163
|
-
// glm-5.1 demoted to back-compat pin 2026-06 (flagship is 5.2) — still routes.
|
|
164
|
-
'glm-5.1': 'zai/glm-5.1',
|
|
165
|
-
'glm-turbo': 'zai/glm-5-turbo',
|
|
166
|
-
'glm5': 'zai/glm-5.2',
|
|
167
|
-
kimi: 'moonshot/kimi-k2.7',
|
|
168
|
-
'k2.7': 'moonshot/kimi-k2.7',
|
|
169
|
-
// K2.6 demoted 2026-06 (flagship is K2.7) but still routes — `k2.6` pins it.
|
|
170
|
-
'k2.6': 'moonshot/kimi-k2.6',
|
|
171
|
-
// K2.5 retired — aliases resolve to the current flagship for muscle memory.
|
|
172
|
-
'kimi-k2.5': 'moonshot/kimi-k2.7',
|
|
173
|
-
'k2.5': 'moonshot/kimi-k2.7',
|
|
174
|
-
};
|
|
175
|
-
// Model pricing now uses shared source from src/pricing.ts
|
|
93
|
+
// Model shortcuts for quick switching — imported from ui/model-picker.ts (the
|
|
94
|
+
// single source of truth) so the proxy and the interactive /model picker can
|
|
95
|
+
// never drift apart. Model pricing likewise comes from src/pricing.ts.
|
|
176
96
|
function detectModelSwitch(parsed) {
|
|
177
97
|
if (!parsed.messages || parsed.messages.length === 0)
|
|
178
98
|
return null;
|
package/dist/router/index.js
CHANGED
|
@@ -319,7 +319,7 @@ function classicRouteRequest(prompt, profile, needsVision = false) {
|
|
|
319
319
|
// llama-4-maverick: clean one-word classification output. glm-4.7 + qwen-
|
|
320
320
|
// thinking emit reasoning into thinking blocks and leave text empty under
|
|
321
321
|
// tight max_tokens — fine for chat, wrong shape for single-word dispatch.
|
|
322
|
-
const CLASSIFIER_MODEL = process.env.FRANKLIN_ROUTER_MODEL || 'nvidia/
|
|
322
|
+
const CLASSIFIER_MODEL = process.env.FRANKLIN_ROUTER_MODEL || 'nvidia/qwen3-next-80b-a3b-instruct';
|
|
323
323
|
const CLASSIFIER_TIMEOUT_MS = 2_500;
|
|
324
324
|
const CLASSIFIER_SYSTEM = `You classify a user's message into ONE routing tier for a CLI agent. Reply with EXACTLY ONE WORD from the allowed set. No explanation, no punctuation, no quotes.
|
|
325
325
|
|
|
@@ -447,7 +447,7 @@ export function resolveTierToModel(tier, profile = 'auto', needsVision = false)
|
|
|
447
447
|
// line; revisit hard-falling to it if a real user hits this path.)
|
|
448
448
|
if (profile === 'free') {
|
|
449
449
|
return {
|
|
450
|
-
model: 'nvidia/
|
|
450
|
+
model: 'nvidia/qwen3-next-80b-a3b-instruct',
|
|
451
451
|
tier: 'SIMPLE',
|
|
452
452
|
confidence: 1.0,
|
|
453
453
|
signals: needsVision ? ['free-profile', 'vision-unsupported'] : ['free-profile'],
|
|
@@ -479,7 +479,7 @@ export function routeRequest(prompt, profile = 'auto', needsVision = false) {
|
|
|
479
479
|
// Free profile — always use free model
|
|
480
480
|
if (profile === 'free') {
|
|
481
481
|
return {
|
|
482
|
-
model: 'nvidia/
|
|
482
|
+
model: 'nvidia/qwen3-next-80b-a3b-instruct',
|
|
483
483
|
tier: 'SIMPLE',
|
|
484
484
|
confidence: 1.0,
|
|
485
485
|
signals: needsVision ? ['free-profile', 'vision-unsupported'] : ['free-profile'],
|
|
@@ -575,20 +575,21 @@ export function getFallbackChain(tier, profile = 'auto') {
|
|
|
575
575
|
// behind maverick rather than leading.
|
|
576
576
|
// 2026-06-07: nvidia/glm-4.7 dropped from every chain — NVIDIA NIM hung, the
|
|
577
577
|
// gateway redirected it to a now-dead model, so routing to it just wasted a slot.
|
|
578
|
-
// 2026-
|
|
579
|
-
// (
|
|
580
|
-
//
|
|
578
|
+
// 2026-07-11: nvidia/deepseek-v4-flash removed — the gateway no longer serves
|
|
579
|
+
// it (410). Free tier is now led by nvidia/qwen3-next-80b-a3b-instruct (cleanest
|
|
580
|
+
// free instruction-follower — no thinking leak / markdown fences, verified live),
|
|
581
|
+
// with nvidia/llama-4-maverick kept as a DIFFERENT-family fallback for resilience.
|
|
581
582
|
const FREE_MODELS_BY_CATEGORY = {
|
|
582
|
-
coding: ['nvidia/
|
|
583
|
-
trading: ['nvidia/
|
|
584
|
-
research: ['nvidia/
|
|
585
|
-
reasoning: ['nvidia/
|
|
586
|
-
chat: ['nvidia/
|
|
587
|
-
creative: ['nvidia/
|
|
583
|
+
coding: ['nvidia/qwen3-next-80b-a3b-instruct', 'nvidia/llama-4-maverick'],
|
|
584
|
+
trading: ['nvidia/qwen3-next-80b-a3b-instruct', 'nvidia/llama-4-maverick'],
|
|
585
|
+
research: ['nvidia/qwen3-next-80b-a3b-instruct', 'nvidia/llama-4-maverick'],
|
|
586
|
+
reasoning: ['nvidia/qwen3-next-80b-a3b-instruct', 'nvidia/llama-4-maverick'],
|
|
587
|
+
chat: ['nvidia/qwen3-next-80b-a3b-instruct', 'nvidia/llama-4-maverick'],
|
|
588
|
+
creative: ['nvidia/qwen3-next-80b-a3b-instruct', 'nvidia/llama-4-maverick'],
|
|
588
589
|
};
|
|
589
590
|
const DEFAULT_FREE_CHAIN = [
|
|
591
|
+
'nvidia/qwen3-next-80b-a3b-instruct',
|
|
590
592
|
'nvidia/llama-4-maverick',
|
|
591
|
-
'nvidia/deepseek-v4-flash',
|
|
592
593
|
];
|
|
593
594
|
/**
|
|
594
595
|
* Pick the next free model to try given the question category and which
|
package/dist/router/vision.js
CHANGED
|
@@ -20,22 +20,32 @@
|
|
|
20
20
|
*/
|
|
21
21
|
const VISION_MODELS = new Set([
|
|
22
22
|
// Anthropic — native vision across the line
|
|
23
|
+
'anthropic/claude-fable-5',
|
|
23
24
|
'anthropic/claude-opus-4.8',
|
|
24
25
|
'anthropic/claude-opus-4.7',
|
|
25
26
|
'anthropic/claude-opus-4.6',
|
|
27
|
+
'anthropic/claude-opus-4.5',
|
|
28
|
+
'anthropic/claude-sonnet-5',
|
|
26
29
|
'anthropic/claude-sonnet-4.6',
|
|
30
|
+
'anthropic/claude-sonnet-4.5',
|
|
27
31
|
'anthropic/claude-haiku-4.5-20251001',
|
|
28
|
-
// OpenAI — multimodal flagships + o3 (Codex 5.3 is text-only, excluded)
|
|
32
|
+
// OpenAI — multimodal flagships + o3 (Codex 5.3 is text-only, excluded).
|
|
33
|
+
// GPT-5.6 family + 5.4-mini are vision; 5.4-nano is text-only.
|
|
34
|
+
'openai/gpt-5.6-sol',
|
|
35
|
+
'openai/gpt-5.6-terra',
|
|
36
|
+
'openai/gpt-5.6-luna',
|
|
29
37
|
'openai/gpt-5.5',
|
|
30
38
|
'openai/gpt-5.4',
|
|
31
39
|
'openai/gpt-5.4-pro',
|
|
40
|
+
'openai/gpt-5.4-mini',
|
|
32
41
|
'openai/gpt-5.2',
|
|
33
42
|
'openai/gpt-5.2-pro',
|
|
34
43
|
'openai/gpt-5-mini',
|
|
35
44
|
'openai/gpt-4.1',
|
|
36
45
|
'openai/o3',
|
|
37
|
-
// Google — vision baked into every Gemini SKU we surface
|
|
46
|
+
// Google — vision baked into every Gemini SKU we surface (flash-lite excepted)
|
|
38
47
|
'google/gemini-3.1-pro',
|
|
48
|
+
'google/gemini-3.5-flash',
|
|
39
49
|
'google/gemini-2.5-pro',
|
|
40
50
|
'google/gemini-2.5-flash',
|
|
41
51
|
// xAI — only Grok 4 base supports vision; grok-4-1-fast-reasoning is text-only
|
|
@@ -44,8 +54,10 @@ const VISION_MODELS = new Set([
|
|
|
44
54
|
// Moonshot — K2.7 (flagship) + K2.6 are multimodal (image + video input)
|
|
45
55
|
'moonshot/kimi-k2.7',
|
|
46
56
|
'moonshot/kimi-k2.6',
|
|
47
|
-
// NVIDIA inference — Llama 4 Maverick
|
|
57
|
+
// NVIDIA inference — Llama 4 Maverick + Nemotron Nano VL are multimodal;
|
|
58
|
+
// deepseek/qwen-coder are not.
|
|
48
59
|
'nvidia/llama-4-maverick',
|
|
60
|
+
'nvidia/nemotron-nano-12b-v2-vl',
|
|
49
61
|
]);
|
|
50
62
|
/** Does this concrete gateway model accept image input? */
|
|
51
63
|
export function isVisionModel(modelId) {
|
package/dist/serve/server.js
CHANGED
|
@@ -32,7 +32,10 @@ import { readSwaps } from '../stats/swap-log.js';
|
|
|
32
32
|
import { isCloudSyncEnabled, cloudList, cloudSync } from './cloud-sync.js';
|
|
33
33
|
import { setupAgentWallet, setupAgentSolanaWallet } from '@blockrun/llm';
|
|
34
34
|
import { retryFetchBalance } from '../commands/balance-retry.js';
|
|
35
|
-
|
|
35
|
+
// qwen3-next-80b-a3b-instruct: cleanest free instruction-follower (no thinking
|
|
36
|
+
// leak / markdown fences — verified live 2026-07-11). Replaces the EOL'd
|
|
37
|
+
// nvidia/deepseek-v4-flash the gateway no longer serves.
|
|
38
|
+
const FREE_DEFAULT_MODEL = 'nvidia/qwen3-next-80b-a3b-instruct';
|
|
36
39
|
// Curated Base (chainId 8453) tokens for the wallet "holdings" view. Plain RPC
|
|
37
40
|
// can't enumerate every token an address holds (no on-chain "list all"), so we
|
|
38
41
|
// balanceOf a known set and show the non-zero ones. `stable` → USD ≈ amount.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agent_talent — hire paid AI skills from the BlockRun agent marketplace.
|
|
3
|
+
*
|
|
4
|
+
* The autonomous counterpart to the `/market` slash command: where `/market`
|
|
5
|
+
* lets a human browse and hire, this capability lets the agent discover and
|
|
6
|
+
* hire talent mid-task. `action: "list"` returns the catalog (free GET);
|
|
7
|
+
* `action: "run"` hires a skill by slug, signing ONE standard `exact` x402
|
|
8
|
+
* USDC payment from the user wallet on Base (only on a successful run), and
|
|
9
|
+
* returns the skill's output plus the USD paid.
|
|
10
|
+
*
|
|
11
|
+
* Both actions delegate to src/market/client.ts, the single payment path
|
|
12
|
+
* shared with the command — see that file for the x402 details.
|
|
13
|
+
*/
|
|
14
|
+
import type { CapabilityHandler } from '../agent/types.js';
|
|
15
|
+
export declare const agentTalentCapability: CapabilityHandler;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agent_talent — hire paid AI skills from the BlockRun agent marketplace.
|
|
3
|
+
*
|
|
4
|
+
* The autonomous counterpart to the `/market` slash command: where `/market`
|
|
5
|
+
* lets a human browse and hire, this capability lets the agent discover and
|
|
6
|
+
* hire talent mid-task. `action: "list"` returns the catalog (free GET);
|
|
7
|
+
* `action: "run"` hires a skill by slug, signing ONE standard `exact` x402
|
|
8
|
+
* USDC payment from the user wallet on Base (only on a successful run), and
|
|
9
|
+
* returns the skill's output plus the USD paid.
|
|
10
|
+
*
|
|
11
|
+
* Both actions delegate to src/market/client.ts, the single payment path
|
|
12
|
+
* shared with the command — see that file for the x402 details.
|
|
13
|
+
*/
|
|
14
|
+
import { fetchCatalog, runMarketSkill, fmtUsd } from '../market/client.js';
|
|
15
|
+
import { recordUsage } from '../stats/tracker.js';
|
|
16
|
+
import { frameUntrusted } from './untrusted.js';
|
|
17
|
+
import { logger } from '../logger.js';
|
|
18
|
+
// A model-facing line per skill: enough to choose, not a wall of text.
|
|
19
|
+
function listLine(s) {
|
|
20
|
+
const type = s.execution_type === 'agent' && s.data_sources?.length
|
|
21
|
+
? `live-data(${s.data_sources.join(',')})`
|
|
22
|
+
: s.execution_type;
|
|
23
|
+
const sample = s.sample_input ? ` | e.g. ${JSON.stringify(s.sample_input)}` : '';
|
|
24
|
+
const by = s.creator?.x ? ` | by @${s.creator.x}` : '';
|
|
25
|
+
return `- ${s.slug} — ${s.name} [${type}] ${fmtUsd(s.price_usd)}/run${by}\n ${s.description}${sample}`;
|
|
26
|
+
}
|
|
27
|
+
export const agentTalentCapability = {
|
|
28
|
+
spec: {
|
|
29
|
+
name: 'agent_talent',
|
|
30
|
+
description: 'Browse and hire paid AI skills ("talents") from the BlockRun agent marketplace — specialized agents other creators published. ' +
|
|
31
|
+
'action="list" returns the catalog for free. Use it whenever the user asks you to find, search, browse, or recommend an agent / skill / talent for some domain or task (pass their topic as `query`), OR when you yourself need talent for a sub-task you cannot do well (live market/on-chain data, a domain-specific analysis, a niche transform). ' +
|
|
32
|
+
'`query` filters by name, description, and data source; the match is semantic on your part — map the user\'s intent (e.g. "track gas prices" -> "gas", a request in any language) to a sensible keyword. Omit `query` to list the most popular. ' +
|
|
33
|
+
'action="run" hires one skill by `slug` with your `input`: it signs ONE standard USDC x402 payment from the user wallet on Base and returns the skill\'s output. ' +
|
|
34
|
+
'The wallet is charged automatically and ONLY on a successful run (the response reports the USD paid); a failed run is free. ' +
|
|
35
|
+
'Prefer listing first to get the exact slug and price before running.',
|
|
36
|
+
input_schema: {
|
|
37
|
+
type: 'object',
|
|
38
|
+
properties: {
|
|
39
|
+
action: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
enum: ['list', 'run'],
|
|
42
|
+
description: '"list" to browse/search the catalog (free); "run" to hire a skill (paid).',
|
|
43
|
+
},
|
|
44
|
+
query: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'For list: optional keyword filter over name, description, and data sources.',
|
|
47
|
+
},
|
|
48
|
+
slug: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
description: 'For run: the skill slug to hire (get it from list).',
|
|
51
|
+
},
|
|
52
|
+
input: {
|
|
53
|
+
type: 'string',
|
|
54
|
+
description: 'For run: the input text to send the skill.',
|
|
55
|
+
},
|
|
56
|
+
limit: {
|
|
57
|
+
type: 'number',
|
|
58
|
+
description: 'For list: max skills to return (default 20, max 200).',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
required: ['action'],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
// list is a free read; run signs a payment. Only the read is parallel-safe.
|
|
65
|
+
isConcurrentSafe: (input) => input.action === 'list',
|
|
66
|
+
async execute(input, ctx) {
|
|
67
|
+
const raw = input;
|
|
68
|
+
const action = typeof raw.action === 'string' ? raw.action.toLowerCase() : '';
|
|
69
|
+
if (action === 'list') {
|
|
70
|
+
try {
|
|
71
|
+
const limit = Math.min(Math.max(typeof raw.limit === 'number' ? raw.limit : 20, 1), 200);
|
|
72
|
+
const skills = await fetchCatalog({
|
|
73
|
+
limit,
|
|
74
|
+
query: typeof raw.query === 'string' ? raw.query : undefined,
|
|
75
|
+
signal: ctx.abortSignal,
|
|
76
|
+
});
|
|
77
|
+
if (skills.length === 0) {
|
|
78
|
+
return { output: raw.query ? `No marketplace skills match "${raw.query}".` : 'The marketplace has no runnable skills right now.' };
|
|
79
|
+
}
|
|
80
|
+
const head = raw.query
|
|
81
|
+
? `BlockRun agent talents — ${skills.length} skill(s) matching "${raw.query}":`
|
|
82
|
+
: `BlockRun agent talents — ${skills.length} skill(s):`;
|
|
83
|
+
const body = frameUntrusted('BlockRun marketplace catalog (untrusted, creator-authored)', skills.map(listLine).join('\n'));
|
|
84
|
+
const out = `${head}\n${body}\n\nTo hire one: agent_talent { action: "run", slug: "<slug>", input: "<input>" }.`;
|
|
85
|
+
return { output: out, fullOutput: out };
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
return { output: `Could not reach the marketplace: ${err.message}`, isError: true };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (action === 'run') {
|
|
92
|
+
const slug = typeof raw.slug === 'string' ? raw.slug.trim() : '';
|
|
93
|
+
const userInput = typeof raw.input === 'string' ? raw.input : '';
|
|
94
|
+
if (!slug)
|
|
95
|
+
return { output: 'Error: `slug` is required for action="run" (list first to find it).', isError: true };
|
|
96
|
+
if (!userInput.trim())
|
|
97
|
+
return { output: 'Error: `input` is required for action="run".', isError: true };
|
|
98
|
+
const outcome = await runMarketSkill(slug, userInput, { signal: ctx.abortSignal });
|
|
99
|
+
try {
|
|
100
|
+
recordUsage(`agent_talent:${slug}`, 0, 0, outcome.paidUsd, 0);
|
|
101
|
+
}
|
|
102
|
+
catch { /* best-effort telemetry */ }
|
|
103
|
+
if (!outcome.ok) {
|
|
104
|
+
logger.warn(`[franklin] agent_talent run ${slug} failed (${outcome.status}): ${outcome.error}`);
|
|
105
|
+
return {
|
|
106
|
+
output: `Hiring "${slug}" failed: ${outcome.error ?? `HTTP ${outcome.status}`}. No charge (the marketplace settles only on success).`,
|
|
107
|
+
isError: true,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const receipt = `Hired ${slug} — paid ${fmtUsd(outcome.paidUsd)}${outcome.txHash ? ` (tx ${outcome.txHash.slice(0, 10)}…)` : ''}`;
|
|
111
|
+
const out = `${receipt}\n\n${frameUntrusted('BlockRun marketplace skill output (untrusted, third-party)', outcome.result ?? '')}`;
|
|
112
|
+
return { output: out, fullOutput: out };
|
|
113
|
+
}
|
|
114
|
+
return { output: `Error: unknown action "${raw.action}". Use "list" or "run".`, isError: true };
|
|
115
|
+
},
|
|
116
|
+
};
|
package/dist/tools/defillama.js
CHANGED
|
@@ -19,6 +19,7 @@ import { getOrCreateWallet, getOrCreateSolanaWallet, createPaymentPayload, creat
|
|
|
19
19
|
import { loadChain, API_URLS, VERSION } from '../config.js';
|
|
20
20
|
import { logger } from '../logger.js';
|
|
21
21
|
import { recordUsage } from '../stats/tracker.js';
|
|
22
|
+
import { frameUntrusted } from './untrusted.js';
|
|
22
23
|
const TIMEOUT_MS = 30_000;
|
|
23
24
|
// ─── Shared GET-with-x402 flow ────────────────────────────────────────────
|
|
24
25
|
async function getWithPayment(path, ctx) {
|
|
@@ -187,7 +188,7 @@ export const defiLlamaProtocolsCapability = {
|
|
|
187
188
|
const change = p.change_1d != null ? ` · 24h ${formatPct(p.change_1d)}` : '';
|
|
188
189
|
lines.push(`${i + 1}. **${p.name}** (${p.slug}) — ${formatUsd(Number(p.tvl))}${cat}${change}\n chains: ${chains}${more}`);
|
|
189
190
|
});
|
|
190
|
-
return { output: lines.join('\n') };
|
|
191
|
+
return { output: frameUntrusted('DefiLlama data (untrusted)', lines.join('\n')) };
|
|
191
192
|
}
|
|
192
193
|
catch (err) {
|
|
193
194
|
return { output: `Error: ${err.message}`, isError: true };
|
|
@@ -248,7 +249,7 @@ export const defiLlamaProtocolCapability = {
|
|
|
248
249
|
lines.push(`Audits: ${p.audits}`);
|
|
249
250
|
if (p.description)
|
|
250
251
|
lines.push('', p.description);
|
|
251
|
-
return { output: lines.join('\n') };
|
|
252
|
+
return { output: frameUntrusted('DefiLlama data (untrusted)', lines.join('\n')) };
|
|
252
253
|
}
|
|
253
254
|
catch (err) {
|
|
254
255
|
return { output: `Error: ${err.message}`, isError: true };
|
|
@@ -280,7 +281,7 @@ export const defiLlamaChainsCapability = {
|
|
|
280
281
|
const sym = c.tokenSymbol ? ` (${c.tokenSymbol})` : '';
|
|
281
282
|
lines.push(`${i + 1}. **${c.name}**${sym} — ${formatUsd(Number(c.tvl))}`);
|
|
282
283
|
});
|
|
283
|
-
return { output: lines.join('\n') };
|
|
284
|
+
return { output: frameUntrusted('DefiLlama data (untrusted)', lines.join('\n')) };
|
|
284
285
|
}
|
|
285
286
|
catch (err) {
|
|
286
287
|
return { output: `Error: ${err.message}`, isError: true };
|
|
@@ -354,7 +355,7 @@ export const defiLlamaYieldsCapability = {
|
|
|
354
355
|
const il = p.ilRisk ? ` · IL: ${p.ilRisk}` : '';
|
|
355
356
|
lines.push(`${i + 1}. **${p.project}** / ${p.chain} / ${p.symbol} — ${(p.apy ?? 0).toFixed(2)}% APY${breakdown}\n TVL: ${formatUsd(p.tvlUsd)}${il} · pool: ${p.pool}`);
|
|
356
357
|
});
|
|
357
|
-
return { output: lines.join('\n') };
|
|
358
|
+
return { output: frameUntrusted('DefiLlama data (untrusted)', lines.join('\n')) };
|
|
358
359
|
}
|
|
359
360
|
catch (err) {
|
|
360
361
|
return { output: `Error: ${err.message}`, isError: true };
|
|
@@ -409,7 +410,7 @@ export const defiLlamaPriceCapability = {
|
|
|
409
410
|
const ts = entry.timestamp ? ` · ${new Date(entry.timestamp * 1000).toISOString().slice(0, 19)}Z` : '';
|
|
410
411
|
lines.push(`- **${id}**${sym}: $${entry.price.toFixed(entry.price < 0.01 ? 8 : 4)}${conf}${ts}`);
|
|
411
412
|
}
|
|
412
|
-
return { output: lines.join('\n') };
|
|
413
|
+
return { output: frameUntrusted('DefiLlama data (untrusted)', lines.join('\n')) };
|
|
413
414
|
}
|
|
414
415
|
catch (err) {
|
|
415
416
|
return { output: `Error: ${err.message}`, isError: true };
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -21,4 +21,19 @@ export declare function resetToolSessionState(): void;
|
|
|
21
21
|
/** All capabilities available to the Franklin agent (excluding sub-agent, which needs config). */
|
|
22
22
|
export declare const allCapabilities: CapabilityHandler[];
|
|
23
23
|
export { readCapability, writeCapability, editCapability, bashCapability, globCapability, grepCapability, webFetchCapability, webSearchCapability, taskCapability, detachCapability, };
|
|
24
|
+
/**
|
|
25
|
+
* "Franklin prediction mode" toolset.
|
|
26
|
+
*
|
|
27
|
+
* A deliberately tight, research-only capability set for forecasting a single
|
|
28
|
+
* real-world event the way a careful bettor would: gather current facts, read
|
|
29
|
+
* sources, check live prediction-market odds and a little market data — then
|
|
30
|
+
* decide. Everything else (filesystem, shell, media generation, swaps/trade
|
|
31
|
+
* execution, phone/voice, GPU sandbox, posting) is intentionally excluded:
|
|
32
|
+
* a forecaster looks things up, it does not act on the world or spend beyond
|
|
33
|
+
* the cheap read calls these tools make.
|
|
34
|
+
*
|
|
35
|
+
* Used by the `franklin predict` command and reusable by any headless caller
|
|
36
|
+
* (e.g. franklin.bet) that wants a grounded prediction.
|
|
37
|
+
*/
|
|
38
|
+
export declare const predictionCapabilities: CapabilityHandler[];
|
|
24
39
|
export { createSubAgentCapability } from './subagent.js';
|
package/dist/tools/index.js
CHANGED
|
@@ -35,6 +35,7 @@ import { predictionMarketCapability } from './prediction.js';
|
|
|
35
35
|
import { polymarketBetCapability } from './polymarket-bet.js';
|
|
36
36
|
import { modalCapabilities } from './modal.js';
|
|
37
37
|
import { blockrunCapability } from './blockrun.js';
|
|
38
|
+
import { agentTalentCapability } from './agent-talent.js';
|
|
38
39
|
import { surfCapabilities } from './surf.js';
|
|
39
40
|
import { realFaceCapability } from './realface.js';
|
|
40
41
|
import { listPhoneNumbersCapability, buyPhoneNumberCapability, renewPhoneNumberCapability, releasePhoneNumberCapability, phoneLookupCapability, phoneFraudCheckCapability, } from './phone.js';
|
|
@@ -173,6 +174,7 @@ export const allCapabilities = [
|
|
|
173
174
|
predictionMarketCapability, // Polymarket / Kalshi / matching / smart money via Predexon (read-only research)
|
|
174
175
|
polymarketBetCapability, // PolymarketBet — real-money betting execution: setup/fund/buy/sell/redeem/withdraw (CLOB V2)
|
|
175
176
|
blockrunCapability, // Generic x402-paid gateway primitive — future partners + long-tail Surf paths
|
|
177
|
+
agentTalentCapability, // Hire paid skills from the BlockRun agent marketplace (business.blockrun.ai)
|
|
176
178
|
...surfCapabilities, // SurfMarket / SurfChain / SurfSocial — endpoint-enum function tools (no path guessing, auto x402)
|
|
177
179
|
// Phone & Voice — typed surface so the agent pattern-matches on the user
|
|
178
180
|
// intent ("buy a number", "make a call") without needing to consult the
|
|
@@ -194,4 +196,30 @@ export const allCapabilities = [
|
|
|
194
196
|
...modalCapabilities, // ModalCreate, ModalExec, ModalStatus, ModalTerminate
|
|
195
197
|
];
|
|
196
198
|
export { readCapability, writeCapability, editCapability, bashCapability, globCapability, grepCapability, webFetchCapability, webSearchCapability, taskCapability, detachCapability, };
|
|
199
|
+
/**
|
|
200
|
+
* "Franklin prediction mode" toolset.
|
|
201
|
+
*
|
|
202
|
+
* A deliberately tight, research-only capability set for forecasting a single
|
|
203
|
+
* real-world event the way a careful bettor would: gather current facts, read
|
|
204
|
+
* sources, check live prediction-market odds and a little market data — then
|
|
205
|
+
* decide. Everything else (filesystem, shell, media generation, swaps/trade
|
|
206
|
+
* execution, phone/voice, GPU sandbox, posting) is intentionally excluded:
|
|
207
|
+
* a forecaster looks things up, it does not act on the world or spend beyond
|
|
208
|
+
* the cheap read calls these tools make.
|
|
209
|
+
*
|
|
210
|
+
* Used by the `franklin predict` command and reusable by any headless caller
|
|
211
|
+
* (e.g. franklin.bet) that wants a grounded prediction.
|
|
212
|
+
*/
|
|
213
|
+
export const predictionCapabilities = [
|
|
214
|
+
webSearchCapability, // web_search — current news & facts
|
|
215
|
+
webFetchCapability, // webfetch — read a specific source URL
|
|
216
|
+
exaSearchCapability, // exa search — higher-quality web research
|
|
217
|
+
exaAnswerCapability, // exa answer — direct sourced answers
|
|
218
|
+
exaReadUrlsCapability, // exa read — pull full text of found URLs
|
|
219
|
+
searchXCapability, // search X — live sentiment / breaking signal
|
|
220
|
+
predictionMarketCapability, // search_prediction_markets — live implied odds
|
|
221
|
+
tradingSignalCapability, // market signal/indicators (for market-type events)
|
|
222
|
+
tradingMarketCapability, // market snapshot data
|
|
223
|
+
defiLlamaPriceCapability, // token price lookup (crypto-type events)
|
|
224
|
+
];
|
|
197
225
|
export { createSubAgentCapability } from './subagent.js';
|
package/dist/tools/moa.js
CHANGED
|
@@ -14,13 +14,13 @@ import { ModelClient } from '../agent/llm.js';
|
|
|
14
14
|
// ─── Configuration ────────────────────────────────────────────────────────
|
|
15
15
|
/** Reference models — diverse, cheap/free models for parallel queries. */
|
|
16
16
|
const REFERENCE_MODELS = [
|
|
17
|
-
'nvidia/
|
|
18
|
-
'nvidia/
|
|
17
|
+
'nvidia/qwen3-next-80b-a3b-instruct', // Free, clean instruction-follower
|
|
18
|
+
'nvidia/llama-4-maverick', // Free, agent-tested general chat (diverse family)
|
|
19
19
|
'google/gemini-2.5-flash', // Fast, cheap
|
|
20
20
|
'deepseek/deepseek-chat', // Cheap, good reasoning
|
|
21
21
|
];
|
|
22
22
|
/** Aggregator model — free by default. Users explicitly pass `aggregator` to upgrade. */
|
|
23
|
-
const AGGREGATOR_MODEL = 'nvidia/
|
|
23
|
+
const AGGREGATOR_MODEL = 'nvidia/qwen3-next-80b-a3b-instruct';
|
|
24
24
|
/** Max tokens per reference response. */
|
|
25
25
|
const REFERENCE_MAX_TOKENS = 4096;
|
|
26
26
|
/** Max tokens for aggregator. */
|