@blockrun/franklin 3.49.0 → 3.49.1

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
@@ -74,7 +74,7 @@ franklin
74
74
  # Pick ONE — a USDC wallet, or a prepaid API key.
75
75
 
76
76
  # a) Wallet — no signup, no account
77
- franklin setup solana # or: franklin setup base
77
+ franklin setup solana # or: franklin setup base / franklin setup arc
78
78
  franklin balance # show address + USDC balance
79
79
 
80
80
  # b) API key — sign up and top up at https://user.blockrun.ai
@@ -163,12 +163,20 @@ interchangeable. Everything else about the agent is identical.
163
163
  | --- | --- | --- |
164
164
  | Setup | `franklin setup solana` | Sign up, top up, `franklin login brk_...` |
165
165
  | Account required | No | Yes |
166
- | Crypto required | Yes — USDC on Solana or Base | No — top up with a card |
166
+ | Crypto required | Yes — USDC on Solana, Base or Arc | No — top up with a card |
167
167
  | Settlement | On-chain, per call, via [x402](https://x402.org) | Against a prepaid balance |
168
- | Gateway | `sol.blockrun.ai` / `blockrun.ai` | `api.blockrun.ai` |
168
+ | Gateway | `sol.blockrun.ai` / `blockrun.ai` / `arc.blockrun.ai` | `api.blockrun.ai` |
169
169
  | Where the money lives | A wallet only you hold the key to | Your BlockRun account |
170
170
  | Spend visibility | `franklin stats` — exact settled amounts | `franklin balance` + [dashboard](https://user.blockrun.ai/dashboard); exact except chat |
171
171
 
172
+ **Three wallet chains.** Solana (the default), Base, or Circle's [Arc](https://arc.network)
173
+ (chain 5042). Switch with `franklin solana` / `franklin base` / `franklin arc`, or the chain
174
+ buttons on the panel's wallet page. Base and Arc share one EVM key, so the same address
175
+ receives USDC on both; Solana has its own key. Card purchase (Coinbase Onramp) funds Base
176
+ and Solana only — on Arc, send USDC to the address directly. `franklin balance` always
177
+ reports the active chain's USDC, so after switching to Arc it shows your Arc balance, not
178
+ Base's. Arc's gateway adds models after Base does; the picker lists what Arc serves today.
179
+
172
180
  **The wallet is still Franklin's identity.** Memory, the trading journal and goals are
173
181
  keyed to it, and the wallet route is the one that needs nothing from us — no signup, no
174
182
  KYC, no account to suspend. The API key exists because not everyone wants to hold crypto
@@ -448,7 +456,7 @@ No single model is best at everything. Sonnet writes better code, Gemini handles
448
456
 
449
457
  ### 🔐  Wallet is identity
450
458
 
451
- No email. No phone. No KYC. Your Solana or Base address is your account — portable, permissionless, global. A wallet requires only USDC. (Prefer an account and a card? [Two ways to pay](#two-ways-to-pay) — the key route exists, it just is not the one that makes the agent sovereign.)
459
+ No email. No phone. No KYC. Your Solana, Base or Arc address is your account — portable, permissionless, global. A wallet requires only USDC. (Prefer an account and a card? [Two ways to pay](#two-ways-to-pay) — the key route exists, it just is not the one that makes the agent sovereign.)
452
460
 
453
461
  </td>
454
462
  </tr>
@@ -495,7 +503,7 @@ Ask "generate a logo" — Franklin calls DALL-E / GPT Image, saves the result lo
495
503
  Anthropic, OpenAI, Google, xAI, DeepSeek, GLM, Kimi, Minimax, NVIDIA free tier. One wallet, one interface, automatic fallback.
496
504
 
497
505
  **💳 x402 micropayments (YOPO)**
498
- HTTP 402 native. Every paid action is a signed USDC micropayment via EIP-712 — non-custodial, your keys never leave your machine. YOPO: you pay only for outcomes.
506
+ 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.
499
507
 
500
508
  **🧠 Learned model router**
501
509
  Trained on 2M+ real requests. Classifies your task and picks the best model from <!-- br:models.chatVisible -->82<!-- /br:models.chatVisible --> LLMs. Four profiles (auto/eco/premium/free). Adapts to your usage over time.
@@ -569,7 +577,7 @@ like `opus`, `gpt` and `grok` keep their current targets.
569
577
  │ <!-- br:models.chatVisible@live -->82<!-- /br:models.chatVisible@live --> LLMs · CoinGecko · Search · Image APIs · paid services │
570
578
  ├──────────────────────────────────────────────────────────────┤
571
579
  │ x402 Micropayment Protocol │
572
- │ HTTP 402 · USDC on Solana & Base · signed payment payloads │
580
+ │ HTTP 402 · USDC on Solana, Base & Arc · signed payloads │
573
581
  └──────────────────────────────────────────────────────────────┘
574
582
  │
575
583
  ▼
@@ -611,7 +619,7 @@ src/
611
619
  ├── ui/ Ink-based terminal UI
612
620
  ├── proxy/ Payment proxy for external tools
613
621
  ├── router/ Learned model router (<!-- br:models.chatVisible@live -->82<!-- /br:models.chatVisible@live --> models, Elo scoring)
614
- ├── wallet/ Wallet management (Base + Solana)
622
+ ├── wallet/ Wallet management (Base/Arc + Solana)
615
623
  ├── mcp/ MCP server auto-discovery
616
624
  └── commands/ CLI subcommands
617
625
  ```
@@ -727,7 +735,8 @@ Franklin uses [BlockRun Model Core](https://github.com/BlockRunAI/model-catalog)
727
735
  for model metadata, picker policy and price estimates. The runtime dependency
728
736
  is pinned to an immutable commit. On refresh, Franklin reads the public policy
729
737
  snapshot and the active gateway's catalog, so new models and prices can appear
730
- without a Franklin release. Base, Solana and API accounts have separate caches.
738
+ without a Franklin release. Base, Solana, Arc and API accounts have separate caches.
739
+ Arc reads Base's policy and offline snapshot, with live rows from `arc.blockrun.ai`.
731
740
  The default picker shows Auto and curated groups; other available chat models
732
741
  remain accessible through +more / Ctrl+A.
733
742
 
@@ -527,7 +527,7 @@ function buildExecute(deps) {
527
527
  ? `\n\nOpen with: open ${savedPaths[0]}`
528
528
  : `\n\nOpen with: open ${savedPaths.join(' ')}`;
529
529
  return {
530
- output: `${header}${revisedPrompt}${openHint}${contentSummary}`,
530
+ output: `${header}\nPrompt sent: ${chosenPrompt}${revisedPrompt}${openHint}${contentSummary}`,
531
531
  };
532
532
  }
533
533
  catch (err) {
@@ -662,7 +662,9 @@ export function createImageGenCapability(deps = {}) {
662
662
  input_schema: {
663
663
  type: 'object',
664
664
  properties: {
665
- prompt: { type: 'string', description: 'Text description of the image to generate, or edit instructions when a reference image is provided' },
665
+ prompt: { type: 'string', description: 'Self-contained text description of the image to generate, or edit instructions when a reference image is provided. ' +
666
+ 'The image model sees ONLY this text, never the conversation: when the user refers to earlier messages ("these numbers", "that chart"), ' +
667
+ 'write those details (figures, names, labels, quoted text) into the prompt verbatim. Never invent data the user did not give.' },
666
668
  output_path: { type: 'string', description: 'Where to save the image. Default: generated-<timestamp>.png in working directory. With n>1, a -1/-2/... suffix is appended before the extension.' },
667
669
  size: { type: 'string', description: 'Image size. gpt-image-1/2: 1024x1024, 1536x1024, 1024x1536. google/nano-banana: 1024x1024. google/nano-banana-pro: 1024x1024, 2048x2048, 4096x4096. Default: 1024x1024. Note: openai/gpt-image-2 is forced to 1024x1024 (other sizes time out at the gateway).' },
668
670
  model: { type: 'string', description: 'Image model to use. Default: openai/gpt-image-1 (text-to-image) / openai/gpt-image-2 (image-to-image).' },
@@ -23,6 +23,7 @@ import { isWalletKeyPath } from './sensitive-paths.js';
23
23
  import { findModel, estimateCostUsd } from '../gateway-models.js';
24
24
  import { recordUsage } from '../stats/tracker.js';
25
25
  import { noChargeNote } from '../payments/billing-copy.js';
26
+ import { pollImageJob } from './imagegen.js';
26
27
  const DEFAULT_MODEL = 'minimax/music-2.5+';
27
28
  // Flat per-track price for the default model — already margin-inclusive
28
29
  // ($0.15/track × 1.05 gateway margin). Fallback when the catalog is unavailable.
@@ -111,8 +112,9 @@ function buildExecute(deps) {
111
112
  headers,
112
113
  body,
113
114
  });
115
+ let paymentHeaders = null;
114
116
  if (response.status === 402 && walletMayPay(headers)) {
115
- const paymentHeaders = await signPayment(response, chain, endpoint);
117
+ paymentHeaders = await signPayment(response, chain, endpoint);
116
118
  if (!paymentHeaders) {
117
119
  return { output: 'Payment failed. Check wallet balance with: franklin balance', isError: true };
118
120
  }
@@ -130,7 +132,48 @@ function buildExecute(deps) {
130
132
  isError: true,
131
133
  };
132
134
  }
133
- const result = (await response.json());
135
+ let result = (await response.json());
136
+ // Slow tracks outrun the gateway's inline window: it answers 202 +
137
+ // poll_url and settles on the first completed poll, so nothing is charged
138
+ // until then. Same contract (and same signed header on each poll) as the
139
+ // ImageGen async path.
140
+ if (response.status === 202 && result.poll_url) {
141
+ const pollEndpoint = result.poll_url.startsWith('http')
142
+ ? result.poll_url
143
+ : `${new URL(apiUrl).origin}${result.poll_url}`;
144
+ clearTimeout(timeout);
145
+ let outcome = await pollImageJob(pollEndpoint, paymentHeaders ? { ...headers, ...paymentHeaders } : headers, controller.signal);
146
+ // The poll may refuse the POST's authorization: the gateway builds the
147
+ // poll's requirements with a longer timeout than the music POST's, and a
148
+ // strict facilitator (Circle, on Arc) rejects the mismatch as
149
+ // invalid_payment_requirements. The poll publishes its own 402 challenge
150
+ // and accepts a fresh signature from the same wallet, so sign that one.
151
+ // The job settles once, on the first completed poll: no double charge.
152
+ if (outcome.kind === 'poll_http_error' && outcome.status === 402 && paymentHeaders && walletMayPay(headers)) {
153
+ const challenge = await fetch(pollEndpoint, { method: 'GET', headers, signal: controller.signal });
154
+ const fresh = challenge.status === 402 ? await signPayment(challenge, chain, pollEndpoint) : null;
155
+ if (fresh) {
156
+ outcome = await pollImageJob(pollEndpoint, { ...headers, ...fresh }, controller.signal);
157
+ }
158
+ }
159
+ if (outcome.kind === 'failed') {
160
+ return {
161
+ output: `Music generation failed upstream: ${JSON.stringify(outcome.error ?? '').slice(0, 240)}. ${noChargeNote()}`,
162
+ isError: true,
163
+ };
164
+ }
165
+ if (outcome.kind === 'poll_http_error') {
166
+ return { output: `Music poll failed (${outcome.status}): ${outcome.bodyPreview}`, isError: true };
167
+ }
168
+ if (outcome.kind === 'timed_out') {
169
+ return {
170
+ output: 'Music generation was queued but did not complete within 5 minutes. ' +
171
+ 'The gateway only charges when a poll sees the finished track.',
172
+ isError: true,
173
+ };
174
+ }
175
+ result = outcome.body;
176
+ }
134
177
  const track = result.data?.[0];
135
178
  if (!track?.url) {
136
179
  return { output: 'No track URL returned from API', isError: true };
@@ -189,7 +232,8 @@ function buildExecute(deps) {
189
232
  }
190
233
  }
191
234
  return {
192
- output: `Track saved to ${outPath} (${sizeMB}MB, ${dur}s, ${musicModel})\n\n` +
235
+ output: `Track saved to ${outPath} (${sizeMB}MB, ${dur}s, ${musicModel})\n` +
236
+ `Prompt sent: ${prompt}\n\n` +
193
237
  `Open with: open ${outPath}${lyricsPreview}${contentSummary}`,
194
238
  };
195
239
  }
@@ -272,7 +316,9 @@ export function createMusicGenCapability(deps = {}) {
272
316
  input_schema: {
273
317
  type: 'object',
274
318
  properties: {
275
- prompt: { type: 'string', description: 'Music style / mood / description' },
319
+ prompt: { type: 'string', description: 'Self-contained music style / mood / description. ' +
320
+ 'The music model sees ONLY this text, never the conversation: when the user refers to earlier messages, ' +
321
+ 'write those details into the prompt.' },
276
322
  output_path: { type: 'string', description: 'Where to save the MP3. Default: generated-<timestamp>.mp3' },
277
323
  model: { type: 'string', description: 'Music model. Default: minimax/music-2.5+' },
278
324
  instrumental: { type: 'boolean', description: 'No vocals. Cannot combine with `lyrics`.' },
@@ -366,7 +366,8 @@ function buildExecute(deps) {
366
366
  }
367
367
  }
368
368
  return {
369
- output: `Video saved to ${outPath} (${sizeMB}MB, ${dur}s, ${videoModel})\n\n` +
369
+ output: `Video saved to ${outPath} (${sizeMB}MB, ${dur}s, ${videoModel})\n` +
370
+ `Prompt sent: ${prompt}\n\n` +
370
371
  `Open with: open ${outPath}${contentSummary}`,
371
372
  };
372
373
  }
@@ -503,7 +504,9 @@ export function createVideoGenCapability(deps = {}) {
503
504
  input_schema: {
504
505
  type: 'object',
505
506
  properties: {
506
- prompt: { type: 'string', description: 'Text description of the video to generate' },
507
+ prompt: { type: 'string', description: 'Self-contained text description of the video to generate. ' +
508
+ 'The video model sees ONLY this text, never the conversation: when the user refers to earlier messages, ' +
509
+ 'write those details (scenes, names, quoted text) into the prompt verbatim.' },
507
510
  output_path: { type: 'string', description: 'Where to save the MP4. Default: generated-<timestamp>.mp4 in working directory' },
508
511
  model: {
509
512
  type: 'string',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/franklin",
3
- "version": "3.49.0",
3
+ "version": "3.49.1",
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": {
@@ -87,7 +87,7 @@
87
87
  "@solana/spl-token": "^0.4.14",
88
88
  "@solana/web3.js": "^1.98.4",
89
89
  "@types/react": "^19.2.14",
90
- "axios": "^1.18.1",
90
+ "axios": "^1.20.0",
91
91
  "bs58": "^6.0.0",
92
92
  "chalk": "^5.4.0",
93
93
  "commander": "^15.0.0",
@@ -98,7 +98,7 @@
98
98
  "playwright-core": "^1.49.1",
99
99
  "qrcode": "^1.5.4",
100
100
  "react": "^19.2.4",
101
- "sharp": "^0.35.3",
101
+ "sharp": "^0.35.5",
102
102
  "viem": "^2.48.1",
103
103
  "ws": "^8.21.1"
104
104
  },
@@ -112,7 +112,7 @@
112
112
  "ws@>=8.0.0 <=8.20.1": "^8.21.1",
113
113
  "@polymarket/builder-signing-sdk": "1.0.0",
114
114
  "@polymarket/builder-relayer-client": {
115
- "axios": "^1.18.1"
115
+ "axios": "^1.20.0"
116
116
  },
117
117
  "qs": "^6.16.0"
118
118
  }