dsh-vision-router 3.1.5 → 3.2.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.
Files changed (47) hide show
  1. package/README.md +6 -6
  2. package/README.zh.md +6 -6
  3. package/THIRD_PARTY_NOTICES.md +107 -0
  4. package/assets/licenses/apache-2.0.txt +202 -0
  5. package/assets/licenses/moxcms-BSD-3-Clause.txt +26 -0
  6. package/assets/licenses/roots-BSD-2-Clause.txt +24 -0
  7. package/assets/licenses/unicode-ident-Unicode-3.0.txt +39 -0
  8. package/assets/licenses/vtracer-MIT.txt +25 -0
  9. package/assets/licenses/zlib-rs-Zlib.txt +19 -0
  10. package/cordis.patch.yml +8 -15
  11. package/docs/architecture/dsh-support-window-3.1-historical.md +98 -0
  12. package/docs/architecture/dsh-support-window.md +30 -83
  13. package/docs/architecture/dvr32-host-retirement.md +194 -0
  14. package/docs/ci-archive/README.md +3 -0
  15. package/docs/ci-archive/minimum-host-settings-persistence.legacy.js +118 -0
  16. package/docs/compatibility/dsh-0.2.2-rc2-audit.md +40 -0
  17. package/docs/compliance/vtracer-alpha4-provenance.md +47 -0
  18. package/docs/compliance/vtracer-alpha4-reconstructed-Cargo.lock +567 -0
  19. package/docs/compliance/vtracer-alpha4-rust-inventory.json +421 -0
  20. package/docs/compliance/vtracer-alpha4-rust-license-texts.md +13018 -0
  21. package/docs/progressive-tools-cache.md +4 -0
  22. package/docs/releases/v3.2.0-rc.0.md +16 -0
  23. package/docs/releases/v3.2.0.md +38 -0
  24. package/docs/releases/v3.2.1.md +21 -0
  25. package/docs/remote-settings.md +83 -8
  26. package/index.js +55 -57
  27. package/lib/client.js +13 -13
  28. package/lib/core-primitives.js +69 -187
  29. package/lib/doctor-cli-p0.js +14 -1
  30. package/lib/doctor-cli.js +70 -2
  31. package/lib/doctor-runtime.js +8 -3
  32. package/lib/doctor.js +57 -1
  33. package/lib/dsh-support-window.js +80 -31
  34. package/lib/grounding-box-recovery.js +76 -0
  35. package/lib/grounding-coordinate-runtime.js +10 -0
  36. package/lib/remote-settings-bridge.js +93 -57
  37. package/lib/remote-settings-risk-client-boundary.js +2 -2
  38. package/lib/runtime-i18n.js +4 -4
  39. package/lib/settings-client-017-compat.js +4 -2
  40. package/lib/settings-ia-client-prelude.js +26 -10
  41. package/lib/trace-vtracer-worker.js +163 -0
  42. package/lib/web/dsh-settings-017-root-transport.js +52 -6
  43. package/lib/web-capability-boundary.js +6 -0
  44. package/package.json +21 -26
  45. package/presets/README.md +0 -9
  46. package/presets/web-connection-ready/index.mjs +0 -48
  47. package/presets/web-connection-ready/package.json +0 -6
