@lob-ox/core-darwin-x64 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core.cjs +10 -17
- package/package.json +1 -1
- package/ui-react/assets/{InstancesPage-WNocGU57.js → InstancesPage-vhaXR-Ri.js} +1 -1
- package/ui-react/assets/{OverviewPage-CohjbLp9.js → OverviewPage-BEKX3Xvl.js} +2 -2
- package/ui-react/assets/{PluginsPage-DaV7inbG.js → PluginsPage-C8XuMY7A.js} +1 -1
- package/ui-react/assets/{RouterPage-qBZOgVzM.js → RouterPage-Dt8Q-fBz.js} +1 -1
- package/ui-react/assets/{SettingsPage-ohOn3bbK.js → SettingsPage-5em8oAQt.js} +1 -1
- package/ui-react/assets/{TasksPage-Xw8-xl8p.js → TasksPage-SdBAC-IQ.js} +1 -1
- package/ui-react/assets/{supervisor-BilTj6si.js → supervisor-Bg0C-67Q.js} +2 -2
- package/ui-react/supervisor.html +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,F as t,I as n,L as r,M as i,O as a,R as o,S as s,T as c,U as l,V as u,_ as d,a as f,d as p,f as m,h,i as g,j as _,l as v,m as y,p as b,s as x,u as S,v as C,w,x as T,y as E}from"./supervisor-Dfq_YAmt.js";import{t as D}from"./refresh-cw-CFZGPyP6.js";import{c as O,l as k}from"./supervisor-BilTj6si.js";import{t as A}from"./useSupervisorAction-DZSdzPif.js";import{n as j,o as M,t as N}from"./widgets-M2h3F-43.js";var P=l(u(),1),F=o();function I(){let[e,t]=(0,P.useState)(null),[r,i]=(0,P.useState)(null),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(``),[u,h]=(0,P.useState)(`hide`),{busy:_,run:y}=A(),C=(0,P.useCallback)(async()=>{let[e,n,r,a]=await Promise.all([f.autostart().catch(()=>null),f.lanPanel().catch(()=>null),f.accessKey().catch(()=>null),f.closeAction().catch(()=>null)]);e&&t(e.on),n&&i(n),r&&s(r),a&&h(a.closeAction)},[]);(0,P.useEffect)(()=>{C()},[C]);async function w(e){t(e);try{let n=await f.setAutostart(e);n.ok===!1?(a.error(n.error||`设置失败`),t(!e)):a.success(e?`已开启开机自启(整条服务链)`:`已关闭开机自启`)}catch(n){a.error(String(n)),t(!e)}}async function T(e){i(t=>t&&{...t,enabled:e});try{let t=await f.setLanPanel(e);if(t.ok===!1){a.error(t.error||`设置失败`),i(t=>t&&{...t,enabled:!e});return}i(t),a.success(e?`已开启局域网访问`:`已关闭局域网访问(仅本机)`)}catch(t){a.error(String(t)),i(t=>t&&{...t,enabled:!e})}}async function E(){let e=c.trim();if(e&&e.length<8){a.error(`访问密钥至少 8 位(建议 16+ 位随机串)`);return}await y(`akk`,()=>f.setAccessKey(e),{success:e?`访问密钥已设置`:`访问密钥已清除`,refresh:!1,onDone:()=>{l(``),C()}})&&g(e)}async function D(e){let t=e===`exit`?`exit`:`hide`;h(t),await y(`ca`,()=>f.setCloseAction(t),{success:t===`exit`?`已设为:关闭窗口时退出管家`:`已设为:关闭窗口时隐藏至托盘`,refresh:!1})}return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(N,{children:[(0,F.jsx)(j,{title:`启动`,subtitle:`开机行为与偏好`}),(0,F.jsxs)(`div`,{className:`grid gap-4 px-5 py-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-6`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`strong`,{className:`block text-sm font-medium text-foreground`,children:`开机自动启动管家`}),(0,F.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`开机登录后自动启动 DeepSeek Harness 管家(本程序)。不会自动启动任何单个实例——实例是否被自动拉起,由各自「进程守护」开关决定。`})]}),e===null?(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`…`}):(0,F.jsx)(`span`,{title:`开机自启`,children:(0,F.jsx)(x,{checked:e,onCheckedChange:e=>void w(e)})})]}),(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-6 border-t border-border/60 pt-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`strong`,{className:`block text-sm font-medium text-foreground`,children:`关闭窗口时`}),(0,F.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`隐藏至托盘:管家与服务继续在后台运行;退出管家:关闭并停止全部服务。`})]}),(0,F.jsxs)(v,{value:u,onValueChange:e=>void D(e),children:[(0,F.jsx)(m,{className:`w-[150px]`,children:(0,F.jsx)(b,{})}),(0,F.jsxs)(S,{children:[(0,F.jsx)(p,{value:`hide`,children:`隐藏至托盘`}),(0,F.jsx)(p,{value:`exit`,children:`退出管家`})]})]})]})]})]}),(0,F.jsxs)(N,{children:[(0,F.jsx)(j,{title:`访问`}),(0,F.jsxs)(`div`,{className:`grid gap-4 px-5 py-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-6`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`strong`,{className:`block text-sm font-medium text-foreground`,children:`管家局域网访问`}),r?r.enabled?(0,F.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[`开启后,局域网内设备可通过\xA0`,(r.urls??[]).map((e,t)=>(0,F.jsxs)(`span`,{children:[t>0?`、 `:null,(0,F.jsx)(`code`,{className:`rounded bg-muted px-1 py-px font-mono text-foreground`,children:e})]},e)),`\xA0访问本面板。`]}):(0,F.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`关闭后仅本机可访问,局域网设备不可用。`}):null]}),r===null?(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`…`}):(0,F.jsx)(`span`,{title:`局域网访问`,children:(0,F.jsx)(x,{checked:r.enabled,onCheckedChange:e=>void T(e)})})]}),(0,F.jsx)(`div`,{className:`flex items-start justify-between gap-6 border-t border-border/60 pt-4`,children:(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`strong`,{className:`block text-sm font-medium text-foreground`,children:`访问密钥`}),(0,F.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[`局域网或公网访问本面板需携带此密钥;本机访问不受影响。留空保存可清除。`,o?.configured?(0,F.jsx)(`span`,{className:`mt-1 block text-status-ok`,children:`当前:已设置`}):(0,F.jsx)(`span`,{className:`mt-1 block text-muted-foreground`,children:`当前:未设置`})]})]})}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(d,{type:`password`,autoComplete:`new-password`,placeholder:`输入 ≥8 位访问密钥(建议随机长串)`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&E()},className:`flex-1`}),(0,F.jsx)(n,{variant:`outline`,onClick:()=>l(``),disabled:!c&&!o?.configured,children:`清除`}),(0,F.jsx)(n,{disabled:_===`akk`,onClick:()=>void E(),children:o?.configured?`更新密钥`:`设置密钥`})]})]})]})]})}function L(){let[t,o]=(0,P.useState)(null),[s,l]=(0,P.useState)(`auto`),[u,p]=(0,P.useState)([]),[m,g]=(0,P.useState)(``),[v,b]=(0,P.useState)(``),[x,S]=(0,P.useState)(!1),C=(0,P.useRef)(null),{busy:T,run:E}=A();(0,P.useEffect)(()=>{if(!x||!C.current)return;let e=window.setTimeout(()=>{let e=C.current;e&&e.scrollIntoView({block:`start`,behavior:`smooth`})},320);return()=>window.clearTimeout(e)},[x]);let I=(0,P.useCallback)(async()=>{let e=await f.registry().catch(()=>null);o(e)},[]);(0,P.useEffect)(()=>{I()},[I]),(0,P.useEffect)(()=>{t&&(l(t.mode||`auto`),p((t.candidates??[]).map(e=>e.origin)),g(t.manualOrigin||``))},[t]);let L=()=>{let e=v.trim();if(!/^https?:\/\//.test(e)){a.error(`请输入合法的镜像 URL`);return}if(u.includes(e)){a.info(`已在列表中`);return}p(t=>[...t,e]),b(``)};async function z(){let e={mode:s,origins:u};if(s===`manual`){if(!/^https?:\/\//.test(m.trim())){a.error(`手动模式需提供合法镜像 URL`);return}e.manualOrigin=m.trim()}await E(`reg`,()=>f.registrySet(e),{success:`已保存镜像配置`,refresh:!1,onDone:()=>void I()})}async function B(){await E(`regr`,()=>f.registryRefresh(),{success:`已探测镜像`,refresh:!1,onDone:()=>void I()})}let V=e=>{let n=(t?.probes??[]).find(t=>t.origin===e);return n&&n.ok?n.latencyMs:null},H=e=>{let n=(t?.registries??[]).find(t=>t.base===e);if(n&&!n.usable)return`形态非法:`+(n.violation||`未知`);let r=(t?.probes??[]).find(t=>t.origin===e);return r&&!r.ok?`不可达:`+(r.error||`未知`):`未探测`};return(0,F.jsxs)(N,{children:[(0,F.jsx)(j,{title:`镜像源`,subtitle:`npm 拉取 / 更新检测共用此源`}),(0,F.jsxs)(`div`,{className:`grid gap-3 px-5 py-4`,children:[(0,F.jsxs)(y,{value:s,onValueChange:e=>l(e),className:`flex gap-3`,children:[(0,F.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1.5 text-sm`,children:[(0,F.jsx)(h,{value:`auto`,id:`reg-auto`}),(0,F.jsx)(`span`,{children:`自动(按延迟选最快)`})]}),(0,F.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1.5 text-sm`,children:[(0,F.jsx)(h,{value:`manual`,id:`reg-manual`}),(0,F.jsx)(`span`,{children:`手动(固定指定)`})]})]}),s===`manual`?(0,F.jsx)(`div`,{className:`grid gap-1.5`,children:(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(d,{placeholder:`https://registry.npmmirror.com`,value:m,onChange:e=>g(e.target.value),className:`flex-1`}),(0,F.jsx)(n,{variant:`outline`,onClick:()=>void R(m),children:`测试`})]})}):null,(0,F.jsxs)(e,{open:x,onOpenChange:S,className:`grid gap-1`,children:[(0,F.jsxs)(c,{ref:C,children:[(0,F.jsxs)(`span`,{className:`text-xs font-medium text-foreground`,children:[`候选镜像列表(`,u.length,`)`]}),x?(0,F.jsx)(_,{className:`size-3.5 text-muted-foreground`}):(0,F.jsx)(i,{className:`size-3.5 text-muted-foreground`})]}),x?null:(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-md border border-border/70 px-3 py-1.5`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(M,{tone:`ok`,children:`当前`}),(0,F.jsx)(`code`,{className:`truncate font-mono text-xs text-muted-foreground`,children:t?.origin||`未选择`})]}),t?.origin&&V(t.origin)!=null?(0,F.jsxs)(`span`,{className:`shrink-0 text-xs font-medium tabular-nums`,children:[V(t.origin),`ms`]}):null]}),(0,F.jsx)(w,{children:(0,F.jsx)(`div`,{className:`rounded-md border border-border/70`,children:u.map((e,r)=>(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border/50 px-3 py-1.5 last:border-b-0`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[t?.origin===e?(0,F.jsx)(M,{tone:`ok`,children:`当前`}):null,(0,F.jsx)(`code`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e})]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[V(e)==null?(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground/50`,title:H(e),children:`—`}):(0,F.jsxs)(`span`,{className:`text-xs font-medium tabular-nums`,title:`延迟毫秒数(自动探测)`,children:[V(e),(0,F.jsx)(`span`,{className:`text-muted-foreground/60`,children:`ms`})]}),(0,F.jsx)(n,{size:`chip`,variant:`ghost`,onClick:()=>p(t=>t.filter(t=>t!==e)),title:`移除该候选镜像`,children:(0,F.jsx)(O,{className:`size-3.5 text-destructive`})})]})]},r))})})]}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(d,{placeholder:`https://… 添加自定义镜像`,value:v,onChange:e=>b(e.target.value),className:`flex-1`,onKeyDown:e=>{e.key===`Enter`&&L()}}),(0,F.jsxs)(n,{variant:`outline`,onClick:L,children:[(0,F.jsx)(k,{className:`size-4`}),`添加`]})]}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsxs)(n,{size:`sm`,disabled:T===`regr`,onClick:()=>void B(),variant:`outline`,children:[(0,F.jsx)(D,{className:r(`size-3.5`,T===`regr`&&`animate-spin`)}),`重新探测`]}),(0,F.jsx)(n,{disabled:T===`reg`,onClick:()=>void z(),children:`保存`})]})]})]})}async function R(e){if(!/^https?:\/\//.test(e)){a.error(`请输入合法镜像 URL`);return}a.info(`测试中…`);try{let t=await f.registryProbe(e.replace(/\/+$/,``));t&&t.ok===!0&&typeof t.latencyMs==`number`?a.success(`可达,延迟 `+t.latencyMs+` ms`):t&&typeof t.error==`string`&&t.error?a.error(`探测失败:`+t.error):a.error(`不可达`)}catch(e){a.error(`探测失败:`+(e instanceof Error?e.message:String(e)))}}var z=`lobox:kernel-update-request`,B=`lobox:kernel-update-result`,V=`lobox:kernel-update-progress`,H=12e5;function U(e){return new Promise(t=>{if(!W()){t({ok:!1,error:`内核更新由桌面壳执行:请在桌面壳面板中操作。`});return}let n=`kupd-`+Date.now()+`-`+Math.random().toString(36).slice(2,8),r=Date.now(),i=!1,a=null,o=setTimeout(s,H);function s(){l(a?{ok:!1,error:`桌面壳无响应(更新请求超时;最后一次进度:`+a+`)`}:{ok:!1,error:`桌面壳无响应(更新请求超时)`})}let c=e=>{clearTimeout(o),o=setTimeout(s,Math.max(0,e))},l=e=>{i||(i=!0,window.removeEventListener(`message`,u),clearTimeout(o),t(e))},u=t=>{let i=t.data;if(!(!i||typeof i!=`object`)&&t.source===window.parent&&i.v===2&&(i.type===B||i.type===V)&&i.requestId===n){if(i.type===V){let t=typeof i.status==`string`&&i.status?i.status:null;t&&(a=t),e?.({stage:typeof i.stage==`string`?i.stage:null,status:t,progress:typeof i.progress==`number`?i.progress:null});let n=typeof i.maxWaitMs==`number`?i.maxWaitMs:0;n>0&&c(n-(Date.now()-r));return}l({ok:i.ok===!0,stage:i.stage??null,version:i.version??null,restartUncertain:i.restartUncertain===!0,error:i.error??null})}};window.addEventListener(`message`,u);try{window.parent.postMessage({v:2,type:z,requestId:n},`*`)}catch(e){l({ok:!1,error:String(e)})}})}function W(){try{return window.parent!==window}catch{return!1}}var G=`DeepSeek Harness 管家`,K=`独立于 Harness 运行的系统级守卫:负责启动、存活监测与故障自动重启被监管目标,提供生命周期管理、智能路由、远程控制与多实例沙箱的运维面板。`,q=e=>e?String(e).replace(/^v/i,``):`—`;function J(){let[e,i]=(0,P.useState)(null),[o,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(!1),[d,p]=(0,P.useState)(`dsh`),[m,h]=(0,P.useState)(``),[g,_]=(0,P.useState)(null),{busy:v,run:y}=A(),b=t(),x=(0,P.useCallback)(async e=>{p(e),h(``),u(!0);try{let t=e===`dsh`?await f.dshChangelog():await f.guardChangelog();h(t||`(无内容)`)}catch(e){h(`加载失败:`+String(e))}},[]),S=(0,P.useCallback)(async()=>{let[e,t]=await Promise.all([f.guardVersion().catch(()=>null),f.shellStatus().catch(()=>null)]);i(e||{}),c(t?{version:t.identity?.version||null,capable:t.identity?.selfUpdateCapable===!0,installKind:t.identity?.installKind}:{})},[]);(0,P.useEffect)(()=>{S()},[S]),(0,P.useEffect)(()=>{let e=!0;return(async()=>{let[t,n]=await Promise.all([f.selfUpdateStatus().catch(()=>null),f.shellCheckUpdate().catch(()=>null)]);e&&(t&&t.ok!==!1&&i(e=>({...e||{},...t})),n&&c(e=>({...e||{},latest:n.latest||null,updateAvailable:n.updateAvailable===!0,error:n.error||null})))})(),()=>{e=!1}},[]);let w=async()=>{await y(`chk`,async()=>{let e=`内核:状态未知`,t=await f.selfUpdateStatus().catch(()=>null);if(t&&t.ok!==!1)i(t||{}),e=t.updateAvailable&&t.latest?`内核有新版本 `+q(t.latest)+`(当前 `+q(t.installed)+`)`:`内核已是最新(`+q(t.installed)+`)`;else{let n=await f.guardVersion().catch(()=>null);if(n?.upstream===`git-repo`){let t=await f.guardVersionCheck().catch(()=>null);i({...n||{},...t||{}}),e=t?.updateAvailable?`内核源码仓库有上游更新(当前提交 `+(t.commit||n?.commit||`—`)+`)`:`内核源码仓库已是最新(提交 `+(n?.commit||t?.commit||`—`)+`)`}else e=`内核:`+(t&&t.error||`自更新未配置`)}let n=await f.shellCheckUpdate().catch(()=>null),r=`桌面壳:状态未知`;n&&n.ok!==!1?(c(e=>({...e||{},latest:n.latest||null,updateAvailable:n.updateAvailable===!0,error:null})),r=n.updateAvailable&&n.latest?`桌面壳有新版本 `+q(n.latest)+`(当前 `+q(n.installed)+`)`:`桌面壳已是最新(`+q(n.installed)+`)`):(c(e=>({...e||{},error:n&&n.error||`检测失败`})),r=`桌面壳:`+(n&&n.error||`检测失败`)),t?.updateAvailable&&t?.latest||n?.updateAvailable&&n?.latest?a.warning(e+`;`+r):a.success(e+`;`+r)},{refresh:!1})},O=async()=>{if(!W()){a.error(`内核更新由桌面壳执行:请在桌面壳面板中操作。`);return}await b({title:`发现内核新版本 `+q(e?.latest)+`,是否立即更新?`,description:`内核将由桌面壳安装,并自动重启守卫。`,confirmText:`更新`})&&await y(`upd`,async()=>{_({status:`已向桌面壳发出更新请求,等待响应…`});let t=await U(_);if(!t.ok){a.error(t.error||`更新失败`);return}let n=q(t.version||e?.latest);t.restartUncertain?a.warning(`内核已更新至 `+n+`,但守卫可能未自动重启,请手动确认。`):a.success(`内核已更新至 `+n+`,守卫已重启。`)},{refresh:!0,onDone:()=>_(null)})},k=async()=>{await b({title:`将重启桌面壳以应用更新 `+q(o?.latest)+`,是否继续?`,description:`桌面壳窗口会关闭并重新打开;内核与被管实例不受影响。`,confirmText:`重启桌面壳`})&&await y(`shupd`,async()=>{let e=await f.shellRestart();if(e?.ok===!1){a.error(e.error||`重启桌面壳失败`);return}a.success(`桌面壳正在重启,将在启动时自动更新至 `+q(o?.latest))},{refresh:!1})},I=!!(e?.updateAvailable&&e?.latest&&e.latest!==e?.installed),L=!!(o?.updateAvailable&&o?.latest&&o.latest!==o?.version),R=o?.capable===!1;return(0,F.jsxs)(N,{children:[(0,F.jsx)(j,{title:`关于`,subtitle:G,actions:(0,F.jsxs)(n,{size:`sm`,disabled:v===`chk`,onClick:()=>void w(),variant:`outline`,children:[(0,F.jsx)(D,{className:r(`size-3.5`,v===`chk`&&`animate-spin`)}),`检查更新`]})}),(0,F.jsxs)(`div`,{className:`grid gap-3 px-5 py-4`,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-[96px_minmax(0,1fr)] items-baseline gap-3`,children:[(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`桌面壳版本`}),(0,F.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-sm font-medium text-foreground`,children:[q(o?.version),o?.installKind?(0,F.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,o.installKind,`)`]}):null,L?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(M,{tone:`warn`,children:[`可更新 `,q(o?.latest)]}),(0,F.jsxs)(n,{size:`chip`,disabled:v===`shupd`,onClick:()=>void k(),variant:`outline`,children:[(0,F.jsx)(D,{className:r(`size-3`,v===`shupd`&&`animate-spin`)}),`重启并更新`]})]}):null,R?(0,F.jsx)(M,{tone:`off`,children:`当前形态不支持自更新`}):null,o?.error?(0,F.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:o.error}):null]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-[96px_minmax(0,1fr)] items-baseline gap-3`,children:[(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`内核版本`}),(0,F.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-sm font-medium text-foreground`,children:[q(e?.installed||e?.version),I?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(M,{tone:`warn`,children:[`可更新 `,q(e?.latest)]}),W()?(0,F.jsxs)(n,{size:`chip`,disabled:v===`upd`,onClick:()=>void O(),variant:`outline`,children:[(0,F.jsx)(D,{className:r(`size-3`,v===`upd`&&`animate-spin`)}),`更新`]}):(0,F.jsx)(M,{tone:`off`,children:`请在桌面壳中更新`})]}):null]})]}),g?(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs leading-relaxed text-muted-foreground`,children:[(0,F.jsx)(D,{className:`size-3 shrink-0 animate-spin`}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:g.status||`桌面壳处理中…`}),typeof g.progress==`number`?(0,F.jsxs)(`span`,{className:`tabular-nums font-medium text-foreground`,children:[Math.round(g.progress*100),`%`]}):null]}):null,(0,F.jsx)(`p`,{className:`border-t border-border/60 pt-3 text-xs leading-relaxed text-muted-foreground`,children:K}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/60 pt-3`,children:[(0,F.jsx)(n,{size:`chip`,variant:`outline`,onClick:()=>void x(`dsh`),children:`DSH 更新日志`}),(0,F.jsx)(n,{size:`chip`,variant:`outline`,onClick:()=>void x(`guard`),children:`管家更新日志`})]})]}),(0,F.jsx)(C,{open:l,onOpenChange:u,children:(0,F.jsxs)(E,{className:`max-w-[560px]`,children:[(0,F.jsx)(T,{children:(0,F.jsx)(s,{children:d===`dsh`?`DeepSeek Harness 更新日志`:`管家更新日志`})}),(0,F.jsx)(`pre`,{className:`max-h-[50vh] overflow-auto whitespace-pre-wrap break-words rounded-md border border-border/60 bg-muted/30 p-3 text-xs leading-relaxed text-foreground`,children:m||`加载中…`})]})})]})}function Y(){return(0,F.jsxs)(`div`,{className:`grid content-start gap-4`,children:[(0,F.jsx)(I,{}),(0,F.jsx)(L,{}),(0,F.jsx)(J,{})]})}export{Y as SettingsPage};
|
|
1
|
+
import{C as e,F as t,I as n,L as r,M as i,O as a,R as o,S as s,T as c,U as l,V as u,_ as d,a as f,d as p,f as m,h,i as g,j as _,l as v,m as y,p as b,s as x,u as S,v as C,w,x as T,y as E}from"./supervisor-Dfq_YAmt.js";import{t as D}from"./refresh-cw-CFZGPyP6.js";import{c as O,l as k}from"./supervisor-Bg0C-67Q.js";import{t as A}from"./useSupervisorAction-DZSdzPif.js";import{n as j,o as M,t as N}from"./widgets-M2h3F-43.js";var P=l(u(),1),F=o();function I(){let[e,t]=(0,P.useState)(null),[r,i]=(0,P.useState)(null),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(``),[u,h]=(0,P.useState)(`hide`),{busy:_,run:y}=A(),C=(0,P.useCallback)(async()=>{let[e,n,r,a]=await Promise.all([f.autostart().catch(()=>null),f.lanPanel().catch(()=>null),f.accessKey().catch(()=>null),f.closeAction().catch(()=>null)]);e&&t(e.on),n&&i(n),r&&s(r),a&&h(a.closeAction)},[]);(0,P.useEffect)(()=>{C()},[C]);async function w(e){t(e);try{let n=await f.setAutostart(e);n.ok===!1?(a.error(n.error||`设置失败`),t(!e)):a.success(e?`已开启开机自启(整条服务链)`:`已关闭开机自启`)}catch(n){a.error(String(n)),t(!e)}}async function T(e){i(t=>t&&{...t,enabled:e});try{let t=await f.setLanPanel(e);if(t.ok===!1){a.error(t.error||`设置失败`),i(t=>t&&{...t,enabled:!e});return}i(t),a.success(e?`已开启局域网访问`:`已关闭局域网访问(仅本机)`)}catch(t){a.error(String(t)),i(t=>t&&{...t,enabled:!e})}}async function E(){let e=c.trim();if(e&&e.length<8){a.error(`访问密钥至少 8 位(建议 16+ 位随机串)`);return}await y(`akk`,()=>f.setAccessKey(e),{success:e?`访问密钥已设置`:`访问密钥已清除`,refresh:!1,onDone:()=>{l(``),C()}})&&g(e)}async function D(e){let t=e===`exit`?`exit`:`hide`;h(t),await y(`ca`,()=>f.setCloseAction(t),{success:t===`exit`?`已设为:关闭窗口时退出管家`:`已设为:关闭窗口时隐藏至托盘`,refresh:!1})}return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(N,{children:[(0,F.jsx)(j,{title:`启动`,subtitle:`开机行为与偏好`}),(0,F.jsxs)(`div`,{className:`grid gap-4 px-5 py-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-6`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`strong`,{className:`block text-sm font-medium text-foreground`,children:`开机自动启动管家`}),(0,F.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`开机登录后自动启动 DeepSeek Harness 管家(本程序)。不会自动启动任何单个实例——实例是否被自动拉起,由各自「进程监控」开关决定。`})]}),e===null?(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`…`}):(0,F.jsx)(`span`,{title:`开机自启`,children:(0,F.jsx)(x,{checked:e,onCheckedChange:e=>void w(e)})})]}),(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-6 border-t border-border/60 pt-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`strong`,{className:`block text-sm font-medium text-foreground`,children:`关闭窗口时`}),(0,F.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`隐藏至托盘:管家与服务继续在后台运行;退出管家:关闭并停止全部服务。`})]}),(0,F.jsxs)(v,{value:u,onValueChange:e=>void D(e),children:[(0,F.jsx)(m,{className:`w-[150px]`,children:(0,F.jsx)(b,{})}),(0,F.jsxs)(S,{children:[(0,F.jsx)(p,{value:`hide`,children:`隐藏至托盘`}),(0,F.jsx)(p,{value:`exit`,children:`退出管家`})]})]})]})]})]}),(0,F.jsxs)(N,{children:[(0,F.jsx)(j,{title:`访问`}),(0,F.jsxs)(`div`,{className:`grid gap-4 px-5 py-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-6`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`strong`,{className:`block text-sm font-medium text-foreground`,children:`管家局域网访问`}),r?r.enabled?(0,F.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[`开启后,局域网内设备可通过\xA0`,(r.urls??[]).map((e,t)=>(0,F.jsxs)(`span`,{children:[t>0?`、 `:null,(0,F.jsx)(`code`,{className:`rounded bg-muted px-1 py-px font-mono text-foreground`,children:e})]},e)),`\xA0访问本面板。`]}):(0,F.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`关闭后仅本机可访问,局域网设备不可用。`}):null]}),r===null?(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`…`}):(0,F.jsx)(`span`,{title:`局域网访问`,children:(0,F.jsx)(x,{checked:r.enabled,onCheckedChange:e=>void T(e)})})]}),(0,F.jsx)(`div`,{className:`flex items-start justify-between gap-6 border-t border-border/60 pt-4`,children:(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`strong`,{className:`block text-sm font-medium text-foreground`,children:`访问密钥`}),(0,F.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[`局域网或公网访问本面板需携带此密钥;本机访问不受影响。留空保存可清除。`,o?.configured?(0,F.jsx)(`span`,{className:`mt-1 block text-status-ok`,children:`当前:已设置`}):(0,F.jsx)(`span`,{className:`mt-1 block text-muted-foreground`,children:`当前:未设置`})]})]})}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(d,{type:`password`,autoComplete:`new-password`,placeholder:`输入 ≥8 位访问密钥(建议随机长串)`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&E()},className:`flex-1`}),(0,F.jsx)(n,{variant:`outline`,onClick:()=>l(``),disabled:!c&&!o?.configured,children:`清除`}),(0,F.jsx)(n,{disabled:_===`akk`,onClick:()=>void E(),children:o?.configured?`更新密钥`:`设置密钥`})]})]})]})]})}function L(){let[t,o]=(0,P.useState)(null),[s,l]=(0,P.useState)(`auto`),[u,p]=(0,P.useState)([]),[m,g]=(0,P.useState)(``),[v,b]=(0,P.useState)(``),[x,S]=(0,P.useState)(!1),C=(0,P.useRef)(null),{busy:T,run:E}=A();(0,P.useEffect)(()=>{if(!x||!C.current)return;let e=window.setTimeout(()=>{let e=C.current;e&&e.scrollIntoView({block:`start`,behavior:`smooth`})},320);return()=>window.clearTimeout(e)},[x]);let I=(0,P.useCallback)(async()=>{let e=await f.registry().catch(()=>null);o(e)},[]);(0,P.useEffect)(()=>{I()},[I]),(0,P.useEffect)(()=>{t&&(l(t.mode||`auto`),p((t.candidates??[]).map(e=>e.origin)),g(t.manualOrigin||``))},[t]);let L=()=>{let e=v.trim();if(!/^https?:\/\//.test(e)){a.error(`请输入合法的镜像 URL`);return}if(u.includes(e)){a.info(`已在列表中`);return}p(t=>[...t,e]),b(``)};async function z(){let e={mode:s,origins:u};if(s===`manual`){if(!/^https?:\/\//.test(m.trim())){a.error(`手动模式需提供合法镜像 URL`);return}e.manualOrigin=m.trim()}await E(`reg`,()=>f.registrySet(e),{success:`已保存镜像配置`,refresh:!1,onDone:()=>void I()})}async function B(){await E(`regr`,()=>f.registryRefresh(),{success:`已探测镜像`,refresh:!1,onDone:()=>void I()})}let V=e=>{let n=(t?.probes??[]).find(t=>t.origin===e);return n&&n.ok?n.latencyMs:null},H=e=>{let n=(t?.registries??[]).find(t=>t.base===e);if(n&&!n.usable)return`形态非法:`+(n.violation||`未知`);let r=(t?.probes??[]).find(t=>t.origin===e);return r&&!r.ok?`不可达:`+(r.error||`未知`):`未探测`};return(0,F.jsxs)(N,{children:[(0,F.jsx)(j,{title:`镜像源`,subtitle:`npm 拉取 / 更新检测共用此源`}),(0,F.jsxs)(`div`,{className:`grid gap-3 px-5 py-4`,children:[(0,F.jsxs)(y,{value:s,onValueChange:e=>l(e),className:`flex gap-3`,children:[(0,F.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1.5 text-sm`,children:[(0,F.jsx)(h,{value:`auto`,id:`reg-auto`}),(0,F.jsx)(`span`,{children:`自动(按延迟选最快)`})]}),(0,F.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1.5 text-sm`,children:[(0,F.jsx)(h,{value:`manual`,id:`reg-manual`}),(0,F.jsx)(`span`,{children:`手动(固定指定)`})]})]}),s===`manual`?(0,F.jsx)(`div`,{className:`grid gap-1.5`,children:(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(d,{placeholder:`https://registry.npmmirror.com`,value:m,onChange:e=>g(e.target.value),className:`flex-1`}),(0,F.jsx)(n,{variant:`outline`,onClick:()=>void R(m),children:`测试`})]})}):null,(0,F.jsxs)(e,{open:x,onOpenChange:S,className:`grid gap-1`,children:[(0,F.jsxs)(c,{ref:C,children:[(0,F.jsxs)(`span`,{className:`text-xs font-medium text-foreground`,children:[`候选镜像列表(`,u.length,`)`]}),x?(0,F.jsx)(_,{className:`size-3.5 text-muted-foreground`}):(0,F.jsx)(i,{className:`size-3.5 text-muted-foreground`})]}),x?null:(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-md border border-border/70 px-3 py-1.5`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(M,{tone:`ok`,children:`当前`}),(0,F.jsx)(`code`,{className:`truncate font-mono text-xs text-muted-foreground`,children:t?.origin||`未选择`})]}),t?.origin&&V(t.origin)!=null?(0,F.jsxs)(`span`,{className:`shrink-0 text-xs font-medium tabular-nums`,children:[V(t.origin),`ms`]}):null]}),(0,F.jsx)(w,{children:(0,F.jsx)(`div`,{className:`rounded-md border border-border/70`,children:u.map((e,r)=>(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border/50 px-3 py-1.5 last:border-b-0`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[t?.origin===e?(0,F.jsx)(M,{tone:`ok`,children:`当前`}):null,(0,F.jsx)(`code`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e})]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[V(e)==null?(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground/50`,title:H(e),children:`—`}):(0,F.jsxs)(`span`,{className:`text-xs font-medium tabular-nums`,title:`延迟毫秒数(自动探测)`,children:[V(e),(0,F.jsx)(`span`,{className:`text-muted-foreground/60`,children:`ms`})]}),(0,F.jsx)(n,{size:`chip`,variant:`ghost`,onClick:()=>p(t=>t.filter(t=>t!==e)),title:`移除该候选镜像`,children:(0,F.jsx)(O,{className:`size-3.5 text-destructive`})})]})]},r))})})]}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(d,{placeholder:`https://… 添加自定义镜像`,value:v,onChange:e=>b(e.target.value),className:`flex-1`,onKeyDown:e=>{e.key===`Enter`&&L()}}),(0,F.jsxs)(n,{variant:`outline`,onClick:L,children:[(0,F.jsx)(k,{className:`size-4`}),`添加`]})]}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsxs)(n,{size:`sm`,disabled:T===`regr`,onClick:()=>void B(),variant:`outline`,children:[(0,F.jsx)(D,{className:r(`size-3.5`,T===`regr`&&`animate-spin`)}),`重新探测`]}),(0,F.jsx)(n,{disabled:T===`reg`,onClick:()=>void z(),children:`保存`})]})]})]})}async function R(e){if(!/^https?:\/\//.test(e)){a.error(`请输入合法镜像 URL`);return}a.info(`测试中…`);try{let t=await f.registryProbe(e.replace(/\/+$/,``));t&&t.ok===!0&&typeof t.latencyMs==`number`?a.success(`可达,延迟 `+t.latencyMs+` ms`):t&&typeof t.error==`string`&&t.error?a.error(`探测失败:`+t.error):a.error(`不可达`)}catch(e){a.error(`探测失败:`+(e instanceof Error?e.message:String(e)))}}var z=`lobox:kernel-update-request`,B=`lobox:kernel-update-result`,V=`lobox:kernel-update-progress`,H=12e5;function U(e){return new Promise(t=>{if(!W()){t({ok:!1,error:`内核更新由桌面壳执行:请在桌面壳面板中操作。`});return}let n=`kupd-`+Date.now()+`-`+Math.random().toString(36).slice(2,8),r=Date.now(),i=!1,a=null,o=setTimeout(s,H);function s(){l(a?{ok:!1,error:`桌面壳无响应(更新请求超时;最后一次进度:`+a+`)`}:{ok:!1,error:`桌面壳无响应(更新请求超时)`})}let c=e=>{clearTimeout(o),o=setTimeout(s,Math.max(0,e))},l=e=>{i||(i=!0,window.removeEventListener(`message`,u),clearTimeout(o),t(e))},u=t=>{let i=t.data;if(!(!i||typeof i!=`object`)&&t.source===window.parent&&i.v===2&&(i.type===B||i.type===V)&&i.requestId===n){if(i.type===V){let t=typeof i.status==`string`&&i.status?i.status:null;t&&(a=t),e?.({stage:typeof i.stage==`string`?i.stage:null,status:t,progress:typeof i.progress==`number`?i.progress:null});let n=typeof i.maxWaitMs==`number`?i.maxWaitMs:0;n>0&&c(n-(Date.now()-r));return}l({ok:i.ok===!0,stage:i.stage??null,version:i.version??null,restartUncertain:i.restartUncertain===!0,error:i.error??null})}};window.addEventListener(`message`,u);try{window.parent.postMessage({v:2,type:z,requestId:n},`*`)}catch(e){l({ok:!1,error:String(e)})}})}function W(){try{return window.parent!==window}catch{return!1}}var G=`DeepSeek Harness 管家`,K=`独立于 Harness 运行的系统级守卫:负责启动、存活监测与故障自动重启被监管目标,提供生命周期管理、智能路由、远程控制与多实例沙箱的运维面板。`,q=e=>e?String(e).replace(/^v/i,``):`—`;function J(){let[e,i]=(0,P.useState)(null),[o,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(!1),[d,p]=(0,P.useState)(`dsh`),[m,h]=(0,P.useState)(``),[g,_]=(0,P.useState)(null),{busy:v,run:y}=A(),b=t(),x=(0,P.useCallback)(async e=>{p(e),h(``),u(!0);try{let t=e===`dsh`?await f.dshChangelog():await f.guardChangelog();h(t||`(无内容)`)}catch(e){h(`加载失败:`+String(e))}},[]),S=(0,P.useCallback)(async()=>{let[e,t]=await Promise.all([f.guardVersion().catch(()=>null),f.shellStatus().catch(()=>null)]);i(e||{}),c(t?{version:t.identity?.version||null,capable:t.identity?.selfUpdateCapable===!0,installKind:t.identity?.installKind}:{})},[]);(0,P.useEffect)(()=>{S()},[S]),(0,P.useEffect)(()=>{let e=!0;return(async()=>{let[t,n]=await Promise.all([f.selfUpdateStatus().catch(()=>null),f.shellCheckUpdate().catch(()=>null)]);e&&(t&&t.ok!==!1&&i(e=>({...e||{},...t})),n&&c(e=>({...e||{},latest:n.latest||null,updateAvailable:n.updateAvailable===!0,error:n.error||null})))})(),()=>{e=!1}},[]);let w=async()=>{await y(`chk`,async()=>{let e=`内核:状态未知`,t=await f.selfUpdateStatus().catch(()=>null);if(t&&t.ok!==!1)i(t||{}),e=t.updateAvailable&&t.latest?`内核有新版本 `+q(t.latest)+`(当前 `+q(t.installed)+`)`:`内核已是最新(`+q(t.installed)+`)`;else{let n=await f.guardVersion().catch(()=>null);if(n?.upstream===`git-repo`){let t=await f.guardVersionCheck().catch(()=>null);i({...n||{},...t||{}}),e=t?.updateAvailable?`内核源码仓库有上游更新(当前提交 `+(t.commit||n?.commit||`—`)+`)`:`内核源码仓库已是最新(提交 `+(n?.commit||t?.commit||`—`)+`)`}else e=`内核:`+(t&&t.error||`自更新未配置`)}let n=await f.shellCheckUpdate().catch(()=>null),r=`桌面壳:状态未知`;n&&n.ok!==!1?(c(e=>({...e||{},latest:n.latest||null,updateAvailable:n.updateAvailable===!0,error:null})),r=n.updateAvailable&&n.latest?`桌面壳有新版本 `+q(n.latest)+`(当前 `+q(n.installed)+`)`:`桌面壳已是最新(`+q(n.installed)+`)`):(c(e=>({...e||{},error:n&&n.error||`检测失败`})),r=`桌面壳:`+(n&&n.error||`检测失败`)),t?.updateAvailable&&t?.latest||n?.updateAvailable&&n?.latest?a.warning(e+`;`+r):a.success(e+`;`+r)},{refresh:!1})},O=async()=>{if(!W()){a.error(`内核更新由桌面壳执行:请在桌面壳面板中操作。`);return}await b({title:`发现内核新版本 `+q(e?.latest)+`,是否立即更新?`,description:`内核将由桌面壳安装,并自动重启守卫。`,confirmText:`更新`})&&await y(`upd`,async()=>{_({status:`已向桌面壳发出更新请求,等待响应…`});let t=await U(_);if(!t.ok){a.error(t.error||`更新失败`);return}let n=q(t.version||e?.latest);t.restartUncertain?a.warning(`内核已更新至 `+n+`,但守卫可能未自动重启,请手动确认。`):a.success(`内核已更新至 `+n+`,守卫已重启。`)},{refresh:!0,onDone:()=>_(null)})},k=async()=>{await b({title:`将重启桌面壳以应用更新 `+q(o?.latest)+`,是否继续?`,description:`桌面壳窗口会关闭并重新打开;内核与被管实例不受影响。`,confirmText:`重启桌面壳`})&&await y(`shupd`,async()=>{let e=await f.shellRestart();if(e?.ok===!1){a.error(e.error||`重启桌面壳失败`);return}a.success(`桌面壳正在重启,将在启动时自动更新至 `+q(o?.latest))},{refresh:!1})},I=!!(e?.updateAvailable&&e?.latest&&e.latest!==e?.installed),L=!!(o?.updateAvailable&&o?.latest&&o.latest!==o?.version),R=o?.capable===!1;return(0,F.jsxs)(N,{children:[(0,F.jsx)(j,{title:`关于`,subtitle:G,actions:(0,F.jsxs)(n,{size:`sm`,disabled:v===`chk`,onClick:()=>void w(),variant:`outline`,children:[(0,F.jsx)(D,{className:r(`size-3.5`,v===`chk`&&`animate-spin`)}),`检查更新`]})}),(0,F.jsxs)(`div`,{className:`grid gap-3 px-5 py-4`,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-[96px_minmax(0,1fr)] items-baseline gap-3`,children:[(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`桌面壳版本`}),(0,F.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-sm font-medium text-foreground`,children:[q(o?.version),o?.installKind?(0,F.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,o.installKind,`)`]}):null,L?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(M,{tone:`warn`,children:[`可更新 `,q(o?.latest)]}),(0,F.jsxs)(n,{size:`chip`,disabled:v===`shupd`,onClick:()=>void k(),variant:`outline`,children:[(0,F.jsx)(D,{className:r(`size-3`,v===`shupd`&&`animate-spin`)}),`重启并更新`]})]}):null,R?(0,F.jsx)(M,{tone:`off`,children:`当前形态不支持自更新`}):null,o?.error?(0,F.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:o.error}):null]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-[96px_minmax(0,1fr)] items-baseline gap-3`,children:[(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`内核版本`}),(0,F.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-sm font-medium text-foreground`,children:[q(e?.installed||e?.version),I?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(M,{tone:`warn`,children:[`可更新 `,q(e?.latest)]}),W()?(0,F.jsxs)(n,{size:`chip`,disabled:v===`upd`,onClick:()=>void O(),variant:`outline`,children:[(0,F.jsx)(D,{className:r(`size-3`,v===`upd`&&`animate-spin`)}),`更新`]}):(0,F.jsx)(M,{tone:`off`,children:`请在桌面壳中更新`})]}):null]})]}),g?(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs leading-relaxed text-muted-foreground`,children:[(0,F.jsx)(D,{className:`size-3 shrink-0 animate-spin`}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:g.status||`桌面壳处理中…`}),typeof g.progress==`number`?(0,F.jsxs)(`span`,{className:`tabular-nums font-medium text-foreground`,children:[Math.round(g.progress*100),`%`]}):null]}):null,(0,F.jsx)(`p`,{className:`border-t border-border/60 pt-3 text-xs leading-relaxed text-muted-foreground`,children:K}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/60 pt-3`,children:[(0,F.jsx)(n,{size:`chip`,variant:`outline`,onClick:()=>void x(`dsh`),children:`DSH 更新日志`}),(0,F.jsx)(n,{size:`chip`,variant:`outline`,onClick:()=>void x(`guard`),children:`管家更新日志`})]})]}),(0,F.jsx)(C,{open:l,onOpenChange:u,children:(0,F.jsxs)(E,{className:`max-w-[560px]`,children:[(0,F.jsx)(T,{children:(0,F.jsx)(s,{children:d===`dsh`?`DeepSeek Harness 更新日志`:`管家更新日志`})}),(0,F.jsx)(`pre`,{className:`max-h-[50vh] overflow-auto whitespace-pre-wrap break-words rounded-md border border-border/60 bg-muted/30 p-3 text-xs leading-relaxed text-foreground`,children:m||`加载中…`})]})})]})}function Y(){return(0,F.jsxs)(`div`,{className:`grid content-start gap-4`,children:[(0,F.jsx)(I,{}),(0,F.jsx)(L,{}),(0,F.jsx)(J,{})]})}export{Y as SettingsPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I as e,L as t,O as n,R as r,U as i,V as a,a as o}from"./supervisor-Dfq_YAmt.js";import{t as s}from"./refresh-cw-CFZGPyP6.js";import{a as c,d as l,i as u,r as d}from"./supervisor-
|
|
1
|
+
import{I as e,L as t,O as n,R as r,U as i,V as a,a as o}from"./supervisor-Dfq_YAmt.js";import{t as s}from"./refresh-cw-CFZGPyP6.js";import{a as c,d as l,i as u,r as d}from"./supervisor-Bg0C-67Q.js";import{o as f,t as p}from"./widgets-M2h3F-43.js";import{r as m}from"./format-QeaTKFhQ.js";var h=i(a(),1),g=r();function _(){let[r,i]=(0,h.useState)(null),[a,_]=(0,h.useState)(!1),[v,y]=(0,h.useState)(``);async function b(){try{let e=await o.tasks();i(e.tasks)}catch(e){n.error(String(e))}}(0,h.useEffect)(()=>{b()},[]);async function x(){_(!0);try{await b(),n.success(`任务中心已刷新`)}catch{}finally{_(!1)}}let S=[`native`,`instance`,`plugin`,`proxy-app`],C=(r??[]).filter(e=>!v||e.kind===v);return(0,g.jsxs)(`div`,{className:`grid content-start gap-4`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,g.jsx)(e,{className:t(v?`text-muted-foreground hover:bg-muted hover:text-foreground`:`bg-primary/10 text-primary hover:bg-primary/15`),onClick:()=>y(``),size:`sm`,variant:`ghost`,children:`全部`}),S.map(n=>(0,g.jsx)(e,{className:t(v===n?`bg-primary/10 text-primary hover:bg-primary/15`:`text-muted-foreground hover:bg-muted hover:text-foreground`),onClick:()=>y(n),size:`sm`,variant:`ghost`,children:u[n]||n},n))]}),(0,g.jsxs)(e,{onClick:()=>void x(),variant:`outline`,children:[(0,g.jsx)(s,{className:t(`size-4`,a&&`animate-spin`)}),`刷新`]})]}),r?C.length?(0,g.jsx)(`div`,{className:`grid gap-3`,children:C.map(e=>{let n=c[e.state]||{label:e.state,tone:`off`},r=e.from&&e.to&&e.from!==e.to?e.from+` → `+e.to:e.to?`→ `+e.to:``,i=e.steps||[];return(0,g.jsxs)(p,{className:`p-4`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,g.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:u[e.kind]||e.kind}),(0,g.jsx)(f,{tone:`boot`,children:d[e.action]||e.action}),(0,g.jsx)(`strong`,{className:`truncate text-sm text-foreground`,children:e.target.name}),r?(0,g.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:r}):null]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,g.jsx)(f,{tone:n.tone,children:n.label}),(0,g.jsxs)(`span`,{className:`whitespace-nowrap`,children:[m(e.startedAt),e.finishedAt?` ~ `+m(e.finishedAt):``]})]})]}),e.error?(0,g.jsx)(`p`,{className:`mt-2 truncate text-xs text-destructive`,title:e.error,children:e.error}):null,i.length?(0,g.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:i.map((e,n)=>(0,g.jsxs)(`span`,{className:t(`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-xs leading-tight`,e.state===`done`&&`bg-success-background text-success`,e.state===`running`&&`bg-primary/10 text-primary`,e.state===`failed`&&`bg-careful-background text-careful`,(!e.state||e.state===`pending`)&&`bg-muted text-muted-foreground`),children:[e.state===`running`?(0,g.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-primary`}):null,e.name]},n))}):null,e.logTail?.length?(0,g.jsxs)(`details`,{className:`mt-3`,children:[(0,g.jsxs)(`summary`,{className:`cursor-pointer text-xs text-muted-foreground hover:text-foreground`,children:[`日志(`,e.logTail.length,`)`]}),(0,g.jsx)(`pre`,{className:`mt-2 max-h-[180px] overflow-auto whitespace-pre-wrap break-all rounded-md bg-muted/70 p-3 font-mono text-xs leading-relaxed text-muted-foreground`,children:e.logTail.join(`
|
|
2
2
|
`)})]}):null]},e.id)})}):(0,g.jsxs)(`div`,{className:`grid place-items-center rounded-lg border border-dashed border-border py-16 text-center`,children:[(0,g.jsx)(l,{className:`mx-auto mb-3 size-8 text-muted-foreground`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`暂无任务记录。安装 / 升级 / 卸载 / 更新操作完成后会在此显示状态与历史。`})]}):(0,g.jsx)(`div`,{className:`grid place-items-center py-16 text-sm text-muted-foreground`,children:`加载中…`})]})}export{_ as TasksPage};
|