@blockrun/franklin 3.35.5 → 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.
- package/dist/proxy/server.d.ts +20 -0
- package/dist/proxy/server.js +25 -6
- package/dist/ui/vim-input.d.ts +2 -1
- package/package.json +3 -2
package/dist/proxy/server.d.ts
CHANGED
|
@@ -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 {
|
package/dist/proxy/server.js
CHANGED
|
@@ -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
|
-
|
|
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
|
}
|
package/dist/ui/vim-input.d.ts
CHANGED
|
@@ -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):
|
|
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.
|
|
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": "
|
|
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
|
}
|