titan-agent 6.1.0 → 6.2.0

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 (170) hide show
  1. package/README.md +25 -5
  2. package/dist/config/schema.js +23 -0
  3. package/dist/config/schema.js.map +1 -1
  4. package/dist/eval/harness.js +2 -1
  5. package/dist/eval/harness.js.map +1 -1
  6. package/dist/gateway/routes/telephony.js +497 -0
  7. package/dist/gateway/routes/telephony.js.map +1 -0
  8. package/dist/gateway/routes/tests.js +3 -1
  9. package/dist/gateway/routes/tests.js.map +1 -1
  10. package/dist/gateway/server.js +6 -0
  11. package/dist/gateway/server.js.map +1 -1
  12. package/dist/skills/builtin/phone_call.js +66 -0
  13. package/dist/skills/builtin/phone_call.js.map +1 -0
  14. package/dist/skills/registry.js +2 -0
  15. package/dist/skills/registry.js.map +1 -1
  16. package/dist/telephony/dograhClient.js +175 -0
  17. package/dist/telephony/dograhClient.js.map +1 -0
  18. package/dist/telephony/optOutStore.js +71 -0
  19. package/dist/telephony/optOutStore.js.map +1 -0
  20. package/dist/telephony/phonePolicy.js +120 -0
  21. package/dist/telephony/phonePolicy.js.map +1 -0
  22. package/dist/utils/constants.js +1 -1
  23. package/dist/utils/constants.js.map +1 -1
  24. package/dist/utils/safety.js +12 -1
  25. package/dist/utils/safety.js.map +1 -1
  26. package/package.json +1 -1
  27. package/ui/dist/assets/AuditPanel-DuxwAH5U.js +1 -0
  28. package/ui/dist/assets/{AutonomyPanel-zsQ6kIP7.js → AutonomyPanel-VWBgurnv.js} +1 -1
  29. package/ui/dist/assets/{AutopilotPanel-NlxdRleV.js → AutopilotPanel-Dw8MYOtj.js} +1 -1
  30. package/ui/dist/assets/{AutoresearchPanel-CHeEcUmN.js → AutoresearchPanel-CpEX0Zub.js} +1 -1
  31. package/ui/dist/assets/{BackupPanel-C7RHr9Gu.js → BackupPanel-n41_6i6x.js} +1 -1
  32. package/ui/dist/assets/{BrowserPanel-Cxu9bCLW.js → BrowserPanel-DEBTIt6h.js} +1 -1
  33. package/ui/dist/assets/{CPActivity-B0QSTuSq.js → CPActivity-em82PTiQ.js} +1 -1
  34. package/ui/dist/assets/{CPAgentDetail-BUqGIkaM.js → CPAgentDetail-Bd8lKqcL.js} +1 -1
  35. package/ui/dist/assets/{CPAgents-DO0RVLLA.js → CPAgents-GRBrDd6c.js} +1 -1
  36. package/ui/dist/assets/{CPApprovals-DRceMgME.js → CPApprovals-DdLaCgJZ.js} +1 -1
  37. package/ui/dist/assets/{CPCosts-D9l4mkiW.js → CPCosts-Cm8Hv9fv.js} +1 -1
  38. package/ui/dist/assets/{CPDashboard-DaCCdMjs.js → CPDashboard-Dm9vUKLu.js} +1 -1
  39. package/ui/dist/assets/{CPFiles-DTphWHsR.js → CPFiles-DxMn1x2m.js} +1 -1
  40. package/ui/dist/assets/{CPGoals-DeJBRV3M.js → CPGoals-Wr1tCn6y.js} +1 -1
  41. package/ui/dist/assets/{CPInbox-DsT5O636.js → CPInbox-CGYpK1rG.js} +2 -2
  42. package/ui/dist/assets/{CPIssueDetail-D8pG5Tnq.js → CPIssueDetail-dTU59sgQ.js} +1 -1
  43. package/ui/dist/assets/{CPIssues-oeffaZSb.js → CPIssues-wgjI2eqS.js} +1 -1
  44. package/ui/dist/assets/CPLayout-CBtGEYSs.js +2 -0
  45. package/ui/dist/assets/{CPOrg-CesGXL8r.js → CPOrg-eT6LNmyy.js} +1 -1
  46. package/ui/dist/assets/{CPRuns-CfYgZUGv.js → CPRuns-B3sdo5g2.js} +1 -1
  47. package/ui/dist/assets/{CPSocial-CK0qGSa0.js → CPSocial-B99Mfee_.js} +3 -3
  48. package/ui/dist/assets/{CPVoice-iIkC-KnQ.js → CPVoice-D4J6yFWu.js} +1 -1
  49. package/ui/dist/assets/{ChannelsPanel-DTS5SXlC.js → ChannelsPanel--lhZqYLD.js} +1 -1
  50. package/ui/dist/assets/{CheckpointsPanel-c5dwo2eW.js → CheckpointsPanel-DaOIUcEi.js} +1 -1
  51. package/ui/dist/assets/{CommandPostHub-BsdfjoBN.js → CommandPostHub-Pq9lQMW5.js} +3 -3
  52. package/ui/dist/assets/{CronPanel-BkeP_mIS.js → CronPanel-CywjWM7O.js} +1 -1
  53. package/ui/dist/assets/{DataTable-Gajb24Ni.js → DataTable-Bt0cxehB.js} +1 -1
  54. package/ui/dist/assets/{DreamPanel-CGrozxjo.js → DreamPanel-Ct7MuLzD.js} +1 -1
  55. package/ui/dist/assets/{EmptyState-B3lWjJU-.js → EmptyState-iLOrbdU7.js} +1 -1
  56. package/ui/dist/assets/{EvalHarnessPanel-DQ4O9caO.js → EvalHarnessPanel-7KKDzeXw.js} +2 -2
  57. package/ui/dist/assets/{EvalPanel-BOUHXllR.js → EvalPanel-70LzkLDO.js} +1 -1
  58. package/ui/dist/assets/{FileViewer-00_4kM0_.js → FileViewer-h6A7YYTm.js} +1 -1
  59. package/ui/dist/assets/{FilesPanel-DISpHxEJ.js → FilesPanel-l8qC6eLD.js} +1 -1
  60. package/ui/dist/assets/{FleetPanel-Vz7_88zK.js → FleetPanel-Z3ResHIb.js} +1 -1
  61. package/ui/dist/assets/{HomelabPanel-CCqGyERB.js → HomelabPanel-9QhrXzo1.js} +1 -1
  62. package/ui/dist/assets/InfraView-G1q6vF0Q.js +2 -0
  63. package/ui/dist/assets/{InlineEditableField-BGjdtpGQ.js → InlineEditableField-DsVfGRH2.js} +1 -1
  64. package/ui/dist/assets/{Input-CzDjGc5Y.js → Input-Bzh0-cXU.js} +1 -1
  65. package/ui/dist/assets/{IntegrationsPanel-BOe9ybbQ.js → IntegrationsPanel-DBOdLYJ8.js} +1 -1
  66. package/ui/dist/assets/IntelligenceView-J8Nbh4zs.js +2 -0
  67. package/ui/dist/assets/{LearningPanel-5zb6yYZW.js → LearningPanel-CiSLVxUX.js} +1 -1
  68. package/ui/dist/assets/{LogsPanel-C_1bqy9b.js → LogsPanel-CPAAItsq.js} +1 -1
  69. package/ui/dist/assets/{McpPanel-CY7_7erZ.js → McpPanel-MYWE2Zqs.js} +1 -1
  70. package/ui/dist/assets/{MemoryGraphPanel-DsF8er1w.js → MemoryGraphPanel-BFr51D_1.js} +1 -1
  71. package/ui/dist/assets/{MemoryWikiPanel-D4KPpOX7.js → MemoryWikiPanel-BA7GUxhg.js} +1 -1
  72. package/ui/dist/assets/{MeshPanel-C_cNMUcI.js → MeshPanel-5BDbwBVR.js} +1 -1
  73. package/ui/dist/assets/{MissionCanvas-BMw5bJcw.js → MissionCanvas-CrDZIQX6.js} +1 -1
  74. package/ui/dist/assets/{MissionChat-CrgPUYhU.js → MissionChat-BDTWMQjj.js} +1 -1
  75. package/ui/dist/assets/{MissionLibrary-ASkOLTWA.js → MissionLibrary-DEPH2eEu.js} +1 -1
  76. package/ui/dist/assets/{MissionStart-DDoZMkie.js → MissionStart-COLFZLHB.js} +1 -1
  77. package/ui/dist/assets/{Modal-DTzLKnUQ.js → Modal-nvni-LGR.js} +1 -1
  78. package/ui/dist/assets/{NvidiaPanel-dtkQr6gS.js → NvidiaPanel-BCgVrdWt.js} +1 -1
  79. package/ui/dist/assets/{OrganismPanel-DLfHCoYh.js → OrganismPanel-Cab4MV9i.js} +1 -1
  80. package/ui/dist/assets/{OverviewPanel-COcMqu-y.js → OverviewPanel-isNUxBki.js} +1 -1
  81. package/ui/dist/assets/{PageHeader-BXEGoqDX.js → PageHeader-BJ1jHtOy.js} +1 -1
  82. package/ui/dist/assets/{PersonaProfilesPanel-BKWsHE1j.js → PersonaProfilesPanel-BGiDuDPj.js} +1 -1
  83. package/ui/dist/assets/{PersonasPanel-tsXvN_8B.js → PersonasPanel-4-USk8fm.js} +1 -1
  84. package/ui/dist/assets/PhoneDeskPanel-CUz5YVUY.js +11 -0
  85. package/ui/dist/assets/{RecipesPanel-B8GOxD4_.js → RecipesPanel-DJd6Otdy.js} +1 -1
  86. package/ui/dist/assets/{SecurityPanel-CqhRhXZ8.js → SecurityPanel-CKqTnhNY.js} +1 -1
  87. package/ui/dist/assets/{SelfImprovePanel-Di0XhdJJ.js → SelfImprovePanel-BiCjKpTM.js} +1 -1
  88. package/ui/dist/assets/{SelfProposalsPanel-CbgdHeQY.js → SelfProposalsPanel-BQCwEHdF.js} +1 -1
  89. package/ui/dist/assets/{SessionsPanel-DBdDx51G.js → SessionsPanel-MTMSODP7.js} +1 -1
  90. package/ui/dist/assets/{SessionsTab-C8cEt83E.js → SessionsTab-CEFFZWMK.js} +1 -1
  91. package/ui/dist/assets/{SettingsPanel-BAenxGtq.js → SettingsPanel-CniESkQQ.js} +1 -1
  92. package/ui/dist/assets/SettingsView-2AwXqlvc.js +2 -0
  93. package/ui/dist/assets/{SkeletonLoader-DGQ0Q7vy.js → SkeletonLoader-IpWkLmoy.js} +1 -1
  94. package/ui/dist/assets/{SkillsPanel-r91e0ype.js → SkillsPanel-CCP-gCR4.js} +1 -1
  95. package/ui/dist/assets/{SomaView-CGoJDjEX.js → SomaView-BK_thK9H.js} +1 -1
  96. package/ui/dist/assets/{StatCard-D0Q7T1EQ.js → StatCard-I0fVw2CH.js} +1 -1
  97. package/ui/dist/assets/{StatusBadge-Do8GEljT.js → StatusBadge-e3tFf05B.js} +1 -1
  98. package/ui/dist/assets/{Tabs-B-g5Ghos.js → Tabs-vGpPiBzr.js} +1 -1
  99. package/ui/dist/assets/{TeamsPanel-BrT1eigj.js → TeamsPanel-AFIQBzRK.js} +1 -1
  100. package/ui/dist/assets/{TelemetryPanel-C9vV_ydx.js → TelemetryPanel-DKZGVmcp.js} +1 -1
  101. package/ui/dist/assets/{TitanCanvas-BPVdmdYo.js → TitanCanvas-CqvuuIjd.js} +4 -4
  102. package/ui/dist/assets/{ToolsView-COEuSnLh.js → ToolsView-DnIkrUvP.js} +2 -2
  103. package/ui/dist/assets/{Tooltip-Ip86jr39.js → Tooltip-DNc5AWi0.js} +1 -1
  104. package/ui/dist/assets/{TraceViewer-BcK-DNNV.js → TraceViewer-MD9YRFVc.js} +1 -1
  105. package/ui/dist/assets/{TrainingPanel-s5yKr9vs.js → TrainingPanel-BfXoR7_N.js} +1 -1
  106. package/ui/dist/assets/{VoiceOverlay-BKtgGRK8.js → VoiceOverlay-Bl81c4yf.js} +1 -1
  107. package/ui/dist/assets/{VramPanel-C2vulpkc.js → VramPanel-Ba8H8Qs2.js} +1 -1
  108. package/ui/dist/assets/{WatchView-GXZc0v1H.js → WatchView-CoLHPGd7.js} +1 -1
  109. package/ui/dist/assets/{WorkTab-CCQpoRi6.js → WorkTab-UppfR_AF.js} +1 -1
  110. package/ui/dist/assets/{WorkflowsPanel-CjU5wOPV.js → WorkflowsPanel-CdN7Epxr.js} +1 -1
  111. package/ui/dist/assets/{archive-Cty0CkR8.js → archive-DWgNklp0.js} +1 -1
  112. package/ui/dist/assets/{arrow-left-pfqo1Fw_.js → arrow-left-CW5NV7E0.js} +1 -1
  113. package/ui/dist/assets/{book-open-B6YYAKPS.js → book-open-DRI_Y6cW.js} +1 -1
  114. package/ui/dist/assets/{bot-CF5xQRRg.js → bot-DSGZRM5O.js} +1 -1
  115. package/ui/dist/assets/{chart-column-DmdEaxIF.js → chart-column-D6yK9tts.js} +1 -1
  116. package/ui/dist/assets/{check-B06kj6lQ.js → check-Cxp-6q4k.js} +1 -1
  117. package/ui/dist/assets/{chevron-right-BANsqvxz.js → chevron-right-DkIMxdwH.js} +1 -1
  118. package/ui/dist/assets/{chevron-up-DZTojCej.js → chevron-up-BbDu8x1d.js} +1 -1
  119. package/ui/dist/assets/{circle-check-big-2NAZFdp9.js → circle-check-big-DnJPBAGU.js} +1 -1
  120. package/ui/dist/assets/{circle-stop-AU_Yx5I3.js → circle-stop-DOe0OacY.js} +1 -1
  121. package/ui/dist/assets/clipboard-list-Dj5RQbT8.js +6 -0
  122. package/ui/dist/assets/{clock-DXDS0v3F.js → clock-BS8fh7Rt.js} +1 -1
  123. package/ui/dist/assets/{dollar-sign-DLLEescF.js → dollar-sign-DMXBeaTj.js} +1 -1
  124. package/ui/dist/assets/{download-CsU2Repn.js → download-BykARpbG.js} +1 -1
  125. package/ui/dist/assets/{external-link-Chx9uvWw.js → external-link-BfXhMi9L.js} +1 -1
  126. package/ui/dist/assets/{file-text-RZVxniN-.js → file-text-CUkSytWL.js} +1 -1
  127. package/ui/dist/assets/{flask-conical-BMH8pJKb.js → flask-conical-BS4cuENu.js} +1 -1
  128. package/ui/dist/assets/{folder-DgwmNgPQ.js → folder-BDwoUobN.js} +1 -1
  129. package/ui/dist/assets/{funnel-BR7hTVZW.js → funnel-xr6Dd1ub.js} +1 -1
  130. package/ui/dist/assets/{git-branch-B5R0dCYG.js → git-branch-C0Qk52W8.js} +1 -1
  131. package/ui/dist/assets/{index-BUCi9exS.js → index-CmaGnHzR.js} +30 -30
  132. package/ui/dist/assets/index-OZm1iJy9.css +1 -0
  133. package/ui/dist/assets/{layers-DGEsxpYY.js → layers-DPHYdeRk.js} +1 -1
  134. package/ui/dist/assets/{legacy-DgcX067d.js → legacy-DzagVk5C.js} +1 -1
  135. package/ui/dist/assets/{lightbulb-BvNv5S2z.js → lightbulb-Bj6cj6Xl.js} +1 -1
  136. package/ui/dist/assets/{list-todo-BYS3IIni.js → list-todo-Cm4jNFHV.js} +1 -1
  137. package/ui/dist/assets/{message-square-I2Wa53bg.js → message-square-BrWLAovN.js} +1 -1
  138. package/ui/dist/assets/{mic-CLF69wwf.js → mic-BXNK4d7X.js} +1 -1
  139. package/ui/dist/assets/{missions-a23pAr7Z.js → missions-DEjMYSre.js} +1 -1
  140. package/ui/dist/assets/{network-DPPIz6Io.js → network-CrQn1GKv.js} +1 -1
  141. package/ui/dist/assets/{pause-4M6u54u8.js → pause-DS5xgDMT.js} +1 -1
  142. package/ui/dist/assets/{pencil-CmthDu_c.js → pencil-DAI6FtFQ.js} +1 -1
  143. package/ui/dist/assets/{play-C5er2jT3.js → play-DxBy837b.js} +1 -1
  144. package/ui/dist/assets/{plug-Cj409xHk.js → plug-D0Bstfm0.js} +1 -1
  145. package/ui/dist/assets/{plus-C63FIH_4.js → plus-DxgNIt8h.js} +1 -1
  146. package/ui/dist/assets/{proxy-CV0RFkNZ.js → proxy-KYomRnLW.js} +1 -1
  147. package/ui/dist/assets/{radio-DJcw-8Fl.js → radio-2vniRFTO.js} +1 -1
  148. package/ui/dist/assets/{refresh-cw-D7RrQJQl.js → refresh-cw-BFBnnWj8.js} +1 -1
  149. package/ui/dist/assets/{rotate-ccw-wDOKy6Sz.js → rotate-ccw-B9wWlKRc.js} +1 -1
  150. package/ui/dist/assets/{save-Cy8s5sjb.js → save--wCYre_u.js} +1 -1
  151. package/ui/dist/assets/{search-BXNHN7Ra.js → search-DOD1aOm8.js} +1 -1
  152. package/ui/dist/assets/{send-DU7Jy0ph.js → send-Bb57UxT7.js} +1 -1
  153. package/ui/dist/assets/{server-Cg6QHqG3.js → server-CBsCfofY.js} +1 -1
  154. package/ui/dist/assets/{shield-check-nn5B33Zk.js → shield-check-B24N03VU.js} +1 -1
  155. package/ui/dist/assets/{terminal-D3qHXhYo.js → terminal-CZ77Swtc.js} +1 -1
  156. package/ui/dist/assets/{test-tube-qD4BUs0u.js → test-tube-CkkvIu5j.js} +1 -1
  157. package/ui/dist/assets/{toggle-right-B8VL5BEg.js → toggle-right-DgphAedS.js} +1 -1
  158. package/ui/dist/assets/{trash-2-BscnSMjc.js → trash-2-C5KNXS-O.js} +1 -1
  159. package/ui/dist/assets/{trending-up-CusGuaj_.js → trending-up-B3H8xrGD.js} +1 -1
  160. package/ui/dist/assets/{trophy-SEdQm3z6.js → trophy-C-xSgHD2.js} +1 -1
  161. package/ui/dist/assets/{volume-2-lPPI8coL.js → volume-2-BXwRjeve.js} +1 -1
  162. package/ui/dist/assets/{wifi-off-Deo-Hgei.js → wifi-off-DOm__Zn6.js} +1 -1
  163. package/ui/dist/index.html +2 -2
  164. package/ui/dist/sw.js +1 -1
  165. package/ui/dist/assets/AuditPanel-Dln-nzxR.js +0 -6
  166. package/ui/dist/assets/CPLayout-DVvrBIqI.js +0 -2
  167. package/ui/dist/assets/InfraView-KVwWRhIp.js +0 -2
  168. package/ui/dist/assets/IntelligenceView-CGUmFDYY.js +0 -2
  169. package/ui/dist/assets/SettingsView-DqklKAud.js +0 -2
  170. package/ui/dist/assets/index-CUxC9gxc.css +0 -1
