@lsamien/yaoyao 0.4.79 → 0.4.81

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 (116) hide show
  1. package/README.md +9 -7
  2. package/THIRD_PARTY_NOTICES.md +4 -0
  3. package/bin/hermes-yaoyao-updater.mjs +97 -1
  4. package/bin/lib/npm-release.d.mts +10 -0
  5. package/bin/lib/npm-release.mjs +93 -0
  6. package/build-info.json +22 -3
  7. package/desktop/main.mjs +28 -26
  8. package/dist/assets/{AboutDialog-CrajAC--.js → AboutDialog-g6pYSCjs.js} +2 -2
  9. package/dist/assets/{AboutDialog-CrajAC--.js.map → AboutDialog-g6pYSCjs.js.map} +1 -1
  10. package/dist/assets/{BotAutomationsView-DTOoFSEl.js → BotAutomationsView-D1qf-5yf.js} +2 -2
  11. package/dist/assets/{BotAutomationsView-DTOoFSEl.js.map → BotAutomationsView-D1qf-5yf.js.map} +1 -1
  12. package/dist/assets/BotPluginsDialog-B0iR4Jy2.css +1 -0
  13. package/dist/assets/BotPluginsDialog-BOSzPlLZ.js +2 -0
  14. package/dist/assets/BotPluginsDialog-BOSzPlLZ.js.map +1 -0
  15. package/dist/assets/{BotSettingsDialog-ChffrjSM.js → BotSettingsDialog-Ba-380qV.js} +4 -4
  16. package/dist/assets/{BotSettingsDialog-ChffrjSM.js.map → BotSettingsDialog-Ba-380qV.js.map} +1 -1
  17. package/dist/assets/ChatView-ClK12dmT.css +1 -0
  18. package/dist/assets/ChatView-DHyj3yzu.js +2 -0
  19. package/dist/assets/ChatView-DHyj3yzu.js.map +1 -0
  20. package/dist/assets/{ComputerPanel-bNkvZAiT.js → ComputerPanel-D1hglwwV.js} +2 -2
  21. package/dist/assets/{ComputerPanel-bNkvZAiT.js.map → ComputerPanel-D1hglwwV.js.map} +1 -1
  22. package/dist/assets/{ComputerViewerView-DCTvbHr-.js → ComputerViewerView-BDL1eNKT.js} +2 -2
  23. package/dist/assets/{ComputerViewerView-DCTvbHr-.js.map → ComputerViewerView-BDL1eNKT.js.map} +1 -1
  24. package/dist/assets/{ConversationsView-BnysxvX_.js → ConversationsView-BaWBEaBU.js} +5 -5
  25. package/dist/assets/{ConversationsView-BnysxvX_.js.map → ConversationsView-BaWBEaBU.js.map} +1 -1
  26. package/dist/assets/{ConversationsView-CbArO1v2.css → ConversationsView-CdPjaDik.css} +1 -1
  27. package/dist/assets/{FilesView-D7tA6Nu1.js → FilesView-AjaCIyCs.js} +2 -2
  28. package/dist/assets/{FilesView-D7tA6Nu1.js.map → FilesView-AjaCIyCs.js.map} +1 -1
  29. package/dist/assets/FloatingResourceSearch-CeLuyNWO.js +9 -0
  30. package/dist/assets/{FloatingResourceSearch-c6l1JuAA.js.map → FloatingResourceSearch-CeLuyNWO.js.map} +1 -1
  31. package/dist/assets/{FloatingResourceSearch-3GOuDkuO.css → FloatingResourceSearch-CqauCQAf.css} +1 -1
  32. package/dist/assets/{HistoryView-Cnsriop4.js → HistoryView-C96yRoyB.js} +2 -2
  33. package/dist/assets/{HistoryView-Cnsriop4.js.map → HistoryView-C96yRoyB.js.map} +1 -1
  34. package/dist/assets/{KanbanView-CXm05b62.js → KanbanView-CVbjfqiX.js} +2 -2
  35. package/dist/assets/{KanbanView-CXm05b62.js.map → KanbanView-CVbjfqiX.js.map} +1 -1
  36. package/dist/assets/{LocalVmSettingsPanel-HgNC1SCF.js → LocalVmSettingsPanel-DcDIRVsO.js} +2 -2
  37. package/dist/assets/{LocalVmSettingsPanel-HgNC1SCF.js.map → LocalVmSettingsPanel-DcDIRVsO.js.map} +1 -1
  38. package/dist/assets/{RunnerSettingsPanel-CLKZvWua.js → RunnerSettingsPanel-XYeXVx5y.js} +2 -2
  39. package/dist/assets/{RunnerSettingsPanel-CLKZvWua.js.map → RunnerSettingsPanel-XYeXVx5y.js.map} +1 -1
  40. package/dist/assets/{StandaloneDialog-DODllzh1.js → StandaloneDialog-C6HIM_jc.js} +2 -2
  41. package/dist/assets/{StandaloneDialog-DODllzh1.js.map → StandaloneDialog-C6HIM_jc.js.map} +1 -1
  42. package/dist/assets/{UpdateCheckDialog-DHcAuryL.js → UpdateCheckDialog-Dv1d1s42.js} +2 -2
  43. package/dist/assets/{UpdateCheckDialog-DHcAuryL.js.map → UpdateCheckDialog-Dv1d1s42.js.map} +1 -1
  44. package/dist/assets/{WorkspaceKnowledgePanel-BrE8xSi2.js → WorkspaceKnowledgePanel-Dnauu0Hw.js} +2 -2
  45. package/dist/assets/{WorkspaceKnowledgePanel-BrE8xSi2.js.map → WorkspaceKnowledgePanel-Dnauu0Hw.js.map} +1 -1
  46. package/dist/assets/{WorkspaceRoutinesPanel-CpDVEwHx.js → WorkspaceRoutinesPanel-WNI3qP4D.js} +2 -2
  47. package/dist/assets/{WorkspaceRoutinesPanel-CpDVEwHx.js.map → WorkspaceRoutinesPanel-WNI3qP4D.js.map} +1 -1
  48. package/dist/assets/WorkspaceShell-BT92dIOL.css +1 -0
  49. package/dist/assets/WorkspaceShell-Bl2QMnvN.js +44 -0
  50. package/dist/assets/WorkspaceShell-Bl2QMnvN.js.map +1 -0
  51. package/dist/assets/{WorkspaceView-CBWFRLki.js → WorkspaceView-Dhdw4Kml.js} +2 -2
  52. package/dist/assets/{WorkspaceView-CBWFRLki.js.map → WorkspaceView-Dhdw4Kml.js.map} +1 -1
  53. package/dist/assets/{docx-preview-CG4CK2Qm.js → docx-preview-BNRkFvPc.js} +2 -2
  54. package/dist/assets/{docx-preview-CG4CK2Qm.js.map → docx-preview-BNRkFvPc.js.map} +1 -1
  55. package/dist/assets/{index-BRP9NWum.js → index-DU4OTLup.js} +3 -3
  56. package/dist/assets/{index-BRP9NWum.js.map → index-DU4OTLup.js.map} +1 -1
  57. package/dist/assets/{pdf-CFWXmhVF.js → pdf-C6_9GF5Z.js} +2 -2
  58. package/dist/assets/{pdf-CFWXmhVF.js.map → pdf-C6_9GF5Z.js.map} +1 -1
  59. package/dist/assets/{sessionOwnership-B2YxdBdf.js → sessionOwnership-D9vGe33s.js} +2 -2
  60. package/dist/assets/{sessionOwnership-B2YxdBdf.js.map → sessionOwnership-D9vGe33s.js.map} +1 -1
  61. package/dist/assets/{viewModels-CYJ8m5Uf.js → viewModels-BLN4GfVX.js} +5 -5
  62. package/dist/assets/viewModels-BLN4GfVX.js.map +1 -0
  63. package/dist/index.html +1 -1
  64. package/dist/provider-logos/airtable.svg +13 -0
  65. package/dist/provider-logos/discord.svg +15 -0
  66. package/dist/provider-logos/github.svg +10 -0
  67. package/dist/provider-logos/gmail.svg +1 -0
  68. package/dist/provider-logos/googlecalendar.svg +148 -0
  69. package/dist/provider-logos/googledrive.svg +25 -0
  70. package/dist/provider-logos/linear.svg +5 -0
  71. package/dist/provider-logos/notion.svg +11 -0
  72. package/dist/provider-logos/outlook.svg +76 -0
  73. package/dist/provider-logos/slack.svg +22 -0
  74. package/dist/provider-logos/trello.svg +19 -0
  75. package/dist/provider-logos/twitter.svg +128 -0
  76. package/dist-server/server/app.js +4 -2
  77. package/dist-server/server/botPlugins/connectedApps.js +3 -2
  78. package/dist-server/server/chatCache.js +3 -2
  79. package/dist-server/server/chatPresentation.js +32 -0
  80. package/dist-server/server/chatTranscriptApi.js +2 -1
  81. package/dist-server/server/config.js +2 -0
  82. package/dist-server/server/credentialVault/adapterExecutor.js +23 -0
  83. package/dist-server/server/credentialVault/botAccess.js +161 -0
  84. package/dist-server/server/credentialVault/broker.js +61 -6
  85. package/dist-server/server/credentialVault/coordinator.js +109 -14
  86. package/dist-server/server/credentialVault/localClient.js +191 -0
  87. package/dist-server/server/credentialVault/localExecutor.js +15 -0
  88. package/dist-server/server/credentialVault/protectedExecutor.js +3 -19
  89. package/dist-server/server/credentialVault/schema.js +11 -4
  90. package/dist-server/server/credentialVault/sshExecutor.js +111 -15
  91. package/dist-server/server/credentialVault/store.js +11 -5
  92. package/dist-server/server/credentialVault/transport.js +5 -1
  93. package/dist-server/server/dashboardCommand.js +62 -0
  94. package/dist-server/server/dashboardController.js +117 -25
  95. package/dist-server/server/jsonCompression.js +29 -0
  96. package/dist-server/server/routes.js +19 -1
  97. package/dist-server/server/runnerHub.js +12 -1
  98. package/dist-server/server/security.js +2 -1
  99. package/dist-server/server/updateManager.js +42 -10
  100. package/dist-server/server/workspaceRoutes.js +30 -4
  101. package/dist-server/server/workspaceSync.js +22 -4
  102. package/dist-server/shared/botProviderLogos.js +61 -0
  103. package/dist-server/shared/desktopUpdate.js +1 -0
  104. package/package.json +1 -1
  105. package/release.json +3 -3
  106. package/dist/assets/BotPluginsDialog-Ckiwmito.js +0 -2
  107. package/dist/assets/BotPluginsDialog-Ckiwmito.js.map +0 -1
  108. package/dist/assets/BotPluginsDialog-Db5dTqvg.css +0 -1
  109. package/dist/assets/ChatView-C_7_7olu.css +0 -1
  110. package/dist/assets/ChatView-znZF8RZE.js +0 -2
  111. package/dist/assets/ChatView-znZF8RZE.js.map +0 -1
  112. package/dist/assets/FloatingResourceSearch-c6l1JuAA.js +0 -9
  113. package/dist/assets/WorkspaceShell-Dhm3r61t.js +0 -44
  114. package/dist/assets/WorkspaceShell-Dhm3r61t.js.map +0 -1
  115. package/dist/assets/WorkspaceShell-Dk003lIq.css +0 -1
  116. package/dist/assets/viewModels-CYJ8m5Uf.js.map +0 -1
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lsamien/yaoyao",
3
- "version": "0.4.79",
3
+ "version": "0.4.81",
4
4
  "license": "Apache-2.0",
5
5
  "description": "夭夭 AI:聊天、多 Agent 团队、文件库与电脑工作空间",
6
6
  "type": "module",
package/release.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "releaseVersion": "0.4.79",
4
- "webVersion": "0.4.79",
5
- "gitTag": "v0.4.79"
3
+ "releaseVersion": "0.4.81",
4
+ "webVersion": "0.4.81",
5
+ "gitTag": "v0.4.81"
6
6
  }
