adam-agent-server 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -7
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/web/dist/assets/{ChannelDetail-DoQs1auJ.js → ChannelDetail-eWtIGhAd.js} +1 -1
- package/web/dist/assets/{Channels-Dc6QduC1.js → Channels-2veauYsm.js} +1 -1
- package/web/dist/assets/{Chat-NrKA_MiZ.js → Chat-Bha4vXwT.js} +1 -1
- package/web/dist/assets/{Dashboard-C67v0x7e.js → Dashboard-cDHpOWnY.js} +1 -1
- package/web/dist/assets/EnvVarEditor-CaCpNT3y.js +1 -0
- package/web/dist/assets/{Evolution-CbFOTN2o.js → Evolution-Ao-gdHbS.js} +1 -1
- package/web/dist/assets/{GoalDetail-DYUbYJpT.js → GoalDetail-CX2i9A5a.js} +1 -1
- package/web/dist/assets/{Goals-7eD9_7Qo.js → Goals-DdM0tFus.js} +1 -1
- package/web/dist/assets/{Logs-CDFbfvQT.js → Logs-DJhpDtCA.js} +1 -1
- package/web/dist/assets/{Memories-D0J8Es-o.js → Memories-CYN99g2T.js} +1 -1
- package/web/dist/assets/{Plugins-CXCUhsEZ.js → Plugins-gcMpBdyq.js} +1 -1
- package/web/dist/assets/{RoleDetail-C2lXyAjt.js → RoleDetail-s7u-Shk3.js} +2 -2
- package/web/dist/assets/{Roles-Bia_f3ml.js → Roles-CCy1H7PY.js} +1 -1
- package/web/dist/assets/{Settings-CzgdtkLo.js → Settings-JbgBxBeo.js} +1 -1
- package/web/dist/assets/{Strategies-CRdpzdUe.js → Strategies-CO4LwZjS.js} +1 -1
- package/web/dist/assets/{Switch-B05Q1L98.js → Switch-CTAIxUd_.js} +1 -1
- package/web/dist/assets/{TaskDetail-4yYEVV6Z.js → TaskDetail-DEg_oUwx.js} +1 -1
- package/web/dist/assets/{Work-CE6TB6LG.js → Work-BpKK_uXA.js} +1 -1
- package/web/dist/assets/{index-oA-kWqT5.js → index-rvaixveh.js} +5 -5
- package/web/dist/index.html +1 -1
- package/web/dist/assets/EnvVarEditor-DeCQryTm.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{h as t,nt as n,t as r,v as i}from"./vendor-icons-CkI4-NxL.js";import{r as a,t as o}from"./vendor-react-DLRtONKt.js";import{C as s,f as c,t as l,w as u}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{h as t,nt as n,t as r,v as i}from"./vendor-icons-CkI4-NxL.js";import{r as a,t as o}from"./vendor-react-DLRtONKt.js";import{C as s,f as c,t as l,w as u}from"./index-rvaixveh.js";import{t as d}from"./Card-4mOZntHG.js";import{a as f}from"./format-DvtQjPZn.js";import{t as p}from"./EmptyState-BlgMMAr-.js";import{a as m,i as h,n as g,o as _,r as v,t as y}from"./Table-BxbnOSbq.js";var b=e(n(),1),x=o();function S(){let e=s(e=>e.roles),n=s(e=>e.fetchRoles),o=s(e=>e.createRole),[S,C]=(0,b.useState)(!1),[w,T]=(0,b.useState)(!1),[E,D]=(0,b.useState)(``),[O,k]=(0,b.useState)(``),[A,j]=(0,b.useState)(!1),[M,N]=(0,b.useState)(null),P=(0,b.useCallback)(async()=>{C(!0),await n(),C(!1)},[n]),F=()=>{D(``),k(``),N(null),j(!1)},I=async()=>{let e=E.trim();if(!e){N(`Name is required.`);return}j(!0),N(null);try{await o({name:e,cagPrompt:O.trim()}),await n(),T(!1),F(),u.success(`Role created`)}catch(e){N(e instanceof Error?e.message:`Failed to create role`)}finally{j(!1)}};(0,b.useEffect)(()=>{P()},[P]);let L=e=>e===`active`?`success`:e===`inactive`?`secondary`:e===`retired`?`destructive`:e===`probation`?`warning`:`secondary`;return(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Roles`}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(c,{variant:`ghost`,size:`sm`,onClick:()=>void P(),disabled:S,children:(0,x.jsx)(t,{size:14,className:S?`animate-spin`:``})}),(0,x.jsx)(c,{size:`sm`,onClick:()=>T(!0),children:(0,x.jsx)(i,{size:14})})]})]}),e.length===0&&!S?(0,x.jsx)(d,{children:(0,x.jsx)(p,{title:`No roles yet`,description:`Create a role to define agent behavior and bind plugins.`})}):(0,x.jsx)(d,{padding:!1,children:(0,x.jsxs)(y,{children:[(0,x.jsx)(m,{children:(0,x.jsxs)(_,{children:[(0,x.jsx)(h,{children:`Name`}),(0,x.jsx)(h,{children:`Status`}),(0,x.jsx)(h,{children:`Score`}),(0,x.jsx)(h,{children:`Memories`}),(0,x.jsx)(h,{children:`Created`})]})}),(0,x.jsx)(g,{children:e.map(e=>(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{children:(0,x.jsx)(a,{to:`/roles/${e.id}`,className:`font-medium text-blue-400 hover:text-blue-300`,children:e.name})}),(0,x.jsx)(v,{children:(0,x.jsx)(l,{variant:L(e.status),children:e.status})}),(0,x.jsx)(v,{children:e.performanceScore==null?(0,x.jsx)(`span`,{className:`text-slate-500`,children:`—`}):(0,x.jsxs)(`span`,{className:`font-mono text-xs text-slate-300`,children:[(e.performanceScore*100).toFixed(0),`%`]})}),(0,x.jsx)(v,{children:(0,x.jsx)(`span`,{className:`text-sm text-slate-400`,children:e.memoryStreamId?e.memoryStreamId.slice(0,8):`—`})}),(0,x.jsx)(v,{className:`text-xs text-slate-500`,children:f(e.createdAt)})]},e.id))})]})}),w&&(0,x.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,onClick:e=>{e.target===e.currentTarget&&(T(!1),F())},children:(0,x.jsxs)(`div`,{className:`w-full max-w-md rounded-lg border border-slate-700 bg-slate-900 p-6 shadow-lg`,children:[(0,x.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,x.jsx)(`h2`,{className:`text-lg font-semibold text-slate-100`,children:`Create Role`}),(0,x.jsx)(`button`,{className:`text-slate-400 hover:text-slate-200`,onClick:()=>{T(!1),F()},children:(0,x.jsx)(r,{size:16})})]}),(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`label`,{className:`mb-1 block text-sm font-medium text-slate-300`,htmlFor:`role-name`,children:[`Name `,(0,x.jsx)(`span`,{className:`text-red-400`,children:`*`})]}),(0,x.jsx)(`input`,{id:`role-name`,className:`w-full rounded border border-slate-700 bg-slate-800 px-3 py-2 text-sm text-slate-200 placeholder-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`e.g. Engineer, Reviewer`,value:E,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key===`Enter`&&I()},autoFocus:!0})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-slate-300`,htmlFor:`role-cag-prompt`,children:`CAG Prompt`}),(0,x.jsx)(`textarea`,{id:`role-cag-prompt`,className:`w-full rounded border border-slate-700 bg-slate-800 px-3 py-2 text-sm text-slate-200 placeholder-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Character and Guidance prompt for this role...`,rows:5,value:O,onChange:e=>k(e.target.value)})]}),M&&(0,x.jsx)(`p`,{className:`text-sm text-red-400`,children:M}),(0,x.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,x.jsx)(c,{variant:`ghost`,size:`sm`,onClick:()=>{T(!1),F()},children:`Cancel`}),(0,x.jsx)(c,{size:`sm`,onClick:()=>void I(),disabled:A,children:A?`Creating...`:`Create`})]})]})]})})]})}export{S as Roles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,h as n,nt as r,p as i,u as a}from"./vendor-icons-CkI4-NxL.js";import{l as o,t as s}from"./vendor-react-DLRtONKt.js";import{r as c}from"./dist-HyCSN_hp.js";import{C as l,a as u,c as d,f,i as p,l as m,o as h,r as g,s as _,u as v}from"./index-oA-kWqT5.js";import{t as y}from"./Card-4mOZntHG.js";import{i as b}from"./format-DvtQjPZn.js";import{t as x}from"./EmptyState-BlgMMAr-.js";import{t as S}from"./EnvVarEditor-DeCQryTm.js";var C=e(r(),1),w=s(),T={anthropic:{label:`Anthropic`,paths:[`anthropic.apiKey`,`anthropic.baseUrl`,`anthropic.model`,`anthropic.defaultOpusModel`,`anthropic.defaultSonnetModel`,`anthropic.defaultHaikuModel`,`anthropic.smallFastModel`]},defaults:{label:`Defaults`,paths:[`defaults.model`,`defaults.effort`,`defaults.maxTurns`,`defaults.maxBudgetUsd`,`defaults.timeout`,`defaults.approvalTimeout`]},server:{label:`Server`,paths:[`server.port`,`server.host`,`server.apiKey`],mutablePaths:[`server.timezone`]},logging:{label:`Logging`,paths:[`logging.level`]},evolution:{label:`Evolution`,paths:[`roles.evolution.triggerEvery`,`roles.evolution.reflectionThreshold`]},chat:{label:`Chat`,paths:[`chat.sessionTimeoutMinutes`,`chat.maxSessionTurns`,`chat.autoTitle`,`chat.archiveExtractMemory`]}},E=[`defaults.deniedReadPaths`,`defaults.approvalRequired`],D=new Set([`anthropic.apiKey`,`server.apiKey`]),O={"anthropic.apiKey":`API Key`,"anthropic.baseUrl":`Base URL`,"anthropic.model":`Model`,"anthropic.defaultOpusModel":`Default Opus Model`,"anthropic.defaultSonnetModel":`Default Sonnet Model`,"anthropic.defaultHaikuModel":`Default Haiku Model`,"anthropic.smallFastModel":`Small Fast Model`,"defaults.model":`Default Model`,"defaults.effort":`Effort Level`,"defaults.maxTurns":`Max Turns`,"defaults.maxBudgetUsd":`Max Budget (USD)`,"defaults.timeout":`Timeout (seconds)`,"defaults.approvalTimeout":`Approval Timeout (seconds)`,"server.port":`Port`,"server.host":`Host`,"server.apiKey":`API Key (server auth)`,"server.timezone":`Timezone`,"logging.level":`Log Level`,"roles.evolution.triggerEvery":`Evolution Trigger Every (tasks)`,"roles.evolution.reflectionThreshold":`Reflection Threshold (tokens)`,"chat.sessionTimeoutMinutes":`Session Timeout (minutes)`,"chat.maxSessionTurns":`Max Session Turns`,"chat.autoTitle":`Auto-generate Session Title`,"chat.archiveExtractMemory":`Extract Memory on Archive`},k={"defaults.effort":[`low`,`medium`,`high`,`max`],"logging.level":[`debug`,`info`,`warn`,`error`],"server.timezone":[`system`,`Asia/Shanghai`,`Asia/Tokyo`,`Asia/Singapore`,`America/New_York`,`America/Los_Angeles`,`America/Chicago`,`Europe/London`,`Europe/Berlin`,`Europe/Paris`,`UTC`]};function A(){let[e,r]=(0,C.useState)({}),[s,A]=(0,C.useState)([]),[M,N]=(0,C.useState)({}),[P,F]=(0,C.useState)(new Set),[I,L]=(0,C.useState)(!1),[R,z]=(0,C.useState)(null),[B,V]=(0,C.useState)(!0),[H,U]=(0,C.useState)(null),[W,G]=(0,C.useState)({}),[K,q]=(0,C.useState)(new Set),[J,Y]=(0,C.useState)({}),X=l(e=>e.configVersion);(0,C.useEffect)(()=>{if(P.size===0)return;let e=e=>{e.preventDefault()};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[P.size]);let Z=o(({currentLocation:e,nextLocation:t})=>P.size>0&&e.pathname!==t.pathname),Q=(0,C.useCallback)(async()=>{try{let e=await c(`/config`);r(e.config),A(e.mutable);let t={};for(let[n,r]of Object.entries(e.config))t[n]=String(r.value??``);N(t),F(new Set);let n=e.config[`server.timezone`]?.value;n&&b(n);let i={};for(let t of E){let n=e.config[t];n&&(i[t]=Array.isArray(n.value)?n.value:[])}G(i),q(new Set),U(await c(`/config/env-diff`)),Y((await c(`/config/env`)).env)}catch(e){z({type:`error`,text:e instanceof Error?e.message:`Failed to load config`})}finally{V(!1)}},[]);(0,C.useEffect)(()=>{Q()},[Q]),(0,C.useEffect)(()=>{X>0&&Q()},[X,Q]);let ee=async()=>{await c(`/config/sync-to-env`,{method:`POST`}),z({type:`success`,text:`Synced DB values to .env`}),U(null)},te=async()=>{await c(`/config/load-from-env`,{method:`POST`}),z({type:`success`,text:`Loaded .env values to DB`}),Q()},$=(e,t)=>{N(n=>({...n,[e]:t})),F(t=>new Set(t).add(e)),z(null)},ne=async()=>{if(P.size!==0){L(!0),z(null);try{let t={};for(let n of P){let r=e[n],i=M[n];if(r&&typeof r.value==`number`&&(i=Number(i),isNaN(i))){z({type:`error`,text:`"${O[n]??n}" must be a number`}),L(!1);return}t[n]=i}let n=await c(`/config`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,...Object.fromEntries(Array.from(K).map(e=>[e,W[e]??[]]))})});if(n.updated.length>0&&(z({type:`success`,text:`Updated ${n.updated.length} setting(s)`}),n.updated.includes(`server.timezone`))){let e=M[`server.timezone`];b(e)}n.errors.length>0&&z({type:`error`,text:n.errors.join(`; `)}),F(new Set),Q()}catch(e){z({type:`error`,text:e instanceof Error?e.message:`Save failed`})}finally{L(!1)}}};return B?(0,w.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,w.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-slate-700 border-t-blue-500`})}):Object.keys(e).length===0?(0,w.jsx)(x,{icon:(0,w.jsx)(a,{size:32}),title:`No configuration`,description:`Config API not available`}):(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Settings`}),(0,w.jsxs)(`div`,{className:`flex gap-2`,children:[(0,w.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>void Q(),children:(0,w.jsx)(n,{size:14})}),P.size>0&&(0,w.jsxs)(f,{size:`sm`,onClick:()=>void ne(),disabled:I,children:[(0,w.jsx)(i,{size:14}),I?`Saving...`:`Save (${P.size})`]})]})]}),R&&(0,w.jsx)(`div`,{className:`rounded px-3 py-2 text-sm ${R.type===`success`?`bg-green-900/30 text-green-400`:`bg-red-900/30 text-red-400`}`,children:R.text}),H&&H.diffs.length>0&&(0,w.jsx)(y,{children:(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`p`,{className:`text-sm font-medium text-yellow-400`,children:[`.env and DB have `,H.diffs.length,` different value(s)`]}),(0,w.jsx)(`p`,{className:`mt-1 text-xs text-slate-500`,children:H.diffs.map(e=>e.envKey).join(`, `)})]}),(0,w.jsxs)(`div`,{className:`flex gap-2`,children:[(0,w.jsx)(f,{variant:`ghost`,size:`sm`,onClick:ee,children:`Sync DB → .env`}),(0,w.jsx)(f,{variant:`ghost`,size:`sm`,onClick:te,children:`Load .env → DB`})]})]})}),Object.entries(T).map(([n,{label:r,paths:i,mutablePaths:a}])=>{let o=[...i,...a??[]];return(0,w.jsxs)(y,{children:[(0,w.jsx)(`h2`,{className:`mb-3 text-sm font-medium text-slate-300`,children:r}),(0,w.jsx)(`div`,{className:`space-y-3`,children:o.map(n=>{let r=e[n];if(!r)return null;let i=s.includes(n),a=O[n]??n,o=M[n]??String(r.value??``),c=P.has(n),l=k[n];return(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsxs)(`div`,{className:`w-56 flex items-center gap-1.5`,children:[!i&&(0,w.jsx)(t,{size:12,className:`text-slate-600`}),(0,w.jsx)(`label`,{className:`text-sm text-slate-400`,children:a}),!i&&(0,w.jsx)(`span`,{className:`text-[10px] text-slate-600`,children:`restart required`})]}),(0,w.jsx)(`div`,{className:`flex-1`,children:l?(0,w.jsx)(`select`,{className:`w-full rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none disabled:opacity-50`,value:o,onChange:e=>$(n,e.target.value),disabled:!i,children:l.map(e=>(0,w.jsx)(`option`,{value:e,children:e},e))}):(0,w.jsx)(`input`,{className:`w-full rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none disabled:opacity-50`,type:D.has(n)?`password`:`text`,value:o,onChange:e=>$(n,e.target.value),disabled:!i,placeholder:D.has(n)?`Enter to update`:void 0})}),(0,w.jsx)(`div`,{className:`w-16 text-right`,children:c&&i&&(0,w.jsx)(`span`,{className:`text-[10px] text-yellow-500`,children:`modified`})})]},n)})})]},n)}),(0,w.jsx)(S,{envVars:J,onSave:()=>void Q(),mode:`global`,title:`Environment Variables`}),(0,w.jsx)(j,{mutablePaths:s,listValues:W,listDirty:K,setListValues:G,setListDirty:e=>q(e),dirty:P}),(0,w.jsx)(g,{open:Z.state===`blocked`,children:(0,w.jsxs)(h,{children:[(0,w.jsxs)(m,{children:[(0,w.jsx)(v,{children:`Unsaved Changes`}),(0,w.jsxs)(_,{children:[`You have `,P.size+K.size,` unsaved change(s). Discard and leave?`]})]}),(0,w.jsxs)(d,{children:[(0,w.jsx)(u,{onClick:()=>Z.reset?.(),children:`Stay`}),(0,w.jsx)(p,{onClick:()=>Z.proceed?.(),children:`Discard`})]})]})})]})}function j({mutablePaths:e,listValues:n,listDirty:r,setListValues:i,setListDirty:a,dirty:o}){let[s,c]=(0,C.useState)(``),[l,u]=(0,C.useState)(``),d=e.includes(`defaults.deniedReadPaths`),p=e.includes(`defaults.approvalRequired`),m=n[`defaults.deniedReadPaths`]??[],h=n[`defaults.approvalRequired`]??[],g=[`~/.ssh`,`~/.aws`,`~/.gnupg`,`/etc/shadow`],_=[`rm -rf *`,`git push*`,`git reset*`,`curl * -X POST*`,`curl * --request POST*`],v=e=>g.some(t=>e===(t.startsWith(`~/`),t)||e===t),b=e=>_.includes(e),x=()=>{let e=s.trim();!e||m.includes(e)||(i(t=>({...t,"defaults.deniedReadPaths":[...m,e]})),a(e=>new Set(e).add(`defaults.deniedReadPaths`)),c(``))},S=e=>{v(e)||(i(t=>({...t,"defaults.deniedReadPaths":m.filter(t=>t!==e)})),a(e=>new Set(e).add(`defaults.deniedReadPaths`)))},T=()=>{let e=l.trim();!e||h.includes(e)||(i(t=>({...t,"defaults.approvalRequired":[...h,e]})),a(e=>new Set(e).add(`defaults.approvalRequired`)),u(``))},E=e=>{b(e)||(i(t=>({...t,"defaults.approvalRequired":h.filter(t=>t!==e)})),a(e=>new Set(e).add(`defaults.approvalRequired`)))},D=o.size+r.size;return(0,w.jsxs)(y,{children:[(0,w.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,w.jsx)(`h2`,{className:`text-sm font-medium text-slate-300`,children:`Advanced`}),D>0&&(0,w.jsxs)(`span`,{className:`text-[10px] text-yellow-500`,children:[r.size,` modified`]})]}),(0,w.jsxs)(`div`,{className:`mb-6`,children:[(0,w.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,w.jsx)(`h3`,{className:`text-xs font-medium text-slate-400`,children:`Denied Read Paths`}),!d&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-slate-600`,children:[(0,w.jsx)(t,{size:10}),` restart required`]})]}),(0,w.jsxs)(`p`,{className:`mb-2 text-xs text-slate-500`,children:[`Paths blocked at both the SDK and OS layer for all roles. System defaults (locked) cannot be removed. Uses `,(0,w.jsx)(`code`,{className:`text-slate-400`,children:`*`}),` as wildcard.`]}),(0,w.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,children:m.map(e=>{let n=v(e);return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border px-2 py-0.5 text-xs ${n?`border-slate-700 bg-slate-800 text-slate-500`:`border-red-800 bg-red-950 text-red-300`}`,children:[n&&(0,w.jsx)(t,{size:9}),e,!n&&d&&(0,w.jsx)(`button`,{type:`button`,className:`ml-0.5 text-red-500 hover:text-red-300`,onClick:()=>S(e),children:`×`})]},e)})}),d&&(0,w.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,w.jsx)(`input`,{className:`flex-1 rounded border border-slate-700 bg-slate-900 px-2 py-1 text-xs text-slate-200 focus:border-blue-500 focus:outline-none`,placeholder:`/absolute/path or ~/path`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),x())}}),(0,w.jsx)(f,{variant:`ghost`,size:`sm`,className:`scale-75`,onClick:()=>x(),children:`Add`})]})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,w.jsx)(`h3`,{className:`text-xs font-medium text-slate-400`,children:`Approval Required Patterns`}),!p&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-slate-600`,children:[(0,w.jsx)(t,{size:10}),` restart required`]})]}),(0,w.jsxs)(`p`,{className:`mb-2 text-xs text-slate-500`,children:[`Operations matching these glob patterns require user approval before execution. Uses SDK Permission Rule glob syntax (`,(0,w.jsx)(`code`,{className:`text-slate-400`,children:`*`}),` = wildcard, e.g.,`,` `,(0,w.jsx)(`code`,{className:`text-slate-400`,children:`rm -rf *`}),`).`]}),(0,w.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,children:h.map(e=>{let n=b(e);return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border px-2 py-0.5 text-xs ${n?`border-slate-700 bg-slate-800 text-slate-500`:`border-amber-800 bg-amber-950 text-amber-300`}`,children:[n&&(0,w.jsx)(t,{size:9}),e,!n&&p&&(0,w.jsx)(`button`,{type:`button`,className:`ml-0.5 text-amber-500 hover:text-amber-300`,onClick:()=>E(e),children:`×`})]},e)})}),p&&(0,w.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,w.jsx)(`input`,{className:`flex-1 rounded border border-slate-700 bg-slate-900 px-2 py-1 text-xs text-slate-200 focus:border-blue-500 focus:outline-none`,placeholder:`e.g. "curl * --request POST *"`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),T())}}),(0,w.jsx)(f,{variant:`ghost`,size:`sm`,className:`scale-75`,onClick:()=>T(),children:`Add`})]})]})]})}export{A as Settings};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,h as n,nt as r,p as i,u as a}from"./vendor-icons-CkI4-NxL.js";import{l as o,t as s}from"./vendor-react-DLRtONKt.js";import{r as c}from"./dist-HyCSN_hp.js";import{C as l,a as u,c as d,f,i as p,l as m,o as h,r as g,s as _,u as v}from"./index-rvaixveh.js";import{t as y}from"./Card-4mOZntHG.js";import{i as b}from"./format-DvtQjPZn.js";import{t as x}from"./EmptyState-BlgMMAr-.js";import{t as S}from"./EnvVarEditor-CaCpNT3y.js";var C=e(r(),1),w=s(),T={anthropic:{label:`Anthropic`,paths:[`anthropic.apiKey`,`anthropic.baseUrl`,`anthropic.model`,`anthropic.defaultOpusModel`,`anthropic.defaultSonnetModel`,`anthropic.defaultHaikuModel`,`anthropic.smallFastModel`]},defaults:{label:`Defaults`,paths:[`defaults.model`,`defaults.effort`,`defaults.maxTurns`,`defaults.maxBudgetUsd`,`defaults.timeout`,`defaults.approvalTimeout`]},server:{label:`Server`,paths:[`server.port`,`server.host`,`server.apiKey`],mutablePaths:[`server.timezone`]},logging:{label:`Logging`,paths:[`logging.level`]},evolution:{label:`Evolution`,paths:[`roles.evolution.triggerEvery`,`roles.evolution.reflectionThreshold`]},chat:{label:`Chat`,paths:[`chat.sessionTimeoutMinutes`,`chat.maxSessionTurns`,`chat.autoTitle`,`chat.archiveExtractMemory`]}},E=[`defaults.deniedReadPaths`,`defaults.approvalRequired`],D=new Set([`anthropic.apiKey`,`server.apiKey`]),O={"anthropic.apiKey":`API Key`,"anthropic.baseUrl":`Base URL`,"anthropic.model":`Model`,"anthropic.defaultOpusModel":`Default Opus Model`,"anthropic.defaultSonnetModel":`Default Sonnet Model`,"anthropic.defaultHaikuModel":`Default Haiku Model`,"anthropic.smallFastModel":`Small Fast Model`,"defaults.model":`Default Model`,"defaults.effort":`Effort Level`,"defaults.maxTurns":`Max Turns`,"defaults.maxBudgetUsd":`Max Budget (USD)`,"defaults.timeout":`Timeout (seconds)`,"defaults.approvalTimeout":`Approval Timeout (seconds)`,"server.port":`Port`,"server.host":`Host`,"server.apiKey":`API Key (server auth)`,"server.timezone":`Timezone`,"logging.level":`Log Level`,"roles.evolution.triggerEvery":`Evolution Trigger Every (tasks)`,"roles.evolution.reflectionThreshold":`Reflection Threshold (tokens)`,"chat.sessionTimeoutMinutes":`Session Timeout (minutes)`,"chat.maxSessionTurns":`Max Session Turns`,"chat.autoTitle":`Auto-generate Session Title`,"chat.archiveExtractMemory":`Extract Memory on Archive`},k={"defaults.effort":[`low`,`medium`,`high`,`max`],"logging.level":[`debug`,`info`,`warn`,`error`],"server.timezone":[`system`,`Asia/Shanghai`,`Asia/Tokyo`,`Asia/Singapore`,`America/New_York`,`America/Los_Angeles`,`America/Chicago`,`Europe/London`,`Europe/Berlin`,`Europe/Paris`,`UTC`]};function A(){let[e,r]=(0,C.useState)({}),[s,A]=(0,C.useState)([]),[M,N]=(0,C.useState)({}),[P,F]=(0,C.useState)(new Set),[I,L]=(0,C.useState)(!1),[R,z]=(0,C.useState)(null),[B,V]=(0,C.useState)(!0),[H,U]=(0,C.useState)(null),[W,G]=(0,C.useState)({}),[K,q]=(0,C.useState)(new Set),[J,Y]=(0,C.useState)({}),X=l(e=>e.configVersion);(0,C.useEffect)(()=>{if(P.size===0)return;let e=e=>{e.preventDefault()};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[P.size]);let Z=o(({currentLocation:e,nextLocation:t})=>P.size>0&&e.pathname!==t.pathname),Q=(0,C.useCallback)(async()=>{try{let e=await c(`/config`);r(e.config),A(e.mutable);let t={};for(let[n,r]of Object.entries(e.config))t[n]=String(r.value??``);N(t),F(new Set);let n=e.config[`server.timezone`]?.value;n&&b(n);let i={};for(let t of E){let n=e.config[t];n&&(i[t]=Array.isArray(n.value)?n.value:[])}G(i),q(new Set),U(await c(`/config/env-diff`)),Y((await c(`/config/env`)).env)}catch(e){z({type:`error`,text:e instanceof Error?e.message:`Failed to load config`})}finally{V(!1)}},[]);(0,C.useEffect)(()=>{Q()},[Q]),(0,C.useEffect)(()=>{X>0&&Q()},[X,Q]);let ee=async()=>{await c(`/config/sync-to-env`,{method:`POST`}),z({type:`success`,text:`Synced DB values to .env`}),U(null)},te=async()=>{await c(`/config/load-from-env`,{method:`POST`}),z({type:`success`,text:`Loaded .env values to DB`}),Q()},$=(e,t)=>{N(n=>({...n,[e]:t})),F(t=>new Set(t).add(e)),z(null)},ne=async()=>{if(P.size!==0){L(!0),z(null);try{let t={};for(let n of P){let r=e[n],i=M[n];if(r&&typeof r.value==`number`&&(i=Number(i),isNaN(i))){z({type:`error`,text:`"${O[n]??n}" must be a number`}),L(!1);return}t[n]=i}let n=await c(`/config`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,...Object.fromEntries(Array.from(K).map(e=>[e,W[e]??[]]))})});if(n.updated.length>0&&(z({type:`success`,text:`Updated ${n.updated.length} setting(s)`}),n.updated.includes(`server.timezone`))){let e=M[`server.timezone`];b(e)}n.errors.length>0&&z({type:`error`,text:n.errors.join(`; `)}),F(new Set),Q()}catch(e){z({type:`error`,text:e instanceof Error?e.message:`Save failed`})}finally{L(!1)}}};return B?(0,w.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,w.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-slate-700 border-t-blue-500`})}):Object.keys(e).length===0?(0,w.jsx)(x,{icon:(0,w.jsx)(a,{size:32}),title:`No configuration`,description:`Config API not available`}):(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Settings`}),(0,w.jsxs)(`div`,{className:`flex gap-2`,children:[(0,w.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>void Q(),children:(0,w.jsx)(n,{size:14})}),P.size>0&&(0,w.jsxs)(f,{size:`sm`,onClick:()=>void ne(),disabled:I,children:[(0,w.jsx)(i,{size:14}),I?`Saving...`:`Save (${P.size})`]})]})]}),R&&(0,w.jsx)(`div`,{className:`rounded px-3 py-2 text-sm ${R.type===`success`?`bg-green-900/30 text-green-400`:`bg-red-900/30 text-red-400`}`,children:R.text}),H&&H.diffs.length>0&&(0,w.jsx)(y,{children:(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`p`,{className:`text-sm font-medium text-yellow-400`,children:[`.env and DB have `,H.diffs.length,` different value(s)`]}),(0,w.jsx)(`p`,{className:`mt-1 text-xs text-slate-500`,children:H.diffs.map(e=>e.envKey).join(`, `)})]}),(0,w.jsxs)(`div`,{className:`flex gap-2`,children:[(0,w.jsx)(f,{variant:`ghost`,size:`sm`,onClick:ee,children:`Sync DB → .env`}),(0,w.jsx)(f,{variant:`ghost`,size:`sm`,onClick:te,children:`Load .env → DB`})]})]})}),Object.entries(T).map(([n,{label:r,paths:i,mutablePaths:a}])=>{let o=[...i,...a??[]];return(0,w.jsxs)(y,{children:[(0,w.jsx)(`h2`,{className:`mb-3 text-sm font-medium text-slate-300`,children:r}),(0,w.jsx)(`div`,{className:`space-y-3`,children:o.map(n=>{let r=e[n];if(!r)return null;let i=s.includes(n),a=O[n]??n,o=M[n]??String(r.value??``),c=P.has(n),l=k[n];return(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsxs)(`div`,{className:`w-56 flex items-center gap-1.5`,children:[!i&&(0,w.jsx)(t,{size:12,className:`text-slate-600`}),(0,w.jsx)(`label`,{className:`text-sm text-slate-400`,children:a}),!i&&(0,w.jsx)(`span`,{className:`text-[10px] text-slate-600`,children:`restart required`})]}),(0,w.jsx)(`div`,{className:`flex-1`,children:l?(0,w.jsx)(`select`,{className:`w-full rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none disabled:opacity-50`,value:o,onChange:e=>$(n,e.target.value),disabled:!i,children:l.map(e=>(0,w.jsx)(`option`,{value:e,children:e},e))}):(0,w.jsx)(`input`,{className:`w-full rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none disabled:opacity-50`,type:D.has(n)?`password`:`text`,value:o,onChange:e=>$(n,e.target.value),disabled:!i,placeholder:D.has(n)?`Enter to update`:void 0})}),(0,w.jsx)(`div`,{className:`w-16 text-right`,children:c&&i&&(0,w.jsx)(`span`,{className:`text-[10px] text-yellow-500`,children:`modified`})})]},n)})})]},n)}),(0,w.jsx)(S,{envVars:J,onSave:()=>void Q(),mode:`global`,title:`Environment Variables`}),(0,w.jsx)(j,{mutablePaths:s,listValues:W,listDirty:K,setListValues:G,setListDirty:e=>q(e),dirty:P}),(0,w.jsx)(g,{open:Z.state===`blocked`,children:(0,w.jsxs)(h,{children:[(0,w.jsxs)(m,{children:[(0,w.jsx)(v,{children:`Unsaved Changes`}),(0,w.jsxs)(_,{children:[`You have `,P.size+K.size,` unsaved change(s). Discard and leave?`]})]}),(0,w.jsxs)(d,{children:[(0,w.jsx)(u,{onClick:()=>Z.reset?.(),children:`Stay`}),(0,w.jsx)(p,{onClick:()=>Z.proceed?.(),children:`Discard`})]})]})})]})}function j({mutablePaths:e,listValues:n,listDirty:r,setListValues:i,setListDirty:a,dirty:o}){let[s,c]=(0,C.useState)(``),[l,u]=(0,C.useState)(``),d=e.includes(`defaults.deniedReadPaths`),p=e.includes(`defaults.approvalRequired`),m=n[`defaults.deniedReadPaths`]??[],h=n[`defaults.approvalRequired`]??[],g=[`~/.ssh`,`~/.aws`,`~/.gnupg`,`/etc/shadow`],_=[`rm -rf *`,`git push*`,`git reset*`,`curl * -X POST*`,`curl * --request POST*`],v=e=>g.some(t=>e===(t.startsWith(`~/`),t)||e===t),b=e=>_.includes(e),x=()=>{let e=s.trim();!e||m.includes(e)||(i(t=>({...t,"defaults.deniedReadPaths":[...m,e]})),a(e=>new Set(e).add(`defaults.deniedReadPaths`)),c(``))},S=e=>{v(e)||(i(t=>({...t,"defaults.deniedReadPaths":m.filter(t=>t!==e)})),a(e=>new Set(e).add(`defaults.deniedReadPaths`)))},T=()=>{let e=l.trim();!e||h.includes(e)||(i(t=>({...t,"defaults.approvalRequired":[...h,e]})),a(e=>new Set(e).add(`defaults.approvalRequired`)),u(``))},E=e=>{b(e)||(i(t=>({...t,"defaults.approvalRequired":h.filter(t=>t!==e)})),a(e=>new Set(e).add(`defaults.approvalRequired`)))},D=o.size+r.size;return(0,w.jsxs)(y,{children:[(0,w.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,w.jsx)(`h2`,{className:`text-sm font-medium text-slate-300`,children:`Advanced`}),D>0&&(0,w.jsxs)(`span`,{className:`text-[10px] text-yellow-500`,children:[r.size,` modified`]})]}),(0,w.jsxs)(`div`,{className:`mb-6`,children:[(0,w.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,w.jsx)(`h3`,{className:`text-xs font-medium text-slate-400`,children:`Denied Read Paths`}),!d&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-slate-600`,children:[(0,w.jsx)(t,{size:10}),` restart required`]})]}),(0,w.jsxs)(`p`,{className:`mb-2 text-xs text-slate-500`,children:[`Paths blocked at both the SDK and OS layer for all roles. System defaults (locked) cannot be removed. Uses `,(0,w.jsx)(`code`,{className:`text-slate-400`,children:`*`}),` as wildcard.`]}),(0,w.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,children:m.map(e=>{let n=v(e);return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border px-2 py-0.5 text-xs ${n?`border-slate-700 bg-slate-800 text-slate-500`:`border-red-800 bg-red-950 text-red-300`}`,children:[n&&(0,w.jsx)(t,{size:9}),e,!n&&d&&(0,w.jsx)(`button`,{type:`button`,className:`ml-0.5 text-red-500 hover:text-red-300`,onClick:()=>S(e),children:`×`})]},e)})}),d&&(0,w.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,w.jsx)(`input`,{className:`flex-1 rounded border border-slate-700 bg-slate-900 px-2 py-1 text-xs text-slate-200 focus:border-blue-500 focus:outline-none`,placeholder:`/absolute/path or ~/path`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),x())}}),(0,w.jsx)(f,{variant:`ghost`,size:`sm`,className:`scale-75`,onClick:()=>x(),children:`Add`})]})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,w.jsx)(`h3`,{className:`text-xs font-medium text-slate-400`,children:`Approval Required Patterns`}),!p&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-slate-600`,children:[(0,w.jsx)(t,{size:10}),` restart required`]})]}),(0,w.jsxs)(`p`,{className:`mb-2 text-xs text-slate-500`,children:[`Operations matching these glob patterns require user approval before execution. Uses SDK Permission Rule glob syntax (`,(0,w.jsx)(`code`,{className:`text-slate-400`,children:`*`}),` = wildcard, e.g.,`,` `,(0,w.jsx)(`code`,{className:`text-slate-400`,children:`rm -rf *`}),`).`]}),(0,w.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,children:h.map(e=>{let n=b(e);return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border px-2 py-0.5 text-xs ${n?`border-slate-700 bg-slate-800 text-slate-500`:`border-amber-800 bg-amber-950 text-amber-300`}`,children:[n&&(0,w.jsx)(t,{size:9}),e,!n&&p&&(0,w.jsx)(`button`,{type:`button`,className:`ml-0.5 text-amber-500 hover:text-amber-300`,onClick:()=>E(e),children:`×`})]},e)})}),p&&(0,w.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,w.jsx)(`input`,{className:`flex-1 rounded border border-slate-700 bg-slate-900 px-2 py-1 text-xs text-slate-200 focus:border-blue-500 focus:outline-none`,placeholder:`e.g. "curl * --request POST *"`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),T())}}),(0,w.jsx)(f,{variant:`ghost`,size:`sm`,className:`scale-75`,onClick:()=>T(),children:`Add`})]})]})]})}export{A as Settings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{A as t,h as n,nt as r}from"./vendor-icons-CkI4-NxL.js";import{t as i}from"./vendor-react-DLRtONKt.js";import{C as a,f as o,t as s}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{A as t,h as n,nt as r}from"./vendor-icons-CkI4-NxL.js";import{t as i}from"./vendor-react-DLRtONKt.js";import{C as a,f as o,t as s}from"./index-rvaixveh.js";import{t as c}from"./Card-4mOZntHG.js";import{a as l}from"./format-DvtQjPZn.js";import{t as u}from"./EmptyState-BlgMMAr-.js";import{a as d,i as f,n as p,o as m,r as h,t as g}from"./Table-BxbnOSbq.js";var _=e(r(),1),v=i(),y={engineer:`info`,analyst:`warning`,content_creator:`success`,reviewer:`muted`};function b(){let e=a(e=>e.strategies),r=a(e=>e.fetchStrategies);(0,_.useEffect)(()=>{r()},[r]);let i=new Map;for(let t of e){let e=i.get(t.roleId)??[];e.push(t),i.set(t.roleId,e)}return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Strategies`}),(0,v.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>void r(),children:(0,v.jsx)(n,{size:14})})]}),e.length===0?(0,v.jsx)(u,{icon:(0,v.jsx)(t,{size:32}),title:`No strategies`,description:`Strategies are created by the Thompson Sampling engine as agents process tasks`}):Array.from(i.entries()).map(([e,t])=>(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(s,{variant:y[e]??`muted`,children:e}),(0,v.jsxs)(`span`,{className:`text-xs text-slate-500`,children:[t.length,` strategies`]})]}),(0,v.jsx)(c,{padding:!1,children:(0,v.jsxs)(g,{children:[(0,v.jsx)(d,{children:(0,v.jsxs)(m,{children:[(0,v.jsx)(f,{children:`Name`}),(0,v.jsx)(f,{children:`Task Type`}),(0,v.jsx)(f,{children:`Alpha`}),(0,v.jsx)(f,{children:`Beta`}),(0,v.jsx)(f,{children:`Trials`}),(0,v.jsx)(f,{children:`Avg Reward`}),(0,v.jsx)(f,{children:`Created`})]})}),(0,v.jsx)(p,{children:t.map(e=>(0,v.jsxs)(m,{children:[(0,v.jsx)(h,{className:`font-medium text-slate-200`,children:e.name}),(0,v.jsx)(h,{children:(0,v.jsx)(`span`,{className:`rounded bg-slate-800 px-1.5 py-0.5 font-mono text-[10px] text-slate-400`,children:e.taskType})}),(0,v.jsx)(h,{className:`font-mono text-xs`,children:e.alpha.toFixed(2)}),(0,v.jsx)(h,{className:`font-mono text-xs`,children:e.beta.toFixed(2)}),(0,v.jsx)(h,{className:`font-mono text-xs`,children:e.totalTrials}),(0,v.jsx)(h,{className:`font-mono text-xs`,children:e.avgReward==null?`—`:e.avgReward.toFixed(3)}),(0,v.jsx)(h,{className:`text-xs text-slate-500`,children:l(e.createdAt)})]},e.id))})]})})]},e))]})}export{b as Strategies};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{nt as t}from"./vendor-icons-CkI4-NxL.js";import{t as n}from"./vendor-react-DLRtONKt.js";import{n as r}from"./dist-HyCSN_hp.js";import{S as i,_ as a,b as o,h as s,x as c,y as l}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{nt as t}from"./vendor-icons-CkI4-NxL.js";import{t as n}from"./vendor-react-DLRtONKt.js";import{n as r}from"./dist-HyCSN_hp.js";import{S as i,_ as a,b as o,h as s,x as c,y as l}from"./index-rvaixveh.js";var u=e(t(),1);function d(e){let t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function f(e){let[t,n]=u.useState(void 0);return l(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var p=n(),m=`Switch`,[h,g]=i(m),[_,v]=h(m),y=u.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:l,required:d,disabled:f,value:h=`on`,onCheckedChange:g,form:v,...y}=e,[b,x]=u.useState(null),S=c(t,e=>x(e)),T=u.useRef(!1),E=b?v||!!b.closest(`form`):!0,[D,O]=a({prop:i,defaultProp:l??!1,onChange:g,caller:m});return(0,p.jsxs)(_,{scope:n,checked:D,disabled:f,children:[(0,p.jsx)(s.button,{type:`button`,role:`switch`,"aria-checked":D,"aria-required":d,"data-state":w(D),"data-disabled":f?``:void 0,disabled:f,value:h,...y,ref:S,onClick:o(e.onClick,e=>{O(e=>!e),E&&(T.current=e.isPropagationStopped(),T.current||e.stopPropagation())})}),E&&(0,p.jsx)(C,{control:b,bubbles:!T.current,name:r,value:h,checked:D,required:d,disabled:f,form:v,style:{transform:`translateX(-100%)`}})]})});y.displayName=m;var b=`SwitchThumb`,x=u.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=v(b,n);return(0,p.jsx)(s.span,{"data-state":w(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});x.displayName=b;var S=`SwitchBubbleInput`,C=u.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=u.useRef(null),s=c(o,a),l=d(n),m=f(t);return u.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(l!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[l,n,r]),(0,p.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...m,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});C.displayName=S;function w(e){return e?`checked`:`unchecked`}var T=y,E=x,D=u.forwardRef(({className:e,...t},n)=>(0,p.jsx)(T,{className:r(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-slate-900 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue-600 data-[state=unchecked]:bg-slate-700`,e),...t,ref:n,children:(0,p.jsx)(E,{className:r(`pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`)})}));D.displayName=T.displayName;export{D as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{$ as t,B as n,H as r,M as i,N as a,U as o,i as s,nt as c}from"./vendor-icons-CkI4-NxL.js";import{d as l,r as u,t as d}from"./vendor-react-DLRtONKt.js";import{i as f,r as p}from"./dist-HyCSN_hp.js";import{f as m,n as h,t as g}from"./index-oA-kWqT5.js";import{n as _,r as v,t as y}from"./Card-4mOZntHG.js";import{a as b,n as x,r as S,t as C}from"./format-DvtQjPZn.js";var w=e(c(),1),T=d(),E={reasoning:`bg-blue-500`,tool_call:`bg-blue-400`,tool_result:`bg-green-500`,approval_request:`bg-yellow-500`,approval_response:`bg-yellow-400`,permission_denied:`bg-orange-500`,error:`bg-red-500`,plugin_error:`bg-red-600`};function D({logs:e}){let[t,n]=(0,w.useState)(new Set);return e.length===0?(0,T.jsx)(`p`,{className:`text-sm text-slate-500`,children:`No execution steps yet.`}):(0,T.jsx)(`div`,{className:`space-y-0`,children:e.map((r,i)=>{let a=i>0?e[i-1].timestamp:null,o=a?r.timestamp-a:null,s=r.type===`plugin_error`,c=t.has(i)?r.content:r.content.length>200?r.content.slice(0,200)+`...`:r.content;return(0,T.jsxs)(`div`,{className:`flex gap-3`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,T.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full mt-1.5 flex-shrink-0 ${E[r.type]??`bg-slate-500`} ${s?`ring-2 ring-red-400`:``}`}),i<e.length-1&&(0,T.jsx)(`div`,{className:`w-0.5 flex-1 bg-slate-700 mt-0.5`})]}),(0,T.jsxs)(`div`,{className:`flex-1 pb-4 ${s?`border border-red-500/40 rounded-md bg-red-950/10 p-2`:``}`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,T.jsxs)(`span`,{className:`text-xs font-mono text-slate-500`,children:[`#`,r.index]}),(0,T.jsx)(`span`,{className:`text-sm font-medium text-slate-200`,children:r.toolName??r.type}),s&&(0,T.jsx)(g,{variant:`destructive`,children:`Plugin Error`}),(0,T.jsx)(`span`,{className:`text-xs text-slate-500`,children:b(r.timestamp)}),o!=null&&o>0&&(0,T.jsxs)(`span`,{className:`text-xs text-slate-600`,children:[`+`,o,`ms`]}),r.truncated&&(0,T.jsx)(g,{variant:`outline`,children:`truncated`})]}),c&&(0,T.jsx)(`button`,{className:`mt-1 text-xs text-slate-400 hover:text-slate-300 text-left w-full font-mono`,onClick:()=>{n(e=>{let t=new Set(e);return t.has(i)?t.delete(i):t.add(i),t})},children:c})]})]},r.id)})})}function O(){let{id:e}=l(),[c,d]=(0,w.useState)(null),[b,E]=(0,w.useState)([]),[O,j]=(0,w.useState)([]),[M,N]=(0,w.useState)([]),[P,F]=(0,w.useState)(null),[I,L]=(0,w.useState)(null),[R,z]=(0,w.useState)(!1);(0,w.useEffect)(()=>{if(!e)return;let t=async()=>{try{d((await p(`/tasks/${e}`)).task),L(null)}catch(e){L(e instanceof Error?e.message:`Failed to load task`)}};t(),p(`/tasks/${e}/plan`).then(e=>E(e.plans)).catch(()=>E([])),p(`/tasks/${e}/logs?limit=200`).then(e=>j(e.logs)).catch(()=>j([])),f(e).then(e=>N(e)).catch(()=>N([]));let n=setInterval(t,3e3);return()=>clearInterval(n)},[e]),(0,w.useEffect)(()=>{if(!c?.roleId||!e)return;let t=!1;return p(`/roles/${c.roleId}/scores?limit=100`).then(n=>{t||F(n.scores.find(t=>t.taskId===e)??null)}).catch(()=>{t||F(null)}),()=>{t=!0}},[c?.roleId,e]);let B=async()=>{if(e){z(!0);try{await p(`/tasks/${e}/cancel`,{method:`POST`}),d(e=>e&&{...e,status:`cancelled`})}finally{z(!1)}}};if(I)return(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsxs)(u,{to:`/work`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,T.jsx)(t,{size:14}),` Back to Tasks`]}),(0,T.jsx)(y,{className:`text-center text-red-400`,children:I})]});if(!c)return(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsxs)(u,{to:`/work`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,T.jsx)(t,{size:14}),` Back to Tasks`]}),(0,T.jsx)(y,{className:`text-center text-slate-500`,children:`Loading...`})]});let V=[`running`,`queued`,`pending`,`paused`].includes(c.status);return(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,T.jsxs)(u,{to:`/work`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,T.jsx)(t,{size:14}),` Back to Tasks`]}),V&&(0,T.jsxs)(m,{variant:`destructive`,size:`sm`,onClick:()=>void B(),disabled:R,children:[(0,T.jsx)(o,{size:14}),R?`Cancelling...`:`Cancel Task`]})]}),(0,T.jsx)(y,{children:(0,T.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,T.jsx)(g,{variant:h(c.status),children:c.status}),(0,T.jsx)(`span`,{className:`font-mono text-xs text-slate-500`,children:c.id})]}),(0,T.jsx)(`p`,{className:`text-sm text-slate-200 whitespace-pre-wrap`,children:c.prompt})]})})}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,T.jsx)(A,{icon:r,label:`Created`,value:x(c.createdAt)}),(0,T.jsx)(A,{icon:r,label:`Duration`,value:c.totalDurationMs?S(c.totalDurationMs):c.startedAt?S(Date.now()-c.startedAt):`—`}),(0,T.jsx)(A,{icon:n,label:`Cost`,value:c.costUsd==null?`—`:C(c.costUsd)}),(0,T.jsx)(A,{icon:a,label:`Turns`,value:String(c.numTurns??`—`)})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,T.jsx)(A,{icon:s,label:`Role`,value:c.roleId??`—`,mono:!0}),(0,T.jsx)(A,{icon:i,label:`Parent`,value:c.parentId??`—`,mono:!0}),c.templateId?(0,T.jsxs)(u,{to:`/work`,className:`block`,children:[(0,T.jsx)(A,{icon:i,label:`Template`,value:c.templateId,mono:!0}),(0,T.jsx)(`span`,{className:`mt-0.5 block text-xs text-blue-400 hover:text-blue-300`,children:`View in Automations →`})]}):(0,T.jsx)(A,{icon:i,label:`Template`,value:`—`,mono:!0}),c.sourceSessionId&&(0,T.jsx)(A,{icon:a,label:`Source Session`,value:c.sourceSessionId.slice(0,8),mono:!0})]}),(c.deliverTo||c.reportTo)&&(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:(0,T.jsx)(v,{children:`Delivery Targets`})}),(0,T.jsxs)(`div`,{className:`space-y-3`,children:[c.deliverTo&&c.deliverTo.length>0&&(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`p`,{className:`text-xs text-slate-500 mb-1`,children:`Output`}),(0,T.jsx)(`div`,{className:`space-y-1`,children:c.deliverTo.map((e,t)=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-slate-300`,children:[(0,T.jsx)(g,{variant:`outline`,children:e.type===`channel`?`Channel`:`Session`}),e.type===`channel`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`font-mono text-xs`,children:e.channelId.slice(0,8)}),e.chatId&&(0,T.jsxs)(`span`,{className:`text-xs text-slate-500`,children:[`chat: `,e.chatId.slice(0,8)]})]}):(0,T.jsxs)(`span`,{className:`text-xs text-slate-400`,children:[`session `,e.sessionId?.slice(0,8)]})]},`d-${t}`))})]}),c.reportTo&&c.reportTo.length>0&&(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`p`,{className:`text-xs text-slate-500 mb-1`,children:`Status Reports`}),(0,T.jsx)(`div`,{className:`space-y-1`,children:c.reportTo.map((e,t)=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-slate-300`,children:[(0,T.jsx)(g,{variant:`outline`,children:e.type===`channel`?`Channel`:`Session`}),e.type===`channel`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`font-mono text-xs`,children:e.channelId.slice(0,8)}),e.chatId&&(0,T.jsxs)(`span`,{className:`text-xs text-slate-500`,children:[`chat: `,e.chatId.slice(0,8)]})]}):(0,T.jsxs)(`span`,{className:`text-xs text-slate-400`,children:[`session `,e.sessionId?.slice(0,8)]})]},`r-${t}`))})]})]})]}),P&&(c.status===`completed`||c.status===`failed`)&&(0,T.jsx)(k,{score:P}),c.tokenUsage&&(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:(0,T.jsx)(v,{children:`Token Usage`})}),(0,T.jsxs)(`div`,{className:`flex gap-6 text-sm`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`text-slate-500`,children:`Input:`}),` `,(0,T.jsx)(`span`,{className:`font-mono text-slate-200`,children:c.tokenUsage.input.toLocaleString()})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`text-slate-500`,children:`Output:`}),` `,(0,T.jsx)(`span`,{className:`font-mono text-slate-200`,children:c.tokenUsage.output.toLocaleString()})]})]})]}),b.length>0&&(()=>{let e=b[0],t=e.plan.overallRisk===`high`?`destructive`:e.plan.overallRisk===`medium`?`warning`:`secondary`;return(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(v,{children:`Execution Plan`}),(0,T.jsxs)(g,{variant:t,children:[e.plan.overallRisk.toUpperCase(),` RISK`]}),(0,T.jsx)(g,{variant:`outline`,children:e.status})]})}),(0,T.jsxs)(`h4`,{className:`text-sm font-medium text-slate-300 mb-2`,children:[`Plan Steps (`,e.plan.steps.length,`)`]}),(0,T.jsx)(`div`,{className:`space-y-2`,children:e.plan.steps.map(e=>(0,T.jsxs)(`div`,{className:`rounded-md border border-slate-700 bg-slate-800/50 p-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`span`,{className:`text-xs font-mono text-slate-500`,children:[`#`,e.index]}),(0,T.jsx)(`span`,{className:`text-sm text-slate-200`,children:e.description})]}),(0,T.jsx)(g,{variant:e.riskLevel===`high`?`destructive`:e.riskLevel===`medium`?`warning`:`secondary`,children:e.riskLevel})]}),(0,T.jsxs)(`div`,{className:`mt-1 text-xs text-slate-400`,children:[`Tools: `,e.toolsNeeded.join(`, `)||`none`]}),e.expectedOutput&&(0,T.jsxs)(`div`,{className:`mt-0.5 text-xs text-slate-500`,children:[`Expected: `,e.expectedOutput]})]},e.index))}),Object.keys(e.plan.requiredPermissions).length>0&&(0,T.jsxs)(`div`,{className:`mt-2`,children:[(0,T.jsx)(`p`,{className:`text-sm font-medium text-slate-300 mb-1`,children:`Required Permissions`}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.keys(e.plan.requiredPermissions).map(e=>(0,T.jsx)(g,{variant:`secondary`,children:e},e))})]}),e.deviationReport&&(0,T.jsxs)(`div`,{className:`mt-3 rounded-md border border-amber-900/50 bg-amber-950/20 p-3`,children:[(0,T.jsx)(`p`,{className:`text-sm font-medium text-amber-400 mb-2`,children:`Deviation Report`}),(0,T.jsxs)(`div`,{className:`text-xs text-slate-400 mb-2`,children:[`Planned: `,e.deviationReport.stepsPlanned,` | Executed: `,e.deviationReport.stepsExecuted,` | Accuracy: `,(e.deviationReport.overallAccuracy*100).toFixed(0),`%`]}),e.deviationReport.deviations.length>0&&(0,T.jsx)(`div`,{className:`space-y-1`,children:e.deviationReport.deviations.map((e,t)=>(0,T.jsxs)(`div`,{className:`text-xs`,children:[(0,T.jsxs)(`span`,{className:`text-amber-400 font-mono`,children:[`[`,e.deviationType,`]`]}),(0,T.jsxs)(`span`,{className:`text-slate-400`,children:[` Step `,e.stepIndex,`: `]}),(0,T.jsx)(`span`,{className:`text-slate-300`,children:e.actual})]},t))})]}),e.learnedRules&&e.learnedRules.length>0&&(0,T.jsxs)(`div`,{className:`mt-3`,children:[(0,T.jsx)(`p`,{className:`text-sm font-medium text-slate-300 mb-2`,children:`Learned Rules`}),(0,T.jsx)(`ul`,{className:`space-y-1`,children:e.learnedRules.map((e,t)=>(0,T.jsxs)(`li`,{className:`text-xs text-slate-400 flex items-start gap-1.5`,children:[(0,T.jsx)(`span`,{className:`text-blue-400 mt-0.5`,children:`*`}),e]},t))})]})]})})(),O.length>0&&(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:(0,T.jsxs)(v,{children:[`Execution Timeline (`,O.length,` steps)`]})}),(0,T.jsx)(D,{logs:O})]}),c.result&&(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:(0,T.jsx)(v,{children:`Result`})}),(0,T.jsx)(`pre`,{className:`max-h-96 overflow-auto whitespace-pre-wrap rounded-md bg-slate-800 p-3 font-mono text-xs text-slate-300`,children:c.result})]}),c.error&&(()=>{let e=[`plugin`,`--plugin-dir`,`failed to load plugin`],t=c.error.toLowerCase(),n=e.some(e=>t.includes(e)),r=n?c.error.split(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{$ as t,B as n,H as r,M as i,N as a,U as o,i as s,nt as c}from"./vendor-icons-CkI4-NxL.js";import{d as l,r as u,t as d}from"./vendor-react-DLRtONKt.js";import{i as f,r as p}from"./dist-HyCSN_hp.js";import{f as m,n as h,t as g}from"./index-rvaixveh.js";import{n as _,r as v,t as y}from"./Card-4mOZntHG.js";import{a as b,n as x,r as S,t as C}from"./format-DvtQjPZn.js";var w=e(c(),1),T=d(),E={reasoning:`bg-blue-500`,tool_call:`bg-blue-400`,tool_result:`bg-green-500`,approval_request:`bg-yellow-500`,approval_response:`bg-yellow-400`,permission_denied:`bg-orange-500`,error:`bg-red-500`,plugin_error:`bg-red-600`};function D({logs:e}){let[t,n]=(0,w.useState)(new Set);return e.length===0?(0,T.jsx)(`p`,{className:`text-sm text-slate-500`,children:`No execution steps yet.`}):(0,T.jsx)(`div`,{className:`space-y-0`,children:e.map((r,i)=>{let a=i>0?e[i-1].timestamp:null,o=a?r.timestamp-a:null,s=r.type===`plugin_error`,c=t.has(i)?r.content:r.content.length>200?r.content.slice(0,200)+`...`:r.content;return(0,T.jsxs)(`div`,{className:`flex gap-3`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,T.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full mt-1.5 flex-shrink-0 ${E[r.type]??`bg-slate-500`} ${s?`ring-2 ring-red-400`:``}`}),i<e.length-1&&(0,T.jsx)(`div`,{className:`w-0.5 flex-1 bg-slate-700 mt-0.5`})]}),(0,T.jsxs)(`div`,{className:`flex-1 pb-4 ${s?`border border-red-500/40 rounded-md bg-red-950/10 p-2`:``}`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,T.jsxs)(`span`,{className:`text-xs font-mono text-slate-500`,children:[`#`,r.index]}),(0,T.jsx)(`span`,{className:`text-sm font-medium text-slate-200`,children:r.toolName??r.type}),s&&(0,T.jsx)(g,{variant:`destructive`,children:`Plugin Error`}),(0,T.jsx)(`span`,{className:`text-xs text-slate-500`,children:b(r.timestamp)}),o!=null&&o>0&&(0,T.jsxs)(`span`,{className:`text-xs text-slate-600`,children:[`+`,o,`ms`]}),r.truncated&&(0,T.jsx)(g,{variant:`outline`,children:`truncated`})]}),c&&(0,T.jsx)(`button`,{className:`mt-1 text-xs text-slate-400 hover:text-slate-300 text-left w-full font-mono`,onClick:()=>{n(e=>{let t=new Set(e);return t.has(i)?t.delete(i):t.add(i),t})},children:c})]})]},r.id)})})}function O(){let{id:e}=l(),[c,d]=(0,w.useState)(null),[b,E]=(0,w.useState)([]),[O,j]=(0,w.useState)([]),[M,N]=(0,w.useState)([]),[P,F]=(0,w.useState)(null),[I,L]=(0,w.useState)(null),[R,z]=(0,w.useState)(!1);(0,w.useEffect)(()=>{if(!e)return;let t=async()=>{try{d((await p(`/tasks/${e}`)).task),L(null)}catch(e){L(e instanceof Error?e.message:`Failed to load task`)}};t(),p(`/tasks/${e}/plan`).then(e=>E(e.plans)).catch(()=>E([])),p(`/tasks/${e}/logs?limit=200`).then(e=>j(e.logs)).catch(()=>j([])),f(e).then(e=>N(e)).catch(()=>N([]));let n=setInterval(t,3e3);return()=>clearInterval(n)},[e]),(0,w.useEffect)(()=>{if(!c?.roleId||!e)return;let t=!1;return p(`/roles/${c.roleId}/scores?limit=100`).then(n=>{t||F(n.scores.find(t=>t.taskId===e)??null)}).catch(()=>{t||F(null)}),()=>{t=!0}},[c?.roleId,e]);let B=async()=>{if(e){z(!0);try{await p(`/tasks/${e}/cancel`,{method:`POST`}),d(e=>e&&{...e,status:`cancelled`})}finally{z(!1)}}};if(I)return(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsxs)(u,{to:`/work`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,T.jsx)(t,{size:14}),` Back to Tasks`]}),(0,T.jsx)(y,{className:`text-center text-red-400`,children:I})]});if(!c)return(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsxs)(u,{to:`/work`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,T.jsx)(t,{size:14}),` Back to Tasks`]}),(0,T.jsx)(y,{className:`text-center text-slate-500`,children:`Loading...`})]});let V=[`running`,`queued`,`pending`,`paused`].includes(c.status);return(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,T.jsxs)(u,{to:`/work`,className:`flex items-center gap-1.5 text-sm text-slate-400 hover:text-slate-200`,children:[(0,T.jsx)(t,{size:14}),` Back to Tasks`]}),V&&(0,T.jsxs)(m,{variant:`destructive`,size:`sm`,onClick:()=>void B(),disabled:R,children:[(0,T.jsx)(o,{size:14}),R?`Cancelling...`:`Cancel Task`]})]}),(0,T.jsx)(y,{children:(0,T.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,T.jsx)(g,{variant:h(c.status),children:c.status}),(0,T.jsx)(`span`,{className:`font-mono text-xs text-slate-500`,children:c.id})]}),(0,T.jsx)(`p`,{className:`text-sm text-slate-200 whitespace-pre-wrap`,children:c.prompt})]})})}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,T.jsx)(A,{icon:r,label:`Created`,value:x(c.createdAt)}),(0,T.jsx)(A,{icon:r,label:`Duration`,value:c.totalDurationMs?S(c.totalDurationMs):c.startedAt?S(Date.now()-c.startedAt):`—`}),(0,T.jsx)(A,{icon:n,label:`Cost`,value:c.costUsd==null?`—`:C(c.costUsd)}),(0,T.jsx)(A,{icon:a,label:`Turns`,value:String(c.numTurns??`—`)})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,T.jsx)(A,{icon:s,label:`Role`,value:c.roleId??`—`,mono:!0}),(0,T.jsx)(A,{icon:i,label:`Parent`,value:c.parentId??`—`,mono:!0}),c.templateId?(0,T.jsxs)(u,{to:`/work`,className:`block`,children:[(0,T.jsx)(A,{icon:i,label:`Template`,value:c.templateId,mono:!0}),(0,T.jsx)(`span`,{className:`mt-0.5 block text-xs text-blue-400 hover:text-blue-300`,children:`View in Automations →`})]}):(0,T.jsx)(A,{icon:i,label:`Template`,value:`—`,mono:!0}),c.sourceSessionId&&(0,T.jsx)(A,{icon:a,label:`Source Session`,value:c.sourceSessionId.slice(0,8),mono:!0})]}),(c.deliverTo||c.reportTo)&&(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:(0,T.jsx)(v,{children:`Delivery Targets`})}),(0,T.jsxs)(`div`,{className:`space-y-3`,children:[c.deliverTo&&c.deliverTo.length>0&&(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`p`,{className:`text-xs text-slate-500 mb-1`,children:`Output`}),(0,T.jsx)(`div`,{className:`space-y-1`,children:c.deliverTo.map((e,t)=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-slate-300`,children:[(0,T.jsx)(g,{variant:`outline`,children:e.type===`channel`?`Channel`:`Session`}),e.type===`channel`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`font-mono text-xs`,children:e.channelId.slice(0,8)}),e.chatId&&(0,T.jsxs)(`span`,{className:`text-xs text-slate-500`,children:[`chat: `,e.chatId.slice(0,8)]})]}):(0,T.jsxs)(`span`,{className:`text-xs text-slate-400`,children:[`session `,e.sessionId?.slice(0,8)]})]},`d-${t}`))})]}),c.reportTo&&c.reportTo.length>0&&(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`p`,{className:`text-xs text-slate-500 mb-1`,children:`Status Reports`}),(0,T.jsx)(`div`,{className:`space-y-1`,children:c.reportTo.map((e,t)=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-slate-300`,children:[(0,T.jsx)(g,{variant:`outline`,children:e.type===`channel`?`Channel`:`Session`}),e.type===`channel`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`font-mono text-xs`,children:e.channelId.slice(0,8)}),e.chatId&&(0,T.jsxs)(`span`,{className:`text-xs text-slate-500`,children:[`chat: `,e.chatId.slice(0,8)]})]}):(0,T.jsxs)(`span`,{className:`text-xs text-slate-400`,children:[`session `,e.sessionId?.slice(0,8)]})]},`r-${t}`))})]})]})]}),P&&(c.status===`completed`||c.status===`failed`)&&(0,T.jsx)(k,{score:P}),c.tokenUsage&&(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:(0,T.jsx)(v,{children:`Token Usage`})}),(0,T.jsxs)(`div`,{className:`flex gap-6 text-sm`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`text-slate-500`,children:`Input:`}),` `,(0,T.jsx)(`span`,{className:`font-mono text-slate-200`,children:c.tokenUsage.input.toLocaleString()})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`text-slate-500`,children:`Output:`}),` `,(0,T.jsx)(`span`,{className:`font-mono text-slate-200`,children:c.tokenUsage.output.toLocaleString()})]})]})]}),b.length>0&&(()=>{let e=b[0],t=e.plan.overallRisk===`high`?`destructive`:e.plan.overallRisk===`medium`?`warning`:`secondary`;return(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(v,{children:`Execution Plan`}),(0,T.jsxs)(g,{variant:t,children:[e.plan.overallRisk.toUpperCase(),` RISK`]}),(0,T.jsx)(g,{variant:`outline`,children:e.status})]})}),(0,T.jsxs)(`h4`,{className:`text-sm font-medium text-slate-300 mb-2`,children:[`Plan Steps (`,e.plan.steps.length,`)`]}),(0,T.jsx)(`div`,{className:`space-y-2`,children:e.plan.steps.map(e=>(0,T.jsxs)(`div`,{className:`rounded-md border border-slate-700 bg-slate-800/50 p-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`span`,{className:`text-xs font-mono text-slate-500`,children:[`#`,e.index]}),(0,T.jsx)(`span`,{className:`text-sm text-slate-200`,children:e.description})]}),(0,T.jsx)(g,{variant:e.riskLevel===`high`?`destructive`:e.riskLevel===`medium`?`warning`:`secondary`,children:e.riskLevel})]}),(0,T.jsxs)(`div`,{className:`mt-1 text-xs text-slate-400`,children:[`Tools: `,e.toolsNeeded.join(`, `)||`none`]}),e.expectedOutput&&(0,T.jsxs)(`div`,{className:`mt-0.5 text-xs text-slate-500`,children:[`Expected: `,e.expectedOutput]})]},e.index))}),Object.keys(e.plan.requiredPermissions).length>0&&(0,T.jsxs)(`div`,{className:`mt-2`,children:[(0,T.jsx)(`p`,{className:`text-sm font-medium text-slate-300 mb-1`,children:`Required Permissions`}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.keys(e.plan.requiredPermissions).map(e=>(0,T.jsx)(g,{variant:`secondary`,children:e},e))})]}),e.deviationReport&&(0,T.jsxs)(`div`,{className:`mt-3 rounded-md border border-amber-900/50 bg-amber-950/20 p-3`,children:[(0,T.jsx)(`p`,{className:`text-sm font-medium text-amber-400 mb-2`,children:`Deviation Report`}),(0,T.jsxs)(`div`,{className:`text-xs text-slate-400 mb-2`,children:[`Planned: `,e.deviationReport.stepsPlanned,` | Executed: `,e.deviationReport.stepsExecuted,` | Accuracy: `,(e.deviationReport.overallAccuracy*100).toFixed(0),`%`]}),e.deviationReport.deviations.length>0&&(0,T.jsx)(`div`,{className:`space-y-1`,children:e.deviationReport.deviations.map((e,t)=>(0,T.jsxs)(`div`,{className:`text-xs`,children:[(0,T.jsxs)(`span`,{className:`text-amber-400 font-mono`,children:[`[`,e.deviationType,`]`]}),(0,T.jsxs)(`span`,{className:`text-slate-400`,children:[` Step `,e.stepIndex,`: `]}),(0,T.jsx)(`span`,{className:`text-slate-300`,children:e.actual})]},t))})]}),e.learnedRules&&e.learnedRules.length>0&&(0,T.jsxs)(`div`,{className:`mt-3`,children:[(0,T.jsx)(`p`,{className:`text-sm font-medium text-slate-300 mb-2`,children:`Learned Rules`}),(0,T.jsx)(`ul`,{className:`space-y-1`,children:e.learnedRules.map((e,t)=>(0,T.jsxs)(`li`,{className:`text-xs text-slate-400 flex items-start gap-1.5`,children:[(0,T.jsx)(`span`,{className:`text-blue-400 mt-0.5`,children:`*`}),e]},t))})]})]})})(),O.length>0&&(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:(0,T.jsxs)(v,{children:[`Execution Timeline (`,O.length,` steps)`]})}),(0,T.jsx)(D,{logs:O})]}),c.result&&(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:(0,T.jsx)(v,{children:`Result`})}),(0,T.jsx)(`pre`,{className:`max-h-96 overflow-auto whitespace-pre-wrap rounded-md bg-slate-800 p-3 font-mono text-xs text-slate-300`,children:c.result})]}),c.error&&(()=>{let e=[`plugin`,`--plugin-dir`,`failed to load plugin`],t=c.error.toLowerCase(),n=e.some(e=>t.includes(e)),r=n?c.error.split(`
|
|
2
2
|
`).find(t=>e.some(e=>t.toLowerCase().includes(e))):null;return(0,T.jsxs)(y,{className:n?`border-red-500`:``,children:[(0,T.jsx)(_,{children:(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(v,{children:`Error`}),n&&(0,T.jsx)(g,{variant:`warning`,children:`Plugin Issue`})]})}),n&&r&&(0,T.jsx)(`div`,{className:`mb-2 rounded bg-amber-950/30 px-2 py-1 text-xs text-amber-400`,children:r}),(0,T.jsx)(`pre`,{className:`max-h-96 overflow-auto whitespace-pre-wrap rounded-md bg-red-950/30 p-3 font-mono text-xs text-red-400`,children:c.error})]})})(),M.length>0&&(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:(0,T.jsxs)(v,{children:[`Delivery Status (`,M.length,`)`]})}),(0,T.jsx)(`div`,{className:`space-y-2`,children:M.map(e=>{let t=e.status===`delivered`?`default`:e.status===`pending`?`secondary`:`destructive`,n=e.target.type===`webhook`?e.target.webhookUrl:e.target.type===`channel`?`channel ${e.target.channelId.slice(0,8)}`:`session ${e.target.sessionId?.slice(0,8)}`;return(0,T.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,T.jsx)(g,{variant:t,className:`mt-0.5 shrink-0`,children:e.status}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-slate-400`,children:[(0,T.jsx)(`span`,{className:`text-xs font-mono truncate`,children:n}),e.messageType&&(0,T.jsxs)(`span`,{className:`text-xs text-slate-600`,children:[`(`,e.messageType,`)`]})]}),e.error&&(0,T.jsx)(`p`,{className:`text-xs text-red-400 mt-0.5`,children:e.error}),(0,T.jsxs)(`p`,{className:`text-xs text-slate-600 mt-0.5`,children:[x(e.createdAt),e.deliveredAt&&` \u2192 ${x(e.deliveredAt)}`]})]})]},e.id)})})]})]})}function k({score:e}){let t=[{label:`Task Success`,value:e.scores.taskSuccess,weight:`30%`},{label:`Plan Accuracy`,value:e.scores.planAccuracy,weight:`25%`},{label:`Permission Compliance`,value:e.scores.permissionCompliance,weight:`25%`},{label:`Efficiency`,value:e.scores.efficiency,weight:`20%`}];return(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:(0,T.jsx)(v,{children:`Quality Score`})}),(0,T.jsxs)(`div`,{className:`space-y-3`,children:[t.map(e=>(0,T.jsxs)(`div`,{children:[(0,T.jsxs)(`div`,{className:`mb-1 flex items-center justify-between text-xs`,children:[(0,T.jsxs)(`span`,{className:`text-slate-400`,children:[e.label,` `,(0,T.jsxs)(`span`,{className:`text-slate-600`,children:[`(`,e.weight,`)`]})]}),(0,T.jsxs)(`span`,{className:`font-mono text-slate-300`,children:[(e.value*100).toFixed(0),`%`]})]}),(0,T.jsx)(`div`,{className:`h-1.5 w-full rounded-full bg-slate-800`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full ${e.value<.4?`bg-red-500`:`bg-blue-600`}`,style:{width:`${e.value*100}%`}})})]},e.label)),(0,T.jsxs)(`div`,{className:`mt-2 flex items-center justify-between border-t border-slate-800 pt-2`,children:[(0,T.jsx)(`span`,{className:`text-sm text-slate-300`,children:`Weighted Score`}),(0,T.jsxs)(`span`,{className:`font-mono text-sm font-semibold text-slate-100`,children:[(e.scores.weighted*100).toFixed(0),`%`]})]}),(0,T.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,T.jsx)(`span`,{className:`text-sm text-slate-300`,children:`EMA (after this task)`}),(0,T.jsxs)(`span`,{className:`font-mono text-sm font-semibold ${e.emaScore<.4?`text-red-400`:`text-emerald-400`}`,children:[(e.emaScore*100).toFixed(0),`%`]})]})]})]})}function A({icon:e,label:t,value:n,mono:r}){return(0,T.jsxs)(y,{className:`flex flex-col gap-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-1.5 text-slate-500`,children:[(0,T.jsx)(e,{size:12}),(0,T.jsx)(`span`,{className:`text-xs`,children:t})]}),(0,T.jsx)(`span`,{className:`text-sm text-slate-200 truncate ${r?`font-mono text-xs`:``}`,children:n})]})}export{O as TaskDetail};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{I as t,S as n,U as r,X as i,h as a,k as o,nt as s,o as c,v as l,x as u}from"./vendor-icons-CkI4-NxL.js";import{r as d,t as f}from"./vendor-react-DLRtONKt.js";import{n as p,r as m}from"./dist-HyCSN_hp.js";import{C as h,S as g,_,a as v,b as y,c as b,f as x,g as S,h as C,i as w,l as T,m as ee,n as E,o as D,p as O,r as te,s as ne,t as re,u as ie,v as k,w as A,x as j}from"./index-oA-kWqT5.js";import{t as M}from"./Card-4mOZntHG.js";import{a as ae,o as oe,t as se}from"./format-DvtQjPZn.js";import{t as ce}from"./EmptyState-BlgMMAr-.js";import{a as le,i as N,n as ue,o as P,r as F,t as de}from"./Table-BxbnOSbq.js";import{Goals as I,t as fe}from"./Goals-7eD9_7Qo.js";import{t as pe}from"./Switch-B05Q1L98.js";var L=e(s(),1),R=f();function z(e){let t=e+`CollectionProvider`,[n,r]=g(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=L.useRef(null),a=L.useRef(new Map).current;return(0,R.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=S(s),l=L.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,R.jsx)(c,{ref:j(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=S(u),p=L.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=L.useRef(null),s=j(t,o),c=a(u,n);return L.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,R.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return L.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var B=L.createContext(void 0);function V(e){let t=L.useContext(B);return e||t||`ltr`}var H=`rovingFocusGroup.onEntryFocus`,U={bubbles:!1,cancelable:!0},W=`RovingFocusGroup`,[G,K,me]=z(W),[q,he]=g(W,[me]),[ge,_e]=q(W),J=L.forwardRef((e,t)=>(0,R.jsx)(G.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(G.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(ve,{...e,ref:t})})}));J.displayName=W;var ve=L.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=L.useRef(null),p=j(t,f),m=V(a),[h,g]=_({prop:o,defaultProp:s??null,onChange:c,caller:W}),[v,b]=L.useState(!1),x=ee(l),S=K(n),w=L.useRef(!1),[T,E]=L.useState(0);return L.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(H,x),()=>e.removeEventListener(H,x)},[x]),(0,R.jsx)(ge,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:L.useCallback(e=>g(e),[g]),onItemShiftTab:L.useCallback(()=>b(!0),[]),onFocusableItemAdd:L.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:L.useCallback(()=>E(e=>e-1),[]),children:(0,R.jsx)(C.div,{tabIndex:v||T===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:y(e.onMouseDown,()=>{w.current=!0}),onFocus:y(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(H,U);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);Z([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}w.current=!1}),onBlur:y(e.onBlur,()=>b(!1))})})}),ye=`RovingFocusGroupItem`,be=L.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=k(),l=a||c,u=_e(ye,n),d=u.currentTabStopId===l,f=K(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return L.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,R.jsx)(G.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,R.jsx)(C.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:y(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:y(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:y(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=X(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Se(n,r+1):n.slice(r+1)}setTimeout(()=>Z(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});be.displayName=ye;var Y={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function xe(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function X(e,t,n){let r=xe(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Y[r]}function Z(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Se(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Ce=J,we=be,Q=`Tabs`,[Te,Ee]=g(Q,[he]),De=he(),[Oe,ke]=Te(Q),Ae=L.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=V(s),[d,f]=_({prop:r,onChange:i,defaultProp:a??``,caller:Q});return(0,R.jsx)(Oe,{scope:n,baseId:k(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,R.jsx)(C.div,{dir:u,"data-orientation":o,...l,ref:t})})});Ae.displayName=Q;var je=`TabsList`,Me=L.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=ke(je,n),o=De(n);return(0,R.jsx)(Ce,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,R.jsx)(C.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Me.displayName=je;var Ne=`TabsTrigger`,Pe=L.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=ke(Ne,n),s=De(n),c=Le(o.baseId,r),l=Re(o.baseId,r),u=r===o.value;return(0,R.jsx)(we,{asChild:!0,...s,focusable:!i,active:u,children:(0,R.jsx)(C.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:y(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:y(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:y(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Pe.displayName=Ne;var Fe=`TabsContent`,Ie=L.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=ke(Fe,n),c=Le(s.baseId,r),l=Re(s.baseId,r),u=r===s.value,d=L.useRef(u);return L.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,R.jsx)(O,{present:i||u,children:({present:n})=>(0,R.jsx)(C.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Ie.displayName=Fe;function Le(e,t){return`${e}-trigger-${t}`}function Re(e,t){return`${e}-content-${t}`}var ze=Ae,Be=Me,Ve=Pe,He=Ie,Ue=ze,We=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Be,{ref:n,className:p(`inline-flex h-9 items-center justify-center rounded-lg bg-slate-800/50 p-1 text-slate-400`,e),...t}));We.displayName=Be.displayName;var Ge=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Ve,{ref:n,className:p(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-slate-950 transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-slate-900 data-[state=active]:text-slate-100 data-[state=active]:shadow`,e),...t}));Ge.displayName=Ve.displayName;var Ke=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(He,{ref:n,className:p(`mt-2 ring-offset-slate-950 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2`,e),...t}));Ke.displayName=He.displayName;var qe=[{label:`All`,value:`all`},{label:`Running`,value:`running`},{label:`Pending`,value:`pending`},{label:`Completed`,value:`completed`},{label:`Failed`,value:`failed`},{label:`Cancelled`,value:`cancelled`}],$=new Set([`pending`,`queued`,`running`,`paused`]);function Je(){let e=h(e=>e.tasks),t=h(e=>e.fetchTasks),[n,s]=(0,L.useState)(`all`),[c,u]=(0,L.useState)(!1),[f,p]=(0,L.useState)(``),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(new Set),[b,S]=(0,L.useState)(!1);(0,L.useEffect)(()=>{let e=n===`all`?void 0:n;t(e);let r=setInterval(()=>void t(e),5e3);return()=>clearInterval(r)},[t,n]),(0,L.useEffect)(()=>{y(new Set)},[n]);let C=async()=>{if(f.trim()){_(!0);try{await m(`/tasks`,{method:`POST`,body:JSON.stringify({prompt:f.trim()})}),p(``),u(!1),t(n===`all`?void 0:n)}finally{_(!1)}}},w=e=>{y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},T=()=>{let e=D.filter(e=>$.has(e.status)).map(e=>e.id);y(new Set(e))},ee=async()=>{if(v.size!==0){S(!0);try{await m(`/tasks/batch-cancel`,{method:`POST`,body:JSON.stringify({taskIds:Array.from(v)})}),y(new Set),t(n===`all`?void 0:n)}finally{S(!1)}}},D=[...e].sort((e,t)=>t.createdAt-e.createdAt),O=Array.from(v).filter(t=>{let n=e.find(e=>e.id===t);return n&&$.has(n.status)});return(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Tasks`}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[v.size>0&&(0,R.jsxs)(x,{variant:`destructive`,size:`sm`,onClick:()=>void ee(),disabled:b||O.length===0,children:[(0,R.jsx)(r,{size:14}),b?`Cancelling...`:`Cancel ${O.length} task${O.length===1?``:`s`}`]}),(0,R.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>void t(n===`all`?void 0:n),children:(0,R.jsx)(a,{size:14})}),(0,R.jsxs)(x,{size:`sm`,onClick:()=>u(!c),children:[(0,R.jsx)(l,{size:14}),`New Task`]})]})]}),c&&(0,R.jsxs)(M,{className:`flex gap-2`,children:[(0,R.jsx)(`input`,{className:`flex-1 rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Enter task prompt...`,value:f,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&C()}}),(0,R.jsx)(x,{onClick:()=>void C(),disabled:g||!f.trim(),children:g?`Creating...`:`Create`}),(0,R.jsx)(x,{variant:`ghost`,onClick:()=>u(!1),children:`Cancel`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`div`,{className:`flex gap-1.5`,children:qe.map(e=>(0,R.jsx)(`button`,{onClick:()=>s(e.value),className:`rounded-md px-2.5 py-1 text-xs font-medium transition-colors ${n===e.value?`bg-slate-800 text-slate-100`:`text-slate-500 hover:text-slate-300`}`,children:e.label},e.value))}),D.some(e=>$.has(e.status))&&(0,R.jsx)(`button`,{onClick:T,className:`text-xs text-slate-500 hover:text-slate-300`,children:`Select all cancellable`}),v.size>0&&(0,R.jsxs)(`button`,{onClick:()=>y(new Set),className:`text-xs text-slate-500 hover:text-slate-300`,children:[`Clear selection (`,v.size,`)`]})]}),(0,R.jsx)(M,{padding:!1,children:D.length===0?(0,R.jsx)(ce,{icon:(0,R.jsx)(o,{size:32}),title:`No tasks found`,description:n===`all`?`Create a task to get started`:`No tasks with status "${n}"`}):(0,R.jsxs)(de,{children:[(0,R.jsx)(le,{children:(0,R.jsxs)(P,{children:[(0,R.jsx)(N,{className:`w-8`,children:(0,R.jsx)(`button`,{onClick:()=>{v.size>0&&v.size===D.filter(e=>$.has(e.status)).length?y(new Set):T()},className:`flex h-4 w-4 items-center justify-center rounded border transition-colors ${v.size>0&&v.size===D.filter(e=>$.has(e.status)).length?`border-blue-600 bg-blue-600 text-white`:`border-slate-600 bg-transparent hover:border-slate-400`}`,children:v.size>0&&v.size===D.filter(e=>$.has(e.status)).length&&(0,R.jsx)(i,{size:12})})}),(0,R.jsx)(N,{children:`ID`}),(0,R.jsx)(N,{children:`Prompt`}),(0,R.jsx)(N,{children:`Status`}),(0,R.jsx)(N,{children:`Role`}),(0,R.jsx)(N,{children:`Cost`}),(0,R.jsx)(N,{children:`Created`})]})}),(0,R.jsx)(ue,{children:D.map(e=>(0,R.jsxs)(P,{className:v.has(e.id)?`bg-slate-800/50`:``,children:[(0,R.jsx)(F,{children:$.has(e.status)?(0,R.jsx)(`button`,{onClick:()=>w(e.id),className:`flex h-4 w-4 items-center justify-center rounded border transition-colors ${v.has(e.id)?`border-blue-600 bg-blue-600 text-white`:`border-slate-600 bg-transparent hover:border-slate-400`}`,children:v.has(e.id)&&(0,R.jsx)(i,{size:12})}):(0,R.jsx)(`span`,{className:`inline-block w-4`})}),(0,R.jsx)(F,{children:(0,R.jsx)(d,{to:`/tasks/${e.id}`,className:`font-mono text-xs text-blue-400 hover:text-blue-300`,children:e.id.slice(0,8)})}),(0,R.jsx)(F,{children:oe(e.prompt,80)}),(0,R.jsx)(F,{children:(0,R.jsx)(re,{variant:E(e.status),children:e.status})}),(0,R.jsx)(F,{children:(0,R.jsx)(`span`,{className:`font-mono text-xs text-slate-500`,children:e.roleId?e.roleId.slice(0,12):`—`})}),(0,R.jsx)(F,{className:`font-mono text-xs`,children:e.costUsd==null?`—`:se(e.costUsd)}),(0,R.jsx)(F,{className:`text-xs text-slate-500`,children:ae(e.createdAt)})]},e.id))})]})})]})}function Ye(){let e=h(e=>e.templates),r=h(e=>e.fetchTemplates),i=h(e=>e.goals),o=h(e=>e.fetchGoals),[s,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(``),[g,_]=(0,L.useState)(`manual`),[y,S]=(0,L.useState)(``),[C,ee]=(0,L.useState)(``),[E,O]=(0,L.useState)(``),[k,j]=(0,L.useState)(!1),[oe,se]=(0,L.useState)(null),[I,z]=(0,L.useState)(null),[B,V]=(0,L.useState)(null),[H,U]=(0,L.useState)(null),[W,G]=(0,L.useState)(``),[K,me]=(0,L.useState)(`manual`),[q,he]=(0,L.useState)(``),[ge,_e]=(0,L.useState)(``),[J,ve]=(0,L.useState)(``),[ye,be]=(0,L.useState)(!1),[Y,xe]=(0,L.useState)(`prompt`),[X,Z]=(0,L.useState)([]),[Se,Ce]=(0,L.useState)([]),[we,Q]=(0,L.useState)([]);(0,L.useEffect)(()=>{r(),o()},[r,o]);let Te=async()=>{if(f.trim()&&!(Y===`prompt`&&!E.trim())&&!(Y===`goal`&&X.length===0)){j(!0);try{let e={name:f.trim(),trigger:{type:g,...g===`cron`&&y?{cron:y}:{},...g===`once`&&C?{runAt:new Date(C).toISOString()}:{}},enabled:!0,...Se.length>0?{deliverTo:Se}:{}};Y===`prompt`?e.steps=[{id:`step-1`,prompt:E.trim()}]:(e.goalIds=X,e.steps=[]),await m(`/task-templates`,{method:`POST`,body:JSON.stringify(e)}),p(``),O(``),S(``),ee(``),Z([]),Ce([]),d(!1),r()}finally{j(!1)}}},Ee=async t=>{let n=e.find(e=>e.id===t);se(t);try{await m(`/task-templates/${t}/run`,{method:`POST`}),A.success(`Triggered: ${n?.name??t}`)}catch(e){let t=e instanceof Error?e.message:`Failed to trigger template`;A.error(`Trigger failed: ${t}`)}finally{se(null)}},De=async t=>{let n=e.find(e=>e.id===t);try{await m(`/task-templates/${t}`,{method:`DELETE`}),A.success(`Deleted: ${n?.name??t}`),r()}catch(e){let t=e instanceof Error?e.message:`Failed to delete template`;A.error(`Delete failed: ${t}`)}},Oe=async t=>{let n=e.find(e=>e.id===t);if(!n)return;if(n.trigger.type!==`cron`&&n.trigger.type!==`event`&&n.trigger.type!==`once`){A.error(`Toggle not applicable for manual triggers`);return}let i=!n.enabled;try{await m(`/task-templates/${t}`,{method:`PATCH`,body:JSON.stringify({enabled:i})}),A.success(`${n.name} ${i?`enabled`:`disabled`}`),r()}catch(e){let t=e instanceof Error?e.message:`Failed to toggle template`;A.error(`Toggle failed: ${t}`)}},ke=e=>{U(e.id),G(e.name),me(e.trigger.type),he(e.trigger.cron??``),_e(e.trigger.runAt?new Date(e.trigger.runAt).toISOString().slice(0,16):``),ve(e.steps[0]?.prompt??``),Q(e.deliverTo??[])},Ae=async()=>{if(!(!H||!W.trim()||!J.trim())){be(!0);try{await m(`/task-templates/${H}`,{method:`PATCH`,body:JSON.stringify({name:W.trim(),trigger:{type:K,...K===`cron`&&q?{cron:q}:{},...K===`once`&&ge?{runAt:new Date(ge).toISOString()}:{}},steps:[{id:`step-1`,prompt:J.trim()}],enabled:e.find(e=>e.id===H)?.enabled??!0,deliverTo:we.length>0?we:void 0})}),U(null),r(),A.success(`Template updated`)}catch(e){let t=e instanceof Error?e.message:`Failed to update template`;A.error(t)}finally{be(!1)}}},je=e.find(e=>e.id===I),Me=e.find(e=>e.id===B);return(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Automations`}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>void r(),children:(0,R.jsx)(a,{size:14})}),(0,R.jsxs)(x,{size:`sm`,onClick:()=>d(!s),children:[(0,R.jsx)(l,{size:14}),`New Automation`]})]})]}),s&&(0,R.jsxs)(M,{className:`space-y-3`,children:[(0,R.jsx)(`input`,{className:`w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Template name`,value:f,onChange:e=>p(e.target.value)}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsxs)(`select`,{className:`rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:g,onChange:e=>_(e.target.value),children:[(0,R.jsx)(`option`,{value:`manual`,children:`Manual`}),(0,R.jsx)(`option`,{value:`cron`,children:`Cron`}),(0,R.jsx)(`option`,{value:`event`,children:`Event`}),(0,R.jsx)(`option`,{value:`once`,children:`Once`})]}),g===`cron`&&(0,R.jsx)(`input`,{className:`flex-1 rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Cron expression (e.g. */5 * * * *)`,value:y,onChange:e=>S(e.target.value)}),g===`once`&&(0,R.jsx)(`input`,{type:`datetime-local`,className:`flex-1 rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:C,onChange:e=>ee(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsx)(`span`,{className:`text-xs text-slate-400`,children:`Action type:`}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>xe(`prompt`),className:`rounded px-2 py-1 text-xs ${Y===`prompt`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:text-slate-300`}`,children:`Custom Prompt`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>xe(`goal`),className:`rounded px-2 py-1 text-xs ${Y===`goal`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:text-slate-300`}`,children:`Goal Reference`})]})]}),Y===`prompt`?(0,R.jsx)(`textarea`,{className:`w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-2 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Step prompt`,rows:3,value:E,onChange:e=>O(e.target.value)}):(0,R.jsx)(`div`,{className:`space-y-1`,children:i.length===0?(0,R.jsx)(`p`,{className:`text-xs text-slate-500`,children:`No goals available`}):i.map(e=>(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-slate-300 hover:text-slate-100 cursor-pointer`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:X.includes(e.id),onChange:t=>{t.target.checked?Z([...X,e.id]):Z(X.filter(t=>t!==e.id))},className:`rounded border-slate-600 bg-slate-800`}),(0,R.jsx)(`span`,{className:`truncate`,children:e.name}),(0,R.jsx)(re,{variant:`muted`,className:`text-[10px]`,children:e.status})]},e.id))}),(0,R.jsx)(fe,{value:Se,onChange:Ce}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(x,{onClick:()=>void Te(),disabled:k||!f.trim()||Y===`prompt`&&!E.trim()||Y===`goal`&&X.length===0,children:k?`Creating...`:`Create`}),(0,R.jsx)(x,{variant:`ghost`,onClick:()=>d(!1),children:`Cancel`})]})]}),H!==null&&(0,R.jsxs)(M,{className:`space-y-3`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-slate-200`,children:`Edit Automation`}),(0,R.jsx)(`input`,{className:`w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Template name`,value:W,onChange:e=>G(e.target.value)}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsxs)(`select`,{className:`rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:K,onChange:e=>me(e.target.value),children:[(0,R.jsx)(`option`,{value:`manual`,children:`Manual`}),(0,R.jsx)(`option`,{value:`cron`,children:`Cron`}),(0,R.jsx)(`option`,{value:`event`,children:`Event`}),(0,R.jsx)(`option`,{value:`once`,children:`Once`})]}),K===`cron`&&(0,R.jsx)(`input`,{className:`flex-1 rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Cron expression`,value:q,onChange:e=>he(e.target.value)}),K===`once`&&(0,R.jsx)(`input`,{type:`datetime-local`,className:`flex-1 rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:ge,onChange:e=>_e(e.target.value)})]}),(0,R.jsx)(`textarea`,{className:`w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-2 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Step prompt`,rows:3,value:J,onChange:e=>ve(e.target.value)}),(0,R.jsx)(fe,{value:we,onChange:Q}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(x,{onClick:()=>void Ae(),disabled:ye||!W.trim()||!J.trim(),children:ye?`Saving...`:`Save`}),(0,R.jsx)(x,{variant:`ghost`,onClick:()=>U(null),children:`Cancel`})]})]}),(0,R.jsx)(M,{padding:!1,children:e.length===0?(0,R.jsx)(ce,{icon:(0,R.jsx)(t,{size:32}),title:`No automations`,description:`Create an automation to run recurring tasks`}):(0,R.jsxs)(de,{children:[(0,R.jsx)(le,{children:(0,R.jsxs)(P,{children:[(0,R.jsx)(N,{children:`Name`}),(0,R.jsx)(N,{children:`Trigger`}),(0,R.jsx)(N,{children:`Schedule`}),(0,R.jsx)(N,{children:`Steps`}),(0,R.jsx)(N,{children:`Enabled`}),(0,R.jsx)(N,{children:`Created`}),(0,R.jsx)(N,{children:`Webhook URL`}),(0,R.jsx)(N,{children:`Actions`})]})}),(0,R.jsx)(ue,{children:e.map(e=>(0,R.jsxs)(P,{children:[(0,R.jsx)(F,{className:`font-medium text-slate-200`,children:e.name}),(0,R.jsx)(F,{children:(0,R.jsx)(re,{variant:e.trigger.type===`cron`?`info`:e.trigger.type===`event`?`warning`:(e.trigger.type,`muted`),children:e.trigger.type})}),(0,R.jsx)(F,{className:`font-mono text-xs`,children:e.trigger.type===`once`&&e.trigger.runAt?new Date(e.trigger.runAt).toLocaleString():e.trigger.cron??`—`}),(0,R.jsx)(F,{className:`font-mono text-xs`,children:e.goalIds&&e.goalIds.length>0?`Goals: ${e.goalIds.length}`:e.steps.length}),(0,R.jsx)(F,{children:e.trigger.type!==`cron`&&e.trigger.type!==`event`&&e.trigger.type!==`once`?(0,R.jsx)(`span`,{className:`text-xs text-slate-500`,children:`—`}):(0,R.jsx)(pe,{checked:e.enabled,onCheckedChange:()=>void Oe(e.id),"aria-label":`Toggle ${e.name}`})}),(0,R.jsx)(F,{className:`text-xs text-slate-500`,children:e.createdAt?ae(e.createdAt):`—`}),(0,R.jsx)(F,{className:`font-mono text-xs text-slate-400`,children:e.enabled?`POST /webhooks/${e.id}`:`—`}),(0,R.jsx)(F,{children:(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>ke(e),title:`Edit`,children:(0,R.jsx)(n,{size:12})}),(0,R.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>z(e.id),disabled:oe===e.id,title:`Run now`,children:(0,R.jsx)(u,{size:12})}),(0,R.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>V(e.id),title:`Delete`,children:(0,R.jsx)(c,{size:12,className:`text-red-400`})})]})})]},e.id))})]})}),(0,R.jsx)(te,{open:I!==null,onOpenChange:e=>{e||z(null)},children:(0,R.jsxs)(D,{children:[(0,R.jsxs)(T,{children:[(0,R.jsx)(ie,{children:`Run Template`}),(0,R.jsxs)(ne,{children:[`Run “`,je?.name,`” now? This will execute the template immediately.`]})]}),(0,R.jsxs)(b,{children:[(0,R.jsx)(v,{children:`Cancel`}),(0,R.jsx)(w,{onClick:()=>{I&&Ee(I),z(null)},children:`Run Now`})]})]})}),(0,R.jsx)(te,{open:B!==null,onOpenChange:e=>{e||V(null)},children:(0,R.jsxs)(D,{children:[(0,R.jsxs)(T,{children:[(0,R.jsx)(ie,{children:`Delete Template`}),(0,R.jsxs)(ne,{children:[`Delete “`,Me?.name,`”? This action cannot be undone.`]})]}),(0,R.jsxs)(b,{children:[(0,R.jsx)(v,{children:`Cancel`}),(0,R.jsx)(w,{className:`bg-red-600 hover:bg-red-500`,onClick:()=>{B&&De(B),V(null)},children:`Delete`})]})]})})]})}function Xe(){return(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Work`}),(0,R.jsxs)(Ue,{defaultValue:`tasks`,children:[(0,R.jsxs)(We,{children:[(0,R.jsx)(Ge,{value:`tasks`,children:`Tasks`}),(0,R.jsx)(Ge,{value:`automations`,children:`Automations`}),(0,R.jsx)(Ge,{value:`goals`,children:`Goals`})]}),(0,R.jsx)(Ke,{value:`tasks`,children:(0,R.jsx)(Je,{})}),(0,R.jsx)(Ke,{value:`automations`,children:(0,R.jsx)(Ye,{})}),(0,R.jsx)(Ke,{value:`goals`,children:(0,R.jsx)(I,{})})]})]})}export{Xe as Work};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{I as t,S as n,U as r,X as i,h as a,k as o,nt as s,o as c,v as l,x as u}from"./vendor-icons-CkI4-NxL.js";import{r as d,t as f}from"./vendor-react-DLRtONKt.js";import{n as p,r as m}from"./dist-HyCSN_hp.js";import{C as h,S as g,_,a as v,b as y,c as b,f as x,g as S,h as C,i as w,l as T,m as ee,n as E,o as D,p as O,r as te,s as ne,t as re,u as ie,v as k,w as A,x as j}from"./index-rvaixveh.js";import{t as M}from"./Card-4mOZntHG.js";import{a as ae,o as oe,t as se}from"./format-DvtQjPZn.js";import{t as ce}from"./EmptyState-BlgMMAr-.js";import{a as le,i as N,n as ue,o as P,r as F,t as de}from"./Table-BxbnOSbq.js";import{Goals as I,t as fe}from"./Goals-DdM0tFus.js";import{t as pe}from"./Switch-CTAIxUd_.js";var L=e(s(),1),R=f();function z(e){let t=e+`CollectionProvider`,[n,r]=g(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=L.useRef(null),a=L.useRef(new Map).current;return(0,R.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=S(s),l=L.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,R.jsx)(c,{ref:j(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=S(u),p=L.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=L.useRef(null),s=j(t,o),c=a(u,n);return L.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,R.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return L.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var B=L.createContext(void 0);function V(e){let t=L.useContext(B);return e||t||`ltr`}var H=`rovingFocusGroup.onEntryFocus`,U={bubbles:!1,cancelable:!0},W=`RovingFocusGroup`,[G,K,me]=z(W),[q,he]=g(W,[me]),[ge,_e]=q(W),J=L.forwardRef((e,t)=>(0,R.jsx)(G.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(G.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(ve,{...e,ref:t})})}));J.displayName=W;var ve=L.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=L.useRef(null),p=j(t,f),m=V(a),[h,g]=_({prop:o,defaultProp:s??null,onChange:c,caller:W}),[v,b]=L.useState(!1),x=ee(l),S=K(n),w=L.useRef(!1),[T,E]=L.useState(0);return L.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(H,x),()=>e.removeEventListener(H,x)},[x]),(0,R.jsx)(ge,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:L.useCallback(e=>g(e),[g]),onItemShiftTab:L.useCallback(()=>b(!0),[]),onFocusableItemAdd:L.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:L.useCallback(()=>E(e=>e-1),[]),children:(0,R.jsx)(C.div,{tabIndex:v||T===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:y(e.onMouseDown,()=>{w.current=!0}),onFocus:y(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(H,U);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);Z([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}w.current=!1}),onBlur:y(e.onBlur,()=>b(!1))})})}),ye=`RovingFocusGroupItem`,be=L.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=k(),l=a||c,u=_e(ye,n),d=u.currentTabStopId===l,f=K(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return L.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,R.jsx)(G.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,R.jsx)(C.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:y(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:y(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:y(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=X(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Se(n,r+1):n.slice(r+1)}setTimeout(()=>Z(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});be.displayName=ye;var Y={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function xe(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function X(e,t,n){let r=xe(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Y[r]}function Z(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Se(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Ce=J,we=be,Q=`Tabs`,[Te,Ee]=g(Q,[he]),De=he(),[Oe,ke]=Te(Q),Ae=L.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=V(s),[d,f]=_({prop:r,onChange:i,defaultProp:a??``,caller:Q});return(0,R.jsx)(Oe,{scope:n,baseId:k(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,R.jsx)(C.div,{dir:u,"data-orientation":o,...l,ref:t})})});Ae.displayName=Q;var je=`TabsList`,Me=L.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=ke(je,n),o=De(n);return(0,R.jsx)(Ce,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,R.jsx)(C.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Me.displayName=je;var Ne=`TabsTrigger`,Pe=L.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=ke(Ne,n),s=De(n),c=Le(o.baseId,r),l=Re(o.baseId,r),u=r===o.value;return(0,R.jsx)(we,{asChild:!0,...s,focusable:!i,active:u,children:(0,R.jsx)(C.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:y(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:y(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:y(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Pe.displayName=Ne;var Fe=`TabsContent`,Ie=L.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=ke(Fe,n),c=Le(s.baseId,r),l=Re(s.baseId,r),u=r===s.value,d=L.useRef(u);return L.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,R.jsx)(O,{present:i||u,children:({present:n})=>(0,R.jsx)(C.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Ie.displayName=Fe;function Le(e,t){return`${e}-trigger-${t}`}function Re(e,t){return`${e}-content-${t}`}var ze=Ae,Be=Me,Ve=Pe,He=Ie,Ue=ze,We=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Be,{ref:n,className:p(`inline-flex h-9 items-center justify-center rounded-lg bg-slate-800/50 p-1 text-slate-400`,e),...t}));We.displayName=Be.displayName;var Ge=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(Ve,{ref:n,className:p(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-slate-950 transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-slate-900 data-[state=active]:text-slate-100 data-[state=active]:shadow`,e),...t}));Ge.displayName=Ve.displayName;var Ke=L.forwardRef(({className:e,...t},n)=>(0,R.jsx)(He,{ref:n,className:p(`mt-2 ring-offset-slate-950 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2`,e),...t}));Ke.displayName=He.displayName;var qe=[{label:`All`,value:`all`},{label:`Running`,value:`running`},{label:`Pending`,value:`pending`},{label:`Completed`,value:`completed`},{label:`Failed`,value:`failed`},{label:`Cancelled`,value:`cancelled`}],$=new Set([`pending`,`queued`,`running`,`paused`]);function Je(){let e=h(e=>e.tasks),t=h(e=>e.fetchTasks),[n,s]=(0,L.useState)(`all`),[c,u]=(0,L.useState)(!1),[f,p]=(0,L.useState)(``),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(new Set),[b,S]=(0,L.useState)(!1);(0,L.useEffect)(()=>{let e=n===`all`?void 0:n;t(e);let r=setInterval(()=>void t(e),5e3);return()=>clearInterval(r)},[t,n]),(0,L.useEffect)(()=>{y(new Set)},[n]);let C=async()=>{if(f.trim()){_(!0);try{await m(`/tasks`,{method:`POST`,body:JSON.stringify({prompt:f.trim()})}),p(``),u(!1),t(n===`all`?void 0:n)}finally{_(!1)}}},w=e=>{y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},T=()=>{let e=D.filter(e=>$.has(e.status)).map(e=>e.id);y(new Set(e))},ee=async()=>{if(v.size!==0){S(!0);try{await m(`/tasks/batch-cancel`,{method:`POST`,body:JSON.stringify({taskIds:Array.from(v)})}),y(new Set),t(n===`all`?void 0:n)}finally{S(!1)}}},D=[...e].sort((e,t)=>t.createdAt-e.createdAt),O=Array.from(v).filter(t=>{let n=e.find(e=>e.id===t);return n&&$.has(n.status)});return(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Tasks`}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[v.size>0&&(0,R.jsxs)(x,{variant:`destructive`,size:`sm`,onClick:()=>void ee(),disabled:b||O.length===0,children:[(0,R.jsx)(r,{size:14}),b?`Cancelling...`:`Cancel ${O.length} task${O.length===1?``:`s`}`]}),(0,R.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>void t(n===`all`?void 0:n),children:(0,R.jsx)(a,{size:14})}),(0,R.jsxs)(x,{size:`sm`,onClick:()=>u(!c),children:[(0,R.jsx)(l,{size:14}),`New Task`]})]})]}),c&&(0,R.jsxs)(M,{className:`flex gap-2`,children:[(0,R.jsx)(`input`,{className:`flex-1 rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Enter task prompt...`,value:f,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&C()}}),(0,R.jsx)(x,{onClick:()=>void C(),disabled:g||!f.trim(),children:g?`Creating...`:`Create`}),(0,R.jsx)(x,{variant:`ghost`,onClick:()=>u(!1),children:`Cancel`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`div`,{className:`flex gap-1.5`,children:qe.map(e=>(0,R.jsx)(`button`,{onClick:()=>s(e.value),className:`rounded-md px-2.5 py-1 text-xs font-medium transition-colors ${n===e.value?`bg-slate-800 text-slate-100`:`text-slate-500 hover:text-slate-300`}`,children:e.label},e.value))}),D.some(e=>$.has(e.status))&&(0,R.jsx)(`button`,{onClick:T,className:`text-xs text-slate-500 hover:text-slate-300`,children:`Select all cancellable`}),v.size>0&&(0,R.jsxs)(`button`,{onClick:()=>y(new Set),className:`text-xs text-slate-500 hover:text-slate-300`,children:[`Clear selection (`,v.size,`)`]})]}),(0,R.jsx)(M,{padding:!1,children:D.length===0?(0,R.jsx)(ce,{icon:(0,R.jsx)(o,{size:32}),title:`No tasks found`,description:n===`all`?`Create a task to get started`:`No tasks with status "${n}"`}):(0,R.jsxs)(de,{children:[(0,R.jsx)(le,{children:(0,R.jsxs)(P,{children:[(0,R.jsx)(N,{className:`w-8`,children:(0,R.jsx)(`button`,{onClick:()=>{v.size>0&&v.size===D.filter(e=>$.has(e.status)).length?y(new Set):T()},className:`flex h-4 w-4 items-center justify-center rounded border transition-colors ${v.size>0&&v.size===D.filter(e=>$.has(e.status)).length?`border-blue-600 bg-blue-600 text-white`:`border-slate-600 bg-transparent hover:border-slate-400`}`,children:v.size>0&&v.size===D.filter(e=>$.has(e.status)).length&&(0,R.jsx)(i,{size:12})})}),(0,R.jsx)(N,{children:`ID`}),(0,R.jsx)(N,{children:`Prompt`}),(0,R.jsx)(N,{children:`Status`}),(0,R.jsx)(N,{children:`Role`}),(0,R.jsx)(N,{children:`Cost`}),(0,R.jsx)(N,{children:`Created`})]})}),(0,R.jsx)(ue,{children:D.map(e=>(0,R.jsxs)(P,{className:v.has(e.id)?`bg-slate-800/50`:``,children:[(0,R.jsx)(F,{children:$.has(e.status)?(0,R.jsx)(`button`,{onClick:()=>w(e.id),className:`flex h-4 w-4 items-center justify-center rounded border transition-colors ${v.has(e.id)?`border-blue-600 bg-blue-600 text-white`:`border-slate-600 bg-transparent hover:border-slate-400`}`,children:v.has(e.id)&&(0,R.jsx)(i,{size:12})}):(0,R.jsx)(`span`,{className:`inline-block w-4`})}),(0,R.jsx)(F,{children:(0,R.jsx)(d,{to:`/tasks/${e.id}`,className:`font-mono text-xs text-blue-400 hover:text-blue-300`,children:e.id.slice(0,8)})}),(0,R.jsx)(F,{children:oe(e.prompt,80)}),(0,R.jsx)(F,{children:(0,R.jsx)(re,{variant:E(e.status),children:e.status})}),(0,R.jsx)(F,{children:(0,R.jsx)(`span`,{className:`font-mono text-xs text-slate-500`,children:e.roleId?e.roleId.slice(0,12):`—`})}),(0,R.jsx)(F,{className:`font-mono text-xs`,children:e.costUsd==null?`—`:se(e.costUsd)}),(0,R.jsx)(F,{className:`text-xs text-slate-500`,children:ae(e.createdAt)})]},e.id))})]})})]})}function Ye(){let e=h(e=>e.templates),r=h(e=>e.fetchTemplates),i=h(e=>e.goals),o=h(e=>e.fetchGoals),[s,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(``),[g,_]=(0,L.useState)(`manual`),[y,S]=(0,L.useState)(``),[C,ee]=(0,L.useState)(``),[E,O]=(0,L.useState)(``),[k,j]=(0,L.useState)(!1),[oe,se]=(0,L.useState)(null),[I,z]=(0,L.useState)(null),[B,V]=(0,L.useState)(null),[H,U]=(0,L.useState)(null),[W,G]=(0,L.useState)(``),[K,me]=(0,L.useState)(`manual`),[q,he]=(0,L.useState)(``),[ge,_e]=(0,L.useState)(``),[J,ve]=(0,L.useState)(``),[ye,be]=(0,L.useState)(!1),[Y,xe]=(0,L.useState)(`prompt`),[X,Z]=(0,L.useState)([]),[Se,Ce]=(0,L.useState)([]),[we,Q]=(0,L.useState)([]);(0,L.useEffect)(()=>{r(),o()},[r,o]);let Te=async()=>{if(f.trim()&&!(Y===`prompt`&&!E.trim())&&!(Y===`goal`&&X.length===0)){j(!0);try{let e={name:f.trim(),trigger:{type:g,...g===`cron`&&y?{cron:y}:{},...g===`once`&&C?{runAt:new Date(C).toISOString()}:{}},enabled:!0,...Se.length>0?{deliverTo:Se}:{}};Y===`prompt`?e.steps=[{id:`step-1`,prompt:E.trim()}]:(e.goalIds=X,e.steps=[]),await m(`/task-templates`,{method:`POST`,body:JSON.stringify(e)}),p(``),O(``),S(``),ee(``),Z([]),Ce([]),d(!1),r()}finally{j(!1)}}},Ee=async t=>{let n=e.find(e=>e.id===t);se(t);try{await m(`/task-templates/${t}/run`,{method:`POST`}),A.success(`Triggered: ${n?.name??t}`)}catch(e){let t=e instanceof Error?e.message:`Failed to trigger template`;A.error(`Trigger failed: ${t}`)}finally{se(null)}},De=async t=>{let n=e.find(e=>e.id===t);try{await m(`/task-templates/${t}`,{method:`DELETE`}),A.success(`Deleted: ${n?.name??t}`),r()}catch(e){let t=e instanceof Error?e.message:`Failed to delete template`;A.error(`Delete failed: ${t}`)}},Oe=async t=>{let n=e.find(e=>e.id===t);if(!n)return;if(n.trigger.type!==`cron`&&n.trigger.type!==`event`&&n.trigger.type!==`once`){A.error(`Toggle not applicable for manual triggers`);return}let i=!n.enabled;try{await m(`/task-templates/${t}`,{method:`PATCH`,body:JSON.stringify({enabled:i})}),A.success(`${n.name} ${i?`enabled`:`disabled`}`),r()}catch(e){let t=e instanceof Error?e.message:`Failed to toggle template`;A.error(`Toggle failed: ${t}`)}},ke=e=>{U(e.id),G(e.name),me(e.trigger.type),he(e.trigger.cron??``),_e(e.trigger.runAt?new Date(e.trigger.runAt).toISOString().slice(0,16):``),ve(e.steps[0]?.prompt??``),Q(e.deliverTo??[])},Ae=async()=>{if(!(!H||!W.trim()||!J.trim())){be(!0);try{await m(`/task-templates/${H}`,{method:`PATCH`,body:JSON.stringify({name:W.trim(),trigger:{type:K,...K===`cron`&&q?{cron:q}:{},...K===`once`&&ge?{runAt:new Date(ge).toISOString()}:{}},steps:[{id:`step-1`,prompt:J.trim()}],enabled:e.find(e=>e.id===H)?.enabled??!0,deliverTo:we.length>0?we:void 0})}),U(null),r(),A.success(`Template updated`)}catch(e){let t=e instanceof Error?e.message:`Failed to update template`;A.error(t)}finally{be(!1)}}},je=e.find(e=>e.id===I),Me=e.find(e=>e.id===B);return(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Automations`}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>void r(),children:(0,R.jsx)(a,{size:14})}),(0,R.jsxs)(x,{size:`sm`,onClick:()=>d(!s),children:[(0,R.jsx)(l,{size:14}),`New Automation`]})]})]}),s&&(0,R.jsxs)(M,{className:`space-y-3`,children:[(0,R.jsx)(`input`,{className:`w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Template name`,value:f,onChange:e=>p(e.target.value)}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsxs)(`select`,{className:`rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:g,onChange:e=>_(e.target.value),children:[(0,R.jsx)(`option`,{value:`manual`,children:`Manual`}),(0,R.jsx)(`option`,{value:`cron`,children:`Cron`}),(0,R.jsx)(`option`,{value:`event`,children:`Event`}),(0,R.jsx)(`option`,{value:`once`,children:`Once`})]}),g===`cron`&&(0,R.jsx)(`input`,{className:`flex-1 rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Cron expression (e.g. */5 * * * *)`,value:y,onChange:e=>S(e.target.value)}),g===`once`&&(0,R.jsx)(`input`,{type:`datetime-local`,className:`flex-1 rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:C,onChange:e=>ee(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsx)(`span`,{className:`text-xs text-slate-400`,children:`Action type:`}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>xe(`prompt`),className:`rounded px-2 py-1 text-xs ${Y===`prompt`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:text-slate-300`}`,children:`Custom Prompt`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>xe(`goal`),className:`rounded px-2 py-1 text-xs ${Y===`goal`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:text-slate-300`}`,children:`Goal Reference`})]})]}),Y===`prompt`?(0,R.jsx)(`textarea`,{className:`w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-2 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Step prompt`,rows:3,value:E,onChange:e=>O(e.target.value)}):(0,R.jsx)(`div`,{className:`space-y-1`,children:i.length===0?(0,R.jsx)(`p`,{className:`text-xs text-slate-500`,children:`No goals available`}):i.map(e=>(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-slate-300 hover:text-slate-100 cursor-pointer`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:X.includes(e.id),onChange:t=>{t.target.checked?Z([...X,e.id]):Z(X.filter(t=>t!==e.id))},className:`rounded border-slate-600 bg-slate-800`}),(0,R.jsx)(`span`,{className:`truncate`,children:e.name}),(0,R.jsx)(re,{variant:`muted`,className:`text-[10px]`,children:e.status})]},e.id))}),(0,R.jsx)(fe,{value:Se,onChange:Ce}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(x,{onClick:()=>void Te(),disabled:k||!f.trim()||Y===`prompt`&&!E.trim()||Y===`goal`&&X.length===0,children:k?`Creating...`:`Create`}),(0,R.jsx)(x,{variant:`ghost`,onClick:()=>d(!1),children:`Cancel`})]})]}),H!==null&&(0,R.jsxs)(M,{className:`space-y-3`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-slate-200`,children:`Edit Automation`}),(0,R.jsx)(`input`,{className:`w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Template name`,value:W,onChange:e=>G(e.target.value)}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsxs)(`select`,{className:`rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:K,onChange:e=>me(e.target.value),children:[(0,R.jsx)(`option`,{value:`manual`,children:`Manual`}),(0,R.jsx)(`option`,{value:`cron`,children:`Cron`}),(0,R.jsx)(`option`,{value:`event`,children:`Event`}),(0,R.jsx)(`option`,{value:`once`,children:`Once`})]}),K===`cron`&&(0,R.jsx)(`input`,{className:`flex-1 rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Cron expression`,value:q,onChange:e=>he(e.target.value)}),K===`once`&&(0,R.jsx)(`input`,{type:`datetime-local`,className:`flex-1 rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:ge,onChange:e=>_e(e.target.value)})]}),(0,R.jsx)(`textarea`,{className:`w-full rounded-md border border-slate-700 bg-slate-800 px-3 py-2 text-sm text-slate-200 placeholder:text-slate-500 focus:border-blue-500 focus:outline-none`,placeholder:`Step prompt`,rows:3,value:J,onChange:e=>ve(e.target.value)}),(0,R.jsx)(fe,{value:we,onChange:Q}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(x,{onClick:()=>void Ae(),disabled:ye||!W.trim()||!J.trim(),children:ye?`Saving...`:`Save`}),(0,R.jsx)(x,{variant:`ghost`,onClick:()=>U(null),children:`Cancel`})]})]}),(0,R.jsx)(M,{padding:!1,children:e.length===0?(0,R.jsx)(ce,{icon:(0,R.jsx)(t,{size:32}),title:`No automations`,description:`Create an automation to run recurring tasks`}):(0,R.jsxs)(de,{children:[(0,R.jsx)(le,{children:(0,R.jsxs)(P,{children:[(0,R.jsx)(N,{children:`Name`}),(0,R.jsx)(N,{children:`Trigger`}),(0,R.jsx)(N,{children:`Schedule`}),(0,R.jsx)(N,{children:`Steps`}),(0,R.jsx)(N,{children:`Enabled`}),(0,R.jsx)(N,{children:`Created`}),(0,R.jsx)(N,{children:`Webhook URL`}),(0,R.jsx)(N,{children:`Actions`})]})}),(0,R.jsx)(ue,{children:e.map(e=>(0,R.jsxs)(P,{children:[(0,R.jsx)(F,{className:`font-medium text-slate-200`,children:e.name}),(0,R.jsx)(F,{children:(0,R.jsx)(re,{variant:e.trigger.type===`cron`?`info`:e.trigger.type===`event`?`warning`:(e.trigger.type,`muted`),children:e.trigger.type})}),(0,R.jsx)(F,{className:`font-mono text-xs`,children:e.trigger.type===`once`&&e.trigger.runAt?new Date(e.trigger.runAt).toLocaleString():e.trigger.cron??`—`}),(0,R.jsx)(F,{className:`font-mono text-xs`,children:e.goalIds&&e.goalIds.length>0?`Goals: ${e.goalIds.length}`:e.steps.length}),(0,R.jsx)(F,{children:e.trigger.type!==`cron`&&e.trigger.type!==`event`&&e.trigger.type!==`once`?(0,R.jsx)(`span`,{className:`text-xs text-slate-500`,children:`—`}):(0,R.jsx)(pe,{checked:e.enabled,onCheckedChange:()=>void Oe(e.id),"aria-label":`Toggle ${e.name}`})}),(0,R.jsx)(F,{className:`text-xs text-slate-500`,children:e.createdAt?ae(e.createdAt):`—`}),(0,R.jsx)(F,{className:`font-mono text-xs text-slate-400`,children:e.enabled?`POST /webhooks/${e.id}`:`—`}),(0,R.jsx)(F,{children:(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>ke(e),title:`Edit`,children:(0,R.jsx)(n,{size:12})}),(0,R.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>z(e.id),disabled:oe===e.id,title:`Run now`,children:(0,R.jsx)(u,{size:12})}),(0,R.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>V(e.id),title:`Delete`,children:(0,R.jsx)(c,{size:12,className:`text-red-400`})})]})})]},e.id))})]})}),(0,R.jsx)(te,{open:I!==null,onOpenChange:e=>{e||z(null)},children:(0,R.jsxs)(D,{children:[(0,R.jsxs)(T,{children:[(0,R.jsx)(ie,{children:`Run Template`}),(0,R.jsxs)(ne,{children:[`Run “`,je?.name,`” now? This will execute the template immediately.`]})]}),(0,R.jsxs)(b,{children:[(0,R.jsx)(v,{children:`Cancel`}),(0,R.jsx)(w,{onClick:()=>{I&&Ee(I),z(null)},children:`Run Now`})]})]})}),(0,R.jsx)(te,{open:B!==null,onOpenChange:e=>{e||V(null)},children:(0,R.jsxs)(D,{children:[(0,R.jsxs)(T,{children:[(0,R.jsx)(ie,{children:`Delete Template`}),(0,R.jsxs)(ne,{children:[`Delete “`,Me?.name,`”? This action cannot be undone.`]})]}),(0,R.jsxs)(b,{children:[(0,R.jsx)(v,{children:`Cancel`}),(0,R.jsx)(w,{className:`bg-red-600 hover:bg-red-500`,onClick:()=>{B&&De(B),V(null)},children:`Delete`})]})]})})]})}function Xe(){return(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Work`}),(0,R.jsxs)(Ue,{defaultValue:`tasks`,children:[(0,R.jsxs)(We,{children:[(0,R.jsx)(Ge,{value:`tasks`,children:`Tasks`}),(0,R.jsx)(Ge,{value:`automations`,children:`Automations`}),(0,R.jsx)(Ge,{value:`goals`,children:`Goals`})]}),(0,R.jsx)(Ke,{value:`tasks`,children:(0,R.jsx)(Je,{})}),(0,R.jsx)(Ke,{value:`automations`,children:(0,R.jsx)(Ye,{})}),(0,R.jsx)(Ke,{value:`goals`,children:(0,R.jsx)(I,{})})]})]})}export{Xe as Work};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-cDHpOWnY.js","assets/rolldown-runtime-Dw2cE7zH.js","assets/vendor-react-DLRtONKt.js","assets/vendor-icons-CkI4-NxL.js","assets/Card-4mOZntHG.js","assets/dist-HyCSN_hp.js","assets/Table-BxbnOSbq.js","assets/format-DvtQjPZn.js","assets/Chat-Bha4vXwT.js","assets/vendor-state-B_-GdGNJ.js","assets/Work-BpKK_uXA.js","assets/Switch-CTAIxUd_.js","assets/EmptyState-BlgMMAr-.js","assets/Goals-DdM0tFus.js","assets/TaskDetail-DEg_oUwx.js","assets/Plugins-gcMpBdyq.js","assets/Strategies-CO4LwZjS.js","assets/Logs-DJhpDtCA.js","assets/Settings-JbgBxBeo.js","assets/EnvVarEditor-CaCpNT3y.js","assets/Memories-CYN99g2T.js","assets/Evolution-Ao-gdHbS.js","assets/Channels-2veauYsm.js","assets/GoalDetail-CX2i9A5a.js","assets/ChannelDetail-eWtIGhAd.js","assets/Roles-CCy1H7PY.js","assets/RoleDetail-s7u-Shk3.js","assets/NotFound-CSjhzSGa.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{A as t,E as n,F as r,Q as i,T as a,W as o,_ as s,g as c,j as l,k as u,n as d,nt as f,r as p,s as m,t as h,u as g}from"./vendor-icons-CkI4-NxL.js";import{a as _,c as v,f as y,i as b,m as x,n as S,o as C,p as w,s as ee,t as T}from"./vendor-react-DLRtONKt.js";import{a as te,n as E,r as D,t as O}from"./dist-HyCSN_hp.js";import{t as ne}from"./vendor-state-B_-GdGNJ.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var k=w(),A=e(f(),1),j=T(),re=class extends A.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[ErrorBoundary] Uncaught error:`,e,t.componentStack)}render(){return this.state.hasError?(0,j.jsx)(`div`,{className:`flex h-screen items-center justify-center bg-slate-950 p-6`,children:(0,j.jsxs)(`div`,{className:`w-full max-w-md rounded-lg border border-slate-800 bg-slate-900 p-8 text-center`,children:[(0,j.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-red-500/10`,children:(0,j.jsx)(`svg`,{className:`h-6 w-6 text-red-500`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})})}),(0,j.jsx)(`h1`,{className:`mb-2 text-lg font-semibold text-slate-100`,children:`Something went wrong`}),(0,j.jsx)(`p`,{className:`mb-6 text-sm text-slate-400`,children:`An unexpected error occurred. Try reloading the page.`}),this.state.error&&(0,j.jsx)(`pre`,{className:`mb-6 max-h-32 overflow-auto rounded bg-slate-950 p-3 text-left text-xs text-red-400`,children:this.state.error.message}),(0,j.jsx)(`button`,{onClick:()=>window.location.reload(),className:`rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-slate-900`,children:`Reload`})]})}):this.props.children}},M=[{to:`/`,icon:l,label:`Dashboard`},{to:`/chat`,icon:a,label:`Chat`},{to:`/work`,icon:u,label:`Work`},{to:`/roles`,icon:o,label:`Roles`},{to:`/strategies`,icon:t,label:`Strategies`},{to:`/channels`,icon:c,label:`Channels`},{to:`/memories`,icon:i,label:`Memories`},{to:`/evolution`,icon:r,label:`Evolution`},{to:`/plugins`,icon:s,label:`Plugins`},{to:`/logs`,icon:m,label:`Logs`},{to:`/settings`,icon:g,label:`Settings`}];function N({onNavigate:e}){return(0,j.jsxs)(`aside`,{className:`flex h-full w-60 flex-col border-r border-slate-800 bg-slate-950`,children:[(0,j.jsxs)(`div`,{className:`flex h-14 items-center gap-2.5 border-b border-slate-800 px-5`,children:[(0,j.jsx)(`div`,{className:`flex h-7 w-7 items-center justify-center rounded-md bg-blue-600 text-xs font-bold text-white`,children:`A`}),(0,j.jsx)(`span`,{className:`text-sm font-semibold text-slate-100 tracking-wide`,children:`Adam`}),(0,j.jsx)(`span`,{className:`ml-auto rounded bg-slate-800 px-1.5 py-0.5 font-mono text-[10px] text-slate-500`,children:`v2.0`})]}),(0,j.jsx)(`nav`,{role:`navigation`,"aria-label":`Main navigation`,className:`flex-1 space-y-0.5 px-3 py-4`,children:M.map(({to:t,icon:n,label:r})=>(0,j.jsx)(b,{to:t,end:t===`/`,onClick:e,className:({isActive:e})=>te(`flex items-center gap-2.5 rounded-md px-2.5 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-slate-950`,e?`bg-slate-800 text-slate-100`:`text-slate-400 hover:bg-slate-900 hover:text-slate-200`),children:({isActive:e})=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(n,{size:16}),r,e&&(0,j.jsx)(`span`,{className:`sr-only`,children:`(current page)`})]})},t))})]})}var ie=e(x(),1);function ae(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var oe=e=>{switch(e){case`success`:return le;case`info`:return de;case`warning`:return ue;case`error`:return fe;default:return null}},se=Array(12).fill(0),ce=({visible:e,className:t})=>A.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},A.createElement(`div`,{className:`sonner-spinner`},se.map((e,t)=>A.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),le=A.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},A.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),ue=A.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},A.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),de=A.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},A.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),fe=A.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},A.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),pe=A.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},A.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),A.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),me=()=>{let[e,t]=A.useState(document.hidden);return A.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},P=1,F=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:P++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],A.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(he(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!A.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!A.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!A.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!A.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||P++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},I=(e,t)=>{let n=t?.id||P++;return F.addToast({title:e,...t,id:n}),n},he=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,ge=Object.assign(I,{success:F.success,info:F.info,warning:F.warning,error:F.error,custom:F.custom,message:F.message,promise:F.promise,dismiss:F.dismiss,loading:F.loading},{getHistory:()=>F.toasts,getToasts:()=>F.getActiveToasts()});ae(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function _e(e){return e.label!==void 0}var L=3,R=`24px`,ve=`16px`,ye=4e3,be=356,xe=14,Se=45,Ce=200;function z(...e){return e.filter(Boolean).join(` `)}function we(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Te=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:ee=`Close toast`}=e,[T,te]=A.useState(null),[E,D]=A.useState(null),[O,ne]=A.useState(!1),[k,j]=A.useState(!1),[re,M]=A.useState(!1),[N,ie]=A.useState(!1),[ae,se]=A.useState(!1),[le,ue]=A.useState(0),[de,fe]=A.useState(0),P=A.useRef(n.duration||y||ye),F=A.useRef(null),I=A.useRef(null),he=c===0,ge=c+1<=o,L=n.type,R=n.dismissible!==!1,ve=n.className||``,be=n.descriptionClassName||``,xe=A.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),Te=A.useMemo(()=>n.closeButton??p,[n.closeButton,p]),Ee=A.useMemo(()=>n.duration||y||ye,[n.duration,y]),De=A.useRef(0),B=A.useRef(0),Oe=A.useRef(0),V=A.useRef(null),[H,ke]=b.split(`-`),Ae=A.useMemo(()=>s.reduce((e,t,n)=>n>=xe?e:e+t.height,0),[s,xe]),je=me(),Me=n.invert||t,Ne=L===`loading`;B.current=A.useMemo(()=>xe*x+Ae,[xe,Ae]),A.useEffect(()=>{P.current=Ee},[Ee]),A.useEffect(()=>{ne(!0)},[]),A.useEffect(()=>{let e=I.current;if(e){let t=e.getBoundingClientRect().height;return fe(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),A.useLayoutEffect(()=>{if(!O)return;let e=I.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,fe(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[O,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let U=A.useCallback(()=>{j(!0),ue(B.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Ce)},[n,d,a,B]);A.useEffect(()=>{if(n.promise&&L===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||je?(()=>{if(Oe.current<De.current){let e=new Date().getTime()-De.current;P.current-=e}Oe.current=new Date().getTime()})():P.current!==1/0&&(De.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),U()},P.current)),()=>clearTimeout(e)},[u,i,n,L,je,U]),A.useEffect(()=>{n.delete&&(U(),n.onDismiss==null||n.onDismiss.call(n,n))},[U,n.delete]);function Pe(){return w?.loading?A.createElement(`div`,{className:z(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":L===`loading`},w.loading):A.createElement(ce,{className:z(C?.loader,n?.classNames?.loader),visible:L===`loading`})}let W=n.icon||w?.[L]||oe(L);return A.createElement(`li`,{tabIndex:0,ref:I,className:z(_,ve,C?.toast,n?.classNames?.toast,C?.default,C?.[L],n?.classNames?.[L]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":O,"data-promise":!!n.promise,"data-swiped":ae,"data-removed":k,"data-visible":ge,"data-y-position":H,"data-x-position":ke,"data-index":c,"data-front":he,"data-swiping":re,"data-dismissible":R,"data-type":L,"data-invert":Me,"data-swipe-out":N,"data-swipe-direction":E,"data-expanded":!!(u||S&&O),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${k?le:B.current}px`,"--initial-height":S?`auto`:`${de}px`,...m,...n.style},onDragEnd:()=>{M(!1),te(null),V.current=null},onPointerDown:e=>{e.button!==2&&(Ne||!R||(F.current=new Date,ue(B.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(M(!0),V.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(N||!R)return;V.current=null;let e=Number(I.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(I.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-F.current?.getTime(),i=T===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=Se||a>.11){ue(B.current),n.onDismiss==null||n.onDismiss.call(n,n),D(T===`x`?e>0?`right`:`left`:t>0?`down`:`up`),U(),ie(!0);return}else{var o,s;(o=I.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=I.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}se(!1),M(!1),te(null)},onPointerMove:t=>{var n,r;if(!V.current||!R||window.getSelection()?.toString().length>0)return;let i=t.clientY-V.current.y,a=t.clientX-V.current.x,o=e.swipeDirections??we(b);!T&&(Math.abs(a)>1||Math.abs(i)>1)&&te(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(T===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(T===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&se(!0),(n=I.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=I.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},Te&&!n.jsx&&L!==`loading`?A.createElement(`button`,{"aria-label":ee,"data-disabled":Ne,"data-close-button":!0,onClick:Ne||!R?()=>{}:()=>{U(),n.onDismiss==null||n.onDismiss.call(n,n)},className:z(C?.closeButton,n?.classNames?.closeButton)},w?.close??pe):null,(L||n.icon||n.promise)&&n.icon!==null&&(w?.[L]!==null||n.icon)?A.createElement(`div`,{"data-icon":``,className:z(C?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Pe():null,n.type===`loading`?null:W):null,A.createElement(`div`,{"data-content":``,className:z(C?.content,n?.classNames?.content)},A.createElement(`div`,{"data-title":``,className:z(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?A.createElement(`div`,{"data-description":``,className:z(v,be,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),A.isValidElement(n.cancel)?n.cancel:n.cancel&&_e(n.cancel)?A.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{_e(n.cancel)&&R&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),U())},className:z(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,A.isValidElement(n.action)?n.action:n.action&&_e(n.action)?A.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{_e(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&U())},className:z(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Ee(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function De(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?ve:R;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var B=A.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=L,toastOptions:g,dir:_=Ee(),gap:v=xe,icons:y,containerAriaLabel:b=`Notifications`}=e,[x,S]=A.useState([]),C=A.useMemo(()=>n?x.filter(e=>e.toasterId===n):x.filter(e=>!e.toasterId),[x,n]),w=A.useMemo(()=>Array.from(new Set([i].concat(C.filter(e=>e.position).map(e=>e.position)))),[C,i]),[ee,T]=A.useState([]),[te,E]=A.useState(!1),[D,O]=A.useState(!1),[ne,k]=A.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),j=A.useRef(null),re=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),M=A.useRef(null),N=A.useRef(!1),ae=A.useCallback(e=>{S(t=>(t.find(t=>t.id===e.id)?.delete||F.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return A.useEffect(()=>F.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{S(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{ie.flushSync(()=>{S(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[x]),A.useEffect(()=>{if(d!==`system`){k(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?k(`dark`):k(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{k(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{k(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),A.useEffect(()=>{x.length<=1&&E(!1)},[x]),A.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;E(!0),(t=j.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===j.current||j.current?.contains(document.activeElement))&&E(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),A.useEffect(()=>{if(j.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,N.current=!1)}},[j.current]),A.createElement(`section`,{ref:t,"aria-label":`${b} ${re}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},w.map((t,n)=>{let[i,a]=t.split(`-`);return C.length?A.createElement(`ol`,{key:t,dir:_===`auto`?Ee():_,tabIndex:-1,ref:j,className:c,"data-sonner-toaster":!0,"data-sonner-theme":ne,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${ee[0]?.height||0}px`,"--width":`${be}px`,"--gap":`${v}px`,...m,...De(l,u)},onBlur:e=>{N.current&&!e.currentTarget.contains(e.relatedTarget)&&(N.current=!1,M.current&&=(M.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||N.current||(N.current=!0,M.current=e.relatedTarget)},onMouseEnter:()=>E(!0),onMouseMove:()=>E(!0),onMouseLeave:()=>{D||E(!1)},onDragEnd:()=>E(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||O(!0)},onPointerUp:()=>O(!1)},C.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>A.createElement(Te,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:D,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:ae,toasts:C.filter(e=>e.position==n.position),heights:ee.filter(e=>e.position==n.position),setHeights:T,expandByDefault:o,gap:v,expanded:te,swipeDirections:e.swipeDirections}))):null}))}),Oe=({...e})=>(0,j.jsx)(B,{theme:`dark`,className:`toaster group`,toastOptions:{classNames:{toast:`group toast group-[.toaster]:bg-slate-900 group-[.toaster]:text-slate-200 group-[.toaster]:border-slate-800 group-[.toaster]:shadow-lg`,description:`group-[.toast]:text-slate-400`,actionButton:`group-[.toast]:bg-blue-600 group-[.toast]:text-white`,cancelButton:`group-[.toast]:bg-slate-800 group-[.toast]:text-slate-200`}},...e}),V=500,H=ne((e,t)=>({tasks:[],goals:[],strategies:[],templates:[],readiness:null,stats:{activeTasks:0,queuedTasks:0,totalCostToday:0},logs:[],configVersion:0,pendingPlanApproval:null,planTimeoutNotice:null,roles:[],executionPool:{active:0,max:5,queued:0},deliveryLog:[],wsConnected:!1,_ws:null,_wsReconnectDelay:1e3,fetchTasks:async t=>{let n=new URLSearchParams({limit:`100`});t&&n.set(`status`,t),e({tasks:(await D(`/tasks?${n}`)).tasks})},fetchGoals:async()=>{e({goals:(await D(`/goals`)).goals})},updateGoal:async(t,n)=>{let r=await D(`/goals/${t}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});return e(e=>({goals:e.goals.map(e=>e.id===t?r.goal:e)})),r.goal},deleteGoal:async t=>{await D(`/goals/${t}`,{method:`DELETE`}),e(e=>({goals:e.goals.filter(e=>e.id!==t)}))},fetchStrategies:async()=>{e({strategies:(await D(`/strategies`)).strategies})},fetchTemplates:async()=>{e({templates:(await D(`/task-templates`)).templates})},fetchExecutionPool:async()=>{try{e({executionPool:(await D(`/stats`)).executionPool})}catch{}},fetchReadiness:async()=>{try{e({readiness:await(await fetch(`/readyz`)).json()})}catch{e({readiness:{status:`not_ready`,checks:{database:!1,config:!1}}})}},connectWebSocket:()=>{let n=t()._ws;if(n&&n.readyState<=1)return;let r=window.location.protocol===`https:`?`wss:`:`ws:`,i=localStorage.getItem(`adam_api_key`),a=new URL(`${r}//${window.location.host}/events`);i&&a.searchParams.set(`api_key`,i);let o=new WebSocket(a.toString());o.onopen=()=>{e({wsConnected:!0,_ws:o,_wsReconnectDelay:1e3})},o.onclose=()=>{let n=t()._wsReconnectDelay;e({wsConnected:!1,_ws:null,_wsReconnectDelay:Math.min(n*2,1e4)}),setTimeout(()=>{t().connectWebSocket()},n)},o.onerror=()=>{o.close()},o.onmessage=n=>{try{ke(JSON.parse(n.data),e,t)}catch{}},e({_ws:o})},disconnectWebSocket:()=>{let n=t()._ws;n&&(n.close(),e({_ws:null,wsConnected:!1}))},addLog:t=>{e(e=>({logs:[...e.logs.slice(-(V-1)),t]}))},addDeliveryLogEntry:t=>{e(e=>({deliveryLog:[t,...e.deliveryLog].slice(0,100)}))},approvePlan:async(t,n,r)=>{await D(`/tasks/${t}/approve-plan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({planId:n,decision:`allow`,approvalType:r})}),e({pendingPlanApproval:null})},denyPlan:async(t,n,r)=>{await D(`/tasks/${t}/approve-plan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({planId:n,decision:`deny`,reason:r??`rejected by user`})}),e({pendingPlanApproval:null})},clearPlanTimeoutNotice:()=>{e({planTimeoutNotice:null})},fetchRoles:async()=>{let{roles:t}=await D(`/roles`);e({roles:t})},createRole:async t=>{let n=await D(`/roles`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});return e(e=>({roles:[...e.roles,n.role]})),n.role},updateRole:async(t,n)=>{let r=await D(`/roles/${t}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});return e(e=>({roles:e.roles.map(e=>e.id===t?{...e,...r.role}:e)})),r.role},deleteRole:async t=>{await D(`/roles/${t}`,{method:`DELETE`}),e(e=>({roles:e.roles.filter(e=>e.id!==t)}))}}));function ke(e,t,n){switch(e.type){case`task_status_change`:t(t=>({tasks:t.tasks.map(t=>t.id===e.taskId?{...t,status:e.newStatus}:t)}));break;case`stats_update`:t(()=>({stats:{activeTasks:e.activeTasks,queuedTasks:e.queuedTasks,totalCostToday:e.totalCostToday}}));break;case`log_event`:n().addLog(e);break;case`goal_status_change`:t(t=>({goals:t.goals.map(t=>t.id===e.goalId?{...t,status:e.newStatus}:t)}));break;case`config_changed`:t(e=>({configVersion:e.configVersion+1}));break;case`execution_slot_change`:t(()=>({executionPool:{active:e.active,max:e.max,queued:e.queued}}));break;case`plan_approval_request`:t(()=>({pendingPlanApproval:{taskId:e.taskId,planId:e.planId,plan:e.plan}}));break;case`plan_approval_decision`:n().pendingPlanApproval?.planId===e.planId&&t(()=>({pendingPlanApproval:null}));break;case`delivery_status_change`:n().addDeliveryLogEntry(e);break}}function Ae(){let[e,t]=(0,A.useState)(!1),r=H(e=>e.wsConnected),i=H(e=>e.connectWebSocket),a=H(e=>e.fetchReadiness);(0,A.useEffect)(()=>{i(),a();let e=setInterval(a,3e4);return()=>clearInterval(e)},[i,a]);let o=(0,A.useCallback)(()=>t(!1),[]);return(0,j.jsxs)(`div`,{className:`flex h-screen overflow-hidden bg-slate-950`,children:[(0,j.jsx)(`a`,{href:`#main-content`,className:`sr-only focus:not-sr-only focus:fixed focus:left-4 focus:top-4 focus:z-50 focus:rounded-md focus:bg-blue-600 focus:px-4 focus:py-2 focus:text-sm focus:font-medium focus:text-white focus:outline-none`,children:`Skip to content`}),(0,j.jsx)(`div`,{className:`hidden lg:block`,children:(0,j.jsx)(N,{})}),e&&(0,j.jsxs)(`div`,{className:`fixed inset-0 z-40 lg:hidden`,children:[(0,j.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:o}),(0,j.jsx)(`div`,{className:`relative z-50 h-full w-60`,children:(0,j.jsx)(N,{onNavigate:o})})]}),(0,j.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,j.jsxs)(`header`,{className:`flex h-14 items-center gap-3 border-b border-slate-800 px-4`,children:[(0,j.jsx)(`button`,{className:`lg:hidden text-slate-400 hover:text-slate-200`,onClick:()=>t(!e),"aria-label":e?`Close menu`:`Open menu`,children:e?(0,j.jsx)(h,{size:20}):(0,j.jsx)(n,{size:20})}),(0,j.jsx)(`div`,{className:`flex-1`}),(0,j.jsx)(`div`,{className:`flex items-center gap-1.5 text-xs`,"aria-live":`polite`,children:r?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(d,{size:14,className:`text-emerald-500`}),(0,j.jsx)(`span`,{className:`text-emerald-400`,children:`Connected`})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(p,{size:14,className:`text-red-500`}),(0,j.jsx)(`span`,{className:`text-red-400`,children:`Disconnected`})]})})]}),(0,j.jsx)(`main`,{id:`main-content`,role:`main`,className:`flex-1 overflow-y-auto p-4 lg:p-6`,children:(0,j.jsx)(_,{})})]}),(0,j.jsx)(Oe,{position:`bottom-center`})]})}function je(e,t){let n=A.createContext(t),r=e=>{let{children:t,...r}=e,i=A.useMemo(()=>r,Object.values(r));return(0,j.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=A.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Me(e,t=[]){let n=[];function r(t,r){let i=A.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=A.useMemo(()=>o,Object.values(o));return(0,j.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=A.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>A.createContext(e));return function(n){let r=n?.[e]||t;return A.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Ne(i,...t)]}function Ne(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return A.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function U(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Pe(...e){return t=>{let n=!1,r=e.map(e=>{let r=U(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():U(e[t],null)}}}}function W(...e){return A.useCallback(Pe(...e),e)}typeof window<`u`&&window.document&&window.document.createElement;function G(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var K=globalThis?.document?A.useLayoutEffect:()=>{},Fe=A.useId||(()=>void 0),Ie=0;function Le(e){let[t,n]=A.useState(Fe());return K(()=>{e||n(e=>e??String(Ie++))},[e]),e||(t?`radix-${t}`:``)}var Re=A.useInsertionEffect||K;function ze({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Be({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=A.useRef(e!==void 0);A.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,A.useCallback(t=>{if(s){let n=Ve(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Be({defaultProp:e,onChange:t}){let[n,r]=A.useState(e),i=A.useRef(n),a=A.useRef(t);return Re(()=>{a.current=t},[t]),A.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Ve(e){return typeof e==`function`}function He(e){let t=Ue(e),n=A.forwardRef((e,n)=>{let{children:r,...i}=e,a=A.Children.toArray(r),o=a.find(Ke);if(o){let e=o.props.children,r=a.map(t=>t===o?A.Children.count(e)>1?A.Children.only(null):A.isValidElement(e)?e.props.children:null:t);return(0,j.jsx)(t,{...i,ref:n,children:A.isValidElement(e)?A.cloneElement(e,void 0,r):null})}return(0,j.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Ue(e){let t=A.forwardRef((e,t)=>{let{children:n,...r}=e;if(A.isValidElement(n)){let e=Je(n),i=qe(r,n.props);return n.type!==A.Fragment&&(i.ref=t?Pe(t,e):e),A.cloneElement(n,i)}return A.Children.count(n)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var We=Symbol(`radix.slottable`);function Ge(e){let t=({children:e})=>(0,j.jsx)(j.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=We,t}function Ke(e){return A.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===We}function qe(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Je(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var q=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=He(`Primitive.${t}`),r=A.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,j.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Ye(e,t){e&&ie.flushSync(()=>e.dispatchEvent(t))}function Xe(e){let t=A.useRef(e);return A.useEffect(()=>{t.current=e}),A.useMemo(()=>(...e)=>t.current?.(...e),[])}function Ze(e,t=globalThis?.document){let n=Xe(e);A.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Qe=`DismissableLayer`,$e=`dismissableLayer.update`,et=`dismissableLayer.pointerDownOutside`,tt=`dismissableLayer.focusOutside`,nt,rt=A.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),it=A.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=A.useContext(rt),[u,d]=A.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=A.useState({}),m=W(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=st(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=ct(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return Ze(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),A.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(nt=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),lt(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=nt)}},[u,f,n,l]),A.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),lt())},[u,l]),A.useEffect(()=>{let e=()=>p({});return document.addEventListener($e,e),()=>document.removeEventListener($e,e)},[]),(0,j.jsx)(q.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:G(e.onFocusCapture,S.onFocusCapture),onBlurCapture:G(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:G(e.onPointerDownCapture,x.onPointerDownCapture)})});it.displayName=Qe;var at=`DismissableLayerBranch`,ot=A.forwardRef((e,t)=>{let n=A.useContext(rt),r=A.useRef(null),i=W(t,r);return A.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,j.jsx)(q.div,{...e,ref:i})});ot.displayName=at;function st(e,t=globalThis?.document){let n=Xe(e),r=A.useRef(!1),i=A.useRef(()=>{});return A.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){ut(et,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ct(e,t=globalThis?.document){let n=Xe(e),r=A.useRef(!1);return A.useEffect(()=>{let e=e=>{e.target&&!r.current&&ut(tt,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function lt(){let e=new CustomEvent($e);document.dispatchEvent(e)}function ut(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Ye(i,a):i.dispatchEvent(a)}var dt=`focusScope.autoFocusOnMount`,ft=`focusScope.autoFocusOnUnmount`,pt={bubbles:!1,cancelable:!0},mt=`FocusScope`,ht=A.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=A.useState(null),l=Xe(i),u=Xe(a),d=A.useRef(null),f=W(t,e=>c(e)),p=A.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;A.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:J(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||J(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&J(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),A.useEffect(()=>{if(s){St.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(dt,pt);s.addEventListener(dt,l),s.dispatchEvent(t),t.defaultPrevented||(gt(Tt(vt(s)),{select:!0}),document.activeElement===e&&J(s))}return()=>{s.removeEventListener(dt,l),setTimeout(()=>{let t=new CustomEvent(ft,pt);s.addEventListener(ft,u),s.dispatchEvent(t),t.defaultPrevented||J(e??document.body,{select:!0}),s.removeEventListener(ft,u),St.remove(p)},0)}}},[s,l,u,p]);let m=A.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=_t(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&J(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&J(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,j.jsx)(q.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});ht.displayName=mt;function gt(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(J(r,{select:t}),document.activeElement!==n)return}function _t(e){let t=vt(e);return[yt(t,e),yt(t.reverse(),e)]}function vt(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function yt(e,t){for(let n of e)if(!bt(n,{upTo:t}))return n}function bt(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function xt(e){return e instanceof HTMLInputElement&&`select`in e}function J(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&xt(e)&&t&&e.select()}}var St=Ct();function Ct(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=wt(e,t),e.unshift(t)},remove(t){e=wt(e,t),e[0]?.resume()}}}function wt(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Tt(e){return e.filter(e=>e.tagName!==`A`)}var Et=`Portal`,Dt=A.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=A.useState(!1);K(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?ie.createPortal((0,j.jsx)(q.div,{...r,ref:t}),o):null});Dt.displayName=Et;function Ot(e,t){return A.useReducer((e,n)=>t[e][n]??e,e)}var kt=e=>{let{present:t,children:n}=e,r=At(t),i=typeof n==`function`?n({present:r.isPresent}):A.Children.only(n),a=W(r.ref,Mt(i));return typeof n==`function`||r.isPresent?A.cloneElement(i,{ref:a}):null};kt.displayName=`Presence`;function At(e){let[t,n]=A.useState(),r=A.useRef(null),i=A.useRef(e),a=A.useRef(`none`),[o,s]=Ot(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return A.useEffect(()=>{let e=jt(r.current);a.current=o===`mounted`?e:`none`},[o]),K(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=jt(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),K(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=jt(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=jt(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:A.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function jt(e){return e?.animationName||`none`}function Mt(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Nt=0;function Pt(){A.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Ft()),document.body.insertAdjacentElement(`beforeend`,e[1]??Ft()),Nt++,()=>{Nt===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Nt--}},[])}function Ft(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Y=function(){return Y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Y.apply(this,arguments)};function It(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Lt(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Rt=`right-scroll-bar-position`,zt=`width-before-scroll-bar`,Bt=`with-scroll-bars-hidden`,Vt=`--removed-body-scroll-bar-size`;function Ht(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ut(e,t){var n=(0,A.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Wt=typeof window<`u`?A.useLayoutEffect:A.useEffect,Gt=new WeakMap;function Kt(e,t){var n=Ut(t||null,function(t){return e.forEach(function(e){return Ht(e,t)})});return Wt(function(){var t=Gt.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Ht(e,null)}),i.forEach(function(e){r.has(e)||Ht(e,a)})}Gt.set(n,e)},[e]),n}function qt(e){return e}function Jt(e,t){t===void 0&&(t=qt);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Yt(e){e===void 0&&(e={});var t=Jt(null);return t.options=Y({async:!0,ssr:!1},e),t}var Xt=function(e){var t=e.sideCar,n=It(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return A.createElement(r,Y({},n))};Xt.isSideCarExport=!0;function Zt(e,t){return e.useMedium(t),Xt}var Qt=Yt(),$t=function(){},en=A.forwardRef(function(e,t){var n=A.useRef(null),r=A.useState({onScrollCapture:$t,onWheelCapture:$t,onTouchMoveCapture:$t}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=It(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Kt([n,t]),C=Y(Y({},b),i);return A.createElement(A.Fragment,null,u&&A.createElement(x,{sideCar:Qt,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?A.cloneElement(A.Children.only(s),Y(Y({},C),{ref:S})):A.createElement(v,Y({},C,{className:c,ref:S}),s))});en.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},en.classNames={fullWidth:zt,zeroRight:Rt};var tn,nn=function(){if(tn)return tn;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function rn(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=nn();return t&&e.setAttribute(`nonce`,t),e}function an(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function on(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var sn=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rn())&&(an(t,n),on(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},cn=function(){var e=sn();return function(t,n){A.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ln=function(){var e=cn();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},un={left:0,top:0,right:0,gap:0},dn=function(e){return parseInt(e||``,10)||0},fn=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[dn(n),dn(r),dn(i)]},pn=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return un;var t=fn(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},mn=ln(),hn=`data-scroll-locked`,gn=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
3
3
|
.${Bt} {
|
|
4
4
|
overflow: hidden ${r};
|
|
@@ -43,10 +43,10 @@ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{A as t,E as n,F as r,Q
|
|
|
43
43
|
|
|
44
44
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
45
45
|
|
|
46
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return A.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Ar=`DialogDescriptionWarning`,jr=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Or(Ar).contentName}}.`;return A.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Mr=ir,Nr=or,Pr=ur,Fr=fr,Ir=hr,Lr=br,Rr=Sr,zr=wr,Br=`AlertDialog`,[Vr,Hr]=Me(Br,[nr]),Q=nr(),Ur=e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,j.jsx)(Mr,{...r,...n,modal:!0})};Ur.displayName=Br;var Wr=`AlertDialogTrigger`,Gr=A.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,j.jsx)(Nr,{...i,...r,ref:t})});Gr.displayName=Wr;var Kr=`AlertDialogPortal`,qr=e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,j.jsx)(Pr,{...r,...n})};qr.displayName=Kr;var Jr=`AlertDialogOverlay`,Yr=A.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,j.jsx)(Fr,{...i,...r,ref:t})});Yr.displayName=Jr;var
|
|
46
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return A.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Ar=`DialogDescriptionWarning`,jr=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Or(Ar).contentName}}.`;return A.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Mr=ir,Nr=or,Pr=ur,Fr=fr,Ir=hr,Lr=br,Rr=Sr,zr=wr,Br=`AlertDialog`,[Vr,Hr]=Me(Br,[nr]),Q=nr(),Ur=e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,j.jsx)(Mr,{...r,...n,modal:!0})};Ur.displayName=Br;var Wr=`AlertDialogTrigger`,Gr=A.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,j.jsx)(Nr,{...i,...r,ref:t})});Gr.displayName=Wr;var Kr=`AlertDialogPortal`,qr=e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,j.jsx)(Pr,{...r,...n})};qr.displayName=Kr;var Jr=`AlertDialogOverlay`,Yr=A.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,j.jsx)(Fr,{...i,...r,ref:t})});Yr.displayName=Jr;var Xr=`AlertDialogContent`,[Zr,Qr]=Vr(Xr),$r=Ge(`AlertDialogContent`),ei=A.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=Q(n),o=A.useRef(null),s=W(t,o),c=A.useRef(null);return(0,j.jsx)(Dr,{contentName:Xr,titleName:ti,docsSlug:`alert-dialog`,children:(0,j.jsx)(Zr,{scope:n,cancelRef:c,children:(0,j.jsxs)(Ir,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:G(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,j.jsx)($r,{children:r}),(0,j.jsx)(li,{contentRef:o})]})})})});ei.displayName=Xr;var ti=`AlertDialogTitle`,ni=A.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,j.jsx)(Lr,{...i,...r,ref:t})});ni.displayName=ti;var ri=`AlertDialogDescription`,ii=A.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,j.jsx)(Rr,{...i,...r,ref:t})});ii.displayName=ri;var ai=`AlertDialogAction`,oi=A.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,j.jsx)(zr,{...i,...r,ref:t})});oi.displayName=ai;var si=`AlertDialogCancel`,ci=A.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=Qr(si,n),a=Q(n),o=W(t,i);return(0,j.jsx)(zr,{...a,...r,ref:o})});ci.displayName=si;var li=({contentRef:e})=>{let t=`\`${Xr}\` requires a description for the component to be accessible for screen reader users.
|
|
47
47
|
|
|
48
|
-
You can add a description to the \`${
|
|
48
|
+
You can add a description to the \`${Xr}\` by passing a \`${ri}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
49
49
|
|
|
50
|
-
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${
|
|
50
|
+
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Xr}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
51
51
|
|
|
52
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return A.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},li=Ur,ui=Gr,di=qr,fi=Yr,pi=$r,mi=ai,hi=si,gi=ti,_i=ri,vi=Symbol.for(`react.lazy`),yi=A.use;function bi(e){return typeof e==`object`&&!!e&&`then`in e}function xi(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===vi&&`_payload`in e&&bi(e._payload)}function Si(e){let t=wi(e),n=A.forwardRef((e,n)=>{let{children:r,...i}=e;xi(r)&&typeof yi==`function`&&(r=yi(r._payload));let a=A.Children.toArray(r),o=a.find(Ei);if(o){let e=o.props.children,r=a.map(t=>t===o?A.Children.count(e)>1?A.Children.only(null):A.isValidElement(e)?e.props.children:null:t);return(0,j.jsx)(t,{...i,ref:n,children:A.isValidElement(e)?A.cloneElement(e,void 0,r):null})}return(0,j.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Ci=Si(`Slot`);function wi(e){let t=A.forwardRef((e,t)=>{let{children:n,...r}=e;if(xi(n)&&typeof yi==`function`&&(n=yi(n._payload)),A.isValidElement(n)){let e=Oi(n),i=Di(r,n.props);return n.type!==A.Fragment&&(i.ref=t?Pe(t,e):e),A.cloneElement(n,i)}return A.Children.count(n)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ti=Symbol(`radix.slottable`);function Ei(e){return A.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ti}function Di(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Oi(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ki=O(`inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-slate-950 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-blue-600 text-white hover:bg-blue-500 active:bg-blue-700`,secondary:`bg-slate-800 text-slate-200 hover:bg-slate-700 active:bg-slate-600 border border-slate-700`,destructive:`bg-red-600 text-white hover:bg-red-500 active:bg-red-700`,ghost:`text-slate-400 hover:text-slate-200 hover:bg-slate-800`,outline:`border border-slate-700 bg-transparent text-slate-200 hover:bg-slate-800 hover:text-slate-100`,link:`text-blue-500 underline-offset-4 hover:underline`},size:{default:`px-3.5 py-1.5`,sm:`px-2.5 py-1 text-xs`,lg:`px-5 py-2`,icon:`h-8 w-8`}},defaultVariants:{variant:`default`,size:`default`}}),Ai=A.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,j.jsx)(r?Ci:`button`,{className:E(ki({variant:t,size:n,className:e})),ref:a,...i}));Ai.displayName=`Button`;var ji=li,Mi=ui,Ni=di,Pi=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(fi,{ref:n,className:E(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Pi.displayName=fi.displayName;var Fi=A.forwardRef(({className:e,...t},n)=>(0,j.jsxs)(Ni,{children:[(0,j.jsx)(Pi,{}),(0,j.jsx)(pi,{ref:n,className:E(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-slate-800 bg-slate-900 p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));Fi.displayName=pi.displayName;var Ii=({className:e,...t})=>(0,j.jsx)(`div`,{className:E(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});Ii.displayName=`AlertDialogHeader`;var Li=({className:e,...t})=>(0,j.jsx)(`div`,{className:E(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Li.displayName=`AlertDialogFooter`;var Ri=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(gi,{ref:n,className:E(`text-lg font-semibold text-slate-100`,e),...t}));Ri.displayName=gi.displayName;var zi=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(_i,{ref:n,className:E(`text-sm text-slate-400`,e),...t}));zi.displayName=_i.displayName;var Bi=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(mi,{ref:n,className:E(ki(),e),...t}));Bi.displayName=mi.displayName;var Vi=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(hi,{ref:n,className:E(ki({variant:`ghost`}),`mt-2 sm:mt-0`,e),...t}));Vi.displayName=hi.displayName;var Hi=O(`inline-flex items-center rounded-md px-2 py-0.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2`,{variants:{variant:{default:`bg-slate-700 text-slate-200`,secondary:`bg-slate-800 text-slate-400`,destructive:`bg-red-900/50 text-red-400 border border-red-800`,outline:`border border-slate-700 text-slate-300`,success:`bg-emerald-900/50 text-emerald-400 border border-emerald-800`,warning:`bg-amber-900/50 text-amber-400 border border-amber-800`,info:`bg-blue-900/50 text-blue-400 border border-blue-800`,muted:`bg-slate-800 text-slate-500`}},defaultVariants:{variant:`default`}});function Ui({className:e,variant:t=`default`,...n}){return(0,j.jsx)(`span`,{className:E(Hi({variant:t}),e),...n})}function Wi(e){switch(e){case`completed`:case`ready`:case`idle`:return`success`;case`running`:case`busy`:case`executing`:case`planning`:case`evaluating`:case`replanning`:return`info`;case`pending`:case`queued`:case`paused`:case`degraded`:return`warning`;case`failed`:case`cancelled`:case`dead`:case`not_ready`:return`destructive`;default:return`muted`}}var Gi=300;function Ki(e){return e===`high`?`destructive`:e===`medium`?`outline`:`secondary`}function qi(){let e=H(e=>e.pendingPlanApproval),t=H(e=>e.approvePlan),n=H(e=>e.denyPlan),r=H(e=>e.planTimeoutNotice),i=H(e=>e.clearPlanTimeoutNotice),[a,o]=(0,A.useState)(Gi),[s,c]=(0,A.useState)(!1);(0,A.useEffect)(()=>{if(!e){o(Gi),c(!1);return}let t=setInterval(()=>{o(e=>e<=1?(clearInterval(t),0):e-1)},1e3);return()=>clearInterval(t)},[e?.planId]),(0,A.useEffect)(()=>{a===0&&e&&!s&&(c(!0),n(e.taskId,e.planId,`timeout`).catch(()=>{}))},[a,e,s,n]);let l=async n=>{if(e){c(!0);try{await t(e.taskId,e.planId,n)}catch{c(!1)}}},u=async()=>{if(e){c(!0);try{await n(e.taskId,e.planId)}catch{c(!1)}}},d=e?.plan;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(ji,{open:!!e,children:(0,j.jsxs)(Fi,{className:`max-w-2xl max-h-[80vh] overflow-y-auto`,children:[(0,j.jsxs)(Ii,{children:[(0,j.jsxs)(Ri,{className:`flex items-center gap-2`,children:[`Execution Plan — Approval Required`,d&&(0,j.jsxs)(Ui,{variant:Ki(d.overallRisk),children:[d.overallRisk.toUpperCase(),` RISK`]})]}),(0,j.jsxs)(zi,{className:`text-xs text-slate-400`,children:[`Plan `,e?.planId,` | Task `,e?.taskId,` | `,a,`s remaining`]})]}),d&&(0,j.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`h4`,{className:`text-sm font-medium text-slate-300 mb-2`,children:[`Plan Steps (`,d.steps.length,`)`]}),(0,j.jsx)(`div`,{className:`space-y-2`,children:d.steps.map(e=>(0,j.jsxs)(`div`,{className:`rounded-md border border-slate-700 bg-slate-800/50 p-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`span`,{className:`text-xs font-mono text-slate-500`,children:[`#`,e.index]}),(0,j.jsx)(`span`,{className:`text-sm text-slate-200`,children:e.description})]}),(0,j.jsx)(Ui,{variant:Ki(e.riskLevel),children:e.riskLevel})]}),(0,j.jsxs)(`div`,{className:`mt-1 text-xs text-slate-400`,children:[`Tools: `,e.toolsNeeded.join(`, `)||`none`]})]},e.index))})]}),Object.keys(d.requiredPermissions).length>0&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h4`,{className:`text-sm font-medium text-slate-300 mb-1`,children:`Required Permissions`}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.keys(d.requiredPermissions).map(e=>(0,j.jsx)(Ui,{variant:`secondary`,children:e},e))})]})]}),(0,j.jsxs)(Li,{children:[(0,j.jsx)(Ai,{variant:`destructive`,onClick:u,disabled:s,children:`Deny`}),(0,j.jsx)(Ai,{variant:`outline`,onClick:()=>l(`permanent`),disabled:s,children:`Allow Permanent`}),(0,j.jsx)(Ai,{onClick:()=>l(`once`),disabled:s,children:`Allow Once`})]})]})}),r&&(0,j.jsxs)(`div`,{className:`fixed bottom-4 right-4 z-50 rounded-md border border-amber-700 bg-amber-950 px-4 py-2 text-sm text-amber-200 shadow-lg`,children:[r,(0,j.jsx)(`button`,{className:`ml-3 text-amber-400 hover:text-amber-200`,onClick:i,children:`Dismiss`})]})]})}var Ji=(0,A.lazy)(()=>y(()=>import(`./Dashboard-C67v0x7e.js`).then(e=>({default:e.Dashboard})),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Yi=(0,A.lazy)(()=>y(()=>import(`./Chat-NrKA_MiZ.js`).then(e=>({default:e.Chat})),__vite__mapDeps([8,1,2,3,5,9,7]))),Xi=(0,A.lazy)(()=>y(()=>import(`./Work-CE6TB6LG.js`).then(e=>({default:e.Work})),__vite__mapDeps([10,1,2,3,11,5,4,12,13,7,6]))),Zi=(0,A.lazy)(()=>y(()=>import(`./TaskDetail-4yYEVV6Z.js`).then(e=>({default:e.TaskDetail})),__vite__mapDeps([14,1,2,3,5,4,7]))),Qi=(0,A.lazy)(()=>y(()=>import(`./Plugins-CXCUhsEZ.js`).then(e=>({default:e.Plugins})),__vite__mapDeps([15,1,2,3,5,4,12,6,7]))),$i=(0,A.lazy)(()=>y(()=>import(`./Strategies-CRdpzdUe.js`).then(e=>({default:e.Strategies})),__vite__mapDeps([16,1,2,3,4,5,12,6,7]))),ea=(0,A.lazy)(()=>y(()=>import(`./Goals-7eD9_7Qo.js`).then(e=>({default:e.Goals})),__vite__mapDeps([13,1,2,3,5,4,12,7]))),ta=(0,A.lazy)(()=>y(()=>import(`./Logs-CDFbfvQT.js`).then(e=>({default:e.Logs})),__vite__mapDeps([17,1,2,3,4,5,12]))),na=(0,A.lazy)(()=>y(()=>import(`./Settings-CzgdtkLo.js`).then(e=>({default:e.Settings})),__vite__mapDeps([18,1,2,3,5,19,4,12,7]))),ra=(0,A.lazy)(()=>y(()=>import(`./Memories-D0J8Es-o.js`).then(e=>({default:e.Memories})),__vite__mapDeps([20,1,2,3,5,4,12,7]))),ia=(0,A.lazy)(()=>y(()=>import(`./Evolution-CbFOTN2o.js`).then(e=>({default:e.Evolution})),__vite__mapDeps([21,1,2,3,5,4,12,7]))),aa=(0,A.lazy)(()=>y(()=>import(`./Channels-Dc6QduC1.js`).then(e=>({default:e.Channels})),__vite__mapDeps([22,1,2,3,5,4,12]))),oa=(0,A.lazy)(()=>y(()=>import(`./GoalDetail-DYUbYJpT.js`).then(e=>({default:e.GoalDetail})),__vite__mapDeps([23,1,2,3,5,4,7]))),sa=(0,A.lazy)(()=>y(()=>import(`./ChannelDetail-DoQs1auJ.js`).then(e=>({default:e.ChannelDetail})),__vite__mapDeps([24,1,2,3,5,4,7]))),ca=(0,A.lazy)(()=>y(()=>import(`./Roles-Bia_f3ml.js`).then(e=>({default:e.Roles})),__vite__mapDeps([25,1,2,3,4,5,12,6,7]))),la=(0,A.lazy)(()=>y(()=>import(`./RoleDetail-C2lXyAjt.js`).then(e=>({default:e.RoleDetail})),__vite__mapDeps([26,1,2,3,11,5,19,4,6,7]))),ua=(0,A.lazy)(()=>y(()=>import(`./NotFound-CSjhzSGa.js`),__vite__mapDeps([27,2,1,3])));function da(){return(0,j.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,j.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-slate-700 border-t-blue-500`})})}function fa(){return(0,j.jsxs)(A.Suspense,{fallback:(0,j.jsx)(da,{}),children:[(0,j.jsx)(ee,{children:(0,j.jsxs)(C,{element:(0,j.jsx)(Ae,{}),children:[(0,j.jsx)(C,{index:!0,element:(0,j.jsx)(Ji,{})}),(0,j.jsx)(C,{path:`chat`,element:(0,j.jsx)(Yi,{})}),(0,j.jsx)(C,{path:`work`,element:(0,j.jsx)(Xi,{})}),(0,j.jsx)(C,{path:`tasks/:id`,element:(0,j.jsx)(Zi,{})}),(0,j.jsx)(C,{path:`plugins`,element:(0,j.jsx)(Qi,{})}),(0,j.jsx)(C,{path:`roles`,element:(0,j.jsx)(ca,{})}),(0,j.jsx)(C,{path:`roles/:id`,element:(0,j.jsx)(la,{})}),(0,j.jsx)(C,{path:`channels`,element:(0,j.jsx)(aa,{})}),(0,j.jsx)(C,{path:`channels/:id`,element:(0,j.jsx)(sa,{})}),(0,j.jsx)(C,{path:`strategies`,element:(0,j.jsx)($i,{})}),(0,j.jsx)(C,{path:`goals`,element:(0,j.jsx)(ea,{})}),(0,j.jsx)(C,{path:`goals/:id`,element:(0,j.jsx)(oa,{})}),(0,j.jsx)(C,{path:`logs`,element:(0,j.jsx)(ta,{})}),(0,j.jsx)(C,{path:`settings`,element:(0,j.jsx)(na,{})}),(0,j.jsx)(C,{path:`memories`,element:(0,j.jsx)(ra,{})}),(0,j.jsx)(C,{path:`evolution`,element:(0,j.jsx)(ia,{})}),(0,j.jsx)(C,{path:`*`,element:(0,j.jsx)(ua,{})})]})}),(0,j.jsx)(qi,{})]})}var pa=v([{path:`*`,element:(0,j.jsx)(fa,{})}],{basename:`/ui`});(0,k.createRoot)(document.getElementById(`root`)).render((0,j.jsx)(A.StrictMode,{children:(0,j.jsx)(re,{children:(0,j.jsx)(S,{router:pa})})}));export{H as C,Me as S,ze as _,Vi as a,G as b,Li as c,Mi as d,Ai as f,He as g,q as h,Bi as i,Ii as l,Xe as m,Wi as n,Fi as o,kt as p,ji as r,zi as s,Ui as t,Ri as u,Le as v,ge as w,W as x,K as y};
|
|
52
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return A.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},ui=Ur,di=Gr,fi=qr,pi=Yr,mi=ei,hi=oi,gi=ci,_i=ni,vi=ii,yi=Symbol.for(`react.lazy`),bi=A.use;function xi(e){return typeof e==`object`&&!!e&&`then`in e}function Si(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===yi&&`_payload`in e&&xi(e._payload)}function Ci(e){let t=Ti(e),n=A.forwardRef((e,n)=>{let{children:r,...i}=e;Si(r)&&typeof bi==`function`&&(r=bi(r._payload));let a=A.Children.toArray(r),o=a.find(Di);if(o){let e=o.props.children,r=a.map(t=>t===o?A.Children.count(e)>1?A.Children.only(null):A.isValidElement(e)?e.props.children:null:t);return(0,j.jsx)(t,{...i,ref:n,children:A.isValidElement(e)?A.cloneElement(e,void 0,r):null})}return(0,j.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var wi=Ci(`Slot`);function Ti(e){let t=A.forwardRef((e,t)=>{let{children:n,...r}=e;if(Si(n)&&typeof bi==`function`&&(n=bi(n._payload)),A.isValidElement(n)){let e=ki(n),i=Oi(r,n.props);return n.type!==A.Fragment&&(i.ref=t?Pe(t,e):e),A.cloneElement(n,i)}return A.Children.count(n)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ei=Symbol(`radix.slottable`);function Di(e){return A.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ei}function Oi(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function ki(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ai=O(`inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-slate-950 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-blue-600 text-white hover:bg-blue-500 active:bg-blue-700`,secondary:`bg-slate-800 text-slate-200 hover:bg-slate-700 active:bg-slate-600 border border-slate-700`,destructive:`bg-red-600 text-white hover:bg-red-500 active:bg-red-700`,ghost:`text-slate-400 hover:text-slate-200 hover:bg-slate-800`,outline:`border border-slate-700 bg-transparent text-slate-200 hover:bg-slate-800 hover:text-slate-100`,link:`text-blue-500 underline-offset-4 hover:underline`},size:{default:`px-3.5 py-1.5`,sm:`px-2.5 py-1 text-xs`,lg:`px-5 py-2`,icon:`h-8 w-8`}},defaultVariants:{variant:`default`,size:`default`}}),ji=A.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,j.jsx)(r?wi:`button`,{className:E(Ai({variant:t,size:n,className:e})),ref:a,...i}));ji.displayName=`Button`;var Mi=ui,Ni=di,Pi=fi,Fi=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(pi,{ref:n,className:E(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Fi.displayName=pi.displayName;var Ii=A.forwardRef(({className:e,...t},n)=>(0,j.jsxs)(Pi,{children:[(0,j.jsx)(Fi,{}),(0,j.jsx)(mi,{ref:n,className:E(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-slate-800 bg-slate-900 p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));Ii.displayName=mi.displayName;var Li=({className:e,...t})=>(0,j.jsx)(`div`,{className:E(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});Li.displayName=`AlertDialogHeader`;var Ri=({className:e,...t})=>(0,j.jsx)(`div`,{className:E(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Ri.displayName=`AlertDialogFooter`;var zi=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(_i,{ref:n,className:E(`text-lg font-semibold text-slate-100`,e),...t}));zi.displayName=_i.displayName;var Bi=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(vi,{ref:n,className:E(`text-sm text-slate-400`,e),...t}));Bi.displayName=vi.displayName;var Vi=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(hi,{ref:n,className:E(Ai(),e),...t}));Vi.displayName=hi.displayName;var Hi=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(gi,{ref:n,className:E(Ai({variant:`ghost`}),`mt-2 sm:mt-0`,e),...t}));Hi.displayName=gi.displayName;var Ui=O(`inline-flex items-center rounded-md px-2 py-0.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2`,{variants:{variant:{default:`bg-slate-700 text-slate-200`,secondary:`bg-slate-800 text-slate-400`,destructive:`bg-red-900/50 text-red-400 border border-red-800`,outline:`border border-slate-700 text-slate-300`,success:`bg-emerald-900/50 text-emerald-400 border border-emerald-800`,warning:`bg-amber-900/50 text-amber-400 border border-amber-800`,info:`bg-blue-900/50 text-blue-400 border border-blue-800`,muted:`bg-slate-800 text-slate-500`}},defaultVariants:{variant:`default`}});function Wi({className:e,variant:t=`default`,...n}){return(0,j.jsx)(`span`,{className:E(Ui({variant:t}),e),...n})}function Gi(e){switch(e){case`completed`:case`ready`:case`idle`:return`success`;case`running`:case`busy`:case`executing`:case`planning`:case`evaluating`:case`replanning`:return`info`;case`pending`:case`queued`:case`paused`:case`degraded`:return`warning`;case`failed`:case`cancelled`:case`dead`:case`not_ready`:return`destructive`;default:return`muted`}}var Ki=300;function qi(e){return e===`high`?`destructive`:e===`medium`?`outline`:`secondary`}function Ji(){let e=H(e=>e.pendingPlanApproval),t=H(e=>e.approvePlan),n=H(e=>e.denyPlan),r=H(e=>e.planTimeoutNotice),i=H(e=>e.clearPlanTimeoutNotice),[a,o]=(0,A.useState)(Ki),[s,c]=(0,A.useState)(!1);(0,A.useEffect)(()=>{if(!e){o(Ki),c(!1);return}let t=setInterval(()=>{o(e=>e<=1?(clearInterval(t),0):e-1)},1e3);return()=>clearInterval(t)},[e?.planId]),(0,A.useEffect)(()=>{a===0&&e&&!s&&(c(!0),n(e.taskId,e.planId,`timeout`).catch(()=>{}))},[a,e,s,n]);let l=async n=>{if(e){c(!0);try{await t(e.taskId,e.planId,n)}catch{c(!1)}}},u=async()=>{if(e){c(!0);try{await n(e.taskId,e.planId)}catch{c(!1)}}},d=e?.plan;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Mi,{open:!!e,children:(0,j.jsxs)(Ii,{className:`max-w-2xl max-h-[80vh] overflow-y-auto`,children:[(0,j.jsxs)(Li,{children:[(0,j.jsxs)(zi,{className:`flex items-center gap-2`,children:[`Execution Plan — Approval Required`,d&&(0,j.jsxs)(Wi,{variant:qi(d.overallRisk),children:[d.overallRisk.toUpperCase(),` RISK`]})]}),(0,j.jsxs)(Bi,{className:`text-xs text-slate-400`,children:[`Plan `,e?.planId,` | Task `,e?.taskId,` | `,a,`s remaining`]})]}),d&&(0,j.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`h4`,{className:`text-sm font-medium text-slate-300 mb-2`,children:[`Plan Steps (`,d.steps.length,`)`]}),(0,j.jsx)(`div`,{className:`space-y-2`,children:d.steps.map(e=>(0,j.jsxs)(`div`,{className:`rounded-md border border-slate-700 bg-slate-800/50 p-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`span`,{className:`text-xs font-mono text-slate-500`,children:[`#`,e.index]}),(0,j.jsx)(`span`,{className:`text-sm text-slate-200`,children:e.description})]}),(0,j.jsx)(Wi,{variant:qi(e.riskLevel),children:e.riskLevel})]}),(0,j.jsxs)(`div`,{className:`mt-1 text-xs text-slate-400`,children:[`Tools: `,e.toolsNeeded.join(`, `)||`none`]})]},e.index))})]}),Object.keys(d.requiredPermissions).length>0&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h4`,{className:`text-sm font-medium text-slate-300 mb-1`,children:`Required Permissions`}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.keys(d.requiredPermissions).map(e=>(0,j.jsx)(Wi,{variant:`secondary`,children:e},e))})]})]}),(0,j.jsxs)(Ri,{children:[(0,j.jsx)(ji,{variant:`destructive`,onClick:u,disabled:s,children:`Deny`}),(0,j.jsx)(ji,{variant:`outline`,onClick:()=>l(`permanent`),disabled:s,children:`Allow Permanent`}),(0,j.jsx)(ji,{onClick:()=>l(`once`),disabled:s,children:`Allow Once`})]})]})}),r&&(0,j.jsxs)(`div`,{className:`fixed bottom-4 right-4 z-50 rounded-md border border-amber-700 bg-amber-950 px-4 py-2 text-sm text-amber-200 shadow-lg`,children:[r,(0,j.jsx)(`button`,{className:`ml-3 text-amber-400 hover:text-amber-200`,onClick:i,children:`Dismiss`})]})]})}function $(e){return(0,A.lazy)(()=>e().catch(e=>{let t=`chunk-reload-`+window.location.pathname;if(!sessionStorage.getItem(t))return sessionStorage.setItem(t,`1`),window.location.reload(),new Promise(()=>{});throw sessionStorage.removeItem(t),e}))}var Yi=$(()=>y(()=>import(`./Dashboard-cDHpOWnY.js`).then(e=>({default:e.Dashboard})),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Xi=$(()=>y(()=>import(`./Chat-Bha4vXwT.js`).then(e=>({default:e.Chat})),__vite__mapDeps([8,1,2,3,5,9,7]))),Zi=$(()=>y(()=>import(`./Work-BpKK_uXA.js`).then(e=>({default:e.Work})),__vite__mapDeps([10,1,2,3,11,5,4,12,13,7,6]))),Qi=$(()=>y(()=>import(`./TaskDetail-DEg_oUwx.js`).then(e=>({default:e.TaskDetail})),__vite__mapDeps([14,1,2,3,5,4,7]))),$i=$(()=>y(()=>import(`./Plugins-gcMpBdyq.js`).then(e=>({default:e.Plugins})),__vite__mapDeps([15,1,2,3,5,4,12,6,7]))),ea=$(()=>y(()=>import(`./Strategies-CO4LwZjS.js`).then(e=>({default:e.Strategies})),__vite__mapDeps([16,1,2,3,4,5,12,6,7]))),ta=$(()=>y(()=>import(`./Goals-DdM0tFus.js`).then(e=>({default:e.Goals})),__vite__mapDeps([13,1,2,3,5,4,12,7]))),na=$(()=>y(()=>import(`./Logs-DJhpDtCA.js`).then(e=>({default:e.Logs})),__vite__mapDeps([17,1,2,3,4,5,12]))),ra=$(()=>y(()=>import(`./Settings-JbgBxBeo.js`).then(e=>({default:e.Settings})),__vite__mapDeps([18,1,2,3,5,19,4,12,7]))),ia=$(()=>y(()=>import(`./Memories-CYN99g2T.js`).then(e=>({default:e.Memories})),__vite__mapDeps([20,1,2,3,5,4,12,7]))),aa=$(()=>y(()=>import(`./Evolution-Ao-gdHbS.js`).then(e=>({default:e.Evolution})),__vite__mapDeps([21,1,2,3,5,4,12,7]))),oa=$(()=>y(()=>import(`./Channels-2veauYsm.js`).then(e=>({default:e.Channels})),__vite__mapDeps([22,1,2,3,5,4,12]))),sa=$(()=>y(()=>import(`./GoalDetail-CX2i9A5a.js`).then(e=>({default:e.GoalDetail})),__vite__mapDeps([23,1,2,3,5,4,7]))),ca=$(()=>y(()=>import(`./ChannelDetail-eWtIGhAd.js`).then(e=>({default:e.ChannelDetail})),__vite__mapDeps([24,1,2,3,5,4,7]))),la=$(()=>y(()=>import(`./Roles-CCy1H7PY.js`).then(e=>({default:e.Roles})),__vite__mapDeps([25,1,2,3,4,5,12,6,7]))),ua=$(()=>y(()=>import(`./RoleDetail-s7u-Shk3.js`).then(e=>({default:e.RoleDetail})),__vite__mapDeps([26,1,2,3,11,5,19,4,6,7]))),da=$(()=>y(()=>import(`./NotFound-CSjhzSGa.js`),__vite__mapDeps([27,2,1,3])));function fa(){return(0,j.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,j.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-slate-700 border-t-blue-500`})})}function pa(){return(0,j.jsxs)(A.Suspense,{fallback:(0,j.jsx)(fa,{}),children:[(0,j.jsx)(ee,{children:(0,j.jsxs)(C,{element:(0,j.jsx)(Ae,{}),children:[(0,j.jsx)(C,{index:!0,element:(0,j.jsx)(Yi,{})}),(0,j.jsx)(C,{path:`chat`,element:(0,j.jsx)(Xi,{})}),(0,j.jsx)(C,{path:`work`,element:(0,j.jsx)(Zi,{})}),(0,j.jsx)(C,{path:`tasks/:id`,element:(0,j.jsx)(Qi,{})}),(0,j.jsx)(C,{path:`plugins`,element:(0,j.jsx)($i,{})}),(0,j.jsx)(C,{path:`roles`,element:(0,j.jsx)(la,{})}),(0,j.jsx)(C,{path:`roles/:id`,element:(0,j.jsx)(ua,{})}),(0,j.jsx)(C,{path:`channels`,element:(0,j.jsx)(oa,{})}),(0,j.jsx)(C,{path:`channels/:id`,element:(0,j.jsx)(ca,{})}),(0,j.jsx)(C,{path:`strategies`,element:(0,j.jsx)(ea,{})}),(0,j.jsx)(C,{path:`goals`,element:(0,j.jsx)(ta,{})}),(0,j.jsx)(C,{path:`goals/:id`,element:(0,j.jsx)(sa,{})}),(0,j.jsx)(C,{path:`logs`,element:(0,j.jsx)(na,{})}),(0,j.jsx)(C,{path:`settings`,element:(0,j.jsx)(ra,{})}),(0,j.jsx)(C,{path:`memories`,element:(0,j.jsx)(ia,{})}),(0,j.jsx)(C,{path:`evolution`,element:(0,j.jsx)(aa,{})}),(0,j.jsx)(C,{path:`*`,element:(0,j.jsx)(da,{})})]})}),(0,j.jsx)(Ji,{})]})}var ma=v([{path:`*`,element:(0,j.jsx)(pa,{})}],{basename:`/ui`});(0,k.createRoot)(document.getElementById(`root`)).render((0,j.jsx)(A.StrictMode,{children:(0,j.jsx)(re,{children:(0,j.jsx)(S,{router:ma})})}));export{H as C,Me as S,ze as _,Hi as a,G as b,Ri as c,Ni as d,ji as f,He as g,q as h,Vi as i,Li as l,Xe as m,Gi as n,Ii as o,kt as p,Mi as r,Bi as s,Wi as t,zi as u,Le as v,ge as w,W as x,K as y};
|
package/web/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/ui/favicon.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Adam</title>
|
|
8
|
-
<script type="module" crossorigin src="/ui/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/ui/assets/index-rvaixveh.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/ui/assets/rolldown-runtime-Dw2cE7zH.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/ui/assets/vendor-icons-CkI4-NxL.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/ui/assets/vendor-react-DLRtONKt.js">
|