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
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkillsPanel-CHwX2kDR.js","assets/jsx-runtime-B15e6lOy.js","assets/createLucideIcon-qnlrxww7.js","assets/download-CJZWQNfV.js","assets/search-aNVcX-nv.js","assets/trash-2-CwUv7ww1.js","assets/index-WI-E4I3h.js","assets/index-Cz8190xO.css","assets/PageHeader-CH85uoZG.js","assets/chevron-right-A_pvnRh_.js","assets/ConfirmDialog-6hcNjmAh.js","assets/clsx-CjueKrWZ.js","assets/McpPanel-uMYEsPI4.js","assets/plug-Dm25Wbrc.js","assets/plus-CHryCIkk.js","assets/test-tube-BimtS92_.js","assets/refresh-cw-Disd5wRB.js","assets/server-DFfeYjoM.js","assets/IntegrationsPanel-BmL70fOw.js","assets/circle-check-big-C-JUM7wb.js","assets/save-DP7oNar2.js","assets/ChannelsPanel-DLbxg1zO.js","assets/MeshPanel-D4-g2tlu.js","assets/shield-check-Cd50jCAn.js","assets/DataTable-KVqtDzvP.js","assets/EvalHarnessPanel-BKzRiiQw.js","assets/layers-BPu5SRjI.js","assets/play-9WxZWVHA.js","assets/trending-up-Ba9TwEow.js"])))=>i.map(i=>d[i]);
2
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{sr as r}from"./index-WI-E4I3h.js";import{t as i}from"./clsx-CjueKrWZ.js";var a=e(t(),1),o=n(),s=(0,a.lazy)(()=>r(()=>import(`./SkillsPanel-CHwX2kDR.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),c=(0,a.lazy)(()=>r(()=>import(`./McpPanel-uMYEsPI4.js`),__vite__mapDeps([12,1,13,2,14,15,16,17,5,6,7,8,9,10,11]))),l=(0,a.lazy)(()=>r(()=>import(`./IntegrationsPanel-BmL70fOw.js`),__vite__mapDeps([18,1,9,2,19,13,20,6,7,8]))),u=(0,a.lazy)(()=>r(()=>import(`./ChannelsPanel-DLbxg1zO.js`),__vite__mapDeps([21,1,9,2,19,16,20,6,7,8]))),d=(0,a.lazy)(()=>r(()=>import(`./MeshPanel-D4-g2tlu.js`),__vite__mapDeps([22,1,2,16,23,6,7,8,9,24]))),f=(0,a.lazy)(()=>r(()=>import(`./EvalHarnessPanel-BKzRiiQw.js`),__vite__mapDeps([25,1,9,2,19,26,27,16,28,6,7]))),p=[{id:`skills`,label:`Skills`},{id:`mcp`,label:`MCP Servers`},{id:`integrations`,label:`Integrations`},{id:`channels`,label:`Channels`},{id:`mesh`,label:`Mesh Network`},{id:`evals`,label:`Eval Harness`}];function m(){let[e,t]=(0,a.useState)(`skills`);return(0,o.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,o.jsxs)(`div`,{className:`shrink-0 px-5 pt-4 pb-0`,children:[(0,o.jsx)(`h1`,{className:`text-sm font-semibold text-text mb-3`,children:`Tools & Connections`}),(0,o.jsx)(`div`,{className:`flex items-center gap-0.5 border-b border-border/50`,children:p.map(n=>(0,o.jsxs)(`button`,{onClick:()=>t(n.id),className:i(`px-3 py-2 text-xs font-medium transition-colors relative`,e===n.id?`text-accent`:`text-text-muted hover:text-text-secondary`),children:[n.label,e===n.id&&(0,o.jsx)(`div`,{className:`absolute bottom-0 left-1 right-1 h-[2px] bg-accent rounded-full`})]},n.id))})]}),(0,o.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto p-5`,children:(0,o.jsxs)(a.Suspense,{fallback:(0,o.jsx)(`div`,{className:`skeleton-shimmer h-40 rounded-lg`}),children:[e===`skills`&&(0,o.jsx)(s,{}),e===`mcp`&&(0,o.jsx)(c,{}),e===`integrations`&&(0,o.jsx)(l,{}),e===`channels`&&(0,o.jsx)(u,{}),e===`mesh`&&(0,o.jsx)(d,{}),e===`evals`&&(0,o.jsx)(f,{})]})})]})}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"./arrow-left-4c2FnES1.js";import{t as i}from"./chart-column-hhZMdCgB.js";import{t as a}from"./clock-DSPgndSD.js";import{t as o}from"./git-branch-CQ2yNSzU.js";import{t as s}from"./search-aNVcX-nv.js";import{t as c}from"./trending-up-Ba9TwEow.js";import{A as l,I as u,a as d,c as f,f as p,fn as m,j as h,pn as g}from"./index-WI-E4I3h.js";var _=e(t(),1),v=n();function y(e){let t=e.toLowerCase();return t.includes(`rate limit`)||t.includes(`too many requests`)||t.includes(`429`)?{category:`Rate Limit`,severity:`rate_limit`,icon:`⏱️`}:t.includes(`timeout`)||t.includes(`etimedout`)||t.includes(`econnreset`)?{category:`Timeout`,severity:`timeout`,icon:`⏳`}:t.includes(`auth`)||t.includes(`unauthorized`)||t.includes(`403`)||t.includes(`401`)?{category:`Auth / Permission`,severity:`permanent`,icon:`🔒`}:t.includes(`not found`)||t.includes(`404`)||t.includes(`enoent`)?{category:`Not Found`,severity:`permanent`,icon:`❓`}:t.includes(`context`)||t.includes(`too long`)||t.includes(`max tokens`)?{category:`Context Overflow`,severity:`permanent`,icon:`📄`}:t.includes(`quota`)||t.includes(`insufficient`)||t.includes(`exceeded`)?{category:`Quota Exceeded`,severity:`permanent`,icon:`💰`}:t.includes(`network`)||t.includes(`econnrefused`)||t.includes(`dns`)?{category:`Network`,severity:`transient`,icon:`🌐`}:t.includes(`empty`)||t.includes(`no response`)?{category:`Empty Response`,severity:`transient`,icon:`👻`}:t.includes(`format`)||t.includes(`json`)||t.includes(`parse`)?{category:`Format Error`,severity:`transient`,icon:`🔧`}:{category:`Unknown`,severity:`unknown`,icon:`❓`}}var b={transient:`text-warning bg-warning/10 border-warning/20`,permanent:`text-error bg-error/10 border-error/20`,timeout:`text-cyan bg-cyan/10 border-cyan/20`,rate_limit:`text-orange-400 bg-orange-400/10 border-orange-400/20`,unknown:`text-text-muted bg-bg-tertiary border-border`};function x({traces:e,stats:t}){let n=(0,_.useMemo)(()=>e.filter(e=>e.status===`failed`&&e.error),[e]),r=(0,_.useMemo)(()=>{let e=new Map;for(let t of n){if(!t.error)continue;let{category:n,severity:r,icon:i}=y(t.error),a=e.get(n);a?(a.count++,a.examples.length<3&&a.examples.push(t.error)):e.set(n,{count:1,severity:r,icon:i,examples:[t.error]})}return Array.from(e.entries()).sort((e,t)=>t[1].count-e[1].count)},[n]),i=(0,_.useMemo)(()=>{let t=new Map;for(let n of e)for(let e of n.toolCalls){let n=t.get(e.tool)||{success:0,fail:0};e.success?n.success++:n.fail++,t.set(e.tool,n)}return Array.from(t.entries()).map(([e,{success:t,fail:n}])=>{let r=t+n;return{tool:e,success:t,fail:n,total:r,rate:r>0?Math.round(n/r*100):0}}).sort((e,t)=>t.fail-e.fail)},[e]),a=e.length,o=a>0?Math.round(n.length/a*100):0;return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3`,children:[{icon:u,label:`Total`,value:a,color:`text-accent`},{icon:l,label:`Failed`,value:n.length,color:`text-error`},{icon:c,label:`Fail Rate`,value:`${o}%`,color:o>20?`text-error`:o>5?`text-warning`:`text-success`},{icon:p,label:`Categories`,value:r.length,color:`text-orange-400`}].map(e=>(0,v.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,v.jsx)(e.icon,{size:14,className:e.color}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-muted uppercase tracking-wider`,children:e.label})]}),(0,v.jsx)(`div`,{className:`text-2xl font-bold text-text`,children:e.value})]},e.label))}),r.length>0&&(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-2.5 border-b border-border`,children:[(0,v.jsx)(p,{size:14,className:`text-error`}),(0,v.jsx)(`span`,{className:`text-xs font-medium text-text-secondary`,children:`Hermes Error Taxonomy`})]}),(0,v.jsx)(`div`,{className:`divide-y divide-border`,children:r.map(([e,t])=>(0,v.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`span`,{className:`text-sm`,children:t.icon}),(0,v.jsx)(`span`,{className:`text-[12px] font-medium text-text-secondary`,children:e}),(0,v.jsx)(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded border capitalize ${b[t.severity]}`,children:t.severity})]}),(0,v.jsxs)(`span`,{className:`text-[11px] text-text-muted`,children:[t.count,` occurrence`,t.count===1?``:`s`]})]}),t.examples.length>0&&(0,v.jsx)(`div`,{className:`space-y-0.5 mt-1.5`,children:t.examples.map((e,t)=>(0,v.jsx)(`div`,{className:`text-[10px] text-text-muted font-mono truncate pl-5`,children:e},t))})]},e))})]}),i.length>0&&(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-2.5 border-b border-border`,children:[(0,v.jsx)(f,{size:14,className:`text-accent`}),(0,v.jsx)(`span`,{className:`text-xs font-medium text-text-secondary`,children:`Tool Failure Rates`})]}),(0,v.jsx)(`div`,{className:`divide-y divide-border`,children:i.slice(0,15).map(e=>{let t=e.total>0?Math.round(e.fail/e.total*100):0;return(0,v.jsxs)(`div`,{className:`px-4 py-2 flex items-center gap-3`,children:[(0,v.jsx)(`span`,{className:`text-[11px] text-text-secondary font-mono w-32 truncate`,children:e.tool}),(0,v.jsx)(`div`,{className:`flex-1 h-1.5 bg-bg rounded-full overflow-hidden`,children:(0,v.jsx)(`div`,{className:`h-full rounded-full ${t>50?`bg-error`:t>10?`bg-warning`:`bg-success`}`,style:{width:`${t}%`}})}),(0,v.jsxs)(`div`,{className:`text-[10px] text-text-muted w-20 text-right tabular-nums`,children:[e.fail,`/`,e.total,` (`,t,`%)`]})]},e.tool)})})]}),r.length===0&&i.every(e=>e.fail===0)&&(0,v.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-text-muted text-xs`,children:[(0,v.jsx)(h,{size:24,className:`mb-2 text-success opacity-60`}),`No errors detected in recent traces`]})]})}function S(){let{toast:e}=d(),[t,n]=(0,_.useState)([]),[r,c]=(0,_.useState)(null),[f,p]=(0,_.useState)(!0),[m,y]=(0,_.useState)(null),[b,S]=(0,_.useState)(``),[w,T]=(0,_.useState)(`all`),E=async()=>{try{let e=await g(100);n(e.traces||[]),c(e.stats||null)}catch(t){p(n=>(n&&e(`error`,`Couldn't load traces — try again. ${t.message}`),n))}p(!1)};(0,_.useEffect)(()=>{E();let e=setInterval(E,1e4);return()=>clearInterval(e)},[]);let D=(0,_.useMemo)(()=>{let e=t;if(w!==`all`&&(e=e.filter(e=>e.status===w)),b.trim()){let t=b.toLowerCase();e=e.filter(e=>e.message.toLowerCase().includes(t)||e.sessionId.toLowerCase().includes(t)||e.traceId.toLowerCase().includes(t)||e.toolCalls.some(e=>e.tool.toLowerCase().includes(t)))}return e},[t,w,b]),O=t.filter(e=>e.status===`failed`),k=r?.avgDurationMs??0,A=r?.topTools??[];return f?(0,v.jsxs)(`div`,{className:`space-y-3`,children:[(0,v.jsx)(`div`,{className:`grid grid-cols-4 gap-3`,children:[1,2,3,4].map(e=>(0,v.jsx)(`div`,{className:`h-20 rounded-xl bg-bg-secondary animate-pulse`},e))}),(0,v.jsx)(`div`,{className:`space-y-2`,children:[1,2,3,4,5].map(e=>(0,v.jsx)(`div`,{className:`h-14 rounded-lg bg-bg-secondary animate-pulse`},e))})]}):m?(0,v.jsx)(C,{trace:m,onBack:()=>y(null)}):(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3`,children:[{icon:o,label:`Traces`,value:r?.totalTraces??0,sub:`in memory`,color:`text-accent`},{icon:u,label:`Running`,value:r?.running??0,sub:`active now`,color:`text-cyan`},{icon:l,label:`Failed`,value:O.length,sub:`${t.length>0?Math.round(O.length/t.length*100):0}% rate`,color:`text-error`},{icon:a,label:`Avg Duration`,value:`${k}ms`,sub:`${r?.avgRounds??0} avg rounds`,color:`text-warning`}].map(e=>(0,v.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,v.jsx)(e.icon,{size:14,className:e.color}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-muted uppercase tracking-wider`,children:e.label})]}),(0,v.jsx)(`div`,{className:`text-2xl font-bold text-text`,children:e.value}),e.sub&&(0,v.jsx)(`div`,{className:`text-[11px] text-text-muted mt-1`,children:e.sub})]},e.label))}),(0,v.jsx)(x,{traces:t,stats:r}),A.length>0&&(0,v.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,v.jsx)(i,{size:14,className:`text-accent`}),(0,v.jsx)(`span`,{className:`text-xs font-medium text-text-secondary`,children:`Top Tools`})]}),(0,v.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:A.slice(0,8).map(e=>(0,v.jsxs)(`span`,{className:`text-[11px] px-2 py-1 rounded-full bg-bg border border-border text-text-secondary`,children:[e.tool,` `,(0,v.jsxs)(`span`,{className:`text-text-muted`,children:[`(`,e.count,`)`]})]},e.tool))})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,v.jsxs)(`div`,{className:`relative flex-1 min-w-[200px]`,children:[(0,v.jsx)(s,{size:14,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted`}),(0,v.jsx)(`input`,{value:b,onChange:e=>S(e.target.value),placeholder:`Search traces, sessions, tools...`,className:`w-full bg-bg-secondary border border-border rounded-lg pl-8 pr-3 py-2 text-[12px] text-text placeholder-text-muted focus:outline-none focus:border-accent`})]}),(0,v.jsx)(`div`,{className:`flex gap-1`,children:[`all`,`running`,`completed`,`failed`].map(e=>(0,v.jsx)(`button`,{onClick:()=>T(e),className:`px-2.5 py-1.5 text-[10px] rounded-lg capitalize transition-colors ${w===e?`bg-accent text-white`:`bg-bg-secondary text-text-muted hover:text-text`}`,children:e},e))})]}),(0,v.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-2xl overflow-hidden`,children:[(0,v.jsx)(`div`,{className:`flex items-center justify-between px-4 py-2.5 border-b border-border`,children:(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(o,{size:14,className:`text-accent`}),(0,v.jsx)(`span`,{className:`text-[13px] font-medium text-text-secondary`,children:`Execution Traces`}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-muted`,children:D.length})]})}),(0,v.jsx)(`div`,{className:`divide-y divide-border max-h-[500px] overflow-y-auto`,children:D.length===0?(0,v.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-text-muted text-xs`,children:[(0,v.jsx)(o,{size:24,className:`mb-2 opacity-40`}),t.length===0?`No traces captured yet`:`No traces match your filters`]}):D.map(e=>(0,v.jsxs)(`button`,{onClick:()=>y(e),className:`w-full text-left px-4 py-3 hover:bg-bg-secondary/30 transition-colors`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.status===`running`?(0,v.jsx)(u,{size:14,className:`text-cyan animate-pulse shrink-0`}):e.status===`completed`?(0,v.jsx)(h,{size:14,className:`text-success shrink-0`}):(0,v.jsx)(l,{size:14,className:`text-error shrink-0`}),(0,v.jsx)(`p`,{className:`text-[12px] text-text-secondary truncate flex-1`,children:e.message}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-muted shrink-0 tabular-nums`,children:e.totalMs?`${e.totalMs}ms`:`...`})]}),(0,v.jsxs)(`div`,{className:`flex gap-3 mt-1 text-[10px] text-text-muted ml-6`,children:[(0,v.jsxs)(`span`,{children:[e.toolCalls.length,` tools`]}),(0,v.jsxs)(`span`,{children:[e.rounds,` rounds`]}),e.model&&(0,v.jsx)(`span`,{children:e.model.split(`/`).pop()}),e.error&&(0,v.jsx)(`span`,{className:`text-error truncate max-w-[200px]`,children:e.error})]})]},e.traceId))})]})]})}function C({trace:e,onBack:t}){let[n,i]=(0,_.useState)(null),[o,s]=(0,_.useState)(!0);(0,_.useEffect)(()=>{let t=!0;return m(e.traceId).then(e=>{t&&i(e)}).catch(()=>{t&&i(e)}).finally(()=>{t&&s(!1)}),()=>{t=!1}},[e.traceId,e]);let c=n||e;return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsxs)(`button`,{onClick:t,className:`flex items-center gap-1 text-[11px] text-text-muted hover:text-text transition-colors`,children:[(0,v.jsx)(r,{size:12}),` Back to traces`]}),(0,v.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[c.status===`running`?(0,v.jsx)(u,{size:16,className:`text-cyan animate-pulse`}):c.status===`completed`?(0,v.jsx)(h,{size:16,className:`text-success`}):(0,v.jsx)(l,{size:16,className:`text-error`}),(0,v.jsx)(`span`,{className:`text-xs font-semibold capitalize ${c.status===`completed`?`text-success`:c.status===`failed`?`text-error`:`text-cyan`}`,children:c.status})]}),(0,v.jsx)(`p`,{className:`text-sm text-text mb-2`,children:c.message}),(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-[11px] text-text-muted`,children:[(0,v.jsxs)(`span`,{children:[`ID: `,(0,v.jsx)(`span`,{className:`font-mono text-text-secondary`,children:c.traceId.slice(0,12)})]}),(0,v.jsxs)(`span`,{children:[`Session: `,(0,v.jsx)(`span`,{className:`font-mono text-text-secondary`,children:c.sessionId.slice(0,12)})]}),c.totalMs&&(0,v.jsxs)(`span`,{children:[c.totalMs,`ms`]}),(0,v.jsxs)(`span`,{children:[c.rounds,` rounds`]}),c.model&&(0,v.jsx)(`span`,{children:c.model}),c.tokens&&(0,v.jsxs)(`span`,{children:[c.tokens.prompt,` prompt / `,c.tokens.completion,` completion`]})]})]}),c.spans.length>0&&(0,v.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,v.jsx)(a,{size:14,className:`text-accent`}),(0,v.jsx)(`span`,{className:`text-xs font-medium text-text-secondary`,children:`Timeline`})]}),(0,v.jsx)(`div`,{className:`space-y-2`,children:c.spans.map((e,t)=>(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,v.jsx)(`div`,{className:`w-16 text-[10px] text-text-muted text-right tabular-nums`,children:e.durationMs===void 0?`...`:`${e.durationMs}ms`}),(0,v.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full bg-accent shrink-0`}),(0,v.jsx)(`span`,{className:`text-[11px] text-text-secondary font-mono`,children:e.name}),e.data&&Object.keys(e.data).length>0&&(0,v.jsx)(`span`,{className:`text-[10px] text-text-muted truncate max-w-[200px]`,children:JSON.stringify(e.data).slice(0,60)})]},t))})]}),c.toolCalls.length>0&&(0,v.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-xl p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,v.jsx)(f,{size:14,className:`text-accent`}),(0,v.jsx)(`span`,{className:`text-xs font-medium text-text-secondary`,children:`Tool Calls`})]}),(0,v.jsx)(`div`,{className:`space-y-2`,children:c.toolCalls.map((e,t)=>(0,v.jsxs)(`div`,{className:`flex items-center gap-3 px-2.5 py-2 rounded-lg bg-bg border border-border`,children:[(0,v.jsx)(f,{size:12,className:e.success?`text-success shrink-0`:`text-error shrink-0`}),(0,v.jsx)(`span`,{className:`text-[11px] text-text-secondary font-mono`,children:e.tool}),(0,v.jsxs)(`span`,{className:`text-[10px] text-text-muted`,children:[e.durationMs,`ms`]}),(0,v.jsxs)(`span`,{className:`text-[10px] text-text-muted`,children:[`round `,e.round]}),!e.success&&(0,v.jsx)(`span`,{className:`text-[10px] text-error ml-auto`,children:`failed`})]},t))})]}),c.error&&(0,v.jsxs)(`div`,{className:`bg-error/5 border border-error/20 rounded-xl p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,v.jsx)(p,{size:14,className:`text-error`}),(0,v.jsx)(`span`,{className:`text-xs font-semibold text-error`,children:`Error`})]}),(0,v.jsx)(`div`,{className:`text-[11px] text-text-secondary font-mono whitespace-pre-wrap`,children:c.error})]})]})}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"./download-CJZWQNfV.js";import{H as i,I as a}from"./index-WI-E4I3h.js";import{t as o}from"./PageHeader-CH85uoZG.js";var s=e(t(),1),c=n();function l({label:e,value:t}){return(0,c.jsxs)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4`,children:[(0,c.jsx)(`p`,{className:`text-sm text-[var(--text-muted)]`,children:e}),(0,c.jsx)(`p`,{className:`text-lg font-semibold text-[var(--text)]`,children:t})]})}function u(){let[e,t]=(0,s.useState)([]),[n,u]=(0,s.useState)(null),[d,f]=(0,s.useState)(!0);return(0,s.useEffect)(()=>{f(!0),Promise.all([i(`/api/traces?limit=100`,{headers:{"Content-Type":`application/json`}}).then(e=>e.json()).then(e=>e.spans||[]).catch(()=>[]),i(`/api/traces/summary`,{headers:{"Content-Type":`application/json`}}).then(e=>e.json()).catch(()=>null)]).then(([e,n])=>{t(e),u(n)}).finally(()=>f(!1))},[]),(0,c.jsxs)(`div`,{className:`space-y-6`,children:[(0,c.jsx)(o,{title:`Observability`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Tools`},{label:`Observability`}]}),(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(a,{size:18,className:`text-[var(--text-secondary)]`}),(0,c.jsx)(`span`,{className:`text-sm text-[var(--text-secondary)]`,children:`Per-run traces — latency, tokens, cost, tools`}),(0,c.jsxs)(`a`,{href:`/api/traces/export`,target:`_blank`,rel:`noopener noreferrer`,className:`ml-auto flex items-center gap-1 text-xs px-2 py-1 rounded border border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text)]`,children:[(0,c.jsx)(r,{size:12}),` OTel export`]})]}),n&&(0,c.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-4`,children:[(0,c.jsx)(l,{label:`Runs`,value:String(n.totalRuns)}),(0,c.jsx)(l,{label:`OK`,value:`${n.okRuns}/${n.totalRuns}`}),(0,c.jsx)(l,{label:`Tokens`,value:(n.totalPromptTokens+n.totalCompletionTokens).toLocaleString()}),(0,c.jsx)(l,{label:`Cost`,value:`$${n.totalCostUsd.toFixed(4)}`}),(0,c.jsx)(l,{label:`Avg latency`,value:`${(n.avgDurationMs/1e3).toFixed(1)}s`})]}),d?(0,c.jsx)(`div`,{className:`text-[var(--text-muted)]`,children:`Loading traces…`}):e.length===0?(0,c.jsx)(`div`,{className:`text-[var(--text-muted)] text-sm`,children:`No runs traced yet — send a message and they'll appear here.`}):(0,c.jsx)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden`,children:(0,c.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,c.jsx)(`thead`,{className:`text-[var(--text-muted)] border-b border-[var(--border)]`,children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{className:`text-left p-2`,children:`Model`}),(0,c.jsx)(`th`,{className:`text-left p-2`,children:`Input`}),(0,c.jsx)(`th`,{className:`text-left p-2`,children:`Tools`}),(0,c.jsx)(`th`,{className:`text-right p-2`,children:`Tokens`}),(0,c.jsx)(`th`,{className:`text-right p-2`,children:`Cost`}),(0,c.jsx)(`th`,{className:`text-right p-2`,children:`Latency`}),(0,c.jsx)(`th`,{className:`text-center p-2`,children:`OK`})]})}),(0,c.jsx)(`tbody`,{children:e.map(e=>(0,c.jsxs)(`tr`,{className:`border-b border-[var(--border)] last:border-0`,children:[(0,c.jsx)(`td`,{className:`p-2 font-mono text-[var(--text-secondary)] whitespace-nowrap`,children:e.model}),(0,c.jsx)(`td`,{className:`p-2 text-[var(--text-secondary)] max-w-[220px] truncate`,title:e.input,children:e.input}),(0,c.jsx)(`td`,{className:`p-2 text-[var(--text-muted)] whitespace-nowrap`,children:e.toolsUsed.join(`, `)||`—`}),(0,c.jsx)(`td`,{className:`p-2 text-right text-[var(--text-secondary)]`,children:(e.promptTokens+e.completionTokens).toLocaleString()}),(0,c.jsxs)(`td`,{className:`p-2 text-right text-[var(--text-secondary)]`,children:[`$`,e.costUsd.toFixed(4)]}),(0,c.jsxs)(`td`,{className:`p-2 text-right text-[var(--text-secondary)]`,children:[(e.durationMs/1e3).toFixed(1),`s`]}),(0,c.jsx)(`td`,{className:`p-2 text-center`,children:e.ok?`✓`:`✗`})]},e.id))})]})})]})}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"./download-CJZWQNfV.js";import{t as i}from"./refresh-cw-Disd5wRB.js";import{F as a,a as o,hn as s,mn 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)(null),[f,p]=(0,u.useState)([]),[m,h]=(0,u.useState)(!0),g=(0,u.useCallback)(async()=>{h(!0);try{let[e,t]=await Promise.all([s(),c()]);n(e),p(t.runs||[])}catch(t){e(`error`,`Couldn't load training data — try again. (${t.message})`)}h(!1)},[e]);return(0,u.useEffect)(()=>{g()},[g]),(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsx)(l,{title:`Training Dashboard`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Intelligence`},{label:`Training`}]}),(0,d.jsxs)(`div`,{className:`flex gap-2`,children:[(0,d.jsxs)(`button`,{onClick:g,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,d.jsx)(i,{className:`w-4 h-4 ${m?`animate-spin`:``}`}),` Refresh`]}),(0,d.jsxs)(`a`,{href:`/api/training/export`,download:!0,className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46]`,children:[(0,d.jsx)(r,{className:`w-4 h-4`}),` Export`]})]}),t&&(0,d.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,d.jsxs)(`div`,{className:`p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,d.jsx)(`div`,{className:`text-xs text-[#52525b]`,children:`Entries`}),(0,d.jsx)(`div`,{className:`text-lg font-semibold text-[#e4e4e7]`,children:t.entries})]}),(0,d.jsxs)(`div`,{className:`p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,d.jsx)(`div`,{className:`text-xs text-[#52525b]`,children:`Size (bytes)`}),(0,d.jsx)(`div`,{className:`text-lg font-semibold text-[#e4e4e7]`,children:t.sizeBytes})]}),(0,d.jsxs)(`div`,{className:`p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,d.jsx)(`div`,{className:`text-xs text-[#52525b]`,children:`Last Capture`}),(0,d.jsx)(`div`,{className:`text-lg font-semibold text-[#e4e4e7]`,children:t.lastCapture?new Date(t.lastCapture).toLocaleString():`—`})]})]}),(0,d.jsx)(`div`,{className:`space-y-2`,children:f.map(e=>(0,d.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,d.jsx)(a,{className:`w-4 h-4 ${e.status===`running`?`text-amber-400`:e.status===`completed`?`text-emerald-400`:`text-red-400`}`}),(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(`div`,{className:`text-sm text-[#e4e4e7]`,children:[e.type,` — `,e.id.slice(0,8)]}),(0,d.jsxs)(`div`,{className:`text-xs text-[#52525b]`,children:[e.examplesProcessed,` examples • `,e.status]})]})]}),(0,d.jsx)(`div`,{className:`text-xs text-[#52525b]`,children:new Date(e.startedAt).toLocaleDateString()})]},e.id))})]})}export{f as default};
@@ -0,0 +1,7 @@
1
+ import{a as e,c as t,n,t as r}from"./jsx-runtime-B15e6lOy.js";import{t as i}from"./createLucideIcon-qnlrxww7.js";import{t as a}from"./chevron-right-A_pvnRh_.js";import{t as o}from"./mic-De6oZFaV.js";import{t as s}from"./volume-2-BVlfVl2U.js";import{H as c,N as l,P as u,i as d,s as f}from"./index-WI-E4I3h.js";var p=i(`mic-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M18.89 13.23A7.12 7.12 0 0 0 19 12v-2`,key:`80xlxr`}],[`path`,{d:`M5 10v2a7 7 0 0 0 12 5`,key:`p2k8kg`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}]]),m=i(`phone-off`,[[`path`,{d:`M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272`,key:`1wngk7`}],[`path`,{d:`M22 2 2 22`,key:`y4kqgn`}],[`path`,{d:`M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473`,key:`10hv5p`}]]),h=t(n(),1),g=r();function _({messages:e=[],isListening:t=!1}){let n=(0,h.useRef)(null);return(0,h.useEffect)(()=>{n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length]),(0,g.jsxs)(`div`,{ref:n,className:`w-full max-w-lg overflow-y-auto rounded-xl backdrop-blur`,style:{maxHeight:300,backgroundColor:`rgba(24, 24, 27, 0.5)`,padding:`1rem`},children:[e.length===0&&!t&&(0,g.jsx)(`p`,{className:`text-center text-sm text-text-muted`,children:`Start speaking to begin the conversation`}),(0,g.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(e=>(0,g.jsx)(`div`,{className:`flex ${e.role===`user`?`justify-end`:`justify-start`}`,children:(0,g.jsx)(`div`,{className:`max-w-[80%] rounded-lg px-3 py-2 text-sm`,style:{backgroundColor:e.role===`user`?`var(--color-accent)`:`var(--color-bg-tertiary)`,color:`var(--color-text)`},children:e.text})},e.id))}),t&&(0,g.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full`,style:{backgroundColor:`var(--color-accent)`,animation:`listeningPulse 1s ease-in-out infinite`}}),(0,g.jsx)(`span`,{className:`text-xs text-text-secondary`,children:`Listening...`}),(0,g.jsx)(`style`,{children:`
2
+ @keyframes listeningPulse {
3
+ 0%, 100% { opacity: 1; transform: scale(1); }
4
+ 50% { opacity: 0.4; transform: scale(0.8); }
5
+ }
6
+ `})]})]})}var v={default:{name:`Default`,description:`F5-TTS base voice`,gradient:`radial-gradient(circle at 35% 35%, #c084fc, #a855f7, #7c3aed)`,glow:`#a855f7`}},y=[{gradient:`radial-gradient(circle at 35% 35%, #93c5fd, #3b82f6, #1d4ed8)`,glow:`#3b82f6`},{gradient:`radial-gradient(circle at 35% 35%, #fbbf24, #f59e0b, #b45309)`,glow:`#f59e0b`},{gradient:`radial-gradient(circle at 35% 35%, #5eead4, #14b8a6, #0f766e)`,glow:`#14b8a6`},{gradient:`radial-gradient(circle at 35% 35%, #fda4af, #fb7185, #e11d48)`,glow:`#fb7185`},{gradient:`radial-gradient(circle at 35% 35%, #a5b4fc, #818cf8, #4f46e5)`,glow:`#818cf8`},{gradient:`radial-gradient(circle at 35% 35%, #fdba74, #f97316, #c2410c)`,glow:`#f97316`},{gradient:`radial-gradient(circle at 35% 35%, #86efac, #22c55e, #15803d)`,glow:`#22c55e`},{gradient:`radial-gradient(circle at 35% 35%, #67e8f9, #22d3ee, #0891b2)`,glow:`#22d3ee`}];function b(e){return e.map((e,t)=>{let n=v[e];if(n)return{id:e,...n};let r=y[t%y.length];return{id:e,name:e.charAt(0).toUpperCase()+e.slice(1),description:`Cloned voice`,gradient:r.gradient,glow:r.glow}})}function x(e){let t=v[e];if(t)return{name:t.name,glow:t.glow};let n=y.findIndex((t,n)=>n===e.length%y.length),r=y[n>=0?n:0];return{name:e.charAt(0).toUpperCase()+e.slice(1),glow:r.glow}}function S({currentVoice:e,onSelect:t,onPreview:n}){let[r,i]=(0,h.useState)([]),[o,u]=(0,h.useState)(!0),[d,f]=(0,h.useState)(0),[p,m]=(0,h.useState)(!1),[_,v]=(0,h.useState)(0),y=(0,h.useRef)(0),x=(0,h.useRef)(null);(0,h.useEffect)(()=>{(async()=>{u(!0);try{let t=await c(`/api/voice/voices`);if(t.ok){let n=await t.json(),r=b(n.voices?.length?n.voices:[`default`]);if(i(r),e){let t=r.findIndex(t=>t.id===e);t>=0&&f(t)}}else i(b([`default`]))}catch{i(b([`default`]))}finally{u(!1)}})()},[]);let S=r[d]||r[0],C=(0,h.useCallback)(e=>{f(Math.max(0,Math.min(r.length-1,e)))},[r.length]),w=(0,h.useCallback)(()=>C(d-1),[d,C]),T=(0,h.useCallback)(()=>C(d+1),[d,C]);(0,h.useEffect)(()=>{let e=e=>{e.key===`ArrowLeft`&&w(),e.key===`ArrowRight`&&T(),e.key===`Enter`&&t(r[d].id)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[d,w,T,t,r]);let ee=e=>{m(!0),y.current=e.clientX,v(0)},E=e=>{p&&v(e.clientX-y.current)},D=()=>{p&&(m(!1),_>60?w():_<-60&&T(),v(0))};return o||r.length===0?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full select-none`,children:[(0,g.jsx)(`div`,{className:`w-8 h-8 border-2 border-accent border-t-transparent rounded-full animate-spin mb-4`}),(0,g.jsx)(`p`,{className:`text-sm text-text-muted`,children:`Loading voices...`})]}):(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full select-none`,children:[(0,g.jsx)(`h2`,{className:`text-xl font-semibold text-text mb-2`,children:`Choose a voice`}),(0,g.jsx)(`p`,{className:`text-sm text-text-muted mb-10`,children:r.length>1?`${r.length} cloned voices available`:`Swipe or use arrow keys`}),(0,g.jsxs)(`div`,{ref:x,className:`relative flex items-center justify-center w-full`,style:{height:280,touchAction:`pan-y`},onPointerDown:ee,onPointerMove:E,onPointerUp:D,onPointerLeave:D,children:[d>0&&(0,g.jsx)(`button`,{onClick:w,className:`absolute left-4 z-10 rounded-full p-2 text-text-muted hover:text-text hover:bg-bg-tertiary transition-colors`,children:(0,g.jsx)(l,{size:28})}),(0,g.jsx)(`div`,{className:`relative`,style:{width:220,height:220},children:r.map((e,t)=>{let n=t-d,r=t===d,i=p?_*.3:0;return(0,g.jsxs)(`div`,{className:`absolute inset-0 transition-all`,style:{transitionDuration:p?`0ms`:`400ms`,transitionTimingFunction:`cubic-bezier(0.4, 0, 0.2, 1)`,transform:`translateX(${n*260+i}px) scale(${r?1:.7})`,opacity:Math.abs(n)>1?0:r?1:.4,zIndex:r?10:1,pointerEvents:r?`auto`:`none`},children:[(0,g.jsx)(`div`,{className:`absolute inset-0 rounded-full blur-2xl transition-opacity duration-500`,style:{background:e.glow,opacity:r?.3:0,transform:`scale(1.2)`}}),(0,g.jsx)(`div`,{className:`w-full h-full rounded-full shadow-2xl`,style:{background:e.gradient,boxShadow:r?`0 0 60px ${e.glow}40`:`none`}}),(0,g.jsx)(`div`,{className:`absolute rounded-full`,style:{top:`12%`,left:`18%`,width:`35%`,height:`35%`,background:`radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 70%)`}})]},e.id)})}),d<r.length-1&&(0,g.jsx)(`button`,{onClick:T,className:`absolute right-4 z-10 rounded-full p-2 text-text-muted hover:text-text hover:bg-bg-tertiary transition-colors`,children:(0,g.jsx)(a,{size:28})})]}),(0,g.jsxs)(`div`,{className:`mt-8 text-center`,children:[(0,g.jsx)(`h3`,{className:`text-2xl font-bold text-text mb-1`,children:S.name}),(0,g.jsx)(`p`,{className:`text-sm text-text-secondary`,children:S.description})]}),n&&(0,g.jsxs)(`button`,{onClick:()=>n(S.id),className:`mt-4 flex items-center gap-2 rounded-full px-4 py-2 text-xs font-medium text-text-secondary hover:text-text hover:bg-bg-tertiary transition-colors`,children:[(0,g.jsx)(s,{size:14}),`Preview`]}),(0,g.jsx)(`div`,{className:`flex items-center gap-2 mt-6`,children:r.map((e,t)=>(0,g.jsx)(`button`,{onClick:()=>C(t),className:`rounded-full transition-all duration-300`,style:{width:t===d?10:6,height:t===d?10:6,backgroundColor:t===d?S.glow:`var(--color-border)`,boxShadow:t===d?`0 0 8px ${S.glow}80`:`none`}},e.id))}),(0,g.jsxs)(`button`,{onClick:()=>t(S.id),className:`mt-10 w-72 rounded-full py-3.5 text-base font-semibold transition-all duration-200`,style:{background:`linear-gradient(135deg, ${S.glow}30, ${S.glow}15)`,border:`1px solid ${S.glow}40`,color:`var(--color-text)`},onMouseEnter:e=>{e.currentTarget.style.background=`linear-gradient(135deg, ${S.glow}50, ${S.glow}25)`,e.currentTarget.style.boxShadow=`0 0 20px ${S.glow}30`},onMouseLeave:e=>{e.currentTarget.style.background=`linear-gradient(135deg, ${S.glow}30, ${S.glow}15)`,e.currentTarget.style.boxShadow=`none`},children:[`Start with `,S.name]})]})}b([`default`]);var C=`/ollama`,w=`kimi-k2.6:cloud`;function T(e,t){let n=[];t&&n.push({role:`system`,content:t});for(let t of e)t.role===`framework`?n.push({role:`user`,content:t.content}):n.push({role:t.role,content:t.content});return n}async function ee(e,t,n,r){let i=r?.model||w,a=T(e,t),o=await fetch(`${C}/api/chat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({model:i,messages:a,stream:!0}),signal:r?.signal?AbortSignal.any([r.signal,AbortSignal.timeout(12e4)]):AbortSignal.timeout(12e4)});if(!o.ok){let e=await o.text().catch(()=>o.statusText);throw Error(`Ollama error ${o.status}: ${e}`)}if(!o.body)throw Error(`No response body from Ollama`);let s=o.body.getReader(),c=new TextDecoder,l=``,u=``,d=``;try{for(;;){let{done:e,value:t}=await s.read();if(e)break;l+=c.decode(t,{stream:!0});let r=l.split(`
7
+ `);l=r.pop()||``;for(let e of r)if(e.trim())try{let t=JSON.parse(e);if(t.message?.thinking&&(d+=t.message.thinking,n.onThinking?.(t.message.thinking)),t.message?.content&&(u+=t.message.content,n.onToken(t.message.content)),t.done){n.onDone?.({totalDuration:t.total_duration||0,promptTokens:t.prompt_eval_count||0,evalTokens:t.eval_count||0});return}}catch{}}if(l+=c.decode(),l.trim())try{let e=JSON.parse(l.trim());if(e.message?.content&&n.onToken(e.message.content),e.message?.thinking&&n.onThinking?.(e.message.thinking),e.done){n.onDone?.({totalDuration:e.total_duration||0,promptTokens:e.prompt_eval_count||0,evalTokens:e.eval_count||0});return}}catch{}n.onDone?.({totalDuration:0,promptTokens:0,evalTokens:0})}finally{s.releaseLock()}}var E=e({VoiceOverlay:()=>k}),D=0,O=()=>`voice-msg-${Date.now()}-${++D}`,te=e=>e.replace(/<(?:laugh|chuckle|sigh|cough|sniffle|groan|yawn|gasp)>/gi,``).replace(/\s{2,}/g,` `).trim(),ne=e=>e.replace(/```[\s\S]*?```/g,``).replace(/\*\*(.*?)\*\*/g,`$1`).replace(/\*(.*?)\*/g,`$1`).replace(/^#+\s+/gm,``).replace(/^[-*]\s+/gm,``).replace(/\n{2,}/g,` `).trim(),re=e=>e.replace(/(?:Let me |I'll |I will |I'm going to )(?:use|call|check|run|invoke|execute|try)(?: the)? \w[\w_]*(?: tool)?(?:\s+(?:to|for|and)\b[^.!?]*)?[.!]?\s*/gi,``).replace(/\b(?:Using|Calling|Running|Checking|Invoking|Executing) (?:the )?\w[\w_]*(?: tool)?(?:\s+(?:to|for)\b[^.!?]*)?[.!]?\s*/gi,``).replace(/\b\w[\w_]*(?:_\w+)+\b/g,``).replace(/\s{2,}/g,` `).trim();function k({onClose:e}){let[t,n]=(0,h.useState)(!1),r=localStorage.getItem(`titan-voice`)||``,[i,a]=(0,h.useState)(r?`active`:`picking`),[s,l]=(0,h.useState)(r),v=(0,h.useRef)(r),[y,b]=(0,h.useState)(!1),[C,w]=(0,h.useState)(!1),[T,E]=(0,h.useState)(!1),[D,k]=(0,h.useState)(!1),[A,j]=(0,h.useState)([]),[ie,M]=(0,h.useState)(0),[ae,oe]=(0,h.useState)(``),[se,N]=(0,h.useState)(null),[P,ce]=(0,h.useState)(!1),[le,ue]=(0,h.useState)([]),F=(0,h.useRef)(null),I=(0,h.useRef)(null),de=(0,h.useRef)(null),L=(0,h.useRef)(null),R=(0,h.useRef)(null),z=(0,h.useRef)(``),B=(0,h.useRef)(0);(0,h.useRef)(void 0);let V=(0,h.useRef)(null),H=(0,h.useRef)(null),U=(0,h.useRef)(null),W=(0,h.useRef)(null),G=(0,h.useRef)(null),fe=(0,h.useRef)(0),K=(0,h.useRef)(!1),pe=(0,h.useRef)(null);(0,h.useRef)(typeof navigator<`u`&&/iPad|iPhone|iPod/.test(navigator.userAgent));let q=(0,h.useCallback)(e=>new Promise(async t=>{let n=U.current;if(n&&n.state!==`closed`)try{n.state===`suspended`&&await n.resume();let r=await(await fetch(e)).arrayBuffer(),i=await n.decodeAudioData(r);try{W.current?.stop()}catch{}let a=n.createBufferSource();a.buffer=i,a.connect(n.destination),W.current=a,a.onended=()=>{URL.revokeObjectURL(e),t()},a.start(0);try{F.current?.stop()}catch{}console.log(`[Voice] Playing via Web Audio API`);return}catch(e){console.warn(`[Voice] Web Audio failed:`,e)}try{let n=H.current||new Audio;H.current=n,n.setAttribute(`playsinline`,``),n.setAttribute(`autoplay`,``),V.current=n,n.onplay=()=>{try{F.current?.stop()}catch{}},n.onended=()=>{URL.revokeObjectURL(e),t()},n.onerror=n=>{console.warn(`[Voice] Audio element error:`,n),URL.revokeObjectURL(e),t()},n.src=e,await n.play(),console.log(`[Voice] Playing via Audio element`)}catch(n){console.warn(`[Voice] Audio element play failed:`,n),URL.revokeObjectURL(e),t()}}),[]),J=(0,h.useRef)(!1),Y=(0,h.useRef)(!1),X=(0,h.useRef)(`picking`);(0,h.useEffect)(()=>{J.current=y},[y]),(0,h.useEffect)(()=>{Y.current=T},[T]),(0,h.useEffect)(()=>{X.current=i},[i]),(0,h.useEffect)(()=>{(async()=>{try{let e=await c(`/api/voice/voices`);if(e.ok){let t=await e.json();if(t.voices?.length){if(ue(t.voices),r&&!t.voices.includes(r)){let e=t.voices[0];l(e),v.current=e,localStorage.setItem(`titan-voice`,e)}}else ue([`default`])}}catch{ue([`default`])}})()},[]),(0,h.useEffect)(()=>{requestAnimationFrame(()=>n(!0))},[]),(0,h.useEffect)(()=>()=>{X.current=`picking`;try{F.current?.stop()}catch{}F.current=null,L.current?.getTracks().forEach(e=>e.stop()),I.current?.close(),G.current?.abort(),R.current&&clearTimeout(R.current),pe.current&&=(clearInterval(pe.current),null),cancelAnimationFrame(B.current),cancelAnimationFrame(fe.current)},[]),(0,h.useEffect)(()=>{if(!P)return;let e=()=>ce(!1),t=setTimeout(()=>document.addEventListener(`click`,e),0);return()=>{clearTimeout(t),document.removeEventListener(`click`,e)}},[P]);let Z=(0,h.useCallback)(async()=>{try{if(!navigator.mediaDevices?.getUserMedia){console.warn(`[Voice] getUserMedia not available — may need HTTPS on mobile`);return}let e=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});L.current=e;let t=I.current;(!t||t.state===`closed`)&&(t=new(window.AudioContext||window.webkitAudioContext)),t.state===`suspended`&&await t.resume(),I.current=t;let n=t.createMediaStreamSource(e),r=t.createAnalyser();r.fftSize=256,r.smoothingTimeConstant=.8,n.connect(r),de.current=r;let i=new Uint8Array(r.frequencyBinCount);function a(){r.getByteFrequencyData(i);let e=0;for(let t=0;t<i.length;t++)e+=i[t];let t=e/i.length/255;M(t),B.current=requestAnimationFrame(a)}B.current=requestAnimationFrame(a)}catch(e){console.error(`Mic access denied:`,e)}},[]),Q=(0,h.useCallback)(()=>{cancelAnimationFrame(B.current),cancelAnimationFrame(fe.current),L.current?.getTracks().forEach(e=>e.stop()),I.current?.close(),L.current=null,I.current=null,de.current=null,M(0)},[]),me=(0,h.useCallback)(()=>{let e=window.SpeechRecognition||window.webkitSpeechRecognition;if(!e){console.error(`Speech recognition not supported`);return}try{F.current?.stop()}catch{}let t=new e;t.continuous=!0,t.interimResults=!0,t.lang=`en-US`,t.onresult=e=>{if(Y.current)return;let t=``,n=``;for(let r=e.resultIndex;r<e.results.length;r++){let i=e.results[r];i[0].confidence>0&&i[0].confidence<.5||(i.isFinal?n+=i[0].transcript:t+=i[0].transcript)}if(t&&oe(t),n){z.current+=n,oe(``),R.current&&clearTimeout(R.current);let e=z.current.trim().split(/\s+/).length<10?400:700;R.current=setTimeout(()=>{let e=z.current.trim();e&&(z.current=``,he(e))},e)}},t.onend=()=>{if(!J.current&&!Y.current&&X.current===`active`)try{t.start()}catch{}w(!1)},t.onstart=()=>{w(!0)},t.onerror=e=>{console.error(`Speech recognition error:`,e.error),e.error===`not-allowed`?(N(`Mic access denied — check browser permissions`),w(!1)):e.error===`network`?(N(`Speech recognition network error`),setTimeout(()=>{if(!J.current&&X.current===`active`)try{t.start()}catch{}},2e3)):e.error===`audio-capture`?(N(`Mic not available — is another app using it?`),w(!1)):e.error!==`no-speech`&&console.error(`STT error:`,e.error)},F.current=t;try{t.start()}catch{}},[]),$=(0,h.useCallback)(()=>{try{W.current?.stop()}catch{}W.current=null;let e=V.current;e&&(e.pause(),e.src=``,V.current=null),`speechSynthesis`in window&&window.speechSynthesis.cancel(),E(!1),M(0)},[]);(0,h.useEffect)(()=>{if(r&&i===`active`){try{new Audio(`data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=`).play().catch(()=>{})}catch{}Z(),me()}},[]),(0,h.useCallback)(()=>{let e=[],t=0,n=!1,r=!1,i=null,a=null,o=Date.now(),s=setInterval(()=>{if(!n){let e=(Date.now()-o)/600;M(.45+Math.sin(e*Math.PI*2)*.15)}},100),c=()=>{clearInterval(s),M(0)},l=()=>{if(n){c();return}if(t<e.length){let n=e[t++];q(n).then(()=>l()).catch(()=>l())}else r?(c(),i&&i()):a=l};return{push(t){if(e.push(t),a){let e=a;a=null,e()}},finish(){if(r=!0,a){let e=a;a=null,e()}},start(e){i=e,l()},cancel(){n=!0;try{W.current?.stop()}catch{}V.current&&(V.current.pause(),V.current.src=``),c()},get length(){return e.length}}},[]);let he=(0,h.useCallback)(async e=>{if(K.current)return;K.current=!0,$(),G.current?.abort(),j(t=>[...t,{id:O(),role:`user`,text:e}]),k(!0),w(!1),N(null);try{F.current?.stop()}catch{}let t=new AbortController;G.current=t;let n=v.current||`default`,r=``,i=``;try{await ee([...A.map(e=>({role:e.role,content:e.text,timestamp:(e.id,Date.now())})),{role:`user`,content:e,timestamp:Date.now()}],`You are TITAN, a helpful AI assistant. Keep responses concise and natural for voice conversation. Use short sentences.`,{onToken:e=>{i+=e;let t=re(te(ne(i)));r?j(e=>e.map(e=>e.id===r?{...e,text:t}:e)):(r=O(),j(e=>[...e,{id:r,role:`assistant`,text:t}])),k(!1)}},{signal:t.signal});let a=re(te(ne(i)));if(!a){K.current=!1;try{F.current?.start()}catch{}return}E(!0);let o=await fetch(`/api/voice/preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:a.slice(0,500),voice:n}),signal:AbortSignal.timeout(12e4)});if(!o.ok)throw Error(`F5-TTS error: ${o.status}`);let s=await o.blob(),c=URL.createObjectURL(s);await q(c),E(!1),M(0),z.current=``,setTimeout(()=>{if(K.current=!1,!J.current&&X.current===`active`)try{F.current?.start()}catch{}},500)}catch(e){if(e?.name===`AbortError`&&!G.current)return;let t=e?.name===`AbortError`?`Request timed out`:`Connection error`;N(t),setTimeout(()=>N(null),4e3),console.error(`Voice processing error:`,e),j(e=>[...e,{id:O(),role:`assistant`,text:`Sorry, something went wrong.`}]),k(!1),E(!1),z.current=``,K.current=!1;try{F.current?.start()}catch{}}},[$,q,A]),ge=(0,h.useCallback)(async e=>{l(e),v.current=e,localStorage.setItem(`titan-voice`,e);try{await c(`/api/config`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({voice:{ttsVoice:e}})})}catch{}if(a(`active`),!U.current||U.current.state===`closed`){let e=window.AudioContext||window.webkitAudioContext;U.current=new e}U.current.state===`suspended`&&U.current.resume().catch(()=>{});try{let e=U.current,t=e.createBuffer(1,1,22050),n=e.createBufferSource();n.buffer=t,n.connect(e.destination),n.start(0)}catch{}H.current||(H.current=new Audio,H.current.preload=`auto`),Z(),me()},[Z,me]),_e=(0,h.useCallback)(e=>{l(e),v.current=e,localStorage.setItem(`titan-voice`,e),ce(!1),c(`/api/config`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({voice:{ttsVoice:e}})}).catch(()=>{})},[]),ve=(0,h.useCallback)(async e=>{try{let t=await fetch(`/api/voice/preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:`Hey! I'm TITAN, your AI assistant.`,voice:e})});if(!t.ok)return;let n=await t.blob(),r=URL.createObjectURL(n),i=H.current||new Audio,a=()=>{URL.revokeObjectURL(r),i.src=``};i.onended=a,i.onerror=a,i.play()}catch{}},[]),ye=(0,h.useCallback)(()=>{n(!1),X.current=`picking`,a(`picking`),G.current?.abort(),G.current=null;try{F.current?.stop()}catch{}F.current=null,$(),Q(),R.current&&clearTimeout(R.current),K.current=!1,setTimeout(e,200)},[e,Q,$]),be=(0,h.useCallback)(()=>{b(e=>{let t=!e;if(J.current=t,t){try{F.current?.stop()}catch{}Q(),w(!1)}else{Z();try{F.current?.start()}catch{}}return t})},[Z,Q]),xe=T?`assistant`:D?`thinking`:C?`user`:`idle`,Se=y?`Muted`:T?`TITAN is speaking...`:D?`Thinking...`:C?ae?`"${ae}"`:`Listening...`:`Connected`;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`audio`,{ref:e=>{e&&!H.current&&(H.current=e)},autoPlay:!0,playsInline:!0,style:{position:`absolute`,width:0,height:0,opacity:0}}),(0,g.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col items-center justify-center backdrop-blur-sm transition-all duration-200`,style:{backgroundColor:`rgba(9, 9, 11, 0.95)`,opacity:+!!t,transform:t?`scale(1)`:`scale(0.95)`},children:[(0,g.jsx)(`button`,{onClick:ye,className:`absolute right-6 top-6 rounded-full p-2 transition-colors hover:bg-bg-tertiary z-20 text-text-secondary`,children:(0,g.jsx)(f,{className:`h-6 w-6`})}),i===`picking`&&(0,g.jsx)(`div`,{className:`w-full h-full`,children:(0,g.jsx)(S,{currentVoice:s||void 0,onSelect:ge,onPreview:ve})}),i===`active`&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{className:`mb-6 text-center`,children:[(0,g.jsx)(`div`,{className:`text-base font-medium mb-0.5 transition-colors duration-500 max-w-md truncate px-4`,style:{color:T?`var(--color-purple-light)`:D?`var(--color-warning)`:C?`var(--color-cyan)`:`var(--color-text-muted)`},children:Se}),se&&(0,g.jsx)(`div`,{className:`text-xs font-medium mt-1 animate-pulse text-error`,children:se}),(0,g.jsxs)(`div`,{className:`relative mt-2`,children:[(0,g.jsxs)(`button`,{onClick:()=>ce(e=>!e),className:`inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-medium transition-colors hover:bg-bg-tertiary`,style:{color:x(s||`tara`).glow},children:[(0,g.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{backgroundColor:x(s||`tara`).glow}}),x(s||`tara`).name,(0,g.jsx)(u,{className:`h-3 w-3`})]}),P&&(0,g.jsx)(`div`,{className:`absolute left-1/2 -translate-x-1/2 mt-1 rounded-xl border border-bg-tertiary bg-bg-secondary/95 backdrop-blur-sm p-1.5 shadow-xl z-30`,style:{minWidth:180},children:le.map(e=>{let t=x(e),n=e===(s||`tara`);return(0,g.jsxs)(`button`,{onClick:()=>_e(e),className:`flex items-center gap-2.5 w-full rounded-lg px-3 py-2 text-left text-sm transition-colors hover:bg-bg-tertiary`,style:{color:n?t.glow:`var(--color-text-secondary)`},children:[(0,g.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full flex-shrink-0`,style:{backgroundColor:t.glow,boxShadow:n?`0 0 8px ${t.glow}60`:`none`}}),(0,g.jsx)(`span`,{className:`font-medium`,children:t.name}),n&&(0,g.jsx)(`span`,{className:`ml-auto text-xs opacity-60`,children:`✓`})]},e)})})]})]}),(0,g.jsx)(d,{audioLevel:y?0:ie,speaker:y?`idle`:xe,size:260}),(0,g.jsx)(`div`,{className:`mt-8 w-full max-w-lg px-4`,children:(0,g.jsx)(_,{messages:A,isListening:C&&!y})}),(0,g.jsxs)(`div`,{className:`absolute bottom-12 flex items-center gap-6`,children:[(0,g.jsx)(`button`,{onClick:be,className:`rounded-full p-4 transition-colors`,style:{backgroundColor:y?`var(--color-error)`:`var(--color-bg-tertiary)`,color:`var(--color-text)`},title:y?`Unmute`:`Mute`,children:y?(0,g.jsx)(p,{className:`h-6 w-6`}):(0,g.jsx)(o,{className:`h-6 w-6`})}),(0,g.jsx)(`button`,{onClick:ye,className:`rounded-full p-4 transition-colors`,style:{backgroundColor:`var(--color-error)`,color:`var(--color-text)`},title:`End call`,children:(0,g.jsx)(m,{className:`h-6 w-6`})})]})]})]})]})}export{E as n,k as t};
@@ -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{O as i,a,gn as o,y as s}from"./index-WI-E4I3h.js";import{t as c}from"./PageHeader-CH85uoZG.js";var l=e(t(),1),u=n();function d(){let{toast:e}=a(),[t,n]=(0,l.useState)(null),[d,f]=(0,l.useState)(!0),p=(0,l.useCallback)(async()=>{f(!0);try{let e=await o();n(e)}catch(t){e(`error`,`Couldn't load VRAM snapshot — try again. (${t.message})`)}f(!1)},[e]);return(0,l.useEffect)(()=>{p()},[p]),(0,u.jsxs)(`div`,{className:`space-y-4`,children:[(0,u.jsx)(c,{title:`VRAM Monitor`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Infra`},{label:`VRAM`}]}),(0,u.jsx)(`div`,{className:`flex gap-2`,children:(0,u.jsxs)(`button`,{onClick:p,disabled:d,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,u.jsx)(r,{className:`w-4 h-4 ${d?`animate-spin`:``}`}),` Refresh`]})}),t?.gpu&&(0,u.jsxs)(`div`,{className:`p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,u.jsx)(i,{className:`w-4 h-4 text-[#6366f1]`}),(0,u.jsx)(`span`,{className:`text-sm font-medium text-[#e4e4e7]`,children:t.gpu.gpuName}),(0,u.jsxs)(`span`,{className:`text-xs text-[#52525b]`,children:[`(`,t.gpu.vendor,`)`]})]}),(0,u.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-xs`,children:[(0,u.jsxs)(`div`,{className:`p-2 rounded bg-[#27272a]/50`,children:[(0,u.jsx)(`div`,{className:`text-[#52525b]`,children:`Total`}),(0,u.jsxs)(`div`,{className:`text-[#e4e4e7]`,children:[(t.gpu.totalMB/1024).toFixed(1),` GB`]})]}),(0,u.jsxs)(`div`,{className:`p-2 rounded bg-[#27272a]/50`,children:[(0,u.jsx)(`div`,{className:`text-[#52525b]`,children:`Used`}),(0,u.jsxs)(`div`,{className:`text-[#e4e4e7]`,children:[(t.gpu.usedMB/1024).toFixed(1),` GB`]})]}),(0,u.jsxs)(`div`,{className:`p-2 rounded bg-[#27272a]/50`,children:[(0,u.jsx)(`div`,{className:`text-[#52525b]`,children:`Free`}),(0,u.jsxs)(`div`,{className:`text-[#e4e4e7]`,children:[(t.gpu.freeMB/1024).toFixed(1),` GB`]})]})]}),(0,u.jsx)(`div`,{className:`mt-2 h-2 rounded-full bg-[#27272a] overflow-hidden`,children:(0,u.jsx)(`div`,{className:`h-full bg-[#6366f1] rounded-full`,style:{width:`${t.gpu.usedMB/t.gpu.totalMB*100}%`}})})]}),t&&t.activeLeases.length>0&&(0,u.jsxs)(`div`,{className:`space-y-2`,children:[(0,u.jsx)(`div`,{className:`text-sm font-medium text-[#e4e4e7]`,children:`Active Leases`}),t.activeLeases.map(e=>(0,u.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(s,{className:`w-3.5 h-3.5 text-[#6366f1]`}),(0,u.jsx)(`span`,{className:`text-xs text-[#e4e4e7]`,children:e.service})]}),(0,u.jsxs)(`span`,{className:`text-xs text-[#52525b]`,children:[(e.reservedMB/1024).toFixed(1),` GB`]})]},e.id))]})]})}export{d as default};
@@ -0,0 +1,13 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{H as r,or as i,s as a}from"./index-WI-E4I3h.js";import{a as o,i as s}from"./ConfirmDialog-6hcNjmAh.js";var c=e(t(),1),l={purpose:`#a78bfa`,hunger:`#fbbf24`,curiosity:`#22d3ee`,safety:`#34d399`,social:`#f472b6`},u={purpose:`Purpose`,hunger:`Hunger`,curiosity:`Curiosity`,safety:`Safety`,social:`Social`};function d(e){return l[e?.toLowerCase()]||`#a1a1aa`}var f=new Set([`soma:proposal`,`turn:pre`,`tool:call`,`goal:subtask:ready`,`initiative:start`,`initiative:complete`,`pressure:threshold`,`goal:completed`]);function p(e,t=Date.now()){let n;if(typeof e==`number`&&!Number.isNaN(e)&&e>0)n=e;else if(typeof e==`string`){let r=Date.parse(e);n=Number.isNaN(r)?t:r}else n=t;let r=Math.max(0,Math.floor((t-n)/1e3));if(r<10)return`just now`;if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}var m=100,h=500;function g(){try{return localStorage.getItem(`titan-token`)||localStorage.getItem(`titan_token`)||``}catch{return``}}function _(){let[e,t]=(0,c.useState)([]),[n,r]=(0,c.useState)([]),[i,a]=(0,c.useState)(!1),[o,s]=(0,c.useState)(!1),[l,d]=(0,c.useState)(0),[f,p]=(0,c.useState)(null),_=(0,c.useRef)(null),v=(0,c.useCallback)(e=>{if(!Array.isArray(e))return;let n=e.map(e=>({id:e.id,label:e.label||u[e.id?.toLowerCase()]||e.id,satisfaction:e.satisfaction??1,setpoint:e.setpoint??.7,pressure:e.pressure??0,weight:e.weight,description:e.description}));t(n)},[]),y=(0,c.useCallback)(()=>{_.current&&_.current.close();let e=g(),t=`/api/watch/stream${e?`?token=${encodeURIComponent(e)}`:``}`,n=new EventSource(t);_.current=n;let i=Date.now();n.onopen=()=>{a(!0),s(!1)},n.onerror=()=>{a(!1),Date.now()-i>h&&s(!0)},n.onmessage=e=>{try{let t=JSON.parse(e.data);if(t.type===`snapshot`){p({drives:t.drives||[],totalPressure:t.totalPressure||0,dominantDrives:t.dominantDrives||[],timestamp:t.timestamp||Date.now()}),v(t.drives);return}if(t.type===`event`){if(t.topic===`drive:tick`){let e=t.raw?.drives??[];v(e),d(Date.now());return}if(t.topic===`initiative:round`){let e=t.raw?.subtaskTitle,n={id:t.id,timestamp:t.timestamp,topic:t.topic,kind:t.kind,icon:t.icon,captionTitan:t.captionTitan,captionControl:t.captionControl,detail:t.detail,raw:t.raw};r(t=>{let r=e?t.filter(t=>!(t.topic===`initiative:round`&&t.raw?.subtaskTitle===e)):t.filter(e=>e.topic!==`initiative:round`),i=[n,...r];return i.length>m&&(i.length=m),i}),d(Date.now());return}let e={id:t.id,timestamp:t.timestamp,topic:t.topic,kind:t.kind,icon:t.icon,captionTitan:t.captionTitan,captionControl:t.captionControl,detail:t.detail,raw:t.raw};r(t=>{let n=[e,...t];return n.length>m&&(n.length=m),n}),d(Date.now())}}catch{}}},[v]),b=(0,c.useCallback)(()=>{_.current&&_.current.close(),y()},[y]);return(0,c.useEffect)(()=>{let e=g(),t={};e&&(t.Authorization=`Bearer ${e}`),fetch(`/api/watch/snapshot`,{headers:t}).then(e=>e.status===401?(localStorage.removeItem(`titan-token`),localStorage.removeItem(`titan_token`),window.location.reload(),null):e.ok?e.json():null).then(e=>{e&&!e.error&&(p(e),v(e.drives))}).catch(()=>{})},[v]),(0,c.useEffect)(()=>(y(),()=>{_.current?.close(),_.current=null}),[y]),{drives:e,events:n,connected:i,reconnecting:o,lastActivity:l,snapshot:f,reconnect:b}}var v=n();function y(e){for(let t of e)if(f.has(t.topic))return t;return e[0]||null}function b({events:e,voice:t}){let n=(0,c.useMemo)(()=>y(e),[e]),r=n?t===`titan`?n.captionTitan:n.captionControl:null;return(0,v.jsxs)(`div`,{style:{position:`relative`,minHeight:80},children:[(0,v.jsx)(`div`,{style:{fontSize:10,textTransform:`uppercase`,letterSpacing:`0.15em`,color:`rgba(255, 255, 255, 0.35)`,marginBottom:10,fontWeight:600},children:`What I'm doing`}),(0,v.jsx)(o,{mode:`wait`,initial:!1,children:(0,v.jsx)(s.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.3},style:{fontSize:`clamp(18px, 2.4vw, 24px)`,fontWeight:500,lineHeight:1.35,color:r?`rgba(255, 255, 255, 0.95)`:`rgba(255, 255, 255, 0.45)`},children:r||`Standing by.`},n?.id||`idle`)}),n&&(0,v.jsxs)(`div`,{style:{display:`flex`,gap:12,marginTop:12,fontSize:11,color:`rgba(255, 255, 255, 0.35)`,flexWrap:`wrap`},children:[(0,v.jsx)(`span`,{children:p(n.timestamp)}),n.detail&&(0,v.jsxs)(`span`,{children:[`· `,n.detail]})]})]})}var x={drive:`var(--color-purple-light)`,soma:`#c084fc`,tool:`#60a5fa`,goal:`var(--color-emerald)`,channel:`#fb7185`,agent:`#c084fc`,health:`#fbbf24`,memory:`#e879f9`,system:`#9ca3af`};function S({events:e,voice:t,onEventClick:n}){let[,r]=(0,c.useState)(0);(0,c.useEffect)(()=>{let e=setInterval(()=>r(e=>e+1),2e4);return()=>clearInterval(e)},[]);let i=(0,c.useMemo)(()=>e.slice(0,80),[e]);return i.length===0?(0,v.jsx)(`div`,{style:{color:`rgba(255,255,255,0.35)`,fontSize:13,fontStyle:`italic`,padding:`24px 16px`,textAlign:`center`},children:`Listening for TITAN to do something…`}):(0,v.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4,overflow:`hidden`},children:(0,v.jsx)(o,{initial:!1,children:i.map((e,r)=>{let i=t===`titan`?e.captionTitan:e.captionControl,a=x[e.kind]||`#9ca3af`,o=r===0;return(0,v.jsxs)(s.div,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.35,ease:`easeOut`},onClick:()=>n?.(e),style:{display:`flex`,alignItems:`flex-start`,gap:12,padding:`10px 12px`,borderRadius:10,background:o?`${a}14`:`rgba(255, 255, 255, 0.015)`,borderLeft:`2px solid ${a}`,fontSize:13,lineHeight:1.35,transition:`background 0.2s, transform 0.15s`,cursor:n?`pointer`:`default`},onMouseEnter:e=>{n&&(e.currentTarget.style.background=`${a}22`)},onMouseLeave:e=>{e.currentTarget.style.background=o?`${a}14`:`rgba(255, 255, 255, 0.015)`},title:`Click for details · ${e.topic}`,children:[(0,v.jsx)(`div`,{style:{fontSize:15,flexShrink:0,width:20,textAlign:`center`,marginTop:1},children:e.icon}),(0,v.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,v.jsx)(`div`,{style:{color:`rgba(255,255,255,0.92)`},children:i}),e.detail&&(0,v.jsx)(`div`,{style:{color:`rgba(255,255,255,0.45)`,fontSize:11,marginTop:2,lineHeight:1.3},children:e.detail})]}),(0,v.jsx)(`div`,{style:{color:`rgba(255,255,255,0.35)`,fontSize:11,flexShrink:0,fontVariantNumeric:`tabular-nums`,whiteSpace:`nowrap`,marginTop:1},children:p(e.timestamp)})]},e.id)})})})}function C(e,t){let n=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);return n?`rgba(${parseInt(n[1],16)}, ${parseInt(n[2],16)}, ${parseInt(n[3],16)}, ${t})`:`rgba(160, 160, 160, ${t})`}function w({drives:e,excited:t=!1,reducedMotion:n=!1}){let r=(0,c.useRef)(null),i=(0,c.useRef)(e),a=(0,c.useRef)(t),o=(0,c.useRef)(null);return(0,c.useEffect)(()=>{i.current=e},[e]),(0,c.useEffect)(()=>{a.current=t},[t]),(0,c.useEffect)(()=>{let e=r.current;if(!e)return;let t=e.getContext(`2d`,{alpha:!0});if(!t)return;let s=Math.min(window.devicePixelRatio||1,2),c=()=>{let n=e.getBoundingClientRect();e.width=Math.max(2,n.width*s),e.height=Math.max(2,n.height*s),t.setTransform(s,0,0,s,0,0)};c();let l=new ResizeObserver(c);l.observe(e);let u=[],f=0,p=()=>{o.current=requestAnimationFrame(p),f+=1;let r=e.getBoundingClientRect(),s=r.width,c=r.height;if(s<10||c<10)return;let l=s/2,m=c/2,h=Math.min(s,c)*.11,g=Math.min(s,c)*.34,_=performance.now()/1e3,v=i.current;t.clearRect(0,0,s,c);let y=t.createRadialGradient(l,m,0,l,m,Math.min(s,c)*.55),b=n?.08:.08+.03*Math.sin(_*.5);y.addColorStop(0,`rgba(255, 255, 255, ${b*2})`),y.addColorStop(.3,`rgba(167, 139, 250, ${b})`),y.addColorStop(1,`rgba(167, 139, 250, 0)`),t.fillStyle=y,t.fillRect(0,0,s,c);let x=Math.max(v.length,5);for(let e=0;e<v.length;e++){let r=v[e],i=e/x*Math.PI*2-Math.PI/2,o=l+Math.cos(i)*g,s=m+Math.sin(i)*g,c=Math.min(1,(r.pressure||0)*3),f=n?0:.35+c*1.4,p=h*(.75+(n?0:.04+c*.15)*Math.sin(_*f+e*1.3)),y=d(r.id),b=p*2.8,S=t.createRadialGradient(o,s,0,o,s,b);S.addColorStop(0,C(y,.35)),S.addColorStop(.35,C(y,.18)),S.addColorStop(1,C(y,0)),t.fillStyle=S,t.beginPath(),t.arc(o,s,b,0,Math.PI*2),t.fill();let w=t.createRadialGradient(o-p*.3,s-p*.3,0,o,s,p);w.addColorStop(0,C(y,.95)),w.addColorStop(.55,C(y,.55)),w.addColorStop(1,C(y,.2)),t.fillStyle=w,t.beginPath(),t.arc(o,s,p,0,Math.PI*2),t.fill(),c>.1&&(t.strokeStyle=C(y,.6+.3*Math.sin(_*3+e)),t.lineWidth=1.5,t.beginPath(),t.arc(o,s,p*1.05,0,Math.PI*2),t.stroke()),t.font=`600 10px -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif`,t.textAlign=`center`,t.fillStyle=`rgba(255,255,255,0.65)`,t.fillText(r.label.toUpperCase(),o,s+p+18),t.font=`11px -apple-system, system-ui`,t.fillStyle=`rgba(255,255,255,0.35)`,t.fillText(`${Math.round((r.satisfaction||0)*100)}%`,o,s+p+32);let T=c*.25+(a.current?.03:0);!n&&u.length<60&&Math.random()<T&&u.push({sourceIdx:e,phase:0,color:y,size:2+Math.random()*2})}if(!n)for(let e=u.length-1;e>=0;e--){let n=u[e];if(n.phase+=.012,n.phase>=1){u.splice(e,1);continue}if(!v[n.sourceIdx]){u.splice(e,1);continue}let r=n.sourceIdx/x*Math.PI*2-Math.PI/2,i=l+Math.cos(r)*g,a=m+Math.sin(r)*g,o=(i+l)/2+Math.sin(r+Math.PI/2)*20,s=(a+m)/2+Math.cos(r+Math.PI/2)*20,c=(1-n.phase)*(1-n.phase)*i+2*(1-n.phase)*n.phase*o+n.phase*n.phase*l,d=(1-n.phase)*(1-n.phase)*a+2*(1-n.phase)*n.phase*s+n.phase*n.phase*m,f=Math.sin(n.phase*Math.PI)*.9;t.fillStyle=C(n.color,f),t.beginPath(),t.arc(c,d,n.size,0,Math.PI*2),t.fill()}if(!n){let e=_%20/20;if(e<.18){let n=h+e*Math.min(s,c)*2.5,r=(1-e/.18)*.18;t.strokeStyle=`rgba(167, 139, 250, ${r})`,t.lineWidth=1.5,t.beginPath(),t.arc(l,m,n,0,Math.PI*2),t.stroke()}}};return o.current=requestAnimationFrame(p),()=>{l.disconnect(),o.current&&cancelAnimationFrame(o.current)}},[n]),(0,v.jsx)(`canvas`,{ref:r,style:{width:`100%`,height:`100%`,display:`block`},"aria-label":`TITAN organism — 5 drives breathing`})}function T({event:e,voice:t,onClose:n}){return(0,v.jsx)(o,{children:e&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(s.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.18},onClick:n,style:{position:`fixed`,inset:0,background:`rgba(0, 0, 0, 0.55)`,backdropFilter:`blur(4px)`,WebkitBackdropFilter:`blur(4px)`,zIndex:99}},`backdrop`),(0,v.jsx)(s.aside,{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`},transition:{duration:.28,ease:[.32,.72,0,1]},style:{position:`fixed`,top:0,right:0,bottom:0,width:`min(540px, 100vw)`,background:`rgba(10, 12, 20, 0.96)`,backdropFilter:`blur(24px)`,WebkitBackdropFilter:`blur(24px)`,borderLeft:`1px solid rgba(167, 139, 250, 0.15)`,display:`flex`,flexDirection:`column`,zIndex:100,color:`#f8f9fc`,boxShadow:`-20px 0 60px rgba(0,0,0,0.5)`},role:`dialog`,"aria-modal":`true`,children:(0,v.jsx)(E,{event:e,voice:t,onClose:n})},`panel`)]})})}function E({event:e,voice:t,onClose:n}){let r=t===`titan`?e.captionTitan:e.captionControl,i=e.raw||{};return(0,c.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{style:{padding:`20px 24px`,borderBottom:`1px solid rgba(255,255,255,0.06)`,display:`flex`,alignItems:`flex-start`,gap:12},children:[(0,v.jsx)(`div`,{style:{fontSize:22,width:36,height:36,borderRadius:10,background:`rgba(255,255,255,0.04)`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:e.icon}),(0,v.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,v.jsx)(`div`,{style:{fontSize:17,fontWeight:600,lineHeight:1.3,marginBottom:4},children:r}),(0,v.jsxs)(`div`,{style:{fontSize:11,color:`rgba(255,255,255,0.35)`,display:`flex`,gap:10},children:[(0,v.jsx)(`span`,{children:p(e.timestamp)}),(0,v.jsx)(`span`,{style:{opacity:.5},children:`·`}),(0,v.jsx)(`span`,{style:{textTransform:`uppercase`,letterSpacing:`0.1em`},children:e.kind}),(0,v.jsx)(`span`,{style:{opacity:.5},children:`·`}),(0,v.jsx)(`span`,{style:{fontFamily:`ui-monospace, monospace`,fontSize:10},children:e.topic})]})]}),(0,v.jsx)(`button`,{onClick:n,"aria-label":`Close`,style:{background:`transparent`,border:0,color:`rgba(255,255,255,0.55)`,cursor:`pointer`,padding:6,borderRadius:8,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,v.jsx)(a,{size:18})})]}),(0,v.jsxs)(`div`,{style:{flex:1,overflowY:`auto`,padding:`20px 24px`,minHeight:0},children:[e.detail&&(0,v.jsx)(D,{label:`Detail`,children:(0,v.jsx)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.75)`,lineHeight:1.5},children:e.detail})}),e.kind===`soma`&&(0,v.jsx)(O,{raw:i}),e.kind===`goal`&&(0,v.jsx)(k,{raw:i}),e.kind===`tool`&&(0,v.jsx)(j,{raw:i,topic:e.topic}),e.kind===`channel`&&(0,v.jsx)(M,{raw:i,topic:e.topic}),e.kind===`drive`&&(0,v.jsx)(N,{raw:i,topic:e.topic}),(e.kind===`system`||e.kind===`agent`||e.kind===`memory`||e.kind===`health`)&&(0,v.jsx)(P,{raw:i,topic:e.topic})]}),(0,v.jsx)(L,{label:`Raw event data`,raw:i})]})}function D({label:e,children:t}){return(0,v.jsxs)(`div`,{style:{marginBottom:20},children:[(0,v.jsx)(`div`,{style:{fontSize:10,textTransform:`uppercase`,letterSpacing:`0.15em`,color:`rgba(255,255,255,0.35)`,fontWeight:600,marginBottom:8},children:e}),t]})}function O({raw:e}){let t=e.approvalId,n=e.dominantDrives||[],r=e.shadowVerdict;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(D,{label:`What drove this`,children:(0,v.jsxs)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.75)`},children:[n.length?n.map(e=>e[0].toUpperCase()+e.slice(1)).join(`, `):`an unspecified drive`,` `,`was below its setpoint. Soma filed this proposal autonomously.`]})}),t&&(0,v.jsx)(D,{label:`Command Post approval`,children:(0,v.jsx)(`code`,{style:{fontSize:11,color:`rgba(167, 139, 250, 0.9)`},children:t})}),r&&(0,v.jsx)(D,{label:`Shadow rehearsal verdict`,children:(0,v.jsx)(`pre`,{style:{fontSize:11,lineHeight:1.4,color:`rgba(255,255,255,0.7)`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,background:`rgba(255,255,255,0.02)`,padding:12,borderRadius:8},children:JSON.stringify(r,null,2)})})]})}function k({raw:e}){let t=e.goalId,[n,i]=(0,c.useState)(null),[a,o]=(0,c.useState)(!1);if((0,c.useEffect)(()=>{t&&(o(!0),r(`/api/goals/${t}`).then(e=>e.ok?e.json():null).then(e=>i(e?.goal||e||null)).catch(()=>{}).finally(()=>o(!1)))},[t]),!t)return null;if(a)return(0,v.jsx)(D,{label:`Goal`,children:(0,v.jsx)(`div`,{style:{color:`rgba(255,255,255,0.4)`,fontSize:12},children:`Loading…`})});if(!n)return(0,v.jsx)(D,{label:`Goal`,children:(0,v.jsx)(`div`,{style:{color:`rgba(255,255,255,0.4)`,fontSize:12},children:`Goal not found (may have been deleted).`})});let s=n.subtasks||[],l=s.filter(e=>e.status===`done`||e.status===`skipped`).length;return(0,v.jsxs)(D,{label:`Goal`,children:[(0,v.jsx)(`div`,{style:{fontSize:14,fontWeight:600,marginBottom:6},children:String(n.title||``)}),(0,v.jsxs)(`div`,{style:{fontSize:11,color:`rgba(255,255,255,0.4)`,marginBottom:12},children:[String(n.status||``),` · `,l,`/`,s.length,` subtasks`]}),s.length>0&&(0,v.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:s.map((e,t)=>(0,v.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 10px`,borderRadius:8,background:`rgba(255,255,255,0.02)`,fontSize:12},children:[(0,v.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:A(e.status),boxShadow:`0 0 6px ${A(e.status)}`,flexShrink:0}}),(0,v.jsx)(`span`,{style:{flex:1},children:String(e.title||``)}),(0,v.jsx)(`span`,{style:{fontSize:10,color:`rgba(255,255,255,0.35)`,textTransform:`uppercase`,letterSpacing:`0.1em`},children:String(e.status||``)})]},t))})]})}function A(e){switch(e){case`done`:return`var(--color-emerald)`;case`running`:return`var(--color-cyan)`;case`failed`:return`var(--color-error)`;case`skipped`:return`var(--color-text-secondary)`;case`pending`:return`#fbbf24`;default:return`#9ca3af`}}function j({raw:e,topic:t}){let n=e.tool,r=e.argsPreview,i=e.durationMs,a=e.success;return(0,v.jsxs)(v.Fragment,{children:[n&&(0,v.jsx)(D,{label:`Tool`,children:(0,v.jsx)(`code`,{style:{fontSize:12,color:`rgba(96, 165, 250, 0.9)`},children:n})}),r!==void 0&&(0,v.jsx)(D,{label:`Arguments`,children:(0,v.jsx)(`pre`,{style:{fontSize:11,lineHeight:1.4,color:`rgba(255,255,255,0.7)`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,background:`rgba(255,255,255,0.02)`,padding:12,borderRadius:8,maxHeight:300,overflowY:`auto`},children:typeof r==`string`?r:JSON.stringify(r,null,2)})}),t===`tool:result`&&(0,v.jsx)(D,{label:`Result`,children:(0,v.jsxs)(`div`,{style:{fontSize:13,color:a?`rgba(52,211,153,0.9)`:`rgba(239,68,68,0.9)`},children:[a?`✓ Completed`:`✗ Failed`,i!==void 0&&(0,v.jsxs)(`span`,{style:{color:`rgba(255,255,255,0.5)`,marginLeft:8},children:[`in `,i,`ms`]})]})})]})}function M({raw:e,topic:t}){let n=e.sessionId,i=e.channel,a=e.userId,o=e.message,s=e.toolsUsed||[],l=e.model,u=e.durationMs,[d,f]=(0,c.useState)(null);return(0,c.useEffect)(()=>{n&&r(`/api/sessions/${n}`).then(e=>e.ok?e.json():null).then(e=>{let t=Array.isArray(e)?e:e?.messages||[];f(t)}).catch(()=>{})},[n]),(0,v.jsxs)(v.Fragment,{children:[i&&(0,v.jsx)(D,{label:`Channel`,children:(0,v.jsxs)(`div`,{style:{fontSize:13},children:[i,a&&(0,v.jsxs)(`span`,{style:{color:`rgba(255,255,255,0.4)`},children:[` · `,a]})]})}),o&&(0,v.jsx)(D,{label:t===`turn:pre`?`What they said`:`Message`,children:(0,v.jsx)(`div`,{style:{fontSize:13,lineHeight:1.5,color:`rgba(255,255,255,0.8)`,padding:12,background:`rgba(255,255,255,0.02)`,borderRadius:8},children:o})}),t===`turn:post`&&(0,v.jsx)(D,{label:`Turn stats`,children:(0,v.jsxs)(`div`,{style:{fontSize:12,color:`rgba(255,255,255,0.55)`,lineHeight:1.6},children:[u!==void 0&&(0,v.jsxs)(`div`,{children:[`Took `,(u/1e3).toFixed(1),`s`]}),l&&(0,v.jsxs)(`div`,{children:[`Model: `,l]}),s.length>0&&(0,v.jsxs)(`div`,{children:[`Used: `,s.join(`, `)]})]})}),d&&d.length>0&&(0,v.jsx)(D,{label:`Session messages`,children:(0,v.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10,maxHeight:400,overflowY:`auto`},children:d.slice(-8).map((e,t)=>(0,v.jsxs)(`div`,{style:{padding:10,borderRadius:8,background:e.role===`assistant`?`rgba(167, 139, 250, 0.06)`:`rgba(255,255,255,0.02)`,borderLeft:`2px solid ${e.role===`assistant`?`var(--color-purple-light)`:`rgba(255,255,255,0.2)`}`,fontSize:12},children:[(0,v.jsx)(`div`,{style:{fontSize:10,textTransform:`uppercase`,letterSpacing:`0.1em`,color:`rgba(255,255,255,0.35)`,marginBottom:4},children:String(e.role||`?`)}),(0,v.jsxs)(`div`,{style:{color:`rgba(255,255,255,0.85)`,lineHeight:1.5,whiteSpace:`pre-wrap`},children:[String(e.content||``).slice(0,400),String(e.content||``).length>400&&`…`]})]},t))})})]})}function N({raw:e,topic:t}){let n=e.drives||[],r=e.totalPressure,i=e.dominantDrives||[];return(0,v.jsxs)(v.Fragment,{children:[r!==void 0&&(0,v.jsx)(D,{label:`Pressure snapshot`,children:(0,v.jsxs)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.75)`},children:[`Total: `,(0,v.jsx)(`strong`,{children:r.toFixed(3)}),i.length>0&&(0,v.jsxs)(`span`,{children:[` · Dominant: `,i.map(e=>e[0].toUpperCase()+e.slice(1)).join(`, `)]})]})}),n.length>0&&t===`drive:tick`&&(0,v.jsx)(D,{label:`All drives this tick`,children:(0,v.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:n.map((e,t)=>(0,v.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 10px`,borderRadius:8,background:`rgba(255,255,255,0.02)`,fontSize:12},children:[(0,v.jsx)(`span`,{style:{flex:1,fontWeight:500},children:String(e.label||e.id)}),(0,v.jsxs)(`span`,{style:{color:`rgba(255,255,255,0.55)`,fontVariantNumeric:`tabular-nums`},children:[`sat `,(Number(e.satisfaction)*100).toFixed(0),`% · sp `,(Number(e.setpoint)*100).toFixed(0),`%`]}),(0,v.jsx)(`span`,{style:{color:Number(e.pressure)>0?`#fbbf24`:`rgba(255,255,255,0.25)`,fontVariantNumeric:`tabular-nums`,width:50,textAlign:`right`},children:Number(e.pressure).toFixed(2)})]},t))})})]})}function P({raw:e,topic:t}){if(t===`initiative:round`){let t=e.round,n=e.maxRounds,r=e.subtaskTitle;return(0,v.jsx)(D,{label:`What's happening`,children:(0,v.jsxs)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.8)`,lineHeight:1.6},children:[`TITAN is reasoning through round `,(0,v.jsx)(`strong`,{children:t}),` of `,(0,v.jsx)(`strong`,{children:n}),r&&(0,v.jsxs)(v.Fragment,{children:[` on the subtask `,(0,v.jsxs)(`em`,{style:{color:`rgba(167, 139, 250, 0.9)`},children:[`"`,r,`"`]})]}),`.`,(0,v.jsx)(`br`,{}),(0,v.jsx)(`br`,{}),`Each round is one tool-calling cycle — the agent thinks, picks a tool, runs it, then thinks again with the result. The cycle continues until the subtask is complete or the round budget runs out.`]})})}if(t===`initiative:start`){let t=e.subtaskTitle,n=e.goalTitle;return(0,v.jsx)(D,{label:`What's happening`,children:(0,v.jsxs)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.8)`,lineHeight:1.6},children:[`TITAN picked up a task and started working.`,t&&(0,v.jsxs)(v.Fragment,{children:[` Subtask: `,(0,v.jsxs)(`em`,{style:{color:`rgba(167, 139, 250, 0.9)`},children:[`"`,t,`"`]}),`.`]}),n&&(0,v.jsxs)(v.Fragment,{children:[` Part of goal: `,(0,v.jsxs)(`em`,{style:{color:`rgba(52, 211, 153, 0.9)`},children:[`"`,n,`"`]}),`.`]})]})})}if(t===`initiative:complete`){let t=e.success,n=e.toolsUsed||[],r=e.summary;return(0,v.jsxs)(D,{label:`Result`,children:[(0,v.jsxs)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.8)`,lineHeight:1.6},children:[t===!1?`The task ran but ended without full success.`:`Task complete.`,n.length>0&&(0,v.jsxs)(v.Fragment,{children:[` Tools used: `,n.join(`, `),`.`]})]}),r&&(0,v.jsx)(`div`,{style:{marginTop:8,padding:10,borderRadius:8,background:`rgba(255,255,255,0.02)`,fontSize:12,lineHeight:1.5,color:`rgba(255,255,255,0.7)`},children:r})]})}if(t===`initiative:no_progress`){let t=e.reason;return(0,v.jsx)(D,{label:`Why it paused`,children:(0,v.jsx)(`div`,{style:{fontSize:13,color:`rgba(251, 191, 36, 0.9)`,lineHeight:1.6},children:t||`Ran but couldn't advance.`})})}if(t===`dreaming:consolidated`)return(0,v.jsx)(D,{label:`What's happening`,children:(0,v.jsx)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.8)`,lineHeight:1.6},children:`TITAN periodically consolidates recent memories — merging related facts, pruning stale ones, strengthening frequently-accessed associations. It's how it keeps the memory graph fast without losing useful context.`})});if(t===`daemon:started`||t===`daemon:resumed`)return(0,v.jsx)(D,{label:`What's happening`,children:(0,v.jsx)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.8)`,lineHeight:1.6},children:`TITAN's background daemon came online. All watchers (goals, cron, health, memory, drive ticks, Facebook autopilot) are active.`})});if(t===`daemon:paused`)return(0,v.jsx)(D,{label:`What's happening`,children:(0,v.jsx)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.8)`,lineHeight:1.6},children:`Background work is paused. Chat still works; cron, autopilot, and Soma ticks are halted until resumed.`})});if(t.startsWith(`health:`))return(0,v.jsx)(D,{label:`Health alert`,children:(0,v.jsx)(`div`,{style:{fontSize:13,color:`rgba(251, 191, 36, 0.9)`,lineHeight:1.6},children:`A subsystem reported a health issue. Check the Console tab for diagnostics.`})});if(t===`agent:spawned`||t===`agent:stopped`){let n=e.name,r=e.model;return(0,v.jsx)(D,{label:`What's happening`,children:(0,v.jsxs)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.8)`,lineHeight:1.6},children:[t===`agent:spawned`?`Spawned`:`Stopped`,` sub-agent`,n&&(0,v.jsxs)(v.Fragment,{children:[` `,(0,v.jsx)(`strong`,{children:n})]}),r&&t===`agent:spawned`&&(0,v.jsxs)(v.Fragment,{children:[` running `,r]}),`.`]})})}if(t===`agent:task:completed`||t===`agent:task:failed`){let n=e.agentId,r=e.reason,i=e.success;return(0,v.jsx)(D,{label:`Sub-agent result`,children:(0,v.jsxs)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.8)`,lineHeight:1.6},children:[n&&(0,v.jsxs)(v.Fragment,{children:[`Sub-agent `,(0,v.jsx)(`strong`,{children:n}),` `]}),t===`agent:task:completed`&&i!==!1?`finished its task successfully.`:r?`couldn\'t complete: ${r}.`:`did not complete its task.`]})})}return(0,v.jsx)(F,{raw:e})}function F({raw:e}){let t=Object.entries(e||{}).filter(([e])=>e!==`timestamp`);return t.length===0?null:(0,v.jsx)(D,{label:`Details`,children:(0,v.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:t.slice(0,8).map(([e,t])=>(0,v.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:12,padding:`6px 10px`,borderRadius:6,background:`rgba(255,255,255,0.02)`,fontSize:11},children:[(0,v.jsx)(`span`,{style:{color:`rgba(255,255,255,0.4)`},children:e}),(0,v.jsx)(`span`,{style:{color:`rgba(255,255,255,0.8)`,fontFamily:`ui-monospace, monospace`,textAlign:`right`,wordBreak:`break-all`},children:I(t)})]},e))})})}function I(e){if(e==null)return`—`;if(typeof e==`string`)return e.length>80?e.slice(0,77)+`…`:e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e).slice(0,80)}catch{return`[object]`}}function L({label:e,raw:t}){let[n,r]=(0,c.useState)(!1);return(0,v.jsxs)(`div`,{style:{borderTop:`1px solid rgba(255,255,255,0.06)`},children:[(0,v.jsxs)(`button`,{onClick:()=>r(e=>!e),style:{width:`100%`,padding:`14px 24px`,background:`transparent`,border:0,color:`rgba(255,255,255,0.5)`,fontSize:11,textTransform:`uppercase`,letterSpacing:`0.15em`,fontWeight:600,textAlign:`left`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,v.jsx)(`span`,{children:e}),(0,v.jsx)(`span`,{style:{fontSize:14},children:n?`−`:`+`})]}),n&&(0,v.jsx)(`pre`,{style:{margin:0,padding:`0 24px 20px`,fontSize:10,lineHeight:1.4,color:`rgba(255,255,255,0.5)`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,maxHeight:300,overflowY:`auto`},children:JSON.stringify(t,null,2)})]})}function R(){let[e]=i(),t=e.get(`kiosk`)===`1`,[n,r]=(0,c.useState)(e.get(`voice`)===`control`?`control`:`titan`),[a,o]=(0,c.useState)(null),{drives:s,events:l,connected:u,reconnecting:f,lastActivity:p}=_(),m=p>0&&Date.now()-p<1e4,h=typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches;(0,c.useEffect)(()=>{if(!t)return;let e=null,n=async()=>{try{`wakeLock`in navigator&&(e=await navigator.wakeLock.request(`screen`))}catch{}};n();let r=()=>{document.visibilityState===`visible`&&n()};return document.addEventListener(`visibilitychange`,r),()=>{document.removeEventListener(`visibilitychange`,r),e?.release?.()}},[t]);let g=(0,c.useMemo)(()=>u?`live`:f?`reconnecting…`:`connecting…`,[u,f]),y=u?`var(--color-emerald)`:f?`#fbbf24`:`#6b7280`;return(0,v.jsxs)(`div`,{style:{position:t?`fixed`:`relative`,inset:t?0:void 0,height:`100%`,width:`100%`,minHeight:t?`100vh`:`100%`,background:`radial-gradient(ellipse at 20% 30%, rgba(167, 139, 250, 0.06) 0%, transparent 55%), radial-gradient(ellipse at 80% 70%, rgba(34, 211, 238, 0.05) 0%, transparent 55%), radial-gradient(ellipse at 50% 50%, rgba(52, 211, 153, 0.03) 0%, transparent 60%), #05060a`,color:`#f8f9fc`,overflow:`hidden`,fontFamily:`-apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif`,display:`flex`,flexDirection:`column`,zIndex:t?9999:void 0},children:[(0,v.jsx)(`div`,{"aria-hidden":!0,style:{position:`absolute`,inset:0,opacity:.03,pointerEvents:`none`,backgroundImage:`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='0.8'/></svg>")`}}),(0,v.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,padding:t?`32px 40px`:`20px 24px`,minHeight:0,zIndex:1},children:[!t&&(0,v.jsxs)(`header`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:16,fontSize:13},children:[(0,v.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,color:`rgba(255,255,255,0.5)`,fontWeight:600,letterSpacing:`0.02em`},children:[(0,v.jsx)(`div`,{style:{width:8,height:8,borderRadius:`50%`,background:y,boxShadow:`0 0 10px ${y}`,animation:`watch-pulse 2s ease-in-out infinite`}}),(0,v.jsx)(`span`,{children:`TITAN`}),(0,v.jsx)(`span`,{style:{opacity:.4},children:`·`}),(0,v.jsx)(`span`,{children:g})]}),(0,v.jsx)(`div`,{style:{display:`flex`,gap:2,background:`rgba(20, 24, 36, 0.6)`,border:`1px solid rgba(80, 90, 120, 0.25)`,borderRadius:999,padding:2},children:[`titan`,`control`].map(e=>(0,v.jsx)(`button`,{onClick:()=>r(e),style:{background:n===e?`#f8f9fc`:`transparent`,color:n===e?`#05060a`:`rgba(255,255,255,0.55)`,border:0,padding:`6px 14px`,borderRadius:999,cursor:`pointer`,fontSize:11,fontWeight:600,letterSpacing:`0.02em`,transition:`all 0.15s`,textTransform:`uppercase`},children:e===`titan`?`TITAN`:`Mission`},e))})]}),(0,v.jsxs)(`main`,{style:{display:`grid`,gridTemplateColumns:`minmax(0, 1.05fr) minmax(0, 1fr)`,gridTemplateRows:`auto 1fr`,gridTemplateAreas:`"focus activity" "organism activity"`,gap:t?28:18,flex:1,minHeight:0},className:`watch-grid`,children:[(0,v.jsx)(z,{gridArea:`focus`,excited:m,children:(0,v.jsx)(b,{events:l,voice:n})}),(0,v.jsxs)(z,{gridArea:`organism`,excited:m,padding:t?24:16,children:[(0,v.jsx)(`div`,{style:{fontSize:10,textTransform:`uppercase`,letterSpacing:`0.15em`,color:`rgba(255,255,255,0.35)`,fontWeight:600,marginBottom:6},children:`How I'm feeling`}),(0,v.jsx)(`div`,{style:{flex:1,minHeight:t?320:220},children:(0,v.jsx)(w,{drives:s,excited:m,reducedMotion:h})}),(0,v.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`,gap:8,marginTop:10,fontSize:11},children:s.map(e=>{let t=(e.pressure||0)>.01;return(0,v.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`6px 10px`,borderRadius:8,background:t?`rgba(251, 191, 36, 0.08)`:`rgba(255,255,255,0.02)`,border:`1px solid ${t?`rgba(251, 191, 36, 0.3)`:`rgba(255,255,255,0.04)`}`},title:e.description||`${e.label}: satisfaction ${e.satisfaction.toFixed(2)}, setpoint ${e.setpoint.toFixed(2)}`,children:[(0,v.jsx)(`div`,{style:{width:8,height:8,borderRadius:`50%`,background:d(e.id),boxShadow:`0 0 8px ${d(e.id)}`}}),(0,v.jsx)(`div`,{style:{flex:1,color:`rgba(255,255,255,0.65)`,fontWeight:500},children:e.label}),(0,v.jsxs)(`div`,{style:{color:`rgba(255,255,255,0.35)`,fontVariantNumeric:`tabular-nums`},children:[Math.round((e.satisfaction||0)*100),`%`]})]},e.id)})})]}),(0,v.jsxs)(z,{gridArea:`activity`,excited:m,children:[(0,v.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:12},children:[(0,v.jsx)(`div`,{style:{fontSize:10,textTransform:`uppercase`,letterSpacing:`0.15em`,color:`rgba(255,255,255,0.35)`,fontWeight:600},children:`Recent activity`}),(0,v.jsxs)(`div`,{style:{fontSize:11,color:`rgba(255,255,255,0.35)`,fontVariantNumeric:`tabular-nums`},children:[l.length,` `,l.length===1?`event`:`events`]})]}),(0,v.jsx)(`div`,{style:{flex:1,overflowY:`auto`,minHeight:0,maskImage:`linear-gradient(to bottom, transparent 0, black 16px, black calc(100% - 16px), transparent 100%)`,WebkitMaskImage:`linear-gradient(to bottom, transparent 0, black 16px, black calc(100% - 16px), transparent 100%)`,paddingRight:4},children:(0,v.jsx)(S,{events:l,voice:n,onEventClick:o})})]})]})]}),(0,v.jsx)(T,{event:a,voice:n,onClose:()=>o(null)}),(0,v.jsx)(`style`,{children:`
2
+ @keyframes watch-pulse {
3
+ 0%, 100% { opacity: 1; transform: scale(1); }
4
+ 50% { opacity: 0.6; transform: scale(0.85); }
5
+ }
6
+ @media (max-width: 820px) {
7
+ .watch-grid {
8
+ grid-template-columns: 1fr !important;
9
+ grid-template-rows: auto auto 1fr !important;
10
+ grid-template-areas: "focus" "organism" "activity" !important;
11
+ }
12
+ }
13
+ `})]})}function z({gridArea:e,children:t,excited:n,padding:r=20}){return(0,v.jsx)(`section`,{style:{gridArea:e,background:`rgba(20, 24, 36, 0.6)`,border:`1px solid ${n?`rgba(167, 139, 250, 0.35)`:`rgba(80, 90, 120, 0.25)`}`,borderRadius:20,padding:r,backdropFilter:`blur(10px)`,WebkitBackdropFilter:`blur(10px)`,display:`flex`,flexDirection:`column`,minHeight:0,transition:`border-color 0.5s`,position:`relative`,overflow:`hidden`},children:t})}export{R 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"./external-link-CpQLWKKE.js";import{t as i}from"./pause-C4TDJSfA.js";import{t as a}from"./play-9WxZWVHA.js";import{t as o}from"./plus-CHryCIkk.js";import{t as s}from"./rotate-ccw-Cw1T2W1T.js";import{t as c}from"./trash-2-CwUv7ww1.js";import{H as l,a as u,j as d,s as f}from"./index-WI-E4I3h.js";import{a as p,i as m}from"./ConfirmDialog-6hcNjmAh.js";var h=e(t(),1),g=n();function _({open:e,approval:t,onClose:n}){let[i,a]=(0,h.useState)(null),[o,s]=(0,h.useState)(!1),[c,u]=(0,h.useState)(!1),d=t?.payload?.goalId;if((0,h.useEffect)(()=>{if(!e||!d){a(null),u(!1);return}let t=!1,n=async()=>{try{let e=await l(`/api/goals/${d}`);if(!e.ok){t||(u(!0),s(!1));return}let n=await e.json();if(t)return;a(n.goal||n),u(!1),s(!1)}catch{t||(u(!0),s(!1))}};s(!0),n();let r=setInterval(n,5e3);return()=>{t=!0,clearInterval(r)}},[e,d]),(0,h.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,n]),!t)return null;let _=t.title||t.payload?.title||`Approval`,y=t.payload?.rationale;return(0,g.jsx)(p,{children:e&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(m.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.18},onClick:n,style:{position:`fixed`,inset:0,background:`rgba(0, 0, 0, 0.55)`,backdropFilter:`blur(4px)`,WebkitBackdropFilter:`blur(4px)`,zIndex:99}},`backdrop`),(0,g.jsxs)(m.aside,{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`},transition:{duration:.28,ease:[.32,.72,0,1]},style:{position:`fixed`,top:0,right:0,bottom:0,width:`min(540px, 100vw)`,background:`rgba(10, 12, 20, 0.96)`,backdropFilter:`blur(24px)`,WebkitBackdropFilter:`blur(24px)`,borderLeft:`1px solid rgba(167, 139, 250, 0.15)`,display:`flex`,flexDirection:`column`,zIndex:100,color:`#f8f9fc`,boxShadow:`-20px 0 60px rgba(0,0,0,0.5)`},role:`dialog`,"aria-modal":`true`,children:[(0,g.jsxs)(`div`,{style:{padding:`20px 24px`,borderBottom:`1px solid rgba(255,255,255,0.06)`,display:`flex`,alignItems:`flex-start`,gap:12},children:[(0,g.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,g.jsx)(`div`,{style:{fontSize:10,textTransform:`uppercase`,letterSpacing:`0.15em`,color:`rgba(255,255,255,0.35)`,fontWeight:600,marginBottom:6},children:`Proposal`}),(0,g.jsx)(`div`,{style:{fontSize:17,fontWeight:600,lineHeight:1.3,marginBottom:6},children:_}),(0,g.jsx)(`div`,{style:{fontSize:11,color:`rgba(255,255,255,0.35)`},children:(0,g.jsx)(b,{status:t.status})})]}),(0,g.jsx)(`button`,{onClick:n,"aria-label":`Close`,style:{background:`transparent`,border:0,color:`rgba(255,255,255,0.55)`,cursor:`pointer`,padding:6,borderRadius:8},children:(0,g.jsx)(f,{size:18})})]}),(0,g.jsxs)(`div`,{style:{flex:1,overflowY:`auto`,padding:`20px 24px`},children:[y&&(0,g.jsx)(S,{label:`Why this`,children:(0,g.jsx)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.75)`,lineHeight:1.5},children:y})}),!d&&t.status===`pending`&&(0,g.jsx)(S,{label:`Status`,children:(0,g.jsx)(`div`,{style:{fontSize:13,color:`rgba(251, 191, 36, 0.9)`},children:`Waiting for approval. Once approved, a goal will be created and TITAN will start working on it.`})}),!d&&t.status===`rejected`&&(0,g.jsx)(S,{label:`Status`,children:(0,g.jsx)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.5)`},children:`Rejected. No work started.`})}),d&&(0,g.jsxs)(g.Fragment,{children:[o&&!i&&(0,g.jsx)(S,{label:`Progress`,children:(0,g.jsx)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.4)`},children:`Loading goal…`})}),c&&(0,g.jsx)(S,{label:`Progress`,children:(0,g.jsx)(`div`,{style:{fontSize:13,color:`rgba(255,255,255,0.4)`},children:`Goal linked to this approval wasn't found (may have been deleted).`})}),i&&(0,g.jsx)(v,{goal:i})]})]}),(0,g.jsxs)(`div`,{style:{padding:`14px 24px`,borderTop:`1px solid rgba(255,255,255,0.06)`,display:`flex`,gap:10},children:[d&&(0,g.jsxs)(`a`,{href:`/command-post`,onClick:e=>{e.preventDefault(),window.location.hash=`#watch`,n()},style:{display:`inline-flex`,alignItems:`center`,gap:6,padding:`8px 14px`,borderRadius:8,background:`rgba(167, 139, 250, 0.12)`,color:`#c4b5fd`,fontSize:12,fontWeight:500,textDecoration:`none`,cursor:`pointer`},children:[(0,g.jsx)(r,{size:12}),` Watch live`]}),(0,g.jsx)(`button`,{onClick:n,style:{padding:`8px 14px`,borderRadius:8,background:`rgba(255,255,255,0.04)`,border:0,color:`rgba(255,255,255,0.55)`,fontSize:12,cursor:`pointer`},children:`Close`})]})]},`panel`)]})})}function v({goal:e}){let t=e.subtasks||[],n=t.filter(e=>e.status===`done`||e.status===`skipped`).length,r=t.filter(e=>e.status===`failed`).length,i=t.filter(e=>e.status===`running`).length,a=t.length?n/t.length*100:e.progress||0;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(S,{label:`Progress`,children:[(0,g.jsxs)(`div`,{style:{marginBottom:10},children:[(0,g.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:12,marginBottom:6},children:[(0,g.jsxs)(`span`,{style:{color:`rgba(255,255,255,0.6)`},children:[n,` / `,t.length,` complete`]}),(0,g.jsxs)(`span`,{style:{color:`rgba(255,255,255,0.4)`,fontVariantNumeric:`tabular-nums`},children:[a.toFixed(0),`%`]})]}),(0,g.jsx)(`div`,{style:{height:6,borderRadius:3,background:`rgba(255,255,255,0.04)`,overflow:`hidden`},children:(0,g.jsx)(`div`,{style:{width:`${a}%`,height:`100%`,background:r>0?`linear-gradient(to right, #34d399, #fbbf24)`:`var(--color-emerald)`,transition:`width 0.5s`}})})]}),(0,g.jsxs)(`div`,{style:{fontSize:11,color:`rgba(255,255,255,0.4)`,display:`flex`,gap:12},children:[(0,g.jsx)(b,{status:e.status}),i>0&&(0,g.jsxs)(`span`,{children:[`· `,i,` running`]}),r>0&&(0,g.jsxs)(`span`,{style:{color:`rgba(239, 68, 68, 0.9)`},children:[`· `,r,` failed`]})]})]}),t.length>0&&(0,g.jsx)(S,{label:`Subtasks`,children:(0,g.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:t.map(t=>(0,g.jsx)(y,{goalId:e.id,subtask:t},t.id))})})]})}function y({goalId:e,subtask:t}){let{toast:n}=u(),r=x(t.status),i=t.status===`running`,[a,o]=(0,h.useState)(!1);return(0,g.jsxs)(`div`,{style:{padding:`10px 12px`,borderRadius:8,background:`rgba(255,255,255,0.02)`,borderLeft:`2px solid ${r}`,fontSize:12},children:[(0,g.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,marginBottom:t.error||t.result?6:0},children:[(0,g.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:r,boxShadow:`0 0 ${i?10:5}px ${r}`,animation:i?`subtask-pulse 1.4s ease-in-out infinite`:`none`,flexShrink:0}}),(0,g.jsx)(`span`,{style:{flex:1,color:`rgba(255,255,255,0.85)`,lineHeight:1.4},children:t.title}),t.status===`failed`&&(0,g.jsx)(`button`,{onClick:async()=>{o(!0);try{await l(`/api/goals/${e}/subtasks/${t.id}/retry`,{method:`POST`}),n(`success`,`Subtask reset and retried.`)}catch(e){n(`error`,`Couldn't retry subtask — try again. (${e.message})`)}o(!1)},disabled:a,title:`Reset + retry`,style:{background:`transparent`,border:0,padding:4,borderRadius:4,color:`#fbbf24`,cursor:`pointer`,opacity:a?.4:.8},children:(0,g.jsx)(s,{size:12})}),t.status===`pending`&&(0,g.jsx)(`button`,{onClick:async()=>{o(!0);try{await l(`/api/goals/${e}/subtasks/${t.id}/complete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({result:`Marked complete from Command Post`})}),n(`success`,`Subtask marked done.`)}catch(e){n(`error`,`Couldn't mark subtask done — try again. (${e.message})`)}o(!1)},disabled:a,title:`Mark done`,style:{background:`transparent`,border:0,padding:4,borderRadius:4,color:`var(--color-emerald)`,cursor:`pointer`,opacity:a?.4:.8},children:(0,g.jsx)(d,{size:12})}),(0,g.jsx)(`span`,{style:{fontSize:10,textTransform:`uppercase`,letterSpacing:`0.1em`,color:r,fontWeight:600,flexShrink:0},children:t.status})]}),t.error&&(0,g.jsx)(`div`,{style:{fontSize:11,color:`rgba(239, 68, 68, 0.85)`,padding:`6px 8px`,borderRadius:6,background:`rgba(239, 68, 68, 0.06)`,marginLeft:18},children:t.error}),t.result&&t.status===`done`&&(0,g.jsxs)(`div`,{style:{fontSize:11,color:`rgba(255,255,255,0.55)`,lineHeight:1.4,marginLeft:18,marginTop:4},children:[t.result.slice(0,240),t.result.length>240?`…`:``]}),(0,g.jsx)(`style`,{children:`@keyframes subtask-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }`})]})}function b({status:e}){let t=x(e);return(0,g.jsx)(`span`,{style:{display:`inline-block`,padding:`2px 8px`,borderRadius:999,background:`${t}15`,color:t,fontSize:10,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.1em`},children:e})}function x(e){switch(e){case`done`:case`completed`:case`approved`:case`active`:return`var(--color-emerald)`;case`running`:return`var(--color-cyan)`;case`failed`:case`rejected`:return`var(--color-error)`;case`skipped`:return`var(--color-text-secondary)`;case`pending`:case`paused`:return`#fbbf24`;default:return`#9ca3af`}}function S({label:e,children:t}){return(0,g.jsxs)(`div`,{style:{marginBottom:20},children:[(0,g.jsx)(`div`,{style:{fontSize:10,textTransform:`uppercase`,letterSpacing:`0.15em`,color:`rgba(255,255,255,0.35)`,fontWeight:600,marginBottom:8},children:e}),t]})}function C(){let[e,t]=(0,h.useState)([]),[n,r]=(0,h.useState)(!0),[i,s]=(0,h.useState)(null),[d,f]=(0,h.useState)(null),[v,y]=(0,h.useState)(!1),[b,x]=(0,h.useState)(null),[S,C]=(0,h.useState)(null),{toast:O}=u(),k=async()=>{try{let e=await l(`/api/goals`);if(e.ok){let n=await e.json();t(n.goals||[])}}catch{}},A=async e=>{C(e.id);let t=e.status===`paused`?`active`:`paused`;try{await l(`/api/goals/${e.id}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:t})}),await k()}catch(e){O(`error`,`Update failed: ${e.message}`)}C(null)},j=async e=>{C(e.id);try{await l(`/api/goals/${e.id}`,{method:`DELETE`}),await k()}catch(e){O(`error`,`Delete failed: ${e.message}`)}C(null),x(null)},M=async e=>{C(e.id);try{let t=(e.subtasks||[]).filter(e=>e.status===`failed`);for(let n of t)await l(`/api/goals/${e.id}/subtasks/${n.id}/retry`,{method:`POST`});e.status!==`active`&&await l(`/api/goals/${e.id}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:`active`})}),await k()}catch(e){O(`error`,`Restart failed: ${e.message}`)}C(null)};(0,h.useEffect)(()=>{let e=!0,n=async()=>{try{let n=await l(`/api/goals`);if(!n.ok)return;let i=await n.json();if(!e)return;t(i.goals||[]),r(!1)}catch{}};n();let i=setInterval(n,1e4);return()=>{e=!1,clearInterval(i)}},[]),(0,h.useEffect)(()=>{let e=localStorage.getItem(`titan-token`)||localStorage.getItem(`titan_token`)||``,t=`/api/watch/stream${e?`?token=${encodeURIComponent(e)}`:``}`,n=new EventSource(t);return n.onmessage=e=>{try{let t=JSON.parse(e.data);if(t.type!==`event`)return;if(t.topic===`initiative:start`||t.topic===`initiative:round`){let e=t.raw||{};f({goalTitle:e.goalTitle||``,subtaskTitle:e.subtaskTitle||``,round:e.round,maxRounds:e.maxRounds})}(t.topic===`initiative:complete`||t.topic===`initiative:no_progress`)&&f(null)}catch{}},n.onerror=()=>{},()=>n.close()},[]);let N=(0,h.useMemo)(()=>e.filter(e=>e.status===`active`).sort((e,t)=>(e.priority||5)-(t.priority||5)),[e]),P=(0,h.useMemo)(()=>e.filter(e=>e.status===`paused`),[e]),F=(0,h.useMemo)(()=>e.filter(e=>e.status===`completed`).sort((e,t)=>(t.completedAt||t.updatedAt||``).localeCompare(e.completedAt||e.updatedAt||``)).slice(0,5),[e]),I=(0,h.useMemo)(()=>{let e=[];for(let t of N){let n=new Set((t.subtasks||[]).filter(e=>e.status===`done`||e.status===`skipped`).map(e=>e.id));for(let r of t.subtasks||[])r.status===`pending`&&(r.dependsOn||[]).every(e=>n.has(e))&&e.push({goal:t,subtask:r})}return e},[N]),L=(0,h.useMemo)(()=>{let t=[];for(let n of e)if(!(n.status!==`active`&&n.status!==`paused`))for(let e of n.subtasks||[])e.status===`failed`&&t.push({goal:n,subtask:e});return t.slice(0,5)},[e]);return n?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-64 text-sm text-text-muted`,children:`Loading work…`}):(0,g.jsxs)(`div`,{className:`space-y-6`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`text-[11px] text-text-muted`,children:[e.filter(e=>e.status===`active`).length,` active · `,e.filter(e=>e.status===`paused`).length,` paused · `,e.filter(e=>e.status===`completed`).length,` completed`]}),(0,g.jsxs)(`button`,{onClick:()=>y(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-[12px] font-medium rounded-lg bg-indigo-600 text-white hover:bg-indigo-500 transition-colors`,children:[(0,g.jsx)(o,{size:13}),` New goal`]})]}),(0,g.jsx)(E,{label:`Now`,count:+!!d,children:(0,g.jsx)(p,{mode:`wait`,children:d?(0,g.jsxs)(m.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0},transition:{duration:.25},className:`p-4 rounded-xl border border-cyan-500/20 bg-cyan-500/[0.04]`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,g.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full bg-cyan-400 animate-pulse`,style:{boxShadow:`0 0 12px #22d3ee`}}),(0,g.jsx)(`span`,{className:`text-[11px] text-cyan-300 uppercase tracking-wider font-semibold`,children:`executing`}),d.round&&d.maxRounds&&(0,g.jsxs)(`span`,{className:`text-[11px] text-text-muted`,children:[`round `,d.round,`/`,d.maxRounds]})]}),(0,g.jsx)(`div`,{className:`text-[15px] font-medium text-white/95 mb-1`,children:d.subtaskTitle||`(unnamed subtask)`}),d.goalTitle&&(0,g.jsxs)(`div`,{className:`text-[11px] text-text-muted`,children:[`in goal: `,d.goalTitle]})]},`${d.goalTitle}-${d.subtaskTitle}`):(0,g.jsxs)(m.div,{initial:{opacity:0},animate:{opacity:1},className:`p-6 rounded-xl border border-border text-center`,children:[(0,g.jsx)(`div`,{className:`text-[13px] text-text-muted`,children:`Nothing running right now.`}),(0,g.jsx)(`div`,{className:`text-[11px] text-text-muted mt-1`,children:I.length>0?`${I.length} task${I.length===1?``:`s`} queued — TITAN will start within 10 seconds`:N.length>0?`${N.length} goal${N.length===1?``:`s`} active — waiting for driver to begin`:`No work in queue. Approve a proposal from the Inbox to get started.`})]},`idle`)})}),I.length>0&&(0,g.jsx)(E,{label:`Up next`,count:I.length,children:(0,g.jsx)(`div`,{className:`space-y-2`,children:I.slice(0,3).map(({goal:e,subtask:t},n)=>(0,g.jsxs)(`div`,{onClick:()=>s(e),className:`flex items-center gap-3 p-3 rounded-lg bg-bg-secondary/30 border border-border/30 hover:bg-bg-secondary cursor-pointer transition-colors`,children:[(0,g.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-amber-400/60`}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`div`,{className:`text-[13px] text-white/85 truncate`,children:t.title}),(0,g.jsx)(`div`,{className:`text-[11px] text-text-muted truncate`,children:e.title})]}),n===0&&(0,g.jsx)(`span`,{className:`text-[10px] text-cyan-300/70 uppercase tracking-wider`,children:`next`})]},`${e.id}-${t.id}`))})}),(0,g.jsx)(E,{label:`Active goals`,count:N.length,children:N.length===0?(0,g.jsx)(`div`,{className:`p-6 rounded-xl border border-border text-center text-[12px] text-text-muted`,children:`No active goals. TITAN is idle. (Soma may propose one shortly.)`}):(0,g.jsx)(`div`,{className:`space-y-2`,children:N.map(e=>(0,g.jsx)(T,{goal:e,busy:S===e.id,onClick:()=>s(e),onPauseToggle:()=>A(e),onDelete:()=>x(e),onRestart:()=>M(e)},e.id))})}),F.length>0&&(0,g.jsx)(E,{label:`Recently done`,count:F.length,children:(0,g.jsx)(`div`,{className:`space-y-2`,children:F.map(e=>(0,g.jsxs)(`div`,{onClick:()=>s(e),className:`flex items-center gap-3 p-3 rounded-lg bg-emerald-500/[0.03] border border-emerald-500/10 hover:bg-emerald-500/[0.06] cursor-pointer`,children:[(0,g.jsx)(`span`,{className:`text-emerald-400`,children:`✓`}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`div`,{className:`text-[13px] text-white/85 truncate`,children:e.title}),(0,g.jsxs)(`div`,{className:`text-[11px] text-text-muted`,children:[`completed `,D(e.completedAt||e.updatedAt)]})]})]},e.id))})}),(P.length>0||L.length>0)&&(0,g.jsx)(E,{label:`Needs attention`,count:P.length+L.length,children:(0,g.jsxs)(`div`,{className:`space-y-2`,children:[P.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-lg bg-amber-500/[0.03] border border-amber-500/15 hover:bg-amber-500/[0.06]`,children:[(0,g.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-amber-400`}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0 cursor-pointer`,onClick:()=>s(e),children:[(0,g.jsx)(`div`,{className:`text-[13px] text-white/85 truncate`,children:e.title}),(0,g.jsx)(`div`,{className:`text-[11px] text-text-muted`,children:`paused`})]}),(0,g.jsx)(`button`,{onClick:t=>{t.stopPropagation(),A(e)},disabled:S===e.id,title:`Resume`,className:`p-1.5 rounded hover:bg-bg-tertiary text-emerald-400/70 hover:text-emerald-400 disabled:opacity-40`,children:(0,g.jsx)(a,{size:12})}),(0,g.jsx)(`button`,{onClick:t=>{t.stopPropagation(),x(e)},disabled:S===e.id,title:`Delete`,className:`p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-red-400 disabled:opacity-40`,children:(0,g.jsx)(c,{size:12})})]},e.id)),L.map(({goal:e,subtask:t})=>(0,g.jsxs)(`div`,{onClick:()=>s(e),className:`flex items-start gap-3 p-3 rounded-lg bg-red-500/[0.03] border border-red-500/15 hover:bg-red-500/[0.06] cursor-pointer`,children:[(0,g.jsx)(`span`,{className:`text-red-400 mt-0.5`,children:`✗`}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`div`,{className:`text-[13px] text-white/85 truncate`,children:t.title}),(0,g.jsxs)(`div`,{className:`text-[11px] text-text-muted truncate`,children:[`in `,e.title]}),t.error&&(0,g.jsx)(`div`,{className:`text-[11px] text-red-300/70 mt-1 truncate`,children:t.error})]})]},`${e.id}-${t.id}`))]})}),(0,g.jsx)(_,{open:i!==null,approval:i?{id:i.id,title:i.title,status:i.status,payload:{goalId:i.id,title:i.title,description:i.description,rationale:i.description}}:null,onClose:()=>s(null)}),(0,g.jsx)(w,{open:v,onClose:()=>y(!1),onCreated:async()=>{y(!1),await k()}}),(0,g.jsx)(p,{children:b&&(0,g.jsx)(m.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.7)`,backdropFilter:`blur(6px)`,zIndex:200,display:`flex`,alignItems:`center`,justifyContent:`center`},onClick:()=>x(null),children:(0,g.jsxs)(m.div,{initial:{scale:.96,y:8},animate:{scale:1,y:0},exit:{scale:.96,y:8},onClick:e=>e.stopPropagation(),style:{background:`rgba(15, 17, 26, 0.98)`,border:`1px solid rgba(239, 68, 68, 0.25)`,borderRadius:16,padding:24,maxWidth:440,width:`calc(100% - 32px)`,color:`#f8f9fc`},children:[(0,g.jsx)(`div`,{className:`text-[16px] font-semibold mb-2`,children:`Delete this goal?`}),(0,g.jsx)(`div`,{className:`text-[13px] text-white/55 mb-1`,children:b.title}),(0,g.jsxs)(`div`,{className:`text-[11px] text-text-muted mb-5`,children:[`All `,(b.subtasks||[]).length,` subtasks will be removed. Can't undo.`]}),(0,g.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,g.jsx)(`button`,{onClick:()=>x(null),className:`px-4 py-2 rounded-lg text-[12px] text-text-secondary hover:bg-bg-tertiary`,children:`Cancel`}),(0,g.jsx)(`button`,{onClick:()=>j(b),disabled:S===b.id,className:`px-4 py-2 rounded-lg text-[12px] font-medium bg-red-600 text-white hover:bg-red-500 disabled:opacity-50`,children:`Delete goal`})]})]})})})]})}function w({open:e,onClose:t,onCreated:n}){let[r,i]=(0,h.useState)(``),[a,o]=(0,h.useState)(``),[s,c]=(0,h.useState)([]),[u,d]=(0,h.useState)(``),[_,v]=(0,h.useState)(!1),[y,b]=(0,h.useState)(null);(0,h.useEffect)(()=>{e||(i(``),o(``),c([]),d(``),b(null))},[e]),(0,h.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]);let x=()=>{let e=u.trim();e&&(c(t=>[...t,e]),d(``))};return(0,g.jsx)(p,{children:e&&(0,g.jsx)(m.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.7)`,backdropFilter:`blur(6px)`,zIndex:200,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:16},onClick:t,children:(0,g.jsxs)(m.div,{initial:{scale:.96,y:8},animate:{scale:1,y:0},exit:{scale:.96,y:8},onClick:e=>e.stopPropagation(),style:{background:`rgba(15, 17, 26, 0.98)`,border:`1px solid rgba(99, 102, 241, 0.25)`,borderRadius:16,padding:24,maxWidth:520,width:`100%`,color:`#f8f9fc`},children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between mb-5`,children:[(0,g.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`New goal`}),(0,g.jsx)(`button`,{onClick:t,className:`text-white/55 hover:text-text p-1`,children:(0,g.jsx)(f,{size:18})})]}),(0,g.jsx)(`label`,{className:`text-[10px] uppercase tracking-wider text-text-muted font-semibold block mb-1.5`,children:`Title`}),(0,g.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`Build the Polymarket monitor`,autoFocus:!0,className:`w-full bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[14px] text-white/95 placeholder-white/25 focus:outline-none focus:border-indigo-500/50 mb-4`}),(0,g.jsx)(`label`,{className:`text-[10px] uppercase tracking-wider text-text-muted font-semibold block mb-1.5`,children:`Description (optional)`}),(0,g.jsx)(`textarea`,{value:a,onChange:e=>o(e.target.value),placeholder:`What should TITAN accomplish? Why?`,rows:3,className:`w-full bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[13px] text-white/85 placeholder-white/25 focus:outline-none focus:border-indigo-500/50 resize-none mb-4`}),(0,g.jsx)(`label`,{className:`text-[10px] uppercase tracking-wider text-text-muted font-semibold block mb-1.5`,children:`Subtasks (optional)`}),(0,g.jsx)(`div`,{className:`space-y-1.5 mb-2`,children:s.map((e,t)=>(0,g.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 rounded-lg bg-bg-tertiary/30 border border-border/50`,children:[(0,g.jsxs)(`span`,{className:`text-[11px] text-text-muted tabular-nums`,children:[t+1,`.`]}),(0,g.jsx)(`span`,{className:`flex-1 text-[12px] text-text`,children:e}),(0,g.jsx)(`button`,{onClick:()=>c(e=>e.filter((e,n)=>n!==t)),className:`text-text-muted hover:text-red-400`,"aria-label":`Remove`,children:(0,g.jsx)(f,{size:12})})]},t))}),(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),x())},placeholder:`Add a subtask (press Enter)`,className:`flex-1 bg-bg-tertiary border border-border rounded-lg px-3 py-1.5 text-[12px] text-white/85 placeholder-white/25 focus:outline-none focus:border-indigo-500/50`}),(0,g.jsx)(`button`,{onClick:x,disabled:!u.trim(),className:`px-3 rounded-lg text-[12px] bg-bg-tertiary text-text-secondary hover:bg-bg-tertiary disabled:opacity-30`,children:`Add`})]}),s.length===0&&(0,g.jsx)(`p`,{className:`text-[10px] text-text-muted italic mt-2`,children:`Leaving subtasks empty is fine — TITAN can plan them itself.`}),y&&(0,g.jsx)(`div`,{className:`mt-4 p-2 rounded-lg bg-red-500/[0.08] border border-red-500/20 text-[12px] text-red-300`,children:y}),(0,g.jsxs)(`div`,{className:`flex gap-2 justify-end mt-6`,children:[(0,g.jsx)(`button`,{onClick:t,className:`px-4 py-2 rounded-lg text-[12px] text-text-secondary hover:bg-bg-tertiary`,children:`Cancel`}),(0,g.jsx)(`button`,{onClick:async()=>{if(!r.trim()){b(`Title is required`);return}v(!0),b(null);try{let e={title:r.trim(),description:a.trim()||r.trim(),subtasks:s.map(e=>({title:e,description:e}))},t=await l(`/api/goals`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.text().catch(()=>``);throw Error(e||`HTTP ${t.status}`)}n()}catch(e){b(e.message)}v(!1)},disabled:_||!r.trim(),className:`px-4 py-2 rounded-lg text-[12px] font-medium bg-indigo-600 text-white hover:bg-indigo-500 disabled:opacity-50`,children:_?`Creating…`:`Create goal`})]})]})})})}function T({goal:e,busy:t,onClick:n,onPauseToggle:r,onDelete:o,onRestart:l}){let u=e.subtasks||[],d=u.filter(e=>e.status===`done`||e.status===`skipped`).length,f=u.filter(e=>e.status===`running`).length,p=u.filter(e=>e.status===`failed`).length,m=u.length?d/u.length*100:e.progress||0;return(0,g.jsxs)(`div`,{className:`group p-3 rounded-lg bg-bg-secondary/30 border border-border/50 hover:bg-bg-secondary transition-colors`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 mb-1.5`,children:[(0,g.jsx)(`div`,{onClick:n,className:`flex-1 min-w-0 cursor-pointer`,children:(0,g.jsx)(`div`,{className:`text-[13px] text-text truncate font-medium`,children:e.title})}),(0,g.jsxs)(`span`,{className:`text-[10px] text-text-muted flex-shrink-0 tabular-nums`,children:[d,`/`,u.length]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-0.5 flex-shrink-0`,children:[p>0&&(0,g.jsx)(`button`,{onClick:e=>{e.stopPropagation(),l()},disabled:t,title:`Retry ${p} failed subtask${p===1?``:`s`}`,className:`p-1.5 rounded hover:bg-bg-tertiary text-amber-300/70 hover:text-amber-300 disabled:opacity-40`,children:(0,g.jsx)(s,{size:12})}),(0,g.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r()},disabled:t,title:e.status===`paused`?`Resume`:`Pause`,className:`p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text disabled:opacity-40`,children:e.status===`paused`?(0,g.jsx)(a,{size:12}):(0,g.jsx)(i,{size:12})}),(0,g.jsx)(`button`,{onClick:e=>{e.stopPropagation(),o()},disabled:t,title:`Delete`,className:`p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-red-400 disabled:opacity-40`,children:(0,g.jsx)(c,{size:12})})]})]}),(0,g.jsx)(`div`,{className:`h-1 rounded-full bg-bg-tertiary overflow-hidden mb-2 cursor-pointer`,onClick:n,children:(0,g.jsx)(`div`,{className:`h-full transition-all duration-500`,style:{width:`${m}%`,background:p>0?`linear-gradient(to right, #34d399, #fbbf24)`:`var(--color-emerald)`}})}),(0,g.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-text-muted cursor-pointer`,onClick:n,children:[f>0&&(0,g.jsxs)(`span`,{className:`text-cyan-300/80`,children:[`▶ `,f,` running`]}),p>0&&(0,g.jsxs)(`span`,{className:`text-red-300/80`,children:[`✗ `,p,` failed`]}),f===0&&p===0&&u.length>0&&(0,g.jsxs)(`span`,{children:[u.length-d,` pending`]}),u.length===0&&(0,g.jsx)(`span`,{className:`italic text-text-muted`,children:`no subtasks yet`})]})]})}function E({label:e,count:t,children:n}){return(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,g.jsx)(`h3`,{className:`text-[11px] uppercase tracking-wider text-text-muted font-semibold`,children:e}),t!==void 0&&t>0&&(0,g.jsx)(`span`,{className:`text-[10px] text-text-muted tabular-nums`,children:t})]}),n]})}function D(e){if(!e)return``;let t=Date.parse(e);if(isNaN(t))return``;let n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}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"./createLucideIcon-qnlrxww7.js";import{t as i}from"./play-9WxZWVHA.js";import{t as a}from"./refresh-cw-Disd5wRB.js";import{H as o}from"./index-WI-E4I3h.js";import{t as s}from"./PageHeader-CH85uoZG.js";var c=r(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),l=e(t(),1),u=n(),d={done:`#22c55e`,completed:`#22c55e`,in_progress:`#3b82f6`,running:`#3b82f6`,pending:`#64748b`,blocked:`#f59e0b`,failed:`#ef4444`,skipped:`#475569`};function f(e){let t=new Map(e.map(e=>[e.id,e])),n=new Map,r=(e,i=new Set)=>{if(n.has(e))return n.get(e);if(i.has(e))return 0;i.add(e);let a=(t.get(e)?.dependsOn||[]).filter(e=>t.has(e)),o=a.length===0?0:1+Math.max(...a.map(e=>r(e,i)));return n.set(e,o),o};e.forEach(e=>r(e.id));let i=new Map;e.forEach(e=>{let t=n.get(e.id)??0;i.has(t)||i.set(t,[]),i.get(t).push(e.id)});let a=new Map,o=0;return[...i.entries()].forEach(([e,t])=>t.forEach((t,n)=>{a.set(t,{x:e*240+20,y:n*92+20}),o=Math.max(o,n)})),{pos:a,width:(Math.max(0,...i.keys())+1)*240+40,height:(o+1)*92+40}}var p=190,m=64;function h(){let[e,t]=(0,l.useState)([]),[n,r]=(0,l.useState)(null),[h,g]=(0,l.useState)([]),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(``),[x,S]=(0,l.useState)(!1),[C,w]=(0,l.useState)(null),T=()=>{Promise.all([o(`/api/missions/active`,{headers:{"Content-Type":`application/json`}}).then(e=>e.json()).then(e=>e.missions||e.active||(Array.isArray(e)?e:[])).catch(()=>[]),o(`/api/missions/recent`,{headers:{"Content-Type":`application/json`}}).then(e=>e.json()).then(e=>e.recent||e.missions||(Array.isArray(e)?e:[])).catch(()=>[])]).then(([e,n])=>{let r=e=>({goalId:e.goalId||e.id,title:e.title||`(workflow)`,phase:e.phase}),i=[...e.map(r),...n.map(r)],a=new Set;t(i.filter(e=>e.goalId&&!a.has(e.goalId)&&a.add(e.goalId)))})};(0,l.useEffect)(T,[]),(0,l.useEffect)(()=>{if(!n){g([]);return}o(`/api/mission/${n}`,{headers:{"Content-Type":`application/json`}}).then(e=>e.json()).then(e=>{g(e.goal?.subtasks||[]),v(e.driver?.currentSubtaskId||null)}).catch(()=>g([]))},[n]);let{pos:E,width:D,height:O}=(0,l.useMemo)(()=>f(h),[h]),k=(0,l.useMemo)(()=>new Map(h.map(e=>[e.id,e])),[h]),A=async()=>{if(y.trim()){S(!0);try{let e=await o(`/api/mission/run`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({prompt:y})}).then(e=>e.json());b(``),T();let t=e.goal?.id||e.goalId||e.id;t&&r(t)}finally{S(!1)}}};return(0,u.jsxs)(`div`,{className:`space-y-6`,children:[(0,u.jsx)(s,{title:`Workflow Builder`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Missions`},{label:`Workflow Builder`}]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(c,{size:18,className:`text-[var(--text-secondary)]`}),(0,u.jsx)(`span`,{className:`text-sm text-[var(--text-secondary)]`,children:`Visualize + author workflows as a goal/subtask DAG`}),(0,u.jsxs)(`button`,{onClick:T,className:`ml-auto flex items-center gap-1 text-xs px-2 py-1 rounded border border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text)]`,children:[(0,u.jsx)(a,{size:12}),` Refresh`]})]}),(0,u.jsxs)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-3 flex gap-2`,children:[(0,u.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{e.key===`Enter`&&A()},placeholder:`Describe a workflow in plain English (e.g. 'research X, draft a summary, then post it')`,className:`flex-1 bg-transparent text-sm text-[var(--text)] placeholder:text-[var(--text-muted)] outline-none`}),(0,u.jsxs)(`button`,{onClick:A,disabled:x||!y.trim(),className:`flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-blue-500/15 text-blue-400 border border-blue-500/30 disabled:opacity-50`,children:[(0,u.jsx)(i,{size:12}),` `,x?`Decomposing…`:`Build`]})]}),(0,u.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,u.jsxs)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-2 space-y-1 max-h-[60vh] overflow-auto`,children:[(0,u.jsx)(`p`,{className:`text-[10px] uppercase tracking-wide text-[var(--text-muted)] px-2 py-1`,children:`Workflows`}),e.length===0&&(0,u.jsx)(`p`,{className:`text-xs text-[var(--text-muted)] px-2`,children:`None yet — build one above.`}),e.map(e=>(0,u.jsxs)(`button`,{onClick:()=>r(e.goalId),className:`w-full text-left text-xs px-2 py-1.5 rounded ${n===e.goalId?`bg-blue-500/15 text-blue-300`:`text-[var(--text-secondary)] hover:bg-[var(--bg)]`}`,children:[(0,u.jsx)(`span`,{className:`truncate block`,children:e.title}),e.phase&&(0,u.jsx)(`span`,{className:`text-[10px] text-[var(--text-muted)]`,children:e.phase})]},e.goalId))]}),(0,u.jsx)(`div`,{className:`md:col-span-3 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-2 overflow-auto max-h-[60vh]`,children:h.length===0?(0,u.jsx)(`div`,{className:`text-[var(--text-muted)] text-sm p-6 text-center`,children:`Select a workflow to view its DAG, or build one from a prompt.`}):(0,u.jsxs)(`svg`,{width:D,height:O,className:`min-w-full`,children:[h.flatMap(e=>(e.dependsOn||[]).filter(e=>k.has(e)).map(t=>{let n=E.get(t),r=E.get(e.id);return(0,u.jsx)(`line`,{x1:n.x+p,y1:n.y+m/2,x2:r.x,y2:r.y+m/2,stroke:`var(--border)`,strokeWidth:1.5,markerEnd:`url(#arrow)`},`${t}->${e.id}`)})),(0,u.jsx)(`defs`,{children:(0,u.jsx)(`marker`,{id:`arrow`,markerWidth:`8`,markerHeight:`8`,refX:`7`,refY:`3`,orient:`auto`,children:(0,u.jsx)(`path`,{d:`M0,0 L7,3 L0,6 Z`,fill:`var(--text-muted)`})})}),h.map(e=>{let t=E.get(e.id),n=d[e.status]||`#64748b`,r=e.id===_;return(0,u.jsxs)(`g`,{transform:`translate(${t.x},${t.y})`,onClick:()=>w(e),style:{cursor:`pointer`},children:[(0,u.jsx)(`rect`,{width:p,height:m,rx:8,fill:`var(--bg)`,stroke:r?`#3b82f6`:`var(--border)`,strokeWidth:r?2:1}),(0,u.jsx)(`rect`,{width:4,height:m,rx:2,fill:n}),(0,u.jsx)(`text`,{x:12,y:22,fill:`var(--text)`,fontSize:11,fontWeight:600,children:e.title.slice(0,26)}),(0,u.jsxs)(`text`,{x:12,y:40,fill:`var(--text-muted)`,fontSize:9,children:[e.status,r?` • running`:``]})]},e.id)})]})})]}),C&&(0,u.jsxs)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4`,onClick:()=>w(null),children:[(0,u.jsx)(`p`,{className:`text-sm font-semibold text-[var(--text)]`,children:C.title}),(0,u.jsxs)(`p`,{className:`text-xs text-[var(--text-muted)]`,children:[`status: `,C.status,` · depends on: `,C.dependsOn.length?C.dependsOn.join(`, `):`—`]}),C.description&&(0,u.jsx)(`p`,{className:`text-xs text-[var(--text-secondary)] mt-1`,children:C.description})]})]})}export{h 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"./book-open-Ds_yciQm.js";import{t as a}from"./chevron-right-A_pvnRh_.js";import{n as o}from"./shared-DLz_Jtg3.js";import{t as s}from"./clock-DSPgndSD.js";import{t as c}from"./pause-C4TDJSfA.js";import{t as l}from"./play-9WxZWVHA.js";import{t as u}from"./plus-CHryCIkk.js";import{t as d}from"./refresh-cw-Disd5wRB.js";import{n as f,t as p}from"./toggle-right-BMaR-sfT.js";import{t as m}from"./trash-2-CwUv7ww1.js";import{A as h,H as g,P as _,a as v,f as y,j as b,o as x,p as S}from"./index-WI-E4I3h.js";import{t as C}from"./PageHeader-CH85uoZG.js";import{t as w}from"./ConfirmDialog-6hcNjmAh.js";var T=r(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),E=r(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),D=e(t(),1),O=n();function k(e){let t=e.split(` `);if(t.length!==5)return e;let[n,r,i,a,o]=t,s={0:`Sun`,1:`Mon`,2:`Tue`,3:`Wed`,4:`Thu`,5:`Fri`,6:`Sat`,7:`Sun`};if(i===`*`&&a===`*`){let e=`${r.padStart(2,`0`)}:${n.padStart(2,`0`)}`;return o===`*`?`Daily at ${e}`:o===`1-5`?`Weekdays at ${e}`:o===`0,6`?`Weekends at ${e}`:`${o.split(`,`).map(e=>s[e]||e).join(`, `)} at ${e}`}return n.startsWith(`*/`)?`Every ${n.slice(2)} min`:r.startsWith(`*/`)?`Every ${r.slice(2)} hours`:e}function A(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`}var j=async(e,t)=>{let n=await g(e,{headers:{"Content-Type":`application/json`},...t});if(!n.ok)throw Error(`API ${n.status}`);return n.json()};function M({icon:e,title:t,count:n,accent:r=`var(--color-accent)`}){return(0,O.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,O.jsx)(e,{className:`w-5 h-5`,style:{color:r}}),(0,O.jsx)(`h2`,{className:`text-base font-semibold text-text`,children:t}),n!==void 0&&(0,O.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-bg-tertiary text-text-secondary`,children:n})]})}function N({status:e}){let t={active:{bg:`#34d39920`,text:`var(--color-emerald)`},completed:{bg:`#6366f120`,text:`var(--color-accent)`},paused:{bg:`#f59e0b20`,text:`var(--color-warning)`},failed:{bg:`#ef444420`,text:`var(--color-error)`},pending:{bg:`#52525b20`,text:`var(--color-text-secondary)`},running:{bg:`#22d3ee20`,text:`var(--color-cyan)`},done:{bg:`#34d39920`,text:`var(--color-emerald)`},skipped:{bg:`#52525b20`,text:`var(--color-border-light)`},ok:{bg:`#34d39920`,text:`var(--color-emerald)`},notable:{bg:`#f59e0b20`,text:`var(--color-warning)`},urgent:{bg:`#ef444420`,text:`var(--color-error)`}},n=t[e]||t.pending;return(0,O.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full font-medium capitalize`,style:{backgroundColor:n.bg,color:n.text},children:e})}function P({status:e}){switch(e){case`done`:return(0,O.jsx)(b,{className:`w-3.5 h-3.5 text-emerald`});case`failed`:return(0,O.jsx)(h,{className:`w-3.5 h-3.5 text-error`});case`running`:return(0,O.jsx)(d,{className:`w-3.5 h-3.5 animate-spin text-cyan`});case`skipped`:return(0,O.jsx)(c,{className:`w-3.5 h-3.5 text-text-muted`});default:return(0,O.jsx)(T,{className:`w-3.5 h-3.5 text-text-muted`})}}function F({goals:e,onRefresh:t}){let{toast:n}=v(),[r,i]=(0,D.useState)(new Set),[s,f]=(0,D.useState)(!1),[p,h]=(0,D.useState)(``),[g,y]=(0,D.useState)(``),[b,x]=(0,D.useState)(null),C=e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},T=async()=>{if(p.trim())try{await j(`/api/goals`,{method:`POST`,body:JSON.stringify({title:p,description:g})}),h(``),y(``),f(!1),t(),n(`success`,`Goal created.`)}catch(e){n(`error`,`Couldn't create goal — try again. (${e.message})`)}},E=async e=>{try{await j(`/api/goals/${e}`,{method:`DELETE`}),t(),n(`success`,`Goal deleted.`)}catch(e){n(`error`,`Couldn't delete goal — try again. (${e.message})`)}},k=async(e,r)=>{let i=r===`paused`?`active`:`paused`;try{await j(`/api/goals/${e}`,{method:`PATCH`,body:JSON.stringify({status:i})}),t()}catch(e){n(`error`,`Couldn't update goal — try again. (${e.message})`)}},A=async(e,r)=>{try{await j(`/api/goals/${e}/subtasks/${r}/retry`,{method:`POST`}),t(),n(`success`,`Subtask retried.`)}catch(e){n(`error`,`Couldn't retry subtask — try again. (${e.message})`)}},F=async(e,r,i)=>{try{await j(`/api/goals/${e}/subtasks/${r}`,{method:`PATCH`,body:JSON.stringify({title:i})}),t()}catch(e){n(`error`,`Couldn't save subtask — try again. (${e.message})`)}},I=async(e,r)=>{try{await j(`/api/goals/${e}/subtasks/${r}/complete`,{method:`POST`,body:JSON.stringify({result:`Completed via dashboard`})}),t(),n(`success`,`Subtask marked done.`)}catch(e){n(`error`,`Couldn't complete subtask — try again. (${e.message})`)}};return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,O.jsx)(M,{icon:S,title:`Active Goals`,count:e.length,accent:`#34d399`}),(0,O.jsxs)(`button`,{onClick:()=>f(!s),className:`flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg transition-colors bg-bg-tertiary text-text-secondary`,onMouseEnter:e=>{e.currentTarget.style.backgroundColor=`#34d39930`,e.currentTarget.style.color=`var(--color-emerald)`},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`var(--color-bg-tertiary)`,e.currentTarget.style.color=`var(--color-text-secondary)`},children:[(0,O.jsx)(u,{className:`w-3.5 h-3.5`}),` New Goal`]})]}),s&&(0,O.jsxs)(`div`,{className:`rounded-lg p-4 mb-4`,style:{backgroundColor:`var(--color-bg-secondary)`,border:`1px solid #27272a`},children:[(0,O.jsx)(`input`,{id:`workflow-goal-title`,name:`workflow-goal-title`,type:`text`,placeholder:`Goal title...`,value:p,onChange:e=>h(e.target.value),className:`w-full px-3 py-2 rounded-lg text-sm mb-2 outline-none`,style:{backgroundColor:`var(--color-bg)`,border:`1px solid #27272a`,color:`var(--color-text)`}}),(0,O.jsx)(`textarea`,{id:`workflow-goal-description`,name:`workflow-goal-description`,placeholder:`Description (optional)...`,value:g,onChange:e=>y(e.target.value),rows:2,className:`w-full px-3 py-2 rounded-lg text-sm mb-3 outline-none resize-none`,style:{backgroundColor:`var(--color-bg)`,border:`1px solid #27272a`,color:`var(--color-text)`}}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{onClick:T,className:`text-xs px-4 py-1.5 rounded-lg font-medium transition-opacity hover:opacity-80`,style:{backgroundColor:`var(--color-emerald)`,color:`var(--color-bg)`},children:`Create`}),(0,O.jsx)(`button`,{onClick:()=>f(!1),className:`text-xs px-4 py-1.5 rounded-lg transition-colors hover:opacity-80 bg-bg-tertiary text-text-secondary`,children:`Cancel`})]})]}),e.length===0?(0,O.jsxs)(`div`,{className:`rounded-lg p-6 text-center`,style:{backgroundColor:`var(--color-bg-secondary)`,border:`1px solid #27272a`},children:[(0,O.jsx)(S,{className:`w-8 h-8 mx-auto mb-2 text-text-muted`}),(0,O.jsx)(`p`,{className:`text-sm text-text-muted`,children:`No goals yet. Create one to get started.`})]}):(0,O.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let t=r.has(e.id),n=e.subtasks.filter(e=>e.status===`done`||e.status===`skipped`).length,i=e.subtasks.length;return(0,O.jsxs)(`div`,{className:`rounded-lg overflow-hidden`,style:{backgroundColor:`var(--color-bg-secondary)`,border:`1px solid #27272a`},children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 cursor-pointer select-none`,onClick:()=>C(e.id),children:[t?(0,O.jsx)(_,{className:`w-4 h-4 flex-shrink-0 text-text-muted`}):(0,O.jsx)(a,{className:`w-4 h-4 flex-shrink-0 text-text-muted`}),(0,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`text-sm font-medium truncate text-text`,children:e.title}),(0,O.jsx)(N,{status:e.status})]}),i>0&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,O.jsx)(`div`,{className:`flex-1 h-1.5 rounded-full overflow-hidden bg-bg-tertiary`,children:(0,O.jsx)(`div`,{className:`h-full rounded-full transition-all`,style:{width:`${e.progress}%`,backgroundColor:`var(--color-emerald)`}})}),(0,O.jsxs)(`span`,{className:`text-xs flex-shrink-0 text-text-secondary`,children:[n,`/`,i]})]})]}),e.status!==`completed`&&(0,O.jsx)(`button`,{onClick:t=>{t.stopPropagation(),k(e.id,e.status)},className:`p-1 rounded hover:opacity-80 flex-shrink-0`,title:e.status===`paused`?`Resume goal`:`Pause goal`,children:e.status===`paused`?(0,O.jsx)(l,{className:`w-3.5 h-3.5 text-emerald`}):(0,O.jsx)(c,{className:`w-3.5 h-3.5`,style:{color:`#fbbf24`}})}),(0,O.jsx)(`button`,{onClick:t=>{t.stopPropagation(),x(e.id)},className:`p-1 rounded hover:opacity-80 flex-shrink-0`,title:`Delete goal`,children:(0,O.jsx)(m,{className:`w-3.5 h-3.5 text-text-muted`})})]}),t&&e.subtasks.length>0&&(0,O.jsx)(`div`,{className:`px-4 pb-3 border-t`,style:{borderColor:`var(--color-bg-tertiary)`},children:(0,O.jsx)(`div`,{className:`space-y-1.5 mt-2`,children:e.subtasks.map(t=>(0,O.jsxs)(`div`,{className:`flex items-center gap-2 py-1 px-2 rounded bg-bg`,children:[(0,O.jsx)(P,{status:t.status}),(0,O.jsx)(`span`,{className:`text-xs flex-1 min-w-0`,style:{color:t.status===`done`?`var(--color-border-light)`:`var(--color-text-secondary)`},children:(0,O.jsx)(o,{value:t.title,onSave:n=>F(e.id,t.id,n),placeholder:`Subtask title`})}),t.status===`failed`&&t.error&&(0,O.jsx)(`span`,{className:`text-xs truncate max-w-40 text-error`,title:t.error,children:t.error}),t.status===`failed`&&(0,O.jsxs)(`button`,{onClick:()=>A(e.id,t.id),className:`text-xs px-2 py-0.5 rounded transition-colors hover:opacity-80`,style:{backgroundColor:`var(--color-bg-tertiary)`,color:`#fbbf24`},title:`Reset to pending, clear error, retry`,children:[(0,O.jsx)(d,{className:`w-3 h-3 inline`}),` Retry`]}),t.status===`pending`&&(0,O.jsx)(`button`,{onClick:()=>I(e.id,t.id),className:`text-xs px-2 py-0.5 rounded transition-colors hover:opacity-80`,style:{backgroundColor:`var(--color-bg-tertiary)`,color:`var(--color-emerald)`},children:`Done`})]},t.id))})})]},e.id)})}),(0,O.jsx)(w,{open:b!==null,title:`Delete this goal?`,message:`This can't be undone. The goal and its subtasks will be permanently removed.`,confirmLabel:`Delete`,onConfirm:async()=>{b&&await E(b),x(null)},onCancel:()=>x(null)})]})}function I({jobs:e,onRefresh:t}){let{toast:n}=v(),[r,i]=(0,D.useState)(!1),[a,o]=(0,D.useState)(``),[c,l]=(0,D.useState)(``),[d,h]=(0,D.useState)(``),[g,_]=(0,D.useState)(null),y=async()=>{if(!(!a.trim()||!c.trim()||!d.trim()))try{await j(`/api/cron`,{method:`POST`,body:JSON.stringify({name:a,schedule:c,command:d})}),o(``),l(``),h(``),i(!1),t(),n(`success`,`Cron job created.`)}catch(e){n(`error`,`Couldn't create cron job — try again. (${e.message})`)}},b=async(e,r)=>{try{await j(`/api/cron/${e}/toggle`,{method:`POST`,body:JSON.stringify({enabled:!r})}),t(),n(`success`,r?`Cron job disabled.`:`Cron job enabled.`)}catch(e){n(`error`,`Couldn't update cron job — try again. (${e.message})`)}},x=async e=>{try{await j(`/api/cron/${e}`,{method:`DELETE`}),t(),n(`success`,`Cron job deleted.`)}catch(e){n(`error`,`Couldn't delete cron job — try again. (${e.message})`)}};return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,O.jsx)(M,{icon:s,title:`Scheduled Tasks`,count:e.length,accent:`#22d3ee`}),(0,O.jsxs)(`button`,{onClick:()=>i(!r),className:`flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg transition-colors bg-bg-tertiary text-text-secondary`,onMouseEnter:e=>{e.currentTarget.style.backgroundColor=`#22d3ee30`,e.currentTarget.style.color=`var(--color-cyan)`},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`var(--color-bg-tertiary)`,e.currentTarget.style.color=`var(--color-text-secondary)`},children:[(0,O.jsx)(u,{className:`w-3.5 h-3.5`}),` New Cron`]})]}),r&&(0,O.jsxs)(`div`,{className:`rounded-lg p-4 mb-4`,style:{backgroundColor:`var(--color-bg-secondary)`,border:`1px solid #27272a`},children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2 mb-2`,children:[(0,O.jsx)(`input`,{id:`workflow-cron-name`,name:`workflow-cron-name`,type:`text`,placeholder:`Job name...`,value:a,onChange:e=>o(e.target.value),className:`px-3 py-2 rounded-lg text-sm outline-none`,style:{backgroundColor:`var(--color-bg)`,border:`1px solid #27272a`,color:`var(--color-text)`}}),(0,O.jsx)(`input`,{id:`workflow-cron-schedule`,name:`workflow-cron-schedule`,type:`text`,placeholder:`Schedule (e.g. */5 * * * *)`,value:c,onChange:e=>l(e.target.value),className:`px-3 py-2 rounded-lg text-sm outline-none`,style:{backgroundColor:`var(--color-bg)`,border:`1px solid #27272a`,color:`var(--color-text)`}})]}),(0,O.jsx)(`input`,{id:`workflow-cron-command`,name:`workflow-cron-command`,type:`text`,placeholder:`Command to execute...`,value:d,onChange:e=>h(e.target.value),className:`w-full px-3 py-2 rounded-lg text-sm mb-3 outline-none`,style:{backgroundColor:`var(--color-bg)`,border:`1px solid #27272a`,color:`var(--color-text)`}}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{onClick:y,className:`text-xs px-4 py-1.5 rounded-lg font-medium transition-opacity hover:opacity-80`,style:{backgroundColor:`var(--color-cyan)`,color:`var(--color-bg)`},children:`Create`}),(0,O.jsx)(`button`,{onClick:()=>i(!1),className:`text-xs px-4 py-1.5 rounded-lg transition-colors hover:opacity-80 bg-bg-tertiary text-text-secondary`,children:`Cancel`})]})]}),e.length===0?(0,O.jsxs)(`div`,{className:`rounded-lg p-6 text-center`,style:{backgroundColor:`var(--color-bg-secondary)`,border:`1px solid #27272a`},children:[(0,O.jsx)(s,{className:`w-8 h-8 mx-auto mb-2 text-text-muted`}),(0,O.jsx)(`p`,{className:`text-sm text-text-muted`,children:`No scheduled tasks. Create a cron job to automate tasks.`})]}):(0,O.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,O.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg px-4 py-3`,style:{backgroundColor:`var(--color-bg-secondary)`,border:`1px solid #27272a`},children:[(0,O.jsx)(`button`,{onClick:()=>b(e.id,e.enabled),title:e.enabled?`Disable`:`Enable`,children:e.enabled?(0,O.jsx)(p,{className:`w-5 h-5 text-emerald`}):(0,O.jsx)(f,{className:`w-5 h-5 text-text-muted`})}),(0,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`text-sm font-medium truncate`,style:{color:e.enabled?`var(--color-text)`:`var(--color-border-light)`},children:e.name}),(0,O.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full`,style:{backgroundColor:`var(--color-bg-tertiary)`,color:`var(--color-cyan)`},children:k(e.schedule)})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-3 mt-0.5`,children:[(0,O.jsx)(`span`,{className:`text-xs font-mono truncate text-text-muted`,children:e.command}),e.last_run&&(0,O.jsxs)(`span`,{className:`text-xs flex-shrink-0 text-text-muted`,children:[`Last: `,A(e.last_run)]})]})]}),(0,O.jsx)(`button`,{onClick:()=>_(e.id),className:`p-1 rounded hover:opacity-80 flex-shrink-0`,title:`Delete`,children:(0,O.jsx)(m,{className:`w-3.5 h-3.5 text-text-muted`})})]},e.id))}),(0,O.jsx)(w,{open:g!==null,title:`Delete this cron job?`,message:`This can't be undone. The scheduled task will stop running and be removed.`,confirmLabel:`Delete`,onConfirm:async()=>{g&&await x(g),_(null)},onCancel:()=>_(null)})]})}function L({recipes:e,onRefresh:t}){let{toast:n}=v(),[r,a]=(0,D.useState)(null),o=async e=>{a(e);try{await j(`/api/recipes/${e}/run`,{method:`POST`,body:JSON.stringify({params:{}})}),t(),n(`success`,`Recipe started.`)}catch(e){n(`error`,`Couldn't run recipe — try again. (${e.message})`)}finally{a(null)}};return(0,O.jsxs)(`div`,{children:[(0,O.jsx)(M,{icon:i,title:`Recipes`,count:e.length,accent:`#6366f1`}),e.length===0?(0,O.jsxs)(`div`,{className:`rounded-lg p-6 text-center`,style:{backgroundColor:`var(--color-bg-secondary)`,border:`1px solid #27272a`},children:[(0,O.jsx)(i,{className:`w-8 h-8 mx-auto mb-2 text-text-muted`}),(0,O.jsx)(`p`,{className:`text-sm text-text-muted`,children:`No recipes available.`})]}):(0,O.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3`,children:e.map(e=>(0,O.jsxs)(`div`,{className:`rounded-lg p-4 flex flex-col`,style:{backgroundColor:`var(--color-bg-secondary)`,border:`1px solid #27272a`},children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-2`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-medium truncate text-text`,children:e.name}),e.slashCommand&&(0,O.jsxs)(`span`,{className:`text-xs font-mono text-accent`,children:[`/`,e.slashCommand]})]}),(0,O.jsxs)(`button`,{onClick:()=>o(e.id),disabled:r===e.id,className:`flex items-center gap-1 text-xs px-2.5 py-1 rounded-lg transition-opacity hover:opacity-80 flex-shrink-0`,style:{backgroundColor:`#6366f130`,color:`var(--color-accent)`},children:[r===e.id?(0,O.jsx)(d,{className:`w-3 h-3 animate-spin`}):(0,O.jsx)(l,{className:`w-3 h-3`}),`Run`]})]}),(0,O.jsx)(`p`,{className:`text-xs flex-1 line-clamp-2 mb-2 text-text-secondary`,children:e.description}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,O.jsxs)(`span`,{className:`text-xs text-text-muted`,children:[e.steps.length,` step`,e.steps.length===1?``:`s`]}),e.tags?.map(e=>(0,O.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-bg-tertiary text-text-secondary`,children:e},e)),e.lastRunAt&&(0,O.jsxs)(`span`,{className:`text-xs ml-auto text-text-muted`,children:[`Ran `,A(e.lastRunAt)]})]})]},e.id))})]})}function R({status:e,history:t,onRefresh:n}){let{toast:r}=v(),[i,a]=(0,D.useState)(!1),[o,s]=(0,D.useState)(!1),c=async()=>{a(!0);try{await j(`/api/autopilot/toggle`,{method:`POST`,body:JSON.stringify({enabled:!e?.enabled})}),n(),r(`success`,e?.enabled?`Autopilot disabled.`:`Autopilot enabled.`)}catch(e){r(`error`,`Couldn't update autopilot — try again. (${e.message})`)}finally{a(!1)}},u=async()=>{s(!0);try{await j(`/api/autopilot/run`,{method:`POST`}),n(),r(`success`,`Autopilot run started.`)}catch(e){r(`error`,`Couldn't start autopilot run — try again. (${e.message})`)}finally{s(!1)}},m=e=>{switch(e){case`urgent`:return(0,O.jsx)(y,{className:`w-3.5 h-3.5 text-error`});case`notable`:return(0,O.jsx)(x,{className:`w-3.5 h-3.5 text-warning`});default:return(0,O.jsx)(b,{className:`w-3.5 h-3.5 text-emerald`})}};return(0,O.jsxs)(`div`,{children:[(0,O.jsx)(M,{icon:x,title:`Autopilot`,accent:`#f59e0b`}),(0,O.jsxs)(`div`,{className:`rounded-lg overflow-hidden`,style:{backgroundColor:`var(--color-bg-secondary)`,border:`1px solid #27272a`},children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-4 px-4 py-3`,children:[(0,O.jsx)(`button`,{onClick:c,disabled:i,title:e?.enabled?`Disable autopilot`:`Enable autopilot`,children:e?.enabled?(0,O.jsx)(p,{className:`w-6 h-6 text-emerald`}):(0,O.jsx)(f,{className:`w-6 h-6 text-text-muted`})}),(0,O.jsxs)(`div`,{className:`flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`text-sm font-medium text-text`,children:e?.enabled?`Active`:`Disabled`}),e?.isRunning&&(0,O.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-cyan`,children:[(0,O.jsx)(d,{className:`w-3 h-3 animate-spin`}),` Running...`]})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-3 mt-0.5`,children:[(0,O.jsxs)(`span`,{className:`text-xs text-text-muted`,children:[(0,O.jsx)(E,{className:`w-3 h-3 inline mr-1`}),e?.schedule?k(e.schedule):`No schedule`]}),(0,O.jsxs)(`span`,{className:`text-xs text-text-muted`,children:[e?.totalRuns??0,` total runs`]}),e?.lastRun&&(0,O.jsxs)(`span`,{className:`text-xs text-text-muted`,children:[`Last: `,A(e.lastRun.timestamp)]})]})]}),(0,O.jsxs)(`button`,{onClick:u,disabled:o||e?.isRunning,className:`flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg transition-opacity hover:opacity-80`,style:{backgroundColor:`#f59e0b30`,color:`var(--color-warning)`},children:[o?(0,O.jsx)(d,{className:`w-3 h-3 animate-spin`}):(0,O.jsx)(l,{className:`w-3 h-3`}),`Run Now`]})]}),t.length>0&&(0,O.jsxs)(`div`,{className:`border-t`,style:{borderColor:`var(--color-bg-tertiary)`},children:[(0,O.jsx)(`div`,{className:`px-4 py-2`,children:(0,O.jsx)(`span`,{className:`text-xs font-medium text-text-muted`,children:`Recent Runs`})}),(0,O.jsx)(`div`,{className:`divide-y`,style:{borderColor:`var(--color-bg-tertiary)`},children:t.slice(-5).reverse().map((e,t)=>(0,O.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2`,children:[m(e.classification),(0,O.jsx)(`span`,{className:`text-xs flex-1 truncate text-text-secondary`,children:e.skipped?`Skipped: ${e.summary}`:e.summary.slice(0,120)}),(0,O.jsx)(N,{status:e.classification}),(0,O.jsx)(`span`,{className:`text-xs flex-shrink-0 text-text-muted`,children:A(e.timestamp)})]},t))})]})]})]})}function z(){let[e,t]=(0,D.useState)([]),[n,r]=(0,D.useState)([]),[i,a]=(0,D.useState)([]),[o,s]=(0,D.useState)(null),[c,l]=(0,D.useState)([]),[u,f]=(0,D.useState)(!0),p=(0,D.useCallback)(async()=>{try{let[e,n,i,o,c]=await Promise.allSettled([j(`/api/goals`),j(`/api/cron`),j(`/api/recipes`),j(`/api/autopilot/status`),j(`/api/autopilot/history?limit=5`)]);e.status===`fulfilled`&&t(e.value.goals||[]),n.status===`fulfilled`&&r(n.value.jobs||[]),i.status===`fulfilled`&&a(i.value.recipes||[]),o.status===`fulfilled`&&s(o.value),c.status===`fulfilled`&&l(Array.isArray(c.value)?c.value:[])}finally{f(!1)}},[]);return(0,D.useEffect)(()=>{p();let e=setInterval(p,15e3);return()=>clearInterval(e)},[p]),u?(0,O.jsx)(`div`,{className:`flex items-center justify-center py-20`,children:(0,O.jsx)(d,{className:`w-6 h-6 animate-spin text-text-muted`})}):(0,O.jsxs)(`div`,{className:`space-y-8`,children:[(0,O.jsx)(C,{title:`Workflows`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Agent`},{label:`Workflows`}],actions:(0,O.jsx)(`button`,{onClick:()=>{f(!0),p()},className:`p-2 rounded-lg transition-colors hover:opacity-80 bg-bg-tertiary`,title:`Refresh`,children:(0,O.jsx)(d,{className:`w-4 h-4 text-text-secondary`})})}),(0,O.jsx)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-3`,children:[{label:`Goals`,value:e.filter(e=>e.status===`active`).length,total:e.length,color:`var(--color-emerald)`},{label:`Cron Jobs`,value:n.filter(e=>e.enabled).length,total:n.length,color:`var(--color-cyan)`},{label:`Recipes`,value:i.length,color:`var(--color-accent)`},{label:`Autopilot Runs`,value:o?.totalRuns??0,color:`var(--color-warning)`}].map(e=>(0,O.jsxs)(`div`,{className:`rounded-lg px-4 py-3`,style:{backgroundColor:`var(--color-bg-secondary)`,border:`1px solid #27272a`},children:[(0,O.jsx)(`p`,{className:`text-xs mb-1 text-text-muted`,children:e.label}),(0,O.jsxs)(`p`,{className:`text-lg font-bold`,style:{color:e.color},children:[e.value,e.total!==void 0&&e.total!==e.value&&(0,O.jsxs)(`span`,{className:`text-xs font-normal ml-1 text-text-muted`,children:[`/ `,e.total]})]})]},e.label))}),(0,O.jsx)(F,{goals:e,onRefresh:p}),(0,O.jsx)(I,{jobs:n,onRefresh:p}),(0,O.jsx)(L,{recipes:i,onRefresh:p}),(0,O.jsx)(R,{status:o,history:c,onRefresh:p})]})}export{z as default};
@@ -0,0 +1 @@
1
+ function e(e){let t=e.payload||{},n=t.kind;if(n===`driver_blocked`){let e=t.question||`Specialist needs clarification`,n=[];return t.goalTitle&&n.push(`Goal: ${t.goalTitle}`),t.subtaskTitle&&n.push(`Task: ${t.subtaskTitle}`),t.specialist&&n.push(`Agent: ${t.specialist}`),t.attempts&&n.push(`${t.attempts} attempt(s)`),t.lastError&&n.push(`Error: ${String(t.lastError).slice(0,120)}`),{kindLabel:`Driver blocked`,headline:e.length>120?e.slice(0,120)+`…`:e,detail:n.join(` · `)||void 0,urgency:`high`}}if(n===`self_mod_pr`){let n=e.payload,r=n.initialFileCount,i=n.firstFile,a=n.proposedBy,o=[];return typeof r==`number`&&r>0&&o.push(`${r} file${r===1?``:`s`}`),i&&o.push(i.split(`/`).slice(-2).join(`/`)),t.target&&o.push(`→ ${t.target}`),a&&o.push(`by ${a}`),{kindLabel:`Self-mod PR`,headline:t.goalTitle?`Code changes for: ${t.goalTitle}`:`Code changes pending review`,detail:o.length>0?o.join(` · `):t.suggestedAction,urgency:`medium`}}if(n===`self_repair`){let e=(t.evidence||{}).driveId,n=t.finding||`finding`;return{kindLabel:`Self-repair`,headline:t.reason||`${n}${e?` (${e})`:``}`,detail:t.suggestedAction,urgency:t.severity||`medium`}}if(n===`canary_regression`){let e=t.regressions||[],n=e.length>0?e.map(e=>`${e.taskId} ${(e.baseline*100).toFixed(0)}%→${(e.current*100).toFixed(0)}%`).join(`, `):null;return{kindLabel:`Canary regression`,headline:n?`Quality drop on ${e.length} task(s): ${n}`:t.reason||`Model quality regression detected`,detail:t.suggestedAction||(t.model?`Model: ${t.model}`:void 0),urgency:`high`}}if(e.type===`goal_proposal`||e.type===`soma_proposal`||n===`goal_proposal`)return{kindLabel:e.type===`soma_proposal`?`Soma proposal`:`New goal proposal`,headline:t.title||t.goalTitle||`Goal proposal`,detail:t.description?.slice(0,180)||t.rationale?.slice(0,180),urgency:`medium`};if(e.type===`hire_agent`)return{kindLabel:`Hire agent`,headline:t.name?`Hire "${t.name}" as ${t.role||`agent`}`:`Hire new agent`,urgency:`medium`};if(e.type===`budget_override`)return{kindLabel:`Budget override`,headline:`Agent requesting budget continuation`,detail:t.reason,urgency:`medium`};let r=t.question||t.title||t.goalTitle||t.reason||t.finding||t.description||t.rationale||`${e.type.replace(/_/g,` `)} from ${e.requestedBy}`;return{kindLabel:(n||e.type).replace(/_/g,` `),headline:String(r).slice(0,200),urgency:t.urgency||`low`}}export{e as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]);export{t};
@@ -0,0 +1 @@
1
+ function e(t){var n,r,i=``;if(typeof t==`string`||typeof t==`number`)i+=t;else if(typeof t==`object`)if(Array.isArray(t)){var a=t.length;for(n=0;n<a;n++)t[n]&&(r=e(t[n]))&&(i&&(i+=` `),i+=r)}else for(r in t)t[r]&&(i&&(i+=` `),i+=r);return i}function t(){for(var t,n,r=0,i=``,a=arguments.length;r<a;r++)(t=arguments[r])&&(n=e(t))&&(i&&(i+=` `),i+=n);return i}export{t};
@@ -0,0 +1 @@
1
+ import{c as e,n as t}from"./jsx-runtime-B15e6lOy.js";var n=e(t()),r=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),i=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),a=e=>{let t=i(e);return t.charAt(0).toUpperCase()+t.slice(1)},o=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),s=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},c={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},l=(0,n.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:a=``,children:l,iconNode:u,...d},f)=>(0,n.createElement)(`svg`,{ref:f,...c,width:t,height:t,stroke:e,strokeWidth:i?Number(r)*24/Number(t):r,className:o(`lucide`,a),...!l&&!s(d)&&{"aria-hidden":`true`},...d},[...u.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(l)?l:[l]])),u=(e,t)=>{let i=(0,n.forwardRef)(({className:i,...s},c)=>(0,n.createElement)(l,{ref:c,iconNode:t,className:o(`lucide-${r(a(e))}`,`lucide-${e}`,i),...s}));return i.displayName=a(e),i};export{u as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`file-text`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`git-branch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-qnlrxww7.js";var t=e(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]);export{t};