@blockrun/franklin 3.35.0 → 3.35.1
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/agent/context.js +7 -3
- package/dist/agent/llm.js +15 -2
- package/dist/agent/optimize.js +4 -0
- package/dist/agent/tokens.js +3 -0
- package/dist/pricing.js +2 -0
- package/dist/ui/model-picker.js +8 -0
- package/package.json +1 -1
package/dist/agent/context.js
CHANGED
|
@@ -534,9 +534,12 @@ export function getModelGuidance(model) {
|
|
|
534
534
|
- Keep responses under 300 words. Be direct, not verbose.
|
|
535
535
|
- Before responding: does every URL and fact come from a tool result? If not, remove it.`;
|
|
536
536
|
}
|
|
537
|
-
// Medium models: balanced guidance
|
|
537
|
+
// Medium models: balanced guidance. The bare `qwen` match dates from when
|
|
538
|
+
// every qwen id on the gateway was a free NVIDIA SKU — qwen3.7-max is a paid
|
|
539
|
+
// 1M-context flagship and belongs in the strong branch below.
|
|
538
540
|
if (m.includes('kimi') || m.includes('grok') || m.includes('flash') ||
|
|
539
|
-
m.includes('haiku') || m.includes('deepseek') ||
|
|
541
|
+
m.includes('haiku') || m.includes('deepseek') ||
|
|
542
|
+
(m.includes('qwen') && !m.includes('qwen3.7-max'))) {
|
|
540
543
|
return `# Execution Guidance
|
|
541
544
|
- Use tools to verify facts before stating them. Do not answer from memory when a tool can confirm.
|
|
542
545
|
- Batch independent tool calls in one response (parallel execution).
|
|
@@ -546,7 +549,8 @@ export function getModelGuidance(model) {
|
|
|
546
549
|
// Strong models: quality standards + thinking guidance
|
|
547
550
|
if (m.includes('claude') || m.includes('gpt-5') || m.includes('opus') ||
|
|
548
551
|
m.includes('sonnet') || m.includes('gemini-2.5-pro') || m.includes('gemini-3') ||
|
|
549
|
-
m.includes('o3') || m.includes('o1') || m.includes('codex')
|
|
552
|
+
m.includes('o3') || m.includes('o1') || m.includes('codex') ||
|
|
553
|
+
m.includes('qwen3.7-max')) {
|
|
550
554
|
return `# Quality Standards (strong model)
|
|
551
555
|
- Keep calling tools until the task is complete AND the result is verified. Don't stop at "this should work" — prove it works.
|
|
552
556
|
- Before finalizing: check correctness, grounding in tool output, and formatting.
|
package/dist/agent/llm.js
CHANGED
|
@@ -19,6 +19,10 @@ const MODELS_WITHOUT_TOOL_CHOICE_SUBSTR = [
|
|
|
19
19
|
'deepseek-reasoner',
|
|
20
20
|
'openai/o1',
|
|
21
21
|
'openai/o3',
|
|
22
|
+
// Qwen3.7 Max — plain tool use works, but any `tool_choice` on the payload
|
|
23
|
+
// 400s ("Invalid request: 400 Provider returned error"). Caught 2026-07-20
|
|
24
|
+
// by the grounding-retry path, which is the only place we force tool use.
|
|
25
|
+
'qwen3.7-max',
|
|
22
26
|
];
|
|
23
27
|
function modelDoesNotSupportToolChoice(model) {
|
|
24
28
|
if (!model)
|
|
@@ -678,10 +682,19 @@ export class ModelClient {
|
|
|
678
682
|
// know that. Catch the error, drop tool_choice, re-fire once.
|
|
679
683
|
// No payment re-sign needed — original 402 already settled, and
|
|
680
684
|
// the gateway treats this as the same logical request.
|
|
685
|
+
// Second shape, verified 2026-07-20 on qwen/qwen3.7-max: the gateway
|
|
686
|
+
// returns an OPAQUE `400 Invalid request: 400 Provider returned error`
|
|
687
|
+
// that never names tool_choice, so the precise match below can't fire
|
|
688
|
+
// and the user just sees "Tool schema rejected by this model". Since
|
|
689
|
+
// the request has already failed, dropping tool_choice and re-firing
|
|
690
|
+
// once costs nothing on the happy path and self-heals the whole class
|
|
691
|
+
// for models we haven't catalogued yet. If tool_choice wasn't the
|
|
692
|
+
// cause, the retry 400s again and the original error still surfaces.
|
|
681
693
|
const lc = message.toLowerCase();
|
|
682
694
|
const looksLikeToolChoiceReject = response.status === 400 &&
|
|
683
|
-
lc.includes('tool_choice') &&
|
|
684
|
-
|
|
695
|
+
((lc.includes('tool_choice') &&
|
|
696
|
+
(lc.includes('not support') || lc.includes('unsupported') || lc.includes('does not support'))) ||
|
|
697
|
+
requestPayload['tool_choice'] !== undefined);
|
|
685
698
|
if (looksLikeToolChoiceReject && requestPayload['tool_choice'] !== undefined) {
|
|
686
699
|
delete requestPayload['tool_choice'];
|
|
687
700
|
const retryBody = JSON.stringify(requestPayload);
|
package/dist/agent/optimize.js
CHANGED
|
@@ -57,6 +57,10 @@ const MODEL_MAX_OUTPUT = {
|
|
|
57
57
|
'moonshot/kimi-k3': 65_536,
|
|
58
58
|
'moonshot/kimi-k2.7': 65_536,
|
|
59
59
|
'moonshot/kimi-k2.6': 65_536,
|
|
60
|
+
// Qwen3.7 Max — gateway model entry reports max_output: 65536. Same 4×
|
|
61
|
+
// headroom the K3 entry above recovers; without it the paid model gets the
|
|
62
|
+
// 16K default and truncates mid-answer, burning USDC on continuation calls.
|
|
63
|
+
'qwen/qwen3.7-max': 65_536,
|
|
60
64
|
};
|
|
61
65
|
/** Get max output tokens for a model */
|
|
62
66
|
export function getMaxOutputTokens(model) {
|
package/dist/agent/tokens.js
CHANGED
|
@@ -266,6 +266,9 @@ const MODEL_CONTEXT_WINDOWS = {
|
|
|
266
266
|
'nvidia/nemotron-nano-12b-v2-vl': 131_072,
|
|
267
267
|
'nvidia/llama-4-maverick': 131_072,
|
|
268
268
|
'nvidia/mistral-large-3-675b': 131_072,
|
|
269
|
+
// Qwen (paid) — Max tier is 1M ctx; the generic `qwen` fallback below is
|
|
270
|
+
// 128k and would compact ~8x too early.
|
|
271
|
+
'qwen/qwen3.7-max': 1_000_000,
|
|
269
272
|
};
|
|
270
273
|
/**
|
|
271
274
|
* Get the context window size for a model, with a conservative default.
|
package/dist/pricing.js
CHANGED
|
@@ -105,6 +105,8 @@ export const MODEL_PRICING = {
|
|
|
105
105
|
'minimax/minimax-m3': { input: 0.3, output: 1.2 },
|
|
106
106
|
'minimax/minimax-m2.7': { input: 0.3, output: 1.2 },
|
|
107
107
|
'minimax/minimax-m2.5': { input: 0.3, output: 1.2 },
|
|
108
|
+
// Qwen
|
|
109
|
+
'qwen/qwen3.7-max': { input: 1.475, output: 4.425 },
|
|
108
110
|
// Moonshot — K3 is the gateway flagship (2026-07): 2.8T open MoE, 1M
|
|
109
111
|
// context, multimodal (image+text), returns reasoning_content. Pricier
|
|
110
112
|
// than the K2.x line it replaced ($3/$15 vs K2.7's $0.95/$4).
|
package/dist/ui/model-picker.js
CHANGED
|
@@ -132,6 +132,11 @@ export const MODEL_SHORTCUTS = {
|
|
|
132
132
|
minimax: 'minimax/minimax-m3',
|
|
133
133
|
'm3': 'minimax/minimax-m3',
|
|
134
134
|
'm2.7': 'minimax/minimax-m2.7',
|
|
135
|
+
// Qwen (paid). NOTE: bare `qwen` stays pinned to the FREE nvidia default
|
|
136
|
+
// above — never repoint a free alias at a paid model.
|
|
137
|
+
'qwen-max': 'qwen/qwen3.7-max',
|
|
138
|
+
'qwen3.7-max': 'qwen/qwen3.7-max',
|
|
139
|
+
'qwen-3.7-max': 'qwen/qwen3.7-max',
|
|
135
140
|
glm: 'zai/glm-5.2',
|
|
136
141
|
'glm-5': 'zai/glm-5',
|
|
137
142
|
'glm-5.2': 'zai/glm-5.2',
|
|
@@ -205,6 +210,7 @@ const PROVIDER_ORDER = [
|
|
|
205
210
|
'zai',
|
|
206
211
|
'moonshot',
|
|
207
212
|
'minimax',
|
|
213
|
+
'qwen',
|
|
208
214
|
'deepseek',
|
|
209
215
|
'nvidia',
|
|
210
216
|
];
|
|
@@ -216,6 +222,7 @@ const PROVIDER_LABELS = {
|
|
|
216
222
|
zai: 'Z.AI / GLM',
|
|
217
223
|
moonshot: 'Moonshot / Kimi',
|
|
218
224
|
minimax: 'MiniMax',
|
|
225
|
+
qwen: 'Qwen / Alibaba',
|
|
219
226
|
deepseek: 'DeepSeek',
|
|
220
227
|
nvidia: 'Free / NVIDIA',
|
|
221
228
|
};
|
|
@@ -254,6 +261,7 @@ export const PICKER_CATEGORIES = [
|
|
|
254
261
|
{ id: 'anthropic/claude-fable-5', shortcut: 'fable', label: 'Claude Fable 5', price: '$10/$50' },
|
|
255
262
|
{ id: 'anthropic/claude-opus-4.8', shortcut: 'opus', label: 'Claude Opus 4.8', price: '$5/$25', highlight: true },
|
|
256
263
|
{ id: 'anthropic/claude-sonnet-5', shortcut: 'sonnet', label: 'Claude Sonnet 5', price: '$3/$15' },
|
|
264
|
+
{ id: 'qwen/qwen3.7-max', shortcut: 'qwen-max', label: 'Qwen3.7 Max', price: '$1.475/$4.425', highlight: true },
|
|
257
265
|
{ id: 'openai/gpt-5.6-sol', shortcut: 'gpt', label: 'GPT-5.6 Sol', price: '$5/$30', highlight: true },
|
|
258
266
|
{ id: 'google/gemini-3.1-pro', shortcut: 'gemini-3', label: 'Gemini 3.1 Pro', price: '$2/$12' },
|
|
259
267
|
{ id: 'google/gemini-2.5-pro', shortcut: 'gemini', label: 'Gemini 2.5 Pro', price: '$1.25/$10' },
|
package/package.json
CHANGED