titan-agent 7.0.0 → 7.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 (343) hide show
  1. package/README.md +54 -2
  2. package/dist/agent/agent.js +55 -10
  3. package/dist/agent/agent.js.map +1 -1
  4. package/dist/agent/contextManager.js +1 -1
  5. package/dist/agent/contextManager.js.map +1 -1
  6. package/dist/agent/honestyGuard.js +66 -0
  7. package/dist/agent/honestyGuard.js.map +1 -0
  8. package/dist/agent/selfCritique.js +101 -0
  9. package/dist/agent/selfCritique.js.map +1 -0
  10. package/dist/agent/toolSearch.js +9 -2
  11. package/dist/agent/toolSearch.js.map +1 -1
  12. package/dist/agent/trajectoryLogger.js +19 -2
  13. package/dist/agent/trajectoryLogger.js.map +1 -1
  14. package/dist/analytics/collector.js +1 -1
  15. package/dist/analytics/collector.js.map +1 -1
  16. package/dist/config/schema.js +32 -0
  17. package/dist/config/schema.js.map +1 -1
  18. package/dist/eval/harness.js +4 -1
  19. package/dist/eval/harness.js.map +1 -1
  20. package/dist/gateway/server.js +24 -8
  21. package/dist/gateway/server.js.map +1 -1
  22. package/dist/gateway/slashCommands.js +31 -0
  23. package/dist/gateway/slashCommands.js.map +1 -1
  24. package/dist/mcp/agentTools.js +135 -0
  25. package/dist/mcp/agentTools.js.map +1 -0
  26. package/dist/mcp/server.js +19 -2
  27. package/dist/mcp/server.js.map +1 -1
  28. package/dist/memory/graph.js +2 -0
  29. package/dist/memory/graph.js.map +1 -1
  30. package/dist/providers/errorTaxonomy.js +4 -0
  31. package/dist/providers/errorTaxonomy.js.map +1 -1
  32. package/dist/providers/moa.js +151 -0
  33. package/dist/providers/moa.js.map +1 -0
  34. package/dist/providers/modelCapabilities.js +65 -2
  35. package/dist/providers/modelCapabilities.js.map +1 -1
  36. package/dist/providers/ollama.js +1 -0
  37. package/dist/providers/ollama.js.map +1 -1
  38. package/dist/providers/openai_compat.js +14 -2
  39. package/dist/providers/openai_compat.js.map +1 -1
  40. package/dist/providers/router.js +3 -1
  41. package/dist/providers/router.js.map +1 -1
  42. package/dist/utils/benchMode.js +8 -0
  43. package/dist/utils/benchMode.js.map +1 -0
  44. package/dist/utils/constants.js +1 -1
  45. package/dist/utils/constants.js.map +1 -1
  46. package/package.json +26 -26
  47. package/ui/dist/assets/AboutYouMemory-57X5SqHQ.js +1 -0
  48. package/ui/dist/assets/AuditPanel-AyB8ciLZ.js +1 -0
  49. package/ui/dist/assets/AutonomyPanel-wmVPr-n3.js +1 -0
  50. package/ui/dist/assets/AutopilotPanel-CbLy4lJP.js +1 -0
  51. package/ui/dist/assets/AutoresearchPanel-DxRO1rBF.js +1 -0
  52. package/ui/dist/assets/BackupPanel-BUh9rQ-3.js +1 -0
  53. package/ui/dist/assets/BrowserPanel-OqKwGrIL.js +1 -0
  54. package/ui/dist/assets/CPActivity-DGfS7EY3.js +1 -0
  55. package/ui/dist/assets/CPAgentDetail-p0Kvzhhb.js +1 -0
  56. package/ui/dist/assets/CPAgents-B6wSSQZM.js +1 -0
  57. package/ui/dist/assets/CPApprovals-CYv9Do0i.js +1 -0
  58. package/ui/dist/assets/CPCosts-Dx6Q71rN.js +1 -0
  59. package/ui/dist/assets/CPDashboard-DA8-tE-l.js +1 -0
  60. package/ui/dist/assets/CPFiles-BJ49tzai.js +1 -0
  61. package/ui/dist/assets/CPGoals-h0dKL5V_.js +1 -0
  62. package/ui/dist/assets/CPInbox-CDvefgNH.js +1 -0
  63. package/ui/dist/assets/CPIssueDetail-CnmLzzDD.js +1 -0
  64. package/ui/dist/assets/CPIssues-DknAIMyl.js +1 -0
  65. package/ui/dist/assets/CPLayout-C2nqgkmY.js +2 -0
  66. package/ui/dist/assets/CPOrg-tDbHFphX.js +1 -0
  67. package/ui/dist/assets/CPRuns-UlrIURqG.js +1 -0
  68. package/ui/dist/assets/CPSocial-B-gHgvEw.js +1 -0
  69. package/ui/dist/assets/CPVoice-CJy938ZF.js +1 -0
  70. package/ui/dist/assets/ChannelsPanel-DLbxg1zO.js +1 -0
  71. package/ui/dist/assets/CheckpointsPanel-BB6TT0aE.js +1 -0
  72. package/ui/dist/assets/CommandPostHub-fIslwU_t.js +2 -0
  73. package/ui/dist/assets/ConfirmDialog-6hcNjmAh.js +9 -0
  74. package/ui/dist/assets/CronPanel-DLpw3Y25.js +1 -0
  75. package/ui/dist/assets/DataTable-KVqtDzvP.js +1 -0
  76. package/ui/dist/assets/DreamPanel-lcMXpbEb.js +5 -0
  77. package/ui/dist/assets/EmptyState-D-Dg8B8r.js +1 -0
  78. package/ui/dist/assets/EvalHarnessPanel-BKzRiiQw.js +2 -0
  79. package/ui/dist/assets/EvalPanel-Dtodacmj.js +1 -0
  80. package/ui/dist/assets/FileViewer-DjcVKkO2.js +60 -0
  81. package/ui/dist/assets/FilesPanel-BI90Pplh.js +1 -0
  82. package/ui/dist/assets/FleetPanel-tr0wjAwr.js +1 -0
  83. package/ui/dist/assets/HomelabPanel-m8vMm5rE.js +1 -0
  84. package/ui/dist/assets/InfraView-3WriJnyE.js +2 -0
  85. package/ui/dist/assets/IntegrationsPanel-BmL70fOw.js +1 -0
  86. package/ui/dist/assets/IntelligenceView-BGVxCKD3.js +2 -0
  87. package/ui/dist/assets/LearningPanel-CrYLQ6eV.js +1 -0
  88. package/ui/dist/assets/LiveStudio-CnW3eZYF.js +2 -0
  89. package/ui/dist/assets/LogsPanel-DbShr4Ic.js +1 -0
  90. package/ui/dist/assets/McpPanel-uMYEsPI4.js +1 -0
  91. package/ui/dist/assets/MemoryGraphPanel-C7-Z8f0v.js +1 -0
  92. package/ui/dist/assets/MemoryTaxonomyPanel-KrxN8U1G.js +1 -0
  93. package/ui/dist/assets/MemoryWikiPanel-DI3q6IHC.js +1 -0
  94. package/ui/dist/assets/MeshPanel-D4-g2tlu.js +1 -0
  95. package/ui/dist/assets/MissionCanvas-D8cjakJe.js +61 -0
  96. package/ui/dist/assets/MissionChat-BvqCUf1E.js +3 -0
  97. package/ui/dist/assets/MissionLibrary-CZoJQ9WD.js +1 -0
  98. package/ui/dist/assets/MissionStart-CXCq-_AD.js +1 -0
  99. package/ui/dist/assets/NvidiaPanel-BfI1K5Pg.js +1 -0
  100. package/ui/dist/assets/OrganismPanel-B7Gm9pP-.js +1 -0
  101. package/ui/dist/assets/OverviewPanel-B9tKWRK2.js +1 -0
  102. package/ui/dist/assets/PageHeader-CH85uoZG.js +1 -0
  103. package/ui/dist/assets/PersonaProfilesPanel-BPi8fl-U.js +3 -0
  104. package/ui/dist/assets/PersonasPanel-Dwr7sycT.js +1 -0
  105. package/ui/dist/assets/PhoneDeskPanel-D7qc6wUI.js +1 -0
  106. package/ui/dist/assets/RecipesPanel-DcqPWRSU.js +1 -0
  107. package/ui/dist/assets/SecurityPanel-Bv_B9Ahf.js +1 -0
  108. package/ui/dist/assets/SelfImprovePanel-Ca4rGwEG.js +1 -0
  109. package/ui/dist/assets/SelfProposalsPanel-DteMSASq.js +1 -0
  110. package/ui/dist/assets/SessionsPanel-BdbbKTbL.js +1 -0
  111. package/ui/dist/assets/SessionsTab-BJipiVJs.js +1 -0
  112. package/ui/dist/assets/SettingsPanel-mV7ykOCc.js +1 -0
  113. package/ui/dist/assets/SettingsView-Bu_wYTT5.js +2 -0
  114. package/ui/dist/assets/SkeletonLoader-9H7QWa9E.js +1 -0
  115. package/ui/dist/assets/SkillsPanel-CHwX2kDR.js +1 -0
  116. package/ui/dist/assets/SomaView-Bpsm4ZW7.js +5 -0
  117. package/ui/dist/assets/SomaView-Dghh9om4.css +1 -0
  118. package/ui/dist/assets/StatCard-wmSgMAM3.js +1 -0
  119. package/ui/dist/assets/TeamsPanel-XJiHxdDX.js +1 -0
  120. package/ui/dist/assets/TelemetryPanel-_pmGVxpO.js +1 -0
  121. package/ui/dist/assets/TitanCanvas-Cb7KG80W.css +1 -0
  122. package/ui/dist/assets/TitanCanvas-CmLy7p2N.js +883 -0
  123. package/ui/dist/assets/ToolsView-PHizHZBx.js +2 -0
  124. package/ui/dist/assets/TraceViewer-CYAzIcfB.js +1 -0
  125. package/ui/dist/assets/TracesPanel-CRSN_dzK.js +1 -0
  126. package/ui/dist/assets/TrainingPanel-B9rcuMsV.js +1 -0
  127. package/ui/dist/assets/VoiceOverlay-BL_ns1ZA.js +7 -0
  128. package/ui/dist/assets/VramPanel-BNPQ06_9.js +1 -0
  129. package/ui/dist/assets/WatchView-BgAkNnur.js +13 -0
  130. package/ui/dist/assets/WorkTab-RRpPpEOg.js +1 -0
  131. package/ui/dist/assets/WorkflowBuilderPanel-BPHIH8pf.js +1 -0
  132. package/ui/dist/assets/WorkflowsPanel-DqtmT0NB.js +1 -0
  133. package/ui/dist/assets/approvalHeadline-BRg3ReTi.js +1 -0
  134. package/ui/dist/assets/archive-DcK9HrbE.js +1 -0
  135. package/ui/dist/assets/arrow-left-4c2FnES1.js +1 -0
  136. package/ui/dist/assets/book-open-Ds_yciQm.js +1 -0
  137. package/ui/dist/assets/bot-CWDCc265.js +1 -0
  138. package/ui/dist/assets/chart-column-hhZMdCgB.js +1 -0
  139. package/ui/dist/assets/chevron-right-A_pvnRh_.js +1 -0
  140. package/ui/dist/assets/circle-check-big-C-JUM7wb.js +1 -0
  141. package/ui/dist/assets/circle-stop-yZuG9ZAE.js +1 -0
  142. package/ui/dist/assets/clipboard-list-C2HUEjZc.js +1 -0
  143. package/ui/dist/assets/clock-DSPgndSD.js +1 -0
  144. package/ui/dist/assets/clsx-CjueKrWZ.js +1 -0
  145. package/ui/dist/assets/createLucideIcon-qnlrxww7.js +1 -0
  146. package/ui/dist/assets/database-C1SgHa8T.js +1 -0
  147. package/ui/dist/assets/dollar-sign-D9siqK91.js +1 -0
  148. package/ui/dist/assets/download-CJZWQNfV.js +1 -0
  149. package/ui/dist/assets/external-link-CpQLWKKE.js +1 -0
  150. package/ui/dist/assets/file-text-BbGTi-Po.js +1 -0
  151. package/ui/dist/assets/flask-conical-B1YVft4E.js +1 -0
  152. package/ui/dist/assets/folder-EbR-w2Mq.js +1 -0
  153. package/ui/dist/assets/funnel-D2Dkn8Pf.js +1 -0
  154. package/ui/dist/assets/git-branch-CQ2yNSzU.js +1 -0
  155. package/ui/dist/assets/git-pull-request-BxL5wlGX.js +1 -0
  156. package/ui/dist/assets/index-Cz8190xO.css +2 -0
  157. package/ui/dist/assets/index-WI-E4I3h.js +243 -0
  158. package/ui/dist/assets/jsx-runtime-B15e6lOy.js +1 -0
  159. package/ui/dist/assets/layers-BPu5SRjI.js +1 -0
  160. package/ui/dist/assets/legacy-BIzifT-t.js +3 -0
  161. package/ui/dist/assets/lightbulb-BY7CpMte.js +1 -0
  162. package/ui/dist/assets/link-VDQkrGJw.js +1 -0
  163. package/ui/dist/assets/list-todo-DfnNUV_T.js +1 -0
  164. package/ui/dist/assets/message-square-BpzrINHz.js +1 -0
  165. package/ui/dist/assets/mic-De6oZFaV.js +1 -0
  166. package/ui/dist/assets/missions-y-qg_f9b.js +1 -0
  167. package/ui/dist/assets/network-CM7y1ats.js +1 -0
  168. package/ui/dist/assets/pause-C4TDJSfA.js +1 -0
  169. package/ui/dist/assets/pencil-Dd_vzHE-.js +1 -0
  170. package/ui/dist/assets/play-9WxZWVHA.js +1 -0
  171. package/ui/dist/assets/plug-Dm25Wbrc.js +1 -0
  172. package/ui/dist/assets/plus-CHryCIkk.js +1 -0
  173. package/ui/dist/assets/radio-D-XnoAVu.js +1 -0
  174. package/ui/dist/assets/refresh-cw-Disd5wRB.js +1 -0
  175. package/ui/dist/assets/rotate-ccw-Cw1T2W1T.js +1 -0
  176. package/ui/dist/assets/save-DP7oNar2.js +1 -0
  177. package/ui/dist/assets/search-aNVcX-nv.js +1 -0
  178. package/ui/dist/assets/send-D7iQD57b.js +1 -0
  179. package/ui/dist/assets/server-DFfeYjoM.js +1 -0
  180. package/ui/dist/assets/settings-5NWXzgyY.js +1 -0
  181. package/ui/dist/assets/shared-DLz_Jtg3.js +1 -0
  182. package/ui/dist/assets/shield-check-Cd50jCAn.js +1 -0
  183. package/ui/dist/assets/square-DlcoJ1ZM.js +1 -0
  184. package/ui/dist/assets/terminal-DgFz2Vsf.js +1 -0
  185. package/ui/dist/assets/test-tube-BimtS92_.js +1 -0
  186. package/ui/dist/assets/toggle-right-BMaR-sfT.js +1 -0
  187. package/ui/dist/assets/trash-2-CwUv7ww1.js +1 -0
  188. package/ui/dist/assets/trending-up-Ba9TwEow.js +1 -0
  189. package/ui/dist/assets/trophy-Gfv1QC45.js +1 -0
  190. package/ui/dist/assets/volume-2-BVlfVl2U.js +1 -0
  191. package/ui/dist/assets/wifi-off-CWLeusSV.js +1 -0
  192. package/ui/dist/assets/zoom-out-DeggJ7RM.js +1 -0
  193. package/ui/dist/index.html +4 -2
  194. package/ui/dist/sw.js +1 -1
  195. package/ui/dist/assets/AboutYouMemory-CZKEOd_O.js +0 -11
  196. package/ui/dist/assets/AuditPanel-Bu71N5Er.js +0 -1
  197. package/ui/dist/assets/AutonomyPanel-DB-39dX4.js +0 -11
  198. package/ui/dist/assets/AutopilotPanel-Cj8oKxWv.js +0 -1
  199. package/ui/dist/assets/AutoresearchPanel-3s8pjm6Z.js +0 -6
  200. package/ui/dist/assets/BackupPanel-EUQJMJE7.js +0 -1
  201. package/ui/dist/assets/BrowserPanel-Beo4F5Ar.js +0 -6
  202. package/ui/dist/assets/Button-MdXmb4_n.js +0 -1
  203. package/ui/dist/assets/CPActivity-B1Se9VVc.js +0 -1
  204. package/ui/dist/assets/CPAgentDetail-BYji6tT8.js +0 -1
  205. package/ui/dist/assets/CPAgents-BSUKucTe.js +0 -1
  206. package/ui/dist/assets/CPApprovals-B4v0em6e.js +0 -1
  207. package/ui/dist/assets/CPCosts-9ikh61Kv.js +0 -1
  208. package/ui/dist/assets/CPDashboard-sOok2T5v.js +0 -1
  209. package/ui/dist/assets/CPFiles-DB2nY5JE.js +0 -1
  210. package/ui/dist/assets/CPGoals-8Z1yOY8e.js +0 -1
  211. package/ui/dist/assets/CPInbox-Cq6-UY8F.js +0 -11
  212. package/ui/dist/assets/CPIssueDetail-NAGfmJg8.js +0 -1
  213. package/ui/dist/assets/CPIssues-BzX6Rckx.js +0 -1
  214. package/ui/dist/assets/CPLayout-BcRM6QSg.js +0 -2
  215. package/ui/dist/assets/CPOrg-B7DQ4UQP.js +0 -1
  216. package/ui/dist/assets/CPRuns-D-cpPw_M.js +0 -1
  217. package/ui/dist/assets/CPSocial-DshtmcK0.js +0 -11
  218. package/ui/dist/assets/CPVoice-DfXRnQVU.js +0 -1
  219. package/ui/dist/assets/ChannelsPanel-BnaTOeyf.js +0 -1
  220. package/ui/dist/assets/CheckpointsPanel-C62naE4U.js +0 -1
  221. package/ui/dist/assets/CommandPostHub-B_L1CAss.js +0 -24
  222. package/ui/dist/assets/ConfirmDialog-VErHWAbo.js +0 -1
  223. package/ui/dist/assets/CronPanel-BwMrrZ5d.js +0 -1
  224. package/ui/dist/assets/DataTable-BCqSUuN7.js +0 -1
  225. package/ui/dist/assets/DreamPanel-BNAcCLBB.js +0 -15
  226. package/ui/dist/assets/EmptyState-D9kQf1PX.js +0 -1
  227. package/ui/dist/assets/EvalHarnessPanel-BaMLdBNm.js +0 -2
  228. package/ui/dist/assets/EvalPanel-CW-SSjtg.js +0 -1
  229. package/ui/dist/assets/FileViewer-BL00nsd7.js +0 -61
  230. package/ui/dist/assets/FilesPanel-CeC6YUSd.js +0 -16
  231. package/ui/dist/assets/FleetPanel-EyWF7l3W.js +0 -1
  232. package/ui/dist/assets/HomelabPanel-BRfKRYe7.js +0 -6
  233. package/ui/dist/assets/InfraView-Jmqhg_Yc.js +0 -2
  234. package/ui/dist/assets/InlineEditableField-DgMrLDj1.js +0 -1
  235. package/ui/dist/assets/Input-CBTwa_Iw.js +0 -1
  236. package/ui/dist/assets/IntegrationsPanel-DQL-7Ec6.js +0 -1
  237. package/ui/dist/assets/IntelligenceView-DxD78qfP.js +0 -2
  238. package/ui/dist/assets/LearningPanel-C_JzSbJU.js +0 -1
  239. package/ui/dist/assets/LiveStudio-Db5yeaWo.js +0 -7
  240. package/ui/dist/assets/LogsPanel-CpinKwaZ.js +0 -1
  241. package/ui/dist/assets/McpPanel-D-MqN_f-.js +0 -1
  242. package/ui/dist/assets/MemoryGraphPanel-BnD5jRqf.js +0 -1
  243. package/ui/dist/assets/MemoryTaxonomyPanel-BBI202dd.js +0 -6
  244. package/ui/dist/assets/MemoryWikiPanel-Dn3XZHL0.js +0 -6
  245. package/ui/dist/assets/MeshPanel-C-mRJpr0.js +0 -11
  246. package/ui/dist/assets/MissionCanvas-CbZW83Ch.js +0 -72
  247. package/ui/dist/assets/MissionChat-Bs75jPAD.js +0 -7
  248. package/ui/dist/assets/MissionLibrary-BxQ6SxPe.js +0 -5
  249. package/ui/dist/assets/MissionStart-CBuBPasl.js +0 -1
  250. package/ui/dist/assets/Modal-ybPGvlQs.js +0 -9
  251. package/ui/dist/assets/NvidiaPanel-DdG13OX4.js +0 -1
  252. package/ui/dist/assets/OrganismPanel-xZWUJKyr.js +0 -1
  253. package/ui/dist/assets/OverviewPanel-B45ZYhJV.js +0 -1
  254. package/ui/dist/assets/PageHeader-DdrbS1aq.js +0 -1
  255. package/ui/dist/assets/PersonaProfilesPanel-CKER-EU5.js +0 -8
  256. package/ui/dist/assets/PersonasPanel-CMMQ3nh3.js +0 -1
  257. package/ui/dist/assets/PhoneDeskPanel-Bw_Y-cVE.js +0 -11
  258. package/ui/dist/assets/RecipesPanel-DzMcxpJJ.js +0 -1
  259. package/ui/dist/assets/SecurityPanel-BCq3Fzbr.js +0 -1
  260. package/ui/dist/assets/SelfImprovePanel-YE3hT8jK.js +0 -1
  261. package/ui/dist/assets/SelfProposalsPanel-DXuqBM6p.js +0 -1
  262. package/ui/dist/assets/SessionsPanel-DORz5goR.js +0 -1
  263. package/ui/dist/assets/SessionsTab-qYHDOuC8.js +0 -1
  264. package/ui/dist/assets/SettingsPanel-BbwPu1i7.js +0 -1
  265. package/ui/dist/assets/SettingsView-zgqkDDBJ.js +0 -2
  266. package/ui/dist/assets/SkeletonLoader-r6OGXaU9.js +0 -1
  267. package/ui/dist/assets/SkillsPanel-BjEOBMRo.js +0 -11
  268. package/ui/dist/assets/SomaView-BtCkeWfZ.css +0 -1
  269. package/ui/dist/assets/SomaView-DLzApZVW.js +0 -5
  270. package/ui/dist/assets/StatCard-DLq8aBps.js +0 -1
  271. package/ui/dist/assets/StatusBadge-BqlvIbdj.js +0 -1
  272. package/ui/dist/assets/Tabs-DdUThlp1.js +0 -1
  273. package/ui/dist/assets/TeamsPanel-uIIKoU7I.js +0 -1
  274. package/ui/dist/assets/TelemetryPanel-dVr3yQQr.js +0 -1
  275. package/ui/dist/assets/TitanCanvas-BfitWg9R.css +0 -1
  276. package/ui/dist/assets/TitanCanvas-xHAJqwG2.js +0 -945
  277. package/ui/dist/assets/ToolsView-CG1mZdiy.js +0 -2
  278. package/ui/dist/assets/Tooltip-C2tXJcrN.js +0 -6
  279. package/ui/dist/assets/TraceViewer-BIMD_Osr.js +0 -1
  280. package/ui/dist/assets/TracesPanel-nMUiyMj5.js +0 -1
  281. package/ui/dist/assets/TrainingPanel-CT5R4HWm.js +0 -1
  282. package/ui/dist/assets/VoiceOverlay-Br4QnCtw.js +0 -17
  283. package/ui/dist/assets/VramPanel-CdnJYytg.js +0 -1
  284. package/ui/dist/assets/WatchView-TNU6Ns1Q.js +0 -13
  285. package/ui/dist/assets/WorkTab-wTlX_UKP.js +0 -1
  286. package/ui/dist/assets/WorkflowBuilderPanel-CDpVt5ux.js +0 -6
  287. package/ui/dist/assets/WorkflowsPanel-zsFqsLdn.js +0 -11
  288. package/ui/dist/assets/approvalHeadline-DB9SgR-9.js +0 -1
  289. package/ui/dist/assets/archive-Bh689DNg.js +0 -6
  290. package/ui/dist/assets/arrow-left-WkVYLm80.js +0 -6
  291. package/ui/dist/assets/book-open-ohEXgUsS.js +0 -6
  292. package/ui/dist/assets/bot-DvEcyQcD.js +0 -6
  293. package/ui/dist/assets/chart-column-w3goFd5f.js +0 -6
  294. package/ui/dist/assets/check-CuRYh4Zh.js +0 -6
  295. package/ui/dist/assets/chevron-right-DbLSHmff.js +0 -6
  296. package/ui/dist/assets/circle-check-big-Bkba568b.js +0 -6
  297. package/ui/dist/assets/circle-stop-Bx2ohEg8.js +0 -6
  298. package/ui/dist/assets/clipboard-list-Dj9tORnu.js +0 -6
  299. package/ui/dist/assets/clock-JyQAYy6X.js +0 -6
  300. package/ui/dist/assets/clsx-B-dksMZM.js +0 -1
  301. package/ui/dist/assets/dollar-sign-XxwPAA2a.js +0 -6
  302. package/ui/dist/assets/download-D1izVEOL.js +0 -6
  303. package/ui/dist/assets/external-link-DZ_rZsIt.js +0 -6
  304. package/ui/dist/assets/file-text-Cfawu8Bs.js +0 -6
  305. package/ui/dist/assets/flask-conical-Ql8QxhgY.js +0 -6
  306. package/ui/dist/assets/folder-DAdIw-Pb.js +0 -6
  307. package/ui/dist/assets/funnel-FycfZcXo.js +0 -6
  308. package/ui/dist/assets/git-branch-C2qrhGGu.js +0 -6
  309. package/ui/dist/assets/index-Cml2x9pA.js +0 -507
  310. package/ui/dist/assets/index-yWybhcfI.css +0 -1
  311. package/ui/dist/assets/layers-yzjtGlHB.js +0 -6
  312. package/ui/dist/assets/legacy-D21WSMF1.js +0 -3
  313. package/ui/dist/assets/lightbulb-BZJNK69S.js +0 -6
  314. package/ui/dist/assets/link-CnFkBkaY.js +0 -6
  315. package/ui/dist/assets/list-todo-BlgfQHup.js +0 -6
  316. package/ui/dist/assets/message-square-CRsG9u6_.js +0 -6
  317. package/ui/dist/assets/mic-B32RHc7Y.js +0 -6
  318. package/ui/dist/assets/missions-1iw8Z2_0.js +0 -1
  319. package/ui/dist/assets/network-C9RXQGrV.js +0 -6
  320. package/ui/dist/assets/pause-BT1Bc2q3.js +0 -6
  321. package/ui/dist/assets/pencil-BK5IU6o0.js +0 -6
  322. package/ui/dist/assets/play-Cl1nC_gc.js +0 -6
  323. package/ui/dist/assets/plug-DvcpOalj.js +0 -6
  324. package/ui/dist/assets/plus-Dpo1qfrl.js +0 -6
  325. package/ui/dist/assets/radio-C5c9IyqX.js +0 -6
  326. package/ui/dist/assets/refresh-cw-C-iZkzuS.js +0 -6
  327. package/ui/dist/assets/rotate-ccw-qzrB3SNw.js +0 -6
  328. package/ui/dist/assets/save-DwR9wQVu.js +0 -6
  329. package/ui/dist/assets/search-D10l0m3-.js +0 -6
  330. package/ui/dist/assets/send-DtXGsaFW.js +0 -6
  331. package/ui/dist/assets/server-BzisF3LL.js +0 -6
  332. package/ui/dist/assets/settings-Dbwd1_-c.js +0 -6
  333. package/ui/dist/assets/shield-check-CXlDJyAW.js +0 -6
  334. package/ui/dist/assets/square-BBC-JKzY.js +0 -11
  335. package/ui/dist/assets/terminal-DaBIlWEM.js +0 -6
  336. package/ui/dist/assets/test-tube-CDATRD5t.js +0 -11
  337. package/ui/dist/assets/toggle-right-DTmrC5RD.js +0 -11
  338. package/ui/dist/assets/trash-2-CTeyjxD_.js +0 -6
  339. package/ui/dist/assets/trending-up-CXPRjRV4.js +0 -6
  340. package/ui/dist/assets/trophy-DbVdXRtU.js +0 -6
  341. package/ui/dist/assets/volume-2-DYDBmm3M.js +0 -6
  342. package/ui/dist/assets/wifi-off-BBuIGbiP.js +0 -6
  343. package/ui/dist/assets/zoom-out-D47_pRAO.js +0 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "titan-agent",