@@ -1 +1 @@
1
- import{r as g,j as t,w as ae,x as re,y as ie,z as ne,U as oe,T as ce,A as q,D as X}from"./index-BUCi9exS.js";import"./Input-CzDjGc5Y.js";import{S as de}from"./StatusBadge-Do8GEljT.js";import{P as J}from"./PageHeader-BXEGoqDX.js";import{S as xe}from"./SkeletonLoader-DGQ0Q7vy.js";import{R as me}from"./refresh-cw-D7RrQJQl.js";import{L as K}from"./list-todo-BYS3IIni.js";import{D as fe}from"./dollar-sign-DLLEescF.js";import"./clsx-B-dksMZM.js";import"./chevron-right-BANsqvxz.js";const Q={idle:"textSecondary",active:"success",paused:"warning",error:"error",stopped:"borderLight"},he={ceo:"C",manager:"M",engineer:"E",researcher:"R",general:"G"};function ge({agents:x,activity:m}){const v=g.useRef(null),R=g.useRef(x),p=g.useRef(m);return R.current=x,p.current=m,g.useEffect(()=>{const b=v.current;if(!b)return;const e=b.getContext("2d");if(!e)return;const w=window.devicePixelRatio||1;let L,$=0;const A=()=>{const i=document.documentElement,c=getComputedStyle(i),s=(u,j,l)=>{const k=u?c.getPropertyValue(u).trim():"";return k||c.getPropertyValue(j).trim()||l};return{bg:s("--theme-bg-base","--color-bg","#09090b"),bgTertiary:s("--theme-bg-grain","--color-bg-tertiary","#27272a"),border:s("--theme-metal-dark","--color-border","#3f3f46"),borderLight:s("--theme-metal","--color-border-light","#52525b"),textMuted:s("--theme-ink-soft","--color-text-muted","#71717a"),textSecondary:s("--theme-paper-fg","--color-text-secondary","#a1a1aa"),accent:s("--theme-accent","--color-accent","#6366f1"),accentLight:s(null,"--color-accent-light","#a5b4fc"),success:s(null,"--color-success","#22c55e"),warning:s(null,"--color-warning","#f59e0b"),error:s(null,"--color-error","#ef4444")}},M=()=>{const i=b.clientWidth,c=b.clientHeight;b.width=i*w,b.height=c*w,e.setTransform(w,0,0,w,0,0)};M(),window.addEventListener("resize",M);const I=()=>{$++;const i=$/15,c=b.clientWidth,s=b.clientHeight,u=R.current,j=p.current,l=A();e.fillStyle=l.bg,e.fillRect(0,0,c,s),e.strokeStyle="#141418",e.lineWidth=.5;for(let a=0;a<c;a+=24)e.beginPath(),e.moveTo(a,s*.72),e.lineTo(a,s),e.stroke();for(let a=s*.72;a<s;a+=24)e.beginPath(),e.moveTo(0,a),e.lineTo(c,a),e.stroke();if(u.length===0){e.fillStyle=l.bgTertiary,e.font="12px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center",e.fillText("No agents registered",c/2,s/2-10),e.font="10px -apple-system, BlinkMacSystemFont, sans-serif",e.fillStyle=l.border,e.fillText("Spawn agents to see them here",c/2,s/2+10),e.textAlign="start",L=requestAnimationFrame(I);return}const k=Math.min(u.length,8),D=Math.min(120,(c-20)/k),ee=(c-D*k)/2+D/2;for(let a=0;a<k;a++){const P=u[a],r=ee+a*D,n=s*.55,f=P.status==="active"?"active":P.status,z=l[Q[f]||Q.idle],o=Math.sin(i*.8+a*1.5)*1.5,F=j.some(d=>d.agentId===P.id&&Date.now()-new Date(d.timestamp).getTime()<3e4),E=Math.min(70,D-10),T=10,B=r-E/2,S=n+16;e.fillStyle=l.border,e.fillRect(B,S,E,T),e.fillStyle=l.borderLight,e.fillRect(B+1,S+1,E-2,T-2),e.fillStyle=l.border,e.fillRect(B+3,S+T,3,14),e.fillRect(B+E-6,S+T,3,14);const H=26,O=18,V=r-H/2,U=S-O;e.fillStyle=l.bgTertiary,e.fillRect(V,U,H,O);const Y=f==="error"?l.error:f==="active"?l.success:l.accent;if(e.fillStyle=Y+"30",e.fillRect(V+2,U+2,H-4,O-4),f==="active"||F){e.fillStyle=Y+"60";const d=2+Math.floor(i%3);for(let h=0;h<d;h++){const C=6+Math.sin(i*2+h+a)*5;e.fillRect(V+3,U+3+h*4,C,1.5)}}e.fillStyle=l.border,e.fillRect(r-2,S-1,4,3),e.fillStyle="#1e1e22",e.fillRect(r-10,n+10+o,20,8),e.fillRect(r-11,n-2+o,3,20),e.fillStyle=l.border,e.fillRect(r-7,n+o,14,12);const y=f==="active"&&F?Math.sin(i*1.5+a)*1.5:0;e.fillStyle=l.borderLight,e.fillRect(r-6,n-10+o+y,12,10);const G=Math.sin(i*.3+a*2)>.95?1:2;if(e.fillStyle=z,f==="stopped"?(e.fillRect(r-4,n-7+o+y,2,1),e.fillRect(r-3,n-6+o+y,2,1),e.fillRect(r+1,n-7+o+y,2,1),e.fillRect(r+2,n-6+o+y,2,1)):(e.fillRect(r-4,n-7+o+y,2,G),e.fillRect(r+2,n-7+o+y,2,G)),e.fillStyle=l.borderLight,e.fillRect(r-1,n-14+o+y,2,4),e.fillStyle=z,e.beginPath(),e.arc(r,n-15+o+y,2,0,Math.PI*2),e.fill(),f==="active"&&(e.globalAlpha=.3+Math.sin(i*3+a)*.2,e.beginPath(),e.arc(r,n-15+o+y,5,0,Math.PI*2),e.fill(),e.globalAlpha=1),f==="active"&&F){const d=Math.sin(i*6+a)*2,h=Math.sin(i*6+a+Math.PI)*2;e.fillStyle=l.border,e.fillRect(r-11,n+3+o+d,4,3),e.fillRect(r+7,n+3+o+h,4,3)}else e.fillStyle=l.border,e.fillRect(r-10,n+5+o,3,6),e.fillRect(r+7,n+5+o,3,6);if(f==="active"&&F){for(let d=0;d<2;d++){const h=i*1.5+d*Math.PI+a,C=14+Math.sin(i+d)*4,se=r+Math.cos(h)*C,le=n-3+Math.sin(h)*C*.4+o;e.globalAlpha=.25+Math.sin(i*2+d)*.15,e.fillStyle=z,e.beginPath(),e.arc(se,le,1,0,Math.PI*2),e.fill()}e.globalAlpha=1}if(f==="error"){for(let d=0;d<3;d++){const h=r+Math.sin(i*4+d*2)*12,C=n-5+Math.cos(i*3+d)*8+o;e.globalAlpha=.4+Math.sin(i+d)*.3,e.fillStyle=l.error,e.fillRect(h-1,C-1,2,2)}e.globalAlpha=1}e.fillStyle=f==="stopped"?l.border:l.textMuted,e.font="9px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center";const _=Math.max(44,E+14);let N=P.name;if(e.measureText(N).width>_){for(;N.length>1&&e.measureText(N+"…").width>_;)N=N.slice(0,-1);N=N.trimEnd()+"…"}e.fillText(N,r,S+T+24);const te=he[P.role]||"G";e.fillStyle=z+"60",e.font="bold 7px -apple-system, BlinkMacSystemFont, sans-serif",e.fillText(te,r,S+T+33),e.textAlign="start"}if(e.fillStyle=l.bgTertiary,e.font="bold 9px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center",e.fillText("COMMAND POST",c/2,s-6),e.textAlign="start",j.length>0){const a=j[j.length-1];if(Date.now()-new Date(a.timestamp).getTime()<6e4){e.fillStyle=l.accent+"40",e.fillRect(0,0,c,16),e.fillStyle=l.accentLight,e.font="8px -apple-system, BlinkMacSystemFont, sans-serif";const r=a.message.length>60?a.message.slice(0,57)+"...":a.message;e.textAlign="center",e.fillText(r,c/2,11),e.textAlign="start"}}L=requestAnimationFrame(I)};return I(),()=>{cancelAnimationFrame(L),window.removeEventListener("resize",M)}},[]),t.jsx("canvas",{ref:v,className:"w-full rounded-xl border border-border",style:{height:220,imageRendering:"pixelated"}})}function Z(x){const m=Math.floor((Date.now()-new Date(x).getTime())/1e3);return m<60?`${m}s`:m<3600?`${Math.floor(m/60)}m`:m<86400?`${Math.floor(m/3600)}h`:`${Math.floor(m/86400)}d`}function W({icon:x,label:m,value:v,sub:R,color:p}){return t.jsxs("div",{className:"bg-bg-tertiary/50 border border-border rounded-xl p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(x,{size:14,className:p}),t.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:m})]}),t.jsx("div",{className:"text-2xl font-bold text-text",children:v}),R&&t.jsx("div",{className:"text-[11px] text-text-muted mt-1",children:R})]})}function Ae(){var c;const[x,m]=g.useState(null),[v,R]=g.useState([]),[p,b]=g.useState([]),[e,w]=g.useState(0),[L,$]=g.useState(!0),A=g.useCallback(async()=>{try{const[s,u,j,l]=await Promise.all([ae(),re(20),ie(),ne("pending")]);m(s),R(u),b(j),w(l.length)}catch{}$(!1)},[]);if(g.useEffect(()=>{A();const s=setInterval(A,15e3);return()=>clearInterval(s)},[A]),L)return t.jsxs("div",{className:"space-y-6",children:[t.jsx(J,{title:"Dashboard",breadcrumbs:[{label:"Command Post"},{label:"Dashboard"}]}),t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:t.jsx(xe,{variant:"metric",count:4})})]});if(!x)return t.jsx("div",{className:"text-center py-12 text-text-muted",children:"Failed to load dashboard"});const M=x.budgetUtilization??0,I=p.filter(s=>s.status==="in_progress").length,i=p.filter(s=>s.status==="blocked").length;return t.jsxs("div",{className:"space-y-6",children:[t.jsx(J,{title:"Dashboard",breadcrumbs:[{label:"Command Post"},{label:"Dashboard"}],actions:t.jsx("button",{onClick:A,className:"p-1.5 text-text-muted hover:text-text rounded-lg hover:bg-bg-tertiary transition-colors",children:t.jsx(me,{size:16})})}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[t.jsx(W,{icon:oe,label:"Agents Enabled",value:x.totalAgents,sub:`${x.activeAgents} running, ${Math.max(0,x.totalAgents-x.activeAgents)} paused`,color:"text-info"}),t.jsx(W,{icon:K,label:"Tasks In Progress",value:I,sub:`${p.length} open, ${i} blocked`,color:"text-warning"}),t.jsx(W,{icon:fe,label:"Budget Used",value:`${Math.round(M)}%`,sub:M>=80?"Nearing limit":"Healthy",color:M>=80?"text-error":"text-success"}),t.jsx(W,{icon:ce,label:"Goals",value:((c=x.goalTree)==null?void 0:c.length)??0,sub:"in hierarchy",color:"text-purple"})]}),x.agents.length>0&&t.jsx(ge,{agents:x.agents,activity:v}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[t.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(q,{size:14,className:"text-accent"}),t.jsx("h3",{className:"text-sm font-semibold text-text",children:"Recent Activity"})]}),t.jsx(X,{to:"/command-post/activity",className:"text-[10px] text-accent hover:text-accent-hover",children:"View all"})]}),t.jsx("div",{className:"max-h-72 overflow-y-auto divide-y divide-border",children:v.length===0?t.jsx("div",{className:"py-8 text-center text-xs text-text-muted",children:"No activity yet"}):[...v].reverse().slice(0,15).map((s,u)=>t.jsxs("div",{className:"flex items-start gap-2 px-4 py-2",children:[t.jsx(q,{size:12,className:"text-text-muted mt-0.5 flex-shrink-0"}),t.jsx("span",{className:"text-[11px] text-text-secondary flex-1",children:s.message}),t.jsx("span",{className:"text-[10px] text-text-muted flex-shrink-0",children:Z(s.timestamp)})]},`${s.timestamp}-${u}`))})]}),t.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(K,{size:14,className:"text-accent"}),t.jsx("h3",{className:"text-sm font-semibold text-text",children:"Recent Issues"})]}),t.jsx(X,{to:"/command-post/issues",className:"text-[10px] text-accent hover:text-accent-hover",children:"View all"})]}),t.jsx("div",{className:"max-h-72 overflow-y-auto divide-y divide-border",children:p.length===0?t.jsx("div",{className:"py-8 text-center text-xs text-text-muted",children:"No issues yet"}):p.slice(0,10).map(s=>t.jsxs(X,{to:`/command-post/issues/${s.id}`,className:"flex items-center gap-2 px-4 py-2 hover:bg-bg-tertiary transition-colors",children:[t.jsx(de,{status:s.status,variant:"dot",size:"sm"}),t.jsx("span",{className:"text-[11px] text-text-secondary flex-1 truncate",children:s.title}),s.assigneeAgentId&&t.jsx("span",{className:"text-[10px] text-text-muted",children:s.assigneeAgentId}),t.jsx("span",{className:"text-[10px] text-text-muted flex-shrink-0",children:Z(s.updatedAt)})]},s.id))})]})]})]})}export{Ae as default};
1
+ import{r as g,j as t,w as ae,x as re,y as ie,z as ne,U as oe,T as ce,A as q,D as X}from"./index-CmaGnHzR.js";import"./Input-Bzh0-cXU.js";import{S as de}from"./StatusBadge-e3tFf05B.js";import{P as J}from"./PageHeader-BJ1jHtOy.js";import{S as xe}from"./SkeletonLoader-IpWkLmoy.js";import{R as me}from"./refresh-cw-BFBnnWj8.js";import{L as K}from"./list-todo-Cm4jNFHV.js";import{D as fe}from"./dollar-sign-DMXBeaTj.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DkIMxdwH.js";const Q={idle:"textSecondary",active:"success",paused:"warning",error:"error",stopped:"borderLight"},he={ceo:"C",manager:"M",engineer:"E",researcher:"R",general:"G"};function ge({agents:x,activity:m}){const v=g.useRef(null),R=g.useRef(x),p=g.useRef(m);return R.current=x,p.current=m,g.useEffect(()=>{const b=v.current;if(!b)return;const e=b.getContext("2d");if(!e)return;const w=window.devicePixelRatio||1;let L,$=0;const A=()=>{const i=document.documentElement,c=getComputedStyle(i),s=(u,j,l)=>{const k=u?c.getPropertyValue(u).trim():"";return k||c.getPropertyValue(j).trim()||l};return{bg:s("--theme-bg-base","--color-bg","#09090b"),bgTertiary:s("--theme-bg-grain","--color-bg-tertiary","#27272a"),border:s("--theme-metal-dark","--color-border","#3f3f46"),borderLight:s("--theme-metal","--color-border-light","#52525b"),textMuted:s("--theme-ink-soft","--color-text-muted","#71717a"),textSecondary:s("--theme-paper-fg","--color-text-secondary","#a1a1aa"),accent:s("--theme-accent","--color-accent","#6366f1"),accentLight:s(null,"--color-accent-light","#a5b4fc"),success:s(null,"--color-success","#22c55e"),warning:s(null,"--color-warning","#f59e0b"),error:s(null,"--color-error","#ef4444")}},M=()=>{const i=b.clientWidth,c=b.clientHeight;b.width=i*w,b.height=c*w,e.setTransform(w,0,0,w,0,0)};M(),window.addEventListener("resize",M);const I=()=>{$++;const i=$/15,c=b.clientWidth,s=b.clientHeight,u=R.current,j=p.current,l=A();e.fillStyle=l.bg,e.fillRect(0,0,c,s),e.strokeStyle="#141418",e.lineWidth=.5;for(let a=0;a<c;a+=24)e.beginPath(),e.moveTo(a,s*.72),e.lineTo(a,s),e.stroke();for(let a=s*.72;a<s;a+=24)e.beginPath(),e.moveTo(0,a),e.lineTo(c,a),e.stroke();if(u.length===0){e.fillStyle=l.bgTertiary,e.font="12px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center",e.fillText("No agents registered",c/2,s/2-10),e.font="10px -apple-system, BlinkMacSystemFont, sans-serif",e.fillStyle=l.border,e.fillText("Spawn agents to see them here",c/2,s/2+10),e.textAlign="start",L=requestAnimationFrame(I);return}const k=Math.min(u.length,8),D=Math.min(120,(c-20)/k),ee=(c-D*k)/2+D/2;for(let a=0;a<k;a++){const P=u[a],r=ee+a*D,n=s*.55,f=P.status==="active"?"active":P.status,z=l[Q[f]||Q.idle],o=Math.sin(i*.8+a*1.5)*1.5,F=j.some(d=>d.agentId===P.id&&Date.now()-new Date(d.timestamp).getTime()<3e4),E=Math.min(70,D-10),T=10,B=r-E/2,S=n+16;e.fillStyle=l.border,e.fillRect(B,S,E,T),e.fillStyle=l.borderLight,e.fillRect(B+1,S+1,E-2,T-2),e.fillStyle=l.border,e.fillRect(B+3,S+T,3,14),e.fillRect(B+E-6,S+T,3,14);const H=26,O=18,V=r-H/2,U=S-O;e.fillStyle=l.bgTertiary,e.fillRect(V,U,H,O);const Y=f==="error"?l.error:f==="active"?l.success:l.accent;if(e.fillStyle=Y+"30",e.fillRect(V+2,U+2,H-4,O-4),f==="active"||F){e.fillStyle=Y+"60";const d=2+Math.floor(i%3);for(let h=0;h<d;h++){const C=6+Math.sin(i*2+h+a)*5;e.fillRect(V+3,U+3+h*4,C,1.5)}}e.fillStyle=l.border,e.fillRect(r-2,S-1,4,3),e.fillStyle="#1e1e22",e.fillRect(r-10,n+10+o,20,8),e.fillRect(r-11,n-2+o,3,20),e.fillStyle=l.border,e.fillRect(r-7,n+o,14,12);const y=f==="active"&&F?Math.sin(i*1.5+a)*1.5:0;e.fillStyle=l.borderLight,e.fillRect(r-6,n-10+o+y,12,10);const G=Math.sin(i*.3+a*2)>.95?1:2;if(e.fillStyle=z,f==="stopped"?(e.fillRect(r-4,n-7+o+y,2,1),e.fillRect(r-3,n-6+o+y,2,1),e.fillRect(r+1,n-7+o+y,2,1),e.fillRect(r+2,n-6+o+y,2,1)):(e.fillRect(r-4,n-7+o+y,2,G),e.fillRect(r+2,n-7+o+y,2,G)),e.fillStyle=l.borderLight,e.fillRect(r-1,n-14+o+y,2,4),e.fillStyle=z,e.beginPath(),e.arc(r,n-15+o+y,2,0,Math.PI*2),e.fill(),f==="active"&&(e.globalAlpha=.3+Math.sin(i*3+a)*.2,e.beginPath(),e.arc(r,n-15+o+y,5,0,Math.PI*2),e.fill(),e.globalAlpha=1),f==="active"&&F){const d=Math.sin(i*6+a)*2,h=Math.sin(i*6+a+Math.PI)*2;e.fillStyle=l.border,e.fillRect(r-11,n+3+o+d,4,3),e.fillRect(r+7,n+3+o+h,4,3)}else e.fillStyle=l.border,e.fillRect(r-10,n+5+o,3,6),e.fillRect(r+7,n+5+o,3,6);if(f==="active"&&F){for(let d=0;d<2;d++){const h=i*1.5+d*Math.PI+a,C=14+Math.sin(i+d)*4,se=r+Math.cos(h)*C,le=n-3+Math.sin(h)*C*.4+o;e.globalAlpha=.25+Math.sin(i*2+d)*.15,e.fillStyle=z,e.beginPath(),e.arc(se,le,1,0,Math.PI*2),e.fill()}e.globalAlpha=1}if(f==="error"){for(let d=0;d<3;d++){const h=r+Math.sin(i*4+d*2)*12,C=n-5+Math.cos(i*3+d)*8+o;e.globalAlpha=.4+Math.sin(i+d)*.3,e.fillStyle=l.error,e.fillRect(h-1,C-1,2,2)}e.globalAlpha=1}e.fillStyle=f==="stopped"?l.border:l.textMuted,e.font="9px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center";const _=Math.max(44,E+14);let N=P.name;if(e.measureText(N).width>_){for(;N.length>1&&e.measureText(N+"…").width>_;)N=N.slice(0,-1);N=N.trimEnd()+"…"}e.fillText(N,r,S+T+24);const te=he[P.role]||"G";e.fillStyle=z+"60",e.font="bold 7px -apple-system, BlinkMacSystemFont, sans-serif",e.fillText(te,r,S+T+33),e.textAlign="start"}if(e.fillStyle=l.bgTertiary,e.font="bold 9px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center",e.fillText("COMMAND POST",c/2,s-6),e.textAlign="start",j.length>0){const a=j[j.length-1];if(Date.now()-new Date(a.timestamp).getTime()<6e4){e.fillStyle=l.accent+"40",e.fillRect(0,0,c,16),e.fillStyle=l.accentLight,e.font="8px -apple-system, BlinkMacSystemFont, sans-serif";const r=a.message.length>60?a.message.slice(0,57)+"...":a.message;e.textAlign="center",e.fillText(r,c/2,11),e.textAlign="start"}}L=requestAnimationFrame(I)};return I(),()=>{cancelAnimationFrame(L),window.removeEventListener("resize",M)}},[]),t.jsx("canvas",{ref:v,className:"w-full rounded-xl border border-border",style:{height:220,imageRendering:"pixelated"}})}function Z(x){const m=Math.floor((Date.now()-new Date(x).getTime())/1e3);return m<60?`${m}s`:m<3600?`${Math.floor(m/60)}m`:m<86400?`${Math.floor(m/3600)}h`:`${Math.floor(m/86400)}d`}function W({icon:x,label:m,value:v,sub:R,color:p}){return t.jsxs("div",{className:"bg-bg-tertiary/50 border border-border rounded-xl p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(x,{size:14,className:p}),t.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:m})]}),t.jsx("div",{className:"text-2xl font-bold text-text",children:v}),R&&t.jsx("div",{className:"text-[11px] text-text-muted mt-1",children:R})]})}function Ae(){var c;const[x,m]=g.useState(null),[v,R]=g.useState([]),[p,b]=g.useState([]),[e,w]=g.useState(0),[L,$]=g.useState(!0),A=g.useCallback(async()=>{try{const[s,u,j,l]=await Promise.all([ae(),re(20),ie(),ne("pending")]);m(s),R(u),b(j),w(l.length)}catch{}$(!1)},[]);if(g.useEffect(()=>{A();const s=setInterval(A,15e3);return()=>clearInterval(s)},[A]),L)return t.jsxs("div",{className:"space-y-6",children:[t.jsx(J,{title:"Dashboard",breadcrumbs:[{label:"Command Post"},{label:"Dashboard"}]}),t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:t.jsx(xe,{variant:"metric",count:4})})]});if(!x)return t.jsx("div",{className:"text-center py-12 text-text-muted",children:"Failed to load dashboard"});const M=x.budgetUtilization??0,I=p.filter(s=>s.status==="in_progress").length,i=p.filter(s=>s.status==="blocked").length;return t.jsxs("div",{className:"space-y-6",children:[t.jsx(J,{title:"Dashboard",breadcrumbs:[{label:"Command Post"},{label:"Dashboard"}],actions:t.jsx("button",{onClick:A,className:"p-1.5 text-text-muted hover:text-text rounded-lg hover:bg-bg-tertiary transition-colors",children:t.jsx(me,{size:16})})}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[t.jsx(W,{icon:oe,label:"Agents Enabled",value:x.totalAgents,sub:`${x.activeAgents} running, ${Math.max(0,x.totalAgents-x.activeAgents)} paused`,color:"text-info"}),t.jsx(W,{icon:K,label:"Tasks In Progress",value:I,sub:`${p.length} open, ${i} blocked`,color:"text-warning"}),t.jsx(W,{icon:fe,label:"Budget Used",value:`${Math.round(M)}%`,sub:M>=80?"Nearing limit":"Healthy",color:M>=80?"text-error":"text-success"}),t.jsx(W,{icon:ce,label:"Goals",value:((c=x.goalTree)==null?void 0:c.length)??0,sub:"in hierarchy",color:"text-purple"})]}),x.agents.length>0&&t.jsx(ge,{agents:x.agents,activity:v}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[t.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(q,{size:14,className:"text-accent"}),t.jsx("h3",{className:"text-sm font-semibold text-text",children:"Recent Activity"})]}),t.jsx(X,{to:"/command-post/activity",className:"text-[10px] text-accent hover:text-accent-hover",children:"View all"})]}),t.jsx("div",{className:"max-h-72 overflow-y-auto divide-y divide-border",children:v.length===0?t.jsx("div",{className:"py-8 text-center text-xs text-text-muted",children:"No activity yet"}):[...v].reverse().slice(0,15).map((s,u)=>t.jsxs("div",{className:"flex items-start gap-2 px-4 py-2",children:[t.jsx(q,{size:12,className:"text-text-muted mt-0.5 flex-shrink-0"}),t.jsx("span",{className:"text-[11px] text-text-secondary flex-1",children:s.message}),t.jsx("span",{className:"text-[10px] text-text-muted flex-shrink-0",children:Z(s.timestamp)})]},`${s.timestamp}-${u}`))})]}),t.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(K,{size:14,className:"text-accent"}),t.jsx("h3",{className:"text-sm font-semibold text-text",children:"Recent Issues"})]}),t.jsx(X,{to:"/command-post/issues",className:"text-[10px] text-accent hover:text-accent-hover",children:"View all"})]}),t.jsx("div",{className:"max-h-72 overflow-y-auto divide-y divide-border",children:p.length===0?t.jsx("div",{className:"py-8 text-center text-xs text-text-muted",children:"No issues yet"}):p.slice(0,10).map(s=>t.jsxs(X,{to:`/command-post/issues/${s.id}`,className:"flex items-center gap-2 px-4 py-2 hover:bg-bg-tertiary transition-colors",children:[t.jsx(de,{status:s.status,variant:"dot",size:"sm"}),t.jsx("span",{className:"text-[11px] text-text-secondary flex-1 truncate",children:s.title}),s.assigneeAgentId&&t.jsx("span",{className:"text-[10px] text-text-muted",children:s.assigneeAgentId}),t.jsx("span",{className:"text-[10px] text-text-muted flex-shrink-0",children:Z(s.updatedAt)})]},s.id))})]})]})]})}export{Ae as default};
@@ -1 +1 @@
1
- import{r as i,j as e,b as f,X as j}from"./index-BUCi9exS.js";import{F as N}from"./folder-DgwmNgPQ.js";import{F as y}from"./flask-conical-BMH8pJKb.js";import{S as v}from"./search-BXNHN7Ra.js";import{R as p}from"./refresh-cw-D7RrQJQl.js";import{F as w}from"./file-text-RZVxniN-.js";async function h(t){const a=await f(t);if(!a.ok)throw new Error(`HTTP ${a.status}`);return a.json()}function b(t){return t===void 0?"—":t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}K`:`${(t/1024/1024).toFixed(1)}M`}function g(t){const a=Math.floor((Date.now()-new Date(t).getTime())/1e3);return a<60?`${a}s`:a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}function k({path:t,onClose:a}){const[r,c]=i.useState(null);return i.useEffect(()=>{c(null),h(`/api/files/content?path=${encodeURIComponent(t)}`).then(l=>c(l)).catch(l=>c({error:String(l)}))},[t]),e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 flex items-center justify-center p-4",onClick:a,children:e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl w-full max-w-5xl max-h-[90vh] flex flex-col shadow-2xl",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text truncate",children:t}),r&&"sizeBytes"in r&&e.jsxs("div",{className:"text-xs text-text-muted",children:[b(r.sizeBytes)," · ",r.encoding,r.truncated?" · truncated at 1MB":""]})]}),e.jsx("button",{onClick:a,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted",title:"Close",children:e.jsx(j,{size:18})})]}),e.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[r===null&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),r&&"error"in r&&e.jsx("div",{className:"text-error text-sm py-8 text-center",children:r.error}),r&&"content"in r&&e.jsx("pre",{className:"text-[12px] font-mono leading-snug whitespace-pre-wrap text-text-secondary",children:r.content})]})]})})}function C(){const[t,a]=i.useState([]),[r,c]=i.useState(!0),[l,m]=i.useState(""),[o,n]=i.useState(null),d=i.useCallback(async()=>{c(!0);try{const s=await h("/api/files/edited?limit=300");a(s.files||[])}catch{}c(!1)},[]);i.useEffect(()=>{d()},[d]);const x=l?t.filter(s=>s.path.toLowerCase().includes(l.toLowerCase())):t;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-bg-secondary",children:[e.jsx(v,{size:14,className:"text-text-muted"}),e.jsx("input",{type:"text",placeholder:"Filter by path…",value:l,onChange:s=>m(s.target.value),className:"flex-1 bg-transparent text-sm outline-none"})]}),e.jsxs("button",{onClick:d,className:"px-3 py-1.5 rounded-lg border border-border bg-bg-secondary text-sm hover:bg-bg-tertiary flex items-center gap-1.5",title:"Refresh",children:[e.jsx(p,{size:14,className:r?"animate-spin":""}),r?"Loading":"Refresh"]}),e.jsxs("div",{className:"text-xs text-text-muted",children:[x.length," / ",t.length]})]}),r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),!r&&x.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:l?"No files match filter":"No file edits recorded yet"}),x.length>0&&e.jsx("div",{className:"divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden",children:x.map(s=>e.jsxs("button",{onClick:()=>s.readable&&s.exists&&n(s.path),disabled:!s.readable||!s.exists,className:"w-full flex items-start gap-3 px-4 py-2.5 text-left hover:bg-bg-tertiary transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(w,{size:14,className:s.isSelfMod?"text-accent mt-0.5 flex-shrink-0":"text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-mono text-text truncate",children:s.path}),e.jsxs("div",{className:"text-xs text-text-muted mt-0.5 flex items-center gap-2 flex-wrap",children:[s.isSelfMod&&e.jsx("span",{className:"px-1 rounded bg-accent/15 text-accent text-[10px]",children:"self-mod"}),e.jsxs("span",{children:["×",s.writeCount]}),s.tools.length>0&&e.jsx("span",{children:s.tools.join("+")}),s.channels.length>0&&e.jsxs("span",{children:["via ",s.channels.join(", ")]}),!s.exists&&e.jsx("span",{className:"text-warn",children:"deleted"}),e.jsx("span",{children:b(s.sizeBytes)})]})]}),e.jsx("div",{className:"text-xs text-text-muted flex-shrink-0",children:g(s.lastWrittenAt)})]},s.path))}),o&&e.jsx(k,{path:o,onClose:()=>n(null)})]})}function S(){const[t,a]=i.useState([]),[r,c]=i.useState(!0),[l,m]=i.useState(null),o=i.useCallback(async()=>{c(!0);try{const n=await h("/api/research/recent?limit=50");a(n.research||[])}catch{}c(!1)},[]);return i.useEffect(()=>{o()},[o]),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:o,className:"px-3 py-1.5 rounded-lg border border-border bg-bg-secondary text-sm hover:bg-bg-tertiary flex items-center gap-1.5",children:[e.jsx(p,{size:14,className:r?"animate-spin":""}),r?"Loading":"Refresh"]}),e.jsxs("div",{className:"text-xs text-text-muted",children:[t.length," items"]})]}),r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),!r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"No research recorded yet. Complete a goal and results will appear here."}),e.jsx("div",{className:"space-y-2",children:t.map(n=>{var u;const d=l===n.id,x=n.content.slice(0,200),s=n.subtaskTitle?`${n.goalTitle} — ${n.subtaskTitle}`:((u=n.tags)==null?void 0:u.join(" · "))||n.kind;return e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary overflow-hidden",children:[e.jsxs("button",{onClick:()=>m(d?null:n.id),className:"w-full text-left px-4 py-3 hover:bg-bg-tertiary transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary text-text-muted uppercase tracking-wide font-medium",children:n.kind.replace(/_/g," ")}),e.jsx("span",{className:"text-xs text-text-muted",children:g(n.at)})]}),e.jsx("div",{className:"text-sm font-medium text-text truncate",children:s}),!d&&e.jsxs("div",{className:"text-xs text-text-secondary mt-1 line-clamp-2",children:[x,n.content.length>200?"…":""]})]}),d&&e.jsx("div",{className:"px-4 pb-4",children:e.jsx("pre",{className:"text-[12px] font-mono leading-snug whitespace-pre-wrap text-text-secondary",children:n.content})})]},n.id)})})]})}function M(){const[t,a]=i.useState("files");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>a("files"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors ${t==="files"?"bg-accent/15 text-accent border border-accent/30":"text-text-secondary hover:text-text hover:bg-bg-tertiary border border-transparent"}`,children:[e.jsx(N,{size:14})," Files edited"]}),e.jsxs("button",{onClick:()=>a("research"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors ${t==="research"?"bg-accent/15 text-accent border border-accent/30":"text-text-secondary hover:text-text hover:bg-bg-tertiary border border-transparent"}`,children:[e.jsx(y,{size:14})," Research"]})]}),t==="files"?e.jsx(C,{}):e.jsx(S,{})]})}export{M as default};
1
+ import{r as i,j as e,b as f,X as j}from"./index-CmaGnHzR.js";import{F as N}from"./folder-BDwoUobN.js";import{F as y}from"./flask-conical-BS4cuENu.js";import{S as v}from"./search-DOD1aOm8.js";import{R as p}from"./refresh-cw-BFBnnWj8.js";import{F as w}from"./file-text-CUkSytWL.js";async function h(t){const a=await f(t);if(!a.ok)throw new Error(`HTTP ${a.status}`);return a.json()}function b(t){return t===void 0?"—":t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}K`:`${(t/1024/1024).toFixed(1)}M`}function g(t){const a=Math.floor((Date.now()-new Date(t).getTime())/1e3);return a<60?`${a}s`:a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}function k({path:t,onClose:a}){const[r,c]=i.useState(null);return i.useEffect(()=>{c(null),h(`/api/files/content?path=${encodeURIComponent(t)}`).then(l=>c(l)).catch(l=>c({error:String(l)}))},[t]),e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 flex items-center justify-center p-4",onClick:a,children:e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl w-full max-w-5xl max-h-[90vh] flex flex-col shadow-2xl",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text truncate",children:t}),r&&"sizeBytes"in r&&e.jsxs("div",{className:"text-xs text-text-muted",children:[b(r.sizeBytes)," · ",r.encoding,r.truncated?" · truncated at 1MB":""]})]}),e.jsx("button",{onClick:a,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted",title:"Close",children:e.jsx(j,{size:18})})]}),e.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[r===null&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),r&&"error"in r&&e.jsx("div",{className:"text-error text-sm py-8 text-center",children:r.error}),r&&"content"in r&&e.jsx("pre",{className:"text-[12px] font-mono leading-snug whitespace-pre-wrap text-text-secondary",children:r.content})]})]})})}function C(){const[t,a]=i.useState([]),[r,c]=i.useState(!0),[l,m]=i.useState(""),[o,n]=i.useState(null),d=i.useCallback(async()=>{c(!0);try{const s=await h("/api/files/edited?limit=300");a(s.files||[])}catch{}c(!1)},[]);i.useEffect(()=>{d()},[d]);const x=l?t.filter(s=>s.path.toLowerCase().includes(l.toLowerCase())):t;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-bg-secondary",children:[e.jsx(v,{size:14,className:"text-text-muted"}),e.jsx("input",{type:"text",placeholder:"Filter by path…",value:l,onChange:s=>m(s.target.value),className:"flex-1 bg-transparent text-sm outline-none"})]}),e.jsxs("button",{onClick:d,className:"px-3 py-1.5 rounded-lg border border-border bg-bg-secondary text-sm hover:bg-bg-tertiary flex items-center gap-1.5",title:"Refresh",children:[e.jsx(p,{size:14,className:r?"animate-spin":""}),r?"Loading":"Refresh"]}),e.jsxs("div",{className:"text-xs text-text-muted",children:[x.length," / ",t.length]})]}),r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),!r&&x.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:l?"No files match filter":"No file edits recorded yet"}),x.length>0&&e.jsx("div",{className:"divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden",children:x.map(s=>e.jsxs("button",{onClick:()=>s.readable&&s.exists&&n(s.path),disabled:!s.readable||!s.exists,className:"w-full flex items-start gap-3 px-4 py-2.5 text-left hover:bg-bg-tertiary transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(w,{size:14,className:s.isSelfMod?"text-accent mt-0.5 flex-shrink-0":"text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-mono text-text truncate",children:s.path}),e.jsxs("div",{className:"text-xs text-text-muted mt-0.5 flex items-center gap-2 flex-wrap",children:[s.isSelfMod&&e.jsx("span",{className:"px-1 rounded bg-accent/15 text-accent text-[10px]",children:"self-mod"}),e.jsxs("span",{children:["×",s.writeCount]}),s.tools.length>0&&e.jsx("span",{children:s.tools.join("+")}),s.channels.length>0&&e.jsxs("span",{children:["via ",s.channels.join(", ")]}),!s.exists&&e.jsx("span",{className:"text-warn",children:"deleted"}),e.jsx("span",{children:b(s.sizeBytes)})]})]}),e.jsx("div",{className:"text-xs text-text-muted flex-shrink-0",children:g(s.lastWrittenAt)})]},s.path))}),o&&e.jsx(k,{path:o,onClose:()=>n(null)})]})}function S(){const[t,a]=i.useState([]),[r,c]=i.useState(!0),[l,m]=i.useState(null),o=i.useCallback(async()=>{c(!0);try{const n=await h("/api/research/recent?limit=50");a(n.research||[])}catch{}c(!1)},[]);return i.useEffect(()=>{o()},[o]),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:o,className:"px-3 py-1.5 rounded-lg border border-border bg-bg-secondary text-sm hover:bg-bg-tertiary flex items-center gap-1.5",children:[e.jsx(p,{size:14,className:r?"animate-spin":""}),r?"Loading":"Refresh"]}),e.jsxs("div",{className:"text-xs text-text-muted",children:[t.length," items"]})]}),r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),!r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"No research recorded yet. Complete a goal and results will appear here."}),e.jsx("div",{className:"space-y-2",children:t.map(n=>{var u;const d=l===n.id,x=n.content.slice(0,200),s=n.subtaskTitle?`${n.goalTitle} — ${n.subtaskTitle}`:((u=n.tags)==null?void 0:u.join(" · "))||n.kind;return e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary overflow-hidden",children:[e.jsxs("button",{onClick:()=>m(d?null:n.id),className:"w-full text-left px-4 py-3 hover:bg-bg-tertiary transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary text-text-muted uppercase tracking-wide font-medium",children:n.kind.replace(/_/g," ")}),e.jsx("span",{className:"text-xs text-text-muted",children:g(n.at)})]}),e.jsx("div",{className:"text-sm font-medium text-text truncate",children:s}),!d&&e.jsxs("div",{className:"text-xs text-text-secondary mt-1 line-clamp-2",children:[x,n.content.length>200?"…":""]})]}),d&&e.jsx("div",{className:"px-4 pb-4",children:e.jsx("pre",{className:"text-[12px] font-mono leading-snug whitespace-pre-wrap text-text-secondary",children:n.content})})]},n.id)})})]})}function M(){const[t,a]=i.useState("files");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>a("files"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors ${t==="files"?"bg-accent/15 text-accent border border-accent/30":"text-text-secondary hover:text-text hover:bg-bg-tertiary border border-transparent"}`,children:[e.jsx(N,{size:14})," Files edited"]}),e.jsxs("button",{onClick:()=>a("research"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors ${t==="research"?"bg-accent/15 text-accent border border-accent/30":"text-text-secondary hover:text-text hover:bg-bg-tertiary border border-transparent"}`,children:[e.jsx(y,{size:14})," Research"]})]}),t==="files"?e.jsx(C,{}):e.jsx(S,{})]})}export{M as default};
@@ -1 +1 @@
1
- import{r as i,Q as D,j as e,T as N,V as $,X as M,b as y}from"./index-BUCi9exS.js";import{B as j}from"./Input-CzDjGc5Y.js";import{S as T}from"./StatusBadge-Do8GEljT.js";import{P as O}from"./PageHeader-BXEGoqDX.js";import{E as A}from"./EmptyState-B3lWjJU-.js";import{M as F}from"./Modal-DTzLKnUQ.js";import{S as L}from"./SkeletonLoader-DGQ0Q7vy.js";import{P as B}from"./plus-C63FIH_4.js";import{C as I}from"./chevron-right-BANsqvxz.js";import{T as U}from"./trash-2-BscnSMjc.js";import"./clsx-B-dksMZM.js";import"./proxy-CV0RFkNZ.js";function _(t){const a=Math.floor((Date.now()-new Date(t).getTime())/1e3);return a<60?`${a}s`:a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}const H=["pending","in_progress","completed","blocked"];function J({node:t,onClose:a,onRefresh:l}){const[d,c]=i.useState(!1),[x,m]=i.useState(!1),r=t.goal,g=async()=>{c(!0);try{await y(`/api/goals/${r.id}`,{method:"DELETE"}),l(),a()}catch{}c(!1)},o=async n=>{m(!0);try{await y(`/api/goals/${r.id}`,{method:"PATCH",body:JSON.stringify({status:n})}),l()}catch{}m(!1)};return e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-text",children:r.title}),r.description&&e.jsx("p",{className:"text-sm text-text-secondary mt-1",children:r.description})]}),e.jsx("button",{onClick:a,className:"p-1 text-text-muted hover:text-text rounded-lg hover:bg-bg-tertiary transition-colors",children:e.jsx(M,{size:16})})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 text-xs",children:[e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Status: "}),e.jsx(T,{status:r.status,size:"sm"})]}),r.progress>0&&e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Progress: "}),e.jsxs("span",{className:"text-text font-medium",children:[Math.round(r.progress),"%"]})]}),t.children.length>0&&e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Sub-goals: "}),e.jsxs("span",{className:"text-text font-medium",children:[t.children.filter(n=>n.goal.status==="completed"||n.goal.status==="done").length,"/",t.children.length," done"]})]}),e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Updated: "}),e.jsxs("span",{className:"text-text font-medium",children:[_(r.updatedAt||r.createdAt||new Date().toISOString())," ago"]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-2",children:"Change Status"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:H.map(n=>e.jsx("button",{disabled:x||r.status===n,onClick:()=>o(n),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${r.status===n?"bg-accent/20 text-accent border border-accent/30":"bg-bg-tertiary text-text-secondary hover:bg-bg-tertiary/80 border border-border"} disabled:opacity-50`,children:n.replace("_"," ")},n))})]}),e.jsx("div",{className:"pt-2 border-t border-border flex justify-end",children:e.jsxs("button",{onClick:g,disabled:d,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-error hover:bg-error/10 transition-colors disabled:opacity-50",children:[e.jsx(U,{size:12}),d?"Deleting...":"Delete Goal"]})})]})}function z({node:t,expanded:a,toggleExpand:l,selectedId:d,onSelect:c}){const x=t.children.length>0,m=a.has(t.goal.id),r=d===t.goal.id,g=t.children.filter(o=>o.goal.status==="completed"||o.goal.status==="done").length;return e.jsxs("div",{children:[e.jsxs("div",{className:`flex items-center gap-2 py-2 px-3 rounded-lg transition-colors cursor-pointer group ${r?"bg-accent/10 border-l-2 border-accent":"hover:bg-bg-tertiary/50"}`,style:{paddingLeft:`${t.depth*24+12}px`},onClick:()=>c(t),children:[x?e.jsx("button",{onClick:o=>{o.stopPropagation(),l(t.goal.id)},className:"p-0.5 rounded hover:bg-bg-tertiary transition-colors",children:m?e.jsx($,{size:14,className:"text-text-muted"}):e.jsx(I,{size:14,className:"text-text-muted"})}):e.jsx("span",{className:"w-[18px] flex-shrink-0"}),e.jsx(N,{size:14,className:r?"text-accent":"text-text-muted"}),e.jsx("span",{className:"text-sm text-text flex-1 truncate",children:t.goal.title}),e.jsx(T,{status:t.goal.status,size:"sm"}),x&&e.jsxs("span",{className:"text-[10px] text-text-muted",children:[g,"/",t.children.length]}),t.goal.progress>0&&e.jsx("div",{className:"w-16 h-1.5 bg-bg-tertiary rounded-full overflow-hidden flex-shrink-0",children:e.jsx("div",{className:"h-full bg-accent rounded-full transition-all",style:{width:`${Math.min(100,t.goal.progress)}%`}})})]}),x&&m&&e.jsx("div",{children:t.children.map(o=>e.jsx(z,{node:o,expanded:a,toggleExpand:l,selectedId:d,onSelect:c},o.goal.id))})]})}function E(t,a){for(const l of t){if(l.goal.id===a)return l;const d=E(l.children,a);if(d)return d}return null}function ae(){const[t,a]=i.useState([]),[l,d]=i.useState(!0),[c,x]=i.useState(null),[m,r]=i.useState(new Set),[g,o]=i.useState(null),[n,u]=i.useState(!1),[p,v]=i.useState(""),[P,S]=i.useState(!1),b=i.useCallback(async()=>{try{const s=await D();a(s),r(new Set(s.map(h=>h.goal.id))),x(null)}catch(s){x(s instanceof Error?s.message:"Failed to load goals")}d(!1)},[]);i.useEffect(()=>{b()},[b]);const C=s=>{r(h=>{const f=new Set(h);return f.has(s)?f.delete(s):f.add(s),f})},G=s=>{o(h=>h===s.goal.id?null:s.goal.id),s.children.length>0&&!m.has(s.goal.id)&&C(s.goal.id)},w=async()=>{if(p.trim()){S(!0);try{await y("/api/command-post/goals",{method:"POST",body:JSON.stringify({title:p.trim()})}),u(!1),v(""),await b()}catch{}S(!1)}},k=g?E(t,g):null;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(O,{title:"Goals",breadcrumbs:[{label:"Command Post"},{label:"Goals"}],actions:e.jsx(j,{size:"sm",icon:e.jsx(B,{size:14}),onClick:()=>u(!0),children:"Create Goal"})}),l&&e.jsx(L,{variant:"row",count:5}),c&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:c}),!l&&!c&&t.length===0&&e.jsx(A,{icon:e.jsx(N,{size:32}),title:"No goals",description:"Create your first goal to start organizing agent work.",action:{label:"Create Goal",onClick:()=>u(!0)}}),!l&&!c&&t.length>0&&e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"lg:col-span-2 rounded-xl border border-border bg-bg-secondary overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-text-muted",children:[t.length," top-level goal",t.length!==1?"s":""]}),e.jsx("span",{className:"text-[10px] text-text-muted",children:"Click a goal to view details"})]}),e.jsx("div",{className:"divide-y divide-border",children:t.map(s=>e.jsx(z,{node:s,expanded:m,toggleExpand:C,selectedId:g,onSelect:G},s.goal.id))})]}),e.jsx("div",{className:"lg:col-span-1",children:k?e.jsx(J,{node:k,onClose:()=>o(null),onRefresh:b}):e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-8 text-center",children:[e.jsx(N,{size:24,className:"text-text-muted mx-auto mb-2"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Select a goal to view details"})]})})]}),e.jsx(F,{open:n,onClose:()=>u(!1),title:"Create Goal",footer:e.jsxs(e.Fragment,{children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:()=>u(!1),children:"Cancel"}),e.jsx(j,{size:"sm",onClick:w,loading:P,disabled:!p.trim(),children:"Create"})]}),children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Goal Title"}),e.jsx("input",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:"Enter goal title...",value:p,onChange:s=>v(s.target.value),onKeyDown:s=>s.key==="Enter"&&w(),autoFocus:!0})]})})]})}export{ae as default};
1
+ import{r as i,Q as D,j as e,T as N,V as $,X as M,b as y}from"./index-CmaGnHzR.js";import{B as j}from"./Input-Bzh0-cXU.js";import{S as T}from"./StatusBadge-e3tFf05B.js";import{P as O}from"./PageHeader-BJ1jHtOy.js";import{E as A}from"./EmptyState-iLOrbdU7.js";import{M as F}from"./Modal-nvni-LGR.js";import{S as L}from"./SkeletonLoader-IpWkLmoy.js";import{P as B}from"./plus-DxgNIt8h.js";import{C as I}from"./chevron-right-DkIMxdwH.js";import{T as U}from"./trash-2-C5KNXS-O.js";import"./clsx-B-dksMZM.js";import"./proxy-KYomRnLW.js";function _(t){const a=Math.floor((Date.now()-new Date(t).getTime())/1e3);return a<60?`${a}s`:a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}const H=["pending","in_progress","completed","blocked"];function J({node:t,onClose:a,onRefresh:l}){const[d,c]=i.useState(!1),[x,m]=i.useState(!1),r=t.goal,g=async()=>{c(!0);try{await y(`/api/goals/${r.id}`,{method:"DELETE"}),l(),a()}catch{}c(!1)},o=async n=>{m(!0);try{await y(`/api/goals/${r.id}`,{method:"PATCH",body:JSON.stringify({status:n})}),l()}catch{}m(!1)};return e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-text",children:r.title}),r.description&&e.jsx("p",{className:"text-sm text-text-secondary mt-1",children:r.description})]}),e.jsx("button",{onClick:a,className:"p-1 text-text-muted hover:text-text rounded-lg hover:bg-bg-tertiary transition-colors",children:e.jsx(M,{size:16})})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 text-xs",children:[e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Status: "}),e.jsx(T,{status:r.status,size:"sm"})]}),r.progress>0&&e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Progress: "}),e.jsxs("span",{className:"text-text font-medium",children:[Math.round(r.progress),"%"]})]}),t.children.length>0&&e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Sub-goals: "}),e.jsxs("span",{className:"text-text font-medium",children:[t.children.filter(n=>n.goal.status==="completed"||n.goal.status==="done").length,"/",t.children.length," done"]})]}),e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Updated: "}),e.jsxs("span",{className:"text-text font-medium",children:[_(r.updatedAt||r.createdAt||new Date().toISOString())," ago"]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-2",children:"Change Status"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:H.map(n=>e.jsx("button",{disabled:x||r.status===n,onClick:()=>o(n),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${r.status===n?"bg-accent/20 text-accent border border-accent/30":"bg-bg-tertiary text-text-secondary hover:bg-bg-tertiary/80 border border-border"} disabled:opacity-50`,children:n.replace("_"," ")},n))})]}),e.jsx("div",{className:"pt-2 border-t border-border flex justify-end",children:e.jsxs("button",{onClick:g,disabled:d,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-error hover:bg-error/10 transition-colors disabled:opacity-50",children:[e.jsx(U,{size:12}),d?"Deleting...":"Delete Goal"]})})]})}function z({node:t,expanded:a,toggleExpand:l,selectedId:d,onSelect:c}){const x=t.children.length>0,m=a.has(t.goal.id),r=d===t.goal.id,g=t.children.filter(o=>o.goal.status==="completed"||o.goal.status==="done").length;return e.jsxs("div",{children:[e.jsxs("div",{className:`flex items-center gap-2 py-2 px-3 rounded-lg transition-colors cursor-pointer group ${r?"bg-accent/10 border-l-2 border-accent":"hover:bg-bg-tertiary/50"}`,style:{paddingLeft:`${t.depth*24+12}px`},onClick:()=>c(t),children:[x?e.jsx("button",{onClick:o=>{o.stopPropagation(),l(t.goal.id)},className:"p-0.5 rounded hover:bg-bg-tertiary transition-colors",children:m?e.jsx($,{size:14,className:"text-text-muted"}):e.jsx(I,{size:14,className:"text-text-muted"})}):e.jsx("span",{className:"w-[18px] flex-shrink-0"}),e.jsx(N,{size:14,className:r?"text-accent":"text-text-muted"}),e.jsx("span",{className:"text-sm text-text flex-1 truncate",children:t.goal.title}),e.jsx(T,{status:t.goal.status,size:"sm"}),x&&e.jsxs("span",{className:"text-[10px] text-text-muted",children:[g,"/",t.children.length]}),t.goal.progress>0&&e.jsx("div",{className:"w-16 h-1.5 bg-bg-tertiary rounded-full overflow-hidden flex-shrink-0",children:e.jsx("div",{className:"h-full bg-accent rounded-full transition-all",style:{width:`${Math.min(100,t.goal.progress)}%`}})})]}),x&&m&&e.jsx("div",{children:t.children.map(o=>e.jsx(z,{node:o,expanded:a,toggleExpand:l,selectedId:d,onSelect:c},o.goal.id))})]})}function E(t,a){for(const l of t){if(l.goal.id===a)return l;const d=E(l.children,a);if(d)return d}return null}function ae(){const[t,a]=i.useState([]),[l,d]=i.useState(!0),[c,x]=i.useState(null),[m,r]=i.useState(new Set),[g,o]=i.useState(null),[n,u]=i.useState(!1),[p,v]=i.useState(""),[P,S]=i.useState(!1),b=i.useCallback(async()=>{try{const s=await D();a(s),r(new Set(s.map(h=>h.goal.id))),x(null)}catch(s){x(s instanceof Error?s.message:"Failed to load goals")}d(!1)},[]);i.useEffect(()=>{b()},[b]);const C=s=>{r(h=>{const f=new Set(h);return f.has(s)?f.delete(s):f.add(s),f})},G=s=>{o(h=>h===s.goal.id?null:s.goal.id),s.children.length>0&&!m.has(s.goal.id)&&C(s.goal.id)},w=async()=>{if(p.trim()){S(!0);try{await y("/api/command-post/goals",{method:"POST",body:JSON.stringify({title:p.trim()})}),u(!1),v(""),await b()}catch{}S(!1)}},k=g?E(t,g):null;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(O,{title:"Goals",breadcrumbs:[{label:"Command Post"},{label:"Goals"}],actions:e.jsx(j,{size:"sm",icon:e.jsx(B,{size:14}),onClick:()=>u(!0),children:"Create Goal"})}),l&&e.jsx(L,{variant:"row",count:5}),c&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:c}),!l&&!c&&t.length===0&&e.jsx(A,{icon:e.jsx(N,{size:32}),title:"No goals",description:"Create your first goal to start organizing agent work.",action:{label:"Create Goal",onClick:()=>u(!0)}}),!l&&!c&&t.length>0&&e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"lg:col-span-2 rounded-xl border border-border bg-bg-secondary overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-text-muted",children:[t.length," top-level goal",t.length!==1?"s":""]}),e.jsx("span",{className:"text-[10px] text-text-muted",children:"Click a goal to view details"})]}),e.jsx("div",{className:"divide-y divide-border",children:t.map(s=>e.jsx(z,{node:s,expanded:m,toggleExpand:C,selectedId:g,onSelect:G},s.goal.id))})]}),e.jsx("div",{className:"lg:col-span-1",children:k?e.jsx(J,{node:k,onClose:()=>o(null),onRefresh:b}):e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-8 text-center",children:[e.jsx(N,{size:24,className:"text-text-muted mx-auto mb-2"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Select a goal to view details"})]})})]}),e.jsx(F,{open:n,onClose:()=>u(!1),title:"Create Goal",footer:e.jsxs(e.Fragment,{children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:()=>u(!1),children:"Cancel"}),e.jsx(j,{size:"sm",onClick:w,loading:P,disabled:!p.trim(),children:"Create"})]}),children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Goal Title"}),e.jsx("input",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:"Enter goal title...",value:p,onChange:s=>v(s.target.value),onKeyDown:s=>s.key==="Enter"&&w(),autoFocus:!0})]})})]})}export{ae as default};
@@ -1,4 +1,4 @@
1
- import{c as A,r as d,J as P,j as e,bd as J,bG as Y,u as Q,z as Z,Y as ee,$ as te,y as se,l as re,K as I,X as E,V as ae,D as B,bH as ne,O as ie,P as oe,bI as le,b as de}from"./index-BUCi9exS.js";import{B as m}from"./Input-CzDjGc5Y.js";import{P as ce}from"./PageHeader-BXEGoqDX.js";import{E as xe}from"./EmptyState-B3lWjJU-.js";import{T as ue}from"./Tabs-B-g5Ghos.js";import{S as pe}from"./SkeletonLoader-DGQ0Q7vy.js";import{e as he}from"./approvalHeadline-DB9SgR-9.js";import{M as U}from"./message-square-I2Wa53bg.js";import{B as q}from"./bot-CF5xQRRg.js";import{C}from"./clock-DXDS0v3F.js";import{S as me}from"./send-DU7Jy0ph.js";import{S as ge}from"./shield-check-nn5B33Zk.js";import{C as D}from"./check-B06kj6lQ.js";import{F as fe}from"./funnel-BR7hTVZW.js";import{C as be}from"./chevron-up-DZTojCej.js";import{R as ve}from"./rotate-ccw-wDOKy6Sz.js";import"./clsx-B-dksMZM.js";import"./chevron-right-BANsqvxz.js";/**
1
+ import{c as A,r as d,J as P,j as e,bi as Y,bL as G,u as Q,z as Z,Y as ee,$ as te,y as se,l as re,K as I,X as E,V as ae,D as B,bM as ne,O as ie,P as oe,bN as le,b as de}from"./index-CmaGnHzR.js";import{B as m}from"./Input-Bzh0-cXU.js";import{P as ce}from"./PageHeader-BJ1jHtOy.js";import{E as xe}from"./EmptyState-iLOrbdU7.js";import{T as ue}from"./Tabs-vGpPiBzr.js";import{S as pe}from"./SkeletonLoader-IpWkLmoy.js";import{e as he}from"./approvalHeadline-DB9SgR-9.js";import{M as U}from"./message-square-BrWLAovN.js";import{B as q}from"./bot-DSGZRM5O.js";import{C}from"./clock-BS8fh7Rt.js";import{S as me}from"./send-Bb57UxT7.js";import{S as ge}from"./shield-check-B24N03VU.js";import{C as D}from"./check-Cxp-6q4k.js";import{F as fe}from"./funnel-xr6Dd1ub.js";import{C as be}from"./chevron-up-BbDu8x1d.js";import{R as ve}from"./rotate-ccw-B9wWlKRc.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DkIMxdwH.js";/**
2
2
  * @license lucide-react v0.513.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -13,4 +13,4 @@ import{c as A,r as d,J as P,j as e,bd as J,bG as Y,u as Q,z as Z,Y as ee,$ as te
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const Ne=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Se=A("square",Ne);function ze(o){return new Date(o).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Ce({approval:o,onReply:l}){const[u,y]=d.useState(""),[f,j]=d.useState(!1),{toast:x}=P(),k=o.thread||[],p=async()=>{if(u.trim()){j(!0);try{await Y(o.id,"user",u.trim()),y(""),l==null||l(),x("success","Reply sent")}catch{x("error","Failed to send reply")}j(!1)}};return e.jsxs("div",{className:"space-y-3 mt-3",children:[k.length===0&&e.jsxs("div",{className:"text-xs text-text-muted italic flex items-center gap-1",children:[e.jsx(U,{size:12}),"No replies yet. Start the conversation below."]}),k.map(r=>e.jsxs("div",{className:`flex gap-2 ${r.authorUser?"flex-row":"flex-row-reverse"}`,children:[e.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 ${r.authorUser?"bg-accent/20 text-accent":"bg-warning/20 text-warning"}`,children:r.authorUser?e.jsx(J,{size:12}):e.jsx(q,{size:12})}),e.jsxs("div",{className:`max-w-[80%] rounded-lg px-3 py-2 text-xs ${r.authorUser?"bg-bg-tertiary text-text":"bg-warning/10 text-text border border-warning/20"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("span",{className:"font-semibold",children:r.authorUser||r.authorAgentId||"Agent"}),e.jsx(C,{size:10,className:"text-text-muted"}),e.jsx("span",{className:"text-text-muted",children:ze(r.createdAt)})]}),e.jsx("div",{className:"whitespace-pre-wrap",children:r.body})]})]},r.id)),e.jsxs("div",{className:"flex items-end gap-2 pt-2",children:[e.jsx("textarea",{value:u,onChange:r=>y(r.target.value),placeholder:"Reply to this agent...",className:"flex-1 min-h-[60px] rounded-lg border border-border bg-bg px-3 py-2 text-xs text-text outline-none focus:border-accent resize-none",onKeyDown:r=>{r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),p())}}),e.jsx("button",{onClick:p,disabled:f||!u.trim(),className:"h-8 w-8 rounded-lg bg-accent text-white flex items-center justify-center disabled:opacity-40 hover:bg-accent/90 transition-colors",children:e.jsx(me,{size:14})})]})]})}function Ae(o){const l=Math.floor((Date.now()-new Date(o).getTime())/1e3);return l<60?`${l}s`:l<3600?`${Math.floor(l/60)}m`:l<86400?`${Math.floor(l/3600)}h`:`${Math.floor(l/86400)}d`}function $e(o){return!!o.snoozedUntil&&new Date(o.snoozedUntil)>new Date}function Xe(){const[o,l]=d.useState([]),[u,y]=d.useState(!0),[f,j]=d.useState(null),[x,k]=d.useState("all"),[p,r]=d.useState(null),[F,M]=d.useState(null),[w,S]=d.useState(new Set),[N,L]=d.useState("all"),{toast:c}=P(),V=Q(),h=d.useCallback(async()=>{try{const[t,n,a,b]=await Promise.all([Z("pending"),ee(void 0,50),te(),se({status:"blocked"})]),i=[];t.forEach(s=>{const v=he(s),g=s.type==="custom"&&s.payload.kind==="driver_blocked",T=s.type==="custom"&&s.payload.kind==="self_mod_pr";i.push({id:`approval-${s.id}`,kind:"approval",icon:ge,iconColor:g?"text-error":T?"text-warning":"text-accent",urgency:g||T?"high":"medium",message:`${v.kindLabel}: ${v.headline}`,timestamp:s.createdAt,data:s})}),n.filter(s=>s.status==="failed"||s.status==="error").forEach(s=>i.push({id:`run-${s.id}`,kind:"failed_run",icon:re,iconColor:"text-error",urgency:"high",message:`Run failed: ${s.agentId} — ${s.error??"unknown error"}`,timestamp:s.finishedAt??s.startedAt,data:s})),a.filter(s=>s.status==="error").forEach(s=>i.push({id:`agent-${s.id}`,kind:"error_agent",icon:I,iconColor:"text-error",urgency:"high",message:`Agent error: ${s.name}`,timestamp:s.lastHeartbeat,data:s})),b.forEach(s=>i.push({id:`issue-${s.id}`,kind:"blocked_issue",icon:I,iconColor:"text-warning",urgency:"medium",message:`Blocked: ${s.identifier} — ${s.title}`,timestamp:s.updatedAt,data:s})),i.sort((s,v)=>{const g={high:0,medium:1,low:2};return g[s.urgency]!==g[v.urgency]?g[s.urgency]-g[v.urgency]:new Date(v.timestamp).getTime()-new Date(s.timestamp).getTime()}),l(i),j(null)}catch(t){j(t instanceof Error?t.message:"Failed to load inbox")}y(!1)},[]);d.useEffect(()=>{h()},[h]);const H=async t=>{r(t.id);try{await ie(t.id,"user"),await h();const n=t.type==="goal_proposal"||t.type==="soma_proposal",a=t.type==="custom"&&t.payload.kind==="driver_blocked";c("success",n?"Work approved — TITAN is starting…":a?"Unblocked — TITAN is resuming…":"Approved"),(n||a)&&V("/command-post",{state:{tab:"Work"}})}catch{c("error","Approval failed")}r(null)},O=async t=>{r(t.id);try{await oe(t.id,"user"),await h(),c("success","Rejected")}catch{c("error","Reject failed")}r(null)},K=async(t,n)=>{r(t.id);try{const a=new Date(Date.now()+n*6e4).toISOString();await le(t.id,a),await h(),c("success",`Snoozed for ${n}m`)}catch{c("error","Snooze failed")}r(null)},W=async t=>{r(t.id);try{const n=await de(`/api/command-post/runs/${t.id}/retry`,{method:"POST"});if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);await h(),c("success","Retry queued — TITAN will try again")}catch{c("error","Retry failed")}r(null)},X=t=>{S(n=>{const a=new Set(n);return a.has(t)?a.delete(t):a.add(t),a})},$=async t=>{const n=Array.from(w).map(a=>{var b;return(b=o.find(i=>i.id===a))==null?void 0:b.data}).filter(a=>(a==null?void 0:a.id)!==void 0).map(a=>a.id);if(n.length!==0){r("batch");try{await ne(n,t,"user"),S(new Set),await h(),c("success",`${t==="approve"?"Approved":"Rejected"} ${n.length} item(s)`)}catch{c("error","Batch action failed")}r(null)}},z=o.filter(t=>x==="all"?!0:x==="approvals"?t.kind==="approval":x==="failed_runs"?t.kind==="failed_run":x==="errors"?t.kind==="error_agent"||t.kind==="blocked_issue":!0).filter(t=>N==="all"?!0:t.kind==="approval"?t.data.requestedBy===N:t.kind==="failed_run"?t.data.agentId===N:!0),_=o.filter(t=>t.kind==="approval"),G=[{id:"all",label:"All",count:o.length},{id:"approvals",label:"Approvals",count:_.length},{id:"failed_runs",label:"Failed Runs",count:o.filter(t=>t.kind==="failed_run").length},{id:"errors",label:"Errors",count:o.filter(t=>t.kind==="error_agent"||t.kind==="blocked_issue").length}],R=Array.from(new Set(_.map(t=>t.data.requestedBy))).filter(Boolean);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(ce,{title:"Inbox",breadcrumbs:[{label:"Command Post"},{label:"Inbox"}]}),w.size>0&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-accent/10 border border-accent/20",children:[e.jsxs("span",{className:"text-xs font-medium text-accent",children:[w.size," selected"]}),e.jsx("div",{className:"flex-1"}),e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>$("approve"),loading:p==="batch",icon:e.jsx(D,{size:14}),children:"Approve All"}),e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>$("reject"),loading:p==="batch",icon:e.jsx(E,{size:14}),children:"Reject All"}),e.jsx("button",{onClick:()=>S(new Set),className:"text-xs text-text-muted hover:text-text px-2",children:"Clear"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ue,{tabs:G,activeTab:x,onChange:k}),e.jsx("div",{className:"flex-1"}),x==="approvals"&&R.length>0&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(fe,{size:12,className:"text-text-muted"}),e.jsxs("select",{value:N,onChange:t=>L(t.target.value),className:"text-xs bg-bg border border-border rounded px-2 py-1 outline-none focus:border-accent",children:[e.jsx("option",{value:"all",children:"All agents"}),R.map(t=>e.jsx("option",{value:t,children:t},t))]})]})]}),u&&e.jsx(pe,{variant:"row",count:5}),f&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:f}),!u&&!f&&z.length===0&&e.jsx(xe,{icon:e.jsx(ye,{size:32}),title:"Inbox empty",description:"No pending items require your attention."}),!u&&!f&&z.length>0&&e.jsx("div",{className:"space-y-2",children:z.map(t=>{const n=t.icon,a=F===t.id,b=w.has(t.id),i=t.kind==="approval"?t.data:null;return e.jsxs("div",{className:`rounded-xl border overflow-hidden transition-colors ${t.urgency==="high"?"border-error/30 bg-error/5":t.urgency==="medium"?"border-warning/20 bg-warning/[0.03]":"border-border bg-bg-secondary"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[t.kind==="approval"&&e.jsx("button",{onClick:()=>X(t.id),className:"text-text-muted hover:text-accent transition-colors",children:b?e.jsx(we,{size:16,className:"text-accent"}):e.jsx(Se,{size:16})}),e.jsx(n,{size:16,className:t.iconColor}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-text font-medium truncate",children:t.message}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-text-muted mt-0.5",children:[i&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(q,{size:10}),i.requestedBy]}),i.thread&&i.thread.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent",children:[e.jsx(U,{size:10}),i.thread.length]}),$e(i)&&e.jsxs("span",{className:"flex items-center gap-1 text-warning",children:[e.jsx(C,{size:10}),"Snoozed"]})]}),e.jsx("span",{children:Ae(t.timestamp)})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[t.kind==="approval"&&e.jsxs(e.Fragment,{children:[e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>H(t.data),loading:p===t.data.id,icon:e.jsx(D,{size:14}),children:"Approve"}),e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>O(t.data),loading:p===t.data.id,icon:e.jsx(E,{size:14}),children:"Reject"}),e.jsxs("div",{className:"relative group",children:[e.jsx(m,{size:"sm",variant:"ghost",icon:e.jsx(C,{size:14}),children:"Snooze"}),e.jsx("div",{className:"absolute right-0 top-full mt-1 hidden group-hover:flex flex-col gap-1 bg-bg border border-border rounded-lg p-1 shadow-lg z-10",children:[15,60,240,1440].map(s=>e.jsx("button",{onClick:()=>K(t.data,s),className:"text-xs text-left px-2 py-1 rounded hover:bg-bg-tertiary whitespace-nowrap",children:s<60?`${s}m`:s<1440?`${s/60}h`:`${s/1440}d`},s))})]}),e.jsx("button",{onClick:()=>M(a?null:t.id),className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted",children:a?e.jsx(be,{size:14}):e.jsx(ae,{size:14})})]}),t.kind==="failed_run"&&e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>W(t.data),loading:p===t.data.id,icon:e.jsx(ve,{size:14}),children:"Retry"}),t.kind==="blocked_issue"&&e.jsx(B,{to:`/command-post/issues/${t.data.id}`,children:e.jsx(m,{size:"sm",variant:"ghost",children:"View"})}),t.kind==="error_agent"&&e.jsx(B,{to:`/command-post/agents/${t.data.id}`,children:e.jsx(m,{size:"sm",variant:"ghost",children:"View"})})]})]}),a&&i&&e.jsxs("div",{className:"px-4 pb-4 border-t border-border/50",children:[i.payload&&!!i.payload.shadowVerdict&&e.jsxs("div",{className:"mt-3 p-2 rounded-lg bg-bg-tertiary/50 text-xs",children:[e.jsx("div",{className:"font-medium text-text-muted mb-1",children:"Shadow Rehearsal"}),e.jsx("div",{className:"text-text-secondary",children:(()=>{const s=i.payload.shadowVerdict;return s?e.jsxs("div",{className:"space-y-1",children:[s.estimatedCostUsd?e.jsxs("div",{children:["Cost: $",Number(s.estimatedCostUsd).toFixed(2)]}):null,s.reversibilityScore!==void 0?e.jsxs("div",{children:["Reversibility: ",Number(s.reversibilityScore).toFixed(2)]}):null,s.breakRisks&&Array.isArray(s.breakRisks)&&s.breakRisks.length>0?e.jsxs("div",{className:"text-error",children:["Risks: ",s.breakRisks.join(", ")]}):null]}):null})()})]}),e.jsx(Ce,{approval:i,onReply:h})]})]},t.id)})})]})}export{Xe as default};
16
+ */const Ne=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Se=A("square",Ne);function ze(o){return new Date(o).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Ce({approval:o,onReply:l}){const[u,y]=d.useState(""),[f,j]=d.useState(!1),{toast:x}=P(),k=o.thread||[],p=async()=>{if(u.trim()){j(!0);try{await G(o.id,"user",u.trim()),y(""),l==null||l(),x("success","Reply sent")}catch{x("error","Failed to send reply")}j(!1)}};return e.jsxs("div",{className:"space-y-3 mt-3",children:[k.length===0&&e.jsxs("div",{className:"text-xs text-text-muted italic flex items-center gap-1",children:[e.jsx(U,{size:12}),"No replies yet. Start the conversation below."]}),k.map(r=>e.jsxs("div",{className:`flex gap-2 ${r.authorUser?"flex-row":"flex-row-reverse"}`,children:[e.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 ${r.authorUser?"bg-accent/20 text-accent":"bg-warning/20 text-warning"}`,children:r.authorUser?e.jsx(Y,{size:12}):e.jsx(q,{size:12})}),e.jsxs("div",{className:`max-w-[80%] rounded-lg px-3 py-2 text-xs ${r.authorUser?"bg-bg-tertiary text-text":"bg-warning/10 text-text border border-warning/20"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("span",{className:"font-semibold",children:r.authorUser||r.authorAgentId||"Agent"}),e.jsx(C,{size:10,className:"text-text-muted"}),e.jsx("span",{className:"text-text-muted",children:ze(r.createdAt)})]}),e.jsx("div",{className:"whitespace-pre-wrap",children:r.body})]})]},r.id)),e.jsxs("div",{className:"flex items-end gap-2 pt-2",children:[e.jsx("textarea",{value:u,onChange:r=>y(r.target.value),placeholder:"Reply to this agent...",className:"flex-1 min-h-[60px] rounded-lg border border-border bg-bg px-3 py-2 text-xs text-text outline-none focus:border-accent resize-none",onKeyDown:r=>{r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),p())}}),e.jsx("button",{onClick:p,disabled:f||!u.trim(),className:"h-8 w-8 rounded-lg bg-accent text-white flex items-center justify-center disabled:opacity-40 hover:bg-accent/90 transition-colors",children:e.jsx(me,{size:14})})]})]})}function Ae(o){const l=Math.floor((Date.now()-new Date(o).getTime())/1e3);return l<60?`${l}s`:l<3600?`${Math.floor(l/60)}m`:l<86400?`${Math.floor(l/3600)}h`:`${Math.floor(l/86400)}d`}function $e(o){return!!o.snoozedUntil&&new Date(o.snoozedUntil)>new Date}function Xe(){const[o,l]=d.useState([]),[u,y]=d.useState(!0),[f,j]=d.useState(null),[x,k]=d.useState("all"),[p,r]=d.useState(null),[F,M]=d.useState(null),[w,S]=d.useState(new Set),[N,L]=d.useState("all"),{toast:c}=P(),V=Q(),h=d.useCallback(async()=>{try{const[t,n,a,b]=await Promise.all([Z("pending"),ee(void 0,50),te(),se({status:"blocked"})]),i=[];t.forEach(s=>{const v=he(s),g=s.type==="custom"&&s.payload.kind==="driver_blocked",T=s.type==="custom"&&s.payload.kind==="self_mod_pr";i.push({id:`approval-${s.id}`,kind:"approval",icon:ge,iconColor:g?"text-error":T?"text-warning":"text-accent",urgency:g||T?"high":"medium",message:`${v.kindLabel}: ${v.headline}`,timestamp:s.createdAt,data:s})}),n.filter(s=>s.status==="failed"||s.status==="error").forEach(s=>i.push({id:`run-${s.id}`,kind:"failed_run",icon:re,iconColor:"text-error",urgency:"high",message:`Run failed: ${s.agentId} — ${s.error??"unknown error"}`,timestamp:s.finishedAt??s.startedAt,data:s})),a.filter(s=>s.status==="error").forEach(s=>i.push({id:`agent-${s.id}`,kind:"error_agent",icon:I,iconColor:"text-error",urgency:"high",message:`Agent error: ${s.name}`,timestamp:s.lastHeartbeat,data:s})),b.forEach(s=>i.push({id:`issue-${s.id}`,kind:"blocked_issue",icon:I,iconColor:"text-warning",urgency:"medium",message:`Blocked: ${s.identifier} — ${s.title}`,timestamp:s.updatedAt,data:s})),i.sort((s,v)=>{const g={high:0,medium:1,low:2};return g[s.urgency]!==g[v.urgency]?g[s.urgency]-g[v.urgency]:new Date(v.timestamp).getTime()-new Date(s.timestamp).getTime()}),l(i),j(null)}catch(t){j(t instanceof Error?t.message:"Failed to load inbox")}y(!1)},[]);d.useEffect(()=>{h()},[h]);const H=async t=>{r(t.id);try{await ie(t.id,"user"),await h();const n=t.type==="goal_proposal"||t.type==="soma_proposal",a=t.type==="custom"&&t.payload.kind==="driver_blocked";c("success",n?"Work approved — TITAN is starting…":a?"Unblocked — TITAN is resuming…":"Approved"),(n||a)&&V("/command-post",{state:{tab:"Work"}})}catch{c("error","Approval failed")}r(null)},O=async t=>{r(t.id);try{await oe(t.id,"user"),await h(),c("success","Rejected")}catch{c("error","Reject failed")}r(null)},K=async(t,n)=>{r(t.id);try{const a=new Date(Date.now()+n*6e4).toISOString();await le(t.id,a),await h(),c("success",`Snoozed for ${n}m`)}catch{c("error","Snooze failed")}r(null)},W=async t=>{r(t.id);try{const n=await de(`/api/command-post/runs/${t.id}/retry`,{method:"POST"});if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);await h(),c("success","Retry queued — TITAN will try again")}catch{c("error","Retry failed")}r(null)},X=t=>{S(n=>{const a=new Set(n);return a.has(t)?a.delete(t):a.add(t),a})},$=async t=>{const n=Array.from(w).map(a=>{var b;return(b=o.find(i=>i.id===a))==null?void 0:b.data}).filter(a=>(a==null?void 0:a.id)!==void 0).map(a=>a.id);if(n.length!==0){r("batch");try{await ne(n,t,"user"),S(new Set),await h(),c("success",`${t==="approve"?"Approved":"Rejected"} ${n.length} item(s)`)}catch{c("error","Batch action failed")}r(null)}},z=o.filter(t=>x==="all"?!0:x==="approvals"?t.kind==="approval":x==="failed_runs"?t.kind==="failed_run":x==="errors"?t.kind==="error_agent"||t.kind==="blocked_issue":!0).filter(t=>N==="all"?!0:t.kind==="approval"?t.data.requestedBy===N:t.kind==="failed_run"?t.data.agentId===N:!0),_=o.filter(t=>t.kind==="approval"),J=[{id:"all",label:"All",count:o.length},{id:"approvals",label:"Approvals",count:_.length},{id:"failed_runs",label:"Failed Runs",count:o.filter(t=>t.kind==="failed_run").length},{id:"errors",label:"Errors",count:o.filter(t=>t.kind==="error_agent"||t.kind==="blocked_issue").length}],R=Array.from(new Set(_.map(t=>t.data.requestedBy))).filter(Boolean);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(ce,{title:"Inbox",breadcrumbs:[{label:"Command Post"},{label:"Inbox"}]}),w.size>0&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-accent/10 border border-accent/20",children:[e.jsxs("span",{className:"text-xs font-medium text-accent",children:[w.size," selected"]}),e.jsx("div",{className:"flex-1"}),e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>$("approve"),loading:p==="batch",icon:e.jsx(D,{size:14}),children:"Approve All"}),e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>$("reject"),loading:p==="batch",icon:e.jsx(E,{size:14}),children:"Reject All"}),e.jsx("button",{onClick:()=>S(new Set),className:"text-xs text-text-muted hover:text-text px-2",children:"Clear"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ue,{tabs:J,activeTab:x,onChange:k}),e.jsx("div",{className:"flex-1"}),x==="approvals"&&R.length>0&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(fe,{size:12,className:"text-text-muted"}),e.jsxs("select",{value:N,onChange:t=>L(t.target.value),className:"text-xs bg-bg border border-border rounded px-2 py-1 outline-none focus:border-accent",children:[e.jsx("option",{value:"all",children:"All agents"}),R.map(t=>e.jsx("option",{value:t,children:t},t))]})]})]}),u&&e.jsx(pe,{variant:"row",count:5}),f&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:f}),!u&&!f&&z.length===0&&e.jsx(xe,{icon:e.jsx(ye,{size:32}),title:"Inbox empty",description:"No pending items require your attention."}),!u&&!f&&z.length>0&&e.jsx("div",{className:"space-y-2",children:z.map(t=>{const n=t.icon,a=F===t.id,b=w.has(t.id),i=t.kind==="approval"?t.data:null;return e.jsxs("div",{className:`rounded-xl border overflow-hidden transition-colors ${t.urgency==="high"?"border-error/30 bg-error/5":t.urgency==="medium"?"border-warning/20 bg-warning/[0.03]":"border-border bg-bg-secondary"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[t.kind==="approval"&&e.jsx("button",{onClick:()=>X(t.id),className:"text-text-muted hover:text-accent transition-colors",children:b?e.jsx(we,{size:16,className:"text-accent"}):e.jsx(Se,{size:16})}),e.jsx(n,{size:16,className:t.iconColor}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-text font-medium truncate",children:t.message}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-text-muted mt-0.5",children:[i&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(q,{size:10}),i.requestedBy]}),i.thread&&i.thread.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent",children:[e.jsx(U,{size:10}),i.thread.length]}),$e(i)&&e.jsxs("span",{className:"flex items-center gap-1 text-warning",children:[e.jsx(C,{size:10}),"Snoozed"]})]}),e.jsx("span",{children:Ae(t.timestamp)})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[t.kind==="approval"&&e.jsxs(e.Fragment,{children:[e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>H(t.data),loading:p===t.data.id,icon:e.jsx(D,{size:14}),children:"Approve"}),e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>O(t.data),loading:p===t.data.id,icon:e.jsx(E,{size:14}),children:"Reject"}),e.jsxs("div",{className:"relative group",children:[e.jsx(m,{size:"sm",variant:"ghost",icon:e.jsx(C,{size:14}),children:"Snooze"}),e.jsx("div",{className:"absolute right-0 top-full mt-1 hidden group-hover:flex flex-col gap-1 bg-bg border border-border rounded-lg p-1 shadow-lg z-10",children:[15,60,240,1440].map(s=>e.jsx("button",{onClick:()=>K(t.data,s),className:"text-xs text-left px-2 py-1 rounded hover:bg-bg-tertiary whitespace-nowrap",children:s<60?`${s}m`:s<1440?`${s/60}h`:`${s/1440}d`},s))})]}),e.jsx("button",{onClick:()=>M(a?null:t.id),className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted",children:a?e.jsx(be,{size:14}):e.jsx(ae,{size:14})})]}),t.kind==="failed_run"&&e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>W(t.data),loading:p===t.data.id,icon:e.jsx(ve,{size:14}),children:"Retry"}),t.kind==="blocked_issue"&&e.jsx(B,{to:`/command-post/issues/${t.data.id}`,children:e.jsx(m,{size:"sm",variant:"ghost",children:"View"})}),t.kind==="error_agent"&&e.jsx(B,{to:`/command-post/agents/${t.data.id}`,children:e.jsx(m,{size:"sm",variant:"ghost",children:"View"})})]})]}),a&&i&&e.jsxs("div",{className:"px-4 pb-4 border-t border-border/50",children:[i.payload&&!!i.payload.shadowVerdict&&e.jsxs("div",{className:"mt-3 p-2 rounded-lg bg-bg-tertiary/50 text-xs",children:[e.jsx("div",{className:"font-medium text-text-muted mb-1",children:"Shadow Rehearsal"}),e.jsx("div",{className:"text-text-secondary",children:(()=>{const s=i.payload.shadowVerdict;return s?e.jsxs("div",{className:"space-y-1",children:[s.estimatedCostUsd?e.jsxs("div",{children:["Cost: $",Number(s.estimatedCostUsd).toFixed(2)]}):null,s.reversibilityScore!==void 0?e.jsxs("div",{children:["Reversibility: ",Number(s.reversibilityScore).toFixed(2)]}):null,s.breakRisks&&Array.isArray(s.breakRisks)&&s.breakRisks.length>0?e.jsxs("div",{className:"text-error",children:["Risks: ",s.breakRisks.join(", ")]}):null]}):null})()})]}),e.jsx(Ce,{approval:i,onReply:h})]})]},t.id)})})]})}export{Xe as default};
@@ -1 +1 @@
1
- import{p as z,u as $,r,bD as B,b as S,bE as M,j as e,D as L,b5 as C}from"./index-BUCi9exS.js";import{B as c}from"./Input-CzDjGc5Y.js";import{S as O}from"./StatusBadge-Do8GEljT.js";import{P as h}from"./PageHeader-BXEGoqDX.js";import{S as U}from"./SkeletonLoader-DGQ0Q7vy.js";import{A as R}from"./arrow-left-pfqo1Fw_.js";import{M as _}from"./message-square-I2Wa53bg.js";import{S as F}from"./send-DU7Jy0ph.js";import"./clsx-B-dksMZM.js";import"./chevron-right-BANsqvxz.js";function b(a){const i=Math.floor((Date.now()-new Date(a).getTime())/1e3);return i<60?`${i}s`:i<3600?`${Math.floor(i/60)}m`:i<86400?`${Math.floor(i/3600)}h`:`${Math.floor(i/86400)}d`}const K={critical:"text-error",high:"text-warning",medium:"text-accent",low:"text-text-muted"},q=["backlog","todo","in_progress","in_review","done","blocked","cancelled"];function te(){const{id:a}=z(),i=$(),[s,o]=r.useState(null),[l,k]=r.useState([]),[I,E]=r.useState(!0),[g,f]=r.useState(null),[P,x]=r.useState(!1),[m,u]=r.useState(""),[n,j]=r.useState(""),[A,y]=r.useState(!1),[v,D]=r.useState(""),p=r.useCallback(async()=>{if(a){try{const t=await B(a);o(t),u(t.title);try{const d=await S(`/api/command-post/issues/${a}/comments`);d.ok&&k(await d.json())}catch{}f(null)}catch(t){f(t instanceof Error?t.message:"Failed to load issue")}E(!1)}},[a]);r.useEffect(()=>{p()},[p]),r.useEffect(()=>{s!=null&&s.id&&M(s.id).then(t=>D(t.ancestry)).catch(()=>{})},[s==null?void 0:s.id]);const T=async t=>{if(!(!a||!s))try{const d=await C(a,{status:t});o(d)}catch{}},N=async()=>{if(!(!a||!s||!m.trim()))try{const t=await C(a,{title:m.trim()});o(t),x(!1)}catch{}},w=async()=>{if(!(!a||!n.trim())){y(!0);try{await S(`/api/command-post/issues/${a}/comments`,{method:"POST",body:JSON.stringify({body:n.trim()})}),j(""),await p()}catch{}y(!1)}};return I?e.jsxs("div",{className:"space-y-6",children:[e.jsx(h,{title:"Issue",breadcrumbs:[{label:"Command Post"},{label:"Issues",href:"/command-post/issues"},{label:"..."}]}),e.jsx(U,{variant:"card",count:1})]}):g||!s?e.jsxs("div",{className:"space-y-6",children:[e.jsx(h,{title:"Issue",breadcrumbs:[{label:"Command Post"},{label:"Issues",href:"/command-post/issues"},{label:"Error"}]}),e.jsxs("div",{className:"text-center py-12",children:[e.jsx("p",{className:"text-error text-sm mb-4",children:g??"Issue not found"}),e.jsx(c,{variant:"secondary",size:"sm",onClick:()=>i("/command-post/issues"),children:"Back to Issues"})]})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(h,{title:s.identifier,breadcrumbs:[{label:"Command Post"},{label:"Issues",href:"/command-post/issues"},{label:s.identifier}],actions:e.jsxs(L,{to:"/command-post/issues",className:"flex items-center gap-1 text-xs text-text-muted hover:text-text",children:[e.jsx(R,{size:14})," Back"]})}),v&&e.jsx("div",{className:"bg-bg-tertiary/30 border border-border rounded-lg px-4 py-3 mb-4",children:e.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap font-mono leading-relaxed",children:v})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-4",children:[P?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{className:"flex-1 rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-base font-semibold text-text focus:outline-none focus:border-accent",value:m,onChange:t=>u(t.target.value),onKeyDown:t=>t.key==="Enter"&&N(),autoFocus:!0}),e.jsx(c,{size:"sm",onClick:N,children:"Save"}),e.jsx(c,{size:"sm",variant:"ghost",onClick:()=>{x(!1),u(s.title)},children:"Cancel"})]}):e.jsx("h2",{className:"text-lg font-semibold text-text cursor-pointer hover:text-accent transition-colors",onClick:()=>x(!0),title:"Click to edit",children:s.title}),s.description&&e.jsx("p",{className:"mt-3 text-sm text-text-secondary whitespace-pre-wrap",children:s.description})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:q.map(t=>e.jsx("button",{onClick:()=>T(t),disabled:s.status===t,className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors border ${s.status===t?"border-accent bg-accent/10 text-accent":"border-border bg-bg-tertiary text-text-muted hover:text-text hover:border-border-light"}`,children:t.replace(/_/g," ")},t))}),e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[e.jsx(_,{size:14,className:"text-accent"}),e.jsx("h3",{className:"text-sm font-semibold text-text",children:"Comments"}),e.jsxs("span",{className:"text-xs text-text-muted",children:["(",l.length,")"]})]}),l.length===0?e.jsx("div",{className:"py-8 text-center text-xs text-text-muted",children:"No comments yet"}):e.jsx("div",{className:"divide-y divide-border max-h-96 overflow-y-auto",children:l.map(t=>e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-xs font-medium text-text",children:t.authorAgentId??t.authorUser??"Unknown"}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:[b(t.createdAt)," ago"]})]}),e.jsx("p",{className:"text-sm text-text-secondary whitespace-pre-wrap",children:t.body})]},t.id))}),e.jsxs("div",{className:"border-t border-border px-4 py-3 flex items-center gap-2",children:[e.jsx("input",{className:"flex-1 rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:"Add a comment...",value:n,onChange:t=>j(t.target.value),onKeyDown:t=>t.key==="Enter"&&!t.shiftKey&&w()}),e.jsx(c,{size:"sm",onClick:w,loading:A,disabled:!n.trim(),icon:e.jsx(F,{size:14}),children:"Send"})]})]})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Status"}),e.jsx("div",{className:"mt-1",children:e.jsx(O,{status:s.status})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Priority"}),e.jsx("div",{className:`mt-1 text-sm font-medium capitalize ${K[s.priority]??"text-text"}`,children:s.priority})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Assignee"}),e.jsx("div",{className:"mt-1 text-sm text-text-secondary",children:s.assigneeAgentId??"Unassigned"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Identifier"}),e.jsx("div",{className:"mt-1 text-sm text-text font-mono",children:s.identifier})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Created"}),e.jsxs("div",{className:"mt-1 text-sm text-text-secondary",children:[b(s.createdAt)," ago"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Updated"}),e.jsxs("div",{className:"mt-1 text-sm text-text-secondary",children:[b(s.updatedAt)," ago"]})]})]})})]})]})}export{te as default};
1
+ import{p as D,u as $,r,bI as B,b as S,bJ as M,j as e,D as L,ba as C}from"./index-CmaGnHzR.js";import{B as c}from"./Input-Bzh0-cXU.js";import{S as O}from"./StatusBadge-e3tFf05B.js";import{P as h}from"./PageHeader-BJ1jHtOy.js";import{S as U}from"./SkeletonLoader-IpWkLmoy.js";import{A as R}from"./arrow-left-CW5NV7E0.js";import{M as _}from"./message-square-BrWLAovN.js";import{S as F}from"./send-Bb57UxT7.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DkIMxdwH.js";function b(a){const i=Math.floor((Date.now()-new Date(a).getTime())/1e3);return i<60?`${i}s`:i<3600?`${Math.floor(i/60)}m`:i<86400?`${Math.floor(i/3600)}h`:`${Math.floor(i/86400)}d`}const K={critical:"text-error",high:"text-warning",medium:"text-accent",low:"text-text-muted"},J=["backlog","todo","in_progress","in_review","done","blocked","cancelled"];function te(){const{id:a}=D(),i=$(),[s,o]=r.useState(null),[l,k]=r.useState([]),[I,P]=r.useState(!0),[g,f]=r.useState(null),[A,x]=r.useState(!1),[m,u]=r.useState(""),[n,j]=r.useState(""),[E,y]=r.useState(!1),[v,T]=r.useState(""),p=r.useCallback(async()=>{if(a){try{const t=await B(a);o(t),u(t.title);try{const d=await S(`/api/command-post/issues/${a}/comments`);d.ok&&k(await d.json())}catch{}f(null)}catch(t){f(t instanceof Error?t.message:"Failed to load issue")}P(!1)}},[a]);r.useEffect(()=>{p()},[p]),r.useEffect(()=>{s!=null&&s.id&&M(s.id).then(t=>T(t.ancestry)).catch(()=>{})},[s==null?void 0:s.id]);const z=async t=>{if(!(!a||!s))try{const d=await C(a,{status:t});o(d)}catch{}},N=async()=>{if(!(!a||!s||!m.trim()))try{const t=await C(a,{title:m.trim()});o(t),x(!1)}catch{}},w=async()=>{if(!(!a||!n.trim())){y(!0);try{await S(`/api/command-post/issues/${a}/comments`,{method:"POST",body:JSON.stringify({body:n.trim()})}),j(""),await p()}catch{}y(!1)}};return I?e.jsxs("div",{className:"space-y-6",children:[e.jsx(h,{title:"Issue",breadcrumbs:[{label:"Command Post"},{label:"Issues",href:"/command-post/issues"},{label:"..."}]}),e.jsx(U,{variant:"card",count:1})]}):g||!s?e.jsxs("div",{className:"space-y-6",children:[e.jsx(h,{title:"Issue",breadcrumbs:[{label:"Command Post"},{label:"Issues",href:"/command-post/issues"},{label:"Error"}]}),e.jsxs("div",{className:"text-center py-12",children:[e.jsx("p",{className:"text-error text-sm mb-4",children:g??"Issue not found"}),e.jsx(c,{variant:"secondary",size:"sm",onClick:()=>i("/command-post/issues"),children:"Back to Issues"})]})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(h,{title:s.identifier,breadcrumbs:[{label:"Command Post"},{label:"Issues",href:"/command-post/issues"},{label:s.identifier}],actions:e.jsxs(L,{to:"/command-post/issues",className:"flex items-center gap-1 text-xs text-text-muted hover:text-text",children:[e.jsx(R,{size:14})," Back"]})}),v&&e.jsx("div",{className:"bg-bg-tertiary/30 border border-border rounded-lg px-4 py-3 mb-4",children:e.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap font-mono leading-relaxed",children:v})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-4",children:[A?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{className:"flex-1 rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-base font-semibold text-text focus:outline-none focus:border-accent",value:m,onChange:t=>u(t.target.value),onKeyDown:t=>t.key==="Enter"&&N(),autoFocus:!0}),e.jsx(c,{size:"sm",onClick:N,children:"Save"}),e.jsx(c,{size:"sm",variant:"ghost",onClick:()=>{x(!1),u(s.title)},children:"Cancel"})]}):e.jsx("h2",{className:"text-lg font-semibold text-text cursor-pointer hover:text-accent transition-colors",onClick:()=>x(!0),title:"Click to edit",children:s.title}),s.description&&e.jsx("p",{className:"mt-3 text-sm text-text-secondary whitespace-pre-wrap",children:s.description})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:J.map(t=>e.jsx("button",{onClick:()=>z(t),disabled:s.status===t,className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors border ${s.status===t?"border-accent bg-accent/10 text-accent":"border-border bg-bg-tertiary text-text-muted hover:text-text hover:border-border-light"}`,children:t.replace(/_/g," ")},t))}),e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[e.jsx(_,{size:14,className:"text-accent"}),e.jsx("h3",{className:"text-sm font-semibold text-text",children:"Comments"}),e.jsxs("span",{className:"text-xs text-text-muted",children:["(",l.length,")"]})]}),l.length===0?e.jsx("div",{className:"py-8 text-center text-xs text-text-muted",children:"No comments yet"}):e.jsx("div",{className:"divide-y divide-border max-h-96 overflow-y-auto",children:l.map(t=>e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-xs font-medium text-text",children:t.authorAgentId??t.authorUser??"Unknown"}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:[b(t.createdAt)," ago"]})]}),e.jsx("p",{className:"text-sm text-text-secondary whitespace-pre-wrap",children:t.body})]},t.id))}),e.jsxs("div",{className:"border-t border-border px-4 py-3 flex items-center gap-2",children:[e.jsx("input",{className:"flex-1 rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:"Add a comment...",value:n,onChange:t=>j(t.target.value),onKeyDown:t=>t.key==="Enter"&&!t.shiftKey&&w()}),e.jsx(c,{size:"sm",onClick:w,loading:E,disabled:!n.trim(),icon:e.jsx(F,{size:14}),children:"Send"})]})]})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Status"}),e.jsx("div",{className:"mt-1",children:e.jsx(O,{status:s.status})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Priority"}),e.jsx("div",{className:`mt-1 text-sm font-medium capitalize ${K[s.priority]??"text-text"}`,children:s.priority})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Assignee"}),e.jsx("div",{className:"mt-1 text-sm text-text-secondary",children:s.assigneeAgentId??"Unassigned"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Identifier"}),e.jsx("div",{className:"mt-1 text-sm text-text font-mono",children:s.identifier})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Created"}),e.jsxs("div",{className:"mt-1 text-sm text-text-secondary",children:[b(s.createdAt)," ago"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Updated"}),e.jsxs("div",{className:"mt-1 text-sm text-text-secondary",children:[b(s.updatedAt)," ago"]})]})]})})]})]})}export{te as default};
@@ -1 +1 @@
1
- import{r as s,y as k,j as e,D as T,F as P}from"./index-BUCi9exS.js";import{B as u}from"./Input-CzDjGc5Y.js";import{S as D}from"./StatusBadge-Do8GEljT.js";import{P as z}from"./PageHeader-BXEGoqDX.js";import{E}from"./EmptyState-B3lWjJU-.js";import{T as L}from"./Tabs-B-g5Ghos.js";import{M}from"./Modal-DTzLKnUQ.js";import{S as $}from"./SkeletonLoader-DGQ0Q7vy.js";import{P as A}from"./plus-C63FIH_4.js";import{L as B}from"./list-todo-BYS3IIni.js";import"./clsx-B-dksMZM.js";import"./chevron-right-BANsqvxz.js";import"./proxy-CV0RFkNZ.js";function R(a){const r=Math.floor((Date.now()-new Date(a).getTime())/1e3);return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}const _={critical:"text-error",high:"text-warning",medium:"text-accent",low:"text-text-muted"},F=[{id:"all",label:"All"},{id:"backlog",label:"Backlog"},{id:"todo",label:"Todo"},{id:"in_progress",label:"In Progress"},{id:"in_review",label:"In Review"},{id:"done",label:"Done"},{id:"blocked",label:"Blocked"}];function ee(){const[a,r]=s.useState([]),[c,w]=s.useState(!0),[l,m]=s.useState(null),[o,y]=s.useState("all"),[v,i]=s.useState(!1),[n,h]=s.useState(""),[p,b]=s.useState("medium"),[f,g]=s.useState(""),[C,j]=s.useState(!1),d=s.useCallback(async()=>{try{const t=await k();r(t),m(null)}catch(t){m(t instanceof Error?t.message:"Failed to load issues")}w(!1)},[]);s.useEffect(()=>{d()},[d]);const N=async()=>{if(n.trim()){j(!0);try{await P({title:n,description:f,priority:p}),i(!1),h(""),g(""),b("medium"),await d()}catch{}j(!1)}},x=o==="all"?a:a.filter(t=>t.status===o),S=F.map(t=>({...t,count:t.id==="all"?a.length:a.filter(I=>I.status===t.id).length}));return e.jsxs("div",{className:"space-y-4",children:[e.jsx(z,{title:"Issues",breadcrumbs:[{label:"Command Post"},{label:"Issues"}],actions:e.jsx(u,{size:"sm",icon:e.jsx(A,{size:14}),onClick:()=>i(!0),children:"New Issue"})}),e.jsx(L,{tabs:S,activeTab:o,onChange:y}),c&&e.jsx($,{variant:"row",count:6}),l&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:l}),!c&&!l&&x.length===0&&e.jsx(E,{icon:e.jsx(B,{size:32}),title:"No issues",description:o==="all"?"Create your first issue to get started.":`No ${o.replace(/_/g," ")} issues.`,action:{label:"New Issue",onClick:()=>i(!0)}}),!c&&!l&&x.length>0&&e.jsx("div",{className:"divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden",children:x.map(t=>e.jsxs(T,{to:`/command-post/issues/${t.id}`,className:"flex items-center gap-3 px-4 py-3 hover:bg-bg-tertiary/50 transition-colors",children:[e.jsx(D,{status:t.status,variant:"dot",size:"sm"}),e.jsx("span",{className:"text-sm text-text flex-1 truncate",children:t.title}),e.jsx("span",{className:`text-xs font-medium uppercase ${_[t.priority]??"text-text-muted"}`,children:t.priority}),t.assigneeAgentId&&e.jsx("span",{className:"text-xs text-text-muted truncate max-w-[100px]",children:t.assigneeAgentId}),e.jsx("span",{className:"text-xs text-text-muted font-mono",children:t.identifier}),e.jsx("span",{className:"text-xs text-text-muted flex-shrink-0",children:R(t.updatedAt)})]},t.id))}),e.jsx(M,{open:v,onClose:()=>i(!1),title:"New Issue",footer:e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"secondary",size:"sm",onClick:()=>i(!1),children:"Cancel"}),e.jsx(u,{size:"sm",onClick:N,loading:C,disabled:!n.trim(),children:"Create"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Title"}),e.jsx("input",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:"Issue title...",value:n,onChange:t=>h(t.target.value),autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Priority"}),e.jsxs("select",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text focus:outline-none focus:border-accent",value:p,onChange:t=>b(t.target.value),children:[e.jsx("option",{value:"low",children:"Low"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"critical",children:"Critical"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Description"}),e.jsx("textarea",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent min-h-[80px] resize-y",placeholder:"Describe the issue...",value:f,onChange:t=>g(t.target.value)})]})]})})]})}export{ee as default};
1
+ import{r as s,y as k,j as e,D as T,F as P}from"./index-CmaGnHzR.js";import{B as u}from"./Input-Bzh0-cXU.js";import{S as D}from"./StatusBadge-e3tFf05B.js";import{P as z}from"./PageHeader-BJ1jHtOy.js";import{E}from"./EmptyState-iLOrbdU7.js";import{T as L}from"./Tabs-vGpPiBzr.js";import{M}from"./Modal-nvni-LGR.js";import{S as $}from"./SkeletonLoader-IpWkLmoy.js";import{P as A}from"./plus-DxgNIt8h.js";import{L as B}from"./list-todo-Cm4jNFHV.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DkIMxdwH.js";import"./proxy-KYomRnLW.js";function R(a){const r=Math.floor((Date.now()-new Date(a).getTime())/1e3);return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}const _={critical:"text-error",high:"text-warning",medium:"text-accent",low:"text-text-muted"},F=[{id:"all",label:"All"},{id:"backlog",label:"Backlog"},{id:"todo",label:"Todo"},{id:"in_progress",label:"In Progress"},{id:"in_review",label:"In Review"},{id:"done",label:"Done"},{id:"blocked",label:"Blocked"}];function ee(){const[a,r]=s.useState([]),[c,w]=s.useState(!0),[l,m]=s.useState(null),[o,y]=s.useState("all"),[v,i]=s.useState(!1),[n,h]=s.useState(""),[p,b]=s.useState("medium"),[f,g]=s.useState(""),[C,j]=s.useState(!1),d=s.useCallback(async()=>{try{const t=await k();r(t),m(null)}catch(t){m(t instanceof Error?t.message:"Failed to load issues")}w(!1)},[]);s.useEffect(()=>{d()},[d]);const N=async()=>{if(n.trim()){j(!0);try{await P({title:n,description:f,priority:p}),i(!1),h(""),g(""),b("medium"),await d()}catch{}j(!1)}},x=o==="all"?a:a.filter(t=>t.status===o),S=F.map(t=>({...t,count:t.id==="all"?a.length:a.filter(I=>I.status===t.id).length}));return e.jsxs("div",{className:"space-y-4",children:[e.jsx(z,{title:"Issues",breadcrumbs:[{label:"Command Post"},{label:"Issues"}],actions:e.jsx(u,{size:"sm",icon:e.jsx(A,{size:14}),onClick:()=>i(!0),children:"New Issue"})}),e.jsx(L,{tabs:S,activeTab:o,onChange:y}),c&&e.jsx($,{variant:"row",count:6}),l&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:l}),!c&&!l&&x.length===0&&e.jsx(E,{icon:e.jsx(B,{size:32}),title:"No issues",description:o==="all"?"Create your first issue to get started.":`No ${o.replace(/_/g," ")} issues.`,action:{label:"New Issue",onClick:()=>i(!0)}}),!c&&!l&&x.length>0&&e.jsx("div",{className:"divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden",children:x.map(t=>e.jsxs(T,{to:`/command-post/issues/${t.id}`,className:"flex items-center gap-3 px-4 py-3 hover:bg-bg-tertiary/50 transition-colors",children:[e.jsx(D,{status:t.status,variant:"dot",size:"sm"}),e.jsx("span",{className:"text-sm text-text flex-1 truncate",children:t.title}),e.jsx("span",{className:`text-xs font-medium uppercase ${_[t.priority]??"text-text-muted"}`,children:t.priority}),t.assigneeAgentId&&e.jsx("span",{className:"text-xs text-text-muted truncate max-w-[100px]",children:t.assigneeAgentId}),e.jsx("span",{className:"text-xs text-text-muted font-mono",children:t.identifier}),e.jsx("span",{className:"text-xs text-text-muted flex-shrink-0",children:R(t.updatedAt)})]},t.id))}),e.jsx(M,{open:v,onClose:()=>i(!1),title:"New Issue",footer:e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"secondary",size:"sm",onClick:()=>i(!1),children:"Cancel"}),e.jsx(u,{size:"sm",onClick:N,loading:C,disabled:!n.trim(),children:"Create"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Title"}),e.jsx("input",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:"Issue title...",value:n,onChange:t=>h(t.target.value),autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Priority"}),e.jsxs("select",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text focus:outline-none focus:border-accent",value:p,onChange:t=>b(t.target.value),children:[e.jsx("option",{value:"low",children:"Low"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"critical",children:"Critical"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Description"}),e.jsx("textarea",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent min-h-[80px] resize-y",placeholder:"Describe the issue...",value:f,onChange:t=>g(t.target.value)})]})]})})]})}export{ee as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CommandPostHub-Pq9lQMW5.js","assets/index-CmaGnHzR.js","assets/index-OZm1iJy9.css","assets/Input-Bzh0-cXU.js","assets/clsx-B-dksMZM.js","assets/Modal-nvni-LGR.js","assets/proxy-KYomRnLW.js","assets/InlineEditableField-DsVfGRH2.js","assets/check-Cxp-6q4k.js","assets/pencil-DAI6FtFQ.js","assets/Tooltip-DNc5AWi0.js","assets/approvalHeadline-DB9SgR-9.js","assets/chevron-right-DkIMxdwH.js","assets/bot-DSGZRM5O.js","assets/pause-DS5xgDMT.js","assets/dollar-sign-DMXBeaTj.js","assets/git-branch-C0Qk52W8.js","assets/chart-column-D6yK9tts.js","assets/clock-BS8fh7Rt.js","assets/message-square-BrWLAovN.js","assets/file-text-CUkSytWL.js","assets/terminal-CZ77Swtc.js","assets/refresh-cw-BFBnnWj8.js","assets/circle-stop-DOe0OacY.js","assets/send-Bb57UxT7.js","assets/plus-DxgNIt8h.js","assets/trash-2-C5KNXS-O.js","assets/CPIssues-wgjI2eqS.js","assets/StatusBadge-e3tFf05B.js","assets/PageHeader-BJ1jHtOy.js","assets/EmptyState-iLOrbdU7.js","assets/Tabs-vGpPiBzr.js","assets/SkeletonLoader-IpWkLmoy.js","assets/list-todo-Cm4jNFHV.js","assets/CPIssueDetail-dTU59sgQ.js","assets/arrow-left-CW5NV7E0.js","assets/CPAgents-GRBrDd6c.js","assets/CPAgentDetail-Bd8lKqcL.js","assets/circle-check-big-DnJPBAGU.js","assets/save--wCYre_u.js","assets/CPApprovals-DdLaCgJZ.js","assets/shield-check-B24N03VU.js","assets/CPActivity-em82PTiQ.js","assets/CPGoals-Wr1tCn6y.js","assets/CPRuns-B3sdo5g2.js","assets/play-DxBy837b.js","assets/CPCosts-Cm8Hv9fv.js","assets/CPOrg-eT6LNmyy.js","assets/network-CrQn1GKv.js","assets/CPFiles-DxMn1x2m.js","assets/folder-BDwoUobN.js","assets/flask-conical-BS4cuENu.js","assets/search-DOD1aOm8.js"])))=>i.map(i=>d[i]);
2
+ import{j as t,r as s,q as _,v as e,N as l,_ as o}from"./index-CmaGnHzR.js";const a=s.lazy(()=>o(()=>import("./CommandPostHub-Pq9lQMW5.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]))),i=s.lazy(()=>o(()=>import("./CPIssues-wgjI2eqS.js"),__vite__mapDeps([27,1,2,3,4,28,29,12,30,31,5,6,32,25,33]))),r=s.lazy(()=>o(()=>import("./CPIssueDetail-dTU59sgQ.js"),__vite__mapDeps([34,1,2,3,4,28,29,12,32,35,19,24]))),n=s.lazy(()=>o(()=>import("./CPAgents-GRBrDd6c.js"),__vite__mapDeps([36,1,2,3,4,28,29,12,30,32]))),x=s.lazy(()=>o(()=>import("./CPAgentDetail-Bd8lKqcL.js"),__vite__mapDeps([37,1,2,3,4,28,29,12,30,31,32,35,38,15,18,39]))),m=s.lazy(()=>o(()=>import("./CPApprovals-DdLaCgJZ.js"),__vite__mapDeps([40,1,2,3,4,28,29,12,30,31,32,11,41,8]))),j=s.lazy(()=>o(()=>import("./CPActivity-em82PTiQ.js"),__vite__mapDeps([42,1,2,3,4,29,12,30,31,32,41,15,13]))),p=s.lazy(()=>o(()=>import("./CPGoals-Wr1tCn6y.js"),__vite__mapDeps([43,1,2,3,4,28,29,12,30,5,6,32,25,26]))),u=s.lazy(()=>o(()=>import("./CPRuns-B3sdo5g2.js"),__vite__mapDeps([44,1,2,3,4,28,29,12,30,32,45]))),c=s.lazy(()=>o(()=>import("./CPCosts-Cm8Hv9fv.js"),__vite__mapDeps([46,1,2,3,4,28,29,12,30,5,6,32,25,15,26]))),d=s.lazy(()=>o(()=>import("./CPOrg-eT6LNmyy.js"),__vite__mapDeps([47,1,2,3,4,28,29,12,30,32,48,26]))),P=s.lazy(()=>o(()=>import("./CPFiles-DxMn1x2m.js"),__vite__mapDeps([49,1,2,50,51,52,22,20])));function E(){return t.jsx("div",{className:"flex items-center justify-center h-full text-sm",style:{color:"#c4b49a"},children:"Loading..."})}function h(){return t.jsx("div",{className:"h-full overflow-hidden",children:t.jsx("div",{className:"h-full overflow-auto",children:t.jsx(s.Suspense,{fallback:t.jsx(E,{}),children:t.jsxs(_,{children:[t.jsx(e,{index:!0,element:t.jsx(a,{})}),t.jsx(e,{path:"dashboard",element:t.jsx(a,{})}),t.jsx(e,{path:"issues",element:t.jsx(i,{})}),t.jsx(e,{path:"issues/:id",element:t.jsx(r,{})}),t.jsx(e,{path:"agents",element:t.jsx(n,{})}),t.jsx(e,{path:"agents/:id",element:t.jsx(x,{})}),t.jsx(e,{path:"approvals",element:t.jsx(m,{})}),t.jsx(e,{path:"activity",element:t.jsx(j,{})}),t.jsx(e,{path:"goals",element:t.jsx(p,{})}),t.jsx(e,{path:"runs",element:t.jsx(u,{})}),t.jsx(e,{path:"costs",element:t.jsx(c,{})}),t.jsx(e,{path:"org",element:t.jsx(d,{})}),t.jsx(e,{path:"files",element:t.jsx(P,{})}),t.jsx(e,{path:"*",element:t.jsx(l,{to:"/command-post",replace:!0})})]})})})})}export{h as CPLayout,h as default};
@@ -1,4 +1,4 @@
1
- import{r as i,a0 as u,a1 as b,j as e}from"./index-BUCi9exS.js";import"./Input-CzDjGc5Y.js";import{S as j}from"./StatusBadge-Do8GEljT.js";import{P as f}from"./PageHeader-BXEGoqDX.js";import{E as v}from"./EmptyState-B3lWjJU-.js";import{S as y}from"./SkeletonLoader-DGQ0Q7vy.js";import{N}from"./network-DPPIz6Io.js";import{T as C}from"./trash-2-BscnSMjc.js";import"./clsx-B-dksMZM.js";import"./chevron-right-BANsqvxz.js";function w(t){const s=t.split("/");return s[s.length-1]}function x({node:t,depth:s,onDelete:o}){const l=t.role==="Company";return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start gap-3 py-2",style:{paddingLeft:`${s*32+16}px`},children:[s>0&&e.jsx("div",{className:"flex items-center gap-0 -ml-5",children:e.jsx("div",{className:"w-4 border-t border-border-light"})}),e.jsxs("div",{className:`border rounded-lg p-3 flex-1 max-w-sm transition-colors group ${l?"bg-accent/5 border-accent/20 hover:border-accent/40":"bg-bg-secondary border-border hover:border-border-light"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-text",children:t.name}),e.jsx(j,{status:t.status,size:"sm"})]}),l&&o&&e.jsx("button",{onClick:a=>{a.stopPropagation(),o(t.id,t.name)},className:"opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-error/20 text-text-muted hover:text-error transition-all",title:`Delete ${t.name}`,children:e.jsx(C,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted",children:[l&&e.jsx("span",{className:"text-accent text-[9px] font-medium uppercase tracking-wider",children:"Company"}),!l&&e.jsx("span",{className:"capitalize",children:t.role}),t.title&&e.jsx("span",{children:t.title}),t.model&&e.jsx("span",{children:w(t.model)})]}),l&&t.reports.length>0&&e.jsxs("div",{className:"text-[10px] text-text-muted mt-1",children:[t.reports.length," agent",t.reports.length!==1?"s":""]})]})]}),t.reports.length>0&&e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute border-l border-border-light",style:{left:`${(s+1)*32+16}px`,top:0,height:"100%"}}),t.reports.map(a=>e.jsx(x,{node:a,depth:s+1,onDelete:o},a.id))]})]})}function A(){const[t,s]=i.useState([]),[o,l]=i.useState(!0),[a,c]=i.useState(null),[p,m]=i.useState(null),n=i.useCallback(async()=>{try{const r=await u();s(r),c(null)}catch(r){c(r instanceof Error?r.message:"Failed to load org chart")}l(!1)},[]);i.useEffect(()=>{n()},[n]);const g=i.useCallback(async(r,h)=>{if(confirm(`Delete company "${h}"?
1
+ import{r as i,a0 as u,a1 as b,j as e}from"./index-CmaGnHzR.js";import"./Input-Bzh0-cXU.js";import{S as j}from"./StatusBadge-e3tFf05B.js";import{P as f}from"./PageHeader-BJ1jHtOy.js";import{E as v}from"./EmptyState-iLOrbdU7.js";import{S as y}from"./SkeletonLoader-IpWkLmoy.js";import{N}from"./network-CrQn1GKv.js";import{T as C}from"./trash-2-C5KNXS-O.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DkIMxdwH.js";function w(t){const s=t.split("/");return s[s.length-1]}function x({node:t,depth:s,onDelete:o}){const l=t.role==="Company";return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start gap-3 py-2",style:{paddingLeft:`${s*32+16}px`},children:[s>0&&e.jsx("div",{className:"flex items-center gap-0 -ml-5",children:e.jsx("div",{className:"w-4 border-t border-border-light"})}),e.jsxs("div",{className:`border rounded-lg p-3 flex-1 max-w-sm transition-colors group ${l?"bg-accent/5 border-accent/20 hover:border-accent/40":"bg-bg-secondary border-border hover:border-border-light"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-text",children:t.name}),e.jsx(j,{status:t.status,size:"sm"})]}),l&&o&&e.jsx("button",{onClick:a=>{a.stopPropagation(),o(t.id,t.name)},className:"opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-error/20 text-text-muted hover:text-error transition-all",title:`Delete ${t.name}`,children:e.jsx(C,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted",children:[l&&e.jsx("span",{className:"text-accent text-[9px] font-medium uppercase tracking-wider",children:"Company"}),!l&&e.jsx("span",{className:"capitalize",children:t.role}),t.title&&e.jsx("span",{children:t.title}),t.model&&e.jsx("span",{children:w(t.model)})]}),l&&t.reports.length>0&&e.jsxs("div",{className:"text-[10px] text-text-muted mt-1",children:[t.reports.length," agent",t.reports.length!==1?"s":""]})]})]}),t.reports.length>0&&e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute border-l border-border-light",style:{left:`${(s+1)*32+16}px`,top:0,height:"100%"}}),t.reports.map(a=>e.jsx(x,{node:a,depth:s+1,onDelete:o},a.id))]})]})}function A(){const[t,s]=i.useState([]),[o,l]=i.useState(!0),[a,c]=i.useState(null),[p,m]=i.useState(null),n=i.useCallback(async()=>{try{const r=await u();s(r),c(null)}catch(r){c(r instanceof Error?r.message:"Failed to load org chart")}l(!1)},[]);i.useEffect(()=>{n()},[n]);const g=i.useCallback(async(r,h)=>{if(confirm(`Delete company "${h}"?
2
2
 
