@lsamien/yaovi 0.1.3 → 0.1.4

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 (59) hide show
  1. package/build-info.json +15 -4
  2. package/desktop/main.mjs +1 -1
  3. package/dist/assets/{AboutDialog-CnNkIRo8.js → AboutDialog-CDpS-zAu.js} +2 -2
  4. package/dist/assets/{AboutDialog-CnNkIRo8.js.map → AboutDialog-CDpS-zAu.js.map} +1 -1
  5. package/dist/assets/{BotAutomationsView-J9Y7Unoq.js → BotAutomationsView-RXBQzdfc.js} +2 -2
  6. package/dist/assets/{BotAutomationsView-J9Y7Unoq.js.map → BotAutomationsView-RXBQzdfc.js.map} +1 -1
  7. package/dist/assets/{BotControlSettingsPanel-CtXD24FZ.js → BotControlSettingsPanel-GQEVHXbw.js} +2 -2
  8. package/dist/assets/{BotControlSettingsPanel-CtXD24FZ.js.map → BotControlSettingsPanel-GQEVHXbw.js.map} +1 -1
  9. package/dist/assets/BotPluginsDialog-HIhXqyGn.js +2 -0
  10. package/dist/assets/{BotPluginsDialog-qRw8dCbX.js.map → BotPluginsDialog-HIhXqyGn.js.map} +1 -1
  11. package/dist/assets/{BotSettingsPanel-DbCMOfAW.js → BotSettingsPanel-Bkqal3lR.js} +3 -3
  12. package/dist/assets/{BotSettingsPanel-DbCMOfAW.js.map → BotSettingsPanel-Bkqal3lR.js.map} +1 -1
  13. package/dist/assets/{ComputerPanel-CI-jDmC3.js → ComputerPanel-Dt73pgTG.js} +2 -2
  14. package/dist/assets/{ComputerPanel-CI-jDmC3.js.map → ComputerPanel-Dt73pgTG.js.map} +1 -1
  15. package/dist/assets/{ComputerViewerView-B76D6Fln.js → ComputerViewerView-ChYgaS9q.js} +2 -2
  16. package/dist/assets/{ComputerViewerView-B76D6Fln.js.map → ComputerViewerView-ChYgaS9q.js.map} +1 -1
  17. package/dist/assets/{ConversationsView-DsuaLKva.js → ConversationsView-DzcDJZh3.js} +88 -88
  18. package/dist/assets/ConversationsView-DzcDJZh3.js.map +1 -0
  19. package/dist/assets/ConversationsView-EdF5AM1T.css +1 -0
  20. package/dist/assets/{LocalVmSettingsPanel-BfXFdMYF.js → LocalVmSettingsPanel-DLbDb5Tq.js} +4 -4
  21. package/dist/assets/{LocalVmSettingsPanel-BfXFdMYF.js.map → LocalVmSettingsPanel-DLbDb5Tq.js.map} +1 -1
  22. package/dist/assets/{ModelNetworkChoice-DB6cLOBw.js → ModelNetworkChoice-Cfyt4Unl.js} +2 -2
  23. package/dist/assets/{ModelNetworkChoice-DB6cLOBw.js.map → ModelNetworkChoice-Cfyt4Unl.js.map} +1 -1
  24. package/dist/assets/{StandaloneDialog-BWUp2Wxo.js → StandaloneDialog-Cte829Ai.js} +2 -2
  25. package/dist/assets/{StandaloneDialog-BWUp2Wxo.js.map → StandaloneDialog-Cte829Ai.js.map} +1 -1
  26. package/dist/assets/{UpdateCheckDialog-CpZSPlUI.js → UpdateCheckDialog-BaMo_M4n.js} +2 -2
  27. package/dist/assets/{UpdateCheckDialog-CpZSPlUI.js.map → UpdateCheckDialog-BaMo_M4n.js.map} +1 -1
  28. package/dist/assets/{UsageView-BhiRCw7p.js → UsageView-CklMPG4n.js} +3 -3
  29. package/dist/assets/{UsageView-BhiRCw7p.js.map → UsageView-CklMPG4n.js.map} +1 -1
  30. package/dist/assets/WorkspaceKnowledgePanel-BdbhD3rO.js +3 -0
  31. package/dist/assets/{WorkspaceKnowledgePanel-D34YxglF.js.map → WorkspaceKnowledgePanel-BdbhD3rO.js.map} +1 -1
  32. package/dist/assets/WorkspaceRoutinesPanel-VpRoMe1x.js +2 -0
  33. package/dist/assets/{WorkspaceRoutinesPanel-Bn-W52Im.js.map → WorkspaceRoutinesPanel-VpRoMe1x.js.map} +1 -1
  34. package/dist/assets/{WorkstreamsView-CH6qDPvj.js → WorkstreamsView-BwZpuuhs.js} +2 -2
  35. package/dist/assets/{WorkstreamsView-CH6qDPvj.js.map → WorkstreamsView-BwZpuuhs.js.map} +1 -1
  36. package/dist/assets/index-C-5Gq82f.css +1 -0
  37. package/dist/assets/{index-DjhQ-RMG.js → index-Cx1SdzRY.js} +18 -18
  38. package/dist/assets/index-Cx1SdzRY.js.map +1 -0
  39. package/dist/assets/{pdf-wqiF06Qz.js → pdf-CoNh_Rmj.js} +2 -2
  40. package/dist/assets/{pdf-wqiF06Qz.js.map → pdf-CoNh_Rmj.js.map} +1 -1
  41. package/dist/index.html +2 -2
  42. package/dist-server/server/remoteAccess/dispatcher.js +5 -1
  43. package/node_modules/@yaovi/remote-core/index.mjs +13 -10
  44. package/node_modules/@yaovi/remote-core/package.json +2 -2
  45. package/node_modules/@yaovi/remote-core/types/remote-core/src/control/recovery.d.ts +1 -1
  46. package/node_modules/@yaovi/remote-core/types/remote-core/src/control/remote.d.ts +2 -0
  47. package/node_modules/@yaovi/remote-core/types/remote-core/src/index.d.ts +1 -0
  48. package/node_modules/@yaovi/remote-core/types/remote-core/src/transport/lan.d.ts +10 -4
  49. package/node_modules/@yaovi/remote-core/types/remote-core/src/transport/packet.d.ts +2 -2
  50. package/package.json +2 -2
  51. package/release.json +3 -3
  52. package/vendor/yaovi-remote-core-0.2.0-remote.18.tgz +0 -0
  53. package/dist/assets/BotPluginsDialog-qRw8dCbX.js +0 -2
  54. package/dist/assets/ConversationsView-DoA0eNiz.css +0 -1
  55. package/dist/assets/ConversationsView-DsuaLKva.js.map +0 -1
  56. package/dist/assets/WorkspaceKnowledgePanel-D34YxglF.js +0 -3
  57. package/dist/assets/WorkspaceRoutinesPanel-Bn-W52Im.js +0 -2
  58. package/dist/assets/index-DjhQ-RMG.js.map +0 -1
  59. package/dist/assets/index-DrIgDgnN.css +0 -1
