@apteva/apteva-darwin-arm64 0.4.53 → 0.4.56

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.
Files changed (82) hide show
  1. package/apteva +0 -0
  2. package/dist/ActivityPage.nx7edj1s.js +3 -0
  3. package/dist/{ActivityPage.9v5ha2p7.js.map → ActivityPage.nx7edj1s.js.map} +2 -2
  4. package/dist/ApiDocsPage.rwys8wpd.js +4 -0
  5. package/dist/{ApiDocsPage.qsehxvkb.js.map → ApiDocsPage.rwys8wpd.js.map} +2 -2
  6. package/dist/App.2j4tpeys.js +61 -0
  7. package/dist/{App.anvw0hjc.js.map → App.2j4tpeys.js.map} +3 -3
  8. package/dist/{App.jdkx6eqd.js → App.8cvz3ngj.js} +2 -2
  9. package/dist/{App.jdkx6eqd.js.map → App.8cvz3ngj.js.map} +1 -1
  10. package/dist/App.a2rb0ne3.js +4 -0
  11. package/dist/{App.sd685nt9.js.map → App.a2rb0ne3.js.map} +2 -2
  12. package/dist/App.aybz4ae0.js +53 -0
  13. package/dist/{App.d9vcm6zs.js.map → App.aybz4ae0.js.map} +3 -3
  14. package/dist/App.bjefj5zs.js +4 -0
  15. package/dist/{App.aexwv4rk.js.map → App.bjefj5zs.js.map} +2 -2
  16. package/dist/App.cnbb1872.js +4 -0
  17. package/dist/{App.x6x8s16g.js.map → App.cnbb1872.js.map} +2 -2
  18. package/dist/App.cv6e5yds.js +4 -0
  19. package/dist/App.cv6e5yds.js.map +10 -0
  20. package/dist/App.eqd061d2.js +4 -0
  21. package/dist/{App.dmvykj97.js.map → App.eqd061d2.js.map} +3 -3
  22. package/dist/App.fy5bef1p.js +20 -0
  23. package/dist/{App.shfd8tp9.js.map → App.fy5bef1p.js.map} +6 -5
  24. package/dist/App.mxcz65n1.js +4 -0
  25. package/dist/{App.cjcyr5aj.js.map → App.mxcz65n1.js.map} +2 -2
  26. package/dist/App.nvpvg5yh.js +13 -0
  27. package/dist/{App.j4ec9k18.js.map → App.nvpvg5yh.js.map} +2 -2
  28. package/dist/{App.2j20h2gt.js → App.rvnjekh6.js} +3 -3
  29. package/dist/{App.2j20h2gt.js.map → App.rvnjekh6.js.map} +2 -2
  30. package/dist/App.was53rtk.js +4 -0
  31. package/dist/{App.kz3qyyre.js.map → App.was53rtk.js.map} +2 -2
  32. package/dist/App.wqjbggrj.js +4 -0
  33. package/dist/{App.e2kkda2a.js.map → App.wqjbggrj.js.map} +2 -2
  34. package/dist/App.z92hp4k3.js +221 -0
  35. package/dist/{App.j0xwtdd7.js.map → App.z92hp4k3.js.map} +11 -11
  36. package/dist/{App.wghtdzsk.js → App.zn4mw16t.js} +1 -1
  37. package/dist/ConnectionsPage.qfyks0xm.js +3 -0
  38. package/dist/McpPage.y6vgt9ej.js +3 -0
  39. package/dist/SettingsPage.fkw8berr.js +3 -0
  40. package/dist/SkillsPage.48zztx44.js +3 -0
  41. package/dist/TasksPage.v930en79.js +3 -0
  42. package/dist/TelemetryPage.xxebs3s9.js +3 -0
  43. package/dist/TelemetryPage.xxebs3s9.js.map +9 -0
  44. package/dist/TestsPage.1xtfmbrg.js +3 -0
  45. package/dist/ThreadsPage.xazwab60.js +3 -0
  46. package/dist/ThreadsPage.xazwab60.js.map +9 -0
  47. package/dist/apteva-kit.css +1 -1
  48. package/dist/index.html +1 -1
  49. package/dist/styles.css +1 -1
  50. package/package.json +1 -1
  51. package/dist/ActivityPage.9v5ha2p7.js +0 -3
  52. package/dist/ApiDocsPage.qsehxvkb.js +0 -4
  53. package/dist/App.2md3x3z7.js +0 -4
  54. package/dist/App.2md3x3z7.js.map +0 -10
  55. package/dist/App.aexwv4rk.js +0 -4
  56. package/dist/App.anvw0hjc.js +0 -61
  57. package/dist/App.cjcyr5aj.js +0 -4
  58. package/dist/App.d9vcm6zs.js +0 -53
  59. package/dist/App.dmvykj97.js +0 -4
  60. package/dist/App.e2kkda2a.js +0 -4
  61. package/dist/App.j0xwtdd7.js +0 -221
  62. package/dist/App.j4ec9k18.js +0 -13
  63. package/dist/App.kz3qyyre.js +0 -4
  64. package/dist/App.sd685nt9.js +0 -4
  65. package/dist/App.shfd8tp9.js +0 -20
  66. package/dist/App.x6x8s16g.js +0 -4
  67. package/dist/ConnectionsPage.1dyyfqbk.js +0 -3
  68. package/dist/McpPage.xvr8hk05.js +0 -3
  69. package/dist/SettingsPage.4r1nbxvp.js +0 -3
  70. package/dist/SkillsPage.jw7carjq.js +0 -3
  71. package/dist/TasksPage.r8txe0e9.js +0 -3
  72. package/dist/TelemetryPage.sqnsfrht.js +0 -3
  73. package/dist/TelemetryPage.sqnsfrht.js.map +0 -9
  74. package/dist/TestsPage.pkymr7yt.js +0 -3
  75. package/dist/ThreadsPage.49tgq4fq.js +0 -3
  76. package/dist/ThreadsPage.49tgq4fq.js.map +0 -9
  77. /package/dist/{ConnectionsPage.1dyyfqbk.js.map → ConnectionsPage.qfyks0xm.js.map} +0 -0
  78. /package/dist/{McpPage.xvr8hk05.js.map → McpPage.y6vgt9ej.js.map} +0 -0
  79. /package/dist/{SettingsPage.4r1nbxvp.js.map → SettingsPage.fkw8berr.js.map} +0 -0
  80. /package/dist/{SkillsPage.jw7carjq.js.map → SkillsPage.48zztx44.js.map} +0 -0
  81. /package/dist/{TasksPage.r8txe0e9.js.map → TasksPage.v930en79.js.map} +0 -0
  82. /package/dist/{TestsPage.pkymr7yt.js.map → TestsPage.1xtfmbrg.js.map} +0 -0