@@ -1,2 +0,0 @@
1
- import{A as e,F as t,G as n,H as r,L as i,M as a,Q as o,W as ee,_ as s,ct as c,d as l,et as u,g as d,h as te,i as f,m as p,o as ne,ot as re,p as ie,s as m,t as h,u as g,v as _,x as v,y}from"./_plugin-vue_export-helper-CscYwSBt.js";import{F as b,X as x}from"./index-BRP9NWum.js";import{t as S}from"./StandaloneDialog-DODllzh1.js";var ae={class:`bot-plugins`,"aria-label":`Bot 插件管理`},oe={class:`plugin-tabs`,role:`tablist`,"aria-label":`插件类型`},se=[`aria-selected`],ce=[`aria-selected`],le={key:0,class:`plugin-error`,role:`alert`},ue=[`disabled`],de={key:1,class:`plugin-notice`,role:`status`},fe={key:2,role:`status`},pe={class:`plugin-toolbar`},me=[`disabled`],he={key:0,class:`hint`},ge=[`value`],_e={key:0,class:`hint`},ve={class:`editor-actions`},ye=[`disabled`],be=[`disabled`],xe={key:2,class:`plugin-empty`},Se={class:`card-heading`},Ce={class:`hint endpoint`},we={class:`hint`},Te={key:0,class:`hint`},Ee={key:1,class:`hint`},De={class:`card-actions`},Oe=[`disabled`,`onClick`],ke=[`disabled`,`onClick`],Ae=[`disabled`,`onClick`],je=[`disabled`,`onClick`],Me=[`disabled`,`onClick`],Ne=[`value`,`disabled`],Pe={key:0,class:`hint`},Fe={class:`card-actions`},Ie=[`disabled`],Le=[`disabled`],Re={class:`plugin-toolbar`},ze={class:`view-tabs`,role:`tablist`,"aria-label":`应用列表`},Be=[`aria-selected`],Ve=[`aria-selected`],He=[`disabled`],Ue={class:`plugin-search`},We={key:0,class:`plugin-notice`},Ge={class:`app-grid`},Ke={class:`card-heading`},qe={class:`app-monogram`,"aria-hidden":`true`},Je={class:`hint`},Ye={key:0},Xe=[`disabled`,`aria-label`,`onClick`],Ze={key:0},Qe={class:`card-actions`},$e=[`disabled`,`onClick`],et=[`disabled`,`onClick`],tt=[`href`],nt={key:2,class:`hint`},rt=[`value`],it={class:`card-actions`},at=[`disabled`],ot=[`disabled`],st={key:2,class:`plugin-empty`},ct=[`open`],lt=[`placeholder`],ut={class:`card-actions`},dt=[`disabled`],ft=[`disabled`],pt=`/api/app/bot-tools`,C=h(v({__name:`BotPluginsPanel`,emits:[`dirty-change`],setup(ee,{emit:te}){let h=te,v=u(`apps`),S=u(`marketplace`),C=u({configured:!1,revision:0}),w=u(!1),T=u([]),mt=u([]),E=u([]),ht=u([]),D=u(!1),gt=u(!0),O=u(!1),k=u(``),A=u(``),j=u(``),M=u(``),N=u(`{}`),P=u(null),F=u(!1),I=u(``),L=u([]),R=u(``),z=u(``),B=u(``),V=u([]),_t=u(0),H=o({name:``,transport:`stdio`,command:`npx`,args:`[]`,url:``,env:`{}`,headers:`{}`,agentIds:[],revision:0}),U=u({}),W=u(40);r([j,S],()=>{W.value=40});let G=!1,vt=0,K,q=(e,t,n)=>b(pt+e,{method:t,...n===void 0?{}:{body:n}}),J=ie(()=>ht.value.filter(e=>!e.archived&&!e.remoteAgentId&&!e.temporaryGoalId)),Y=e=>e.filter(e=>J.value.some(t=>t.id===e)),X=ie(()=>{let e=new Map(mt.value.map(e=>[e.slug,e]));for(let t of E.value)e.has(t.slug)||e.set(t.slug,{slug:t.slug,name:t.slug,description:``});let t=j.value.trim().toLowerCase();return[...e.values()].filter(e=>(S.value!==`connected`||E.value.some(t=>t.slug===e.slug))&&`${e.name} ${e.slug} ${e.description}`.toLowerCase().includes(t))}),Z=e=>E.value.find(t=>t.slug===e),yt=e=>({ACTIVE:`已连接`,INITIATED:`待授权`,INITIALIZING:`连接中`,PENDING:`待授权`,EXPIRED:`已过期`,FAILED:`连接失败`,INACTIVE:`未启用`})[e.toUpperCase()]??e,bt=e=>D.value?e.map(e=>J.value.find(t=>t.id===e)?.name).filter(Boolean).join(`、`)||`尚未授权 Bot`:`Bot 授权暂不可读`;async function Q(){let e=++vt,t=await Promise.allSettled([b(`/api/app/bot-tools/settings`),b(`/api/app/bot-tools/mcp`),b(`/api/app/bot-tools/apps/catalog`),b(`/api/app/bot-tools/apps`),b(`/api/app/agents`)]);if(G||e!==vt)return;let[n,r,i,a,o]=t;n.status===`fulfilled`&&(C.value=n.value,w.value=n.value.canManageMcp),r.status===`fulfilled`&&(T.value=r.value.plugins),i.status===`fulfilled`&&(mt.value=i.value.cards),a.status===`fulfilled`&&a.value.authoritative&&(E.value=a.value.connections),D.value=o.status===`fulfilled`,o.status===`fulfilled`&&(ht.value=o.value.agents),k.value=t.filter(e=>e.status===`rejected`).map(e=>e.reason instanceof Error?e.reason.message:`读取失败,请重试`).join(`;`),gt.value=!1}async function $(e){if(!O.value){O.value=!0,k.value=``,A.value=``;try{await e(),G||await Q()}catch(e){G||(k.value=e instanceof Error?e.message:`操作失败,请重试`)}finally{O.value=!1}}}function xt(e){B.value=``,P.value=e?.id??null,Object.assign(H,{name:e?.name??``,transport:e?.transport??`stdio`,command:e?.command??`npx`,args:JSON.stringify(e?.args??[],null,2),url:e?.url??``,env:JSON.stringify(Object.fromEntries((e?.envKeys??[]).map(e=>[e,!0])),null,2),headers:JSON.stringify(Object.fromEntries((e?.headerKeys??[]).map(e=>[e,!0])),null,2),agentIds:Y(e?.agentIds??[]),revision:e?.revision??0}),F.value=!0,h(`dirty-change`,!1)}function St(){F.value=!1,h(`dirty-change`,!1)}async function Ct(){await $(async()=>{let e,t,n;try{e=JSON.parse(H.args),t=JSON.parse(H.env),n=JSON.parse(H.headers)}catch{throw Error(`参数、环境变量和请求头必须是有效 JSON`)}let r={name:H.name,transport:H.transport,command:H.command,args:e,url:H.url,env:t,headers:n,agentIds:H.agentIds};await q(P.value?`/mcp/`+P.value:`/mcp`,P.value?`PUT`:`POST`,P.value?{definition:r,revision:H.revision}:r),St(),A.value=`已保存。测试连接成功后即可启用。`})}async function wt(e){await $(async()=>{let t=await q(`/mcp/`+e.id+`/test`,`POST`,{});A.value=`服务器连接成功,发现 ${t.plugin.toolCount} 个工具。服务登录状态需另行确认。`})}async function Tt(e){await $(async()=>{await q(`/mcp/`+e.id,`PATCH`,{enabled:!e.enabled,revision:e.revision})})}async function Et(e){window.confirm(`移除插件“${e.name}”?此插件将不再提供给 Bot。`)&&await $(async()=>{await q(`/mcp/`+e.id,`DELETE`),B.value===e.id&&Ot()})}function Dt(e){St(),B.value=e.id,V.value=Y(e.agentIds),_t.value=e.revision}function Ot(){B.value=``,h(`dirty-change`,!1)}async function kt(){await $(async()=>{await q(`/mcp/`+B.value,`PATCH`,{agentIds:V.value,revision:_t.value}),Ot(),A.value=`Bot 授权已保存,将用于下一轮对话。`})}async function At(e=!1){e&&!window.confirm(`清除当前账号的应用连接服务配置?Bot 将暂时无法使用这些应用。`)||await $(async()=>{let t;try{t=JSON.parse(N.value)}catch{throw Error(`Auth Config 映射必须是有效 JSON`)}await q(`/settings`,`PUT`,{apiKey:e?``:M.value,revision:C.value.revision,authConfigs:t}),M.value=``,N.value=`{}`,h(`dirty-change`,!1),A.value=e?`已清除连接服务配置。`:`应用连接服务已配置。`})}async function jt(e){if(O.value)return;if(Z(e.slug)?.accounts.length&&R.value!==e.slug){R.value=e.slug,z.value=``;return}let t=window.open(`about:blank`,`_blank`);t&&(t.opener=null);let n=new Set(Z(e.slug)?.accounts.map(e=>e.id)??[]);await $(async()=>{try{let r=await q(`/apps/`+e.slug+`/authorize`,`POST`,z.value.trim()&&R.value===e.slug?{alias:z.value.trim()}:{});U.value[e.slug]=r.url,t&&(t.location.href=r.url),R.value=``,z.value=``,A.value=`请在新窗口完成授权,然后刷新连接状态。`,clearTimeout(K);let i=0,a=async()=>{G||(await Q(),Z(e.slug)?.accounts.some(e=>!n.has(e.id)&&e.status.toUpperCase()===`ACTIVE`)?(delete U.value[e.slug],A.value=`${e.name} 已连接。`):!G&&++i<24&&(K=setTimeout(a,5e3)))};K=setTimeout(a,5e3)}catch(e){throw t?.close(),e}})}async function Mt(e,t){window.confirm(`断开这个应用账号?其他账号的连接会保留。`)&&await $(async()=>{await q(`/apps/`+e+`/accounts/`+encodeURIComponent(t),`DELETE`),delete U.value[e]})}function Nt(e){I.value=e,L.value=[...Z(e)?.agentIds??[]]}async function Pt(){await $(async()=>{await q(`/apps/`+I.value+`/agents`,`PUT`,{agentIds:L.value,revision:Z(I.value)?.revision??0}),I.value=``,h(`dirty-change`,!1)})}return a(Q),e(()=>{G=!0,vt++,clearTimeout(K)}),(e,r)=>(t(),s(`section`,ae,[r[55]||=p(`p`,{class:`intro`},`为 Bot 连接应用和工具,按需选择可使用它们的机器人。`,-1),p(`div`,oe,[p(`button`,{type:`button`,role:`tab`,"aria-selected":v.value===`apps`,onClick:r[0]||=e=>v.value=`apps`},[y(x,{name:`link`,size:17}),r[28]||=_(`应用`,-1)],8,se),p(`button`,{type:`button`,role:`tab`,"aria-selected":v.value===`mcp`,onClick:r[1]||=e=>v.value=`mcp`},[y(x,{name:`tools`,size:17}),r[29]||=_(`MCP 服务`,-1)],8,ce)]),k.value?(t(),s(`p`,le,[_(c(k.value)+` `,1),p(`button`,{type:`button`,disabled:O.value,onClick:Q},`重试`,8,ue)])):d(``,!0),A.value?(t(),s(`p`,de,c(A.value),1)):d(``,!0),gt.value?(t(),s(`p`,fe,`正在读取插件…`)):v.value===`mcp`?(t(),s(l,{key:3},[p(`div`,pe,[r[31]||=p(`p`,null,`自定义 MCP 服务`,-1),p(`button`,{disabled:!w.value||O.value||!D.value,onClick:r[2]||=e=>xt()},[y(x,{name:`plus`,size:16}),r[30]||=_(`添加服务`,-1)],8,me)]),r[45]||=p(`p`,{class:`hint`},`stdio 程序及其路径在当前连接的夭夭服务器上运行和读取;HTTP / HTTPS 地址也由服务器连接。客户端通过服务器使用已授权的工具,无需安装 MCP 程序。`,-1),w.value?d(``,!0):(t(),s(`p`,he,`自定义 MCP 服务由管理员管理。`)),F.value?(t(),s(`form`,{key:1,class:`plugin-editor`,"aria-label":`MCP 服务配置`,onSubmit:g(Ct,[`prevent`]),onInput:r[11]||=e=>h(`dirty-change`,!0),onChange:r[12]||=e=>h(`dirty-change`,!0)},[p(`h4`,null,c(P.value?`编辑 MCP 服务`:`添加 MCP 服务`),1),p(`label`,null,[r[32]||=_(`名称`,-1),n(p(`input`,{"onUpdate:modelValue":r[3]||=e=>H.name=e,required:``,maxlength:`80`},null,512),[[m,H.name]])]),p(`label`,null,[r[34]||=_(`连接方式`,-1),n(p(`select`,{"onUpdate:modelValue":r[4]||=e=>H.transport=e},[...r[33]||=[p(`option`,{value:`stdio`},`服务器程序(stdio)`,-1),p(`option`,{value:`http`},`远程地址(HTTP / HTTPS)`,-1)]],512),[[ne,H.transport]])]),H.transport===`stdio`?(t(),s(l,{key:0},[p(`label`,null,[r[35]||=_(`服务器程序`,-1),n(p(`input`,{"onUpdate:modelValue":r[5]||=e=>H.command=e,required:``,placeholder:`服务器上的 npx 或程序完整路径`},null,512),[[m,H.command]])]),p(`label`,null,[r[36]||=_(`参数(JSON 数组)`,-1),n(p(`textarea`,{"onUpdate:modelValue":r[6]||=e=>H.args=e,rows:`3`,spellcheck:`false`},null,512),[[m,H.args]])]),p(`label`,null,[r[37]||=_(`环境变量(JSON)`,-1),n(p(`textarea`,{"onUpdate:modelValue":r[7]||=e=>H.env=e,rows:`3`,spellcheck:`false`,autocomplete:`off`},null,512),[[m,H.env]])]),r[38]||=p(`p`,{class:`hint`},`程序和参数中的文件路径须在服务器上可用。所需账号配置和环境变量也须提供给服务器上的 MCP 进程。`,-1)],64)):(t(),s(l,{key:1},[p(`label`,null,[r[39]||=_(`MCP 地址`,-1),n(p(`input`,{"onUpdate:modelValue":r[8]||=e=>H.url=e,type:`url`,required:``,placeholder:`https://example.com/mcp`},null,512),[[m,H.url]])]),p(`label`,null,[r[40]||=_(`请求头(JSON)`,-1),n(p(`textarea`,{"onUpdate:modelValue":r[9]||=e=>H.headers=e,rows:`3`,spellcheck:`false`,autocomplete:`off`},null,512),[[m,H.headers]])])],64)),r[42]||=p(`p`,{class:`hint`},`凭据请放在环境变量或请求头中。已保存的值用 true 表示保留,不会回显。`,-1),p(`fieldset`,null,[r[41]||=p(`legend`,null,`允许使用的 Bot`,-1),(t(!0),s(l,null,i(J.value,e=>(t(),s(`label`,{key:e.id,class:`check-row`},[n(p(`input`,{"onUpdate:modelValue":r[10]||=e=>H.agentIds=e,type:`checkbox`,value:e.id},null,8,ge),[[f,H.agentIds]]),_(c(e.name),1)]))),128)),J.value.length?d(``,!0):(t(),s(`p`,_e,`创建 Bot 后可在这里授权。`))]),p(`div`,ve,[p(`button`,{type:`button`,disabled:O.value,onClick:St},`取消`,8,ye),p(`button`,{type:`submit`,class:`primary`,disabled:O.value||!D.value},c(O.value?`保存中…`:`保存服务`),9,be)])],32)):d(``,!0),!T.value.length&&!F.value?(t(),s(`p`,xe,`还没有 MCP 服务。添加服务并测试连接后,即可授权 Bot 使用。`)):d(``,!0),(t(!0),s(l,null,i(T.value,e=>(t(),s(`article`,{key:e.id,class:`mcp-card`},[p(`div`,Se,[y(x,{name:`tools`,size:20}),p(`h4`,null,c(e.name),1),p(`span`,{class:re([`badge`,{enabled:e.enabled}])},c(e.enabled?`已启用`:`未启用`),3)]),p(`p`,Ce,c(e.transport===`stdio`?e.command:e.url),1),p(`p`,we,c(e.transport===`stdio`?`运行于夭夭服务器`:`由夭夭服务器连接`)+` · `+c(e.testedAt?`已发现 ${e.toolCount} 个工具`:`尚未测试连接`)+` · `+c(bt(e.agentIds)),1),D.value&&Y(e.agentIds).length!==e.agentIds.length?(t(),s(`p`,Te,`部分 Bot 授权已失效,请重新选择可使用此服务的 Bot。`)):d(``,!0),D.value&&e.enabled&&!Y(e.agentIds).length?(t(),s(`p`,Ee,`服务已启用,尚无可使用它的 Bot。请先授权 Bot。`)):d(``,!0),p(`div`,De,[p(`button`,{disabled:O.value||!w.value,onClick:t=>wt(e)},`测试连接`,8,Oe),p(`button`,{disabled:O.value||!w.value||!e.enabled&&!e.testedAt,onClick:t=>Tt(e)},c(e.enabled?`停用`:`启用`),9,ke),p(`button`,{disabled:O.value||!w.value||!D.value,onClick:t=>Dt(e)},`授权 Bot`,8,Ae),p(`button`,{disabled:O.value||!w.value||!D.value,onClick:t=>xt(e)},`编辑`,8,je),p(`button`,{class:`danger`,disabled:O.value||!w.value,onClick:t=>Et(e)},`移除`,8,Me)]),B.value===e.id?(t(),s(`form`,{key:2,class:`grant-editor`,"aria-label":`MCP Bot 授权`,onSubmit:g(kt,[`prevent`]),onChange:r[14]||=e=>h(`dirty-change`,!0)},[p(`fieldset`,null,[r[43]||=p(`legend`,null,`允许使用的 Bot`,-1),(t(!0),s(l,null,i(J.value,e=>(t(),s(`label`,{key:e.id,class:`check-row`},[n(p(`input`,{"onUpdate:modelValue":r[13]||=e=>V.value=e,type:`checkbox`,value:e.id,disabled:O.value},null,8,Ne),[[f,V.value]]),_(c(e.name),1)]))),128)),J.value.length?d(``,!0):(t(),s(`p`,Pe,`创建 Bot 后可在这里授权。`))]),r[44]||=p(`p`,{class:`hint`},`授权按 Bot 保存,同一账号在各客户端均可使用。更改授权后,连接验证结果和服务启用状态会保留。`,-1),p(`div`,Fe,[p(`button`,{type:`button`,disabled:O.value,onClick:Ot},`取消`,8,Ie),p(`button`,{type:`submit`,disabled:O.value||!w.value||!D.value},`保存授权`,8,Le)])],32)):d(``,!0)]))),128))],64)):gt.value?d(``,!0):(t(),s(l,{key:4},[p(`div`,Re,[p(`div`,ze,[p(`button`,{role:`tab`,"aria-selected":S.value===`marketplace`,onClick:r[15]||=e=>S.value=`marketplace`},`应用目录`,8,Be),p(`button`,{role:`tab`,"aria-selected":S.value===`connected`,onClick:r[16]||=e=>S.value=`connected`},`已连接 `+c(E.value.length||``),9,Ve)]),p(`button`,{disabled:O.value,"aria-label":`刷新应用连接`,onClick:Q},[y(x,{name:`refresh`,size:17})],8,He)]),p(`label`,Ue,[y(x,{name:`search`,size:17}),n(p(`input`,{"onUpdate:modelValue":r[17]||=e=>j.value=e,type:`search`,"aria-label":`搜索应用`,placeholder:`搜索应用`},null,512),[[m,j.value]])]),C.value.configured?d(``,!0):(t(),s(`p`,We,`配置 Composio 连接服务后,即可连接应用。`)),p(`div`,Ge,[(t(!0),s(l,null,i(X.value.slice(0,W.value),e=>(t(),s(`article`,{key:e.slug,class:`app-card`},[p(`div`,Ke,[p(`span`,qe,c(e.name.slice(0,1)),1),p(`h4`,null,c(e.name),1)]),p(`p`,Je,c(e.description),1),(t(!0),s(l,null,i(Z(e.slug)?.accounts??[],n=>(t(),s(`div`,{key:n.id,class:`app-account`},[p(`span`,null,[_(c(n.alias||yt(n.status)),1),n.alias?(t(),s(`small`,Ye,c(yt(n.status)),1)):d(``,!0)]),p(`button`,{class:`danger`,disabled:O.value,"aria-label":`断开 ${e.name} ${n.alias||`账号`}`,onClick:t=>Mt(e.slug,n.id)},`断开`,8,Xe)]))),128)),R.value===e.slug?(t(),s(`label`,Ze,[r[46]||=_(`账号别名`,-1),n(p(`input`,{"onUpdate:modelValue":r[18]||=e=>z.value=e,placeholder:`例如:工作账号`,maxlength:`64`},null,512),[[m,z.value]])])):d(``,!0),p(`div`,Qe,[p(`button`,{disabled:O.value||!C.value.configured||R.value===e.slug&&!z.value.trim(),onClick:t=>jt(e)},c(R.value===e.slug?`继续连接`:Z(e.slug)?.accounts.length?`添加账号`:`连接`),9,$e),Z(e.slug)?.accounts.length?(t(),s(`button`,{key:0,disabled:O.value,onClick:t=>Nt(e.slug)},`授权 Bot`,8,et)):d(``,!0)]),U.value[e.slug]?(t(),s(`a`,{key:1,href:U.value[e.slug],target:`_blank`,rel:`noopener noreferrer`},[r[47]||=_(`继续授权 `,-1),y(x,{name:`external`,size:13})],8,tt)):d(``,!0),Z(e.slug)?(t(),s(`p`,nt,c(bt(Z(e.slug).agentIds)),1)):d(``,!0),I.value===e.slug?(t(),s(`form`,{key:3,class:`grant-editor`,onSubmit:g(Pt,[`prevent`]),onChange:r[21]||=e=>h(`dirty-change`,!0)},[p(`fieldset`,null,[r[48]||=p(`legend`,null,`允许使用的 Bot`,-1),(t(!0),s(l,null,i(J.value,e=>(t(),s(`label`,{key:e.id,class:`check-row`},[n(p(`input`,{"onUpdate:modelValue":r[19]||=e=>L.value=e,type:`checkbox`,value:e.id},null,8,rt),[[f,L.value]]),_(c(e.name),1)]))),128))]),p(`div`,it,[p(`button`,{type:`button`,disabled:O.value,onClick:r[20]||=e=>{I.value=``,h(`dirty-change`,!1)}},`取消`,8,at),p(`button`,{type:`submit`,disabled:O.value},`保存授权`,8,ot)])],32)):d(``,!0)]))),128))]),X.value.length>W.value?(t(),s(`button`,{key:1,type:`button`,onClick:r[22]||=e=>W.value+=40},`显示更多应用(`+c(X.value.length-W.value)+`)`,1)):d(``,!0),X.value.length?d(``,!0):(t(),s(`p`,st,c(j.value?`没有匹配的应用。`:`还没有已连接的应用。可前往应用目录添加。`),1)),p(`details`,{class:`connection-settings`,open:!C.value.configured},[p(`summary`,null,[r[49]||=_(`应用连接服务 `,-1),p(`span`,null,c(C.value.configured?`已配置`:`未配置`),1)]),r[54]||=p(`p`,{class:`hint`},`使用你的 Composio 项目连接应用。密钥加密保存在服务器,仅用于当前账号。`,-1),p(`form`,{onSubmit:r[26]||=g(e=>At(),[`prevent`]),onInput:r[27]||=e=>h(`dirty-change`,!0)},[p(`label`,null,[r[50]||=_(`Composio API Key`,-1),n(p(`input`,{"onUpdate:modelValue":r[23]||=e=>M.value=e,type:`password`,autocomplete:`new-password`,placeholder:C.value.configured?`已保存,输入新密钥可替换`:`ak_…`},null,8,lt),[[m,M.value]])]),p(`details`,null,[r[52]||=p(`summary`,null,`自定义 Auth Config(可选)`,-1),p(`label`,null,[r[51]||=_(`应用与 Auth Config 映射(JSON)`,-1),n(p(`textarea`,{"onUpdate:modelValue":r[24]||=e=>N.value=e,rows:`3`,spellcheck:`false`},null,512),[[m,N.value]])])]),p(`div`,ut,[p(`button`,{type:`submit`,disabled:O.value||!M.value.trim()},`保存连接服务`,8,dt),C.value.configured?(t(),s(`button`,{key:0,type:`button`,class:`danger`,disabled:O.value,onClick:r[25]||=e=>At(!0)},`清除配置`,8,ft)):d(``,!0),r[53]||=p(`a`,{href:`https://dashboard.composio.dev`,target:`_blank`,rel:`noopener noreferrer`},`获取 API Key`,-1)])],32)],8,ct)],64))]))}}),[[`__scopeId`,`data-v-9850b6a3`]]),w=v({__name:`BotPluginsDialog`,emits:[`close`],setup(e,{emit:n}){let r=n,i=u(!1),a=()=>!i.value||window.confirm(`放弃尚未保存的插件更改?`);return(e,n)=>(t(),te(S,{title:`已连接应用`,"before-close":a,onClose:n[1]||=e=>r(`close`)},{default:ee(()=>[y(C,{onDirtyChange:n[0]||=e=>i.value=e})]),_:1}))}});export{w as default};
2
- //# sourceMappingURL=BotPluginsDialog-Ckiwmito.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BotPluginsDialog-Ckiwmito.js","names":[],"sources":["../../src/client/components/workspace/BotPluginsPanel.vue","../../src/client/components/workspace/BotPluginsPanel.vue","../../src/client/components/workspace/BotPluginsDialog.vue","../../src/client/components/workspace/BotPluginsDialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'\nimport { apiRequest } from '@/api/client'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport type { JsonValue } from '@shared/types'\nimport type { WorkspaceAgent } from '@shared/workspace'\nimport type { BotAppCard, BotAppConnection, BotMcpPlugin, BotPluginSettings } from '@shared/workspacePlugins'\n\nconst emit = defineEmits<{ 'dirty-change': [value: boolean] }>()\nconst base = '/api/app/bot-tools'\nconst surface = ref<'apps' | 'mcp'>('apps'), view = ref('marketplace')\nconst settings = ref<BotPluginSettings>({ configured: false, revision: 0 }), canManage = ref(false)\nconst plugins = ref<BotMcpPlugin[]>([]), cards = ref<BotAppCard[]>([]), connections = ref<BotAppConnection[]>([]), agents = ref<WorkspaceAgent[]>([])\nconst agentsLoaded = ref(false)\nconst loading = ref(true), busy = ref(false), error = ref(''), notice = ref(''), search = ref(''), apiKey = ref(''), authConfigs = ref('{}')\nconst editing = ref<string | null>(null), editorOpen = ref(false), grantSlug = ref(''), grantIds = ref<string[]>([]), aliasSlug = ref(''), alias = ref('')\nconst mcpGrantId = ref(''), mcpGrantIds = ref<string[]>([]), mcpGrantRevision = ref(0)\nconst form = reactive({ name: '', transport: 'stdio' as 'stdio' | 'http', command: 'npx', args: '[]', url: '', env: '{}', headers: '{}', agentIds: [] as string[], revision: 0 })\nconst pendingUrls = ref<Record<string, string>>({})\nconst visibleCount = ref(40)\nwatch([search, view], () => { visibleCount.value = 40 })\nlet closed = false, generation = 0, timer: ReturnType<typeof setTimeout> | undefined\nconst call = <T,>(path: string, method: string, body?: unknown) => apiRequest<T>(base + path, { method, ...(body === undefined ? {} : { body: body as JsonValue }) })\nconst selectable = computed(() => agents.value.filter(a => !a.archived && !a.remoteAgentId && !a.temporaryGoalId))\nconst validAgentIds = (ids: string[]) => ids.filter(id => selectable.value.some(agent => agent.id === id))\nconst filtered = computed(() => {\n const all = new Map(cards.value.map(c => [c.slug, c]))\n for (const c of connections.value) if (!all.has(c.slug)) all.set(c.slug, { slug: c.slug, name: c.slug, description: '' })\n const query = search.value.trim().toLowerCase()\n return [...all.values()].filter(c => (view.value !== 'connected' || connections.value.some(item => item.slug === c.slug)) && `${c.name} ${c.slug} ${c.description}`.toLowerCase().includes(query))\n})\nconst connected = (slug: string) => connections.value.find(c => c.slug === slug)\nconst stateLabel = (status: string) => ({ ACTIVE: '已连接', INITIATED: '待授权', INITIALIZING: '连接中', PENDING: '待授权', EXPIRED: '已过期', FAILED: '连接失败', INACTIVE: '未启用' }[status.toUpperCase()] ?? status)\nconst grantNames = (ids: string[]) => !agentsLoaded.value ? 'Bot 授权暂不可读' : ids.map(id => selectable.value.find(a => a.id === id)?.name).filter(Boolean).join('、') || '尚未授权 Bot'\nasync function load() {\n const version = ++generation\n const results = await Promise.allSettled([\n apiRequest<BotPluginSettings & { canManageMcp: boolean }>(base + '/settings'),\n apiRequest<{ plugins: BotMcpPlugin[]; canManage: boolean }>(base + '/mcp'),\n apiRequest<{ cards: BotAppCard[] }>(base + '/apps/catalog'),\n apiRequest<{ connections: BotAppConnection[]; authoritative: boolean }>(base + '/apps'),\n apiRequest<{ agents: WorkspaceAgent[] }>('/api/app/agents'),\n ])\n if (closed || version !== generation) return\n const [s, m, c, a, bots] = results\n if (s.status === 'fulfilled') { settings.value = s.value; canManage.value = s.value.canManageMcp }\n if (m.status === 'fulfilled') plugins.value = m.value.plugins\n if (c.status === 'fulfilled') cards.value = c.value.cards\n if (a.status === 'fulfilled' && a.value.authoritative) connections.value = a.value.connections\n agentsLoaded.value = bots.status === 'fulfilled'\n if (bots.status === 'fulfilled') agents.value = bots.value.agents\n error.value = results.filter((r): r is PromiseRejectedResult => r.status === 'rejected').map(r => r.reason instanceof Error ? r.reason.message : '读取失败,请重试').join(';')\n loading.value = false\n}\nasync function action(fn: () => Promise<void>) {\n if (busy.value) return\n busy.value = true; error.value = ''; notice.value = ''\n try { await fn(); if (!closed) await load() } catch (e) { if (!closed) error.value = e instanceof Error ? e.message : '操作失败,请重试' }\n finally { busy.value = false }\n}\nfunction edit(plugin?: BotMcpPlugin) {\n mcpGrantId.value = ''\n editing.value = plugin?.id ?? null\n Object.assign(form, { name: plugin?.name ?? '', transport: plugin?.transport ?? 'stdio', command: plugin?.command ?? 'npx', args: JSON.stringify(plugin?.args ?? [], null, 2), url: plugin?.url ?? '', env: JSON.stringify(Object.fromEntries((plugin?.envKeys ?? []).map(k => [k, true])), null, 2), headers: JSON.stringify(Object.fromEntries((plugin?.headerKeys ?? []).map(k => [k, true])), null, 2), agentIds: validAgentIds(plugin?.agentIds ?? []), revision: plugin?.revision ?? 0 })\n editorOpen.value = true; emit('dirty-change', false)\n}\nfunction closeEditor() { editorOpen.value = false; emit('dirty-change', false) }\nasync function save() {\n await action(async () => {\n let args: unknown, env: unknown, headers: unknown\n try { args = JSON.parse(form.args); env = JSON.parse(form.env); headers = JSON.parse(form.headers) } catch { throw new Error('参数、环境变量和请求头必须是有效 JSON') }\n const definition = { name: form.name, transport: form.transport, command: form.command, args, url: form.url, env, headers, agentIds: form.agentIds }\n await call(editing.value ? '/mcp/' + editing.value : '/mcp', editing.value ? 'PUT' : 'POST', editing.value ? { definition, revision: form.revision } : definition)\n closeEditor(); notice.value = '已保存。测试连接成功后即可启用。'\n })\n}\nasync function test(plugin: BotMcpPlugin) { await action(async () => { const result = await call<{ plugin: BotMcpPlugin }>('/mcp/' + plugin.id + '/test', 'POST', {}); notice.value = `服务器连接成功,发现 ${result.plugin.toolCount} 个工具。服务登录状态需另行确认。` }) }\nasync function toggle(plugin: BotMcpPlugin) { await action(async () => { await call('/mcp/' + plugin.id, 'PATCH', { enabled: !plugin.enabled, revision: plugin.revision }) }) }\nasync function remove(plugin: BotMcpPlugin) { if (window.confirm(`移除插件“${plugin.name}”?此插件将不再提供给 Bot。`)) await action(async () => { await call('/mcp/' + plugin.id, 'DELETE'); if (mcpGrantId.value === plugin.id) closeMcpGrant() }) }\nfunction openMcpGrant(plugin: BotMcpPlugin) {\n closeEditor()\n mcpGrantId.value = plugin.id; mcpGrantIds.value = validAgentIds(plugin.agentIds); mcpGrantRevision.value = plugin.revision\n}\nfunction closeMcpGrant() { mcpGrantId.value = ''; emit('dirty-change', false) }\nasync function saveMcpGrant() {\n await action(async () => {\n await call('/mcp/' + mcpGrantId.value, 'PATCH', { agentIds: mcpGrantIds.value, revision: mcpGrantRevision.value })\n closeMcpGrant(); notice.value = 'Bot 授权已保存,将用于下一轮对话。'\n })\n}\nasync function configure(clear = false) {\n if (clear && !window.confirm('清除当前账号的应用连接服务配置?Bot 将暂时无法使用这些应用。')) return\n await action(async () => {\n let configs: unknown\n try { configs = JSON.parse(authConfigs.value) } catch { throw new Error('Auth Config 映射必须是有效 JSON') }\n await call('/settings', 'PUT', { apiKey: clear ? '' : apiKey.value, revision: settings.value.revision, authConfigs: configs })\n apiKey.value = ''; authConfigs.value = '{}'; emit('dirty-change', false); notice.value = clear ? '已清除连接服务配置。' : '应用连接服务已配置。'\n })\n}\nasync function connect(card: BotAppCard) {\n if (busy.value) return\n if (connected(card.slug)?.accounts.length && aliasSlug.value !== card.slug) { aliasSlug.value = card.slug; alias.value = ''; return }\n const popup = window.open('about:blank', '_blank')\n if (popup) popup.opener = null\n const previousAccounts = new Set(connected(card.slug)?.accounts.map(a => a.id) ?? [])\n await action(async () => {\n try {\n const result = await call<{ url: string }>('/apps/' + card.slug + '/authorize', 'POST', alias.value.trim() && aliasSlug.value === card.slug ? { alias: alias.value.trim() } : {})\n pendingUrls.value[card.slug] = result.url\n if (popup) popup.location.href = result.url\n aliasSlug.value = ''; alias.value = ''; notice.value = '请在新窗口完成授权,然后刷新连接状态。'\n clearTimeout(timer); let attempts = 0\n const poll = async () => {\n if (closed) return\n await load()\n const completed = connected(card.slug)?.accounts.some(a => !previousAccounts.has(a.id) && a.status.toUpperCase() === 'ACTIVE')\n if (completed) { delete pendingUrls.value[card.slug]; notice.value = `${card.name} 已连接。` }\n else if (!closed && ++attempts < 24) timer = setTimeout(poll, 5000)\n }\n timer = setTimeout(poll, 5000)\n } catch (e) { popup?.close(); throw e }\n })\n}\nasync function disconnect(slug: string, id: string) { if (window.confirm('断开这个应用账号?其他账号的连接会保留。')) await action(async () => { await call('/apps/' + slug + '/accounts/' + encodeURIComponent(id), 'DELETE'); delete pendingUrls.value[slug] }) }\nfunction openGrant(slug: string) { grantSlug.value = slug; grantIds.value = [...(connected(slug)?.agentIds ?? [])] }\nasync function saveGrant() { await action(async () => { await call('/apps/' + grantSlug.value + '/agents', 'PUT', { agentIds: grantIds.value, revision: connected(grantSlug.value)?.revision ?? 0 }); grantSlug.value = ''; emit('dirty-change', false) }) }\nonMounted(load)\nonBeforeUnmount(() => { closed = true; generation++; clearTimeout(timer) })\n</script>\n\n<template>\n <section class=\"bot-plugins\" aria-label=\"Bot 插件管理\">\n <p class=\"intro\">为 Bot 连接应用和工具,按需选择可使用它们的机器人。</p>\n <div class=\"plugin-tabs\" role=\"tablist\" aria-label=\"插件类型\">\n <button type=\"button\" role=\"tab\" :aria-selected=\"surface === 'apps'\" @click=\"surface = 'apps'\"><AppIcon name=\"link\" :size=\"17\" />应用</button>\n <button type=\"button\" role=\"tab\" :aria-selected=\"surface === 'mcp'\" @click=\"surface = 'mcp'\"><AppIcon name=\"tools\" :size=\"17\" />MCP 服务</button>\n </div>\n <p v-if=\"error\" class=\"plugin-error\" role=\"alert\">{{ error }} <button type=\"button\" :disabled=\"busy\" @click=\"load\">重试</button></p>\n <p v-if=\"notice\" class=\"plugin-notice\" role=\"status\">{{ notice }}</p>\n <p v-if=\"loading\" role=\"status\">正在读取插件…</p>\n <template v-else-if=\"surface === 'mcp'\">\n <div class=\"plugin-toolbar\"><p>自定义 MCP 服务</p><button :disabled=\"!canManage || busy || !agentsLoaded\" @click=\"edit()\"><AppIcon name=\"plus\" :size=\"16\" />添加服务</button></div>\n <p class=\"hint\">stdio 程序及其路径在当前连接的夭夭服务器上运行和读取;HTTP / HTTPS 地址也由服务器连接。客户端通过服务器使用已授权的工具,无需安装 MCP 程序。</p>\n <p v-if=\"!canManage\" class=\"hint\">自定义 MCP 服务由管理员管理。</p>\n <form v-if=\"editorOpen\" class=\"plugin-editor\" aria-label=\"MCP 服务配置\" @submit.prevent=\"save\" @input=\"emit('dirty-change', true)\" @change=\"emit('dirty-change', true)\">\n <h4>{{ editing ? '编辑 MCP 服务' : '添加 MCP 服务' }}</h4>\n <label>名称<input v-model=\"form.name\" required maxlength=\"80\" /></label>\n <label>连接方式<select v-model=\"form.transport\"><option value=\"stdio\">服务器程序(stdio)</option><option value=\"http\">远程地址(HTTP / HTTPS)</option></select></label>\n <template v-if=\"form.transport === 'stdio'\"><label>服务器程序<input v-model=\"form.command\" required placeholder=\"服务器上的 npx 或程序完整路径\" /></label><label>参数(JSON 数组)<textarea v-model=\"form.args\" rows=\"3\" spellcheck=\"false\" /></label><label>环境变量(JSON)<textarea v-model=\"form.env\" rows=\"3\" spellcheck=\"false\" autocomplete=\"off\" /></label><p class=\"hint\">程序和参数中的文件路径须在服务器上可用。所需账号配置和环境变量也须提供给服务器上的 MCP 进程。</p></template>\n <template v-else><label>MCP 地址<input v-model=\"form.url\" type=\"url\" required placeholder=\"https://example.com/mcp\" /></label><label>请求头(JSON)<textarea v-model=\"form.headers\" rows=\"3\" spellcheck=\"false\" autocomplete=\"off\" /></label></template>\n <p class=\"hint\">凭据请放在环境变量或请求头中。已保存的值用 true 表示保留,不会回显。</p>\n <fieldset><legend>允许使用的 Bot</legend><label v-for=\"agent in selectable\" :key=\"agent.id\" class=\"check-row\"><input v-model=\"form.agentIds\" type=\"checkbox\" :value=\"agent.id\" />{{ agent.name }}</label><p v-if=\"!selectable.length\" class=\"hint\">创建 Bot 后可在这里授权。</p></fieldset>\n <div class=\"editor-actions\"><button type=\"button\" :disabled=\"busy\" @click=\"closeEditor\">取消</button><button type=\"submit\" class=\"primary\" :disabled=\"busy || !agentsLoaded\">{{ busy ? '保存中…' : '保存服务' }}</button></div>\n </form>\n <p v-if=\"!plugins.length && !editorOpen\" class=\"plugin-empty\">还没有 MCP 服务。添加服务并测试连接后,即可授权 Bot 使用。</p>\n <article v-for=\"plugin in plugins\" :key=\"plugin.id\" class=\"mcp-card\">\n <div class=\"card-heading\"><AppIcon name=\"tools\" :size=\"20\" /><h4>{{ plugin.name }}</h4><span class=\"badge\" :class=\"{ enabled: plugin.enabled }\">{{ plugin.enabled ? '已启用' : '未启用' }}</span></div>\n <p class=\"hint endpoint\">{{ plugin.transport === 'stdio' ? plugin.command : plugin.url }}</p>\n <p class=\"hint\">{{ plugin.transport === 'stdio' ? '运行于夭夭服务器' : '由夭夭服务器连接' }} · {{ plugin.testedAt ? `已发现 ${plugin.toolCount} 个工具` : '尚未测试连接' }} · {{ grantNames(plugin.agentIds) }}</p>\n <p v-if=\"agentsLoaded && validAgentIds(plugin.agentIds).length !== plugin.agentIds.length\" class=\"hint\">部分 Bot 授权已失效,请重新选择可使用此服务的 Bot。</p>\n <p v-if=\"agentsLoaded && plugin.enabled && !validAgentIds(plugin.agentIds).length\" class=\"hint\">服务已启用,尚无可使用它的 Bot。请先授权 Bot。</p>\n <div class=\"card-actions\"><button :disabled=\"busy || !canManage\" @click=\"test(plugin)\">测试连接</button><button :disabled=\"busy || !canManage || (!plugin.enabled && !plugin.testedAt)\" @click=\"toggle(plugin)\">{{ plugin.enabled ? '停用' : '启用' }}</button><button :disabled=\"busy || !canManage || !agentsLoaded\" @click=\"openMcpGrant(plugin)\">授权 Bot</button><button :disabled=\"busy || !canManage || !agentsLoaded\" @click=\"edit(plugin)\">编辑</button><button class=\"danger\" :disabled=\"busy || !canManage\" @click=\"remove(plugin)\">移除</button></div>\n <form v-if=\"mcpGrantId === plugin.id\" class=\"grant-editor\" aria-label=\"MCP Bot 授权\" @submit.prevent=\"saveMcpGrant\" @change=\"emit('dirty-change', true)\">\n <fieldset><legend>允许使用的 Bot</legend><label v-for=\"agent in selectable\" :key=\"agent.id\" class=\"check-row\"><input v-model=\"mcpGrantIds\" type=\"checkbox\" :value=\"agent.id\" :disabled=\"busy\" />{{ agent.name }}</label><p v-if=\"!selectable.length\" class=\"hint\">创建 Bot 后可在这里授权。</p></fieldset>\n <p class=\"hint\">授权按 Bot 保存,同一账号在各客户端均可使用。更改授权后,连接验证结果和服务启用状态会保留。</p>\n <div class=\"card-actions\"><button type=\"button\" :disabled=\"busy\" @click=\"closeMcpGrant\">取消</button><button type=\"submit\" :disabled=\"busy || !canManage || !agentsLoaded\">保存授权</button></div>\n </form>\n </article>\n </template>\n <template v-else-if=\"!loading\">\n <div class=\"plugin-toolbar\"><div class=\"view-tabs\" role=\"tablist\" aria-label=\"应用列表\"><button role=\"tab\" :aria-selected=\"view === 'marketplace'\" @click=\"view = 'marketplace'\">应用目录</button><button role=\"tab\" :aria-selected=\"view === 'connected'\" @click=\"view = 'connected'\">已连接 {{ connections.length || '' }}</button></div><button :disabled=\"busy\" aria-label=\"刷新应用连接\" @click=\"load\"><AppIcon name=\"refresh\" :size=\"17\" /></button></div>\n <label class=\"plugin-search\"><AppIcon name=\"search\" :size=\"17\" /><input v-model=\"search\" type=\"search\" aria-label=\"搜索应用\" placeholder=\"搜索应用\" /></label>\n <p v-if=\"!settings.configured\" class=\"plugin-notice\">配置 Composio 连接服务后,即可连接应用。</p>\n <div class=\"app-grid\"><article v-for=\"card in filtered.slice(0, visibleCount)\" :key=\"card.slug\" class=\"app-card\">\n <div class=\"card-heading\"><span class=\"app-monogram\" aria-hidden=\"true\">{{ card.name.slice(0, 1) }}</span><h4>{{ card.name }}</h4></div><p class=\"hint\">{{ card.description }}</p>\n <div v-for=\"account in connected(card.slug)?.accounts ?? []\" :key=\"account.id\" class=\"app-account\"><span>{{ account.alias || stateLabel(account.status) }}<small v-if=\"account.alias\">{{ stateLabel(account.status) }}</small></span><button class=\"danger\" :disabled=\"busy\" :aria-label=\"`断开 ${card.name} ${account.alias || '账号'}`\" @click=\"disconnect(card.slug, account.id)\">断开</button></div>\n <label v-if=\"aliasSlug === card.slug\">账号别名<input v-model=\"alias\" placeholder=\"例如:工作账号\" maxlength=\"64\" /></label>\n <div class=\"card-actions\"><button :disabled=\"busy || !settings.configured || (aliasSlug === card.slug && !alias.trim())\" @click=\"connect(card)\">{{ aliasSlug === card.slug ? '继续连接' : connected(card.slug)?.accounts.length ? '添加账号' : '连接' }}</button><button v-if=\"connected(card.slug)?.accounts.length\" :disabled=\"busy\" @click=\"openGrant(card.slug)\">授权 Bot</button></div>\n <a v-if=\"pendingUrls[card.slug]\" :href=\"pendingUrls[card.slug]\" target=\"_blank\" rel=\"noopener noreferrer\">继续授权 <AppIcon name=\"external\" :size=\"13\" /></a>\n <p v-if=\"connected(card.slug)\" class=\"hint\">{{ grantNames(connected(card.slug)!.agentIds) }}</p>\n <form v-if=\"grantSlug === card.slug\" class=\"grant-editor\" @submit.prevent=\"saveGrant\" @change=\"emit('dirty-change', true)\"><fieldset><legend>允许使用的 Bot</legend><label v-for=\"agent in selectable\" :key=\"agent.id\" class=\"check-row\"><input v-model=\"grantIds\" type=\"checkbox\" :value=\"agent.id\" />{{ agent.name }}</label></fieldset><div class=\"card-actions\"><button type=\"button\" :disabled=\"busy\" @click=\"grantSlug = ''; emit('dirty-change', false)\">取消</button><button type=\"submit\" :disabled=\"busy\">保存授权</button></div></form>\n </article></div>\n <button v-if=\"filtered.length > visibleCount\" type=\"button\" @click=\"visibleCount += 40\">显示更多应用({{ filtered.length - visibleCount }})</button>\n <p v-if=\"!filtered.length\" class=\"plugin-empty\">{{ search ? '没有匹配的应用。' : '还没有已连接的应用。可前往应用目录添加。' }}</p>\n <details class=\"connection-settings\" :open=\"!settings.configured\"><summary>应用连接服务 <span>{{ settings.configured ? '已配置' : '未配置' }}</span></summary><p class=\"hint\">使用你的 Composio 项目连接应用。密钥加密保存在服务器,仅用于当前账号。</p><form @submit.prevent=\"configure()\" @input=\"emit('dirty-change', true)\"><label>Composio API Key<input v-model=\"apiKey\" type=\"password\" autocomplete=\"new-password\" :placeholder=\"settings.configured ? '已保存,输入新密钥可替换' : 'ak_…'\" /></label><details><summary>自定义 Auth Config(可选)</summary><label>应用与 Auth Config 映射(JSON)<textarea v-model=\"authConfigs\" rows=\"3\" spellcheck=\"false\" /></label></details><div class=\"card-actions\"><button type=\"submit\" :disabled=\"busy || !apiKey.trim()\">保存连接服务</button><button v-if=\"settings.configured\" type=\"button\" class=\"danger\" :disabled=\"busy\" @click=\"configure(true)\">清除配置</button><a href=\"https://dashboard.composio.dev\" target=\"_blank\" rel=\"noopener noreferrer\">获取 API Key</a></div></form></details>\n </template>\n </section>\n</template>\n\n<style scoped>\n.bot-plugins{display:grid;gap:16px;color:var(--text-primary);font-size:13px}.intro,.hint{color:var(--text-secondary);line-height:1.6;margin:0}.hint{font-size:12px}.plugin-tabs,.view-tabs,.plugin-toolbar,.card-heading,.card-actions,.editor-actions{display:flex;align-items:center;gap:8px}.plugin-tabs{border-bottom:1px solid var(--line);padding-bottom:8px}.plugin-tabs button[aria-selected=true],.view-tabs button[aria-selected=true]{background:var(--surface-soft);font-weight:650}.plugin-toolbar{justify-content:space-between}.plugin-toolbar p{margin:0;font-weight:650}.card-heading h4{font-size:14px;margin:0;flex:1;min-width:0;overflow-wrap:anywhere}.card-actions{flex-wrap:wrap}.bot-plugins button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:36px;padding:6px 10px;border:1px solid var(--line);border-radius:8px;background:var(--surface-raised);color:inherit;font:inherit;cursor:pointer}.bot-plugins button:hover{background:var(--surface-hover)}.bot-plugins button:disabled{opacity:.45;cursor:not-allowed}.bot-plugins :is(button,input,select,textarea,a,summary):focus-visible{outline:2px solid var(--accent);outline-offset:2px}.bot-plugins a{color:var(--accent);display:inline-flex;align-items:center;gap:4px}.bot-plugins .danger{color:var(--danger)}.bot-plugins .primary{background:var(--accent);color:var(--text-on-solid);border-color:var(--accent)}.bot-plugins label{display:grid;gap:6px;font-size:12px;line-height:1.6}.bot-plugins input:not([type=checkbox]),.bot-plugins select,.bot-plugins textarea{width:100%;box-sizing:border-box;min-width:0;padding:9px 10px;border:1px solid var(--line);border-radius:8px;color:var(--text-primary);background:var(--surface);font:inherit}.bot-plugins textarea{resize:vertical;font-family:var(--font-mono,monospace)}.plugin-search{position:relative}.plugin-search>svg{position:absolute;left:10px;top:11px;color:var(--text-muted)}.plugin-search input{padding-left:34px!important}.plugin-editor,.mcp-card,.app-card,.connection-settings{border:1px solid var(--line);border-radius:12px;padding:14px;display:grid;gap:12px;background:var(--surface)}.plugin-editor h4{margin:0}.plugin-editor{background:var(--surface-soft)}.editor-actions{justify-content:flex-end}.bot-plugins fieldset{border:1px solid var(--line);border-radius:8px;display:grid;gap:4px;max-height:180px;overflow:auto}.bot-plugins .check-row{display:flex;align-items:center;gap:8px;min-height:32px}.check-row input{accent-color:var(--accent)}.app-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px}.app-card{align-content:start}.app-monogram{display:grid;place-items:center;width:34px;height:34px;flex-shrink:0;border-radius:9px;background:var(--surface-soft);font-size:17px;font-weight:650}.app-account{display:flex;align-items:center;justify-content:space-between;gap:8px;border-top:1px solid var(--line);padding-top:8px}.app-account span{min-width:0;overflow-wrap:anywhere}.app-account small{display:block;color:var(--text-muted);margin-top:3px}.badge{font-size:11px;color:var(--text-muted);white-space:nowrap}.badge.enabled{color:var(--accent)}.endpoint{overflow-wrap:anywhere}.plugin-error,.plugin-notice{padding:12px;border-radius:8px;background:var(--surface-soft);margin:0;line-height:1.6}.plugin-error{color:var(--danger)}.plugin-empty{text-align:center;color:var(--text-secondary);padding:28px 12px;line-height:1.8}.connection-settings{display:block}.connection-settings summary{cursor:pointer;font-weight:600;line-height:1.8}.connection-settings summary span{float:right;font-weight:400;color:var(--text-muted)}.connection-settings p{margin:12px 0}.connection-settings form{display:grid;gap:12px}.grant-editor{display:grid;gap:8px}@media(max-width:767px){.app-grid{grid-template-columns:1fr}.bot-plugins button{min-height:44px}.bot-plugins .check-row{min-height:44px}}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'\nimport { apiRequest } from '@/api/client'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport type { JsonValue } from '@shared/types'\nimport type { WorkspaceAgent } from '@shared/workspace'\nimport type { BotAppCard, BotAppConnection, BotMcpPlugin, BotPluginSettings } from '@shared/workspacePlugins'\n\nconst emit = defineEmits<{ 'dirty-change': [value: boolean] }>()\nconst base = '/api/app/bot-tools'\nconst surface = ref<'apps' | 'mcp'>('apps'), view = ref('marketplace')\nconst settings = ref<BotPluginSettings>({ configured: false, revision: 0 }), canManage = ref(false)\nconst plugins = ref<BotMcpPlugin[]>([]), cards = ref<BotAppCard[]>([]), connections = ref<BotAppConnection[]>([]), agents = ref<WorkspaceAgent[]>([])\nconst agentsLoaded = ref(false)\nconst loading = ref(true), busy = ref(false), error = ref(''), notice = ref(''), search = ref(''), apiKey = ref(''), authConfigs = ref('{}')\nconst editing = ref<string | null>(null), editorOpen = ref(false), grantSlug = ref(''), grantIds = ref<string[]>([]), aliasSlug = ref(''), alias = ref('')\nconst mcpGrantId = ref(''), mcpGrantIds = ref<string[]>([]), mcpGrantRevision = ref(0)\nconst form = reactive({ name: '', transport: 'stdio' as 'stdio' | 'http', command: 'npx', args: '[]', url: '', env: '{}', headers: '{}', agentIds: [] as string[], revision: 0 })\nconst pendingUrls = ref<Record<string, string>>({})\nconst visibleCount = ref(40)\nwatch([search, view], () => { visibleCount.value = 40 })\nlet closed = false, generation = 0, timer: ReturnType<typeof setTimeout> | undefined\nconst call = <T,>(path: string, method: string, body?: unknown) => apiRequest<T>(base + path, { method, ...(body === undefined ? {} : { body: body as JsonValue }) })\nconst selectable = computed(() => agents.value.filter(a => !a.archived && !a.remoteAgentId && !a.temporaryGoalId))\nconst validAgentIds = (ids: string[]) => ids.filter(id => selectable.value.some(agent => agent.id === id))\nconst filtered = computed(() => {\n const all = new Map(cards.value.map(c => [c.slug, c]))\n for (const c of connections.value) if (!all.has(c.slug)) all.set(c.slug, { slug: c.slug, name: c.slug, description: '' })\n const query = search.value.trim().toLowerCase()\n return [...all.values()].filter(c => (view.value !== 'connected' || connections.value.some(item => item.slug === c.slug)) && `${c.name} ${c.slug} ${c.description}`.toLowerCase().includes(query))\n})\nconst connected = (slug: string) => connections.value.find(c => c.slug === slug)\nconst stateLabel = (status: string) => ({ ACTIVE: '已连接', INITIATED: '待授权', INITIALIZING: '连接中', PENDING: '待授权', EXPIRED: '已过期', FAILED: '连接失败', INACTIVE: '未启用' }[status.toUpperCase()] ?? status)\nconst grantNames = (ids: string[]) => !agentsLoaded.value ? 'Bot 授权暂不可读' : ids.map(id => selectable.value.find(a => a.id === id)?.name).filter(Boolean).join('、') || '尚未授权 Bot'\nasync function load() {\n const version = ++generation\n const results = await Promise.allSettled([\n apiRequest<BotPluginSettings & { canManageMcp: boolean }>(base + '/settings'),\n apiRequest<{ plugins: BotMcpPlugin[]; canManage: boolean }>(base + '/mcp'),\n apiRequest<{ cards: BotAppCard[] }>(base + '/apps/catalog'),\n apiRequest<{ connections: BotAppConnection[]; authoritative: boolean }>(base + '/apps'),\n apiRequest<{ agents: WorkspaceAgent[] }>('/api/app/agents'),\n ])\n if (closed || version !== generation) return\n const [s, m, c, a, bots] = results\n if (s.status === 'fulfilled') { settings.value = s.value; canManage.value = s.value.canManageMcp }\n if (m.status === 'fulfilled') plugins.value = m.value.plugins\n if (c.status === 'fulfilled') cards.value = c.value.cards\n if (a.status === 'fulfilled' && a.value.authoritative) connections.value = a.value.connections\n agentsLoaded.value = bots.status === 'fulfilled'\n if (bots.status === 'fulfilled') agents.value = bots.value.agents\n error.value = results.filter((r): r is PromiseRejectedResult => r.status === 'rejected').map(r => r.reason instanceof Error ? r.reason.message : '读取失败,请重试').join(';')\n loading.value = false\n}\nasync function action(fn: () => Promise<void>) {\n if (busy.value) return\n busy.value = true; error.value = ''; notice.value = ''\n try { await fn(); if (!closed) await load() } catch (e) { if (!closed) error.value = e instanceof Error ? e.message : '操作失败,请重试' }\n finally { busy.value = false }\n}\nfunction edit(plugin?: BotMcpPlugin) {\n mcpGrantId.value = ''\n editing.value = plugin?.id ?? null\n Object.assign(form, { name: plugin?.name ?? '', transport: plugin?.transport ?? 'stdio', command: plugin?.command ?? 'npx', args: JSON.stringify(plugin?.args ?? [], null, 2), url: plugin?.url ?? '', env: JSON.stringify(Object.fromEntries((plugin?.envKeys ?? []).map(k => [k, true])), null, 2), headers: JSON.stringify(Object.fromEntries((plugin?.headerKeys ?? []).map(k => [k, true])), null, 2), agentIds: validAgentIds(plugin?.agentIds ?? []), revision: plugin?.revision ?? 0 })\n editorOpen.value = true; emit('dirty-change', false)\n}\nfunction closeEditor() { editorOpen.value = false; emit('dirty-change', false) }\nasync function save() {\n await action(async () => {\n let args: unknown, env: unknown, headers: unknown\n try { args = JSON.parse(form.args); env = JSON.parse(form.env); headers = JSON.parse(form.headers) } catch { throw new Error('参数、环境变量和请求头必须是有效 JSON') }\n const definition = { name: form.name, transport: form.transport, command: form.command, args, url: form.url, env, headers, agentIds: form.agentIds }\n await call(editing.value ? '/mcp/' + editing.value : '/mcp', editing.value ? 'PUT' : 'POST', editing.value ? { definition, revision: form.revision } : definition)\n closeEditor(); notice.value = '已保存。测试连接成功后即可启用。'\n })\n}\nasync function test(plugin: BotMcpPlugin) { await action(async () => { const result = await call<{ plugin: BotMcpPlugin }>('/mcp/' + plugin.id + '/test', 'POST', {}); notice.value = `服务器连接成功,发现 ${result.plugin.toolCount} 个工具。服务登录状态需另行确认。` }) }\nasync function toggle(plugin: BotMcpPlugin) { await action(async () => { await call('/mcp/' + plugin.id, 'PATCH', { enabled: !plugin.enabled, revision: plugin.revision }) }) }\nasync function remove(plugin: BotMcpPlugin) { if (window.confirm(`移除插件“${plugin.name}”?此插件将不再提供给 Bot。`)) await action(async () => { await call('/mcp/' + plugin.id, 'DELETE'); if (mcpGrantId.value === plugin.id) closeMcpGrant() }) }\nfunction openMcpGrant(plugin: BotMcpPlugin) {\n closeEditor()\n mcpGrantId.value = plugin.id; mcpGrantIds.value = validAgentIds(plugin.agentIds); mcpGrantRevision.value = plugin.revision\n}\nfunction closeMcpGrant() { mcpGrantId.value = ''; emit('dirty-change', false) }\nasync function saveMcpGrant() {\n await action(async () => {\n await call('/mcp/' + mcpGrantId.value, 'PATCH', { agentIds: mcpGrantIds.value, revision: mcpGrantRevision.value })\n closeMcpGrant(); notice.value = 'Bot 授权已保存,将用于下一轮对话。'\n })\n}\nasync function configure(clear = false) {\n if (clear && !window.confirm('清除当前账号的应用连接服务配置?Bot 将暂时无法使用这些应用。')) return\n await action(async () => {\n let configs: unknown\n try { configs = JSON.parse(authConfigs.value) } catch { throw new Error('Auth Config 映射必须是有效 JSON') }\n await call('/settings', 'PUT', { apiKey: clear ? '' : apiKey.value, revision: settings.value.revision, authConfigs: configs })\n apiKey.value = ''; authConfigs.value = '{}'; emit('dirty-change', false); notice.value = clear ? '已清除连接服务配置。' : '应用连接服务已配置。'\n })\n}\nasync function connect(card: BotAppCard) {\n if (busy.value) return\n if (connected(card.slug)?.accounts.length && aliasSlug.value !== card.slug) { aliasSlug.value = card.slug; alias.value = ''; return }\n const popup = window.open('about:blank', '_blank')\n if (popup) popup.opener = null\n const previousAccounts = new Set(connected(card.slug)?.accounts.map(a => a.id) ?? [])\n await action(async () => {\n try {\n const result = await call<{ url: string }>('/apps/' + card.slug + '/authorize', 'POST', alias.value.trim() && aliasSlug.value === card.slug ? { alias: alias.value.trim() } : {})\n pendingUrls.value[card.slug] = result.url\n if (popup) popup.location.href = result.url\n aliasSlug.value = ''; alias.value = ''; notice.value = '请在新窗口完成授权,然后刷新连接状态。'\n clearTimeout(timer); let attempts = 0\n const poll = async () => {\n if (closed) return\n await load()\n const completed = connected(card.slug)?.accounts.some(a => !previousAccounts.has(a.id) && a.status.toUpperCase() === 'ACTIVE')\n if (completed) { delete pendingUrls.value[card.slug]; notice.value = `${card.name} 已连接。` }\n else if (!closed && ++attempts < 24) timer = setTimeout(poll, 5000)\n }\n timer = setTimeout(poll, 5000)\n } catch (e) { popup?.close(); throw e }\n })\n}\nasync function disconnect(slug: string, id: string) { if (window.confirm('断开这个应用账号?其他账号的连接会保留。')) await action(async () => { await call('/apps/' + slug + '/accounts/' + encodeURIComponent(id), 'DELETE'); delete pendingUrls.value[slug] }) }\nfunction openGrant(slug: string) { grantSlug.value = slug; grantIds.value = [...(connected(slug)?.agentIds ?? [])] }\nasync function saveGrant() { await action(async () => { await call('/apps/' + grantSlug.value + '/agents', 'PUT', { agentIds: grantIds.value, revision: connected(grantSlug.value)?.revision ?? 0 }); grantSlug.value = ''; emit('dirty-change', false) }) }\nonMounted(load)\nonBeforeUnmount(() => { closed = true; generation++; clearTimeout(timer) })\n</script>\n\n<template>\n <section class=\"bot-plugins\" aria-label=\"Bot 插件管理\">\n <p class=\"intro\">为 Bot 连接应用和工具,按需选择可使用它们的机器人。</p>\n <div class=\"plugin-tabs\" role=\"tablist\" aria-label=\"插件类型\">\n <button type=\"button\" role=\"tab\" :aria-selected=\"surface === 'apps'\" @click=\"surface = 'apps'\"><AppIcon name=\"link\" :size=\"17\" />应用</button>\n <button type=\"button\" role=\"tab\" :aria-selected=\"surface === 'mcp'\" @click=\"surface = 'mcp'\"><AppIcon name=\"tools\" :size=\"17\" />MCP 服务</button>\n </div>\n <p v-if=\"error\" class=\"plugin-error\" role=\"alert\">{{ error }} <button type=\"button\" :disabled=\"busy\" @click=\"load\">重试</button></p>\n <p v-if=\"notice\" class=\"plugin-notice\" role=\"status\">{{ notice }}</p>\n <p v-if=\"loading\" role=\"status\">正在读取插件…</p>\n <template v-else-if=\"surface === 'mcp'\">\n <div class=\"plugin-toolbar\"><p>自定义 MCP 服务</p><button :disabled=\"!canManage || busy || !agentsLoaded\" @click=\"edit()\"><AppIcon name=\"plus\" :size=\"16\" />添加服务</button></div>\n <p class=\"hint\">stdio 程序及其路径在当前连接的夭夭服务器上运行和读取;HTTP / HTTPS 地址也由服务器连接。客户端通过服务器使用已授权的工具,无需安装 MCP 程序。</p>\n <p v-if=\"!canManage\" class=\"hint\">自定义 MCP 服务由管理员管理。</p>\n <form v-if=\"editorOpen\" class=\"plugin-editor\" aria-label=\"MCP 服务配置\" @submit.prevent=\"save\" @input=\"emit('dirty-change', true)\" @change=\"emit('dirty-change', true)\">\n <h4>{{ editing ? '编辑 MCP 服务' : '添加 MCP 服务' }}</h4>\n <label>名称<input v-model=\"form.name\" required maxlength=\"80\" /></label>\n <label>连接方式<select v-model=\"form.transport\"><option value=\"stdio\">服务器程序(stdio)</option><option value=\"http\">远程地址(HTTP / HTTPS)</option></select></label>\n <template v-if=\"form.transport === 'stdio'\"><label>服务器程序<input v-model=\"form.command\" required placeholder=\"服务器上的 npx 或程序完整路径\" /></label><label>参数(JSON 数组)<textarea v-model=\"form.args\" rows=\"3\" spellcheck=\"false\" /></label><label>环境变量(JSON)<textarea v-model=\"form.env\" rows=\"3\" spellcheck=\"false\" autocomplete=\"off\" /></label><p class=\"hint\">程序和参数中的文件路径须在服务器上可用。所需账号配置和环境变量也须提供给服务器上的 MCP 进程。</p></template>\n <template v-else><label>MCP 地址<input v-model=\"form.url\" type=\"url\" required placeholder=\"https://example.com/mcp\" /></label><label>请求头(JSON)<textarea v-model=\"form.headers\" rows=\"3\" spellcheck=\"false\" autocomplete=\"off\" /></label></template>\n <p class=\"hint\">凭据请放在环境变量或请求头中。已保存的值用 true 表示保留,不会回显。</p>\n <fieldset><legend>允许使用的 Bot</legend><label v-for=\"agent in selectable\" :key=\"agent.id\" class=\"check-row\"><input v-model=\"form.agentIds\" type=\"checkbox\" :value=\"agent.id\" />{{ agent.name }}</label><p v-if=\"!selectable.length\" class=\"hint\">创建 Bot 后可在这里授权。</p></fieldset>\n <div class=\"editor-actions\"><button type=\"button\" :disabled=\"busy\" @click=\"closeEditor\">取消</button><button type=\"submit\" class=\"primary\" :disabled=\"busy || !agentsLoaded\">{{ busy ? '保存中…' : '保存服务' }}</button></div>\n </form>\n <p v-if=\"!plugins.length && !editorOpen\" class=\"plugin-empty\">还没有 MCP 服务。添加服务并测试连接后,即可授权 Bot 使用。</p>\n <article v-for=\"plugin in plugins\" :key=\"plugin.id\" class=\"mcp-card\">\n <div class=\"card-heading\"><AppIcon name=\"tools\" :size=\"20\" /><h4>{{ plugin.name }}</h4><span class=\"badge\" :class=\"{ enabled: plugin.enabled }\">{{ plugin.enabled ? '已启用' : '未启用' }}</span></div>\n <p class=\"hint endpoint\">{{ plugin.transport === 'stdio' ? plugin.command : plugin.url }}</p>\n <p class=\"hint\">{{ plugin.transport === 'stdio' ? '运行于夭夭服务器' : '由夭夭服务器连接' }} · {{ plugin.testedAt ? `已发现 ${plugin.toolCount} 个工具` : '尚未测试连接' }} · {{ grantNames(plugin.agentIds) }}</p>\n <p v-if=\"agentsLoaded && validAgentIds(plugin.agentIds).length !== plugin.agentIds.length\" class=\"hint\">部分 Bot 授权已失效,请重新选择可使用此服务的 Bot。</p>\n <p v-if=\"agentsLoaded && plugin.enabled && !validAgentIds(plugin.agentIds).length\" class=\"hint\">服务已启用,尚无可使用它的 Bot。请先授权 Bot。</p>\n <div class=\"card-actions\"><button :disabled=\"busy || !canManage\" @click=\"test(plugin)\">测试连接</button><button :disabled=\"busy || !canManage || (!plugin.enabled && !plugin.testedAt)\" @click=\"toggle(plugin)\">{{ plugin.enabled ? '停用' : '启用' }}</button><button :disabled=\"busy || !canManage || !agentsLoaded\" @click=\"openMcpGrant(plugin)\">授权 Bot</button><button :disabled=\"busy || !canManage || !agentsLoaded\" @click=\"edit(plugin)\">编辑</button><button class=\"danger\" :disabled=\"busy || !canManage\" @click=\"remove(plugin)\">移除</button></div>\n <form v-if=\"mcpGrantId === plugin.id\" class=\"grant-editor\" aria-label=\"MCP Bot 授权\" @submit.prevent=\"saveMcpGrant\" @change=\"emit('dirty-change', true)\">\n <fieldset><legend>允许使用的 Bot</legend><label v-for=\"agent in selectable\" :key=\"agent.id\" class=\"check-row\"><input v-model=\"mcpGrantIds\" type=\"checkbox\" :value=\"agent.id\" :disabled=\"busy\" />{{ agent.name }}</label><p v-if=\"!selectable.length\" class=\"hint\">创建 Bot 后可在这里授权。</p></fieldset>\n <p class=\"hint\">授权按 Bot 保存,同一账号在各客户端均可使用。更改授权后,连接验证结果和服务启用状态会保留。</p>\n <div class=\"card-actions\"><button type=\"button\" :disabled=\"busy\" @click=\"closeMcpGrant\">取消</button><button type=\"submit\" :disabled=\"busy || !canManage || !agentsLoaded\">保存授权</button></div>\n </form>\n </article>\n </template>\n <template v-else-if=\"!loading\">\n <div class=\"plugin-toolbar\"><div class=\"view-tabs\" role=\"tablist\" aria-label=\"应用列表\"><button role=\"tab\" :aria-selected=\"view === 'marketplace'\" @click=\"view = 'marketplace'\">应用目录</button><button role=\"tab\" :aria-selected=\"view === 'connected'\" @click=\"view = 'connected'\">已连接 {{ connections.length || '' }}</button></div><button :disabled=\"busy\" aria-label=\"刷新应用连接\" @click=\"load\"><AppIcon name=\"refresh\" :size=\"17\" /></button></div>\n <label class=\"plugin-search\"><AppIcon name=\"search\" :size=\"17\" /><input v-model=\"search\" type=\"search\" aria-label=\"搜索应用\" placeholder=\"搜索应用\" /></label>\n <p v-if=\"!settings.configured\" class=\"plugin-notice\">配置 Composio 连接服务后,即可连接应用。</p>\n <div class=\"app-grid\"><article v-for=\"card in filtered.slice(0, visibleCount)\" :key=\"card.slug\" class=\"app-card\">\n <div class=\"card-heading\"><span class=\"app-monogram\" aria-hidden=\"true\">{{ card.name.slice(0, 1) }}</span><h4>{{ card.name }}</h4></div><p class=\"hint\">{{ card.description }}</p>\n <div v-for=\"account in connected(card.slug)?.accounts ?? []\" :key=\"account.id\" class=\"app-account\"><span>{{ account.alias || stateLabel(account.status) }}<small v-if=\"account.alias\">{{ stateLabel(account.status) }}</small></span><button class=\"danger\" :disabled=\"busy\" :aria-label=\"`断开 ${card.name} ${account.alias || '账号'}`\" @click=\"disconnect(card.slug, account.id)\">断开</button></div>\n <label v-if=\"aliasSlug === card.slug\">账号别名<input v-model=\"alias\" placeholder=\"例如:工作账号\" maxlength=\"64\" /></label>\n <div class=\"card-actions\"><button :disabled=\"busy || !settings.configured || (aliasSlug === card.slug && !alias.trim())\" @click=\"connect(card)\">{{ aliasSlug === card.slug ? '继续连接' : connected(card.slug)?.accounts.length ? '添加账号' : '连接' }}</button><button v-if=\"connected(card.slug)?.accounts.length\" :disabled=\"busy\" @click=\"openGrant(card.slug)\">授权 Bot</button></div>\n <a v-if=\"pendingUrls[card.slug]\" :href=\"pendingUrls[card.slug]\" target=\"_blank\" rel=\"noopener noreferrer\">继续授权 <AppIcon name=\"external\" :size=\"13\" /></a>\n <p v-if=\"connected(card.slug)\" class=\"hint\">{{ grantNames(connected(card.slug)!.agentIds) }}</p>\n <form v-if=\"grantSlug === card.slug\" class=\"grant-editor\" @submit.prevent=\"saveGrant\" @change=\"emit('dirty-change', true)\"><fieldset><legend>允许使用的 Bot</legend><label v-for=\"agent in selectable\" :key=\"agent.id\" class=\"check-row\"><input v-model=\"grantIds\" type=\"checkbox\" :value=\"agent.id\" />{{ agent.name }}</label></fieldset><div class=\"card-actions\"><button type=\"button\" :disabled=\"busy\" @click=\"grantSlug = ''; emit('dirty-change', false)\">取消</button><button type=\"submit\" :disabled=\"busy\">保存授权</button></div></form>\n </article></div>\n <button v-if=\"filtered.length > visibleCount\" type=\"button\" @click=\"visibleCount += 40\">显示更多应用({{ filtered.length - visibleCount }})</button>\n <p v-if=\"!filtered.length\" class=\"plugin-empty\">{{ search ? '没有匹配的应用。' : '还没有已连接的应用。可前往应用目录添加。' }}</p>\n <details class=\"connection-settings\" :open=\"!settings.configured\"><summary>应用连接服务 <span>{{ settings.configured ? '已配置' : '未配置' }}</span></summary><p class=\"hint\">使用你的 Composio 项目连接应用。密钥加密保存在服务器,仅用于当前账号。</p><form @submit.prevent=\"configure()\" @input=\"emit('dirty-change', true)\"><label>Composio API Key<input v-model=\"apiKey\" type=\"password\" autocomplete=\"new-password\" :placeholder=\"settings.configured ? '已保存,输入新密钥可替换' : 'ak_…'\" /></label><details><summary>自定义 Auth Config(可选)</summary><label>应用与 Auth Config 映射(JSON)<textarea v-model=\"authConfigs\" rows=\"3\" spellcheck=\"false\" /></label></details><div class=\"card-actions\"><button type=\"submit\" :disabled=\"busy || !apiKey.trim()\">保存连接服务</button><button v-if=\"settings.configured\" type=\"button\" class=\"danger\" :disabled=\"busy\" @click=\"configure(true)\">清除配置</button><a href=\"https://dashboard.composio.dev\" target=\"_blank\" rel=\"noopener noreferrer\">获取 API Key</a></div></form></details>\n </template>\n </section>\n</template>\n\n<style scoped>\n.bot-plugins{display:grid;gap:16px;color:var(--text-primary);font-size:13px}.intro,.hint{color:var(--text-secondary);line-height:1.6;margin:0}.hint{font-size:12px}.plugin-tabs,.view-tabs,.plugin-toolbar,.card-heading,.card-actions,.editor-actions{display:flex;align-items:center;gap:8px}.plugin-tabs{border-bottom:1px solid var(--line);padding-bottom:8px}.plugin-tabs button[aria-selected=true],.view-tabs button[aria-selected=true]{background:var(--surface-soft);font-weight:650}.plugin-toolbar{justify-content:space-between}.plugin-toolbar p{margin:0;font-weight:650}.card-heading h4{font-size:14px;margin:0;flex:1;min-width:0;overflow-wrap:anywhere}.card-actions{flex-wrap:wrap}.bot-plugins button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:36px;padding:6px 10px;border:1px solid var(--line);border-radius:8px;background:var(--surface-raised);color:inherit;font:inherit;cursor:pointer}.bot-plugins button:hover{background:var(--surface-hover)}.bot-plugins button:disabled{opacity:.45;cursor:not-allowed}.bot-plugins :is(button,input,select,textarea,a,summary):focus-visible{outline:2px solid var(--accent);outline-offset:2px}.bot-plugins a{color:var(--accent);display:inline-flex;align-items:center;gap:4px}.bot-plugins .danger{color:var(--danger)}.bot-plugins .primary{background:var(--accent);color:var(--text-on-solid);border-color:var(--accent)}.bot-plugins label{display:grid;gap:6px;font-size:12px;line-height:1.6}.bot-plugins input:not([type=checkbox]),.bot-plugins select,.bot-plugins textarea{width:100%;box-sizing:border-box;min-width:0;padding:9px 10px;border:1px solid var(--line);border-radius:8px;color:var(--text-primary);background:var(--surface);font:inherit}.bot-plugins textarea{resize:vertical;font-family:var(--font-mono,monospace)}.plugin-search{position:relative}.plugin-search>svg{position:absolute;left:10px;top:11px;color:var(--text-muted)}.plugin-search input{padding-left:34px!important}.plugin-editor,.mcp-card,.app-card,.connection-settings{border:1px solid var(--line);border-radius:12px;padding:14px;display:grid;gap:12px;background:var(--surface)}.plugin-editor h4{margin:0}.plugin-editor{background:var(--surface-soft)}.editor-actions{justify-content:flex-end}.bot-plugins fieldset{border:1px solid var(--line);border-radius:8px;display:grid;gap:4px;max-height:180px;overflow:auto}.bot-plugins .check-row{display:flex;align-items:center;gap:8px;min-height:32px}.check-row input{accent-color:var(--accent)}.app-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px}.app-card{align-content:start}.app-monogram{display:grid;place-items:center;width:34px;height:34px;flex-shrink:0;border-radius:9px;background:var(--surface-soft);font-size:17px;font-weight:650}.app-account{display:flex;align-items:center;justify-content:space-between;gap:8px;border-top:1px solid var(--line);padding-top:8px}.app-account span{min-width:0;overflow-wrap:anywhere}.app-account small{display:block;color:var(--text-muted);margin-top:3px}.badge{font-size:11px;color:var(--text-muted);white-space:nowrap}.badge.enabled{color:var(--accent)}.endpoint{overflow-wrap:anywhere}.plugin-error,.plugin-notice{padding:12px;border-radius:8px;background:var(--surface-soft);margin:0;line-height:1.6}.plugin-error{color:var(--danger)}.plugin-empty{text-align:center;color:var(--text-secondary);padding:28px 12px;line-height:1.8}.connection-settings{display:block}.connection-settings summary{cursor:pointer;font-weight:600;line-height:1.8}.connection-settings summary span{float:right;font-weight:400;color:var(--text-muted)}.connection-settings p{margin:12px 0}.connection-settings form{display:grid;gap:12px}.grant-editor{display:grid;gap:8px}@media(max-width:767px){.app-grid{grid-template-columns:1fr}.bot-plugins button{min-height:44px}.bot-plugins .check-row{min-height:44px}}\n</style>\n","<script setup lang=\"ts\">\nimport { ref } from 'vue'\nimport StandaloneDialog from '@/components/common/StandaloneDialog.vue'\nimport BotPluginsPanel from './BotPluginsPanel.vue'\nconst emit = defineEmits<{ close: [] }>()\nconst dirty = ref(false)\nconst beforeClose = () => !dirty.value || window.confirm('放弃尚未保存的插件更改?')\n</script>\n<template><StandaloneDialog title=\"已连接应用\" :before-close=\"beforeClose\" @close=\"emit('close')\"><BotPluginsPanel @dirty-change=\"dirty = $event\" /></StandaloneDialog></template>\n","<script setup lang=\"ts\">\nimport { ref } from 'vue'\nimport StandaloneDialog from '@/components/common/StandaloneDialog.vue'\nimport BotPluginsPanel from './BotPluginsPanel.vue'\nconst emit = defineEmits<{ close: [] }>()\nconst dirty = ref(false)\nconst beforeClose = () => !dirty.value || window.confirm('放弃尚未保存的插件更改?')\n</script>\n<template><StandaloneDialog title=\"已连接应用\" :before-close=\"beforeClose\" @close=\"emit('close')\"><BotPluginsPanel @dirty-change=\"dirty = $event\" /></StandaloneDialog></template>\n"],"mappings":"u1DASM,GAAO,gGADb,IAAM,EAAO,GAEP,EAAU,EAAoB,MAAM,EAAG,EAAO,EAAI,aAAa,EAC/D,EAAW,EAAuB,CAAE,WAAY,GAAO,SAAU,CAAE,CAAC,EAAG,EAAY,EAAI,EAAK,EAC5F,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B,EAAA,EAAA,EAAA,EAA8D,WAAA,CAA3C,sBAAA,AAAA,EAAA,MAAA,GAAA,EAAW,MAAA,EAAE,KAAK,IAAI,WAAW,OAAjC,EAAA,KAAA,GAAA,EAAA,CAAA,CAAA,EAAA,EAAA,KAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAkD,EAAgU,MAAhU,GAAgU,CAAtS,EAAwE,SAAA,CAAhE,KAAK,SAAU,SAAU,EAAA,OAAI,CAAK,EAAA,MAAO,KAAI,CAAI,EAAA,SAAM,EAAA,EAAA,EAAuB,EAAA,MAAS,YAAvB,EAAA,EAAA,EAAuH,SAAA,OAApF,KAAK,SAAS,MAAM,SAAU,SAAU,EAAA,MAAO,QAAK,AAAA,EAAA,MAAA,GAAE,GAAS,EAAA,CAAQ,EAAA,OAAI,EAAA,EAAA,GAAA,EAAA,GAAA,EAAA,EAAS,AAAA,EAAA,MAAA,EAAiG,IAAA,CAA9F,KAAK,iCAAiC,OAAO,SAAS,IAAI,qBAAsB,EAAA,aAAU,EAAA,gIEpLl5B,IAAM,EAAO,EACP,EAAQ,EAAI,EAAK,EACjB,MAAoB,CAAC,EAAM,OAAS,OAAO,QAAQ,cAAc,gBAE7D,EAAA,EAAA,GAAwJ,EAAA,CAAtI,MAAM,QAAS,eAAc,EAAc,QAAK,AAAA,EAAA,KAAA,GAAE,EAAI,OAAA,IAAW,QAAA,OAAkD,CAAlD,EAAkD,EAAA,CAAhC,cAAY,AAAA,EAAA,KAAA,GAAE,EAAA,MAAQ,CAAA,CAAA,CAAA,CAAA"}
@@ -1 +0,0 @@
1
- .bot-plugins[data-v-9850b6a3]{color:var(--text-primary);gap:16px;font-size:13px;display:grid}.intro[data-v-9850b6a3],.hint[data-v-9850b6a3]{color:var(--text-secondary);margin:0;line-height:1.6}.hint[data-v-9850b6a3]{font-size:12px}.plugin-tabs[data-v-9850b6a3],.view-tabs[data-v-9850b6a3],.plugin-toolbar[data-v-9850b6a3],.card-heading[data-v-9850b6a3],.card-actions[data-v-9850b6a3],.editor-actions[data-v-9850b6a3]{align-items:center;gap:8px;display:flex}.plugin-tabs[data-v-9850b6a3]{border-bottom:1px solid var(--line);padding-bottom:8px}.plugin-tabs button[aria-selected=true][data-v-9850b6a3],.view-tabs button[aria-selected=true][data-v-9850b6a3]{background:var(--surface-soft);font-weight:650}.plugin-toolbar[data-v-9850b6a3]{justify-content:space-between}.plugin-toolbar p[data-v-9850b6a3]{margin:0;font-weight:650}.card-heading h4[data-v-9850b6a3]{overflow-wrap:anywhere;flex:1;min-width:0;margin:0;font-size:14px}.card-actions[data-v-9850b6a3]{flex-wrap:wrap}.bot-plugins button[data-v-9850b6a3]{border:1px solid var(--line);background:var(--surface-raised);min-height:36px;color:inherit;font:inherit;cursor:pointer;border-radius:8px;justify-content:center;align-items:center;gap:6px;padding:6px 10px;display:inline-flex}.bot-plugins button[data-v-9850b6a3]:hover{background:var(--surface-hover)}.bot-plugins button[data-v-9850b6a3]:disabled{opacity:.45;cursor:not-allowed}.bot-plugins[data-v-9850b6a3] :is(button,input,select,textarea,a,summary):focus-visible{outline:2px solid var(--accent);outline-offset:2px}.bot-plugins a[data-v-9850b6a3]{color:var(--accent);align-items:center;gap:4px;display:inline-flex}.bot-plugins .danger[data-v-9850b6a3]{color:var(--danger)}.bot-plugins .primary[data-v-9850b6a3]{background:var(--accent);color:var(--text-on-solid);border-color:var(--accent)}.bot-plugins label[data-v-9850b6a3]{gap:6px;font-size:12px;line-height:1.6;display:grid}.bot-plugins input[data-v-9850b6a3]:not([type=checkbox]),.bot-plugins select[data-v-9850b6a3],.bot-plugins textarea[data-v-9850b6a3]{box-sizing:border-box;border:1px solid var(--line);width:100%;min-width:0;color:var(--text-primary);background:var(--surface);font:inherit;border-radius:8px;padding:9px 10px}.bot-plugins textarea[data-v-9850b6a3]{resize:vertical;font-family:var(--font-mono,monospace)}.plugin-search[data-v-9850b6a3]{position:relative}.plugin-search>svg[data-v-9850b6a3]{color:var(--text-muted);position:absolute;top:11px;left:10px}.plugin-search input[data-v-9850b6a3]{padding-left:34px!important}.plugin-editor[data-v-9850b6a3],.mcp-card[data-v-9850b6a3],.app-card[data-v-9850b6a3],.connection-settings[data-v-9850b6a3]{border:1px solid var(--line);background:var(--surface);border-radius:12px;gap:12px;padding:14px;display:grid}.plugin-editor h4[data-v-9850b6a3]{margin:0}.plugin-editor[data-v-9850b6a3]{background:var(--surface-soft)}.editor-actions[data-v-9850b6a3]{justify-content:flex-end}.bot-plugins fieldset[data-v-9850b6a3]{border:1px solid var(--line);border-radius:8px;gap:4px;max-height:180px;display:grid;overflow:auto}.bot-plugins .check-row[data-v-9850b6a3]{align-items:center;gap:8px;min-height:32px;display:flex}.check-row input[data-v-9850b6a3]{accent-color:var(--accent)}.app-grid[data-v-9850b6a3]{grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px;display:grid}.app-card[data-v-9850b6a3]{align-content:start}.app-monogram[data-v-9850b6a3]{background:var(--surface-soft);border-radius:9px;flex-shrink:0;place-items:center;width:34px;height:34px;font-size:17px;font-weight:650;display:grid}.app-account[data-v-9850b6a3]{border-top:1px solid var(--line);justify-content:space-between;align-items:center;gap:8px;padding-top:8px;display:flex}.app-account span[data-v-9850b6a3]{overflow-wrap:anywhere;min-width:0}.app-account small[data-v-9850b6a3]{color:var(--text-muted);margin-top:3px;display:block}.badge[data-v-9850b6a3]{color:var(--text-muted);white-space:nowrap;font-size:11px}.badge.enabled[data-v-9850b6a3]{color:var(--accent)}.endpoint[data-v-9850b6a3]{overflow-wrap:anywhere}.plugin-error[data-v-9850b6a3],.plugin-notice[data-v-9850b6a3]{background:var(--surface-soft);border-radius:8px;margin:0;padding:12px;line-height:1.6}.plugin-error[data-v-9850b6a3]{color:var(--danger)}.plugin-empty[data-v-9850b6a3]{text-align:center;color:var(--text-secondary);padding:28px 12px;line-height:1.8}.connection-settings[data-v-9850b6a3]{display:block}.connection-settings summary[data-v-9850b6a3]{cursor:pointer;font-weight:600;line-height:1.8}.connection-settings summary span[data-v-9850b6a3]{float:right;color:var(--text-muted);font-weight:400}.connection-settings p[data-v-9850b6a3]{margin:12px 0}.connection-settings form[data-v-9850b6a3]{gap:12px;display:grid}.grant-editor[data-v-9850b6a3]{gap:8px;display:grid}@media (width<=767px){.app-grid[data-v-9850b6a3]{grid-template-columns:1fr}.bot-plugins button[data-v-9850b6a3],.bot-plugins .check-row[data-v-9850b6a3]{min-height:44px}}
@@ -1 +0,0 @@
1
- .chat-workspace[data-v-b7f0efb0]{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.sidebar-primary-action[data-v-b7f0efb0]{width:100%;min-height:40px;color:var(--text-primary);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:9px;align-items:center;gap:10px;padding:0 11px;font-size:12px;font-weight:610;transition:background-color .12s;display:flex}.sidebar-primary-action[data-v-b7f0efb0]:hover,.sidebar-primary-action[data-v-b7f0efb0]:focus-visible{background:var(--surface-hover);outline:0}.sidebar-primary-action[data-v-b7f0efb0]:focus-visible{box-shadow:inset 0 0 0 1px var(--line-strong)}.header-session-menu[data-v-b7f0efb0]{color:var(--text-muted);background:0 0}.header-session-menu[data-v-b7f0efb0]:hover{color:var(--text-primary);background:var(--surface-soft)}.chat-error[data-v-b7f0efb0]{width:min(760px,100% - 32px);color:var(--danger);align-items:center;gap:6px;margin:0 auto 4px;font-size:9px;display:flex}.session-actions[data-v-b7f0efb0]{z-index:205;box-sizing:border-box;border:1px solid var(--line);background:var(--surface-raised);border-radius:11px;width:208px;padding:6px;position:fixed;box-shadow:0 12px 34px #00000029}.action-row[data-v-b7f0efb0]{width:100%;min-height:34px;color:var(--text-secondary);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:7px;align-items:center;gap:8px;padding:0 9px;font-size:11px;display:flex}.action-row[data-v-b7f0efb0]:hover,.action-row[data-v-b7f0efb0]:focus-visible{background:var(--surface-soft);color:var(--text-primary);outline:0}.action-row.danger[data-v-b7f0efb0]{color:var(--danger)}.session-actions label[data-v-b7f0efb0]{color:var(--text-muted);flex-direction:column;gap:6px;padding:4px;font-size:9px;display:flex}.session-actions input[data-v-b7f0efb0]{box-sizing:border-box;border:1px solid var(--line);background:var(--surface-soft);width:100%;height:32px;color:var(--text-primary);border-radius:7px;outline:0;padding:0 8px;font-size:11px}.session-actions input[data-v-b7f0efb0]:focus{border-color:var(--line-strong);box-shadow:0 0 0 3px var(--focus-ring)}.session-actions>div[data-v-b7f0efb0]{justify-content:flex-end;gap:5px;margin-top:7px;padding:0 4px 3px;display:flex}.session-actions[data-v-b7f0efb0] .quiet-button,.session-actions[data-v-b7f0efb0] .solid-button{min-height:29px;padding-inline:10px;font-size:10px}.session-menu-enter-active[data-v-b7f0efb0],.session-menu-leave-active[data-v-b7f0efb0]{transition:opacity .1s ease, transform .12s var(--ease-out);transform-origin:100% 0}.session-menu-enter-from[data-v-b7f0efb0],.session-menu-leave-to[data-v-b7f0efb0]{opacity:0;transform:translateY(-3px)scale(.98)}@media (prefers-reduced-motion:reduce){.sidebar-primary-action[data-v-b7f0efb0],.session-menu-enter-active[data-v-b7f0efb0],.session-menu-leave-active[data-v-b7f0efb0]{transition:none}}
@@ -1,2 +0,0 @@
1
- import{i as e,l as t,r as n}from"./WorkspaceShell-Dhm3r61t.js";import{A as r,D as i,F as a,G as ee,H as o,M as te,W as s,_ as c,at as l,ct as ne,d as u,et as d,f as re,g as f,h as p,l as ie,m,n as ae,p as h,s as oe,st as se,t as ce,u as le,v as g,x as _,y as v}from"./_plugin-vue_export-helper-CscYwSBt.js";import{$ as ue,X as y,c as de,d as fe,et as pe,f as me,l as he,m as ge,o as _e,s as ve,u as ye}from"./index-BRP9NWum.js";import{_ as be,f as xe,g as Se,h as Ce,i as we,n as Te,t as Ee}from"./viewModels-CYJ8m5Uf.js";import{_ as b,g as De,h as Oe,t as ke,v as Ae}from"./FloatingResourceSearch-c6l1JuAA.js";import{i as je,n as Me,r as Ne,t as x}from"./sessionOwnership-B2YxdBdf.js";import{t as Pe}from"./WorkspaceView-CBWFRLki.js";var S=`hermes-yaoyao:pending-composer-item`;async function Fe(e){let t=e.downloadUrl||e.previewUrl;if(!t||!e.name)return null;try{let n=await fetch(t,{credentials:`same-origin`});if(!n.ok)throw Error(`下载文件失败(${n.status})`);let r=await n.blob();return new File([r],e.name,{type:e.mimeType||r.type||`application/octet-stream`})}catch{return null}}async function Ie(){let e=sessionStorage.getItem(S);if(!e)return null;sessionStorage.removeItem(S);try{let t=JSON.parse(e);return await Fe({name:t.name,downloadUrl:t.url,mimeType:t.mimeType})}catch{return null}}var Le={class:`chat-workspace`},Re={key:0,class:`chat-error`,role:`alert`},ze=[`disabled`],C=ce(_({__name:`ChatView`,setup(ce){let _=me(),S=ge(),C=_e(),w=ue(),T=pe(),E=d(null),D=d(null),O=d(null),k=d(null),A=d(!1),j=d(!1),M=d(!1),N=d(!1),P=d(!1),F=d(``),I=d(!1),L=d(``),R=d({x:8,y:8}),z=d(null),B=d(null),Be=d(null),V=d(``);function Ve(t){let n=e(t);n&&n===S.activeProfile?.name&&C.loadModels(n).catch(()=>void 0)}let H=h(()=>[...C.sessions].filter(x)),He=h(()=>new Map(S.profiles.map(e=>[e.name,e.agentName||e.displayName||e.name]))),Ue=h(()=>Object.fromEntries(S.profiles.flatMap(e=>e.agentAvatar?[[e.name,e.agentAvatar]]:[]))),We=h(()=>H.value.map(e=>we(e,_.snapshot.conversations.find(t=>t.mode===`chat`&&t.id===e.id&&t.profile===e.profile)?.count??0,He.value.get(e.profile||S.activeProfile?.name||``)))),U=h(()=>Te(C.messages,e=>e?He.value.get(e):void 0)),Ge=h(()=>Oe(U.value)),Ke=h(()=>Ge.value.map(e=>({url:e.previewUrl||e.downloadUrl||``,name:e.name,type:e.kind})).filter(e=>e.url)),W=h(()=>C.activeSession),G=h(()=>C.sessions.find(e=>e.id===F.value)),qe=h(()=>[`connected`,`ready`].includes(C.connectionState)),K=h(()=>Ee(C.pendingApproval,C.pendingClarification)),Je=h(()=>E.value?{id:E.value.id,content:E.value.content,author:E.value.author}:null),Ye=h(()=>{let e=W.value?.parentSessionId;return e?C.sessions.find(t=>t.id===e&&t.profile===W.value?.profile)?.title||e:``}),Xe=h(()=>C.selectedModel?he(C.selectedModel):``),Ze=[{id:``,label:`默认`,description:`使用模型或 Profile 的默认强度`},{id:`none`,label:`关闭`,description:`不使用额外推理`},{id:`low`,label:`低`,description:`更快的轻量推理`},{id:`medium`,label:`中`,description:`速度与深度平衡`},{id:`high`,label:`高`,description:`更深入地分析复杂问题`},{id:`xhigh`,label:`极高`,description:`适用于最复杂的任务`}],Qe=h(()=>Ze.map(e=>({id:e.id,label:e.label,detail:e.description}))),$e=h(()=>Ze.find(e=>e.id===(C.reasoningEffort||``))?.label||`默认`),et=h(()=>({left:`${R.value.x}px`,top:`${R.value.y}px`}));function q(){let e=typeof w.query.profile==`string`?w.query.profile:``;return S.profiles.some(t=>t.name===e)?e:``}function J(e,t){return{path:`/chat/${encodeURIComponent(e)}`,query:{profile:t}}}async function tt(e){for(let t of S.profiles)try{if((await fe(e,t.name)).id===e)return t.name}catch{}return S.activeProfile?.name||``}async function nt(e){!e||S.activeProfile?.name===e||(C.switchProfile(e),V.value=e,S.selectProfile(e),await i())}async function rt(){let e=typeof w.params.sessionId==`string`?w.params.sessionId:``,t=q()||(e?await tt(e):S.activeProfile?.name||``);if(t&&S.activeProfile?.name!==t&&(e&&await T.replace(J(e,t)),await nt(t)),await C.loadSessions(t,`chat`),e){let n=await fe(e,t).catch(()=>void 0);if(n&&!x(n)){await T.replace({path:`/history/${encodeURIComponent(e)}`,query:{profile:t}});return}}e&&C.activeSessionId!==e&&await C.selectSession(e,t),e&&t&&q()!==t&&await T.replace(J(e,t)),C.loadUnread(t).catch(()=>void 0),!e&&C.activeSession&&!x(C.activeSession)&&C.clearSelection()}let Y=new Set;async function it(e){if(D.value||O.value||A.value||j.value||!C.activeSessionId||typeof w.query.unread==`string`)return;let t=C.activeSessionId,n=C.activeProfileName,r=`${n}:${t}:${e.join(`,`)}`;if(!Y.has(r)){Y.add(r);try{await _.visible(`chat`,t,n,e)}catch{}finally{Y.delete(r)}}}let at=0;o(()=>[w.params.id,w.query.unread,C.messages.length],async()=>{let e=w.query.unread;if(typeof e!=`string`||!C.activeSessionId)return;let t=++at;for(let n=0;n<100&&t===at;n++){if(await i(),B.value?.scrollToMessage(e)){let e={...w.query};delete e.unread,await T.replace({query:e});return}if(!C.hasMoreBefore)return;let t=C.messages.length;if(await C.loadOlder(),C.messages.length===t)return}},{flush:`post`});async function X(e){A.value=!1,D.value=null;let t=C.sessions.find(t=>t.id===e)?.profile||S.activeProfile?.name||`default`;await T.push(J(e,t)),await nt(t),C.activeProfileName!==t&&await C.loadSessions(t,`chat`),await C.selectSession(e,t),E.value=null}async function ot(){A.value=!1,D.value=null;let e=C.createSession(S.activeProfile?.name);await T.push(J(e,S.activeProfile?.name||`default`))}async function st(e){try{await C.send(e.text,e.files,P.value?`queue`:C.isStreaming?`steer`:`submit`),z.value?.clearAfterSend()}catch{}}function ct(e){let t=b(e.name,e.url||``,e.id,e.kind);t.size=e.size,t.kind===`image`||t.kind===`video`?lt(t):(A.value=!1,D.value=null,O.value=t)}function lt(e){let t=De(e.previewUrl||e.downloadUrl||``),n=Ke.value.findIndex(e=>De(e.url)===t);k.value=n>=0?n:null}function ut({name:e,url:t}){let n=b(e,t);n.kind===`image`||n.kind===`video`?lt(n):(A.value=!1,O.value=n)}async function Z(e){let t=await Fe(e);!t||!z.value||(z.value.attachFiles([t]),D.value=null,O.value=null,k.value=null,await i(),z.value?.focus())}async function dt(e){await Z(b(e.name,e.url,`preview:${e.url}`,e.type))}async function ft(e){if(e===Xe.value){j.value=!1;return}let t=ye(C.models,e);if(!(!t||M.value)){M.value=!0;try{await C.setModel(t),j.value=!1}finally{M.value=!1}}}function pt(e){C.reasoningEffort=e||void 0}async function mt(e){try{await C.setFastMode(e)}catch{}}function ht(e=S.activeProfile?.name||`default`){N.value=ve(S.user?.id??`local`,e)}function gt(){N.value=!N.value,de(S.user?.id??`local`,S.activeProfile?.name||`default`,N.value)}function Q(e,t){F.value=e;let n=C.sessions.find(t=>t.id===e);L.value=n?.title||``,I.value=!1;let r=t?.currentTarget instanceof HTMLElement?t.currentTarget.getBoundingClientRect():null,i=t?.type===`contextmenu`?t.clientX:r?r.right-208:window.innerWidth-208-14,a=t?.type===`contextmenu`?t.clientY:r?r.bottom+5:46;R.value={x:Math.max(8,Math.min(i,window.innerWidth-208-8)),y:Math.max(8,Math.min(a,window.innerHeight-210-8))}}function $(){F.value=``,I.value=!1}async function _t(){$();try{await C.forceRefreshHistory()}catch{}}function vt(e){!F.value||e.target.closest(`.session-actions`)||$()}function yt(e){e.key===`Escape`&&F.value&&$()}async function bt(){let e=C.sessions.find(e=>e.id===F.value);!e||!L.value.trim()||(await C.renameSession(e.id,L.value.trim(),e.profile),$())}async function xt(){let e=G.value;e&&(await C.setSessionPinned(e.id,!e.pinned,e.profile),$())}async function St(){let e=G.value;e&&($(),(e.id!==C.activeSessionId||e.profile!==C.activeProfileName)&&await X(e.id),D.value=null,A.value=!0)}function Ct(){let e=A.value;D.value=null,A.value=!1,e&&i(()=>Be.value?.focus())}function wt(e){B.value?.scrollToAnchor(e.messageId,e.anchorId),window.matchMedia(`(max-width: 900px)`).matches&&Ct()}async function Tt(){let e=C.sessions.find(e=>e.id===F.value);e&&(await C.removeSession(e.id,e.profile),$(),w.params.sessionId===e.id&&await T.replace(`/chat`))}async function Et(){let e=await C.branchSession();e&&await T.push(J(e,C.activeProfileName||S.activeProfile?.name||`default`))}async function Dt(){let e=typeof w.query.message==`string`?w.query.message:``;if(e){await i();for(let t=0;t<10;t+=1){if(B.value?.scrollToMessage(e)||!C.hasMoreBefore)return;await C.loadOlder(),await i()}}}return te(async()=>{ht(),document.addEventListener(`pointerdown`,vt),document.addEventListener(`keydown`,yt),window.addEventListener(n,Ve),await rt(),await Promise.allSettled([C.loadModels(S.activeProfile?.name),C.connect()]),C.refreshActiveSessionModel().catch(()=>void 0),await Dt();let e=await Ie();e&&z.value?.attachFiles([e])}),r(()=>{document.removeEventListener(`pointerdown`,vt),document.removeEventListener(`keydown`,yt),window.removeEventListener(n,Ve)}),o(()=>S.activeProfile?.name,async(e,t)=>{if(!e||e===t)return;if(ht(e),A.value=!1,D.value=null,V.value===e){V.value=``;return}C.switchProfile(e);let n=typeof w.params.sessionId==`string`?w.params.sessionId:``;if(n&&q()===e){await Promise.allSettled([C.loadSessions(e,`chat`),C.loadModels(e),C.loadUnread(e),C.connect()]),await C.selectSession(n,e);return}await T.replace({path:`/chat`,query:{profile:e}}),await Promise.allSettled([C.loadSessions(e,`chat`),C.loadModels(e),C.loadUnread(e),C.connect()])}),o(()=>C.activeSessionId,async e=>{let t=C.activeProfileName||S.activeProfile?.name||``;e&&C.refreshActiveSessionModel().catch(()=>void 0),!(!e||w.params.sessionId===e&&q()===t)&&await T.replace(J(e,t))}),(e,n)=>(a(),c(u,null,[v(Pe,{"sidebar-title":`对话`,"sidebar-subtitle":`${H.value.length} 个会话`,"inspector-open":!!D.value||A.value,"inspector-close-label":A.value?`关闭会话大纲`:`关闭预览`,onCloseInspector:Ct},{"sidebar-action":s(()=>[m(`button`,{class:`sidebar-primary-action`,type:`button`,title:`新建聊天`,"aria-label":`新建聊天`,onClick:ot},[v(t,{name:`add`}),n[17]||=m(`span`,null,`新建聊天`,-1)])]),sidebar:s(()=>[v(xe,{items:We.value,"active-id":l(C).activeSessionId,loading:l(C).isLoading,"external-search":``,"single-line":``,"has-more":l(C).hasMoreSessions,"loading-more":l(C).isLoadingMoreSessions,"search-placeholder":`搜索会话`,"empty-title":`还没有会话`,"empty-description":`新建会话后,从输入框开始聊天。`,onLoadMore:n[0]||=e=>l(C).loadMoreSessions(l(S).activeProfile?.name),onSelect:X,onMore:Q,onContextMenu:Q},null,8,[`items`,`active-id`,`loading`,`has-more`,`loading-more`])]),inspector:s(()=>[A.value?(a(),p(Me,{key:0,messages:U.value,"has-older":l(C).hasMoreBefore,onNavigate:wt},null,8,[`messages`,`has-older`])):D.value?(a(),p(be,{key:1,item:D.value,onClose:n[8]||=e=>D.value=null,onAddToComposer:Z},null,8,[`item`])):f(``,!0)]),default:s(()=>[m(`div`,Le,[v(Ne,{onVisibleMessages:it,ref_key:`timeline`,ref:B,messages:U.value,title:W.value?.title||`新会话`,subtitle:W.value?`${W.value.profile||l(S).activeProfile?.name||``} · ${W.value.model||l(C).selectedModel?.name||`默认模型`}`:`选择会话或直接开始输入`,loading:l(C).activeRouteState?.isLoadingHistory,"loading-older":l(C).activeRouteState?.isLoadingHistory,"has-older":l(C).hasMoreBefore,connected:qe.value,synced:l(C).historySynced,"show-tools":N.value,thinking:l(C).isSending||l(C).isStreaming,"show-assistant-identity":!1,"agent-avatars":Ue.value,interaction:K.value,"empty-logo":``,"transparent-header":``,"fork-source-title":Ye.value,onLoadOlder:l(C).loadOlder,onQuote:n[2]||=e=>E.value=e,onBranch:Et,onPreview:ct,onPreviewFile:ut,onApprove:n[3]||=e=>K.value&&l(C).respondToApproval(K.value.id,e),onClarify:n[4]||=e=>K.value&&l(C).respondToClarification(K.value.id,e)},{"header-actions":s(()=>[W.value?(a(),c(`button`,{key:0,ref_key:`headerSessionMenuButton`,ref:Be,class:`icon-button header-session-menu`,type:`button`,title:`会话操作`,"aria-label":`会话操作`,onClick:n[1]||=e=>Q(W.value.id,e)},[v(y,{name:`dots`,size:18})],512)):f(``,!0)]),_:1},8,[`messages`,`title`,`subtitle`,`loading`,`loading-older`,`has-older`,`connected`,`synced`,`show-tools`,`thinking`,`agent-avatars`,`interaction`,`fork-source-title`,`onLoadOlder`]),l(C).error?(a(),c(`p`,Re,[v(y,{name:`alert`,size:13}),g(ne(l(C).error),1)])):f(``,!0),v(Ae,{ref_key:`composer`,ref:z,mode:`chat`,"draft-key":`${l(S).user?.id||`local`}:${l(S).activeProfile?.name||`default`}:${l(C).activeSessionId||`new`}`,disabled:l(C).connectionState===`failed`,streaming:l(C).isStreaming,sending:l(C).isSending,"model-label":l(C).selectedModel?.name||`选择模型`,"fast-mode":l(C).fastMode,"fast-mode-disabled":!l(C).activeSessionId,"reasoning-effort":$e.value,"reasoning-value":l(C).reasoningEffort||``,"reasoning-options":Qe.value,"show-context":``,"context-used":l(C).contextUsage?.contextTokens,"context-limit":l(C).contextUsage?.contextLimit,"context-percent":l(C).contextUsage?.percentUsed,"queue-mode":P.value||l(C).isQueued,"tool-trace-visible":N.value,reference:Je.value,"slash-commands":[{id:`fork`,label:`fork`,detail:`从当前会话创建分支`},{id:`compact`,label:`compact`,detail:`压缩当前会话上下文`},{id:`model`,label:`model`,detail:`切换模型`}],onSend:st,onStop:l(C).interrupt,onModelClick:n[5]||=e=>j.value=!0,onFastModeToggle:mt,onReasoningChange:pt,onSettingsClick:gt,onQueueToggle:n[6]||=e=>P.value=!P.value,onClearReference:n[7]||=e=>E.value=null},null,8,[`draft-key`,`disabled`,`streaming`,`sending`,`model-label`,`fast-mode`,`fast-mode-disabled`,`reasoning-effort`,`reasoning-value`,`reasoning-options`,`context-used`,`context-limit`,`context-percent`,`queue-mode`,`tool-trace-visible`,`reference`,`onStop`])])]),_:1},8,[`sidebar-subtitle`,`inspector-open`,`inspector-close-label`]),v(ke,{section:`chat`,label:`搜索会话`,items:We.value,onSelect:X},null,8,[`items`]),O.value?(a(),p(Se,{key:0,item:O.value,items:Ge.value,onClose:n[9]||=e=>O.value=null,onAddToComposer:Z,onSource:n[10]||=e=>O.value=null},null,8,[`item`,`items`])):f(``,!0),v(Ce,{modelValue:k.value,"onUpdate:modelValue":n[11]||=e=>k.value=e,images:Ke.value,onAdd:dt},null,8,[`modelValue`,`images`]),v(je,{open:j.value,options:l(C).models,"selected-id":Xe.value,busy:M.value,onClose:n[12]||=e=>j.value=!1,onSelect:ft},null,8,[`open`,`options`,`selected-id`,`busy`]),(a(),p(re,{to:`body`},[v(ae,{name:`session-menu`},{default:s(()=>[F.value?(a(),c(`section`,{key:0,class:`session-actions`,style:se(et.value),role:`menu`,"aria-label":`会话操作`,onContextmenu:n[16]||=le(()=>{},[`prevent`])},[I.value?(a(),c(u,{key:0},[m(`label`,null,[n[18]||=g(`会话名称`,-1),ee(m(`input`,{"onUpdate:modelValue":n[13]||=e=>L.value=e,maxlength:`120`,autofocus:``,onKeydown:ie(bt,[`enter`])},null,544),[[oe,L.value]])]),m(`div`,null,[m(`button`,{class:`quiet-button`,type:`button`,onClick:n[14]||=e=>I.value=!1},`取消`),m(`button`,{class:`solid-button`,type:`button`,onClick:bt},`保存`)])],64)):(a(),c(u,{key:1},[m(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:St},[v(y,{name:`menu`,size:14}),n[19]||=g(`会话大纲`,-1)]),F.value===l(C).activeSessionId?(a(),c(`button`,{key:0,class:`action-row`,role:`menuitem`,type:`button`,disabled:l(C).isStreaming||l(C).isQueued||l(C).isSending||l(C).activeRouteState?.isLoadingHistory,onClick:_t},[v(y,{name:`refresh`,size:14}),n[20]||=g(`强制刷新历史`,-1)],8,ze)):f(``,!0),m(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:xt},[v(y,{name:G.value?.pinned?`pin-off`:`pin`,size:14},null,8,[`name`]),g(ne(G.value?.pinned?`取消置顶`:`置顶会话`),1)]),m(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:n[15]||=e=>I.value=!0},[v(y,{name:`edit`,size:14}),n[21]||=g(`重命名`,-1)]),m(`button`,{class:`action-row danger`,role:`menuitem`,type:`button`,onClick:Tt},[v(y,{name:`trash`,size:14}),n[22]||=g(`删除会话`,-1)])],64))],36)):f(``,!0)]),_:1})]))],64))}}),[[`__scopeId`,`data-v-b7f0efb0`]]);export{C as default};
2
- //# sourceMappingURL=ChatView-znZF8RZE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatView-znZF8RZE.js","names":[],"sources":["../../src/client/components/workspace/pendingComposer.ts","../../src/client/views/ChatView.vue","../../src/client/views/ChatView.vue"],"sourcesContent":["import type { UiLibraryItem } from '@/components/library/types'\n\nconst KEY = 'hermes-yaoyao:pending-composer-item'\n\ntype PendingItem = { name: string; url: string; mimeType?: string }\n\ntype ComposerFileSource = Pick<UiLibraryItem, 'name' | 'previewUrl' | 'downloadUrl' | 'mimeType'>\n\nexport function queueLibraryItemForComposer(item: UiLibraryItem): boolean {\n const url = item.downloadUrl || item.previewUrl\n if (!url) return false\n const pending: PendingItem = { name: item.name, url, mimeType: item.mimeType }\n sessionStorage.setItem(KEY, JSON.stringify(pending))\n return true\n}\n\nexport async function loadComposerFile(item: ComposerFileSource): Promise<File | null> {\n const url = item.downloadUrl || item.previewUrl\n if (!url || !item.name) return null\n try {\n const response = await fetch(url, { credentials: 'same-origin' })\n if (!response.ok) throw new Error(`下载文件失败(${response.status})`)\n const blob = await response.blob()\n return new File([blob], item.name, { type: item.mimeType || blob.type || 'application/octet-stream' })\n } catch {\n return null\n }\n}\n\nexport async function consumeLibraryItemForComposer(): Promise<File | null> {\n const raw = sessionStorage.getItem(KEY)\n if (!raw) return null\n sessionStorage.removeItem(KEY)\n try {\n const pending = JSON.parse(raw) as PendingItem\n return await loadComposerFile({ name: pending.name, downloadUrl: pending.url, mimeType: pending.mimeType })\n } catch {\n return null\n }\n}\n","<script setup lang=\"ts\">\nimport {useUnreadStore} from '@/stores/unread'\nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRoute, useRouter } from 'vue-router'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport YaoYaoSidebarIcon from '@/components/common/YaoYaoSidebarIcon.vue'\nimport type { ChoiceOption } from '@/components/common/types'\nimport ComposerShell from '@/components/composer/ComposerShell.vue'\nimport ModelChoiceDialog from '@/components/composer/ModelChoiceDialog.vue'\nimport type { ComposerOption, ComposerReference, ComposerSubmit } from '@/components/composer/types'\nimport PreviewInspector from '@/components/library/PreviewInspector.vue'\nimport PreviewModal from '@/components/library/PreviewModal.vue'\nimport ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'\nimport type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'\nimport type { UiLibraryItem } from '@/components/library/types'\nimport { mediaItemsFromMessages, mediaUrlIdentity, previewItemFromUrl } from '@/components/library/mediaSequence'\nimport MessageTimeline from '@/components/messages/MessageTimeline.vue'\nimport SessionOutline from '@/components/messages/SessionOutline.vue'\nimport type { UiMessage } from '@/components/messages/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport FloatingResourceSearch from '@/components/app/FloatingResourceSearch.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { chatInteraction, chatMessagesToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { consumeLibraryItemForComposer, loadComposerFile } from '@/components/workspace/pendingComposer'\nimport { readAgentShowThinking, writeAgentShowThinking } from '@/utils/sessionPreferences'\nimport { modelChoiceId, modelForChoiceId } from '@/utils/sessionModel'\nimport { MODEL_CATALOG_CHANGED_EVENT, modelCatalogChangedProfile } from '@/utils/modelCatalogEvents'\nimport { isOwnedChatSession } from '@/utils/sessionOwnership'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\nimport { getSession } from '@/api/sessions'\n\nconst unread=useUnreadStore()\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst route = useRoute()\nconst router = useRouter()\nconst quoted = ref<UiMessage | null>(null)\nconst preview = ref<UiLibraryItem | null>(null)\nconst filePreview = ref<UiLibraryItem | null>(null)\nconst mediaPreviewIndex = ref<number | null>(null)\nconst outlineOpen = ref(false)\nconst modelDialog = ref(false)\nconst modelSwitching = ref(false)\nconst showThinking = ref(false)\nconst queueMode = ref(false)\nconst actionSessionId = ref('')\nconst renaming = ref(false)\nconst renameValue = ref('')\nconst actionMenuPosition = ref({ x: 8, y: 8 })\nconst composer = ref<InstanceType<typeof ComposerShell> | null>(null)\nconst timeline = ref<InstanceType<typeof MessageTimeline> | null>(null)\nconst headerSessionMenuButton = ref<HTMLButtonElement | null>(null)\nconst restoringRouteProfile = ref('')\n\nfunction handleModelCatalogChanged(event: Event) {\n const profile = modelCatalogChangedProfile(event)\n if (profile && profile === auth.activeProfile?.name) void chat.loadModels(profile).catch(() => undefined)\n}\n\nconst sessions = computed(() => [...chat.sessions]\n .filter(isOwnedChatSession))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [\n profile.name,\n profile.agentName || profile.displayName || profile.name,\n])))\nconst agentAvatars = computed(() => Object.fromEntries(auth.profiles.flatMap(profile =>\n profile.agentAvatar ? [[profile.name, profile.agentAvatar] as const] : []\n)))\nconst sidebarItems = computed(() => sessions.value.map(session => sessionSidebarItem(\n session,\n unread.snapshot.conversations.find(c=>c.mode==='chat'&&c.id===session.id&&c.profile===session.profile)?.count ?? 0,\n agentNames.value.get(session.profile || auth.activeProfile?.name || ''),\n)))\nconst messages = computed(() => chatMessagesToUi(chat.messages, profile => profile ? agentNames.value.get(profile) : undefined))\nconst conversationMediaItems = computed(() => mediaItemsFromMessages(messages.value))\nconst lightboxMedia = computed(() => conversationMediaItems.value.map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst activeSession = computed(() => chat.activeSession)\nconst actionSession = computed(() => chat.sessions.find(session => session.id === actionSessionId.value))\nconst connected = computed(() => ['connected', 'ready'].includes(chat.connectionState))\nconst interaction = computed(() => chatInteraction(chat.pendingApproval, chat.pendingClarification))\nconst reference = computed<ComposerReference | null>(() => quoted.value ? { id: quoted.value.id, content: quoted.value.content, author: quoted.value.author } : null)\nconst forkSourceTitle = computed(() => {\n const parentId = activeSession.value?.parentSessionId\n if (!parentId) return ''\n return chat.sessions.find(session => session.id === parentId && session.profile === activeSession.value?.profile)?.title || parentId\n})\nconst selectedModelId = computed(() => chat.selectedModel ? modelChoiceId(chat.selectedModel) : '')\nconst reasoningOptions: ChoiceOption[] = [\n { id: '', label: '默认', description: '使用模型或 Profile 的默认强度' },\n { id: 'none', label: '关闭', description: '不使用额外推理' },\n { id: 'low', label: '低', description: '更快的轻量推理' },\n { id: 'medium', label: '中', description: '速度与深度平衡' },\n { id: 'high', label: '高', description: '更深入地分析复杂问题' },\n { id: 'xhigh', label: '极高', description: '适用于最复杂的任务' },\n]\nconst reasoningComposerOptions = computed<ComposerOption[]>(() => reasoningOptions.map(option => ({\n id: option.id,\n label: option.label,\n detail: option.description,\n})))\nconst reasoningLabel = computed(() => reasoningOptions.find(option => option.id === (chat.reasoningEffort || ''))?.label || '默认')\nconst actionMenuStyle = computed(() => ({ left: `${actionMenuPosition.value.x}px`, top: `${actionMenuPosition.value.y}px` }))\n\nfunction routeProfile(): string {\n const value = typeof route.query.profile === 'string' ? route.query.profile : ''\n return auth.profiles.some(profile => profile.name === value) ? value : ''\n}\n\nfunction sessionLocation(id: string, profile: string) {\n return { path: `/chat/${encodeURIComponent(id)}`, query: { profile } }\n}\n\nasync function findLegacySessionProfile(sessionId: string): Promise<string> {\n for (const profile of auth.profiles) {\n try {\n const session = await getSession(sessionId, profile.name)\n if (session.id === sessionId) return profile.name\n } catch { /* Try the next profile: 9119 returns 404 for a foreign session. */ }\n }\n return auth.activeProfile?.name || ''\n}\n\nasync function ensureRouteProfile(profile: string): Promise<void> {\n if (!profile || auth.activeProfile?.name === profile) return\n chat.switchProfile(profile)\n restoringRouteProfile.value = profile\n auth.selectProfile(profile)\n await nextTick()\n}\n\nasync function refreshSessions() {\n const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''\n const profile = routeProfile() || (requestedId ? await findLegacySessionProfile(requestedId) : auth.activeProfile?.name || '')\n if (profile && auth.activeProfile?.name !== profile) {\n if (requestedId) await router.replace(sessionLocation(requestedId, profile))\n await ensureRouteProfile(profile)\n }\n // The session route is the authoritative navigation target. A secondary\n // unread-count request must never prevent its history from being restored.\n await chat.loadSessions(profile, 'chat')\n if (requestedId) {\n const target = await getSession(requestedId, profile).catch(() => undefined)\n if (target && !isOwnedChatSession(target)) {\n await router.replace({ path: `/history/${encodeURIComponent(requestedId)}`, query: { profile } })\n return\n }\n }\n if (requestedId && chat.activeSessionId !== requestedId) await chat.selectSession(requestedId, profile)\n if (requestedId && profile && routeProfile() !== profile) await router.replace(sessionLocation(requestedId, profile))\n void chat.loadUnread(profile).catch(() => undefined)\n if (!requestedId && chat.activeSession && !isOwnedChatSession(chat.activeSession)) {\n chat.clearSelection()\n }\n}\n\nconst readPending=new Set<string>()\nasync function markVisible(ids:string[]){\n if(preview.value||filePreview.value||outlineOpen.value||modelDialog.value||!chat.activeSessionId||typeof route.query.unread==='string')return\n const session=chat.activeSessionId,profile=chat.activeProfileName,key=`${profile}:${session}:${ids.join(',')}`\n if(readPending.has(key))return\n readPending.add(key);try{await unread.visible('chat',session,profile,ids)}catch{}finally{readPending.delete(key)}\n}\nlet unreadNavigation=0\nwatch(()=>[route.params.id,route.query.unread,chat.messages.length],async()=>{\n const id=route.query.unread;if(typeof id!=='string'||!chat.activeSessionId)return\n const own=++unreadNavigation\n for(let i=0;i<100&&own===unreadNavigation;i++){\n await nextTick();if(timeline.value?.scrollToMessage(id)){const query={...route.query};delete query.unread;await router.replace({query});return}\n if(!chat.hasMoreBefore)return\n const before=chat.messages.length;await chat.loadOlder();if(chat.messages.length===before)return\n }\n},{flush:'post'})\nasync function chooseSession(id: string) {\n outlineOpen.value = false\n preview.value = null\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name || 'default'\n await router.push(sessionLocation(id, profile))\n await ensureRouteProfile(profile)\n if (chat.activeProfileName !== profile) await chat.loadSessions(profile, 'chat')\n await chat.selectSession(id, profile)\n\n quoted.value = null\n}\n\nasync function createSession() {\n outlineOpen.value = false\n preview.value = null\n const id = chat.createSession(auth.activeProfile?.name)\n await router.push(sessionLocation(id, auth.activeProfile?.name || 'default'))\n}\n\nasync function send(payload: ComposerSubmit) {\n try {\n await chat.send(payload.text, payload.files, queueMode.value ? 'queue' : chat.isStreaming ? 'steer' : 'submit')\n composer.value?.clearAfterSend()\n } catch { /* store exposes the error and the composer keeps its draft */ }\n}\n\nfunction openAttachment(attachment: NonNullable<UiMessage['attachments']>[number]) {\n const item = previewItemFromUrl(attachment.name, attachment.url || '', attachment.id, attachment.kind)\n item.size = attachment.size\n if (item.kind === 'image' || item.kind === 'video') openMedia(item)\n else { outlineOpen.value = false; preview.value = null; filePreview.value = item }\n}\n\nfunction openMedia(item: UiLibraryItem) {\n const target = mediaUrlIdentity(item.previewUrl || item.downloadUrl || '')\n const index = lightboxMedia.value.findIndex(media => mediaUrlIdentity(media.url) === target)\n mediaPreviewIndex.value = index >= 0 ? index : null\n}\n\nfunction openLocalFile({ name, url }: { name: string; url: string }) {\n const item = previewItemFromUrl(name, url)\n if (item.kind === 'image' || item.kind === 'video') openMedia(item)\n else { outlineOpen.value = false; filePreview.value = item }\n}\n\nasync function addPreviewToComposer(item: UiLibraryItem) {\n const file = await loadComposerFile(item)\n if (!file || !composer.value) return\n composer.value.attachFiles([file])\n preview.value = null\n filePreview.value = null\n mediaPreviewIndex.value = null\n await nextTick()\n composer.value?.focus()\n}\n\nasync function addMediaToComposer(media: PreviewMedia) {\n await addPreviewToComposer(previewItemFromUrl(media.name, media.url, `preview:${media.url}`, media.type))\n}\n\nasync function selectModel(id: string) {\n if (id === selectedModelId.value) {\n modelDialog.value = false\n return\n }\n const model = modelForChoiceId(chat.models, id)\n if (!model || modelSwitching.value) return\n modelSwitching.value = true\n try {\n await chat.setModel(model)\n modelDialog.value = false\n } finally {\n modelSwitching.value = false\n }\n}\n\nfunction selectReasoning(id: string) {\n chat.reasoningEffort = id || undefined\n}\n\nasync function toggleFastMode(enabled: boolean) {\n try { await chat.setFastMode(enabled) } catch { /* store restores the acknowledged state */ }\n}\n\nfunction restoreShowThinking(profile = auth.activeProfile?.name || 'default') {\n showThinking.value = readAgentShowThinking(auth.user?.id ?? 'local', profile)\n}\n\nfunction toggleShowThinking() {\n showThinking.value = !showThinking.value\n writeAgentShowThinking(auth.user?.id ?? 'local', auth.activeProfile?.name || 'default', showThinking.value)\n}\n\nfunction openSessionActions(id: string, event?: MouseEvent) {\n actionSessionId.value = id\n const session = chat.sessions.find(item => item.id === id)\n renameValue.value = session?.title || ''\n renaming.value = false\n const menuWidth = 208\n const menuHeight = 210\n const inset = 8\n const anchor = event?.currentTarget instanceof HTMLElement ? event.currentTarget.getBoundingClientRect() : null\n const requestedX = event?.type === 'contextmenu' ? event.clientX : anchor ? anchor.right - menuWidth : window.innerWidth - menuWidth - 14\n const requestedY = event?.type === 'contextmenu' ? event.clientY : anchor ? anchor.bottom + 5 : 46\n actionMenuPosition.value = {\n x: Math.max(inset, Math.min(requestedX, window.innerWidth - menuWidth - inset)),\n y: Math.max(inset, Math.min(requestedY, window.innerHeight - menuHeight - inset)),\n }\n}\n\nfunction closeSessionActions() {\n actionSessionId.value = ''\n renaming.value = false\n}\n\nasync function forceRefreshHistory() {\n closeSessionActions()\n try { await chat.forceRefreshHistory() }\n catch { /* The chat store displays the refresh error without clearing messages. */ }\n}\n\nfunction handleSessionActionPointer(event: PointerEvent) {\n if (!actionSessionId.value || (event.target as HTMLElement).closest('.session-actions')) return\n closeSessionActions()\n}\n\nfunction handleSessionActionKey(event: KeyboardEvent) {\n if (event.key === 'Escape' && actionSessionId.value) closeSessionActions()\n}\n\nasync function saveRename() {\n const session = chat.sessions.find(item => item.id === actionSessionId.value)\n if (!session || !renameValue.value.trim()) return\n await chat.renameSession(session.id, renameValue.value.trim(), session.profile)\n closeSessionActions()\n}\n\nasync function toggleSessionPinned() {\n const session = actionSession.value\n if (!session) return\n await chat.setSessionPinned(session.id, !session.pinned, session.profile)\n closeSessionActions()\n}\n\nasync function openSessionOutline() {\n const session = actionSession.value\n if (!session) return\n closeSessionActions()\n if (session.id !== chat.activeSessionId || session.profile !== chat.activeProfileName) await chooseSession(session.id)\n preview.value = null\n outlineOpen.value = true\n}\n\nfunction closeInspector() {\n const restoreMenuFocus = outlineOpen.value\n preview.value = null\n outlineOpen.value = false\n if (restoreMenuFocus) void nextTick(() => headerSessionMenuButton.value?.focus())\n}\n\nfunction navigateOutline(target: { messageId: string; anchorId: string }) {\n timeline.value?.scrollToAnchor(target.messageId, target.anchorId)\n if (window.matchMedia('(max-width: 900px)').matches) closeInspector()\n}\n\nasync function deleteSession() {\n const session = chat.sessions.find(item => item.id === actionSessionId.value)\n if (!session) return\n await chat.removeSession(session.id, session.profile)\n closeSessionActions()\n if (route.params.sessionId === session.id) await router.replace('/chat')\n}\n\nasync function branch() {\n const id = await chat.branchSession()\n if (id) await router.push(sessionLocation(id, chat.activeProfileName || auth.activeProfile?.name || 'default'))\n}\n\nasync function revealSourceMessage() {\n const messageId = typeof route.query.message === 'string' ? route.query.message : ''\n if (!messageId) return\n await nextTick()\n for (let attempt = 0; attempt < 10; attempt += 1) {\n if (timeline.value?.scrollToMessage(messageId)) return\n if (!chat.hasMoreBefore) return\n await chat.loadOlder()\n await nextTick()\n }\n}\n\nonMounted(async () => {\n restoreShowThinking()\n document.addEventListener('pointerdown', handleSessionActionPointer)\n document.addEventListener('keydown', handleSessionActionKey)\n window.addEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)\n await refreshSessions()\n await Promise.allSettled([chat.loadModels(auth.activeProfile?.name), chat.connect()])\n void chat.refreshActiveSessionModel().catch(() => undefined)\n await revealSourceMessage()\n const pendingFile = await consumeLibraryItemForComposer()\n if (pendingFile) composer.value?.attachFiles([pendingFile])\n})\n\nonBeforeUnmount(() => {\n document.removeEventListener('pointerdown', handleSessionActionPointer)\n document.removeEventListener('keydown', handleSessionActionKey)\n window.removeEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)\n})\n\nwatch(() => auth.activeProfile?.name, async (profile, previous) => {\n if (!profile || profile === previous) return\n restoreShowThinking(profile)\n outlineOpen.value = false\n preview.value = null\n if (restoringRouteProfile.value === profile) {\n restoringRouteProfile.value = ''\n return\n }\n chat.switchProfile(profile)\n const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''\n if (requestedId && routeProfile() === profile) {\n await Promise.allSettled([chat.loadSessions(profile, 'chat'), chat.loadModels(profile), chat.loadUnread(profile), chat.connect()])\n await chat.selectSession(requestedId, profile)\n return\n }\n await router.replace({ path: '/chat', query: { profile } })\n await Promise.allSettled([chat.loadSessions(profile, 'chat'), chat.loadModels(profile), chat.loadUnread(profile), chat.connect()])\n})\n\nwatch(() => chat.activeSessionId, async id => {\n const profile = chat.activeProfileName || auth.activeProfile?.name || ''\n if (id) void chat.refreshActiveSessionModel().catch(() => undefined)\n if (!id || (route.params.sessionId === id && routeProfile() === profile)) return\n await router.replace(sessionLocation(id, profile))\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"对话\" :sidebar-subtitle=\"`${sessions.length} 个会话`\" :inspector-open=\"!!preview || outlineOpen\" :inspector-close-label=\"outlineOpen ? '关闭会话大纲' : '关闭预览'\" @close-inspector=\"closeInspector\">\n <template #sidebar-action>\n <button class=\"sidebar-primary-action\" type=\"button\" title=\"新建聊天\" aria-label=\"新建聊天\" @click=\"createSession\">\n <YaoYaoSidebarIcon name=\"add\" />\n <span>新建聊天</span>\n </button>\n </template>\n <template #sidebar>\n <ResourceSidebar\n :items=\"sidebarItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n external-search\n single-line\n :has-more=\"chat.hasMoreSessions\"\n :loading-more=\"chat.isLoadingMoreSessions\"\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"新建会话后,从输入框开始聊天。\"\n @load-more=\"chat.loadMoreSessions(auth.activeProfile?.name)\"\n @select=\"chooseSession\"\n @more=\"openSessionActions\"\n @context-menu=\"openSessionActions\"\n />\n </template>\n\n <div class=\"chat-workspace\">\n <MessageTimeline\n @visible-messages=\"markVisible\"\n ref=\"timeline\"\n :messages=\"messages\"\n :title=\"activeSession?.title || '新会话'\"\n :subtitle=\"activeSession ? `${activeSession.profile || auth.activeProfile?.name || ''} · ${activeSession.model || chat.selectedModel?.name || '默认模型'}` : '选择会话或直接开始输入'\"\n :loading=\"chat.activeRouteState?.isLoadingHistory\"\n :loading-older=\"chat.activeRouteState?.isLoadingHistory\"\n :has-older=\"chat.hasMoreBefore\"\n :connected=\"connected\"\n :synced=\"chat.historySynced\"\n :show-tools=\"showThinking\"\n :thinking=\"chat.isSending || chat.isStreaming\"\n :show-assistant-identity=\"false\"\n :agent-avatars=\"agentAvatars\"\n :interaction=\"interaction\"\n empty-logo\n transparent-header\n :fork-source-title=\"forkSourceTitle\"\n @load-older=\"chat.loadOlder\"\n @quote=\"quoted = $event\"\n @branch=\"branch\"\n @preview=\"openAttachment\"\n @preview-file=\"openLocalFile\"\n @approve=\"interaction && chat.respondToApproval(interaction.id, $event)\"\n @clarify=\"interaction && chat.respondToClarification(interaction.id, $event)\"\n >\n <template #header-actions>\n <button v-if=\"activeSession\" ref=\"headerSessionMenuButton\" class=\"icon-button header-session-menu\" type=\"button\" title=\"会话操作\" aria-label=\"会话操作\" @click=\"openSessionActions(activeSession.id, $event)\"><AppIcon name=\"dots\" :size=\"18\" /></button>\n </template>\n </MessageTimeline>\n <p v-if=\"chat.error\" class=\"chat-error\" role=\"alert\"><AppIcon name=\"alert\" :size=\"13\" />{{ chat.error }}</p>\n <ComposerShell\n ref=\"composer\"\n mode=\"chat\"\n :draft-key=\"`${auth.user?.id || 'local'}:${auth.activeProfile?.name || 'default'}:${chat.activeSessionId || 'new'}`\"\n :disabled=\"chat.connectionState === 'failed'\"\n :streaming=\"chat.isStreaming\"\n :sending=\"chat.isSending\"\n :model-label=\"chat.selectedModel?.name || '选择模型'\"\n :fast-mode=\"chat.fastMode\"\n :fast-mode-disabled=\"!chat.activeSessionId\"\n :reasoning-effort=\"reasoningLabel\"\n :reasoning-value=\"chat.reasoningEffort || ''\"\n :reasoning-options=\"reasoningComposerOptions\"\n show-context\n :context-used=\"chat.contextUsage?.contextTokens\"\n :context-limit=\"chat.contextUsage?.contextLimit\"\n :context-percent=\"chat.contextUsage?.percentUsed\"\n :queue-mode=\"queueMode || chat.isQueued\"\n :tool-trace-visible=\"showThinking\"\n :reference=\"reference\"\n :slash-commands=\"[\n { id: 'fork', label: 'fork', detail: '从当前会话创建分支' },\n { id: 'compact', label: 'compact', detail: '压缩当前会话上下文' },\n { id: 'model', label: 'model', detail: '切换模型' },\n ]\"\n @send=\"send\"\n @stop=\"chat.interrupt\"\n @model-click=\"modelDialog = true\"\n @fast-mode-toggle=\"toggleFastMode\"\n @reasoning-change=\"selectReasoning\"\n @settings-click=\"toggleShowThinking\"\n @queue-toggle=\"queueMode = !queueMode\"\n @clear-reference=\"quoted = null\"\n />\n </div>\n\n <template #inspector>\n <SessionOutline v-if=\"outlineOpen\" :messages=\"messages\" :has-older=\"chat.hasMoreBefore\" @navigate=\"navigateOutline\" />\n <PreviewInspector v-else-if=\"preview\" :item=\"preview\" @close=\"preview = null\" @add-to-composer=\"addPreviewToComposer\" />\n </template>\n </WorkspaceView>\n\n <FloatingResourceSearch section=\"chat\" label=\"搜索会话\" :items=\"sidebarItems\" @select=\"chooseSession\" />\n <PreviewModal v-if=\"filePreview\" :item=\"filePreview\" :items=\"conversationMediaItems\" @close=\"filePreview = null\" @add-to-composer=\"addPreviewToComposer\" @source=\"filePreview = null\" />\n <ImagePreviewLightbox v-model=\"mediaPreviewIndex\" :images=\"lightboxMedia\" @add=\"addMediaToComposer\" />\n\n <ModelChoiceDialog :open=\"modelDialog\" :options=\"chat.models\" :selected-id=\"selectedModelId\" :busy=\"modelSwitching\" @close=\"modelDialog = false\" @select=\"selectModel\" />\n\n <Teleport to=\"body\">\n <Transition name=\"session-menu\">\n <section v-if=\"actionSessionId\" class=\"session-actions\" :style=\"actionMenuStyle\" role=\"menu\" aria-label=\"会话操作\" @contextmenu.prevent>\n <template v-if=\"renaming\">\n <label>会话名称<input v-model=\"renameValue\" maxlength=\"120\" autofocus @keydown.enter=\"saveRename\" /></label>\n <div><button class=\"quiet-button\" type=\"button\" @click=\"renaming = false\">取消</button><button class=\"solid-button\" type=\"button\" @click=\"saveRename\">保存</button></div>\n </template>\n <template v-else>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"openSessionOutline\"><AppIcon name=\"menu\" :size=\"14\" />会话大纲</button>\n <button v-if=\"actionSessionId === chat.activeSessionId\" class=\"action-row\" role=\"menuitem\" type=\"button\" :disabled=\"chat.isStreaming || chat.isQueued || chat.isSending || chat.activeRouteState?.isLoadingHistory\" @click=\"forceRefreshHistory\"><AppIcon name=\"refresh\" :size=\"14\" />强制刷新历史</button>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"toggleSessionPinned\"><AppIcon :name=\"actionSession?.pinned ? 'pin-off' : 'pin'\" :size=\"14\" />{{ actionSession?.pinned ? '取消置顶' : '置顶会话' }}</button>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"renaming = true\"><AppIcon name=\"edit\" :size=\"14\" />重命名</button>\n <button class=\"action-row danger\" role=\"menuitem\" type=\"button\" @click=\"deleteSession\"><AppIcon name=\"trash\" :size=\"14\" />删除会话</button>\n </template>\n </section>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.chat-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.sidebar-primary-action { display: flex; width: 100%; min-height: 40px; align-items: center; gap: 10px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--text-primary); cursor: pointer; font-size: 12px; font-weight: 610; text-align: left; transition: background-color 120ms ease; }\n.sidebar-primary-action:hover, .sidebar-primary-action:focus-visible { background: var(--surface-hover); outline: 0; }\n.sidebar-primary-action:focus-visible { box-shadow: inset 0 0 0 1px var(--line-strong); }\n.header-session-menu { color: var(--text-muted); background: transparent; }.header-session-menu:hover { color: var(--text-primary); background: var(--surface-soft); }\n.chat-error { display: flex; width: min(760px, calc(100% - 32px)); margin: 0 auto 4px; align-items: center; gap: 6px; color: var(--danger); font-size: 9px; }\n.session-actions { position: fixed; z-index: 205; width: 208px; box-sizing: border-box; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-raised); box-shadow: 0 12px 34px rgba(0,0,0,.16); }.action-row { display: flex; width: 100%; min-height: 34px; align-items: center; gap: 8px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 11px; text-align: left; }.action-row:hover, .action-row:focus-visible { outline: 0; background: var(--surface-soft); color: var(--text-primary); }.action-row.danger { color: var(--danger); }.session-actions label { display: flex; flex-direction: column; gap: 6px; padding: 4px; color: var(--text-muted); font-size: 9px; }.session-actions input { width: 100%; height: 32px; box-sizing: border-box; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--surface-soft); color: var(--text-primary); font-size: 11px; }.session-actions input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--focus-ring); }.session-actions > div { display: flex; justify-content: flex-end; gap: 5px; margin-top: 7px; padding: 0 4px 3px; }.session-actions :deep(.quiet-button), .session-actions :deep(.solid-button) { min-height: 29px; padding-inline: 10px; font-size: 10px; }\n.session-menu-enter-active, .session-menu-leave-active { transition: opacity 100ms ease, transform 120ms var(--ease-out); transform-origin: top right; }.session-menu-enter-from, .session-menu-leave-to { opacity: 0; transform: translateY(-3px) scale(.98); }\n@media (prefers-reduced-motion: reduce) { .sidebar-primary-action, .session-menu-enter-active, .session-menu-leave-active { transition: none; } }\n</style>\n","<script setup lang=\"ts\">\nimport {useUnreadStore} from '@/stores/unread'\nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRoute, useRouter } from 'vue-router'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport YaoYaoSidebarIcon from '@/components/common/YaoYaoSidebarIcon.vue'\nimport type { ChoiceOption } from '@/components/common/types'\nimport ComposerShell from '@/components/composer/ComposerShell.vue'\nimport ModelChoiceDialog from '@/components/composer/ModelChoiceDialog.vue'\nimport type { ComposerOption, ComposerReference, ComposerSubmit } from '@/components/composer/types'\nimport PreviewInspector from '@/components/library/PreviewInspector.vue'\nimport PreviewModal from '@/components/library/PreviewModal.vue'\nimport ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'\nimport type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'\nimport type { UiLibraryItem } from '@/components/library/types'\nimport { mediaItemsFromMessages, mediaUrlIdentity, previewItemFromUrl } from '@/components/library/mediaSequence'\nimport MessageTimeline from '@/components/messages/MessageTimeline.vue'\nimport SessionOutline from '@/components/messages/SessionOutline.vue'\nimport type { UiMessage } from '@/components/messages/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport FloatingResourceSearch from '@/components/app/FloatingResourceSearch.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { chatInteraction, chatMessagesToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { consumeLibraryItemForComposer, loadComposerFile } from '@/components/workspace/pendingComposer'\nimport { readAgentShowThinking, writeAgentShowThinking } from '@/utils/sessionPreferences'\nimport { modelChoiceId, modelForChoiceId } from '@/utils/sessionModel'\nimport { MODEL_CATALOG_CHANGED_EVENT, modelCatalogChangedProfile } from '@/utils/modelCatalogEvents'\nimport { isOwnedChatSession } from '@/utils/sessionOwnership'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\nimport { getSession } from '@/api/sessions'\n\nconst unread=useUnreadStore()\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst route = useRoute()\nconst router = useRouter()\nconst quoted = ref<UiMessage | null>(null)\nconst preview = ref<UiLibraryItem | null>(null)\nconst filePreview = ref<UiLibraryItem | null>(null)\nconst mediaPreviewIndex = ref<number | null>(null)\nconst outlineOpen = ref(false)\nconst modelDialog = ref(false)\nconst modelSwitching = ref(false)\nconst showThinking = ref(false)\nconst queueMode = ref(false)\nconst actionSessionId = ref('')\nconst renaming = ref(false)\nconst renameValue = ref('')\nconst actionMenuPosition = ref({ x: 8, y: 8 })\nconst composer = ref<InstanceType<typeof ComposerShell> | null>(null)\nconst timeline = ref<InstanceType<typeof MessageTimeline> | null>(null)\nconst headerSessionMenuButton = ref<HTMLButtonElement | null>(null)\nconst restoringRouteProfile = ref('')\n\nfunction handleModelCatalogChanged(event: Event) {\n const profile = modelCatalogChangedProfile(event)\n if (profile && profile === auth.activeProfile?.name) void chat.loadModels(profile).catch(() => undefined)\n}\n\nconst sessions = computed(() => [...chat.sessions]\n .filter(isOwnedChatSession))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [\n profile.name,\n profile.agentName || profile.displayName || profile.name,\n])))\nconst agentAvatars = computed(() => Object.fromEntries(auth.profiles.flatMap(profile =>\n profile.agentAvatar ? [[profile.name, profile.agentAvatar] as const] : []\n)))\nconst sidebarItems = computed(() => sessions.value.map(session => sessionSidebarItem(\n session,\n unread.snapshot.conversations.find(c=>c.mode==='chat'&&c.id===session.id&&c.profile===session.profile)?.count ?? 0,\n agentNames.value.get(session.profile || auth.activeProfile?.name || ''),\n)))\nconst messages = computed(() => chatMessagesToUi(chat.messages, profile => profile ? agentNames.value.get(profile) : undefined))\nconst conversationMediaItems = computed(() => mediaItemsFromMessages(messages.value))\nconst lightboxMedia = computed(() => conversationMediaItems.value.map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst activeSession = computed(() => chat.activeSession)\nconst actionSession = computed(() => chat.sessions.find(session => session.id === actionSessionId.value))\nconst connected = computed(() => ['connected', 'ready'].includes(chat.connectionState))\nconst interaction = computed(() => chatInteraction(chat.pendingApproval, chat.pendingClarification))\nconst reference = computed<ComposerReference | null>(() => quoted.value ? { id: quoted.value.id, content: quoted.value.content, author: quoted.value.author } : null)\nconst forkSourceTitle = computed(() => {\n const parentId = activeSession.value?.parentSessionId\n if (!parentId) return ''\n return chat.sessions.find(session => session.id === parentId && session.profile === activeSession.value?.profile)?.title || parentId\n})\nconst selectedModelId = computed(() => chat.selectedModel ? modelChoiceId(chat.selectedModel) : '')\nconst reasoningOptions: ChoiceOption[] = [\n { id: '', label: '默认', description: '使用模型或 Profile 的默认强度' },\n { id: 'none', label: '关闭', description: '不使用额外推理' },\n { id: 'low', label: '低', description: '更快的轻量推理' },\n { id: 'medium', label: '中', description: '速度与深度平衡' },\n { id: 'high', label: '高', description: '更深入地分析复杂问题' },\n { id: 'xhigh', label: '极高', description: '适用于最复杂的任务' },\n]\nconst reasoningComposerOptions = computed<ComposerOption[]>(() => reasoningOptions.map(option => ({\n id: option.id,\n label: option.label,\n detail: option.description,\n})))\nconst reasoningLabel = computed(() => reasoningOptions.find(option => option.id === (chat.reasoningEffort || ''))?.label || '默认')\nconst actionMenuStyle = computed(() => ({ left: `${actionMenuPosition.value.x}px`, top: `${actionMenuPosition.value.y}px` }))\n\nfunction routeProfile(): string {\n const value = typeof route.query.profile === 'string' ? route.query.profile : ''\n return auth.profiles.some(profile => profile.name === value) ? value : ''\n}\n\nfunction sessionLocation(id: string, profile: string) {\n return { path: `/chat/${encodeURIComponent(id)}`, query: { profile } }\n}\n\nasync function findLegacySessionProfile(sessionId: string): Promise<string> {\n for (const profile of auth.profiles) {\n try {\n const session = await getSession(sessionId, profile.name)\n if (session.id === sessionId) return profile.name\n } catch { /* Try the next profile: 9119 returns 404 for a foreign session. */ }\n }\n return auth.activeProfile?.name || ''\n}\n\nasync function ensureRouteProfile(profile: string): Promise<void> {\n if (!profile || auth.activeProfile?.name === profile) return\n chat.switchProfile(profile)\n restoringRouteProfile.value = profile\n auth.selectProfile(profile)\n await nextTick()\n}\n\nasync function refreshSessions() {\n const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''\n const profile = routeProfile() || (requestedId ? await findLegacySessionProfile(requestedId) : auth.activeProfile?.name || '')\n if (profile && auth.activeProfile?.name !== profile) {\n if (requestedId) await router.replace(sessionLocation(requestedId, profile))\n await ensureRouteProfile(profile)\n }\n // The session route is the authoritative navigation target. A secondary\n // unread-count request must never prevent its history from being restored.\n await chat.loadSessions(profile, 'chat')\n if (requestedId) {\n const target = await getSession(requestedId, profile).catch(() => undefined)\n if (target && !isOwnedChatSession(target)) {\n await router.replace({ path: `/history/${encodeURIComponent(requestedId)}`, query: { profile } })\n return\n }\n }\n if (requestedId && chat.activeSessionId !== requestedId) await chat.selectSession(requestedId, profile)\n if (requestedId && profile && routeProfile() !== profile) await router.replace(sessionLocation(requestedId, profile))\n void chat.loadUnread(profile).catch(() => undefined)\n if (!requestedId && chat.activeSession && !isOwnedChatSession(chat.activeSession)) {\n chat.clearSelection()\n }\n}\n\nconst readPending=new Set<string>()\nasync function markVisible(ids:string[]){\n if(preview.value||filePreview.value||outlineOpen.value||modelDialog.value||!chat.activeSessionId||typeof route.query.unread==='string')return\n const session=chat.activeSessionId,profile=chat.activeProfileName,key=`${profile}:${session}:${ids.join(',')}`\n if(readPending.has(key))return\n readPending.add(key);try{await unread.visible('chat',session,profile,ids)}catch{}finally{readPending.delete(key)}\n}\nlet unreadNavigation=0\nwatch(()=>[route.params.id,route.query.unread,chat.messages.length],async()=>{\n const id=route.query.unread;if(typeof id!=='string'||!chat.activeSessionId)return\n const own=++unreadNavigation\n for(let i=0;i<100&&own===unreadNavigation;i++){\n await nextTick();if(timeline.value?.scrollToMessage(id)){const query={...route.query};delete query.unread;await router.replace({query});return}\n if(!chat.hasMoreBefore)return\n const before=chat.messages.length;await chat.loadOlder();if(chat.messages.length===before)return\n }\n},{flush:'post'})\nasync function chooseSession(id: string) {\n outlineOpen.value = false\n preview.value = null\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name || 'default'\n await router.push(sessionLocation(id, profile))\n await ensureRouteProfile(profile)\n if (chat.activeProfileName !== profile) await chat.loadSessions(profile, 'chat')\n await chat.selectSession(id, profile)\n\n quoted.value = null\n}\n\nasync function createSession() {\n outlineOpen.value = false\n preview.value = null\n const id = chat.createSession(auth.activeProfile?.name)\n await router.push(sessionLocation(id, auth.activeProfile?.name || 'default'))\n}\n\nasync function send(payload: ComposerSubmit) {\n try {\n await chat.send(payload.text, payload.files, queueMode.value ? 'queue' : chat.isStreaming ? 'steer' : 'submit')\n composer.value?.clearAfterSend()\n } catch { /* store exposes the error and the composer keeps its draft */ }\n}\n\nfunction openAttachment(attachment: NonNullable<UiMessage['attachments']>[number]) {\n const item = previewItemFromUrl(attachment.name, attachment.url || '', attachment.id, attachment.kind)\n item.size = attachment.size\n if (item.kind === 'image' || item.kind === 'video') openMedia(item)\n else { outlineOpen.value = false; preview.value = null; filePreview.value = item }\n}\n\nfunction openMedia(item: UiLibraryItem) {\n const target = mediaUrlIdentity(item.previewUrl || item.downloadUrl || '')\n const index = lightboxMedia.value.findIndex(media => mediaUrlIdentity(media.url) === target)\n mediaPreviewIndex.value = index >= 0 ? index : null\n}\n\nfunction openLocalFile({ name, url }: { name: string; url: string }) {\n const item = previewItemFromUrl(name, url)\n if (item.kind === 'image' || item.kind === 'video') openMedia(item)\n else { outlineOpen.value = false; filePreview.value = item }\n}\n\nasync function addPreviewToComposer(item: UiLibraryItem) {\n const file = await loadComposerFile(item)\n if (!file || !composer.value) return\n composer.value.attachFiles([file])\n preview.value = null\n filePreview.value = null\n mediaPreviewIndex.value = null\n await nextTick()\n composer.value?.focus()\n}\n\nasync function addMediaToComposer(media: PreviewMedia) {\n await addPreviewToComposer(previewItemFromUrl(media.name, media.url, `preview:${media.url}`, media.type))\n}\n\nasync function selectModel(id: string) {\n if (id === selectedModelId.value) {\n modelDialog.value = false\n return\n }\n const model = modelForChoiceId(chat.models, id)\n if (!model || modelSwitching.value) return\n modelSwitching.value = true\n try {\n await chat.setModel(model)\n modelDialog.value = false\n } finally {\n modelSwitching.value = false\n }\n}\n\nfunction selectReasoning(id: string) {\n chat.reasoningEffort = id || undefined\n}\n\nasync function toggleFastMode(enabled: boolean) {\n try { await chat.setFastMode(enabled) } catch { /* store restores the acknowledged state */ }\n}\n\nfunction restoreShowThinking(profile = auth.activeProfile?.name || 'default') {\n showThinking.value = readAgentShowThinking(auth.user?.id ?? 'local', profile)\n}\n\nfunction toggleShowThinking() {\n showThinking.value = !showThinking.value\n writeAgentShowThinking(auth.user?.id ?? 'local', auth.activeProfile?.name || 'default', showThinking.value)\n}\n\nfunction openSessionActions(id: string, event?: MouseEvent) {\n actionSessionId.value = id\n const session = chat.sessions.find(item => item.id === id)\n renameValue.value = session?.title || ''\n renaming.value = false\n const menuWidth = 208\n const menuHeight = 210\n const inset = 8\n const anchor = event?.currentTarget instanceof HTMLElement ? event.currentTarget.getBoundingClientRect() : null\n const requestedX = event?.type === 'contextmenu' ? event.clientX : anchor ? anchor.right - menuWidth : window.innerWidth - menuWidth - 14\n const requestedY = event?.type === 'contextmenu' ? event.clientY : anchor ? anchor.bottom + 5 : 46\n actionMenuPosition.value = {\n x: Math.max(inset, Math.min(requestedX, window.innerWidth - menuWidth - inset)),\n y: Math.max(inset, Math.min(requestedY, window.innerHeight - menuHeight - inset)),\n }\n}\n\nfunction closeSessionActions() {\n actionSessionId.value = ''\n renaming.value = false\n}\n\nasync function forceRefreshHistory() {\n closeSessionActions()\n try { await chat.forceRefreshHistory() }\n catch { /* The chat store displays the refresh error without clearing messages. */ }\n}\n\nfunction handleSessionActionPointer(event: PointerEvent) {\n if (!actionSessionId.value || (event.target as HTMLElement).closest('.session-actions')) return\n closeSessionActions()\n}\n\nfunction handleSessionActionKey(event: KeyboardEvent) {\n if (event.key === 'Escape' && actionSessionId.value) closeSessionActions()\n}\n\nasync function saveRename() {\n const session = chat.sessions.find(item => item.id === actionSessionId.value)\n if (!session || !renameValue.value.trim()) return\n await chat.renameSession(session.id, renameValue.value.trim(), session.profile)\n closeSessionActions()\n}\n\nasync function toggleSessionPinned() {\n const session = actionSession.value\n if (!session) return\n await chat.setSessionPinned(session.id, !session.pinned, session.profile)\n closeSessionActions()\n}\n\nasync function openSessionOutline() {\n const session = actionSession.value\n if (!session) return\n closeSessionActions()\n if (session.id !== chat.activeSessionId || session.profile !== chat.activeProfileName) await chooseSession(session.id)\n preview.value = null\n outlineOpen.value = true\n}\n\nfunction closeInspector() {\n const restoreMenuFocus = outlineOpen.value\n preview.value = null\n outlineOpen.value = false\n if (restoreMenuFocus) void nextTick(() => headerSessionMenuButton.value?.focus())\n}\n\nfunction navigateOutline(target: { messageId: string; anchorId: string }) {\n timeline.value?.scrollToAnchor(target.messageId, target.anchorId)\n if (window.matchMedia('(max-width: 900px)').matches) closeInspector()\n}\n\nasync function deleteSession() {\n const session = chat.sessions.find(item => item.id === actionSessionId.value)\n if (!session) return\n await chat.removeSession(session.id, session.profile)\n closeSessionActions()\n if (route.params.sessionId === session.id) await router.replace('/chat')\n}\n\nasync function branch() {\n const id = await chat.branchSession()\n if (id) await router.push(sessionLocation(id, chat.activeProfileName || auth.activeProfile?.name || 'default'))\n}\n\nasync function revealSourceMessage() {\n const messageId = typeof route.query.message === 'string' ? route.query.message : ''\n if (!messageId) return\n await nextTick()\n for (let attempt = 0; attempt < 10; attempt += 1) {\n if (timeline.value?.scrollToMessage(messageId)) return\n if (!chat.hasMoreBefore) return\n await chat.loadOlder()\n await nextTick()\n }\n}\n\nonMounted(async () => {\n restoreShowThinking()\n document.addEventListener('pointerdown', handleSessionActionPointer)\n document.addEventListener('keydown', handleSessionActionKey)\n window.addEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)\n await refreshSessions()\n await Promise.allSettled([chat.loadModels(auth.activeProfile?.name), chat.connect()])\n void chat.refreshActiveSessionModel().catch(() => undefined)\n await revealSourceMessage()\n const pendingFile = await consumeLibraryItemForComposer()\n if (pendingFile) composer.value?.attachFiles([pendingFile])\n})\n\nonBeforeUnmount(() => {\n document.removeEventListener('pointerdown', handleSessionActionPointer)\n document.removeEventListener('keydown', handleSessionActionKey)\n window.removeEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)\n})\n\nwatch(() => auth.activeProfile?.name, async (profile, previous) => {\n if (!profile || profile === previous) return\n restoreShowThinking(profile)\n outlineOpen.value = false\n preview.value = null\n if (restoringRouteProfile.value === profile) {\n restoringRouteProfile.value = ''\n return\n }\n chat.switchProfile(profile)\n const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''\n if (requestedId && routeProfile() === profile) {\n await Promise.allSettled([chat.loadSessions(profile, 'chat'), chat.loadModels(profile), chat.loadUnread(profile), chat.connect()])\n await chat.selectSession(requestedId, profile)\n return\n }\n await router.replace({ path: '/chat', query: { profile } })\n await Promise.allSettled([chat.loadSessions(profile, 'chat'), chat.loadModels(profile), chat.loadUnread(profile), chat.connect()])\n})\n\nwatch(() => chat.activeSessionId, async id => {\n const profile = chat.activeProfileName || auth.activeProfile?.name || ''\n if (id) void chat.refreshActiveSessionModel().catch(() => undefined)\n if (!id || (route.params.sessionId === id && routeProfile() === profile)) return\n await router.replace(sessionLocation(id, profile))\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"对话\" :sidebar-subtitle=\"`${sessions.length} 个会话`\" :inspector-open=\"!!preview || outlineOpen\" :inspector-close-label=\"outlineOpen ? '关闭会话大纲' : '关闭预览'\" @close-inspector=\"closeInspector\">\n <template #sidebar-action>\n <button class=\"sidebar-primary-action\" type=\"button\" title=\"新建聊天\" aria-label=\"新建聊天\" @click=\"createSession\">\n <YaoYaoSidebarIcon name=\"add\" />\n <span>新建聊天</span>\n </button>\n </template>\n <template #sidebar>\n <ResourceSidebar\n :items=\"sidebarItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n external-search\n single-line\n :has-more=\"chat.hasMoreSessions\"\n :loading-more=\"chat.isLoadingMoreSessions\"\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"新建会话后,从输入框开始聊天。\"\n @load-more=\"chat.loadMoreSessions(auth.activeProfile?.name)\"\n @select=\"chooseSession\"\n @more=\"openSessionActions\"\n @context-menu=\"openSessionActions\"\n />\n </template>\n\n <div class=\"chat-workspace\">\n <MessageTimeline\n @visible-messages=\"markVisible\"\n ref=\"timeline\"\n :messages=\"messages\"\n :title=\"activeSession?.title || '新会话'\"\n :subtitle=\"activeSession ? `${activeSession.profile || auth.activeProfile?.name || ''} · ${activeSession.model || chat.selectedModel?.name || '默认模型'}` : '选择会话或直接开始输入'\"\n :loading=\"chat.activeRouteState?.isLoadingHistory\"\n :loading-older=\"chat.activeRouteState?.isLoadingHistory\"\n :has-older=\"chat.hasMoreBefore\"\n :connected=\"connected\"\n :synced=\"chat.historySynced\"\n :show-tools=\"showThinking\"\n :thinking=\"chat.isSending || chat.isStreaming\"\n :show-assistant-identity=\"false\"\n :agent-avatars=\"agentAvatars\"\n :interaction=\"interaction\"\n empty-logo\n transparent-header\n :fork-source-title=\"forkSourceTitle\"\n @load-older=\"chat.loadOlder\"\n @quote=\"quoted = $event\"\n @branch=\"branch\"\n @preview=\"openAttachment\"\n @preview-file=\"openLocalFile\"\n @approve=\"interaction && chat.respondToApproval(interaction.id, $event)\"\n @clarify=\"interaction && chat.respondToClarification(interaction.id, $event)\"\n >\n <template #header-actions>\n <button v-if=\"activeSession\" ref=\"headerSessionMenuButton\" class=\"icon-button header-session-menu\" type=\"button\" title=\"会话操作\" aria-label=\"会话操作\" @click=\"openSessionActions(activeSession.id, $event)\"><AppIcon name=\"dots\" :size=\"18\" /></button>\n </template>\n </MessageTimeline>\n <p v-if=\"chat.error\" class=\"chat-error\" role=\"alert\"><AppIcon name=\"alert\" :size=\"13\" />{{ chat.error }}</p>\n <ComposerShell\n ref=\"composer\"\n mode=\"chat\"\n :draft-key=\"`${auth.user?.id || 'local'}:${auth.activeProfile?.name || 'default'}:${chat.activeSessionId || 'new'}`\"\n :disabled=\"chat.connectionState === 'failed'\"\n :streaming=\"chat.isStreaming\"\n :sending=\"chat.isSending\"\n :model-label=\"chat.selectedModel?.name || '选择模型'\"\n :fast-mode=\"chat.fastMode\"\n :fast-mode-disabled=\"!chat.activeSessionId\"\n :reasoning-effort=\"reasoningLabel\"\n :reasoning-value=\"chat.reasoningEffort || ''\"\n :reasoning-options=\"reasoningComposerOptions\"\n show-context\n :context-used=\"chat.contextUsage?.contextTokens\"\n :context-limit=\"chat.contextUsage?.contextLimit\"\n :context-percent=\"chat.contextUsage?.percentUsed\"\n :queue-mode=\"queueMode || chat.isQueued\"\n :tool-trace-visible=\"showThinking\"\n :reference=\"reference\"\n :slash-commands=\"[\n { id: 'fork', label: 'fork', detail: '从当前会话创建分支' },\n { id: 'compact', label: 'compact', detail: '压缩当前会话上下文' },\n { id: 'model', label: 'model', detail: '切换模型' },\n ]\"\n @send=\"send\"\n @stop=\"chat.interrupt\"\n @model-click=\"modelDialog = true\"\n @fast-mode-toggle=\"toggleFastMode\"\n @reasoning-change=\"selectReasoning\"\n @settings-click=\"toggleShowThinking\"\n @queue-toggle=\"queueMode = !queueMode\"\n @clear-reference=\"quoted = null\"\n />\n </div>\n\n <template #inspector>\n <SessionOutline v-if=\"outlineOpen\" :messages=\"messages\" :has-older=\"chat.hasMoreBefore\" @navigate=\"navigateOutline\" />\n <PreviewInspector v-else-if=\"preview\" :item=\"preview\" @close=\"preview = null\" @add-to-composer=\"addPreviewToComposer\" />\n </template>\n </WorkspaceView>\n\n <FloatingResourceSearch section=\"chat\" label=\"搜索会话\" :items=\"sidebarItems\" @select=\"chooseSession\" />\n <PreviewModal v-if=\"filePreview\" :item=\"filePreview\" :items=\"conversationMediaItems\" @close=\"filePreview = null\" @add-to-composer=\"addPreviewToComposer\" @source=\"filePreview = null\" />\n <ImagePreviewLightbox v-model=\"mediaPreviewIndex\" :images=\"lightboxMedia\" @add=\"addMediaToComposer\" />\n\n <ModelChoiceDialog :open=\"modelDialog\" :options=\"chat.models\" :selected-id=\"selectedModelId\" :busy=\"modelSwitching\" @close=\"modelDialog = false\" @select=\"selectModel\" />\n\n <Teleport to=\"body\">\n <Transition name=\"session-menu\">\n <section v-if=\"actionSessionId\" class=\"session-actions\" :style=\"actionMenuStyle\" role=\"menu\" aria-label=\"会话操作\" @contextmenu.prevent>\n <template v-if=\"renaming\">\n <label>会话名称<input v-model=\"renameValue\" maxlength=\"120\" autofocus @keydown.enter=\"saveRename\" /></label>\n <div><button class=\"quiet-button\" type=\"button\" @click=\"renaming = false\">取消</button><button class=\"solid-button\" type=\"button\" @click=\"saveRename\">保存</button></div>\n </template>\n <template v-else>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"openSessionOutline\"><AppIcon name=\"menu\" :size=\"14\" />会话大纲</button>\n <button v-if=\"actionSessionId === chat.activeSessionId\" class=\"action-row\" role=\"menuitem\" type=\"button\" :disabled=\"chat.isStreaming || chat.isQueued || chat.isSending || chat.activeRouteState?.isLoadingHistory\" @click=\"forceRefreshHistory\"><AppIcon name=\"refresh\" :size=\"14\" />强制刷新历史</button>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"toggleSessionPinned\"><AppIcon :name=\"actionSession?.pinned ? 'pin-off' : 'pin'\" :size=\"14\" />{{ actionSession?.pinned ? '取消置顶' : '置顶会话' }}</button>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"renaming = true\"><AppIcon name=\"edit\" :size=\"14\" />重命名</button>\n <button class=\"action-row danger\" role=\"menuitem\" type=\"button\" @click=\"deleteSession\"><AppIcon name=\"trash\" :size=\"14\" />删除会话</button>\n </template>\n </section>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.chat-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.sidebar-primary-action { display: flex; width: 100%; min-height: 40px; align-items: center; gap: 10px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--text-primary); cursor: pointer; font-size: 12px; font-weight: 610; text-align: left; transition: background-color 120ms ease; }\n.sidebar-primary-action:hover, .sidebar-primary-action:focus-visible { background: var(--surface-hover); outline: 0; }\n.sidebar-primary-action:focus-visible { box-shadow: inset 0 0 0 1px var(--line-strong); }\n.header-session-menu { color: var(--text-muted); background: transparent; }.header-session-menu:hover { color: var(--text-primary); background: var(--surface-soft); }\n.chat-error { display: flex; width: min(760px, calc(100% - 32px)); margin: 0 auto 4px; align-items: center; gap: 6px; color: var(--danger); font-size: 9px; }\n.session-actions { position: fixed; z-index: 205; width: 208px; box-sizing: border-box; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-raised); box-shadow: 0 12px 34px rgba(0,0,0,.16); }.action-row { display: flex; width: 100%; min-height: 34px; align-items: center; gap: 8px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 11px; text-align: left; }.action-row:hover, .action-row:focus-visible { outline: 0; background: var(--surface-soft); color: var(--text-primary); }.action-row.danger { color: var(--danger); }.session-actions label { display: flex; flex-direction: column; gap: 6px; padding: 4px; color: var(--text-muted); font-size: 9px; }.session-actions input { width: 100%; height: 32px; box-sizing: border-box; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--surface-soft); color: var(--text-primary); font-size: 11px; }.session-actions input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--focus-ring); }.session-actions > div { display: flex; justify-content: flex-end; gap: 5px; margin-top: 7px; padding: 0 4px 3px; }.session-actions :deep(.quiet-button), .session-actions :deep(.solid-button) { min-height: 29px; padding-inline: 10px; font-size: 10px; }\n.session-menu-enter-active, .session-menu-leave-active { transition: opacity 100ms ease, transform 120ms var(--ease-out); transform-origin: top right; }.session-menu-enter-from, .session-menu-leave-to { opacity: 0; transform: translateY(-3px) scale(.98); }\n@media (prefers-reduced-motion: reduce) { .sidebar-primary-action, .session-menu-enter-active, .session-menu-leave-active { transition: none; } }\n</style>\n"],"mappings":"+tBAEA,IAAM,EAAM,sCAcZ,eAAsB,GAAiB,EAAgD,CACrF,IAAM,EAAM,EAAK,aAAe,EAAK,WACrC,GAAI,CAAC,GAAO,CAAC,EAAK,KAAM,OAAO,KAC/B,GAAI,CACF,IAAM,EAAW,MAAM,MAAM,EAAK,CAAE,YAAa,aAAc,CAAC,EAChE,GAAI,CAAC,EAAS,GAAI,MAAU,MAAM,UAAU,EAAS,OAAO,EAAE,EAC9D,IAAM,EAAO,MAAM,EAAS,KAAK,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