agent-relay-server 0.35.1 → 0.35.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/docs/openapi.json +1 -1
  2. package/package.json +1 -1
  3. package/public/assets/{activity-B0_uE6Yh.js → activity-WjOShx3N.js} +2 -2
  4. package/public/assets/{activity-B0_uE6Yh.js.map → activity-WjOShx3N.js.map} +1 -1
  5. package/public/assets/{agent-profiles-Rwxrcf9F.js → agent-profiles-Bs8MAW6j.js} +2 -2
  6. package/public/assets/{agent-profiles-Rwxrcf9F.js.map → agent-profiles-Bs8MAW6j.js.map} +1 -1
  7. package/public/assets/{agents-Dp1EXJc8.js → agents-Cihuuoxa.js} +2 -2
  8. package/public/assets/{agents-Dp1EXJc8.js.map → agents-Cihuuoxa.js.map} +1 -1
  9. package/public/assets/{analytics-D5OT5ajj.js → analytics-B5_HS2Lt.js} +2 -2
  10. package/public/assets/{analytics-D5OT5ajj.js.map → analytics-B5_HS2Lt.js.map} +1 -1
  11. package/public/assets/{automation-Dm6rXNxK.js → automation-CoOe2nEA.js} +2 -2
  12. package/public/assets/{automation-Dm6rXNxK.js.map → automation-CoOe2nEA.js.map} +1 -1
  13. package/public/assets/{branch-state-badge-FX5Yww2s.js → branch-state-badge-EliCEAQI.js} +2 -2
  14. package/public/assets/{branch-state-badge-FX5Yww2s.js.map → branch-state-badge-EliCEAQI.js.map} +1 -1
  15. package/public/assets/{channels--rdAiX17.js → channels-BzSpsE5h.js} +2 -2
  16. package/public/assets/{channels--rdAiX17.js.map → channels-BzSpsE5h.js.map} +1 -1
  17. package/public/assets/{chat-JZAEDGfX.js → chat-0ZbxHlDu.js} +2 -2
  18. package/public/assets/{chat-JZAEDGfX.js.map → chat-0ZbxHlDu.js.map} +1 -1
  19. package/public/assets/{connectors-Bx4gzvNf.js → connectors-DoUgct8f.js} +2 -2
  20. package/public/assets/{connectors-Bx4gzvNf.js.map → connectors-DoUgct8f.js.map} +1 -1
  21. package/public/assets/{formatted-body-impl-CVq4qHix.js → formatted-body-impl-DhCblnWM.js} +2 -2
  22. package/public/assets/{formatted-body-impl-CVq4qHix.js.map → formatted-body-impl-DhCblnWM.js.map} +1 -1
  23. package/public/assets/{index-BHRtR4q7.js → index-CvSlyTSI.js} +6 -6
  24. package/public/assets/{index-BHRtR4q7.js.map → index-CvSlyTSI.js.map} +1 -1
  25. package/public/assets/{integrations-k1HIONjo.js → integrations-CUv4i_4i.js} +2 -2
  26. package/public/assets/{integrations-k1HIONjo.js.map → integrations-CUv4i_4i.js.map} +1 -1
  27. package/public/assets/{maintenance-CsoOFBXx.js → maintenance-CUxxVXsc.js} +2 -2
  28. package/public/assets/{maintenance-CsoOFBXx.js.map → maintenance-CUxxVXsc.js.map} +1 -1
  29. package/public/assets/{managed-agents-Q3HuVjGg.js → managed-agents-VZEeMMSP.js} +2 -2
  30. package/public/assets/{managed-agents-Q3HuVjGg.js.map → managed-agents-VZEeMMSP.js.map} +1 -1
  31. package/public/assets/{markdown-preview-impl-CnsMjrnu.js → markdown-preview-impl-Bbwmbxvn.js} +2 -2
  32. package/public/assets/{markdown-preview-impl-CnsMjrnu.js.map → markdown-preview-impl-Bbwmbxvn.js.map} +1 -1
  33. package/public/assets/{memory-D3-K5eJS.js → memory-BQAC3YmR.js} +2 -2
  34. package/public/assets/{memory-D3-K5eJS.js.map → memory-BQAC3YmR.js.map} +1 -1
  35. package/public/assets/{messages-B4lCP5rS.js → messages-_sdHV42k.js} +2 -2
  36. package/public/assets/{messages-B4lCP5rS.js.map → messages-_sdHV42k.js.map} +1 -1
  37. package/public/assets/{orchestrators-CRoZtLeQ.js → orchestrators-BkHHgd83.js} +2 -2
  38. package/public/assets/{orchestrators-CRoZtLeQ.js.map → orchestrators-BkHHgd83.js.map} +1 -1
  39. package/public/assets/{overview-CxCU2fOF.js → overview-CYAHOUyA.js} +2 -2
  40. package/public/assets/{overview-CxCU2fOF.js.map → overview-CYAHOUyA.js.map} +1 -1
  41. package/public/assets/{pairs-unqjPlmq.js → pairs-BvMH1CS7.js} +2 -2
  42. package/public/assets/{pairs-unqjPlmq.js.map → pairs-BvMH1CS7.js.map} +1 -1
  43. package/public/assets/{security-B7HhSYNy.js → security-Dsdr3lSX.js} +2 -2
  44. package/public/assets/{security-B7HhSYNy.js.map → security-Dsdr3lSX.js.map} +1 -1
  45. package/public/assets/{settings-B9NDhsAb.js → settings-DlovIWdE.js} +2 -2
  46. package/public/assets/{settings-B9NDhsAb.js.map → settings-DlovIWdE.js.map} +1 -1
  47. package/public/assets/store-CICRhg1m.js +9 -0
  48. package/public/assets/store-CICRhg1m.js.map +1 -0
  49. package/public/assets/{tasks-CIQolvNm.js → tasks-Cgan8Oqb.js} +2 -2
  50. package/public/assets/{tasks-CIQolvNm.js.map → tasks-Cgan8Oqb.js.map} +1 -1
  51. package/public/assets/{terminal-viewer-impl-DCifVqFR.js → terminal-viewer-impl-DVW-LRbz.js} +2 -2
  52. package/public/assets/{terminal-viewer-impl-DCifVqFR.js.map → terminal-viewer-impl-DVW-LRbz.js.map} +1 -1
  53. package/public/assets/{work-queue-Dr3c1V6O.js → work-queue-B4CifZKH.js} +2 -2
  54. package/public/assets/{work-queue-Dr3c1V6O.js.map → work-queue-B4CifZKH.js.map} +1 -1
  55. package/public/assets/{workspaces-B1Jxop7h.js → workspaces-D7lsWShY.js} +2 -2
  56. package/public/assets/{workspaces-B1Jxop7h.js.map → workspaces-D7lsWShY.js.map} +1 -1
  57. package/public/index.html +2 -2
  58. package/src/db/workspaces.ts +3 -2
  59. package/public/assets/store-DiSzYHj9.js +0 -9
  60. package/public/assets/store-DiSzYHj9.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{$t as e,En as t,L as n,Nt as r,Zt as i,at as a,kn as o}from"./lucide-react-CD8Xl2U3.js";import{t as s}from"./store-DiSzYHj9.js";import{V as c,_ as l}from"./display-Bebqs1qu.js";import{t as u}from"./badge-t8zAwHW9.js";import{t as d}from"./button-DDA5P2YQ.js";import{i as f,n as p,r as m,t as h}from"./card-CggxP1h9.js";var g=o(),_={PlugZap:n,AlertCircle:e,Activity:t,Eye:r,CircleCheck:i};function v(){let e=s(e=>e.integrations),t=s(e=>e.set),r=s(e=>e.switchView),i=e.reduce((e,t)=>e+(t.taskStats?.waitingTasks||0),0);function o(e){t({taskSourceFilter:e}),r(`tasks`)}return(0,g.jsxs)(`div`,{className:`space-y-6`,children:[(0,g.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Integrations`}),(0,g.jsxs)(u,{variant:`outline`,className:`text-xs`,children:[e.length,` total`]}),i>0&&(0,g.jsxs)(u,{className:`bg-yellow-500/20 text-yellow-400 border-yellow-500/30 text-xs`,children:[i,` waiting`]})]})}),e.length===0?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,g.jsx)(n,{className:`w-10 h-10 text-zinc-600 mb-3`}),(0,g.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No integrations configured`})]}):(0,g.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4`,children:e.map(e=>{let t=l(e),r=_[e.icon||t.icon]||_[t.icon]||n,i=e.taskStats||{};return(0,g.jsxs)(h,{className:`flex flex-col border-l-2`,style:{borderLeftColor:e.accentColor||void 0},children:[(0,g.jsxs)(m,{children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,g.jsxs)(`div`,{className:`min-w-0`,children:[(0,g.jsx)(f,{className:`text-sm font-medium truncate`,children:e.displayName||e.name}),e.description&&(0,g.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,g.jsx)(r,{className:`w-3.5 h-3.5 ${c(t.tone)}`}),(0,g.jsx)(`span`,{className:`text-xs ${c(t.tone)}`,children:t.label})]})]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:[e.configured&&(0,g.jsx)(u,{variant:`outline`,className:`text-xs text-emerald-400 border-emerald-500/30`,children:`configured`}),e.observed&&(0,g.jsx)(u,{variant:`outline`,className:`text-xs text-blue-400 border-blue-500/30`,children:`observed`}),!e.enabled&&(0,g.jsx)(u,{variant:`outline`,className:`text-xs text-red-400 border-red-500/30`,children:`disabled`}),e.type&&(0,g.jsx)(u,{variant:`secondary`,className:`text-xs`,children:e.type}),e.tags?.map(e=>(0,g.jsxs)(u,{variant:`outline`,className:`text-xs text-zinc-400`,children:[`#`,e]},e))]})]}),(0,g.jsxs)(p,{className:`flex-1 space-y-3`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-4 gap-2 text-center`,children:[(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)(`p`,{className:`text-base font-semibold tabular-nums`,children:i.tasks??0}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`tasks`})]}),(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)(`p`,{className:`text-base font-semibold tabular-nums text-blue-400`,children:i.openTasks??0}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`open`})]}),(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)(`p`,{className:`text-base font-semibold tabular-nums ${(i.waitingTasks??0)>0?`text-yellow-400`:``}`,children:i.waitingTasks??0}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`waiting`})]}),(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)(`p`,{className:`text-base font-semibold tabular-nums ${(i.failedTasks??0)>0?`text-red-400`:``}`,children:i.failedTasks??0}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`failed`})]})]}),(e.scopes?.length>0||e.targets?.length>0||e.channels?.length>0)&&(0,g.jsxs)(`div`,{className:`space-y-1.5`,children:[e.scopes?.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.scopes.map(e=>(0,g.jsx)(u,{variant:`outline`,className:`text-xs text-zinc-400`,children:e},e))}),e.targets?.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.targets.map(e=>(0,g.jsx)(u,{variant:`secondary`,className:`text-xs`,children:e},e))}),e.channels?.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.channels.map(e=>(0,g.jsxs)(u,{className:`text-xs bg-blue-500/10 text-blue-400 border-blue-500/20`,children:[`#`,e]},e))})]})]}),(i.tasks??0)>0&&(0,g.jsx)(`div`,{className:`px-4 pb-4`,children:(0,g.jsxs)(d,{variant:`outline`,size:`sm`,className:`w-full gap-1.5`,onClick:()=>o(i.source||e.name),children:[(0,g.jsx)(a,{className:`w-3.5 h-3.5`}),`Show tasks`]})})]},e.name)})})]})}export{v as IntegrationsView};
2
- //# sourceMappingURL=integrations-k1HIONjo.js.map
1
+ import{$t as e,En as t,L as n,Nt as r,Zt as i,at as a,kn as o}from"./lucide-react-CD8Xl2U3.js";import{t as s}from"./store-CICRhg1m.js";import{V as c,_ as l}from"./display-Bebqs1qu.js";import{t as u}from"./badge-t8zAwHW9.js";import{t as d}from"./button-DDA5P2YQ.js";import{i as f,n as p,r as m,t as h}from"./card-CggxP1h9.js";var g=o(),_={PlugZap:n,AlertCircle:e,Activity:t,Eye:r,CircleCheck:i};function v(){let e=s(e=>e.integrations),t=s(e=>e.set),r=s(e=>e.switchView),i=e.reduce((e,t)=>e+(t.taskStats?.waitingTasks||0),0);function o(e){t({taskSourceFilter:e}),r(`tasks`)}return(0,g.jsxs)(`div`,{className:`space-y-6`,children:[(0,g.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Integrations`}),(0,g.jsxs)(u,{variant:`outline`,className:`text-xs`,children:[e.length,` total`]}),i>0&&(0,g.jsxs)(u,{className:`bg-yellow-500/20 text-yellow-400 border-yellow-500/30 text-xs`,children:[i,` waiting`]})]})}),e.length===0?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,g.jsx)(n,{className:`w-10 h-10 text-zinc-600 mb-3`}),(0,g.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No integrations configured`})]}):(0,g.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4`,children:e.map(e=>{let t=l(e),r=_[e.icon||t.icon]||_[t.icon]||n,i=e.taskStats||{};return(0,g.jsxs)(h,{className:`flex flex-col border-l-2`,style:{borderLeftColor:e.accentColor||void 0},children:[(0,g.jsxs)(m,{children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,g.jsxs)(`div`,{className:`min-w-0`,children:[(0,g.jsx)(f,{className:`text-sm font-medium truncate`,children:e.displayName||e.name}),e.description&&(0,g.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,g.jsx)(r,{className:`w-3.5 h-3.5 ${c(t.tone)}`}),(0,g.jsx)(`span`,{className:`text-xs ${c(t.tone)}`,children:t.label})]})]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:[e.configured&&(0,g.jsx)(u,{variant:`outline`,className:`text-xs text-emerald-400 border-emerald-500/30`,children:`configured`}),e.observed&&(0,g.jsx)(u,{variant:`outline`,className:`text-xs text-blue-400 border-blue-500/30`,children:`observed`}),!e.enabled&&(0,g.jsx)(u,{variant:`outline`,className:`text-xs text-red-400 border-red-500/30`,children:`disabled`}),e.type&&(0,g.jsx)(u,{variant:`secondary`,className:`text-xs`,children:e.type}),e.tags?.map(e=>(0,g.jsxs)(u,{variant:`outline`,className:`text-xs text-zinc-400`,children:[`#`,e]},e))]})]}),(0,g.jsxs)(p,{className:`flex-1 space-y-3`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-4 gap-2 text-center`,children:[(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)(`p`,{className:`text-base font-semibold tabular-nums`,children:i.tasks??0}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`tasks`})]}),(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)(`p`,{className:`text-base font-semibold tabular-nums text-blue-400`,children:i.openTasks??0}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`open`})]}),(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)(`p`,{className:`text-base font-semibold tabular-nums ${(i.waitingTasks??0)>0?`text-yellow-400`:``}`,children:i.waitingTasks??0}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`waiting`})]}),(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)(`p`,{className:`text-base font-semibold tabular-nums ${(i.failedTasks??0)>0?`text-red-400`:``}`,children:i.failedTasks??0}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`failed`})]})]}),(e.scopes?.length>0||e.targets?.length>0||e.channels?.length>0)&&(0,g.jsxs)(`div`,{className:`space-y-1.5`,children:[e.scopes?.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.scopes.map(e=>(0,g.jsx)(u,{variant:`outline`,className:`text-xs text-zinc-400`,children:e},e))}),e.targets?.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.targets.map(e=>(0,g.jsx)(u,{variant:`secondary`,className:`text-xs`,children:e},e))}),e.channels?.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.channels.map(e=>(0,g.jsxs)(u,{className:`text-xs bg-blue-500/10 text-blue-400 border-blue-500/20`,children:[`#`,e]},e))})]})]}),(i.tasks??0)>0&&(0,g.jsx)(`div`,{className:`px-4 pb-4`,children:(0,g.jsxs)(d,{variant:`outline`,size:`sm`,className:`w-full gap-1.5`,onClick:()=>o(i.source||e.name),children:[(0,g.jsx)(a,{className:`w-3.5 h-3.5`}),`Show tasks`]})})]},e.name)})})]})}export{v as IntegrationsView};
2
+ //# sourceMappingURL=integrations-CUv4i_4i.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"integrations-k1HIONjo.js","names":[],"sources":["../../dashboard/src/components/views/integrations.tsx"],"sourcesContent":["import { useRelayStore } from '@/store'\nimport { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { integrationPresence, toneToColor } from '@/lib/display'\nimport { PlugZap, AlertCircle, Activity, Eye, CircleCheck, ListChecks } from 'lucide-react'\n\nconst PRESENCE_ICONS: Record<string, typeof PlugZap> = {\n PlugZap, AlertCircle, Activity, Eye, CircleCheck,\n}\n\nexport function IntegrationsView() {\n const integrations = useRelayStore((s) => s.integrations)\n const set = useRelayStore((s) => s.set)\n const switchView = useRelayStore((s) => s.switchView)\n\n const waitingCount = integrations.reduce((sum, i) => sum + (i.taskStats?.waitingTasks || 0), 0)\n\n function showTasks(source: string) {\n set({ taskSourceFilter: source })\n switchView('tasks')\n }\n\n return (\n <div className=\"space-y-6\">\n {/* Header */}\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-3\">\n <h1 className=\"text-lg font-semibold\">Integrations</h1>\n <Badge variant=\"outline\" className=\"text-xs\">\n {integrations.length} total\n </Badge>\n {waitingCount > 0 && (\n <Badge className=\"bg-yellow-500/20 text-yellow-400 border-yellow-500/30 text-xs\">\n {waitingCount} waiting\n </Badge>\n )}\n </div>\n </div>\n\n {integrations.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <PlugZap className=\"w-10 h-10 text-zinc-600 mb-3\" />\n <p className=\"text-muted-foreground text-sm\">No integrations configured</p>\n </div>\n ) : (\n <div className=\"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4\">\n {integrations.map((integration) => {\n const presence = integrationPresence(integration)\n const PresenceIcon = PRESENCE_ICONS[integration.icon || presence.icon] || PRESENCE_ICONS[presence.icon] || PlugZap\n const stats = integration.taskStats || {}\n\n return (\n <Card key={integration.name} className=\"flex flex-col border-l-2\" style={{ borderLeftColor: integration.accentColor || undefined }}>\n <CardHeader>\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <CardTitle className=\"text-sm font-medium truncate\">{integration.displayName || integration.name}</CardTitle>\n {integration.description && <p className=\"mt-1 text-xs text-muted-foreground line-clamp-2\">{integration.description}</p>}\n </div>\n <div className=\"flex items-center gap-1.5 shrink-0\">\n <PresenceIcon className={`w-3.5 h-3.5 ${toneToColor(presence.tone)}`} />\n <span className={`text-xs ${toneToColor(presence.tone)}`}>{presence.label}</span>\n </div>\n </div>\n\n <div className=\"flex flex-wrap gap-1 mt-1\">\n {integration.configured && (\n <Badge variant=\"outline\" className=\"text-xs text-emerald-400 border-emerald-500/30\">\n configured\n </Badge>\n )}\n {integration.observed && (\n <Badge variant=\"outline\" className=\"text-xs text-blue-400 border-blue-500/30\">\n observed\n </Badge>\n )}\n {!integration.enabled && (\n <Badge variant=\"outline\" className=\"text-xs text-red-400 border-red-500/30\">\n disabled\n </Badge>\n )}\n {integration.type && (\n <Badge variant=\"secondary\" className=\"text-xs\">\n {integration.type}\n </Badge>\n )}\n {integration.tags?.map((tag) => (\n <Badge key={tag} variant=\"outline\" className=\"text-xs text-zinc-400\">\n #{tag}\n </Badge>\n ))}\n </div>\n </CardHeader>\n\n <CardContent className=\"flex-1 space-y-3\">\n {/* Mini stats */}\n <div className=\"grid grid-cols-4 gap-2 text-center\">\n <div className=\"space-y-0.5\">\n <p className=\"text-base font-semibold tabular-nums\">{stats.tasks ?? 0}</p>\n <p className=\"text-xs text-muted-foreground\">tasks</p>\n </div>\n <div className=\"space-y-0.5\">\n <p className=\"text-base font-semibold tabular-nums text-blue-400\">{stats.openTasks ?? 0}</p>\n <p className=\"text-xs text-muted-foreground\">open</p>\n </div>\n <div className=\"space-y-0.5\">\n <p className={`text-base font-semibold tabular-nums ${(stats.waitingTasks ?? 0) > 0 ? 'text-yellow-400' : ''}`}>\n {stats.waitingTasks ?? 0}\n </p>\n <p className=\"text-xs text-muted-foreground\">waiting</p>\n </div>\n <div className=\"space-y-0.5\">\n <p className={`text-base font-semibold tabular-nums ${(stats.failedTasks ?? 0) > 0 ? 'text-red-400' : ''}`}>\n {stats.failedTasks ?? 0}\n </p>\n <p className=\"text-xs text-muted-foreground\">failed</p>\n </div>\n </div>\n\n {/* Scopes / Targets / Channels */}\n {(integration.scopes?.length > 0 || integration.targets?.length > 0 || integration.channels?.length > 0) && (\n <div className=\"space-y-1.5\">\n {integration.scopes?.length > 0 && (\n <div className=\"flex flex-wrap gap-1\">\n {integration.scopes.map((s) => (\n <Badge key={s} variant=\"outline\" className=\"text-xs text-zinc-400\">\n {s}\n </Badge>\n ))}\n </div>\n )}\n {integration.targets?.length > 0 && (\n <div className=\"flex flex-wrap gap-1\">\n {integration.targets.map((t) => (\n <Badge key={t} variant=\"secondary\" className=\"text-xs\">\n {t}\n </Badge>\n ))}\n </div>\n )}\n {integration.channels?.length > 0 && (\n <div className=\"flex flex-wrap gap-1\">\n {integration.channels.map((c) => (\n <Badge key={c} className=\"text-xs bg-blue-500/10 text-blue-400 border-blue-500/20\">\n #{c}\n </Badge>\n ))}\n </div>\n )}\n </div>\n )}\n </CardContent>\n\n {(stats.tasks ?? 0) > 0 && (\n <div className=\"px-4 pb-4\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n className=\"w-full gap-1.5\"\n onClick={() => showTasks(stats.source || integration.name)}\n >\n <ListChecks className=\"w-3.5 h-3.5\" />\n Show tasks\n </Button>\n </div>\n )}\n </Card>\n )\n })}\n </div>\n )}\n </div>\n )\n}\n"],"mappings":"+UAOM,EAAiD,CACrD,UA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AAY,UAAU,mBAC1C,EACK,CAFI,EAEJ,CACR,CACE,CAAA,CAEP,EAAY,UAAU,OAAS,IAC9B,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,gCACZ,EAAY,SAAS,IAAK,IACzB,EAAA,EAAA,MAAC,EAAD,CAAe,UAAU,mEAAzB,CAAmF,IAC/E,EACI,EAFI,EAEJ,CACR,CACE,CAAA,CAEJ,GAEI,IAEZ,EAAM,OAAS,GAAK,IACpB,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,sBACb,EAAA,EAAA,MAAC,EAAD,CACE,QAAQ,UACR,KAAK,KACL,UAAU,iBACV,YAAe,EAAU,EAAM,QAAU,EAAY,KAAK,UAJ5D,EAME,EAAA,EAAA,KAAC,EAAD,CAAY,UAAU,cAAgB,CAAA,CAAA,aAE/B,GACL,CAAA,CAEH,EAlHI,EAAY,KAkHhB,EAET,CACE,CAAA,CAEJ"}
1
+ {"version":3,"file":"integrations-CUv4i_4i.js","names":[],"sources":["../../dashboard/src/components/views/integrations.tsx"],"sourcesContent":["import { useRelayStore } from '@/store'\nimport { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { integrationPresence, toneToColor } from '@/lib/display'\nimport { PlugZap, AlertCircle, Activity, Eye, CircleCheck, ListChecks } from 'lucide-react'\n\nconst PRESENCE_ICONS: Record<string, typeof PlugZap> = {\n PlugZap, AlertCircle, Activity, Eye, CircleCheck,\n}\n\nexport function IntegrationsView() {\n const integrations = useRelayStore((s) => s.integrations)\n const set = useRelayStore((s) => s.set)\n const switchView = useRelayStore((s) => s.switchView)\n\n const waitingCount = integrations.reduce((sum, i) => sum + (i.taskStats?.waitingTasks || 0), 0)\n\n function showTasks(source: string) {\n set({ taskSourceFilter: source })\n switchView('tasks')\n }\n\n return (\n <div className=\"space-y-6\">\n {/* Header */}\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-3\">\n <h1 className=\"text-lg font-semibold\">Integrations</h1>\n <Badge variant=\"outline\" className=\"text-xs\">\n {integrations.length} total\n </Badge>\n {waitingCount > 0 && (\n <Badge className=\"bg-yellow-500/20 text-yellow-400 border-yellow-500/30 text-xs\">\n {waitingCount} waiting\n </Badge>\n )}\n </div>\n </div>\n\n {integrations.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <PlugZap className=\"w-10 h-10 text-zinc-600 mb-3\" />\n <p className=\"text-muted-foreground text-sm\">No integrations configured</p>\n </div>\n ) : (\n <div className=\"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4\">\n {integrations.map((integration) => {\n const presence = integrationPresence(integration)\n const PresenceIcon = PRESENCE_ICONS[integration.icon || presence.icon] || PRESENCE_ICONS[presence.icon] || PlugZap\n const stats = integration.taskStats || {}\n\n return (\n <Card key={integration.name} className=\"flex flex-col border-l-2\" style={{ borderLeftColor: integration.accentColor || undefined }}>\n <CardHeader>\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <CardTitle className=\"text-sm font-medium truncate\">{integration.displayName || integration.name}</CardTitle>\n {integration.description && <p className=\"mt-1 text-xs text-muted-foreground line-clamp-2\">{integration.description}</p>}\n </div>\n <div className=\"flex items-center gap-1.5 shrink-0\">\n <PresenceIcon className={`w-3.5 h-3.5 ${toneToColor(presence.tone)}`} />\n <span className={`text-xs ${toneToColor(presence.tone)}`}>{presence.label}</span>\n </div>\n </div>\n\n <div className=\"flex flex-wrap gap-1 mt-1\">\n {integration.configured && (\n <Badge variant=\"outline\" className=\"text-xs text-emerald-400 border-emerald-500/30\">\n configured\n </Badge>\n )}\n {integration.observed && (\n <Badge variant=\"outline\" className=\"text-xs text-blue-400 border-blue-500/30\">\n observed\n </Badge>\n )}\n {!integration.enabled && (\n <Badge variant=\"outline\" className=\"text-xs text-red-400 border-red-500/30\">\n disabled\n </Badge>\n )}\n {integration.type && (\n <Badge variant=\"secondary\" className=\"text-xs\">\n {integration.type}\n </Badge>\n )}\n {integration.tags?.map((tag) => (\n <Badge key={tag} variant=\"outline\" className=\"text-xs text-zinc-400\">\n #{tag}\n </Badge>\n ))}\n </div>\n </CardHeader>\n\n <CardContent className=\"flex-1 space-y-3\">\n {/* Mini stats */}\n <div className=\"grid grid-cols-4 gap-2 text-center\">\n <div className=\"space-y-0.5\">\n <p className=\"text-base font-semibold tabular-nums\">{stats.tasks ?? 0}</p>\n <p className=\"text-xs text-muted-foreground\">tasks</p>\n </div>\n <div className=\"space-y-0.5\">\n <p className=\"text-base font-semibold tabular-nums text-blue-400\">{stats.openTasks ?? 0}</p>\n <p className=\"text-xs text-muted-foreground\">open</p>\n </div>\n <div className=\"space-y-0.5\">\n <p className={`text-base font-semibold tabular-nums ${(stats.waitingTasks ?? 0) > 0 ? 'text-yellow-400' : ''}`}>\n {stats.waitingTasks ?? 0}\n </p>\n <p className=\"text-xs text-muted-foreground\">waiting</p>\n </div>\n <div className=\"space-y-0.5\">\n <p className={`text-base font-semibold tabular-nums ${(stats.failedTasks ?? 0) > 0 ? 'text-red-400' : ''}`}>\n {stats.failedTasks ?? 0}\n </p>\n <p className=\"text-xs text-muted-foreground\">failed</p>\n </div>\n </div>\n\n {/* Scopes / Targets / Channels */}\n {(integration.scopes?.length > 0 || integration.targets?.length > 0 || integration.channels?.length > 0) && (\n <div className=\"space-y-1.5\">\n {integration.scopes?.length > 0 && (\n <div className=\"flex flex-wrap gap-1\">\n {integration.scopes.map((s) => (\n <Badge key={s} variant=\"outline\" className=\"text-xs text-zinc-400\">\n {s}\n </Badge>\n ))}\n </div>\n )}\n {integration.targets?.length > 0 && (\n <div className=\"flex flex-wrap gap-1\">\n {integration.targets.map((t) => (\n <Badge key={t} variant=\"secondary\" className=\"text-xs\">\n {t}\n </Badge>\n ))}\n </div>\n )}\n {integration.channels?.length > 0 && (\n <div className=\"flex flex-wrap gap-1\">\n {integration.channels.map((c) => (\n <Badge key={c} className=\"text-xs bg-blue-500/10 text-blue-400 border-blue-500/20\">\n #{c}\n </Badge>\n ))}\n </div>\n )}\n </div>\n )}\n </CardContent>\n\n {(stats.tasks ?? 0) > 0 && (\n <div className=\"px-4 pb-4\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n className=\"w-full gap-1.5\"\n onClick={() => showTasks(stats.source || integration.name)}\n >\n <ListChecks className=\"w-3.5 h-3.5\" />\n Show tasks\n </Button>\n </div>\n )}\n </Card>\n )\n })}\n </div>\n )}\n </div>\n )\n}\n"],"mappings":"+UAOM,EAAiD,CACrD,UAAS,YAAA,EAAa,WAAU,MAAK,cACtC,CAED,SAAgB,GAAmB,CACjC,IAAM,EAAe,EAAe,GAAM,EAAE,aAAa,CACnD,EAAM,EAAe,GAAM,EAAE,IAAI,CACjC,EAAa,EAAe,GAAM,EAAE,WAAW,CAE/C,EAAe,EAAa,QAAQ,EAAK,IAAM,GAAO,EAAE,WAAW,cAAgB,GAAI,EAAE,CAE/F,SAAS,EAAU,EAAgB,CACjC,EAAI,CAAE,iBAAkB,EAAQ,CAAC,CACjC,EAAW,QAAQ,CAGrB,OACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,qBAAf,EAEE,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,8CACb,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,mCAAf,EACE,EAAA,EAAA,KAAC,KAAD,CAAI,UAAU,iCAAwB,eAAiB,CAAA,EACvD,EAAA,EAAA,MAAC,EAAD,CAAO,QAAQ,UAAU,UAAU,mBAAnC,CACG,EAAa,OAAO,SACf,GACP,EAAe,IACd,EAAA,EAAA,MAAC,EAAD,CAAO,UAAU,yEAAjB,CACG,EAAa,WACR,GAEN,GACF,CAAA,CAEL,EAAa,SAAW,GACvB,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,uEAAf,EACE,EAAA,EAAA,KAAC,EAAD,CAAS,UAAU,+BAAiC,CAAA,EACpD,EAAA,EAAA,KAAC,IAAD,CAAG,UAAU,yCAAgC,6BAA8B,CAA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Af,CACG,EAAY,QAAQ,OAAS,IAC5B,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,gCACZ,EAAY,OAAO,IAAK,IACvB,EAAA,EAAA,KAAC,EAAD,CAAe,QAAQ,UAAU,UAAU,iCACxC,EACK,CAFI,EAEJ,CACR,CACE,CAAA,CAEP,EAAY,SAAS,OAAS,IAC7B,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,gCACZ,EAAY,QAAQ,IAAK,IACxB,EAAA,EAAA,KAAC,EAAD,CAAe,QAAQ,YAAY,UAAU,mBAC1C,EACK,CAFI,EAEJ,CACR,CACE,CAAA,CAEP,EAAY,UAAU,OAAS,IAC9B,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,gCACZ,EAAY,SAAS,IAAK,IACzB,EAAA,EAAA,MAAC,EAAD,CAAe,UAAU,mEAAzB,CAAmF,IAC/E,EACI,EAFI,EAEJ,CACR,CACE,CAAA,CAEJ,GAEI,IAEZ,EAAM,OAAS,GAAK,IACpB,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,sBACb,EAAA,EAAA,MAAC,EAAD,CACE,QAAQ,UACR,KAAK,KACL,UAAU,iBACV,YAAe,EAAU,EAAM,QAAU,EAAY,KAAK,UAJ5D,EAME,EAAA,EAAA,KAAC,EAAD,CAAY,UAAU,cAAgB,CAAA,CAAA,aAE/B,GACL,CAAA,CAEH,EAlHI,EAAY,KAkHhB,EAET,CACE,CAAA,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{Dn as t,En as n,Gt as r,M as i,R as a,Vn as o,Zt as s,a as c,kn as l,p as u}from"./lucide-react-CD8Xl2U3.js";import{i as d,t as f}from"./store-DiSzYHj9.js";import{m as p,z as m}from"./display-Bebqs1qu.js";import{t as h}from"./badge-t8zAwHW9.js";import{t as g}from"./button-DDA5P2YQ.js";import{s as _}from"./index-BHRtR4q7.js";var v=e(o(),1),y=l(),b={succeeded:`bg-emerald-500/10 text-emerald-400 border-emerald-500/30`,running:`bg-blue-500/10 text-blue-400 border-blue-500/30`,failed:`bg-red-500/10 text-red-400 border-red-500/30`,idle:`bg-zinc-500/10 text-zinc-400 border-zinc-500/30`,disabled:`bg-zinc-500/10 text-zinc-500 border-zinc-500/20`};function x(){let e=d(),t=f(e=>e.maintenanceJobs),n=f(e=>e.fetchMaintenanceJobs),r=f(e=>e.runMaintenanceJob),a=(0,v.useMemo)(()=>({failed:t.filter(e=>e.lastStatus===`failed`).length,running:t.filter(e=>e.running||e.lastStatus===`running`).length,dueSoon:t.filter(t=>t.nextRunAt&&t.nextRunAt<=e+300*1e3).length}),[t,e]);return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,y.jsx)(c,{className:`h-5 w-5 text-muted-foreground`}),(0,y.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Maintenance`}),(0,y.jsx)(h,{variant:`secondary`,children:t.length}),a.running>0&&(0,y.jsxs)(h,{className:`border border-blue-500/30 bg-blue-500/10 text-blue-400`,children:[a.running,` running`]}),a.failed>0&&(0,y.jsxs)(h,{variant:`destructive`,children:[a.failed,` failing`]}),a.dueSoon>0&&(0,y.jsxs)(h,{className:`border border-yellow-500/30 bg-yellow-500/10 text-yellow-400`,children:[a.dueSoon,` due soon`]})]}),(0,y.jsxs)(g,{size:`sm`,variant:`outline`,onClick:()=>void n(),children:[(0,y.jsx)(i,{className:`h-3.5 w-3.5`}),` Refresh`]})]}),(0,y.jsx)(_,{className:`h-[calc(100dvh-10rem)]`,children:t.length===0?(0,y.jsx)(`div`,{className:`rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground`,children:`No maintenance jobs registered`}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`hidden overflow-x-auto rounded-md border border-border md:block`,children:(0,y.jsxs)(`table`,{className:`w-full min-w-[980px] text-sm`,children:[(0,y.jsx)(`thead`,{className:`bg-muted/40 text-xs text-muted-foreground`,children:(0,y.jsxs)(`tr`,{children:[(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Job`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Status`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Last run`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Next run`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Duration`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Result`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Action`})]})}),(0,y.jsx)(`tbody`,{children:t.map(t=>(0,y.jsx)(T,{job:t,now:e,onRun:()=>void r(t.id)},t.id))})]})}),(0,y.jsx)(`div`,{className:`space-y-3 md:hidden`,children:t.map(t=>(0,y.jsx)(w,{job:t,now:e,onRun:()=>void r(t.id)},t.id))})]})})]})}function S(e){return e.running?`running`:e.enabled?e.lastStatus:`disabled`}function C({status:e}){return(0,y.jsxs)(h,{variant:`outline`,className:t(`border`,b[e]||b.idle),children:[E(e),e]})}function w({job:e,now:t,onRun:n}){let r=S(e);return(0,y.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsx)(`div`,{className:`font-medium`,children:e.title}),(0,y.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e.description}),(0,y.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground/80`,children:e.id})]}),(0,y.jsx)(C,{status:r})]}),e.consecutiveFailures>0&&(0,y.jsxs)(`div`,{className:`mt-2 text-xs text-red-400`,children:[e.consecutiveFailures,` failure`,e.consecutiveFailures===1?``:`s`]}),(0,y.jsxs)(`dl`,{className:`mt-3 grid grid-cols-3 gap-2 text-xs`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last run`}),(0,y.jsx)(`dd`,{children:e.lastRunAt?(0,y.jsx)(`span`,{title:p(e.lastRunAt),children:m(t,e.lastRunAt)}):`never`})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Next run`}),(0,y.jsx)(`dd`,{children:e.nextRunAt?(0,y.jsx)(`span`,{title:p(e.nextRunAt),children:O(t,e.nextRunAt)}):`-`})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Duration`}),(0,y.jsx)(`dd`,{children:e.lastDurationMs===void 0?`-`:`${e.lastDurationMs}ms`})]})]}),(0,y.jsxs)(`div`,{className:`mt-3`,children:[(0,y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Result`}),e.lastError?(0,y.jsx)(`div`,{className:`mt-0.5 text-xs text-red-400 line-clamp-3`,children:e.lastError}):(0,y.jsx)(`div`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground line-clamp-3`,children:D(e)})]}),(0,y.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,y.jsxs)(g,{size:`sm`,variant:`outline`,disabled:!e.enabled||e.running,onClick:n,children:[(0,y.jsx)(a,{className:`h-3.5 w-3.5`}),` Run`]})})]})}function T({job:e,now:t,onRun:n}){let r=S(e);return(0,y.jsxs)(`tr`,{className:`border-t border-border align-top`,children:[(0,y.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,y.jsx)(`div`,{className:`font-medium`,children:e.title}),(0,y.jsx)(`div`,{className:`mt-0.5 max-w-md text-xs text-muted-foreground`,children:e.description}),(0,y.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground/80`,children:e.id})]}),(0,y.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,y.jsx)(C,{status:r}),e.consecutiveFailures>0&&(0,y.jsxs)(`div`,{className:`mt-1 text-xs text-red-400`,children:[e.consecutiveFailures,` failure`,e.consecutiveFailures===1?``:`s`]})]}),(0,y.jsx)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e.lastRunAt?(0,y.jsx)(`span`,{title:p(e.lastRunAt),children:m(t,e.lastRunAt)}):`never`}),(0,y.jsx)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e.nextRunAt?(0,y.jsx)(`span`,{title:p(e.nextRunAt),children:O(t,e.nextRunAt)}):`-`}),(0,y.jsx)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e.lastDurationMs===void 0?`-`:`${e.lastDurationMs}ms`}),(0,y.jsx)(`td`,{className:`px-3 py-3`,children:e.lastError?(0,y.jsx)(`div`,{className:`max-w-sm text-xs text-red-400 line-clamp-3`,children:e.lastError}):(0,y.jsx)(`div`,{className:`max-w-sm font-mono text-[11px] text-muted-foreground line-clamp-3`,children:D(e)})}),(0,y.jsx)(`td`,{className:`px-3 py-3 text-right`,children:(0,y.jsxs)(g,{size:`sm`,variant:`outline`,disabled:!e.enabled||e.running,onClick:n,children:[(0,y.jsx)(a,{className:`h-3.5 w-3.5`}),` Run`]})})]})}function E(e){return e===`succeeded`?(0,y.jsx)(s,{className:`mr-1 h-3 w-3`}):e===`running`?(0,y.jsx)(n,{className:`mr-1 h-3 w-3`}):e===`failed`?(0,y.jsx)(u,{className:`mr-1 h-3 w-3`}):(0,y.jsx)(r,{className:`mr-1 h-3 w-3`})}function D(e){if(!e.lastResult)return`-`;let t=Object.entries(e.lastResult).filter(([,e])=>Array.isArray(e)?e.length>0:e!=null&&e!==0).map(([e,t])=>`${e}: ${Array.isArray(t)?t.length:String(t)}`);return t.length?t.join(`, `):`no changes`}function O(e,t){if(t<=e)return`due now`;let n=Math.max(0,(t-e)/1e3);return n<60?`in ${Math.ceil(n)}s`:n<3600?`in ${Math.ceil(n/60)}m`:n<86400?`in ${Math.ceil(n/3600)}h`:`in ${Math.ceil(n/86400)}d`}export{x as MaintenanceView};
2
- //# sourceMappingURL=maintenance-CsoOFBXx.js.map
1
+ import{r as e}from"./chunk-CilyBKbf.js";import{Dn as t,En as n,Gt as r,M as i,R as a,Vn as o,Zt as s,a as c,kn as l,p as u}from"./lucide-react-CD8Xl2U3.js";import{i as d,t as f}from"./store-CICRhg1m.js";import{m as p,z as m}from"./display-Bebqs1qu.js";import{t as h}from"./badge-t8zAwHW9.js";import{t as g}from"./button-DDA5P2YQ.js";import{s as _}from"./index-CvSlyTSI.js";var v=e(o(),1),y=l(),b={succeeded:`bg-emerald-500/10 text-emerald-400 border-emerald-500/30`,running:`bg-blue-500/10 text-blue-400 border-blue-500/30`,failed:`bg-red-500/10 text-red-400 border-red-500/30`,idle:`bg-zinc-500/10 text-zinc-400 border-zinc-500/30`,disabled:`bg-zinc-500/10 text-zinc-500 border-zinc-500/20`};function x(){let e=d(),t=f(e=>e.maintenanceJobs),n=f(e=>e.fetchMaintenanceJobs),r=f(e=>e.runMaintenanceJob),a=(0,v.useMemo)(()=>({failed:t.filter(e=>e.lastStatus===`failed`).length,running:t.filter(e=>e.running||e.lastStatus===`running`).length,dueSoon:t.filter(t=>t.nextRunAt&&t.nextRunAt<=e+300*1e3).length}),[t,e]);return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,y.jsx)(c,{className:`h-5 w-5 text-muted-foreground`}),(0,y.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Maintenance`}),(0,y.jsx)(h,{variant:`secondary`,children:t.length}),a.running>0&&(0,y.jsxs)(h,{className:`border border-blue-500/30 bg-blue-500/10 text-blue-400`,children:[a.running,` running`]}),a.failed>0&&(0,y.jsxs)(h,{variant:`destructive`,children:[a.failed,` failing`]}),a.dueSoon>0&&(0,y.jsxs)(h,{className:`border border-yellow-500/30 bg-yellow-500/10 text-yellow-400`,children:[a.dueSoon,` due soon`]})]}),(0,y.jsxs)(g,{size:`sm`,variant:`outline`,onClick:()=>void n(),children:[(0,y.jsx)(i,{className:`h-3.5 w-3.5`}),` Refresh`]})]}),(0,y.jsx)(_,{className:`h-[calc(100dvh-10rem)]`,children:t.length===0?(0,y.jsx)(`div`,{className:`rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground`,children:`No maintenance jobs registered`}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`hidden overflow-x-auto rounded-md border border-border md:block`,children:(0,y.jsxs)(`table`,{className:`w-full min-w-[980px] text-sm`,children:[(0,y.jsx)(`thead`,{className:`bg-muted/40 text-xs text-muted-foreground`,children:(0,y.jsxs)(`tr`,{children:[(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Job`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Status`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Last run`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Next run`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Duration`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Result`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Action`})]})}),(0,y.jsx)(`tbody`,{children:t.map(t=>(0,y.jsx)(T,{job:t,now:e,onRun:()=>void r(t.id)},t.id))})]})}),(0,y.jsx)(`div`,{className:`space-y-3 md:hidden`,children:t.map(t=>(0,y.jsx)(w,{job:t,now:e,onRun:()=>void r(t.id)},t.id))})]})})]})}function S(e){return e.running?`running`:e.enabled?e.lastStatus:`disabled`}function C({status:e}){return(0,y.jsxs)(h,{variant:`outline`,className:t(`border`,b[e]||b.idle),children:[E(e),e]})}function w({job:e,now:t,onRun:n}){let r=S(e);return(0,y.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsx)(`div`,{className:`font-medium`,children:e.title}),(0,y.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e.description}),(0,y.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground/80`,children:e.id})]}),(0,y.jsx)(C,{status:r})]}),e.consecutiveFailures>0&&(0,y.jsxs)(`div`,{className:`mt-2 text-xs text-red-400`,children:[e.consecutiveFailures,` failure`,e.consecutiveFailures===1?``:`s`]}),(0,y.jsxs)(`dl`,{className:`mt-3 grid grid-cols-3 gap-2 text-xs`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last run`}),(0,y.jsx)(`dd`,{children:e.lastRunAt?(0,y.jsx)(`span`,{title:p(e.lastRunAt),children:m(t,e.lastRunAt)}):`never`})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Next run`}),(0,y.jsx)(`dd`,{children:e.nextRunAt?(0,y.jsx)(`span`,{title:p(e.nextRunAt),children:O(t,e.nextRunAt)}):`-`})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Duration`}),(0,y.jsx)(`dd`,{children:e.lastDurationMs===void 0?`-`:`${e.lastDurationMs}ms`})]})]}),(0,y.jsxs)(`div`,{className:`mt-3`,children:[(0,y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Result`}),e.lastError?(0,y.jsx)(`div`,{className:`mt-0.5 text-xs text-red-400 line-clamp-3`,children:e.lastError}):(0,y.jsx)(`div`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground line-clamp-3`,children:D(e)})]}),(0,y.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,y.jsxs)(g,{size:`sm`,variant:`outline`,disabled:!e.enabled||e.running,onClick:n,children:[(0,y.jsx)(a,{className:`h-3.5 w-3.5`}),` Run`]})})]})}function T({job:e,now:t,onRun:n}){let r=S(e);return(0,y.jsxs)(`tr`,{className:`border-t border-border align-top`,children:[(0,y.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,y.jsx)(`div`,{className:`font-medium`,children:e.title}),(0,y.jsx)(`div`,{className:`mt-0.5 max-w-md text-xs text-muted-foreground`,children:e.description}),(0,y.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground/80`,children:e.id})]}),(0,y.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,y.jsx)(C,{status:r}),e.consecutiveFailures>0&&(0,y.jsxs)(`div`,{className:`mt-1 text-xs text-red-400`,children:[e.consecutiveFailures,` failure`,e.consecutiveFailures===1?``:`s`]})]}),(0,y.jsx)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e.lastRunAt?(0,y.jsx)(`span`,{title:p(e.lastRunAt),children:m(t,e.lastRunAt)}):`never`}),(0,y.jsx)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e.nextRunAt?(0,y.jsx)(`span`,{title:p(e.nextRunAt),children:O(t,e.nextRunAt)}):`-`}),(0,y.jsx)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e.lastDurationMs===void 0?`-`:`${e.lastDurationMs}ms`}),(0,y.jsx)(`td`,{className:`px-3 py-3`,children:e.lastError?(0,y.jsx)(`div`,{className:`max-w-sm text-xs text-red-400 line-clamp-3`,children:e.lastError}):(0,y.jsx)(`div`,{className:`max-w-sm font-mono text-[11px] text-muted-foreground line-clamp-3`,children:D(e)})}),(0,y.jsx)(`td`,{className:`px-3 py-3 text-right`,children:(0,y.jsxs)(g,{size:`sm`,variant:`outline`,disabled:!e.enabled||e.running,onClick:n,children:[(0,y.jsx)(a,{className:`h-3.5 w-3.5`}),` Run`]})})]})}function E(e){return e===`succeeded`?(0,y.jsx)(s,{className:`mr-1 h-3 w-3`}):e===`running`?(0,y.jsx)(n,{className:`mr-1 h-3 w-3`}):e===`failed`?(0,y.jsx)(u,{className:`mr-1 h-3 w-3`}):(0,y.jsx)(r,{className:`mr-1 h-3 w-3`})}function D(e){if(!e.lastResult)return`-`;let t=Object.entries(e.lastResult).filter(([,e])=>Array.isArray(e)?e.length>0:e!=null&&e!==0).map(([e,t])=>`${e}: ${Array.isArray(t)?t.length:String(t)}`);return t.length?t.join(`, `):`no changes`}function O(e,t){if(t<=e)return`due now`;let n=Math.max(0,(t-e)/1e3);return n<60?`in ${Math.ceil(n)}s`:n<3600?`in ${Math.ceil(n/60)}m`:n<86400?`in ${Math.ceil(n/3600)}h`:`in ${Math.ceil(n/86400)}d`}export{x as MaintenanceView};
2
+ //# sourceMappingURL=maintenance-CUxxVXsc.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"maintenance-CsoOFBXx.js","names":[],"sources":["../../dashboard/src/components/views/maintenance.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { Activity, AlertTriangle, CheckCircle2, Clock3, Play, RefreshCw, Wrench } from 'lucide-react'\nimport { useRelayStore, useNow } from '@/store'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { ScrollArea } from '@/components/ui/scroll-area'\nimport { cn } from '@/lib/utils'\nimport { fmtTime, timeAgo } from '@/lib/display'\nimport type { MaintenanceJob } from '@/types'\n\nconst STATUS_CLASS: Record<string, string> = {\n succeeded: 'bg-emerald-500/10 text-emerald-400 border-emerald-500/30',\n running: 'bg-blue-500/10 text-blue-400 border-blue-500/30',\n failed: 'bg-red-500/10 text-red-400 border-red-500/30',\n idle: 'bg-zinc-500/10 text-zinc-400 border-zinc-500/30',\n disabled: 'bg-zinc-500/10 text-zinc-500 border-zinc-500/20',\n}\n\nexport function MaintenanceView() {\n const now = useNow()\n const jobs = useRelayStore((s) => s.maintenanceJobs)\n const fetchMaintenanceJobs = useRelayStore((s) => s.fetchMaintenanceJobs)\n const runMaintenanceJob = useRelayStore((s) => s.runMaintenanceJob)\n\n const summary = useMemo(() => {\n const failed = jobs.filter((job) => job.lastStatus === 'failed').length\n const running = jobs.filter((job) => job.running || job.lastStatus === 'running').length\n const dueSoon = jobs.filter((job) => job.nextRunAt && job.nextRunAt <= now + 5 * 60 * 1000).length\n return { failed, running, dueSoon }\n }, [jobs, now])\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex items-center justify-between flex-wrap gap-2\">\n <div className=\"flex items-center gap-2 min-w-0\">\n <Wrench className=\"h-5 w-5 text-muted-foreground\" />\n <h2 className=\"text-lg font-semibold\">Maintenance</h2>\n <Badge variant=\"secondary\">{jobs.length}</Badge>\n {summary.running > 0 && <Badge className=\"border border-blue-500/30 bg-blue-500/10 text-blue-400\">{summary.running} running</Badge>}\n {summary.failed > 0 && <Badge variant=\"destructive\">{summary.failed} failing</Badge>}\n {summary.dueSoon > 0 && <Badge className=\"border border-yellow-500/30 bg-yellow-500/10 text-yellow-400\">{summary.dueSoon} due soon</Badge>}\n </div>\n <Button size=\"sm\" variant=\"outline\" onClick={() => void fetchMaintenanceJobs()}>\n <RefreshCw className=\"h-3.5 w-3.5\" /> Refresh\n </Button>\n </div>\n\n <ScrollArea className=\"h-[calc(100dvh-10rem)]\">\n {jobs.length === 0 ? (\n <div className=\"rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground\">No maintenance jobs registered</div>\n ) : (\n <>\n {/* Desktop / wide: full table */}\n <div className=\"hidden overflow-x-auto rounded-md border border-border md:block\">\n <table className=\"w-full min-w-[980px] text-sm\">\n <thead className=\"bg-muted/40 text-xs text-muted-foreground\">\n <tr>\n <th className=\"px-3 py-2 text-left font-medium\">Job</th>\n <th className=\"px-3 py-2 text-left font-medium\">Status</th>\n <th className=\"px-3 py-2 text-left font-medium\">Last run</th>\n <th className=\"px-3 py-2 text-left font-medium\">Next run</th>\n <th className=\"px-3 py-2 text-left font-medium\">Duration</th>\n <th className=\"px-3 py-2 text-left font-medium\">Result</th>\n <th className=\"px-3 py-2 text-right font-medium\">Action</th>\n </tr>\n </thead>\n <tbody>\n {jobs.map((job) => (\n <MaintenanceRow\n key={job.id}\n job={job}\n now={now}\n onRun={() => void runMaintenanceJob(job.id)}\n />\n ))}\n </tbody>\n </table>\n </div>\n\n {/* Mobile / narrow: stacked cards so every field is visible without horizontal scroll */}\n <div className=\"space-y-3 md:hidden\">\n {jobs.map((job) => (\n <MaintenanceCard\n key={job.id}\n job={job}\n now={now}\n onRun={() => void runMaintenanceJob(job.id)}\n />\n ))}\n </div>\n </>\n )}\n </ScrollArea>\n </div>\n )\n}\n\nfunction jobStatus(job: MaintenanceJob): string {\n return job.running ? 'running' : job.enabled ? job.lastStatus : 'disabled'\n}\n\nfunction StatusBadge({ status }: { status: string }) {\n return (\n <Badge variant=\"outline\" className={cn('border', STATUS_CLASS[status] || STATUS_CLASS.idle)}>\n {statusIcon(status)}\n {status}\n </Badge>\n )\n}\n\nfunction MaintenanceCard({ job, now, onRun }: { job: MaintenanceJob; now: number; onRun: () => void }) {\n const status = jobStatus(job)\n return (\n <div className=\"rounded-md border border-border p-3\">\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <div className=\"font-medium\">{job.title}</div>\n <div className=\"mt-0.5 text-xs text-muted-foreground\">{job.description}</div>\n <div className=\"mt-1 font-mono text-[11px] text-muted-foreground/80\">{job.id}</div>\n </div>\n <StatusBadge status={status} />\n </div>\n\n {job.consecutiveFailures > 0 && (\n <div className=\"mt-2 text-xs text-red-400\">{job.consecutiveFailures} failure{job.consecutiveFailures === 1 ? '' : 's'}</div>\n )}\n\n <dl className=\"mt-3 grid grid-cols-3 gap-2 text-xs\">\n <div>\n <dt className=\"text-muted-foreground\">Last run</dt>\n <dd>{job.lastRunAt ? <span title={fmtTime(job.lastRunAt)}>{timeAgo(now, job.lastRunAt)}</span> : 'never'}</dd>\n </div>\n <div>\n <dt className=\"text-muted-foreground\">Next run</dt>\n <dd>{job.nextRunAt ? <span title={fmtTime(job.nextRunAt)}>{nextRunText(now, job.nextRunAt)}</span> : '-'}</dd>\n </div>\n <div>\n <dt className=\"text-muted-foreground\">Duration</dt>\n <dd>{job.lastDurationMs !== undefined ? `${job.lastDurationMs}ms` : '-'}</dd>\n </div>\n </dl>\n\n <div className=\"mt-3\">\n <div className=\"text-xs text-muted-foreground\">Result</div>\n {job.lastError ? (\n <div className=\"mt-0.5 text-xs text-red-400 line-clamp-3\">{job.lastError}</div>\n ) : (\n <div className=\"mt-0.5 font-mono text-[11px] text-muted-foreground line-clamp-3\">{resultSummary(job)}</div>\n )}\n </div>\n\n <div className=\"mt-3 flex justify-end\">\n <Button size=\"sm\" variant=\"outline\" disabled={!job.enabled || job.running} onClick={onRun}>\n <Play className=\"h-3.5 w-3.5\" /> Run\n </Button>\n </div>\n </div>\n )\n}\n\nfunction MaintenanceRow({ job, now, onRun }: { job: MaintenanceJob; now: number; onRun: () => void }) {\n const status = jobStatus(job)\n return (\n <tr className=\"border-t border-border align-top\">\n <td className=\"px-3 py-3\">\n <div className=\"font-medium\">{job.title}</div>\n <div className=\"mt-0.5 max-w-md text-xs text-muted-foreground\">{job.description}</div>\n <div className=\"mt-1 font-mono text-[11px] text-muted-foreground/80\">{job.id}</div>\n </td>\n <td className=\"px-3 py-3\">\n <StatusBadge status={status} />\n {job.consecutiveFailures > 0 && (\n <div className=\"mt-1 text-xs text-red-400\">{job.consecutiveFailures} failure{job.consecutiveFailures === 1 ? '' : 's'}</div>\n )}\n </td>\n <td className=\"px-3 py-3 text-xs text-muted-foreground\">\n {job.lastRunAt ? (\n <span title={fmtTime(job.lastRunAt)}>{timeAgo(now, job.lastRunAt)}</span>\n ) : 'never'}\n </td>\n <td className=\"px-3 py-3 text-xs text-muted-foreground\">\n {job.nextRunAt ? (\n <span title={fmtTime(job.nextRunAt)}>{nextRunText(now, job.nextRunAt)}</span>\n ) : '-'}\n </td>\n <td className=\"px-3 py-3 text-xs text-muted-foreground\">\n {job.lastDurationMs !== undefined ? `${job.lastDurationMs}ms` : '-'}\n </td>\n <td className=\"px-3 py-3\">\n {job.lastError ? (\n <div className=\"max-w-sm text-xs text-red-400 line-clamp-3\">{job.lastError}</div>\n ) : (\n <div className=\"max-w-sm font-mono text-[11px] text-muted-foreground line-clamp-3\">{resultSummary(job)}</div>\n )}\n </td>\n <td className=\"px-3 py-3 text-right\">\n <Button size=\"sm\" variant=\"outline\" disabled={!job.enabled || job.running} onClick={onRun}>\n <Play className=\"h-3.5 w-3.5\" /> Run\n </Button>\n </td>\n </tr>\n )\n}\n\nfunction statusIcon(status: string) {\n if (status === 'succeeded') return <CheckCircle2 className=\"mr-1 h-3 w-3\" />\n if (status === 'running') return <Activity className=\"mr-1 h-3 w-3\" />\n if (status === 'failed') return <AlertTriangle className=\"mr-1 h-3 w-3\" />\n return <Clock3 className=\"mr-1 h-3 w-3\" />\n}\n\nfunction resultSummary(job: MaintenanceJob): string {\n if (!job.lastResult) return '-'\n const entries = Object.entries(job.lastResult)\n .filter(([, value]) => Array.isArray(value) ? value.length > 0 : value !== undefined && value !== null && value !== 0)\n .map(([key, value]) => `${key}: ${Array.isArray(value) ? value.length : String(value)}`)\n return entries.length ? entries.join(', ') : 'no changes'\n}\n\nfunction nextRunText(now: number, nextRunAt: number): string {\n if (nextRunAt <= now) return 'due now'\n const diff = Math.max(0, (nextRunAt - now) / 1000)\n if (diff < 60) return `in ${Math.ceil(diff)}s`\n if (diff < 3600) return `in ${Math.ceil(diff / 60)}m`\n if (diff < 86400) return `in ${Math.ceil(diff / 3600)}h`\n return `in ${Math.ceil(diff / 86400)}d`\n}\n"],"mappings":"0YAUM,EAAuC,CAC3C,UAAW,2DACX,QAAS,kDACT,OAAQ,+CACR,KAAM,kDACN,SAAU,kDACX,CAED,SAAgB,GAAkB,CAChC,IAAM,EAAM,GAAQ,CACd,EAAO,EAAe,GAAM,EAAE,gBAAgB,CAC9C,EAAuB,EAAe,GAAM,EAAE,qBAAqB,CACnE,EAAoB,EAAe,GAAM,EAAE,kBAAkB,CAE7D,GAAA,EAAA,EAAA,cAIG,CAAE,OAHM,E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,KAAC,EAAD,CAAU,UAAU,eAAiB,CAAA,CAClE,IAAW,UAAiB,EAAA,EAAA,KAAC,EAAD,CAAe,UAAU,eAAiB,CAAA,EACnE,EAAA,EAAA,KAAC,EAAD,CAAQ,UAAU,eAAiB,CAAA,CAG5C,SAAS,EAAc,EAA6B,CAClD,GAAI,CAAC,EAAI,WAAY,MAAO,IAC5B,IAAM,EAAU,OAAO,QAAQ,EAAI,WAAW,CAC3C,QAAQ,EAAG,KAAW,MAAM,QAAQ,EAAM,CAAG,EAAM,OAAS,EAAI,GAAiC,MAAQ,IAAU,EAAE,CACrH,KAAK,CAAC,EAAK,KAAW,GAAG,EAAI,IAAI,MAAM,QAAQ,EAAM,CAAG,EAAM,OAAS,OAAO,EAAM,GAAG,CAC1F,OAAO,EAAQ,OAAS,EAAQ,KAAK,KAAK,CAAG,aAG/C,SAAS,EAAY,EAAa,EAA2B,CAC3D,GAAI,GAAa,EAAK,MAAO,UAC7B,IAAM,EAAO,KAAK,IAAI,GAAI,EAAY,GAAO,IAAK,CAIlD,OAHI,EAAO,GAAW,MAAM,KAAK,KAAK,EAAK,CAAC,GACxC,EAAO,KAAa,MAAM,KAAK,KAAK,EAAO,GAAG,CAAC,GAC/C,EAAO,MAAc,MAAM,KAAK,KAAK,EAAO,KAAK,CAAC,GAC/C,MAAM,KAAK,KAAK,EAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"maintenance-CUxxVXsc.js","names":[],"sources":["../../dashboard/src/components/views/maintenance.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { Activity, AlertTriangle, CheckCircle2, Clock3, Play, RefreshCw, Wrench } from 'lucide-react'\nimport { useRelayStore, useNow } from '@/store'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { ScrollArea } from '@/components/ui/scroll-area'\nimport { cn } from '@/lib/utils'\nimport { fmtTime, timeAgo } from '@/lib/display'\nimport type { MaintenanceJob } from '@/types'\n\nconst STATUS_CLASS: Record<string, string> = {\n succeeded: 'bg-emerald-500/10 text-emerald-400 border-emerald-500/30',\n running: 'bg-blue-500/10 text-blue-400 border-blue-500/30',\n failed: 'bg-red-500/10 text-red-400 border-red-500/30',\n idle: 'bg-zinc-500/10 text-zinc-400 border-zinc-500/30',\n disabled: 'bg-zinc-500/10 text-zinc-500 border-zinc-500/20',\n}\n\nexport function MaintenanceView() {\n const now = useNow()\n const jobs = useRelayStore((s) => s.maintenanceJobs)\n const fetchMaintenanceJobs = useRelayStore((s) => s.fetchMaintenanceJobs)\n const runMaintenanceJob = useRelayStore((s) => s.runMaintenanceJob)\n\n const summary = useMemo(() => {\n const failed = jobs.filter((job) => job.lastStatus === 'failed').length\n const running = jobs.filter((job) => job.running || job.lastStatus === 'running').length\n const dueSoon = jobs.filter((job) => job.nextRunAt && job.nextRunAt <= now + 5 * 60 * 1000).length\n return { failed, running, dueSoon }\n }, [jobs, now])\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex items-center justify-between flex-wrap gap-2\">\n <div className=\"flex items-center gap-2 min-w-0\">\n <Wrench className=\"h-5 w-5 text-muted-foreground\" />\n <h2 className=\"text-lg font-semibold\">Maintenance</h2>\n <Badge variant=\"secondary\">{jobs.length}</Badge>\n {summary.running > 0 && <Badge className=\"border border-blue-500/30 bg-blue-500/10 text-blue-400\">{summary.running} running</Badge>}\n {summary.failed > 0 && <Badge variant=\"destructive\">{summary.failed} failing</Badge>}\n {summary.dueSoon > 0 && <Badge className=\"border border-yellow-500/30 bg-yellow-500/10 text-yellow-400\">{summary.dueSoon} due soon</Badge>}\n </div>\n <Button size=\"sm\" variant=\"outline\" onClick={() => void fetchMaintenanceJobs()}>\n <RefreshCw className=\"h-3.5 w-3.5\" /> Refresh\n </Button>\n </div>\n\n <ScrollArea className=\"h-[calc(100dvh-10rem)]\">\n {jobs.length === 0 ? (\n <div className=\"rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground\">No maintenance jobs registered</div>\n ) : (\n <>\n {/* Desktop / wide: full table */}\n <div className=\"hidden overflow-x-auto rounded-md border border-border md:block\">\n <table className=\"w-full min-w-[980px] text-sm\">\n <thead className=\"bg-muted/40 text-xs text-muted-foreground\">\n <tr>\n <th className=\"px-3 py-2 text-left font-medium\">Job</th>\n <th className=\"px-3 py-2 text-left font-medium\">Status</th>\n <th className=\"px-3 py-2 text-left font-medium\">Last run</th>\n <th className=\"px-3 py-2 text-left font-medium\">Next run</th>\n <th className=\"px-3 py-2 text-left font-medium\">Duration</th>\n <th className=\"px-3 py-2 text-left font-medium\">Result</th>\n <th className=\"px-3 py-2 text-right font-medium\">Action</th>\n </tr>\n </thead>\n <tbody>\n {jobs.map((job) => (\n <MaintenanceRow\n key={job.id}\n job={job}\n now={now}\n onRun={() => void runMaintenanceJob(job.id)}\n />\n ))}\n </tbody>\n </table>\n </div>\n\n {/* Mobile / narrow: stacked cards so every field is visible without horizontal scroll */}\n <div className=\"space-y-3 md:hidden\">\n {jobs.map((job) => (\n <MaintenanceCard\n key={job.id}\n job={job}\n now={now}\n onRun={() => void runMaintenanceJob(job.id)}\n />\n ))}\n </div>\n </>\n )}\n </ScrollArea>\n </div>\n )\n}\n\nfunction jobStatus(job: MaintenanceJob): string {\n return job.running ? 'running' : job.enabled ? job.lastStatus : 'disabled'\n}\n\nfunction StatusBadge({ status }: { status: string }) {\n return (\n <Badge variant=\"outline\" className={cn('border', STATUS_CLASS[status] || STATUS_CLASS.idle)}>\n {statusIcon(status)}\n {status}\n </Badge>\n )\n}\n\nfunction MaintenanceCard({ job, now, onRun }: { job: MaintenanceJob; now: number; onRun: () => void }) {\n const status = jobStatus(job)\n return (\n <div className=\"rounded-md border border-border p-3\">\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <div className=\"font-medium\">{job.title}</div>\n <div className=\"mt-0.5 text-xs text-muted-foreground\">{job.description}</div>\n <div className=\"mt-1 font-mono text-[11px] text-muted-foreground/80\">{job.id}</div>\n </div>\n <StatusBadge status={status} />\n </div>\n\n {job.consecutiveFailures > 0 && (\n <div className=\"mt-2 text-xs text-red-400\">{job.consecutiveFailures} failure{job.consecutiveFailures === 1 ? '' : 's'}</div>\n )}\n\n <dl className=\"mt-3 grid grid-cols-3 gap-2 text-xs\">\n <div>\n <dt className=\"text-muted-foreground\">Last run</dt>\n <dd>{job.lastRunAt ? <span title={fmtTime(job.lastRunAt)}>{timeAgo(now, job.lastRunAt)}</span> : 'never'}</dd>\n </div>\n <div>\n <dt className=\"text-muted-foreground\">Next run</dt>\n <dd>{job.nextRunAt ? <span title={fmtTime(job.nextRunAt)}>{nextRunText(now, job.nextRunAt)}</span> : '-'}</dd>\n </div>\n <div>\n <dt className=\"text-muted-foreground\">Duration</dt>\n <dd>{job.lastDurationMs !== undefined ? `${job.lastDurationMs}ms` : '-'}</dd>\n </div>\n </dl>\n\n <div className=\"mt-3\">\n <div className=\"text-xs text-muted-foreground\">Result</div>\n {job.lastError ? (\n <div className=\"mt-0.5 text-xs text-red-400 line-clamp-3\">{job.lastError}</div>\n ) : (\n <div className=\"mt-0.5 font-mono text-[11px] text-muted-foreground line-clamp-3\">{resultSummary(job)}</div>\n )}\n </div>\n\n <div className=\"mt-3 flex justify-end\">\n <Button size=\"sm\" variant=\"outline\" disabled={!job.enabled || job.running} onClick={onRun}>\n <Play className=\"h-3.5 w-3.5\" /> Run\n </Button>\n </div>\n </div>\n )\n}\n\nfunction MaintenanceRow({ job, now, onRun }: { job: MaintenanceJob; now: number; onRun: () => void }) {\n const status = jobStatus(job)\n return (\n <tr className=\"border-t border-border align-top\">\n <td className=\"px-3 py-3\">\n <div className=\"font-medium\">{job.title}</div>\n <div className=\"mt-0.5 max-w-md text-xs text-muted-foreground\">{job.description}</div>\n <div className=\"mt-1 font-mono text-[11px] text-muted-foreground/80\">{job.id}</div>\n </td>\n <td className=\"px-3 py-3\">\n <StatusBadge status={status} />\n {job.consecutiveFailures > 0 && (\n <div className=\"mt-1 text-xs text-red-400\">{job.consecutiveFailures} failure{job.consecutiveFailures === 1 ? '' : 's'}</div>\n )}\n </td>\n <td className=\"px-3 py-3 text-xs text-muted-foreground\">\n {job.lastRunAt ? (\n <span title={fmtTime(job.lastRunAt)}>{timeAgo(now, job.lastRunAt)}</span>\n ) : 'never'}\n </td>\n <td className=\"px-3 py-3 text-xs text-muted-foreground\">\n {job.nextRunAt ? (\n <span title={fmtTime(job.nextRunAt)}>{nextRunText(now, job.nextRunAt)}</span>\n ) : '-'}\n </td>\n <td className=\"px-3 py-3 text-xs text-muted-foreground\">\n {job.lastDurationMs !== undefined ? `${job.lastDurationMs}ms` : '-'}\n </td>\n <td className=\"px-3 py-3\">\n {job.lastError ? (\n <div className=\"max-w-sm text-xs text-red-400 line-clamp-3\">{job.lastError}</div>\n ) : (\n <div className=\"max-w-sm font-mono text-[11px] text-muted-foreground line-clamp-3\">{resultSummary(job)}</div>\n )}\n </td>\n <td className=\"px-3 py-3 text-right\">\n <Button size=\"sm\" variant=\"outline\" disabled={!job.enabled || job.running} onClick={onRun}>\n <Play className=\"h-3.5 w-3.5\" /> Run\n </Button>\n </td>\n </tr>\n )\n}\n\nfunction statusIcon(status: string) {\n if (status === 'succeeded') return <CheckCircle2 className=\"mr-1 h-3 w-3\" />\n if (status === 'running') return <Activity className=\"mr-1 h-3 w-3\" />\n if (status === 'failed') return <AlertTriangle className=\"mr-1 h-3 w-3\" />\n return <Clock3 className=\"mr-1 h-3 w-3\" />\n}\n\nfunction resultSummary(job: MaintenanceJob): string {\n if (!job.lastResult) return '-'\n const entries = Object.entries(job.lastResult)\n .filter(([, value]) => Array.isArray(value) ? value.length > 0 : value !== undefined && value !== null && value !== 0)\n .map(([key, value]) => `${key}: ${Array.isArray(value) ? value.length : String(value)}`)\n return entries.length ? entries.join(', ') : 'no changes'\n}\n\nfunction nextRunText(now: number, nextRunAt: number): string {\n if (nextRunAt <= now) return 'due now'\n const diff = Math.max(0, (nextRunAt - now) / 1000)\n if (diff < 60) return `in ${Math.ceil(diff)}s`\n if (diff < 3600) return `in ${Math.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CAAC"}
@@ -1,2 +1,2 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{Dn as t,I as n,R as r,Vn as i,g as a,k as o,kn as s,kt as c,m as l,y as u,z as d}from"./lucide-react-CD8Xl2U3.js";import{t as f}from"./store-DiSzYHj9.js";import{m as p}from"./display-Bebqs1qu.js";import{t as m}from"./button-DDA5P2YQ.js";import{c as h,l as g}from"./index-BHRtR4q7.js";var _=e(i(),1),v=s(),y={running:`bg-emerald-500/15 text-emerald-400 border-emerald-500/30`,starting:`bg-blue-500/15 text-blue-400 border-blue-500/30`,stopping:`bg-yellow-500/15 text-yellow-400 border-yellow-500/30`,backoff:`bg-red-500/15 text-red-400 border-red-500/30`,stopped:`bg-muted text-muted-foreground border-border`};function b({status:e}){return(0,v.jsx)(`span`,{className:t(`inline-flex items-center rounded border px-2 py-0.5 text-xs font-medium`,y[e]),children:e})}function x(e,t){let n=t?.meta?.tmuxSession;return typeof n==`string`&&n.trim()?n:e.state.tmuxSession}function S(e,t){return x(e,t)?t?!!t.providerCapabilities?.terminal?.live?.read:e.policy.provider===`claude`:!1}function C(e,t){return S(e,t)?t?!!(t.providerCapabilities?.terminal?.live?.write||e.policy.provider===`claude`):e.policy.provider===`claude`:!1}function w(){let e=f(e=>e.managedPolicies),t=f(e=>e.agentsById),i=f(e=>e.fetchManagedPolicies),s=f(e=>e.apiCall),y=f(e=>e.openPolicyCreate),w=f(e=>e.openPolicyEdit),T=f(e=>e.deletePolicy),[E,D]=(0,_.useState)(null),[O,k]=(0,_.useState)(null);(0,_.useEffect)(()=>{i()},[]);async function A(e,t){await s(`POST`,`/spawn-policy/${encodeURIComponent(e)}/${t}`,{surface:{component:`managed-agents`}}),await i()}return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Managed Agents`}),(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Spawn policies, lifecycle state, and headless session logs.`})]}),(0,v.jsxs)(m,{onClick:y,size:`sm`,children:[(0,v.jsx)(n,{className:`h-4 w-4 mr-1`}),`Create Policy`]})]}),e.length===0&&(0,v.jsx)(`div`,{className:`rounded-md border border-border px-3 py-8 text-center text-sm text-muted-foreground`,children:`No managed agents configured`}),(0,v.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>{let n=e.state.agentId?t[e.state.agentId]:void 0,i=x(e,n);return(0,v.jsxs)(`div`,{className:`rounded-md border border-border bg-card p-3 space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(`div`,{className:`font-medium text-sm truncate`,children:e.policy.label||e.policy.name}),(0,v.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[e.policy.mode,` · `,e.policy.cwd]})]}),(0,v.jsx)(b,{status:e.state.status})]}),(0,v.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-1 text-xs`,children:[(0,v.jsx)(`div`,{className:`text-muted-foreground`,children:`Provider`}),(0,v.jsx)(`div`,{children:e.policy.provider}),(0,v.jsx)(`div`,{className:`text-muted-foreground`,children:`Agent`}),(0,v.jsx)(`div`,{className:`font-mono truncate`,children:e.state.agentId||`-`}),(0,v.jsx)(`div`,{className:`text-muted-foreground`,children:`Restarts`}),(0,v.jsx)(`div`,{children:e.state.restartCount}),(e.state.backoffUntil||e.state.lastError)&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`text-muted-foreground`,children:e.state.backoffUntil?`Backoff`:`Error`}),(0,v.jsx)(`div`,{className:`truncate`,children:e.state.backoffUntil?p(e.state.backoffUntil):e.state.lastError})]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1 border-t border-border`,children:[(0,v.jsx)(m,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>A(e.policy.name,`start`),title:`Start`,children:(0,v.jsx)(r,{className:`h-3.5 w-3.5`})}),(0,v.jsx)(m,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>A(e.policy.name,`stop`),title:`Stop`,children:(0,v.jsx)(u,{className:`h-3.5 w-3.5`})}),(0,v.jsx)(m,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>A(e.policy.name,`restart`),title:`Restart`,children:(0,v.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,v.jsx)(m,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>D(e),disabled:!e.state.tmuxSession,title:`Logs`,children:(0,v.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,v.jsx)(m,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>i&&k({item:e,session:i}),disabled:!S(e,n),title:`Terminal`,children:(0,v.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,v.jsx)(m,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>w(e.policy),title:`Edit`,children:(0,v.jsx)(d,{className:`h-3.5 w-3.5`})}),(0,v.jsx)(m,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>T(e.policy.name),title:`Delete`,children:(0,v.jsx)(l,{className:`h-3.5 w-3.5`})})]})]},e.policy.name)})}),E?.state.tmuxSession&&(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsxs)(`h2`,{className:`text-lg font-semibold`,children:[E.policy.name,` Logs`]}),(0,v.jsx)(m,{variant:`outline`,size:`sm`,onClick:()=>D(null),children:`Close`})]}),(0,v.jsx)(h,{orchestratorId:E.policy.orchestratorId,session:E.state.tmuxSession})]}),(0,v.jsx)(g,{open:!!O,onOpenChange:e=>{e||k(null)},orchestratorId:O?.item.policy.orchestratorId??``,session:O?.session??``,interactive:O?C(O.item,O.item.state.agentId?t[O.item.state.agentId]:void 0):!1})]})}export{w as ManagedAgentsView};
2
- //# sourceMappingURL=managed-agents-Q3HuVjGg.js.map
1
+ import{r as e}from"./chunk-CilyBKbf.js";import{Dn as t,I as n,R as r,Vn as i,g as a,k as o,kn as s,kt as c,m as l,y as u,z as d}from"./lucide-react-CD8Xl2U3.js";import{t as f}from"./store-CICRhg1m.js";import{m as p}from"./display-Bebqs1qu.js";import{t as m}from"./button-DDA5P2YQ.js";import{c as h,l as g}from"./index-CvSlyTSI.js";var _=e(i(),1),v=s(),y={running:`bg-emerald-500/15 text-emerald-400 border-emerald-500/30`,starting:`bg-blue-500/15 text-blue-400 border-blue-500/30`,stopping:`bg-yellow-500/15 text-yellow-400 border-yellow-500/30`,backoff:`bg-red-500/15 text-red-400 border-red-500/30`,stopped:`bg-muted text-muted-foreground border-border`};function b({status:e}){return(0,v.jsx)(`span`,{className:t(`inline-flex items-center rounded border px-2 py-0.5 text-xs font-medium`,y[e]),children:e})}function x(e,t){let n=t?.meta?.tmuxSession;return typeof n==`string`&&n.trim()?n:e.state.tmuxSession}function S(e,t){return x(e,t)?t?!!t.providerCapabilities?.terminal?.live?.read:e.policy.provider===`claude`:!1}function C(e,t){return S(e,t)?t?!!(t.providerCapabilities?.terminal?.live?.write||e.policy.provider===`claude`):e.policy.provider===`claude`:!1}function w(){let e=f(e=>e.managedPolicies),t=f(e=>e.agentsById),i=f(e=>e.fetchManagedPolicies),s=f(e=>e.apiCall),y=f(e=>e.openPolicyCreate),w=f(e=>e.openPolicyEdit),T=f(e=>e.deletePolicy),[E,D]=(0,_.useState)(null),[O,k]=(0,_.useState)(null);(0,_.useEffect)(()=>{i()},[]);async function A(e,t){await s(`POST`,`/spawn-policy/${encodeURIComponent(e)}/${t}`,{surface:{component:`managed-agents`}}),await i()}return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Managed Agents`}),(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Spawn policies, lifecycle state, and headless session logs.`})]}),(0,v.jsxs)(m,{onClick:y,size:`sm`,children:[(0,v.jsx)(n,{className:`h-4 w-4 mr-1`}),`Create Policy`]})]}),e.length===0&&(0,v.jsx)(`div`,{className:`rounded-md border border-border px-3 py-8 text-center text-sm text-muted-foreground`,children:`No managed agents configured`}),(0,v.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>{let n=e.state.agentId?t[e.state.agentId]:void 0,i=x(e,n);return(0,v.jsxs)(`div`,{className:`rounded-md border border-border bg-card p-3 space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(`div`,{className:`font-medium text-sm truncate`,children:e.policy.label||e.policy.name}),(0,v.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[e.policy.mode,` · `,e.policy.cwd]})]}),(0,v.jsx)(b,{status:e.state.status})]}),(0,v.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-1 text-xs`,children:[(0,v.jsx)(`div`,{className:`text-muted-foreground`,children:`Provider`}),(0,v.jsx)(`div`,{children:e.policy.provider}),(0,v.jsx)(`div`,{className:`text-muted-foreground`,children:`Agent`}),(0,v.jsx)(`div`,{className:`font-mono truncate`,children:e.state.agentId||`-`}),(0,v.jsx)(`div`,{className:`text-muted-foreground`,children:`Restarts`}),(0,v.jsx)(`div`,{children:e.state.restartCount}),(e.state.backoffUntil||e.state.lastError)&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`text-muted-foreground`,children:e.state.backoffUntil?`Backoff`:`Error`}),(0,v.jsx)(`div`,{className:`truncate`,children:e.state.backoffUntil?p(e.state.backoffUntil):e.state.lastError})]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1 border-t border-border`,children:[(0,v.jsx)(m,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>A(e.policy.name,`start`),title:`Start`,children:(0,v.jsx)(r,{className:`h-3.5 w-3.5`})}),(0,v.jsx)(m,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>A(e.policy.name,`stop`),title:`Stop`,children:(0,v.jsx)(u,{className:`h-3.5 w-3.5`})}),(0,v.jsx)(m,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>A(e.policy.name,`restart`),title:`Restart`,children:(0,v.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,v.jsx)(m,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>D(e),disabled:!e.state.tmuxSession,title:`Logs`,children:(0,v.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,v.jsx)(m,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>i&&k({item:e,session:i}),disabled:!S(e,n),title:`Terminal`,children:(0,v.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,v.jsx)(m,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>w(e.policy),title:`Edit`,children:(0,v.jsx)(d,{className:`h-3.5 w-3.5`})}),(0,v.jsx)(m,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>T(e.policy.name),title:`Delete`,children:(0,v.jsx)(l,{className:`h-3.5 w-3.5`})})]})]},e.policy.name)})}),E?.state.tmuxSession&&(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsxs)(`h2`,{className:`text-lg font-semibold`,children:[E.policy.name,` Logs`]}),(0,v.jsx)(m,{variant:`outline`,size:`sm`,onClick:()=>D(null),children:`Close`})]}),(0,v.jsx)(h,{orchestratorId:E.policy.orchestratorId,session:E.state.tmuxSession})]}),(0,v.jsx)(g,{open:!!O,onOpenChange:e=>{e||k(null)},orchestratorId:O?.item.policy.orchestratorId??``,session:O?.session??``,interactive:O?C(O.item,O.item.state.agentId?t[O.item.state.agentId]:void 0):!1})]})}export{w as ManagedAgentsView};
2
+ //# sourceMappingURL=managed-agents-VZEeMMSP.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"managed-agents-Q3HuVjGg.js","names":[],"sources":["../../dashboard/src/components/shared/health-badge.tsx","../../dashboard/src/components/views/managed-agents.tsx"],"sourcesContent":["import { cn } from '@/lib/utils'\nimport type { ManagedAgentLifecycleStatus } from '@/types'\n\nconst styles: Record<ManagedAgentLifecycleStatus, string> = {\n running: 'bg-emerald-500/15 text-emerald-400 border-emerald-500/30',\n starting: 'bg-blue-500/15 text-blue-400 border-blue-500/30',\n stopping: 'bg-yellow-500/15 text-yellow-400 border-yellow-500/30',\n backoff: 'bg-red-500/15 text-red-400 border-red-500/30',\n stopped: 'bg-muted text-muted-foreground border-border',\n}\n\nexport function HealthBadge({ status }: { status: ManagedAgentLifecycleStatus }) {\n return (\n <span className={cn('inline-flex items-center rounded border px-2 py-0.5 text-xs font-medium', styles[status])}>\n {status}\n </span>\n )\n}\n","import { useEffect, useState } from 'react'\nimport { FileText, Pencil, Play, Plus, RotateCw, Square, Terminal, Trash2 } from 'lucide-react'\nimport { useRelayStore } from '@/store'\nimport { Button } from '@/components/ui/button'\nimport { HealthBadge } from '@/components/shared/health-badge'\nimport { LogViewer } from '@/components/shared/log-viewer'\nimport { TerminalDialog } from '@/components/shared/terminal-viewer'\nimport { fmtTime } from '@/lib/display'\nimport type { Agent, ManagedPolicyHealth } from '@/types'\n\nfunction terminalSessionFor(item: ManagedPolicyHealth, agent?: Agent): string | undefined {\n const agentSession = agent?.meta?.tmuxSession\n if (typeof agentSession === 'string' && agentSession.trim()) return agentSession\n return item.state.tmuxSession\n}\n\nfunction canReadTerminal(item: ManagedPolicyHealth, agent?: Agent): boolean {\n if (!terminalSessionFor(item, agent)) return false\n if (agent) return Boolean(agent.providerCapabilities?.terminal?.live?.read)\n return item.policy.provider === 'claude'\n}\n\nfunction canWriteTerminal(item: ManagedPolicyHealth, agent?: Agent): boolean {\n if (!canReadTerminal(item, agent)) return false\n if (agent) return Boolean(agent.providerCapabilities?.terminal?.live?.write || item.policy.provider === 'claude')\n return item.policy.provider === 'claude'\n}\n\nexport function ManagedAgentsView() {\n const policies = useRelayStore((s) => s.managedPolicies)\n const agentsById = useRelayStore((s) => s.agentsById)\n const fetchManagedPolicies = useRelayStore((s) => s.fetchManagedPolicies)\n const apiCall = useRelayStore((s) => s.apiCall)\n const openPolicyCreate = useRelayStore((s) => s.openPolicyCreate)\n const openPolicyEdit = useRelayStore((s) => s.openPolicyEdit)\n const deletePolicy = useRelayStore((s) => s.deletePolicy)\n const [logsFor, setLogsFor] = useState<ManagedPolicyHealth | null>(null)\n const [terminalFor, setTerminalFor] = useState<{ item: ManagedPolicyHealth; session: string } | null>(null)\n\n useEffect(() => {\n void fetchManagedPolicies()\n }, [])\n\n async function lifecycle(name: string, action: 'start' | 'stop' | 'restart') {\n await apiCall('POST', `/spawn-policy/${encodeURIComponent(name)}/${action}`, { surface: { component: 'managed-agents' } })\n await fetchManagedPolicies()\n }\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex items-center justify-between\">\n <div>\n <h1 className=\"text-2xl font-semibold\">Managed Agents</h1>\n <p className=\"text-sm text-muted-foreground\">Spawn policies, lifecycle state, and headless session logs.</p>\n </div>\n <Button onClick={openPolicyCreate} size=\"sm\">\n <Plus className=\"h-4 w-4 mr-1\" />\n Create Policy\n </Button>\n </div>\n\n {policies.length === 0 && (\n <div className=\"rounded-md border border-border px-3 py-8 text-center text-sm text-muted-foreground\">\n No managed agents configured\n </div>\n )}\n\n <div className=\"grid gap-3 sm:grid-cols-2 lg:grid-cols-3\">\n {policies.map((item) => {\n const agent = item.state.agentId ? agentsById[item.state.agentId] : undefined\n const terminalSession = terminalSessionFor(item, agent)\n return (\n <div key={item.policy.name} className=\"rounded-md border border-border bg-card p-3 space-y-2\">\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <div className=\"font-medium text-sm truncate\">{item.policy.label || item.policy.name}</div>\n <div className=\"text-xs text-muted-foreground truncate\">{item.policy.mode} · {item.policy.cwd}</div>\n </div>\n <HealthBadge status={item.state.status} />\n </div>\n\n <div className=\"grid grid-cols-2 gap-x-4 gap-y-1 text-xs\">\n <div className=\"text-muted-foreground\">Provider</div>\n <div>{item.policy.provider}</div>\n <div className=\"text-muted-foreground\">Agent</div>\n <div className=\"font-mono truncate\">{item.state.agentId || '-'}</div>\n <div className=\"text-muted-foreground\">Restarts</div>\n <div>{item.state.restartCount}</div>\n {(item.state.backoffUntil || item.state.lastError) && (\n <>\n <div className=\"text-muted-foreground\">{item.state.backoffUntil ? 'Backoff' : 'Error'}</div>\n <div className=\"truncate\">{item.state.backoffUntil ? fmtTime(item.state.backoffUntil) : item.state.lastError}</div>\n </>\n )}\n </div>\n\n <div className=\"flex flex-wrap gap-1 pt-1 border-t border-border\">\n <Button size=\"icon\" variant=\"outline\" className=\"h-7 w-7\" onClick={() => lifecycle(item.policy.name, 'start')} title=\"Start\"><Play className=\"h-3.5 w-3.5\" /></Button>\n <Button size=\"icon\" variant=\"outline\" className=\"h-7 w-7\" onClick={() => lifecycle(item.policy.name, 'stop')} title=\"Stop\"><Square className=\"h-3.5 w-3.5\" /></Button>\n <Button size=\"icon\" variant=\"outline\" className=\"h-7 w-7\" onClick={() => lifecycle(item.policy.name, 'restart')} title=\"Restart\"><RotateCw className=\"h-3.5 w-3.5\" /></Button>\n <Button size=\"icon\" variant=\"outline\" className=\"h-7 w-7\" onClick={() => setLogsFor(item)} disabled={!item.state.tmuxSession} title=\"Logs\"><FileText className=\"h-3.5 w-3.5\" /></Button>\n <Button size=\"icon\" variant=\"outline\" className=\"h-7 w-7\" onClick={() => terminalSession && setTerminalFor({ item, session: terminalSession })} disabled={!canReadTerminal(item, agent)} title=\"Terminal\"><Terminal className=\"h-3.5 w-3.5\" /></Button>\n <Button size=\"icon\" variant=\"outline\" className=\"h-7 w-7\" onClick={() => openPolicyEdit(item.policy)} title=\"Edit\"><Pencil className=\"h-3.5 w-3.5\" /></Button>\n <Button size=\"icon\" variant=\"outline\" className=\"h-7 w-7\" onClick={() => deletePolicy(item.policy.name)} title=\"Delete\"><Trash2 className=\"h-3.5 w-3.5\" /></Button>\n </div>\n </div>\n )\n })}\n </div>\n\n {logsFor?.state.tmuxSession && (\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold\">{logsFor.policy.name} Logs</h2>\n <Button variant=\"outline\" size=\"sm\" onClick={() => setLogsFor(null)}>Close</Button>\n </div>\n <LogViewer orchestratorId={logsFor.policy.orchestratorId} session={logsFor.state.tmuxSession} />\n </div>\n )}\n\n <TerminalDialog\n open={!!terminalFor}\n onOpenChange={(open) => { if (!open) setTerminalFor(null) }}\n orchestratorId={terminalFor?.item.policy.orchestratorId ?? ''}\n session={terminalFor?.session ?? ''}\n interactive={terminalFor ? canWriteTerminal(terminalFor.item, terminalFor.item.state.agentId ? agentsById[terminalFor.item.state.agentId] : undefined) : false}\n />\n </div>\n )\n}\n"],"mappings":"gWAGA,EAAA,+SAQA,SAAA,EAAA,CAAA,UAAA,kICDA,SAAS,EAAmB,EAA2B,EAAmC,CACxF,IAAM,EAAe,GAAO,MAAM,YAElC,OADI,OAAO,GAAiB,UAAY,EAAa,MAAM,CAAS,EAC7D,EAAK,MAAM,YAGpB,SAAS,EAAgB,EAA2B,EAAwB,CAG1E,OAFK,EAAmB,EAAM,EAAM,CAChC,EAAc,EAAQ,EAAM,sBAAsB,UAAU,MAAM,KAC/D,EAAK,OAAO,WAAa,SAFa,GAK/C,SAAS,EAAiB,EAA2B,EAAwB,CAG3E,OAFK,EAAgB,EAAM,EAAM,CAC7B,EAAc,GAAQ,EAAM,sBAAsB,UAAU,MAAM,OAAS,EAAK,OAAO,WAAa,UACjG,EAAK,OAAO,WAAa,SAFU,GAK5C,SAAgB,GAAoB,CAClC,IAAM,EAAW,EAAe,GAAM,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EAAA,EAAA,KAAC,EAAD,CAAQ,KAAK,OAAO,QAAQ,UAAU,UAAU,UAAU,YAAe,EAAa,EAAK,OAAO,KAAK,CAAE,MAAM,mBAAS,EAAA,EAAA,KAAC,EAAD,CAAQ,UAAU,cAAgB,CAAA,CAAS,CAAA,CAC/J,GACF,EAjCI,EAAK,OAAO,KAiChB,EAEN,CACE,CAAA,CAEL,GAAS,MAAM,cACd,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,qBAAf,EACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,6CAAf,EACE,EAAA,EAAA,MAAC,KAAD,CAAI,UAAU,iCAAd,CAAuC,EAAQ,OAAO,KAAK,QAAU,IACrE,EAAA,EAAA,KAAC,EAAD,CAAQ,QAAQ,UAAU,KAAK,KAAK,YAAe,EAAW,KAAK,UAAE,QAAc,CAAA,CAC/E,IACN,EAAA,EAAA,KAAC,EAAD,CAAW,eAAgB,EAAQ,OAAO,eAAgB,QAAS,EAAQ,MAAM,YAAe,CAAA,CAC5F,IAGR,EAAA,EAAA,KAAC,EAAD,CACE,KAAM,CAAC,CAAC,EACR,aAAe,GAAS,CAAO,GAAM,EAAe,KAAK,EACzD,eAAgB,GAAa,KAAK,OAAO,gBAAkB,GAC3D,QAAS,GAAa,SAAW,GACjC,YAAa,EAAc,EAAiB,EAAY,KAAM,EAAY,KAAK,MAAM,QAAU,EAAW,EAAY,KAAK,MAAM,SAAW,IAAA,GAAU,CAAG,GACzJ,CAAA,CACE"}
1
+ {"version":3,"file":"managed-agents-VZEeMMSP.js","names":[],"sources":["../../dashboard/src/components/shared/health-badge.tsx","../../dashboard/src/components/views/managed-agents.tsx"],"sourcesContent":["import { cn } from '@/lib/utils'\nimport type { ManagedAgentLifecycleStatus } from '@/types'\n\nconst styles: Record<ManagedAgentLifecycleStatus, string> = {\n running: 'bg-emerald-500/15 text-emerald-400 border-emerald-500/30',\n starting: 'bg-blue-500/15 text-blue-400 border-blue-500/30',\n stopping: 'bg-yellow-500/15 text-yellow-400 border-yellow-500/30',\n backoff: 'bg-red-500/15 text-red-400 border-red-500/30',\n stopped: 'bg-muted text-muted-foreground border-border',\n}\n\nexport function HealthBadge({ status }: { status: ManagedAgentLifecycleStatus }) {\n return (\n <span className={cn('inline-flex items-center rounded border px-2 py-0.5 text-xs font-medium', styles[status])}>\n {status}\n </span>\n )\n}\n","import { useEffect, useState } from 'react'\nimport { FileText, Pencil, Play, Plus, RotateCw, Square, Terminal, Trash2 } from 'lucide-react'\nimport { useRelayStore } from '@/store'\nimport { Button } from '@/components/ui/button'\nimport { HealthBadge } from '@/components/shared/health-badge'\nimport { LogViewer } from '@/components/shared/log-viewer'\nimport { TerminalDialog } from '@/components/shared/terminal-viewer'\nimport { fmtTime } from '@/lib/display'\nimport type { Agent, ManagedPolicyHealth } from '@/types'\n\nfunction terminalSessionFor(item: ManagedPolicyHealth, agent?: Agent): string | undefined {\n const agentSession = agent?.meta?.tmuxSession\n if (typeof agentSession === 'string' && agentSession.trim()) return agentSession\n return item.state.tmuxSession\n}\n\nfunction canReadTerminal(item: ManagedPolicyHealth, agent?: Agent): boolean {\n if (!terminalSessionFor(item, agent)) return false\n if (agent) return Boolean(agent.providerCapabilities?.terminal?.live?.read)\n return item.policy.provider === 'claude'\n}\n\nfunction canWriteTerminal(item: ManagedPolicyHealth, agent?: Agent): boolean {\n if (!canReadTerminal(item, agent)) return false\n if (agent) return Boolean(agent.providerCapabilities?.terminal?.live?.write || item.policy.provider === 'claude')\n return item.policy.provider === 'claude'\n}\n\nexport function ManagedAgentsView() {\n const policies = useRelayStore((s) => s.managedPolicies)\n const agentsById = useRelayStore((s) => s.agentsById)\n const fetchManagedPolicies = useRelayStore((s) => s.fetchManagedPolicies)\n const apiCall = useRelayStore((s) => s.apiCall)\n const openPolicyCreate = useRelayStore((s) => s.openPolicyCreate)\n const openPolicyEdit = useRelayStore((s) => s.openPolicyEdit)\n const deletePolicy = useRelayStore((s) => s.deletePolicy)\n const [logsFor, setLogsFor] = useState<ManagedPolicyHealth | null>(null)\n const [terminalFor, setTerminalFor] = useState<{ item: ManagedPolicyHealth; session: string } | null>(null)\n\n useEffect(() => {\n void fetchManagedPolicies()\n }, [])\n\n async function lifecycle(name: string, action: 'start' | 'stop' | 'restart') {\n await apiCall('POST', `/spawn-policy/${encodeURIComponent(name)}/${action}`, { surface: { component: 'managed-agents' } })\n await fetchManagedPolicies()\n }\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex items-center justify-between\">\n <div>\n <h1 className=\"text-2xl font-semibold\">Managed Agents</h1>\n <p className=\"text-sm text-muted-foreground\">Spawn policies, lifecycle state, and headless session logs.</p>\n </div>\n <Button onClick={openPolicyCreate} size=\"sm\">\n <Plus className=\"h-4 w-4 mr-1\" />\n Create Policy\n </Button>\n </div>\n\n {policies.length === 0 && (\n <div className=\"rounded-md border border-border px-3 py-8 text-center text-sm text-muted-foreground\">\n No managed agents configured\n </div>\n )}\n\n <div className=\"grid gap-3 sm:grid-cols-2 lg:grid-cols-3\">\n {policies.map((item) => {\n const agent = item.state.agentId ? agentsById[item.state.agentId] : undefined\n const terminalSession = terminalSessionFor(item, agent)\n return (\n <div key={item.policy.name} className=\"rounded-md border border-border bg-card p-3 space-y-2\">\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <div className=\"font-medium text-sm truncate\">{item.policy.label || item.policy.name}</div>\n <div className=\"text-xs text-muted-foreground truncate\">{item.policy.mode} · {item.policy.cwd}</div>\n </div>\n <HealthBadge status={item.state.status} />\n </div>\n\n <div className=\"grid grid-cols-2 gap-x-4 gap-y-1 text-xs\">\n <div className=\"text-muted-foreground\">Provider</div>\n <div>{item.policy.provider}</div>\n <div className=\"text-muted-foreground\">Agent</div>\n <div className=\"font-mono truncate\">{item.state.agentId || '-'}</div>\n <div className=\"text-muted-foreground\">Restarts</div>\n <div>{item.state.restartCount}</div>\n {(item.state.backoffUntil || item.state.lastError) && (\n <>\n <div className=\"text-muted-foreground\">{item.state.backoffUntil ? 'Backoff' : 'Error'}</div>\n <div className=\"truncate\">{item.state.backoffUntil ? fmtTime(item.state.backoffUntil) : item.state.lastError}</div>\n </>\n )}\n </div>\n\n <div className=\"flex flex-wrap gap-1 pt-1 border-t border-border\">\n <Button size=\"icon\" variant=\"outline\" className=\"h-7 w-7\" onClick={() => lifecycle(item.policy.name, 'start')} title=\"Start\"><Play className=\"h-3.5 w-3.5\" /></Button>\n <Button size=\"icon\" variant=\"outline\" className=\"h-7 w-7\" onClick={() => lifecycle(item.policy.name, 'stop')} title=\"Stop\"><Square className=\"h-3.5 w-3.5\" /></Button>\n <Button size=\"icon\" variant=\"outline\" className=\"h-7 w-7\" onClick={() => lifecycle(item.policy.name, 'restart')} title=\"Restart\"><RotateCw className=\"h-3.5 w-3.5\" /></Button>\n <Button size=\"icon\" variant=\"outline\" className=\"h-7 w-7\" onClick={() => setLogsFor(item)} disabled={!item.state.tmuxSession} title=\"Logs\"><FileText className=\"h-3.5 w-3.5\" /></Button>\n <Button size=\"icon\" variant=\"outline\" className=\"h-7 w-7\" onClick={() => terminalSession && setTerminalFor({ item, session: terminalSession })} disabled={!canReadTerminal(item, agent)} title=\"Terminal\"><Terminal className=\"h-3.5 w-3.5\" /></Button>\n <Button size=\"icon\" variant=\"outline\" className=\"h-7 w-7\" onClick={() => openPolicyEdit(item.policy)} title=\"Edit\"><Pencil className=\"h-3.5 w-3.5\" /></Button>\n <Button size=\"icon\" variant=\"outline\" className=\"h-7 w-7\" onClick={() => deletePolicy(item.policy.name)} title=\"Delete\"><Trash2 className=\"h-3.5 w-3.5\" /></Button>\n </div>\n </div>\n )\n })}\n </div>\n\n {logsFor?.state.tmuxSession && (\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold\">{logsFor.policy.name} Logs</h2>\n <Button variant=\"outline\" size=\"sm\" onClick={() => setLogsFor(null)}>Close</Button>\n </div>\n <LogViewer orchestratorId={logsFor.policy.orchestratorId} session={logsFor.state.tmuxSession} />\n </div>\n )}\n\n <TerminalDialog\n open={!!terminalFor}\n onOpenChange={(open) => { if (!open) setTerminalFor(null) }}\n orchestratorId={terminalFor?.item.policy.orchestratorId ?? ''}\n session={terminalFor?.session ?? ''}\n interactive={terminalFor ? canWriteTerminal(terminalFor.item, terminalFor.item.state.agentId ? agentsById[terminalFor.item.state.agentId] : undefined) : false}\n />\n </div>\n )\n}\n"],"mappings":"gWAGA,EAAA,+SAQA,SAAA,EAAA,CAAA,UAAA,kICDA,SAAS,EAAmB,EAA2B,EAAmC,CACxF,IAAM,EAAe,GAAO,MAAM,YAElC,OADI,OAAO,GAAiB,UAAY,EAAa,MAAM,CAAS,EAC7D,EAAK,MAAM,YAGpB,SAAS,EAAgB,EAA2B,EAAwB,CAG1E,OAFK,EAAmB,EAAM,EAAM,CAChC,EAAc,EAAQ,EAAM,sBAAsB,UAAU,MAAM,KAC/D,EAAK,OAAO,WAAa,SAFa,GAK/C,SAAS,EAAiB,EAA2B,EAAwB,CAG3E,OAFK,EAAgB,EAAM,EAAM,CAC7B,EAAc,GAAQ,EAAM,sBAAsB,UAAU,MAAM,OAAS,EAAK,OAAO,WAAa,UACjG,EAAK,OAAO,WAAa,SAFU,GAK5C,SAAgB,GAAoB,CAClC,IAAM,EAAW,EAAe,GAAM,EAAE,gBAAgB,CAClD,EAAa,EAAe,GAAM,EAAE,WAAW,CAC/C,EAAuB,EAAe,GAAM,EAAE,qBAAqB,CACnE,EAAU,EAAe,GAAM,EAAE,QAAQ,CACzC,EAAmB,EAAe,GAAM,EAAE,iBAAiB,CAC3D,EAAiB,EAAe,GAAM,EAAE,eAAe,CACvD,EAAe,EAAe,GAAM,EAAE,aAAa,CACnD,CAAC,EAAS,IAAA,EAAA,EAAA,UAAmD,KAAK,CAClE,CAAC,EAAa,IAAA,EAAA,EAAA,UAAkF,KAAK,EAE3G,EAAA,EAAA,eAAgB,CACd,GAA2B,EAC1B,EAAE,CAAC,CAEN,eAAe,EAAU,EAAc,EAAsC,C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ACrE,EAAA,EAAA,KAAC,EAAD,CAAQ,QAAQ,UAAU,KAAK,KAAK,YAAe,EAAW,KAAK,UAAE,QAAc,CAAA,CAC/E,IACN,EAAA,EAAA,KAAC,EAAD,CAAW,eAAgB,EAAQ,OAAO,eAAgB,QAAS,EAAQ,MAAM,YAAe,CAAA,CAC5F,IAGR,EAAA,EAAA,KAAC,EAAD,CACE,KAAM,CAAC,CAAC,EACR,aAAe,GAAS,CAAO,GAAM,EAAe,KAAK,EACzD,eAAgB,GAAa,KAAK,OAAO,gBAAkB,GAC3D,QAAS,GAAa,SAAW,GACjC,YAAa,EAAc,EAAiB,EAAY,KAAM,EAAY,KAAK,MAAM,QAAU,EAAW,EAAY,KAAK,MAAM,SAAW,IAAA,GAAU,CAAG,GACzJ,CAAA,CACE"}
@@ -1,2 +1,2 @@
1
- import{kn as e}from"./lucide-react-CD8Xl2U3.js";import{b as t,x as n}from"./index-BHRtR4q7.js";import{i as r,n as i,r as a,t as o}from"./lib-ZEIADKGq.js";var s=e(),c={...a,attributes:{...a.attributes,code:[...a.attributes?.code||[],[`className`,/^language-[\w-]+$/]]}};function l(e){return!e||!/^https?:\/\//i.test(e)?{}:{target:`_blank`,rel:`noreferrer`}}function u({content:e,path:a}){return(0,s.jsx)(`div`,{className:`markdown-preview max-w-none overflow-hidden p-4 text-sm leading-6`,children:(0,s.jsx)(r,{remarkPlugins:[o],rehypePlugins:[[i,c]],components:{a({href:e,children:t}){return(0,s.jsx)(`a`,{href:e,...l(e),children:t})},img({src:e,alt:n}){return e?(0,s.jsx)(t,{src:e,alt:n,className:`max-w-full`}):null},code({className:e,children:t,...r}){let i=/language-([\w-]+)/.exec(e||``),o=String(t).replace(/\n$/,``);return i?(0,s.jsx)(n,{content:o,path:`${a}.${i[1]}`,languageHint:i[1],compact:!0}):(0,s.jsx)(`code`,{className:e,...r,children:t})}},children:e})})}export{u as MarkdownPreview};
2
- //# sourceMappingURL=markdown-preview-impl-CnsMjrnu.js.map
1
+ import{kn as e}from"./lucide-react-CD8Xl2U3.js";import{b as t,x as n}from"./index-CvSlyTSI.js";import{i as r,n as i,r as a,t as o}from"./lib-ZEIADKGq.js";var s=e(),c={...a,attributes:{...a.attributes,code:[...a.attributes?.code||[],[`className`,/^language-[\w-]+$/]]}};function l(e){return!e||!/^https?:\/\//i.test(e)?{}:{target:`_blank`,rel:`noreferrer`}}function u({content:e,path:a}){return(0,s.jsx)(`div`,{className:`markdown-preview max-w-none overflow-hidden p-4 text-sm leading-6`,children:(0,s.jsx)(r,{remarkPlugins:[o],rehypePlugins:[[i,c]],components:{a({href:e,children:t}){return(0,s.jsx)(`a`,{href:e,...l(e),children:t})},img({src:e,alt:n}){return e?(0,s.jsx)(t,{src:e,alt:n,className:`max-w-full`}):null},code({className:e,children:t,...r}){let i=/language-([\w-]+)/.exec(e||``),o=String(t).replace(/\n$/,``);return i?(0,s.jsx)(n,{content:o,path:`${a}.${i[1]}`,languageHint:i[1],compact:!0}):(0,s.jsx)(`code`,{className:e,...r,children:t})}},children:e})})}export{u as MarkdownPreview};
2
+ //# sourceMappingURL=markdown-preview-impl-Bbwmbxvn.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-preview-impl-CnsMjrnu.js","names":[],"sources":["../../dashboard/src/components/shared/markdown-preview-impl.tsx"],"sourcesContent":["import ReactMarkdown from 'react-markdown'\nimport rehypeSanitize, { defaultSchema } from 'rehype-sanitize'\nimport remarkGfm from 'remark-gfm'\nimport { CodePreview } from './code-preview'\nimport { ZoomableImage } from './zoomable-image'\n\nconst markdownSchema = {\n ...defaultSchema,\n attributes: {\n ...defaultSchema.attributes,\n code: [\n ...(defaultSchema.attributes?.code || []),\n ['className', /^language-[\\w-]+$/],\n ],\n },\n}\n\nfunction externalLinkProps(href?: string) {\n if (!href || !/^https?:\\/\\//i.test(href)) return {}\n return { target: '_blank', rel: 'noreferrer' }\n}\n\nexport interface MarkdownPreviewProps { content: string; path: string }\n\nexport function MarkdownPreview({ content, path }: MarkdownPreviewProps) {\n return (\n <div className=\"markdown-preview max-w-none overflow-hidden p-4 text-sm leading-6\">\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n rehypePlugins={[[rehypeSanitize, markdownSchema]]}\n components={{\n a({ href, children }) {\n return (\n <a href={href} {...externalLinkProps(href)}>\n {children}\n </a>\n )\n },\n img({ src, alt }) {\n if (!src) return null\n return <ZoomableImage src={src} alt={alt} className=\"max-w-full\" />\n },\n code({ className, children, ...props }) {\n const match = /language-([\\w-]+)/.exec(className || '')\n const code = String(children).replace(/\\n$/, '')\n if (match) {\n return (\n <CodePreview\n content={code}\n path={`${path}.${match[1]}`}\n languageHint={match[1]}\n compact\n />\n )\n }\n return (\n <code className={className} {...props}>\n {children}\n </code>\n )\n },\n }}\n >\n {content}\n </ReactMarkdown>\n </div>\n )\n}\n"],"mappings":"oKAMM,EAAiB,CACrB,GAAG,EACH,WAAY,CACV,GAAG,EAAc,WACjB,KAAM,CACJ,GAAI,EAAc,YAAY,MAAQ,EAAE,CACxC,CAAC,YAAa,oBAAoB,CACnC,CACF,CACF,CAED,SAAS,EAAkB,EAAe,CAExC,MADI,CAAC,GAAQ,CAAC,gBAAgB,KAAK,EAAK,CAAS,EAAE,CAC5C,CAAE,OAAQ,SAAU,IAAK,aAAc,CAKhD,SAAgB,EAAgB,CAAE,UAAS,QAA8B,CACvE,OACE,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,8EACb,EAAA,EAAA,KAAC,EAAD,CACE,cAAe,CAAC,EAAU,CAC1B,cAAe,CAAC,CAAC,EAAgB,EAAe,CAAC,CACjD,WAAY,CACV,EAAE,CAAE,OAAM,YAAY,CACpB,OACE,EAAA,EAAA,KAAC,IAAD,CAAS,OAAM,GAAI,EAAkB,EAAK,CACvC,WACC,CAAA,EAGR,IAAI,CAAE,MAAK,OAAO,CAEhB,OADK,GACE,EAAA,EAAA,KAAC,EAAD,CAAoB,MAAU,MAAK,UAAU,aAAe,CAAA,CADlD,MAGnB,KAAK,CAAE,YAAW,WAAU,GAAG,GAAS,CACtC,IAAM,EAAQ,oBAAoB,KAAK,GAAa,GAAG,CACjD,EAAO,OAAO,EAAS,CAAC,QAAQ,MAAO,GAAG,CAWhD,OAVI,GAEA,EAAA,EAAA,KAAC,EAAD,CACE,QAAS,EACT,KAAM,GAAG,EAAK,GAAG,EAAM,KACvB,aAAc,EAAM,GACpB,QAAA,GACA,CAAA,EAIJ,EAAA,EAAA,KAAC,OAAD,CAAiB,YAAW,GAAI,EAC7B,WACI,CAAA,EAGZ,UAEA,EACa,CAAA,CACZ,CAAA"}
1
+ {"version":3,"file":"markdown-preview-impl-Bbwmbxvn.js","names":[],"sources":["../../dashboard/src/components/shared/markdown-preview-impl.tsx"],"sourcesContent":["import ReactMarkdown from 'react-markdown'\nimport rehypeSanitize, { defaultSchema } from 'rehype-sanitize'\nimport remarkGfm from 'remark-gfm'\nimport { CodePreview } from './code-preview'\nimport { ZoomableImage } from './zoomable-image'\n\nconst markdownSchema = {\n ...defaultSchema,\n attributes: {\n ...defaultSchema.attributes,\n code: [\n ...(defaultSchema.attributes?.code || []),\n ['className', /^language-[\\w-]+$/],\n ],\n },\n}\n\nfunction externalLinkProps(href?: string) {\n if (!href || !/^https?:\\/\\//i.test(href)) return {}\n return { target: '_blank', rel: 'noreferrer' }\n}\n\nexport interface MarkdownPreviewProps { content: string; path: string }\n\nexport function MarkdownPreview({ content, path }: MarkdownPreviewProps) {\n return (\n <div className=\"markdown-preview max-w-none overflow-hidden p-4 text-sm leading-6\">\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n rehypePlugins={[[rehypeSanitize, markdownSchema]]}\n components={{\n a({ href, children }) {\n return (\n <a href={href} {...externalLinkProps(href)}>\n {children}\n </a>\n )\n },\n img({ src, alt }) {\n if (!src) return null\n return <ZoomableImage src={src} alt={alt} className=\"max-w-full\" />\n },\n code({ className, children, ...props }) {\n const match = /language-([\\w-]+)/.exec(className || '')\n const code = String(children).replace(/\\n$/, '')\n if (match) {\n return (\n <CodePreview\n content={code}\n path={`${path}.${match[1]}`}\n languageHint={match[1]}\n compact\n />\n )\n }\n return (\n <code className={className} {...props}>\n {children}\n </code>\n )\n },\n }}\n >\n {content}\n </ReactMarkdown>\n </div>\n )\n}\n"],"mappings":"oKAMM,EAAiB,CACrB,GAAG,EACH,WAAY,CACV,GAAG,EAAc,WACjB,KAAM,CACJ,GAAI,EAAc,YAAY,MAAQ,EAAE,CACxC,CAAC,YAAa,oBAAoB,CACnC,CACF,CACF,CAED,SAAS,EAAkB,EAAe,CAExC,MADI,CAAC,GAAQ,CAAC,gBAAgB,KAAK,EAAK,CAAS,EAAE,CAC5C,CAAE,OAAQ,SAAU,IAAK,aAAc,CAKhD,SAAgB,EAAgB,CAAE,UAAS,QAA8B,CACvE,OACE,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,8EACb,EAAA,EAAA,KAAC,EAAD,CACE,cAAe,CAAC,EAAU,CAC1B,cAAe,CAAC,CAAC,EAAgB,EAAe,CAAC,CACjD,WAAY,CACV,EAAE,CAAE,OAAM,YAAY,CACpB,OACE,EAAA,EAAA,KAAC,IAAD,CAAS,OAAM,GAAI,EAAkB,EAAK,CACvC,WACC,CAAA,EAGR,IAAI,CAAE,MAAK,OAAO,CAEhB,OADK,GACE,EAAA,EAAA,KAAC,EAAD,CAAoB,MAAU,MAAK,UAAU,aAAe,CAAA,CADlD,MAGnB,KAAK,CAAE,YAAW,WAAU,GAAG,GAAS,CACtC,IAAM,EAAQ,oBAAoB,KAAK,GAAa,GAAG,CACjD,EAAO,OAAO,EAAS,CAAC,QAAQ,MAAO,GAAG,CAWhD,OAVI,GAEA,EAAA,EAAA,KAAC,EAAD,CACE,QAAS,EACT,KAAM,GAAG,EAAK,GAAG,EAAM,KACvB,aAAc,EAAM,GACpB,QAAA,GACA,CAAA,EAIJ,EAAA,EAAA,KAAC,OAAD,CAAiB,YAAW,GAAI,EAC7B,WACI,CAAA,EAGZ,UAEA,EACa,CAAA,CACZ,CAAA"}
@@ -1,2 +1,2 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{B as t,D as n,E as r,I as ee,M as i,Rt as te,Vn as a,fn as ne,kn as o,m as re}from"./lucide-react-CD8Xl2U3.js";import{i as ie,t as s}from"./store-DiSzYHj9.js";import{m as c,u as ae,z as l}from"./display-Bebqs1qu.js";import{t as u}from"./badge-t8zAwHW9.js";import{t as d}from"./button-DDA5P2YQ.js";import{t as f}from"./input-BW9UD3FM.js";import{D as oe,r as se,s as ce}from"./index-BHRtR4q7.js";import{i as p,n as m,r as h,t as g}from"./card-CggxP1h9.js";var _=e(a(),1),v=o(),y=[`organization`,`role`,`project`,`task`,`interaction`,`agent`],le=[`private`,`project`,`org`,`public`],ue=[`public`,`normal`,`sensitive`,`secret`],b=[`reported`,`inferred`,`verified`];function x(){return{type:`project`,scope:`default`,title:``,content:``,tags:``,visibility:`project`,sensitivity:`normal`,confidence:`reported`,relevanceScore:`0.7`}}function S(e){return{type:e.type,scope:e.scope,title:e.title,content:e.content,tags:e.tags.join(`, `),visibility:e.visibility,sensitivity:e.sensitivity,confidence:e.confidence,relevanceScore:String(e.relevanceScore)}}function C(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function de(e){let t={limit:100};e.type&&(t.type=e.type),e.scope.trim()&&(t.scope=e.scope.trim()),e.visibility&&(t.visibility=e.visibility);let n=C(e.tags);if(n.length&&(t.tags=n),e.minRelevance.trim()){let n=Number(e.minRelevance);Number.isFinite(n)&&(t.minRelevance=Math.max(0,Math.min(1,n)))}return t}function w(e){return e===`secret`?`bg-red-500/10 text-red-400 border-red-500/30`:e===`sensitive`?`bg-yellow-500/10 text-yellow-400 border-yellow-500/30`:e===`public`?`bg-blue-500/10 text-blue-400 border-blue-500/30`:`bg-zinc-500/10 text-zinc-400 border-zinc-500/30`}function T(e){return e>=.8?`text-emerald-400`:e>=.5?`text-yellow-400`:`text-zinc-400`}function fe(e){return e?Object.entries(e).map(([e,t])=>`${e}=${Array.isArray(t)?t.join(` `):String(t)}`).join(` `):`default`}function pe(e){return e.filter(e=>![`system`,`user`,`channel`].includes(e.kind||``))}function E(){let e=ie(),a=s(e=>e.agents),o=s(e=>e.memories),E=s(e=>e.memoryTotal),O=s(e=>e.memoryStats),k=s(e=>e.memoryBrokerInfo),A=s(e=>e.memoryFilters),j=s(e=>e.selectedMemoryId),he=s(e=>e.memoryLoading),M=s(e=>e.set),ge=s(e=>e.fetchMemories),N=s(e=>e.refreshMemory),P=s(e=>e.saveMemory),F=s(e=>e.deleteMemory),I=s(e=>e.injectMemory),L=o.find(e=>e.id===j),[R,z]=(0,_.useState)(`create`),[B,V]=(0,_.useState)(x),[H,U]=(0,_.useState)(``),[W,_e]=(0,_.useState)(`manual`),[G,ve]=(0,_.useState)(`1600`),[K,ye]=(0,_.useState)(`8`),[q,be]=(0,_.useState)(``),J=(0,_.useMemo)(()=>pe(a),[a]);(0,_.useEffect)(()=>{!H&&J[0]&&U(J[0].id)},[J,H]),(0,_.useEffect)(()=>{L&&R===`edit`&&V(S(L))},[L?.id,R]);let Y=(0,_.useMemo)(()=>{let e=A.search.trim().toLowerCase();return e?o.filter(t=>[t.id,t.type,t.scope,t.title,t.content,...t.tags].some(t=>String(t).toLowerCase().includes(e))):o},[o,A.search]);function X(e){M({memoryFilters:{...A,...e}})}async function Z(){let e=Number(B.relevanceScore),t={title:B.title.trim(),content:B.content.trim(),tags:C(B.tags),visibility:B.visibility,sensitivity:B.sensitivity,confidence:B.confidence,relevanceScore:Number.isFinite(e)?Math.max(0,Math.min(1,e)):.7};if(R===`edit`&&L){await P(t,L.id);return}await P({...t,type:B.type,scope:B.scope.trim()}),z(`create`),V(x())}async function Q(e){if(!H)return;let t=await I({agentId:H,memoryIds:e,query:e?.length?void 0:de(A),reason:W.trim()||`manual`,budget:{maxTokens:Math.max(200,Number(G)||1600),maxMemories:Math.max(1,Number(K)||8),priorityCutoff:3}});t?.command?.id&&be(t.command.id)}function xe(){z(`create`),V(x())}function Se(){L&&(z(`edit`),V(S(L)))}let Ce=B.title.trim()&&B.content.trim()&&(R===`edit`||B.scope.trim()),$=fe(k?.config);return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(ne,{className:`w-5 h-5 text-muted-foreground`}),(0,v.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Memory`}),(0,v.jsx)(u,{variant:`secondary`,children:O?.total??E}),k&&(0,v.jsx)(u,{className:k.external?`bg-blue-500/15 text-blue-400 border-blue-500/30`:`bg-emerald-500/15 text-emerald-400 border-emerald-500/30`,children:k.type})]}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,className:`gap-1.5`,onClick:()=>N(),children:[(0,v.jsx)(i,{className:`w-3.5 h-3.5 ${he?`animate-spin`:``}`}),`Refresh`]})]}),(0,v.jsxs)(`div`,{className:`grid gap-3 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,v.jsxs)(g,{children:[(0,v.jsx)(h,{className:`py-3 px-4`,children:(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,v.jsxs)(p,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,v.jsx)(te,{className:`w-4 h-4 text-muted-foreground`}),`Broker`]}),k?.capabilities&&(0,v.jsx)(`div`,{className:`flex flex-wrap gap-1 justify-end`,children:Object.entries(k.capabilities).filter(([,e])=>!!e).map(([e])=>(0,v.jsx)(u,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:e},e))})]})}),(0,v.jsxs)(m,{className:`px-4 pb-4 space-y-3`,children:[(0,v.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-2`,children:[(0,v.jsx)(D,{label:`total`,value:O?.total??E}),(0,v.jsx)(D,{label:`project`,value:O?.byType?.project??0}),(0,v.jsx)(D,{label:`task`,value:O?.byType?.task??0}),(0,v.jsx)(D,{label:`agent`,value:O?.byType?.agent??0}),(0,v.jsx)(D,{label:`sensitive`,value:(O?.bySensitivity?.sensitive??0)+(O?.bySensitivity?.secret??0)})]}),(0,v.jsx)(`div`,{className:`font-mono text-xs text-muted-foreground truncate`,title:$,children:$})]})]}),(0,v.jsxs)(g,{children:[(0,v.jsx)(h,{className:`py-3 px-4`,children:(0,v.jsx)(p,{className:`text-sm font-medium`,children:`Inject`})}),(0,v.jsxs)(m,{className:`px-4 pb-4 space-y-2`,children:[(0,v.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:[(0,v.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:H,onChange:e=>U(e.target.value),children:[(0,v.jsx)(`option`,{value:``,children:`Agent`}),J.map(e=>(0,v.jsx)(`option`,{value:e.id,children:ae(e)},e.id))]}),(0,v.jsx)(f,{value:W,onChange:e=>_e(e.target.value),placeholder:`reason`}),(0,v.jsx)(f,{value:G,onChange:e=>ve(e.target.value),inputMode:`numeric`,placeholder:`tokens`}),(0,v.jsx)(f,{value:K,onChange:e=>ye(e.target.value),inputMode:`numeric`,placeholder:`memories`})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,v.jsxs)(d,{size:`sm`,className:`gap-1.5`,disabled:!H||!L,onClick:()=>L&&Q([L.id]),children:[(0,v.jsx)(r,{className:`w-3.5 h-3.5`}),`Selected`]}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,className:`gap-1.5`,disabled:!H,onClick:()=>Q(),children:[(0,v.jsx)(n,{className:`w-3.5 h-3.5`}),`Filtered`]}),q&&(0,v.jsx)(u,{variant:`outline`,className:`font-mono text-[10px]`,children:q})]})]})]})]}),(0,v.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,v.jsxs)(`div`,{className:`space-y-3`,children:[(0,v.jsx)(g,{children:(0,v.jsx)(m,{className:`p-3`,children:(0,v.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-6 gap-2`,children:[(0,v.jsx)(f,{className:`lg:col-span-2`,value:A.search,onChange:e=>X({search:e.target.value}),placeholder:`Search visible memories`}),(0,v.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:A.type,onChange:e=>X({type:e.target.value}),children:[(0,v.jsx)(`option`,{value:``,children:`All types`}),y.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsx)(f,{value:A.scope,onChange:e=>X({scope:e.target.value}),placeholder:`scope`}),(0,v.jsx)(f,{value:A.tags,onChange:e=>X({tags:e.target.value}),placeholder:`tags`}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsx)(f,{value:A.minRelevance,onChange:e=>X({minRelevance:e.target.value}),placeholder:`score`}),(0,v.jsx)(d,{size:`sm`,variant:`outline`,className:`h-8 px-2`,onClick:()=>ge(),children:(0,v.jsx)(n,{className:`w-4 h-4`})})]})]})})}),(0,v.jsx)(ce,{className:`h-[calc(100dvh-24rem)] min-h-[360px]`,children:(0,v.jsxs)(`div`,{className:`space-y-2 pr-2`,children:[Y.length===0&&(0,v.jsx)(`div`,{className:`text-center text-sm text-muted-foreground py-16`,children:`No memories`}),Y.map(t=>(0,v.jsx)(me,{memory:t,selected:t.id===j,now:e,onSelect:()=>M({selectedMemoryId:t.id})},t.id))]})})]}),(0,v.jsxs)(g,{children:[(0,v.jsx)(h,{className:`py-3 px-4`,children:(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,v.jsx)(p,{className:`text-sm font-medium`,children:R===`edit`?`Edit Memory`:`New Memory`}),(0,v.jsxs)(`div`,{className:`flex gap-1`,children:[(0,v.jsx)(d,{size:`sm`,variant:`ghost`,className:`h-7 px-2`,onClick:xe,title:`New memory`,children:(0,v.jsx)(ee,{className:`w-3.5 h-3.5`})}),(0,v.jsx)(d,{size:`sm`,variant:`ghost`,className:`h-7 px-2`,onClick:Se,disabled:!L,title:`Edit selected`,children:(0,v.jsx)(t,{className:`w-3.5 h-3.5`})}),(0,v.jsx)(d,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-red-400 hover:text-red-300`,disabled:!L,onClick:()=>L&&F(L.id),title:`Delete selected`,children:(0,v.jsx)(re,{className:`w-3.5 h-3.5`})})]})]})}),(0,v.jsxs)(m,{className:`px-4 pb-4 space-y-3`,children:[L&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,v.jsx)(u,{variant:`secondary`,children:L.type}),(0,v.jsx)(u,{variant:`outline`,children:L.scope}),(0,v.jsx)(u,{className:w(L.sensitivity),children:L.sensitivity}),(0,v.jsx)(u,{variant:`outline`,className:T(L.relevanceScore),children:L.relevanceScore.toFixed(2)})]}),(0,v.jsxs)(`div`,{className:`text-xs text-muted-foreground`,title:c(L.updatedAt),children:[`updated `,l(e,L.updatedAt)]}),(0,v.jsx)(`p`,{className:`text-sm font-medium`,children:L.title}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground whitespace-pre-wrap max-h-24 overflow-auto`,children:L.content})]}),(0,v.jsx)(oe,{})]}),(0,v.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,v.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,disabled:R===`edit`,value:B.type,onChange:e=>V({...B,type:e.target.value}),children:y.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsx)(f,{disabled:R===`edit`,value:B.scope,onChange:e=>V({...B,scope:e.target.value}),placeholder:`scope`}),(0,v.jsx)(f,{className:`col-span-2`,value:B.title,onChange:e=>V({...B,title:e.target.value}),placeholder:`title`}),(0,v.jsx)(se,{className:`col-span-2 min-h-32`,value:B.content,onChange:e=>V({...B,content:e.target.value}),placeholder:`content`}),(0,v.jsx)(f,{className:`col-span-2`,value:B.tags,onChange:e=>V({...B,tags:e.target.value}),placeholder:`tags`}),(0,v.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:B.visibility,onChange:e=>V({...B,visibility:e.target.value}),children:le.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:B.sensitivity,onChange:e=>V({...B,sensitivity:e.target.value}),children:ue.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:B.confidence,onChange:e=>V({...B,confidence:e.target.value}),children:b.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsx)(f,{value:B.relevanceScore,onChange:e=>V({...B,relevanceScore:e.target.value}),inputMode:`decimal`,placeholder:`score`})]}),(0,v.jsx)(d,{size:`sm`,className:`w-full`,disabled:!Ce,onClick:Z,children:R===`edit`?`Save memory`:`Create memory`})]})]})]})]})}function D({label:e,value:t}){return(0,v.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/20 px-3 py-2`,children:[(0,v.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:t}),(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e})]})}function me({memory:e,selected:t,now:n,onSelect:r}){return(0,v.jsx)(`button`,{onClick:r,className:`w-full text-left rounded-md border p-3 transition-colors ${t?`border-primary bg-primary/5`:`border-border bg-card hover:border-zinc-600`}`,children:(0,v.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,v.jsx)(u,{variant:`secondary`,className:`text-[10px]`,children:e.type}),(0,v.jsx)(u,{variant:`outline`,className:`text-[10px] font-mono`,children:e.scope}),(0,v.jsx)(u,{className:`text-[10px] ${w(e.sensitivity)}`,children:e.sensitivity})]}),(0,v.jsx)(`div`,{className:`font-medium text-sm mt-2 truncate`,children:e.title}),(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground line-clamp-2 mt-1`,children:e.content}),e.tags.length>0&&(0,v.jsx)(`div`,{className:`flex gap-1 flex-wrap mt-2`,children:e.tags.slice(0,8).map(e=>(0,v.jsxs)(u,{variant:`outline`,className:`text-[10px] text-zinc-400`,children:[`#`,e]},e))})]}),(0,v.jsxs)(`div`,{className:`text-right shrink-0 space-y-1`,children:[(0,v.jsx)(`div`,{className:`text-sm font-semibold tabular-nums ${T(e.relevanceScore)}`,children:e.relevanceScore.toFixed(2)}),(0,v.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,title:c(e.updatedAt),children:l(n,e.updatedAt)}),e.accessCount>0&&(0,v.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[e.accessCount,` hits`]})]})]})})}export{E as MemoryView};
2
- //# sourceMappingURL=memory-D3-K5eJS.js.map
1
+ import{r as e}from"./chunk-CilyBKbf.js";import{B as t,D as n,E as r,I as ee,M as i,Rt as te,Vn as a,fn as ne,kn as o,m as re}from"./lucide-react-CD8Xl2U3.js";import{i as ie,t as s}from"./store-CICRhg1m.js";import{m as c,u as ae,z as l}from"./display-Bebqs1qu.js";import{t as u}from"./badge-t8zAwHW9.js";import{t as d}from"./button-DDA5P2YQ.js";import{t as f}from"./input-BW9UD3FM.js";import{D as oe,r as se,s as ce}from"./index-CvSlyTSI.js";import{i as p,n as m,r as h,t as g}from"./card-CggxP1h9.js";var _=e(a(),1),v=o(),y=[`organization`,`role`,`project`,`task`,`interaction`,`agent`],le=[`private`,`project`,`org`,`public`],ue=[`public`,`normal`,`sensitive`,`secret`],b=[`reported`,`inferred`,`verified`];function x(){return{type:`project`,scope:`default`,title:``,content:``,tags:``,visibility:`project`,sensitivity:`normal`,confidence:`reported`,relevanceScore:`0.7`}}function S(e){return{type:e.type,scope:e.scope,title:e.title,content:e.content,tags:e.tags.join(`, `),visibility:e.visibility,sensitivity:e.sensitivity,confidence:e.confidence,relevanceScore:String(e.relevanceScore)}}function C(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function de(e){let t={limit:100};e.type&&(t.type=e.type),e.scope.trim()&&(t.scope=e.scope.trim()),e.visibility&&(t.visibility=e.visibility);let n=C(e.tags);if(n.length&&(t.tags=n),e.minRelevance.trim()){let n=Number(e.minRelevance);Number.isFinite(n)&&(t.minRelevance=Math.max(0,Math.min(1,n)))}return t}function w(e){return e===`secret`?`bg-red-500/10 text-red-400 border-red-500/30`:e===`sensitive`?`bg-yellow-500/10 text-yellow-400 border-yellow-500/30`:e===`public`?`bg-blue-500/10 text-blue-400 border-blue-500/30`:`bg-zinc-500/10 text-zinc-400 border-zinc-500/30`}function T(e){return e>=.8?`text-emerald-400`:e>=.5?`text-yellow-400`:`text-zinc-400`}function fe(e){return e?Object.entries(e).map(([e,t])=>`${e}=${Array.isArray(t)?t.join(` `):String(t)}`).join(` `):`default`}function pe(e){return e.filter(e=>![`system`,`user`,`channel`].includes(e.kind||``))}function E(){let e=ie(),a=s(e=>e.agents),o=s(e=>e.memories),E=s(e=>e.memoryTotal),O=s(e=>e.memoryStats),k=s(e=>e.memoryBrokerInfo),A=s(e=>e.memoryFilters),j=s(e=>e.selectedMemoryId),he=s(e=>e.memoryLoading),M=s(e=>e.set),ge=s(e=>e.fetchMemories),N=s(e=>e.refreshMemory),P=s(e=>e.saveMemory),F=s(e=>e.deleteMemory),I=s(e=>e.injectMemory),L=o.find(e=>e.id===j),[R,z]=(0,_.useState)(`create`),[B,V]=(0,_.useState)(x),[H,U]=(0,_.useState)(``),[W,_e]=(0,_.useState)(`manual`),[G,ve]=(0,_.useState)(`1600`),[K,ye]=(0,_.useState)(`8`),[q,be]=(0,_.useState)(``),J=(0,_.useMemo)(()=>pe(a),[a]);(0,_.useEffect)(()=>{!H&&J[0]&&U(J[0].id)},[J,H]),(0,_.useEffect)(()=>{L&&R===`edit`&&V(S(L))},[L?.id,R]);let Y=(0,_.useMemo)(()=>{let e=A.search.trim().toLowerCase();return e?o.filter(t=>[t.id,t.type,t.scope,t.title,t.content,...t.tags].some(t=>String(t).toLowerCase().includes(e))):o},[o,A.search]);function X(e){M({memoryFilters:{...A,...e}})}async function Z(){let e=Number(B.relevanceScore),t={title:B.title.trim(),content:B.content.trim(),tags:C(B.tags),visibility:B.visibility,sensitivity:B.sensitivity,confidence:B.confidence,relevanceScore:Number.isFinite(e)?Math.max(0,Math.min(1,e)):.7};if(R===`edit`&&L){await P(t,L.id);return}await P({...t,type:B.type,scope:B.scope.trim()}),z(`create`),V(x())}async function Q(e){if(!H)return;let t=await I({agentId:H,memoryIds:e,query:e?.length?void 0:de(A),reason:W.trim()||`manual`,budget:{maxTokens:Math.max(200,Number(G)||1600),maxMemories:Math.max(1,Number(K)||8),priorityCutoff:3}});t?.command?.id&&be(t.command.id)}function xe(){z(`create`),V(x())}function Se(){L&&(z(`edit`),V(S(L)))}let Ce=B.title.trim()&&B.content.trim()&&(R===`edit`||B.scope.trim()),$=fe(k?.config);return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(ne,{className:`w-5 h-5 text-muted-foreground`}),(0,v.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Memory`}),(0,v.jsx)(u,{variant:`secondary`,children:O?.total??E}),k&&(0,v.jsx)(u,{className:k.external?`bg-blue-500/15 text-blue-400 border-blue-500/30`:`bg-emerald-500/15 text-emerald-400 border-emerald-500/30`,children:k.type})]}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,className:`gap-1.5`,onClick:()=>N(),children:[(0,v.jsx)(i,{className:`w-3.5 h-3.5 ${he?`animate-spin`:``}`}),`Refresh`]})]}),(0,v.jsxs)(`div`,{className:`grid gap-3 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,v.jsxs)(g,{children:[(0,v.jsx)(h,{className:`py-3 px-4`,children:(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,v.jsxs)(p,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,v.jsx)(te,{className:`w-4 h-4 text-muted-foreground`}),`Broker`]}),k?.capabilities&&(0,v.jsx)(`div`,{className:`flex flex-wrap gap-1 justify-end`,children:Object.entries(k.capabilities).filter(([,e])=>!!e).map(([e])=>(0,v.jsx)(u,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:e},e))})]})}),(0,v.jsxs)(m,{className:`px-4 pb-4 space-y-3`,children:[(0,v.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-2`,children:[(0,v.jsx)(D,{label:`total`,value:O?.total??E}),(0,v.jsx)(D,{label:`project`,value:O?.byType?.project??0}),(0,v.jsx)(D,{label:`task`,value:O?.byType?.task??0}),(0,v.jsx)(D,{label:`agent`,value:O?.byType?.agent??0}),(0,v.jsx)(D,{label:`sensitive`,value:(O?.bySensitivity?.sensitive??0)+(O?.bySensitivity?.secret??0)})]}),(0,v.jsx)(`div`,{className:`font-mono text-xs text-muted-foreground truncate`,title:$,children:$})]})]}),(0,v.jsxs)(g,{children:[(0,v.jsx)(h,{className:`py-3 px-4`,children:(0,v.jsx)(p,{className:`text-sm font-medium`,children:`Inject`})}),(0,v.jsxs)(m,{className:`px-4 pb-4 space-y-2`,children:[(0,v.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:[(0,v.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:H,onChange:e=>U(e.target.value),children:[(0,v.jsx)(`option`,{value:``,children:`Agent`}),J.map(e=>(0,v.jsx)(`option`,{value:e.id,children:ae(e)},e.id))]}),(0,v.jsx)(f,{value:W,onChange:e=>_e(e.target.value),placeholder:`reason`}),(0,v.jsx)(f,{value:G,onChange:e=>ve(e.target.value),inputMode:`numeric`,placeholder:`tokens`}),(0,v.jsx)(f,{value:K,onChange:e=>ye(e.target.value),inputMode:`numeric`,placeholder:`memories`})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,v.jsxs)(d,{size:`sm`,className:`gap-1.5`,disabled:!H||!L,onClick:()=>L&&Q([L.id]),children:[(0,v.jsx)(r,{className:`w-3.5 h-3.5`}),`Selected`]}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,className:`gap-1.5`,disabled:!H,onClick:()=>Q(),children:[(0,v.jsx)(n,{className:`w-3.5 h-3.5`}),`Filtered`]}),q&&(0,v.jsx)(u,{variant:`outline`,className:`font-mono text-[10px]`,children:q})]})]})]})]}),(0,v.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,v.jsxs)(`div`,{className:`space-y-3`,children:[(0,v.jsx)(g,{children:(0,v.jsx)(m,{className:`p-3`,children:(0,v.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-6 gap-2`,children:[(0,v.jsx)(f,{className:`lg:col-span-2`,value:A.search,onChange:e=>X({search:e.target.value}),placeholder:`Search visible memories`}),(0,v.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:A.type,onChange:e=>X({type:e.target.value}),children:[(0,v.jsx)(`option`,{value:``,children:`All types`}),y.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsx)(f,{value:A.scope,onChange:e=>X({scope:e.target.value}),placeholder:`scope`}),(0,v.jsx)(f,{value:A.tags,onChange:e=>X({tags:e.target.value}),placeholder:`tags`}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsx)(f,{value:A.minRelevance,onChange:e=>X({minRelevance:e.target.value}),placeholder:`score`}),(0,v.jsx)(d,{size:`sm`,variant:`outline`,className:`h-8 px-2`,onClick:()=>ge(),children:(0,v.jsx)(n,{className:`w-4 h-4`})})]})]})})}),(0,v.jsx)(ce,{className:`h-[calc(100dvh-24rem)] min-h-[360px]`,children:(0,v.jsxs)(`div`,{className:`space-y-2 pr-2`,children:[Y.length===0&&(0,v.jsx)(`div`,{className:`text-center text-sm text-muted-foreground py-16`,children:`No memories`}),Y.map(t=>(0,v.jsx)(me,{memory:t,selected:t.id===j,now:e,onSelect:()=>M({selectedMemoryId:t.id})},t.id))]})})]}),(0,v.jsxs)(g,{children:[(0,v.jsx)(h,{className:`py-3 px-4`,children:(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,v.jsx)(p,{className:`text-sm font-medium`,children:R===`edit`?`Edit Memory`:`New Memory`}),(0,v.jsxs)(`div`,{className:`flex gap-1`,children:[(0,v.jsx)(d,{size:`sm`,variant:`ghost`,className:`h-7 px-2`,onClick:xe,title:`New memory`,children:(0,v.jsx)(ee,{className:`w-3.5 h-3.5`})}),(0,v.jsx)(d,{size:`sm`,variant:`ghost`,className:`h-7 px-2`,onClick:Se,disabled:!L,title:`Edit selected`,children:(0,v.jsx)(t,{className:`w-3.5 h-3.5`})}),(0,v.jsx)(d,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-red-400 hover:text-red-300`,disabled:!L,onClick:()=>L&&F(L.id),title:`Delete selected`,children:(0,v.jsx)(re,{className:`w-3.5 h-3.5`})})]})]})}),(0,v.jsxs)(m,{className:`px-4 pb-4 space-y-3`,children:[L&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,v.jsx)(u,{variant:`secondary`,children:L.type}),(0,v.jsx)(u,{variant:`outline`,children:L.scope}),(0,v.jsx)(u,{className:w(L.sensitivity),children:L.sensitivity}),(0,v.jsx)(u,{variant:`outline`,className:T(L.relevanceScore),children:L.relevanceScore.toFixed(2)})]}),(0,v.jsxs)(`div`,{className:`text-xs text-muted-foreground`,title:c(L.updatedAt),children:[`updated `,l(e,L.updatedAt)]}),(0,v.jsx)(`p`,{className:`text-sm font-medium`,children:L.title}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground whitespace-pre-wrap max-h-24 overflow-auto`,children:L.content})]}),(0,v.jsx)(oe,{})]}),(0,v.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,v.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,disabled:R===`edit`,value:B.type,onChange:e=>V({...B,type:e.target.value}),children:y.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsx)(f,{disabled:R===`edit`,value:B.scope,onChange:e=>V({...B,scope:e.target.value}),placeholder:`scope`}),(0,v.jsx)(f,{className:`col-span-2`,value:B.title,onChange:e=>V({...B,title:e.target.value}),placeholder:`title`}),(0,v.jsx)(se,{className:`col-span-2 min-h-32`,value:B.content,onChange:e=>V({...B,content:e.target.value}),placeholder:`content`}),(0,v.jsx)(f,{className:`col-span-2`,value:B.tags,onChange:e=>V({...B,tags:e.target.value}),placeholder:`tags`}),(0,v.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:B.visibility,onChange:e=>V({...B,visibility:e.target.value}),children:le.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:B.sensitivity,onChange:e=>V({...B,sensitivity:e.target.value}),children:ue.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:B.confidence,onChange:e=>V({...B,confidence:e.target.value}),children:b.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsx)(f,{value:B.relevanceScore,onChange:e=>V({...B,relevanceScore:e.target.value}),inputMode:`decimal`,placeholder:`score`})]}),(0,v.jsx)(d,{size:`sm`,className:`w-full`,disabled:!Ce,onClick:Z,children:R===`edit`?`Save memory`:`Create memory`})]})]})]})]})}function D({label:e,value:t}){return(0,v.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/20 px-3 py-2`,children:[(0,v.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:t}),(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e})]})}function me({memory:e,selected:t,now:n,onSelect:r}){return(0,v.jsx)(`button`,{onClick:r,className:`w-full text-left rounded-md border p-3 transition-colors ${t?`border-primary bg-primary/5`:`border-border bg-card hover:border-zinc-600`}`,children:(0,v.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,v.jsx)(u,{variant:`secondary`,className:`text-[10px]`,children:e.type}),(0,v.jsx)(u,{variant:`outline`,className:`text-[10px] font-mono`,children:e.scope}),(0,v.jsx)(u,{className:`text-[10px] ${w(e.sensitivity)}`,children:e.sensitivity})]}),(0,v.jsx)(`div`,{className:`font-medium text-sm mt-2 truncate`,children:e.title}),(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground line-clamp-2 mt-1`,children:e.content}),e.tags.length>0&&(0,v.jsx)(`div`,{className:`flex gap-1 flex-wrap mt-2`,children:e.tags.slice(0,8).map(e=>(0,v.jsxs)(u,{variant:`outline`,className:`text-[10px] text-zinc-400`,children:[`#`,e]},e))})]}),(0,v.jsxs)(`div`,{className:`text-right shrink-0 space-y-1`,children:[(0,v.jsx)(`div`,{className:`text-sm font-semibold tabular-nums ${T(e.relevanceScore)}`,children:e.relevanceScore.toFixed(2)}),(0,v.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,title:c(e.updatedAt),children:l(n,e.updatedAt)}),e.accessCount>0&&(0,v.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[e.accessCount,` hits`]})]})]})})}export{E as MemoryView};
2
+ //# sourceMappingURL=memory-BQAC3YmR.js.map