@blockrun/franklin 3.15.22 → 3.15.23
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/mcp/client.js +11 -10
- package/dist/tools/defillama.js +2 -1
- package/dist/tools/exa.js +2 -1
- package/dist/tools/imagegen.js +2 -1
- package/dist/tools/modal.js +2 -1
- package/dist/tools/musicgen.js +2 -1
- package/dist/tools/videogen.js +2 -1
- package/dist/tools/zerox-gasless.js +2 -1
- package/package.json +1 -1
package/dist/mcp/client.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
7
7
|
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
8
|
+
import { logger } from '../logger.js';
|
|
8
9
|
// ─── Connection Management ────────────────────────────────────────────────
|
|
9
10
|
const connections = new Map();
|
|
10
11
|
/**
|
|
@@ -168,13 +169,9 @@ export async function connectMcpServers(config, debug) {
|
|
|
168
169
|
if (serverConfig.disabled)
|
|
169
170
|
continue;
|
|
170
171
|
try {
|
|
171
|
-
|
|
172
|
-
console.error(`[franklin] Connecting to MCP server: ${name}...`);
|
|
173
|
-
}
|
|
172
|
+
logger.debug(`[franklin] Connecting to MCP server: ${name}...`);
|
|
174
173
|
if (serverConfig.transport !== 'stdio') {
|
|
175
|
-
|
|
176
|
-
console.error(`[franklin] MCP HTTP transport not yet supported for ${name}`);
|
|
177
|
-
}
|
|
174
|
+
logger.debug(`[franklin] MCP HTTP transport not yet supported for ${name}`);
|
|
178
175
|
continue;
|
|
179
176
|
}
|
|
180
177
|
// Timeout: don't let a slow server block startup
|
|
@@ -182,14 +179,18 @@ export async function connectMcpServers(config, debug) {
|
|
|
182
179
|
const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error('connection timeout (5s)')), MCP_CONNECT_TIMEOUT));
|
|
183
180
|
const connected = await Promise.race([connectPromise, timeoutPromise]);
|
|
184
181
|
allTools.push(...connected.tools);
|
|
185
|
-
|
|
186
|
-
console.error(`[franklin] MCP ${name}: ${connected.tools.length} tools discovered`);
|
|
187
|
-
}
|
|
182
|
+
logger.info(`[franklin] MCP ${name}: ${connected.tools.length} tools discovered`);
|
|
188
183
|
}
|
|
189
184
|
catch (err) {
|
|
190
185
|
// Graceful degradation — one-line warning, continue without this server.
|
|
191
|
-
// Always
|
|
186
|
+
// Always written to franklin-debug.log so the user can post-mortem
|
|
187
|
+
// why tools went missing; ALSO printed to stderr at session boot
|
|
188
|
+
// so the user sees it in real time before the agent eats the
|
|
189
|
+
// terminal. Two separate writes (logger + stderr) is fine here —
|
|
190
|
+
// the user-visible "tool missing" notice has different timing
|
|
191
|
+
// requirements than the persistent log entry.
|
|
192
192
|
const shortMsg = err.message?.split('\n')[0]?.slice(0, 100) || 'unknown error';
|
|
193
|
+
logger.warn(`[franklin] MCP ${name}: ${shortMsg}`);
|
|
193
194
|
console.error(` ${name}: ${shortMsg} ${debug ? '' : '(--debug for details)'}`);
|
|
194
195
|
}
|
|
195
196
|
}
|
package/dist/tools/defillama.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { getOrCreateWallet, getOrCreateSolanaWallet, createPaymentPayload, createSolanaPaymentPayload, parsePaymentRequired, extractPaymentDetails, solanaKeyToBytes, SOLANA_NETWORK, } from '@blockrun/llm';
|
|
19
19
|
import { loadChain, API_URLS, VERSION } from '../config.js';
|
|
20
|
+
import { logger } from '../logger.js';
|
|
20
21
|
const TIMEOUT_MS = 30_000;
|
|
21
22
|
// ─── Shared GET-with-x402 flow ────────────────────────────────────────────
|
|
22
23
|
async function getWithPayment(path, ctx) {
|
|
@@ -90,7 +91,7 @@ async function signPayment(response, chain, endpoint) {
|
|
|
90
91
|
return { 'PAYMENT-SIGNATURE': payload };
|
|
91
92
|
}
|
|
92
93
|
catch (err) {
|
|
93
|
-
|
|
94
|
+
logger.warn(`[franklin] DefiLlama payment error: ${err.message}`);
|
|
94
95
|
return null;
|
|
95
96
|
}
|
|
96
97
|
}
|
package/dist/tools/exa.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { getOrCreateWallet, getOrCreateSolanaWallet, createPaymentPayload, createSolanaPaymentPayload, parsePaymentRequired, extractPaymentDetails, solanaKeyToBytes, SOLANA_NETWORK, } from '@blockrun/llm';
|
|
21
21
|
import { loadChain, API_URLS, VERSION } from '../config.js';
|
|
22
|
+
import { logger } from '../logger.js';
|
|
22
23
|
const GEN_TIMEOUT_MS = 30_000;
|
|
23
24
|
// ─── Shared payment flow ─────────────────────────────────────────────
|
|
24
25
|
async function postWithPayment(path, body, ctx) {
|
|
@@ -95,7 +96,7 @@ async function signPayment(response, chain, endpoint) {
|
|
|
95
96
|
return { 'PAYMENT-SIGNATURE': payload };
|
|
96
97
|
}
|
|
97
98
|
catch (err) {
|
|
98
|
-
|
|
99
|
+
logger.warn(`[franklin] Exa payment error: ${err.message}`);
|
|
99
100
|
return null;
|
|
100
101
|
}
|
|
101
102
|
}
|
package/dist/tools/imagegen.js
CHANGED
|
@@ -11,6 +11,7 @@ import { ModelClient } from '../agent/llm.js';
|
|
|
11
11
|
import { analyzeMediaRequest, renderProposalForAskUser } from '../agent/media-router.js';
|
|
12
12
|
import { recordUsage } from '../stats/tracker.js';
|
|
13
13
|
import { findModel, estimateCostUsd } from '../gateway-models.js';
|
|
14
|
+
import { logger } from '../logger.js';
|
|
14
15
|
/**
|
|
15
16
|
* Models that accept a reference image via /v1/images/image2image. Currently
|
|
16
17
|
* limited to OpenAI's edit endpoint — Gemini Nano Banana Pro and Grok Imagine
|
|
@@ -391,7 +392,7 @@ async function signPayment(response, chain, endpoint) {
|
|
|
391
392
|
}
|
|
392
393
|
}
|
|
393
394
|
catch (err) {
|
|
394
|
-
|
|
395
|
+
logger.warn(`[franklin] Image payment error: ${err.message}`);
|
|
395
396
|
return null;
|
|
396
397
|
}
|
|
397
398
|
}
|
package/dist/tools/modal.js
CHANGED
|
@@ -29,6 +29,7 @@ import { getOrCreateWallet, getOrCreateSolanaWallet, createPaymentPayload, creat
|
|
|
29
29
|
import { loadChain, API_URLS, VERSION } from '../config.js';
|
|
30
30
|
import { walletReservation } from '../wallet/reservation.js';
|
|
31
31
|
import { recordUsage } from '../stats/tracker.js';
|
|
32
|
+
import { logger } from '../logger.js';
|
|
32
33
|
// ─── Pricing table (probed from /.well-known/x402 + 402 responses) ─────────
|
|
33
34
|
const CREATE_PRICE_USD = {
|
|
34
35
|
cpu: 0.01,
|
|
@@ -95,7 +96,7 @@ async function signPayment(response, chain, endpoint, resourceDescription) {
|
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
catch (err) {
|
|
98
|
-
|
|
99
|
+
logger.warn(`[franklin] Modal payment error: ${err.message}`);
|
|
99
100
|
return null;
|
|
100
101
|
}
|
|
101
102
|
}
|
package/dist/tools/musicgen.js
CHANGED
|
@@ -17,6 +17,7 @@ import fs from 'node:fs';
|
|
|
17
17
|
import path from 'node:path';
|
|
18
18
|
import { getOrCreateWallet, getOrCreateSolanaWallet, createPaymentPayload, createSolanaPaymentPayload, parsePaymentRequired, extractPaymentDetails, solanaKeyToBytes, SOLANA_NETWORK, } from '@blockrun/llm';
|
|
19
19
|
import { loadChain, API_URLS, VERSION } from '../config.js';
|
|
20
|
+
import { logger } from '../logger.js';
|
|
20
21
|
const DEFAULT_MODEL = 'minimax/music-2.5+';
|
|
21
22
|
const PRICE_USD = 0.1575;
|
|
22
23
|
// MiniMax generation is 1-3 minutes + small buffer for payment + download.
|
|
@@ -199,7 +200,7 @@ async function signPayment(response, chain, endpoint) {
|
|
|
199
200
|
return { 'PAYMENT-SIGNATURE': payload };
|
|
200
201
|
}
|
|
201
202
|
catch (err) {
|
|
202
|
-
|
|
203
|
+
logger.warn(`[franklin] Music payment error: ${err.message}`);
|
|
203
204
|
return null;
|
|
204
205
|
}
|
|
205
206
|
}
|
package/dist/tools/videogen.js
CHANGED
|
@@ -22,6 +22,7 @@ import fs from 'node:fs';
|
|
|
22
22
|
import path from 'node:path';
|
|
23
23
|
import { getOrCreateWallet, getOrCreateSolanaWallet, createPaymentPayload, createSolanaPaymentPayload, parsePaymentRequired, extractPaymentDetails, solanaKeyToBytes, SOLANA_NETWORK, } from '@blockrun/llm';
|
|
24
24
|
import { loadChain, API_URLS, VERSION } from '../config.js';
|
|
25
|
+
import { logger } from '../logger.js';
|
|
25
26
|
import { ModelClient } from '../agent/llm.js';
|
|
26
27
|
import { analyzeMediaRequest, renderProposalForAskUser } from '../agent/media-router.js';
|
|
27
28
|
import { recordUsage } from '../stats/tracker.js';
|
|
@@ -385,7 +386,7 @@ async function signPayment(response, chain, endpoint) {
|
|
|
385
386
|
return { 'PAYMENT-SIGNATURE': payload };
|
|
386
387
|
}
|
|
387
388
|
catch (err) {
|
|
388
|
-
|
|
389
|
+
logger.warn(`[franklin] Video payment error: ${err.message}`);
|
|
389
390
|
return null;
|
|
390
391
|
}
|
|
391
392
|
}
|
|
@@ -24,6 +24,7 @@ import { createWalletClient, http, publicActions } from 'viem';
|
|
|
24
24
|
import { getOrCreateWallet } from '@blockrun/llm';
|
|
25
25
|
import { loadConfig } from '../commands/config.js';
|
|
26
26
|
import { loadChain, API_URLS, VERSION } from '../config.js';
|
|
27
|
+
import { logger } from '../logger.js';
|
|
27
28
|
// ─── Constants ────────────────────────────────────────────────────────────
|
|
28
29
|
const ZEROX_GATEWAY_PATH = '/v1/zerox/gasless';
|
|
29
30
|
const QUOTE_TIMEOUT_MS = 30_000;
|
|
@@ -235,7 +236,7 @@ async function pollUntilDone(tradeHash, ctx) {
|
|
|
235
236
|
}
|
|
236
237
|
catch (err) {
|
|
237
238
|
// Surface a transient failure but keep polling — relayer might be backlogged.
|
|
238
|
-
|
|
239
|
+
logger.warn(`[franklin] gasless status poll error: ${err.message}`);
|
|
239
240
|
}
|
|
240
241
|
if (last.status === 'confirmed' ||
|
|
241
242
|
last.status === 'succeeded' ||
|
package/package.json
CHANGED