@openork/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dev.js +3 -0
- package/bin/run.js +3 -0
- package/dist/commands/gateway/start.d.ts +14 -0
- package/dist/commands/gateway/start.d.ts.map +1 -0
- package/dist/commands/gateway/start.js +120 -0
- package/dist/commands/gateway/start.js.map +1 -0
- package/dist/commands/gateway/stop.d.ts +7 -0
- package/dist/commands/gateway/stop.d.ts.map +1 -0
- package/dist/commands/gateway/stop.js +33 -0
- package/dist/commands/gateway/stop.js.map +1 -0
- package/dist/commands/setup.d.ts +7 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +86 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/setup.spec.d.ts +2 -0
- package/dist/commands/setup.spec.d.ts.map +1 -0
- package/dist/commands/setup.spec.js +88 -0
- package/dist/commands/setup.spec.js.map +1 -0
- package/dist/commands/uninstall.d.ts +10 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +71 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/gateway.d.ts +19 -0
- package/dist/lib/gateway.d.ts.map +1 -0
- package/dist/lib/gateway.js +52 -0
- package/dist/lib/gateway.js.map +1 -0
- package/dist/lib/shell-profile.d.ts +10 -0
- package/dist/lib/shell-profile.d.ts.map +1 -0
- package/dist/lib/shell-profile.js +56 -0
- package/dist/lib/shell-profile.js.map +1 -0
- package/dist/migrations/0001-add-memory-enabled.js +42 -0
- package/dist/migrations/lib/helpers.js +78 -0
- package/dist/migrations/lib/template.js +8 -0
- package/dist/openapi.yml +5648 -0
- package/dist/prisma/migrations/20260318152538_add_trigger_type_and_source_workflow/migration.sql +79 -0
- package/dist/prisma/migrations/20260318154232_drop_skill_and_emit_from_action/migration.sql +25 -0
- package/dist/prisma/migrations/20260318160029_action_types_cli_bash_node_http/migration.sql +29 -0
- package/dist/prisma/migrations/migration_lock.toml +3 -0
- package/dist/prisma/schema.prisma +236 -0
- package/dist/server.js +182527 -0
- package/dist/server.js.map +1 -0
- package/dist/web/assets/activity-feed-D_eonDKG.js +1 -0
- package/dist/web/assets/agent-edit-CblZItU5.js +98 -0
- package/dist/web/assets/agent-sessions-COpCcffa.js +1 -0
- package/dist/web/assets/agent-use-F4pOt3KJ.js +1 -0
- package/dist/web/assets/agents-Av7w2wHE.js +1 -0
- package/dist/web/assets/api-docs-BQzn4-6U.js +1 -0
- package/dist/web/assets/arrow-down-XHN5PD1k.js +1 -0
- package/dist/web/assets/arrow-left-wtNmm6Le.js +1 -0
- package/dist/web/assets/bi-gM8sIAZV.js +1 -0
- package/dist/web/assets/chat-CQvfLy7Y.js +4 -0
- package/dist/web/assets/chat-input-BepRPV_L.js +2 -0
- package/dist/web/assets/chat-message-CbcDeDcb.js +37 -0
- package/dist/web/assets/chat-new-BOtDuYij.js +1 -0
- package/dist/web/assets/chat-sessions-CaCaK_PC.js +1 -0
- package/dist/web/assets/chats-64IReeGV.js +1 -0
- package/dist/web/assets/circle-alert-W8QX9LOG.js +1 -0
- package/dist/web/assets/circle-check-DLl9fl65.js +1 -0
- package/dist/web/assets/circle-x-D_8Tcgt1.js +1 -0
- package/dist/web/assets/code-Brz4KHlI.js +1 -0
- package/dist/web/assets/code-editor-x9L6nkh4.js +1 -0
- package/dist/web/assets/commands-DT9K8bae.js +8 -0
- package/dist/web/assets/copy-C87mjn_Y.js +1 -0
- package/dist/web/assets/credentials-DC-HOVxW.js +1 -0
- package/dist/web/assets/cron-COUPKvGu.js +1 -0
- package/dist/web/assets/crown-BJEsQkh4.js +1 -0
- package/dist/web/assets/dashboard-OfnNUjFX.js +1 -0
- package/dist/web/assets/database-BohjTljV.js +1 -0
- package/dist/web/assets/debug-Et9rgBM8.js +1 -0
- package/dist/web/assets/download-B2UOiYAS.js +1 -0
- package/dist/web/assets/eye-DN-Km5vf.js +1 -0
- package/dist/web/assets/file-plus-B8qWemgt.js +1 -0
- package/dist/web/assets/file-tree-DkLQ1z0I.js +1 -0
- package/dist/web/assets/folder-plus-DsmP6Mur.js +1 -0
- package/dist/web/assets/geist-cyrillic-wght-normal-CHSlOQsW.woff2 +0 -0
- package/dist/web/assets/geist-latin-ext-wght-normal-DMtmJ5ZE.woff2 +0 -0
- package/dist/web/assets/geist-latin-wght-normal-Dm3htQBi.woff2 +0 -0
- package/dist/web/assets/globe-fwFSeXZn.js +1 -0
- package/dist/web/assets/grip-vertical-Djo-yR-o.js +1 -0
- package/dist/web/assets/history-CyBBboEp.js +1 -0
- package/dist/web/assets/index-YgjFlLLv.css +2 -0
- package/dist/web/assets/index-dc8HGqTp.js +2 -0
- package/dist/web/assets/layers-ephyCrDm.js +1 -0
- package/dist/web/assets/layout-grid-DCVGg8ZA.js +1 -0
- package/dist/web/assets/mcp-setup-BfMdYdsI.js +17 -0
- package/dist/web/assets/memory-DAQ474-p.js +1 -0
- package/dist/web/assets/new-chat-DtMw6FMg.js +1 -0
- package/dist/web/assets/play-DXJMtO-K.js +1 -0
- package/dist/web/assets/refresh-cw-RFYUf5GB.js +1 -0
- package/dist/web/assets/rolldown-runtime-Dw2cE7zH.js +1 -0
- package/dist/web/assets/save-Dewm93H6.js +1 -0
- package/dist/web/assets/search-Ww0msJQz.js +1 -0
- package/dist/web/assets/send-FWvygYFQ.js +1 -0
- package/dist/web/assets/settings-Auyn4Z5T.js +1 -0
- package/dist/web/assets/shield-check-Dt7sXtBF.js +1 -0
- package/dist/web/assets/shuffle-DjvBJ7XV.js +1 -0
- package/dist/web/assets/src-DUhGoAQb.js +24 -0
- package/dist/web/assets/team-edit-DO-RX3lC.js +1 -0
- package/dist/web/assets/team-sessions-DSw8MTtZ.js +1 -0
- package/dist/web/assets/team-use-BfNvsFcO.js +3 -0
- package/dist/web/assets/terminal-CIapYonS.js +1 -0
- package/dist/web/assets/timer-C9X20mTO.js +1 -0
- package/dist/web/assets/useMutation-BlOHt3MR.js +1 -0
- package/dist/web/assets/useQuery-DvovkaPT.js +1 -0
- package/dist/web/assets/utils-DHTPP40O.js +1 -0
- package/dist/web/assets/vendor-editor-BORFA-rZ.js +39 -0
- package/dist/web/assets/vendor-react-BJ8SIkmN.js +11 -0
- package/dist/web/assets/vendor-ui-CHpVij2M.css +1 -0
- package/dist/web/assets/vendor-ui-Dpw9mBc-.js +39 -0
- package/dist/web/assets/workflow-edit-D0FNyl64.js +4 -0
- package/dist/web/assets/workflow-runs-CPVvaVzN.js +1 -0
- package/dist/web/assets/workflows-C9jurJiE.js +1 -0
- package/dist/web/assets/wrench-DZBtSPP8.js +1 -0
- package/dist/web/assets/zap-CbT5plGA.js +1 -0
- package/dist/web/docs.html +242 -0
- package/dist/web/favicon.svg +13 -0
- package/dist/web/index.html +23 -0
- package/package.json +65 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{h as t,l as n,t as r,u as i}from"./vendor-react-BJ8SIkmN.js";import{r as a,t as o}from"./useQuery-DvovkaPT.js";import{t as s}from"./useMutation-BlOHt3MR.js";import{K as c,U as l,V as u,_ as d,f,g as p,h as m,j as h,m as g,q as _,v,w as y,y as b}from"./src-DUhGoAQb.js";import{C as ee,S as x,_ as S,b as te,g as C,h as ne,m as w,p as re,v as ie,w as ae,x as T,y as oe}from"./vendor-ui-Dpw9mBc-.js";import{t as se}from"./arrow-left-wtNmm6Le.js";import{n as E,r as D,t as O}from"./shuffle-DjvBJ7XV.js";import{t as k}from"./crown-BJEsQkh4.js";import{t as A}from"./grip-vertical-Djo-yR-o.js";import{t as ce}from"./layout-grid-DCVGg8ZA.js";import{t as le}from"./save-Dewm93H6.js";import"./utils-DHTPP40O.js";import{D as ue,I as de,k as fe,m as pe,n as j,r as M,t as N,w as P}from"./index-dc8HGqTp.js";var F=e(t(),1),I=r(),me={sequential:{icon:D,label:`Sequential`,description:`Agents run one after another`},parallel:{icon:E,label:`Parallel`,description:`All agents run simultaneously`},router:{icon:O,label:`Router`,description:`A router agent decides who handles the task`},debate:{icon:de,label:`Debate`,description:`Agents discuss and reach consensus`}},L=(0,F.memo)(function({data:e,selected:t}){let n=e.agent;return(0,I.jsxs)(`div`,{className:c(`rounded-lg border-2 min-w-[220px] max-w-[280px] transition-all duration-150`,e.isRouter?`border-amber-500/50 bg-amber-500/5`:`border-violet-500/50 bg-violet-500/5`,t&&`ring-2 ring-primary ring-offset-1 ring-offset-background`),children:[(0,I.jsx)(S,{type:`target`,position:x.Top,id:`top-in`,className:`!bg-transparent !border-orange-400`,style:{left:`35%`,width:12,height:6,borderRadius:`6px 6px 0 0`,borderWidth:2,borderBottomWidth:0,transform:`translate(-50%, 0)`,top:-6}}),(0,I.jsx)(S,{type:`source`,position:x.Top,id:`top-out`,className:`!bg-sky-400 !border-0`,style:{left:`65%`,width:12,height:6,borderRadius:`6px 6px 0 0`,transform:`translate(-50%, 0)`,top:-6}}),(0,I.jsx)(S,{type:`target`,position:x.Left,id:`left-in`,className:`!bg-transparent !border-orange-400`,style:{top:`35%`,width:6,height:12,borderRadius:`6px 0 0 6px`,borderWidth:2,borderRightWidth:0,transform:`translate(0, -50%)`,left:-6}}),(0,I.jsx)(S,{type:`source`,position:x.Left,id:`left-out`,className:`!bg-sky-400 !border-0`,style:{top:`65%`,width:6,height:12,borderRadius:`6px 0 0 6px`,transform:`translate(0, -50%)`,left:-6}}),(0,I.jsx)(S,{type:`source`,position:x.Right,id:`right-out`,className:`!bg-sky-400 !border-0`,style:{top:`35%`,width:6,height:12,borderRadius:`0 6px 6px 0`,transform:`translate(0, -50%)`,right:-6,left:`auto`}}),(0,I.jsx)(S,{type:`target`,position:x.Right,id:`right-in`,className:`!bg-transparent !border-orange-400`,style:{top:`65%`,width:6,height:12,borderRadius:`0 6px 6px 0`,borderWidth:2,borderLeftWidth:0,transform:`translate(0, -50%)`,right:-6,left:`auto`}}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-3 border-b border-border/50`,children:[(0,I.jsx)(A,{className:`h-3.5 w-3.5 text-muted-foreground/50 shrink-0 cursor-grab`}),(0,I.jsx)(`span`,{className:`text-2xl`,children:n?.avatar??`?`}),(0,I.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,I.jsx)(`div`,{className:`text-sm font-medium truncate`,children:n?.name??`Unknown Agent`}),(0,I.jsxs)(`div`,{className:`text-[10px] text-muted-foreground flex items-center gap-1`,children:[n?.runtime===`cli`&&n.cli&&(0,F.createElement)(j(n.cli),{className:`h-2.5 w-2.5`}),n?.runtime===`cli`?M(n.cli??void 0):`API`]})]}),e.isRouter&&(0,I.jsx)(k,{className:`h-4 w-4 text-amber-500 shrink-0`})]}),(0,I.jsxs)(`div`,{className:`px-3 py-2`,children:[(0,I.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Role: `}),(0,I.jsx)(`span`,{className:c(`text-[11px] font-medium`,e.role?`text-primary/80`:`text-muted-foreground/50 italic`),children:e.role||`N/A`})]}),(0,I.jsx)(S,{type:`source`,position:x.Bottom,id:`bottom-out`,className:`!bg-sky-400 !border-0`,style:{left:`35%`,width:12,height:6,borderRadius:`0 0 6px 6px`,transform:`translate(-50%, 0)`,bottom:-6,top:`auto`}}),(0,I.jsx)(S,{type:`target`,position:x.Bottom,id:`bottom-in`,className:`!bg-transparent !border-orange-400`,style:{left:`65%`,width:12,height:6,borderRadius:`0 0 6px 6px`,borderWidth:2,borderTopWidth:0,transform:`translate(-50%, 0)`,bottom:-6,top:`auto`}})]})});function R({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o,style:s,markerEnd:c,data:l}){let u=l?.hovered??!1,[d,f,p]=ae({sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o});return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(w,{path:d,markerEnd:c,style:{...s,stroke:u?`#f87171`:s?.stroke,strokeWidth:u?2.5:s?.strokeWidth??2}}),u&&(0,I.jsx)(C,{children:(0,I.jsx)(`button`,{className:`nodrag nopan absolute flex items-center justify-center w-5 h-5 rounded-full bg-muted border border-border text-muted-foreground shadow-sm hover:bg-red-400/20 hover:text-red-400 hover:border-red-400/50 transition-colors cursor-pointer`,style:{transform:`translate(-50%, -50%) translate(${f}px, ${p}px)`,pointerEvents:`all`},onClick:()=>l?.onDelete?.(e),children:(0,I.jsx)(h,{className:`h-3 w-3`})})})]})}function he({agents:e}){let{t}=P(),n=(e,t)=>{e.dataTransfer.setData(`application/team-agent-id`,t),e.dataTransfer.effectAllowed=`move`};return(0,I.jsxs)(`div`,{className:`w-56 border-r border-border bg-card flex flex-col h-full`,children:[(0,I.jsxs)(`div`,{className:`p-3 border-b border-border`,children:[(0,I.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Agents`}),(0,I.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:`Drag agents onto the canvas`})]}),(0,I.jsxs)(`div`,{className:`flex-1 overflow-auto p-2 space-y-1`,children:[e.length===0&&(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground italic text-center py-8`,children:t(`teamEdit.noAgentsYet`)}),e.map(e=>(0,I.jsxs)(`div`,{draggable:!0,onDragStart:t=>n(t,e.id),className:`flex items-center gap-2 p-2 rounded-md border border-border bg-background hover:bg-accent/50 cursor-grab active:cursor-grabbing transition-colors`,children:[(0,I.jsx)(`span`,{className:`text-lg`,children:e.avatar}),(0,I.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,I.jsx)(`div`,{className:`text-xs font-medium truncate`,children:e.name}),(0,I.jsxs)(`div`,{className:`text-[10px] text-muted-foreground flex items-center gap-1`,children:[e?.runtime===`cli`&&e.cli&&(0,F.createElement)(j(e.cli),{className:`h-2.5 w-2.5`}),e.runtime===`cli`?M(e.cli??void 0):`API`]})]})]},e.id))]})]})}function ge({node:e,agents:t,onUpdate:n,onDelete:r,onClose:i}){let{t:a}=P(),o=e.data,s=t.find(e=>e.id===o.agentId);return(0,I.jsxs)(`div`,{className:`w-72 border-l border-border bg-card flex flex-col h-full`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between p-3 border-b border-border`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`text-lg`,children:s?.avatar??`?`}),(0,I.jsx)(`span`,{className:`text-sm font-medium`,children:s?.name??`Unknown`})]}),(0,I.jsx)(u,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:i,children:(0,I.jsx)(h,{className:`h-4 w-4`})})]}),(0,I.jsxs)(`div`,{className:`flex-1 overflow-auto p-3 space-y-4`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{className:`text-xs text-muted-foreground mb-1 block`,children:`Agent`}),(0,I.jsxs)(m,{value:o.agentId,onValueChange:r=>{if(r){let i=t.find(e=>e.id===r);n(e.id,{agentId:r,agent:i})}},children:[(0,I.jsx)(v,{children:(0,I.jsx)(b,{})}),(0,I.jsx)(p,{children:t.map(e=>(0,I.jsxs)(d,{value:e.id,children:[e.avatar,` `,e.name]},e.id))})]})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{className:`text-xs text-muted-foreground mb-1 block`,children:a(`teamEdit.role`)}),(0,I.jsx)(y,{value:o.role,onChange:t=>n(e.id,{role:t.target.value}),placeholder:a(`teamEdit.rolePlaceholder`)})]}),s&&(0,I.jsxs)(`div`,{className:`space-y-2 pt-2`,children:[(0,I.jsx)(g,{}),(0,I.jsx)(`label`,{className:`text-xs text-muted-foreground block`,children:a(`teamEdit.agentDetails`)}),s.description&&(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s.description}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[s.soul&&(0,I.jsx)(l,{variant:`secondary`,className:`text-[10px]`,children:`SOUL`}),s.identity&&(0,I.jsx)(l,{variant:`secondary`,className:`text-[10px]`,children:`Identity`}),s.rules&&(0,I.jsx)(l,{variant:`secondary`,className:`text-[10px]`,children:`Rules`}),s.heartbeat&&(0,I.jsx)(l,{variant:`secondary`,className:`text-[10px]`,children:`Heartbeat`}),s.knowledge&&(0,I.jsx)(l,{variant:`secondary`,className:`text-[10px]`,children:`Knowledge`})]})]})]}),(0,I.jsx)(`div`,{className:`p-3 border-t border-border`,children:(0,I.jsxs)(u,{variant:`destructive`,size:`sm`,className:`w-full`,onClick:()=>r(e.id),children:[(0,I.jsx)(fe,{className:`h-3.5 w-3.5 mr-1.5`}),`Remove from Team`]})})]})}var z=280,B=300;function _e(e){return Math.round(e/z)*z}function V(e){if(e.length===0)return e;let t=[...new Set(e.map(e=>Math.round(e.position.y/z)))].sort((e,t)=>e-t);if(t.every((e,n)=>e===t[0]+n))return e;let n=new Map;return t.forEach((e,t)=>n.set(e,t)),e.map(e=>{let t=Math.round(e.position.y/z),r=(n.get(t)??t)*z;return r===e.position.y?e:{...e,position:{...e.position,y:r}}})}function ve(e){if(e.length===0)return e;let t=new Map;for(let n of e){let e=Math.round(n.position.y/z);t.has(e)||t.set(e,[]),t.get(e).push(n)}let n=new Map;for(let[e,r]of t){r.sort((e,t)=>e.position.x-t.position.x);let t=-((r.length-1)*B)/2;for(let i=0;i<r.length;i++)n.set(r[i].id,{x:t+i*B,y:e*z})}return e.map(e=>({...e,position:n.get(e.id)??e.position}))}var H=0;function ye(){return`team_node_${++H}_${Date.now()}`}function U(e,t,n,r,i){return{id:e,source:t,sourceHandle:n,target:r,targetHandle:i,type:`team-edge`,markerEnd:{type:T.ArrowClosed,width:16,height:16},style:{strokeWidth:2,stroke:`#6b7280`},animated:!0}}function W(e,t){let n=[];if(t===`sequential`)for(let t=0;t<e.length-1;t++)n.push(U(`e-${e[t].id}-${e[t+1].id}`,e[t].id,`bottom-out`,e[t+1].id,`top-in`));else if(t===`router`){let t=e.find(e=>e.data.isRouter);if(t)for(let r of e)r.id!==t.id&&n.push(U(`e-${t.id}-${r.id}`,t.id,`bottom-out`,r.id,`top-in`))}return n}function be(e,t){if(!e||e.agents.length===0)return{nodes:[],edges:[]};let n=new Map(t.map(e=>[e.id,e]));if(e.canvas&&e.canvas.nodes.length>0)return{nodes:e.canvas.nodes.map(e=>({id:e.id,type:`team-agent`,position:{x:e.x,y:e.y},data:{agentId:e.agentId,role:e.role,agent:n.get(e.agentId),isRouter:e.isRouter??!1}})),edges:e.canvas.edges.map(e=>U(e.id,e.source,e.sourceHandle,e.target,e.targetHandle))};let r=e.agents.map(t=>({id:ye(),type:`team-agent`,position:{x:0,y:0},data:{agentId:t.agentId,role:t.role,agent:n.get(t.agentId),isRouter:e.strategy===`router`&&e.routerConfig?.routerAgentId===t.agentId}})),i=W(r,e.strategy);return{nodes:ve(r),edges:i}}function G(e,t){let n=new Map;for(let t of e)n.set(t.id,[]);for(let e of t){let t=n.get(e.target);t&&t.push(e.source)}return n}function K(e,t,n,r){let i=[];for(let a of t)if(a.source===e&&!r.has(a.target)){let e=n.find(e=>e.id===a.target);e&&i.push(e)}return i}function q(e,t){let n=G(e,t),r=e.filter(e=>(n.get(e.id)??[]).length===0),i=new Set,a=[],o=[...r];for(;o.length>0;){let n=o.shift();i.has(n.id)||(i.add(n.id),a.push(n),o.push(...K(n.id,t,e,i)))}for(let t of e)i.has(t.id)||a.push(t);return a}function xe(e,t){let n=q(e,t).map(e=>({agentId:e.data.agentId,role:e.data.role})),r={nodes:e.map(e=>({id:e.id,agentId:e.data.agentId,role:e.data.role,isRouter:e.data.isRouter||void 0,x:e.position.x,y:e.position.y})),edges:t.map(e=>({id:e.id,source:e.source,sourceHandle:e.sourceHandle??`bottom-out`,target:e.target,targetHandle:e.targetHandle??`top-in`}))};return{agents:n,routerAgentId:e.find(e=>e.data.isRouter)?.data.agentId??null,canvas:r}}function Se({viewport:e,tierRange:t}){let{y:n,zoom:r}=e,i=z*r,{minTier:a,maxTier:o,isDragging:s,dragTier:c}=t,l=s?a-1:a,u=s?o+1:o,d=l>u?0:l,f=l>u?0:u,p=[`0, 90%, 60%`,`25, 95%, 55%`,`50, 95%, 50%`,`139, 72%, 50%`,`217, 80%, 55%`,`280, 70%, 55%`];return(0,I.jsx)(`div`,{style:{position:`absolute`,inset:0,pointerEvents:`none`,overflow:`hidden`,zIndex:5},children:Array.from({length:f-d+1},(e,t)=>{let l=d+t,u=l-d,f=(l*z-z/2)*r+n,m=l<a||l>o,h=s&&c===l,g=p[u%p.length],_=f+i,v;v=h?.6:m?.12:.3;let y;return y=h?.5:m?.15:.35,(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{style:{position:`absolute`,left:0,right:0,top:_,height:0,borderTop:`1px dashed hsl(${g})`,opacity:v,transition:`background 150ms ease, height 150ms ease`}}),(0,I.jsxs)(`div`,{style:{position:`absolute`,left:10,top:f+6,fontSize:11,fontWeight:600,color:`hsl(${g})`,opacity:y,fontFamily:`var(--font-sans, system-ui)`,fontStyle:m?`italic`:void 0,userSelect:`none`,transition:`color 150ms ease`},children:[`Tier `,u]})]},l)})})}var Ce={"team-agent":L},we={"team-edge":R};function J(){let{t:e}=P(),{id:t}=i(),r=n(),d=a(),p=!t,m=(0,F.useRef)(null),[h,v]=(0,F.useState)(null),[b,x,S]=te([]),[C,w,ae]=oe([]),[E,D]=(0,F.useState)(null),[O,k]=(0,F.useState)(null),A=(0,F.useRef)(null),[de,fe]=(0,F.useState)(!1),[j,M]=(0,F.useState)({x:0,y:0,zoom:.6}),[L,R]=(0,F.useState)(!1),[B,H]=(0,F.useState)(null),[U,W]=(0,F.useState)(``),[G,K]=(0,F.useState)(``),[q,J]=(0,F.useState)(`sequential`),[Y,Te]=(0,F.useState)(``),[X,Ee]=(0,F.useState)(!0),Z=o({queryKey:[`agents`],queryFn:()=>_.agents.list({page:1,pageSize:100})}),De=o({queryKey:[`teams`,t],queryFn:()=>_.teams.get(t),enabled:!!t}),Q=(0,F.useMemo)(()=>Z.data?.data??[],[Z.data?.data]),$=De.data;if(!de&&(p||$)&&(fe(!0),$)){W($.name),K($.description),J($.strategy),Te($.tags.join(`, `)),Ee($.memoryEnabled??!0);let{nodes:e,edges:t}=be($,Q);x(e),w(t)}let Oe=(0,F.useMemo)(()=>E?b.find(e=>e.id===E):null,[b,E]),ke=s({mutationFn:e=>_.teams.create(e),onSuccess:t=>{d.invalidateQueries({queryKey:[`teams`]}),N.success(e(`teamEdit.teamCreated`)),r(`/agents/teams/${t.id}`,{replace:!0})},onError:e=>N.error(e.message)}),Ae=s({mutationFn:e=>_.teams.update(t,e),onSuccess:()=>{d.invalidateQueries({queryKey:[`teams`]}),N.success(e(`teamEdit.teamSaved`))},onError:e=>N.error(e.message)}),je=(0,F.useCallback)(()=>{let e=Y.split(`,`).map(e=>e.trim()).filter(Boolean),{agents:t,routerAgentId:n,canvas:r}=xe(b,C),i={name:U,description:G,strategy:q,agents:t,routerConfig:q===`router`&&n?{routerAgentId:n,routingPrompt:``}:null,canvas:r,memoryEnabled:X,tags:e};p?ke.mutate(i):Ae.mutate(i)},[U,G,q,Y,X,b,C,p,ke,Ae]),Me=(0,F.useCallback)(e=>w(t=>t.filter(t=>t.id!==e)),[w]),Ne=(0,F.useMemo)(()=>C.map(e=>({...e,type:`team-edge`,data:{...e.data,onDelete:Me,hovered:e.id===O}})),[C,Me,O]),Pe=(0,F.useCallback)(e=>{w(t=>ee({...e,type:`team-edge`,markerEnd:{type:T.ArrowClosed,width:16,height:16},style:{strokeWidth:2,stroke:`#6b7280`},animated:!0},t))},[w]),Fe=(0,F.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),Ie=(0,F.useCallback)(e=>{e.preventDefault();let t=e.dataTransfer.getData(`application/team-agent-id`);if(!t||!h||!m.current)return;let n=Q.find(e=>e.id===t);if(!n)return;let r=h.screenToFlowPosition({x:e.clientX,y:e.clientY}),i={x:r.x,y:_e(r.y)},a={id:ye(),type:`team-agent`,position:i,data:{agentId:t,role:``,agent:n,isRouter:!1}};x(e=>V([...e,a])),D(a.id)},[h,Q,x]),Le=(0,F.useMemo)(()=>{if(b.length===0)return{minTier:0,maxTier:0,isDragging:L,dragTier:B};let e=1/0,t=-1/0;for(let n of b){let r=Math.round(n.position.y/z);r<e&&(e=r),r>t&&(t=r)}return{minTier:e,maxTier:t,isDragging:L,dragTier:B}},[b,L,B]),Re=(0,F.useCallback)((e,t)=>{R(!0),H(Math.round(t.position.y/z))},[]),ze=(0,F.useCallback)((e,t)=>{R(!1),H(null),x(e=>V(e.map(e=>e.id===t.id?{...e,position:{...e.position,y:_e(t.position.y)}}:e)))},[x]),Be=(0,F.useCallback)((e,t)=>{D(t.id)},[]),Ve=(0,F.useCallback)(()=>{D(null)},[]),He=(0,F.useCallback)((e,t)=>{x(n=>n.map(n=>n.id===e?{...n,data:{...n.data,...t}}:n))},[x]),Ue=(0,F.useCallback)(e=>{x(t=>V(t.filter(t=>t.id!==e))),w(t=>t.filter(t=>t.source!==e&&t.target!==e)),D(null)},[x,w]),We=(0,F.useCallback)(()=>{x(e=>ve(e)),setTimeout(()=>h?.fitView({padding:.5,maxZoom:.7}),50)},[x,h]),Ge=ke.isPending||Ae.isPending;return(0,F.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),U.trim()&&je())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[je,U]),!p&&(De.isLoading||Z.isLoading)?(0,I.jsx)(pe,{}):(0,I.jsxs)(`div`,{className:`h-[calc(100vh-3.5rem)] flex flex-col`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2.5 border-b border-border bg-card shrink-0`,children:[(0,I.jsx)(u,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(`/agents?tab=teams`),children:(0,I.jsx)(se,{className:`h-4 w-4`})}),(0,I.jsx)(`div`,{className:`h-8 w-8 rounded-lg bg-primary/10 flex items-center justify-center`,children:(0,I.jsx)(ue,{className:`h-4 w-4 text-primary`})}),(0,I.jsx)(y,{value:U,onChange:e=>W(e.target.value),placeholder:e(`teamEdit.namePlaceholder`),className:`h-8 text-sm font-medium max-w-xs border-none bg-transparent focus-visible:ring-1`}),(0,I.jsx)(y,{value:G,onChange:e=>K(e.target.value),placeholder:e(`teamEdit.descriptionPlaceholder`),className:`h-8 text-xs text-muted-foreground max-w-xs border-none bg-transparent focus-visible:ring-1`}),(0,I.jsx)(g,{orientation:`vertical`,className:`h-6`}),(0,I.jsx)(`div`,{className:`flex items-center gap-1`,children:Object.entries(me).map(([e,t])=>{let n=t.icon;return(0,I.jsxs)(u,{variant:q===e?`secondary`:`ghost`,size:`sm`,className:c(`h-7 text-xs gap-1`,q===e&&`font-medium`),onClick:()=>J(e),title:t.description,children:[(0,I.jsx)(n,{className:`h-3 w-3`}),t.label]},e)})}),(0,I.jsx)(g,{orientation:`vertical`,className:`h-6`}),(0,I.jsx)(y,{value:Y,onChange:e=>Te(e.target.value),placeholder:e(`teamEdit.tagsPlaceholder`),className:`h-8 text-xs max-w-32 border-none bg-transparent focus-visible:ring-1`}),(0,I.jsx)(g,{orientation:`vertical`,className:`h-6`}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:e(`teamEdit.memoryEnabled`)}),(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e(`teamEdit.memoryEnabledHelp`)})]}),(0,I.jsx)(f,{checked:X,onCheckedChange:Ee})]}),(0,I.jsx)(`div`,{className:`flex-1`}),(0,I.jsxs)(l,{variant:`outline`,className:`text-xs`,children:[b.length,` agent`,b.length===1?``:`s`]}),(0,I.jsxs)(u,{size:`sm`,onClick:je,disabled:!U.trim()||Ge,children:[(0,I.jsx)(le,{className:`h-3.5 w-3.5 mr-1.5`}),Ge?`Saving...`:`Save`]})]}),(0,I.jsxs)(`div`,{className:`flex-1 flex min-h-0`,children:[(0,I.jsx)(he,{agents:Q}),(0,I.jsxs)(`div`,{className:`flex-1 relative`,ref:m,children:[b.length>1&&(0,I.jsx)(`div`,{className:`absolute top-3 right-3 z-10`,children:(0,I.jsxs)(u,{variant:`secondary`,size:`sm`,className:`h-8 shadow-md`,onClick:We,children:[(0,I.jsx)(ce,{className:`h-3.5 w-3.5 mr-1.5`}),`Tidy up`]})}),(0,I.jsxs)(ie,{nodes:b,edges:Ne,onNodesChange:e=>S(e),onEdgesChange:ae,onConnect:Pe,onInit:e=>{v(e),M(e.getViewport())},onMove:(e,t)=>M(t),onDrop:Ie,onDragOver:Fe,onEdgeMouseEnter:(e,t)=>{A.current&&=(clearTimeout(A.current),null),k(t.id)},onEdgeMouseLeave:()=>{A.current=setTimeout(()=>k(null),150)},onNodeDrag:Re,onNodeDragStop:ze,onNodeClick:Be,onPaneClick:Ve,nodeTypes:Ce,edgeTypes:we,fitView:!0,fitViewOptions:{padding:.5,maxZoom:.7},defaultViewport:{x:0,y:0,zoom:.6},proOptions:{hideAttribution:!0},deleteKeyCode:[`Backspace`,`Delete`],snapToGrid:!0,snapGrid:[16,16],minZoom:.2,maxZoom:2,edgesFocusable:!0,edgesReconnectable:!0,defaultEdgeOptions:{markerEnd:{type:T.ArrowClosed,width:16,height:16},style:{strokeWidth:2,stroke:`#6b7280`},animated:!0,interactionWidth:20},children:[(0,I.jsx)(re,{gap:16,size:1,color:`hsl(var(--muted-foreground) / 0.08)`}),(0,I.jsx)(ne,{showInteractive:!1})]}),(0,I.jsx)(Se,{viewport:j,tierRange:Le}),b.length===0&&(0,I.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:(0,I.jsxs)(`div`,{className:`text-center text-muted-foreground`,children:[(0,I.jsx)(ue,{className:`h-12 w-12 mx-auto mb-3 opacity-30`}),(0,I.jsx)(`p`,{className:`text-lg font-medium`,children:`Drag agents from the palette`}),(0,I.jsx)(`p`,{className:`text-sm mt-1`,children:`to compose your team hierarchy`}),(0,I.jsx)(`p`,{className:`text-xs mt-3 opacity-60`,children:`Connect agents with edges to define execution order`})]})})]}),Oe&&(0,I.jsx)(ge,{node:Oe,agents:Q,onUpdate:He,onDelete:Ue,onClose:()=>D(null)})]})]})}export{J as TeamEdit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{h as t,l as n,r,t as i,u as a}from"./vendor-react-BJ8SIkmN.js";import{U as o,V as s,q as c}from"./src-DUhGoAQb.js";import{t as l}from"./arrow-left-wtNmm6Le.js";import{n as u,t as d}from"./zap-CbT5plGA.js";import{t as f}from"./layers-ephyCrDm.js";import{t as p}from"./play-DXJMtO-K.js";import{A as m,D as h,H as g,K as _,U as v,W as y,t as b,w as x}from"./index-dc8HGqTp.js";var S=e(t(),1),C=i();function w(e){switch(e){case`completed`:return`default`;case`failed`:return`destructive`;case`cancelled`:return`outline`;default:return`secondary`}}function T(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function E(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function D(e,t){let n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return`${n}ms`;let r=Math.round(n/1e3);return r<60?`${r}s`:`${Math.floor(r/60)}m ${r%60}s`}function O({stats:e}){return(0,C.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,C.jsxs)(`div`,{className:`rounded-lg border bg-card p-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,C.jsx)(f,{className:`h-3.5 w-3.5`}),`Sessions`]}),(0,C.jsx)(`p`,{className:`mt-1 text-2xl font-semibold`,children:e.totalSessions})]}),(0,C.jsxs)(`div`,{className:`rounded-lg border bg-card p-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,C.jsx)(d,{className:`h-3.5 w-3.5`}),`Total Tokens`]}),(0,C.jsx)(`p`,{className:`mt-1 text-2xl font-semibold`,children:T(e.totalTokens)})]}),(0,C.jsxs)(`div`,{className:`rounded-lg border bg-card p-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,C.jsx)(u,{className:`h-3.5 w-3.5`}),`Input`]}),(0,C.jsx)(`p`,{className:`mt-1 text-2xl font-semibold`,children:T(e.totalInputTokens)})]}),(0,C.jsxs)(`div`,{className:`rounded-lg border bg-card p-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,C.jsx)(u,{className:`h-3.5 w-3.5`}),`Output`]}),(0,C.jsx)(`p`,{className:`mt-1 text-2xl font-semibold`,children:T(e.totalOutputTokens)})]})]})}function k({session:e}){let t=n(),r=e.inputTokens+e.outputTokens;return(0,C.jsxs)(`div`,{className:`space-y-6`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.teamName}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground line-clamp-2`,children:e.prompt})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsxs)(s,{size:`sm`,variant:`outline`,onClick:()=>t(`/agents/teams/${e.teamId}/use/${e.id}`),children:[(0,C.jsx)(g,{className:`mr-1.5 h-3.5 w-3.5`}),`Review in team`]}),(0,C.jsx)(o,{variant:w(e.status),children:e.status})]})]}),(0,C.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,C.jsxs)(`div`,{className:`text-sm`,children:[(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`Strategy`}),(0,C.jsx)(`p`,{className:`font-medium capitalize`,children:e.strategy})]}),(0,C.jsxs)(`div`,{className:`text-sm`,children:[(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`Rounds`}),(0,C.jsxs)(`p`,{className:`font-medium`,children:[e.totalRounds,`/`,e.maxRounds]})]}),(0,C.jsxs)(`div`,{className:`text-sm`,children:[(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`Duration`}),(0,C.jsx)(`p`,{className:`font-medium`,children:D(e.startedAt,e.completedAt)})]}),(0,C.jsxs)(`div`,{className:`text-sm`,children:[(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`Tokens`}),(0,C.jsx)(`p`,{className:`font-medium`,children:T(r)})]})]}),e.error&&(0,C.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive`,children:e.error}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-muted-foreground`,children:`Agents`}),(0,C.jsx)(`div`,{className:`space-y-2`,children:e.agents.map(e=>{let t=e.inputTokens+e.outputTokens;return(0,C.jsxs)(`div`,{className:`rounded-lg border p-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(_,{className:`h-4 w-4 text-muted-foreground`}),(0,C.jsx)(`span`,{className:`font-medium text-sm`,children:e.agentName}),(0,C.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,e.role,`)`]})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.model&&(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.model}),(0,C.jsx)(o,{variant:w(e.status),className:`text-xs`,children:e.status}),(0,C.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[T(t),` tok`]})]})]}),e.output&&(0,C.jsxs)(`pre`,{className:`mt-2 max-h-48 overflow-auto rounded bg-muted/50 p-2 text-xs whitespace-pre-wrap`,children:[e.output.slice(0,2e3),e.output.length>2e3&&`…`]})]},e.id)})})]})]})}function A(){let{t:e}=x(),t=n(),{id:i}=a(),[u,f]=(0,S.useState)([]),[A,j]=(0,S.useState)([]),[M,N]=(0,S.useState)(0),[P,F]=(0,S.useState)(null),[I,L]=(0,S.useState)(null),[R,z]=(0,S.useState)(!0),[B,V]=(0,S.useState)(1);(0,S.useEffect)(()=>{let e=!1;return Promise.resolve().then(()=>{e||z(!0)}),Promise.all([c.teamSessions.list({limit:20,offset:(B-1)*20}),c.teamSessions.stats(14),c.teams.listActiveRuns()]).then(([t,n,r])=>{e||(f(t.data),N(t.total),F(n),j(r.data.filter(e=>e.status===`running`)))}).finally(()=>{e||z(!1)}),()=>{e=!0}},[B]),(0,S.useEffect)(()=>{i?c.teamSessions.get(i).then(L).catch(()=>L(null)):Promise.resolve().then(()=>L(null))},[i]);let H=async e=>{await c.teams.cancelRun(e),j(t=>t.filter(t=>t.id!==e)),b.success(`Run cancelled`)},U=Math.ceil(M/20);return I?(0,C.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4 p-6`,children:[(0,C.jsxs)(r,{to:`/team-sessions`,className:`inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground`,children:[(0,C.jsx)(l,{className:`h-3.5 w-3.5`}),` Back to sessions`]}),(0,C.jsx)(k,{session:I})]}):(0,C.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-6 p-6`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h1`,{className:`text-xl font-semibold`,children:e(`teamSessions.title`)}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`History of all team runs with token consumption analytics`})]}),P&&(0,C.jsx)(O,{stats:P}),P&&(P.byTeam.length>0||P.byAgent.length>0)&&(0,C.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[P.byTeam.length>0&&(0,C.jsxs)(`div`,{className:`rounded-lg border bg-card p-4`,children:[(0,C.jsxs)(`h3`,{className:`mb-3 flex items-center gap-2 text-sm font-medium`,children:[(0,C.jsx)(h,{className:`h-4 w-4`}),` Top Teams (14d)`]}),(0,C.jsx)(`div`,{className:`space-y-2`,children:P.byTeam.slice(0,5).map(e=>(0,C.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,C.jsx)(`span`,{className:`truncate`,children:e.teamName}),(0,C.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,C.jsxs)(`span`,{children:[e.sessions,` runs`]}),(0,C.jsxs)(`span`,{children:[T(e.totalTokens),` tok`]}),(0,C.jsxs)(`span`,{className:`text-green-500`,children:[e.completed,`ok`]}),e.failed>0&&(0,C.jsxs)(`span`,{className:`text-red-500`,children:[e.failed,`err`]})]})]},e.teamId))})]}),P.byAgent.length>0&&(0,C.jsxs)(`div`,{className:`rounded-lg border bg-card p-4`,children:[(0,C.jsxs)(`h3`,{className:`mb-3 flex items-center gap-2 text-sm font-medium`,children:[(0,C.jsx)(_,{className:`h-4 w-4`}),` Top Agents (14d)`]}),(0,C.jsx)(`div`,{className:`space-y-2`,children:P.byAgent.slice(0,5).map(e=>(0,C.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,C.jsx)(`span`,{className:`truncate`,children:e.agentName}),(0,C.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,C.jsxs)(`span`,{children:[e.sessions,` runs`]}),(0,C.jsxs)(`span`,{children:[T(e.totalTokens),` tok`]})]})]},e.agentId))})]})]}),A.length>0&&(0,C.jsxs)(`div`,{className:`rounded-lg border border-yellow-500/30`,children:[(0,C.jsx)(`div`,{className:`border-b border-yellow-500/30 px-4 py-3`,children:(0,C.jsxs)(`h3`,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,C.jsxs)(`span`,{className:`relative flex h-2 w-2`,children:[(0,C.jsx)(`span`,{className:`animate-ping absolute inline-flex h-full w-full rounded-full bg-yellow-400 opacity-75`}),(0,C.jsx)(`span`,{className:`relative inline-flex rounded-full h-2 w-2 bg-yellow-500`})]}),`Running (`,A.length,`)`]})}),(0,C.jsx)(`div`,{className:`divide-y`,children:A.map(e=>(0,C.jsxs)(`div`,{className:`flex items-center gap-4 px-4 py-3 hover:bg-muted/50 transition-colors`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`font-medium text-sm truncate`,children:e.teamId}),(0,C.jsx)(o,{variant:`secondary`,className:`text-xs`,children:`running`}),(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground capitalize`,children:e.strategy})]}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground line-clamp-1`,children:e.prompt})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,C.jsxs)(s,{size:`sm`,variant:`outline`,onClick:()=>t(`/agents/teams/${e.teamId}/use`),children:[(0,C.jsx)(p,{className:`mr-1.5 h-3.5 w-3.5`}),`Open`]}),(0,C.jsxs)(s,{size:`sm`,variant:`outline`,onClick:()=>H(e.id),children:[(0,C.jsx)(m,{className:`mr-1.5 h-3.5 w-3.5`}),`Stop`]})]})]},e.id))})]}),(0,C.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,C.jsx)(`div`,{className:`border-b px-4 py-3`,children:(0,C.jsxs)(`h3`,{className:`text-sm font-medium`,children:[`All Sessions (`,M,`)`]})}),R&&(0,C.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:`Loading...`}),!R&&u.length===0&&(0,C.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:`No sessions yet. Run a team to see history here.`}),!R&&u.length>0&&(0,C.jsx)(`div`,{className:`divide-y`,children:u.map(e=>{let n=e.inputTokens+e.outputTokens;return(0,C.jsxs)(`div`,{className:`flex items-center gap-4 px-4 py-3 hover:bg-muted/50 transition-colors cursor-pointer`,onClick:()=>t(`/team-sessions/${e.id}`),children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`font-medium text-sm truncate`,children:e.teamName}),(0,C.jsx)(o,{variant:w(e.status),className:`text-xs`,children:e.status}),(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground capitalize`,children:e.strategy})]}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground line-clamp-1`,children:e.prompt})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-4 text-xs text-muted-foreground shrink-0`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,C.jsx)(v,{className:`h-3 w-3`}),E(e.startedAt)]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,C.jsx)(d,{className:`h-3 w-3`}),T(n)]}),(0,C.jsxs)(`span`,{children:[e.agents.length,` agents`]}),(0,C.jsx)(`span`,{children:D(e.startedAt,e.completedAt)}),(0,C.jsxs)(s,{size:`sm`,variant:`ghost`,className:`h-7 px-2`,onClick:n=>{n.stopPropagation(),t(`/agents/teams/${e.teamId}/use/${e.id}`)},children:[(0,C.jsx)(g,{className:`mr-1 h-3.5 w-3.5`}),`Review`]}),(0,C.jsx)(y,{className:`h-4 w-4`})]})]},e.id)})}),U>1&&(0,C.jsxs)(`div`,{className:`flex items-center justify-between border-t px-4 py-3`,children:[(0,C.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Page `,B,` of `,U]}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(s,{size:`sm`,variant:`outline`,disabled:B<=1,onClick:()=>V(e=>e-1),children:`Previous`}),(0,C.jsx)(s,{size:`sm`,variant:`outline`,disabled:B>=U,onClick:()=>V(e=>e+1),children:`Next`})]})]})]})]})}export{A as TeamSessions};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{h as t,l as n,t as r,u as i}from"./vendor-react-BJ8SIkmN.js";import{t as a}from"./useQuery-DvovkaPT.js";import{F as o,K as s,N as c,U as l,V as u,j as d,q as f,t as p}from"./src-DUhGoAQb.js";import{S as m,_ as h,h as g,p as _,v,x as y}from"./vendor-ui-Dpw9mBc-.js";import{t as b}from"./arrow-left-wtNmm6Le.js";import{t as x}from"./crown-BJEsQkh4.js";import{t as S}from"./chat-message-CbcDeDcb.js";import{t as ee}from"./history-CyBBboEp.js";import{n as C,r as te,t as ne}from"./send-FWvygYFQ.js";import{t as w}from"./play-DXJMtO-K.js";import"./utils-DHTPP40O.js";import{A as T,D as E,R as re,_ as ie,g as D,n as O,r as k,t as A,w as j}from"./index-dc8HGqTp.js";var ae=o(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),M=e(t(),1);function N(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>{let r=n;return[r.agentId,r.output??t[r.agentId]??``]}))}function oe(e){let[t,n]=(0,M.useState)({agentStates:{},agentOutputs:{},agentStreaming:{},agentIsStreaming:{},agentStreamIds:{},messageEdges:[],runStatus:`idle`,currentRound:0,maxRounds:0,debateRound:null}),r=(0,M.useRef)(null),i=(0,M.useCallback)(()=>{n({agentStates:{},agentOutputs:{},agentStreaming:{},agentIsStreaming:{},agentStreamIds:{},messageEdges:[],runStatus:`idle`,currentRound:0,maxRounds:0,debateRound:null})},[]);return(0,M.useEffect)(()=>{if(!e){r.current&&=(r.current.close(),null);return}let i=new EventSource(`/api/team-runs/${e}/stream`);r.current=i,i.onopen=()=>{n(e=>({...e,runStatus:`running`}))},i.addEventListener(`state`,e=>{try{let t=JSON.parse(e.data);t.type===`state-snapshot`&&n(e=>({...e,agentStates:t.agentStates??e.agentStates,runStatus:t.status===`running`?`running`:t.status,currentRound:t.currentRound??e.currentRound,maxRounds:t.maxRounds??e.maxRounds,agentOutputs:N(t.agentStates??{},e.agentOutputs)}))}catch{}}),i.addEventListener(`team-event`,e=>{try{a(JSON.parse(e.data))}catch{}}),i.onerror=()=>{t.runStatus!==`running`&&i.close()};function a(e){n(t=>{let n={...t};switch(e.type){case`run-started`:n.runStatus=`running`;break;case`agent-status`:{let t=n.agentStates[e.nodeId];n.agentStates={...n.agentStates,[e.nodeId]:{...t??{agentId:e.agentId,nodeId:e.nodeId,role:``,round:0},status:e.status}},e.status===`running`&&(n.agentIsStreaming={...n.agentIsStreaming,[e.agentId]:!0},n.agentStreaming={...n.agentStreaming,[e.agentId]:``}),(e.status===`done`||e.status===`error`)&&(n.agentIsStreaming={...n.agentIsStreaming,[e.agentId]:!1});break}case`agent-stream-start`:n.agentStreamIds={...n.agentStreamIds,[e.agentId]:e.streamId},n.agentIsStreaming={...n.agentIsStreaming,[e.agentId]:!0},n.agentStreaming={...n.agentStreaming,[e.agentId]:``};break;case`agent-output`:n.agentStreaming={...n.agentStreaming,[e.agentId]:(t.agentStreaming[e.agentId]??``)+e.delta};break;case`agent-done`:n.agentOutputs={...n.agentOutputs,[e.agentId]:e.output},n.agentStreaming={...n.agentStreaming,[e.agentId]:``},n.agentIsStreaming={...n.agentIsStreaming,[e.agentId]:!1};break;case`agent-error`:n.agentIsStreaming={...n.agentIsStreaming,[e.agentId]:!1};break;case`message-pass`:n.messageEdges=[...t.messageEdges,{fromNodeId:e.fromNodeId,toNodeId:e.toNodeId,preview:e.preview,edgeId:e.edgeId,timestamp:Date.now()}].slice(-50);break;case`round-info`:n.currentRound=e.currentRound,n.maxRounds=e.maxRounds;break;case`debate-round`:n.debateRound={current:e.round,total:e.totalRounds};break;case`run-completed`:n.runStatus=`completed`;break;case`run-failed`:n.runStatus=`failed`;break;case`run-cancelled`:n.runStatus=`cancelled`;break;case`run-final`:n.runStatus=e.status;break}return n})}return()=>{i.close(),r.current=null}},[e]),{...t,reset:i}}var P=r();function F(e){return e===`running`?`running`:e===`done`?`done`:e===`error`?`error`:`idle`}var I=(0,M.memo)(function({data:e,selected:t}){let n=e.agent;return(0,P.jsxs)(`div`,{className:s(`rounded-lg border-2 min-w-[220px] max-w-[280px] transition-all duration-300`,e.isRouter?`border-amber-500/50 bg-amber-500/5`:`border-violet-500/50 bg-violet-500/5`,e.isSelected&&`ring-2 ring-primary ring-offset-1 ring-offset-background`,!e.isSelected&&{idle:``,running:`ring-2 ring-emerald-500/50`,done:`ring-2 ring-emerald-500/20`,error:`ring-2 ring-red-500/30`}[e.status],e.status===`running`&&`agent-node-active`),style:e.status===`running`?{boxShadow:`0 0 20px 4px rgba(16, 185, 129, 0.25), 0 0 40px 8px rgba(16, 185, 129, 0.10)`}:void 0,children:[(0,P.jsx)(h,{type:`target`,position:m.Top,id:`top-in`,className:`!bg-transparent !border-orange-400`,style:{left:`35%`,width:12,height:6,borderRadius:`6px 6px 0 0`,borderWidth:2,borderBottomWidth:0,transform:`translate(-50%, 0)`,top:-6}}),(0,P.jsx)(h,{type:`source`,position:m.Top,id:`top-out`,className:`!bg-sky-400 !border-0`,style:{left:`65%`,width:12,height:6,borderRadius:`6px 6px 0 0`,transform:`translate(-50%, 0)`,top:-6}}),(0,P.jsx)(h,{type:`target`,position:m.Left,id:`left-in`,className:`!bg-transparent !border-orange-400`,style:{top:`35%`,width:6,height:12,borderRadius:`6px 0 0 6px`,borderWidth:2,borderRightWidth:0,transform:`translate(0, -50%)`,left:-6}}),(0,P.jsx)(h,{type:`source`,position:m.Left,id:`left-out`,className:`!bg-sky-400 !border-0`,style:{top:`65%`,width:6,height:12,borderRadius:`6px 0 0 6px`,transform:`translate(0, -50%)`,left:-6}}),(0,P.jsx)(h,{type:`source`,position:m.Right,id:`right-out`,className:`!bg-sky-400 !border-0`,style:{top:`35%`,width:6,height:12,borderRadius:`0 6px 6px 0`,transform:`translate(0, -50%)`,right:-6,left:`auto`}}),(0,P.jsx)(h,{type:`target`,position:m.Right,id:`right-in`,className:`!bg-transparent !border-orange-400`,style:{top:`65%`,width:6,height:12,borderRadius:`0 6px 6px 0`,borderWidth:2,borderLeftWidth:0,transform:`translate(0, -50%)`,right:-6,left:`auto`}}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-3 border-b border-border/50`,children:[(0,P.jsx)(`span`,{className:`text-2xl`,children:n?.avatar??`?`}),(0,P.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,P.jsx)(`div`,{className:`text-sm font-medium truncate`,children:n?.name??`Unknown Agent`}),(0,P.jsxs)(`div`,{className:`text-[10px] text-muted-foreground flex items-center gap-1`,children:[n?.runtime===`cli`&&n.cli&&(0,M.createElement)(O(n.cli),{className:`h-2.5 w-2.5`}),n?.runtime===`cli`?k(n.cli??void 0):`API`]})]}),e.isRouter&&(0,P.jsx)(x,{className:`h-4 w-4 text-amber-500 shrink-0`}),e.status===`running`&&(0,P.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full bg-emerald-500 animate-pulse shrink-0`}),e.status===`done`&&(0,P.jsx)(l,{variant:`secondary`,className:`text-[9px] bg-emerald-500/15 text-emerald-500 px-1.5 py-0`,children:`Done`}),e.status===`error`&&(0,P.jsx)(l,{variant:`secondary`,className:`text-[9px] bg-red-500/15 text-red-500 px-1.5 py-0`,children:`Error`})]}),(0,P.jsxs)(`div`,{className:`px-3 py-2`,children:[(0,P.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Role: `}),(0,P.jsx)(`span`,{className:s(`text-[11px] font-medium`,e.role?`text-primary/80`:`text-muted-foreground/50 italic`),children:e.role||`N/A`})]}),(0,P.jsx)(h,{type:`source`,position:m.Bottom,id:`bottom-out`,className:`!bg-sky-400 !border-0`,style:{left:`35%`,width:12,height:6,borderRadius:`0 0 6px 6px`,transform:`translate(-50%, 0)`,bottom:-6,top:`auto`}}),(0,P.jsx)(h,{type:`target`,position:m.Bottom,id:`bottom-in`,className:`!bg-transparent !border-orange-400`,style:{left:`65%`,width:12,height:6,borderRadius:`0 0 6px 6px`,borderWidth:2,borderTopWidth:0,transform:`translate(-50%, 0)`,bottom:-6,top:`auto`}})]})}),se={"team-agent":I};function L({agent:e,session:t,onSend:n,onStop:r,isStreaming:i,streamingContent:a,streamingThinking:o,streamingToolCalls:c,compact:f,onClose:m,label:h,hideHeader:g}){let[_,v]=(0,M.useState)(``),y=(0,M.useRef)(null),b=(0,M.useRef)(null),[x,ee]=(0,M.useState)(!0),C=(0,M.useCallback)(()=>{y.current?.scrollIntoView({behavior:`smooth`})},[]),te=(0,M.useCallback)(()=>{let e=b.current;e&&ee(e.scrollHeight-e.scrollTop-e.clientHeight<100)},[]);(0,M.useEffect)(()=>{x&&C()},[t.messages,a,c,x,C]),(0,M.useEffect)(()=>{let e=t.messages;e.length>0&&e[e.length-1].role===`user`&&setTimeout(C,0)},[t.messages.length,C,t.messages]);let w=(0,M.useCallback)(()=>{let e=_.trim();!e||i||(n(e),v(``))},[_,i,n]),E=(0,M.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),w())},[w]);return(0,P.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 border-b border-border last:border-b-0`,children:[!g&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-muted/50 border-b border-border shrink-0`,children:[(0,P.jsx)(`span`,{className:`text-base`,children:e.avatar}),(0,P.jsx)(`span`,{className:`text-xs font-medium truncate`,children:e.name}),h&&(0,P.jsx)(l,{variant:`outline`,className:`text-[9px] px-1.5 py-0`,children:h}),t.status===`running`&&(0,P.jsx)(`div`,{className:`h-2 w-2 rounded-full bg-emerald-500 animate-pulse`}),(0,P.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[i&&(0,P.jsx)(u,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:r,title:`Stop`,children:(0,P.jsx)(T,{className:`h-3 w-3 text-destructive`})}),m&&(0,P.jsx)(u,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:m,children:(0,P.jsx)(d,{className:`h-3 w-3`})})]})]}),(0,P.jsx)(`div`,{ref:b,onScroll:te,className:`flex-1 min-h-0 overflow-y-auto`,children:(0,P.jsxs)(`div`,{className:s(`space-y-3 p-3`,f?`max-w-none`:`max-w-xl mx-auto`),children:[t.messages.length===0&&!a&&!i&&(0,P.jsx)(`div`,{className:`text-center py-6 text-muted-foreground`,children:(0,P.jsxs)(`p`,{className:`text-xs`,children:[`Send a message to `,e.name]})}),t.messages.map(e=>(0,P.jsx)(S,{role:e.role,content:e.content,thinking:e.thinking,toolCalls:e.toolCalls,compact:e.role===`user`},e.id)),i&&(a||o||c&&c.length>0)&&(0,P.jsx)(S,{role:`assistant`,content:a,thinking:o,toolCalls:c?.map(e=>({id:e.id,name:e.name,input:e.input,output:e.output}))}),i&&!a&&!o&&(!c||c.length===0)&&(0,P.jsxs)(`div`,{className:`flex gap-2 justify-start`,children:[(0,P.jsx)(`div`,{className:`h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center shrink-0 mt-0.5`,children:(0,P.jsx)(`span`,{className:`text-xs`,children:e.avatar})}),(0,P.jsx)(`div`,{className:`rounded-lg px-3 py-2.5 bg-muted`,children:(0,P.jsxs)(`div`,{className:`flex gap-1`,children:[(0,P.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-muted-foreground/50 animate-bounce [animation-delay:0ms]`}),(0,P.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-muted-foreground/50 animate-bounce [animation-delay:150ms]`}),(0,P.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-muted-foreground/50 animate-bounce [animation-delay:300ms]`})]})})]}),(0,P.jsx)(`div`,{ref:y})]})}),(0,P.jsx)(`div`,{className:`border-t p-2 shrink-0`,children:(0,P.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,P.jsx)(p,{value:_,onChange:e=>v(e.target.value),onKeyDown:E,placeholder:`Message ${e.name}...`,className:`min-h-[36px] max-h-[100px] resize-none text-xs`,rows:1,disabled:i}),i?(0,P.jsx)(u,{variant:`destructive`,size:`icon`,className:`h-[36px] w-[36px] shrink-0`,onClick:r,children:(0,P.jsx)(T,{className:`h-3.5 w-3.5`})}):(0,P.jsx)(u,{size:`icon`,className:`h-[36px] w-[36px] shrink-0`,onClick:w,disabled:!_.trim(),children:(0,P.jsx)(ne,{className:`h-3.5 w-3.5`})})]})})]})}function R({agent:e,session:t,onUpdateSession:n,compact:r,onClose:i,label:a,hideHeader:o,teamStreamId:s}){let{t:c}=j(),{streamingContent:l,streamingThinking:u,streamingToolCalls:d,isStreaming:p,error:m,startStream:h,stopStream:g,consumeStream:_}=D(s?`team/${e.id}/${s}`:t.sessionKey),v=(0,M.useRef)(null);return(0,M.useEffect)(()=>{s&&s!==v.current&&(v.current=s,h(s))},[s,h]),(0,M.useEffect)(()=>{p&&t.status===`idle`&&n(e.id,{status:`running`})},[p,t.status,e.id,n]),(0,M.useEffect)(()=>{if(!p&&(l||d.length>0)&&(t.status===`running`||t.status===`done`)){let r=_();r&&(r.content||r.toolCalls.length>0)&&n(e.id,{status:`done`,messages:[...t.messages,{id:crypto.randomUUID(),role:`assistant`,content:r.content,timestamp:new Date,thinking:r.thinking||void 0,toolCalls:r.toolCalls.map(e=>({id:e.id,name:e.name,input:e.input,output:e.output}))}]})}},[p,l,d,t.status,e.id,t.messages,n,_]),(0,M.useEffect)(()=>{if(m&&t.status===`running`){if(l||d.length>0)return;n(e.id,{status:`error`,messages:[...t.messages,{id:crypto.randomUUID(),role:`system`,content:`Error: ${m}`,timestamp:new Date}]})}},[m,t.status,e.id,t.messages,n,l,d]),(0,P.jsx)(L,{agent:e,session:t,onSend:(0,M.useCallback)(async r=>{let i={id:crypto.randomUUID(),role:`user`,content:r,timestamp:new Date},a=[...t.messages,i];n(e.id,{messages:a,status:`running`});try{let t=e.additionalFolders?.map(e=>e.path),i=await f.chat.startNew(e.dir,r,e.cli??void 0,t?.length?t:void 0),a=`team-use/${e.id}/${i.streamId}`;n(e.id,{sessionKey:a,streamId:i.streamId}),h(i.streamId)}catch(t){n(e.id,{status:`error`,messages:[...a,{id:crypto.randomUUID(),role:`system`,content:`Failed to start: ${t}`,timestamp:new Date}]}),A.error(c(`teamUse.failedToStart`,{name:e.name}))}},[e,t.messages,n,h,c]),onStop:(0,M.useCallback)(()=>{g(),n(e.id,{status:`idle`})},[g,e.id,n]),isStreaming:p,streamingContent:l,streamingThinking:u,streamingToolCalls:d,compact:r,onClose:i,label:a,hideHeader:o})}function z({initialRunId:e,initialExpandedPanels:t,initialSessions:r,initialRunStatus:o}={}){let{t:d}=j(),{id:m,sessionId:h}=i(),x=n(),{data:S,isLoading:ne}=a({queryKey:[`teams`,m],queryFn:()=>f.teams.get(m),enabled:!!m}),{data:T}=a({queryKey:[`agents`],queryFn:()=>f.agents.list({page:1,pageSize:100})}),D=(0,M.useMemo)(()=>T?.data??[],[T?.data]),[O,k]=(0,M.useState)(r??{}),[N,I]=(0,M.useState)(null),[L,z]=(0,M.useState)(e??null),[B,V]=(0,M.useState)(``),H=oe(r?null:L),U=o??H.runStatus,W=U===`running`,[G,K]=(0,M.useState)(`side`),[ce,q]=(0,M.useState)(new Set(t??[])),J=(0,M.useCallback)(e=>{q(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);(0,M.useEffect)(()=>{if(L)for(let[e,n]of Object.entries(H.agentStreamIds))n&&(ie(n,`team/${e}/${n}`),t||q(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n}))},[L,H.agentStreamIds,t]),(0,M.useEffect)(()=>{S&&D.length>0&&k(e=>{let t={...e};for(let e of S.agents)t[e.agentId]||(t[e.agentId]={agentId:e.agentId,messages:[],status:`idle`});return t})},[S,D]),(0,M.useEffect)(()=>{!h||!S||!D.length||f.teamSessions.get(h).then(e=>{V(e.prompt);let t={};for(let n of e.agents){let r=[{id:crypto.randomUUID(),role:`user`,content:e.prompt,timestamp:new Date(e.startedAt)}];n.output&&r.push({id:crypto.randomUUID(),role:`assistant`,content:n.output,timestamp:new Date(e.completedAt??e.startedAt)}),t[n.agentId]={agentId:n.agentId,messages:r,status:F(n.status)},q(e=>{let t=new Set(e);return t.add(n.agentId),t})}k(e=>({...e,...t}))}).catch(()=>{})},[h,S?.id,D.length]),(0,M.useEffect)(()=>{if(!S?.id||L||r||h)return;let e=!1;return f.teams.listActiveRuns().then(t=>{if(e)return;let n=t.data.filter(e=>e.teamId===S.id&&e.status===`running`).sort((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())[0];n&&(z(n.id),n.prompt&&V(n.prompt),A.info(`Reconnected to active run`))}).catch(()=>{}),()=>{e=!0}},[S?.id,r,h,L]),(0,M.useEffect)(()=>{if(L)for(let[,e]of Object.entries(H.agentStates)){let t=F(e.status);k(n=>{let r=n[e.agentId];return!r||r.status===t?n:{...n,[e.agentId]:{...r,status:t}}})}},[L,H.agentStates]),(0,M.useEffect)(()=>{if(L)for(let[e,t]of Object.entries(H.agentOutputs))t&&k(n=>{let r=n[e];if(!r)return n;let i=r.messages[r.messages.length-1];return i?.role===`assistant`&&i.content===t?n:{...n,[e]:{...r,messages:[...r.messages,{id:crypto.randomUUID(),role:`assistant`,content:t,timestamp:new Date}]}}})},[L,H.agentOutputs]);let Y=(0,M.useCallback)(async()=>{if(!(!S||!B.trim()))try{let{runId:e}=await f.teams.startRun(S.id,B.trim());z(e),k(e=>{let t={...e};for(let e of S.agents)t[e.agentId]&&(t[e.agentId]={...t[e.agentId],messages:[...t[e.agentId].messages,{id:crypto.randomUUID(),role:`user`,content:B.trim(),timestamp:new Date}],status:`running`});return t}),V(``),A.success(d(`teamUse.teamRunStarted`))}catch(e){A.error(d(`teamUse.failedToStartRun`,{error:String(e)}))}},[S,B,d]),le=(0,M.useCallback)(async()=>{if(L)try{await f.teams.cancelRun(L),A.info(d(`teamUse.teamRunCancelled`))}catch(e){A.error(d(`teamUse.failedToCancel`,{error:String(e)}))}},[L,d]),X=(0,M.useCallback)((e,t)=>{k(n=>({...n,[e]:{...n[e],...t}}))},[]),ue=(0,M.useMemo)(()=>Object.entries(O).filter(([,e])=>e.status===`running`||e.status===`done`||e.status===`error`||e.messages.length>0).map(([e])=>e),[O]),Z=(0,M.useMemo)(()=>{if(!S)return[];let e=new Map(D.map(e=>[e.id,e])),t=e=>{if(L){let t=Object.values(H.agentStates).find(t=>t.agentId===e);if(t){if(t.status===`running`)return`running`;if(t.status===`done`)return`done`;if(t.status===`error`)return`error`}}return O[e]?.status??`idle`};return S.canvas&&S.canvas.nodes.length>0?S.canvas.nodes.map(n=>({id:n.id,type:`team-agent`,position:{x:n.x,y:n.y},data:{agentId:n.agentId,role:n.role??``,agent:e.get(n.agentId),isRouter:n.isRouter,status:t(n.agentId),isSelected:n.id===N},draggable:!1,selectable:!0})):S.agents.map((n,r)=>({id:`fallback_${n.agentId}`,type:`team-agent`,position:{x:S.strategy===`sequential`?0:(r-(S.agents.length-1)/2)*300,y:S.strategy===`sequential`?r*280:S.strategy===`router`&&S.routerConfig?.routerAgentId===n.agentId?0:280},data:{agentId:n.agentId,role:n.role??``,agent:e.get(n.agentId),isRouter:S.strategy===`router`&&S.routerConfig?.routerAgentId===n.agentId,status:t(n.agentId),isSelected:!1},draggable:!1,selectable:!0}))},[S,D,O,N,L,H.agentStates]),[de,fe]=(0,M.useState)(0);(0,M.useEffect)(()=>{if(H.messageEdges.length===0)return;let e=setInterval(()=>fe(e=>e+1),1e3);return()=>clearInterval(e)},[H.messageEdges.length]);let pe=(0,M.useMemo)(()=>{let e=Date.now();return new Set(H.messageEdges.filter(t=>e-t.timestamp<5e3).map(e=>e.edgeId).filter(Boolean))},[H.messageEdges,de]),me=(0,M.useMemo)(()=>{if(!S)return[];if(S.canvas&&S.canvas.edges.length>0)return S.canvas.edges.map(e=>{let t=pe.has(e.id),n=t||U===`completed`;return{id:e.id,source:e.source,sourceHandle:e.sourceHandle,target:e.target,targetHandle:e.targetHandle,markerEnd:{type:y.ArrowClosed,width:16,height:16},style:{strokeWidth:n?3:2,stroke:n?`#22c55e`:`#6b7280`,transition:`stroke 0.5s ease, stroke-width 0.3s ease`},animated:t,className:t?`react-flow__edge-animated-pulse`:``}});let e=Z,t=[];if(S.strategy===`sequential`)for(let n=0;n<e.length-1;n++)t.push({id:`e-${e[n].id}-${e[n+1].id}`,source:e[n].id,sourceHandle:`bottom-out`,target:e[n+1].id,targetHandle:`top-in`,markerEnd:{type:y.ArrowClosed,width:16,height:16},style:{strokeWidth:2,stroke:`#6b7280`},animated:!0});else if(S.strategy===`router`){let n=e.find(e=>e.data.isRouter);if(n)for(let r of e)r.id!==n.id&&t.push({id:`e-${n.id}-${r.id}`,source:n.id,sourceHandle:`bottom-out`,target:r.id,targetHandle:`top-in`,markerEnd:{type:y.ArrowClosed,width:16,height:16},style:{strokeWidth:2,stroke:`#6b7280`},animated:!0})}return t},[S,Z,pe,U]),Q=(0,M.useMemo)(()=>N?Z.find(e=>e.id===N)?.data.agentId??null:null,[N,Z]),he=(0,M.useCallback)((e,t)=>{I(e=>e===t.id?null:t.id)},[]),ge=(0,M.useCallback)(e=>{let t=Z.find(t=>t.data.agentId===e);t&&I(t.id)},[Z]),_e=(0,M.useCallback)(()=>{I(null)},[]);if(ne)return(0,P.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,P.jsx)(re,{className:`h-8 w-8 animate-spin text-muted-foreground`})});if(!S)return(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-4`,children:[(0,P.jsx)(`p`,{className:`text-muted-foreground`,children:d(`teamUse.teamNotFound`)}),(0,P.jsxs)(u,{variant:`outline`,onClick:()=>x(`/agents?tab=teams`),children:[(0,P.jsx)(b,{className:`h-4 w-4 mr-1`}),` `,d(`teamUse.backToTeams`)]})]});let $=Q?D.find(e=>e.id===Q):null,ve=Q?O[Q]:null,ye=ue.filter(e=>e!==Q);return(0,P.jsxs)(`div`,{className:`h-full flex flex-col`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2 border-b bg-background/95 backdrop-blur shrink-0`,children:[(0,P.jsx)(u,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>x(`/agents?tab=teams`),children:(0,P.jsx)(b,{className:`h-4 w-4`})}),(0,P.jsx)(`div`,{className:`h-8 w-8 rounded-lg bg-primary/10 flex items-center justify-center`,children:(0,P.jsx)(E,{className:`h-4 w-4 text-primary`})}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h1`,{className:`text-sm font-semibold`,children:S.name}),(0,P.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[S.agents.length,` agents · `,S.strategy]})]}),(0,P.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[H.debateRound&&(0,P.jsxs)(l,{variant:`outline`,className:`text-xs`,children:[`Debate Round `,H.debateRound.current,`/`,H.debateRound.total]}),H.currentRound>0&&!H.debateRound&&(0,P.jsxs)(l,{variant:`outline`,className:`text-xs`,children:[`Round `,H.currentRound,`/`,H.maxRounds]}),W&&(0,P.jsx)(l,{className:`bg-emerald-500/15 text-emerald-500 border-emerald-500/30 animate-pulse`,children:`Running`}),U===`completed`&&(0,P.jsx)(l,{className:`bg-emerald-500/15 text-emerald-500 border-emerald-500/30`,children:`Completed`}),U===`failed`&&(0,P.jsx)(l,{className:`bg-red-500/15 text-red-500 border-red-500/30`,children:`Failed`}),W&&(0,P.jsxs)(u,{variant:`destructive`,size:`sm`,onClick:le,children:[(0,P.jsx)(ae,{className:`h-3.5 w-3.5 mr-1`}),` Stop`]}),(0,P.jsxs)(u,{variant:`ghost`,size:`sm`,className:`h-7 text-xs gap-1`,onClick:()=>x(`/team-sessions?teamId=${S.id}`),children:[(0,P.jsx)(ee,{className:`h-3.5 w-3.5`}),` History`]}),(0,P.jsxs)(`div`,{className:`flex items-center border rounded-lg p-0.5 bg-muted/50`,children:[(0,P.jsx)(u,{variant:G===`side`?`secondary`:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>K(`side`),title:d(`common.sideBySide`),children:(0,P.jsx)(te,{className:`h-3.5 w-3.5`})}),(0,P.jsx)(u,{variant:G===`stack`?`secondary`:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>K(`stack`),title:d(`common.stacked`),children:(0,P.jsx)(C,{className:`h-3.5 w-3.5`})})]})]})]}),(0,P.jsxs)(`div`,{className:s(`flex-1 min-h-0`,G===`side`?`flex`:`flex flex-col`),children:[(0,P.jsx)(`div`,{className:s(`bg-muted/30`,G===`side`?`w-[45%] h-full border-r`:`h-[280px] border-b shrink-0`),children:(0,P.jsxs)(v,{nodes:Z,edges:me,nodeTypes:se,onNodeClick:he,onPaneClick:_e,fitView:!0,fitViewOptions:{padding:.3},proOptions:{hideAttribution:!0},panOnScroll:!0,zoomOnScroll:!0,minZoom:.3,maxZoom:1.5,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,children:[(0,P.jsx)(_,{gap:20,size:1}),(0,P.jsx)(g,{showInteractive:!1})]})}),(0,P.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 min-h-0 overflow-hidden`,children:[!W&&U!==`completed`&&(0,P.jsx)(`div`,{className:`border-b p-3 shrink-0 bg-muted/30`,children:(0,P.jsxs)(`div`,{className:`flex gap-2 max-w-2xl mx-auto`,children:[(0,P.jsx)(p,{value:B,onChange:e=>V(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Y())},placeholder:`Give the team a task (${S.strategy} strategy)...`,className:`min-h-[44px] max-h-[120px] resize-none text-sm`,rows:1}),(0,P.jsxs)(u,{className:`h-[44px] shrink-0 gap-1.5`,onClick:Y,disabled:!B.trim(),children:[(0,P.jsx)(w,{className:`h-4 w-4`}),` Run Team`]})]})}),G===`stack`||ye.length>0||$?G===`stack`?(0,P.jsx)(`div`,{className:`flex-1 flex min-h-0 overflow-x-auto`,children:S.agents.map(e=>e.agentId).map(e=>{let t=D.find(t=>t.id===e),n=O[e];if(!t||!n)return null;let r=S.agents.find(t=>t.agentId===e);return(0,P.jsx)(`div`,{onClick:()=>ge(e),className:s(`flex-1 min-w-[280px] border-r border-border last:border-r-0 flex flex-col min-h-0 cursor-pointer`,e===Q&&`ring-2 ring-primary ring-inset bg-primary/[0.02]`),children:(0,P.jsx)(R,{agent:t,session:n,onUpdateSession:X,compact:!0,label:r?.role,teamStreamId:L?H.agentStreamIds[e]:void 0})},e)})}):(0,P.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 overflow-auto`,children:[$&&ve&&(0,P.jsx)(`div`,{className:`flex-1 flex flex-col min-h-[200px]`,children:(0,P.jsx)(R,{agent:$,session:ve,onUpdateSession:X,compact:!0,label:`Selected`,onClose:()=>I(null),teamStreamId:L?H.agentStreamIds[$.id]:void 0})}),ye.map(e=>{let t=D.find(t=>t.id===e),n=O[e];if(!t||!n)return null;let r=S.agents.find(t=>t.agentId===e),i=ce.has(e),a=H.agentIsStreaming[e],o=H.agentStreaming[e]||``,u=n.messages[n.messages.length-1];return(0,P.jsxs)(`div`,{className:`border-t border-border shrink-0`,children:[(0,P.jsxs)(`button`,{onClick:()=>J(e),className:s(`w-full flex items-center gap-2 px-3 py-1.5 hover:bg-muted/80 transition-colors`,a?`bg-emerald-500/5`:`bg-muted/50`),children:[(0,P.jsx)(c,{className:s(`h-3.5 w-3.5 text-muted-foreground transition-transform duration-200`,!i&&`-rotate-90`)}),(0,P.jsx)(`span`,{className:`text-base`,children:t.avatar}),(0,P.jsx)(`span`,{className:`text-xs font-medium truncate`,children:t.name}),r?.role&&(0,P.jsx)(l,{variant:`outline`,className:`text-[9px] px-1.5 py-0`,children:r.role}),a&&(0,P.jsx)(`div`,{className:`h-2 w-2 rounded-full bg-emerald-500 animate-pulse`}),n.status===`done`&&!a&&(0,P.jsx)(l,{variant:`secondary`,className:`text-[9px] bg-emerald-500/15 text-emerald-500 px-1.5 py-0`,children:`Done`}),n.status===`error`&&(0,P.jsx)(l,{variant:`secondary`,className:`text-[9px] bg-red-500/15 text-red-500 px-1.5 py-0`,children:`Error`})]}),!i&&(a||o)&&(0,P.jsx)(`div`,{className:`px-3 py-2 bg-muted/20 border-b border-border/50 cursor-pointer`,onClick:()=>J(e),children:(0,P.jsxs)(`div`,{className:`text-[11px] text-muted-foreground font-mono leading-relaxed max-h-[60px] overflow-hidden relative`,children:[o.split(`
|
|
2
|
+
`).slice(-3).join(`
|
|
3
|
+
`)||`…`,a&&(0,P.jsx)(`span`,{className:`inline-block w-1.5 h-3 bg-emerald-500 animate-pulse ml-0.5 align-middle`}),(0,P.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 h-4 bg-gradient-to-t from-muted/20 to-transparent pointer-events-none`})]})}),!i&&!a&&!o&&u&&(0,P.jsx)(`div`,{className:`px-3 py-1.5 bg-muted/10 border-b border-border/50 cursor-pointer`,onClick:()=>J(e),children:(0,P.jsxs)(`p`,{className:`text-[10px] text-muted-foreground truncate`,children:[u.content.slice(0,150),u.content.length>150?`…`:``]})}),i&&(0,P.jsx)(`div`,{className:`h-[300px]`,children:(0,P.jsx)(R,{agent:t,session:n,onUpdateSession:X,compact:!0,hideHeader:!0,label:r?.role,teamStreamId:L?H.agentStreamIds[e]:void 0})})]},e)})]}):(0,P.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-muted-foreground`,children:[(0,P.jsx)(E,{className:`h-12 w-12 mb-3 opacity-30`}),(0,P.jsx)(`p`,{className:`font-medium text-sm`,children:U===`idle`?`Run the team or select an agent`:`Select an agent on the canvas`}),(0,P.jsx)(`p`,{className:`text-xs mt-1`,children:U===`idle`?`Enter a prompt above to orchestrate all agents, or click a node to chat directly`:`Click a node to open its chat panel`})]})]})]})]})}export{z as TeamUse};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as e}from"./src-DUhGoAQb.js";var t=e(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as e}from"./src-DUhGoAQb.js";var t=e(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{h as t}from"./vendor-react-BJ8SIkmN.js";import{S as n,T as r,c as i,m as a,r as o,v as s,x as c}from"./useQuery-DvovkaPT.js";import{Z as l}from"./index-dc8HGqTp.js";var u=class extends r{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),c(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&a(t.mutationKey)!==a(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??l();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){i.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},d=e(t(),1);function f(e,t){let r=o(t),[a]=d.useState(()=>new u(r,e));d.useEffect(()=>{a.setOptions(e)},[a,e]);let c=d.useSyncExternalStore(d.useCallback(e=>a.subscribe(i.batchCalls(e)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),l=d.useCallback((e,t)=>{a.mutate(e,t).catch(s)},[a]);if(c.error&&n(a.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:l,mutateAsync:c.mutate}}export{f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{h as t,t as n}from"./vendor-react-BJ8SIkmN.js";var r=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},i=new class extends r{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},a={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},o=new class{#e=a;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function s(e){setTimeout(e,0)}var c=typeof window>`u`||`Deno`in globalThis;function l(){}function u(e,t){return typeof e==`function`?e(t):e}function d(e){return typeof e==`number`&&e>=0&&e!==1/0}function f(e,t){return Math.max(e+(t||0)-Date.now(),0)}function p(e,t){return typeof e==`function`?e(t):e}function m(e,t){return typeof e==`function`?e(t):e}function h(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==_(o,t.options))return!1}else if(!y(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function g(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(v(t.options.mutationKey)!==v(a))return!1}else if(!y(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function _(e,t){return(t?.queryKeyHashFn||v)(e)}function v(e){return JSON.stringify(e,(e,t)=>w(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function y(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>y(e[n],t[n])):!1}var b=Object.prototype.hasOwnProperty;function x(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=C(e)&&C(t);if(!r&&!(w(e)&&w(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:b.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=x(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function S(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function C(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function w(e){if(!T(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!T(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function T(e){return Object.prototype.toString.call(e)===`[object Object]`}function E(e){return new Promise(t=>{o.setTimeout(t,e)})}function D(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:x(e,t)}function O(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ee(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var k=Symbol();function A(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===k?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function j(e,t){return typeof e==`function`?e(...t):!!e}function te(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var M=(()=>{let e=()=>c;return{isServer(){return e()},setIsServer(t){e=t}}})();function N(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var P=s;function ne(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=P,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var F=ne(),I=new class extends r{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function re(e){return Math.min(1e3*2**e,3e4)}function L(e){return(e??`online`)===`online`?I.isOnline():!0}var R=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function z(e){let t=!1,n=0,r,a=N(),o=()=>a.status!==`pending`,s=t=>{if(!o()){let n=new R(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>i.isFocused()&&(e.networkMode===`always`||I.isOnline())&&e.canRun(),d=()=>L(e.networkMode)&&e.canRun(),f=e=>{o()||(r?.(),a.resolve(e))},p=e=>{o()||(r?.(),a.reject(e))},m=()=>new Promise(t=>{r=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),h=()=>{if(o())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(o())return;let i=e.retry??(M.isServer()?0:3),a=e.retryDelay??re,s=typeof a==`function`?a(n,r):a,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),E(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:a,status:()=>a.status,cancel:s,continue:()=>(r?.(),a),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),a)}}var B=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),d(this.gcTime)&&(this.#e=o.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(M.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(o.clearTimeout(this.#e),void 0)}},ie=class extends B{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=U(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=U(this.options);e.data!==void 0&&(this.setState(H(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=D(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(l).catch(l):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>m(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===k||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>p(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!f(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=A(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=z({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof R&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof R){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...V(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...H(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),F.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function V(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:L(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function H(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function U(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var ae=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=N(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),W(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return G(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return G(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof m(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!S(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&K(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||p(this.options.staleTime,this.#t)!==p(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return se(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(l)),t}#g(){this.#b();let e=p(this.options.staleTime,this.#t);if(M.isServer()||this.#r.isStale||!d(e))return;let t=f(this.#r.dataUpdatedAt,e)+1;this.#d=o.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(M.isServer()||m(this.options.enabled,this.#t)===!1||!d(this.#p)||this.#p===0)&&(this.#f=o.setInterval(()=>{(this.options.refetchIntervalInBackground||i.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(o.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(o.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&W(e,t),o=i&&K(e,n,t,r);(a||o)&&(l={...l,...V(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:h}=l;d=l.data;let g=!1;if(t.placeholderData!==void 0&&d===void 0&&h===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,g=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(h=`success`,d=D(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!g)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=D(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),h=`error`);let _=l.fetchStatus===`fetching`,v=h===`pending`,y=h===`error`,b=v&&_,x=d!==void 0,S={status:h,fetchStatus:l.fetchStatus,isPending:v,isSuccess:h===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:q(e,t),refetch:this.refetch,promise:this.#o,isEnabled:m(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{i(this.#o=S.promise=N())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!S(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){F.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function oe(e,t){return m(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function W(e,t){return oe(e,t)||e.state.data!==void 0&&G(e,t,t.refetchOnMount)}function G(e,t,n){if(m(t.enabled,e)!==!1&&p(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&q(e,t)}return!1}function K(e,t,n,r){return(e!==t||m(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&q(e,n)}function q(e,t){return m(t.enabled,e)!==!1&&e.isStaleByTime(p(t.staleTime,e))}function se(e,t){return!S(e.getCurrentResult(),t)}var J=e(t(),1),ce=n(),Y=J.createContext(void 0),X=e=>{let t=J.useContext(Y);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},le=({client:e,children:t})=>(J.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,ce.jsx)(Y.Provider,{value:e,children:t})),Z=J.createContext(!1),ue=()=>J.useContext(Z);Z.Provider;function de(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var fe=J.createContext(de()),pe=()=>J.useContext(fe),me=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?j(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Q=e=>{J.useEffect(()=>{e.clearReset()},[e])},he=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||j(n,[e.error,r])),ge=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},_e=(e,t)=>e.isLoading&&e.isFetching&&!t,ve=(e,t)=>e?.suspense&&t.isPending,$=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ye(e,t,n){let r=ue(),i=pe(),a=X(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,ge(o),me(o,i,s),Q(i);let c=!a.getQueryCache().get(o.queryHash),[u]=J.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&e.subscribed!==!1;if(J.useSyncExternalStore(J.useCallback(e=>{let t=f?u.subscribe(F.batchCalls(e)):l;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),J.useEffect(()=>{u.setOptions(o)},[o,u]),ve(o,d))throw $(o,u,i);if(he({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!M.isServer()&&_e(d,r)&&(c?$(o,u,i):s?.promise)?.catch(l).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function be(e,t){return ye(e,ae,t)}export{k as C,j as S,r as T,h as _,B as a,p as b,F as c,ee as d,A as f,g,_ as h,ie as i,te as l,v as m,le as n,z as o,u as p,X as r,I as s,be as t,O as u,l as v,i as w,S as x,y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./src-DUhGoAQb.js";function e(e){if(e<1e3)return`${Math.round(e)}ms`;let t=Math.floor(e/1e3);if(t<60)return`${t}${e%1e3>=100?`.${Math.floor(e%1e3/100)}`:``}s`;let n=Math.floor(t/60),r=t%60;if(n<60)return r>0?`${n}m ${r}s`:`${n}m`;let i=Math.floor(n/60),a=n%60;return a>0?`${i}h ${a}m`:`${i}h`}function t(e,t){return t?new Date(t).getTime()-new Date(e).getTime():null}function n(e){return Date.now()-new Date(e).getTime()}export{n,e as r,t};
|