apteva 0.4.41 → 0.4.44
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 +3 -0
- package/dist/ApiDocsPage.yzcxx5ax.js +4 -0
- package/dist/App.09yb8t0b.js +1 -0
- package/dist/App.152mbs1r.js +4 -0
- package/dist/App.3a67nx9w.js +4 -0
- package/dist/App.9epx6785.js +4 -0
- package/dist/App.d8955awp.js +4 -0
- package/dist/App.drwb57jq.js +4 -0
- package/dist/App.gssbmajb.js +4 -0
- package/dist/App.qw70pc29.js +53 -0
- package/dist/{App.7fb3e7mp.js → App.qzbx5wtj.js} +1 -1
- package/dist/App.r5serxkt.js +8 -0
- package/dist/App.tpmp9020.js +20 -0
- package/dist/App.v2wb4d7d.js +61 -0
- package/dist/App.vxmaaj0m.js +13 -0
- package/dist/App.w4p2tda9.js +4 -0
- package/dist/App.wv2ng55q.js +221 -0
- package/dist/App.yncnrn0f.js +4 -0
- package/dist/ConnectionsPage.k6cspyqq.js +3 -0
- package/dist/McpPage.cdxm48xj.js +3 -0
- package/dist/SettingsPage.evpv7c2y.js +3 -0
- package/dist/SkillsPage.pvzp6c1a.js +3 -0
- package/dist/TasksPage.6jnvbpsy.js +3 -0
- package/dist/TelemetryPage.t7vk24zc.js +3 -0
- package/dist/TestsPage.5x6658aa.js +3 -0
- package/dist/ThreadsPage.3fvhtevh.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 +8 -8
- package/src/db.ts +19 -9
- package/src/integrations/agentdojo.ts +1 -0
- package/src/mcp-platform.ts +418 -63
- package/src/openapi.ts +96 -0
- package/src/providers.ts +50 -24
- package/src/routes/api/agent-utils.ts +0 -1
- package/src/routes/api/agents.ts +19 -1
- package/src/routes/api/meta-agent.ts +2 -0
- package/src/routes/api/system.ts +90 -1
- package/src/routes/api/telemetry.ts +19 -1
- package/src/routes/share.ts +85 -0
- package/src/server.ts +12 -0
- package/src/web/App.tsx +89 -11
- package/src/web/components/activity/ActivityPage.tsx +14 -14
- package/src/web/components/agents/AgentCard.tsx +14 -14
- package/src/web/components/agents/AgentPanel.tsx +358 -198
- package/src/web/components/agents/AgentsView.tsx +4 -4
- package/src/web/components/agents/CreateAgentModal.tsx +21 -79
- package/src/web/components/api/ApiDocsPage.tsx +66 -66
- package/src/web/components/auth/CreateAccountStep.tsx +16 -16
- package/src/web/components/auth/LoginPage.tsx +10 -10
- package/src/web/components/common/LoadingSpinner.tsx +2 -2
- package/src/web/components/common/Modal.tsx +8 -8
- package/src/web/components/common/Select.tsx +9 -9
- package/src/web/components/connections/ConnectionsPage.tsx +4 -4
- package/src/web/components/connections/IntegrationsTab.tsx +18 -18
- package/src/web/components/connections/OverviewTab.tsx +13 -13
- package/src/web/components/connections/TriggersTab.tsx +99 -99
- package/src/web/components/dashboard/Dashboard.tsx +32 -32
- package/src/web/components/layout/Header.tsx +50 -34
- package/src/web/components/layout/Sidebar.tsx +34 -15
- package/src/web/components/mcp/IntegrationsPanel.tsx +40 -40
- package/src/web/components/mcp/McpPage.tsx +208 -208
- package/src/web/components/meta-agent/MetaAgent.tsx +12 -10
- package/src/web/components/onboarding/OnboardingWizard.tsx +25 -25
- package/src/web/components/settings/SettingsPage.tsx +258 -175
- package/src/web/components/skills/SkillsPage.tsx +88 -88
- package/src/web/components/tasks/TasksPage.tsx +339 -54
- package/src/web/components/telemetry/TelemetryPage.tsx +135 -64
- package/src/web/components/tests/TestsPage.tsx +50 -50
- package/src/web/components/threads/ThreadsPage.tsx +23 -21
- package/src/web/context/ProjectContext.tsx +6 -1
- package/src/web/context/ThemeContext.tsx +69 -0
- package/src/web/context/index.ts +2 -0
- package/src/web/styles.css +5 -3
- package/src/web/themes.ts +99 -0
- package/src/web/types.ts +0 -4
- package/dist/ActivityPage.7907h64p.js +0 -3
- package/dist/ApiDocsPage.k3jjenpq.js +0 -4
- package/dist/App.01nq20st.js +0 -4
- package/dist/App.1maqvamf.js +0 -4
- package/dist/App.2yjrh32f.js +0 -4
- package/dist/App.3qw8nben.js +0 -20
- package/dist/App.7sy3wq8c.js +0 -4
- package/dist/App.apjrmctz.js +0 -57
- package/dist/App.av6t2yhe.js +0 -4
- package/dist/App.jqj5a094.js +0 -46
- package/dist/App.mc7xf85h.js +0 -4
- package/dist/App.myxqcj9x.js +0 -4
- package/dist/App.nm91r1mp.js +0 -13
- package/dist/App.p02f4ret.js +0 -1
- package/dist/App.qcknavjz.js +0 -221
- package/dist/App.vc7vfhg4.js +0 -4
- package/dist/App.z4s9zkw5.js +0 -4
- package/dist/ConnectionsPage.z1pw5xe2.js +0 -3
- package/dist/McpPage.8vc97z0b.js +0 -3
- package/dist/SettingsPage.p61bz8kd.js +0 -3
- package/dist/SkillsPage.r9x43g3g.js +0 -3
- package/dist/TasksPage.1e0zkye4.js +0 -3
- package/dist/TelemetryPage.p9vbe4gf.js +0 -3
- package/dist/TestsPage.d4xy504e.js +0 -3
- package/dist/ThreadsPage.m016am3x.js +0 -3
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{G as D,H as r,I as k,l as p,q as j}from"./App.qzbx5wtj.js";import{O as d}from"./App.9epx6785.js";import{U as V}from"./App.drwb57jq.js";import{$ as t,X as g,aa as l,da as u,ja as c,ma as i}from"./App.tpmp9020.js";var X=g(t(),1);var z=g(l(),1);function Zz({onSelectAgent:G}){let{authFetch:q}=c(),{currentProjectId:Y}=i(),[_,O]=X.useState([]),[L,K]=X.useState(!0),[Z,J]=X.useState("all"),[U,$]=X.useState("all"),[W,N]=X.useState(null),[w,R]=X.useState(!1),[v,P]=X.useState(!1),f=X.useRef(null),{events:I}=u({category:"TASK"}),A=X.useCallback(async()=>{try{let B=`/api/tasks?status=${Z}`;if(Y!==null)B+=`&project_id=${encodeURIComponent(Y)}`;let Q=await(await q(B)).json();O(Q.tasks||[])}catch(B){console.error("Failed to fetch tasks:",B)}finally{K(!1)}},[q,Z,Y]);X.useEffect(()=>{A()},[A]),X.useEffect(()=>{if(!I.length)return;let B=I[0];if(!B||B.id===f.current)return;let H=B.type;if(H==="task_created"||H==="task_updated"||H==="task_deleted")f.current=B.id,console.log("[TasksPage] Telemetry event:",H),A()},[I,A]);let b=X.useCallback(async(B)=>{N(B),R(!0);try{let H=await q(`/api/tasks/${B.agentId}/${B.id}`);if(console.log("[TasksPage] Fetch task response status:",H.status),H.ok){let Q=await H.json();if(console.log("[TasksPage] Task data:",Q),console.log("[TasksPage] Has trajectory:",!!Q.task?.trajectory,"Length:",Q.task?.trajectory?.length),Q.task)N({...Q.task,agentId:B.agentId,agentName:B.agentName})}else console.error("[TasksPage] Failed to fetch task:",H.status,await H.text())}catch(H){console.error("Failed to fetch task details:",H)}finally{R(!1)}},[q]),F=X.useMemo(()=>{let B=new Map;for(let H of _){let Q=H.agentId||H.agent_id,M=H.agentName||H.agent_name;if(Q&&M&&!B.has(Q))B.set(Q,M)}return Array.from(B.entries()).sort((H,Q)=>H[1].localeCompare(Q[1]))},[_]),T=X.useMemo(()=>{return[...U==="all"?_:_.filter((H)=>(H.agentId||H.agent_id)===U)].sort((H,Q)=>{if(H.status==="running"&&Q.status!=="running")return-1;if(Q.status==="running"&&H.status!=="running")return 1;let M=H.status==="pending",S=Q.status==="pending";if(M&&!S)return-1;if(S&&!M)return 1;if(M&&S||H.status==="running"&&Q.status==="running"){let m=H.next_run||H.execute_at||null,h=Q.next_run||Q.execute_at||null,e=m?new Date(m).getTime():1/0,s=h?new Date(h).getTime():1/0;return e-s}let x=H.completed_at||H.executed_at||H.created_at,a=Q.completed_at||Q.executed_at||Q.created_at;return new Date(a).getTime()-new Date(x).getTime()})},[_,U]),C={pending:"bg-yellow-500/20 text-yellow-400",running:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",failed:"bg-red-500/20 text-red-400",cancelled:"bg-gray-500/20 text-gray-400"};return z.jsxDEV("div",{className:"flex-1 flex overflow-hidden",children:[z.jsxDEV("div",{className:`flex-1 p-4 md:p-6 overflow-auto ${W?"hidden md:block md:w-1/2 lg:w-2/3":""}`,children:z.jsxDEV("div",{className:"max-w-4xl",children:[z.jsxDEV("div",{className:"mb-6",children:[z.jsxDEV("div",{className:"mb-4 flex items-start justify-between",children:[z.jsxDEV("div",{children:[z.jsxDEV("h1",{className:"text-xl md:text-2xl font-semibold mb-1",children:"Tasks"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)]",children:"View tasks from all running agents"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:()=>P(!0),className:"px-3 py-1.5 rounded text-sm bg-[var(--color-accent)] text-black hover:opacity-90 transition flex items-center gap-1.5 flex-shrink-0",children:[z.jsxDEV("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:z.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"},void 0,!1,void 0,this)},void 0,!1,void 0,this),"Create Task"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-3 flex-wrap pb-1",children:[z.jsxDEV("div",{className:"flex gap-2 overflow-x-auto scrollbar-hide",children:[{value:"all",label:"All"},{value:"pending",label:"Pending"},{value:"running",label:"Running"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}].map((B)=>z.jsxDEV("button",{onClick:()=>J(B.value),className:`px-3 py-1.5 rounded text-sm transition whitespace-nowrap ${Z===B.value?"bg-[var(--color-accent)] text-black":"bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)]"}`,children:B.label},B.value,!1,void 0,this))},void 0,!1,void 0,this),F.length>0&&z.jsxDEV("div",{className:"w-48",children:z.jsxDEV(V,{value:U,onChange:$,placeholder:"All agents",compact:!0,options:[{value:"all",label:"All agents"},...F.map(([B,H])=>({value:B,label:H}))]},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L?z.jsxDEV("div",{className:"text-center py-12 text-[var(--color-text-muted)]",children:"Loading tasks..."},void 0,!1,void 0,this):T.length===0?z.jsxDEV("div",{className:"text-center py-12",children:[z.jsxDEV(j,{className:"w-12 h-12 mx-auto mb-4 text-[var(--color-border-light)]"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:"No tasks found"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[var(--color-text-faint)] mt-1",children:"Tasks will appear here when agents create them"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV("div",{className:"space-y-3",children:T.map((B)=>z.jsxDEV("div",{onClick:()=>b(B),className:`bg-[var(--color-surface)] border rounded-lg p-4 cursor-pointer transition ${W?.id===B.id&&W?.agentId===B.agentId?"border-[var(--color-accent)]":"border-[var(--color-border)] hover:border-[var(--color-border-light)]"}`,children:[z.jsxDEV("div",{className:"flex items-start justify-between mb-2",children:[z.jsxDEV("div",{className:"flex-1",children:[z.jsxDEV("h3",{className:"font-medium",children:B.title},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)]",children:B.agentName},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("span",{className:`px-2 py-1 rounded text-xs font-medium ${C[B.status]||C.pending}`,children:B.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),B.description&&z.jsxDEV("p",{className:"text-sm text-[var(--color-text-secondary)] mb-2 line-clamp-2",children:B.description},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-[var(--color-text-faint)]",children:[z.jsxDEV("span",{className:"flex items-center gap-1",children:[B.type==="recurring"?z.jsxDEV(D,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this):B.execute_at?z.jsxDEV(r,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this):z.jsxDEV(k,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this),B.type==="recurring"&&B.recurrence?n(B.recurrence):B.type]},void 0,!0,void 0,this),z.jsxDEV("span",{children:["Priority: ",B.priority]},void 0,!0,void 0,this),B.next_run&&z.jsxDEV("span",{className:"text-[var(--color-accent)]",children:y(B.next_run)},void 0,!1,void 0,this),!B.next_run&&B.execute_at&&z.jsxDEV("span",{className:"text-[var(--color-accent)]",children:y(B.execute_at)},void 0,!1,void 0,this),z.jsxDEV("span",{children:["Created: ",new Date(B.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},`${B.agentId}-${B.id}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),W&&z.jsxDEV(zz,{task:W,statusColors:C,onClose:()=>N(null),onSelectAgent:G,loading:w,authFetch:q,onRefresh:()=>{A(),N(null)}},void 0,!1,void 0,this),v&&z.jsxDEV(Gz,{authFetch:q,currentProjectId:Y,onClose:()=>P(!1),onCreated:()=>{A(),P(!1)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function zz({task:G,statusColors:q,onClose:Y,onSelectAgent:_,loading:O,authFetch:L,onRefresh:K}){let[Z,J]=X.useState(!1),[U,$]=X.useState(!1),{confirm:W,ConfirmDialog:N}=d(),w=async()=>{if(!L||Z)return;J(!0);try{await L(`/api/tasks/${G.agentId}/${G.id}/execute`,{method:"POST"}),K?.()}catch(v){console.error("Failed to execute task:",v)}finally{J(!1)}},R=async()=>{if(!L||U)return;if(!await W(`Are you sure you want to delete "${G.title}"?`,{title:"Delete Task",confirmText:"Delete",confirmVariant:"danger"}))return;$(!0);try{await L(`/api/tasks/${G.agentId}/${G.id}`,{method:"DELETE"}),K?.()}catch(P){console.error("Failed to delete task:",P)}finally{$(!1)}};return z.jsxDEV("div",{className:"w-full md:w-1/2 lg:w-1/3 border-l border-[var(--color-border)] bg-[var(--color-bg)] flex flex-col overflow-hidden",children:[N,z.jsxDEV("div",{className:"flex items-center justify-between p-4 border-b border-[var(--color-border)]",children:[z.jsxDEV("h2",{className:"font-medium truncate pr-2",children:"Task Details"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2",children:[L&&(G.status==="pending"||G.status==="completed")&&z.jsxDEV("button",{onClick:w,disabled:Z,title:"Execute now",className:"text-[var(--color-accent)] hover:opacity-80 transition disabled:opacity-50",children:z.jsxDEV("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[z.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"},void 0,!1,void 0,this),z.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),L&&z.jsxDEV("button",{onClick:R,disabled:U,title:"Delete task",className:"text-red-400 hover:text-red-300 transition disabled:opacity-50",children:z.jsxDEV("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:z.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:Y,className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)] transition",children:z.jsxDEV(p,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[z.jsxDEV("div",{children:[z.jsxDEV("div",{className:"flex items-start justify-between gap-2 mb-2",children:[z.jsxDEV("h3",{className:"text-lg font-medium",children:G.title},void 0,!1,void 0,this),z.jsxDEV("span",{className:`px-2 py-1 rounded text-xs font-medium flex-shrink-0 ${q[G.status]}`,children:G.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:()=>_?.(G.agentId),className:"text-sm text-[var(--color-accent)] hover:underline",children:G.agentName},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.description&&z.jsxDEV("div",{children:[z.jsxDEV("h4",{className:"text-xs text-[var(--color-text-muted)] uppercase tracking-wider mb-1",children:"Description"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[var(--color-text-secondary)] whitespace-pre-wrap",children:G.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[z.jsxDEV("div",{children:[z.jsxDEV("span",{className:"text-[var(--color-text-muted)]",children:"Type"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"capitalize",children:G.type},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("span",{className:"text-[var(--color-text-muted)]",children:"Priority"},void 0,!1,void 0,this),z.jsxDEV("p",{children:G.priority},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("span",{className:"text-[var(--color-text-muted)]",children:"Source"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"capitalize",children:G.source},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.recurrence&&z.jsxDEV("div",{children:[z.jsxDEV("span",{className:"text-[var(--color-text-muted)]",children:"Recurrence"},void 0,!1,void 0,this),z.jsxDEV("p",{children:n(G.recurrence)},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mt-0.5 font-mono",children:G.recurrence},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"space-y-2 text-sm",children:[z.jsxDEV("div",{className:"flex justify-between",children:[z.jsxDEV("span",{className:"text-[var(--color-text-muted)]",children:"Created"},void 0,!1,void 0,this),z.jsxDEV("span",{children:new Date(G.created_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.execute_at&&z.jsxDEV("div",{className:"flex justify-between",children:[z.jsxDEV("span",{className:"text-[var(--color-text-muted)]",children:"Scheduled"},void 0,!1,void 0,this),z.jsxDEV("span",{className:"text-[var(--color-accent)]",children:y(G.execute_at)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.executed_at&&z.jsxDEV("div",{className:"flex justify-between",children:[z.jsxDEV("span",{className:"text-[var(--color-text-muted)]",children:"Started"},void 0,!1,void 0,this),z.jsxDEV("span",{children:new Date(G.executed_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.completed_at&&z.jsxDEV("div",{className:"flex justify-between",children:[z.jsxDEV("span",{className:"text-[var(--color-text-muted)]",children:"Completed"},void 0,!1,void 0,this),z.jsxDEV("span",{children:new Date(G.completed_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.next_run&&z.jsxDEV("div",{className:"flex justify-between",children:[z.jsxDEV("span",{className:"text-[var(--color-text-muted)]",children:"Next Run"},void 0,!1,void 0,this),z.jsxDEV("span",{className:"text-[var(--color-accent)]",children:y(G.next_run)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.status==="failed"&&G.error&&z.jsxDEV("div",{className:"min-w-0",children:[z.jsxDEV("h4",{className:"text-xs text-red-400 uppercase tracking-wider mb-1",children:"Error"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"bg-red-500/10 border border-red-500/20 rounded p-3 overflow-x-auto",children:z.jsxDEV("pre",{className:"text-sm text-red-400 whitespace-pre-wrap break-words",children:G.error},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.status==="completed"&&G.result&&z.jsxDEV("div",{className:"min-w-0",children:[z.jsxDEV("h4",{className:"text-xs text-green-400 uppercase tracking-wider mb-1",children:"Result"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"bg-green-500/10 border border-green-500/20 rounded p-3 overflow-x-auto",children:z.jsxDEV("pre",{className:"text-sm text-green-400 whitespace-pre-wrap break-words",children:typeof G.result==="string"?G.result:JSON.stringify(G.result,null,2)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O&&!G.trajectory&&z.jsxDEV("div",{children:[z.jsxDEV("h4",{className:"text-xs text-[var(--color-text-muted)] uppercase tracking-wider mb-2",children:"Trajectory"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"text-sm text-[var(--color-text-faint)]",children:"Loading trajectory..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.trajectory&&G.trajectory.length>0&&z.jsxDEV("div",{children:[z.jsxDEV("h4",{className:"text-xs text-[var(--color-text-muted)] uppercase tracking-wider mb-2",children:["Trajectory (",G.trajectory.length," steps)"]},void 0,!0,void 0,this),z.jsxDEV(Bz,{trajectory:G.trajectory},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Bz({trajectory:G}){let[q,Y]=X.useState(new Set),_=(K)=>{Y((Z)=>{let J=new Set(Z);if(J.has(K))J.delete(K);else J.add(K);return J})},O={user:{bg:"bg-blue-500/10",text:"text-blue-400",icon:"\uD83D\uDC64",label:"User"},assistant:{bg:"bg-purple-500/10",text:"text-purple-400",icon:"\uD83E\uDD16",label:"Assistant"}},L=(K)=>{let Z=K.content;if(typeof Z==="string"){let J=Z.length>200,U=q.has(K.id);return z.jsxDEV("div",{children:[z.jsxDEV("p",{className:`text-sm text-[var(--color-text)] whitespace-pre-wrap break-words ${!U&&J?"line-clamp-4":""}`,children:Z},void 0,!1,void 0,this),J&&z.jsxDEV("button",{onClick:()=>_(K.id),className:"text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] mt-1",children:U?"Show less":"Show more..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}return z.jsxDEV("div",{className:"space-y-2",children:Z.map((J,U)=>{if(J.type==="tool_use"){let $=JSON.stringify(J.input,null,2),W=$.length>150,N=`${K.id}-${U}`,w=q.has(N);return z.jsxDEV("div",{className:"bg-orange-500/10 border border-orange-500/20 rounded p-2",children:[z.jsxDEV("div",{className:"flex items-center gap-2 mb-1",children:[z.jsxDEV("span",{className:"text-orange-400",children:"\uD83D\uDD27"},void 0,!1,void 0,this),z.jsxDEV("span",{className:"text-xs font-medium text-orange-400",children:"Tool Call"},void 0,!1,void 0,this),z.jsxDEV("span",{className:"text-xs text-[var(--color-text-secondary)]",children:J.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("pre",{className:`text-xs text-[var(--color-text-secondary)] overflow-x-auto ${!w&&W?"line-clamp-3":""}`,children:$},void 0,!1,void 0,this),W&&z.jsxDEV("button",{onClick:()=>_(N),className:"text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] mt-1",children:w?"Show less":"Show more..."},void 0,!1,void 0,this)]},U,!0,void 0,this)}if(J.type==="tool_result"){let $=J.is_error,W=`${K.id}-${U}`,N=q.has(W),w=J.content.length>150;return z.jsxDEV("div",{className:`${$?"bg-red-500/10 border-red-500/20":"bg-teal-500/10 border-teal-500/20"} border rounded p-2`,children:[z.jsxDEV("div",{className:"flex items-center gap-2 mb-1",children:[z.jsxDEV("span",{children:$?"❌":"\uD83D\uDCCB"},void 0,!1,void 0,this),z.jsxDEV("span",{className:`text-xs font-medium ${$?"text-red-400":"text-teal-400"}`,children:"Tool Result"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("pre",{className:`text-xs text-[var(--color-text-secondary)] overflow-x-auto whitespace-pre-wrap break-words ${!N&&w?"line-clamp-3":""}`,children:J.content},void 0,!1,void 0,this),w&&z.jsxDEV("button",{onClick:()=>_(W),className:"text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] mt-1",children:N?"Show less":"Show more..."},void 0,!1,void 0,this)]},U,!0,void 0,this)}return null})},void 0,!1,void 0,this)};return z.jsxDEV("div",{className:"space-y-2",children:G.map((K)=>{let Z=O[K.role]||O.assistant;return z.jsxDEV("div",{className:`${Z.bg} border border-[var(--color-border)] rounded overflow-hidden p-3`,children:[z.jsxDEV("div",{className:"flex items-center gap-2 mb-2",children:[z.jsxDEV("span",{children:Z.icon},void 0,!1,void 0,this),z.jsxDEV("span",{className:`text-xs font-medium ${Z.text}`,children:Z.label},void 0,!1,void 0,this),K.model&&z.jsxDEV("span",{className:"text-xs text-[var(--color-text-faint)]",children:["· ",K.model]},void 0,!0,void 0,this),z.jsxDEV("span",{className:"text-xs text-[var(--color-text-faint)]",children:["· ",new Date(K.created_at).toLocaleTimeString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L(K)]},K.id,!0,void 0,this)})},void 0,!1,void 0,this)}function Gz({authFetch:G,currentProjectId:q,onClose:Y,onCreated:_}){let[O,L]=X.useState([]),[K,Z]=X.useState(""),[J,U]=X.useState(""),[$,W]=X.useState(""),[N,w]=X.useState("once"),[R,v]=X.useState(5),[P,f]=X.useState(""),[I,A]=X.useState(""),[b,F]=X.useState(!1),[T,C]=X.useState("");return X.useEffect(()=>{G("/api/agents").then((B)=>B.json()).then((B)=>{let H=(B.agents||[]).filter((Q)=>Q.status==="running"&&Q.features?.tasks);if(L(H.map((Q)=>({id:Q.id,name:Q.name}))),H.length===1)Z(H[0].id)}).catch(()=>{})},[G]),z.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:Y,children:z.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg w-full max-w-md",onClick:(B)=>B.stopPropagation(),children:[z.jsxDEV("div",{className:"flex items-center justify-between p-4 border-b border-[var(--color-border)]",children:[z.jsxDEV("h2",{className:"font-medium",children:"Create Task"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:Y,className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)] transition",children:z.jsxDEV(p,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("form",{onSubmit:async(B)=>{if(B.preventDefault(),!K||!J.trim())return;F(!0),C("");let H={title:J.trim(),description:$.trim()||void 0,type:N,priority:R};if(N==="once"&&P)H.execute_at=new Date(P).toISOString();if(N==="recurring"&&I.trim())H.recurrence=I.trim();try{let Q=await G(`/api/tasks/${K}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H)});if(!Q.ok){let M=await Q.json().catch(()=>({}));C(M.error||`HTTP ${Q.status}`);return}_()}catch(Q){C(String(Q))}finally{F(!1)}},className:"p-4 space-y-4",children:[z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Agent"},void 0,!1,void 0,this),O.length===0?z.jsxDEV("p",{className:"text-sm text-[var(--color-text-faint)]",children:"No running agents with tasks enabled"},void 0,!1,void 0,this):z.jsxDEV("select",{value:K,onChange:(B)=>Z(B.target.value),className:"w-full bg-[var(--color-bg)] border border-[var(--color-border)] rounded px-3 py-2 text-sm",required:!0,children:[z.jsxDEV("option",{value:"",children:"Select agent..."},void 0,!1,void 0,this),O.map((B)=>z.jsxDEV("option",{value:B.id,children:B.name},B.id,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Title"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:J,onChange:(B)=>U(B.target.value),className:"w-full bg-[var(--color-bg)] border border-[var(--color-border)] rounded px-3 py-2 text-sm",placeholder:"e.g. Check email for new orders",required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Description"},void 0,!1,void 0,this),z.jsxDEV("textarea",{value:$,onChange:(B)=>W(B.target.value),className:"w-full bg-[var(--color-bg)] border border-[var(--color-border)] rounded px-3 py-2 text-sm resize-none",rows:2,placeholder:"Optional instructions for the agent..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"grid grid-cols-2 gap-3",children:[z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Type"},void 0,!1,void 0,this),z.jsxDEV("select",{value:N,onChange:(B)=>w(B.target.value),className:"w-full bg-[var(--color-bg)] border border-[var(--color-border)] rounded px-3 py-2 text-sm",children:[z.jsxDEV("option",{value:"once",children:"One-time"},void 0,!1,void 0,this),z.jsxDEV("option",{value:"recurring",children:"Recurring"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Priority"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"number",min:1,max:10,value:R,onChange:(B)=>v(Number(B.target.value)),className:"w-full bg-[var(--color-bg)] border border-[var(--color-border)] rounded px-3 py-2 text-sm"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N==="once"&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Schedule (optional)"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"datetime-local",value:P,onChange:(B)=>f(B.target.value),className:"w-full bg-[var(--color-bg)] border border-[var(--color-border)] rounded px-3 py-2 text-sm"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mt-1",children:"Leave empty to execute immediately"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N==="recurring"&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Cron Schedule"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:I,onChange:(B)=>A(B.target.value),className:"w-full bg-[var(--color-bg)] border border-[var(--color-border)] rounded px-3 py-2 text-sm font-mono",placeholder:"*/30 * * * *",required:!0},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mt-1",children:"e.g. */30 * * * * = every 30 min, 0 9 * * 1-5 = weekdays at 9am"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T&&z.jsxDEV("p",{className:"text-sm text-red-400",children:T},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex justify-end gap-2 pt-2",children:[z.jsxDEV("button",{type:"button",onClick:Y,className:"px-4 py-2 rounded text-sm bg-[var(--color-surface-raised)] hover:bg-[var(--color-border)] transition",children:"Cancel"},void 0,!1,void 0,this),z.jsxDEV("button",{type:"submit",disabled:b||!K||!J.trim()||O.length===0,className:"px-4 py-2 rounded text-sm bg-[var(--color-accent)] text-black hover:opacity-90 transition disabled:opacity-50",children:b?"Creating...":"Create Task"},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,!1,void 0,this)}var o=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function n(G){try{let q=G.trim().split(/\s+/);if(q.length!==5)return G;let[Y,_,O,L,K]=q;if(Y.startsWith("*/")&&_==="*"&&O==="*"&&L==="*"&&K==="*"){let J=parseInt(Y.slice(2));if(J===1)return"Every minute";return`Every ${J} minutes`}if(Y!=="*"&&!Y.includes("/")&&_==="*"&&O==="*"&&L==="*"&&K==="*")return"Every hour";if(_.startsWith("*/")&&O==="*"&&L==="*"&&K==="*"){let J=parseInt(_.slice(2));if(J===1)return"Every hour";return`Every ${J} hours`}let Z=(J,U)=>{let $=parseInt(J),W=parseInt(U);if(isNaN($))return"";let N=$>=12?"PM":"AM";return`${$===0?12:$>12?$-12:$}:${W.toString().padStart(2,"0")} ${N}`};if(_!=="*"&&!_.includes("/")&&O==="*"&&L==="*"){let J=Z(_,Y);if(K==="*")return`Daily at ${J}`;let U=K.split(",").map(($)=>{let W=parseInt($.trim());return o[W]||$});if(U.length===7)return`Daily at ${J}`;if(U.length===5&&!U.includes("Sat")&&!U.includes("Sun"))return`Weekdays at ${J}`;if(U.length===1)return`Weekly on ${U[0]} at ${J}`;return`${U.join(" & ")} at ${J}`}return G}catch{return G}}function y(G){let q=new Date(G),Y=new Date,_=q.getTime()-Y.getTime(),O=Math.abs(_),L=_>0,K=Math.floor(O/60000),Z=Math.floor(O/3600000),J=Math.floor(O/86400000),U=q.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),$=q.toDateString()===Y.toDateString(),W=new Date(Y);W.setDate(W.getDate()+1);let N=q.toDateString()===W.toDateString(),w=new Date(Y);w.setDate(w.getDate()-1);let R=q.toDateString()===w.toDateString();if($){if(K<1)return L?"now":"just now";if(K<60)return L?`in ${K} min (${U})`:`${K} min ago`;return L?`in ${Z}h (${U})`:`${Z}h ago`}if(N)return`Tomorrow at ${U}`;if(R)return`Yesterday at ${U}`;if(J<7)return`${o[q.getDay()]} at ${U}`;return q.toLocaleDateString([],{month:"short",day:"numeric"})+` at ${U}`}
|
|
2
|
+
export{Zz as d,zz as e,Bz as f,n as g,y as h};
|
|
3
|
+
|
|
4
|
+
//# debugId=6613E014B5F09F8264756E2164756E21
|