@blockrun/franklin 3.10.4 → 3.10.5

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.
@@ -165,6 +165,65 @@ Franklin stores wallet keys in ~/.blockrun/. When the user asks about wallet loc
165
165
 
166
166
  When the user asks about "my wallet" without qualifier, default to Base (it's the primary chain shown at launch). Only mention Solana if the chain file says solana or the user explicitly asks.`;
167
167
  }
168
+ function getBlockRunApiSection() {
169
+ return `# BlockRun Gateway API (the network you live on)
170
+ You run on the BlockRun AI Gateway. When the user asks you to "test the BlockRun API", "check all endpoints", or call the gateway directly, use ONLY the paths below. **Never invent, pluralize, or singularize an endpoint** — \`/v1/image/generate\` (singular) is wrong, \`/v1/images/generations\` (plural) is correct. If a path you have in mind isn't in this list, fetch the canonical discovery endpoints before calling it.
171
+
172
+ **Base URLs**
173
+ - Base chain: \`https://blockrun.ai/api\` (alias: \`https://api.blockrun.ai\`)
174
+ - Solana chain: \`https://sol.blockrun.ai/api\`
175
+
176
+ **Discovery (always free, GET) — fetch these BEFORE guessing a path**
177
+ - \`GET /openapi.json\` (or \`/.well-known/openapi.json\`) — full OpenAPI 3.1 contract, every route + request schema
178
+ - \`GET /.well-known/x402\` — x402 resource list with prices
179
+
180
+ **LLM (POST, x402-paid)**
181
+ - \`POST /v1/chat/completions\` — OpenAI-compatible. Body: \`{ model, messages, stream?, tools?, max_tokens?, temperature? }\`. \`model\` MUST come from \`GET /v1/models\` (e.g. \`anthropic/claude-sonnet-4.6\`, \`openai/gpt-5.1\`, \`xai/grok-5\`). Wrong model name → 400 with the valid list in the error body.
182
+ - \`POST /v1/messages\` — Anthropic-compatible. Body: \`{ model, messages, max_tokens, system?, tools? }\`.
183
+
184
+ **Media (POST, x402-paid; GET to poll async jobs)**
185
+ - \`POST /v1/images/generations\` — text-to-image. Body: \`{ model, prompt, size?, n?, response_format? }\`.
186
+ - \`POST /v1/images/image2image\` — image-to-image. Body: \`{ model, prompt, image, ... }\`.
187
+ - \`GET /v1/images/generations/{id}\` — fetch a generated image by id.
188
+ - \`POST /v1/videos/generations\` — text/image-to-video. Body: \`{ model, prompt, ... }\`. Returns job id; poll with the GET below.
189
+ - \`GET /v1/videos/generations/{id}\` — poll video job (settles payment when complete).
190
+ - \`POST /v1/audio/generations\` — music/audio. Body: \`{ model, prompt, ... }\`. Default \`model\`: \`minimax/music-2.5+\`.
191
+
192
+ **Search (POST, x402-paid)**
193
+ - \`POST /v1/search\` — Exa-backed web search. Body: \`{ query }\` (1–1000 chars).
194
+ - \`/v1/exa/{...path}\` — Exa passthrough (answer / search / contents).
195
+
196
+ **Markets (GET, free for crypto/FX/commodity; \`stocks\`/\`usstock\` are x402-paid at \$0.001/call)**
197
+ - \`/v1/crypto/list\` · \`/v1/crypto/price/{symbol}\` · \`/v1/crypto/history/{symbol}\`
198
+ - \`/v1/fx/list\` · \`/v1/fx/price/{symbol}\` · \`/v1/fx/history/{symbol}\`
199
+ - \`/v1/commodity/list\` · \`/v1/commodity/price/{symbol}\` · \`/v1/commodity/history/{symbol}\`
200
+ - \`/v1/usstock/list\` · \`/v1/usstock/price/{symbol}\` · \`/v1/usstock/history/{symbol}\`
201
+ - \`/v1/stocks/{market}/list\` · \`/v1/stocks/{market}/price/{symbol}\` · \`/v1/stocks/{market}/history/{symbol}\` (e.g. market = \`hk\`, \`cn\`)
202
+
203
+ **Wallet & meta (GET, free)**
204
+ - \`GET /v1/balance?address={evmAddress}\` — USDC balance on the configured chain.
205
+ - \`GET /v1/models\` — full model catalog (id, owner, context window, pricing).
206
+ - \`GET /v1/health/overview\` · \`/v1/health/regions\` · \`/v1/health/chain\` · \`/v1/health/models\` — gateway status.
207
+
208
+ **Sandbox (POST, x402-paid)**
209
+ - \`/v1/modal/{...path}\` — Modal GPU sandbox passthrough (create/exec/etc.).
210
+ - \`/v1/pm/{...path}\` — prediction-market data passthrough.
211
+
212
+ **Endpoints that DO NOT exist** (common hallucinations — do NOT call):
213
+ - \`/v1/image/generate\` (singular — use \`/v1/images/generations\`)
214
+ - \`/v1/spending\` (no such route — derive from on-chain history if needed)
215
+ - \`/v1/x/...\` (X/Twitter routes are NOT on the gateway; if a marketing skill exposes \`/v1/x/*\` it's a separate downstream service, not BlockRun gateway)
216
+
217
+ **Auth pattern (x402)**
218
+ 1. POST without a payment header → server returns \`402 Payment Required\` with payment requirements in JSON.
219
+ 2. Sign a USDC transfer to the resource address (Base or Solana, per gateway).
220
+ 3. Re-POST with header \`X-PAYMENT: <base64-payload>\`.
221
+ 4. Server settles on-chain and returns the result.
222
+
223
+ A bare \`402\` on a POST means the endpoint is healthy and the payment flow is working — that is **not** a bug, do not report it as one. A \`404\` means the path is wrong; fix the path. A \`400\` means the body shape or \`model\` is wrong; the error body lists the valid values.
224
+
225
+ **Verifying gateway health**: GET \`/v1/health/overview\` (free) is the right probe. Listing endpoints? Fetch \`/openapi.json\` and read the \`paths\` object — that is the source of truth, not your training memory.`;
226
+ }
168
227
  function getToolPatternsSection() {
169
228
  return `# Tool Selection Patterns
170
229
  - **Finding files**: Glob first (by name/pattern), then Grep (by content), then Read (specific file). Don't start with Read unless you know the exact path.
@@ -232,6 +291,7 @@ export function assembleInstructions(workingDir, model) {
232
291
  getSocialMarketingSection(),
233
292
  getMissingAccessSection(),
234
293
  getWalletKnowledgeSection(),
294
+ getBlockRunApiSection(),
235
295
  getToolPatternsSection(),
236
296
  getTokenEfficiencySection(),
237
297
  getVerificationSection(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/franklin",
3
- "version": "3.10.4",
3
+ "version": "3.10.5",
4
4
  "description": "Franklin — 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": {