@axiom-lattice/gateway 4.6.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/OrphanRecoveryRuntime-MQDEJX3M.mjs +8 -0
  2. package/dist/OrphanRecoveryRuntime-MQDEJX3M.mjs.map +1 -0
  3. package/dist/RecoveryCallerDeps-6SJUYJ5S.mjs +8 -0
  4. package/dist/RecoveryCallerDeps-6SJUYJ5S.mjs.map +1 -0
  5. package/dist/{a2a-standard-PIOKEHPS.mjs → a2a-standard-PBYPNHOA.mjs} +59 -21
  6. package/dist/a2a-standard-PBYPNHOA.mjs.map +1 -0
  7. package/dist/chunk-KDQKTU3N.mjs +288 -0
  8. package/dist/chunk-KDQKTU3N.mjs.map +1 -0
  9. package/dist/chunk-NOXGKYUV.mjs +37 -0
  10. package/dist/chunk-NOXGKYUV.mjs.map +1 -0
  11. package/dist/{chunk-526UYVNQ.mjs → chunk-NPHK4SZ6.mjs} +4 -4
  12. package/dist/embed/{embed-page-AgentDetailSideApp-7NYLPLAX.js → embed-page-AgentDetailSideApp-2C2ZR62Q.js} +1 -1
  13. package/dist/embed/{embed-page-AgentGovernanceWorkbench-LNGNSI7X.js → embed-page-AgentGovernanceWorkbench-GG4ONSTS.js} +1 -1
  14. package/dist/embed/{embed-page-MessageGraph-E6DZDT65.js → embed-page-MessageGraph-WMYTVUUC.js} +1 -1
  15. package/dist/embed/{embed-page-ReactChart-3VE7F5VJ.js → embed-page-ReactChart-7XCMDMH6.js} +1 -1
  16. package/dist/embed/{embed-page-TasksSideApp-QM5TZ7EG.js → embed-page-TasksSideApp-4ZJ4Q4CL.js} +1 -1
  17. package/dist/embed/{embed-page-TeamWorkspace-E7RFY3ZY.js → embed-page-TeamWorkspace-H5OOEN3K.js} +1 -1
  18. package/dist/embed/{embed-page-TopologyRuntimeView-DLPDUB7Z.js → embed-page-TopologyRuntimeView-QMXWERVC.js} +1 -1
  19. package/dist/embed/{embed-page-WorkflowAutomationView-FKSVOHHB.js → embed-page-WorkflowAutomationView-L2OEGCA5.js} +1 -1
  20. package/dist/embed/{embed-page-chunk-H6TK3FAR.js → embed-page-chunk-2G54EIW2.js} +1 -1
  21. package/dist/embed/{embed-page-chunk-I7PWCKAG.js → embed-page-chunk-CZE4IEB3.js} +1 -1
  22. package/dist/embed/{embed-page-chunk-WWTU55RX.js → embed-page-chunk-N2ISCAS7.js} +1 -1
  23. package/dist/embed/{embed-page-chunk-EXCJ42IB.js → embed-page-chunk-OHDEKFTU.js} +1 -1
  24. package/dist/embed/{embed-page-chunk-KN7D66KL.js → embed-page-chunk-SUMYB6ZA.js} +1 -1
  25. package/dist/embed/{embed-page-chunk-U276WBDI.js → embed-page-chunk-XIXSRYJY.js} +6 -6
  26. package/dist/embed/embed-page.js +1 -1
  27. package/dist/index.d.mts +226 -3
  28. package/dist/index.d.ts +226 -3
  29. package/dist/index.js +638 -257
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +86 -78
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/{open-AMEMJOFJ.mjs → open-STFMNRO5.mjs} +8 -8
  34. package/dist/{open-exposure-I44Q4M3T.mjs → open-exposure-VU227IO3.mjs} +5 -5
  35. package/dist/{open-files-EJ6O2SGX.mjs → open-files-NPNQQ6TY.mjs} +4 -4
  36. package/dist/{open-session-LBTCU3AE.mjs → open-session-IHDGAXL3.mjs} +4 -4
  37. package/package.json +7 -7
  38. package/dist/a2a-standard-PIOKEHPS.mjs.map +0 -1
  39. /package/dist/{chunk-526UYVNQ.mjs.map → chunk-NPHK4SZ6.mjs.map} +0 -0
  40. /package/dist/{open-AMEMJOFJ.mjs.map → open-STFMNRO5.mjs.map} +0 -0
  41. /package/dist/{open-exposure-I44Q4M3T.mjs.map → open-exposure-VU227IO3.mjs.map} +0 -0
  42. /package/dist/{open-files-EJ6O2SGX.mjs.map → open-files-NPNQQ6TY.mjs.map} +0 -0
  43. /package/dist/{open-session-LBTCU3AE.mjs.map → open-session-IHDGAXL3.mjs.map} +0 -0
