@lob-ox/core-darwin-x64 0.0.17 → 0.0.19
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 +21168 -21610
- package/package.json +1 -1
- package/ui-react/assets/InstancesPage-p4wXb1ax.js +3 -0
- package/ui-react/assets/{OverviewPage-BVNv_we9.js → OverviewPage-Db0jblYm.js} +1 -1
- package/ui-react/assets/{PluginsPage-CB9vP3Zw.js → PluginsPage-CZzJb7Io.js} +1 -1
- package/ui-react/assets/{RouterPage-DhiSp8tn.js → RouterPage-BoApjMyy.js} +1 -1
- package/ui-react/assets/{SettingsPage-CFxjRGSS.js → SettingsPage-roII_vHR.js} +1 -1
- package/ui-react/assets/{TasksPage-C4MaW5ZN.js → TasksPage-BynVo5ge.js} +1 -1
- package/ui-react/assets/{supervisor-BASdnb70.js → supervisor-C0cZTc5d.js} +2 -2
- package/ui-react/supervisor.html +1 -1
- package/ui-react/assets/InstancesPage-BfUNgbrz.js +0 -3
package/ui-react/supervisor.html
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
html, body, #root { width: 100%; height: 100%; height: 100dvh; }
|
|
17
17
|
body { margin: 0; min-width: 320px; min-height: 100vh; min-height: 100dvh; overflow: hidden; background: transparent; }
|
|
18
18
|
</style>
|
|
19
|
-
<script type="module" crossorigin src="/assets/supervisor-
|
|
19
|
+
<script type="module" crossorigin src="/assets/supervisor-C0cZTc5d.js"></script>
|
|
20
20
|
<link rel="modulepreload" crossorigin href="/assets/supervisor-Blfqgw-f.js">
|
|
21
21
|
<link rel="stylesheet" crossorigin href="/assets/supervisor-hG2-v7mV.css">
|
|
22
22
|
<link rel="stylesheet" crossorigin href="/assets/supervisor-D4l-mJqH.css">
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{F as e,I as t,L as n,N as r,O as i,R as a,S as o,U as s,V as c,_ as l,a as u,b as d,c as f,g as p,k as m,n as h,o as g,t as _,v,x as y,y as b}from"./supervisor-Blfqgw-f.js";import{n as x,o as S}from"./openExternal-BL2ow_UN.js";import{n as C,t as w}from"./rocket-OqsLWeGD.js";import{t as ee}from"./shield-check-DdG3gN1L.js";import{c as T,f as E,o as D,s as te}from"./supervisor-BASdnb70.js";import{t as O}from"./useSupervisorAction-DUxfx47b.js";import{c as k,i as A,o as j,r as M,t as N}from"./widgets-C9CEOdGF.js";var ne=r(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),P=r(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),F=r(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),I=s(c(),1),L=a();function R({onRegisterActions:r}){let{snap:a}=_(),{busy:s,run:c}=O(),R=e(),[z,B]=(0,I.useState)(!1),[V,H]=(0,I.useState)(``),[U,W]=(0,I.useState)(``),[G,K]=(0,I.useState)(``),q=a.instances?.instances??[],[J,Y]=(0,I.useState)(null);(0,I.useEffect)(()=>{let e=!0;return u.envStatus().then(t=>{e&&Y(t.capabilities??null)}).catch(()=>void 0),()=>{e=!1}},[]);let X=J!==null&&J.sandboxLaunch===!1,Z=J?.sandboxEnforcement===`supervise`,Q=J==null?null:J.sandboxEnforcement===`cgroup`?`cgroup 内核硬限`:Z?`采样式软限(超限由守卫按拍数收割重启,非内核级强制)`:`无内核级限额`;(0,I.useEffect)(()=>(r?.({onAdd:()=>B(!0)}),()=>r?.(null)),[r]);let $=(e,t)=>c(e,t),re=e=>c(e,()=>x(()=>u.instanceOpenWeb(e)).then(()=>void 0));async function ie(){if(X){i.error(`当前平台不支持沙箱实例(见 /env/status 能力矩阵)`);return}let e=parseInt(U,10);if(!Number.isFinite(e)||e<=0){i.error(`请填写有效端口`);return}let t=G?G.split(/\n/).map(e=>e.trim()).filter(Boolean):[];try{let n=await u.instanceAdd({name:V.trim()||`沙箱 `+e,port:e,command:t});if(n&&n.ok===!1){i.error(n.error||`添加失败`);return}i.success(`已添加实例`),B(!1),H(``),W(``),K(``),h.refresh()}catch(e){i.error(String(e))}}async function ae(e){await c(e.id,async()=>{let t=await u.instanceCheckUpdate(e.id);t.updateAvailable?(i.success(`发现新版 `+t.latest+`,可点「更新」升级`),se(t=>new Map(t).set(e.id,!0))):t.latest?i.info(`已是最新 `+t.latest):i.error(t.error||`版本检测失败`)})}let[oe,se]=(0,I.useState)(new Map);async function ce(e){await R({title:`升级该沙箱实例的 DSH 到最新版?`,description:`实例会短暂重启,进行中的请求中断。`,confirmText:`升级`})&&await c(e.id,()=>u.instanceUpgrade(e.id),{success:`升级已开始…`})}async function le(e){await R({title:`删除实例「`+e.name+`」?`,description:`将彻底删除该沙箱实例(含配置与运行时数据)。此操作不可恢复。`,confirmText:`删除实例`,tone:`destructive`})&&await c(e.id,async()=>{let t=await u.instanceRemove(e.id);t&&t.ok!==!1&&t.dataPreserved===!0?i.warning(`实例已移除,但因其单元仍在运行,数据目录已保留(未删除)——请先停止实例再删数据`):t&&t.ok===!1&&i.error(t.error||`删除失败`),h.refresh()})}let ue=({it:e})=>{let r=e.state?.running??!1,i=e.state?.lifecyclePhase,a=te(i,r),o=e.updateJob,c=o?.state===`running`,l=e.state?.allocation?.memoryMax||`—`,d=e.state?.allocation?.cpuQuota||`—`,p=e.state?.usage,h=p&&typeof p.memMb==`number`?p.memMb:null,g=p&&typeof p.cpuPct==`number`?p.cpuPct:null,_=s===e.id;return(0,L.jsxs)(N,{className:`overflow-visible`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 @min-[720px]:grid-cols-[minmax(0,5fr)_minmax(0,6fr)]`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-border px-6 py-5 md:border-b-0 md:border-r`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,L.jsx)(`strong`,{className:`truncate text-lg font-semibold tracking-[-0.01em] text-foreground`,children:e.name}),e.version?(0,L.jsxs)(`span`,{className:`font-mono text-sm text-muted-foreground`,children:[`v`,e.version]}):null]}),oe.get(e.id)?(0,L.jsxs)(t,{className:`text-primary-foreground`,onClick:()=>void ce(e),size:`chip`,children:[(0,L.jsx)(P,{className:`size-3`}),`更新`]}):(0,L.jsxs)(t,{className:`bg-primary/10 text-primary hover:bg-primary/15`,disabled:_||c,onClick:()=>void ae(e),size:`chip`,variant:`ghost`,children:[(0,L.jsx)(P,{className:n(`size-3`,_&&`animate-spin`)}),`检测更新`]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(k,{tone:a.tone,ping:a.tone===`ok`}),(0,L.jsx)(`span`,{className:`text-base font-semibold leading-none text-foreground`,children:a.label})]}),c?(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,L.jsx)(f,{className:`size-3`}),`正在升级 DeepSeek Harness(`,o?.step||``,`)…`]}):null,e.state?.installing?(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,L.jsx)(f,{className:`size-3`}),`正在安装…`]}):null,i===`FAILED`?(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-destructive`,children:[(0,L.jsx)(m,{className:`size-3.5`}),(0,L.jsx)(`span`,{className:`truncate`,children:e.state?.lastError||e.state?.installError||`启动反复失败,已停止自动重启,可手动重试`})]}):null]}),(0,L.jsx)(`div`,{className:`flex items-center bg-[image:var(--panel-accent-gradient)] px-6 py-5`,children:(0,L.jsxs)(`div`,{className:`grid w-full grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-4`,children:[(0,L.jsx)(A,{icon:(0,L.jsx)(E,{className:`size-4`}),label:`端口`,value:String(e.port),mono:!0}),(0,L.jsx)(A,{icon:(0,L.jsx)(F,{className:`size-4`}),label:`PID`,value:e.state?.pid?String(e.state.pid):`—`,mono:!0}),(0,L.jsx)(A,{icon:(0,L.jsx)(P,{className:`size-4`}),label:`重启次数`,value:String(e.state?.restartCount??0),mono:!0}),(0,L.jsx)(A,{icon:(0,L.jsx)(m,{className:`size-4`}),label:`最近故障`,value:e.state?.lastFailure?D(e.state.lastFailure):`无`,warn:!!e.state?.lastFailure})]})})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-border/60 px-6 py-3`,children:[(0,L.jsxs)(`span`,{className:`hidden min-w-0 items-center lg:inline-flex gap-2 text-xs text-muted-foreground`,children:[(0,L.jsx)(M,{domain:`sandbox`}),(0,L.jsx)(j,{tone:e.remoteMode&&e.remoteMode!==`off`?`boot`:`off`,children:e.remoteMode===`wan`?`远程·公网`:e.remoteMode===`lan`?`远程·局域网`:`远程关闭`}),(0,L.jsxs)(`span`,{className:`whitespace-nowrap`,title:`配额由守卫按机器预算与活跃实例数动态推导`+(Q?`;执行档位:`+Q:``),children:[`配额 内存 `,l,` · CPU `,d,Z?`(软限)`:``]}),h===null&&g===null?null:(0,L.jsxs)(`span`,{className:`whitespace-nowrap`,title:`监督拍实测值(最近一次采样;停止或未采到不显示)`,children:[`占用 `,h===null?`—`:`${h}MB`,g===null?``:` · CPU ${Math.round(g)}%`]})]}),(0,L.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(t,{disabled:!r,onClick:()=>void re(e.id),size:`sm`,title:`打开 DSH Web(自动带认证连接)`,variant:`outline`,className:`hidden md:inline-flex`,children:[(0,L.jsx)(S,{className:`size-4`}),`DSH Web`]}),(0,L.jsx)(t,{disabled:c,onClick:()=>void $(e.id,()=>r?u.instanceStop(e.id):u.instanceStart(e.id)),size:`sm`,variant:`outline`,children:r?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(C,{className:`size-4 text-status-error`}),`停止实例`]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(w,{className:`size-4 text-primary`}),`启动实例`]})}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-5 w-px bg-border`}),(0,L.jsxs)(t,{disabled:_,onClick:()=>void $(e.id,()=>u.instanceUpdate(e.id,{guardian:!e.guardian})),size:`sm`,variant:`outline`,children:[(0,L.jsx)(ee,{className:n(`size-4`,e.guardian?`text-status-ok`:`text-muted-foreground`)}),e.guardian?`停止监控`:`启动监控`]}),(0,L.jsxs)(t,{className:`hidden h-[30px] md:inline-flex`,disabled:_,onClick:()=>void le(e),size:`sm`,variant:`destructive`,children:[(0,L.jsx)(T,{className:`size-4`}),`删除`]})]})]})]})};return(0,L.jsxs)(`div`,{className:`grid content-start gap-4`,children:[X?(0,L.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(m,{className:`mt-0.5 size-3.5 shrink-0 text-amber-500`}),(0,L.jsxs)(`span`,{children:[`当前平台(`,J?.platform||`未知`,`)不支持沙箱实例(能力矩阵见 /env/status 的 capabilities.sandboxLaunch;限额执行档位见 capabilities.sandboxEnforcement)。 原生 DSH 主实例不受影响。`]})]}):null,q.length?(0,L.jsx)(`div`,{className:`grid gap-3`,children:q.map(e=>(0,L.jsx)(ue,{it:e},e.id))}):(0,L.jsx)(`div`,{className:`grid min-h-[220px] place-items-center rounded-lg border border-dashed border-border text-center`,children:(0,L.jsxs)(`div`,{children:[(0,L.jsx)(ne,{className:`mx-auto mb-3 size-8 text-muted-foreground`}),(0,L.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`尚未添加沙箱实例`}),(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:X?`当前平台不支持沙箱实例(见上方说明)`:`点击顶部「添加实例」创建沙箱`})]})}),(0,L.jsx)(v,{open:z,onOpenChange:B,children:(0,L.jsxs)(b,{className:`max-w-[440px]`,children:[(0,L.jsx)(y,{children:(0,L.jsx)(o,{children:`添加 DSH 实例`})}),(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,L.jsx)(p,{children:`实例名称`}),(0,L.jsx)(l,{placeholder:`如 沙箱二开`,value:V,onChange:e=>H(e.target.value)})]}),(0,L.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,L.jsx)(p,{children:`监听端口`}),(0,L.jsx)(l,{inputMode:`numeric`,placeholder:`如 3082`,value:U,onChange:e=>W(e.target.value)})]}),(0,L.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,L.jsx)(p,{children:`启动命令(每项一参数,可留空用默认)`}),(0,L.jsx)(g,{className:`min-h-[72px] font-mono text-sm`,placeholder:`node
|
|
2
|
-
/usr/local/bin/dsh
|
|
3
|
-
web`,value:G,onChange:e=>K(e.target.value)})]}),(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`内存/CPU 配额无需填写:启动时由守卫按机器预算与活跃实例数自动推导,实例增减后动态重分配。`,Q?` 执行档位:${Q}。`:``]})]}),(0,L.jsxs)(d,{children:[(0,L.jsx)(t,{onClick:()=>B(!1),variant:`outline`,children:`取消`}),(0,L.jsx)(t,{onClick:()=>void ie(),children:`添加`})]})]})})]})}export{R as InstancesPage};
|