3
3
  This will:
4
4
  • Stop the heartbeat runner
@@ -1 +1 @@
1
- import{r as a,Y as h,$ as f,j as e}from"./index-BUCi9exS.js";import"./Input-CzDjGc5Y.js";import{S as j}from"./StatusBadge-Do8GEljT.js";import{P as g}from"./PageHeader-BXEGoqDX.js";import{E as y}from"./EmptyState-B3lWjJU-.js";import{S as b}from"./SkeletonLoader-DGQ0Q7vy.js";import{P as N}from"./play-C5er2jT3.js";import"./clsx-B-dksMZM.js";import"./chevron-right-BANsqvxz.js";function v(s){const r=Math.floor((Date.now()-new Date(s).getTime())/1e3);return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}function S(s){return s?s<1e3?`${s}ms`:s<6e4?`${(s/1e3).toFixed(1)}s`:`${(s/6e4).toFixed(1)}m`:"-"}function D(){const[s,r]=a.useState([]),[x,m]=a.useState([]),[n,d]=a.useState(!0),[o,i]=a.useState(null),[l,u]=a.useState(""),c=a.useCallback(async()=>{try{const[t,p]=await Promise.all([h(l||void 0,100),f()]);r(t),m(p),i(null)}catch(t){i(t instanceof Error?t.message:"Failed to load runs")}d(!1)},[l]);return a.useEffect(()=>{d(!0),c()},[c]),e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{title:"Runs",breadcrumbs:[{label:"Command Post"},{label:"Runs"}],actions:e.jsxs("select",{className:"rounded-lg border border-border bg-bg-tertiary px-3 py-1.5 text-xs text-text focus:outline-none focus:border-accent",value:l,onChange:t=>u(t.target.value),children:[e.jsx("option",{value:"",children:"All agents"}),x.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]})}),n&&e.jsx(b,{variant:"row",count:8}),o&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:o}),!n&&!o&&s.length===0&&e.jsx(y,{icon:e.jsx(N,{size:32}),title:"No runs",description:"Agent runs will appear here as they execute."}),!n&&!o&&s.length>0&&e.jsx("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left",children:[e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Agent"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Source"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Duration"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Tools"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Started"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:s.map(t=>e.jsxs("tr",{className:"hover:bg-bg-tertiary/50 transition-colors",children:[e.jsx("td",{className:"px-4 py-2.5 text-text font-medium",children:t.agentId}),e.jsx("td",{className:"px-4 py-2.5 text-text-secondary capitalize",children:t.source}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(j,{status:t.status,size:"sm"})}),e.jsx("td",{className:"px-4 py-2.5 text-text-secondary font-mono",children:S(t.durationMs)}),e.jsx("td",{className:"px-4 py-2.5 text-text-muted",children:t.toolsUsed.length>0?e.jsxs("span",{title:t.toolsUsed.join(", "),children:[t.toolsUsed.length," tool",t.toolsUsed.length!==1?"s":""]}):"-"}),e.jsxs("td",{className:"px-4 py-2.5 text-text-muted",children:[v(t.startedAt)," ago"]})]},t.id))})]})})})]})}export{D as default};
1
+ import{r as a,Y as h,$ as f,j as e}from"./index-CmaGnHzR.js";import"./Input-Bzh0-cXU.js";import{S as j}from"./StatusBadge-e3tFf05B.js";import{P as g}from"./PageHeader-BJ1jHtOy.js";import{E as y}from"./EmptyState-iLOrbdU7.js";import{S as b}from"./SkeletonLoader-IpWkLmoy.js";import{P as N}from"./play-DxBy837b.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DkIMxdwH.js";function v(s){const r=Math.floor((Date.now()-new Date(s).getTime())/1e3);return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}function S(s){return s?s<1e3?`${s}ms`:s<6e4?`${(s/1e3).toFixed(1)}s`:`${(s/6e4).toFixed(1)}m`:"-"}function D(){const[s,r]=a.useState([]),[x,m]=a.useState([]),[n,d]=a.useState(!0),[o,i]=a.useState(null),[l,u]=a.useState(""),c=a.useCallback(async()=>{try{const[t,p]=await Promise.all([h(l||void 0,100),f()]);r(t),m(p),i(null)}catch(t){i(t instanceof Error?t.message:"Failed to load runs")}d(!1)},[l]);return a.useEffect(()=>{d(!0),c()},[c]),e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{title:"Runs",breadcrumbs:[{label:"Command Post"},{label:"Runs"}],actions:e.jsxs("select",{className:"rounded-lg border border-border bg-bg-tertiary px-3 py-1.5 text-xs text-text focus:outline-none focus:border-accent",value:l,onChange:t=>u(t.target.value),children:[e.jsx("option",{value:"",children:"All agents"}),x.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]})}),n&&e.jsx(b,{variant:"row",count:8}),o&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:o}),!n&&!o&&s.length===0&&e.jsx(y,{icon:e.jsx(N,{size:32}),title:"No runs",description:"Agent runs will appear here as they execute."}),!n&&!o&&s.length>0&&e.jsx("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left",children:[e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Agent"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Source"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Duration"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Tools"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Started"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:s.map(t=>e.jsxs("tr",{className:"hover:bg-bg-tertiary/50 transition-colors",children:[e.jsx("td",{className:"px-4 py-2.5 text-text font-medium",children:t.agentId}),e.jsx("td",{className:"px-4 py-2.5 text-text-secondary capitalize",children:t.source}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(j,{status:t.status,size:"sm"})}),e.jsx("td",{className:"px-4 py-2.5 text-text-secondary font-mono",children:S(t.durationMs)}),e.jsx("td",{className:"px-4 py-2.5 text-text-muted",children:t.toolsUsed.length>0?e.jsxs("span",{title:t.toolsUsed.join(", "),children:[t.toolsUsed.length," tool",t.toolsUsed.length!==1?"s":""]}):"-"}),e.jsxs("td",{className:"px-4 py-2.5 text-text-muted",children:[v(t.startedAt)," ago"]})]},t.id))})]})})})]})}export{D as default};
@@ -1,11 +1,11 @@
1
- import{c as v,r as n,bK as $,bL as A,j as e,i as L,k as D,l as q,bM as _,bN as I,bO as O,bP as z}from"./index-BUCi9exS.js";import{R as b}from"./refresh-cw-D7RrQJQl.js";import{S as G}from"./send-DU7Jy0ph.js";import{L as H}from"./lightbulb-BvNv5S2z.js";import{C as F}from"./clock-DXDS0v3F.js";import{M as B}from"./message-square-I2Wa53bg.js";/**
1
+ import{c as v,r as n,bP as A,bQ as M,j as e,i as D,k as L,l as q,bR as _,bS as I,bT as O,bU as z}from"./index-CmaGnHzR.js";import{R as b}from"./refresh-cw-BFBnnWj8.js";import{S as G}from"./send-Bb57UxT7.js";import{L as H}from"./lightbulb-Bj6cj6Xl.js";import{C as F}from"./clock-BS8fh7Rt.js";import{M as Q}from"./message-square-BrWLAovN.js";/**
2
2
  * @license lucide-react v0.513.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const K=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],Q=v("share-2",K);/**
6
+ */const U=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],B=v("share-2",U);/**
7
7
  * @license lucide-react v0.513.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const U=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],V=v("type",U);function N(r){const l=Math.floor((Date.now()-new Date(r).getTime())/1e3);return l<60?`${l}s`:l<3600?`${Math.floor(l/60)}m`:l<86400?`${Math.floor(l/3600)}h`:`${Math.floor(l/86400)}d`}const w={activity:"Activity",spotlight:"Spotlight",stats:"Stats",tips:"Tips",promo:"Promo",usecase:"Use Case",eli5:"ELI5"},x={activity:"var(--color-accent-hover)",spotlight:"var(--color-emerald)",stats:"var(--color-cyan)",tips:"#fbbf24",promo:"#f472b6",usecase:"var(--color-purple-light)",eli5:"#fb923c"};function re(){const[r,l]=n.useState(null),[k,C]=n.useState(!0),[u,i]=n.useState(null),[c,g]=n.useState(""),[y,f]=n.useState(!1),[j,m]=n.useState(null),[p,d]=n.useState(null),o=n.useCallback(async()=>{try{i(null);const t=await $();l(t)}catch(t){i(t instanceof Error?t.message:"Failed to load social state")}finally{C(!1)}},[]),h=n.useCallback(async()=>{try{const a=(await A()).recentTopics;if(a.length===0){m(null);return}const M=a.slice(0,3).map(R=>`"${R.content.split(/\s+/).slice(0,6).join(" ")}..."`).join(", ");m(`💡 Recent social posts: ${M}. Consider a follow-up on a related but fresh topic.`)}catch{m(null)}},[]);n.useEffect(()=>{o(),h()},[o,h]);const S=async()=>{if(!r)return;const t=!r.autopilot.enabled;try{await _(t),l(a=>a&&{...a,autopilot:{...a.autopilot,enabled:t}})}catch(a){i(a instanceof Error?a.message:"Toggle failed")}},T=async()=>{if(c.trim()){f(!0);try{const t=await I(c.trim());t.success?(g(""),await o(),await h()):i(t.error||t.skipped||"Post failed")}catch(t){i(t instanceof Error?t.message:"Post failed")}finally{f(!1)}}},P=async t=>{d(t);try{await O(t),await o()}catch(a){i(a instanceof Error?a.message:"Approve failed")}finally{d(null)}},E=async t=>{d(t);try{await z(t),await o()}catch(a){i(a instanceof Error?a.message:"Reject failed")}finally{d(null)}};if(k)return e.jsxs("div",{className:"flex items-center justify-center py-20",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-indigo-500/30 border-t-indigo-500 rounded-full animate-spin"}),e.jsx("span",{className:"ml-3 text-sm text-text-muted",children:"Loading social media…"})]});const s=r==null?void 0:r.autopilot;return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-pink-500/10 border border-pink-500/20",children:e.jsx(Q,{className:"h-4 w-4 text-pink-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-white",children:"Social Media"}),e.jsx("p",{className:"text-[11px] text-text-muted",children:"Facebook autopilot, drafts, and post history"})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 rounded-lg bg-bg-tertiary px-3 py-1.5 text-[11px] text-text-muted hover:bg-bg-tertiary transition-colors border border-border",children:[e.jsx(b,{className:"h-3 w-3"})," Refresh"]})})]}),u&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-xs text-red-300",children:[e.jsx(L,{className:"h-4 w-4 shrink-0"}),u]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Autopilot"}),e.jsx("button",{onClick:S,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${s!=null&&s.enabled?"bg-pink-500":"bg-white/10"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${s!=null&&s.enabled?"translate-x-4.5":"translate-x-1"}`})})]}),e.jsx("p",{className:`mt-1 text-sm font-semibold ${s!=null&&s.enabled?"text-pink-400":"text-text-muted"}`,children:s!=null&&s.enabled?"Enabled":"Paused"})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Posts Today"}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-xl font-bold text-white",children:(s==null?void 0:s.postsToday)??0}),e.jsxs("p",{className:"text-[11px] text-text-muted",children:["/ ",(s==null?void 0:s.maxPostsPerDay)??6]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Replies Today"}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-xl font-bold text-white",children:(s==null?void 0:s.repliesToday)??0}),e.jsx("p",{className:"text-[11px] text-text-muted",children:"/ 10"})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Next Type"}),e.jsx("p",{className:"mt-1 text-sm font-semibold",style:{color:x[(s==null?void 0:s.nextContentType)||"activity"]||"#fff"},children:w[(s==null?void 0:s.nextContentType)||"activity"]||(s==null?void 0:s.nextContentType)})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-4 w-4 text-pink-400"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Compose Post"})]}),e.jsx("textarea",{value:c,onChange:t=>g(t.target.value),placeholder:"What's on your mind?",rows:3,className:"w-full rounded-lg border border-border bg-black/20 px-3 py-2 text-sm text-white placeholder:text-text-muted focus:border-pink-500/50 focus:outline-none resize-none"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:`text-[11px] ${c.length>280?"text-red-400":"text-text-muted"}`,children:[c.length," chars"]}),e.jsxs("button",{onClick:T,disabled:y||!c.trim(),className:"flex items-center gap-1.5 rounded-lg bg-pink-500/20 px-4 py-1.5 text-xs font-medium text-pink-300 hover:bg-pink-500/30 disabled:opacity-40 disabled:cursor-not-allowed transition-colors border border-pink-500/20",children:[y?e.jsx(b,{className:"h-3 w-3 animate-spin"}):e.jsx(G,{className:"h-3 w-3"}),"Post Now"]})]}),j&&e.jsxs("div",{className:"flex items-start gap-2 rounded-lg bg-amber-500/5 border border-amber-500/10 px-3 py-2",children:[e.jsx(H,{className:"h-3.5 w-3.5 text-amber-400 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-[11px] text-amber-200/70 leading-relaxed",children:j})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"h-4 w-4 text-text-muted"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Draft Queue"}),e.jsxs("span",{className:"text-[11px] text-text-muted ml-1",children:[(r==null?void 0:r.queue.length)??0," pending"]})]}),r!=null&&r.queue&&r.queue.length>0?e.jsx("div",{className:"space-y-2",children:r.queue.map(t=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-bg-secondary/30 px-4 py-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm text-text break-words",children:t.content}),e.jsxs("p",{className:"mt-1 text-[10px] text-text-muted",children:[t.method," · ",N(t.createdAt)," ago"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsxs("button",{onClick:()=>P(t.id),disabled:p===t.id,className:"flex items-center gap-1 rounded-md bg-emerald-500/10 px-2.5 py-1 text-[11px] text-emerald-300 hover:bg-emerald-500/20 disabled:opacity-40 transition-colors border border-emerald-500/15",children:[p===t.id?e.jsx(b,{className:"h-3 w-3 animate-spin"}):e.jsx(D,{className:"h-3 w-3"}),"Approve"]}),e.jsxs("button",{onClick:()=>E(t.id),disabled:p===t.id,className:"flex items-center gap-1 rounded-md bg-red-500/10 px-2.5 py-1 text-[11px] text-red-300 hover:bg-red-500/20 disabled:opacity-40 transition-colors border border-red-500/15",children:[e.jsx(q,{className:"h-3 w-3"}),"Reject"]})]})]},t.id))}):e.jsx("div",{className:"rounded-lg border border-border bg-bg-secondary/30 px-4 py-6 text-center",children:e.jsx("p",{className:"text-xs text-text-muted",children:"No pending drafts in the queue."})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{className:"h-4 w-4 text-text-muted"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Recent Posts"}),e.jsxs("span",{className:"text-[11px] text-text-muted ml-1",children:[(r==null?void 0:r.recentPosts.length)??0," tracked"]})]}),r!=null&&r.recentPosts&&r.recentPosts.length>0?e.jsx("div",{className:"space-y-2",children:r.recentPosts.map((t,a)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-bg-secondary/30 px-4 py-3",children:[e.jsx("div",{className:"mt-0.5 h-2 w-2 rounded-full shrink-0",style:{backgroundColor:x[t.type]||"#64748b"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded",style:{backgroundColor:(x[t.type]||"#64748b")+"20",color:x[t.type]||"#94a3b8"},children:w[t.type]||t.type}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:[N(t.date)," ago"]})]}),e.jsx("p",{className:"text-sm text-text-secondary break-words",children:t.content||"(content not stored)"}),t.postId&&e.jsxs("p",{className:"mt-1 text-[10px] text-text-muted font-mono",children:["ID: ",t.postId]})]})]},a))}):e.jsx("div",{className:"rounded-lg border border-border bg-bg-secondary/30 px-4 py-6 text-center",children:e.jsx("p",{className:"text-xs text-text-muted",children:"No posts in history yet."})})]})]})}export{re as default};
11
+ */const V=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],W=v("type",V);function N(r){const l=Math.floor((Date.now()-new Date(r).getTime())/1e3);return l<60?`${l}s`:l<3600?`${Math.floor(l/60)}m`:l<86400?`${Math.floor(l/3600)}h`:`${Math.floor(l/86400)}d`}const w={activity:"Activity",spotlight:"Spotlight",stats:"Stats",tips:"Tips",promo:"Promo",usecase:"Use Case",eli5:"ELI5"},x={activity:"var(--color-accent-hover)",spotlight:"var(--color-emerald)",stats:"var(--color-cyan)",tips:"#fbbf24",promo:"#f472b6",usecase:"var(--color-purple-light)",eli5:"#fb923c"};function re(){const[r,l]=n.useState(null),[k,C]=n.useState(!0),[u,i]=n.useState(null),[c,g]=n.useState(""),[y,f]=n.useState(!1),[j,m]=n.useState(null),[p,d]=n.useState(null),o=n.useCallback(async()=>{try{i(null);const t=await A();l(t)}catch(t){i(t instanceof Error?t.message:"Failed to load social state")}finally{C(!1)}},[]),h=n.useCallback(async()=>{try{const a=(await M()).recentTopics;if(a.length===0){m(null);return}const R=a.slice(0,3).map($=>`"${$.content.split(/\s+/).slice(0,6).join(" ")}..."`).join(", ");m(`💡 Recent social posts: ${R}. Consider a follow-up on a related but fresh topic.`)}catch{m(null)}},[]);n.useEffect(()=>{o(),h()},[o,h]);const S=async()=>{if(!r)return;const t=!r.autopilot.enabled;try{await _(t),l(a=>a&&{...a,autopilot:{...a.autopilot,enabled:t}})}catch(a){i(a instanceof Error?a.message:"Toggle failed")}},T=async()=>{if(c.trim()){f(!0);try{const t=await I(c.trim());t.success?(g(""),await o(),await h()):i(t.error||t.skipped||"Post failed")}catch(t){i(t instanceof Error?t.message:"Post failed")}finally{f(!1)}}},P=async t=>{d(t);try{await O(t),await o()}catch(a){i(a instanceof Error?a.message:"Approve failed")}finally{d(null)}},E=async t=>{d(t);try{await z(t),await o()}catch(a){i(a instanceof Error?a.message:"Reject failed")}finally{d(null)}};if(k)return e.jsxs("div",{className:"flex items-center justify-center py-20",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-indigo-500/30 border-t-indigo-500 rounded-full animate-spin"}),e.jsx("span",{className:"ml-3 text-sm text-text-muted",children:"Loading social media…"})]});const s=r==null?void 0:r.autopilot;return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-pink-500/10 border border-pink-500/20",children:e.jsx(B,{className:"h-4 w-4 text-pink-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-white",children:"Social Media"}),e.jsx("p",{className:"text-[11px] text-text-muted",children:"Facebook autopilot, drafts, and post history"})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 rounded-lg bg-bg-tertiary px-3 py-1.5 text-[11px] text-text-muted hover:bg-bg-tertiary transition-colors border border-border",children:[e.jsx(b,{className:"h-3 w-3"})," Refresh"]})})]}),u&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-xs text-red-300",children:[e.jsx(D,{className:"h-4 w-4 shrink-0"}),u]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Autopilot"}),e.jsx("button",{onClick:S,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${s!=null&&s.enabled?"bg-pink-500":"bg-white/10"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${s!=null&&s.enabled?"translate-x-4.5":"translate-x-1"}`})})]}),e.jsx("p",{className:`mt-1 text-sm font-semibold ${s!=null&&s.enabled?"text-pink-400":"text-text-muted"}`,children:s!=null&&s.enabled?"Enabled":"Paused"})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Posts Today"}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-xl font-bold text-white",children:(s==null?void 0:s.postsToday)??0}),e.jsxs("p",{className:"text-[11px] text-text-muted",children:["/ ",(s==null?void 0:s.maxPostsPerDay)??6]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Replies Today"}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-xl font-bold text-white",children:(s==null?void 0:s.repliesToday)??0}),e.jsx("p",{className:"text-[11px] text-text-muted",children:"/ 10"})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Next Type"}),e.jsx("p",{className:"mt-1 text-sm font-semibold",style:{color:x[(s==null?void 0:s.nextContentType)||"activity"]||"#fff"},children:w[(s==null?void 0:s.nextContentType)||"activity"]||(s==null?void 0:s.nextContentType)})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{className:"h-4 w-4 text-pink-400"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Compose Post"})]}),e.jsx("textarea",{value:c,onChange:t=>g(t.target.value),placeholder:"What's on your mind?",rows:3,className:"w-full rounded-lg border border-border bg-black/20 px-3 py-2 text-sm text-white placeholder:text-text-muted focus:border-pink-500/50 focus:outline-none resize-none"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:`text-[11px] ${c.length>280?"text-red-400":"text-text-muted"}`,children:[c.length," chars"]}),e.jsxs("button",{onClick:T,disabled:y||!c.trim(),className:"flex items-center gap-1.5 rounded-lg bg-pink-500/20 px-4 py-1.5 text-xs font-medium text-pink-300 hover:bg-pink-500/30 disabled:opacity-40 disabled:cursor-not-allowed transition-colors border border-pink-500/20",children:[y?e.jsx(b,{className:"h-3 w-3 animate-spin"}):e.jsx(G,{className:"h-3 w-3"}),"Post Now"]})]}),j&&e.jsxs("div",{className:"flex items-start gap-2 rounded-lg bg-amber-500/5 border border-amber-500/10 px-3 py-2",children:[e.jsx(H,{className:"h-3.5 w-3.5 text-amber-400 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-[11px] text-amber-200/70 leading-relaxed",children:j})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"h-4 w-4 text-text-muted"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Draft Queue"}),e.jsxs("span",{className:"text-[11px] text-text-muted ml-1",children:[(r==null?void 0:r.queue.length)??0," pending"]})]}),r!=null&&r.queue&&r.queue.length>0?e.jsx("div",{className:"space-y-2",children:r.queue.map(t=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-bg-secondary/30 px-4 py-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm text-text break-words",children:t.content}),e.jsxs("p",{className:"mt-1 text-[10px] text-text-muted",children:[t.method," · ",N(t.createdAt)," ago"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsxs("button",{onClick:()=>P(t.id),disabled:p===t.id,className:"flex items-center gap-1 rounded-md bg-emerald-500/10 px-2.5 py-1 text-[11px] text-emerald-300 hover:bg-emerald-500/20 disabled:opacity-40 transition-colors border border-emerald-500/15",children:[p===t.id?e.jsx(b,{className:"h-3 w-3 animate-spin"}):e.jsx(L,{className:"h-3 w-3"}),"Approve"]}),e.jsxs("button",{onClick:()=>E(t.id),disabled:p===t.id,className:"flex items-center gap-1 rounded-md bg-red-500/10 px-2.5 py-1 text-[11px] text-red-300 hover:bg-red-500/20 disabled:opacity-40 transition-colors border border-red-500/15",children:[e.jsx(q,{className:"h-3 w-3"}),"Reject"]})]})]},t.id))}):e.jsx("div",{className:"rounded-lg border border-border bg-bg-secondary/30 px-4 py-6 text-center",children:e.jsx("p",{className:"text-xs text-text-muted",children:"No pending drafts in the queue."})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4 text-text-muted"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Recent Posts"}),e.jsxs("span",{className:"text-[11px] text-text-muted ml-1",children:[(r==null?void 0:r.recentPosts.length)??0," tracked"]})]}),r!=null&&r.recentPosts&&r.recentPosts.length>0?e.jsx("div",{className:"space-y-2",children:r.recentPosts.map((t,a)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-bg-secondary/30 px-4 py-3",children:[e.jsx("div",{className:"mt-0.5 h-2 w-2 rounded-full shrink-0",style:{backgroundColor:x[t.type]||"#64748b"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded",style:{backgroundColor:(x[t.type]||"#64748b")+"20",color:x[t.type]||"#94a3b8"},children:w[t.type]||t.type}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:[N(t.date)," ago"]})]}),e.jsx("p",{className:"text-sm text-text-secondary break-words",children:t.content||"(content not stored)"}),t.postId&&e.jsxs("p",{className:"mt-1 text-[10px] text-text-muted font-mono",children:["ID: ",t.postId]})]})]},a))}):e.jsx("div",{className:"rounded-lg border border-border bg-bg-secondary/30 px-4 py-6 text-center",children:e.jsx("p",{className:"text-xs text-text-muted",children:"No posts in history yet."})})]})]})}export{re as default};
@@ -1 +1 @@
1
- import{r as i,j as t,b as N}from"./index-BUCi9exS.js";import"./Input-CzDjGc5Y.js";import{P as k}from"./PageHeader-BXEGoqDX.js";import{C as S}from"./circle-stop-AU_Yx5I3.js";import{M as C}from"./mic-CLF69wwf.js";import{V as b}from"./volume-2-lPPI8coL.js";import{S as T}from"./send-DU7Jy0ph.js";import"./clsx-B-dksMZM.js";import"./chevron-right-BANsqvxz.js";async function R(o,l){const c=await N(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!c.ok)throw new Error(`HTTP ${c.status}`);return c.json()}function I(){const[o,l]=i.useState(""),[c,u]=i.useState([]),[h,d]=i.useState(!1),[p,j]=i.useState(!0),m=i.useRef(null),a=i.useRef(null);i.useEffect(()=>{const e=window.SpeechRecognition||window.webkitSpeechRecognition;if(e){const s=new e;s.lang="en-US",s.continuous=!1,s.interimResults=!1,s.onresult=r=>{var n,g;const x=((g=(n=r.results[0])==null?void 0:n[0])==null?void 0:g.transcript)||"";l(x),d(!1)},s.onerror=()=>d(!1),s.onend=()=>d(!1),m.current=s}},[]);const f=async()=>{const e=o.trim();if(!e)return;const s={id:`e-${Date.now()}`,question:e,loading:!0,at:new Date().toISOString()};u(r=>[s,...r].slice(0,20)),l("");try{const r=await R("/api/voice/ask",{question:e,voice:"default",speak:p});u(x=>x.map(n=>n.id===s.id?{...n,loading:!1,answer:r.answer,activeDrivers:r.activeDrivers,ttsUrl:r.ttsUrl}:n)),r.ttsUrl&&p&&a.current&&(a.current.src=r.ttsUrl,a.current.play().catch(()=>{}))}catch(r){u(x=>x.map(n=>n.id===s.id?{...n,loading:!1,error:r.message}:n))}},v=()=>{const e=m.current;if(!e){alert("Speech recognition not supported in this browser. Use Chrome.");return}try{e.start(),d(!0)}catch{}},w=()=>{const e=m.current;e&&e.stop(),d(!1)},y=!!(window.SpeechRecognition||window.webkitSpeechRecognition);return t.jsxs("div",{className:"space-y-4 flex flex-col h-[calc(100vh-180px)]",children:[t.jsx(k,{title:"Voice Ask",breadcrumbs:[{label:"Command Post"},{label:"Voice"}]}),t.jsx("audio",{ref:a}),t.jsxs("div",{className:"flex items-center gap-2 bg-bg-secondary border border-border rounded-xl px-3 py-2",children:[y&&(h?t.jsx("button",{onClick:w,className:"p-2 rounded bg-error/20 text-error hover:bg-error/30",title:"Stop listening",children:t.jsx(S,{size:18})}):t.jsx("button",{onClick:v,className:"p-2 rounded hover:bg-bg-tertiary text-text-muted",title:"Voice input (Chrome only)",children:t.jsx(C,{size:18})})),t.jsx("input",{value:o,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),f())},placeholder:h?"Listening…":'Ask TITAN — "What are you working on?" or give it instructions',className:"flex-1 bg-transparent text-sm outline-none"}),t.jsx("button",{onClick:()=>j(e=>!e),className:`p-2 rounded hover:bg-bg-tertiary ${p?"text-accent":"text-text-muted"}`,title:`TTS ${p?"ON":"OFF"}`,children:t.jsx(b,{size:16})}),t.jsxs("button",{onClick:f,disabled:!o.trim(),className:"px-3 py-1.5 rounded bg-accent/20 border border-accent/40 text-accent text-sm hover:bg-accent/30 disabled:opacity-50 flex items-center gap-1",children:[t.jsx(T,{size:14})," Ask"]})]}),t.jsxs("div",{className:"flex-1 overflow-auto space-y-3",children:[c.length===0&&t.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:'Ask a question to start. TITAN has driver-aware chat, so "what are you doing?" gets a real answer.'}),c.map(e=>t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"text-xs text-text-muted mt-1 flex-shrink-0 w-10",children:"You"}),t.jsx("div",{className:"text-sm text-text",children:e.question})]}),t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"text-xs text-accent mt-1 flex-shrink-0 w-10",children:"TITAN"}),t.jsxs("div",{className:"text-sm text-text-secondary flex-1",children:[e.loading&&t.jsx("span",{className:"text-text-muted",children:"thinking…"}),e.error&&t.jsxs("span",{className:"text-error",children:["error: ",e.error]}),e.answer&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"whitespace-pre-wrap",children:e.answer}),t.jsxs("div",{className:"text-[11px] text-text-muted flex items-center gap-2",children:[t.jsxs("span",{children:["drivers: ",e.activeDrivers??"?"]}),e.ttsUrl&&t.jsxs("button",{onClick:()=>{a.current&&(a.current.src=e.ttsUrl,a.current.play().catch(()=>{}))},className:"text-accent hover:underline flex items-center gap-0.5",children:[t.jsx(b,{size:10})," play"]})]})]})]})]})]},e.id))]})]})}export{I as default};
1
+ import{r as i,j as t,b as N}from"./index-CmaGnHzR.js";import"./Input-Bzh0-cXU.js";import{P as k}from"./PageHeader-BJ1jHtOy.js";import{C as S}from"./circle-stop-DOe0OacY.js";import{M as C}from"./mic-BXNK4d7X.js";import{V as b}from"./volume-2-BXwRjeve.js";import{S as T}from"./send-Bb57UxT7.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DkIMxdwH.js";async function R(o,l){const c=await N(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!c.ok)throw new Error(`HTTP ${c.status}`);return c.json()}function I(){const[o,l]=i.useState(""),[c,u]=i.useState([]),[h,d]=i.useState(!1),[p,j]=i.useState(!0),m=i.useRef(null),a=i.useRef(null);i.useEffect(()=>{const e=window.SpeechRecognition||window.webkitSpeechRecognition;if(e){const s=new e;s.lang="en-US",s.continuous=!1,s.interimResults=!1,s.onresult=r=>{var n,g;const x=((g=(n=r.results[0])==null?void 0:n[0])==null?void 0:g.transcript)||"";l(x),d(!1)},s.onerror=()=>d(!1),s.onend=()=>d(!1),m.current=s}},[]);const f=async()=>{const e=o.trim();if(!e)return;const s={id:`e-${Date.now()}`,question:e,loading:!0,at:new Date().toISOString()};u(r=>[s,...r].slice(0,20)),l("");try{const r=await R("/api/voice/ask",{question:e,voice:"default",speak:p});u(x=>x.map(n=>n.id===s.id?{...n,loading:!1,answer:r.answer,activeDrivers:r.activeDrivers,ttsUrl:r.ttsUrl}:n)),r.ttsUrl&&p&&a.current&&(a.current.src=r.ttsUrl,a.current.play().catch(()=>{}))}catch(r){u(x=>x.map(n=>n.id===s.id?{...n,loading:!1,error:r.message}:n))}},v=()=>{const e=m.current;if(!e){alert("Speech recognition not supported in this browser. Use Chrome.");return}try{e.start(),d(!0)}catch{}},w=()=>{const e=m.current;e&&e.stop(),d(!1)},y=!!(window.SpeechRecognition||window.webkitSpeechRecognition);return t.jsxs("div",{className:"space-y-4 flex flex-col h-[calc(100vh-180px)]",children:[t.jsx(k,{title:"Voice Ask",breadcrumbs:[{label:"Command Post"},{label:"Voice"}]}),t.jsx("audio",{ref:a}),t.jsxs("div",{className:"flex items-center gap-2 bg-bg-secondary border border-border rounded-xl px-3 py-2",children:[y&&(h?t.jsx("button",{onClick:w,className:"p-2 rounded bg-error/20 text-error hover:bg-error/30",title:"Stop listening",children:t.jsx(S,{size:18})}):t.jsx("button",{onClick:v,className:"p-2 rounded hover:bg-bg-tertiary text-text-muted",title:"Voice input (Chrome only)",children:t.jsx(C,{size:18})})),t.jsx("input",{value:o,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),f())},placeholder:h?"Listening…":'Ask TITAN — "What are you working on?" or give it instructions',className:"flex-1 bg-transparent text-sm outline-none"}),t.jsx("button",{onClick:()=>j(e=>!e),className:`p-2 rounded hover:bg-bg-tertiary ${p?"text-accent":"text-text-muted"}`,title:`TTS ${p?"ON":"OFF"}`,children:t.jsx(b,{size:16})}),t.jsxs("button",{onClick:f,disabled:!o.trim(),className:"px-3 py-1.5 rounded bg-accent/20 border border-accent/40 text-accent text-sm hover:bg-accent/30 disabled:opacity-50 flex items-center gap-1",children:[t.jsx(T,{size:14})," Ask"]})]}),t.jsxs("div",{className:"flex-1 overflow-auto space-y-3",children:[c.length===0&&t.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:'Ask a question to start. TITAN has driver-aware chat, so "what are you doing?" gets a real answer.'}),c.map(e=>t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"text-xs text-text-muted mt-1 flex-shrink-0 w-10",children:"You"}),t.jsx("div",{className:"text-sm text-text",children:e.question})]}),t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"text-xs text-accent mt-1 flex-shrink-0 w-10",children:"TITAN"}),t.jsxs("div",{className:"text-sm text-text-secondary flex-1",children:[e.loading&&t.jsx("span",{className:"text-text-muted",children:"thinking…"}),e.error&&t.jsxs("span",{className:"text-error",children:["error: ",e.error]}),e.answer&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"whitespace-pre-wrap",children:e.answer}),t.jsxs("div",{className:"text-[11px] text-text-muted flex items-center gap-2",children:[t.jsxs("span",{children:["drivers: ",e.activeDrivers??"?"]}),e.ttsUrl&&t.jsxs("button",{onClick:()=>{a.current&&(a.current.src=e.ttsUrl,a.current.play().catch(()=>{}))},className:"text-accent hover:underline flex items-center gap-0.5",children:[t.jsx(b,{size:10})," play"]})]})]})]})]})]},e.id))]})]})}export{I as default};
@@ -1 +1 @@
1
- import{r as a,j as e,i as $,ao as E,ap as D,V as F,an as K,E as I,aq as R}from"./index-BUCi9exS.js";import{P as O}from"./PageHeader-BXEGoqDX.js";import{R as W}from"./refresh-cw-D7RrQJQl.js";import{C as _}from"./circle-check-big-2NAZFdp9.js";import{C as G}from"./chevron-right-BANsqvxz.js";import{S as H}from"./save-Cy8s5sjb.js";const L=[{id:"discord",label:"Discord",description:"Discord bot via discord.js",fields:[{key:"token",label:"Bot Token",placeholder:"Bot token from Discord Developer Portal"}]},{id:"telegram",label:"Telegram",description:"Telegram bot via Grammy",fields:[{key:"token",label:"Bot Token",placeholder:"Token from @BotFather"}]},{id:"slack",label:"Slack",description:"Slack workspace via Bolt SDK",fields:[{key:"token",label:"Bot Token",placeholder:"xoxb-..."},{key:"apiKey",label:"Signing Secret",placeholder:"Signing secret from Slack app settings"}]},{id:"whatsapp",label:"WhatsApp",description:"WhatsApp via Twilio",fields:[{key:"token",label:"Auth Token",placeholder:"Twilio auth token"},{key:"apiKey",label:"Account SID",placeholder:"Twilio account SID"}]},{id:"googlechat",label:"Google Chat",description:"Google Chat spaces",fields:[{key:"token",label:"Service Account Key",placeholder:"JSON key path or content"}]},{id:"matrix",label:"Matrix",description:"Matrix protocol (Element, etc.)",fields:[{key:"token",label:"Access Token",placeholder:"Matrix access token"}]},{id:"signal",label:"Signal",description:"Signal messenger",fields:[{key:"token",label:"API Token",placeholder:"Signal API token"}]},{id:"msteams",label:"Microsoft Teams",description:"MS Teams via Bot Framework",fields:[{key:"token",label:"App Password",placeholder:"Bot framework app password"},{key:"apiKey",label:"App ID",placeholder:"Bot framework app ID"}]},{id:"irc",label:"IRC",description:"Internet Relay Chat",fields:[{key:"token",label:"Password",placeholder:"NickServ password (optional)"}]},{id:"mattermost",label:"Mattermost",description:"Self-hosted team chat",fields:[{key:"token",label:"Bot Token",placeholder:"Mattermost bot access token"}]},{id:"lark",label:"Lark",description:"Lark/Feishu messaging",fields:[{key:"token",label:"App Token",placeholder:"Lark app token"},{key:"apiKey",label:"App Secret",placeholder:"Lark app secret"}]},{id:"email_inbound",label:"Email (Inbound)",description:"IMAP email webhook",fields:[{key:"token",label:"IMAP Password",placeholder:"IMAP password or app password"}]},{id:"line",label:"LINE",description:"LINE messaging platform",fields:[{key:"token",label:"Channel Access Token",placeholder:"LINE channel access token"},{key:"apiKey",label:"Channel Secret",placeholder:"LINE channel secret"}]},{id:"zulip",label:"Zulip",description:"Zulip team chat",fields:[{key:"apiKey",label:"API Key",placeholder:"Zulip API key"}]}],Z=[{value:"pairing",label:"Pairing",desc:"User must pair first"},{value:"open",label:"Open",desc:"Anyone can DM"},{value:"closed",label:"Closed",desc:"DMs disabled"}];function q({def:l,config:o,status:b,onSave:f,saving:v}){const[d,k]=a.useState(!1),[x,N]=a.useState(o.enabled),[p,c]=a.useState(""),[m,u]=a.useState(""),[g,w]=a.useState(o.dmPolicy),[y,t]=a.useState(!1),[n,h]=a.useState(!1),[r,i]=a.useState(!1),j=v===l.id,S=(b==null?void 0:b.status)==="connected",A=!!o.token,P=!!o.apiKey,M=()=>{N(!x),i(!0)},B=async()=>{const s={enabled:x,dmPolicy:g};p&&(s.token=p),m&&(s.apiKey=m),await f(l.id,s),c(""),u(""),i(!1)},C=l.fields.find(s=>s.key==="token"),T=l.fields.find(s=>s.key==="apiKey");return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary",children:[e.jsxs("button",{onClick:()=>k(!d),className:"flex w-full items-center justify-between px-4 py-3 text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[d?e.jsx(F,{className:"h-4 w-4 text-text-muted"}):e.jsx(G,{className:"h-4 w-4 text-text-muted"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-text",children:l.label}),e.jsx("span",{className:"ml-2 text-xs text-text-muted",children:l.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[S&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-success/10 px-2.5 py-0.5 text-xs font-medium text-success",children:[e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-success"}),"Connected"]}),e.jsx("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${o.enabled?"bg-accent/10 text-accent-hover":"bg-border-light/20 text-text-muted"}`,children:o.enabled?"Enabled":"Disabled"})]})]}),d&&e.jsxs("div",{className:"border-t border-bg-tertiary px-4 py-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm text-text-secondary",children:"Enabled"}),e.jsx("button",{onClick:M,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${x?"bg-accent":"bg-border"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${x?"translate-x-6":"translate-x-1"}`})})]}),C&&e.jsxs("div",{children:[e.jsxs("label",{className:"mb-1 flex items-center gap-2 text-xs text-text-muted",children:[C.label,A&&e.jsx("span",{className:"rounded bg-success/10 px-1.5 py-0.5 text-[10px] text-success",children:"set"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:`channel-${l.id}-token`,name:`channel-${l.id}-token`,type:y?"text":"password",value:p,onChange:s=>{c(s.target.value),i(!0)},placeholder:A?"(configured — enter new value to change)":C.placeholder,className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-accent"}),e.jsx("button",{type:"button",onClick:()=>t(!y),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:y?e.jsx(K,{className:"h-4 w-4"}):e.jsx(I,{className:"h-4 w-4"})})]})]}),T&&e.jsxs("div",{children:[e.jsxs("label",{className:"mb-1 flex items-center gap-2 text-xs text-text-muted",children:[T.label,P&&e.jsx("span",{className:"rounded bg-success/10 px-1.5 py-0.5 text-[10px] text-success",children:"set"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:`channel-${l.id}-api-key`,name:`channel-${l.id}-api-key`,type:n?"text":"password",value:m,onChange:s=>{u(s.target.value),i(!0)},placeholder:P?"(configured — enter new value to change)":T.placeholder,className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-accent"}),e.jsx("button",{type:"button",onClick:()=>h(!n),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:n?e.jsx(K,{className:"h-4 w-4"}):e.jsx(I,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"DM Policy"}),e.jsx("div",{className:"flex gap-2",children:Z.map(s=>e.jsx("button",{onClick:()=>{w(s.value),i(!0)},className:`rounded-lg border px-3 py-1.5 text-xs transition-colors ${g===s.value?"border-accent bg-accent/10 text-accent-hover":"border-border text-text-muted hover:border-border-light"}`,title:s.desc,children:s.label},s.value))})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:B,disabled:j||!r,className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50",children:[e.jsx(H,{className:"h-3.5 w-3.5"}),j?"Saving...":"Save"]})})]})]})}function Y(){const[l,o]=a.useState([]),[b,f]=a.useState({}),[v,d]=a.useState(!0),[k,x]=a.useState(null),[N,p]=a.useState(null),[c,m]=a.useState(null),u=async()=>{try{const[t,n]=await Promise.all([E(),D()]);o(t),f(n)}catch(t){x(t instanceof Error?t.message:"Failed to fetch channels")}finally{d(!1)}};a.useEffect(()=>{u()},[]);const g=(t,n)=>{m({type:t,message:n}),setTimeout(()=>m(null),3e3)},w=async(t,n)=>{var h;p(t);try{await R(t,n);const[r,i]=await Promise.all([E(),D()]);o(r),f(i);const j=((h=L.find(S=>S.id===t))==null?void 0:h.label)??t;g("success",`${j} settings saved (restart gateway to apply)`)}catch(r){g("error",r instanceof Error?r.message:"Failed to save")}finally{p(null)}};if(v)return e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((t,n)=>e.jsx("div",{className:"h-14 animate-pulse rounded-xl border border-border bg-bg-secondary"},n))});if(k)return e.jsx("div",{className:"rounded-xl border border-error/50 bg-bg-secondary p-6 text-center text-error",children:k});const y={enabled:!1,allowFrom:[],dmPolicy:"pairing"};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(O,{title:"Channels",subtitle:`Configure messaging channels — ${l.filter(t=>t.status==="connected").length} connected`,breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"Channels"}],actions:e.jsxs("button",{onClick:()=>{d(!0),u()},className:"flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-text-secondary hover:border-border-light hover:text-text",children:[e.jsx(W,{className:"h-3.5 w-3.5"}),"Refresh"]})}),c&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${c.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[c.type==="success"?e.jsx(_,{className:"h-4 w-4"}):e.jsx($,{className:"h-4 w-4"}),c.message]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Built-in"}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium text-text",children:"WebChat"}),e.jsx("span",{className:"text-xs text-text-muted",children:"HTTP/WebSocket — always enabled"})]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-success/10 px-2.5 py-0.5 text-xs font-medium text-success",children:[e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-success"}),"Connected"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Messaging Channels"}),e.jsx("div",{className:"space-y-2",children:L.map(t=>{const n=b[t.id]??y,h=l.find(r=>r.name===t.id||r.type===t.id);return e.jsx(q,{def:t,config:n,status:h,onSave:w,saving:N},t.id)})})]}),e.jsx("p",{className:"text-xs text-text-muted text-center",children:"Channel changes are saved to config. Restart the gateway to connect/disconnect channels."})]})}export{Y as default};
1
+ import{r as a,j as e,i as $,ao as E,ap as D,V as F,an as K,E as I,aq as R}from"./index-CmaGnHzR.js";import{P as O}from"./PageHeader-BJ1jHtOy.js";import{R as W}from"./refresh-cw-BFBnnWj8.js";import{C as _}from"./circle-check-big-DnJPBAGU.js";import{C as G}from"./chevron-right-DkIMxdwH.js";import{S as H}from"./save--wCYre_u.js";const L=[{id:"discord",label:"Discord",description:"Discord bot via discord.js",fields:[{key:"token",label:"Bot Token",placeholder:"Bot token from Discord Developer Portal"}]},{id:"telegram",label:"Telegram",description:"Telegram bot via Grammy",fields:[{key:"token",label:"Bot Token",placeholder:"Token from @BotFather"}]},{id:"slack",label:"Slack",description:"Slack workspace via Bolt SDK",fields:[{key:"token",label:"Bot Token",placeholder:"xoxb-..."},{key:"apiKey",label:"Signing Secret",placeholder:"Signing secret from Slack app settings"}]},{id:"whatsapp",label:"WhatsApp",description:"WhatsApp via Twilio",fields:[{key:"token",label:"Auth Token",placeholder:"Twilio auth token"},{key:"apiKey",label:"Account SID",placeholder:"Twilio account SID"}]},{id:"googlechat",label:"Google Chat",description:"Google Chat spaces",fields:[{key:"token",label:"Service Account Key",placeholder:"JSON key path or content"}]},{id:"matrix",label:"Matrix",description:"Matrix protocol (Element, etc.)",fields:[{key:"token",label:"Access Token",placeholder:"Matrix access token"}]},{id:"signal",label:"Signal",description:"Signal messenger",fields:[{key:"token",label:"API Token",placeholder:"Signal API token"}]},{id:"msteams",label:"Microsoft Teams",description:"MS Teams via Bot Framework",fields:[{key:"token",label:"App Password",placeholder:"Bot framework app password"},{key:"apiKey",label:"App ID",placeholder:"Bot framework app ID"}]},{id:"irc",label:"IRC",description:"Internet Relay Chat",fields:[{key:"token",label:"Password",placeholder:"NickServ password (optional)"}]},{id:"mattermost",label:"Mattermost",description:"Self-hosted team chat",fields:[{key:"token",label:"Bot Token",placeholder:"Mattermost bot access token"}]},{id:"lark",label:"Lark",description:"Lark/Feishu messaging",fields:[{key:"token",label:"App Token",placeholder:"Lark app token"},{key:"apiKey",label:"App Secret",placeholder:"Lark app secret"}]},{id:"email_inbound",label:"Email (Inbound)",description:"IMAP email webhook",fields:[{key:"token",label:"IMAP Password",placeholder:"IMAP password or app password"}]},{id:"line",label:"LINE",description:"LINE messaging platform",fields:[{key:"token",label:"Channel Access Token",placeholder:"LINE channel access token"},{key:"apiKey",label:"Channel Secret",placeholder:"LINE channel secret"}]},{id:"zulip",label:"Zulip",description:"Zulip team chat",fields:[{key:"apiKey",label:"API Key",placeholder:"Zulip API key"}]}],Z=[{value:"pairing",label:"Pairing",desc:"User must pair first"},{value:"open",label:"Open",desc:"Anyone can DM"},{value:"closed",label:"Closed",desc:"DMs disabled"}];function q({def:l,config:o,status:b,onSave:f,saving:v}){const[d,k]=a.useState(!1),[x,N]=a.useState(o.enabled),[p,c]=a.useState(""),[m,u]=a.useState(""),[g,w]=a.useState(o.dmPolicy),[y,t]=a.useState(!1),[n,h]=a.useState(!1),[r,i]=a.useState(!1),j=v===l.id,S=(b==null?void 0:b.status)==="connected",A=!!o.token,P=!!o.apiKey,M=()=>{N(!x),i(!0)},B=async()=>{const s={enabled:x,dmPolicy:g};p&&(s.token=p),m&&(s.apiKey=m),await f(l.id,s),c(""),u(""),i(!1)},C=l.fields.find(s=>s.key==="token"),T=l.fields.find(s=>s.key==="apiKey");return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary",children:[e.jsxs("button",{onClick:()=>k(!d),className:"flex w-full items-center justify-between px-4 py-3 text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[d?e.jsx(F,{className:"h-4 w-4 text-text-muted"}):e.jsx(G,{className:"h-4 w-4 text-text-muted"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-text",children:l.label}),e.jsx("span",{className:"ml-2 text-xs text-text-muted",children:l.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[S&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-success/10 px-2.5 py-0.5 text-xs font-medium text-success",children:[e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-success"}),"Connected"]}),e.jsx("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${o.enabled?"bg-accent/10 text-accent-hover":"bg-border-light/20 text-text-muted"}`,children:o.enabled?"Enabled":"Disabled"})]})]}),d&&e.jsxs("div",{className:"border-t border-bg-tertiary px-4 py-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm text-text-secondary",children:"Enabled"}),e.jsx("button",{onClick:M,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${x?"bg-accent":"bg-border"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${x?"translate-x-6":"translate-x-1"}`})})]}),C&&e.jsxs("div",{children:[e.jsxs("label",{className:"mb-1 flex items-center gap-2 text-xs text-text-muted",children:[C.label,A&&e.jsx("span",{className:"rounded bg-success/10 px-1.5 py-0.5 text-[10px] text-success",children:"set"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:`channel-${l.id}-token`,name:`channel-${l.id}-token`,type:y?"text":"password",value:p,onChange:s=>{c(s.target.value),i(!0)},placeholder:A?"(configured — enter new value to change)":C.placeholder,className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-accent"}),e.jsx("button",{type:"button",onClick:()=>t(!y),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:y?e.jsx(K,{className:"h-4 w-4"}):e.jsx(I,{className:"h-4 w-4"})})]})]}),T&&e.jsxs("div",{children:[e.jsxs("label",{className:"mb-1 flex items-center gap-2 text-xs text-text-muted",children:[T.label,P&&e.jsx("span",{className:"rounded bg-success/10 px-1.5 py-0.5 text-[10px] text-success",children:"set"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:`channel-${l.id}-api-key`,name:`channel-${l.id}-api-key`,type:n?"text":"password",value:m,onChange:s=>{u(s.target.value),i(!0)},placeholder:P?"(configured — enter new value to change)":T.placeholder,className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-accent"}),e.jsx("button",{type:"button",onClick:()=>h(!n),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:n?e.jsx(K,{className:"h-4 w-4"}):e.jsx(I,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"DM Policy"}),e.jsx("div",{className:"flex gap-2",children:Z.map(s=>e.jsx("button",{onClick:()=>{w(s.value),i(!0)},className:`rounded-lg border px-3 py-1.5 text-xs transition-colors ${g===s.value?"border-accent bg-accent/10 text-accent-hover":"border-border text-text-muted hover:border-border-light"}`,title:s.desc,children:s.label},s.value))})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:B,disabled:j||!r,className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50",children:[e.jsx(H,{className:"h-3.5 w-3.5"}),j?"Saving...":"Save"]})})]})]})}function Y(){const[l,o]=a.useState([]),[b,f]=a.useState({}),[v,d]=a.useState(!0),[k,x]=a.useState(null),[N,p]=a.useState(null),[c,m]=a.useState(null),u=async()=>{try{const[t,n]=await Promise.all([E(),D()]);o(t),f(n)}catch(t){x(t instanceof Error?t.message:"Failed to fetch channels")}finally{d(!1)}};a.useEffect(()=>{u()},[]);const g=(t,n)=>{m({type:t,message:n}),setTimeout(()=>m(null),3e3)},w=async(t,n)=>{var h;p(t);try{await R(t,n);const[r,i]=await Promise.all([E(),D()]);o(r),f(i);const j=((h=L.find(S=>S.id===t))==null?void 0:h.label)??t;g("success",`${j} settings saved (restart gateway to apply)`)}catch(r){g("error",r instanceof Error?r.message:"Failed to save")}finally{p(null)}};if(v)return e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((t,n)=>e.jsx("div",{className:"h-14 animate-pulse rounded-xl border border-border bg-bg-secondary"},n))});if(k)return e.jsx("div",{className:"rounded-xl border border-error/50 bg-bg-secondary p-6 text-center text-error",children:k});const y={enabled:!1,allowFrom:[],dmPolicy:"pairing"};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(O,{title:"Channels",subtitle:`Configure messaging channels — ${l.filter(t=>t.status==="connected").length} connected`,breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"Channels"}],actions:e.jsxs("button",{onClick:()=>{d(!0),u()},className:"flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-text-secondary hover:border-border-light hover:text-text",children:[e.jsx(W,{className:"h-3.5 w-3.5"}),"Refresh"]})}),c&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${c.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[c.type==="success"?e.jsx(_,{className:"h-4 w-4"}):e.jsx($,{className:"h-4 w-4"}),c.message]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Built-in"}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium text-text",children:"WebChat"}),e.jsx("span",{className:"text-xs text-text-muted",children:"HTTP/WebSocket — always enabled"})]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-success/10 px-2.5 py-0.5 text-xs font-medium text-success",children:[e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-success"}),"Connected"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Messaging Channels"}),e.jsx("div",{className:"space-y-2",children:L.map(t=>{const n=b[t.id]??y,h=l.find(r=>r.name===t.id||r.type===t.id);return e.jsx(q,{def:t,config:n,status:h,onSave:w,saving:N},t.id)})})]}),e.jsx("p",{className:"text-xs text-text-muted text-center",children:"Channel changes are saved to config. Restart the gateway to connect/disconnect channels."})]})}export{Y as default};
@@ -1 +1 @@
1
- import{r as a,by as l,j as e,bz as d}from"./index-BUCi9exS.js";import{P as m}from"./PageHeader-BXEGoqDX.js";import{R as h}from"./refresh-cw-D7RrQJQl.js";import{S as x}from"./save-Cy8s5sjb.js";import{T as p}from"./trash-2-BscnSMjc.js";import"./chevron-right-BANsqvxz.js";function k(){const[c,n]=a.useState([]),[i,r]=a.useState(!0),t=a.useCallback(async()=>{r(!0);try{const s=await l();n(s.checkpoints||[])}catch{}r(!1)},[]);a.useEffect(()=>{t()},[t]);const o=async s=>{if(confirm("Delete this checkpoint?"))try{await d(s),await t()}catch{}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(m,{title:"Checkpoints",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"System"},{label:"Checkpoints"}]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:t,disabled:i,className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46] disabled:opacity-50",children:[e.jsx(h,{className:`w-4 h-4 ${i?"animate-spin":""}`})," Refresh"]})}),e.jsx("div",{className:"space-y-2",children:c.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x,{className:"w-4 h-4 text-[#6366f1]"}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm text-[#e4e4e7]",children:[s.sessionId.slice(0,16),"..."]}),e.jsx("div",{className:"text-xs text-[#52525b]",children:new Date(s.createdAt).toLocaleString()})]})]}),e.jsx("button",{onClick:()=>o(s.sessionId),className:"p-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] hover:bg-[#3f3f46] hover:text-red-400",children:e.jsx(p,{className:"w-3.5 h-3.5"})})]},s.sessionId))})]})}export{k as default};
1
+ import{r as a,bD as l,j as e,bE as d}from"./index-CmaGnHzR.js";import{P as m}from"./PageHeader-BJ1jHtOy.js";import{R as h}from"./refresh-cw-BFBnnWj8.js";import{S as x}from"./save--wCYre_u.js";import{T as p}from"./trash-2-C5KNXS-O.js";import"./chevron-right-DkIMxdwH.js";function k(){const[c,n]=a.useState([]),[i,r]=a.useState(!0),t=a.useCallback(async()=>{r(!0);try{const s=await l();n(s.checkpoints||[])}catch{}r(!1)},[]);a.useEffect(()=>{t()},[t]);const o=async s=>{if(confirm("Delete this checkpoint?"))try{await d(s),await t()}catch{}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(m,{title:"Checkpoints",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"System"},{label:"Checkpoints"}]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:t,disabled:i,className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46] disabled:opacity-50",children:[e.jsx(h,{className:`w-4 h-4 ${i?"animate-spin":""}`})," Refresh"]})}),e.jsx("div",{className:"space-y-2",children:c.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x,{className:"w-4 h-4 text-[#6366f1]"}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm text-[#e4e4e7]",children:[s.sessionId.slice(0,16),"..."]}),e.jsx("div",{className:"text-xs text-[#52525b]",children:new Date(s.createdAt).toLocaleString()})]})]}),e.jsx("button",{onClick:()=>o(s.sessionId),className:"p-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] hover:bg-[#3f3f46] hover:text-red-400",children:e.jsx(p,{className:"w-3.5 h-3.5"})})]},s.sessionId))})]})}export{k as default};