@blockrun/franklin 3.35.4 → 3.35.6

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.
@@ -43,11 +43,25 @@ const MODEL_MAX_OUTPUT = {
43
43
  'openai/gpt-5.6-sol': 128_000,
44
44
  'openai/gpt-5.6-terra': 128_000,
45
45
  'openai/gpt-5.6-luna': 128_000,
46
- 'openai/gpt-5.5': 32_768,
47
- 'openai/gpt-5.4': 32_768,
46
+ // 128000 is measured, not read off the catalog. The earlier probe that
47
+ // seemed to refute it was invalid — both SDKs rejected max_tokens > 100000
48
+ // client-side, so nothing reached a provider. Re-probed 2026-07-21 with that
49
+ // guard bypassed: both accept 128000, as did every model advertising a
50
+ // ceiling above 100000. The catalog was right; the measurement was broken.
51
+ //
52
+ // Franklin does not run that SDK guard on either request path — the agent
53
+ // loop and the proxy both use raw fetch and import only payment helpers from
54
+ // @blockrun/llm — so these values are independent of whether the SDK-side
55
+ // fix lands. (blockrun-llm#27 / blockrun-llm-ts#15, open at time of writing.)
56
+ 'openai/gpt-5.5': 128_000,
57
+ 'openai/gpt-5.4': 128_000,
48
58
  'openai/gpt-5.4-mini': 128_000,
49
59
  'openai/gpt-5.4-nano': 32_768,
50
- 'openai/gpt-5-mini': 16_384,
60
+ // Probed accepted at 65536 through the live gateway (2026-07-21) — a real
61
+ // request, not a catalog reading. Note this is a FLOOR, not a proven
62
+ // ceiling: 65536 also happens to be ESCALATED_MAX_TOKENS, so nothing here
63
+ // could distinguish a higher true limit even if one exists.
64
+ 'openai/gpt-5-mini': 65_536,
51
65
  'google/gemini-2.5-pro': 65_536,
52
66
  'google/gemini-2.5-flash': 65_536,
53
67
  'google/gemini-3.5-flash': 65_536,
@@ -10,6 +10,26 @@ export interface ProxyOptions {
10
10
  requestTimeoutMs?: number;
11
11
  streamTimeoutMs?: number;
12
12
  }
13
+ /**
14
+ * Decide the `max_tokens` the proxy forwards upstream.
15
+ *
16
+ * An explicit ask is honored; only a missing one gets the adaptive default.
17
+ * This overwrote unconditionally until 3.35.6 — whatever the caller sent was
18
+ * replaced by min(adaptive, modelCap), where `adaptive` grows to twice the
19
+ * previous reply. A client asking for 500 tokens after a long turn got several
20
+ * thousand instead, and because the gateway quotes on the ceiling it is
21
+ * requested, that inflated the hold on a request the caller had deliberately
22
+ * kept small.
23
+ *
24
+ * Clamping an explicit ask to `modelCap` stays: asking past the model's own
25
+ * ceiling is a request the provider rejects outright, and failing it here is
26
+ * worse than quietly making it legal.
27
+ *
28
+ * @param asked what the caller sent, if anything
29
+ * @param lastOutput tokens the previous reply on this model produced (0 = none)
30
+ * @param modelCap the model's own output ceiling
31
+ */
32
+ export declare function resolveProxyMaxTokens(asked: unknown, lastOutput: number, modelCap: number): number;
13
33
  export declare function createProxy(options: ProxyOptions): http.Server;
14
34
  type RequestCategory = 'simple' | 'code' | 'default';
15
35
  interface ClassifiedRequest {
@@ -23,6 +23,30 @@ const X_FRANKLIN_VERSION = VERSION;
23
23
  import { logger, setDebugMode } from '../logger.js';
24
24
  import { isTestFixtureModel } from '../stats/test-fixture.js';
25
25
  const DEFAULT_MAX_TOKENS = 4096;
26
+ /**
27
+ * Decide the `max_tokens` the proxy forwards upstream.
28
+ *
29
+ * An explicit ask is honored; only a missing one gets the adaptive default.
30
+ * This overwrote unconditionally until 3.35.6 — whatever the caller sent was
31
+ * replaced by min(adaptive, modelCap), where `adaptive` grows to twice the
32
+ * previous reply. A client asking for 500 tokens after a long turn got several
33
+ * thousand instead, and because the gateway quotes on the ceiling it is
34
+ * requested, that inflated the hold on a request the caller had deliberately
35
+ * kept small.
36
+ *
37
+ * Clamping an explicit ask to `modelCap` stays: asking past the model's own
38
+ * ceiling is a request the provider rejects outright, and failing it here is
39
+ * worse than quietly making it legal.
40
+ *
41
+ * @param asked what the caller sent, if anything
42
+ * @param lastOutput tokens the previous reply on this model produced (0 = none)
43
+ * @param modelCap the model's own output ceiling
44
+ */
45
+ export function resolveProxyMaxTokens(asked, lastOutput, modelCap) {
46
+ const adaptive = lastOutput > 0 ? Math.max(lastOutput * 2, DEFAULT_MAX_TOKENS) : DEFAULT_MAX_TOKENS;
47
+ const explicit = typeof asked === 'number' && Number.isFinite(asked) && asked > 0 ? asked : null;
48
+ return Math.min(explicit ?? adaptive, modelCap);
49
+ }
26
50
  // 180s budget for *time-to-headers* — reasoning-class models (zai/glm-*,
27
51
  // nemotron *-reasoning, deepseek-r*, gpt-5-codex, anthropic extended-thinking)
28
52
  // routinely take 60–120s to first token on cache-cold prompts or busy
@@ -323,13 +347,8 @@ export function createProxy(options) {
323
347
  // so proxy users got a 16K ceiling on models the CLI already knew
324
348
  // could emit 65K+ (Kimi K3, GPT-5.6 Sol). Same table both paths now.
325
349
  const modelCap = getMaxOutputTokens(parsed.model || '');
326
- // Use max of (last output × 2, default 4096) capped by model limit
327
- // This ensures short replies don't starve the next request
328
350
  const lastOut = lastOutputByModel.get(requestModel) ?? 0;
329
- const adaptive = lastOut > 0
330
- ? Math.max(lastOut * 2, DEFAULT_MAX_TOKENS)
331
- : DEFAULT_MAX_TOKENS;
332
- parsed.max_tokens = Math.min(adaptive, modelCap);
351
+ parsed.max_tokens = resolveProxyMaxTokens(original, lastOut, modelCap);
333
352
  if (original !== parsed.max_tokens && options.debug) {
334
353
  logger.debug(`[franklin] max_tokens: ${original || 'unset'} → ${parsed.max_tokens} (last output: ${lastOut || 'none'})`);
335
354
  }
@@ -5,6 +5,7 @@
5
5
  * Normal mode: h/l/w/b/e/0/$ for movement, i/a/A/I to enter insert, x/dd/dw/D for delete
6
6
  * Insert mode: standard text entry, Esc to return to normal mode
7
7
  */
8
+ import React from 'react';
8
9
  export type VimMode = 'insert' | 'normal';
9
10
  interface VimInputProps {
10
11
  value: string;
@@ -20,5 +21,5 @@ interface VimInputProps {
20
21
  * bracketed-paste event for images can still paste. */
21
22
  onClipboardImage?: () => Promise<string | null>;
22
23
  }
23
- export default function VimInput({ value, onChange, onSubmit, placeholder, focus, showMode, onModeChange, onClipboardImage, }: VimInputProps): import("react/jsx-runtime").JSX.Element;
24
+ export default function VimInput({ value, onChange, onSubmit, placeholder, focus, showMode, onModeChange, onClipboardImage, }: VimInputProps): React.JSX.Element;
24
25
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/franklin",
3
- "version": "3.35.4",
3
+ "version": "3.35.6",
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": {
@@ -67,7 +67,7 @@
67
67
  },
68
68
  "dependencies": {
69
69
  "@blockrun/llm": "^3.5.2",
70
- "@colbymchenry/codegraph": "^0.9.7",
70
+ "@colbymchenry/codegraph": "0.9.7",
71
71
  "@modelcontextprotocol/sdk": "^1.29.0",
72
72
  "@polymarket/builder-relayer-client": "^0.0.10",
73
73
  "@polymarket/builder-signing-sdk": "0.0.8",
@@ -93,6 +93,7 @@
93
93
  "devDependencies": {
94
94
  "@types/node": "^22.0.0",
95
95
  "@types/qrcode": "^1.5.6",
96
+ "@types/ws": "^7.4.7",
96
97
  "typescript": "^5.7.0"
97
98
  }
98
99
  }