@@ -1,4 +0,0 @@
1
- import{G as x,H as n,I as r,l as m,q as i}from"./App.jdkx6eqd.js";import{O as j}from"./App.e2kkda2a.js";import{U as D}from"./App.sd685nt9.js";import{$ as t,X as g,aa as u,da as c,ja as V,ma as d}from"./App.shfd8tp9.js";var Q=g(t(),1);var z=g(u(),1);function Zz({onSelectAgent:B}){let{authFetch:N}=V(),{currentProjectId:w}=d(),[L,P]=Q.useState([]),[O,K]=Q.useState(!0),[_,J]=Q.useState("all"),[Z,Y]=Q.useState("all"),[U,W]=Q.useState(null),[R,I]=Q.useState(!1),[$,A]=Q.useState(!1),f=Q.useRef(null),{events:C}=c({category:"TASK"}),v=Q.useCallback(async()=>{try{let G=`/api/tasks?status=${_}`;if(w!==null)G+=`&project_id=${encodeURIComponent(w)}`;let X=await(await N(G)).json();P(X.tasks||[])}catch(G){console.error("Failed to fetch tasks:",G)}finally{K(!1)}},[N,_,w]);Q.useEffect(()=>{v()},[v]),Q.useEffect(()=>{if(!C.length)return;let G=C[0];if(!G||G.id===f.current)return;let H=G.type;if(H==="task_created"||H==="task_updated"||H==="task_deleted")f.current=G.id,console.log("[TasksPage] Telemetry event:",H),v()},[C,v]);let y=Q.useCallback(async(G)=>{W(G),I(!0);try{let H=await N(`/api/tasks/${G.agentId}/${G.id}`);if(console.log("[TasksPage] Fetch task response status:",H.status),H.ok){let X=await H.json();if(console.log("[TasksPage] Task data:",X),console.log("[TasksPage] Has trajectory:",!!X.task?.trajectory,"Length:",X.task?.trajectory?.length),X.task)W({...X.task,agentId:G.agentId,agentName:G.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{I(!1)}},[N]),b=Q.useMemo(()=>{let G=new Map;for(let H of L){let X=H.agentId||H.agent_id,T=H.agentName||H.agent_name;if(X&&T&&!G.has(X))G.set(X,T)}return Array.from(G.entries()).sort((H,X)=>H[1].localeCompare(X[1]))},[L]),M=Q.useMemo(()=>{return[...Z==="all"?L:L.filter((H)=>(H.agentId||H.agent_id)===Z)].sort((H,X)=>{if(H.status==="running"&&X.status!=="running")return-1;if(X.status==="running"&&H.status!=="running")return 1;let T=H.status==="pending",p=X.status==="pending";if(T&&!p)return-1;if(p&&!T)return 1;if(T&&p||H.status==="running"&&X.status==="running"){let h=H.next_run||H.execute_at||null,l=X.next_run||X.execute_at||null,e=h?new Date(h).getTime():1/0,s=l?new Date(l).getTime():1/0;return e-s}let k=H.completed_at||H.executed_at||H.created_at,a=X.completed_at||X.executed_at||X.created_at;return new Date(a).getTime()-new Date(k).getTime()})},[L,Z]),q={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 ${U?"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:()=>A(!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((G)=>z.jsxDEV("button",{onClick:()=>J(G.value),className:`px-3 py-1.5 rounded text-sm transition whitespace-nowrap ${_===G.value?"bg-[var(--color-accent)] text-black":"bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)]"}`,children:G.label},G.value,!1,void 0,this))},void 0,!1,void 0,this),b.length>0&&z.jsxDEV("div",{className:"w-48",children:z.jsxDEV(D,{value:Z,onChange:Y,placeholder:"All agents",compact:!0,options:[{value:"all",label:"All agents"},...b.map(([G,H])=>({value:G,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),O?z.jsxDEV("div",{className:"text-center py-12 text-[var(--color-text-muted)]",children:"Loading tasks..."},void 0,!1,void 0,this):M.length===0?z.jsxDEV("div",{className:"text-center py-12",children:[z.jsxDEV(i,{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:M.map((G)=>z.jsxDEV("div",{onClick:()=>y(G),className:`bg-[var(--color-surface)] border rounded-lg p-4 cursor-pointer transition ${U?.id===G.id&&U?.agentId===G.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:G.title},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)]",children:G.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 ${q[G.status]||q.pending}`,children:G.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.description&&z.jsxDEV("p",{className:"text-sm text-[var(--color-text-secondary)] mb-2 line-clamp-2",children:G.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:[G.type==="recurring"?z.jsxDEV(x,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this):G.execute_at?z.jsxDEV(n,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this):z.jsxDEV(r,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this),G.type==="recurring"&&G.recurrence?E(G.recurrence):G.type]},void 0,!0,void 0,this),z.jsxDEV("span",{children:["Priority: ",G.priority]},void 0,!0,void 0,this),G.next_run&&z.jsxDEV("span",{className:"text-[var(--color-accent)]",children:F(G.next_run)},void 0,!1,void 0,this),!G.next_run&&G.execute_at&&z.jsxDEV("span",{className:"text-[var(--color-accent)]",children:F(G.execute_at)},void 0,!1,void 0,this),z.jsxDEV("span",{children:["Created: ",new Date(G.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},`${G.agentId}-${G.id}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),U&&z.jsxDEV(zz,{task:U,statusColors:q,onClose:()=>W(null),onSelectAgent:B,loading:R,authFetch:N,onRefresh:()=>{v(),W(null)}},void 0,!1,void 0,this),$&&z.jsxDEV(Gz,{authFetch:N,currentProjectId:w,onClose:()=>A(!1),onCreated:()=>{v(),A(!1)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function zz({task:B,statusColors:N,onClose:w,onSelectAgent:L,loading:P,authFetch:O,onRefresh:K}){let[_,J]=Q.useState(!1),[Z,Y]=Q.useState(!1),[U,W]=Q.useState(!1),[R,I]=Q.useState(!1),[$,A]=Q.useState({title:B.title,description:B.description||"",type:B.type,priority:B.priority,execute_at:B.execute_at?new Date(B.execute_at).toISOString().slice(0,16):"",recurrence:B.recurrence||""}),{confirm:f,ConfirmDialog:C}=j();Q.useEffect(()=>{A({title:B.title,description:B.description||"",type:B.type,priority:B.priority,execute_at:B.execute_at?new Date(B.execute_at).toISOString().slice(0,16):"",recurrence:B.recurrence||""}),W(!1)},[B.id,B.agentId]);let v=async()=>{if(!O||R)return;I(!0);try{let q={title:$.title.trim(),description:$.description.trim()||void 0,type:$.type,priority:$.priority};if($.type==="once"&&$.execute_at)q.execute_at=new Date($.execute_at).toISOString();if($.type==="recurring"&&$.recurrence.trim())q.recurrence=$.recurrence.trim();if((await O(`/api/tasks/${B.agentId}/${B.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(q)})).ok)W(!1),K?.()}catch(q){console.error("Failed to update task:",q)}finally{I(!1)}},y=async()=>{if(!O||_)return;J(!0);try{await O(`/api/tasks/${B.agentId}/${B.id}/execute`,{method:"POST"}),K?.()}catch(q){console.error("Failed to execute task:",q)}finally{J(!1)}},b=async()=>{if(!O||Z)return;if(!await f(`Are you sure you want to delete "${B.title}"?`,{title:"Delete Task",confirmText:"Delete",confirmVariant:"danger"}))return;Y(!0);try{await O(`/api/tasks/${B.agentId}/${B.id}`,{method:"DELETE"}),K?.()}catch(S){console.error("Failed to delete task:",S)}finally{Y(!1)}},M="w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-2 py-1.5 text-sm focus:outline-none focus:border-[var(--color-accent)] text-[var(--color-text)]";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:[C,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:U?"Edit Task":"Task Details"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2",children:[O&&!U&&(B.status==="pending"||B.status==="completed"||B.status==="failed")&&z.jsxDEV("button",{onClick:()=>W(!0),title:"Edit task",className:"text-[var(--color-text-muted)] hover:text-[var(--color-accent)] transition",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:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),O&&!U&&(B.status==="pending"||B.status==="completed")&&z.jsxDEV("button",{onClick:y,disabled:_,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),O&&!U&&z.jsxDEV("button",{onClick:b,disabled:Z,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),U&&z.jsxDEV(z.Fragment,{children:[z.jsxDEV("button",{onClick:()=>{W(!1),A({title:B.title,description:B.description||"",type:B.type,priority:B.priority,execute_at:B.execute_at?new Date(B.execute_at).toISOString().slice(0,16):"",recurrence:B.recurrence||""})},className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)] text-sm transition",children:"Cancel"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:v,disabled:R||!$.title.trim(),className:"px-3 py-1 rounded text-sm bg-[var(--color-accent)] text-black hover:opacity-90 transition disabled:opacity-50",children:R?"Saving...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!U&&z.jsxDEV("button",{onClick:w,className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)] transition",children:z.jsxDEV(m,{},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:[U?z.jsxDEV("input",{type:"text",value:$.title,onChange:(q)=>A({...$,title:q.target.value}),className:`${M} text-lg font-medium`,placeholder:"Task title"},void 0,!1,void 0,this):z.jsxDEV("h3",{className:"text-lg font-medium",children:B.title},void 0,!1,void 0,this),!U&&z.jsxDEV("span",{className:`px-2 py-1 rounded text-xs font-medium flex-shrink-0 ${N[B.status]}`,children:B.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!U&&z.jsxDEV("button",{onClick:()=>L?.(B.agentId),className:"text-sm text-[var(--color-accent)] hover:underline",children:B.agentName},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U?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("textarea",{value:$.description,onChange:(q)=>A({...$,description:q.target.value}),className:`${M} resize-none`,rows:3,placeholder:"Task description..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):B.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:B.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,U?z.jsxDEV("div",{className:"grid grid-cols-2 gap-3",children:[z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"text-xs text-[var(--color-text-muted)] uppercase tracking-wider mb-1 block",children:"Type"},void 0,!1,void 0,this),z.jsxDEV("select",{value:$.type,onChange:(q)=>A({...$,type:q.target.value}),className:M,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:"text-xs text-[var(--color-text-muted)] uppercase tracking-wider mb-1 block",children:"Priority"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"number",min:1,max:10,value:$.priority,onChange:(q)=>A({...$,priority:Number(q.target.value)}),className:M},void 0,!1,void 0,this)]},void 0,!0,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:B.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:B.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:B.source},void 0,!1,void 0,this)]},void 0,!0,void 0,this),B.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:E(B.recurrence)},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mt-0.5 font-mono",children:B.recurrence},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),U&&$.type==="once"&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"text-xs text-[var(--color-text-muted)] uppercase tracking-wider mb-1 block",children:"Schedule"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"datetime-local",value:$.execute_at,onChange:(q)=>A({...$,execute_at:q.target.value}),className:M},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mt-1",children:"Leave empty for manual execution"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&$.type==="recurring"&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"text-xs text-[var(--color-text-muted)] uppercase tracking-wider mb-1 block",children:"Cron Schedule"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:$.recurrence,onChange:(q)=>A({...$,recurrence:q.target.value}),className:`${M} font-mono`,placeholder:"*/30 * * * *"},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"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!U&&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(B.created_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),B.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:F(B.execute_at)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),B.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(B.executed_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),B.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(B.completed_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),B.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:F(B.next_run)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),B.status==="failed"&&B.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:B.error},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),B.status==="completed"&&B.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 B.result==="string"?B.result:JSON.stringify(B.result,null,2)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P&&!B.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),B.trajectory&&B.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 (",B.trajectory.length," steps)"]},void 0,!0,void 0,this),z.jsxDEV(Bz,{trajectory:B.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:B}){let[N,w]=Q.useState(new Set),L=(K)=>{w((_)=>{let J=new Set(_);if(J.has(K))J.delete(K);else J.add(K);return J})},P={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"}},O=(K)=>{let _=K.content;if(typeof _==="string"){let J=_.length>200,Z=N.has(K.id);return z.jsxDEV("div",{children:[z.jsxDEV("p",{className:`text-sm text-[var(--color-text)] whitespace-pre-wrap break-words ${!Z&&J?"line-clamp-4":""}`,children:_},void 0,!1,void 0,this),J&&z.jsxDEV("button",{onClick:()=>L(K.id),className:"text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] mt-1",children:Z?"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:_.map((J,Z)=>{if(J.type==="tool_use"){let Y=JSON.stringify(J.input,null,2),U=Y.length>150,W=`${K.id}-${Z}`,R=N.has(W);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 ${!R&&U?"line-clamp-3":""}`,children:Y},void 0,!1,void 0,this),U&&z.jsxDEV("button",{onClick:()=>L(W),className:"text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] mt-1",children:R?"Show less":"Show more..."},void 0,!1,void 0,this)]},Z,!0,void 0,this)}if(J.type==="tool_result"){let Y=J.is_error,U=`${K.id}-${Z}`,W=N.has(U),R=J.content.length>150;return z.jsxDEV("div",{className:`${Y?"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:Y?"❌":"\uD83D\uDCCB"},void 0,!1,void 0,this),z.jsxDEV("span",{className:`text-xs font-medium ${Y?"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 ${!W&&R?"line-clamp-3":""}`,children:J.content},void 0,!1,void 0,this),R&&z.jsxDEV("button",{onClick:()=>L(U),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)]},Z,!0,void 0,this)}return null})},void 0,!1,void 0,this)};return z.jsxDEV("div",{className:"space-y-2",children:B.map((K)=>{let _=P[K.role]||P.assistant;return z.jsxDEV("div",{className:`${_.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:_.icon},void 0,!1,void 0,this),z.jsxDEV("span",{className:`text-xs font-medium ${_.text}`,children:_.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),O(K)]},K.id,!0,void 0,this)})},void 0,!1,void 0,this)}function Gz({authFetch:B,currentProjectId:N,onClose:w,onCreated:L}){let[P,O]=Q.useState([]),[K,_]=Q.useState(""),[J,Z]=Q.useState(""),[Y,U]=Q.useState(""),[W,R]=Q.useState("once"),[I,$]=Q.useState(5),[A,f]=Q.useState(""),[C,v]=Q.useState(""),[y,b]=Q.useState(!1),[M,q]=Q.useState("");return Q.useEffect(()=>{B("/api/agents").then((G)=>G.json()).then((G)=>{let H=(G.agents||[]).filter((X)=>X.status==="running"&&X.features?.tasks);if(O(H.map((X)=>({id:X.id,name:X.name}))),H.length===1)_(H[0].id)}).catch(()=>{})},[B]),z.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:w,children:z.jsxDEV("div",{className:"bg-[var(--color-surface)] card w-full max-w-md",onClick:(G)=>G.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:w,className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)] transition",children:z.jsxDEV(m,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("form",{onSubmit:async(G)=>{if(G.preventDefault(),!K||!J.trim())return;b(!0),q("");let H={title:J.trim(),description:Y.trim()||void 0,type:W,priority:I};if(W==="once"&&A)H.execute_at=new Date(A).toISOString();if(W==="recurring"&&C.trim())H.recurrence=C.trim();try{let X=await B(`/api/tasks/${K}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H)});if(!X.ok){let T=await X.json().catch(()=>({}));q(T.error||`HTTP ${X.status}`);return}L()}catch(X){q(String(X))}finally{b(!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),P.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:(G)=>_(G.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),P.map((G)=>z.jsxDEV("option",{value:G.id,children:G.name},G.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:(G)=>Z(G.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:Y,onChange:(G)=>U(G.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:W,onChange:(G)=>R(G.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:I,onChange:(G)=>$(Number(G.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),W==="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:A,onChange:(G)=>f(G.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),W==="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:C,onChange:(G)=>v(G.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),M&&z.jsxDEV("p",{className:"text-sm text-red-400",children:M},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex justify-end gap-2 pt-2",children:[z.jsxDEV("button",{type:"button",onClick:w,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:y||!K||!J.trim()||P.length===0,className:"px-4 py-2 rounded text-sm bg-[var(--color-accent)] text-black hover:opacity-90 transition disabled:opacity-50",children:y?"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 E(B){try{let N=B.trim().split(/\s+/);if(N.length!==5)return B;let[w,L,P,O,K]=N;if(w.startsWith("*/")&&L==="*"&&P==="*"&&O==="*"&&K==="*"){let J=parseInt(w.slice(2));if(J===1)return"Every minute";return`Every ${J} minutes`}if(w!=="*"&&!w.includes("/")&&L==="*"&&P==="*"&&O==="*"&&K==="*")return"Every hour";if(L.startsWith("*/")&&P==="*"&&O==="*"&&K==="*"){let J=parseInt(L.slice(2));if(J===1)return"Every hour";return`Every ${J} hours`}let _=(J,Z)=>{let Y=parseInt(J),U=parseInt(Z);if(isNaN(Y))return"";let W=Y>=12?"PM":"AM";return`${Y===0?12:Y>12?Y-12:Y}:${U.toString().padStart(2,"0")} ${W}`};if(L!=="*"&&!L.includes("/")&&P==="*"&&O==="*"){let J=_(L,w);if(K==="*")return`Daily at ${J}`;let Z=K.split(",").map((Y)=>{let U=parseInt(Y.trim());return o[U]||Y});if(Z.length===7)return`Daily at ${J}`;if(Z.length===5&&!Z.includes("Sat")&&!Z.includes("Sun"))return`Weekdays at ${J}`;if(Z.length===1)return`Weekly on ${Z[0]} at ${J}`;return`${Z.join(" & ")} at ${J}`}return B}catch{return B}}function F(B){let N=new Date(B),w=new Date,L=N.getTime()-w.getTime(),P=Math.abs(L),O=L>0,K=Math.floor(P/60000),_=Math.floor(P/3600000),J=Math.floor(P/86400000),Z=N.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),Y=N.toDateString()===w.toDateString(),U=new Date(w);U.setDate(U.getDate()+1);let W=N.toDateString()===U.toDateString(),R=new Date(w);R.setDate(R.getDate()-1);let I=N.toDateString()===R.toDateString();if(Y){if(K<1)return O?"now":"just now";if(K<60)return O?`in ${K} min (${Z})`:`${K} min ago`;return O?`in ${_}h (${Z})`:`${_}h ago`}if(W)return`Tomorrow at ${Z}`;if(I)return`Yesterday at ${Z}`;if(J<7)return`${o[N.getDay()]} at ${Z}`;return N.toLocaleDateString([],{month:"short",day:"numeric"})+` at ${Z}`}
2
- export{Zz as d,zz as e,Bz as f,E as g,F as h};
3
-
4
- //# debugId=8E2D9B056A9C318964756E2164756E21