1 line
19 KiB
JavaScript
1 line
19 KiB
JavaScript
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n,y as r}from"./react-QV7DAAIx.js";import{B as i,G as a,I as o,N as s,R as c,S as l,T as u,U as d,W as f,lt as p,p as m,ut as h,y as g}from"./semi-65W_4I1v.js";import{D as _,E as v,F as y,I as b,L as x,O as S,S as ee,_ as C,a as w,b as T,d as E,g as D,i as te,l as O,m as k,n as ne,o as A,p as re,r as ie,s as j,u as M,x as N,y as ae}from"./index-C6SML8F9.js";var P=e(t(),1),F=[`completed`,`running`,`queued`,`failed`,`blocked`,`hard_timeout`,`cancelled`,`orphaned`],I={pending:`statusPending`,queued:`statusQueued`,running:`statusRunning`,completed:`statusCompleted`,failed:`statusFailed`,blocked:`statusBlocked`,cancelled:`statusCancelled`,hard_timeout:`statusHardTimeout`,orphaned:`statusOrphaned`},L={pending:`等待中`,queued:`排队中`,running:`执行中`,completed:`已完成`,failed:`失败`,blocked:`已拦截`,cancelled:`已终止`,hard_timeout:`执行超时`,orphaned:`孤儿任务`},R={completed:`green`,running:`blue`,queued:`amber`,failed:`red`,blocked:`orange`,hard_timeout:`red`,cancelled:`grey`,orphaned:`grey`};function z(e){return String(e||``).trim().toLowerCase()}function B(e,t){let n=z(t),r=I[n];return r?e(`mcpMonitor.${r}`,null,L[n]||n):t||`—`}function V(e){return R[z(e)]||`grey`}function H(e){return z(e)===`running`}function U(e){let t=String(e||``).trim();return t?t.includes(`::`)?t.replace(/::/g,`__`):t:``}function W(e){if(!e)return null;let t=Number(e.duration);if(Number.isFinite(t)&&t>0)return t/1e6;let n=e.startTime?new Date(e.startTime).getTime():NaN,r=e.endTime?new Date(e.endTime).getTime():NaN;return Number.isFinite(n)&&Number.isFinite(r)&&r>=n?r-n:null}function G(e){let t=Number(e);if(!Number.isFinite(t)||t<0)return`—`;if(t<1e3)return`${Math.round(t)} ms`;if(t<6e4)return`${(t/1e3).toFixed(2)} s`;let n=Math.floor(t/6e4),r=Math.round(t%6e4/1e3);return n<60?`${n} 分 ${r} 秒`:`${Math.floor(n/60)} 小时 ${n%60} 分`}function K(e){if(!e)return null;let t=(Number(e.totalCalls)||0)-(Number(e.blockedCalls)||0);return t<=0?null:(Number(e.successCalls)||0)/t}function q(e,t=1){return e==null||!Number.isFinite(Number(e))?`—`:`${(Number(e)*100).toFixed(t)}%`}function oe(e){let t=(e||[]).map(W).filter(e=>Number.isFinite(e)&&e>=0);return t.length?t.reduce((e,t)=>e+t,0)/t.length:null}function J(e,t){let n=new Date(e);if(!Number.isFinite(n.getTime()))return``;let r=e=>String(e).padStart(2,`0`),i=`${r(n.getMonth()+1)}-${r(n.getDate())}`;return t===`30d`?i:t===`7d`?`${i} ${r(n.getHours())}h`:`${r(n.getHours())}:00`}function Y(e,t){let n=e?.t?new Date(e.t).toLocaleString(`zh-CN`,{hour12:!1}):`—`;return t(`mcpMonitor.timelineTooltip`,{time:n,total:e?.total||0,failed:e?.failed||0,blocked:e?.blocked||0},`${n} 总调用 ${e?.total||0},失败 ${e?.failed||0},拦截 ${e?.blocked||0}`)}var X=e(n(),1);function se({summary:e,loading:t,avgMs:n=null,avgSamples:r=0}){let i=y(),a=K(e);return(0,X.jsx)(C,{columns:4,metrics:[{id:`calls`,label:i(`mcpMonitor.totalCalls`,null,`调用次数`),value:e?e.totalCalls??0:`—`,detail:e?i(`mcpMonitor.statsFromAllTools`,null,`全部工具累计,含已拦截调用`):void 0,loading:t},{id:`rate`,label:i(`mcpMonitor.successRate`,null,`成功率`),value:q(a),detail:e?`${i(`common.ok`,null,`成功`)} ${e.successCalls??0} / ${i(`mcpMonitor.failedColumn`,null,`失败`)} ${e.failedCalls??0}`:void 0,tone:a===null?void 0:a>=.95?`success`:a>=.8?`warning`:`danger`,loading:t},{id:`avg`,label:`平均耗时`,value:n===null?`—`:G(n),detail:r>0?`按当前页 ${r} 条计时记录估算`:`当前页暂无可计时的执行记录`,loading:t},{id:`failed`,label:i(`mcpMonitor.failedMetric`,null,`失败数`),value:e?e.failedCalls??0:`—`,detail:e?`${i(`mcpMonitor.blockedCount`,{n:e.blockedCalls??0},`安全拦截 ${e.blockedCalls??0}`)} · ${i(`mcpMonitor.lastCall`,null,`最近调用`)} ${e.lastCallTime?v(e.lastCallTime):`—`}`:void 0,tone:e&&e.failedCalls>0?`danger`:void 0,loading:t}]})}function ce({topTools:e,loading:t,onFilterTool:n,activeTool:r}){let i=y(),a=(0,P.useMemo)(()=>(e||[]).map(e=>{let t=Number(e.totalCalls)||0,n=Number(e.blockedCalls)||0,r=Number(e.successCalls)||0,i=t-n;return{...e,key:e.toolName,displayName:U(e.toolName),rate:i>0?r/i:null}}),[e]),o=[{title:i(`mcpMonitor.columnTool`,null,`工具`),dataIndex:`displayName`,render:(e,t)=>(0,X.jsx)(`button`,{type:`button`,className:`mcp-monitor-tool-link ${r&&r===t.toolName?`mcp-monitor-link-active`:``}`,onClick:()=>n?.(t.toolName),children:e||i(`mcpMonitor.unknownTool`,null,`未知工具`)})},{title:i(`mcpMonitor.columnCalls`,null,`调用`),dataIndex:`totalCalls`,width:90,render:e=>e??0},{title:i(`mcpMonitor.successColumn`,null,`成功`),dataIndex:`successCalls`,width:90,render:e=>e??0},{title:i(`mcpMonitor.failedColumn`,null,`失败`),dataIndex:`failedCalls`,width:90,render:e=>(0,X.jsx)(`span`,{className:e>0?`mcp-monitor-danger`:void 0,children:e??0})},{title:i(`mcpMonitor.blockedColumn`,null,`拦截`),dataIndex:`blockedCalls`,width:90,render:e=>e?(0,X.jsx)(s,{size:`small`,color:`orange`,children:e}):0},{title:i(`mcpMonitor.columnSuccessRate`,null,`成功率`),dataIndex:`rate`,width:110,render:e=>e===null?`—`:S(e,1)}];return(0,X.jsx)(k,{title:i(`mcpMonitor.toolStatsTitle`,null,`工具统计`),description:i(`mcpMonitor.toolStatsHint`,null,`点击工具名筛选下方执行记录`),children:(0,X.jsx)(j,{columns:o,dataSource:a,rowKey:`key`,loading:t,pagination:!1,size:`small`,emptyText:i(`mcpMonitor.noStatsData`,null,`暂无统计数据`)})})}var le=[{value:`24h`,labelKey:`timelineRange24h`,fallback:`24 小时`},{value:`7d`,labelKey:`timelineRange7d`,fallback:`7 天`},{value:`30d`,labelKey:`timelineRange30d`,fallback:`30 天`}];function ue({data:e,loading:t,error:n,range:r,onRangeChange:i,onRetry:a}){let o=y(),s=Array.isArray(e?.points)?e.points:[],c=e?.summary||{},l=Number(c.peak)||0,u=(0,P.useMemo)(()=>s.reduce((e,t)=>Math.max(e,Number(t.total)||0),0),[s]),d=Number(c.totalCalls)||0,f=Math.max(1,Math.ceil(s.length/8)),p=le.map(e=>({value:e.value,label:o(`mcpMonitor.${e.labelKey}`,null,e.fallback)}));return(0,X.jsxs)(k,{title:o(`mcpMonitor.timelineTitle`,null,`调用趋势`),description:o(`mcpMonitor.timelineHint`,null,`全部工具合计,失败与拦截单独着色`),extra:(0,X.jsx)(g,{size:`small`,value:r,optionList:p,style:{width:120},onChange:i}),children:[(0,X.jsx)(O,{error:n,onRetry:a}),(0,X.jsxs)(`div`,{className:`mcp-monitor-timeline-summary`,children:[(0,X.jsx)(D,{label:o(`mcpMonitor.timelineTotalLegend`,null,`总调用`),value:_(d),loading:t}),(0,X.jsx)(D,{label:`峰值 / 桶`,value:_(l),detail:o(`mcpMonitor.scopeTimeline`,null,`当前时间范围`),loading:t}),(0,X.jsxs)(`div`,{className:`mcp-monitor-timeline-legend`,children:[(0,X.jsxs)(`span`,{className:`mcp-monitor-legend-item`,children:[(0,X.jsx)(`i`,{className:`mcp-monitor-legend-dot mcp-monitor-legend-total`}),o(`mcpMonitor.timelineTotalLegend`,null,`总调用`)]}),(0,X.jsxs)(`span`,{className:`mcp-monitor-legend-item`,children:[(0,X.jsx)(`i`,{className:`mcp-monitor-legend-dot mcp-monitor-legend-failed`}),o(`mcpMonitor.timelineFailedLegend`,null,`失败`)]}),(0,X.jsxs)(`span`,{className:`mcp-monitor-legend-item`,children:[(0,X.jsx)(`i`,{className:`mcp-monitor-legend-dot mcp-monitor-legend-blocked`}),o(`mcpMonitor.timelineBlockedLegend`,null,`安全拦截`)]})]})]}),t&&!s.length?(0,X.jsx)(`div`,{className:`mcp-monitor-timeline-empty`,children:o(`mcpMonitor.timelineLoading`,null,`趋势加载中…`)}):d===0||u===0?(0,X.jsxs)(`div`,{className:`mcp-monitor-timeline-empty`,children:[(0,X.jsx)(`p`,{children:o(`mcpMonitor.timelineNoData`,null,`该时段暂无调用`)}),(0,X.jsx)(`p`,{className:`mcp-monitor-timeline-hint`,children:o(`mcpMonitor.timelineEmptyHint`,null,`调用 MCP 工具后此处会出现趋势`)})]}):(0,X.jsx)(`div`,{className:`mcp-monitor-timeline-chart`,role:`img`,"aria-label":o(`mcpMonitor.timelineTitle`,null,`调用趋势`),children:s.map((e,t)=>{let n=Number(e.total)||0,i=Number(e.failed)||0,a=Number(e.blocked)||0,s=n>0?Math.max(3,n/u*100):0,c=n>0?i/n*100:0,l=n>0?a/n*100:0,d=J(e.t,r);return(0,X.jsxs)(`div`,{className:`mcp-monitor-timeline-slot`,title:Y(e,o),children:[(0,X.jsx)(`div`,{className:`mcp-monitor-timeline-bar-wrap`,children:(0,X.jsxs)(`div`,{className:`mcp-monitor-timeline-bar`,style:{height:`${s}%`},children:[l>0&&(0,X.jsx)(`span`,{className:`mcp-monitor-timeline-seg mcp-monitor-seg-blocked`,style:{height:`${l}%`}}),c>0&&(0,X.jsx)(`span`,{className:`mcp-monitor-timeline-seg mcp-monitor-seg-failed`,style:{height:`${c}%`}})]})}),(0,X.jsx)(`span`,{className:`mcp-monitor-timeline-tick`,children:t%f===0?d:``})]},e.t||t)})})]})}function Z({status:e}){let t=y();return(0,X.jsx)(s,{size:`small`,color:V(e),shape:`square`,children:B(t,e)})}function de({data:e,loading:t,error:n,page:r,pageSize:i,status:a,toolInput:s,selected:l,onQuery:u,onPageChange:f,onRefresh:m,onOpenDetail:h,onCancel:_,onDelete:b,onSelectionChange:x,canWrite:S,canDelete:ee}){let C=y(),w=e?.executions||[],T=Number(e?.total)||0,E=[{value:`all`,label:C(`mcp.filterAll`,null,`全部`)},...F.map(e=>({value:e,label:B(C,e)}))],D=[{title:C(`mcpMonitor.columnTool`,null,`工具`),dataIndex:`toolName`,render:e=>(0,X.jsx)(`span`,{className:`mcp-monitor-cell-tool`,children:U(e)||C(`mcpMonitor.unknownTool`,null,`未知工具`)})},{title:C(`mcpMonitor.columnStatus`,null,`状态`),dataIndex:`status`,width:110,render:e=>(0,X.jsx)(Z,{status:e})},{title:C(`mcpMonitor.columnStartTime`,null,`开始时间`),dataIndex:`startTime`,width:180,render:e=>v(e)},{title:C(`mcpMonitor.columnDuration`,null,`耗时`),dataIndex:`duration`,width:110,render:(e,t)=>G(W(t))},{title:C(`common.actions`,null,`操作`),dataIndex:`id`,width:230,render:(e,t)=>(0,X.jsxs)(o,{spacing:4,wrap:!0,children:[(0,X.jsx)(c,{size:`small`,theme:`borderless`,onClick:()=>h(e),children:C(`mcpMonitor.viewDetail`,null,`详情`)}),H(t.status)&&(0,X.jsx)(c,{size:`small`,theme:`borderless`,disabled:!S,onClick:()=>_(t),children:C(`mcpMonitor.terminateExecution`,null,`终止`)}),(0,X.jsx)(c,{size:`small`,theme:`borderless`,type:`danger`,disabled:!ee,onClick:()=>b(t),children:C(`common.delete`,null,`删除`)})]})}];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{error:n,onRetry:m}),(0,X.jsx)(j,{columns:D,dataSource:w,rowKey:`id`,loading:t,pagination:{currentPage:r,pageSize:i,total:T,showSizeChanger:!0,pageSizeOpts:[20,50,100],showTotal:!0,onPageChange:e=>f(e,i),onPageSizeChange:e=>f(1,e)},onRefresh:m,emptyText:C(`mcpMonitor.noExecutions`,null,`暂无执行记录`),rowSelection:{selectedRowKeys:l,onChange:e=>x(e||[])},toolbar:(0,X.jsxs)(o,{spacing:8,wrap:!0,children:[(0,X.jsx)(d,{prefix:(0,X.jsx)(p,{}),value:s,showClear:!0,style:{width:220},placeholder:C(`mcp.toolSearchPlaceholder`,null,`输入工具名称…`),onChange:e=>u({toolInput:e})}),(0,X.jsx)(g,{value:a,style:{width:150},optionList:E,onChange:e=>u({status:e})})]})})]})}var{Text:Q}=a;function fe({executionId:e,onClose:t,canWrite:n,onCancelRequest:r}){let a=y(),{data:s,loading:l,error:u,reload:d}=w(()=>x.get(`/monitor/execution/${encodeURIComponent(e)}`),[e],{skip:!e}),p=e?s:null,h=p?H(p.status):!1;return(0,X.jsxs)(m,{visible:!!e,onCancel:t,title:a(`mcpMonitor.viewDetail`,null,`执行详情`),width:720,footer:p?(0,X.jsxs)(o,{children:[h&&(0,X.jsx)(c,{theme:`solid`,disabled:!n,onClick:()=>r(p),children:a(`mcpMonitor.terminateExecution`,null,`终止`)}),(0,X.jsx)(c,{onClick:t,children:a(`common.close`,null,`关闭`)})]}):null,children:[!p&&l&&(0,X.jsx)(`div`,{className:`mcp-monitor-detail-loading`,children:(0,X.jsx)(f,{})}),(0,X.jsx)(O,{error:u,onRetry:d}),p&&(0,X.jsxs)(`div`,{className:`mcp-monitor-detail`,children:[(0,X.jsx)(E,{columns:2,items:[{label:`工具`,value:(0,X.jsx)(Q,{strong:!0,children:U(p.toolName)||`—`})},{label:a(`mcpMonitor.columnStatus`,null,`状态`),value:(0,X.jsx)(Z,{status:p.status})},{label:`执行 ID`,value:(0,X.jsx)(`span`,{className:`mcp-monitor-mono`,children:p.id})},{label:a(`mcpMonitor.columnStartTime`,null,`开始时间`),value:v(p.startTime)},{label:`结束时间`,value:p.endTime?v(p.endTime):`—`},{label:a(`mcpMonitor.columnDuration`,null,`耗时`),value:G(W(p))},{label:`关联会话`,value:p.conversationId?(0,X.jsxs)(o,{spacing:4,children:[(0,X.jsx)(`span`,{className:`mcp-monitor-mono`,children:p.conversationId}),(0,X.jsx)(A,{text:p.conversationId,size:`small`})]}):`—`},{label:`结果状态`,value:p.result?p.result.isError?`错误结果`:p.result.blocked?`已拦截`:`正常返回`:`无返回`}]}),p.error&&(0,X.jsx)(i,{type:`danger`,className:`mcp-monitor-detail-error`,description:(0,X.jsx)(`span`,{className:`mcp-monitor-mono`,children:p.error})}),(0,X.jsx)(`div`,{className:`mcp-monitor-detail-section`,children:(0,X.jsx)(M,{title:a(`mcpDetailModal.requestParams`,null,`入参`),value:p.arguments??{}})}),(0,X.jsx)(`div`,{className:`mcp-monitor-detail-section`,children:p.result?(0,X.jsx)(M,{title:a(`mcpDetailModal.responseResult`,null,`出参`),value:p.result}):(0,X.jsx)(`div`,{className:`mcp-monitor-detail-empty`,children:h?a(`mcpDetailModal.runningNoResponseYet`,null,`尚无返回,工具可能仍在执行。`):a(`chat.noResponseData`,null,`暂无响应数据`)})}),p.partialOutput&&(0,X.jsxs)(`div`,{className:`mcp-monitor-detail-section`,children:[(0,X.jsxs)(`div`,{className:`mcp-monitor-detail-section-head`,children:[(0,X.jsx)(Q,{strong:!0,children:`实时输出尾部`}),(0,X.jsxs)(o,{spacing:4,children:[p.partialOutputBytes?(0,X.jsxs)(Q,{type:`tertiary`,children:[p.partialOutputBytes,` B`]}):null,(0,X.jsx)(A,{text:p.partialOutput,size:`small`})]})]}),(0,X.jsx)(`pre`,{className:`mcp-monitor-detail-pre`,children:p.partialOutput})]}),(0,X.jsxs)(`div`,{className:`mcp-monitor-detail-footnote`,children:[B(a,p.status),` · `,a(`mcpMonitor.statsFromAllTools`,null,`全部工具累计`)]})]})]})}function $(){let e=y(),{hasPermission:t}=b(),[n,i]=r(),a=t(`monitor:write`)||t(`mcp:write`),s=t(`monitor:delete`),[d,f]=(0,P.useState)(1),[p,m]=(0,P.useState)(20),[g,_]=(0,P.useState)(`all`),[v,S]=(0,P.useState)(``),C=ne(v,350),[E,D]=(0,P.useState)([]),[O,A]=te(`mcp-monitor-timeline-range`,`7d`),[j,M]=(0,P.useState)(null),[F,I]=(0,P.useState)(``),[L,R]=(0,P.useState)(!1),z=n.get(`id`)||``,B=[`24h`,`7d`,`30d`].includes(O)?O:`7d`,V=w(()=>x.get(`/monitor`,{page:d,page_size:p,status:g===`all`?``:g,tool:C}),[d,p,g,C]),H=w(()=>x.get(`/monitor/stats`,{top:12}),[]),G=w(()=>x.get(`/monitor/calls-timeline`,{range:B}),[B]),K=V.data?.executions||[],q=H.data?.summary||V.data?.summary||null,J=H.data?.topTools||V.data?.topTools||[],Y=Number(V.data?.retentionDays)||0,le=(0,P.useMemo)(()=>K.filter(e=>W(e)!==null).length,[K]),Z=(0,P.useMemo)(()=>oe(K),[K]);ie(()=>{typeof document<`u`&&document.hidden||(V.reload({silent:!0}),G.reload({silent:!0}))},5e3),ie(()=>{typeof document<`u`&&document.hidden||H.reload({silent:!0})},2e4);let Q=(0,P.useCallback)(()=>{V.reload(),H.reload({silent:!0}),G.reload({silent:!0})},[V.reload,H.reload,G.reload]),$=(0,P.useCallback)(e=>{let t=new URLSearchParams(n);t.set(`id`,e),i(t,{replace:!0})},[n,i]),pe=(0,P.useCallback)(()=>{let e=new URLSearchParams(n);e.delete(`id`),i(e,{replace:!0})},[n,i]),me=(0,P.useCallback)(e=>{Object.prototype.hasOwnProperty.call(e,`toolInput`)&&S(e.toolInput),e.status!==void 0&&_(e.status),f(1),D([])},[]),he=(0,P.useCallback)((e,t)=>{f(e),t&&t!==p&&m(t)},[p]),ge=(0,P.useCallback)(e=>{S(U(e)),f(1),D([])},[]),_e=(0,P.useCallback)(t=>{ae({title:e(`mcpMonitor.deleteExecTitle`,null,`删除此执行记录`),content:`确定删除 ${U(t.toolName)||`该`} 的执行记录?此操作不可恢复。`,okText:e(`common.delete`,null,`删除`),onOk:async()=>{try{await x.del(`/monitor/execution/${encodeURIComponent(t.id)}`),D(e=>e.filter(e=>e!==t.id)),N(e(`mcpMonitor.execDeleted`,null,`执行记录已删除`)),Q()}catch(t){T(t,e(`mcpMonitor.deleteExecFailed`,null,`删除执行记录失败`))}}})},[Q,e]),ve=(0,P.useCallback)(async()=>{if(!E.length){ee(e(`mcpMonitor.selectExecFirst`,null,`请先选择要删除的执行记录`));return}let t=[];try{let e=await x.post(`/monitor/executions/names`,{ids:E});t=[...new Set(Object.values(e||{}).map(e=>U(e?.toolName)).filter(Boolean))]}catch{t=[]}let n=t.length?`涉及工具:${t.slice(0,3).join(`、`)}${t.length>3?` 等`:``}。`:``;ae({title:e(`mcpMonitor.batchDeleteConfirm`,{count:E.length},`确定删除选中的 ${E.length} 条执行记录?`),content:`${n}此操作不可恢复。`,okText:e(`common.delete`,null,`删除`),onOk:async()=>{try{await x.del(`/monitor/executions`,{body:{ids:E}}),N(`已删除 ${E.length} 条执行记录`),D([]),Q()}catch(t){T(t,e(`mcp.batchDeleteFailed`,null,`批量删除执行记录失败`))}}})},[Q,E,e]),ye=(0,P.useCallback)(e=>{M(e),I(``)},[]),be=(0,P.useCallback)(async()=>{if(j?.id){R(!0);try{await x.post(`/monitor/execution/${encodeURIComponent(j.id)}/cancel`,{note:F.trim()}),N(e(`mcpDetailModal.abortSuccess`,null,`已发送终止请求`)),M(null),Q()}catch(t){T(t,e(`mcpDetailModal.abortFailed`,null,`终止失败`))}finally{R(!1)}}},[F,j,Q,e]),xe=Y>0?e(`mcpMonitor.retentionHint`,{days:Y},`执行记录保留 ${Y} 天,失败与拦截调用单独标记。`):`统计全部 MCP 工具调用,失败与拦截调用单独标记。`;return(0,X.jsxs)(`div`,{className:`mcp-monitor-page`,children:[(0,X.jsx)(re,{title:e(`mcp.monitorTitle`,null,`MCP 状态监控`),description:xe,extra:(0,X.jsx)(o,{children:(0,X.jsx)(c,{icon:(0,X.jsx)(h,{}),onClick:Q,loading:V.loading||H.loading,children:e(`common.refresh`,null,`刷新`)})})}),(0,X.jsx)(se,{summary:q,loading:H.loading&&!q,avgMs:Z,avgSamples:le}),(0,X.jsx)(ue,{data:G.data,loading:G.loading,error:G.error,range:B,onRangeChange:e=>{e&&A(e)},onRetry:()=>G.reload()}),(0,X.jsx)(ce,{topTools:J,loading:H.loading&&!J.length,onFilterTool:ge,activeTool:C}),(0,X.jsx)(k,{title:e(`mcp.latestExecutions`,null,`最新执行记录`),description:e(`mcpMonitor.emptyHint`,null,`在对话或任务中调用 MCP 工具后,执行记录将显示在此处`),extra:E.length>0?(0,X.jsxs)(o,{spacing:8,children:[(0,X.jsx)(`span`,{className:`mcp-monitor-selected`,children:e(`mcp.selectedCount`,{count:E.length},`已选择 ${E.length} 项`)}),(0,X.jsx)(c,{size:`small`,disabled:!s,type:`danger`,onClick:ve,children:e(`mcp.deleteSelected`,null,`批量删除`)}),(0,X.jsx)(c,{size:`small`,theme:`borderless`,onClick:()=>D([]),children:e(`mcpMonitor.deselectAll`,null,`取消全选`)})]}):null,children:(0,X.jsx)(de,{data:V.data,loading:V.loading,error:V.error,page:d,pageSize:p,status:g,toolInput:v,selected:E,onQuery:me,onPageChange:he,onRefresh:()=>V.reload(),onOpenDetail:$,onCancel:ye,onDelete:_e,onSelectionChange:D,canWrite:a,canDelete:s})}),(0,X.jsx)(fe,{executionId:z,onClose:pe,canWrite:a,onCancelRequest:e=>{pe(),ye(e)}}),(0,X.jsxs)(u,{title:e(`mcpMonitor.terminateExecution`,null,`终止执行`),visible:!!j,confirmLoading:L,maskClosable:!L,okText:e(`mcpMonitor.terminateExecution`,null,`终止`),cancelText:e(`common.cancel`,null,`取消`),onCancel:()=>M(null),onOk:be,children:[(0,X.jsx)(`p`,{className:`mcp-monitor-cancel-hint`,children:e(`mcpDetailModal.abortHint`,null,`终止仅取消本次工具调用,不会停止整条对话;说明会与工具输出一起交给模型。`)}),(0,X.jsx)(l,{rows:4,value:F,placeholder:e(`mcpDetailModal.abortNotePlaceholder`,null,`终止说明(可选),例如:命令执行时间过长,先终止。`),onChange:e=>I(e)})]})]})}export{$ as default}; |