import{c as f,i as T,j as y}from"./index-DHt40zKj-aster.js";import{P as z}from"./PageTour-CdU2AnnI-aster.js";import{_ as p}from"./PixelSection.vue_vue_type_script_setup_true_lang-BFSQ9vuX-aster.js";import{B as C,g as I,f as N}from"./vendor-ui-SnQwDthD-aster.js";import{p as S}from"./vendor-icons-B2dQ8Ycb-aster.js";import{k as D,o as F,_ as r,Z as s,Y as l,X as i,N as o,W as L,a1 as P,r as n,j as g,$ as a,F as V,R as B,V as d}from"./vendor-vue-Dqr9UV61-aster.js";import{_ as $}from"./_plugin-vue_export-helper-DlAUqK2U-aster.js";import"./vendor-DWmN2shr-aster.js";const A={class:"page"},U={class:"toolbar","data-tour":"dashboard-actions"},W={class:"toolbar-actions"},E={class:"grid two embedded-grid"},H={class:"metric"},M={class:"metric-value"},O={class:"metric"},X={class:"metric-value"},Y={class:"metric"},Z={class:"metric-value"},q={class:"metric"},G={class:"metric-value"},J={key:0,class:"muted"},K={key:1,class:"mini-list"},Q={key:0,class:"muted"},j={key:1,class:"mini-list"},ss={class:"error-box"},ts=D({__name:"DashboardView",setup(es){const u=n(!1),c=n([]),k=n([]),w=n([]),m=n([]),v=n(""),h=n(!1),R=[{target:'[data-tour="dashboard-actions"]',title:"刷新运行状态",text:"总览页会同时拉取调度、技能、会话和网关状态。遇到状态滞后时，先点这里刷新。"},{target:'[data-tour="dashboard-metrics"]',title:"查看核心计数",text:"这里用最少信息展示当前系统规模，适合快速判断本地 CLI 和 Web UI 是否连通。"},{target:'[data-tour="dashboard-schedule"]',title:"最近调度",text:"最近调度会展示即将执行的任务，便于确认提醒、定时任务是否已经进入队列。"},{target:'[data-tour="dashboard-gateways"]',title:"网关状态",text:"这里能看到飞书等外部入口的运行状态，启动或配置仍在网关页面完成。"}];async function x(){u.value=!0,v.value="";try{const[_,t,e,b]=await Promise.all([f.schedule(),f.skills(),f.sessions(),f.gatewayStatus()]);c.value=_,k.value=t,w.value=e,m.value=b}catch(_){v.value=_.message}finally{u.value=!1}}return F(x),(_,t)=>(d(),r("div",A,[s("div",U,[t[4]||(t[4]=s("div",null,[s("h2",{class:"section-title"},"运行状态"),s("p",{class:"section-subtitle"},"从本机 Aster CLI 拉取实时状态。")],-1)),s("div",W,[l(o(C),{size:"small",secondary:"",onClick:t[0]||(t[0]=e=>h.value=!0)},{icon:i(()=>[l(o(S),{size:14})]),default:i(()=>[t[2]||(t[2]=g(" 使用教程 ",-1))]),_:1}),l(o(C),{size:"small",secondary:"",loading:u.value,onClick:x},{default:i(()=>[...t[3]||(t[3]=[g("刷新",-1)])]),_:1},8,["loading"])])]),l(o(I),{show:u.value},{default:i(()=>[l(p,{"data-tour":"dashboard-metrics",title:"运行计数",subtitle:"来自调度、技能、会话和网关状态接口。"},{default:i(()=>[s("div",E,[s("div",H,[t[5]||(t[5]=s("div",{class:"metric-label"},"调度任务",-1)),s("div",M,a(c.value.length),1)]),s("div",O,[t[6]||(t[6]=s("div",{class:"metric-label"},"技能",-1)),s("div",X,a(k.value.length),1)]),s("div",Y,[t[7]||(t[7]=s("div",{class:"metric-label"},"会话",-1)),s("div",Z,a(w.value.length),1)]),s("div",q,[t[8]||(t[8]=s("div",{class:"metric-label"},"网关记录",-1)),s("div",G,a(m.value.length),1)])])]),_:1}),l(p,{"data-tour":"dashboard-schedule",title:"最近调度",subtitle:"按下一次运行时间排序。"},{default:i(()=>[c.value.length===0?(d(),r("div",J,"暂无任务。")):(d(),r("div",K,[(d(!0),r(V,null,B(c.value.slice(0,5),e=>(d(),r("div",{key:e.id,class:"mini-row"},[s("div",null,[s("strong",null,a(e.name||e.prompt),1),s("small",null,a(o(T)(e.nextRunAt)),1)]),l(o(N),{size:"small",type:e.enabled?"success":"default"},{default:i(()=>[g(a(e.kind),1)]),_:2},1032,["type"])]))),128))]))]),_:1}),l(p,{"data-tour":"dashboard-gateways",title:"网关",subtitle:"飞书等平台的进程状态。"},{default:i(()=>[m.value.length===0?(d(),r("div",Q,"暂无网关状态。")):(d(),r("div",j,[(d(!0),r(V,null,B(m.value,(e,b)=>(d(),r("div",{key:b,class:"mini-row"},[s("div",null,[s("strong",null,a(o(y)(e,["name","platform"],"gateway")),1),s("small",null,a(o(y)(e,["pid","status","running"],"-")),1)]),l(o(N),{size:"small"},{default:i(()=>[g(a(o(y)(e,["enabled"],"-")),1)]),_:2},1024)]))),128))]))]),_:1})]),_:1},8,["show"]),v.value?(d(),L(p,{key:0,title:"错误"},{default:i(()=>[s("div",ss,a(v.value),1)]),_:1})):P("",!0),l(z,{show:h.value,"onUpdate:show":t[1]||(t[1]=e=>h.value=e),steps:R,"title-id":"dashboardTourTitle"},null,8,["show"])]))}}),cs=$(ts,[["__scopeId","data-v-fe869ebd"]]);export{cs as default};