@@ -0,0 +1,2 @@
1
+ import{A as e,D as t,Et as n,F as r,G as i,H as a,L as o,Ot as s,Q as ee,W as te,_ as c,a as l,b as u,d,et as f,f as p,m,o as ne,p as h,st as g,t as _,u as v,v as y,z as re}from"./_plugin-vue_export-helper-CD0r-vVb.js";import{B as b,at as x,i as ie,j as S,lt as C,nt as ae,ot as w,st as oe}from"./index-Cx1SdzRY.js";var se=[`telegram`,`feishu`,`dingtalk`,`wecom`,`slack`,`discord`,`email`,`signal`,`whatsapp`],ce={telegram:`Telegram`,feishu:`飞书`,dingtalk:`钉钉`,wecom:`企业微信`,slack:`Slack`,discord:`Discord`,email:`Email`,signal:`Signal`,whatsapp:`WhatsApp`},le={key:0,class:`home-routine-heading`},ue={key:1,class:`routine-overview`},de={class:`overview-title`},fe={class:`overview-actions`},pe={key:2,class:`error-box`,role:`alert`},me={key:3,class:`empty-state`},he=[`aria-label`],ge={class:`card-heading`},_e=[`onClick`],ve={key:0,class:`next-run`},ye={class:`latest-row`},be={key:0},xe={key:1,class:`muted`},Se=[`aria-label`,`onClick`],Ce={key:1,class:`result-preview failure`},we={class:`logs-heading`},Te={class:`log-filters`},Ee=[`value`],De={key:0,class:`scope-hint`},Oe={key:1,class:`error-box`,role:`alert`},ke={key:2,class:`empty-state`},Ae={key:0,class:`failure`},je={key:1},Me=[`open`,`aria-label`],Ne={class:`editor-body`},Pe={key:0,class:`error-box`,role:`alert`},Fe=[`value`],Ie=[`value`],Le=[`value`],Re={class:`schedule-grid`},ze={key:0},Be={key:1},Ve={key:2},He={key:1},Ue=[`value`],We={key:0,class:`secondary-actions`},Ge=[`disabled`],Ke=[`disabled`],qe=[`disabled`],Je={class:`save-actions`},Ye=[`disabled`],Xe=[`disabled`],T=_(u({__name:`WorkspaceRoutinesPanel`,props:{agentId:{},editorOnly:{type:Boolean},home:{type:Boolean},inline:{type:Boolean}},emits:[`changed`,`executed`,`editing-change`],setup(u,{expose:_,emit:T}){let E=u,D=T,O=f([]),k=f([]),A=f(null),j=f(!1),M=f(``),N=f(!1),P=f([]),F=ee({deliver:``,deviceHost:``,name:``,prompt:``,enabled:!0,kind:`daily`,time:`09:00`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,everyMinutes:60,at:``,weekdays:[1,2,3,4,5]}),I={queued:`排队中`,running:`执行中`,waiting:`等待处理`,complete:`已完成`,failed:`失败`,interrupted:`已停止`,uncertain:`状态待确认`,skipped:`已跳过`},L=f(`list`),R=f(``),z=f(``),B=f(`all`),V=f(),Ze=v(()=>[...O.value].sort((e,t)=>Number(t.enabled)-Number(e.enabled)||(e.nextAt??1/0)-(t.nextAt??1/0)||e.name.localeCompare(t.name))),H=v(()=>O.value.find(e=>e.id===A.value)),U=v(()=>k.value.filter(e=>(!R.value||e.routineId===R.value)&&(B.value===`all`||e.status===B.value)&&(O.value.find(t=>t.id===e.routineId)?.name+` `+(e.error??``)).toLowerCase().includes(z.value.trim().toLowerCase()))),W=e=>e?new Date(e).toLocaleString(`zh-CN`,{hour12:!1}):``,G=e=>k.value.find(t=>t.routineId===e),Qe=e=>e.schedule.kind===`interval`?`每 ${e.schedule.everyMinutes} 分钟`:e.schedule.kind===`once`?W(e.schedule.at):`${e.schedule.kind===`weekly`?`每周 `+(e.schedule.weekdays??[]).map(e=>`日一二三四五六`[e]).join(`、`):`每天`} ${e.schedule.time}`,$e=e=>e.enabled?`已启用`:e.schedule.kind===`once`&&e.lastAt?`已结束`:`已暂停`;function K(e=``){R.value=e,L.value=`logs`,z.value=``,B.value=`all`}a(j,async e=>{D(`editing-change`,e),await t(),E.inline||(e?V.value?.showModal():V.value?.close())});async function et(e){await $(async()=>{await S(X()+`/`+e.id+`/run`,{method:`POST`,body:{requestId:ie()}}),j.value=!1,K(e.id),D(`executed`,e.id)})}let q,J=!1,Y=0,X=()=>`/api/app/agents/${E.agentId}/routines`;async function tt(){let e=Y;try{let t=await S(X());e===Y&&!J&&(O.value=t.routines,k.value=t.runs,M.value=``)}catch(t){e===Y&&!J&&(M.value=t instanceof Error?t.message:`无法读取定时任务`)}}async function nt(){let e=Y;!document.hidden&&!N.value&&await tt(),!J&&e===Y&&(q=setTimeout(nt,5e3))}let Z=0;async function Q(e){let t=++Z,n=E.agentId;A.value=e?.id??null,Object.assign(F,{deliver:e?.deliver?.platform??``,deviceHost:e?.deviceHost??``,name:e?.name??``,prompt:e?.prompt??``,enabled:e?.enabled??!0,kind:e?.schedule.kind??`daily`,time:e?.schedule.time??`09:00`,timezone:e?.schedule.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,everyMinutes:e?.schedule.everyMinutes??60,at:e?.schedule.at?new Date(e.schedule.at-new Date(e.schedule.at).getTimezoneOffset()*6e4).toISOString().slice(0,16):``,weekdays:e?.schedule.weekdays??[1,2,3,4,5]}),j.value=!0;try{let[r,i]=await Promise.all([S(`/api/app/agents/${n}/desktop-environment`),e?Promise.resolve(void 0):window.yaoviDesktop?.deviceHost?.()]);if(t!==Z||n!==E.agentId||J)return;P.value=r.hosts,!e&&!F.deviceHost&&(F.deviceHost=i?.deviceHost??``)}catch{t===Z&&(P.value=[])}}async function $(e){if(!N.value){N.value=!0,M.value=``;try{await e(),await tt(),D(`changed`)}catch(e){M.value=e instanceof Error?e.message:`定时任务操作失败`}finally{N.value=!1}}}function rt(e){return{name:e.name,prompt:e.prompt,enabled:!e.enabled,deviceHost:e.deviceHost??null,schedule:e.schedule}}async function it(){let e=H.value?.schedule.at,t=e?new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16):void 0,n={kind:F.kind,timezone:F.timezone,...F.kind===`once`?{at:t===F.at?e:new Date(F.at).getTime()}:F.kind===`interval`?{everyMinutes:F.everyMinutes}:{time:F.time,...F.kind===`weekly`?{weekdays:F.weekdays}:{}}};await $(async()=>{await S(X()+(A.value?`/`+A.value:``),{method:A.value?`PUT`:`POST`,body:{name:F.name,prompt:F.prompt,enabled:F.enabled,deviceHost:F.deviceHost||null,deliver:F.deliver?{platform:F.deliver,...H.value?.deliver?.platform===F.deliver&&H.value.deliver.chatId?{chatId:H.value.deliver.chatId}:{}}:null,schedule:n}}),j.value=!1})}return a(()=>E.agentId,()=>{Y++,O.value=[],k.value=[],j.value=!1,L.value=`list`,R.value=``,clearTimeout(q),E.editorOnly||nt()},{immediate:!0}),_({edit:e=>{E.editorOnly&&(O.value=e?[e]:[]),Q(e)}}),e(()=>{J=!0,Y++,clearTimeout(q)}),(e,t)=>{let a=re(`RouterLink`);return i((r(),m(`section`,{class:n([`routines`,{home:u.home,inline:u.inline}]),"aria-label":`机器人定时任务`},[L.value===`list`&&!(u.inline&&j.value)?(r(),m(l,{key:0},[u.home?(r(),m(`div`,le,[t[24]||=d(`h2`,null,`定时任务`,-1),d(`button`,{"aria-label":`新建定时任务`,onClick:t[0]||=e=>Q()},[y(b,{name:`plus`,size:20})])])):(r(),m(`div`,ue,[d(`div`,de,[y(b,{name:`calendar`,size:16}),t[25]||=d(`h2`,null,`定时任务`,-1),d(`span`,null,s(O.value.length),1)]),d(`div`,fe,[d(`button`,{class:`primary`,onClick:t[1]||=e=>Q()},[y(b,{name:`plus`,size:14}),t[26]||=c(`新建定时任务`,-1)]),d(`button`,{onClick:t[2]||=e=>K()},[y(b,{name:`file`,size:13}),t[27]||=c(`运行日志`,-1)])])])),M.value?(r(),m(`p`,pe,s(M.value),1)):h(``,!0),O.value.length?h(``,!0):(r(),m(`div`,me,[y(b,{name:`calendar`,size:22}),t[28]||=d(`p`,null,`还没有定时任务`,-1),t[29]||=d(`small`,null,`为这个机器人安排定期执行的工作。`,-1)])),(r(!0),m(l,null,o(Ze.value,e=>(r(),m(`article`,{key:e.id,class:`routine-card`,"aria-label":e.name},[d(`div`,ge,[d(`button`,{class:`routine-title`,onClick:t=>Q(e)},[d(`h3`,null,s(e.name),1),d(`span`,null,s(Qe(e))+` · `+s(e.schedule.timezone),1)],8,_e),d(`span`,{class:n([`state-pill`,{enabled:e.enabled}])},s($e(e)),3)]),e.enabled&&e.nextAt?(r(),m(`p`,ve,`下次 `+s(W(e.nextAt)),1)):h(``,!0),d(`div`,ye,[G(e.id)?(r(),m(`div`,be,[d(`span`,{class:n({failure:G(e.id)?.status===`failed`})},`最近执行:`+s(I[G(e.id).status]),3),d(`small`,null,s(W(G(e.id).startedAt)),1)])):(r(),m(`span`,xe,`尚未执行`)),d(`button`,{"aria-label":`查看`+e.name+`的运行日志`,onClick:t=>K(e.id)},[y(b,{name:`file`,size:12}),t[30]||=c(`日志`,-1)],8,Se)]),G(e.id)?.error?(r(),m(`p`,Ce,s(G(e.id).error),1)):h(``,!0)],8,he))),128))],64)):h(``,!0),u.home&&L.value===`list`&&!(u.inline&&j.value)?(r(),m(`button`,{key:1,class:`home-routine-logs`,onClick:t[3]||=e=>K()},[y(b,{name:`file`,size:18}),t[31]||=c(`查看运行记录`,-1)])):h(``,!0),L.value===`logs`&&!(u.inline&&j.value)?(r(),m(l,{key:2},[d(`div`,we,[d(`button`,{class:`back`,"aria-label":`返回定时任务列表`,onClick:t[4]||=e=>L.value=`list`},[y(b,{name:`chevron-left`,size:16})]),t[32]||=d(`div`,null,[d(`h2`,null,`运行日志`),d(`p`,null,`查看每次执行的状态与结果。`)],-1)]),d(`div`,Te,[d(`label`,null,[y(b,{name:`search`,size:14}),i(d(`input`,{"onUpdate:modelValue":t[5]||=e=>z.value=e,"aria-label":`搜索运行日志`,placeholder:`搜索任务或错误`},null,512),[[w,z.value]])]),i(d(`select`,{"onUpdate:modelValue":t[6]||=e=>B.value=e,"aria-label":`筛选执行状态`},[t[33]||=d(`option`,{value:`all`},`全部状态`,-1),(r(),m(l,null,o(I,(e,t)=>d(`option`,{key:t,value:t},s(e),9,Ee)),64))],512),[[x,B.value]])]),R.value?(r(),m(`div`,De,[t[34]||=c(`当前任务的日志`,-1),d(`button`,{onClick:t[7]||=e=>R.value=``},`显示全部`)])):h(``,!0),M.value?(r(),m(`p`,Oe,s(M.value),1)):h(``,!0),U.value.length?h(``,!0):(r(),m(`div`,ke,[y(b,{name:`file`,size:24}),d(`p`,null,s(k.value.length?`没有匹配的执行记录`:`还没有执行记录`),1)])),(r(!0),m(l,null,o(U.value,e=>(r(),m(`details`,{key:e.id,class:`run-card`},[d(`summary`,null,[d(`div`,null,[d(`strong`,null,s(O.value.find(t=>t.id===e.routineId)?.name??`定时任务`),1),d(`small`,null,s(W(e.startedAt))+` · `+s(e.scheduledAt===0?`手动执行`:`定时执行`),1)]),d(`span`,{class:n([`run-state`,{failure:e.status===`failed`,success:e.status===`complete`}])},s(I[e.status]??e.status),3)]),e.error?(r(),m(`p`,Ae,s(e.error),1)):(r(),m(`p`,je,s(e.status===`complete`?`结果已发送到机器人的聊天。`:`执行进度会自动更新。`),1)),e.conversationId?(r(),p(a,{key:2,to:`/conversations/`+e.conversationId},{default:te(()=>[...t[35]||=[c(`查看聊天结果 ↗`,-1)]]),_:1},8,[`to`])):h(``,!0)]))),128))],64)):h(``,!0),(r(),p(ne,{to:`body`,disabled:u.inline},[j.value?(r(),m(`dialog`,{key:0,open:u.inline,ref_key:`dialog`,ref:V,class:`routine-editor`,"aria-label":A.value?`编辑定时任务`:`新建定时任务`,onCancel:t[23]||=C(e=>j.value=!1,[`prevent`])},[d(`form`,{onSubmit:C(it,[`prevent`])},[d(`header`,null,[d(`div`,null,[y(b,{name:`calendar`,size:18}),d(`h2`,null,s(A.value?`编辑定时任务`:`新建定时任务`),1)]),d(`button`,{type:`button`,class:`icon-button`,"aria-label":`关闭定时任务编辑器`,onClick:t[8]||=e=>j.value=!1},[y(b,{name:`close`})])]),d(`div`,Ne,[M.value?(r(),m(`p`,Pe,s(M.value),1)):h(``,!0),d(`label`,null,[t[37]||=c(`任务中的“本机”`,-1),i(d(`select`,{"onUpdate:modelValue":t[9]||=e=>F.deviceHost=e},[t[36]||=d(`option`,{value:``},`未指定,请在任务中点名目标电脑`,-1),(r(!0),m(l,null,o(P.value,e=>(r(),m(`option`,{key:e.id,value:e.id},s(e.id===`local`?`服务器 · `:``)+s(e.name),9,Fe))),128)),F.deviceHost&&!P.value.some(e=>e.id===F.deviceHost)?(r(),m(`option`,{key:0,value:F.deviceHost},`原设备(未连接)`,8,Ie)):h(``,!0)],512),[[x,F.deviceHost]]),t[38]||=d(`small`,null,`固定使用保存的目标,不随查看任务的客户端变化。`,-1)]),d(`label`,null,[t[40]||=c(`同时投递到渠道`,-1),i(d(`select`,{"onUpdate:modelValue":t[10]||=e=>F.deliver=e,"aria-label":`投递到渠道`},[t[39]||=d(`option`,{value:``},`不投递,仅在聊天中`,-1),(r(!0),m(l,null,o(g(se),e=>(r(),m(`option`,{key:e,value:e},s(g(ce)[e])+` 主频道`,9,Le))),128))],512),[[x,F.deliver]]),t[41]||=d(`small`,null,`使用本 Bot 自己的渠道账号;主频道在 Bot 设置 → 渠道中填写。`,-1)]),d(`label`,null,[t[42]||=c(`名称`,-1),i(d(`input`,{"onUpdate:modelValue":t[11]||=e=>F.name=e,required:``,maxlength:`100`,placeholder:`为这项工作命名`},null,512),[[w,F.name]])]),d(`label`,null,[t[43]||=c(`任务内容`,-1),i(d(`textarea`,{"onUpdate:modelValue":t[12]||=e=>F.prompt=e,required:``,maxlength:`24000`,rows:`5`,placeholder:`告诉机器人需要定期完成什么`},null,512),[[w,F.prompt]])]),d(`div`,Re,[d(`label`,null,[t[45]||=c(`重复`,-1),i(d(`select`,{"onUpdate:modelValue":t[13]||=e=>F.kind=e,"aria-label":`重复`},[...t[44]||=[d(`option`,{value:`once`},`仅一次`,-1),d(`option`,{value:`interval`},`固定间隔`,-1),d(`option`,{value:`daily`},`每天`,-1),d(`option`,{value:`weekly`},`每周`,-1)]],512),[[x,F.kind]])]),F.kind===`once`?(r(),m(`label`,ze,[t[46]||=c(`执行时间`,-1),i(d(`input`,{"onUpdate:modelValue":t[14]||=e=>F.at=e,type:`datetime-local`,required:``},null,512),[[w,F.at]])])):F.kind===`interval`?(r(),m(`label`,Be,[t[47]||=c(`间隔(分钟)`,-1),i(d(`input`,{"onUpdate:modelValue":t[15]||=e=>F.everyMinutes=e,type:`number`,min:`1`,max:`525600`,required:``},null,512),[[w,F.everyMinutes,void 0,{number:!0}]])])):(r(),m(`label`,Ve,[t[48]||=c(`执行时间`,-1),i(d(`input`,{"onUpdate:modelValue":t[16]||=e=>F.time=e,type:`time`,required:``},null,512),[[w,F.time]])]))]),F.kind===`weekly`?(r(),m(`fieldset`,He,[t[49]||=d(`legend`,null,`每周`,-1),(r(),m(l,null,o([`日`,`一`,`二`,`三`,`四`,`五`,`六`],(e,n)=>d(`label`,{key:e,class:`check`},[i(d(`input`,{"onUpdate:modelValue":t[17]||=e=>F.weekdays=e,type:`checkbox`,value:n},null,8,Ue),[[ae,F.weekdays]]),c(s(e),1)])),64))])):h(``,!0),d(`label`,null,[t[50]||=c(`时区`,-1),i(d(`input`,{"onUpdate:modelValue":t[18]||=e=>F.timezone=e,required:``,placeholder:`Asia/Shanghai`},null,512),[[w,F.timezone]])]),t[51]||=d(`p`,{class:`editor-note`},`服务端按计划执行,结果回到当前机器人的聊天。`,-1)]),d(`footer`,null,[H.value?(r(),m(`div`,We,[d(`button`,{type:`button`,disabled:N.value,onClick:t[19]||=e=>et(H.value)},`立即执行`,8,Ge),d(`button`,{type:`button`,disabled:N.value,onClick:t[20]||=e=>{$(async()=>{await g(S)(X()+`/`+H.value.id,{method:`PUT`,body:rt(H.value)}),j.value=!1})}},s(H.value.enabled?`暂停`:`启用`),9,Ke),d(`button`,{type:`button`,class:`danger-button`,disabled:N.value,onClick:t[21]||=e=>{$(async()=>{await g(S)(X()+`/`+H.value.id,{method:`DELETE`}),j.value=!1})}},`删除`,8,qe)])):h(``,!0),d(`div`,Je,[d(`button`,{type:`button`,disabled:N.value,onClick:t[22]||=e=>j.value=!1},`取消`,8,Ye),d(`button`,{class:`primary`,disabled:N.value},`保存`,8,Xe)])])],32)],40,Me)):h(``,!0)],8,[`disabled`]))],2)),[[oe,!u.editorOnly]])}}}),[[`__scopeId`,`data-v-a3240f3c`]]);export{T as t};
2
+ //# sourceMappingURL=WorkspaceRoutinesPanel-VpRoMe1x.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WorkspaceRoutinesPanel-Bn-W52Im.js","names":[],"sources":["../../src/shared/channelPlatforms.ts","../../src/client/components/workspace/WorkspaceRoutinesPanel.vue","../../src/client/components/workspace/WorkspaceRoutinesPanel.vue"],"sourcesContent":["export const channelPlatforms=['telegram','feishu','dingtalk','wecom','slack','discord','email','signal','whatsapp'] as const\nexport type MessagingChannelPlatform=typeof channelPlatforms[number]\nexport const messagingChannelLabels:Record<MessagingChannelPlatform,string>={telegram:'Telegram',feishu:'飞书',dingtalk:'钉钉',wecom:'企业微信',slack:'Slack',discord:'Discord',email:'Email',signal:'Signal',whatsapp:'WhatsApp'}\n","<script setup lang=\"ts\">\nimport { channelPlatforms,messagingChannelLabels,type MessagingChannelPlatform } from '@shared/channelPlatforms'\nimport {ref,reactive,watch,onBeforeUnmount,computed,nextTick} from 'vue'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport {apiRequest} from '@/api/client'\nimport {createUuid} from '@/utils/id'\nimport type {WorkspaceRoutine,WorkspaceRoutineRun,WorkspaceSchedule} from '@shared/workspacePanels'\nconst props=defineProps<{agentId:string;editorOnly?:boolean;home?:boolean;inline?:boolean}>()\nconst emit=defineEmits<{changed:[];executed:[id:string];'editing-change':[value:boolean]}>()\nconst routines=ref<WorkspaceRoutine[]>([]),runs=ref<WorkspaceRoutineRun[]>([]),editing=ref<string|null>(null),showEditor=ref(false),error=ref(''),busy=ref(false)\nconst hosts=ref<{id:string;name:string}[]>([])\nconst form=reactive({deliver:'' as ''|MessagingChannelPlatform,deviceHost:'',name:'',prompt:'',enabled:true,kind:'daily' as WorkspaceSchedule['kind'],time:'09:00',timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,everyMinutes:60,at:'',weekdays:[1,2,3,4,5]})\nconst status:Record<string,string>={queued:'排队中',running:'执行中',waiting:'等待处理',complete:'已完成',failed:'失败',interrupted:'已停止',uncertain:'状态待确认',skipped:'已跳过'}\nconst view=ref<'list'|'logs'>('list'),logFilter=ref(''),query=ref(''),statusFilter=ref('all'),dialog=ref<HTMLDialogElement>()\nconst sorted=computed(()=>[...routines.value].sort((a,b)=>Number(b.enabled)-Number(a.enabled)||(a.nextAt??Infinity)-(b.nextAt??Infinity)||a.name.localeCompare(b.name)))\nconst selectedRoutine=computed(()=>routines.value.find(r=>r.id===editing.value))\nconst logs=computed(()=>runs.value.filter(r=>(!logFilter.value||r.routineId===logFilter.value)&&(statusFilter.value==='all'||r.status===statusFilter.value)&&(routines.value.find(item=>item.id===r.routineId)?.name+' '+(r.error??'')).toLowerCase().includes(query.value.trim().toLowerCase())))\nconst date=(at?:number)=>at?new Date(at).toLocaleString('zh-CN',{hour12:false}):''\nconst latest=(id:string)=>runs.value.find(r=>r.routineId===id)\nconst scheduleLabel=(r:WorkspaceRoutine)=>r.schedule.kind==='interval'?`每 ${r.schedule.everyMinutes} 分钟`:r.schedule.kind==='once'?date(r.schedule.at):`${r.schedule.kind==='weekly'?'每周 '+(r.schedule.weekdays??[]).map(i=>'日一二三四五六'[i]).join('、'):'每天'} ${r.schedule.time}`\nconst scheduleState=(r:WorkspaceRoutine)=>r.enabled?'已启用':r.schedule.kind==='once'&&r.lastAt?'已结束':'已暂停'\nfunction openLogs(id=''){logFilter.value=id;view.value='logs';query.value='';statusFilter.value='all'}\nwatch(showEditor,async(value)=>{emit('editing-change',value);await nextTick();if(!props.inline){if(value)dialog.value?.showModal();else dialog.value?.close()}})\nasync function runNow(r:WorkspaceRoutine){await action(async()=>{await apiRequest(base()+'/'+r.id+'/run',{method:'POST',body:{requestId:createUuid()}});showEditor.value=false;openLogs(r.id);emit('executed',r.id)})}\nlet timer:ReturnType<typeof setTimeout>|undefined,closed=false,generation=0\nconst base=()=>`/api/app/agents/${props.agentId}/routines`\nasync function load(){const version=generation;try{const value=await apiRequest<{routines:WorkspaceRoutine[];runs:WorkspaceRoutineRun[]}>(base());if(version===generation&&!closed){routines.value=value.routines;runs.value=value.runs;error.value=''}}catch(e){if(version===generation&&!closed)error.value=e instanceof Error?e.message:'无法读取定时任务'}}\nasync function cycle(){const version=generation;if(!document.hidden&&!busy.value)await load();if(!closed&&version===generation)timer=setTimeout(cycle,5000)}\nlet editorGeneration=0\nasync function edit(r?:WorkspaceRoutine){const version=++editorGeneration,agentId=props.agentId;editing.value=r?.id??null;Object.assign(form,{deliver:r?.deliver?.platform??'',deviceHost:r?.deviceHost??'',name:r?.name??'',prompt:r?.prompt??'',enabled:r?.enabled??true,kind:r?.schedule.kind??'daily',time:r?.schedule.time??'09:00',timezone:r?.schedule.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,everyMinutes:r?.schedule.everyMinutes??60,at:r?.schedule.at?new Date(r.schedule.at-new Date(r.schedule.at).getTimezoneOffset()*60000).toISOString().slice(0,16):'',weekdays:r?.schedule.weekdays??[1,2,3,4,5]});showEditor.value=true;try{const [result,source]=await Promise.all([apiRequest<{hosts:{id:string;name:string}[]}>(`/api/app/agents/${agentId}/desktop-environment`),r?Promise.resolve(undefined):window.yaoviDesktop?.deviceHost?.()]);if(version!==editorGeneration||agentId!==props.agentId||closed)return;hosts.value=result.hosts;if(!r&&!form.deviceHost)form.deviceHost=source?.deviceHost??''}catch{if(version===editorGeneration)hosts.value=[]}}\nasync function action(work:()=>Promise<unknown>){if(busy.value)return;busy.value=true;error.value='';try{await work();await load();emit('changed')}catch(e){error.value=e instanceof Error?e.message:'定时任务操作失败'}finally{busy.value=false}}\nfunction payload(r:WorkspaceRoutine){return {name:r.name,prompt:r.prompt,enabled:!r.enabled,deviceHost:r.deviceHost??null,schedule:r.schedule}}\nasync function save(){const original=selectedRoutine.value?.schedule.at,originalDisplay=original?new Date(original-new Date(original).getTimezoneOffset()*60000).toISOString().slice(0,16):undefined;const schedule:WorkspaceSchedule={kind:form.kind,timezone:form.timezone,...(form.kind==='once'?{at:originalDisplay===form.at?original:new Date(form.at).getTime()}:form.kind==='interval'?{everyMinutes:form.everyMinutes}:{time:form.time,...(form.kind==='weekly'?{weekdays:form.weekdays}:{})})};await action(async()=>{await apiRequest(base()+(editing.value?'/'+editing.value:''),{method:editing.value?'PUT':'POST',body:{name:form.name,prompt:form.prompt,enabled:form.enabled,deviceHost:form.deviceHost||null,deliver:form.deliver?{platform:form.deliver,...(selectedRoutine.value?.deliver?.platform===form.deliver&&selectedRoutine.value.deliver.chatId?{chatId:selectedRoutine.value.deliver.chatId}:{})}:null,schedule} as any});showEditor.value=false})}\nwatch(()=>props.agentId,()=>{generation++;routines.value=[];runs.value=[];showEditor.value=false;view.value='list';logFilter.value='';clearTimeout(timer);if(!props.editorOnly)void cycle()},{immediate:true})\ndefineExpose({edit:(r?:WorkspaceRoutine)=>{if(props.editorOnly)routines.value=r?[r]:[];edit(r)}})\nonBeforeUnmount(()=>{closed=true;generation++;clearTimeout(timer)})\n</script>\n<template>\n <section v-show=\"!editorOnly\" class=\"routines\" :class=\"{home,inline}\" aria-label=\"机器人定时任务\">\n <template v-if=\"view==='list'&&!(inline&&showEditor)\">\n <div v-if=\"home\" class=\"home-routine-heading\"><h2>定时任务</h2><button aria-label=\"新建定时任务\" @click=\"edit()\"><AppIcon name=\"plus\" :size=\"20\"/></button></div>\n <div v-else class=\"routine-overview\"><div class=\"overview-title\"><AppIcon name=\"calendar\" :size=\"16\"/><h2>定时任务</h2><span>{{routines.length}}</span></div><div class=\"overview-actions\"><button class=\"primary\" @click=\"edit()\"><AppIcon name=\"plus\" :size=\"14\"/>新建定时任务</button><button @click=\"openLogs()\"><AppIcon name=\"file\" :size=\"13\"/>运行日志</button></div></div>\n <p v-if=\"error\" class=\"error-box\" role=\"alert\">{{error}}</p>\n <div v-if=\"!routines.length\" class=\"empty-state\"><AppIcon name=\"calendar\" :size=\"22\"/><p>还没有定时任务</p><small>为这个机器人安排定期执行的工作。</small></div>\n <article v-for=\"routine in sorted\" :key=\"routine.id\" class=\"routine-card\" :aria-label=\"routine.name\">\n <div class=\"card-heading\"><button class=\"routine-title\" @click=\"edit(routine)\"><h3>{{routine.name}}</h3><span>{{scheduleLabel(routine)}} · {{routine.schedule.timezone}}</span></button><span :class=\"['state-pill',{enabled:routine.enabled}]\">{{scheduleState(routine)}}</span></div>\n <p v-if=\"routine.enabled&&routine.nextAt\" class=\"next-run\">下次 {{date(routine.nextAt)}}</p>\n <div class=\"latest-row\"><div v-if=\"latest(routine.id)\"><span :class=\"{failure:latest(routine.id)?.status==='failed'}\">最近执行:{{status[latest(routine.id)!.status]}}</span><small>{{date(latest(routine.id)!.startedAt)}}</small></div><span v-else class=\"muted\">尚未执行</span><button :aria-label=\"'查看'+routine.name+'的运行日志'\" @click=\"openLogs(routine.id)\"><AppIcon name=\"file\" :size=\"12\"/>日志</button></div>\n <p v-if=\"latest(routine.id)?.error\" class=\"result-preview failure\">{{latest(routine.id)!.error}}</p>\n </article>\n </template>\n <button v-if=\"home&&view==='list'&&!(inline&&showEditor)\" class=\"home-routine-logs\" @click=\"openLogs()\"><AppIcon name=\"file\" :size=\"18\"/>查看运行记录</button>\n <template v-if=\"view==='logs'&&!(inline&&showEditor)\">\n <div class=\"logs-heading\"><button class=\"back\" aria-label=\"返回定时任务列表\" @click=\"view='list'\"><AppIcon name=\"chevron-left\" :size=\"16\"/></button><div><h2>运行日志</h2><p>查看每次执行的状态与结果。</p></div></div>\n <div class=\"log-filters\"><label><AppIcon name=\"search\" :size=\"14\"/><input v-model=\"query\" aria-label=\"搜索运行日志\" placeholder=\"搜索任务或错误\"></label><select v-model=\"statusFilter\" aria-label=\"筛选执行状态\"><option value=\"all\">全部状态</option><option v-for=\"(label,key) in status\" :key=\"key\" :value=\"key\">{{label}}</option></select></div>\n <div v-if=\"logFilter\" class=\"scope-hint\">当前任务的日志<button @click=\"logFilter=''\">显示全部</button></div>\n <p v-if=\"error\" class=\"error-box\" role=\"alert\">{{error}}</p>\n <div v-if=\"!logs.length\" class=\"empty-state\"><AppIcon name=\"file\" :size=\"24\"/><p>{{runs.length?'没有匹配的执行记录':'还没有执行记录'}}</p></div>\n <details v-for=\"run in logs\" :key=\"run.id\" class=\"run-card\"><summary><div><strong>{{routines.find(r=>r.id===run.routineId)?.name??'定时任务'}}</strong><small>{{date(run.startedAt)}} · {{run.scheduledAt===0?'手动执行':'定时执行'}}</small></div><span :class=\"['run-state',{failure:run.status==='failed',success:run.status==='complete'}]\">{{status[run.status]??run.status}}</span></summary><p v-if=\"run.error\" class=\"failure\">{{run.error}}</p><p v-else>{{run.status==='complete'?'结果已发送到机器人的聊天。':'执行进度会自动更新。'}}</p><RouterLink v-if=\"run.conversationId\" :to=\"'/conversations/'+run.conversationId\">查看聊天结果 ↗</RouterLink></details>\n </template>\n <Teleport to=\"body\" :disabled=\"inline\"><dialog :open=\"inline\" v-if=\"showEditor\" ref=\"dialog\" class=\"routine-editor\" :aria-label=\"editing?'编辑定时任务':'新建定时任务'\" @cancel.prevent=\"showEditor=false\">\n <form @submit.prevent=\"save\"><header><div><AppIcon name=\"calendar\" :size=\"18\"/><h2>{{editing?'编辑定时任务':'新建定时任务'}}</h2></div><button type=\"button\" class=\"icon-button\" aria-label=\"关闭定时任务编辑器\" @click=\"showEditor=false\"><AppIcon name=\"close\"/></button></header>\n <div class=\"editor-body\"><p v-if=\"error\" class=\"error-box\" role=\"alert\">{{error}}</p><label>任务中的“本机”<select v-model=\"form.deviceHost\"><option value=\"\">未指定,请在任务中点名目标电脑</option><option v-for=\"host in hosts\" :key=\"host.id\" :value=\"host.id\">{{host.id==='local'?'服务器 · ':''}}{{host.name}}</option><option v-if=\"form.deviceHost&&!hosts.some(h=>h.id===form.deviceHost)\" :value=\"form.deviceHost\">原设备(未连接)</option></select><small>固定使用保存的目标,不随查看任务的客户端变化。</small></label><label>同时投递到渠道<select v-model=\"form.deliver\" aria-label=\"投递到渠道\"><option value=\"\">不投递,仅在聊天中</option><option v-for=\"platform in channelPlatforms\" :key=\"platform\" :value=\"platform\">{{messagingChannelLabels[platform]}} 主频道</option></select><small>使用本 Bot 自己的渠道账号;主频道在 Bot 设置 → 渠道中填写。</small></label><label>名称<input v-model=\"form.name\" required maxlength=\"100\" placeholder=\"为这项工作命名\"></label><label>任务内容<textarea v-model=\"form.prompt\" required maxlength=\"24000\" rows=\"5\" placeholder=\"告诉机器人需要定期完成什么\"/></label>\n <div class=\"schedule-grid\"><label>重复<select v-model=\"form.kind\" aria-label=\"重复\"><option value=\"once\">仅一次</option><option value=\"interval\">固定间隔</option><option value=\"daily\">每天</option><option value=\"weekly\">每周</option></select></label><label v-if=\"form.kind==='once'\">执行时间<input v-model=\"form.at\" type=\"datetime-local\" required></label><label v-else-if=\"form.kind==='interval'\">间隔(分钟)<input v-model.number=\"form.everyMinutes\" type=\"number\" min=\"1\" max=\"525600\" required></label><label v-else>执行时间<input v-model=\"form.time\" type=\"time\" required></label></div>\n <fieldset v-if=\"form.kind==='weekly'\"><legend>每周</legend><label v-for=\"(day,index) in ['日','一','二','三','四','五','六']\" :key=\"day\" class=\"check\"><input v-model=\"form.weekdays\" type=\"checkbox\" :value=\"index\">{{day}}</label></fieldset><label>时区<input v-model=\"form.timezone\" required placeholder=\"Asia/Shanghai\"></label><p class=\"editor-note\">服务端按计划执行,结果回到当前机器人的聊天。</p>\n </div>\n <footer><div class=\"secondary-actions\" v-if=\"selectedRoutine\"><button type=\"button\" :disabled=\"busy\" @click=\"runNow(selectedRoutine)\">立即执行</button><button type=\"button\" :disabled=\"busy\" @click=\"action(async()=>{await apiRequest(base()+'/'+selectedRoutine!.id,{method:'PUT',body:payload(selectedRoutine!) as any});showEditor=false})\">{{selectedRoutine.enabled?'暂停':'启用'}}</button><button type=\"button\" class=\"danger-button\" :disabled=\"busy\" @click=\"action(async()=>{await apiRequest(base()+'/'+selectedRoutine!.id,{method:'DELETE'});showEditor=false})\">删除</button></div><div class=\"save-actions\"><button type=\"button\" :disabled=\"busy\" @click=\"showEditor=false\">取消</button><button class=\"primary\" :disabled=\"busy\">保存</button></div></footer>\n </form>\n </dialog></Teleport>\n </section>\n</template>\n<style scoped>\n.routines{padding:16px;overflow:auto;min-height:0;display:flex;flex-direction:column;gap:14px;color:var(--text-primary)}.routine-overview{border-radius:12px;background:var(--surface-raised);padding:16px}.overview-title,.overview-actions,.card-heading,.latest-row,.logs-heading,.log-filters{display:flex;align-items:center;gap:8px}.overview-title .app-icon{color:var(--accent)}h2{font-size:15px;font-weight:600;margin:0}.overview-title h2{flex:1}.overview-title>span{font-size:11.5px;color:var(--text-muted)}.overview-actions{margin-top:14px}.overview-actions .primary{flex:1}button,input,select,textarea{font:inherit;color:inherit;border:1px solid var(--line);border-radius:8px;background:var(--surface-raised);box-sizing:border-box;min-height:40px;min-width:0;padding:8px 10px;font-size:12px}button{cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:6px}button:disabled{opacity:.5;cursor:default}.primary{background:var(--accent);border-color:var(--accent);color:var(--text-on-solid);font-weight:500}.routine-card,.run-card{border:1px solid var(--line);border-radius:12px;background:var(--surface-raised);padding:14px}.card-heading{align-items:flex-start}.routine-title{flex:1;min-width:0;text-align:left;display:block;padding:0;border:0;background:transparent;min-height:40px}.routine-title h3{font-size:13px;line-height:1.5;font-weight:600;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.routine-title span{display:block;font-size:11.5px;line-height:1.7;color:var(--text-muted);margin-top:4px}.state-pill{flex:none;border-radius:999px;padding:3px 8px;font-size:10px;line-height:1.5;background:var(--surface-soft);color:var(--text-muted)}.state-pill.enabled{color:var(--accent)}.next-run{font-size:11.5px;color:var(--text-muted);margin:10px 0 6px}.latest-row{justify-content:space-between;font-size:11.5px;align-items:flex-start;margin-top:8px}.latest-row small{display:block;font-size:10.5px;color:var(--text-muted);margin-top:5px}.latest-row button{font-size:11px;min-height:32px;padding:5px 7px;border:0;background:transparent;color:var(--text-secondary)}.result-preview{font-size:11.5px;line-height:1.6;margin-bottom:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.muted{color:var(--text-muted)}.empty-state{padding:28px 18px;border:1px dashed var(--line);border-radius:12px;text-align:center;color:var(--text-muted)}.empty-state .app-icon{opacity:.6}.empty-state p{font-size:13px}.empty-state small{font-size:11.5px}.logs-heading{align-items:flex-start}.logs-heading h2{font-size:17px}.logs-heading p{font-size:12px;color:var(--text-muted);margin:6px 0}.back{min-width:36px;min-height:36px;padding:6px;border:0;background:transparent}.log-filters{flex-wrap:wrap}.log-filters label{display:flex;align-items:center;gap:6px;flex:1;min-width:150px;padding:0 10px;border:1px solid var(--line);border-radius:8px;color:var(--text-muted)}.log-filters input{width:100%;border:0;padding-left:0;background:transparent}.scope-hint{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-muted)}.scope-hint button{border:0;color:var(--accent);background:transparent}.run-card summary{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;cursor:pointer;min-height:44px;list-style:none}.run-card summary::-webkit-details-marker{display:none}.run-card strong{display:block;font-size:13px}.run-card small{display:block;font-size:11px;line-height:1.6;color:var(--text-muted);margin-top:5px}.run-state{flex:none;font-size:11.5px}.failure,.error-box{color:var(--danger)}.success{color:var(--success,var(--accent))}.run-card p{font-size:12px;line-height:1.7}.run-card a{font-size:12px;color:var(--accent)}.error-box{font-size:12px;line-height:1.6;padding:10px;border-radius:8px;background:color-mix(in srgb,var(--danger) 8%,transparent)}.routine-editor{width:min(640px,calc(100vw - 32px));max-height:92dvh;padding:0;border:1px solid var(--line);border-radius:16px;background:var(--surface);color:var(--text-primary);box-shadow:0 24px 100px #0005;overflow:auto}.routine-editor::backdrop{background:#0008;backdrop-filter:blur(3px)}.routine-editor header,.routine-editor footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 22px;border-bottom:1px solid var(--line)}.routine-editor header>div{display:flex;align-items:center;gap:10px}.icon-button{border:0;background:transparent;min-width:40px}.editor-body{display:grid;gap:18px;padding:22px}.editor-body label{display:grid;gap:8px;font-size:12px;font-weight:500}.editor-body textarea{resize:vertical;line-height:1.7}.schedule-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.editor-body input,.editor-body textarea,.editor-body select{width:100%;font-size:13px;min-height:44px}.editor-note{font-size:11.5px;color:var(--text-muted);margin:0}.routine-editor footer{border-bottom:0;border-top:1px solid var(--line);flex-wrap:wrap}.save-actions,.secondary-actions{display:flex;gap:8px}.save-actions{margin-left:auto}.danger-button{color:var(--danger)}fieldset{border:1px solid var(--line);border-radius:8px;display:flex;gap:10px;flex-wrap:wrap}.editor-body .check{display:flex;align-items:center;gap:4px;min-height:44px}.check input{width:16px;min-height:16px}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible{outline:2px solid var(--accent);outline-offset:2px}@media(max-width:600px){button{min-height:44px}.latest-row button{min-height:44px}.routine-editor{width:calc(100vw - 20px)}.editor-body{padding:16px}.routine-editor header,.routine-editor footer{padding:14px 16px}.schedule-grid{grid-template-columns:1fr}.routines{gap:12px}}\n.home .routine-overview{background:transparent;padding:0}.home .routine-card,.home .run-card{border:0;border-radius:0;padding:14px 0;background:transparent}.home .routine-card .routine-title h3{font-size:14px}.inline .routine-editor{position:static;width:100%;max-height:none;border:0;border-radius:0;box-shadow:none}.inline .editor-body{padding:14px 0}.inline .routine-editor header,.inline .routine-editor footer{padding:12px 0}.inline .schedule-grid{grid-template-columns:1fr}\n.home-routine-heading{display:flex;align-items:center;justify-content:space-between}.home-routine-heading h2{font-size:17px}.home-routine-heading button{border:0;border-radius:50%;background:var(--surface-soft);width:44px;height:44px}.home-routine-logs{background:transparent;border:0;justify-content:flex-start;font-size:14px;min-height:48px}\n</style>\n","<script setup lang=\"ts\">\nimport { channelPlatforms,messagingChannelLabels,type MessagingChannelPlatform } from '@shared/channelPlatforms'\nimport {ref,reactive,watch,onBeforeUnmount,computed,nextTick} from 'vue'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport {apiRequest} from '@/api/client'\nimport {createUuid} from '@/utils/id'\nimport type {WorkspaceRoutine,WorkspaceRoutineRun,WorkspaceSchedule} from '@shared/workspacePanels'\nconst props=defineProps<{agentId:string;editorOnly?:boolean;home?:boolean;inline?:boolean}>()\nconst emit=defineEmits<{changed:[];executed:[id:string];'editing-change':[value:boolean]}>()\nconst routines=ref<WorkspaceRoutine[]>([]),runs=ref<WorkspaceRoutineRun[]>([]),editing=ref<string|null>(null),showEditor=ref(false),error=ref(''),busy=ref(false)\nconst hosts=ref<{id:string;name:string}[]>([])\nconst form=reactive({deliver:'' as ''|MessagingChannelPlatform,deviceHost:'',name:'',prompt:'',enabled:true,kind:'daily' as WorkspaceSchedule['kind'],time:'09:00',timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,everyMinutes:60,at:'',weekdays:[1,2,3,4,5]})\nconst status:Record<string,string>={queued:'排队中',running:'执行中',waiting:'等待处理',complete:'已完成',failed:'失败',interrupted:'已停止',uncertain:'状态待确认',skipped:'已跳过'}\nconst view=ref<'list'|'logs'>('list'),logFilter=ref(''),query=ref(''),statusFilter=ref('all'),dialog=ref<HTMLDialogElement>()\nconst sorted=computed(()=>[...routines.value].sort((a,b)=>Number(b.enabled)-Number(a.enabled)||(a.nextAt??Infinity)-(b.nextAt??Infinity)||a.name.localeCompare(b.name)))\nconst selectedRoutine=computed(()=>routines.value.find(r=>r.id===editing.value))\nconst logs=computed(()=>runs.value.filter(r=>(!logFilter.value||r.routineId===logFilter.value)&&(statusFilter.value==='all'||r.status===statusFilter.value)&&(routines.value.find(item=>item.id===r.routineId)?.name+' '+(r.error??'')).toLowerCase().includes(query.value.trim().toLowerCase())))\nconst date=(at?:number)=>at?new Date(at).toLocaleString('zh-CN',{hour12:false}):''\nconst latest=(id:string)=>runs.value.find(r=>r.routineId===id)\nconst scheduleLabel=(r:WorkspaceRoutine)=>r.schedule.kind==='interval'?`每 ${r.schedule.everyMinutes} 分钟`:r.schedule.kind==='once'?date(r.schedule.at):`${r.schedule.kind==='weekly'?'每周 '+(r.schedule.weekdays??[]).map(i=>'日一二三四五六'[i]).join('、'):'每天'} ${r.schedule.time}`\nconst scheduleState=(r:WorkspaceRoutine)=>r.enabled?'已启用':r.schedule.kind==='once'&&r.lastAt?'已结束':'已暂停'\nfunction openLogs(id=''){logFilter.value=id;view.value='logs';query.value='';statusFilter.value='all'}\nwatch(showEditor,async(value)=>{emit('editing-change',value);await nextTick();if(!props.inline){if(value)dialog.value?.showModal();else dialog.value?.close()}})\nasync function runNow(r:WorkspaceRoutine){await action(async()=>{await apiRequest(base()+'/'+r.id+'/run',{method:'POST',body:{requestId:createUuid()}});showEditor.value=false;openLogs(r.id);emit('executed',r.id)})}\nlet timer:ReturnType<typeof setTimeout>|undefined,closed=false,generation=0\nconst base=()=>`/api/app/agents/${props.agentId}/routines`\nasync function load(){const version=generation;try{const value=await apiRequest<{routines:WorkspaceRoutine[];runs:WorkspaceRoutineRun[]}>(base());if(version===generation&&!closed){routines.value=value.routines;runs.value=value.runs;error.value=''}}catch(e){if(version===generation&&!closed)error.value=e instanceof Error?e.message:'无法读取定时任务'}}\nasync function cycle(){const version=generation;if(!document.hidden&&!busy.value)await load();if(!closed&&version===generation)timer=setTimeout(cycle,5000)}\nlet editorGeneration=0\nasync function edit(r?:WorkspaceRoutine){const version=++editorGeneration,agentId=props.agentId;editing.value=r?.id??null;Object.assign(form,{deliver:r?.deliver?.platform??'',deviceHost:r?.deviceHost??'',name:r?.name??'',prompt:r?.prompt??'',enabled:r?.enabled??true,kind:r?.schedule.kind??'daily',time:r?.schedule.time??'09:00',timezone:r?.schedule.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,everyMinutes:r?.schedule.everyMinutes??60,at:r?.schedule.at?new Date(r.schedule.at-new Date(r.schedule.at).getTimezoneOffset()*60000).toISOString().slice(0,16):'',weekdays:r?.schedule.weekdays??[1,2,3,4,5]});showEditor.value=true;try{const [result,source]=await Promise.all([apiRequest<{hosts:{id:string;name:string}[]}>(`/api/app/agents/${agentId}/desktop-environment`),r?Promise.resolve(undefined):window.yaoviDesktop?.deviceHost?.()]);if(version!==editorGeneration||agentId!==props.agentId||closed)return;hosts.value=result.hosts;if(!r&&!form.deviceHost)form.deviceHost=source?.deviceHost??''}catch{if(version===editorGeneration)hosts.value=[]}}\nasync function action(work:()=>Promise<unknown>){if(busy.value)return;busy.value=true;error.value='';try{await work();await load();emit('changed')}catch(e){error.value=e instanceof Error?e.message:'定时任务操作失败'}finally{busy.value=false}}\nfunction payload(r:WorkspaceRoutine){return {name:r.name,prompt:r.prompt,enabled:!r.enabled,deviceHost:r.deviceHost??null,schedule:r.schedule}}\nasync function save(){const original=selectedRoutine.value?.schedule.at,originalDisplay=original?new Date(original-new Date(original).getTimezoneOffset()*60000).toISOString().slice(0,16):undefined;const schedule:WorkspaceSchedule={kind:form.kind,timezone:form.timezone,...(form.kind==='once'?{at:originalDisplay===form.at?original:new Date(form.at).getTime()}:form.kind==='interval'?{everyMinutes:form.everyMinutes}:{time:form.time,...(form.kind==='weekly'?{weekdays:form.weekdays}:{})})};await action(async()=>{await apiRequest(base()+(editing.value?'/'+editing.value:''),{method:editing.value?'PUT':'POST',body:{name:form.name,prompt:form.prompt,enabled:form.enabled,deviceHost:form.deviceHost||null,deliver:form.deliver?{platform:form.deliver,...(selectedRoutine.value?.deliver?.platform===form.deliver&&selectedRoutine.value.deliver.chatId?{chatId:selectedRoutine.value.deliver.chatId}:{})}:null,schedule} as any});showEditor.value=false})}\nwatch(()=>props.agentId,()=>{generation++;routines.value=[];runs.value=[];showEditor.value=false;view.value='list';logFilter.value='';clearTimeout(timer);if(!props.editorOnly)void cycle()},{immediate:true})\ndefineExpose({edit:(r?:WorkspaceRoutine)=>{if(props.editorOnly)routines.value=r?[r]:[];edit(r)}})\nonBeforeUnmount(()=>{closed=true;generation++;clearTimeout(timer)})\n</script>\n<template>\n <section v-show=\"!editorOnly\" class=\"routines\" :class=\"{home,inline}\" aria-label=\"机器人定时任务\">\n <template v-if=\"view==='list'&&!(inline&&showEditor)\">\n <div v-if=\"home\" class=\"home-routine-heading\"><h2>定时任务</h2><button aria-label=\"新建定时任务\" @click=\"edit()\"><AppIcon name=\"plus\" :size=\"20\"/></button></div>\n <div v-else class=\"routine-overview\"><div class=\"overview-title\"><AppIcon name=\"calendar\" :size=\"16\"/><h2>定时任务</h2><span>{{routines.length}}</span></div><div class=\"overview-actions\"><button class=\"primary\" @click=\"edit()\"><AppIcon name=\"plus\" :size=\"14\"/>新建定时任务</button><button @click=\"openLogs()\"><AppIcon name=\"file\" :size=\"13\"/>运行日志</button></div></div>\n <p v-if=\"error\" class=\"error-box\" role=\"alert\">{{error}}</p>\n <div v-if=\"!routines.length\" class=\"empty-state\"><AppIcon name=\"calendar\" :size=\"22\"/><p>还没有定时任务</p><small>为这个机器人安排定期执行的工作。</small></div>\n <article v-for=\"routine in sorted\" :key=\"routine.id\" class=\"routine-card\" :aria-label=\"routine.name\">\n <div class=\"card-heading\"><button class=\"routine-title\" @click=\"edit(routine)\"><h3>{{routine.name}}</h3><span>{{scheduleLabel(routine)}} · {{routine.schedule.timezone}}</span></button><span :class=\"['state-pill',{enabled:routine.enabled}]\">{{scheduleState(routine)}}</span></div>\n <p v-if=\"routine.enabled&&routine.nextAt\" class=\"next-run\">下次 {{date(routine.nextAt)}}</p>\n <div class=\"latest-row\"><div v-if=\"latest(routine.id)\"><span :class=\"{failure:latest(routine.id)?.status==='failed'}\">最近执行:{{status[latest(routine.id)!.status]}}</span><small>{{date(latest(routine.id)!.startedAt)}}</small></div><span v-else class=\"muted\">尚未执行</span><button :aria-label=\"'查看'+routine.name+'的运行日志'\" @click=\"openLogs(routine.id)\"><AppIcon name=\"file\" :size=\"12\"/>日志</button></div>\n <p v-if=\"latest(routine.id)?.error\" class=\"result-preview failure\">{{latest(routine.id)!.error}}</p>\n </article>\n </template>\n <button v-if=\"home&&view==='list'&&!(inline&&showEditor)\" class=\"home-routine-logs\" @click=\"openLogs()\"><AppIcon name=\"file\" :size=\"18\"/>查看运行记录</button>\n <template v-if=\"view==='logs'&&!(inline&&showEditor)\">\n <div class=\"logs-heading\"><button class=\"back\" aria-label=\"返回定时任务列表\" @click=\"view='list'\"><AppIcon name=\"chevron-left\" :size=\"16\"/></button><div><h2>运行日志</h2><p>查看每次执行的状态与结果。</p></div></div>\n <div class=\"log-filters\"><label><AppIcon name=\"search\" :size=\"14\"/><input v-model=\"query\" aria-label=\"搜索运行日志\" placeholder=\"搜索任务或错误\"></label><select v-model=\"statusFilter\" aria-label=\"筛选执行状态\"><option value=\"all\">全部状态</option><option v-for=\"(label,key) in status\" :key=\"key\" :value=\"key\">{{label}}</option></select></div>\n <div v-if=\"logFilter\" class=\"scope-hint\">当前任务的日志<button @click=\"logFilter=''\">显示全部</button></div>\n <p v-if=\"error\" class=\"error-box\" role=\"alert\">{{error}}</p>\n <div v-if=\"!logs.length\" class=\"empty-state\"><AppIcon name=\"file\" :size=\"24\"/><p>{{runs.length?'没有匹配的执行记录':'还没有执行记录'}}</p></div>\n <details v-for=\"run in logs\" :key=\"run.id\" class=\"run-card\"><summary><div><strong>{{routines.find(r=>r.id===run.routineId)?.name??'定时任务'}}</strong><small>{{date(run.startedAt)}} · {{run.scheduledAt===0?'手动执行':'定时执行'}}</small></div><span :class=\"['run-state',{failure:run.status==='failed',success:run.status==='complete'}]\">{{status[run.status]??run.status}}</span></summary><p v-if=\"run.error\" class=\"failure\">{{run.error}}</p><p v-else>{{run.status==='complete'?'结果已发送到机器人的聊天。':'执行进度会自动更新。'}}</p><RouterLink v-if=\"run.conversationId\" :to=\"'/conversations/'+run.conversationId\">查看聊天结果 ↗</RouterLink></details>\n </template>\n <Teleport to=\"body\" :disabled=\"inline\"><dialog :open=\"inline\" v-if=\"showEditor\" ref=\"dialog\" class=\"routine-editor\" :aria-label=\"editing?'编辑定时任务':'新建定时任务'\" @cancel.prevent=\"showEditor=false\">\n <form @submit.prevent=\"save\"><header><div><AppIcon name=\"calendar\" :size=\"18\"/><h2>{{editing?'编辑定时任务':'新建定时任务'}}</h2></div><button type=\"button\" class=\"icon-button\" aria-label=\"关闭定时任务编辑器\" @click=\"showEditor=false\"><AppIcon name=\"close\"/></button></header>\n <div class=\"editor-body\"><p v-if=\"error\" class=\"error-box\" role=\"alert\">{{error}}</p><label>任务中的“本机”<select v-model=\"form.deviceHost\"><option value=\"\">未指定,请在任务中点名目标电脑</option><option v-for=\"host in hosts\" :key=\"host.id\" :value=\"host.id\">{{host.id==='local'?'服务器 · ':''}}{{host.name}}</option><option v-if=\"form.deviceHost&&!hosts.some(h=>h.id===form.deviceHost)\" :value=\"form.deviceHost\">原设备(未连接)</option></select><small>固定使用保存的目标,不随查看任务的客户端变化。</small></label><label>同时投递到渠道<select v-model=\"form.deliver\" aria-label=\"投递到渠道\"><option value=\"\">不投递,仅在聊天中</option><option v-for=\"platform in channelPlatforms\" :key=\"platform\" :value=\"platform\">{{messagingChannelLabels[platform]}} 主频道</option></select><small>使用本 Bot 自己的渠道账号;主频道在 Bot 设置 → 渠道中填写。</small></label><label>名称<input v-model=\"form.name\" required maxlength=\"100\" placeholder=\"为这项工作命名\"></label><label>任务内容<textarea v-model=\"form.prompt\" required maxlength=\"24000\" rows=\"5\" placeholder=\"告诉机器人需要定期完成什么\"/></label>\n <div class=\"schedule-grid\"><label>重复<select v-model=\"form.kind\" aria-label=\"重复\"><option value=\"once\">仅一次</option><option value=\"interval\">固定间隔</option><option value=\"daily\">每天</option><option value=\"weekly\">每周</option></select></label><label v-if=\"form.kind==='once'\">执行时间<input v-model=\"form.at\" type=\"datetime-local\" required></label><label v-else-if=\"form.kind==='interval'\">间隔(分钟)<input v-model.number=\"form.everyMinutes\" type=\"number\" min=\"1\" max=\"525600\" required></label><label v-else>执行时间<input v-model=\"form.time\" type=\"time\" required></label></div>\n <fieldset v-if=\"form.kind==='weekly'\"><legend>每周</legend><label v-for=\"(day,index) in ['日','一','二','三','四','五','六']\" :key=\"day\" class=\"check\"><input v-model=\"form.weekdays\" type=\"checkbox\" :value=\"index\">{{day}}</label></fieldset><label>时区<input v-model=\"form.timezone\" required placeholder=\"Asia/Shanghai\"></label><p class=\"editor-note\">服务端按计划执行,结果回到当前机器人的聊天。</p>\n </div>\n <footer><div class=\"secondary-actions\" v-if=\"selectedRoutine\"><button type=\"button\" :disabled=\"busy\" @click=\"runNow(selectedRoutine)\">立即执行</button><button type=\"button\" :disabled=\"busy\" @click=\"action(async()=>{await apiRequest(base()+'/'+selectedRoutine!.id,{method:'PUT',body:payload(selectedRoutine!) as any});showEditor=false})\">{{selectedRoutine.enabled?'暂停':'启用'}}</button><button type=\"button\" class=\"danger-button\" :disabled=\"busy\" @click=\"action(async()=>{await apiRequest(base()+'/'+selectedRoutine!.id,{method:'DELETE'});showEditor=false})\">删除</button></div><div class=\"save-actions\"><button type=\"button\" :disabled=\"busy\" @click=\"showEditor=false\">取消</button><button class=\"primary\" :disabled=\"busy\">保存</button></div></footer>\n </form>\n </dialog></Teleport>\n </section>\n</template>\n<style scoped>\n.routines{padding:16px;overflow:auto;min-height:0;display:flex;flex-direction:column;gap:14px;color:var(--text-primary)}.routine-overview{border-radius:12px;background:var(--surface-raised);padding:16px}.overview-title,.overview-actions,.card-heading,.latest-row,.logs-heading,.log-filters{display:flex;align-items:center;gap:8px}.overview-title .app-icon{color:var(--accent)}h2{font-size:15px;font-weight:600;margin:0}.overview-title h2{flex:1}.overview-title>span{font-size:11.5px;color:var(--text-muted)}.overview-actions{margin-top:14px}.overview-actions .primary{flex:1}button,input,select,textarea{font:inherit;color:inherit;border:1px solid var(--line);border-radius:8px;background:var(--surface-raised);box-sizing:border-box;min-height:40px;min-width:0;padding:8px 10px;font-size:12px}button{cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:6px}button:disabled{opacity:.5;cursor:default}.primary{background:var(--accent);border-color:var(--accent);color:var(--text-on-solid);font-weight:500}.routine-card,.run-card{border:1px solid var(--line);border-radius:12px;background:var(--surface-raised);padding:14px}.card-heading{align-items:flex-start}.routine-title{flex:1;min-width:0;text-align:left;display:block;padding:0;border:0;background:transparent;min-height:40px}.routine-title h3{font-size:13px;line-height:1.5;font-weight:600;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.routine-title span{display:block;font-size:11.5px;line-height:1.7;color:var(--text-muted);margin-top:4px}.state-pill{flex:none;border-radius:999px;padding:3px 8px;font-size:10px;line-height:1.5;background:var(--surface-soft);color:var(--text-muted)}.state-pill.enabled{color:var(--accent)}.next-run{font-size:11.5px;color:var(--text-muted);margin:10px 0 6px}.latest-row{justify-content:space-between;font-size:11.5px;align-items:flex-start;margin-top:8px}.latest-row small{display:block;font-size:10.5px;color:var(--text-muted);margin-top:5px}.latest-row button{font-size:11px;min-height:32px;padding:5px 7px;border:0;background:transparent;color:var(--text-secondary)}.result-preview{font-size:11.5px;line-height:1.6;margin-bottom:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.muted{color:var(--text-muted)}.empty-state{padding:28px 18px;border:1px dashed var(--line);border-radius:12px;text-align:center;color:var(--text-muted)}.empty-state .app-icon{opacity:.6}.empty-state p{font-size:13px}.empty-state small{font-size:11.5px}.logs-heading{align-items:flex-start}.logs-heading h2{font-size:17px}.logs-heading p{font-size:12px;color:var(--text-muted);margin:6px 0}.back{min-width:36px;min-height:36px;padding:6px;border:0;background:transparent}.log-filters{flex-wrap:wrap}.log-filters label{display:flex;align-items:center;gap:6px;flex:1;min-width:150px;padding:0 10px;border:1px solid var(--line);border-radius:8px;color:var(--text-muted)}.log-filters input{width:100%;border:0;padding-left:0;background:transparent}.scope-hint{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-muted)}.scope-hint button{border:0;color:var(--accent);background:transparent}.run-card summary{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;cursor:pointer;min-height:44px;list-style:none}.run-card summary::-webkit-details-marker{display:none}.run-card strong{display:block;font-size:13px}.run-card small{display:block;font-size:11px;line-height:1.6;color:var(--text-muted);margin-top:5px}.run-state{flex:none;font-size:11.5px}.failure,.error-box{color:var(--danger)}.success{color:var(--success,var(--accent))}.run-card p{font-size:12px;line-height:1.7}.run-card a{font-size:12px;color:var(--accent)}.error-box{font-size:12px;line-height:1.6;padding:10px;border-radius:8px;background:color-mix(in srgb,var(--danger) 8%,transparent)}.routine-editor{width:min(640px,calc(100vw - 32px));max-height:92dvh;padding:0;border:1px solid var(--line);border-radius:16px;background:var(--surface);color:var(--text-primary);box-shadow:0 24px 100px #0005;overflow:auto}.routine-editor::backdrop{background:#0008;backdrop-filter:blur(3px)}.routine-editor header,.routine-editor footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 22px;border-bottom:1px solid var(--line)}.routine-editor header>div{display:flex;align-items:center;gap:10px}.icon-button{border:0;background:transparent;min-width:40px}.editor-body{display:grid;gap:18px;padding:22px}.editor-body label{display:grid;gap:8px;font-size:12px;font-weight:500}.editor-body textarea{resize:vertical;line-height:1.7}.schedule-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.editor-body input,.editor-body textarea,.editor-body select{width:100%;font-size:13px;min-height:44px}.editor-note{font-size:11.5px;color:var(--text-muted);margin:0}.routine-editor footer{border-bottom:0;border-top:1px solid var(--line);flex-wrap:wrap}.save-actions,.secondary-actions{display:flex;gap:8px}.save-actions{margin-left:auto}.danger-button{color:var(--danger)}fieldset{border:1px solid var(--line);border-radius:8px;display:flex;gap:10px;flex-wrap:wrap}.editor-body .check{display:flex;align-items:center;gap:4px;min-height:44px}.check input{width:16px;min-height:16px}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible{outline:2px solid var(--accent);outline-offset:2px}@media(max-width:600px){button{min-height:44px}.latest-row button{min-height:44px}.routine-editor{width:calc(100vw - 20px)}.editor-body{padding:16px}.routine-editor header,.routine-editor footer{padding:14px 16px}.schedule-grid{grid-template-columns:1fr}.routines{gap:12px}}\n.home .routine-overview{background:transparent;padding:0}.home .routine-card,.home .run-card{border:0;border-radius:0;padding:14px 0;background:transparent}.home .routine-card .routine-title h3{font-size:14px}.inline .routine-editor{position:static;width:100%;max-height:none;border:0;border-radius:0;box-shadow:none}.inline .editor-body{padding:14px 0}.inline .routine-editor header,.inline .routine-editor footer{padding:12px 0}.inline .schedule-grid{grid-template-columns:1fr}\n.home-routine-heading{display:flex;align-items:center;justify-content:space-between}.home-routine-heading h2{font-size:17px}.home-routine-heading button{border:0;border-radius:50%;background:var(--surface-soft);width:44px;height:44px}.home-routine-logs{background:transparent;border:0;justify-content:flex-start;font-size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AAA,EAAS,EAAwO,SAAA,CAAhO,KAAK,SAAU,SAAU,EAAA,MAAO,QAAK,AAAA,EAAA,MAAA,GAAA,CAAE,EAAM,SAAA,CAAA,MAAiB,EAAA,CAAA,CAAU,CAAC,EAAI,EAAA,IAAO,EAAA,MAAiB,GAAE,CAAA,OAAA,MAAA,KAAoB,GAAQ,EAAA,KAAe,CAAA,CAAA,EAAY,EAAA,MAAU,EAAA,CAAA,CAAA,CAAY,EAAA,EAAA,EAAA,MAAgB,QAAO,KAAA,IAAA,EAAA,EAAA,EAAA,EAAqB,EAAwL,SAAA,CAAhL,KAAK,SAAS,MAAM,gBAAiB,SAAU,EAAA,MAAO,QAAK,AAAA,EAAA,MAAA,GAAA,CAAE,EAAM,SAAA,CAAA,MAAiB,EAAA,CAAA,CAAU,CAAC,EAAI,EAAA,IAAO,EAAA,MAAiB,GAAE,CAAA,OAAA,QAAA,CAAA,EAAoB,EAAA,MAAU,EAAA,CAAA,CAAA,CAAU,EAAA,KAAE,EAAA,EAAA,CAAe,CAAA,GAAA,EAAA,GAAA,EAAA,EAAA,EAAgK,MAAhK,GAAgK,CAAtI,EAA4E,SAAA,CAApE,KAAK,SAAU,SAAU,EAAA,MAAO,QAAK,AAAA,EAAA,MAAA,GAAE,EAAA,MAAU,EAAQ,EAAA,KAAE,EAAA,EAAA,EAAS,EAAoD,SAAA,CAA5C,MAAM,UAAW,SAAU,EAAA,KAAM,EAAA,KAAE,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,0CA5B3rB,EAAA,CAAA,GAAA,CAAA,CAAA,GAAA,CAAA,EAAA,UAAU,CAAA,CAAA"}
1
+ {"version":3,"file":"WorkspaceRoutinesPanel-VpRoMe1x.js","names":[],"sources":["../../src/shared/channelPlatforms.ts","../../src/client/components/workspace/WorkspaceRoutinesPanel.vue","../../src/client/components/workspace/WorkspaceRoutinesPanel.vue"],"sourcesContent":["export const channelPlatforms=['telegram','feishu','dingtalk','wecom','slack','discord','email','signal','whatsapp'] as const\nexport type MessagingChannelPlatform=typeof channelPlatforms[number]\nexport const messagingChannelLabels:Record<MessagingChannelPlatform,string>={telegram:'Telegram',feishu:'飞书',dingtalk:'钉钉',wecom:'企业微信',slack:'Slack',discord:'Discord',email:'Email',signal:'Signal',whatsapp:'WhatsApp'}\n","<script setup lang=\"ts\">\nimport { channelPlatforms,messagingChannelLabels,type MessagingChannelPlatform } from '@shared/channelPlatforms'\nimport {ref,reactive,watch,onBeforeUnmount,computed,nextTick} from 'vue'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport {apiRequest} from '@/api/client'\nimport {createUuid} from '@/utils/id'\nimport type {WorkspaceRoutine,WorkspaceRoutineRun,WorkspaceSchedule} from '@shared/workspacePanels'\nconst props=defineProps<{agentId:string;editorOnly?:boolean;home?:boolean;inline?:boolean}>()\nconst emit=defineEmits<{changed:[];executed:[id:string];'editing-change':[value:boolean]}>()\nconst routines=ref<WorkspaceRoutine[]>([]),runs=ref<WorkspaceRoutineRun[]>([]),editing=ref<string|null>(null),showEditor=ref(false),error=ref(''),busy=ref(false)\nconst hosts=ref<{id:string;name:string}[]>([])\nconst form=reactive({deliver:'' as ''|MessagingChannelPlatform,deviceHost:'',name:'',prompt:'',enabled:true,kind:'daily' as WorkspaceSchedule['kind'],time:'09:00',timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,everyMinutes:60,at:'',weekdays:[1,2,3,4,5]})\nconst status:Record<string,string>={queued:'排队中',running:'执行中',waiting:'等待处理',complete:'已完成',failed:'失败',interrupted:'已停止',uncertain:'状态待确认',skipped:'已跳过'}\nconst view=ref<'list'|'logs'>('list'),logFilter=ref(''),query=ref(''),statusFilter=ref('all'),dialog=ref<HTMLDialogElement>()\nconst sorted=computed(()=>[...routines.value].sort((a,b)=>Number(b.enabled)-Number(a.enabled)||(a.nextAt??Infinity)-(b.nextAt??Infinity)||a.name.localeCompare(b.name)))\nconst selectedRoutine=computed(()=>routines.value.find(r=>r.id===editing.value))\nconst logs=computed(()=>runs.value.filter(r=>(!logFilter.value||r.routineId===logFilter.value)&&(statusFilter.value==='all'||r.status===statusFilter.value)&&(routines.value.find(item=>item.id===r.routineId)?.name+' '+(r.error??'')).toLowerCase().includes(query.value.trim().toLowerCase())))\nconst date=(at?:number)=>at?new Date(at).toLocaleString('zh-CN',{hour12:false}):''\nconst latest=(id:string)=>runs.value.find(r=>r.routineId===id)\nconst scheduleLabel=(r:WorkspaceRoutine)=>r.schedule.kind==='interval'?`每 ${r.schedule.everyMinutes} 分钟`:r.schedule.kind==='once'?date(r.schedule.at):`${r.schedule.kind==='weekly'?'每周 '+(r.schedule.weekdays??[]).map(i=>'日一二三四五六'[i]).join('、'):'每天'} ${r.schedule.time}`\nconst scheduleState=(r:WorkspaceRoutine)=>r.enabled?'已启用':r.schedule.kind==='once'&&r.lastAt?'已结束':'已暂停'\nfunction openLogs(id=''){logFilter.value=id;view.value='logs';query.value='';statusFilter.value='all'}\nwatch(showEditor,async(value)=>{emit('editing-change',value);await nextTick();if(!props.inline){if(value)dialog.value?.showModal();else dialog.value?.close()}})\nasync function runNow(r:WorkspaceRoutine){await action(async()=>{await apiRequest(base()+'/'+r.id+'/run',{method:'POST',body:{requestId:createUuid()}});showEditor.value=false;openLogs(r.id);emit('executed',r.id)})}\nlet timer:ReturnType<typeof setTimeout>|undefined,closed=false,generation=0\nconst base=()=>`/api/app/agents/${props.agentId}/routines`\nasync function load(){const version=generation;try{const value=await apiRequest<{routines:WorkspaceRoutine[];runs:WorkspaceRoutineRun[]}>(base());if(version===generation&&!closed){routines.value=value.routines;runs.value=value.runs;error.value=''}}catch(e){if(version===generation&&!closed)error.value=e instanceof Error?e.message:'无法读取定时任务'}}\nasync function cycle(){const version=generation;if(!document.hidden&&!busy.value)await load();if(!closed&&version===generation)timer=setTimeout(cycle,5000)}\nlet editorGeneration=0\nasync function edit(r?:WorkspaceRoutine){const version=++editorGeneration,agentId=props.agentId;editing.value=r?.id??null;Object.assign(form,{deliver:r?.deliver?.platform??'',deviceHost:r?.deviceHost??'',name:r?.name??'',prompt:r?.prompt??'',enabled:r?.enabled??true,kind:r?.schedule.kind??'daily',time:r?.schedule.time??'09:00',timezone:r?.schedule.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,everyMinutes:r?.schedule.everyMinutes??60,at:r?.schedule.at?new Date(r.schedule.at-new Date(r.schedule.at).getTimezoneOffset()*60000).toISOString().slice(0,16):'',weekdays:r?.schedule.weekdays??[1,2,3,4,5]});showEditor.value=true;try{const [result,source]=await Promise.all([apiRequest<{hosts:{id:string;name:string}[]}>(`/api/app/agents/${agentId}/desktop-environment`),r?Promise.resolve(undefined):window.yaoviDesktop?.deviceHost?.()]);if(version!==editorGeneration||agentId!==props.agentId||closed)return;hosts.value=result.hosts;if(!r&&!form.deviceHost)form.deviceHost=source?.deviceHost??''}catch{if(version===editorGeneration)hosts.value=[]}}\nasync function action(work:()=>Promise<unknown>){if(busy.value)return;busy.value=true;error.value='';try{await work();await load();emit('changed')}catch(e){error.value=e instanceof Error?e.message:'定时任务操作失败'}finally{busy.value=false}}\nfunction payload(r:WorkspaceRoutine){return {name:r.name,prompt:r.prompt,enabled:!r.enabled,deviceHost:r.deviceHost??null,schedule:r.schedule}}\nasync function save(){const original=selectedRoutine.value?.schedule.at,originalDisplay=original?new Date(original-new Date(original).getTimezoneOffset()*60000).toISOString().slice(0,16):undefined;const schedule:WorkspaceSchedule={kind:form.kind,timezone:form.timezone,...(form.kind==='once'?{at:originalDisplay===form.at?original:new Date(form.at).getTime()}:form.kind==='interval'?{everyMinutes:form.everyMinutes}:{time:form.time,...(form.kind==='weekly'?{weekdays:form.weekdays}:{})})};await action(async()=>{await apiRequest(base()+(editing.value?'/'+editing.value:''),{method:editing.value?'PUT':'POST',body:{name:form.name,prompt:form.prompt,enabled:form.enabled,deviceHost:form.deviceHost||null,deliver:form.deliver?{platform:form.deliver,...(selectedRoutine.value?.deliver?.platform===form.deliver&&selectedRoutine.value.deliver.chatId?{chatId:selectedRoutine.value.deliver.chatId}:{})}:null,schedule} as any});showEditor.value=false})}\nwatch(()=>props.agentId,()=>{generation++;routines.value=[];runs.value=[];showEditor.value=false;view.value='list';logFilter.value='';clearTimeout(timer);if(!props.editorOnly)void cycle()},{immediate:true})\ndefineExpose({edit:(r?:WorkspaceRoutine)=>{if(props.editorOnly)routines.value=r?[r]:[];edit(r)}})\nonBeforeUnmount(()=>{closed=true;generation++;clearTimeout(timer)})\n</script>\n<template>\n <section v-show=\"!editorOnly\" class=\"routines\" :class=\"{home,inline}\" aria-label=\"机器人定时任务\">\n <template v-if=\"view==='list'&&!(inline&&showEditor)\">\n <div v-if=\"home\" class=\"home-routine-heading\"><h2>定时任务</h2><button aria-label=\"新建定时任务\" @click=\"edit()\"><AppIcon name=\"plus\" :size=\"20\"/></button></div>\n <div v-else class=\"routine-overview\"><div class=\"overview-title\"><AppIcon name=\"calendar\" :size=\"16\"/><h2>定时任务</h2><span>{{routines.length}}</span></div><div class=\"overview-actions\"><button class=\"primary\" @click=\"edit()\"><AppIcon name=\"plus\" :size=\"14\"/>新建定时任务</button><button @click=\"openLogs()\"><AppIcon name=\"file\" :size=\"13\"/>运行日志</button></div></div>\n <p v-if=\"error\" class=\"error-box\" role=\"alert\">{{error}}</p>\n <div v-if=\"!routines.length\" class=\"empty-state\"><AppIcon name=\"calendar\" :size=\"22\"/><p>还没有定时任务</p><small>为这个机器人安排定期执行的工作。</small></div>\n <article v-for=\"routine in sorted\" :key=\"routine.id\" class=\"routine-card\" :aria-label=\"routine.name\">\n <div class=\"card-heading\"><button class=\"routine-title\" @click=\"edit(routine)\"><h3>{{routine.name}}</h3><span>{{scheduleLabel(routine)}} · {{routine.schedule.timezone}}</span></button><span :class=\"['state-pill',{enabled:routine.enabled}]\">{{scheduleState(routine)}}</span></div>\n <p v-if=\"routine.enabled&&routine.nextAt\" class=\"next-run\">下次 {{date(routine.nextAt)}}</p>\n <div class=\"latest-row\"><div v-if=\"latest(routine.id)\"><span :class=\"{failure:latest(routine.id)?.status==='failed'}\">最近执行:{{status[latest(routine.id)!.status]}}</span><small>{{date(latest(routine.id)!.startedAt)}}</small></div><span v-else class=\"muted\">尚未执行</span><button :aria-label=\"'查看'+routine.name+'的运行日志'\" @click=\"openLogs(routine.id)\"><AppIcon name=\"file\" :size=\"12\"/>日志</button></div>\n <p v-if=\"latest(routine.id)?.error\" class=\"result-preview failure\">{{latest(routine.id)!.error}}</p>\n </article>\n </template>\n <button v-if=\"home&&view==='list'&&!(inline&&showEditor)\" class=\"home-routine-logs\" @click=\"openLogs()\"><AppIcon name=\"file\" :size=\"18\"/>查看运行记录</button>\n <template v-if=\"view==='logs'&&!(inline&&showEditor)\">\n <div class=\"logs-heading\"><button class=\"back\" aria-label=\"返回定时任务列表\" @click=\"view='list'\"><AppIcon name=\"chevron-left\" :size=\"16\"/></button><div><h2>运行日志</h2><p>查看每次执行的状态与结果。</p></div></div>\n <div class=\"log-filters\"><label><AppIcon name=\"search\" :size=\"14\"/><input v-model=\"query\" aria-label=\"搜索运行日志\" placeholder=\"搜索任务或错误\"></label><select v-model=\"statusFilter\" aria-label=\"筛选执行状态\"><option value=\"all\">全部状态</option><option v-for=\"(label,key) in status\" :key=\"key\" :value=\"key\">{{label}}</option></select></div>\n <div v-if=\"logFilter\" class=\"scope-hint\">当前任务的日志<button @click=\"logFilter=''\">显示全部</button></div>\n <p v-if=\"error\" class=\"error-box\" role=\"alert\">{{error}}</p>\n <div v-if=\"!logs.length\" class=\"empty-state\"><AppIcon name=\"file\" :size=\"24\"/><p>{{runs.length?'没有匹配的执行记录':'还没有执行记录'}}</p></div>\n <details v-for=\"run in logs\" :key=\"run.id\" class=\"run-card\"><summary><div><strong>{{routines.find(r=>r.id===run.routineId)?.name??'定时任务'}}</strong><small>{{date(run.startedAt)}} · {{run.scheduledAt===0?'手动执行':'定时执行'}}</small></div><span :class=\"['run-state',{failure:run.status==='failed',success:run.status==='complete'}]\">{{status[run.status]??run.status}}</span></summary><p v-if=\"run.error\" class=\"failure\">{{run.error}}</p><p v-else>{{run.status==='complete'?'结果已发送到机器人的聊天。':'执行进度会自动更新。'}}</p><RouterLink v-if=\"run.conversationId\" :to=\"'/conversations/'+run.conversationId\">查看聊天结果 ↗</RouterLink></details>\n </template>\n <Teleport to=\"body\" :disabled=\"inline\"><dialog :open=\"inline\" v-if=\"showEditor\" ref=\"dialog\" class=\"routine-editor\" :aria-label=\"editing?'编辑定时任务':'新建定时任务'\" @cancel.prevent=\"showEditor=false\">\n <form @submit.prevent=\"save\"><header><div><AppIcon name=\"calendar\" :size=\"18\"/><h2>{{editing?'编辑定时任务':'新建定时任务'}}</h2></div><button type=\"button\" class=\"icon-button\" aria-label=\"关闭定时任务编辑器\" @click=\"showEditor=false\"><AppIcon name=\"close\"/></button></header>\n <div class=\"editor-body\"><p v-if=\"error\" class=\"error-box\" role=\"alert\">{{error}}</p><label>任务中的“本机”<select v-model=\"form.deviceHost\"><option value=\"\">未指定,请在任务中点名目标电脑</option><option v-for=\"host in hosts\" :key=\"host.id\" :value=\"host.id\">{{host.id==='local'?'服务器 · ':''}}{{host.name}}</option><option v-if=\"form.deviceHost&&!hosts.some(h=>h.id===form.deviceHost)\" :value=\"form.deviceHost\">原设备(未连接)</option></select><small>固定使用保存的目标,不随查看任务的客户端变化。</small></label><label>同时投递到渠道<select v-model=\"form.deliver\" aria-label=\"投递到渠道\"><option value=\"\">不投递,仅在聊天中</option><option v-for=\"platform in channelPlatforms\" :key=\"platform\" :value=\"platform\">{{messagingChannelLabels[platform]}} 主频道</option></select><small>使用本 Bot 自己的渠道账号;主频道在 Bot 设置 → 渠道中填写。</small></label><label>名称<input v-model=\"form.name\" required maxlength=\"100\" placeholder=\"为这项工作命名\"></label><label>任务内容<textarea v-model=\"form.prompt\" required maxlength=\"24000\" rows=\"5\" placeholder=\"告诉机器人需要定期完成什么\"/></label>\n <div class=\"schedule-grid\"><label>重复<select v-model=\"form.kind\" aria-label=\"重复\"><option value=\"once\">仅一次</option><option value=\"interval\">固定间隔</option><option value=\"daily\">每天</option><option value=\"weekly\">每周</option></select></label><label v-if=\"form.kind==='once'\">执行时间<input v-model=\"form.at\" type=\"datetime-local\" required></label><label v-else-if=\"form.kind==='interval'\">间隔(分钟)<input v-model.number=\"form.everyMinutes\" type=\"number\" min=\"1\" max=\"525600\" required></label><label v-else>执行时间<input v-model=\"form.time\" type=\"time\" required></label></div>\n <fieldset v-if=\"form.kind==='weekly'\"><legend>每周</legend><label v-for=\"(day,index) in ['日','一','二','三','四','五','六']\" :key=\"day\" class=\"check\"><input v-model=\"form.weekdays\" type=\"checkbox\" :value=\"index\">{{day}}</label></fieldset><label>时区<input v-model=\"form.timezone\" required placeholder=\"Asia/Shanghai\"></label><p class=\"editor-note\">服务端按计划执行,结果回到当前机器人的聊天。</p>\n </div>\n <footer><div class=\"secondary-actions\" v-if=\"selectedRoutine\"><button type=\"button\" :disabled=\"busy\" @click=\"runNow(selectedRoutine)\">立即执行</button><button type=\"button\" :disabled=\"busy\" @click=\"action(async()=>{await apiRequest(base()+'/'+selectedRoutine!.id,{method:'PUT',body:payload(selectedRoutine!) as any});showEditor=false})\">{{selectedRoutine.enabled?'暂停':'启用'}}</button><button type=\"button\" class=\"danger-button\" :disabled=\"busy\" @click=\"action(async()=>{await apiRequest(base()+'/'+selectedRoutine!.id,{method:'DELETE'});showEditor=false})\">删除</button></div><div class=\"save-actions\"><button type=\"button\" :disabled=\"busy\" @click=\"showEditor=false\">取消</button><button class=\"primary\" :disabled=\"busy\">保存</button></div></footer>\n </form>\n </dialog></Teleport>\n </section>\n</template>\n<style scoped>\n.routines{padding:16px;overflow:auto;min-height:0;display:flex;flex-direction:column;gap:14px;color:var(--text-primary)}.routine-overview{border-radius:12px;background:var(--surface-raised);padding:16px}.overview-title,.overview-actions,.card-heading,.latest-row,.logs-heading,.log-filters{display:flex;align-items:center;gap:8px}.overview-title .app-icon{color:var(--accent)}h2{font-size:15px;font-weight:600;margin:0}.overview-title h2{flex:1}.overview-title>span{font-size:11.5px;color:var(--text-muted)}.overview-actions{margin-top:14px}.overview-actions .primary{flex:1}button,input,select,textarea{font:inherit;color:inherit;border:1px solid var(--line);border-radius:8px;background:var(--surface-raised);box-sizing:border-box;min-height:40px;min-width:0;padding:8px 10px;font-size:12px}button{cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:6px}button:disabled{opacity:.5;cursor:default}.primary{background:var(--accent);border-color:var(--accent);color:var(--text-on-solid);font-weight:500}.routine-card,.run-card{border:1px solid var(--line);border-radius:12px;background:var(--surface-raised);padding:14px}.card-heading{align-items:flex-start}.routine-title{flex:1;min-width:0;text-align:left;display:block;padding:0;border:0;background:transparent;min-height:40px}.routine-title h3{font-size:13px;line-height:1.5;font-weight:600;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.routine-title span{display:block;font-size:11.5px;line-height:1.7;color:var(--text-muted);margin-top:4px}.state-pill{flex:none;border-radius:999px;padding:3px 8px;font-size:10px;line-height:1.5;background:var(--surface-soft);color:var(--text-muted)}.state-pill.enabled{color:var(--accent)}.next-run{font-size:11.5px;color:var(--text-muted);margin:10px 0 6px}.latest-row{justify-content:space-between;font-size:11.5px;align-items:flex-start;margin-top:8px}.latest-row small{display:block;font-size:10.5px;color:var(--text-muted);margin-top:5px}.latest-row button{font-size:11px;min-height:32px;padding:5px 7px;border:0;background:transparent;color:var(--text-secondary)}.result-preview{font-size:11.5px;line-height:1.6;margin-bottom:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.muted{color:var(--text-muted)}.empty-state{padding:28px 18px;border:1px dashed var(--line);border-radius:12px;text-align:center;color:var(--text-muted)}.empty-state .app-icon{opacity:.6}.empty-state p{font-size:13px}.empty-state small{font-size:11.5px}.logs-heading{align-items:flex-start}.logs-heading h2{font-size:17px}.logs-heading p{font-size:12px;color:var(--text-muted);margin:6px 0}.back{min-width:36px;min-height:36px;padding:6px;border:0;background:transparent}.log-filters{flex-wrap:wrap}.log-filters label{display:flex;align-items:center;gap:6px;flex:1;min-width:150px;padding:0 10px;border:1px solid var(--line);border-radius:8px;color:var(--text-muted)}.log-filters input{width:100%;border:0;padding-left:0;background:transparent}.scope-hint{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-muted)}.scope-hint button{border:0;color:var(--accent);background:transparent}.run-card summary{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;cursor:pointer;min-height:44px;list-style:none}.run-card summary::-webkit-details-marker{display:none}.run-card strong{display:block;font-size:13px}.run-card small{display:block;font-size:11px;line-height:1.6;color:var(--text-muted);margin-top:5px}.run-state{flex:none;font-size:11.5px}.failure,.error-box{color:var(--danger)}.success{color:var(--success,var(--accent))}.run-card p{font-size:12px;line-height:1.7}.run-card a{font-size:12px;color:var(--accent)}.error-box{font-size:12px;line-height:1.6;padding:10px;border-radius:8px;background:color-mix(in srgb,var(--danger) 8%,transparent)}.routine-editor{width:min(640px,calc(100vw - 32px));max-height:92dvh;padding:0;border:1px solid var(--line);border-radius:16px;background:var(--surface);color:var(--text-primary);box-shadow:0 24px 100px #0005;overflow:auto}.routine-editor::backdrop{background:#0008;backdrop-filter:blur(3px)}.routine-editor header,.routine-editor footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 22px;border-bottom:1px solid var(--line)}.routine-editor header>div{display:flex;align-items:center;gap:10px}.icon-button{border:0;background:transparent;min-width:40px}.editor-body{display:grid;gap:18px;padding:22px}.editor-body label{display:grid;gap:8px;font-size:12px;font-weight:500}.editor-body textarea{resize:vertical;line-height:1.7}.schedule-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.editor-body input,.editor-body textarea,.editor-body select{width:100%;font-size:13px;min-height:44px}.editor-note{font-size:11.5px;color:var(--text-muted);margin:0}.routine-editor footer{border-bottom:0;border-top:1px solid var(--line);flex-wrap:wrap}.save-actions,.secondary-actions{display:flex;gap:8px}.save-actions{margin-left:auto}.danger-button{color:var(--danger)}fieldset{border:1px solid var(--line);border-radius:8px;display:flex;gap:10px;flex-wrap:wrap}.editor-body .check{display:flex;align-items:center;gap:4px;min-height:44px}.check input{width:16px;min-height:16px}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible{outline:2px solid var(--accent);outline-offset:2px}@media(max-width:600px){button{min-height:44px}.latest-row button{min-height:44px}.routine-editor{width:calc(100vw - 20px)}.editor-body{padding:16px}.routine-editor header,.routine-editor footer{padding:14px 16px}.schedule-grid{grid-template-columns:1fr}.routines{gap:12px}}\n.home .routine-overview{background:transparent;padding:0}.home .routine-card,.home .run-card{border:0;border-radius:0;padding:14px 0;background:transparent}.home .routine-card .routine-title h3{font-size:14px}.inline .routine-editor{position:static;width:100%;max-height:none;border:0;border-radius:0;box-shadow:none}.inline .editor-body{padding:14px 0}.inline .routine-editor header,.inline .routine-editor footer{padding:12px 0}.inline .schedule-grid{grid-template-columns:1fr}\n.home-routine-heading{display:flex;align-items:center;justify-content:space-between}.home-routine-heading h2{font-size:17px}.home-routine-heading button{border:0;border-radius:50%;background:var(--surface-soft);width:44px;height:44px}.home-routine-logs{background:transparent;border:0;justify-content:flex-start;font-size:14px;min-height:48px}\n</style>\n","<script setup lang=\"ts\">\nimport { channelPlatforms,messagingChannelLabels,type MessagingChannelPlatform } from '@shared/channelPlatforms'\nimport {ref,reactive,watch,onBeforeUnmount,computed,nextTick} from 'vue'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport {apiRequest} from '@/api/client'\nimport {createUuid} from '@/utils/id'\nimport type {WorkspaceRoutine,WorkspaceRoutineRun,WorkspaceSchedule} from '@shared/workspacePanels'\nconst props=defineProps<{agentId:string;editorOnly?:boolean;home?:boolean;inline?:boolean}>()\nconst emit=defineEmits<{changed:[];executed:[id:string];'editing-change':[value:boolean]}>()\nconst routines=ref<WorkspaceRoutine[]>([]),runs=ref<WorkspaceRoutineRun[]>([]),editing=ref<string|null>(null),showEditor=ref(false),error=ref(''),busy=ref(false)\nconst hosts=ref<{id:string;name:string}[]>([])\nconst form=reactive({deliver:'' as ''|MessagingChannelPlatform,deviceHost:'',name:'',prompt:'',enabled:true,kind:'daily' as WorkspaceSchedule['kind'],time:'09:00',timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,everyMinutes:60,at:'',weekdays:[1,2,3,4,5]})\nconst status:Record<string,string>={queued:'排队中',running:'执行中',waiting:'等待处理',complete:'已完成',failed:'失败',interrupted:'已停止',uncertain:'状态待确认',skipped:'已跳过'}\nconst view=ref<'list'|'logs'>('list'),logFilter=ref(''),query=ref(''),statusFilter=ref('all'),dialog=ref<HTMLDialogElement>()\nconst sorted=computed(()=>[...routines.value].sort((a,b)=>Number(b.enabled)-Number(a.enabled)||(a.nextAt??Infinity)-(b.nextAt??Infinity)||a.name.localeCompare(b.name)))\nconst selectedRoutine=computed(()=>routines.value.find(r=>r.id===editing.value))\nconst logs=computed(()=>runs.value.filter(r=>(!logFilter.value||r.routineId===logFilter.value)&&(statusFilter.value==='all'||r.status===statusFilter.value)&&(routines.value.find(item=>item.id===r.routineId)?.name+' '+(r.error??'')).toLowerCase().includes(query.value.trim().toLowerCase())))\nconst date=(at?:number)=>at?new Date(at).toLocaleString('zh-CN',{hour12:false}):''\nconst latest=(id:string)=>runs.value.find(r=>r.routineId===id)\nconst scheduleLabel=(r:WorkspaceRoutine)=>r.schedule.kind==='interval'?`每 ${r.schedule.everyMinutes} 分钟`:r.schedule.kind==='once'?date(r.schedule.at):`${r.schedule.kind==='weekly'?'每周 '+(r.schedule.weekdays??[]).map(i=>'日一二三四五六'[i]).join('、'):'每天'} ${r.schedule.time}`\nconst scheduleState=(r:WorkspaceRoutine)=>r.enabled?'已启用':r.schedule.kind==='once'&&r.lastAt?'已结束':'已暂停'\nfunction openLogs(id=''){logFilter.value=id;view.value='logs';query.value='';statusFilter.value='all'}\nwatch(showEditor,async(value)=>{emit('editing-change',value);await nextTick();if(!props.inline){if(value)dialog.value?.showModal();else dialog.value?.close()}})\nasync function runNow(r:WorkspaceRoutine){await action(async()=>{await apiRequest(base()+'/'+r.id+'/run',{method:'POST',body:{requestId:createUuid()}});showEditor.value=false;openLogs(r.id);emit('executed',r.id)})}\nlet timer:ReturnType<typeof setTimeout>|undefined,closed=false,generation=0\nconst base=()=>`/api/app/agents/${props.agentId}/routines`\nasync function load(){const version=generation;try{const value=await apiRequest<{routines:WorkspaceRoutine[];runs:WorkspaceRoutineRun[]}>(base());if(version===generation&&!closed){routines.value=value.routines;runs.value=value.runs;error.value=''}}catch(e){if(version===generation&&!closed)error.value=e instanceof Error?e.message:'无法读取定时任务'}}\nasync function cycle(){const version=generation;if(!document.hidden&&!busy.value)await load();if(!closed&&version===generation)timer=setTimeout(cycle,5000)}\nlet editorGeneration=0\nasync function edit(r?:WorkspaceRoutine){const version=++editorGeneration,agentId=props.agentId;editing.value=r?.id??null;Object.assign(form,{deliver:r?.deliver?.platform??'',deviceHost:r?.deviceHost??'',name:r?.name??'',prompt:r?.prompt??'',enabled:r?.enabled??true,kind:r?.schedule.kind??'daily',time:r?.schedule.time??'09:00',timezone:r?.schedule.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,everyMinutes:r?.schedule.everyMinutes??60,at:r?.schedule.at?new Date(r.schedule.at-new Date(r.schedule.at).getTimezoneOffset()*60000).toISOString().slice(0,16):'',weekdays:r?.schedule.weekdays??[1,2,3,4,5]});showEditor.value=true;try{const [result,source]=await Promise.all([apiRequest<{hosts:{id:string;name:string}[]}>(`/api/app/agents/${agentId}/desktop-environment`),r?Promise.resolve(undefined):window.yaoviDesktop?.deviceHost?.()]);if(version!==editorGeneration||agentId!==props.agentId||closed)return;hosts.value=result.hosts;if(!r&&!form.deviceHost)form.deviceHost=source?.deviceHost??''}catch{if(version===editorGeneration)hosts.value=[]}}\nasync function action(work:()=>Promise<unknown>){if(busy.value)return;busy.value=true;error.value='';try{await work();await load();emit('changed')}catch(e){error.value=e instanceof Error?e.message:'定时任务操作失败'}finally{busy.value=false}}\nfunction payload(r:WorkspaceRoutine){return {name:r.name,prompt:r.prompt,enabled:!r.enabled,deviceHost:r.deviceHost??null,schedule:r.schedule}}\nasync function save(){const original=selectedRoutine.value?.schedule.at,originalDisplay=original?new Date(original-new Date(original).getTimezoneOffset()*60000).toISOString().slice(0,16):undefined;const schedule:WorkspaceSchedule={kind:form.kind,timezone:form.timezone,...(form.kind==='once'?{at:originalDisplay===form.at?original:new Date(form.at).getTime()}:form.kind==='interval'?{everyMinutes:form.everyMinutes}:{time:form.time,...(form.kind==='weekly'?{weekdays:form.weekdays}:{})})};await action(async()=>{await apiRequest(base()+(editing.value?'/'+editing.value:''),{method:editing.value?'PUT':'POST',body:{name:form.name,prompt:form.prompt,enabled:form.enabled,deviceHost:form.deviceHost||null,deliver:form.deliver?{platform:form.deliver,...(selectedRoutine.value?.deliver?.platform===form.deliver&&selectedRoutine.value.deliver.chatId?{chatId:selectedRoutine.value.deliver.chatId}:{})}:null,schedule} as any});showEditor.value=false})}\nwatch(()=>props.agentId,()=>{generation++;routines.value=[];runs.value=[];showEditor.value=false;view.value='list';logFilter.value='';clearTimeout(timer);if(!props.editorOnly)void cycle()},{immediate:true})\ndefineExpose({edit:(r?:WorkspaceRoutine)=>{if(props.editorOnly)routines.value=r?[r]:[];edit(r)}})\nonBeforeUnmount(()=>{closed=true;generation++;clearTimeout(timer)})\n</script>\n<template>\n <section v-show=\"!editorOnly\" class=\"routines\" :class=\"{home,inline}\" aria-label=\"机器人定时任务\">\n <template v-if=\"view==='list'&&!(inline&&showEditor)\">\n <div v-if=\"home\" class=\"home-routine-heading\"><h2>定时任务</h2><button aria-label=\"新建定时任务\" @click=\"edit()\"><AppIcon name=\"plus\" :size=\"20\"/></button></div>\n <div v-else class=\"routine-overview\"><div class=\"overview-title\"><AppIcon name=\"calendar\" :size=\"16\"/><h2>定时任务</h2><span>{{routines.length}}</span></div><div class=\"overview-actions\"><button class=\"primary\" @click=\"edit()\"><AppIcon name=\"plus\" :size=\"14\"/>新建定时任务</button><button @click=\"openLogs()\"><AppIcon name=\"file\" :size=\"13\"/>运行日志</button></div></div>\n <p v-if=\"error\" class=\"error-box\" role=\"alert\">{{error}}</p>\n <div v-if=\"!routines.length\" class=\"empty-state\"><AppIcon name=\"calendar\" :size=\"22\"/><p>还没有定时任务</p><small>为这个机器人安排定期执行的工作。</small></div>\n <article v-for=\"routine in sorted\" :key=\"routine.id\" class=\"routine-card\" :aria-label=\"routine.name\">\n <div class=\"card-heading\"><button class=\"routine-title\" @click=\"edit(routine)\"><h3>{{routine.name}}</h3><span>{{scheduleLabel(routine)}} · {{routine.schedule.timezone}}</span></button><span :class=\"['state-pill',{enabled:routine.enabled}]\">{{scheduleState(routine)}}</span></div>\n <p v-if=\"routine.enabled&&routine.nextAt\" class=\"next-run\">下次 {{date(routine.nextAt)}}</p>\n <div class=\"latest-row\"><div v-if=\"latest(routine.id)\"><span :class=\"{failure:latest(routine.id)?.status==='failed'}\">最近执行:{{status[latest(routine.id)!.status]}}</span><small>{{date(latest(routine.id)!.startedAt)}}</small></div><span v-else class=\"muted\">尚未执行</span><button :aria-label=\"'查看'+routine.name+'的运行日志'\" @click=\"openLogs(routine.id)\"><AppIcon name=\"file\" :size=\"12\"/>日志</button></div>\n <p v-if=\"latest(routine.id)?.error\" class=\"result-preview failure\">{{latest(routine.id)!.error}}</p>\n </article>\n </template>\n <button v-if=\"home&&view==='list'&&!(inline&&showEditor)\" class=\"home-routine-logs\" @click=\"openLogs()\"><AppIcon name=\"file\" :size=\"18\"/>查看运行记录</button>\n <template v-if=\"view==='logs'&&!(inline&&showEditor)\">\n <div class=\"logs-heading\"><button class=\"back\" aria-label=\"返回定时任务列表\" @click=\"view='list'\"><AppIcon name=\"chevron-left\" :size=\"16\"/></button><div><h2>运行日志</h2><p>查看每次执行的状态与结果。</p></div></div>\n <div class=\"log-filters\"><label><AppIcon name=\"search\" :size=\"14\"/><input v-model=\"query\" aria-label=\"搜索运行日志\" placeholder=\"搜索任务或错误\"></label><select v-model=\"statusFilter\" aria-label=\"筛选执行状态\"><option value=\"all\">全部状态</option><option v-for=\"(label,key) in status\" :key=\"key\" :value=\"key\">{{label}}</option></select></div>\n <div v-if=\"logFilter\" class=\"scope-hint\">当前任务的日志<button @click=\"logFilter=''\">显示全部</button></div>\n <p v-if=\"error\" class=\"error-box\" role=\"alert\">{{error}}</p>\n <div v-if=\"!logs.length\" class=\"empty-state\"><AppIcon name=\"file\" :size=\"24\"/><p>{{runs.length?'没有匹配的执行记录':'还没有执行记录'}}</p></div>\n <details v-for=\"run in logs\" :key=\"run.id\" class=\"run-card\"><summary><div><strong>{{routines.find(r=>r.id===run.routineId)?.name??'定时任务'}}</strong><small>{{date(run.startedAt)}} · {{run.scheduledAt===0?'手动执行':'定时执行'}}</small></div><span :class=\"['run-state',{failure:run.status==='failed',success:run.status==='complete'}]\">{{status[run.status]??run.status}}</span></summary><p v-if=\"run.error\" class=\"failure\">{{run.error}}</p><p v-else>{{run.status==='complete'?'结果已发送到机器人的聊天。':'执行进度会自动更新。'}}</p><RouterLink v-if=\"run.conversationId\" :to=\"'/conversations/'+run.conversationId\">查看聊天结果 ↗</RouterLink></details>\n </template>\n <Teleport to=\"body\" :disabled=\"inline\"><dialog :open=\"inline\" v-if=\"showEditor\" ref=\"dialog\" class=\"routine-editor\" :aria-label=\"editing?'编辑定时任务':'新建定时任务'\" @cancel.prevent=\"showEditor=false\">\n <form @submit.prevent=\"save\"><header><div><AppIcon name=\"calendar\" :size=\"18\"/><h2>{{editing?'编辑定时任务':'新建定时任务'}}</h2></div><button type=\"button\" class=\"icon-button\" aria-label=\"关闭定时任务编辑器\" @click=\"showEditor=false\"><AppIcon name=\"close\"/></button></header>\n <div class=\"editor-body\"><p v-if=\"error\" class=\"error-box\" role=\"alert\">{{error}}</p><label>任务中的“本机”<select v-model=\"form.deviceHost\"><option value=\"\">未指定,请在任务中点名目标电脑</option><option v-for=\"host in hosts\" :key=\"host.id\" :value=\"host.id\">{{host.id==='local'?'服务器 · ':''}}{{host.name}}</option><option v-if=\"form.deviceHost&&!hosts.some(h=>h.id===form.deviceHost)\" :value=\"form.deviceHost\">原设备(未连接)</option></select><small>固定使用保存的目标,不随查看任务的客户端变化。</small></label><label>同时投递到渠道<select v-model=\"form.deliver\" aria-label=\"投递到渠道\"><option value=\"\">不投递,仅在聊天中</option><option v-for=\"platform in channelPlatforms\" :key=\"platform\" :value=\"platform\">{{messagingChannelLabels[platform]}} 主频道</option></select><small>使用本 Bot 自己的渠道账号;主频道在 Bot 设置 → 渠道中填写。</small></label><label>名称<input v-model=\"form.name\" required maxlength=\"100\" placeholder=\"为这项工作命名\"></label><label>任务内容<textarea v-model=\"form.prompt\" required maxlength=\"24000\" rows=\"5\" placeholder=\"告诉机器人需要定期完成什么\"/></label>\n <div class=\"schedule-grid\"><label>重复<select v-model=\"form.kind\" aria-label=\"重复\"><option value=\"once\">仅一次</option><option value=\"interval\">固定间隔</option><option value=\"daily\">每天</option><option value=\"weekly\">每周</option></select></label><label v-if=\"form.kind==='once'\">执行时间<input v-model=\"form.at\" type=\"datetime-local\" required></label><label v-else-if=\"form.kind==='interval'\">间隔(分钟)<input v-model.number=\"form.everyMinutes\" type=\"number\" min=\"1\" max=\"525600\" required></label><label v-else>执行时间<input v-model=\"form.time\" type=\"time\" required></label></div>\n <fieldset v-if=\"form.kind==='weekly'\"><legend>每周</legend><label v-for=\"(day,index) in ['日','一','二','三','四','五','六']\" :key=\"day\" class=\"check\"><input v-model=\"form.weekdays\" type=\"checkbox\" :value=\"index\">{{day}}</label></fieldset><label>时区<input v-model=\"form.timezone\" required placeholder=\"Asia/Shanghai\"></label><p class=\"editor-note\">服务端按计划执行,结果回到当前机器人的聊天。</p>\n </div>\n <footer><div class=\"secondary-actions\" v-if=\"selectedRoutine\"><button type=\"button\" :disabled=\"busy\" @click=\"runNow(selectedRoutine)\">立即执行</button><button type=\"button\" :disabled=\"busy\" @click=\"action(async()=>{await apiRequest(base()+'/'+selectedRoutine!.id,{method:'PUT',body:payload(selectedRoutine!) as any});showEditor=false})\">{{selectedRoutine.enabled?'暂停':'启用'}}</button><button type=\"button\" class=\"danger-button\" :disabled=\"busy\" @click=\"action(async()=>{await apiRequest(base()+'/'+selectedRoutine!.id,{method:'DELETE'});showEditor=false})\">删除</button></div><div class=\"save-actions\"><button type=\"button\" :disabled=\"busy\" @click=\"showEditor=false\">取消</button><button class=\"primary\" :disabled=\"busy\">保存</button></div></footer>\n </form>\n </dialog></Teleport>\n </section>\n</template>\n<style scoped>\n.routines{padding:16px;overflow:auto;min-height:0;display:flex;flex-direction:column;gap:14px;color:var(--text-primary)}.routine-overview{border-radius:12px;background:var(--surface-raised);padding:16px}.overview-title,.overview-actions,.card-heading,.latest-row,.logs-heading,.log-filters{display:flex;align-items:center;gap:8px}.overview-title .app-icon{color:var(--accent)}h2{font-size:15px;font-weight:600;margin:0}.overview-title h2{flex:1}.overview-title>span{font-size:11.5px;color:var(--text-muted)}.overview-actions{margin-top:14px}.overview-actions .primary{flex:1}button,input,select,textarea{font:inherit;color:inherit;border:1px solid var(--line);border-radius:8px;background:var(--surface-raised);box-sizing:border-box;min-height:40px;min-width:0;padding:8px 10px;font-size:12px}button{cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:6px}button:disabled{opacity:.5;cursor:default}.primary{background:var(--accent);border-color:var(--accent);color:var(--text-on-solid);font-weight:500}.routine-card,.run-card{border:1px solid var(--line);border-radius:12px;background:var(--surface-raised);padding:14px}.card-heading{align-items:flex-start}.routine-title{flex:1;min-width:0;text-align:left;display:block;padding:0;border:0;background:transparent;min-height:40px}.routine-title h3{font-size:13px;line-height:1.5;font-weight:600;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.routine-title span{display:block;font-size:11.5px;line-height:1.7;color:var(--text-muted);margin-top:4px}.state-pill{flex:none;border-radius:999px;padding:3px 8px;font-size:10px;line-height:1.5;background:var(--surface-soft);color:var(--text-muted)}.state-pill.enabled{color:var(--accent)}.next-run{font-size:11.5px;color:var(--text-muted);margin:10px 0 6px}.latest-row{justify-content:space-between;font-size:11.5px;align-items:flex-start;margin-top:8px}.latest-row small{display:block;font-size:10.5px;color:var(--text-muted);margin-top:5px}.latest-row button{font-size:11px;min-height:32px;padding:5px 7px;border:0;background:transparent;color:var(--text-secondary)}.result-preview{font-size:11.5px;line-height:1.6;margin-bottom:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.muted{color:var(--text-muted)}.empty-state{padding:28px 18px;border:1px dashed var(--line);border-radius:12px;text-align:center;color:var(--text-muted)}.empty-state .app-icon{opacity:.6}.empty-state p{font-size:13px}.empty-state small{font-size:11.5px}.logs-heading{align-items:flex-start}.logs-heading h2{font-size:17px}.logs-heading p{font-size:12px;color:var(--text-muted);margin:6px 0}.back{min-width:36px;min-height:36px;padding:6px;border:0;background:transparent}.log-filters{flex-wrap:wrap}.log-filters label{display:flex;align-items:center;gap:6px;flex:1;min-width:150px;padding:0 10px;border:1px solid var(--line);border-radius:8px;color:var(--text-muted)}.log-filters input{width:100%;border:0;padding-left:0;background:transparent}.scope-hint{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-muted)}.scope-hint button{border:0;color:var(--accent);background:transparent}.run-card summary{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;cursor:pointer;min-height:44px;list-style:none}.run-card summary::-webkit-details-marker{display:none}.run-card strong{display:block;font-size:13px}.run-card small{display:block;font-size:11px;line-height:1.6;color:var(--text-muted);margin-top:5px}.run-state{flex:none;font-size:11.5px}.failure,.error-box{color:var(--danger)}.success{color:var(--success,var(--accent))}.run-card p{font-size:12px;line-height:1.7}.run-card a{font-size:12px;color:var(--accent)}.error-box{font-size:12px;line-height:1.6;padding:10px;border-radius:8px;background:color-mix(in srgb,var(--danger) 8%,transparent)}.routine-editor{width:min(640px,calc(100vw - 32px));max-height:92dvh;padding:0;border:1px solid var(--line);border-radius:16px;background:var(--surface);color:var(--text-primary);box-shadow:0 24px 100px #0005;overflow:auto}.routine-editor::backdrop{background:#0008;backdrop-filter:blur(3px)}.routine-editor header,.routine-editor footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 22px;border-bottom:1px solid var(--line)}.routine-editor header>div{display:flex;align-items:center;gap:10px}.icon-button{border:0;background:transparent;min-width:40px}.editor-body{display:grid;gap:18px;padding:22px}.editor-body label{display:grid;gap:8px;font-size:12px;font-weight:500}.editor-body textarea{resize:vertical;line-height:1.7}.schedule-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.editor-body input,.editor-body textarea,.editor-body select{width:100%;font-size:13px;min-height:44px}.editor-note{font-size:11.5px;color:var(--text-muted);margin:0}.routine-editor footer{border-bottom:0;border-top:1px solid var(--line);flex-wrap:wrap}.save-actions,.secondary-actions{display:flex;gap:8px}.save-actions{margin-left:auto}.danger-button{color:var(--danger)}fieldset{border:1px solid var(--line);border-radius:8px;display:flex;gap:10px;flex-wrap:wrap}.editor-body .check{display:flex;align-items:center;gap:4px;min-height:44px}.check input{width:16px;min-height:16px}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible{outline:2px solid var(--accent);outline-offset:2px}@media(max-width:600px){button{min-height:44px}.latest-row button{min-height:44px}.routine-editor{width:calc(100vw - 20px)}.editor-body{padding:16px}.routine-editor header,.routine-editor footer{padding:14px 16px}.schedule-grid{grid-template-columns:1fr}.routines{gap:12px}}\n.home .routine-overview{background:transparent;padding:0}.home .routine-card,.home .run-card{border:0;border-radius:0;padding:14px 0;background:transparent}.home .routine-card .routine-title h3{font-size:14px}.inline .routine-editor{position:static;width:100%;max-height:none;border:0;border-radius:0;box-shadow:none}.inline .editor-body{padding:14px 0}.inline .routine-editor header,.inline .routine-editor footer{padding:12px 0}.inline .schedule-grid{grid-template-columns:1fr}\n.home-routine-heading{display:flex;align-items:center;justify-content:space-between}.home-routine-heading h2{font-size:17px}.home-routine-heading button{border:0;border-radius:50%;background:var(--surface-soft);width:44px;height:44px}.home-routine-logs{background:transparent;border:0;justify-content:flex-start;font-size:14px;min-height:48px}\n</style>\n"],"mappings":"4TAAA,IAAa,GAAiB,CAAC,WAAW,SA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,AAAA,EAAA,MAAA,GAAA,CAAE,EAAM,SAAA,CAAA,MAAiB,EAAA,CAAA,CAAU,CAAC,EAAI,EAAA,IAAO,EAAA,MAAiB,GAAE,CAAA,OAAA,MAAA,KAAoB,GAAQ,EAAA,KAAe,CAAA,CAAA,EAAY,EAAA,MAAU,EAAA,CAAA,CAAA,CAAY,EAAA,EAAA,EAAA,MAAgB,QAAO,KAAA,IAAA,EAAA,EAAA,EAAA,EAAqB,EAAwL,SAAA,CAAhL,KAAK,SAAS,MAAM,gBAAiB,SAAU,EAAA,MAAO,QAAK,AAAA,EAAA,MAAA,GAAA,CAAE,EAAM,SAAA,CAAA,MAAiB,EAAA,CAAA,CAAU,CAAC,EAAI,EAAA,IAAO,EAAA,MAAiB,GAAE,CAAA,OAAA,QAAA,CAAA,EAAoB,EAAA,MAAU,EAAA,CAAA,CAAA,CAAU,EAAA,KAAE,EAAA,EAAA,CAAe,CAAA,GAAA,EAAA,GAAA,EAAA,EAAA,EAAgK,MAAhK,GAAgK,CAAtI,EAA4E,SAAA,CAApE,KAAK,SAAU,SAAU,EAAA,MAAO,QAAK,AAAA,EAAA,MAAA,GAAE,EAAA,MAAU,EAAQ,EAAA,KAAE,EAAA,EAAA,EAAS,EAAoD,SAAA,CAA5C,MAAM,UAAW,SAAU,EAAA,KAAM,EAAA,KAAE,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,0CA5B3rB,EAAA,CAAA,GAAA,CAAA,CAAA,GAAA,CAAA,EAAA,UAAU,CAAA,CAAA"}
@@ -1,2 +1,2 @@
1
- import{A as e,D as t,Et as n,F as r,G as i,H as a,L as o,M as s,Ot as c,_ as l,a as u,b as d,d as f,et as p,f as m,m as h,p as g,st as _,t as v,u as y,v as b}from"./_plugin-vue_export-helper-CD0r-vVb.js";import{D as x,E as S,I as C,J as w,Y as T,i as E,o as D,ot as O,rt as k}from"./index-DjhQ-RMG.js";import{a as A,i as j,n as M,o as N,r as P,s as F}from"./backgroundTaskPresentation-CJMcreMr.js";var I={key:0},L={class:`filters`,role:`tablist`},R=[`aria-pressed`],z=[`aria-pressed`],B={key:1,role:`alert`},V=[`data-task-id`],H={class:`task-content`},U={key:0,role:`status`},W=[`open`],G={key:0,style:{"white-space":`pre-wrap`,"overflow-wrap":`anywhere`}},ee={key:1},te={key:2,style:{"white-space":`pre-wrap`,"overflow-wrap":`anywhere`}},ne={key:2,class:`requirement-editor`},re=[`onSubmit`],ie=[`onUpdate:modelValue`,`aria-label`,`disabled`],ae=[`disabled`],oe={key:3,class:`requirement-editor`},se=[`onSubmit`],ce=[`value`,`aria-label`,`disabled`,`onInput`],le=[`disabled`],ue={key:4,class:`requirement-editor`},de=[`onSubmit`],fe=[`value`,`aria-label`,`disabled`,`onChange`],pe=[`value`],me=[`disabled`],he={class:`actions`},ge=[`disabled`,`onClick`],_e=[`disabled`,`onClick`],ve={key:2,class:`empty`},K=v(d({__name:`WorkstreamsPanel`,props:{tasks:{},conversationId:{},agentId:{},agents:{},groupByBot:{type:Boolean,default:!1},embedded:{type:Boolean,default:!1},orchestration:{type:Boolean},commandCache:{},focusTaskId:{}},emits:[`close`,`changed`],setup(s,{emit:l}){let d=s,m=l,v=p(`active`),b=p(``),C=p(``),w=p({}),T=p({}),D=p({}),N=d.commandCache??new Map,K=p(),q=``;a(()=>[d.focusTaskId,d.tasks.some(e=>e.id===d.focusTaskId)],async([e,n])=>{!e||!n||q===e||(q=e,F(d.tasks.find(t=>t.id===e).status)&&(v.value=`all`),await t(),K.value?.querySelector(`[data-task-id="${e.replace(/["\\]/g,``)}"]`)?.scrollIntoView?.({block:`center`}))},{immediate:!0});let J=!1;e(()=>{J=!0});let Y=[{value:-2,label:`最低`},{value:-1,label:`较低`},{value:0,label:`普通`},{value:1,label:`较高`},{value:2,label:`最高`}],X=(e,t,n)=>N.has(JSON.stringify([e,t,n])),Z=y(()=>d.tasks.filter(e=>!d.conversationId||e.originConversationId===d.conversationId).filter(e=>!d.agentId||e.agentId===d.agentId).filter(e=>v.value===`all`||!F(e.status)).sort((e,t)=>t.updatedAt-e.updatedAt)),Q=y(()=>{if(d.groupByBot){let e=d.agents??[],t=new Set(e.map(e=>e.id)),n=e.map(e=>({title:e.name,tasks:Z.value.filter(t=>t.agentId===e.id)})).filter(e=>e.tasks.length),r=Z.value.filter(e=>!t.has(e.agentId));if(r.length){let e=new Map;for(let t of r){let n=t.executorName||t.agentId||`其他`,r=e.get(n)??[];r.push(t),e.set(n,r)}for(let[t,r]of e)n.push({title:t,tasks:r})}return n}return[{title:`并行工作流`,tasks:Z.value.filter(e=>e.kind===`workstream`)},{title:`其他后台任务`,tasks:Z.value.filter(e=>e.kind!==`workstream`)}].filter(e=>e.tasks.length)});async function $(e,t){if(b.value)return;let n=w.value[e.id]?.trim()??``,r=(T.value[e.id]??e.instructions).trim(),i=D.value[e.id]??e.priority??0;if(t===`append`&&!n||t===`replace`&&(!r||r===e.instructions.trim()&&!X(e.id,`replace_spec`,{instructions:r}))||[`replace`,`priority`].includes(t)&&(!d.orchestration||e.orchestrationVersion!==2))return;b.value=e.id,C.value=``;let a={append:`append_requirement`,stop:`cancel`,retry:`resume`,replace:`replace_spec`,priority:`set_priority`}[t],o=t===`append`?{text:n}:t===`replace`?{instructions:r}:t===`priority`?{priority:i}:{},s=JSON.stringify([e.id,a,o]),c=n=>{if(N.delete(s),t===`replace`||t===`priority`)for(let[t,n]of N)JSON.parse(t)[0]===e.id&&n.kind===a&&N.delete(t);J||(m(`changed`,n.task),t===`append`&&(w.value[e.id]=``),t===`replace`&&delete T.value[e.id],t===`priority`&&delete D.value[e.id],C.value=``)};try{let r;if(d.orchestration){let n=N.get(s)??{requestId:E(),kind:a,...[`append`,`replace`].includes(t)?{expectedSpecRevision:e.specRevision??e.revision}:{},...e.controlEpoch===void 0?{}:{expectedControlEpoch:e.controlEpoch},payload:o};N.set(s,n),r=await x(`/api/app/background-tasks/${encodeURIComponent(e.id)}/commands`,{method:`POST`,body:n})}else r=await x(`/api/app/background-tasks/${encodeURIComponent(e.id)}/${t===`append`?`update`:t}`,{method:`POST`,body:{expectedRevision:e.revision,...t===`append`?{instructions:`${e.instructions}\n\n补充要求:\n${n}`}:{}}});c(r)}catch(t){if(t instanceof S&&t.status>=400&&t.status<500&&![408,429].includes(t.status)&&N.delete(s),J)return;C.value=t instanceof Error?t.message:`操作失败`;try{let t=await x(`/api/app/background-tasks/${encodeURIComponent(e.id)}`);if(J)return;let n=N.get(s)?.requestId,r=t.task.commands?.find(e=>e.id===n);r&&r.state!==`rejected`?c(t):m(`changed`,t.task)}catch{}}finally{b.value=``}}return(e,t)=>(r(),h(`aside`,{ref_key:`root`,ref:K,class:n([`workstreams`,{"workstreams--embedded":s.embedded}]),"aria-label":`工作流面板`},[s.embedded?g(``,!0):(r(),h(`header`,I,[t[3]||=f(`div`,null,[f(`h2`,null,`工作流`),f(`p`,null,`任务独立执行,完成或需要你处理时会回到聊天。停止聊天回复不会停止这些任务。`)],-1),f(`button`,{type:`button`,class:`icon-close`,"aria-label":`关闭`,onClick:t[0]||=e=>m(`close`)},`×`)])),f(`div`,L,[f(`button`,{type:`button`,"aria-pressed":v.value===`active`,onClick:t[1]||=e=>v.value=`active`},`进行中`,8,R),f(`button`,{type:`button`,"aria-pressed":v.value===`all`,onClick:t[2]||=e=>v.value=`all`},`全部`,8,z)]),C.value?(r(),h(`p`,B,c(C.value),1)):g(``,!0),(r(!0),h(u,null,o(Q.value,e=>(r(),h(`section`,{key:e.title},[f(`h3`,null,c(e.title)+` · `+c(e.tasks.length),1),(r(!0),h(u,null,o(e.tasks,e=>(r(),h(`article`,{key:e.id,"data-task-id":e.id,class:n({"task--focused":e.id===s.focusTaskId})},[f(`div`,H,[f(`strong`,null,c(e.title),1),f(`small`,null,c(_(M)(e)),1),_(P)(e)?(r(),h(`small`,U,c(_(P)(e)),1)):g(``,!0),e.result||e.error?(r(),h(`details`,{key:1,open:e.id===s.focusTaskId},[f(`summary`,null,c(e.error?e.result?`查看结果与问题`:`查看问题`:`查看完整结果`),1),e.error?(r(),h(`p`,G,c(e.error),1)):g(``,!0),e.status===`failed`&&e.phase===`review`&&e.result?(r(),h(`p`,ee,`已完成的执行结果(未通过复核):`)):g(``,!0),e.result?(r(),h(`p`,te,c(e.result),1)):g(``,!0)],8,W)):g(``,!0),_(A)(e)?(r(),h(`details`,ne,[t[4]||=f(`summary`,null,`补充要求`,-1),f(`form`,{"data-command":`append`,onSubmit:O(t=>$(e,`append`),[`prevent`])},[i(f(`textarea`,{"onUpdate:modelValue":t=>w.value[e.id]=t,"aria-label":`补充 ${e.title} 的要求`,disabled:!!b.value,rows:`3`,placeholder:`补充目标、约束或验收要求`},null,8,ie),[[k,w.value[e.id]]]),f(`small`,null,c(s.orchestration&&e.orchestrationVersion===2?`补充先保存,在执行的安全边界采纳。`:`此任务沿用旧执行协议:确认旧执行停止后,再按补充要求继续。`),1),f(`button`,{type:`submit`,disabled:!!b.value||!w.value[e.id]?.trim()},`提交补充`,8,ae)],40,re)])):g(``,!0),s.orchestration&&e.orchestrationVersion===2&&_(A)(e)?(r(),h(`details`,oe,[t[6]||=f(`summary`,null,`修改目标`,-1),f(`form`,{"data-command":`replace`,onSubmit:O(t=>$(e,`replace`),[`prevent`])},[f(`textarea`,{value:T.value[e.id]??e.instructions,"aria-label":`修改 ${e.title} 的目标`,disabled:!!b.value,rows:`4`,onInput:t=>T.value[e.id]=t.target.value},null,40,ce),t[5]||=f(`small`,null,`替换当前目标。系统会确认旧执行停止,再按新目标继续;已发生的操作不会自动撤销。`,-1),f(`button`,{type:`submit`,disabled:!!b.value||!(T.value[e.id]??e.instructions).trim()||(T.value[e.id]??e.instructions).trim()===e.instructions.trim()&&!X(e.id,`replace_spec`,{instructions:(T.value[e.id]??e.instructions).trim()})},`保存新目标`,8,le)],40,se)])):g(``,!0),s.orchestration&&e.orchestrationVersion===2&&_(A)(e)?(r(),h(`details`,ue,[f(`summary`,null,`优先级 · `+c(Y.find(t=>t.value===(e.priority??0))?.label),1),f(`form`,{"data-command":`priority`,onSubmit:O(t=>$(e,`priority`),[`prevent`])},[f(`select`,{value:D.value[e.id]??e.priority??0,"aria-label":`${e.title} 的优先级`,disabled:!!b.value,onChange:t=>D.value[e.id]=Number(t.target.value)},[(r(),h(u,null,o(Y,e=>f(`option`,{key:e.value,value:e.value},c(e.label),9,pe)),64))],40,fe),t[7]||=f(`small`,null,`影响后续排队,不打断正在执行的操作。`,-1),f(`button`,{type:`submit`,disabled:!!b.value||(D.value[e.id]??e.priority??0)===(e.priority??0)&&!X(e.id,`set_priority`,{priority:D.value[e.id]??e.priority??0})},`调整优先级`,8,me)],40,de)])):g(``,!0)]),f(`div`,he,[_(A)(e)?(r(),h(`button`,{key:0,type:`button`,disabled:!!b.value,onClick:t=>$(e,`stop`)},`停止`,8,ge)):g(``,!0),_(j)(e)?(r(),h(`button`,{key:1,type:`button`,disabled:!!b.value,onClick:t=>$(e,`retry`)},c(s.orchestration?`继续`:`重试`),9,_e)):g(``,!0)])],10,V))),128))]))),128)),Z.value.length?g(``,!0):(r(),h(`p`,ve,`暂无符合条件的任务。主 Bot 聊天中的重活会自动出现在这里。`))],2))}}),[[`__scopeId`,`data-v-ee381897`]]),q={class:`workstreams-page`,"aria-label":`工作流`},J={class:`workstreams-header`},Y={class:`workstreams-body`},X={class:`workstreams-sidebar`,"aria-label":`按 Bot 筛选`},Z={"aria-label":`按 Bot 筛选`},Q=[`aria-current`],$=[`aria-current`,`onClick`],ye={key:0},be={class:`workstreams-content`,"aria-live":`polite`},xe={key:0,class:`page-error`,role:`alert`},Se={key:1,class:`loading`,role:`status`},Ce={key:2,class:`empty`},we=v(d({__name:`WorkstreamsView`,setup(t){let n=T(),a=w(),d=p([]),v=p([]),S=p(!0),E=p(``),O=p(`all`),A=p(``),j=p([]),M=new Map,P=y(()=>typeof a.query.from==`string`&&/^\/conversations(?:\/[a-f0-9-]{36})?(?:\?taskId=[a-f0-9-]{36})?$/i.test(a.query.from)?a.query.from:`/conversations`),F=y(()=>j.value.includes(`task-orchestration-v2`)),I=y(()=>typeof a.query.task==`string`&&/^[a-f0-9-]{36}$/i.test(a.query.task)?a.query.task:void 0),L=y(()=>j.value.includes(`background-tasks-v1`)),R=y(()=>d.value.filter(e=>e.name.toLowerCase().includes(A.value.trim().toLowerCase()))),z=y(()=>O.value===`all`?v.value:v.value.filter(e=>e.agentId===O.value)),B=e=>v.value.filter(t=>t.agentId===e).length,V=0,H=!1,U;async function W(){let e=++V;try{let[t,n]=await Promise.all([x(`/api/app/capabilities`),x(`/api/app/agents`)]);if(H||e!==V)return;if(j.value=t.features,d.value=n.agents.filter(e=>!e.archived),t.features.includes(`background-tasks-v1`)){let t=await x(`/api/app/background-tasks`);if(H||e!==V)return;v.value=N(v.value,t.tasks)}else v.value=[];O.value!==`all`&&!d.value.some(e=>e.id===O.value)&&(O.value=`all`),E.value=``}catch(t){!H&&e===V&&(E.value=t instanceof Error?t.message:`无法读取工作流`)}finally{!H&&e===V&&(S.value=!1)}}async function G(){document.hidden||await W(),H||(U=setTimeout(G,5e3))}function ee(e){v.value=N(v.value,[e])}return s(G),e(()=>{H=!0,V++,clearTimeout(U)}),(e,t)=>(r(),h(`main`,q,[f(`header`,J,[f(`button`,{class:`icon-button`,type:`button`,"aria-label":`返回聊天`,onClick:t[0]||=e=>_(n).push(P.value)},[b(C,{name:`chevron-left`,size:20})]),b(C,{name:`board`,size:23}),t[3]||=f(`h1`,null,`工作流`,-1),t[4]||=f(`p`,{class:`workstreams-lead`},`按 Bot 查看并行任务。停止聊天回复不会停止这些任务。`,-1),f(`button`,{class:`icon-button`,type:`button`,"aria-label":`刷新工作流`,onClick:W},[b(C,{name:`refresh`,size:17})])]),f(`div`,Y,[f(`aside`,X,[f(`h2`,null,[t[5]||=l(`我的 Bot `,-1),f(`span`,null,c(d.value.length),1)]),i(f(`input`,{"onUpdate:modelValue":t[1]||=e=>A.value=e,type:`search`,"aria-label":`搜索 Bot`,placeholder:`搜索 Bot`},null,512),[[k,A.value]]),f(`nav`,Z,[f(`button`,{type:`button`,"aria-current":O.value===`all`?`true`:void 0,onClick:t[2]||=e=>O.value=`all`},[b(C,{name:`users`,size:22}),t[6]||=l(`全部 Bot`,-1),f(`span`,null,c(v.value.length),1)],8,Q),(r(!0),h(u,null,o(R.value,e=>(r(),h(`button`,{key:e.id,type:`button`,"aria-current":O.value===e.id?`true`:void 0,onClick:t=>O.value=e.id},[b(D,{name:e.name,avatar:e.avatar,size:26},null,8,[`name`,`avatar`]),f(`strong`,null,c(e.name),1),f(`span`,null,c(B(e.id)),1)],8,$))),128))]),d.value.length?g(``,!0):(r(),h(`p`,ye,`创建 Bot 后,主 Bot 聊天中的重活会按 Bot 出现在这里。`))]),f(`section`,be,[E.value?(r(),h(`p`,xe,c(E.value),1)):S.value&&!v.value.length?(r(),h(`p`,Se,`正在读取工作流…`)):!L.value&&!S.value?(r(),h(`p`,Ce,`当前环境尚未开启后台工作流。`)):(r(),m(K,{key:3,embedded:``,tasks:z.value,agents:d.value,"group-by-bot":O.value===`all`,"agent-id":O.value===`all`?void 0:O.value,orchestration:F.value,"command-cache":_(M),"focus-task-id":I.value,onChanged:ee},null,8,[`tasks`,`agents`,`group-by-bot`,`agent-id`,`orchestration`,`command-cache`,`focus-task-id`]))])])]))}}),[[`__scopeId`,`data-v-e9ad5c05`]]);export{we as default};
2
- //# sourceMappingURL=WorkstreamsView-CH6qDPvj.js.map
1
+ import{A as e,D as t,Et as n,F as r,G as i,H as a,L as o,M as s,Ot as c,_ as l,a as u,b as d,d as f,et as p,f as m,m as h,p as g,st as _,t as v,u as y,v as b}from"./_plugin-vue_export-helper-CD0r-vVb.js";import{A as x,B as S,Q as C,Z as w,i as T,j as E,lt as D,o as O,ot as k}from"./index-Cx1SdzRY.js";import{a as A,i as j,n as M,o as N,r as P,s as F}from"./backgroundTaskPresentation-CJMcreMr.js";var I={key:0},L={class:`filters`,role:`tablist`},R=[`aria-pressed`],z=[`aria-pressed`],B={key:1,role:`alert`},V=[`data-task-id`],H={class:`task-content`},U={key:0,role:`status`},W=[`open`],G={key:0,style:{"white-space":`pre-wrap`,"overflow-wrap":`anywhere`}},ee={key:1},te={key:2,style:{"white-space":`pre-wrap`,"overflow-wrap":`anywhere`}},ne={key:2,class:`requirement-editor`},re=[`onSubmit`],ie=[`onUpdate:modelValue`,`aria-label`,`disabled`],ae=[`disabled`],oe={key:3,class:`requirement-editor`},se=[`onSubmit`],ce=[`value`,`aria-label`,`disabled`,`onInput`],le=[`disabled`],ue={key:4,class:`requirement-editor`},de=[`onSubmit`],fe=[`value`,`aria-label`,`disabled`,`onChange`],pe=[`value`],me=[`disabled`],he={class:`actions`},ge=[`disabled`,`onClick`],_e=[`disabled`,`onClick`],ve={key:2,class:`empty`},K=v(d({__name:`WorkstreamsPanel`,props:{tasks:{},conversationId:{},agentId:{},agents:{},groupByBot:{type:Boolean,default:!1},embedded:{type:Boolean,default:!1},orchestration:{type:Boolean},commandCache:{},focusTaskId:{}},emits:[`close`,`changed`],setup(s,{emit:l}){let d=s,m=l,v=p(`active`),b=p(``),S=p(``),C=p({}),w=p({}),O=p({}),N=d.commandCache??new Map,K=p(),q=``;a(()=>[d.focusTaskId,d.tasks.some(e=>e.id===d.focusTaskId)],async([e,n])=>{!e||!n||q===e||(q=e,F(d.tasks.find(t=>t.id===e).status)&&(v.value=`all`),await t(),K.value?.querySelector(`[data-task-id="${e.replace(/["\\]/g,``)}"]`)?.scrollIntoView?.({block:`center`}))},{immediate:!0});let J=!1;e(()=>{J=!0});let Y=[{value:-2,label:`最低`},{value:-1,label:`较低`},{value:0,label:`普通`},{value:1,label:`较高`},{value:2,label:`最高`}],X=(e,t,n)=>N.has(JSON.stringify([e,t,n])),Z=y(()=>d.tasks.filter(e=>!d.conversationId||e.originConversationId===d.conversationId).filter(e=>!d.agentId||e.agentId===d.agentId).filter(e=>v.value===`all`||!F(e.status)).sort((e,t)=>t.updatedAt-e.updatedAt)),Q=y(()=>{if(d.groupByBot){let e=d.agents??[],t=new Set(e.map(e=>e.id)),n=e.map(e=>({title:e.name,tasks:Z.value.filter(t=>t.agentId===e.id)})).filter(e=>e.tasks.length),r=Z.value.filter(e=>!t.has(e.agentId));if(r.length){let e=new Map;for(let t of r){let n=t.executorName||t.agentId||`其他`,r=e.get(n)??[];r.push(t),e.set(n,r)}for(let[t,r]of e)n.push({title:t,tasks:r})}return n}return[{title:`并行工作流`,tasks:Z.value.filter(e=>e.kind===`workstream`)},{title:`其他后台任务`,tasks:Z.value.filter(e=>e.kind!==`workstream`)}].filter(e=>e.tasks.length)});async function $(e,t){if(b.value)return;let n=C.value[e.id]?.trim()??``,r=(w.value[e.id]??e.instructions).trim(),i=O.value[e.id]??e.priority??0;if(t===`append`&&!n||t===`replace`&&(!r||r===e.instructions.trim()&&!X(e.id,`replace_spec`,{instructions:r}))||[`replace`,`priority`].includes(t)&&(!d.orchestration||e.orchestrationVersion!==2))return;b.value=e.id,S.value=``;let a={append:`append_requirement`,stop:`cancel`,retry:`resume`,replace:`replace_spec`,priority:`set_priority`}[t],o=t===`append`?{text:n}:t===`replace`?{instructions:r}:t===`priority`?{priority:i}:{},s=JSON.stringify([e.id,a,o]),c=n=>{if(N.delete(s),t===`replace`||t===`priority`)for(let[t,n]of N)JSON.parse(t)[0]===e.id&&n.kind===a&&N.delete(t);J||(m(`changed`,n.task),t===`append`&&(C.value[e.id]=``),t===`replace`&&delete w.value[e.id],t===`priority`&&delete O.value[e.id],S.value=``)};try{let r;if(d.orchestration){let n=N.get(s)??{requestId:T(),kind:a,...[`append`,`replace`].includes(t)?{expectedSpecRevision:e.specRevision??e.revision}:{},...e.controlEpoch===void 0?{}:{expectedControlEpoch:e.controlEpoch},payload:o};N.set(s,n),r=await E(`/api/app/background-tasks/${encodeURIComponent(e.id)}/commands`,{method:`POST`,body:n})}else r=await E(`/api/app/background-tasks/${encodeURIComponent(e.id)}/${t===`append`?`update`:t}`,{method:`POST`,body:{expectedRevision:e.revision,...t===`append`?{instructions:`${e.instructions}\n\n补充要求:\n${n}`}:{}}});c(r)}catch(t){if(t instanceof x&&t.status>=400&&t.status<500&&![408,429].includes(t.status)&&N.delete(s),J)return;S.value=t instanceof Error?t.message:`操作失败`;try{let t=await E(`/api/app/background-tasks/${encodeURIComponent(e.id)}`);if(J)return;let n=N.get(s)?.requestId,r=t.task.commands?.find(e=>e.id===n);r&&r.state!==`rejected`?c(t):m(`changed`,t.task)}catch{}}finally{b.value=``}}return(e,t)=>(r(),h(`aside`,{ref_key:`root`,ref:K,class:n([`workstreams`,{"workstreams--embedded":s.embedded}]),"aria-label":`工作流面板`},[s.embedded?g(``,!0):(r(),h(`header`,I,[t[3]||=f(`div`,null,[f(`h2`,null,`工作流`),f(`p`,null,`任务独立执行,完成或需要你处理时会回到聊天。停止聊天回复不会停止这些任务。`)],-1),f(`button`,{type:`button`,class:`icon-close`,"aria-label":`关闭`,onClick:t[0]||=e=>m(`close`)},`×`)])),f(`div`,L,[f(`button`,{type:`button`,"aria-pressed":v.value===`active`,onClick:t[1]||=e=>v.value=`active`},`进行中`,8,R),f(`button`,{type:`button`,"aria-pressed":v.value===`all`,onClick:t[2]||=e=>v.value=`all`},`全部`,8,z)]),S.value?(r(),h(`p`,B,c(S.value),1)):g(``,!0),(r(!0),h(u,null,o(Q.value,e=>(r(),h(`section`,{key:e.title},[f(`h3`,null,c(e.title)+` · `+c(e.tasks.length),1),(r(!0),h(u,null,o(e.tasks,e=>(r(),h(`article`,{key:e.id,"data-task-id":e.id,class:n({"task--focused":e.id===s.focusTaskId})},[f(`div`,H,[f(`strong`,null,c(e.title),1),f(`small`,null,c(_(M)(e)),1),_(P)(e)?(r(),h(`small`,U,c(_(P)(e)),1)):g(``,!0),e.result||e.error?(r(),h(`details`,{key:1,open:e.id===s.focusTaskId},[f(`summary`,null,c(e.error?e.result?`查看结果与问题`:`查看问题`:`查看完整结果`),1),e.error?(r(),h(`p`,G,c(e.error),1)):g(``,!0),e.status===`failed`&&e.phase===`review`&&e.result?(r(),h(`p`,ee,`已完成的执行结果(未通过复核):`)):g(``,!0),e.result?(r(),h(`p`,te,c(e.result),1)):g(``,!0)],8,W)):g(``,!0),_(A)(e)?(r(),h(`details`,ne,[t[4]||=f(`summary`,null,`补充要求`,-1),f(`form`,{"data-command":`append`,onSubmit:D(t=>$(e,`append`),[`prevent`])},[i(f(`textarea`,{"onUpdate:modelValue":t=>C.value[e.id]=t,"aria-label":`补充 ${e.title} 的要求`,disabled:!!b.value,rows:`3`,placeholder:`补充目标、约束或验收要求`},null,8,ie),[[k,C.value[e.id]]]),f(`small`,null,c(s.orchestration&&e.orchestrationVersion===2?`补充先保存,在执行的安全边界采纳。`:`此任务沿用旧执行协议:确认旧执行停止后,再按补充要求继续。`),1),f(`button`,{type:`submit`,disabled:!!b.value||!C.value[e.id]?.trim()},`提交补充`,8,ae)],40,re)])):g(``,!0),s.orchestration&&e.orchestrationVersion===2&&_(A)(e)?(r(),h(`details`,oe,[t[6]||=f(`summary`,null,`修改目标`,-1),f(`form`,{"data-command":`replace`,onSubmit:D(t=>$(e,`replace`),[`prevent`])},[f(`textarea`,{value:w.value[e.id]??e.instructions,"aria-label":`修改 ${e.title} 的目标`,disabled:!!b.value,rows:`4`,onInput:t=>w.value[e.id]=t.target.value},null,40,ce),t[5]||=f(`small`,null,`替换当前目标。系统会确认旧执行停止,再按新目标继续;已发生的操作不会自动撤销。`,-1),f(`button`,{type:`submit`,disabled:!!b.value||!(w.value[e.id]??e.instructions).trim()||(w.value[e.id]??e.instructions).trim()===e.instructions.trim()&&!X(e.id,`replace_spec`,{instructions:(w.value[e.id]??e.instructions).trim()})},`保存新目标`,8,le)],40,se)])):g(``,!0),s.orchestration&&e.orchestrationVersion===2&&_(A)(e)?(r(),h(`details`,ue,[f(`summary`,null,`优先级 · `+c(Y.find(t=>t.value===(e.priority??0))?.label),1),f(`form`,{"data-command":`priority`,onSubmit:D(t=>$(e,`priority`),[`prevent`])},[f(`select`,{value:O.value[e.id]??e.priority??0,"aria-label":`${e.title} 的优先级`,disabled:!!b.value,onChange:t=>O.value[e.id]=Number(t.target.value)},[(r(),h(u,null,o(Y,e=>f(`option`,{key:e.value,value:e.value},c(e.label),9,pe)),64))],40,fe),t[7]||=f(`small`,null,`影响后续排队,不打断正在执行的操作。`,-1),f(`button`,{type:`submit`,disabled:!!b.value||(O.value[e.id]??e.priority??0)===(e.priority??0)&&!X(e.id,`set_priority`,{priority:O.value[e.id]??e.priority??0})},`调整优先级`,8,me)],40,de)])):g(``,!0)]),f(`div`,he,[_(A)(e)?(r(),h(`button`,{key:0,type:`button`,disabled:!!b.value,onClick:t=>$(e,`stop`)},`停止`,8,ge)):g(``,!0),_(j)(e)?(r(),h(`button`,{key:1,type:`button`,disabled:!!b.value,onClick:t=>$(e,`retry`)},c(s.orchestration?`继续`:`重试`),9,_e)):g(``,!0)])],10,V))),128))]))),128)),Z.value.length?g(``,!0):(r(),h(`p`,ve,`暂无符合条件的任务。主 Bot 聊天中的重活会自动出现在这里。`))],2))}}),[[`__scopeId`,`data-v-ee381897`]]),q={class:`workstreams-page`,"aria-label":`工作流`},J={class:`workstreams-header`},Y={class:`workstreams-body`},X={class:`workstreams-sidebar`,"aria-label":`按 Bot 筛选`},Z={"aria-label":`按 Bot 筛选`},Q=[`aria-current`],$=[`aria-current`,`onClick`],ye={key:0},be={class:`workstreams-content`,"aria-live":`polite`},xe={key:0,class:`page-error`,role:`alert`},Se={key:1,class:`loading`,role:`status`},Ce={key:2,class:`empty`},we=v(d({__name:`WorkstreamsView`,setup(t){let n=C(),a=w(),d=p([]),v=p([]),x=p(!0),T=p(``),D=p(`all`),A=p(``),j=p([]),M=new Map,P=y(()=>typeof a.query.from==`string`&&/^\/conversations(?:\/[a-f0-9-]{36})?(?:\?taskId=[a-f0-9-]{36})?$/i.test(a.query.from)?a.query.from:`/conversations`),F=y(()=>j.value.includes(`task-orchestration-v2`)),I=y(()=>typeof a.query.task==`string`&&/^[a-f0-9-]{36}$/i.test(a.query.task)?a.query.task:void 0),L=y(()=>j.value.includes(`background-tasks-v1`)),R=y(()=>d.value.filter(e=>e.name.toLowerCase().includes(A.value.trim().toLowerCase()))),z=y(()=>D.value===`all`?v.value:v.value.filter(e=>e.agentId===D.value)),B=e=>v.value.filter(t=>t.agentId===e).length,V=0,H=!1,U;async function W(){let e=++V;try{let[t,n]=await Promise.all([E(`/api/app/capabilities`),E(`/api/app/agents`)]);if(H||e!==V)return;if(j.value=t.features,d.value=n.agents.filter(e=>!e.archived),t.features.includes(`background-tasks-v1`)){let t=await E(`/api/app/background-tasks`);if(H||e!==V)return;v.value=N(v.value,t.tasks)}else v.value=[];D.value!==`all`&&!d.value.some(e=>e.id===D.value)&&(D.value=`all`),T.value=``}catch(t){!H&&e===V&&(T.value=t instanceof Error?t.message:`无法读取工作流`)}finally{!H&&e===V&&(x.value=!1)}}async function G(){document.hidden||await W(),H||(U=setTimeout(G,5e3))}function ee(e){v.value=N(v.value,[e])}return s(G),e(()=>{H=!0,V++,clearTimeout(U)}),(e,t)=>(r(),h(`main`,q,[f(`header`,J,[f(`button`,{class:`icon-button`,type:`button`,"aria-label":`返回聊天`,onClick:t[0]||=e=>_(n).push(P.value)},[b(S,{name:`chevron-left`,size:20})]),b(S,{name:`board`,size:23}),t[3]||=f(`h1`,null,`工作流`,-1),t[4]||=f(`p`,{class:`workstreams-lead`},`按 Bot 查看并行任务。停止聊天回复不会停止这些任务。`,-1),f(`button`,{class:`icon-button`,type:`button`,"aria-label":`刷新工作流`,onClick:W},[b(S,{name:`refresh`,size:17})])]),f(`div`,Y,[f(`aside`,X,[f(`h2`,null,[t[5]||=l(`我的 Bot `,-1),f(`span`,null,c(d.value.length),1)]),i(f(`input`,{"onUpdate:modelValue":t[1]||=e=>A.value=e,type:`search`,"aria-label":`搜索 Bot`,placeholder:`搜索 Bot`},null,512),[[k,A.value]]),f(`nav`,Z,[f(`button`,{type:`button`,"aria-current":D.value===`all`?`true`:void 0,onClick:t[2]||=e=>D.value=`all`},[b(S,{name:`users`,size:22}),t[6]||=l(`全部 Bot`,-1),f(`span`,null,c(v.value.length),1)],8,Q),(r(!0),h(u,null,o(R.value,e=>(r(),h(`button`,{key:e.id,type:`button`,"aria-current":D.value===e.id?`true`:void 0,onClick:t=>D.value=e.id},[b(O,{name:e.name,avatar:e.avatar,size:26},null,8,[`name`,`avatar`]),f(`strong`,null,c(e.name),1),f(`span`,null,c(B(e.id)),1)],8,$))),128))]),d.value.length?g(``,!0):(r(),h(`p`,ye,`创建 Bot 后,主 Bot 聊天中的重活会按 Bot 出现在这里。`))]),f(`section`,be,[T.value?(r(),h(`p`,xe,c(T.value),1)):x.value&&!v.value.length?(r(),h(`p`,Se,`正在读取工作流…`)):!L.value&&!x.value?(r(),h(`p`,Ce,`当前环境尚未开启后台工作流。`)):(r(),m(K,{key:3,embedded:``,tasks:z.value,agents:d.value,"group-by-bot":D.value===`all`,"agent-id":D.value===`all`?void 0:D.value,orchestration:F.value,"command-cache":_(M),"focus-task-id":I.value,onChanged:ee},null,8,[`tasks`,`agents`,`group-by-bot`,`agent-id`,`orchestration`,`command-cache`,`focus-task-id`]))])])]))}}),[[`__scopeId`,`data-v-e9ad5c05`]]);export{we as default};
2
+ //# sourceMappingURL=WorkstreamsView-BwZpuuhs.js.map