3
- "version": "7.0.0",
3
+ "version": "7.2.0",
4
4
  "description": "TITAN — the AI agent that provably teaches itself. TypeScript agent framework with replay-verified self-learned skills (Muscle Memory), one-minute Welcome Mode setup, a living desk with heartbeat/reminders/proactive memory, multi-agent orchestration, 36-provider routing, approval gates, receipts, evals, and a React Mission Control dashboard. Open-source, MIT.",
5
5
  "author": "Tony Elliott (https://github.com/Djtony707)",
6
6
  "repository": {
@@ -49,7 +49,7 @@
49
49
  "start": "node dist/cli/index.js",
50
50
  "lint": "eslint src/ --ext .ts",
51
51
  "lint:fix": "eslint src/ --ext .ts --fix",
52
- "test": "vitest run --reporter=basic",
52
+ "test": "vitest run --reporter=default",
53
53
  "test:watch": "vitest",
54
54
  "test:coverage": "vitest run --coverage",
55
55
  "test:e2e": "npx playwright test",
@@ -135,7 +135,7 @@
135
135
  "picomatch": "^4.0.4",
136
136
  "flatted": "^3.4.2",
137
137
  "basic-ftp": "^5.3.1",
138
- "hono": "^4.12.24",
138
+ "hono": "^4.12.27",
139
139
  "@hono/node-server": "^1.19.13",
140
140
  "axios": "^1.17.0",
141
141
  "vite": "^6.4.2",
@@ -154,40 +154,40 @@
154
154
  }
155
155
  },
156
156
  "dependencies": {
157
- "@inquirer/prompts": "^8.4.3",
158
- "@langchain/core": "^1.1.46",
157
+ "@inquirer/prompts": "^8.5.2",
158
+ "@langchain/core": "^1.2.1",
159
159
  "@mozilla/readability": "^0.6.0",
160
160
  "boxen": "^8.0.1",
161
161
  "chalk": "^5.3.0",
162
- "commander": "^14.0.3",
162
+ "commander": "^15.0.0",
163
163
  "dotenv": "^17.4.2",
164
164
  "express": "^4.22.2",
165
165
  "jsdom": "^29.1.1",
166
- "node-cron": "^4.2.1",
167
- "ora": "^9.4.0",
168
- "posthog-node": "^5.34.2",
166
+ "node-cron": "^4.5.0",
167
+ "ora": "^9.4.1",
168
+ "posthog-node": "^5.39.4",
169
169
  "turndown": "^7.2.2",
170
- "undici": "^8.2.0",
171
- "uuid": "^14.0.0",
172
- "ws": "^8.20.1",
170
+ "undici": "^8.6.0",
171
+ "uuid": "^14.0.1",
172
+ "ws": "^8.21.0",
173
173
  "zod": "^3.23.8"
174
174
  },
175
175
  "devDependencies": {
176
- "@playwright/test": "^1.60.0",
176
+ "@playwright/test": "^1.61.1",
177
177
  "@types/express": "^4.17.21",
178
- "@types/jsdom": "^28.0.2",
179
- "@types/node": "^25.7.0",
178
+ "@types/jsdom": "^28.0.3",
179
+ "@types/node": "^25.9.4",
180
180
  "@types/turndown": "^5.0.6",
181
181
  "@types/uuid": "^11.0.0",
182
182
  "@types/ws": "^8.5.12",
183
- "@typescript-eslint/eslint-plugin": "^8.59.3",
183
+ "@typescript-eslint/eslint-plugin": "^8.62.1",
184
184
  "@typescript-eslint/parser": "^8.12.0",
185
- "@vitest/coverage-v8": "^2.1.9",
185
+ "@vitest/coverage-v8": "^4.1.9",
186
186
  "eslint": "^8.57.1",
187
187
  "tsup": "^8.3.5",
188
- "tsx": "^4.19.2",
188
+ "tsx": "^4.23.0",
189
189
  "typescript": "^5.9.3",
190
- "vitest": "^2.1.9"
190
+ "vitest": "^4.1.9"
191
191
  },
192
192
  "tsup": {
193
193
  "entry": [
@@ -263,13 +263,13 @@
263
263
  }
264
264
  },
