@axiom-lattice/gateway 10.3.1 → 11.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 (91) hide show
  1. package/dist/{A2AAuthService-UKN53ZGP.mjs → A2AAuthService-UYWSDE5L.mjs} +2 -2
  2. package/dist/{a2a-YLKZE5JG.mjs → a2a-OCCSVNWB.mjs} +3 -3
  3. package/dist/{a2a-standard-ELY7MTJB.mjs → a2a-standard-2IJP4JG5.mjs} +2 -2
  4. package/dist/{chunk-BIMO2ILH.mjs → chunk-5EXTBV2Z.mjs} +6 -3
  5. package/dist/chunk-5EXTBV2Z.mjs.map +1 -0
  6. package/dist/{chunk-JGQURU44.mjs → chunk-6DTR3CPW.mjs} +2 -2
  7. package/dist/chunk-6DTR3CPW.mjs.map +1 -0
  8. package/dist/{chunk-BOPNXTMO.mjs → chunk-7XTRBDCF.mjs} +2 -2
  9. package/dist/{chunk-MFWTGNQR.mjs → chunk-HBDRSIPK.mjs} +1 -1
  10. package/dist/chunk-HBDRSIPK.mjs.map +1 -0
  11. package/dist/{chunk-YR32MWEJ.mjs → chunk-JQWIJDZN.mjs} +2 -2
  12. package/dist/{chunk-LCM4OQTI.mjs → chunk-NQS3U4KP.mjs} +23 -1
  13. package/dist/chunk-NQS3U4KP.mjs.map +1 -0
  14. package/dist/{chunk-NYYSBNDG.mjs → chunk-Q5ADRJ3T.mjs} +2 -2
  15. package/dist/{chunk-7CG57LEF.mjs → chunk-WKHTSTB6.mjs} +2 -2
  16. package/dist/chunk-WKHTSTB6.mjs.map +1 -0
  17. package/dist/embed/agent-chat-loader.js +1 -1
  18. package/dist/embed/{embed-page-AgentDetailSideApp-HQMDIT7S.js → embed-page-AgentDetailSideApp-CQEMTLCM.js} +1 -1
  19. package/dist/embed/{embed-page-AgentGovernanceWorkbench-T26AS6KD.js → embed-page-AgentGovernanceWorkbench-MFE7A3HX.js} +1 -1
  20. package/dist/embed/{embed-page-LangfuseDashboard-WU5WJUBH.js → embed-page-LangfuseDashboard-FXNWREGX.js} +1 -1
  21. package/dist/embed/{embed-page-MessageGraph-AB5JL57B.js → embed-page-MessageGraph-2KRSGTMR.js} +1 -1
  22. package/dist/embed/{embed-page-ReactChart-OFCUVHIA.js → embed-page-ReactChart-BFMFGXXT.js} +1 -1
  23. package/dist/embed/{embed-page-SkillFlow-3Z4KXWBR.js → embed-page-SkillFlow-F24RIIPR.js} +1 -1
  24. package/dist/embed/{embed-page-TasksSideApp-5J5KPJGJ.js → embed-page-TasksSideApp-EKOC6GR5.js} +1 -1
  25. package/dist/embed/{embed-page-ThreadMaintenancePanel-TOPARLQN.js → embed-page-ThreadMaintenancePanel-25HFF6LC.js} +1 -1
  26. package/dist/embed/embed-page-TopologyRuntimeView-AZ56RJ3H.js +6 -0
  27. package/dist/embed/{embed-page-WorkflowAutomationView-3CGPGS7D.js → embed-page-WorkflowAutomationView-TZR47MHE.js} +1 -1
  28. package/dist/embed/{embed-page-chunk-GMLPPJZP.js → embed-page-chunk-43ZJCYNA.js} +1 -1
  29. package/dist/embed/{embed-page-chunk-N2Y3D6YG.js → embed-page-chunk-5VJZ7DJM.js} +1 -1
  30. package/dist/embed/{embed-page-chunk-T2GL7G2Z.js → embed-page-chunk-FUNZXEPN.js} +1 -1
  31. package/dist/embed/{embed-page-chunk-JRGR5W3C.js → embed-page-chunk-GWB56NNU.js} +1 -1
  32. package/dist/embed/{embed-page-chunk-GXHZDCWF.js → embed-page-chunk-JAZH5PLN.js} +1 -1
  33. package/dist/embed/{embed-page-chunk-PNJ7DZ5V.js → embed-page-chunk-QQZUP2A4.js} +1 -1
  34. package/dist/embed/embed-page-chunk-S2G53SSD.js +217 -0
  35. package/dist/embed/{embed-page-chunk-KJTJI54Q.js → embed-page-chunk-TJMEWCV7.js} +141 -141
  36. package/dist/embed/{embed-page-chunk-U3XF7MHJ.js → embed-page-chunk-XP37R2JT.js} +5 -5
  37. package/dist/embed/{embed-page-chunk-4T3AWQQQ.js → embed-page-chunk-YI3NKQSA.js} +1 -1
  38. package/dist/embed/{embed-page-en-PPUKY32O.js → embed-page-en-BRZZWMIP.js} +1 -1
  39. package/dist/embed/{embed-page-en-3DNM36A2.js → embed-page-en-RKPA6NPQ.js} +3 -1
  40. package/dist/embed/{embed-page-zh-4SFTLL5M.js → embed-page-zh-D4S5EDEI.js} +1 -1
  41. package/dist/embed/{embed-page-zh-OA54TF5G.js → embed-page-zh-LQCDXDUF.js} +3 -1
  42. package/dist/embed/embed-page.js +3 -3
  43. package/dist/embed/mcp-app-page.js +19 -19
  44. package/dist/index.js +2083 -1398
  45. package/dist/index.js.map +1 -1
  46. package/dist/index.mjs +1148 -271
  47. package/dist/index.mjs.map +1 -1
  48. package/dist/{mcp-apps-MZECSNN2.mjs → mcp-apps-MKHHUJE4.mjs} +2 -2
  49. package/dist/{open-Y7PAA2VJ.mjs → open-TJLQARLV.mjs} +8 -8
  50. package/dist/open-TJLQARLV.mjs.map +1 -0
  51. package/dist/{open-catalog-NVGP6SQP.mjs → open-catalog-LLTMSZGH.mjs} +2 -2
  52. package/dist/{open-exposure-HGYT5VFC.mjs → open-exposure-2CSXJTM3.mjs} +3 -3
  53. package/dist/{open-files-WK4SQHE3.mjs → open-files-QIMOTHSN.mjs} +2 -2
  54. package/dist/{open-session-CLZT3HVG.mjs → open-session-F5H6PFSN.mjs} +3 -3
  55. package/dist/open-session-F5H6PFSN.mjs.map +1 -0
  56. package/dist/{openLattice-D5YTSZBY.mjs → openLattice-KFUREFWM.mjs} +2 -2
  57. package/dist/{registerExposedPlugins-2JGXSMAL.mjs → registerExposedPlugins-N6ENBBKN.mjs} +3 -3
  58. package/dist/{resources-YD5DOPGD.mjs → resources-53PXMFQI.mjs} +37 -12
  59. package/dist/resources-53PXMFQI.mjs.map +1 -0
  60. package/dist/{sandboxOpenCredentialProvider-RTYOYRCT.mjs → sandboxOpenCredentialProvider-3CUISBEL.mjs} +4 -4
  61. package/dist/sandboxOpenCredentialProvider-3CUISBEL.mjs.map +1 -0
  62. package/package.json +8 -8
  63. package/dist/chunk-7CG57LEF.mjs.map +0 -1
  64. package/dist/chunk-BIMO2ILH.mjs.map +0 -1
  65. package/dist/chunk-JGQURU44.mjs.map +0 -1
  66. package/dist/chunk-LCM4OQTI.mjs.map +0 -1
  67. package/dist/chunk-MFWTGNQR.mjs.map +0 -1
  68. package/dist/chunk-PWHUWFXL.mjs +0 -173
  69. package/dist/chunk-PWHUWFXL.mjs.map +0 -1
  70. package/dist/collection_service-RTRJEQFL.mjs +0 -8
  71. package/dist/embed/embed-page-TopologyRuntimeView-DNYSW2GN.js +0 -6
  72. package/dist/embed/embed-page-chunk-5UOSSN26.js +0 -217
  73. package/dist/kbProvider-2D6DZ34N.mjs +0 -50
  74. package/dist/kbProvider-2D6DZ34N.mjs.map +0 -1
  75. package/dist/open-Y7PAA2VJ.mjs.map +0 -1
  76. package/dist/open-session-CLZT3HVG.mjs.map +0 -1
  77. package/dist/registerExposedPlugins-2JGXSMAL.mjs.map +0 -1
  78. package/dist/resources-YD5DOPGD.mjs.map +0 -1
  79. package/dist/sandboxOpenCredentialProvider-RTYOYRCT.mjs.map +0 -1
  80. /package/dist/{A2AAuthService-UKN53ZGP.mjs.map → A2AAuthService-UYWSDE5L.mjs.map} +0 -0
  81. /package/dist/{a2a-YLKZE5JG.mjs.map → a2a-OCCSVNWB.mjs.map} +0 -0
  82. /package/dist/{a2a-standard-ELY7MTJB.mjs.map → a2a-standard-2IJP4JG5.mjs.map} +0 -0
  83. /package/dist/{chunk-BOPNXTMO.mjs.map → chunk-7XTRBDCF.mjs.map} +0 -0
  84. /package/dist/{chunk-YR32MWEJ.mjs.map → chunk-JQWIJDZN.mjs.map} +0 -0
  85. /package/dist/{chunk-NYYSBNDG.mjs.map → chunk-Q5ADRJ3T.mjs.map} +0 -0
  86. /package/dist/{collection_service-RTRJEQFL.mjs.map → mcp-apps-MKHHUJE4.mjs.map} +0 -0
  87. /package/dist/{open-catalog-NVGP6SQP.mjs.map → open-catalog-LLTMSZGH.mjs.map} +0 -0
  88. /package/dist/{open-exposure-HGYT5VFC.mjs.map → open-exposure-2CSXJTM3.mjs.map} +0 -0
  89. /package/dist/{open-files-WK4SQHE3.mjs.map → open-files-QIMOTHSN.mjs.map} +0 -0
  90. /package/dist/{mcp-apps-MZECSNN2.mjs.map → openLattice-KFUREFWM.mjs.map} +0 -0
  91. /package/dist/{openLattice-D5YTSZBY.mjs.map → registerExposedPlugins-N6ENBBKN.mjs.map} +0 -0
