@axiom-lattice/gateway 4.2.0 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{A2AAuthService-DK5X6VIL.mjs → A2AAuthService-7UGQ7GMW.mjs} +3 -2
- package/dist/{WechatChannelAdapter-WSDKR4OA.mjs → WechatChannelAdapter-7WHE5UGY.mjs} +2 -1
- package/dist/{WechatChannelAdapter-WSDKR4OA.mjs.map → WechatChannelAdapter-7WHE5UGY.mjs.map} +1 -1
- package/dist/{a2a-7N3WDAOP.mjs → a2a-FGYX2HH3.mjs} +71 -32
- package/dist/a2a-FGYX2HH3.mjs.map +1 -0
- package/dist/{a2a-standard-WC2BSOFV.mjs → a2a-standard-VEQBXBMM.mjs} +93 -115
- package/dist/a2a-standard-VEQBXBMM.mjs.map +1 -0
- package/dist/agentProvider-X4FVQPKW.mjs +88 -0
- package/dist/agentProvider-X4FVQPKW.mjs.map +1 -0
- package/dist/chunk-2POW27EI.mjs +27 -0
- package/dist/chunk-2POW27EI.mjs.map +1 -0
- package/dist/chunk-52SUWMOX.mjs +121 -0
- package/dist/chunk-52SUWMOX.mjs.map +1 -0
- package/dist/chunk-GF4GGTWJ.mjs +164 -0
- package/dist/chunk-GF4GGTWJ.mjs.map +1 -0
- package/dist/{chunk-2HOCF46L.mjs → chunk-GPHOYR3X.mjs} +33 -11
- package/dist/chunk-GPHOYR3X.mjs.map +1 -0
- package/dist/chunk-NFEGQTCC.mjs +27 -0
- package/dist/chunk-PWHUWFXL.mjs +173 -0
- package/dist/chunk-PWHUWFXL.mjs.map +1 -0
- package/dist/chunk-QUT2DS4R.mjs +50 -0
- package/dist/chunk-QUT2DS4R.mjs.map +1 -0
- package/dist/chunk-TJAUXMYJ.mjs +109 -0
- package/dist/chunk-TJAUXMYJ.mjs.map +1 -0
- package/dist/chunk-WKNZ7GBC.mjs +56 -0
- package/dist/chunk-WKNZ7GBC.mjs.map +1 -0
- package/dist/collection_service-RTRJEQFL.mjs +8 -0
- package/dist/embed/agent-chat-loader.js +1 -1
- package/dist/embed/{embed-page-AgentDetailSideApp-6CVXM3P3.js → embed-page-AgentDetailSideApp-DTDBMB2U.js} +1 -1
- package/dist/embed/{embed-page-AgentDetailSideApp-DRGKJ6C5.css → embed-page-AgentDetailSideApp-O6G4NJ7I.css} +1 -1
- package/dist/embed/{embed-page-AgentGovernanceWorkbench-4B3NJPCY.js → embed-page-AgentGovernanceWorkbench-JUP6SNBX.js} +1 -1
- package/dist/embed/embed-page-AgentGovernanceWorkbench-SFZNVMUH.css +1 -0
- package/dist/embed/embed-page-MessageGraph-H5S7SARE.js +6 -0
- package/dist/embed/{embed-page-ReactChart-OG5Z43H7.js → embed-page-ReactChart-FWXMXO7F.js} +1 -1
- package/dist/embed/{embed-page-SkillFlow-GS4OUCJJ.js → embed-page-SkillFlow-SFZ5HLMK.js} +1 -1
- package/dist/embed/{embed-page-TasksSideApp-I6Z7BOT2.js → embed-page-TasksSideApp-Q6HTW6S6.js} +1 -1
- package/dist/embed/{embed-page-TeamWorkspace-LSCUIJDA.js → embed-page-TeamWorkspace-6KFWCIKW.js} +4 -4
- package/dist/embed/{embed-page-TopologyRuntimeView-RY7NOUB7.js → embed-page-TopologyRuntimeView-MASWKWXA.js} +1 -1
- package/dist/embed/{embed-page-WorkflowAutomationView-RNKIKDUX.js → embed-page-WorkflowAutomationView-6UOT36GW.js} +1 -1
- package/dist/embed/{embed-page-chunk-4BIOW547.js → embed-page-chunk-2WCPJYBC.js} +1 -1
- package/dist/embed/{embed-page-chunk-7CFGO35V.js → embed-page-chunk-3EUETTEM.js} +1 -1
- package/dist/embed/{embed-page-chunk-4X5XHAMX.js → embed-page-chunk-74BPRLSV.js} +4 -4
- package/dist/embed/embed-page-chunk-7SO4HHS4.js +4084 -0
- package/dist/embed/{embed-page-chunk-DVHOG6AY.js → embed-page-chunk-AC6X2XRH.js} +1 -1
- package/dist/embed/{embed-page-chunk-SU5GXLKX.js → embed-page-chunk-AVZ7FKIO.js} +4 -4
- package/dist/embed/{embed-page-chunk-EPEKIAZP.js → embed-page-chunk-FJ3SFKJY.js} +1 -1
- package/dist/embed/{embed-page-chunk-Q32Y7CP2.js → embed-page-chunk-IV5C4DYL.js} +1 -1
- package/dist/embed/{embed-page-chunk-KGX7G7XQ.js → embed-page-chunk-KEL6XU6R.js} +1 -1
- package/dist/embed/{embed-page-chunk-BZI3YCE7.js → embed-page-chunk-N46WJ2FS.js} +1 -1
- package/dist/embed/embed-page-chunk-NFLB3VUZ.js +245 -0
- package/dist/embed/{embed-page-chunk-AYOVLRHX.js → embed-page-chunk-NHOWQIND.js} +182 -70
- package/dist/embed/{embed-page-chunk-KG5A66WX.js → embed-page-chunk-O4QK5LWZ.js} +83 -83
- package/dist/embed/{embed-page-chunk-JLWIJ4BP.js → embed-page-chunk-X4DK4JRG.js} +1 -1
- package/dist/embed/{embed-page-chunk-ESLOGPBN.js → embed-page-chunk-Z7USDLHI.js} +1 -1
- package/dist/embed/{embed-page-code-highlighter-TBT4ICNZ.js → embed-page-code-highlighter-Y6CQA4CN.js} +1 -1
- package/dist/embed/{embed-page-mermaid-TBO3M7GX.js → embed-page-mermaid-CW4QCAH3.js} +1 -1
- package/dist/embed/embed-page.css +1 -1
- package/dist/embed/embed-page.js +1 -1
- package/dist/index.js +2067 -585
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +374 -348
- package/dist/index.mjs.map +1 -1
- package/dist/kbProvider-2D6DZ34N.mjs +50 -0
- package/dist/kbProvider-2D6DZ34N.mjs.map +1 -0
- package/dist/{mcp-configs-IIKQM5GM.mjs → mcp-configs-WCY5EXCW.mjs} +2 -1
- package/dist/mcp-configs-WCY5EXCW.mjs.map +1 -0
- package/dist/{mcpTransportRegistry-XMJ5Y2RG.mjs → mcpTransportRegistry-VXUVJKBC.mjs} +2 -1
- package/dist/mcpTransportRegistry-VXUVJKBC.mjs.map +1 -0
- package/dist/open-HH7RKGML.mjs +260 -0
- package/dist/open-HH7RKGML.mjs.map +1 -0
- package/dist/open-audit-UJ3NXCGW.mjs +32 -0
- package/dist/open-audit-UJ3NXCGW.mjs.map +1 -0
- package/dist/open-catalog-WYS2AENM.mjs +59 -0
- package/dist/open-catalog-WYS2AENM.mjs.map +1 -0
- package/dist/open-exposure-FK4G6O6L.mjs +67 -0
- package/dist/open-exposure-FK4G6O6L.mjs.map +1 -0
- package/dist/open-files-GVRMK5PL.mjs +146 -0
- package/dist/open-files-GVRMK5PL.mjs.map +1 -0
- package/dist/open-session-3VN65PRR.mjs +53 -0
- package/dist/open-session-3VN65PRR.mjs.map +1 -0
- package/dist/openLattice-GAAGQJST.mjs +16 -0
- package/dist/openLattice-GAAGQJST.mjs.map +1 -0
- package/dist/registerExposedPlugins-63EUF4VS.mjs +99 -0
- package/dist/registerExposedPlugins-63EUF4VS.mjs.map +1 -0
- package/dist/{resources-VA7LSDKN.mjs → resources-SRQRKW5G.mjs} +47 -4
- package/dist/resources-SRQRKW5G.mjs.map +1 -0
- package/dist/sandboxProvider-I3P66VXT.mjs +10 -0
- package/dist/sandboxProvider-I3P66VXT.mjs.map +1 -0
- package/dist/{sender-PX32VSHB.mjs → sender-PLDU5EZ3.mjs} +3 -1
- package/dist/{sender-PX32VSHB.mjs.map → sender-PLDU5EZ3.mjs.map} +1 -1
- package/package.json +7 -7
- package/dist/a2a-7N3WDAOP.mjs.map +0 -1
- package/dist/a2a-standard-WC2BSOFV.mjs.map +0 -1
- package/dist/chunk-2HOCF46L.mjs.map +0 -1
- package/dist/embed/embed-page-chunk-A2LQIHX4.js +0 -261
- package/dist/embed/embed-page-chunk-OWGBADV6.js +0 -3880
- package/dist/open-DCAOL5CG.mjs +0 -176
- package/dist/open-DCAOL5CG.mjs.map +0 -1
- package/dist/resources-VA7LSDKN.mjs.map +0 -1
- /package/dist/{A2AAuthService-DK5X6VIL.mjs.map → A2AAuthService-7UGQ7GMW.mjs.map} +0 -0
- /package/dist/{mcp-configs-IIKQM5GM.mjs.map → chunk-NFEGQTCC.mjs.map} +0 -0
- /package/dist/{mcpTransportRegistry-XMJ5Y2RG.mjs.map → collection_service-RTRJEQFL.mjs.map} +0 -0
- /package/dist/embed/{embed-page-AgentGovernanceWorkbench-SDS3GBCC.css → embed-page-MessageGraph-TYOOATYV.css} +0 -0
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import{a as hr,b as Pn}from"./embed-page-chunk-4BIOW547.js";import{b as Vi,c as Qi}from"./embed-page-chunk-EPEKIAZP.js";import{e as Hi}from"./embed-page-chunk-7CFGO35V.js";import{c as Ro,d as Io}from"./embed-page-chunk-KGX7G7XQ.js";import{b as lt,c as Wi,d as xo,e as St,f as To,g as Bi,h as Cn,i as An,j as ji,l as Gi,m as $i}from"./embed-page-chunk-DVHOG6AY.js";import{a as Ni,b as Eo,c as Ki,d as Ui,e as Po,f as yr,g as Zi,h as Yi}from"./embed-page-chunk-AYOVLRHX.js";import{a as En}from"./embed-page-chunk-JLWIJ4BP.js";import{e as qi,f as So,g as Co,h as Ao}from"./embed-page-chunk-SU5GXLKX.js";import{$a as Mi,C as hi,E as bi,Ea as bo,F as fr,Fa as Pi,G as vi,Ga as Di,I as ki,Ia as Li,J as wi,Ka as kt,L as ho,T as xi,Wa as In,Ya as Sn,Za as vo,_a as ko,ab as Oi,db as _i,eb as Fi,fb as zi,g as fi,gb as wo,i as mi,ia as Ti,j as Kn,ja as Ri,ka as Ii,ma as Si,na as Ci,ta as Ai,u as yi,za as Ei}from"./embed-page-chunk-OWGBADV6.js";import{b as ri,i as po,l as st,p as go,q as nt}from"./embed-page-chunk-4X5XHAMX.js";import{a as W}from"./embed-page-chunk-MB65DZAX.js";import{a as mr}from"./embed-page-chunk-VW3NF5NT.js";import{Bc as ui,Cb as mo,Db as di,Dc as pi,Ec as pr,Fa as ti,Fc as gr,Ha as uo,Ia as Ue,Ja as ni,La as qe,Ma as oi,Qc as gi,Tb as ur,U as It,V as Qr,W as oe,Wa as ii,Y as Rn,Z as Bt,_ as at,aa as Yt,bc as ci,ca as dr,da as cr,ea as co,eb as ai,fa as Yr,fc as yo,ga as Xr,ia as pn,la as Jr,mb as si,na as ei,oa as vt,ob as li,ra as ve,ta as Oe,tb as fo,va as ut,wc as Xt,xa as Ke,ya as $e}from"./embed-page-chunk-KG5A66WX.js";import{a as Se}from"./embed-page-chunk-4BKXE5ON.js";import{e as T}from"./embed-page-chunk-6Y3UYJ6Z.js";var Xs={react:{label:"capability",color:"blue"},capability:{label:"capability",color:"blue"},deep_agent:{label:"orchestrator",color:"orange"},orchestrator:{label:"orchestrator",color:"orange"},team:{label:"team",color:"green"},processing:{label:"workflow",color:"purple"},workflow:{label:"workflow",color:"purple"},a2a_remote:{label:"remote",color:"cyan"},remote:{label:"remote",color:"cyan"}};function Dn(e){return Xs[e]??{label:"capability",color:"blue"}}var Js={enabled:"green",draft:"orange",disabled:"default"};function Ji(e){return Js[e]??"default"}var Xi={blue:"#3b82f6",orange:"#f59e0b",green:"#22c55e",purple:"#a855f7",cyan:"#06b6d4"};function Un(e){return Xi[e]??Xi.cyan}function rc(e){let t={enabled:"#22c55e",draft:"#f59e0b",disabled:"#d9d9d9"};return t[e]??t.disabled}function Ln(e){return typeof e.graphDefinition=="object"&&e.graphDefinition!==null?e.graphDefinition:{}}function vr(e){return((Ln(e).metadata??{}).tags??"").split(",").map(r=>r.trim()).filter(Boolean)}function kr(e){let o=(Ln(e).metadata??{}).version;return o?o.startsWith("v")?o:`v${o}`:"v1"}function wr(e){let o=(Ln(e).metadata??{}).status??"enabled";return o==="draft"||o==="disabled"?o:"enabled"}function br(e){let n=Ln(e).subAgents??[],o=Array.isArray(n)?n.filter(Boolean):[];return Array.from(new Set(o))}function ic(e){return e.map(t=>{let n=Ln(t),o=String(n.type??"react");return{id:t.id,name:t.name,description:t.description,type:Dn(o).label,tags:vr(t),version:kr(t),status:wr(t),subAgents:br(t)}})}function ac(e){let t=new Set(e.map(r=>r.id)),n=e.map(r=>({id:r.id,label:r.name,type:Dn(String(Ln(r).type??"react")).label,subAgentCount:br(r).length})),o=[];for(let r of e)for(let i of br(r))t.has(i)&&o.push({source:r.id,target:i});return{nodes:n,edges:o}}var Ee=T(Se());var ie=T(Se());var Ae=T(Se());var U=T(W()),{Text:Ct}=qe,{TextArea:el}=Oe,tl=new Set(["completed","input-required","failed","canceled"]),na=e=>{let t=typeof e=="string"?(()=>{try{return JSON.parse(e)}catch{return null}})():e;return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:{}},ea=e=>na(e.graphDefinition).a2aExposure,Nn=({label:e,code:t})=>{let n=(0,Ae.useCallback)(()=>{(async()=>{try{if(!navigator.clipboard)throw new Error("Clipboard unavailable");await navigator.clipboard.writeText(t),Ke.success("Copied to clipboard")}catch(o){console.error("Failed to copy integration example:",o),Ke.error("Failed to copy")}})()},[t]);return(0,U.jsxs)("div",{style:{marginTop:12},children:[(0,U.jsxs)(vt,{style:{justifyContent:"space-between",width:"100%"},children:[(0,U.jsx)(Ct,{strong:!0,style:{fontSize:12},children:e}),(0,U.jsx)(oe,{size:"small",icon:(0,U.jsx)(fr,{size:13}),onClick:n,children:"Copy"})]}),(0,U.jsx)("pre",{style:{background:"rgba(0,0,0,0.03)",padding:12,borderRadius:10,fontSize:11,lineHeight:1.5,overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:t})]})},ta=()=>typeof sessionStorage<"u"?sessionStorage.getItem("lattice_token"):null;async function nl(e,t){let n=e.getReader(),o=new TextDecoder,r="",i=s=>{let c;try{c=JSON.parse(s)}catch{return}if(c.error){let d=c.error;t({error:String(d.message??"error")});return}let u=(c.result??c).status,p=u?.state;typeof p=="string"&&tl.has(p)&&t({terminalState:p});let a=u?.message?.parts;if(Array.isArray(a)){let d=a.filter(m=>typeof m.text=="string").map(m=>m.text).join("");d&&t({text:d})}};try{for(;;){let{done:s,value:c}=await n.read();if(s)break;r+=o.decode(c,{stream:!0});let l=r.split(`
|
|
2
|
-
`);r=l.pop()??"";for(let u of l)u.startsWith("data:")&&i(u.slice(5).trim())}r.startsWith("data:")&&i(r.slice(5).trim())}finally{n.releaseLock()}}var oa=({assistant:e,onChanged:t,disabled:n=!1,onUpdatingChange:o,persistOnToggle:r=!0})=>{let i=st("__GLOBAL__"),{currentTenant:s,baseURL:c}=po(),{projects:l}=kt(),u=s?.id??"",p=(c??"").trim().replace(/\/+$/,""),[g,a]=(0,Ae.useState)(ea(e)?.enabled===!0),[d,m]=(0,Ae.useState)(null),[y,v]=(0,Ae.useState)(!1),[f,k]=(0,Ae.useState)(null),[I,D]=(0,Ae.useState)("internal"),[R,F]=(0,Ae.useState)(""),[N,E]=(0,Ae.useState)(void 0),[x,G]=(0,Ae.useState)(""),[ue,H]=(0,Ae.useState)(!1),[J,P]=(0,Ae.useState)(""),[B,j]=(0,Ae.useState)(null),[O,te]=(0,Ae.useState)(null),[C,Q]=(0,Ae.useState)(!1),de=(0,Ae.useRef)(0),ye=(0,Ae.useRef)(o);(0,Ae.useEffect)(()=>{ye.current=o},[o]),(0,Ae.useEffect)(()=>()=>{ye.current?.(!1)},[]);let Re=(0,Ae.useRef)(0);(0,Ae.useEffect)(()=>(de.current+=1,Re.current+=1,Q(!1),ye.current?.(!1),H(!1),a(ea(e)?.enabled===!0),m(null),k(null),F(""),E(void 0),G(""),P(""),j(null),te(null),()=>{de.current+=1}),[e,u]);let fe=p?`${p}/api/a2a/agents/${e.id}/.well-known/agent-card.json`:"",_=`${p}/api/a2a/agents/${e.id}/jsonrpc`,A=`-H 'x-tenant-id: ${u||"<TENANT_ID>"}'`,ee={card:`curl --fail-with-body '${fe}' \\
|
|
3
|
-
${A}`,stream:`curl -N -X POST '${_}' \\
|
|
4
|
-
-H 'Authorization: Bearer <A2A_API_KEY>' \\
|
|
5
|
-
-H 'Content-Type: application/json' \\
|
|
6
|
-
-H 'Accept: text/event-stream' \\
|
|
7
|
-
-d '{"jsonrpc":"2.0","id":"request-1","method":"message/stream","params":{"message":{"messageId":"message-1","role":"user","parts":[{"kind":"text","text":"Your message here"}]}}}'`,get:`curl -X POST '${_}' \\
|
|
8
|
-
-H 'Authorization: Bearer <A2A_API_KEY>' \\
|
|
9
|
-
-H 'Content-Type: application/json' \\
|
|
10
|
-
-d '{"jsonrpc":"2.0","id":"request-2","method":"tasks/get","params":{"id":"<TASK_ID>"}}'`,cancel:`curl -X POST '${_}' \\
|
|
11
|
-
-H 'Authorization: Bearer <A2A_API_KEY>' \\
|
|
12
|
-
-H 'Content-Type: application/json' \\
|
|
13
|
-
-d '{"jsonrpc":"2.0","id":"request-3","method":"tasks/cancel","params":{"id":"<TASK_ID>"}}'`,continue:`curl -X POST '${_}' \\
|
|
14
|
-
-H 'Authorization: Bearer <A2A_API_KEY>' \\
|
|
15
|
-
-H 'Content-Type: application/json' \\
|
|
16
|
-
-d '{"jsonrpc":"2.0","id":"request-4","method":"message/send","params":{"message":{"messageId":"message-2","taskId":"<TASK_ID>","role":"user","parts":[{"kind":"text","text":"Your follow-up answer"}]}}}'`,file:`# Add this part to params.message.parts in message/send or message/stream
|
|
17
|
-
{"kind":"file","file":{"name":"report.pdf","mimeType":"application/pdf","bytes":"<BASE64_FILE_CONTENT>"}}`};(0,Ae.useEffect)(()=>{if(!g||!p){m(null),v(!1),k(null);return}let X=!1,ae=new AbortController;return v(!0),k(null),(async()=>{try{let Ie=ta(),Pe={};u&&(Pe["x-tenant-id"]=u),Ie&&(Pe.Authorization=`Bearer ${Ie}`);let je=await fetch(fe,{signal:ae.signal,headers:Object.keys(Pe).length>0?Pe:void 0});if(!je.ok){X||k(je.status===404?"\u672A\u516C\u5F00\u6216\u4E0D\u53EF\u7528":"Failed to load agent card");return}let Me=await je.json();X||m(Me)}catch{X||k("Failed to load agent card")}finally{X||v(!1)}})(),()=>{X=!0,ae.abort()}},[g,fe,u]);let Z=(0,Ae.useCallback)(async X=>{if(n||C)return;let ae=++de.current,be=na(e.graphDefinition),Ie=be.a2aExposure??{},Pe={...be,a2aExposure:{...Ie,enabled:X}},je=g;if(a(X),!r){t?.({...e,graphDefinition:Pe});return}Q(!0),ye.current?.(!0);try{let Me=await i.assistants.update(e.id,{graphDefinition:Pe});ae===de.current&&t?.(Me)}catch(Me){ae===de.current&&(a(je),console.error("Failed to update A2A exposure:",Me),Ke.error("Failed to update A2A exposure"))}finally{ae===de.current&&(Q(!1),ye.current?.(!1))}},[e,n,g,C,r,i,t]),L=(0,Ae.useCallback)(()=>{(async()=>{try{if(!navigator.clipboard)throw new Error("Clipboard unavailable");await navigator.clipboard.writeText(fe),Ke.success("Copied to clipboard")}catch(X){console.error("Failed to copy agent card URL:",X),Ke.error("Failed to copy")}})()},[fe]),K=(0,Ae.useCallback)(async()=>{if(!p||!R.trim()||I==="internal"&&!N||I==="full"&&!x.trim())return;let X=++Re.current,ae=()=>X===Re.current;H(!0),P(""),j(null),te(null);try{let be=I==="internal",Ie=be?`${p}/api/a2a/agents/${e.id}/test-call`:`${p}/api/a2a/agents/${e.id}/jsonrpc`,Pe={"Content-Type":"application/json",Accept:"text/event-stream"},je;if(be){Pe["x-tenant-id"]=u;let _e=ta();_e&&(Pe.Authorization=`Bearer ${_e}`),je=JSON.stringify({projectId:N,message:R.trim()})}else Pe.Authorization=`Bearer ${x.trim()}`,je=JSON.stringify({jsonrpc:"2.0",method:"message/stream",params:{message:{messageId:mr(),role:"user",parts:[{kind:"text",text:R.trim()}]}},id:mr()});let Me=await fetch(Ie,{method:"POST",headers:Pe,body:je});if(!Me.ok||!Me.body){ae()&&te(`Request failed (${Me.status})`);return}await nl(Me.body,_e=>{ae()&&(_e.text&&P(He=>He+_e.text),_e.terminalState&&j(_e.terminalState),_e.error&&te(_e.error))})}catch(be){ae()&&te(be instanceof Error?be.message:"Failed")}finally{ae()&&H(!1)}},[I,R,N,x,e.id,u,p]),ke=l.map(X=>({value:X.id,label:X.name})),M=R.trim().length>0&&(I==="internal"?!!N:x.trim().length>0);return(0,U.jsxs)("div",{children:[(0,U.jsxs)(vt,{align:"center",style:{justifyContent:"space-between",width:"100%",marginBottom:16},children:[(0,U.jsxs)("div",{children:[(0,U.jsx)(Ct,{strong:!0,style:{fontSize:14},children:"Public (A2A)"}),(0,U.jsx)("div",{children:(0,U.jsx)(Ct,{type:"secondary",style:{fontSize:12},children:"Expose this agent over the A2A protocol"})})]}),(0,U.jsx)(ti,{"aria-label":g?"Disable A2A":"Enable A2A",checked:g,disabled:n||C,loading:C,onChange:X=>void Z(X)})]}),g&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{style:{marginBottom:16},children:[(0,U.jsx)(Ct,{strong:!0,style:{fontSize:13},children:"Agent Card URL"}),p?(0,U.jsxs)("div",{style:{display:"flex",gap:8,marginTop:8},children:[(0,U.jsx)(Ct,{code:!0,"data-testid":"a2a-card-url",style:{flex:1,minWidth:0,wordBreak:"break-all",alignSelf:"center"},children:fe}),(0,U.jsx)(oe,{icon:(0,U.jsx)(fr,{size:14}),onClick:L,children:"Copy"})]}):(0,U.jsx)(It,{style:{marginTop:8},type:"warning",showIcon:!0,message:"Gateway URL is not configured"})]}),(0,U.jsxs)("div",{style:{marginBottom:16},children:[(0,U.jsx)(Ct,{strong:!0,style:{fontSize:13},children:"Agent Card"}),(0,U.jsx)("div",{style:{marginTop:8},children:y?(0,U.jsx)(ut,{}):f?(0,U.jsx)(Ct,{type:"danger",children:f}):d?(0,U.jsx)("pre",{"data-testid":"a2a-card-json",style:{background:"rgba(0,0,0,0.03)",padding:12,borderRadius:10,fontSize:12,maxHeight:240,overflow:"auto"},children:JSON.stringify(d,null,2)}):null})]}),(0,U.jsxs)(Xr,{size:"small",title:"Integration Guide","data-testid":"a2a-integration-guide",style:{marginBottom:16},children:[p?(0,U.jsxs)(Ct,{type:"secondary",style:{fontSize:12},children:["Share these examples with the external developer. Use the gateway URL above, not the web UI URL. Replace ",(0,U.jsx)(Ct,{code:!0,children:"<A2A_API_KEY>"}),"with the key shown once when it is created."]}):(0,U.jsx)(It,{type:"warning",showIcon:!0,message:"Configure a gateway URL to generate integration examples."}),p&&(0,U.jsx)(Qr,{ghost:!0,items:[{key:"guide",label:"Copy integration examples",children:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Nn,{label:"1. Discover Agent Card",code:ee.card}),(0,U.jsx)(Nn,{label:"2. Stream a message",code:ee.stream}),(0,U.jsx)(Nn,{label:"3. Query a task",code:ee.get}),(0,U.jsx)(Nn,{label:"4. Cancel a task",code:ee.cancel}),(0,U.jsx)(Nn,{label:"5. Continue input-required",code:ee.continue}),(0,U.jsx)(Nn,{label:"6. Send a file part",code:ee.file})]})}],defaultActiveKey:["guide"]})]}),(0,U.jsxs)("div",{children:[(0,U.jsx)(Ct,{strong:!0,style:{fontSize:13},children:"Try Call"}),(0,U.jsx)("div",{style:{marginTop:8,marginBottom:12},children:(0,U.jsxs)(co.Group,{value:I,onChange:X=>D(X.target.value),children:[(0,U.jsx)(co,{value:"internal",children:"Internal"}),(0,U.jsx)(co,{value:"full",children:"Full chain"})]})}),I==="full"&&(0,U.jsx)(Oe.Password,{"aria-label":"A2A API key",placeholder:"A2A API key",value:x,onChange:X=>G(X.target.value),style:{marginBottom:8}}),(0,U.jsx)(el,{placeholder:"Enter a test message",value:R,onChange:X=>F(X.target.value),autoSize:{minRows:2,maxRows:4},style:{marginBottom:8}}),I==="internal"&&(0,U.jsx)(at,{"aria-label":"Project",placeholder:"Select project",value:N,onChange:X=>E(X),options:ke,style:{width:"100%",marginBottom:8}}),(0,U.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,U.jsx)(oe,{type:"primary",loading:ue,disabled:!p||!M,onClick:()=>void K(),children:"Test Call"}),B&&(0,U.jsx)(Ue,{"data-testid":"a2a-terminal-state",color:B==="completed"?"success":B==="failed"?"error":"warning",children:B})]}),O&&(0,U.jsx)("div",{style:{marginTop:8},children:(0,U.jsx)(Ct,{type:"danger",children:O})}),J&&(0,U.jsx)("pre",{"data-testid":"a2a-result-text",style:{background:"rgba(0,0,0,0.03)",padding:12,borderRadius:10,fontSize:12,marginTop:12,whiteSpace:"pre-wrap"},children:J})]})]})]})};var h=T(W()),{TextArea:ol}=Oe,{Text:At}=qe,ra=["data","execution","workflow","assistant"],rl={data:"Data & Knowledge",execution:"Execution & Interaction",workflow:"Workflow & Orchestration",assistant:"Assistant & Evaluation",other:"Other"},Zn=(e,t)=>{if(Array.isArray(e)){let n=e.map(o=>Zn(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,Zn(o,n)])):e},ia=e=>{if(typeof e!="string")return Zn(e??null);try{return Zn(JSON.parse(e))}catch{return e}},aa=e=>JSON.stringify(Zn({...e,tools:[...e.tools].sort(),subAgents:[...e.subAgents].sort()})),il=Li(({token:e,css:t})=>({modalBody:t`
|
|
18
|
-
padding: 0;
|
|
19
|
-
height: 92vh;
|
|
20
|
-
width: 100%;
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
overflow: hidden;
|
|
24
|
-
`,topbar:t`
|
|
25
|
-
display: flex;
|
|
26
|
-
align-items: center;
|
|
27
|
-
justify-content: space-between;
|
|
28
|
-
padding: 20px 32px;
|
|
29
|
-
border-bottom: 1px solid ${e.colorBorderSecondary};
|
|
30
|
-
background: ${e.colorBgContainer};
|
|
31
|
-
flex-shrink: 0;
|
|
32
|
-
`,topbarLeft:t`
|
|
33
|
-
display: flex;
|
|
34
|
-
align-items: center;
|
|
35
|
-
gap: 16px;
|
|
36
|
-
min-width: 0;
|
|
37
|
-
`,agentName:t`
|
|
38
|
-
font-size: 20px;
|
|
39
|
-
font-weight: 600;
|
|
40
|
-
color: ${e.colorText};
|
|
41
|
-
white-space: nowrap;
|
|
42
|
-
overflow: hidden;
|
|
43
|
-
text-overflow: ellipsis;
|
|
44
|
-
`,agentDesc:t`
|
|
45
|
-
font-size: 13px;
|
|
46
|
-
color: ${e.colorTextSecondary};
|
|
47
|
-
white-space: nowrap;
|
|
48
|
-
overflow: hidden;
|
|
49
|
-
text-overflow: ellipsis;
|
|
50
|
-
max-width: 480px;
|
|
51
|
-
`,layout:t`
|
|
52
|
-
display: flex;
|
|
53
|
-
flex: 1;
|
|
54
|
-
min-height: 0;
|
|
55
|
-
|
|
56
|
-
@media (max-width: 720px) {
|
|
57
|
-
flex-direction: column;
|
|
58
|
-
}
|
|
59
|
-
`,pageHeader:t`
|
|
60
|
-
display: flex;
|
|
61
|
-
align-items: center;
|
|
62
|
-
gap: 16px;
|
|
63
|
-
padding-bottom: 20px;
|
|
64
|
-
border-bottom: 1px solid ${e.colorBorderSecondary};
|
|
65
|
-
margin-bottom: 24px;
|
|
66
|
-
`,pageIcon:t`
|
|
67
|
-
width: 48px;
|
|
68
|
-
height: 48px;
|
|
69
|
-
border-radius: 12px;
|
|
70
|
-
background: ${e.colorPrimaryBg};
|
|
71
|
-
display: flex;
|
|
72
|
-
align-items: center;
|
|
73
|
-
justify-content: center;
|
|
74
|
-
font-size: 22px;
|
|
75
|
-
flex-shrink: 0;
|
|
76
|
-
`,pageName:t`
|
|
77
|
-
font-size: 20px;
|
|
78
|
-
font-weight: 600;
|
|
79
|
-
color: ${e.colorText};
|
|
80
|
-
margin: 0;
|
|
81
|
-
`,pageDesc:t`
|
|
82
|
-
font-size: 13px;
|
|
83
|
-
color: ${e.colorTextSecondary};
|
|
84
|
-
margin: 4px 0 0;
|
|
85
|
-
`,blockTitle:t`
|
|
86
|
-
font-size: 14px;
|
|
87
|
-
font-weight: 600;
|
|
88
|
-
color: ${e.colorTextSecondary};
|
|
89
|
-
margin: 0;
|
|
90
|
-
`,content:t`
|
|
91
|
-
flex: 1;
|
|
92
|
-
min-width: 0;
|
|
93
|
-
overflow-y: auto;
|
|
94
|
-
padding: 32px 40px;
|
|
95
|
-
background: ${e.colorBgLayout};
|
|
96
|
-
|
|
97
|
-
@media (max-width: 720px) {
|
|
98
|
-
padding: 20px 16px;
|
|
99
|
-
}
|
|
100
|
-
`,sectionHeader:t`
|
|
101
|
-
display: flex;
|
|
102
|
-
align-items: flex-end;
|
|
103
|
-
justify-content: space-between;
|
|
104
|
-
margin-bottom: 20px;
|
|
105
|
-
gap: 16px;
|
|
106
|
-
`,sectionTitle:t`
|
|
107
|
-
font-size: 20px;
|
|
108
|
-
font-weight: 600;
|
|
109
|
-
color: ${e.colorText};
|
|
110
|
-
margin: 0;
|
|
111
|
-
`,sectionDesc:t`
|
|
112
|
-
font-size: 13px;
|
|
113
|
-
color: ${e.colorTextSecondary};
|
|
114
|
-
margin: 4px 0 0;
|
|
115
|
-
`,sectionActions:t`
|
|
116
|
-
display: flex;
|
|
117
|
-
align-items: center;
|
|
118
|
-
gap: 12px;
|
|
119
|
-
flex-shrink: 0;
|
|
120
|
-
`,cardGrid:t`
|
|
121
|
-
display: grid;
|
|
122
|
-
grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
|
|
123
|
-
gap: 16px;
|
|
124
|
-
align-items: start;
|
|
125
|
-
|
|
126
|
-
@media (max-width: 720px) {
|
|
127
|
-
grid-template-columns: minmax(0, 1fr);
|
|
128
|
-
}
|
|
129
|
-
`,footer:t`
|
|
130
|
-
display: flex;
|
|
131
|
-
align-items: center;
|
|
132
|
-
justify-content: space-between;
|
|
133
|
-
padding: 16px 32px;
|
|
134
|
-
border-top: 1px solid ${e.colorBorderSecondary};
|
|
135
|
-
background: ${e.colorBgContainer};
|
|
136
|
-
flex-shrink: 0;
|
|
137
|
-
|
|
138
|
-
@media (max-width: 720px) {
|
|
139
|
-
justify-content: flex-end;
|
|
140
|
-
}
|
|
141
|
-
`,footerHint:t`
|
|
142
|
-
font-size: 13px;
|
|
143
|
-
|
|
144
|
-
@media (max-width: 720px) {
|
|
145
|
-
display: none;
|
|
146
|
-
}
|
|
147
|
-
`,selectedCard:t`
|
|
148
|
-
border-color: ${e.colorPrimary} !important;
|
|
149
|
-
background: ${e.colorPrimaryBg} !important;
|
|
150
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
|
|
151
|
-
`,dataSection:t`
|
|
152
|
-
border-top: 1px solid ${e.colorBorderSecondary};
|
|
153
|
-
margin-top: 16px;
|
|
154
|
-
padding-top: 16px;
|
|
155
|
-
`,dataSectionHeader:t`
|
|
156
|
-
display: flex;
|
|
157
|
-
align-items: center;
|
|
158
|
-
justify-content: space-between;
|
|
159
|
-
gap: 8px;
|
|
160
|
-
margin-bottom: 10px;
|
|
161
|
-
`,dataList:t`
|
|
162
|
-
max-height: 240px;
|
|
163
|
-
overflow-y: auto;
|
|
164
|
-
border-radius: 10px;
|
|
165
|
-
background: ${e.colorFillQuaternary};
|
|
166
|
-
padding: 4px 8px;
|
|
167
|
-
`,toolsGrid:t`
|
|
168
|
-
display: grid;
|
|
169
|
-
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
|
170
|
-
gap: 12px;
|
|
171
|
-
align-items: start;
|
|
172
|
-
`,toolDesc:t`
|
|
173
|
-
font-size: 13px;
|
|
174
|
-
line-height: 1.5;
|
|
175
|
-
color: ${e.colorTextSecondary};
|
|
176
|
-
display: -webkit-box;
|
|
177
|
-
-webkit-line-clamp: 1;
|
|
178
|
-
-webkit-box-orient: vertical;
|
|
179
|
-
overflow: hidden;
|
|
180
|
-
`,configGrid:t`
|
|
181
|
-
display: grid;
|
|
182
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
183
|
-
gap: 12px 16px;
|
|
184
|
-
padding: 8px 0;
|
|
185
|
-
`,searchBox:t`
|
|
186
|
-
width: 220px;
|
|
187
|
-
`})),sa=(e,t)=>t?.find(n=>n.type===e),la=({assistant:e,allAssistants:t,visible:n,onClose:o,onSave:r,onDelete:i,embedded:s,initialSection:c="basic",onDirtyChange:l,onOverlayOpenChange:u})=>{let[p]=ve.useForm(),{token:g}=ni.useToken(),{styles:a}=il(),{styles:d}=Ki(),{config:m}=go(),{middlewareTypes:y,isLoading:v}=Eo(m.middlewareTypesEndpoint),{get:f}=nt(),[k,I]=(0,ie.useState)(c),[D,R]=(0,ie.useState)(e),[F,N]=(0,ie.useState)(null),[E,x]=(0,ie.useState)(!0),[G,ue]=(0,ie.useState)(!1),[H,J]=(0,ie.useState)(!1),[P,B]=(0,ie.useState)(!1),[j,O]=(0,ie.useState)(!1),[te,C]=(0,ie.useState)([]),[Q,de]=(0,ie.useState)(""),[ye,Re]=(0,ie.useState)(""),[fe,_]=(0,ie.useState)([]),[A,ee]=(0,ie.useState)([]),[Z,L]=(0,ie.useState)(""),[K,ke]=(0,ie.useState)(!1),[M,X]=(0,ie.useState)("react"),[ae,be]=(0,ie.useState)([]),[Ie,Pe]=(0,ie.useState)({name:"",description:""}),[je,Me]=(0,ie.useState)(""),[_e,He]=(0,ie.useState)(null),[Ve,Rt]=(0,ie.useState)(!1),Fe=(0,ie.useRef)(0),Dt=(0,ie.useRef)(null),Ft=(0,ie.useRef)(!1),Ut=(0,ie.useRef)(l),Zt=(0,ie.useRef)(u);(0,ie.useEffect)(()=>{Ut.current=l},[l]),(0,ie.useEffect)(()=>()=>{Ut.current?.(!1)},[]),(0,ie.useEffect)(()=>{Zt.current=u},[u]),(0,ie.useEffect)(()=>()=>{Zt.current?.(!1)},[]);let zt=(0,ie.useMemo)(()=>aa({form:Ie,agentType:M,tools:fe,subAgents:A,prompt:Z,middleware:ae,graphDefinition:ia(D?.graphDefinition)}),[Ie,M,fe,A,Z,ae,D?.graphDefinition]),Lt=Ve&&zt!==je,Vt=Ve;Ft.current=Lt;let yt=(0,ie.useMemo)(()=>{if(!e?.graphDefinition)return null;try{let b=typeof e.graphDefinition=="string"?JSON.parse(e.graphDefinition):e.graphDefinition;return{tools:b.tools||[],prompt:b.prompt||"",subAgents:b.subAgents||[],type:b.type||"react",middleware:b.middleware||[]}}catch{return null}},[e]),ln=(0,ie.useCallback)(b=>(b||[]).filter($=>$.schema?.properties&&Object.keys($.schema.properties).length>0||$.tools&&$.tools.length>0).map(($,xe)=>({id:`${$.type}-${xe+1}`,type:$.type,name:$.name,description:$.description,enabled:!1,config:{}})),[]),V=(0,ie.useCallback)((b,se)=>{let $=(se||[]).filter(z=>z.schema?.properties&&Object.keys(z.schema.properties).length>0||z.tools&&z.tools.length>0),xe=new Map(b?.map(z=>[z.type,z])||[]),w=$.map((z,ze)=>{let ot=xe.get(z.type);return ot?{...ot,name:z.name,description:z.description}:{id:`${z.type}-${ze+1}`,type:z.type,name:z.name,description:z.description,enabled:!1,config:{}}}),S=new Set($.map(z=>z.type));return[...w,...(b??[]).filter(z=>!S.has(z.type))]},[]),De=(0,ie.useCallback)(async()=>{if(n){ue(!0);try{let b=await f("/api/tools");b.success&&b.data?.records&&C(b.data.records)}catch(b){console.error("Failed to fetch tools:",b)}finally{ue(!1)}}},[f,n]);(0,ie.useEffect)(()=>{if(!n||!e){Dt.current=null,Fe.current+=1,Rt(!1),R(e),He(null);return}if(Dt.current===e||Dt.current?.id===e.id&&Ft.current)return;let b=m.availableMiddlewareTypes;if(!(!b&&v)){Dt.current=e,Fe.current+=1;{De();let se={name:e.name??"",description:e.description??""},$=yt?.tools??[],xe=yt?.subAgents??[],w=yt?.prompt??"",S=yt?.type??"react",z=yt?V(yt.middleware,b||y):ln(b||y);Rt(!1),R(e),Pe(se),_($),ee(xe),L(w),X(S),be(z),p.setFieldsValue({...se,type:S}),He(aa({form:se,agentType:S,tools:$,subAgents:xe,prompt:w,middleware:z,graphDefinition:ia(e.graphDefinition)}))}}},[n,e,Lt,yt,p,De,ln,V,m.availableMiddlewareTypes,v,y]),(0,ie.useEffect)(()=>{_e!==null&&zt===_e&&(Me(_e),He(null),Rt(!0))},[zt,_e]),(0,ie.useEffect)(()=>{l?.(Lt)},[Lt,l]),(0,ie.useEffect)(()=>{Zt.current?.(K||j)},[K,j]);let Ge=async()=>{if(!D||!Vt)return;let b=Fe.current,se=zt;try{J(!0);let xe={...await p.validateFields(),type:M,tools:fe,subAgents:A,prompt:Z,middleware:ae};await r?.(D,xe),Fe.current===b&&Me(se)}catch($){$ instanceof Error&&Ke.error($.message)}finally{J(!1)}},ct=async()=>{if(e){B(!0);try{await i?.(e),O(!1),o()}catch(b){O(!1),Ke.error(b instanceof Error?b.message:"Failed to delete assistant")}finally{B(!1)}}},dn=b=>{be(se=>se.map($=>{if($.id!==b)return $;if($.enabled)return{...$,enabled:!1};{let xe=(m.availableMiddlewareTypes||y)?.find(w=>w.type===$.type);return{...$,enabled:!0,config:xe?.defaultConfig||{}}}}))},io=(b,se)=>{be($=>$.map(xe=>xe.id===b?{...xe,config:{...xe.config,...se}}:xe))},jn=(b,se)=>{be($=>$.map(xe=>xe.id===b?{...xe,allowedTools:se}:xe))},Wt=b=>{let se=fe.includes(b.id);return(0,h.jsx)(ko,{item:b,className:se?a.selectedCard:void 0,onClick:()=>_($=>$.includes(b.id)?$.filter(xe=>xe!==b.id):[...$,b.id]),renderIcon:()=>(0,h.jsx)("span",{style:{fontSize:18,fontWeight:600},children:b.name.charAt(0).toUpperCase()}),renderPrimary:()=>(0,h.jsxs)(vt,{size:6,children:[(0,h.jsx)("span",{children:b.name}),b.needUserApprove&&(0,h.jsx)(Ue,{color:"warning",style:{fontSize:10,padding:"0 4px",margin:0},children:"Approve"})]}),renderDetails:()=>(0,h.jsx)(Ui,{text:b.description,className:a.toolDesc}),renderHeaderActions:()=>(0,h.jsx)(pn,{checked:se,onClick:$=>$.stopPropagation(),onChange:()=>_($=>$.includes(b.id)?$.filter(xe=>xe!==b.id):[...$,b.id])})},b.id)},kn=b=>{let se=A.includes(b.id);return(0,h.jsx)(ko,{item:b,className:se?a.selectedCard:void 0,onClick:()=>ee($=>$.includes(b.id)?$.filter(xe=>xe!==b.id):[...$,b.id]),renderIcon:()=>(0,h.jsx)(dr,{size:36,style:{backgroundColor:se?g.colorPrimary:g.colorSuccess,fontSize:15},children:b.name?.charAt(0).toUpperCase()||"A"}),renderPrimary:()=>b.name,renderSecondary:()=>b.description||"No description",renderHeaderActions:()=>(0,h.jsx)(pn,{checked:se,onClick:$=>$.stopPropagation(),onChange:()=>ee($=>$.includes(b.id)?$.filter(xe=>xe!==b.id):[...$,b.id])})},b.id)},Gn=(0,ie.useCallback)(b=>sa(b.type,m.availableMiddlewareTypes||y)?.category||"other",[m.availableMiddlewareTypes,y]),cn=(0,ie.useMemo)(()=>{let b=new Map;for(let se of ae){let $=Gn(se),xe=b.get($);xe?xe.push(se):b.set($,[se])}return b},[ae,Gn]),ao=(0,ie.useMemo)(()=>{let b=Array.from(cn.keys());return[...ra.filter(se=>cn.has(se)),...b.filter(se=>!ra.includes(se))]},[cn]),Qe=(0,ie.useMemo)(()=>ae.length===0?null:ae.find(b=>b.type===F)??ae.find(b=>b.enabled)??ae[0],[ae,F]);if(!n||!e)return null;let we=[{key:"basic",icon:(0,h.jsx)(gr,{}),label:"Basic Info"},{key:"prompt",icon:(0,h.jsx)(ur,{}),label:"System Prompt"},{key:"tools",icon:(0,h.jsx)(gi,{}),label:"Common Tools",badge:fe.length},{key:"middleware",icon:(0,h.jsx)(li,{}),label:"Capabilities",badge:ae.filter(b=>b.enabled).length},{key:"subagents",icon:(0,h.jsx)(ui,{}),label:"Sub-Agents",badge:A.length},{key:"a2a",icon:(0,h.jsx)(ci,{}),label:"A2A"}],$n=te.filter(b=>b.name.toLowerCase().includes(Q.toLowerCase())||b.description.toLowerCase().includes(Q.toLowerCase())),ht=t.filter(b=>b.id!==e.id),wn=ht.filter(b=>(b.name||"").toLowerCase().includes(ye.toLowerCase())||(b.description||"").toLowerCase().includes(ye.toLowerCase())),un=()=>(0,h.jsxs)("div",{style:{maxWidth:960},children:[(0,h.jsxs)("div",{className:a.pageHeader,children:[(0,h.jsx)("div",{className:a.pageIcon,children:(0,h.jsx)(gr,{})}),(0,h.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,h.jsx)("h2",{className:a.pageName,children:"Basic Info"}),(0,h.jsx)("p",{className:a.pageDesc,children:"Core identity and behavior of this agent"})]})]}),(0,h.jsxs)(ve,{form:p,layout:"vertical",autoComplete:"off",onValuesChange:(b,se)=>Pe({name:se.name??"",description:se.description??""}),children:[(0,h.jsx)(ve.Item,{name:"name",label:(0,h.jsx)(At,{strong:!0,style:{fontSize:14},children:"Name"}),rules:[{required:!0,message:"Please enter agent name"}],style:{marginBottom:24},children:(0,h.jsx)(Oe,{placeholder:"Enter agent name\u2026"})}),(0,h.jsxs)(ve.Item,{name:"type",label:(0,h.jsx)(At,{strong:!0,style:{fontSize:14},children:"Agent Type"}),rules:[{required:!0}],style:{marginBottom:24},children:[(0,h.jsx)(Jr,{value:M,onChange:b=>X(b),options:[{value:"react",label:"Executor"},{value:"deep_agent",label:"Orchestrator"},{value:"team",label:"Team"},{value:"processing",label:"Workflow"}],block:!0}),(0,h.jsx)(At,{type:"secondary",style:{fontSize:13,marginTop:8,display:"block",lineHeight:1.6},children:M==="react"?"Executor: Executes tasks directly using tools. Best for single-step operations like search, code execution, and data retrieval.":M==="deep_agent"?"Orchestrator: Maintains a todo list to plan and delegate tasks to sub-agents. Best for structured multi-step workflows.":M==="processing"?"Workflow: Delegates to sub-agents in a predefined topology order. Best for deterministic multi-step processes.":"Team: Creates tasks with dependencies and dynamically spawns teammates who communicate via mailbox. Best for exploration and divergent thinking."})]}),(0,h.jsx)(ve.Item,{name:"description",label:(0,h.jsx)(At,{strong:!0,style:{fontSize:14},children:"Description"}),rules:[{required:!0,message:"Please enter agent description"}],style:{marginBottom:0},children:(0,h.jsx)(Oe.TextArea,{placeholder:"Enter agent description\u2026",autoSize:{minRows:3,maxRows:6}})})]})]}),so=()=>(0,h.jsxs)("div",{style:{maxWidth:960},children:[(0,h.jsxs)("div",{className:a.pageHeader,children:[(0,h.jsx)("div",{className:a.pageIcon,children:(0,h.jsx)(ur,{})}),(0,h.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,h.jsx)("h2",{className:a.pageName,children:"System Prompt"}),(0,h.jsx)("p",{className:a.pageDesc,children:"Define the agent's behavior, capabilities, and constraints"})]}),(0,h.jsx)(oe,{icon:(0,h.jsx)(mo,{}),onClick:()=>ke(!0),children:"Expand"})]}),(0,h.jsx)(ol,{"aria-label":"System Prompt",value:Z,onChange:b=>L(b.target.value),placeholder:"Enter the system prompt for this agent\u2026",autoSize:{minRows:12,maxRows:24},style:{fontFamily:"monospace",fontSize:13,lineHeight:1.7}}),(0,h.jsx)("div",{style:{marginTop:8,display:"flex",justifyContent:"flex-end"},children:(0,h.jsxs)(At,{type:"secondary",style:{fontSize:12},children:[Z.length," chars"]})})]}),ir=()=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:a.sectionHeader,children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("h2",{className:a.sectionTitle,children:"Common Tools"}),(0,h.jsx)("p",{className:a.sectionDesc,children:"Choose the tools this agent can call directly"})]}),(0,h.jsxs)("div",{className:a.sectionActions,children:[(0,h.jsx)(Oe,{allowClear:!0,prefix:(0,h.jsx)(pr,{}),placeholder:"Search tools\u2026",value:Q,onChange:b=>de(b.target.value),className:a.searchBox}),(0,h.jsxs)(At,{type:"secondary",style:{fontSize:13},children:["Selected ",fe.length," / ",te.length]}),(0,h.jsx)(oe,{size:"small",onClick:()=>_(fe.length===te.length?[]:te.map(b=>b.id)),children:fe.length===te.length?"Clear":"Select All"})]})]}),G?(0,h.jsx)("div",{style:{textAlign:"center",padding:60},children:(0,h.jsx)(ut,{})}):$n.length===0?(0,h.jsx)(Bt,{description:"No tools available",style:{padding:60}}):(0,h.jsx)("div",{className:a.cardGrid,children:$n.map(Wt)})]}),ar=()=>Qe?(0,h.jsx)(Po,{middleware:Qe,middlewareType:sa(Qe.type,m.availableMiddlewareTypes||y),onToggle:()=>dn(Qe.id),onConfigChange:b=>io(Qe.id,b),onAllowedToolsChange:b=>jn(Qe.id,b)},Qe.id):(0,h.jsx)(Bt,{description:"No capabilities available",style:{padding:60}}),sr=()=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:a.sectionHeader,children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("h2",{className:a.sectionTitle,children:"Sub-Agents"}),(0,h.jsx)("p",{className:a.sectionDesc,children:"Choose sub-agents this agent can delegate to"})]}),(0,h.jsxs)("div",{className:a.sectionActions,children:[(0,h.jsx)(Oe,{allowClear:!0,prefix:(0,h.jsx)(pr,{}),placeholder:"Search sub-agents\u2026",value:ye,onChange:b=>Re(b.target.value),className:a.searchBox}),(0,h.jsxs)(At,{type:"secondary",style:{fontSize:13},children:["Selected ",A.length," / ",ht.length]}),(0,h.jsx)(oe,{size:"small",onClick:()=>ee(A.length===ht.length?[]:ht.map(b=>b.id)),children:A.length===ht.length?"Clear":"Select All"})]})]}),ht.length===0?(0,h.jsx)(Bt,{description:"No other agents available",style:{padding:60}}):wn.length===0?(0,h.jsx)(Bt,{description:"No matching results",style:{padding:60}}):(0,h.jsx)("div",{className:a.cardGrid,children:wn.map(kn)})]}),lr={basic:un(),prompt:so(),tools:ir(),middleware:ar(),subagents:sr(),a2a:(0,h.jsx)("div",{style:{maxWidth:960},children:(0,h.jsx)(oa,{assistant:D??e,disabled:H||!Vt,onChanged:R,persistOnToggle:!1})})},lo=(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:a.modalBody,style:s?{height:"100%",width:"100%"}:void 0,children:[!s&&(0,h.jsxs)("div",{className:a.topbar,children:[(0,h.jsxs)("div",{className:a.topbarLeft,children:[(0,h.jsx)(dr,{size:40,style:{backgroundColor:g.colorPrimary,fontSize:18,flexShrink:0},children:e.name?.charAt(0).toUpperCase()||"A"}),(0,h.jsxs)("div",{style:{minWidth:0},children:[(0,h.jsx)("div",{className:a.agentName,children:e.name}),(0,h.jsx)("div",{className:a.agentDesc,children:e.description})]}),(0,h.jsx)(Ue,{color:"blue",style:{margin:0,fontSize:11,flexShrink:0},children:"Config Workbench"})]}),(0,h.jsxs)(vt,{children:[i&&(0,h.jsx)(Yt,{title:"Delete Agent",children:(0,h.jsx)(oe,{"aria-label":"Delete Agent",type:"text",danger:!0,icon:(0,h.jsx)(fo,{}),onClick:()=>O(!0)})}),(0,h.jsx)(oe,{type:"text",icon:(0,h.jsx)(si,{}),onClick:o})]})]}),(0,h.jsxs)("div",{className:a.layout,children:[(0,h.jsx)("div",{className:d.nav,role:"tablist","aria-label":"Agent configuration sections",children:we.map(b=>b.key!=="middleware"?(0,h.jsxs)("button",{type:"button",role:"tab","aria-selected":k===b.key,className:`${d.navItem} ${k===b.key?"active":""}`,onClick:()=>I(b.key),children:[(0,h.jsx)("span",{style:{fontSize:16},children:b.icon}),(0,h.jsx)("span",{children:b.label}),b.badge!==void 0&&b.badge>0&&(0,h.jsx)(cr,{count:b.badge,size:"small",className:d.navBadge,style:{backgroundColor:g.colorPrimary}})]},b.key):(0,h.jsxs)(ie.default.Fragment,{children:[(0,h.jsxs)("button",{type:"button",role:"tab","aria-selected":k==="middleware",className:`${d.navItem} ${k==="middleware"?"active":""}`,onClick:()=>x(se=>!se),children:[(0,h.jsx)("span",{style:{fontSize:16},children:b.icon}),(0,h.jsx)("span",{children:b.label}),b.badge!==void 0&&b.badge>0&&(0,h.jsx)(cr,{count:b.badge,size:"small",className:d.navBadge,style:{backgroundColor:g.colorPrimary}})]}),E&&(0,h.jsx)("div",{className:d.navSub,children:ao.map(se=>(0,h.jsxs)("div",{children:[(0,h.jsx)("div",{className:d.navGroupLabel,children:rl[se]||se}),cn.get(se)?.map($=>(0,h.jsxs)("button",{type:"button",role:"option","aria-selected":k==="middleware"&&F===$.type,className:`${d.navSubItem} ${k==="middleware"&&F===$.type?"active":""}`,onClick:()=>{N($.type),I("middleware")},children:[(0,h.jsx)("span",{className:d.navStatusDot,style:{backgroundColor:$.enabled?g.colorSuccess:g.colorBorder}}),(0,h.jsx)("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:$.name})]},$.id))]},se))})]},"middleware"))}),(0,h.jsx)("div",{className:a.content,children:Vt?lr[k]:(0,h.jsx)("div",{style:{minHeight:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,h.jsxs)(vt,{direction:"vertical",align:"center",children:[(0,h.jsx)(ut,{}),(0,h.jsx)(At,{type:"secondary",children:"Loading agent configuration..."})]})})})]}),(0,h.jsxs)("div",{className:a.footer,children:[(0,h.jsx)(At,{"data-testid":"config-footer-hint",className:a.footerHint,type:Lt?"warning":"secondary",children:Lt?"Unsaved changes":r?"Changes will be saved to this agent":"Viewing agent configuration"}),(0,h.jsxs)(vt,{children:[(0,h.jsx)(oe,{onClick:o,children:"Close"}),r&&(0,h.jsx)(oe,{"aria-label":"Save",type:"primary",icon:(0,h.jsx)(pi,{}),loading:H,disabled:!Vt,onClick:Ge,children:"Save"})]})]})]}),(0,h.jsx)($e,{title:"System Prompt",open:K,onCancel:()=>ke(!1),width:800,footer:[(0,h.jsx)(oe,{onClick:()=>ke(!1),children:"Close"},"cancel"),(0,h.jsx)(oe,{type:"primary",onClick:()=>ke(!1),children:"Done"},"done")],children:(0,h.jsx)(Oe.TextArea,{"aria-label":"System Prompt",value:Z,onChange:b=>L(b.target.value),rows:16,style:{width:"100%",fontFamily:"monospace",fontSize:13,lineHeight:1.7,resize:"vertical",minHeight:300}})}),(0,h.jsx)($e,{title:"Delete Agent",open:j,onCancel:()=>O(!1),footer:[(0,h.jsx)(oe,{onClick:()=>O(!1),children:"Cancel"},"cancel"),(0,h.jsx)(oe,{type:"primary",danger:!0,loading:P,onClick:ct,children:"Delete"},"delete")],children:(0,h.jsxs)(At,{children:["Are you sure you want to delete ",(0,h.jsx)(At,{strong:!0,children:e.name})," ? This action cannot be undone."]})})]});return s?(0,h.jsx)("div",{style:{width:"100%",height:"100%",overflow:"hidden"},children:lo}):(0,h.jsx)($e,{open:n,onCancel:o,width:"88vw",footer:null,closable:!1,centered:!0,styles:{body:{padding:0},content:{borderRadius:20,overflow:"hidden",padding:0},mask:{backdropFilter:"blur(4px)"}},destroyOnHidden:!0,children:lo})};var rt=T(Se());function Do(e,t){return e.find(n=>n.targetServerConfig?.targetAgentId===t)??e.find(n=>n.name===`eval-${t}`)??e.find(n=>typeof n.description=="string"&&n.description.includes(t))??null}var he=T(W()),{Text:al}=qe,sl=e=>e?.page==="suite"&&e.suiteId?.trim()?{page:"suite",suiteId:e.suiteId,runId:""}:e?.page==="run"&&e.runId?.trim()?{page:"run",suiteId:"",runId:e.runId}:{page:"suites",suiteId:"",runId:""},Lo=({assistantId:e,initial:t,navigationKey:n,onEvalInvalidated:o})=>{let{projects:r,loading:i,create:s}=wo(),c=Do(r,e),l=c?.id??"",u=c?.name||`eval-${e}`,p=sl(t),g=`${p.page}\0${p.suiteId}\0${p.runId}`,[a,d]=(0,rt.useState)(p),{page:m,suiteId:y,runId:v}=a;(0,rt.useEffect)(()=>{d(p)},[e,g,n]);let{start:f}=vo(l),{workspaceId:k,projectId:I}=kt(),[D,R]=(0,rt.useState)(!1),{create:F}=Sn(l),[N,E]=(0,rt.useState)(!1),[x,G]=(0,rt.useState)(""),[ue,H]=(0,rt.useState)(0),[J,P]=(0,rt.useState)(!1),[B]=ve.useForm(),[j,O]=(0,rt.useState)(!1),[te,C]=(0,rt.useState)([]),Q=st("__GLOBAL__"),de=(0,rt.useRef)(o);de.current=o;let ye=L=>({workspaceId:k||void 0,projectId:L||I||void 0}),Re=(0,rt.useCallback)(async()=>{let L=Q,K=L.config?.baseURL||L.baseUrl||"";try{let M=await(await fetch(`${K}/api/models`,{headers:{Authorization:`Bearer ${L.config?.apiKey||""}`}})).json();M.success&&C(M.data||[])}catch{}},[Q]),fe=async L=>{O(!0);try{await s({name:`eval-${e}`,judgeModelConfig:{modelKey:L.modelKey||""},targetServerConfig:{base_url:"",api_key:"",targetAgentId:e}}),await Promise.resolve(de.current?.()).catch(()=>{}),B.resetFields(),P(!1)}catch(K){Ke.error(K instanceof Error?K.message:"Failed to create eval project")}finally{O(!1)}},_=(L,K,ke)=>{d(M=>({page:L,suiteId:K??M.suiteId,runId:ke??M.runId}))},A=async()=>{x.trim()&&(await F(l,{name:x.trim()}),H(L=>L+1),await o?.(),G(""),E(!1))},ee=async L=>{let K=await f(l,ye(L.projectId));K?.run_id&&(await Promise.resolve(o?.()).catch(()=>{}),_("run",void 0,K.run_id))},Z=(0,he.jsx)($e,{title:"Create Eval Project",open:J,onCancel:()=>{B.resetFields(),P(!1)},footer:null,destroyOnHidden:!0,width:480,children:(0,he.jsxs)(ve,{form:B,layout:"vertical",onFinish:fe,initialValues:{name:`eval-${e}`},children:[(0,he.jsx)(ve.Item,{name:"name",label:"Project Name",children:(0,he.jsx)(Oe,{disabled:!0})}),(0,he.jsx)(ve.Item,{name:"modelKey",label:"Judge Model",rules:[{required:!0,message:"Please select a judge model"}],children:(0,he.jsx)(at,{placeholder:"Select a registered model",options:te.map(L=>{let K=L;return{value:K.key,label:`${K.displayName||K.key} (${K.model||""})`}})})}),(0,he.jsxs)(ve.Item,{style:{marginBottom:0,textAlign:"right"},children:[(0,he.jsx)(oe,{onClick:()=>{B.resetFields(),P(!1)},style:{marginRight:8},children:"Cancel"}),(0,he.jsx)(oe,{type:"primary",htmlType:"submit",loading:j,children:"Create"})]})]})});return i?(0,he.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,he.jsx)(ut,{})}):c?(0,he.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column",background:"#f5f5f5"},children:[(0,he.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 24px",background:"#fff",borderBottom:"1px solid #f0f0f0",flexShrink:0},children:[(0,he.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10},children:[(0,he.jsx)(di,{style:{color:"#6366f1",fontSize:18}}),(0,he.jsx)("span",{style:{fontSize:15,fontWeight:600},children:u}),(0,he.jsx)(Ue,{color:"purple",children:"eval"})]}),m==="suites"&&(0,he.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,he.jsx)(oe,{icon:(0,he.jsx)(Xt,{}),onClick:()=>E(L=>!L),children:"New Suite"}),(0,he.jsx)(oe,{type:"primary",icon:(0,he.jsx)(ai,{}),onClick:()=>R(!0),children:"Run All"})]})]}),m==="suites"&&N&&(0,he.jsxs)("div",{style:{padding:"12px 24px",borderBottom:"1px solid #f0f0f0",display:"flex",gap:8,background:"#fff"},children:[(0,he.jsx)("input",{type:"text",placeholder:"Suite name",value:x,onChange:L=>G(L.target.value),onKeyDown:L=>L.key==="Enter"&&void A(),autoFocus:!0,style:{width:260,padding:"6px 12px",border:"1px solid #d9d9d9",borderRadius:8,fontSize:14,outline:"none"}}),(0,he.jsx)(oe,{type:"primary",size:"small",onClick:()=>void A(),children:"Create"}),(0,he.jsx)(oe,{size:"small",onClick:()=>E(!1),children:"Cancel"})]}),(0,he.jsxs)("div",{style:{flex:1,overflow:"auto",padding:28},children:[m==="suites"&&(0,he.jsx)(Mi,{projectId:l,onSelectSuite:(L,K)=>_("suite",K),onEvalInvalidated:o},`${l}:${ue}`),m==="suite"&&y&&(0,he.jsx)(Fi,{projectId:l,suiteId:y,onBack:()=>_("suites"),onRun:L=>{Promise.resolve(o?.()).catch(()=>{}),_("run",void 0,L)},onEvalInvalidated:o}),m==="run"&&v&&(0,he.jsx)(zi,{runId:v,onBack:()=>_("suites"),onRunSettled:o})]}),(0,he.jsx)(_i,{open:D,onClose:()=>R(!1),onRun:ee})]}):(0,he.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,background:"#fff"},children:[(0,he.jsx)(Bt,{description:(0,he.jsx)(al,{type:"secondary",children:"This agent has no eval project yet"})}),(0,he.jsx)(oe,{type:"primary",icon:(0,he.jsx)(Xt,{}),onClick:()=>{Re(),P(!0)},children:"Create eval project"}),Z]})};var We=T(Se());var Vn=T(Se());var me=T(W()),{Text:Mn}=qe,da={projectSelector:!1,modelSelector:!1,threadManagement:!0,attachments:!0,hitl:!0,genUI:!0,files:!1},ca=({open:e,assistantId:t,value:n,projects:o,models:r,submitting:i,error:s,onCancel:c,onSubmit:l})=>{let[u]=ve.useForm(),[p,g]=(0,Vn.useState)(!1),[a,d]=(0,Vn.useState)(!1);(0,Vn.useEffect)(()=>{if(!e)return;let f=n?.features??da;g(f.projectSelector),d(f.modelSelector),u.setFieldsValue({name:n?.name??"",description:n?.description,defaultProjectId:n?.scope.defaultProjectId??o[0]?.id,allowedProjectIds:n?.scope.allowedProjectIds??(o[0]?[o[0].id]:[]),defaultModelKey:n?.scope.defaultModelKey,allowedModelKeys:n?.scope.allowedModelKeys,...f,title:n?.appearance.title,welcomeMessage:n?.appearance.welcomeMessage,primaryColor:n?.appearance.primaryColor,identityPolicy:n?.identity?.policy??"unverified",identityIssuers:n?.identity?JSON.stringify(n.identity.issuers,null,2):void 0})},[u,e,o,n]);let m=async()=>{let f=await u.validateFields(),k=f.projectSelector?Array.from(new Set(f.allowedProjectIds??[])):[f.defaultProjectId],I=f.modelSelector?Array.from(new Set([...f.defaultModelKey?[f.defaultModelKey]:[],...f.allowedModelKeys??[]])):f.defaultModelKey?[f.defaultModelKey]:void 0,D,R=f.identityPolicy??"unverified";if(R!=="unverified"){let N;try{N=JSON.parse(f.identityIssuers??"")}catch{throw new Error("Trusted issuers must be a valid JSON array")}if(!Array.isArray(N)||N.length===0)throw new Error("Verified identity requires at least one trusted issuer");D={policy:R,issuers:N}}let F={name:f.name.trim(),description:f.description?.trim()||void 0,scope:{defaultProjectId:f.defaultProjectId,allowedProjectIds:k,defaultModelKey:f.defaultModelKey||void 0,allowedModelKeys:I},features:{projectSelector:f.projectSelector,modelSelector:f.modelSelector,threadManagement:f.threadManagement,attachments:f.attachments,hitl:f.hitl,genUI:f.genUI,files:f.files??!1},appearance:{title:f.title?.trim()||void 0,welcomeMessage:f.welcomeMessage?.trim()||void 0,primaryColor:f.primaryColor?.trim()||void 0},identity:D};await l(n?F:{...F,assistantId:t,integration:{type:"react_sdk"}})},y=o.map(f=>({value:f.id,label:f.name})),v=r.map(f=>({value:f.key,label:f.displayName??f.model??f.key}));return(0,me.jsxs)($e,{title:n?"Edit Web App":"Create Web App",open:e,onCancel:c,onOk:()=>void m().catch(()=>{}),okText:n?"Save":"Create",confirmLoading:i,width:720,destroyOnHidden:!0,children:[s&&(0,me.jsx)("div",{role:"alert",style:{color:"#ef4444",marginBottom:12},children:s}),(0,me.jsxs)(ve,{form:u,layout:"vertical",initialValues:da,children:[(0,me.jsx)(ve.Item,{name:"name",label:"Name",rules:[{required:!0,whitespace:!0},{max:120,message:"Name must be 120 characters or fewer"}],children:(0,me.jsx)(Oe,{"aria-label":"Name",maxLength:121})}),(0,me.jsx)(ve.Item,{name:"description",label:"Description",rules:[{max:1e3,message:"Description must be 1000 characters or fewer"}],children:(0,me.jsx)(Oe.TextArea,{"aria-label":"Description",maxLength:1001})}),(0,me.jsx)(Mn,{strong:!0,children:"Project scope"}),(0,me.jsx)(ve.Item,{name:"projectSelector",valuePropName:"checked",children:(0,me.jsx)(pn,{"aria-label":"Project selector",onChange:f=>g(f.target.checked),children:"Project selector"})}),(0,me.jsx)(ve.Item,{name:"allowedProjectIds",label:"Allowed projects",dependencies:["defaultProjectId","projectSelector"],rules:p?[{required:!0,message:"Select at least one project"},{validator:(f,k)=>(k??[]).every(I=>y.some(D=>D.value===I))?Promise.resolve():Promise.reject(new Error("Select valid allowed projects"))},{validator:(f,k)=>(k??[]).includes(u.getFieldValue("defaultProjectId"))?Promise.resolve():Promise.reject(new Error("Default project must be in allowed projects"))}]:void 0,children:(0,me.jsx)(at,{"aria-label":"Allowed projects",mode:"multiple",disabled:!p,options:y})}),(0,me.jsx)(ve.Item,{name:"defaultProjectId",label:"Default project",rules:[{required:!0},{validator:(f,k)=>!k||y.some(I=>I.value===k)?Promise.resolve():Promise.reject(new Error("Select a valid default project"))}],children:(0,me.jsx)(at,{"aria-label":"Default project",options:y})}),(0,me.jsx)(Mn,{strong:!0,children:"Model scope (optional)"}),(0,me.jsx)(ve.Item,{name:"modelSelector",valuePropName:"checked",children:(0,me.jsx)(pn,{"aria-label":"Model selector",onChange:f=>d(f.target.checked),children:"Model selector"})}),(0,me.jsx)(ve.Item,{name:"allowedModelKeys",label:"Allowed models",dependencies:["defaultModelKey","modelSelector"],rules:a?[{validator:(f,k)=>k?.length||u.getFieldValue("defaultModelKey")?Promise.resolve():Promise.reject(new Error("Select at least one model"))},{validator:(f,k)=>(k??[]).every(I=>v.some(D=>D.value===I))?Promise.resolve():Promise.reject(new Error("Select valid allowed models"))}]:void 0,children:(0,me.jsx)(at,{"aria-label":"Allowed models",mode:"multiple",allowClear:!0,disabled:!a,options:v})}),(0,me.jsx)(ve.Item,{name:"defaultModelKey",label:"Default model",rules:[{validator:(f,k)=>!k||v.some(I=>I.value===k)?Promise.resolve():Promise.reject(new Error("Select a valid default model"))}],children:(0,me.jsx)(at,{"aria-label":"Default model",allowClear:!0,options:v})}),(0,me.jsx)(Mn,{strong:!0,children:"Features"}),(0,me.jsx)(vt,{wrap:!0,children:["threadManagement","attachments","hitl","genUI","files"].map(f=>(0,me.jsx)(ve.Item,{name:f,valuePropName:"checked",noStyle:!0,children:(0,me.jsx)(pn,{"aria-label":f,children:f})},f))}),(0,me.jsx)("div",{style:{marginTop:20},children:(0,me.jsx)(Mn,{strong:!0,children:"Appearance"})}),(0,me.jsx)(ve.Item,{name:"title",label:"Title",rules:[{max:120,message:"Title must be 120 characters or fewer"}],children:(0,me.jsx)(Oe,{"aria-label":"Title",maxLength:121})}),(0,me.jsx)(ve.Item,{name:"welcomeMessage",label:"Welcome message",rules:[{max:1e3,message:"Welcome message must be 1000 characters or fewer"}],children:(0,me.jsx)(Oe.TextArea,{"aria-label":"Welcome message",maxLength:1001})}),(0,me.jsx)(ve.Item,{name:"primaryColor",label:"Primary color",rules:[{pattern:/^#[0-9A-Fa-f]{6}$/,message:"Use a #RRGGBB color",transform:f=>f||void 0}],children:(0,me.jsx)(Oe,{"aria-label":"Primary color",placeholder:"#6366f1"})}),(0,me.jsx)("div",{style:{marginTop:20},children:(0,me.jsx)(Mn,{strong:!0,children:"Identity"})}),(0,me.jsx)(ve.Item,{name:"identityPolicy",label:"Identity policy",initialValue:"unverified",children:(0,me.jsx)(at,{"aria-label":"Identity policy",options:[{value:"unverified",label:"Unverified (header)"},{value:"both",label:"Verified token or header (migration)"},{value:"verified",label:"Verified tokens only"}]})}),(0,me.jsx)(ve.Item,{name:"identityIssuers",label:"Trusted issuers (JSON)",tooltip:'Required when the policy includes verified tokens. Example: [{"iss":"https://host.example.com","aud":"<webAppId>","alg":"HS256","secret":"..."}]',dependencies:["identityPolicy"],rules:[{validator:(f,k)=>{if(u.getFieldValue("identityPolicy")==="unverified"||k===void 0||k.trim()==="")return Promise.resolve();try{let I=JSON.parse(k);return Array.isArray(I)&&I.length>0?Promise.resolve():Promise.reject(new Error("Provide a non-empty JSON array of issuers"))}catch{return Promise.reject(new Error("Trusted issuers must be a valid JSON array"))}}}],children:(0,me.jsx)(Oe.TextArea,{"aria-label":"Trusted issuers",rows:3,placeholder:'[{"iss":"https://host.example.com","aud":"<webAppId>","alg":"HS256","secret":"..."}]'})}),(0,me.jsx)(Mn,{type:"secondary",children:"Integration type: react_sdk"})]})]})};var le=T(W()),{Text:No}=qe,Qn=e=>e instanceof Error?e.message:"Request failed";function ll(e,t){let n=typeof sessionStorage>"u"?null:sessionStorage.getItem("lattice_token"),o=new Headers(t?.headers);return n&&o.set("Authorization",`Bearer ${n}`),o.set("X-Axiom-Web-App-Preview","true"),globalThis.fetch(e,{...t,headers:o})}var Yn=(e,t)=>{let n=`import '@axiom-lattice/react-sdk/web-app/styles.css';
|
|
188
|
-
|
|
189
|
-
interface ExampleProps {
|
|
190
|
-
currentUser: { id: string; name?: string };
|
|
191
|
-
}`,o=r=>`<AgentWebAppProvider gatewayUrl="${t}" webAppId="${e.id}" identity={{ mode: 'unverified', userId: currentUser.id, displayName: currentUser.name }}>
|
|
192
|
-
${r}
|
|
193
|
-
</AgentWebAppProvider>`;return{embed:`<script>
|
|
194
|
-
window.AxiomChatSettings = {
|
|
195
|
-
gatewayUrl: "${t}",
|
|
196
|
-
webAppId: "${e.id}",
|
|
197
|
-
userId: "current-user-id" // stable per-user subject
|
|
198
|
-
};
|
|
199
|
-
<\/script>
|
|
200
|
-
<script src="${t}/embed/agent-chat-loader.js" defer><\/script>`,agentChat:`import { AgentChatApp } from '@axiom-lattice/react-sdk';
|
|
201
|
-
import '@axiom-lattice/react-sdk/styles.css';
|
|
202
|
-
import 'antd/dist/reset.css';
|
|
203
|
-
|
|
204
|
-
interface ExampleProps {
|
|
205
|
-
currentUser: { id: string; name?: string };
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export function AgentChatExample({ currentUser }: ExampleProps) {
|
|
209
|
-
// Runs the full Console chat stack (LatticeChat + thread history) against
|
|
210
|
-
// this web app over the runtime mirror \u2014 npm SDK path with full control.
|
|
211
|
-
return (
|
|
212
|
-
<AgentChatApp
|
|
213
|
-
gatewayUrl="${t}"
|
|
214
|
-
webAppId="${e.id}"
|
|
215
|
-
identity={{ mode: 'unverified', userId: currentUser.id, displayName: currentUser.name }}
|
|
216
|
-
/>
|
|
217
|
-
);
|
|
218
|
-
}`,composable:`import { AgentWebAppProvider, WidgetProjectSelector, WidgetThreadList, WidgetMessageList, WidgetComposer } from '@axiom-lattice/react-sdk/web-app';
|
|
219
|
-
${n}
|
|
220
|
-
|
|
221
|
-
export function ComposableExample({ currentUser }: ExampleProps) {
|
|
222
|
-
return (
|
|
223
|
-
${o(` <main>
|
|
224
|
-
<WidgetProjectSelector />
|
|
225
|
-
<WidgetThreadList />
|
|
226
|
-
<WidgetMessageList />
|
|
227
|
-
<WidgetComposer />
|
|
228
|
-
</main>`)}
|
|
229
|
-
);
|
|
230
|
-
}`,hooks:`import { AgentWebAppProvider, useAgentWebApp, useWidgetProject, useWidgetThreads, useWidgetChat } from '@axiom-lattice/react-sdk/web-app';
|
|
231
|
-
${n}
|
|
232
|
-
|
|
233
|
-
function RuntimeStatus() {
|
|
234
|
-
const runtime = useAgentWebApp();
|
|
235
|
-
const project = useWidgetProject();
|
|
236
|
-
const threads = useWidgetThreads();
|
|
237
|
-
const chat = useWidgetChat();
|
|
238
|
-
return <p>{runtime.bootstrap?.webApp.name}: {project.projectId ?? 'No project'}, {threads.threads.length} threads, {chat.messages.length} messages</p>;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export function HooksExample({ currentUser }: ExampleProps) {
|
|
242
|
-
return (
|
|
243
|
-
${o(" <RuntimeStatus />")}
|
|
244
|
-
);
|
|
245
|
-
}`}},Mo={whiteSpace:"pre-wrap",overflow:"auto",background:"#111827",color:"#e5e7eb",padding:16,borderRadius:10},dl=[{name:"webAppId",type:"string \xB7 required",description:"Publication id (not the Agent id). Missing \u2192 the loader warns and does not start."},{name:"userId",type:"string \xB7 required",description:"Stable per-user subject. ^[A-Za-z0-9._:@-]+$, \u2264128 chars. Missing/invalid \u2192 the chat does not start and onError fires with USER_ID_REQUIRED."},{name:"gatewayUrl",type:"string",description:"Gateway URL (defaults to the loader script's own origin). Trailing slashes are trimmed."},{name:"mode",type:'"bubble" | "inline"',description:"Bubble popup (default) or embed into the containerSelector element."},{name:"containerSelector",type:"string",description:"Required for inline mode. Falls back to body with a console warning when not found."},{name:"bubble",type:"boolean \xB7 default true",description:"false = no launcher button; drive the panel with open()/hide()."},{name:"width / height",type:"number \xB7 380 / 640",description:"Bubble panel size, clamped to the viewport (min 240)."},{name:"position",type:'"bottom-right" | "bottom-left"',description:"Horizontal anchor for the launcher and panel."},{name:"offsetX / offsetY",type:"number \xB7 20",description:"Viewport margin. Nested form also supported: offset: { x, y }."},{name:"zIndex",type:"number \xB7 9999",description:"Panel stacking (the launcher sits at zIndex + 1)."}],cl=[{api:"AxiomChat.open() / hide() / toggle()",behavior:"Show, hide, or toggle the panel. No-ops in inline mode (the chat is always visible in its container)."},{api:"AxiomChat.sendMessage(text)",behavior:"Send a message programmatically \u2014 rendered in the UI like a typed message and streamed from the server. Trimmed non-empty, \u226432768 chars; automatically queued while the chat is busy; before onReady it is buffered and flushed on ready. Send failures show the chat's own inline error banner."}],ul=[{event:'["onReady", cb]',payload:"\u2014",when:"The chat can send/receive (handshake complete, thread ready). Buffered sends flush immediately after."},{event:'["onMessage", cb]',payload:'{ role: "human" | "ai", content: string }',when:"Per accepted message: your sent message (server echo) and each completed AI reply (final text \u2014 not per-token). Boot-time history is not replayed; the baseline resets per thread. Structured content is not included."},{event:'["onError", cb]',payload:"{ code: string, message: string }",when:"WEB_APP_NOT_FOUND \xB7 WEB_APP_DISABLED \xB7 USER_ID_REQUIRED \xB7 PROJECT_NOT_ALLOWED \xB7 MODEL_NOT_ALLOWED \xB7 FEATURE_DISABLED \xB7 INVALID_REQUEST \xB7 STREAM_FAILED"}],ua=({assistant:e})=>{let t=st("__GLOBAL__"),{user:n,currentTenant:o,baseURL:r}=po(),{projects:i}=kt(),[s,c]=(0,We.useState)([]),[l,u]=(0,We.useState)([]),[p,g]=(0,We.useState)(!1),[a,d]=(0,We.useState)(null),[m,y]=(0,We.useState)(null),[v,f]=(0,We.useState)(null),[k,I]=(0,We.useState)(!1),[D,R]=(0,We.useState)(null),[F,N]=(0,We.useState)(!1),[E,x]=(0,We.useState)(!1),[G,ue]=(0,We.useState)(null),[H,J]=(0,We.useState)(null),P=(0,We.useRef)(0),B=(0,We.useRef)(0),j=(0,We.useRef)(0),O=(0,We.useRef)(!1),te=Array.from(new Map(i.map(_=>[_.id,_])).values()),C=(0,We.useCallback)(async()=>{let _=++P.current;g(!0),d(null);try{let A=await t.webApps.list({assistantId:e.id});_===P.current&&c(A.records)}catch(A){_===P.current&&d(Qn(A))}finally{_===P.current&&g(!1)}},[e.id,t,o?.id]);(0,We.useEffect)(()=>(c([]),y(null),R(null),ue(null),J(null),I(!1),N(!1),x(!1),O.current=!1,j.current+=1,C(),()=>{P.current+=1,j.current+=1}),[C]),(0,We.useEffect)(()=>{let _=++B.current;return t.request("/api/models").then(A=>{_===B.current&&u(A.data??[])}).catch(()=>{_===B.current&&u([])}),()=>{B.current+=1}},[t]);let Q=async _=>{if(O.current)return;O.current=!0,x(!0);let A=++j.current;d(null);try{await _(),A===j.current&&await C()}catch(ee){A===j.current&&d(Qn(ee))}finally{A===j.current&&(O.current=!1,x(!1))}},de=async _=>{if(O.current)return;O.current=!0,x(!0);let A=++j.current;I(!0),f(null);try{m==="create"?await t.webApps.create(_):m&&await t.webApps.update(m.id,_),A===j.current&&(y(null),await C())}catch(ee){A===j.current&&f(Qn(ee))}finally{A===j.current&&(O.current=!1,x(!1),I(!1))}},ye=async _=>{d(null);try{if(!navigator.clipboard)throw new Error("Clipboard unavailable");await navigator.clipboard.writeText(_)}catch(A){d(Qn(A))}},Re=_=>[{key:"edit",icon:Ii,label:"Edit",disabled:E,onClick:y},{key:"toggle",icon:_.status==="active"?fi:yi,label:_.status==="active"?"Disable":"Enable",disabled:E,onClick:A=>void Q(()=>A.status==="active"?t.webApps.disable(A.id):t.webApps.enable(A.id))},{key:"preview",icon:wi,label:"Preview",disabled:E,onClick:ue},{key:"guide",icon:bi,label:"Integration guide",disabled:E,onClick:J},{key:"copy",icon:hi,label:"Copy Web App ID",disabled:E,onClick:A=>void ye(A.id)},{key:"delete",icon:Ei,label:"Delete",danger:!0,disabled:E,onClick:R}],fe=async()=>{if(!D||O.current)return;O.current=!0,x(!0);let _=++j.current;N(!0);try{await t.webApps.delete(D.id),_===j.current&&(R(null),await C())}catch(A){_===j.current&&d(Qn(A))}finally{_===j.current&&(O.current=!1,x(!1),N(!1))}};return(0,le.jsxs)("div",{style:{height:"100%",overflow:"auto",padding:16},children:[(0,le.jsx)(It,{type:"warning",showIcon:!0,message:"Unverified identity",description:"Web Apps trust the external user ID supplied by the embedding application. Do not use it as proof of authentication.",style:{marginBottom:16}}),a&&(0,le.jsx)(It,{role:"alert",type:"error",message:a,action:(0,le.jsx)(oe,{size:"small",onClick:()=>void C(),children:"Retry"}),style:{marginBottom:16}}),(0,le.jsx)(Oi,{title:"Web Apps",itemName:"app",items:s,loading:p,keyExtractor:_=>_.id,createLabel:E?void 0:"Create Web App",onCreateClick:E?void 0:()=>{f(null),y("create")},renderIcon:()=>(0,le.jsx)(ki,{size:22,color:"#6366f1"}),renderPrimary:_=>_.name,renderSecondary:_=>_.description??_.id,renderHeaderActions:_=>(0,le.jsx)(Ue,{color:_.status==="active"?"green":_.status==="disabled"?"default":"gold",children:_.status}),renderDetails:_=>(0,le.jsxs)(No,{type:"secondary",children:[_.scope.allowedProjectIds.length," project",_.scope.allowedProjectIds.length===1?"":"s"," \xB7 react_sdk"]}),itemActions:Re,actionsPosition:"always",showViewToggle:!1,emptyTitle:"No Web Apps",emptyDescription:"Create a React SDK publication for this agent."}),(0,le.jsx)(ca,{open:m!==null,assistantId:e.id,value:m==="create"?null:m,projects:te,models:l,submitting:k,error:v,onCancel:()=>y(null),onSubmit:de}),(0,le.jsx)($e,{title:"Delete Web App",open:D!==null,onCancel:()=>R(null),onOk:()=>void fe(),okText:"Delete",okButtonProps:{danger:!0,loading:F},children:(0,le.jsxs)("p",{children:["Delete \u201C",D?.name,"\u201D? This action cannot be undone."]})}),(0,le.jsx)($e,{title:"Preview",open:G!==null,onCancel:()=>ue(null),footer:(0,le.jsx)(oe,{onClick:()=>ue(null),children:"Close"}),width:900,children:r?G&&G.status==="active"?(0,le.jsx)("iframe",{src:`${r}/api/web-apps/${G.id}/chat?mode=embed`,title:"Web App preview",style:{width:"100%",height:640,border:"1px solid #d9d9d9",borderRadius:8}}):G?(0,le.jsxs)("div",{children:[(0,le.jsx)(It,{type:"info",showIcon:!0,message:"Draft preview",description:"This renders the in-page console chat so you can inspect draft content. Enable the publication to preview the exact embed experience external users get.",style:{marginBottom:16}}),(0,le.jsx)(Yi,{gatewayUrl:r,webAppId:G.id,identity:{mode:"unverified",userId:`console-preview:${n?.id??"unknown"}:${G.id}`,displayName:n?.name},fetch:ll})]}):null:(0,le.jsx)(It,{type:"warning",message:"Gateway URL unavailable"})}),(0,le.jsx)($e,{title:"Integration guide",open:H!==null,onCancel:()=>J(null),footer:(0,le.jsxs)(vt,{children:[(0,le.jsx)(oe,{onClick:()=>H&&void ye(Object.values(Yn(H,r)).join(`
|
|
246
|
-
|
|
247
|
-
`)),children:"Copy examples"}),(0,le.jsx)(oe,{type:"primary",onClick:()=>J(null),children:"Close"})]}),width:900,children:H&&(0,le.jsx)(Yr,{defaultActiveKey:"zero-code",items:[{key:"zero-code",label:"Zero-code script loader",children:(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(qe.Paragraph,{type:"secondary",style:{marginTop:0},children:"One script tag \u2014 the full Console-style chat runs in an isolated iframe on the gateway origin. No build step, no npm install."}),(0,le.jsx)("pre",{style:Mo,children:Yn(H,r).embed}),(0,le.jsx)(qe.Title,{level:5,style:{marginTop:24},children:"Configuration \u2014 window.AxiomChatSettings"}),(0,le.jsx)(uo,{size:"small",style:{marginBottom:8},pagination:!1,rowKey:"name",columns:[{title:"Key",dataIndex:"name",key:"name",width:160},{title:"Type",dataIndex:"type",key:"type",width:180},{title:"Description",dataIndex:"description",key:"description"}],dataSource:dl}),(0,le.jsx)(qe.Title,{level:5,children:"JS API \u2014 window.AxiomChat"}),(0,le.jsxs)(qe.Paragraph,{type:"secondary",children:["Property and command forms are equivalent; register callbacks or actions before the loader loads with the array form (",'window.AxiomChat = [["onMessage", fn], ["open"]]'," \u2014 replayed in order on load)."]}),(0,le.jsx)(uo,{size:"small",style:{marginBottom:8},pagination:!1,rowKey:"api",columns:[{title:"API",dataIndex:"api",key:"api",width:280},{title:"Behavior",dataIndex:"behavior",key:"behavior"}],dataSource:cl}),(0,le.jsx)(qe.Title,{level:5,children:"Events"}),(0,le.jsx)(uo,{size:"small",style:{marginBottom:8},pagination:!1,rowKey:"event",columns:[{title:"Register",dataIndex:"event",key:"event",width:220},{title:"Payload",dataIndex:"payload",key:"payload",width:280},{title:"When",dataIndex:"when",key:"when"}],dataSource:ul}),(0,le.jsx)(It,{style:{marginTop:8},type:"warning",showIcon:!0,message:"Host trust and limits",description:"The host page can send messages and read new conversation content \u2014 only embed on trusted pages. One streaming reply at a time; loading the loader twice is unsupported. Not available yet: unread callbacks, runtime theme updates, verified setIdentity, token-level streaming events."})]})},{key:"npm-sdk",label:"npm SDK",children:(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(qe.Paragraph,{type:"secondary",style:{marginTop:0},children:"React applications \u2014 the same chat stack as a first-class component in your page, fully composable."}),(0,le.jsx)(No,{strong:!0,children:"Full chat \u2014 AgentChatApp"}),(0,le.jsx)("pre",{style:Mo,children:Yn(H,r).agentChat}),(0,le.jsx)(No,{strong:!0,children:"Composable widgets"}),(0,le.jsx)("pre",{style:Mo,children:Yn(H,r).composable}),(0,le.jsx)(No,{strong:!0,children:"Hooks"}),(0,le.jsx)("pre",{style:Mo,children:Yn(H,r).hooks})]})}]})})]})};var q=T(Se());var pl={agent:{color:"agent"},tool:{color:"#06b6d4",section:"tools"},capability:{color:"#6366f1",section:"middleware"},subagent:{color:"#22c55e",section:"subagents"},skill:{color:"#a855f7",section:"skills"},model:{color:"#8c8c8c"},eval:{color:"#f59e0b"}};function Oo(e){let t=pl[e];return e==="agent"?"agent":t.color}function gl(e){return typeof e=="object"&&e!==null?e:{}}var xr=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[];function pa(e,t){let n=gl(e),o=typeof n.key=="string"?n.key:"agent",r=n.type??"capability",i={id:o,type:"agent",label:n.name||o,description:n.description||void 0,config:{name:n.name||o,type:r,description:n.description||"",modelKey:n.modelKey||"",prompt:n.prompt||"",version:n.metadata?.version||""}},s=(d,m,y,v,f)=>({id:m,type:d,label:y,description:v,config:f}),c=xr(n.tools).map(d=>s("tool",`tool:${d}`,d)),l=(Array.isArray(n.middleware)?n.middleware:[]).filter(d=>d.enabled!==!1).map(d=>{let m=typeof d.type=="string"?d.type:"unknown";return s("capability",`cap:${m}`,d.name||m,d.description||void 0,d)}),u=xr(n.subAgents).map(d=>s("subagent",`sub:${d}`,d)),p=xr(n.skills).map(d=>s("skill",`skill:${d}`,d)),g=[{id:"group:tools",type:"tool",label:"Tools",items:c},{id:"group:capabilities",type:"capability",label:"Capabilities",items:l},{id:"group:subagents",type:"subagent",label:"Sub-Agents",items:u},{id:"group:skills",type:"skill",label:"Skills",items:p}],a=t?.includeEmptyGroups?g:g.filter(d=>d.items.length>0);return{agent:i,groups:a}}var ga=T(W()),Xn=({id:e,position:t,type:n="source"})=>(0,ga.jsx)(St,{id:e,type:n,position:t,style:{opacity:0,width:0,height:0,border:"none"},isConnectable:!1});var Jt=T(W()),_o={agent:(0,Jt.jsx)(Kn,{size:14}),tool:(0,Jt.jsx)(Pi,{size:12}),capability:(0,Jt.jsx)(mi,{size:12}),subagent:(0,Jt.jsx)(Kn,{size:12}),skill:(0,Jt.jsx)(xi,{size:12}),model:(0,Jt.jsx)(vi,{size:12}),eval:(0,Jt.jsx)(ho,{size:12})},fa={agent:"Agent",tool:"Tool",capability:"Capability",subagent:"Sub-Agent",skill:"Skill",model:"Model",eval:"Eval Suite"};var Ce=T(W()),ma=({type:e="source"})=>(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)(Xn,{id:"top",position:lt.Top,type:e}),(0,Ce.jsx)(Xn,{id:"bottom",position:lt.Bottom,type:e}),(0,Ce.jsx)(Xn,{id:"left",position:lt.Left,type:e}),(0,Ce.jsx)(Xn,{id:"right",position:lt.Right,type:e})]}),ya=({data:e})=>{let{node:t,onClick:n}=e,o=Un(Dn(String(t.config?.type??"react")).color),r=t.config??{};return(0,Ce.jsxs)("div",{onClick:n,style:{width:220,background:"#fff",border:`2px solid ${o}`,borderRadius:14,padding:"10px 12px",cursor:"pointer",fontFamily:"inherit"},children:[(0,Ce.jsx)(ma,{type:"source"}),(0,Ce.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[_o.agent,(0,Ce.jsx)("span",{style:{fontSize:13,fontWeight:700,color:"#333",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.label})]}),r.description&&(0,Ce.jsx)("div",{style:{fontSize:11,color:"rgba(0,0,0,0.55)",marginBottom:6,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:r.description}),(0,Ce.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:6},children:[(0,Ce.jsx)(Ue,{bordered:!1,style:{margin:0,fontSize:10,background:`${o}1A`,color:o},children:r.type??"capability"}),r.modelKey&&(0,Ce.jsx)(Ue,{bordered:!1,style:{margin:0,fontSize:10},children:r.modelKey}),r.version&&(0,Ce.jsxs)(Ue,{bordered:!1,style:{margin:0,fontSize:10},children:["v",r.version]})]}),r.prompt&&(0,Ce.jsx)("div",{style:{fontSize:10,color:"#999",background:"#fafafa",borderRadius:6,padding:"4px 8px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.prompt})]})},ha=({data:e})=>{let{group:t,onClick:n,onRemove:o}=e,r=Oo(t.type);return(0,Ce.jsxs)("div",{style:{border:`1.5px dashed ${r}66`,borderRadius:12,padding:"10px 12px",background:"rgba(255,255,255,0.8)",minWidth:170},children:[(0,Ce.jsx)(ma,{type:"target"}),(0,Ce.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:5,marginBottom:8},children:[_o[t.type],(0,Ce.jsx)("span",{style:{fontSize:11,fontWeight:600,color:"#666"},children:t.label}),(0,Ce.jsxs)("span",{style:{fontSize:10,color:"#bbb"},children:["(",t.items.length,")"]})]}),t.items.length===0?(0,Ce.jsx)("div",{style:{fontSize:10,color:"#bbb",padding:"2px 0"},children:"empty"}):(0,Ce.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:t.items.map(i=>(0,Ce.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,Ce.jsxs)("div",{onClick:s=>{s.stopPropagation(),n?.(i)},style:{display:"flex",alignItems:"center",gap:5,padding:"4px 8px",borderRadius:8,background:"#fff",border:`1px solid ${r}55`,fontSize:11,color:"#333",cursor:"pointer",position:"relative",whiteSpace:"nowrap"},children:[_o[i.type],(0,Ce.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:i.label})]}),o&&(0,Ce.jsx)("button",{onClick:s=>{s.stopPropagation(),o(i)},title:`Remove ${i.label}`,style:{width:14,height:14,borderRadius:"50%",border:"none",background:"transparent",color:"#ccc",fontSize:9,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,flexShrink:0},children:"\u2715"})]},i.id))})]})};var $t=T(Se());function jt(e,t){let n=new Date(e.createdAt).getTime(),o=new Date(t.createdAt).getTime(),r=Number.isFinite(n),i=Number.isFinite(o);return r&&!i?-1:!r&&i?1:r&&i&&n!==o?n-o:e.id<t.id?-1:e.id>t.id?1:0}function ba(e){return{runId:e.id,score:e.avgScore,passRate:e.totalCases>0?Math.round(e.passedCases/e.totalCases*100):null,createdAt:e.createdAt,...e.taskId?{taskId:e.taskId}:{}}}function va(e,t=1){let n=Number.isFinite(t)?Math.abs(t):1,o=e.filter(m=>Number.isFinite(m.avgScore)&&Number.isFinite(new Date(m.createdAt).getTime())).sort(jt),r=o.filter(m=>m.status==="completed"&&!m.holdout),i=r[r.length-1],s=i?.envProjectId!==void 0,l=(s?r.filter(m=>m.envProjectId===i.envProjectId):r).map(ba),u=o.filter(m=>m.status==="completed"&&m.holdout).map(ba),p=l[l.length-1],g=l[l.length-2],a=p&&g?p.score-g.score:null,d="needs-evidence";return a!==null&&(d=a>n?"improving":a<-n?"regressed":"stable"),{verdict:d,latest:p,previous:g,delta:a,passRate:p?.passRate??null,comparisonLabel:s?"Latest comparable result":"Latest recorded result",trend:l,validationTrend:u,runningRuns:o.filter(m=>m.status==="running"),failedRuns:o.filter(m=>m.status==="failed"||m.status==="aborted")}}var Gt=T(Se()),ka=T(W()),gn=({option:e,height:t=200,onEvents:n})=>{let o=(0,Gt.useRef)(null),r=(0,Gt.useRef)(null),i=(0,Gt.useRef)(e),s=(0,Gt.useRef)(n);return(0,Gt.useEffect)(()=>{i.current=e,r.current?.setOption(e,!0)},[e]),(0,Gt.useEffect)(()=>{s.current=n;let c=r.current;if(!c||!n)return;let l=Object.entries(n);for(let[u,p]of l)c.on(u,p);return()=>{for(let[u,p]of l)c.off(u,p)}},[n]),(0,Gt.useEffect)(()=>{let c=!1,l=null;return(async()=>{let u=await import("./embed-page-echarts-7KZDMH4F.js");if(c||!o.current)return;let p=u.init(o.current);r.current=p,p.setOption(i.current,!0);let g=s.current;if(g)for(let[a,d]of Object.entries(g))p.on(a,d);l=new ResizeObserver(()=>r.current?.resize()),l.observe(o.current)})().catch(u=>{console.error("[EChart] async init failed:",u)}),()=>{c=!0,l?.disconnect(),r.current?.dispose(),r.current=null}},[]),(0,ka.jsx)("div",{ref:o,style:{width:"100%",height:t}})};var Sa=T(W()),wa={total:0,last7d:0,last30d:0,lastActive:null,daily7d:[],daily30d:[],loading:!0,error:null},Tr=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),xa=(e,t)=>{if(!(typeof e=="string"||typeof e=="number"||e instanceof Date))return null;let n=new Date(e).getTime();return Number.isFinite(n)&&n<=t?n:null},fl=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),Ta=e=>{let t=fl(e);return Math.floor(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())/864e5)},ml=(e,t)=>Ta(e)-Ta(t);function Ra(e){let{get:t}=nt(),[n,o]=$t.default.useState(wa),r=$t.default.useRef(0),i=$t.default.useRef(e);return i.current=e,$t.default.useEffect(()=>{let s=++r.current,c=!0,l=()=>c&&r.current===s&&i.current===e;return o(u=>({...u,loading:!0,error:null})),(async()=>{try{let u=await t(`/api/assistants/${e}/threads`);if(!Tr(u)||u.success!==!0||!Tr(u.data))throw new Error("Invalid thread list response");let{records:p,total:g}=u.data;if(!Array.isArray(p)||typeof g!="number"||!Number.isSafeInteger(g)||g<0)throw new Error("Invalid thread list response");let a=Date.now(),d=new Date(a),m=null,y=0,v=0,f=new Array(7).fill(0),k=new Array(30).fill(0);for(let I of p){if(!Tr(I))continue;let D=xa(I.createdAt,a);if(D!==null){let F=ml(d,new Date(D));F>=0&&F<7&&(y++,f[6-F]++),F>=0&&F<30&&(v++,k[29-F]++)}let R=xa(I.updatedAt,a);R!==null&&(m===null||R>m)&&(m=R)}if(!l())return;o({total:g,last7d:y,last30d:v,lastActive:m===null?null:new Date(m),daily7d:f,daily30d:k,loading:!1,error:null})}catch(u){if(!l())return;o({...wa,loading:!1,error:u instanceof Error?u:new Error("Failed to load thread activity")})}})(),()=>{c=!1,r.current===s&&r.current++}},[t,e]),n}function Fo(e){if(!e)return"\u2014";let t=Date.now()-e.getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;let o=Math.floor(n/60);if(o<24)return`${o}h ago`;let r=Math.floor(o/24);return r<30?`${r}d ago`:r<365?`${Math.floor(r/30)}mo ago`:`${Math.floor(r/365)}y ago`}function zo(e){let{projects:t,loading:n,error:o,refresh:r}=wo(),i=Do(t,e),s=i?.id??"",{suites:c,loading:l,error:u,refresh:p}=Sn(s),{runs:g,inventoryProjectId:a,loading:d,error:m,refresh:y}=vo(s),v=(0,$t.useCallback)(async()=>{await Promise.all([r(),p(),y()])},[r,p,y]);return{...(0,$t.useMemo)(()=>{let k=c.reduce((N,E)=>N+(E.caseCount??0),0),I=a===s?g.filter(N=>N.projectId===s):[],D=[...I].sort(jt),R=va(I),F=R.latest?I.find(N=>N.id===R.latest?.runId):void 0;return{evalProjectId:i?.id,inventoryProjectId:a,suiteCount:c.length,caseCount:k,scores:R.trend.map(N=>N.score),latest:F,runs:D,runCount:I.length,passRate:R.passRate,score:R.latest?.score??null,hasEvalProject:!!i,suiteNames:c.map(N=>N.name??"Unnamed").filter(Boolean),error:o??u??m,loading:!!(n||s&&(a!==s||l||d))}},[c,g,a,i,s,n,l,d,o,u,m]),refresh:v,refreshRuns:y}}var yl=(e,t=new Date)=>{let n=[];for(let o=e-1;o>=0;o--){let r=new Date(t.getFullYear(),t.getMonth(),t.getDate()-o);n.push([String(r.getFullYear()).padStart(4,"0"),String(r.getMonth()+1).padStart(2,"0"),String(r.getDate()).padStart(2,"0")].join("-"))}return n},hl=e=>yl(e).map(t=>t.slice(5)),bl="#6366f1";var vl={left:8,right:8,top:24,bottom:24,containLabel:!0};function Ia(e){return{grid:vl,tooltip:{trigger:"axis"},xAxis:{type:"category",data:hl(e.length),axisLabel:{fontSize:9,interval:4,color:"#999"},axisLine:{lineStyle:{color:"#eee"}}},yAxis:{type:"value",minInterval:1,axisLabel:{fontSize:9,color:"#999"},splitLine:{lineStyle:{color:"#f5f5f5"}}},series:[{type:"bar",data:e,itemStyle:{color:bl,borderRadius:[2,2,0,0]},barMaxWidth:10}]}}var eo=T(Se());var fn=T(W()),Ca=({values:e,width:t=120,height:n=32,color:o="#6366f1",placeholderColor:r="#e5e5e5"})=>{if(e.length===0)return null;let i=Math.max(...e,1),s=t/e.length,c=s>4?1:0,l=2;return(0,fn.jsx)("svg",{width:t,height:n,style:{display:"block"},children:e.map((u,p)=>{let g=Math.max(u/i*n,l);return(0,fn.jsx)("rect",{x:p*s,y:n-g,width:Math.max(s-c,1),height:g,fill:u===0?r:o,rx:1},p)})})},Aa=({values:e,width:t=200,height:n=40,color:o="#6366f1"})=>{if(e.length===0)return null;let r=Math.min(...e),s=Math.max(...e)-r||1,c=2,l=t-c*2,u=a=>e.length===1?t/2:c+a/(e.length-1)*l,p=a=>n-2-(a-r)/s*(n-4),g=e.map((a,d)=>`${u(d)},${p(a)}`).join(" ");return(0,fn.jsxs)("svg",{width:t,height:n,style:{display:"block"},children:[(0,fn.jsx)("polyline",{points:g,fill:"none",stroke:o,strokeWidth:"1.5",strokeLinecap:"round"}),e.map((a,d)=>(0,fn.jsx)("circle",{cx:u(d),cy:p(a),r:"2.5",fill:o},d))]})};var Ze=T(Se());var tn=T(Se());var Wo=T(Se());var en=T(W()),Ea=({projectId:e,value:t,onChange:n})=>{let{uploadFileToProject:o}=kt(),[r,i]=(0,Wo.useState)([]),s=(0,Wo.useRef)(e);s.current=e;let c=t.map(g=>({uid:g.uri,name:g.name||g.uri,status:"done",response:{uri:g.uri,name:g.name}})),l=async g=>{let a=g.file;try{let d=await o(e,"/project/uploads",a);g.onSuccess?.({uri:d.path,name:a.name,projectId:e})}catch(d){g.onError?.(d instanceof Error?d:new Error("Upload failed"))}},u=g=>{let{file:a}=g;if(a.status==="done"&&a.response?.uri){if(a.response.projectId&&a.response.projectId!==s.current){i(g.fileList.filter(m=>m.status==="uploading"||m.status==="error"));return}let d={uri:a.response.uri,name:a.response.name||a.name,addedBy:"user"};t.some(m=>m.uri===d.uri)||n([...t,d])}a.status==="error"&&Ke.error(`Failed to upload "${a.name}"`),i(g.fileList.filter(d=>d.status==="uploading"||d.status==="error"))},p=g=>{if(g.status==="done"){let a=g.response?.uri;n(t.filter(d=>d.uri!==a&&d.name!==g.name))}else i(a=>a.filter(d=>d.uid!==g.uid))};return(0,en.jsx)("div",{"data-testid":"reference-files-field",children:(0,en.jsxs)(oi.Dragger,{multiple:!0,fileList:[...c,...r],customRequest:l,onChange:u,onRemove:p,style:{padding:"8px 0"},children:[(0,en.jsx)("p",{className:"ant-upload-drag-icon",style:{marginBottom:4},children:(0,en.jsx)(Ti,{size:24,style:{color:"#6366f1"}})}),(0,en.jsx)("p",{className:"ant-upload-text",style:{fontSize:13},children:"Click or drag files to this area to upload"}),(0,en.jsx)("p",{className:"ant-upload-hint",style:{fontSize:12},children:"Files are stored in the selected project under /project/uploads"})]},e)})};function On(e){return(e.metadata??{}).trainingRound===!0}function Vu(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)>>>0;return t.toString(36).slice(0,6)}function Bo(e){return["pending","in_progress","review"].includes(e.status)}function _n(e,t){return`/api/tasks?${`ownerId=agent-architect&metadata=${encodeURIComponent(JSON.stringify({trainingRound:"true",targetAgentId:e}))}`}${t?`&projectId=${t}`:""}`}function kl(e,t){return`/api/tasks?${`ownerId=agent-architect&parentId=${e}`}${t?`&projectId=${t}`:""}`}function Pa(e,t){return`${e}:${t}`}async function Da(e){let t=e.projectId?{headers:{"x-project-id":e.projectId}}:void 0,o=(await e.post("/api/tasks",{title:e.goal.slice(0,60),description:e.goal,ownerType:"agent",ownerId:"agent-architect",workspaceId:e.workspaceId??void 0,projectId:e.projectId??void 0,metadata:{trainingRound:!0,targetAgentId:e.targetAgentId},files:e.files&&e.files.length>0?e.files:void 0},t)).data;if(!o)throw new Error("Failed to create learning round task");let r=e.existingThreadId??null;if(!r&&(r=(await e.post("/api/assistants/agent-architect/threads",{metadata:{training:!0,targetAgentId:e.targetAgentId}})).data?.id??null,!r))throw new Error("Failed to create training thread");return await e.put(`/api/tasks/${o.id}`,{metadata:{trainingRound:!0,targetAgentId:e.targetAgentId,trainingSessionId:r}},t),{roundTaskId:o.id,threadId:r}}function La(e){let t=e.graphDefinition,n=t;if(typeof t=="string")try{n=JSON.parse(t)}catch{n={}}let o=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},r=o.metadata!==null&&typeof o.metadata=="object"&&!Array.isArray(o.metadata)?o.metadata:{};return r.learningPlaceholder==="true"&&r.architectureStatus==="undecided"?"placeholder":o.type==="workflow"?"existing-workflow":"existing-agent"}function Na(e){let t=e.targetMode==="placeholder"?"This is a marked learning placeholder and its architecture is undecided. Select and explicitly approve its initial architecture, then materialize this exact ID through agent-build or design-workflow.":e.targetMode==="existing-workflow"?"This is an existing Workflow. Keep its architecture and use the design-workflow procedure skill for exact-ID update_workflow followed by validate_workflow.":"This is an existing Capability or Orchestra. Keep its architecture and use the agent-build procedure skill for a same-form exact-ID update_agent.";return[`Learning goal: ${e.goal}`,`Exact target ID: "${e.targetAgentId}".`,`Exact round Task ID: "${e.roundTaskId}".`,t,"Load [[agent-architecture]] and the routed procedure skill.",`Reconcile the round task itself first: one manage_task update on task "${e.roundTaskId}" that writes the confirmed Objective / Acceptance Criteria / Belief State into its description before creating any child. Keep reconciling this same task as evidence arrives. Never create a parallel replacement main task. For status transitions always use manage_task set_status, never update with a status field.`,"The round task's Acceptance Criteria MUST include the eval quality bar as decidable criteria \u2014 all development eval cases pass, and hold-out pass rate \u2265 80% baseline per [[eval-verify]] / [[completion-gate]]. The round task is completed only when these criteria are met by evidence; a low eval score means keep iterating the FEP loop, never mark complete.",`Create your work as children of the round task with parentId: "${e.roundTaskId}" and ownerType: "agent".`,`Pass taskId: "${e.roundTaskId}" to every Eval run for this round.`,...e.files?.length?[`Reference files: ${e.files.map(n=>`${n.name||n.uri} (${n.uri})`).join(", ")}. Read them before designing; in your first reply state which files you actually read and what you took from each.`]:[]].join(`
|
|
248
|
-
`)}var wl=5;async function Ma(e,t,n){let o=n?.projectId,r=o?{headers:{"x-project-id":o}}:void 0,i=g=>kl(g,o??void 0),s=[],c=!1,l=new Set,u=new Set([t]),p=[t];for(let g=0;g<wl&&p.length>0;g++){let d=(await Promise.all(p.map(m=>e(i(m),r).then(y=>Array.isArray(y.data)?y.data.map(v=>v.parentId?v:{...v,parentId:m}):[]).catch(()=>(c=!0,l.add(m),[]))))).flat().filter(m=>u.has(m.id)?!1:(u.add(m.id),!0));s.push(...d),p=d.map(m=>m.id)}if(p.length>0){c=!0;for(let g of p)l.add(g)}return{tasks:s,partial:c,...l.size>0?{incompleteParentIds:[...l]}:{}}}var Je=T(W()),jo=({open:e,agentId:t,defaultProjectId:n,onClose:o,onCreated:r})=>{let{get:i,post:s,put:c}=nt(),{message:l}=Rn.useApp(),u=st("agent-architect"),{trainingProjects:p,loading:g}=kt(),a=p.find(N=>N.id===n)??null,[d]=ve.useForm(),[m,y]=(0,tn.useState)(!1),[v,f]=(0,tn.useState)(null),[k,I]=(0,tn.useState)(null),[D,R]=(0,tn.useState)([]);return(0,tn.useEffect)(()=>{e&&(I(Pa(u.tenantId,t)),R([]))},[e,u,t]),(0,tn.useEffect)(()=>{if(!e)return;let N=!1;return(async()=>{try{let E=await i(_n(t,a?.id??void 0),a?{headers:{"x-project-id":a.id}}:void 0);if(N)return;let x=(E.data??[]).filter(On);f(x.find(Bo)??null)}catch{}})(),()=>{N=!0}},[e,i,t,a]),(0,Je.jsxs)($e,{title:"New Learning Task",open:e,onCancel:o,footer:null,width:520,destroyOnClose:!0,children:[v&&(0,Je.jsx)(It,{type:"warning",showIcon:!0,style:{marginBottom:16},message:"A learning task is already in progress. Complete it before starting a new one."}),(0,Je.jsxs)(ve,{form:d,layout:"vertical",onFinish:async N=>{if(!a){l.error("No learning project is available");return}y(!0);try{let{roundTaskId:E,threadId:x}=await Da({goal:N.goal,targetAgentId:t,workspaceId:a.workspaceId,projectId:a.id,existingThreadId:k,files:D,post:s,put:c});l.success("Learning task created. Preparing the Architect\u2026"),d.resetFields(),r(E,x,N.goal,D),R([])}catch(E){l.error(E instanceof Error?E.message:"Failed to create the learning task. Please try again.")}finally{y(!1)}},children:[(0,Je.jsx)(ve.Item,{label:"Learning Goal for This Round",name:"goal",rules:[{required:!0,message:"Please describe what you want this agent to learn or improve in this round"}],children:(0,Je.jsx)(Oe.TextArea,{rows:3,placeholder:"e.g. Improve the agent's accuracy when handling price disputes based on the price protection policy"})}),a&&(0,Je.jsx)(ve.Item,{label:(0,Je.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[(0,Je.jsx)("span",{children:"Reference Materials"}),(0,Je.jsx)(hr,{project:a,selectable:!1,loading:g})]}),extra:"Optional. These materials will be used as reference for this learning round.",style:{marginBottom:16},colon:!1,children:(0,Je.jsx)(Ea,{projectId:a.id,value:D,onChange:R})}),!a&&!g&&(0,Je.jsx)(ve.Item,{style:{marginBottom:16},children:(0,Je.jsx)(hr,{project:a,projects:p,loading:g})}),(0,Je.jsxs)(ve.Item,{style:{marginBottom:0,textAlign:"right"},children:[(0,Je.jsx)(oe,{onClick:o,style:{marginRight:8},children:"Cancel"}),(0,Je.jsx)(oe,{type:"primary",htmlType:"submit",loading:m,disabled:!!v||g||!a,children:"Start Learning"})]})]})]})};var Te=T(Se());var mn=T(W()),Oa=32,Tl=8,Rl=Oa-Tl,Il="Activity could not be loaded. Please try again shortly.",Sl="Too many activity requests are still pending. Please try again shortly.",Rr=Te.default.createContext(null),_a=Te.default.createContext(()=>{});function Cl(e){return e==="in_progress"?"Task retry started":e==="cancelled"?"Task cancelled":"Task updated"}function Al(e,t){return new Promise((n,o)=>{let r=window.setTimeout(()=>o(new Error("Work-item request timed out")),t);e.then(i=>{window.clearTimeout(r),n(i)},i=>{window.clearTimeout(r),o(i)})})}var Ir=({task:e,relatedTasks:t,onClose:n,onRefresh:o,height:r})=>{let{message:i}=Rn.useApp(),[s,c]=(0,Te.useState)(null),[l,u]=(0,Te.useState)([]),[p,g]=(0,Te.useState)([]),[a,d]=(0,Te.useState)(!1),[m,y]=(0,Te.useState)(null),[v,f]=(0,Te.useState)(()=>new Set),k=st("__GLOBAL__"),D=Te.default.useContext(Rr)??{getWorkItemRequest:(A,ee,Z,L)=>B(A,ee,Z,L),getDetailSession:()=>ue.current,bumpDetailSession:()=>{ue.current+=1}},R=(0,Te.useRef)(0),F=(0,Te.useRef)(null),N=(0,Te.useRef)(new Set),E=(0,Te.useRef)(!0),x=(0,Te.useRef)(new Map),G=(0,Te.useRef)(new Set),ue=(0,Te.useRef)(0),H=(0,Te.useRef)(k);H.current=k;let J=(0,Te.useRef)(D);J.current=D;let P=s??e,B=(A,ee,Z=ue.current,L=!1)=>{let K=x.current.get(A);if(K&&(!L||K.detailSession===Z))return K;K&&(x.current.delete(A),G.current.add(K.promise),K.promise.finally(()=>{G.current.delete(K.promise)}).catch(()=>{}));let ke=L?Oa:Rl;if(x.current.size+G.current.size>=ke){let be=Promise.reject(new Error("Work-item request capacity reached"));return be.catch(()=>{}),{promise:be,source:ee,detailSession:Z}}let X;try{X=Promise.resolve(H.current.tasks.workItems.list(A))}catch(be){X=Promise.reject(be)}let ae={promise:X,source:ee,detailSession:Z};return x.current.set(A,ae),X.finally(()=>{x.current.get(A)?.promise===X&&x.current.delete(A)}).catch(()=>{}),ae};(0,Te.useEffect)(()=>(E.current=!0,()=>{E.current=!1,F.current=null,R.current+=1,J.current.bumpDetailSession(),Promise.resolve().then(()=>{E.current||(x.current.clear(),G.current.clear(),N.current.clear())})}),[]);let j=(A,ee=!0)=>{let Z=ee?++R.current:R.current;ee&&E.current&&d(!0);let L=D.getDetailSession(),K=D.getWorkItemRequest(A,"detail",L,ee),ke=K.detailSession===L;return Al(K.promise,4e3).then(M=>{ke&&E.current&&Z===R.current&&F.current===A&&(g(M),y(null))}).catch(M=>{ke&&ee&&E.current&&Z===R.current&&F.current===A&&(g([]),y(M instanceof Error&&M.message==="Work-item request capacity reached"?Sl:Il))}).finally(()=>{ke&&E.current&&Z===R.current&&F.current===A&&d(!1)})},O=(A,ee)=>{ee&&u(Z=>P?[...Z,P]:Z),F.current=A.id,c(A),g([]),y(null),j(A.id)},te=A=>O(A,!0),C=()=>{if(l.length===0)return;let A=l[l.length-1];u(l.slice(0,-1)),O(A,!1)},Q=()=>{D.bumpDetailSession(),F.current=null,R.current+=1,c(null),u([]),g([]),d(!1),y(null),n()},de=async(A,ee)=>{let Z=F.current;if(!Z||N.current.has(Z))return;let L=Cl(A);N.current.add(Z),f(K=>new Set(K).add(Z));try{try{await H.current.tasks.update(Z,ee?{status:A,failureReason:ee}:{status:A})}catch{E.current&&i.error("Operation failed, please retry");return}if(!E.current)return;F.current===Z&&c(K=>!E.current||K?.id!==Z||F.current!==Z?K:(j(Z,!1),{...K,status:A,...ee?{failureReason:ee}:{}})),E.current&&i.success(L),o&&Promise.resolve().then(o).catch(()=>{E.current&&i.warning(`${L}, but the task list could not be refreshed`)})}finally{N.current.delete(Z),E.current&&f(K=>{let ke=new Set(K);return ke.delete(Z),ke})}};(0,Te.useEffect)(()=>{F.current!==e.id&&(u([]),O(e,!1))},[e]),(0,Te.useEffect)(()=>{let A=F.current;if(!A)return;let ee=t.find(L=>L.id===A);if(!ee){Q();return}c(L=>L&&L.id===A?ee:L);let Z=new Map(t.map(L=>[L.id,L]));u(L=>L.flatMap(K=>{let ke=Z.get(K.id);return ke?[ke]:[]})),j(A,!1)},[e,t]),(0,Te.useEffect)(()=>{if(!P?.id)return;let A=P.id,ee=!1,Z,L=async()=>{document.hidden||(await j(A,!1),!ee&&E.current&&F.current===A&&!document.hidden&&(Z=window.setTimeout(()=>void L(),5e3)))},K=()=>{ee||!E.current||document.hidden||(Z!==void 0&&window.clearTimeout(Z),Z=void 0,L())};return document.addEventListener("visibilitychange",K),L(),()=>{ee=!0,Z!==void 0&&window.clearTimeout(Z),document.removeEventListener("visibilitychange",K)}},[P?.id]);let ye=Ao(P),Re=Te.default.useContext(_a);(0,Te.useEffect)(()=>{Re(e,P)},[Re,e,P]);let fe=P?v.has(P.id):!1,_=P?.ownerType==="agent"?{onApprove:void 0,onReject:void 0,onRetry:void 0,onCancel:void 0}:{onApprove:void 0,onReject:void 0,onRetry:()=>void de("in_progress"),onCancel:()=>void de("cancelled")};return(0,mn.jsx)("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"#fff",border:"1px solid rgba(5,5,5,0.15)",borderRadius:12,overflow:"hidden"},children:(0,mn.jsx)("div",{style:{flex:1,minHeight:0},children:(0,mn.jsx)(Co,{task:P,relatedTasks:t,onRelatedTaskClick:te,workItems:p,loading:a,activityError:m??void 0,transitionPending:fe,..._,onViewChat:ye,onBack:C,canGoBack:l.length>0,maxHeight:r,focusKey:`${P.id}:${fe?"updating":P.status}`,subtasks:t.filter(A=>A.parentId===P.id),onSubtaskClick:te,parent:t.find(A=>A.id===P.parentId)??null,onParentClick:te})})})},Fa=({task:e,relatedTasks:t,onClose:n,onRefresh:o})=>{let[r,i]=(0,Te.useState)(null),s=(0,Te.useCallback)((l,u)=>{i({rootId:l.id,title:u.title})},[]);(0,Te.useEffect)(()=>{e||i(null)},[e]);let c=e?r&&r.rootId===e.id?r.title:e.title:"";return(0,mn.jsx)($e,{open:e!==null,onCancel:n,footer:null,title:c,width:960,style:{maxWidth:"calc(100vw - 32px)"},styles:{header:{padding:"16px 24px 0"},content:{padding:0},body:{padding:"12px 24px 24px"}},centered:!0,children:(0,mn.jsx)(_a.Provider,{value:s,children:e&&(0,mn.jsx)(Ir,{task:e,relatedTasks:t,onClose:n,onRefresh:o,height:"calc(100dvh - 96px)"})})})};var Le=T(W()),Sr=32,El=8,Pl=Sr-El;function Dl(e){for(let t of e.split(`
|
|
249
|
-
`)){let n=t.trim().match(/^#{1,6}\s+(.*)$/);if(n){let o=n[1].trim();if(o.length>0)return o}}}function Ll(e){let t=typeof e.detail?.markdown=="string"&&e.detail.markdown.length>0?e.detail.markdown:void 0;if(t){let n=Dl(t);if(n)return n}return e.summary||e.action||""}function Nl(e){let t=e.context?.interruption;return e.status==="interrupted"&&typeof t=="object"&&t!==null&&t.type==="review_required"}function Ml(e,t){return new Promise((n,o)=>{let r=window.setTimeout(()=>o(new Error("Work-item request timed out")),t);e.then(i=>{window.clearTimeout(r),n(i)},i=>{window.clearTimeout(r),o(i)})})}var za=({assistantId:e,projectId:t,onLearningStarted:n,round:o,subTasks:r,rounds:i,subTasksByRound:s,selectedRoundId:c,onSelectedRoundChange:l,loading:u,onRefresh:p,onStartRequest:g,onExpandWorkflow:a})=>{let{message:d}=Rn.useApp(),[m,y]=(0,Ze.useState)(!1),[v,f]=(0,Ze.useState)(!1),[k,I]=(0,Ze.useState)(null),[D,R]=(0,Ze.useState)(null),F=st("__GLOBAL__"),N=(0,Ze.useRef)(!0),E=(0,Ze.useRef)(new Map),x=(0,Ze.useRef)(new Set),G=(0,Ze.useRef)(0),ue=(0,Ze.useRef)(0),H=i&&i.length>0?i:o?[o]:[],[J,P]=(0,Ze.useState)(null),B=c!==void 0,j=B?c:J,O=H.map(M=>M.id).join(",");(0,Ze.useEffect)(()=>{if(H.length===0){P(null);return}P(M=>M&&O.split(",").includes(M)?M:H[0].id)},[O]);let te=H.find(M=>M.id===j)??H[0]??null,C=M=>{B||P(M),l?.(M)},Q=s&&te?s[te.id]??[]:te&&te.id===o?.id?r:[],de=(0,Ze.useMemo)(()=>[te,...Q].filter(M=>M!==null),[o,r,i,s,j]),ye=Q.filter(M=>M.status==="in_progress"),Re=ye[0]??null,fe=te?.status==="in_progress",_=(ye.length>0?ye.map(M=>M.id):fe&&te?[te.id]:[]).sort(),A=_.join(","),ee=(0,Ze.useRef)(F);ee.current=F;let Z=(0,Ze.useRef)(null);Z.current||(Z.current={getWorkItemRequest:(M,X,ae,be)=>L(M,X,ae,be),getDetailSession:()=>G.current,bumpDetailSession:()=>{G.current+=1}});let L=(M,X,ae=G.current,be=!1)=>{let Ie=E.current.get(M);if(Ie&&(!be||Ie.detailSession===ae))return Ie;Ie&&(E.current.delete(M),x.current.add(Ie.promise),Ie.promise.finally(()=>{x.current.delete(Ie.promise)}).catch(()=>{}));let Pe=be?Sr:Pl;if(E.current.size+x.current.size>=Pe){let He=Promise.reject(new Error("Work-item request capacity reached"));return He.catch(()=>{}),{promise:He,source:X,detailSession:ae}}let Me;try{Me=Promise.resolve(ee.current.tasks.workItems.list(M))}catch(He){Me=Promise.reject(He)}let _e={promise:Me,source:X,detailSession:ae};return E.current.set(M,_e),Me.finally(()=>{E.current.get(M)?.promise===Me&&E.current.delete(M)}).catch(()=>{}),_e};(0,Ze.useEffect)(()=>(N.current=!0,()=>{N.current=!1,Promise.resolve().then(()=>{N.current||(E.current.clear(),x.current.clear())})}),[]),(0,Ze.useEffect)(()=>{if(_.length===0){R(null);return}R(null);let M=!1,X,ae=()=>{if(document.hidden)return Promise.resolve();let Ie=ue.current%_.length,Pe=[..._.slice(Ie),..._.slice(0,Ie)];return ue.current=(Ie+Sr)%_.length,Promise.allSettled(Pe.map(je=>Ml(L(je,"live").promise,4e3))).then(je=>{if(M||!N.current)return;let Me=je.filter(Ve=>Ve.status==="fulfilled").map(Ve=>Ve.value);if(Me.length===0)return;let He=[...Me.flat().filter(Ve=>!/^Status changed to\b/i.test(Ve.summary??""))].sort((Ve,Rt)=>new Date(Rt.createdAt).getTime()-new Date(Ve.createdAt).getTime());R(He[0]??null)}).finally(()=>{!M&&N.current&&!document.hidden&&(X=window.setTimeout(()=>void ae(),5e3))})},be=()=>{M||!N.current||document.hidden||(X!==void 0&&window.clearTimeout(X),X=void 0,ae())};return document.addEventListener("visibilitychange",be),ae(),()=>{M=!0,X!==void 0&&window.clearTimeout(X),document.removeEventListener("visibilitychange",be)}},[A]);let K=M=>I(M),ke=(M,X,ae,be)=>{C(M),y(!1);let Ie;try{Ie=Promise.resolve(p())}catch{Ie=Promise.reject(new Error("Task-list refresh failed"))}Ie.catch(()=>{N.current&&d.error("Task created, but the task list could not be refreshed")}),n?.(ae,M,be)};return(0,Le.jsxs)("div",{style:{background:"rgba(255, 255, 255, 0.6)",border:"1px solid rgba(240, 240, 240, 0.7)",borderRadius:10,padding:"8px 10px",boxShadow:"0 2px 10px rgba(0,0,0,0.06)",backdropFilter:"blur(8px)",pointerEvents:"auto",width:300},children:[u?(0,Le.jsx)("div",{style:{fontSize:12,color:"#bbb",padding:"4px 2px"},children:"Loading..."}):te?(0,Le.jsxs)("div",{children:[(0,Le.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:6,padding:"0 2px 6px",borderBottom:"1px solid rgba(240,240,240,0.7)",marginBottom:6},children:[(0,Le.jsx)("span",{style:{fontSize:12,fontWeight:600,color:"#595959"},children:"Learning Tasks"}),(0,Le.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:2},children:[a&&(0,Le.jsx)(oe,{size:"small",type:"text","aria-label":"Open workflow view",icon:(0,Le.jsx)(mo,{}),onClick:a}),(0,Le.jsx)(oe,{size:"small",type:"text",icon:(0,Le.jsx)(Xt,{}),onClick:()=>g?g():y(!0),style:{fontSize:12},children:"New Learning Task"})]})]}),H.length>1&&(0,Le.jsx)(at,{size:"small","data-testid":"round-filter",style:{width:"100%",marginBottom:6},value:te.id,onChange:C,options:H.map(M=>({value:M.id,label:`${M.title||M.id} (${M.status})`}))}),(()=>{let M=de.filter(Nl);return M.length>0?(0,Le.jsxs)(oe,{type:"text","data-testid":"review-banner","aria-label":`Open ${M.length} task${M.length>1?"s":""} waiting for approval`,onClick:()=>K(M[0]),style:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:6,cursor:"pointer",width:"100%",height:"auto",fontSize:12,fontWeight:600,color:"#b45309",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)",borderRadius:8,padding:"5px 8px",marginBottom:6},children:[M.length," item",M.length>1?"s":""," waiting for approval"]}):null})(),D&&(0,Le.jsxs)("div",{"data-testid":"live-status",style:{display:"flex",alignItems:"center",gap:6,fontSize:12,color:"#666",padding:"2px 2px 6px",borderBottom:"1px solid rgba(240,240,240,0.7)",marginBottom:4},children:[(0,Le.jsx)("span",{style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:Re?"#3b82f6":"#bbb",animation:Re?"live-pulse 1.2s ease-in-out infinite":void 0}}),(0,Le.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Ll(D)}),(0,Le.jsx)("style",{children:"@keyframes live-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }"})]}),(0,Le.jsx)("div",{style:{maxHeight:240,overflow:"auto"},children:(0,Le.jsx)(Hi,{tasks:[te,...Q],loading:!1,onTaskClick:K,hideCompleted:v,onHideCompletedChange:f})})]}):(0,Le.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"4px 2px"},children:[(0,Le.jsx)("span",{style:{fontSize:12,color:"#999"},children:"No learning tasks yet"}),(0,Le.jsx)(oe,{size:"small",icon:(0,Le.jsx)(Xt,{}),onClick:()=>g?g():y(!0),children:"New Learning Task"})]}),!g&&(0,Le.jsx)(jo,{open:m,agentId:e,defaultProjectId:t,onClose:()=>y(!1),onCreated:ke}),(0,Le.jsx)(Rr.Provider,{value:Z.current,children:(0,Le.jsx)(Fa,{task:k,relatedTasks:de,onClose:()=>I(null),onRefresh:p})})]})};var Be=T(Se());function Wa(e,t){let n=[...t],o=new Set(t.map(c=>`${c.from}|${c.to}`)),r=new Set(t.filter(c=>c.kind==="dependency").map(c=>c.to)),i=new Set(e.map(c=>c.id)),s=new Map;for(let c of e){if(!c.parentId||!i.has(c.parentId))continue;let l=s.get(c.parentId)??[];l.push(c),s.set(c.parentId,l)}for(let c of s.values()){let l=[...c].sort((u,p)=>new Date(u.createdAt).getTime()-new Date(p.createdAt).getTime());for(let u=1;u<l.length;u++){let p=l[u];if(r.has(p.id))continue;let g=l[u-1].id,a=`${g}|${p.id}`;o.has(a)||o.has(`${p.id}|${g}`)||(n.push({from:g,to:p.id,kind:"sequence"}),o.add(a))}}return n}function Ba(e,t){return e!=="completed"?"idle":t==="in_progress"?"flowing":t==="pending"?"idle":"traversed"}function ja(e){return e==="completed"?"traversed":e==="in_progress"?"flowing":"idle"}var qt={pending:{label:"Pending",color:"#9ca3af",active:!1},in_progress:{label:"Running",color:"#3b82f6",active:!0},review:{label:"Review",color:"#8b5cf6",active:!1},failed:{label:"Failed",color:"#ef4444",active:!1},interrupted:{label:"Interrupted",color:"#f59e0b",active:!1},completed:{label:"Done",color:"#22c55e",active:!1},cancelled:{label:"Cancelled",color:"#9ca3af",active:!1}};var Nt=T(W()),Ga=({data:e})=>{let{task:t}=e,n=qt[t.status];return(0,Nt.jsxs)("div",{"data-testid":"workflow-task-node","data-active":String(n.active),style:{width:180,padding:"8px 10px",borderRadius:10,border:`1.5px solid ${n.color}`,background:"#fff",animation:n.active?"workflow-node-pulse 1.6s ease-in-out infinite":void 0},children:[(0,Nt.jsx)(St,{type:"target",position:lt.Left,style:{opacity:0}}),(0,Nt.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[(0,Nt.jsx)("span",{style:{width:8,height:8,borderRadius:9999,background:n.color,flexShrink:0}}),(0,Nt.jsx)("span",{style:{fontSize:12,fontWeight:600,color:"#262626",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.title,children:t.title})]}),(0,Nt.jsx)("div",{style:{fontSize:10,color:"#8c8c8c"},children:n.label}),(0,Nt.jsx)(St,{type:"source",position:lt.Right,style:{opacity:0}}),n.active&&(0,Nt.jsx)("style",{children:"@keyframes workflow-node-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.35); } 50% { box-shadow: 0 0 0 6px rgba(59,130,246,0.08); } }"})]})};var dt=T(W()),Ol={workflowTask:Ga},_l=180,Fl=56,zl={traversed:{stroke:"#22c55e",strokeWidth:1.5},flowing:{stroke:"#6366f1",strokeWidth:2},idle:{stroke:"#d1d5db",strokeWidth:1,strokeDasharray:"5 5"}},$a=({rounds:e,subTasksByRound:t,loading:n})=>{let o=st("__GLOBAL__"),[r,i]=(0,Be.useState)(null),[s,c]=(0,Be.useState)(null),[l,u]=(0,Be.useState)([]),[p,g]=(0,Be.useState)(!1),[a,d]=(0,Be.useState)(null),m=(0,Be.useRef)(0),y=(0,Be.useRef)(o);y.current=o;let v=e.map(C=>C.id).join(",");(0,Be.useEffect)(()=>{i(C=>C&&v.split(",").includes(C)?C:e[0]?.id??null)},[v]);let f=e.find(C=>C.id===r)??e[0]??null,k=(0,Be.useMemo)(()=>[f,...f?t[f.id]??[]:[]].filter(C=>C!==null),[f,t]),{nodes:I,edges:D}=(0,Be.useMemo)(()=>So(k),[k]),R=(0,Be.useMemo)(()=>Wa(k,D),[k,D]),F=(0,Be.useMemo)(()=>new Map(k.map(C=>[C.id,C])),[k]),N=(0,Be.useMemo)(()=>{let C=Ro(I.map(Q=>({id:Q.id})),R.map(Q=>({from:Q.from,to:Q.to})),{nodeWidth:_l,nodeHeight:Fl,nodesep:24,ranksep:60,rankdir:"LR"});return I.map(Q=>({id:Q.id,type:"workflowTask",position:C.get(Q.id)??{x:0,y:0},data:{task:Q.task}}))},[I,R]),E=(0,Be.useMemo)(()=>R.map(C=>{let Q=Ba(F.get(C.from)?.status??"pending",F.get(C.to)?.status??"pending");return{id:`${C.from}->${C.to}:${C.kind}`,source:C.from,target:C.to,animated:Q==="flowing",style:{...zl[Q],...C.kind==="sequence"&&Q!=="idle"?{strokeDasharray:"2 3"}:{}}}}),[R,F]),[x,G,ue]=Cn(N),[H,J,P]=An(E);(0,Be.useEffect)(()=>{G(C=>{let Q=C.map(ye=>ye.id).sort().join("|"),de=N.map(ye=>ye.id).sort().join("|");if(Q===de){let ye=new Map(C.map(Re=>[Re.id,Re]));return N.map(Re=>{let fe=ye.get(Re.id);return fe?{...Re,position:fe.position}:Re})}return N}),J(E)},[N,E,G,J]);let B=(0,Be.useCallback)(C=>{let Q=++m.current;g(!0),d(null),y.current.tasks.workItems.list(C).then(de=>{Q===m.current&&u(de)}).catch(()=>{Q===m.current&&(u([]),d("Activity could not be loaded. Please try again shortly."))}).finally(()=>{Q===m.current&&g(!1)})},[]),j=(0,Be.useCallback)((C,Q)=>{let de=Q.data?.task;de&&(u([]),c(de),B(de.id))},[B]),O=(0,Be.useCallback)(()=>{m.current+=1,c(null),u([]),d(null),g(!1)},[]),te=Ao(s);return n?(0,dt.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,dt.jsx)(ut,{size:"large"})}):!f||k.length===0?(0,dt.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,dt.jsx)(Bt,{description:"No tasks"})}):(0,dt.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[e.length>1&&(0,dt.jsx)("div",{style:{display:"flex",gap:6,flexWrap:"wrap",paddingBottom:12,flexShrink:0},children:e.map((C,Q)=>{let de=qt[C.status],ye=C.id===f.id;return(0,dt.jsxs)("button",{type:"button","data-testid":`round-chip-${C.id}`,onClick:()=>{i(C.id),O()},title:C.title,style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11,fontWeight:600,padding:"3px 10px",borderRadius:9999,cursor:"pointer",border:ye?"1.5px solid #6366f1":"1px solid #e5e7eb",background:ye?"rgba(99,102,241,0.08)":"#fff",color:ye?"#6366f1":"#6b7280"},children:[(0,dt.jsx)("span",{style:{width:6,height:6,borderRadius:9999,background:de.color}}),"R",e.length-Q]},C.id)})}),(0,dt.jsx)("div",{style:{flex:1,minHeight:0,position:"relative"},children:(0,dt.jsx)(Io,{nodes:x,edges:H,nodeTypes:Ol,onNodesChange:ue,onEdgesChange:P,onNodeClick:j,fitView:!0,fitViewOptions:{padding:.15},nodesDraggable:!0,nodesConnectable:!1,miniMap:!0,attributionPosition:"bottom-right"})}),s&&(0,dt.jsx)("div",{"data-testid":"workflow-detail",style:{height:"40%",minHeight:200,flexShrink:0,borderTop:"1px solid #f0f0f0",overflow:"hidden"},children:(0,dt.jsx)(Co,{task:s,relatedTasks:k,workItems:l,loading:p,activityError:a??void 0,onApprove:void 0,onReject:void 0,onRetry:void 0,onCancel:void 0,onViewChat:te,onBack:O,subtasks:k.filter(C=>C.parentId===s.id),onSubtaskClick:C=>{u([]),c(C),B(C.id)},parent:k.find(C=>C.id===s.parentId)??null,onParentClick:C=>{u([]),c(C),B(C.id)}})})]})};var Et=T(Se());var Mt=T(W()),Wl=0,Ha=360,Ka=48,qa=16;function Cr(e){let t=typeof window>"u"?1200:window.innerWidth-Ka;return Math.min(Math.max(e,Ha),t)}var wt=({open:e,width:t,mobileWidth:n,left:o,top:r=56,bottom:i=12,height:s,title:c,onClose:l,bodyStyle:u,restoreFocusRef:p,focusControlRef:g,escapeEnabled:a=!0,zIndex:d=25,children:m})=>{let y=Ni("(max-width: 720px)"),v=(0,Et.useRef)(null),f=(0,Et.useRef)(null),k=(0,Et.useRef)(null);k.current||(k.current=`canvas-dock-title-${++Wl}`);let I=k.current,[D,R]=(0,Et.useState)(null);(0,Et.useEffect)(()=>R(null),[t,n]);let F=!y&&typeof t=="number",N=y?n??t:D??t,E=typeof N=="number"?N:null,x=o===void 0?-1:1,G=H=>{if(!F||E===null)return;H.preventDefault();let J={startX:H.clientX,startWidth:E},P=j=>{R(Cr(J.startWidth+x*(j.clientX-J.startX)))},B=()=>{window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",B)};window.addEventListener("pointermove",P),window.addEventListener("pointerup",B)},ue=H=>{!F||E===null||(H.key==="ArrowLeft"?(H.preventDefault(),R(Cr(E-x*qa))):H.key==="ArrowRight"&&(H.preventDefault(),R(Cr(E+x*qa))))};return(0,Et.useEffect)(()=>{if(!e||!a)return;let H=J=>{J.key==="Escape"&&!J.defaultPrevented&&l()};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[a,e,l]),(0,Et.useEffect)(()=>{if(g)return g.current=()=>v.current?.focus(),()=>{g.current=null}},[g]),(0,Et.useEffect)(()=>{if(!e)return;let H=p?.current??document.activeElement;return H instanceof HTMLElement&&(f.current=H),v.current?.focus(),()=>{f.current?.focus(),f.current=null}},[e]),e?(0,Mt.jsxs)("div",{"data-testid":"canvas-dock",role:"region","aria-labelledby":I,style:{position:"absolute",top:r,...o===void 0?{right:12}:{left:o},...s===void 0?{bottom:i}:{height:s},width:N,maxWidth:"calc(100% - 24px)",boxSizing:"border-box",zIndex:d,display:"flex",flexDirection:"column",background:"rgba(255,255,255,0.92)",backdropFilter:"blur(12px)",borderRadius:16,border:"1px solid rgba(240,240,240,0.9)",boxShadow:"0 8px 32px rgba(0,0,0,0.12)",animation:"canvas-dock-in 0.2s ease",overflow:"hidden"},children:[(0,Mt.jsx)("style",{children:"@keyframes canvas-dock-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }"}),F&&(0,Mt.jsx)("div",{"data-testid":"canvas-dock-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize panel","aria-valuenow":E??void 0,"aria-valuemin":Ha,"aria-valuemax":typeof window>"u"?void 0:window.innerWidth-Ka,tabIndex:0,onPointerDown:G,onKeyDown:ue,style:{position:"absolute",...o===void 0?{left:0}:{right:0},top:0,bottom:0,width:6,cursor:"ew-resize",zIndex:1,touchAction:"none"}}),(0,Mt.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 16px",borderBottom:"1px solid rgba(240,240,240,0.9)",flexShrink:0,fontSize:13,fontWeight:600,color:"#333"},children:[(0,Mt.jsx)("div",{id:I,style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:8,overflow:"hidden"},children:c}),(0,Mt.jsx)("button",{ref:v,type:"button","aria-label":"Close dock",onClick:l,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,border:"none",borderRadius:6,background:"transparent",color:"#999",cursor:"pointer",flexShrink:0},children:(0,Mt.jsx)(Di,{size:14})})]}),(0,Mt.jsx)("div",{"data-testid":"canvas-dock-body",style:{flex:1,minHeight:0,overflow:"auto",padding:16,...u},children:m})]}):null};var Ot=T(Se());var Go=80;function nn(e){return e>=80?"#22c55e":e>=50?"#f59e0b":"#ef4444"}function Jn(e){return e.filter(t=>t.status==="completed"&&t.holdout!==!0).sort(jt)}function Ua(e){let t=Jn(e),n=t[t.length-1];if(!n)return{latestScore:null,delta:null,passRate:null,passedCases:0,totalCases:0,interruptedCases:0,latestRunId:null};let o=t[t.length-2],r=n.totalCases??0,i=n.passedCases??0;return{latestScore:n.avgScore,delta:o?Math.round(n.avgScore-o.avgScore):null,passRate:r>0?Math.round(i/r*100):null,passedCases:i,totalCases:r,interruptedCases:n.interruptedCases??0,latestRunId:n.id}}function Za(e){let t=new Map;for(let n of e)if(!n.interrupted)for(let o of n.dimensionResults??[]){let r=t.get(o.name)??{sum:0,count:0};r.sum+=o.score,r.count+=1,t.set(o.name,r)}return[...t.entries()].map(([n,{sum:o,count:r}])=>({name:n,avgScore:Math.round(o/r*10)/10,count:r})).sort((n,o)=>n.avgScore-o.avgScore)}var Bl=.15,Va={left:36,right:12,top:16,bottom:24},Ar={fontSize:9,color:"#999"};function Qa(){return{type:"value",min:0,max:100,axisLabel:{...Ar},splitLine:{lineStyle:{color:"#f5f5f5"}}}}function Ya({rounds:e,runs:t,selectedRoundId:n}){let o=[...e].sort((a,d)=>new Date(a.createdAt).getTime()-new Date(d.createdAt).getTime()),r=t.filter(a=>a.status==="completed").sort(jt),i=new Map(o.map((a,d)=>[a.id,d+1])),s=new Map;for(let a of r){let d=a.taskId?i.get(a.taskId):void 0;d!==void 0&&s.set(d,(s.get(d)??0)+1)}let c=new Map,l=[],u=new Map;for(let a of r){let d=a.taskId?i.get(a.taskId):void 0;if(d===void 0)continue;let m=c.get(d)??0;if(c.set(d,m+1),a.holdout===!0){let y=(m-((s.get(d)??1)-1)/2)*Bl;l.push([Math.round((d+y)*100)/100,a.avgScore])}else u.set(d,a.avgScore)}let p=n??null;if(p===null){for(let a=o.length-1;a>=0;a--)if(u.has(a+1)){p=o[a].id;break}}let g=o.map((a,d)=>{let m=u.get(d+1);if(m===void 0)return null;let y=a.id===p;return{value:[d+1,m],itemStyle:{color:nn(m),borderRadius:[4,4,0,0],...y?{borderColor:"#6366f1",borderWidth:2}:{}}}});return{grid:Va,tooltip:{trigger:"item"},xAxis:{type:"value",min:.5,max:o.length+.5,interval:1,axisLabel:{...Ar,formatter:a=>Number.isInteger(a)?`R${a}`:""},axisLine:{lineStyle:{color:"#eee"}},splitLine:{show:!1}},yAxis:Qa(),series:[{type:"bar",data:g,barWidth:22,markLine:{silent:!0,symbol:"none",lineStyle:{type:"dashed",color:"#d9d9d9"},label:{fontSize:9,color:"#999",formatter:`target ${Go}`},data:[{yAxis:Go}]}},{type:"scatter",data:l,symbol:"diamond",symbolSize:9,itemStyle:{color:"#fff",borderColor:"#f59e0b",borderWidth:1.5},z:4}]}}function Xa(e){let t=e.filter(r=>r.status==="completed").sort(jt),n=[],o=[];return t.forEach((r,i)=>{r.holdout===!0?o.push([i+1,r.avgScore]):n.push([i+1,r.avgScore])}),{grid:Va,tooltip:{trigger:"item"},xAxis:{type:"value",min:.5,max:Math.max(t.length,1)+.5,interval:1,axisLabel:{...Ar,formatter:r=>Number.isInteger(r)?`#${r}`:""},axisLine:{lineStyle:{color:"#eee"}},splitLine:{show:!1}},yAxis:Qa(),series:[{type:"line",data:n,symbol:"circle",symbolSize:6,lineStyle:{color:"#6366f1",width:1.5},itemStyle:{color:"#6366f1"},markLine:{silent:!0,symbol:"none",lineStyle:{type:"dashed",color:"#d9d9d9"},label:{fontSize:9,color:"#999",formatter:`target ${Go}`},data:[{yAxis:Go}]}},{type:"scatter",data:o,symbol:"diamond",symbolSize:9,itemStyle:{color:"#fff",borderColor:"#f59e0b",borderWidth:1.5},z:4}]}}var pt=T(W()),Er={fontSize:10,color:"#999"},Pr={fontSize:22,fontWeight:700,lineHeight:1.2},Ja=({summary:e})=>e.latestScore===null?null:(0,pt.jsxs)("div",{"data-testid":"eval-summary",style:{display:"flex",gap:28},children:[(0,pt.jsxs)("div",{children:[(0,pt.jsxs)("div",{style:{...Pr,color:nn(e.latestScore)},children:[e.latestScore.toFixed(1),e.delta!==null&&(0,pt.jsxs)("span",{"data-testid":"summary-delta",style:{fontSize:11,fontWeight:600,color:e.delta>=0?"#22c55e":"#ef4444",marginLeft:6},children:[e.delta>=0?"\u25B2":"\u25BC"," ",Math.abs(e.delta)]})]}),(0,pt.jsx)("div",{style:Er,children:"latest score"})]}),(0,pt.jsxs)("div",{children:[(0,pt.jsx)("div",{"data-testid":"summary-pass",style:{...Pr,color:"#262626"},children:e.passRate!==null?`${e.passRate}%`:"\u2014"}),(0,pt.jsxs)("div",{style:Er,children:["pass \xB7 ",e.passedCases,"/",e.totalCases]})]}),e.interruptedCases>0&&(0,pt.jsxs)("div",{"data-testid":"summary-interrupted",children:[(0,pt.jsx)("div",{style:{...Pr,color:"#b45309"},children:e.interruptedCases}),(0,pt.jsx)("div",{style:Er,children:"interrupted"})]})]});var gt=T(Se());var Fn=T(W()),es=({agentId:e,projectId:t,runs:n,selectedRoundId:o,onSelectRound:r})=>{let{get:i}=nt(),[s,c]=(0,gt.useState)([]),[l,u]=(0,gt.useState)(!1),[p,g]=(0,gt.useState)(null),a=gt.default.useRef(i);a.current=i,(0,gt.useEffect)(()=>{let v=!1;return a.current(_n(e,t)).then(f=>{if(v)return;let k=(f.data??[]).filter(On);k.sort((I,D)=>new Date(I.createdAt).getTime()-new Date(D.createdAt).getTime()),c(k),u(!0)}).catch(()=>{v||u(!0)}),()=>{v=!0}},[e,t]),(0,gt.useEffect)(()=>{p&&!s.some(v=>v.id===p)&&g(null)},[s,p]);let d=(0,gt.useMemo)(()=>Ya({rounds:s,runs:n,selectedRoundId:o??p}),[s,n,o,p]),m=(0,gt.useMemo)(()=>({click:v=>{let f=v;if(f.seriesType!=="bar"||typeof f.dataIndex!="number")return;let k=s[f.dataIndex];k&&(g(k.id),r?.(k.id))}}),[s,r]),y=(0,gt.useMemo)(()=>{if(s.length===0)return!1;let v=new Set(s.map(f=>f.id));return Jn(n).some(f=>f.taskId!==void 0&&v.has(f.taskId))},[s,n]);return l?y?(0,Fn.jsxs)("div",{"data-testid":"round-trend-chart",style:{border:"1px solid #f0f0f0",borderRadius:12,padding:12},children:[(0,Fn.jsx)("div",{style:{fontSize:12,fontWeight:600,color:"rgba(0,0,0,0.65)",marginBottom:8},children:"Score by learning round"}),(0,Fn.jsx)(gn,{option:d,height:100,onEvents:m})]}):(0,Fn.jsx)("div",{"data-testid":"round-trend-empty",style:{display:"none"}}):null};var on=T(W()),ts=({dimensions:e})=>e.length===0?null:(0,on.jsx)("div",{"data-testid":"dimension-panorama",style:{display:"flex",flexDirection:"column",gap:4},children:e.map(t=>{let n=Math.min(Math.max(t.avgScore,0),100);return(0,on.jsxs)("div",{"data-testid":`dimension-row-${t.name}`,style:{display:"flex",alignItems:"center",gap:8,fontSize:11},children:[(0,on.jsx)("span",{"data-testid":`dimension-label-${t.name}`,style:{flexShrink:0,maxWidth:"60%",color:"#595959",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.name,children:t.name}),(0,on.jsx)("div",{style:{flex:1,height:8,background:"#f5f5f5",borderRadius:4,overflow:"hidden"},children:(0,on.jsx)("div",{"data-testid":`dimension-fill-${t.name}`,style:{width:`${n}%`,height:"100%",background:nn(t.avgScore),borderRadius:4}})}),(0,on.jsx)("span",{style:{width:28,textAlign:"right",flexShrink:0,fontWeight:600,color:nn(t.avgScore)},children:Math.round(t.avgScore)})]},t.name)})});var Ht=T(W());function ns(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!n.holdout&&n.status==="completed"&&typeof n.id=="string")return n.id}return null}var os=({results:e})=>{if(e===null)return null;let t=e.filter(o=>o.interrupted).length,n=e.filter(o=>!o.pass&&!o.interrupted).flatMap(o=>o.dimensionResults??[]).sort((o,r)=>o.score-r.score).slice(0,3);return(0,Ht.jsxs)("div",{style:{marginTop:8},"data-testid":"run-insights",children:[t>0&&(0,Ht.jsxs)("div",{"data-testid":"interrupted-count",style:{fontSize:12,color:"#b45309",marginBottom:6},children:[t," interrupted"]}),n.length===0?(0,Ht.jsx)("div",{style:{fontSize:12,color:"#22c55e"},children:"All cases passed"}):n.map((o,r)=>(0,Ht.jsxs)("div",{style:{fontSize:12,padding:"3px 0",display:"flex",gap:6,alignItems:"baseline"},children:[(0,Ht.jsx)("span",{style:{color:"#333",fontWeight:600,flexShrink:0},children:o.name}),(0,Ht.jsx)("span",{style:{color:o.score>=50?"#f59e0b":"#ef4444",flexShrink:0},children:o.score}),(0,Ht.jsx)("span",{style:{color:"#888",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.reason.length>80?`${o.reason.slice(0,80)}\u2026`:o.reason})]},`${o.name}-${r}`))]})};var ft=T(W()),rs={fontSize:12,fontWeight:600,color:"rgba(0,0,0,0.65)",marginBottom:8},is={border:"1px solid #f0f0f0",borderRadius:12,padding:12},zn=({agentId:e,projectId:t,runs:n,showRoundTrend:o=!0})=>{let{get:r}=nt(),i=(0,Ot.useMemo)(()=>Ua(n),[n]),s=ns(n),c=n.find(m=>m.id===s),[l,u]=(0,Ot.useState)(null),p=Ot.default.useRef(r);p.current=r,(0,Ot.useEffect)(()=>{if(!s){u(null);return}let m=!1;return p.current(`/api/eval/runs/${s}`).then(y=>!m&&u(y.data?.results??[])).catch(()=>!m&&u([])),()=>{m=!0}},[s]);let g=(0,Ot.useMemo)(()=>Za(l??[]),[l]),a=(0,Ot.useMemo)(()=>Xa(n),[n]),d=Jn(n).length>0;return i.latestScore===null?(0,ft.jsx)("div",{style:{height:120,display:"flex",alignItems:"center",justifyContent:"center",color:"#bfbfbf",fontSize:12},children:"No eval runs yet"}):(0,ft.jsxs)("div",{"data-testid":"eval-quality-panel",style:{display:"flex",flexDirection:"column",gap:12},children:[(0,ft.jsx)(Ja,{summary:i}),o&&(0,ft.jsx)(es,{agentId:e,projectId:t,runs:n}),d&&(0,ft.jsxs)("div",{"data-testid":"run-trend-card",style:is,children:[(0,ft.jsx)("div",{style:rs,children:"Score by run"}),(0,ft.jsx)(gn,{option:a,height:160})]}),s&&l!==null&&(0,ft.jsxs)("div",{"data-testid":"run-diagnosis-card",style:is,children:[(0,ft.jsxs)("div",{style:rs,children:["Latest run",c?` \xB7 ${Fo(new Date(c.createdAt))}`:""," \xB7 ",i.passedCases,"/",i.totalCases," passed"]}),(0,ft.jsx)(ts,{dimensions:g}),(0,ft.jsx)(os,{results:l})]})]})};var ce=T(W()),as={background:"rgba(255, 255, 255, 0.6)",border:"1px solid rgba(240, 240, 240, 0.7)",borderRadius:10,padding:"8px 12px",boxShadow:"0 2px 10px rgba(0,0,0,0.06)",backdropFilter:"blur(8px)",pointerEvents:"auto",cursor:"pointer"},jl=async()=>{},Gl={rounds:[],round:null,subTasks:[],subTasksByRound:{},loading:!1},$o=({assistantId:e,projectId:t,onProjectChange:n,onLearningStarted:o,learningTasks:r=Gl,topOffset:i=12,onLearningRefresh:s,evalTick:c,showLearning:l=!0,variant:u="full"})=>{let[p,g]=(0,eo.useState)(null),[a,d]=(0,eo.useState)(!1),m=Ra(e),y=zo(e);return(0,eo.useEffect)(()=>{c!==void 0&&c>0&&y.refresh()},[c]),u==="selector"?(0,ce.jsx)("div",{style:{position:"absolute",left:12,top:i,zIndex:10,pointerEvents:"none"},children:(0,ce.jsx)("div",{style:{pointerEvents:"auto"},children:(0,ce.jsx)(yr,{kind:"training",disableDropdown:!1,showWorkspace:!1,value:t,onChange:n})})}):(0,ce.jsxs)(ce.Fragment,{children:[(0,ce.jsxs)("div",{style:{position:"absolute",left:12,top:i,zIndex:10,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none"},children:[(0,ce.jsx)("div",{style:{pointerEvents:"auto"},children:(0,ce.jsx)(yr,{kind:"training",disableDropdown:!1,showWorkspace:!1,value:t,onChange:n})}),(0,ce.jsxs)("div",{onClick:()=>g(p==="runtime"?null:"runtime"),title:"Click for 30-day chart",style:as,children:[(0,ce.jsx)("div",{style:{fontSize:10,fontWeight:600,color:"#999",marginBottom:4},children:"Runtime"}),(0,ce.jsxs)("div",{style:{display:"flex",gap:14,fontSize:12,alignItems:"center"},children:[(0,ce.jsxs)("span",{children:[(0,ce.jsx)("strong",{style:{color:"#595959"},children:m.total})," ",(0,ce.jsx)("span",{style:{color:"#bbb"},children:"threads"})]}),(0,ce.jsxs)("span",{children:[(0,ce.jsx)("strong",{style:{color:"#595959"},children:m.last7d})," ",(0,ce.jsx)("span",{style:{color:"#bbb"},children:"7d"})]}),(0,ce.jsxs)("span",{children:[(0,ce.jsx)("strong",{style:{color:"#595959"},children:m.last30d})," ",(0,ce.jsx)("span",{style:{color:"#bbb"},children:"30d"})]}),(0,ce.jsx)("span",{style:{color:"#999"},children:Fo(m.lastActive)}),m.daily7d.length>0&&(0,ce.jsx)(Ca,{values:m.daily7d,width:56,height:20,color:"#8c8c8c"})]})]}),(0,ce.jsxs)("div",{onClick:()=>g(p==="eval"?null:"eval"),title:"Click for score trend",style:as,children:[(0,ce.jsx)("div",{style:{fontSize:10,fontWeight:600,color:"#999",marginBottom:4},children:"Eval quality"}),(0,ce.jsxs)("div",{style:{display:"flex",gap:14,fontSize:12,alignItems:"center"},children:[(0,ce.jsxs)("span",{children:[(0,ce.jsx)("strong",{style:{color:y.score===null?"#d9d9d9":y.score>=80?"#22c55e":y.score>=50?"#f59e0b":"#ef4444"},children:y.score!==null?y.score.toFixed(1):"\u2014"})," ",(0,ce.jsx)("span",{style:{color:"#bbb"},children:"score"})]}),(0,ce.jsxs)("span",{children:[(0,ce.jsx)("strong",{style:{color:"#595959"},children:y.passRate!==null?`${y.passRate}%`:"\u2014"})," ",(0,ce.jsx)("span",{style:{color:"#bbb"},children:"pass"})]}),(0,ce.jsxs)("span",{children:[(0,ce.jsx)("strong",{style:{color:"#595959"},children:y.runCount})," ",(0,ce.jsx)("span",{style:{color:"#bbb"},children:"runs"})]}),y.scores.length>1&&(0,ce.jsx)(Aa,{values:y.scores.slice(-10),width:64,height:20,color:y.score===null?"#d9d9d9":y.score>=80?"#22c55e":y.score>=50?"#f59e0b":"#ef4444"})]})]}),l&&(0,ce.jsx)(za,{assistantId:e,projectId:t,onLearningStarted:o,round:r.round,subTasks:r.subTasks,rounds:r.rounds,subTasksByRound:r.subTasksByRound,loading:r.loading,onRefresh:s??jl,onExpandWorkflow:()=>d(!0)})]}),p==="runtime"&&(0,ce.jsxs)("div",{style:{position:"absolute",left:340,top:12,zIndex:11,background:"#fff",borderRadius:12,padding:16,border:"1px solid #f0f0f0",boxShadow:"0 6px 24px rgba(0,0,0,0.15)",width:420},children:[(0,ce.jsx)("div",{style:{fontSize:12,fontWeight:600,color:"rgba(0,0,0,0.65)",marginBottom:8},children:"Runtime \u2014 last 30 days"}),(0,ce.jsx)(gn,{option:Ia(m.daily30d),height:220})]}),p==="eval"&&(0,ce.jsx)(wt,{open:!0,width:720,title:"Eval quality",onClose:()=>g(null),children:(0,ce.jsx)(zn,{agentId:e,runs:y.runs??[]})}),a&&(0,ce.jsx)(wt,{open:!0,width:860,title:"Learning workflow",onClose:()=>d(!1),children:(0,ce.jsx)($a,{rounds:r.rounds,subTasksByRound:r.subTasksByRound,loading:r.loading})})]})};var Dr=T(Se());var yn=T(W()),$l=({data:e})=>{let[t,n]=Dr.default.useState(!1),o=!!e.pinned;return(0,yn.jsx)("div",{"data-testid":`canvas-zone-${e.label.toLowerCase()}`,style:{width:e.width,height:e.height,borderRadius:18,border:"1.5px dashed rgba(99,102,241,0.28)",background:"rgba(99,102,241,0.04)",pointerEvents:"none",position:"relative"},children:(0,yn.jsxs)("div",{style:{position:"absolute",top:-22,left:2,display:"flex",alignItems:"center",gap:6},children:[(0,yn.jsx)("span",{"data-testid":`canvas-zone-chip-${e.label.toLowerCase()}`,style:{fontSize:11,fontWeight:600,letterSpacing:1,color:"rgba(99,102,241,0.65)",userSelect:"none",pointerEvents:"auto",cursor:"grab"},children:e.label}),e.pinnable&&e.onPinToggle&&(0,yn.jsx)("button",{type:"button","data-testid":`canvas-zone-pin-${e.label.toLowerCase()}`,"aria-label":o?`Unpin ${e.label} zone`:`Pin ${e.label} zone`,"aria-pressed":o,onMouseDown:r=>r.stopPropagation(),onClick:r=>{r.stopPropagation(),e.onPinToggle?.()},onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,padding:0,border:"none",borderRadius:5,background:o?"rgba(99,102,241,0.12)":"transparent",color:o||t?"#6366f1":"rgba(99,102,241,0.45)",cursor:"pointer",pointerEvents:"auto",lineHeight:1},children:(0,yn.jsx)(Si,{size:11,fill:o?"currentColor":"none"})})]})})},ss=Dr.default.memo($l);var et=T(Se());var qo=T(Se()),to="(max-width: 767px)",ql=()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(to).matches:!1;function ls(){let[e,t]=(0,qo.useState)(ql);return(0,qo.useEffect)(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;let n=window.matchMedia(to),o=r=>{t(r.matches)};return t(n.matches),typeof n.addEventListener=="function"?(n.addEventListener("change",o),()=>n.removeEventListener("change",o)):(n.addListener(o),()=>n.removeListener(o))},[]),e}var rn=T(Se()),ds=(e,t)=>e?.requestId===t?.requestId&&e?.content===t?.content;function Wn({assistantId:e,initialMessageRequest:t,onInitialMessageSubmitted:n}){let o=(0,rn.useRef)(new Set),r=t??null,i=(0,rn.useRef)(null);i.current===null&&(i.current={assistantId:e,observedRequest:r,request:r});let[s,c]=(0,rn.useState)(i.current),l=(0,rn.useRef)(s);(0,rn.useLayoutEffect)(()=>{let g=l.current;if(g.assistantId===e&&ds(g.observedRequest,r))return;let a={assistantId:e,observedRequest:r,request:r};l.current=a,c(a)},[e,r?.requestId,r?.content]);let u=s.assistantId===e&&ds(s.observedRequest,r)?s.request:null;return{attemptedRequestIdsRef:o,effectivePendingRequest:u,handleInitialMessageSubmitted:g=>{let a=l.current;if(a.assistantId===e){if(a.request?.requestId===g){let d={...a,request:null};l.current=d,c(m=>m.assistantId===e&&m.request?.requestId===g?{...m,request:null}:m)}n?.(g)}}}}var xt=T(W()),cs=()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(to).matches:!1,Ho=({assistantId:e,assistantName:t,workspaceId:n,projectId:o,contextType:r,initialMessageRequest:i,onInitialMessageSubmitted:s,onToolCompleted:c,label:l="Architect",temporarilyHidden:u=!1,openSignal:p=0,showMobileTrigger:g=!0,restoreFocusRef:a})=>{let[d,m]=(0,et.useState)(cs),[y,v]=(0,et.useState)(()=>!cs()),[f,k]=(0,et.useState)(360),I=(0,et.useRef)(null),D=(0,et.useRef)(null),R=(0,et.useRef)(null),F=i??null,{attemptedRequestIdsRef:N,effectivePendingRequest:E,handleInitialMessageSubmitted:x}=Wn({assistantId:e,initialMessageRequest:i,onInitialMessageSubmitted:s});(0,et.useEffect)(()=>{I.current&&(I.current.inert=u||!y)},[d,u,y]),(0,et.useEffect)(()=>{d&&u&&v(!1)},[d,u]),(0,et.useEffect)(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;let J=window.matchMedia(to),P=B=>{m(B.matches),v(!B.matches)};return m(J.matches),typeof J.addEventListener=="function"?(J.addEventListener("change",P),()=>J.removeEventListener("change",P)):(J.addListener(P),()=>J.removeListener(P))},[]),(0,et.useEffect)(()=>{p>0&&v(!0)},[p]),(0,et.useEffect)(()=>{F&&!d&&v(!0)},[e,F?.requestId,F?.content,d]);let G=(0,et.useCallback)(J=>{J.preventDefault(),R.current={startX:J.clientX,startWidth:f}},[f]);(0,et.useEffect)(()=>{let J=B=>{if(!R.current)return;let j=R.current.startX-B.clientX,O=Math.min(900,Math.max(320,R.current.startWidth+j));k(O)},P=()=>{R.current=null};return window.addEventListener("mousemove",J),window.addEventListener("mouseup",P),()=>{window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",P)}},[]);let ue=(0,xt.jsxs)("div",{ref:I,"data-testid":"architect-copilot-container","aria-hidden":u||!y||void 0,style:d?{width:"100%",height:"100%",overflow:"hidden",visibility:u||!y?"hidden":"visible",pointerEvents:u||!y?"none":void 0}:{position:"absolute",right:12,top:56,bottom:12,width:f,zIndex:15,borderRadius:12,overflow:"hidden",boxShadow:"0 4px 24px rgba(0,0,0,0.12)",visibility:u||!y?"hidden":"visible",pointerEvents:u||!y?"none":void 0},children:[!d&&(0,xt.jsx)("div",{onMouseDown:G,style:{position:"absolute",left:0,top:0,bottom:0,width:6,cursor:"ew-resize",zIndex:2,background:"transparent"}}),(0,xt.jsx)(En,{defaultWorkspaceId:n??void 0,defaultProjectId:o??void 0,children:(0,xt.jsx)(Pn,{workflowContext:{id:e,name:t??"",type:r},onClose:()=>v(!1),onToolCompleted:c,initialMessageRequest:E,attemptedInitialMessageRequestIdsRef:N,rawInitialMessage:!0,onInitialMessageSubmitted:x},e)},`${n??"default"}:${o??"default"}`)]});return(0,xt.jsxs)(xt.Fragment,{children:[!y&&!u&&(!d||g)?(0,xt.jsx)("div",{style:d?{position:"absolute",right:12,bottom:16,zIndex:20}:{position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",zIndex:20},children:(0,xt.jsx)("button",{ref:D,type:"button","aria-label":"Open copilot",onClick:()=>v(!0),style:d?{padding:"9px 14px",background:"#6366f1",color:"#fff",borderRadius:9999,cursor:"pointer",fontSize:12,fontWeight:500,userSelect:"none",border:"none",boxShadow:"0 4px 16px rgba(79,70,229,0.28)"}:{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",border:"none"},children:l})}):null,d?(0,xt.jsx)(ei,{title:l,"aria-label":l,placement:"right",width:"100vw",open:y&&!u,onClose:()=>v(!1),forceRender:!0,destroyOnHidden:!1,styles:{body:{padding:0,overflow:"hidden",height:"100%"}},afterOpenChange:J=>{!J&&!y&&(a?.current??D.current)?.focus()},children:ue}):ue]})};var hn=T(Se());var an=T(W()),no="node:architect-copilot",Hl=({data:e})=>{let{assistantId:t,assistantName:n,workspaceId:o,projectId:r,initialMessageRequest:i,onInitialMessageSubmitted:s,onToolCompleted:c,temporarilyHidden:l=!1,openSignal:u=0,width:p,height:g,center:a}=e,d=xo(),m=(0,hn.useRef)(null),{attemptedRequestIdsRef:y,effectivePendingRequest:v,handleInitialMessageSubmitted:f}=Wn({assistantId:t,initialMessageRequest:i,onInitialMessageSubmitted:s}),k=l,I=()=>d.setCenter(a.x,a.y,{zoom:1,duration:400});return(0,hn.useEffect)(()=>{m.current&&(m.current.inert=k)},[k]),(0,hn.useEffect)(()=>{u>0&&I()},[u]),(0,an.jsxs)("div",{style:{width:p,height:g,position:"relative",fontFamily:"inherit"},children:[(0,an.jsx)("div",{ref:m,"data-testid":"architect-copilot-node-panel","aria-hidden":k||void 0,className:"nodrag nowheel nopan",style:{position:"absolute",top:0,left:0,right:0,bottom:0,borderRadius:12,overflow:"hidden",background:"#fff",visibility:k?"hidden":"visible",pointerEvents:k?"none":void 0,userSelect:"text",WebkitUserSelect:"text"},children:(0,an.jsx)(En,{defaultWorkspaceId:o??void 0,defaultProjectId:r??void 0,children:(0,an.jsx)(Pn,{workflowContext:{id:t,name:n??"",type:"agent"},onToolCompleted:c,initialMessageRequest:v,attemptedInitialMessageRequestIdsRef:y,rawInitialMessage:!0,showHeader:!1,onInitialMessageSubmitted:f},t)},`${o??"default"}:${r??"default"}`)}),k&&(0,an.jsxs)("button",{type:"button","data-testid":"architect-copilot-node-badge","aria-label":"Expand architect copilot",onClick:I,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",gap:6,padding:"9px 14px",background:"#6366f1",color:"#fff",borderRadius:9999,border:"none",cursor:"pointer",fontSize:12,fontWeight:500,userSelect:"none"},children:[(0,an.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",background:"#22c55e",display:"inline-block"}}),"Architect"]})]})},us=hn.default.memo(Hl);var Mr=T(Se());var Uo=(e,t,n,o,r)=>({id:e,label:t,x:n-o/2,y:-r/2,width:o,height:r}),bn=Uo("zone:config","CONFIG",-767,900,620),Bn=Uo("zone:testing","EVALUATION",-69,400,560),Ko=Uo("zone:learning","LEARNING",459,560,680),ps=Uo("zone:copilot","COPILOT",1147,720,740);var gs=[bn.id,Bn.id,Ko.id,ps.id],fs=.45,Kl=220,Ul=110,Zl=200,Zo=90,Vo={"group:subagents":{x:0,y:-190},"group:capabilities":{x:330,y:0},"group:tools":{x:0,y:190},"group:skills":{x:-330,y:0}},ms=e=>({x:e.x+e.width/2-Kl/2,y:e.y+e.height/2-Ul/2}),ys=(e,t,n)=>{let o=Vo[t]??{x:0,y:0};return{x:e.x+e.width/2+o.x-Zl/2,y:e.y+e.height/2+o.y-n/2}},Vl=310,Ql=e=>{let t=bn.x+bn.width/2,n=Vl;for(let[o,r]of Object.entries(e)){let i=Vo[o];i&&(n=Math.max(n,Math.abs(i.y)+r/2+40))}return{id:bn.id,label:bn.label,x:t-bn.width/2,y:-n,width:bn.width,height:n*2}},Yl=900,Lr={x:20,y:20},oo=110,ro=48,Xl=220,Jl=560,ed=e=>({id:Bn.id,label:Bn.label,x:Bn.x,y:Bn.y,width:Bn.width,height:Math.max(Jl,Xl+e+24)}),hs=(e,t,n)=>({x:e.x+e.width/2-oo/2,y:e.y+e.height/2-ro/2}),td=48,nd=520,od=720,Tt=20,Nr=150,rd=12,id=56,ad=12,bs=(e,t,n)=>{let o={},r=rd,i=id,s=ad,c=Math.round((e-r*2-s)/2),l=e-r*2-s-c,u=t-i-r,p=Math.round((u-s)/2),g=n.has("learning"),a=n.has("evaluation");return n.has("copilot")?(o.copilot={width:c},g&&(o.learning=a?{left:r,top:i,width:l,height:p}:{left:r,top:i,width:l,height:u}),a&&(o.evaluation=g?{left:r,top:i+p+s,width:l,height:u-p-s}:{left:r,top:i,width:l,height:u}),o):g&&a?(o.learning={left:r,top:i,width:l,height:u},o.evaluation={left:r+l+s,top:i,width:c,height:u},o):(g&&(o.learning={width:c}),a&&(o.evaluation={width:c}),o)},vs=e=>{let t=Ql(e.groupHeights),n={...ed(e.suitesGroupHeight),width:nd},o=Math.max(Ko.width,e.learningDagBBox.width+Tt*2),r={...Ko,width:o,height:Math.max(Ko.height,e.learningDagBBox.height+Nr+Tt*2)},i={...ps,width:od},s=Math.max(Yl,t.height,n.height,r.height,i.height),c=t.x,l=u=>{let p={x:c,y:-s/2,width:u.width,height:s};return c+=u.width+td,p};return{config:{...l(t),label:t.label,id:t.id},learning:{...l(r),label:r.label,id:r.id},testing:{...l(n),label:n.label,id:n.id},copilot:{...l(i),label:i.label,id:i.id},height:s}};var mt=T(W()),sd=.4,ld=.45,ks=(e,t)=>t==="badge"?e>=ld?"overview":"badge":e<sd?"badge":"overview",dd={background:"rgba(255,255,255,0.92)",border:"1px solid rgba(240,240,240,0.9)",borderRadius:14},cd=({data:e})=>(0,mt.jsxs)("div",{"data-testid":"testing-panel",style:{...dd,width:e.width,minHeight:e.height,boxSizing:"border-box",padding:12,overflow:"auto",display:"flex",flexDirection:"column",gap:12},children:[(0,mt.jsx)(zn,{agentId:e.agentId,runs:e.runs}),e.suites.length>0&&(0,mt.jsxs)("div",{"data-testid":"testing-suites",style:{borderTop:"1px solid #f0f0f0",paddingTop:10,display:"flex",flexDirection:"column",gap:8},children:[(0,mt.jsx)("div",{style:{fontSize:12,fontWeight:600,color:"rgba(0,0,0,0.65)"},children:"Evaluation suites"}),(0,mt.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:e.suites.map(t=>(0,mt.jsxs)("div",{"data-testid":"testing-suite-chip",onClick:()=>e.onSuiteClick(t),style:{display:"inline-flex",alignItems:"center",gap:5,padding:"4px 10px",borderRadius:9999,background:"#fff",border:`1px solid ${Oo("eval")}55`,fontSize:11,color:"#333",cursor:"pointer",whiteSpace:"nowrap"},children:[(0,mt.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:t.label}),t.description&&(0,mt.jsx)("span",{style:{fontSize:10,color:"#999"},children:t.description})]},t.id))})]})]}),ws=Mr.default.memo(cd),ud=({data:e})=>(0,mt.jsxs)("div",{"data-testid":"testing-badge",style:{width:oo,height:ro,borderRadius:10,background:"rgba(255,255,255,0.92)",border:"1px solid rgba(240,240,240,0.9)",display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[(0,mt.jsx)("span",{style:{width:10,height:10,borderRadius:9999,background:e.score===null?"#d1d5db":nn(e.score),flexShrink:0}}),(0,mt.jsx)("span",{style:{fontSize:12,fontWeight:600,color:"#6b7280"},children:e.suiteCount})]}),xs=Mr.default.memo(ud);var Pt=T(Se());var re=T(W());function Fr(e,t){for(let n of e.rounds){let o=e.subTasksByRound[n.id]??[];if(n.id===t)return{task:n,related:[n,...o]};let r=o.find(i=>i.id===t);if(r)return{task:r,related:[n,...o]}}return null}function pd(e,t){let n=e.rounds;if(t){let o=n.find(r=>r.id===t);if(o)return o}for(let o of n)if(Bo(o))return o;return e.round??n[0]??null}function zr(e,t){let n=pd(e,t);return n?[n,...e.subTasksByRound[n.id]??[]]:[]}var Qo=200,Ts=80,gd=40,fd=70,_r={width:0,height:0},md=e=>({headerOffset:{x:e.x+Tt,y:e.y+Tt},headerWidth:e.width-Tt*2,dagOffset:{x:e.x+Tt,y:e.y+Nr+Tt}}),yd={background:"rgba(255,255,255,0.92)",border:"1px solid rgba(240,240,240,0.9)",borderRadius:14,padding:"10px 12px"},hd={traversed:{stroke:"#22c55e",strokeWidth:1.5},flowing:{stroke:"#6366f1",strokeWidth:2},idle:{stroke:"#d1d5db",strokeWidth:1}},bd={stroke:"#cbd5e1",strokeOpacity:.55,strokeWidth:1,strokeDasharray:"5 4"},vd={type:"arrowclosed",color:"#cbd5e1",width:16,height:16};function Rs(e){let t=e.context?.interruption;return e.status==="interrupted"&&typeof t=="object"&&t!==null&&t.type==="review_required"}function Is(e){if(!e)return null;let t=new Date(e).getTime();if(!Number.isFinite(t))return null;let n=Math.floor((Date.now()-t)/6e4);return n<1?"just now":n<60?`${n}m ago`:n<1440?`${Math.floor(n/60)}h ago`:`${Math.floor(n/1440)}d ago`}function Ss(e){let t=e.length>0?e[0]:null,n=new Map(e.map(r=>[r.id,r])),o=new Map;for(let r of e){if(t&&r.id===t.id)continue;let i=r.parentId&&r.parentId!==r.id&&n.has(r.parentId)?r.parentId:t?.id;if(!i)continue;let s=o.get(i)??[];s.push(r),o.set(i,s)}return{byId:n,round:t,childrenOf:o}}function kd(e,t){let n=[],o=[...e.childrenOf.get(t)??[]];for(;o.length>0;){let r=o.pop();if(!r)break;n.push(r),o.push(...e.childrenOf.get(r.id)??[])}return n}function wd(e){return e.some(t=>t.status==="review"||Rs(t))?"#f59e0b":e.some(t=>t.status==="in_progress")?"#3b82f6":"#9ca3af"}function xd(e,t){let n=(e.dependencies??[]).filter(r=>t.has(r));if(n.length===0)return null;let o=n.filter(r=>{let i=t.get(r);return i?!qi(i.status):!1});return o.length>0?{kind:"waiting",count:o.length}:{kind:"done",count:n.length}}function Cs(e,t){let n=e[0]??null;return!n||!t||t===n.id?null:e.some(o=>o.id===t)?t:null}function As(e){let t=new Map(e.map(l=>[l.id,l])),n=new Set(e.map(l=>l.id)),o=new Map([...e].sort((l,u)=>new Date(l.createdAt).getTime()-new Date(u.createdAt).getTime()).map((l,u)=>[l.id,u])),r=new Map,i=new Map;for(let l of e)r.set(l.id,[]),i.set(l.id,0);for(let l of e)for(let u of l.dependencies??[])n.has(u)&&u!==l.id&&(r.get(u)?.push(l.id),i.set(l.id,(i.get(l.id)??0)+1));let s=new Set(n),c=[];for(;s.size>0;){let l=null,u=1/0;for(let g of s){if((i.get(g)??0)!==0)continue;let a=o.get(g)??1/0;a<u&&(l=g,u=a)}if(l===null)break;s.delete(l);let p=t.get(l);p&&c.push(p);for(let g of r.get(l)??[])i.set(g,(i.get(g)??0)-1)}for(let l of[...s].sort((u,p)=>(o.get(u)??1/0)-(o.get(p)??1/0))){let u=t.get(l);u&&c.push(u)}return c}function Td(e,t){let n=new Set(t.map(i=>i.id));if(t.some(i=>(i.dependencies??[]).some(s=>s!==i.id&&n.has(s))))return[];let r=[];for(let i=0;i+1<e.length;i++)r.push({from:e[i].id,to:e[i+1].id,kind:"sequence"});return r}function Yo(e,t,n=null){let o={root:null,tasks:[],edges:[],positions:new Map,bbox:{..._r}},r=Ss(e),i=r.round;if(!i)return o;let s=Cs(e,t),c=s??i.id,l=r.childrenOf.get(c)??[],u=x=>{let G=kd(r,x.id);return G.length===0?null:{count:G.length,dotColor:wd(G)}},p=(x,G,ue)=>({id:x.id,task:x,seq:G,fold:ue?u(x):null,depBadge:xd(x,r.byId)}),g=[],a=[],d=x=>{let G=As(x);return a.push(...Td(G,x)),G};d(l).forEach((x,G)=>{g.push(p(x,G+1,!1)),d(r.childrenOf.get(x.id)??[]).forEach((ue,H)=>{g.push(p(ue,H+1,!0))})});let m=s?g.map(x=>x.task):[i,...g.map(x=>x.task)],v=So(m).edges.map(x=>({from:x.from,to:x.to,kind:x.kind==="parent"?"structure":"dependency"}));v.push(...a);let f=null;if(!s){f={id:i.id,label:n!==null?`R${n}`:"R",title:i.title,status:i.status,doneCount:e.filter(G=>G.status==="completed").length,totalCount:e.length};let x=new Set(v.filter(G=>G.from===i.id).map(G=>`${G.to}:${G.kind}`));for(let G of l)x.has(`${G.id}:structure`)||(v.push({from:i.id,to:G.id,kind:"structure"}),x.add(`${G.id}:structure`))}let k=m.map(x=>({id:x.id})),I=Ro(k,v.map(x=>({from:x.from,to:x.to})),{nodeWidth:Qo,nodeHeight:Ts,nodesep:gd,ranksep:fd,rankdir:"TB"}),D=1/0,R=1/0;for(let x of I.values())D=Math.min(D,x.x),R=Math.min(R,x.y);let F=new Map;if(Number.isFinite(D)&&Number.isFinite(R))for(let[x,G]of I)F.set(x,{x:G.x-D,y:G.y-R});let N=0,E=0;for(let x of F.values())N=Math.max(N,x.x+Qo),E=Math.max(E,x.y+Ts);return{root:f,tasks:g,edges:v,positions:F,bbox:{width:N,height:E}}}function Es(e,t=null){return e.length===0?{width:0,height:0}:Yo(e,t).bbox}var Or={draggable:!1,selectable:!1,focusable:!1,deletable:!1,connectable:!1};function Wr(e,t,n){let o=e.rounds,r=zr(e,t),i=r[0]??null,s=r.filter(Rs),c=Ss(r),l=r.filter(y=>y.status==="completed").length,u=i?o.findIndex(y=>y.id===i.id):-1,p=i?o.length-u:null,g=o.map((y,v)=>({id:y.id,label:`R${o.length-v}`,title:y.title,status:y.status,createdAt:y.createdAt})),a=r.reduce((y,v)=>y?new Date(v.updatedAt).getTime()>new Date(y.updatedAt).getTime()?v:y:v,null),d=Cs(r,n),m=[];if(i&&(m.push({id:i.id,label:`R${p}`}),d)){let y=[],v=c.byId.get(d)??null;for(;v&&v.id!==i.id;)y.unshift(v),v=v.parentId?c.byId.get(v.parentId)??null:null;for(let f of y){let I=As(c.childrenOf.get(f.parentId??"")??[]).findIndex(D=>D.id===f.id)+1;m.push({id:f.id,label:`${I}.${f.title}`})}}return{tree:r,selectedRound:i,roundTreeById:c.byId,focusId:d,reviewTasks:s,doneCount:l,roundNumber:p,roundOptions:g,roundLatestActivity:Is(a?.updatedAt),breadcrumb:m}}var Br=({hasRounds:e,reviewCount:t,onReviewClick:n,roundOptions:o,selectedRoundValue:r,onSelectRound:i,roundTitle:s,roundStatus:c,roundDoneCount:l,roundTotalCount:u,roundWaitingCount:p,roundLatestActivity:g,breadcrumb:a,onFocusTask:d,actions:m})=>{let y=c?qt[c]:null;return(0,re.jsxs)(re.Fragment,{children:[(0,re.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:6},children:[(0,re.jsx)("div",{className:"nodrag nopan nowheel","data-testid":"learning-round-select",children:(0,re.jsx)(at,{size:"small",style:{width:260},placeholder:"Select round",value:r??void 0,allowClear:!0,disabled:o.length===0,onChange:v=>i(v??null),options:o.map(v=>{let f=qt[v.status],k=Is(v.createdAt);return{value:v.id,label:`${v.label} ${v.title} \xB7 ${f.label}${k?` \xB7 ${k}`:""}`}})})}),m]}),!e&&(0,re.jsx)("div",{"data-testid":"learning-empty",style:{fontSize:12,color:"#999",paddingBottom:4},children:"No learning tasks yet"}),y&&s&&(0,re.jsxs)("div",{"data-testid":"learning-round-stats",style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",marginBottom:6},children:[(0,re.jsx)("span",{style:{width:8,height:8,borderRadius:9999,background:y.color,flexShrink:0}}),(0,re.jsx)("span",{style:{fontSize:12,fontWeight:600,color:"#262626"},children:y.label}),(0,re.jsx)("span",{style:{fontSize:11,color:"#d1d5db"},children:"\xB7"}),(0,re.jsxs)("span",{style:{fontSize:11,color:"#8c8c8c"},children:[l,"/",u," tasks"]}),p>0&&(0,re.jsxs)("span",{style:{fontSize:11,fontWeight:600,color:"#b45309",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)",borderRadius:9999,padding:"1px 8px"},children:["\u23F8 ",p," waiting"]}),g&&(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)("span",{style:{fontSize:11,color:"#d1d5db"},children:"\xB7"}),(0,re.jsx)("span",{style:{fontSize:11,color:"#9ca3af"},children:g})]})]}),a.length>1&&(0,re.jsxs)("div",{"data-testid":"learning-breadcrumb",style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",marginBottom:6,fontSize:11,color:"#6b7280"},children:[a.map((v,f)=>(0,re.jsxs)(Pt.default.Fragment,{children:[f>0&&(0,re.jsx)("span",{style:{color:"#d1d5db"},children:"/"}),(0,re.jsx)("button",{type:"button","data-testid":`learning-crumb-${f}`,onClick:()=>d(f===0?null:v.id),style:{border:"none",background:"transparent",padding:0,cursor:"pointer",fontSize:11,fontWeight:600,color:f===a.length-1?"#4b5563":"#6366f1"},children:v.label})]},v.id)),(0,re.jsx)("button",{type:"button","data-testid":"learning-crumb-back",onClick:()=>d(a[a.length-2]?.id??null),style:{border:"none",background:"rgba(99,102,241,0.08)",borderRadius:9999,padding:"1px 8px",cursor:"pointer",fontSize:11,fontWeight:600,color:"#6366f1"},children:"\u2039 Back"})]}),t>0&&(0,re.jsxs)("button",{type:"button","data-testid":"learning-review-banner","aria-label":`Open ${t} task${t>1?"s":""} waiting for approval`,onClick:n,style:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:6,cursor:"pointer",width:"100%",fontSize:12,fontWeight:600,color:"#b45309",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)",borderRadius:8,padding:"5px 8px",marginBottom:6},children:[t," item",t>1?"s":""," waiting for approval"]})]})},Rd=({data:e})=>{let[t,n]=(0,Pt.useState)(!1);return(0,re.jsxs)("div",{style:{...yd,width:e.width},children:[(0,re.jsx)(Br,{hasRounds:e.hasRounds,reviewCount:e.reviewCount,onReviewClick:e.onReviewClick,roundOptions:e.roundOptions,selectedRoundValue:e.selectedRoundValue,onSelectRound:e.onSelectRound,roundNumber:e.roundNumber,roundTitle:e.roundTitle,roundStatus:e.roundStatus,roundDoneCount:e.roundDoneCount,roundTotalCount:e.roundTotalCount,roundWaitingCount:e.roundWaitingCount,roundLatestActivity:e.roundLatestActivity,breadcrumb:e.breadcrumb,onFocusTask:e.onFocusTask,actions:(0,re.jsx)(oe,{size:"small",type:"text",icon:(0,re.jsx)(Xt,{}),"data-testid":"learning-new-task",onClick:()=>n(!0),style:{fontSize:12},children:"New Learning Task"})}),(0,re.jsx)(jo,{open:t,agentId:e.agentId,defaultProjectId:e.projectId??void 0,onClose:()=>n(!1),onCreated:(o,r,i,s)=>{e.onLearningStarted?.(i,o,s),n(!1)}})]})},Ps=Pt.default.memo(Rd),Id=({data:e})=>{let t=qt[e.task.status],[n,o]=(0,Pt.useState)(!1);return(0,re.jsxs)("div",{"data-testid":"learning-dag-task",onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{width:Qo,minHeight:46,padding:"8px 10px",borderRadius:10,cursor:"pointer",border:`1.5px solid ${n?"rgba(99,102,241,0.5)":t.color}`,background:n?"rgba(99,102,241,0.08)":"#fff",transition:"background 0.15s ease, border-color 0.15s ease",animation:t.active?"workflow-node-pulse 1.6s ease-in-out infinite":void 0},children:[(0,re.jsx)(St,{type:"target",position:lt.Top,style:{opacity:0}}),(0,re.jsx)(St,{id:"left",type:"target",position:lt.Left,style:{opacity:0}}),(0,re.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:6},children:[(0,re.jsx)("span",{style:{width:8,height:8,borderRadius:9999,background:t.color,flexShrink:0,marginTop:4}}),(0,re.jsxs)("span",{style:{fontSize:12,fontWeight:600,color:"#262626",flexShrink:0},children:[e.seq,"."]}),(0,re.jsx)("span",{"data-testid":"learning-task-title",title:e.task.title,style:{fontSize:12,fontWeight:600,color:"#262626",lineHeight:"17px",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word"},children:e.task.title})]}),(e.depBadge||e.fold)&&(0,re.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:6,marginTop:5},children:[e.depBadge?(0,re.jsx)("span",{"data-testid":"learning-dep-badge",style:{fontSize:10,fontWeight:600,flexShrink:0,color:e.depBadge.kind==="done"?"#22c55e":"#f59e0b",background:e.depBadge.kind==="done"?"rgba(34,197,94,0.1)":"rgba(245,158,11,0.12)",borderRadius:9999,padding:"1px 6px"},children:e.depBadge.kind==="done"?`\u2B26 ${e.depBadge.count} deps \u2713`:`\u2B26 waits ${e.depBadge.count}`}):(0,re.jsx)("span",{}),e.fold&&(0,re.jsxs)("button",{type:"button","data-testid":"learning-fold",className:"nodrag","aria-label":`Expand ${e.fold.count} nested tasks in ${e.task.title}`,onClick:r=>{r.stopPropagation(),e.onFocusTask?.(e.task.id)},style:{display:"inline-flex",alignItems:"center",gap:4,cursor:"pointer",flexShrink:0,fontSize:10,fontWeight:600,color:"#6b7280",border:"1px solid #e5e7eb",background:"#fafafa",borderRadius:9999,padding:"1px 6px"},children:[(0,re.jsx)("span",{style:{width:6,height:6,borderRadius:9999,background:e.fold.dotColor,flexShrink:0}}),"\u25B8 ",e.fold.count]})]}),(0,re.jsx)(St,{type:"source",position:lt.Bottom,style:{opacity:0}}),t.active&&(0,re.jsx)("style",{children:"@keyframes workflow-node-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.35); } 50% { box-shadow: 0 0 0 6px rgba(59,130,246,0.08); } }"})]})},Xo=Pt.default.memo(Id),Sd=({data:e})=>{let t=qt[e.status],[n,o]=(0,Pt.useState)(!1);return(0,re.jsxs)("div",{"data-testid":"learning-round-root",onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{width:Qo,minHeight:46,padding:"8px 10px",borderRadius:10,cursor:"pointer",border:`1.5px solid ${n?"rgba(99,102,241,0.5)":t.color}`,background:n?"rgba(99,102,241,0.14)":"rgba(99,102,241,0.04)",transition:"background 0.15s ease, border-color 0.15s ease"},children:[(0,re.jsx)(St,{type:"target",position:lt.Top,style:{opacity:0}}),(0,re.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:6},children:[(0,re.jsx)("span",{style:{width:8,height:8,borderRadius:9999,background:t.color,flexShrink:0,marginTop:4}}),(0,re.jsxs)("span",{"data-testid":"learning-round-root-title",title:e.title,style:{fontSize:12,fontWeight:700,color:"#262626",lineHeight:"17px",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word"},children:[e.label," \xB7 ",e.title]})]}),(0,re.jsxs)("div",{style:{fontSize:11,color:"#8c8c8c",marginTop:4},children:[e.doneCount,"/",e.totalCount," tasks done"]}),(0,re.jsx)(St,{type:"source",position:lt.Bottom,style:{opacity:0}})]})},Jo=Pt.default.memo(Sd);function jr(e,t){let{nodeId:n,byId:o,prefix:r=""}=t;return e.edges.map(i=>{if(i.kind==="dependency"||i.kind==="sequence")return{id:`${r}${i.from}->${i.to}:${i.kind}`,source:n(i.from),target:n(i.to),type:"bezier",animated:!1,style:bd,...i.kind==="dependency"?{markerEnd:vd}:{}};let s=ja(o.get(i.to)?.status??"pending");return{id:`${r}${i.from}->${i.to}:structure`,source:n(i.from),target:n(i.to),targetHandle:"left",animated:s==="flowing",style:hd[s]}})}function Ds(e){let{learningTasks:t,selectedRoundId:n,onSelectRound:o,onTaskClick:r,onFocusTask:i,focusTaskId:s,onLearningStarted:c,agentId:l,projectId:u,zone:p}=e;return(0,Pt.useMemo)(()=>{if(!l)return{nodes:[],edges:[],bbox:{..._r},breadcrumb:[]};let g=md(p),a=Wr(t,n,s),{tree:d,selectedRound:m,roundTreeById:y,focusId:v,reviewTasks:f,doneCount:k,roundNumber:I,roundOptions:D,roundLatestActivity:R,breadcrumb:F}=a,E=[{id:"learning:header",type:"learningHeader",position:g.headerOffset,data:{width:g.headerWidth,hasRounds:t.rounds.length>0,reviewCount:f.length,onReviewClick:()=>{f[0]&&r(f[0],d)},onLearningStarted:c,agentId:l,projectId:u,roundOptions:D,selectedRoundId:n,selectedRoundValue:m?.id??null,onSelectRound:o,roundNumber:I,roundTitle:m?.title??null,roundStatus:m?.status??null,roundDoneCount:k,roundTotalCount:d.length,roundWaitingCount:f.length,roundLatestActivity:R,breadcrumb:F,onFocusTask:i},...Or}];if(!m)return{nodes:E,edges:[],bbox:{..._r},breadcrumb:F};let x=Yo(d,v,I),G=p.width-Tt*2,ue=g.dagOffset.x+Math.max(0,(G-x.bbox.width)/2);if(x.root){let P=x.positions.get(x.root.id)??{x:0,y:0};E.push({id:"learning:round-root",type:"learningRoundRoot",position:{x:ue+P.x,y:g.dagOffset.y+P.y},data:{label:x.root.label,title:x.root.title,status:x.root.status,doneCount:x.root.doneCount,totalCount:x.root.totalCount,onTaskClick:()=>r(m,d)},...Or})}for(let P of x.tasks){let B=x.positions.get(P.id)??{x:0,y:0};E.push({id:`learning:task:${P.id}`,type:"learningTask",position:{x:ue+B.x,y:g.dagOffset.y+B.y},data:{task:P.task,seq:P.seq,depBadge:P.depBadge,fold:P.fold,onTaskClick:()=>r(P.task,d),onFocusTask:P.fold?()=>i(P.id):void 0},...Or})}let J=jr(x,{byId:y,nodeId:P=>P===m.id?"learning:round-root":`learning:task:${P}`,prefix:"learning:"});return{nodes:E,edges:J,bbox:x.bbox,breadcrumb:F}},[t,n,o,r,i,s,c,l,u,p])}var sn=T(Se()),it=T(W()),er=[{title:"Welcome to the training canvas",description:"Four zones you can arrange freely. Press Next to learn the basics in 3 quick steps.",targetSelector:null,eventKind:null},{title:"Switch zones",description:"Press \u2318/Ctrl + 2 or 4 \u2014 or click a dot in the pill below \u2014 to jump between zones.",targetSelector:'[data-testid="zone-quick-nav"]',eventKind:"zoneActivated"},{title:"Move a zone",description:"Grab a zone label above any block and drag it anywhere. Positions reset next session.",targetSelector:'[data-testid^="canvas-zone-chip-"]',eventKind:"zoneDragged"},{title:"Pin the copilot",description:"Click \u{1F4CC} on the COPILOT label to dock it into the right split. Click again to unpin.",targetSelector:'[data-testid="canvas-zone-pin-copilot"]',eventKind:"copilotPinned"}],tr=6,Ls=({open:e,step:t,onStep:n,onDone:o,events:r,onEventConsumed:i})=>{let s=er[t]??null,[c,l]=(0,sn.useState)(null),u=e&&s?s.targetSelector:null;(0,sn.useEffect)(()=>{if(!u){l(null);return}let a=0,d=null,m=()=>{let v=document.querySelector(u);if(!v){d!==null&&(d=null,l(null));return}let f=v.getBoundingClientRect(),k={left:f.left-tr,top:f.top-tr,width:f.width+tr*2,height:f.height+tr*2},I=`${k.left}|${k.top}|${k.width}|${k.height}`;I!==d&&(d=I,l(k))};m();let y=()=>{m(),a=window.requestAnimationFrame(y)};return a=window.requestAnimationFrame(y),window.addEventListener("resize",m),()=>{window.cancelAnimationFrame(a),window.removeEventListener("resize",m)}},[u]);let p=(0,sn.useRef)(r);if((0,sn.useEffect)(()=>{let a=p.current;if(p.current=r,!e||!s)return;let d=s.eventKind;!d||!r[d]||a[d]||(i(d),t>=er.length-1?o():n(t+1))}),(0,sn.useEffect)(()=>{if(!e||!s)return;let a=s.eventKind;a&&r[a]&&i(a)},[e,t]),!e||!s)return null;let g=t>=er.length-1;return(0,it.jsxs)(it.Fragment,{children:[(0,it.jsx)("style",{children:`
|
|
250
|
-
.axiom-onboarding-next:hover { background: #4f46e5 !important; }
|
|
251
|
-
.axiom-onboarding-skip:hover { color: #e5e7eb !important; }
|
|
252
|
-
`}),c&&(0,it.jsx)("div",{"data-testid":"onboarding-tour-ring",style:{position:"fixed",left:c.left,top:c.top,width:c.width,height:c.height,border:"2px solid #6366f1",borderRadius:10,pointerEvents:"none",boxShadow:"0 0 0 9999px rgba(0,0,0,0.35)",zIndex:59}}),(0,it.jsxs)("div",{"data-testid":"onboarding-tour-card",style:{position:"fixed",top:16,left:"50%",transform:"translateX(-50%)",zIndex:60,width:360,padding:"12px 16px",background:"rgba(17,24,39,0.92)",color:"#fff",borderRadius:12,boxShadow:"0 8px 24px rgba(0,0,0,0.25)",pointerEvents:"auto"},children:[(0,it.jsx)("div",{"data-testid":"onboarding-tour-dots",style:{display:"flex",gap:6,marginBottom:8},children:er.map((a,d)=>(0,it.jsx)("span",{style:{width:6,height:6,borderRadius:"9999px",background:d===t?"#6366f1":"rgba(255,255,255,0.28)"}},d))}),(0,it.jsx)("div",{style:{fontSize:14,fontWeight:600,marginBottom:4},children:s.title}),(0,it.jsx)("div",{style:{fontSize:12,lineHeight:1.5,color:"rgba(255,255,255,0.82)"},children:s.description}),(0,it.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:8,marginTop:10},children:[(0,it.jsx)("button",{type:"button","data-testid":"onboarding-tour-skip",className:"axiom-onboarding-skip",onClick:o,style:{cursor:"pointer",border:"none",background:"transparent",padding:"4px 8px",fontSize:12,color:"rgba(255,255,255,0.6)"},children:"Skip tour"}),(0,it.jsx)("button",{type:"button","data-testid":"onboarding-tour-next",className:"axiom-onboarding-next",onClick:()=>g?o():n(t+1),style:{cursor:"pointer",border:"none",borderRadius:6,background:"#6366f1",padding:"5px 14px",fontSize:12,fontWeight:600,color:"#fff"},children:g?"Done":"Next"})]})]})]})};var _t=T(Se());var vn=T(W()),Cd={learningTask:Xo,learningRoundRoot:Jo},Ns=({learningTasks:e,selectedRoundId:t,onSelectRound:n,onTaskClick:o,height:r="100%"})=>{let[i,s]=(0,_t.useState)(null);(0,_t.useEffect)(()=>{s(null)},[t]);let c=(0,_t.useMemo)(()=>Wr(e,t,i),[e,t,i]),{dagNodes:l,dagEdges:u}=(0,_t.useMemo)(()=>{let f=Yo(c.tree,c.focusId,c.roundNumber),k=c.tree,I=[];f.root&&c.selectedRound&&I.push({id:f.root.id,type:"learningRoundRoot",position:f.positions.get(f.root.id)??{x:0,y:0},data:{label:f.root.label,title:f.root.title,status:f.root.status,doneCount:f.root.doneCount,totalCount:f.root.totalCount,onTaskClick:()=>o(c.selectedRound,k)}});for(let R of f.tasks)I.push({id:R.id,type:"learningTask",position:f.positions.get(R.id)??{x:0,y:0},data:{task:R.task,seq:R.seq,depBadge:R.depBadge,fold:R.fold,onTaskClick:()=>o(R.task,k),onFocusTask:R.fold?()=>s(R.id):void 0}});let D=jr(f,{byId:c.roundTreeById,nodeId:R=>R});return{dagNodes:I,dagEdges:D}},[c,o]),[p,g,a]=Cn(l),[d,m,y]=An(u);(0,_t.useEffect)(()=>{g(l),m(u)},[l,u,g,m]);let v=(0,_t.useCallback)((f,k)=>{k.data.onTaskClick?.()},[]);return(0,vn.jsxs)("div",{style:{width:"100%",height:r,display:"flex",flexDirection:"column",minHeight:0},children:[(0,vn.jsx)("div",{className:"nodrag nowheel nopan",style:{flexShrink:0,padding:"12px 16px 4px"},children:(0,vn.jsx)(Br,{hasRounds:e.rounds.length>0,reviewCount:c.reviewTasks.length,onReviewClick:()=>{c.reviewTasks[0]&&o(c.reviewTasks[0],c.tree)},roundOptions:c.roundOptions,selectedRoundValue:c.selectedRound?.id??null,onSelectRound:n,roundNumber:c.roundNumber,roundTitle:c.selectedRound?.title??null,roundStatus:c.selectedRound?.status??null,roundDoneCount:c.doneCount,roundTotalCount:c.tree.length,roundWaitingCount:c.reviewTasks.length,roundLatestActivity:c.roundLatestActivity,breadcrumb:c.breadcrumb,onFocusTask:s})}),(0,vn.jsx)("div",{style:{flex:1,minHeight:0,position:"relative"},children:(0,vn.jsx)(Io,{nodes:p,edges:d,nodeTypes:Cd,onNodesChange:a,onEdgesChange:y,onNodeClick:v,fitView:!0,fitViewOptions:{padding:.15,maxZoom:1.2},nodesDraggable:!1,nodesConnectable:!1,miniMap:!1})})]})};var pe=T(W()),Ad={"zone:copilot":"copilot","zone:learning":"learning","zone:testing":"evaluation"},Ed={copilot:"COPILOT",learning:"LEARNING",evaluation:"EVALUATION"},Ms={copilot:"copilot",learning:"learning",testing:"evaluation"},Pd=(e,t)=>{if(Object.keys(t).length===0)return e;let n=o=>{let r=t[o.id];return r?{...o,x:r.x,y:r.y}:o};return{config:n(e.config),copilot:n(e.copilot),learning:n(e.learning),testing:n(e.testing),height:e.height}},Dd={rounds:[],round:null,subTasks:[],subTasksByRound:{},loading:!1},nr={padding:"1px 6px",marginRight:6,border:"1px solid #e0e0e0",borderRadius:4,background:"#fafafa",fontSize:11,fontFamily:"monospace",color:"#595959"},zs="axiom.trainingCanvas.guideDismissed",Ld=()=>{try{return typeof window<"u"&&window.localStorage?.getItem(zs)==="1"}catch{return!1}},Nd=e=>{try{window.localStorage?.setItem(zs,e?"1":"0")}catch{}},Ws="axiom.trainingCanvas.tutorialDone",Md=()=>{try{return typeof window<"u"&&window.localStorage?.getItem(Ws)==="1"}catch{return!1}},Os=e=>{try{window.localStorage?.setItem(Ws,e?"1":"0")}catch{}},Gr="axiom.trainingCanvas.layout",Od=["copilot","learning","evaluation"],_d=new Set(gs),Fd=e=>{if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.x=="number"&&Number.isFinite(t.x)&&typeof t.y=="number"&&Number.isFinite(t.y)},_s=()=>{try{if(typeof window>"u")return null;let e=window.localStorage?.getItem(Gr);if(!e)return null;let t=JSON.parse(e);if(typeof t!="object"||t===null)return null;let n=t;if(n.version!==1)return null;let o={};if(typeof n.origins=="object"&&n.origins!==null)for(let[r,i]of Object.entries(n.origins))Fd(i)&&(o[r]=i);return{version:1,pinned:Array.isArray(n.pinned)?n.pinned.filter(r=>typeof r=="string"):[],origins:o}}catch{return null}},Fs=(e,t)=>{try{let n={version:1,pinned:[...e],origins:t};window.localStorage?.setItem(Gr,JSON.stringify(n))}catch{}},zd=()=>{try{window.localStorage?.removeItem(Gr)}catch{}},Bs=({graphDefinition:e,onSelectNode:t,assistantId:n,assistantName:o,workspaceId:r,onRemoveNode:i,initialMessageRequest:s,onInitialMessageSubmitted:c,projectId:l,onProjectChange:u,onLearningStarted:p,onToolActivity:g,learningTasks:a,onLearningRefresh:d,evalTick:m,evalData:y,hudTopOffset:v,copilotTemporarilyHidden:f,onOpenArchitect:k,architectOpenSignal:I=0,architectRestoreFocusRef:D})=>{let[R,F,N]=Cn([]),[E,x,G]=An([]),[ue,H]=(0,q.useState)(null),J=ls(),P=xo(),B=(0,q.useRef)(!1),[j,O]=(0,q.useState)(!Ld()),[te,C]=(0,q.useState)(null),Q=(0,q.useRef)(null),[de,ye]=(0,q.useState)(()=>!Md()),[Re,fe]=(0,q.useState)(0),[_,A]=(0,q.useState)({zoneActivated:!1,zoneDragged:!1,copilotPinned:!1}),ee=(0,q.useCallback)(w=>{A(S=>S[w]?S:{...S,[w]:!0})},[]),Z=(0,q.useRef)({onInitialMessageSubmitted:c,onToolActivity:g,onLearningStarted:p});Z.current={onInitialMessageSubmitted:c,onToolActivity:g,onLearningStarted:p};let[L,K]=(0,q.useState)(()=>{let w=new Set;for(let S of _s()?.pinned??[])Od.includes(S)&&w.add(S);return w}),[ke,M]=(0,q.useState)(()=>{let w={};for(let[S,z]of Object.entries(_s()?.origins??{}))_d.has(S)&&(w[S]=z);return w}),X=(0,q.useRef)(L);X.current=L;let ae=(0,q.useRef)(ke);ae.current=ke;let be=(0,q.useCallback)(w=>{let S=new Set(X.current);S.has(w)?S.delete(w):(S.add(w),w==="copilot"&&ee("copilotPinned")),X.current=S,K(S),Fs([...S],ae.current)},[ee]),Ie=(0,q.useRef)(null),[Pe,je]=(0,q.useState)(()=>({width:typeof window>"u"?1200:window.innerWidth,height:typeof window>"u"?800:window.innerHeight}));(0,q.useEffect)(()=>{let w=Ie.current;if(!w||typeof ResizeObserver>"u")return;let S=()=>{let ze=w.getBoundingClientRect();je({width:ze.width,height:ze.height})},z=new ResizeObserver(S);return z.observe(w),S(),()=>z.disconnect()},[]);let Me=(0,q.useMemo)(()=>bs(Pe.width,Pe.height,L),[Pe,L]),_e=Wn({assistantId:n??"",initialMessageRequest:s,onInitialMessageSubmitted:w=>Z.current.onInitialMessageSubmitted?.(w)}),He=(0,q.useCallback)(w=>{C(w),ee("zoneActivated"),Q.current!==null&&window.clearTimeout(Q.current),Q.current=window.setTimeout(()=>C(null),700)},[ee]);(0,q.useEffect)(()=>()=>{Q.current!==null&&window.clearTimeout(Q.current)},[]);let[Ve,Rt]=(0,q.useState)(null),[Fe,Dt]=(0,q.useState)(null),[Ft,Ut]=(0,q.useState)(null),Zt=(0,q.useCallback)(w=>Ut(w.id),[]),zt=(0,q.useCallback)(()=>Ut(null),[]),Lt=(0,q.useCallback)(w=>Dt(w),[]),Vt=(0,q.useCallback)((w,S,z)=>Z.current.onLearningStarted?.(w,S,z),[]),{suites:yt}=Sn(y.evalProjectId??""),ln=yt.map(w=>`${w.name}:${w.caseCount??0}`).join("|"),V=(0,q.useMemo)(()=>{let w={};for(let S of yt)w[S.name]=S.caseCount??0;return w},[ln]),De=(0,q.useMemo)(()=>y.suiteNames.map(w=>({id:`suite:${w}`,type:"eval",label:w,description:`${V[w]??0} cases`})),[y.suiteNames,V]),Ge=(0,q.useMemo)(()=>pa(e,{includeEmptyGroups:!0}),[e]),ct=(0,q.useMemo)(()=>({zone:ss,config:ha,agent:ya,copilot:us,testingPanel:ws,testingBadge:xs,learningHeader:Ps,learningTask:Xo,learningRoundRoot:Jo}),[]),dn=Wi(w=>w.transform[2]),io=(0,q.useRef)("overview"),jn=ks(dn,io.current);io.current=jn;let Wt=a??Dd,kn=(0,q.useMemo)(()=>{let w=new Map(Ge.groups.map(z=>[z.id,z])),S={};for(let z of Ge.groups)w.get(z.id)&&(S[z.id]=Math.max(Zo,56+z.items.length*30));return S},[Ge.groups]),Gn=(0,q.useMemo)(()=>y.suiteNames.length>0?Math.max(Zo,56+y.suiteNames.length*30):0,[y.suiteNames]),cn=(0,q.useMemo)(()=>zr(Wt,Ve),[Wt,Ve]),ao=(0,q.useMemo)(()=>Es(cn,Fe),[cn,Fe]),Qe=(0,q.useMemo)(()=>vs({groupHeights:kn,suitesGroupHeight:Gn,learningDagBBox:ao}),[kn,Gn,ao]),we=(0,q.useMemo)(()=>Pd(Qe,ke),[Qe,ke]),$n=(0,q.useRef)({}),ht=(0,q.useRef)({}),wn=(0,q.useRef)(null),[un,so]=(0,q.useState)({x:0,y:0}),ir=(0,q.useMemo)(()=>{let w=we.learning;return un.x===0&&un.y===0?w:{...w,x:w.x+un.x,y:w.y+un.y}},[we,un]),ar=(0,q.useCallback)((w,S)=>{w.startsWith("zone:")&&(wn.current=w,ht.current[w]={x:S.x,y:S.y})},[]),sr=(0,q.useCallback)((w,S)=>{if(!w.startsWith("zone:"))return;let z=ht.current[w],ze={x:S.x,y:S.y};if(ht.current[w]=ze,!z)return;let ot=ze.x-z.x,bt=ze.y-z.y;if(ot===0&&bt===0)return;let xn=$n.current[w]??[];w==="zone:learning"&&so(Tn=>({x:Tn.x+ot,y:Tn.y+bt})),xn.length>0&&F(Tn=>Tn.map(Qt=>Qt.position&&xn.indexOf(Qt.id)>=0?{...Qt,position:{x:Qt.position.x+ot,y:Qt.position.y+bt}}:Qt))},[F]),lr=(0,q.useCallback)((w,S)=>{if(!w.startsWith("zone:"))return;wn.current=null,delete ht.current[w],w==="zone:learning"&&so({x:0,y:0}),ee("zoneDragged");let z=Object.keys(ae.current).length===0?{"zone:config":{x:Qe.config.x,y:Qe.config.y},"zone:copilot":{x:Qe.copilot.x,y:Qe.copilot.y},"zone:learning":{x:Qe.learning.x,y:Qe.learning.y},"zone:testing":{x:Qe.testing.x,y:Qe.testing.y}}:{...ae.current};z[w]={x:S.x,y:S.y},ae.current=z,M(z),Fs([...X.current],z)},[Qe,ee]),lo=(0,q.useCallback)(()=>{zd(),X.current=new Set,K(new Set),ae.current={},M({})},[]),b=Ds({learningTasks:Wt,selectedRoundId:Ve,zone:ir,onSelectRound:Rt,onTaskClick:Zt,onFocusTask:Lt,focusTaskId:Fe,onLearningStarted:Vt,agentId:n??"",projectId:l}),se=Ft?Fr(Wt,Ft):null;(0,q.useEffect)(()=>{Ft&&!se&&Ut(null)},[Ft,se]),(0,q.useEffect)(()=>{Dt(null)},[Ve]),(0,q.useEffect)(()=>{Fe&&!Fr(Wt,Fe)&&Dt(null)},[Fe,Wt]),(0,q.useEffect)(()=>{let w=Ge.groups,S=new Map(w.map(ge=>[ge.id,ge])),z=[],ze=!!n&&!J,ot=we.config,bt=we.testing,xn=L.has("copilot"),Tn=L.has("learning"),Qt=L.has("evaluation"),Ur=[we.config,we.testing,we.learning,we.copilot].filter(ge=>ge.id!==we.copilot.id||ze&&!xn).filter(ge=>ge.id!==we.learning.id||!!n&&!Tn).filter(ge=>ge.id!==we.testing.id||!Qt).map(ge=>{let Ye=Ad[ge.id];return{id:ge.id,type:"zone",position:{x:ge.x,y:ge.y},data:{label:ge.label,width:ge.width,height:ge.height,pinnable:Ye!==void 0,pinned:Ye!==void 0&&L.has(Ye),onPinToggle:Ye!==void 0?()=>be(Ye):void 0},draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1,zIndex:-1,style:{pointerEvents:"none"}}});z.push(...Ur);let Zr={[we.config.id]:[],[we.testing.id]:[],[we.learning.id]:[],[we.copilot.id]:[]},qn=(ge,Ye)=>{let Hn=Zr[ge];Hn&&Hn.indexOf(Ye)<0&&Hn.push(Ye)};qn(we.config.id,Ge.agent.id),z.push({id:Ge.agent.id,type:"agent",draggable:!1,data:{node:Ge.agent,onClick:()=>t?.(Ge.agent)},position:ms(ot)});for(let ge of w){let Ye=S.get(ge.id);if(!Ye)continue;let Hn=kn[ge.id]??Math.max(Zo,56+ge.items.length*30);qn(we.config.id,ge.id),z.push({id:ge.id,type:"config",draggable:!1,data:{group:Ye,onClick:Ys=>t?.(Ys),onRemove:i},position:ys(ot,ge.id,Hn)})}L.has("evaluation")||(jn==="badge"?y.suiteNames.length>0&&(qn(we.testing.id,"testing:badge"),z.push({id:"testing:badge",type:"testingBadge",draggable:!1,data:{score:y.score,suiteCount:y.suiteNames.length},position:hs(bt,oo,ro)})):(qn(we.testing.id,"testing:panel"),z.push({id:"testing:panel",type:"testingPanel",draggable:!1,data:{agentId:n??"",runs:y.runs,width:bt.width-Tt*2,height:bt.height-Tt*2,suites:De,onSuiteClick:ge=>t?.(ge)},position:{x:bt.x+Lr.x,y:bt.y+Lr.y}}))),ze&&!L.has("copilot")&&(qn(we.copilot.id,no),z.push({id:no,type:"copilot",draggable:!1,data:{assistantId:n,assistantName:o??"",workspaceId:r,projectId:l,initialMessageRequest:s??null,onInitialMessageSubmitted:ge=>Z.current.onInitialMessageSubmitted?.(ge),onToolCompleted:ge=>Z.current.onToolActivity?.(ge),temporarilyHidden:f??!1,openSignal:I,width:we.copilot.width,height:we.copilot.height,center:{x:we.copilot.x+we.copilot.width/2,y:we.copilot.y+we.copilot.height/2}},position:{x:we.copilot.x,y:we.copilot.y}})),$n.current=Zr;for(let ge of Ur)wn.current!==ge.id&&(ht.current[ge.id]={x:ge.position.x,y:ge.position.y});F(z);let Vr=(ge,Ye)=>Math.abs(ge)>Math.abs(Ye)?ge<0?"left":"right":Ye<0?"top":"bottom";x(w.map(ge=>{let Ye=Vo[ge.id]??{x:0,y:0};return{id:`e${Ge.agent.id}-${ge.id}`,source:Ge.agent.id,target:ge.id,sourceHandle:Vr(Ye.x,Ye.y),targetHandle:Vr(-Ye.x,-Ye.y),style:{stroke:"#c7c7c7",strokeWidth:1.2},type:"bezier"}}))},[Ge,F,x,i,n,J,r,l,o,f,I,s?.requestId,s?.content,jn,De,y.score,y.suiteNames,y.runs.map(w=>w.id).join(","),we,kn,L,be]);let $=ji();(0,q.useEffect)(()=>{if(!$||B.current)return;B.current=!0;let w=P.getNodes().filter(S=>!S.id.startsWith("zone:"));P.fitView({padding:.2,nodes:w}).then(S=>{S&&P.getZoom()<fs&&P.fitView({padding:.2,nodes:P.getNodes().filter(z=>z.type==="agent"||z.type==="config")})})},[$,P]),(0,q.useEffect)(()=>{let w=[["1","zone:config","config"],["2","zone:learning","learning"],["3","zone:testing","testing"],["4","zone:copilot","copilot"]],S=z=>{if(!(z.ctrlKey||z.metaKey))return;let ze=w.find(([xn])=>z.key===xn);if(!ze)return;let ot=z.target;if(ot&&(ot.tagName==="INPUT"||ot.tagName==="TEXTAREA"||ot.tagName==="SELECT"||ot.isContentEditable))return;z.preventDefault();let bt=Ms[ze[2]];bt&&L.has(bt)||(He(ze[2]),P.fitView({padding:.4,duration:400,nodes:[{id:ze[1]}]}))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[P,He,L]);let xe=(0,q.useMemo)(()=>{let w=R.some(S=>S.id===ue)?ue:null;return w===null?R:R.map(S=>{if(S.id===no||S.id.startsWith("zone:")||S.id.startsWith("testing:"))return S;let z=S.id===w||E.some(ze=>ze.source===w&&ze.target===S.id||ze.target===w&&ze.source===S.id);return{...S,style:{opacity:z?1:.4,transition:"opacity 0.2s ease"}}})},[R,E,ue]);return(0,pe.jsxs)("div",{ref:Ie,style:{width:"100%",height:"100%",position:"relative",background:"#fafafa"},children:[(0,pe.jsx)("style",{children:`.axiom-training-canvas .react-flow__pane { cursor: default; }
|
|
253
|
-
.axiom-training-canvas .react-flow__pane.dragging { cursor: grabbing; }
|
|
254
|
-
@keyframes zone-dot-pulse { 0% { box-shadow: 0 0 0 0 rgba(99,102,241,0.5); } 100% { box-shadow: 0 0 0 8px rgba(99,102,241,0); } }
|
|
255
|
-
.zone-dot-active { animation: zone-dot-pulse 0.7s ease-out; }
|
|
256
|
-
.zone-help-toggle:hover { color: #6366f1; }`}),(0,pe.jsxs)(Bi,{className:"axiom-training-canvas",nodes:[...xe,...L.has("learning")?[]:b.nodes],edges:[...E,...L.has("learning")?[]:b.edges],onNodesChange:N,onEdgesChange:G,onNodeDragStart:(w,S)=>ar(S.id,S.position),onNodeDrag:(w,S)=>sr(S.id,S.position),onNodeDragStop:(w,S)=>lr(S.id,S.position),onNodeMouseEnter:(w,S)=>{S.id===no||S.id.startsWith("zone:")||S.id.startsWith("testing:")||S.type?.startsWith("learning")||H(S.id)},onNodeMouseLeave:()=>H(null),onPaneClick:()=>t?.(null),onNodeClick:(w,S)=>{if(S.type!=="learningTask"&&S.type!=="learningRoundRoot")return;S.data.onTaskClick?.()},nodeTypes:ct,children:[(0,pe.jsx)(Gi,{color:"#eee",gap:20}),(0,pe.jsx)($i,{})]}),(0,pe.jsx)(wt,{open:se!==null,width:860,title:se?.task.title??"",onClose:zt,bodyStyle:{padding:0,overflow:"hidden"},children:se&&(0,pe.jsx)(Ir,{task:se.task,relatedTasks:se.related,onClose:zt,onRefresh:d,height:"100%"})}),["copilot","learning","evaluation"].map(w=>{let S=Me[w];return S?(0,pe.jsxs)(wt,{open:!0,width:S.width,left:S.left,top:S.top,height:S.height,escapeEnabled:!1,zIndex:20,title:Ed[w],onClose:()=>be(w),bodyStyle:{padding:0},children:[w==="copilot"&&n&&(0,pe.jsx)("div",{style:{width:"100%",height:"100%",userSelect:"text",WebkitUserSelect:"text"},children:(0,pe.jsx)(En,{defaultWorkspaceId:r??void 0,defaultProjectId:l??void 0,children:(0,pe.jsx)(Pn,{workflowContext:{id:n,name:o??"",type:"agent"},onToolCompleted:z=>Z.current.onToolActivity?.(z),initialMessageRequest:_e.effectivePendingRequest,attemptedInitialMessageRequestIdsRef:_e.attemptedRequestIdsRef,rawInitialMessage:!0,showHeader:!1,onInitialMessageSubmitted:_e.handleInitialMessageSubmitted},n)},`${r??"default"}:${l??"default"}`)}),w==="learning"&&(0,pe.jsx)(Ns,{learningTasks:Wt,selectedRoundId:Ve,onSelectRound:Rt,agentId:n??"",projectId:l,onTaskClick:Zt,height:"100%"}),w==="evaluation"&&(0,pe.jsx)(zn,{agentId:n??"",runs:y.runs})]},w):null}),n&&(0,pe.jsx)($o,{assistantId:n,projectId:l,onProjectChange:u,onLearningStarted:p,learningTasks:a,topOffset:v,onLearningRefresh:d,evalTick:m,showLearning:!1,variant:"selector"}),n&&J&&(0,pe.jsx)(Ho,{assistantId:n,assistantName:o??"",workspaceId:r,projectId:l,contextType:"agent",initialMessageRequest:s,onInitialMessageSubmitted:c,onToolCompleted:w=>g?.(w),temporarilyHidden:f,openSignal:I,restoreFocusRef:D,showMobileTrigger:k===void 0}),j&&(0,pe.jsxs)("div",{"data-testid":"zone-help-card",style:{position:"absolute",bottom:58,left:"50%",transform:"translateX(-50%)",zIndex:13,width:300,padding:"12px 14px",background:"#fff",borderRadius:12,border:"1px solid #f0f0f0",boxShadow:"0 4px 16px rgba(0,0,0,0.10)"},children:[(0,pe.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[(0,pe.jsx)("span",{style:{fontSize:13,fontWeight:600,color:"#262626"},children:"Quick navigation"}),(0,pe.jsx)("span",{"data-testid":"zone-help-close",onClick:()=>{Nd(!0),O(!1)},style:{cursor:"pointer",color:"#8c8c8c",fontSize:12,lineHeight:1},children:"\u2715"})]}),(0,pe.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6,fontSize:12,color:"#595959"},children:[(0,pe.jsxs)("div",{children:[(0,pe.jsx)("span",{style:nr,children:"\u2318/Ctrl + 1\u20134"})," focus a zone"]}),(0,pe.jsxs)("div",{children:[(0,pe.jsx)("span",{style:nr,children:"Click a dot"})," focus a zone"]}),(0,pe.jsxs)("div",{children:[(0,pe.jsx)("span",{style:nr,children:"Drag a zone label"})," move the block"]}),(0,pe.jsxs)("div",{children:[(0,pe.jsx)("span",{style:nr,children:"\u{1F4CC} Click a zone label"})," pin it into the side split (click again to unpin)"]}),(0,pe.jsx)("div",{style:{color:"#8c8c8c"},children:"\u2460 Config \u2461 Learning \u2462 Evaluation \u2463 Copilot"})]}),(0,pe.jsxs)("div",{style:{marginTop:8,paddingTop:8,borderTop:"1px solid #f0f0f0",display:"flex",justifyContent:"flex-end",gap:8},children:[(0,pe.jsx)("button",{type:"button","data-testid":"start-tutorial",onClick:()=>{Os(!1),fe(0),ye(!0)},style:{cursor:"pointer",border:"1px solid #6366f1",borderRadius:4,background:"#6366f1",padding:"2px 10px",fontSize:12,color:"#fff"},children:"Start tutorial"}),(0,pe.jsx)("button",{type:"button","data-testid":"layout-reset",onClick:lo,style:{cursor:"pointer",border:"1px solid #e0e0e0",borderRadius:4,background:"#fafafa",padding:"2px 10px",fontSize:12,color:"#595959"},children:"Reset layout"})]})]}),(0,pe.jsxs)("div",{"data-testid":"zone-quick-nav",style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",zIndex:12,display:"flex",gap:10,padding:"8px 14px",background:"#fff",borderRadius:9999,border:"1px solid #f0f0f0",boxShadow:"0 2px 12px rgba(0,0,0,0.08)"},children:[[["config","Config"],["learning","Learning"],["testing","Evaluation"],["copilot","Copilot"]].map(([w,S])=>{let z=Ms[w],ze=z!==void 0&&L.has(z);return(0,pe.jsx)("button",{type:"button","aria-label":`Fit ${S} zone`,"data-testid":`zone-dot-${w}`,className:te===w?"zone-dot-active":void 0,onClick:()=>{He(w),P.fitView({padding:.4,duration:400,nodes:[{id:we[w].id}]})},style:{width:10,height:10,borderRadius:"9999px",border:"none",padding:0,cursor:"pointer",background:te===w||ze?"#6366f1":"#d9d9d9"}},w)}),(0,pe.jsx)("span",{"aria-hidden":"true",style:{width:1,alignSelf:"stretch",background:"#f0f0f0"}}),(0,pe.jsx)("span",{"data-testid":"zone-help-toggle",className:"zone-help-toggle","aria-label":"Quick navigation guide",onClick:()=>O(w=>!w),style:{cursor:"pointer",color:"#8c8c8c",fontSize:12,lineHeight:"10px",userSelect:"none"},children:"\u24D8"})]}),(0,pe.jsx)(Ls,{open:de,step:Re,onStep:fe,onDone:()=>{Os(!0),ye(!1)},events:_,onEventConsumed:w=>A(S=>({...S,[w]:!1}))})]})},Wd=e=>{let t=zo(e.assistantId??""),n=(0,q.useRef)(e.evalTick??0);return(0,q.useEffect)(()=>{let o=e.evalTick??0,r=n.current;n.current=o,o>0&&o!==r&&t.refresh().catch(()=>{})},[e.evalTick]),(0,pe.jsx)(Bs,{...e,evalData:t})},Bd=({evalData:e,...t})=>(0,pe.jsx)(Bs,{...t,evalData:e}),js=({evalData:e,...t})=>(0,pe.jsx)(To,{children:e?(0,pe.jsx)(Bd,{...t,evalData:e}):(0,pe.jsx)(Wd,{...t})});var or=T(Se());var tt=T(W()),{Text:$r}=qe;function jd(e){let t=null;if(typeof e=="string")try{t=JSON.parse(e)}catch{return null}else e&&typeof e=="object"&&(t=e);if(!t||typeof t.workflowYaml!="string")return null;try{return Qi(t.workflowYaml)}catch{return null}}var Gs=({graphDefinition:e,assistantId:t,assistantName:n,workspaceId:o,description:r,initialMessageRequest:i,onInitialMessageSubmitted:s,projectId:c,onProjectChange:l,onLearningStarted:u,onToolActivity:p,learningTasks:g,onLearningRefresh:a,evalTick:d,hideTitleBar:m=!1,hudTopOffset:y,copilotTemporarilyHidden:v,onOpenArchitect:f,architectOpenSignal:k=0,architectRestoreFocusRef:I})=>{let[D,R]=(0,or.useState)(!1),F=(0,or.useMemo)(()=>jd(e),[e]);return(0,tt.jsxs)("div",{style:{width:"100%",height:"100%",position:"relative",background:"#fafafa"},children:[(0,tt.jsx)(To,{children:(0,tt.jsx)("div",{style:{width:"100%",height:"100%"},children:F?(0,tt.jsx)(Vi,{dsl:F}):(0,tt.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,tt.jsx)($r,{type:"secondary",children:"No workflow DSL yet \u2014 ask the architect to design one"})})})}),!m&&(0,tt.jsxs)("div",{style:{position:"absolute",top:12,right:12,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,tt.jsx)(bo,{size:16,color:"#6366f1"}),(0,tt.jsx)($r,{strong:!0,style:{fontSize:13},children:n}),(0,tt.jsx)(yo,{style:{color:"#6366f1",cursor:"pointer",fontSize:15},onClick:()=>R(!0)})]}),(0,tt.jsx)($o,{assistantId:t,projectId:c,onProjectChange:l,onLearningStarted:u,learningTasks:g,topOffset:y,onLearningRefresh:a,evalTick:d}),(0,tt.jsx)(Ho,{assistantId:t,assistantName:n,workspaceId:o,projectId:c,contextType:"workflow",label:"Builder",initialMessageRequest:i,onInitialMessageSubmitted:s,onToolCompleted:N=>p?.(N),temporarilyHidden:v,openSignal:k,restoreFocusRef:I,showMobileTrigger:f===void 0}),(0,tt.jsx)($e,{title:n,open:D,onCancel:()=>R(!1),footer:null,width:"85vw",centered:!0,styles:{body:{maxHeight:"calc(85vh - 120px)",overflow:"auto",padding:"12px 24px 24px"}},children:r?(0,tt.jsx)(In,{content:r}):(0,tt.jsx)($r,{type:"secondary",children:"No description set."})})]})};var Xe=T(Se());var Y=T(W()),{Text:qr}=qe;function $s(e){switch(e.type){case"capability":case"agent":return 560;case"eval":return 860;default:return 400}}function qs(e){return e.label}var Gd=({label:e,confirmLabel:t,onConfirm:n})=>{let[o,r]=(0,Xe.useState)(!1);return o?(0,Y.jsx)(oe,{danger:!0,size:"small",onClick:n,children:t}):(0,Y.jsx)(oe,{danger:!0,size:"small",type:"text",onClick:()=>r(!0),children:e})},Kt=({title:e,children:t})=>(0,Y.jsxs)("div",{style:{marginBottom:16},children:[(0,Y.jsx)("div",{style:{fontSize:12,fontWeight:600,color:"#999",marginBottom:6},children:e}),t]}),$d=({node:e})=>{let{get:t}=nt(),[n,o]=(0,Xe.useState)(null),[r,i]=(0,Xe.useState)(!0);if((0,Xe.useEffect)(()=>{let l=!1;return i(!0),t("/api/tools").then(u=>{if(l)return;let p=u.data?.records?.find(g=>g.name===e.label)??null;o(p)}).catch(()=>!l&&o(null)).finally(()=>!l&&i(!1)),()=>{l=!0}},[t,e.label]),r)return(0,Y.jsx)(ut,{size:"small"});if(!n)return(0,Y.jsx)(qr,{type:"secondary",style:{fontSize:13},children:"Tool details unavailable."});let s=n.schema?.properties??{},c=new Set(n.schema?.required??[]);return(0,Y.jsxs)(Y.Fragment,{children:[n.description&&(0,Y.jsx)(Kt,{title:"Description",children:n.description}),Object.keys(s).length>0&&(0,Y.jsx)(Kt,{title:"Parameters",children:Object.entries(s).map(([l,u])=>(0,Y.jsxs)("div",{style:{display:"flex",gap:8,fontSize:12,padding:"4px 0",alignItems:"baseline"},children:[(0,Y.jsxs)("span",{style:{color:"#333",fontWeight:600},children:[l,c.has(l)&&(0,Y.jsx)("span",{style:{color:"#ef4444"},children:" *"})]}),(0,Y.jsx)("span",{style:{color:"#999"},children:u.type??"any"}),u.description&&(0,Y.jsx)("span",{style:{color:"#666",flex:1},children:u.description})]},l))})]})},qd=({node:e})=>{let{get:t}=nt(),[n,o]=(0,Xe.useState)(null),[r,i]=(0,Xe.useState)(!0);return(0,Xe.useEffect)(()=>{let s=!1;return i(!0),t(`/api/assistants/${e.label}`).then(c=>!s&&o(c.data??null)).catch(()=>!s&&o(null)).finally(()=>!s&&i(!1)),()=>{s=!0}},[t,e.label]),r?(0,Y.jsx)(ut,{size:"small"}):n?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Kt,{title:"Description",children:n.description||"No description"}),n.graphDefinition?.modelKey&&(0,Y.jsx)(Kt,{title:"Model",children:n.graphDefinition.modelKey})]}):(0,Y.jsx)(qr,{type:"secondary",style:{fontSize:13},children:"Sub-agent details unavailable."})},Hd=({node:e})=>{let{get:t}=nt(),[n,o]=(0,Xe.useState)(null),[r,i]=(0,Xe.useState)(!0);return(0,Xe.useEffect)(()=>{let s=!1;return i(!0),t(`/api/skills/${e.label}`).then(c=>!s&&o(c.data??null)).catch(()=>!s&&o(null)).finally(()=>!s&&i(!1)),()=>{s=!0}},[t,e.label]),r?(0,Y.jsx)(ut,{size:"small"}):n?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Kt,{title:"Description",children:n.description||"No description"}),n.content&&(0,Y.jsx)(Kt,{title:"Content",children:(0,Y.jsx)(In,{content:n.content})})]}):(0,Y.jsx)(qr,{type:"secondary",style:{fontSize:13},children:"Skill details unavailable."})},Kd=({node:e,graphDefinition:t,onSaveGraph:n})=>{let{config:o}=go(),{middlewareTypes:r}=Eo(o.middlewareTypesEndpoint),i=e.config??{},[s,c]=(0,Xe.useState)({id:i.type??e.id,type:i.type??"unknown",name:i.name??e.label,description:i.description??"",enabled:i.enabled!==!1,config:i.config??{},allowedTools:i.allowedTools}),[l,u]=(0,Xe.useState)(!1),p=(o.availableMiddlewareTypes||r)?.find(a=>a.type===s.type),g=async()=>{if(n){u(!0);try{let a=typeof t=="object"&&t!==null?t:{},d=Array.isArray(a.middleware)?a.middleware:[],m={...i,name:s.name,description:s.description,enabled:s.enabled,config:s.config,...s.allowedTools!==void 0?{allowedTools:s.allowedTools}:{}},y=d.some(v=>v.type===s.type)?d.map(v=>v.type===s.type?m:v):[...d,m];await n({...a,middleware:y}),Ke.success("Capability saved")}catch{Ke.error("Failed to save capability")}finally{u(!1)}}};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Po,{middleware:s,middlewareType:p,onToggle:()=>c(a=>({...a,enabled:!a.enabled})),onConfigChange:a=>c(d=>({...d,config:{...d.config,...a}})),onAllowedToolsChange:a=>c(d=>({...d,allowedTools:a}))}),(0,Y.jsx)("div",{style:{marginTop:16,textAlign:"right"},children:(0,Y.jsx)(oe,{type:"primary",size:"small",loading:l,onClick:()=>void g(),children:"Save"})})]})},Ud=({graphDefinition:e,onSaveGraph:t})=>{let n=typeof e=="object"&&e!==null?e:{},[o,r]=(0,Xe.useState)(n.description??""),[i,s]=(0,Xe.useState)(n.prompt??""),[c,l]=(0,Xe.useState)(n.modelKey??""),[u,p]=(0,Xe.useState)(!1),g=async()=>{if(t){p(!0);try{await t({...n,description:o,prompt:i,modelKey:c}),Ke.success("Agent saved")}catch{Ke.error("Failed to save agent")}finally{p(!1)}}};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Kt,{title:"Description",children:(0,Y.jsx)(Oe.TextArea,{"aria-label":"Description",rows:2,value:o,onChange:a=>r(a.target.value)})}),(0,Y.jsx)(Kt,{title:"Model",children:(0,Y.jsx)(Oe,{"aria-label":"Model",size:"small",value:c,onChange:a=>l(a.target.value)})}),(0,Y.jsx)(Kt,{title:"Prompt",children:(0,Y.jsx)(Oe.TextArea,{"aria-label":"Prompt",rows:8,value:i,onChange:a=>s(a.target.value)})}),(0,Y.jsx)("div",{style:{textAlign:"right"},children:(0,Y.jsx)(oe,{type:"primary",size:"small",loading:u,onClick:()=>void g(),children:"Save"})})]})},Hs=({node:e,graphDefinition:t,assistantId:n,onRemoveNode:o,onSaveGraph:r})=>{let i=e.type==="tool"||e.type==="subagent"||e.type==="skill";return(0,Y.jsxs)("div",{children:[(0,Y.jsx)("div",{style:{marginBottom:12},children:(0,Y.jsx)(Ue,{bordered:!1,style:{margin:0,fontSize:10},children:fa[e.type]})}),e.type==="tool"&&(0,Y.jsx)($d,{node:e},e.id),e.type==="subagent"&&(0,Y.jsx)(qd,{node:e},e.id),e.type==="skill"&&(0,Y.jsx)(Hd,{node:e},e.id),e.type==="capability"&&(0,Y.jsx)(Kd,{node:e,graphDefinition:t,onSaveGraph:r},e.id),e.type==="agent"&&(0,Y.jsx)(Ud,{graphDefinition:t,onSaveGraph:r},e.id),e.type==="eval"&&n&&(0,Y.jsx)(Lo,{assistantId:n},e.id),i&&o&&(0,Y.jsx)("div",{style:{marginTop:16,borderTop:"1px solid #f0f0f0",paddingTop:12},children:(0,Y.jsx)(Gd,{label:"Remove from agent",confirmLabel:"Confirm remove",onConfirm:()=>o(e)})})]})};function Ks(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{return}if(!t||typeof t!="object"||Array.isArray(t))return;let n=t.metadata;if(!n||typeof n!="object"||Array.isArray(n))return;let o=n.trainingProjectId;return typeof o=="string"?o:void 0}var Ne=T(Se());var Zd=new Set(["create_agent","update_agent","delete_agent","create_workflow","update_workflow"]),Vd=new Set(["manage_task"]),Qd=new Set(["manage_eval","run_eval"]),Yd=new Set(["create_agent","delete_agent"]);function Us(e){return Yd.has(e)}function Zs(e){let t=[];return Zd.has(e)&&t.push("config"),Vd.has(e)&&t.push("tasks"),Qd.has(e)&&t.push("eval"),t}var Xd=300,Jd=3e5,Hr=()=>({rounds:[],round:null,subTasks:[],subTasksByRound:{},loading:!0}),Kr=()=>({config:{error:null,updatedAt:null},tasks:{error:null,updatedAt:null,partial:!1}});function ec(e,t,n){let o=new Set(n),r=new Map(e.map(c=>[c.id,c])),i=c=>{let l=c.parentId,u=new Set;for(;l&&!u.has(l);){if(o.has(l))return!0;u.add(l),l=r.get(l)?.parentId}return!1},s=new Set(t.map(c=>c.id));return[...t,...e.filter(c=>!s.has(c.id)&&i(c))]}function Vs(e){let{agentId:t,projectId:n,onAssistantUpdated:o,onAgentListInvalidated:r}=e,{get:i}=nt(),s=`${t}\0${n??""}`,[c,l]=(0,Ne.useState)(()=>({scope:s,value:Hr()})),[u,p]=(0,Ne.useState)(()=>({scope:s,value:0})),[g,a]=(0,Ne.useState)(()=>({scope:s,value:Kr()})),d=(0,Ne.useRef)({}),m=(0,Ne.useRef)(0),y=(0,Ne.useRef)(null),v=(0,Ne.useRef)(null),f=(0,Ne.useRef)(0),k=(0,Ne.useRef)({}),I=(0,Ne.useRef)(!1),D=(0,Ne.useRef)(s),R=(0,Ne.useRef)({onAssistantUpdated:o,onAgentListInvalidated:r});(0,Ne.useLayoutEffect)(()=>{R.current={onAssistantUpdated:o,onAgentListInvalidated:r}},[o,r]),(0,Ne.useLayoutEffect)(()=>{if(D.current!==s){D.current=s,m.current+=1,f.current+=1,k.current={},y.current=null,v.current=null,I.current=!1;for(let B of Object.values(d.current))B&&clearTimeout(B);d.current={},l({scope:s,value:Hr()}),a({scope:s,value:Kr()}),p({scope:s,value:0})}},[s]);let F=c.scope===s?c.value:Hr(),N=g.scope===s?g.value:Kr(),E=u.scope===s?u.value:0,x=B=>{a(j=>j.scope===s?{scope:s,value:B(j.value)}:j)},G=(0,Ne.useCallback)(async()=>{let B=++f.current,j=s;try{let O=await i(`/api/assistants/${t}`);if(B!==f.current||j!==D.current)return;O.success&&O.data?(I.current=!1,R.current.onAssistantUpdated?.(O.data),x(te=>({...te,config:{error:null,updatedAt:new Date}}))):(I.current=!1,x(te=>({...te,config:{...te.config,error:new Error("Configuration refresh returned no agent")}})))}catch(O){if(B!==f.current||j!==D.current)return;if(O instanceof ri&&O.statusCode===404){I.current||R.current.onAgentListInvalidated?.(),I.current=!1,x(C=>({...C,config:{...C.config,error:O}}));return}I.current=!1,console.warn("[useEntityRefresher] config refresh failed",O);let te=O instanceof Error?O:new Error(String(O));x(C=>({...C,config:{...C.config,error:te}}))}},[i,t,s]),ue=(0,Ne.useCallback)(()=>{let B=y.current;if(B?.scope===s)return B.promise;let j=++m.current,O=s,te=(async()=>{try{let Q=((await i(_n(t,n))).data??[]).filter(On),de={},ye=!1;if(await Promise.all(Q.map(async fe=>{let _=await Ma(i,fe.id,{projectId:n});ye||=_.partial,de[fe.id]=_.partial?ec(k.current[fe.id]??[],_.tasks,_.incompleteParentIds??[]):_.tasks})),j!==m.current||O!==D.current)return;k.current=Object.fromEntries(Q.map(fe=>[fe.id,de[fe.id]??[]]));let Re=Q[0]??null;l({scope:s,value:{rounds:Q,round:Re,subTasks:Re?de[Re.id]??[]:[],subTasksByRound:de,loading:!1}}),x(fe=>({...fe,tasks:{error:null,updatedAt:new Date,partial:ye}}))}catch(C){if(console.warn("[useEntityRefresher] task refresh failed",C),j!==m.current||O!==D.current)return;l(de=>de.scope===s?{scope:s,value:{...de.value,loading:!1}}:de);let Q=C instanceof Error?C:new Error(String(C));x(de=>({...de,tasks:{...de.tasks,error:Q}}))}})().finally(()=>{y.current?.promise===te&&(y.current=null,v.current===O&&D.current===O&&(v.current=null,H.current.refreshLearningTasks()))});return y.current={scope:s,promise:te},te},[i,t,n,s]),H=(0,Ne.useRef)({refreshAgent:G,refreshLearningTasks:ue});(0,Ne.useEffect)(()=>{H.current={refreshAgent:G,refreshLearningTasks:ue}});let J=(0,Ne.useCallback)((B,j)=>{let O=d.current;O[B]&&clearTimeout(O[B]),O[B]=setTimeout(j,Xd)},[]),P=(0,Ne.useCallback)(B=>{for(let j of Zs(B))j==="config"&&J(j,()=>{Us(B)&&(I.current=!0,R.current.onAgentListInvalidated?.()),H.current.refreshAgent()}),j==="tasks"&&J(j,()=>{let O=D.current;y.current?.scope===O?v.current=O:H.current.refreshLearningTasks()}),j==="eval"&&J(j,()=>{let O=D.current;p(te=>te.scope===O?{scope:O,value:te.value+1}:te)})},[J]);return(0,Ne.useEffect)(()=>{let B=!1,j,O=async()=>{await ue(),B||(j=setTimeout(()=>{O()},Jd))};return O(),()=>{B=!0,j&&clearTimeout(j)}},[ue]),(0,Ne.useEffect)(()=>()=>{for(let B of Object.values(d.current))B&&clearTimeout(B)},[]),{handleToolCompleted:P,learningTasks:F,refreshLearningTasks:ue,refreshAgent:G,freshness:N,evalTick:E}}var ne=T(W()),{Text:Qs}=qe,rr={color:"#4f46e5",background:"#eef2ff"},tc=`
|
|
257
|
-
@media (max-width: 767px) {
|
|
258
|
-
.agent-detail__identity-pill { max-width: calc(100% - 24px) !important; right: 12px; }
|
|
259
|
-
.agent-detail__actions-pill { top: 52px !important; left: 12px; right: auto !important; }
|
|
260
|
-
}
|
|
261
|
-
`,nc=e=>e==="configuration"?{kind:"configuration"}:e==="playground"?{kind:"playground"}:e==="eval"?{kind:"eval",initial:{page:"suites"},navigationKey:0}:e==="web-apps"?{kind:"web-apps"}:null,oc=e=>{let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{return{}}return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:{}},Em=({assistant:e,allAssistants:t,onBack:n,onDeleted:o,initialTab:r="graph",onSave:i,onAssistantUpdated:s,onAgentListInvalidated:c,initialMessage:l=null,initialProjectId:u=null})=>{let[p,g]=(0,Ee.useState)(()=>nc(r)),[a,d]=(0,Ee.useState)(!1),[m,y]=(0,Ee.useState)(!1),[v,f]=(0,Ee.useState)(null),[k,I]=(0,Ee.useState)(0),D=(0,Ee.useRef)(null),R=(0,Ee.useRef)(()=>{}),F=(0,Ee.useRef)(0),N=(0,Ee.useRef)(null),E=(0,Ee.useRef)(null),x=(0,Ee.useRef)(null),G=(0,Ee.useRef)(null),ue=(0,Ee.useRef)(null),H=(0,Ee.useRef)(null),J=(0,Ee.useRef)(null),[P,B]=(0,Ee.useState)(()=>l?{requestId:`initial:${e.id}`,content:l}:null),{workspaceId:j,trainingProjects:O}=kt(),te=Ks(e.graphDefinition),[C,Q]=(0,Ee.useState)(u??te??O[0]?.id??null),de=V=>{Q(V)},ye=(V,De,Ge)=>{let ct=O.find(dn=>dn.id===C)??null;B({requestId:De,content:Na({goal:V,roundTaskId:De,targetAgentId:e.id,targetMode:La(e),files:Ge,projectId:C??void 0,workspaceId:ct?.workspaceId??j??void 0})})},Re=V=>{B(De=>De?.requestId===V?null:De)};(0,Ee.useEffect)(()=>{!C&&O.length>0&&Q(O[0].id)},[C,O]);let[fe,_]=(0,Ee.useState)(!1),[A,ee]=(0,Ee.useState)(!1),[Z,L]=(0,Ee.useState)(!1),[K,ke]=(0,Ee.useState)(e.graphDefinition),{handleToolCompleted:M,learningTasks:X,refreshLearningTasks:ae,evalTick:be}=Vs({agentId:e.id,projectId:C,onAssistantUpdated:s,onAgentListInvalidated:c});(0,Ee.useEffect)(()=>{ke(e.graphDefinition)},[e]);let Ie=typeof e.graphDefinition=="object"?e.graphDefinition:{},Pe=String(Ie.type??"react"),je=Dn(Pe),Me=Pe==="workflow"?bo:Kn,_e=vr(e),He=wr(e),Ve=Ji(He),Rt=V=>{V.kind==="back"?n():V.kind==="close"?g(null):V.kind==="architect"?(g(null),I(De=>De+1)):g(V.view)},Fe=V=>{if(!D.current&&!(V.kind==="dock"&&V.view.kind!=="node"&&p?.kind===V.view.kind&&V.view.kind!=="eval")){if(p?.kind==="configuration"&&a){D.current=V,f(V);return}Rt(V)}};R.current=Fe;let Dt=V=>{let De=V??(document.activeElement instanceof HTMLElement?document.activeElement:void 0);return De?{current:De}:void 0},Ft=(0,Ee.useCallback)(V=>{let De=++F.current;R.current({kind:"dock",view:{kind:"eval",initial:{page:"suites"},navigationKey:De,restoreFocusRef:Dt(V)}})},[]),Ut=()=>{D.current=null,f(null),requestAnimationFrame(()=>J.current?.())},Zt=()=>{let V=D.current;V&&(D.current=null,f(null),d(!1),Rt(V))},zt=()=>{ee(!0)},Lt=async()=>{_(!0);try{await o(e.id),ee(!1)}finally{_(!1)}},Vt=V=>(ke(V),i?.(e,V)),yt=i?async(V,De)=>{await i(V,De),ke({...oc(V.graphDefinition),...De})}:void 0,ln=V=>{let De=typeof K=="object"&&K!==null?K:{},Ge={...De};if(V.type==="tool"&&V.id.startsWith("tool:"))Ge.tools=(De.tools??[]).filter(ct=>ct!==V.id.slice(5));else if(V.type==="subagent"&&V.id.startsWith("sub:"))Ge.subAgents=(De.subAgents??[]).filter(ct=>ct!==V.id.slice(4));else if(V.type==="skill"&&V.id.startsWith("skill:"))Ge.skills=(De.skills??[]).filter(ct=>ct!==V.id.slice(6));else if(V.type==="capability"&&V.id.startsWith("cap:")){let ct=V.id.slice(4);Ge.middleware=(De.middleware??[]).filter(dn=>dn.type!==ct)}else return;ke(Ge),i?.(e,Ge).catch(()=>Ke.error("Failed to save after removing node"))};return(0,ne.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column",background:"#fff"},children:[(0,ne.jsx)("style",{"data-agent-detail-responsive":!0,children:tc}),(0,ne.jsxs)("div",{style:{flex:1,minHeight:0,position:"relative"},children:[(0,ne.jsxs)("div",{"data-testid":"agent-header-pill",className:"agent-detail__identity-pill",style:{position:"absolute",top:12,left:12,zIndex:12,display:"flex",alignItems:"center",gap:8,height:32,padding:"0 10px 0 4px",background:"rgba(255,255,255,0.95)",borderRadius:10,boxShadow:"0 2px 12px rgba(0,0,0,0.08)",border:"1px solid #f0f0f0",maxWidth:"calc(100% - 176px)",minWidth:0},children:[(0,ne.jsx)(oe,{type:"text",size:"small",icon:(0,ne.jsx)(ii,{}),onClick:()=>Fe({kind:"back"}),"aria-label":"Back"}),(0,ne.jsx)(Me,{size:15,color:Un(je.color)}),(0,ne.jsx)(Qs,{strong:!0,style:{fontSize:13,maxWidth:220,minWidth:0,flex:"1 1 auto",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),(0,ne.jsx)("span",{"data-testid":"agent-status-dot",title:He,style:{width:8,height:8,borderRadius:"50%",background:Un(Ve),flexShrink:0}}),(0,ne.jsx)(oe,{type:"text",size:"small","aria-label":"View description",icon:(0,ne.jsx)(yo,{}),style:{color:"#6366f1"},onClick:()=>L(!0)})]}),(0,ne.jsxs)("div",{"data-testid":"agent-actions-pill",className:"agent-detail__actions-pill",style:{position:"absolute",top:12,right:12,zIndex:12,display:"flex",alignItems:"center",gap:2,height:32,padding:"0 6px",background:"rgba(255,255,255,0.95)",borderRadius:10,boxShadow:"0 2px 12px rgba(0,0,0,0.08)",border:"1px solid #f0f0f0"},children:[(0,ne.jsx)(Yt,{title:"Test in Playground",children:(0,ne.jsx)(oe,{ref:N,type:"text",size:"small",icon:(0,ne.jsx)(Ci,{size:14}),onClick:()=>Fe({kind:"dock",view:{kind:"playground"}}),"aria-label":"Test in Playground","aria-pressed":p?.kind==="playground",style:p?.kind==="playground"?rr:void 0})}),(0,ne.jsx)(Yt,{title:"Eval Suite",children:(0,ne.jsx)(oe,{ref:E,type:"text",size:"small",icon:(0,ne.jsx)(ho,{size:14}),onClick:()=>Ft(E.current??void 0),"aria-label":"Eval Suite","aria-pressed":p?.kind==="eval",style:p?.kind==="eval"?rr:void 0})}),(0,ne.jsx)(Yt,{title:"Web Apps",children:(0,ne.jsx)(oe,{ref:x,type:"text",size:"small",icon:(0,ne.jsx)(Ri,{size:14}),onClick:()=>Fe({kind:"dock",view:{kind:"web-apps"}}),"aria-label":"Web Apps","aria-pressed":p?.kind==="web-apps",style:p?.kind==="web-apps"?rr:void 0})}),(0,ne.jsx)(Yt,{title:"Configuration",children:(0,ne.jsx)(oe,{ref:G,type:"text",size:"small",icon:(0,ne.jsx)(Ai,{size:14}),onClick:()=>Fe({kind:"dock",view:{kind:"configuration"}}),"aria-label":"Configuration","aria-pressed":p?.kind==="configuration",style:p?.kind==="configuration"?rr:void 0})}),(0,ne.jsx)(Yt,{title:"Delete Agent",children:(0,ne.jsx)(oe,{type:"text",size:"small",danger:!0,icon:(0,ne.jsx)(fo,{}),loading:fe,onClick:zt,"aria-label":"Delete Agent"})})]}),Pe==="workflow"?(0,ne.jsx)(Gs,{graphDefinition:K,assistantId:e.id,assistantName:e.name,workspaceId:j,description:e.description,hideTitleBar:!0,hudTopOffset:56,initialMessageRequest:P,onInitialMessageSubmitted:Re,projectId:C,onProjectChange:de,onLearningStarted:ye,onToolActivity:M,learningTasks:X,onLearningRefresh:ae,evalTick:be,architectOpenSignal:k,architectRestoreFocusRef:H,copilotTemporarilyHidden:p!==null}):(0,ne.jsx)(js,{graphDefinition:K,assistantId:e.id,assistantName:e.name,workspaceId:j,hudTopOffset:56,onSelectNode:V=>{V?Fe({kind:"dock",view:{kind:"node",node:V}}):p?.kind==="node"&&Fe({kind:"close"})},onRemoveNode:ln,initialMessageRequest:P,onInitialMessageSubmitted:Re,projectId:C,onProjectChange:de,onLearningStarted:ye,onToolActivity:M,learningTasks:X,onLearningRefresh:ae,evalTick:be,architectOpenSignal:k,architectRestoreFocusRef:H,copilotTemporarilyHidden:p!==null}),p?.kind==="node"&&(0,ne.jsx)(wt,{open:!0,width:$s(p.node),title:qs(p.node),onClose:()=>g(null),children:(0,ne.jsx)(Hs,{node:p.node,graphDefinition:K,assistantId:e.id,onRemoveNode:V=>{ln(V),g(null)},onSaveGraph:Vt})}),p?.kind==="playground"&&(0,ne.jsx)(wt,{open:!0,width:720,title:"Playground",onClose:()=>Fe({kind:"close"}),restoreFocusRef:N,children:(0,ne.jsx)(Zi,{assistant_id:e.id})}),p?.kind==="eval"&&(0,ne.jsx)(wt,{open:!0,width:860,title:p.initial?.page==="run"?"Run Results":"Eval Suite",onClose:()=>Fe({kind:"close"}),restoreFocusRef:p.restoreFocusRef??E,children:(0,ne.jsx)(Lo,{assistantId:e.id,initial:p.initial,navigationKey:p.navigationKey})},p.navigationKey),p?.kind==="web-apps"&&(0,ne.jsx)(wt,{open:!0,width:960,title:"Web Apps",onClose:()=>Fe({kind:"close"}),restoreFocusRef:x,bodyStyle:{padding:0,overflow:"hidden"},children:(0,ne.jsx)(ua,{assistant:e})}),p?.kind==="configuration"&&(0,ne.jsx)(wt,{open:!0,width:"80%",mobileWidth:"calc(100% - 24px)",title:"Configuration",onClose:()=>Fe({kind:"close"}),bodyStyle:{padding:0,overflow:"hidden"},restoreFocusRef:ue,focusControlRef:J,escapeEnabled:!m&&!Z&&!A&&v===null,children:(0,ne.jsx)(la,{assistant:{...e,graphDefinition:K},allAssistants:t,visible:!0,onClose:()=>Fe({kind:"close"}),onSave:yt,onDirtyChange:d,onOverlayOpenChange:y,embedded:!0})})]}),(0,ne.jsx)($e,{title:"Discard unsaved configuration?",open:v!==null,onCancel:Ut,onOk:Zt,okText:"Discard",okButtonProps:{danger:!0},cancelText:"Continue editing",children:(0,ne.jsx)("p",{children:"You have unsaved configuration changes. Discard them and continue?"})}),(0,ne.jsxs)($e,{title:e.name,open:Z,onCancel:()=>L(!1),footer:null,width:640,centered:!0,children:[(0,ne.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:12},children:[(0,ne.jsx)(Ue,{color:je.color,style:{margin:0},children:je.label}),_e.map(V=>(0,ne.jsx)(Ue,{color:"magenta",style:{margin:0},children:V},V)),(0,ne.jsx)(Ue,{style:{margin:0},children:kr(e)}),(0,ne.jsx)(Ue,{color:Ve,style:{margin:0},children:He})]}),e.description?(0,ne.jsx)(In,{content:e.description}):(0,ne.jsx)(Qs,{type:"secondary",children:"No description set."})]}),(0,ne.jsx)($e,{title:"Delete Agent",open:A,onCancel:()=>ee(!1),onOk:Lt,okText:"Delete",okButtonProps:{danger:!0,loading:fe},cancelText:"Cancel",children:(0,ne.jsxs)("p",{children:['Are you sure you want to delete "',e.name,'"? This action cannot be undone.']})})]})};export{Dn as a,Un as b,rc as c,ic as d,ac as e,Ca as f,Ea as g,Vu as h,Pa as i,Da as j,Na as k,Em as l};
|