@axiom-lattice/react-sdk 8.1.1 → 8.2.0
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/{AgentDetailSideApp-ZSEYYLLD.mjs → AgentDetailSideApp-PNN6EZAK.mjs} +11 -11
- package/dist/AgentGovernanceWorkbench-RHZHXKXL.mjs +24 -0
- package/dist/{LangfuseDashboard-OHQOU74U.mjs → LangfuseDashboard-LRYMXATJ.mjs} +2 -2
- package/dist/{MessageGraph-AJYUV6KO.mjs → MessageGraph-G4S25PLS.mjs} +7 -7
- package/dist/{ReactChart-PVQCB6DJ.mjs → ReactChart-UNBTHGFX.mjs} +7 -7
- package/dist/SkillFlow-ZZZGU7G5.mjs +14 -0
- package/dist/{TasksSideApp-OJ5NHBIJ.mjs → TasksSideApp-PKIA6WVE.mjs} +8 -8
- package/dist/ThreadMaintenancePanel-HJQ24NMZ.mjs +12 -0
- package/dist/{TopologyRuntimeView-N7HDB2ZH.mjs → TopologyRuntimeView-EQIYLMTF.mjs} +8 -8
- package/dist/WorkflowAutomationView-WR4LQ7CY.mjs +22 -0
- package/dist/{chunk-B7CF2V4Z.mjs → chunk-6KAXO3UV.mjs} +4 -4
- package/dist/{chunk-H3WEVZMT.mjs → chunk-7IRISB5X.mjs} +2 -2
- package/dist/{chunk-RSVCJORT.mjs → chunk-FXPJL27K.mjs} +4 -4
- package/dist/{chunk-YMMOZ4SQ.mjs → chunk-HJBIRTLF.mjs} +3 -3
- package/dist/{chunk-NTGALUWV.mjs → chunk-M5PVHJ2T.mjs} +10 -10
- package/dist/{chunk-QEZDPFJD.mjs → chunk-MDGPZ6PT.mjs} +6952 -6305
- package/dist/chunk-MDGPZ6PT.mjs.map +1 -0
- package/dist/{chunk-RSKPM2EX.mjs → chunk-MI623NH3.mjs} +3 -3
- package/dist/{chunk-WQEQWSBD.mjs → chunk-O6LQDULL.mjs} +8 -8
- package/dist/{chunk-5RH6VC6U.mjs → chunk-ON5OXKYT.mjs} +3 -3
- package/dist/{chunk-CEC7VWIE.mjs → chunk-PT4E2OUU.mjs} +3 -3
- package/dist/{chunk-CBOSLYWQ.mjs → chunk-THI4W7JV.mjs} +3 -3
- package/dist/{chunk-VZS7AXE2.mjs → chunk-UAZQVVSC.mjs} +7 -7
- package/dist/{chunk-MCSBXLVL.mjs → chunk-UHXZUMQE.mjs} +3 -3
- package/dist/{chunk-YYBZ2KBD.mjs → chunk-ZZ23HKVT.mjs} +4 -4
- package/dist/{embed-page-AgentDetailSideApp-23TCREK6.js → embed-page-AgentDetailSideApp-RY4FAEAM.js} +1 -1
- package/dist/{embed-page-AgentGovernanceWorkbench-N3F65F3W.js → embed-page-AgentGovernanceWorkbench-UFDULZ5A.js} +1 -1
- package/dist/{embed-page-LangfuseDashboard-WBE7GJPU.js → embed-page-LangfuseDashboard-GNNJGAA2.js} +1 -1
- package/dist/{embed-page-MessageGraph-T3EFAXTX.js → embed-page-MessageGraph-S7GCLNLR.js} +1 -1
- package/dist/{embed-page-ReactChart-FJFQU4IV.js → embed-page-ReactChart-LWZPH244.js} +1 -1
- package/dist/{embed-page-SkillFlow-2BUXCLAL.js → embed-page-SkillFlow-OVIGJFUH.js} +1 -1
- package/dist/{embed-page-TasksSideApp-VFKEYFGR.js → embed-page-TasksSideApp-AOS4MZAI.js} +1 -1
- package/dist/{embed-page-ThreadMaintenancePanel-EPBJ4J3L.js → embed-page-ThreadMaintenancePanel-PXL2TJBO.js} +1 -1
- package/dist/{embed-page-TopologyRuntimeView-OWESU7IK.js → embed-page-TopologyRuntimeView-GRM34Z2Z.js} +1 -1
- package/dist/{embed-page-WorkflowAutomationView-5J2RQTZ7.js → embed-page-WorkflowAutomationView-JV26AHRB.js} +1 -1
- package/dist/{embed-page-chunk-WKQHSEZ4.js → embed-page-chunk-3UK7XM33.js} +1 -1
- package/dist/{embed-page-chunk-6QLLZJVH.js → embed-page-chunk-5XP4FJW7.js} +1 -1
- package/dist/{embed-page-chunk-R7TLHZR3.js → embed-page-chunk-6ZHR5GWS.js} +1 -1
- package/dist/{embed-page-chunk-2ZBEWYJQ.js → embed-page-chunk-ABGWNVMG.js} +1 -1
- package/dist/{embed-page-chunk-JMTQCORF.js → embed-page-chunk-NNQHJZ5Q.js} +1 -1
- package/dist/{embed-page-chunk-CQLDPGEG.js → embed-page-chunk-ONXC5S22.js} +1 -1
- package/dist/{embed-page-chunk-BFVNPGSW.js → embed-page-chunk-OQUMCCF5.js} +1 -1
- package/dist/{embed-page-chunk-CKUSXUKW.js → embed-page-chunk-SQSVDSG6.js} +176 -176
- package/dist/{embed-page-chunk-L7TDL27M.js → embed-page-chunk-YCTDKWKW.js} +1 -1
- package/dist/{embed-page-chunk-EU32IF7M.js → embed-page-chunk-YM76GTXK.js} +1 -1
- package/dist/{embed-page-en-TSCGSJAI.js → embed-page-en-ISNUZBPO.js} +1 -1
- package/dist/{embed-page-zh-Q22DIOB3.js → embed-page-zh-MDJTBW2K.js} +1 -1
- package/dist/embed-page.js +1 -1
- package/dist/{en-46QZD2TW.mjs → en-YVYTG3D2.mjs} +32 -8
- package/dist/{en-46QZD2TW.mjs.map → en-YVYTG3D2.mjs.map} +1 -1
- package/dist/index.d.mts +31 -7
- package/dist/index.d.ts +31 -7
- package/dist/index.js +4322 -3612
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -14
- package/dist/web-app.js +62 -14
- package/dist/web-app.js.map +1 -1
- package/dist/web-app.mjs +2 -2
- package/dist/{zh-2SMAXRUF.mjs → zh-RPVSLAR6.mjs} +32 -8
- package/dist/{zh-2SMAXRUF.mjs.map → zh-RPVSLAR6.mjs.map} +1 -1
- package/package.json +3 -3
- package/dist/AgentGovernanceWorkbench-NVQXK3VM.mjs +0 -24
- package/dist/SkillFlow-IRNQI55E.mjs +0 -14
- package/dist/ThreadMaintenancePanel-BGBGVU3W.mjs +0 -12
- package/dist/WorkflowAutomationView-TN4NHNLD.mjs +0 -22
- package/dist/chunk-QEZDPFJD.mjs.map +0 -1
- /package/dist/{AgentDetailSideApp-ZSEYYLLD.mjs.map → AgentDetailSideApp-PNN6EZAK.mjs.map} +0 -0
- /package/dist/{AgentGovernanceWorkbench-NVQXK3VM.mjs.map → AgentGovernanceWorkbench-RHZHXKXL.mjs.map} +0 -0
- /package/dist/{LangfuseDashboard-OHQOU74U.mjs.map → LangfuseDashboard-LRYMXATJ.mjs.map} +0 -0
- /package/dist/{MessageGraph-AJYUV6KO.mjs.map → MessageGraph-G4S25PLS.mjs.map} +0 -0
- /package/dist/{ReactChart-PVQCB6DJ.mjs.map → ReactChart-UNBTHGFX.mjs.map} +0 -0
- /package/dist/{SkillFlow-IRNQI55E.mjs.map → SkillFlow-ZZZGU7G5.mjs.map} +0 -0
- /package/dist/{TasksSideApp-OJ5NHBIJ.mjs.map → TasksSideApp-PKIA6WVE.mjs.map} +0 -0
- /package/dist/{ThreadMaintenancePanel-BGBGVU3W.mjs.map → ThreadMaintenancePanel-HJQ24NMZ.mjs.map} +0 -0
- /package/dist/{TopologyRuntimeView-N7HDB2ZH.mjs.map → TopologyRuntimeView-EQIYLMTF.mjs.map} +0 -0
- /package/dist/{WorkflowAutomationView-TN4NHNLD.mjs.map → WorkflowAutomationView-WR4LQ7CY.mjs.map} +0 -0
- /package/dist/{chunk-B7CF2V4Z.mjs.map → chunk-6KAXO3UV.mjs.map} +0 -0
- /package/dist/{chunk-H3WEVZMT.mjs.map → chunk-7IRISB5X.mjs.map} +0 -0
- /package/dist/{chunk-RSVCJORT.mjs.map → chunk-FXPJL27K.mjs.map} +0 -0
- /package/dist/{chunk-YMMOZ4SQ.mjs.map → chunk-HJBIRTLF.mjs.map} +0 -0
- /package/dist/{chunk-NTGALUWV.mjs.map → chunk-M5PVHJ2T.mjs.map} +0 -0
- /package/dist/{chunk-RSKPM2EX.mjs.map → chunk-MI623NH3.mjs.map} +0 -0
- /package/dist/{chunk-WQEQWSBD.mjs.map → chunk-O6LQDULL.mjs.map} +0 -0
- /package/dist/{chunk-5RH6VC6U.mjs.map → chunk-ON5OXKYT.mjs.map} +0 -0
- /package/dist/{chunk-CEC7VWIE.mjs.map → chunk-PT4E2OUU.mjs.map} +0 -0
- /package/dist/{chunk-CBOSLYWQ.mjs.map → chunk-THI4W7JV.mjs.map} +0 -0
- /package/dist/{chunk-VZS7AXE2.mjs.map → chunk-UAZQVVSC.mjs.map} +0 -0
- /package/dist/{chunk-MCSBXLVL.mjs.map → chunk-UHXZUMQE.mjs.map} +0 -0
- /package/dist/{chunk-YYBZ2KBD.mjs.map → chunk-ZZ23HKVT.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as Z,c as he,e as ee,f as Se,g as xe,h as ve,i as be,l as Te,m as Ce}from"./embed-page-chunk-DJKD2PHO.js";import{a as fe,b as ge,c as me,d as ue,e as ke}from"./embed-page-chunk-SV2BM3WO.js";import"./embed-page-chunk-S4XZPBRM.js";import{a as V,b as we}from"./embed-page-chunk-CQLDPGEG.js";import{o as se,t as ne}from"./embed-page-chunk-R7TLHZR3.js";import{k as q}from"./embed-page-chunk-L7TDL27M.js";import{a as K}from"./embed-page-chunk-QV7QAJ4N.js";import{D as ce,E as de,Ja as U,ea as pe,o as re,sa as ye}from"./embed-page-chunk-B2KNZ3EW.js";import{Ia as R,La as C,Ma as le,Za as E,_ as v,_a as _,bb as ae,ua as ie,za as B}from"./embed-page-chunk-F7TA3LRH.js";import{a as oe}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-EUOOO2LS.js";import{f as W}from"./embed-page-chunk-QBTAJ2YI.js";var h=W(oe());var k=W(oe());var e=W(K()),{Text:d}=ae,{TextArea:Ne}=R,Ee=({data:b})=>{let s=q(),{token:o}=_.useToken(),{config:w}=ne(),{put:Y}=V(),I=he(t=>t.transform[2])>.6,G=se("__GLOBAL__");if(!b)return null;let{skill:g,onClick:D,onDelete:S}=b;if(!g)return null;let[i,A]=(0,k.useState)(g),O=i.subSkills&&i.subSkills.length>0,m=i.subSkills?.length||0,F=(0,k.useMemo)(()=>Math.min(12+Math.sqrt(m)*10,48),[m]),X=i.metadata&&i.metadata.category||"global",T=(0,k.useMemo)(()=>i.metadata?Object.entries(i.metadata).filter(([t,a])=>t&&a):[],[i.metadata]),P=t=>{if(!t)return"";let a=t instanceof Date?t:new Date(t);return Number.isNaN(a.getTime())?"":a.toLocaleString()},J=t=>{navigator.clipboard.writeText(t)},[z,x]=(0,k.useState)(!1),[p,n]=(0,k.useState)({...g,id:g.name}),[c,u]=(0,k.useState)(T.map(([t,a])=>({key:t,value:a}))),[$,M]=(0,k.useState)(!1),[Q,L]=(0,k.useState)(!1);(0,k.useEffect)(()=>{x(!1),A(g),n({...g,id:g.name}),u(Object.entries(g.metadata||{}).map(([t,a])=>({key:t,value:a})))},[g]);let l=(t,a)=>{if(t==="name"){n(r=>({...r,name:a,id:a}));return}n(r=>({...r,[t]:a}))},H=async t=>{t?.stopPropagation(),t?.preventDefault();try{let a=i.id||i.name;if(!a){C.error(s("chatWorkspace.skillNode.idMissing"));return}await G.skills.delete(a),C.success(s("chatWorkspace.skillNode.deleted")),M(!1),S&&await S()}catch(a){C.error(a?.message||s("chatWorkspace.skillNode.deleteFailed"))}},j=t=>{u(t);let a=t.reduce((r,y)=>(y.key&&(r[y.key]=y.value),r),{});n(r=>({...r,metadata:a}))},te=(t,a,r)=>{let y=[...c];y[t]={...y[t],[a]:r},j(y)},We=()=>{j([...c,{key:"",value:""}])},Be=async()=>{try{L(!0);let t={"Content-Type":"application/json"};w.apiKey&&(t.Authorization=`Bearer ${w.apiKey}`);let a={name:p.name,description:p.description,license:p.license||void 0,compatibility:p.compatibility||void 0,metadata:p.metadata||void 0,content:p.content||void 0,subSkills:p.subSkills||void 0},r=await Y(`/api/skills/${i.id}`,a);if(r.success){C.success(s("chatWorkspace.skillNode.updated"));let y=r.data||p;A(y),n({...y,id:y.name}),u(Object.entries(y.metadata||{}).map(([Fe,Me])=>({key:Fe,value:Me}))),x(!1),D?.(y)}else C.error(r.message||s("chatWorkspace.skillNode.updateFailed"))}catch(t){C.error(t.message||s("chatWorkspace.skillNode.updateError"))}finally{L(!1)}},Re=(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"row",gap:24},children:[(0,e.jsxs)("div",{style:{flex:"0 0 320px",display:"flex",flexDirection:"column",gap:12},children:[(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.description")}),(0,e.jsx)(Ne,{value:p.description,onChange:t=>l("description",t.target.value),placeholder:s("chatWorkspace.skills.field.description"),rows:3})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.license")}),(0,e.jsx)(R,{value:p.license,onChange:t=>l("license",t.target.value),placeholder:s("chatWorkspace.skills.field.license")})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.compatibility")}),(0,e.jsx)(R,{value:p.compatibility,onChange:t=>l("compatibility",t.target.value),placeholder:s("chatWorkspace.skills.field.compatibility")})]}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:s("chatWorkspace.skills.field.metadata")}),(0,e.jsx)(v,{size:"small",icon:(0,e.jsx)(U,{}),onClick:We,children:s("chatWorkspace.skillNode.add")})]}),(0,e.jsxs)(B,{direction:"vertical",size:8,style:{width:"100%"},children:[c.length===0&&(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextTertiary},children:s("chatWorkspace.skillNode.noMetadata")}),c.map((t,a)=>(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextSecondary},children:s("chatWorkspace.skillNode.meta",{index:a+1})}),(0,e.jsxs)(B,{style:{width:"100%"},size:8,wrap:!0,children:[(0,e.jsx)(R,{value:t.key,placeholder:s("chatWorkspace.skillNode.keyPlaceholder"),style:{width:120},onChange:r=>te(a,"key",r.target.value)}),(0,e.jsx)(R,{value:t.value,placeholder:s("chatWorkspace.skillNode.valuePlaceholder"),style:{flex:1,minWidth:160},onChange:r=>te(a,"value",r.target.value)})]})]},a))]})]}),(0,e.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6,minWidth:400},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.content")}),(0,e.jsx)(Ne,{value:p.content,onChange:t=>l("content",t.target.value),placeholder:s("chatWorkspace.skillNode.contentPlaceholder"),rows:30,style:{fontFamily:"monospace",fontSize:13,flex:1,minHeight:600}})]})]}),Ie=(0,e.jsxs)("div",{style:{width:z?960:720,maxHeight:"95vh",overflowY:"auto",padding:24},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:16},children:(0,e.jsxs)("div",{style:{flex:1},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(d,{strong:!0,style:{fontSize:18,fontWeight:600,color:o.colorText},children:i.name}),(0,e.jsx)(E,{style:{margin:0,fontSize:10,padding:"2px 8px",fontWeight:600},color:"geekblue",children:X.toUpperCase()})]}),(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6},children:(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:`>_ ${i.id}`})})]})}),z?Re:(0,e.jsxs)(e.Fragment,{children:[i.description&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(d,{style:{fontSize:12,color:o.colorText,lineHeight:1.6,fontStyle:"italic"},children:['"',i.description,'"']})}),T.length>0&&(0,e.jsxs)("div",{style:{marginBottom:16},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(ye,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:s("chatWorkspace.skillNode.metadataCount",{count:T.length})})]}),(0,e.jsx)("div",{style:{border:`1px solid ${o.colorBorderSecondary}`,borderRadius:6,overflow:"hidden"},children:T.map(([t,a],r)=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"stretch",borderBottom:r===T.length-1?"none":`1px solid ${o.colorBorderSecondary}`},children:[(0,e.jsx)("div",{style:{width:140,padding:"8px 10px",background:o.colorFillTertiary,borderRight:`1px solid ${o.colorBorderSecondary}`,fontSize:11,color:o.colorTextSecondary,fontWeight:600,textTransform:"capitalize"},children:t}),(0,e.jsx)("div",{style:{flex:1,padding:"8px 10px",fontSize:11,color:o.colorText,wordBreak:"break-word"},children:a})]},t))})]}),O&&(0,e.jsxs)("div",{style:{marginBottom:16},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(re,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsxs)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:["Sub-Skills (",i.subSkills.length,")"]})]}),(0,e.jsx)(B,{size:[8,8],wrap:!0,children:i.subSkills.map((t,a)=>(0,e.jsx)(E,{style:{fontSize:11,padding:"4px 12px",backgroundColor:o.colorFillTertiary,color:o.colorText,border:`1px solid ${o.colorBorderSecondary}`},children:t},a))})]}),(i.license||i.compatibility)&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(B,{size:[8,8],wrap:!0,children:[i.license&&(0,e.jsx)(E,{icon:(0,e.jsx)(de,{}),style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:o.colorInfoBg,color:o.colorInfo,border:`1px solid ${o.colorInfoBorder}`,fontWeight:500,lineHeight:"16px"},children:i.license}),i.compatibility&&(0,e.jsx)(E,{style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:o.colorSuccessBg,color:o.colorSuccess,border:`1px solid ${o.colorSuccessBorder}`,fontWeight:500,lineHeight:"16px",display:"inline-flex",alignItems:"center",gap:4},children:i.compatibility})]})}),(i.createdAt||i.updatedAt)&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(B,{direction:"vertical",size:4,children:[i.createdAt&&(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:["Created: ",P(i.createdAt)]}),i.updatedAt&&(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:["Updated: ",P(i.updatedAt)]})]})}),i.content&&(0,e.jsxs)("div",{style:{marginBottom:0},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(pe,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:600,letterSpacing:.5},children:s("chatWorkspace.skillNode.contentSection")})]}),(0,e.jsx)("div",{style:{padding:16,background:o.colorFillTertiary,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:6,maxHeight:400,overflowY:"auto"},children:(0,e.jsx)(d,{style:{fontSize:12,color:o.colorText,lineHeight:1.7,whiteSpace:"pre-wrap",fontFamily:"monospace"},children:i.content})})]})]}),(0,e.jsx)(ie,{style:{margin:"16px 0"}}),(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:z?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(v,{block:!0,onClick:()=>{x(!1),n(g)},style:{flex:1},children:s("common.cancel")}),(0,e.jsx)(v,{type:"primary",block:!0,onClick:Be,loading:Q,style:{flex:1},children:s("common.save")})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(v,{type:"primary",block:!0,onClick:()=>x(!0),style:{flex:1},children:s("chatWorkspace.skillNode.edit")}),(0,e.jsx)(v,{danger:!0,onClick:t=>{t.stopPropagation(),H(t)},children:s("common.delete")}),(0,e.jsx)(v,{icon:(0,e.jsx)(ce,{}),onClick:()=>J(i.id),title:s("chatWorkspace.skillNode.copyId")})]})})]});return(0,e.jsxs)("div",{style:{position:"relative",padding:4,overflow:"visible"},children:[(0,e.jsx)(ee,{type:"source",position:Z.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:1,height:1,borderRadius:"50%",pointerEvents:"none"},isConnectable:!1}),(0,e.jsx)(ee,{type:"target",position:Z.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:1,height:1,borderRadius:"50%",pointerEvents:"none"},isConnectable:!1}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",position:"relative"},onClick:()=>M(!0),children:[(0,e.jsx)("div",{style:{width:F,height:F,borderRadius:"50%",background:"#999",flexShrink:0,boxShadow:"0 1px 4px rgba(0,0,0,0.15)",transition:"transform 0.15s ease"},onMouseEnter:t=>{t.currentTarget.style.transform="scale(1.15)"},onMouseLeave:t=>{t.currentTarget.style.transform="scale(1)"}}),I&&(0,e.jsx)(d,{style:{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:4,fontSize:10,color:o.colorTextSecondary,opacity:.45,whiteSpace:"nowrap",pointerEvents:"none",userSelect:"none"},children:i.name})]}),(0,e.jsx)(le,{open:$,onCancel:()=>{M(!1),x(!1),n({...i,id:i.name})},footer:null,width:z?1e3:760,destroyOnClose:!0,title:null,styles:{body:{padding:0}},children:Ie})]})},ze=Ee;var f=W(K()),De=({onNodeClick:b})=>{let s=q(),[o,w,Y]=ve([]),[N,I,G]=be([]),[g,D]=(0,h.useState)(!1),[S,i]=(0,h.useState)([]),[A,O]=(0,h.useState)(!1),[m,F]=(0,h.useState)(null),{token:X}=_.useToken(),{get:T}=V(),P=(0,h.useMemo)(()=>({skill:ze}),[]),J=(0,h.useMemo)(()=>m===null?o:o.map(n=>{let c=n.id===m||N.some(u=>u.source===m&&u.target===n.id||u.target===m&&u.source===n.id);return{...n,style:{opacity:c?1:.2,transition:"opacity 0.2s ease"}}}),[o,N,m]),z=(0,h.useMemo)(()=>m===null?N.map(n=>({...n,style:{stroke:"#1677ff",strokeWidth:1.5,opacity:.25,transition:"opacity 0.2s ease"}})):N.map(n=>{let c=n.source===m||n.target===m;return{...n,style:{stroke:"#1677ff",strokeWidth:c?2.5:1,opacity:c?1:.04,transition:"opacity 0.2s ease"}}}),[N,m]),x=async()=>{O(!0);try{let n=await T("/api/skills");n.success&&n.data&&Array.isArray(n.data.records)&&i(n.data.records)}catch(n){console.error("Failed to fetch skills:",n),i([])}finally{O(!1)}};(0,h.useEffect)(()=>{x()},[]),(0,h.useEffect)(()=>{if(!S||S.length===0){w([]),I([]);return}let n=[],c=new Map,u=[];S.forEach(l=>{c.set(l.name,l),l.subSkills&&l.subSkills.length>0&&l.subSkills.forEach(H=>{S.find(j=>j.name===H)&&u.push({source:l.name,target:H})})});let $=S.map(l=>({id:l.name})),M=u.map(l=>({source:l.source,target:l.target})),Q=ue($).force("link",me(M).id(l=>l.id).distance(80)).force("charge",ke().strength(-300)).force("center",fe(0,0)).force("collide",ge(30)).stop();for(let l=0;l<300;l++)Q.tick();let L=$.map(l=>({id:l.id,type:"skill",data:{skill:c.get(l.id),onClick:()=>b?.(c.get(l.id)),onDelete:x},position:{x:l.x,y:l.y}}));u.forEach(l=>{c.has(l.source)&&c.has(l.target)&&n.push({id:`e${l.source}-${l.target}`,source:l.source,target:l.target,style:{stroke:"#1677ff",strokeWidth:2},type:"straight"})}),w(L),I(n)},[S,w,I,b]);let p=async()=>{await x()};return A?(0,f.jsx)("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"#fafafa"},children:s("chat.skills.loading")}):(0,f.jsxs)("div",{style:{width:"100%",height:"100%",background:"#fafafa",position:"relative"},children:[(0,f.jsxs)(xe,{nodes:J,edges:z,onNodesChange:Y,onEdgesChange:G,onNodeMouseEnter:(n,c)=>F(c.id),onNodeMouseLeave:()=>F(null),nodeTypes:P,fitView:!0,children:[(0,f.jsx)(Te,{color:"#eee",gap:20}),(0,f.jsx)(Ce,{})]}),(0,f.jsx)("div",{style:{position:"absolute",top:20,right:20,zIndex:10},children:(0,f.jsx)(v,{type:"primary",size:"large",icon:(0,f.jsx)(U,{}),onClick:()=>D(!0),style:{height:48,width:48,borderRadius:"50%",boxShadow:X.boxShadowTertiary,display:"flex",alignItems:"center",justifyContent:"center",padding:0}})}),(0,f.jsx)(we,{open:g,onCancel:()=>D(!1),onSuccess:p})]})},Ae=b=>(0,f.jsx)(Se,{children:(0,f.jsx)(De,{...b})}),nt=Ae;export{nt as default};
|
|
1
|
+
import{b as Z,c as he,e as ee,f as Se,g as xe,h as ve,i as be,l as Te,m as Ce}from"./embed-page-chunk-DJKD2PHO.js";import{a as fe,b as ge,c as me,d as ue,e as ke}from"./embed-page-chunk-SV2BM3WO.js";import"./embed-page-chunk-S4XZPBRM.js";import{a as V,b as we}from"./embed-page-chunk-ONXC5S22.js";import{o as se,t as ne}from"./embed-page-chunk-6ZHR5GWS.js";import{k as q}from"./embed-page-chunk-YCTDKWKW.js";import{a as K}from"./embed-page-chunk-QV7QAJ4N.js";import{D as ce,E as de,Ja as U,ea as pe,o as re,sa as ye}from"./embed-page-chunk-B2KNZ3EW.js";import{Ia as R,La as C,Ma as le,Za as E,_ as v,_a as _,bb as ae,ua as ie,za as B}from"./embed-page-chunk-F7TA3LRH.js";import{a as oe}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-EUOOO2LS.js";import{f as W}from"./embed-page-chunk-QBTAJ2YI.js";var h=W(oe());var k=W(oe());var e=W(K()),{Text:d}=ae,{TextArea:Ne}=R,Ee=({data:b})=>{let s=q(),{token:o}=_.useToken(),{config:w}=ne(),{put:Y}=V(),I=he(t=>t.transform[2])>.6,G=se("__GLOBAL__");if(!b)return null;let{skill:g,onClick:D,onDelete:S}=b;if(!g)return null;let[i,A]=(0,k.useState)(g),O=i.subSkills&&i.subSkills.length>0,m=i.subSkills?.length||0,F=(0,k.useMemo)(()=>Math.min(12+Math.sqrt(m)*10,48),[m]),X=i.metadata&&i.metadata.category||"global",T=(0,k.useMemo)(()=>i.metadata?Object.entries(i.metadata).filter(([t,a])=>t&&a):[],[i.metadata]),P=t=>{if(!t)return"";let a=t instanceof Date?t:new Date(t);return Number.isNaN(a.getTime())?"":a.toLocaleString()},J=t=>{navigator.clipboard.writeText(t)},[z,x]=(0,k.useState)(!1),[p,n]=(0,k.useState)({...g,id:g.name}),[c,u]=(0,k.useState)(T.map(([t,a])=>({key:t,value:a}))),[$,M]=(0,k.useState)(!1),[Q,L]=(0,k.useState)(!1);(0,k.useEffect)(()=>{x(!1),A(g),n({...g,id:g.name}),u(Object.entries(g.metadata||{}).map(([t,a])=>({key:t,value:a})))},[g]);let l=(t,a)=>{if(t==="name"){n(r=>({...r,name:a,id:a}));return}n(r=>({...r,[t]:a}))},H=async t=>{t?.stopPropagation(),t?.preventDefault();try{let a=i.id||i.name;if(!a){C.error(s("chatWorkspace.skillNode.idMissing"));return}await G.skills.delete(a),C.success(s("chatWorkspace.skillNode.deleted")),M(!1),S&&await S()}catch(a){C.error(a?.message||s("chatWorkspace.skillNode.deleteFailed"))}},j=t=>{u(t);let a=t.reduce((r,y)=>(y.key&&(r[y.key]=y.value),r),{});n(r=>({...r,metadata:a}))},te=(t,a,r)=>{let y=[...c];y[t]={...y[t],[a]:r},j(y)},We=()=>{j([...c,{key:"",value:""}])},Be=async()=>{try{L(!0);let t={"Content-Type":"application/json"};w.apiKey&&(t.Authorization=`Bearer ${w.apiKey}`);let a={name:p.name,description:p.description,license:p.license||void 0,compatibility:p.compatibility||void 0,metadata:p.metadata||void 0,content:p.content||void 0,subSkills:p.subSkills||void 0},r=await Y(`/api/skills/${i.id}`,a);if(r.success){C.success(s("chatWorkspace.skillNode.updated"));let y=r.data||p;A(y),n({...y,id:y.name}),u(Object.entries(y.metadata||{}).map(([Fe,Me])=>({key:Fe,value:Me}))),x(!1),D?.(y)}else C.error(r.message||s("chatWorkspace.skillNode.updateFailed"))}catch(t){C.error(t.message||s("chatWorkspace.skillNode.updateError"))}finally{L(!1)}},Re=(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"row",gap:24},children:[(0,e.jsxs)("div",{style:{flex:"0 0 320px",display:"flex",flexDirection:"column",gap:12},children:[(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.description")}),(0,e.jsx)(Ne,{value:p.description,onChange:t=>l("description",t.target.value),placeholder:s("chatWorkspace.skills.field.description"),rows:3})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.license")}),(0,e.jsx)(R,{value:p.license,onChange:t=>l("license",t.target.value),placeholder:s("chatWorkspace.skills.field.license")})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.compatibility")}),(0,e.jsx)(R,{value:p.compatibility,onChange:t=>l("compatibility",t.target.value),placeholder:s("chatWorkspace.skills.field.compatibility")})]}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:s("chatWorkspace.skills.field.metadata")}),(0,e.jsx)(v,{size:"small",icon:(0,e.jsx)(U,{}),onClick:We,children:s("chatWorkspace.skillNode.add")})]}),(0,e.jsxs)(B,{direction:"vertical",size:8,style:{width:"100%"},children:[c.length===0&&(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextTertiary},children:s("chatWorkspace.skillNode.noMetadata")}),c.map((t,a)=>(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextSecondary},children:s("chatWorkspace.skillNode.meta",{index:a+1})}),(0,e.jsxs)(B,{style:{width:"100%"},size:8,wrap:!0,children:[(0,e.jsx)(R,{value:t.key,placeholder:s("chatWorkspace.skillNode.keyPlaceholder"),style:{width:120},onChange:r=>te(a,"key",r.target.value)}),(0,e.jsx)(R,{value:t.value,placeholder:s("chatWorkspace.skillNode.valuePlaceholder"),style:{flex:1,minWidth:160},onChange:r=>te(a,"value",r.target.value)})]})]},a))]})]}),(0,e.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6,minWidth:400},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.content")}),(0,e.jsx)(Ne,{value:p.content,onChange:t=>l("content",t.target.value),placeholder:s("chatWorkspace.skillNode.contentPlaceholder"),rows:30,style:{fontFamily:"monospace",fontSize:13,flex:1,minHeight:600}})]})]}),Ie=(0,e.jsxs)("div",{style:{width:z?960:720,maxHeight:"95vh",overflowY:"auto",padding:24},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:16},children:(0,e.jsxs)("div",{style:{flex:1},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(d,{strong:!0,style:{fontSize:18,fontWeight:600,color:o.colorText},children:i.name}),(0,e.jsx)(E,{style:{margin:0,fontSize:10,padding:"2px 8px",fontWeight:600},color:"geekblue",children:X.toUpperCase()})]}),(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6},children:(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:`>_ ${i.id}`})})]})}),z?Re:(0,e.jsxs)(e.Fragment,{children:[i.description&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(d,{style:{fontSize:12,color:o.colorText,lineHeight:1.6,fontStyle:"italic"},children:['"',i.description,'"']})}),T.length>0&&(0,e.jsxs)("div",{style:{marginBottom:16},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(ye,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:s("chatWorkspace.skillNode.metadataCount",{count:T.length})})]}),(0,e.jsx)("div",{style:{border:`1px solid ${o.colorBorderSecondary}`,borderRadius:6,overflow:"hidden"},children:T.map(([t,a],r)=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"stretch",borderBottom:r===T.length-1?"none":`1px solid ${o.colorBorderSecondary}`},children:[(0,e.jsx)("div",{style:{width:140,padding:"8px 10px",background:o.colorFillTertiary,borderRight:`1px solid ${o.colorBorderSecondary}`,fontSize:11,color:o.colorTextSecondary,fontWeight:600,textTransform:"capitalize"},children:t}),(0,e.jsx)("div",{style:{flex:1,padding:"8px 10px",fontSize:11,color:o.colorText,wordBreak:"break-word"},children:a})]},t))})]}),O&&(0,e.jsxs)("div",{style:{marginBottom:16},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(re,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsxs)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:["Sub-Skills (",i.subSkills.length,")"]})]}),(0,e.jsx)(B,{size:[8,8],wrap:!0,children:i.subSkills.map((t,a)=>(0,e.jsx)(E,{style:{fontSize:11,padding:"4px 12px",backgroundColor:o.colorFillTertiary,color:o.colorText,border:`1px solid ${o.colorBorderSecondary}`},children:t},a))})]}),(i.license||i.compatibility)&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(B,{size:[8,8],wrap:!0,children:[i.license&&(0,e.jsx)(E,{icon:(0,e.jsx)(de,{}),style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:o.colorInfoBg,color:o.colorInfo,border:`1px solid ${o.colorInfoBorder}`,fontWeight:500,lineHeight:"16px"},children:i.license}),i.compatibility&&(0,e.jsx)(E,{style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:o.colorSuccessBg,color:o.colorSuccess,border:`1px solid ${o.colorSuccessBorder}`,fontWeight:500,lineHeight:"16px",display:"inline-flex",alignItems:"center",gap:4},children:i.compatibility})]})}),(i.createdAt||i.updatedAt)&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(B,{direction:"vertical",size:4,children:[i.createdAt&&(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:["Created: ",P(i.createdAt)]}),i.updatedAt&&(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:["Updated: ",P(i.updatedAt)]})]})}),i.content&&(0,e.jsxs)("div",{style:{marginBottom:0},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(pe,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:600,letterSpacing:.5},children:s("chatWorkspace.skillNode.contentSection")})]}),(0,e.jsx)("div",{style:{padding:16,background:o.colorFillTertiary,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:6,maxHeight:400,overflowY:"auto"},children:(0,e.jsx)(d,{style:{fontSize:12,color:o.colorText,lineHeight:1.7,whiteSpace:"pre-wrap",fontFamily:"monospace"},children:i.content})})]})]}),(0,e.jsx)(ie,{style:{margin:"16px 0"}}),(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:z?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(v,{block:!0,onClick:()=>{x(!1),n(g)},style:{flex:1},children:s("common.cancel")}),(0,e.jsx)(v,{type:"primary",block:!0,onClick:Be,loading:Q,style:{flex:1},children:s("common.save")})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(v,{type:"primary",block:!0,onClick:()=>x(!0),style:{flex:1},children:s("chatWorkspace.skillNode.edit")}),(0,e.jsx)(v,{danger:!0,onClick:t=>{t.stopPropagation(),H(t)},children:s("common.delete")}),(0,e.jsx)(v,{icon:(0,e.jsx)(ce,{}),onClick:()=>J(i.id),title:s("chatWorkspace.skillNode.copyId")})]})})]});return(0,e.jsxs)("div",{style:{position:"relative",padding:4,overflow:"visible"},children:[(0,e.jsx)(ee,{type:"source",position:Z.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:1,height:1,borderRadius:"50%",pointerEvents:"none"},isConnectable:!1}),(0,e.jsx)(ee,{type:"target",position:Z.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:1,height:1,borderRadius:"50%",pointerEvents:"none"},isConnectable:!1}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",position:"relative"},onClick:()=>M(!0),children:[(0,e.jsx)("div",{style:{width:F,height:F,borderRadius:"50%",background:"#999",flexShrink:0,boxShadow:"0 1px 4px rgba(0,0,0,0.15)",transition:"transform 0.15s ease"},onMouseEnter:t=>{t.currentTarget.style.transform="scale(1.15)"},onMouseLeave:t=>{t.currentTarget.style.transform="scale(1)"}}),I&&(0,e.jsx)(d,{style:{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:4,fontSize:10,color:o.colorTextSecondary,opacity:.45,whiteSpace:"nowrap",pointerEvents:"none",userSelect:"none"},children:i.name})]}),(0,e.jsx)(le,{open:$,onCancel:()=>{M(!1),x(!1),n({...i,id:i.name})},footer:null,width:z?1e3:760,destroyOnClose:!0,title:null,styles:{body:{padding:0}},children:Ie})]})},ze=Ee;var f=W(K()),De=({onNodeClick:b})=>{let s=q(),[o,w,Y]=ve([]),[N,I,G]=be([]),[g,D]=(0,h.useState)(!1),[S,i]=(0,h.useState)([]),[A,O]=(0,h.useState)(!1),[m,F]=(0,h.useState)(null),{token:X}=_.useToken(),{get:T}=V(),P=(0,h.useMemo)(()=>({skill:ze}),[]),J=(0,h.useMemo)(()=>m===null?o:o.map(n=>{let c=n.id===m||N.some(u=>u.source===m&&u.target===n.id||u.target===m&&u.source===n.id);return{...n,style:{opacity:c?1:.2,transition:"opacity 0.2s ease"}}}),[o,N,m]),z=(0,h.useMemo)(()=>m===null?N.map(n=>({...n,style:{stroke:"#1677ff",strokeWidth:1.5,opacity:.25,transition:"opacity 0.2s ease"}})):N.map(n=>{let c=n.source===m||n.target===m;return{...n,style:{stroke:"#1677ff",strokeWidth:c?2.5:1,opacity:c?1:.04,transition:"opacity 0.2s ease"}}}),[N,m]),x=async()=>{O(!0);try{let n=await T("/api/skills");n.success&&n.data&&Array.isArray(n.data.records)&&i(n.data.records)}catch(n){console.error("Failed to fetch skills:",n),i([])}finally{O(!1)}};(0,h.useEffect)(()=>{x()},[]),(0,h.useEffect)(()=>{if(!S||S.length===0){w([]),I([]);return}let n=[],c=new Map,u=[];S.forEach(l=>{c.set(l.name,l),l.subSkills&&l.subSkills.length>0&&l.subSkills.forEach(H=>{S.find(j=>j.name===H)&&u.push({source:l.name,target:H})})});let $=S.map(l=>({id:l.name})),M=u.map(l=>({source:l.source,target:l.target})),Q=ue($).force("link",me(M).id(l=>l.id).distance(80)).force("charge",ke().strength(-300)).force("center",fe(0,0)).force("collide",ge(30)).stop();for(let l=0;l<300;l++)Q.tick();let L=$.map(l=>({id:l.id,type:"skill",data:{skill:c.get(l.id),onClick:()=>b?.(c.get(l.id)),onDelete:x},position:{x:l.x,y:l.y}}));u.forEach(l=>{c.has(l.source)&&c.has(l.target)&&n.push({id:`e${l.source}-${l.target}`,source:l.source,target:l.target,style:{stroke:"#1677ff",strokeWidth:2},type:"straight"})}),w(L),I(n)},[S,w,I,b]);let p=async()=>{await x()};return A?(0,f.jsx)("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"#fafafa"},children:s("chat.skills.loading")}):(0,f.jsxs)("div",{style:{width:"100%",height:"100%",background:"#fafafa",position:"relative"},children:[(0,f.jsxs)(xe,{nodes:J,edges:z,onNodesChange:Y,onEdgesChange:G,onNodeMouseEnter:(n,c)=>F(c.id),onNodeMouseLeave:()=>F(null),nodeTypes:P,fitView:!0,children:[(0,f.jsx)(Te,{color:"#eee",gap:20}),(0,f.jsx)(Ce,{})]}),(0,f.jsx)("div",{style:{position:"absolute",top:20,right:20,zIndex:10},children:(0,f.jsx)(v,{type:"primary",size:"large",icon:(0,f.jsx)(U,{}),onClick:()=>D(!0),style:{height:48,width:48,borderRadius:"50%",boxShadow:X.boxShadowTertiary,display:"flex",alignItems:"center",justifyContent:"center",padding:0}})}),(0,f.jsx)(we,{open:g,onCancel:()=>D(!1),onSuccess:p})]})},Ae=b=>(0,f.jsx)(Se,{children:(0,f.jsx)(De,{...b})}),nt=Ae;export{nt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ze}from"./embed-page-chunk-
|
|
1
|
+
import{a as Ze}from"./embed-page-chunk-5XP4FJW7.js";import{c as qe,d as Ke}from"./embed-page-chunk-GSUSX54K.js";import{b as Ne,e as Ie,h as He,i as We}from"./embed-page-chunk-DJKD2PHO.js";import"./embed-page-chunk-S4XZPBRM.js";import{C as Ve,D as Ue,E as ue,F as Re,G as Ye,H as Qe,I as Je,K as Xe,L as et,M as tt,N as ot,r as Ge}from"./embed-page-chunk-SQSVDSG6.js";import{g as q,i as _e}from"./embed-page-chunk-NNQHJZ5Q.js";import"./embed-page-chunk-ONXC5S22.js";import{l as Ee,o as Oe}from"./embed-page-chunk-6ZHR5GWS.js";import{I as Fe,Qa as me,n as ce,ya as pe}from"./embed-page-chunk-F7ZUYG42.js";import{k as j}from"./embed-page-chunk-YCTDKWKW.js";import{a as A}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-34RWKVD7.js";import"./embed-page-chunk-B2KNZ3EW.js";import{Da as W,Ia as Ce,Ja as J,Ma as ze,Sa as le,Za as Me,_ as ae,aa as Be,ba as Le,bb as de,fa as be,va as De}from"./embed-page-chunk-F7TA3LRH.js";import{a as se}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as T}from"./embed-page-chunk-QBTAJ2YI.js";var n=T(se());var it=T(se());var s=T(A()),Tt=[{key:"pending",color:"#7A7A7A"},{key:"in_progress",color:"#3b82f6"},{key:"failed",color:"#ef4444"},{key:"interrupted",color:"#8b5cf6"},{key:"completed",color:"#22c55e"}],rt={high:"#ef4444",medium:"#f59e0b",low:"#22c55e"};function bt(e){return e==="high"||e==="low"?e:"medium"}function Ct(e,i){let f=typeof e=="string"?new Date(e):e,a=new Date().getTime()-f.getTime(),k=Math.floor(a/1e3),o=Math.floor(k/60),r=Math.floor(o/60),l=Math.floor(r/24);return k<60?i("common.time.justNow"):o<60?i("common.time.minutesAgo",{count:o}):r<24?i("common.time.hoursAgo",{count:r}):l<30?i("common.time.daysAgo",{count:l}):f.toLocaleDateString(i.locale)}var Nt=q(({css:e,token:i})=>({container:e`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
height: 100%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as ue,q as he}from"./embed-page-chunk-
|
|
1
|
+
import{k as ue,q as he}from"./embed-page-chunk-NNQHJZ5Q.js";import{o as oe}from"./embed-page-chunk-6ZHR5GWS.js";import{Aa as le,L as ce,La as de,O as se,Wa as Ae}from"./embed-page-chunk-F7ZUYG42.js";import{k as re}from"./embed-page-chunk-YCTDKWKW.js";import{a as ie}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-B2KNZ3EW.js";import{Ma as ae,Oa as C,W as d,Ya as L,Za as S,_ as u,ba as F,bb as c,qa as te,xa as ne,za as h}from"./embed-page-chunk-F7TA3LRH.js";import{a as Pe}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-EUOOO2LS.js";import{f as I}from"./embed-page-chunk-QBTAJ2YI.js";var a=I(Pe());var _=I(Ae());var t=I(ie());function f(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Ee(r){if(!f(r))return;let e=r.checkpoint;if(f(e)&&typeof e.checkpoint_id=="string")return e.checkpoint_id;let o=r.config;if(f(o)&&f(o.configurable)){let s=o.configurable.checkpoint_id;if(typeof s=="string")return s}}function ze(r){if(!f(r))return;if(typeof r.createdAt=="string")return r.createdAt;let e=r.checkpoint;if(f(e)&&typeof e.ts=="string")return e.ts}function He(r){switch(r){case"pending":return"blue";case"running":return"processing";case"success":return"green";case"error":case"failed":case"timeout":return"red";case"interrupted":return"orange";default:return}}function Fe(r){return r==="pending"||r==="running"}function Le(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(2)} MB`}var We=({data:r})=>{let e=re(),o=r?.threadId,s=r?.assistantId,l=oe(s||"__no_assistant__"),D=(0,a.useContext)(ue),{closeSideApp:pe}=he(),[m,ge]=(0,a.useState)(null),[T,ye]=(0,a.useState)(null),[fe,me]=(0,a.useState)([]),[Te,Me]=(0,a.useState)([]),[v,R]=(0,a.useState)(!0),[K,M]=(0,a.useState)(null),[Y,O]=(0,a.useState)(null),[p,J]=(0,a.useState)({}),[b,N]=(0,a.useState)(null),[xe,W]=(0,a.useState)(!1),[ke,B]=(0,a.useState)(""),[we,$]=(0,a.useState)(!1),[Ce,G]=(0,a.useState)(!1),[P,Ie]=(0,a.useState)(null),[U,V]=(0,a.useState)(!1),[A,j]=(0,a.useState)(5),E=(0,a.useRef)(0),x=(0,a.useRef)(0),g=(0,a.useCallback)(async()=>{if(!o||!s){R(!1);return}let n=++E.current;R(!0),J({});let[i,k,X,Z]=await Promise.allSettled([l.getThreadStatus(o),l.getThreadStorage(o),l.getThreadHistory(o,{limit:10}),l.runs.list(o,s)]);if(n!==E.current)return;let w={};i.status==="fulfilled"?ge(i.value):w.status=e("chat.threadMaintenance.statusLoadFailed"),k.status==="fulfilled"?ye(k.value):w.storage=e("chat.threadMaintenance.storageLoadFailed"),X.status==="fulfilled"?me(X.value.flatMap(H=>{let ee=Ee(H);return ee===void 0?[]:[{id:ee,createdAt:ze(H),raw:H}]})):w.history=e("chat.threadMaintenance.historyLoadFailed"),Z.status==="fulfilled"?Me(Z.value):w.runs=e("chat.threadMaintenance.runsLoadFailed"),J(w),R(!1)},[s,l,e,o]);(0,a.useEffect)(()=>(g(),()=>{E.current+=1}),[g]);let Se=async n=>{if(!o)return;let i=++x.current;W(!0),$(!0),B("");try{let k=await l.getThreadStateAtCheckpoint(o,n.id);i===x.current&&B(JSON.stringify(k,null,2))}catch{i===x.current&&B(e("chat.threadMaintenance.stateFailed"))}finally{i===x.current&&$(!1)}},ve=()=>{x.current+=1,W(!1)},Re=async()=>{if(o){G(!0),M(null);try{let n=await l.copyThread(o);Ie(n.id)}catch{M(e("chat.threadMaintenance.copyFailed"))}finally{G(!1)}}},q=async n=>{if(!o)return;V(!0),M(null);let i=Math.min(100,Math.max(1,Math.trunc(A)));j(i);try{if(!(await l.pruneThread(o,n==="delete"?{strategy:n}:{strategy:n,keep:i})).pruned){M(e("chat.threadMaintenance.pruneFailed"));return}if(n==="delete"){pe();return}await g()}catch{M(e("chat.threadMaintenance.pruneFailed"))}finally{V(!1)}},z=(0,a.useCallback)(async(n,i)=>{if(!(!o||!s)){N(n),O(null);try{await l.runs.cancel(o,n,{action:i},s),await g()}catch{O(e("chat.threadMaintenance.runCancelFailed"))}finally{N(null)}}},[s,l,g,e,o]),Q=m?.interrupts??[],be=(0,a.useMemo)(()=>[{title:e("chat.threadMaintenance.runStatus"),dataIndex:"status",render:n=>(0,t.jsx)(S,{color:He(n),children:n})},{title:e("chat.threadMaintenance.runId"),dataIndex:"runId",render:n=>(0,t.jsx)(c.Text,{code:!0,ellipsis:{tooltip:n},style:{maxWidth:180},children:n})},{title:e("chat.threadMaintenance.runCreated"),dataIndex:"createdAt",render:n=>(0,_.default)(n).format("YYYY-MM-DD HH:mm:ss")},{title:e("chat.threadMaintenance.runOwner"),key:"owner",render:(n,i)=>(0,t.jsxs)(h,{size:4,children:[(0,t.jsx)(c.Text,{children:i.owner??"\u2014"}),(0,t.jsx)(c.Text,{type:"secondary",children:"/"}),(0,t.jsx)(c.Text,{type:"secondary",children:i.attempts})]})},{key:"actions",render:(n,i)=>Fe(i.status)?(0,t.jsxs)(h,{size:4,children:[(0,t.jsx)(C,{title:e("chat.threadMaintenance.interruptRunConfirm"),okText:e("chat.threadMaintenance.interruptRun"),cancelText:e("common.cancel"),onConfirm:()=>void z(i.runId,"interrupt"),children:(0,t.jsx)(u,{size:"small",type:"link",loading:b===i.runId,children:e("chat.threadMaintenance.interruptRun")})}),(0,t.jsx)(C,{title:e("chat.threadMaintenance.rollbackRunConfirm"),okText:e("chat.threadMaintenance.rollbackRun"),cancelText:e("common.cancel"),onConfirm:()=>void z(i.runId,"rollback"),children:(0,t.jsx)(u,{size:"small",type:"link",danger:!0,loading:b===i.runId,children:e("chat.threadMaintenance.rollbackRun")})})]}):null}],[z,b,e]),Be=(0,a.useMemo)(()=>[{title:e("chat.threadMaintenance.checkpointId"),dataIndex:"id",render:n=>(0,t.jsx)(c.Text,{code:!0,children:n})},{title:e("chat.threadMaintenance.checkpointTime"),dataIndex:"createdAt",render:n=>n?(0,_.default)(n).format("YYYY-MM-DD HH:mm:ss"):e("chat.threadMaintenance.unknown")},{key:"actions",render:(n,i)=>(0,t.jsx)(u,{size:"small",type:"link",onClick:()=>void Se(i),children:e("chat.threadMaintenance.viewState")})}],[e]);return!o||!s?(0,t.jsx)(d,{type:"warning",showIcon:!0,message:e("chat.threadMaintenance.missingContext")}):(0,t.jsxs)(te,{title:(0,t.jsxs)(h,{children:[(0,t.jsx)(se,{size:16}),e("chat.threadMaintenance.title")]}),extra:(0,t.jsxs)(h,{wrap:!0,children:[(0,t.jsx)(u,{icon:(0,t.jsx)(le,{size:14}),onClick:()=>void g(),loading:v,children:e("common.refresh")}),(0,t.jsx)(u,{icon:(0,t.jsx)(ce,{size:14}),loading:Ce,onClick:()=>void Re(),children:e("chat.threadMaintenance.copy")})]}),children:[(0,t.jsxs)(h,{direction:"vertical",size:14,style:{width:"100%"},children:[K?(0,t.jsx)(d,{type:"error",showIcon:!0,message:K}):null,p.status?(0,t.jsx)(d,{type:"error",showIcon:!0,message:p.status}):null,p.storage?(0,t.jsx)(d,{type:"warning",showIcon:!0,message:p.storage}):null,p.history?(0,t.jsx)(d,{type:"warning",showIcon:!0,message:p.history}):null,p.runs?(0,t.jsx)(d,{type:"warning",showIcon:!0,message:p.runs}):null,P?(0,t.jsx)(d,{type:"success",showIcon:!0,message:e("chat.threadMaintenance.copySuccess",{id:P}),action:D?.selectThread?(0,t.jsx)(u,{size:"small",onClick:()=>D.selectThread(P),children:e("chat.threadMaintenance.switchToCopy")}):null}):null,(0,t.jsxs)(h,{wrap:!0,size:16,children:[(0,t.jsx)(y,{label:e("chat.threadMaintenance.status"),children:(0,t.jsx)(S,{color:m?.status==="idle"?"green":m?.status==="error"?"red":"blue",children:m?.status??e("chat.threadMaintenance.unknown")})}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.pendingMessages"),children:m?.pendingMessages??0}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.storage"),children:T?Le(T.totalBytes):e("chat.threadMaintenance.unknown")}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.checkpoints"),children:T?.checkpoints.count??0}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.channelValues"),children:T?.channelValues.count??0}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.pendingWrites"),children:T?.pendingWrites.count??0})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Text,{strong:!0,children:e("chat.threadMaintenance.interrupts")}),(0,t.jsx)("div",{style:{marginTop:6},children:Q.length===0?(0,t.jsx)(c.Text,{type:"secondary",children:e("chat.threadMaintenance.noInterrupts")}):(0,t.jsx)(h,{wrap:!0,children:Q.map(n=>(0,t.jsxs)(S,{color:"orange",children:[n.type,": ",n.interruptId]},n.interruptId))})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Text,{strong:!0,children:e("chat.threadMaintenance.runs")}),Y?(0,t.jsx)(d,{type:"error",showIcon:!0,message:Y,style:{marginTop:6}}):null,(0,t.jsx)(L,{rowKey:"runId",size:"small",columns:be,dataSource:Te,pagination:!1,loading:v,locale:{emptyText:(0,t.jsx)(F,{description:e("chat.threadMaintenance.noRuns")})}})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Text,{strong:!0,children:e("chat.threadMaintenance.history")}),(0,t.jsx)(L,{rowKey:"id",size:"small",columns:Be,dataSource:fe,pagination:!1,loading:v,locale:{emptyText:(0,t.jsx)(F,{description:e("chat.threadMaintenance.noHistory")})}})]}),(0,t.jsxs)(h,{wrap:!0,children:[(0,t.jsx)(C,{title:e("chat.threadMaintenance.pruneDeleteTitle"),description:e("chat.threadMaintenance.pruneDeleteConfirm"),okText:e("common.delete"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onConfirm:()=>void q("delete"),children:(0,t.jsx)(u,{danger:!0,icon:(0,t.jsx)(de,{size:14}),loading:U,children:e("chat.threadMaintenance.pruneDelete")})}),(0,t.jsx)(ne,{"aria-label":e("chat.threadMaintenance.keepLabel"),min:1,max:100,precision:0,step:1,value:A,onChange:n=>{j(typeof n=="number"?Math.min(100,Math.max(1,Math.trunc(n))):1)}}),(0,t.jsx)(C,{title:e("chat.threadMaintenance.pruneKeepTitle"),description:e("chat.threadMaintenance.pruneKeepConfirm",{count:A}),okText:e("chat.threadMaintenance.pruneKeepLatest"),cancelText:e("common.cancel"),onConfirm:()=>void q("keep_latest"),children:(0,t.jsx)(u,{loading:U,children:e("chat.threadMaintenance.pruneKeepLatest")})})]})]}),(0,t.jsx)(ae,{open:xe,title:e("chat.threadMaintenance.stateTitle"),footer:null,onCancel:ve,width:720,children:we?(0,t.jsx)(c.Text,{children:e("chat.threadMaintenance.loadingState")}):(0,t.jsx)("pre",{style:{maxHeight:"60vh",overflow:"auto",margin:0},children:ke})})]})},y=({label:r,children:e})=>(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Text,{type:"secondary",style:{display:"block",fontSize:12},children:r}),(0,t.jsx)(c.Text,{strong:!0,children:e})]});export{We as ThreadMaintenancePanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ue,c as fe}from"./embed-page-chunk-
|
|
1
|
+
import{a as ue,c as fe}from"./embed-page-chunk-3UK7XM33.js";import{a as xe}from"./embed-page-chunk-GSUSX54K.js";import{a as ie,b as G,e as V,f as U,g as re,h as se,i as ae,k as le,l as de,m as ce,n as pe}from"./embed-page-chunk-DJKD2PHO.js";import"./embed-page-chunk-S4XZPBRM.js";import{j as O}from"./embed-page-chunk-SQSVDSG6.js";import"./embed-page-chunk-NNQHJZ5Q.js";import{a as j}from"./embed-page-chunk-ONXC5S22.js";import"./embed-page-chunk-6ZHR5GWS.js";import{A as oe,E as $,Pa as ne,g as te,ma as H,y as L}from"./embed-page-chunk-F7ZUYG42.js";import{k as N}from"./embed-page-chunk-YCTDKWKW.js";import{a as D}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-34RWKVD7.js";import{G as Q,Ma as ee}from"./embed-page-chunk-B2KNZ3EW.js";import{Ja as M,Ka as K,Oa as Z,Sa as X,Za as I,ba as P,bb as q,ha as B,ya as J,za as F}from"./embed-page-chunk-F7TA3LRH.js";import{a as Y}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as T}from"./embed-page-chunk-QBTAJ2YI.js";var s=T(Y());var _=T(xe());var ge=T(Y());var ye=T(D()),me=({steps:t,graphDefinition:o,assistantId:r})=>{let n=(0,ge.useMemo)(()=>fe(o),[o]);return(0,ye.jsx)(ue,{dsl:n,steps:t,assistantId:r})};var e=T(D()),ve=`
|
|
2
2
|
@keyframes spin {
|
|
3
3
|
from { transform: rotate(0deg); }
|
|
4
4
|
to { transform: rotate(360deg); }
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as $e,b as Ge}from"./embed-page-chunk-
|
|
1
|
+
import{a as $e,b as Ge}from"./embed-page-chunk-ABGWNVMG.js";import{b as Ue,c as be}from"./embed-page-chunk-3UK7XM33.js";import"./embed-page-chunk-GSUSX54K.js";import{f as Ye}from"./embed-page-chunk-DJKD2PHO.js";import"./embed-page-chunk-S4XZPBRM.js";import{S as Ke,j as He}from"./embed-page-chunk-SQSVDSG6.js";import{i as ee}from"./embed-page-chunk-NNQHJZ5Q.js";import{a as te}from"./embed-page-chunk-ONXC5S22.js";import"./embed-page-chunk-6ZHR5GWS.js";import{Ea as q,Ha as ue,I as ce,Ja as Ne,O as pe,Ra as me,Sa as Z,Ta as qe,Y as je,_ as ge,aa as fe,fa as Ee,ia as _e,l as Oe,na as Fe,o as de,t as Pe,za as Be}from"./embed-page-chunk-F7ZUYG42.js";import{k as P}from"./embed-page-chunk-YCTDKWKW.js";import{a as E}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-34RWKVD7.js";import{Ba as De,G as Te,Ja as le,Ra as Le,sa as Me}from"./embed-page-chunk-B2KNZ3EW.js";import{Da as X,Ia as J,Ja as ae,Ma as V,Oa as Ae,_ as $,ba as G,bb as Q,ha as U,qa as Ie}from"./embed-page-chunk-F7TA3LRH.js";import{a as se}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as A}from"./embed-page-chunk-QBTAJ2YI.js";var i=A(se());var oe=A(se());var j=A(E());function gt(r){let n=r.split(/[\n\r.。;;!!??]+/).filter(Boolean)[0]?.trim()||"";return n=n.replace(/[,,]+$/,"").trim(),n.length>50&&(n=n.slice(0,50)),n||(n=r.slice(0,50).trim()),n}function ft(r){let t=5381;for(let n=0;n<r.length;n++)t=(t<<5)+t+r.charCodeAt(n)>>>0;return t.toString(36).slice(0,6)}var we=({open:r,onCancel:t,onCreated:n,type:f="processing"})=>{let{post:D}=te(),l=P(),{trainingProjects:u,loading:w}=ee(),[g,m]=(0,oe.useState)(null),[y]=X.useForm(),b=u.find(h=>h.id===g)??u[0]??null;(0,oe.useEffect)(()=>{r&&(y.resetFields(),m(null))},[r,y]);let S=async()=>{if(f==="workflow"&&!b)return;let k=((await y.validateFields()).purpose||"").trim(),z=gt(k),I=`wf-${ft(k+Date.now())}`,p=f==="workflow"?{key:I,name:z,description:k,type:"workflow",prompt:"Complete the assigned task accurately and concisely.",metadata:{trainingProjectId:b?.id},workflowYaml:`name: ${I}
|
|
2
2
|
steps: []
|
|
3
3
|
`}:{key:I,name:z,description:k,type:"processing",prompt:`You are the orchestrator for workflow "${z}". Purpose: ${k}. Follow the topology to delegate tasks to sub-agents.`,tools:[],skills:[],subAgents:[],middleware:[{id:"topology",type:"topology",name:l("chatConfig.workflow.middleware.topologyName"),description:l("chatConfig.workflow.middleware.topologyDescription"),enabled:!0,config:{edges:[]}}]};await D("/api/assistants",{id:I,name:z,description:k,graphDefinition:p}),y.resetFields(),n(I,k,f==="workflow"?b?.id:void 0)};return(0,j.jsx)(V,{title:l(f==="workflow"?"chatConfig.workflow.create.title":"chatConfig.workflow.create.titleProcessing"),open:r,onCancel:t,onOk:S,okText:l("common.create"),okButtonProps:{disabled:f==="workflow"&&(w||!b)},destroyOnClose:!0,children:(0,j.jsxs)(X,{form:y,layout:"vertical",initialValues:{purpose:""},children:[(0,j.jsx)(X.Item,{name:"purpose",label:l("chatConfig.workflow.field.purpose"),rules:[{required:!0,message:l("chatConfig.workflow.validation.purposeRequired")}],children:(0,j.jsx)(J.TextArea,{placeholder:l("chatConfig.workflow.field.purposePlaceholder"),rows:4})}),f==="workflow"&&(0,j.jsx)($e,{project:b,projects:u,value:b?.id??null,onChange:m,loading:w})]})})};var Ve=A(se());var e=A(E()),{Text:ye}=Q;function ut(r){if(!r||typeof r!="object")return null;let t=r;return{modelKey:t.modelKey||t.model||void 0,tools:Array.isArray(t.tools)?t.tools:[],middleware:Array.isArray(t.middleware)?t.middleware.filter(n=>n&&typeof n=="object"&&n.type):[],subAgents:Array.isArray(t.subAgents)?t.subAgents:[],skillCategories:Array.isArray(t.skillCategories)?t.skillCategories:[],runConfig:t.runConfig&&typeof t.runConfig=="object"?t.runConfig:void 0}}var mt={filesystem:(0,e.jsx)(je,{size:12}),code_eval:(0,e.jsx)(Ne,{size:12}),browser:(0,e.jsx)(fe,{size:12}),sql:(0,e.jsx)(pe,{size:12}),skill:(0,e.jsx)(ue,{size:12}),http:(0,e.jsx)(_e,{size:12}),scheduler:(0,e.jsx)(ce,{size:12}),metrics:(0,e.jsx)(Oe,{size:12}),topology:(0,e.jsx)(ge,{size:12}),ask_user_to_clarify:(0,e.jsx)(Fe,{size:12}),widget:(0,e.jsx)(de,{size:12}),date:(0,e.jsx)(Pe,{size:12}),task:(0,e.jsx)(ge,{size:12}),custom:(0,e.jsx)(Be,{size:12}),claw:(0,e.jsx)(q,{size:12}),collection:(0,e.jsx)(Ee,{size:12})},bt={filesystem:{bg:"rgba(34,197,94,0.08)",text:"#16a34a",border:"rgba(34,197,94,0.2)"},code_eval:{bg:"rgba(99,102,241,0.08)",text:"#4f46e5",border:"rgba(99,102,241,0.2)"},browser:{bg:"rgba(59,130,246,0.08)",text:"#2563eb",border:"rgba(59,130,246,0.2)"},sql:{bg:"rgba(249,115,22,0.08)",text:"#ea580c",border:"rgba(249,115,22,0.2)"},skill:{bg:"rgba(168,85,247,0.08)",text:"#9333ea",border:"rgba(168,85,247,0.2)"},http:{bg:"rgba(20,184,166,0.08)",text:"#0d9488",border:"rgba(20,184,166,0.2)"},scheduler:{bg:"rgba(245,158,11,0.08)",text:"#d97706",border:"rgba(245,158,11,0.2)"},metrics:{bg:"rgba(236,72,153,0.08)",text:"#db2777",border:"rgba(236,72,153,0.2)"},topology:{bg:"rgba(99,102,241,0.08)",text:"#4f46e5",border:"rgba(99,102,241,0.2)"},ask_user_to_clarify:{bg:"rgba(245,158,11,0.08)",text:"#d97706",border:"rgba(245,158,11,0.2)"},widget:{bg:"rgba(20,184,166,0.08)",text:"#0d9488",border:"rgba(20,184,166,0.2)"},date:{bg:"rgba(139,92,246,0.08)",text:"#7c3aed",border:"rgba(139,92,246,0.2)"},task:{bg:"rgba(99,102,241,0.08)",text:"#4f46e5",border:"rgba(99,102,241,0.2)"},custom:{bg:"rgba(107,114,128,0.08)",text:"#4b5563",border:"rgba(107,114,128,0.2)"},claw:{bg:"rgba(107,114,128,0.08)",text:"#4b5563",border:"rgba(107,114,128,0.2)"},collection:{bg:"rgba(6,182,212,0.08)",text:"#0891b2",border:"rgba(6,182,212,0.2)"}},wt={bg:"rgba(107,114,128,0.08)",text:"#4b5563",border:"rgba(107,114,128,0.2)"};function yt(r){let t=r.split(/[_-]+/).filter(Boolean);return t.length===1?t[0].slice(0,2).toUpperCase():t.map(n=>n[0]).join("").toUpperCase().slice(0,2)}var Xe=[{bg:"rgba(99,102,241,0.1)",text:"#6366f1"},{bg:"rgba(34,197,94,0.1)",text:"#22c55e"},{bg:"rgba(245,158,11,0.1)",text:"#f59e0b"},{bg:"rgba(59,130,246,0.1)",text:"#3b82f6"},{bg:"rgba(239,68,68,0.1)",text:"#ef4444"},{bg:"rgba(168,85,247,0.1)",text:"#a855f7"},{bg:"rgba(20,184,166,0.1)",text:"#14b8a6"},{bg:"rgba(236,72,153,0.1)",text:"#ec4899"}];function Je(r){return Xe[r%Xe.length]}var H=({icon:r,label:t,count:n,children:f})=>(0,e.jsxs)("div",{style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6},children:[(0,e.jsx)("span",{style:{color:"#6366f1",display:"flex",alignItems:"center"},children:r}),(0,e.jsx)(ye,{strong:!0,style:{fontSize:11,color:"#52525b",textTransform:"uppercase",letterSpacing:"0.3px"},children:t}),(0,e.jsx)("span",{style:{fontSize:9,fontWeight:600,color:"#a1a1aa",background:"rgba(0,0,0,0.04)",borderRadius:8,padding:"1px 6px",lineHeight:"16px"},children:n})]}),f]}),Qe=({graphDef:r})=>{let t=P(),n=(0,Ve.useMemo)(()=>ut(r),[r]);if(!n)return null;let f=n.middleware.filter(l=>l.enabled!==!1),D=!1;return n.tools.length===0&&f.length===0&&n.subAgents.length===0?null:(0,e.jsx)("div",{style:{pointerEvents:"auto"},children:(0,e.jsxs)("div",{style:{background:"rgba(255,255,255,0.5)",borderRadius:8,width:250,transition:"all 0.25s ease",overflow:"hidden"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:"rgba(99,102,241,0.02)",borderBottom:"1px solid rgba(0,0,0,0.03)"},children:(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,e.jsx)("div",{style:{width:24,height:24,borderRadius:6,background:"rgba(99,102,241,0.05)",display:"flex",alignItems:"center",justifyContent:"center",color:"#6366f1"},children:(0,e.jsx)(q,{size:13})}),(0,e.jsx)(ye,{strong:!0,style:{fontSize:12,color:"#1a1a1a"},children:t("chat.environment.title")})]})}),(0,e.jsxs)("div",{style:{padding:"10px 12px 12px",maxHeight:"calc(60vh - 48px)",overflowY:"auto"},children:[n.tools.length>0&&(0,e.jsx)(H,{icon:(0,e.jsx)(qe,{size:12}),label:t("chat.environment.tools"),count:n.tools.length,children:(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:n.tools.map((l,u)=>{let w=Je(u);return(0,e.jsx)(U,{title:l,placement:"top",children:(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:w.text,background:w.bg,cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,e.jsx)("span",{style:{fontWeight:700,fontSize:9,opacity:.7},children:yt(l)}),(0,e.jsx)("span",{children:l})]})},l)})})}),f.length>0&&(0,e.jsx)(H,{icon:(0,e.jsx)(de,{size:12}),label:t("chat.environment.capabilities"),count:f.length,children:(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:f.map(l=>{let u=bt[l.type]||wt,w=mt[l.type]||(0,e.jsx)(q,{size:12});return(0,e.jsx)(U,{title:l.name||l.type,placement:"top",children:(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:u.text,background:u.bg,border:`1px solid ${u.border}`,cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[w,(0,e.jsx)("span",{children:l.name||l.type})]})},l.type)})})}),n.subAgents.length>0&&(0,e.jsx)(H,{icon:(0,e.jsx)(me,{size:12}),label:t("chat.environment.subAgents"),count:n.subAgents.length,children:(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:n.subAgents.map((l,u)=>{let w=Je(u+3);return(0,e.jsx)(U,{title:l,placement:"top",children:(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:w.text,background:w.bg,cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,e.jsx)(me,{size:10}),(0,e.jsx)("span",{children:l})]})},l)})})}),(n.modelKey||n.runConfig)&&(0,e.jsx)(H,{icon:(0,e.jsx)(ce,{size:12}),label:t("chat.environment.runtime"),count:n.modelKey?1:0,children:(0,e.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[n.modelKey&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:"#4f46e5",background:"rgba(99,102,241,0.08)",border:"1px solid rgba(99,102,241,0.2)",cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,e.jsx)(q,{size:10}),(0,e.jsx)("span",{children:t("chat.environment.model",{model:n.modelKey})})]}),!!n.runConfig?.databaseKey&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:"#ea580c",background:"rgba(249,115,22,0.08)",border:"1px solid rgba(249,115,22,0.2)",cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,e.jsx)(pe,{size:10}),(0,e.jsx)("span",{children:t("chat.environment.db",{db:String(n.runConfig?.databaseKey)})})]}),n.skillCategories&&n.skillCategories.length>0&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:"#9333ea",background:"rgba(168,85,247,0.08)",border:"1px solid rgba(168,85,247,0.2)",cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,e.jsx)(ue,{size:10}),(0,e.jsx)("span",{children:t("chat.environment.skills",{skills:n.skillCategories.join(", ")})})]})]})}),D&&(0,e.jsx)(H,{icon:(0,e.jsx)(fe,{size:12}),label:t("chat.environment.channels"),count:0,children:(0,e.jsx)(ye,{type:"secondary",style:{fontSize:10,fontStyle:"italic"},children:t("chat.environment.noChannels")})})]})]})})};var o=A(E()),{Text:Y}=Q,ht=300;function Ze(r){if(typeof r=="string")try{let t=JSON.parse(r);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}return r&&typeof r=="object"&&!Array.isArray(r)?r:null}function kt(r){let t=null;if(typeof r=="string")try{t=JSON.parse(r)}catch{return null}else r&&typeof r=="object"&&(t=r);if(!t)return null;if(t.type!=="workflow")return console.warn("[extractDSL] type is not 'workflow':",t.type),null;if(typeof t.workflowYaml!="string")return console.warn("[extractDSL] workflowYaml not found or not a string, keys:",Object.keys(t)),null;try{return be(t.workflowYaml)}catch(n){return console.error("[extractDSL] expandWorkflow failed:",n.message,n),null}}function xt({workflows:r,selectedId:t,onSelect:n,onCreate:f,onDelete:D,dsl:l,agentNameMap:u,onSpecClick:w,environmentConfig:g}){let m=P(),y=r.find(p=>p.id===t),[b,S]=(0,i.useState)(!0),[h,k]=(0,i.useState)(""),z=(0,i.useMemo)(()=>{let p=h.trim().toLowerCase();return p?r.filter(x=>x.name.toLowerCase().includes(p)||x.description.toLowerCase().includes(p)):r},[r,h]);(0,i.useEffect)(()=>{t?S(!1):(S(!0),k(""))},[t]);let I=p=>{n(p),S(!1)};return(0,o.jsx)("div",{style:{display:"flex",height:"100%",width:"100%"},children:(0,o.jsxs)("div",{style:{flex:1,position:"relative"},children:[y?(0,o.jsxs)(o.Fragment,{children:[l?(0,o.jsx)(Ue,{dsl:l,agentNameMap:u}):(0,o.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,o.jsx)(ae,{tip:m("chatWorkspace.workflowAutomation.loadingDsl")})}),!b&&(0,o.jsx)("div",{style:{position:"absolute",top:12,left:12,zIndex:10},children:(0,o.jsx)($,{type:"default",icon:(0,o.jsx)(De,{}),onClick:()=>S(!0),style:{width:32,height:32,borderRadius:10,boxShadow:"0 2px 12px rgba(0,0,0,0.08)",border:"1px solid #f0f0f0",background:"rgba(255,255,255,0.95)",color:"#6366f1",display:"flex",alignItems:"center",justifyContent:"center"}})}),(0,o.jsxs)("div",{style:{position:"absolute",top:12,left:b?12:56,zIndex:10,display:"flex",alignItems:"center",gap:6,height:32,padding:"0 14px",background:"rgba(255,255,255,0.95)",borderRadius:10,boxShadow:"0 2px 12px rgba(0,0,0,0.08)",border:"1px solid #f0f0f0"},children:[(0,o.jsx)(Z,{size:16,color:"#6366f1"}),(0,o.jsx)(Y,{strong:!0,style:{fontSize:13},children:y.name}),(0,o.jsx)(Me,{style:{color:"#6366f1",cursor:"pointer",fontSize:15},onClick:w})]}),(0,o.jsx)("div",{style:{position:"absolute",top:12,right:12,zIndex:10,display:"flex",alignItems:"center",height:32,padding:"0 14px",background:"rgba(255,255,255,0.95)",borderRadius:10,boxShadow:"0 2px 12px rgba(0,0,0,0.08)",border:"1px solid #f0f0f0"},children:(0,o.jsx)(Ae,{title:m("chatWorkspace.workflowAutomation.deleteTitle"),description:m("chatWorkspace.workflowAutomation.deleteBody"),onConfirm:()=>D(y.id),okText:m("common.delete"),cancelText:m("common.cancel"),okButtonProps:{danger:!0},children:(0,o.jsx)(Te,{style:{color:"#ff4d4f",cursor:"pointer",fontSize:15}})})}),!b&&(0,o.jsx)("div",{style:{position:"absolute",top:52,left:b?12:56,zIndex:20},children:(0,o.jsx)(Qe,{graphDef:g},y.id)})]}):(0,o.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,o.jsx)(G,{description:m("chatWorkspace.workflowAutomation.selectWorkflow")})}),b&&(0,o.jsxs)(o.Fragment,{children:[t&&(0,o.jsx)("div",{onClick:()=>S(!1),style:{position:"absolute",inset:0,zIndex:25,background:"transparent"}}),(0,o.jsxs)(Ie,{size:"small",title:(0,o.jsx)(Y,{strong:!0,style:{fontSize:15,color:"#1a1a1a"},children:m("chatWorkspace.workflowAutomation.title")}),extra:(0,o.jsx)($,{type:"text",size:"small",icon:(0,o.jsx)(le,{}),onClick:f,style:{color:"#6366f1"}}),styles:{body:{padding:"12px 16px 16px"},header:{padding:"14px 16px 10px",borderBottom:"1px solid rgba(0,0,0,0.04)"}},style:{position:"absolute",left:16,top:t?56:48,bottom:16,width:300,zIndex:30,borderRadius:16,boxShadow:"0 4px 24px rgba(0,0,0,0.12)",border:"1px solid #f0f0f0",overflow:"auto",background:"rgba(255, 255, 255, 0.92)"},children:[(0,o.jsx)("div",{style:{marginBottom:12},children:(0,o.jsx)(J,{prefix:(0,o.jsx)(Le,{style:{color:"#bbb"}}),placeholder:m("chatWorkspace.workflowAutomation.filterPlaceholder"),value:h,onChange:p=>k(p.target.value),allowClear:!0,size:"small",style:{borderRadius:10,border:"1px solid rgba(0,0,0,0.06)"}})}),z.length===0?(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 16px",color:"#bbb"},children:[(0,o.jsx)(Z,{size:28,style:{marginBottom:10,opacity:.4}}),(0,o.jsx)(Y,{type:"secondary",style:{fontSize:13},children:h.trim()?m("chatWorkspace.workflowAutomation.noMatch"):m("chatWorkspace.workflowAutomation.emptyTitle")})]}):z.map(p=>{let x=t===p.id;return(0,o.jsxs)("div",{onClick:()=>I(p.id),style:{display:"flex",alignItems:"center",gap:12,padding:"13px 15px",borderRadius:12,cursor:"pointer",transition:"all 0.2s ease",background:x?"rgba(99, 102, 241, 0.07)":"rgba(255, 255, 255, 0.5)",border:x?"1px solid rgba(99, 102, 241, 0.25)":"1px solid transparent",marginBottom:6},onMouseEnter:R=>{x||(R.currentTarget.style.background="rgba(255, 255, 255, 0.92)",R.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.05)",R.currentTarget.style.transform="translateY(-1px)",R.currentTarget.style.borderColor="rgba(0,0,0,0.06)")},onMouseLeave:R=>{x||(R.currentTarget.style.background="rgba(255, 255, 255, 0.5)",R.currentTarget.style.boxShadow="none",R.currentTarget.style.transform="translateY(0)",R.currentTarget.style.borderColor="transparent")},children:[(0,o.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:38,height:38,borderRadius:10,background:x?"rgba(99, 102, 241, 0.12)":"rgba(0, 0, 0, 0.04)",flexShrink:0,transition:"background 0.2s ease"},children:(0,o.jsx)(Z,{size:18,color:x?"#6366f1":"#888"})}),(0,o.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,o.jsx)(Y,{strong:!0,ellipsis:{tooltip:p.name},style:{fontSize:14,color:x?"#6366f1":"#1a1a1a",transition:"color 0.2s ease"},children:p.name}),p.description&&(0,o.jsx)("div",{style:{fontSize:12,color:"#999",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:3,lineHeight:"18px"},children:p.description})]})]},p.id)})]})]})]})})}var vt=()=>{let r=P(),{get:t,del:n}=te(),{workspaceId:f,trainingProjects:D,loading:l}=ee(),[u,w]=(0,i.useState)([]),[g,m]=(0,i.useState)(null),[y,b]=(0,i.useState)(null),[S,h]=(0,i.useState)(null),[k,z]=(0,i.useState)([]),[I,p]=(0,i.useState)(new Map),x=(0,i.useCallback)(async()=>{try{let s=await t("/api/assistants");if(s.success&&s.data?.records){let c=[],a=new Map;for(let d of s.data.records){if(d.id&&d.name){let v=typeof d.graphDefinition=="object"&&d.graphDefinition!==null?d.graphDefinition:void 0;a.set(d.id,{name:d.name,type:v?.type??"unknown"})}if(d.graphDefinition)if(typeof d.graphDefinition=="string")try{c.push(JSON.parse(d.graphDefinition))}catch{}else typeof d.graphDefinition=="object"&&c.push(d.graphDefinition)}z(c),p(a)}}catch{}},[t]),[R,he]=(0,i.useState)(!0),[ne,et]=(0,i.useState)(420),_=(0,i.useRef)(null),[tt,ot]=(0,i.useState)(!0),[ke,xe]=(0,i.useState)(null),[nt,ve]=(0,i.useState)(!1),[Ce,F]=(0,i.useState)(!1),[rt,Se]=(0,i.useState)(null),it=(0,i.useMemo)(()=>["create_workflow","update_workflow","validate_workflow","create_agent","update_agent","delete_agent"],[]),T=(0,i.useCallback)(async()=>{let s=await t("/api/assistants");if(s.success&&s.data?.records){let c=s.data.records.filter(a=>(Ze(a.graphDefinition)??void 0)?.type==="workflow").map(a=>{let d=Ze(a.graphDefinition)??void 0,v=typeof d?.workflowYaml=="string"?d.workflowYaml:"",B=d?.metadata,N=0;try{N=be(v).nodes.filter(W=>W.type!=="terminal").length}catch{}return{id:a.id,name:a.name,description:a.description||"",type:"workflow",stepCount:N,trainingProjectId:typeof B?.trainingProjectId=="string"?B.trainingProjectId:void 0}});w(c)}xe(null)},[t]),K=(0,i.useCallback)(async s=>{try{let c=await t(`/api/assistants/${s}`);if(c.success&&c.data){let a=c.data.graphDefinition,d=kt(a);if(b(d),!a)h(null);else if(typeof a=="string")try{h(JSON.parse(a))}catch{h(null)}else h(typeof a=="object"?a:null)}}catch{b(null),h(null)}},[t]);(0,i.useEffect)(()=>{let s=!1;return(async()=>{try{await T(),await x()}catch(a){s||xe(a instanceof Error?a.message:r("chatWorkspace.workflowAutomation.loadFailed"))}finally{s||ot(!1)}})(),()=>{s=!0}},[T]),(0,i.useEffect)(()=>{g?K(g):b(null)},[g,K]);let st=(0,i.useCallback)(s=>{s.preventDefault(),_.current={startX:s.clientX,startWidth:ne}},[ne]);(0,i.useEffect)(()=>{let s=a=>{if(!_.current)return;let d=_.current.startX-a.clientX,v=Math.min(900,Math.max(400,_.current.startWidth+d));et(v)},c=()=>{_.current=null};return window.addEventListener("mousemove",s),window.addEventListener("mouseup",c),()=>{window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",c)}},[]);let L=(0,i.useRef)(null),Re=(0,i.useRef)({fetchWorkflows:T,fetchDSL:K});Re.current={fetchWorkflows:T,fetchDSL:K};let We=(0,i.useRef)(g);We.current=g;let at=(0,i.useCallback)(()=>{L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{L.current=null;let{fetchWorkflows:s,fetchDSL:c}=Re.current;s().catch(d=>{console.warn("Failed to refresh workflows:",d)});let a=We.current;a&&c(a).catch(d=>{console.warn("Failed to refresh workflow DSL:",d)})},ht)},[]);(0,i.useEffect)(()=>()=>{L.current&&(clearTimeout(L.current),L.current=null)},[]);let lt=(0,i.useCallback)(s=>{m(s)},[]),ze=(0,i.useCallback)((s,c,a)=>{F(!1),T().then(()=>{m(s),a&&w(d=>d.map(v=>v.id===s?{...v,trainingProjectId:a}:v)),c&&Se({requestId:s,content:c})})},[T]),dt=(0,i.useCallback)(async s=>{await n(`/api/assistants/${s}`),g===s&&m(null),await T()},[n,T,g]),O=(0,i.useMemo)(()=>u.find(s=>s.id===g)||null,[u,g]),re=O?.trainingProjectId??D[0]?.id??null,ct=(0,i.useMemo)(()=>g&&O?{id:g,name:O.name,type:"workflow"}:null,[g,O]),pt=(0,i.useMemo)(()=>{let s=y?.nodes.filter(C=>C.type!=="terminal"&&C.ref).map(C=>C.ref).filter((C,W,M)=>M.indexOf(C)===W)??[];if(s.length===0)return S;let c=k.filter(C=>{let W=C.key;return W&&s.includes(W)});if(c.length===0)return S;let a={...S??{}},d=new Set(a.tools??[]),v=[...a.middleware??[]],B=new Set(a.subAgents??[]),N=new Set(v.map(C=>C.type).filter(Boolean));for(let C of c){let W=C;for(let M of W.tools??[])d.add(M);for(let M of W.middleware??[]){let ie=M.type;ie&&!N.has(ie)&&(v.push(M),N.add(ie))}for(let M of W.subAgents??[])B.add(M)}return a.tools=Array.from(d),a.middleware=v,a.subAgents=Array.from(B),a},[y,S,k]);return tt?(0,o.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,o.jsx)(ae,{size:"large",tip:r("chatWorkspace.workflowAutomation.loading")})}):ke?(0,o.jsx)(G,{description:ke}):u.length===0?(0,o.jsxs)("div",{style:{width:"100%",height:"100%"},children:[(0,o.jsx)(we,{open:Ce,onCancel:()=>F(!1),onCreated:ze,type:"workflow"}),(0,o.jsx)(G,{description:r("chatWorkspace.workflowAutomation.noDefinitions"),children:(0,o.jsx)($,{type:"primary",icon:(0,o.jsx)(le,{}),onClick:()=>F(!0),children:r("chatWorkspace.workflowAutomation.createWorkflow")})})]}):(0,o.jsxs)("div",{style:{width:"100%",height:"100%"},children:[(0,o.jsx)(we,{open:Ce,onCancel:()=>F(!1),onCreated:ze,type:"workflow"}),(0,o.jsx)(V,{title:O?.name,open:nt,onCancel:()=>ve(!1),footer:null,width:"85vw",centered:!0,styles:{body:{maxHeight:"calc(85vh - 120px)",overflow:"auto",padding:"12px 24px 24px"}},children:O?.description?(0,o.jsx)(He,{content:O.description}):(0,o.jsx)(Y,{type:"secondary",children:r("chatWorkspace.workflowAutomation.noDescription")})}),(0,o.jsx)(Ye,{children:(0,o.jsxs)("div",{style:{height:"100%",width:"100%",position:"relative",overflow:"hidden"},children:[(0,o.jsx)(xt,{workflows:u,selectedId:g,onSelect:lt,onCreate:()=>F(!0),onDelete:dt,dsl:y,agentNameMap:I,onSpecClick:()=>ve(!0),environmentConfig:pt}),!R&&g&&(0,o.jsx)("div",{style:{position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",zIndex:20},children:(0,o.jsx)("div",{onClick:()=>he(!0),style:{writingMode:"vertical-rl",textOrientation:"mixed",padding:"16px 8px",background:"#6366f1",color:"#fff",borderRadius:"8px 0 0 8px",cursor:"pointer",fontSize:12,fontWeight:500,userSelect:"none"},children:r("chatWorkspace.workflowAutomation.copilot")})}),R&&g&&re&&!l&&(0,o.jsxs)("div",{style:{position:"absolute",right:16,top:48,bottom:12,zIndex:15,width:ne,borderRadius:16,overflow:"hidden",boxShadow:"0 4px 24px rgba(0,0,0,0.12)"},children:[(0,o.jsx)("div",{onMouseDown:st,style:{position:"absolute",left:0,top:0,bottom:0,width:6,cursor:"ew-resize",zIndex:2,background:"transparent"}}),(0,o.jsx)(Ke,{defaultWorkspaceId:f??void 0,defaultProjectId:re??void 0,children:(0,o.jsx)(Ge,{workflowContext:ct,onClose:()=>he(!1),onToolCompleted:s=>{it.includes(s)&&at()},initialMessageRequest:rt,onInitialMessageSubmitted:s=>Se(c=>c?.requestId===s?null:c)})},`${f??"default"}:${re??"default"}`)]})]})})]})},Qt=vt;export{vt as WorkflowAutomationView,Qt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as sn,c as an,d as En}from"./embed-page-chunk-GSUSX54K.js";import{a as cn,b as Ae,e as ke,f as vn,h as Cn,i as _n}from"./embed-page-chunk-DJKD2PHO.js";import{j as ln}from"./embed-page-chunk-CKUSXUKW.js";import{A as yn,Ba as An,D as xn,E as Me,F as Fe,Pa as kn,Sa as Tn,Z as wn,ha as Sn,ma as bn,y as Oe}from"./embed-page-chunk-F7ZUYG42.js";import{k as _e}from"./embed-page-chunk-L7TDL27M.js";import{a as Ve}from"./embed-page-chunk-QV7QAJ4N.js";import{Ja as mn,Za as se,ba as dn,bb as Xe,ha as Te,ia as gn,pa as hn}from"./embed-page-chunk-F7TA3LRH.js";import{a as lr}from"./embed-page-chunk-R5QL57JJ.js";import{f as Re}from"./embed-page-chunk-QBTAJ2YI.js";var ie=Re(lr());var E=Re(Ve());if(typeof document<"u"){let u="workflow-node-spin-keyframes";if(!document.getElementById(u)){let o=document.createElement("style");o.id=u,o.textContent="@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }",document.head.appendChild(o)}}var{Text:ae}=Xe,Qe={opacity:0},De={running:{color:"#1677ff",icon:(0,E.jsx)(bn,{size:14,style:{animation:"spin 1s linear infinite"}})},completed:{color:"#52c41a",icon:(0,E.jsx)(Oe,{size:14})},failed:{color:"#ff4d4f",icon:(0,E.jsx)(Me,{size:14})},interrupted:{color:"#faad14",icon:(0,E.jsx)(yn,{size:14})},skipped:{color:"#8c8c8c",icon:(0,E.jsx)(Fe,{size:14})}},Nn={running:"chatWorkspace.workflowNode.stepStatus.running",completed:"chatWorkspace.workflowNode.stepStatus.completed",failed:"chatWorkspace.workflowNode.stepStatus.failed",interrupted:"chatWorkspace.workflowNode.stepStatus.interrupted",skipped:"chatWorkspace.workflowNode.stepStatus.skipped"},In={color:"#d9d9d9",icon:(0,E.jsx)(Fe,{size:14})},Ln={agent:{color:"#6366f1",bg:"#EEF2FF",border:"#6366f1"},map:{color:"#10b981",bg:"#ECFDF5",border:"#10b981"},terminal:{color:"#64748b",bg:"#F8FAFC",border:"#94a3b8"}},Rn={success:{color:"#22c55e",bg:"#F0FDF4",label:"chatWorkspace.workflowNode.terminal.success"},failed:{color:"#ef4444",bg:"#FEF2F2",label:"chatWorkspace.workflowNode.terminal.failed"},__default:{color:"#94a3b8",bg:"#F8FAFC",label:"chatWorkspace.workflowNode.terminal.stop"}};function cr(u){return(u||"?").split(/[\s_-]+/).filter(Boolean).map(o=>o[0]).join("").toUpperCase().slice(0,2)}function un({schema:u,t:o}){let p=u;if(!p||typeof p!="object")return(0,E.jsx)(ae,{type:"secondary",style:{fontSize:11},children:o("chatWorkspace.workflowNode.noSchema")});let m=p.properties,S=p.required||[],I=p.items,g=a=>a==="string"?"green":a==="number"||a==="integer"?"orange":a==="boolean"?"purple":a==="array"?"cyan":a==="object"?"blue":"default",c=a=>{let s=a.type;if(s==="array"&&a.items){let h=a.items.type;return h?`Array<${h}>`:"Array"}return s||"any"};return(0,E.jsxs)("div",{style:{maxWidth:340,maxHeight:360,overflow:"auto",fontSize:12},children:[m&&(0,E.jsxs)("div",{children:[(0,E.jsx)(ae,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5,display:"block",marginBottom:6},children:o("chatWorkspace.workflowNode.properties")}),Object.entries(m).map(([a,s])=>{let h=S.includes(a),r=s.description,l=c(s),A=s.properties,O=s.items,D=!!(A||O);return(0,E.jsx)(Te,{title:D?(0,E.jsx)(un,{t:o,schema:D?A?s:O:void 0}):r||void 0,placement:"left",overlayStyle:{maxWidth:360},children:(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 6px",borderRadius:4,marginBottom:2,background:h?"rgba(99,102,241,0.04)":"transparent",cursor:D?"pointer":"default"},children:[(0,E.jsx)(ae,{style:{fontSize:11,fontWeight:h?600:400,fontFamily:"monospace"},children:a}),h&&(0,E.jsx)("span",{style:{color:"#ef4444",fontSize:9},children:"*"}),r&&!D&&(0,E.jsx)(ae,{type:"secondary",style:{fontSize:10,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),(0,E.jsx)(se,{color:g(l),style:{margin:0,fontSize:9,padding:"0 4px",lineHeight:"16px",marginLeft:"auto"},children:l})]})},a)})]}),!m&&I&&(0,E.jsxs)("div",{children:[(0,E.jsx)(ae,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5,display:"block",marginBottom:4},children:o("chatWorkspace.workflowNode.items")}),(0,E.jsx)(un,{t:o,schema:I})]})]})}var On=72,sr=3,ar=({data:u})=>{let o=_e();if(!u)return null;let{nodeType:p,name:m,description:S,ref:I,refAgentName:g,refAgentType:c,refDeleted:a,outputKey:s,nodeSchema:h,config:r,status:l,source:A,innerRef:O,inputTemplate:D,ask:Z,condition:j,runState:N,pending:B}=u,C=Ln[p]||Ln.agent,W=Rn[l||""]||Rn.__default,P=N?De[N.status]||De.running:null,z=P?.color,U=P?.icon,q=l==="success"?(0,E.jsx)(Oe,{size:14,color:"#22c55e"}):l==="failed"?(0,E.jsx)(Me,{size:14,color:"#ef4444"}):(0,E.jsx)(Fe,{size:14,color:"#94a3b8"}),fe=l==="success"?(0,E.jsx)(Oe,{size:32,color:W.color}):l==="failed"?(0,E.jsx)(Me,{size:32,color:W.color}):(0,E.jsx)(xn,{size:32,color:W.color}),ue=r?.title,oe=r?.maxRetries,J=r?.timeout,te=r?.batchSize,X=r?.maxConcurrency,G=r?.innerConcurrency,ee=N?.selected,_=!!N||B;function de(V){return V==null?"-":V<1e3?`${V}ms`:`${(V/1e3).toFixed(1)}s`}if(p==="terminal"){let V=W.color,ne=W.bg,pe=o(W.label),ce=fe;_&&(N?(V=z||V,pe=N.status,ce=(0,E.jsx)("span",{style:{fontSize:18},children:U})):B&&(V=In.color,ne="#fafafa",pe=o("chatWorkspace.workflowNode.pending"),ce=(0,E.jsx)(Fe,{size:18,style:{color:In.color}})));let me=ee&&z?`0 4px 16px ${z}30`:"0 2px 8px rgba(0,0,0,0.06)";return(0,E.jsxs)("div",{style:{padding:4,display:"flex",flexDirection:"column",alignItems:"center",opacity:B?.5:1},children:[(0,E.jsx)(ke,{type:"target",position:Ae.Top,style:Qe}),(0,E.jsx)(Te,{title:_&&N?o(Nn[N.status]):m,children:(0,E.jsx)("div",{style:{width:On,height:On,borderRadius:"50%",background:ne,border:`${sr}px solid ${B?`${V}80`:V}`,borderStyle:B?"dashed":"solid",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:me,transition:"all 0.2s ease",cursor:"default"},onMouseEnter:B?void 0:K=>{K.currentTarget.style.transform="scale(1.08)",K.currentTarget.style.boxShadow=`0 4px 16px ${V}30`},onMouseLeave:B?void 0:K=>{K.currentTarget.style.transform="scale(1)",K.currentTarget.style.boxShadow=me},children:ce})}),(0,E.jsx)(ae,{style:{fontSize:11,color:V,marginTop:6,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:pe}),(0,E.jsx)(ke,{type:"source",position:Ae.Bottom,style:Qe})]})}let le=_&&z?z:C.border,Ee=_&&z?z:C.color,he=p==="agent"?(0,E.jsx)(Tn,{size:14}):p==="map"?(0,E.jsx)(An,{size:14}):cr(m),ve=N?de(N.durationMs):null,Se=ee&&z?`0 4px 14px ${z}20`:"0 1px 6px rgba(0,0,0,0.08)",be=_&&z?z:C.color;return(0,E.jsxs)("div",{style:{padding:4},children:[(0,E.jsx)(ke,{type:"target",position:Ae.Top,style:Qe}),(0,E.jsxs)("div",{style:{width:260,minHeight:90,boxSizing:"border-box",background:"#fff",borderRadius:12,boxShadow:Se,border:"1px solid #e5e7eb",borderLeft:`3px solid ${le}`,borderStyle:I?"dashed":"solid",overflow:"hidden",transition:"all 0.2s ease",...B?{opacity:.5,borderStyle:"dashed"}:{}},onMouseEnter:B?void 0:V=>{V.currentTarget.style.transform="translateY(-2px)",V.currentTarget.style.boxShadow=`0 4px 12px ${be}20`},onMouseLeave:B?void 0:V=>{V.currentTarget.style.transform="translateY(0)",V.currentTarget.style.boxShadow=Se},children:[(0,E.jsxs)("div",{style:{background:C.bg,padding:"6px 12px",display:"flex",alignItems:"center",gap:6,borderBottom:"1px solid #f1f5f9"},children:[(0,E.jsx)("div",{style:{width:24,height:24,borderRadius:"50%",backgroundColor:Ee,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:600,flexShrink:0},children:he}),(0,E.jsx)("div",{style:{flex:1,minWidth:0},children:(0,E.jsx)(ae,{strong:!0,style:{fontSize:12,color:C.color},ellipsis:{tooltip:m},children:m})}),_&&U&&(0,E.jsx)(Te,{title:N?o(Nn[N.status]):void 0,children:(0,E.jsx)("span",{style:{color:z,fontSize:12,display:"flex",flexShrink:0},children:U})})]}),(0,E.jsxs)("div",{style:{padding:"10px 12px"},children:[S&&(0,E.jsx)(ae,{type:"secondary",style:{fontSize:11,display:"block",marginTop:2,lineHeight:1.4},ellipsis:{tooltip:S},children:S}),p==="map"&&A&&(0,E.jsxs)(ae,{type:"secondary",style:{fontSize:11,display:"block",marginTop:4,lineHeight:1.4,color:C.color,background:C.bg,padding:"2px 6px",borderRadius:4,maxHeight:32,overflow:"hidden"},ellipsis:{tooltip:A},children:["\u2190 ",A]}),p!=="map"&&D&&(0,E.jsx)(ae,{type:"secondary",style:{fontSize:11,display:"block",marginTop:4,lineHeight:1.4,color:C.color,background:C.bg,padding:"2px 6px",borderRadius:4,maxHeight:32,overflow:"hidden"},ellipsis:{tooltip:D},children:D}),(0,E.jsxs)("div",{style:{display:"flex",gap:4,marginTop:6,flexWrap:"wrap"},children:[!_&&p==="agent"&&I&&(0,E.jsx)(Te,{title:a?o("chatWorkspace.workflowNode.refDeleted",{ref:I}):o("chatWorkspace.workflowNode.refDelegated",{name:g??I}),children:(0,E.jsx)(se,{color:a?"red":"purple",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},icon:(0,E.jsx)(Sn,{size:10}),children:a?o("chatWorkspace.workflowNode.refDeletedTag",{ref:I}):`\u2192 ${g??I}`})}),!_&&p==="agent"&&!I&&(0,E.jsx)(se,{color:"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:o("chatWorkspace.workflowNode.inline")}),Z&&(0,E.jsx)(Te,{title:o("chatWorkspace.workflowNode.askTooltip"),children:(0,E.jsx)("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:20,height:20,borderRadius:"50%",background:"#fff7e6",border:"1px solid #ffd591",cursor:"default"},children:(0,E.jsx)(kn,{size:12,style:{color:"#fa8c16"}})})}),j&&(0,E.jsx)(Te,{title:o("chatWorkspace.workflowNode.when",{condition:j}),children:(0,E.jsx)("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:20,height:20,borderRadius:"50%",background:"#f0f5ff",border:"1px solid #adc6ff",cursor:"default"},children:(0,E.jsx)(wn,{size:12,style:{color:"#2f54eb"}})})}),!_&&p==="map"&&O&&(0,E.jsx)(se,{color:"purple",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:O}),!_&&p==="map"&&D&&(0,E.jsx)(se,{color:"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px",maxWidth:120},title:D,children:D.length>20?D.slice(0,18)+"\u2026":D}),!_&&p==="map"&&(te||X||G)&&(0,E.jsxs)(se,{color:"cyan",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:[te??50,"\xD7",X??10,"\xD7",G??5]}),!_&&oe?(0,E.jsxs)(se,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:["\u21BB ",oe]}):null,!_&&J?(0,E.jsxs)(se,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:["\u23F1 ",J,"s"]}):null,ve&&(0,E.jsx)(se,{color:N?"blue":"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:ve}),s&&(0,E.jsx)("span",{style:{marginLeft:"auto"}}),s&&(0,E.jsx)(gn,{trigger:"hover",placement:"right",mouseEnterDelay:.2,title:(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,E.jsx)(ae,{strong:!0,style:{fontSize:12},children:o("chatWorkspace.workflowNode.output")}),(0,E.jsx)(ae,{style:{fontSize:11,fontFamily:"monospace",color:"#6366f1"},children:s})]}),content:h?(0,E.jsx)(un,{t:o,schema:h}):(0,E.jsx)(ae,{type:"secondary",style:{fontSize:11},children:o("chatWorkspace.workflowNode.noSchema")}),children:(0,E.jsxs)(se,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px",flexShrink:0,cursor:"default"},children:["\u2192 ",s]})})]})]})]}),(0,E.jsx)(ke,{type:"source",position:Ae.Bottom,style:Qe})]})},Mn=ar;var H=Re(Ve()),{Text:ge}=Xe;function Fn(u){return new Date(u).toLocaleString()}function ur(u){return u.input?typeof u.input.rendered=="string"?u.input.rendered:typeof u.input.description=="string"?u.input.description:JSON.stringify(u.input,null,2):null}function pr(u){return u.output?typeof u.output.result=="string"?u.output.result:typeof u.output=="object"?JSON.stringify(u.output,null,2):String(u.output):null}function fr({step:u}){let o=_e(),p=ur(u),m=pr(u),S=De[u.status]||De.running,I=[{key:"io",label:o("chatWorkspace.workflowCanvas.tabIo"),children:(0,H.jsxs)(H.Fragment,{children:[p&&(0,H.jsxs)("div",{style:{marginBottom:m?12:0},children:[(0,H.jsx)(ge,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:o("chatWorkspace.workflowCanvas.input")}),(0,H.jsx)("div",{style:{background:"rgba(0,0,0,0.02)",borderRadius:8,padding:"8px 10px",marginTop:4,maxHeight:200,overflow:"auto"},children:u.input?.description?(0,H.jsx)(ln,{content:p}):(0,H.jsx)("pre",{style:{margin:0,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace"},children:p})})]}),m&&(0,H.jsxs)("div",{children:[(0,H.jsx)(ge,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:o("chatWorkspace.workflowCanvas.output")}),(0,H.jsx)("div",{style:{background:"linear-gradient(135deg, rgba(99,102,241,0.04) 0%, rgba(99,102,241,0.01) 100%)",borderRadius:8,padding:"8px 10px",marginTop:4,maxHeight:200,overflow:"auto"},children:u.output?.result?(0,H.jsx)(ln,{content:m}):(0,H.jsx)("pre",{style:{margin:0,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace"},children:m})})]}),!p&&!m&&(0,H.jsx)(ge,{type:"secondary",style:{fontSize:11},children:o("chatWorkspace.workflowCanvas.noIo")})]})}];return(0,H.jsxs)("div",{style:{maxWidth:480},children:[(0,H.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[(0,H.jsx)("span",{style:{color:S.color,fontSize:14},children:S.icon}),(0,H.jsx)(ge,{strong:!0,style:{fontSize:14},children:u.stepName}),(0,H.jsx)(se,{color:"purple",style:{fontSize:11},children:u.stepType})]}),u.edgePurpose&&(0,H.jsx)("div",{style:{marginBottom:10},children:(0,H.jsx)(ge,{type:"secondary",style:{fontSize:11},children:o("chatWorkspace.workflowCanvas.purpose",{purpose:u.edgePurpose})})}),u.errorMessage&&(0,H.jsx)("div",{style:{background:"#FEF2F2",border:"1px solid #FECACA",borderRadius:8,padding:"8px 12px",marginBottom:12,overflow:"hidden"},children:(0,H.jsx)(ge,{type:"danger",style:{fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:u.errorMessage})}),(0,H.jsx)(hn,{activeKey:"io",items:I,size:"small",style:{marginBottom:-8}}),(0,H.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginTop:12,paddingTop:8,borderTop:"1px solid #f0f0f0"},children:[(0,H.jsx)(ge,{type:"secondary",style:{fontSize:10},children:o("chatWorkspace.workflowCanvas.started",{time:Fn(u.startedAt)})}),u.completedAt&&(0,H.jsx)(ge,{type:"secondary",style:{fontSize:10},children:o("chatWorkspace.workflowCanvas.ended",{time:Fn(u.completedAt)})})]})]})}function Pe(u,o){return u.find(p=>p.stepName===o.name)??null}function Ze(u,o,p,m){let S=u.ref&&m?m.get(u.ref):void 0;return{nodeType:u.type,name:u.name,description:u.description,ref:u.ref,refAgentName:S?.name,refAgentType:S?.type,refDeleted:u.ref&&m?!S:void 0,outputKey:u.output?.key,nodeSchema:u.output?.schema,config:u.config,status:u.status,source:u.source,innerRef:u.node?.ref,inputTemplate:u.input?.template,ask:u.ask,condition:u.condition,runState:o,pending:p}}function Dn(u){let o=new Map;for(let p of u)if(p.parentGroup&&p.type!=="terminal"){let m=o.get(p.parentGroup)||[];m.push(p.id),o.set(p.parentGroup,m)}return Array.from(o.entries()).map(([p,m])=>({sourceId:p,childIds:m}))}function dr(){let u=_e();return(0,H.jsxs)("div",{style:{width:"100%",height:"100%",position:"relative",pointerEvents:"none"},children:[(0,H.jsx)(ke,{type:"target",position:Ae.Top,style:{opacity:0}}),(0,H.jsx)(ke,{type:"source",position:Ae.Bottom,style:{opacity:0}}),(0,H.jsx)("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,border:"2px dashed #a78bfa",borderRadius:12,background:"rgba(167, 139, 250, 0.04)"}}),(0,H.jsx)("div",{style:{position:"absolute",top:8,left:12,fontSize:12,fontWeight:600,color:"#7c3aed",padding:"2px 8px",background:"rgba(167, 139, 250, 0.08)",borderRadius:6,whiteSpace:"nowrap",zIndex:2},children:u("chatWorkspace.workflowCanvas.parallel")})]})}function gr(u,o){let p=u.nodes,m=u.edges,S=Dn(p),I=new Set(S.map(N=>N.sourceId)),g=new Set(S.flatMap(N=>N.childIds)),c=268,a=100,s=40;for(let N of S){let B=p.find(C=>C.id===N.sourceId);if(B){let C=N.childIds.length;B.width=C*c+(C-1)*s+40,B.height=a+100}}let h=p.filter(N=>!g.has(N.id)),r=an(h,m,{nodeWidth:c,nodeHeight:a,ranksep:120}),l=h.find(N=>!I.has(N.id)&&N.type!=="terminal"),A=l?r.get(l.id):void 0,O=l?l.width??c:c,D=A?A.x+O/2:0;for(let N of h){if(I.has(N.id))continue;let B=r.get(N.id);if(!B)continue;let C=N.width??c;B.x=D-C/2}let Z=h.filter(N=>r.has(N.id)&&!I.has(N.id)&&N.type!=="terminal").map(N=>{let B=r.get(N.id);return{id:N.id,type:"workflow",position:B,data:{...Ze(N,void 0,void 0,o)}}});for(let N of S){let B=p.find(J=>J.id===N.sourceId),C=r.get(N.sourceId);if(!B||!C)continue;let W=B.width,P=B.height,z=N.childIds.length,U=D-W/2,q=z*c+(z-1)*s,fe=D-q/2,ue=C.y+(P-a)/2;for(let J=0;J<z;J++){let te=N.childIds[J],X=p.find(G=>G.id===te);X&&Z.push({id:X.id,type:"workflow",position:{x:fe+J*(c+s),y:ue},data:{...Ze(X,void 0,void 0,o),parallelGroup:!0},style:{zIndex:2}})}let oe=`group_${N.sourceId}`;Z.push({id:oe,type:"groupLabel",position:{x:U,y:C.y},data:{},selectable:!1,draggable:!1,style:{zIndex:0,width:W,height:P}})}let j=[];for(let N of m){let B=sn(N);for(let C of B){let W=p.find(U=>U.id===C);if(W?.type==="terminal"&&W.name==="__end"||I.has(N.from)&&p.find(q=>q.id===C)?.parentGroup===N.from)continue;let P=I.has(N.from)?`group_${N.from}`:N.from,z=I.has(C)?`group_${C}`:C;j.push({id:`${P}-${z}`,source:P,target:z,type:"straight",markerEnd:{type:cn.ArrowClosed}})}}return{nodes:Z,edges:j}}function hr(u,o,p,m){let S=u.nodes,I=u.edges,g=Dn(S),c=new Set(g.map(C=>C.sourceId)),a=new Set(g.flatMap(C=>C.childIds)),s=268,h=100,r=40;for(let C of g){let W=S.find(P=>P.id===C.sourceId);if(W){let P=C.childIds.length;W.width=P*s+(P-1)*r+40,W.height=h+100}}let l=S.filter(C=>!a.has(C.id)),A=an(l,I,{nodeWidth:s,nodeHeight:h,ranksep:120}),O=l.find(C=>!c.has(C.id)&&C.type!=="terminal"),D=O?A.get(O.id):void 0,Z=O?O.width??s:s,j=D?D.x+Z/2:0;for(let C of l){if(c.has(C.id))continue;let W=A.get(C.id);if(!W)continue;let P=C.width??s;W.x=j-P/2}let N=l.filter(C=>A.has(C.id)&&!c.has(C.id)).map(C=>{let W=A.get(C.id),P=Pe(o,C),z=C.type==="terminal",U=P&&(!z||P.status!=="running")?{status:P.status,stepType:P.stepType,durationMs:P.durationMs,selected:!1}:void 0;return{id:C.id,type:"workflow",position:W,style:z?{width:s,height:h}:void 0,data:Ze(C,U,!P&&!z,m)}});for(let C of g){let W=S.find(X=>X.id===C.sourceId),P=A.get(C.sourceId);if(!W||!P)continue;let z=W.width,U=W.height,q=C.childIds.length,fe=q*s+(q-1)*r,ue=j-fe/2,oe=P.y+(U-h)/2;for(let X=0;X<q;X++){let G=C.childIds[X],ee=S.find(le=>le.id===G);if(!ee)continue;let _=Pe(o,ee),de=_?{status:_.status,stepType:_.stepType,durationMs:_.durationMs,selected:!1}:void 0;N.push({id:ee.id,type:"workflow",position:{x:ue+X*(s+r),y:oe},data:{...Ze(ee,de,!_,m),parallelGroup:!0},style:{zIndex:2}})}let J=j-z/2,te=`group_${C.sourceId}`;N.push({id:te,type:"groupLabel",position:{x:J,y:P.y},data:{},selectable:!1,draggable:!1,style:{zIndex:0,width:z,height:U}})}let B=[];for(let C of I){let W=sn(C);for(let P of W){if(c.has(C.from)&&S.find(_=>_.id===P)?.parentGroup===C.from)continue;let z=c.has(C.from)?`group_${C.from}`:C.from,U=c.has(P)?`group_${P}`:P,q=S.find(ee=>ee.id===C.from),ue=(q?Pe(o,q):void 0)!==void 0,oe=S.find(ee=>ee.id===P),te=(oe?Pe(o,oe):void 0)!==void 0,X=ue&&te,G=X?"#6366f1":"#d9d9d9";B.push({id:`${z}-${U}`,source:z,target:U,type:"straight",animated:X,style:X?{stroke:G,strokeWidth:2}:{stroke:G,strokeWidth:2,strokeDasharray:"6 4",opacity:.25},markerEnd:{type:cn.ArrowClosed,color:G,width:20,height:20}})}}return{nodes:N,edges:B}}var mr=({dsl:u,steps:o,assistantId:p,agentNameMap:m,onNodeClick:S,height:I="100%"})=>{let g=_e(),c=!!o,a=(0,ie.useMemo)(()=>({workflow:Mn,groupLabel:dr}),[]),{nodes:s,edges:h}=(0,ie.useMemo)(()=>c?hr(u,o,void 0,m):gr(u,m),[u,o,c,m]),[r,l,A]=Cn(s),[O,D,Z]=_n(h),[j,N]=(0,ie.useState)(null),B=(0,ie.useMemo)(()=>{if(!c||!j)return null;let U=u.nodes.find(q=>q.id===j);return U?Pe(o,U):null},[u.nodes,o,j,c]);(0,ie.useEffect)(()=>{l(s),D(h)},[s,h,l,D]);let C=(0,ie.useCallback)(()=>{l(U=>U.map(q=>({...q,data:{...q.data,runState:q.data.runState?{...q.data.runState,selected:!1}:void 0}})))},[l]);(0,ie.useEffect)(()=>{c&&l(U=>U.map(q=>({...q,data:{...q.data,runState:q.data.runState?{...q.data.runState,selected:q.id===j}:void 0}})))},[j,l,c]);let W=(0,ie.useCallback)((U,q)=>{c?N(q.id):S?.(q.id)},[c,S]),P=(0,ie.useCallback)(()=>{c&&(C(),N(null))},[c,C]),z=(0,ie.useCallback)(()=>{C(),N(null)},[C]);return!u.nodes||u.nodes.length===0?c?(0,H.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:300},children:(0,H.jsx)(mn,{size:"large"})}):(0,H.jsx)(dn,{description:g("chatWorkspace.workflowCanvas.noNodes")}):(0,H.jsx)(vn,{children:(0,H.jsx)(En,{nodes:r,edges:O,nodeTypes:a,onNodesChange:A,onEdgesChange:Z,onNodeClick:W,onPaneClick:c?P:void 0,height:I,fitView:!0,fitViewOptions:c?{padding:.3}:void 0,minZoom:c?.3:void 0,maxZoom:c?1.5:void 0,nodesDraggable:!1,nodesConnectable:c?!1:void 0,defaultEdgeOptions:c?void 0:{style:{strokeWidth:2}},backgroundGap:c?20:void 0,miniMap:c?{nodeStrokeWidth:3,pannable:!0,zoomable:!0,style:{backgroundColor:"#f5f5f5"}}:void 0,children:c&&B&&j&&(0,H.jsxs)("div",{style:{position:"absolute",right:24,top:24,width:460,maxHeight:"calc(100% - 48px)",background:"#fff",borderRadius:16,boxShadow:"0 8px 30px rgba(0,0,0,0.12)",border:"1px solid #e5e7eb",zIndex:10,overflow:"auto",padding:20},children:[(0,H.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[(0,H.jsx)(ge,{type:"secondary",style:{fontSize:11,textTransform:"uppercase",letterSpacing:.5},children:g("chatWorkspace.workflowCanvas.stepDetail")}),(0,H.jsx)(ge,{type:"secondary",style:{fontSize:11,cursor:"pointer"},onClick:z,children:g("common.close")})]}),(0,H.jsx)(fr,{step:B})]})})})},Gr=mr;var yr=Object.create,Pn=Object.defineProperty,xr=Object.getOwnPropertyDescriptor,wr=Object.getOwnPropertyNames,Sr=Object.getPrototypeOf,br=Object.prototype.hasOwnProperty,$=(u,o)=>()=>(o||(u((o={exports:{}}).exports,o),u=null),o.exports),Ar=(u,o,p,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(var S=wr(o),I=0,g=S.length,c;I<g;I++)c=S[I],!br.call(u,c)&&c!==p&&Pn(u,c,{get:(a=>o[a]).bind(null,c),enumerable:!(m=xr(o,c))||m.enumerable});return u},kr=(u,o,p)=>(p=u!=null?yr(Sr(u)):{},Ar(o||!u||!u.__esModule?Pn(p,"default",{value:u,enumerable:!0}):p,u)),We=$(((u,o)=>{function p(a){return typeof a>"u"||a===null}function m(a){return typeof a=="object"&&a!==null}function S(a){return Array.isArray(a)?a:p(a)?[]:[a]}function I(a,s){if(s){let h=Object.keys(s);for(let r=0,l=h.length;r<l;r+=1){let A=h[r];a[A]=s[A]}}return a}function g(a,s){let h="";for(let r=0;r<s;r+=1)h+=a;return h}function c(a){return a===0&&Number.NEGATIVE_INFINITY===1/a}o.exports.isNothing=p,o.exports.isObject=m,o.exports.toArray=S,o.exports.repeat=g,o.exports.isNegativeZero=c,o.exports.extend=I})),He=$(((u,o)=>{function p(S,I){let g="",c=S.reason||"(unknown reason)";return S.mark?(S.mark.name&&(g+='in "'+S.mark.name+'" '),g+="("+(S.mark.line+1)+":"+(S.mark.column+1)+")",!I&&S.mark.snippet&&(g+=`
|
|
1
|
+
import{b as sn,c as an,d as En}from"./embed-page-chunk-GSUSX54K.js";import{a as cn,b as Ae,e as ke,f as vn,h as Cn,i as _n}from"./embed-page-chunk-DJKD2PHO.js";import{j as ln}from"./embed-page-chunk-SQSVDSG6.js";import{A as yn,Ba as An,D as xn,E as Me,F as Fe,Pa as kn,Sa as Tn,Z as wn,ha as Sn,ma as bn,y as Oe}from"./embed-page-chunk-F7ZUYG42.js";import{k as _e}from"./embed-page-chunk-YCTDKWKW.js";import{a as Ve}from"./embed-page-chunk-QV7QAJ4N.js";import{Ja as mn,Za as se,ba as dn,bb as Xe,ha as Te,ia as gn,pa as hn}from"./embed-page-chunk-F7TA3LRH.js";import{a as lr}from"./embed-page-chunk-R5QL57JJ.js";import{f as Re}from"./embed-page-chunk-QBTAJ2YI.js";var ie=Re(lr());var E=Re(Ve());if(typeof document<"u"){let u="workflow-node-spin-keyframes";if(!document.getElementById(u)){let o=document.createElement("style");o.id=u,o.textContent="@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }",document.head.appendChild(o)}}var{Text:ae}=Xe,Qe={opacity:0},De={running:{color:"#1677ff",icon:(0,E.jsx)(bn,{size:14,style:{animation:"spin 1s linear infinite"}})},completed:{color:"#52c41a",icon:(0,E.jsx)(Oe,{size:14})},failed:{color:"#ff4d4f",icon:(0,E.jsx)(Me,{size:14})},interrupted:{color:"#faad14",icon:(0,E.jsx)(yn,{size:14})},skipped:{color:"#8c8c8c",icon:(0,E.jsx)(Fe,{size:14})}},Nn={running:"chatWorkspace.workflowNode.stepStatus.running",completed:"chatWorkspace.workflowNode.stepStatus.completed",failed:"chatWorkspace.workflowNode.stepStatus.failed",interrupted:"chatWorkspace.workflowNode.stepStatus.interrupted",skipped:"chatWorkspace.workflowNode.stepStatus.skipped"},In={color:"#d9d9d9",icon:(0,E.jsx)(Fe,{size:14})},Ln={agent:{color:"#6366f1",bg:"#EEF2FF",border:"#6366f1"},map:{color:"#10b981",bg:"#ECFDF5",border:"#10b981"},terminal:{color:"#64748b",bg:"#F8FAFC",border:"#94a3b8"}},Rn={success:{color:"#22c55e",bg:"#F0FDF4",label:"chatWorkspace.workflowNode.terminal.success"},failed:{color:"#ef4444",bg:"#FEF2F2",label:"chatWorkspace.workflowNode.terminal.failed"},__default:{color:"#94a3b8",bg:"#F8FAFC",label:"chatWorkspace.workflowNode.terminal.stop"}};function cr(u){return(u||"?").split(/[\s_-]+/).filter(Boolean).map(o=>o[0]).join("").toUpperCase().slice(0,2)}function un({schema:u,t:o}){let p=u;if(!p||typeof p!="object")return(0,E.jsx)(ae,{type:"secondary",style:{fontSize:11},children:o("chatWorkspace.workflowNode.noSchema")});let m=p.properties,S=p.required||[],I=p.items,g=a=>a==="string"?"green":a==="number"||a==="integer"?"orange":a==="boolean"?"purple":a==="array"?"cyan":a==="object"?"blue":"default",c=a=>{let s=a.type;if(s==="array"&&a.items){let h=a.items.type;return h?`Array<${h}>`:"Array"}return s||"any"};return(0,E.jsxs)("div",{style:{maxWidth:340,maxHeight:360,overflow:"auto",fontSize:12},children:[m&&(0,E.jsxs)("div",{children:[(0,E.jsx)(ae,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5,display:"block",marginBottom:6},children:o("chatWorkspace.workflowNode.properties")}),Object.entries(m).map(([a,s])=>{let h=S.includes(a),r=s.description,l=c(s),A=s.properties,O=s.items,D=!!(A||O);return(0,E.jsx)(Te,{title:D?(0,E.jsx)(un,{t:o,schema:D?A?s:O:void 0}):r||void 0,placement:"left",overlayStyle:{maxWidth:360},children:(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 6px",borderRadius:4,marginBottom:2,background:h?"rgba(99,102,241,0.04)":"transparent",cursor:D?"pointer":"default"},children:[(0,E.jsx)(ae,{style:{fontSize:11,fontWeight:h?600:400,fontFamily:"monospace"},children:a}),h&&(0,E.jsx)("span",{style:{color:"#ef4444",fontSize:9},children:"*"}),r&&!D&&(0,E.jsx)(ae,{type:"secondary",style:{fontSize:10,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),(0,E.jsx)(se,{color:g(l),style:{margin:0,fontSize:9,padding:"0 4px",lineHeight:"16px",marginLeft:"auto"},children:l})]})},a)})]}),!m&&I&&(0,E.jsxs)("div",{children:[(0,E.jsx)(ae,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5,display:"block",marginBottom:4},children:o("chatWorkspace.workflowNode.items")}),(0,E.jsx)(un,{t:o,schema:I})]})]})}var On=72,sr=3,ar=({data:u})=>{let o=_e();if(!u)return null;let{nodeType:p,name:m,description:S,ref:I,refAgentName:g,refAgentType:c,refDeleted:a,outputKey:s,nodeSchema:h,config:r,status:l,source:A,innerRef:O,inputTemplate:D,ask:Z,condition:j,runState:N,pending:B}=u,C=Ln[p]||Ln.agent,W=Rn[l||""]||Rn.__default,P=N?De[N.status]||De.running:null,z=P?.color,U=P?.icon,q=l==="success"?(0,E.jsx)(Oe,{size:14,color:"#22c55e"}):l==="failed"?(0,E.jsx)(Me,{size:14,color:"#ef4444"}):(0,E.jsx)(Fe,{size:14,color:"#94a3b8"}),fe=l==="success"?(0,E.jsx)(Oe,{size:32,color:W.color}):l==="failed"?(0,E.jsx)(Me,{size:32,color:W.color}):(0,E.jsx)(xn,{size:32,color:W.color}),ue=r?.title,oe=r?.maxRetries,J=r?.timeout,te=r?.batchSize,X=r?.maxConcurrency,G=r?.innerConcurrency,ee=N?.selected,_=!!N||B;function de(V){return V==null?"-":V<1e3?`${V}ms`:`${(V/1e3).toFixed(1)}s`}if(p==="terminal"){let V=W.color,ne=W.bg,pe=o(W.label),ce=fe;_&&(N?(V=z||V,pe=N.status,ce=(0,E.jsx)("span",{style:{fontSize:18},children:U})):B&&(V=In.color,ne="#fafafa",pe=o("chatWorkspace.workflowNode.pending"),ce=(0,E.jsx)(Fe,{size:18,style:{color:In.color}})));let me=ee&&z?`0 4px 16px ${z}30`:"0 2px 8px rgba(0,0,0,0.06)";return(0,E.jsxs)("div",{style:{padding:4,display:"flex",flexDirection:"column",alignItems:"center",opacity:B?.5:1},children:[(0,E.jsx)(ke,{type:"target",position:Ae.Top,style:Qe}),(0,E.jsx)(Te,{title:_&&N?o(Nn[N.status]):m,children:(0,E.jsx)("div",{style:{width:On,height:On,borderRadius:"50%",background:ne,border:`${sr}px solid ${B?`${V}80`:V}`,borderStyle:B?"dashed":"solid",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:me,transition:"all 0.2s ease",cursor:"default"},onMouseEnter:B?void 0:K=>{K.currentTarget.style.transform="scale(1.08)",K.currentTarget.style.boxShadow=`0 4px 16px ${V}30`},onMouseLeave:B?void 0:K=>{K.currentTarget.style.transform="scale(1)",K.currentTarget.style.boxShadow=me},children:ce})}),(0,E.jsx)(ae,{style:{fontSize:11,color:V,marginTop:6,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:pe}),(0,E.jsx)(ke,{type:"source",position:Ae.Bottom,style:Qe})]})}let le=_&&z?z:C.border,Ee=_&&z?z:C.color,he=p==="agent"?(0,E.jsx)(Tn,{size:14}):p==="map"?(0,E.jsx)(An,{size:14}):cr(m),ve=N?de(N.durationMs):null,Se=ee&&z?`0 4px 14px ${z}20`:"0 1px 6px rgba(0,0,0,0.08)",be=_&&z?z:C.color;return(0,E.jsxs)("div",{style:{padding:4},children:[(0,E.jsx)(ke,{type:"target",position:Ae.Top,style:Qe}),(0,E.jsxs)("div",{style:{width:260,minHeight:90,boxSizing:"border-box",background:"#fff",borderRadius:12,boxShadow:Se,border:"1px solid #e5e7eb",borderLeft:`3px solid ${le}`,borderStyle:I?"dashed":"solid",overflow:"hidden",transition:"all 0.2s ease",...B?{opacity:.5,borderStyle:"dashed"}:{}},onMouseEnter:B?void 0:V=>{V.currentTarget.style.transform="translateY(-2px)",V.currentTarget.style.boxShadow=`0 4px 12px ${be}20`},onMouseLeave:B?void 0:V=>{V.currentTarget.style.transform="translateY(0)",V.currentTarget.style.boxShadow=Se},children:[(0,E.jsxs)("div",{style:{background:C.bg,padding:"6px 12px",display:"flex",alignItems:"center",gap:6,borderBottom:"1px solid #f1f5f9"},children:[(0,E.jsx)("div",{style:{width:24,height:24,borderRadius:"50%",backgroundColor:Ee,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:600,flexShrink:0},children:he}),(0,E.jsx)("div",{style:{flex:1,minWidth:0},children:(0,E.jsx)(ae,{strong:!0,style:{fontSize:12,color:C.color},ellipsis:{tooltip:m},children:m})}),_&&U&&(0,E.jsx)(Te,{title:N?o(Nn[N.status]):void 0,children:(0,E.jsx)("span",{style:{color:z,fontSize:12,display:"flex",flexShrink:0},children:U})})]}),(0,E.jsxs)("div",{style:{padding:"10px 12px"},children:[S&&(0,E.jsx)(ae,{type:"secondary",style:{fontSize:11,display:"block",marginTop:2,lineHeight:1.4},ellipsis:{tooltip:S},children:S}),p==="map"&&A&&(0,E.jsxs)(ae,{type:"secondary",style:{fontSize:11,display:"block",marginTop:4,lineHeight:1.4,color:C.color,background:C.bg,padding:"2px 6px",borderRadius:4,maxHeight:32,overflow:"hidden"},ellipsis:{tooltip:A},children:["\u2190 ",A]}),p!=="map"&&D&&(0,E.jsx)(ae,{type:"secondary",style:{fontSize:11,display:"block",marginTop:4,lineHeight:1.4,color:C.color,background:C.bg,padding:"2px 6px",borderRadius:4,maxHeight:32,overflow:"hidden"},ellipsis:{tooltip:D},children:D}),(0,E.jsxs)("div",{style:{display:"flex",gap:4,marginTop:6,flexWrap:"wrap"},children:[!_&&p==="agent"&&I&&(0,E.jsx)(Te,{title:a?o("chatWorkspace.workflowNode.refDeleted",{ref:I}):o("chatWorkspace.workflowNode.refDelegated",{name:g??I}),children:(0,E.jsx)(se,{color:a?"red":"purple",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},icon:(0,E.jsx)(Sn,{size:10}),children:a?o("chatWorkspace.workflowNode.refDeletedTag",{ref:I}):`\u2192 ${g??I}`})}),!_&&p==="agent"&&!I&&(0,E.jsx)(se,{color:"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:o("chatWorkspace.workflowNode.inline")}),Z&&(0,E.jsx)(Te,{title:o("chatWorkspace.workflowNode.askTooltip"),children:(0,E.jsx)("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:20,height:20,borderRadius:"50%",background:"#fff7e6",border:"1px solid #ffd591",cursor:"default"},children:(0,E.jsx)(kn,{size:12,style:{color:"#fa8c16"}})})}),j&&(0,E.jsx)(Te,{title:o("chatWorkspace.workflowNode.when",{condition:j}),children:(0,E.jsx)("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:20,height:20,borderRadius:"50%",background:"#f0f5ff",border:"1px solid #adc6ff",cursor:"default"},children:(0,E.jsx)(wn,{size:12,style:{color:"#2f54eb"}})})}),!_&&p==="map"&&O&&(0,E.jsx)(se,{color:"purple",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:O}),!_&&p==="map"&&D&&(0,E.jsx)(se,{color:"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px",maxWidth:120},title:D,children:D.length>20?D.slice(0,18)+"\u2026":D}),!_&&p==="map"&&(te||X||G)&&(0,E.jsxs)(se,{color:"cyan",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:[te??50,"\xD7",X??10,"\xD7",G??5]}),!_&&oe?(0,E.jsxs)(se,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:["\u21BB ",oe]}):null,!_&&J?(0,E.jsxs)(se,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:["\u23F1 ",J,"s"]}):null,ve&&(0,E.jsx)(se,{color:N?"blue":"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:ve}),s&&(0,E.jsx)("span",{style:{marginLeft:"auto"}}),s&&(0,E.jsx)(gn,{trigger:"hover",placement:"right",mouseEnterDelay:.2,title:(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,E.jsx)(ae,{strong:!0,style:{fontSize:12},children:o("chatWorkspace.workflowNode.output")}),(0,E.jsx)(ae,{style:{fontSize:11,fontFamily:"monospace",color:"#6366f1"},children:s})]}),content:h?(0,E.jsx)(un,{t:o,schema:h}):(0,E.jsx)(ae,{type:"secondary",style:{fontSize:11},children:o("chatWorkspace.workflowNode.noSchema")}),children:(0,E.jsxs)(se,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px",flexShrink:0,cursor:"default"},children:["\u2192 ",s]})})]})]})]}),(0,E.jsx)(ke,{type:"source",position:Ae.Bottom,style:Qe})]})},Mn=ar;var H=Re(Ve()),{Text:ge}=Xe;function Fn(u){return new Date(u).toLocaleString()}function ur(u){return u.input?typeof u.input.rendered=="string"?u.input.rendered:typeof u.input.description=="string"?u.input.description:JSON.stringify(u.input,null,2):null}function pr(u){return u.output?typeof u.output.result=="string"?u.output.result:typeof u.output=="object"?JSON.stringify(u.output,null,2):String(u.output):null}function fr({step:u}){let o=_e(),p=ur(u),m=pr(u),S=De[u.status]||De.running,I=[{key:"io",label:o("chatWorkspace.workflowCanvas.tabIo"),children:(0,H.jsxs)(H.Fragment,{children:[p&&(0,H.jsxs)("div",{style:{marginBottom:m?12:0},children:[(0,H.jsx)(ge,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:o("chatWorkspace.workflowCanvas.input")}),(0,H.jsx)("div",{style:{background:"rgba(0,0,0,0.02)",borderRadius:8,padding:"8px 10px",marginTop:4,maxHeight:200,overflow:"auto"},children:u.input?.description?(0,H.jsx)(ln,{content:p}):(0,H.jsx)("pre",{style:{margin:0,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace"},children:p})})]}),m&&(0,H.jsxs)("div",{children:[(0,H.jsx)(ge,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:o("chatWorkspace.workflowCanvas.output")}),(0,H.jsx)("div",{style:{background:"linear-gradient(135deg, rgba(99,102,241,0.04) 0%, rgba(99,102,241,0.01) 100%)",borderRadius:8,padding:"8px 10px",marginTop:4,maxHeight:200,overflow:"auto"},children:u.output?.result?(0,H.jsx)(ln,{content:m}):(0,H.jsx)("pre",{style:{margin:0,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace"},children:m})})]}),!p&&!m&&(0,H.jsx)(ge,{type:"secondary",style:{fontSize:11},children:o("chatWorkspace.workflowCanvas.noIo")})]})}];return(0,H.jsxs)("div",{style:{maxWidth:480},children:[(0,H.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[(0,H.jsx)("span",{style:{color:S.color,fontSize:14},children:S.icon}),(0,H.jsx)(ge,{strong:!0,style:{fontSize:14},children:u.stepName}),(0,H.jsx)(se,{color:"purple",style:{fontSize:11},children:u.stepType})]}),u.edgePurpose&&(0,H.jsx)("div",{style:{marginBottom:10},children:(0,H.jsx)(ge,{type:"secondary",style:{fontSize:11},children:o("chatWorkspace.workflowCanvas.purpose",{purpose:u.edgePurpose})})}),u.errorMessage&&(0,H.jsx)("div",{style:{background:"#FEF2F2",border:"1px solid #FECACA",borderRadius:8,padding:"8px 12px",marginBottom:12,overflow:"hidden"},children:(0,H.jsx)(ge,{type:"danger",style:{fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:u.errorMessage})}),(0,H.jsx)(hn,{activeKey:"io",items:I,size:"small",style:{marginBottom:-8}}),(0,H.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginTop:12,paddingTop:8,borderTop:"1px solid #f0f0f0"},children:[(0,H.jsx)(ge,{type:"secondary",style:{fontSize:10},children:o("chatWorkspace.workflowCanvas.started",{time:Fn(u.startedAt)})}),u.completedAt&&(0,H.jsx)(ge,{type:"secondary",style:{fontSize:10},children:o("chatWorkspace.workflowCanvas.ended",{time:Fn(u.completedAt)})})]})]})}function Pe(u,o){return u.find(p=>p.stepName===o.name)??null}function Ze(u,o,p,m){let S=u.ref&&m?m.get(u.ref):void 0;return{nodeType:u.type,name:u.name,description:u.description,ref:u.ref,refAgentName:S?.name,refAgentType:S?.type,refDeleted:u.ref&&m?!S:void 0,outputKey:u.output?.key,nodeSchema:u.output?.schema,config:u.config,status:u.status,source:u.source,innerRef:u.node?.ref,inputTemplate:u.input?.template,ask:u.ask,condition:u.condition,runState:o,pending:p}}function Dn(u){let o=new Map;for(let p of u)if(p.parentGroup&&p.type!=="terminal"){let m=o.get(p.parentGroup)||[];m.push(p.id),o.set(p.parentGroup,m)}return Array.from(o.entries()).map(([p,m])=>({sourceId:p,childIds:m}))}function dr(){let u=_e();return(0,H.jsxs)("div",{style:{width:"100%",height:"100%",position:"relative",pointerEvents:"none"},children:[(0,H.jsx)(ke,{type:"target",position:Ae.Top,style:{opacity:0}}),(0,H.jsx)(ke,{type:"source",position:Ae.Bottom,style:{opacity:0}}),(0,H.jsx)("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,border:"2px dashed #a78bfa",borderRadius:12,background:"rgba(167, 139, 250, 0.04)"}}),(0,H.jsx)("div",{style:{position:"absolute",top:8,left:12,fontSize:12,fontWeight:600,color:"#7c3aed",padding:"2px 8px",background:"rgba(167, 139, 250, 0.08)",borderRadius:6,whiteSpace:"nowrap",zIndex:2},children:u("chatWorkspace.workflowCanvas.parallel")})]})}function gr(u,o){let p=u.nodes,m=u.edges,S=Dn(p),I=new Set(S.map(N=>N.sourceId)),g=new Set(S.flatMap(N=>N.childIds)),c=268,a=100,s=40;for(let N of S){let B=p.find(C=>C.id===N.sourceId);if(B){let C=N.childIds.length;B.width=C*c+(C-1)*s+40,B.height=a+100}}let h=p.filter(N=>!g.has(N.id)),r=an(h,m,{nodeWidth:c,nodeHeight:a,ranksep:120}),l=h.find(N=>!I.has(N.id)&&N.type!=="terminal"),A=l?r.get(l.id):void 0,O=l?l.width??c:c,D=A?A.x+O/2:0;for(let N of h){if(I.has(N.id))continue;let B=r.get(N.id);if(!B)continue;let C=N.width??c;B.x=D-C/2}let Z=h.filter(N=>r.has(N.id)&&!I.has(N.id)&&N.type!=="terminal").map(N=>{let B=r.get(N.id);return{id:N.id,type:"workflow",position:B,data:{...Ze(N,void 0,void 0,o)}}});for(let N of S){let B=p.find(J=>J.id===N.sourceId),C=r.get(N.sourceId);if(!B||!C)continue;let W=B.width,P=B.height,z=N.childIds.length,U=D-W/2,q=z*c+(z-1)*s,fe=D-q/2,ue=C.y+(P-a)/2;for(let J=0;J<z;J++){let te=N.childIds[J],X=p.find(G=>G.id===te);X&&Z.push({id:X.id,type:"workflow",position:{x:fe+J*(c+s),y:ue},data:{...Ze(X,void 0,void 0,o),parallelGroup:!0},style:{zIndex:2}})}let oe=`group_${N.sourceId}`;Z.push({id:oe,type:"groupLabel",position:{x:U,y:C.y},data:{},selectable:!1,draggable:!1,style:{zIndex:0,width:W,height:P}})}let j=[];for(let N of m){let B=sn(N);for(let C of B){let W=p.find(U=>U.id===C);if(W?.type==="terminal"&&W.name==="__end"||I.has(N.from)&&p.find(q=>q.id===C)?.parentGroup===N.from)continue;let P=I.has(N.from)?`group_${N.from}`:N.from,z=I.has(C)?`group_${C}`:C;j.push({id:`${P}-${z}`,source:P,target:z,type:"straight",markerEnd:{type:cn.ArrowClosed}})}}return{nodes:Z,edges:j}}function hr(u,o,p,m){let S=u.nodes,I=u.edges,g=Dn(S),c=new Set(g.map(C=>C.sourceId)),a=new Set(g.flatMap(C=>C.childIds)),s=268,h=100,r=40;for(let C of g){let W=S.find(P=>P.id===C.sourceId);if(W){let P=C.childIds.length;W.width=P*s+(P-1)*r+40,W.height=h+100}}let l=S.filter(C=>!a.has(C.id)),A=an(l,I,{nodeWidth:s,nodeHeight:h,ranksep:120}),O=l.find(C=>!c.has(C.id)&&C.type!=="terminal"),D=O?A.get(O.id):void 0,Z=O?O.width??s:s,j=D?D.x+Z/2:0;for(let C of l){if(c.has(C.id))continue;let W=A.get(C.id);if(!W)continue;let P=C.width??s;W.x=j-P/2}let N=l.filter(C=>A.has(C.id)&&!c.has(C.id)).map(C=>{let W=A.get(C.id),P=Pe(o,C),z=C.type==="terminal",U=P&&(!z||P.status!=="running")?{status:P.status,stepType:P.stepType,durationMs:P.durationMs,selected:!1}:void 0;return{id:C.id,type:"workflow",position:W,style:z?{width:s,height:h}:void 0,data:Ze(C,U,!P&&!z,m)}});for(let C of g){let W=S.find(X=>X.id===C.sourceId),P=A.get(C.sourceId);if(!W||!P)continue;let z=W.width,U=W.height,q=C.childIds.length,fe=q*s+(q-1)*r,ue=j-fe/2,oe=P.y+(U-h)/2;for(let X=0;X<q;X++){let G=C.childIds[X],ee=S.find(le=>le.id===G);if(!ee)continue;let _=Pe(o,ee),de=_?{status:_.status,stepType:_.stepType,durationMs:_.durationMs,selected:!1}:void 0;N.push({id:ee.id,type:"workflow",position:{x:ue+X*(s+r),y:oe},data:{...Ze(ee,de,!_,m),parallelGroup:!0},style:{zIndex:2}})}let J=j-z/2,te=`group_${C.sourceId}`;N.push({id:te,type:"groupLabel",position:{x:J,y:P.y},data:{},selectable:!1,draggable:!1,style:{zIndex:0,width:z,height:U}})}let B=[];for(let C of I){let W=sn(C);for(let P of W){if(c.has(C.from)&&S.find(_=>_.id===P)?.parentGroup===C.from)continue;let z=c.has(C.from)?`group_${C.from}`:C.from,U=c.has(P)?`group_${P}`:P,q=S.find(ee=>ee.id===C.from),ue=(q?Pe(o,q):void 0)!==void 0,oe=S.find(ee=>ee.id===P),te=(oe?Pe(o,oe):void 0)!==void 0,X=ue&&te,G=X?"#6366f1":"#d9d9d9";B.push({id:`${z}-${U}`,source:z,target:U,type:"straight",animated:X,style:X?{stroke:G,strokeWidth:2}:{stroke:G,strokeWidth:2,strokeDasharray:"6 4",opacity:.25},markerEnd:{type:cn.ArrowClosed,color:G,width:20,height:20}})}}return{nodes:N,edges:B}}var mr=({dsl:u,steps:o,assistantId:p,agentNameMap:m,onNodeClick:S,height:I="100%"})=>{let g=_e(),c=!!o,a=(0,ie.useMemo)(()=>({workflow:Mn,groupLabel:dr}),[]),{nodes:s,edges:h}=(0,ie.useMemo)(()=>c?hr(u,o,void 0,m):gr(u,m),[u,o,c,m]),[r,l,A]=Cn(s),[O,D,Z]=_n(h),[j,N]=(0,ie.useState)(null),B=(0,ie.useMemo)(()=>{if(!c||!j)return null;let U=u.nodes.find(q=>q.id===j);return U?Pe(o,U):null},[u.nodes,o,j,c]);(0,ie.useEffect)(()=>{l(s),D(h)},[s,h,l,D]);let C=(0,ie.useCallback)(()=>{l(U=>U.map(q=>({...q,data:{...q.data,runState:q.data.runState?{...q.data.runState,selected:!1}:void 0}})))},[l]);(0,ie.useEffect)(()=>{c&&l(U=>U.map(q=>({...q,data:{...q.data,runState:q.data.runState?{...q.data.runState,selected:q.id===j}:void 0}})))},[j,l,c]);let W=(0,ie.useCallback)((U,q)=>{c?N(q.id):S?.(q.id)},[c,S]),P=(0,ie.useCallback)(()=>{c&&(C(),N(null))},[c,C]),z=(0,ie.useCallback)(()=>{C(),N(null)},[C]);return!u.nodes||u.nodes.length===0?c?(0,H.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:300},children:(0,H.jsx)(mn,{size:"large"})}):(0,H.jsx)(dn,{description:g("chatWorkspace.workflowCanvas.noNodes")}):(0,H.jsx)(vn,{children:(0,H.jsx)(En,{nodes:r,edges:O,nodeTypes:a,onNodesChange:A,onEdgesChange:Z,onNodeClick:W,onPaneClick:c?P:void 0,height:I,fitView:!0,fitViewOptions:c?{padding:.3}:void 0,minZoom:c?.3:void 0,maxZoom:c?1.5:void 0,nodesDraggable:!1,nodesConnectable:c?!1:void 0,defaultEdgeOptions:c?void 0:{style:{strokeWidth:2}},backgroundGap:c?20:void 0,miniMap:c?{nodeStrokeWidth:3,pannable:!0,zoomable:!0,style:{backgroundColor:"#f5f5f5"}}:void 0,children:c&&B&&j&&(0,H.jsxs)("div",{style:{position:"absolute",right:24,top:24,width:460,maxHeight:"calc(100% - 48px)",background:"#fff",borderRadius:16,boxShadow:"0 8px 30px rgba(0,0,0,0.12)",border:"1px solid #e5e7eb",zIndex:10,overflow:"auto",padding:20},children:[(0,H.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[(0,H.jsx)(ge,{type:"secondary",style:{fontSize:11,textTransform:"uppercase",letterSpacing:.5},children:g("chatWorkspace.workflowCanvas.stepDetail")}),(0,H.jsx)(ge,{type:"secondary",style:{fontSize:11,cursor:"pointer"},onClick:z,children:g("common.close")})]}),(0,H.jsx)(fr,{step:B})]})})})},Gr=mr;var yr=Object.create,Pn=Object.defineProperty,xr=Object.getOwnPropertyDescriptor,wr=Object.getOwnPropertyNames,Sr=Object.getPrototypeOf,br=Object.prototype.hasOwnProperty,$=(u,o)=>()=>(o||(u((o={exports:{}}).exports,o),u=null),o.exports),Ar=(u,o,p,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(var S=wr(o),I=0,g=S.length,c;I<g;I++)c=S[I],!br.call(u,c)&&c!==p&&Pn(u,c,{get:(a=>o[a]).bind(null,c),enumerable:!(m=xr(o,c))||m.enumerable});return u},kr=(u,o,p)=>(p=u!=null?yr(Sr(u)):{},Ar(o||!u||!u.__esModule?Pn(p,"default",{value:u,enumerable:!0}):p,u)),We=$(((u,o)=>{function p(a){return typeof a>"u"||a===null}function m(a){return typeof a=="object"&&a!==null}function S(a){return Array.isArray(a)?a:p(a)?[]:[a]}function I(a,s){if(s){let h=Object.keys(s);for(let r=0,l=h.length;r<l;r+=1){let A=h[r];a[A]=s[A]}}return a}function g(a,s){let h="";for(let r=0;r<s;r+=1)h+=a;return h}function c(a){return a===0&&Number.NEGATIVE_INFINITY===1/a}o.exports.isNothing=p,o.exports.isObject=m,o.exports.toArray=S,o.exports.repeat=g,o.exports.isNegativeZero=c,o.exports.extend=I})),He=$(((u,o)=>{function p(S,I){let g="",c=S.reason||"(unknown reason)";return S.mark?(S.mark.name&&(g+='in "'+S.mark.name+'" '),g+="("+(S.mark.line+1)+":"+(S.mark.column+1)+")",!I&&S.mark.snippet&&(g+=`
|
|
2
2
|
|
|
3
3
|
`+S.mark.snippet),c+" "+g):c}function m(S,I){Error.call(this),this.name="YAMLException",this.reason=S,this.mark=I,this.message=p(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}m.prototype=Object.create(Error.prototype),m.prototype.constructor=m,m.prototype.toString=function(I){return this.name+": "+p(this,I)},o.exports=m})),Tr=$(((u,o)=>{var p=We();function m(g,c,a,s,h){let r="",l="",A=Math.floor(h/2)-1;return s-c>A&&(r=" ... ",c=s-A+r.length),a-s>A&&(l=" ...",a=s+A-l.length),{str:r+g.slice(c,a).replace(/\t/g,"\u2192")+l,pos:s-c+r.length}}function S(g,c){return p.repeat(" ",c-g.length)+g}function I(g,c){if(c=Object.create(c||null),!g.buffer)return null;c.maxLength||(c.maxLength=79),typeof c.indent!="number"&&(c.indent=1),typeof c.linesBefore!="number"&&(c.linesBefore=3),typeof c.linesAfter!="number"&&(c.linesAfter=2);let a=/\r?\n|\r|\0/g,s=[0],h=[],r,l=-1;for(;r=a.exec(g.buffer);)h.push(r.index),s.push(r.index+r[0].length),g.position<=r.index&&l<0&&(l=s.length-2);l<0&&(l=s.length-1);let A="",O=Math.min(g.line+c.linesAfter,h.length).toString().length,D=c.maxLength-(c.indent+O+3);for(let j=1;j<=c.linesBefore&&!(l-j<0);j++){let N=m(g.buffer,s[l-j],h[l-j],g.position-(s[l]-s[l-j]),D);A=p.repeat(" ",c.indent)+S((g.line-j+1).toString(),O)+" | "+N.str+`
|
|
4
4
|
`+A}let Z=m(g.buffer,s[l],h[l],g.position,D);A+=p.repeat(" ",c.indent)+S((g.line+1).toString(),O)+" | "+Z.str+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as M,E as N,F as S,I as z,J as w}from"./embed-page-chunk-
|
|
1
|
+
import{C as M,E as N,F as S,I as z,J as w}from"./embed-page-chunk-SQSVDSG6.js";import{g as D}from"./embed-page-chunk-NNQHJZ5Q.js";import{v as $,w as L}from"./embed-page-chunk-F7ZUYG42.js";import{k as v}from"./embed-page-chunk-YCTDKWKW.js";import{a as B}from"./embed-page-chunk-QV7QAJ4N.js";import{Ja as O,Sa as P,ba as C,bb as R}from"./embed-page-chunk-F7TA3LRH.js";import{a as Y}from"./embed-page-chunk-R5QL57JJ.js";import{f as I}from"./embed-page-chunk-QBTAJ2YI.js";var f=I(Y());function q(t,o){if(t.parentId&&t.parentId!==t.id&&o.has(t.parentId))return t.parentId;for(let c of t.dependencies??[])if(c!==t.id&&o.has(c))return c}function A(t,o){let u=o?.hideCompleted??!1?t.filter(e=>!w(e.status)):t,g=new Map(u.map(e=>[e.id,e])),p=new Map;for(let e of u)p.set(e.id,q(e,g));let l=new Set;for(let e of p.keys()){if(l.has(e))continue;let n=new Map,d=e,y=0;for(;d!==void 0&&!l.has(d)&&!n.has(d);)n.set(d,y),y+=1,d=p.get(d);if(d!==void 0&&n.has(d)){let h=n.get(d);for(let[x,s]of n)s>=h&&l.add(x)}}for(let e of l)p.set(e,void 0);let m=new Map;for(let e of u)m.set(e.id,[]);for(let e of u){let n=p.get(e.id);n!==void 0&&m.get(n).push(e.id)}let r=e=>({task:g.get(e),children:(m.get(e)??[]).map(r)});return u.filter(e=>p.get(e.id)===void 0).map(e=>r(e.id))}var i=I(B()),{Text:E}=R,J=16,K=3,Q=D(({css:t,token:o})=>({root:t`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
height: 100%;
|