@blockrun/franklin 3.43.0 → 3.44.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.
Files changed (58) hide show
  1. package/README.md +95 -11
  2. package/dist/agent/intent-prefetch.js +4 -3
  3. package/dist/agent/llm.js +5 -0
  4. package/dist/agent/loop.js +7 -4
  5. package/dist/agent/secret-redact.js +11 -0
  6. package/dist/commands/balance.js +25 -1
  7. package/dist/commands/doctor.js +48 -2
  8. package/dist/commands/login.d.ts +14 -0
  9. package/dist/commands/login.js +97 -0
  10. package/dist/commands/models.js +3 -2
  11. package/dist/commands/plugin.js +3 -2
  12. package/dist/commands/predict.js +3 -2
  13. package/dist/commands/proxy.js +3 -2
  14. package/dist/commands/setup.js +15 -1
  15. package/dist/commands/slack.js +3 -2
  16. package/dist/commands/social.js +3 -2
  17. package/dist/commands/start.js +3 -2
  18. package/dist/commands/stats.js +18 -1
  19. package/dist/commands/telegram.js +3 -2
  20. package/dist/config.d.ts +5 -0
  21. package/dist/config.js +17 -0
  22. package/dist/gateway-models.js +9 -4
  23. package/dist/index.js +26 -3
  24. package/dist/onramp/client.js +3 -2
  25. package/dist/payments/auth-mode.d.ts +114 -0
  26. package/dist/payments/auth-mode.js +186 -0
  27. package/dist/payments/post-with-payment.d.ts +6 -0
  28. package/dist/payments/post-with-payment.js +40 -6
  29. package/dist/payments/price-catalog.d.ts +71 -0
  30. package/dist/payments/price-catalog.js +322 -0
  31. package/dist/phone/client.js +6 -2
  32. package/dist/pricing.js +3 -3
  33. package/dist/proxy/fallback.d.ts +1 -1
  34. package/dist/proxy/fallback.js +21 -2
  35. package/dist/proxy/server.js +38 -1
  36. package/dist/router/index.js +2 -1
  37. package/dist/serve/cloud-sync.d.ts +1 -0
  38. package/dist/serve/server.js +10 -3
  39. package/dist/stats/tracker.d.ts +15 -1
  40. package/dist/stats/tracker.js +14 -2
  41. package/dist/tools/blockrun.js +10 -3
  42. package/dist/tools/defillama.js +9 -3
  43. package/dist/tools/exa.js +22 -9
  44. package/dist/tools/imagegen.js +4 -2
  45. package/dist/tools/modal.js +4 -2
  46. package/dist/tools/musicgen.js +4 -2
  47. package/dist/tools/phone.js +4 -2
  48. package/dist/tools/prediction.js +15 -4
  49. package/dist/tools/realface.js +14 -8
  50. package/dist/tools/rpc.js +10 -3
  51. package/dist/tools/surf.js +12 -4
  52. package/dist/tools/videogen.js +4 -2
  53. package/dist/tools/voice.js +6 -4
  54. package/dist/tools/zerox-base.js +4 -2
  55. package/dist/tools/zerox-gasless.js +6 -4
  56. package/dist/trading/providers/blockrun/client.js +20 -7
  57. package/dist/ui/model-picker.js +1 -1
  58. package/package.json +8 -4
@@ -14,13 +14,25 @@
14
14
  * together with the x402 signing wrapper.
15
15
  */
16
16
  import { USER_AGENT, loadChain } from '../../../config.js';
17
+ import { gatewayHeaders, resolvePayMode } from '../../../payments/auth-mode.js';
17
18
  import { recordFetch } from '../telemetry.js';
18
19
  import { getOrCreateWallet, getOrCreateSolanaWallet, createPaymentPayload, createSolanaPaymentPayload, parsePaymentRequired, extractPaymentDetails, solanaKeyToBytes, SOLANA_NETWORK, } from '@blockrun/llm';
19
20
  const TIMEOUT_MS = 10_000;