@@ -4365,7 +4365,7 @@ ${ae}`.trim()),rt.success("Copied")},[]),J=(0,Xo.useCallback)(async A=>{try{awai
4365
4365
  display: flex;
4366
4366
  align-items: center;
4367
4367
  gap: 16px;
4368
- `})),i$={running:{color:"processing",label:"Running"},completed:{color:"success",label:"Completed"},failed:{color:"error",label:"Failed"},aborted:{color:"warning",label:"Aborted"}},vw=({initial:e})=>{let{styles:t,cx:r}=n$(),{token:o}=Vr.useToken(),{projects:a}=WA(),[n,i]=(0,fi.useState)(e?.projectId??""),[s,l]=(0,fi.useState)(e?.page??"dashboard"),[c,u]=(0,fi.useState)(e?.suiteId??""),[p,m]=(0,fi.useState)(e?.runId??"");fi.default.useEffect(()=>{!n&&a.length>0&&i(a[0].id)},[a,n]);let{suites:f}=bl(n),{runs:y,start:g,remove:x}=Bu(n),{workspaceId:v,projectId:C}=Yr(),[w,P]=(0,fi.useState)(!1),[E,$]=(0,fi.useState)(null),M=R=>({workspaceId:v||void 0,projectId:R||C||void 0}),B=()=>P(!0),z=(0,fi.useMemo)(()=>{let R=f.reduce((G,q)=>G+(q.caseCount??0),0),F=y[0],O=F?.totalCases>0?Math.round(F.passedCases/F.totalCases*100):null;return{totalCases:R,passRate:O,suiteCount:f.length,runCount:y.length}},[f,y]),_=(R,F,O)=>{l(R),F!==void 0&&u(F),O!==void 0&&m(O)};fi.default.useEffect(()=>{e&&(e.projectId!==void 0&&i(e.projectId),e.page!==void 0&&l(e.page),e.suiteId!==void 0&&u(e.suiteId),e.runId!==void 0&&m(e.runId))},[e?.projectId,e?.page,e?.suiteId,e?.runId]);let T=s==="suite"&&!c||s==="run"&&!p?"dashboard":s,k=({icon:R,bg:F,label:O,value:G})=>(0,Je.jsx)(Sr,{className:t.statCard,styles:{body:{padding:0}},size:"small",children:(0,Je.jsxs)("div",{className:t.statInner,children:[(0,Je.jsx)("div",{className:t.statIcon,style:{background:F},children:R}),(0,Je.jsxs)("div",{children:[(0,Je.jsx)("div",{className:t.statValue,children:G}),(0,Je.jsx)("div",{className:t.statLabel,children:O})]})]})});if(T==="dashboard")return(0,Je.jsxs)("div",{className:t.shell,children:[(0,Je.jsxs)("div",{className:t.topBar,children:[(0,Je.jsxs)("div",{className:t.topLeft,children:[(0,Je.jsx)("div",{className:t.pageIcon,children:(0,Je.jsx)(Ti,{size:20,color:o.colorPrimary})}),(0,Je.jsx)("span",{className:t.pageTitle,children:"Evaluation Dashboard"})]}),(0,Je.jsxs)("div",{className:t.topRight,children:[(0,Je.jsx)(ca,{menu:{items:a.map(R=>({key:R.id,label:(0,Je.jsxs)("div",{children:[(0,Je.jsx)("div",{children:R.name}),(0,Je.jsx)(cs,{type:"secondary",style:{fontSize:11},children:R.targetServerConfig?.base_url||"\u2014"})]}),onClick:()=>i(R.id)}))},children:(0,Je.jsxs)("div",{className:t.projectBtn,children:[(0,Je.jsx)("div",{className:t.projectDot}),(0,Je.jsxs)("div",{style:{textAlign:"left"},children:[(0,Je.jsx)("div",{style:{lineHeight:1.3},children:a.find(R=>R.id===n)?.name||"Select Project"}),(0,Je.jsx)(cs,{type:"secondary",style:{fontSize:11},children:a.find(R=>R.id===n)?.targetServerConfig?.base_url||""})]}),(0,Je.jsx)(Ii,{size:14})]})}),(0,Je.jsx)(ge,{type:"primary",icon:(0,Je.jsx)(ks,{size:16}),onClick:()=>_("suites"),children:"Go to Suites"})]})]}),(0,Je.jsxs)("div",{className:t.body,children:[(0,Je.jsxs)(Yd,{gutter:[16,16],className:t.statRow,children:[(0,Je.jsx)(rl,{span:6,children:(0,Je.jsx)(k,{icon:(0,Je.jsx)(Ti,{size:22,color:o.colorPrimary}),bg:`${o.colorPrimary}14`,label:"Test Suites",value:z.suiteCount})}),(0,Je.jsx)(rl,{span:6,children:(0,Je.jsx)(k,{icon:(0,Je.jsx)(Ri,{size:22,color:o.colorSuccess}),bg:`${o.colorSuccess}14`,label:"Test Cases",value:z.totalCases})}),(0,Je.jsx)(rl,{span:6,children:(0,Je.jsx)(k,{icon:(0,Je.jsx)(op,{size:22,color:o.colorInfo}),bg:`${o.colorInfo}14`,label:"Total Runs",value:z.runCount})}),(0,Je.jsx)(rl,{span:6,children:(0,Je.jsx)(k,{icon:z.passRate!==null&&z.passRate>=80?(0,Je.jsx)(ai,{size:22,color:o.colorSuccess}):(0,Je.jsx)(rs,{size:22,color:o.colorWarning}),bg:z.passRate!==null?`${o.colorSuccess}14`:`${o.colorFill}`,label:"Latest Pass Rate",value:z.passRate!==null?`${z.passRate}%`:"N/A"})})]}),(0,Je.jsxs)("div",{className:t.section,children:[(0,Je.jsxs)("div",{className:t.sectionHead,children:[(0,Je.jsxs)("h3",{className:t.sectionTitle,children:[(0,Je.jsx)(Ti,{size:16}),"Evaluation Suites"]}),(0,Je.jsxs)(ge,{size:"small",type:"text",onClick:()=>_("suites"),children:["View All ",(0,Je.jsx)(Um,{size:14,style:{marginLeft:4}})]})]}),(0,Je.jsx)(hw,{projectId:n,onSelectSuite:(R,F)=>_("suite",F)})]}),(0,Je.jsxs)("div",{className:t.section,children:[(0,Je.jsx)("div",{className:t.sectionHead,children:(0,Je.jsxs)("h3",{className:t.sectionTitle,children:[(0,Je.jsx)(op,{size:16}),"Recent Runs"]})}),(0,Je.jsx)(Sr,{styles:{body:{padding:0}},size:"small",children:y.length===0?(0,Je.jsx)("div",{style:{padding:40,textAlign:"center"},children:(0,Je.jsx)(cs,{type:"secondary",children:"No runs yet. Go to Suites to run your first evaluation."})}):y.slice(0,5).map(R=>{let F=i$[R.status]||{color:"default",label:R.status},O=R.createdAt?new Date(R.createdAt):null,G=R.completedAt?new Date(R.completedAt):null,q=O&&G?G.getTime()-O.getTime():null,W=R.totalCases>0?Math.round(R.passedCases/R.totalCases*100):null,J=D=>{let V=Y=>String(Y).padStart(2,"0");return`${D.getFullYear()}-${V(D.getMonth()+1)}-${V(D.getDate())} ${V(D.getHours())}:${V(D.getMinutes())}`},re=D=>D<1e3?`${D}ms`:D<6e4?`${(D/1e3).toFixed(1)}s`:`${Math.floor(D/6e4)}m ${Math.round(D%6e4/1e3)}s`,A=R.id?.slice(0,8);return(0,Je.jsxs)("div",{className:t.runRow,onClick:()=>_("run",void 0,R.id),children:[(0,Je.jsxs)("div",{className:t.runRowLeft,children:[(0,Je.jsx)(cs,{code:!0,style:{fontSize:12,marginRight:8},children:A}),O&&(0,Je.jsxs)(cs,{type:"secondary",style:{fontSize:12,minWidth:120},children:[(0,Je.jsx)(nu,{size:11,style:{marginRight:3,verticalAlign:"middle"}}),J(O)]}),(0,Je.jsxs)(cs,{style:{fontSize:13},children:[(0,Je.jsx)(cs,{type:"success",children:R.passedCases}),(0,Je.jsx)(cs,{type:"secondary",children:" passed "}),(0,Je.jsx)(cs,{type:"danger",children:R.failedCases}),(0,Je.jsx)(cs,{type:"secondary",children:" failed"})]}),W!==null&&(0,Je.jsxs)(kt,{color:W>=80?"success":W>=50?"warning":"error",children:[W,"%"]}),R.envProjectId&&(0,Je.jsx)(kt,{icon:(0,Je.jsx)(su,{size:11}),color:"blue",style:{marginRight:0},children:R.envProjectId})]}),(0,Je.jsxs)("div",{className:t.runRowRight,style:{gap:16},children:[q!==null&&(0,Je.jsx)(cs,{type:"secondary",style:{fontSize:12},children:re(q)}),(0,Je.jsx)(kt,{color:F.color,style:{margin:0},children:F.label}),(0,Je.jsx)(cs,{strong:!0,style:{fontSize:15,minWidth:40,textAlign:"right"},children:typeof R.avgScore=="number"?R.avgScore.toFixed(1):"\u2014"}),(0,Je.jsx)(Nn,{title:"Delete this run?",description:"Run results will be permanently deleted.",onConfirm:async D=>{D?.stopPropagation(),await x(R.id),rt.success("Run deleted")},onCancel:D=>D?.stopPropagation(),okText:"Delete",okButtonProps:{danger:!0},children:(0,Je.jsx)(ge,{type:"text",size:"small",danger:!0,icon:(0,Je.jsx)(Fn,{size:14}),onClick:D=>D.stopPropagation()})})]})]},R.id)})})]})]})]});let L=()=>{let[R,F]=(0,fi.useState)(!1),[O,G]=(0,fi.useState)(""),{create:q}=bl(n),W=async()=>{O.trim()&&(await q(n,{name:O.trim()}),G(""),F(!1))};return(0,Je.jsxs)("div",{className:t.shell,children:[(0,Je.jsxs)("div",{className:t.topBar,children:[(0,Je.jsxs)("div",{className:t.topLeft,children:[(0,Je.jsx)("button",{className:t.breadcrumb,onClick:()=>_("dashboard"),children:"Dashboard"}),(0,Je.jsx)("span",{className:t.breadcrumbSep,children:"/"}),(0,Je.jsx)("span",{className:t.pageTitle,children:"Test Suites"})]}),(0,Je.jsxs)("div",{className:t.topRight,children:[(0,Je.jsx)(ge,{icon:(0,Je.jsx)(ks,{size:16}),onClick:()=>F(!R),children:"New Suite"}),(0,Je.jsx)(ge,{type:"primary",icon:(0,Je.jsx)(ks,{size:16}),onClick:B,children:"Run All"})]})]}),R&&(0,Je.jsxs)("div",{style:{padding:"12px 28px",borderBottom:`1px solid ${o.colorBorderSecondary}`,display:"flex",gap:8},children:[(0,Je.jsx)("input",{type:"text",placeholder:"Suite name",value:O,onChange:J=>G(J.target.value),onKeyDown:J=>J.key==="Enter"&&W(),autoFocus:!0,style:{width:260,padding:"6px 12px",border:`1px solid ${o.colorBorder}`,borderRadius:o.borderRadius,fontSize:14,outline:"none"}}),(0,Je.jsx)(ge,{type:"primary",size:"small",onClick:W,children:"Create"}),(0,Je.jsx)(ge,{size:"small",onClick:()=>F(!1),children:"Cancel"})]}),(0,Je.jsx)("div",{className:t.body,children:(0,Je.jsx)(hw,{projectId:n,onSelectSuite:(J,re)=>_("suite",re)})}),(0,Je.jsx)(ix,{open:w,onClose:()=>P(!1),onRun:async J=>{let re=await g(n,J);re?.run_id&&_("run",void 0,re.run_id)}})]})};return T==="suites"?(0,Je.jsx)(L,{}):T==="suite"&&c?(0,Je.jsx)(UA,{projectId:n,suiteId:c,onBack:()=>_("suites"),onRun:R=>_("run",void 0,R)}):T==="run"&&p?(0,Je.jsx)(HA,{runId:p,onBack:()=>_("dashboard")}):null};var ux=I(ie());var dx=I(ie());var VA=I(ie());var GA=I(H()),{Text:Vxe}=we;var KA=I(H()),{Text:t1e}=we;var bw=I(ie());var ww=I(H()),{Text:d1e,Paragraph:u1e}=we;var Cw=I(H()),{Text:C1e}=we;var Sw=I(ie());var XA=I(H()),{Text:L1e}=we;var kw=I(ie());var fx=I(ie());var YA=I(ie());var JA=I(H()),{Text:D1e}=we;var Iw=I(H()),{Text:V1e}=we;var Lx=I(ie());var px=I(H()),s$=({defaultWorkspaceId:e,defaultProjectId:t,children:r})=>{let o=Xt("__GLOBAL__");return(0,px.jsx)(Zv,{workspaceId:e,projectId:t,client:o,children:r})},mx=({children:e,defaultProjectId:t,defaultWorkspaceId:r})=>{let{config:{baseURL:o}}=Rt();return(0,px.jsx)(LS,{config:{baseURL:o,apiKey:"",assistantId:"__GLOBAL__",transport:"sse"},children:(0,px.jsx)(s$,{defaultWorkspaceId:r,defaultProjectId:t,children:e})})},J1e=mx;var Tw=I(H()),Lw=()=>{let{toolsVisible:e,toggleTools:t}=Ir();return(0,Tw.jsx)(Fp,{ariaLabel:"Toggle file directory",icon:(0,Tw.jsx)(Li,{size:16}),onClick:t,pressed:e})};var gx=I(ie());var Up=I(H()),l$=(0,gx.lazy)(()=>import("./embed-page-TasksSideApp-QM5TZ7EG.js").then(e=>({default:e.TasksSideApp}))),Rw=()=>{let{openSideApp:e,sideAppVisible:t,sideAppSelectedCard:r}=Ir(),o=t&&r?.component_key==="tasks_side_app_pin";return(0,Up.jsx)(Fp,{ariaLabel:"Open tasks",icon:(0,Up.jsx)(Vl,{size:16}),onClick:()=>{o||e({component_key:"tasks_side_app_pin",message:"Tasks",data:{component:(0,Up.jsx)(gx.Suspense,{fallback:(0,Up.jsx)(yt,{style:{display:"block",margin:"auto"}}),children:(0,Up.jsx)(l$,{showProjectFilter:!1})})}})}})};var hx=I(ie());var za=I(ie());var hn=I(H()),{ErrorBoundary:c$}=Xr,d$=({message:e,renderContent:t,autoLoadRightPanel:r})=>{let o=(0,za.useRef)(null),[a,n]=(0,za.useState)(!1),[i,s]=(0,za.useState)(!1);return(0,za.useEffect)(()=>{let c=new IntersectionObserver(([u])=>{let p=u.isIntersecting;n(p),p&&!i&&s(!0)},{threshold:.1});return o.current&&c.observe(o.current),()=>{o.current&&c.unobserve(o.current)}},[i]),(0,za.useEffect)(()=>{r?.()},[]),(0,hn.jsx)(c$,{children:(0,hn.jsx)("div",{ref:o,style:{width:"100%"},children:a||i?t(e):(()=>{let c=(e.tool_calls?.length??0)*140,u=e.content?Math.min(100,e.content.length/5)+c:100+c;return(0,hn.jsx)("div",{style:{height:`${u}px`,minHeight:"50px"}})})()})})},ZA=(0,za.memo)(({items:e,role:t,className:r})=>(0,hn.jsx)(U0.List,{autoScroll:!0,items:e,role:t,className:r},"messages"));ZA.displayName="MemoizedBubbleList";var QA=({messages:e,className:t,isLoading:r=!1})=>{let{styles:o}=Qc(),a=Yt(),n=(0,za.useDeferredValue)(e),i=r?n:e,s=(0,za.useRef)(i?.length??0);(0,za.useEffect)(()=>{i?.length&&(s.current=i?.length)},[i?.length]);let l=(0,za.useCallback)(p=>{let{content:m}=p;try{let g=JSON.parse(m);if(g.action&&g.message)return(0,hn.jsx)(or,{content:g.message})}catch{}let f=p.tool_calls?.map(g=>{try{return`\`\`\`tool_call
4368
+ `})),i$={running:{color:"processing",label:"Running"},completed:{color:"success",label:"Completed"},failed:{color:"error",label:"Failed"},aborted:{color:"warning",label:"Aborted"}},vw=({initial:e})=>{let{styles:t,cx:r}=n$(),{token:o}=Vr.useToken(),{projects:a}=WA(),[n,i]=(0,fi.useState)(e?.projectId??""),[s,l]=(0,fi.useState)(e?.page??"dashboard"),[c,u]=(0,fi.useState)(e?.suiteId??""),[p,m]=(0,fi.useState)(e?.runId??"");fi.default.useEffect(()=>{!n&&a.length>0&&i(a[0].id)},[a,n]);let{suites:f}=bl(n),{runs:y,start:g,remove:x}=Bu(n),{workspaceId:v,projectId:C}=Yr(),[w,P]=(0,fi.useState)(!1),[E,$]=(0,fi.useState)(null),M=R=>({workspaceId:v||void 0,projectId:R||C||void 0}),B=()=>P(!0),z=(0,fi.useMemo)(()=>{let R=f.reduce((G,q)=>G+(q.caseCount??0),0),F=y[0],O=F?.totalCases>0?Math.round(F.passedCases/F.totalCases*100):null;return{totalCases:R,passRate:O,suiteCount:f.length,runCount:y.length}},[f,y]),_=(R,F,O)=>{l(R),F!==void 0&&u(F),O!==void 0&&m(O)};fi.default.useEffect(()=>{e&&(e.projectId!==void 0&&i(e.projectId),e.page!==void 0&&l(e.page),e.suiteId!==void 0&&u(e.suiteId),e.runId!==void 0&&m(e.runId))},[e?.projectId,e?.page,e?.suiteId,e?.runId]);let T=s==="suite"&&!c||s==="run"&&!p?"dashboard":s,k=({icon:R,bg:F,label:O,value:G})=>(0,Je.jsx)(Sr,{className:t.statCard,styles:{body:{padding:0}},size:"small",children:(0,Je.jsxs)("div",{className:t.statInner,children:[(0,Je.jsx)("div",{className:t.statIcon,style:{background:F},children:R}),(0,Je.jsxs)("div",{children:[(0,Je.jsx)("div",{className:t.statValue,children:G}),(0,Je.jsx)("div",{className:t.statLabel,children:O})]})]})});if(T==="dashboard")return(0,Je.jsxs)("div",{className:t.shell,children:[(0,Je.jsxs)("div",{className:t.topBar,children:[(0,Je.jsxs)("div",{className:t.topLeft,children:[(0,Je.jsx)("div",{className:t.pageIcon,children:(0,Je.jsx)(Ti,{size:20,color:o.colorPrimary})}),(0,Je.jsx)("span",{className:t.pageTitle,children:"Evaluation Dashboard"})]}),(0,Je.jsxs)("div",{className:t.topRight,children:[(0,Je.jsx)(ca,{menu:{items:a.map(R=>({key:R.id,label:(0,Je.jsxs)("div",{children:[(0,Je.jsx)("div",{children:R.name}),(0,Je.jsx)(cs,{type:"secondary",style:{fontSize:11},children:R.targetServerConfig?.base_url||"\u2014"})]}),onClick:()=>i(R.id)}))},children:(0,Je.jsxs)("div",{className:t.projectBtn,children:[(0,Je.jsx)("div",{className:t.projectDot}),(0,Je.jsxs)("div",{style:{textAlign:"left"},children:[(0,Je.jsx)("div",{style:{lineHeight:1.3},children:a.find(R=>R.id===n)?.name||"Select Project"}),(0,Je.jsx)(cs,{type:"secondary",style:{fontSize:11},children:a.find(R=>R.id===n)?.targetServerConfig?.base_url||""})]}),(0,Je.jsx)(Ii,{size:14})]})}),(0,Je.jsx)(ge,{type:"primary",icon:(0,Je.jsx)(ks,{size:16}),onClick:()=>_("suites"),children:"Go to Suites"})]})]}),(0,Je.jsxs)("div",{className:t.body,children:[(0,Je.jsxs)(Yd,{gutter:[16,16],className:t.statRow,children:[(0,Je.jsx)(rl,{span:6,children:(0,Je.jsx)(k,{icon:(0,Je.jsx)(Ti,{size:22,color:o.colorPrimary}),bg:`${o.colorPrimary}14`,label:"Test Suites",value:z.suiteCount})}),(0,Je.jsx)(rl,{span:6,children:(0,Je.jsx)(k,{icon:(0,Je.jsx)(Ri,{size:22,color:o.colorSuccess}),bg:`${o.colorSuccess}14`,label:"Test Cases",value:z.totalCases})}),(0,Je.jsx)(rl,{span:6,children:(0,Je.jsx)(k,{icon:(0,Je.jsx)(op,{size:22,color:o.colorInfo}),bg:`${o.colorInfo}14`,label:"Total Runs",value:z.runCount})}),(0,Je.jsx)(rl,{span:6,children:(0,Je.jsx)(k,{icon:z.passRate!==null&&z.passRate>=80?(0,Je.jsx)(ai,{size:22,color:o.colorSuccess}):(0,Je.jsx)(rs,{size:22,color:o.colorWarning}),bg:z.passRate!==null?`${o.colorSuccess}14`:`${o.colorFill}`,label:"Latest Pass Rate",value:z.passRate!==null?`${z.passRate}%`:"N/A"})})]}),(0,Je.jsxs)("div",{className:t.section,children:[(0,Je.jsxs)("div",{className:t.sectionHead,children:[(0,Je.jsxs)("h3",{className:t.sectionTitle,children:[(0,Je.jsx)(Ti,{size:16}),"Evaluation Suites"]}),(0,Je.jsxs)(ge,{size:"small",type:"text",onClick:()=>_("suites"),children:["View All ",(0,Je.jsx)(Um,{size:14,style:{marginLeft:4}})]})]}),(0,Je.jsx)(hw,{projectId:n,onSelectSuite:(R,F)=>_("suite",F)})]}),(0,Je.jsxs)("div",{className:t.section,children:[(0,Je.jsx)("div",{className:t.sectionHead,children:(0,Je.jsxs)("h3",{className:t.sectionTitle,children:[(0,Je.jsx)(op,{size:16}),"Recent Runs"]})}),(0,Je.jsx)(Sr,{styles:{body:{padding:0}},size:"small",children:y.length===0?(0,Je.jsx)("div",{style:{padding:40,textAlign:"center"},children:(0,Je.jsx)(cs,{type:"secondary",children:"No runs yet. Go to Suites to run your first evaluation."})}):y.slice(0,5).map(R=>{let F=i$[R.status]||{color:"default",label:R.status},O=R.createdAt?new Date(R.createdAt):null,G=R.completedAt?new Date(R.completedAt):null,q=O&&G?G.getTime()-O.getTime():null,W=R.totalCases>0?Math.round(R.passedCases/R.totalCases*100):null,J=D=>{let V=Y=>String(Y).padStart(2,"0");return`${D.getFullYear()}-${V(D.getMonth()+1)}-${V(D.getDate())} ${V(D.getHours())}:${V(D.getMinutes())}`},re=D=>D<1e3?`${D}ms`:D<6e4?`${(D/1e3).toFixed(1)}s`:`${Math.floor(D/6e4)}m ${Math.round(D%6e4/1e3)}s`,A=R.id?.slice(0,8);return(0,Je.jsxs)("div",{className:t.runRow,onClick:()=>_("run",void 0,R.id),children:[(0,Je.jsxs)("div",{className:t.runRowLeft,children:[(0,Je.jsx)(cs,{code:!0,style:{fontSize:12,marginRight:8},children:A}),O&&(0,Je.jsxs)(cs,{type:"secondary",style:{fontSize:12,minWidth:120},children:[(0,Je.jsx)(nu,{size:11,style:{marginRight:3,verticalAlign:"middle"}}),J(O)]}),(0,Je.jsxs)(cs,{style:{fontSize:13},children:[(0,Je.jsx)(cs,{type:"success",children:R.passedCases}),(0,Je.jsx)(cs,{type:"secondary",children:" passed "}),(0,Je.jsx)(cs,{type:"danger",children:R.failedCases}),(0,Je.jsx)(cs,{type:"secondary",children:" failed"})]}),W!==null&&(0,Je.jsxs)(kt,{color:W>=80?"success":W>=50?"warning":"error",children:[W,"%"]}),R.envProjectId&&(0,Je.jsx)(kt,{icon:(0,Je.jsx)(su,{size:11}),color:"blue",style:{marginRight:0},children:R.envProjectId})]}),(0,Je.jsxs)("div",{className:t.runRowRight,style:{gap:16},children:[q!==null&&(0,Je.jsx)(cs,{type:"secondary",style:{fontSize:12},children:re(q)}),(0,Je.jsx)(kt,{color:F.color,style:{margin:0},children:F.label}),(0,Je.jsx)(cs,{strong:!0,style:{fontSize:15,minWidth:40,textAlign:"right"},children:typeof R.avgScore=="number"?R.avgScore.toFixed(1):"\u2014"}),(0,Je.jsx)(Nn,{title:"Delete this run?",description:"Run results will be permanently deleted.",onConfirm:async D=>{D?.stopPropagation(),await x(R.id),rt.success("Run deleted")},onCancel:D=>D?.stopPropagation(),okText:"Delete",okButtonProps:{danger:!0},children:(0,Je.jsx)(ge,{type:"text",size:"small",danger:!0,icon:(0,Je.jsx)(Fn,{size:14}),onClick:D=>D.stopPropagation()})})]})]},R.id)})})]})]})]});let L=()=>{let[R,F]=(0,fi.useState)(!1),[O,G]=(0,fi.useState)(""),{create:q}=bl(n),W=async()=>{O.trim()&&(await q(n,{name:O.trim()}),G(""),F(!1))};return(0,Je.jsxs)("div",{className:t.shell,children:[(0,Je.jsxs)("div",{className:t.topBar,children:[(0,Je.jsxs)("div",{className:t.topLeft,children:[(0,Je.jsx)("button",{className:t.breadcrumb,onClick:()=>_("dashboard"),children:"Dashboard"}),(0,Je.jsx)("span",{className:t.breadcrumbSep,children:"/"}),(0,Je.jsx)("span",{className:t.pageTitle,children:"Test Suites"})]}),(0,Je.jsxs)("div",{className:t.topRight,children:[(0,Je.jsx)(ge,{icon:(0,Je.jsx)(ks,{size:16}),onClick:()=>F(!R),children:"New Suite"}),(0,Je.jsx)(ge,{type:"primary",icon:(0,Je.jsx)(ks,{size:16}),onClick:B,children:"Run All"})]})]}),R&&(0,Je.jsxs)("div",{style:{padding:"12px 28px",borderBottom:`1px solid ${o.colorBorderSecondary}`,display:"flex",gap:8},children:[(0,Je.jsx)("input",{type:"text",placeholder:"Suite name",value:O,onChange:J=>G(J.target.value),onKeyDown:J=>J.key==="Enter"&&W(),autoFocus:!0,style:{width:260,padding:"6px 12px",border:`1px solid ${o.colorBorder}`,borderRadius:o.borderRadius,fontSize:14,outline:"none"}}),(0,Je.jsx)(ge,{type:"primary",size:"small",onClick:W,children:"Create"}),(0,Je.jsx)(ge,{size:"small",onClick:()=>F(!1),children:"Cancel"})]}),(0,Je.jsx)("div",{className:t.body,children:(0,Je.jsx)(hw,{projectId:n,onSelectSuite:(J,re)=>_("suite",re)})}),(0,Je.jsx)(ix,{open:w,onClose:()=>P(!1),onRun:async J=>{let re=await g(n,J);re?.run_id&&_("run",void 0,re.run_id)}})]})};return T==="suites"?(0,Je.jsx)(L,{}):T==="suite"&&c?(0,Je.jsx)(UA,{projectId:n,suiteId:c,onBack:()=>_("suites"),onRun:R=>_("run",void 0,R)}):T==="run"&&p?(0,Je.jsx)(HA,{runId:p,onBack:()=>_("dashboard")}):null};var ux=I(ie());var dx=I(ie());var VA=I(ie());var GA=I(H()),{Text:Vxe}=we;var KA=I(H()),{Text:t1e}=we;var bw=I(ie());var ww=I(H()),{Text:d1e,Paragraph:u1e}=we;var Cw=I(H()),{Text:C1e}=we;var Sw=I(ie());var XA=I(H()),{Text:L1e}=we;var kw=I(ie());var fx=I(ie());var YA=I(ie());var JA=I(H()),{Text:D1e}=we;var Iw=I(H()),{Text:V1e}=we;var Lx=I(ie());var px=I(H()),s$=({defaultWorkspaceId:e,defaultProjectId:t,children:r})=>{let o=Xt("__GLOBAL__");return(0,px.jsx)(Zv,{workspaceId:e,projectId:t,client:o,children:r})},mx=({children:e,defaultProjectId:t,defaultWorkspaceId:r})=>{let{config:{baseURL:o}}=Rt();return(0,px.jsx)(LS,{config:{baseURL:o,apiKey:"",assistantId:"__GLOBAL__",transport:"sse"},children:(0,px.jsx)(s$,{defaultWorkspaceId:r,defaultProjectId:t,children:e})})},J1e=mx;var Tw=I(H()),Lw=()=>{let{toolsVisible:e,toggleTools:t}=Ir();return(0,Tw.jsx)(Fp,{ariaLabel:"Toggle file directory",icon:(0,Tw.jsx)(Li,{size:16}),onClick:t,pressed:e})};var gx=I(ie());var Up=I(H()),l$=(0,gx.lazy)(()=>import("./embed-page-TasksSideApp-4ZJ4Q4CL.js").then(e=>({default:e.TasksSideApp}))),Rw=()=>{let{openSideApp:e,sideAppVisible:t,sideAppSelectedCard:r}=Ir(),o=t&&r?.component_key==="tasks_side_app_pin";return(0,Up.jsx)(Fp,{ariaLabel:"Open tasks",icon:(0,Up.jsx)(Vl,{size:16}),onClick:()=>{o||e({component_key:"tasks_side_app_pin",message:"Tasks",data:{component:(0,Up.jsx)(gx.Suspense,{fallback:(0,Up.jsx)(yt,{style:{display:"block",margin:"auto"}}),children:(0,Up.jsx)(l$,{showProjectFilter:!1})})}})}})};var hx=I(ie());var za=I(ie());var hn=I(H()),{ErrorBoundary:c$}=Xr,d$=({message:e,renderContent:t,autoLoadRightPanel:r})=>{let o=(0,za.useRef)(null),[a,n]=(0,za.useState)(!1),[i,s]=(0,za.useState)(!1);return(0,za.useEffect)(()=>{let c=new IntersectionObserver(([u])=>{let p=u.isIntersecting;n(p),p&&!i&&s(!0)},{threshold:.1});return o.current&&c.observe(o.current),()=>{o.current&&c.unobserve(o.current)}},[i]),(0,za.useEffect)(()=>{r?.()},[]),(0,hn.jsx)(c$,{children:(0,hn.jsx)("div",{ref:o,style:{width:"100%"},children:a||i?t(e):(()=>{let c=(e.tool_calls?.length??0)*140,u=e.content?Math.min(100,e.content.length/5)+c:100+c;return(0,hn.jsx)("div",{style:{height:`${u}px`,minHeight:"50px"}})})()})})},ZA=(0,za.memo)(({items:e,role:t,className:r})=>(0,hn.jsx)(U0.List,{autoScroll:!0,items:e,role:t,className:r},"messages"));ZA.displayName="MemoizedBubbleList";var QA=({messages:e,className:t,isLoading:r=!1})=>{let{styles:o}=Qc(),a=Yt(),n=(0,za.useDeferredValue)(e),i=r?n:e,s=(0,za.useRef)(i?.length??0);(0,za.useEffect)(()=>{i?.length&&(s.current=i?.length)},[i?.length]);let l=(0,za.useCallback)(p=>{let{content:m}=p;try{let g=JSON.parse(m);if(g.action&&g.message)return(0,hn.jsx)(or,{content:g.message})}catch{}let f=p.tool_calls?.map(g=>{try{return`\`\`\`tool_call
4369
4369
  ${JSON.stringify(g,(x,v)=>typeof v=="bigint"?v.toString():v)}
4370
4370
  \`\`\``}catch(x){return console.error("[MessageList] Failed to serialize tool_call:",x,g),"```tool_call\n[Unable to serialize tool call]\n```"}})||[],y=[m,...f].join(`
4371
4371
  `);return(0,hn.jsx)(Xe,{direction:"vertical",style:{width:"100%"},children:(0,hn.jsx)(or,{content:y})})},[]),c=(0,za.useMemo)(()=>i.map((p,m)=>({key:p.id,role:p.role,typing:!1,content:(0,hn.jsx)(d$,{message:p,renderContent:l,autoLoadRightPanel:()=>{let{content:f,role:y}=p,g=s.current>1&&s.current+1===e.length;if(m===e.length-1&&g&&y==="ai")try{let x=f?.match(/```([\w_]*)\n({.*?}|[^`]*)\n```/m),v=x?.[1],C=x?.[2],w=C?JSON.parse(C):{};if(v){let P=Es(v);P?.side_app_view?a({component_key:v,data:w}):P?.action&&P.action(w)}}catch(x){console.error(x)}}})})),[e,l]),u={ai:{placement:"start",typing:!1,variant:"filled",styles:{content:{background:"transparent",padding:0}}},human:{placement:"end",variant:"filled",styles:{content:{background:"linear-gradient(1777deg, rgba(153, 164, 255, 0.38), rgb(231 243 248 / 38%) 27%)"}}}};return c.length===0?r?(0,hn.jsxs)("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:[(0,hn.jsx)("style",{children:`
@@ -4373,7 +4373,7 @@ ${JSON.stringify(g,(x,v)=>typeof v=="bigint"?v.toString():v)}
4373
4373
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
4374
4374
  30% { transform: translateY(-6px); opacity: 1; }
4375
4375
  }
4376
- `}),(0,hn.jsx)("div",{style:{display:"flex",gap:6,padding:"12px 20px"},children:[0,1,2].map(p=>(0,hn.jsx)("div",{style:{width:8,height:8,borderRadius:"50%",background:"linear-gradient(135deg, #6366f1, #a855f7)",animation:"msg-typing 1.2s ease-in-out infinite",animationDelay:`${p*.2}s`}},p))})]}):(0,hn.jsx)("div",{style:{flex:1}}):(0,hn.jsx)(ZA,{items:c,role:u,className:o.messages||t})};var Ou=I(H()),u$=hx.default.lazy(()=>import("./embed-page-MessageGraph-E6DZDT65.js").then(e=>({default:e.MessageGraph}))),Pw=({messages:e,isLoading:t,viewMode:r,className:o,onJumpToMessage:a})=>r==="graph"?(0,Ou.jsx)(hx.Suspense,{fallback:(0,Ou.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,Ou.jsx)(yt,{})}),children:(0,Ou.jsx)("div",{style:{height:"100%",minHeight:0,width:"100%"},children:(0,Ou.jsx)(u$,{messages:e,isLoading:t,onJumpToMessage:a})})}):(0,Ou.jsx)(QA,{messages:e,isLoading:t,className:o});var bve={human:{width:420,height:220},ai:{width:440,height:360},tool:{width:380,height:320},agent:{width:380,height:320},summary:{width:260,height:96}},t4={understand:"\u7406\u89E3\u4E0E\u89C4\u5212",act:"\u6267\u884C",delegate:"\u59D4\u6D3E",answer:"\u56DE\u7B54"};function e4(e){return e.role==="ai"}function f$(e){let t=[];for(let r of e){let o=t[t.length-1];o&&o.kind===r.data.phase?o.nodeIds.push(r.id):t.push({id:`phase:${t.length}:${r.data.phase}`,kind:r.data.phase,title:t4[r.data.phase],nodeIds:[r.id]})}return t}function wve(e,t={}){let r=t.isLoading===!0,o=[],a=[],n=[...e].reverse().find(e4),i=e[e.length-1],s=[],l=!1,c=(u,p)=>{for(let m of s)a.push({id:`${p}:${m}->${u}`,from:m,to:u,kind:p})};for(let u of e){if(u.role==="human"){let w=`human:${u.id}`;o.push({id:w,data:{kind:"human",status:"success",phase:"understand",messageId:u.id,label:"\u7528\u6237",content:u.content}}),c(w,"sequence"),s=[w],l=!1;continue}if(!e4(u))continue;let p=u.tool_calls??[],m=u===n&&p.length===0,f=p.some(w=>w.name==="task")?"delegate":p.length>0?"act":m?"answer":"understand",y=p.some(w=>w.response===void 0),g=r&&u===i,x=g?"running":y&&!g?"error":"success",v=`ai:${u.id}`;o.push({id:v,data:{kind:"ai",status:x,phase:f,messageId:u.id,label:t4[f],content:u.content,isAnswer:m}}),c(v,l?"result":"sequence");let C=[];for(let w of p){let P=`tool:${w.id}`,E=w.response!==void 0?"success":g?"running":"error";o.push({id:P,data:{kind:w.name==="task"?"agent":"tool",status:E,phase:f,messageId:u.id,aiId:v,label:w.name,toolCall:w,parallelGroupId:v,parallelCount:p.length}}),a.push({id:`invoke:${v}->${P}`,from:v,to:P,kind:"invoke"}),C.push(P)}C.length>0?(s=C,l=!0):(s=[v],l=!1)}return{nodes:o,edges:a,phases:f$(o)}}function Cve(e,t){if(t<1||e.phases.length<=t)return e;let r=e.phases.slice(-t),o=e.phases.slice(0,-t),a=new Set(o.flatMap(m=>m.nodeIds)),n=new Set(r.flatMap(m=>m.nodeIds)),i=`summary:${o[0].id}`,l=[{id:i,data:{kind:"summary",status:"success",phase:o[0].kind,messageId:i,label:`${a.size} \u4E2A\u6B65\u9AA4`}},...e.nodes.filter(m=>!a.has(m.id))],c=e.edges.filter(m=>!a.has(m.from)&&!a.has(m.to)).map(m=>({...m})),u=new Set;for(let m of e.edges)a.has(m.from)&&n.has(m.to)&&!u.has(m.to)&&(u.add(m.to),c.push({id:`${m.kind}:${i}->${m.to}`,from:i,to:m.to,kind:m.kind}));let p={id:`phase:summary:${o[0].id}`,kind:o[0].kind,title:"\u66F4\u65E9",nodeIds:[i]};return{nodes:l,edges:c,phases:[p,...r]}}function r4(e,t){return e!==void 0?e:t===!0}var er=I(ie());var $u=I(H()),{Panel:p$}=Vo,m$=/^```([\w_]+)\n([\s\S]*?)\n```$/;function g$(e){if(typeof e!="string")return;let t=m$.exec(e.trim());if(t)try{let r=JSON.parse(t[2]);return typeof r=="object"&&r!==null&&!Array.isArray(r)?{key:t[1],data:r}:void 0}catch{return}}var h$=Le(({token:e,css:t})=>({card:t`
4376
+ `}),(0,hn.jsx)("div",{style:{display:"flex",gap:6,padding:"12px 20px"},children:[0,1,2].map(p=>(0,hn.jsx)("div",{style:{width:8,height:8,borderRadius:"50%",background:"linear-gradient(135deg, #6366f1, #a855f7)",animation:"msg-typing 1.2s ease-in-out infinite",animationDelay:`${p*.2}s`}},p))})]}):(0,hn.jsx)("div",{style:{flex:1}}):(0,hn.jsx)(ZA,{items:c,role:u,className:o.messages||t})};var Ou=I(H()),u$=hx.default.lazy(()=>import("./embed-page-MessageGraph-WMYTVUUC.js").then(e=>({default:e.MessageGraph}))),Pw=({messages:e,isLoading:t,viewMode:r,className:o,onJumpToMessage:a})=>r==="graph"?(0,Ou.jsx)(hx.Suspense,{fallback:(0,Ou.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,Ou.jsx)(yt,{})}),children:(0,Ou.jsx)("div",{style:{height:"100%",minHeight:0,width:"100%"},children:(0,Ou.jsx)(u$,{messages:e,isLoading:t,onJumpToMessage:a})})}):(0,Ou.jsx)(QA,{messages:e,isLoading:t,className:o});var bve={human:{width:420,height:220},ai:{width:440,height:360},tool:{width:380,height:320},agent:{width:380,height:320},summary:{width:260,height:96}},t4={understand:"\u7406\u89E3\u4E0E\u89C4\u5212",act:"\u6267\u884C",delegate:"\u59D4\u6D3E",answer:"\u56DE\u7B54"};function e4(e){return e.role==="ai"}function f$(e){let t=[];for(let r of e){let o=t[t.length-1];o&&o.kind===r.data.phase?o.nodeIds.push(r.id):t.push({id:`phase:${t.length}:${r.data.phase}`,kind:r.data.phase,title:t4[r.data.phase],nodeIds:[r.id]})}return t}function wve(e,t={}){let r=t.isLoading===!0,o=[],a=[],n=[...e].reverse().find(e4),i=e[e.length-1],s=[],l=!1,c=(u,p)=>{for(let m of s)a.push({id:`${p}:${m}->${u}`,from:m,to:u,kind:p})};for(let u of e){if(u.role==="human"){let w=`human:${u.id}`;o.push({id:w,data:{kind:"human",status:"success",phase:"understand",messageId:u.id,label:"\u7528\u6237",content:u.content}}),c(w,"sequence"),s=[w],l=!1;continue}if(!e4(u))continue;let p=u.tool_calls??[],m=u===n&&p.length===0,f=p.some(w=>w.name==="task")?"delegate":p.length>0?"act":m?"answer":"understand",y=p.some(w=>w.response===void 0),g=r&&u===i,x=g?"running":y&&!g?"error":"success",v=`ai:${u.id}`;o.push({id:v,data:{kind:"ai",status:x,phase:f,messageId:u.id,label:t4[f],content:u.content,isAnswer:m}}),c(v,l?"result":"sequence");let C=[];for(let w of p){let P=`tool:${w.id}`,E=w.response!==void 0?"success":g?"running":"error";o.push({id:P,data:{kind:w.name==="task"?"agent":"tool",status:E,phase:f,messageId:u.id,aiId:v,label:w.name,toolCall:w,parallelGroupId:v,parallelCount:p.length}}),a.push({id:`invoke:${v}->${P}`,from:v,to:P,kind:"invoke"}),C.push(P)}C.length>0?(s=C,l=!0):(s=[v],l=!1)}return{nodes:o,edges:a,phases:f$(o)}}function Cve(e,t){if(t<1||e.phases.length<=t)return e;let r=e.phases.slice(-t),o=e.phases.slice(0,-t),a=new Set(o.flatMap(m=>m.nodeIds)),n=new Set(r.flatMap(m=>m.nodeIds)),i=`summary:${o[0].id}`,l=[{id:i,data:{kind:"summary",status:"success",phase:o[0].kind,messageId:i,label:`${a.size} \u4E2A\u6B65\u9AA4`}},...e.nodes.filter(m=>!a.has(m.id))],c=e.edges.filter(m=>!a.has(m.from)&&!a.has(m.to)).map(m=>({...m})),u=new Set;for(let m of e.edges)a.has(m.from)&&n.has(m.to)&&!u.has(m.to)&&(u.add(m.to),c.push({id:`${m.kind}:${i}->${m.to}`,from:i,to:m.to,kind:m.kind}));let p={id:`phase:summary:${o[0].id}`,kind:o[0].kind,title:"\u66F4\u65E9",nodeIds:[i]};return{nodes:l,edges:c,phases:[p,...r]}}function r4(e,t){return e!==void 0?e:t===!0}var er=I(ie());var $u=I(H()),{Panel:p$}=Vo,m$=/^```([\w_]+)\n([\s\S]*?)\n```$/;function g$(e){if(typeof e!="string")return;let t=m$.exec(e.trim());if(t)try{let r=JSON.parse(t[2]);return typeof r=="object"&&r!==null&&!Array.isArray(r)?{key:t[1],data:r}:void 0}catch{return}}var h$=Le(({token:e,css:t})=>({card:t`
4377
4377
  max-width: 1200px;
4378
4378
  margin: 8px 20px;
4379
4379
  background: ${e.colorPrimaryBg};
@@ -5250,7 +5250,7 @@ ${e}
5250
5250
  overflow: auto;
5251
5251
  min-height: 0;
5252
5252
  background: ${e.colorBgContainer};
5253
- `}));var ch=({fileUrl:e,fileName:t="",downloadUrl:r,showHeader:o=!0})=>{let{styles:a}=zz(),[n,i]=(0,Pd.useState)(""),[s,l]=(0,Pd.useState)(!0),[c,u]=(0,Pd.useState)(null),p=(0,Pd.useMemo)(()=>Ld(t),[t]);if((0,Pd.useEffect)(()=>{p==="markdown"||p==="text"?(l(!0),u(null),fetch(e).then(m=>{if(!m.ok)throw new Error(`Failed: ${m.status}`);return m.text()}).then(m=>{i(m),l(!1)}).catch(m=>{u(m.message),l(!1)})):l(!1)},[e,p]),s)return(0,Zr.jsx)("div",{className:a.loading,children:(0,Zr.jsx)(yt,{size:"large",tip:"Loading..."})});if(c)return(0,Zr.jsx)("div",{className:a.error,children:(0,Zr.jsx)(Xr,{message:"Failed to load file",description:c,type:"error",showIcon:!0})});switch(p){case"markdown":case"text":return(0,Zr.jsx)("div",{className:a.container,children:(0,Zr.jsx)(qx,{content:n,fileName:t,downloadUrl:r})});case"image":return(0,Zr.jsx)("div",{className:a.container,children:(0,Zr.jsx)("div",{className:a.contentWrapper,children:(0,Zr.jsx)("div",{className:a.imageContainer,children:(0,Zr.jsx)("img",{src:e,alt:t,className:a.image})})})});case"pdf":case"iframe":return(0,Zr.jsx)("div",{className:a.container,children:(0,Zr.jsx)("div",{className:a.pdfContainer,children:(0,Zr.jsx)("iframe",{src:e,title:t,className:a.pdfIframe})})});case"audio":return(0,Zr.jsx)("div",{className:a.container,children:(0,Zr.jsx)("div",{className:a.mediaContainer,children:(0,Zr.jsxs)("audio",{controls:!0,className:a.media,children:[(0,Zr.jsx)("source",{src:e}),"Your browser does not support the audio element."]})})});case"video":return(0,Zr.jsx)("div",{className:a.container,children:(0,Zr.jsx)("div",{className:a.mediaContainer,children:(0,Zr.jsxs)("video",{controls:!0,className:a.media,children:[(0,Zr.jsx)("source",{src:e}),"Your browser does not support the video element."]})})});default:return(0,Zr.jsx)("div",{className:a.container,children:(0,Zr.jsxs)("div",{className:a.downloadContainer,children:[(0,Zr.jsx)(Pc,{className:a.fileIcon}),(0,Zr.jsx)("span",{className:a.fileName,children:t||"Unknown file"}),(0,Zr.jsx)(ge,{type:"primary",href:r||e,download:t,children:"Download File"})]})})}};var _E=I(H()),uC=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,dh=({data:e})=>{let t=bp(e);if(!t)return null;let r=uC(e);return(0,_E.jsx)(Hx,{uiRef:t,ui:uC(r?.ui),toolInput:uC(r?.toolInput),toolResult:r?.toolResult})};var DE=I(H());var BE=I(ie());var OE=I(H()),{Text:pke}=we;var Hz=I(ie());var fC=I(ie());var $E=I(H()),{Text:vke}=we;var qz=I(ie());var Uz=I(ie());var pC=I(H());var mC=I(H()),{Dragger:Lke}=Rc,{Text:Rke,Title:Pke}=we;var zE=I(H()),{Title:Bke,Text:Oke}=we;var So=I(H()),jE=[{id:"personal_assistant",type:"route",name:"Personal Assistant",icon:(0,So.jsx)(ki,{size:20}),order:-10},{id:"workspace_projects",type:"route",name:"Projects",icon:(0,So.jsx)(Li,{size:20}),order:0},{id:"metrics",builtin:"metrics",type:"route",name:"Metrics",icon:(0,So.jsx)(ou,{size:20}),order:10,group:"DataSource"},{id:"database",builtin:"database",type:"route",name:"Database",icon:(0,So.jsx)(Cs,{size:20}),order:20,group:"DataSource"},{id:"connections",builtin:"connections",type:"route",name:"Plugins",icon:(0,So.jsx)(ep,{size:20}),order:21},{id:"model-providers",type:"route",name:"Model Providers",icon:(0,So.jsx)(Hm,{size:20}),order:48,group:"Settings"},{id:"topology-runtimes",type:"route",name:"Runtime",icon:(0,So.jsx)(Jf,{size:20}),order:26,group:"Process"},{id:"topology-inbox",type:"route",name:"Inbox",icon:(0,So.jsx)(Xm,{size:20}),order:27,group:"Process"},{id:"workflows",type:"route",name:"Automations",icon:(0,So.jsx)(tp,{size:20}),order:25,group:"Process"},{id:"shares",type:"route",name:"Shares",icon:(0,So.jsx)(tp,{size:20}),order:55,group:"Settings"},{id:"workspace_migration",type:"route",name:"Migration",icon:(0,So.jsx)(jm,{size:20}),order:56,group:"Settings"},{id:"eval",type:"route",name:"Eval",icon:(0,So.jsx)(Ti,{size:20}),order:28,group:"Process"},{id:"assistants",builtin:"assistants",type:"route",name:"Assistants",icon:(0,So.jsx)(ki,{size:20}),order:30,group:"Settings"},{id:"skills",builtin:"skills",type:"route",name:"Skills",icon:(0,So.jsx)(lg,{size:20}),order:35,group:"Settings"},{id:"collections",type:"route",name:"Collections",icon:(0,So.jsx)(Bc,{size:20}),order:29,group:"Knowledge"},{id:"mcp",builtin:"mcp",type:"route",name:"MCP",icon:(0,So.jsx)(ep,{size:20}),order:40,group:"Settings"},{id:"a2a-keys",type:"route",name:"API Keys",icon:(0,So.jsx)(Ym,{size:20}),order:45,group:"Settings"},{id:"open-audit",type:"route",name:"Audit Log",icon:(0,So.jsx)(Jf,{size:20}),order:47,group:"Settings"},{id:"capability-bundles",type:"route",name:"Runtime Profiles",icon:(0,So.jsx)(ng,{size:20}),order:46,group:"Settings"},{id:"tools",builtin:"tools",type:"route",name:"Tools",icon:(0,So.jsx)(sg,{size:20}),order:50,group:"Settings"},{id:"tasks",type:"route",name:"Tasks",icon:(0,So.jsx)(Vl,{size:20}),order:100}];var rIe=(0,$i.lazy)(()=>import("./embed-page-AgentGovernanceWorkbench-LNGNSI7X.js").then(e=>({default:e.AgentGovernanceWorkbench}))),oIe=(0,$i.lazy)(()=>import("./embed-page-TopologyRuntimeView-DLPDUB7Z.js").then(e=>({default:e.TopologyRuntimeView}))),aIe=(0,$i.lazy)(()=>import("./embed-page-WorkflowAutomationView-FKSVOHHB.js").then(e=>({default:e.WorkflowAutomationView}))),nIe=(0,$i.lazy)(()=>import("./embed-page-TasksSideApp-QM5TZ7EG.js").then(e=>({default:e.TasksSideApp}))),iIe=(0,$i.lazy)(()=>import("./embed-page-AgentDetailSideApp-7NYLPLAX.js").then(e=>({default:e.AgentDetailSideApp})));var Sn=I(H());function Wz(e){let{contentType:t,assistantId:r,contentConfig:o,workspaceId:a,projectId:n}=e;return t==="agent"?{agentId:r,workspaceId:a||void 0,projectId:n||void 0}:{...o,workspaceId:a||void 0,projectId:n||void 0}}function Wx(e){return typeof e=="string"?e:""}function Vz(e,t,r){return Wx(e.workspaceId)===Wx(t)&&Wx(e.projectId)===Wx(r)}async function Gz(e,t,r){let{contentType:o,assistantId:a,contentConfig:n,isMatch:i,workspaceId:s,projectId:l}=t;if(!(o==="agent"?!!a:!!n)||!r)return{isPinned:!1,pinnedId:null};let u=await e("/api/menu-items?menuTarget=workspace");if(u.success&&u.data?.records){let p=i??(f=>o==="agent"&&f.agentId===a),m=u.data.records.find(f=>{let y=f.contentConfig??{};return f.contentType===o&&Vz(y,s,l)&&p(y)});if(m)return{isPinned:!0,pinnedId:m.id}}return{isPinned:!1,pinnedId:null}}async function Kz(e,t){let{contentType:r,name:o,group:a}=t,n=Wz(t),i={menuTarget:"workspace",contentType:r,contentConfig:n,group:a?.trim()||void 0,name:o.trim(),sortOrder:0},s=await e("/api/menu-items",i);if(!s.success)throw new Error(s.message||"Failed to pin");return{id:s.data.id}}async function Xz(e,t){let r=await e(`/api/menu-items/${t}`);if(!r.success)throw new Error(r.message||"Failed to unpin")}function Q0(){let e=No.default.useContext(si),{config:t}=Rt(),{post:r,get:o,del:a}=Pt(),n=t.enableCustomMenu??!1,i=e?.workspaceId,s=e?.projectId,l=(0,No.useCallback)(async p=>Gz(o,{...p,workspaceId:i,projectId:s},n),[o,n,i,s]),c=(0,No.useCallback)(async p=>Kz(r,{...p,workspaceId:i,projectId:s}),[r,i,s]),u=(0,No.useCallback)(async p=>Xz(a,p),[a]);return{check:l,pin:c,unpin:u,enableCustomMenu:n,get:o}}function UE(e){let t=new Set;for(let r of e)r.group?.trim()&&t.add(r.group.trim());return Array.from(t).sort()}function J2(){let{config:e}=Rt(),t=No.default.useMemo(()=>UE(jE),[]),r=No.default.useMemo(()=>UE(e.workspaceMenuItems??[]),[e.workspaceMenuItems]);return No.default.useMemo(()=>Array.from(new Set([...t,...r])).sort(),[t,r])}async function Z2(e){let t=await e("/api/menu-items?menuTarget=workspace");if(t.success&&t.data?.records){let r=new Set;for(let o of t.data.records)o.group?.trim()&&r.add(o.group.trim());return Array.from(r).sort()}return[]}var Yz={display:"flex",flexDirection:"column",gap:12},th=({assistantId:e,contentType:t="agent",contentConfig:r,isMatch:o,size:a="small",label:n,block:i,defaultName:s})=>{let{check:l,pin:c,unpin:u,enableCustomMenu:p,get:m}=Q0(),[f,y]=(0,No.useState)(!1),[g,x]=(0,No.useState)(""),[v,C]=(0,No.useState)(s??""),[w,P]=(0,No.useState)(!1),[E,$]=(0,No.useState)(!1),[M,B]=(0,No.useState)(null),[z,_]=(0,No.useState)(!0),T=J2(),[k,L]=(0,No.useState)(T);(0,No.useEffect)(()=>{L(T)},[T]),(0,No.useEffect)(()=>{f&&Z2(m).then(W=>{L(Array.from(new Set([...T,...W])).sort())})},[f]);let R=t==="agent"?!!e:!!r,F=(0,No.useCallback)(async()=>{if(!R||!p){_(!1);return}_(!0);try{let W=await l({contentType:t,assistantId:e,contentConfig:r,isMatch:o});$(W.isPinned),B(W.pinnedId)}catch{}finally{_(!1)}},[R,p,l,t,e,r,o]);if((0,No.useEffect)(()=>{F()},[F]),!R||!p)return null;let O=async()=>{if(!v.trim()){rt.warning("Please enter a menu name");return}P(!0);try{await c({contentType:t,assistantId:e,contentConfig:r,isMatch:o,name:v.trim(),group:g.trim()||void 0}),rt.success("Pinned to menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),y(!1),x(""),C(s??""),F()}catch(W){rt.error(W.message||"Failed to pin to menu")}finally{P(!1)}},G=async()=>{if(M){P(!0);try{await u(M),rt.success("Unpinned from menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),$(!1),B(null)}catch(W){rt.error(W.message||"Failed to unpin from menu")}finally{P(!1)}}},q=()=>{E?G():y(!0)};return(0,Sn.jsxs)(Sn.Fragment,{children:[(0,Sn.jsx)(ft,{title:E?"Unpin from Menu":"Pin to Menu",children:n?(0,Sn.jsx)(ge,{type:"text",size:a,block:i,icon:E?(0,Sn.jsx)(_n,{size:14,fill:"currentColor"}):(0,Sn.jsx)(_n,{size:14}),onClick:q,loading:z||w&&E,children:n}):(0,Sn.jsx)(ge,{type:"text",size:a,block:i,icon:E?(0,Sn.jsx)(_n,{size:14,fill:"currentColor"}):(0,Sn.jsx)(_n,{size:14}),onClick:q,loading:z||w&&E})}),(0,Sn.jsx)(Vt,{title:"Pin to Menu",open:f,onOk:O,onCancel:()=>y(!1),confirmLoading:w,okText:"Pin",children:(0,Sn.jsxs)("div",{style:Yz,children:[(0,Sn.jsx)(It,{placeholder:"Menu name (required)",value:v,onChange:W=>C(W.target.value)}),(0,Sn.jsx)(Jh,{placeholder:"Group (optional, select or type new)",value:g,options:k.map(W=>({value:W})),onChange:W=>x(W),filterOption:(W,J)=>J?.value?.toUpperCase().includes(W.toUpperCase())??!1})]})})]})};var Xu=I(H());function hC(e,t,r,o){return{...e,toolInput:t,toolResult:r,...o?{ui:o}:{}}}var Vx=({uiRef:e,toolInput:t,toolResult:r,ui:o})=>{let a=Yt(),n=typeof e.title=="string"&&e.title.trim()!==""?e.title:void 0,i=()=>{a({component_key:"mcp_app",data:hC(e,t,r,o),message:n})},s=gC.default.useMemo(()=>e.kind==="plugin"?{kind:"plugin",pluginType:e.pluginType,resource:e.resource,displayMode:e.displayMode,...e.title?{title:e.title}:{},...t?{toolInput:t}:{},...r!==void 0?{toolResult:r}:{},...o?{ui:o}:{}}:{kind:"mcp",serverKey:e.serverKey,resourceUri:e.resourceUri,displayMode:e.displayMode,...e.title?{title:e.title}:{},...t?{toolInput:t}:{},...r!==void 0?{toolResult:r}:{},...o?{ui:o}:{}},[e,t,r,o]),l=gC.default.useCallback(c=>e.kind==="plugin"?c.kind==="plugin"&&c.pluginType===e.pluginType&&c.resource===e.resource:c.kind==="mcp"&&c.serverKey===e.serverKey&&c.resourceUri===e.resourceUri,[e]);return(0,Xu.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:n?"space-between":"flex-end",gap:8,padding:"2px 8px 2px 0"},children:[n&&(0,Xu.jsx)(we.Text,{strong:!0,style:{fontSize:13},children:n}),(0,Xu.jsx)(th,{contentType:"mcpApp",contentConfig:s,isMatch:l,defaultName:n??"MCP App",size:"small"}),(0,Xu.jsx)(ge,{type:"text",size:"small",icon:(0,Xu.jsx)(ry,{}),onClick:i,title:"Open in side app"})]})};function Yu(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>{if(typeof t=="string")return t;if(t!==null&&typeof t=="object"){let r=t.text;if(typeof r=="string")return r}return""}).filter(t=>t.length>0).join(`
5253
+ `}));var ch=({fileUrl:e,fileName:t="",downloadUrl:r,showHeader:o=!0})=>{let{styles:a}=zz(),[n,i]=(0,Pd.useState)(""),[s,l]=(0,Pd.useState)(!0),[c,u]=(0,Pd.useState)(null),p=(0,Pd.useMemo)(()=>Ld(t),[t]);if((0,Pd.useEffect)(()=>{p==="markdown"||p==="text"?(l(!0),u(null),fetch(e).then(m=>{if(!m.ok)throw new Error(`Failed: ${m.status}`);return m.text()}).then(m=>{i(m),l(!1)}).catch(m=>{u(m.message),l(!1)})):l(!1)},[e,p]),s)return(0,Zr.jsx)("div",{className:a.loading,children:(0,Zr.jsx)(yt,{size:"large",tip:"Loading..."})});if(c)return(0,Zr.jsx)("div",{className:a.error,children:(0,Zr.jsx)(Xr,{message:"Failed to load file",description:c,type:"error",showIcon:!0})});switch(p){case"markdown":case"text":return(0,Zr.jsx)("div",{className:a.container,children:(0,Zr.jsx)(qx,{content:n,fileName:t,downloadUrl:r})});case"image":return(0,Zr.jsx)("div",{className:a.container,children:(0,Zr.jsx)("div",{className:a.contentWrapper,children:(0,Zr.jsx)("div",{className:a.imageContainer,children:(0,Zr.jsx)("img",{src:e,alt:t,className:a.image})})})});case"pdf":case"iframe":return(0,Zr.jsx)("div",{className:a.container,children:(0,Zr.jsx)("div",{className:a.pdfContainer,children:(0,Zr.jsx)("iframe",{src:e,title:t,className:a.pdfIframe})})});case"audio":return(0,Zr.jsx)("div",{className:a.container,children:(0,Zr.jsx)("div",{className:a.mediaContainer,children:(0,Zr.jsxs)("audio",{controls:!0,className:a.media,children:[(0,Zr.jsx)("source",{src:e}),"Your browser does not support the audio element."]})})});case"video":return(0,Zr.jsx)("div",{className:a.container,children:(0,Zr.jsx)("div",{className:a.mediaContainer,children:(0,Zr.jsxs)("video",{controls:!0,className:a.media,children:[(0,Zr.jsx)("source",{src:e}),"Your browser does not support the video element."]})})});default:return(0,Zr.jsx)("div",{className:a.container,children:(0,Zr.jsxs)("div",{className:a.downloadContainer,children:[(0,Zr.jsx)(Pc,{className:a.fileIcon}),(0,Zr.jsx)("span",{className:a.fileName,children:t||"Unknown file"}),(0,Zr.jsx)(ge,{type:"primary",href:r||e,download:t,children:"Download File"})]})})}};var _E=I(H()),uC=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,dh=({data:e})=>{let t=bp(e);if(!t)return null;let r=uC(e);return(0,_E.jsx)(Hx,{uiRef:t,ui:uC(r?.ui),toolInput:uC(r?.toolInput),toolResult:r?.toolResult})};var DE=I(H());var BE=I(ie());var OE=I(H()),{Text:pke}=we;var Hz=I(ie());var fC=I(ie());var $E=I(H()),{Text:vke}=we;var qz=I(ie());var Uz=I(ie());var pC=I(H());var mC=I(H()),{Dragger:Lke}=Rc,{Text:Rke,Title:Pke}=we;var zE=I(H()),{Title:Bke,Text:Oke}=we;var So=I(H()),jE=[{id:"personal_assistant",type:"route",name:"Personal Assistant",icon:(0,So.jsx)(ki,{size:20}),order:-10},{id:"workspace_projects",type:"route",name:"Projects",icon:(0,So.jsx)(Li,{size:20}),order:0},{id:"metrics",builtin:"metrics",type:"route",name:"Metrics",icon:(0,So.jsx)(ou,{size:20}),order:10,group:"DataSource"},{id:"database",builtin:"database",type:"route",name:"Database",icon:(0,So.jsx)(Cs,{size:20}),order:20,group:"DataSource"},{id:"connections",builtin:"connections",type:"route",name:"Plugins",icon:(0,So.jsx)(ep,{size:20}),order:21},{id:"model-providers",type:"route",name:"Model Providers",icon:(0,So.jsx)(Hm,{size:20}),order:48,group:"Settings"},{id:"topology-runtimes",type:"route",name:"Runtime",icon:(0,So.jsx)(Jf,{size:20}),order:26,group:"Process"},{id:"topology-inbox",type:"route",name:"Inbox",icon:(0,So.jsx)(Xm,{size:20}),order:27,group:"Process"},{id:"workflows",type:"route",name:"Automations",icon:(0,So.jsx)(tp,{size:20}),order:25,group:"Process"},{id:"shares",type:"route",name:"Shares",icon:(0,So.jsx)(tp,{size:20}),order:55,group:"Settings"},{id:"workspace_migration",type:"route",name:"Migration",icon:(0,So.jsx)(jm,{size:20}),order:56,group:"Settings"},{id:"eval",type:"route",name:"Eval",icon:(0,So.jsx)(Ti,{size:20}),order:28,group:"Process"},{id:"assistants",builtin:"assistants",type:"route",name:"Assistants",icon:(0,So.jsx)(ki,{size:20}),order:30,group:"Settings"},{id:"skills",builtin:"skills",type:"route",name:"Skills",icon:(0,So.jsx)(lg,{size:20}),order:35,group:"Settings"},{id:"collections",type:"route",name:"Collections",icon:(0,So.jsx)(Bc,{size:20}),order:29,group:"Knowledge"},{id:"mcp",builtin:"mcp",type:"route",name:"MCP",icon:(0,So.jsx)(ep,{size:20}),order:40,group:"Settings"},{id:"a2a-keys",type:"route",name:"API Keys",icon:(0,So.jsx)(Ym,{size:20}),order:45,group:"Settings"},{id:"open-audit",type:"route",name:"Audit Log",icon:(0,So.jsx)(Jf,{size:20}),order:47,group:"Settings"},{id:"capability-bundles",type:"route",name:"Runtime Profiles",icon:(0,So.jsx)(ng,{size:20}),order:46,group:"Settings"},{id:"tools",builtin:"tools",type:"route",name:"Tools",icon:(0,So.jsx)(sg,{size:20}),order:50,group:"Settings"},{id:"tasks",type:"route",name:"Tasks",icon:(0,So.jsx)(Vl,{size:20}),order:100}];var rIe=(0,$i.lazy)(()=>import("./embed-page-AgentGovernanceWorkbench-GG4ONSTS.js").then(e=>({default:e.AgentGovernanceWorkbench}))),oIe=(0,$i.lazy)(()=>import("./embed-page-TopologyRuntimeView-QMXWERVC.js").then(e=>({default:e.TopologyRuntimeView}))),aIe=(0,$i.lazy)(()=>import("./embed-page-WorkflowAutomationView-L2OEGCA5.js").then(e=>({default:e.WorkflowAutomationView}))),nIe=(0,$i.lazy)(()=>import("./embed-page-TasksSideApp-4ZJ4Q4CL.js").then(e=>({default:e.TasksSideApp}))),iIe=(0,$i.lazy)(()=>import("./embed-page-AgentDetailSideApp-2C2ZR62Q.js").then(e=>({default:e.AgentDetailSideApp})));var Sn=I(H());function Wz(e){let{contentType:t,assistantId:r,contentConfig:o,workspaceId:a,projectId:n}=e;return t==="agent"?{agentId:r,workspaceId:a||void 0,projectId:n||void 0}:{...o,workspaceId:a||void 0,projectId:n||void 0}}function Wx(e){return typeof e=="string"?e:""}function Vz(e,t,r){return Wx(e.workspaceId)===Wx(t)&&Wx(e.projectId)===Wx(r)}async function Gz(e,t,r){let{contentType:o,assistantId:a,contentConfig:n,isMatch:i,workspaceId:s,projectId:l}=t;if(!(o==="agent"?!!a:!!n)||!r)return{isPinned:!1,pinnedId:null};let u=await e("/api/menu-items?menuTarget=workspace");if(u.success&&u.data?.records){let p=i??(f=>o==="agent"&&f.agentId===a),m=u.data.records.find(f=>{let y=f.contentConfig??{};return f.contentType===o&&Vz(y,s,l)&&p(y)});if(m)return{isPinned:!0,pinnedId:m.id}}return{isPinned:!1,pinnedId:null}}async function Kz(e,t){let{contentType:r,name:o,group:a}=t,n=Wz(t),i={menuTarget:"workspace",contentType:r,contentConfig:n,group:a?.trim()||void 0,name:o.trim(),sortOrder:0},s=await e("/api/menu-items",i);if(!s.success)throw new Error(s.message||"Failed to pin");return{id:s.data.id}}async function Xz(e,t){let r=await e(`/api/menu-items/${t}`);if(!r.success)throw new Error(r.message||"Failed to unpin")}function Q0(){let e=No.default.useContext(si),{config:t}=Rt(),{post:r,get:o,del:a}=Pt(),n=t.enableCustomMenu??!1,i=e?.workspaceId,s=e?.projectId,l=(0,No.useCallback)(async p=>Gz(o,{...p,workspaceId:i,projectId:s},n),[o,n,i,s]),c=(0,No.useCallback)(async p=>Kz(r,{...p,workspaceId:i,projectId:s}),[r,i,s]),u=(0,No.useCallback)(async p=>Xz(a,p),[a]);return{check:l,pin:c,unpin:u,enableCustomMenu:n,get:o}}function UE(e){let t=new Set;for(let r of e)r.group?.trim()&&t.add(r.group.trim());return Array.from(t).sort()}function J2(){let{config:e}=Rt(),t=No.default.useMemo(()=>UE(jE),[]),r=No.default.useMemo(()=>UE(e.workspaceMenuItems??[]),[e.workspaceMenuItems]);return No.default.useMemo(()=>Array.from(new Set([...t,...r])).sort(),[t,r])}async function Z2(e){let t=await e("/api/menu-items?menuTarget=workspace");if(t.success&&t.data?.records){let r=new Set;for(let o of t.data.records)o.group?.trim()&&r.add(o.group.trim());return Array.from(r).sort()}return[]}var Yz={display:"flex",flexDirection:"column",gap:12},th=({assistantId:e,contentType:t="agent",contentConfig:r,isMatch:o,size:a="small",label:n,block:i,defaultName:s})=>{let{check:l,pin:c,unpin:u,enableCustomMenu:p,get:m}=Q0(),[f,y]=(0,No.useState)(!1),[g,x]=(0,No.useState)(""),[v,C]=(0,No.useState)(s??""),[w,P]=(0,No.useState)(!1),[E,$]=(0,No.useState)(!1),[M,B]=(0,No.useState)(null),[z,_]=(0,No.useState)(!0),T=J2(),[k,L]=(0,No.useState)(T);(0,No.useEffect)(()=>{L(T)},[T]),(0,No.useEffect)(()=>{f&&Z2(m).then(W=>{L(Array.from(new Set([...T,...W])).sort())})},[f]);let R=t==="agent"?!!e:!!r,F=(0,No.useCallback)(async()=>{if(!R||!p){_(!1);return}_(!0);try{let W=await l({contentType:t,assistantId:e,contentConfig:r,isMatch:o});$(W.isPinned),B(W.pinnedId)}catch{}finally{_(!1)}},[R,p,l,t,e,r,o]);if((0,No.useEffect)(()=>{F()},[F]),!R||!p)return null;let O=async()=>{if(!v.trim()){rt.warning("Please enter a menu name");return}P(!0);try{await c({contentType:t,assistantId:e,contentConfig:r,isMatch:o,name:v.trim(),group:g.trim()||void 0}),rt.success("Pinned to menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),y(!1),x(""),C(s??""),F()}catch(W){rt.error(W.message||"Failed to pin to menu")}finally{P(!1)}},G=async()=>{if(M){P(!0);try{await u(M),rt.success("Unpinned from menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),$(!1),B(null)}catch(W){rt.error(W.message||"Failed to unpin from menu")}finally{P(!1)}}},q=()=>{E?G():y(!0)};return(0,Sn.jsxs)(Sn.Fragment,{children:[(0,Sn.jsx)(ft,{title:E?"Unpin from Menu":"Pin to Menu",children:n?(0,Sn.jsx)(ge,{type:"text",size:a,block:i,icon:E?(0,Sn.jsx)(_n,{size:14,fill:"currentColor"}):(0,Sn.jsx)(_n,{size:14}),onClick:q,loading:z||w&&E,children:n}):(0,Sn.jsx)(ge,{type:"text",size:a,block:i,icon:E?(0,Sn.jsx)(_n,{size:14,fill:"currentColor"}):(0,Sn.jsx)(_n,{size:14}),onClick:q,loading:z||w&&E})}),(0,Sn.jsx)(Vt,{title:"Pin to Menu",open:f,onOk:O,onCancel:()=>y(!1),confirmLoading:w,okText:"Pin",children:(0,Sn.jsxs)("div",{style:Yz,children:[(0,Sn.jsx)(It,{placeholder:"Menu name (required)",value:v,onChange:W=>C(W.target.value)}),(0,Sn.jsx)(Jh,{placeholder:"Group (optional, select or type new)",value:g,options:k.map(W=>({value:W})),onChange:W=>x(W),filterOption:(W,J)=>J?.value?.toUpperCase().includes(W.toUpperCase())??!1})]})})]})};var Xu=I(H());function hC(e,t,r,o){return{...e,toolInput:t,toolResult:r,...o?{ui:o}:{}}}var Vx=({uiRef:e,toolInput:t,toolResult:r,ui:o})=>{let a=Yt(),n=typeof e.title=="string"&&e.title.trim()!==""?e.title:void 0,i=()=>{a({component_key:"mcp_app",data:hC(e,t,r,o),message:n})},s=gC.default.useMemo(()=>e.kind==="plugin"?{kind:"plugin",pluginType:e.pluginType,resource:e.resource,displayMode:e.displayMode,...e.title?{title:e.title}:{},...t?{toolInput:t}:{},...r!==void 0?{toolResult:r}:{},...o?{ui:o}:{}}:{kind:"mcp",serverKey:e.serverKey,resourceUri:e.resourceUri,displayMode:e.displayMode,...e.title?{title:e.title}:{},...t?{toolInput:t}:{},...r!==void 0?{toolResult:r}:{},...o?{ui:o}:{}},[e,t,r,o]),l=gC.default.useCallback(c=>e.kind==="plugin"?c.kind==="plugin"&&c.pluginType===e.pluginType&&c.resource===e.resource:c.kind==="mcp"&&c.serverKey===e.serverKey&&c.resourceUri===e.resourceUri,[e]);return(0,Xu.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:n?"space-between":"flex-end",gap:8,padding:"2px 8px 2px 0"},children:[n&&(0,Xu.jsx)(we.Text,{strong:!0,style:{fontSize:13},children:n}),(0,Xu.jsx)(th,{contentType:"mcpApp",contentConfig:s,isMatch:l,defaultName:n??"MCP App",size:"small"}),(0,Xu.jsx)(ge,{type:"text",size:"small",icon:(0,Xu.jsx)(ry,{}),onClick:i,title:"Open in side app"})]})};function Yu(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>{if(typeof t=="string")return t;if(t!==null&&typeof t=="object"){let r=t.text;if(typeof r=="string")return r}return""}).filter(t=>t.length>0).join(`
5254
5254
 
5255
5255
  `);if(e!==null&&typeof e=="object"){let t=e.text;if(typeof t=="string")return t;try{let r=JSON.stringify(e);return typeof r=="string"?r:""}catch{return""}}return""}var qE=/```mcp_app\s*\n([\s\S]*?)```/;function HE(e){let t=Yu(e);if(!t)return null;let r=qE.exec(t);if(!r)return null;try{return bp(JSON.parse(r[1].trim()))}catch{return null}}function WE(e){let t=Yu(e);return t?t.replace(qE,"").trim():""}var Ju=I(H()),Jz="/mcp-apps/sandbox.html",Zz=120,Qz=1200,ej=320;function tj(e){let t=e.config?.baseURL;if(!t)return null;try{return new URL(t,window.location.origin).origin}catch{return null}}function rj(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var oj=e=>typeof e=="object"&&e!==null;function aj(e){let t=/^data:([^;,]*);base64,(.*)$/.exec(e);return t?{mimeType:t[1]||void 0,data:t[2]}:null}function nj(e){if(e.type==="image_url"){let t=oj(e.image_url)&&typeof e.image_url.url=="string"?e.image_url.url:"",r=t?aj(t):null;return r?{type:"image",data:r.data,mimeType:r.mimeType??"application/octet-stream"}:null}if(e.type==="image"||e.type==="audio"){let t=typeof e.mime_type=="string"?e.mime_type:typeof e.mimeType=="string"?e.mimeType:"application/octet-stream";return{type:e.type,data:e.data,mimeType:t}}return e.type==="resource"?{type:"resource",resource:e.resource}:e.type==="text"?{type:"text",text:e.text}:e}function ij(e,t,r){let o=r?.structuredContent!==void 0?r.structuredContent:t.kind==="mcp"?t.structuredContent:void 0,a=o!==void 0?{structuredContent:o}:{},n=r?.meta!==void 0?{_meta:r.meta}:{};if(e!==null&&typeof e=="object"&&!Array.isArray(e)&&"content"in e)return{...e,...a,...n};let i=[],s=WE(Yu(e));s&&i.push({type:"text",text:s});for(let l of r?.contentBlocks??[]){let c=nj(l);c&&i.push(c)}return i.length===0&&i.push({type:"text",text:""}),{content:i,...a,...n}}var Hx=({uiRef:e,toolName:t,toolInput:r,toolResult:o,ui:a,onError:n})=>{let i=kp(),s=i?.state.assistantId??"",l=Xt(s),{openSideApp:c}=Ir(),u=(0,Wn.useRef)(null),p=(0,Wn.useRef)(null),[m,f]=(0,Wn.useState)(null),[y,g]=(0,Wn.useState)(ej),[x,v]=(0,Wn.useState)(null),C=(0,Wn.useMemo)(()=>tj(l),[l]),w=C!==null&&C===window.location.origin,P=(0,Wn.useRef)({client:l,uiRef:e,toolName:t,toolInput:r,toolResult:o,ui:a,thread:i,openSideApp:c,onError:n});return(0,Wn.useEffect)(()=>{P.current={client:l,uiRef:e,toolName:t,toolInput:r,toolResult:o,ui:a,thread:i,openSideApp:c,onError:n}}),(0,Wn.useEffect)(()=>{w&&P.current.onError?.(new Error("MCP Apps require the gateway sandbox to be served from a different origin than the console."))},[w]),(0,Wn.useEffect)(()=>{if(!C||w)return;let E=u.current;if(!E)return;let $=k=>{E.contentWindow?.postMessage(k,C)},M={rpc:(k,L)=>P.current.client.mcpApps.rpc(P.current.uiRef,k,L),openLink:k=>{window.open(k,"_blank","noopener,noreferrer")},sendMessage:async k=>{let L=P.current.thread?.sendMessage;L&&await L({input:{message:k}})},requestDisplayMode:async k=>{if(k!=="fullscreen"||!P.current.openSideApp)return"inline";try{let L={component_key:"mcp_app",data:hC(P.current.uiRef,P.current.toolInput,P.current.toolResult,P.current.ui),message:P.current.uiRef.title};return P.current.openSideApp(L),"fullscreen"}catch{return"inline"}},downloadFile:()=>{},onInitialized:()=>{$({jsonrpc:"2.0",method:"ui/notifications/tool-input",params:{arguments:P.current.toolInput??{}}}),$({jsonrpc:"2.0",method:"ui/notifications/tool-result",params:ij(P.current.toolResult,P.current.uiRef,P.current.ui)})},toolName:P.current.toolName,theme:rj(),locale:typeof navigator<"u"?navigator.language:void 0},B=new S0(M),z=!1,_=!1,T=async k=>{if(k.origin!==C||k.source!==E.contentWindow)return;let L=k.data;if(!L||typeof L!="object")return;if(!z){if(L.method!=="ui/notifications/sandbox-proxy-ready")return;z=!0;try{let F=await P.current.client.mcpApps.getResource(P.current.uiRef);if(_)return;$({jsonrpc:"2.0",method:"ui/notifications/sandbox-resource-ready",params:{html:F.html,csp:F.cspPolicy}})}catch(F){let O=F instanceof Error?F:new Error("Failed to load MCP app resource");v(O.message),P.current.onError?.(O)}return}if(L.method==="ui/notifications/size-changed"){let F=Number(L.params?.height);Number.isFinite(F)&&g(Math.min(Qz,Math.max(Zz,F)));return}let R=await B.handle(L);L.id!==void 0&&$(R)};return window.addEventListener("message",T),()=>{_=!0,window.removeEventListener("message",T)}},[C,w]),(0,Wn.useEffect)(()=>{let E=p.current;if(!E||typeof ResizeObserver>"u")return;let $=E.closest(".ant-bubble")??E,M=new ResizeObserver(z=>{for(let _ of z){let T=_.contentRect.width;T>0&&f(T)}});M.observe($);let B=$.getBoundingClientRect().width;return B>0&&f(B),()=>M.disconnect()},[C,w,x]),C?w?(0,Ju.jsx)(Xr,{type:"warning",showIcon:!0,message:"MCP App unavailable",description:"MCP Apps require the gateway sandbox to be served from a different origin than the console."}):x?(0,Ju.jsxs)(we.Text,{type:"secondary",children:["MCP App failed to load: ",x]}):(0,Ju.jsx)("div",{ref:p,children:(0,Ju.jsx)("iframe",{ref:u,title:e.title??"MCP App",sandbox:"allow-scripts allow-same-origin",src:`${C}${Jz}`,style:{width:m&&m>0?`${m}px`:"100%",height:y,border:0,display:"block"},onError:()=>n?.(new Error("MCP app failed to load"))})}):(0,Ju.jsx)(we.Text,{type:"secondary",children:"MCP App host is unavailable."})};var Gx=I(H());function sj(e){return e.startsWith("data:")}function lj(e){if(e.type==="image_url"){let a=e.image_url;return typeof a=="object"&&a!==null&&typeof a.url=="string"&&sj(a.url)?a.url:null}let t=typeof e.source_type=="string"?e.source_type:void 0;if(t!==void 0&&t!=="base64")return null;let r=typeof e.data=="string"?e.data:"";return!r||r.startsWith("http")?null:`data:${typeof e.mime_type=="string"?e.mime_type:typeof e.mimeType=="string"?e.mimeType:"application/octet-stream"};base64,${r}`}var VE=({ui:e})=>{let t=(e?.contentBlocks??[]).filter(r=>r.type==="image"||r.type==="image_url"||r.type==="audio").map(r=>{let o=lj(r);return o?{block:r,src:o}:null}).filter(r=>r!==null);return t.length===0?null:(0,Gx.jsx)("div",{style:{marginTop:8,display:"flex",flexDirection:"column",gap:8},children:t.map(({block:r,src:o},a)=>r.type==="image"||r.type==="image_url"?(0,Gx.jsx)("img",{src:o,alt:"tool result",style:{maxWidth:"100%"}},a):(0,Gx.jsx)("audio",{controls:!0,src:o},a))})};var rn=I(H()),cj=Vo.Panel,GE=({data:e})=>{let t=e,[r,o]=(0,Zu.useState)(!1),a=(0,Zu.useCallback)(()=>{o(!0)},[]),n=(0,Zu.useMemo)(()=>HE(t.response),[t.response]),i=(0,Zu.useMemo)(()=>Yu(t.response),[t.response]);if(n&&!r)return(0,rn.jsxs)("div",{children:[(0,rn.jsx)(Vx,{uiRef:n,ui:t.ui,toolInput:t.args,toolResult:t.response}),(0,rn.jsx)(Hx,{uiRef:n,ui:t.ui,toolName:t.name,toolInput:t.args,toolResult:t.response,onError:a})]});let s=y=>{try{let g=Object.values(y).map(v=>typeof v=="object"?JSON.stringify(v).substring(0,50)+(JSON.stringify(v).length>50?"...":""):String(v).substring(0,50)+(String(v).length>50?"...":"")).join(" ");return(g.length>100?g.substring(0,100)+"...":g).replaceAll(`
5256
5256
  `," ")}catch{return"Error parsing args"}},l=(0,rn.jsxs)(bo,{align:"center",wrap:"wrap",children:[(0,rn.jsx)(we.Text,{strong:!0,children:SL(t.name)}),(0,rn.jsx)(we.Text,{type:"secondary",style:{fontSize:"12px",marginLeft:"8px"},children:s(t.args)})]}),c={name:t.name,parameters:t.args,type:"tool_call"},u=(0,rn.jsxs)("div",{style:{marginTop:"8px"},children:[(0,rn.jsx)(b0,{data:c,component_key:`${t.id}-params`,interactive:!1}),i&&(0,rn.jsxs)("div",{style:{marginTop:"12px"},children:[(0,rn.jsx)(we.Text,{strong:!0,style:{fontSize:"12px",marginBottom:"8px",display:"block"},children:"Response:"}),(0,rn.jsx)(or,{content:i})]}),(0,rn.jsx)(VE,{ui:t.ui})]}),p=({isActive:y})=>C0(t.status),m=t.name.toLowerCase();m.startsWith("browser_")&&(m="browser_viewer");let f=Es(m);if(f&&!n){let y=f.card_view;return(0,rn.jsx)(y,{data:t,component_key:t.id})}return(0,rn.jsx)(Vo,{size:"small",bordered:!1,defaultActiveKey:[],expandIcon:p,children:(0,rn.jsx)(cj,{header:l,style:{minWidth:400},children:u},t.id)})};var XE=I(ie());var xt=I(H());function Qu(e){if(!e)return{success:!0,data:void 0};try{let t=JSON.parse(e);return t&&typeof t=="object"&&"success"in t?t:{success:!0,data:t}}catch{return{success:!0,data:void 0}}}var uh=({message:e})=>(0,xt.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px",borderRadius:12,background:"rgba(255, 77, 79, 0.08)",border:"1px solid rgba(255, 77, 79, 0.35)",color:"#ef4444",fontSize:13},children:[(0,xt.jsx)("span",{children:"\u2715"}),(0,xt.jsx)("span",{children:e})]}),{Text:lc}=we,Kx=Le(({css:e})=>({liveCard:e`
@@ -5578,7 +5578,7 @@ ${e}
5578
5578
  background: ${e.colorFillAlter};
5579
5579
  border-radius: 8px;
5580
5580
  border: 1px solid ${e.colorBorderSecondary};
5581
- `}));function PN(e){if(e)try{let t=JSON.parse(e);if(t&&typeof t=="object")return t}catch{return}}function l9(e){if(typeof e!="string")return;let t="execution-result:";if(!e.startsWith(t))return;let r=e.slice(t.length).trim();return r.length>0?r:void 0}async function c9(e,t,r,o){let a=PN(r),n=a?.threadId??l9(a?.executionResultId)??(typeof o=="string"&&o.length>0?o:void 0);if(n)return n;try{let i=await e.tasks.workItems.list(t),s,l=Number.NEGATIVE_INFINITY;for(let c of i){if(c.action!=="execution_result"||typeof c.threadId!="string"||c.threadId.length===0)continue;let u=new Date(c.createdAt).getTime();Number.isFinite(u)&&u>l&&(l=u,s=c.threadId)}return s}catch{return}}var AN=({data:e,component_key:t,interactive:r=!0})=>{let{styles:o}=s9(),a=e,n=Yt(),i=Xt("__GLOBAL__"),s=typeof a?.args?.taskId=="string"&&a.args.taskId.length>0?a.args.taskId:void 0,l=typeof a?.args?.agentId=="string"&&a.args.agentId.length>0?a.args.agentId:void 0,c=s!==void 0&&l!==void 0,[u,p]=(0,i1.useState)(null),{threadId:m,assistantId:f}=nr();if((0,i1.useEffect)(()=>{if(!c||!s)return;let _=!1;return i.tasks.get(s).then(T=>{_||p(T)},()=>{_||p(null)}),()=>{_=!0}},[i,c,s]),!a)return null;let{description:y,subagent_type:g,assignee:x}=a?.args||{},v=a.status||"pending",C=a.response||null,w=c?u?.title??"Task":void 0,P=g;g==="general-purpose"&&(P=f+"-general-purpose");let E=(m||"")+"____"+P+"_"+a.id,M=(_=>{switch(_){case"success":return{icon:(0,Pr.jsx)(Zi,{style:{fontSize:16}}),color:"success",text:"Completed",bgColor:"rgba(82, 196, 26, 0.1)"};case"error":return{icon:(0,Pr.jsx)(ey,{style:{fontSize:16}}),color:"error",text:"Failed",bgColor:"rgba(255, 77, 79, 0.1)"};case"pending":default:return{icon:(0,Pr.jsx)(Wl,{style:{fontSize:16}}),color:"processing",text:"In Progress",bgColor:"rgba(24, 144, 255, 0.1)"}}})(v),B=v==="success"&&C,z=()=>{if(c){if(!s)return;let _=w,T=u?.description??"",k=u?.context?.thread_id,L=PN(C)?.agentId??l;L==="general-purpose"&&(L=f+"-general-purpose"),c9(i,s,C,k).then(R=>{R&&n({component_key:"task",message:_,data:{thread_id:R,description:T,subagent_type:L,display_name:_}})});return}n({component_key:"task",message:g,data:{thread_id:E,description:y,subagent_type:P}})};return(0,Pr.jsx)(Sr,{size:"small",className:o.card,bordered:!1,onClick:z,hoverable:r,bodyStyle:{padding:0},children:(0,Pr.jsxs)("div",{className:o.cardBody,children:[(0,Pr.jsx)("div",{className:o.header,children:(0,Pr.jsxs)("div",{className:o.titleSection,children:[(0,Pr.jsx)("div",{className:o.iconWrapper,children:(0,Pr.jsx)(DS,{style:{fontSize:20,color:"#1890ff"}})}),(0,Pr.jsx)("div",{className:o.titleContent,children:c?(0,Pr.jsxs)(Pr.Fragment,{children:[l&&(0,Pr.jsx)("div",{className:o.taskType,children:l}),(0,Pr.jsx)(n1,{className:o.description,children:w})]}):(0,Pr.jsxs)(Pr.Fragment,{children:[g&&(0,Pr.jsx)("div",{className:o.taskType,children:g}),y&&(0,Pr.jsx)(n1,{className:o.description,children:y})]})})]})}),(0,Pr.jsxs)("div",{className:o.footer,children:[(0,Pr.jsxs)("div",{className:o.footerLeft,children:[x&&(0,Pr.jsxs)("div",{className:o.assigneeContainer,children:[(0,Pr.jsx)(Xd,{size:24,icon:(0,Pr.jsx)(gy,{}),className:o.assigneeAvatar}),(0,Pr.jsx)(n1,{className:o.assigneeName,children:x})]}),(0,Pr.jsx)(kt,{icon:M.icon,color:M.color,style:{margin:0,padding:"4px 12px",borderRadius:"12px",fontSize:"12px",fontWeight:500,border:"none",background:M.bgColor},children:M.text})]}),r&&(0,Pr.jsx)(Of,{className:o.actionIcon})]}),B&&(0,Pr.jsxs)("div",{className:o.responseSection,onClick:_=>_.stopPropagation(),children:[(0,Pr.jsx)(n1,{className:o.responseHeader,children:"Response"}),(0,Pr.jsx)("div",{className:o.responseContent,children:(0,Pr.jsx)(or,{content:C})})]})]})})};var s1=I(H()),{Text:fRe}=we,EN=({data:e,component_key:t,interactive:r=!0})=>{let{description:o,subagent_type:a,thread_id:n,display_name:i}=e||{};return(0,s1.jsx)(Fg,{threadId:n,assistantId:a,options:{streaming:!0,enableReturnStateWhenStreamCompleted:!0,enableResumeStream:!0},children:(0,s1.jsx)("div",{style:{overflow:"hidden"},children:(0,s1.jsx)(kx,{showRefreshButton:!0,name:i??a,showHeader:!0,showSender:!1,showHITL:!0})})})};var ji=I(H()),{Text:IC}=we,d9=Le(({token:e,css:t})=>({listContainer:t`
5581
+ `}));function PN(e){if(e)try{let t=JSON.parse(e);if(t&&typeof t=="object")return t}catch{return}}function l9(e){if(typeof e!="string")return;let t="execution-result:";if(!e.startsWith(t))return;let r=e.slice(t.length).trim().split(":")[0]?.trim();return r&&r.length>0?r:void 0}async function c9(e,t,r,o){let a=PN(r),n=a?.threadId??l9(a?.executionResultId)??(typeof o=="string"&&o.length>0?o:void 0);if(n)return n;try{let i=await e.tasks.workItems.list(t),s,l=Number.NEGATIVE_INFINITY;for(let c of i){if(c.action!=="execution_result"||typeof c.threadId!="string"||c.threadId.length===0)continue;let u=new Date(c.createdAt).getTime();Number.isFinite(u)&&u>l&&(l=u,s=c.threadId)}return s}catch{return}}var AN=({data:e,component_key:t,interactive:r=!0})=>{let{styles:o}=s9(),a=e,n=Yt(),i=Xt("__GLOBAL__"),s=typeof a?.args?.taskId=="string"&&a.args.taskId.length>0?a.args.taskId:void 0,l=typeof a?.args?.agentId=="string"&&a.args.agentId.length>0?a.args.agentId:void 0,c=s!==void 0&&l!==void 0,[u,p]=(0,i1.useState)(null),{threadId:m,assistantId:f}=nr();if((0,i1.useEffect)(()=>{if(!c||!s)return;let _=!1;return i.tasks.get(s).then(T=>{_||p(T)},()=>{_||p(null)}),()=>{_=!0}},[i,c,s]),!a)return null;let{description:y,subagent_type:g,assignee:x}=a?.args||{},v=a.status||"pending",C=a.response||null,w=c?u?.title??"Task":void 0,P=g;g==="general-purpose"&&(P=f+"-general-purpose");let E=(m||"")+"____"+P+"_"+a.id,M=(_=>{switch(_){case"success":return{icon:(0,Pr.jsx)(Zi,{style:{fontSize:16}}),color:"success",text:"Completed",bgColor:"rgba(82, 196, 26, 0.1)"};case"error":return{icon:(0,Pr.jsx)(ey,{style:{fontSize:16}}),color:"error",text:"Failed",bgColor:"rgba(255, 77, 79, 0.1)"};case"pending":default:return{icon:(0,Pr.jsx)(Wl,{style:{fontSize:16}}),color:"processing",text:"In Progress",bgColor:"rgba(24, 144, 255, 0.1)"}}})(v),B=v==="success"&&C,z=()=>{if(c){if(!s)return;let _=w,T=u?.description??"",k=u?.context?.thread_id,L=PN(C)?.agentId??l;L==="general-purpose"&&(L=f+"-general-purpose"),c9(i,s,C,k).then(R=>{R&&n({component_key:"task",message:_,data:{thread_id:R,description:T,subagent_type:L,display_name:_}})});return}n({component_key:"task",message:g,data:{thread_id:E,description:y,subagent_type:P}})};return(0,Pr.jsx)(Sr,{size:"small",className:o.card,bordered:!1,onClick:z,hoverable:r,bodyStyle:{padding:0},children:(0,Pr.jsxs)("div",{className:o.cardBody,children:[(0,Pr.jsx)("div",{className:o.header,children:(0,Pr.jsxs)("div",{className:o.titleSection,children:[(0,Pr.jsx)("div",{className:o.iconWrapper,children:(0,Pr.jsx)(DS,{style:{fontSize:20,color:"#1890ff"}})}),(0,Pr.jsx)("div",{className:o.titleContent,children:c?(0,Pr.jsxs)(Pr.Fragment,{children:[l&&(0,Pr.jsx)("div",{className:o.taskType,children:l}),(0,Pr.jsx)(n1,{className:o.description,children:w})]}):(0,Pr.jsxs)(Pr.Fragment,{children:[g&&(0,Pr.jsx)("div",{className:o.taskType,children:g}),y&&(0,Pr.jsx)(n1,{className:o.description,children:y})]})})]})}),(0,Pr.jsxs)("div",{className:o.footer,children:[(0,Pr.jsxs)("div",{className:o.footerLeft,children:[x&&(0,Pr.jsxs)("div",{className:o.assigneeContainer,children:[(0,Pr.jsx)(Xd,{size:24,icon:(0,Pr.jsx)(gy,{}),className:o.assigneeAvatar}),(0,Pr.jsx)(n1,{className:o.assigneeName,children:x})]}),(0,Pr.jsx)(kt,{icon:M.icon,color:M.color,style:{margin:0,padding:"4px 12px",borderRadius:"12px",fontSize:"12px",fontWeight:500,border:"none",background:M.bgColor},children:M.text})]}),r&&(0,Pr.jsx)(Of,{className:o.actionIcon})]}),B&&(0,Pr.jsxs)("div",{className:o.responseSection,onClick:_=>_.stopPropagation(),children:[(0,Pr.jsx)(n1,{className:o.responseHeader,children:"Response"}),(0,Pr.jsx)("div",{className:o.responseContent,children:(0,Pr.jsx)(or,{content:C})})]})]})})};var s1=I(H()),{Text:fRe}=we,EN=({data:e,component_key:t,interactive:r=!0})=>{let{description:o,subagent_type:a,thread_id:n,display_name:i}=e||{};return(0,s1.jsx)(Fg,{threadId:n,assistantId:a,options:{streaming:!0,enableReturnStateWhenStreamCompleted:!0,enableResumeStream:!0},children:(0,s1.jsx)("div",{style:{overflow:"hidden"},children:(0,s1.jsx)(kx,{showRefreshButton:!0,name:i??a,showHeader:!0,showSender:!1,showHITL:!0})})})};var ji=I(H()),{Text:IC}=we,d9=Le(({token:e,css:t})=>({listContainer:t`
5582
5582
  background: ${e.colorBgContainer};
5583
5583
  border-radius: ${e.borderRadius}px;
5584
5584
  padding: 8px 0;
@@ -6588,7 +6588,7 @@ svg { height:100%}
6588
6588
  font-size: 12px;
6589
6589
  `,metadata:t`
6590
6590
  margin-top: ${e.marginXS}px;
6591
- `})),n3=({data:e})=>{let{styles:t}=H9(),{query:r,collection:o,results:a}=e??{};return!a||a.length===0?null:(0,Al.jsx)("div",{className:t.container,children:(0,Al.jsxs)(Sr,{size:"small",title:`Search: "${r||""}"`,children:[o&&(0,Al.jsxs)(a3,{type:"secondary",style:{fontSize:12},children:["Collection: ",o]}),a.map((n,i)=>(0,Al.jsxs)(Sr,{size:"small",className:t.resultCard,children:[(0,Al.jsx)(q9,{ellipsis:{rows:3,expandable:!0,symbol:"more"},style:{marginBottom:4},children:n.content}),(0,Al.jsxs)(Xe,{wrap:!0,className:t.metadata,children:[n.score!==void 0&&(0,Al.jsxs)(a3,{className:t.score,children:["Score: ",n.score.toFixed(4)]}),n.metadata&&Object.entries(n.metadata).filter(([s])=>!s.startsWith("_")).map(([s,l])=>(0,Al.jsxs)(kt,{children:[s,": ",String(l)]},s))]})]},i))]})})};var ph=I(H()),_C=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,i3=({data:e,component_key:t})=>{let r=bp(e);if(!r)return null;let o=_C(e);return(0,ph.jsxs)("div",{children:[(0,ph.jsx)(Vx,{uiRef:r,ui:_C(o?.ui),toolInput:_C(o?.toolInput),toolResult:o?.toolResult}),(0,ph.jsx)(dh,{data:e,component_key:t})]})};var rf=I(H()),W9=(0,nm.lazy)(()=>import("./embed-page-TasksSideApp-QM5TZ7EG.js").then(e=>({default:e.TasksSideApp}))),V9=(0,nm.lazy)(()=>import("./embed-page-TeamWorkspace-E7RFY3ZY.js").then(e=>({default:e.TeamWorkspace}))),c1={action_show_attachments_uploader:{card_view:()=>null,action:e=>{console.log(e)}},generic_data_table:{card_view:Ql,side_app_view:wL},confirm:{card_view:mL},clarify:{card_view:yL},task_review:{card_view:bL},tool_call:{card_view:GE},manage_eval:{card_view:YE,side_app_view:Jx},run_eval:{card_view:oN,side_app_view:Jx},read_eval:{card_view:aN,side_app_view:Jx},manage_task:{card_view:lN,side_app_view:({data:e})=>(0,rf.jsx)(nm.Suspense,{fallback:(0,rf.jsx)(yt,{style:{display:"block",margin:"auto"}}),children:(0,rf.jsx)(W9,{initialTask:e?.task})})},tool_card:{card_view:b0},todo_list:{card_view:zu},write_todos:{card_view:dN},internet_search:{card_view:NN},write_file:{card_view:yN},edit_file:{card_view:RN},file_explorer:{card_view:()=>null,side_app_view:fN},attachments:{card_view:r1,side_app_view:a1},file_content_diff_view:{card_view:kC,side_app_view:kC},task:{card_view:AN,side_app_view:EN},schedule_viewer:{card_view:()=>null,side_app_view:BN},browser_viewer:{card_view:ON,side_app_view:a1},execute_code:{card_view:$N},create_team:{card_view:zN},team_workspace:{card_view:()=>null,side_app_view:e=>(0,rf.jsx)(nm.Suspense,{fallback:(0,rf.jsx)(yt,{style:{display:"block",margin:"auto"}}),children:(0,rf.jsx)(V9,{...e})})},task_board:{card_view:AC,side_app_view:AC},mailbox:{card_view:KN,side_app_view:ZN},show_widget:{card_view:t3,side_app_view:o3},search_collection_result:{card_view:n3},mcp_app:{card_view:i3,side_app_view:dh}};var Es=e=>e&&c1[e]?c1[e]:null,ex=(e,t)=>(console.log("regsiterElement",e,t),c1[e]=t,t);var of=I(ie());var mo=I(H()),G9=Le(({token:e,css:t})=>({container:t`
6591
+ `})),n3=({data:e})=>{let{styles:t}=H9(),{query:r,collection:o,results:a}=e??{};return!a||a.length===0?null:(0,Al.jsx)("div",{className:t.container,children:(0,Al.jsxs)(Sr,{size:"small",title:`Search: "${r||""}"`,children:[o&&(0,Al.jsxs)(a3,{type:"secondary",style:{fontSize:12},children:["Collection: ",o]}),a.map((n,i)=>(0,Al.jsxs)(Sr,{size:"small",className:t.resultCard,children:[(0,Al.jsx)(q9,{ellipsis:{rows:3,expandable:!0,symbol:"more"},style:{marginBottom:4},children:n.content}),(0,Al.jsxs)(Xe,{wrap:!0,className:t.metadata,children:[n.score!==void 0&&(0,Al.jsxs)(a3,{className:t.score,children:["Score: ",n.score.toFixed(4)]}),n.metadata&&Object.entries(n.metadata).filter(([s])=>!s.startsWith("_")).map(([s,l])=>(0,Al.jsxs)(kt,{children:[s,": ",String(l)]},s))]})]},i))]})})};var ph=I(H()),_C=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,i3=({data:e,component_key:t})=>{let r=bp(e);if(!r)return null;let o=_C(e);return(0,ph.jsxs)("div",{children:[(0,ph.jsx)(Vx,{uiRef:r,ui:_C(o?.ui),toolInput:_C(o?.toolInput),toolResult:o?.toolResult}),(0,ph.jsx)(dh,{data:e,component_key:t})]})};var rf=I(H()),W9=(0,nm.lazy)(()=>import("./embed-page-TasksSideApp-4ZJ4Q4CL.js").then(e=>({default:e.TasksSideApp}))),V9=(0,nm.lazy)(()=>import("./embed-page-TeamWorkspace-H5OOEN3K.js").then(e=>({default:e.TeamWorkspace}))),c1={action_show_attachments_uploader:{card_view:()=>null,action:e=>{console.log(e)}},generic_data_table:{card_view:Ql,side_app_view:wL},confirm:{card_view:mL},clarify:{card_view:yL},task_review:{card_view:bL},tool_call:{card_view:GE},manage_eval:{card_view:YE,side_app_view:Jx},run_eval:{card_view:oN,side_app_view:Jx},read_eval:{card_view:aN,side_app_view:Jx},manage_task:{card_view:lN,side_app_view:({data:e})=>(0,rf.jsx)(nm.Suspense,{fallback:(0,rf.jsx)(yt,{style:{display:"block",margin:"auto"}}),children:(0,rf.jsx)(W9,{initialTask:e?.task})})},tool_card:{card_view:b0},todo_list:{card_view:zu},write_todos:{card_view:dN},internet_search:{card_view:NN},write_file:{card_view:yN},edit_file:{card_view:RN},file_explorer:{card_view:()=>null,side_app_view:fN},attachments:{card_view:r1,side_app_view:a1},file_content_diff_view:{card_view:kC,side_app_view:kC},task:{card_view:AN,side_app_view:EN},schedule_viewer:{card_view:()=>null,side_app_view:BN},browser_viewer:{card_view:ON,side_app_view:a1},execute_code:{card_view:$N},create_team:{card_view:zN},team_workspace:{card_view:()=>null,side_app_view:e=>(0,rf.jsx)(nm.Suspense,{fallback:(0,rf.jsx)(yt,{style:{display:"block",margin:"auto"}}),children:(0,rf.jsx)(V9,{...e})})},task_board:{card_view:AC,side_app_view:AC},mailbox:{card_view:KN,side_app_view:ZN},show_widget:{card_view:t3,side_app_view:o3},search_collection_result:{card_view:n3},mcp_app:{card_view:i3,side_app_view:dh}};var Es=e=>e&&c1[e]?c1[e]:null,ex=(e,t)=>(console.log("regsiterElement",e,t),c1[e]=t,t);var of=I(ie());var mo=I(H()),G9=Le(({token:e,css:t})=>({container:t`
6592
6592
  margin: 16px 0;
6593
6593
  border: 1px solid ${e.colorBorderSecondary};
6594
6594
  border-radius: ${e.borderRadius}px;
@@ -6617,7 +6617,7 @@ svg { height:100%}
6617
6617
  background: ${e.colorBgContainer};
6618
6618
  `,error:t`
6619
6619
  padding: 24px;
6620
- `}));function K9(e){let t="";if(typeof e=="string"?t=e.trim():Array.isArray(e)&&(t=e.join("").trim()),!t)return{};if(t.startsWith("{"))try{return JSON.parse(t)}catch{return{path:t}}return t.startsWith("http://")||t.startsWith("https://")?{url:t}:{path:t}}function X9(e){switch(Ld(e)){case"markdown":case"text":return(0,mo.jsx)(Mn,{});case"image":return(0,mo.jsx)(Qd,{});case"pdf":return(0,mo.jsx)(Hl,{});case"audio":return(0,mo.jsx)(wk,{});case"video":return(0,mo.jsx)(ly,{});default:{let r=e.split(".").pop()?.toLowerCase();return["doc","docx"].includes(r||"")?(0,mo.jsx)(Ff,{}):["xls","xlsx","csv"].includes(r||"")?(0,mo.jsx)(_f,{}):["zip","rar","7z","tar","gz"].includes(r||"")?(0,mo.jsx)(Df,{}):(0,mo.jsx)(Pc,{})}}}var s3=({children:e})=>{let{styles:t}=G9(),{config:r}=Rt(),{threadId:o,assistantId:a}=ns()??{},[n,i]=(0,of.useState)(!1),s=(0,of.useMemo)(()=>K9(e),[e]),l=(0,of.useMemo)(()=>s.url?s.url:!s.path||!r?.baseURL||!a||!o?null:`${r.baseURL}/api/assistants/${a}/threads/${o}/sandbox/downloadfile?path=${encodeURIComponent(s.path)}`,[s,r?.baseURL,a,o]),c=(0,of.useMemo)(()=>{if(s.title)return s.title;if(s.path)return s.path.split("/").pop()||s.path;if(s.url)try{return new URL(s.url).pathname.split("/").pop()||s.url}catch{return s.url}return"Embedded File"},[s]),u=(0,of.useMemo)(()=>{let m=s.path||s.url||"";return X9(m)},[s]);if(!l)return(0,mo.jsx)("div",{className:t.error,children:(0,mo.jsx)(Xr,{message:"Invalid embed configuration",description:"Please provide a valid file path or URL",type:"warning",showIcon:!0})});let p=(0,mo.jsx)("div",{className:t.content,children:(0,mo.jsx)(ch,{fileUrl:l,fileName:c})});return s.collapsed?(0,mo.jsx)(Vo,{size:"small",defaultActiveKey:["1"],items:[{key:"1",label:(0,mo.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,mo.jsx)("span",{children:u}),(0,mo.jsx)("span",{children:c})]}),children:p}]}):(0,mo.jsxs)("div",{className:t.container,children:[(0,mo.jsxs)("div",{className:t.header,children:[(0,mo.jsx)("span",{className:t.headerIcon,children:u}),(0,mo.jsx)("span",{className:t.headerTitle,children:c}),(0,mo.jsx)(ge,{type:"text",size:"small",icon:(0,mo.jsx)(bs,{}),onClick:()=>i(!0),children:"Share"})]}),p,n&&(0,mo.jsx)(Op,{open:n,filePath:s.path??"",assistantId:a??void 0,fileName:c,onClose:()=>i(!1)})]})};var va=I(H()),Y9=(0,El.lazy)(()=>import("./embed-page-mermaid-CW4QCAH3.js")),J9=(0,El.lazy)(()=>import("./embed-page-ReactInfographic-IABAC7DO.js").then(e=>({default:e.ReactInfographic}))),Z9=(0,El.lazy)(()=>import("./embed-page-ReactChart-3VE7F5VJ.js").then(e=>({default:e.ReactChart})));function mh(){return(0,va.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:200,color:"rgba(0, 0, 0, 0.45)",fontSize:13},children:"Loading\u2026"})}var l3=e=>{let{className:t,children:r}=e,o=t?.match(/language-(\w+)/)?.[1]||"",a;if(typeof r=="string"&&(a=r),Array.isArray(r)&&(a=r.join("")),o){let n=Es(o)?.card_view;if(n){let i;try{i=JSON.parse(a)}catch{}return o==="task_review"?(0,va.jsx)(n,{component_key:o,data:i,interactive:!1}):(0,va.jsx)(n,{component_key:o,data:i})}switch(o){case"infographic":return(0,va.jsx)(El.Suspense,{fallback:(0,va.jsx)(mh,{}),children:(0,va.jsx)(J9,{children:r})});case"mermaid":return(0,va.jsx)(El.Suspense,{fallback:(0,va.jsx)(mh,{}),children:(0,va.jsx)(Y9,{children:r})});case"chart":return(0,va.jsx)(El.Suspense,{fallback:(0,va.jsx)(mh,{}),children:(0,va.jsx)(Z9,{children:r})});case"embed":return(0,va.jsx)(s3,{children:r});default:return(0,va.jsx)(El.Suspense,{fallback:(0,va.jsx)(mh,{}),children:(0,va.jsx)(_2,{lang:o,children:r})})}}return(0,va.jsx)(El.Suspense,{fallback:(0,va.jsx)(mh,{}),children:(0,va.jsx)(_2,{lang:o,children:r})})};var FC=I(H()),d1=e=>t=>{if(!t)return null;let{className:r,children:o}=t,a;if(typeof o=="string"?a=o:Array.isArray(o)&&(a=o.join("")),!a)return(0,FC.jsx)(e,{component_key:r,data:void 0});let n;try{n=JSON.parse(a)}catch{n=a}return(0,FC.jsx)(e,{component_key:r,data:n})};var u1=I(ie());var im=I(H()),c3=({data:e})=>{if(!e)return null;if(!ME(e))return(0,im.jsx)(im.Fragment,{children:e});let t=Yt(),{threadId:r,assistantId:o}=ns()??{},{config:a}=Rt(),n=(0,u1.useMemo)(()=>!a?.baseURL||!o||!r?null:`${a.baseURL}/api/assistants/${o}/threads/${r}/sandbox/downloadfile`,[a?.baseURL,o,r]),i=(0,u1.useCallback)(s=>{if(!n)return;let l=new URLSearchParams({path:s}),c=`${n}?${l.toString()}`;t({component_key:"attachments",data:{file_id:s,message:"\u9884\u89C8\uFF1A"+s.split("/").pop(),full_url:c,download_url:c},message:"\u9884\u89C8\uFF1A"+s.split("/").pop()})},[n,t]);return n?(0,im.jsx)(ge,{type:"link",size:"small",onClick:()=>i(e),children:e}):(0,im.jsx)("span",{children:e})};var sm=I(ie());var DC=I(H()),Q9=/\/api\/web-apps\/[^/]+\/runtime$/,d3=({data:e})=>{if(e==null)return null;let t=typeof e=="string"?e:String(e??"");if(t.length===0)return null;let r=Yt(),{threadId:o,assistantId:a}=ns()??{},{config:n}=Rt(),i=(0,sm.useContext)(si),s=(0,sm.useMemo)(()=>{if(i?.workspaceId&&i?.projectId){let p=i.getFileViewUrl(t,a||void 0),m=i.getFileDownloadUrl(t,a||void 0);if(p&&m)return{fullUrl:p,downloadUrl:m}}if(!n?.baseURL)return null;let c=new URLSearchParams({path:t});if(Q9.test(n.baseURL)){let p=n.baseURL.replace(/\/$/,"");return{fullUrl:`${p}/files/viewfile?${c.toString()}`,downloadUrl:`${p}/files/downloadfile?${c.toString()}`}}if(!a||!o)return null;let u=`${n.baseURL}/api/assistants/${a}/threads/${o}/sandbox/downloadfile?${c.toString()}`;return{fullUrl:u,downloadUrl:u}},[i,n?.baseURL,a,o,t]),l=(0,sm.useCallback)(()=>{if(!s)return;let c=t.split("/").pop()??t;r({component_key:"attachments",data:{file_id:t,message:`\u9884\u89C8\uFF1A${c}`,full_url:s.fullUrl,download_url:s.downloadUrl},message:`\u9884\u89C8\uFF1A${c}`})},[s,t,r]);return s?(0,DC.jsx)(ge,{type:"link",size:"small",onClick:l,children:t}):(0,DC.jsx)("span",{children:t})};var u3=I(ie());var p3=I(H()),eU=e=>{if(!e||!e.children)return null;let t=[],r=[],o=e.children.find(n=>n.name==="thead"),a=e.children.find(n=>n.name==="tbody");if(o&&o.children){let n=o.children.find(i=>i.name==="tr");n&&n.children&&n.children.forEach(i=>{if(i.name==="th"&&i.children){let s=i.children.map(l=>l.type==="text"?l.data:l.children?l.children.map(c=>c.type==="text"?c.data:"").join(""):"").join("").trim();t.push(s)}})}if(a&&a.children&&a.children.forEach(n=>{if(n.name==="tr"&&n.children){let i={},s=0;n.children.forEach(l=>{if(l.name==="td"&&s<t.length){let c=l.children.map(p=>p.type==="text"?p.data:p.children?p.children.map(m=>m.type==="text"?m.data:"").join(""):"").join("").trim(),u=t[s]||`col_${s}`;i[u]=c,s++}}),Object.keys(i).length>0&&r.push(i)}}),t.length===0&&r.length>0){let n=r[0];return{headers:Object.keys(n),dataSource:r}}return{headers:t,dataSource:r}},f3=e=>{let{domNode:t}=e,r=(0,u3.useMemo)(()=>eU(t),[t]);return!r||r.dataSource.length===0?null:(0,p3.jsx)(Ql,{component_key:"markdown_table",data:{dataSource:r.dataSource,message:""},interactive:!0,default_open_in_side_app:!0})};var tU=d1(Ql),rU=d1(c3),oU=d1(d3),m3={code:l3,file:rU,filelink:oU,genericdatatable:tU,table:f3};var BC="\uE000",aU=new Set(["code","codespan","html","table","def","hr","link","image","autolink","url","escape"]),y3="[A-Za-z0-9_.\\-~\\u4e00-\\u9fff]",nU=new RegExp(`^${y3}$`),g3=["project","agent","root"];function h3(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function iU(e){return Array.isArray(e.items)&&e.items.length>0?e.items:Array.isArray(e.tokens)&&e.tokens.length>0?e.tokens:null}function x3(e,t,r,o){let a=r.start;for(let n of t){let i=n.raw??"";if(i.length===0)continue;let s=e.indexOf(i,a);if(s<r.start||s+i.length>r.end){o.push({start:a,end:r.end});return}if(aU.has(n.type))o.push({start:s,end:s+i.length});else{let l=iU(n);l&&x3(e,l,{start:s,end:s+i.length},o)}a=s+i.length}}function v3(e,t){if(typeof e!="string"||e.length===0||e.includes(BC))return e;let r=(t?.volumes&&t.volumes.length>0?t.volumes:g3).map(g=>g.replace(/^\/+|\/+$/g,"")).filter(g=>g.length>0).map(h3);r.length===0&&(r=g3.map(h3));let o;try{o=sT(e)}catch{return e}let a=[];x3(e,o,{start:0,end:e.length},a);let n=[],i="",s=0;for(let g of a)i+=e.slice(s,g.start)+BC,n.push(e.slice(g.start,g.end)),s=g.end;i+=e.slice(s);let l=new RegExp(`(?<![A-Za-z0-9_:/.])/(?:${r.join("|")})(?:/${y3}+)+`,"g"),c="",u=0,p=!1,m;for(;(m=l.exec(i))!==null;){let g=i[l.lastIndex];if(g!==void 0&&nU.test(g))continue;let x=m[0].replace(/\.+$/,"");x!==m[0]&&!x.includes("/")||(c+=i.slice(u,m.index),c+=`<filelink>${x}</filelink>`,u=l.lastIndex,p=!0)}if(!p)return e;c+=i.slice(u);let f=c.split(BC),y="";for(let g=0;g<f.length;g+=1)y+=f[g],g<n.length&&(y+=n[g]);return y}var af=I(H()),sU=m3,lU=Le(({token:e,css:t})=>({markdownContainer:t`
6620
+ `}));function K9(e){let t="";if(typeof e=="string"?t=e.trim():Array.isArray(e)&&(t=e.join("").trim()),!t)return{};if(t.startsWith("{"))try{return JSON.parse(t)}catch{return{path:t}}return t.startsWith("http://")||t.startsWith("https://")?{url:t}:{path:t}}function X9(e){switch(Ld(e)){case"markdown":case"text":return(0,mo.jsx)(Mn,{});case"image":return(0,mo.jsx)(Qd,{});case"pdf":return(0,mo.jsx)(Hl,{});case"audio":return(0,mo.jsx)(wk,{});case"video":return(0,mo.jsx)(ly,{});default:{let r=e.split(".").pop()?.toLowerCase();return["doc","docx"].includes(r||"")?(0,mo.jsx)(Ff,{}):["xls","xlsx","csv"].includes(r||"")?(0,mo.jsx)(_f,{}):["zip","rar","7z","tar","gz"].includes(r||"")?(0,mo.jsx)(Df,{}):(0,mo.jsx)(Pc,{})}}}var s3=({children:e})=>{let{styles:t}=G9(),{config:r}=Rt(),{threadId:o,assistantId:a}=ns()??{},[n,i]=(0,of.useState)(!1),s=(0,of.useMemo)(()=>K9(e),[e]),l=(0,of.useMemo)(()=>s.url?s.url:!s.path||!r?.baseURL||!a||!o?null:`${r.baseURL}/api/assistants/${a}/threads/${o}/sandbox/downloadfile?path=${encodeURIComponent(s.path)}`,[s,r?.baseURL,a,o]),c=(0,of.useMemo)(()=>{if(s.title)return s.title;if(s.path)return s.path.split("/").pop()||s.path;if(s.url)try{return new URL(s.url).pathname.split("/").pop()||s.url}catch{return s.url}return"Embedded File"},[s]),u=(0,of.useMemo)(()=>{let m=s.path||s.url||"";return X9(m)},[s]);if(!l)return(0,mo.jsx)("div",{className:t.error,children:(0,mo.jsx)(Xr,{message:"Invalid embed configuration",description:"Please provide a valid file path or URL",type:"warning",showIcon:!0})});let p=(0,mo.jsx)("div",{className:t.content,children:(0,mo.jsx)(ch,{fileUrl:l,fileName:c})});return s.collapsed?(0,mo.jsx)(Vo,{size:"small",defaultActiveKey:["1"],items:[{key:"1",label:(0,mo.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,mo.jsx)("span",{children:u}),(0,mo.jsx)("span",{children:c})]}),children:p}]}):(0,mo.jsxs)("div",{className:t.container,children:[(0,mo.jsxs)("div",{className:t.header,children:[(0,mo.jsx)("span",{className:t.headerIcon,children:u}),(0,mo.jsx)("span",{className:t.headerTitle,children:c}),(0,mo.jsx)(ge,{type:"text",size:"small",icon:(0,mo.jsx)(bs,{}),onClick:()=>i(!0),children:"Share"})]}),p,n&&(0,mo.jsx)(Op,{open:n,filePath:s.path??"",assistantId:a??void 0,fileName:c,onClose:()=>i(!1)})]})};var va=I(H()),Y9=(0,El.lazy)(()=>import("./embed-page-mermaid-CW4QCAH3.js")),J9=(0,El.lazy)(()=>import("./embed-page-ReactInfographic-IABAC7DO.js").then(e=>({default:e.ReactInfographic}))),Z9=(0,El.lazy)(()=>import("./embed-page-ReactChart-7XCMDMH6.js").then(e=>({default:e.ReactChart})));function mh(){return(0,va.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:200,color:"rgba(0, 0, 0, 0.45)",fontSize:13},children:"Loading\u2026"})}var l3=e=>{let{className:t,children:r}=e,o=t?.match(/language-(\w+)/)?.[1]||"",a;if(typeof r=="string"&&(a=r),Array.isArray(r)&&(a=r.join("")),o){let n=Es(o)?.card_view;if(n){let i;try{i=JSON.parse(a)}catch{}return o==="task_review"?(0,va.jsx)(n,{component_key:o,data:i,interactive:!1}):(0,va.jsx)(n,{component_key:o,data:i})}switch(o){case"infographic":return(0,va.jsx)(El.Suspense,{fallback:(0,va.jsx)(mh,{}),children:(0,va.jsx)(J9,{children:r})});case"mermaid":return(0,va.jsx)(El.Suspense,{fallback:(0,va.jsx)(mh,{}),children:(0,va.jsx)(Y9,{children:r})});case"chart":return(0,va.jsx)(El.Suspense,{fallback:(0,va.jsx)(mh,{}),children:(0,va.jsx)(Z9,{children:r})});case"embed":return(0,va.jsx)(s3,{children:r});default:return(0,va.jsx)(El.Suspense,{fallback:(0,va.jsx)(mh,{}),children:(0,va.jsx)(_2,{lang:o,children:r})})}}return(0,va.jsx)(El.Suspense,{fallback:(0,va.jsx)(mh,{}),children:(0,va.jsx)(_2,{lang:o,children:r})})};var FC=I(H()),d1=e=>t=>{if(!t)return null;let{className:r,children:o}=t,a;if(typeof o=="string"?a=o:Array.isArray(o)&&(a=o.join("")),!a)return(0,FC.jsx)(e,{component_key:r,data:void 0});let n;try{n=JSON.parse(a)}catch{n=a}return(0,FC.jsx)(e,{component_key:r,data:n})};var u1=I(ie());var im=I(H()),c3=({data:e})=>{if(!e)return null;if(!ME(e))return(0,im.jsx)(im.Fragment,{children:e});let t=Yt(),{threadId:r,assistantId:o}=ns()??{},{config:a}=Rt(),n=(0,u1.useMemo)(()=>!a?.baseURL||!o||!r?null:`${a.baseURL}/api/assistants/${o}/threads/${r}/sandbox/downloadfile`,[a?.baseURL,o,r]),i=(0,u1.useCallback)(s=>{if(!n)return;let l=new URLSearchParams({path:s}),c=`${n}?${l.toString()}`;t({component_key:"attachments",data:{file_id:s,message:"\u9884\u89C8\uFF1A"+s.split("/").pop(),full_url:c,download_url:c},message:"\u9884\u89C8\uFF1A"+s.split("/").pop()})},[n,t]);return n?(0,im.jsx)(ge,{type:"link",size:"small",onClick:()=>i(e),children:e}):(0,im.jsx)("span",{children:e})};var sm=I(ie());var DC=I(H()),Q9=/\/api\/web-apps\/[^/]+\/runtime$/,d3=({data:e})=>{if(e==null)return null;let t=typeof e=="string"?e:String(e??"");if(t.length===0)return null;let r=Yt(),{threadId:o,assistantId:a}=ns()??{},{config:n}=Rt(),i=(0,sm.useContext)(si),s=(0,sm.useMemo)(()=>{if(i?.workspaceId&&i?.projectId){let p=i.getFileViewUrl(t,a||void 0),m=i.getFileDownloadUrl(t,a||void 0);if(p&&m)return{fullUrl:p,downloadUrl:m}}if(!n?.baseURL)return null;let c=new URLSearchParams({path:t});if(Q9.test(n.baseURL)){let p=n.baseURL.replace(/\/$/,"");return{fullUrl:`${p}/files/viewfile?${c.toString()}`,downloadUrl:`${p}/files/downloadfile?${c.toString()}`}}if(!a||!o)return null;let u=`${n.baseURL}/api/assistants/${a}/threads/${o}/sandbox/downloadfile?${c.toString()}`;return{fullUrl:u,downloadUrl:u}},[i,n?.baseURL,a,o,t]),l=(0,sm.useCallback)(()=>{if(!s)return;let c=t.split("/").pop()??t;r({component_key:"attachments",data:{file_id:t,message:`\u9884\u89C8\uFF1A${c}`,full_url:s.fullUrl,download_url:s.downloadUrl},message:`\u9884\u89C8\uFF1A${c}`})},[s,t,r]);return s?(0,DC.jsx)(ge,{type:"link",size:"small",onClick:l,children:t}):(0,DC.jsx)("span",{children:t})};var u3=I(ie());var p3=I(H()),eU=e=>{if(!e||!e.children)return null;let t=[],r=[],o=e.children.find(n=>n.name==="thead"),a=e.children.find(n=>n.name==="tbody");if(o&&o.children){let n=o.children.find(i=>i.name==="tr");n&&n.children&&n.children.forEach(i=>{if(i.name==="th"&&i.children){let s=i.children.map(l=>l.type==="text"?l.data:l.children?l.children.map(c=>c.type==="text"?c.data:"").join(""):"").join("").trim();t.push(s)}})}if(a&&a.children&&a.children.forEach(n=>{if(n.name==="tr"&&n.children){let i={},s=0;n.children.forEach(l=>{if(l.name==="td"&&s<t.length){let c=l.children.map(p=>p.type==="text"?p.data:p.children?p.children.map(m=>m.type==="text"?m.data:"").join(""):"").join("").trim(),u=t[s]||`col_${s}`;i[u]=c,s++}}),Object.keys(i).length>0&&r.push(i)}}),t.length===0&&r.length>0){let n=r[0];return{headers:Object.keys(n),dataSource:r}}return{headers:t,dataSource:r}},f3=e=>{let{domNode:t}=e,r=(0,u3.useMemo)(()=>eU(t),[t]);return!r||r.dataSource.length===0?null:(0,p3.jsx)(Ql,{component_key:"markdown_table",data:{dataSource:r.dataSource,message:""},interactive:!0,default_open_in_side_app:!0})};var tU=d1(Ql),rU=d1(c3),oU=d1(d3),m3={code:l3,file:rU,filelink:oU,genericdatatable:tU,table:f3};var BC="\uE000",aU=new Set(["code","codespan","html","table","def","hr","link","image","autolink","url","escape"]),y3="[A-Za-z0-9_.\\-~\\u4e00-\\u9fff]",nU=new RegExp(`^${y3}$`),g3=["project","agent","root"];function h3(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function iU(e){return Array.isArray(e.items)&&e.items.length>0?e.items:Array.isArray(e.tokens)&&e.tokens.length>0?e.tokens:null}function x3(e,t,r,o){let a=r.start;for(let n of t){let i=n.raw??"";if(i.length===0)continue;let s=e.indexOf(i,a);if(s<r.start||s+i.length>r.end){o.push({start:a,end:r.end});return}if(aU.has(n.type))o.push({start:s,end:s+i.length});else{let l=iU(n);l&&x3(e,l,{start:s,end:s+i.length},o)}a=s+i.length}}function v3(e,t){if(typeof e!="string"||e.length===0||e.includes(BC))return e;let r=(t?.volumes&&t.volumes.length>0?t.volumes:g3).map(g=>g.replace(/^\/+|\/+$/g,"")).filter(g=>g.length>0).map(h3);r.length===0&&(r=g3.map(h3));let o;try{o=sT(e)}catch{return e}let a=[];x3(e,o,{start:0,end:e.length},a);let n=[],i="",s=0;for(let g of a)i+=e.slice(s,g.start)+BC,n.push(e.slice(g.start,g.end)),s=g.end;i+=e.slice(s);let l=new RegExp(`(?<![A-Za-z0-9_:/.])/(?:${r.join("|")})(?:/${y3}+)+`,"g"),c="",u=0,p=!1,m;for(;(m=l.exec(i))!==null;){let g=i[l.lastIndex];if(g!==void 0&&nU.test(g))continue;let x=m[0].replace(/\.+$/,"");x!==m[0]&&!x.includes("/")||(c+=i.slice(u,m.index),c+=`<filelink>${x}</filelink>`,u=l.lastIndex,p=!0)}if(!p)return e;c+=i.slice(u);let f=c.split(BC),y="";for(let g=0;g<f.length;g+=1)y+=f[g],g<n.length&&(y+=n[g]);return y}var af=I(H()),sU=m3,lU=Le(({token:e,css:t})=>({markdownContainer:t`
6621
6621
  white-space: normal;
6622
6622
 
6623
6623
  h1,
@@ -1,4 +1,4 @@
1
- import{b as f}from"./embed-page-chunk-EXCJ42IB.js";import"./embed-page-chunk-U276WBDI.js";import"./embed-page-chunk-HEMNMC4X.js";import{a as b}from"./embed-page-chunk-MB65DZAX.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-5JDQ456X.js";import"./embed-page-chunk-Z7USDLHI.js";import{a as g}from"./embed-page-chunk-O4QK5LWZ.js";import"./embed-page-chunk-4BKXE5ON.js";import"./embed-page-chunk-IX4WLWCY.js";import"./embed-page-chunk-EUOOO2LS.js";import{b as U,e as s}from"./embed-page-chunk-6Y3UYJ6Z.js";var h=U(d=>{"use strict";var E=g();d.createRoot=E.createRoot,d.hydrateRoot=E.hydrateRoot;var ee});var T=s(h()),k=s(g());var y="axiom-web-app-embed";var x=["axiom:hello","axiom:identity","axiom:send","axiom:config"];function w(e,t){return{source:y,version:1,type:e,payload:t}}var N=6,z=40,B=500;function H(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=Object.keys(t);return n.length!==2||!n.includes("label")||!n.includes("text")?!1:typeof t.label=="string"&&t.label.length>=1&&t.label.length<=z&&typeof t.text=="string"&&t.text.length>=1&&t.text.length<=B}function Q(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(t.length>=N)break;H(n)&&t.push({label:n.label,text:n.text})}return t}function _(e){if(typeof e!="object"||e===null)return null;let t=e,n={};if(typeof t.welcome=="string"&&t.welcome.length>0&&(n.welcome=t.welcome),Array.isArray(t.quicks)){let r=Q(t.quicks);(r.length>0||t.quicks.length===0)&&(n.quicks=r)}return n.welcome===void 0&&n.quicks===void 0?null:n}function R(e,t){if(typeof e!="object"||e===null)return null;let n=e;return n.source!==y||n.version!==1||typeof n.type!="string"||!t.includes(n.type)?null:{type:n.type,payload:n.payload}}var p=s(b()),P=/^[A-Za-z0-9._:@-]{1,128}$/,q="Open this chat from the host page embed to start chatting.",v="axiom-embed-root",C="axiom-embed-style",A=32768,G=`
1
+ import{b as f}from"./embed-page-chunk-OHDEKFTU.js";import"./embed-page-chunk-XIXSRYJY.js";import"./embed-page-chunk-HEMNMC4X.js";import{a as b}from"./embed-page-chunk-MB65DZAX.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-5JDQ456X.js";import"./embed-page-chunk-Z7USDLHI.js";import{a as g}from"./embed-page-chunk-O4QK5LWZ.js";import"./embed-page-chunk-4BKXE5ON.js";import"./embed-page-chunk-IX4WLWCY.js";import"./embed-page-chunk-EUOOO2LS.js";import{b as U,e as s}from"./embed-page-chunk-6Y3UYJ6Z.js";var h=U(d=>{"use strict";var E=g();d.createRoot=E.createRoot,d.hydrateRoot=E.hydrateRoot;var ee});var T=s(h()),k=s(g());var y="axiom-web-app-embed";var x=["axiom:hello","axiom:identity","axiom:send","axiom:config"];function w(e,t){return{source:y,version:1,type:e,payload:t}}var N=6,z=40,B=500;function H(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=Object.keys(t);return n.length!==2||!n.includes("label")||!n.includes("text")?!1:typeof t.label=="string"&&t.label.length>=1&&t.label.length<=z&&typeof t.text=="string"&&t.text.length>=1&&t.text.length<=B}function Q(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(t.length>=N)break;H(n)&&t.push({label:n.label,text:n.text})}return t}function _(e){if(typeof e!="object"||e===null)return null;let t=e,n={};if(typeof t.welcome=="string"&&t.welcome.length>0&&(n.welcome=t.welcome),Array.isArray(t.quicks)){let r=Q(t.quicks);(r.length>0||t.quicks.length===0)&&(n.quicks=r)}return n.welcome===void 0&&n.quicks===void 0?null:n}function R(e,t){if(typeof e!="object"||e===null)return null;let n=e;return n.source!==y||n.version!==1||typeof n.type!="string"||!t.includes(n.type)?null:{type:n.type,payload:n.payload}}var p=s(b()),P=/^[A-Za-z0-9._:@-]{1,128}$/,q="Open this chat from the host page embed to start chatting.",v="axiom-embed-root",C="axiom-embed-style",A=32768,G=`
2
2
  html, body, #${v} { height: 100%; margin: 0; }
3
3
  .axiom-embed-fill { height: 100% !important; min-height: 0 !important; }
4
4
  .axiom-embed-card { display: flex; align-items: center; justify-content: center; height: 100%; margin: 0; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: #64748b; padding: 24px; box-sizing: border-box; text-align: center; }
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as http from 'http';
2
- import { ProjectRoomMessage, ProjectBotMembership, ProjectMembership, TaskItem, ChannelAdapter, InboundMessage, Binding, BindingRegistry, ChannelInstallationStore, DispatchResult, ProjectRoomEventScope, ProjectRoomBusinessEventDraft, ProjectRoomScopedBusinessEvent, ProjectRoomBusinessEvent, ProjectRoomEventSubscription, TaskStore, ProjectRoomStore, ProjectBotMembershipStore, ThreadStore, ProjectRoom, Thread, ProjectStore, LoggerType, PinoFileOptions } from '@axiom-lattice/protocols';
3
- import { TrustedAgentMessageDispatcher, TrustedMessageOptions, TaskLifecycleListener, TaskLifecycleService, IMessageQueueStore, Agent } from '@axiom-lattice/core';
2
+ import { ProjectRoomMessage, ProjectBotMembership, ProjectMembership, TaskItem, ChannelAdapter, InboundMessage, Binding, BindingRegistry, ChannelInstallationStore, DispatchResult, ProjectRoomEventScope, ProjectRoomBusinessEventDraft, ProjectRoomScopedBusinessEvent, ProjectRoomBusinessEvent, ProjectRoomEventSubscription, TaskStore, ProjectRoomStore, ProjectBotMembershipStore, ThreadStore, ProjectRoom, Thread, ProjectStore, TaskWorkItemStore, TenantStore, LoggerType, PinoFileOptions } from '@axiom-lattice/protocols';
3
+ import { TrustedAgentMessageDispatcher, TrustedMessageOptions, TaskLifecycleListener, TaskLifecycleService, IMessageQueueStore, Agent, TaskRunRegistry } from '@axiom-lattice/core';
4
4
  import * as fastify from 'fastify';
5
5
 
6
6
  /** Public publisher surface for committed Project Room business facts. */
@@ -764,6 +764,229 @@ declare class AgentTaskConsumer {
764
764
  trigger_agent_task(taskRequest: AgentTaskRequest): void;
765
765
  }
766
766
 
767
+ /** Minimal caller-graph client surface used by recovery. */
768
+ interface RecoveryCallerClient {
769
+ getState(config: unknown): Promise<unknown>;
770
+ updateState(config: unknown, values: unknown, asNode?: string): Promise<unknown>;
771
+ invoke(input: unknown, config: unknown): Promise<unknown>;
772
+ }
773
+ interface TopCallerRecoveryDeps {
774
+ /**
775
+ * Resolve a caller's agent client + config from the resolved top caller.
776
+ *
777
+ * @param top The resolved top-level caller thread + assistant.
778
+ * @param tenantId The orphan task's tenant, used to scope the caller client.
779
+ */
780
+ callerFor(top: {
781
+ threadId: string;
782
+ assistantId?: string;
783
+ }, tenantId: string): Promise<{
784
+ client: RecoveryCallerClient;
785
+ config: unknown;
786
+ agent?: unknown;
787
+ } | undefined>;
788
+ /** Live-run registry (defaults to the shared Core singleton). */
789
+ registry?: {
790
+ isLive(taskId: string): boolean;
791
+ };
792
+ /** Resume the continuation (tests can call client.invoke(null, config)). */
793
+ resume(client: RecoveryCallerClient, config: unknown, agent?: unknown): Promise<void>;
794
+ }
795
+ /** Dependencies for an on-demand single-task recovery ({@link recoverTask}). */
796
+ interface RecoverTaskDeps {
797
+ /** Lifecycle used to converge the orphan to `failed(no_executor)`. */
798
+ lifecycle: Pick<TaskLifecycleService, "failTask">;
799
+ /** Live-run registry (defaults to the shared Core singleton). */
800
+ registry?: TaskRunRegistry;
801
+ /**
802
+ * The tenant's other orphan candidates (normally every `in_progress` task),
803
+ * used to walk the caller chain up to the true top-level caller.
804
+ *
805
+ * @remarks
806
+ * Without this set {@link resolveTopCaller} can only see the target itself,
807
+ * so a nested middle run would be mistaken for a direct child of its
808
+ * immediate (frozen) caller. Defaults to `[converged]` when omitted.
809
+ */
810
+ orphans?: TaskItem[];
811
+ /** Resolve a caller's agent client + config from the resolved top caller. */
812
+ callerFor: TopCallerRecoveryDeps["callerFor"];
813
+ /** Resume the continuation (tests can call client.invoke(null, config)). */
814
+ resume: TopCallerRecoveryDeps["resume"];
815
+ }
816
+ /**
817
+ * Outcome of an on-demand single-task recovery attempt.
818
+ *
819
+ * @remarks
820
+ * - `recovered`: the task was converged and its top-level caller was resumed.
821
+ * - `skipped`: nothing was changed; `reason` names the guard (for example
822
+ * `not_in_progress`, `live`, `middle`, `project_task`, `no_top_caller`,
823
+ * `not_found`).
824
+ * - `converged_no_call`: the task was converged to `failed`, but the caller had
825
+ * no pending `task` call left to resolve, so no continuation was resumed.
826
+ */
827
+ type RecoverTaskResult = {
828
+ kind: "recovered";
829
+ } | {
830
+ kind: "skipped";
831
+ reason: string;
832
+ } | {
833
+ kind: "converged_no_call";
834
+ };
835
+ /**
836
+ * Backfills one converged direct-child task's top-level caller.
837
+ *
838
+ * @param task The converged orphan task (must carry `context.caller_thread_id`).
839
+ * @param top The resolved top-level caller.
840
+ * @param deps Caller resolver, live-run registry, and resume hook.
841
+ * @returns `"recovered"` or a `"skipped:<reason>"` string.
842
+ */
843
+ declare function recoverTopCaller(task: TaskItem, top: {
844
+ threadId: string;
845
+ assistantId?: string;
846
+ }, deps: TopCallerRecoveryDeps): Promise<string>;
847
+ /**
848
+ * Recovers a single orphan task on demand, reusing the collapse logic.
849
+ *
850
+ * @param task The candidate task (any status).
851
+ * @param deps Lifecycle, live-run registry, orphan candidate set (for the
852
+ * caller-chain walk), caller resolver, and resume hook.
853
+ * @returns A discriminated outcome: `recovered`, `skipped:<reason>`, or
854
+ * `converged_no_call` when the task was converged but the caller had no
855
+ * pending `task` call to resolve.
856
+ * @remarks
857
+ * Mirrors {@link runOrphanRecovery} for exactly one task: anything not
858
+ * `in_progress`, or still held by a live run, is skipped; the rest is converged
859
+ * to `failed` (`no_executor`, ADR-143) and its **top-level** caller is
860
+ * backfilled. `deps.orphans` must carry the tenant's other `in_progress`
861
+ * candidates so a nested middle run is correctly skipped (`middle`) instead of
862
+ * being mistaken for a direct child of its frozen immediate caller.
863
+ *
864
+ * This is an **offline/maintenance** entry point (the `task:recover` CLI): run
865
+ * it when the Gateway is stopped, or from within the Gateway process. The
866
+ * `live` guard reads the process-local {@link taskRunRegistry}, so it is
867
+ * meaningful only in-process and cannot detect a run held by another process.
868
+ *
869
+ * The convergence actor is `system:on-demand-recovery` (distinct from the
870
+ * startup sweep's `system:orphan-recovery`), so on-demand convergences are
871
+ * auditable in the task work-item trail. No HTTP route is added and recovery
872
+ * semantics are unchanged.
873
+ */
874
+ declare function recoverTask(task: TaskItem, deps: RecoverTaskDeps): Promise<RecoverTaskResult>;
875
+ /** Walks caller links up to the thread that is not any orphan's run thread. */
876
+ declare function resolveTopCaller(task: TaskItem, orphans: TaskItem[]): {
877
+ threadId: string;
878
+ assistantId?: string;
879
+ } | undefined;
880
+ /**
881
+ * Runs the whole collapse recovery once: reconcile orphan tasks, then backfill
882
+ * the top-level caller of every direct-child orphan, grouped per top caller.
883
+ * Best-effort; a failing group is contained and never aborts the others.
884
+ *
885
+ * @param deps Reconcile source, caller resolution, resume, and logger.
886
+ * @returns The recovered and skipped `taskId:reason` entries.
887
+ */
888
+ declare function runOrphanRecovery(deps: {
889
+ reconcile: () => Promise<{
890
+ convergedTasks: TaskItem[];
891
+ }>;
892
+ callerFor: TopCallerRecoveryDeps["callerFor"];
893
+ resume: TopCallerRecoveryDeps["resume"];
894
+ log: {
895
+ info(msg: string, ctx: Record<string, unknown>): void;
896
+ warn(msg: string, ctx: Record<string, unknown>): void;
897
+ };
898
+ }): Promise<{
899
+ recovered: string[];
900
+ skipped: string[];
901
+ }>;
902
+
903
+ /**
904
+ * Shared orphan-recovery runtime: the startup sweep and the on-demand
905
+ * single-task entry point share one dependency shape and one lifecycle.
906
+ *
907
+ * @remarks
908
+ * `recoverAll()` is the behavior-preserving move of the gateway startup block
909
+ * (reconcile every tenant's orphaned ordinary tasks, then backfill the
910
+ * top-level caller). `recoverTask()` is the A-lite on-demand entry: no HTTP
911
+ * route, just a programmatic call used by the `task:recover` CLI/script.
912
+ */
913
+
914
+ /** Dependencies shared by the startup sweep and the single-task entry. */
915
+ interface OrphanRecoveryRuntimeDeps {
916
+ /** Task store used to enumerate tenants' orphans and read one task by id. */
917
+ taskStore: TaskStore;
918
+ /** Work-item store used to build the lifecycle when `lifecycle` is omitted. */
919
+ workItemStore: TaskWorkItemStore;
920
+ /** Tenant store supplying `getAllTenants()` for the startup sweep. */
921
+ tenantStore: Pick<TenantStore, "getAllTenants">;
922
+ /** Lifecycle used to converge orphans (built from the stores when omitted). */
923
+ lifecycle?: Pick<TaskLifecycleService, "failTask">;
924
+ /** Resolve a caller's agent client + config from the resolved top caller. */
925
+ callerFor: TopCallerRecoveryDeps["callerFor"];
926
+ /** Resume the continuation (tests can call client.invoke(null, config)). */
927
+ resume: TopCallerRecoveryDeps["resume"];
928
+ /** Structured logger. */
929
+ log: {
930
+ info(msg: string, ctx: Record<string, unknown>): void;
931
+ warn(msg: string, ctx: Record<string, unknown>): void;
932
+ };
933
+ }
934
+ /** Entry points returned by {@link createOrphanRecoveryRuntime}. */
935
+ interface OrphanRecoveryRuntime {
936
+ /** Startup/interval sweep over every tenant's orphaned ordinary tasks. */
937
+ recoverAll(): Promise<{
938
+ recovered: string[];
939
+ skipped: string[];
940
+ }>;
941
+ /**
942
+ * On-demand recovery of exactly one task within one tenant.
943
+ *
944
+ * @remarks Offline/maintenance: run when the Gateway is stopped, or from the
945
+ * Gateway process. The `live` guard reads the process-local task registry and
946
+ * cannot see a run held by another process. Governed Project tasks are refused
947
+ * (`skipped:project_task`) so this never bypasses their managed runtime.
948
+ */
949
+ recoverTask(input: {
950
+ tenantId: string;
951
+ taskId: string;
952
+ }): Promise<RecoverTaskResult>;
953
+ }
954
+ /**
955
+ * Builds the shared orphan-recovery runtime.
956
+ *
957
+ * @param deps Task/work-item/tenant stores, optional lifecycle, caller
958
+ * resolver, resume hook, and logger.
959
+ * @returns `recoverAll()` (startup sweep) and `recoverTask()` (on-demand).
960
+ * @remarks
961
+ * Governed Project tasks are excluded from `recoverAll()` (they have their own
962
+ * observer-based reconciliation) and from `recoverTask()`
963
+ * (`skipped:project_task`), so the on-demand entry can never bypass the managed
964
+ * Project runtime. `recoverTask()` delegates to {@link recoverSingleTask} with
965
+ * the shared lifecycle and the process-local live-run registry, so it never
966
+ * converges a task a live run still holds — in-process only.
967
+ *
968
+ * @example
969
+ * ```ts
970
+ * const runtime = createOrphanRecoveryRuntime({ taskStore, workItemStore, tenantStore, callerFor, resume, log });
971
+ * await runtime.recoverAll();
972
+ * const outcome = await runtime.recoverTask({ tenantId, taskId });
973
+ * ```
974
+ */
975
+ declare function createOrphanRecoveryRuntime(deps: OrphanRecoveryRuntimeDeps): OrphanRecoveryRuntime;
976
+
977
+ /**
978
+ * Builds the caller-resolution and resume hooks used by orphan recovery.
979
+ *
980
+ * @returns `callerFor` (resolves a top caller's agent client + config, omitting
981
+ * the in-memory `agent` when it is absent) and `resume` (prefers
982
+ * `agent.resumeTask()`, otherwise a raw checkpoint continuation via
983
+ * `client.invoke(null, config)`).
984
+ * @remarks
985
+ * `callerFor` uses `getAgentClientAsync` (falls back to `getAgentClient`) so a
986
+ * DB-backed assistant that is not resident in memory can still be loaded.
987
+ */
988
+ declare function createRecoveryCallerDeps(): Pick<TopCallerRecoveryDeps, "callerFor" | "resume">;
989
+
767
990
  /**
768
991
  * Logger configuration for gateway
769
992
  */
@@ -794,4 +1017,4 @@ declare const LatticeGateway: {
794
1017
  AgentTaskConsumer: typeof AgentTaskConsumer;
795
1018
  };
796
1019
 
797
- export { type GatewayLoggerConfig, LatticeGateway, type LatticeGatewayConfig };
1020
+ export { type GatewayLoggerConfig, LatticeGateway, type LatticeGatewayConfig, type OrphanRecoveryRuntime, type OrphanRecoveryRuntimeDeps, type RecoverTaskDeps, type RecoverTaskResult, createOrphanRecoveryRuntime, createRecoveryCallerDeps, recoverTask, recoverTopCaller, resolveTopCaller, runOrphanRecovery };