@axiom-lattice/react-sdk 5.0.0 → 6.0.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.
Files changed (54) hide show
  1. package/dist/{AgentDetailSideApp-TIU7UQZH.mjs → AgentDetailSideApp-QZPV7MNB.mjs} +6 -6
  2. package/dist/{AgentGovernanceWorkbench-CWFRVPS5.mjs → AgentGovernanceWorkbench-25C3AKQI.mjs} +7 -7
  3. package/dist/{MessageGraph-XRSLD6VY.mjs → MessageGraph-JX6Y3VFH.mjs} +2 -2
  4. package/dist/{ReactChart-IW27RELF.mjs → ReactChart-LYUXL5M6.mjs} +2 -2
  5. package/dist/{TasksSideApp-5UTBVBIW.mjs → TasksSideApp-TWDLVB4D.mjs} +3 -3
  6. package/dist/{TeamWorkspace-WZ7EHM3X.mjs → TeamWorkspace-FGFAUD5Z.mjs} +2 -2
  7. package/dist/{TopologyRuntimeView-77JCSNTK.mjs → TopologyRuntimeView-O3VL4A7R.mjs} +3 -3
  8. package/dist/{WorkflowAutomationView-AVGN2L6Y.mjs → WorkflowAutomationView-D4YMZLRJ.mjs} +5 -5
  9. package/dist/{chunk-NE5RWDYD.mjs → chunk-3ZEMSWAC.mjs} +2 -2
  10. package/dist/{chunk-MFFUZVR5.mjs → chunk-466FV4VM.mjs} +2 -2
  11. package/dist/{chunk-CLCJX35D.mjs → chunk-6BWBE7MR.mjs} +6 -6
  12. package/dist/{chunk-QLFWQ4HR.mjs → chunk-7JDWJZ5M.mjs} +11 -11
  13. package/dist/{chunk-VQT22AKU.mjs → chunk-JJIGSAPR.mjs} +127 -220
  14. package/dist/chunk-JJIGSAPR.mjs.map +1 -0
  15. package/dist/{chunk-GJTDVFBS.mjs → chunk-QABSNIMF.mjs} +2 -2
  16. package/dist/{chunk-VLQM75ZM.mjs → chunk-UZWBRDTU.mjs} +4 -4
  17. package/dist/{embed-page-AgentDetailSideApp-XCP4LY7Y.js → embed-page-AgentDetailSideApp-JYVZKSUU.js} +1 -1
  18. package/dist/embed-page-AgentGovernanceWorkbench-SD2EHW2B.js +1 -0
  19. package/dist/{embed-page-MessageGraph-D77CYFAG.js → embed-page-MessageGraph-GLQXKAVC.js} +1 -1
  20. package/dist/{embed-page-ReactChart-TBDJOTZ5.js → embed-page-ReactChart-74MHCE2K.js} +1 -1
  21. package/dist/{embed-page-TasksSideApp-BVCIAE24.js → embed-page-TasksSideApp-DA4LUTMD.js} +1 -1
  22. package/dist/{embed-page-TeamWorkspace-JFEKNVFP.js → embed-page-TeamWorkspace-DUB3L6V6.js} +1 -1
  23. package/dist/{embed-page-TopologyRuntimeView-42TN76MK.js → embed-page-TopologyRuntimeView-NFBHAICN.js} +1 -1
  24. package/dist/{embed-page-WorkflowAutomationView-JLP4UHPP.js → embed-page-WorkflowAutomationView-43YGTXGF.js} +1 -1
  25. package/dist/{embed-page-chunk-K2U3JD67.js → embed-page-chunk-BVSC3MSO.js} +1 -1
  26. package/dist/{embed-page-chunk-5NJ3O2GK.js → embed-page-chunk-C4ZV4IXK.js} +2 -2
  27. package/dist/{embed-page-chunk-I3OONX3N.js → embed-page-chunk-DWIBLGBW.js} +1 -1
  28. package/dist/{embed-page-chunk-H64UEFHS.js → embed-page-chunk-GKHIPXZ2.js} +1 -1
  29. package/dist/{embed-page-chunk-YYDZ6ZBV.js → embed-page-chunk-P477ZTUO.js} +5 -5
  30. package/dist/{embed-page-chunk-GUSAII2D.js → embed-page-chunk-UHH575CK.js} +1 -1
  31. package/dist/embed-page.js +1 -1
  32. package/dist/index.d.mts +17 -20
  33. package/dist/index.d.ts +17 -20
  34. package/dist/index.js +467 -694
  35. package/dist/index.js.map +1 -1
  36. package/dist/index.mjs +89 -219
  37. package/dist/index.mjs.map +1 -1
  38. package/package.json +1 -1
  39. package/dist/chunk-VQT22AKU.mjs.map +0 -1
  40. package/dist/embed-page-AgentGovernanceWorkbench-BBDKEIBI.js +0 -5
  41. /package/dist/{AgentDetailSideApp-TIU7UQZH.mjs.map → AgentDetailSideApp-QZPV7MNB.mjs.map} +0 -0
  42. /package/dist/{AgentGovernanceWorkbench-CWFRVPS5.mjs.map → AgentGovernanceWorkbench-25C3AKQI.mjs.map} +0 -0
  43. /package/dist/{MessageGraph-XRSLD6VY.mjs.map → MessageGraph-JX6Y3VFH.mjs.map} +0 -0
  44. /package/dist/{ReactChart-IW27RELF.mjs.map → ReactChart-LYUXL5M6.mjs.map} +0 -0
  45. /package/dist/{TasksSideApp-5UTBVBIW.mjs.map → TasksSideApp-TWDLVB4D.mjs.map} +0 -0
  46. /package/dist/{TeamWorkspace-WZ7EHM3X.mjs.map → TeamWorkspace-FGFAUD5Z.mjs.map} +0 -0
  47. /package/dist/{TopologyRuntimeView-77JCSNTK.mjs.map → TopologyRuntimeView-O3VL4A7R.mjs.map} +0 -0
  48. /package/dist/{WorkflowAutomationView-AVGN2L6Y.mjs.map → WorkflowAutomationView-D4YMZLRJ.mjs.map} +0 -0
  49. /package/dist/{chunk-NE5RWDYD.mjs.map → chunk-3ZEMSWAC.mjs.map} +0 -0
  50. /package/dist/{chunk-MFFUZVR5.mjs.map → chunk-466FV4VM.mjs.map} +0 -0
  51. /package/dist/{chunk-CLCJX35D.mjs.map → chunk-6BWBE7MR.mjs.map} +0 -0
  52. /package/dist/{chunk-QLFWQ4HR.mjs.map → chunk-7JDWJZ5M.mjs.map} +0 -0
  53. /package/dist/{chunk-GJTDVFBS.mjs.map → chunk-QABSNIMF.mjs.map} +0 -0
  54. /package/dist/{chunk-VLQM75ZM.mjs.map → chunk-UZWBRDTU.mjs.map} +0 -0
