apteva 0.4.53 → 0.4.54
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.sw9p594m.js → ActivityPage.k33hj12v.js} +1 -1
- package/dist/{ApiDocsPage.90e03bz7.js → ApiDocsPage.q37747gr.js} +1 -1
- package/dist/{App.9t1zc5r7.js → App.3hp80jc2.js} +13 -13
- package/dist/{App.pse0pzar.js → App.5ebcd85d.js} +1 -1
- package/dist/{App.p7jjw1zf.js → App.6fefs2d5.js} +1 -1
- package/dist/{App.tm3k7h4b.js → App.794kjn6a.js} +1 -1
- package/dist/{App.ysxy7akk.js → App.c5ebgvec.js} +1 -1
- package/dist/App.cb1np6f0.js +20 -0
- package/dist/{App.jhb45d7r.js → App.ccs4g85x.js} +1 -1
- package/dist/{App.9sryp183.js → App.g1qhcmpc.js} +1 -1
- package/dist/{App.r43t58w6.js → App.jemr4v3a.js} +2 -2
- package/dist/{App.vkg121c6.js → App.kpyf0grm.js} +1 -1
- package/dist/{App.stgng5bx.js → App.p7zc1bv2.js} +1 -1
- package/dist/{App.xva0tfzh.js → App.qx4wdtjg.js} +1 -1
- package/dist/{App.yzkh4gq2.js → App.wjxmwjrp.js} +1 -1
- package/dist/{App.3vnrera5.js → App.wq1f2jke.js} +1 -1
- package/dist/{App.pfbdzrhh.js → App.zx6x0gk2.js} +1 -1
- package/dist/ConnectionsPage.8b2v07qp.js +3 -0
- package/dist/McpPage.3800a82c.js +3 -0
- package/dist/SettingsPage.88nj3hbv.js +3 -0
- package/dist/SkillsPage.b8pxj5mb.js +3 -0
- package/dist/TasksPage.6b3y4b1n.js +3 -0
- package/dist/TelemetryPage.7q4d69wj.js +3 -0
- package/dist/TestsPage.dpevv5xb.js +3 -0
- package/dist/ThreadsPage.1h15363y.js +3 -0
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/mcp-platform.ts +75 -9
- package/src/routes/api/telemetry.ts +0 -7
- package/src/web/components/telemetry/TelemetryPage.tsx +13 -10
- package/src/web/context/TelemetryContext.tsx +4 -1
- package/dist/App.94x6mh7f.js +0 -20
- package/dist/ConnectionsPage.q5f9fd37.js +0 -3
- package/dist/McpPage.f3ccrezb.js +0 -3
- package/dist/SettingsPage.zmzm1pp6.js +0 -3
- package/dist/SkillsPage.whxnez67.js +0 -3
- package/dist/TasksPage.zp4jfevw.js +0 -3
- package/dist/TelemetryPage.an0ky78c.js +0 -3
- package/dist/TestsPage.18krj0d1.js +0 -3
- package/dist/ThreadsPage.nnphgy98.js +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{O as V}from"./App.vkg121c6.js";import{U as D}from"./App.p7jjw1zf.js";import{$ as Kk,X as P,aa as v,da as i,ja as o,ma as d}from"./App.94x6mh7f.js";var J=P(Kk(),1);var q=P(v(),1);function Yk(){let{authFetch:K}=o(),{currentProjectId:X}=d(),{confirm:j,ConfirmDialog:E}=V(),[$,x]=J.useState([]),[A,c]=J.useState([]),[a,u]=J.useState(!0),[r,Y]=J.useState(!1),[H,C]=J.useState(null),[T,Q]=J.useState(new Set),[F,R]=J.useState(!1),[y,I]=J.useState(null),[w,f]=J.useState(null),[S,U]=J.useState({}),[M,N]=J.useState(""),[b,L]=J.useState(""),[g,B]=J.useState(""),Z=X&&X!=="all"&&X!=="unassigned"?X:null,n=Z?A.filter((k)=>k.projectId===Z):A,{events:p}=i({category:"test",limit:50}),_=J.useRef(new Set);J.useEffect(()=>{for(let k of p){if(_.current.has(k.id))continue;_.current.add(k.id);let z=k.data?.test_case_id;if(!z)continue;if(k.type==="test_started")U((G)=>({...G,[z]:{phase:"starting"}})),Q((G)=>new Set(G).add(z));else if(k.type==="test_planning")U((G)=>({...G,[z]:{phase:"planning"}}));else if(k.type==="test_executing"){let G=k.data?.agent_name;U((O)=>({...O,[z]:{phase:"executing",detail:G}}))}else if(k.type==="test_judging")U((G)=>({...G,[z]:{phase:"judging"}}));else if(k.type==="test_completed")U((G)=>{let O={...G};return delete O[z],O}),Q((G)=>{let O=new Set(G);return O.delete(z),O}),W()}if(_.current.size>500)_.current=new Set([..._.current].slice(-200))},[p]);let W=async()=>{try{let k=Z?`?project_id=${Z}`:"",z=await K(`/api/tests${k}`);if(z.ok)x(await z.json())}catch{}u(!1)},s=async()=>{try{let k=await K("/api/agents");if(k.ok){let z=await k.json();c((z.agents||z).map((G)=>({id:G.id,name:G.name,status:G.status,provider:G.provider,model:G.model,projectId:G.projectId||null})))}}catch{}};J.useEffect(()=>{Promise.all([W(),s()])},[X]);let l=()=>{C(null),N(""),L(""),B(""),Y(!0)},t=(k)=>{C(k),N(k.name),L(k.behavior||""),B(k.agent_id||""),Y(!0)},e=async()=>{if(!M||!b)return;let k={name:M,behavior:b,agent_id:g||null,project_id:Z||void 0};if(H)await K(`/api/tests/${H.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});else await K("/api/tests",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});Y(!1),W()},kk=async(k)=>{if(!await j("Delete this test case? Run history will also be deleted."))return;await K(`/api/tests/${k}`,{method:"DELETE"}),W()},qk=async(k)=>{Q((z)=>new Set(z).add(k));try{await K(`/api/tests/${k}/run`,{method:"POST"}),await W()}catch{}Q((z)=>{let G=new Set(z);return G.delete(k),G}),U((z)=>{let G={...z};return delete G[k],G})},zk=async()=>{R(!0);try{let k=$.map((z)=>z.id);Q(new Set(k)),await K("/api/tests/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({test_case_ids:k})}),await W()}catch{}Q(new Set),R(!1)},Gk=async(k)=>{try{let z=await K(`/api/tests/${k}/runs`);if(z.ok)I({testId:k,runs:await z.json()})}catch{}},h={starting:{label:"Starting",color:"bg-blue-900/50 text-blue-400 border-blue-500/30"},planning:{label:"Planning",color:"bg-purple-900/50 text-purple-400 border-purple-500/30"},executing:{label:"Executing",color:"bg-cyan-900/50 text-cyan-400 border-cyan-500/30"},judging:{label:"Judging",color:"bg-amber-900/50 text-amber-400 border-amber-500/30"}},m=(k)=>{return q.jsxDEV("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${{passed:"bg-green-900/50 text-green-400",failed:"bg-red-900/50 text-red-400",error:"bg-yellow-900/50 text-yellow-400",running:"bg-blue-900/50 text-blue-400"}[k]||"bg-[var(--color-surface-raised)] text-[var(--color-text-muted)]"}`,children:k.toUpperCase()},void 0,!1,void 0,this)},Jk=(k)=>{let z=S[k];if(!z)return null;let G=h[z.phase]||h.starting;return q.jsxDEV("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-medium border ${G.color} animate-pulse`,children:[q.jsxDEV("span",{className:"w-1.5 h-1.5 rounded-full bg-current"},void 0,!1,void 0,this),G.label,z.detail?` · ${z.detail}`:""]},void 0,!0,void 0,this)};return q.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:[E,q.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[q.jsxDEV("div",{children:[q.jsxDEV("h1",{className:"text-xl font-bold",children:"Tests"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)] mt-1",children:"Describe behavior, AI handles the rest"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[$.length>0&&q.jsxDEV("button",{onClick:zk,disabled:F,className:"px-4 py-2 bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] text-[var(--color-text)] rounded text-sm font-medium transition disabled:opacity-50",children:F?"Running...":"Run All"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:l,className:"px-4 py-2 bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-white rounded text-sm font-medium transition",children:"+ New Test"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a?q.jsxDEV("div",{className:"text-[var(--color-text-muted)] text-sm",children:"Loading..."},void 0,!1,void 0,this):$.length===0?q.jsxDEV("div",{className:"text-center py-16",children:[q.jsxDEV("div",{className:"text-[var(--color-border-light)] text-4xl mb-4",children:q.jsxDEV("svg",{className:"w-12 h-12 mx-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:q.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[var(--color-text-muted)] mb-2",children:"No tests yet"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mb-4",children:"Describe what your agents should do and let AI verify it"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:l,className:"px-4 py-2 bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-white rounded text-sm font-medium transition",children:"Create your first test"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"space-y-3",children:$.map((k)=>q.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-4",children:q.jsxDEV("div",{className:"flex items-start justify-between",children:[q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("div",{className:"flex items-center gap-2 mb-1",children:[q.jsxDEV("span",{className:"font-medium text-sm",children:k.name},void 0,!1,void 0,this),S[k.id]?Jk(k.id):k.last_run&&q.jsxDEV(q.Fragment,{children:[m(k.last_run.status),k.last_run.score!=null&&q.jsxDEV("span",{className:"text-xs text-[var(--color-text-secondary)] font-mono",children:[k.last_run.score,"/10"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.behavior&&q.jsxDEV("p",{className:"text-xs text-[var(--color-text-secondary)] mb-1.5 line-clamp-2",children:k.behavior},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] space-y-0.5",children:[q.jsxDEV("div",{children:["Agent:"," ",q.jsxDEV("span",{className:"text-[var(--color-text-secondary)]",children:k.agent_name||(k.last_run?.selected_agent_name?`${k.last_run.selected_agent_name} (auto-selected)`:"Auto (AI picks)")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.last_run?.generated_message&&q.jsxDEV("div",{className:"truncate",children:["Message: ",q.jsxDEV("span",{className:"text-[var(--color-text-secondary)]",children:['"',k.last_run.generated_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.input_message&&!k.last_run?.generated_message&&q.jsxDEV("div",{className:"truncate",children:["Message: ",q.jsxDEV("span",{className:"text-[var(--color-text-secondary)]",children:['"',k.input_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.last_run&&q.jsxDEV("div",{children:["Last run:"," ",q.jsxDEV("span",{className:"text-[var(--color-text-secondary)]",children:[k.last_run.duration_ms?`${(k.last_run.duration_ms/1000).toFixed(1)}s`:"---",k.last_run.judge_reasoning&&` --- "${k.last_run.judge_reasoning.slice(0,80)}${k.last_run.judge_reasoning.length>80?"...":""}"`]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-1 ml-3 shrink-0",children:[q.jsxDEV("button",{onClick:()=>Gk(k.id),className:"px-2 py-1 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)] rounded transition",title:"View run history",children:"History"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>qk(k.id),disabled:T.has(k.id),className:"px-3 py-1 text-xs bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] text-[var(--color-text)] rounded transition disabled:opacity-50",children:T.has(k.id)?"Running...":"Run"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>t(k),className:"px-2 py-1 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)] rounded transition",children:"Edit"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>kk(k.id),className:"px-2 py-1 text-xs text-[var(--color-text-muted)] hover:text-red-400 hover:bg-[var(--color-surface-raised)] rounded transition",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},k.id,!1,void 0,this))},void 0,!1,void 0,this),y&&q.jsxDEV("div",{className:"mt-6",children:[q.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[q.jsxDEV("h2",{className:"text-sm font-bold text-[var(--color-text-secondary)]",children:"Run History"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>{I(null),f(null)},className:"text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]",children:"Close"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y.runs.length===0?q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)]",children:"No runs yet"},void 0,!1,void 0,this):q.jsxDEV("div",{className:"space-y-2",children:y.runs.map((k)=>q.jsxDEV("div",{className:"bg-[var(--color-bg-secondary)] border border-[var(--color-border)] rounded p-3",children:[q.jsxDEV("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>f(w===k.id?null:k.id),children:[q.jsxDEV("div",{className:"flex items-center gap-3",children:[m(k.status),q.jsxDEV("span",{className:"text-xs text-[var(--color-text-muted)]",children:k.duration_ms?`${(k.duration_ms/1000).toFixed(1)}s`:"---"},void 0,!1,void 0,this),k.score!=null&&q.jsxDEV("span",{className:"text-xs text-[var(--color-text-secondary)] font-mono",children:[k.score,"/10"]},void 0,!0,void 0,this),k.selected_agent_name&&q.jsxDEV("span",{className:"text-xs text-[var(--color-text-faint)]",children:["Agent: ",k.selected_agent_name]},void 0,!0,void 0,this),q.jsxDEV("span",{className:"text-xs text-[var(--color-text-faint)]",children:new Date(k.created_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("span",{className:"text-xs text-[var(--color-text-faint)]",children:w===k.id?"---":"+"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w===k.id&&q.jsxDEV("div",{className:"mt-3 space-y-2",children:[k.planner_reasoning&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] mb-1",children:"Planner:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[var(--color-text-secondary)] bg-[var(--color-bg)] p-2 rounded",children:[k.selected_agent_name&&q.jsxDEV("span",{className:"text-[var(--color-accent)]",children:k.selected_agent_name},void 0,!1,void 0,this),k.selected_agent_name&&" --- ",k.planner_reasoning]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.generated_message&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] mb-1",children:"Generated Message:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[var(--color-text-secondary)] bg-[var(--color-bg)] p-2 rounded",children:['"',k.generated_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.judge_reasoning&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] mb-1",children:"Judge:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[var(--color-text-secondary)] bg-[var(--color-bg)] p-2 rounded",children:k.judge_reasoning},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.error&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-red-400 mb-1",children:"Error:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-red-300 bg-[var(--color-bg)] p-2 rounded",children:k.error},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.agent_response&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] mb-1",children:"Agent Response (Thread):"},void 0,!1,void 0,this),q.jsxDEV("pre",{className:"text-xs text-[var(--color-text-secondary)] bg-[var(--color-bg)] p-2 rounded overflow-auto max-h-64",children:k.agent_response},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},k.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r&&q.jsxDEV("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center",onClick:()=>Y(!1),children:q.jsxDEV("div",{className:"bg-[var(--color-surface)] card w-full max-w-lg mx-4 p-6",onClick:(k)=>k.stopPropagation(),children:[q.jsxDEV("h2",{className:"text-lg font-bold mb-4",children:H?"Edit Test":"New Test"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"space-y-4",children:[q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[var(--color-text-muted)] mb-1",children:"Name"},void 0,!1,void 0,this),q.jsxDEV("input",{value:M,onChange:(k)=>N(k.target.value),placeholder:"e.g. Social Media Posting",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)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[var(--color-text-muted)] mb-1",children:"Behavior"},void 0,!1,void 0,this),q.jsxDEV("textarea",{value:b,onChange:(k)=>L(k.target.value),placeholder:"Describe what should happen, e.g. 'When asked to post on social media, the agent creates a proper post with relevant hashtags and confirms it was published'",rows:3,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)] resize-none"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mt-1",children:"AI will generate the test message and evaluate results based on this"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[var(--color-text-muted)] mb-1",children:"Agent"},void 0,!1,void 0,this),q.jsxDEV(D,{value:g,onChange:B,placeholder:"Auto (AI picks the best agent)",options:n.map((k)=>({value:k.id,label:`${k.name} (${k.status})`}))},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mt-1",children:"Leave empty to let AI choose the right agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex justify-end gap-2 mt-6",children:[q.jsxDEV("button",{onClick:()=>Y(!1),className:"px-4 py-2 text-sm text-[var(--color-text-secondary)] hover:text-[var(--color-text)] transition",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:e,disabled:!M||!b,className:"px-4 py-2 bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] disabled:opacity-50 text-white rounded text-sm font-medium transition",children:H?"Save":"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)]},void 0,!0,void 0,this)}
|
|
1
|
+
import{O as V}from"./App.kpyf0grm.js";import{U as D}from"./App.6fefs2d5.js";import{$ as Kk,X as P,aa as v,da as i,ja as o,ma as d}from"./App.cb1np6f0.js";var J=P(Kk(),1);var q=P(v(),1);function Yk(){let{authFetch:K}=o(),{currentProjectId:X}=d(),{confirm:j,ConfirmDialog:E}=V(),[$,x]=J.useState([]),[A,c]=J.useState([]),[a,u]=J.useState(!0),[r,Y]=J.useState(!1),[H,C]=J.useState(null),[T,Q]=J.useState(new Set),[F,R]=J.useState(!1),[y,I]=J.useState(null),[w,f]=J.useState(null),[S,U]=J.useState({}),[M,N]=J.useState(""),[b,L]=J.useState(""),[g,B]=J.useState(""),Z=X&&X!=="all"&&X!=="unassigned"?X:null,n=Z?A.filter((k)=>k.projectId===Z):A,{events:p}=i({category:"test",limit:50}),_=J.useRef(new Set);J.useEffect(()=>{for(let k of p){if(_.current.has(k.id))continue;_.current.add(k.id);let z=k.data?.test_case_id;if(!z)continue;if(k.type==="test_started")U((G)=>({...G,[z]:{phase:"starting"}})),Q((G)=>new Set(G).add(z));else if(k.type==="test_planning")U((G)=>({...G,[z]:{phase:"planning"}}));else if(k.type==="test_executing"){let G=k.data?.agent_name;U((O)=>({...O,[z]:{phase:"executing",detail:G}}))}else if(k.type==="test_judging")U((G)=>({...G,[z]:{phase:"judging"}}));else if(k.type==="test_completed")U((G)=>{let O={...G};return delete O[z],O}),Q((G)=>{let O=new Set(G);return O.delete(z),O}),W()}if(_.current.size>500)_.current=new Set([..._.current].slice(-200))},[p]);let W=async()=>{try{let k=Z?`?project_id=${Z}`:"",z=await K(`/api/tests${k}`);if(z.ok)x(await z.json())}catch{}u(!1)},s=async()=>{try{let k=await K("/api/agents");if(k.ok){let z=await k.json();c((z.agents||z).map((G)=>({id:G.id,name:G.name,status:G.status,provider:G.provider,model:G.model,projectId:G.projectId||null})))}}catch{}};J.useEffect(()=>{Promise.all([W(),s()])},[X]);let l=()=>{C(null),N(""),L(""),B(""),Y(!0)},t=(k)=>{C(k),N(k.name),L(k.behavior||""),B(k.agent_id||""),Y(!0)},e=async()=>{if(!M||!b)return;let k={name:M,behavior:b,agent_id:g||null,project_id:Z||void 0};if(H)await K(`/api/tests/${H.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});else await K("/api/tests",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});Y(!1),W()},kk=async(k)=>{if(!await j("Delete this test case? Run history will also be deleted."))return;await K(`/api/tests/${k}`,{method:"DELETE"}),W()},qk=async(k)=>{Q((z)=>new Set(z).add(k));try{await K(`/api/tests/${k}/run`,{method:"POST"}),await W()}catch{}Q((z)=>{let G=new Set(z);return G.delete(k),G}),U((z)=>{let G={...z};return delete G[k],G})},zk=async()=>{R(!0);try{let k=$.map((z)=>z.id);Q(new Set(k)),await K("/api/tests/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({test_case_ids:k})}),await W()}catch{}Q(new Set),R(!1)},Gk=async(k)=>{try{let z=await K(`/api/tests/${k}/runs`);if(z.ok)I({testId:k,runs:await z.json()})}catch{}},h={starting:{label:"Starting",color:"bg-blue-900/50 text-blue-400 border-blue-500/30"},planning:{label:"Planning",color:"bg-purple-900/50 text-purple-400 border-purple-500/30"},executing:{label:"Executing",color:"bg-cyan-900/50 text-cyan-400 border-cyan-500/30"},judging:{label:"Judging",color:"bg-amber-900/50 text-amber-400 border-amber-500/30"}},m=(k)=>{return q.jsxDEV("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${{passed:"bg-green-900/50 text-green-400",failed:"bg-red-900/50 text-red-400",error:"bg-yellow-900/50 text-yellow-400",running:"bg-blue-900/50 text-blue-400"}[k]||"bg-[var(--color-surface-raised)] text-[var(--color-text-muted)]"}`,children:k.toUpperCase()},void 0,!1,void 0,this)},Jk=(k)=>{let z=S[k];if(!z)return null;let G=h[z.phase]||h.starting;return q.jsxDEV("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-medium border ${G.color} animate-pulse`,children:[q.jsxDEV("span",{className:"w-1.5 h-1.5 rounded-full bg-current"},void 0,!1,void 0,this),G.label,z.detail?` · ${z.detail}`:""]},void 0,!0,void 0,this)};return q.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:[E,q.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[q.jsxDEV("div",{children:[q.jsxDEV("h1",{className:"text-xl font-bold",children:"Tests"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)] mt-1",children:"Describe behavior, AI handles the rest"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[$.length>0&&q.jsxDEV("button",{onClick:zk,disabled:F,className:"px-4 py-2 bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] text-[var(--color-text)] rounded text-sm font-medium transition disabled:opacity-50",children:F?"Running...":"Run All"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:l,className:"px-4 py-2 bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-white rounded text-sm font-medium transition",children:"+ New Test"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a?q.jsxDEV("div",{className:"text-[var(--color-text-muted)] text-sm",children:"Loading..."},void 0,!1,void 0,this):$.length===0?q.jsxDEV("div",{className:"text-center py-16",children:[q.jsxDEV("div",{className:"text-[var(--color-border-light)] text-4xl mb-4",children:q.jsxDEV("svg",{className:"w-12 h-12 mx-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:q.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[var(--color-text-muted)] mb-2",children:"No tests yet"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mb-4",children:"Describe what your agents should do and let AI verify it"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:l,className:"px-4 py-2 bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-white rounded text-sm font-medium transition",children:"Create your first test"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"space-y-3",children:$.map((k)=>q.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-4",children:q.jsxDEV("div",{className:"flex items-start justify-between",children:[q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("div",{className:"flex items-center gap-2 mb-1",children:[q.jsxDEV("span",{className:"font-medium text-sm",children:k.name},void 0,!1,void 0,this),S[k.id]?Jk(k.id):k.last_run&&q.jsxDEV(q.Fragment,{children:[m(k.last_run.status),k.last_run.score!=null&&q.jsxDEV("span",{className:"text-xs text-[var(--color-text-secondary)] font-mono",children:[k.last_run.score,"/10"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.behavior&&q.jsxDEV("p",{className:"text-xs text-[var(--color-text-secondary)] mb-1.5 line-clamp-2",children:k.behavior},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] space-y-0.5",children:[q.jsxDEV("div",{children:["Agent:"," ",q.jsxDEV("span",{className:"text-[var(--color-text-secondary)]",children:k.agent_name||(k.last_run?.selected_agent_name?`${k.last_run.selected_agent_name} (auto-selected)`:"Auto (AI picks)")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.last_run?.generated_message&&q.jsxDEV("div",{className:"truncate",children:["Message: ",q.jsxDEV("span",{className:"text-[var(--color-text-secondary)]",children:['"',k.last_run.generated_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.input_message&&!k.last_run?.generated_message&&q.jsxDEV("div",{className:"truncate",children:["Message: ",q.jsxDEV("span",{className:"text-[var(--color-text-secondary)]",children:['"',k.input_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.last_run&&q.jsxDEV("div",{children:["Last run:"," ",q.jsxDEV("span",{className:"text-[var(--color-text-secondary)]",children:[k.last_run.duration_ms?`${(k.last_run.duration_ms/1000).toFixed(1)}s`:"---",k.last_run.judge_reasoning&&` --- "${k.last_run.judge_reasoning.slice(0,80)}${k.last_run.judge_reasoning.length>80?"...":""}"`]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-1 ml-3 shrink-0",children:[q.jsxDEV("button",{onClick:()=>Gk(k.id),className:"px-2 py-1 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)] rounded transition",title:"View run history",children:"History"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>qk(k.id),disabled:T.has(k.id),className:"px-3 py-1 text-xs bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] text-[var(--color-text)] rounded transition disabled:opacity-50",children:T.has(k.id)?"Running...":"Run"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>t(k),className:"px-2 py-1 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)] rounded transition",children:"Edit"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>kk(k.id),className:"px-2 py-1 text-xs text-[var(--color-text-muted)] hover:text-red-400 hover:bg-[var(--color-surface-raised)] rounded transition",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},k.id,!1,void 0,this))},void 0,!1,void 0,this),y&&q.jsxDEV("div",{className:"mt-6",children:[q.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[q.jsxDEV("h2",{className:"text-sm font-bold text-[var(--color-text-secondary)]",children:"Run History"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>{I(null),f(null)},className:"text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]",children:"Close"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y.runs.length===0?q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)]",children:"No runs yet"},void 0,!1,void 0,this):q.jsxDEV("div",{className:"space-y-2",children:y.runs.map((k)=>q.jsxDEV("div",{className:"bg-[var(--color-bg-secondary)] border border-[var(--color-border)] rounded p-3",children:[q.jsxDEV("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>f(w===k.id?null:k.id),children:[q.jsxDEV("div",{className:"flex items-center gap-3",children:[m(k.status),q.jsxDEV("span",{className:"text-xs text-[var(--color-text-muted)]",children:k.duration_ms?`${(k.duration_ms/1000).toFixed(1)}s`:"---"},void 0,!1,void 0,this),k.score!=null&&q.jsxDEV("span",{className:"text-xs text-[var(--color-text-secondary)] font-mono",children:[k.score,"/10"]},void 0,!0,void 0,this),k.selected_agent_name&&q.jsxDEV("span",{className:"text-xs text-[var(--color-text-faint)]",children:["Agent: ",k.selected_agent_name]},void 0,!0,void 0,this),q.jsxDEV("span",{className:"text-xs text-[var(--color-text-faint)]",children:new Date(k.created_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("span",{className:"text-xs text-[var(--color-text-faint)]",children:w===k.id?"---":"+"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w===k.id&&q.jsxDEV("div",{className:"mt-3 space-y-2",children:[k.planner_reasoning&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] mb-1",children:"Planner:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[var(--color-text-secondary)] bg-[var(--color-bg)] p-2 rounded",children:[k.selected_agent_name&&q.jsxDEV("span",{className:"text-[var(--color-accent)]",children:k.selected_agent_name},void 0,!1,void 0,this),k.selected_agent_name&&" --- ",k.planner_reasoning]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.generated_message&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] mb-1",children:"Generated Message:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[var(--color-text-secondary)] bg-[var(--color-bg)] p-2 rounded",children:['"',k.generated_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.judge_reasoning&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] mb-1",children:"Judge:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[var(--color-text-secondary)] bg-[var(--color-bg)] p-2 rounded",children:k.judge_reasoning},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.error&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-red-400 mb-1",children:"Error:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-red-300 bg-[var(--color-bg)] p-2 rounded",children:k.error},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.agent_response&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] mb-1",children:"Agent Response (Thread):"},void 0,!1,void 0,this),q.jsxDEV("pre",{className:"text-xs text-[var(--color-text-secondary)] bg-[var(--color-bg)] p-2 rounded overflow-auto max-h-64",children:k.agent_response},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},k.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r&&q.jsxDEV("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center",onClick:()=>Y(!1),children:q.jsxDEV("div",{className:"bg-[var(--color-surface)] card w-full max-w-lg mx-4 p-6",onClick:(k)=>k.stopPropagation(),children:[q.jsxDEV("h2",{className:"text-lg font-bold mb-4",children:H?"Edit Test":"New Test"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"space-y-4",children:[q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[var(--color-text-muted)] mb-1",children:"Name"},void 0,!1,void 0,this),q.jsxDEV("input",{value:M,onChange:(k)=>N(k.target.value),placeholder:"e.g. Social Media Posting",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)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[var(--color-text-muted)] mb-1",children:"Behavior"},void 0,!1,void 0,this),q.jsxDEV("textarea",{value:b,onChange:(k)=>L(k.target.value),placeholder:"Describe what should happen, e.g. 'When asked to post on social media, the agent creates a proper post with relevant hashtags and confirms it was published'",rows:3,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)] resize-none"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mt-1",children:"AI will generate the test message and evaluate results based on this"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[var(--color-text-muted)] mb-1",children:"Agent"},void 0,!1,void 0,this),q.jsxDEV(D,{value:g,onChange:B,placeholder:"Auto (AI picks the best agent)",options:n.map((k)=>({value:k.id,label:`${k.name} (${k.status})`}))},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mt-1",children:"Leave empty to let AI choose the right agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex justify-end gap-2 mt-6",children:[q.jsxDEV("button",{onClick:()=>Y(!1),className:"px-4 py-2 text-sm text-[var(--color-text-secondary)] hover:text-[var(--color-text)] transition",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:e,disabled:!M||!b,className:"px-4 py-2 bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] disabled:opacity-50 text-white rounded text-sm font-medium transition",children:H?"Save":"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)]},void 0,!0,void 0,this)}
|
|
2
2
|
export{Yk as M};
|
|
3
3
|
|
|
4
4
|
//# debugId=2D14C6A7BC29E53364756E2164756E21
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{d as a,e as b,f as c,g as d,h as e}from"./App.wjxmwjrp.js";import"./App.g1qhcmpc.js";import"./App.kpyf0grm.js";import"./App.6fefs2d5.js";import"./App.cb1np6f0.js";export{e as formatRelativeTime,d as formatCron,c as TrajectoryView,a as TasksPage,b as TaskDetailPanel};
|
|
2
|
+
|
|
3
|
+
//# debugId=C2CFA2705D3D8A1B64756E2164756E21
|
package/dist/index.html
CHANGED
package/package.json
CHANGED
package/src/mcp-platform.ts
CHANGED
|
@@ -828,6 +828,30 @@ After adding, use assign_mcp_server_to_agent to give an agent access to these to
|
|
|
828
828
|
required: ["provider", "config_id"],
|
|
829
829
|
},
|
|
830
830
|
},
|
|
831
|
+
// Analytics
|
|
832
|
+
{
|
|
833
|
+
name: "get_analytics",
|
|
834
|
+
description: "Get analytics summary: total events, LLM calls, tool calls, errors, token usage (input/output/cache/reasoning), and cost. Optionally filter by agent, project, or time range.",
|
|
835
|
+
inputSchema: {
|
|
836
|
+
type: "object",
|
|
837
|
+
properties: {
|
|
838
|
+
agent_id: { type: "string", description: "Filter by agent ID (optional)" },
|
|
839
|
+
project_id: { type: "string", description: "Filter by project ID (optional)" },
|
|
840
|
+
since: { type: "string", description: "ISO timestamp — only include events after this time (optional)" },
|
|
841
|
+
},
|
|
842
|
+
},
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
name: "get_usage_by_agent",
|
|
846
|
+
description: "Get token usage and cost breakdown per agent. Returns LLM calls, tool calls, input/output/cache/reasoning tokens, errors, and cost for each agent.",
|
|
847
|
+
inputSchema: {
|
|
848
|
+
type: "object",
|
|
849
|
+
properties: {
|
|
850
|
+
project_id: { type: "string", description: "Filter by project ID (optional)" },
|
|
851
|
+
since: { type: "string", description: "ISO timestamp — only include events after this time (optional)" },
|
|
852
|
+
},
|
|
853
|
+
},
|
|
854
|
+
},
|
|
831
855
|
];
|
|
832
856
|
|
|
833
857
|
// Project-only tools — hidden entirely when PROJECTS_ENABLED is not set
|
|
@@ -867,15 +891,33 @@ async function executeTool(name: string, args: Record<string, any>): Promise<{ c
|
|
|
867
891
|
: AgentDB.findAll();
|
|
868
892
|
// Exclude meta agent from list
|
|
869
893
|
const filtered = agents.filter(a => a.id !== META_AGENT_ID);
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
894
|
+
const mcpIds = [...new Set(filtered.flatMap(a => a.mcp_servers || []))];
|
|
895
|
+
const skillIds = [...new Set(filtered.flatMap(a => a.skills || []))];
|
|
896
|
+
const mcpMap = McpServerDB.findByIdsLight(mcpIds);
|
|
897
|
+
const skillMap = SkillDB.findByIds(skillIds);
|
|
898
|
+
const result = filtered.map(a => {
|
|
899
|
+
const mcpNames = (a.mcp_servers || [])
|
|
900
|
+
.map(id => mcpMap.get(id)?.name)
|
|
901
|
+
.filter(Boolean);
|
|
902
|
+
const skillNames = (a.skills || [])
|
|
903
|
+
.map(id => skillMap.get(id)?.name)
|
|
904
|
+
.filter(Boolean);
|
|
905
|
+
const enabledFeatures = Object.entries(a.features || {})
|
|
906
|
+
.filter(([, v]) => v === true || (typeof v === "object" && v !== null && (v as any).enabled))
|
|
907
|
+
.map(([k]) => k);
|
|
908
|
+
return {
|
|
909
|
+
id: a.id,
|
|
910
|
+
name: a.name,
|
|
911
|
+
provider: a.provider,
|
|
912
|
+
model: a.model,
|
|
913
|
+
status: a.status,
|
|
914
|
+
projectId: a.project_id,
|
|
915
|
+
features: enabledFeatures,
|
|
916
|
+
mcpServers: mcpNames,
|
|
917
|
+
skills: skillNames,
|
|
918
|
+
systemPrompt: a.system_prompt?.slice(0, 200) + (a.system_prompt && a.system_prompt.length > 200 ? "..." : ""),
|
|
919
|
+
};
|
|
920
|
+
});
|
|
879
921
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
880
922
|
}
|
|
881
923
|
|
|
@@ -2035,6 +2077,29 @@ async function executeTool(name: string, args: Record<string, any>): Promise<{ c
|
|
|
2035
2077
|
return { content: [{ type: "text", text: `Local add not supported for provider: ${providerId}` }], isError: true };
|
|
2036
2078
|
}
|
|
2037
2079
|
|
|
2080
|
+
case "get_analytics": {
|
|
2081
|
+
const stats = TelemetryDB.getStats({
|
|
2082
|
+
agentId: args.agent_id || undefined,
|
|
2083
|
+
projectId: args.project_id || undefined,
|
|
2084
|
+
since: args.since || undefined,
|
|
2085
|
+
});
|
|
2086
|
+
return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }] };
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
case "get_usage_by_agent": {
|
|
2090
|
+
const usage = TelemetryDB.getUsage({
|
|
2091
|
+
project_id: args.project_id || undefined,
|
|
2092
|
+
since: args.since || undefined,
|
|
2093
|
+
group_by: "agent",
|
|
2094
|
+
});
|
|
2095
|
+
// Enrich with agent names
|
|
2096
|
+
const enriched = usage.map(u => {
|
|
2097
|
+
const agent = AgentDB.findById(u.agent_id || "");
|
|
2098
|
+
return { ...u, agent_name: agent?.name || u.agent_id };
|
|
2099
|
+
});
|
|
2100
|
+
return { content: [{ type: "text", text: JSON.stringify(enriched, null, 2) }] };
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2038
2103
|
default:
|
|
2039
2104
|
return { content: [{ type: "text", text: `Unknown tool: ${name}` }], isError: true };
|
|
2040
2105
|
}
|
|
@@ -2090,6 +2155,7 @@ You can manage:
|
|
|
2090
2155
|
- PROJECTS: Organize agents into projects. Tools: list_projects, create_project, update_project, delete_project. Use project tools when the user is viewing All Projects. Deleting a project unassigns its agents (does not delete them).
|
|
2091
2156
|
- MCP SERVERS: Tool integrations that give agents capabilities (web search, file access, APIs). Use update_agent with add_mcp_servers to assign servers to agents.
|
|
2092
2157
|
- SKILLS: Reusable instruction sets that specialize agent behavior. Use create_skill to create new skills (pass project_id from context to scope to the current project). Use update_agent with add_skills/remove_skills to assign/unassign skills to agents. Tools: list_skills, get_skill, create_skill, update_skill, toggle_skill, delete_skill.
|
|
2158
|
+
- ANALYTICS: View token usage, costs, and activity stats across agents. Tools: get_analytics (summary totals), get_usage_by_agent (per-agent breakdown). Both support filtering by agent, project, or time range.
|
|
2093
2159
|
- PROVIDERS: View which LLM providers have API keys configured.
|
|
2094
2160
|
- TESTS: Create and run automated tests for agent workflows. Tests send a message to an agent, then an LLM judge evaluates the response against success criteria. Tools: list_tests, create_test, run_test, run_all_tests, get_test_results, delete_test.
|
|
2095
2161
|
- SUBSCRIPTIONS & TRIGGERS: Subscribe agents to external events (webhooks). Supports multiple providers (composio, agentdojo). Use list_trigger_providers → list_trigger_types → list_integration_connections → create_subscription. Manage with enable_subscription, disable_subscription, delete_subscription, list_subscriptions.
|
|
@@ -34,13 +34,6 @@ export async function handleTelemetryRoutes(
|
|
|
34
34
|
return json({ error: "agent_id and events are required" }, 400);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
// Debug: log raw incoming events
|
|
38
|
-
for (const event of body.events) {
|
|
39
|
-
if (event.category === "LLM") {
|
|
40
|
-
console.log(`[telemetry] RAW LLM event from ${body.agent_id}: ${JSON.stringify(event)}`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
37
|
// Filter out debug events - too noisy
|
|
45
38
|
const filteredEvents = body.events.filter(e => e.level !== "debug");
|
|
46
39
|
|
|
@@ -143,8 +143,8 @@ export function TelemetryPage() {
|
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
-
// Track
|
|
147
|
-
const
|
|
146
|
+
// Track the timestamp of the last fetch — only count realtime events arriving after this
|
|
147
|
+
const fetchTimestampRef = useRef<number>(0);
|
|
148
148
|
|
|
149
149
|
// Track which events are "new" (for animation) - stores event IDs with their arrival time
|
|
150
150
|
const [newEventIds, setNewEventIds] = useState<Set<string>>(new Set());
|
|
@@ -220,8 +220,8 @@ export function TelemetryPage() {
|
|
|
220
220
|
const events = eventsData.events || [];
|
|
221
221
|
setHistoricalEvents(events);
|
|
222
222
|
|
|
223
|
-
//
|
|
224
|
-
|
|
223
|
+
// Record fetch time — realtime events before this are already in DB aggregations
|
|
224
|
+
fetchTimestampRef.current = Date.now();
|
|
225
225
|
|
|
226
226
|
// Fetch usage by agent
|
|
227
227
|
const usageParams = new URLSearchParams();
|
|
@@ -283,7 +283,8 @@ export function TelemetryPage() {
|
|
|
283
283
|
let deltaCost = 0;
|
|
284
284
|
|
|
285
285
|
for (const event of realtimeEvents) {
|
|
286
|
-
|
|
286
|
+
// Only count events received via SSE AFTER the last fetch (DB already has everything before)
|
|
287
|
+
if (event._receivedAt && event._receivedAt > fetchTimestampRef.current) {
|
|
287
288
|
deltaEvents++;
|
|
288
289
|
const eventStats = extractEventStats(event);
|
|
289
290
|
deltaLlmCalls += eventStats.llm_calls;
|
|
@@ -320,9 +321,9 @@ export function TelemetryPage() {
|
|
|
320
321
|
usageMap.set(u.agent_id, { ...u });
|
|
321
322
|
}
|
|
322
323
|
|
|
323
|
-
// Add deltas from real-time events
|
|
324
|
+
// Add deltas from real-time events received after the last fetch
|
|
324
325
|
for (const event of realtimeEvents) {
|
|
325
|
-
if (
|
|
326
|
+
if (event._receivedAt && event._receivedAt > fetchTimestampRef.current) {
|
|
326
327
|
const eventStats = extractEventStats(event);
|
|
327
328
|
const existing = usageMap.get(event.agent_id);
|
|
328
329
|
if (existing) {
|
|
@@ -397,9 +398,9 @@ export function TelemetryPage() {
|
|
|
397
398
|
buckets.set(d.date, { ...d });
|
|
398
399
|
}
|
|
399
400
|
|
|
400
|
-
// Add deltas from real-time events
|
|
401
|
+
// Add deltas from real-time events received after the last fetch
|
|
401
402
|
for (const event of realtimeEvents) {
|
|
402
|
-
if (
|
|
403
|
+
if (event._receivedAt && event._receivedAt > fetchTimestampRef.current) {
|
|
403
404
|
const ts = new Date(event.timestamp);
|
|
404
405
|
const key = useDaily
|
|
405
406
|
? `${ts.getFullYear()}-${String(ts.getMonth() + 1).padStart(2, "0")}-${String(ts.getDate()).padStart(2, "0")}`
|
|
@@ -720,7 +721,9 @@ export function TelemetryPage() {
|
|
|
720
721
|
const stackedData = chartData.map(d => {
|
|
721
722
|
const cacheRead = d.cache_read_tokens || 0;
|
|
722
723
|
const cacheWrite = d.cache_creation_tokens || 0;
|
|
723
|
-
|
|
724
|
+
// Anthropic: input_tokens includes cache_read but NOT cache_creation
|
|
725
|
+
// So regular = input_tokens - cache_read (don't subtract cache_write)
|
|
726
|
+
const regularInput = Math.max(0, d.input_tokens - cacheRead);
|
|
724
727
|
const reasoning = d.reasoning_tokens || 0;
|
|
725
728
|
const regularOutput = Math.max(0, d.output_tokens - reasoning);
|
|
726
729
|
return {
|
|
@@ -13,6 +13,7 @@ export interface TelemetryEvent {
|
|
|
13
13
|
duration_ms?: number;
|
|
14
14
|
error?: string;
|
|
15
15
|
cost?: number;
|
|
16
|
+
_receivedAt?: number; // Client-side timestamp when event was received via SSE
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
interface TelemetryContextValue {
|
|
@@ -88,8 +89,10 @@ export function TelemetryProvider({ children }: { children: React.ReactNode }) {
|
|
|
88
89
|
|
|
89
90
|
// Handle array of events
|
|
90
91
|
if (Array.isArray(data)) {
|
|
92
|
+
const now = Date.now();
|
|
93
|
+
const stamped = data.map((e: TelemetryEvent) => ({ ...e, _receivedAt: now }));
|
|
91
94
|
setEvents(prev => {
|
|
92
|
-
const combined = [...
|
|
95
|
+
const combined = [...stamped, ...prev];
|
|
93
96
|
return combined.slice(0, MAX_EVENTS);
|
|
94
97
|
});
|
|
95
98
|
|
package/dist/App.94x6mh7f.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
var GZ=Object.create;var{getPrototypeOf:HZ,defineProperty:xW,getOwnPropertyNames:BZ}=Object;var zZ=Object.prototype.hasOwnProperty;var n=(H,$,M)=>{M=H!=null?GZ(HZ(H)):{};let U=$||!H||!H.__esModule?xW(M,"default",{value:H,enumerable:!0}):M;for(let V of BZ(H))if(!zZ.call(U,V))xW(U,V,{get:()=>H[V],enumerable:!0});return U};var yW=(H,$)=>()=>($||H(($={exports:{}}).exports,$),$.exports);var EZ=(H,$)=>{for(var M in $)xW(H,M,{get:$[M],enumerable:!0,configurable:!0,set:(U)=>$[M]=()=>U})};var IZ=((H)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(H,{get:($,M)=>(typeof require<"u"?require:$)[M]}):H)(function(H){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+H+'" is not supported')});var UW=yW((QZ,KW)=>{(function(){function H(W,Z){Object.defineProperty(U.prototype,W,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",Z[0],Z[1])}})}function $(W){if(W===null||typeof W!=="object")return null;return W=EW&&W[EW]||W["@@iterator"],typeof W==="function"?W:null}function M(W,Z){W=(W=W.constructor)&&(W.displayName||W.name)||"ReactClass";var G=W+"."+Z;IW[G]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",Z,W),IW[G]=!0)}function U(W,Z,G){this.props=W,this.context=Z,this.refs=NW,this.updater=G||AW}function V(){}function E(W,Z,G){this.props=W,this.context=Z,this.refs=NW,this.updater=G||AW}function v(){}function N(W){return""+W}function C(W){try{N(W);var Z=!1}catch(Q){Z=!0}if(Z){Z=console;var G=Z.error,B=typeof Symbol==="function"&&Symbol.toStringTag&&W[Symbol.toStringTag]||W.constructor.name||"Object";return G.call(Z,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",B),N(W)}}function b(W){if(W==null)return null;if(typeof W==="function")return W.$$typeof===tW?null:W.displayName||W.name||null;if(typeof W==="string")return W;switch(W){case QW:return"Fragment";case L:return"Profiler";case X:return"StrictMode";case YW:return"Suspense";case k:return"SuspenseList";case LW:return"Activity"}if(typeof W==="object")switch(typeof W.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),W.$$typeof){case JW:return"Portal";case u:return W.displayName||"Context";case j:return(W._context.displayName||"Context")+".Consumer";case t:var Z=W.render;return W=W.displayName,W||(W=Z.displayName||Z.name||"",W=W!==""?"ForwardRef("+W+")":"ForwardRef"),W;case e:return Z=W.displayName||null,Z!==null?Z:b(W.type)||"Memo";case WW:Z=W._payload,W=W._init;try{return b(W(Z))}catch(G){}}return null}function o(W){if(W===QW)return"<>";if(typeof W==="object"&&W!==null&&W.$$typeof===WW)return"<...>";try{var Z=b(W);return Z?"<"+Z+">":"<...>"}catch(G){return"<...>"}}function w(){var W=q.A;return W===null?null:W.getOwner()}function m(){return Error("react-stack-top-frame")}function d(W){if(qW.call(W,"key")){var Z=Object.getOwnPropertyDescriptor(W,"key").get;if(Z&&Z.isReactWarning)return!1}return W.key!==void 0}function i(W,Z){function G(){CW||(CW=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",Z))}G.isReactWarning=!0,Object.defineProperty(W,"key",{get:G,configurable:!0})}function f(){var W=b(this.type);return gW[W]||(gW[W]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),W=this.props.ref,W!==void 0?W:null}function P(W,Z,G,B,Q,D){var J=G.ref;return W={$$typeof:MW,type:W,key:Z,props:G,_owner:B},(J!==void 0?J:null)!==null?Object.defineProperty(W,"ref",{enumerable:!1,get:f}):Object.defineProperty(W,"ref",{enumerable:!1,value:null}),W._store={},Object.defineProperty(W._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(W,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(W,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.defineProperty(W,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:D}),Object.freeze&&(Object.freeze(W.props),Object.freeze(W)),W}function y(W,Z){return Z=P(W.type,Z,W.props,W._owner,W._debugStack,W._debugTask),W._store&&(Z._store.validated=W._store.validated),Z}function c(W){p(W)?W._store&&(W._store.validated=1):typeof W==="object"&&W!==null&&W.$$typeof===WW&&(W._payload.status==="fulfilled"?p(W._payload.value)&&W._payload.value._store&&(W._payload.value._store.validated=1):W._store&&(W._store.validated=1))}function p(W){return typeof W==="object"&&W!==null&&W.$$typeof===MW}function l(W){var Z={"=":"=0",":":"=2"};return"$"+W.replace(/[=:]/g,function(G){return Z[G]})}function S(W,Z){return typeof W==="object"&&W!==null&&W.key!=null?(C(W.key),l(""+W.key)):Z.toString(36)}function g(W){switch(W.status){case"fulfilled":return W.value;case"rejected":throw W.reason;default:switch(typeof W.status==="string"?W.then(v,v):(W.status="pending",W.then(function(Z){W.status==="pending"&&(W.status="fulfilled",W.value=Z)},function(Z){W.status==="pending"&&(W.status="rejected",W.reason=Z)})),W.status){case"fulfilled":return W.value;case"rejected":throw W.reason}}throw W}function I(W,Z,G,B,Q){var D=typeof W;if(D==="undefined"||D==="boolean")W=null;var J=!1;if(W===null)J=!0;else switch(D){case"bigint":case"string":case"number":J=!0;break;case"object":switch(W.$$typeof){case MW:case JW:J=!0;break;case WW:return J=W._init,I(J(W._payload),Z,G,B,Q)}}if(J){J=W,Q=Q(J);var x=B===""?"."+S(J,0):B;return TW(Q)?(G="",x!=null&&(G=x.replace(bW,"$&/")+"/"),I(Q,Z,G,"",function(GW){return GW})):Q!=null&&(p(Q)&&(Q.key!=null&&(J&&J.key===Q.key||C(Q.key)),G=y(Q,G+(Q.key==null||J&&J.key===Q.key?"":(""+Q.key).replace(bW,"$&/")+"/")+x),B!==""&&J!=null&&p(J)&&J.key==null&&J._store&&!J._store.validated&&(G._store.validated=2),Q=G),Z.push(Q)),1}if(J=0,x=B===""?".":B+":",TW(W))for(var R=0;R<W.length;R++)B=W[R],D=x+S(B,R),J+=I(B,Z,G,D,Q);else if(R=$(W),typeof R==="function")for(R===W.entries&&(kW||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),kW=!0),W=R.call(W),R=0;!(B=W.next()).done;)B=B.value,D=x+S(B,R++),J+=I(B,Z,G,D,Q);else if(D==="object"){if(typeof W.then==="function")return I(g(W),Z,G,B,Q);throw Z=String(W),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(W).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return J}function z(W,Z,G){if(W==null)return W;var B=[],Q=0;return I(W,B,"","",function(D){return Z.call(G,D,Q++)}),B}function K(W){if(W._status===-1){var Z=W._ioInfo;Z!=null&&(Z.start=Z.end=performance.now()),Z=W._result;var G=Z();if(G.then(function(Q){if(W._status===0||W._status===-1){W._status=1,W._result=Q;var D=W._ioInfo;D!=null&&(D.end=performance.now()),G.status===void 0&&(G.status="fulfilled",G.value=Q)}},function(Q){if(W._status===0||W._status===-1){W._status=2,W._result=Q;var D=W._ioInfo;D!=null&&(D.end=performance.now()),G.status===void 0&&(G.status="rejected",G.reason=Q)}}),Z=W._ioInfo,Z!=null){Z.value=G;var B=G.displayName;typeof B==="string"&&(Z.name=B)}W._status===-1&&(W._status=0,W._result=G)}if(W._status===1)return Z=W._result,Z===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
2
|
-
|
|
3
|
-
Your code should look like:
|
|
4
|
-
const MyComponent = lazy(() => import('./MyComponent'))
|
|
5
|
-
|
|
6
|
-
Did you accidentally put curly braces around the import?`,Z),"default"in Z||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
7
|
-
|
|
8
|
-
Your code should look like:
|
|
9
|
-
const MyComponent = lazy(() => import('./MyComponent'))`,Z),Z.default;throw W._result}function Y(){var W=q.H;return W===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
10
|
-
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
11
|
-
2. You might be breaking the Rules of Hooks
|
|
12
|
-
3. You might have more than one copy of React in the same app
|
|
13
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),W}function O(){q.asyncTransitions--}function A(W){if(DW===null)try{var Z=("require"+Math.random()).slice(0,7);DW=(KW&&KW[Z]).call(KW,"timers").setImmediate}catch(G){DW=function(B){fW===!1&&(fW=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var Q=new MessageChannel;Q.port1.onmessage=B,Q.port2.postMessage(void 0)}}return DW(W)}function h(W){return 1<W.length&&typeof AggregateError==="function"?AggregateError(W):W[0]}function a(W,Z){Z!==RW-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),RW=Z}function XW(W,Z,G){var B=q.actQueue;if(B!==null)if(B.length!==0)try{zW(B),A(function(){return XW(W,Z,G)});return}catch(Q){q.thrownErrors.push(Q)}else q.actQueue=null;0<q.thrownErrors.length?(B=h(q.thrownErrors),q.thrownErrors.length=0,G(B)):Z(W)}function zW(W){if(!PW){PW=!0;var Z=0;try{for(;Z<W.length;Z++){var G=W[Z];do{q.didUsePromise=!1;var B=G(!1);if(B!==null){if(q.didUsePromise){W[Z]=G,W.splice(0,Z);return}G=B}else break}while(1)}W.length=0}catch(Q){W.splice(0,Z+1),q.thrownErrors.push(Q)}finally{PW=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var MW=Symbol.for("react.transitional.element"),JW=Symbol.for("react.portal"),QW=Symbol.for("react.fragment"),X=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),u=Symbol.for("react.context"),t=Symbol.for("react.forward_ref"),YW=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),e=Symbol.for("react.memo"),WW=Symbol.for("react.lazy"),LW=Symbol.for("react.activity"),EW=Symbol.iterator,IW={},AW={isMounted:function(){return!1},enqueueForceUpdate:function(W){M(W,"forceUpdate")},enqueueReplaceState:function(W){M(W,"replaceState")},enqueueSetState:function(W){M(W,"setState")}},jW=Object.assign,NW={};Object.freeze(NW),U.prototype.isReactComponent={},U.prototype.setState=function(W,Z){if(typeof W!=="object"&&typeof W!=="function"&&W!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,W,Z,"setState")},U.prototype.forceUpdate=function(W){this.updater.enqueueForceUpdate(this,W,"forceUpdate")};var r={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(OW in r)r.hasOwnProperty(OW)&&H(OW,r[OW]);V.prototype=U.prototype,r=E.prototype=new V,r.constructor=E,jW(r,U.prototype),r.isPureReactComponent=!0;var TW=Array.isArray,tW=Symbol.for("react.client.reference"),q={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},qW=Object.prototype.hasOwnProperty,vW=console.createTask?console.createTask:function(){return null};r={react_stack_bottom_frame:function(W){return W()}};var CW,SW,gW={},eW=r.react_stack_bottom_frame.bind(r,m)(),WZ=vW(o(m)),kW=!1,bW=/\/+/g,mW=typeof reportError==="function"?reportError:function(W){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof W==="object"&&W!==null&&typeof W.message==="string"?String(W.message):String(W),error:W});if(!window.dispatchEvent(Z))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",W);return}console.error(W)},fW=!1,DW=null,RW=0,wW=!1,PW=!1,hW=typeof queueMicrotask==="function"?function(W){queueMicrotask(function(){return queueMicrotask(W)})}:A;r=Object.freeze({__proto__:null,c:function(W){return Y().useMemoCache(W)}});var OW={map:z,forEach:function(W,Z,G){z(W,function(){Z.apply(this,arguments)},G)},count:function(W){var Z=0;return z(W,function(){Z++}),Z},toArray:function(W){return z(W,function(Z){return Z})||[]},only:function(W){if(!p(W))throw Error("React.Children.only expected to receive a single React element child.");return W}};QZ.Activity=LW,QZ.Children=OW,QZ.Component=U,QZ.Fragment=QW,QZ.Profiler=L,QZ.PureComponent=E,QZ.StrictMode=X,QZ.Suspense=YW,QZ.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,QZ.__COMPILER_RUNTIME=r,QZ.act=function(W){var Z=q.actQueue,G=RW;RW++;var B=q.actQueue=Z!==null?Z:[],Q=!1;try{var D=W()}catch(R){q.thrownErrors.push(R)}if(0<q.thrownErrors.length)throw a(Z,G),W=h(q.thrownErrors),q.thrownErrors.length=0,W;if(D!==null&&typeof D==="object"&&typeof D.then==="function"){var J=D;return hW(function(){Q||wW||(wW=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(R,GW){Q=!0,J.then(function($W){if(a(Z,G),G===0){try{zW(B),A(function(){return XW($W,R,GW)})}catch(XZ){q.thrownErrors.push(XZ)}if(0<q.thrownErrors.length){var ZZ=h(q.thrownErrors);q.thrownErrors.length=0,GW(ZZ)}}else R($W)},function($W){a(Z,G),0<q.thrownErrors.length?($W=h(q.thrownErrors),q.thrownErrors.length=0,GW($W)):GW($W)})}}}var x=D;if(a(Z,G),G===0&&(zW(B),B.length!==0&&hW(function(){Q||wW||(wW=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),q.actQueue=null),0<q.thrownErrors.length)throw W=h(q.thrownErrors),q.thrownErrors.length=0,W;return{then:function(R,GW){Q=!0,G===0?(q.actQueue=B,A(function(){return XW(x,R,GW)})):R(x)}}},QZ.cache=function(W){return function(){return W.apply(null,arguments)}},QZ.cacheSignal=function(){return null},QZ.captureOwnerStack=function(){var W=q.getCurrentStack;return W===null?null:W()},QZ.cloneElement=function(W,Z,G){if(W===null||W===void 0)throw Error("The argument must be a React element, but you passed "+W+".");var B=jW({},W.props),Q=W.key,D=W._owner;if(Z!=null){var J;W:{if(qW.call(Z,"ref")&&(J=Object.getOwnPropertyDescriptor(Z,"ref").get)&&J.isReactWarning){J=!1;break W}J=Z.ref!==void 0}J&&(D=w()),d(Z)&&(C(Z.key),Q=""+Z.key);for(x in Z)!qW.call(Z,x)||x==="key"||x==="__self"||x==="__source"||x==="ref"&&Z.ref===void 0||(B[x]=Z[x])}var x=arguments.length-2;if(x===1)B.children=G;else if(1<x){J=Array(x);for(var R=0;R<x;R++)J[R]=arguments[R+2];B.children=J}B=P(W.type,Q,B,D,W._debugStack,W._debugTask);for(Q=2;Q<arguments.length;Q++)c(arguments[Q]);return B},QZ.createContext=function(W){return W={$$typeof:u,_currentValue:W,_currentValue2:W,_threadCount:0,Provider:null,Consumer:null},W.Provider=W,W.Consumer={$$typeof:j,_context:W},W._currentRenderer=null,W._currentRenderer2=null,W},QZ.createElement=function(W,Z,G){for(var B=2;B<arguments.length;B++)c(arguments[B]);B={};var Q=null;if(Z!=null)for(R in SW||!("__self"in Z)||"key"in Z||(SW=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),d(Z)&&(C(Z.key),Q=""+Z.key),Z)qW.call(Z,R)&&R!=="key"&&R!=="__self"&&R!=="__source"&&(B[R]=Z[R]);var D=arguments.length-2;if(D===1)B.children=G;else if(1<D){for(var J=Array(D),x=0;x<D;x++)J[x]=arguments[x+2];Object.freeze&&Object.freeze(J),B.children=J}if(W&&W.defaultProps)for(R in D=W.defaultProps,D)B[R]===void 0&&(B[R]=D[R]);Q&&i(B,typeof W==="function"?W.displayName||W.name||"Unknown":W);var R=1e4>q.recentlyCreatedOwnerStacks++;return P(W,Q,B,w(),R?Error("react-stack-top-frame"):eW,R?vW(o(W)):WZ)},QZ.createRef=function(){var W={current:null};return Object.seal(W),W},QZ.forwardRef=function(W){W!=null&&W.$$typeof===e?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof W!=="function"?console.error("forwardRef requires a render function but was given %s.",W===null?"null":typeof W):W.length!==0&&W.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",W.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),W!=null&&W.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var Z={$$typeof:t,render:W},G;return Object.defineProperty(Z,"displayName",{enumerable:!1,configurable:!0,get:function(){return G},set:function(B){G=B,W.name||W.displayName||(Object.defineProperty(W,"name",{value:B}),W.displayName=B)}}),Z},QZ.isValidElement=p,QZ.lazy=function(W){W={_status:-1,_result:W};var Z={$$typeof:WW,_payload:W,_init:K},G={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return W._ioInfo=G,Z._debugInfo=[{awaited:G}],Z},QZ.memo=function(W,Z){W==null&&console.error("memo: The first argument must be a component. Instead received: %s",W===null?"null":typeof W),Z={$$typeof:e,type:W,compare:Z===void 0?null:Z};var G;return Object.defineProperty(Z,"displayName",{enumerable:!1,configurable:!0,get:function(){return G},set:function(B){G=B,W.name||W.displayName||(Object.defineProperty(W,"name",{value:B}),W.displayName=B)}}),Z},QZ.startTransition=function(W){var Z=q.T,G={};G._updatedFibers=new Set,q.T=G;try{var B=W(),Q=q.S;Q!==null&&Q(G,B),typeof B==="object"&&B!==null&&typeof B.then==="function"&&(q.asyncTransitions++,B.then(O,O),B.then(v,mW))}catch(D){mW(D)}finally{Z===null&&G._updatedFibers&&(W=G._updatedFibers.size,G._updatedFibers.clear(),10<W&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),Z!==null&&G.types!==null&&(Z.types!==null&&Z.types!==G.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),Z.types=G.types),q.T=Z}},QZ.unstable_useCacheRefresh=function(){return Y().useCacheRefresh()},QZ.use=function(W){return Y().use(W)},QZ.useActionState=function(W,Z,G){return Y().useActionState(W,Z,G)},QZ.useCallback=function(W,Z){return Y().useCallback(W,Z)},QZ.useContext=function(W){var Z=Y();return W.$$typeof===j&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),Z.useContext(W)},QZ.useDebugValue=function(W,Z){return Y().useDebugValue(W,Z)},QZ.useDeferredValue=function(W,Z){return Y().useDeferredValue(W,Z)},QZ.useEffect=function(W,Z){return W==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),Y().useEffect(W,Z)},QZ.useEffectEvent=function(W){return Y().useEffectEvent(W)},QZ.useId=function(){return Y().useId()},QZ.useImperativeHandle=function(W,Z,G){return Y().useImperativeHandle(W,Z,G)},QZ.useInsertionEffect=function(W,Z){return W==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),Y().useInsertionEffect(W,Z)},QZ.useLayoutEffect=function(W,Z){return W==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),Y().useLayoutEffect(W,Z)},QZ.useMemo=function(W,Z){return Y().useMemo(W,Z)},QZ.useOptimistic=function(W,Z){return Y().useOptimistic(W,Z)},QZ.useReducer=function(W,Z,G){return Y().useReducer(W,Z,G)},QZ.useRef=function(W){return Y().useRef(W)},QZ.useState=function(W){return Y().useState(W)},QZ.useSyncExternalStore=function(W,Z,G){return Y().useSyncExternalStore(W,Z,G)},QZ.useTransition=function(){return Y().useTransition()},QZ.version="19.2.4",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var ZW=yW((YZ)=>{var HW=n(UW());(function(){function H(X){if(X==null)return null;if(typeof X==="function")return X.$$typeof===Y?null:X.displayName||X.name||null;if(typeof X==="string")return X;switch(X){case f:return"Fragment";case y:return"Profiler";case P:return"StrictMode";case S:return"Suspense";case g:return"SuspenseList";case K:return"Activity"}if(typeof X==="object")switch(typeof X.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),X.$$typeof){case i:return"Portal";case p:return X.displayName||"Context";case c:return(X._context.displayName||"Context")+".Consumer";case l:var L=X.render;return X=X.displayName,X||(X=L.displayName||L.name||"",X=X!==""?"ForwardRef("+X+")":"ForwardRef"),X;case I:return L=X.displayName||null,L!==null?L:H(X.type)||"Memo";case z:L=X._payload,X=X._init;try{return H(X(L))}catch(j){}}return null}function $(X){return""+X}function M(X){try{$(X);var L=!1}catch(t){L=!0}if(L){L=console;var j=L.error,u=typeof Symbol==="function"&&Symbol.toStringTag&&X[Symbol.toStringTag]||X.constructor.name||"Object";return j.call(L,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",u),$(X)}}function U(X){if(X===f)return"<>";if(typeof X==="object"&&X!==null&&X.$$typeof===z)return"<...>";try{var L=H(X);return L?"<"+L+">":"<...>"}catch(j){return"<...>"}}function V(){var X=O.A;return X===null?null:X.getOwner()}function E(){return Error("react-stack-top-frame")}function v(X){if(A.call(X,"key")){var L=Object.getOwnPropertyDescriptor(X,"key").get;if(L&&L.isReactWarning)return!1}return X.key!==void 0}function N(X,L){function j(){XW||(XW=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",L))}j.isReactWarning=!0,Object.defineProperty(X,"key",{get:j,configurable:!0})}function C(){var X=H(this.type);return zW[X]||(zW[X]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),X=this.props.ref,X!==void 0?X:null}function b(X,L,j,u,t,YW){var k=j.ref;return X={$$typeof:d,type:X,key:L,props:j,_owner:u},(k!==void 0?k:null)!==null?Object.defineProperty(X,"ref",{enumerable:!1,get:C}):Object.defineProperty(X,"ref",{enumerable:!1,value:null}),X._store={},Object.defineProperty(X._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(X,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(X,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:t}),Object.defineProperty(X,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:YW}),Object.freeze&&(Object.freeze(X.props),Object.freeze(X)),X}function o(X,L,j,u,t,YW){var k=L.children;if(k!==void 0)if(u)if(h(k)){for(u=0;u<k.length;u++)w(k[u]);Object.freeze&&Object.freeze(k)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else w(k);if(A.call(L,"key")){k=H(X);var e=Object.keys(L).filter(function(LW){return LW!=="key"});u=0<e.length?"{key: someKey, "+e.join(": ..., ")+": ...}":"{key: someKey}",QW[k+u]||(e=0<e.length?"{"+e.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
14
|
-
let props = %s;
|
|
15
|
-
<%s {...props} />
|
|
16
|
-
React keys must be passed directly to JSX without using spread:
|
|
17
|
-
let props = %s;
|
|
18
|
-
<%s key={someKey} {...props} />`,u,k,e,k),QW[k+u]=!0)}if(k=null,j!==void 0&&(M(j),k=""+j),v(L)&&(M(L.key),k=""+L.key),"key"in L){j={};for(var WW in L)WW!=="key"&&(j[WW]=L[WW])}else j=L;return k&&N(j,typeof X==="function"?X.displayName||X.name||"Unknown":X),b(X,k,j,V(),t,YW)}function w(X){m(X)?X._store&&(X._store.validated=1):typeof X==="object"&&X!==null&&X.$$typeof===z&&(X._payload.status==="fulfilled"?m(X._payload.value)&&X._payload.value._store&&(X._payload.value._store.validated=1):X._store&&(X._store.validated=1))}function m(X){return typeof X==="object"&&X!==null&&X.$$typeof===d}var d=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),p=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),Y=Symbol.for("react.client.reference"),O=HW.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,h=Array.isArray,a=console.createTask?console.createTask:function(){return null};HW={react_stack_bottom_frame:function(X){return X()}};var XW,zW={},MW=HW.react_stack_bottom_frame.bind(HW,E)(),JW=a(U(E)),QW={};YZ.Fragment=f,YZ.jsxDEV=function(X,L,j,u){var t=1e4>O.recentlyCreatedOwnerStacks++;return o(X,L,j,u,t?Error("react-stack-top-frame"):MW,t?a(U(X)):JW)}})()});var _=n(UW(),1),dW=n(ZW(),1),uW=_.createContext(null),$Z=200;function UZ({children:H}){let[$,M]=_.useState(!1),[U,V]=_.useState([]),[E,v]=_.useState({}),[N,C]=_.useState({}),[b,o]=_.useState(0),[w,m]=_.useState(0),[d,i]=_.useState(0),f=_.useRef(null),P=_.useRef(null);_.useEffect(()=>{let S=setInterval(()=>{let g=Date.now();C((I)=>{let z={};for(let[K,Y]of Object.entries(I))if(Y.expiresAt>g)z[K]=Y;return z})},500);return()=>clearInterval(S)},[]);let y=_.useCallback(()=>{if(f.current)f.current.close(),f.current=null;try{let S=new EventSource("/api/telemetry/stream");f.current=S,S.onopen=()=>{M(!0)},S.onmessage=(g)=>{if(!g.data||g.data.trim()==="")return;try{let I=JSON.parse(g.data);if(I.connected){M(!0);return}if(Array.isArray(I)){if(V((z)=>{return[...I,...z].slice(0,$Z)}),v((z)=>{let K={...z};for(let Y of I){let O=K[Y.agent_id];if(!O||new Date(Y.timestamp)>new Date(O.timestamp))K[Y.agent_id]={timestamp:Y.timestamp,category:Y.category,type:Y.type}}return K}),C((z)=>{let K={...z},Y=Date.now()+3000;for(let O of I)K[O.agent_id]={type:O.type,expiresAt:Y};return K}),I.some((z)=>z.category==="system"&&(z.type==="agent_started"||z.type==="agent_stopped")))o((z)=>z+1);if(I.some((z)=>z.category==="TASK"&&(z.type==="task_created"||z.type==="task_updated"||z.type==="task_deleted")))m((z)=>z+1);if(I.some((z)=>z.level==="error"||z.category==="ERROR"||z.category==="system"&&z.type==="agent_stopped"))i((z)=>z+1)}}catch{}},S.onerror=()=>{if(M(!1),S.close(),f.current=null,P.current)clearTimeout(P.current);P.current=setTimeout(y,2000)}}catch{if(M(!1),P.current)clearTimeout(P.current);P.current=setTimeout(y,2000)}},[]);_.useEffect(()=>{return y(),()=>{if(f.current)f.current.close();if(P.current)clearTimeout(P.current)}},[y]);let c=_.useCallback(()=>{V([])},[]),p=_.useCallback(()=>{o((S)=>S+1),m((S)=>S+1)},[]),l=_.default.useMemo(()=>({connected:$,events:U,lastActivityByAgent:E,activeAgents:N,statusChangeCounter:b,taskChangeCounter:w,notificationCounter:d,clearEvents:c,triggerRefresh:p}),[$,U,E,N,b,w,d,c,p]);return dW.jsxDEV(uW.Provider,{value:l,children:H},void 0,!1,void 0,this)}function BW(){let H=_.useContext(uW);if(!H)throw Error("useTelemetryContext must be used within TelemetryProvider");return H}function MZ(H){let{connected:$,events:M,lastActivityByAgent:U}=BW(),V=_.default.useMemo(()=>{let N=M;if(H?.agent_id)N=N.filter((C)=>C.agent_id===H.agent_id);if(H?.category)N=N.filter((C)=>C.category===H.category);if(H?.limit)N=N.slice(0,H.limit);return N},[M,H?.agent_id,H?.category,H?.limit]),E=H?.agent_id?U[H.agent_id]:void 0,v=_.default.useMemo(()=>{if(!E)return!1;let N=new Date(E.timestamp).getTime();return Date.now()-N<1e4},[E]);return{connected:$,events:V,lastActivity:E,isActive:v}}function OZ(H){switch(H){case"llm_request":return"Thinking";case"tool_invocation":return"Using tools";case"tool_result":return"Using tools";case"thread_activity":return"Working";case"agent_started":return"Starting";case"agent_stopped":return"Stopped";default:return"Working"}}function JZ(H){let{activeAgents:$}=BW(),M=$[H],U=!!M,V=M?.type;return _.default.useMemo(()=>({isActive:U,type:V,label:U?OZ(V):void 0}),[U,V])}function LZ(){let{statusChangeCounter:H}=BW();return H}function qZ(){let{taskChangeCounter:H}=BW();return H}function DZ(){let{notificationCounter:H}=BW();return H}function RZ(){let{triggerRefresh:H}=BW();return H}var F=n(UW(),1),sW=n(ZW(),1),pW=F.createContext(null);function FW(){let H=F.useContext(pW);if(!H)throw Error("useAuth must be used within an AuthProvider");return H}function wZ({children:H}){let[$,M]=F.useState(null),[U,V]=F.useState(null),[E,v]=F.useState(!0),[N,C]=F.useState(null),[b,o]=F.useState(!1),[w,m]=F.useState(null),d=F.useRef(null),i=F.useRef(!1),f=F.useRef(!1),P=F.useCallback((z)=>{d.current=z,V(z)},[]),y=F.useCallback(async()=>{if(i.current)return!1;i.current=!0;try{let z=await fetch("/api/auth/refresh",{method:"POST",credentials:"include"});if(!z.ok)return!1;let K=await z.json();if(P(K.accessToken),K.user)M(K.user);if(K.onboarding)m(K.onboarding.completed||K.onboarding.has_any_keys);return!!K.user}catch(z){return console.error("Token refresh failed:",z),!1}finally{i.current=!1}},[P]),c=F.useCallback(async()=>{try{let z=d.current,Y=await(await fetch("/api/auth/check",{headers:z?{Authorization:`Bearer ${z}`}:{}})).json();if(C(Y.hasUsers),o(Y.isDev??!1),Y.onboarding)m(Y.onboarding.completed||Y.onboarding.has_any_keys);if(Y.authenticated&&Y.user)M(Y.user);else if(M(null),Y.hasUsers){if(!await y())P(null)}}catch(z){console.error("Auth check failed:",z),M(null),P(null)}finally{v(!1)}},[y,P]),p=F.useCallback(async(z,K)=>{try{let Y=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({username:z,password:K})}),O=await Y.json();if(!Y.ok)return{success:!1,error:O.error||"Login failed"};return P(O.accessToken),M(O.user),C(!0),{success:!0}}catch(Y){return console.error("Login failed:",Y),{success:!1,error:"Login failed"}}},[P]),l=F.useCallback(async()=>{try{let z=d.current;await fetch("/api/auth/logout",{method:"POST",credentials:"include",headers:z?{Authorization:`Bearer ${z}`}:{}})}catch(z){console.error("Logout failed:",z)}finally{M(null),P(null)}},[P]),S=F.useCallback(async(z,K={})=>{let Y=new Headers(K.headers),O=d.current;if(O)Y.set("Authorization",`Bearer ${O}`);return fetch(z,{...K,headers:Y})},[]),g=F.useCallback(async()=>{return y()},[y]);F.useEffect(()=>{if(f.current)return;f.current=!0,c()},[c]),F.useEffect(()=>{if(!U)return;let z=setInterval(()=>{y()},840000);return()=>clearInterval(z)},[U,y]);let I=F.useMemo(()=>({user:$,isAuthenticated:!!$,isLoading:E,hasUsers:N,isDev:b,accessToken:U,onboardingComplete:w,setOnboardingComplete:m,login:p,logout:l,refreshToken:g,checkAuth:c,authFetch:S}),[$,E,N,b,U,w,m,p,l,g,c,S]);return sW.jsxDEV(pW.Provider,{value:I,children:H},void 0,!1,void 0,this)}function KZ(){let{accessToken:H}=FW();return H?{Authorization:`Bearer ${H}`}:{}}var T=n(UW(),1);var cW=n(ZW(),1),iW=T.createContext(null);function FZ(){let H=T.useContext(iW);if(!H)throw Error("useProjects must be used within a ProjectProvider");return H}var _W="apteva_current_project";function VZ({children:H}){let{authFetch:$,isAuthenticated:M,isLoading:U}=FW(),[V,E]=T.useState([]),[v,N]=T.useState(()=>{if(typeof window<"u")return localStorage.getItem(_W);return null}),[C,b]=T.useState(!0),[o,w]=T.useState(null),[m,d]=T.useState(0),[i,f]=T.useState(!1),[P,y]=T.useState(!1),[c,p]=T.useState(!0);T.useEffect(()=>{fetch("/api/features").then((O)=>O.json()).then((O)=>{f(O.projects===!0),y(O.metaAgent===!0),p(O.costTracking!==!1)}).catch(()=>{f(!1),y(!1),p(!0)})},[]);let l=T.useCallback((O)=>{if(N(O),typeof window<"u")if(O===null)localStorage.removeItem(_W);else localStorage.setItem(_W,O)},[]),S=V.find((O)=>O.id===v)||null,g=T.useCallback(async()=>{if(!i){E([]),b(!1);return}if(!M&&!U){E([]),b(!1);return}try{w(null);let O=await $("/api/projects");if(!O.ok)throw Error("Failed to fetch projects");let A=await O.json();if(E(A.projects||[]),d(A.unassignedCount||0),v&&v!=="unassigned"&&!A.projects.find((h)=>h.id===v))l(null)}catch(O){console.error("Failed to fetch projects:",O),w("Failed to load projects")}finally{b(!1)}},[$,M,U,v,l,i]),I=T.useCallback(async(O)=>{try{let A=await $("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)});if(!A.ok){let a=await A.json();throw Error(a.error||"Failed to create project")}let h=await A.json();return await g(),h.project}catch(A){return console.error("Failed to create project:",A),null}},[$,g]),z=T.useCallback(async(O,A)=>{try{let h=await $(`/api/projects/${O}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!h.ok){let XW=await h.json();throw Error(XW.error||"Failed to update project")}let a=await h.json();return await g(),a.project}catch(h){return console.error("Failed to update project:",h),null}},[$,g]),K=T.useCallback(async(O)=>{try{let A=await $(`/api/projects/${O}`,{method:"DELETE"});if(!A.ok){let h=await A.json();throw Error(h.error||"Failed to delete project")}if(v===O)l(null);return await g(),!0}catch(A){return console.error("Failed to delete project:",A),!1}},[$,v,l,g]);T.useEffect(()=>{if(!U&&i)g()},[U,i,g]);let Y=T.useMemo(()=>({projects:V,currentProjectId:v,currentProject:S,isLoading:C,error:o,unassignedCount:m,projectsEnabled:i,metaAgentEnabled:P,costTrackingEnabled:c,setCurrentProjectId:l,createProject:I,updateProject:z,deleteProject:K,refreshProjects:g}),[V,v,S,C,o,m,i,P,c,l,I,z,K,g]);return cW.jsxDEV(iW.Provider,{value:Y,children:H},void 0,!1,void 0,this)}var s=n(UW(),1);var VW={dark:{id:"dark",name:"Dark",colors:{"--color-bg":"#0a0a0a","--color-bg-secondary":"#0f0f0f","--color-surface":"#111111","--color-surface-hover":"#0a0a0a","--color-surface-raised":"#1a1a1a","--color-border":"#1a1a1a","--color-border-light":"#222222","--color-text":"#e0e0e0","--color-text-secondary":"#888888","--color-text-muted":"#666666","--color-text-faint":"#555555","--color-accent":"#f97316","--color-accent-hover":"#ea580c","--color-accent-5":"rgba(249, 115, 22, 0.05)","--color-accent-10":"rgba(249, 115, 22, 0.1)","--color-accent-15":"rgba(249, 115, 22, 0.15)","--color-accent-20":"rgba(249, 115, 22, 0.2)","--color-accent-30":"rgba(249, 115, 22, 0.3)","--color-accent-70":"rgba(249, 115, 22, 0.7)","--color-selection-bg":"#f97316","--color-selection-text":"#0a0a0a","--color-scrollbar":"#222222","--color-scrollbar-hover":"#444444"}},light:{id:"light",name:"Light",colors:{"--color-bg":"#ffffff","--color-bg-secondary":"#f7f7f7","--color-surface":"#ffffff","--color-surface-hover":"#f5f5f5","--color-surface-raised":"#f0f0f0","--color-border":"#e0e0e0","--color-border-light":"#e8e8e8","--color-text":"#1a1a1a","--color-text-secondary":"#555555","--color-text-muted":"#777777","--color-text-faint":"#999999","--color-accent":"#ea580c","--color-accent-hover":"#c2410c","--color-accent-5":"rgba(234, 88, 12, 0.05)","--color-accent-10":"rgba(234, 88, 12, 0.1)","--color-accent-15":"rgba(234, 88, 12, 0.15)","--color-accent-20":"rgba(234, 88, 12, 0.2)","--color-accent-30":"rgba(234, 88, 12, 0.3)","--color-accent-70":"rgba(234, 88, 12, 0.7)","--color-selection-bg":"#ea580c","--color-selection-text":"#ffffff","--color-scrollbar":"#cccccc","--color-scrollbar-hover":"#aaaaaa"}},"professional-dark":{id:"professional-dark",name:"Professional Dark",colors:{"--color-bg":"#0f1117","--color-bg-secondary":"#131520","--color-surface":"#181a24","--color-surface-hover":"#1e2030","--color-surface-raised":"#232636","--color-border":"#252838","--color-border-light":"#2d3044","--color-text":"#d4d7e0","--color-text-secondary":"#8b8fa3","--color-text-muted":"#6b6f83","--color-text-faint":"#4e5266","--color-accent":"#7c3aed","--color-accent-hover":"#6d28d9","--color-accent-5":"rgba(124, 58, 237, 0.05)","--color-accent-10":"rgba(124, 58, 237, 0.1)","--color-accent-15":"rgba(124, 58, 237, 0.15)","--color-accent-20":"rgba(124, 58, 237, 0.2)","--color-accent-30":"rgba(124, 58, 237, 0.3)","--color-accent-70":"rgba(124, 58, 237, 0.7)","--color-selection-bg":"#7c3aed","--color-selection-text":"#ffffff","--color-scrollbar":"#2d3044","--color-scrollbar-hover":"#3d4058"}},"professional-light":{id:"professional-light",name:"Professional Light",colors:{"--color-bg":"#f8f9fb","--color-bg-secondary":"#f0f2f5","--color-surface":"#ffffff","--color-surface-hover":"#f5f6f8","--color-surface-raised":"#eef0f4","--color-border":"#e2e4ea","--color-border-light":"#e8eaef","--color-text":"#1a1d2b","--color-text-secondary":"#4b5066","--color-text-muted":"#6b7088","--color-text-faint":"#9298ac","--color-accent":"#6d28d9","--color-accent-hover":"#5b21b6","--color-accent-5":"rgba(109, 40, 217, 0.05)","--color-accent-10":"rgba(109, 40, 217, 0.1)","--color-accent-15":"rgba(109, 40, 217, 0.15)","--color-accent-20":"rgba(109, 40, 217, 0.2)","--color-accent-30":"rgba(109, 40, 217, 0.3)","--color-accent-70":"rgba(109, 40, 217, 0.7)","--color-selection-bg":"#6d28d9","--color-selection-text":"#ffffff","--color-scrollbar":"#cdd0d8","--color-scrollbar-hover":"#b0b4c0"}}};function lW(H,$,M){let U=H==="auto"?M:H==="dark";if($==="professional")return U?VW["professional-dark"]:VW["professional-light"];return U?VW.dark:VW.light}var aW=n(ZW(),1),rW=s.createContext(null);function NZ(){let H=s.useContext(rW);if(!H)throw Error("useTheme must be used within a ThemeProvider");return H}var oW="apteva_theme_mode",nW="apteva_theme_style";function PZ(){if(typeof window>"u")return!0;return window.matchMedia("(prefers-color-scheme: dark)").matches}function xZ(H,$){let M=document.documentElement;for(let[U,V]of Object.entries(H.colors))M.style.setProperty(U,V);M.setAttribute("data-theme",H.id),M.setAttribute("data-style",$),document.body.style.fontFamily=$==="professional"?"'Inter', system-ui, -apple-system, sans-serif":"'JetBrains Mono', monospace"}function _Z({children:H}){let[$,M]=s.useState(()=>{if(typeof window<"u"){let w=localStorage.getItem(oW);if(w==="dark"||w==="light"||w==="auto")return w}return"auto"}),[U,V]=s.useState(()=>{if(typeof window<"u"){let w=localStorage.getItem(nW);if(w==="classic"||w==="professional")return w}return"classic"}),[E,v]=s.useState(PZ);s.useEffect(()=>{let w=window.matchMedia("(prefers-color-scheme: dark)"),m=(d)=>v(d.matches);return w.addEventListener("change",m),()=>w.removeEventListener("change",m)},[]);let N=s.useMemo(()=>lW($,U,E),[$,U,E]);s.useEffect(()=>{xZ(N,U)},[N,U]);let C=s.useCallback((w)=>{M(w),localStorage.setItem(oW,w)},[]),b=s.useCallback((w)=>{V(w),localStorage.setItem(nW,w)},[]),o=s.useMemo(()=>({mode:$,style:U,theme:N,setMode:C,setStyle:b}),[$,U,N,C,b]);return aW.jsxDEV(rW.Provider,{value:o,children:H},void 0,!1,void 0,this)}export{n as X,yW as Y,EZ as Z,IZ as _,UW as $,ZW as aa,UZ as ba,BW as ca,MZ as da,JZ as ea,LZ as fa,qZ as ga,DZ as ha,RZ as ia,FW as ja,wZ as ka,KZ as la,FZ as ma,VZ as na,NZ as oa,_Z as pa};
|
|
19
|
-
|
|
20
|
-
//# debugId=5BBAA77039A9BCAC64756E2164756E21
|
package/dist/McpPage.f3ccrezb.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.yzkh4gq2.js";import"./App.9sryp183.js";import"./App.vkg121c6.js";import"./App.p7jjw1zf.js";import"./App.94x6mh7f.js";export{e as formatRelativeTime,d as formatCron,c as TrajectoryView,a as TasksPage,b as TaskDetailPanel};
|
|
2
|
-
|
|
3
|
-
//# debugId=C2CFA2705D3D8A1B64756E2164756E21
|