@bpinhosilva/agent-orchestrator 1.1.2 → 1.2.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/CHANGELOG.md +21 -0
- package/README.md +7 -0
- package/dist/cli/commands/run.command.js +20 -1
- package/dist/cli/commands/setup.command.js +13 -0
- package/dist/cli/constants.js +2 -1
- package/dist/cli/env.js +2 -0
- package/dist/cli/preload.js +12 -0
- package/dist/cli/process-manager.js +33 -29
- package/dist/cli/setup/index.js +24 -0
- package/dist/cli/setup/validators.js +14 -0
- package/dist/common/postman/postman-conversion.js +57 -0
- package/dist/config/env.validation.js +6 -0
- package/dist/config/runtime-logger.js +214 -0
- package/dist/main.js +8 -0
- package/dist/tasks/recurrent-task-scheduler.service.js +3 -4
- package/dist/ui/assets/{AgentFleet-BarfEwcK.js → AgentFleet-B8p5vbKK.js} +1 -1
- package/dist/ui/assets/{AttachmentItem-Cerhbyya.js → AttachmentItem-C_uUACPz.js} +1 -1
- package/dist/ui/assets/{ConfirmDialog-y3vTcqFR.js → ConfirmDialog-BltdtevE.js} +1 -1
- package/dist/ui/assets/{CreateRecurrentTaskModal-BgfnJ1n8.js → CreateRecurrentTaskModal-CGSdgNAf.js} +1 -1
- package/dist/ui/assets/{CreateTaskModal-BH9lOLYT.js → CreateTaskModal-XNvIWKz3.js} +1 -1
- package/dist/ui/assets/{ExecLogModal-ShacCOOV.js → ExecLogModal-BYTGF04P.js} +1 -1
- package/dist/ui/assets/{MarkdownField--1gpyapw.js → MarkdownField-DR6tHsei.js} +1 -1
- package/dist/ui/assets/{Profile-qnuRN5Qv.js → Profile-ByioVLM8.js} +1 -1
- package/dist/ui/assets/{ProjectDetail-ZYQG9yn2.js → ProjectDetail-dwZDzb0m.js} +1 -1
- package/dist/ui/assets/{Providers-DR7srJHq.js → Providers-JAClEFt0.js} +1 -1
- package/dist/ui/assets/{Scheduler-Bs3DC0re.js → Scheduler-C1HQNxQ6.js} +2 -2
- package/dist/ui/assets/{Settings-C3ad44vP.js → Settings-Cjn2xdo1.js} +1 -1
- package/dist/ui/assets/{TaskDetail-D-f_Ao2a.js → TaskDetail-Blphf9tw.js} +1 -1
- package/dist/ui/assets/{TaskExecutions-BeodRIz1.js → TaskExecutions-ydR4KPCY.js} +3 -3
- package/dist/ui/assets/{TaskManager-BA2Y31ut.js → TaskManager-DrFbuAwN.js} +3 -3
- package/dist/ui/assets/{UserDetail-BvWm-U4y.js → UserDetail-mWjJPTzO.js} +1 -1
- package/dist/ui/assets/{Users-CQNcXLyV.js → Users-FaX0thJx.js} +1 -1
- package/dist/ui/assets/{activity-CmAajKmR.js → activity-B_2QSywM.js} +1 -1
- package/dist/ui/assets/{agents-b8btewki.js → agents-YQJ7JNfI.js} +1 -1
- package/dist/ui/assets/{auth-dROenHXk.js → auth-Lh2N3iYN.js} +1 -1
- package/dist/ui/assets/{bot-QVmnxPf4.js → bot-DadO9w3D.js} +1 -1
- package/dist/ui/assets/{box-Bw_pyYzU.js → box-CFDcDxHv.js} +1 -1
- package/dist/ui/assets/{brain-C6vlLcg3.js → brain-DWTpby6b.js} +1 -1
- package/dist/ui/assets/{briefcase-DtHlat45.js → briefcase-mFWNV6w9.js} +1 -1
- package/dist/ui/assets/check-BiORptL3.js +1 -0
- package/dist/ui/assets/chevron-down-BUOg3vvd.js +1 -0
- package/dist/ui/assets/chevron-left-B0NmQyxK.js +1 -0
- package/dist/ui/assets/chevron-right-Bm_d1KKk.js +1 -0
- package/dist/ui/assets/{circle-alert-pUx6yhcF.js → circle-alert-sCcf7ANF.js} +1 -1
- package/dist/ui/assets/circle-check-Jz8IOE4h.js +1 -0
- package/dist/ui/assets/client-B553SX3l.js +9 -0
- package/dist/ui/assets/clock-CSNFJjo4.js +1 -0
- package/dist/ui/assets/{cpu-8Sbc9Dk0.js → cpu-C2_GFeSH.js} +1 -1
- package/dist/ui/assets/{database-D6O4hvbm.js → database-zXW48-_N.js} +1 -1
- package/dist/ui/assets/{download-DHcd5oLD.js → download-DZdOdijy.js} +1 -1
- package/dist/ui/assets/{eye-Cc-vy4Zu.js → eye-CjrFwZG_.js} +1 -1
- package/dist/ui/assets/{file-text-DWBSXx5l.js → file-text-CX_Yqfjf.js} +1 -1
- package/dist/ui/assets/{index-BvUv9Lzq.js → index-IcLlFUZs.js} +3 -3
- package/dist/ui/assets/{info-1jA6X-_e.js → info-DGHChFI6.js} +1 -1
- package/dist/ui/assets/{layers-BcHXXg-4.js → layers-CVf8_Byb.js} +1 -1
- package/dist/ui/assets/loader-circle-CB6PQwdc.js +1 -0
- package/dist/ui/assets/{panels-top-left-Vk8FzAxf.js → panels-top-left-Cp169WzB.js} +1 -1
- package/dist/ui/assets/{paperclip-DWJjaP8B.js → paperclip-5Y367YTj.js} +1 -1
- package/dist/ui/assets/plus-CkteVqhM.js +1 -0
- package/dist/ui/assets/{projects-CUOthD8N.js → projects-DoalTI7c.js} +1 -1
- package/dist/ui/assets/{providers-CNrSTcdc.js → providers-AawjMy3x.js} +1 -1
- package/dist/ui/assets/{recurrent-tasks-CKT47N2l.js → recurrent-tasks-7thk45mk.js} +1 -1
- package/dist/ui/assets/{refresh-cw-DQW6jR7M.js → refresh-cw-BgDsJOC_.js} +1 -1
- package/dist/ui/assets/{rocket-CMSwBl_C.js → rocket-B9Iexkcw.js} +1 -1
- package/dist/ui/assets/{save-DycJmlX0.js → save-Cmqi1IkN.js} +1 -1
- package/dist/ui/assets/{send-BZjwSrJW.js → send-iK1X7WSe.js} +1 -1
- package/dist/ui/assets/{server-CJE2K1Vt.js → server-BBmM-vrg.js} +1 -1
- package/dist/ui/assets/{settings-at7JqFrc.js → settings-BpKLGxm8.js} +1 -1
- package/dist/ui/assets/{shield-alert-CP5GVXxa.js → shield-alert-Do_Sg9SX.js} +1 -1
- package/dist/ui/assets/{shield-check-Cr4SHjdR.js → shield-check-YKs9kUNq.js} +1 -1
- package/dist/ui/assets/{sparkles-v57Nc-z-.js → sparkles-krUpxie4.js} +1 -1
- package/dist/ui/assets/{taskFormSchemas-dl1t1OyX.js → taskFormSchemas-B6YlRxrx.js} +1 -1
- package/dist/ui/assets/{tasks-DEUQCNoH.js → tasks-DHsBE-ea.js} +1 -1
- package/dist/ui/assets/{terminal-a6AV2mPO.js → terminal-B6iyNuAm.js} +1 -1
- package/dist/ui/assets/{trash-2-DJpTXgEP.js → trash-2-CphQfk35.js} +1 -1
- package/dist/ui/assets/{trending-up-DlrXEXE6.js → trending-up-ClGbkbN9.js} +1 -1
- package/dist/ui/assets/user-Brcjlps5.js +1 -0
- package/dist/ui/assets/{user-plus-nDkwsBT1.js → user-plus-0Y0M1GKi.js} +1 -1
- package/dist/ui/assets/{users-C6WiDiuN.js → users-BcnlUG5N.js} +1 -1
- package/dist/ui/assets/{users-Ef6Sh2iR.js → users-tdyaGZbx.js} +1 -1
- package/dist/ui/assets/x-CCZGYGDC.js +1 -0
- package/dist/ui/assets/{zap-BmhZqgvm.js → zap-BDAytXMX.js} +1 -1
- package/dist/ui/index.html +17 -17
- package/package.json +9 -4
- package/dist/ui/assets/check-DTei8Qlg.js +0 -1
- package/dist/ui/assets/chevron-down-LTeQHW9O.js +0 -1
- package/dist/ui/assets/chevron-left-CJc_eQid.js +0 -1
- package/dist/ui/assets/chevron-right-G5-HRo_C.js +0 -1
- package/dist/ui/assets/circle-check-B9kyRki5.js +0 -1
- package/dist/ui/assets/client-BGOBXkO8.js +0 -9
- package/dist/ui/assets/clock-BY4rrypg.js +0 -1
- package/dist/ui/assets/loader-circle-Cl6yIkPK.js +0 -1
- package/dist/ui/assets/plus-Dx6G8SOZ.js +0 -1
- package/dist/ui/assets/user--KOoEB9m.js +0 -1
- package/dist/ui/assets/x-wDy15QMx.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{i as n,n as r,t as i}from"./vendor-query-xpDrc4rM.js";import{r as a}from"./vendor-markdown-DoJbQ1of.js";import{i as o}from"./client-BGOBXkO8.js";import{t as s}from"./activity-CmAajKmR.js";import{t as c}from"./box-Bw_pyYzU.js";import{t as l}from"./brain-C6vlLcg3.js";import{t as u}from"./check-DTei8Qlg.js";import{t as d}from"./chevron-down-LTeQHW9O.js";import{t as f}from"./circle-alert-pUx6yhcF.js";import{t as p}from"./circle-check-B9kyRki5.js";import{n as m,t as h}from"./terminal-a6AV2mPO.js";import{t as g}from"./MarkdownField--1gpyapw.js";import{r as _,t as v}from"./providers-CNrSTcdc.js";import{t as y}from"./layers-BcHXXg-4.js";import{t as b}from"./loader-circle-Cl6yIkPK.js";import{t as x}from"./plus-Dx6G8SOZ.js";import{t as S}from"./send-BZjwSrJW.js";import{t as C}from"./settings-at7JqFrc.js";import{t as w}from"./sparkles-v57Nc-z-.js";import{t as T}from"./trash-2-DJpTXgEP.js";import{t as E}from"./ConfirmDialog-y3vTcqFR.js";import{t as D}from"./x-wDy15QMx.js";import{n as O,t as k}from"./vendor-motion-CMGWJcqR.js";import{n as A,t as j}from"./agents-b8btewki.js";import{t as ee}from"./useNotification-DQayTSUL.js";import{a as M,i as te,r as N,t as P}from"./agentEmojis-BQA0jC3z.js";import{a as F,c as I,o as L,s as R}from"./vendor-forms-DHyqHeyd.js";import{r as z,t as B}from"./taskFormSchemas-dl1t1OyX.js";var ne=o(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),V=o(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),H=o(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),U=o(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),re=o(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),W=e(t(),1),G=a(),K={active:{color:`text-secondary`,bg:`bg-secondary/10`,dot:`bg-secondary`,animate:`animate-pulse`,icon:l},idle:{color:`text-on-surface-variant`,bg:`bg-on-surface-variant/10`,dot:`bg-on-surface-variant`,animate:``,icon:w},updating:{color:`text-primary`,bg:`bg-primary/10`,dot:`bg-primary`,animate:`animate-ping`,icon:s},inactive:{color:`text-error/60`,bg:`bg-error/5`,dot:`bg-error/40`,animate:``,icon:m}},q=({id:e,name:t,emoji:n,expertise:r,model:i,status:a,metricLabel:o,metricValue:s,onProbe:c,onConfigure:u,onDelete:d,onActivate:f})=>{let[p,m]=(0,W.useState)(!1),g=(0,W.useRef)(null),v=K[a];return(0,W.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&m(!1)};return p&&document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[p]),(0,G.jsxs)(`div`,{className:`group relative bg-surface-container-low rounded-xl p-6 transition-all duration-300 hover:translate-y-[-4px] shadow-lg border border-transparent hover:border-outline-variant/20`,children:[(0,G.jsxs)(`div`,{className:`absolute top-4 right-4 flex items-center gap-1.5 px-2.5 py-1 rounded-full ${v.bg} ${v.color} text-[10px] font-bold tracking-widest uppercase`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${v.dot} ${v.animate}`}),a]}),(0,G.jsxs)(`div`,{className:`flex gap-5`,children:[(0,G.jsx)(`div`,{className:`w-16 h-16 rounded-xl bg-surface-container-high flex items-center justify-center ring-1 ring-outline-variant/30 group-hover:ring-primary/50 transition-all text-3xl`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:n??`🧠`})}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:t}),(0,G.jsx)(`p`,{className:`text-on-surface-variant text-xs mt-1`,children:r}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/60 uppercase tracking-tighter`,children:`Model`}),(0,G.jsx)(`span`,{className:`text-xs font-semibold text-primary`,children:i})]}),(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/60 uppercase tracking-tighter`,children:o}),(0,G.jsx)(`span`,{className:`text-xs font-semibold ${v.color}`,children:s})]})]})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex gap-2`,children:[(0,G.jsx)(`button`,{onClick:t=>{t.stopPropagation(),u?.(e)},className:`flex-1 py-2 rounded bg-surface-container-high text-xs font-semibold text-on-surface hover:bg-surface-container-highest transition-colors`,children:`Configure`}),(0,G.jsxs)(`div`,{className:`relative`,ref:g,children:[(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),m(!p)},"aria-label":`Agent actions menu`,className:`px-3 py-2 rounded bg-surface-container-high text-on-surface-variant hover:text-white transition-colors h-full ${p?`bg-surface-container-highest text-white`:``}`,children:(0,G.jsx)(_,{size:16,"aria-hidden":`true`})}),p&&(0,G.jsxs)(`div`,{className:`absolute bottom-full right-0 mb-2 w-48 bg-surface-container-highest rounded-lg shadow-2xl py-2 ring-1 ring-outline-variant/20 animate-in fade-in slide-in-from-bottom-2 duration-200 z-20`,children:[(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),c?.(e),m(!1)},disabled:a===`inactive`,className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-on-surface-variant hover:text-white hover:bg-primary/10 transition-colors group disabled:opacity-30 disabled:grayscale disabled:cursor-not-allowed`,children:[(0,G.jsx)(h,{size:14,className:`group-hover:text-primary`}),`Probe Agent`]}),(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),u?.(e),m(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-on-surface-variant hover:text-white hover:bg-white/5 transition-colors`,children:[(0,G.jsx)(C,{size:14}),`Control Matrix`]}),(0,G.jsx)(`div`,{className:`my-1 border-t border-outline-variant/10`}),a===`inactive`?(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),f?.(e),m(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-secondary/60 hover:text-secondary hover:bg-secondary/10 transition-colors`,children:[(0,G.jsx)(l,{size:14}),`Activate Node`]}):(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),d?.(e),m(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-error/60 hover:text-error hover:bg-error/10 transition-colors`,children:[(0,G.jsx)(T,{size:14}),`Decommission`]})]})]})]})]})},ie=({isOpen:e,selectedEmoji:t,currentEmoji:n,isSaving:r,onSelect:i,onClose:a,onConfirm:o})=>((0,W.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&!r&&a()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r,a]),e?(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[110] flex items-center justify-center bg-black/70 px-4 py-8 backdrop-blur-md`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0`,"aria-hidden":`true`,onClick:()=>{r||a()}}),(0,G.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`agent-emoji-picker-title`,className:`relative w-full max-w-3xl overflow-hidden rounded-[28px] border border-outline-variant/20 bg-surface shadow-[0_35px_120px_rgba(0,0,0,0.55)]`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(173,198,255,0.16),transparent_35%),radial-gradient(circle_at_bottom_right,rgba(197,255,191,0.12),transparent_32%)]`}),(0,G.jsx)(`div`,{className:`relative border-b border-outline-variant/10 px-6 py-5`,children:(0,G.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-2 inline-flex items-center gap-2 rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-[10px] font-black uppercase tracking-[0.32em] text-primary`,children:[(0,G.jsx)(w,{size:12}),`Agent identity`]}),(0,G.jsx)(`h2`,{id:`agent-emoji-picker-title`,className:`font-headline text-2xl font-black tracking-tight text-on-surface`,children:`Choose an emoji signature`}),(0,G.jsx)(`p`,{className:`mt-2 max-w-xl text-sm leading-relaxed text-on-surface-variant`,children:`Pick one of the built-in native emojis to mark this agent across the fleet, tasks, and comments.`})]}),(0,G.jsx)(`button`,{type:`button`,onClick:a,disabled:r,"aria-label":`Close emoji picker`,className:`rounded-full border border-outline-variant/20 p-2 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface disabled:cursor-not-allowed disabled:opacity-50`,children:(0,G.jsx)(D,{size:18})})]})}),(0,G.jsxs)(`div`,{className:`relative p-6`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-5`,children:P.map(e=>{let r=e.value===t,a=e.value===n;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e.value),className:`group relative overflow-hidden rounded-3xl border p-4 text-left transition-all duration-200 ${r?`border-primary bg-primary/10 shadow-[0_18px_35px_rgba(173,198,255,0.16)]`:`border-outline-variant/20 bg-surface-container-low/80 hover:-translate-y-0.5 hover:border-primary/35 hover:bg-surface-container-high`}`,"aria-pressed":r,"aria-label":`${e.label} emoji ${e.value}`,children:[(0,G.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-2xl border border-white/5 bg-surface-container-high text-4xl shadow-inner shadow-black/20`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:e.value})}),(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-bold text-on-surface`,children:e.label}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-on-surface-variant`,children:e.hint})]}),r?(0,G.jsx)(`span`,{className:`inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary text-on-primary`,children:(0,G.jsx)(u,{size:14})}):null]}),(0,G.jsx)(`p`,{className:`mt-3 text-[11px] font-bold uppercase tracking-[0.24em] text-on-surface-variant/60`,children:a?`Current`:`Available`})]},e.value)})}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:a,disabled:r,className:`rounded-lg border border-outline-variant/20 px-5 py-2.5 text-sm font-bold text-on-surface-variant transition-colors hover:bg-surface-container-high disabled:cursor-not-allowed disabled:opacity-50`,children:`Cancel`}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>void o(),disabled:r||t===n,className:`flex items-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-on-primary transition-all hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-60`,children:[r?(0,G.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-on-primary/30 border-t-on-primary`}):null,`Save emoji`]})]})]})]})]}):null),J=[{label:`AI Optimized`,values:{creativity:3,strictness:3.5}},{label:`Creative`,values:{creativity:4.5,strictness:2}},{label:`Analyst`,values:{creativity:1.5,strictness:4.5}},{label:`Assistant`,values:{creativity:3,strictness:2.5}},{label:`Strict Expert`,values:{creativity:2,strictness:5}}],Y=1,X=5,Z=.01,Q=e=>(e??j.creativity).toFixed(2),ae=({value:e,onChange:t,readonly:n=!1})=>{let r=e.creativity??j.creativity,i=e.strictness??j.strictness;return(0,G.jsxs)(`section`,{className:`space-y-4`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Personality Matrix`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:J.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>t({...e.values}),disabled:n,"aria-label":e.label,className:`text-[10px] px-2 py-0.5 rounded bg-surface-container-highest hover:bg-tertiary/20 hover:text-tertiary border border-outline/20 transition-colors disabled:pointer-events-none disabled:opacity-50`,children:e.label},e.label))}),(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Creativity`}),(0,G.jsx)(`span`,{"data-testid":`creativity-value`,className:`text-primary font-mono font-bold`,children:Q(r)})]}),(0,G.jsx)(`input`,{type:`range`,min:Y,max:X,step:Z,value:r,onChange:n=>{t({...e,creativity:parseFloat(n.target.value)})},disabled:n,"aria-label":`Creativity`,"aria-valuemin":Y,"aria-valuemax":X,"aria-valuenow":r,className:`w-full accent-primary h-1 bg-surface-container-highest rounded-full appearance-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Strictness`}),(0,G.jsx)(`span`,{"data-testid":`strictness-value`,className:`text-secondary font-mono font-bold`,children:Q(i)})]}),(0,G.jsx)(`input`,{type:`range`,min:Y,max:X,step:Z,value:i,onChange:n=>{t({...e,strictness:parseFloat(n.target.value)})},disabled:n,"aria-label":`Strictness`,"aria-valuemin":Y,"aria-valuemax":X,"aria-valuenow":i,className:`w-full accent-secondary h-1 bg-surface-container-highest rounded-full appearance-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`})]})]})]})},oe=({isOpen:e,onClose:t,onUpdated:n,agent:r})=>{let{notifyError:i,notifySuccess:a}=ee(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[_,y]=(0,W.useState)(``),[x,S]=(0,W.useState)(``),[C,w]=(0,W.useState)(``),[T,E]=(0,W.useState)(``),[O,k]=(0,W.useState)([]),[N,P]=(0,W.useState)(``),[F,I]=(0,W.useState)([]),[L,R]=(0,W.useState)(``),[z,B]=(0,W.useState)(`🧠`),[V,H]=(0,W.useState)(!1),[U,K]=(0,W.useState)({...j});(0,W.useEffect)(()=>{e&&r&&(y(r.name||``),S(r.role||``),w(r.description||``),E(r.systemInstructions||``),R(r.model?.id||``),B(M(r.emoji)),P(r.model?.provider?.id??``),K(r.attributes??{...j}))},[e,r]),(0,W.useEffect)(()=>{e&&(async()=>{try{p(!0);let{data:e}=await v.findAll();k(e)}catch{}finally{p(!1)}})()},[e]),(0,W.useEffect)(()=>{if(!N){I([]);return}(async()=>{try{l(!0);let{data:e}=await v.findModels(N);I(e),L&&!e.find(e=>e.id===L)&&R(e[0]?.id??``)}catch{I([])}finally{l(!1)}})()},[N,L]);let q=()=>{r?.id&&(navigator.clipboard.writeText(r.id),h(!0),a(`Copied`,`Agent ID copied to clipboard`),setTimeout(()=>h(!1),2e3))},J=async()=>{if(r?.id)try{s(!0),await A.update(r.id,{name:_,emoji:z,role:x,description:C,systemInstructions:T,modelId:L||void 0,attributes:U}),n?.(),t()}catch{i(`Update Failed`,`An error occurred while saving the configuration.`)}finally{s(!1)}};return(0,W.useEffect)(()=>{let n=e=>{e.key===`Escape`&&!V&&t()};return e&&window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[V,e,t]),e?(0,G.jsxs)(`div`,{className:`fixed inset-y-0 right-0 w-[420px] bg-surface-container-low shadow-2xl z-[60] flex flex-col ring-1 ring-outline-variant/10 animate-in slide-in-from-right duration-300`,children:[(0,G.jsxs)(`div`,{className:`p-6 border-b border-outline-variant/10 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Agent Configuration`}),(0,G.jsxs)(`p`,{className:`text-[10px] text-on-surface-variant uppercase tracking-widest mt-0.5`,children:[`Edit Profile: `,r?.name||`Logic Specialist`]})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors`,children:(0,G.jsx)(D,{size:20})})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-8 scrollbar-hide`,children:[(0,G.jsxs)(`section`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>H(!0),className:`relative flex h-20 w-20 items-center justify-center overflow-hidden rounded-2xl bg-surface-container-high ring-1 ring-outline-variant/50 transition-all hover:ring-primary/40`,"aria-label":`Change agent emoji`,children:[(0,G.jsx)(`span`,{className:`text-4xl text-secondary`,children:z}),(0,G.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/60 opacity-0 transition-opacity hover:opacity-100 text-white`,children:(0,G.jsx)(re,{size:16})})]}),(0,G.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Emoji Signature`}),(0,G.jsx)(`p`,{className:`text-xs font-semibold text-on-surface`,children:te(z).label}),(0,G.jsx)(`p`,{className:`text-[11px] text-on-surface-variant/70`,children:te(z).hint})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Agent Name`}),(0,G.jsx)(`input`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-9 px-3`,type:`text`,value:_,onChange:e=>y(e.target.value)})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Agent ID`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`input`,{className:`flex-1 bg-surface-container-lowest/50 border-none rounded-md text-[10px] font-mono text-on-surface-variant focus:ring-0 h-8 px-3 cursor-default`,type:`text`,value:r?.id||``,readOnly:!0}),(0,G.jsx)(`button`,{onClick:q,className:`p-1.5 rounded bg-surface-container-highest hover:bg-surface-container-highest/80 text-on-surface-variant transition-colors flex items-center justify-center aspect-square h-8`,title:`Copy ID`,children:m?(0,G.jsx)(u,{size:14,className:`text-primary`}):(0,G.jsx)(ne,{size:14})})]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Role`}),(0,G.jsx)(`input`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-9 px-3 placeholder:text-on-surface-variant/30`,type:`text`,placeholder:`e.g. Researcher, Developer...`,value:x,onChange:e=>S(e.target.value)})]})]}),(0,G.jsx)(g,{label:`Description`,value:C,onChange:w,placeholder:`Detailed agent profile...`,height:`h-32`,maxLength:1e3}),(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Provider`}),f&&(0,G.jsx)(b,{size:12,className:`animate-spin text-primary`})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-11 appearance-none px-4 disabled:opacity-50`,value:N,onChange:e=>P(e.target.value),disabled:f,children:[(0,G.jsx)(`option`,{value:``,children:`Select a provider...`}),O.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(d,{className:`absolute right-3 top-3 pointer-events-none text-on-surface-variant/60`,size:18})]})]}),(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Model Engine`}),c&&(0,G.jsx)(b,{size:12,className:`animate-spin text-primary`})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-11 appearance-none px-4 disabled:opacity-50`,value:L,onChange:e=>R(e.target.value),disabled:c||F.length===0,children:[F.length===0&&!c&&(0,G.jsx)(`option`,{value:``,children:`No models available for this provider`}),F.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(d,{className:`absolute right-3 top-3 pointer-events-none text-on-surface-variant/60`,size:18})]})]}),(0,G.jsx)(ae,{value:U,onChange:K}),(0,G.jsx)(g,{label:`System Instructions`,value:T,onChange:E,placeholder:`Define operational logic...`,height:`h-64`,maxLength:2e3})]}),(0,G.jsxs)(`div`,{className:`p-6 bg-surface-container-high border-t border-outline-variant/10 flex gap-3`,children:[(0,G.jsx)(`button`,{onClick:()=>{J()},disabled:o,className:`flex-1 bg-primary text-on-primary py-2.5 rounded font-bold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 transition-all flex items-center justify-center gap-2 active:scale-95 disabled:opacity-50`,children:o?(0,G.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(u,{size:16}),`Save Changes`]})}),(0,G.jsx)(`button`,{onClick:t,className:`px-4 py-2.5 rounded border border-outline-variant text-on-surface-variant hover:text-white transition-all`,children:`Reset`})]}),(0,G.jsx)(ie,{isOpen:V,selectedEmoji:z,currentEmoji:M(r?.emoji),isSaving:o,onSelect:B,onClose:()=>H(!1),onConfirm:()=>H(!1)})]}):null},se={name:``,role:``,description:``,emoji:N,providerId:``,modelId:``,instructions:B,attributes:{...j}},ce=[{id:1,title:`Essential Config`,subtitle:`ID, ROLE & MODEL`},{id:2,title:`Intelligence Tuning`,subtitle:`COGNITIVE MATRIX`},{id:3,title:`Instructions`,subtitle:`KNOWLEDGE BASE`}],$=({isOpen:e,onClose:t,onCreated:a})=>{let o=n(),{notifyApiError:s,notifyError:l,notifySuccess:u}=ee(),[f,p]=(0,W.useState)(1),[m,h]=(0,W.useState)(!1),_=(0,W.useId)(),b=(0,W.useId)(),x=(0,W.useId)(),S=(0,W.useId)(),C=(0,W.useId)(),T=(0,W.useId)(),E=(0,W.useId)(),D=(0,W.useId)(),{control:P,formState:{errors:B},handleSubmit:ne,register:V,reset:H,setValue:U}=R({resolver:F(z),defaultValues:se,mode:`onBlur`}),K=I({control:P,name:`providerId`}),q=I({control:P,name:`modelId`}),J=I({control:P,name:`emoji`}),Y=r({queryKey:[`providers`],enabled:e,queryFn:async()=>(await v.findAll()).data}),X=r({queryKey:[`provider-models`,K],enabled:e&&!!K,queryFn:async()=>(await v.findModels(K)).data});(0,W.useEffect)(()=>{if(!e){H(se);return}let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,H]),(0,W.useEffect)(()=>{e&&Y.error&&s(Y.error,`Providers Load Failed`)},[e,s,Y.error]),(0,W.useEffect)(()=>{e&&X.error&&s(X.error,`Models Load Failed`)},[e,X.error,s]);let Z=(0,W.useMemo)(()=>Y.data??[],[Y.data]),Q=(0,W.useMemo)(()=>X.data??[],[X.data]);(0,W.useEffect)(()=>{if(e){if(Z.length===0){K&&U(`providerId`,``,{shouldDirty:!1,shouldValidate:!0});return}(!K||!Z.some(e=>e.id===K))&&U(`providerId`,Z[0].id,{shouldDirty:!1,shouldValidate:!0})}},[e,K,Z,U]),(0,W.useEffect)(()=>{if(e){if(!K){q&&U(`modelId`,``,{shouldDirty:!1,shouldValidate:!0});return}if(Q.length===0){q&&U(`modelId`,``,{shouldDirty:!1,shouldValidate:!0});return}(!q||!Q.some(e=>e.id===q))&&U(`modelId`,Q[0].id,{shouldDirty:!1,shouldValidate:!0})}},[Q,e,q,K,U]);let oe=i({mutationFn:async e=>(await A.create({name:e.name,emoji:e.emoji,role:e.role,description:e.description,systemInstructions:e.instructions,modelId:e.modelId,status:`active`,attributes:e.attributes}),e),onSuccess:e=>{o.invalidateQueries({queryKey:[`agents`]}),u(`Agent Deployed`,`Successfully commissioned ${e.name} into the fleet.`),a?.(),t(),H(se),p(1)},onError:e=>{s(e,`Deployment Failed`)}}),$=oe.isPending,le=Y.isPending||X.isPending,ue=ne(async e=>{await oe.mutateAsync(e)},()=>{l(`Validation Error`,`Please review the highlighted fields before deploying the agent.`)}),de=()=>{$||(p(1),t())};return e?(0,G.jsx)(O,{children:(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4 md:p-8`,children:[(0,G.jsx)(k.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:de,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`,"aria-hidden":`true`}),(0,G.jsxs)(k.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},role:`dialog`,"aria-modal":`true`,"aria-labelledby":_,"aria-describedby":b,"aria-busy":$||le,className:`relative w-full max-w-5xl h-full max-h-[850px] bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md sticky top-0 z-10`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{id:_,className:`text-2xl font-black font-headline text-white tracking-tight`,children:`Create New Agent`}),(0,G.jsx)(`p`,{id:b,className:`text-sm text-on-surface-variant/80 mt-1`,children:`Configure a specialized AI persona to handle specific nodes in your automation flows.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:de,disabled:$,className:`px-6 py-2.5 rounded-md text-sm font-bold text-on-surface-variant hover:text-white transition-all disabled:opacity-50 disabled:cursor-not-allowed`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:ue,disabled:$||Z.length===0||Q.length===0,className:`px-8 py-2.5 rounded-md bg-primary text-on-primary text-sm font-bold shadow-lg shadow-primary/20 hover:scale-[1.02] active:scale-[0.98] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed disabled:hover:scale-100`,children:$?`Deploying...`:`Deploy Agent`})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 flex overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`w-72 bg-surface-container-low/30 border-r border-outline-variant/5 p-8 flex flex-col gap-10`,children:[(0,G.jsx)(`div`,{className:`space-y-8`,children:ce.map(e=>(0,G.jsxs)(`button`,{type:`button`,className:`flex gap-4 group cursor-pointer text-left w-full`,onClick:()=>p(e.id),"aria-pressed":f===e.id,children:[(0,G.jsx)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center text-[10px] font-black transition-all ${f===e.id?`bg-secondary text-surface`:`bg-surface-container-highest text-on-surface-variant`}`,children:e.id.toString().padStart(2,`0`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`text-xs font-bold font-headline transition-colors ${f===e.id?`text-white`:`text-on-surface-variant`}`,children:e.title}),(0,G.jsx)(`p`,{className:`text-[9px] font-bold tracking-widest text-on-surface-variant/50 mt-0.5`,children:e.subtitle})]})]},e.id))}),(0,G.jsxs)(`div`,{className:`mt-auto bg-tertiary/10 rounded-xl p-5 ring-1 ring-tertiary/20 backdrop-blur-sm relative overflow-hidden group`,children:[(0,G.jsx)(`div`,{className:`absolute -right-4 -top-4 w-16 h-16 bg-tertiary/10 rounded-full blur-2xl group-hover:bg-tertiary/20 transition-all duration-700`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 text-tertiary`,children:[(0,G.jsx)(w,{size:14,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-widest`,children:`AI Suggestion`})]}),(0,G.jsxs)(`p`,{className:`text-[11px] text-on-surface-variant leading-relaxed italic`,children:[`"Try selecting `,(0,G.jsx)(`span`,{className:`text-tertiary font-bold`,children:`Researcher`}),` role for high-depth data synthesis tasks."`]})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-10 space-y-12 custom-scrollbar`,children:[(0,G.jsxs)(`section`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-secondary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Basic Configuration`})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>h(!0),className:`group flex w-full items-center justify-between rounded-[24px] border border-outline-variant/10 bg-surface-container-highest/20 p-5 text-left transition-all hover:border-primary/30 hover:bg-surface-container-highest/35`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(`div`,{className:`flex h-20 w-20 items-center justify-center rounded-[20px] border border-primary/20 bg-surface-container-high text-5xl shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:M(J)})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-[0.32em] text-primary/80`,children:`Emoji signature`}),(0,G.jsx)(`h4`,{className:`mt-2 font-headline text-xl font-black text-white`,children:te(J).label}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-on-surface-variant`,children:te(J).hint})]})]}),(0,G.jsx)(`span`,{className:`inline-flex h-10 w-10 items-center justify-center rounded-full border border-outline-variant/20 bg-surface-container-high text-on-surface-variant transition-colors group-hover:text-on-surface`,children:(0,G.jsx)(re,{size:16,"aria-hidden":`true`})})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-6`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-name`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Agent Name`}),(0,G.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all`,children:(0,G.jsx)(`input`,{id:`create-agent-name`,type:`text`,placeholder:`e.g. Researcher-X`,"aria-invalid":!!B.name,"aria-describedby":B.name?x:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-3 focus:outline-none placeholder:text-on-surface-variant/30`,...V(`name`)})}),B.name&&(0,G.jsx)(`p`,{id:x,className:`text-xs text-error font-semibold`,children:B.name.message})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-role`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Primary Role`}),(0,G.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all text-on-surface`,children:(0,G.jsx)(`input`,{id:`create-agent-role`,type:`text`,placeholder:`e.g. Researcher`,"aria-invalid":!!B.role,"aria-describedby":B.role?S:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-4 focus:outline-none placeholder:text-on-surface-variant/30`,...V(`role`)})}),B.role&&(0,G.jsx)(`p`,{id:S,className:`text-xs text-error font-semibold`,children:B.role.message})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(L,{control:P,name:`description`,render:({field:e})=>(0,G.jsx)(g,{label:`Description`,value:e.value,onChange:e.onChange,placeholder:`Define what this agent aims to achieve... You can use markdown for formatting.`,height:`h-32`,maxLength:1e3})}),B.description&&(0,G.jsx)(`p`,{id:C,className:`text-xs text-error font-semibold`,children:B.description.message})]}),(0,G.jsxs)(`div`,{className:`pt-4 space-y-8 border-t border-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Select Provider`}),le&&(0,G.jsx)(`span`,{className:`text-[10px] text-primary animate-pulse font-bold uppercase tracking-widest`,children:`Updating...`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[Z.map(e=>(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":K===e.id,onClick:()=>{K!==e.id&&(U(`providerId`,e.id,{shouldDirty:!0,shouldValidate:!0}),U(`modelId`,``,{shouldDirty:!0,shouldValidate:!1}))},className:`p-4 rounded-xl flex flex-col items-center gap-3 transition-all ${K===e.id?`bg-primary/10 ring-2 ring-primary shadow-[0_0_20px_rgba(173,198,255,0.15)]`:`bg-surface-container-highest/30 ring-1 ring-outline-variant/10 hover:bg-surface-container-highest/50`}`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-lg flex items-center justify-center transition-colors ${K===e.id?`bg-primary text-surface`:`bg-surface-container-high text-on-surface-variant`}`,children:(0,G.jsx)(c,{size:20,"aria-hidden":`true`})}),(0,G.jsx)(`div`,{className:`text-center`,children:(0,G.jsx)(`h4`,{className:`text-xs font-black uppercase tracking-wider ${K===e.id?`text-white`:`text-on-surface-variant`}`,children:e.name})})]},e.id)),Z.length===0&&!Y.isPending&&(0,G.jsxs)(`div`,{className:`col-span-4 py-8 border-2 border-dashed border-outline-variant/10 rounded-xl flex flex-col items-center justify-center text-on-surface-variant/40 gap-2`,children:[(0,G.jsx)(y,{size:24,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`No providers registered`})]})]}),B.providerId&&(0,G.jsx)(`p`,{id:T,className:`text-xs text-error font-semibold`,children:B.providerId.message})]}),(0,G.jsx)(O,{mode:`wait`,children:K&&(0,G.jsxs)(k.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:`space-y-4 pt-4 border-t border-outline-variant/5`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-model`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Model Variant Selection`}),(0,G.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,G.jsxs)(`select`,{id:`create-agent-model`,value:q,onChange:e=>U(`modelId`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),"aria-invalid":!!B.modelId,"aria-describedby":B.modelId?E:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-3 focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:``,disabled:!0,className:`bg-surface-container-low text-on-surface`,children:`Select a model...`}),Q.map(e=>(0,G.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface`,children:e.name},e.id))]}),(0,G.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,G.jsx)(d,{size:18,"aria-hidden":`true`})})]}),B.modelId&&(0,G.jsx)(`p`,{id:E,className:`text-xs text-error font-semibold`,children:B.modelId.message}),Q.length===0&&!X.isPending&&(0,G.jsx)(`div`,{className:`py-6 text-center bg-error/5 rounded-xl border border-error/10`,children:(0,G.jsx)(`span`,{className:`text-[10px] font-bold text-error uppercase tracking-widest opacity-60`,children:`No model variants found for this provider`})})]},K)})]})]}),(0,G.jsxs)(`section`,{className:`space-y-10`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-primary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Intelligence Tuning`})]}),(0,G.jsx)(L,{control:P,name:`attributes`,render:({field:e})=>(0,G.jsx)(ae,{value:e.value??{...j},onChange:e.onChange})})]}),(0,G.jsxs)(`section`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-tertiary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Operational Directives`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(L,{control:P,name:`instructions`,render:({field:e})=>(0,G.jsx)(g,{label:`System Instructions`,value:e.value,onChange:e.onChange,height:`h-64`,helperText:`Prompt Engineering Active`,maxLength:1e3})}),B.instructions&&(0,G.jsx)(`p`,{id:D,className:`text-xs text-error font-semibold`,children:B.instructions.message})]})]})]})]})]}),(0,G.jsx)(ie,{isOpen:m,selectedEmoji:M(J),currentEmoji:N,isSaving:$,onSelect:e=>U(`emoji`,e,{shouldDirty:!0,shouldValidate:!0}),onClose:()=>h(!1),onConfirm:()=>h(!1)})]})}):null},le=({isOpen:e,onClose:t,agent:n})=>{let r=`Wake up, who are you?`,[i,a]=(0,W.useState)(r),[o,c]=(0,W.useState)(``),[u,d]=(0,W.useState)(),[m,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(`idle`);return(0,W.useEffect)(()=>{let n=e=>{e.key===`Escape`&&t()};return e&&(window.addEventListener(`keydown`,n),c(``),d(void 0),v(`idle`),a(r)),()=>window.removeEventListener(`keydown`,n)},[e,t]),e?(0,G.jsx)(O,{children:(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4`,children:[(0,G.jsx)(k.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`}),(0,G.jsxs)(k.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`relative w-full max-w-2xl bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`px-6 py-4 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary`,children:(0,G.jsx)(l,{size:20})}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-xl font-black font-headline text-white tracking-tight`,children:[`Probe: `,n?.name]}),(0,G.jsx)(`p`,{className:`text-[10px] text-on-surface-variant uppercase tracking-widest font-bold`,children:`Neural Direct Message`})]})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors p-2`,children:(0,G.jsx)(D,{size:20})})]}),(0,G.jsxs)(`div`,{className:`p-6 space-y-6 max-h-[80vh] overflow-y-auto scrollbar-hide`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(h,{size:12}),`Command Input`]}),(0,G.jsxs)(`div`,{className:`relative group`,children:[(0,G.jsx)(`textarea`,{value:i,onChange:e=>a(e.target.value),placeholder:`Type your command...`,className:`w-full bg-surface-container-highest/30 rounded-xl p-4 text-sm text-on-surface h-32 focus:outline-none focus:ring-2 focus:ring-primary/40 transition-all resize-none border border-outline-variant/10 group-hover:border-outline-variant/30`}),(0,G.jsx)(`button`,{onClick:async()=>{if(!(!n?.id||!i.trim()))try{g(!0),v(`idle`),c(`Awaiting response from neural node...`),d(void 0);let{data:e}=await A.probe(n.id,i);c(e.content),d(e.image),v(`success`)}catch(e){let t=`An unexpected error occurred during the probe.`;if(e&&typeof e==`object`&&`response`in e){let n=e;t=n.response?.data?.message||n.message||t}else e instanceof Error&&(t=e.message);c(`ERROR: ${t}`),v(`error`)}finally{g(!1)}},disabled:m||!i.trim(),className:`absolute bottom-3 right-3 p-2.5 rounded-lg bg-primary text-on-primary shadow-lg shadow-primary/20 hover:scale-[1.05] active:scale-[0.95] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group`,children:m?(0,G.jsx)(b,{size:18,className:`animate-spin`}):(0,G.jsx)(S,{size:18})})]})]}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(s,{size:12,className:m?`animate-pulse`:``}),`Neural Response`]}),_===`success`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-[9px] font-black text-secondary uppercase bg-secondary/10 px-2 py-0.5 rounded`,children:[(0,G.jsx)(p,{size:10}),` Sync Complete`]}),_===`error`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-[9px] font-black text-error uppercase bg-error/10 px-2 py-0.5 rounded`,children:[(0,G.jsx)(f,{size:10}),` Link Severed`]})]}),(0,G.jsx)(`div`,{className:`w-full min-h-[100px] bg-black/40 rounded-xl p-5 border border-outline-variant/5 font-mono text-sm leading-relaxed transition-all duration-500 whitespace-pre-wrap ${_===`error`?`text-error/80 border-error/20`:_===`success`?`text-secondary/90 border-secondary/20 shadow-[inset_0_0_20px_rgba(102,231,175,0.05)]`:`text-on-surface-variant/60`}`,children:o||`Enter a command and initiate the probe to see the agent response.`}),(0,G.jsx)(O,{children:u&&(0,G.jsxs)(k.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(H,{size:12}),`Visual Output`]}),(0,G.jsxs)(`div`,{className:`relative rounded-xl overflow-hidden border border-outline-variant/10 bg-surface-container-highest/20 group`,children:[(0,G.jsx)(`img`,{src:`data:image/png;base64,${u}`,alt:`Neural Output`,className:`w-full h-auto max-h-[400px] object-contain mx-auto`}),(0,G.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 p-3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,G.jsx)(`span`,{className:`text-[10px] font-bold text-white uppercase tracking-wider`,children:`Generated Content`})})]})]})})]})]}),(0,G.jsx)(`div`,{className:`px-6 py-4 bg-surface-container-high/50 border-t border-outline-variant/10 flex justify-end`,children:(0,G.jsx)(`button`,{onClick:t,className:`px-6 py-2 rounded-lg text-sm font-bold text-on-surface hover:bg-surface-container-highest transition-all`,children:`Close Terminal`})})]})]})}):null},ue=()=>{let{notifySuccess:e,notifyApiError:t}=ee(),a=n(),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(`grid`),{data:v=[],isLoading:y}=r({queryKey:[`agents`],queryFn:async()=>{let{data:e}=await A.findAll();return e}}),S=(0,W.useCallback)(()=>a.invalidateQueries({queryKey:[`agents`]}),[a]),C=i({mutationFn:e=>A.delete(e),onSuccess:()=>{e(`Agent Inactivated`,`Neural node has been marked as inactive.`),h(!1),S()},onError:e=>t(e,`Operation Failed`)}),w=i({mutationFn:e=>A.update(e,{status:`active`}),onSuccess:()=>{e(`Neural Link Restored`,`The agent has been reactivated and synchronized.`),S()},onError:e=>t(e,`Activation Failed`)}),T=e=>{s(e),l(!0)},D=e=>{s(e),p(!0)},O=e=>{s(e),h(!0)},k=()=>{o&&C.mutate(o.id)},j=e=>{w.mutate(e)};return(0,G.jsxs)(`div`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-4xl font-extrabold font-headline tracking-tight text-white`,children:`Agent Fleet`}),(0,G.jsxs)(`p`,{className:`text-on-surface-variant mt-2 font-body text-sm`,children:[`Commanding `,(0,G.jsx)(`span`,{className:`text-secondary font-bold`,children:v.filter(e=>e.status!==`inactive`).length}),` active neural nodes across the network.`]})]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`button`,{onClick:()=>_(`grid`),"aria-label":`Grid view`,"aria-pressed":g===`grid`,className:`p-2 rounded transition-colors ${g===`grid`?`bg-surface-container-high text-white`:`text-on-surface-variant hover:text-white`}`,children:(0,G.jsx)(V,{size:20,"aria-hidden":`true`})}),(0,G.jsx)(`button`,{onClick:()=>_(`list`),"aria-label":`List view`,"aria-pressed":g===`list`,className:`p-2 rounded transition-colors ${g===`list`?`bg-surface-container-high text-white`:`text-on-surface-variant hover:text-white`}`,children:(0,G.jsx)(U,{size:20,"aria-hidden":`true`})})]})]}),y?(0,G.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,G.jsx)(b,{className:`w-12 h-12 text-primary animate-spin`})}):(0,G.jsxs)(`div`,{className:g===`grid`?`grid grid-cols-1 xl:grid-cols-2 2xl:grid-cols-3 gap-6`:`flex flex-col gap-4`,children:[v.map(e=>(0,G.jsx)(`div`,{onClick:()=>T(e),className:e.status===`inactive`?`opacity-50 grayscale hover:grayscale-0 transition-all`:``,children:(0,G.jsx)(q,{id:e.id,name:e.name,emoji:e.emoji,expertise:e.role||`General Assistant`,model:e.model?.name||`Unknown`,status:e.status||`active`,metricLabel:`Provider`,metricValue:e.model?.provider?.name||`Unknown`,onConfigure:()=>T(e),onProbe:()=>D(e),onDelete:()=>O(e),onActivate:()=>j(e.id)})},e.id)),(0,G.jsxs)(`div`,{onClick:()=>d(!0),className:`border-2 border-dashed border-outline-variant/30 rounded-xl p-6 flex flex-col items-center justify-center text-center group cursor-pointer hover:border-primary/50 transition-all hover:bg-primary/5`,children:[(0,G.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-surface-container-low flex items-center justify-center mb-4 group-hover:scale-110 transition-transform`,children:(0,G.jsx)(x,{size:24,className:`text-primary`})}),(0,G.jsx)(`span`,{className:`text-sm font-bold font-headline text-on-surface-variant group-hover:text-on-surface`,children:`Deploy New Agent`}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant/60 mt-1 max-w-[200px]`,children:`Expand your fleet with specialized intelligence units.`})]})]}),(0,G.jsx)(oe,{isOpen:c,onClose:()=>l(!1),onUpdated:S,agent:o},o?.id||`none`),(0,G.jsx)(le,{isOpen:f,onClose:()=>p(!1),agent:o}),(0,G.jsx)($,{isOpen:u,onClose:()=>d(!1),onCreated:S}),(0,G.jsx)(E,{isOpen:m,onClose:()=>h(!1),onConfirm:k,title:`Decommission Neural Node?`,message:`This will mark ${o?.name} as inactive. The agent will remain in the database but will no longer be available for automated tasks or direct neural connection.`,confirmText:`Decommission`,variant:`danger`})]})};export{ue as default};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{i as n,n as r,t as i}from"./vendor-query-xpDrc4rM.js";import{r as a}from"./vendor-markdown-DoJbQ1of.js";import{i as o}from"./client-B553SX3l.js";import{t as s}from"./activity-B_2QSywM.js";import{t as c}from"./box-CFDcDxHv.js";import{t as l}from"./brain-DWTpby6b.js";import{t as u}from"./check-BiORptL3.js";import{t as d}from"./chevron-down-BUOg3vvd.js";import{t as f}from"./circle-alert-sCcf7ANF.js";import{t as p}from"./circle-check-Jz8IOE4h.js";import{n as m,t as h}from"./terminal-B6iyNuAm.js";import{t as g}from"./MarkdownField-DR6tHsei.js";import{r as _,t as v}from"./providers-AawjMy3x.js";import{t as y}from"./layers-CVf8_Byb.js";import{t as b}from"./loader-circle-CB6PQwdc.js";import{t as x}from"./plus-CkteVqhM.js";import{t as S}from"./send-iK1X7WSe.js";import{t as C}from"./settings-BpKLGxm8.js";import{t as w}from"./sparkles-krUpxie4.js";import{t as T}from"./trash-2-CphQfk35.js";import{t as E}from"./ConfirmDialog-BltdtevE.js";import{t as D}from"./x-CCZGYGDC.js";import{n as O,t as k}from"./vendor-motion-CMGWJcqR.js";import{n as A,t as j}from"./agents-YQJ7JNfI.js";import{t as ee}from"./useNotification-DQayTSUL.js";import{a as M,i as te,r as N,t as P}from"./agentEmojis-BQA0jC3z.js";import{a as F,c as I,o as L,s as R}from"./vendor-forms-DHyqHeyd.js";import{r as z,t as B}from"./taskFormSchemas-B6YlRxrx.js";var ne=o(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),V=o(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),H=o(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),U=o(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),re=o(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),W=e(t(),1),G=a(),K={active:{color:`text-secondary`,bg:`bg-secondary/10`,dot:`bg-secondary`,animate:`animate-pulse`,icon:l},idle:{color:`text-on-surface-variant`,bg:`bg-on-surface-variant/10`,dot:`bg-on-surface-variant`,animate:``,icon:w},updating:{color:`text-primary`,bg:`bg-primary/10`,dot:`bg-primary`,animate:`animate-ping`,icon:s},inactive:{color:`text-error/60`,bg:`bg-error/5`,dot:`bg-error/40`,animate:``,icon:m}},q=({id:e,name:t,emoji:n,expertise:r,model:i,status:a,metricLabel:o,metricValue:s,onProbe:c,onConfigure:u,onDelete:d,onActivate:f})=>{let[p,m]=(0,W.useState)(!1),g=(0,W.useRef)(null),v=K[a];return(0,W.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&m(!1)};return p&&document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[p]),(0,G.jsxs)(`div`,{className:`group relative bg-surface-container-low rounded-xl p-6 transition-all duration-300 hover:translate-y-[-4px] shadow-lg border border-transparent hover:border-outline-variant/20`,children:[(0,G.jsxs)(`div`,{className:`absolute top-4 right-4 flex items-center gap-1.5 px-2.5 py-1 rounded-full ${v.bg} ${v.color} text-[10px] font-bold tracking-widest uppercase`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${v.dot} ${v.animate}`}),a]}),(0,G.jsxs)(`div`,{className:`flex gap-5`,children:[(0,G.jsx)(`div`,{className:`w-16 h-16 rounded-xl bg-surface-container-high flex items-center justify-center ring-1 ring-outline-variant/30 group-hover:ring-primary/50 transition-all text-3xl`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:n??`🧠`})}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:t}),(0,G.jsx)(`p`,{className:`text-on-surface-variant text-xs mt-1`,children:r}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/60 uppercase tracking-tighter`,children:`Model`}),(0,G.jsx)(`span`,{className:`text-xs font-semibold text-primary`,children:i})]}),(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/60 uppercase tracking-tighter`,children:o}),(0,G.jsx)(`span`,{className:`text-xs font-semibold ${v.color}`,children:s})]})]})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex gap-2`,children:[(0,G.jsx)(`button`,{onClick:t=>{t.stopPropagation(),u?.(e)},className:`flex-1 py-2 rounded bg-surface-container-high text-xs font-semibold text-on-surface hover:bg-surface-container-highest transition-colors`,children:`Configure`}),(0,G.jsxs)(`div`,{className:`relative`,ref:g,children:[(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),m(!p)},"aria-label":`Agent actions menu`,className:`px-3 py-2 rounded bg-surface-container-high text-on-surface-variant hover:text-white transition-colors h-full ${p?`bg-surface-container-highest text-white`:``}`,children:(0,G.jsx)(_,{size:16,"aria-hidden":`true`})}),p&&(0,G.jsxs)(`div`,{className:`absolute bottom-full right-0 mb-2 w-48 bg-surface-container-highest rounded-lg shadow-2xl py-2 ring-1 ring-outline-variant/20 animate-in fade-in slide-in-from-bottom-2 duration-200 z-20`,children:[(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),c?.(e),m(!1)},disabled:a===`inactive`,className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-on-surface-variant hover:text-white hover:bg-primary/10 transition-colors group disabled:opacity-30 disabled:grayscale disabled:cursor-not-allowed`,children:[(0,G.jsx)(h,{size:14,className:`group-hover:text-primary`}),`Probe Agent`]}),(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),u?.(e),m(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-on-surface-variant hover:text-white hover:bg-white/5 transition-colors`,children:[(0,G.jsx)(C,{size:14}),`Control Matrix`]}),(0,G.jsx)(`div`,{className:`my-1 border-t border-outline-variant/10`}),a===`inactive`?(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),f?.(e),m(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-secondary/60 hover:text-secondary hover:bg-secondary/10 transition-colors`,children:[(0,G.jsx)(l,{size:14}),`Activate Node`]}):(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),d?.(e),m(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-error/60 hover:text-error hover:bg-error/10 transition-colors`,children:[(0,G.jsx)(T,{size:14}),`Decommission`]})]})]})]})]})},ie=({isOpen:e,selectedEmoji:t,currentEmoji:n,isSaving:r,onSelect:i,onClose:a,onConfirm:o})=>((0,W.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&!r&&a()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r,a]),e?(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[110] flex items-center justify-center bg-black/70 px-4 py-8 backdrop-blur-md`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0`,"aria-hidden":`true`,onClick:()=>{r||a()}}),(0,G.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`agent-emoji-picker-title`,className:`relative w-full max-w-3xl overflow-hidden rounded-[28px] border border-outline-variant/20 bg-surface shadow-[0_35px_120px_rgba(0,0,0,0.55)]`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(173,198,255,0.16),transparent_35%),radial-gradient(circle_at_bottom_right,rgba(197,255,191,0.12),transparent_32%)]`}),(0,G.jsx)(`div`,{className:`relative border-b border-outline-variant/10 px-6 py-5`,children:(0,G.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-2 inline-flex items-center gap-2 rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-[10px] font-black uppercase tracking-[0.32em] text-primary`,children:[(0,G.jsx)(w,{size:12}),`Agent identity`]}),(0,G.jsx)(`h2`,{id:`agent-emoji-picker-title`,className:`font-headline text-2xl font-black tracking-tight text-on-surface`,children:`Choose an emoji signature`}),(0,G.jsx)(`p`,{className:`mt-2 max-w-xl text-sm leading-relaxed text-on-surface-variant`,children:`Pick one of the built-in native emojis to mark this agent across the fleet, tasks, and comments.`})]}),(0,G.jsx)(`button`,{type:`button`,onClick:a,disabled:r,"aria-label":`Close emoji picker`,className:`rounded-full border border-outline-variant/20 p-2 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface disabled:cursor-not-allowed disabled:opacity-50`,children:(0,G.jsx)(D,{size:18})})]})}),(0,G.jsxs)(`div`,{className:`relative p-6`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-5`,children:P.map(e=>{let r=e.value===t,a=e.value===n;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e.value),className:`group relative overflow-hidden rounded-3xl border p-4 text-left transition-all duration-200 ${r?`border-primary bg-primary/10 shadow-[0_18px_35px_rgba(173,198,255,0.16)]`:`border-outline-variant/20 bg-surface-container-low/80 hover:-translate-y-0.5 hover:border-primary/35 hover:bg-surface-container-high`}`,"aria-pressed":r,"aria-label":`${e.label} emoji ${e.value}`,children:[(0,G.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-2xl border border-white/5 bg-surface-container-high text-4xl shadow-inner shadow-black/20`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:e.value})}),(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-bold text-on-surface`,children:e.label}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-on-surface-variant`,children:e.hint})]}),r?(0,G.jsx)(`span`,{className:`inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary text-on-primary`,children:(0,G.jsx)(u,{size:14})}):null]}),(0,G.jsx)(`p`,{className:`mt-3 text-[11px] font-bold uppercase tracking-[0.24em] text-on-surface-variant/60`,children:a?`Current`:`Available`})]},e.value)})}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:a,disabled:r,className:`rounded-lg border border-outline-variant/20 px-5 py-2.5 text-sm font-bold text-on-surface-variant transition-colors hover:bg-surface-container-high disabled:cursor-not-allowed disabled:opacity-50`,children:`Cancel`}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>void o(),disabled:r||t===n,className:`flex items-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-on-primary transition-all hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-60`,children:[r?(0,G.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-on-primary/30 border-t-on-primary`}):null,`Save emoji`]})]})]})]})]}):null),J=[{label:`AI Optimized`,values:{creativity:3,strictness:3.5}},{label:`Creative`,values:{creativity:4.5,strictness:2}},{label:`Analyst`,values:{creativity:1.5,strictness:4.5}},{label:`Assistant`,values:{creativity:3,strictness:2.5}},{label:`Strict Expert`,values:{creativity:2,strictness:5}}],Y=1,X=5,Z=.01,Q=e=>(e??j.creativity).toFixed(2),ae=({value:e,onChange:t,readonly:n=!1})=>{let r=e.creativity??j.creativity,i=e.strictness??j.strictness;return(0,G.jsxs)(`section`,{className:`space-y-4`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Personality Matrix`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:J.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>t({...e.values}),disabled:n,"aria-label":e.label,className:`text-[10px] px-2 py-0.5 rounded bg-surface-container-highest hover:bg-tertiary/20 hover:text-tertiary border border-outline/20 transition-colors disabled:pointer-events-none disabled:opacity-50`,children:e.label},e.label))}),(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Creativity`}),(0,G.jsx)(`span`,{"data-testid":`creativity-value`,className:`text-primary font-mono font-bold`,children:Q(r)})]}),(0,G.jsx)(`input`,{type:`range`,min:Y,max:X,step:Z,value:r,onChange:n=>{t({...e,creativity:parseFloat(n.target.value)})},disabled:n,"aria-label":`Creativity`,"aria-valuemin":Y,"aria-valuemax":X,"aria-valuenow":r,className:`w-full accent-primary h-1 bg-surface-container-highest rounded-full appearance-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Strictness`}),(0,G.jsx)(`span`,{"data-testid":`strictness-value`,className:`text-secondary font-mono font-bold`,children:Q(i)})]}),(0,G.jsx)(`input`,{type:`range`,min:Y,max:X,step:Z,value:i,onChange:n=>{t({...e,strictness:parseFloat(n.target.value)})},disabled:n,"aria-label":`Strictness`,"aria-valuemin":Y,"aria-valuemax":X,"aria-valuenow":i,className:`w-full accent-secondary h-1 bg-surface-container-highest rounded-full appearance-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`})]})]})]})},oe=({isOpen:e,onClose:t,onUpdated:n,agent:r})=>{let{notifyError:i,notifySuccess:a}=ee(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[_,y]=(0,W.useState)(``),[x,S]=(0,W.useState)(``),[C,w]=(0,W.useState)(``),[T,E]=(0,W.useState)(``),[O,k]=(0,W.useState)([]),[N,P]=(0,W.useState)(``),[F,I]=(0,W.useState)([]),[L,R]=(0,W.useState)(``),[z,B]=(0,W.useState)(`🧠`),[V,H]=(0,W.useState)(!1),[U,K]=(0,W.useState)({...j});(0,W.useEffect)(()=>{e&&r&&(y(r.name||``),S(r.role||``),w(r.description||``),E(r.systemInstructions||``),R(r.model?.id||``),B(M(r.emoji)),P(r.model?.provider?.id??``),K(r.attributes??{...j}))},[e,r]),(0,W.useEffect)(()=>{e&&(async()=>{try{p(!0);let{data:e}=await v.findAll();k(e)}catch{}finally{p(!1)}})()},[e]),(0,W.useEffect)(()=>{if(!N){I([]);return}(async()=>{try{l(!0);let{data:e}=await v.findModels(N);I(e),L&&!e.find(e=>e.id===L)&&R(e[0]?.id??``)}catch{I([])}finally{l(!1)}})()},[N,L]);let q=()=>{r?.id&&(navigator.clipboard.writeText(r.id),h(!0),a(`Copied`,`Agent ID copied to clipboard`),setTimeout(()=>h(!1),2e3))},J=async()=>{if(r?.id)try{s(!0),await A.update(r.id,{name:_,emoji:z,role:x,description:C,systemInstructions:T,modelId:L||void 0,attributes:U}),n?.(),t()}catch{i(`Update Failed`,`An error occurred while saving the configuration.`)}finally{s(!1)}};return(0,W.useEffect)(()=>{let n=e=>{e.key===`Escape`&&!V&&t()};return e&&window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[V,e,t]),e?(0,G.jsxs)(`div`,{className:`fixed inset-y-0 right-0 w-[420px] bg-surface-container-low shadow-2xl z-[60] flex flex-col ring-1 ring-outline-variant/10 animate-in slide-in-from-right duration-300`,children:[(0,G.jsxs)(`div`,{className:`p-6 border-b border-outline-variant/10 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Agent Configuration`}),(0,G.jsxs)(`p`,{className:`text-[10px] text-on-surface-variant uppercase tracking-widest mt-0.5`,children:[`Edit Profile: `,r?.name||`Logic Specialist`]})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors`,children:(0,G.jsx)(D,{size:20})})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-8 scrollbar-hide`,children:[(0,G.jsxs)(`section`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>H(!0),className:`relative flex h-20 w-20 items-center justify-center overflow-hidden rounded-2xl bg-surface-container-high ring-1 ring-outline-variant/50 transition-all hover:ring-primary/40`,"aria-label":`Change agent emoji`,children:[(0,G.jsx)(`span`,{className:`text-4xl text-secondary`,children:z}),(0,G.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/60 opacity-0 transition-opacity hover:opacity-100 text-white`,children:(0,G.jsx)(re,{size:16})})]}),(0,G.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Emoji Signature`}),(0,G.jsx)(`p`,{className:`text-xs font-semibold text-on-surface`,children:te(z).label}),(0,G.jsx)(`p`,{className:`text-[11px] text-on-surface-variant/70`,children:te(z).hint})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Agent Name`}),(0,G.jsx)(`input`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-9 px-3`,type:`text`,value:_,onChange:e=>y(e.target.value)})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Agent ID`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`input`,{className:`flex-1 bg-surface-container-lowest/50 border-none rounded-md text-[10px] font-mono text-on-surface-variant focus:ring-0 h-8 px-3 cursor-default`,type:`text`,value:r?.id||``,readOnly:!0}),(0,G.jsx)(`button`,{onClick:q,className:`p-1.5 rounded bg-surface-container-highest hover:bg-surface-container-highest/80 text-on-surface-variant transition-colors flex items-center justify-center aspect-square h-8`,title:`Copy ID`,children:m?(0,G.jsx)(u,{size:14,className:`text-primary`}):(0,G.jsx)(ne,{size:14})})]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Role`}),(0,G.jsx)(`input`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-9 px-3 placeholder:text-on-surface-variant/30`,type:`text`,placeholder:`e.g. Researcher, Developer...`,value:x,onChange:e=>S(e.target.value)})]})]}),(0,G.jsx)(g,{label:`Description`,value:C,onChange:w,placeholder:`Detailed agent profile...`,height:`h-32`,maxLength:1e3}),(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Provider`}),f&&(0,G.jsx)(b,{size:12,className:`animate-spin text-primary`})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-11 appearance-none px-4 disabled:opacity-50`,value:N,onChange:e=>P(e.target.value),disabled:f,children:[(0,G.jsx)(`option`,{value:``,children:`Select a provider...`}),O.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(d,{className:`absolute right-3 top-3 pointer-events-none text-on-surface-variant/60`,size:18})]})]}),(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Model Engine`}),c&&(0,G.jsx)(b,{size:12,className:`animate-spin text-primary`})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-11 appearance-none px-4 disabled:opacity-50`,value:L,onChange:e=>R(e.target.value),disabled:c||F.length===0,children:[F.length===0&&!c&&(0,G.jsx)(`option`,{value:``,children:`No models available for this provider`}),F.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(d,{className:`absolute right-3 top-3 pointer-events-none text-on-surface-variant/60`,size:18})]})]}),(0,G.jsx)(ae,{value:U,onChange:K}),(0,G.jsx)(g,{label:`System Instructions`,value:T,onChange:E,placeholder:`Define operational logic...`,height:`h-64`,maxLength:2e3})]}),(0,G.jsxs)(`div`,{className:`p-6 bg-surface-container-high border-t border-outline-variant/10 flex gap-3`,children:[(0,G.jsx)(`button`,{onClick:()=>{J()},disabled:o,className:`flex-1 bg-primary text-on-primary py-2.5 rounded font-bold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 transition-all flex items-center justify-center gap-2 active:scale-95 disabled:opacity-50`,children:o?(0,G.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(u,{size:16}),`Save Changes`]})}),(0,G.jsx)(`button`,{onClick:t,className:`px-4 py-2.5 rounded border border-outline-variant text-on-surface-variant hover:text-white transition-all`,children:`Reset`})]}),(0,G.jsx)(ie,{isOpen:V,selectedEmoji:z,currentEmoji:M(r?.emoji),isSaving:o,onSelect:B,onClose:()=>H(!1),onConfirm:()=>H(!1)})]}):null},se={name:``,role:``,description:``,emoji:N,providerId:``,modelId:``,instructions:B,attributes:{...j}},ce=[{id:1,title:`Essential Config`,subtitle:`ID, ROLE & MODEL`},{id:2,title:`Intelligence Tuning`,subtitle:`COGNITIVE MATRIX`},{id:3,title:`Instructions`,subtitle:`KNOWLEDGE BASE`}],$=({isOpen:e,onClose:t,onCreated:a})=>{let o=n(),{notifyApiError:s,notifyError:l,notifySuccess:u}=ee(),[f,p]=(0,W.useState)(1),[m,h]=(0,W.useState)(!1),_=(0,W.useId)(),b=(0,W.useId)(),x=(0,W.useId)(),S=(0,W.useId)(),C=(0,W.useId)(),T=(0,W.useId)(),E=(0,W.useId)(),D=(0,W.useId)(),{control:P,formState:{errors:B},handleSubmit:ne,register:V,reset:H,setValue:U}=R({resolver:F(z),defaultValues:se,mode:`onBlur`}),K=I({control:P,name:`providerId`}),q=I({control:P,name:`modelId`}),J=I({control:P,name:`emoji`}),Y=r({queryKey:[`providers`],enabled:e,queryFn:async()=>(await v.findAll()).data}),X=r({queryKey:[`provider-models`,K],enabled:e&&!!K,queryFn:async()=>(await v.findModels(K)).data});(0,W.useEffect)(()=>{if(!e){H(se);return}let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,H]),(0,W.useEffect)(()=>{e&&Y.error&&s(Y.error,`Providers Load Failed`)},[e,s,Y.error]),(0,W.useEffect)(()=>{e&&X.error&&s(X.error,`Models Load Failed`)},[e,X.error,s]);let Z=(0,W.useMemo)(()=>Y.data??[],[Y.data]),Q=(0,W.useMemo)(()=>X.data??[],[X.data]);(0,W.useEffect)(()=>{if(e){if(Z.length===0){K&&U(`providerId`,``,{shouldDirty:!1,shouldValidate:!0});return}(!K||!Z.some(e=>e.id===K))&&U(`providerId`,Z[0].id,{shouldDirty:!1,shouldValidate:!0})}},[e,K,Z,U]),(0,W.useEffect)(()=>{if(e){if(!K){q&&U(`modelId`,``,{shouldDirty:!1,shouldValidate:!0});return}if(Q.length===0){q&&U(`modelId`,``,{shouldDirty:!1,shouldValidate:!0});return}(!q||!Q.some(e=>e.id===q))&&U(`modelId`,Q[0].id,{shouldDirty:!1,shouldValidate:!0})}},[Q,e,q,K,U]);let oe=i({mutationFn:async e=>(await A.create({name:e.name,emoji:e.emoji,role:e.role,description:e.description,systemInstructions:e.instructions,modelId:e.modelId,status:`active`,attributes:e.attributes}),e),onSuccess:e=>{o.invalidateQueries({queryKey:[`agents`]}),u(`Agent Deployed`,`Successfully commissioned ${e.name} into the fleet.`),a?.(),t(),H(se),p(1)},onError:e=>{s(e,`Deployment Failed`)}}),$=oe.isPending,le=Y.isPending||X.isPending,ue=ne(async e=>{await oe.mutateAsync(e)},()=>{l(`Validation Error`,`Please review the highlighted fields before deploying the agent.`)}),de=()=>{$||(p(1),t())};return e?(0,G.jsx)(O,{children:(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4 md:p-8`,children:[(0,G.jsx)(k.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:de,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`,"aria-hidden":`true`}),(0,G.jsxs)(k.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},role:`dialog`,"aria-modal":`true`,"aria-labelledby":_,"aria-describedby":b,"aria-busy":$||le,className:`relative w-full max-w-5xl h-full max-h-[850px] bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md sticky top-0 z-10`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{id:_,className:`text-2xl font-black font-headline text-white tracking-tight`,children:`Create New Agent`}),(0,G.jsx)(`p`,{id:b,className:`text-sm text-on-surface-variant/80 mt-1`,children:`Configure a specialized AI persona to handle specific nodes in your automation flows.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:de,disabled:$,className:`px-6 py-2.5 rounded-md text-sm font-bold text-on-surface-variant hover:text-white transition-all disabled:opacity-50 disabled:cursor-not-allowed`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:ue,disabled:$||Z.length===0||Q.length===0,className:`px-8 py-2.5 rounded-md bg-primary text-on-primary text-sm font-bold shadow-lg shadow-primary/20 hover:scale-[1.02] active:scale-[0.98] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed disabled:hover:scale-100`,children:$?`Deploying...`:`Deploy Agent`})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 flex overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`w-72 bg-surface-container-low/30 border-r border-outline-variant/5 p-8 flex flex-col gap-10`,children:[(0,G.jsx)(`div`,{className:`space-y-8`,children:ce.map(e=>(0,G.jsxs)(`button`,{type:`button`,className:`flex gap-4 group cursor-pointer text-left w-full`,onClick:()=>p(e.id),"aria-pressed":f===e.id,children:[(0,G.jsx)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center text-[10px] font-black transition-all ${f===e.id?`bg-secondary text-surface`:`bg-surface-container-highest text-on-surface-variant`}`,children:e.id.toString().padStart(2,`0`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`text-xs font-bold font-headline transition-colors ${f===e.id?`text-white`:`text-on-surface-variant`}`,children:e.title}),(0,G.jsx)(`p`,{className:`text-[9px] font-bold tracking-widest text-on-surface-variant/50 mt-0.5`,children:e.subtitle})]})]},e.id))}),(0,G.jsxs)(`div`,{className:`mt-auto bg-tertiary/10 rounded-xl p-5 ring-1 ring-tertiary/20 backdrop-blur-sm relative overflow-hidden group`,children:[(0,G.jsx)(`div`,{className:`absolute -right-4 -top-4 w-16 h-16 bg-tertiary/10 rounded-full blur-2xl group-hover:bg-tertiary/20 transition-all duration-700`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 text-tertiary`,children:[(0,G.jsx)(w,{size:14,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-widest`,children:`AI Suggestion`})]}),(0,G.jsxs)(`p`,{className:`text-[11px] text-on-surface-variant leading-relaxed italic`,children:[`"Try selecting `,(0,G.jsx)(`span`,{className:`text-tertiary font-bold`,children:`Researcher`}),` role for high-depth data synthesis tasks."`]})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-10 space-y-12 custom-scrollbar`,children:[(0,G.jsxs)(`section`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-secondary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Basic Configuration`})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>h(!0),className:`group flex w-full items-center justify-between rounded-[24px] border border-outline-variant/10 bg-surface-container-highest/20 p-5 text-left transition-all hover:border-primary/30 hover:bg-surface-container-highest/35`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(`div`,{className:`flex h-20 w-20 items-center justify-center rounded-[20px] border border-primary/20 bg-surface-container-high text-5xl shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:M(J)})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-[0.32em] text-primary/80`,children:`Emoji signature`}),(0,G.jsx)(`h4`,{className:`mt-2 font-headline text-xl font-black text-white`,children:te(J).label}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-on-surface-variant`,children:te(J).hint})]})]}),(0,G.jsx)(`span`,{className:`inline-flex h-10 w-10 items-center justify-center rounded-full border border-outline-variant/20 bg-surface-container-high text-on-surface-variant transition-colors group-hover:text-on-surface`,children:(0,G.jsx)(re,{size:16,"aria-hidden":`true`})})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-6`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-name`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Agent Name`}),(0,G.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all`,children:(0,G.jsx)(`input`,{id:`create-agent-name`,type:`text`,placeholder:`e.g. Researcher-X`,"aria-invalid":!!B.name,"aria-describedby":B.name?x:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-3 focus:outline-none placeholder:text-on-surface-variant/30`,...V(`name`)})}),B.name&&(0,G.jsx)(`p`,{id:x,className:`text-xs text-error font-semibold`,children:B.name.message})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-role`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Primary Role`}),(0,G.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all text-on-surface`,children:(0,G.jsx)(`input`,{id:`create-agent-role`,type:`text`,placeholder:`e.g. Researcher`,"aria-invalid":!!B.role,"aria-describedby":B.role?S:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-4 focus:outline-none placeholder:text-on-surface-variant/30`,...V(`role`)})}),B.role&&(0,G.jsx)(`p`,{id:S,className:`text-xs text-error font-semibold`,children:B.role.message})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(L,{control:P,name:`description`,render:({field:e})=>(0,G.jsx)(g,{label:`Description`,value:e.value,onChange:e.onChange,placeholder:`Define what this agent aims to achieve... You can use markdown for formatting.`,height:`h-32`,maxLength:1e3})}),B.description&&(0,G.jsx)(`p`,{id:C,className:`text-xs text-error font-semibold`,children:B.description.message})]}),(0,G.jsxs)(`div`,{className:`pt-4 space-y-8 border-t border-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Select Provider`}),le&&(0,G.jsx)(`span`,{className:`text-[10px] text-primary animate-pulse font-bold uppercase tracking-widest`,children:`Updating...`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[Z.map(e=>(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":K===e.id,onClick:()=>{K!==e.id&&(U(`providerId`,e.id,{shouldDirty:!0,shouldValidate:!0}),U(`modelId`,``,{shouldDirty:!0,shouldValidate:!1}))},className:`p-4 rounded-xl flex flex-col items-center gap-3 transition-all ${K===e.id?`bg-primary/10 ring-2 ring-primary shadow-[0_0_20px_rgba(173,198,255,0.15)]`:`bg-surface-container-highest/30 ring-1 ring-outline-variant/10 hover:bg-surface-container-highest/50`}`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-lg flex items-center justify-center transition-colors ${K===e.id?`bg-primary text-surface`:`bg-surface-container-high text-on-surface-variant`}`,children:(0,G.jsx)(c,{size:20,"aria-hidden":`true`})}),(0,G.jsx)(`div`,{className:`text-center`,children:(0,G.jsx)(`h4`,{className:`text-xs font-black uppercase tracking-wider ${K===e.id?`text-white`:`text-on-surface-variant`}`,children:e.name})})]},e.id)),Z.length===0&&!Y.isPending&&(0,G.jsxs)(`div`,{className:`col-span-4 py-8 border-2 border-dashed border-outline-variant/10 rounded-xl flex flex-col items-center justify-center text-on-surface-variant/40 gap-2`,children:[(0,G.jsx)(y,{size:24,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`No providers registered`})]})]}),B.providerId&&(0,G.jsx)(`p`,{id:T,className:`text-xs text-error font-semibold`,children:B.providerId.message})]}),(0,G.jsx)(O,{mode:`wait`,children:K&&(0,G.jsxs)(k.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:`space-y-4 pt-4 border-t border-outline-variant/5`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-model`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Model Variant Selection`}),(0,G.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,G.jsxs)(`select`,{id:`create-agent-model`,value:q,onChange:e=>U(`modelId`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),"aria-invalid":!!B.modelId,"aria-describedby":B.modelId?E:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-3 focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:``,disabled:!0,className:`bg-surface-container-low text-on-surface`,children:`Select a model...`}),Q.map(e=>(0,G.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface`,children:e.name},e.id))]}),(0,G.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,G.jsx)(d,{size:18,"aria-hidden":`true`})})]}),B.modelId&&(0,G.jsx)(`p`,{id:E,className:`text-xs text-error font-semibold`,children:B.modelId.message}),Q.length===0&&!X.isPending&&(0,G.jsx)(`div`,{className:`py-6 text-center bg-error/5 rounded-xl border border-error/10`,children:(0,G.jsx)(`span`,{className:`text-[10px] font-bold text-error uppercase tracking-widest opacity-60`,children:`No model variants found for this provider`})})]},K)})]})]}),(0,G.jsxs)(`section`,{className:`space-y-10`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-primary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Intelligence Tuning`})]}),(0,G.jsx)(L,{control:P,name:`attributes`,render:({field:e})=>(0,G.jsx)(ae,{value:e.value??{...j},onChange:e.onChange})})]}),(0,G.jsxs)(`section`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-tertiary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Operational Directives`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(L,{control:P,name:`instructions`,render:({field:e})=>(0,G.jsx)(g,{label:`System Instructions`,value:e.value,onChange:e.onChange,height:`h-64`,helperText:`Prompt Engineering Active`,maxLength:1e3})}),B.instructions&&(0,G.jsx)(`p`,{id:D,className:`text-xs text-error font-semibold`,children:B.instructions.message})]})]})]})]})]}),(0,G.jsx)(ie,{isOpen:m,selectedEmoji:M(J),currentEmoji:N,isSaving:$,onSelect:e=>U(`emoji`,e,{shouldDirty:!0,shouldValidate:!0}),onClose:()=>h(!1),onConfirm:()=>h(!1)})]})}):null},le=({isOpen:e,onClose:t,agent:n})=>{let r=`Wake up, who are you?`,[i,a]=(0,W.useState)(r),[o,c]=(0,W.useState)(``),[u,d]=(0,W.useState)(),[m,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(`idle`);return(0,W.useEffect)(()=>{let n=e=>{e.key===`Escape`&&t()};return e&&(window.addEventListener(`keydown`,n),c(``),d(void 0),v(`idle`),a(r)),()=>window.removeEventListener(`keydown`,n)},[e,t]),e?(0,G.jsx)(O,{children:(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4`,children:[(0,G.jsx)(k.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`}),(0,G.jsxs)(k.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`relative w-full max-w-2xl bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`px-6 py-4 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary`,children:(0,G.jsx)(l,{size:20})}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-xl font-black font-headline text-white tracking-tight`,children:[`Probe: `,n?.name]}),(0,G.jsx)(`p`,{className:`text-[10px] text-on-surface-variant uppercase tracking-widest font-bold`,children:`Neural Direct Message`})]})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors p-2`,children:(0,G.jsx)(D,{size:20})})]}),(0,G.jsxs)(`div`,{className:`p-6 space-y-6 max-h-[80vh] overflow-y-auto scrollbar-hide`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(h,{size:12}),`Command Input`]}),(0,G.jsxs)(`div`,{className:`relative group`,children:[(0,G.jsx)(`textarea`,{value:i,onChange:e=>a(e.target.value),placeholder:`Type your command...`,className:`w-full bg-surface-container-highest/30 rounded-xl p-4 text-sm text-on-surface h-32 focus:outline-none focus:ring-2 focus:ring-primary/40 transition-all resize-none border border-outline-variant/10 group-hover:border-outline-variant/30`}),(0,G.jsx)(`button`,{onClick:async()=>{if(!(!n?.id||!i.trim()))try{g(!0),v(`idle`),c(`Awaiting response from neural node...`),d(void 0);let{data:e}=await A.probe(n.id,i);c(e.content),d(e.image),v(`success`)}catch(e){let t=`An unexpected error occurred during the probe.`;if(e&&typeof e==`object`&&`response`in e){let n=e;t=n.response?.data?.message||n.message||t}else e instanceof Error&&(t=e.message);c(`ERROR: ${t}`),v(`error`)}finally{g(!1)}},disabled:m||!i.trim(),className:`absolute bottom-3 right-3 p-2.5 rounded-lg bg-primary text-on-primary shadow-lg shadow-primary/20 hover:scale-[1.05] active:scale-[0.95] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group`,children:m?(0,G.jsx)(b,{size:18,className:`animate-spin`}):(0,G.jsx)(S,{size:18})})]})]}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(s,{size:12,className:m?`animate-pulse`:``}),`Neural Response`]}),_===`success`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-[9px] font-black text-secondary uppercase bg-secondary/10 px-2 py-0.5 rounded`,children:[(0,G.jsx)(p,{size:10}),` Sync Complete`]}),_===`error`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-[9px] font-black text-error uppercase bg-error/10 px-2 py-0.5 rounded`,children:[(0,G.jsx)(f,{size:10}),` Link Severed`]})]}),(0,G.jsx)(`div`,{className:`w-full min-h-[100px] bg-black/40 rounded-xl p-5 border border-outline-variant/5 font-mono text-sm leading-relaxed transition-all duration-500 whitespace-pre-wrap ${_===`error`?`text-error/80 border-error/20`:_===`success`?`text-secondary/90 border-secondary/20 shadow-[inset_0_0_20px_rgba(102,231,175,0.05)]`:`text-on-surface-variant/60`}`,children:o||`Enter a command and initiate the probe to see the agent response.`}),(0,G.jsx)(O,{children:u&&(0,G.jsxs)(k.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(H,{size:12}),`Visual Output`]}),(0,G.jsxs)(`div`,{className:`relative rounded-xl overflow-hidden border border-outline-variant/10 bg-surface-container-highest/20 group`,children:[(0,G.jsx)(`img`,{src:`data:image/png;base64,${u}`,alt:`Neural Output`,className:`w-full h-auto max-h-[400px] object-contain mx-auto`}),(0,G.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 p-3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,G.jsx)(`span`,{className:`text-[10px] font-bold text-white uppercase tracking-wider`,children:`Generated Content`})})]})]})})]})]}),(0,G.jsx)(`div`,{className:`px-6 py-4 bg-surface-container-high/50 border-t border-outline-variant/10 flex justify-end`,children:(0,G.jsx)(`button`,{onClick:t,className:`px-6 py-2 rounded-lg text-sm font-bold text-on-surface hover:bg-surface-container-highest transition-all`,children:`Close Terminal`})})]})]})}):null},ue=()=>{let{notifySuccess:e,notifyApiError:t}=ee(),a=n(),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(`grid`),{data:v=[],isLoading:y}=r({queryKey:[`agents`],queryFn:async()=>{let{data:e}=await A.findAll();return e}}),S=(0,W.useCallback)(()=>a.invalidateQueries({queryKey:[`agents`]}),[a]),C=i({mutationFn:e=>A.delete(e),onSuccess:()=>{e(`Agent Inactivated`,`Neural node has been marked as inactive.`),h(!1),S()},onError:e=>t(e,`Operation Failed`)}),w=i({mutationFn:e=>A.update(e,{status:`active`}),onSuccess:()=>{e(`Neural Link Restored`,`The agent has been reactivated and synchronized.`),S()},onError:e=>t(e,`Activation Failed`)}),T=e=>{s(e),l(!0)},D=e=>{s(e),p(!0)},O=e=>{s(e),h(!0)},k=()=>{o&&C.mutate(o.id)},j=e=>{w.mutate(e)};return(0,G.jsxs)(`div`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-4xl font-extrabold font-headline tracking-tight text-white`,children:`Agent Fleet`}),(0,G.jsxs)(`p`,{className:`text-on-surface-variant mt-2 font-body text-sm`,children:[`Commanding `,(0,G.jsx)(`span`,{className:`text-secondary font-bold`,children:v.filter(e=>e.status!==`inactive`).length}),` active neural nodes across the network.`]})]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`button`,{onClick:()=>_(`grid`),"aria-label":`Grid view`,"aria-pressed":g===`grid`,className:`p-2 rounded transition-colors ${g===`grid`?`bg-surface-container-high text-white`:`text-on-surface-variant hover:text-white`}`,children:(0,G.jsx)(V,{size:20,"aria-hidden":`true`})}),(0,G.jsx)(`button`,{onClick:()=>_(`list`),"aria-label":`List view`,"aria-pressed":g===`list`,className:`p-2 rounded transition-colors ${g===`list`?`bg-surface-container-high text-white`:`text-on-surface-variant hover:text-white`}`,children:(0,G.jsx)(U,{size:20,"aria-hidden":`true`})})]})]}),y?(0,G.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,G.jsx)(b,{className:`w-12 h-12 text-primary animate-spin`})}):(0,G.jsxs)(`div`,{className:g===`grid`?`grid grid-cols-1 xl:grid-cols-2 2xl:grid-cols-3 gap-6`:`flex flex-col gap-4`,children:[v.map(e=>(0,G.jsx)(`div`,{onClick:()=>T(e),className:e.status===`inactive`?`opacity-50 grayscale hover:grayscale-0 transition-all`:``,children:(0,G.jsx)(q,{id:e.id,name:e.name,emoji:e.emoji,expertise:e.role||`General Assistant`,model:e.model?.name||`Unknown`,status:e.status||`active`,metricLabel:`Provider`,metricValue:e.model?.provider?.name||`Unknown`,onConfigure:()=>T(e),onProbe:()=>D(e),onDelete:()=>O(e),onActivate:()=>j(e.id)})},e.id)),(0,G.jsxs)(`div`,{onClick:()=>d(!0),className:`border-2 border-dashed border-outline-variant/30 rounded-xl p-6 flex flex-col items-center justify-center text-center group cursor-pointer hover:border-primary/50 transition-all hover:bg-primary/5`,children:[(0,G.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-surface-container-low flex items-center justify-center mb-4 group-hover:scale-110 transition-transform`,children:(0,G.jsx)(x,{size:24,className:`text-primary`})}),(0,G.jsx)(`span`,{className:`text-sm font-bold font-headline text-on-surface-variant group-hover:text-on-surface`,children:`Deploy New Agent`}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant/60 mt-1 max-w-[200px]`,children:`Expand your fleet with specialized intelligence units.`})]})]}),(0,G.jsx)(oe,{isOpen:c,onClose:()=>l(!1),onUpdated:S,agent:o},o?.id||`none`),(0,G.jsx)(le,{isOpen:f,onClose:()=>p(!1),agent:o}),(0,G.jsx)($,{isOpen:u,onClose:()=>d(!1),onCreated:S}),(0,G.jsx)(E,{isOpen:m,onClose:()=>h(!1),onConfirm:k,title:`Decommission Neural Node?`,message:`This will mark ${o?.name} as inactive. The agent will remain in the database but will no longer be available for automated tasks or direct neural connection.`,confirmText:`Decommission`,variant:`danger`})]})};export{ue as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CfaHPvi0.js";import{r as t}from"./vendor-markdown-DoJbQ1of.js";import{t as n}from"./download-
|
|
1
|
+
import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CfaHPvi0.js";import{r as t}from"./vendor-markdown-DoJbQ1of.js";import{t as n}from"./download-DZdOdijy.js";import{t as r}from"./file-text-CX_Yqfjf.js";e();var i=t(),a=({name:e,size:t,type:a,filePath:o})=>{let s=[`png`,`jpg`,`jpeg`,`svg`,`gif`].includes(a.toLowerCase()),c=(e=>e.startsWith(`http`)?e:e.startsWith(`uploads/`)?`/api/v1/${e}`:`/api/v1/uploads/artifacts/${e}`)(o);return(0,i.jsxs)(`div`,{className:`flex items-center gap-4 p-3 bg-surface-container-highest/40 rounded-lg border border-outline-variant/10 group hover:border-primary/20 transition-all cursor-pointer`,onClick:()=>window.open(c,`_blank`),children:[(0,i.jsx)(`div`,{className:`h-10 w-10 rounded shadow-inner flex items-center justify-center overflow-hidden ${s?`bg-secondary/10 text-secondary`:`bg-primary/10 text-primary`}`,children:s?(0,i.jsx)(`img`,{src:c,alt:e,className:`h-full w-full object-cover`}):(0,i.jsx)(r,{size:20})}),(0,i.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,i.jsx)(`p`,{className:`text-xs font-bold text-on-surface truncate`,children:e}),(0,i.jsx)(`p`,{className:`text-[10px] text-on-surface-variant/60 font-medium uppercase tracking-tighter`,children:t||`Artifact`})]}),(0,i.jsx)(`div`,{className:`flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,i.jsx)(`button`,{className:`p-1.5 hover:bg-surface-container-highest rounded text-on-surface-variant hover:text-primary transition-colors`,children:(0,i.jsx)(n,{size:14})})})]})};export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CfaHPvi0.js";import{r as t}from"./vendor-markdown-DoJbQ1of.js";import{i as n}from"./client-
|
|
1
|
+
import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CfaHPvi0.js";import{r as t}from"./vendor-markdown-DoJbQ1of.js";import{i as n}from"./client-B553SX3l.js";import{t as r}from"./circle-check-Jz8IOE4h.js";import{t as i}from"./info-DGHChFI6.js";import{t as a}from"./x-CCZGYGDC.js";import{n as o,t as s}from"./vendor-motion-CMGWJcqR.js";var c=n(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);e();var l=t(),u=({isOpen:e,onClose:t,onConfirm:n,title:u,message:d,confirmText:f=`Confirm`,cancelText:p=`Cancel`,variant:m=`primary`,loading:h=!1,showCheckbox:g=!1,checkboxLabel:_=`Don't show this again`,onCheckboxChange:v})=>{let y={danger:{icon:c,iconBg:`bg-error/10`,iconColor:`text-error`,buttonBg:`bg-error hover:bg-error/90`,buttonText:`text-on-error`,ring:`ring-error/20`},primary:{icon:i,iconBg:`bg-primary/10`,iconColor:`text-primary`,buttonBg:`bg-primary hover:bg-primary/90`,buttonText:`text-on-primary`,ring:`ring-primary/20`},success:{icon:r,iconBg:`bg-secondary/10`,iconColor:`text-secondary`,buttonBg:`bg-secondary hover:bg-secondary/90`,buttonText:`text-surface`,ring:`ring-secondary/20`},warning:{icon:c,iconBg:`bg-tertiary/10`,iconColor:`text-tertiary`,buttonBg:`bg-tertiary hover:bg-tertiary/90`,buttonText:`text-surface`,ring:`ring-tertiary/20`}}[m],b=y.icon;return e?(0,l.jsx)(o,{children:(0,l.jsxs)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center p-4`,children:[(0,l.jsx)(s.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/60 backdrop-blur-md`}),(0,l.jsxs)(s.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:`relative w-full max-w-md bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden ring-1 ring-outline-variant/10 p-6 flex flex-col gap-6`,children:[(0,l.jsxs)(`div`,{className:`flex gap-4`,children:[(0,l.jsx)(`div`,{className:`w-12 h-12 rounded-xl flex-shrink-0 flex items-center justify-center ${y.iconBg} ${y.iconColor}`,children:(0,l.jsx)(b,{size:24})}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsx)(`h3`,{className:`text-xl font-black font-headline text-white tracking-tight mb-2`,children:u}),(0,l.jsx)(`p`,{className:`text-sm text-on-surface-variant leading-relaxed`,children:d})]}),(0,l.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors h-fit p-1`,children:(0,l.jsx)(a,{size:20})})]}),g&&(0,l.jsx)(`div`,{className:`flex items-center gap-3 px-1 mt-[-12px]`,children:(0,l.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer group`,children:[(0,l.jsxs)(`div`,{className:`relative flex items-center`,children:[(0,l.jsx)(`input`,{type:`checkbox`,onChange:e=>v?.(e.target.checked),className:`peer appearance-none w-5 h-5 rounded border border-outline-variant/30 bg-surface-container-highest checked:bg-primary checked:border-primary transition-all cursor-pointer`}),(0,l.jsx)(r,{size:14,className:`absolute inset-0 m-auto text-on-primary opacity-0 peer-checked:opacity-100 transition-opacity pointer-events-none`})]}),(0,l.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant group-hover:text-white transition-colors uppercase tracking-wider`,children:_})]})}),(0,l.jsxs)(`div`,{className:`flex items-center justify-end gap-3 mt-2`,children:[(0,l.jsx)(`button`,{onClick:t,disabled:h,className:`px-5 py-2.5 rounded-lg text-sm font-bold text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all disabled:opacity-50`,children:p}),(0,l.jsx)(`button`,{onClick:n,disabled:h,className:`px-6 py-2.5 rounded-lg text-sm font-bold shadow-lg transition-all ${y.buttonBg} ${y.buttonText} ${y.ring} hover:scale-[1.02] active:scale-[0.98] disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed`,children:h?`Processing...`:f})]})]})]})}):null};export{u as t};
|
package/dist/ui/assets/{CreateRecurrentTaskModal-BgfnJ1n8.js → CreateRecurrentTaskModal-CGSdgNAf.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,t}from"./rolldown-runtime-COnpUsM8.js";import{g as n}from"./vendor-dnd-CfaHPvi0.js";import{n as r,t as i}from"./vendor-query-xpDrc4rM.js";import{r as a}from"./vendor-markdown-DoJbQ1of.js";import{i as o}from"./client-BGOBXkO8.js";import{t as s}from"./bot-QVmnxPf4.js";import{t as c}from"./brain-C6vlLcg3.js";import{t as l}from"./chevron-down-LTeQHW9O.js";import{t as u}from"./circle-alert-pUx6yhcF.js";import{t as d}from"./clock-BY4rrypg.js";import{n as f,t as p}from"./MarkdownField--1gpyapw.js";import{t as m}from"./cpu-8Sbc9Dk0.js";import{t as h}from"./rocket-CMSwBl_C.js";import{t as g}from"./sparkles-v57Nc-z-.js";import{t as _}from"./x-wDy15QMx.js";import{n as v,t as y}from"./vendor-motion-CMGWJcqR.js";import{n as b}from"./agents-b8btewki.js";import{t as ee}from"./useNotification-DQayTSUL.js";import{a as x,c as S,o as te,s as ne}from"./vendor-forms-DHyqHeyd.js";import{t as C}from"./tasks-DEUQCNoH.js";import{a as w}from"./taskFormSchemas-dl1t1OyX.js";import{n as T,r as E}from"./recurrent-tasks-CKT47N2l.js";var D=o(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),O=o(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),k=o(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),A=t(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define(`cronstrue`,[],r):typeof e==`object`?e.cronstrue=r():n.cronstrue=r()})(globalThis,()=>(()=>{var e={949(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.CronParser=void 0;var r=n(515);t.CronParser=function(){function e(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=!1),this.expression=e,this.dayOfWeekStartIndexZero=t,this.monthStartIndexZero=n}return e.prototype.parse=function(){var e,t=this.expression??``;if(t===`@reboot`)return e=[`@reboot`,``,``,``,``,``,``],e;if(t.startsWith(`@`)){var n=this.parseSpecial(this.expression);e=this.extractParts(n)}else e=this.extractParts(this.expression);return this.normalize(e),this.validate(e),e},e.prototype.parseSpecial=function(e){var t={"@yearly":`0 0 1 1 *`,"@annually":`0 0 1 1 *`,"@monthly":`0 0 1 * *`,"@weekly":`0 0 * * 0`,"@daily":`0 0 * * *`,"@midnight":`0 0 * * *`,"@hourly":`0 * * * *`,"@reboot":`@reboot`}[e];if(!t)throw Error(`Unknown special expression.`);return t},e.prototype.extractParts=function(e){if(!this.expression)throw Error(`cron expression is empty`);for(var t=e.trim().split(/[ ]+/),n=0;n<t.length;n++)if(t[n].includes(`,`)){var r=t[n].split(`,`).map(function(e){return e.trim()}).filter(function(e){return e!==``}).map(function(e){return isNaN(Number(e))?e:Number(e)}).filter(function(e){return e!==null&&e!==``});r.length===0&&r.push(`*`),r.sort(function(e,t){return e!==null&&t!==null?e-t:0}),t[n]=r.map(function(e){return e===null?``:e.toString()}).join(`,`)}if(t.length<5)throw Error(`Expression has only ${t.length} part${t.length==1?``:`s`}. At least 5 parts are required.`);if(t.length==5)t.unshift(``),t.push(``);else if(t.length==6)/\d{4}$/.test(t[5])||t[4]==`?`||t[2]==`?`?t.unshift(``):t.push(``);else if(t.length>7)throw Error(`Expression has ${t.length} parts; too many!`);return t},e.prototype.normalize=function(e){var t=this;if(e[3]=e[3].replace(`?`,`*`),e[5]=e[5].replace(`?`,`*`),e[2]=e[2].replace(`?`,`*`),e[0].indexOf(`0/`)==0&&(e[0]=e[0].replace(`0/`,`*/`)),e[1].indexOf(`0/`)==0&&(e[1]=e[1].replace(`0/`,`*/`)),e[2].indexOf(`0/`)==0&&(e[2]=e[2].replace(`0/`,`*/`)),e[3].indexOf(`1/`)==0&&(e[3]=e[3].replace(`1/`,`*/`)),e[4].indexOf(`1/`)==0&&(e[4]=e[4].replace(`1/`,`*/`)),e[6].indexOf(`1/`)==0&&(e[6]=e[6].replace(`1/`,`*/`)),e[5]=e[5].replace(/(^\d)|([^#/\s]\d)/g,function(e){var n=e.replace(/\D/,``),r=n;return t.dayOfWeekStartIndexZero?n==`7`&&(r=`0`):r=(parseInt(n)-1).toString(),e.replace(n,r)}),e[5]==`L`&&(e[5]=`6`),e[3]==`?`&&(e[3]=`*`),e[3].indexOf(`W`)>-1&&(e[3].indexOf(`,`)>-1||e[3].indexOf(`-`)>-1))throw Error(`The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.`);var n={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var r in n)e[5]=e[5].replace(new RegExp(r,`gi`),n[r].toString());e[4]=e[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(e){var n=e.replace(/\D/,``),r=n;return t.monthStartIndexZero&&(r=(parseInt(n)+1).toString()),e.replace(n,r)});var i={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var a in i)e[4]=e[4].replace(new RegExp(a,`gi`),i[a].toString());e[0]==`0`&&(e[0]=``),!/\*|\-|\,|\//.test(e[2])&&(/\*|\//.test(e[1])||/\*|\//.test(e[0]))&&(e[2]+=`-${e[2]}`);for(var o=0;o<e.length;o++)if(e[o].indexOf(`,`)!=-1&&(e[o]=e[o].split(`,`).filter(function(e){return e!==``}).join(`,`)||`*`),e[o]==`*/1`&&(e[o]=`*`),e[o].indexOf(`/`)>-1&&!/^\*|\-|\,/.test(e[o])){var s=null;switch(o){case 4:s=`12`;break;case 5:s=`6`;break;case 6:s=`9999`;break;default:s=null;break}if(s!==null){var c=e[o].split(`/`);e[o]=`${c[0]}-${s}/${c[1]}`}}},e.prototype.validate=function(e){var t=`0-9,\\-*/`;this.validateOnlyExpectedCharactersFound(e[0],t),this.validateOnlyExpectedCharactersFound(e[1],t),this.validateOnlyExpectedCharactersFound(e[2],t),this.validateOnlyExpectedCharactersFound(e[3],`0-9,\\-*/LW`),this.validateOnlyExpectedCharactersFound(e[4],t),this.validateOnlyExpectedCharactersFound(e[5],`0-9,\\-*/L#`),this.validateOnlyExpectedCharactersFound(e[6],t),this.validateAnyRanges(e)},e.prototype.validateAnyRanges=function(e){r.default.secondRange(e[0]),r.default.minuteRange(e[1]),r.default.hourRange(e[2]),r.default.dayOfMonthRange(e[3]),r.default.monthRange(e[4],this.monthStartIndexZero),r.default.dayOfWeekRange(e[5],this.dayOfWeekStartIndexZero)},e.prototype.validateOnlyExpectedCharactersFound=function(e,t){var n=e.match(RegExp(`[^${t}]+`,`gi`));if(n&&n.length)throw Error(`Expression contains invalid values: '${n.toString()}'`)},e}()},333(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.ExpressionDescriptor=void 0;var r=n(823),i=n(949);t.ExpressionDescriptor=function(){function e(t,n){if(this.expression=t,this.options=n,this.expressionParts=[,,,,,],!this.options.locale&&e.defaultLocale&&(this.options.locale=e.defaultLocale),!e.locales[this.options.locale]){var r=Object.keys(e.locales)[0];console.warn(`Locale '${this.options.locale}' could not be found; falling back to '${r}'.`),this.options.locale=r}this.i18n=e.locales[this.options.locale],n.use24HourTimeFormat===void 0&&(n.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,n){var r=n===void 0?{}:n,i=r.throwExceptionOnParseError,a=i===void 0?!0:i,o=r.verbose,s=o===void 0?!1:o,c=r.dayOfWeekStartIndexZero,l=c===void 0?!0:c,u=r.monthStartIndexZero,d=u===void 0?!1:u,f=r.use24HourTimeFormat,p=r.trimHoursLeadingZero,m=p===void 0?!1:p,h=r.locale,g=h===void 0?null:h,_=r.logicalAndDayFields,v={throwExceptionOnParseError:a,verbose:s,dayOfWeekStartIndexZero:l,monthStartIndexZero:d,use24HourTimeFormat:f,trimHoursLeadingZero:m,locale:g,logicalAndDayFields:_===void 0?!1:_};return v.tzOffset&&console.warn(`'tzOffset' option has been deprecated and is no longer supported.`),new e(t,v).getFullDescription()},e.initialize=function(t,n){n===void 0&&(n=`en`),e.specialCharacters=[`/`,`-`,`,`,`*`],e.defaultLocale=n,t.load(e.locales)},e.prototype.getFullDescription=function(){var e,t=``;try{if(this.expressionParts=new i.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero).parse(),this.expressionParts[0]===`@reboot`)return(e=this.i18n).atReboot?.call(e)||`Run once, at startup`;var n=this.getTimeOfDayDescription(),r=this.getDayOfMonthDescription(),a=this.getMonthDescription(),o=this.getDayOfWeekDescription(),s=this.getYearDescription();t+=n+r+o+a+s,t=this.transformVerbosity(t,!!this.options.verbose),t=t.charAt(0).toLocaleUpperCase()+t.substr(1)}catch(e){if(!this.options.throwExceptionOnParseError)t=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw`${e}`}return t},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],n=this.expressionParts[1],i=this.expressionParts[2],a=``;if(!r.StringUtilities.containsAny(n,e.specialCharacters)&&!r.StringUtilities.containsAny(i,e.specialCharacters)&&!r.StringUtilities.containsAny(t,e.specialCharacters))a+=this.i18n.atSpace()+this.formatTime(i,n,t);else if(!t&&n.indexOf(`-`)>-1&&!(n.indexOf(`,`)>-1)&&!(n.indexOf(`/`)>-1)&&!r.StringUtilities.containsAny(i,e.specialCharacters)){var o=n.split(`-`);a+=r.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(i,o[0],``),this.formatTime(i,o[1],``))}else if(!t&&i.indexOf(`,`)>-1&&i.indexOf(`-`)==-1&&i.indexOf(`/`)==-1&&!r.StringUtilities.containsAny(n,e.specialCharacters)){var s=i.split(`,`);a+=this.i18n.at();for(var c=0;c<s.length;c++)a+=` `,a+=this.formatTime(s[c],n,``),c<s.length-2&&(a+=`,`),c==s.length-2&&(a+=this.i18n.spaceAnd())}else{var l=this.getSecondsDescription(),u=this.getMinutesDescription(),d=this.getHoursDescription();if(a+=l,a&&u&&(a+=`, `),a+=u,u===d)return a;a&&d&&(a+=`, `),a+=d}return a},e.prototype.getSecondsDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Seconds(t),t)},function(t){return e.i18n.secondsX0ThroughX1PastTheMinute()},function(t){return t==`0`?``:parseInt(t)<20?e.i18n.atX0SecondsPastTheMinute(t):e.i18n.atX0SecondsPastTheMinuteGt20()||e.i18n.atX0SecondsPastTheMinute(t)})},e.prototype.getMinutesDescription=function(){var e=this,t=this.expressionParts[0],n=this.expressionParts[2];return this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Minutes(t),t)},function(t){return e.i18n.minutesX0ThroughX1PastTheHour()},function(r){var i;try{return r==`0`&&n.indexOf(`/`)==-1&&t==``?e.i18n.everyHour():r==`0`?(i=e.i18n).onTheHour?.call(i)||e.i18n.atX0MinutesPastTheHour(r):parseInt(r)<20?e.i18n.atX0MinutesPastTheHour(r):e.i18n.atX0MinutesPastTheHourGt20()||e.i18n.atX0MinutesPastTheHour(r)}catch{return e.i18n.atX0MinutesPastTheHour(r)}})},e.prototype.getHoursDescription=function(){var e=this,t=this.expressionParts[2],n=0,i=[];t.split(`/`)[0].split(`,`).forEach(function(e){var t=e.split(`-`);t.length===2&&i.push({value:t[1],index:n+1}),n+=t.length});var a=0;return this.getSegmentDescription(t,this.i18n.everyHour(),function(t){var n=i.find(function(e){return e.value===t&&e.index===a})&&e.expressionParts[1]!==`0`;return a++,n?e.formatTime(t,`59`,``):e.formatTime(t,`0`,``)},function(t){return r.StringUtilities.format(e.i18n.everyX0Hours(t),t)},function(t){return e.i18n.betweenX0AndX1()},function(t){return e.i18n.atX0()})},e.prototype.getDayOfWeekDescription=function(){var e=this,t=this.i18n.daysOfTheWeek(),n=null;return n=this.expressionParts[5]==`*`?``:this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(n,r){var i=n;n.indexOf(`#`)>-1?i=n.substring(0,n.indexOf(`#`)):n.indexOf(`L`)>-1&&(i=i.replace(`L`,``));var a=parseInt(i),o=e.i18n.daysOfTheWeekInCase?e.i18n.daysOfTheWeekInCase(r)[a]:t[a];if(n.indexOf(`#`)>-1){var s=null,c=n.substring(n.indexOf(`#`)+1),l=n.substring(0,n.indexOf(`#`));switch(c){case`1`:s=e.i18n.first(l);break;case`2`:s=e.i18n.second(l);break;case`3`:s=e.i18n.third(l);break;case`4`:s=e.i18n.fourth(l);break;case`5`:s=e.i18n.fifth(l);break}o=s+` `+o}return o},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0DaysOfTheWeek(t),t)},function(t){var n=t.substring(0,t.indexOf(`-`));return e.expressionParts[3]==`*`?e.i18n.commaX0ThroughX1(n):e.i18n.commaAndX0ThroughX1(n)},function(t){var n=null;if(t.indexOf(`#`)>-1){var r=t.substring(t.indexOf(`#`)+1),i=t.substring(0,t.indexOf(`#`));n=e.i18n.commaOnThe(r,i).trim()+e.i18n.spaceX0OfTheMonth()}else n=t.indexOf(`L`)>-1?e.i18n.commaOnTheLastX0OfTheMonth(t.replace(`L`,``)):e.expressionParts[3]==`*`||e.options.logicalAndDayFields?e.i18n.commaOnlyOnX0(t):e.i18n.commaAndOnX0();return n}),n},e.prototype.getMonthDescription=function(){var e=this,t=this.i18n.monthsOfTheYear();return this.getSegmentDescription(this.expressionParts[4],``,function(n,r){return r&&e.i18n.monthsOfTheYearInCase?e.i18n.monthsOfTheYearInCase(r)[parseInt(n)-1]:t[parseInt(n)-1]},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0Months(t),t)},function(t){return e.i18n.commaMonthX0ThroughMonthX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInMonthX0?e.i18n.commaOnlyInMonthX0():e.i18n.commaOnlyInX0()})},e.prototype.getDayOfMonthDescription=function(){var e=this,t=null,n=this.expressionParts[3];switch(n){case`L`:t=this.i18n.commaOnTheLastDayOfTheMonth();break;case`WL`:case`LW`:t=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var i=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(i){var a=parseInt(i[0].replace(`W`,``)),o=a==1?this.i18n.firstWeekday():r.StringUtilities.format(this.i18n.weekdayNearestDayX0(),a.toString());t=r.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),o);break}else{var s=n.match(/L-(\d{1,2})/);if(s){var c=s[1];t=r.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(c),c);break}else if(n==`*`&&this.expressionParts[5]!=`*`)return``;else t=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(t){return t==`L`?e.i18n.lastDay():e.i18n.dayX0?r.StringUtilities.format(e.i18n.dayX0(),t):t},function(t){return t==`1`?e.i18n.commaEveryDay():e.i18n.commaEveryX0Days(t)},function(t){return e.i18n.commaBetweenDayX0AndX1OfTheMonth(t)},function(t){return e.i18n.commaOnDayX0OfTheMonth(t)});break}}return t},e.prototype.getYearDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[6],``,function(e){return/^\d+$/.test(e)?new Date(parseInt(e),1).getFullYear().toString():e},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0Years(t),t)},function(t){return e.i18n.commaYearX0ThroughYearX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInYearX0?e.i18n.commaOnlyInYearX0():e.i18n.commaOnlyInX0()})},e.prototype.getSegmentDescription=function(e,t,n,i,a,o){var s=null,c=e.indexOf(`/`)>-1,l=e.indexOf(`-`)>-1,u=e.indexOf(`,`)>-1;if(!e)s=``;else if(e===`*`)s=t;else if(!c&&!l&&!u)s=r.StringUtilities.format(o(e),n(e));else if(u){for(var d=e.split(`,`),f=``,p=0;p<d.length;p++)if(p>0&&d.length>2&&(f+=`,`,p<d.length-1&&(f+=` `)),p>0&&d.length>1&&(p==d.length-1||d.length==2)&&(f+=`${this.i18n.spaceAnd()} `),d[p].indexOf(`/`)>-1||d[p].indexOf(`-`)>-1){var m=d[p].indexOf(`-`)>-1&&d[p].indexOf(`/`)==-1,h=this.getSegmentDescription(d[p],t,n,i,m?this.i18n.commaX0ThroughX1:a,o);m&&(h=h.replace(`, `,``)),f+=h}else if(!c)f+=n(d[p]);else{var g=this.getSegmentDescription(d[p],t,n,i,a,o);g&&g.startsWith(`, `)&&(g=g.substring(2)),f+=g}s=c?f:r.StringUtilities.format(o(e),f)}else if(c){var d=e.split(`/`);if(s=r.StringUtilities.format(i(d[1]),d[1]),d[0].indexOf(`-`)>-1){var _=this.generateRangeSegmentDescription(d[0],a,n);_.indexOf(`, `)!=0&&(s+=`, `),s+=_}else if(d[0].indexOf(`*`)==-1){var v=r.StringUtilities.format(o(d[0]),n(d[0]));v=v.replace(`, `,``),s+=r.StringUtilities.format(this.i18n.commaStartingX0(),v)}}else l&&(s=this.generateRangeSegmentDescription(e,a,n));return s},e.prototype.generateRangeSegmentDescription=function(e,t,n){var i=``,a=e.split(`-`),o=n(a[0],1),s=n(a[1],2),c=t(e);return i+=r.StringUtilities.format(c,o,s),i},e.prototype.formatTime=function(e,t,n){var r=0,i=0,a=parseInt(e)+r,o=parseInt(t)+i;o>=60?(o-=60,a+=1):o<0&&(o+=60,--a),a>=24?a-=24:a<0&&(a=24+a);var s=``,c=!1;this.options.use24HourTimeFormat||(c=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),s=c?`${this.getPeriod(a)} `:` ${this.getPeriod(a)}`,a>12&&(a-=12),a===0&&(a=12));var l=``;n&&(l=`:${(`00`+n).substring(n.length)}`);var u=a.toString(),d=(`00`+u).substring(u.length),f=o.toString(),p=(`00`+f).substring(f.length),m=this.options.trimHoursLeadingZero?u:d;return`${c?s:``}${m}:${p}${l}${c?``:s}`},e.prototype.transformVerbosity=function(e,t){if(!t&&(e=e.replace(RegExp(`, ${this.i18n.everyMinute()}`,`g`),``),e=e.replace(RegExp(`, ${this.i18n.everyHour()}`,`g`),``),e=e.replace(new RegExp(this.i18n.commaEveryDay(),`g`),``),e=e.replace(/\, ?$/,``),this.i18n.conciseVerbosityReplacements))for(var n=0,r=Object.entries(this.i18n.conciseVerbosityReplacements());n<r.length;n++){var i=r[n],a=i[0],o=i[1];e=e.replace(new RegExp(a,`g`),o)}return e},e.prototype.getPeriod=function(e){return e>=12?this.i18n.pm&&this.i18n.pm()||`PM`:this.i18n.am&&this.i18n.am()||`AM`},e.locales={},e}()},747(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.enLocaleLoader=void 0;var r=n(486);t.enLocaleLoader=function(){function e(){}return e.prototype.load=function(e){e.en=new r.en},e}()},486(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.en=void 0,t.en=function(){function e(){}return e.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},e.prototype.atX0MinutesPastTheHourGt20=function(){return null},e.prototype.commaMonthX0ThroughMonthX1=function(){return null},e.prototype.commaYearX0ThroughYearX1=function(){return null},e.prototype.use24HourTimeFormatByDefault=function(){return!1},e.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return`An error occurred when generating the expression description. Check the cron expression syntax.`},e.prototype.everyMinute=function(){return`every minute`},e.prototype.everyHour=function(){return`every hour`},e.prototype.atSpace=function(){return`At `},e.prototype.everyMinuteBetweenX0AndX1=function(){return`Every minute between %s and %s`},e.prototype.at=function(){return`At`},e.prototype.spaceAnd=function(){return` and`},e.prototype.everySecond=function(){return`every second`},e.prototype.everyX0Seconds=function(){return`every %s seconds`},e.prototype.secondsX0ThroughX1PastTheMinute=function(){return`seconds %s through %s past the minute`},e.prototype.atX0SecondsPastTheMinute=function(){return`at %s seconds past the minute`},e.prototype.everyX0Minutes=function(){return`every %s minutes`},e.prototype.minutesX0ThroughX1PastTheHour=function(){return`minutes %s through %s past the hour`},e.prototype.atX0MinutesPastTheHour=function(){return`at %s minutes past the hour`},e.prototype.everyX0Hours=function(){return`every %s hours`},e.prototype.betweenX0AndX1=function(){return`between %s and %s`},e.prototype.atX0=function(){return`at %s`},e.prototype.commaEveryDay=function(){return`, every day`},e.prototype.commaEveryX0DaysOfTheWeek=function(){return`, every %s days of the week`},e.prototype.commaX0ThroughX1=function(){return`, %s through %s`},e.prototype.commaAndX0ThroughX1=function(){return`, %s through %s`},e.prototype.first=function(){return`first`},e.prototype.second=function(){return`second`},e.prototype.third=function(){return`third`},e.prototype.fourth=function(){return`fourth`},e.prototype.fifth=function(){return`fifth`},e.prototype.commaOnThe=function(){return`, on the `},e.prototype.spaceX0OfTheMonth=function(){return` %s of the month`},e.prototype.lastDay=function(){return`the last day`},e.prototype.commaOnTheLastX0OfTheMonth=function(){return`, on the last %s of the month`},e.prototype.commaOnlyOnX0=function(){return`, only on %s`},e.prototype.commaAndOnX0=function(){return`, and on %s`},e.prototype.commaEveryX0Months=function(){return`, every %s months`},e.prototype.commaOnlyInX0=function(){return`, only in %s`},e.prototype.commaOnTheLastDayOfTheMonth=function(){return`, on the last day of the month`},e.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return`, on the last weekday of the month`},e.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return`, %s days before the last day of the month`},e.prototype.firstWeekday=function(){return`first weekday`},e.prototype.weekdayNearestDayX0=function(){return`weekday nearest day %s`},e.prototype.commaOnTheX0OfTheMonth=function(){return`, on the %s of the month`},e.prototype.commaEveryX0Days=function(){return`, every %s days in a month`},e.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return`, between day %s and %s of the month`},e.prototype.commaOnDayX0OfTheMonth=function(){return`, on day %s of the month`},e.prototype.commaEveryHour=function(){return`, every hour`},e.prototype.commaEveryX0Years=function(){return`, every %s years`},e.prototype.commaStartingX0=function(){return`, starting %s`},e.prototype.daysOfTheWeek=function(){return[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},e.prototype.monthsOfTheYear=function(){return[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},e.prototype.atReboot=function(){return`Run once, at startup`},e.prototype.onTheHour=function(){return`on the hour`},e}()},515(e,t){Object.defineProperty(t,`__esModule`,{value:!0});function n(e,t){if(!e)throw Error(t)}t.default=function(){function e(){}return e.secondRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`seconds part must be >= 0 and <= 59`)}},e.minuteRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`minutes part must be >= 0 and <= 59`)}},e.hourRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=23,`hours part must be >= 0 and <= 23`)}},e.dayOfMonthRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=1&&i<=31,`DOM part must be >= 1 and <= 31`)}},e.monthRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=1&&a<=12,t?`month part must be >= 0 and <= 11`:`month part must be >= 1 and <= 12`)}},e.dayOfWeekRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=0&&a<=6,t?`DOW part must be >= 0 and <= 6`:`DOW part must be >= 1 and <= 7`)}},e}()},823(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.StringUtilities=void 0,t.StringUtilities=function(){function e(){}return e.format=function(e){var t=[...arguments].slice(1);return e.replace(/%s/g,function(e){return t.shift()})},e.containsAny=function(e,t){return t.some(function(t){return e.indexOf(t)>-1})},e}()}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.toString=void 0;var t=n(333),i=n(747);t.ExpressionDescriptor.initialize(new i.enLocaleLoader),e.default=t.ExpressionDescriptor,e.toString=t.ExpressionDescriptor.toString})(),r})())})),j=e(n(),1),M=e(A(),1),N=a(),P={title:``,description:``,cronExpression:``,assigneeId:``,priority:C.MEDIUM},F=({projectId:e,isOpen:t,onClose:n,onSuccess:a,initialData:o})=>{let{notifyApiError:A,notifyError:F}=ee(),[I,L]=(0,j.useState)(!1),[R,z]=(0,j.useState)(!1),{control:B,formState:{errors:V},handleSubmit:H,register:U,reset:W,setValue:G}=ne({resolver:x(w),defaultValues:P,mode:`onBlur`}),K=S({control:B,name:`cronExpression`}),q=S({control:B,name:`assigneeId`}),re=S({control:B,name:`priority`}),J=r({queryKey:[`agents`],enabled:t,queryFn:async()=>(await b.findAll()).data??[]}),ie=[{label:`Every 10s`,value:`*/10 * * * * *`},{label:`Every 15m`,value:`*/15 * * * *`},{label:`Hourly`,value:`0 * * * *`},{label:`Daily (12AM)`,value:`0 0 * * *`},{label:`Weekly (Sun)`,value:`0 0 * * 0`},{label:`Monthly (1st)`,value:`0 0 1 * *`}];(0,j.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),W(o?{title:o.title,description:o.description,cronExpression:o.cronExpression,assigneeId:o.assignee.id,priority:Number(o.priority)}:P),()=>{window.removeEventListener(`keydown`,e),z(!1),L(!1),W(P)}},[o,t,n,W]),(0,j.useEffect)(()=>{!t||!J.error||A(J.error,`Agents Load Failed`)},[J.error,t,A]);let Y=i({mutationFn:async t=>{if(o){await E.update(e,o.id,{title:t.title,description:t.description,cronExpression:t.cronExpression,assigneeId:t.assigneeId,priority:t.priority});return}await E.create(e,{title:t.title,description:t.description,cronExpression:t.cronExpression,assigneeId:t.assigneeId,priority:t.priority,status:T.ACTIVE})},onSuccess:()=>{a(),n()},onError:e=>{A(e,`Operation Failed`)}}),X=(0,j.useMemo)(()=>{if(!K||V.cronExpression)return null;try{return M.default.toString(K)}catch{return null}},[K,V.cronExpression]),ae=e=>{switch(e){case C.CRITICAL:return`CRIT`;case C.HIGH:return`HIGH`;case C.MEDIUM:return`MED`;case C.LOW:return`LOW`;default:return`MED`}},Z=J.data??[],Q=Z.find(e=>e.id===q),oe=J.isPending||J.isFetching,$=Y.isPending,se=H(async e=>{await Y.mutateAsync(e)},()=>{F(`Validation Error`,`Please fill in all required fields before deploying the task.`)});return t?(0,N.jsx)(v,{children:(0,N.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-background/60 backdrop-blur-md flex items-center justify-center p-4 overflow-y-auto`,children:(0,N.jsxs)(y.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`glass-panel w-full max-w-2xl rounded-xl overflow-hidden shadow-2xl glow-primary flex flex-col my-8`,"data-testid":`recurrent-task-modal`,onClick:e=>e.stopPropagation(),children:[(0,N.jsxs)(`div`,{className:`p-6 pb-0 flex justify-between items-start`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-2xl font-headline font-extrabold text-primary tracking-tight`,children:o?`Update Protocol`:`Deploy New Task`}),(0,N.jsx)(`p`,{className:`text-sm text-on-surface-variant mt-1`,children:o?`Modify the existing automated orchestration routine.`:`Configure an automated orchestration routine.`})]}),(0,N.jsx)(`button`,{onClick:n,className:`text-on-surface-variant hover:text-on-surface transition-colors p-1`,children:(0,N.jsx)(_,{size:24})})]}),(0,N.jsxs)(`form`,{onSubmit:se,className:`flex flex-col`,children:[(0,N.jsxs)(`div`,{className:`p-8 space-y-8 overflow-y-auto max-h-[70vh] custom-scrollbar`,children:[(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-tertiary`,children:[(0,N.jsx)(D,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Task Identity`})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[(0,N.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,N.jsx)(`label`,{className:`text-xs font-medium text-on-surface-variant px-1`,children:`Task Name`}),(0,N.jsx)(`input`,{type:`text`,className:`w-full bg-surface-container-lowest border-none rounded-lg p-3 text-on-surface placeholder:text-outline-variant focus:ring-1 focus:ring-tertiary transition-all`,placeholder:`e.g., Daily Market Sweep`,...U(`title`)})]}),(0,N.jsx)(te,{control:B,name:`description`,render:({field:e})=>(0,N.jsx)(p,{label:`Description`,value:e.value,onChange:e.onChange,placeholder:`Briefly describe the objective of this task... You can use markdown for formatting.`,height:`h-32`,helperText:`Supports GitHub Flavored Markdown`})})]})]}),(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-primary`,children:[(0,N.jsx)(s,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Agent Fleet`})]}),(0,N.jsxs)(`div`,{className:`relative`,children:[(0,N.jsxs)(`div`,{className:`flex items-center bg-surface-container-lowest rounded-lg p-3 cursor-pointer hover:bg-surface-container-high transition-colors ring-1 ring-outline-variant/10 focus-within:ring-primary/40`,onClick:()=>L(!I),role:`combobox`,"aria-expanded":I,"data-testid":`agent-select`,children:[(0,N.jsx)(`div`,{className:`w-8 h-8 rounded bg-primary/20 flex items-center justify-center mr-3`,children:(0,N.jsx)(c,{size:16,className:`text-primary`})}),(0,N.jsxs)(`div`,{className:`flex-1`,children:[(0,N.jsx)(`div`,{className:`text-sm font-semibold text-on-surface`,children:Q?Q.name:`Select Intelligence Core`}),(0,N.jsx)(`div`,{className:`text-xs text-on-surface-variant`,children:Q?Q.role||`Active Agent`:`Choose an active agent for execution`})]}),(0,N.jsx)(l,{size:20,className:`text-outline transition-transform ${I?`rotate-180`:``}`})]}),(0,N.jsx)(v,{children:I&&(0,N.jsx)(y.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:`absolute top-full left-0 w-full mt-2 bg-surface-container-highest rounded-lg shadow-xl p-2 z-50 border border-outline-variant/20 max-h-60 overflow-y-auto custom-scrollbar`,"data-testid":`agent-dropdown`,children:oe?(0,N.jsx)(`div`,{className:`p-4 text-center text-xs text-on-surface-variant animate-pulse`,children:`Scanning fleet...`}):Z.length===0?(0,N.jsx)(`div`,{className:`p-4 text-center text-xs text-on-surface-variant`,children:`No active agents found.`}):Z.map(e=>(0,N.jsxs)(`div`,{className:`p-3 hover:bg-surface-container-low rounded cursor-pointer flex items-center gap-3 transition-colors group`,onClick:()=>{G(`assigneeId`,e.id,{shouldDirty:!0,shouldValidate:!0}),L(!1)},"data-testid":`agent-option-${e.id}`,children:[(0,N.jsx)(`div`,{className:`w-8 h-8 rounded bg-surface-container-high flex items-center justify-center group-hover:bg-primary/20 transition-colors`,children:(0,N.jsx)(m,{size:14,className:`text-secondary group-hover:text-primary`})}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-bold text-on-surface group-hover:text-primary transition-colors`,children:e.name}),(0,N.jsxs)(`div`,{className:`text-[10px] text-secondary`,children:[e.status||`Active`,` • `,e.role||`Core`]})]})]},e.id))})}),(0,N.jsxs)(`select`,{className:`sr-only`,value:q,onChange:e=>G(`assigneeId`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),children:[(0,N.jsx)(`option`,{value:``,children:`Select Agent`}),Z.map(e=>(0,N.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8`,children:[(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-secondary`,children:[(0,N.jsx)(d,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Scheduling Protocol`})]}),(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`relative flex items-center gap-2`,children:[(0,N.jsxs)(`div`,{className:`relative flex-1`,children:[(0,N.jsx)(`input`,{required:!0,className:`w-full bg-surface-container-lowest border-none rounded-lg p-3 font-mono text-sm text-secondary focus:ring-1 transition-all pr-10 ${V.cronExpression?`ring-1 ring-error`:`focus:ring-secondary`}`,type:`text`,...U(`cronExpression`),placeholder:`e.g. 0 0 * * *`}),(0,N.jsx)(f,{size:16,className:`absolute right-3 top-3.5 text-outline-variant`})]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>z(!R),className:`p-3 rounded-lg border transition-all ${R?`bg-secondary/20 border-secondary text-secondary shadow-[0_0_10px_rgba(78,222,163,0.2)]`:`bg-surface-container-lowest border-outline-variant/10 text-on-surface-variant hover:text-secondary hover:border-secondary/30`}`,title:`Open Cron Wizard`,children:(0,N.jsx)(k,{size:18})})]}),(0,N.jsx)(v,{children:R&&(0,N.jsx)(y.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},className:`overflow-hidden bg-surface-container-highest/30 rounded-xl border border-secondary/10`,children:(0,N.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-black uppercase tracking-widest text-secondary/60`,children:[(0,N.jsx)(g,{size:12}),`Temporal Presets`]}),(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ie.map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>{G(`cronExpression`,e.value,{shouldDirty:!0,shouldValidate:!0})},className:`px-3 py-1.5 rounded-full text-[10px] font-bold border transition-all ${K===e.value?`bg-secondary text-on-secondary border-secondary shadow-lg shadow-secondary/20`:`bg-surface-container-lowest border-outline-variant/10 text-on-surface-variant hover:border-secondary/40 hover:text-secondary`}`,children:e.label},e.value))})]})})}),X&&!V.cronExpression&&(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-secondary font-medium bg-secondary/5 px-3 py-2 rounded-lg border border-secondary/10 animate-in fade-in slide-in-from-left-2`,children:[(0,N.jsx)(O,{size:14,className:`shrink-0`}),(0,N.jsx)(`span`,{children:X})]}),(0,N.jsx)(`div`,{className:`px-1 py-1`,children:(0,N.jsxs)(`p`,{className:`text-[9px] text-on-surface-variant/40 font-mono uppercase tracking-[0.1em] flex gap-2`,children:[(0,N.jsx)(`span`,{className:`text-secondary/60 opacity-60 font-black`,children:`[Sec]`}),(0,N.jsx)(`span`,{children:`Min`}),(0,N.jsx)(`span`,{children:`Hour`}),(0,N.jsx)(`span`,{children:`Dom`}),(0,N.jsx)(`span`,{children:`Mon`}),(0,N.jsx)(`span`,{children:`Dow`})]})}),V.cronExpression?.message&&(0,N.jsxs)(`p`,{className:`text-[10px] text-error px-1 flex items-center gap-1.5 font-medium`,children:[(0,N.jsx)(u,{size:12}),V.cronExpression.message]})]})]}),(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-error`,children:[(0,N.jsx)(u,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Execution Priority`})]}),(0,N.jsx)(`div`,{className:`flex bg-surface-container-lowest p-1 rounded-lg`,children:[C.LOW,C.MEDIUM,C.HIGH,C.CRITICAL].map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>G(`priority`,e,{shouldDirty:!0,shouldValidate:!0}),className:`flex-1 py-2 text-[10px] font-bold rounded transition-all ${Number(re)===Number(e)?e===C.CRITICAL?`bg-error/20 text-error`:`bg-surface-container-high text-primary`:`text-on-surface-variant hover:text-on-surface`}`,children:ae(e)},e))})]})]}),(0,N.jsxs)(`section`,{className:`bg-surface-container-low p-5 rounded-xl border border-outline-variant/10`,children:[(0,N.jsxs)(`div`,{className:`flex justify-between items-center mb-4`,children:[(0,N.jsx)(`h4`,{className:`text-xs font-bold font-headline text-on-surface-variant tracking-wide`,children:`Deployment Preview`}),(0,N.jsx)(`span`,{className:`text-[10px] bg-secondary-container/30 text-secondary px-2 py-0.5 rounded-full font-bold uppercase`,children:`System Cluster 0-A`})]}),(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between text-xs p-2 bg-surface-container-high/50 rounded-lg`,children:[(0,N.jsx)(`span`,{className:`text-on-surface font-medium italic`,children:`Logic integrity check passed`}),(0,N.jsx)(`span`,{className:`text-secondary font-bold`,children:`READY`})]}),(0,N.jsxs)(`div`,{className:`text-[10px] text-on-surface-variant leading-relaxed`,children:[`This task will be registered in the Alpha-Centauri cluster and executed by `,(0,N.jsx)(`span`,{className:`text-primary`,children:Q?.name||`an assigned agent`}),` according to the provided temporal sequence.`]})]})]})]}),(0,N.jsxs)(`div`,{className:`p-6 bg-surface-container-low/50 flex justify-end items-center gap-4 sticky bottom-0 border-t border-outline-variant/10`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:n,className:`px-6 py-2.5 text-sm font-bold text-on-surface-variant hover:text-on-surface transition-all active:scale-95`,children:`Cancel`}),(0,N.jsxs)(`button`,{type:`submit`,disabled:$,className:`px-8 py-2.5 text-sm font-bold bg-primary text-on-primary rounded-lg shadow-lg hover:shadow-primary/20 transition-all active:scale-95 flex items-center gap-2 disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group`,children:[$?(0,N.jsx)(`div`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,N.jsx)(h,{size:16,className:`group-hover:translate-x-0.5 group-hover:-translate-y-0.5 transition-transform`}),o?`Update Task`:`Create Task`]})]})]})]})})}):null};export{F as default};
|
|
1
|
+
import{a as e,t}from"./rolldown-runtime-COnpUsM8.js";import{g as n}from"./vendor-dnd-CfaHPvi0.js";import{n as r,t as i}from"./vendor-query-xpDrc4rM.js";import{r as a}from"./vendor-markdown-DoJbQ1of.js";import{i as o}from"./client-B553SX3l.js";import{t as s}from"./bot-DadO9w3D.js";import{t as c}from"./brain-DWTpby6b.js";import{t as l}from"./chevron-down-BUOg3vvd.js";import{t as u}from"./circle-alert-sCcf7ANF.js";import{t as d}from"./clock-CSNFJjo4.js";import{n as f,t as p}from"./MarkdownField-DR6tHsei.js";import{t as m}from"./cpu-C2_GFeSH.js";import{t as h}from"./rocket-B9Iexkcw.js";import{t as g}from"./sparkles-krUpxie4.js";import{t as _}from"./x-CCZGYGDC.js";import{n as v,t as y}from"./vendor-motion-CMGWJcqR.js";import{n as b}from"./agents-YQJ7JNfI.js";import{t as ee}from"./useNotification-DQayTSUL.js";import{a as x,c as S,o as te,s as ne}from"./vendor-forms-DHyqHeyd.js";import{t as C}from"./tasks-DHsBE-ea.js";import{a as w}from"./taskFormSchemas-B6YlRxrx.js";import{n as T,r as E}from"./recurrent-tasks-7thk45mk.js";var D=o(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),O=o(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),k=o(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),A=t(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define(`cronstrue`,[],r):typeof e==`object`?e.cronstrue=r():n.cronstrue=r()})(globalThis,()=>(()=>{var e={949(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.CronParser=void 0;var r=n(515);t.CronParser=function(){function e(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=!1),this.expression=e,this.dayOfWeekStartIndexZero=t,this.monthStartIndexZero=n}return e.prototype.parse=function(){var e,t=this.expression??``;if(t===`@reboot`)return e=[`@reboot`,``,``,``,``,``,``],e;if(t.startsWith(`@`)){var n=this.parseSpecial(this.expression);e=this.extractParts(n)}else e=this.extractParts(this.expression);return this.normalize(e),this.validate(e),e},e.prototype.parseSpecial=function(e){var t={"@yearly":`0 0 1 1 *`,"@annually":`0 0 1 1 *`,"@monthly":`0 0 1 * *`,"@weekly":`0 0 * * 0`,"@daily":`0 0 * * *`,"@midnight":`0 0 * * *`,"@hourly":`0 * * * *`,"@reboot":`@reboot`}[e];if(!t)throw Error(`Unknown special expression.`);return t},e.prototype.extractParts=function(e){if(!this.expression)throw Error(`cron expression is empty`);for(var t=e.trim().split(/[ ]+/),n=0;n<t.length;n++)if(t[n].includes(`,`)){var r=t[n].split(`,`).map(function(e){return e.trim()}).filter(function(e){return e!==``}).map(function(e){return isNaN(Number(e))?e:Number(e)}).filter(function(e){return e!==null&&e!==``});r.length===0&&r.push(`*`),r.sort(function(e,t){return e!==null&&t!==null?e-t:0}),t[n]=r.map(function(e){return e===null?``:e.toString()}).join(`,`)}if(t.length<5)throw Error(`Expression has only ${t.length} part${t.length==1?``:`s`}. At least 5 parts are required.`);if(t.length==5)t.unshift(``),t.push(``);else if(t.length==6)/\d{4}$/.test(t[5])||t[4]==`?`||t[2]==`?`?t.unshift(``):t.push(``);else if(t.length>7)throw Error(`Expression has ${t.length} parts; too many!`);return t},e.prototype.normalize=function(e){var t=this;if(e[3]=e[3].replace(`?`,`*`),e[5]=e[5].replace(`?`,`*`),e[2]=e[2].replace(`?`,`*`),e[0].indexOf(`0/`)==0&&(e[0]=e[0].replace(`0/`,`*/`)),e[1].indexOf(`0/`)==0&&(e[1]=e[1].replace(`0/`,`*/`)),e[2].indexOf(`0/`)==0&&(e[2]=e[2].replace(`0/`,`*/`)),e[3].indexOf(`1/`)==0&&(e[3]=e[3].replace(`1/`,`*/`)),e[4].indexOf(`1/`)==0&&(e[4]=e[4].replace(`1/`,`*/`)),e[6].indexOf(`1/`)==0&&(e[6]=e[6].replace(`1/`,`*/`)),e[5]=e[5].replace(/(^\d)|([^#/\s]\d)/g,function(e){var n=e.replace(/\D/,``),r=n;return t.dayOfWeekStartIndexZero?n==`7`&&(r=`0`):r=(parseInt(n)-1).toString(),e.replace(n,r)}),e[5]==`L`&&(e[5]=`6`),e[3]==`?`&&(e[3]=`*`),e[3].indexOf(`W`)>-1&&(e[3].indexOf(`,`)>-1||e[3].indexOf(`-`)>-1))throw Error(`The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.`);var n={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var r in n)e[5]=e[5].replace(new RegExp(r,`gi`),n[r].toString());e[4]=e[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(e){var n=e.replace(/\D/,``),r=n;return t.monthStartIndexZero&&(r=(parseInt(n)+1).toString()),e.replace(n,r)});var i={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var a in i)e[4]=e[4].replace(new RegExp(a,`gi`),i[a].toString());e[0]==`0`&&(e[0]=``),!/\*|\-|\,|\//.test(e[2])&&(/\*|\//.test(e[1])||/\*|\//.test(e[0]))&&(e[2]+=`-${e[2]}`);for(var o=0;o<e.length;o++)if(e[o].indexOf(`,`)!=-1&&(e[o]=e[o].split(`,`).filter(function(e){return e!==``}).join(`,`)||`*`),e[o]==`*/1`&&(e[o]=`*`),e[o].indexOf(`/`)>-1&&!/^\*|\-|\,/.test(e[o])){var s=null;switch(o){case 4:s=`12`;break;case 5:s=`6`;break;case 6:s=`9999`;break;default:s=null;break}if(s!==null){var c=e[o].split(`/`);e[o]=`${c[0]}-${s}/${c[1]}`}}},e.prototype.validate=function(e){var t=`0-9,\\-*/`;this.validateOnlyExpectedCharactersFound(e[0],t),this.validateOnlyExpectedCharactersFound(e[1],t),this.validateOnlyExpectedCharactersFound(e[2],t),this.validateOnlyExpectedCharactersFound(e[3],`0-9,\\-*/LW`),this.validateOnlyExpectedCharactersFound(e[4],t),this.validateOnlyExpectedCharactersFound(e[5],`0-9,\\-*/L#`),this.validateOnlyExpectedCharactersFound(e[6],t),this.validateAnyRanges(e)},e.prototype.validateAnyRanges=function(e){r.default.secondRange(e[0]),r.default.minuteRange(e[1]),r.default.hourRange(e[2]),r.default.dayOfMonthRange(e[3]),r.default.monthRange(e[4],this.monthStartIndexZero),r.default.dayOfWeekRange(e[5],this.dayOfWeekStartIndexZero)},e.prototype.validateOnlyExpectedCharactersFound=function(e,t){var n=e.match(RegExp(`[^${t}]+`,`gi`));if(n&&n.length)throw Error(`Expression contains invalid values: '${n.toString()}'`)},e}()},333(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.ExpressionDescriptor=void 0;var r=n(823),i=n(949);t.ExpressionDescriptor=function(){function e(t,n){if(this.expression=t,this.options=n,this.expressionParts=[,,,,,],!this.options.locale&&e.defaultLocale&&(this.options.locale=e.defaultLocale),!e.locales[this.options.locale]){var r=Object.keys(e.locales)[0];console.warn(`Locale '${this.options.locale}' could not be found; falling back to '${r}'.`),this.options.locale=r}this.i18n=e.locales[this.options.locale],n.use24HourTimeFormat===void 0&&(n.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,n){var r=n===void 0?{}:n,i=r.throwExceptionOnParseError,a=i===void 0?!0:i,o=r.verbose,s=o===void 0?!1:o,c=r.dayOfWeekStartIndexZero,l=c===void 0?!0:c,u=r.monthStartIndexZero,d=u===void 0?!1:u,f=r.use24HourTimeFormat,p=r.trimHoursLeadingZero,m=p===void 0?!1:p,h=r.locale,g=h===void 0?null:h,_=r.logicalAndDayFields,v={throwExceptionOnParseError:a,verbose:s,dayOfWeekStartIndexZero:l,monthStartIndexZero:d,use24HourTimeFormat:f,trimHoursLeadingZero:m,locale:g,logicalAndDayFields:_===void 0?!1:_};return v.tzOffset&&console.warn(`'tzOffset' option has been deprecated and is no longer supported.`),new e(t,v).getFullDescription()},e.initialize=function(t,n){n===void 0&&(n=`en`),e.specialCharacters=[`/`,`-`,`,`,`*`],e.defaultLocale=n,t.load(e.locales)},e.prototype.getFullDescription=function(){var e,t=``;try{if(this.expressionParts=new i.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero).parse(),this.expressionParts[0]===`@reboot`)return(e=this.i18n).atReboot?.call(e)||`Run once, at startup`;var n=this.getTimeOfDayDescription(),r=this.getDayOfMonthDescription(),a=this.getMonthDescription(),o=this.getDayOfWeekDescription(),s=this.getYearDescription();t+=n+r+o+a+s,t=this.transformVerbosity(t,!!this.options.verbose),t=t.charAt(0).toLocaleUpperCase()+t.substr(1)}catch(e){if(!this.options.throwExceptionOnParseError)t=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw`${e}`}return t},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],n=this.expressionParts[1],i=this.expressionParts[2],a=``;if(!r.StringUtilities.containsAny(n,e.specialCharacters)&&!r.StringUtilities.containsAny(i,e.specialCharacters)&&!r.StringUtilities.containsAny(t,e.specialCharacters))a+=this.i18n.atSpace()+this.formatTime(i,n,t);else if(!t&&n.indexOf(`-`)>-1&&!(n.indexOf(`,`)>-1)&&!(n.indexOf(`/`)>-1)&&!r.StringUtilities.containsAny(i,e.specialCharacters)){var o=n.split(`-`);a+=r.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(i,o[0],``),this.formatTime(i,o[1],``))}else if(!t&&i.indexOf(`,`)>-1&&i.indexOf(`-`)==-1&&i.indexOf(`/`)==-1&&!r.StringUtilities.containsAny(n,e.specialCharacters)){var s=i.split(`,`);a+=this.i18n.at();for(var c=0;c<s.length;c++)a+=` `,a+=this.formatTime(s[c],n,``),c<s.length-2&&(a+=`,`),c==s.length-2&&(a+=this.i18n.spaceAnd())}else{var l=this.getSecondsDescription(),u=this.getMinutesDescription(),d=this.getHoursDescription();if(a+=l,a&&u&&(a+=`, `),a+=u,u===d)return a;a&&d&&(a+=`, `),a+=d}return a},e.prototype.getSecondsDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Seconds(t),t)},function(t){return e.i18n.secondsX0ThroughX1PastTheMinute()},function(t){return t==`0`?``:parseInt(t)<20?e.i18n.atX0SecondsPastTheMinute(t):e.i18n.atX0SecondsPastTheMinuteGt20()||e.i18n.atX0SecondsPastTheMinute(t)})},e.prototype.getMinutesDescription=function(){var e=this,t=this.expressionParts[0],n=this.expressionParts[2];return this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Minutes(t),t)},function(t){return e.i18n.minutesX0ThroughX1PastTheHour()},function(r){var i;try{return r==`0`&&n.indexOf(`/`)==-1&&t==``?e.i18n.everyHour():r==`0`?(i=e.i18n).onTheHour?.call(i)||e.i18n.atX0MinutesPastTheHour(r):parseInt(r)<20?e.i18n.atX0MinutesPastTheHour(r):e.i18n.atX0MinutesPastTheHourGt20()||e.i18n.atX0MinutesPastTheHour(r)}catch{return e.i18n.atX0MinutesPastTheHour(r)}})},e.prototype.getHoursDescription=function(){var e=this,t=this.expressionParts[2],n=0,i=[];t.split(`/`)[0].split(`,`).forEach(function(e){var t=e.split(`-`);t.length===2&&i.push({value:t[1],index:n+1}),n+=t.length});var a=0;return this.getSegmentDescription(t,this.i18n.everyHour(),function(t){var n=i.find(function(e){return e.value===t&&e.index===a})&&e.expressionParts[1]!==`0`;return a++,n?e.formatTime(t,`59`,``):e.formatTime(t,`0`,``)},function(t){return r.StringUtilities.format(e.i18n.everyX0Hours(t),t)},function(t){return e.i18n.betweenX0AndX1()},function(t){return e.i18n.atX0()})},e.prototype.getDayOfWeekDescription=function(){var e=this,t=this.i18n.daysOfTheWeek(),n=null;return n=this.expressionParts[5]==`*`?``:this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(n,r){var i=n;n.indexOf(`#`)>-1?i=n.substring(0,n.indexOf(`#`)):n.indexOf(`L`)>-1&&(i=i.replace(`L`,``));var a=parseInt(i),o=e.i18n.daysOfTheWeekInCase?e.i18n.daysOfTheWeekInCase(r)[a]:t[a];if(n.indexOf(`#`)>-1){var s=null,c=n.substring(n.indexOf(`#`)+1),l=n.substring(0,n.indexOf(`#`));switch(c){case`1`:s=e.i18n.first(l);break;case`2`:s=e.i18n.second(l);break;case`3`:s=e.i18n.third(l);break;case`4`:s=e.i18n.fourth(l);break;case`5`:s=e.i18n.fifth(l);break}o=s+` `+o}return o},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0DaysOfTheWeek(t),t)},function(t){var n=t.substring(0,t.indexOf(`-`));return e.expressionParts[3]==`*`?e.i18n.commaX0ThroughX1(n):e.i18n.commaAndX0ThroughX1(n)},function(t){var n=null;if(t.indexOf(`#`)>-1){var r=t.substring(t.indexOf(`#`)+1),i=t.substring(0,t.indexOf(`#`));n=e.i18n.commaOnThe(r,i).trim()+e.i18n.spaceX0OfTheMonth()}else n=t.indexOf(`L`)>-1?e.i18n.commaOnTheLastX0OfTheMonth(t.replace(`L`,``)):e.expressionParts[3]==`*`||e.options.logicalAndDayFields?e.i18n.commaOnlyOnX0(t):e.i18n.commaAndOnX0();return n}),n},e.prototype.getMonthDescription=function(){var e=this,t=this.i18n.monthsOfTheYear();return this.getSegmentDescription(this.expressionParts[4],``,function(n,r){return r&&e.i18n.monthsOfTheYearInCase?e.i18n.monthsOfTheYearInCase(r)[parseInt(n)-1]:t[parseInt(n)-1]},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0Months(t),t)},function(t){return e.i18n.commaMonthX0ThroughMonthX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInMonthX0?e.i18n.commaOnlyInMonthX0():e.i18n.commaOnlyInX0()})},e.prototype.getDayOfMonthDescription=function(){var e=this,t=null,n=this.expressionParts[3];switch(n){case`L`:t=this.i18n.commaOnTheLastDayOfTheMonth();break;case`WL`:case`LW`:t=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var i=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(i){var a=parseInt(i[0].replace(`W`,``)),o=a==1?this.i18n.firstWeekday():r.StringUtilities.format(this.i18n.weekdayNearestDayX0(),a.toString());t=r.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),o);break}else{var s=n.match(/L-(\d{1,2})/);if(s){var c=s[1];t=r.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(c),c);break}else if(n==`*`&&this.expressionParts[5]!=`*`)return``;else t=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(t){return t==`L`?e.i18n.lastDay():e.i18n.dayX0?r.StringUtilities.format(e.i18n.dayX0(),t):t},function(t){return t==`1`?e.i18n.commaEveryDay():e.i18n.commaEveryX0Days(t)},function(t){return e.i18n.commaBetweenDayX0AndX1OfTheMonth(t)},function(t){return e.i18n.commaOnDayX0OfTheMonth(t)});break}}return t},e.prototype.getYearDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[6],``,function(e){return/^\d+$/.test(e)?new Date(parseInt(e),1).getFullYear().toString():e},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0Years(t),t)},function(t){return e.i18n.commaYearX0ThroughYearX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInYearX0?e.i18n.commaOnlyInYearX0():e.i18n.commaOnlyInX0()})},e.prototype.getSegmentDescription=function(e,t,n,i,a,o){var s=null,c=e.indexOf(`/`)>-1,l=e.indexOf(`-`)>-1,u=e.indexOf(`,`)>-1;if(!e)s=``;else if(e===`*`)s=t;else if(!c&&!l&&!u)s=r.StringUtilities.format(o(e),n(e));else if(u){for(var d=e.split(`,`),f=``,p=0;p<d.length;p++)if(p>0&&d.length>2&&(f+=`,`,p<d.length-1&&(f+=` `)),p>0&&d.length>1&&(p==d.length-1||d.length==2)&&(f+=`${this.i18n.spaceAnd()} `),d[p].indexOf(`/`)>-1||d[p].indexOf(`-`)>-1){var m=d[p].indexOf(`-`)>-1&&d[p].indexOf(`/`)==-1,h=this.getSegmentDescription(d[p],t,n,i,m?this.i18n.commaX0ThroughX1:a,o);m&&(h=h.replace(`, `,``)),f+=h}else if(!c)f+=n(d[p]);else{var g=this.getSegmentDescription(d[p],t,n,i,a,o);g&&g.startsWith(`, `)&&(g=g.substring(2)),f+=g}s=c?f:r.StringUtilities.format(o(e),f)}else if(c){var d=e.split(`/`);if(s=r.StringUtilities.format(i(d[1]),d[1]),d[0].indexOf(`-`)>-1){var _=this.generateRangeSegmentDescription(d[0],a,n);_.indexOf(`, `)!=0&&(s+=`, `),s+=_}else if(d[0].indexOf(`*`)==-1){var v=r.StringUtilities.format(o(d[0]),n(d[0]));v=v.replace(`, `,``),s+=r.StringUtilities.format(this.i18n.commaStartingX0(),v)}}else l&&(s=this.generateRangeSegmentDescription(e,a,n));return s},e.prototype.generateRangeSegmentDescription=function(e,t,n){var i=``,a=e.split(`-`),o=n(a[0],1),s=n(a[1],2),c=t(e);return i+=r.StringUtilities.format(c,o,s),i},e.prototype.formatTime=function(e,t,n){var r=0,i=0,a=parseInt(e)+r,o=parseInt(t)+i;o>=60?(o-=60,a+=1):o<0&&(o+=60,--a),a>=24?a-=24:a<0&&(a=24+a);var s=``,c=!1;this.options.use24HourTimeFormat||(c=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),s=c?`${this.getPeriod(a)} `:` ${this.getPeriod(a)}`,a>12&&(a-=12),a===0&&(a=12));var l=``;n&&(l=`:${(`00`+n).substring(n.length)}`);var u=a.toString(),d=(`00`+u).substring(u.length),f=o.toString(),p=(`00`+f).substring(f.length),m=this.options.trimHoursLeadingZero?u:d;return`${c?s:``}${m}:${p}${l}${c?``:s}`},e.prototype.transformVerbosity=function(e,t){if(!t&&(e=e.replace(RegExp(`, ${this.i18n.everyMinute()}`,`g`),``),e=e.replace(RegExp(`, ${this.i18n.everyHour()}`,`g`),``),e=e.replace(new RegExp(this.i18n.commaEveryDay(),`g`),``),e=e.replace(/\, ?$/,``),this.i18n.conciseVerbosityReplacements))for(var n=0,r=Object.entries(this.i18n.conciseVerbosityReplacements());n<r.length;n++){var i=r[n],a=i[0],o=i[1];e=e.replace(new RegExp(a,`g`),o)}return e},e.prototype.getPeriod=function(e){return e>=12?this.i18n.pm&&this.i18n.pm()||`PM`:this.i18n.am&&this.i18n.am()||`AM`},e.locales={},e}()},747(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.enLocaleLoader=void 0;var r=n(486);t.enLocaleLoader=function(){function e(){}return e.prototype.load=function(e){e.en=new r.en},e}()},486(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.en=void 0,t.en=function(){function e(){}return e.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},e.prototype.atX0MinutesPastTheHourGt20=function(){return null},e.prototype.commaMonthX0ThroughMonthX1=function(){return null},e.prototype.commaYearX0ThroughYearX1=function(){return null},e.prototype.use24HourTimeFormatByDefault=function(){return!1},e.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return`An error occurred when generating the expression description. Check the cron expression syntax.`},e.prototype.everyMinute=function(){return`every minute`},e.prototype.everyHour=function(){return`every hour`},e.prototype.atSpace=function(){return`At `},e.prototype.everyMinuteBetweenX0AndX1=function(){return`Every minute between %s and %s`},e.prototype.at=function(){return`At`},e.prototype.spaceAnd=function(){return` and`},e.prototype.everySecond=function(){return`every second`},e.prototype.everyX0Seconds=function(){return`every %s seconds`},e.prototype.secondsX0ThroughX1PastTheMinute=function(){return`seconds %s through %s past the minute`},e.prototype.atX0SecondsPastTheMinute=function(){return`at %s seconds past the minute`},e.prototype.everyX0Minutes=function(){return`every %s minutes`},e.prototype.minutesX0ThroughX1PastTheHour=function(){return`minutes %s through %s past the hour`},e.prototype.atX0MinutesPastTheHour=function(){return`at %s minutes past the hour`},e.prototype.everyX0Hours=function(){return`every %s hours`},e.prototype.betweenX0AndX1=function(){return`between %s and %s`},e.prototype.atX0=function(){return`at %s`},e.prototype.commaEveryDay=function(){return`, every day`},e.prototype.commaEveryX0DaysOfTheWeek=function(){return`, every %s days of the week`},e.prototype.commaX0ThroughX1=function(){return`, %s through %s`},e.prototype.commaAndX0ThroughX1=function(){return`, %s through %s`},e.prototype.first=function(){return`first`},e.prototype.second=function(){return`second`},e.prototype.third=function(){return`third`},e.prototype.fourth=function(){return`fourth`},e.prototype.fifth=function(){return`fifth`},e.prototype.commaOnThe=function(){return`, on the `},e.prototype.spaceX0OfTheMonth=function(){return` %s of the month`},e.prototype.lastDay=function(){return`the last day`},e.prototype.commaOnTheLastX0OfTheMonth=function(){return`, on the last %s of the month`},e.prototype.commaOnlyOnX0=function(){return`, only on %s`},e.prototype.commaAndOnX0=function(){return`, and on %s`},e.prototype.commaEveryX0Months=function(){return`, every %s months`},e.prototype.commaOnlyInX0=function(){return`, only in %s`},e.prototype.commaOnTheLastDayOfTheMonth=function(){return`, on the last day of the month`},e.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return`, on the last weekday of the month`},e.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return`, %s days before the last day of the month`},e.prototype.firstWeekday=function(){return`first weekday`},e.prototype.weekdayNearestDayX0=function(){return`weekday nearest day %s`},e.prototype.commaOnTheX0OfTheMonth=function(){return`, on the %s of the month`},e.prototype.commaEveryX0Days=function(){return`, every %s days in a month`},e.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return`, between day %s and %s of the month`},e.prototype.commaOnDayX0OfTheMonth=function(){return`, on day %s of the month`},e.prototype.commaEveryHour=function(){return`, every hour`},e.prototype.commaEveryX0Years=function(){return`, every %s years`},e.prototype.commaStartingX0=function(){return`, starting %s`},e.prototype.daysOfTheWeek=function(){return[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},e.prototype.monthsOfTheYear=function(){return[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},e.prototype.atReboot=function(){return`Run once, at startup`},e.prototype.onTheHour=function(){return`on the hour`},e}()},515(e,t){Object.defineProperty(t,`__esModule`,{value:!0});function n(e,t){if(!e)throw Error(t)}t.default=function(){function e(){}return e.secondRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`seconds part must be >= 0 and <= 59`)}},e.minuteRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`minutes part must be >= 0 and <= 59`)}},e.hourRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=23,`hours part must be >= 0 and <= 23`)}},e.dayOfMonthRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=1&&i<=31,`DOM part must be >= 1 and <= 31`)}},e.monthRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=1&&a<=12,t?`month part must be >= 0 and <= 11`:`month part must be >= 1 and <= 12`)}},e.dayOfWeekRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=0&&a<=6,t?`DOW part must be >= 0 and <= 6`:`DOW part must be >= 1 and <= 7`)}},e}()},823(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.StringUtilities=void 0,t.StringUtilities=function(){function e(){}return e.format=function(e){var t=[...arguments].slice(1);return e.replace(/%s/g,function(e){return t.shift()})},e.containsAny=function(e,t){return t.some(function(t){return e.indexOf(t)>-1})},e}()}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.toString=void 0;var t=n(333),i=n(747);t.ExpressionDescriptor.initialize(new i.enLocaleLoader),e.default=t.ExpressionDescriptor,e.toString=t.ExpressionDescriptor.toString})(),r})())})),j=e(n(),1),M=e(A(),1),N=a(),P={title:``,description:``,cronExpression:``,assigneeId:``,priority:C.MEDIUM},F=({projectId:e,isOpen:t,onClose:n,onSuccess:a,initialData:o})=>{let{notifyApiError:A,notifyError:F}=ee(),[I,L]=(0,j.useState)(!1),[R,z]=(0,j.useState)(!1),{control:B,formState:{errors:V},handleSubmit:H,register:U,reset:W,setValue:G}=ne({resolver:x(w),defaultValues:P,mode:`onBlur`}),K=S({control:B,name:`cronExpression`}),q=S({control:B,name:`assigneeId`}),re=S({control:B,name:`priority`}),J=r({queryKey:[`agents`],enabled:t,queryFn:async()=>(await b.findAll()).data??[]}),ie=[{label:`Every 10s`,value:`*/10 * * * * *`},{label:`Every 15m`,value:`*/15 * * * *`},{label:`Hourly`,value:`0 * * * *`},{label:`Daily (12AM)`,value:`0 0 * * *`},{label:`Weekly (Sun)`,value:`0 0 * * 0`},{label:`Monthly (1st)`,value:`0 0 1 * *`}];(0,j.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),W(o?{title:o.title,description:o.description,cronExpression:o.cronExpression,assigneeId:o.assignee.id,priority:Number(o.priority)}:P),()=>{window.removeEventListener(`keydown`,e),z(!1),L(!1),W(P)}},[o,t,n,W]),(0,j.useEffect)(()=>{!t||!J.error||A(J.error,`Agents Load Failed`)},[J.error,t,A]);let Y=i({mutationFn:async t=>{if(o){await E.update(e,o.id,{title:t.title,description:t.description,cronExpression:t.cronExpression,assigneeId:t.assigneeId,priority:t.priority});return}await E.create(e,{title:t.title,description:t.description,cronExpression:t.cronExpression,assigneeId:t.assigneeId,priority:t.priority,status:T.ACTIVE})},onSuccess:()=>{a(),n()},onError:e=>{A(e,`Operation Failed`)}}),X=(0,j.useMemo)(()=>{if(!K||V.cronExpression)return null;try{return M.default.toString(K)}catch{return null}},[K,V.cronExpression]),ae=e=>{switch(e){case C.CRITICAL:return`CRIT`;case C.HIGH:return`HIGH`;case C.MEDIUM:return`MED`;case C.LOW:return`LOW`;default:return`MED`}},Z=J.data??[],Q=Z.find(e=>e.id===q),oe=J.isPending||J.isFetching,$=Y.isPending,se=H(async e=>{await Y.mutateAsync(e)},()=>{F(`Validation Error`,`Please fill in all required fields before deploying the task.`)});return t?(0,N.jsx)(v,{children:(0,N.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-background/60 backdrop-blur-md flex items-center justify-center p-4 overflow-y-auto`,children:(0,N.jsxs)(y.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`glass-panel w-full max-w-2xl rounded-xl overflow-hidden shadow-2xl glow-primary flex flex-col my-8`,"data-testid":`recurrent-task-modal`,onClick:e=>e.stopPropagation(),children:[(0,N.jsxs)(`div`,{className:`p-6 pb-0 flex justify-between items-start`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-2xl font-headline font-extrabold text-primary tracking-tight`,children:o?`Update Protocol`:`Deploy New Task`}),(0,N.jsx)(`p`,{className:`text-sm text-on-surface-variant mt-1`,children:o?`Modify the existing automated orchestration routine.`:`Configure an automated orchestration routine.`})]}),(0,N.jsx)(`button`,{onClick:n,className:`text-on-surface-variant hover:text-on-surface transition-colors p-1`,children:(0,N.jsx)(_,{size:24})})]}),(0,N.jsxs)(`form`,{onSubmit:se,className:`flex flex-col`,children:[(0,N.jsxs)(`div`,{className:`p-8 space-y-8 overflow-y-auto max-h-[70vh] custom-scrollbar`,children:[(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-tertiary`,children:[(0,N.jsx)(D,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Task Identity`})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[(0,N.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,N.jsx)(`label`,{className:`text-xs font-medium text-on-surface-variant px-1`,children:`Task Name`}),(0,N.jsx)(`input`,{type:`text`,className:`w-full bg-surface-container-lowest border-none rounded-lg p-3 text-on-surface placeholder:text-outline-variant focus:ring-1 focus:ring-tertiary transition-all`,placeholder:`e.g., Daily Market Sweep`,...U(`title`)})]}),(0,N.jsx)(te,{control:B,name:`description`,render:({field:e})=>(0,N.jsx)(p,{label:`Description`,value:e.value,onChange:e.onChange,placeholder:`Briefly describe the objective of this task... You can use markdown for formatting.`,height:`h-32`,helperText:`Supports GitHub Flavored Markdown`})})]})]}),(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-primary`,children:[(0,N.jsx)(s,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Agent Fleet`})]}),(0,N.jsxs)(`div`,{className:`relative`,children:[(0,N.jsxs)(`div`,{className:`flex items-center bg-surface-container-lowest rounded-lg p-3 cursor-pointer hover:bg-surface-container-high transition-colors ring-1 ring-outline-variant/10 focus-within:ring-primary/40`,onClick:()=>L(!I),role:`combobox`,"aria-expanded":I,"data-testid":`agent-select`,children:[(0,N.jsx)(`div`,{className:`w-8 h-8 rounded bg-primary/20 flex items-center justify-center mr-3`,children:(0,N.jsx)(c,{size:16,className:`text-primary`})}),(0,N.jsxs)(`div`,{className:`flex-1`,children:[(0,N.jsx)(`div`,{className:`text-sm font-semibold text-on-surface`,children:Q?Q.name:`Select Intelligence Core`}),(0,N.jsx)(`div`,{className:`text-xs text-on-surface-variant`,children:Q?Q.role||`Active Agent`:`Choose an active agent for execution`})]}),(0,N.jsx)(l,{size:20,className:`text-outline transition-transform ${I?`rotate-180`:``}`})]}),(0,N.jsx)(v,{children:I&&(0,N.jsx)(y.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:`absolute top-full left-0 w-full mt-2 bg-surface-container-highest rounded-lg shadow-xl p-2 z-50 border border-outline-variant/20 max-h-60 overflow-y-auto custom-scrollbar`,"data-testid":`agent-dropdown`,children:oe?(0,N.jsx)(`div`,{className:`p-4 text-center text-xs text-on-surface-variant animate-pulse`,children:`Scanning fleet...`}):Z.length===0?(0,N.jsx)(`div`,{className:`p-4 text-center text-xs text-on-surface-variant`,children:`No active agents found.`}):Z.map(e=>(0,N.jsxs)(`div`,{className:`p-3 hover:bg-surface-container-low rounded cursor-pointer flex items-center gap-3 transition-colors group`,onClick:()=>{G(`assigneeId`,e.id,{shouldDirty:!0,shouldValidate:!0}),L(!1)},"data-testid":`agent-option-${e.id}`,children:[(0,N.jsx)(`div`,{className:`w-8 h-8 rounded bg-surface-container-high flex items-center justify-center group-hover:bg-primary/20 transition-colors`,children:(0,N.jsx)(m,{size:14,className:`text-secondary group-hover:text-primary`})}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-bold text-on-surface group-hover:text-primary transition-colors`,children:e.name}),(0,N.jsxs)(`div`,{className:`text-[10px] text-secondary`,children:[e.status||`Active`,` • `,e.role||`Core`]})]})]},e.id))})}),(0,N.jsxs)(`select`,{className:`sr-only`,value:q,onChange:e=>G(`assigneeId`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),children:[(0,N.jsx)(`option`,{value:``,children:`Select Agent`}),Z.map(e=>(0,N.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8`,children:[(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-secondary`,children:[(0,N.jsx)(d,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Scheduling Protocol`})]}),(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`relative flex items-center gap-2`,children:[(0,N.jsxs)(`div`,{className:`relative flex-1`,children:[(0,N.jsx)(`input`,{required:!0,className:`w-full bg-surface-container-lowest border-none rounded-lg p-3 font-mono text-sm text-secondary focus:ring-1 transition-all pr-10 ${V.cronExpression?`ring-1 ring-error`:`focus:ring-secondary`}`,type:`text`,...U(`cronExpression`),placeholder:`e.g. 0 0 * * *`}),(0,N.jsx)(f,{size:16,className:`absolute right-3 top-3.5 text-outline-variant`})]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>z(!R),className:`p-3 rounded-lg border transition-all ${R?`bg-secondary/20 border-secondary text-secondary shadow-[0_0_10px_rgba(78,222,163,0.2)]`:`bg-surface-container-lowest border-outline-variant/10 text-on-surface-variant hover:text-secondary hover:border-secondary/30`}`,title:`Open Cron Wizard`,children:(0,N.jsx)(k,{size:18})})]}),(0,N.jsx)(v,{children:R&&(0,N.jsx)(y.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},className:`overflow-hidden bg-surface-container-highest/30 rounded-xl border border-secondary/10`,children:(0,N.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-black uppercase tracking-widest text-secondary/60`,children:[(0,N.jsx)(g,{size:12}),`Temporal Presets`]}),(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ie.map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>{G(`cronExpression`,e.value,{shouldDirty:!0,shouldValidate:!0})},className:`px-3 py-1.5 rounded-full text-[10px] font-bold border transition-all ${K===e.value?`bg-secondary text-on-secondary border-secondary shadow-lg shadow-secondary/20`:`bg-surface-container-lowest border-outline-variant/10 text-on-surface-variant hover:border-secondary/40 hover:text-secondary`}`,children:e.label},e.value))})]})})}),X&&!V.cronExpression&&(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-secondary font-medium bg-secondary/5 px-3 py-2 rounded-lg border border-secondary/10 animate-in fade-in slide-in-from-left-2`,children:[(0,N.jsx)(O,{size:14,className:`shrink-0`}),(0,N.jsx)(`span`,{children:X})]}),(0,N.jsx)(`div`,{className:`px-1 py-1`,children:(0,N.jsxs)(`p`,{className:`text-[9px] text-on-surface-variant/40 font-mono uppercase tracking-[0.1em] flex gap-2`,children:[(0,N.jsx)(`span`,{className:`text-secondary/60 opacity-60 font-black`,children:`[Sec]`}),(0,N.jsx)(`span`,{children:`Min`}),(0,N.jsx)(`span`,{children:`Hour`}),(0,N.jsx)(`span`,{children:`Dom`}),(0,N.jsx)(`span`,{children:`Mon`}),(0,N.jsx)(`span`,{children:`Dow`})]})}),V.cronExpression?.message&&(0,N.jsxs)(`p`,{className:`text-[10px] text-error px-1 flex items-center gap-1.5 font-medium`,children:[(0,N.jsx)(u,{size:12}),V.cronExpression.message]})]})]}),(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-error`,children:[(0,N.jsx)(u,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Execution Priority`})]}),(0,N.jsx)(`div`,{className:`flex bg-surface-container-lowest p-1 rounded-lg`,children:[C.LOW,C.MEDIUM,C.HIGH,C.CRITICAL].map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>G(`priority`,e,{shouldDirty:!0,shouldValidate:!0}),className:`flex-1 py-2 text-[10px] font-bold rounded transition-all ${Number(re)===Number(e)?e===C.CRITICAL?`bg-error/20 text-error`:`bg-surface-container-high text-primary`:`text-on-surface-variant hover:text-on-surface`}`,children:ae(e)},e))})]})]}),(0,N.jsxs)(`section`,{className:`bg-surface-container-low p-5 rounded-xl border border-outline-variant/10`,children:[(0,N.jsxs)(`div`,{className:`flex justify-between items-center mb-4`,children:[(0,N.jsx)(`h4`,{className:`text-xs font-bold font-headline text-on-surface-variant tracking-wide`,children:`Deployment Preview`}),(0,N.jsx)(`span`,{className:`text-[10px] bg-secondary-container/30 text-secondary px-2 py-0.5 rounded-full font-bold uppercase`,children:`System Cluster 0-A`})]}),(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between text-xs p-2 bg-surface-container-high/50 rounded-lg`,children:[(0,N.jsx)(`span`,{className:`text-on-surface font-medium italic`,children:`Logic integrity check passed`}),(0,N.jsx)(`span`,{className:`text-secondary font-bold`,children:`READY`})]}),(0,N.jsxs)(`div`,{className:`text-[10px] text-on-surface-variant leading-relaxed`,children:[`This task will be registered in the Alpha-Centauri cluster and executed by `,(0,N.jsx)(`span`,{className:`text-primary`,children:Q?.name||`an assigned agent`}),` according to the provided temporal sequence.`]})]})]})]}),(0,N.jsxs)(`div`,{className:`p-6 bg-surface-container-low/50 flex justify-end items-center gap-4 sticky bottom-0 border-t border-outline-variant/10`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:n,className:`px-6 py-2.5 text-sm font-bold text-on-surface-variant hover:text-on-surface transition-all active:scale-95`,children:`Cancel`}),(0,N.jsxs)(`button`,{type:`submit`,disabled:$,className:`px-8 py-2.5 text-sm font-bold bg-primary text-on-primary rounded-lg shadow-lg hover:shadow-primary/20 transition-all active:scale-95 flex items-center gap-2 disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group`,children:[$?(0,N.jsx)(`div`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,N.jsx)(h,{size:16,className:`group-hover:translate-x-0.5 group-hover:-translate-y-0.5 transition-transform`}),o?`Update Task`:`Create Task`]})]})]})]})})}):null};export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{i as n,n as r,t as i}from"./vendor-query-xpDrc4rM.js";import{r as a}from"./vendor-markdown-DoJbQ1of.js";import{i as o}from"./client-BGOBXkO8.js";import{t as s}from"./chevron-down-LTeQHW9O.js";import{t as c}from"./MarkdownField--1gpyapw.js";import{t as l}from"./file-text-DWBSXx5l.js";import{t as ee}from"./sparkles-v57Nc-z-.js";import{t as te}from"./trash-2-DJpTXgEP.js";import{t as u}from"./user--KOoEB9m.js";import{t as d}from"./x-wDy15QMx.js";import{n as f,t as p}from"./vendor-motion-CMGWJcqR.js";import{n as m}from"./projects-CUOthD8N.js";import{n as h}from"./agents-b8btewki.js";import{t as g}from"./useNotification-DQayTSUL.js";import{a as ne,c as _,o as re,s as v}from"./vendor-forms-DHyqHeyd.js";import{i as y,n as b,t as x}from"./tasks-DEUQCNoH.js";import{i as ie,n as S}from"./taskFormSchemas-dl1t1OyX.js";var C=o(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),w=o(`flag`,[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]),T=e(t(),1),E=a(),D={title:``,description:S,status:b.BACKLOG,priority:x.MEDIUM,assigneeId:``,projectId:``},O=({isOpen:e,onClose:t,onCreated:a})=>{let o=n(),{notifyApiError:O,notifyError:ae,notifySuccess:oe}=g(),k=(0,T.useId)(),se=(0,T.useId)(),A=(0,T.useId)(),j=(0,T.useId)(),M=(0,T.useId)(),N=(0,T.useId)(),P=(0,T.useId)(),F=(0,T.useId)(),I=(0,T.useId)(),{control:L,formState:{errors:R},handleSubmit:z,register:B,reset:V,setValue:H}=v({resolver:ne(ie),defaultValues:D,mode:`onBlur`}),U=r({queryKey:[`agents`],enabled:e,queryFn:async()=>(await h.findAll()).data}),W=r({queryKey:[`projects`],enabled:e,queryFn:async()=>(await m.findAll()).data});(0,T.useEffect)(()=>{if(!e){V(D);return}let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,V]),(0,T.useEffect)(()=>{e&&U.error&&O(U.error,`Agents Load Failed`)},[U.error,e,O]),(0,T.useEffect)(()=>{e&&W.error&&O(W.error,`Projects Load Failed`)},[e,O,W.error]);let G=(0,T.useMemo)(()=>W.data??[],[W.data]),K=_({control:L,name:`projectId`});(0,T.useEffect)(()=>{!e||G.length===0||K||H(`projectId`,G[0].id,{shouldDirty:!1,shouldValidate:!0})},[K,e,G,H]);let q=i({mutationFn:async e=>(await y.create(e.projectId,{title:e.title,description:e.description,status:e.status,priority:e.priority,assigneeId:e.assigneeId||void 0,projectId:e.projectId}),e),onSuccess:e=>{o.invalidateQueries({queryKey:[`tasks`,e.projectId]}),o.invalidateQueries({queryKey:[`projects`]}),oe(`Task Commissioned`,`The task node has been added to the orchestration grid.`),a?.(),t(),V({...D,projectId:e.projectId})},onError:e=>{O(e,`Task Creation Failed`)}}),J=U.data??[],Y=U.isPending||W.isPending,X=q.isPending,Z=_({control:L,name:`priority`}),ce=_({control:L,name:`status`}),Q=_({control:L,name:`assigneeId`}),le=_({control:L,name:`projectId`}),ue=z(async e=>{await q.mutateAsync(e)},()=>{ae(`Validation Error`,`Please review the highlighted fields before commissioning the task.`)}),$=()=>{X||t()};return e?(0,E.jsx)(f,{children:(0,E.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4 md:p-8`,children:[(0,E.jsx)(p.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:$,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`,"aria-hidden":`true`}),(0,E.jsxs)(p.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},role:`dialog`,"aria-modal":`true`,"aria-labelledby":F,"aria-describedby":I,"aria-busy":Y||X,className:`relative w-full max-w-3xl h-full max-h-[750px] bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,E.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md sticky top-0 z-10`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary`,children:(0,E.jsx)(C,{size:22,"aria-hidden":`true`})}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{id:F,className:`text-xl font-black font-headline text-white tracking-tight`,children:`Comission New Task`}),(0,E.jsx)(`p`,{id:I,className:`text-[10px] uppercase tracking-widest text-on-surface-variant/60 font-bold`,children:`Node Specification Protocol`})]})]}),(0,E.jsx)(`button`,{type:`button`,onClick:$,disabled:X,"aria-label":`Close create task modal`,className:`w-10 h-10 rounded-full flex items-center justify-center text-on-surface-variant hover:bg-surface-container-highest transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,E.jsx)(d,{size:20,"aria-hidden":`true`})})]}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-10 space-y-10 custom-scrollbar`,children:[(0,E.jsxs)(`section`,{className:`space-y-6`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,E.jsx)(`div`,{className:`w-1 bg-primary h-4 rounded-full`}),(0,E.jsx)(`h3`,{className:`text-xs font-black uppercase tracking-[0.2em] text-on-surface-variant`,children:`Essential Intelligence`})]}),(0,E.jsxs)(`div`,{className:`space-y-6`,children:[(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(`label`,{htmlFor:P,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Task Title`}),(0,E.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 focus-within:bg-surface-container-highest/50 transition-all`,children:(0,E.jsx)(`input`,{id:P,type:`text`,placeholder:`e.g. Synthesize Vector DB results`,"aria-invalid":!!R.title,"aria-describedby":R.title?k:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-12 px-4 focus:outline-none placeholder:text-on-surface-variant/30 font-medium`,...B(`title`)})}),R.title&&(0,E.jsx)(`p`,{id:k,className:`text-xs text-error font-semibold`,children:R.title.message})]}),(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,E.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Objective / Description`}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsxs)(`button`,{type:`button`,onClick:()=>H(`description`,S,{shouldDirty:!0,shouldValidate:!0}),className:`flex items-center gap-1 px-2 py-1 rounded hover:bg-surface-container-highest text-[9px] font-black text-on-surface-variant/60 uppercase tracking-widest transition-colors`,title:`Reset to template`,children:[(0,E.jsx)(l,{size:10,"aria-hidden":`true`}),`Template`]}),(0,E.jsx)(`div`,{className:`w-px h-3 bg-outline-variant/10`}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>H(`description`,``,{shouldDirty:!0,shouldValidate:!0}),className:`flex items-center gap-1 px-2 py-1 rounded hover:bg-error/10 text-[9px] font-black text-error/60 hover:text-error uppercase tracking-widest transition-colors`,title:`Clear field`,children:[(0,E.jsx)(te,{size:10,"aria-hidden":`true`}),`Clear`]})]})]}),(0,E.jsx)(re,{control:L,name:`description`,render:({field:e})=>(0,E.jsx)(c,{value:e.value,onChange:e.onChange,placeholder:`Describe the desired output and constraints for this node...`,height:`h-52`,maxLength:2e3})}),R.description&&(0,E.jsx)(`p`,{id:se,className:`text-xs text-error font-semibold`,children:R.description.message})]})]})]}),(0,E.jsxs)(`section`,{className:`space-y-6 pt-10 border-t border-outline-variant/10`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,E.jsx)(`div`,{className:`w-1 bg-secondary h-4 rounded-full`}),(0,E.jsx)(`h3`,{className:`text-xs font-black uppercase tracking-[0.2em] text-on-surface-variant`,children:`Operational Configuration`})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8`,children:[(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1 flex items-center gap-1.5`,children:[(0,E.jsx)(w,{size:12,className:`text-secondary`,"aria-hidden":`true`}),`Priority Level`]}),(0,E.jsx)(`div`,{className:`grid grid-cols-4 gap-2 p-1 bg-surface-container-highest/30 rounded-xl ring-1 ring-outline-variant/10`,children:[{id:x.LOW,label:`LOW`},{id:x.MEDIUM,label:`MED`},{id:x.HIGH,label:`HIGH`},{id:x.CRITICAL,label:`CRIT`}].map(e=>(0,E.jsx)(`button`,{type:`button`,"aria-pressed":Z===e.id,onClick:()=>H(`priority`,e.id,{shouldDirty:!0,shouldValidate:!0}),className:`py-2 rounded-lg text-[10px] font-black tracking-widest transition-all ${Z===e.id?e.id===x.CRITICAL||e.id===x.HIGH?`bg-error text-on-error shadow-lg shadow-error/30`:`bg-primary text-on-primary shadow-lg shadow-primary/30`:`hover:bg-surface-container-highest text-on-surface-variant`}`,children:e.label},e.id))}),R.priority&&(0,E.jsx)(`p`,{id:j,className:`text-xs text-error font-semibold`,children:R.priority.message})]}),(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsx)(`label`,{htmlFor:`create-task-status`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Initial Status`}),(0,E.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,E.jsx)(`select`,{id:`create-task-status`,value:ce,onChange:e=>H(`status`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),"aria-invalid":!!R.status,"aria-describedby":R.status?A:void 0,className:`w-full bg-transparent border-none text-xs font-bold text-on-surface h-10 px-4 focus:outline-none appearance-none cursor-pointer uppercase tracking-widest`,children:[b.BACKLOG,b.IN_PROGRESS,b.REVIEW].map(e=>(0,E.jsx)(`option`,{value:e,className:`bg-surface-container-low text-on-surface uppercase`,children:e},e))}),(0,E.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,E.jsx)(s,{size:16,"aria-hidden":`true`})})]}),R.status&&(0,E.jsx)(`p`,{id:A,className:`text-xs text-error font-semibold`,children:R.status.message})]}),(0,E.jsxs)(`div`,{className:`space-y-3 col-span-full`,children:[(0,E.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1 flex items-center gap-1.5`,children:[(0,E.jsx)(u,{size:12,className:`text-primary`,"aria-hidden":`true`}),`Assigned Intelligence (Optional)`]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 gap-3`,children:[J.map(e=>(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":Q===e.id,onClick:()=>H(`assigneeId`,Q===e.id?``:e.id,{shouldDirty:!0,shouldValidate:!0}),className:`p-3 rounded-xl border flex items-center gap-3 transition-all text-left ${Q===e.id?`bg-primary/10 border-primary shadow-[0_0_15px_rgba(173,198,255,0.1)]`:`bg-surface-container-highest/20 border-outline-variant/5 hover:border-outline-variant/30 hover:bg-surface-container-highest/30`}`,children:[(0,E.jsx)(`div`,{className:`w-8 h-8 rounded-lg flex items-center justify-center font-bold text-xs ${Q===e.id?`bg-primary text-surface`:`bg-surface-container-high text-on-surface-variant`}`,children:e.name.substring(0,2).toUpperCase()}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`text-[11px] font-bold ${Q===e.id?`text-white`:`text-on-surface-variant`}`,children:e.name}),(0,E.jsx)(`div`,{className:`text-[9px] text-on-surface-variant/50 uppercase tracking-widest font-black leading-none mt-0.5`,children:e.role||`Agent`})]})]},e.id)),J.length===0&&!U.isPending&&(0,E.jsx)(`div`,{className:`col-span-full py-4 text-center border-2 border-dashed border-outline-variant/10 rounded-xl`,children:(0,E.jsx)(`span`,{className:`text-[10px] font-bold text-on-surface-variant/30 uppercase tracking-[0.2em]`,children:`No active intelligence found`})})]}),R.assigneeId&&(0,E.jsx)(`p`,{id:M,className:`text-xs text-error font-semibold`,children:R.assigneeId.message})]}),G.length>1?(0,E.jsxs)(`div`,{className:`space-y-3 col-span-full`,children:[(0,E.jsx)(`label`,{htmlFor:`create-task-project`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Target Project`}),(0,E.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,E.jsx)(`select`,{id:`create-task-project`,value:le,onChange:e=>H(`projectId`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),"aria-invalid":!!R.projectId,"aria-describedby":R.projectId?N:void 0,className:`w-full bg-transparent border-none text-xs font-bold text-on-surface h-10 px-4 focus:outline-none appearance-none cursor-pointer`,children:G.map(e=>(0,E.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface`,children:e.title},e.id))}),(0,E.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,E.jsx)(s,{size:16,"aria-hidden":`true`})})]}),R.projectId&&(0,E.jsx)(`p`,{id:N,className:`text-xs text-error font-semibold`,children:R.projectId.message})]}):G.length===1?(0,E.jsxs)(`div`,{className:`col-span-full px-4 py-2 bg-surface-container-highest/10 rounded-lg border border-outline-variant/10 flex items-center justify-between`,children:[(0,E.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/40`,children:`Target Project`}),(0,E.jsx)(`span`,{className:`text-xs font-bold text-primary/80`,children:G[0].title})]}):(0,E.jsxs)(`div`,{className:`col-span-full p-4 bg-error/5 border border-error/20 rounded-xl text-center`,children:[(0,E.jsx)(`p`,{className:`text-xs font-bold text-error`,children:`No Project Detected`}),(0,E.jsx)(`p`,{className:`text-[10px] text-on-surface-variant/60 mt-1 uppercase tracking-widest font-black`,children:`Create a project in the sidebar before commissioning tasks`})]})]})]})]}),(0,E.jsxs)(`div`,{className:`px-8 py-6 bg-surface-container-low/80 backdrop-blur-md border-t border-outline-variant/10 flex items-center justify-between`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-bold text-on-surface-variant/50 uppercase tracking-widest`,children:[(0,E.jsx)(ee,{size:12,className:`text-primary animate-pulse`,"aria-hidden":`true`}),`Agentic Orchestration Active`]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:$,disabled:X,className:`px-6 py-2.5 rounded-lg text-sm font-bold text-on-surface-variant hover:text-white transition-all hover:bg-surface-container-highest disabled:opacity-50 disabled:cursor-not-allowed`,children:`Discard`}),(0,E.jsxs)(`button`,{type:`button`,onClick:ue,disabled:X||Y||G.length===0,className:`px-10 py-2.5 rounded-lg bg-primary text-on-primary text-sm font-black shadow-[0_8px_20px_rgba(173,198,255,0.2)] hover:scale-[1.02] active:scale-[0.98] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group relative overflow-hidden disabled:hover:scale-100`,children:[(0,E.jsx)(`div`,{className:`absolute inset-0 bg-white/10 translate-x-[-100%] group-hover:translate-x-[100%] transition-transform duration-700 skew-x-12`}),X?`Processing...`:`Comission Task`]})]})]})]})]})}):null};export{O as default};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{i as n,n as r,t as i}from"./vendor-query-xpDrc4rM.js";import{r as a}from"./vendor-markdown-DoJbQ1of.js";import{i as o}from"./client-B553SX3l.js";import{t as s}from"./chevron-down-BUOg3vvd.js";import{t as c}from"./MarkdownField-DR6tHsei.js";import{t as l}from"./file-text-CX_Yqfjf.js";import{t as ee}from"./sparkles-krUpxie4.js";import{t as te}from"./trash-2-CphQfk35.js";import{t as u}from"./user-Brcjlps5.js";import{t as d}from"./x-CCZGYGDC.js";import{n as f,t as p}from"./vendor-motion-CMGWJcqR.js";import{n as m}from"./projects-DoalTI7c.js";import{n as h}from"./agents-YQJ7JNfI.js";import{t as g}from"./useNotification-DQayTSUL.js";import{a as ne,c as _,o as re,s as v}from"./vendor-forms-DHyqHeyd.js";import{i as y,n as b,t as x}from"./tasks-DHsBE-ea.js";import{i as ie,n as S}from"./taskFormSchemas-B6YlRxrx.js";var C=o(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),w=o(`flag`,[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]),T=e(t(),1),E=a(),D={title:``,description:S,status:b.BACKLOG,priority:x.MEDIUM,assigneeId:``,projectId:``},O=({isOpen:e,onClose:t,onCreated:a})=>{let o=n(),{notifyApiError:O,notifyError:ae,notifySuccess:oe}=g(),k=(0,T.useId)(),se=(0,T.useId)(),A=(0,T.useId)(),j=(0,T.useId)(),M=(0,T.useId)(),N=(0,T.useId)(),P=(0,T.useId)(),F=(0,T.useId)(),I=(0,T.useId)(),{control:L,formState:{errors:R},handleSubmit:z,register:B,reset:V,setValue:H}=v({resolver:ne(ie),defaultValues:D,mode:`onBlur`}),U=r({queryKey:[`agents`],enabled:e,queryFn:async()=>(await h.findAll()).data}),W=r({queryKey:[`projects`],enabled:e,queryFn:async()=>(await m.findAll()).data});(0,T.useEffect)(()=>{if(!e){V(D);return}let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,V]),(0,T.useEffect)(()=>{e&&U.error&&O(U.error,`Agents Load Failed`)},[U.error,e,O]),(0,T.useEffect)(()=>{e&&W.error&&O(W.error,`Projects Load Failed`)},[e,O,W.error]);let G=(0,T.useMemo)(()=>W.data??[],[W.data]),K=_({control:L,name:`projectId`});(0,T.useEffect)(()=>{!e||G.length===0||K||H(`projectId`,G[0].id,{shouldDirty:!1,shouldValidate:!0})},[K,e,G,H]);let q=i({mutationFn:async e=>(await y.create(e.projectId,{title:e.title,description:e.description,status:e.status,priority:e.priority,assigneeId:e.assigneeId||void 0,projectId:e.projectId}),e),onSuccess:e=>{o.invalidateQueries({queryKey:[`tasks`,e.projectId]}),o.invalidateQueries({queryKey:[`projects`]}),oe(`Task Commissioned`,`The task node has been added to the orchestration grid.`),a?.(),t(),V({...D,projectId:e.projectId})},onError:e=>{O(e,`Task Creation Failed`)}}),J=U.data??[],Y=U.isPending||W.isPending,X=q.isPending,Z=_({control:L,name:`priority`}),ce=_({control:L,name:`status`}),Q=_({control:L,name:`assigneeId`}),le=_({control:L,name:`projectId`}),ue=z(async e=>{await q.mutateAsync(e)},()=>{ae(`Validation Error`,`Please review the highlighted fields before commissioning the task.`)}),$=()=>{X||t()};return e?(0,E.jsx)(f,{children:(0,E.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4 md:p-8`,children:[(0,E.jsx)(p.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:$,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`,"aria-hidden":`true`}),(0,E.jsxs)(p.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},role:`dialog`,"aria-modal":`true`,"aria-labelledby":F,"aria-describedby":I,"aria-busy":Y||X,className:`relative w-full max-w-3xl h-full max-h-[750px] bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,E.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md sticky top-0 z-10`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary`,children:(0,E.jsx)(C,{size:22,"aria-hidden":`true`})}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{id:F,className:`text-xl font-black font-headline text-white tracking-tight`,children:`Comission New Task`}),(0,E.jsx)(`p`,{id:I,className:`text-[10px] uppercase tracking-widest text-on-surface-variant/60 font-bold`,children:`Node Specification Protocol`})]})]}),(0,E.jsx)(`button`,{type:`button`,onClick:$,disabled:X,"aria-label":`Close create task modal`,className:`w-10 h-10 rounded-full flex items-center justify-center text-on-surface-variant hover:bg-surface-container-highest transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,E.jsx)(d,{size:20,"aria-hidden":`true`})})]}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-10 space-y-10 custom-scrollbar`,children:[(0,E.jsxs)(`section`,{className:`space-y-6`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,E.jsx)(`div`,{className:`w-1 bg-primary h-4 rounded-full`}),(0,E.jsx)(`h3`,{className:`text-xs font-black uppercase tracking-[0.2em] text-on-surface-variant`,children:`Essential Intelligence`})]}),(0,E.jsxs)(`div`,{className:`space-y-6`,children:[(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(`label`,{htmlFor:P,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Task Title`}),(0,E.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 focus-within:bg-surface-container-highest/50 transition-all`,children:(0,E.jsx)(`input`,{id:P,type:`text`,placeholder:`e.g. Synthesize Vector DB results`,"aria-invalid":!!R.title,"aria-describedby":R.title?k:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-12 px-4 focus:outline-none placeholder:text-on-surface-variant/30 font-medium`,...B(`title`)})}),R.title&&(0,E.jsx)(`p`,{id:k,className:`text-xs text-error font-semibold`,children:R.title.message})]}),(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,E.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Objective / Description`}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsxs)(`button`,{type:`button`,onClick:()=>H(`description`,S,{shouldDirty:!0,shouldValidate:!0}),className:`flex items-center gap-1 px-2 py-1 rounded hover:bg-surface-container-highest text-[9px] font-black text-on-surface-variant/60 uppercase tracking-widest transition-colors`,title:`Reset to template`,children:[(0,E.jsx)(l,{size:10,"aria-hidden":`true`}),`Template`]}),(0,E.jsx)(`div`,{className:`w-px h-3 bg-outline-variant/10`}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>H(`description`,``,{shouldDirty:!0,shouldValidate:!0}),className:`flex items-center gap-1 px-2 py-1 rounded hover:bg-error/10 text-[9px] font-black text-error/60 hover:text-error uppercase tracking-widest transition-colors`,title:`Clear field`,children:[(0,E.jsx)(te,{size:10,"aria-hidden":`true`}),`Clear`]})]})]}),(0,E.jsx)(re,{control:L,name:`description`,render:({field:e})=>(0,E.jsx)(c,{value:e.value,onChange:e.onChange,placeholder:`Describe the desired output and constraints for this node...`,height:`h-52`,maxLength:2e3})}),R.description&&(0,E.jsx)(`p`,{id:se,className:`text-xs text-error font-semibold`,children:R.description.message})]})]})]}),(0,E.jsxs)(`section`,{className:`space-y-6 pt-10 border-t border-outline-variant/10`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,E.jsx)(`div`,{className:`w-1 bg-secondary h-4 rounded-full`}),(0,E.jsx)(`h3`,{className:`text-xs font-black uppercase tracking-[0.2em] text-on-surface-variant`,children:`Operational Configuration`})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8`,children:[(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1 flex items-center gap-1.5`,children:[(0,E.jsx)(w,{size:12,className:`text-secondary`,"aria-hidden":`true`}),`Priority Level`]}),(0,E.jsx)(`div`,{className:`grid grid-cols-4 gap-2 p-1 bg-surface-container-highest/30 rounded-xl ring-1 ring-outline-variant/10`,children:[{id:x.LOW,label:`LOW`},{id:x.MEDIUM,label:`MED`},{id:x.HIGH,label:`HIGH`},{id:x.CRITICAL,label:`CRIT`}].map(e=>(0,E.jsx)(`button`,{type:`button`,"aria-pressed":Z===e.id,onClick:()=>H(`priority`,e.id,{shouldDirty:!0,shouldValidate:!0}),className:`py-2 rounded-lg text-[10px] font-black tracking-widest transition-all ${Z===e.id?e.id===x.CRITICAL||e.id===x.HIGH?`bg-error text-on-error shadow-lg shadow-error/30`:`bg-primary text-on-primary shadow-lg shadow-primary/30`:`hover:bg-surface-container-highest text-on-surface-variant`}`,children:e.label},e.id))}),R.priority&&(0,E.jsx)(`p`,{id:j,className:`text-xs text-error font-semibold`,children:R.priority.message})]}),(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsx)(`label`,{htmlFor:`create-task-status`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Initial Status`}),(0,E.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,E.jsx)(`select`,{id:`create-task-status`,value:ce,onChange:e=>H(`status`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),"aria-invalid":!!R.status,"aria-describedby":R.status?A:void 0,className:`w-full bg-transparent border-none text-xs font-bold text-on-surface h-10 px-4 focus:outline-none appearance-none cursor-pointer uppercase tracking-widest`,children:[b.BACKLOG,b.IN_PROGRESS,b.REVIEW].map(e=>(0,E.jsx)(`option`,{value:e,className:`bg-surface-container-low text-on-surface uppercase`,children:e},e))}),(0,E.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,E.jsx)(s,{size:16,"aria-hidden":`true`})})]}),R.status&&(0,E.jsx)(`p`,{id:A,className:`text-xs text-error font-semibold`,children:R.status.message})]}),(0,E.jsxs)(`div`,{className:`space-y-3 col-span-full`,children:[(0,E.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1 flex items-center gap-1.5`,children:[(0,E.jsx)(u,{size:12,className:`text-primary`,"aria-hidden":`true`}),`Assigned Intelligence (Optional)`]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 gap-3`,children:[J.map(e=>(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":Q===e.id,onClick:()=>H(`assigneeId`,Q===e.id?``:e.id,{shouldDirty:!0,shouldValidate:!0}),className:`p-3 rounded-xl border flex items-center gap-3 transition-all text-left ${Q===e.id?`bg-primary/10 border-primary shadow-[0_0_15px_rgba(173,198,255,0.1)]`:`bg-surface-container-highest/20 border-outline-variant/5 hover:border-outline-variant/30 hover:bg-surface-container-highest/30`}`,children:[(0,E.jsx)(`div`,{className:`w-8 h-8 rounded-lg flex items-center justify-center font-bold text-xs ${Q===e.id?`bg-primary text-surface`:`bg-surface-container-high text-on-surface-variant`}`,children:e.name.substring(0,2).toUpperCase()}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`text-[11px] font-bold ${Q===e.id?`text-white`:`text-on-surface-variant`}`,children:e.name}),(0,E.jsx)(`div`,{className:`text-[9px] text-on-surface-variant/50 uppercase tracking-widest font-black leading-none mt-0.5`,children:e.role||`Agent`})]})]},e.id)),J.length===0&&!U.isPending&&(0,E.jsx)(`div`,{className:`col-span-full py-4 text-center border-2 border-dashed border-outline-variant/10 rounded-xl`,children:(0,E.jsx)(`span`,{className:`text-[10px] font-bold text-on-surface-variant/30 uppercase tracking-[0.2em]`,children:`No active intelligence found`})})]}),R.assigneeId&&(0,E.jsx)(`p`,{id:M,className:`text-xs text-error font-semibold`,children:R.assigneeId.message})]}),G.length>1?(0,E.jsxs)(`div`,{className:`space-y-3 col-span-full`,children:[(0,E.jsx)(`label`,{htmlFor:`create-task-project`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Target Project`}),(0,E.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,E.jsx)(`select`,{id:`create-task-project`,value:le,onChange:e=>H(`projectId`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),"aria-invalid":!!R.projectId,"aria-describedby":R.projectId?N:void 0,className:`w-full bg-transparent border-none text-xs font-bold text-on-surface h-10 px-4 focus:outline-none appearance-none cursor-pointer`,children:G.map(e=>(0,E.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface`,children:e.title},e.id))}),(0,E.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,E.jsx)(s,{size:16,"aria-hidden":`true`})})]}),R.projectId&&(0,E.jsx)(`p`,{id:N,className:`text-xs text-error font-semibold`,children:R.projectId.message})]}):G.length===1?(0,E.jsxs)(`div`,{className:`col-span-full px-4 py-2 bg-surface-container-highest/10 rounded-lg border border-outline-variant/10 flex items-center justify-between`,children:[(0,E.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/40`,children:`Target Project`}),(0,E.jsx)(`span`,{className:`text-xs font-bold text-primary/80`,children:G[0].title})]}):(0,E.jsxs)(`div`,{className:`col-span-full p-4 bg-error/5 border border-error/20 rounded-xl text-center`,children:[(0,E.jsx)(`p`,{className:`text-xs font-bold text-error`,children:`No Project Detected`}),(0,E.jsx)(`p`,{className:`text-[10px] text-on-surface-variant/60 mt-1 uppercase tracking-widest font-black`,children:`Create a project in the sidebar before commissioning tasks`})]})]})]})]}),(0,E.jsxs)(`div`,{className:`px-8 py-6 bg-surface-container-low/80 backdrop-blur-md border-t border-outline-variant/10 flex items-center justify-between`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-bold text-on-surface-variant/50 uppercase tracking-widest`,children:[(0,E.jsx)(ee,{size:12,className:`text-primary animate-pulse`,"aria-hidden":`true`}),`Agentic Orchestration Active`]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:$,disabled:X,className:`px-6 py-2.5 rounded-lg text-sm font-bold text-on-surface-variant hover:text-white transition-all hover:bg-surface-container-highest disabled:opacity-50 disabled:cursor-not-allowed`,children:`Discard`}),(0,E.jsxs)(`button`,{type:`button`,onClick:ue,disabled:X||Y||G.length===0,className:`px-10 py-2.5 rounded-lg bg-primary text-on-primary text-sm font-black shadow-[0_8px_20px_rgba(173,198,255,0.2)] hover:scale-[1.02] active:scale-[0.98] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group relative overflow-hidden disabled:hover:scale-100`,children:[(0,E.jsx)(`div`,{className:`absolute inset-0 bg-white/10 translate-x-[-100%] group-hover:translate-x-[100%] transition-transform duration-700 skew-x-12`}),X?`Processing...`:`Comission Task`]})]})]})]})]})}):null};export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{r as n}from"./vendor-markdown-DoJbQ1of.js";import{t as r}from"./MarkdownField
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{r as n}from"./vendor-markdown-DoJbQ1of.js";import{t as r}from"./MarkdownField-DR6tHsei.js";import{t as i}from"./paperclip-5Y367YTj.js";import{t as a}from"./x-CCZGYGDC.js";import{n as o,t as s}from"./vendor-motion-CMGWJcqR.js";import{t as c}from"./recurrent-tasks-7thk45mk.js";import{t as l}from"./AttachmentItem-C_uUACPz.js";var u=e(t(),1),d=n(),f={[c.SUCCESS]:{label:`Success`,dot:`bg-secondary`,badge:`text-secondary bg-secondary/10 border-secondary/20`},[c.FAILURE]:{label:`Failure`,dot:`bg-error`,badge:`text-error bg-error/10 border-error/20`},[c.RUNNING]:{label:`Running`,dot:`bg-tertiary animate-pulse`,badge:`text-tertiary bg-tertiary/10 border-tertiary/20`},[c.CANCELED]:{label:`Canceled`,dot:`bg-on-surface-variant`,badge:`text-on-surface-variant bg-surface-container-highest border-outline-variant/30`}},p=e=>({"image/png":`png`,"image/jpeg":`jpg`,"image/gif":`gif`,"image/svg+xml":`svg`,"application/pdf":`pdf`,"text/plain":`txt`,"text/csv":`csv`,"application/json":`json`})[e]??e.split(`/`).pop()??`file`,m=({isOpen:e,onClose:t,exec:n})=>{(0,u.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]);let m=n?f[n.status]??f[c.CANCELED]:null,h=n?.artifacts?.filter(Boolean)??[];return(0,d.jsx)(o,{children:e&&n&&(0,d.jsxs)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center p-4`,children:[(0,d.jsx)(s.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/60 backdrop-blur-md`}),(0,d.jsxs)(s.div,{initial:{opacity:0,scale:.97,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.97,y:12},transition:{duration:.2,ease:`easeOut`},className:`relative w-full max-w-3xl max-h-[85vh] flex flex-col bg-surface-container-low rounded-3xl shadow-2xl ring-1 ring-outline-variant/10 overflow-hidden`,children:[(0,d.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-8 py-6 border-b border-outline-variant/10 flex-shrink-0`,children:[(0,d.jsxs)(`div`,{className:`flex flex-col gap-2 min-w-0`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,d.jsxs)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-primary font-mono`,children:[`#EXEC-`,n.id.split(`-`)[0].toUpperCase()]}),m&&(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[10px] font-black uppercase tracking-widest px-3 py-1 rounded-full border ${m.badge}`,children:[(0,d.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${m.dot}`}),m.label]})]}),(0,d.jsx)(`h2`,{className:`text-xl font-headline font-black text-white tracking-tight`,children:`Execution Log`}),(0,d.jsxs)(`p`,{className:`text-[10px] text-on-surface-variant/50 font-mono`,children:[new Date(n.createdAt).toLocaleString(),n.latencyMs!=null&&(0,d.jsx)(`span`,{className:`ml-4 text-on-surface-variant/40`,children:n.latencyMs>=6e4?`${Math.floor(n.latencyMs/6e4)}m ${String(Math.floor(n.latencyMs%6e4/1e3)).padStart(2,`0`)}s`:`${Math.floor(n.latencyMs/1e3)}s`})]})]}),(0,d.jsx)(`button`,{onClick:t,className:`flex-shrink-0 p-2 rounded-xl text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all active:scale-90`,"aria-label":`Close`,children:(0,d.jsx)(a,{size:20})})]}),(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto custom-scrollbar px-8 py-6 space-y-8`,children:[(0,d.jsxs)(`section`,{children:[(0,d.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-[0.25em] text-on-surface-variant/40 mb-4`,children:`Result`}),(0,d.jsx)(`div`,{className:`bg-surface-container-highest/20 rounded-2xl border border-outline-variant/10 px-6 py-5`,children:n.result?(0,d.jsx)(r,{readOnly:!0,value:n.result}):(0,d.jsx)(`p`,{className:`text-xs text-on-surface-variant/30 italic font-mono uppercase tracking-widest`,children:`No output recorded for this execution.`})})]}),h.length>0&&(0,d.jsxs)(`section`,{children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,d.jsx)(i,{size:14,className:`text-on-surface-variant/40`}),(0,d.jsxs)(`p`,{className:`text-[10px] font-black uppercase tracking-[0.25em] text-on-surface-variant/40`,children:[`Artifacts`,(0,d.jsx)(`span`,{className:`ml-2 text-primary/60`,children:h.length})]})]}),(0,d.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:h.map(e=>(0,d.jsx)(l,{name:e.originalName,type:p(e.mimeType),filePath:e.filePath},e.id))})]})]})]})]})})};export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{n,r,t as i}from"./vendor-markdown-DoJbQ1of.js";import{i as a}from"./client-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{n,r,t as i}from"./vendor-markdown-DoJbQ1of.js";import{i as a}from"./client-B553SX3l.js";import{t as o}from"./eye-CjrFwZG_.js";import{t as s}from"./sparkles-krUpxie4.js";var c=a(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),l=e(t(),1),u=r(),d=({label:e,value:t,onChange:r=()=>{},placeholder:a,height:d=`h-40`,helperText:f,maxLength:p,onKeyDown:m,initialMode:h=`write`,readOnly:g=!1})=>{let[_,v]=(0,l.useState)(h);return g?(0,u.jsx)(`div`,{className:`prose prose-invert prose-xs max-w-none`,children:(0,u.jsx)(n,{remarkPlugins:[i],children:t||``})}):(0,u.jsxs)(`div`,{className:`space-y-3`,children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e&&(0,u.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:e}),(0,u.jsxs)(`div`,{className:`flex items-center gap-1 bg-surface-container-high/50 p-1 rounded-lg ring-1 ring-outline-variant/10`,children:[(0,u.jsxs)(`button`,{type:`button`,onClick:()=>v(`write`),className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-[9px] font-black tracking-widest uppercase transition-all ${_===`write`?`bg-primary text-surface shadow-lg shadow-primary/20`:`text-on-surface-variant/60 hover:text-white`}`,children:[(0,u.jsx)(c,{size:12}),`Write`]}),(0,u.jsxs)(`button`,{type:`button`,onClick:()=>v(`preview`),className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-[9px] font-black tracking-widest uppercase transition-all ${_===`preview`?`bg-secondary text-surface shadow-lg shadow-secondary/20`:`text-on-surface-variant/60 hover:text-white`}`,children:[(0,u.jsx)(o,{size:12}),`Preview`]})]})]}),(0,u.jsx)(`div`,{className:`relative group bg-surface-container-highest/30 rounded-lg ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all ${d} overflow-hidden`,children:_===`write`?(0,u.jsx)(`textarea`,{value:t,onChange:e=>r(e.target.value),onKeyDown:m,placeholder:a,maxLength:p,className:`w-full h-full bg-transparent border-none text-xs text-on-surface p-4 focus:outline-none placeholder:text-on-surface-variant/30 resize-none leading-relaxed font-mono`}):(0,u.jsx)(`div`,{className:`w-full h-full p-4 overflow-y-auto custom-scrollbar prose prose-invert prose-xs max-w-none`,children:(0,u.jsx)(n,{remarkPlugins:[i],children:t||`*Nothing to preview*`})})}),(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[f?(0,u.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 py-0.5 rounded bg-tertiary/10 text-[9px] font-black text-tertiary tracking-widest uppercase w-fit`,children:[(0,u.jsx)(s,{size:10}),f]}):(0,u.jsx)(`div`,{}),p!=null&&p>0?(0,u.jsxs)(`div`,{className:`text-[10px] font-bold text-on-surface-variant/40 lowercase tracking-widest`,children:[t.length,` / `,p]}):null]})]})};export{c as n,d as t};
|