@winspan/claude-forge 3.7.2 → 3.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/daemon/handlers/post-tool-use-handler.d.ts.map +1 -1
- package/dist/daemon/handlers/post-tool-use-handler.js +16 -6
- package/dist/daemon/handlers/post-tool-use-handler.js.map +1 -1
- package/dist/goal/goal-decomposer.d.ts +5 -0
- package/dist/goal/goal-decomposer.d.ts.map +1 -1
- package/dist/goal/goal-decomposer.js +24 -1
- package/dist/goal/goal-decomposer.js.map +1 -1
- package/dist/pipeline/completion-detector.d.ts.map +1 -1
- package/dist/pipeline/completion-detector.js +6 -5
- package/dist/pipeline/completion-detector.js.map +1 -1
- package/dist/pipeline/completion-gate.d.ts +5 -0
- package/dist/pipeline/completion-gate.d.ts.map +1 -1
- package/dist/pipeline/completion-gate.js +50 -17
- package/dist/pipeline/completion-gate.js.map +1 -1
- package/dist/pipeline/completion-verifier.d.ts +9 -1
- package/dist/pipeline/completion-verifier.d.ts.map +1 -1
- package/dist/pipeline/completion-verifier.js +39 -9
- package/dist/pipeline/completion-verifier.js.map +1 -1
- package/dist/pipeline/dynamic-node-executor.d.ts.map +1 -1
- package/dist/pipeline/dynamic-node-executor.js +8 -3
- package/dist/pipeline/dynamic-node-executor.js.map +1 -1
- package/dist/pipeline/i-node-executor.d.ts +1 -1
- package/dist/pipeline/i-node-executor.d.ts.map +1 -1
- package/dist/pipeline/node-type-registry.d.ts.map +1 -1
- package/dist/pipeline/node-type-registry.js +44 -5
- package/dist/pipeline/node-type-registry.js.map +1 -1
- package/dist/web-static/assets/Config-CUb6-ddH.js +1 -0
- package/dist/web-static/assets/{index-CKQ07xt_.js → index-j5VaS74c.js} +2 -2
- package/dist/web-static/index.html +1 -1
- package/package.json +1 -1
- package/dist/web-static/assets/Config-CF9-kWg9.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-Dskgf0jG.js","assets/rolldown-runtime-COnpUsM8.js","assets/vendor-react-DJI9oneq.js","assets/vendor-DRGPi8ui.js","assets/vendor-charts-9eVsQvUV.js","assets/vendor-query-DqPOMnuX.js","assets/vendor-flow-srkes8If.js","assets/vendor-flow-CHpVij2M.css","assets/vendor-motion-CQmdgnI8.js","assets/client-BvVpIixG.js","assets/ConfirmDialog-BKfwMp04.js","assets/ui-CDL3BZ13.js","assets/Sessions-C0BmdDPK.js","assets/BatchProgress-BQ533tSf.js","assets/ErrorState-BOInXmfg.js","assets/Skeleton-B7PVDJJ_.js","assets/exportCsv-Dm5Y5M_E.js","assets/SessionDetail-BMrqH8_W.js","assets/Breadcrumb-DtfwnOx6.js","assets/Events-CAY9kU9T.js","assets/useDebounce-DNfPs3Tv.js","assets/Pipelines-Drat9IqZ.js","assets/Pagination-lp8b_3NR.js","assets/PipelineDetail-Bc6l2jqX.js","assets/Toast-BbB3oD2a.js","assets/Quality-Bm7oRSun.js","assets/Config-
|
|
2
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{$n as t,$t as n,Bt as r,Dn as i,En as a,Ft as o,Mn as s,Qt as c,Un as l,Vt as u,_n as d,ar as f,cr as p,en as ee,gr as m,ir as h,kn as g,mn as _,or as v,pr as y,rn as b,rr as x,un as S,xn as C}from"./vendor-DRGPi8ui.js";import{a as w,c as T,d as E,i as D,o as O,r as k,s as A,t as j,u as M}from"./vendor-react-DJI9oneq.js";import{a as N,i as P,o as F,r as I}from"./vendor-query-DqPOMnuX.js";import{c as te}from"./vendor-flow-srkes8If.js";import{Dt as L,Yt as R,et as z,ht as B,wt as V}from"./client-BvVpIixG.js";import{a as H,n as U}from"./ui-CDL3BZ13.js";import{n as W,t as G}from"./vendor-motion-CQmdgnI8.js";import{t as K}from"./useDebounce-DNfPs3Tv.js";import{t as q}from"./Toast-BbB3oD2a.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var J=e(E(),1),Y=e(m(),1),X=te(),Z=[{path:`/dashboard`,label:`仪表盘`,icon:C},{path:`/projects`,label:`项目管理`,icon:g},{path:`/sessions`,label:`会话管理`,icon:y},{path:`/events`,label:`事件流`,icon:h},{path:`/pipelines`,label:`流水线`,icon:i},{path:`/quality`,label:`质量门禁`,icon:c},{path:`/knowledge`,label:`知识图谱`,icon:f},{path:`/skills`,label:`技能管理`,icon:S},{path:`/conventions`,label:`规范管理`,icon:p},{path:`/node-types`,label:`节点类型`,icon:v},{path:`/pipeline-templates`,label:`模板管理`,icon:s},{path:`/templates`,label:`执行模板`,icon:i},{path:`/evolution`,label:`模板进化`,icon:u},{path:`/analytics`,label:`数据分析`,icon:x},{path:`/config`,label:`系统配置`,icon:n}];function Q({children:e}){let[n,r]=(0,Y.useState)(()=>localStorage.getItem(`sidebar-collapsed`)===`true`),i=A();(0,Y.useEffect)(()=>{localStorage.setItem(`sidebar-collapsed`,String(n))},[n]);let{data:a}=I({queryKey:[`health`],queryFn:()=>z().then(e=>e.data)}),s=Z.find(e=>i.pathname.startsWith(e.path));return(0,X.jsxs)(`div`,{className:`flex min-h-screen bg-gray-50`,children:[(0,X.jsxs)(`aside`,{className:H(`fixed top-0 left-0 bottom-0 z-50 flex flex-col transition-all duration-300`,`bg-gradient-to-b from-slate-900 to-slate-800`,n?`w-16`:`w-60`),children:[(0,X.jsxs)(`div`,{className:H(`flex items-center border-b border-white/10 h-16`,n?`justify-center px-2`:`justify-between px-5`),children:[!n&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,X.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-gradient-to-br from-blue-500 to-purple-600`,children:(0,X.jsx)(o,{className:`h-5 w-5 text-white`})}),(0,X.jsx)(`span`,{className:`text-white font-bold text-lg tracking-tight`,children:`Forge`})]}),(0,X.jsx)(`button`,{onClick:()=>r(!n),className:`p-1.5 rounded-lg text-white/60 hover:text-white hover:bg-white/10 transition-colors`,children:n?(0,X.jsx)(_,{className:`h-5 w-5`}):(0,X.jsx)(t,{className:`h-5 w-5`})})]}),(0,X.jsx)(`nav`,{className:`flex-1 py-4 space-y-1 px-2`,children:Z.map(e=>(0,X.jsxs)(k,{to:e.path,className:({isActive:e})=>H(`flex items-center gap-3 rounded-lg transition-all duration-200`,n?`justify-center p-3`:`px-3 py-2.5`,e?`bg-blue-600/20 text-blue-400`:`text-white/60 hover:text-white hover:bg-white/5`),children:[(0,X.jsx)(e.icon,{className:`h-5 w-5 flex-shrink-0`}),!n&&(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:e.label})]},e.path))}),(0,X.jsx)(`div`,{className:H(`border-t border-white/10 py-4`,n?`px-2`:`px-5`),children:(0,X.jsxs)(`div`,{className:H(`flex items-center gap-2`,n?`justify-center`:``),children:[(0,X.jsx)(`div`,{className:H(`w-2 h-2 rounded-full`,a?.status===`ok`?`bg-green-400 animate-pulse`:`bg-red-400`)}),!n&&(0,X.jsx)(`span`,{className:`text-xs text-white/40`,children:a?.status===`ok`?`Daemon 运行中`:`连接断开`})]})})]}),(0,X.jsxs)(`main`,{className:H(`flex-1 transition-all duration-300`,n?`ml-16`:`ml-60`),children:[(0,X.jsxs)(`header`,{className:`sticky top-0 z-40 bg-white/80 backdrop-blur-md border-b border-gray-200/50 h-16 flex items-center justify-between px-8`,children:[(0,X.jsx)(`h1`,{className:`text-xl font-semibold text-gray-900`,children:s?.label||`Claude Forge`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,X.jsxs)(`button`,{className:`hidden sm:flex items-center gap-2 px-3 py-1.5 text-sm text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors`,onClick:()=>{let e=new KeyboardEvent(`keydown`,{key:`k`,metaKey:!0});window.dispatchEvent(e)},children:[(0,X.jsx)(l,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:`命令面板`}),(0,X.jsx)(`kbd`,{className:`px-2 py-0.5 text-xs bg-gray-100 rounded border border-gray-200`,children:`⌘K`})]}),(0,X.jsxs)(`span`,{className:`text-sm text-gray-500`,children:[`v`,`3.7.2`]}),(0,X.jsxs)(`div`,{className:H(`flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-semibold`,a?.status===`ok`?`bg-green-50 text-green-700 border border-green-200`:`bg-red-50 text-red-700 border border-red-200`),children:[(0,X.jsx)(`div`,{className:H(`w-1.5 h-1.5 rounded-full`,a?.status===`ok`?`bg-green-500`:`bg-red-500`)}),a?.status===`ok`?`在线`:`离线`]})]})]}),(0,X.jsx)(`div`,{className:`p-8 overflow-x-hidden`,children:e})]})]})}var ne=e=>[{id:`nav-dashboard`,label:`仪表盘`,description:`查看效率指标和趋势`,icon:C,action:()=>e(`/dashboard`),category:`导航`},{id:`nav-sessions`,label:`会话管理`,description:`查看和管理会话`,icon:y,action:()=>e(`/sessions`),category:`导航`},{id:`nav-events`,label:`事件流`,description:`查看实时事件`,icon:h,action:()=>e(`/events`),category:`导航`},{id:`nav-pipelines`,label:`流水线`,description:`查看编排流水线`,icon:i,action:()=>e(`/pipelines`),category:`导航`},{id:`nav-quality`,label:`质量门禁`,description:`查看质量问题`,icon:c,action:()=>e(`/quality`),category:`导航`},{id:`nav-knowledge`,label:`知识图谱`,description:`浏览知识节点`,icon:f,action:()=>e(`/knowledge`),category:`导航`},{id:`nav-analytics`,label:`数据分析`,description:`查看统计报表`,icon:x,action:()=>e(`/analytics`),category:`导航`},{id:`nav-config`,label:`系统配置`,description:`管理配置项`,icon:n,action:()=>e(`/config`),category:`导航`}];function re(){let[e,t]=(0,Y.useState)(!1),[n,r]=(0,Y.useState)(``),[i,s]=(0,Y.useState)(0),c=(0,Y.useRef)(null),u=T(),p=K(n,300),m=p.trim().length>=2,{data:h,isFetching:g}=I({queryKey:[`cmd-pipelines`,p],queryFn:()=>B({search:p,page_size:5}).then(e=>e.data),enabled:m&&e,staleTime:1e4}),{data:_,isFetching:v}=I({queryKey:[`cmd-sessions`,p],queryFn:()=>V({limit:5}).then(e=>e.data),enabled:m&&e,staleTime:1e4}),{data:b,isFetching:x}=I({queryKey:[`cmd-knowledge`,p],queryFn:()=>R(p,void 0,void 0,5).then(e=>e.data),enabled:m&&e,staleTime:1e4}),{data:S,isFetching:C}=I({queryKey:[`cmd-skills`,p],queryFn:()=>L({limit:5}).then(e=>e.data),enabled:m&&e,staleTime:1e4}),w=g||v||x||C,E=[];if(m){let e=p.toLowerCase();(h?.items||[]).forEach(t=>{let n=String(t.requirement||``);(n.toLowerCase().includes(e)||!e)&&E.push({id:`pipeline-${t.id}`,label:n.slice(0,60)||String(t.id),description:`流水线 · ${t.project||``}`,icon:a,action:()=>u(`/pipelines/${t.id}`),category:`流水线`})}),(_?.items||[]).filter(t=>String(t.title||t.id||``).toLowerCase().includes(e)).forEach(e=>{E.push({id:`session-${e.id}`,label:String(e.title||e.id||``).slice(0,60),description:`会话 · ${String(e.project_path||``).split(`/`).pop()||``}`,icon:y,action:()=>u(`/sessions/${e.id}`),category:`会话`})}),(b?.items||[]).forEach(e=>{E.push({id:`knowledge-${e.id}`,label:String(e.title||``).slice(0,60),description:`知识节点 · ${e.node_type||``}`,icon:f,action:()=>u(`/knowledge`),category:`知识图谱`})}),(S?.items||[]).filter(t=>String(t.name||``).toLowerCase().includes(e)).forEach(e=>{E.push({id:`skill-${e.name}`,label:String(e.name||``).slice(0,60),description:`技能 · ${e.description?String(e.description).slice(0,40):``}`,icon:o,action:()=>u(`/skills`),category:`技能`})})}let D=ne(u),O=n?D.filter(e=>e.label.toLowerCase().includes(n.toLowerCase())||(e.description||``).toLowerCase().includes(n.toLowerCase())):D,k=m?[...E,...O]:O;(0,Y.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`k`&&(e.preventDefault(),t(e=>!e),r(``),s(0)),e.key===`Escape`&&t(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,Y.useEffect)(()=>{e&&setTimeout(()=>c.current?.focus(),100)},[e]),(0,Y.useEffect)(()=>{s(0)},[p]);let A=e=>{e.key===`ArrowDown`?(e.preventDefault(),s(e=>Math.min(e+1,k.length-1))):e.key===`ArrowUp`?(e.preventDefault(),s(e=>Math.max(e-1,0))):e.key===`Enter`&&k[i]&&(k[i].action(),t(!1))},j=Array.from(new Set(k.map(e=>e.category)));return(0,X.jsx)(W,{children:e&&(0,X.jsx)(G.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`fixed inset-0 z-[200] bg-black/50 backdrop-blur-sm flex items-start justify-center pt-[20vh]`,onClick:()=>t(!1),children:(0,X.jsxs)(G.div,{initial:{scale:.95,opacity:0,y:-20},animate:{scale:1,opacity:1,y:0},exit:{scale:.95,opacity:0,y:-20},transition:{duration:.15},className:`bg-white rounded-xl shadow-2xl w-full max-w-lg overflow-hidden border border-gray-200`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 border-b border-gray-100`,children:[w?(0,X.jsx)(d,{className:`h-5 w-5 text-blue-400 flex-shrink-0 animate-spin`}):(0,X.jsx)(ee,{className:`h-5 w-5 text-gray-400 flex-shrink-0`}),(0,X.jsx)(`input`,{ref:c,type:`text`,placeholder:`输入命令或搜索(≥2字符跨模块搜索)...`,value:n,onChange:e=>{r(e.target.value),s(0)},onKeyDown:A,className:`flex-1 text-sm outline-none placeholder:text-gray-400`}),(0,X.jsx)(`kbd`,{className:`hidden sm:inline-flex items-center gap-1 px-2 py-0.5 text-xs text-gray-400 bg-gray-100 rounded`,children:`ESC`})]}),(0,X.jsx)(`div`,{className:`max-h-80 overflow-y-auto py-2`,children:k.length===0&&!w?(0,X.jsx)(`div`,{className:`px-4 py-8 text-center text-sm text-gray-400`,children:m?`没有找到相关内容`:`没有匹配的命令`}):j.map(e=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`px-4 py-1.5 text-xs font-semibold text-gray-400 uppercase tracking-wider`,children:e}),k.filter(t=>t.category===e).map(e=>{let n=k.indexOf(e);return(0,X.jsxs)(`button`,{className:H(`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors`,n===i?`bg-blue-50 text-blue-700`:`text-gray-700 hover:bg-gray-50`),onClick:()=>{e.action(),t(!1)},onMouseEnter:()=>s(n),children:[(0,X.jsx)(e.icon,{className:`h-4 w-4 flex-shrink-0`}),(0,X.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,X.jsx)(`div`,{className:`text-sm font-medium truncate`,children:e.label}),e.description&&(0,X.jsx)(`div`,{className:`text-xs text-gray-400 truncate`,children:e.description})]})]},e.id)})]},e))}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-t border-gray-100 text-xs text-gray-400`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(`kbd`,{className:`px-1.5 py-0.5 bg-gray-100 rounded`,children:`↑↓`}),`导航`]}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(`kbd`,{className:`px-1.5 py-0.5 bg-gray-100 rounded`,children:`↵`}),`执行`]})]}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(l,{className:`h-3 w-3`}),`K 打开`]})]})]})})})}var $=class extends Y.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught:`,e,t)}render(){return this.state.hasError?(0,X.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-50 px-4`,children:(0,X.jsxs)(`div`,{className:`max-w-md w-full bg-white rounded-xl shadow-lg p-8 text-center`,children:[(0,X.jsx)(r,{className:`h-16 w-16 text-red-500 mx-auto mb-4`}),(0,X.jsx)(`h1`,{className:`text-2xl font-bold text-gray-900 mb-2`,children:`出错了`}),(0,X.jsx)(`p`,{className:`text-gray-600 mb-6`,children:`页面加载时遇到错误,请刷新页面重试`}),this.state.error&&(0,X.jsxs)(`details`,{className:`text-left mb-6 p-4 bg-gray-50 rounded-lg`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-gray-700 mb-2`,children:`错误详情`}),(0,X.jsx)(`pre`,{className:`text-xs text-red-600 overflow-auto`,children:this.state.error.toString()})]}),(0,X.jsx)(U,{variant:`primary`,icon:b,onClick:()=>window.location.reload(),children:`刷新页面`})]})}):this.props.children}},ie=3e3;function ae(){let e=window.__AUTH_TOKEN__;return e?`/api/events/stream?token=${encodeURIComponent(e)}`:`/api/events/stream`}function oe(){let e=N(),t=(0,Y.useRef)(null),n=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let r=!1;function i(){if(r)return;let a=new EventSource(ae());t.current=a;let o=t=>{for(let n of t)e.invalidateQueries({queryKey:n})};a.addEventListener(`pipeline:status`,()=>{o([[`pipelines-active`],[`pipelines`,`active`],[`pipelines`],[`overview`],[`plan`,`by-project`]])}),a.addEventListener(`pipeline:node`,()=>{o([[`pipelines-active`],[`pipelines`,`active`],[`pipelines`],[`pipeline`]])}),a.addEventListener(`quality:issue`,()=>{o([[`quality-history`],[`quality-unresolved`],[`overview`]])}),a.addEventListener(`session:event`,()=>{o([[`events-live`],[`sessions`],[`overview`]])}),a.addEventListener(`session:status`,()=>{o([[`sessions`],[`overview`]])}),a.addEventListener(`daemon:status`,()=>{o([[`daemon-status`],[`health`]])}),a.onerror=()=>{a.close(),t.current=null,r||(n.current=setTimeout(i,ie))}}return i(),()=>{r=!0,n.current&&clearTimeout(n.current),t.current?.close(),t.current=null}},[e])}var se=(0,Y.lazy)(()=>M(()=>import(`./Dashboard-Dskgf0jG.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),ce=(0,Y.lazy)(()=>M(()=>import(`./Sessions-C0BmdDPK.js`),__vite__mapDeps([12,1,2,3,4,5,6,7,9,13,10,11,8,14,15,16]))),le=(0,Y.lazy)(()=>M(()=>import(`./SessionDetail-BMrqH8_W.js`),__vite__mapDeps([17,1,2,3,4,5,6,7,8,9,18,11]))),ue=(0,Y.lazy)(()=>M(()=>import(`./Events-CAY9kU9T.js`),__vite__mapDeps([19,1,3,5,6,4,7,8,9,10,11,14,20,16]))),de=(0,Y.lazy)(()=>M(()=>import(`./Pipelines-Drat9IqZ.js`),__vite__mapDeps([21,1,2,3,4,5,6,7,8,9,13,10,11,14,22,15,20,16]))),fe=(0,Y.lazy)(()=>M(()=>import(`./PipelineDetail-Bc6l2jqX.js`),__vite__mapDeps([23,1,2,3,4,5,6,7,8,9,18,10,11,24]))),pe=(0,Y.lazy)(()=>M(()=>import(`./Quality-Bm7oRSun.js`),__vite__mapDeps([25,1,3,5,6,4,7,8,9,10,11,14,22,24,20,16]))),me=(0,Y.lazy)(()=>M(()=>import(`./Config-CF9-kWg9.js`),__vite__mapDeps([26,1,3,5,6,4,7,8,9,10,11,24]))),he=(0,Y.lazy)(()=>M(()=>import(`./Analytics-txva5ugO.js`),__vite__mapDeps([27,1,3,5,6,4,7,9,14,11,8,16]))),ge=(0,Y.lazy)(()=>M(()=>import(`./Knowledge-BHLyFp2U.js`),__vite__mapDeps([28,1,3,5,6,4,7,8,9,10,11,22,24,16]))),_e=(0,Y.lazy)(()=>M(()=>import(`./Projects-qDolX6Y6.js`),__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,22,11,24,16]))),ve=(0,Y.lazy)(()=>M(()=>import(`./ProjectDetail-Cx8VZp8O.js`),__vite__mapDeps([30,1,2,3,4,5,6,7,9,18,22,11,8,24]))),ye=(0,Y.lazy)(()=>M(()=>import(`./Skills-B3c1_uFt.js`),__vite__mapDeps([31,1,3,5,6,4,7,9,10,11,8,24]))),be=(0,Y.lazy)(()=>M(()=>import(`./Conventions-E_2yAYoB.js`),__vite__mapDeps([32,1,33,3,5,6,4,7,9,10,11,8,24]))),xe=(0,Y.lazy)(()=>M(()=>import(`./NodeTypes-B6wc7VnR.js`),__vite__mapDeps([34,1,3,5,6,4,7,9]))),Se=(0,Y.lazy)(()=>M(()=>import(`./PipelineTemplates-sSL-9oRh.js`),__vite__mapDeps([35,1,3,5,6,4,7,9,24]))),Ce=(0,Y.lazy)(()=>M(()=>import(`./Templates-Dho__f4l.js`),__vite__mapDeps([36,1,2,3,4,5,6,7,8,9,14,11,15]))),we=(0,Y.lazy)(()=>M(()=>import(`./TemplateDetail-ep5h3Cu5.js`),__vite__mapDeps([37,1,2,3,4,5,6,7,8,9,10,11,14,15]))),Te=(0,Y.lazy)(()=>M(()=>import(`./Evolution-Ck_BqRpt.js`),__vite__mapDeps([38,2,1,3,4,5,6,7,8,9,15,11])));function Ee(){return oe(),(0,X.jsx)($,{children:(0,X.jsxs)(q,{children:[(0,X.jsx)(re,{}),(0,X.jsx)(Q,{children:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`div`,{className:`flex items-center justify-center h-full text-gray-400`,children:`加载中...`}),children:(0,X.jsxs)(O,{children:[(0,X.jsx)(w,{path:`/`,element:(0,X.jsx)(D,{to:`/dashboard`,replace:!0})}),(0,X.jsx)(w,{path:`/dashboard`,element:(0,X.jsx)(se,{})}),(0,X.jsx)(w,{path:`/sessions`,element:(0,X.jsx)(ce,{})}),(0,X.jsx)(w,{path:`/sessions/:id`,element:(0,X.jsx)(le,{})}),(0,X.jsx)(w,{path:`/events`,element:(0,X.jsx)(ue,{})}),(0,X.jsx)(w,{path:`/pipelines`,element:(0,X.jsx)(de,{})}),(0,X.jsx)(w,{path:`/pipelines/:id`,element:(0,X.jsx)(fe,{})}),(0,X.jsx)(w,{path:`/projects`,element:(0,X.jsx)(_e,{})}),(0,X.jsx)(w,{path:`/projects/:encodedPath`,element:(0,X.jsx)(ve,{})}),(0,X.jsx)(w,{path:`/quality`,element:(0,X.jsx)(pe,{})}),(0,X.jsx)(w,{path:`/analytics`,element:(0,X.jsx)(he,{})}),(0,X.jsx)(w,{path:`/knowledge`,element:(0,X.jsx)(ge,{})}),(0,X.jsx)(w,{path:`/skills`,element:(0,X.jsx)(ye,{})}),(0,X.jsx)(w,{path:`/conventions`,element:(0,X.jsx)(be,{})}),(0,X.jsx)(w,{path:`/node-types`,element:(0,X.jsx)(xe,{})}),(0,X.jsx)(w,{path:`/pipeline-templates`,element:(0,X.jsx)(Se,{})}),(0,X.jsx)(w,{path:`/templates`,element:(0,X.jsx)(Ce,{})}),(0,X.jsx)(w,{path:`/templates/:id`,element:(0,X.jsx)(we,{})}),(0,X.jsx)(w,{path:`/evolution`,element:(0,X.jsx)(Te,{})}),(0,X.jsx)(w,{path:`/config`,element:(0,X.jsx)(me,{})})]})})})]})})}var De=new F({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:3e4}}});J.createRoot(document.getElementById(`root`)).render((0,X.jsx)(Y.StrictMode,{children:(0,X.jsx)(P,{client:De,children:(0,X.jsx)(j,{children:(0,X.jsx)(Ee,{})})})}));
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-Dskgf0jG.js","assets/rolldown-runtime-COnpUsM8.js","assets/vendor-react-DJI9oneq.js","assets/vendor-DRGPi8ui.js","assets/vendor-charts-9eVsQvUV.js","assets/vendor-query-DqPOMnuX.js","assets/vendor-flow-srkes8If.js","assets/vendor-flow-CHpVij2M.css","assets/vendor-motion-CQmdgnI8.js","assets/client-BvVpIixG.js","assets/ConfirmDialog-BKfwMp04.js","assets/ui-CDL3BZ13.js","assets/Sessions-C0BmdDPK.js","assets/BatchProgress-BQ533tSf.js","assets/ErrorState-BOInXmfg.js","assets/Skeleton-B7PVDJJ_.js","assets/exportCsv-Dm5Y5M_E.js","assets/SessionDetail-BMrqH8_W.js","assets/Breadcrumb-DtfwnOx6.js","assets/Events-CAY9kU9T.js","assets/useDebounce-DNfPs3Tv.js","assets/Pipelines-Drat9IqZ.js","assets/Pagination-lp8b_3NR.js","assets/PipelineDetail-Bc6l2jqX.js","assets/Toast-BbB3oD2a.js","assets/Quality-Bm7oRSun.js","assets/Config-CUb6-ddH.js","assets/Analytics-txva5ugO.js","assets/Knowledge-BHLyFp2U.js","assets/Projects-qDolX6Y6.js","assets/ProjectDetail-Cx8VZp8O.js","assets/Skills-B3c1_uFt.js","assets/Conventions-E_2yAYoB.js","assets/vendor-editor-CYLOGES5.js","assets/NodeTypes-B6wc7VnR.js","assets/PipelineTemplates-sSL-9oRh.js","assets/Templates-Dho__f4l.js","assets/TemplateDetail-ep5h3Cu5.js","assets/Evolution-Ck_BqRpt.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{$n as t,$t as n,Bt as r,Dn as i,En as a,Ft as o,Mn as s,Qt as c,Un as l,Vt as u,_n as d,ar as f,cr as p,en as ee,gr as m,ir as h,kn as g,mn as _,or as v,pr as y,rn as b,rr as x,un as S,xn as C}from"./vendor-DRGPi8ui.js";import{a as w,c as T,d as E,i as D,o as O,r as k,s as A,t as j,u as M}from"./vendor-react-DJI9oneq.js";import{a as N,i as P,o as F,r as I}from"./vendor-query-DqPOMnuX.js";import{c as te}from"./vendor-flow-srkes8If.js";import{Dt as L,Yt as R,et as z,ht as B,wt as V}from"./client-BvVpIixG.js";import{a as H,n as U}from"./ui-CDL3BZ13.js";import{n as W,t as G}from"./vendor-motion-CQmdgnI8.js";import{t as K}from"./useDebounce-DNfPs3Tv.js";import{t as q}from"./Toast-BbB3oD2a.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var J=e(E(),1),Y=e(m(),1),X=te(),Z=[{path:`/dashboard`,label:`仪表盘`,icon:C},{path:`/projects`,label:`项目管理`,icon:g},{path:`/sessions`,label:`会话管理`,icon:y},{path:`/events`,label:`事件流`,icon:h},{path:`/pipelines`,label:`流水线`,icon:i},{path:`/quality`,label:`质量门禁`,icon:c},{path:`/knowledge`,label:`知识图谱`,icon:f},{path:`/skills`,label:`技能管理`,icon:S},{path:`/conventions`,label:`规范管理`,icon:p},{path:`/node-types`,label:`节点类型`,icon:v},{path:`/pipeline-templates`,label:`模板管理`,icon:s},{path:`/templates`,label:`执行模板`,icon:i},{path:`/evolution`,label:`模板进化`,icon:u},{path:`/analytics`,label:`数据分析`,icon:x},{path:`/config`,label:`系统配置`,icon:n}];function Q({children:e}){let[n,r]=(0,Y.useState)(()=>localStorage.getItem(`sidebar-collapsed`)===`true`),i=A();(0,Y.useEffect)(()=>{localStorage.setItem(`sidebar-collapsed`,String(n))},[n]);let{data:a}=I({queryKey:[`health`],queryFn:()=>z().then(e=>e.data)}),s=Z.find(e=>i.pathname.startsWith(e.path));return(0,X.jsxs)(`div`,{className:`flex min-h-screen bg-gray-50`,children:[(0,X.jsxs)(`aside`,{className:H(`fixed top-0 left-0 bottom-0 z-50 flex flex-col transition-all duration-300`,`bg-gradient-to-b from-slate-900 to-slate-800`,n?`w-16`:`w-60`),children:[(0,X.jsxs)(`div`,{className:H(`flex items-center border-b border-white/10 h-16`,n?`justify-center px-2`:`justify-between px-5`),children:[!n&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,X.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-gradient-to-br from-blue-500 to-purple-600`,children:(0,X.jsx)(o,{className:`h-5 w-5 text-white`})}),(0,X.jsx)(`span`,{className:`text-white font-bold text-lg tracking-tight`,children:`Forge`})]}),(0,X.jsx)(`button`,{onClick:()=>r(!n),className:`p-1.5 rounded-lg text-white/60 hover:text-white hover:bg-white/10 transition-colors`,children:n?(0,X.jsx)(_,{className:`h-5 w-5`}):(0,X.jsx)(t,{className:`h-5 w-5`})})]}),(0,X.jsx)(`nav`,{className:`flex-1 py-4 space-y-1 px-2`,children:Z.map(e=>(0,X.jsxs)(k,{to:e.path,className:({isActive:e})=>H(`flex items-center gap-3 rounded-lg transition-all duration-200`,n?`justify-center p-3`:`px-3 py-2.5`,e?`bg-blue-600/20 text-blue-400`:`text-white/60 hover:text-white hover:bg-white/5`),children:[(0,X.jsx)(e.icon,{className:`h-5 w-5 flex-shrink-0`}),!n&&(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:e.label})]},e.path))}),(0,X.jsx)(`div`,{className:H(`border-t border-white/10 py-4`,n?`px-2`:`px-5`),children:(0,X.jsxs)(`div`,{className:H(`flex items-center gap-2`,n?`justify-center`:``),children:[(0,X.jsx)(`div`,{className:H(`w-2 h-2 rounded-full`,a?.status===`ok`?`bg-green-400 animate-pulse`:`bg-red-400`)}),!n&&(0,X.jsx)(`span`,{className:`text-xs text-white/40`,children:a?.status===`ok`?`Daemon 运行中`:`连接断开`})]})})]}),(0,X.jsxs)(`main`,{className:H(`flex-1 transition-all duration-300`,n?`ml-16`:`ml-60`),children:[(0,X.jsxs)(`header`,{className:`sticky top-0 z-40 bg-white/80 backdrop-blur-md border-b border-gray-200/50 h-16 flex items-center justify-between px-8`,children:[(0,X.jsx)(`h1`,{className:`text-xl font-semibold text-gray-900`,children:s?.label||`Claude Forge`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,X.jsxs)(`button`,{className:`hidden sm:flex items-center gap-2 px-3 py-1.5 text-sm text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors`,onClick:()=>{let e=new KeyboardEvent(`keydown`,{key:`k`,metaKey:!0});window.dispatchEvent(e)},children:[(0,X.jsx)(l,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:`命令面板`}),(0,X.jsx)(`kbd`,{className:`px-2 py-0.5 text-xs bg-gray-100 rounded border border-gray-200`,children:`⌘K`})]}),(0,X.jsxs)(`span`,{className:`text-sm text-gray-500`,children:[`v`,`3.7.5`]}),(0,X.jsxs)(`div`,{className:H(`flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-semibold`,a?.status===`ok`?`bg-green-50 text-green-700 border border-green-200`:`bg-red-50 text-red-700 border border-red-200`),children:[(0,X.jsx)(`div`,{className:H(`w-1.5 h-1.5 rounded-full`,a?.status===`ok`?`bg-green-500`:`bg-red-500`)}),a?.status===`ok`?`在线`:`离线`]})]})]}),(0,X.jsx)(`div`,{className:`p-8 overflow-x-hidden`,children:e})]})]})}var ne=e=>[{id:`nav-dashboard`,label:`仪表盘`,description:`查看效率指标和趋势`,icon:C,action:()=>e(`/dashboard`),category:`导航`},{id:`nav-sessions`,label:`会话管理`,description:`查看和管理会话`,icon:y,action:()=>e(`/sessions`),category:`导航`},{id:`nav-events`,label:`事件流`,description:`查看实时事件`,icon:h,action:()=>e(`/events`),category:`导航`},{id:`nav-pipelines`,label:`流水线`,description:`查看编排流水线`,icon:i,action:()=>e(`/pipelines`),category:`导航`},{id:`nav-quality`,label:`质量门禁`,description:`查看质量问题`,icon:c,action:()=>e(`/quality`),category:`导航`},{id:`nav-knowledge`,label:`知识图谱`,description:`浏览知识节点`,icon:f,action:()=>e(`/knowledge`),category:`导航`},{id:`nav-analytics`,label:`数据分析`,description:`查看统计报表`,icon:x,action:()=>e(`/analytics`),category:`导航`},{id:`nav-config`,label:`系统配置`,description:`管理配置项`,icon:n,action:()=>e(`/config`),category:`导航`}];function re(){let[e,t]=(0,Y.useState)(!1),[n,r]=(0,Y.useState)(``),[i,s]=(0,Y.useState)(0),c=(0,Y.useRef)(null),u=T(),p=K(n,300),m=p.trim().length>=2,{data:h,isFetching:g}=I({queryKey:[`cmd-pipelines`,p],queryFn:()=>B({search:p,page_size:5}).then(e=>e.data),enabled:m&&e,staleTime:1e4}),{data:_,isFetching:v}=I({queryKey:[`cmd-sessions`,p],queryFn:()=>V({limit:5}).then(e=>e.data),enabled:m&&e,staleTime:1e4}),{data:b,isFetching:x}=I({queryKey:[`cmd-knowledge`,p],queryFn:()=>R(p,void 0,void 0,5).then(e=>e.data),enabled:m&&e,staleTime:1e4}),{data:S,isFetching:C}=I({queryKey:[`cmd-skills`,p],queryFn:()=>L({limit:5}).then(e=>e.data),enabled:m&&e,staleTime:1e4}),w=g||v||x||C,E=[];if(m){let e=p.toLowerCase();(h?.items||[]).forEach(t=>{let n=String(t.requirement||``);(n.toLowerCase().includes(e)||!e)&&E.push({id:`pipeline-${t.id}`,label:n.slice(0,60)||String(t.id),description:`流水线 · ${t.project||``}`,icon:a,action:()=>u(`/pipelines/${t.id}`),category:`流水线`})}),(_?.items||[]).filter(t=>String(t.title||t.id||``).toLowerCase().includes(e)).forEach(e=>{E.push({id:`session-${e.id}`,label:String(e.title||e.id||``).slice(0,60),description:`会话 · ${String(e.project_path||``).split(`/`).pop()||``}`,icon:y,action:()=>u(`/sessions/${e.id}`),category:`会话`})}),(b?.items||[]).forEach(e=>{E.push({id:`knowledge-${e.id}`,label:String(e.title||``).slice(0,60),description:`知识节点 · ${e.node_type||``}`,icon:f,action:()=>u(`/knowledge`),category:`知识图谱`})}),(S?.items||[]).filter(t=>String(t.name||``).toLowerCase().includes(e)).forEach(e=>{E.push({id:`skill-${e.name}`,label:String(e.name||``).slice(0,60),description:`技能 · ${e.description?String(e.description).slice(0,40):``}`,icon:o,action:()=>u(`/skills`),category:`技能`})})}let D=ne(u),O=n?D.filter(e=>e.label.toLowerCase().includes(n.toLowerCase())||(e.description||``).toLowerCase().includes(n.toLowerCase())):D,k=m?[...E,...O]:O;(0,Y.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`k`&&(e.preventDefault(),t(e=>!e),r(``),s(0)),e.key===`Escape`&&t(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,Y.useEffect)(()=>{e&&setTimeout(()=>c.current?.focus(),100)},[e]),(0,Y.useEffect)(()=>{s(0)},[p]);let A=e=>{e.key===`ArrowDown`?(e.preventDefault(),s(e=>Math.min(e+1,k.length-1))):e.key===`ArrowUp`?(e.preventDefault(),s(e=>Math.max(e-1,0))):e.key===`Enter`&&k[i]&&(k[i].action(),t(!1))},j=Array.from(new Set(k.map(e=>e.category)));return(0,X.jsx)(W,{children:e&&(0,X.jsx)(G.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`fixed inset-0 z-[200] bg-black/50 backdrop-blur-sm flex items-start justify-center pt-[20vh]`,onClick:()=>t(!1),children:(0,X.jsxs)(G.div,{initial:{scale:.95,opacity:0,y:-20},animate:{scale:1,opacity:1,y:0},exit:{scale:.95,opacity:0,y:-20},transition:{duration:.15},className:`bg-white rounded-xl shadow-2xl w-full max-w-lg overflow-hidden border border-gray-200`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 border-b border-gray-100`,children:[w?(0,X.jsx)(d,{className:`h-5 w-5 text-blue-400 flex-shrink-0 animate-spin`}):(0,X.jsx)(ee,{className:`h-5 w-5 text-gray-400 flex-shrink-0`}),(0,X.jsx)(`input`,{ref:c,type:`text`,placeholder:`输入命令或搜索(≥2字符跨模块搜索)...`,value:n,onChange:e=>{r(e.target.value),s(0)},onKeyDown:A,className:`flex-1 text-sm outline-none placeholder:text-gray-400`}),(0,X.jsx)(`kbd`,{className:`hidden sm:inline-flex items-center gap-1 px-2 py-0.5 text-xs text-gray-400 bg-gray-100 rounded`,children:`ESC`})]}),(0,X.jsx)(`div`,{className:`max-h-80 overflow-y-auto py-2`,children:k.length===0&&!w?(0,X.jsx)(`div`,{className:`px-4 py-8 text-center text-sm text-gray-400`,children:m?`没有找到相关内容`:`没有匹配的命令`}):j.map(e=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`px-4 py-1.5 text-xs font-semibold text-gray-400 uppercase tracking-wider`,children:e}),k.filter(t=>t.category===e).map(e=>{let n=k.indexOf(e);return(0,X.jsxs)(`button`,{className:H(`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors`,n===i?`bg-blue-50 text-blue-700`:`text-gray-700 hover:bg-gray-50`),onClick:()=>{e.action(),t(!1)},onMouseEnter:()=>s(n),children:[(0,X.jsx)(e.icon,{className:`h-4 w-4 flex-shrink-0`}),(0,X.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,X.jsx)(`div`,{className:`text-sm font-medium truncate`,children:e.label}),e.description&&(0,X.jsx)(`div`,{className:`text-xs text-gray-400 truncate`,children:e.description})]})]},e.id)})]},e))}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-t border-gray-100 text-xs text-gray-400`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(`kbd`,{className:`px-1.5 py-0.5 bg-gray-100 rounded`,children:`↑↓`}),`导航`]}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(`kbd`,{className:`px-1.5 py-0.5 bg-gray-100 rounded`,children:`↵`}),`执行`]})]}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(l,{className:`h-3 w-3`}),`K 打开`]})]})]})})})}var $=class extends Y.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught:`,e,t)}render(){return this.state.hasError?(0,X.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-50 px-4`,children:(0,X.jsxs)(`div`,{className:`max-w-md w-full bg-white rounded-xl shadow-lg p-8 text-center`,children:[(0,X.jsx)(r,{className:`h-16 w-16 text-red-500 mx-auto mb-4`}),(0,X.jsx)(`h1`,{className:`text-2xl font-bold text-gray-900 mb-2`,children:`出错了`}),(0,X.jsx)(`p`,{className:`text-gray-600 mb-6`,children:`页面加载时遇到错误,请刷新页面重试`}),this.state.error&&(0,X.jsxs)(`details`,{className:`text-left mb-6 p-4 bg-gray-50 rounded-lg`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-gray-700 mb-2`,children:`错误详情`}),(0,X.jsx)(`pre`,{className:`text-xs text-red-600 overflow-auto`,children:this.state.error.toString()})]}),(0,X.jsx)(U,{variant:`primary`,icon:b,onClick:()=>window.location.reload(),children:`刷新页面`})]})}):this.props.children}},ie=3e3;function ae(){let e=window.__AUTH_TOKEN__;return e?`/api/events/stream?token=${encodeURIComponent(e)}`:`/api/events/stream`}function oe(){let e=N(),t=(0,Y.useRef)(null),n=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let r=!1;function i(){if(r)return;let a=new EventSource(ae());t.current=a;let o=t=>{for(let n of t)e.invalidateQueries({queryKey:n})};a.addEventListener(`pipeline:status`,()=>{o([[`pipelines-active`],[`pipelines`,`active`],[`pipelines`],[`overview`],[`plan`,`by-project`]])}),a.addEventListener(`pipeline:node`,()=>{o([[`pipelines-active`],[`pipelines`,`active`],[`pipelines`],[`pipeline`]])}),a.addEventListener(`quality:issue`,()=>{o([[`quality-history`],[`quality-unresolved`],[`overview`]])}),a.addEventListener(`session:event`,()=>{o([[`events-live`],[`sessions`],[`overview`]])}),a.addEventListener(`session:status`,()=>{o([[`sessions`],[`overview`]])}),a.addEventListener(`daemon:status`,()=>{o([[`daemon-status`],[`health`]])}),a.onerror=()=>{a.close(),t.current=null,r||(n.current=setTimeout(i,ie))}}return i(),()=>{r=!0,n.current&&clearTimeout(n.current),t.current?.close(),t.current=null}},[e])}var se=(0,Y.lazy)(()=>M(()=>import(`./Dashboard-Dskgf0jG.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),ce=(0,Y.lazy)(()=>M(()=>import(`./Sessions-C0BmdDPK.js`),__vite__mapDeps([12,1,2,3,4,5,6,7,9,13,10,11,8,14,15,16]))),le=(0,Y.lazy)(()=>M(()=>import(`./SessionDetail-BMrqH8_W.js`),__vite__mapDeps([17,1,2,3,4,5,6,7,8,9,18,11]))),ue=(0,Y.lazy)(()=>M(()=>import(`./Events-CAY9kU9T.js`),__vite__mapDeps([19,1,3,5,6,4,7,8,9,10,11,14,20,16]))),de=(0,Y.lazy)(()=>M(()=>import(`./Pipelines-Drat9IqZ.js`),__vite__mapDeps([21,1,2,3,4,5,6,7,8,9,13,10,11,14,22,15,20,16]))),fe=(0,Y.lazy)(()=>M(()=>import(`./PipelineDetail-Bc6l2jqX.js`),__vite__mapDeps([23,1,2,3,4,5,6,7,8,9,18,10,11,24]))),pe=(0,Y.lazy)(()=>M(()=>import(`./Quality-Bm7oRSun.js`),__vite__mapDeps([25,1,3,5,6,4,7,8,9,10,11,14,22,24,20,16]))),me=(0,Y.lazy)(()=>M(()=>import(`./Config-CUb6-ddH.js`),__vite__mapDeps([26,1,3,5,6,4,7,8,9,10,11,24]))),he=(0,Y.lazy)(()=>M(()=>import(`./Analytics-txva5ugO.js`),__vite__mapDeps([27,1,3,5,6,4,7,9,14,11,8,16]))),ge=(0,Y.lazy)(()=>M(()=>import(`./Knowledge-BHLyFp2U.js`),__vite__mapDeps([28,1,3,5,6,4,7,8,9,10,11,22,24,16]))),_e=(0,Y.lazy)(()=>M(()=>import(`./Projects-qDolX6Y6.js`),__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,22,11,24,16]))),ve=(0,Y.lazy)(()=>M(()=>import(`./ProjectDetail-Cx8VZp8O.js`),__vite__mapDeps([30,1,2,3,4,5,6,7,9,18,22,11,8,24]))),ye=(0,Y.lazy)(()=>M(()=>import(`./Skills-B3c1_uFt.js`),__vite__mapDeps([31,1,3,5,6,4,7,9,10,11,8,24]))),be=(0,Y.lazy)(()=>M(()=>import(`./Conventions-E_2yAYoB.js`),__vite__mapDeps([32,1,33,3,5,6,4,7,9,10,11,8,24]))),xe=(0,Y.lazy)(()=>M(()=>import(`./NodeTypes-B6wc7VnR.js`),__vite__mapDeps([34,1,3,5,6,4,7,9]))),Se=(0,Y.lazy)(()=>M(()=>import(`./PipelineTemplates-sSL-9oRh.js`),__vite__mapDeps([35,1,3,5,6,4,7,9,24]))),Ce=(0,Y.lazy)(()=>M(()=>import(`./Templates-Dho__f4l.js`),__vite__mapDeps([36,1,2,3,4,5,6,7,8,9,14,11,15]))),we=(0,Y.lazy)(()=>M(()=>import(`./TemplateDetail-ep5h3Cu5.js`),__vite__mapDeps([37,1,2,3,4,5,6,7,8,9,10,11,14,15]))),Te=(0,Y.lazy)(()=>M(()=>import(`./Evolution-Ck_BqRpt.js`),__vite__mapDeps([38,2,1,3,4,5,6,7,8,9,15,11])));function Ee(){return oe(),(0,X.jsx)($,{children:(0,X.jsxs)(q,{children:[(0,X.jsx)(re,{}),(0,X.jsx)(Q,{children:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`div`,{className:`flex items-center justify-center h-full text-gray-400`,children:`加载中...`}),children:(0,X.jsxs)(O,{children:[(0,X.jsx)(w,{path:`/`,element:(0,X.jsx)(D,{to:`/dashboard`,replace:!0})}),(0,X.jsx)(w,{path:`/dashboard`,element:(0,X.jsx)(se,{})}),(0,X.jsx)(w,{path:`/sessions`,element:(0,X.jsx)(ce,{})}),(0,X.jsx)(w,{path:`/sessions/:id`,element:(0,X.jsx)(le,{})}),(0,X.jsx)(w,{path:`/events`,element:(0,X.jsx)(ue,{})}),(0,X.jsx)(w,{path:`/pipelines`,element:(0,X.jsx)(de,{})}),(0,X.jsx)(w,{path:`/pipelines/:id`,element:(0,X.jsx)(fe,{})}),(0,X.jsx)(w,{path:`/projects`,element:(0,X.jsx)(_e,{})}),(0,X.jsx)(w,{path:`/projects/:encodedPath`,element:(0,X.jsx)(ve,{})}),(0,X.jsx)(w,{path:`/quality`,element:(0,X.jsx)(pe,{})}),(0,X.jsx)(w,{path:`/analytics`,element:(0,X.jsx)(he,{})}),(0,X.jsx)(w,{path:`/knowledge`,element:(0,X.jsx)(ge,{})}),(0,X.jsx)(w,{path:`/skills`,element:(0,X.jsx)(ye,{})}),(0,X.jsx)(w,{path:`/conventions`,element:(0,X.jsx)(be,{})}),(0,X.jsx)(w,{path:`/node-types`,element:(0,X.jsx)(xe,{})}),(0,X.jsx)(w,{path:`/pipeline-templates`,element:(0,X.jsx)(Se,{})}),(0,X.jsx)(w,{path:`/templates`,element:(0,X.jsx)(Ce,{})}),(0,X.jsx)(w,{path:`/templates/:id`,element:(0,X.jsx)(we,{})}),(0,X.jsx)(w,{path:`/evolution`,element:(0,X.jsx)(Te,{})}),(0,X.jsx)(w,{path:`/config`,element:(0,X.jsx)(me,{})})]})})})]})})}var De=new F({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:3e4}}});J.createRoot(document.getElementById(`root`)).render((0,X.jsx)(Y.StrictMode,{children:(0,X.jsx)(P,{client:De,children:(0,X.jsx)(j,{children:(0,X.jsx)(Ee,{})})})}));
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Claude Forge - 管理后台</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-j5VaS74c.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-COnpUsM8.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/vendor-DRGPi8ui.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/vendor-charts-9eVsQvUV.js">
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{Bn as t,Bt as n,Fn as r,In as i,Lt as a,Qt as o,Rn as s,Tn as c,Vn as l,Yn as u,gr as d,hn as f,nn as p,qn as m,rn as h,s as g,tn as _,zt as v}from"./vendor-DRGPi8ui.js";import{a as y,n as b,r as x}from"./vendor-query-DqPOMnuX.js";import{c as S}from"./vendor-flow-srkes8If.js";import{A as C,Bt as w,Gt as T,H as E,Lt as D,Qt as O,R as k,U as A,a as j,at as M,h as N,it as P,m as F,q as I,r as L,tn as ee}from"./client-BvVpIixG.js";import{a as R,n as z,r as B,t as te}from"./ui-CDL3BZ13.js";import{n as V,t as H}from"./vendor-motion-CQmdgnI8.js";import{n as U}from"./Toast-BbB3oD2a.js";import{t as ne}from"./ConfirmDialog-BKfwMp04.js";var W=e(d(),1),G=S();function re({onConfirm:e}){let n=y(),[a,o]=(0,W.useState)(!1),[l,u]=(0,W.useState)(``),[d,p]=(0,W.useState)(!1),[m,_]=(0,W.useState)({}),{data:v,refetch:S}=x({queryKey:[`backups`],queryFn:()=>D().then(e=>e.data)}),{data:C}=x({queryKey:[`daemon-status`],queryFn:()=>I().then(e=>e.data)}),w=b({mutationFn:()=>j(a?{encrypt:!0,password:l}:{}),onSuccess:()=>{U(`备份创建成功`,`success`),u(``),o(!1),S()},onError:()=>U(`备份创建失败`,`error`)}),E=b({mutationFn:({filename:e,password:t})=>T(e,t),onSuccess:()=>{U(`数据库恢复成功,daemon 将自动重启`,`success`),n.clear()},onError:()=>U(`恢复失败,请检查密码或文件完整性`,`error`)});return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(B,{children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`flex-shrink-0 w-10 h-10 rounded-full bg-blue-50 flex items-center justify-center`,children:(0,G.jsx)(c,{className:`h-5 w-5 text-blue-600`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`当前数据库`}),(0,G.jsxs)(`p`,{className:`text-sm text-gray-500 mt-1`,children:[`内存占用:`,C?.memory?`${(C.memory.heapUsed/1024/1024).toFixed(2)} MB`:`加载中...`]})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col items-end gap-2`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm text-gray-600 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked),className:`rounded`}),(0,G.jsx)(f,{className:`h-3.5 w-3.5`}),`加密备份`]})}),a&&(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`input`,{type:d?`text`:`password`,placeholder:`备份密码(≥8位)`,value:l,onChange:e=>u(e.target.value),className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 pr-8 w-48`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>p(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-gray-400`,children:d?(0,G.jsx)(i,{className:`h-3.5 w-3.5`}):(0,G.jsx)(r,{className:`h-3.5 w-3.5`})})]}),(0,G.jsx)(z,{variant:`primary`,size:`sm`,icon:t,onClick:()=>w.mutate(),loading:w.isPending,disabled:a&&l.length<8,children:`立即备份`})]})]})}),(0,G.jsxs)(B,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,G.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`备份历史`}),(0,G.jsx)(z,{variant:`ghost`,size:`sm`,icon:h,onClick:()=>void S(),children:`刷新`})]}),v&&v.items.length>0?(0,G.jsx)(`div`,{className:`space-y-2`,children:v.items.map(t=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-gray-900 truncate`,children:t.filename}),t.encrypted&&(0,G.jsxs)(`span`,{className:`flex items-center gap-0.5 text-xs text-amber-600 bg-amber-50 px-1.5 py-0.5 rounded`,children:[(0,G.jsx)(f,{className:`h-3 w-3`}),` 已加密`]}),!t.hasChecksum&&(0,G.jsx)(`span`,{className:`text-xs text-gray-400 bg-gray-100 px-1.5 py-0.5 rounded`,children:`无校验`})]}),(0,G.jsxs)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:[g(new Date(t.createdAt),`yyyy-MM-dd HH:mm:ss`),` · `,t.sizeMb,` MB`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 ml-3 flex-shrink-0`,children:[(0,G.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>e({title:`恢复数据库`,description:`确定要从 ${t.filename} 恢复数据库吗?当前数据库将被覆盖(会自动备份)。恢复后 daemon 将自动重启。`,onConfirm:()=>E.mutate({filename:t.filename,password:m[t.filename]})}),loading:E.isPending&&E.variables?.filename===t.filename,children:`恢复`}),(0,G.jsx)(`a`,{href:k(t.filename),download:t.filename,children:(0,G.jsx)(z,{variant:`ghost`,size:`sm`,icon:s,children:`下载`})})]})]}),t.encrypted&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(f,{className:`h-3.5 w-3.5 text-amber-500 flex-shrink-0`}),(0,G.jsx)(`input`,{type:`password`,placeholder:`输入解密密码后点击恢复`,value:m[t.filename]||``,onChange:e=>_(n=>({...n,[t.filename]:e.target.value})),className:`flex-1 px-2 py-1 text-xs border border-amber-200 rounded focus:outline-none focus:ring-1 focus:ring-amber-400`})]})]},t.filename))}):(0,G.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无备份记录`})]}),(0,G.jsxs)(B,{children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between mb-4`,children:(0,G.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`数据管理`})}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:`清理历史事件`}),(0,G.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:`删除超过指定天数的事件记录`})]}),(0,G.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>e({title:`清理历史事件`,description:`确定要清理 30 天前的事件记录吗?此操作不可撤销。`,onConfirm:()=>{L.post(`/events/purge`,{retentionDays:30}).then(()=>U(`事件清理完成`,`success`)).catch(()=>U(`事件清理失败`,`error`))}}),children:`清理 30 天前`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:`数据库优化`}),(0,G.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:`执行 VACUUM 回收空间,提升性能`})]}),(0,G.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>e({title:`数据库优化`,description:`确定要执行 VACUUM 优化吗?此操作可能需要几分钟。`,onConfirm:()=>{L.post(`/config/vacuum`).then(()=>U(`数据库优化完成`,`success`)).catch(()=>U(`数据库优化失败`,`error`))}}),children:`立即优化`})]})]})]})]})}function ie({onConfirm:e}){let{data:t,refetch:n}=x({queryKey:[`memory-caches`],queryFn:()=>P().then(e=>e.data)}),{data:r}=x({queryKey:[`memory-process`],queryFn:()=>M().then(e=>e.data)}),i=b({mutationFn:e=>N(e),onSuccess:()=>{U(`缓存已清空`,`success`),n()},onError:()=>U(`清空失败`,`error`)}),a=b({mutationFn:()=>F(),onSuccess:()=>{U(`所有缓存已清空`,`success`),n()},onError:()=>U(`清空失败`,`error`)}),o=b({mutationFn:()=>O(),onSuccess:()=>U(`GC 已触发`,`success`),onError:()=>U(`GC 触发失败`,`error`)});return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(B,{children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between mb-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`flex-shrink-0 w-10 h-10 rounded-full bg-purple-50 flex items-center justify-center`,children:(0,G.jsx)(l,{className:`h-5 w-5 text-purple-600`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`进程内存`}),r&&(0,G.jsxs)(`div`,{className:`text-sm text-gray-600 mt-2 space-y-1`,children:[(0,G.jsxs)(`div`,{children:[`RSS: `,r.rssMB,` MB`]}),(0,G.jsxs)(`div`,{children:[`堆已用: `,r.heapUsedMB,` MB / `,r.heapTotalMB,` MB`]}),(0,G.jsxs)(`div`,{children:[`外部: `,r.externalMB,` MB`]})]})]})]}),(0,G.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>o.mutate(),loading:o.isPending,children:`触发 GC`})]})}),(0,G.jsxs)(B,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,G.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`LRU 缓存`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(z,{variant:`ghost`,size:`sm`,icon:h,onClick:()=>void n(),children:`刷新`}),(0,G.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>e({title:`清空所有缓存`,description:`确定要清空所有 LRU 缓存吗?`,onConfirm:()=>a.mutate()}),loading:a.isPending,children:`清空全部`})]})]}),t&&t.caches.length>0?(0,G.jsx)(`div`,{className:`space-y-2`,children:t.caches.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:e.name}),(0,G.jsxs)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:[e.size,` / `,e.maxSize,` 条`,e.hitRate!==void 0&&` · 命中率 ${(e.hitRate*100).toFixed(1)}%`]})]}),(0,G.jsx)(z,{variant:`ghost`,size:`sm`,onClick:()=>i.mutate(e.name),loading:i.isPending&&i.variables===e.name,children:`清空`})]},e.name))}):(0,G.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无缓存数据`})]})]})}function ae({currentConfig:e,onRestore:t,onConfirm:n}){let[r,i]=(0,W.useState)(null),{data:a}=x({queryKey:[`config-history`],queryFn:()=>A().then(e=>e.data)});return(0,G.jsxs)(B,{children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between mb-4`,children:(0,G.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`最近 10 次配置变更`})}),a&&a.items.length>0?(0,G.jsx)(`div`,{className:`space-y-2`,children:a.items.map(a=>{let o=r===String(a.id),s=e,c=[];if(o&&s){let e=(t,n=``)=>typeof t!=`object`||!t?{[n]:JSON.stringify(t)}:Object.entries(t).reduce((t,[r,i])=>{let a=n?`${n}.${r}`:r;return typeof i==`object`&&i&&!Array.isArray(i)?Object.assign(t,e(i,a)):t[a]=JSON.stringify(i),t},{}),t=e(a.config),n=e(s);new Set([...Object.keys(t),...Object.keys(n)]).forEach(e=>{let r=t[e]??`(无)`,i=n[e]??`(无)`;r!==i&&c.push({key:e,old:r,cur:i})})}return(0,G.jsxs)(`div`,{className:`py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`text-sm font-medium text-gray-900`,children:[`#`,a.id]}),(0,G.jsx)(`span`,{className:`text-xs text-gray-500`,children:g(new Date(a.savedAt),`yyyy-MM-dd HH:mm:ss`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(z,{variant:`ghost`,size:`sm`,onClick:()=>i(o?null:String(a.id)),children:o?`收起对比`:`与当前对比`}),(0,G.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>n({title:`确认恢复配置`,description:`确定要恢复到 ${g(new Date(a.savedAt),`yyyy-MM-dd HH:mm:ss`)} 的配置吗?当前配置将被覆盖。`,onConfirm:()=>t(a.config)}),children:`恢复到此版本`})]})]}),(0,G.jsx)(V,{children:o&&(0,G.jsx)(H.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:`overflow-hidden`,children:(0,G.jsxs)(`div`,{className:`mt-3 rounded border border-gray-200 overflow-hidden text-xs font-mono`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-3 bg-gray-100 px-3 py-1.5 text-gray-500 font-medium text-xs`,children:[(0,G.jsx)(`span`,{children:`配置项`}),(0,G.jsx)(`span`,{className:`text-red-600`,children:`历史值`}),(0,G.jsx)(`span`,{className:`text-green-600`,children:`当前值`})]}),c.length===0?(0,G.jsx)(`div`,{className:`px-3 py-3 text-gray-400 text-center`,children:`与当前配置完全一致`}):c.map(({key:e,old:t,cur:n})=>(0,G.jsxs)(`div`,{className:`grid grid-cols-3 px-3 py-2 border-t border-gray-100 hover:bg-gray-50`,children:[(0,G.jsx)(`span`,{className:`text-gray-700 truncate`,children:e}),(0,G.jsx)(`span`,{className:`text-red-600 truncate`,children:t}),(0,G.jsx)(`span`,{className:`text-green-600 truncate`,children:n})]},e))]})})})]},a.id)})}):(0,G.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无历史记录`})]})}function oe({content:e,children:t,className:n}){let[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(`top`),s=(0,W.useRef)(null);return(0,W.useEffect)(()=>{r&&s.current&&o(s.current.getBoundingClientRect().top<80?`bottom`:`top`)},[r]),(0,G.jsxs)(`span`,{ref:s,className:R(`relative inline-flex items-center cursor-help`,n),onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[t,r&&(0,G.jsx)(`span`,{className:R(`absolute z-50 w-max max-w-xs px-2.5 py-1.5 text-xs text-white bg-gray-800 rounded-lg shadow-lg pointer-events-none whitespace-normal`,a===`top`?`bottom-full mb-1.5 left-1/2 -translate-x-1/2`:`top-full mt-1.5 left-1/2 -translate-x-1/2`),children:e})]})}var K={Pipeline:`自动化工作流,将需求分解为多个节点依次执行`,Daemon:`后台守护进程,监听 Claude Code 事件并驱动编排引擎`,Hook:`Claude Code 生命周期钩子,在工具调用前后触发`,Distill:`将会话事件提炼为结构化知识,沉淀到知识图谱`,"Quality Gate":`质量门禁,在关键节点检测代码/文档质量问题`,Convention:`项目规范配置,定义节点类型、技能绑定和质量标准`,Skill:`可复用的 Claude Code 技能脚本,绑定到 Pipeline 节点`,ROI:`投资回报率,统计 AI 辅助节省的时间和 Token 用量`,Token:`LLM 处理的最小文本单元,影响 API 调用成本`,SSE:`Server-Sent Events,服务端向客户端推送实时事件的协议`},q=[{key:`distill`,title:`蒸馏配置`,description:`AI 知识蒸馏的触发条件和参数`,fields:[{key:`provider`,label:`提供商`,type:`select`,options:[{value:`claude`,label:`Claude`},{value:`openai`,label:`OpenAI`},{value:`ollama`,label:`Ollama`}]},{key:`auto_trigger`,label:`自动触发`,type:`boolean`,description:`达到事件阈值时自动蒸馏`},{key:`event_threshold`,label:`事件阈值`,type:`number`,description:`触发蒸馏的最小事件数`,min:1,max:1e4},{key:`timer_interval_minutes`,label:`定时器间隔(分钟)`,type:`number`,min:1,max:1440},{key:`model`,label:`模型`,type:`text`},{key:`api_key`,label:`API Key`,type:`text`,sensitive:!0,description:`留空自动从环境变量获取`},{key:`base_url`,label:`API 地址`,type:`text`,description:`留空使用默认地址`}]},{key:`autopilot`,title:`自动驾驶`,description:`意图分析、质量门禁、Pipeline 编排`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`intent_analysis`,label:`意图分析`,type:`boolean`,description:`AI 分析用户意图和任务复杂度`},{key:`quality_gate`,label:`质量门禁`,type:`boolean`,description:`代码变更时自动审查质量`},{key:`quality_review_interval`,label:`审查间隔`,type:`number`,description:`每 N 次 Write/Edit 触发一次审查`,min:1,max:100},{key:`auto_start_pipeline`,label:`自动启动流水线`,type:`boolean`},{key:`pipeline_confirm_mode`,label:`确认模式`,type:`select`,options:[{value:`prompt`,label:`提示确认`},{value:`auto`,label:`自动启动`},{value:`preview`,label:`仅预览`}]}]},{key:`resume`,title:`会话续接`,description:`中断会话的自动恢复`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`timeout_minutes`,label:`超时时间(分钟)`,type:`number`,min:1,max:1440},{key:`max_age_days`,label:`最大保留天数`,type:`number`,min:1,max:365}]},{key:`claudemd`,title:`CLAUDE.md 管理`,description:`项目级 CLAUDE.md 的自动生成与精炼`,fields:[{key:`auto_generate`,label:`自动生成`,type:`boolean`},{key:`auto_refine`,label:`自动精炼`,type:`boolean`},{key:`refine_interval`,label:`精炼间隔`,type:`number`,description:`每 N 次蒸馏后精炼一次`,min:1,max:100}]},{key:`orchestration`,title:`编排通知`,description:`蒸馏和 CLAUDE.md 更新的通知`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`notify_on_distill`,label:`蒸馏完成通知`,type:`boolean`},{key:`notify_on_claudemd`,label:`CLAUDE.md 更新通知`,type:`boolean`}]},{key:`web`,title:`Web 管理后台`,description:`Web 服务配置`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`port`,label:`端口`,type:`number`,min:1024,max:65535}]},{key:`ai`,title:`AI 模型`,description:`分层模型配置(Haiku/Sonnet/Opus)`,fields:[{key:`models.haiku`,label:`Haiku 模型`,type:`text`},{key:`models.sonnet`,label:`Sonnet 模型`,type:`text`},{key:`models.opus`,label:`Opus 模型`,type:`text`}]},{key:`storage`,title:`存储`,description:`数据库路径和容量限制`,fields:[{key:`path`,label:`数据库路径`,type:`text`},{key:`max_size_mb`,label:`最大容量(MB)`,type:`number`,min:100,max:102400}]},{key:`backup`,title:`备份配置`,description:`数据备份策略`,fields:[{key:`include_profile`,label:`包含用户画像`,type:`boolean`,description:`备份时包含用户画像数据`},{key:`encrypt_by_default`,label:`默认加密`,type:`boolean`,description:`备份文件默认加密`}]},{key:`pattern_engine`,title:`模式引擎`,description:`模式识别与演化配置`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`route_timeout_ms`,label:`路由超时(毫秒)`,type:`number`,min:100,max:6e4},{key:`evolve_interval_days`,label:`演化间隔(天)`,type:`number`,min:1,max:365},{key:`evolve_min_executions`,label:`最小执行次数`,type:`number`,description:`触发演化的最小执行次数`,min:1,max:1e3}]},{key:`ui`,title:`UI 配置`,description:`前端界面参数`,fields:[{key:`skill_repair_limit`,label:`Skill 修复上限`,type:`number`,min:1,max:100},{key:`logs_tail_default`,label:`日志默认条数`,type:`number`,min:10,max:1e3},{key:`pipeline_expire_hours`,label:`Pipeline 过期时间(小时)`,type:`number`,min:1,max:720}]},{key:`history`,title:`配置历史`,description:`查看最近 10 次配置变更记录`,fields:[]}];function J(){let e=y(),[r,i]=(0,W.useState)(null),[c,l]=(0,W.useState)(`idle`),[d,f]=(0,W.useState)(`distill`),[g,S]=(0,W.useState)(new Set),T=g.size>0,[D,O]=(0,W.useState)(null),[k,A]=(0,W.useState)(new Set),[j,M]=(0,W.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:N,isLoading:P}=x({queryKey:[`config`],queryFn:()=>E().then(e=>e.data)}),{data:F,refetch:I}=x({queryKey:[`daemon-diagnosis`],queryFn:()=>C().then(e=>e.data),enabled:d===`environment`}),J=b({mutationFn:()=>w(),onSuccess:e=>{O(e.data),I()}});(0,W.useEffect)(()=>{N&&!r&&i(N)},[N,r]);let Y=b({mutationFn:e=>ee(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),l(`success`),S(new Set),setTimeout(()=>l(`idle`),3e3)},onError:()=>{l(`error`),setTimeout(()=>l(`idle`),3e3)}}),X=b({mutationFn:()=>L.post(`/config/reset`),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),i(null),l(`success`),setTimeout(()=>l(`idle`),3e3)}});if(P||!r)return(0,G.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,G.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});let Z=(e,t)=>{let n=r[e];if(!n)return``;let i=t.split(`.`),a=n;for(let e of i)a=a?.[e];return a??``},Q=(e,t,n)=>{S(t=>new Set(t).add(e)),i(r=>{if(!r)return r;let i={...r[e]||{}},a=t.split(`.`);if(a.length===1)i[t]=n;else{let e={...i[a[0]]||{}};e[a[1]]=n,i[a[0]]=e}return{...r,[e]:i}})},se=()=>{if(!r)return;let e={};g.forEach(t=>{e[t]=r[t]}),Y.mutate(e)},ce=()=>{i(N),S(new Set)},le=()=>{let e=JSON.stringify(r,null,2),t=new Blob([e],{type:`application/json`}),n=URL.createObjectURL(t),i=document.createElement(`a`);i.href=n,i.download=`claude-forge-config-${new Date().toISOString().slice(0,10)}.json`,i.click(),URL.revokeObjectURL(n)},ue=()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`.json`,e.onchange=e=>{let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=e=>{try{i(JSON.parse(e.target?.result)),S(new Set(q.map(e=>e.key)))}catch{U(`配置文件格式错误,请选择有效的 JSON 文件`,`error`)}},n.readAsText(t)},e.click()},$=q.find(e=>e.key===d);return(0,G.jsxs)(`div`,{className:`flex gap-6`,children:[(0,G.jsx)(`div`,{className:`w-56 flex-shrink-0`,children:(0,G.jsx)(B,{className:`!p-2 sticky top-6`,children:(0,G.jsxs)(`nav`,{className:`space-y-1`,children:[q.map(e=>(0,G.jsx)(`button`,{onClick:()=>f(e.key),className:R(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors`,d===e.key?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:K[e.title]?(0,G.jsx)(oe,{content:K[e.title],children:e.title}):e.title},e.key)),(0,G.jsx)(`div`,{className:`border-t border-gray-100 my-1`}),(0,G.jsxs)(`button`,{onClick:()=>f(`backup_mgmt`),className:R(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors flex items-center gap-2`,d===`backup_mgmt`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:[(0,G.jsx)(t,{className:`h-3.5 w-3.5`}),`数据备份`]}),(0,G.jsxs)(`button`,{onClick:()=>f(`memory_mgmt`),className:R(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors flex items-center gap-2`,d===`memory_mgmt`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:[(0,G.jsx)(Cpu,{className:`h-3.5 w-3.5`}),`内存管理`]}),(0,G.jsxs)(`button`,{onClick:()=>f(`environment`),className:R(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors flex items-center gap-2`,d===`environment`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:[(0,G.jsx)(o,{className:`h-3.5 w-3.5`}),`环境检测`]})]})})}),(0,G.jsxs)(`div`,{className:`flex-1 space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-gray-900`,children:d===`environment`?`环境检测`:d===`backup_mgmt`?`数据备份`:d===`memory_mgmt`?`内存管理`:d===`history`?`配置历史`:$?.title}),(0,G.jsx)(`p`,{className:`text-sm text-gray-500`,children:d===`environment`?`Hook 脚本与 Claude settings.json 注入状态检测与修复`:d===`backup_mgmt`?`数据库备份与历史备份管理`:d===`memory_mgmt`?`LRU 缓存状态与进程内存管理`:d===`history`?`查看最近 10 次配置变更记录`:$?.description??``})]}),d!==`environment`&&d!==`backup_mgmt`&&d!==`memory_mgmt`&&d!==`history`&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(V,{children:[c===`success`&&(0,G.jsxs)(H.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0},className:`flex items-center gap-1.5 text-green-600 text-sm`,children:[(0,G.jsx)(u,{className:`h-4 w-4`}),`已保存`]}),c===`error`&&(0,G.jsxs)(H.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0},className:`flex items-center gap-1.5 text-red-600 text-sm`,children:[(0,G.jsx)(m,{className:`h-4 w-4`}),`保存失败`]})]}),T&&(0,G.jsx)(te,{variant:`warning`,children:`未保存`}),(0,G.jsx)(z,{variant:`ghost`,size:`sm`,icon:s,onClick:le,children:`导出`}),(0,G.jsx)(z,{variant:`ghost`,size:`sm`,icon:v,onClick:ue,children:`导入`}),(0,G.jsx)(z,{variant:`ghost`,size:`sm`,icon:p,onClick:ce,disabled:!T,children:`撤销`}),(0,G.jsx)(z,{variant:`primary`,size:`sm`,icon:_,onClick:se,loading:Y.isPending,disabled:!T,children:`保存`})]})]}),d!==`environment`&&d!==`backup_mgmt`&&d!==`memory_mgmt`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(B,{children:(0,G.jsx)(`div`,{className:`space-y-6`,children:$?.fields.map(e=>(0,G.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,G.jsxs)(`div`,{className:`w-48 flex-shrink-0 pt-2`,children:[(0,G.jsx)(`label`,{className:`text-sm font-medium text-gray-700`,children:e.label}),e.description&&(0,G.jsx)(`p`,{className:`text-xs text-gray-400 mt-0.5`,children:e.description})]}),(0,G.jsx)(`div`,{className:`flex-1`,children:e.type===`boolean`?(0,G.jsx)(`button`,{onClick:()=>Q(d,e.key,!Z(d,e.key)),className:R(`relative inline-flex h-6 w-11 items-center rounded-full transition-colors`,Z(d,e.key)?`bg-blue-600`:`bg-gray-300`),children:(0,G.jsx)(`span`,{className:R(`inline-block h-4 w-4 transform rounded-full bg-white transition-transform`,Z(d,e.key)?`translate-x-6`:`translate-x-1`)})}):e.type===`select`?(0,G.jsx)(`select`,{value:String(Z(d,e.key)||``),onChange:t=>Q(d,e.key,t.target.value),className:`w-full max-w-xs px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`,children:e.options?.map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))}):e.type===`number`?(0,G.jsx)(`input`,{type:`number`,value:Number(Z(d,e.key))||0,onChange:t=>Q(d,e.key,Number(t.target.value)),min:e.min,max:e.max,className:`w-full max-w-xs px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`}):(0,G.jsxs)(`div`,{className:`relative flex items-center max-w-xs`,children:[(0,G.jsx)(`input`,{type:e.sensitive&&!k.has(`${d}.${e.key}`)?`password`:`text`,value:String(Z(d,e.key)||``),onChange:t=>Q(d,e.key,t.target.value),className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm pr-9`}),e.sensitive&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>A(t=>{let n=new Set(t),r=`${d}.${e.key}`;return n.has(r)?n.delete(r):n.add(r),n}),className:`absolute right-2 text-gray-400 hover:text-gray-600`,children:k.has(`${d}.${e.key}`)?(0,G.jsx)(EyeOff,{className:`h-4 w-4`}):(0,G.jsx)(Eye,{className:`h-4 w-4`})})]})})]},e.key))})}),(0,G.jsx)(B,{className:`!border-red-200`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-red-600`,children:`重置配置`}),(0,G.jsx)(`p`,{className:`text-xs text-gray-500 mt-1`,children:`将所有配置恢复为默认值,此操作不可撤销`})]}),(0,G.jsx)(z,{variant:`danger`,size:`sm`,icon:n,onClick:()=>{M({open:!0,title:`重置配置`,description:`确定要重置所有配置为默认值吗?此操作不可撤销。`,onConfirm:()=>{X.mutate(),M({...j,open:!1})}})},loading:X.isPending,children:`重置`})]})})]}),d===`backup_mgmt`&&(0,G.jsx)(re,{onConfirm:e=>M({...e,open:!0})}),d===`memory_mgmt`&&(0,G.jsx)(ie,{onConfirm:e=>M({...e,open:!0})}),d===`history`&&(0,G.jsx)(ae,{currentConfig:N,onRestore:e=>Y.mutate(e),onConfirm:e=>M({...e,open:!0})}),d===`environment`&&(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(B,{children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-medium text-gray-900 mb-1`,children:`Hook 环境诊断`}),(0,G.jsx)(`p`,{className:`text-sm text-gray-500`,children:`检测 Forge hooks 脚本与 Claude settings.json 中 Forge 注入是否完整`})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 flex-shrink-0`,children:[(0,G.jsx)(z,{variant:`secondary`,size:`sm`,icon:h,onClick:()=>I(),children:`重新检测`}),(0,G.jsx)(z,{size:`sm`,icon:a,onClick:()=>J.mutate(),disabled:J.isPending||F?.hooksHealthy,children:J.isPending?`修复中...`:`一键修复`})]})]})}),D&&(0,G.jsx)(B,{children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[D.hooksHealthy?(0,G.jsx)(u,{className:`h-4 w-4 text-green-500 mt-0.5 flex-shrink-0`}):(0,G.jsx)(n,{className:`h-4 w-4 text-yellow-500 mt-0.5 flex-shrink-0`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:R(`text-sm font-medium`,D.hooksHealthy?`text-gray-900`:`text-yellow-600`),children:D.hooksHealthy?`Hooks 环境已恢复正常`:`修复后仍有未通过项,请根据下方列表排查`}),D.backupPath&&(0,G.jsxs)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:[`已备份 settings: `,D.backupPath.split(`/`).pop()]})]})]}),(0,G.jsx)(z,{variant:`ghost`,size:`sm`,icon:m,onClick:()=>O(null)})]})}),F&&(0,G.jsx)(B,{children:(0,G.jsx)(`div`,{className:`space-y-2`,children:F.items.map(e=>(0,G.jsxs)(`div`,{className:`flex items-start gap-3 py-2 border-b border-gray-50 last:border-0`,children:[(0,G.jsx)(`div`,{className:`flex-shrink-0 mt-0.5`,children:e.ok?(0,G.jsx)(u,{className:`h-4 w-4 text-green-500`}):e.id===`daemon_process`?(0,G.jsx)(n,{className:`h-4 w-4 text-yellow-500`}):(0,G.jsx)(m,{className:`h-4 w-4 text-red-500`})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:e.label}),(0,G.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5 break-all`,children:e.detail})]})]},e.id))})}),F&&(0,G.jsx)(B,{className:F.hooksHealthy?`!border-green-200 !bg-green-50`:`!border-yellow-200 !bg-yellow-50`,children:(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:F.hooksHealthy?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(u,{className:`h-5 w-5 text-green-600`}),(0,G.jsx)(`p`,{className:`text-sm font-medium text-green-700`,children:`Hooks 相关环境正常`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(n,{className:`h-5 w-5 text-yellow-600`}),(0,G.jsx)(`p`,{className:`text-sm font-medium text-yellow-700`,children:`检测到 Hooks 环境不完整,请点击「一键修复」`})]})})})]})]}),(0,G.jsx)(ne,{open:j.open,title:j.title,description:j.description,variant:`danger`,onConfirm:j.onConfirm,onCancel:()=>M({...j,open:!1})})]})}export{J as default};
|