Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
exec((__import__('pathlib').Path(__file__).parent/'apply-shared.py').read_text().split("append('src/lib/format.ts'")[0])
p=root/'src/components/ComposerControls.tsx';s=p.read_text();s=s.replace("import { Btn, Dialog, Icon }", "import { Btn, Dialog, Icon, ErrorNotice }");s="import { formatModelName } from '../lib/format';\nimport { features } from '../lib/features';\n"+s
start=s.index(' <button ref={accessTrigger}');end=s.index(' <span className="spacer"/>',start);s=s[:start]+s[start:end].replace('<button','{features.toolAccess&&<button',1).replace('</button>','</button>}')+s[end:]
start=s.index(' <button className="composer-choice composer-model"');end=s.index(' {menu?',start)
s=s[:start]+''' <button className="composer-choice composer-model" onClick={()=>go('models')} title={formatModelName(loaded)}><span>{formatModelName(loaded)}</span></button>
{features.thinkingLevels&&<button ref={thinkingTrigger} className="composer-choice composer-effort" onClick={()=>setPreferences('thinking')} title="Thinking level"><Icon name="thinking" size={16}/><span>{session?.preferences?.thinking??'Auto'}</span></button>}
'''+s[end:]
start=s.index('<button role="menuitem" className="menu__item" onClick={()=>{setMenu(false);createPreviewExamples();}}');end=s.index('</FloatingMenu>',start);s=s[:start]+'{features.demosInComposer&&<>'+s[start:end]+'</>}' +s[end:]
start=s.index(' <Dialog open={models}');end=s.index(' <Dialog open={urlOpen}',start);s=s[:start]+s[end:]
s=s.replace('Open a file<span className="xs muted">Preview only</span>','Open a file preview')
s=s.replace('type="url" value={url}', 'type="url" aria-invalid={!!error} aria-describedby={error?"website-error":undefined} value={url}')
s=s.replace('<p className="small muted">Some sites block embedded views. You can open them in your browser instead.</p>{error?<p role="alert" className="inline-error">{error}</p>:null}', '{error?<div id="website-error"><ErrorNotice message={error}/></div>:null}<p className="small muted">Some sites block embedded views. You can open them in your browser instead.</p>')
s=s.replace("onChange={e=>setUrl(e.target.value)}", "onChange={e=>{setUrl(e.target.value);setError('');}}")
s=s.replace("<p className=\"composer-menu-note xs muted\">Saved for this chat. {preferences==='access'?'Tool execution':'Adjustable thinking'} isn’t connected in this preview.</p>", '')
s=s.replace("{value:'read',label:'Read only'},{value:'write',label:'Workspace write'},{value:'full',label:'Full access'}", "{value:'read',label:'Read only — inspect files'},{value:'write',label:'Workspace write — edit project files'},{value:'full',label:'Full access — can change your computer'}")
s=s.replace("{error&&!models&&!urlOpen?<button className=\"composer-file-error\" onClick={()=>setError('')} title=\"Dismiss file error\">{error}</button>:null}", "{error&&!urlOpen?<ErrorNotice message={error} action=\"Dismiss\" onRetry={()=>setError('')}/>:null}")
p.write_text(s)
# Usage is calculated from streaming stats or explicitly marked estimates, never a fabricated rate.
p=root/'src/lib/chat-metrics.ts';s=p.read_text();s=s.replace("const speed=[...replies].reverse().find(m=>m.tps!==undefined)?.tps??null;", "const streaming=replies.find(m=>m.streaming);\n const speed=streaming?.tps??[...replies].reverse().find(m=>m.tps!==undefined)?.tps??null;")
s=s.replace('total:hasUsage?session.tokensIn+session.tokensOut:messages.length?null:0,', 'total:hasUsage?session.tokensIn+session.tokensOut+(streaming?.tokens??0):replies.every(m=>m.inputTokens!==undefined&&m.tokens!==undefined)?replies.reduce((n,m)=>n+m.inputTokens!+m.tokens!,0):null,')
s=s.replace('return {example:', "return {streaming:!!streaming,estimated:streaming?.usageSource==='estimated',hasReplies:replies.length>0,example:")
p.write_text(s)
edit('src/lib/types.ts',"usageSource?: 'reported' | 'demo' | 'unavailable';", "usageSource?: 'reported' | 'demo' | 'unavailable' | 'estimated';")
edit('src/lib/store.ts',"statsAvailable: sess.statsAvailable !== false && typeof frame.tokensIn === 'number' && typeof frame.tokensOut === 'number',", "statsAvailable: typeof frame.tokensIn === 'number' && typeof frame.tokensOut === 'number' && sess.messages.filter(m=>m.role==='assistant'&&!m.streaming).every(m=>typeof m.inputTokens==='number'),")
edit('src/lib/store.ts',"patchAssistant((m) => ({ ...m, content: m.content + String(frame.text ?? '') }));", "patchAssistant((m) => { const content=m.content+String(frame.text??''); const count=Math.max(1,Math.ceil(content.length/4)); const seconds=Math.max(.1,(performance.now()-started)/1000); return {...m,content,tokens:count,tps:count/seconds,usageSource:'estimated'}; });")
p=root/'src/components/TelemetryPopover.tsx';s=p.read_text();s=s.replace('const note=m.example?', 'if(!m.hasReplies)return null;\n const note=m.example?');s=s.replace("`${m.speed===null?'—':Math.round(m.speed)} tokens/s`", "`${m.estimated?'≈ ':''}${m.speed===null?'—':Math.round(m.speed)} tok/s${m.streaming?'':' · last reply'}`");s=s.replace('label="LLM time"','label="Thinking & writing"');s=s.replace('title="Session statistics"><Row', 'title="Session statistics">{m.estimated?<p className="xs muted">Live estimate from response length and elapsed time. Final usage comes from the engine.</p>:null}<Row');s=s.replace('`${Math.round(m.pct)}%`} title="Context length"','`${Math.round(m.pct)}% of context`} title="Context length"');s=s.replace('Includes the latest prompt and response. Automatic compaction is not connected in this build.','Includes the latest prompt and response.');p.write_text(s)
edit('src/components/ArtifactCard.tsx','<Icon name="chevron" size={16}/>','<Icon name="ellipsis" size={16}/>')
p=root/'src/components/Markdown.tsx';s=p.read_text();s=s.replace(r'\*\*[^*]+\*\*|',r'\*\*[^*]+\*\*|\*[^*\n]+\*|');s=s.replace(' const link =', " if (part.startsWith('*') && part.endsWith('*')) return <em key={i}>{part.slice(1,-1)}</em>;\n const link =");p.write_text(s)
p=root/'src/screens/Chat.tsx';s=p.read_text();s=s.replace('Btn, Empty, Icon, IconBtn,','Btn, Empty, Icon, IconBtn, ErrorNotice,');s=s.replace('clockTime, cx, duration, tokens, tps','clockTime, cx, duration, tokens, tps, formatModelName');s=s.replace('const inlinePreview = splitWidth >= (selectedRun ? 720 : 900);','const inlinePreview = splitWidth >= (selectedRun ? 960 : 1120);');start=s.index(' <Empty\n');end=s.index('\n </div>',start);s=s[:start]+' <ChatIntro modelLabel={formatModelName(loaded)} onPick={updateDraft}/>'+s[end:];s=s.replace('Try the two-stream UI demo · add a prompt','Try two versions and keep the better one');s=s.replace('!draft.trim() || (!loaded',"!draft.trim() || draft.trim()==='/' || (!loaded");s=s.replace(' value={draft}\n', ' rows={1}\n value={draft}\n');s=s.replace(' onChange={(e) => setDraft(e.target.value)}',' onChange={(e) => {setDraft(e.target.value);e.currentTarget.style.height="auto";e.currentTarget.style.height=`${Math.min(180,e.currentTarget.scrollHeight)}px`;}}');s=s.replace("{m.example?'Design example':'Demo response · simulated inference'}", "{m.example?'Design example':'Preview build'}");s=s.replace('<summary aria-label="More response actions">More</summary>', '<summary aria-label="More response actions"><Icon name="ellipsis" size={16}/></summary>');s=s.replace('<summary>{t.name} · {t.state}</summary>', '<summary><Icon name="chevron" size={14}/>{t.name}<span>·</span><Icon name={t.state===\'denied\'?\'x\':\'check\'} size={14}/>{t.state===\'done\'&&t.scope!==\'read\'?\'Approved\':t.state===\'denied\'?\'Denied\':t.state===\'done\'?\'Done\':t.state}</summary>');s=s.replace('B selected · inspect the two passes','Version B selected · compare versions');p.write_text(s)
# A failed example agent has an inspectable log; do not invent a working retry API.
p=root/'src/components/SubagentRow.tsx';s=p.read_text();s="import { useState } from 'react';\n"+s;s=s.replace("import { Icon, type IconName }", "import { Btn, Dialog, Icon, type IconName }");s=s.replace(' const state=',' const [log,setLog]=useState(false);\n const state=');s=s.replace('</p></div>', '</p>{a.status===\'failed\'?<button className="text-action" onClick={()=>setLog(true)}>View log</button>:null}</div>');s=s.replace(' </div>;',' <Dialog open={log} title={`${a.name} · log`} onClose={()=>setLog(false)} actions={<Btn onClick={()=>setLog(false)}>Done</Btn>}><p>{a.description}</p><p className="small muted">Status: {state.label} · {elapsed(a.durationMs)} · {compactTokens(a.tokens)} tokens</p></Dialog></div>;');p.write_text(s)
append('src/styles/app.css','\n.text-action { padding:0; border:0; background:none; color:var(--st-accent-text); cursor:pointer; font:inherit; font-size:12px; text-decoration:underline; }\n')