apteva 0.4.44 → 0.4.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ActivityPage.c48n83h2.js → ActivityPage.sw9p594m.js} +1 -1
- package/dist/{ApiDocsPage.yzcxx5ax.js → ApiDocsPage.90e03bz7.js} +1 -1
- package/dist/App.0ws87fpx.js +53 -0
- package/dist/App.3vnrera5.js +4 -0
- package/dist/App.94x6mh7f.js +20 -0
- package/dist/{App.qzbx5wtj.js → App.9sryp183.js} +1 -1
- package/dist/App.d9tny4t0.js +221 -0
- package/dist/{App.r5serxkt.js → App.jhb45d7r.js} +1 -1
- package/dist/App.p7jjw1zf.js +4 -0
- package/dist/App.pfbdzrhh.js +4 -0
- package/dist/App.stgng5bx.js +13 -0
- package/dist/{App.152mbs1r.js → App.tm3k7h4b.js} +1 -1
- package/dist/App.vkg121c6.js +4 -0
- package/dist/App.wghtdzsk.js +1 -0
- package/dist/App.xf7wsckg.js +4 -0
- package/dist/App.xva0tfzh.js +4 -0
- package/dist/App.ysxy7akk.js +61 -0
- package/dist/App.yzkh4gq2.js +4 -0
- package/dist/ConnectionsPage.q5f9fd37.js +3 -0
- package/dist/McpPage.f3ccrezb.js +3 -0
- package/dist/SettingsPage.3sqx6wm4.js +3 -0
- package/dist/SkillsPage.whxnez67.js +3 -0
- package/dist/TasksPage.zp4jfevw.js +3 -0
- package/dist/TelemetryPage.a9fmxq87.js +3 -0
- package/dist/TestsPage.18krj0d1.js +3 -0
- package/dist/ThreadsPage.nnphgy98.js +3 -0
- package/dist/apteva-kit.css +1 -1
- package/dist/index.html +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -4
- package/src/db.ts +42 -4
- package/src/providers.ts +14 -9
- package/src/routes/api/agent-utils.ts +25 -3
- package/src/routes/api/telemetry.ts +20 -2
- package/src/server.ts +52 -1
- package/src/web/App.tsx +1 -1
- package/src/web/components/agents/AgentCard.tsx +9 -7
- package/src/web/components/agents/AgentPanel.tsx +205 -44
- package/src/web/components/agents/CreateAgentModal.tsx +5 -5
- package/src/web/components/auth/LoginPage.tsx +2 -2
- package/src/web/components/common/LoadingSpinner.tsx +1 -1
- package/src/web/components/common/Modal.tsx +6 -6
- package/src/web/components/common/Select.tsx +2 -2
- package/src/web/components/connections/ConnectionsPage.tsx +1 -1
- package/src/web/components/connections/IntegrationsTab.tsx +3 -3
- package/src/web/components/connections/OverviewTab.tsx +3 -3
- package/src/web/components/connections/TriggersTab.tsx +8 -8
- package/src/web/components/dashboard/Dashboard.tsx +2 -2
- package/src/web/components/layout/Header.tsx +3 -3
- package/src/web/components/layout/Sidebar.tsx +3 -2
- package/src/web/components/mcp/McpPage.tsx +13 -13
- package/src/web/components/onboarding/OnboardingWizard.tsx +2 -2
- package/src/web/components/settings/SettingsPage.tsx +55 -22
- package/src/web/components/skills/SkillsPage.tsx +7 -7
- package/src/web/components/tasks/TasksPage.tsx +212 -36
- package/src/web/components/telemetry/TelemetryPage.tsx +278 -9
- package/src/web/components/tests/TestsPage.tsx +2 -2
- package/src/web/components/threads/ThreadsPage.tsx +2 -2
- package/src/web/context/ThemeContext.tsx +31 -10
- package/src/web/index.html +1 -6
- package/src/web/styles.css +47 -0
- package/src/web/themes.ts +68 -5
- package/dist/App.09yb8t0b.js +0 -1
- package/dist/App.3a67nx9w.js +0 -4
- package/dist/App.9epx6785.js +0 -4
- package/dist/App.d8955awp.js +0 -4
- package/dist/App.drwb57jq.js +0 -4
- package/dist/App.gssbmajb.js +0 -4
- package/dist/App.qw70pc29.js +0 -53
- package/dist/App.tpmp9020.js +0 -20
- package/dist/App.v2wb4d7d.js +0 -61
- package/dist/App.vxmaaj0m.js +0 -13
- package/dist/App.w4p2tda9.js +0 -4
- package/dist/App.wv2ng55q.js +0 -221
- package/dist/App.yncnrn0f.js +0 -4
- package/dist/ConnectionsPage.k6cspyqq.js +0 -3
- package/dist/McpPage.cdxm48xj.js +0 -3
- package/dist/SettingsPage.evpv7c2y.js +0 -3
- package/dist/SkillsPage.pvzp6c1a.js +0 -3
- package/dist/TasksPage.6jnvbpsy.js +0 -3
- package/dist/TelemetryPage.t7vk24zc.js +0 -3
- package/dist/TestsPage.5x6658aa.js +0 -3
- package/dist/ThreadsPage.3fvhtevh.js +0 -3
package/dist/App.yncnrn0f.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{j as fN}from"./App.152mbs1r.js";import{U as x}from"./App.drwb57jq.js";import{$ as Xv,X as O,aa as I,ja as g,ma as o}from"./App.tpmp9020.js";var $N=O(Xv(),1);var D=O(Xv(),1);var U=O(I(),1);function NN(){let{authFetch:R}=g(),{currentProjectId:H}=o(),[J,F]=D.useState([]),[Q,c]=D.useState([]),[W,a]=D.useState(!0);if(D.useEffect(()=>{(async()=>{a(!0);let A=H&&H!=="unassigned"?`?project_id=${H}`:"";try{let[l,S]=await Promise.all([R(`/api/subscriptions${A}`).catch(()=>null),R("/api/agents").catch(()=>null)]);if(l?.ok){let G=await l.json();F(G.subscriptions||[])}if(S?.ok){let G=await S.json();c(G.agents||[])}}catch(l){console.error("Failed to fetch overview data:",l)}a(!1)})()},[R,H]),W)return U.jsxDEV("div",{className:"text-center py-12 text-[var(--color-text-muted)]",children:"Loading..."},void 0,!1,void 0,this);let y=J.filter((Y)=>Y.enabled),T=J.filter((Y)=>!Y.enabled),P=new Map(Q.map((Y)=>[Y.id,Y]));return U.jsxDEV("div",{className:"space-y-6",children:[U.jsxDEV("div",{className:"grid grid-cols-3 gap-4",children:[U.jsxDEV(Cv,{label:"Active",value:y.length},void 0,!1,void 0,this),U.jsxDEV(Cv,{label:"Disabled",value:T.length},void 0,!1,void 0,this),U.jsxDEV(Cv,{label:"Total",value:J.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("section",{children:[U.jsxDEV("h3",{className:"text-sm font-medium text-[var(--color-text-secondary)] mb-3",children:["Subscriptions (",J.length,")"]},void 0,!0,void 0,this),J.length===0?U.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg p-6 text-center text-[var(--color-text-muted)] text-sm",children:"No subscriptions yet. Go to the Triggers tab to create one."},void 0,!1,void 0,this):U.jsxDEV("div",{className:"space-y-2",children:J.map((Y)=>{let A=P.get(Y.agent_id);return U.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg p-3 flex items-center gap-3",children:[U.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${Y.enabled?"bg-green-400":"bg-[var(--color-text-faint)]"}`},void 0,!1,void 0,this),U.jsxDEV("div",{className:"flex-1 min-w-0",children:[U.jsxDEV("div",{className:"text-sm font-medium truncate",children:Y.trigger_slug.replace(/_/g," ").replace(/-/g," ")},void 0,!1,void 0,this),U.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)]",children:Y.trigger_instance_id?`ID: ${Y.trigger_instance_id.slice(0,12)}...`:"All instances"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("div",{className:"text-xs text-[var(--color-text-secondary)] flex-shrink-0",children:[U.jsxDEV("span",{className:"text-[var(--color-text-faint)]",children:"→"},void 0,!1,void 0,this)," ",U.jsxDEV("span",{className:"text-[var(--color-accent)]",children:A?.name||"Unknown Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("span",{className:`text-xs px-2 py-0.5 rounded flex-shrink-0 ${Y.enabled?"bg-green-500/10 text-green-400":"bg-[var(--color-surface-raised)] text-[var(--color-text-faint)]"}`,children:Y.enabled?"active":"disabled"},void 0,!1,void 0,this)]},Y.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Cv({label:R,value:H,valueColor:J}){return U.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg p-4",children:[U.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] mb-1",children:R},void 0,!1,void 0,this),U.jsxDEV("div",{className:`text-2xl font-bold ${J||"text-[var(--color-text)]"}`,children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var $=O(Xv(),1);var i=O(I(),1);function lN({message:R="Loading...",fullScreen:H=!1}){let J=i.jsxDEV("div",{className:"flex items-center gap-3 text-[var(--color-text-muted)]",children:[i.jsxDEV("svg",{className:"animate-spin h-5 w-5",viewBox:"0 0 24 24",children:[i.jsxDEV("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"},void 0,!1,void 0,this),i.jsxDEV("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.jsxDEV("span",{children:R},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(H)return i.jsxDEV("div",{className:"min-h-screen bg-[var(--color-bg)] text-[var(--color-text)] font-mono flex items-center justify-center",children:J},void 0,!1,void 0,this);return i.jsxDEV("div",{className:"flex items-center justify-center py-20",children:J},void 0,!1,void 0,this)}var N=O(I(),1);function mN(){let{authFetch:R}=g(),{currentProjectId:H}=o(),[J,F]=$.useState([]),[Q,c]=$.useState(""),[W,a]=$.useState([]),[y,T]=$.useState(!0),[P,Y]=$.useState([]),[A,l]=$.useState([]),[S,G]=$.useState(!1),[b,k]=$.useState(""),[j,Fv]=$.useState(""),[RN,mv]=$.useState(!1),[B,fv]=$.useState(null),[_v,zN]=$.useState([]),[$v,lv]=$.useState(""),[Yv,Rv]=$.useState(!1),[r,Iv]=$.useState(""),[Zv,nv]=$.useState({}),[Pv,GN]=$.useState(""),[HN,qv]=$.useState(!1),[p,JN]=$.useState([]),[KN,kv]=$.useState(!1),[yv,UN]=$.useState([]),[Qv,XN]=$.useState([]),[s,Av]=$.useState(""),[t,Wv]=$.useState(""),[e,hv]=$.useState(""),[iv,av]=$.useState(!1),[Bv,zv]=$.useState({}),[Tv,YN]=$.useState(""),[Sv,Gv]=$.useState(!1),[Mv,pv]=$.useState(""),[uv,Hv]=$.useState(!1),[Ov,xv]=$.useState(""),[ZN,Jv]=$.useState(!1),[V,Lv]=$.useState(""),[Kv,bv]=$.useState(""),[cv,Vv]=$.useState(!1),[h,qN]=$.useState([]),[dv,Z]=$.useState(null),X=H&&H!=="unassigned"?`?project_id=${H}`:"",Ev=$.useCallback(async()=>{try{let v=await R(`/api/triggers/providers${X}`);if(v.ok){let f=((await v.json()).providers||[]).filter((_)=>_.connected);if(F(f),f.length>0)c((_)=>{if(!_||!f.find((K)=>K.id===_))return f[0].id;return _})}}catch(v){console.error("Failed to fetch providers:",v)}},[R]),u=$.useCallback(async()=>{T(!0);try{let v=`provider=${Q}`,m=X?"&":"?",f=X?`/api/triggers${X}&${v}`:`/api/triggers?${v}`,_=await R(f);if(_.ok){let K=await _.json();a(K.triggers||[])}}catch(v){console.error("Failed to fetch triggers:",v)}T(!1)},[R,X,Q]),vv=$.useCallback(async()=>{try{let v=await R(`/api/subscriptions${X}`);if(v.ok){let m=await v.json();Y(m.subscriptions||[])}}catch(v){console.error("Failed to fetch subscriptions:",v)}},[R,X]),Dv=$.useCallback(async()=>{try{let v=await R(`/api/agents${X}`);if(v.ok){let m=await v.json();qN(m.agents||[])}}catch(v){}},[R,X]);$.useEffect(()=>{Ev(),u(),vv(),Dv()},[Ev,u,vv,Dv]);let QN=async(v)=>{G(!0);try{let m=`/api/triggers/types?provider=${Q}`;if(v)m+=`&toolkit_slugs=${v}`;if(H&&H!=="unassigned")m+=`&project_id=${H}`;let f=await R(m);if(f.ok){let _=await f.json();l(_.types||[])}else{let _=await f.json();Z(_.error||"Failed to fetch trigger types")}}catch(m){Z("Failed to fetch trigger types")}G(!1)},WN=async()=>{try{let v=await R(`/api/integrations/${Q}/connected${X}`);if(v.ok){let m=await v.json();zN((m.accounts||[]).filter((f)=>f.status==="active"))}}catch(v){}},BN=(v)=>{fv(v),lv(""),Iv(""),nv({}),GN(""),mv(!0),WN()},C=Q==="agentdojo",MN=async()=>{qv(!0),Wv(""),Av(""),hv(""),zv({}),YN("");let v=async()=>{if(p.length>0)return;kv(!0);try{let _="/api/triggers/types?provider=agentdojo";if(H&&H!=="unassigned")_+=`&project_id=${H}`;let L=await(await R(_)).json();JN(L.types||[])}catch(_){console.error("Failed to load trigger types:",_)}kv(!1)},m=async()=>{try{let _=`/api/integrations/agentdojo/connected${X}`,q=((await(await R(_)).json()).accounts||[]).filter((E)=>E.status==="active");UN(q)}catch(_){console.error("Failed to load connected accounts:",_)}},f=async()=>{if(Qv.length>0)return;try{let _=`/api/integrations/agentdojo/apps${X}`,L=await(await R(_)).json();XN((L.apps||[]).map((q)=>({id:q.id,name:q.name,slug:q.slug,logo:q.logo})))}catch(_){console.error("Failed to load apps:",_)}};await Promise.all([v(),m(),f()])},ON=async()=>{let v=p.find((f)=>f.slug===t),m=Uv;if(!v||!e||!m)return;av(!0),Z(null);try{let f=h.find((FN)=>FN.id===e),_="provider=agentdojo",K=X?`/api/triggers${X}&provider=agentdojo`:"/api/triggers?provider=agentdojo",L={callback_url:`${window.location.origin}/api/webhooks/agentdojo`,title:`${v.name} → ${f?.name||"Agent"}`,server:v.toolkit_slug,agent_id:e,...Bv},q=await R(K,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:v.slug,connectedAccountId:m.id,config:L})}),E=await q.json();if(!q.ok)Z(E.error||"Failed to create subscription");else qv(!1),u()}catch(f){Z(f.message||"Failed to create subscription")}av(!1)},LN=async()=>{if(!B)return;if(C){if(!r||!Nv)return;Rv(!0),Z(null);try{let v=h.find((q)=>q.id===r),m=window.location.origin,f=`provider=${Q}`,_=X?`/api/triggers${X}&${f}`:`/api/triggers?${f}`,K=await R(_,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:B.slug,connectedAccountId:Nv.id,config:{callback_url:`${m}/api/webhooks/agentdojo`,title:`${B.name} → ${v?.name||"Agent"}`,server:B.toolkit_slug,agent_id:r,...Zv}})}),L=await K.json();if(!K.ok)Z(L.error||"Failed to create subscription");else mv(!1),fv(null),u()}catch(v){Z(v.message||"Failed to create subscription")}Rv(!1);return}if(!$v)return;Rv(!0),Z(null);try{let v=`provider=${Q}`,m=X?`/api/triggers${X}&${v}`:`/api/triggers?${v}`,f=await R(m,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:B.slug,connectedAccountId:$v})}),_=await f.json();if(!f.ok)Z(_.error||"Failed to create trigger");else mv(!1),fv(null),u()}catch(v){Z(v.message||"Failed to create trigger")}Rv(!1)},gv=async(v,m)=>{let f=m==="active"?"disable":"enable";try{let _=X?`&provider=${Q}`:`?provider=${Q}`,K=await R(`/api/triggers/${v}/${f}${X}${_}`,{method:"POST"});if(K.ok)u();else{let L=await K.json();Z(L.error||`Failed to ${f} trigger`)}}catch(_){Z(`Failed to ${f} trigger`)}},ov=async(v)=>{try{let m=X?`&provider=${Q}`:`?provider=${Q}`,f=await R(`/api/triggers/${v}${X}${m}`,{method:"DELETE"});if(f.ok)u();else{let _=await f.json();Z(_.error||"Failed to delete trigger")}}catch(m){Z("Failed to delete trigger")}},bN=async()=>{if(!V||!Kv)return;let v=W.find((m)=>m.id===V);if(!v)return;Vv(!0),Z(null);try{let m=await R("/api/subscriptions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({trigger_slug:v.trigger_slug,trigger_instance_id:v.id,agent_id:Kv,provider:Q,project_id:H&&H!=="unassigned"?H:null,public_url:window.location.origin})}),f=await m.json();if(!m.ok)Z(f.error||"Failed to create subscription");else Jv(!1),Lv(""),bv(""),vv()}catch(m){Z(m.message||"Failed to create subscription")}Vv(!1)},wN=async(v)=>{let m=v.enabled?"disable":"enable";try{if((await R(`/api/subscriptions/${v.id}/${m}`,{method:"POST"})).ok)vv()}catch(f){Z(`Failed to ${m} subscription`)}},CN=async(v)=>{try{if((await R(`/api/subscriptions/${v}`,{method:"DELETE"})).ok)vv()}catch(m){Z("Failed to delete subscription")}},wv=A.filter((v)=>{if(!j)return!0;let m=j.toLowerCase();return v.name.toLowerCase().includes(m)||v.slug.toLowerCase().includes(m)||v.description.toLowerCase().includes(m)}),jv=(v,m)=>{if(!m||v.length===0)return null;let f=m.toLowerCase().replace(/[-_]/g," "),_=v.find((q)=>q.appId?.toLowerCase()===m.toLowerCase()||q.appName?.toLowerCase()===m.toLowerCase());if(_)return _;let K=v.find((q)=>q.appId?.toLowerCase().includes(f)||q.appName?.toLowerCase().replace(/[-_]/g," ").includes(f)||f.includes(q.appId?.toLowerCase()||"")||f.includes(q.appName?.toLowerCase().replace(/[-_]/g," ")||""));if(K)return K;let L=f.split(/\s+/);return v.find((q)=>{let E=(q.appName||"").toLowerCase().replace(/[-_]/g," ").split(/\s+/);return L[0]&&E[0]&&L[0]===E[0]})||null},M=p.find((v)=>v.slug===t),rv=M?jv(yv,M.toolkit_slug):null,Uv=Tv?yv.find((v)=>v.id===Tv)||rv:rv,sv=B&&C?jv(_v,B.toolkit_slug):null,Nv=Pv?_v.find((v)=>v.id===Pv)||sv:sv,tv=$.default.useMemo(()=>{let v=new Map;for(let f of Qv)if(f.logo)v.set(f.slug,f.logo);let m=new Map;for(let f of p){let _=m.get(f.toolkit_slug);if(_)_.count++;else{let K=v.get(f.toolkit_slug)||f.logo||null;m.set(f.toolkit_slug,{slug:f.toolkit_slug,name:f.toolkit_name,logo:K,count:1})}}return Array.from(m.values()).sort((f,_)=>f.name.localeCompare(_.name))},[p,Qv]),ev=s?p.filter((v)=>v.toolkit_slug===s):[],d=tv.find((v)=>v.slug===s),vN=new Map(h.map((v)=>[v.id,v]));if(J.length===0&&!y)return N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg p-8 text-center",children:[N.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:"No trigger providers configured."},void 0,!1,void 0,this),N.jsxDEV("p",{className:"text-sm text-[var(--color-text-faint)] mt-1",children:"Add API keys for Composio or AgentDojo in Settings to enable triggers."},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return N.jsxDEV("div",{className:"space-y-6",children:[dv&&N.jsxDEV("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 border border-red-500/20 rounded-lg flex items-center justify-between",children:[N.jsxDEV("span",{children:dv},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:()=>Z(null),className:"text-red-400 hover:text-red-300",children:"x"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.length>1&&N.jsxDEV("div",{className:"flex items-center gap-2",children:[N.jsxDEV("span",{className:"text-xs text-[var(--color-text-muted)]",children:"Provider:"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex gap-1 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg p-0.5",children:J.map((v)=>N.jsxDEV("button",{onClick:()=>{c(v.id),l([]),k(""),Fv("")},className:`px-3 py-1 rounded text-xs font-medium transition ${Q===v.id?"bg-[var(--color-surface-raised)] text-white":"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]"}`,children:v.name},v.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!C&&N.jsxDEV("section",{children:[N.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[N.jsxDEV("h3",{className:"text-sm font-medium text-[var(--color-text-secondary)]",children:["Subscriptions (",P.length,")"]},void 0,!0,void 0,this),N.jsxDEV("button",{onClick:()=>Jv(!0),className:"text-xs bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] hover:border-[var(--color-accent)] px-3 py-1.5 rounded transition",children:"+ Add Subscription"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.length===0?N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg p-6 text-center text-[var(--color-text-muted)] text-sm",children:"No subscriptions yet. Add one to route trigger events to an agent."},void 0,!1,void 0,this):N.jsxDEV("div",{className:"space-y-2",children:P.map((v)=>{let m=vN.get(v.agent_id);return N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg p-3 flex items-center gap-3",children:[N.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${v.enabled?"bg-green-400":"bg-[var(--color-text-muted)]"}`},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex-1 min-w-0",children:[N.jsxDEV("div",{className:"text-sm font-medium truncate",children:[v.trigger_slug.replace(/_/g," "),N.jsxDEV("span",{className:"text-[var(--color-text-faint)] mx-1.5",children:"→"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-[var(--color-accent)]",children:m?.name||"Unknown Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)]",children:v.trigger_instance_id?`Instance: ${v.trigger_instance_id.slice(0,12)}...`:"All instances"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[N.jsxDEV("button",{onClick:()=>wN(v),className:`text-xs px-3 py-1 rounded transition ${v.enabled?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:v.enabled?"Disable":"Enable"},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:()=>CN(v.id),className:"text-xs text-[var(--color-text-muted)] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},v.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!C&&N.jsxDEV("section",{children:[N.jsxDEV("h3",{className:"text-sm font-medium text-[var(--color-text-secondary)] mb-3",children:["Trigger Instances (",W.length,")"]},void 0,!0,void 0,this),y?N.jsxDEV("div",{className:"text-center py-6 text-[var(--color-text-muted)] text-sm",children:"Loading triggers..."},void 0,!1,void 0,this):W.length===0?N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg p-6 text-center text-[var(--color-text-muted)] text-sm",children:"No trigger instances. Browse trigger types below to create one."},void 0,!1,void 0,this):N.jsxDEV("div",{className:"space-y-2",children:W.map((v)=>N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg p-3 flex items-center gap-3",children:[N.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${v.status==="active"?"bg-green-400":"bg-[var(--color-text-muted)]"}`},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex-1 min-w-0",children:[N.jsxDEV("div",{className:"text-sm font-medium truncate",children:v.trigger_slug.replace(/_/g," ")},void 0,!1,void 0,this),N.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)]",children:["ID: ",v.id.slice(0,12),"... | Created: ",new Date(v.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[N.jsxDEV("button",{onClick:()=>gv(v.id,v.status),className:`text-xs px-3 py-1 rounded transition ${v.status==="active"?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:v.status==="active"?"Disable":"Enable"},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:()=>ov(v.id),className:"text-xs text-[var(--color-text-muted)] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},v.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&N.jsxDEV("section",{children:[N.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[N.jsxDEV("h3",{className:"text-sm font-medium text-[var(--color-text-secondary)]",children:["Active Subscriptions (",W.length,")"]},void 0,!0,void 0,this),N.jsxDEV("button",{onClick:MN,className:"text-xs bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] hover:border-[var(--color-accent)] px-3 py-1.5 rounded transition",children:"+ Add Subscription"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y?N.jsxDEV("div",{className:"text-center py-6 text-[var(--color-text-muted)] text-sm",children:"Loading subscriptions..."},void 0,!1,void 0,this):W.length===0?N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg p-6 text-center text-[var(--color-text-muted)] text-sm",children:"No active subscriptions. Browse trigger types below to create one."},void 0,!1,void 0,this):N.jsxDEV("div",{className:"space-y-2",children:W.map((v)=>{let m=P.find((_)=>_.trigger_instance_id===v.id),f=m?vN.get(m.agent_id):null;return N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg p-3 flex items-center gap-3",children:[N.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${v.status==="active"?"bg-green-400":"bg-[var(--color-text-muted)]"}`},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex-1 min-w-0",children:[N.jsxDEV("div",{className:"text-sm font-medium truncate",children:[v.config?.title||v.trigger_slug.replace(/_/g," "),f&&N.jsxDEV(N.Fragment,{children:[N.jsxDEV("span",{className:"text-[var(--color-text-faint)] mx-1.5",children:"→"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-[var(--color-accent)]",children:f.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)]",children:[v.config?.server&&N.jsxDEV("span",{children:[String(v.config.server)," | "]},void 0,!0,void 0,this),"ID: ",String(v.id).slice(0,8)," | Created: ",new Date(v.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[N.jsxDEV("button",{onClick:()=>gv(v.id,v.status),className:`text-xs px-3 py-1 rounded transition ${v.status==="active"?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:v.status==="active"?"Disable":"Enable"},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:()=>ov(v.id),className:"text-xs text-[var(--color-text-muted)] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},v.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("section",{children:[N.jsxDEV("h3",{className:"text-sm font-medium text-[var(--color-text-secondary)] mb-3",children:"Browse Trigger Types"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex gap-2 mb-3",children:[N.jsxDEV("input",{type:"text",value:b,onChange:(v)=>k(v.target.value),placeholder:"Toolkit filter (e.g. github, gmail, slack)",className:"flex-1 bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded px-3 py-2 text-sm focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:()=>QN(b||void 0),disabled:S,className:"text-sm bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] hover:border-[var(--color-accent)] px-4 py-2 rounded transition disabled:opacity-50",children:S?"Loading...":"Browse"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A.length>0&&N.jsxDEV(N.Fragment,{children:[N.jsxDEV("input",{type:"text",value:j,onChange:(v)=>Fv(v.target.value),placeholder:"Search trigger types...",className:"w-full bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded px-3 py-2 text-sm mb-3 focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:wv.slice(0,30).map((v)=>N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border)] hover:border-[var(--color-border-light)] rounded-lg p-3 transition",children:[N.jsxDEV("div",{className:"flex items-start gap-3",children:[v.logo?N.jsxDEV("img",{src:v.logo,alt:v.toolkit_name,className:"w-8 h-8 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):N.jsxDEV("div",{className:"w-8 h-8 rounded bg-[var(--color-surface-raised)] flex items-center justify-center text-xs flex-shrink-0",children:v.toolkit_name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex-1 min-w-0",children:[N.jsxDEV("div",{className:"text-sm font-medium truncate",children:v.name},void 0,!1,void 0,this),N.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)]",children:v.toolkit_name},void 0,!1,void 0,this),N.jsxDEV("div",{className:"text-xs text-[var(--color-text-faint)] mt-1 line-clamp-2",children:v.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("button",{onClick:()=>BN(v),className:"w-full mt-3 text-xs bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] hover:border-[var(--color-accent)] px-3 py-1.5 rounded transition",children:C?"Subscribe":"Create Trigger"},void 0,!1,void 0,this)]},v.slug,!0,void 0,this))},void 0,!1,void 0,this),wv.length>30&&N.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mt-3 text-center",children:["Showing first 30 of ",wv.length," types. Use search to filter."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),RN&&B&&N.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded-lg p-6 w-full max-w-md mx-4",children:[N.jsxDEV("h3",{className:"font-medium mb-1",children:C?"Create Subscription":"Create Trigger"},void 0,!1,void 0,this),N.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)] mb-4",children:[B.name,B.toolkit_name&&N.jsxDEV("span",{className:"text-[var(--color-text-faint)]",children:[" (",B.toolkit_name,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"space-y-4",children:[!C&&N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),_v.length===0?N.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] bg-[var(--color-bg)] rounded p-3",children:"No connected accounts available. Connect an app first in the Integrations tab."},void 0,!1,void 0,this):N.jsxDEV(x,{value:$v,onChange:lv,placeholder:"Select account...",options:_v.map((v)=>({value:v.id,label:`${v.appName} (${v.id.slice(0,8)}...)`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Route to Agent"},void 0,!1,void 0,this),h.length===0?N.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] bg-[var(--color-bg)] rounded p-3",children:"No agents available. Create an agent first."},void 0,!1,void 0,this):N.jsxDEV(x,{value:r,onChange:Iv,placeholder:"Select agent...",options:h.map((v)=>({value:v.id,label:`${v.name} (${v.status})`}))},void 0,!1,void 0,this),N.jsxDEV("div",{className:"mt-3",children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),Nv?N.jsxDEV("div",{className:"text-xs text-green-400 bg-green-500/10 border border-green-500/20 rounded p-3",children:["Connected: ",Nv.appName]},void 0,!0,void 0,this):N.jsxDEV("div",{className:"text-xs text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded p-3",children:["No connected account for ",B?.toolkit_name||"this app",". Connect it first in the Integrations tab."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),B.config_schema&&Object.keys(B.config_schema.properties||{}).length>0&&N.jsxDEV("div",{className:"mt-3",children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Configuration"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"space-y-2",children:Object.entries(B.config_schema.properties||{}).map(([v,m])=>{let f=(B.config_schema.required||[]).includes(v);return N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-[11px] text-[var(--color-text-secondary)] mb-1",children:[m.title||v,f&&N.jsxDEV("span",{className:"text-red-400 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("input",{type:"text",value:Zv[v]||"",onChange:(_)=>nv((K)=>({...K,[v]:_.target.value})),placeholder:m.description||`Enter ${m.title||v}...`,className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 text-sm focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this)]},v,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex gap-2 mt-4",children:[N.jsxDEV("button",{onClick:()=>{mv(!1),fv(null)},className:"flex-1 text-sm bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:LN,disabled:C?!r||!Nv||Yv||B?.config_schema&&(B.config_schema.required||[]).some((v)=>!Zv[v]?.trim()):!$v||Yv,className:"flex-1 text-sm bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-white px-4 py-2 rounded transition disabled:opacity-50",children:Yv?"Creating...":C?"Subscribe":"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),ZN&&N.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded-lg p-6 w-full max-w-md mx-4",children:[N.jsxDEV("h3",{className:"font-medium mb-1",children:"Route Trigger to Agent"},void 0,!1,void 0,this),N.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)] mb-4",children:W.length===0?"No trigger instances yet. Create one first from the Browse section below.":"Select a trigger instance and the agent that should handle its events."},void 0,!1,void 0,this),W.length>0?N.jsxDEV(N.Fragment,{children:[N.jsxDEV("div",{className:"space-y-4",children:[N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Trigger Instance"},void 0,!1,void 0,this),N.jsxDEV(x,{value:V,onChange:Lv,placeholder:"Select trigger...",options:W.map((v)=>({value:v.id,label:`${v.trigger_slug.replace(/_/g," ")}`}))},void 0,!1,void 0,this),V&&N.jsxDEV("div",{className:"text-xs text-[var(--color-text-faint)] mt-1 font-mono",children:["ID: ",V.slice(0,16),"..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Target Agent"},void 0,!1,void 0,this),N.jsxDEV(x,{value:Kv,onChange:bv,placeholder:"Select agent...",options:h.map((v)=>({value:v.id,label:`${v.name} (${v.status})`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex gap-2 mt-5",children:[N.jsxDEV("button",{onClick:()=>{Jv(!1),Lv(""),bv("")},className:"flex-1 text-sm bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:bN,disabled:!V||!Kv||cv,className:"flex-1 text-sm bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-white px-4 py-2 rounded transition disabled:opacity-50",children:cv?"Adding...":"Add"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):N.jsxDEV("div",{className:"flex gap-2 mt-4",children:N.jsxDEV("button",{onClick:()=>Jv(!1),className:"flex-1 text-sm bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] px-4 py-2 rounded transition",children:"Close"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),HN&&N.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded-lg p-6 w-full max-w-lg mx-4",children:[N.jsxDEV("h3",{className:"font-medium mb-1",children:"Add Subscription"},void 0,!1,void 0,this),N.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)] mb-4",children:"Select an app and trigger, then route it to an agent."},void 0,!1,void 0,this),KN?N.jsxDEV("div",{className:"text-center py-8 text-[var(--color-text-muted)] text-sm",children:"Loading..."},void 0,!1,void 0,this):p.length===0?N.jsxDEV("div",{className:"text-center py-8 text-[var(--color-text-muted)] text-sm",children:"No triggers available. Connect an app first in the Integrations tab."},void 0,!1,void 0,this):N.jsxDEV("div",{className:"space-y-4",children:[N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"App"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"relative",children:[N.jsxDEV("button",{onClick:()=>{Gv(!Sv),Hv(!1),pv("")},className:"w-full flex items-center gap-2 bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 text-sm text-left hover:border-[var(--color-text-faint)] transition",children:[d?N.jsxDEV(N.Fragment,{children:[d.logo?N.jsxDEV("img",{src:d.logo,alt:"",className:"w-5 h-5 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):N.jsxDEV("div",{className:"w-5 h-5 rounded bg-[var(--color-surface-raised)] flex items-center justify-center text-[10px] flex-shrink-0",children:d.name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"flex-1 truncate",children:d.name},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:[d.count," triggers"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):N.jsxDEV("span",{className:"text-[var(--color-text-muted)] flex-1",children:"Select app..."},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-[var(--color-text-muted)] text-xs ml-1",children:"▾"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Sv&&N.jsxDEV(N.Fragment,{children:[N.jsxDEV("div",{className:"fixed inset-0 z-10",onClick:()=>Gv(!1)},void 0,!1,void 0,this),N.jsxDEV("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded-lg shadow-xl z-20 max-h-64 flex flex-col",children:[N.jsxDEV("div",{className:"p-2 border-b border-[var(--color-border)] flex-shrink-0",children:N.jsxDEV("input",{type:"text",value:Mv,onChange:(v)=>pv(v.target.value),placeholder:"Search apps...",className:"w-full bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded px-2 py-1.5 text-sm focus:outline-none focus:border-[var(--color-accent)]",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.jsxDEV("div",{className:"overflow-y-auto flex-1",children:tv.filter((v)=>{if(!Mv)return!0;let m=Mv.toLowerCase();return v.name.toLowerCase().includes(m)||v.slug.toLowerCase().includes(m)}).map((v)=>N.jsxDEV("button",{onClick:()=>{Av(v.slug),Wv(""),zv({}),Gv(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition hover:bg-[var(--color-surface-raised)] ${s===v.slug?"bg-[var(--color-surface-raised)] text-[var(--color-accent)]":""}`,children:[v.logo?N.jsxDEV("img",{src:v.logo,alt:"",className:"w-5 h-5 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):N.jsxDEV("div",{className:"w-5 h-5 rounded bg-[var(--color-surface-raised)] flex items-center justify-center text-[10px] flex-shrink-0",children:v.name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"flex-1 truncate",children:v.name},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:v.count},void 0,!1,void 0,this)]},v.slug,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),s&&N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Trigger"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"relative",children:[N.jsxDEV("button",{onClick:()=>{Hv(!uv),Gv(!1),xv("")},className:"w-full flex items-center gap-2 bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 text-sm text-left hover:border-[var(--color-text-faint)] transition",children:[M?N.jsxDEV(N.Fragment,{children:[N.jsxDEV("span",{className:"flex-1 truncate",children:M.name},void 0,!1,void 0,this),N.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 ${M.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:M.type},void 0,!1,void 0,this)]},void 0,!0,void 0,this):N.jsxDEV("span",{className:"text-[var(--color-text-muted)] flex-1",children:"Select trigger..."},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-[var(--color-text-muted)] text-xs ml-1",children:"▾"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),uv&&N.jsxDEV(N.Fragment,{children:[N.jsxDEV("div",{className:"fixed inset-0 z-10",onClick:()=>Hv(!1)},void 0,!1,void 0,this),N.jsxDEV("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded-lg shadow-xl z-20 max-h-64 flex flex-col",children:[ev.length>3&&N.jsxDEV("div",{className:"p-2 border-b border-[var(--color-border)] flex-shrink-0",children:N.jsxDEV("input",{type:"text",value:Ov,onChange:(v)=>xv(v.target.value),placeholder:"Search triggers...",className:"w-full bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded px-2 py-1.5 text-sm focus:outline-none focus:border-[var(--color-accent)]",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.jsxDEV("div",{className:"overflow-y-auto flex-1",children:ev.filter((v)=>{if(!Ov)return!0;let m=Ov.toLowerCase();return v.name.toLowerCase().includes(m)||v.slug.toLowerCase().includes(m)||v.description.toLowerCase().includes(m)}).map((v)=>N.jsxDEV("button",{onClick:()=>{Wv(v.slug),zv({}),Hv(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition hover:bg-[var(--color-surface-raised)] ${t===v.slug?"bg-[var(--color-surface-raised)] text-[var(--color-accent)]":""}`,children:[N.jsxDEV("div",{className:"flex-1 min-w-0",children:[N.jsxDEV("div",{className:"truncate",children:v.name},void 0,!1,void 0,this),N.jsxDEV("div",{className:"text-[10px] text-[var(--color-text-muted)] truncate",children:v.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 ${v.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:v.type},void 0,!1,void 0,this)]},v.slug,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t&&N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),Uv?N.jsxDEV("div",{className:"text-xs text-green-400 bg-green-500/10 border border-green-500/20 rounded p-3",children:["Connected: ",Uv.appName]},void 0,!0,void 0,this):N.jsxDEV("div",{className:"text-xs text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded p-3",children:["No connected account for ",M?.toolkit_name||"this app",". Connect it first in the Integrations tab."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),M&&M.config_schema&&Object.keys(M.config_schema.properties||{}).length>0&&N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Configuration"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"space-y-2",children:Object.entries(M.config_schema.properties||{}).map(([v,m])=>{let f=(M.config_schema.required||[]).includes(v);return N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-[11px] text-[var(--color-text-secondary)] mb-1",children:[m.title||v,f&&N.jsxDEV("span",{className:"text-red-400 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("input",{type:"text",value:Bv[v]||"",onChange:(_)=>zv((K)=>({...K,[v]:_.target.value})),placeholder:m.description||`Enter ${m.title||v}...`,className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 text-sm focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this)]},v,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Target Agent"},void 0,!1,void 0,this),h.length===0?N.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] bg-[var(--color-bg)] rounded p-3",children:"No agents available. Create an agent first."},void 0,!1,void 0,this):N.jsxDEV(x,{value:e,onChange:hv,placeholder:"Select agent...",options:h.map((v)=>({value:v.id,label:`${v.name} (${v.status})`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex gap-2 mt-5",children:[N.jsxDEV("button",{onClick:()=>qv(!1),className:"flex-1 text-sm bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:ON,disabled:!t||!e||!Uv||iv||M?.config_schema&&(M.config_schema.required||[]).some((v)=>!Bv[v]?.trim()),className:"flex-1 text-sm bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-white px-4 py-2 rounded transition disabled:opacity-50",children:iv?"Creating...":"Subscribe"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var n=O(Xv(),1);var z=O(I(),1);function _N(){let{authFetch:R}=g(),{currentProjectId:H}=o(),J=H&&H!=="unassigned"?H:null,F=J?`?project_id=${J}`:"",[Q,c]=n.useState([]),[W,a]=n.useState("");n.useEffect(()=>{R(`/api/triggers/providers${F}`).then((G)=>G.json()).then((G)=>{let b=(G.providers||[]).filter((k)=>k.connected);if(c(b),b.length>0&&!b.find((k)=>k.id===W))a(b[0].id)}).catch(()=>{})},[R]);let[y,T]=n.useState(null),[P,Y]=n.useState([]),[A,l]=n.useState(!1),S=n.useCallback(async(G)=>{T(G),l(!0);try{let b=`/api/triggers/types?provider=${W}&toolkit_slugs=${G}`;if(J)b+=`&project_id=${J}`;let k=await R(b);if(k.ok){let j=await k.json();Y(j.types||[])}}catch(b){console.error("Failed to fetch trigger types:",b)}l(!1)},[R,J,W]);return z.jsxDEV("div",{children:[z.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)] mb-4",children:"Connect external apps via OAuth or API Key. Connected apps can be used for triggers and MCP integrations."},void 0,!1,void 0,this),Q.length>1&&z.jsxDEV("div",{className:"flex items-center gap-2 mb-4",children:[z.jsxDEV("span",{className:"text-xs text-[var(--color-text-muted)]",children:"Provider:"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex gap-1 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg p-0.5",children:Q.map((G)=>z.jsxDEV("button",{onClick:()=>a(G.id),className:`px-3 py-1 rounded text-xs font-medium transition ${W===G.id?"bg-[var(--color-surface-raised)] text-white":"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]"}`,children:G.name},G.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q.length===0?z.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg p-8 text-center",children:[z.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:"No integration providers configured."},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[var(--color-text-faint)] mt-1",children:"Add API keys for Composio or AgentDojo in Settings."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV(fN,{providerId:W,projectId:J,hideMcpConfig:!0,onBrowseTriggers:S},void 0,!1,void 0,this),y&&z.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:z.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded-lg w-full max-w-2xl mx-4 max-h-[80vh] flex flex-col",children:[z.jsxDEV("div",{className:"p-4 border-b border-[var(--color-border)] flex items-center justify-between",children:[z.jsxDEV("div",{children:[z.jsxDEV("h3",{className:"font-medium",children:"Trigger Types"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)]",children:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:()=>{T(null),Y([])},className:"text-[var(--color-text-muted)] hover:text-white transition text-lg px-2",children:"x"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex-1 overflow-auto p-4",children:A?z.jsxDEV("div",{className:"text-center py-8 text-[var(--color-text-muted)]",children:"Loading trigger types..."},void 0,!1,void 0,this):P.length===0?z.jsxDEV("div",{className:"text-center py-8 text-[var(--color-text-muted)]",children:"No trigger types available for this app."},void 0,!1,void 0,this):z.jsxDEV("div",{className:"space-y-2",children:P.map((G)=>z.jsxDEV("div",{className:"bg-[var(--color-bg)] border border-[var(--color-border)] rounded-lg p-3",children:z.jsxDEV("div",{className:"flex items-start gap-3",children:[G.logo?z.jsxDEV("img",{src:G.logo,alt:G.toolkit_name,className:"w-6 h-6 rounded object-contain flex-shrink-0 mt-0.5"},void 0,!1,void 0,this):z.jsxDEV("div",{className:"w-6 h-6 rounded bg-[var(--color-surface-raised)] flex items-center justify-center text-[10px] flex-shrink-0 mt-0.5",children:G.toolkit_name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"text-sm font-medium",children:G.name},void 0,!1,void 0,this),z.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] mt-0.5",children:G.description},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2 mt-1.5",children:[z.jsxDEV("span",{className:"text-[10px] bg-[var(--color-surface-raised)] text-[var(--color-text-faint)] px-1.5 py-0.5 rounded font-mono",children:G.slug},void 0,!1,void 0,this),z.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${G.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:G.type},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},G.slug,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var w=O(I(),1);function J0(){let[R,H]=$N.useState("overview");return w.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:w.jsxDEV("div",{className:"max-w-6xl",children:[w.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:w.jsxDEV("div",{children:[w.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"Connections"},void 0,!1,void 0,this),w.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:"Manage external app connections, triggers, and webhooks."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),w.jsxDEV("div",{className:"flex gap-1 mb-6 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg p-1 w-fit",children:[{id:"overview",label:"Overview"},{id:"triggers",label:"Triggers"},{id:"integrations",label:"Integrations"}].map((F)=>w.jsxDEV("button",{onClick:()=>H(F.id),className:`px-4 py-2 rounded text-sm font-medium transition ${R===F.id?"bg-[var(--color-surface-raised)] text-white":"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]"}`,children:F.label},F.id,!1,void 0,this))},void 0,!1,void 0,this),R==="overview"&&w.jsxDEV(NN,{},void 0,!1,void 0,this),R==="triggers"&&w.jsxDEV(mN,{},void 0,!1,void 0,this),R==="integrations"&&w.jsxDEV(_N,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}
|
|
2
|
-
export{lN as a,J0 as b};
|
|
3
|
-
|
|
4
|
-
//# debugId=4839B60C058CE01C64756E2164756E21
|
package/dist/McpPage.cdxm48xj.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{d as a,e as b,f as c,g as d,h as e}from"./App.gssbmajb.js";import"./App.qzbx5wtj.js";import"./App.9epx6785.js";import"./App.drwb57jq.js";import"./App.tpmp9020.js";export{e as formatRelativeTime,d as formatCron,c as TrajectoryView,a as TasksPage,b as TaskDetailPanel};
|
|
2
|
-
|
|
3
|
-
//# debugId=C2CFA2705D3D8A1B64756E2164756E21
|