@@ -145,7 +145,26 @@ export const SETTINGS_IA_CLIENT_PRELUDE = String.raw`(function(){
145
145
  function reportFailures(failures){if(!localPage()||typeof fetch!=='function'||!Array.isArray(failures)||!failures.length)return;try{void fetch('/_dsh/vision-router/settings-save-diagnostics',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({failures:failures.slice(0,24)})}).catch(function(){});}catch(_){}}
146
146
 
147
147
  if(!snapshot||snapshot.status!=='ready'){
148
- var loading=!snapshot||snapshot.status==='loading';var disabled=snapshot&&snapshot.remoteDisabled===true;var reason=snapshot&&snapshot.remoteReason;var titleText=loading?tx('正在加载 Vision Router 设置…','Loading Vision Router settings…'):disabled?tx('远程设置未启用','Remote settings are not enabled'):reason==='namespace-unavailable'?tx('Vision Router 设置正在初始化','Vision Router settings are initializing'):tx('远程设置通道不可用','Remote settings channel unavailable');var bodyText=loading?tx('正在读取 Host 设置。','Reading Host settings.'):disabled?tx('你刚才没有授权远程修改。请在可信网络中重新进入此页面并确认风险提示,或从运行 DSH 的机器通过回环地址开启远程设置。','Remote editing was not authorized. Reopen this page and accept the risk prompt on a trusted network, or enable it from the DSH machine over loopback.'):snapshot&&snapshot.remoteErrorCode==='not-found'?tx('远程设置路由返回 404;若使用 Nginx/Caddy,请同时转发 /vision-router-settings/*。','The remote settings route returned 404; if using Nginx/Caddy, proxy /vision-router-settings/* as well.'):tx('无法读取 Vision Router 的远程设置。请检查 trusted host、反向代理和插件版本。','Vision Router remote settings could not be read. Check the trusted host, reverse proxy, and plugin version.');return h('div',{className:'vr-settings-ia-root','data-vr-settings-ia':'1'},h('div',{className:'vr-card vr-card-open vr-ia-card'},h('div',{className:'vr-body',style:{borderTop:0}},h('h3',{className:'vr-ia-title'},titleText),h('p',{className:'vr-hint'},bodyText),scope&&typeof scope.load==='function'&&!loading?h('button',{type:'button',className:'vr-btn',onClick:function(){void scope.load();}},tx('重试','Retry')):null)));
148
+ var loading=!snapshot||snapshot.status==='loading';
149
+ var localFailure=snapshot&&snapshot.mode==='host';
150
+ var disabled=snapshot&&snapshot.remoteDisabled===true;
151
+ var reason=snapshot&&snapshot.remoteReason;
152
+ var titleText=loading?tx('正在加载 Vision Router 设置…','Loading Vision Router settings…')
153
+ :localFailure?tx('本地设置不可用','Local settings unavailable')
154
+ :disabled?tx('远程设置未启用','Remote settings are not enabled')
155
+ :reason==='namespace-unavailable'?tx('Vision Router 设置正在初始化','Vision Router settings are initializing')
156
+ :tx('远程设置通道不可用','Remote settings channel unavailable');
157
+ var bodyText=loading?tx('正在读取 Host 设置。','Reading Host settings.')
158
+ :localFailure?tx('本地设置桥接未能读取配置,请检查 /_dsh/vision-router/local-settings 和插件加载状态。','The local settings bridge could not read configuration. Check /_dsh/vision-router/local-settings and the plugin lifecycle.')
159
+ :disabled?tx('你尚未授权远程修改。请在可信网络中重新进入此页面并确认风险提示,或从运行 DSH 的机器通过回环地址开启远程设置。','Remote editing was not authorized. Reopen this page and accept the risk prompt on a trusted network, or enable it over loopback.')
160
+ :snapshot&&snapshot.remoteErrorCode==='remote-route-missing'?tx('远程设置路由返回 404;若使用 Nginx/Caddy,请同时转发 /vision-router-settings/*。','The remote settings route returned 404; if using Nginx/Caddy, proxy /vision-router-settings/* as well.')
161
+ :tx('无法读取 Vision Router 的远程设置。请检查 DSH 登录状态、trusted host、反向代理和插件版本。','Vision Router remote settings could not be read. Check DSH authentication, trusted host, reverse proxy, and plugin version.');
162
+ return h('div',{className:'vr-settings-ia-root','data-vr-settings-ia':'1'},
163
+ h('div',{className:'vr-card vr-card-open vr-ia-card'},
164
+ h('div',{className:'vr-body',style:{borderTop:0}},
165
+ h('h3',{className:'vr-ia-title'},titleText),
166
+ h('p',{className:'vr-hint'},bodyText),
167
+ scope&&typeof scope.load==='function'&&!loading?h('button',{type:'button',className:'vr-btn',onClick:function(){void scope.load();}},tx('重试','Retry')):null)));
149
168
  }
150
169
 
151
170
  var saved=obj(snapshot.value),user=obj(snapshot.user),writable=snapshot.writable===true,saving=saveState.status==='saving',local=localPage();
@@ -204,13 +223,10 @@ export const SETTINGS_IA_CLIENT_PRELUDE = String.raw`(function(){
204
223
  function modelOptions(provider,current,allowAll){var group=groupById.get(provider),models=arr(group&&group.models),listed=new Set(models.map(function(model){return model&&model.id;}).filter(Boolean)),nodes=[h('option',{value:'',key:'__empty'},allowAll?tx('全部模型','All models'):(provider?tx('选择模型…','Choose model…'):tx('先选供应商','Choose provider first')))];if(current&&!listed.has(current))nodes.push(h('option',{value:current,key:'__stale-'+current},current+' '+tx('(已保存)','(saved)')));models.forEach(function(model){if(model&&typeof model.id==='string'&&model.id)nodes.push(h('option',{value:model.id,key:model.id},modelName(group,model.id)));});return nodes;}
205
224
  function modelRow(row,index,rows,setRows,allowAll){var ready=groups.length>0;function update(next){var copy=rows.map(function(item){return Object.assign({},item);});copy[index]=next;setRows(copy);setSaveState({status:'idle'});}function providerChanged(provider){var next=Object.assign({},row,{provider:provider,model:''});if(!allowAll)next.fallbacks=[];update(next);}function remove(){var copy=rows.filter(function(_,i){return i!==index;});setRows(copy.length?copy:[{provider:'',model:'',fallbacks:[]}]);setSaveState({status:'idle'});}return h('div',{className:'vr-chain-row',key:index},ready?h('select',{className:'vr-input vr-select',value:row.provider||'',disabled:!writable||saving,onChange:function(event){providerChanged(event.target.value);}},providerOptions(row.provider||'')):h('input',{className:'vr-input',placeholder:'provider',value:row.provider||'',disabled:!writable||saving,onChange:function(event){providerChanged(event.target.value);}}),ready?h('select',{className:'vr-input vr-select',value:row.model||'',disabled:!writable||saving||!row.provider,onChange:function(event){update(Object.assign({},row,{model:event.target.value}));}},modelOptions(row.provider||'',row.model||'',allowAll)):h('input',{className:'vr-input',placeholder:allowAll?tx('model(留空=全部)','model (empty = all)'):'model',value:row.model||'',disabled:!writable||saving,onChange:function(event){update(Object.assign({},row,{model:event.target.value}));}}),h('button',{type:'button',className:'vr-reset',disabled:!writable||saving,onClick:remove},tx('移除','Remove')));}
206
225
 
207
- function egressInstructions(local){
208
- if(local)return tx(
226
+ function egressInstructions(){
227
+ return tx(
209
228
  '数据流向:云端识图(含免费兜底)会上传图片、裁剪和提示词。免费或免 Key 不等于离线。要停止上传,请在本页开启「仅本地视觉」,然后点击「保存」。云端聊天模型仍可能收到识图结果文字;要完全不出网,还需在聊天页选择本地聊天模型。',
210
229
  'Data flow: Cloud vision, including the free fallback, uploads images, crops and prompts. Free or keyless is not offline. To stop uploads, enable Local-only vision here and select Save. A cloud chat model may still receive result text; choose a local chat model in the composer to keep the whole workflow local.');
211
- return tx(
212
- '云端识图可能上传图片。要停止上传,请在运行 DSH 的电脑上打开「设置 → Vision Router → 常规」,开启「仅本地视觉」并保存。云端聊天模型仍可能收到识图结果文字;要完全不出网,还需在聊天页选择本地聊天模型。',
213
- 'Cloud vision may upload images. To stop uploads, open Settings → Vision Router → General on the DSH computer, enable Local-only vision and save. A cloud chat model may still receive result text; choose a local chat model in the composer to keep the whole workflow local.');
214
230
  }
215
231
  function egressNotice(localOnly,local){
216
232
  if(localOnly)return h('p',{className:'vr-hint',key:'egress'},tx(
@@ -262,7 +278,7 @@ export const SETTINGS_IA_CLIENT_PRELUDE = String.raw`(function(){
262
278
  '旧版 DSH:llm-pi-ai 使用 input: [text, image];llm-deepseek 使用 inputModalities: [text, image]。只有模型本身支持图片时才这样配置。经验证的 HTTP Chat Completions 通道也可能直接桥接;单独添加视觉能力标记不能开启图片传输。',
263
279
  'Older DSH: llm-pi-ai uses input: [text, image]; llm-deepseek uses inputModalities: [text, image]. Only declare image input if the model supports it. Verified HTTP Chat Completions may bridge; a capability label alone cannot enable image delivery.')));
264
280
  }
265
- return h(React.Fragment,null,title(tx('常规','General'),tx('这里只设置“谁负责看图”。聊天模型仍在聊天页选择。','This page only decides who reads images; the chat model is still chosen in chat.')),card([toggle('localOnlyVision',tx('仅本地视觉','Local-only vision'),tx('只使用本机识图模型;云端识图和免费兜底暂停,原配置保留。识图结果文字仍可能发给云端聊天模型。只能在本机修改。','Use only local vision models; cloud vision and the free fallback are paused without deleting settings. Result text may still go to a cloud chat model. Change this only on the local DSH machine.'),!local),h('div',{className:'vr-ia-status',key:'status'},h('strong',null,(activeLocalOnly?'🔒 ':localOnlyPending?'⚠ ':configured.length||fallback?'● ':'⚠ ')+status),h('p',{className:'vr-hint'},tx('需要看图时,在聊天框旁点击「👁 识图」。','Use “👁 Vision” beside the chat box when an image needs inspection.')),egressNotice(activeLocalOnly,local),localOnlyPending?h('p',{className:localOnly?'vr-failed':'vr-hint',key:'local-only-pending'},localOnly?tx('尚未生效:请点击页面底部「保存」。保存前图片仍可能上传。','Not active yet: select Save at the bottom. Images may still be uploaded until saved.'):tx('还没有保存:当前仍在仅本地视觉模式,保存后才会允许云端识图。','Not saved yet: Local-only vision remains active until you save.')):null,ordered.length?h('p',{className:'vr-ia-chain-summary'},ordered.join(' → ')):null,stale.length?h('p',{className:'vr-failed'},tx('有已保存的识图模型当前不在可调用目录中;请到“诊断”重新检测。','A saved vision model is not currently in the callable catalog; re-detect it in Diagnostics.')):null)]),card([h('div',{className:'vr-field',id:'vr-vision-backend-chain','data-vr-guide-target':'vision-backend',key:'chain'},fieldHead('providers',tx('识图模型','Vision models')),h('p',{className:'vr-hint'},tx('从上到下依次尝试;前一个失败时自动切换到下一个。','Models are tried from top to bottom and fall through automatically on failure.')),rows.map(function(row,index){return modelRow(row,index,rows,setChainDraft,false);}),
281
+ return h(React.Fragment,null,title(tx('常规','General'),tx('这里只设置“谁负责看图”。聊天模型仍在聊天页选择。','This page only decides who reads images; the chat model is still chosen in chat.')),card([toggle('localOnlyVision',tx('仅本地视觉','Local-only vision'),tx('只使用本机识图模型;云端识图和免费兜底暂停,原配置保留。识图结果文字仍可能发给云端聊天模型。远程修改也会改变 Host 的图像数据流向。','Use only local vision models; cloud vision and the free fallback are paused without deleting settings. Result text may still go to a cloud chat model. Remote changes also affect the Host image-data flow.'),false),h('div',{className:'vr-ia-status',key:'status'},h('strong',null,(activeLocalOnly?'🔒 ':localOnlyPending?'⚠ ':configured.length||fallback?'● ':'⚠ ')+status),h('p',{className:'vr-hint'},tx('需要看图时,在聊天框旁点击「👁 识图」。','Use “👁 Vision” beside the chat box when an image needs inspection.')),egressNotice(activeLocalOnly,local),localOnlyPending?h('p',{className:localOnly?'vr-failed':'vr-hint',key:'local-only-pending'},localOnly?tx('尚未生效:请点击页面底部「保存」。保存前图片仍可能上传。','Not active yet: select Save at the bottom. Images may still be uploaded until saved.'):tx('还没有保存:当前仍在仅本地视觉模式,保存后才会允许云端识图。','Not saved yet: Local-only vision remains active until you save.')):null,ordered.length?h('p',{className:'vr-ia-chain-summary'},ordered.join(' → ')):null,stale.length?h('p',{className:'vr-failed'},tx('有已保存的识图模型当前不在可调用目录中;请到“诊断”重新检测。','A saved vision model is not currently in the callable catalog; re-detect it in Diagnostics.')):null)]),card([h('div',{className:'vr-field',id:'vr-vision-backend-chain','data-vr-guide-target':'vision-backend',key:'chain'},fieldHead('providers',tx('识图模型','Vision models')),h('p',{className:'vr-hint'},tx('从上到下依次尝试;前一个失败时自动切换到下一个。','Models are tried from top to bottom and fall through automatically on failure.')),rows.map(function(row,index){return modelRow(row,index,rows,setChainDraft,false);}),
266
282
  readiness.filter(function(entry){return !localOnly&&(caps.status==='ready'||caps.status==='error')&&entry.state!=='evidence';}).map(function(entry,index){return h('div',{
267
283
  className:'vr-field',key:'readiness-'+index,'data-vr-model-readiness':entry.state
268
284
  },h('p',{className:entry.state==='text-only'||entry.state==='blocked'?'vr-failed':'vr-hint'},
@@ -344,13 +360,13 @@ export const SETTINGS_IA_CLIENT_PRELUDE = String.raw`(function(){
344
360
  );
345
361
  }
346
362
  function localProviderCard(key,label,defaults,which){var current=Object.assign({},defaults,obj(value(key,{}))),opened=which==='ollama'?open.ollama:open.lmstudio;function update(patch){setValue(key,Object.assign({},current,patch));}function sample(name,min,max){return h('div',{className:'vr-field'},h('span',{className:'vr-label'},name),h('input',{className:'vr-input',type:'number',step:'0.1',min:min,max:max,value:current[name]===undefined?'':current[name],disabled:!writable||saving,onChange:function(event){var patch={};patch[name]=event.target.value===''?undefined:Number(event.target.value);update(patch);}}));}return card([h('div',{className:'vr-ia-backend-head',key:'head'},h('div',null,h('div',{className:'vr-ia-field-head'},h('strong',null,label),override(key)),h('p',{className:'vr-hint'},current.enabled?tx('已启用','Enabled'):tx('未启用','Disabled'))),h('input',{type:'checkbox',checked:current.enabled===true,disabled:!writable||saving,onChange:function(event){update({enabled:event.target.checked});}})),h('div',{className:'vr-field',key:'model'},h('span',{className:'vr-label'},tx('模型','Model')),h('input',{className:'vr-input',value:String(current.model||''),disabled:!writable||saving,onChange:function(event){update({model:event.target.value});}}),key==='localLmStudio'&&invalidKeys.includes(key)?h('p',{className:'vr-failed'},tx('启用 LM Studio 时必须填写真实模型标识。','A real model id is required when LM Studio is enabled.')):null),h('div',{className:'vr-field',key:'url'},h('span',{className:'vr-label'},tx('服务地址','Service URL')),h('input',{className:'vr-input',value:String(current.baseURL||''),disabled:!writable||saving,onChange:function(event){update({baseURL:event.target.value});}})),h('button',{type:'button',className:'vr-btn',onClick:function(){setOpen(Object.assign({},open,which==='ollama'?{ollama:!opened}:{lmstudio:!opened}));}},opened?tx('收起高级连接设置','Hide advanced connection settings'):tx('高级连接设置','Advanced connection settings')),opened?h('div',{className:'vr-ia-subgrid',key:'advanced'},h('div',{className:'vr-field'},h('span',{className:'vr-label'},tx('请求协议','Request protocol')),h('select',{className:'vr-input',value:current.format==='anthropic'?'anthropic':current.format==='lmstudio'?'lmstudio':'openai',disabled:!writable||saving,onChange:function(event){update({format:event.target.value});}},h('option',{value:'openai'},'OpenAI'),h('option',{value:'anthropic'},'Anthropic'),which==='lmstudio'?h('option',{value:'lmstudio'},tx('LM Studio 原生','LM Studio native')):null)),h('div',{className:'vr-field'},h('span',{className:'vr-label'},tx('最大输出 token','Max output tokens')),h('input',{className:'vr-input',type:'number',step:'256',min:'256',max:'32768',value:String(current.maxTokens||4096),disabled:!writable||saving,onChange:function(event){update({maxTokens:Number(event.target.value)});}})),h('div',{className:'vr-field'},h('span',{className:'vr-label'},tx('推理强度','Reasoning effort')),h('select',{className:'vr-input',value:String(current.reasoningEffort||defaults.reasoningEffort||'provider_default'),disabled:!writable||saving||(which==='lmstudio'?current.format!=='lmstudio':current.format==='anthropic'),onChange:function(event){update({reasoningEffort:event.target.value});}},h('option',{value:'provider_default'},tx('服务端默认','Provider default')),h('option',{value:'none'},tx('关闭推理','Disable reasoning')),h('option',{value:'low'},'low'),h('option',{value:'medium'},'medium'),h('option',{value:'high'},'high'),h('option',{value:'max'},'max'))),sample('temperature',0,2),sample('top_p',0,1)):null]);}
347
- function localPageContent(){if(!local)return h(React.Fragment,null,title(tx('本地与设备','Local & device')),card([h('p',{className:'vr-hint',key:'remote'},tx('本地视觉后端和桌面截图只能在运行 DSH 的机器上配置。','Local vision backends and desktop capture can only be configured on the DSH machine.'))]));return h(React.Fragment,null,title(tx('本地与设备','Local & device'),tx('本地视觉可让图像像素留在本机;但若云端识图行或免费兜底仍开启,失败时仍可能出网,识图结果也会交给当前聊天模型。','Local vision can keep image pixels on this machine. Cloud vision rows or the free fallback may still send them off-device after a failure, and vision result text is still passed to the current chat model.')),localProviderCard('localOllama','Ollama',{enabled:false,baseURL:'http://127.0.0.1:11434/v1',model:'qwen2.5vl',format:'openai',maxTokens:4096,reasoningEffort:'none'},'ollama'),localProviderCard('localLmStudio','LM Studio',{enabled:false,baseURL:'http://localhost:1234/v1',model:'',format:'openai',maxTokens:4096,reasoningEffort:'none'},'lmstudio'),card([toggle('desktopScreenshot',tx('允许 Agent 读取桌面截图','Allow the agent to capture the desktop'),tx('这是独立的隐私权限;macOS 上保存为开启后会立即触发屏幕录制权限检查。','This is a separate privacy permission; on macOS saving it enabled immediately triggers the screen-recording permission check.'))]));}
363
+ function localPageContent(){return h(React.Fragment,null,title(tx('本地与设备','Local & device'),tx('本地视觉可让图像像素留在本机;但若云端识图行或免费兜底仍开启,失败时仍可能出网,识图结果也会交给当前聊天模型。','Local vision can keep image pixels on this machine. Cloud vision rows or the free fallback may still send them off-device after a failure, and vision result text is still passed to the current chat model.')),localProviderCard('localOllama','Ollama',{enabled:false,baseURL:'http://127.0.0.1:11434/v1',model:'qwen2.5vl',format:'openai',maxTokens:4096,reasoningEffort:'none'},'ollama'),localProviderCard('localLmStudio','LM Studio',{enabled:false,baseURL:'http://localhost:1234/v1',model:'',format:'openai',maxTokens:4096,reasoningEffort:'none'},'lmstudio'),card([toggle('desktopScreenshot',tx('允许 Agent 读取桌面截图','Allow the agent to capture the desktop'),tx('这是独立的隐私权限;macOS 上保存为开启后会立即触发屏幕录制权限检查。','This is a separate privacy permission; on macOS saving it enabled immediately triggers the screen-recording permission check.'))]));}
348
364
  function wrappersEditor(){var rows=wrapperRows();return h('div',{className:'vr-field'},fieldHead('wrappedProviders',tx('哪些聊天模型可以开启识图','Which chat models can use Vision mode')),h('p',{className:'vr-hint'},tx('通常无需修改;模型留空表示整个 Provider。','Usually leave this alone; an empty model means the whole provider.')),rows.map(function(row,index){return modelRow(row,index,rows,setWrapperDraft,true);}),h('button',{type:'button',className:'vr-btn',disabled:!writable||saving,onClick:function(){setWrapperDraft(rows.concat([{provider:'',model:''}]))}},tx('+ 添加范围','+ Add scope')));}
349
365
  function textProviderEditor(){var current=Object.assign({provider:'',model:''},obj(value('textProvider',{}))),ready=groups.length>0;return h('div',{className:'vr-field'},fieldHead('textProvider',tx('文字回退模型','Text fallback model')),h('div',{className:'vr-chain-row'},ready?h('select',{className:'vr-input',value:current.provider||'',disabled:!writable||saving,onChange:function(event){setValue('textProvider',{provider:event.target.value,model:''});}},providerOptions(current.provider||'')):h('input',{className:'vr-input',value:current.provider||'',disabled:!writable||saving,onChange:function(event){setValue('textProvider',{provider:event.target.value,model:current.model||''});}}),ready?h('select',{className:'vr-input',value:current.model||'',disabled:!writable||saving||!current.provider,onChange:function(event){setValue('textProvider',{provider:current.provider||'',model:event.target.value});}},modelOptions(current.provider||'',current.model||'',false)):h('input',{className:'vr-input',value:current.model||'',disabled:!writable||saving,onChange:function(event){setValue('textProvider',{provider:current.provider||'',model:event.target.value});}})),invalidKeys.includes('textProvider')?h('p',{className:'vr-failed'},tx('Provider 和 model 必须同时填写,或同时留空恢复默认。','Provider and model must both be filled, or both left empty to restore the default.')):null);}
350
- function advancedPage(){var routing=toggleValue('routing',false),turnBudget=Number(value('visionTurnBudgetMs',0))||0,customBudget=turnBudget>0;return h(React.Fragment,null,title(tx('高级','Advanced'),tx('这些默认值对大多数用户已经合适。','Defaults are suitable for most users.')),card([h('h4',{className:'vr-ia-subtitle',key:'p'},tx('性能与稳定性','Performance & stability')),toggle('downscale',tx('自动缩放','Auto downscale')),numberField('downscaleMaxPixels',tx('图片像素上限','Image pixel limit'),null,1000,100000000),toggle('cache',tx('识图缓存','Vision answer cache')),numberField('cacheTtlSeconds',tx('缓存有效期(秒)','Cache TTL (seconds)'),null,0,31536000),numberField('cacheMaxEntries',tx('最大缓存数量','Maximum cached answers'),null,1,100000),h('h4',{className:'vr-ia-subtitle',key:'t'},tx('超时','Timeouts')),numberField('timeoutMs',tx('单次模型请求','Single model request'),tx('毫秒。','Milliseconds.'),1000,600000),numberField('visionTaskTimeoutMs',tx('单个视觉任务','Single visual task'),tx('包含该任务内部的重试和备用模型;不是每个后端各自一份。','Includes retries and fallbacks inside the task; it is not a fresh budget per backend.'),1000,180000),numberField('ocrTimeoutMs',tx('OCR 任务','OCR task'),null,1000,120000),h('div',{className:'vr-field',key:'ocr-engine'},fieldHead('ocrEngine',tx('OCR 默认引擎','Default OCR engine')),h('select',{className:'vr-input',value:String(value('ocrEngine','auto')||'auto'),disabled:!writable||saving,onChange:function(event){setValue('ocrEngine',event.target.value);}},h('option',{value:'auto'},tx('自动(Tesseract → 视觉模型)','Auto (Tesseract → vision)')),h('option',{value:'tesseract'},tx('仅 Tesseract','Tesseract only')),h('option',{value:'vision'},tx('仅视觉模型','Vision model only'))),h('p',{className:'vr-hint'},tx('vision_ocr 未显式指定 engine 时使用;单次调用的 engine=tesseract/vision 始终优先。','Used when vision_ocr does not explicitly choose an engine; per-call engine=tesseract/vision always wins.'))),h('div',{className:'vr-field',key:'budget'},fieldHead('visionTurnBudgetMs',tx('整轮视觉工具上限','Whole-turn vision-tool limit')),h('select',{className:'vr-input',value:customBudget?'custom':'unlimited',disabled:!writable||saving,onChange:function(event){setValue('visionTurnBudgetMs',event.target.value==='unlimited'?0:(turnBudget>0?turnBudget:180000));}},h('option',{value:'unlimited'},tx('不限制(推荐)','Unlimited (recommended)')),h('option',{value:'custom'},tx('自定义','Custom'))),customBudget?numberField('visionTurnBudgetMs',tx('上限(毫秒)','Limit (ms)'),null,10000,600000):null)]),card([h('h4',{className:'vr-ia-subtitle',key:'cost'},tx('模型顺序与成本','Model order & cost')),toggle('freeCloudFirst',tx('免费云模型优先','Try free cloud models first'))]),card([h('h4',{className:'vr-ia-subtitle',key:'scope'},tx('识图模式范围','Vision mode scope')),toggle('autoWrapProviders',tx('自动允许已启用模型使用识图','Automatically allow enabled models to use Vision mode')),wrappersEditor()]),local?card([h('h4',{className:'vr-ia-subtitle',key:'network'},tx('网络与远程','Network & remote')),h('p',{className:'vr-hint',key:'network-authority'},tx('默认沿用 DSH/Host 的网络出口;只有需要让视觉请求走不同出口时才填写下方覆盖。','By default Vision Router follows the DSH/Host network path. Use the override below only when vision requests need a different egress route.')),toggle('allowRemoteSettings',tx('允许可信 Host 远程修改设置','Allow trusted-host remote settings'),tx('默认关闭;trustedHosts 不是身份认证。','Off by default; trustedHosts is not authentication.')),textField('proxy',tx('视觉专用代理覆盖','Vision-only proxy override'),tx('留空即沿用 DSH/Host;支持 http(s)://、socks5://,并兼容旧 socks5h://。','Leave empty to follow DSH/Host; supports http(s):// and socks5://, with legacy socks5h:// compatibility.')),textareaArray('proxyHosts',tx('视觉代理覆盖域名','Vision proxy override hosts'),tx('仅在上方覆盖非空时生效;每行一个,其余请求继续沿用 DSH/Host。','Used only when the override above is non-empty; one host per line. All other requests keep the DSH/Host path.'))]):null,card([h('h4',{className:'vr-ia-subtitle',key:'compat'},tx('兼容模式','Compatibility')),toggle('rewriteImages',tx('保护纯文本模型','Protect text-only models')),toggle('routing',tx('整轮视觉路由(旧工作流)','Whole-turn vision routing (legacy workflow)')),routing?toggle('reverseRouting',tx('纯文字消息继续使用聊天模型','Keep text-only messages on the chat model')):null,routing?textProviderEditor():null]),card([h('button',{type:'button',className:'vr-btn',key:'dev',onClick:function(){setOpen(Object.assign({},open,{developer:!open.developer}));}},open.developer?tx('隐藏开发者设置','Hide developer settings'):tx('显示开发者设置','Show developer settings')),open.developer?h('div',{className:'vr-ia-dev',key:'body'},toggle('progressiveTools',tx('渐进式工具暴露','Progressive tool exposure')),h('p',{className:'vr-hint',key:'progressive-restart'},tx('保存后需重启 DSH 才生效。','Restart DSH after saving for this change to take effect.')),local?toggle('stealth','Stealth'):null,local?textField('wrapperRoute',tx('包装路由名','Wrapper route name')):null,local?textField('chainRoute',tx('视觉链路由名','Vision chain route name')):null,textareaArray('extraVisionModels',tx('额外视觉能力标记','Extra vision capability labels'),tx('只有诊断发现模型未声明图片能力时才需要。','Needed only when diagnostics show missing image-capability metadata.'))):null]));}
366
+ function advancedPage(){var routing=toggleValue('routing',false),turnBudget=Number(value('visionTurnBudgetMs',0))||0,customBudget=turnBudget>0;return h(React.Fragment,null,title(tx('高级','Advanced'),tx('这些默认值对大多数用户已经合适。','Defaults are suitable for most users.')),card([h('h4',{className:'vr-ia-subtitle',key:'p'},tx('性能与稳定性','Performance & stability')),toggle('downscale',tx('自动缩放','Auto downscale')),numberField('downscaleMaxPixels',tx('图片像素上限','Image pixel limit'),null,1000,100000000),toggle('cache',tx('识图缓存','Vision answer cache')),numberField('cacheTtlSeconds',tx('缓存有效期(秒)','Cache TTL (seconds)'),null,0,31536000),numberField('cacheMaxEntries',tx('最大缓存数量','Maximum cached answers'),null,1,100000),h('h4',{className:'vr-ia-subtitle',key:'t'},tx('超时','Timeouts')),numberField('timeoutMs',tx('单次模型请求','Single model request'),tx('毫秒。','Milliseconds.'),1000,600000),numberField('visionTaskTimeoutMs',tx('单个视觉任务','Single visual task'),tx('包含该任务内部的重试和备用模型;不是每个后端各自一份。','Includes retries and fallbacks inside the task; it is not a fresh budget per backend.'),1000,180000),numberField('ocrTimeoutMs',tx('OCR 任务','OCR task'),null,1000,120000),h('div',{className:'vr-field',key:'ocr-engine'},fieldHead('ocrEngine',tx('OCR 默认引擎','Default OCR engine')),h('select',{className:'vr-input',value:String(value('ocrEngine','auto')||'auto'),disabled:!writable||saving,onChange:function(event){setValue('ocrEngine',event.target.value);}},h('option',{value:'auto'},tx('自动(Tesseract → 视觉模型)','Auto (Tesseract → vision)')),h('option',{value:'tesseract'},tx('仅 Tesseract','Tesseract only')),h('option',{value:'vision'},tx('仅视觉模型','Vision model only'))),h('p',{className:'vr-hint'},tx('vision_ocr 未显式指定 engine 时使用;单次调用的 engine=tesseract/vision 始终优先。','Used when vision_ocr does not explicitly choose an engine; per-call engine=tesseract/vision always wins.'))),h('div',{className:'vr-field',key:'budget'},fieldHead('visionTurnBudgetMs',tx('整轮视觉工具上限','Whole-turn vision-tool limit')),h('select',{className:'vr-input',value:customBudget?'custom':'unlimited',disabled:!writable||saving,onChange:function(event){setValue('visionTurnBudgetMs',event.target.value==='unlimited'?0:(turnBudget>0?turnBudget:180000));}},h('option',{value:'unlimited'},tx('不限制(推荐)','Unlimited (recommended)')),h('option',{value:'custom'},tx('自定义','Custom'))),customBudget?numberField('visionTurnBudgetMs',tx('上限(毫秒)','Limit (ms)'),null,10000,600000):null)]),card([h('h4',{className:'vr-ia-subtitle',key:'cost'},tx('模型顺序与成本','Model order & cost')),toggle('freeCloudFirst',tx('免费云模型优先','Try free cloud models first'))]),card([h('h4',{className:'vr-ia-subtitle',key:'scope'},tx('识图模式范围','Vision mode scope')),toggle('autoWrapProviders',tx('自动允许已启用模型使用识图','Automatically allow enabled models to use Vision mode')),wrappersEditor()]),card([h('h4',{className:'vr-ia-subtitle',key:'network'},tx('网络与远程','Network & remote')),h('p',{className:'vr-hint',key:'network-authority'},tx('默认沿用 DSH/Host 的网络出口;只有需要让视觉请求走不同出口时才填写下方覆盖。','By default Vision Router follows the DSH/Host network path. Use the override below only when vision requests need a different egress route.')),local?toggle('allowRemoteSettings',tx('允许可信 Host 远程修改设置','Allow trusted-host remote settings'),tx('默认关闭;trustedHosts 不是身份认证。','Off by default; trustedHosts is not authentication.')):null,textField('proxy',tx('视觉专用代理覆盖','Vision-only proxy override'),tx('留空即沿用 DSH/Host;支持 http(s)://、socks5://,并兼容旧 socks5h://。','Leave empty to follow DSH/Host; supports http(s):// and socks5://, with legacy socks5h:// compatibility.')),textareaArray('proxyHosts',tx('视觉代理覆盖域名','Vision proxy override hosts'),tx('仅在上方覆盖非空时生效;每行一个,其余请求继续沿用 DSH/Host。','Used only when the override above is non-empty; one host per line. All other requests keep the DSH/Host path.'))]),card([h('h4',{className:'vr-ia-subtitle',key:'compat'},tx('兼容模式','Compatibility')),toggle('rewriteImages',tx('保护纯文本模型','Protect text-only models')),toggle('routing',tx('整轮视觉路由(旧工作流)','Whole-turn vision routing (legacy workflow)')),routing?toggle('reverseRouting',tx('纯文字消息继续使用聊天模型','Keep text-only messages on the chat model')):null,routing?textProviderEditor():null]),card([h('button',{type:'button',className:'vr-btn',key:'dev',onClick:function(){setOpen(Object.assign({},open,{developer:!open.developer}));}},open.developer?tx('隐藏开发者设置','Hide developer settings'):tx('显示开发者设置','Show developer settings')),open.developer?h('div',{className:'vr-ia-dev',key:'body'},toggle('progressiveTools',tx('渐进式工具暴露','Progressive tool exposure')),h('p',{className:'vr-hint',key:'progressive-restart'},tx('保存后需重启 DSH 才生效。','Restart DSH after saving for this change to take effect.')),toggle('stealth','Stealth'),textField('wrapperRoute',tx('包装路由名','Wrapper route name')),textField('chainRoute',tx('视觉链路由名','Vision chain route name')),textareaArray('extraVisionModels',tx('额外视觉能力标记','Extra vision capability labels'),tx('只有诊断发现模型未声明图片能力时才需要。','Needed only when diagnostics show missing image-capability metadata.'))):null]));}
351
367
  function diagnosticValue(label,valueText){return h('div',{className:'vr-ia-diag-row',key:label},h('span',null,label),h('strong',null,valueText));}
352
368
  function updatePanel(){if(!local)return null;var result=updateState.result,auto=result&&result.autoUpdate,current=result&&result.currentVersion?result.currentVersion:tx('检测中','Checking'),latest=result&&result.latestVersion?result.latestVersion:'—',available=result&&result.ok===true&&result.updateAvailable===true,profile=auto&&auto.profile?auto.profile:'web',manualVersion=result&&result.latestVersion?result.latestVersion:'<version>',spec='dsh-vision-router@'+manualVersion,pnpm='pnpm dsh plugin --profile '+profile+' add '+spec,npx='npx @deepseek-ai/dsh plugin --profile '+profile+' add '+spec;return card([h('h4',{className:'vr-ia-subtitle',key:'title'},tx('版本更新','Updates')),h('p',{className:'vr-hint',key:'status'},updateState.status==='running'?tx('正在检查更新…','Checking for updates…'):result&&result.ok===false?tx('更新检查失败:','Update check failed: ')+String(result.error||'unknown'):available?tx('发现新版本:v','Update available: v')+latest+tx('(当前 v',' (current v')+current+')':result&&result.ok===true?tx('已是最新版本 v','Up to date: v')+current:tx('尚未检查','Not checked yet')),h('div',{className:'vr-ia-actions',key:'actions'},h('button',{type:'button',className:'vr-btn',disabled:updateState.status==='running',onClick:function(){void runUpdateCheck(true);}},tx('检查更新','Check for updates')),available&&auto&&auto.supported===true&&auto.token?h('button',{type:'button',className:'vr-btn vr-btn-save',disabled:selfUpdateState.status==='running',onClick:function(){void runSelfUpdate();}},selfUpdateState.status==='running'?tx('更新中…','Updating…'):tx('一键更新','Update now')):null),selfUpdateState.status==='done'&&selfUpdateState.result?h('p',{className:'vr-hint',key:'updated'},tx('更新完成,请重启 DSH。','Update complete. Restart DSH.')):selfUpdateState.error?h('p',{className:'vr-failed',key:'uerr'},String(selfUpdateState.error)):null,available&&(!auto||auto.supported!==true)?h('div',{className:'vr-ia-manual',key:'manual'},h('p',{className:'vr-hint'},tx('当前安装方式不支持安全的一键更新,请使用与你当前 DSH 安装方式一致的命令:','This install method cannot be safely auto-updated. Use the command matching your DSH installation:')),h('code',{className:'vr-ia-code'},pnpm),h('code',{className:'vr-ia-code'},npx)):null]);}
353
- function diagnosticsPage(){var providerCount=groups.length,modelCount=groups.reduce(function(total,group){return total+arr(group&&group.models).length;},0),configured=chainRows().filter(function(row){return row&&row.provider&&row.model;}).length,ollama=obj(value('localOllama',{})),lm=obj(value('localLmStudio',{})),testText=!local?tx('仅本机可见','Local only'):testState.status==='running'?tx('检测中','Checking'):testState.status==='done'&&testState.result&&testState.result.ok===true?tx('连接正常','Connected'):testState.status==='done'?tx('连接失败','Failed'):tx('未检测','Not checked'),capsText=caps.status==='ready'?tx('正常','Ready'):caps.status==='loading'?tx('检测中','Checking'):caps.status==='error'?tx('不可用','Unavailable'):tx('未检测','Not checked');var rows=[[tx('设置协议','Settings contract'),String(value('settingsContractRevision','—'))],[tx('模型目录','Model catalog'),catalog.status==='ready'?tx('正常','Ready'):catalog.status==='loading'?tx('检测中','Checking'):tx('不可用','Unavailable')],[tx('图片能力元数据','Image capability metadata'),capsText],[tx('可选 Provider','Selectable providers'),String(providerCount)],[tx('可选模型','Selectable models'),String(modelCount)],[tx('已配置识图模型','Configured vision models'),String(configured)],[tx('内置免费兜底','Built-in free fallback'),toggleValue('freeFallback',true)?(caps.builtinFallback.length?tx('已启用,','Enabled, ')+caps.builtinFallback.length+tx(' 个模型',' models'):tx('已启用','Enabled')):tx('已关闭','Disabled')],[tx('后端连接','Backend connection'),testText],[tx('Ollama','Ollama'),local?(ollama.enabled===true?tx('已启用','Enabled'):tx('未启用','Disabled')):tx('仅本机可见','Local only')],[tx('LM Studio','LM Studio'),local?(lm.enabled===true?tx('已启用','Enabled'):tx('未启用','Disabled')):tx('仅本机可见','Local only')],[tx('桌面截图','Desktop capture'),local?(toggleValue('desktopScreenshot',false)?tx('已启用','Enabled'):tx('未启用','Disabled')):tx('仅本机可见','Local only')],[tx('网络出口','Network egress'),local?(String(value('proxy','')).trim()?tx('视觉专用覆盖','Vision-only override'):tx('DSH/Host(默认)','DSH/Host (default)')):tx('仅本机可见','Local only')],[tx('识图结果去向','Vision result destination'),tx('当前聊天模型(可能为云端)','Current chat model (may be remote)')],[tx('远程设置','Remote settings'),local?(toggleValue('allowRemoteSettings',false)?tx('已启用','Enabled'):tx('未启用','Disabled')):tx('当前为远程安全视图','Remote safe view')]];function reportText(){return ['Vision Router diagnostics'].concat(rows.map(function(row){return row[0]+': '+row[1];}),['doctor: dsh-vision-router doctor']).join('\n');}async function copyReport(){try{if(typeof navigator!=='undefined'&&navigator.clipboard&&typeof navigator.clipboard.writeText==='function')await navigator.clipboard.writeText(reportText());setActionState({status:'copied'});}catch(error){setActionState({status:'error',error:error&&error.message?error.message:String(error)});}}return h(React.Fragment,null,title(tx('诊断','Diagnostics'),tx('状态页不会修改你的模型/路由设置;连接测试和更新操作会明确由按钮触发。','The status page does not change model or routing settings; connection tests and updates are explicit actions.')),card(rows.map(function(row){return diagnosticValue(row[0],row[1]);})),card([h('div',{className:'vr-ia-actions',key:'actions'},local?h('button',{type:'button',className:'vr-btn',disabled:testState.status==='running',onClick:function(){void runTestConnection();}},tx('测试连接','Test connection')):null,h('button',{type:'button',className:'vr-btn',onClick:function(){invalidateCatalog();}},tx('重新检测模型','Re-detect models')),local?h('button',{type:'button',className:'vr-btn',onClick:function(){void openLogs();}},tx('打开日志文件夹','Open logs folder')):null,h('button',{type:'button',className:'vr-btn',onClick:function(){void copyReport();}},tx('复制诊断信息','Copy diagnostics'))),h('p',{className:'vr-hint',key:'doctor'},tx('需要完整 DSH 版本、安装、Profile、运行时路由和会话诊断时执行:dsh-vision-router doctor','For the full DSH version, installation, profile, runtime-route, and session report, run: dsh-vision-router doctor')),testState.status==='done'&&testState.result&&testState.result.ok!==true?h('p',{className:'vr-failed',key:'testerr'},String(testState.result.error||tx('连接测试失败','Connection test failed'))):null,actionState.status==='error'?h('p',{className:'vr-failed',key:'aerr'},String(actionState.error||'unknown')):null]),updatePanel());}
369
+ function diagnosticsPage(){var providerCount=groups.length,modelCount=groups.reduce(function(total,group){return total+arr(group&&group.models).length;},0),configured=chainRows().filter(function(row){return row&&row.provider&&row.model;}).length,ollama=obj(value('localOllama',{})),lm=obj(value('localLmStudio',{})),testText=!local?tx('仅本机可见','Local only'):testState.status==='running'?tx('检测中','Checking'):testState.status==='done'&&testState.result&&testState.result.ok===true?tx('连接正常','Connected'):testState.status==='done'?tx('连接失败','Failed'):tx('未检测','Not checked'),capsText=caps.status==='ready'?tx('正常','Ready'):caps.status==='loading'?tx('检测中','Checking'):caps.status==='error'?tx('不可用','Unavailable'):tx('未检测','Not checked');var rows=[[tx('设置协议','Settings contract'),String(value('settingsContractRevision','—'))],[tx('模型目录','Model catalog'),catalog.status==='ready'?tx('正常','Ready'):catalog.status==='loading'?tx('检测中','Checking'):tx('不可用','Unavailable')],[tx('图片能力元数据','Image capability metadata'),capsText],[tx('可选 Provider','Selectable providers'),String(providerCount)],[tx('可选模型','Selectable models'),String(modelCount)],[tx('已配置识图模型','Configured vision models'),String(configured)],[tx('内置免费兜底','Built-in free fallback'),toggleValue('freeFallback',true)?(caps.builtinFallback.length?tx('已启用,','Enabled, ')+caps.builtinFallback.length+tx(' 个模型',' models'):tx('已启用','Enabled')):tx('已关闭','Disabled')],[tx('后端连接','Backend connection'),testText],[tx('Ollama','Ollama'),(ollama.enabled===true?tx('已启用','Enabled'):tx('未启用','Disabled'))],[tx('LM Studio','LM Studio'),(lm.enabled===true?tx('已启用','Enabled'):tx('未启用','Disabled'))],[tx('桌面截图','Desktop capture'),(toggleValue('desktopScreenshot',false)?tx('已启用','Enabled'):tx('未启用','Disabled'))],[tx('网络出口','Network egress'),(String(value('proxy','')).trim()?tx('视觉专用覆盖','Vision-only override'):tx('DSH/Host(默认)','DSH/Host (default)'))],[tx('识图结果去向','Vision result destination'),tx('当前聊天模型(可能为云端)','Current chat model (may be remote)')],[tx('远程设置','Remote settings'),local?(toggleValue('allowRemoteSettings',false)?tx('已启用','Enabled'):tx('未启用','Disabled')):tx('已通过风险确认','Risk acknowledged')]];function reportText(){return ['Vision Router diagnostics'].concat(rows.map(function(row){return row[0]+': '+row[1];}),['doctor: dsh-vision-router doctor']).join('\n');}async function copyReport(){try{if(typeof navigator!=='undefined'&&navigator.clipboard&&typeof navigator.clipboard.writeText==='function')await navigator.clipboard.writeText(reportText());setActionState({status:'copied'});}catch(error){setActionState({status:'error',error:error&&error.message?error.message:String(error)});}}return h(React.Fragment,null,title(tx('诊断','Diagnostics'),tx('状态页不会修改你的模型/路由设置;连接测试和更新操作会明确由按钮触发。','The status page does not change model or routing settings; connection tests and updates are explicit actions.')),card(rows.map(function(row){return diagnosticValue(row[0],row[1]);})),card([h('div',{className:'vr-ia-actions',key:'actions'},local?h('button',{type:'button',className:'vr-btn',disabled:testState.status==='running',onClick:function(){void runTestConnection();}},tx('测试连接','Test connection')):null,h('button',{type:'button',className:'vr-btn',onClick:function(){invalidateCatalog();}},tx('重新检测模型','Re-detect models')),local?h('button',{type:'button',className:'vr-btn',onClick:function(){void openLogs();}},tx('打开日志文件夹','Open logs folder')):null,h('button',{type:'button',className:'vr-btn',onClick:function(){void copyReport();}},tx('复制诊断信息','Copy diagnostics'))),h('p',{className:'vr-hint',key:'doctor'},tx('需要完整 DSH 版本、安装、Profile、运行时路由和会话诊断时执行:dsh-vision-router doctor','For the full DSH version, installation, profile, runtime-route, and session report, run: dsh-vision-router doctor')),testState.status==='done'&&testState.result&&testState.result.ok!==true?h('p',{className:'vr-failed',key:'testerr'},String(testState.result.error||tx('连接测试失败','Connection test failed'))):null,actionState.status==='error'?h('p',{className:'vr-failed',key:'aerr'},String(actionState.error||'unknown')):null]),updatePanel());}
354
370
 
355
371
  var pages=[['general',tx('常规','General')],['strategy',tx('识图策略','Vision strategy')],['local',tx('本地与设备','Local & device')],['advanced',tx('高级','Advanced')],['diagnostics',tx('诊断','Diagnostics')]];
356
372
  var content=page==='strategy'?strategyPage():page==='local'?localPageContent():page==='advanced'?advancedPage():page==='diagnostics'?diagnosticsPage():generalPage();
@@ -0,0 +1,163 @@
1
+ import { parentPort, workerData } from 'node:worker_threads'
2
+ import { createRequire } from 'node:module'
3
+
4
+ const require = createRequire(import.meta.url)
5
+ const vtracer = require('@visioncortex/vtracer')
6
+ const MAX_TRACE_PIXELS = 1_000_000
7
+
8
+ function assertDimensions(width, height, byteLength) {
9
+ if (
10
+ !Number.isSafeInteger(width) || !Number.isSafeInteger(height) ||
11
+ width < 1 || height < 1 || width * height > MAX_TRACE_PIXELS ||
12
+ byteLength !== width * height * 4
13
+ ) throw new RangeError('invalid trace RGBA dimensions')
14
+ }
15
+
16
+ function grayPalette(gray, channels, width, height, steps) {
17
+ const histogram = new Float64Array(256)
18
+ const pixels = width * height
19
+ for (let i = 0; i < pixels; i++) histogram[gray[i * channels]]++
20
+ const count = Math.min(17, Math.max(2, steps + 1))
21
+ const quantile = (fraction) => {
22
+ let seen = 0
23
+ for (let i = 0; i < 256; i++) {
24
+ seen += histogram[i]
25
+ if (seen >= fraction * pixels) return i
26
+ }
27
+ return 255
28
+ }
29
+ let centers = Array.from({ length: count }, (_, i) => quantile((i + 0.5) / count))
30
+ for (let pass = 0; pass < 15; pass++) {
31
+ const sums = new Float64Array(count)
32
+ const sizes = new Float64Array(count)
33
+ for (let value = 0; value < 256; value++) {
34
+ const frequency = histogram[value]
35
+ if (!frequency) continue
36
+ let closest = 0
37
+ let distance = Infinity
38
+ for (let j = 0; j < count; j++) {
39
+ const delta = Math.abs(value - centers[j])
40
+ if (delta < distance) { closest = j; distance = delta }
41
+ }
42
+ sums[closest] += value * frequency
43
+ sizes[closest] += frequency
44
+ }
45
+ centers = centers.map((v, j) => sizes[j] ? sums[j] / sizes[j] : v)
46
+ }
47
+ const values = [...new Set(centers.map((v) => Math.max(0, Math.min(255, Math.round(v)))))]
48
+ if (values.length === 1) values.push(values[0] < 128 ? 255 : 0)
49
+ return values.sort((a, b) => a - b).map((v) => '#' + v.toString(16).padStart(2, '0').repeat(3))
50
+ }
51
+
52
+ function colorPalette(palette) {
53
+ if (!Array.isArray(palette) || palette.length > 16 ||
54
+ palette.some((p) => !p || typeof p.hex !== 'string' || !/^#[0-9a-f]{6}$/i.test(p.hex))) {
55
+ throw new RangeError('invalid trace color palette')
56
+ }
57
+ // Exact-palette callers own their color choices. Never silently append
58
+ // white (which could exceed the 16-color contract); alpha is still composited
59
+ // against white before tracing.
60
+ return [...new Set(palette.map((p) => p.hex.toLowerCase()))]
61
+ }
62
+
63
+ async function grayscaleTrace(bytes, steps) {
64
+ if (!Number.isInteger(steps) || steps < 1 || steps > 16) {
65
+ throw new RangeError('trace steps must be an integer between 1 and 16')
66
+ }
67
+ const sharpModule = await import(workerData.sharpUrl)
68
+ const sharp = sharpModule.default ?? sharpModule
69
+ const image = sharp(bytes, { failOn: 'error', limitInputPixels: MAX_TRACE_PIXELS })
70
+ const { data, info } = await image.flatten({ background: '#ffffff' }).greyscale()
71
+ .raw().toBuffer({ resolveWithObject: true })
72
+ const { width, height, channels } = info
73
+ if (width * height > MAX_TRACE_PIXELS || !channels) throw new RangeError('trace image exceeds pixel budget')
74
+ const rgba = Buffer.alloc(width * height * 4)
75
+ for (let i = 0; i < width * height; i++) {
76
+ const gray = data[i * channels]
77
+ const offset = i * 4
78
+ rgba[offset] = gray
79
+ rgba[offset + 1] = gray
80
+ rgba[offset + 2] = gray
81
+ rgba[offset + 3] = 255
82
+ }
83
+ const palette = grayPalette(data, channels, width, height, steps)
84
+ // VTracer's palette option constrains color *selection* but does not force
85
+ // grayscale pixel clustering. Without quantizing the raster itself,
86
+ // smooth black-to-white gradients can collapse to a single solid path.
87
+ // Explicitly posterize each input pixel to the nearest adaptive level.
88
+ const paletteValues = palette.map((hex) => Number.parseInt(hex.slice(1, 3), 16))
89
+ const lookup = new Uint8Array(256)
90
+ for (let gray = 0; gray < 256; gray++) {
91
+ let closest = paletteValues[0]
92
+ let distance = Infinity
93
+ for (const candidate of paletteValues) {
94
+ const delta = Math.abs(candidate - gray)
95
+ if (delta < distance) { distance = delta; closest = candidate }
96
+ }
97
+ lookup[gray] = closest
98
+ }
99
+ for (let i = 0; i < rgba.length; i += 4) {
100
+ const q = lookup[rgba[i]]
101
+ rgba[i] = q
102
+ rgba[i + 1] = q
103
+ rgba[i + 2] = q
104
+ }
105
+ return vtracer.convertPixels(rgba, width, height, {
106
+ preset: 'poster', mode: 'spline', hierarchical: 'cutout',
107
+ palette, maxColors: palette.length, simplify: 0.5, optimize: 1,
108
+ })
109
+ }
110
+
111
+ function colorTrace(data, width, height, palette, colorLimit) {
112
+ assertDimensions(width, height, data.length)
113
+ const explicit = Array.isArray(palette)
114
+ const colors = explicit ? colorPalette(palette) : undefined
115
+ const maxColors = explicit ? Math.max(1, colors.length) : colorLimit
116
+ if (!Number.isInteger(maxColors) || maxColors < 1 || maxColors > 16) {
117
+ throw new RangeError('invalid trace color limit')
118
+ }
119
+ const raw = Buffer.from(data)
120
+ for (let i = 0; i < raw.length; i += 4) {
121
+ const alpha = raw[i + 3]
122
+ // Preserve existing DVR's opaque-white SVG artifact background.
123
+ if (alpha === 0) {
124
+ raw[i] = 255; raw[i + 1] = 255; raw[i + 2] = 255
125
+ } else if (alpha < 255) {
126
+ const a = alpha / 255
127
+ raw[i] = Math.round(raw[i] * a + 255 * (1 - a))
128
+ raw[i + 1] = Math.round(raw[i + 1] * a + 255 * (1 - a))
129
+ raw[i + 2] = Math.round(raw[i + 2] * a + 255 * (1 - a))
130
+ }
131
+ raw[i + 3] = 255
132
+ }
133
+ if (explicit && colors.length === 0) {
134
+ return '<svg xmlns="http://www.w3.org/2000/svg" width="' + width +
135
+ '" height="' + height + '" viewBox="0 0 ' + width + ' ' + height +
136
+ '"><rect width="' + width + '" height="' + height + '" fill="#ffffff"/></svg>'
137
+ }
138
+ return vtracer.convertPixels(raw, width, height, {
139
+ preset: 'poster', mode: 'spline', hierarchical: 'cutout',
140
+ ...(explicit ? { palette: colors } : {}),
141
+ maxColors, simplify: 0.5, optimize: 1,
142
+ })
143
+ }
144
+
145
+ async function main() {
146
+ const { mode } = workerData
147
+ let svg
148
+ if (mode === 'grayscale') {
149
+ svg = await grayscaleTrace(Buffer.from(workerData.bytes), workerData.steps)
150
+ } else if (mode === 'color') {
151
+ svg = colorTrace(workerData.data, workerData.width, workerData.height,
152
+ workerData.palette, workerData.colors)
153
+ } else {
154
+ throw new RangeError('unsupported trace mode')
155
+ }
156
+ if (typeof svg !== 'string' || !/<svg[\s>]/.test(svg) || svg.length > 16 * 1024 * 1024) {
157
+ throw new Error('vectorizer returned an invalid or oversized SVG')
158
+ }
159
+ // VTracer writes uppercase RGB hex codes; preserve DVR's lowercase palette contract.
160
+ parentPort.postMessage({ ok: true, svg: svg.replace(/#[a-fA-F0-9]{6}\b/g, (hex) => hex.toLowerCase()) })
161
+ }
162
+
163
+ main().catch((error) => parentPort.postMessage({ error: String(error?.message ?? error) }))
@@ -2,6 +2,7 @@ import {
2
2
  DSH_017_SETTINGS_COMPAT_MARK,
3
3
  LOCAL_SETTINGS_PATH,
4
4
  } from '../dsh-settings-017-compat.js'
5
+ import { isLocalUiRequest } from '../web-capability-boundary.js'
5
6
 
6
7
  const BODY_LIMIT_BYTES = 256 * 1024
7
8
  const ROOT_TRANSPORT_REGISTRY_KEY = Symbol.for('dsh-vision-router.settings-017-root-local-transport')
@@ -67,8 +68,13 @@ function serviceOf(ctx, name) {
67
68
 
68
69
  function compatibleSettings(ctx) {
69
70
  const settings = serviceOf(ctx, 'settings')
70
- if (settings?.[DSH_017_SETTINGS_COMPAT_MARK] !== true) return undefined
71
- if (typeof settings.describe !== 'function' || typeof settings.mutate !== 'function') return undefined
71
+ if (typeof settings?.describe !== 'function' || typeof settings.mutate !== 'function') return undefined
72
+ // Modern Hosts can expose both native SettingsProvider.register() and
73
+ // configForms. Their browser uses the local bridge even without our
74
+ // ConfigEditor compatibility facade/marker. Keep legacy Hosts without
75
+ // configForms on their original settings path.
76
+ const forms = serviceOf(ctx, 'configForms')
77
+ if (settings[DSH_017_SETTINGS_COMPAT_MARK] !== true && typeof forms?.get !== 'function') return undefined
72
78
  return settings
73
79
  }
74
80
 
@@ -153,11 +159,33 @@ function beginSlowMutationWatch(root, requestId) {
153
159
  }, SLOW_MUTATION_MS)
154
160
  }
155
161
 
156
- function routeFor(root, state) {
162
+ function allowLocalSettingsRequest(req, res, connection) {
163
+ // This root-owned route bypasses DVR's usual child-Context WebServer wrapper.
164
+ // Check *both* transport locality and the Host's authenticated browser
165
+ // session before reading or mutating the complete settings namespace.
166
+ let denied = !isLocalUiRequest(req) ? 403 : undefined
167
+ if (denied === undefined) {
168
+ try {
169
+ if (typeof connection?.requestRejection !== 'function') denied = 403
170
+ else {
171
+ const rejection = connection.requestRejection(req)
172
+ if (rejection !== undefined && rejection !== null) {
173
+ denied = rejection === 401 ? 401 : 403
174
+ }
175
+ }
176
+ } catch { denied = 403 }
177
+ }
178
+ if (denied === undefined) return true
179
+ sendJson(res, denied, { ok: false, error: { code: 'access-denied', message: 'Local settings require an authenticated local DSH browser' } })
180
+ return false
181
+ }
182
+
183
+ function routeFor(root, state, getConnection) {
157
184
  return {
158
185
  kind: 'exact',
159
186
  path: LOCAL_SETTINGS_PATH,
160
187
  async handler(req, res) {
188
+ if (!allowLocalSettingsRequest(req, res, getConnection())) return
161
189
  const requestId = ++state.requestSequence
162
190
  trace('handler-enter', { requestId, method: req.method, generation: state.current?.id })
163
191
  const settings = currentSettings(state)
@@ -230,14 +258,16 @@ function ensureRootRoute(root, state) {
230
258
 
231
259
  state.routeInstalling = true
232
260
  try {
233
- const owner = root.inject(['webServer'], (webCtx) => {
261
+ const owner = root.inject(['webServer', 'connection'], (webCtx) => {
234
262
  if (!webCtx?.webServer || typeof webCtx.webServer.register !== 'function' || typeof webCtx.effect !== 'function') {
235
263
  throw new Error('Vision Router requires WebServer route registration on DSH 0.1.7')
236
264
  }
237
265
  trace('route-register', {})
238
266
  webCtx.effect(
239
267
  () => {
240
- const dispose = webCtx.webServer.register(routeFor(root, state))
268
+ const dispose = webCtx.webServer.register(routeFor(root, state, () => {
269
+ try { return webCtx.connection } catch { return undefined }
270
+ }))
241
271
  return () => {
242
272
  trace('route-dispose', {})
243
273
  dispose()
@@ -270,7 +300,7 @@ export function installDsh017RootLocalSettingsTransport(ctx) {
270
300
  if (!objectLike(root)) return
271
301
  const state = stateFor(root)
272
302
 
273
- ctx.inject(['settings'], (settingsCtx) => {
303
+ const mountGeneration = (settingsCtx) => {
274
304
  const mounted = compatibleSettings(settingsCtx)
275
305
  if (!mounted) return
276
306
 
@@ -310,5 +340,21 @@ export function installDsh017RootLocalSettingsTransport(ctx) {
310
340
  disposeGeneration()
311
341
  throw error
312
342
  }
343
+ }
344
+
345
+ // The 0.1.7 facade needs only settings and must continue to work when the
346
+ // modern configForms service does not exist.
347
+ ctx.inject(['settings'], (settingsCtx) => {
348
+ const settings = serviceOf(settingsCtx, 'settings')
349
+ if (settings?.[DSH_017_SETTINGS_COMPAT_MARK] === true) mountGeneration(settingsCtx)
350
+ })
351
+
352
+ // Native SettingsProvider + configForms is a two-service capability.
353
+ // Depending only on "settings" can observe it before configForms starts and
354
+ // permanently skip the route. Cordis reinvokes a multi-service inject when
355
+ // configForms becomes ready and disposes it if either service disappears.
356
+ ctx.inject(['settings', 'configForms'], (servicesCtx) => {
357
+ const settings = serviceOf(servicesCtx, 'settings')
358
+ if (settings?.[DSH_017_SETTINGS_COMPAT_MARK] !== true) mountGeneration(servicesCtx)
313
359
  })
314
360
  }
@@ -14,6 +14,12 @@ export const WEB_ROUTE_REMOTE_CAPABILITY = Object.freeze({
14
14
  // callers that use isLocalMutationRoute(); local-only GET capabilities such as
15
15
  // test-connection are intentionally not reclassified as mutations.
16
16
  const ROUTE_CAPABILITY_POLICIES = new Map([
17
+ // The ConfigEditor-backed root route has its own explicit transport and
18
+ // BrowserAuth fence; declare its local-only semantics here as well.
19
+ ['/_dsh/vision-router/local-settings', new Map([
20
+ ['GET', { remote: WEB_ROUTE_REMOTE_CAPABILITY.LOCAL_ONLY }],
21
+ ['POST', { remote: WEB_ROUTE_REMOTE_CAPABILITY.LOCAL_ONLY, legacyMutation: true }],
22
+ ])],
17
23
  ['/_dsh/vision-router/self-update', new Map([
18
24
  ['POST', { remote: WEB_ROUTE_REMOTE_CAPABILITY.LOCAL_ONLY, legacyMutation: true }],
19
25
  ])],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-vision-router",
3
- "version": "3.1.5",
3
+ "version": "3.2.1",
4
4
  "description": "Eyes for text-only DeepSeek Harness agents: built-in free vision chain + pixel-level tools. Remote vision providers, including the default free fallback, receive image content unless strict local-only use is configured.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,6 +26,7 @@
26
26
  },
27
27
  "files": [
28
28
  "LICENSE",
29
+ "THIRD_PARTY_NOTICES.md",
29
30
  "README.md",
30
31
  "README.zh.md",
31
32
  "assets",
@@ -33,12 +34,11 @@
33
34
  "docs",
34
35
  "entry.js",
35
36
  "index.js",
36
- "lib",
37
- "presets"
37
+ "lib"
38
38
  ],
39
39
  "engines": {
40
- "node": "^22.19.0 || >=24.0.0",
41
- "dsh": ">=0.1.5-rc.1 <0.2.0-0 || >=0.2.0-rc.2 <0.3.0-0"
40
+ "node": ">=24.9.0",
41
+ "dsh": ">=0.2.1-rc.5 <0.3.0-0"
42
42
  },
43
43
  "packageManager": "pnpm@11.20.0",
44
44
  "keywords": [
@@ -55,44 +55,37 @@
55
55
  ],
56
56
  "dependencies": {
57
57
  "@deepseek-ai/schemastery": ">=3.18.0",
58
- "potrace": "^2.1.8",
58
+ "@visioncortex/vtracer": "1.0.0-alpha.4",
59
59
  "puppeteer-core": "^25.16.0",
60
+ "semver": "7.7.3",
60
61
  "undici": "^7.30.1",
61
62
  "zod": "^4.6.6"
62
63
  },
63
64
  "peerDependencies": {
64
- "@deepseek-ai/dsh-anonymous-user-id": ">=0.1.5-rc.1 <0.2.0-0 || >=0.2.0-rc.2 <0.3.0-0",
65
- "@deepseek-ai/dsh-llm-deepseek": ">=0.1.5-rc.1 <0.2.0-0 || >=0.2.0-rc.2 <0.3.0-0",
66
- "sharp": ">=0.35.3 <1",
67
- "@deepseek-ai/dsh-storage-domain": ">=0.1.5-rc.1 <0.2.0-0 || >=0.2.0-rc.2 <0.3.0-0"
65
+ "@deepseek-ai/dsh-llm-deepseek": ">=0.2.1-rc.5 <0.3.0-0",
66
+ "sharp": ">=0.35.3 <1"
68
67
  },
69
68
  "peerDependenciesMeta": {
70
- "@deepseek-ai/dsh-anonymous-user-id": {
71
- "optional": true
72
- },
73
69
  "@deepseek-ai/dsh-llm-deepseek": {
74
70
  "optional": true
75
71
  },
76
72
  "sharp": {
77
73
  "optional": true
78
- },
79
- "@deepseek-ai/dsh-storage-domain": {
80
- "optional": true
81
74
  }
82
75
  },
83
76
  "devDependencies": {
84
- "@deepseek-ai/dsh-anonymous-user-id": "0.2.0-rc.2",
85
- "@deepseek-ai/dsh-llm-deepseek": "0.2.0-rc.2",
77
+ "@deepseek-ai/dsh-anonymous-user-id": "0.2.1-rc.5",
78
+ "@deepseek-ai/dsh-attachment": "0.2.1-rc.5",
79
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.5",
80
+ "@deepseek-ai/dsh-llm-deepseek": "0.2.1-rc.5",
81
+ "@deepseek-ai/dsh-storage-domain": "0.2.1-rc.5",
82
+ "@types/node": "24.10.0",
86
83
  "fast-check": "4.10.0",
87
84
  "sharp": "^0.35.4",
88
- "typescript": "6.0.3",
89
- "@deepseek-ai/dsh-attachment": "0.2.0-rc.2",
90
- "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
91
- "@types/node": "22.20.0",
92
- "@deepseek-ai/dsh-storage-domain": "0.2.0-rc.2"
85
+ "typescript": "6.0.3"
93
86
  },
94
87
  "scripts": {
95
- "test": "node --test tests/dsh-alpha-pin.test.js tests/dsh-rc1-pin.test.js tests/agent-prestep-model-routing.test.js tests/native-plugin-icons.test.js tests/optional-peer-import-contract.test.js tests/index-modularization.test.js tests/adapter-prepare-call-compat.test.js tests/core.test.js tests/issue-374-delegated-call-config.test.js tests/grounding-coordinate-frame.test.js tests/grounding-coordinate-runtime.test.js tests/capability-advisory.test.js tests/vision-execution-policy.test.js tests/vision-backend-diagnostics.test.js tests/live-model-discovery.test.js tests/cache-atomic-write-concurrency.test.js tests/live-model-credential-resolution.test.js tests/vision-model-registry.test.js tests/live-model-client-stability.test.js tests/providers-persistence.test.js tests/provider-directory-fallback.test.js tests/model-catalog-policy.test.js tests/settings-ia-client-prelude.test.js tests/settings-ia-fj.test.js tests/settings-ia-acceptance-regression.test.js tests/settings-migration.test.js tests/settings-section-order.test.js tests/attachment-admission-policy.test.js tests/vision-resilience.test.js tests/degraded-local-evidence.test.js tests/vision-resilience-lifecycle.test.js tests/vision-breaker-readonly.test.js tests/alpha1-browser-lifecycle-integration.test.js tests/issue-367-remote-session-inject.test.js tests/vision-mode-toggle-injection.test.js tests/dev-staged-build.test.js tests/dev-web-reload.test.js tests/client.test.js tests/issue-307-regression.test.js tests/issue-284-vision-mode-toggle.test.js tests/issue-284-vision-mode-hardening.test.js tests/issue-284-attachment-id-hint.test.js tests/issue-284-model-visibility.test.js tests/issue-284-vision-selection-effort.test.js tests/client-presentation-boundary.test.js tests/clipboard-image-paste-compat.test.js tests/remote-settings-bridge.test.js tests/remote-settings-v2-contract.test.js tests/remote-settings-risk-confirmation.test.js tests/local-remote-settings-permission.test.js tests/artifact-path-security.test.js tests/http-compat.test.js tests/catalog-corrections.test.js tests/release-registry-identity.test.js tests/update-check.test.js tests/update-check-signal-lifecycle.test.js tests/self-update.test.js tests/doctor.test.js tests/doctor-cli.test.js tests/legacy-session-repair.test.js tests/profile-pnpm-diagnostics.test.js tests/doctor-v2.test.js tests/doctor-cli-v2.test.js tests/doctor-runtime.test.js tests/dsh-host-capabilities.test.js tests/doctor-host-capabilities.test.js tests/session-repair-v2.test.js tests/activation-shim-contract.test.js tests/bundle-defaults.test.js tests/file-logger.test.js tests/official-deepseek-catalog.test.js tests/replay-delegation.test.js tests/twin-image-capability-fallback.test.js tests/twin-image-custom-wrapper.test.js tests/adversarial-hardening.test.js tests/vision-adversarial-hardening-v2.test.js tests/vision-capability-benchmark-visual-proof.test.js tests/wrapper-directory.test.js tests/logging-ui.test.js tests/manifest-dependencies.test.js tests/provider-transport-threading.test.js tests/architecture-2.3-gate.test.js tests/host-settings-seam.test.js tests/drift-canary-settings-seam.test.js tests/esm-cycle-audit.test.js tests/structured-bootstrap.test.js tests/structured-bootstrap-gate.test.js tests/vision-model-guidance-contract.test.js tests/local-ollama.test.js tests/local-only-vision.test.js tests/ollama-cold-start.test.js tests/ollama-cold-start-loaded.test.js tests/zero-regression-gate.test.js tests/runtime-e2e.test.js tests/local-vision-stabilizer.test.js tests/local-connection-probe.test.js tests/vision-diagnostics-routes.test.js tests/repetition-guard.test.js tests/guide-scroll-gate.test.js tests/settings-scroll-jank-regression.test.js tests/free-cloud-first.test.js tests/dsh-host-compat.test.js tests/native-image-coexistence.test.js tests/issue-276-session-image-ownership.test.js tests/issue-276-entry-policy-bridge.test.js tests/issue-276-policy-hardening.test.js tests/issue-289-native-nonintervention.test.js tests/issue-512-tool-restriction.test.js tests/issue-606-session-source-ownership.test.js tests/pi-ai-bridge-wire-compat.test.js tests/fetch-wrapper-lifecycle.test.js tests/fetch-wrapper-composition.test.js tests/provider-probe-proxy-scope.test.js tests/lifecycle-invariants.test.js tests/vision-tool-settings-generation.test.js tests/release-package-content-identity.test.js tests/release-state-machine.test.js tests/mixed-router.test.js tests/depth-tier.test.js tests/depth-quota-behavior.test.js tests/structured-flow-hardening.test.js tests/structured-flow-adversarial.test.js tests/vision-budget-activation.test.js tests/runtime-boundary-fixes.test.js tests/vision-stream-iterator-cancellation.test.js tests/security-resource-boundaries.test.js tests/security-property-fuzz.test.js tests/security-adversarial-fuzz-contract.test.js tests/runtime-i18n.test.js tests/long-ocr-empty-retry.test.js tests/tesseract-adaptive-ocr.test.js tests/tesseract-node24-boot.test.js tests/session-vision-state.test.js tests/session-vision-state-integration.test.js tests/session-vision-event-feed.test.js tests/session-vision-policy.test.js tests/session-vision-policy-domain.test.js tests/session-vision-delegation.test.js tests/session-vision-delegation-boundary.test.js tests/subagent-vision-inheritance-characterization.test.js tests/subagent-vision-runtime-integration.test.js tests/subagent-vision-cold-resume.test.js tests/image-resource-governor.test.js tests/resource-retention-lifecycle.test.js tests/pixel-diff-stream.test.js tests/large-image-resource-integration.test.js tests/structured-guard-idempotency.test.js tests/vision-routing-product.test.js tests/vision-runtime-performance.test.js tests/vision-routing-settings-prelude.test.js tests/v2-settings-ia-integration.test.js tests/vision-capability-router.test.js tests/vision-capability-reference.test.js tests/vision-capability-benchmark.test.js tests/vision-capability-grounding-proof-contract.test.js tests/vision-capability-probe.test.js tests/vision-capability-axis-freshness.test.js tests/vision-capability-shadow-health.test.js tests/vision-capability-benchmark-service.test.js tests/vision-capability-preflight-hardening.test.js tests/vision-capability-benchmark-contract.test.js tests/vision-capability-benchmark-client.test.js tests/vision-capability-benchmark-client-productization.test.js tests/vision-capability-adapter-route.test.js tests/vision-background-benchmark.test.js tests/vision-background-lifecycle.test.js tests/vision-background-benchmark-productization.test.js tests/vision-capability-benchmark-budget.test.js tests/vision-image-input-verdict.test.js tests/vision-capability-failure-classification.test.js tests/vision-capability-gate-client.test.js tests/v2-product-review-fixes.test.js tests/qa-top5-reliability.test.js tests/qa-screenshot-runtime.test.js tests/qa-runtime-identity.test.js tests/qa-turn-budget-cancellation.test.js tests/qa-cancellation-publication.test.js tests/qa-reliability-tail.test.js tests/qa-endpoint-route-alias.test.js tests/settings-native-card-semantics.test.js tests/settings-native-card-lazy-data.test.js tests/settings-invalid-staged-dirty.test.js tests/vision-toggle-root-hardening.test.js && pnpm test:regression-closure && node --test tests/vision-backend-runtime-policy.test.js tests/vision-router-adversarial-review-fixes.test.js tests/web-panel-delegation.test.js",
88
+ "test": "node --test tests/dsh-alpha-pin.test.js tests/dsh-rc1-pin.test.js tests/dsh-rc2-pin.test.js tests/agent-prestep-model-routing.test.js tests/native-plugin-icons.test.js tests/optional-peer-import-contract.test.js tests/index-modularization.test.js tests/adapter-prepare-call-compat.test.js tests/core.test.js tests/issue-374-delegated-call-config.test.js tests/grounding-coordinate-frame.test.js tests/grounding-coordinate-runtime.test.js tests/desktop-e2e-watchdog.test.js tests/capability-advisory.test.js tests/vision-execution-policy.test.js tests/vision-backend-diagnostics.test.js tests/live-model-discovery.test.js tests/cache-atomic-write-concurrency.test.js tests/live-model-credential-resolution.test.js tests/vision-model-registry.test.js tests/live-model-client-stability.test.js tests/providers-persistence.test.js tests/provider-directory-fallback.test.js tests/model-catalog-policy.test.js tests/settings-ia-client-prelude.test.js tests/settings-ia-fj.test.js tests/settings-ia-acceptance-regression.test.js tests/settings-migration.test.js tests/settings-section-order.test.js tests/attachment-admission-policy.test.js tests/vision-resilience.test.js tests/degraded-local-evidence.test.js tests/vision-resilience-lifecycle.test.js tests/vision-breaker-readonly.test.js tests/alpha1-browser-lifecycle-integration.test.js tests/issue-367-remote-session-inject.test.js tests/vision-mode-toggle-injection.test.js tests/dev-staged-build.test.js tests/dev-web-reload.test.js tests/client.test.js tests/issue-307-regression.test.js tests/issue-284-vision-mode-toggle.test.js tests/issue-284-vision-mode-hardening.test.js tests/issue-284-attachment-id-hint.test.js tests/issue-284-model-visibility.test.js tests/issue-284-vision-selection-effort.test.js tests/client-presentation-boundary.test.js tests/clipboard-image-paste-compat.test.js tests/remote-settings-bridge.test.js tests/remote-settings-v2-contract.test.js tests/remote-settings-risk-confirmation.test.js tests/local-remote-settings-permission.test.js tests/artifact-path-security.test.js tests/http-compat.test.js tests/catalog-corrections.test.js tests/release-registry-identity.test.js tests/update-check.test.js tests/update-check-signal-lifecycle.test.js tests/self-update.test.js tests/doctor.test.js tests/doctor-cli.test.js tests/legacy-session-repair.test.js tests/profile-pnpm-diagnostics.test.js tests/doctor-v2.test.js tests/doctor-cli-v2.test.js tests/doctor-runtime.test.js tests/dsh-host-capabilities.test.js tests/doctor-host-capabilities.test.js tests/session-repair-v2.test.js tests/activation-shim-contract.test.js tests/bundle-defaults.test.js tests/required-ci-contract.test.js tests/ci-electron-download-retry.test.js tests/file-logger.test.js tests/official-deepseek-catalog.test.js tests/replay-delegation.test.js tests/twin-image-capability-fallback.test.js tests/twin-image-custom-wrapper.test.js tests/adversarial-hardening.test.js tests/vision-adversarial-hardening-v2.test.js tests/vision-capability-benchmark-visual-proof.test.js tests/wrapper-directory.test.js tests/logging-ui.test.js tests/manifest-dependencies.test.js tests/provider-transport-threading.test.js tests/architecture-2.3-gate.test.js tests/host-settings-seam.test.js tests/drift-canary-settings-seam.test.js tests/esm-cycle-audit.test.js tests/structured-bootstrap.test.js tests/structured-bootstrap-gate.test.js tests/vision-model-guidance-contract.test.js tests/local-ollama.test.js tests/local-only-vision.test.js tests/ollama-cold-start.test.js tests/ollama-cold-start-loaded.test.js tests/zero-regression-gate.test.js tests/runtime-e2e.test.js tests/local-vision-stabilizer.test.js tests/local-connection-probe.test.js tests/vision-diagnostics-routes.test.js tests/repetition-guard.test.js tests/guide-scroll-gate.test.js tests/settings-scroll-jank-regression.test.js tests/free-cloud-first.test.js tests/dsh-host-compat.test.js tests/native-image-coexistence.test.js tests/issue-276-session-image-ownership.test.js tests/issue-276-entry-policy-bridge.test.js tests/issue-276-policy-hardening.test.js tests/issue-289-native-nonintervention.test.js tests/issue-512-tool-restriction.test.js tests/issue-606-session-source-ownership.test.js tests/pi-ai-bridge-wire-compat.test.js tests/fetch-wrapper-lifecycle.test.js tests/fetch-wrapper-composition.test.js tests/provider-probe-proxy-scope.test.js tests/lifecycle-invariants.test.js tests/vision-tool-settings-generation.test.js tests/release-package-content-identity.test.js tests/release-state-machine.test.js tests/mixed-router.test.js tests/depth-tier.test.js tests/depth-quota-behavior.test.js tests/structured-flow-hardening.test.js tests/structured-flow-adversarial.test.js tests/vision-budget-activation.test.js tests/runtime-boundary-fixes.test.js tests/vision-stream-iterator-cancellation.test.js tests/security-resource-boundaries.test.js tests/security-property-fuzz.test.js tests/security-adversarial-fuzz-contract.test.js tests/runtime-i18n.test.js tests/long-ocr-empty-retry.test.js tests/tesseract-adaptive-ocr.test.js tests/tesseract-node24-boot.test.js tests/session-vision-state.test.js tests/session-vision-state-integration.test.js tests/session-vision-event-feed.test.js tests/session-vision-policy.test.js tests/session-vision-policy-domain.test.js tests/session-vision-delegation.test.js tests/session-vision-delegation-boundary.test.js tests/subagent-vision-inheritance-characterization.test.js tests/subagent-vision-runtime-integration.test.js tests/subagent-vision-cold-resume.test.js tests/image-resource-governor.test.js tests/resource-retention-lifecycle.test.js tests/pixel-diff-stream.test.js tests/large-image-resource-integration.test.js tests/structured-guard-idempotency.test.js tests/vision-routing-product.test.js tests/vision-runtime-performance.test.js tests/vision-routing-settings-prelude.test.js tests/v2-settings-ia-integration.test.js tests/vision-capability-router.test.js tests/vision-capability-reference.test.js tests/vision-capability-benchmark.test.js tests/vision-capability-grounding-proof-contract.test.js tests/vision-capability-probe.test.js tests/vision-capability-axis-freshness.test.js tests/vision-capability-shadow-health.test.js tests/vision-capability-benchmark-service.test.js tests/vision-capability-preflight-hardening.test.js tests/vision-capability-benchmark-contract.test.js tests/vision-capability-benchmark-client.test.js tests/vision-capability-benchmark-client-productization.test.js tests/vision-capability-adapter-route.test.js tests/vision-background-benchmark.test.js tests/vision-background-lifecycle.test.js tests/vision-background-benchmark-productization.test.js tests/vision-capability-benchmark-budget.test.js tests/vision-image-input-verdict.test.js tests/vision-capability-failure-classification.test.js tests/vision-capability-gate-client.test.js tests/v2-product-review-fixes.test.js tests/qa-top5-reliability.test.js tests/qa-screenshot-runtime.test.js tests/qa-runtime-identity.test.js tests/qa-turn-budget-cancellation.test.js tests/qa-cancellation-publication.test.js tests/qa-reliability-tail.test.js tests/qa-endpoint-route-alias.test.js tests/settings-native-card-semantics.test.js tests/settings-native-card-lazy-data.test.js tests/settings-invalid-staged-dirty.test.js tests/vision-toggle-root-hardening.test.js && pnpm test:regression-closure && node --test tests/vision-backend-runtime-policy.test.js tests/vision-router-adversarial-review-fixes.test.js tests/web-panel-delegation.test.js && node --test tests/vision-trace-vtracer.test.js tests/vision-trace-image-quality.test.js && pnpm license:check",
96
89
  "test:core": "node --test tests/core.test.js tests/degraded-local-evidence.test.js tests/runtime-e2e.test.js tests/structured-bootstrap.test.js tests/structured-flow-hardening.test.js tests/structured-flow-adversarial.test.js tests/vision-execution-policy.test.js tests/vision-backend-runtime-policy.test.js",
97
90
  "test:routing": "node --test tests/issue-374-delegated-call-config.test.js tests/twin-image-capability-fallback.test.js tests/twin-image-custom-wrapper.test.js tests/vision-routing-product.test.js tests/vision-capability-router.test.js tests/vision-capability-probe.test.js tests/vision-capability-shadow-health.test.js tests/vision-runtime-performance.test.js tests/vision-background-benchmark.test.js tests/vision-image-input-verdict.test.js",
98
91
  "test:session": "node --test tests/session-vision-state.test.js tests/session-vision-state-integration.test.js tests/session-vision-policy.test.js tests/session-vision-delegation.test.js tests/session-vision-delegation-boundary.test.js tests/subagent-vision-inheritance-characterization.test.js tests/subagent-vision-runtime-integration.test.js tests/subagent-vision-cold-resume.test.js tests/session-vision-policy-domain.test.js tests/replay-delegation.test.js tests/legacy-session-repair.test.js tests/session-repair-v2.test.js tests/issue-276-session-image-ownership.test.js",
@@ -121,10 +114,12 @@
121
114
  "typecheck:declaration": "tsc -p tsconfig.declaration.json",
122
115
  "typecheck": "pnpm typecheck:host && pnpm typecheck:client && pnpm typecheck:declaration",
123
116
  "prepare": "pnpm build",
124
- "prepack": "pnpm build",
117
+ "prepack": "pnpm license:check && pnpm build",
125
118
  "lint": "node scripts/lint-source-ownership.mjs && node scripts/lint-lifecycle-invariants.mjs",
126
119
  "source:artifact:check": "node scripts/verify-source-artifact-map.mjs",
127
- "test:regression-closure": "node --test tests/auto-wrap-model-removal.test.js tests/guard-stop-surface-shadow.test.js tests/release-package-content-identity.test.js tests/settings-card-race-safety.test.js tests/settings-guide-replay-safety.test.js tests/settings-ia-targeted-adversarial.test.js tests/v2-release-acceptance-regressions.test.js tests/vision-turn-budget-client-prelude.test.js tests/wrapper-scope-client-prelude.test.js"
120
+ "test:regression-closure": "node --test tests/auto-wrap-model-removal.test.js tests/guard-stop-surface-shadow.test.js tests/release-package-content-identity.test.js tests/settings-card-race-safety.test.js tests/settings-guide-replay-safety.test.js tests/settings-ia-targeted-adversarial.test.js tests/v2-release-acceptance-regressions.test.js tests/vision-turn-budget-client-prelude.test.js tests/wrapper-scope-client-prelude.test.js",
121
+ "test:trace": "node --test tests/vision-trace-vtracer.test.js tests/vision-trace-image-quality.test.js",
122
+ "license:check": "node scripts/verify-runtime-licenses.mjs"
128
123
  },
129
124
  "dsh": {
130
125
  "client": {
package/presets/README.md DELETED
@@ -1,9 +0,0 @@
1
- # presets/ — runtime compatibility only
2
-
3
- **DSH owns user provider/model registration, credentials and the model catalog.** Vision Router no longer maintains vendor-specific YAML examples, and the vision backend UI reads DSH's model list.
4
-
5
- **Do not delete `web-connection-ready/`.** It is a real private Web/Host startup bridge loaded through `cordis.patch.yml`. [PR #676](https://github.com/ysr666/dsh-vision-router/pull/676) introduced it for DSH alpha.2: old `webRuntime` and new `webStartup` own different trusted-host readiness generations. It must survive packaging and remains until exact old/new Host tests justify removal.
6
-
7
- [PR #89](https://github.com/ysr666/dsh-vision-router/pull/89) identified a genuine missing `image` declaration for custom DSH models. Prefer DSH model input types when available; for **verified visual models only**, older Hosts may need `llm-pi-ai` `input: [text, image]` and a reload. Verify actual image delivery with Test Vision instead of trusting metadata alone.
8
-
9
- The built-in anonymous OVH fallback lives in `src/lib/core-primitives.js`'s `DEFAULT_HTTP_PROVIDERS`, not the old `presets/ovh.yaml` example. Retired example files can be read at [their original August 2026 commit](https://github.com/ysr666/dsh-vision-router/commit/16e29d07b943d2b2e1dfb615683ab07f24cc96af). See [architecture audit](../docs/architecture/model-catalog-ownership.md).