265
265
  "optionalDependencies": {
266
- "@browserbasehq/stagehand": "^3.4.0",
267
- "@whiskeysockets/baileys": "^6.7.0",
268
- "bonjour-service": "^1.3.0",
269
- "imapflow": "^1.3.3",
270
- "livekit-server-sdk": "^2.9.1",
271
- "matrix-js-sdk": "^41.5.0",
272
- "node-llama-cpp": "^3.0.0",
266
+ "@browserbasehq/stagehand": "^3.6.0",
267
+ "@whiskeysockets/baileys": "^6.7.23",
268
+ "bonjour-service": "^1.4.2",
269
+ "imapflow": "^1.4.3",
270
+ "livekit-server-sdk": "^2.16.0",
271
+ "matrix-js-sdk": "^41.8.0",
272
+ "node-llama-cpp": "^3.19.0",
273
273
  "pdf-parse": "^2.4.5",
274
274
  "playwright": "^1.58.2"
275
275
  },
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./createLucideIcon-qnlrxww7.js";import{E as i,H as a,c as o,ir as s}from"./index-WI-E4I3h.js";var c=r(`heart`,[[`path`,{d:`M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z`,key:`c3ymky`}]]),l=r(`sticky-note`,[[`path`,{d:`M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z`,key:`qazsjp`}],[`path`,{d:`M15 3v4a2 2 0 0 0 2 2h4`,key:`40519r`}]]),u=e(t(),1),d=n();function f({icon:e,title:t,children:n}){return(0,d.jsxs)(`div`,{className:`rounded-xl border px-5 py-4 shadow-md`,style:{background:`var(--theme-paper, var(--color-bg-secondary))`,borderColor:`var(--theme-paper-line, var(--color-border))`,color:`var(--theme-ink, var(--color-text))`},children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 text-sm font-semibold`,style:{fontFamily:`var(--theme-font-display, inherit)`},children:[(0,d.jsx)(`span`,{style:{color:`var(--theme-accent)`},children:e}),` `,t]}),n]})}function p(){let e=s(),[t,n]=(0,u.useState)(null),[r,p]=(0,u.useState)(null);(0,u.useEffect)(()=>{a(`/api/memory/about-me`,{headers:{"Content-Type":`application/json`}}).then(e=>e.json()).then(e=>e.error?p(e.message||e.error):n(e)).catch(e=>p(e.message))},[]);let m=new Map;for(let e of t?.facts??[]){let t=m.get(e.category)||[];t.push(e),m.set(e.category,t)}return(0,d.jsxs)(`div`,{className:`max-w-2xl mx-auto px-4 py-8 space-y-4`,children:[(0,d.jsx)(`h1`,{className:`text-2xl font-semibold`,style:{color:`var(--theme-ink, var(--color-text))`,fontFamily:`var(--theme-font-display, inherit)`},children:`What I know about you`}),(0,d.jsx)(`p`,{className:`text-sm`,style:{color:`var(--theme-ink-soft, var(--color-text-muted))`},children:`Everything here was learned from working together. Ask me in chat to remember or forget anything.`}),r&&(0,d.jsx)(f,{icon:(0,d.jsx)(l,{size:16}),title:`Hmm`,children:(0,d.jsxs)(`p`,{className:`text-sm`,children:[`I couldn't read my memory just now: `,r]})}),t&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f,{icon:(0,d.jsx)(c,{size:16}),title:`Who you've asked me to be`,children:(0,d.jsx)(`p`,{className:`text-[14px] leading-relaxed whitespace-pre-wrap`,children:t.identity||`Nothing set yet — tell me in chat, or set my identity in the Workshop.`})}),(0,d.jsx)(f,{icon:(0,d.jsx)(i,{size:16}),title:`Things I've noticed`,children:t.observations.length===0?(0,d.jsx)(`p`,{className:`text-sm opacity-70`,children:`Nothing yet — I pick these up over time as we work.`}):(0,d.jsx)(`ul`,{className:`space-y-1.5 text-[14px] leading-relaxed list-disc pl-5`,children:t.observations.slice(-25).reverse().map((e,t)=>(0,d.jsx)(`li`,{children:e},t))})}),(0,d.jsx)(f,{icon:(0,d.jsx)(l,{size:16}),title:`Facts I keep`,children:m.size===0?(0,d.jsx)(`p`,{className:`text-sm opacity-70`,children:`No stored facts yet — say "remember that …" in chat.`}):(0,d.jsx)(`div`,{className:`space-y-3`,children:[...m.entries()].map(([e,t])=>(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`text-[11px] uppercase tracking-wide mb-1 opacity-60`,children:e}),(0,d.jsx)(`ul`,{className:`space-y-1 text-[13.5px]`,children:t.slice(0,12).map(e=>(0,d.jsxs)(`li`,{children:[(0,d.jsxs)(`span`,{className:`opacity-70`,children:[e.key,`:`]}),` `,e.value]},e.key))})]},e))})})]}),(0,d.jsxs)(`button`,{onClick:()=>e(`/knowledge/memory-graph`),className:`flex items-center gap-1.5 text-xs hover:underline underline-offset-2`,style:{color:`var(--theme-ink-soft, var(--color-text-muted))`},children:[(0,d.jsx)(o,{size:12}),` The deep memory tools (graph, wiki, taxonomy) live in the Workshop`]})]})}export{p as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./clipboard-list-C2HUEjZc.js";import{t as i}from"./funnel-D2Dkn8Pf.js";import{t as a}from"./refresh-cw-Disd5wRB.js";import{a as o,mt as s,pt as c}from"./index-WI-E4I3h.js";import{t as l}from"./PageHeader-CH85uoZG.js";var u=e(t(),1),d=n();function f(){let{toast:e}=o(),[t,n]=(0,u.useState)([]),[f,p]=(0,u.useState)(null),[m,h]=(0,u.useState)(!0),[g,_]=(0,u.useState)(``),[v,y]=(0,u.useState)(``),b=async()=>{h(!0);try{let[e,t]=await Promise.all([c({source:g||void 0,action:v||void 0,limit:100}),s(24)]);n(e),p(t)}catch(t){e(`error`,`Couldn't load audit log — try again. (${t.message})`)}h(!1)};(0,u.useEffect)(()=>{b()},[g,v]);let x=e=>e===`success`?`text-[var(--success)]`:e===`failure`?`text-[var(--error)]`:e===`escalated`?`text-[var(--warning)]`:`text-[var(--text-muted)]`,S=e=>e===`success`?`bg-[var(--success)]/10 border-[var(--success)]/20`:e===`failure`?`bg-[var(--error)]/10 border-[var(--error)]/20`:e===`escalated`?`bg-[var(--warning)]/10 border-[var(--warning)]/20`:`bg-[var(--bg-tertiary)] border-[var(--border)]`,C=e=>e.startsWith(`daemon`)?`bg-purple-500/10 text-purple-400 border-purple-500/20`:e===`autopilot`?`bg-blue-500/10 text-blue-400 border-blue-500/20`:e===`user`?`bg-emerald-500/10 text-emerald-400 border-emerald-500/20`:e===`initiative`?`bg-amber-500/10 text-amber-400 border-amber-500/20`:`bg-[var(--bg-tertiary)] text-[var(--text-muted)] border-[var(--border)]`,w=e=>{try{let t=new Date(e),n=new Date().getTime()-t.getTime();return n<6e4?`${Math.round(n/1e3)}s ago`:n<36e5?`${Math.round(n/6e4)}m ago`:n<864e5?`${Math.round(n/36e5)}h ago`:t.toLocaleDateString()}catch{return e}},T=[...new Set(t.map(e=>e.source))].sort(),E=[...new Set(t.map(e=>e.action))].sort();return(0,d.jsxs)(`div`,{className:`space-y-6`,children:[(0,d.jsx)(l,{title:`Audit Log`,subtitle:`Every autonomous action logged for accountability`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`System`},{label:`Audit`}],actions:(0,d.jsx)(`button`,{onClick:b,className:`p-2 rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors`,children:(0,d.jsx)(a,{size:14})})}),f&&(0,d.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,d.jsxs)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4`,children:[(0,d.jsx)(`p`,{className:`text-sm text-[var(--text-muted)]`,children:`Actions (24h)`}),(0,d.jsx)(`p`,{className:`text-2xl font-bold text-[var(--text)]`,children:f.totalActions})]}),(0,d.jsxs)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4`,children:[(0,d.jsx)(`p`,{className:`text-sm text-[var(--text-muted)]`,children:`Success Rate`}),(0,d.jsxs)(`p`,{className:`text-2xl font-bold ${f.successRate>=80?`text-[var(--success)]`:f.successRate>=50?`text-[var(--warning)]`:`text-[var(--error)]`}`,children:[f.successRate,`%`]})]}),(0,d.jsxs)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4`,children:[(0,d.jsx)(`p`,{className:`text-sm text-[var(--text-muted)]`,children:`Sources`}),(0,d.jsx)(`p`,{className:`text-2xl font-bold text-[var(--text)]`,children:Object.keys(f.bySource).length})]}),(0,d.jsxs)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4`,children:[(0,d.jsx)(`p`,{className:`text-sm text-[var(--text-muted)]`,children:`Top Tool`}),(0,d.jsx)(`p`,{className:`text-lg font-semibold text-[var(--accent)] truncate`,children:f.topTools[0]?.tool||`none`})]})]}),f&&Object.keys(f.bySource).length>0&&(0,d.jsxs)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4`,children:[(0,d.jsx)(`h2`,{className:`text-sm font-semibold text-[var(--text)] mb-3`,children:`Actions by Source (24h)`}),(0,d.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Object.entries(f.bySource).sort((e,t)=>t[1]-e[1]).map(([e,t])=>(0,d.jsxs)(`button`,{onClick:()=>_(g===e?``:e),className:`px-3 py-1.5 text-xs rounded-md border transition-colors ${g===e?`bg-[var(--accent)] text-white border-[var(--accent)]`:C(e)}`,children:[e,`: `,t]},e))})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,d.jsx)(i,{size:14,className:`text-[var(--text-muted)]`}),(0,d.jsxs)(`select`,{value:g,onChange:e=>_(e.target.value),className:`px-3 py-1.5 text-xs bg-[var(--bg-secondary)] border border-[var(--border)] rounded-md text-[var(--text)]`,children:[(0,d.jsx)(`option`,{value:``,children:`All Sources`}),T.map(e=>(0,d.jsx)(`option`,{value:e,children:e},e))]}),(0,d.jsxs)(`select`,{value:v,onChange:e=>y(e.target.value),className:`px-3 py-1.5 text-xs bg-[var(--bg-secondary)] border border-[var(--border)] rounded-md text-[var(--text)]`,children:[(0,d.jsx)(`option`,{value:``,children:`All Actions`}),E.map(e=>(0,d.jsx)(`option`,{value:e,children:e},e))]}),(g||v)&&(0,d.jsx)(`button`,{onClick:()=>{_(``),y(``)},className:`text-xs text-[var(--accent)] hover:underline`,children:`Clear`})]}),m?(0,d.jsx)(`div`,{className:`text-[var(--text-muted)] text-sm`,children:`Loading audit log...`}):t.length===0?(0,d.jsxs)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-8 text-center`,children:[(0,d.jsx)(r,{className:`w-10 h-10 text-[var(--text-muted)] mx-auto mb-3`}),(0,d.jsx)(`p`,{className:`text-[var(--text-secondary)]`,children:`No audit entries found`}),(0,d.jsx)(`p`,{className:`text-xs text-[var(--text-muted)]`,children:`Autonomous actions will appear here as TITAN operates.`})]}):(0,d.jsx)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden`,children:(0,d.jsx)(`div`,{className:`overflow-x-auto`,children:(0,d.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{className:`border-b border-[var(--border)] text-[var(--text-muted)]`,children:[(0,d.jsx)(`th`,{className:`text-left px-4 py-2 font-medium`,children:`Time`}),(0,d.jsx)(`th`,{className:`text-left px-4 py-2 font-medium`,children:`Action`}),(0,d.jsx)(`th`,{className:`text-left px-4 py-2 font-medium`,children:`Source`}),(0,d.jsx)(`th`,{className:`text-left px-4 py-2 font-medium`,children:`Tool`}),(0,d.jsx)(`th`,{className:`text-left px-4 py-2 font-medium`,children:`Result`}),(0,d.jsx)(`th`,{className:`text-left px-4 py-2 font-medium`,children:`Detail`})]})}),(0,d.jsx)(`tbody`,{children:t.map((e,t)=>(0,d.jsxs)(`tr`,{className:`border-b border-[var(--border)]/50 last:border-0 hover:bg-[var(--bg-tertiary)] transition-colors`,children:[(0,d.jsx)(`td`,{className:`px-4 py-2 text-[var(--text-muted)] whitespace-nowrap`,children:w(e.timestamp)}),(0,d.jsx)(`td`,{className:`px-4 py-2 text-[var(--text)] font-medium`,children:e.action}),(0,d.jsx)(`td`,{className:`px-4 py-2`,children:(0,d.jsx)(`span`,{className:`px-2 py-0.5 rounded text-[10px] border ${C(e.source)}`,children:e.source})}),(0,d.jsx)(`td`,{className:`px-4 py-2 text-[var(--text-secondary)] font-mono`,children:e.tool||`-`}),(0,d.jsx)(`td`,{className:`px-4 py-2`,children:e.result?(0,d.jsx)(`span`,{className:`px-2 py-0.5 rounded text-[10px] border ${S(e.result)} ${x(e.result)}`,children:e.result}):`-`}),(0,d.jsx)(`td`,{className:`px-4 py-2 text-[var(--text-muted)] max-w-[200px] truncate`,children:e.detail?JSON.stringify(e.detail):`-`})]},t))})]})})})]})}export{f as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./createLucideIcon-qnlrxww7.js";import{t as i}from"./bot-CWDCc265.js";import{t as a}from"./circle-check-big-C-JUM7wb.js";import{t as o}from"./database-C1SgHa8T.js";import{t as s}from"./message-square-BpzrINHz.js";import{t as c}from"./network-CM7y1ats.js";import{t as l}from"./play-9WxZWVHA.js";import{t as u}from"./radio-D-XnoAVu.js";import{t as d}from"./refresh-cw-Disd5wRB.js";import{t as f}from"./rotate-ccw-Cw1T2W1T.js";import{t as p}from"./save-DP7oNar2.js";import{t as m}from"./server-DFfeYjoM.js";import{At as h,F as g,H as _,M as v,R as y,T as b,Yn as x,b as S,h as C,m as w,o as T,u as E}from"./index-WI-E4I3h.js";var D=r(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),O=r(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),k=e(t(),1),A=n(),j=[{key:`autonomy-mode`,label:`Autonomous Mode`,description:`TITAN acts without asking for approval on moderate-risk tools. Supervised = asks for dangerous ops. Locked = asks for everything.`,icon:(0,A.jsx)(T,{className:`h-4 w-4`}),section:`autonomy`,field:`mode`,danger:!0},{key:`autonomy-autoProposeGoals`,label:`Auto-Propose Goals`,description:`TITAN can create its own goals from drives, observations, and initiatives.`,icon:(0,A.jsx)(w,{className:`h-4 w-4`}),section:`autonomy`,field:`autoProposeGoals`},{key:`autonomy-proactiveInitiative`,label:`Proactive Initiative`,description:`TITAN takes initiative on its own between user messages.`,icon:(0,A.jsx)(u,{className:`h-4 w-4`}),section:`autonomy`,field:`proactiveInitiative`},{key:`selfMod-enabled`,label:`Self-Modification`,description:`Captures autonomous code changes and queues them for review.`,icon:(0,A.jsx)(i,{className:`h-4 w-4`}),section:`selfMod`,field:`enabled`,danger:!0},{key:`selfMod-autoPR`,label:`Auto-Open PRs`,description:`When specialists approve a self-mod, automatically open a GitHub PR.`,icon:(0,A.jsx)(M,{className:`h-4 w-4`}),section:`selfMod`,field:`autoPR`},{key:`commandPost-enabled`,label:`Command Post`,description:`Org chart, agent registry, approvals, budgets, and goal tracking.`,icon:(0,A.jsx)(m,{className:`h-4 w-4`}),section:`commandPost`,field:`enabled`},{key:`mesh-enabled`,label:`Mesh Networking`,description:`Distributed TITAN nodes. Share tasks and models across machines.`,icon:(0,A.jsx)(c,{className:`h-4 w-4`}),section:`mesh`,field:`enabled`},{key:`autopilot-enabled`,label:`Autopilot`,description:`Nightly autonomous checks, goal reviews, and self-improvement runs.`,icon:(0,A.jsx)(l,{className:`h-4 w-4`}),section:`autopilot`,field:`enabled`},{key:`autopilot-selfInitiate`,label:`Autopilot Self-Initiate`,description:`Autopilot can create and start its own goals without human trigger.`,icon:(0,A.jsx)(w,{className:`h-4 w-4`}),section:`autopilot`,field:`selfInitiate`},{key:`brain-enabled`,label:`Brain (Local Router)`,description:`Small local model routes tools instead of sending full schemas to the cloud LLM.`,icon:(0,A.jsx)(g,{className:`h-4 w-4`}),section:`brain`,field:`enabled`},{key:`mcp-server-enabled`,label:`MCP Server`,description:`Expose TITAN tools as a Model Context Protocol server for other AI apps.`,icon:(0,A.jsx)(O,{className:`h-4 w-4`}),section:`mcp`,field:`serverEnabled`},{key:`training-enabled`,label:`Model Training`,description:`Fine-tune local LoRA adapters from session history.`,icon:(0,A.jsx)(D,{className:`h-4 w-4`}),section:`training`,field:`enabled`},{key:`teams-enabled`,label:`Teams`,description:`Multi-user teams with roles, invites, and permissions.`,icon:(0,A.jsx)(E,{className:`h-4 w-4`}),section:`teams`,field:`enabled`},{key:`tunnel-enabled`,label:`Cloudflare Tunnel`,description:`Expose TITAN securely on the public internet via Cloudflare.`,icon:(0,A.jsx)(b,{className:`h-4 w-4`}),section:`tunnel`,field:`enabled`},{key:`vault-enabled`,label:`Vault`,description:`Encrypted secret storage for API keys and credentials.`,icon:(0,A.jsx)(C,{className:`h-4 w-4`}),section:`vault`,field:`enabled`},{key:`capsolver-enabled`,label:`CAPTCHA Solver`,description:`Automatically solve CAPTCHAs during web browsing.`,icon:(0,A.jsx)(C,{className:`h-4 w-4`}),section:`capsolver`,field:`enabled`},{key:`deliberation-autoDetect`,label:`Auto-Deliberation`,description:`TITAN automatically deliberates on complex tasks before acting.`,icon:(0,A.jsx)(s,{className:`h-4 w-4`}),section:`deliberation`,field:`autoDetect`},{key:`selfImprove-autoApply`,label:`Auto-Apply Self-Improvements`,description:`Apply prompt and config improvements automatically without approval.`,icon:(0,A.jsx)(w,{className:`h-4 w-4`}),section:`selfImprove`,field:`autoApply`},{key:`memory-vectorSearchEnabled`,label:`Vector Memory Search`,description:`Semantic search across episodic memories using embeddings.`,icon:(0,A.jsx)(o,{className:`h-4 w-4`}),section:`memory`,field:`vectorSearchEnabled`}];function M({className:e}){return(0,A.jsx)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,A.jsx)(`path`,{d:`M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z`})})}function N({active:e}){return e?(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-success/15 px-2 py-0.5 text-[10px] font-medium text-success`,children:[(0,A.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-success shadow-[0_0_4px_rgba(34,197,94,0.4)]`}),`ON`]}):(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-bg-tertiary px-2 py-0.5 text-[10px] font-medium text-text-muted`,children:[(0,A.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-border-light`}),`OFF`]})}function P(){let[e,t]=(0,k.useState)(null),[n,r]=(0,k.useState)(!0),[i,o]=(0,k.useState)(!1),[s,c]=(0,k.useState)(!1),[l,u]=(0,k.useState)(null),[m,g]=(0,k.useState)(new Set),[b,C]=(0,k.useState)({}),w=(0,k.useCallback)((e,t)=>{u({type:e,message:t}),setTimeout(()=>u(null),4e3)},[]);(0,k.useEffect)(()=>{h().then(e=>{t(e),r(!1)}).catch(e=>{w(`error`,e instanceof Error?e.message:`Failed to load config`),r(!1)})},[w]);let E=(t,n)=>{if(n===`serverEnabled`)return!!e?.mcp?.server?.enabled;if(n===`selfInitiate`)return!!e?.autopilot?.goals?.selfInitiate;let r=`${t}.${n}`;if(r in b)return b[r];let i=e?.[t];return i?i[n]:!1},D=(e,t,n)=>{let r=`${e}.${t}`;C(e=>({...e,[r]:n})),g(e=>new Set(e).add(r))},O=j.filter(e=>{let t=E(e.section,e.field);return typeof t==`boolean`?t:t===`autonomous`}).length;return n?(0,A.jsx)(`div`,{className:`space-y-4`,children:Array.from({length:4}).map((e,t)=>(0,A.jsx)(`div`,{className:`h-32 animate-pulse rounded-xl border border-border bg-bg-secondary`},t))}):(0,A.jsxs)(`div`,{className:`space-y-5`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{className:`text-base font-semibold text-text`,children:`Autonomy & Features`}),(0,A.jsxs)(`p`,{className:`mt-0.5 text-xs text-text-muted`,children:[O,` of `,j.length,` features active`]})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m.size>0&&(0,A.jsxs)(`span`,{className:`rounded-full bg-accent/15 px-2.5 py-1 text-[10px] font-medium text-accent`,children:[m.size,` unsaved`]}),(0,A.jsxs)(`button`,{onClick:async()=>{o(!0);try{let e={};for(let t of m){let[n,r]=t.split(`.`),i=b[t];e[n]||(e[n]={}),r===`serverEnabled`?(e.mcp||={},e.mcp.server={enabled:i}):r===`selfInitiate`?(e.autopilot||={},e.autopilot.goals={selfInitiate:i}):e[n][r]=i}let n=await x(e);t(n),C({}),g(new Set),y(`autonomy_settings_saved`,{changedCount:m.size}),w(`success`,`Saved ${m.size} change${m.size===1?``:`s`}`)}catch(e){w(`error`,e instanceof Error?e.message:`Failed to save`)}finally{o(!1)}},disabled:i||m.size===0,className:`flex items-center gap-1.5 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:[i?(0,A.jsx)(S,{className:`h-3.5 w-3.5 animate-spin`}):(0,A.jsx)(p,{className:`h-3.5 w-3.5`}),i?`Saving…`:`Save Changes`]})]})]}),l&&(0,A.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border px-3 py-2 text-xs ${l.type===`success`?`border-success/50 text-success`:l.type===`error`?`border-error/50 text-error`:`border-accent/50 text-accent`}`,children:[l.type===`success`?(0,A.jsx)(a,{className:`h-4 w-4`}):l.type===`error`?(0,A.jsx)(v,{className:`h-4 w-4`}):(0,A.jsx)(d,{className:`h-4 w-4 animate-spin`}),l.message]}),(0,A.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-secondary p-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,A.jsx)(T,{className:`h-4 w-4 text-accent`}),(0,A.jsx)(`h3`,{className:`text-sm font-medium text-text`,children:`Autonomy Level`}),(0,A.jsx)(N,{active:E(`autonomy`,`mode`)===`autonomous`})]}),(0,A.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-2`,children:[`locked`,`supervised`,`autonomous`].map(e=>(0,A.jsxs)(`button`,{onClick:()=>D(`autonomy`,`mode`,e),className:`rounded-lg border p-3 text-left transition-all ${E(`autonomy`,`mode`)===e?`border-accent bg-accent/10`:`border-border hover:border-border-light`}`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsx)(`span`,{className:`text-xs font-medium text-text capitalize`,children:e}),e===`autonomous`&&(0,A.jsx)(`span`,{className:`text-[9px] text-error`,children:`High`}),e===`supervised`&&(0,A.jsx)(`span`,{className:`text-[9px] text-warning`,children:`Med`}),e===`locked`&&(0,A.jsx)(`span`,{className:`text-[9px] text-success`,children:`Low`})]}),(0,A.jsxs)(`p`,{className:`mt-1 text-[10px] text-text-muted leading-relaxed`,children:[e===`locked`&&`Asks for approval on every tool call.`,e===`supervised`&&`Auto-approves safe tools. Asks for dangerous ops.`,e===`autonomous`&&`Full auto. Only asks for destructive/rare ops.`]})]},e))})]}),(0,A.jsx)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-3`,children:j.filter(e=>e.field!==`mode`).map(e=>{let t=E(e.section,e.field),n=typeof t==`boolean`?t:!1;return(0,A.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border p-3 transition-colors ${m.has(`${e.section}.${e.field}`)?`border-accent/40 bg-accent/5`:`border-border bg-bg-secondary`}`,children:[(0,A.jsx)(`div`,{className:`mt-0.5 flex-shrink-0 rounded-lg p-2 ${n?`bg-accent/15 text-accent`:`bg-bg-tertiary text-text-muted`}`,children:e.icon}),(0,A.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,A.jsx)(`span`,{className:`text-sm font-medium text-text`,children:e.label}),(0,A.jsx)(N,{active:n})]}),(0,A.jsx)(`p`,{className:`mt-0.5 text-[11px] text-text-muted leading-relaxed`,children:e.description})]}),(0,A.jsxs)(`label`,{className:`flex-shrink-0 relative inline-flex items-center cursor-pointer`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:n,onChange:t=>D(e.section,e.field,t.target.checked),className:`sr-only peer`}),(0,A.jsx)(`div`,{className:`relative w-9 h-5 rounded-full transition-colors ${n?`bg-accent`:`bg-border`}`,children:(0,A.jsx)(`div`,{className:`absolute top-[2px] left-[2px] bg-white w-4 h-4 rounded-full transition-transform ${n?`translate-x-4`:`translate-x-0`}`})})]})]},e.key)})}),(0,A.jsx)(`div`,{className:`rounded-xl border border-warning/30 bg-warning/5 p-4`,children:(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,A.jsx)(f,{className:`h-4 w-4 text-warning mt-0.5`}),(0,A.jsxs)(`div`,{className:`flex-1`,children:[(0,A.jsx)(`h3`,{className:`text-sm font-medium text-text`,children:`Restart TITAN`}),(0,A.jsx)(`p`,{className:`mt-0.5 text-[11px] text-text-muted`,children:`Some feature changes require a full restart to take effect. This will briefly interrupt service.`})]}),(0,A.jsxs)(`button`,{onClick:async()=>{c(!0);try{let e=await _(`/api/system/request-restart`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({reason:`Settings change via Autonomy Panel`,requestedBy:`user`})});if(!e.ok){let t=await e.json().catch(()=>({error:`Request failed`}));w(`error`,t.error||`Restart request failed`),c(!1);return}let{approval:t}=await e.json(),n=await _(`/api/command-post/approvals/${t.id}/approve`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({decidedBy:`user`,note:`Approved via Autonomy Panel`})});if(!n.ok){let e=await n.json().catch(()=>({error:`Approval failed`}));w(`error`,e.error||`Restart approval failed`),c(!1);return}w(`info`,`TITAN is restarting...`),y(`titan_restart_initiated`,{source:`autonomy_panel`});let r=0,i=setInterval(async()=>{r++;try{(await _(`/api/health`)).ok&&(clearInterval(i),c(!1),w(`success`,`TITAN restarted successfully`))}catch{}r>30&&(clearInterval(i),c(!1),w(`error`,`Restart timed out — check Titan PC`))},2e3)}catch(e){w(`error`,e instanceof Error?e.message:`Restart failed`),c(!1)}},disabled:s,className:`flex items-center gap-1.5 rounded-lg border border-warning/50 px-3 py-1.5 text-xs font-medium text-warning transition-colors hover:bg-warning/10 disabled:opacity-50`,children:[s?(0,A.jsx)(S,{className:`h-3.5 w-3.5 animate-spin`}):(0,A.jsx)(f,{className:`h-3.5 w-3.5`}),s?`Restarting…`:`Restart`]})]})})]})}export{P as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{H as r}from"./index-WI-E4I3h.js";import{t as i}from"./PageHeader-CH85uoZG.js";var a=e(t(),1),o=n();function s(){let[e,t]=(0,a.useState)(null),[n,s]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{r(`/api/config`,{headers:{"Content-Type":`application/json`}}).then(e=>e.json()).then(e=>t({mode:e.autonomy?.mode||`supervised`,interval:e.autonomy?.autopilotIntervalMs})).catch(()=>t({mode:`supervised`})).finally(()=>s(!1))},[]),n?(0,o.jsx)(`div`,{className:`text-[var(--text-muted)]`,children:`Loading autopilot config...`}):(0,o.jsxs)(`div`,{className:`space-y-6`,children:[(0,o.jsx)(i,{title:`Autopilot`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Agent`},{label:`Autopilot`}]}),(0,o.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,o.jsxs)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4`,children:[(0,o.jsx)(`p`,{className:`text-sm text-[var(--text-muted)]`,children:`Mode`}),(0,o.jsx)(`p`,{className:`text-lg font-semibold text-[var(--text)] capitalize`,children:e?.mode})]}),(0,o.jsxs)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4`,children:[(0,o.jsx)(`p`,{className:`text-sm text-[var(--text-muted)]`,children:`Interval`}),(0,o.jsx)(`p`,{className:`text-lg font-semibold text-[var(--text)]`,children:e?.interval?`${Math.round(e.interval/6e4)} min`:`Not set`})]})]}),(0,o.jsx)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4`,children:(0,o.jsx)(`p`,{className:`text-sm text-[var(--text-muted)]`,children:`Autopilot mode enables TITAN to run scheduled tasks automatically. Configure via titan.json.`})})]})}export{s as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./createLucideIcon-qnlrxww7.js";import{t as i}from"./chevron-right-A_pvnRh_.js";import{t as a}from"./clock-DSPgndSD.js";import{t as o}from"./flask-conical-B1YVft4E.js";import{t as s}from"./pause-C4TDJSfA.js";import{t as c}from"./play-9WxZWVHA.js";import{t as l}from"./refresh-cw-Disd5wRB.js";import{t as u}from"./trending-up-Ba9TwEow.js";import{t as d}from"./trophy-Gfv1QC45.js";import{H as f,P as p,_ as m}from"./index-WI-E4I3h.js";import{t as h}from"./PageHeader-CH85uoZG.js";var g=r(`settings-2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),_=e(t(),1),v=n();function y(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function b(e){return e<60?`${Math.round(e)}s`:`${Math.floor(e/60)}m ${Math.round(e%60)}s`}function x({runs:e}){if(e.length<2)return(0,v.jsx)(`div`,{className:`flex items-center justify-center h-[200px] rounded-xl border border-bg-tertiary bg-bg-secondary text-text-muted text-sm`,children:`Need at least 2 runs to show chart`});let t={top:20,right:20,bottom:30,left:50},n=800-t.left-t.right,r=200-t.top-t.bottom,i=e.map(e=>e.val_score),a=Math.max(0,Math.min(...i)-5),o=Math.min(100,Math.max(...i)+5),s=e.length>0?e[0].val_score:null,c=r=>t.left+r/(e.length-1)*n,l=e=>t.top+r-(e-a)/(o-a)*r,u=e.map((e,t)=>`${t===0?`M`:`L`} ${c(t)} ${l(e.val_score)}`).join(` `),d=s==null?null:l(s);return(0,v.jsxs)(`div`,{className:`rounded-xl border border-bg-tertiary bg-bg-secondary p-4 overflow-x-auto`,children:[(0,v.jsx)(`h3`,{className:`text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide`,children:`Val Score Over Time`}),(0,v.jsxs)(`svg`,{viewBox:`0 0 800 200`,className:`w-full`,style:{minWidth:400},children:[[0,.25,.5,.75,1].map(e=>{let n=t.top+r*(1-e),i=a+(o-a)*e;return(0,v.jsxs)(`g`,{children:[(0,v.jsx)(`line`,{x1:t.left,y1:n,x2:800-t.right,y2:n,stroke:`#27272a`,strokeWidth:`1`}),(0,v.jsx)(`text`,{x:t.left-8,y:n+4,textAnchor:`end`,fill:`#52525b`,fontSize:`10`,children:i.toFixed(0)})]},e)}),s!=null&&s>=a&&s<=o&&d!=null&&(0,v.jsxs)(`g`,{children:[(0,v.jsx)(`line`,{x1:t.left,y1:d,x2:800-t.right,y2:d,stroke:`#eab308`,strokeWidth:`1`,strokeDasharray:`6,4`}),(0,v.jsx)(`text`,{x:800-t.right+4,y:d+3,fill:`#eab308`,fontSize:`9`,children:`baseline`})]}),(0,v.jsx)(`path`,{d:u,fill:`none`,stroke:`#8b5cf6`,strokeWidth:`2`}),e.map((t,n)=>{let r=n>0&&t.val_score>e[n-1].val_score,i=n>0&&t.val_score<e[n-1].val_score?`var(--color-error)`:r?`var(--color-success)`:`var(--color-purple)`;return(0,v.jsx)(`circle`,{cx:c(n),cy:l(t.val_score),r:`4`,fill:i,stroke:`#18181b`,strokeWidth:`2`,children:(0,v.jsxs)(`title`,{children:[`Run `,n+1,`: `,t.val_score,` (`,y(t.timestamp),`)`]})},n)}),e.map((t,n)=>e.length>10&&n%Math.ceil(e.length/10)!==0&&n!==e.length-1?null:(0,v.jsxs)(`text`,{x:c(n),y:195,textAnchor:`middle`,fill:`#52525b`,fontSize:`9`,children:[`#`,n+1]},n))]})]})}function S({icon:e,label:t,value:n,sub:r,color:i=`text-text`}){return(0,v.jsxs)(`div`,{className:`rounded-xl border border-bg-tertiary bg-bg-secondary p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,v.jsx)(`span`,{className:`text-text-muted`,children:e}),(0,v.jsx)(`span`,{className:`text-[10px] font-medium text-text-muted uppercase tracking-wider`,children:t})]}),(0,v.jsx)(`div`,{className:`text-2xl font-bold ${i}`,children:n}),r&&(0,v.jsx)(`div`,{className:`text-[10px] text-text-muted mt-0.5`,children:r})]})}function C(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)(!0),[C,w]=(0,_.useState)(!1),[T,E]=(0,_.useState)(null),[D,O]=(0,_.useState)(!1),[k,A]=(0,_.useState)(!1),j=(0,_.useRef)(null),M=(0,_.useCallback)((e,t)=>{E({type:e,message:t}),setTimeout(()=>E(null),3e3)},[]),N=(0,_.useCallback)(async()=>{try{let e=await f(`/api/autoresearch/results`);if(e.ok){let n=await e.json();t(n.runs||[])}}catch{}finally{r(!1)}},[]);(0,_.useEffect)(()=>{N()},[N]),(0,_.useEffect)(()=>(k?j.current&&=(clearInterval(j.current),null):j.current=setInterval(N,3e4),()=>{j.current&&clearInterval(j.current)}),[k,N]);let P=async()=>{O(!0);try{(await f(`/api/autoresearch/trigger`,{method:`POST`})).ok?M(`success`,`Autoresearch experiment started`):M(`error`,`Failed to trigger experiment`)}catch{M(`error`,`Failed to connect to API`)}finally{O(!1)}},F=async()=>{try{(await f(`/api/message`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:`Deploy the best autoresearch LoRA adapter to Ollama. Use train_deploy.`})})).ok?M(`success`,`Deploying best model to Ollama...`):M(`error`,`Failed to start deployment`)}catch{M(`error`,`Connection error`)}},I=e.length>0?Math.max(...e.map(e=>e.val_score)):0,L=e.length>0?e[0].val_score:null,R=L!=null&&e.length>0?e.reduce((e,t)=>e+(t.val_score-L),0)/e.length:null,z=e.length>0?e[e.length-1]:null,B=z?.hyperparams,V=(e,t)=>{let n=[],r=e.hyperparams,i=t.hyperparams;return r.lr!==i.lr&&n.push(`LR: ${i.lr} → ${r.lr}`),r.rank!==i.rank&&n.push(`Rank: ${i.rank} → ${r.rank}`),r.alpha!==i.alpha&&n.push(`Alpha: ${i.alpha} → ${r.alpha}`),r.epochs!==i.epochs&&n.push(`Epochs: ${i.epochs} → ${r.epochs}`),r.batch_size!==i.batch_size&&n.push(`Batch: ${i.batch_size} → ${r.batch_size}`),r.dropout!==i.dropout&&n.push(`Dropout: ${i.dropout} → ${r.dropout}`),r.grad_accum!==i.grad_accum&&n.push(`GradAccum: ${i.grad_accum} → ${r.grad_accum}`),r.max_seq_len!==i.max_seq_len&&n.push(`SeqLen: ${i.max_seq_len} → ${r.max_seq_len}`),n.length>0?n:[`No changes`]};return n?(0,v.jsx)(`div`,{className:`space-y-4`,children:[1,2,3].map(e=>(0,v.jsx)(`div`,{className:`h-20 animate-pulse rounded-xl border border-border bg-bg-secondary`},e))}):(0,v.jsxs)(`div`,{className:`space-y-6 max-w-6xl`,children:[T&&(0,v.jsx)(`div`,{className:`fixed top-4 right-4 z-50 rounded-lg px-4 py-2.5 text-sm font-medium shadow-lg ${T.type===`success`?`bg-success/20 text-success border border-success/30`:`bg-error/20 text-error border border-error/30`}`,children:T.message}),(0,v.jsx)(h,{title:`Autoresearch`,subtitle:`Autonomous hyper-parameter search and LoRA fine-tuning`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Knowledge`},{label:`Autoresearch`}],actions:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`button`,{onClick:()=>A(!k),className:`flex items-center gap-1 rounded-lg border border-bg-tertiary px-2.5 py-1.5 text-xs text-text-secondary hover:bg-bg-tertiary`,children:[k?(0,v.jsx)(c,{className:`h-3 w-3`}):(0,v.jsx)(s,{className:`h-3 w-3`}),k?`Resume`:`Pause`]}),(0,v.jsx)(`button`,{onClick:N,className:`flex items-center gap-1 rounded-lg border border-bg-tertiary px-2.5 py-1.5 text-xs text-text-secondary hover:bg-bg-tertiary`,children:(0,v.jsx)(l,{className:`h-3 w-3`})})]})}),(0,v.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,v.jsx)(S,{icon:(0,v.jsx)(o,{className:`h-4 w-4`}),label:`Total Runs`,value:e.length}),(0,v.jsx)(S,{icon:(0,v.jsx)(d,{className:`h-4 w-4`}),label:`Best Val Score`,value:I>0?I.toFixed(1):`—`,sub:L!=null&&I>L?`+${(I-L).toFixed(1)} from baseline`:void 0,color:L!=null&&I>L?`text-success`:`text-text`}),(0,v.jsx)(S,{icon:(0,v.jsx)(u,{className:`h-4 w-4`}),label:`Avg Improvement`,value:R==null?`—`:`${R>=0?`+`:``}${R.toFixed(1)}`,color:R==null?`text-text`:R>0?`text-success`:R<0?`text-error`:`text-text`}),(0,v.jsx)(S,{icon:(0,v.jsx)(a,{className:`h-4 w-4`}),label:`Last Run`,value:z?y(z.timestamp):`Never`,sub:z?`Score: ${z.val_score}`:void 0})]}),(0,v.jsx)(x,{runs:e}),(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,v.jsxs)(`button`,{onClick:P,disabled:D,className:`flex items-center gap-2 rounded-lg bg-purple px-4 py-2 text-sm font-medium text-white hover:bg-[#7c3aed] disabled:opacity-50`,children:[(0,v.jsx)(c,{className:`h-4 w-4`}),D?`Starting...`:`Run Experiment`]}),(0,v.jsxs)(`button`,{onClick:F,disabled:e.length===0,className:`flex items-center gap-2 rounded-lg border border-bg-tertiary px-4 py-2 text-sm font-medium text-text-secondary hover:bg-bg-tertiary disabled:opacity-50`,children:[(0,v.jsx)(m,{className:`h-4 w-4`}),`Deploy Best Model`]}),z&&(0,v.jsxs)(`span`,{className:`text-xs text-text-muted`,children:[z.num_examples,` training examples · `,b(z.training_time_s)]})]}),e.length>0&&(0,v.jsxs)(`div`,{className:`rounded-xl border border-bg-tertiary bg-bg-secondary overflow-hidden`,children:[(0,v.jsxs)(`div`,{className:`px-4 py-3 border-b border-bg-tertiary`,children:[(0,v.jsx)(`h3`,{className:`text-sm font-medium text-text`,children:`What Made TITAN Better`}),(0,v.jsx)(`p`,{className:`text-[10px] text-text-muted`,children:`Experiment history — how each change affected val_score`})]}),(0,v.jsx)(`div`,{className:`overflow-x-auto`,children:(0,v.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,v.jsx)(`thead`,{children:(0,v.jsxs)(`tr`,{className:`border-b border-bg-tertiary`,children:[(0,v.jsx)(`th`,{className:`px-4 py-2 text-[10px] font-medium text-text-muted`,children:`#`}),(0,v.jsx)(`th`,{className:`px-4 py-2 text-[10px] font-medium text-text-muted`,children:`Date`}),(0,v.jsx)(`th`,{className:`px-4 py-2 text-[10px] font-medium text-text-muted`,children:`Changes`}),(0,v.jsx)(`th`,{className:`px-4 py-2 text-[10px] font-medium text-text-muted text-right`,children:`Score`}),(0,v.jsx)(`th`,{className:`px-4 py-2 text-[10px] font-medium text-text-muted text-right`,children:`Δ`}),(0,v.jsx)(`th`,{className:`px-4 py-2 text-[10px] font-medium text-text-muted text-right`,children:`Duration`}),(0,v.jsx)(`th`,{className:`px-4 py-2 text-[10px] font-medium text-text-muted text-right`,children:`Examples`})]})}),(0,v.jsx)(`tbody`,{children:[...e].reverse().map((t,n)=>{let r=e.length-1-n,i=r>0?e[r-1]:null,a=i?t.val_score-i.val_score:L==null?0:t.val_score-L,o=i?V(t,i):[`Initial run`],s=new Date(t.timestamp);return(0,v.jsxs)(`tr`,{className:`border-b border-bg-tertiary last:border-0 hover:bg-[#27272a30]`,children:[(0,v.jsx)(`td`,{className:`px-4 py-2 text-text-muted font-mono`,children:r+1}),(0,v.jsxs)(`td`,{className:`px-4 py-2 text-text-secondary`,children:[s.toLocaleDateString(),` `,s.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})]}),(0,v.jsx)(`td`,{className:`px-4 py-2 text-text-secondary`,children:o.map((e,t)=>(0,v.jsx)(`span`,{className:`inline-block mr-1.5 rounded bg-bg-tertiary px-1.5 py-0.5 text-[10px] font-mono`,children:e},t))}),(0,v.jsx)(`td`,{className:`px-4 py-2 text-right font-mono text-text font-medium`,children:t.val_score.toFixed(1)}),(0,v.jsx)(`td`,{className:`px-4 py-2 text-right font-mono`,children:(0,v.jsxs)(`span`,{className:a>0?`text-success`:a<0?`text-error`:`text-text-muted`,children:[a>0?`+`:``,a.toFixed(1)]})}),(0,v.jsx)(`td`,{className:`px-4 py-2 text-right text-text-muted`,children:b(t.training_time_s)}),(0,v.jsx)(`td`,{className:`px-4 py-2 text-right text-text-muted`,children:t.num_examples})]},r)})})]})})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsxs)(`button`,{onClick:()=>w(!C),className:`flex w-full items-center gap-2 text-xs font-medium text-text-secondary uppercase tracking-wider hover:text-text`,children:[C?(0,v.jsx)(p,{className:`h-3.5 w-3.5`}):(0,v.jsx)(i,{className:`h-3.5 w-3.5`}),(0,v.jsx)(g,{className:`h-3.5 w-3.5`}),`Current Hyperparameters`]}),C&&B&&(0,v.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 sm:grid-cols-4`,children:[{label:`Learning Rate`,value:B.lr},{label:`LoRA Rank`,value:B.rank},{label:`LoRA Alpha`,value:B.alpha},{label:`Dropout`,value:B.dropout},{label:`Epochs`,value:B.epochs},{label:`Batch Size`,value:B.batch_size},{label:`Grad Accum`,value:B.grad_accum},{label:`Max Seq Len`,value:B.max_seq_len}].map(({label:e,value:t})=>(0,v.jsxs)(`div`,{className:`rounded-lg border border-bg-tertiary bg-bg-secondary px-3 py-2`,children:[(0,v.jsx)(`div`,{className:`text-[10px] text-text-muted uppercase tracking-wider`,children:e}),(0,v.jsx)(`div`,{className:`text-sm font-mono text-text mt-0.5`,children:t})]},e))}),C&&!B&&(0,v.jsx)(`div`,{className:`mt-3 rounded-lg border border-bg-tertiary bg-bg-secondary px-4 py-3 text-xs text-text-muted`,children:`No runs yet — hyperparameters will appear after the first experiment`})]}),e.length===0&&(0,v.jsxs)(`div`,{className:`rounded-xl border border-bg-tertiary bg-bg-secondary p-8 text-center`,children:[(0,v.jsx)(o,{className:`h-8 w-8 text-text-muted mx-auto mb-3`}),(0,v.jsx)(`p`,{className:`text-sm text-text-secondary`,children:`No autoresearch runs yet`}),(0,v.jsx)(`p`,{className:`text-xs text-text-muted mt-1`,children:`Click "Run Experiment" to start fine-tuning qwen3.5:35b on the RTX 5090`})]})]})}export{C as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./archive-DcK9HrbE.js";import{t as i}from"./circle-check-big-C-JUM7wb.js";import{t as a}from"./plus-CHryCIkk.js";import{t as o}from"./refresh-cw-Disd5wRB.js";import{J as s,Zn as c,_n as l,a as u}from"./index-WI-E4I3h.js";import{t as d}from"./PageHeader-CH85uoZG.js";var f=e(t(),1),p=n();function m(){let{toast:e}=u(),[t,n]=(0,f.useState)([]),[m,h]=(0,f.useState)(!0),[g,_]=(0,f.useState)(!1),[v,y]=(0,f.useState)(null),b=(0,f.useCallback)(async()=>{h(!0);try{let e=await l();n(e.backups||[])}catch(t){e(`error`,`Couldn't load backups — try again. (${t.message})`)}h(!1)},[e]);(0,f.useEffect)(()=>{b()},[b]);let x=async()=>{_(!0);try{await s(),await b(),e(`success`,`Backup created.`)}catch(t){e(`error`,`Couldn't create backup — try again. (${t.message})`)}_(!1)},S=async t=>{y(t);try{await c(t),e(`success`,`Backup verified successfully.`)}catch(t){e(`error`,`Backup verification failed. (${t.message})`)}y(null)};return(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsx)(d,{title:`Backup Manager`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`System`},{label:`Backups`}]}),(0,p.jsxs)(`div`,{className:`flex gap-2`,children:[(0,p.jsxs)(`button`,{onClick:x,disabled:g,className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-[#6366f1] text-white text-sm font-medium hover:bg-[#4f46e5] disabled:opacity-50`,children:[(0,p.jsx)(a,{className:`w-4 h-4`}),` `,g?`Creating...`:`Create Backup`]}),(0,p.jsxs)(`button`,{onClick:b,disabled:m,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:[(0,p.jsx)(o,{className:`w-4 h-4 ${m?`animate-spin`:``}`}),` Refresh`]})]}),t.length===0&&!m&&(0,p.jsx)(`div`,{className:`text-sm text-[#52525b]`,children:`No backups found.`}),(0,p.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,p.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(r,{className:`w-4 h-4 text-[#6366f1]`}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`text-sm text-[#e4e4e7]`,children:new Date(e.createdAt).toLocaleString()}),(0,p.jsxs)(`div`,{className:`text-xs text-[#52525b]`,children:[(e.sizeBytes/1024/1024).toFixed(1),` MB`]})]})]}),(0,p.jsxs)(`button`,{onClick:()=>S(e.path),disabled:v===e.path,className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] text-xs hover:bg-[#3f3f46] disabled:opacity-50`,children:[(0,p.jsx)(i,{className:`w-3.5 h-3.5`}),` `,v===e.path?`Verifying...`:`Verify`]})]},e.path))})]})}export{m as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./createLucideIcon-qnlrxww7.js";import{In as i,T as a}from"./index-WI-E4I3h.js";import{t as o}from"./PageHeader-CH85uoZG.js";var s=r(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),c=e(t(),1),l=n();function u(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(``),[u,d]=(0,c.useState)(!1);return(0,l.jsxs)(`div`,{className:`space-y-4`,children:[(0,l.jsx)(o,{title:`Browser Tools`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Tools`},{label:`Browser`}]}),(0,l.jsxs)(`div`,{className:`p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,l.jsx)(a,{className:`w-4 h-4 text-[#6366f1]`}),(0,l.jsx)(`span`,{className:`text-sm font-medium text-[#e4e4e7]`,children:`Captcha Solver`})]}),(0,l.jsx)(`textarea`,{value:e,onChange:e=>t(e.target.value),placeholder:`Paste base64 image...`,className:`w-full h-24 p-2 rounded-md bg-[#27272a] border border-[#3f3f46] text-xs text-[#e4e4e7] placeholder-[#52525b] font-mono resize-none`}),(0,l.jsxs)(`button`,{onClick:async()=>{if(e.trim()){d(!0);try{let t=await i(e);r(t.token||t.error||`No result`)}catch(e){r(String(e))}d(!1)}},disabled:u,className:`mt-2 flex items-center gap-2 px-3 py-2 rounded-lg bg-[#6366f1] text-white text-sm font-medium hover:bg-[#4f46e5] disabled:opacity-50`,children:[(0,l.jsx)(s,{className:`w-4 h-4`}),` `,u?`Solving...`:`Solve Captcha`]}),n&&(0,l.jsx)(`div`,{className:`mt-2 p-2 rounded-md bg-[#27272a] text-xs text-[#e4e4e7] font-mono break-all`,children:n})]})]})}export{u as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./bot-CWDCc265.js";import{r as i}from"./shared-DLz_Jtg3.js";import{t as a}from"./dollar-sign-D9siqK91.js";import{t as o}from"./shield-check-Cd50jCAn.js";import{I as s,c,f as l,ht as u,o as d,p as f}from"./index-WI-E4I3h.js";import{t as p}from"./PageHeader-CH85uoZG.js";import{t as m}from"./EmptyState-D-Dg8B8r.js";import{t as h}from"./SkeletonLoader-9H7QWa9E.js";var g=e(t(),1),_=n();function v(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}var y={agent:r,goal:f,budget:a,approval:o,error:l,tool:c,system:d},b={agent:`text-accent`,goal:`text-success`,budget:`text-warning`,approval:`text-info`,error:`text-error`,tool:`text-text-secondary`,system:`text-text-muted`};function x(){let[e,t]=(0,g.useState)([]),[n,r]=(0,g.useState)(!0),[a,o]=(0,g.useState)(null),[c,l]=(0,g.useState)(`all`),d=(0,g.useRef)(null),f=(0,g.useCallback)(async()=>{try{let e=await u(100);t(e),o(null)}catch(e){o(e instanceof Error?e.message:`Failed to load activity`)}r(!1)},[]);(0,g.useEffect)(()=>(f(),d.current=setInterval(f,1e4),()=>{d.current&&clearInterval(d.current)}),[f]);let x=Array.from(new Set(e.map(e=>e.type))),S=[{id:`all`,label:`All`,count:e.length},...x.map(t=>({id:t,label:t.charAt(0).toUpperCase()+t.slice(1),count:e.filter(e=>e.type===t).length}))],C=c===`all`?e:e.filter(e=>e.type===c);return(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsx)(p,{title:`Activity`,subtitle:`Auto-refreshes every 10s`,breadcrumbs:[{label:`Command Post`},{label:`Activity`}]}),x.length>0&&(0,_.jsx)(i,{tabs:S,activeTab:c,onChange:l}),n&&(0,_.jsx)(h,{variant:`row`,count:8}),a&&(0,_.jsx)(`div`,{className:`text-center py-8 text-error text-sm`,children:a}),!n&&!a&&C.length===0&&(0,_.jsx)(m,{icon:(0,_.jsx)(s,{size:32}),title:`No activity`,description:`Agent activity will appear here as events occur.`}),!n&&!a&&C.length>0&&(0,_.jsx)(`div`,{className:`divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden`,children:C.map((e,t)=>(0,_.jsxs)(`div`,{className:`flex items-start gap-3 px-4 py-2.5`,children:[(0,_.jsx)(y[e.type]??s,{size:14,className:`${b[e.type]??`text-text-muted`} mt-0.5 flex-shrink-0`}),(0,_.jsx)(`span`,{className:`flex-1 text-sm text-text-secondary`,children:e.message}),e.agentId&&(0,_.jsx)(`span`,{className:`text-[10px] text-text-muted flex-shrink-0`,children:e.agentId}),(0,_.jsx)(`span`,{className:`text-xs text-text-muted flex-shrink-0`,children:v(e.timestamp)})]},`${e.id}-${t}`))})]})}export{x as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./arrow-left-4c2FnES1.js";import{t as i}from"./circle-check-big-C-JUM7wb.js";import{i as a,r as o}from"./shared-DLz_Jtg3.js";import{t as s}from"./clock-DSPgndSD.js";import{t as c}from"./dollar-sign-D9siqK91.js";import{t as l}from"./save-DP7oNar2.js";import{$n as u,Ct as d,Ot as f,Wn as p,Xt as m,ar as h,ir as g,xt as _}from"./index-WI-E4I3h.js";import{t as v}from"./PageHeader-CH85uoZG.js";import{n as y}from"./ConfirmDialog-6hcNjmAh.js";import{t as b}from"./EmptyState-D-Dg8B8r.js";import{t as x}from"./SkeletonLoader-9H7QWa9E.js";var S=e(t(),1),C=n();function w(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function T(e){return e?e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`:`-`}function E(){let{id:e}=h(),t=g(),[n,E]=(0,S.useState)(null),[D,O]=(0,S.useState)([]),[k,A]=(0,S.useState)([]),[j,M]=(0,S.useState)(!0),[N,P]=(0,S.useState)(null),[F,I]=(0,S.useState)(`overview`),[L,R]=(0,S.useState)(``),[z,B]=(0,S.useState)(``),[V,H]=(0,S.useState)(``),[U,W]=(0,S.useState)(``),[G,K]=(0,S.useState)(!1),[q,J]=(0,S.useState)([]),Y=(0,S.useCallback)(async()=>{if(e){try{let t=(await f()).find(t=>t.id===e);if(!t){P(`Agent not found`),M(!1);return}E(t),R(t.role),B(t.reportsTo??``),H(t.title??``),W(t.model??``);let[n,r]=await Promise.all([d(e),_({assignee:e})]);O(n),A(r),P(null)}catch(e){P(e instanceof Error?e.message:`Failed to load agent`)}M(!1)}},[e]);(0,S.useEffect)(()=>{Y()},[Y]),(0,S.useEffect)(()=>{m().then(e=>J(e)).catch(()=>{})},[]);let X=async()=>{if(e){K(!0);try{let t=await p(e,{role:L,reportsTo:z||void 0,title:V||void 0,model:U||void 0});E(t)}catch{}K(!1)}},Z=[{id:`overview`,label:`Overview`},{id:`runs`,label:`Runs`,count:D.length},{id:`config`,label:`Config`}];if(j)return(0,C.jsxs)(`div`,{className:`space-y-6`,children:[(0,C.jsx)(v,{title:`Agent`,breadcrumbs:[{label:`Command Post`},{label:`Agents`,href:`/command-post/agents`},{label:`...`}]}),(0,C.jsx)(x,{variant:`card`,count:1})]});if(N||!n)return(0,C.jsxs)(`div`,{className:`space-y-6`,children:[(0,C.jsx)(v,{title:`Agent`,breadcrumbs:[{label:`Command Post`},{label:`Agents`,href:`/command-post/agents`},{label:`Error`}]}),(0,C.jsxs)(`div`,{className:`text-center py-12`,children:[(0,C.jsx)(`p`,{className:`text-error text-sm mb-4`,children:N??`Agent not found`}),(0,C.jsx)(y,{variant:`secondary`,size:`sm`,onClick:()=>t(`/command-post/agents`),children:`Back to Agents`})]})]});let Q=Date.now()-new Date(n.createdAt).getTime(),$=Math.floor(Q/36e5);return(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsx)(v,{title:n.name,subtitle:n.title??n.role,breadcrumbs:[{label:`Command Post`},{label:`Agents`,href:`/command-post/agents`},{label:n.name}],actions:(0,C.jsxs)(u,{to:`/command-post/agents`,className:`flex items-center gap-1 text-xs text-text-muted hover:text-text`,children:[(0,C.jsx)(r,{size:14}),` Back`]})}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(a,{status:n.status}),(0,C.jsxs)(`span`,{className:`text-xs text-text-muted`,children:[`Last heartbeat: `,w(n.lastHeartbeat),` ago`]})]}),(0,C.jsx)(o,{tabs:Z,activeTab:F,onChange:I}),F===`overview`&&(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,C.jsxs)(`div`,{className:`bg-bg-tertiary/50 border border-border rounded-xl p-4 text-center`,children:[(0,C.jsx)(i,{size:16,className:`text-success mx-auto mb-1`}),(0,C.jsx)(`div`,{className:`text-xl font-bold text-text`,children:n.totalTasksCompleted}),(0,C.jsx)(`div`,{className:`text-[10px] text-text-muted`,children:`Tasks Completed`})]}),(0,C.jsxs)(`div`,{className:`bg-bg-tertiary/50 border border-border rounded-xl p-4 text-center`,children:[(0,C.jsx)(c,{size:16,className:`text-warning mx-auto mb-1`}),(0,C.jsxs)(`div`,{className:`text-xl font-bold text-text`,children:[`$`,n.totalCostUsd.toFixed(4)]}),(0,C.jsx)(`div`,{className:`text-[10px] text-text-muted`,children:`Total Cost`})]}),(0,C.jsxs)(`div`,{className:`bg-bg-tertiary/50 border border-border rounded-xl p-4 text-center`,children:[(0,C.jsx)(s,{size:16,className:`text-accent mx-auto mb-1`}),(0,C.jsxs)(`div`,{className:`text-xl font-bold text-text`,children:[$,`h`]}),(0,C.jsx)(`div`,{className:`text-[10px] text-text-muted`,children:`Uptime`})]})]}),(0,C.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl overflow-hidden`,children:[(0,C.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,C.jsx)(`h3`,{className:`text-sm font-semibold text-text`,children:`Assigned Issues`})}),k.length===0?(0,C.jsx)(`div`,{className:`py-8 text-center text-xs text-text-muted`,children:`No assigned issues`}):(0,C.jsx)(`div`,{className:`divide-y divide-border`,children:k.map(e=>(0,C.jsxs)(u,{to:`/command-post/issues/${e.id}`,className:`flex items-center gap-2 px-4 py-2 hover:bg-bg-tertiary transition-colors`,children:[(0,C.jsx)(a,{status:e.status,variant:`dot`,size:`sm`}),(0,C.jsx)(`span`,{className:`text-xs text-text flex-1 truncate`,children:e.title}),(0,C.jsx)(`span`,{className:`text-[10px] text-text-muted font-mono`,children:e.identifier})]},e.id))})]})]}),F===`runs`&&(0,C.jsx)(`div`,{className:`bg-bg-secondary border border-border rounded-xl overflow-hidden`,children:D.length===0?(0,C.jsx)(b,{title:`No runs`,description:`This agent has not executed any runs yet.`}):(0,C.jsx)(`div`,{className:`overflow-x-auto`,children:(0,C.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,C.jsx)(`thead`,{children:(0,C.jsxs)(`tr`,{className:`border-b border-border text-left`,children:[(0,C.jsx)(`th`,{className:`px-4 py-2 text-text-muted font-medium`,children:`Source`}),(0,C.jsx)(`th`,{className:`px-4 py-2 text-text-muted font-medium`,children:`Status`}),(0,C.jsx)(`th`,{className:`px-4 py-2 text-text-muted font-medium`,children:`Duration`}),(0,C.jsx)(`th`,{className:`px-4 py-2 text-text-muted font-medium`,children:`Tools`}),(0,C.jsx)(`th`,{className:`px-4 py-2 text-text-muted font-medium`,children:`Started`})]})}),(0,C.jsx)(`tbody`,{className:`divide-y divide-border`,children:D.map(e=>(0,C.jsxs)(`tr`,{className:`hover:bg-bg-tertiary/50 transition-colors`,children:[(0,C.jsx)(`td`,{className:`px-4 py-2 text-text-secondary capitalize`,children:e.source}),(0,C.jsx)(`td`,{className:`px-4 py-2`,children:(0,C.jsx)(a,{status:e.status,size:`sm`})}),(0,C.jsx)(`td`,{className:`px-4 py-2 text-text-secondary`,children:T(e.durationMs)}),(0,C.jsx)(`td`,{className:`px-4 py-2 text-text-muted`,children:e.toolsUsed.length}),(0,C.jsxs)(`td`,{className:`px-4 py-2 text-text-muted`,children:[w(e.startedAt),` ago`]})]},e.id))})]})})}),F===`config`&&(0,C.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl p-4 space-y-4 max-w-md`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Role`}),(0,C.jsx)(`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:L,onChange:e=>R(e.target.value),children:[`ceo`,`manager`,`engineer`,`researcher`,`general`].map(e=>(0,C.jsx)(`option`,{value:e,children:e},e))})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Reports To`}),(0,C.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:`Agent ID...`,value:z,onChange:e=>B(e.target.value)})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Title`}),(0,C.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:`e.g. Senior Engineer`,value:V,onChange:e=>H(e.target.value)})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Model`}),(0,C.jsx)(`input`,{list:`cp-agent-models`,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:`e.g. ollama/qwen3.5:cloud`,value:U,onChange:e=>W(e.target.value)}),(0,C.jsx)(`datalist`,{id:`cp-agent-models`,children:q.map(e=>(0,C.jsx)(`option`,{value:e.id,children:e.name??e.id},e.id))})]}),(0,C.jsx)(y,{size:`sm`,icon:(0,C.jsx)(l,{size:14}),onClick:X,loading:G,children:`Save`})]})]})}export{E as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{i as r}from"./shared-DLz_Jtg3.js";import{$n as i,H as a,Ot as o,s,u as c}from"./index-WI-E4I3h.js";import{t as l}from"./PageHeader-CH85uoZG.js";import{t as u}from"./EmptyState-D-Dg8B8r.js";import{t as d}from"./SkeletonLoader-9H7QWa9E.js";var f=e(t(),1),p=n();function m(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function h(e){let t=e.split(`/`);return t[t.length-1]}function g(){let[e,t]=(0,f.useState)([]),[n,g]=(0,f.useState)(!0),[_,v]=(0,f.useState)(null),y=(0,f.useCallback)(async()=>{try{let e=await o();t(e),v(null)}catch(e){v(e instanceof Error?e.message:`Failed to load agents`)}g(!1)},[]);(0,f.useEffect)(()=>{y()},[y]);let b=async(e,t)=>{t.preventDefault(),t.stopPropagation();try{await a(`/api/command-post/agents/${e}`,{method:`DELETE`}),await y()}catch{}};return(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsx)(l,{title:`Agents`,breadcrumbs:[{label:`Command Post`},{label:`Agents`}]}),n&&(0,p.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:(0,p.jsx)(d,{variant:`card`,count:6})}),_&&(0,p.jsx)(`div`,{className:`text-center py-8 text-error text-sm`,children:_}),!n&&!_&&e.length===0&&(0,p.jsx)(u,{icon:(0,p.jsx)(c,{size:32}),title:`No agents registered`,description:`Agents will appear here once they connect to Command Post.`}),!n&&!_&&e.length>0&&(0,p.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:e.map(e=>(0,p.jsxs)(i,{to:`/command-post/agents/${e.id}`,className:`relative bg-bg-secondary border border-border rounded-xl p-4 hover:border-border-light transition-colors group`,children:[e.role!==`ceo`&&(0,p.jsx)(`button`,{onClick:t=>b(e.id,t),className:`absolute top-3 right-3 p-1 rounded-md text-text-muted hover:text-error hover:bg-error/10 opacity-0 group-hover:opacity-100 transition-all`,title:`Remove agent`,children:(0,p.jsx)(s,{size:14})}),(0,p.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,p.jsx)(`span`,{className:`text-sm font-semibold text-text`,children:e.name}),(0,p.jsx)(r,{status:e.status,size:`sm`})]}),(0,p.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[10px] text-text-muted uppercase`,children:`Role`}),(0,p.jsx)(`span`,{className:`text-xs text-text-secondary capitalize`,children:e.role})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[10px] text-text-muted uppercase`,children:`Model`}),(0,p.jsx)(`span`,{className:`text-xs text-text-secondary truncate max-w-[140px]`,children:h(e.model)})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[10px] text-text-muted uppercase`,children:`Last Heartbeat`}),(0,p.jsxs)(`span`,{className:`text-xs text-text-secondary`,children:[m(e.lastHeartbeat),` ago`]})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[10px] text-text-muted uppercase`,children:`Tasks Done`}),(0,p.jsx)(`span`,{className:`text-xs text-text-secondary`,children:e.totalTasksCompleted})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[10px] text-text-muted uppercase`,children:`Cost`}),(0,p.jsxs)(`span`,{className:`text-xs text-text-secondary`,children:[`$`,e.totalCostUsd.toFixed(4)]})]})]})]},e.id))})]})}export{g as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{n as r}from"./pencil-Dd_vzHE-.js";import{i,r as a}from"./shared-DLz_Jtg3.js";import{t as o}from"./shield-check-Cd50jCAn.js";import{U as s,a as c,f as l,gt as u,s as d,wn as f}from"./index-WI-E4I3h.js";import{t as p}from"./PageHeader-CH85uoZG.js";import{n as m}from"./ConfirmDialog-6hcNjmAh.js";import{t as h}from"./EmptyState-D-Dg8B8r.js";import{t as g}from"./SkeletonLoader-9H7QWa9E.js";import{t as _}from"./approvalHeadline-BRg3ReTi.js";var v=e(t(),1),y=n();function b(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function x(e){return e===`high`?`text-error bg-error/10 border-error/30`:e===`medium`?`text-warn bg-warn/10 border-warn/30`:`text-text-muted bg-bg-tertiary border-border`}var S=[{id:`all`,label:`All`},{id:`pending`,label:`Pending`},{id:`approved`,label:`Approved`},{id:`rejected`,label:`Rejected`}];function C(){let[e,t]=(0,v.useState)([]),[n,C]=(0,v.useState)(!0),[w,T]=(0,v.useState)(null),[E,D]=(0,v.useState)(`all`),[O,k]=(0,v.useState)(null),[A,j]=(0,v.useState)({}),[M,N]=(0,v.useState)(null),{toast:P}=c(),F=(0,v.useCallback)(async()=>{try{let e=await u();t(e),T(null)}catch(e){T(e instanceof Error?e.message:`Failed to load approvals`)}C(!1)},[]);(0,v.useEffect)(()=>{F()},[F]);let I=async e=>{k(e.id);try{let t=A[e.id]?.trim();await s(e.id,`user`,t||void 0),await F();let n=e.type===`goal_proposal`||e.type===`soma_proposal`,r=e.type===`custom`&&e.payload.kind===`driver_blocked`;P(`success`,n?`Work approved — TITAN is starting…`:r?`Unblocked — TITAN is resuming…`:`Approved`),j(t=>{let n={...t};return delete n[e.id],n}),N(null)}catch(e){T(e instanceof Error?e.message:`Approve failed`),P(`error`,`Approval failed`)}k(null)},L=async e=>{k(e.id);try{await f(e.id,`user`),await F(),P(`success`,`Rejected`)}catch(e){T(e instanceof Error?e.message:`Reject failed`),P(`error`,`Rejection failed`)}k(null)},R=E===`all`?e:e.filter(e=>e.status===E),z=S.map(t=>({...t,count:t.id===`all`?e.length:e.filter(e=>e.status===t.id).length}));return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsx)(p,{title:`Approvals`,breadcrumbs:[{label:`Command Post`},{label:`Approvals`}]}),(0,y.jsx)(a,{tabs:z,activeTab:E,onChange:D}),n&&(0,y.jsx)(g,{variant:`row`,count:5}),w&&(0,y.jsx)(`div`,{className:`text-center py-8 text-error text-sm`,children:w}),!n&&!w&&R.length===0&&(0,y.jsx)(h,{icon:(0,y.jsx)(o,{size:32}),title:`No approvals`,description:E===`pending`?`No pending approvals.`:`No approvals to show.`}),!n&&!w&&R.length>0&&(0,y.jsx)(`div`,{className:`divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden`,children:R.map(e=>{let t=_(e);return(0,y.jsxs)(`div`,{className:`flex items-start gap-3 px-4 py-3`,children:[(0,y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5 flex-wrap`,children:[(0,y.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded border font-medium uppercase tracking-wide ${x(t.urgency)}`,children:[t.urgency===`high`&&(0,y.jsx)(l,{size:10,className:`inline mr-0.5`}),t.kindLabel]}),(0,y.jsx)(i,{status:e.status,size:`sm`}),(0,y.jsxs)(`span`,{className:`text-xs text-text-muted`,children:[`from `,(0,y.jsx)(`span`,{className:`font-medium text-text-secondary`,children:e.requestedBy})]})]}),(0,y.jsx)(`div`,{className:`text-sm text-text font-medium leading-snug mb-0.5`,children:t.headline}),t.detail&&(0,y.jsx)(`div`,{className:`text-xs text-text-secondary leading-snug`,children:t.detail}),e.decidedBy&&(0,y.jsxs)(`div`,{className:`text-[10px] text-text-muted mt-1`,children:[`Decided by `,e.decidedBy,e.decisionNote?`: ${e.decisionNote}`:``]})]}),(0,y.jsx)(`span`,{className:`text-xs text-text-muted flex-shrink-0 pt-0.5`,children:b(e.createdAt)}),e.status===`pending`&&(0,y.jsxs)(`div`,{className:`flex flex-col items-end gap-1 flex-shrink-0`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.type===`custom`&&e.payload.kind===`driver_blocked`&&(0,y.jsx)(`button`,{onClick:()=>N(M===e.id?null:e.id),className:`text-[10px] text-text-muted hover:text-text-secondary px-2 py-1 rounded hover:bg-bg-tertiary transition-colors`,children:M===e.id?`Cancel`:`Answer`}),(0,y.jsx)(m,{size:`sm`,variant:`ghost`,onClick:()=>I(e),loading:O===e.id,icon:(0,y.jsx)(r,{size:14}),children:`Approve`}),(0,y.jsx)(m,{size:`sm`,variant:`ghost`,onClick:()=>L(e),loading:O===e.id,icon:(0,y.jsx)(d,{size:14}),children:`Reject`})]}),M===e.id&&(0,y.jsx)(`input`,{type:`text`,value:A[e.id]||``,onChange:t=>j(n=>({...n,[e.id]:t.target.value})),placeholder:`Type your answer...`,className:`w-64 rounded-md border border-border bg-bg px-3 py-1.5 text-xs text-text outline-none focus:border-accent mt-1`,onKeyDown:t=>{t.key===`Enter`&&I(e)},autoFocus:!0})]})]},e.id)})})]})}export{C as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{i as r}from"./shared-DLz_Jtg3.js";import{t as i}from"./dollar-sign-D9siqK91.js";import{t as a}from"./plus-CHryCIkk.js";import{t as o}from"./trash-2-CwUv7ww1.js";import{$ as s,Y as c,_t as l}from"./index-WI-E4I3h.js";import{t as u}from"./PageHeader-CH85uoZG.js";import{n as d,r as f}from"./ConfirmDialog-6hcNjmAh.js";import{t as p}from"./EmptyState-D-Dg8B8r.js";import{t as m}from"./SkeletonLoader-9H7QWa9E.js";var h=e(t(),1),g=n();function _(e){let t=e.limitUsd>0?e.currentSpend/e.limitUsd*100:0;return t>=100?`exceeded`:t>=e.warningThresholdPercent?`warning`:`healthy`}function v(){let[e,t]=(0,h.useState)([]),[n,v]=(0,h.useState)(!0),[y,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(!1),[C,w]=(0,h.useState)(!1),[T,E]=(0,h.useState)(``),[D,O]=(0,h.useState)(`global`),[k,A]=(0,h.useState)(``),[j,M]=(0,h.useState)(`monthly`),[N,P]=(0,h.useState)(`10`),[F,I]=(0,h.useState)(`80`),[L,R]=(0,h.useState)(`warn`),z=(0,h.useCallback)(async()=>{try{let e=await l();t(e),b(null)}catch(e){b(e instanceof Error?e.message:`Failed to load budgets`)}v(!1)},[]);(0,h.useEffect)(()=>{z()},[z]);let B=async()=>{if(T.trim()){w(!0);try{await c({name:T.trim(),scope:{type:D,targetId:k||void 0},period:j,limitUsd:parseFloat(N)||10,warningThresholdPercent:parseInt(F)||80,action:L,enabled:!0}),S(!1),E(``),A(``),P(`10`),await z()}catch{}w(!1)}},V=async e=>{try{await s(e),await z()}catch{}};return(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsx)(u,{title:`Costs & Budgets`,breadcrumbs:[{label:`Command Post`},{label:`Costs`}],actions:(0,g.jsx)(d,{size:`sm`,icon:(0,g.jsx)(a,{size:14}),onClick:()=>S(!0),children:`Create Budget`})}),n&&(0,g.jsx)(m,{variant:`row`,count:4}),y&&(0,g.jsx)(`div`,{className:`text-center py-8 text-error text-sm`,children:y}),!n&&!y&&e.length===0&&(0,g.jsx)(p,{icon:(0,g.jsx)(i,{size:32}),title:`No budgets`,description:`Create budget policies to control agent spending.`,action:{label:`Create Budget`,onClick:()=>S(!0)}}),!n&&!y&&e.length>0&&(0,g.jsx)(`div`,{className:`divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden`,children:e.map(e=>{let t=e.limitUsd>0?e.currentSpend/e.limitUsd*100:0,n=_(e);return(0,g.jsxs)(`div`,{className:`flex items-center gap-4 px-4 py-3`,children:[(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,g.jsx)(`span`,{className:`text-sm font-medium text-text`,children:e.name}),(0,g.jsx)(r,{status:n,size:`sm`}),!e.enabled&&(0,g.jsx)(r,{status:`disabled`,size:`sm`})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-text-muted`,children:[(0,g.jsxs)(`span`,{className:`capitalize`,children:[e.scope.type,e.scope.targetId?`: ${e.scope.targetId}`:``]}),(0,g.jsx)(`span`,{className:`capitalize`,children:e.period}),(0,g.jsxs)(`span`,{children:[`Action: `,e.action]})]})]}),(0,g.jsxs)(`div`,{className:`text-right flex-shrink-0`,children:[(0,g.jsxs)(`div`,{className:`text-sm font-medium text-text`,children:[`$`,e.currentSpend.toFixed(2),` / $`,e.limitUsd.toFixed(2)]}),(0,g.jsx)(`div`,{className:`w-24 h-1.5 bg-bg-tertiary rounded-full overflow-hidden mt-1`,children:(0,g.jsx)(`div`,{className:`h-full rounded-full transition-all ${n===`exceeded`?`bg-error`:n===`warning`?`bg-warning`:`bg-success`}`,style:{width:`${Math.min(100,t)}%`}})})]}),(0,g.jsx)(`button`,{onClick:()=>V(e.id),className:`p-1.5 rounded-md text-text-muted hover:text-error hover:bg-error/10 transition-colors flex-shrink-0`,title:`Delete budget`,children:(0,g.jsx)(o,{size:14})})]},e.id)})}),(0,g.jsx)(f,{open:x,onClose:()=>S(!1),title:`Create Budget Policy`,footer:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d,{variant:`secondary`,size:`sm`,onClick:()=>S(!1),children:`Cancel`}),(0,g.jsx)(d,{size:`sm`,onClick:B,loading:C,disabled:!T.trim(),children:`Create`})]}),children:(0,g.jsxs)(`div`,{className:`space-y-3`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Name`}),(0,g.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:`Budget name...`,value:T,onChange:e=>E(e.target.value),autoFocus:!0})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Scope`}),(0,g.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:D,onChange:e=>O(e.target.value),children:[(0,g.jsx)(`option`,{value:`global`,children:`Global`}),(0,g.jsx)(`option`,{value:`agent`,children:`Agent`}),(0,g.jsx)(`option`,{value:`goal`,children:`Goal`})]})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Period`}),(0,g.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:j,onChange:e=>M(e.target.value),children:[(0,g.jsx)(`option`,{value:`daily`,children:`Daily`}),(0,g.jsx)(`option`,{value:`weekly`,children:`Weekly`}),(0,g.jsx)(`option`,{value:`monthly`,children:`Monthly`})]})]})]}),D!==`global`&&(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Target ID`}),(0,g.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:`${D} ID...`,value:k,onChange:e=>A(e.target.value)})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Limit (USD)`}),(0,g.jsx)(`input`,{type:`number`,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:N,onChange:e=>P(e.target.value)})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Warning %`}),(0,g.jsx)(`input`,{type:`number`,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:F,onChange:e=>I(e.target.value)})]})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Action on Threshold`}),(0,g.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:L,onChange:e=>R(e.target.value),children:[(0,g.jsx)(`option`,{value:`warn`,children:`Warn`}),(0,g.jsx)(`option`,{value:`pause`,children:`Pause`}),(0,g.jsx)(`option`,{value:`stop`,children:`Stop`})]})]})]})})]})}export{v as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{i as r}from"./shared-DLz_Jtg3.js";import{t as i}from"./dollar-sign-D9siqK91.js";import{t as a}from"./list-todo-DfnNUV_T.js";import{t as o}from"./refresh-cw-Disd5wRB.js";import{$n as s,I as c,a as l,gt as u,ht as d,kt as f,p,u as m,xt as h}from"./index-WI-E4I3h.js";import{t as g}from"./PageHeader-CH85uoZG.js";import{t as _}from"./SkeletonLoader-9H7QWa9E.js";var v=e(t(),1),y=n(),b={idle:`textSecondary`,active:`success`,paused:`warning`,error:`error`,stopped:`borderLight`},x={ceo:`C`,manager:`M`,engineer:`E`,researcher:`R`,general:`G`};function S({agents:e,activity:t}){let n=(0,v.useRef)(null),r=(0,v.useRef)(e),i=(0,v.useRef)(t);return r.current=e,i.current=t,(0,v.useEffect)(()=>{let e=n.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let a=window.devicePixelRatio||1,o,s=0,c=()=>{let e=document.documentElement,t=getComputedStyle(e),n=(e,n,r)=>(e?t.getPropertyValue(e).trim():``)||t.getPropertyValue(n).trim()||r;return{bg:n(`--theme-bg-base`,`--color-bg`,`#09090b`),bgTertiary:n(`--theme-bg-grain`,`--color-bg-tertiary`,`#27272a`),border:n(`--theme-metal-dark`,`--color-border`,`#3f3f46`),borderLight:n(`--theme-metal`,`--color-border-light`,`#52525b`),textMuted:n(`--theme-ink-soft`,`--color-text-muted`,`#71717a`),textSecondary:n(`--theme-paper-fg`,`--color-text-secondary`,`#a1a1aa`),accent:n(`--theme-accent`,`--color-accent`,`#6366f1`),accentLight:n(null,`--color-accent-light`,`#a5b4fc`),success:n(null,`--color-success`,`#22c55e`),warning:n(null,`--color-warning`,`#f59e0b`),error:n(null,`--color-error`,`#ef4444`)}},l=()=>{let n=e.clientWidth,r=e.clientHeight;e.width=n*a,e.height=r*a,t.setTransform(a,0,0,a,0,0)};l(),window.addEventListener(`resize`,l);let u=()=>{s++;let n=s/15,a=e.clientWidth,l=e.clientHeight,d=r.current,f=i.current,p=c();t.fillStyle=p.bg,t.fillRect(0,0,a,l),t.strokeStyle=`#141418`,t.lineWidth=.5;for(let e=0;e<a;e+=24)t.beginPath(),t.moveTo(e,l*.72),t.lineTo(e,l),t.stroke();for(let e=l*.72;e<l;e+=24)t.beginPath(),t.moveTo(0,e),t.lineTo(a,e),t.stroke();if(d.length===0){t.fillStyle=p.bgTertiary,t.font=`12px -apple-system, BlinkMacSystemFont, sans-serif`,t.textAlign=`center`,t.fillText(`No agents registered`,a/2,l/2-10),t.font=`10px -apple-system, BlinkMacSystemFont, sans-serif`,t.fillStyle=p.border,t.fillText(`Spawn agents to see them here`,a/2,l/2+10),t.textAlign=`start`,o=requestAnimationFrame(u);return}let m=Math.min(d.length,8),h=Math.min(120,(a-20)/m),g=(a-h*m)/2+h/2;for(let e=0;e<m;e++){let r=d[e],i=g+e*h,a=l*.55,o=r.status===`active`?`active`:r.status,s=p[b[o]||b.idle],c=Math.sin(n*.8+e*1.5)*1.5,u=f.some(e=>e.agentId===r.id&&Date.now()-new Date(e.timestamp).getTime()<3e4),m=Math.min(70,h-10),_=i-m/2,v=a+16;t.fillStyle=p.border,t.fillRect(_,v,m,10),t.fillStyle=p.borderLight,t.fillRect(_+1,v+1,m-2,8),t.fillStyle=p.border,t.fillRect(_+3,v+10,3,14),t.fillRect(_+m-6,v+10,3,14);let y=i-26/2,S=v-18;t.fillStyle=p.bgTertiary,t.fillRect(y,S,26,18);let C=o===`error`?p.error:o===`active`?p.success:p.accent;if(t.fillStyle=C+`30`,t.fillRect(y+2,S+2,22,14),o===`active`||u){t.fillStyle=C+`60`;let r=2+Math.floor(n%3);for(let i=0;i<r;i++){let r=6+Math.sin(n*2+i+e)*5;t.fillRect(y+3,S+3+i*4,r,1.5)}}t.fillStyle=p.border,t.fillRect(i-2,v-1,4,3),t.fillStyle=`#1e1e22`,t.fillRect(i-10,a+10+c,20,8),t.fillRect(i-11,a-2+c,3,20),t.fillStyle=p.border,t.fillRect(i-7,a+c,14,12);let w=o===`active`&&u?Math.sin(n*1.5+e)*1.5:0;t.fillStyle=p.borderLight,t.fillRect(i-6,a-10+c+w,12,10);let T=Math.sin(n*.3+e*2)>.95?1:2;if(t.fillStyle=s,o===`stopped`?(t.fillRect(i-4,a-7+c+w,2,1),t.fillRect(i-3,a-6+c+w,2,1),t.fillRect(i+1,a-7+c+w,2,1),t.fillRect(i+2,a-6+c+w,2,1)):(t.fillRect(i-4,a-7+c+w,2,T),t.fillRect(i+2,a-7+c+w,2,T)),t.fillStyle=p.borderLight,t.fillRect(i-1,a-14+c+w,2,4),t.fillStyle=s,t.beginPath(),t.arc(i,a-15+c+w,2,0,Math.PI*2),t.fill(),o===`active`&&(t.globalAlpha=.3+Math.sin(n*3+e)*.2,t.beginPath(),t.arc(i,a-15+c+w,5,0,Math.PI*2),t.fill(),t.globalAlpha=1),o===`active`&&u){let r=Math.sin(n*6+e)*2,o=Math.sin(n*6+e+Math.PI)*2;t.fillStyle=p.border,t.fillRect(i-11,a+3+c+r,4,3),t.fillRect(i+7,a+3+c+o,4,3)}else t.fillStyle=p.border,t.fillRect(i-10,a+5+c,3,6),t.fillRect(i+7,a+5+c,3,6);if(o===`active`&&u){for(let r=0;r<2;r++){let o=n*1.5+r*Math.PI+e,l=14+Math.sin(n+r)*4,u=i+Math.cos(o)*l,d=a-3+Math.sin(o)*l*.4+c;t.globalAlpha=.25+Math.sin(n*2+r)*.15,t.fillStyle=s,t.beginPath(),t.arc(u,d,1,0,Math.PI*2),t.fill()}t.globalAlpha=1}if(o===`error`){for(let e=0;e<3;e++){let r=i+Math.sin(n*4+e*2)*12,o=a-5+Math.cos(n*3+e)*8+c;t.globalAlpha=.4+Math.sin(n+e)*.3,t.fillStyle=p.error,t.fillRect(r-1,o-1,2,2)}t.globalAlpha=1}t.fillStyle=o===`stopped`?p.border:p.textMuted,t.font=`9px -apple-system, BlinkMacSystemFont, sans-serif`,t.textAlign=`center`;let E=Math.max(44,m+14),D=r.name;if(t.measureText(D).width>E){for(;D.length>1&&t.measureText(D+`…`).width>E;)D=D.slice(0,-1);D=D.trimEnd()+`…`}t.fillText(D,i,v+10+24);let O=x[r.role]||`G`;t.fillStyle=s+`60`,t.font=`bold 7px -apple-system, BlinkMacSystemFont, sans-serif`,t.fillText(O,i,v+10+33),t.textAlign=`start`}if(t.fillStyle=p.bgTertiary,t.font=`bold 9px -apple-system, BlinkMacSystemFont, sans-serif`,t.textAlign=`center`,t.fillText(`COMMAND POST`,a/2,l-6),t.textAlign=`start`,f.length>0){let e=f[f.length-1];if(Date.now()-new Date(e.timestamp).getTime()<6e4){t.fillStyle=p.accent+`40`,t.fillRect(0,0,a,16),t.fillStyle=p.accentLight,t.font=`8px -apple-system, BlinkMacSystemFont, sans-serif`;let n=e.message.length>60?e.message.slice(0,57)+`...`:e.message;t.textAlign=`center`,t.fillText(n,a/2,11),t.textAlign=`start`}}o=requestAnimationFrame(u)};return u(),()=>{cancelAnimationFrame(o),window.removeEventListener(`resize`,l)}},[]),(0,y.jsx)(`canvas`,{ref:n,className:`w-full rounded-xl border border-border`,style:{height:220,imageRendering:`pixelated`}})}function C(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function w({icon:e,label:t,value:n,sub:r,color:i}){return(0,y.jsxs)(`div`,{className:`bg-bg-tertiary/50 border border-border rounded-xl p-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,y.jsx)(e,{size:14,className:i}),(0,y.jsx)(`span`,{className:`text-[10px] text-text-muted uppercase tracking-wider`,children:t})]}),(0,y.jsx)(`div`,{className:`text-2xl font-bold text-text`,children:n}),r&&(0,y.jsx)(`div`,{className:`text-[11px] text-text-muted mt-1`,children:r})]})}function T(){let{toast:e}=l(),[t,n]=(0,v.useState)(null),[b,x]=(0,v.useState)([]),[T,E]=(0,v.useState)([]),[D,O]=(0,v.useState)(0),[k,A]=(0,v.useState)(!0),j=(0,v.useCallback)(async()=>{try{let[e,t,r,i]=await Promise.all([f(),d(20),h(),u(`pending`)]);n(e),x(t),E(r),O(i.length)}catch(t){n(n=>(n===null&&e(`error`,`Couldn't load the dashboard — try again. ${t.message}`),n))}A(!1)},[e]);if((0,v.useEffect)(()=>{j();let e=setInterval(j,15e3);return()=>clearInterval(e)},[j]),k)return(0,y.jsxs)(`div`,{className:`space-y-6`,children:[(0,y.jsx)(g,{title:`Dashboard`,breadcrumbs:[{label:`Command Post`},{label:`Dashboard`}]}),(0,y.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3`,children:(0,y.jsx)(_,{variant:`metric`,count:4})})]});if(!t)return(0,y.jsx)(`div`,{className:`text-center py-12 text-text-muted`,children:`Failed to load dashboard`});let M=t.budgetUtilization??0,N=T.filter(e=>e.status===`in_progress`).length,P=T.filter(e=>e.status===`blocked`).length;return(0,y.jsxs)(`div`,{className:`space-y-6`,children:[(0,y.jsx)(g,{title:`Dashboard`,breadcrumbs:[{label:`Command Post`},{label:`Dashboard`}],actions:(0,y.jsx)(`button`,{onClick:j,className:`p-1.5 text-text-muted hover:text-text rounded-lg hover:bg-bg-tertiary transition-colors`,children:(0,y.jsx)(o,{size:16})})}),(0,y.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3`,children:[(0,y.jsx)(w,{icon:m,label:`Agents Enabled`,value:t.totalAgents,sub:`${t.activeAgents} running, ${Math.max(0,t.totalAgents-t.activeAgents)} paused`,color:`text-info`}),(0,y.jsx)(w,{icon:a,label:`Tasks In Progress`,value:N,sub:`${T.length} open, ${P} blocked`,color:`text-warning`}),(0,y.jsx)(w,{icon:i,label:`Budget Used`,value:`${Math.round(M)}%`,sub:M>=80?`Nearing limit`:`Healthy`,color:M>=80?`text-error`:`text-success`}),(0,y.jsx)(w,{icon:p,label:`Goals`,value:t.goalTree?.length??0,sub:`in hierarchy`,color:`text-purple`})]}),t.agents.length>0&&(0,y.jsx)(S,{agents:t.agents,activity:b}),(0,y.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,y.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl overflow-hidden`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-border`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(c,{size:14,className:`text-accent`}),(0,y.jsx)(`h3`,{className:`text-sm font-semibold text-text`,children:`Recent Activity`})]}),(0,y.jsx)(s,{to:`/command-post/activity`,className:`text-[10px] text-accent hover:text-accent-hover`,children:`View all`})]}),(0,y.jsx)(`div`,{className:`max-h-72 overflow-y-auto divide-y divide-border`,children:b.length===0?(0,y.jsx)(`div`,{className:`py-8 text-center text-xs text-text-muted`,children:`No activity yet`}):[...b].reverse().slice(0,15).map((e,t)=>(0,y.jsxs)(`div`,{className:`flex items-start gap-2 px-4 py-2`,children:[(0,y.jsx)(c,{size:12,className:`text-text-muted mt-0.5 flex-shrink-0`}),(0,y.jsx)(`span`,{className:`text-[11px] text-text-secondary flex-1`,children:e.message}),(0,y.jsx)(`span`,{className:`text-[10px] text-text-muted flex-shrink-0`,children:C(e.timestamp)})]},`${e.timestamp}-${t}`))})]}),(0,y.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl overflow-hidden`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-border`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(a,{size:14,className:`text-accent`}),(0,y.jsx)(`h3`,{className:`text-sm font-semibold text-text`,children:`Recent Issues`})]}),(0,y.jsx)(s,{to:`/command-post/issues`,className:`text-[10px] text-accent hover:text-accent-hover`,children:`View all`})]}),(0,y.jsx)(`div`,{className:`max-h-72 overflow-y-auto divide-y divide-border`,children:T.length===0?(0,y.jsx)(`div`,{className:`py-8 text-center text-xs text-text-muted`,children:`No issues yet`}):T.slice(0,10).map(e=>(0,y.jsxs)(s,{to:`/command-post/issues/${e.id}`,className:`flex items-center gap-2 px-4 py-2 hover:bg-bg-tertiary transition-colors`,children:[(0,y.jsx)(r,{status:e.status,variant:`dot`,size:`sm`}),(0,y.jsx)(`span`,{className:`text-[11px] text-text-secondary flex-1 truncate`,children:e.title}),e.assigneeAgentId&&(0,y.jsx)(`span`,{className:`text-[10px] text-text-muted`,children:e.assigneeAgentId}),(0,y.jsx)(`span`,{className:`text-[10px] text-text-muted flex-shrink-0`,children:C(e.updatedAt)})]},e.id))})]})]})]})}export{T as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./file-text-BbGTi-Po.js";import{t as i}from"./flask-conical-B1YVft4E.js";import{t as a}from"./folder-EbR-w2Mq.js";import{t as o}from"./refresh-cw-Disd5wRB.js";import{t as s}from"./search-aNVcX-nv.js";import{H as c,s as l}from"./index-WI-E4I3h.js";import{t as u}from"./PageHeader-CH85uoZG.js";var d=e(t(),1),f=n();async function p(e){let t=await c(e);if(!t.ok)throw Error(`HTTP ${t.status}`);return t.json()}function m(e){return e===void 0?`—`:e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}K`:`${(e/1024/1024).toFixed(1)}M`}function h(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function g({path:e,onClose:t}){let[n,r]=(0,d.useState)(null);return(0,d.useEffect)(()=>{r(null),p(`/api/files/content?path=${encodeURIComponent(e)}`).then(e=>r(e)).catch(e=>r({error:String(e)}))},[e]),(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/60 flex items-center justify-center p-4`,onClick:t,children:(0,f.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:e=>e.stopPropagation(),children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-border`,children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`div`,{className:`text-sm font-medium text-text truncate`,children:e}),n&&`sizeBytes`in n&&(0,f.jsxs)(`div`,{className:`text-xs text-text-muted`,children:[m(n.sizeBytes),` · `,n.encoding,n.truncated?` · truncated at 1MB`:``]})]}),(0,f.jsx)(`button`,{onClick:t,className:`p-1 rounded hover:bg-bg-tertiary text-text-muted`,title:`Close`,children:(0,f.jsx)(l,{size:18})})]}),(0,f.jsxs)(`div`,{className:`flex-1 overflow-auto p-4`,children:[n===null&&(0,f.jsx)(`div`,{className:`text-center py-12 text-text-muted text-sm`,children:`Loading…`}),n&&`error`in n&&(0,f.jsx)(`div`,{className:`text-error text-sm py-8 text-center`,children:n.error}),n&&`content`in n&&(0,f.jsx)(`pre`,{className:`text-[12px] font-mono leading-snug whitespace-pre-wrap text-text-secondary`,children:n.content})]})]})})}function _(){let[e,t]=(0,d.useState)([]),[n,i]=(0,d.useState)(!0),[a,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(null),_=(0,d.useCallback)(async()=>{i(!0);try{let e=await p(`/api/files/edited?limit=300`);t(e.files||[])}catch{}i(!1)},[]);(0,d.useEffect)(()=>{_()},[_]);let v=a?e.filter(e=>e.path.toLowerCase().includes(a.toLowerCase())):e;return(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`div`,{className:`flex-1 flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-bg-secondary`,children:[(0,f.jsx)(s,{size:14,className:`text-text-muted`}),(0,f.jsx)(`input`,{type:`text`,placeholder:`Filter by path…`,value:a,onChange:e=>c(e.target.value),className:`flex-1 bg-transparent text-sm outline-none`})]}),(0,f.jsxs)(`button`,{onClick:_,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:[(0,f.jsx)(o,{size:14,className:n?`animate-spin`:``}),n?`Loading`:`Refresh`]}),(0,f.jsxs)(`div`,{className:`text-xs text-text-muted`,children:[v.length,` / `,e.length]})]}),n&&e.length===0&&(0,f.jsx)(`div`,{className:`text-center py-12 text-text-muted text-sm`,children:`Loading…`}),!n&&v.length===0&&(0,f.jsx)(`div`,{className:`text-center py-12 text-text-muted text-sm`,children:a?`No files match filter`:`No file edits recorded yet`}),v.length>0&&(0,f.jsx)(`div`,{className:`divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden`,children:v.map(e=>(0,f.jsxs)(`button`,{onClick:()=>e.readable&&e.exists&&u(e.path),disabled:!e.readable||!e.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:[(0,f.jsx)(r,{size:14,className:e.isSelfMod?`text-accent mt-0.5 flex-shrink-0`:`text-text-muted mt-0.5 flex-shrink-0`}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`div`,{className:`text-sm font-mono text-text truncate`,children:e.path}),(0,f.jsxs)(`div`,{className:`text-xs text-text-muted mt-0.5 flex items-center gap-2 flex-wrap`,children:[e.isSelfMod&&(0,f.jsx)(`span`,{className:`px-1 rounded bg-accent/15 text-accent text-[10px]`,children:`self-mod`}),(0,f.jsxs)(`span`,{children:[`×`,e.writeCount]}),e.tools.length>0&&(0,f.jsx)(`span`,{children:e.tools.join(`+`)}),e.channels.length>0&&(0,f.jsxs)(`span`,{children:[`via `,e.channels.join(`, `)]}),!e.exists&&(0,f.jsx)(`span`,{className:`text-warn`,children:`deleted`}),(0,f.jsx)(`span`,{children:m(e.sizeBytes)})]})]}),(0,f.jsx)(`div`,{className:`text-xs text-text-muted flex-shrink-0`,children:h(e.lastWrittenAt)})]},e.path))}),l&&(0,f.jsx)(g,{path:l,onClose:()=>u(null)})]})}function v(){let[e,t]=(0,d.useState)([]),[n,r]=(0,d.useState)(!0),[i,a]=(0,d.useState)(null),s=(0,d.useCallback)(async()=>{r(!0);try{let e=await p(`/api/research/recent?limit=50`);t(e.research||[])}catch{}r(!1)},[]);return(0,d.useEffect)(()=>{s()},[s]),(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`button`,{onClick:s,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:[(0,f.jsx)(o,{size:14,className:n?`animate-spin`:``}),n?`Loading`:`Refresh`]}),(0,f.jsxs)(`div`,{className:`text-xs text-text-muted`,children:[e.length,` items`]})]}),n&&e.length===0&&(0,f.jsx)(`div`,{className:`text-center py-12 text-text-muted text-sm`,children:`Loading…`}),!n&&e.length===0&&(0,f.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.`}),(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let t=i===e.id,n=e.content.slice(0,200),r=e.subtaskTitle?`${e.goalTitle} — ${e.subtaskTitle}`:e.tags?.join(` · `)||e.kind;return(0,f.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-secondary overflow-hidden`,children:[(0,f.jsxs)(`button`,{onClick:()=>a(t?null:e.id),className:`w-full text-left px-4 py-3 hover:bg-bg-tertiary transition-colors`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,f.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary text-text-muted uppercase tracking-wide font-medium`,children:e.kind.replace(/_/g,` `)}),(0,f.jsx)(`span`,{className:`text-xs text-text-muted`,children:h(e.at)})]}),(0,f.jsx)(`div`,{className:`text-sm font-medium text-text truncate`,children:r}),!t&&(0,f.jsxs)(`div`,{className:`text-xs text-text-secondary mt-1 line-clamp-2`,children:[n,e.content.length>200?`…`:``]})]}),t&&(0,f.jsx)(`div`,{className:`px-4 pb-4`,children:(0,f.jsx)(`pre`,{className:`text-[12px] font-mono leading-snug whitespace-pre-wrap text-text-secondary`,children:e.content})})]},e.id)})})]})}function y(){let[e,t]=(0,d.useState)(`files`);return(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(u,{title:`Files & Research`,subtitle:`Files edited by agents and research notes captured during missions`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Tools`},{label:`Files`}]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`button`,{onClick:()=>t(`files`),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors ${e===`files`?`bg-accent/15 text-accent border border-accent/30`:`text-text-secondary hover:text-text hover:bg-bg-tertiary border border-transparent`}`,children:[(0,f.jsx)(a,{size:14}),` Files edited`]}),(0,f.jsxs)(`button`,{onClick:()=>t(`research`),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors ${e===`research`?`bg-accent/15 text-accent border border-accent/30`:`text-text-secondary hover:text-text hover:bg-bg-tertiary border border-transparent`}`,children:[(0,f.jsx)(i,{size:14}),` Research`]})]}),e===`files`?(0,f.jsx)(_,{}):(0,f.jsx)(v,{})]})}export{y as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./chevron-right-A_pvnRh_.js";import{i}from"./shared-DLz_Jtg3.js";import{t as a}from"./plus-CHryCIkk.js";import{t as o}from"./trash-2-CwUv7ww1.js";import{H as s,P as c,p as l,s as u,vt as d}from"./index-WI-E4I3h.js";import{t as f}from"./PageHeader-CH85uoZG.js";import{n as p,r as m}from"./ConfirmDialog-6hcNjmAh.js";import{t as h}from"./EmptyState-D-Dg8B8r.js";import{t as g}from"./SkeletonLoader-9H7QWa9E.js";var _=e(t(),1),v=n();function y(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}var b=[`pending`,`in_progress`,`completed`,`blocked`];function x({node:e,onClose:t,onRefresh:n}){let[r,a]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),d=e.goal,f=async()=>{a(!0);try{await s(`/api/goals/${d.id}`,{method:`DELETE`}),n(),t()}catch{}a(!1)},p=async e=>{l(!0);try{await s(`/api/goals/${d.id}`,{method:`PATCH`,body:JSON.stringify({status:e})}),n()}catch{}l(!1)};return(0,v.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl p-5 space-y-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,v.jsxs)(`div`,{className:`flex-1`,children:[(0,v.jsx)(`h3`,{className:`text-lg font-semibold text-text`,children:d.title}),d.description&&(0,v.jsx)(`p`,{className:`text-sm text-text-secondary mt-1`,children:d.description})]}),(0,v.jsx)(`button`,{onClick:t,className:`p-1 text-text-muted hover:text-text rounded-lg hover:bg-bg-tertiary transition-colors`,children:(0,v.jsx)(u,{size:16})})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-xs`,children:[(0,v.jsxs)(`div`,{className:`bg-bg-tertiary/50 rounded-lg px-3 py-2`,children:[(0,v.jsx)(`span`,{className:`text-text-muted`,children:`Status: `}),(0,v.jsx)(i,{status:d.status,size:`sm`})]}),d.progress>0&&(0,v.jsxs)(`div`,{className:`bg-bg-tertiary/50 rounded-lg px-3 py-2`,children:[(0,v.jsx)(`span`,{className:`text-text-muted`,children:`Progress: `}),(0,v.jsxs)(`span`,{className:`text-text font-medium`,children:[Math.round(d.progress),`%`]})]}),e.children.length>0&&(0,v.jsxs)(`div`,{className:`bg-bg-tertiary/50 rounded-lg px-3 py-2`,children:[(0,v.jsx)(`span`,{className:`text-text-muted`,children:`Sub-goals: `}),(0,v.jsxs)(`span`,{className:`text-text font-medium`,children:[e.children.filter(e=>e.goal.status===`completed`||e.goal.status===`done`).length,`/`,e.children.length,` done`]})]}),(0,v.jsxs)(`div`,{className:`bg-bg-tertiary/50 rounded-lg px-3 py-2`,children:[(0,v.jsx)(`span`,{className:`text-text-muted`,children:`Updated: `}),(0,v.jsxs)(`span`,{className:`text-text font-medium`,children:[y(d.updatedAt||d.createdAt||new Date().toISOString()),` ago`]})]})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:`block text-xs text-text-muted mb-2`,children:`Change Status`}),(0,v.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:b.map(e=>(0,v.jsx)(`button`,{disabled:c||d.status===e,onClick:()=>p(e),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${d.status===e?`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:e.replace(`_`,` `)},e))})]}),(0,v.jsx)(`div`,{className:`pt-2 border-t border-border flex justify-end`,children:(0,v.jsxs)(`button`,{onClick:f,disabled:r,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:[(0,v.jsx)(o,{size:12}),r?`Deleting...`:`Delete Goal`]})})]})}function S({node:e,expanded:t,toggleExpand:n,selectedId:a,onSelect:o}){let s=e.children.length>0,u=t.has(e.goal.id),d=a===e.goal.id,f=e.children.filter(e=>e.goal.status===`completed`||e.goal.status===`done`).length;return(0,v.jsxs)(`div`,{children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 py-2 px-3 rounded-lg transition-colors cursor-pointer group ${d?`bg-accent/10 border-l-2 border-accent`:`hover:bg-bg-tertiary/50`}`,style:{paddingLeft:`${e.depth*24+12}px`},onClick:()=>o(e),children:[s?(0,v.jsx)(`button`,{onClick:t=>{t.stopPropagation(),n(e.goal.id)},className:`p-0.5 rounded hover:bg-bg-tertiary transition-colors`,children:u?(0,v.jsx)(c,{size:14,className:`text-text-muted`}):(0,v.jsx)(r,{size:14,className:`text-text-muted`})}):(0,v.jsx)(`span`,{className:`w-[18px] flex-shrink-0`}),(0,v.jsx)(l,{size:14,className:d?`text-accent`:`text-text-muted`}),(0,v.jsx)(`span`,{className:`text-sm text-text flex-1 truncate`,children:e.goal.title}),(0,v.jsx)(i,{status:e.goal.status,size:`sm`}),s&&(0,v.jsxs)(`span`,{className:`text-[10px] text-text-muted`,children:[f,`/`,e.children.length]}),e.goal.progress>0&&(0,v.jsx)(`div`,{className:`w-16 h-1.5 bg-bg-tertiary rounded-full overflow-hidden flex-shrink-0`,children:(0,v.jsx)(`div`,{className:`h-full bg-accent rounded-full transition-all`,style:{width:`${Math.min(100,e.goal.progress)}%`}})})]}),s&&u&&(0,v.jsx)(`div`,{children:e.children.map(e=>(0,v.jsx)(S,{node:e,expanded:t,toggleExpand:n,selectedId:a,onSelect:o},e.goal.id))})]})}function C(e,t){for(let n of e){if(n.goal.id===t)return n;let e=C(n.children,t);if(e)return e}return null}function w(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)(!0),[i,o]=(0,_.useState)(null),[c,u]=(0,_.useState)(new Set),[y,b]=(0,_.useState)(null),[w,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(``),[O,k]=(0,_.useState)(!1),A=(0,_.useCallback)(async()=>{try{let e=await d();t(e),u(new Set(e.map(e=>e.goal.id))),o(null)}catch(e){o(e instanceof Error?e.message:`Failed to load goals`)}r(!1)},[]);(0,_.useEffect)(()=>{A()},[A]);let j=e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},M=e=>{b(t=>t===e.goal.id?null:e.goal.id),e.children.length>0&&!c.has(e.goal.id)&&j(e.goal.id)},N=async()=>{if(E.trim()){k(!0);try{await s(`/api/command-post/goals`,{method:`POST`,body:JSON.stringify({title:E.trim()})}),T(!1),D(``),await A()}catch{}k(!1)}},P=y?C(e,y):null;return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsx)(f,{title:`Goals`,breadcrumbs:[{label:`Command Post`},{label:`Goals`}],actions:(0,v.jsx)(p,{size:`sm`,icon:(0,v.jsx)(a,{size:14}),onClick:()=>T(!0),children:`Create Goal`})}),n&&(0,v.jsx)(g,{variant:`row`,count:5}),i&&(0,v.jsx)(`div`,{className:`text-center py-8 text-error text-sm`,children:i}),!n&&!i&&e.length===0&&(0,v.jsx)(h,{icon:(0,v.jsx)(l,{size:32}),title:`No goals`,description:`Create your first goal to start organizing agent work.`,action:{label:`Create Goal`,onClick:()=>T(!0)}}),!n&&!i&&e.length>0&&(0,v.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-4`,children:[(0,v.jsxs)(`div`,{className:`lg:col-span-2 rounded-xl border border-border bg-bg-secondary overflow-hidden`,children:[(0,v.jsxs)(`div`,{className:`px-4 py-3 border-b border-border flex items-center justify-between`,children:[(0,v.jsxs)(`span`,{className:`text-xs text-text-muted`,children:[e.length,` top-level goal`,e.length===1?``:`s`]}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-muted`,children:`Click a goal to view details`})]}),(0,v.jsx)(`div`,{className:`divide-y divide-border`,children:e.map(e=>(0,v.jsx)(S,{node:e,expanded:c,toggleExpand:j,selectedId:y,onSelect:M},e.goal.id))})]}),(0,v.jsx)(`div`,{className:`lg:col-span-1`,children:P?(0,v.jsx)(x,{node:P,onClose:()=>b(null),onRefresh:A}):(0,v.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl p-8 text-center`,children:[(0,v.jsx)(l,{size:24,className:`text-text-muted mx-auto mb-2`}),(0,v.jsx)(`p`,{className:`text-xs text-text-muted`,children:`Select a goal to view details`})]})})]}),(0,v.jsx)(m,{open:w,onClose:()=>T(!1),title:`Create Goal`,footer:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(p,{variant:`secondary`,size:`sm`,onClick:()=>T(!1),children:`Cancel`}),(0,v.jsx)(p,{size:`sm`,onClick:N,loading:O,disabled:!E.trim(),children:`Create`})]}),children:(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Goal Title`}),(0,v.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:E,onChange:e=>D(e.target.value),onKeyDown:e=>e.key===`Enter`&&N(),autoFocus:!0})]})})]})}export{w as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./createLucideIcon-qnlrxww7.js";import{t as i}from"./bot-CWDCc265.js";import{n as a}from"./pencil-Dd_vzHE-.js";import{n as o,t as s}from"./square-DlcoJ1ZM.js";import{r as c}from"./shared-DLz_Jtg3.js";import{t as l}from"./clock-DSPgndSD.js";import{t as u}from"./funnel-D2Dkn8Pf.js";import{t as d}from"./message-square-BpzrINHz.js";import{t as f}from"./rotate-ccw-Cw1T2W1T.js";import{t as p}from"./send-D7iQD57b.js";import{t as m}from"./shield-check-Cd50jCAn.js";import{$n as h,A as ee,An as g,Ct as te,Fn as _,H as ne,Ot as v,P as y,U as b,a as x,d as S,f as C,gt as w,ir as T,q as E,s as D,wn as re,xt as ie}from"./index-WI-E4I3h.js";import{t as ae}from"./PageHeader-CH85uoZG.js";import{n as O}from"./ConfirmDialog-6hcNjmAh.js";import{t as oe}from"./EmptyState-D-Dg8B8r.js";import{t as k}from"./SkeletonLoader-9H7QWa9E.js";import{t as A}from"./approvalHeadline-BRg3ReTi.js";var j=r(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),M=r(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),N=e(t(),1),P=n();function F(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function I({approval:e,onReply:t}){let[n,r]=(0,N.useState)(``),[a,o]=(0,N.useState)(!1),{toast:s}=x(),c=e.thread||[],u=async()=>{if(n.trim()){o(!0);try{await g(e.id,`user`,n.trim()),r(``),t?.(),s(`success`,`Reply sent`)}catch{s(`error`,`Failed to send reply`)}o(!1)}};return(0,P.jsxs)(`div`,{className:`space-y-3 mt-3`,children:[c.length===0&&(0,P.jsxs)(`div`,{className:`text-xs text-text-muted italic flex items-center gap-1`,children:[(0,P.jsx)(d,{size:12}),`No replies yet. Start the conversation below.`]}),c.map(e=>(0,P.jsxs)(`div`,{className:`flex gap-2 ${e.authorUser?`flex-row`:`flex-row-reverse`}`,children:[(0,P.jsx)(`div`,{className:`w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 ${e.authorUser?`bg-accent/20 text-accent`:`bg-warning/20 text-warning`}`,children:e.authorUser?(0,P.jsx)(S,{size:12}):(0,P.jsx)(i,{size:12})}),(0,P.jsxs)(`div`,{className:`max-w-[80%] rounded-lg px-3 py-2 text-xs ${e.authorUser?`bg-bg-tertiary text-text`:`bg-warning/10 text-text border border-warning/20`}`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1`,children:[(0,P.jsx)(`span`,{className:`font-semibold`,children:e.authorUser||e.authorAgentId||`Agent`}),(0,P.jsx)(l,{size:10,className:`text-text-muted`}),(0,P.jsx)(`span`,{className:`text-text-muted`,children:F(e.createdAt)})]}),(0,P.jsx)(`div`,{className:`whitespace-pre-wrap`,children:e.body})]})]},e.id)),(0,P.jsxs)(`div`,{className:`flex items-end gap-2 pt-2`,children:[(0,P.jsx)(`textarea`,{value:n,onChange:e=>r(e.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:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),u())}}),(0,P.jsx)(`button`,{onClick:u,disabled:a||!n.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:(0,P.jsx)(p,{size:14})})]})]})}function L(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function R(e){return!!e.snoozedUntil&&new Date(e.snoozedUntil)>new Date}function z(){let[e,t]=(0,N.useState)([]),[n,r]=(0,N.useState)(!0),[p,g]=(0,N.useState)(null),[S,F]=(0,N.useState)(`all`),[z,B]=(0,N.useState)(null),[V,H]=(0,N.useState)(null),[U,W]=(0,N.useState)(new Set),[G,K]=(0,N.useState)(`all`),{toast:q}=x(),se=T(),J=(0,N.useCallback)(async()=>{try{let[e,n,r,i]=await Promise.all([w(`pending`),te(void 0,50),v(),ie({status:`blocked`})]),a=[];e.forEach(e=>{let t=A(e),n=e.type===`custom`&&e.payload.kind===`driver_blocked`,r=e.type===`custom`&&e.payload.kind===`self_mod_pr`;a.push({id:`approval-${e.id}`,kind:`approval`,icon:m,iconColor:n?`text-error`:r?`text-warning`:`text-accent`,urgency:n||r?`high`:`medium`,message:`${t.kindLabel}: ${t.headline}`,timestamp:e.createdAt,data:e})}),n.filter(e=>e.status===`failed`||e.status===`error`).forEach(e=>a.push({id:`run-${e.id}`,kind:`failed_run`,icon:ee,iconColor:`text-error`,urgency:`high`,message:`Run failed: ${e.agentId} — ${e.error??`unknown error`}`,timestamp:e.finishedAt??e.startedAt,data:e})),r.filter(e=>e.status===`error`).forEach(e=>a.push({id:`agent-${e.id}`,kind:`error_agent`,icon:C,iconColor:`text-error`,urgency:`high`,message:`Agent error: ${e.name}`,timestamp:e.lastHeartbeat,data:e})),i.forEach(e=>a.push({id:`issue-${e.id}`,kind:`blocked_issue`,icon:C,iconColor:`text-warning`,urgency:`medium`,message:`Blocked: ${e.identifier} — ${e.title}`,timestamp:e.updatedAt,data:e})),a.sort((e,t)=>{let n={high:0,medium:1,low:2};return n[e.urgency]===n[t.urgency]?new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime():n[e.urgency]-n[t.urgency]}),t(a),g(null)}catch(e){g(e instanceof Error?e.message:`Failed to load inbox`)}r(!1)},[]);(0,N.useEffect)(()=>{J()},[J]);let ce=async e=>{B(e.id);try{await b(e.id,`user`),await J();let t=e.type===`goal_proposal`||e.type===`soma_proposal`,n=e.type===`custom`&&e.payload.kind===`driver_blocked`;q(`success`,t?`Work approved — TITAN is starting…`:n?`Unblocked — TITAN is resuming…`:`Approved`),(t||n)&&se(`/command-post`,{state:{tab:`Work`}})}catch{q(`error`,`Approval failed`)}B(null)},le=async e=>{B(e.id);try{await re(e.id,`user`),await J(),q(`success`,`Rejected`)}catch{q(`error`,`Reject failed`)}B(null)},ue=async(e,t)=>{B(e.id);try{let n=new Date(Date.now()+t*6e4).toISOString();await _(e.id,n),await J(),q(`success`,`Snoozed for ${t}m`)}catch{q(`error`,`Snooze failed`)}B(null)},Y=async e=>{B(e.id);try{let t=await ne(`/api/command-post/runs/${e.id}/retry`,{method:`POST`});if(!t.ok)throw Error(`${t.status} ${t.statusText}`);await J(),q(`success`,`Retry queued — TITAN will try again`)}catch{q(`error`,`Retry failed`)}B(null)},de=e=>{W(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},X=async t=>{let n=Array.from(U).map(t=>e.find(e=>e.id===t)?.data).filter(e=>e?.id!==void 0).map(e=>e.id);if(n.length!==0){B(`batch`);try{await E(n,t,`user`),W(new Set),await J(),q(`success`,`${t===`approve`?`Approved`:`Rejected`} ${n.length} item(s)`)}catch{q(`error`,`Batch action failed`)}B(null)}},Z=e.filter(e=>S===`all`?!0:S===`approvals`?e.kind===`approval`:S===`failed_runs`?e.kind===`failed_run`:S===`errors`?e.kind===`error_agent`||e.kind===`blocked_issue`:!0).filter(e=>G===`all`?!0:e.kind===`approval`?e.data.requestedBy===G:e.kind===`failed_run`?e.data.agentId===G:!0),Q=e.filter(e=>e.kind===`approval`),fe=[{id:`all`,label:`All`,count:e.length},{id:`approvals`,label:`Approvals`,count:Q.length},{id:`failed_runs`,label:`Failed Runs`,count:e.filter(e=>e.kind===`failed_run`).length},{id:`errors`,label:`Errors`,count:e.filter(e=>e.kind===`error_agent`||e.kind===`blocked_issue`).length}],$=Array.from(new Set(Q.map(e=>e.data.requestedBy))).filter(Boolean);return(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(ae,{title:`Inbox`,breadcrumbs:[{label:`Command Post`},{label:`Inbox`}]}),U.size>0&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-accent/10 border border-accent/20`,children:[(0,P.jsxs)(`span`,{className:`text-xs font-medium text-accent`,children:[U.size,` selected`]}),(0,P.jsx)(`div`,{className:`flex-1`}),(0,P.jsx)(O,{size:`sm`,variant:`ghost`,onClick:()=>X(`approve`),loading:z===`batch`,icon:(0,P.jsx)(a,{size:14}),children:`Approve All`}),(0,P.jsx)(O,{size:`sm`,variant:`ghost`,onClick:()=>X(`reject`),loading:z===`batch`,icon:(0,P.jsx)(D,{size:14}),children:`Reject All`}),(0,P.jsx)(`button`,{onClick:()=>W(new Set),className:`text-xs text-text-muted hover:text-text px-2`,children:`Clear`})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(c,{tabs:fe,activeTab:S,onChange:F}),(0,P.jsx)(`div`,{className:`flex-1`}),S===`approvals`&&$.length>0&&(0,P.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,P.jsx)(u,{size:12,className:`text-text-muted`}),(0,P.jsxs)(`select`,{value:G,onChange:e=>K(e.target.value),className:`text-xs bg-bg border border-border rounded px-2 py-1 outline-none focus:border-accent`,children:[(0,P.jsx)(`option`,{value:`all`,children:`All agents`}),$.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]})]})]}),n&&(0,P.jsx)(k,{variant:`row`,count:5}),p&&(0,P.jsx)(`div`,{className:`text-center py-8 text-error text-sm`,children:p}),!n&&!p&&Z.length===0&&(0,P.jsx)(oe,{icon:(0,P.jsx)(j,{size:32}),title:`Inbox empty`,description:`No pending items require your attention.`}),!n&&!p&&Z.length>0&&(0,P.jsx)(`div`,{className:`space-y-2`,children:Z.map(e=>{let t=e.icon,n=V===e.id,r=U.has(e.id),c=e.kind===`approval`?e.data:null;return(0,P.jsxs)(`div`,{className:`rounded-xl border overflow-hidden transition-colors ${e.urgency===`high`?`border-error/30 bg-error/5`:e.urgency===`medium`?`border-warning/20 bg-warning/[0.03]`:`border-border bg-bg-secondary`}`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3`,children:[e.kind===`approval`&&(0,P.jsx)(`button`,{onClick:()=>de(e.id),className:`text-text-muted hover:text-accent transition-colors`,children:r?(0,P.jsx)(M,{size:16,className:`text-accent`}):(0,P.jsx)(s,{size:16})}),(0,P.jsx)(t,{size:16,className:e.iconColor}),(0,P.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,P.jsx)(`div`,{className:`text-sm text-text font-medium truncate`,children:e.message}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-text-muted mt-0.5`,children:[c&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,P.jsx)(i,{size:10}),c.requestedBy]}),c.thread&&c.thread.length>0&&(0,P.jsxs)(`span`,{className:`flex items-center gap-1 text-accent`,children:[(0,P.jsx)(d,{size:10}),c.thread.length]}),R(c)&&(0,P.jsxs)(`span`,{className:`flex items-center gap-1 text-warning`,children:[(0,P.jsx)(l,{size:10}),`Snoozed`]})]}),(0,P.jsx)(`span`,{children:L(e.timestamp)})]})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[e.kind===`approval`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(O,{size:`sm`,variant:`ghost`,onClick:()=>ce(e.data),loading:z===e.data.id,icon:(0,P.jsx)(a,{size:14}),children:`Approve`}),(0,P.jsx)(O,{size:`sm`,variant:`ghost`,onClick:()=>le(e.data),loading:z===e.data.id,icon:(0,P.jsx)(D,{size:14}),children:`Reject`}),(0,P.jsxs)(`div`,{className:`relative group`,children:[(0,P.jsx)(O,{size:`sm`,variant:`ghost`,icon:(0,P.jsx)(l,{size:14}),children:`Snooze`}),(0,P.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(t=>(0,P.jsx)(`button`,{onClick:()=>ue(e.data,t),className:`text-xs text-left px-2 py-1 rounded hover:bg-bg-tertiary whitespace-nowrap`,children:t<60?`${t}m`:t<1440?`${t/60}h`:`${t/1440}d`},t))})]}),(0,P.jsx)(`button`,{onClick:()=>H(n?null:e.id),className:`p-1.5 rounded hover:bg-bg-tertiary text-text-muted`,children:n?(0,P.jsx)(o,{size:14}):(0,P.jsx)(y,{size:14})})]}),e.kind===`failed_run`&&(0,P.jsx)(O,{size:`sm`,variant:`ghost`,onClick:()=>Y(e.data),loading:z===e.data.id,icon:(0,P.jsx)(f,{size:14}),children:`Retry`}),e.kind===`blocked_issue`&&(0,P.jsx)(h,{to:`/command-post/issues/${e.data.id}`,children:(0,P.jsx)(O,{size:`sm`,variant:`ghost`,children:`View`})}),e.kind===`error_agent`&&(0,P.jsx)(h,{to:`/command-post/agents/${e.data.id}`,children:(0,P.jsx)(O,{size:`sm`,variant:`ghost`,children:`View`})})]})]}),n&&c&&(0,P.jsxs)(`div`,{className:`px-4 pb-4 border-t border-border/50`,children:[c.payload&&!!c.payload.shadowVerdict&&(0,P.jsxs)(`div`,{className:`mt-3 p-2 rounded-lg bg-bg-tertiary/50 text-xs`,children:[(0,P.jsx)(`div`,{className:`font-medium text-text-muted mb-1`,children:`Shadow Rehearsal`}),(0,P.jsx)(`div`,{className:`text-text-secondary`,children:(()=>{let e=c.payload.shadowVerdict;return e?(0,P.jsxs)(`div`,{className:`space-y-1`,children:[e.estimatedCostUsd?(0,P.jsxs)(`div`,{children:[`Cost: $`,Number(e.estimatedCostUsd).toFixed(2)]}):null,e.reversibilityScore===void 0?null:(0,P.jsxs)(`div`,{children:[`Reversibility: `,Number(e.reversibilityScore).toFixed(2)]}),e.breakRisks&&Array.isArray(e.breakRisks)&&e.breakRisks.length>0?(0,P.jsxs)(`div`,{className:`text-error`,children:[`Risks: `,e.breakRisks.join(`, `)]}):null]}):null})()})]}),(0,P.jsx)(I,{approval:c,onReply:J})]})]},e.id)})})]})}export{z as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./arrow-left-4c2FnES1.js";import{i}from"./shared-DLz_Jtg3.js";import{t as a}from"./message-square-BpzrINHz.js";import{t as o}from"./send-D7iQD57b.js";import{$n as s,H as c,Kn as l,Ut as u,ar as d,ir as f,yt as p}from"./index-WI-E4I3h.js";import{t as m}from"./PageHeader-CH85uoZG.js";import{n as h}from"./ConfirmDialog-6hcNjmAh.js";import{t as g}from"./SkeletonLoader-9H7QWa9E.js";var _=e(t(),1),v=n();function y(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}var b={critical:`text-error`,high:`text-warning`,medium:`text-accent`,low:`text-text-muted`},x=[`backlog`,`todo`,`in_progress`,`in_review`,`done`,`blocked`,`cancelled`];function S(){let{id:e}=d(),t=f(),[n,S]=(0,_.useState)(null),[C,w]=(0,_.useState)([]),[T,E]=(0,_.useState)(!0),[D,O]=(0,_.useState)(null),[k,A]=(0,_.useState)(!1),[j,M]=(0,_.useState)(``),[N,P]=(0,_.useState)(``),[F,I]=(0,_.useState)(!1),[L,R]=(0,_.useState)(``),z=(0,_.useCallback)(async()=>{if(e){try{let t=await p(e);S(t),M(t.title);try{let t=await c(`/api/command-post/issues/${e}/comments`);t.ok&&w(await t.json())}catch{}O(null)}catch(e){O(e instanceof Error?e.message:`Failed to load issue`)}E(!1)}},[e]);(0,_.useEffect)(()=>{z()},[z]),(0,_.useEffect)(()=>{n?.id&&u(n.id).then(e=>R(e.ancestry)).catch(()=>{})},[n?.id]);let B=async t=>{if(!(!e||!n))try{let n=await l(e,{status:t});S(n)}catch{}},V=async()=>{if(!(!e||!n||!j.trim()))try{let t=await l(e,{title:j.trim()});S(t),A(!1)}catch{}},H=async()=>{if(!(!e||!N.trim())){I(!0);try{await c(`/api/command-post/issues/${e}/comments`,{method:`POST`,body:JSON.stringify({body:N.trim()})}),P(``),await z()}catch{}I(!1)}};return T?(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsx)(m,{title:`Issue`,breadcrumbs:[{label:`Command Post`},{label:`Issues`,href:`/command-post/issues`},{label:`...`}]}),(0,v.jsx)(g,{variant:`card`,count:1})]}):D||!n?(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsx)(m,{title:`Issue`,breadcrumbs:[{label:`Command Post`},{label:`Issues`,href:`/command-post/issues`},{label:`Error`}]}),(0,v.jsxs)(`div`,{className:`text-center py-12`,children:[(0,v.jsx)(`p`,{className:`text-error text-sm mb-4`,children:D??`Issue not found`}),(0,v.jsx)(h,{variant:`secondary`,size:`sm`,onClick:()=>t(`/command-post/issues`),children:`Back to Issues`})]})]}):(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsx)(m,{title:n.identifier,breadcrumbs:[{label:`Command Post`},{label:`Issues`,href:`/command-post/issues`},{label:n.identifier}],actions:(0,v.jsxs)(s,{to:`/command-post/issues`,className:`flex items-center gap-1 text-xs text-text-muted hover:text-text`,children:[(0,v.jsx)(r,{size:14}),` Back`]})}),L&&(0,v.jsx)(`div`,{className:`bg-bg-tertiary/30 border border-border rounded-lg px-4 py-3 mb-4`,children:(0,v.jsx)(`pre`,{className:`text-xs text-text-secondary whitespace-pre-wrap font-mono leading-relaxed`,children:L})}),(0,v.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-6`,children:[(0,v.jsxs)(`div`,{className:`lg:col-span-2 space-y-4`,children:[(0,v.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl p-4`,children:[k?(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.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:j,onChange:e=>M(e.target.value),onKeyDown:e=>e.key===`Enter`&&V(),autoFocus:!0}),(0,v.jsx)(h,{size:`sm`,onClick:V,children:`Save`}),(0,v.jsx)(h,{size:`sm`,variant:`ghost`,onClick:()=>{A(!1),M(n.title)},children:`Cancel`})]}):(0,v.jsx)(`h2`,{className:`text-lg font-semibold text-text cursor-pointer hover:text-accent transition-colors`,onClick:()=>A(!0),title:`Click to edit`,children:n.title}),n.description&&(0,v.jsx)(`p`,{className:`mt-3 text-sm text-text-secondary whitespace-pre-wrap`,children:n.description})]}),(0,v.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:x.map(e=>(0,v.jsx)(`button`,{onClick:()=>B(e),disabled:n.status===e,className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors border ${n.status===e?`border-accent bg-accent/10 text-accent`:`border-border bg-bg-tertiary text-text-muted hover:text-text hover:border-border-light`}`,children:e.replace(/_/g,` `)},e))}),(0,v.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl overflow-hidden`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 border-b border-border`,children:[(0,v.jsx)(a,{size:14,className:`text-accent`}),(0,v.jsx)(`h3`,{className:`text-sm font-semibold text-text`,children:`Comments`}),(0,v.jsxs)(`span`,{className:`text-xs text-text-muted`,children:[`(`,C.length,`)`]})]}),C.length===0?(0,v.jsx)(`div`,{className:`py-8 text-center text-xs text-text-muted`,children:`No comments yet`}):(0,v.jsx)(`div`,{className:`divide-y divide-border max-h-96 overflow-y-auto`,children:C.map(e=>(0,v.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,v.jsx)(`span`,{className:`text-xs font-medium text-text`,children:e.authorAgentId??e.authorUser??`Unknown`}),(0,v.jsxs)(`span`,{className:`text-[10px] text-text-muted`,children:[y(e.createdAt),` ago`]})]}),(0,v.jsx)(`p`,{className:`text-sm text-text-secondary whitespace-pre-wrap`,children:e.body})]},e.id))}),(0,v.jsxs)(`div`,{className:`border-t border-border px-4 py-3 flex items-center gap-2`,children:[(0,v.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:e=>P(e.target.value),onKeyDown:e=>e.key===`Enter`&&!e.shiftKey&&H()}),(0,v.jsx)(h,{size:`sm`,onClick:H,loading:F,disabled:!N.trim(),icon:(0,v.jsx)(o,{size:14}),children:`Send`})]})]})]}),(0,v.jsx)(`div`,{className:`space-y-4`,children:(0,v.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl p-4 space-y-3`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`span`,{className:`text-[10px] text-text-muted uppercase tracking-wider`,children:`Status`}),(0,v.jsx)(`div`,{className:`mt-1`,children:(0,v.jsx)(i,{status:n.status})})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`span`,{className:`text-[10px] text-text-muted uppercase tracking-wider`,children:`Priority`}),(0,v.jsx)(`div`,{className:`mt-1 text-sm font-medium capitalize ${b[n.priority]??`text-text`}`,children:n.priority})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`span`,{className:`text-[10px] text-text-muted uppercase tracking-wider`,children:`Assignee`}),(0,v.jsx)(`div`,{className:`mt-1 text-sm text-text-secondary`,children:n.assigneeAgentId??`Unassigned`})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`span`,{className:`text-[10px] text-text-muted uppercase tracking-wider`,children:`Identifier`}),(0,v.jsx)(`div`,{className:`mt-1 text-sm text-text font-mono`,children:n.identifier})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`span`,{className:`text-[10px] text-text-muted uppercase tracking-wider`,children:`Created`}),(0,v.jsxs)(`div`,{className:`mt-1 text-sm text-text-secondary`,children:[y(n.createdAt),` ago`]})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`span`,{className:`text-[10px] text-text-muted uppercase tracking-wider`,children:`Updated`}),(0,v.jsxs)(`div`,{className:`mt-1 text-sm text-text-secondary`,children:[y(n.updatedAt),` ago`]})]})]})})]})]})}export{S as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{i as r,r as i}from"./shared-DLz_Jtg3.js";import{t as a}from"./list-todo-DfnNUV_T.js";import{t as o}from"./plus-CHryCIkk.js";import{$n as s,X as c,xt as l}from"./index-WI-E4I3h.js";import{t as u}from"./PageHeader-CH85uoZG.js";import{n as d,r as f}from"./ConfirmDialog-6hcNjmAh.js";import{t as p}from"./EmptyState-D-Dg8B8r.js";import{t as m}from"./SkeletonLoader-9H7QWa9E.js";var h=e(t(),1),g=n();function _(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}var v={critical:`text-error`,high:`text-warning`,medium:`text-accent`,low:`text-text-muted`},y=[{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 b(){let[e,t]=(0,h.useState)([]),[n,b]=(0,h.useState)(!0),[x,S]=(0,h.useState)(null),[C,w]=(0,h.useState)(`all`),[T,E]=(0,h.useState)(!1),[D,O]=(0,h.useState)(``),[k,A]=(0,h.useState)(`medium`),[j,M]=(0,h.useState)(``),[N,P]=(0,h.useState)(!1),F=(0,h.useCallback)(async()=>{try{let e=await l();t(e),S(null)}catch(e){S(e instanceof Error?e.message:`Failed to load issues`)}b(!1)},[]);(0,h.useEffect)(()=>{F()},[F]);let I=async()=>{if(D.trim()){P(!0);try{await c({title:D,description:j,priority:k}),E(!1),O(``),M(``),A(`medium`),await F()}catch{}P(!1)}},L=C===`all`?e:e.filter(e=>e.status===C),R=y.map(t=>({...t,count:t.id===`all`?e.length:e.filter(e=>e.status===t.id).length}));return(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsx)(u,{title:`Issues`,breadcrumbs:[{label:`Command Post`},{label:`Issues`}],actions:(0,g.jsx)(d,{size:`sm`,icon:(0,g.jsx)(o,{size:14}),onClick:()=>E(!0),children:`New Issue`})}),(0,g.jsx)(i,{tabs:R,activeTab:C,onChange:w}),n&&(0,g.jsx)(m,{variant:`row`,count:6}),x&&(0,g.jsx)(`div`,{className:`text-center py-8 text-error text-sm`,children:x}),!n&&!x&&L.length===0&&(0,g.jsx)(p,{icon:(0,g.jsx)(a,{size:32}),title:`No issues`,description:C===`all`?`Create your first issue to get started.`:`No ${C.replace(/_/g,` `)} issues.`,action:{label:`New Issue`,onClick:()=>E(!0)}}),!n&&!x&&L.length>0&&(0,g.jsx)(`div`,{className:`divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden`,children:L.map(e=>(0,g.jsxs)(s,{to:`/command-post/issues/${e.id}`,className:`flex items-center gap-3 px-4 py-3 hover:bg-bg-tertiary/50 transition-colors`,children:[(0,g.jsx)(r,{status:e.status,variant:`dot`,size:`sm`}),(0,g.jsx)(`span`,{className:`text-sm text-text flex-1 truncate`,children:e.title}),(0,g.jsx)(`span`,{className:`text-xs font-medium uppercase ${v[e.priority]??`text-text-muted`}`,children:e.priority}),e.assigneeAgentId&&(0,g.jsx)(`span`,{className:`text-xs text-text-muted truncate max-w-[100px]`,children:e.assigneeAgentId}),(0,g.jsx)(`span`,{className:`text-xs text-text-muted font-mono`,children:e.identifier}),(0,g.jsx)(`span`,{className:`text-xs text-text-muted flex-shrink-0`,children:_(e.updatedAt)})]},e.id))}),(0,g.jsx)(f,{open:T,onClose:()=>E(!1),title:`New Issue`,footer:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d,{variant:`secondary`,size:`sm`,onClick:()=>E(!1),children:`Cancel`}),(0,g.jsx)(d,{size:`sm`,onClick:I,loading:N,disabled:!D.trim(),children:`Create`})]}),children:(0,g.jsxs)(`div`,{className:`space-y-3`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Title`}),(0,g.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:D,onChange:e=>O(e.target.value),autoFocus:!0})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Priority`}),(0,g.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:k,onChange:e=>A(e.target.value),children:[(0,g.jsx)(`option`,{value:`low`,children:`Low`}),(0,g.jsx)(`option`,{value:`medium`,children:`Medium`}),(0,g.jsx)(`option`,{value:`high`,children:`High`}),(0,g.jsx)(`option`,{value:`critical`,children:`Critical`})]})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`block text-xs text-text-muted mb-1`,children:`Description`}),(0,g.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:j,onChange:e=>M(e.target.value)})]})]})})]})}export{b as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CommandPostHub-fIslwU_t.js","assets/jsx-runtime-B15e6lOy.js","assets/createLucideIcon-qnlrxww7.js","assets/bot-CWDCc265.js","assets/chart-column-hhZMdCgB.js","assets/chevron-right-A_pvnRh_.js","assets/shared-DLz_Jtg3.js","assets/pencil-Dd_vzHE-.js","assets/index-WI-E4I3h.js","assets/index-Cz8190xO.css","assets/clsx-CjueKrWZ.js","assets/PageHeader-CH85uoZG.js","assets/ConfirmDialog-6hcNjmAh.js","assets/EmptyState-D-Dg8B8r.js","assets/SkeletonLoader-9H7QWa9E.js","assets/DataTable-KVqtDzvP.js","assets/StatCard-wmSgMAM3.js","assets/circle-stop-yZuG9ZAE.js","assets/clock-DSPgndSD.js","assets/dollar-sign-D9siqK91.js","assets/file-text-BbGTi-Po.js","assets/git-branch-CQ2yNSzU.js","assets/message-square-BpzrINHz.js","assets/pause-C4TDJSfA.js","assets/plus-CHryCIkk.js","assets/refresh-cw-Disd5wRB.js","assets/send-D7iQD57b.js","assets/terminal-DgFz2Vsf.js","assets/trash-2-CwUv7ww1.js","assets/approvalHeadline-BRg3ReTi.js","assets/CPIssues-DknAIMyl.js","assets/list-todo-DfnNUV_T.js","assets/CPIssueDetail-CnmLzzDD.js","assets/arrow-left-4c2FnES1.js","assets/CPAgents-B6wSSQZM.js","assets/CPAgentDetail-p0Kvzhhb.js","assets/circle-check-big-C-JUM7wb.js","assets/save-DP7oNar2.js","assets/CPApprovals-CYv9Do0i.js","assets/shield-check-Cd50jCAn.js","assets/CPActivity-DGfS7EY3.js","assets/CPGoals-h0dKL5V_.js","assets/CPRuns-UlrIURqG.js","assets/play-9WxZWVHA.js","assets/CPCosts-Dx6Q71rN.js","assets/CPOrg-tDbHFphX.js","assets/network-CM7y1ats.js","assets/CPFiles-BJ49tzai.js","assets/flask-conical-B1YVft4E.js","assets/folder-EbR-w2Mq.js","assets/search-aNVcX-nv.js"])))=>i.map(i=>d[i]);
2
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{er as r,nr as i,sr as a,tr as o}from"./index-WI-E4I3h.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>a(()=>import(`./CommandPostHub-fIslwU_t.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,27,28,29]))),u=(0,s.lazy)(()=>a(()=>import(`./CPIssues-DknAIMyl.js`),__vite__mapDeps([30,1,6,2,7,8,9,10,11,5,12,13,14,15,16,31,24]))),d=(0,s.lazy)(()=>a(()=>import(`./CPIssueDetail-CnmLzzDD.js`),__vite__mapDeps([32,1,33,2,6,7,8,9,10,11,5,12,13,14,15,16,22,26]))),f=(0,s.lazy)(()=>a(()=>import(`./CPAgents-B6wSSQZM.js`),__vite__mapDeps([34,1,6,2,7,8,9,10,11,5,12,13,14,15,16]))),p=(0,s.lazy)(()=>a(()=>import(`./CPAgentDetail-p0Kvzhhb.js`),__vite__mapDeps([35,1,33,2,36,6,7,8,9,10,11,5,12,13,14,15,16,18,19,37]))),m=(0,s.lazy)(()=>a(()=>import(`./CPApprovals-CYv9Do0i.js`),__vite__mapDeps([38,1,7,2,6,8,9,10,11,5,12,13,14,15,16,39,29]))),h=(0,s.lazy)(()=>a(()=>import(`./CPActivity-DGfS7EY3.js`),__vite__mapDeps([40,1,3,2,6,7,8,9,10,11,5,12,13,14,15,16,19,39]))),g=(0,s.lazy)(()=>a(()=>import(`./CPGoals-h0dKL5V_.js`),__vite__mapDeps([41,1,5,2,6,7,8,9,10,11,12,13,14,15,16,24,28]))),_=(0,s.lazy)(()=>a(()=>import(`./CPRuns-UlrIURqG.js`),__vite__mapDeps([42,1,6,2,7,8,9,10,11,5,12,13,14,15,16,43]))),v=(0,s.lazy)(()=>a(()=>import(`./CPCosts-Dx6Q71rN.js`),__vite__mapDeps([44,1,6,2,7,8,9,10,11,5,12,13,14,15,16,19,24,28]))),y=(0,s.lazy)(()=>a(()=>import(`./CPOrg-tDbHFphX.js`),__vite__mapDeps([45,1,6,2,7,8,9,10,11,5,12,13,14,15,16,46,28]))),b=(0,s.lazy)(()=>a(()=>import(`./CPFiles-BJ49tzai.js`),__vite__mapDeps([47,1,20,2,48,49,25,50,8,9,11,5])));function x(){return(0,c.jsx)(`div`,{className:`flex items-center justify-center h-full text-sm`,style:{color:`#c4b49a`},children:`Loading...`})}function S(){return(0,c.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,c.jsx)(`div`,{className:`h-full overflow-auto`,children:(0,c.jsx)(s.Suspense,{fallback:(0,c.jsx)(x,{}),children:(0,c.jsxs)(i,{children:[(0,c.jsx)(o,{index:!0,element:(0,c.jsx)(l,{})}),(0,c.jsx)(o,{path:`dashboard`,element:(0,c.jsx)(l,{})}),(0,c.jsx)(o,{path:`issues`,element:(0,c.jsx)(u,{})}),(0,c.jsx)(o,{path:`issues/:id`,element:(0,c.jsx)(d,{})}),(0,c.jsx)(o,{path:`agents`,element:(0,c.jsx)(f,{})}),(0,c.jsx)(o,{path:`agents/:id`,element:(0,c.jsx)(p,{})}),(0,c.jsx)(o,{path:`approvals`,element:(0,c.jsx)(m,{})}),(0,c.jsx)(o,{path:`activity`,element:(0,c.jsx)(h,{})}),(0,c.jsx)(o,{path:`goals`,element:(0,c.jsx)(g,{})}),(0,c.jsx)(o,{path:`runs`,element:(0,c.jsx)(_,{})}),(0,c.jsx)(o,{path:`costs`,element:(0,c.jsx)(v,{})}),(0,c.jsx)(o,{path:`org`,element:(0,c.jsx)(y,{})}),(0,c.jsx)(o,{path:`files`,element:(0,c.jsx)(b,{})}),(0,c.jsx)(o,{path:`*`,element:(0,c.jsx)(r,{to:`/command-post`,replace:!0})})]})})})})}export{S as CPLayout,S as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{i as r}from"./shared-DLz_Jtg3.js";import{t as i}from"./network-CM7y1ats.js";import{t as a}from"./trash-2-CwUv7ww1.js";import{St as o,a as s,rt as c}from"./index-WI-E4I3h.js";import{t as l}from"./PageHeader-CH85uoZG.js";import{t as u}from"./ConfirmDialog-6hcNjmAh.js";import{t as d}from"./EmptyState-D-Dg8B8r.js";import{t as f}from"./SkeletonLoader-9H7QWa9E.js";var p=e(t(),1),m=n();function h(e){let t=e.split(`/`);return t[t.length-1]}function g({node:e,depth:t,onDelete:n}){let i=e.role===`Company`;return(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`div`,{className:`flex items-start gap-3 py-2`,style:{paddingLeft:`${t*32+16}px`},children:[t>0&&(0,m.jsx)(`div`,{className:`flex items-center gap-0 -ml-5`,children:(0,m.jsx)(`div`,{className:`w-4 border-t border-border-light`})}),(0,m.jsxs)(`div`,{className:`border rounded-lg p-3 flex-1 max-w-sm transition-colors group ${i?`bg-accent/5 border-accent/20 hover:border-accent/40`:`bg-bg-secondary border-border hover:border-border-light`}`,children:[(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-sm font-semibold text-text`,children:e.name}),(0,m.jsx)(r,{status:e.status,size:`sm`})]}),i&&n&&(0,m.jsx)(`button`,{onClick:t=>{t.stopPropagation(),n(e.id,e.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 ${e.name}`,children:(0,m.jsx)(a,{size:14})})]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-text-muted`,children:[i&&(0,m.jsx)(`span`,{className:`text-accent text-[9px] font-medium uppercase tracking-wider`,children:`Company`}),!i&&(0,m.jsx)(`span`,{className:`capitalize`,children:e.role}),e.title&&(0,m.jsx)(`span`,{children:e.title}),e.model&&(0,m.jsx)(`span`,{children:h(e.model)})]}),i&&e.reports.length>0&&(0,m.jsxs)(`div`,{className:`text-[10px] text-text-muted mt-1`,children:[e.reports.length,` agent`,e.reports.length===1?``:`s`]})]})]}),e.reports.length>0&&(0,m.jsxs)(`div`,{className:`relative`,children:[(0,m.jsx)(`div`,{className:`absolute border-l border-border-light`,style:{left:`${(t+1)*32+16}px`,top:0,height:`100%`}}),e.reports.map(e=>(0,m.jsx)(g,{node:e,depth:t+1,onDelete:n},e.id))]})]})}function _(){let{toast:e}=s(),[t,n]=(0,p.useState)([]),[r,a]=(0,p.useState)(!0),[h,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(null),[b,x]=(0,p.useState)(null),S=(0,p.useCallback)(async()=>{try{let e=await o();n(e),_(null)}catch(e){_(e instanceof Error?e.message:`Failed to load org chart`)}a(!1)},[]);(0,p.useEffect)(()=>{S()},[S]);let C=(0,p.useCallback)(async()=>{if(!b)return;let{id:t}=b;x(null),y(t);try{await c(t),e(`success`,`Company deleted.`),await S()}catch(t){e(`error`,`Couldn't delete company — try again. ${t instanceof Error?t.message:`Unknown error`}`)}y(null)},[b,S,e]);return(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsx)(l,{title:`Organization Chart`,breadcrumbs:[{label:`Command Post`},{label:`Org Chart`}]}),r&&(0,m.jsx)(f,{variant:`row`,count:5}),h&&(0,m.jsxs)(`div`,{className:`rounded-xl border border-error/50 bg-bg-secondary p-6`,children:[(0,m.jsx)(`p`,{className:`text-sm font-medium text-error`,children:`Failed to load org chart`}),(0,m.jsx)(`p`,{className:`mt-2 text-sm text-text-secondary`,children:h}),(0,m.jsx)(`button`,{onClick:S,className:`mt-4 rounded-lg bg-bg-tertiary px-4 py-2 text-sm text-text hover:bg-border transition-colors`,children:`Retry`})]}),!r&&!h&&t.length===0&&(0,m.jsx)(d,{icon:(0,m.jsx)(i,{size:32}),title:`No org structure`,description:`Register agents or create companies to see the org chart.`}),!r&&!h&&t.length>0&&(0,m.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-secondary p-4 overflow-x-auto`,children:[t.map(e=>(0,m.jsx)(g,{node:e,depth:0,onDelete:(e,t)=>x({id:e,name:t})},e.id)),v&&(0,m.jsx)(`div`,{className:`text-xs text-text-muted text-center py-2 animate-pulse`,children:`Deleting...`})]}),(0,m.jsx)(u,{open:!!b,title:`Delete company "${b?.name||``}"?`,message:`This stops the heartbeat runner and archives all of the company's agents, goals, and issues. This can't be undone.`,confirmLabel:`Delete`,onConfirm:C,onCancel:()=>x(null)})]})}export{_ as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{i as r}from"./shared-DLz_Jtg3.js";import{t as i}from"./play-9WxZWVHA.js";import{Ct as a,Ot as o}from"./index-WI-E4I3h.js";import{t as s}from"./PageHeader-CH85uoZG.js";import{t as c}from"./EmptyState-D-Dg8B8r.js";import{t as l}from"./SkeletonLoader-9H7QWa9E.js";var u=e(t(),1),d=n();function f(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function p(e){return e?e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${(e/6e4).toFixed(1)}m`:`-`}function m(){let[e,t]=(0,u.useState)([]),[n,m]=(0,u.useState)([]),[h,g]=(0,u.useState)(!0),[_,v]=(0,u.useState)(null),[y,b]=(0,u.useState)(``),x=(0,u.useCallback)(async()=>{try{let[e,n]=await Promise.all([a(y||void 0,100),o()]);t(e),m(n),v(null)}catch(e){v(e instanceof Error?e.message:`Failed to load runs`)}g(!1)},[y]);return(0,u.useEffect)(()=>{g(!0),x()},[x]),(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsx)(s,{title:`Runs`,breadcrumbs:[{label:`Command Post`},{label:`Runs`}],actions:(0,d.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:y,onChange:e=>b(e.target.value),children:[(0,d.jsx)(`option`,{value:``,children:`All agents`}),n.map(e=>(0,d.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),h&&(0,d.jsx)(l,{variant:`row`,count:8}),_&&(0,d.jsx)(`div`,{className:`text-center py-8 text-error text-sm`,children:_}),!h&&!_&&e.length===0&&(0,d.jsx)(c,{icon:(0,d.jsx)(i,{size:32}),title:`No runs`,description:`Agent runs will appear here as they execute.`}),!h&&!_&&e.length>0&&(0,d.jsx)(`div`,{className:`bg-bg-secondary border border-border rounded-xl overflow-hidden`,children:(0,d.jsx)(`div`,{className:`overflow-x-auto`,children:(0,d.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{className:`border-b border-border text-left`,children:[(0,d.jsx)(`th`,{className:`px-4 py-2.5 text-text-muted font-medium`,children:`Agent`}),(0,d.jsx)(`th`,{className:`px-4 py-2.5 text-text-muted font-medium`,children:`Source`}),(0,d.jsx)(`th`,{className:`px-4 py-2.5 text-text-muted font-medium`,children:`Status`}),(0,d.jsx)(`th`,{className:`px-4 py-2.5 text-text-muted font-medium`,children:`Duration`}),(0,d.jsx)(`th`,{className:`px-4 py-2.5 text-text-muted font-medium`,children:`Tools`}),(0,d.jsx)(`th`,{className:`px-4 py-2.5 text-text-muted font-medium`,children:`Started`})]})}),(0,d.jsx)(`tbody`,{className:`divide-y divide-border`,children:e.map(e=>(0,d.jsxs)(`tr`,{className:`hover:bg-bg-tertiary/50 transition-colors`,children:[(0,d.jsx)(`td`,{className:`px-4 py-2.5 text-text font-medium`,children:e.agentId}),(0,d.jsx)(`td`,{className:`px-4 py-2.5 text-text-secondary capitalize`,children:e.source}),(0,d.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,d.jsx)(r,{status:e.status,size:`sm`})}),(0,d.jsx)(`td`,{className:`px-4 py-2.5 text-text-secondary font-mono`,children:p(e.durationMs)}),(0,d.jsx)(`td`,{className:`px-4 py-2.5 text-text-muted`,children:e.toolsUsed.length>0?(0,d.jsxs)(`span`,{title:e.toolsUsed.join(`, `),children:[e.toolsUsed.length,` tool`,e.toolsUsed.length===1?``:`s`]}):`-`}),(0,d.jsxs)(`td`,{className:`px-4 py-2.5 text-text-muted`,children:[f(e.startedAt),` ago`]})]},e.id))})]})})})]})}export{m as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./createLucideIcon-qnlrxww7.js";import{t as i}from"./clock-DSPgndSD.js";import{t as a}from"./lightbulb-BY7CpMte.js";import{t as o}from"./message-square-BpzrINHz.js";import{t as s}from"./refresh-cw-Disd5wRB.js";import{t as c}from"./send-D7iQD57b.js";import{A as l,En as u,G as d,M as f,Un as p,j as m,on as h,sn as g,xn as _}from"./index-WI-E4I3h.js";var v=r(`share-2`,[[`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`}]]),y=r(`type`,[[`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`}]]),b=e(t(),1),x=n();function S(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}var C={activity:`Activity`,spotlight:`Spotlight`,stats:`Stats`,tips:`Tips`,promo:`Promo`,usecase:`Use Case`,eli5:`ELI5`},w={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 T(){let[e,t]=(0,b.useState)(null),[n,r]=(0,b.useState)(!0),[T,E]=(0,b.useState)(null),[D,O]=(0,b.useState)(``),[k,A]=(0,b.useState)(!1),[j,M]=(0,b.useState)(null),[N,P]=(0,b.useState)(null),F=(0,b.useCallback)(async()=>{try{E(null);let e=await g();t(e)}catch(e){E(e instanceof Error?e.message:`Failed to load social state`)}finally{r(!1)}},[]),I=(0,b.useCallback)(async()=>{try{let e=(await h()).recentTopics;if(e.length===0){M(null);return}let t=e.slice(0,3).map(e=>`"${e.content.split(/\s+/).slice(0,6).join(` `)}..."`).join(`, `);M(`💡 Recent social posts: ${t}. Consider a follow-up on a related but fresh topic.`)}catch{M(null)}},[]);(0,b.useEffect)(()=>{F(),I()},[F,I]);let L=async()=>{if(!e)return;let n=!e.autopilot.enabled;try{await p(n),t(e=>e&&{...e,autopilot:{...e.autopilot,enabled:n}})}catch(e){E(e instanceof Error?e.message:`Toggle failed`)}},R=async()=>{if(D.trim()){A(!0);try{let e=await _(D.trim());e.success?(O(``),await F(),await I()):E(e.error||e.skipped||`Post failed`)}catch(e){E(e instanceof Error?e.message:`Post failed`)}finally{A(!1)}}},z=async e=>{P(e);try{await d(e),await F()}catch(e){E(e instanceof Error?e.message:`Approve failed`)}finally{P(null)}},B=async e=>{P(e);try{await u(e),await F()}catch(e){E(e instanceof Error?e.message:`Reject failed`)}finally{P(null)}};if(n)return(0,x.jsxs)(`div`,{className:`flex items-center justify-center py-20`,children:[(0,x.jsx)(`div`,{className:`w-5 h-5 border-2 border-indigo-500/30 border-t-indigo-500 rounded-full animate-spin`}),(0,x.jsx)(`span`,{className:`ml-3 text-sm text-text-muted`,children:`Loading social media…`})]});let V=e?.autopilot;return(0,x.jsxs)(`div`,{className:`space-y-5`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,x.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-pink-500/10 border border-pink-500/20`,children:(0,x.jsx)(v,{className:`h-4 w-4 text-pink-400`})}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:`Social Media`}),(0,x.jsx)(`p`,{className:`text-[11px] text-text-muted`,children:`Facebook autopilot, drafts, and post history`})]})]}),(0,x.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,x.jsxs)(`button`,{onClick:F,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:[(0,x.jsx)(s,{className:`h-3 w-3`}),` Refresh`]})})]}),T&&(0,x.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:[(0,x.jsx)(f,{className:`h-4 w-4 shrink-0`}),T]}),(0,x.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-3`,children:[(0,x.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsx)(`p`,{className:`text-[11px] text-text-muted`,children:`Autopilot`}),(0,x.jsx)(`button`,{onClick:L,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${V?.enabled?`bg-pink-500`:`bg-white/10`}`,children:(0,x.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${V?.enabled?`translate-x-4.5`:`translate-x-1`}`})})]}),(0,x.jsx)(`p`,{className:`mt-1 text-sm font-semibold ${V?.enabled?`text-pink-400`:`text-text-muted`}`,children:V?.enabled?`Enabled`:`Paused`})]}),(0,x.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3`,children:[(0,x.jsx)(`p`,{className:`text-[11px] text-text-muted`,children:`Posts Today`}),(0,x.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,x.jsx)(`p`,{className:`text-xl font-bold text-white`,children:V?.postsToday??0}),(0,x.jsxs)(`p`,{className:`text-[11px] text-text-muted`,children:[`/ `,V?.maxPostsPerDay??6]})]})]}),(0,x.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3`,children:[(0,x.jsx)(`p`,{className:`text-[11px] text-text-muted`,children:`Replies Today`}),(0,x.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,x.jsx)(`p`,{className:`text-xl font-bold text-white`,children:V?.repliesToday??0}),(0,x.jsx)(`p`,{className:`text-[11px] text-text-muted`,children:`/ 10`})]})]}),(0,x.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3`,children:[(0,x.jsx)(`p`,{className:`text-[11px] text-text-muted`,children:`Next Type`}),(0,x.jsx)(`p`,{className:`mt-1 text-sm font-semibold`,style:{color:w[V?.nextContentType||`activity`]||`#fff`},children:C[V?.nextContentType||`activity`]||V?.nextContentType})]})]}),(0,x.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-tertiary/30 p-4 space-y-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(y,{className:`h-4 w-4 text-pink-400`}),(0,x.jsx)(`span`,{className:`text-sm font-medium text-white`,children:`Compose Post`})]}),(0,x.jsx)(`textarea`,{value:D,onChange:e=>O(e.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`}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsxs)(`span`,{className:`text-[11px] ${D.length>280?`text-red-400`:`text-text-muted`}`,children:[D.length,` chars`]}),(0,x.jsxs)(`button`,{onClick:R,disabled:k||!D.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:[k?(0,x.jsx)(s,{className:`h-3 w-3 animate-spin`}):(0,x.jsx)(c,{className:`h-3 w-3`}),`Post Now`]})]}),j&&(0,x.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-amber-500/5 border border-amber-500/10 px-3 py-2`,children:[(0,x.jsx)(a,{className:`h-3.5 w-3.5 text-amber-400 mt-0.5 shrink-0`}),(0,x.jsx)(`p`,{className:`text-[11px] text-amber-200/70 leading-relaxed`,children:j})]})]}),(0,x.jsxs)(`div`,{className:`space-y-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(i,{className:`h-4 w-4 text-text-muted`}),(0,x.jsx)(`span`,{className:`text-sm font-medium text-white`,children:`Draft Queue`}),(0,x.jsxs)(`span`,{className:`text-[11px] text-text-muted ml-1`,children:[e?.queue.length??0,` pending`]})]}),e?.queue&&e.queue.length>0?(0,x.jsx)(`div`,{className:`space-y-2`,children:e.queue.map(e=>(0,x.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-border bg-bg-secondary/30 px-4 py-3`,children:[(0,x.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,x.jsx)(`p`,{className:`text-sm text-text break-words`,children:e.content}),(0,x.jsxs)(`p`,{className:`mt-1 text-[10px] text-text-muted`,children:[e.method,` · `,S(e.createdAt),` ago`]})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,x.jsxs)(`button`,{onClick:()=>z(e.id),disabled:N===e.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:[N===e.id?(0,x.jsx)(s,{className:`h-3 w-3 animate-spin`}):(0,x.jsx)(m,{className:`h-3 w-3`}),`Approve`]}),(0,x.jsxs)(`button`,{onClick:()=>B(e.id),disabled:N===e.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:[(0,x.jsx)(l,{className:`h-3 w-3`}),`Reject`]})]})]},e.id))}):(0,x.jsx)(`div`,{className:`rounded-lg border border-border bg-bg-secondary/30 px-4 py-6 text-center`,children:(0,x.jsx)(`p`,{className:`text-xs text-text-muted`,children:`No pending drafts in the queue.`})})]}),(0,x.jsxs)(`div`,{className:`space-y-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(o,{className:`h-4 w-4 text-text-muted`}),(0,x.jsx)(`span`,{className:`text-sm font-medium text-white`,children:`Recent Posts`}),(0,x.jsxs)(`span`,{className:`text-[11px] text-text-muted ml-1`,children:[e?.recentPosts.length??0,` tracked`]})]}),e?.recentPosts&&e.recentPosts.length>0?(0,x.jsx)(`div`,{className:`space-y-2`,children:e.recentPosts.map((e,t)=>(0,x.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-border bg-bg-secondary/30 px-4 py-3`,children:[(0,x.jsx)(`div`,{className:`mt-0.5 h-2 w-2 rounded-full shrink-0`,style:{backgroundColor:w[e.type]||`#64748b`}}),(0,x.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,x.jsx)(`span`,{className:`text-[10px] font-medium px-1.5 py-0.5 rounded`,style:{backgroundColor:(w[e.type]||`#64748b`)+`20`,color:w[e.type]||`#94a3b8`},children:C[e.type]||e.type}),(0,x.jsxs)(`span`,{className:`text-[10px] text-text-muted`,children:[S(e.date),` ago`]})]}),(0,x.jsx)(`p`,{className:`text-sm text-text-secondary break-words`,children:e.content||`(content not stored)`}),e.postId&&(0,x.jsxs)(`p`,{className:`mt-1 text-[10px] text-text-muted font-mono`,children:[`ID: `,e.postId]})]})]},t))}):(0,x.jsx)(`div`,{className:`rounded-lg border border-border bg-bg-secondary/30 px-4 py-6 text-center`,children:(0,x.jsx)(`p`,{className:`text-xs text-text-muted`,children:`No posts in history yet.`})})]})]})}export{T as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import"./shared-DLz_Jtg3.js";import{t as r}from"./circle-stop-yZuG9ZAE.js";import{t as i}from"./mic-De6oZFaV.js";import{t as a}from"./send-D7iQD57b.js";import{t as o}from"./volume-2-BVlfVl2U.js";import{H as s,a as c}from"./index-WI-E4I3h.js";import{t as l}from"./PageHeader-CH85uoZG.js";var u=e(t(),1),d=n();async function f(e,t){let n=await s(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(`HTTP ${n.status}`);return n.json()}function p(){let{toast:e}=c(),[t,n]=(0,u.useState)(``),[s,p]=(0,u.useState)([]),[m,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)(!0),v=(0,u.useRef)(null),y=(0,u.useRef)(null);(0,u.useEffect)(()=>{let e=window.SpeechRecognition||window.webkitSpeechRecognition;if(e){let t=new e;t.lang=`en-US`,t.continuous=!1,t.interimResults=!1,t.onresult=e=>{let t=e.results[0]?.[0]?.transcript||``;n(t),h(!1)},t.onerror=()=>h(!1),t.onend=()=>h(!1),v.current=t}},[]);let b=async()=>{let e=t.trim();if(!e)return;let r={id:`e-${Date.now()}`,question:e,loading:!0,at:new Date().toISOString()};p(e=>[r,...e].slice(0,20)),n(``);try{let t=await f(`/api/voice/ask`,{question:e,voice:`default`,speak:g});p(e=>e.map(e=>e.id===r.id?{...e,loading:!1,answer:t.answer,activeDrivers:t.activeDrivers,ttsUrl:t.ttsUrl}:e)),t.ttsUrl&&g&&y.current&&(y.current.src=t.ttsUrl,y.current.play().catch(()=>{}))}catch(e){p(t=>t.map(t=>t.id===r.id?{...t,loading:!1,error:e.message}:t))}},x=()=>{let t=v.current;if(!t){e(`warning`,`Speech recognition is not supported in this browser. Use Chrome.`);return}try{t.start(),h(!0)}catch{}},S=()=>{let e=v.current;e&&e.stop(),h(!1)},C=!!(window.SpeechRecognition||window.webkitSpeechRecognition);return(0,d.jsxs)(`div`,{className:`space-y-4 flex flex-col h-[calc(100vh-180px)]`,children:[(0,d.jsx)(l,{title:`Voice Ask`,breadcrumbs:[{label:`Command Post`},{label:`Voice`}]}),(0,d.jsx)(`audio`,{ref:y}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2 bg-bg-secondary border border-border rounded-xl px-3 py-2`,children:[C&&(m?(0,d.jsx)(`button`,{onClick:S,className:`p-2 rounded bg-error/20 text-error hover:bg-error/30`,title:`Stop listening`,children:(0,d.jsx)(r,{size:18})}):(0,d.jsx)(`button`,{onClick:x,className:`p-2 rounded hover:bg-bg-tertiary text-text-muted`,title:`Voice input (Chrome only)`,children:(0,d.jsx)(i,{size:18})})),(0,d.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),b())},placeholder:m?`Listening…`:`Ask TITAN — "What are you working on?" or give it instructions`,className:`flex-1 bg-transparent text-sm outline-none`}),(0,d.jsx)(`button`,{onClick:()=>_(e=>!e),className:`p-2 rounded hover:bg-bg-tertiary ${g?`text-accent`:`text-text-muted`}`,title:`TTS ${g?`ON`:`OFF`}`,children:(0,d.jsx)(o,{size:16})}),(0,d.jsxs)(`button`,{onClick:b,disabled:!t.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:[(0,d.jsx)(a,{size:14}),` Ask`]})]}),(0,d.jsxs)(`div`,{className:`flex-1 overflow-auto space-y-3`,children:[s.length===0&&(0,d.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.`}),s.map(e=>(0,d.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,d.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,d.jsx)(`span`,{className:`text-xs text-text-muted mt-1 flex-shrink-0 w-10`,children:`You`}),(0,d.jsx)(`div`,{className:`text-sm text-text`,children:e.question})]}),(0,d.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,d.jsx)(`span`,{className:`text-xs text-accent mt-1 flex-shrink-0 w-10`,children:`TITAN`}),(0,d.jsxs)(`div`,{className:`text-sm text-text-secondary flex-1`,children:[e.loading&&(0,d.jsx)(`span`,{className:`text-text-muted`,children:`thinking…`}),e.error&&(0,d.jsxs)(`span`,{className:`text-error`,children:[`error: `,e.error]}),e.answer&&(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(`div`,{className:`whitespace-pre-wrap`,children:e.answer}),(0,d.jsxs)(`div`,{className:`text-[11px] text-text-muted flex items-center gap-2`,children:[(0,d.jsxs)(`span`,{children:[`drivers: `,e.activeDrivers??`?`]}),e.ttsUrl&&(0,d.jsxs)(`button`,{onClick:()=>{y.current&&(y.current.src=e.ttsUrl,y.current.play().catch(()=>{}))},className:`text-accent hover:underline flex items-center gap-0.5`,children:[(0,d.jsx)(o,{size:10}),` play`]})]})]})]})]})]},e.id))]})]})}export{p as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./chevron-right-A_pvnRh_.js";import{t as i}from"./circle-check-big-C-JUM7wb.js";import{t as a}from"./refresh-cw-Disd5wRB.js";import{t as o}from"./save-DP7oNar2.js";import{D as s,E as c,M as l,P as u,Tt as d,qn as f,wt as p}from"./index-WI-E4I3h.js";import{t as m}from"./PageHeader-CH85uoZG.js";var h=e(t(),1),g=n(),_=[{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`}]}],v=[{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 y({def:e,config:t,status:n,onSave:i,saving:a}){let[l,d]=(0,h.useState)(!1),[f,p]=(0,h.useState)(t.enabled),[m,_]=(0,h.useState)(``),[y,b]=(0,h.useState)(``),[x,S]=(0,h.useState)(t.dmPolicy),[C,w]=(0,h.useState)(!1),[T,E]=(0,h.useState)(!1),[D,O]=(0,h.useState)(!1),k=a===e.id,A=n?.status===`connected`,j=!!t.token,M=!!t.apiKey,N=()=>{p(!f),O(!0)},P=async()=>{let t={enabled:f,dmPolicy:x};m&&(t.token=m),y&&(t.apiKey=y),await i(e.id,t),_(``),b(``),O(!1)},F=e.fields.find(e=>e.key===`token`),I=e.fields.find(e=>e.key===`apiKey`);return(0,g.jsxs)(`div`,{className:`rounded-xl border border-bg-tertiary bg-bg-secondary`,children:[(0,g.jsxs)(`button`,{onClick:()=>d(!l),className:`flex w-full items-center justify-between px-4 py-3 text-left`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[l?(0,g.jsx)(u,{className:`h-4 w-4 text-text-muted`}):(0,g.jsx)(r,{className:`h-4 w-4 text-text-muted`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`text-sm font-medium text-text`,children:e.label}),(0,g.jsx)(`span`,{className:`ml-2 text-xs text-text-muted`,children:e.description})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A&&(0,g.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:[(0,g.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-success`}),`Connected`]}),(0,g.jsx)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${t.enabled?`bg-accent/10 text-accent-hover`:`bg-border-light/20 text-text-muted`}`,children:t.enabled?`Enabled`:`Disabled`})]})]}),l&&(0,g.jsxs)(`div`,{className:`border-t border-bg-tertiary px-4 py-4 space-y-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`label`,{className:`text-sm text-text-secondary`,children:`Enabled`}),(0,g.jsx)(`button`,{onClick:N,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${f?`bg-accent`:`bg-border`}`,children:(0,g.jsx)(`span`,{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${f?`translate-x-6`:`translate-x-1`}`})})]}),F&&(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`label`,{className:`mb-1 flex items-center gap-2 text-xs text-text-muted`,children:[F.label,j&&(0,g.jsx)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 text-[10px] text-success`,children:`set`})]}),(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(`input`,{id:`channel-${e.id}-token`,name:`channel-${e.id}-token`,type:C?`text`:`password`,value:m,onChange:e=>{_(e.target.value),O(!0)},placeholder:j?`(configured — enter new value to change)`:F.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`}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>w(!C),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary`,children:C?(0,g.jsx)(s,{className:`h-4 w-4`}):(0,g.jsx)(c,{className:`h-4 w-4`})})]})]}),I&&(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`label`,{className:`mb-1 flex items-center gap-2 text-xs text-text-muted`,children:[I.label,M&&(0,g.jsx)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 text-[10px] text-success`,children:`set`})]}),(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(`input`,{id:`channel-${e.id}-api-key`,name:`channel-${e.id}-api-key`,type:T?`text`:`password`,value:y,onChange:e=>{b(e.target.value),O(!0)},placeholder:M?`(configured — enter new value to change)`:I.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`}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>E(!T),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary`,children:T?(0,g.jsx)(s,{className:`h-4 w-4`}):(0,g.jsx)(c,{className:`h-4 w-4`})})]})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`mb-1 block text-xs text-text-muted`,children:`DM Policy`}),(0,g.jsx)(`div`,{className:`flex gap-2`,children:v.map(e=>(0,g.jsx)(`button`,{onClick:()=>{S(e.value),O(!0)},className:`rounded-lg border px-3 py-1.5 text-xs transition-colors ${x===e.value?`border-accent bg-accent/10 text-accent-hover`:`border-border text-text-muted hover:border-border-light`}`,title:e.desc,children:e.label},e.value))})]}),(0,g.jsx)(`div`,{className:`flex justify-end`,children:(0,g.jsxs)(`button`,{onClick:P,disabled:k||!D,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:[(0,g.jsx)(o,{className:`h-3.5 w-3.5`}),k?`Saving...`:`Save`]})})]})]})}function b(){let[e,t]=(0,h.useState)([]),[n,r]=(0,h.useState)({}),[o,s]=(0,h.useState)(!0),[c,u]=(0,h.useState)(null),[v,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(null),C=async()=>{try{let[e,n]=await Promise.all([d(),p()]);t(e),r(n)}catch(e){u(e instanceof Error?e.message:`Failed to fetch channels`)}finally{s(!1)}};(0,h.useEffect)(()=>{C()},[]);let w=(e,t)=>{S({type:e,message:t}),setTimeout(()=>S(null),3e3)},T=async(e,n)=>{b(e);try{await f(e,n);let[i,a]=await Promise.all([d(),p()]);t(i),r(a);let o=_.find(t=>t.id===e)?.label??e;w(`success`,`${o} settings saved (restart gateway to apply)`)}catch(e){w(`error`,e instanceof Error?e.message:`Failed to save`)}finally{b(null)}};if(o)return(0,g.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:5}).map((e,t)=>(0,g.jsx)(`div`,{className:`h-14 animate-pulse rounded-xl border border-border bg-bg-secondary`},t))});if(c)return(0,g.jsx)(`div`,{className:`rounded-xl border border-error/50 bg-bg-secondary p-6 text-center text-error`,children:c});let E={enabled:!1,allowFrom:[],dmPolicy:`pairing`};return(0,g.jsxs)(`div`,{className:`space-y-6`,children:[(0,g.jsx)(m,{title:`Channels`,subtitle:`Configure messaging channels — ${e.filter(e=>e.status===`connected`).length} connected`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Tools`},{label:`Channels`}],actions:(0,g.jsxs)(`button`,{onClick:()=>{s(!0),C()},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:[(0,g.jsx)(a,{className:`h-3.5 w-3.5`}),`Refresh`]})}),x&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${x.type===`success`?`border-success/50 text-success`:`border-error/50 text-error`}`,children:[x.type===`success`?(0,g.jsx)(i,{className:`h-4 w-4`}):(0,g.jsx)(l,{className:`h-4 w-4`}),x.message]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wider text-text-muted mb-3`,children:`Built-in`}),(0,g.jsxs)(`div`,{className:`rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3 flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(`span`,{className:`text-sm font-medium text-text`,children:`WebChat`}),(0,g.jsx)(`span`,{className:`text-xs text-text-muted`,children:`HTTP/WebSocket — always enabled`})]}),(0,g.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:[(0,g.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-success`}),`Connected`]})]})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wider text-text-muted mb-3`,children:`Messaging Channels`}),(0,g.jsx)(`div`,{className:`space-y-2`,children:_.map(t=>(0,g.jsx)(y,{def:t,config:n[t.id]??E,status:e.find(e=>e.name===t.id||e.type===t.id),onSave:T,saving:v},t.id))})]}),(0,g.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{b as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./refresh-cw-Disd5wRB.js";import{t as i}from"./save-DP7oNar2.js";import{t as a}from"./trash-2-CwUv7ww1.js";import{Et as o,a as s,tt as c}from"./index-WI-E4I3h.js";import{t as l}from"./PageHeader-CH85uoZG.js";import{t as u}from"./ConfirmDialog-6hcNjmAh.js";var d=e(t(),1),f=n();function p(){let{toast:e}=s(),[t,n]=(0,d.useState)([]),[p,m]=(0,d.useState)(!0),[h,g]=(0,d.useState)(null),_=(0,d.useCallback)(async()=>{m(!0);try{let e=await o();n(e.checkpoints||[])}catch(t){e(`error`,`Couldn't load checkpoints — try again. (${t.message})`)}m(!1)},[e]);(0,d.useEffect)(()=>{_()},[_]);let v=async t=>{try{await c(t),await _(),e(`success`,`Checkpoint deleted.`)}catch(t){e(`error`,`Couldn't delete checkpoint — try again. (${t.message})`)}};return(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(l,{title:`Checkpoints`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`System`},{label:`Checkpoints`}]}),(0,f.jsx)(`div`,{className:`flex gap-2`,children:(0,f.jsxs)(`button`,{onClick:_,disabled:p,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:[(0,f.jsx)(r,{className:`w-4 h-4 ${p?`animate-spin`:``}`}),` Refresh`]})}),(0,f.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(i,{className:`w-4 h-4 text-[#6366f1]`}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`text-sm text-[#e4e4e7]`,children:[e.sessionId.slice(0,16),`...`]}),(0,f.jsx)(`div`,{className:`text-xs text-[#52525b]`,children:new Date(e.createdAt).toLocaleString()})]})]}),(0,f.jsx)(`button`,{onClick:()=>g(e.sessionId),className:`p-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] hover:bg-[#3f3f46] hover:text-red-400`,children:(0,f.jsx)(a,{className:`w-3.5 h-3.5`})})]},e.sessionId))}),(0,f.jsx)(u,{open:h!==null,title:`Delete this checkpoint?`,message:`This can't be undone. The saved session state will be permanently removed.`,confirmLabel:`Delete`,onConfirm:async()=>{h&&await v(h),g(null)},onCancel:()=>g(null)})]})}export{p as default};