@@ -1,3 +1,3 @@
1
- import{a as $e,b as Ge}from"./embed-page-chunk-K2U3JD67.js";import{b as Ue,c as be}from"./embed-page-chunk-H64UEFHS.js";import"./embed-page-chunk-WTOAQDQN.js";import{f as Ye}from"./embed-page-chunk-V2GBFWLG.js";import"./embed-page-chunk-S4XZPBRM.js";import{B as pe,Fa as He,G as je,I as ge,K as fe,O as Ee,S as _e,W as Fe,da as Be,e as Oe,h as de,ha as q,i as Pe,ia as ue,ja as Ne,na as me,oa as Z,ob as Ke,pa as qe,sa as ee,y as ce}from"./embed-page-chunk-YYDZ6ZBV.js";import{D as te,r as P}from"./embed-page-chunk-2PFKLMTR.js";import{a as E}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-QULNM5O2.js";import{Aa as Ae,Fc as Le,La as Q,W as $,Z as G,aa as U,ec as Me,ga as Ie,oc as De,ra as X,sb as Te,ta as J,va as ae,xc as le,ya as V}from"./embed-page-chunk-MHGVD4EV.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}
1
+ import{a as $e,b as Ge}from"./embed-page-chunk-BVSC3MSO.js";import{b as Ue,c as be}from"./embed-page-chunk-GKHIPXZ2.js";import"./embed-page-chunk-WTOAQDQN.js";import{f as Ye}from"./embed-page-chunk-V2GBFWLG.js";import"./embed-page-chunk-S4XZPBRM.js";import{B as pe,Fa as He,G as je,I as ge,K as fe,O as Ee,S as _e,W as Fe,da as Be,e as Oe,h as de,ha as q,i as Pe,ia as ue,ja as Ne,na as me,oa as Z,ob as Ke,pa as qe,sa as ee,y as ce}from"./embed-page-chunk-P477ZTUO.js";import{D as te,r as P}from"./embed-page-chunk-2PFKLMTR.js";import{a as E}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-QULNM5O2.js";import{Aa as Ae,Fc as Le,La as Q,W as $,Z as G,aa as U,ec as Me,ga as Ie,oc as De,ra as X,sb as Te,ta as J,va as ae,xc as le,ya as V}from"./embed-page-chunk-MHGVD4EV.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,3 +1,3 @@
1
- import{Pa as T,Xa as C,Ya as j,va as S}from"./embed-page-chunk-YYDZ6ZBV.js";import{r as d,y as x}from"./embed-page-chunk-2PFKLMTR.js";import{a as p}from"./embed-page-chunk-QV7QAJ4N.js";import{La as I,U as v,W as b,lb as P}from"./embed-page-chunk-MHGVD4EV.js";import{a as M}from"./embed-page-chunk-R5QL57JJ.js";import{f as a}from"./embed-page-chunk-QBTAJ2YI.js";var h=a(M());var t=a(p()),{Text:c}=I,_=({workflowContext:e,onClose:g,onToolCompleted:m,initialMessageRequest:n,onInitialMessageSubmitted:u,attemptedInitialMessageRequestIdsRef:f,rawInitialMessage:o,showHeader:s=!0})=>{let r=d(),$=x("agent-architect"),y=e?.id?`${$.tenantId}:${e.id}`:null,A=(0,h.useMemo)(()=>{if(e?.id&&e?.name)return e.type==="agent"?`[Context: You're viewing agent "${e.name}" (assistant: ${e.id})]`:`[Context: You're viewing workflow "${e.name}" (agent: ${e.id})]`},[e]),L=(0,h.useMemo)(()=>{if(!n||!e?.id)return null;if(o)return n;let l;return e.type==="workflow"?l=[`Purpose: ${n.content.trim()}`,"",`Workflow "${e.id}" has been created with an empty YAML DSL. Based on the purpose above, load the 'create-workflow' skill, design the workflow using the YAML needs+if DSL, and update it via update_workflow. Make sure to include a descriptive name.`].join(`
1
+ import{Pa as T,Xa as C,Ya as j,va as S}from"./embed-page-chunk-P477ZTUO.js";import{r as d,y as x}from"./embed-page-chunk-2PFKLMTR.js";import{a as p}from"./embed-page-chunk-QV7QAJ4N.js";import{La as I,U as v,W as b,lb as P}from"./embed-page-chunk-MHGVD4EV.js";import{a as M}from"./embed-page-chunk-R5QL57JJ.js";import{f as a}from"./embed-page-chunk-QBTAJ2YI.js";var h=a(M());var t=a(p()),{Text:c}=I,_=({workflowContext:e,onClose:g,onToolCompleted:m,initialMessageRequest:n,onInitialMessageSubmitted:u,attemptedInitialMessageRequestIdsRef:f,rawInitialMessage:o,showHeader:s=!0})=>{let r=d(),$=x("agent-architect"),y=e?.id?`${$.tenantId}:${e.id}`:null,A=(0,h.useMemo)(()=>{if(e?.id&&e?.name)return e.type==="agent"?`[Context: You're viewing agent "${e.name}" (assistant: ${e.id})]`:`[Context: You're viewing workflow "${e.name}" (agent: ${e.id})]`},[e]),L=(0,h.useMemo)(()=>{if(!n||!e?.id)return null;if(o)return n;let l;return e.type==="workflow"?l=[`Purpose: ${n.content.trim()}`,"",`Workflow "${e.id}" has been created with an empty YAML DSL. Based on the purpose above, load the 'create-workflow' skill, design the workflow using the YAML needs+if DSL, and update it via update_workflow. Make sure to include a descriptive name.`].join(`
2
2
  `):l=[`Purpose: ${n.content.trim()}`,"",`Configure the topology for workflow "${e.id}" based on this purpose. Create sub-agents, set up the processing pipeline, and wire them together with topology edges.`,"The current name is a placeholder \u2014 feel free to update it via update_processing_agent if you have a better one."].join(`
3
3
  `),{...n,content:l}},[n?.requestId,n?.content,e?.id,e?.type,o]);return(0,t.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column",borderLeft:"1px solid #f0f0f0",background:"rgba(255, 255, 255, 0.92)"},children:[s&&(0,t.jsxs)("div",{style:{padding:"12px 12px",borderBottom:"1px solid #f0f0f0",display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(c,{strong:!0,children:r("chat.copilot.agentBuilder")}),e&&(0,t.jsx)("div",{children:(0,t.jsx)(c,{type:"secondary",style:{fontSize:12},children:r("chat.copilot.viewing",{name:e.name})})})]}),g&&(0,t.jsx)(b,{type:"text",size:"small","aria-label":r("chat.copilot.close"),icon:(0,t.jsx)(P,{}),onClick:g})]}),y?(0,t.jsxs)(S,{threadId:y,assistantId:"agent-architect",options:{streaming:!0},onToolCompleted:m,children:[(0,t.jsx)(C,{request:L,onSubmitted:u,attemptedRequestIdsRef:f}),(0,t.jsx)(j,{showHeader:!1,showEmptyState:!1,showDatabaseSlot:!1,showSkillSlot:!1,showAgentSlot:!1,showMetricsDataSourceSlot:!1,systemContext:A})]}):(0,t.jsxs)("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"100%",textAlign:"center",gap:4,padding:"0 8px"},children:[(0,t.jsx)(c,{strong:!0,children:r("chat.copilot.agentBuilder")}),(0,t.jsx)(c,{type:"secondary",children:r("chat.copilot.selectWorkflow")})]})]})};var i=a(p()),O=({project:e,projects:g,value:m,onChange:n,selectable:u=!0,loading:f})=>{let o=d();return e?(0,i.jsxs)("div",{"data-testid":"training-context-card",style:{display:"flex",alignItems:"center",gap:8},children:[(0,i.jsx)("span",{style:{fontSize:12,color:"rgba(0,0,0,0.45)",flexShrink:0},children:o("governance.learning.projectLabel")}),u?(0,i.jsx)(T,{kind:"training",value:m??e.id,onChange:s=>{s&&n?.(s)},style:{minWidth:0}}):(0,i.jsx)("span",{style:{fontSize:12,fontWeight:500},children:e.name})]}):f?null:(0,i.jsx)(v,{type:"warning",showIcon:!0,message:o("governance.learning.noProject"),description:o("governance.learning.noProjectDescription")})};export{O as a,_ as b};
@@ -1,4 +1,4 @@
1
- import{a as fr,b as An}from"./embed-page-chunk-K2U3JD67.js";import{b as $i,c as Hi}from"./embed-page-chunk-H64UEFHS.js";import{a as Co}from"./embed-page-chunk-GUSAII2D.js";import{c as To,d as Ro}from"./embed-page-chunk-WTOAQDQN.js";import{b as st,c as Ni,d as wo,e as Rt,f as xo,g as Oi,h as In,i as Cn,j as Fi,l as _i,m as zi}from"./embed-page-chunk-V2GBFWLG.js";import{a as qi,b as Ui}from"./embed-page-chunk-I3OONX3N.js";import{A as fi,Aa as Pi,Ba as vo,C as mi,Ca as ho,D as yi,F as fo,Fa as Tn,L as vi,La as Rn,Ma as bo,Na as Ei,Qa as Di,Ra as Li,Sa as Mi,Ta as ko,Y as hi,Z as bi,_ as ki,aa as wi,ba as xi,d as di,f as ci,fb as Wi,g as Kn,ga as Ti,gb as Io,hb as So,ib as Ao,jb as Bi,ka as Ri,kb as Po,lb as ji,mb as Gi,nb as Eo,oa as mo,ob as Sn,p as ui,pa as Ii,qa as Ci,qb as gr,ra as Si,rb as Ki,sa as Nt,x as pi,xa as Ai,z as gi,za as yo}from"./embed-page-chunk-YYDZ6ZBV.js";import{C as uo,D as et,j as Jr,q as ei,r as z,v as ti,y as vt}from"./embed-page-chunk-2PFKLMTR.js";import{a as W}from"./embed-page-chunk-QV7QAJ4N.js";import{Bb as xn,Cb as ii,Cc as ai,Ec as si,Fc as ur,Gc as pr,Ha as co,Ia as He,Ja as Yr,La as Be,Ma as Xr,Rc as li,Sb as cr,U as Yt,W as U,Wa as ni,Y as wn,Z as Gt,_ as it,aa as Xt,ca as lr,da as dr,eb as oi,ec as go,fa as Zr,ia as cn,la as Vr,lb as Gn,na as Qr,nb as ri,oa as Lt,ra as ge,sb as po,ta as Me,va as Tt,xa as at,xc as Mt,ya as ze}from"./embed-page-chunk-MHGVD4EV.js";import{a as Ie}from"./embed-page-chunk-R5QL57JJ.js";import{f as R}from"./embed-page-chunk-QBTAJ2YI.js";var Zs={react:{label:"capability",color:"blue"},capability:{label:"capability",color:"blue"},deep_agent:{label:"orchestrator",color:"orange"},orchestrator:{label:"orchestrator",color:"orange"},team:{label:"team",color:"green"},processing:{label:"workflow",color:"purple"},workflow:{label:"workflow",color:"purple"},a2a_remote:{label:"remote",color:"cyan"},remote:{label:"remote",color:"cyan"}};function Pn(e){return Zs[e]??{label:"capability",color:"blue"}}var Vs={enabled:"green",draft:"orange",disabled:"default"};function Vi(e){return Vs[e]??"default"}var Zi={blue:"#3b82f6",orange:"#f59e0b",green:"#22c55e",purple:"#a855f7",cyan:"#06b6d4"};function qn(e){return Zi[e]??Zi.cyan}function Jd(e){let t={enabled:"#22c55e",draft:"#f59e0b",disabled:"#d9d9d9"};return t[e]??t.disabled}function En(e){return typeof e.graphDefinition=="object"&&e.graphDefinition!==null?e.graphDefinition:{}}function yr(e){return((En(e).metadata??{}).tags??"").split(",").map(r=>r.trim()).filter(Boolean)}function vr(e){let o=(En(e).metadata??{}).version;return o?o.startsWith("v")?o:`v${o}`:"v1"}function hr(e){let o=(En(e).metadata??{}).status??"enabled";return o==="draft"||o==="disabled"?o:"enabled"}function mr(e){let n=En(e).subAgents??[],o=Array.isArray(n)?n.filter(Boolean):[];return Array.from(new Set(o))}function ec(e){return e.map(t=>{let n=En(t),o=String(n.type??"react");return{id:t.id,name:t.name,description:t.description,type:Pn(o).label,tags:yr(t),version:vr(t),status:hr(t),subAgents:mr(t)}})}function tc(e){let t=new Set(e.map(r=>r.id)),n=e.map(r=>({id:r.id,label:r.name,type:Pn(String(En(r).type??"react")).label,subAgentCount:mr(r).length})),o=[];for(let r of e)for(let i of mr(r))t.has(i)&&o.push({source:r.id,target:i});return{nodes:n,edges:o}}var Se=R(Ie());var te=R(Ie());var b=R(W()),{TextArea:Qs}=Me,{Text:It}=Be,Qi=["data","execution","workflow","assistant"],Yi={data:"chatConfig.agentPanel.category.data",execution:"chatConfig.agentPanel.category.execution",workflow:"chatConfig.agentPanel.category.workflow",assistant:"chatConfig.agentPanel.category.assistant",other:"chatConfig.agentPanel.category.other"},Ys={react:"chatConfig.agentPanel.typeDesc.react",deep_agent:"chatConfig.agentPanel.typeDesc.deepAgent",team:"chatConfig.agentPanel.typeDesc.team",processing:"chatConfig.agentPanel.typeDesc.processing"},$n=(e,t)=>{if(Array.isArray(e)){let n=e.map(o=>$n(o));return(t==="tools"||t==="subAgents")&&n.every(o=>typeof o=="string")?[...n].sort():n}return e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([n],[o])=>n.localeCompare(o)).map(([n,o])=>[n,$n(o,n)])):e},Xi=e=>{if(typeof e!="string")return $n(e??null);try{return $n(JSON.parse(e))}catch{return e}},Ji=e=>JSON.stringify($n({...e,tools:[...e.tools].sort(),subAgents:[...e.subAgents].sort()})),Xs=Si(({token:e,css:t})=>({modalBody:t`
1
+ import{a as fr,b as An}from"./embed-page-chunk-BVSC3MSO.js";import{b as $i,c as Hi}from"./embed-page-chunk-GKHIPXZ2.js";import{a as Co}from"./embed-page-chunk-UHH575CK.js";import{c as To,d as Ro}from"./embed-page-chunk-WTOAQDQN.js";import{b as st,c as Ni,d as wo,e as Rt,f as xo,g as Oi,h as In,i as Cn,j as Fi,l as _i,m as zi}from"./embed-page-chunk-V2GBFWLG.js";import{a as qi,b as Ui}from"./embed-page-chunk-DWIBLGBW.js";import{A as fi,Aa as Pi,Ba as vo,C as mi,Ca as ho,D as yi,F as fo,Fa as Tn,L as vi,La as Rn,Ma as bo,Na as Ei,Qa as Di,Ra as Li,Sa as Mi,Ta as ko,Y as hi,Z as bi,_ as ki,aa as wi,ba as xi,d as di,f as ci,fb as Wi,g as Kn,ga as Ti,gb as Io,hb as So,ib as Ao,jb as Bi,ka as Ri,kb as Po,lb as ji,mb as Gi,nb as Eo,oa as mo,ob as Sn,p as ui,pa as Ii,qa as Ci,qb as gr,ra as Si,rb as Ki,sa as Nt,x as pi,xa as Ai,z as gi,za as yo}from"./embed-page-chunk-P477ZTUO.js";import{C as uo,D as et,j as Jr,q as ei,r as z,v as ti,y as vt}from"./embed-page-chunk-2PFKLMTR.js";import{a as W}from"./embed-page-chunk-QV7QAJ4N.js";import{Bb as xn,Cb as ii,Cc as ai,Ec as si,Fc as ur,Gc as pr,Ha as co,Ia as He,Ja as Yr,La as Be,Ma as Xr,Rc as li,Sb as cr,U as Yt,W as U,Wa as ni,Y as wn,Z as Gt,_ as it,aa as Xt,ca as lr,da as dr,eb as oi,ec as go,fa as Zr,ia as cn,la as Vr,lb as Gn,na as Qr,nb as ri,oa as Lt,ra as ge,sb as po,ta as Me,va as Tt,xa as at,xc as Mt,ya as ze}from"./embed-page-chunk-MHGVD4EV.js";import{a as Ie}from"./embed-page-chunk-R5QL57JJ.js";import{f as R}from"./embed-page-chunk-QBTAJ2YI.js";var Zs={react:{label:"capability",color:"blue"},capability:{label:"capability",color:"blue"},deep_agent:{label:"orchestrator",color:"orange"},orchestrator:{label:"orchestrator",color:"orange"},team:{label:"team",color:"green"},processing:{label:"workflow",color:"purple"},workflow:{label:"workflow",color:"purple"},a2a_remote:{label:"remote",color:"cyan"},remote:{label:"remote",color:"cyan"}};function Pn(e){return Zs[e]??{label:"capability",color:"blue"}}var Vs={enabled:"green",draft:"orange",disabled:"default"};function Vi(e){return Vs[e]??"default"}var Zi={blue:"#3b82f6",orange:"#f59e0b",green:"#22c55e",purple:"#a855f7",cyan:"#06b6d4"};function qn(e){return Zi[e]??Zi.cyan}function Jd(e){let t={enabled:"#22c55e",draft:"#f59e0b",disabled:"#d9d9d9"};return t[e]??t.disabled}function En(e){return typeof e.graphDefinition=="object"&&e.graphDefinition!==null?e.graphDefinition:{}}function yr(e){return((En(e).metadata??{}).tags??"").split(",").map(r=>r.trim()).filter(Boolean)}function vr(e){let o=(En(e).metadata??{}).version;return o?o.startsWith("v")?o:`v${o}`:"v1"}function hr(e){let o=(En(e).metadata??{}).status??"enabled";return o==="draft"||o==="disabled"?o:"enabled"}function mr(e){let n=En(e).subAgents??[],o=Array.isArray(n)?n.filter(Boolean):[];return Array.from(new Set(o))}function ec(e){return e.map(t=>{let n=En(t),o=String(n.type??"react");return{id:t.id,name:t.name,description:t.description,type:Pn(o).label,tags:yr(t),version:vr(t),status:hr(t),subAgents:mr(t)}})}function tc(e){let t=new Set(e.map(r=>r.id)),n=e.map(r=>({id:r.id,label:r.name,type:Pn(String(En(r).type??"react")).label,subAgentCount:mr(r).length})),o=[];for(let r of e)for(let i of mr(r))t.has(i)&&o.push({source:r.id,target:i});return{nodes:n,edges:o}}var Se=R(Ie());var te=R(Ie());var b=R(W()),{TextArea:Qs}=Me,{Text:It}=Be,Qi=["data","execution","workflow","assistant"],Yi={data:"chatConfig.agentPanel.category.data",execution:"chatConfig.agentPanel.category.execution",workflow:"chatConfig.agentPanel.category.workflow",assistant:"chatConfig.agentPanel.category.assistant",other:"chatConfig.agentPanel.category.other"},Ys={react:"chatConfig.agentPanel.typeDesc.react",deep_agent:"chatConfig.agentPanel.typeDesc.deepAgent",team:"chatConfig.agentPanel.typeDesc.team",processing:"chatConfig.agentPanel.typeDesc.processing"},$n=(e,t)=>{if(Array.isArray(e)){let n=e.map(o=>$n(o));return(t==="tools"||t==="subAgents")&&n.every(o=>typeof o=="string")?[...n].sort():n}return e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([n],[o])=>n.localeCompare(o)).map(([n,o])=>[n,$n(o,n)])):e},Xi=e=>{if(typeof e!="string")return $n(e??null);try{return $n(JSON.parse(e))}catch{return e}},Ji=e=>JSON.stringify($n({...e,tools:[...e.tools].sort(),subAgents:[...e.subAgents].sort()})),Xs=Si(({token:e,css:t})=>({modalBody:t`
2
2
  padding: 0;
3
3
  height: 92vh;
4
4
  width: 100%;
@@ -239,4 +239,4 @@ export function HooksExample({ currentUser }: ExampleProps) {
239
239
  .agent-detail__identity-pill { max-width: calc(100% - 24px) !important; right: 12px; }
240
240
  .agent-detail__actions-pill { top: 52px !important; left: 12px; right: auto !important; }
241
241
  }
242
- `,Yd=e=>e==="configuration"?{kind:"configuration"}:e==="playground"?{kind:"playground"}:e==="eval"?{kind:"eval",initial:{page:"suites"},navigationKey:0}:e==="web-apps"?{kind:"web-apps"}:null,Xd=e=>{let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{return{}}return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:{}},iy=({assistant:e,allAssistants:t,onBack:n,onDeleted:o,initialTab:r="graph",onSave:i,onAssistantUpdated:l,onAgentListInvalidated:c,initialMessage:d=null,initialMessageCustomRunConfig:a=null,initialProjectId:y=null})=>{let g=z(),[u,f]=(0,Se.useState)(()=>Yd(r)),[s,v]=(0,Se.useState)(!1),[k,h]=(0,Se.useState)(!1),[m,w]=(0,Se.useState)(null),[C,P]=(0,Se.useState)(0),S=(0,Se.useRef)(null),$=(0,Se.useRef)(()=>{}),E=(0,Se.useRef)(0),x=(0,Se.useRef)(null),M=(0,Se.useRef)(null),de=(0,Se.useRef)(null),X=(0,Se.useRef)(null),V=(0,Se.useRef)(null),pe=(0,Se.useRef)(null),A=(0,Se.useRef)(null),[G,F]=(0,Se.useState)(()=>d?{requestId:`initial:${e.id}`,content:d,...a?{customRunConfig:a}:{}}:null),{workspaceId:Q,trainingProjects:oe}=Nt(),N=Gs(e.graphDefinition),[B,me]=(0,Se.useState)(y??N??oe[0]?.id??null),ee=K=>{me(K)},ke=(K,ye,Xe)=>{let Je=oe.find(Ke=>Ke.id===B)??null;F({requestId:ye,content:Ia({goal:K,roundTaskId:ye,targetAgentId:e.id,targetMode:Ra(e),files:Xe,projectId:B??void 0,workspaceId:Je?.workspaceId??Q??void 0}),customRunConfig:{execution:{taskId:ye}}})},he=K=>{F(ye=>ye?.requestId===K?null:ye)};(0,Se.useEffect)(()=>{!B&&oe.length>0&&me(oe[0].id)},[B,oe]);let[O,ne]=(0,Se.useState)(!1),[De,j]=(0,Se.useState)(!1),[_,ie]=(0,Se.useState)(!1),[le,L]=(0,Se.useState)(e.graphDefinition),{handleToolCompleted:Le,learningTasks:be,refreshLearningTasks:Ce,evalTick:Ee}=$s({agentId:e.id,projectId:B,onAssistantUpdated:l,onAgentListInvalidated:c});(0,Se.useEffect)(()=>{L(e.graphDefinition)},[e]);let Ne=typeof e.graphDefinition=="object"?e.graphDefinition:{},rt=String(Ne.type??"react"),We=Pn(rt),tt=rt==="workflow"?mo:Kn,Oe=yr(e),mt=hr(e),kt=Vi(mt),At=K=>{K.kind==="back"?n():K.kind==="close"?f(null):K.kind==="architect"?(f(null),P(ye=>ye+1)):f(K.view)},Ge=K=>{if(!S.current&&!(K.kind==="dock"&&K.view.kind!=="node"&&u?.kind===K.view.kind&&K.view.kind!=="eval")){if(u?.kind==="configuration"&&s){S.current=K,w(K);return}At(K)}};$.current=Ge;let sn=K=>{let ye=K??(document.activeElement instanceof HTMLElement?document.activeElement:void 0);return ye?{current:ye}:void 0},ln=(0,Se.useCallback)(K=>{let ye=++E.current;$.current({kind:"dock",view:{kind:"eval",initial:{page:"suites"},navigationKey:ye,restoreFocusRef:sn(K)}})},[]),dn=()=>{S.current=null,w(null),requestAnimationFrame(()=>A.current?.())},Bt=()=>{let K=S.current;K&&(S.current=null,w(null),v(!1),At(K))},wt=()=>{j(!0)},Ze=async()=>{ne(!0);try{await o(e.id),j(!1)}finally{ne(!1)}},xt=K=>(L(K),i?.(e,K)),kn=i?async(K,ye)=>{await i(K,ye),L({...Xd(K.graphDefinition),...ye})}:void 0,Vt=K=>{let ye=typeof le=="object"&&le!==null?le:{},Xe={...ye};if(K.type==="tool"&&K.id.startsWith("tool:"))Xe.tools=(ye.tools??[]).filter(Je=>Je!==K.id.slice(5));else if(K.type==="subagent"&&K.id.startsWith("sub:"))Xe.subAgents=(ye.subAgents??[]).filter(Je=>Je!==K.id.slice(4));else if(K.type==="skill"&&K.id.startsWith("skill:")){let Je=K.id.slice(6);Xe.skills=(ye.skills??[]).filter(Ke=>Ke!==Je),Array.isArray(ye.middleware)&&(Xe.middleware=ye.middleware.map(Ke=>{if(Ke.type!=="skill")return Ke;let Pt=typeof Ke.config=="object"&&Ke.config!==null?Ke.config:{};return K.id===br?{...Ke,config:{...Pt,readAll:!1}}:!Array.isArray(Pt.skills)||!Pt.skills.includes(Je)?Ke:{...Ke,config:{...Pt,skills:Pt.skills.filter(nt=>nt!==Je)}}}))}else if(K.type==="capability"&&K.id.startsWith("cap:")){let Je=K.id.slice(4);Xe.middleware=(ye.middleware??[]).filter(Ke=>Ke.type!==Je)}else return;L(Xe),i?.(e,Xe).catch(()=>at.error(g("governance.detail.removeNodeSaveFailed")))};return(0,Y.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column",background:"#fff"},children:[(0,Y.jsx)("style",{"data-agent-detail-responsive":!0,children:Qd}),(0,Y.jsxs)("div",{style:{flex:1,minHeight:0,position:"relative"},children:[(0,Y.jsxs)("div",{"data-testid":"agent-header-pill",className:"agent-detail__identity-pill",style:{position:"absolute",top:12,left:12,zIndex:12,display:"flex",alignItems:"center",gap:8,height:32,padding:"0 10px 0 4px",background:"rgba(255,255,255,0.95)",borderRadius:10,boxShadow:"0 2px 12px rgba(0,0,0,0.08)",border:"1px solid #f0f0f0",maxWidth:"calc(100% - 176px)",minWidth:0},children:[(0,Y.jsx)(U,{type:"text",size:"small",icon:(0,Y.jsx)(ni,{}),onClick:()=>Ge({kind:"back"}),"aria-label":g("common.back")}),(0,Y.jsx)(tt,{size:15,color:qn(We.color)}),(0,Y.jsx)(Hs,{strong:!0,style:{fontSize:13,maxWidth:220,minWidth:0,flex:"1 1 auto",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),(0,Y.jsx)("span",{"data-testid":"agent-status-dot",title:mt,style:{width:8,height:8,borderRadius:"50%",background:qn(kt),flexShrink:0}}),(0,Y.jsx)(U,{type:"text",size:"small","aria-label":g("governance.detail.viewDescription"),icon:(0,Y.jsx)(go,{}),style:{color:"#6366f1"},onClick:()=>ie(!0)})]}),(0,Y.jsxs)("div",{"data-testid":"agent-actions-pill",className:"agent-detail__actions-pill",style:{position:"absolute",top:12,right:12,zIndex:12,display:"flex",alignItems:"center",gap:2,height:32,padding:"0 6px",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,Y.jsx)(Xt,{title:g("governance.detail.testInPlayground"),children:(0,Y.jsx)(U,{ref:x,type:"text",size:"small",icon:(0,Y.jsx)(xi,{size:14}),onClick:()=>Ge({kind:"dock",view:{kind:"playground"}}),"aria-label":g("governance.detail.testInPlayground"),"aria-pressed":u?.kind==="playground",style:u?.kind==="playground"?rr:void 0})}),(0,Y.jsx)(Xt,{title:g("governance.detail.evalSuite"),children:(0,Y.jsx)(U,{ref:M,type:"text",size:"small",icon:(0,Y.jsx)(fo,{size:14}),onClick:()=>ln(M.current??void 0),"aria-label":g("governance.detail.evalSuite"),"aria-pressed":u?.kind==="eval",style:u?.kind==="eval"?rr:void 0})}),(0,Y.jsx)(Xt,{title:g("governance.detail.webApps"),children:(0,Y.jsx)(U,{ref:de,type:"text",size:"small",icon:(0,Y.jsx)(bi,{size:14}),onClick:()=>Ge({kind:"dock",view:{kind:"web-apps"}}),"aria-label":g("governance.detail.webApps"),"aria-pressed":u?.kind==="web-apps",style:u?.kind==="web-apps"?rr:void 0})}),(0,Y.jsx)(Xt,{title:g("governance.detail.configuration"),children:(0,Y.jsx)(U,{ref:X,type:"text",size:"small",icon:(0,Y.jsx)(Ti,{size:14}),onClick:()=>Ge({kind:"dock",view:{kind:"configuration"}}),"aria-label":g("governance.detail.configuration"),"aria-pressed":u?.kind==="configuration",style:u?.kind==="configuration"?rr:void 0})}),(0,Y.jsx)(Xt,{title:g("governance.deleteAgent"),children:(0,Y.jsx)(U,{type:"text",size:"small",danger:!0,icon:(0,Y.jsx)(po,{}),loading:O,onClick:wt,"aria-label":g("governance.deleteAgent")})})]}),rt==="workflow"?(0,Y.jsx)(zs,{graphDefinition:le,assistantId:e.id,assistantName:e.name,workspaceId:Q,description:e.description,hideTitleBar:!0,hudTopOffset:56,initialMessageRequest:G,onInitialMessageSubmitted:he,projectId:B,onProjectChange:ee,onLearningStarted:ke,onToolActivity:Le,learningTasks:be,onLearningRefresh:Ce,evalTick:Ee,architectOpenSignal:C,architectRestoreFocusRef:pe,copilotTemporarilyHidden:u!==null}):(0,Y.jsx)(_s,{graphDefinition:le,assistantId:e.id,assistantName:e.name,workspaceId:Q,hudTopOffset:56,onSelectNode:K=>{K?Ge({kind:"dock",view:{kind:"node",node:K}}):u?.kind==="node"&&Ge({kind:"close"})},onRemoveNode:Vt,initialMessageRequest:G,onInitialMessageSubmitted:he,projectId:B,onProjectChange:ee,onLearningStarted:ke,onToolActivity:Le,learningTasks:be,onLearningRefresh:Ce,evalTick:Ee,architectOpenSignal:C,architectRestoreFocusRef:pe,copilotTemporarilyHidden:u!==null}),u?.kind==="node"&&(0,Y.jsx)(ct,{open:!0,width:Ws(u.node),title:Bs(u.node),onClose:()=>f(null),children:(0,Y.jsx)(js,{node:u.node,graphDefinition:le,assistantId:e.id,onRemoveNode:K=>{Vt(K),f(null)},onSaveGraph:xt})}),u?.kind==="playground"&&(0,Y.jsx)(ct,{open:!0,width:720,title:g("governance.detail.playground"),onClose:()=>Ge({kind:"close"}),restoreFocusRef:x,children:(0,Y.jsx)(Ki,{assistant_id:e.id})}),u?.kind==="eval"&&(0,Y.jsx)(ct,{open:!0,width:860,title:u.initial?.page==="run"?g("governance.detail.runResults"):g("governance.detail.evalSuite"),onClose:()=>Ge({kind:"close"}),restoreFocusRef:u.restoreFocusRef??M,children:(0,Y.jsx)(Lo,{assistantId:e.id,initial:u.initial,navigationKey:u.navigationKey})},u.navigationKey),u?.kind==="web-apps"&&(0,Y.jsx)(ct,{open:!0,width:960,title:g("governance.detail.webApps"),onClose:()=>Ge({kind:"close"}),restoreFocusRef:de,bodyStyle:{padding:0,overflow:"hidden"},children:(0,Y.jsx)(ra,{assistant:e})}),u?.kind==="configuration"&&(0,Y.jsx)(ct,{open:!0,width:"80%",mobileWidth:"calc(100% - 24px)",title:g("governance.detail.configuration"),onClose:()=>Ge({kind:"close"}),bodyStyle:{padding:0,overflow:"hidden"},restoreFocusRef:V,focusControlRef:A,escapeEnabled:!k&&!_&&!De&&m===null,children:(0,Y.jsx)(ta,{assistant:{...e,graphDefinition:le},allAssistants:t,visible:!0,onClose:()=>Ge({kind:"close"}),onSave:kn,onDirtyChange:v,onOverlayOpenChange:h,embedded:!0})})]}),(0,Y.jsx)(ze,{title:g("governance.detail.discardTitle"),open:m!==null,onCancel:dn,onOk:Bt,okText:g("governance.detail.discard"),okButtonProps:{danger:!0},cancelText:g("governance.detail.continueEditing"),children:(0,Y.jsx)("p",{children:g("governance.detail.discardBody")})}),(0,Y.jsxs)(ze,{title:e.name,open:_,onCancel:()=>ie(!1),footer:null,width:640,centered:!0,children:[(0,Y.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:12},children:[(0,Y.jsx)(He,{color:We.color,style:{margin:0},children:We.label}),Oe.map(K=>(0,Y.jsx)(He,{color:"magenta",style:{margin:0},children:K},K)),(0,Y.jsx)(He,{style:{margin:0},children:vr(e)}),(0,Y.jsx)(He,{color:kt,style:{margin:0},children:mt})]}),e.description?(0,Y.jsx)(Tn,{content:e.description}):(0,Y.jsx)(Hs,{type:"secondary",children:g("governance.detail.noDescription")})]}),(0,Y.jsx)(ze,{title:g("governance.deleteAgent"),open:De,onCancel:()=>j(!1),onOk:Ze,okText:g("common.delete"),okButtonProps:{danger:!0,loading:O},cancelText:g("common.cancel"),children:(0,Y.jsx)("p",{children:g("governance.detail.deleteConfirm",{name:e.name})})})]})};export{Pn as a,qn as b,Jd as c,ec as d,tc as e,ba as f,wa as g,Zu as h,xa as i,Ta as j,Ia as k,iy as l};
242
+ `,Yd=e=>e==="configuration"?{kind:"configuration"}:e==="playground"?{kind:"playground"}:e==="eval"?{kind:"eval",initial:{page:"suites"},navigationKey:0}:e==="web-apps"?{kind:"web-apps"}:null,Xd=e=>{let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{return{}}return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:{}},iy=({assistant:e,allAssistants:t,onBack:n,onDeleted:o,initialTab:r="graph",onSave:i,onAssistantUpdated:l,onAgentListInvalidated:c,initialMessage:d=null,initialMessageCustomRunConfig:a=null,initialProjectId:y=null})=>{let g=z(),[u,f]=(0,Se.useState)(()=>Yd(r)),[s,v]=(0,Se.useState)(!1),[k,h]=(0,Se.useState)(!1),[m,w]=(0,Se.useState)(null),[C,P]=(0,Se.useState)(0),S=(0,Se.useRef)(null),$=(0,Se.useRef)(()=>{}),E=(0,Se.useRef)(0),x=(0,Se.useRef)(null),M=(0,Se.useRef)(null),de=(0,Se.useRef)(null),X=(0,Se.useRef)(null),V=(0,Se.useRef)(null),pe=(0,Se.useRef)(null),A=(0,Se.useRef)(null),[G,F]=(0,Se.useState)(()=>d?{requestId:`initial:${e.id}`,content:d,...a?{customRunConfig:a}:{}}:null),{workspaceId:Q,trainingProjects:oe}=Nt(),N=Gs(e.graphDefinition),[B,me]=(0,Se.useState)(y??N??oe[0]?.id??null),ee=K=>{me(K)},ke=(K,ye,Xe)=>{let Je=oe.find(Ke=>Ke.id===B)??null;F({requestId:ye,content:Ia({goal:K,roundTaskId:ye,targetAgentId:e.id,targetMode:Ra(e),files:Xe,projectId:B??void 0,workspaceId:Je?.workspaceId??Q??void 0}),customRunConfig:{execution:{taskId:ye}}})},he=K=>{F(ye=>ye?.requestId===K?null:ye)};(0,Se.useEffect)(()=>{!B&&oe.length>0&&me(oe[0].id)},[B,oe]);let[O,ne]=(0,Se.useState)(!1),[De,j]=(0,Se.useState)(!1),[_,ie]=(0,Se.useState)(!1),[le,L]=(0,Se.useState)(e.graphDefinition),{handleToolCompleted:Le,learningTasks:be,refreshLearningTasks:Ce,evalTick:Ee}=$s({agentId:e.id,projectId:B,onAssistantUpdated:l,onAgentListInvalidated:c});(0,Se.useEffect)(()=>{L(e.graphDefinition)},[e]);let Ne=typeof e.graphDefinition=="object"?e.graphDefinition:{},rt=String(Ne.type??"react"),We=Pn(rt),tt=rt==="workflow"?mo:Kn,Oe=yr(e),mt=hr(e),kt=Vi(mt),At=K=>{K.kind==="back"?n():K.kind==="close"?f(null):K.kind==="architect"?(f(null),P(ye=>ye+1)):f(K.view)},Ge=K=>{if(!S.current&&!(K.kind==="dock"&&K.view.kind!=="node"&&u?.kind===K.view.kind&&K.view.kind!=="eval")){if(u?.kind==="configuration"&&s){S.current=K,w(K);return}At(K)}};$.current=Ge;let sn=K=>{let ye=K??(document.activeElement instanceof HTMLElement?document.activeElement:void 0);return ye?{current:ye}:void 0},ln=(0,Se.useCallback)(K=>{let ye=++E.current;$.current({kind:"dock",view:{kind:"eval",initial:{page:"suites"},navigationKey:ye,restoreFocusRef:sn(K)}})},[]),dn=()=>{S.current=null,w(null),requestAnimationFrame(()=>A.current?.())},Bt=()=>{let K=S.current;K&&(S.current=null,w(null),v(!1),At(K))},wt=()=>{j(!0)},Ze=async()=>{ne(!0);try{await o(e.id),j(!1)}finally{ne(!1)}},xt=K=>(L(K),i?.(e,K)),kn=i?async(K,ye)=>{await i(K,ye),L({...Xd(K.graphDefinition),...ye})}:void 0,Vt=K=>{let ye=typeof le=="object"&&le!==null?le:{},Xe={...ye};if(K.type==="tool"&&K.id.startsWith("tool:"))Xe.tools=(ye.tools??[]).filter(Je=>Je!==K.id.slice(5));else if(K.type==="subagent"&&K.id.startsWith("sub:"))Xe.subAgents=(ye.subAgents??[]).filter(Je=>Je!==K.id.slice(4));else if(K.type==="skill"&&K.id.startsWith("skill:")){let Je=K.id.slice(6);Xe.skills=(ye.skills??[]).filter(Ke=>Ke!==Je),Array.isArray(ye.middleware)&&(Xe.middleware=ye.middleware.map(Ke=>{if(Ke.type!=="skill")return Ke;let Pt=typeof Ke.config=="object"&&Ke.config!==null?Ke.config:{};return K.id===br?{...Ke,config:{...Pt,readAll:!1}}:!Array.isArray(Pt.skills)||!Pt.skills.includes(Je)?Ke:{...Ke,config:{...Pt,skills:Pt.skills.filter(nt=>nt!==Je)}}}))}else if(K.type==="capability"&&K.id.startsWith("cap:")){let Je=K.id.slice(4);Xe.middleware=(ye.middleware??[]).filter(Ke=>Ke.type!==Je)}else return;L(Xe),i?.(e,Xe).catch(()=>at.error(g("governance.detail.removeNodeSaveFailed")))};return(0,Y.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column",background:"#fff"},children:[(0,Y.jsx)("style",{"data-agent-detail-responsive":!0,children:Qd}),(0,Y.jsxs)("div",{style:{flex:1,minHeight:0,position:"relative"},children:[(0,Y.jsxs)("div",{"data-testid":"agent-header-pill",className:"agent-detail__identity-pill",style:{position:"absolute",top:12,left:12,zIndex:12,display:"flex",alignItems:"center",gap:8,height:32,padding:"0 10px 0 4px",background:"rgba(255,255,255,0.95)",borderRadius:10,boxShadow:"0 2px 12px rgba(0,0,0,0.08)",border:"1px solid #f0f0f0",maxWidth:"calc(100% - 176px)",minWidth:0},children:[(0,Y.jsx)(U,{type:"text",size:"small",icon:(0,Y.jsx)(ni,{}),onClick:()=>Ge({kind:"back"}),"aria-label":g("common.back")}),(0,Y.jsx)(tt,{size:15,color:qn(We.color)}),(0,Y.jsx)(Hs,{strong:!0,style:{fontSize:13,maxWidth:220,minWidth:0,flex:"1 1 auto",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),(0,Y.jsx)("span",{"data-testid":"agent-status-dot",title:mt,style:{width:8,height:8,borderRadius:"50%",background:qn(kt),flexShrink:0}}),(0,Y.jsx)(U,{type:"text",size:"small","aria-label":g("governance.detail.viewDescription"),icon:(0,Y.jsx)(go,{}),style:{color:"#6366f1"},onClick:()=>ie(!0)})]}),(0,Y.jsxs)("div",{"data-testid":"agent-actions-pill",className:"agent-detail__actions-pill",style:{position:"absolute",top:12,right:12,zIndex:12,display:"flex",alignItems:"center",gap:2,height:32,padding:"0 6px",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,Y.jsx)(Xt,{title:g("governance.detail.testInPlayground"),children:(0,Y.jsx)(U,{ref:x,type:"text",size:"small",icon:(0,Y.jsx)(xi,{size:14}),onClick:()=>Ge({kind:"dock",view:{kind:"playground"}}),"aria-label":g("governance.detail.testInPlayground"),"aria-pressed":u?.kind==="playground",style:u?.kind==="playground"?rr:void 0})}),(0,Y.jsx)(Xt,{title:g("governance.detail.evalSuite"),children:(0,Y.jsx)(U,{ref:M,type:"text",size:"small",icon:(0,Y.jsx)(fo,{size:14}),onClick:()=>ln(M.current??void 0),"aria-label":g("governance.detail.evalSuite"),"aria-pressed":u?.kind==="eval",style:u?.kind==="eval"?rr:void 0})}),(0,Y.jsx)(Xt,{title:g("governance.detail.webApps"),children:(0,Y.jsx)(U,{ref:de,type:"text",size:"small",icon:(0,Y.jsx)(bi,{size:14}),onClick:()=>Ge({kind:"dock",view:{kind:"web-apps"}}),"aria-label":g("governance.detail.webApps"),"aria-pressed":u?.kind==="web-apps",style:u?.kind==="web-apps"?rr:void 0})}),(0,Y.jsx)(Xt,{title:g("governance.detail.configuration"),children:(0,Y.jsx)(U,{ref:X,type:"text",size:"small",icon:(0,Y.jsx)(Ti,{size:14}),onClick:()=>Ge({kind:"dock",view:{kind:"configuration"}}),"aria-label":g("governance.detail.configuration"),"aria-pressed":u?.kind==="configuration",style:u?.kind==="configuration"?rr:void 0})}),(0,Y.jsx)(Xt,{title:g("governance.deleteAgent"),children:(0,Y.jsx)(U,{type:"text",size:"small",danger:!0,icon:(0,Y.jsx)(po,{}),loading:O,onClick:wt,"aria-label":g("governance.deleteAgent")})})]}),rt==="workflow"?(0,Y.jsx)(zs,{graphDefinition:le,assistantId:e.id,assistantName:e.name,workspaceId:Q,description:e.description,hideTitleBar:!0,hudTopOffset:56,initialMessageRequest:G,onInitialMessageSubmitted:he,projectId:B,onProjectChange:ee,onLearningStarted:ke,onToolActivity:Le,learningTasks:be,onLearningRefresh:Ce,evalTick:Ee,architectOpenSignal:C,architectRestoreFocusRef:pe,copilotTemporarilyHidden:u!==null}):(0,Y.jsx)(_s,{graphDefinition:le,assistantId:e.id,assistantName:e.name,workspaceId:Q,hudTopOffset:56,onSelectNode:K=>{K?Ge({kind:"dock",view:{kind:"node",node:K}}):u?.kind==="node"&&Ge({kind:"close"})},onRemoveNode:Vt,initialMessageRequest:G,onInitialMessageSubmitted:he,projectId:B,onProjectChange:ee,onLearningStarted:ke,onToolActivity:Le,learningTasks:be,onLearningRefresh:Ce,evalTick:Ee,architectOpenSignal:C,architectRestoreFocusRef:pe,copilotTemporarilyHidden:u!==null}),u?.kind==="node"&&(0,Y.jsx)(ct,{open:!0,width:Ws(u.node),title:Bs(u.node),onClose:()=>f(null),children:(0,Y.jsx)(js,{node:u.node,graphDefinition:le,assistantId:e.id,onRemoveNode:K=>{Vt(K),f(null)},onSaveGraph:xt})}),u?.kind==="playground"&&(0,Y.jsx)(ct,{open:!0,width:720,title:g("governance.detail.playground"),onClose:()=>Ge({kind:"close"}),restoreFocusRef:x,children:(0,Y.jsx)(Ki,{assistant_id:e.id})}),u?.kind==="eval"&&(0,Y.jsx)(ct,{open:!0,width:860,title:u.initial?.page==="run"?g("governance.detail.runResults"):g("governance.detail.evalSuite"),onClose:()=>Ge({kind:"close"}),restoreFocusRef:u.restoreFocusRef??M,children:(0,Y.jsx)(Lo,{assistantId:e.id,initial:u.initial,navigationKey:u.navigationKey})},u.navigationKey),u?.kind==="web-apps"&&(0,Y.jsx)(ct,{open:!0,width:960,title:g("governance.detail.webApps"),onClose:()=>Ge({kind:"close"}),restoreFocusRef:de,bodyStyle:{padding:0,overflow:"hidden"},children:(0,Y.jsx)(ra,{assistant:e})}),u?.kind==="configuration"&&(0,Y.jsx)(ct,{open:!0,width:"80%",mobileWidth:"calc(100% - 24px)",title:g("governance.detail.configuration"),onClose:()=>Ge({kind:"close"}),bodyStyle:{padding:0,overflow:"hidden"},restoreFocusRef:V,focusControlRef:A,escapeEnabled:!k&&!_&&!De&&m===null,children:(0,Y.jsx)(ta,{assistant:{...e,graphDefinition:le},allAssistants:t,visible:!0,onClose:()=>Ge({kind:"close"}),onSave:kn,onDirtyChange:v,onOverlayOpenChange:h,embedded:!0})})]}),(0,Y.jsx)(ze,{title:g("governance.detail.discardTitle"),open:m!==null,onCancel:dn,onOk:Bt,okText:g("governance.detail.discard"),okButtonProps:{danger:!0},cancelText:g("governance.detail.continueEditing"),children:(0,Y.jsx)("p",{children:g("governance.detail.discardBody")})}),(0,Y.jsxs)(ze,{title:e.name,open:_,onCancel:()=>ie(!1),footer:null,width:640,centered:!0,children:[(0,Y.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:12},children:[(0,Y.jsx)(He,{color:We.color,style:{margin:0},children:We.label}),Oe.map(K=>(0,Y.jsx)(He,{color:"magenta",style:{margin:0},children:K},K)),(0,Y.jsx)(He,{style:{margin:0},children:vr(e)}),(0,Y.jsx)(He,{color:kt,style:{margin:0},children:mt})]}),e.description?(0,Y.jsx)(Tn,{content:e.description}):(0,Y.jsx)(Hs,{type:"secondary",children:g("governance.detail.noDescription")})]}),(0,Y.jsx)(ze,{title:g("governance.deleteAgent"),open:De,onCancel:()=>j(!1),onOk:Ze,okText:g("common.delete"),okButtonProps:{danger:!0,loading:O},cancelText:g("common.cancel"),children:(0,Y.jsx)("p",{children:g("governance.detail.deleteConfirm",{name:e.name})})})]})};export{Pn as a,qn as b,Jd as c,ec as d,tc as e,wa as f,Zu as g,xa as h,Ta as i,Ia as j,iy as k};
@@ -1,2 +1,2 @@
1
- import{M as G,a as pe,b as ce,r as me,sb as he,ta as fe,tb as be,ua as q,wa as Ae,ya as ge}from"./embed-page-chunk-YYDZ6ZBV.js";import{B as ue,a as S,e as v,f as ne,g as oe,n as ae,r as L,s as ie,t as se,u as de,x as le}from"./embed-page-chunk-2PFKLMTR.js";import{a as M}from"./embed-page-chunk-QV7QAJ4N.js";import{i as Q,j as Ne,k as Oe,l as je,m as Fe}from"./embed-page-chunk-QULNM5O2.js";import{M as te,va as re}from"./embed-page-chunk-MHGVD4EV.js";import{a as ee}from"./embed-page-chunk-R5QL57JJ.js";import{c as T,f as R}from"./embed-page-chunk-QBTAJ2YI.js";var Ie=T(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.default=void 0;var it={items_per_page:"\u6761/\u9875",jump_to:"\u8DF3\u81F3",jump_to_confirm:"\u786E\u5B9A",page:"\u9875",prev_page:"\u4E0A\u4E00\u9875",next_page:"\u4E0B\u4E00\u9875",prev_5:"\u5411\u524D 5 \u9875",next_5:"\u5411\u540E 5 \u9875",prev_3:"\u5411\u524D 3 \u9875",next_3:"\u5411\u540E 3 \u9875",page_size:"\u9875\u7801"},Qt=O.default=it});var _e=T(j=>{"use strict";var st=Ne().default;Object.defineProperty(j,"__esModule",{value:!0});j.default=void 0;var Pe=st(Oe()),dt=je(),lt=(0,Pe.default)((0,Pe.default)({},dt.commonLocale),{},{locale:"zh_CN",today:"\u4ECA\u5929",now:"\u6B64\u523B",backToToday:"\u8FD4\u56DE\u4ECA\u5929",ok:"\u786E\u5B9A",timeSelect:"\u9009\u62E9\u65F6\u95F4",dateSelect:"\u9009\u62E9\u65E5\u671F",weekSelect:"\u9009\u62E9\u5468",clear:"\u6E05\u9664",week:"\u5468",month:"\u6708",year:"\u5E74",previousMonth:"\u4E0A\u4E2A\u6708 (\u7FFB\u9875\u4E0A\u952E)",nextMonth:"\u4E0B\u4E2A\u6708 (\u7FFB\u9875\u4E0B\u952E)",monthSelect:"\u9009\u62E9\u6708\u4EFD",yearSelect:"\u9009\u62E9\u5E74\u4EFD",decadeSelect:"\u9009\u62E9\u5E74\u4EE3",previousYear:"\u4E0A\u4E00\u5E74 (Control\u952E\u52A0\u5DE6\u65B9\u5411\u952E)",nextYear:"\u4E0B\u4E00\u5E74 (Control\u952E\u52A0\u53F3\u65B9\u5411\u952E)",previousDecade:"\u4E0A\u4E00\u5E74\u4EE3",nextDecade:"\u4E0B\u4E00\u5E74\u4EE3",previousCentury:"\u4E0A\u4E00\u4E16\u7EAA",nextCentury:"\u4E0B\u4E00\u4E16\u7EAA",yearFormat:"YYYY\u5E74",cellDateFormat:"D",monthBeforeYear:!1}),Yt=j.default=lt});var V=T(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.default=void 0;var pt={placeholder:"\u8BF7\u9009\u62E9\u65F6\u95F4",rangePlaceholder:["\u5F00\u59CB\u65F6\u95F4","\u7ED3\u675F\u65F6\u95F4"]},Zt=F.default=pt});var Y=T(H=>{"use strict";var We=Q().default;Object.defineProperty(H,"__esModule",{value:!0});H.default=void 0;var ct=We(_e()),ut=We(V()),Le={lang:Object.assign({placeholder:"\u8BF7\u9009\u62E9\u65E5\u671F",yearPlaceholder:"\u8BF7\u9009\u62E9\u5E74\u4EFD",quarterPlaceholder:"\u8BF7\u9009\u62E9\u5B63\u5EA6",monthPlaceholder:"\u8BF7\u9009\u62E9\u6708\u4EFD",weekPlaceholder:"\u8BF7\u9009\u62E9\u5468",rangePlaceholder:["\u5F00\u59CB\u65E5\u671F","\u7ED3\u675F\u65E5\u671F"],rangeYearPlaceholder:["\u5F00\u59CB\u5E74\u4EFD","\u7ED3\u675F\u5E74\u4EFD"],rangeMonthPlaceholder:["\u5F00\u59CB\u6708\u4EFD","\u7ED3\u675F\u6708\u4EFD"],rangeQuarterPlaceholder:["\u5F00\u59CB\u5B63\u5EA6","\u7ED3\u675F\u5B63\u5EA6"],rangeWeekPlaceholder:["\u5F00\u59CB\u5468","\u7ED3\u675F\u5468"]},ct.default),timePickerLocale:Object.assign({},ut.default)};Le.lang.ok="\u786E\u5B9A";var tr=H.default=Le});var xe=T(B=>{"use strict";var mt=Q().default;Object.defineProperty(B,"__esModule",{value:!0});B.default=void 0;var ft=mt(Y()),nr=B.default=ft.default});var ve=T(X=>{"use strict";var z=Q().default;Object.defineProperty(X,"__esModule",{value:!0});X.default=void 0;var At=z(Ie()),gt=z(xe()),ht=z(Y()),bt=z(V()),y="${label}\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684${type}",yt={locale:"zh-cn",Pagination:At.default,DatePicker:ht.default,TimePicker:bt.default,Calendar:gt.default,global:{placeholder:"\u8BF7\u9009\u62E9",close:"\u5173\u95ED"},Table:{filterTitle:"\u7B5B\u9009",filterConfirm:"\u786E\u5B9A",filterReset:"\u91CD\u7F6E",filterEmptyText:"\u65E0\u7B5B\u9009\u9879",filterCheckAll:"\u5168\u9009",filterSearchPlaceholder:"\u5728\u7B5B\u9009\u9879\u4E2D\u641C\u7D22",emptyText:"\u6682\u65E0\u6570\u636E",selectAll:"\u5168\u9009\u5F53\u9875",selectInvert:"\u53CD\u9009\u5F53\u9875",selectNone:"\u6E05\u7A7A\u6240\u6709",selectionAll:"\u5168\u9009\u6240\u6709",sortTitle:"\u6392\u5E8F",expand:"\u5C55\u5F00\u884C",collapse:"\u5173\u95ED\u884C",triggerDesc:"\u70B9\u51FB\u964D\u5E8F",triggerAsc:"\u70B9\u51FB\u5347\u5E8F",cancelSort:"\u53D6\u6D88\u6392\u5E8F"},Modal:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",justOkText:"\u77E5\u9053\u4E86"},Tour:{Next:"\u4E0B\u4E00\u6B65",Previous:"\u4E0A\u4E00\u6B65",Finish:"\u7ED3\u675F\u5BFC\u89C8"},Popconfirm:{cancelText:"\u53D6\u6D88",okText:"\u786E\u5B9A"},Transfer:{titles:["",""],searchPlaceholder:"\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",itemUnit:"\u9879",itemsUnit:"\u9879",remove:"\u5220\u9664",selectCurrent:"\u5168\u9009\u5F53\u9875",removeCurrent:"\u5220\u9664\u5F53\u9875",selectAll:"\u5168\u9009\u6240\u6709",deselectAll:"\u53D6\u6D88\u5168\u9009",removeAll:"\u5220\u9664\u5168\u90E8",selectInvert:"\u53CD\u9009\u5F53\u9875"},Upload:{uploading:"\u6587\u4EF6\u4E0A\u4F20\u4E2D",removeFile:"\u5220\u9664\u6587\u4EF6",uploadError:"\u4E0A\u4F20\u9519\u8BEF",previewFile:"\u9884\u89C8\u6587\u4EF6",downloadFile:"\u4E0B\u8F7D\u6587\u4EF6"},Empty:{description:"\u6682\u65E0\u6570\u636E"},Icon:{icon:"\u56FE\u6807"},Text:{edit:"\u7F16\u8F91",copy:"\u590D\u5236",copied:"\u590D\u5236\u6210\u529F",expand:"\u5C55\u5F00",collapse:"\u6536\u8D77"},Form:{optional:"\uFF08\u53EF\u9009\uFF09",defaultValidateMessages:{default:"\u5B57\u6BB5\u9A8C\u8BC1\u9519\u8BEF${label}",required:"\u8BF7\u8F93\u5165${label}",enum:"${label}\u5FC5\u987B\u662F\u5176\u4E2D\u4E00\u4E2A[${enum}]",whitespace:"${label}\u4E0D\u80FD\u4E3A\u7A7A\u5B57\u7B26",date:{format:"${label}\u65E5\u671F\u683C\u5F0F\u65E0\u6548",parse:"${label}\u4E0D\u80FD\u8F6C\u6362\u4E3A\u65E5\u671F",invalid:"${label}\u662F\u4E00\u4E2A\u65E0\u6548\u65E5\u671F"},types:{string:y,method:y,array:y,object:y,number:y,date:y,boolean:y,integer:y,float:y,regexp:y,email:y,url:y,hex:y},string:{len:"${label}\u987B\u4E3A${len}\u4E2A\u5B57\u7B26",min:"${label}\u6700\u5C11${min}\u4E2A\u5B57\u7B26",max:"${label}\u6700\u591A${max}\u4E2A\u5B57\u7B26",range:"${label}\u987B\u5728${min}-${max}\u5B57\u7B26\u4E4B\u95F4"},number:{len:"${label}\u5FC5\u987B\u7B49\u4E8E${len}",min:"${label}\u6700\u5C0F\u503C\u4E3A${min}",max:"${label}\u6700\u5927\u503C\u4E3A${max}",range:"${label}\u987B\u5728${min}-${max}\u4E4B\u95F4"},array:{len:"\u987B\u4E3A${len}\u4E2A${label}",min:"\u6700\u5C11${min}\u4E2A${label}",max:"\u6700\u591A${max}\u4E2A${label}",range:"${label}\u6570\u91CF\u987B\u5728${min}-${max}\u4E4B\u95F4"},pattern:{mismatch:"${label}\u4E0E\u6A21\u5F0F\u4E0D\u5339\u914D${pattern}"}}},Image:{preview:"\u9884\u89C8"},QRCode:{expired:"\u4E8C\u7EF4\u7801\u8FC7\u671F",refresh:"\u70B9\u51FB\u5237\u65B0",scanned:"\u5DF2\u626B\u63CF"},ColorPicker:{presetEmpty:"\u6682\u65E0",transparent:"\u65E0\u8272",singleColor:"\u5355\u8272",gradientColor:"\u6E10\u53D8\u8272"}},ar=X.default=yt});var qe=T((sr,Me)=>{"use strict";Me.exports=ve()});var u=R(ee());var g=class extends Error{code;retryable;status;constructor(r,t,n,a){super(t),this.name="AgentWebAppRuntimeClientError",this.code=r,this.retryable=n,this.status=a}};function k(){return new g("STREAM_FAILED","Stream failed",!0)}var He=new Set(["WEB_APP_NOT_FOUND","WEB_APP_DISABLED","USER_ID_REQUIRED","INVALID_USER_ID","PROJECT_NOT_ALLOWED","PROJECT_SELECTOR_DISABLED","MODEL_NOT_ALLOWED","FEATURE_DISABLED","THREAD_NOT_FOUND","STREAM_CONFLICT","STREAM_FAILED","INVALID_REQUEST","INTERNAL_ERROR"]);function I(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function w(e,r){return Object.keys(e).length===r.length&&r.every(n=>n in e)}function Be(e){return I(e)&&w(e,["code","message","retryable"])&&typeof e.code=="string"&&He.has(e.code)&&typeof e.message=="string"&&typeof e.retryable=="boolean"}function ze(e){if(!I(e))return!1;let r=e.data===void 0?["id","type","prompt"]:["id","type","prompt","data"];return w(e,r)&&typeof e.id=="string"&&typeof e.type=="string"&&typeof e.prompt=="string"&&(e.data===void 0||I(e.data))}var Xe=new Set([S.HUMAN,S.AI,S.TOOL,S.INTERRUPT,S.MESSAGE_COMPLETED,S.MESSAGE_FAILED,S.THREAD_IDLE]);function Ke(e,r){let t;try{t=JSON.parse(e)}catch{throw k()}if(!I(t)||typeof t.type!="string")throw k();if(Xe.has(t.type)||t.type==="error"&&I(t.data)&&!I(t.error)){let n=oe(t,r);return n.length===0?[]:n}switch(t.type){case"message.delta":if(w(t,["type","text"])&&typeof t.text=="string")return[t];break;case"message.completed":if(w(t,["type","messageId"])&&typeof t.messageId=="string")return[t];break;case"tool.started":if(w(t,["type","id","name"])&&typeof t.id=="string"&&typeof t.name=="string")return[t];break;case"tool.completed":if(w(t,["type","id"])&&typeof t.id=="string")return[t];break;case"interrupt.created":if(w(t,["type","interrupt"])&&ze(t.interrupt))return[t];break;case"genui.render":if(w(t,["type","block"])&&v(t.block))return[t];break;case"error":if(w(t,["type","error"])&&Be(t.error))return[t];break;case"stream.completed":if(w(t,["type"]))return[t];break}throw k()}function Ge(e){return e instanceof Error&&e.name==="AbortError"}async function ye(e,r){let t=ne({allowGenUI:!0,allowInterrupts:!0}),n=e.getReader(),a=new TextDecoder,o="",i=!1,d=!1;try{for(;!i;){let l;try{l=await n.read()}catch(p){if(Ge(p))return;throw k()}l.done&&(d=!0);try{o+=a.decode(l.value,{stream:!l.done})}catch{throw k()}let C=o.split(/\r?\n\r?\n/);o=l.done?"":C.pop()??"";for(let p of C){let A=p.split(/\r?\n/).filter(m=>m==="data"||m.startsWith("data:")).map(m=>m==="data"?"":m.slice(5).replace(/^ /,""));if(A.length!==0){for(let m of Ke(A.join(`
1
+ import{M as G,a as pe,b as ce,r as me,sb as he,ta as fe,tb as be,ua as q,wa as Ae,ya as ge}from"./embed-page-chunk-P477ZTUO.js";import{B as ue,a as S,e as v,f as ne,g as oe,n as ae,r as L,s as ie,t as se,u as de,x as le}from"./embed-page-chunk-2PFKLMTR.js";import{a as M}from"./embed-page-chunk-QV7QAJ4N.js";import{i as Q,j as Ne,k as Oe,l as je,m as Fe}from"./embed-page-chunk-QULNM5O2.js";import{M as te,va as re}from"./embed-page-chunk-MHGVD4EV.js";import{a as ee}from"./embed-page-chunk-R5QL57JJ.js";import{c as T,f as R}from"./embed-page-chunk-QBTAJ2YI.js";var Ie=T(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.default=void 0;var it={items_per_page:"\u6761/\u9875",jump_to:"\u8DF3\u81F3",jump_to_confirm:"\u786E\u5B9A",page:"\u9875",prev_page:"\u4E0A\u4E00\u9875",next_page:"\u4E0B\u4E00\u9875",prev_5:"\u5411\u524D 5 \u9875",next_5:"\u5411\u540E 5 \u9875",prev_3:"\u5411\u524D 3 \u9875",next_3:"\u5411\u540E 3 \u9875",page_size:"\u9875\u7801"},Qt=O.default=it});var _e=T(j=>{"use strict";var st=Ne().default;Object.defineProperty(j,"__esModule",{value:!0});j.default=void 0;var Pe=st(Oe()),dt=je(),lt=(0,Pe.default)((0,Pe.default)({},dt.commonLocale),{},{locale:"zh_CN",today:"\u4ECA\u5929",now:"\u6B64\u523B",backToToday:"\u8FD4\u56DE\u4ECA\u5929",ok:"\u786E\u5B9A",timeSelect:"\u9009\u62E9\u65F6\u95F4",dateSelect:"\u9009\u62E9\u65E5\u671F",weekSelect:"\u9009\u62E9\u5468",clear:"\u6E05\u9664",week:"\u5468",month:"\u6708",year:"\u5E74",previousMonth:"\u4E0A\u4E2A\u6708 (\u7FFB\u9875\u4E0A\u952E)",nextMonth:"\u4E0B\u4E2A\u6708 (\u7FFB\u9875\u4E0B\u952E)",monthSelect:"\u9009\u62E9\u6708\u4EFD",yearSelect:"\u9009\u62E9\u5E74\u4EFD",decadeSelect:"\u9009\u62E9\u5E74\u4EE3",previousYear:"\u4E0A\u4E00\u5E74 (Control\u952E\u52A0\u5DE6\u65B9\u5411\u952E)",nextYear:"\u4E0B\u4E00\u5E74 (Control\u952E\u52A0\u53F3\u65B9\u5411\u952E)",previousDecade:"\u4E0A\u4E00\u5E74\u4EE3",nextDecade:"\u4E0B\u4E00\u5E74\u4EE3",previousCentury:"\u4E0A\u4E00\u4E16\u7EAA",nextCentury:"\u4E0B\u4E00\u4E16\u7EAA",yearFormat:"YYYY\u5E74",cellDateFormat:"D",monthBeforeYear:!1}),Yt=j.default=lt});var V=T(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.default=void 0;var pt={placeholder:"\u8BF7\u9009\u62E9\u65F6\u95F4",rangePlaceholder:["\u5F00\u59CB\u65F6\u95F4","\u7ED3\u675F\u65F6\u95F4"]},Zt=F.default=pt});var Y=T(H=>{"use strict";var We=Q().default;Object.defineProperty(H,"__esModule",{value:!0});H.default=void 0;var ct=We(_e()),ut=We(V()),Le={lang:Object.assign({placeholder:"\u8BF7\u9009\u62E9\u65E5\u671F",yearPlaceholder:"\u8BF7\u9009\u62E9\u5E74\u4EFD",quarterPlaceholder:"\u8BF7\u9009\u62E9\u5B63\u5EA6",monthPlaceholder:"\u8BF7\u9009\u62E9\u6708\u4EFD",weekPlaceholder:"\u8BF7\u9009\u62E9\u5468",rangePlaceholder:["\u5F00\u59CB\u65E5\u671F","\u7ED3\u675F\u65E5\u671F"],rangeYearPlaceholder:["\u5F00\u59CB\u5E74\u4EFD","\u7ED3\u675F\u5E74\u4EFD"],rangeMonthPlaceholder:["\u5F00\u59CB\u6708\u4EFD","\u7ED3\u675F\u6708\u4EFD"],rangeQuarterPlaceholder:["\u5F00\u59CB\u5B63\u5EA6","\u7ED3\u675F\u5B63\u5EA6"],rangeWeekPlaceholder:["\u5F00\u59CB\u5468","\u7ED3\u675F\u5468"]},ct.default),timePickerLocale:Object.assign({},ut.default)};Le.lang.ok="\u786E\u5B9A";var tr=H.default=Le});var xe=T(B=>{"use strict";var mt=Q().default;Object.defineProperty(B,"__esModule",{value:!0});B.default=void 0;var ft=mt(Y()),nr=B.default=ft.default});var ve=T(X=>{"use strict";var z=Q().default;Object.defineProperty(X,"__esModule",{value:!0});X.default=void 0;var At=z(Ie()),gt=z(xe()),ht=z(Y()),bt=z(V()),y="${label}\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684${type}",yt={locale:"zh-cn",Pagination:At.default,DatePicker:ht.default,TimePicker:bt.default,Calendar:gt.default,global:{placeholder:"\u8BF7\u9009\u62E9",close:"\u5173\u95ED"},Table:{filterTitle:"\u7B5B\u9009",filterConfirm:"\u786E\u5B9A",filterReset:"\u91CD\u7F6E",filterEmptyText:"\u65E0\u7B5B\u9009\u9879",filterCheckAll:"\u5168\u9009",filterSearchPlaceholder:"\u5728\u7B5B\u9009\u9879\u4E2D\u641C\u7D22",emptyText:"\u6682\u65E0\u6570\u636E",selectAll:"\u5168\u9009\u5F53\u9875",selectInvert:"\u53CD\u9009\u5F53\u9875",selectNone:"\u6E05\u7A7A\u6240\u6709",selectionAll:"\u5168\u9009\u6240\u6709",sortTitle:"\u6392\u5E8F",expand:"\u5C55\u5F00\u884C",collapse:"\u5173\u95ED\u884C",triggerDesc:"\u70B9\u51FB\u964D\u5E8F",triggerAsc:"\u70B9\u51FB\u5347\u5E8F",cancelSort:"\u53D6\u6D88\u6392\u5E8F"},Modal:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",justOkText:"\u77E5\u9053\u4E86"},Tour:{Next:"\u4E0B\u4E00\u6B65",Previous:"\u4E0A\u4E00\u6B65",Finish:"\u7ED3\u675F\u5BFC\u89C8"},Popconfirm:{cancelText:"\u53D6\u6D88",okText:"\u786E\u5B9A"},Transfer:{titles:["",""],searchPlaceholder:"\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",itemUnit:"\u9879",itemsUnit:"\u9879",remove:"\u5220\u9664",selectCurrent:"\u5168\u9009\u5F53\u9875",removeCurrent:"\u5220\u9664\u5F53\u9875",selectAll:"\u5168\u9009\u6240\u6709",deselectAll:"\u53D6\u6D88\u5168\u9009",removeAll:"\u5220\u9664\u5168\u90E8",selectInvert:"\u53CD\u9009\u5F53\u9875"},Upload:{uploading:"\u6587\u4EF6\u4E0A\u4F20\u4E2D",removeFile:"\u5220\u9664\u6587\u4EF6",uploadError:"\u4E0A\u4F20\u9519\u8BEF",previewFile:"\u9884\u89C8\u6587\u4EF6",downloadFile:"\u4E0B\u8F7D\u6587\u4EF6"},Empty:{description:"\u6682\u65E0\u6570\u636E"},Icon:{icon:"\u56FE\u6807"},Text:{edit:"\u7F16\u8F91",copy:"\u590D\u5236",copied:"\u590D\u5236\u6210\u529F",expand:"\u5C55\u5F00",collapse:"\u6536\u8D77"},Form:{optional:"\uFF08\u53EF\u9009\uFF09",defaultValidateMessages:{default:"\u5B57\u6BB5\u9A8C\u8BC1\u9519\u8BEF${label}",required:"\u8BF7\u8F93\u5165${label}",enum:"${label}\u5FC5\u987B\u662F\u5176\u4E2D\u4E00\u4E2A[${enum}]",whitespace:"${label}\u4E0D\u80FD\u4E3A\u7A7A\u5B57\u7B26",date:{format:"${label}\u65E5\u671F\u683C\u5F0F\u65E0\u6548",parse:"${label}\u4E0D\u80FD\u8F6C\u6362\u4E3A\u65E5\u671F",invalid:"${label}\u662F\u4E00\u4E2A\u65E0\u6548\u65E5\u671F"},types:{string:y,method:y,array:y,object:y,number:y,date:y,boolean:y,integer:y,float:y,regexp:y,email:y,url:y,hex:y},string:{len:"${label}\u987B\u4E3A${len}\u4E2A\u5B57\u7B26",min:"${label}\u6700\u5C11${min}\u4E2A\u5B57\u7B26",max:"${label}\u6700\u591A${max}\u4E2A\u5B57\u7B26",range:"${label}\u987B\u5728${min}-${max}\u5B57\u7B26\u4E4B\u95F4"},number:{len:"${label}\u5FC5\u987B\u7B49\u4E8E${len}",min:"${label}\u6700\u5C0F\u503C\u4E3A${min}",max:"${label}\u6700\u5927\u503C\u4E3A${max}",range:"${label}\u987B\u5728${min}-${max}\u4E4B\u95F4"},array:{len:"\u987B\u4E3A${len}\u4E2A${label}",min:"\u6700\u5C11${min}\u4E2A${label}",max:"\u6700\u591A${max}\u4E2A${label}",range:"${label}\u6570\u91CF\u987B\u5728${min}-${max}\u4E4B\u95F4"},pattern:{mismatch:"${label}\u4E0E\u6A21\u5F0F\u4E0D\u5339\u914D${pattern}"}}},Image:{preview:"\u9884\u89C8"},QRCode:{expired:"\u4E8C\u7EF4\u7801\u8FC7\u671F",refresh:"\u70B9\u51FB\u5237\u65B0",scanned:"\u5DF2\u626B\u63CF"},ColorPicker:{presetEmpty:"\u6682\u65E0",transparent:"\u65E0\u8272",singleColor:"\u5355\u8272",gradientColor:"\u6E10\u53D8\u8272"}},ar=X.default=yt});var qe=T((sr,Me)=>{"use strict";Me.exports=ve()});var u=R(ee());var g=class extends Error{code;retryable;status;constructor(r,t,n,a){super(t),this.name="AgentWebAppRuntimeClientError",this.code=r,this.retryable=n,this.status=a}};function k(){return new g("STREAM_FAILED","Stream failed",!0)}var He=new Set(["WEB_APP_NOT_FOUND","WEB_APP_DISABLED","USER_ID_REQUIRED","INVALID_USER_ID","PROJECT_NOT_ALLOWED","PROJECT_SELECTOR_DISABLED","MODEL_NOT_ALLOWED","FEATURE_DISABLED","THREAD_NOT_FOUND","STREAM_CONFLICT","STREAM_FAILED","INVALID_REQUEST","INTERNAL_ERROR"]);function I(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function w(e,r){return Object.keys(e).length===r.length&&r.every(n=>n in e)}function Be(e){return I(e)&&w(e,["code","message","retryable"])&&typeof e.code=="string"&&He.has(e.code)&&typeof e.message=="string"&&typeof e.retryable=="boolean"}function ze(e){if(!I(e))return!1;let r=e.data===void 0?["id","type","prompt"]:["id","type","prompt","data"];return w(e,r)&&typeof e.id=="string"&&typeof e.type=="string"&&typeof e.prompt=="string"&&(e.data===void 0||I(e.data))}var Xe=new Set([S.HUMAN,S.AI,S.TOOL,S.INTERRUPT,S.MESSAGE_COMPLETED,S.MESSAGE_FAILED,S.THREAD_IDLE]);function Ke(e,r){let t;try{t=JSON.parse(e)}catch{throw k()}if(!I(t)||typeof t.type!="string")throw k();if(Xe.has(t.type)||t.type==="error"&&I(t.data)&&!I(t.error)){let n=oe(t,r);return n.length===0?[]:n}switch(t.type){case"message.delta":if(w(t,["type","text"])&&typeof t.text=="string")return[t];break;case"message.completed":if(w(t,["type","messageId"])&&typeof t.messageId=="string")return[t];break;case"tool.started":if(w(t,["type","id","name"])&&typeof t.id=="string"&&typeof t.name=="string")return[t];break;case"tool.completed":if(w(t,["type","id"])&&typeof t.id=="string")return[t];break;case"interrupt.created":if(w(t,["type","interrupt"])&&ze(t.interrupt))return[t];break;case"genui.render":if(w(t,["type","block"])&&v(t.block))return[t];break;case"error":if(w(t,["type","error"])&&Be(t.error))return[t];break;case"stream.completed":if(w(t,["type"]))return[t];break}throw k()}function Ge(e){return e instanceof Error&&e.name==="AbortError"}async function ye(e,r){let t=ne({allowGenUI:!0,allowInterrupts:!0}),n=e.getReader(),a=new TextDecoder,o="",i=!1,d=!1;try{for(;!i;){let l;try{l=await n.read()}catch(p){if(Ge(p))return;throw k()}l.done&&(d=!0);try{o+=a.decode(l.value,{stream:!l.done})}catch{throw k()}let C=o.split(/\r?\n\r?\n/);o=l.done?"":C.pop()??"";for(let p of C){let A=p.split(/\r?\n/).filter(m=>m==="data"||m.startsWith("data:")).map(m=>m==="data"?"":m.slice(5).replace(/^ /,""));if(A.length!==0){for(let m of Ke(A.join(`
2
2
  `),t))if(await r(m),i=m.type==="stream.completed",i)break;if(i)break}}if(l.done)break}if(!i)throw k()}finally{if(!d)try{await n.cancel()}catch{}n.releaseLock()}}var Qe=new Set(["WEB_APP_NOT_FOUND","WEB_APP_DISABLED","USER_ID_REQUIRED","INVALID_USER_ID","PROJECT_NOT_ALLOWED","PROJECT_SELECTOR_DISABLED","MODEL_NOT_ALLOWED","FEATURE_DISABLED","THREAD_NOT_FOUND","STREAM_CONFLICT","STREAM_FAILED","INVALID_REQUEST","INTERNAL_ERROR"]);function f(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function h(e,r,t=[]){let n=Object.keys(e);return r.every(a=>a in e)&&n.every(a=>r.includes(a)||t.includes(a))}function s(e){return typeof e=="string"}function D(e){if(!f(e)||!h(e,["id","projectId","createdAt","updatedAt"],["label"])||!s(e.id)||!s(e.projectId)||e.label!==void 0&&!s(e.label)||!s(e.createdAt)||!s(e.updatedAt))return;let r=new Date(e.createdAt),t=new Date(e.updatedAt);if(!(Number.isNaN(r.getTime())||Number.isNaN(t.getTime())))return{id:e.id,projectId:e.projectId,...e.label===void 0?{}:{label:e.label},createdAt:r,updatedAt:t}}function Ce(e){if(!f(e)||e.success!==!1||!f(e.error))return!1;let r=e.error;return h(e,["success","error"])&&h(r,["code","message","retryable"])&&typeof r.code=="string"&&Qe.has(r.code)&&typeof r.message=="string"&&typeof r.retryable=="boolean"}function Ve(e){if(!f(e))return!1;let r=["projectSelector","modelSelector","threadManagement","attachments","hitl","genUI"];return h(e,r,["files"])&&r.every(t=>typeof e[t]=="boolean")&&(e.files===void 0||typeof e.files=="boolean")}function Ye(e){return Array.isArray(e)&&e.length<=6&&e.every(r=>f(r)&&h(r,["label","text"])&&s(r.label)&&r.label.length>=1&&r.label.length<=40&&s(r.text)&&r.text.length>=1&&r.text.length<=500)}function Je(e){return f(e)&&h(e,[],["title","welcomeMessage","primaryColor","quickPrompts"])&&(e.title===void 0||s(e.title))&&(e.welcomeMessage===void 0||s(e.welcomeMessage))&&(e.primaryColor===void 0||s(e.primaryColor))&&(e.quickPrompts===void 0||Ye(e.quickPrompts))}function Ze(e){if(!f(e)||!h(e,["webApp","projects","models"],["thread"])||!f(e.webApp))return;let r=e.webApp;if(!h(r,["id","name","assistant","defaultProjectId","features","appearance","identityAssurance"],["description","defaultModelKey"])||!s(r.id)||!s(r.name)||!s(r.defaultProjectId)||r.description!==void 0&&!s(r.description)||r.defaultModelKey!==void 0&&!s(r.defaultModelKey)||r.identityAssurance!=="unverified"||!f(r.assistant)||!h(r.assistant,["id","name"],["description"])||!s(r.assistant.id)||!s(r.assistant.name)||r.assistant.description!==void 0&&!s(r.assistant.description)||!Ve(r.features)||!Je(r.appearance)||!Array.isArray(e.projects)||!e.projects.every(n=>f(n)&&h(n,["id","name"])&&s(n.id)&&s(n.name))||!Array.isArray(e.models)||!e.models.every(n=>f(n)&&h(n,["key","label"])&&s(n.key)&&s(n.label)))return;let t=e.thread===void 0?void 0:D(e.thread);if(!(e.thread!==void 0&&!t))return{...e,...t?{thread:t}:{}}}function et(e){if(!f(e)||!h(e,["records","total"])||!Array.isArray(e.records)||typeof e.total!="number")return;let r=e.records.map(D);return r.every(t=>t!==void 0)?{records:r,total:e.total}:void 0}function tt(e){return f(e)&&s(e.id)&&(e.role==="human"||e.role==="ai")&&(e.content===void 0||s(e.content)||Array.isArray(e.content)&&e.content.every(r=>v(r)!==void 0))}function rt(e){return f(e)&&h(e,["messages"])&&Array.isArray(e.messages)&&e.messages.every(tt)?e:void 0}function nt(e){return f(e)&&h(e,["ref","name","mimeType","size"])&&s(e.ref)&&s(e.name)&&s(e.mimeType)&&typeof e.size=="number"?e:void 0}function we(e,r){return t=>f(t)&&h(t,e)&&r(t)?t:void 0}var U=class{constructor(r){this.options=r;this.baseUrl=`${r.gatewayUrl.replace(/\/+$/,"")}/api/web-apps/${encodeURIComponent(r.webAppId)}/runtime`,this.fetchImplementation=r.fetch??globalThis.fetch.bind(globalThis),this.translate=r.translate}baseUrl;fetchImplementation;translate;async bootstrap(r={},t){return this.request("bootstrap",Ze,{query:r,signal:t})}async listThreads(r={},t){return this.request("threads",et,{query:r,signal:t})}async createThread(r={},t){return this.request("threads",D,{method:"POST",body:r,signal:t})}async updateThread(r,t,n){return this.request(`threads/${encodeURIComponent(r)}`,D,{method:"PATCH",body:t,signal:n})}async deleteThread(r,t={},n){await this.request(`threads/${encodeURIComponent(r)}`,we(["id"],a=>s(a.id)),{method:"DELETE",query:t,signal:n})}async getMessages(r,t={},n){return this.request(`threads/${encodeURIComponent(r)}/messages`,rt,{query:t,signal:n})}async streamMessage(r,t,n,a){return this.streamRequest(`threads/${encodeURIComponent(r)}/messages/stream`,t,n,a)}async resumeInterrupt(r,t,n,a,o){return this.streamRequest(`threads/${encodeURIComponent(r)}/interrupts/${encodeURIComponent(t)}/resume`,n,a,o)}async streamRequest(r,t,n,a){let o;try{o=await this.fetchRequest(r,{method:"POST",body:t,signal:a})}catch(i){throw Ee(i)||i instanceof g?i:new g("STREAM_FAILED",this.translate?.("integration.error.streamFailed")??"Stream failed",!0)}if(o.ok||await this.throwResponseError(o),!o.body||!o.headers.get("content-type")?.toLowerCase().includes("text/event-stream")){if(o.body)try{await o.body.cancel()}catch{}throw new g("STREAM_FAILED",this.translate?.("integration.error.streamFailed")??"Stream failed",!0,o.status)}await ye(o.body,n)}async abort(r,t={},n){await this.request(`threads/${encodeURIComponent(r)}/abort`,we(["aborted"],a=>typeof a.aborted=="boolean"),{method:"POST",query:t,signal:n})}async uploadAttachment(r,t,n={},a){let o=new FormData,i=typeof File<"u"&&t instanceof File?t.name:"attachment";return o.append("file",t,i),this.request(`threads/${encodeURIComponent(r)}/attachments`,nt,{method:"POST",query:n,body:o,signal:a})}async request(r,t,n={}){let a;try{a=await this.fetchRequest(r,n)}catch(d){throw Ee(d)||d instanceof g?d:new g("INTERNAL_ERROR",this.translate?.("integration.error.requestFailed")??"Request failed",!0)}let o;try{o=await a.json()}catch{throw this.internalError(a.status)}if(Ce(o))throw new g(o.error.code,o.error.message,o.error.retryable,a.status);if(!a.ok||!f(o)||!h(o,["success","data"])||o.success!==!0)throw this.internalError(a.status);let i=t(o.data);if(i===void 0)throw this.internalError(a.status);return i}async fetchRequest(r,t){let n=await this.options.identityProvider.getIdentity(t.signal),a=new URL(`${this.baseUrl}/${r}`);for(let[d,l]of Object.entries(t.query??{}))l!==void 0&&a.searchParams.set(d,l);let o=new Headers;n.bearerToken!==void 0?o.set("Authorization",`Bearer ${n.bearerToken}`):o.set("X-Axiom-External-User-Id",n.externalUserId??"");let i;return t.body instanceof FormData?i=t.body:t.body!==void 0&&(o.set("Content-Type","application/json"),i=JSON.stringify(t.body)),this.fetchImplementation(a,{method:t.method??"GET",headers:o,body:i,signal:t.signal,credentials:"omit"})}async throwResponseError(r){let t;try{t=await r.json()}catch{throw this.internalError(r.status)}throw Ce(t)?new g(t.error.code,t.error.message,t.error.retryable,r.status):this.internalError(r.status)}internalError(r){return new g("INTERNAL_ERROR",this.translate?.("integration.error.invalidServerResponse")??"Invalid server response",!1,r)}};function Ee(e){return typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError"}var $=R(ee());var P=R(M());function Re(){let e=L(),{createThread:r}=q(),{menuCollapsed:t,setMenuCollapsed:n}=Ae();(0,$.useEffect)(()=>{t===void 0&&n(!0)},[t,n]);let a=(0,$.useCallback)(async()=>{try{await r(e("integration.sidebar.newThread"))}catch(p){console.error("Failed to create new thread:",p)}},[r,e]),o=t??!0,i={id:"new-analysis",builtin:"new-analysis",type:"action",name:e("integration.sidebar.newThread"),icon:(0,P.jsx)(me,{size:20}),order:0},d={id:"thread-history-toggle",type:"action",name:e("integration.sidebar.history"),icon:(0,P.jsx)(G,{size:20}),order:1},l={id:"thread-history",builtin:"thread-history",type:"drawer",name:e("integration.sidebar.history"),icon:(0,P.jsx)(G,{size:20}),order:1,title:e("integration.sidebar.historyTitle"),width:320,inline:!0,inlineDefaultExpanded:!0,content:(0,P.jsx)(he,{})},C=[i,...o?[d]:[l]];return(0,P.jsx)(ge,{items:C,showBranding:!1,showToggle:!0,showNewAnalysis:!1,defaultExpanded:!o,collapsed:o,onCollapsedChange:n,onNewAnalysis:a,onItemClick:p=>{p.type==="action"&&p.builtin==="new-analysis"?a():p.type==="action"&&p.id==="thread-history-toggle"&&n(!1)}},o?"agent-chat-sidebar-collapsed":"agent-chat-sidebar-expanded")}function Se(e){if(typeof window>"u"||typeof XMLHttpRequest>"u")return()=>{};let r=`${e.gatewayUrl.replace(/\/+$/,"")}/api/web-apps/${encodeURIComponent(e.webAppId)}/runtime/`,t=XMLHttpRequest.prototype.open,n=XMLHttpRequest.prototype.send,a=new WeakMap;return XMLHttpRequest.prototype.open=function(i,d){a.set(this,String(d)),t.call(this,i,d,!0)},XMLHttpRequest.prototype.send=function(i){let d=a.get(this)??"";if(!d.startsWith(r)||!/\/sandbox\/uploadfile$/.test(d)){n.call(this,i);return}if(e.identity.mode==="unverified"){this.setRequestHeader("X-Axiom-External-User-Id",e.identity.userId),n.call(this,i);return}e.identity.tokenProvider().then(l=>{this.setRequestHeader("Authorization",`Bearer ${l}`),n.call(this,i)}).catch(()=>{n.call(this,i)})},()=>{XMLHttpRequest.prototype.open=t,XMLHttpRequest.prototype.send=n}}var ot=/^#[0-9A-Fa-f]{6}$/;function at(e){return typeof e=="string"&&ot.test(e)}function Te(e){return at(e)?e:void 0}function N(e,r){let t=parseInt(e.replace("#",""),16),n=Math.round(2.55*r),a=(t>>16)+n,o=(t>>8&255)+n,i=(t&255)+n;return"#"+(16777216+(a<255?a<1?0:a:255)*65536+(o<255?o<1?0:o:255)*256+(i<255?i<1?0:i:255)).toString(16).slice(1)}function ke(e){if(e!==void 0)return{token:{colorPrimary:e,colorPrimaryHover:N(e,20),colorPrimaryActive:N(e,-15),colorPrimaryBg:N(e,45)+"20"}}}var De=R(Fe()),Ue=R(qe()),c=R(M()),Ct={"en-US":De.default,"zh-CN":Ue.default};function wt(e,r){let t=J(e.welcome),n=J(r.title),a=t??J(r.welcomeMessage),o=e.quickPrompts??r.quickPrompts??[],i=Te(r.primaryColor);return{...n!==void 0?{title:n}:{},...a!==void 0?{welcome:a}:{},quickPrompts:o,...i!==void 0?{primaryColor:i}:{}}}function J(e){return typeof e=="string"&&e.length>0?e:void 0}function Et(e){if(!e.gatewayUrl.trim())throw new Error("AgentChatApp requires gatewayUrl");try{new URL(e.gatewayUrl)}catch{throw new Error("AgentChatApp gatewayUrl must be a valid URL")}if(!e.webAppId.trim())throw new Error("AgentChatApp requires webAppId");if(e.identity.mode==="unverified"){if(!e.identity.userId.trim())throw new Error("AgentChatApp requires identity.userId")}else if(typeof e.identity.tokenProvider!="function")throw new Error("AgentChatApp requires identity.tokenProvider");if(!e.fetch&&typeof globalThis.fetch!="function")throw new Error("AgentChatApp requires a fetch implementation")}function Rt(e,r){return e instanceof g?e:new g("INTERNAL_ERROR",r("integration.error.requestFailed"),!0)}function St(e){return e.mode==="unverified"?`unverified:${e.userId}`:"verified:token"}function Tr(e){Et(e);let r=`${e.gatewayUrl}\0${e.webAppId}\0${St(e.identity)}`,t=e.storageKey??ie,n=(0,u.useMemo)(()=>e.locale??se(t)??"en-US",[e.locale,t]);return(0,c.jsx)(de,{locale:n,storageKey:t,onLocaleChange:e.onLocaleChange,children:(0,c.jsx)(Tt,{...e,locale:n},r)})}function Tt({gatewayUrl:e,webAppId:r,identity:t,onError:n,onChatReady:a,onChatMessage:o,fetch:i,className:d,welcome:l,quickPrompts:C,locale:p="en-US"}){let A=L(),[m,E]=(0,u.useState)({status:"loading"}),x=(0,u.useRef)(t);x.current=t;let _=(0,u.useRef)(n);_.current=n;let W=(0,u.useRef)();return W.current||(W.current=new U({gatewayUrl:e,webAppId:r,identityProvider:{getIdentity:async()=>{let b=x.current;if(b.mode!=="verified")return{externalUserId:b.userId};try{return{bearerToken:await b.tokenProvider()}}catch{throw new g("USER_ID_REQUIRED",A("integration.error.identityTokenFailed"),!0)}}},translate:A,...i?{fetch:i}:{}})),(0,u.useEffect)(()=>Se({gatewayUrl:e,webAppId:r,identity:t}),[e,r,t]),(0,u.useEffect)(()=>{let b=!1,$e=W.current;return(async()=>{try{let K=await $e.bootstrap({});if(b)return;E({status:"ready",bootstrap:K})}catch(K){if(b)return;let Z=Rt(K,A);E({status:"error",error:Z}),_.current?.(Z)}})(),()=>{b=!0}},[]),m.status==="loading"?(0,c.jsx)("div",{className:d}):m.status==="error"?(0,c.jsxs)("div",{className:d,role:"alert",children:[(0,c.jsx)("strong",{children:A("integration.chat.loadFailed")}),(0,c.jsx)("div",{children:m.error.code}),(0,c.jsx)("button",{type:"button",onClick:()=>E({status:"loading"}),children:A("common.retry")})]}):(0,c.jsx)(It,{className:d,gatewayUrl:e,webAppId:r,identity:t,bootstrap:m.bootstrap,onChatReady:a,onChatMessage:o,welcome:l,quickPrompts:C,locale:p})}function kt(e){return{id:e.id,name:e.name,...e.description!==void 0?{description:e.description}:{},graphDefinition:void 0,createdAt:new Date(0),updatedAt:new Date(0)}}function It({gatewayUrl:e,webAppId:r,identity:t,bootstrap:n,onChatReady:a,onChatMessage:o,className:i,welcome:d,quickPrompts:l,locale:C="en-US"}){let p=(0,u.useMemo)(()=>kt(n.webApp.assistant),[n.webApp.assistant]),A=(0,u.useMemo)(()=>wt({welcome:d,quickPrompts:l},n.webApp.appearance),[d,l,n.webApp.appearance]),m=(0,u.useMemo)(()=>ke(A.primaryColor),[A.primaryColor]),E=(0,u.useMemo)(()=>t.mode==="unverified"?{mode:"unverified",userId:t.userId}:{mode:"verified",tokenProvider:t.tokenProvider},[t]),x=(0,u.useCallback)(b=>new ae({gatewayUrl:e,webAppId:r,identity:E,assistantId:b.assistantId,transport:b.transport,...b.timeout!==void 0?{timeout:b.timeout}:{},...b.headers!==void 0?{headers:b.headers}:{}}),[e,r,E]),_=(0,u.useMemo)(()=>({baseURL:`${e.replace(/\/$/,"")}/api/web-apps/${r}/runtime`,apiKey:"",transport:"sse",assistantId:p.id,enableSkillSlot:!1,enableDatabaseSlot:!1,enableAgentSlot:!1,enableMetricsDataSourceSlot:!1,enableModelSelector:!1,enableWorkspace:!1,enableCustomMenu:!1,showSideMenu:!1,enableAssistantCreation:!1,enableAssistantEditing:!1,enableThreadCreation:!0,enableThreadList:!0}),[p.id,e,r]),W=(0,u.useMemo)(()=>({assistants:[p],currentAssistant:p,isLoading:!1,error:null,listAssistants:async()=>{},getAssistant:async()=>p,createAssistant:async()=>{throw new Error("Not implemented in a Web App")},updateAssistant:async()=>{throw new Error("Not implemented in a Web App")},deleteAssistant:async()=>{},selectAssistant:async()=>{},clearCurrentAssistant:()=>{},refresh:async()=>{}}),[p]);return(0,c.jsx)(te,{theme:m,locale:Ct[C],children:(0,c.jsx)(le,{config:{baseURL:_.baseURL,apiKey:"",assistantId:"__BASE__",transport:"sse"},createClient:x,children:(0,c.jsx)(ue,{initialConfig:_,persistToLocalStorage:!1,children:(0,c.jsx)(pe.Provider,{value:W,children:(0,c.jsx)(fe,{children:(0,c.jsx)(Pt,{className:i,onChatReady:a,onChatMessage:o,title:A.title,welcome:A.welcome,quickPrompts:A.quickPrompts})})})})})})}function Pt({className:e,onChatReady:r,onChatMessage:t,title:n,welcome:a,quickPrompts:o=[]}){let i=L(),{threadId:d}=q(),{currentAssistant:l}=ce();if(!l)return null;let C=d??"";if(!C)return(0,c.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,c.jsx)(re,{tip:i("integration.chat.creatingConversation")})});let p=n??a,A=n!==void 0&&a!==void 0?a:"";return(0,c.jsx)("div",{className:e,children:(0,c.jsx)(be,{thread_id:C,assistant_id:l.id,name:l.name,description:l.description,menu:(0,c.jsx)(Re,{}),showProjectSelector:!1,showSkillSlot:!1,showDatabaseSlot:!1,showAgentSlot:!1,showMetricsDataSourceSlot:!1,headerRight:null,emptyStateGreeting:p?(0,c.jsx)("span",{children:p}):void 0,emptyStateQuestion:A,senderPromptsItems:o.length>0?o.map((m,E)=>({key:`quick-${E}`,label:m.label,description:m.text})):void 0,showSkillPrompts:!1,showQuickAnalysis:!1,onChatReady:r,onChatMessage:t})})}export{ot as a,Tr as b};
@@ -1,4 +1,4 @@
1
- import{b as sn,c as an,d as En}from"./embed-page-chunk-WTOAQDQN.js";import{a as cn,b as Ae,e as ke,f as vn,h as Cn,i as _n}from"./embed-page-chunk-V2GBFWLG.js";import{Fa as ln,H as wn,R as Sn,U as bn,fa as An,la as kn,o as Oe,oa as Tn,q as yn,t as xn,u as Me,v as Fe}from"./embed-page-chunk-YYDZ6ZBV.js";import{r as _e}from"./embed-page-chunk-2PFKLMTR.js";import{a as Ve}from"./embed-page-chunk-QV7QAJ4N.js";import{Ia as se,La as Xe,Z as dn,aa as Te,ba as gn,fa as hn,va as mn}from"./embed-page-chunk-MHGVD4EV.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-WTOAQDQN.js";import{a as cn,b as Ae,e as ke,f as vn,h as Cn,i as _n}from"./embed-page-chunk-V2GBFWLG.js";import{Fa as ln,H as wn,R as Sn,U as bn,fa as An,la as kn,o as Oe,oa as Tn,q as yn,t as xn,u as Me,v as Fe}from"./embed-page-chunk-P477ZTUO.js";import{r as _e}from"./embed-page-chunk-2PFKLMTR.js";import{a as Ve}from"./embed-page-chunk-QV7QAJ4N.js";import{Ia as se,La as Xe,Z as dn,aa as Te,ba as gn,fa as hn,va as mn}from"./embed-page-chunk-MHGVD4EV.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+`