20
- function baseUrl() {
21
- // `loadChain()` dispatches on env / ~/.blockrun/payment-chain. We match it
22
- // every call so mid-session chain switches take effect without restart.
23
- return loadChain() === 'solana' ? 'https://sol.blockrun.ai' : 'https://blockrun.ai';
21
+ /**
22
+ * Absolute URL for a gateway path. Callers pass `/api/v1/...` because that is
23
+ * the shape the x402 hosts serve; the API-key host serves the same routes at
24
+ * `/v1/...`, so the `/api` segment is stripped in key mode.
25
+ *
26
+ * `loadChain()` dispatches on env / ~/.blockrun/payment-chain and is read every
27
+ * call so mid-session chain switches take effect without a restart. In key mode
28
+ * the chain is irrelevant — the credit balance is chainless.
29
+ */
30
+ function gatewayUrl(path) {
31
+ const mode = resolvePayMode();
32
+ if (mode.kind === 'key')
33
+ return mode.apiBase + path.replace(/^\/api/, '');
34
+ const origin = loadChain() === 'solana' ? 'https://sol.blockrun.ai' : 'https://blockrun.ai';
35
+ return origin + path;
24
36
  }
25
37
  const cache = new Map();
26
38
  export async function cached(key, ttlMs, fn) {
@@ -43,11 +55,11 @@ export function clearCache() {
43
55
  export async function blockrunGet(path, opts = { endpoint: path }) {
44
56
  const ctrl = new AbortController();
45
57
  const timer = setTimeout(() => ctrl.abort(), TIMEOUT_MS);
46
- const url = `${baseUrl()}${path}`;
58
+ const url = gatewayUrl(path);
47
59
  const startedAt = Date.now();
48
60
  try {
49
61
  const res = await fetch(url, {
50
- headers: { 'User-Agent': USER_AGENT, Accept: 'application/json' },
62
+ headers: { ...gatewayHeaders(), 'User-Agent': USER_AGENT, Accept: 'application/json' },
51
63
  signal: ctrl.signal,
52
64
  });
53
65
  const latencyMs = Date.now() - startedAt;
@@ -168,10 +180,11 @@ class PaymentSignError extends Error {
168
180
  export async function blockrunGetPaid(path, opts) {
169
181
  const ctrl = new AbortController();
170
182
  const timer = setTimeout(() => ctrl.abort(), TIMEOUT_MS);
171
- const url = `${baseUrl()}${path}`;
183
+ const url = gatewayUrl(path);
172
184
  const chain = loadChain();
173
185
  const startedAt = Date.now();
174
186
  const headers = {
187
+ ...gatewayHeaders(),
175
188
  'User-Agent': USER_AGENT,
176
189
  Accept: 'application/json',
177
190
  };
@@ -366,7 +366,7 @@ export const PICKER_CATEGORIES = [
366
366
  // superseded sibling listed directly under its successor is choice
367
367
  // paralysis, not choice. `gemini-2.5` still resolves to it.
368
368
  { id: 'google/gemini-3.1-pro', shortcut: 'gemini', label: 'Gemini 3.1 Pro', price: '$2/$12' },
369
- { id: 'xai/grok-4.5', shortcut: 'grok', label: 'Grok 4.5', price: '$2.5/$9' },
369
+ { id: 'xai/grok-4.5', shortcut: 'grok', label: 'Grok 4.5', price: '$2/$6' },
370
370
  // Kimi K3 (2026-07): 2.8T open MoE, 1M context, multimodal + reasoning.
371
371
  // Replaced the budget K2.7 line — now premium-priced ($3/$15).
372
372
  { id: 'moonshot/kimi-k3', shortcut: 'kimi', label: 'Kimi K3', price: '$3/$15' },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blockrun/franklin",
3
- "version": "3.43.0",
4
- "description": "Franklin Agent \u2014 The AI agent with a wallet. Spends USDC autonomously to get real work done. Pay per action, no subscriptions.",
3
+ "version": "3.44.0",
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": {
7
7
  ".": {
@@ -38,7 +38,7 @@
38
38
  "desktop:package:win": "npm run dist:win --workspace @blockrun/franklin-desktop",
39
39
  "dev": "tsc --watch",
40
40
  "start": "node dist/index.js",
41
- "test": "npm run build && node --test --test-concurrency=4 --test-reporter=spec test/local.mjs test/serve-security.local.mjs test/skills.local.mjs test/repair.mjs test/model-resolver.mjs test/exa.local.mjs test/audit-batch.local.mjs test/polymarket.local.mjs test/market.local.mjs test/hooks.local.mjs test/scheduler.local.mjs test/trade-plan.local.mjs test/goal.local.mjs test/memory.local.mjs test/agent-host.local.mjs test/reservation.local.mjs",
41
+ "test": "npm run build && node --test --test-concurrency=4 --test-reporter=spec test/local.mjs test/api-key.local.mjs test/serve-security.local.mjs test/skills.local.mjs test/repair.mjs test/model-resolver.mjs test/exa.local.mjs test/audit-batch.local.mjs test/polymarket.local.mjs test/market.local.mjs test/hooks.local.mjs test/scheduler.local.mjs test/trade-plan.local.mjs test/goal.local.mjs test/memory.local.mjs test/agent-host.local.mjs test/reservation.local.mjs",
42
42
  "test:e2e": "npm run build && node --test --test-reporter=spec test/e2e.mjs",
43
43
  "e2e:polymarket:readonly": "npm run build && node scripts/polymarket-e2e-readonly.mjs",
44
44
  "test:free-models": "npm run build && node --test --test-reporter=spec test/free-model-matrix.mjs",
@@ -108,6 +108,10 @@
108
108
  },
109
109
  "overrides": {
110
110
  "ws@>=8.0.0 <=8.20.1": "^8.21.1",
111
- "@polymarket/builder-signing-sdk": "1.0.0"
111
+ "@polymarket/builder-signing-sdk": "1.0.0",
112
+ "@polymarket/builder-relayer-client": {
113
+ "axios": "^1.18.1"
114
+ },
115
+ "qs": "^6.16.0"
112
116
  }
113
117
  }