@@ -1,3 +1,3 @@
1
- import{a as $e,b as Ue}from"./embed-page-chunk-GXHZDCWF.js";import{b as Xe,c as me}from"./embed-page-chunk-GMLPPJZP.js";import"./embed-page-chunk-BJESMNTG.js";import{f as Ye}from"./embed-page-chunk-QPWSDWJ2.js";import"./embed-page-chunk-S4XZPBRM.js";import{T as Ge,j as Ke}from"./embed-page-chunk-KJTJI54Q.js";import{i as te}from"./embed-page-chunk-5UOSSN26.js";import{a as ne}from"./embed-page-chunk-T2GL7G2Z.js";import"./embed-page-chunk-U3XF7MHJ.js";import{Ea as q,Ha as fe,I as ce,Ja as qe,O as pe,Ra as ue,Sa as ee,Ta as He,Y as je,_ as Ee,aa as ge,fa as _e,ia as Fe,l as Oe,na as Be,o as de,t as Pe,za as Ne}from"./embed-page-chunk-BNA3NXXX.js";import{l as O}from"./embed-page-chunk-PNJ7DZ5V.js";import{a as j}from"./embed-page-chunk-L2PNY33P.js";import"./embed-page-chunk-DLSQ2OWQ.js";import"./embed-page-chunk-V5NE4FIR.js";import{Ba as De,G as Te,Ja as le,Ra as Le,sa as Me}from"./embed-page-chunk-7TINC3YA.js";import{Ka as J,Pa as V,Qa as ae,Ta as Q,Va as Ae,ba as ze,fa as $,ia as U,ib as Z,oa as X,xa as Ie}from"./embed-page-chunk-TWJOR2LG.js";import{a as se}from"./embed-page-chunk-MPQBYKDM.js";import"./embed-page-chunk-3KBY77YU.js";import"./embed-page-chunk-U2CG7PH5.js";import{e as I}from"./embed-page-chunk-45A47GH2.js";var i=I(se());var oe=I(se());var P=I(j());function ft(r){let o=r.split(/[\n\r.。;;!!??]+/).filter(Boolean)[0]?.trim()||"";return o=o.replace(/[,,]+$/,"").trim(),o.length>50&&(o=o.slice(0,50)),o||(o=r.slice(0,50).trim()),o}function ut(r){let e=5381;for(let o=0;o<r.length;o++)e=(e<<5)+e+r.charCodeAt(o)>>>0;return e.toString(36).slice(0,6)}var be=({open:r,onCancel:e,onCreated:o})=>{let{post:w}=ne(),v=O(),{trainingProjects:d,loading:u}=te(),[y,p]=(0,oe.useState)(null),[g]=J.useForm(),b=d.find(h=>h.id===y)??d[0]??null;(0,oe.useEffect)(()=>{r&&(g.resetFields(),p(null))},[r,g]);let R=async()=>{if(!b)return;let m=((await g.validateFields()).purpose||"").trim(),A=ft(m),z=`wf-${ut(m+Date.now())}`,E={key:z,name:A,description:m,type:"workflow",prompt:"Complete the assigned task accurately and concisely.",metadata:{trainingProjectId:b?.id},workflowYaml:`name: ${z}
1
+ import{a as $e,b as Ue}from"./embed-page-chunk-JAZH5PLN.js";import{b as Xe,c as me}from"./embed-page-chunk-43ZJCYNA.js";import"./embed-page-chunk-BJESMNTG.js";import{f as Ye}from"./embed-page-chunk-QPWSDWJ2.js";import"./embed-page-chunk-S4XZPBRM.js";import{T as Ge,j as Ke}from"./embed-page-chunk-TJMEWCV7.js";import{i as te}from"./embed-page-chunk-S2G53SSD.js";import{a as ne}from"./embed-page-chunk-FUNZXEPN.js";import"./embed-page-chunk-XP37R2JT.js";import{Ea as q,Ha as fe,I as ce,Ja as qe,O as pe,Ra as ue,Sa as ee,Ta as He,Y as je,_ as Ee,aa as ge,fa as _e,ia as Fe,l as Oe,na as Be,o as de,t as Pe,za as Ne}from"./embed-page-chunk-BNA3NXXX.js";import{l as O}from"./embed-page-chunk-QQZUP2A4.js";import{a as j}from"./embed-page-chunk-L2PNY33P.js";import"./embed-page-chunk-DLSQ2OWQ.js";import"./embed-page-chunk-V5NE4FIR.js";import{Ba as De,G as Te,Ja as le,Ra as Le,sa as Me}from"./embed-page-chunk-7TINC3YA.js";import{Ka as J,Pa as V,Qa as ae,Ta as Q,Va as Ae,ba as ze,fa as $,ia as U,ib as Z,oa as X,xa as Ie}from"./embed-page-chunk-TWJOR2LG.js";import{a as se}from"./embed-page-chunk-MPQBYKDM.js";import"./embed-page-chunk-3KBY77YU.js";import"./embed-page-chunk-U2CG7PH5.js";import{e as I}from"./embed-page-chunk-45A47GH2.js";var i=I(se());var oe=I(se());var P=I(j());function ft(r){let o=r.split(/[\n\r.。;;!!??]+/).filter(Boolean)[0]?.trim()||"";return o=o.replace(/[,,]+$/,"").trim(),o.length>50&&(o=o.slice(0,50)),o||(o=r.slice(0,50).trim()),o}function ut(r){let e=5381;for(let o=0;o<r.length;o++)e=(e<<5)+e+r.charCodeAt(o)>>>0;return e.toString(36).slice(0,6)}var be=({open:r,onCancel:e,onCreated:o})=>{let{post:w}=ne(),v=O(),{trainingProjects:d,loading:u}=te(),[y,p]=(0,oe.useState)(null),[g]=J.useForm(),b=d.find(h=>h.id===y)??d[0]??null;(0,oe.useEffect)(()=>{r&&(g.resetFields(),p(null))},[r,g]);let R=async()=>{if(!b)return;let m=((await g.validateFields()).purpose||"").trim(),A=ft(m),z=`wf-${ut(m+Date.now())}`,E={key:z,name:A,description:m,type:"workflow",prompt:"Complete the assigned task accurately and concisely.",metadata:{trainingProjectId:b?.id},workflowYaml:`name: ${z}
2
2
  steps: []
3
3
  `};await w("/api/assistants",{id:z,name:A,description:m,graphDefinition:E}),g.resetFields(),o(z,m,b?.id)};return(0,P.jsx)(Q,{title:v("chatConfig.workflow.create.title"),open:r,onCancel:e,onOk:R,okText:v("common.create"),okButtonProps:{disabled:u||!b},destroyOnClose:!0,children:(0,P.jsxs)(J,{form:g,layout:"vertical",initialValues:{purpose:""},children:[(0,P.jsx)(J.Item,{name:"purpose",label:v("chatConfig.workflow.field.purpose"),rules:[{required:!0,message:v("chatConfig.workflow.validation.purposeRequired")}],children:(0,P.jsx)(V.TextArea,{placeholder:v("chatConfig.workflow.field.purposePlaceholder"),rows:4})}),(0,P.jsx)($e,{project:b,value:b?.id??null,onChange:p,loading:u})]})})};var Qe=I(se());var t=I(j()),{Text:ye}=Z;function mt(r){if(!r||typeof r!="object")return null;let e=r;return{modelKey:e.modelKey||e.model||void 0,tools:Array.isArray(e.tools)?e.tools:[],middleware:Array.isArray(e.middleware)?e.middleware.filter(o=>o&&typeof o=="object"&&o.type):[],subAgents:Array.isArray(e.subAgents)?e.subAgents:[],skillCategories:Array.isArray(e.skillCategories)?e.skillCategories:[],runConfig:e.runConfig&&typeof e.runConfig=="object"?e.runConfig:void 0}}var bt={filesystem:(0,t.jsx)(je,{size:12}),code_eval:(0,t.jsx)(qe,{size:12}),browser:(0,t.jsx)(ge,{size:12}),sql:(0,t.jsx)(pe,{size:12}),skill:(0,t.jsx)(fe,{size:12}),http:(0,t.jsx)(Fe,{size:12}),scheduler:(0,t.jsx)(ce,{size:12}),metrics:(0,t.jsx)(Oe,{size:12}),ask_user_to_clarify:(0,t.jsx)(Be,{size:12}),widget:(0,t.jsx)(de,{size:12}),date:(0,t.jsx)(Pe,{size:12}),task:(0,t.jsx)(Ee,{size:12}),custom:(0,t.jsx)(Ne,{size:12}),claw:(0,t.jsx)(q,{size:12}),collection:(0,t.jsx)(_e,{size:12})},yt={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)"},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 ht(r){let e=r.split(/[_-]+/).filter(Boolean);return e.length===1?e[0].slice(0,2).toUpperCase():e.map(o=>o[0]).join("").toUpperCase().slice(0,2)}var Je=[{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 Ve(r){return Je[r%Je.length]}var H=({icon:r,label:e,count:o,children:w})=>(0,t.jsxs)("div",{style:{marginBottom:10},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6},children:[(0,t.jsx)("span",{style:{color:"#6366f1",display:"flex",alignItems:"center"},children:r}),(0,t.jsx)(ye,{strong:!0,style:{fontSize:11,color:"#52525b",textTransform:"uppercase",letterSpacing:"0.3px"},children:e}),(0,t.jsx)("span",{style:{fontSize:9,fontWeight:600,color:"#a1a1aa",background:"rgba(0,0,0,0.04)",borderRadius:8,padding:"1px 6px",lineHeight:"16px"},children:o})]}),w]}),Ze=({graphDef:r})=>{let e=O(),o=(0,Qe.useMemo)(()=>mt(r),[r]);if(!o)return null;let w=o.middleware.filter(d=>d.enabled!==!1),v=!1;return o.tools.length===0&&w.length===0&&o.subAgents.length===0?null:(0,t.jsx)("div",{style:{pointerEvents:"auto"},children:(0,t.jsxs)("div",{style:{background:"rgba(255,255,255,0.5)",borderRadius:8,width:250,transition:"all 0.25s ease",overflow:"hidden"},children:[(0,t.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,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,t.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,t.jsx)(q,{size:13})}),(0,t.jsx)(ye,{strong:!0,style:{fontSize:12,color:"#1a1a1a"},children:e("chat.environment.title")})]})}),(0,t.jsxs)("div",{style:{padding:"10px 12px 12px",maxHeight:"calc(60vh - 48px)",overflowY:"auto"},children:[o.tools.length>0&&(0,t.jsx)(H,{icon:(0,t.jsx)(He,{size:12}),label:e("chat.environment.tools"),count:o.tools.length,children:(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:o.tools.map((d,u)=>{let y=Ve(u);return(0,t.jsx)(X,{title:d,placement:"top",children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:y.text,background:y.bg,cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,t.jsx)("span",{style:{fontWeight:700,fontSize:9,opacity:.7},children:ht(d)}),(0,t.jsx)("span",{children:d})]})},d)})})}),w.length>0&&(0,t.jsx)(H,{icon:(0,t.jsx)(de,{size:12}),label:e("chat.environment.capabilities"),count:w.length,children:(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:w.map(d=>{let u=yt[d.type]||wt,y=bt[d.type]||(0,t.jsx)(q,{size:12});return(0,t.jsx)(X,{title:d.name||d.type,placement:"top",children:(0,t.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:[y,(0,t.jsx)("span",{children:d.name||d.type})]})},d.type)})})}),o.subAgents.length>0&&(0,t.jsx)(H,{icon:(0,t.jsx)(ue,{size:12}),label:e("chat.environment.subAgents"),count:o.subAgents.length,children:(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:o.subAgents.map((d,u)=>{let y=Ve(u+3);return(0,t.jsx)(X,{title:d,placement:"top",children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:y.text,background:y.bg,cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,t.jsx)(ue,{size:10}),(0,t.jsx)("span",{children:d})]})},d)})})}),(o.modelKey||o.runConfig)&&(0,t.jsx)(H,{icon:(0,t.jsx)(ce,{size:12}),label:e("chat.environment.runtime"),count:o.modelKey?1:0,children:(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[o.modelKey&&(0,t.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,t.jsx)(q,{size:10}),(0,t.jsx)("span",{children:e("chat.environment.model",{model:o.modelKey})})]}),!!o.runConfig?.databaseKey&&(0,t.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,t.jsx)(pe,{size:10}),(0,t.jsx)("span",{children:e("chat.environment.db",{db:String(o.runConfig?.databaseKey)})})]}),o.skillCategories&&o.skillCategories.length>0&&(0,t.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,t.jsx)(fe,{size:10}),(0,t.jsx)("span",{children:e("chat.environment.skills",{skills:o.skillCategories.join(", ")})})]})]})}),v&&(0,t.jsx)(H,{icon:(0,t.jsx)(ge,{size:12}),label:e("chat.environment.channels"),count:0,children:(0,t.jsx)(ye,{type:"secondary",style:{fontSize:10,fontStyle:"italic"},children:e("chat.environment.noChannels")})})]})]})})};var n=I(j()),{Text:K}=Z,xt=300;function et(r){if(typeof r=="string")try{let e=JSON.parse(r);return e&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}return r&&typeof r=="object"&&!Array.isArray(r)?r:null}function kt(r){let e=null;if(typeof r=="string")try{e=JSON.parse(r)}catch{return null}else r&&typeof r=="object"&&(e=r);if(!e)return null;if(e.type!=="workflow")return console.warn("[extractDSL] type is not 'workflow':",e.type),null;if(typeof e.workflowYaml!="string")return console.warn("[extractDSL] workflowYaml not found or not a string, keys:",Object.keys(e)),null;try{return me(e.workflowYaml)}catch(o){return console.error("[extractDSL] expandWorkflow failed:",o.message,o),null}}function vt({workflows:r,selectedId:e,onSelect:o,onCreate:w,onDelete:v,dsl:d,agentNameMap:u,onSpecClick:y,environmentConfig:p}){let g=O(),b=r.find(f=>f.id===e),[R,h]=(0,i.useState)(!0),[m,A]=(0,i.useState)(""),z=(0,i.useMemo)(()=>{let f=m.trim().toLowerCase();return f?r.filter(C=>C.name.toLowerCase().includes(f)||C.description.toLowerCase().includes(f)):r},[r,m]);(0,i.useEffect)(()=>{e?h(!1):(h(!0),A(""))},[e]);let E=f=>{o(f),h(!1)};return(0,n.jsx)("div",{style:{display:"flex",height:"100%",width:"100%"},children:(0,n.jsxs)("div",{style:{flex:1,position:"relative"},children:[b?(0,n.jsxs)(n.Fragment,{children:[d?(0,n.jsx)(Xe,{dsl:d,agentNameMap:u}):(0,n.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,n.jsx)(ae,{tip:g("chatWorkspace.workflowAutomation.loadingDsl")})}),!R&&(0,n.jsx)("div",{style:{position:"absolute",top:12,left:12,zIndex:10},children:(0,n.jsx)($,{type:"default",icon:(0,n.jsx)(De,{}),onClick:()=>h(!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,n.jsxs)("div",{style:{position:"absolute",top:12,left:R?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,n.jsx)(ee,{size:16,color:"#6366f1"}),(0,n.jsx)(K,{strong:!0,style:{fontSize:13},children:b.name}),(0,n.jsx)(Me,{style:{color:"#6366f1",cursor:"pointer",fontSize:15},onClick:y})]}),(0,n.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,n.jsx)(Ae,{title:g("chatWorkspace.workflowAutomation.deleteTitle"),description:g("chatWorkspace.workflowAutomation.deleteBody"),onConfirm:()=>v(b.id),okText:g("common.delete"),cancelText:g("common.cancel"),okButtonProps:{danger:!0},children:(0,n.jsx)(Te,{style:{color:"#ff4d4f",cursor:"pointer",fontSize:15}})})}),!R&&(0,n.jsx)("div",{style:{position:"absolute",top:52,left:R?12:56,zIndex:20},children:(0,n.jsx)(Ze,{graphDef:p},b.id)})]}):(0,n.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,n.jsx)(U,{description:g("chatWorkspace.workflowAutomation.selectWorkflow")})}),R&&(0,n.jsxs)(n.Fragment,{children:[e&&(0,n.jsx)("div",{onClick:()=>h(!1),style:{position:"absolute",inset:0,zIndex:25,background:"transparent"}}),(0,n.jsxs)(Ie,{size:"small",title:(0,n.jsx)(K,{strong:!0,style:{fontSize:15,color:"#1a1a1a"},children:g("chatWorkspace.workflowAutomation.title")}),extra:(0,n.jsx)($,{type:"text",size:"small",icon:(0,n.jsx)(le,{}),onClick:w,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:e?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,n.jsx)("div",{style:{marginBottom:12},children:(0,n.jsx)(V,{prefix:(0,n.jsx)(Le,{style:{color:"#bbb"}}),placeholder:g("chatWorkspace.workflowAutomation.filterPlaceholder"),value:m,onChange:f=>A(f.target.value),allowClear:!0,size:"small",style:{borderRadius:10,border:"1px solid rgba(0,0,0,0.06)"}})}),z.length===0?(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 16px",color:"#bbb"},children:[(0,n.jsx)(ee,{size:28,style:{marginBottom:10,opacity:.4}}),(0,n.jsx)(K,{type:"secondary",style:{fontSize:13},children:m.trim()?g("chatWorkspace.workflowAutomation.noMatch"):g("chatWorkspace.workflowAutomation.emptyTitle")})]}):z.map(f=>{let C=e===f.id;return(0,n.jsxs)("div",{onClick:()=>E(f.id),style:{display:"flex",alignItems:"center",gap:12,padding:"13px 15px",borderRadius:12,cursor:"pointer",transition:"all 0.2s ease",background:C?"rgba(99, 102, 241, 0.07)":"rgba(255, 255, 255, 0.5)",border:C?"1px solid rgba(99, 102, 241, 0.25)":"1px solid transparent",marginBottom:6},onMouseEnter:S=>{C||(S.currentTarget.style.background="rgba(255, 255, 255, 0.92)",S.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.05)",S.currentTarget.style.transform="translateY(-1px)",S.currentTarget.style.borderColor="rgba(0,0,0,0.06)")},onMouseLeave:S=>{C||(S.currentTarget.style.background="rgba(255, 255, 255, 0.5)",S.currentTarget.style.boxShadow="none",S.currentTarget.style.transform="translateY(0)",S.currentTarget.style.borderColor="transparent")},children:[(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:38,height:38,borderRadius:10,background:C?"rgba(99, 102, 241, 0.12)":"rgba(0, 0, 0, 0.04)",flexShrink:0,transition:"background 0.2s ease"},children:(0,n.jsx)(ee,{size:18,color:C?"#6366f1":"#888"})}),(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsx)(K,{strong:!0,ellipsis:{tooltip:f.name},style:{fontSize:14,color:C?"#6366f1":"#1a1a1a",transition:"color 0.2s ease"},children:f.name}),f.description&&(0,n.jsx)("div",{style:{fontSize:12,color:"#999",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:3,lineHeight:"18px"},children:f.description})]})]},f.id)})]})]})]})})}var Ct=()=>{let r=O(),{get:e,del:o}=ne(),{workspaceId:w,trainingProjects:v,loading:d}=te(),[u,y]=(0,i.useState)([]),[p,g]=(0,i.useState)(null),[b,R]=(0,i.useState)(null),[h,m]=(0,i.useState)(null),[A,z]=(0,i.useState)([]),[E,f]=(0,i.useState)(new Map),C=(0,i.useCallback)(async()=>{try{let s=await e("/api/assistants");if(s.success&&s.data?.records){let c=[],a=new Map;for(let l of s.data.records){if(l.id&&l.name){let x=typeof l.graphDefinition=="object"&&l.graphDefinition!==null?l.graphDefinition:void 0;a.set(l.id,{name:l.name,type:x?.type??"unknown"})}if(l.graphDefinition)if(typeof l.graphDefinition=="string")try{c.push(JSON.parse(l.graphDefinition))}catch{}else typeof l.graphDefinition=="object"&&c.push(l.graphDefinition)}z(c),f(a)}}catch{}},[e]),[S,we]=(0,i.useState)(!0),[re,tt]=(0,i.useState)(420),_=(0,i.useRef)(null),[nt,ot]=(0,i.useState)(!0),[he,xe]=(0,i.useState)(null),[rt,ke]=(0,i.useState)(!1),[ve,F]=(0,i.useState)(!1),[it,Ce]=(0,i.useState)(null),st=(0,i.useMemo)(()=>["create_workflow","update_workflow","validate_workflow","create_agent","update_agent","delete_agent"],[]),T=(0,i.useCallback)(async()=>{let s=await e("/api/assistants");if(s.success&&s.data?.records){let c=s.data.records.filter(a=>(et(a.graphDefinition)??void 0)?.type==="workflow").map(a=>{let l=et(a.graphDefinition)??void 0,x=typeof l?.workflowYaml=="string"?l.workflowYaml:"",B=l?.metadata,N=0;try{N=me(x).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}});y(c)}xe(null)},[e]),Y=(0,i.useCallback)(async s=>{try{let c=await e(`/api/assistants/${s}`);if(c.success&&c.data){let a=c.data.graphDefinition,l=kt(a);if(R(l),!a)m(null);else if(typeof a=="string")try{m(JSON.parse(a))}catch{m(null)}else m(typeof a=="object"?a:null)}}catch{R(null),m(null)}},[e]);(0,i.useEffect)(()=>{let s=!1;return(async()=>{try{await T(),await C()}catch(a){s||xe(a instanceof Error?a.message:r("chatWorkspace.workflowAutomation.loadFailed"))}finally{s||ot(!1)}})(),()=>{s=!0}},[T]),(0,i.useEffect)(()=>{p?Y(p):R(null)},[p,Y]);let at=(0,i.useCallback)(s=>{s.preventDefault(),_.current={startX:s.clientX,startWidth:re}},[re]);(0,i.useEffect)(()=>{let s=a=>{if(!_.current)return;let l=_.current.startX-a.clientX,x=Math.min(900,Math.max(400,_.current.startWidth+l));tt(x)},c=()=>{_.current=null};return window.addEventListener("mousemove",s),window.addEventListener("mouseup",c),()=>{window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",c)}},[]);let D=(0,i.useRef)(null),Se=(0,i.useRef)({fetchWorkflows:T,fetchDSL:Y});Se.current={fetchWorkflows:T,fetchDSL:Y};let Re=(0,i.useRef)(p);Re.current=p;let lt=(0,i.useCallback)(()=>{D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{D.current=null;let{fetchWorkflows:s,fetchDSL:c}=Se.current;s().catch(l=>{console.warn("Failed to refresh workflows:",l)});let a=Re.current;a&&c(a).catch(l=>{console.warn("Failed to refresh workflow DSL:",l)})},xt)},[]);(0,i.useEffect)(()=>()=>{D.current&&(clearTimeout(D.current),D.current=null)},[]);let dt=(0,i.useCallback)(s=>{g(s)},[]),We=(0,i.useCallback)((s,c,a)=>{F(!1),T().then(()=>{g(s),a&&y(l=>l.map(x=>x.id===s?{...x,trainingProjectId:a}:x)),c&&Ce({requestId:s,content:c})})},[T]),ct=(0,i.useCallback)(async s=>{await o(`/api/assistants/${s}`),p===s&&g(null),await T()},[o,T,p]),L=(0,i.useMemo)(()=>u.find(s=>s.id===p)||null,[u,p]),G=L?.trainingProjectId??v[0]?.id??null,pt=(0,i.useMemo)(()=>p&&L?{id:p,name:L.name,type:"workflow"}:null,[p,L]),gt=(0,i.useMemo)(()=>{let s=b?.nodes.filter(k=>k.type!=="terminal"&&k.ref).map(k=>k.ref).filter((k,W,M)=>M.indexOf(k)===W)??[];if(s.length===0)return h;let c=A.filter(k=>{let W=k.key;return W&&s.includes(W)});if(c.length===0)return h;let a={...h??{}},l=new Set(a.tools??[]),x=[...a.middleware??[]],B=new Set(a.subAgents??[]),N=new Set(x.map(k=>k.type).filter(Boolean));for(let k of c){let W=k;for(let M of W.tools??[])l.add(M);for(let M of W.middleware??[]){let ie=M.type;ie&&!N.has(ie)&&(x.push(M),N.add(ie))}for(let M of W.subAgents??[])B.add(M)}return a.tools=Array.from(l),a.middleware=x,a.subAgents=Array.from(B),a},[b,h,A]);return nt?(0,n.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,n.jsx)(ae,{size:"large",tip:r("chatWorkspace.workflowAutomation.loading")})}):he?(0,n.jsx)(U,{description:he}):u.length===0?(0,n.jsxs)("div",{style:{width:"100%",height:"100%"},children:[(0,n.jsx)(be,{open:ve,onCancel:()=>F(!1),onCreated:We}),(0,n.jsx)(U,{description:r("chatWorkspace.workflowAutomation.noDefinitions"),children:(0,n.jsx)($,{type:"primary",icon:(0,n.jsx)(le,{}),onClick:()=>F(!0),children:r("chatWorkspace.workflowAutomation.createWorkflow")})})]}):(0,n.jsxs)("div",{style:{width:"100%",height:"100%"},children:[(0,n.jsx)(be,{open:ve,onCancel:()=>F(!1),onCreated:We}),(0,n.jsx)(Q,{title:L?.name,open:rt,onCancel:()=>ke(!1),footer:null,width:"85vw",centered:!0,styles:{body:{maxHeight:"calc(85vh - 120px)",overflow:"auto",padding:"12px 24px 24px"}},children:L?.description?(0,n.jsx)(Ke,{content:L.description}):(0,n.jsx)(K,{type:"secondary",children:r("chatWorkspace.workflowAutomation.noDescription")})}),(0,n.jsx)(Ye,{children:(0,n.jsxs)("div",{style:{height:"100%",width:"100%",position:"relative",overflow:"hidden"},children:[v.length===0&&!d&&(0,n.jsx)(ze,{type:"warning",showIcon:!0,style:{position:"absolute",top:48,left:"clamp(16px, 32vw, 332px)",right:16,zIndex:40,margin:0},message:r("governance.learning.noProject"),description:r("governance.learning.noProjectDescription")}),(0,n.jsx)(vt,{workflows:u,selectedId:p,onSelect:dt,onCreate:()=>F(!0),onDelete:ct,dsl:b,agentNameMap:E,onSpecClick:()=>ke(!0),environmentConfig:gt}),!S&&p&&G&&(0,n.jsx)("div",{style:{position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",zIndex:20},children:(0,n.jsx)("div",{onClick:()=>we(!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")})}),S&&p&&G&&!d&&(0,n.jsxs)("div",{style:{position:"absolute",right:16,top:48,bottom:12,zIndex:15,width:re,borderRadius:16,overflow:"hidden",boxShadow:"0 4px 24px rgba(0,0,0,0.12)"},children:[(0,n.jsx)("div",{onMouseDown:at,style:{position:"absolute",left:0,top:0,bottom:0,width:6,cursor:"ew-resize",zIndex:2,background:"transparent"}}),(0,n.jsx)(Ge,{defaultWorkspaceId:w??void 0,defaultProjectId:G??void 0,children:(0,n.jsx)(Ue,{workflowContext:pt,onClose:()=>we(!1),onToolCompleted:s=>{st.includes(s)&&lt()},initialMessageRequest:it,onInitialMessageSubmitted:s=>Ce(c=>c?.requestId===s?null:c)})},`${w??"default"}:${G??"default"}`)]})]})})]})},Zt=Ct;export{Ct as WorkflowAutomationView,Zt as default};
@@ -1,4 +1,4 @@
1
- import{b as un,c as an,d as Vn}from"./embed-page-chunk-BJESMNTG.js";import{a as sn,b as Se,e as xe,f as Kn,h as $n,i as Xn}from"./embed-page-chunk-QPWSDWJ2.js";import{j as cn}from"./embed-page-chunk-KJTJI54Q.js";import{A as Hn,Ba as jn,D as qn,E as Fe,F as De,Pa as Gn,Sa as Un,Z as zn,ha as Bn,ma as Yn,y as Me}from"./embed-page-chunk-BNA3NXXX.js";import{l as ve}from"./embed-page-chunk-PNJ7DZ5V.js";import{a as Ve}from"./embed-page-chunk-L2PNY33P.js";import{Qa as Wn,eb as ce,ia as Fn,ib as Xe,oa as Ce,pa as Dn,wa as Pn}from"./embed-page-chunk-TWJOR2LG.js";import{a as Qi}from"./embed-page-chunk-MPQBYKDM.js";import{e as Oe}from"./embed-page-chunk-45A47GH2.js";var te=Oe(Qi());var E=Oe(Ve());if(typeof document<"u"){let o="workflow-node-spin-keyframes";if(!document.getElementById(o)){let a=document.createElement("style");a.id=o,a.textContent="@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }",document.head.appendChild(a)}}var{Text:se}=Xe,Qe={opacity:0},Pe={running:{color:"#1677ff",icon:(0,E.jsx)(Yn,{size:14,style:{animation:"spin 1s linear infinite"}})},completed:{color:"#52c41a",icon:(0,E.jsx)(Me,{size:14})},failed:{color:"#ff4d4f",icon:(0,E.jsx)(Fe,{size:14})},interrupted:{color:"#faad14",icon:(0,E.jsx)(Hn,{size:14})},skipped:{color:"#8c8c8c",icon:(0,E.jsx)(De,{size:14})}},Qn={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"},Zn={color:"#d9d9d9",icon:(0,E.jsx)(De,{size:14})},Jn={agent:{color:"#6366f1",bg:"#EEF2FF",border:"#6366f1"},map:{color:"#10b981",bg:"#ECFDF5",border:"#10b981"},terminal:{color:"#64748b",bg:"#F8FAFC",border:"#94a3b8"}},ei={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 Zi(o){return(o||"?").split(/[\s_-]+/).filter(Boolean).map(a=>a[0]).join("").toUpperCase().slice(0,2)}function fn({schema:o,t:a}){let h=o;if(!h||typeof h!="object")return(0,E.jsx)(se,{type:"secondary",style:{fontSize:11},children:a("chatWorkspace.workflowNode.noSchema")});let A=h.properties,s=h.required||[],g=h.items,p=w=>w==="string"?"green":w==="number"||w==="integer"?"orange":w==="boolean"?"purple":w==="array"?"cyan":w==="object"?"blue":"default",t=w=>{let r=w.type;if(r==="array"&&w.items){let l=w.items.type;return l?`Array<${l}>`:"Array"}return r||"any"};return(0,E.jsxs)("div",{style:{maxWidth:340,maxHeight:360,overflow:"auto",fontSize:12},children:[A&&(0,E.jsxs)("div",{children:[(0,E.jsx)(se,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5,display:"block",marginBottom:6},children:a("chatWorkspace.workflowNode.properties")}),Object.entries(A).map(([w,r])=>{let l=s.includes(w),y=r.description,v=t(r),O=r.properties,K=r.items,M=!!(O||K);return(0,E.jsx)(Ce,{title:M?(0,E.jsx)(fn,{t:a,schema:M?O?r:K:void 0}):y||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:l?"rgba(99,102,241,0.04)":"transparent",cursor:M?"pointer":"default"},children:[(0,E.jsx)(se,{style:{fontSize:11,fontWeight:l?600:400,fontFamily:"monospace"},children:w}),l&&(0,E.jsx)("span",{style:{color:"#ef4444",fontSize:9},children:"*"}),y&&!M&&(0,E.jsx)(se,{type:"secondary",style:{fontSize:10,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y}),(0,E.jsx)(ce,{color:p(v),style:{margin:0,fontSize:9,padding:"0 4px",lineHeight:"16px",marginLeft:"auto"},children:v})]})},w)})]}),!A&&g&&(0,E.jsxs)("div",{children:[(0,E.jsx)(se,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5,display:"block",marginBottom:4},children:a("chatWorkspace.workflowNode.items")}),(0,E.jsx)(fn,{t:a,schema:g})]})]})}var ni=72,Ji=3,er=({data:o})=>{let a=ve();if(!o)return null;let{nodeType:h,name:A,description:s,ref:g,refAgentName:p,refAgentType:t,refDeleted:w,outputKey:r,nodeSchema:l,config:y,status:v,source:O,innerRef:K,inputTemplate:M,ask:V,condition:X,runState:I,pending:F}=o,T=Jn[h]||Jn.agent,H=ei[v||""]||ei.__default,q=I?Pe[I.status]||Pe.running:null,z=q?.color,j=q?.icon,B=v==="success"?(0,E.jsx)(Me,{size:14,color:"#22c55e"}):v==="failed"?(0,E.jsx)(Fe,{size:14,color:"#ef4444"}):(0,E.jsx)(De,{size:14,color:"#94a3b8"}),fe=v==="success"?(0,E.jsx)(Me,{size:32,color:H.color}):v==="failed"?(0,E.jsx)(Fe,{size:32,color:H.color}):(0,E.jsx)(qn,{size:32,color:H.color}),ue=y?.title,oe=y?.maxRetries,J=y?.timeout,G=y?.batchSize,Q=y?.maxConcurrency,N=y?.innerConcurrency,Z=I?.selected,Y=!!I||F;function Ae(U){return U==null?"-":U<1e3?`${U}ms`:`${(U/1e3).toFixed(1)}s`}if(h==="terminal"){let U=H.color,he=H.bg,le=a(H.label),ge=fe;Y&&(I?(U=z||U,le=I.status,ge=(0,E.jsx)("span",{style:{fontSize:18},children:j})):F&&(U=Zn.color,he="#fafafa",le=a("chatWorkspace.workflowNode.pending"),ge=(0,E.jsx)(De,{size:18,style:{color:Zn.color}})));let $=Z&&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:F?.5:1},children:[(0,E.jsx)(xe,{type:"target",position:Se.Top,style:Qe}),(0,E.jsx)(Ce,{title:Y&&I?a(Qn[I.status]):A,children:(0,E.jsx)("div",{style:{width:ni,height:ni,borderRadius:"50%",background:he,border:`${Ji}px solid ${F?`${U}80`:U}`,borderStyle:F?"dashed":"solid",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:$,transition:"all 0.2s ease",cursor:"default"},onMouseEnter:F?void 0:ee=>{ee.currentTarget.style.transform="scale(1.08)",ee.currentTarget.style.boxShadow=`0 4px 16px ${U}30`},onMouseLeave:F?void 0:ee=>{ee.currentTarget.style.transform="scale(1)",ee.currentTarget.style.boxShadow=$},children:ge})}),(0,E.jsx)(se,{style:{fontSize:11,color:U,marginTop:6,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:le}),(0,E.jsx)(xe,{type:"source",position:Se.Bottom,style:Qe})]})}let ae=Y&&z?z:T.border,Ie=Y&&z?z:T.color,ke=h==="agent"?(0,E.jsx)(Un,{size:14}):h==="map"?(0,E.jsx)(jn,{size:14}):Zi(A),pe=I?Ae(I.durationMs):null,Te=Z&&z?`0 4px 14px ${z}20`:"0 1px 6px rgba(0,0,0,0.08)",ie=Y&&z?z:T.color;return(0,E.jsxs)("div",{style:{padding:4},children:[(0,E.jsx)(xe,{type:"target",position:Se.Top,style:Qe}),(0,E.jsxs)("div",{style:{width:260,minHeight:90,boxSizing:"border-box",background:"#fff",borderRadius:12,boxShadow:Te,border:"1px solid #e5e7eb",borderLeft:`3px solid ${ae}`,borderStyle:g?"dashed":"solid",overflow:"hidden",transition:"all 0.2s ease",...F?{opacity:.5,borderStyle:"dashed"}:{}},onMouseEnter:F?void 0:U=>{U.currentTarget.style.transform="translateY(-2px)",U.currentTarget.style.boxShadow=`0 4px 12px ${ie}20`},onMouseLeave:F?void 0:U=>{U.currentTarget.style.transform="translateY(0)",U.currentTarget.style.boxShadow=Te},children:[(0,E.jsxs)("div",{style:{background:T.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:Ie,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:600,flexShrink:0},children:ke}),(0,E.jsx)("div",{style:{flex:1,minWidth:0},children:(0,E.jsx)(se,{strong:!0,style:{fontSize:12,color:T.color},ellipsis:{tooltip:A},children:A})}),Y&&j&&(0,E.jsx)(Ce,{title:I?a(Qn[I.status]):void 0,children:(0,E.jsx)("span",{style:{color:z,fontSize:12,display:"flex",flexShrink:0},children:j})})]}),(0,E.jsxs)("div",{style:{padding:"10px 12px"},children:[s&&(0,E.jsx)(se,{type:"secondary",style:{fontSize:11,display:"block",marginTop:2,lineHeight:1.4},ellipsis:{tooltip:s},children:s}),h==="map"&&O&&(0,E.jsxs)(se,{type:"secondary",style:{fontSize:11,display:"block",marginTop:4,lineHeight:1.4,color:T.color,background:T.bg,padding:"2px 6px",borderRadius:4,maxHeight:32,overflow:"hidden"},ellipsis:{tooltip:O},children:["\u2190 ",O]}),h!=="map"&&M&&(0,E.jsx)(se,{type:"secondary",style:{fontSize:11,display:"block",marginTop:4,lineHeight:1.4,color:T.color,background:T.bg,padding:"2px 6px",borderRadius:4,maxHeight:32,overflow:"hidden"},ellipsis:{tooltip:M},children:M}),(0,E.jsxs)("div",{style:{display:"flex",gap:4,marginTop:6,flexWrap:"wrap"},children:[!Y&&h==="agent"&&g&&(0,E.jsx)(Ce,{title:w?a("chatWorkspace.workflowNode.refDeleted",{ref:g}):a("chatWorkspace.workflowNode.refDelegated",{name:p??g}),children:(0,E.jsx)(ce,{color:w?"red":"purple",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},icon:(0,E.jsx)(Bn,{size:10}),children:w?a("chatWorkspace.workflowNode.refDeletedTag",{ref:g}):`\u2192 ${p??g}`})}),!Y&&h==="agent"&&!g&&(0,E.jsx)(ce,{color:"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:a("chatWorkspace.workflowNode.inline")}),V&&(0,E.jsx)(Ce,{title:a("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)(Gn,{size:12,style:{color:"#fa8c16"}})})}),X&&(0,E.jsx)(Ce,{title:a("chatWorkspace.workflowNode.when",{condition:X}),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)(zn,{size:12,style:{color:"#2f54eb"}})})}),!Y&&h==="map"&&K&&(0,E.jsx)(ce,{color:"purple",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:K}),!Y&&h==="map"&&M&&(0,E.jsx)(ce,{color:"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px",maxWidth:120},title:M,children:M.length>20?M.slice(0,18)+"\u2026":M}),!Y&&h==="map"&&(G||Q||N)&&(0,E.jsxs)(ce,{color:"cyan",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:[G??50,"\xD7",Q??10,"\xD7",N??5]}),!Y&&oe?(0,E.jsxs)(ce,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:["\u21BB ",oe]}):null,!Y&&J?(0,E.jsxs)(ce,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:["\u23F1 ",J,"s"]}):null,pe&&(0,E.jsx)(ce,{color:I?"blue":"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:pe}),r&&(0,E.jsx)("span",{style:{marginLeft:"auto"}}),r&&(0,E.jsx)(Dn,{trigger:"hover",placement:"right",mouseEnterDelay:.2,title:(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,E.jsx)(se,{strong:!0,style:{fontSize:12},children:a("chatWorkspace.workflowNode.output")}),(0,E.jsx)(se,{style:{fontSize:11,fontFamily:"monospace",color:"#6366f1"},children:r})]}),content:l?(0,E.jsx)(fn,{t:a,schema:l}):(0,E.jsx)(se,{type:"secondary",style:{fontSize:11},children:a("chatWorkspace.workflowNode.noSchema")}),children:(0,E.jsxs)(ce,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px",flexShrink:0,cursor:"default"},children:["\u2192 ",r]})})]})]})]}),(0,E.jsx)(xe,{type:"source",position:Se.Bottom,style:Qe})]})},ii=er;var P=Oe(Ve()),{Text:de}=Xe;function ri(o){return new Date(o).toLocaleString()}function nr(o){return o.input?typeof o.input.rendered=="string"?o.input.rendered:typeof o.input.description=="string"?o.input.description:JSON.stringify(o.input,null,2):null}function ir(o){return o.output?typeof o.output.result=="string"?o.output.result:typeof o.output=="object"?JSON.stringify(o.output,null,2):String(o.output):null}function rr({step:o}){let a=ve(),h=nr(o),A=ir(o),s=Pe[o.status]||Pe.running,g=[{key:"io",label:a("chatWorkspace.workflowCanvas.tabIo"),children:(0,P.jsxs)(P.Fragment,{children:[h&&(0,P.jsxs)("div",{style:{marginBottom:A?12:0},children:[(0,P.jsx)(de,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:a("chatWorkspace.workflowCanvas.input")}),(0,P.jsx)("div",{style:{background:"rgba(0,0,0,0.02)",borderRadius:8,padding:"8px 10px",marginTop:4,maxHeight:200,overflow:"auto"},children:o.input?.description?(0,P.jsx)(cn,{content:h}):(0,P.jsx)("pre",{style:{margin:0,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace"},children:h})})]}),A&&(0,P.jsxs)("div",{children:[(0,P.jsx)(de,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:a("chatWorkspace.workflowCanvas.output")}),(0,P.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:o.output?.result?(0,P.jsx)(cn,{content:A}):(0,P.jsx)("pre",{style:{margin:0,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace"},children:A})})]}),!h&&!A&&(0,P.jsx)(de,{type:"secondary",style:{fontSize:11},children:a("chatWorkspace.workflowCanvas.noIo")})]})}];return(0,P.jsxs)("div",{style:{maxWidth:480},children:[(0,P.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[(0,P.jsx)("span",{style:{color:s.color,fontSize:14},children:s.icon}),(0,P.jsx)(de,{strong:!0,style:{fontSize:14},children:o.stepName}),(0,P.jsx)(ce,{color:"purple",style:{fontSize:11},children:o.stepType})]}),o.edgePurpose&&(0,P.jsx)("div",{style:{marginBottom:10},children:(0,P.jsx)(de,{type:"secondary",style:{fontSize:11},children:a("chatWorkspace.workflowCanvas.purpose",{purpose:o.edgePurpose})})}),o.errorMessage&&(0,P.jsx)("div",{style:{background:"#FEF2F2",border:"1px solid #FECACA",borderRadius:8,padding:"8px 12px",marginBottom:12,overflow:"hidden"},children:(0,P.jsx)(de,{type:"danger",style:{fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:o.errorMessage})}),(0,P.jsx)(Pn,{activeKey:"io",items:g,size:"small",style:{marginBottom:-8}}),(0,P.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginTop:12,paddingTop:8,borderTop:"1px solid #f0f0f0"},children:[(0,P.jsx)(de,{type:"secondary",style:{fontSize:10},children:a("chatWorkspace.workflowCanvas.started",{time:ri(o.startedAt)})}),o.completedAt&&(0,P.jsx)(de,{type:"secondary",style:{fontSize:10},children:a("chatWorkspace.workflowCanvas.ended",{time:ri(o.completedAt)})})]})]})}function We(o,a){return o.find(h=>h.stepName===a.name)??null}function Ze(o,a,h,A){let s=o.ref&&A?A.get(o.ref):void 0;return{nodeType:o.type,name:o.name,description:o.description,ref:o.ref,refAgentName:s?.name,refAgentType:s?.type,refDeleted:o.ref&&A?!s:void 0,outputKey:o.output?.key,nodeSchema:o.output?.schema,config:o.config,status:o.status,source:o.source,innerRef:o.node?.ref,inputTemplate:o.input?.template,ask:o.ask,condition:o.condition,runState:a,pending:h}}function oi(o){let a=new Map;for(let h of o)if(h.parentGroup&&h.type!=="terminal"){let A=a.get(h.parentGroup)||[];A.push(h.id),a.set(h.parentGroup,A)}return Array.from(a.entries()).map(([h,A])=>({sourceId:h,childIds:A}))}function or(){let o=ve();return(0,P.jsxs)("div",{style:{width:"100%",height:"100%",position:"relative",pointerEvents:"none"},children:[(0,P.jsx)(xe,{type:"target",position:Se.Top,style:{opacity:0}}),(0,P.jsx)(xe,{type:"source",position:Se.Bottom,style:{opacity:0}}),(0,P.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,P.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:o("chatWorkspace.workflowCanvas.parallel")})]})}function tr(o,a){let h=o.nodes,A=o.edges,s=oi(h),g=new Set(s.map(I=>I.sourceId)),p=new Set(s.flatMap(I=>I.childIds)),t=268,w=100,r=40;for(let I of s){let F=h.find(T=>T.id===I.sourceId);if(F){let T=I.childIds.length;F.width=T*t+(T-1)*r+40,F.height=w+100}}let l=h.filter(I=>!p.has(I.id)),y=an(l,A,{nodeWidth:t,nodeHeight:w,ranksep:120}),v=l.find(I=>!g.has(I.id)&&I.type!=="terminal"),O=v?y.get(v.id):void 0,K=v?v.width??t:t,M=O?O.x+K/2:0;for(let I of l){if(g.has(I.id))continue;let F=y.get(I.id);if(!F)continue;let T=I.width??t;F.x=M-T/2}let V=l.filter(I=>y.has(I.id)&&!g.has(I.id)&&I.type!=="terminal").map(I=>{let F=y.get(I.id);return{id:I.id,type:"workflow",position:F,data:{...Ze(I,void 0,void 0,a)}}});for(let I of s){let F=h.find(J=>J.id===I.sourceId),T=y.get(I.sourceId);if(!F||!T)continue;let H=F.width,q=F.height,z=I.childIds.length,j=M-H/2,B=z*t+(z-1)*r,fe=M-B/2,ue=T.y+(q-w)/2;for(let J=0;J<z;J++){let G=I.childIds[J],Q=h.find(N=>N.id===G);Q&&V.push({id:Q.id,type:"workflow",position:{x:fe+J*(t+r),y:ue},data:{...Ze(Q,void 0,void 0,a),parallelGroup:!0},style:{zIndex:2}})}let oe=`group_${I.sourceId}`;V.push({id:oe,type:"groupLabel",position:{x:j,y:T.y},data:{},selectable:!1,draggable:!1,style:{zIndex:0,width:H,height:q}})}let X=[];for(let I of A){let F=un(I);for(let T of F){let H=h.find(j=>j.id===T);if(H?.type==="terminal"&&H.name==="__end"||g.has(I.from)&&h.find(B=>B.id===T)?.parentGroup===I.from)continue;let q=g.has(I.from)?`group_${I.from}`:I.from,z=g.has(T)?`group_${T}`:T;X.push({id:`${q}-${z}`,source:q,target:z,type:"straight",markerEnd:{type:sn.ArrowClosed}})}}return{nodes:V,edges:X}}function lr(o,a,h,A){let s=o.nodes,g=o.edges,p=oi(s),t=new Set(p.map(T=>T.sourceId)),w=new Set(p.flatMap(T=>T.childIds)),r=268,l=100,y=40;for(let T of p){let H=s.find(q=>q.id===T.sourceId);if(H){let q=T.childIds.length;H.width=q*r+(q-1)*y+40,H.height=l+100}}let v=s.filter(T=>!w.has(T.id)),O=an(v,g,{nodeWidth:r,nodeHeight:l,ranksep:120}),K=v.find(T=>!t.has(T.id)&&T.type!=="terminal"),M=K?O.get(K.id):void 0,V=K?K.width??r:r,X=M?M.x+V/2:0;for(let T of v){if(t.has(T.id))continue;let H=O.get(T.id);if(!H)continue;let q=T.width??r;H.x=X-q/2}let I=v.filter(T=>O.has(T.id)&&!t.has(T.id)).map(T=>{let H=O.get(T.id),q=We(a,T),z=T.type==="terminal",j=q&&(!z||q.status!=="running")?{status:q.status,stepType:q.stepType,durationMs:q.durationMs,selected:!1}:void 0;return{id:T.id,type:"workflow",position:H,style:z?{width:r,height:l}:void 0,data:Ze(T,j,!q&&!z,A)}});for(let T of p){let H=s.find(Q=>Q.id===T.sourceId),q=O.get(T.sourceId);if(!H||!q)continue;let z=H.width,j=H.height,B=T.childIds.length,fe=B*r+(B-1)*y,ue=X-fe/2,oe=q.y+(j-l)/2;for(let Q=0;Q<B;Q++){let N=T.childIds[Q],Z=s.find(ae=>ae.id===N);if(!Z)continue;let Y=We(a,Z),Ae=Y?{status:Y.status,stepType:Y.stepType,durationMs:Y.durationMs,selected:!1}:void 0;I.push({id:Z.id,type:"workflow",position:{x:ue+Q*(r+y),y:oe},data:{...Ze(Z,Ae,!Y,A),parallelGroup:!0},style:{zIndex:2}})}let J=X-z/2,G=`group_${T.sourceId}`;I.push({id:G,type:"groupLabel",position:{x:J,y:q.y},data:{},selectable:!1,draggable:!1,style:{zIndex:0,width:z,height:j}})}let F=[];for(let T of g){let H=un(T);for(let q of H){if(t.has(T.from)&&s.find(Y=>Y.id===q)?.parentGroup===T.from)continue;let z=t.has(T.from)?`group_${T.from}`:T.from,j=t.has(q)?`group_${q}`:q,B=s.find(Z=>Z.id===T.from),ue=(B?We(a,B):void 0)!==void 0,oe=s.find(Z=>Z.id===q),G=(oe?We(a,oe):void 0)!==void 0,Q=ue&&G,N=Q?"#6366f1":"#d9d9d9";F.push({id:`${z}-${j}`,source:z,target:j,type:"straight",animated:Q,style:Q?{stroke:N,strokeWidth:2}:{stroke:N,strokeWidth:2,strokeDasharray:"6 4",opacity:.25},markerEnd:{type:sn.ArrowClosed,color:N,width:20,height:20}})}}return{nodes:I,edges:F}}var cr=({dsl:o,steps:a,assistantId:h,agentNameMap:A,onNodeClick:s,height:g="100%"})=>{let p=ve(),t=!!a,w=(0,te.useMemo)(()=>({workflow:ii,groupLabel:or}),[]),{nodes:r,edges:l}=(0,te.useMemo)(()=>t?lr(o,a,void 0,A):tr(o,A),[o,a,t,A]),[y,v,O]=$n(r),[K,M,V]=Xn(l),[X,I]=(0,te.useState)(null),F=(0,te.useMemo)(()=>{if(!t||!X)return null;let j=o.nodes.find(B=>B.id===X);return j?We(a,j):null},[o.nodes,a,X,t]);(0,te.useEffect)(()=>{v(r),M(l)},[r,l,v,M]);let T=(0,te.useCallback)(()=>{v(j=>j.map(B=>({...B,data:{...B.data,runState:B.data.runState?{...B.data.runState,selected:!1}:void 0}})))},[v]);(0,te.useEffect)(()=>{t&&v(j=>j.map(B=>({...B,data:{...B.data,runState:B.data.runState?{...B.data.runState,selected:B.id===X}:void 0}})))},[X,v,t]);let H=(0,te.useCallback)((j,B)=>{t?I(B.id):s?.(B.id)},[t,s]),q=(0,te.useCallback)(()=>{t&&(T(),I(null))},[t,T]),z=(0,te.useCallback)(()=>{T(),I(null)},[T]);return!o.nodes||o.nodes.length===0?t?(0,P.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:300},children:(0,P.jsx)(Wn,{size:"large"})}):(0,P.jsx)(Fn,{description:p("chatWorkspace.workflowCanvas.noNodes")}):(0,P.jsx)(Kn,{children:(0,P.jsx)(Vn,{nodes:y,edges:K,nodeTypes:w,onNodesChange:O,onEdgesChange:V,onNodeClick:H,onPaneClick:t?q:void 0,height:g,fitView:!0,fitViewOptions:t?{padding:.3}:void 0,minZoom:t?.3:void 0,maxZoom:t?1.5:void 0,nodesDraggable:!1,nodesConnectable:t?!1:void 0,defaultEdgeOptions:t?void 0:{style:{strokeWidth:2}},backgroundGap:t?20:void 0,miniMap:t?{nodeStrokeWidth:3,pannable:!0,zoomable:!0,style:{backgroundColor:"#f5f5f5"}}:void 0,children:t&&F&&X&&(0,P.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,P.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[(0,P.jsx)(de,{type:"secondary",style:{fontSize:11,textTransform:"uppercase",letterSpacing:.5},children:p("chatWorkspace.workflowCanvas.stepDetail")}),(0,P.jsx)(de,{type:"secondary",style:{fontSize:11,cursor:"pointer"},onClick:z,children:p("common.close")})]}),(0,P.jsx)(rr,{step:F})]})})})},Or=cr;function sr(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var ne={},Je={},be={},ti;function He(){if(ti)return be;ti=1;function o(p){return typeof p>"u"||p===null}function a(p){return typeof p=="object"&&p!==null}function h(p){return Array.isArray(p)?p:o(p)?[]:[p]}function A(p,t){if(t){let w=Object.keys(t);for(let r=0,l=w.length;r<l;r+=1){let y=w[r];p[y]=t[y]}}return p}function s(p,t){let w="";for(let r=0;r<t;r+=1)w+=p;return w}function g(p){return p===0&&Number.NEGATIVE_INFINITY===1/p}return be.isNothing=o,be.isObject=a,be.toArray=h,be.repeat=s,be.isNegativeZero=g,be.extend=A,be}var dn,li;function qe(){if(li)return dn;li=1;function o(h,A){let s="",g=h.reason||"(unknown reason)";return h.mark?(h.mark.name&&(s+='in "'+h.mark.name+'" '),s+="("+(h.mark.line+1)+":"+(h.mark.column+1)+")",!A&&h.mark.snippet&&(s+=`
1
+ import{b as un,c as an,d as Vn}from"./embed-page-chunk-BJESMNTG.js";import{a as sn,b as Se,e as xe,f as Kn,h as $n,i as Xn}from"./embed-page-chunk-QPWSDWJ2.js";import{j as cn}from"./embed-page-chunk-TJMEWCV7.js";import{A as Hn,Ba as jn,D as qn,E as Fe,F as De,Pa as Gn,Sa as Un,Z as zn,ha as Bn,ma as Yn,y as Me}from"./embed-page-chunk-BNA3NXXX.js";import{l as ve}from"./embed-page-chunk-QQZUP2A4.js";import{a as Ve}from"./embed-page-chunk-L2PNY33P.js";import{Qa as Wn,eb as ce,ia as Fn,ib as Xe,oa as Ce,pa as Dn,wa as Pn}from"./embed-page-chunk-TWJOR2LG.js";import{a as Qi}from"./embed-page-chunk-MPQBYKDM.js";import{e as Oe}from"./embed-page-chunk-45A47GH2.js";var te=Oe(Qi());var E=Oe(Ve());if(typeof document<"u"){let o="workflow-node-spin-keyframes";if(!document.getElementById(o)){let a=document.createElement("style");a.id=o,a.textContent="@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }",document.head.appendChild(a)}}var{Text:se}=Xe,Qe={opacity:0},Pe={running:{color:"#1677ff",icon:(0,E.jsx)(Yn,{size:14,style:{animation:"spin 1s linear infinite"}})},completed:{color:"#52c41a",icon:(0,E.jsx)(Me,{size:14})},failed:{color:"#ff4d4f",icon:(0,E.jsx)(Fe,{size:14})},interrupted:{color:"#faad14",icon:(0,E.jsx)(Hn,{size:14})},skipped:{color:"#8c8c8c",icon:(0,E.jsx)(De,{size:14})}},Qn={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"},Zn={color:"#d9d9d9",icon:(0,E.jsx)(De,{size:14})},Jn={agent:{color:"#6366f1",bg:"#EEF2FF",border:"#6366f1"},map:{color:"#10b981",bg:"#ECFDF5",border:"#10b981"},terminal:{color:"#64748b",bg:"#F8FAFC",border:"#94a3b8"}},ei={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 Zi(o){return(o||"?").split(/[\s_-]+/).filter(Boolean).map(a=>a[0]).join("").toUpperCase().slice(0,2)}function fn({schema:o,t:a}){let h=o;if(!h||typeof h!="object")return(0,E.jsx)(se,{type:"secondary",style:{fontSize:11},children:a("chatWorkspace.workflowNode.noSchema")});let A=h.properties,s=h.required||[],g=h.items,p=w=>w==="string"?"green":w==="number"||w==="integer"?"orange":w==="boolean"?"purple":w==="array"?"cyan":w==="object"?"blue":"default",t=w=>{let r=w.type;if(r==="array"&&w.items){let l=w.items.type;return l?`Array<${l}>`:"Array"}return r||"any"};return(0,E.jsxs)("div",{style:{maxWidth:340,maxHeight:360,overflow:"auto",fontSize:12},children:[A&&(0,E.jsxs)("div",{children:[(0,E.jsx)(se,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5,display:"block",marginBottom:6},children:a("chatWorkspace.workflowNode.properties")}),Object.entries(A).map(([w,r])=>{let l=s.includes(w),y=r.description,v=t(r),O=r.properties,K=r.items,M=!!(O||K);return(0,E.jsx)(Ce,{title:M?(0,E.jsx)(fn,{t:a,schema:M?O?r:K:void 0}):y||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:l?"rgba(99,102,241,0.04)":"transparent",cursor:M?"pointer":"default"},children:[(0,E.jsx)(se,{style:{fontSize:11,fontWeight:l?600:400,fontFamily:"monospace"},children:w}),l&&(0,E.jsx)("span",{style:{color:"#ef4444",fontSize:9},children:"*"}),y&&!M&&(0,E.jsx)(se,{type:"secondary",style:{fontSize:10,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y}),(0,E.jsx)(ce,{color:p(v),style:{margin:0,fontSize:9,padding:"0 4px",lineHeight:"16px",marginLeft:"auto"},children:v})]})},w)})]}),!A&&g&&(0,E.jsxs)("div",{children:[(0,E.jsx)(se,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5,display:"block",marginBottom:4},children:a("chatWorkspace.workflowNode.items")}),(0,E.jsx)(fn,{t:a,schema:g})]})]})}var ni=72,Ji=3,er=({data:o})=>{let a=ve();if(!o)return null;let{nodeType:h,name:A,description:s,ref:g,refAgentName:p,refAgentType:t,refDeleted:w,outputKey:r,nodeSchema:l,config:y,status:v,source:O,innerRef:K,inputTemplate:M,ask:V,condition:X,runState:I,pending:F}=o,T=Jn[h]||Jn.agent,H=ei[v||""]||ei.__default,q=I?Pe[I.status]||Pe.running:null,z=q?.color,j=q?.icon,B=v==="success"?(0,E.jsx)(Me,{size:14,color:"#22c55e"}):v==="failed"?(0,E.jsx)(Fe,{size:14,color:"#ef4444"}):(0,E.jsx)(De,{size:14,color:"#94a3b8"}),fe=v==="success"?(0,E.jsx)(Me,{size:32,color:H.color}):v==="failed"?(0,E.jsx)(Fe,{size:32,color:H.color}):(0,E.jsx)(qn,{size:32,color:H.color}),ue=y?.title,oe=y?.maxRetries,J=y?.timeout,G=y?.batchSize,Q=y?.maxConcurrency,N=y?.innerConcurrency,Z=I?.selected,Y=!!I||F;function Ae(U){return U==null?"-":U<1e3?`${U}ms`:`${(U/1e3).toFixed(1)}s`}if(h==="terminal"){let U=H.color,he=H.bg,le=a(H.label),ge=fe;Y&&(I?(U=z||U,le=I.status,ge=(0,E.jsx)("span",{style:{fontSize:18},children:j})):F&&(U=Zn.color,he="#fafafa",le=a("chatWorkspace.workflowNode.pending"),ge=(0,E.jsx)(De,{size:18,style:{color:Zn.color}})));let $=Z&&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:F?.5:1},children:[(0,E.jsx)(xe,{type:"target",position:Se.Top,style:Qe}),(0,E.jsx)(Ce,{title:Y&&I?a(Qn[I.status]):A,children:(0,E.jsx)("div",{style:{width:ni,height:ni,borderRadius:"50%",background:he,border:`${Ji}px solid ${F?`${U}80`:U}`,borderStyle:F?"dashed":"solid",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:$,transition:"all 0.2s ease",cursor:"default"},onMouseEnter:F?void 0:ee=>{ee.currentTarget.style.transform="scale(1.08)",ee.currentTarget.style.boxShadow=`0 4px 16px ${U}30`},onMouseLeave:F?void 0:ee=>{ee.currentTarget.style.transform="scale(1)",ee.currentTarget.style.boxShadow=$},children:ge})}),(0,E.jsx)(se,{style:{fontSize:11,color:U,marginTop:6,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:le}),(0,E.jsx)(xe,{type:"source",position:Se.Bottom,style:Qe})]})}let ae=Y&&z?z:T.border,Ie=Y&&z?z:T.color,ke=h==="agent"?(0,E.jsx)(Un,{size:14}):h==="map"?(0,E.jsx)(jn,{size:14}):Zi(A),pe=I?Ae(I.durationMs):null,Te=Z&&z?`0 4px 14px ${z}20`:"0 1px 6px rgba(0,0,0,0.08)",ie=Y&&z?z:T.color;return(0,E.jsxs)("div",{style:{padding:4},children:[(0,E.jsx)(xe,{type:"target",position:Se.Top,style:Qe}),(0,E.jsxs)("div",{style:{width:260,minHeight:90,boxSizing:"border-box",background:"#fff",borderRadius:12,boxShadow:Te,border:"1px solid #e5e7eb",borderLeft:`3px solid ${ae}`,borderStyle:g?"dashed":"solid",overflow:"hidden",transition:"all 0.2s ease",...F?{opacity:.5,borderStyle:"dashed"}:{}},onMouseEnter:F?void 0:U=>{U.currentTarget.style.transform="translateY(-2px)",U.currentTarget.style.boxShadow=`0 4px 12px ${ie}20`},onMouseLeave:F?void 0:U=>{U.currentTarget.style.transform="translateY(0)",U.currentTarget.style.boxShadow=Te},children:[(0,E.jsxs)("div",{style:{background:T.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:Ie,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:600,flexShrink:0},children:ke}),(0,E.jsx)("div",{style:{flex:1,minWidth:0},children:(0,E.jsx)(se,{strong:!0,style:{fontSize:12,color:T.color},ellipsis:{tooltip:A},children:A})}),Y&&j&&(0,E.jsx)(Ce,{title:I?a(Qn[I.status]):void 0,children:(0,E.jsx)("span",{style:{color:z,fontSize:12,display:"flex",flexShrink:0},children:j})})]}),(0,E.jsxs)("div",{style:{padding:"10px 12px"},children:[s&&(0,E.jsx)(se,{type:"secondary",style:{fontSize:11,display:"block",marginTop:2,lineHeight:1.4},ellipsis:{tooltip:s},children:s}),h==="map"&&O&&(0,E.jsxs)(se,{type:"secondary",style:{fontSize:11,display:"block",marginTop:4,lineHeight:1.4,color:T.color,background:T.bg,padding:"2px 6px",borderRadius:4,maxHeight:32,overflow:"hidden"},ellipsis:{tooltip:O},children:["\u2190 ",O]}),h!=="map"&&M&&(0,E.jsx)(se,{type:"secondary",style:{fontSize:11,display:"block",marginTop:4,lineHeight:1.4,color:T.color,background:T.bg,padding:"2px 6px",borderRadius:4,maxHeight:32,overflow:"hidden"},ellipsis:{tooltip:M},children:M}),(0,E.jsxs)("div",{style:{display:"flex",gap:4,marginTop:6,flexWrap:"wrap"},children:[!Y&&h==="agent"&&g&&(0,E.jsx)(Ce,{title:w?a("chatWorkspace.workflowNode.refDeleted",{ref:g}):a("chatWorkspace.workflowNode.refDelegated",{name:p??g}),children:(0,E.jsx)(ce,{color:w?"red":"purple",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},icon:(0,E.jsx)(Bn,{size:10}),children:w?a("chatWorkspace.workflowNode.refDeletedTag",{ref:g}):`\u2192 ${p??g}`})}),!Y&&h==="agent"&&!g&&(0,E.jsx)(ce,{color:"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:a("chatWorkspace.workflowNode.inline")}),V&&(0,E.jsx)(Ce,{title:a("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)(Gn,{size:12,style:{color:"#fa8c16"}})})}),X&&(0,E.jsx)(Ce,{title:a("chatWorkspace.workflowNode.when",{condition:X}),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)(zn,{size:12,style:{color:"#2f54eb"}})})}),!Y&&h==="map"&&K&&(0,E.jsx)(ce,{color:"purple",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:K}),!Y&&h==="map"&&M&&(0,E.jsx)(ce,{color:"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px",maxWidth:120},title:M,children:M.length>20?M.slice(0,18)+"\u2026":M}),!Y&&h==="map"&&(G||Q||N)&&(0,E.jsxs)(ce,{color:"cyan",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:[G??50,"\xD7",Q??10,"\xD7",N??5]}),!Y&&oe?(0,E.jsxs)(ce,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:["\u21BB ",oe]}):null,!Y&&J?(0,E.jsxs)(ce,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:["\u23F1 ",J,"s"]}):null,pe&&(0,E.jsx)(ce,{color:I?"blue":"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:pe}),r&&(0,E.jsx)("span",{style:{marginLeft:"auto"}}),r&&(0,E.jsx)(Dn,{trigger:"hover",placement:"right",mouseEnterDelay:.2,title:(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,E.jsx)(se,{strong:!0,style:{fontSize:12},children:a("chatWorkspace.workflowNode.output")}),(0,E.jsx)(se,{style:{fontSize:11,fontFamily:"monospace",color:"#6366f1"},children:r})]}),content:l?(0,E.jsx)(fn,{t:a,schema:l}):(0,E.jsx)(se,{type:"secondary",style:{fontSize:11},children:a("chatWorkspace.workflowNode.noSchema")}),children:(0,E.jsxs)(ce,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px",flexShrink:0,cursor:"default"},children:["\u2192 ",r]})})]})]})]}),(0,E.jsx)(xe,{type:"source",position:Se.Bottom,style:Qe})]})},ii=er;var P=Oe(Ve()),{Text:de}=Xe;function ri(o){return new Date(o).toLocaleString()}function nr(o){return o.input?typeof o.input.rendered=="string"?o.input.rendered:typeof o.input.description=="string"?o.input.description:JSON.stringify(o.input,null,2):null}function ir(o){return o.output?typeof o.output.result=="string"?o.output.result:typeof o.output=="object"?JSON.stringify(o.output,null,2):String(o.output):null}function rr({step:o}){let a=ve(),h=nr(o),A=ir(o),s=Pe[o.status]||Pe.running,g=[{key:"io",label:a("chatWorkspace.workflowCanvas.tabIo"),children:(0,P.jsxs)(P.Fragment,{children:[h&&(0,P.jsxs)("div",{style:{marginBottom:A?12:0},children:[(0,P.jsx)(de,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:a("chatWorkspace.workflowCanvas.input")}),(0,P.jsx)("div",{style:{background:"rgba(0,0,0,0.02)",borderRadius:8,padding:"8px 10px",marginTop:4,maxHeight:200,overflow:"auto"},children:o.input?.description?(0,P.jsx)(cn,{content:h}):(0,P.jsx)("pre",{style:{margin:0,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace"},children:h})})]}),A&&(0,P.jsxs)("div",{children:[(0,P.jsx)(de,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:a("chatWorkspace.workflowCanvas.output")}),(0,P.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:o.output?.result?(0,P.jsx)(cn,{content:A}):(0,P.jsx)("pre",{style:{margin:0,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace"},children:A})})]}),!h&&!A&&(0,P.jsx)(de,{type:"secondary",style:{fontSize:11},children:a("chatWorkspace.workflowCanvas.noIo")})]})}];return(0,P.jsxs)("div",{style:{maxWidth:480},children:[(0,P.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[(0,P.jsx)("span",{style:{color:s.color,fontSize:14},children:s.icon}),(0,P.jsx)(de,{strong:!0,style:{fontSize:14},children:o.stepName}),(0,P.jsx)(ce,{color:"purple",style:{fontSize:11},children:o.stepType})]}),o.edgePurpose&&(0,P.jsx)("div",{style:{marginBottom:10},children:(0,P.jsx)(de,{type:"secondary",style:{fontSize:11},children:a("chatWorkspace.workflowCanvas.purpose",{purpose:o.edgePurpose})})}),o.errorMessage&&(0,P.jsx)("div",{style:{background:"#FEF2F2",border:"1px solid #FECACA",borderRadius:8,padding:"8px 12px",marginBottom:12,overflow:"hidden"},children:(0,P.jsx)(de,{type:"danger",style:{fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:o.errorMessage})}),(0,P.jsx)(Pn,{activeKey:"io",items:g,size:"small",style:{marginBottom:-8}}),(0,P.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginTop:12,paddingTop:8,borderTop:"1px solid #f0f0f0"},children:[(0,P.jsx)(de,{type:"secondary",style:{fontSize:10},children:a("chatWorkspace.workflowCanvas.started",{time:ri(o.startedAt)})}),o.completedAt&&(0,P.jsx)(de,{type:"secondary",style:{fontSize:10},children:a("chatWorkspace.workflowCanvas.ended",{time:ri(o.completedAt)})})]})]})}function We(o,a){return o.find(h=>h.stepName===a.name)??null}function Ze(o,a,h,A){let s=o.ref&&A?A.get(o.ref):void 0;return{nodeType:o.type,name:o.name,description:o.description,ref:o.ref,refAgentName:s?.name,refAgentType:s?.type,refDeleted:o.ref&&A?!s:void 0,outputKey:o.output?.key,nodeSchema:o.output?.schema,config:o.config,status:o.status,source:o.source,innerRef:o.node?.ref,inputTemplate:o.input?.template,ask:o.ask,condition:o.condition,runState:a,pending:h}}function oi(o){let a=new Map;for(let h of o)if(h.parentGroup&&h.type!=="terminal"){let A=a.get(h.parentGroup)||[];A.push(h.id),a.set(h.parentGroup,A)}return Array.from(a.entries()).map(([h,A])=>({sourceId:h,childIds:A}))}function or(){let o=ve();return(0,P.jsxs)("div",{style:{width:"100%",height:"100%",position:"relative",pointerEvents:"none"},children:[(0,P.jsx)(xe,{type:"target",position:Se.Top,style:{opacity:0}}),(0,P.jsx)(xe,{type:"source",position:Se.Bottom,style:{opacity:0}}),(0,P.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,P.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:o("chatWorkspace.workflowCanvas.parallel")})]})}function tr(o,a){let h=o.nodes,A=o.edges,s=oi(h),g=new Set(s.map(I=>I.sourceId)),p=new Set(s.flatMap(I=>I.childIds)),t=268,w=100,r=40;for(let I of s){let F=h.find(T=>T.id===I.sourceId);if(F){let T=I.childIds.length;F.width=T*t+(T-1)*r+40,F.height=w+100}}let l=h.filter(I=>!p.has(I.id)),y=an(l,A,{nodeWidth:t,nodeHeight:w,ranksep:120}),v=l.find(I=>!g.has(I.id)&&I.type!=="terminal"),O=v?y.get(v.id):void 0,K=v?v.width??t:t,M=O?O.x+K/2:0;for(let I of l){if(g.has(I.id))continue;let F=y.get(I.id);if(!F)continue;let T=I.width??t;F.x=M-T/2}let V=l.filter(I=>y.has(I.id)&&!g.has(I.id)&&I.type!=="terminal").map(I=>{let F=y.get(I.id);return{id:I.id,type:"workflow",position:F,data:{...Ze(I,void 0,void 0,a)}}});for(let I of s){let F=h.find(J=>J.id===I.sourceId),T=y.get(I.sourceId);if(!F||!T)continue;let H=F.width,q=F.height,z=I.childIds.length,j=M-H/2,B=z*t+(z-1)*r,fe=M-B/2,ue=T.y+(q-w)/2;for(let J=0;J<z;J++){let G=I.childIds[J],Q=h.find(N=>N.id===G);Q&&V.push({id:Q.id,type:"workflow",position:{x:fe+J*(t+r),y:ue},data:{...Ze(Q,void 0,void 0,a),parallelGroup:!0},style:{zIndex:2}})}let oe=`group_${I.sourceId}`;V.push({id:oe,type:"groupLabel",position:{x:j,y:T.y},data:{},selectable:!1,draggable:!1,style:{zIndex:0,width:H,height:q}})}let X=[];for(let I of A){let F=un(I);for(let T of F){let H=h.find(j=>j.id===T);if(H?.type==="terminal"&&H.name==="__end"||g.has(I.from)&&h.find(B=>B.id===T)?.parentGroup===I.from)continue;let q=g.has(I.from)?`group_${I.from}`:I.from,z=g.has(T)?`group_${T}`:T;X.push({id:`${q}-${z}`,source:q,target:z,type:"straight",markerEnd:{type:sn.ArrowClosed}})}}return{nodes:V,edges:X}}function lr(o,a,h,A){let s=o.nodes,g=o.edges,p=oi(s),t=new Set(p.map(T=>T.sourceId)),w=new Set(p.flatMap(T=>T.childIds)),r=268,l=100,y=40;for(let T of p){let H=s.find(q=>q.id===T.sourceId);if(H){let q=T.childIds.length;H.width=q*r+(q-1)*y+40,H.height=l+100}}let v=s.filter(T=>!w.has(T.id)),O=an(v,g,{nodeWidth:r,nodeHeight:l,ranksep:120}),K=v.find(T=>!t.has(T.id)&&T.type!=="terminal"),M=K?O.get(K.id):void 0,V=K?K.width??r:r,X=M?M.x+V/2:0;for(let T of v){if(t.has(T.id))continue;let H=O.get(T.id);if(!H)continue;let q=T.width??r;H.x=X-q/2}let I=v.filter(T=>O.has(T.id)&&!t.has(T.id)).map(T=>{let H=O.get(T.id),q=We(a,T),z=T.type==="terminal",j=q&&(!z||q.status!=="running")?{status:q.status,stepType:q.stepType,durationMs:q.durationMs,selected:!1}:void 0;return{id:T.id,type:"workflow",position:H,style:z?{width:r,height:l}:void 0,data:Ze(T,j,!q&&!z,A)}});for(let T of p){let H=s.find(Q=>Q.id===T.sourceId),q=O.get(T.sourceId);if(!H||!q)continue;let z=H.width,j=H.height,B=T.childIds.length,fe=B*r+(B-1)*y,ue=X-fe/2,oe=q.y+(j-l)/2;for(let Q=0;Q<B;Q++){let N=T.childIds[Q],Z=s.find(ae=>ae.id===N);if(!Z)continue;let Y=We(a,Z),Ae=Y?{status:Y.status,stepType:Y.stepType,durationMs:Y.durationMs,selected:!1}:void 0;I.push({id:Z.id,type:"workflow",position:{x:ue+Q*(r+y),y:oe},data:{...Ze(Z,Ae,!Y,A),parallelGroup:!0},style:{zIndex:2}})}let J=X-z/2,G=`group_${T.sourceId}`;I.push({id:G,type:"groupLabel",position:{x:J,y:q.y},data:{},selectable:!1,draggable:!1,style:{zIndex:0,width:z,height:j}})}let F=[];for(let T of g){let H=un(T);for(let q of H){if(t.has(T.from)&&s.find(Y=>Y.id===q)?.parentGroup===T.from)continue;let z=t.has(T.from)?`group_${T.from}`:T.from,j=t.has(q)?`group_${q}`:q,B=s.find(Z=>Z.id===T.from),ue=(B?We(a,B):void 0)!==void 0,oe=s.find(Z=>Z.id===q),G=(oe?We(a,oe):void 0)!==void 0,Q=ue&&G,N=Q?"#6366f1":"#d9d9d9";F.push({id:`${z}-${j}`,source:z,target:j,type:"straight",animated:Q,style:Q?{stroke:N,strokeWidth:2}:{stroke:N,strokeWidth:2,strokeDasharray:"6 4",opacity:.25},markerEnd:{type:sn.ArrowClosed,color:N,width:20,height:20}})}}return{nodes:I,edges:F}}var cr=({dsl:o,steps:a,assistantId:h,agentNameMap:A,onNodeClick:s,height:g="100%"})=>{let p=ve(),t=!!a,w=(0,te.useMemo)(()=>({workflow:ii,groupLabel:or}),[]),{nodes:r,edges:l}=(0,te.useMemo)(()=>t?lr(o,a,void 0,A):tr(o,A),[o,a,t,A]),[y,v,O]=$n(r),[K,M,V]=Xn(l),[X,I]=(0,te.useState)(null),F=(0,te.useMemo)(()=>{if(!t||!X)return null;let j=o.nodes.find(B=>B.id===X);return j?We(a,j):null},[o.nodes,a,X,t]);(0,te.useEffect)(()=>{v(r),M(l)},[r,l,v,M]);let T=(0,te.useCallback)(()=>{v(j=>j.map(B=>({...B,data:{...B.data,runState:B.data.runState?{...B.data.runState,selected:!1}:void 0}})))},[v]);(0,te.useEffect)(()=>{t&&v(j=>j.map(B=>({...B,data:{...B.data,runState:B.data.runState?{...B.data.runState,selected:B.id===X}:void 0}})))},[X,v,t]);let H=(0,te.useCallback)((j,B)=>{t?I(B.id):s?.(B.id)},[t,s]),q=(0,te.useCallback)(()=>{t&&(T(),I(null))},[t,T]),z=(0,te.useCallback)(()=>{T(),I(null)},[T]);return!o.nodes||o.nodes.length===0?t?(0,P.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:300},children:(0,P.jsx)(Wn,{size:"large"})}):(0,P.jsx)(Fn,{description:p("chatWorkspace.workflowCanvas.noNodes")}):(0,P.jsx)(Kn,{children:(0,P.jsx)(Vn,{nodes:y,edges:K,nodeTypes:w,onNodesChange:O,onEdgesChange:V,onNodeClick:H,onPaneClick:t?q:void 0,height:g,fitView:!0,fitViewOptions:t?{padding:.3}:void 0,minZoom:t?.3:void 0,maxZoom:t?1.5:void 0,nodesDraggable:!1,nodesConnectable:t?!1:void 0,defaultEdgeOptions:t?void 0:{style:{strokeWidth:2}},backgroundGap:t?20:void 0,miniMap:t?{nodeStrokeWidth:3,pannable:!0,zoomable:!0,style:{backgroundColor:"#f5f5f5"}}:void 0,children:t&&F&&X&&(0,P.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,P.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[(0,P.jsx)(de,{type:"secondary",style:{fontSize:11,textTransform:"uppercase",letterSpacing:.5},children:p("chatWorkspace.workflowCanvas.stepDetail")}),(0,P.jsx)(de,{type:"secondary",style:{fontSize:11,cursor:"pointer"},onClick:z,children:p("common.close")})]}),(0,P.jsx)(rr,{step:F})]})})})},Or=cr;function sr(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var ne={},Je={},be={},ti;function He(){if(ti)return be;ti=1;function o(p){return typeof p>"u"||p===null}function a(p){return typeof p=="object"&&p!==null}function h(p){return Array.isArray(p)?p:o(p)?[]:[p]}function A(p,t){if(t){let w=Object.keys(t);for(let r=0,l=w.length;r<l;r+=1){let y=w[r];p[y]=t[y]}}return p}function s(p,t){let w="";for(let r=0;r<t;r+=1)w+=p;return w}function g(p){return p===0&&Number.NEGATIVE_INFINITY===1/p}return be.isNothing=o,be.isObject=a,be.toArray=h,be.repeat=s,be.isNegativeZero=g,be.extend=A,be}var dn,li;function qe(){if(li)return dn;li=1;function o(h,A){let s="",g=h.reason||"(unknown reason)";return h.mark?(h.mark.name&&(s+='in "'+h.mark.name+'" '),s+="("+(h.mark.line+1)+":"+(h.mark.column+1)+")",!A&&h.mark.snippet&&(s+=`
2
2
 
3
3
  `+h.mark.snippet),g+" "+s):g}function a(h,A){Error.call(this),this.name="YAMLException",this.reason=h,this.mark=A,this.message=o(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a.prototype.toString=function(A){return this.name+": "+o(this,A)},dn=a,dn}var pn,ci;function ur(){if(ci)return pn;ci=1;let o=He();function a(s,g,p,t,w){let r="",l="",y=Math.floor(w/2)-1;return t-g>y&&(r=" ... ",g=t-y+r.length),p-t>y&&(l=" ...",p=t+y-l.length),{str:r+s.slice(g,p).replace(/\t/g,"\u2192")+l,pos:t-g+r.length}}function h(s,g){return o.repeat(" ",g-s.length)+s}function A(s,g){if(g=Object.create(g||null),!s.buffer)return null;g.maxLength||(g.maxLength=79),typeof g.indent!="number"&&(g.indent=1),typeof g.linesBefore!="number"&&(g.linesBefore=3),typeof g.linesAfter!="number"&&(g.linesAfter=2);let p=/\r?\n|\r|\0/g,t=[0],w=[],r,l=-1;for(;r=p.exec(s.buffer);)w.push(r.index),t.push(r.index+r[0].length),s.position<=r.index&&l<0&&(l=t.length-2);l<0&&(l=t.length-1);let y="",v=Math.min(s.line+g.linesAfter,w.length).toString().length,O=g.maxLength-(g.indent+v+3);for(let M=1;M<=g.linesBefore&&!(l-M<0);M++){let V=a(s.buffer,t[l-M],w[l-M],s.position-(t[l]-t[l-M]),O);y=o.repeat(" ",g.indent)+h((s.line-M+1).toString(),v)+" | "+V.str+`
4
4
  `+y}let K=a(s.buffer,t[l],w[l],s.position,O);y+=o.repeat(" ",g.indent)+h((s.line+1).toString(),v)+" | "+K.str+`
@@ -1,4 +1,4 @@
1
- import{a as gr,b as Pn}from"./embed-page-chunk-GXHZDCWF.js";import{b as qi,c as $i}from"./embed-page-chunk-GMLPPJZP.js";import{a as Io}from"./embed-page-chunk-4T3AWQQQ.js";import{c as xo,d as To}from"./embed-page-chunk-BJESMNTG.js";import{b as st,c as Li,d as ko,e as xt,f as wo,g as Mi,h as Cn,i as Sn,j as Ni,l as Oi,m as Fi}from"./embed-page-chunk-QPWSDWJ2.js";import{a as pn}from"./embed-page-chunk-U6PURUXV.js";import{a as Ki,b as Hi}from"./embed-page-chunk-JRGR5W3C.js";import{J as _i,K as Ro,L as Co,M as So,N as Wi,O as Ao,P as zi,Q as Bi,R as Po,S as ji,T as An,V as pr,W as Gi,b as Ci,d as mo,e as Si,f as yo,g as vo,j as Rn,o as In,p as ho,q as Ai,t as Pi,u as Ei,v as Di,w as bo}from"./embed-page-chunk-KJTJI54Q.js";import{g as Ii,i as Lt}from"./embed-page-chunk-5UOSSN26.js";import{a as et}from"./embed-page-chunk-T2GL7G2Z.js";import{b as Yr,j as Xr,l as Jr,o as yt,t as co}from"./embed-page-chunk-U3XF7MHJ.js";import{Da as wi,H as ci,J as ui,La as xi,N as pi,Q as gi,S as fi,Sa as fo,Ta as Ti,U as go,Ua as Ri,ba as mi,g as si,m as li,n as Gn,ra as yi,sa as vi,ta as hi,va as bi,wa as ki,z as di}from"./embed-page-chunk-BNA3NXXX.js";import{l as _}from"./embed-page-chunk-PNJ7DZ5V.js";import{a as z}from"./embed-page-chunk-L2PNY33P.js";import{B as ni,G as uo,Ja as Dt,Oa as ri,P as Tn,Q as oi,Qa as ii,Ra as cr,Sa as ur,bb as ai,ea as dr,i as ei,s as ti,sa as po,z as jn}from"./embed-page-chunk-7TINC3YA.js";import{Ca as Ur,Fa as Zr,Ga as Et,Ka as fe,Pa as _e,Qa as wt,Ta as Be,ba as Pt,db as lo,eb as He,fa as Z,fb as Vr,ha as Ve,ia as Gt,ib as Ge,kb as Qr,ma as at,oa as Jt,qa as sr,ra as lr,wa as Hr,za as un}from"./embed-page-chunk-TWJOR2LG.js";import{a as Pe}from"./embed-page-chunk-MPQBYKDM.js";import{e as I}from"./embed-page-chunk-45A47GH2.js";var Hs={react:{label:"capability",color:"blue"},capability:{label:"capability",color:"blue"},deep_agent:{label:"orchestrator",color:"orange"},orchestrator:{label:"orchestrator",color:"orange"},processing:{label:"workflow",color:"purple"},workflow:{label:"workflow",color:"purple"},a2a_remote:{label:"remote",color:"cyan"},remote:{label:"remote",color:"cyan"}};function En(e){return Hs[e]??{label:"capability",color:"blue"}}var Us={enabled:"green",draft:"orange",disabled:"default"};function Zi(e){return Us[e]??"default"}var Ui={blue:"#3b82f6",orange:"#f59e0b",green:"#22c55e",purple:"#a855f7",cyan:"#06b6d4"};function Kn(e){return Ui[e]??Ui.cyan}function Yd(e){let t={enabled:"#22c55e",draft:"#f59e0b",disabled:"#d9d9d9"};return t[e]??t.disabled}function Dn(e){return typeof e.graphDefinition=="object"&&e.graphDefinition!==null?e.graphDefinition:{}}function mr(e){return((Dn(e).metadata??{}).tags??"").split(",").map(r=>r.trim()).filter(Boolean)}function yr(e){let o=(Dn(e).metadata??{}).version;return o?o.startsWith("v")?o:`v${o}`:"v1"}function vr(e){let o=(Dn(e).metadata??{}).status??"enabled";return o==="draft"||o==="disabled"?o:"enabled"}function fr(e){let n=Dn(e).subAgents??[],o=Array.isArray(n)?n.filter(Boolean):[];return Array.from(new Set(o))}function Xd(e){return e.map(t=>{let n=Dn(t),o=String(n.type??"react");return{id:t.id,name:t.name,description:t.description,type:En(o).label,tags:mr(t),version:yr(t),status:vr(t),subAgents:fr(t)}})}function Jd(e){let t=new Set(e.map(r=>r.id)),n=e.map(r=>({id:r.id,label:r.name,type:En(String(Dn(r).type??"react")).label,subAgentCount:fr(r).length})),o=[];for(let r of e)for(let i of fr(r))t.has(i)&&o.push({source:r.id,target:i});return{nodes:n,edges:o}}var Ee=I(Pe());var te=I(Pe());var k=I(z()),{TextArea:Zs}=_e,{Text:Tt}=Ge,Vi=["data","execution","workflow","assistant"],Qi={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"},Vs={react:"chatConfig.agentPanel.typeDesc.react",deep_agent:"chatConfig.agentPanel.typeDesc.deepAgent"},qn=(e,t)=>{if(Array.isArray(e)){let n=e.map(o=>qn(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,qn(o,n)])):e},Yi=e=>{if(typeof e!="string")return qn(e??null);try{return qn(JSON.parse(e))}catch{return e}},Xi=e=>JSON.stringify(qn({...e,tools:[...e.tools].sort(),subAgents:[...e.subAgents].sort()})),Qs=Ii(({token:e,css:t})=>({modalBody:t`
1
+ import{a as gr,b as Pn}from"./embed-page-chunk-JAZH5PLN.js";import{b as qi,c as $i}from"./embed-page-chunk-43ZJCYNA.js";import{a as Io}from"./embed-page-chunk-YI3NKQSA.js";import{c as xo,d as To}from"./embed-page-chunk-BJESMNTG.js";import{b as st,c as Li,d as ko,e as xt,f as wo,g as Mi,h as Cn,i as Sn,j as Ni,l as Oi,m as Fi}from"./embed-page-chunk-QPWSDWJ2.js";import{a as pn}from"./embed-page-chunk-U6PURUXV.js";import{a as Ki,b as Hi}from"./embed-page-chunk-GWB56NNU.js";import{J as _i,K as Ro,L as Co,M as So,N as Wi,O as Ao,P as zi,Q as Bi,R as Po,S as ji,T as An,V as pr,W as Gi,b as Ci,d as mo,e as Si,f as yo,g as vo,j as Rn,o as In,p as ho,q as Ai,t as Pi,u as Ei,v as Di,w as bo}from"./embed-page-chunk-TJMEWCV7.js";import{g as Ii,i as Lt}from"./embed-page-chunk-S2G53SSD.js";import{a as et}from"./embed-page-chunk-FUNZXEPN.js";import{b as Yr,j as Xr,l as Jr,o as yt,t as co}from"./embed-page-chunk-XP37R2JT.js";import{Da as wi,H as ci,J as ui,La as xi,N as pi,Q as gi,S as fi,Sa as fo,Ta as Ti,U as go,Ua as Ri,ba as mi,g as si,m as li,n as Gn,ra as yi,sa as vi,ta as hi,va as bi,wa as ki,z as di}from"./embed-page-chunk-BNA3NXXX.js";import{l as _}from"./embed-page-chunk-QQZUP2A4.js";import{a as z}from"./embed-page-chunk-L2PNY33P.js";import{B as ni,G as uo,Ja as Dt,Oa as ri,P as Tn,Q as oi,Qa as ii,Ra as cr,Sa as ur,bb as ai,ea as dr,i as ei,s as ti,sa as po,z as jn}from"./embed-page-chunk-7TINC3YA.js";import{Ca as Ur,Fa as Zr,Ga as Et,Ka as fe,Pa as _e,Qa as wt,Ta as Be,ba as Pt,db as lo,eb as He,fa as Z,fb as Vr,ha as Ve,ia as Gt,ib as Ge,kb as Qr,ma as at,oa as Jt,qa as sr,ra as lr,wa as Hr,za as un}from"./embed-page-chunk-TWJOR2LG.js";import{a as Pe}from"./embed-page-chunk-MPQBYKDM.js";import{e as I}from"./embed-page-chunk-45A47GH2.js";var Hs={react:{label:"capability",color:"blue"},capability:{label:"capability",color:"blue"},deep_agent:{label:"orchestrator",color:"orange"},orchestrator:{label:"orchestrator",color:"orange"},processing:{label:"workflow",color:"purple"},workflow:{label:"workflow",color:"purple"},a2a_remote:{label:"remote",color:"cyan"},remote:{label:"remote",color:"cyan"}};function En(e){return Hs[e]??{label:"capability",color:"blue"}}var Us={enabled:"green",draft:"orange",disabled:"default"};function Zi(e){return Us[e]??"default"}var Ui={blue:"#3b82f6",orange:"#f59e0b",green:"#22c55e",purple:"#a855f7",cyan:"#06b6d4"};function Kn(e){return Ui[e]??Ui.cyan}function Yd(e){let t={enabled:"#22c55e",draft:"#f59e0b",disabled:"#d9d9d9"};return t[e]??t.disabled}function Dn(e){return typeof e.graphDefinition=="object"&&e.graphDefinition!==null?e.graphDefinition:{}}function mr(e){return((Dn(e).metadata??{}).tags??"").split(",").map(r=>r.trim()).filter(Boolean)}function yr(e){let o=(Dn(e).metadata??{}).version;return o?o.startsWith("v")?o:`v${o}`:"v1"}function vr(e){let o=(Dn(e).metadata??{}).status??"enabled";return o==="draft"||o==="disabled"?o:"enabled"}function fr(e){let n=Dn(e).subAgents??[],o=Array.isArray(n)?n.filter(Boolean):[];return Array.from(new Set(o))}function Xd(e){return e.map(t=>{let n=Dn(t),o=String(n.type??"react");return{id:t.id,name:t.name,description:t.description,type:En(o).label,tags:mr(t),version:yr(t),status:vr(t),subAgents:fr(t)}})}function Jd(e){let t=new Set(e.map(r=>r.id)),n=e.map(r=>({id:r.id,label:r.name,type:En(String(Dn(r).type??"react")).label,subAgentCount:fr(r).length})),o=[];for(let r of e)for(let i of fr(r))t.has(i)&&o.push({source:r.id,target:i});return{nodes:n,edges:o}}var Ee=I(Pe());var te=I(Pe());var k=I(z()),{TextArea:Zs}=_e,{Text:Tt}=Ge,Vi=["data","execution","workflow","assistant"],Qi={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"},Vs={react:"chatConfig.agentPanel.typeDesc.react",deep_agent:"chatConfig.agentPanel.typeDesc.deepAgent"},qn=(e,t)=>{if(Array.isArray(e)){let n=e.map(o=>qn(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,qn(o,n)])):e},Yi=e=>{if(typeof e!="string")return qn(e??null);try{return qn(JSON.parse(e))}catch{return e}},Xi=e=>JSON.stringify(qn({...e,tools:[...e.tools].sort(),subAgents:[...e.subAgents].sort()})),Qs=Ii(({token:e,css:t})=>({modalBody:t`
2
2
  padding: 0;
3
3
  height: 92vh;
4
4
  width: 100%;
@@ -1 +1 @@
1
- import{c as P,o as V}from"./embed-page-chunk-U3XF7MHJ.js";import{l as _}from"./embed-page-chunk-PNJ7DZ5V.js";import{a as j}from"./embed-page-chunk-L2PNY33P.js";import{Ja as G}from"./embed-page-chunk-7TINC3YA.js";import{Ga as q,Ka as y,Pa as C,Ta as U,fa as R,fb as O,ha as M,ib as L}from"./embed-page-chunk-TWJOR2LG.js";import{a as D}from"./embed-page-chunk-MPQBYKDM.js";import{e as w}from"./embed-page-chunk-45A47GH2.js";var d=w(D());function W(f){let k=V("__GLOBAL__"),[b,a]=(0,d.useState)(!1),[x,m]=(0,d.useState)(null),S=(0,d.useCallback)(()=>{f?.onUnauthorized?f.onUnauthorized():window.dispatchEvent(new CustomEvent("lattice:unauthorized"))},[f?.onUnauthorized]),s=(0,d.useCallback)(async(i,l,n,u)=>{a(!0),m(null);try{return await k.request(l,{method:i,body:n,headers:u?.headers})}catch(v){throw v instanceof P&&S(),m(v),v}finally{a(!1)}},[k,S]),z=(0,d.useCallback)((i,l)=>s("GET",i,void 0,l),[s]),I=(0,d.useCallback)((i,l,n)=>s("POST",i,l,n),[s]),r=(0,d.useCallback)((i,l,n)=>s("PUT",i,l,n),[s]),t=(0,d.useCallback)((i,l)=>s("DELETE",i,void 0,l),[s]);return{get:z,post:I,put:r,del:t,isLoading:b,error:x}}var T=w(D());var e=w(j()),{TextArea:$}=C,{Text:h}=L,J=({open:f,onCancel:k,onSuccess:b,skill:a})=>{let{message:x}=M.useApp(),[m]=y.useForm(),[S,s]=(0,T.useState)(!1),{post:z,put:I}=W(),{token:r}=O.useToken(),t=_(),i=!!a,l=[{key:"category",value:"global"}],[n,u]=(0,T.useState)(l);(0,T.useEffect)(()=>{f&&a?(m.setFieldsValue({name:a.name,description:a.description,license:a.license||"",compatibility:a.compatibility||"",content:a.content||""}),a.metadata?u(Object.entries(a.metadata).map(([o,c])=>({key:o,value:c}))):u(l)):f&&!a&&(m.resetFields(),u(l))},[f,a]);let v=async()=>{try{let o=await m.validateFields();s(!0);let c=n.length>0?n.reduce((B,F)=>(F.key&&(B[F.key]=F.value),B),{}):void 0,p={id:o.name,name:o.name,description:o.description,license:o.license||void 0,compatibility:o.compatibility||void 0,metadata:c,content:o.content||void 0,subSkills:void 0},g;i?g=await I(`/api/skills/${a.id}`,p):g=await z("/api/skills",p),g.success?(x.success(t(i?"chatConfig.skill.updated":"chatConfig.skill.created")),m.resetFields(),u(l),b?.(),k()):x.error(g.message||t(i?"chatConfig.skill.updateFailed":"chatConfig.skill.createFailed"))}catch(o){if(o.errorFields)return;x.error(o.message||t(i?"chatConfig.skill.updateError":"chatConfig.skill.createError"))}finally{s(!1)}},A=()=>{m.resetFields(),u(l),k()},E=(o,c,p)=>{let g=[...n];g[o]={...g[o],[c]:p},u(g)},H=()=>{u([...n,{key:"",value:""}])};return(0,e.jsx)(U,{title:t(i?"chatConfig.skill.edit.title":"chatConfig.skill.create.title"),open:f,onCancel:A,footer:null,width:520,destroyOnClose:!0,styles:{body:{padding:16}},children:(0,e.jsx)(y,{form:m,layout:"vertical",onFinish:v,autoComplete:"off",children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.name")}),(0,e.jsx)(y.Item,{name:"name",rules:[{required:!0,message:t("chatConfig.skill.validation.nameRequired")},{pattern:/^[a-z0-9]+(-[a-z0-9]+)*$/,message:t("chatConfig.skill.validation.namePattern")},{min:1,max:64,message:t("chatConfig.skill.validation.nameLength")}],style:{marginBottom:0},children:(0,e.jsx)(C,{placeholder:"e.g., data-analysis",disabled:i})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.description")}),(0,e.jsx)(y.Item,{name:"description",rules:[{required:!0,message:t("chatConfig.skill.validation.descriptionRequired")}],style:{marginBottom:0},children:(0,e.jsx)($,{placeholder:t("chatConfig.skill.placeholder.description"),autoSize:{minRows:2,maxRows:4}})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.license")}),(0,e.jsx)(y.Item,{name:"license",style:{marginBottom:0},children:(0,e.jsx)(C,{placeholder:t("chatConfig.skill.placeholder.license")})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.compatibility")}),(0,e.jsx)(y.Item,{name:"compatibility",style:{marginBottom:0},children:(0,e.jsx)(C,{placeholder:t("chatConfig.skill.placeholder.compatibility")})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary,fontWeight:500},children:t("chatConfig.skill.field.metadata")}),(0,e.jsx)(R,{size:"small",icon:(0,e.jsx)(G,{}),onClick:H,children:t("chatConfig.skill.metadata.add")})]}),(0,e.jsxs)(q,{direction:"vertical",size:8,style:{width:"100%"},children:[n.length===0&&(0,e.jsx)(h,{style:{fontSize:11,color:r.colorTextTertiary},children:t("chatConfig.skill.metadata.empty")}),n.map((o,c)=>(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[(0,e.jsx)(h,{style:{fontSize:11,color:r.colorTextSecondary},children:t("chatConfig.skill.metadata.row",{index:c+1})}),(0,e.jsxs)(q,{style:{width:"100%"},size:8,wrap:!0,children:[(0,e.jsx)(C,{value:o.key,placeholder:t("chatConfig.keyValue.key"),style:{width:140},onChange:p=>E(c,"key",p.target.value)}),(0,e.jsx)(C,{value:o.value,placeholder:t("chatConfig.keyValue.value"),style:{flex:1,minWidth:200},onChange:p=>E(c,"value",p.target.value)})]})]},c))]})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.content")}),(0,e.jsx)(y.Item,{name:"content",style:{marginBottom:0},children:(0,e.jsx)($,{placeholder:t("chatConfig.skill.placeholder.content"),autoSize:{minRows:4,maxRows:8}})})]}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,marginTop:8},children:[(0,e.jsx)(R,{onClick:A,children:t("common.cancel")}),(0,e.jsx)(R,{type:"primary",htmlType:"submit",loading:S,children:t(i?"chatConfig.skill.action.save":"chatConfig.skill.action.create")})]})]})})})},oe=J;export{W as a,oe as b};
1
+ import{c as P,o as V}from"./embed-page-chunk-XP37R2JT.js";import{l as _}from"./embed-page-chunk-QQZUP2A4.js";import{a as j}from"./embed-page-chunk-L2PNY33P.js";import{Ja as G}from"./embed-page-chunk-7TINC3YA.js";import{Ga as q,Ka as y,Pa as C,Ta as U,fa as R,fb as O,ha as M,ib as L}from"./embed-page-chunk-TWJOR2LG.js";import{a as D}from"./embed-page-chunk-MPQBYKDM.js";import{e as w}from"./embed-page-chunk-45A47GH2.js";var d=w(D());function W(f){let k=V("__GLOBAL__"),[b,a]=(0,d.useState)(!1),[x,m]=(0,d.useState)(null),S=(0,d.useCallback)(()=>{f?.onUnauthorized?f.onUnauthorized():window.dispatchEvent(new CustomEvent("lattice:unauthorized"))},[f?.onUnauthorized]),s=(0,d.useCallback)(async(i,l,n,u)=>{a(!0),m(null);try{return await k.request(l,{method:i,body:n,headers:u?.headers})}catch(v){throw v instanceof P&&S(),m(v),v}finally{a(!1)}},[k,S]),z=(0,d.useCallback)((i,l)=>s("GET",i,void 0,l),[s]),I=(0,d.useCallback)((i,l,n)=>s("POST",i,l,n),[s]),r=(0,d.useCallback)((i,l,n)=>s("PUT",i,l,n),[s]),t=(0,d.useCallback)((i,l)=>s("DELETE",i,void 0,l),[s]);return{get:z,post:I,put:r,del:t,isLoading:b,error:x}}var T=w(D());var e=w(j()),{TextArea:$}=C,{Text:h}=L,J=({open:f,onCancel:k,onSuccess:b,skill:a})=>{let{message:x}=M.useApp(),[m]=y.useForm(),[S,s]=(0,T.useState)(!1),{post:z,put:I}=W(),{token:r}=O.useToken(),t=_(),i=!!a,l=[{key:"category",value:"global"}],[n,u]=(0,T.useState)(l);(0,T.useEffect)(()=>{f&&a?(m.setFieldsValue({name:a.name,description:a.description,license:a.license||"",compatibility:a.compatibility||"",content:a.content||""}),a.metadata?u(Object.entries(a.metadata).map(([o,c])=>({key:o,value:c}))):u(l)):f&&!a&&(m.resetFields(),u(l))},[f,a]);let v=async()=>{try{let o=await m.validateFields();s(!0);let c=n.length>0?n.reduce((B,F)=>(F.key&&(B[F.key]=F.value),B),{}):void 0,p={id:o.name,name:o.name,description:o.description,license:o.license||void 0,compatibility:o.compatibility||void 0,metadata:c,content:o.content||void 0,subSkills:void 0},g;i?g=await I(`/api/skills/${a.id}`,p):g=await z("/api/skills",p),g.success?(x.success(t(i?"chatConfig.skill.updated":"chatConfig.skill.created")),m.resetFields(),u(l),b?.(),k()):x.error(g.message||t(i?"chatConfig.skill.updateFailed":"chatConfig.skill.createFailed"))}catch(o){if(o.errorFields)return;x.error(o.message||t(i?"chatConfig.skill.updateError":"chatConfig.skill.createError"))}finally{s(!1)}},A=()=>{m.resetFields(),u(l),k()},E=(o,c,p)=>{let g=[...n];g[o]={...g[o],[c]:p},u(g)},H=()=>{u([...n,{key:"",value:""}])};return(0,e.jsx)(U,{title:t(i?"chatConfig.skill.edit.title":"chatConfig.skill.create.title"),open:f,onCancel:A,footer:null,width:520,destroyOnClose:!0,styles:{body:{padding:16}},children:(0,e.jsx)(y,{form:m,layout:"vertical",onFinish:v,autoComplete:"off",children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.name")}),(0,e.jsx)(y.Item,{name:"name",rules:[{required:!0,message:t("chatConfig.skill.validation.nameRequired")},{pattern:/^[a-z0-9]+(-[a-z0-9]+)*$/,message:t("chatConfig.skill.validation.namePattern")},{min:1,max:64,message:t("chatConfig.skill.validation.nameLength")}],style:{marginBottom:0},children:(0,e.jsx)(C,{placeholder:"e.g., data-analysis",disabled:i})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.description")}),(0,e.jsx)(y.Item,{name:"description",rules:[{required:!0,message:t("chatConfig.skill.validation.descriptionRequired")}],style:{marginBottom:0},children:(0,e.jsx)($,{placeholder:t("chatConfig.skill.placeholder.description"),autoSize:{minRows:2,maxRows:4}})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.license")}),(0,e.jsx)(y.Item,{name:"license",style:{marginBottom:0},children:(0,e.jsx)(C,{placeholder:t("chatConfig.skill.placeholder.license")})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.compatibility")}),(0,e.jsx)(y.Item,{name:"compatibility",style:{marginBottom:0},children:(0,e.jsx)(C,{placeholder:t("chatConfig.skill.placeholder.compatibility")})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary,fontWeight:500},children:t("chatConfig.skill.field.metadata")}),(0,e.jsx)(R,{size:"small",icon:(0,e.jsx)(G,{}),onClick:H,children:t("chatConfig.skill.metadata.add")})]}),(0,e.jsxs)(q,{direction:"vertical",size:8,style:{width:"100%"},children:[n.length===0&&(0,e.jsx)(h,{style:{fontSize:11,color:r.colorTextTertiary},children:t("chatConfig.skill.metadata.empty")}),n.map((o,c)=>(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[(0,e.jsx)(h,{style:{fontSize:11,color:r.colorTextSecondary},children:t("chatConfig.skill.metadata.row",{index:c+1})}),(0,e.jsxs)(q,{style:{width:"100%"},size:8,wrap:!0,children:[(0,e.jsx)(C,{value:o.key,placeholder:t("chatConfig.keyValue.key"),style:{width:140},onChange:p=>E(c,"key",p.target.value)}),(0,e.jsx)(C,{value:o.value,placeholder:t("chatConfig.keyValue.value"),style:{flex:1,minWidth:200},onChange:p=>E(c,"value",p.target.value)})]})]},c))]})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.content")}),(0,e.jsx)(y.Item,{name:"content",style:{marginBottom:0},children:(0,e.jsx)($,{placeholder:t("chatConfig.skill.placeholder.content"),autoSize:{minRows:4,maxRows:8}})})]}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,marginTop:8},children:[(0,e.jsx)(R,{onClick:A,children:t("common.cancel")}),(0,e.jsx)(R,{type:"primary",htmlType:"submit",loading:S,children:t(i?"chatConfig.skill.action.save":"chatConfig.skill.action.create")})]})]})})})},oe=J;export{W as a,oe as b};
@@ -1,4 +1,4 @@
1
- import{X as ye,Y as be,c as he}from"./embed-page-chunk-KJTJI54Q.js";import{a as ce,c as ue,m as ge,n as O,q as Ae}from"./embed-page-chunk-5UOSSN26.js";import{g as ie,k as pe,n as le,s as me}from"./embed-page-chunk-U3XF7MHJ.js";import{B as fe,ca as J}from"./embed-page-chunk-BNA3NXXX.js";import{a as C,f as U,g as D,h as $,l as q,o as se,p as de}from"./embed-page-chunk-PNJ7DZ5V.js";import{a as N}from"./embed-page-chunk-L2PNY33P.js";import{j as Z,k as Ne,l as Oe,m as je,n as Fe}from"./embed-page-chunk-V5NE4FIR.js";import{Qa as ae,T as oe}from"./embed-page-chunk-TWJOR2LG.js";import{a as re}from"./embed-page-chunk-MPQBYKDM.js";import{c as L,e as _}from"./embed-page-chunk-45A47GH2.js";var Pe=L(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});z.default=void 0;var st={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"},Vt=z.default=st});var We=L(G=>{"use strict";var dt=Ne().default;Object.defineProperty(G,"__esModule",{value:!0});G.default=void 0;var _e=dt(Oe()),pt=je(),lt=(0,_e.default)((0,_e.default)({},pt.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}),Jt=G.default=lt});var ee=L(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.default=void 0;var ct={placeholder:"\u8BF7\u9009\u62E9\u65F6\u95F4",rangePlaceholder:["\u5F00\u59CB\u65F6\u95F4","\u7ED3\u675F\u65F6\u95F4"]},en=K.default=ct});var te=L(X=>{"use strict";var Le=Z().default;Object.defineProperty(X,"__esModule",{value:!0});X.default=void 0;var ut=Le(We()),mt=Le(ee()),xe={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"]},ut.default),timePickerLocale:Object.assign({},mt.default)};xe.lang.ok="\u786E\u5B9A";var nn=X.default=xe});var ve=L(Q=>{"use strict";var ft=Z().default;Object.defineProperty(Q,"__esModule",{value:!0});Q.default=void 0;var gt=ft(te()),on=Q.default=gt.default});var Me=L(Y=>{"use strict";var V=Z().default;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=void 0;var At=V(Pe()),ht=V(ve()),yt=V(te()),bt=V(ee()),w="${label}\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684${type}",Ct={locale:"zh-cn",Pagination:At.default,DatePicker:yt.default,TimePicker:bt.default,Calendar:ht.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:w,method:w,array:w,object:w,number:w,date:w,boolean:w,integer:w,float:w,regexp:w,email:w,url:w,hex:w},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"}},sn=Y.default=Ct});var Ue=L((pn,qe)=>{"use strict";qe.exports=Me()});var A=_(re());var y=class extends Error{code;retryable;status;constructor(t,n,r,i){super(n),this.name="AgentWebAppRuntimeClientError",this.code=t,this.retryable=r,this.status=i}};function x(){return new y("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 v(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function T(e,t){return Object.keys(e).length===t.length&&t.every(r=>r in e)}function Be(e){return v(e)&&T(e,["code","message","retryable"])&&typeof e.code=="string"&&He.has(e.code)&&typeof e.message=="string"&&typeof e.retryable=="boolean"}function ze(e){if(!v(e))return!1;let t=e.data===void 0?["id","type","prompt"]:["id","type","prompt","data"];return T(e,t)&&typeof e.id=="string"&&typeof e.type=="string"&&typeof e.prompt=="string"&&(e.data===void 0||v(e.data))}var Ge=new Set([C.HUMAN,C.AI,C.TOOL,C.INTERRUPT,C.MESSAGE_COMPLETED,C.MESSAGE_FAILED,C.THREAD_IDLE]);function Ke(e,t){let n;try{n=JSON.parse(e)}catch{throw x()}if(!v(n)||typeof n.type!="string")throw x();if(Ge.has(n.type)||n.type==="error"&&v(n.data)&&!v(n.error)){let r=$(n,t);return r.length===0?[]:r}switch(n.type){case"message.delta":if(T(n,["type","text"])&&typeof n.text=="string")return[n];break;case"message.completed":if(T(n,["type","messageId"])&&typeof n.messageId=="string")return[n];break;case"tool.started":if(T(n,["type","id","name"])&&typeof n.id=="string"&&typeof n.name=="string")return[n];break;case"tool.completed":if(T(n,["type","id"])&&typeof n.id=="string")return[n];break;case"interrupt.created":if(T(n,["type","interrupt"])&&ze(n.interrupt))return[n];break;case"genui.render":if(T(n,["type","block"])&&U(n.block))return[n];break;case"error":if(T(n,["type","error"])&&Be(n.error))return[n];break;case"stream.completed":if(T(n,["type"]))return[n];break}throw x()}function Xe(e){return e instanceof Error&&e.name==="AbortError"}async function Ce(e,t){let n=D({allowGenUI:!0,allowInterrupts:!0}),r=e.getReader(),i=new TextDecoder,o="",a=!1,s=!1;try{for(;!a;){let d;try{d=await r.read()}catch(l){if(Xe(l))return;throw x()}d.done&&(s=!0);try{o+=i.decode(d.value,{stream:!d.done})}catch{throw x()}let h=o.split(/\r?\n\r?\n/);o=d.done?"":h.pop()??"";for(let l of h){let g=l.split(/\r?\n/).filter(f=>f==="data"||f.startsWith("data:")).map(f=>f==="data"?"":f.slice(5).replace(/^ /,""));if(g.length!==0){for(let f of Ke(g.join(`
1
+ import{X as ye,Y as be,c as he}from"./embed-page-chunk-TJMEWCV7.js";import{a as ce,c as ue,m as ge,n as O,q as Ae}from"./embed-page-chunk-S2G53SSD.js";import{g as ie,k as pe,n as le,s as me}from"./embed-page-chunk-XP37R2JT.js";import{B as fe,ca as J}from"./embed-page-chunk-BNA3NXXX.js";import{a as C,f as U,g as D,h as $,l as q,o as se,p as de}from"./embed-page-chunk-QQZUP2A4.js";import{a as N}from"./embed-page-chunk-L2PNY33P.js";import{j as Z,k as Ne,l as Oe,m as je,n as Fe}from"./embed-page-chunk-V5NE4FIR.js";import{Qa as ae,T as oe}from"./embed-page-chunk-TWJOR2LG.js";import{a as re}from"./embed-page-chunk-MPQBYKDM.js";import{c as L,e as _}from"./embed-page-chunk-45A47GH2.js";var Pe=L(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});z.default=void 0;var st={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"},Vt=z.default=st});var We=L(G=>{"use strict";var dt=Ne().default;Object.defineProperty(G,"__esModule",{value:!0});G.default=void 0;var _e=dt(Oe()),pt=je(),lt=(0,_e.default)((0,_e.default)({},pt.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}),Jt=G.default=lt});var ee=L(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.default=void 0;var ct={placeholder:"\u8BF7\u9009\u62E9\u65F6\u95F4",rangePlaceholder:["\u5F00\u59CB\u65F6\u95F4","\u7ED3\u675F\u65F6\u95F4"]},en=K.default=ct});var te=L(X=>{"use strict";var Le=Z().default;Object.defineProperty(X,"__esModule",{value:!0});X.default=void 0;var ut=Le(We()),mt=Le(ee()),xe={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"]},ut.default),timePickerLocale:Object.assign({},mt.default)};xe.lang.ok="\u786E\u5B9A";var nn=X.default=xe});var ve=L(Q=>{"use strict";var ft=Z().default;Object.defineProperty(Q,"__esModule",{value:!0});Q.default=void 0;var gt=ft(te()),on=Q.default=gt.default});var Me=L(Y=>{"use strict";var V=Z().default;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=void 0;var At=V(Pe()),ht=V(ve()),yt=V(te()),bt=V(ee()),w="${label}\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684${type}",Ct={locale:"zh-cn",Pagination:At.default,DatePicker:yt.default,TimePicker:bt.default,Calendar:ht.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:w,method:w,array:w,object:w,number:w,date:w,boolean:w,integer:w,float:w,regexp:w,email:w,url:w,hex:w},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"}},sn=Y.default=Ct});var Ue=L((pn,qe)=>{"use strict";qe.exports=Me()});var A=_(re());var y=class extends Error{code;retryable;status;constructor(t,n,r,i){super(n),this.name="AgentWebAppRuntimeClientError",this.code=t,this.retryable=r,this.status=i}};function x(){return new y("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 v(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function T(e,t){return Object.keys(e).length===t.length&&t.every(r=>r in e)}function Be(e){return v(e)&&T(e,["code","message","retryable"])&&typeof e.code=="string"&&He.has(e.code)&&typeof e.message=="string"&&typeof e.retryable=="boolean"}function ze(e){if(!v(e))return!1;let t=e.data===void 0?["id","type","prompt"]:["id","type","prompt","data"];return T(e,t)&&typeof e.id=="string"&&typeof e.type=="string"&&typeof e.prompt=="string"&&(e.data===void 0||v(e.data))}var Ge=new Set([C.HUMAN,C.AI,C.TOOL,C.INTERRUPT,C.MESSAGE_COMPLETED,C.MESSAGE_FAILED,C.THREAD_IDLE]);function Ke(e,t){let n;try{n=JSON.parse(e)}catch{throw x()}if(!v(n)||typeof n.type!="string")throw x();if(Ge.has(n.type)||n.type==="error"&&v(n.data)&&!v(n.error)){let r=$(n,t);return r.length===0?[]:r}switch(n.type){case"message.delta":if(T(n,["type","text"])&&typeof n.text=="string")return[n];break;case"message.completed":if(T(n,["type","messageId"])&&typeof n.messageId=="string")return[n];break;case"tool.started":if(T(n,["type","id","name"])&&typeof n.id=="string"&&typeof n.name=="string")return[n];break;case"tool.completed":if(T(n,["type","id"])&&typeof n.id=="string")return[n];break;case"interrupt.created":if(T(n,["type","interrupt"])&&ze(n.interrupt))return[n];break;case"genui.render":if(T(n,["type","block"])&&U(n.block))return[n];break;case"error":if(T(n,["type","error"])&&Be(n.error))return[n];break;case"stream.completed":if(T(n,["type"]))return[n];break}throw x()}function Xe(e){return e instanceof Error&&e.name==="AbortError"}async function Ce(e,t){let n=D({allowGenUI:!0,allowInterrupts:!0}),r=e.getReader(),i=new TextDecoder,o="",a=!1,s=!1;try{for(;!a;){let d;try{d=await r.read()}catch(l){if(Xe(l))return;throw x()}d.done&&(s=!0);try{o+=i.decode(d.value,{stream:!d.done})}catch{throw x()}let h=o.split(/\r?\n\r?\n/);o=d.done?"":h.pop()??"";for(let l of h){let g=l.split(/\r?\n/).filter(f=>f==="data"||f.startsWith("data:")).map(f=>f==="data"?"":f.slice(5).replace(/^ /,""));if(g.length!==0){for(let f of Ke(g.join(`
2
2
  `),n))if(await t(f),a=f.type==="stream.completed",a)break;if(a)break}}if(d.done)break}if(!a)throw x()}finally{if(!s)try{await r.cancel()}catch{}r.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","RUN_CANCEL_UNAVAILABLE","RUN_CANCEL_STORE_UNAVAILABLE","INVALID_REQUEST","INTERNAL_ERROR"]);function c(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function b(e,t,n=[]){let r=Object.keys(e);return t.every(i=>i in e)&&r.every(i=>t.includes(i)||n.includes(i))}function p(e){return typeof e=="string"}function j(e){if(!c(e)||!b(e,["id","projectId","createdAt","updatedAt"],["label"])||!p(e.id)||!p(e.projectId)||e.label!==void 0&&!p(e.label)||!p(e.createdAt)||!p(e.updatedAt))return;let t=new Date(e.createdAt),n=new Date(e.updatedAt);if(!(Number.isNaN(t.getTime())||Number.isNaN(n.getTime())))return{id:e.id,projectId:e.projectId,...e.label===void 0?{}:{label:e.label},createdAt:t,updatedAt:n}}function we(e){if(!c(e)||e.success!==!1||!c(e.error))return!1;let t=e.error;return b(e,["success","error"])&&b(t,["code","message","retryable"])&&typeof t.code=="string"&&Qe.has(t.code)&&typeof t.message=="string"&&typeof t.retryable=="boolean"}function Ve(e){if(!c(e))return!1;let t=["projectSelector","modelSelector","threadManagement","attachments","hitl","genUI"];return b(e,t,["files"])&&t.every(n=>typeof e[n]=="boolean")&&(e.files===void 0||typeof e.files=="boolean")}function Ye(e){return Array.isArray(e)&&e.length<=6&&e.every(t=>c(t)&&b(t,["label","text"])&&p(t.label)&&t.label.length>=1&&t.label.length<=40&&p(t.text)&&t.text.length>=1&&t.text.length<=500)}function Je(e){return c(e)&&b(e,[],["title","welcomeMessage","primaryColor","quickPrompts"])&&(e.title===void 0||p(e.title))&&(e.welcomeMessage===void 0||p(e.welcomeMessage))&&(e.primaryColor===void 0||p(e.primaryColor))&&(e.quickPrompts===void 0||Ye(e.quickPrompts))}function Ze(e){if(!c(e)||!b(e,["webApp","projects","models"],["thread"])||!c(e.webApp))return;let t=e.webApp;if(!b(t,["id","name","assistant","defaultProjectId","features","appearance","identityAssurance"],["description","defaultModelKey"])||!p(t.id)||!p(t.name)||!p(t.defaultProjectId)||t.description!==void 0&&!p(t.description)||t.defaultModelKey!==void 0&&!p(t.defaultModelKey)||t.identityAssurance!=="unverified"||!c(t.assistant)||!b(t.assistant,["id","name"],["description"])||!p(t.assistant.id)||!p(t.assistant.name)||t.assistant.description!==void 0&&!p(t.assistant.description)||!Ve(t.features)||!Je(t.appearance)||!Array.isArray(e.projects)||!e.projects.every(r=>c(r)&&b(r,["id","name"])&&p(r.id)&&p(r.name))||!Array.isArray(e.models)||!e.models.every(r=>c(r)&&b(r,["key","label"])&&p(r.key)&&p(r.label)))return;let n=e.thread===void 0?void 0:j(e.thread);if(!(e.thread!==void 0&&!n))return{...e,...n?{thread:n}:{}}}function et(e){if(!c(e)||!b(e,["records","total"])||!Array.isArray(e.records)||typeof e.total!="number")return;let t=e.records.map(j);return t.every(n=>n!==void 0)?{records:t,total:e.total}:void 0}function tt(e){return c(e)&&p(e.id)&&(e.role==="human"||e.role==="ai")&&(e.content===void 0||p(e.content)||Array.isArray(e.content)&&e.content.every(t=>U(t)!==void 0))}function nt(e){return c(e)&&b(e,["messages"])&&Array.isArray(e.messages)&&e.messages.every(tt)?e:void 0}function rt(e){return c(e)&&b(e,["ref","name","mimeType","size"])&&p(e.ref)&&p(e.name)&&p(e.mimeType)&&typeof e.size=="number"?e:void 0}function Ee(e,t){return n=>c(n)&&b(n,e)&&t(n)?n:void 0}function ot(e){let t=c(e.payload)?e.payload:{},n=typeof t.prompt=="string"?t.prompt:typeof t.message=="string"?t.message:"Input required";return{id:e.interruptId,type:e.type,prompt:n,...c(t.data)?{data:t.data}:{}}}var F=class{constructor(t){this.options=t;this.baseUrl=`${t.gatewayUrl.replace(/\/+$/,"")}/api/web-apps/${encodeURIComponent(t.webAppId)}/runtime`,this.fetchImplementation=t.fetch??globalThis.fetch.bind(globalThis),this.translate=t.translate}baseUrl;fetchImplementation;translate;async bootstrap(t={},n){return this.request("bootstrap",Ze,{query:t,signal:n})}async listThreads(t={},n){return this.request("threads",et,{query:t,signal:n})}async createThread(t={},n){return this.request("threads",j,{method:"POST",body:t,signal:n})}async updateThread(t,n,r){return this.request(`threads/${encodeURIComponent(t)}`,j,{method:"PATCH",body:n,signal:r})}async deleteThread(t,n={},r){await this.request(`threads/${encodeURIComponent(t)}`,Ee(["id"],i=>p(i.id)),{method:"DELETE",query:n,signal:r})}async getMessages(t,n={},r){return this.request(`threads/${encodeURIComponent(t)}/messages`,nt,{query:n,signal:r})}async streamMessage(t,n,r,i){return this.streamRequest(`threads/${encodeURIComponent(t)}/messages/stream`,n,r,i)}async resumeInterrupt(t,n,r,i,o){return this.streamRequest(`threads/${encodeURIComponent(t)}/interrupts/${encodeURIComponent(n)}/resume`,r,i,o)}async streamRequest(t,n,r,i){let o;try{o=await this.fetchRequest(t,{method:"POST",body:n,signal:i})}catch(a){throw Re(a)||a instanceof y?a:new y("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 y("STREAM_FAILED",this.translate?.("integration.error.streamFailed")??"Stream failed",!0,o.status)}await Ce(o.body,r)}async commandsRunStart(t,n,r,i={},o){return this.request(`api/assistants/${encodeURIComponent(t)}/threads/${encodeURIComponent(n)}/commands`,a=>c(a)&&typeof a.messageId=="string"?{messageId:a.messageId}:void 0,{method:"POST",query:i,body:{command:"run.start",args:r},signal:o})}async commandsRespond(t,n,r,i={},o){return this.request(`api/assistants/${encodeURIComponent(t)}/threads/${encodeURIComponent(n)}/commands`,a=>{if(!c(a)||typeof a.messageId!="string"||typeof a.interruptId!="string")return;let s=typeof a.accepted=="boolean"?a.accepted:void 0,d=typeof a.commandId=="string"?a.commandId:void 0;return{messageId:a.messageId,interruptId:a.interruptId,...s===void 0?{}:{accepted:s},...d===void 0?{}:{commandId:d}}},{method:"POST",query:i,body:{command:"input.respond",args:r},signal:o})}async getThreadStatus(t,n,r={},i){return this.request(`api/assistants/${encodeURIComponent(t)}/threads/${encodeURIComponent(n)}/status`,o=>c(o)&&typeof o.status=="string"&&typeof o.pendingMessages=="number"&&Array.isArray(o.interrupts)?{status:o.status,pendingMessages:o.pendingMessages,interrupts:o.interrupts.map(a=>ot(a))}:void 0,{query:r,signal:i})}async streamThreadEvents(t,n,r,i,o){let a=await this.fetchRequest(`api/assistants/${encodeURIComponent(t)}/threads/${encodeURIComponent(n)}/stream/events`,{method:"POST",query:{projectId:r.projectId,modelKey:r.modelKey},body:{channels:["messages","tools","input","lifecycle"],...r.since?{since:r.since}:{}},signal:o});if(a.ok||await this.throwResponseError(a),!a.body)throw new y("STREAM_FAILED",this.translate?.("integration.error.streamFailed")??"Stream failed",!0,a.status);let s=D({allowInterrupts:r.allowInterrupts??!0,allowGenUI:r.allowGenUI??!1}),d=new TextDecoder,h="",l=!1,g=a.body.getReader();try{for(;;){let{done:f,value:S}=await g.read();if(f)break;h+=d.decode(S,{stream:!0});let k=h.indexOf(`
3
3
 
4
4
  `);for(;k>=0;){let W=h.slice(0,k);h=h.slice(k+2),k=h.indexOf(`
@@ -1,2 +1,2 @@
1
- import{A as T,B as C,a as S,s as P}from"./embed-page-chunk-KJTJI54Q.js";import{o as I}from"./embed-page-chunk-U3XF7MHJ.js";import{l as d}from"./embed-page-chunk-PNJ7DZ5V.js";import{a as p}from"./embed-page-chunk-L2PNY33P.js";import{z as x}from"./embed-page-chunk-7TINC3YA.js";import{ba as y,fa as v,ib as b}from"./embed-page-chunk-TWJOR2LG.js";import{a as L}from"./embed-page-chunk-MPQBYKDM.js";import{e as s}from"./embed-page-chunk-45A47GH2.js";var u=s(L());var t=s(p()),{Text:c}=b,H=({workflowContext:e,onClose:l,onToolCompleted:g,initialMessageRequest:n,onInitialMessageSubmitted:m,attemptedInitialMessageRequestIdsRef:o,rawInitialMessage:a,showHeader:A=!0})=>{let r=d(),M=I("agent-architect"),f=e?.id?`${M.tenantId}:${e.id}`:null,R=(0,u.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]),$=(0,u.useMemo)(()=>{if(!n||!e?.id)return null;if(a)return n;let h=[`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{A as T,B as C,a as S,s as P}from"./embed-page-chunk-TJMEWCV7.js";import{o as I}from"./embed-page-chunk-XP37R2JT.js";import{l as d}from"./embed-page-chunk-QQZUP2A4.js";import{a as p}from"./embed-page-chunk-L2PNY33P.js";import{z as x}from"./embed-page-chunk-7TINC3YA.js";import{ba as y,fa as v,ib as b}from"./embed-page-chunk-TWJOR2LG.js";import{a as L}from"./embed-page-chunk-MPQBYKDM.js";import{e as s}from"./embed-page-chunk-45A47GH2.js";var u=s(L());var t=s(p()),{Text:c}=b,H=({workflowContext:e,onClose:l,onToolCompleted:g,initialMessageRequest:n,onInitialMessageSubmitted:m,attemptedInitialMessageRequestIdsRef:o,rawInitialMessage:a,showHeader:A=!0})=>{let r=d(),M=I("agent-architect"),f=e?.id?`${M.tenantId}:${e.id}`:null,R=(0,u.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]),$=(0,u.useMemo)(()=>{if(!n||!e?.id)return null;if(a)return n;let h=[`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
  `);return{...n,content:h}},[n?.requestId,n?.content,e?.id,a]);return(0,t.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column",borderLeft:"1px solid #f0f0f0",background:"rgba(255, 255, 255, 0.92)"},children:[A&&(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})})})]}),l&&(0,t.jsx)(v,{type:"text",size:"small","aria-label":r("chat.copilot.close"),icon:(0,t.jsx)(x,{}),onClick:l})]}),f?(0,t.jsxs)(S,{threadId:f,assistantId:"agent-architect",options:{streaming:!0},onToolCompleted:g,children:[(0,t.jsx)(T,{request:$,onSubmitted:m,attemptedRequestIdsRef:o}),(0,t.jsx)(C,{showHeader:!1,showEmptyState:!1,showDatabaseSlot:!1,showSkillSlot:!1,showAgentSlot:!1,showMetricsDataSourceSlot:!1,systemContext:R})]}):(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=s(p()),_=({project:e,value:l,onChange:g,selectable:n=!0,loading:m})=>{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")}),n?(0,i.jsx)(P,{kinds:["training"],value:l??e.id,onChange:a=>{a&&g?.(a)},style:{minWidth:0}}):(0,i.jsx)("span",{style:{fontSize:12,fontWeight:500},children:e.name})]}):m?null:(0,i.jsx)(y,{type:"warning",showIcon:!0,message:o("governance.learning.noProject"),description:o("governance.learning.noProjectDescription")})};export{_ as a,H as b};