@blockrun/franklin 3.49.15 → 3.49.17

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 CHANGED
@@ -45,7 +45,7 @@
45
45
 
46
46
  ## The pitch in one paragraph
47
47
 
48
- Franklin Agent is an **autonomous economic agent** — an AI that holds a USDC wallet and spends it to get real work done, with **trading as its flagship arena**. It buys live market data, proposes trade plans you approve before a cent moves, pursues long-running goals across sessions, keeps a wallet-bound trading journal, and picks the best model per task from <!-- br:models.chatVisible -->88<!-- /br:models.chatVisible --> models. You state an outcome and set a budget. Franklin Agent decides what to call, what to pay for, and when to stop. No subscriptions, no seats, no rate limits.
48
+ Franklin Agent is an **autonomous economic agent** — an AI that holds a USDC wallet and spends it to get real work done, with **trading as its flagship arena**. It buys live market data, proposes trade plans you approve before a cent moves, pursues long-running goals across sessions, keeps a wallet-bound trading journal, and picks the best model per task from <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> models. You state an outcome and set a budget. Franklin Agent decides what to call, what to pay for, and when to stop. No subscriptions, no seats, no rate limits.
49
49
 
50
50
  Funding it is your choice. Fund a **USDC wallet** and every paid action routes through the [x402](https://x402.org) micropayment protocol, settling on-chain against a wallet only you control — no signup, no account, the wallet is the identity. Or top up a **prepaid balance** at [user.blockrun.ai](https://user.blockrun.ai) and hand Franklin an API key. Same models, same tools, same agent. See [Two ways to pay](#two-ways-to-pay).
51
51
 
@@ -387,7 +387,7 @@ Every tool call is itemized. Every token is priced. When the wallet hits zero, F
387
387
 
388
388
  ## Smart Router
389
389
 
390
- **<!-- br:models.chatVisible -->88<!-- /br:models.chatVisible --> models. One decision. Zero guesswork.**
390
+ **<!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> models. One decision. Zero guesswork.**
391
391
 
392
392
  You don't pick models. Franklin picks for you.
393
393
 
@@ -467,7 +467,7 @@ No email. No phone. No KYC. Your Solana, Base or Arc address is your account —
467
467
  | -------------------------------------- | ---------------- | ----------------------- | -------------------- | ------------------------------- |
468
468
  | **Spends money for you** | ❌ | ⚠️ you wire payments | ⚠️ trades only | ✅ **USDC wallet or prepaid key** |
469
469
  | **Buys data + APIs + images + search** | ❌ | ⚠️ one key per service | ❌ | ✅ **one wallet pays for all** |
470
- | Picks best model per task | ❌ single-vendor | ⚠️ you pick | ❌ | ✅ **Smart Router, <!-- br:models.chatVisible -->88<!-- /br:models.chatVisible --> models** |
470
+ | Picks best model per task | ❌ single-vendor | ⚠️ you pick | ❌ | ✅ **Smart Router, <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> models** |
471
471
  | **Money moves only on your approval** | — | ⚠️ build it yourself | ❌ runs on rules | ✅ **trade plan, every mode** |
472
472
  | Spend guardrails | — | ⚠️ build it yourself | ⚠️ per-bot limits | ✅ **budget caps + hooks** |
473
473
  | Works when a provider goes down | ❌ | ⚠️ if you code it | ❌ | ✅ **routes to another** |
@@ -494,14 +494,14 @@ Ask "what's BTC looking like?" — Franklin fetches live price data, computes RS
494
494
  **🎨 AI image generation**
495
495
  Ask "generate a logo" — Franklin calls DALL-E / GPT Image, saves the result locally, paid from your wallet.
496
496
 
497
- **🧠 <!-- br:models.chatVisible -->88<!-- /br:models.chatVisible --> models via one wallet**
497
+ **🧠 <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> models via one wallet**
498
498
  Anthropic, OpenAI, Google, xAI, DeepSeek, GLM, Kimi, Minimax, plus a free tier. One wallet, one interface, automatic fallback.
499
499
 
500
500
  **💳 x402 micropayments (YOPO)**
501
501
  HTTP 402 native. Every paid action is a signed USDC micropayment — an EIP-712 authorization on Base and Arc, a signed SPL transfer on Solana. Non-custodial: your keys never leave your machine. YOPO: you pay only for outcomes.
502
502
 
503
503
  **🧠 Learned model router**
504
- Trained on 2M+ real requests. Classifies your task and picks the best model from <!-- br:models.chatVisible -->88<!-- /br:models.chatVisible --> LLMs. Four profiles (auto/eco/premium/free). Adapts to your usage over time.
504
+ Trained on 2M+ real requests. Classifies your task and picks the best model from <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> LLMs. Four profiles (auto/eco/premium/free). Adapts to your usage over time.
505
505
 
506
506
  </td>
507
507
  <td width="50%" valign="top">
@@ -581,13 +581,13 @@ Found a vulnerability? Please report it privately — see [SECURITY.md](SECURITY
581
581
  │ Intent → Smart Router → Tool Use → Spend Control → Result │
582
582
  ├──────────────────────────────────────────────────────────────┤
583
583
  │ Learned Router │
584
- │ 2M+ requests · <!-- br:models.chatVisible@live -->88<!-- /br:models.chatVisible@live --> models · category detection · Elo scores │
584
+ │ 2M+ requests · <!-- br:models.chatVisible@live -->90<!-- /br:models.chatVisible@live --> models · category detection · Elo scores │
585
585
  ├──────────────────────────────────────────────────────────────┤
586
586
  │ Agent Loop │
587
587
  │ 60+ tools · Sessions · Compaction · Pricing · Plugin SDK │
588
588
  ├──────────────────────────────────────────────────────────────┤
589
589
  │ BlockRun Gateway │
590
- │ <!-- br:models.chatVisible@live -->88<!-- /br:models.chatVisible@live --> LLMs · CoinGecko · Search · Image APIs · paid services │
590
+ │ <!-- br:models.chatVisible@live -->90<!-- /br:models.chatVisible@live --> LLMs · CoinGecko · Search · Image APIs · paid services │
591
591
  ├──────────────────────────────────────────────────────────────┤
592
592
  │ x402 Micropayment Protocol │
593
593
  │ HTTP 402 · USDC on Solana, Base & Arc · signed payloads │
@@ -636,7 +636,7 @@ src/
636
636
  ├── stats/ Usage tracking + insights engine
637
637
  ├── ui/ Ink-based terminal UI
638
638
  ├── proxy/ Payment proxy for external tools
639
- ├── router/ Learned model router (<!-- br:models.chatVisible@live -->88<!-- /br:models.chatVisible@live --> models, Elo scoring)
639
+ ├── router/ Learned model router (<!-- br:models.chatVisible@live -->90<!-- /br:models.chatVisible@live --> models, Elo scoring)
640
640
  ├── wallet/ Wallet management (Base/Arc + Solana)
641
641
  ├── mcp/ MCP server auto-discovery
642
642
  └── commands/ CLI subcommands
@@ -52,6 +52,8 @@ export interface GatewayModel {
52
52
  name: string;
53
53
  description?: string;
54
54
  owned_by?: string;
55
+ available?: boolean;
56
+ release_date?: string;
55
57
  billing_mode: BillingMode;
56
58
  categories: string[];
57
59
  context_window?: number;
@@ -0,0 +1,10 @@
1
+ import type { GatewayModel } from '../gateway-models.js';
2
+ /** The models.list payload used by both Desktop and the browser UI. */
3
+ export declare function buildModelList(models: GatewayModel[]): {
4
+ id: string;
5
+ label: string;
6
+ free: boolean;
7
+ group: string;
8
+ provider: string;
9
+ contextWindow: number | undefined;
10
+ }[];
@@ -0,0 +1,40 @@
1
+ import { sortModelsNewestFirst } from '@blockrun/model-catalog';
2
+ // Keep company sections in the established picker order. Recency within each
3
+ // section belongs to Model Core, shared with the expanded terminal picker.
4
+ const PROVIDER_LABEL = {
5
+ anthropic: 'Anthropic', openai: 'OpenAI', azure: 'OpenAI', google: 'Google', 'google-vertex': 'Google',
6
+ xai: 'xAI', deepseek: 'DeepSeek', meta: 'Meta', 'meta-llama': 'Meta', nvidia: 'NVIDIA',
7
+ moonshot: 'Moonshot', moonshotai: 'Moonshot', qwen: 'Qwen', alibaba: 'Qwen', mistral: 'Mistral',
8
+ mistralai: 'Mistral', minimax: 'MiniMax', zhipu: 'Zhipu', bytedance: 'ByteDance', cohere: 'Cohere',
9
+ perplexity: 'Perplexity', amazon: 'Amazon', microsoft: 'Microsoft', '01-ai': 'Yi', ai21: 'AI21',
10
+ };
11
+ const PROVIDER_ORDER = ['Anthropic', 'OpenAI', 'Google', 'xAI', 'DeepSeek', 'Qwen', 'Moonshot', 'Meta', 'Mistral', 'MiniMax', 'NVIDIA'];
12
+ function providerLabel(id, ownedBy) {
13
+ const p = (id.split('/')[0] || ownedBy || '').toLowerCase();
14
+ return PROVIDER_LABEL[p] || (p ? p.charAt(0).toUpperCase() + p.slice(1) : 'Other');
15
+ }
16
+ /** The models.list payload used by both Desktop and the browser UI. */
17
+ export function buildModelList(models) {
18
+ const groups = new Map();
19
+ for (const model of models) {
20
+ if (model.available === false || !model.categories.includes('chat'))
21
+ continue;
22
+ const provider = providerLabel(model.id, model.owned_by);
23
+ const group = groups.get(provider) ?? [];
24
+ group.push(model);
25
+ groups.set(provider, group);
26
+ }
27
+ const rank = (provider) => {
28
+ const index = PROVIDER_ORDER.indexOf(provider);
29
+ return index < 0 ? PROVIDER_ORDER.length : index;
30
+ };
31
+ return [...groups].sort(([a], [b]) => rank(a) - rank(b) || a.localeCompare(b))
32
+ .flatMap(([provider, rows]) => sortModelsNewestFirst(rows).map(model => ({
33
+ id: model.id,
34
+ label: model.name,
35
+ free: model.billing_mode === 'free',
36
+ group: provider,
37
+ provider,
38
+ contextWindow: model.context_window,
39
+ })));
40
+ }
@@ -30,6 +30,7 @@ import { assembleInstructions } from '../agent/context.js';
30
30
  import { interactiveSession } from '../agent/loop.js';
31
31
  import { allCapabilities, createSubAgentCapability } from '../tools/index.js';
32
32
  import { getModelsByCategory } from '../gateway-models.js';
33
+ import { buildModelList } from './model-list.js';
33
34
  import { listSessions, loadSessionHistory } from '../session/storage.js';
34
35
  import { loadSdkSettlements } from '../stats/cost-log.js';
35
36
  import { readSwaps } from '../stats/swap-log.js';
@@ -144,26 +145,11 @@ const TOOL_LABELS = {
144
145
  function labelFor(name) {
145
146
  return TOOL_LABELS[name] ?? name;
146
147
  }
147
- // Model list grouping — by provider (company), like OpenRouter/Together. The
148
- // provider is the id's vendor prefix (e.g. "anthropic/claude-…"); PROVIDER_ORDER
149
- // puts the most-wanted vendors first, the rest fall in alphabetically.
150
- const PROVIDER_LABEL = {
151
- anthropic: 'Anthropic', openai: 'OpenAI', azure: 'OpenAI', google: 'Google', 'google-vertex': 'Google',
152
- xai: 'xAI', deepseek: 'DeepSeek', meta: 'Meta', 'meta-llama': 'Meta', nvidia: 'NVIDIA',
153
- moonshot: 'Moonshot', moonshotai: 'Moonshot', qwen: 'Qwen', alibaba: 'Qwen', mistral: 'Mistral',
154
- mistralai: 'Mistral', minimax: 'MiniMax', zhipu: 'Zhipu', bytedance: 'ByteDance', cohere: 'Cohere',
155
- perplexity: 'Perplexity', amazon: 'Amazon', microsoft: 'Microsoft', '01-ai': 'Yi', ai21: 'AI21',
156
- };
157
- const PROVIDER_ORDER = ['Anthropic', 'OpenAI', 'Google', 'xAI', 'DeepSeek', 'Qwen', 'Moonshot', 'Meta', 'Mistral', 'MiniMax', 'NVIDIA'];
158
148
  const MEDIA_MIME = {
159
149
  mp3: 'audio/mpeg', wav: 'audio/wav', m4a: 'audio/mp4', ogg: 'audio/ogg', flac: 'audio/flac',
160
150
  mp4: 'video/mp4', webm: 'video/webm',
161
151
  png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', webp: 'image/webp', gif: 'image/gif',
162
152
  };
163
- function providerLabel(id, ownedBy) {
164
- const p = (id.split('/')[0] || ownedBy || '').toLowerCase();
165
- return PROVIDER_LABEL[p] || (p ? p.charAt(0).toUpperCase() + p.slice(1) : 'Other');
166
- }
167
153
  // ─── Browser-attack surface gate ────────────────────────────────────────────
168
154
  // Loopback binding alone is NOT an auth boundary: any web page the user has
169
155
  // open can reach 127.0.0.1 (the browser attaches an Origin header but happily
@@ -863,26 +849,7 @@ export async function startServer(opts) {
863
849
  case 'models.list': {
864
850
  try {
865
851
  const models = await getModelsByCategory('chat');
866
- const mapped = models.map((m) => {
867
- const provider = providerLabel(m.id, m.owned_by);
868
- return {
869
- id: m.id,
870
- label: m.name,
871
- free: m.billing_mode === 'free',
872
- group: provider,
873
- provider,
874
- contextWindow: m.context_window,
875
- };
876
- });
877
- // Group by provider (PROVIDER_ORDER first, then alphabetical); free
878
- // models surface first within each provider. The picker renders
879
- // consecutive same-`group` items as one section, so sort accordingly.
880
- const rank = (g) => { const i = PROVIDER_ORDER.indexOf(g); return i < 0 ? 999 : i; };
881
- mapped.sort((a, b) => rank(a.group) - rank(b.group) ||
882
- a.group.localeCompare(b.group) ||
883
- (a.free === b.free ? 0 : a.free ? -1 : 1) ||
884
- a.label.localeCompare(b.label));
885
- send(ws, id, 'response', { models: mapped });
852
+ send(ws, id, 'response', { models: buildModelList(models) });
886
853
  }
887
854
  catch (err) {
888
855
  send(ws, id, 'error', { message: err instanceof Error ? err.message : 'models error' });
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import readline from 'node:readline';
6
6
  import chalk from 'chalk';
7
+ import { sortModelsNewestFirst } from '@blockrun/model-catalog';
7
8
  import { getGatewayModels } from '../gateway-models.js';
8
9
  import { FREE_DEFAULT_MODEL } from '../free-models.js';
9
10
  import { getModelCatalog, onModelCatalogChange } from '../model-catalog.js';
@@ -457,100 +458,6 @@ function providerHeading(provider) {
457
458
  function modelSuffix(id) {
458
459
  return id.includes('/') ? id.slice(id.indexOf('/') + 1) : id;
459
460
  }
460
- function versionScoreFrom(match) {
461
- if (!match)
462
- return 0;
463
- const parts = match[1].split('.').map(part => Number.parseInt(part, 10) || 0);
464
- return parts.slice(0, 3).reduce((score, part, index) => score + part * [1_000_000, 100_000, 1_000][index], 0);
465
- }
466
- function providerVersionScore(provider, suffix) {
467
- switch (provider) {
468
- case 'anthropic':
469
- return versionScoreFrom(suffix.match(/claude-(?:fable|opus|sonnet|haiku)-(\d+(?:\.\d+)*)/));
470
- case 'openai':
471
- if (suffix.startsWith('gpt-4o'))
472
- return versionScoreFrom(['', '4.0']);
473
- return versionScoreFrom(suffix.match(/(?:gpt-|o)(\d+(?:\.\d+)*)/));
474
- case 'google':
475
- return versionScoreFrom(suffix.match(/gemini-(\d+(?:\.\d+)*)/));
476
- case 'xai':
477
- return versionScoreFrom(suffix.match(/grok-(\d+(?:\.\d+)*)/));
478
- case 'zai':
479
- return versionScoreFrom(suffix.match(/glm-(\d+(?:\.\d+)*)/));
480
- case 'moonshot':
481
- return versionScoreFrom(suffix.match(/kimi-k(\d+(?:\.\d+)*)/));
482
- case 'minimax':
483
- return versionScoreFrom(suffix.match(/minimax-m(\d+(?:\.\d+)*)/));
484
- case 'deepseek':
485
- return versionScoreFrom(suffix.match(/deepseek-v(\d+(?:\.\d+)*)/));
486
- case 'nvidia':
487
- return versionScoreFrom(suffix.match(/deepseek-v(\d+(?:\.\d+)*)/) ??
488
- suffix.match(/qwen(\d+(?:\.\d+)*)/) ??
489
- suffix.match(/step-(\d+(?:\.\d+)*)/) ??
490
- suffix.match(/nemotron-(\d+(?:\.\d+)*)/) ??
491
- suffix.match(/mistral-large-(\d+(?:\.\d+)*)/) ??
492
- suffix.match(/v(\d+(?:\.\d+)*)/));
493
- default:
494
- return versionScoreFrom(suffix.match(/(?:^|[^\d])(\d+(?:\.\d+)*)(?:[^\d]|$)/));
495
- }
496
- }
497
- function expandedModelRank(model) {
498
- const suffix = modelSuffix(model.id).toLowerCase();
499
- const provider = providerOf(model.id);
500
- let score = providerVersionScore(provider, suffix);
501
- switch (provider) {
502
- case 'anthropic':
503
- score += suffix.includes('fable') ? 90_000 : suffix.includes('opus') ? 80_000 : suffix.includes('sonnet') ? 70_000 : suffix.includes('haiku') ? 40_000 : 0;
504
- break;
505
- case 'openai':
506
- score += suffix.startsWith('gpt-') ? 80_000 : suffix.startsWith('o') ? 65_000 : 0;
507
- if (suffix.includes('codex'))
508
- score += 8_000;
509
- if (suffix.includes('pro') || suffix.includes('sol'))
510
- score += 3_000;
511
- if (suffix.includes('terra'))
512
- score += 2_000;
513
- if (suffix.includes('luna'))
514
- score += 1_000;
515
- if (suffix.includes('mini'))
516
- score -= 8_000;
517
- if (suffix.includes('nano'))
518
- score -= 12_000;
519
- break;
520
- case 'google':
521
- score += suffix.includes('gemini') ? 80_000 : 0;
522
- if (suffix.includes('pro'))
523
- score += 5_000;
524
- if (suffix.includes('flash'))
525
- score -= 5_000;
526
- break;
527
- case 'xai':
528
- score += suffix.includes('grok') ? 80_000 : 0;
529
- if (suffix.includes('fast'))
530
- score -= 4_000;
531
- if (suffix.includes('build'))
532
- score -= 8_000;
533
- break;
534
- case 'zai':
535
- score += suffix.includes('glm') ? 80_000 : 0;
536
- if (suffix.includes('turbo'))
537
- score -= 5_000;
538
- break;
539
- case 'moonshot':
540
- score += suffix.includes('kimi') ? 80_000 : 0;
541
- break;
542
- case 'minimax':
543
- score += suffix.includes('minimax') ? 80_000 : 0;
544
- break;
545
- case 'deepseek':
546
- score += suffix.includes('v4-pro') ? 90_000 : suffix.includes('reasoner') ? 75_000 : suffix.includes('chat') ? 70_000 : 0;
547
- break;
548
- case 'nvidia':
549
- score += suffix.includes('qwen3-next') ? 80_000 : suffix.includes('qwen') ? 70_000 : suffix.includes('nemotron') ? 60_000 : 0;
550
- break;
551
- }
552
- return score;
553
- }
554
461
  function cleanGatewayLabel(model) {
555
462
  return (model.name || modelSuffix(model.id))
556
463
  .replace(/\s*\((?:free|paid)\)\s*$/i, '')
@@ -657,30 +564,24 @@ export async function getExpandedPickerCategories() {
657
564
  }
658
565
  export function reconcileExpandedPicker(catalog) {
659
566
  const categories = [{ ...PICKER_CATEGORIES[0], models: [...PICKER_CATEGORIES[0].models] }];
660
- const curated = new Set();
661
567
  const curatedRows = new Map();
662
568
  for (const cat of PICKER_CATEGORIES) {
663
569
  for (const row of cat.models) {
664
- curated.add(row.id);
665
570
  if (!isSyntheticId(row.id))
666
571
  curatedRows.set(row.id, row);
667
572
  }
668
573
  }
669
574
  const shortcutById = buildShortcutById();
670
- const chatModels = catalog
671
- .filter(m => m.categories?.includes('chat'))
672
- .sort((a, b) => {
673
- const providerDelta = providerRank(providerOf(a.id)) - providerRank(providerOf(b.id));
674
- if (providerDelta !== 0)
675
- return providerDelta;
676
- const rankDelta = expandedModelRank(b) - expandedModelRank(a);
677
- if (rankDelta !== 0)
678
- return rankDelta;
679
- const curatedDelta = Number(!curated.has(a.id)) - Number(!curated.has(b.id));
680
- if (curatedDelta !== 0)
681
- return curatedDelta;
682
- return modelSuffix(a.id).localeCompare(modelSuffix(b.id));
683
- });
575
+ const byProviderModels = new Map();
576
+ for (const model of catalog) {
577
+ if (model.available === false || !model.categories?.includes('chat'))
578
+ continue;
579
+ const provider = providerOf(model.id);
580
+ const rows = byProviderModels.get(provider) ?? [];
581
+ rows.push(model);
582
+ byProviderModels.set(provider, rows);
583
+ }
584
+ const chatModels = [...byProviderModels.values()].flatMap(rows => sortModelsNewestFirst(rows));
684
585
  const byProvider = new Map();
685
586
  for (const model of chatModels) {
686
587
  const provider = providerOf(model.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/franklin",
3
- "version": "3.49.15",
3
+ "version": "3.49.17",
4
4
  "description": "Franklin Agent — The AI agent with a wallet. Spends USDC autonomously to get real work done. Pay per action, no subscriptions.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -76,8 +76,8 @@
76
76
  },
77
77
  "dependencies": {
78
78
  "@blockrun/llm": "^3.19.1",
79
- "@blockrun/model-catalog": "https://codeload.github.com/BlockRunAI/model-catalog/tar.gz/b95efe2f025c9968742e6479bc9ec71b6a40c0f4",
80
- "@blockrun/router-core": "https://codeload.github.com/BlockRunAI/router-core/tar.gz/8773a9954b091bd0090acdfec67c75a006c0e156",
79
+ "@blockrun/model-catalog": "https://codeload.github.com/BlockRunAI/model-catalog/tar.gz/aecf20b4d5ee51af4a38a69a1b9c81e3e64b955c",
80
+ "@blockrun/router-core": "https://codeload.github.com/BlockRunAI/router-core/tar.gz/fd6d03d035ff676642ba1683c333d929939f8a00",
81
81
  "@colbymchenry/codegraph": "^1.5.0",
82
82
  "@modelcontextprotocol/sdk": "^1.29.0",
83
83
  "@polymarket/builder-relayer-client": "^0.0.10",