titan-agent 6.5.2 → 7.0.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 (311) hide show
  1. package/README.md +180 -53
  2. package/assets/agent-skills/NOTICE-ECC.md +39 -0
  3. package/assets/agent-skills/agent-introspection-debugging/SKILL.md +153 -0
  4. package/assets/agent-skills/continuous-agent-loop/SKILL.md +45 -0
  5. package/assets/agent-skills/continuous-learning/SKILL.md +131 -0
  6. package/assets/agent-skills/continuous-learning/config.json +18 -0
  7. package/assets/agent-skills/continuous-learning/evaluate-session.sh +69 -0
  8. package/assets/agent-skills/production-audit/SKILL.md +206 -0
  9. package/assets/agent-skills/recursive-decision-ledger/SKILL.md +79 -0
  10. package/assets/agent-skills/scientific-thinking-literature-review/SKILL.md +192 -0
  11. package/assets/agent-skills/scientific-thinking-scholar-evaluation/SKILL.md +160 -0
  12. package/assets/agent-skills/verification-loop/SKILL.md +126 -0
  13. package/dist/agent/agent.js +67 -26
  14. package/dist/agent/agent.js.map +1 -1
  15. package/dist/agent/agentLoop.js +6 -2
  16. package/dist/agent/agentLoop.js.map +1 -1
  17. package/dist/agent/autoModeClassifier.js +26 -2
  18. package/dist/agent/autoModeClassifier.js.map +1 -1
  19. package/dist/agent/goalDriver.js +2 -0
  20. package/dist/agent/goalDriver.js.map +1 -1
  21. package/dist/agent/goalSpec.js +229 -0
  22. package/dist/agent/goalSpec.js.map +1 -0
  23. package/dist/agent/heartbeat.js +130 -0
  24. package/dist/agent/heartbeat.js.map +1 -0
  25. package/dist/agent/missionDecompose.js +38 -0
  26. package/dist/agent/missionDecompose.js.map +1 -0
  27. package/dist/agent/muscleMemory.js +291 -0
  28. package/dist/agent/muscleMemory.js.map +1 -0
  29. package/dist/agent/observationWriter.js +56 -0
  30. package/dist/agent/observationWriter.js.map +1 -0
  31. package/dist/agent/promptSectionCaps.js +6 -0
  32. package/dist/agent/promptSectionCaps.js.map +1 -1
  33. package/dist/agent/reminders.js +101 -0
  34. package/dist/agent/reminders.js.map +1 -0
  35. package/dist/agent/systemWidgets.js +41 -0
  36. package/dist/agent/systemWidgets.js.map +1 -0
  37. package/dist/agent/toolRunner.js +24 -0
  38. package/dist/agent/toolRunner.js.map +1 -1
  39. package/dist/agent/toolSearch.js +3 -0
  40. package/dist/agent/toolSearch.js.map +1 -1
  41. package/dist/channels/messenger.js +39 -0
  42. package/dist/channels/messenger.js.map +1 -1
  43. package/dist/config/config.js +7 -0
  44. package/dist/config/config.js.map +1 -1
  45. package/dist/config/schema.js +18 -1
  46. package/dist/config/schema.js.map +1 -1
  47. package/dist/eval/harness.js +13 -3
  48. package/dist/eval/harness.js.map +1 -1
  49. package/dist/gateway/onboarding.js +91 -0
  50. package/dist/gateway/onboarding.js.map +1 -0
  51. package/dist/gateway/routes/skills.js +2 -1
  52. package/dist/gateway/routes/skills.js.map +1 -1
  53. package/dist/gateway/routes/studioRouter.js +88 -0
  54. package/dist/gateway/routes/studioRouter.js.map +1 -0
  55. package/dist/gateway/routes/watchRouter.js +4 -4
  56. package/dist/gateway/routes/watchRouter.js.map +1 -1
  57. package/dist/gateway/server.js +251 -43
  58. package/dist/gateway/server.js.map +1 -1
  59. package/dist/memory/taxonomy.js +117 -0
  60. package/dist/memory/taxonomy.js.map +1 -0
  61. package/dist/providers/modelCapabilities.js +13 -0
  62. package/dist/providers/modelCapabilities.js.map +1 -1
  63. package/dist/providers/ollama.js +8 -2
  64. package/dist/providers/ollama.js.map +1 -1
  65. package/dist/providers/openai.js +1 -1
  66. package/dist/providers/openai.js.map +1 -1
  67. package/dist/providers/openai_compat.js +38 -2
  68. package/dist/providers/openai_compat.js.map +1 -1
  69. package/dist/providers/router.js +14 -0
  70. package/dist/providers/router.js.map +1 -1
  71. package/dist/recipes/runner.js +8 -1
  72. package/dist/recipes/runner.js.map +1 -1
  73. package/dist/recipes/store.js +2 -1
  74. package/dist/recipes/store.js.map +1 -1
  75. package/dist/skills/builtin/codebase_explore.js +214 -0
  76. package/dist/skills/builtin/codebase_explore.js.map +1 -0
  77. package/dist/skills/builtin/config_audit.js +160 -0
  78. package/dist/skills/builtin/config_audit.js.map +1 -0
  79. package/dist/skills/builtin/delegate_agent.js +107 -0
  80. package/dist/skills/builtin/delegate_agent.js.map +1 -0
  81. package/dist/skills/builtin/memory_map.js +38 -0
  82. package/dist/skills/builtin/memory_map.js.map +1 -0
  83. package/dist/skills/builtin/reminders.js +67 -0
  84. package/dist/skills/builtin/reminders.js.map +1 -0
  85. package/dist/skills/builtin/spec.js +139 -0
  86. package/dist/skills/builtin/spec.js.map +1 -0
  87. package/dist/skills/builtin/widget_gallery.js +12 -5
  88. package/dist/skills/builtin/widget_gallery.js.map +1 -1
  89. package/dist/skills/frontmatterLoader.js +7 -1
  90. package/dist/skills/frontmatterLoader.js.map +1 -1
  91. package/dist/skills/registry.js +12 -0
  92. package/dist/skills/registry.js.map +1 -1
  93. package/dist/substrate/traceBus.js.map +1 -1
  94. package/dist/telemetry/traceStore.js +127 -0
  95. package/dist/telemetry/traceStore.js.map +1 -0
  96. package/dist/utils/constants.js +1 -1
  97. package/dist/utils/constants.js.map +1 -1
  98. package/dist/utils/contrast.js +69 -0
  99. package/dist/utils/contrast.js.map +1 -0
  100. package/dist/watch/sessionContext.js +14 -0
  101. package/dist/watch/sessionContext.js.map +1 -0
  102. package/dist/watch/sessionTrace.js +51 -0
  103. package/dist/watch/sessionTrace.js.map +1 -0
  104. package/dist/watch/studioBuffer.js +53 -0
  105. package/dist/watch/studioBuffer.js.map +1 -0
  106. package/package.json +4 -3
  107. package/ui/dist/assets/AboutYouMemory-CZKEOd_O.js +11 -0
  108. package/ui/dist/assets/AuditPanel-Bu71N5Er.js +1 -0
  109. package/ui/dist/assets/{AutonomyPanel-CmaXJV8d.js → AutonomyPanel-DB-39dX4.js} +2 -2
  110. package/ui/dist/assets/{AutopilotPanel-CbohPtXW.js → AutopilotPanel-Cj8oKxWv.js} +1 -1
  111. package/ui/dist/assets/{AutoresearchPanel-DCwiQ2v2.js → AutoresearchPanel-3s8pjm6Z.js} +2 -2
  112. package/ui/dist/assets/BackupPanel-EUQJMJE7.js +1 -0
  113. package/ui/dist/assets/{BrowserPanel-D6UaSxap.js → BrowserPanel-Beo4F5Ar.js} +2 -2
  114. package/ui/dist/assets/Button-MdXmb4_n.js +1 -0
  115. package/ui/dist/assets/CPActivity-B1Se9VVc.js +1 -0
  116. package/ui/dist/assets/CPAgentDetail-BYji6tT8.js +1 -0
  117. package/ui/dist/assets/CPAgents-BSUKucTe.js +1 -0
  118. package/ui/dist/assets/CPApprovals-B4v0em6e.js +1 -0
  119. package/ui/dist/assets/CPCosts-9ikh61Kv.js +1 -0
  120. package/ui/dist/assets/CPDashboard-sOok2T5v.js +1 -0
  121. package/ui/dist/assets/{CPFiles-BO73EZwJ.js → CPFiles-DB2nY5JE.js} +1 -1
  122. package/ui/dist/assets/CPGoals-8Z1yOY8e.js +1 -0
  123. package/ui/dist/assets/CPInbox-Cq6-UY8F.js +11 -0
  124. package/ui/dist/assets/CPIssueDetail-NAGfmJg8.js +1 -0
  125. package/ui/dist/assets/CPIssues-BzX6Rckx.js +1 -0
  126. package/ui/dist/assets/CPLayout-BcRM6QSg.js +2 -0
  127. package/ui/dist/assets/CPOrg-B7DQ4UQP.js +1 -0
  128. package/ui/dist/assets/CPRuns-D-cpPw_M.js +1 -0
  129. package/ui/dist/assets/{CPSocial-Qw5rKy_4.js → CPSocial-DshtmcK0.js} +3 -3
  130. package/ui/dist/assets/CPVoice-DfXRnQVU.js +1 -0
  131. package/ui/dist/assets/{ChannelsPanel-DS21E-Iz.js → ChannelsPanel-BnaTOeyf.js} +1 -1
  132. package/ui/dist/assets/CheckpointsPanel-C62naE4U.js +1 -0
  133. package/ui/dist/assets/CommandPostHub-B_L1CAss.js +24 -0
  134. package/ui/dist/assets/ConfirmDialog-VErHWAbo.js +1 -0
  135. package/ui/dist/assets/CronPanel-BwMrrZ5d.js +1 -0
  136. package/ui/dist/assets/{DataTable-PnhPeDBG.js → DataTable-BCqSUuN7.js} +1 -1
  137. package/ui/dist/assets/{DreamPanel-DIrtlk2K.js → DreamPanel-BNAcCLBB.js} +2 -2
  138. package/ui/dist/assets/EmptyState-D9kQf1PX.js +1 -0
  139. package/ui/dist/assets/{EvalHarnessPanel-uYb_ZEQG.js → EvalHarnessPanel-BaMLdBNm.js} +2 -2
  140. package/ui/dist/assets/EvalPanel-CW-SSjtg.js +1 -0
  141. package/ui/dist/assets/{FileViewer-CVO3TRs3.js → FileViewer-BL00nsd7.js} +1 -1
  142. package/ui/dist/assets/FilesPanel-CeC6YUSd.js +16 -0
  143. package/ui/dist/assets/FleetPanel-EyWF7l3W.js +1 -0
  144. package/ui/dist/assets/{HomelabPanel-BZvN4LPM.js → HomelabPanel-BRfKRYe7.js} +2 -2
  145. package/ui/dist/assets/InfraView-Jmqhg_Yc.js +2 -0
  146. package/ui/dist/assets/{InlineEditableField-mBzpbcLB.js → InlineEditableField-DgMrLDj1.js} +1 -1
  147. package/ui/dist/assets/Input-CBTwa_Iw.js +1 -0
  148. package/ui/dist/assets/IntegrationsPanel-DQL-7Ec6.js +1 -0
  149. package/ui/dist/assets/IntelligenceView-DxD78qfP.js +2 -0
  150. package/ui/dist/assets/LearningPanel-C_JzSbJU.js +1 -0
  151. package/ui/dist/assets/LiveStudio-Db5yeaWo.js +7 -0
  152. package/ui/dist/assets/{LogsPanel-DbP3Mwnr.js → LogsPanel-CpinKwaZ.js} +1 -1
  153. package/ui/dist/assets/McpPanel-D-MqN_f-.js +1 -0
  154. package/ui/dist/assets/MemoryGraphPanel-BnD5jRqf.js +1 -0
  155. package/ui/dist/assets/MemoryTaxonomyPanel-BBI202dd.js +6 -0
  156. package/ui/dist/assets/MemoryWikiPanel-Dn3XZHL0.js +6 -0
  157. package/ui/dist/assets/{MeshPanel-Bf-4brXL.js → MeshPanel-C-mRJpr0.js} +1 -1
  158. package/ui/dist/assets/{MissionCanvas-CJyhnauG.js → MissionCanvas-CbZW83Ch.js} +1 -1
  159. package/ui/dist/assets/{MissionChat-C2Nto3zM.js → MissionChat-Bs75jPAD.js} +1 -1
  160. package/ui/dist/assets/{MissionLibrary-RXyBHsLL.js → MissionLibrary-BxQ6SxPe.js} +1 -1
  161. package/ui/dist/assets/MissionStart-CBuBPasl.js +1 -0
  162. package/ui/dist/assets/Modal-ybPGvlQs.js +9 -0
  163. package/ui/dist/assets/{NvidiaPanel-4DlcQlyl.js → NvidiaPanel-DdG13OX4.js} +1 -1
  164. package/ui/dist/assets/OrganismPanel-xZWUJKyr.js +1 -0
  165. package/ui/dist/assets/OverviewPanel-B45ZYhJV.js +1 -0
  166. package/ui/dist/assets/{PageHeader-bnc85wQN.js → PageHeader-DdrbS1aq.js} +1 -1
  167. package/ui/dist/assets/PersonaProfilesPanel-CKER-EU5.js +8 -0
  168. package/ui/dist/assets/{PersonasPanel-dR8VppcD.js → PersonasPanel-CMMQ3nh3.js} +1 -1
  169. package/ui/dist/assets/{PhoneDeskPanel-CdVOY7H9.js → PhoneDeskPanel-Bw_Y-cVE.js} +2 -2
  170. package/ui/dist/assets/RecipesPanel-DzMcxpJJ.js +1 -0
  171. package/ui/dist/assets/SecurityPanel-BCq3Fzbr.js +1 -0
  172. package/ui/dist/assets/SelfImprovePanel-YE3hT8jK.js +1 -0
  173. package/ui/dist/assets/SelfProposalsPanel-DXuqBM6p.js +1 -0
  174. package/ui/dist/assets/SessionsPanel-DORz5goR.js +1 -0
  175. package/ui/dist/assets/SessionsTab-qYHDOuC8.js +1 -0
  176. package/ui/dist/assets/SettingsPanel-BbwPu1i7.js +1 -0
  177. package/ui/dist/assets/SettingsView-zgqkDDBJ.js +2 -0
  178. package/ui/dist/assets/{SkeletonLoader-Cax7YTqW.js → SkeletonLoader-r6OGXaU9.js} +1 -1
  179. package/ui/dist/assets/SkillsPanel-BjEOBMRo.js +11 -0
  180. package/ui/dist/assets/{SomaView-eG3wI4S1.js → SomaView-DLzApZVW.js} +2 -2
  181. package/ui/dist/assets/{StatCard-Djr487DV.js → StatCard-DLq8aBps.js} +1 -1
  182. package/ui/dist/assets/{StatusBadge-JpCoA33_.js → StatusBadge-BqlvIbdj.js} +1 -1
  183. package/ui/dist/assets/{Tabs-DJHu-roP.js → Tabs-DdUThlp1.js} +1 -1
  184. package/ui/dist/assets/TeamsPanel-uIIKoU7I.js +1 -0
  185. package/ui/dist/assets/{TelemetryPanel-D4PXsd-X.js → TelemetryPanel-dVr3yQQr.js} +1 -1
  186. package/ui/dist/assets/TitanCanvas-xHAJqwG2.js +945 -0
  187. package/ui/dist/assets/ToolsView-CG1mZdiy.js +2 -0
  188. package/ui/dist/assets/{Tooltip-B1LhTXJ8.js → Tooltip-C2tXJcrN.js} +1 -1
  189. package/ui/dist/assets/TraceViewer-BIMD_Osr.js +1 -0
  190. package/ui/dist/assets/TracesPanel-nMUiyMj5.js +1 -0
  191. package/ui/dist/assets/TrainingPanel-CT5R4HWm.js +1 -0
  192. package/ui/dist/assets/{VoiceOverlay-B_ss7Zg_.js → VoiceOverlay-Br4QnCtw.js} +3 -3
  193. package/ui/dist/assets/VramPanel-CdnJYytg.js +1 -0
  194. package/ui/dist/assets/WatchView-TNU6Ns1Q.js +13 -0
  195. package/ui/dist/assets/WorkTab-wTlX_UKP.js +1 -0
  196. package/ui/dist/assets/WorkflowBuilderPanel-CDpVt5ux.js +6 -0
  197. package/ui/dist/assets/WorkflowsPanel-zsFqsLdn.js +11 -0
  198. package/ui/dist/assets/{archive-gZFnGd5A.js → archive-Bh689DNg.js} +1 -1
  199. package/ui/dist/assets/{arrow-left-qA0Qer2h.js → arrow-left-WkVYLm80.js} +1 -1
  200. package/ui/dist/assets/{book-open-DIxdPqmD.js → book-open-ohEXgUsS.js} +1 -1
  201. package/ui/dist/assets/{bot-CvIF1uHi.js → bot-DvEcyQcD.js} +1 -1
  202. package/ui/dist/assets/{chart-column-BQiM-Td4.js → chart-column-w3goFd5f.js} +1 -1
  203. package/ui/dist/assets/{check-DgyDEFtq.js → check-CuRYh4Zh.js} +1 -1
  204. package/ui/dist/assets/{chevron-right-CQ1NTOtd.js → chevron-right-DbLSHmff.js} +1 -1
  205. package/ui/dist/assets/{circle-check-big-CAFcaPPH.js → circle-check-big-Bkba568b.js} +1 -1
  206. package/ui/dist/assets/{circle-stop-C-8xGv0n.js → circle-stop-Bx2ohEg8.js} +1 -1
  207. package/ui/dist/assets/{clipboard-list-9DdqBj1F.js → clipboard-list-Dj9tORnu.js} +1 -1
  208. package/ui/dist/assets/{clock-CF9BCIpL.js → clock-JyQAYy6X.js} +1 -1
  209. package/ui/dist/assets/{dollar-sign-LDRZBae6.js → dollar-sign-XxwPAA2a.js} +1 -1
  210. package/ui/dist/assets/{download-BBNXvBO0.js → download-D1izVEOL.js} +1 -1
  211. package/ui/dist/assets/{external-link-D_ji4Bec.js → external-link-DZ_rZsIt.js} +1 -1
  212. package/ui/dist/assets/{file-text-DrdTDEYp.js → file-text-Cfawu8Bs.js} +1 -1
  213. package/ui/dist/assets/{flask-conical-BGn5PgFX.js → flask-conical-Ql8QxhgY.js} +1 -1
  214. package/ui/dist/assets/{folder-BeZZUGnK.js → folder-DAdIw-Pb.js} +1 -1
  215. package/ui/dist/assets/{funnel-CAJgGO5M.js → funnel-FycfZcXo.js} +1 -1
  216. package/ui/dist/assets/{git-branch-BcXabeOs.js → git-branch-C2qrhGGu.js} +1 -1
  217. package/ui/dist/assets/index-Cml2x9pA.js +507 -0
  218. package/ui/dist/assets/index-yWybhcfI.css +1 -0
  219. package/ui/dist/assets/{layers-DxYDmPA_.js → layers-yzjtGlHB.js} +1 -1
  220. package/ui/dist/assets/{legacy-dHWI7k8P.js → legacy-D21WSMF1.js} +1 -1
  221. package/ui/dist/assets/{lightbulb-B0Du4SM4.js → lightbulb-BZJNK69S.js} +1 -1
  222. package/ui/dist/assets/{link-CUpaumqr.js → link-CnFkBkaY.js} +1 -1
  223. package/ui/dist/assets/{list-todo-CDDhmPQB.js → list-todo-BlgfQHup.js} +1 -1
  224. package/ui/dist/assets/{message-square-D5VWlv-Q.js → message-square-CRsG9u6_.js} +1 -1
  225. package/ui/dist/assets/{mic-Ddcc6Ann.js → mic-B32RHc7Y.js} +1 -1
  226. package/ui/dist/assets/{missions-2zox16Tc.js → missions-1iw8Z2_0.js} +1 -1
  227. package/ui/dist/assets/{network-DaJ7ugwX.js → network-C9RXQGrV.js} +1 -1
  228. package/ui/dist/assets/{pause-BukaK6rs.js → pause-BT1Bc2q3.js} +1 -1
  229. package/ui/dist/assets/{pencil-D_YwQBeg.js → pencil-BK5IU6o0.js} +1 -1
  230. package/ui/dist/assets/{play-BjdwtYMk.js → play-Cl1nC_gc.js} +1 -1
  231. package/ui/dist/assets/{plug-yISDdeW2.js → plug-DvcpOalj.js} +1 -1
  232. package/ui/dist/assets/{plus-BSjTdepW.js → plus-Dpo1qfrl.js} +1 -1
  233. package/ui/dist/assets/{radio-B7kX_yWE.js → radio-C5c9IyqX.js} +1 -1
  234. package/ui/dist/assets/{refresh-cw-CwDpzXUn.js → refresh-cw-C-iZkzuS.js} +1 -1
  235. package/ui/dist/assets/{rotate-ccw-7SQDTI0_.js → rotate-ccw-qzrB3SNw.js} +1 -1
  236. package/ui/dist/assets/{save-CjTPAQM0.js → save-DwR9wQVu.js} +1 -1
  237. package/ui/dist/assets/{search-BP7VlNxX.js → search-D10l0m3-.js} +1 -1
  238. package/ui/dist/assets/{send-C2XDuRPf.js → send-DtXGsaFW.js} +1 -1
  239. package/ui/dist/assets/{server-BE8W-AT4.js → server-BzisF3LL.js} +1 -1
  240. package/ui/dist/assets/settings-Dbwd1_-c.js +6 -0
  241. package/ui/dist/assets/{shield-check-s7la2J2K.js → shield-check-CXlDJyAW.js} +1 -1
  242. package/ui/dist/assets/square-BBC-JKzY.js +11 -0
  243. package/ui/dist/assets/{terminal-B8IK4WsO.js → terminal-DaBIlWEM.js} +1 -1
  244. package/ui/dist/assets/{test-tube-Xfn9DJeg.js → test-tube-CDATRD5t.js} +1 -1
  245. package/ui/dist/assets/{toggle-right-CHpzOIlj.js → toggle-right-DTmrC5RD.js} +1 -1
  246. package/ui/dist/assets/{trash-2-B1C85ePK.js → trash-2-CTeyjxD_.js} +1 -1
  247. package/ui/dist/assets/{trending-up-DDGHQZY1.js → trending-up-CXPRjRV4.js} +1 -1
  248. package/ui/dist/assets/{trophy-D0LhJSPA.js → trophy-DbVdXRtU.js} +1 -1
  249. package/ui/dist/assets/{volume-2-DMaE91b5.js → volume-2-DYDBmm3M.js} +1 -1
  250. package/ui/dist/assets/{wifi-off-DR9h8HGA.js → wifi-off-BBuIGbiP.js} +1 -1
  251. package/ui/dist/assets/zoom-out-D47_pRAO.js +16 -0
  252. package/ui/dist/index.html +2 -2
  253. package/ui/dist/sw.js +1 -1
  254. package/ui/dist/assets/AuditPanel-BaftX5MP.js +0 -1
  255. package/ui/dist/assets/BackupPanel-DAy9G7Wt.js +0 -1
  256. package/ui/dist/assets/CPActivity-BYDsUoMn.js +0 -1
  257. package/ui/dist/assets/CPAgentDetail-Bb9-GAJY.js +0 -1
  258. package/ui/dist/assets/CPAgents-BTZuGnki.js +0 -1
  259. package/ui/dist/assets/CPApprovals-BME2ARkO.js +0 -1
  260. package/ui/dist/assets/CPCosts-mOXwWq0i.js +0 -1
  261. package/ui/dist/assets/CPDashboard-CTlKGXXQ.js +0 -1
  262. package/ui/dist/assets/CPGoals-BNWhNP14.js +0 -1
  263. package/ui/dist/assets/CPInbox-ybe4r8LW.js +0 -16
  264. package/ui/dist/assets/CPIssueDetail-DaMMGbjw.js +0 -1
  265. package/ui/dist/assets/CPIssues-BgpQOISw.js +0 -1
  266. package/ui/dist/assets/CPLayout-bgErauTx.js +0 -2
  267. package/ui/dist/assets/CPOrg-C8l5SIWJ.js +0 -8
  268. package/ui/dist/assets/CPRuns-DB8S7loF.js +0 -1
  269. package/ui/dist/assets/CPVoice-DfwHPewA.js +0 -1
  270. package/ui/dist/assets/CheckpointsPanel-9-l_8GdG.js +0 -1
  271. package/ui/dist/assets/CommandPostHub-z55Yrhj1.js +0 -24
  272. package/ui/dist/assets/CronPanel-kEZK3gpx.js +0 -1
  273. package/ui/dist/assets/EmptyState-CfvU7SdB.js +0 -1
  274. package/ui/dist/assets/EvalPanel-CDG-njyj.js +0 -1
  275. package/ui/dist/assets/FilesPanel-CaLPog2e.js +0 -16
  276. package/ui/dist/assets/FleetPanel-BtlaV6pH.js +0 -1
  277. package/ui/dist/assets/InfraView-C0zEuFrR.js +0 -2
  278. package/ui/dist/assets/Input-CbrMbLgn.js +0 -1
  279. package/ui/dist/assets/IntegrationsPanel-B4TyR6jC.js +0 -1
  280. package/ui/dist/assets/IntelligenceView-DZ4HxYZ3.js +0 -2
  281. package/ui/dist/assets/LearningPanel-B4RIm_iQ.js +0 -1
  282. package/ui/dist/assets/McpPanel-BmNUFozc.js +0 -1
  283. package/ui/dist/assets/MemoryGraphPanel-JPurHV0L.js +0 -16
  284. package/ui/dist/assets/MemoryWikiPanel-DdvCAZHa.js +0 -6
  285. package/ui/dist/assets/MissionStart-wUkcEP0T.js +0 -1
  286. package/ui/dist/assets/Modal-BmS7C6FN.js +0 -1
  287. package/ui/dist/assets/OrganismPanel-C2LYDPrn.js +0 -1
  288. package/ui/dist/assets/OverviewPanel-DK8uuq4D.js +0 -1
  289. package/ui/dist/assets/PersonaProfilesPanel-DGtokXUu.js +0 -8
  290. package/ui/dist/assets/RecipesPanel-D3Zs2wxr.js +0 -1
  291. package/ui/dist/assets/SecurityPanel-BMERf796.js +0 -1
  292. package/ui/dist/assets/SelfImprovePanel-BxqWHXCU.js +0 -1
  293. package/ui/dist/assets/SelfProposalsPanel-CuC94vdx.js +0 -2
  294. package/ui/dist/assets/SessionsPanel-CQ8qvzp7.js +0 -1
  295. package/ui/dist/assets/SessionsTab-B3eHV3jf.js +0 -1
  296. package/ui/dist/assets/SettingsPanel-Cumls7N2.js +0 -1
  297. package/ui/dist/assets/SettingsView-BtA67pol.js +0 -2
  298. package/ui/dist/assets/SkillsPanel-CA415CT8.js +0 -11
  299. package/ui/dist/assets/TeamsPanel-C_Vu6vnY.js +0 -1
  300. package/ui/dist/assets/TitanCanvas-TuYZSZO7.js +0 -1117
  301. package/ui/dist/assets/ToolsView-BvTN6vFn.js +0 -2
  302. package/ui/dist/assets/TraceViewer-Bh8Jo3Dr.js +0 -1
  303. package/ui/dist/assets/TrainingPanel-Dmbd1rJ-.js +0 -1
  304. package/ui/dist/assets/VramPanel-CPICbZ2s.js +0 -1
  305. package/ui/dist/assets/WatchView-BCgLVfiV.js +0 -13
  306. package/ui/dist/assets/WorkTab-iptofXO9.js +0 -1
  307. package/ui/dist/assets/WorkflowsPanel-3RYkFHyf.js +0 -11
  308. package/ui/dist/assets/chevron-up-UyfdjRp6.js +0 -6
  309. package/ui/dist/assets/index-CUgepw5Q.js +0 -337
  310. package/ui/dist/assets/index-Dm6zcSTS.css +0 -1
  311. package/ui/dist/assets/proxy-CWET5FFX.js +0 -9
@@ -1,4 +1,4 @@
1
- import{c as M,r as c,a8 as B,j as e,L as C,i as F,Z as E,a9 as O,t as T,b,f as g,B as q,U as G,G as V,h as I}from"./index-CUgepw5Q.js";import{S as D}from"./save-CjTPAQM0.js";import{C as H}from"./circle-check-big-CAFcaPPH.js";import{R as U}from"./refresh-cw-CwDpzXUn.js";import{R}from"./rotate-ccw-7SQDTI0_.js";import{R as J}from"./radio-B7kX_yWE.js";import{B as Z}from"./bot-CvIF1uHi.js";import{S as W}from"./server-BE8W-AT4.js";import{N as K}from"./network-DaJ7ugwX.js";import{P as Q}from"./play-BjdwtYMk.js";import{M as X}from"./message-square-D5VWlv-Q.js";import{D as Y}from"./TitanCanvas-TuYZSZO7.js";import"./chevron-up-UyfdjRp6.js";import"./plus-BSjTdepW.js";import"./file-text-DrdTDEYp.js";import"./terminal-B8IK4WsO.js";import"./book-open-DIxdPqmD.js";import"./pencil-D_YwQBeg.js";import"./search-BP7VlNxX.js";import"./send-C2XDuRPf.js";import"./mic-Ddcc6Ann.js";import"./flask-conical-BGn5PgFX.js";import"./clock-CF9BCIpL.js";import"./archive-gZFnGd5A.js";import"./test-tube-Xfn9DJeg.js";import"./VoiceOverlay-B_ss7Zg_.js";import"./chevron-right-CQ1NTOtd.js";import"./volume-2-DMaE91b5.js";import"./folder-BeZZUGnK.js";import"./check-DgyDEFtq.js";import"./shield-check-s7la2J2K.js";import"./external-link-D_ji4Bec.js";import"./wifi-off-DR9h8HGA.js";import"./chart-column-BQiM-Td4.js";import"./link-CUpaumqr.js";import"./trash-2-B1C85ePK.js";/**
1
+ import{c as M,r as c,aa as B,j as e,L as C,k as F,Z as E,ab as O,v as T,b,S as g,B as q,U as G,G as V,i as I}from"./index-Cml2x9pA.js";import{S as D}from"./save-DwR9wQVu.js";import{C as H}from"./circle-check-big-Bkba568b.js";import{R as U}from"./refresh-cw-C-iZkzuS.js";import{R}from"./rotate-ccw-qzrB3SNw.js";import{R as J}from"./radio-C5c9IyqX.js";import{B as Z}from"./bot-DvEcyQcD.js";import{S as W}from"./server-BzisF3LL.js";import{N as K}from"./network-C9RXQGrV.js";import{P as Q}from"./play-Cl1nC_gc.js";import{M as X}from"./message-square-CRsG9u6_.js";import{D as Y}from"./TitanCanvas-xHAJqwG2.js";import"./zoom-out-D47_pRAO.js";import"./ConfirmDialog-VErHWAbo.js";import"./Modal-ybPGvlQs.js";import"./clsx-B-dksMZM.js";import"./Button-MdXmb4_n.js";import"./square-BBC-JKzY.js";import"./plus-Dpo1qfrl.js";import"./file-text-Cfawu8Bs.js";import"./settings-Dbwd1_-c.js";import"./terminal-DaBIlWEM.js";import"./book-open-ohEXgUsS.js";import"./pencil-BK5IU6o0.js";import"./search-D10l0m3-.js";import"./send-DtXGsaFW.js";import"./mic-B32RHc7Y.js";import"./flask-conical-Ql8QxhgY.js";import"./clock-JyQAYy6X.js";import"./archive-Bh689DNg.js";import"./test-tube-CDATRD5t.js";import"./VoiceOverlay-Br4QnCtw.js";import"./chevron-right-DbLSHmff.js";import"./volume-2-DYDBmm3M.js";import"./folder-DAdIw-Pb.js";import"./check-CuRYh4Zh.js";import"./shield-check-CXlDJyAW.js";import"./external-link-DZ_rZsIt.js";import"./wifi-off-BBuIGbiP.js";import"./chart-column-w3goFd5f.js";import"./link-CnFkBkaY.js";import"./trash-2-CTeyjxD_.js";/**
2
2
  * @license lucide-react v0.513.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,4 +8,4 @@ import{c as M,r as c,a8 as B,j as e,L as C,i as F,Z as E,a9 as O,t as T,b,f as g
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const te=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],ae=M("puzzle",te),v=[{key:"autonomy-mode",label:"Autonomous Mode",description:"TITAN acts without asking for approval on moderate-risk tools. Supervised = asks for dangerous ops. Locked = asks for everything.",icon:e.jsx(E,{className:"h-4 w-4"}),section:"autonomy",field:"mode",danger:!0},{key:"autonomy-autoProposeGoals",label:"Auto-Propose Goals",description:"TITAN can create its own goals from drives, observations, and initiatives.",icon:e.jsx(g,{className:"h-4 w-4"}),section:"autonomy",field:"autoProposeGoals"},{key:"autonomy-proactiveInitiative",label:"Proactive Initiative",description:"TITAN takes initiative on its own between user messages.",icon:e.jsx(J,{className:"h-4 w-4"}),section:"autonomy",field:"proactiveInitiative"},{key:"selfMod-enabled",label:"Self-Modification",description:"Captures autonomous code changes and queues them for review.",icon:e.jsx(Z,{className:"h-4 w-4"}),section:"selfMod",field:"enabled",danger:!0},{key:"selfMod-autoPR",label:"Auto-Open PRs",description:"When specialists approve a self-mod, automatically open a GitHub PR.",icon:e.jsx(oe,{className:"h-4 w-4"}),section:"selfMod",field:"autoPR"},{key:"commandPost-enabled",label:"Command Post",description:"Org chart, agent registry, approvals, budgets, and goal tracking.",icon:e.jsx(W,{className:"h-4 w-4"}),section:"commandPost",field:"enabled"},{key:"mesh-enabled",label:"Mesh Networking",description:"Distributed TITAN nodes. Share tasks and models across machines.",icon:e.jsx(K,{className:"h-4 w-4"}),section:"mesh",field:"enabled"},{key:"autopilot-enabled",label:"Autopilot",description:"Nightly autonomous checks, goal reviews, and self-improvement runs.",icon:e.jsx(Q,{className:"h-4 w-4"}),section:"autopilot",field:"enabled"},{key:"autopilot-selfInitiate",label:"Autopilot Self-Initiate",description:"Autopilot can create and start its own goals without human trigger.",icon:e.jsx(g,{className:"h-4 w-4"}),section:"autopilot",field:"selfInitiate"},{key:"brain-enabled",label:"Brain (Local Router)",description:"Small local model routes tools instead of sending full schemas to the cloud LLM.",icon:e.jsx(q,{className:"h-4 w-4"}),section:"brain",field:"enabled"},{key:"mcp-server-enabled",label:"MCP Server",description:"Expose TITAN tools as a Model Context Protocol server for other AI apps.",icon:e.jsx(ae,{className:"h-4 w-4"}),section:"mcp",field:"serverEnabled"},{key:"training-enabled",label:"Model Training",description:"Fine-tune local LoRA adapters from session history.",icon:e.jsx(se,{className:"h-4 w-4"}),section:"training",field:"enabled"},{key:"teams-enabled",label:"Teams",description:"Multi-user teams with roles, invites, and permissions.",icon:e.jsx(G,{className:"h-4 w-4"}),section:"teams",field:"enabled"},{key:"tunnel-enabled",label:"Cloudflare Tunnel",description:"Expose TITAN securely on the public internet via Cloudflare.",icon:e.jsx(V,{className:"h-4 w-4"}),section:"tunnel",field:"enabled"},{key:"vault-enabled",label:"Vault",description:"Encrypted secret storage for API keys and credentials.",icon:e.jsx(I,{className:"h-4 w-4"}),section:"vault",field:"enabled"},{key:"capsolver-enabled",label:"CAPTCHA Solver",description:"Automatically solve CAPTCHAs during web browsing.",icon:e.jsx(I,{className:"h-4 w-4"}),section:"capsolver",field:"enabled"},{key:"deliberation-autoDetect",label:"Auto-Deliberation",description:"TITAN automatically deliberates on complex tasks before acting.",icon:e.jsx(X,{className:"h-4 w-4"}),section:"deliberation",field:"autoDetect"},{key:"selfImprove-autoApply",label:"Auto-Apply Self-Improvements",description:"Apply prompt and config improvements automatically without approval.",icon:e.jsx(g,{className:"h-4 w-4"}),section:"selfImprove",field:"autoApply"},{key:"memory-vectorSearchEnabled",label:"Vector Memory Search",description:"Semantic search across episodic memories using embeddings.",icon:e.jsx(Y,{className:"h-4 w-4"}),section:"memory",field:"vectorSearchEnabled"}];function oe({className:n}){return e.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})})}function P({active:n}){return n?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-success/15 px-2 py-0.5 text-[10px] font-medium text-success",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-success shadow-[0_0_4px_rgba(34,197,94,0.4)]"}),"ON"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-bg-tertiary px-2 py-0.5 text-[10px] font-medium text-text-muted",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-border-light"}),"OFF"]})}function qe(){const[n,y]=c.useState(null),[L,N]=c.useState(!0),[x,j]=c.useState(!1),[f,m]=c.useState(!1),[p,w]=c.useState(null),[d,k]=c.useState(new Set),[h,A]=c.useState({}),l=c.useCallback((s,t)=>{w({type:s,message:t}),setTimeout(()=>w(null),4e3)},[]);c.useEffect(()=>{B().then(s=>{y(s),N(!1)}).catch(s=>{l("error",s instanceof Error?s.message:"Failed to load config"),N(!1)})},[l]);const u=(s,t)=>{if(t==="serverEnabled"){const a=n==null?void 0:n.mcp,r=a==null?void 0:a.server;return!!(r!=null&&r.enabled)}if(t==="selfInitiate"){const a=n==null?void 0:n.autopilot,r=a==null?void 0:a.goals;return!!(r!=null&&r.selfInitiate)}const o=`${s}.${t}`;if(o in h)return h[o];const i=n==null?void 0:n[s];return i?i[t]:!1},S=(s,t,o)=>{const i=`${s}.${t}`;A(a=>({...a,[i]:o})),k(a=>new Set(a).add(i))},$=v.filter(s=>{const t=u(s.section,s.field);return typeof t=="boolean"?t:t==="autonomous"}).length,z=async()=>{j(!0);try{const s={};for(const o of d){const[i,a]=o.split("."),r=h[o];s[i]||(s[i]={}),a==="serverEnabled"?(s.mcp||(s.mcp={}),s.mcp.server={enabled:r}):a==="selfInitiate"?(s.autopilot||(s.autopilot={}),s.autopilot.goals={selfInitiate:r}):s[i][a]=r}const t=await O(s);y(t),A({}),k(new Set),T("autonomy_settings_saved",{changedCount:d.size}),l("success",`Saved ${d.size} change${d.size!==1?"s":""}`)}catch(s){l("error",s instanceof Error?s.message:"Failed to save")}finally{j(!1)}},_=async()=>{m(!0);try{const s=await b("/api/system/request-restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Settings change via Autonomy Panel",requestedBy:"user"})});if(!s.ok){const r=await s.json().catch(()=>({error:"Request failed"}));l("error",r.error||"Restart request failed"),m(!1);return}const{approval:t}=await s.json(),o=await b(`/api/command-post/approvals/${t.id}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decidedBy:"user",note:"Approved via Autonomy Panel"})});if(!o.ok){const r=await o.json().catch(()=>({error:"Approval failed"}));l("error",r.error||"Restart approval failed"),m(!1);return}l("info","TITAN is restarting..."),T("titan_restart_initiated",{source:"autonomy_panel"});let i=0;const a=setInterval(async()=>{i++;try{(await b("/api/health")).ok&&(clearInterval(a),m(!1),l("success","TITAN restarted successfully"))}catch{}i>30&&(clearInterval(a),m(!1),l("error","Restart timed out — check Titan PC"))},2e3)}catch(s){l("error",s instanceof Error?s.message:"Restart failed"),m(!1)}};return L?e.jsx("div",{className:"space-y-4",children:Array.from({length:4}).map((s,t)=>e.jsx("div",{className:"h-32 animate-pulse rounded-xl border border-border bg-bg-secondary"},t))}):e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-text",children:"Autonomy & Features"}),e.jsxs("p",{className:"mt-0.5 text-xs text-text-muted",children:[$," of ",v.length," features active"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d.size>0&&e.jsxs("span",{className:"rounded-full bg-accent/15 px-2.5 py-1 text-[10px] font-medium text-accent",children:[d.size," unsaved"]}),e.jsxs("button",{onClick:z,disabled:x||d.size===0,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50",children:[x?e.jsx(C,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(D,{className:"h-3.5 w-3.5"}),x?"Saving…":"Save Changes"]})]})]}),p&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-3 py-2 text-xs ${p.type==="success"?"border-success/50 text-success":p.type==="error"?"border-error/50 text-error":"border-accent/50 text-accent"}`,children:[p.type==="success"?e.jsx(H,{className:"h-4 w-4"}):p.type==="error"?e.jsx(F,{className:"h-4 w-4"}):e.jsx(U,{className:"h-4 w-4 animate-spin"}),p.message]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(E,{className:"h-4 w-4 text-accent"}),e.jsx("h3",{className:"text-sm font-medium text-text",children:"Autonomy Level"}),e.jsx(P,{active:u("autonomy","mode")==="autonomous"})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:["locked","supervised","autonomous"].map(s=>e.jsxs("button",{onClick:()=>S("autonomy","mode",s),className:`rounded-lg border p-3 text-left transition-all ${u("autonomy","mode")===s?"border-accent bg-accent/10":"border-border hover:border-border-light"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-text capitalize",children:s}),s==="autonomous"&&e.jsx("span",{className:"text-[9px] text-error",children:"High"}),s==="supervised"&&e.jsx("span",{className:"text-[9px] text-warning",children:"Med"}),s==="locked"&&e.jsx("span",{className:"text-[9px] text-success",children:"Low"})]}),e.jsxs("p",{className:"mt-1 text-[10px] text-text-muted leading-relaxed",children:[s==="locked"&&"Asks for approval on every tool call.",s==="supervised"&&"Auto-approves safe tools. Asks for dangerous ops.",s==="autonomous"&&"Full auto. Only asks for destructive/rare ops."]})]},s))})]}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:v.filter(s=>s.field!=="mode").map(s=>{const t=u(s.section,s.field),o=typeof t=="boolean"?t:!1,i=d.has(`${s.section}.${s.field}`);return e.jsxs("div",{className:`flex items-start gap-3 rounded-xl border p-3 transition-colors ${i?"border-accent/40 bg-accent/5":"border-border bg-bg-secondary"}`,children:[e.jsx("div",{className:`mt-0.5 flex-shrink-0 rounded-lg p-2 ${o?"bg-accent/15 text-accent":"bg-bg-tertiary text-text-muted"}`,children:s.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-text",children:s.label}),e.jsx(P,{active:o})]}),e.jsx("p",{className:"mt-0.5 text-[11px] text-text-muted leading-relaxed",children:s.description})]}),e.jsxs("label",{className:"flex-shrink-0 relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:o,onChange:a=>S(s.section,s.field,a.target.checked),className:"sr-only peer"}),e.jsx("div",{className:`relative w-9 h-5 rounded-full transition-colors ${o?"bg-accent":"bg-border"}`,children:e.jsx("div",{className:`absolute top-[2px] left-[2px] bg-white w-4 h-4 rounded-full transition-transform ${o?"translate-x-4":"translate-x-0"}`})})]})]},s.key)})}),e.jsx("div",{className:"rounded-xl border border-warning/30 bg-warning/5 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(R,{className:"h-4 w-4 text-warning mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:"Restart TITAN"}),e.jsx("p",{className:"mt-0.5 text-[11px] text-text-muted",children:"Some feature changes require a full restart to take effect. This will briefly interrupt service."})]}),e.jsxs("button",{onClick:_,disabled:f,className:"flex items-center gap-1.5 rounded-lg border border-warning/50 px-3 py-1.5 text-xs font-medium text-warning transition-colors hover:bg-warning/10 disabled:opacity-50",children:[f?e.jsx(C,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(R,{className:"h-3.5 w-3.5"}),f?"Restarting…":"Restart"]})]})})]})}export{qe as default};
11
+ */const te=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],ae=M("puzzle",te),v=[{key:"autonomy-mode",label:"Autonomous Mode",description:"TITAN acts without asking for approval on moderate-risk tools. Supervised = asks for dangerous ops. Locked = asks for everything.",icon:e.jsx(E,{className:"h-4 w-4"}),section:"autonomy",field:"mode",danger:!0},{key:"autonomy-autoProposeGoals",label:"Auto-Propose Goals",description:"TITAN can create its own goals from drives, observations, and initiatives.",icon:e.jsx(g,{className:"h-4 w-4"}),section:"autonomy",field:"autoProposeGoals"},{key:"autonomy-proactiveInitiative",label:"Proactive Initiative",description:"TITAN takes initiative on its own between user messages.",icon:e.jsx(J,{className:"h-4 w-4"}),section:"autonomy",field:"proactiveInitiative"},{key:"selfMod-enabled",label:"Self-Modification",description:"Captures autonomous code changes and queues them for review.",icon:e.jsx(Z,{className:"h-4 w-4"}),section:"selfMod",field:"enabled",danger:!0},{key:"selfMod-autoPR",label:"Auto-Open PRs",description:"When specialists approve a self-mod, automatically open a GitHub PR.",icon:e.jsx(oe,{className:"h-4 w-4"}),section:"selfMod",field:"autoPR"},{key:"commandPost-enabled",label:"Command Post",description:"Org chart, agent registry, approvals, budgets, and goal tracking.",icon:e.jsx(W,{className:"h-4 w-4"}),section:"commandPost",field:"enabled"},{key:"mesh-enabled",label:"Mesh Networking",description:"Distributed TITAN nodes. Share tasks and models across machines.",icon:e.jsx(K,{className:"h-4 w-4"}),section:"mesh",field:"enabled"},{key:"autopilot-enabled",label:"Autopilot",description:"Nightly autonomous checks, goal reviews, and self-improvement runs.",icon:e.jsx(Q,{className:"h-4 w-4"}),section:"autopilot",field:"enabled"},{key:"autopilot-selfInitiate",label:"Autopilot Self-Initiate",description:"Autopilot can create and start its own goals without human trigger.",icon:e.jsx(g,{className:"h-4 w-4"}),section:"autopilot",field:"selfInitiate"},{key:"brain-enabled",label:"Brain (Local Router)",description:"Small local model routes tools instead of sending full schemas to the cloud LLM.",icon:e.jsx(q,{className:"h-4 w-4"}),section:"brain",field:"enabled"},{key:"mcp-server-enabled",label:"MCP Server",description:"Expose TITAN tools as a Model Context Protocol server for other AI apps.",icon:e.jsx(ae,{className:"h-4 w-4"}),section:"mcp",field:"serverEnabled"},{key:"training-enabled",label:"Model Training",description:"Fine-tune local LoRA adapters from session history.",icon:e.jsx(se,{className:"h-4 w-4"}),section:"training",field:"enabled"},{key:"teams-enabled",label:"Teams",description:"Multi-user teams with roles, invites, and permissions.",icon:e.jsx(G,{className:"h-4 w-4"}),section:"teams",field:"enabled"},{key:"tunnel-enabled",label:"Cloudflare Tunnel",description:"Expose TITAN securely on the public internet via Cloudflare.",icon:e.jsx(V,{className:"h-4 w-4"}),section:"tunnel",field:"enabled"},{key:"vault-enabled",label:"Vault",description:"Encrypted secret storage for API keys and credentials.",icon:e.jsx(I,{className:"h-4 w-4"}),section:"vault",field:"enabled"},{key:"capsolver-enabled",label:"CAPTCHA Solver",description:"Automatically solve CAPTCHAs during web browsing.",icon:e.jsx(I,{className:"h-4 w-4"}),section:"capsolver",field:"enabled"},{key:"deliberation-autoDetect",label:"Auto-Deliberation",description:"TITAN automatically deliberates on complex tasks before acting.",icon:e.jsx(X,{className:"h-4 w-4"}),section:"deliberation",field:"autoDetect"},{key:"selfImprove-autoApply",label:"Auto-Apply Self-Improvements",description:"Apply prompt and config improvements automatically without approval.",icon:e.jsx(g,{className:"h-4 w-4"}),section:"selfImprove",field:"autoApply"},{key:"memory-vectorSearchEnabled",label:"Vector Memory Search",description:"Semantic search across episodic memories using embeddings.",icon:e.jsx(Y,{className:"h-4 w-4"}),section:"memory",field:"vectorSearchEnabled"}];function oe({className:n}){return e.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})})}function P({active:n}){return n?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-success/15 px-2 py-0.5 text-[10px] font-medium text-success",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-success shadow-[0_0_4px_rgba(34,197,94,0.4)]"}),"ON"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-bg-tertiary px-2 py-0.5 text-[10px] font-medium text-text-muted",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-border-light"}),"OFF"]})}function Je(){const[n,y]=c.useState(null),[L,N]=c.useState(!0),[x,j]=c.useState(!1),[f,m]=c.useState(!1),[p,w]=c.useState(null),[d,k]=c.useState(new Set),[h,A]=c.useState({}),l=c.useCallback((s,t)=>{w({type:s,message:t}),setTimeout(()=>w(null),4e3)},[]);c.useEffect(()=>{B().then(s=>{y(s),N(!1)}).catch(s=>{l("error",s instanceof Error?s.message:"Failed to load config"),N(!1)})},[l]);const u=(s,t)=>{if(t==="serverEnabled"){const a=n==null?void 0:n.mcp,r=a==null?void 0:a.server;return!!(r!=null&&r.enabled)}if(t==="selfInitiate"){const a=n==null?void 0:n.autopilot,r=a==null?void 0:a.goals;return!!(r!=null&&r.selfInitiate)}const o=`${s}.${t}`;if(o in h)return h[o];const i=n==null?void 0:n[s];return i?i[t]:!1},S=(s,t,o)=>{const i=`${s}.${t}`;A(a=>({...a,[i]:o})),k(a=>new Set(a).add(i))},$=v.filter(s=>{const t=u(s.section,s.field);return typeof t=="boolean"?t:t==="autonomous"}).length,z=async()=>{j(!0);try{const s={};for(const o of d){const[i,a]=o.split("."),r=h[o];s[i]||(s[i]={}),a==="serverEnabled"?(s.mcp||(s.mcp={}),s.mcp.server={enabled:r}):a==="selfInitiate"?(s.autopilot||(s.autopilot={}),s.autopilot.goals={selfInitiate:r}):s[i][a]=r}const t=await O(s);y(t),A({}),k(new Set),T("autonomy_settings_saved",{changedCount:d.size}),l("success",`Saved ${d.size} change${d.size!==1?"s":""}`)}catch(s){l("error",s instanceof Error?s.message:"Failed to save")}finally{j(!1)}},_=async()=>{m(!0);try{const s=await b("/api/system/request-restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Settings change via Autonomy Panel",requestedBy:"user"})});if(!s.ok){const r=await s.json().catch(()=>({error:"Request failed"}));l("error",r.error||"Restart request failed"),m(!1);return}const{approval:t}=await s.json(),o=await b(`/api/command-post/approvals/${t.id}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decidedBy:"user",note:"Approved via Autonomy Panel"})});if(!o.ok){const r=await o.json().catch(()=>({error:"Approval failed"}));l("error",r.error||"Restart approval failed"),m(!1);return}l("info","TITAN is restarting..."),T("titan_restart_initiated",{source:"autonomy_panel"});let i=0;const a=setInterval(async()=>{i++;try{(await b("/api/health")).ok&&(clearInterval(a),m(!1),l("success","TITAN restarted successfully"))}catch{}i>30&&(clearInterval(a),m(!1),l("error","Restart timed out — check Titan PC"))},2e3)}catch(s){l("error",s instanceof Error?s.message:"Restart failed"),m(!1)}};return L?e.jsx("div",{className:"space-y-4",children:Array.from({length:4}).map((s,t)=>e.jsx("div",{className:"h-32 animate-pulse rounded-xl border border-border bg-bg-secondary"},t))}):e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-text",children:"Autonomy & Features"}),e.jsxs("p",{className:"mt-0.5 text-xs text-text-muted",children:[$," of ",v.length," features active"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d.size>0&&e.jsxs("span",{className:"rounded-full bg-accent/15 px-2.5 py-1 text-[10px] font-medium text-accent",children:[d.size," unsaved"]}),e.jsxs("button",{onClick:z,disabled:x||d.size===0,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50",children:[x?e.jsx(C,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(D,{className:"h-3.5 w-3.5"}),x?"Saving…":"Save Changes"]})]})]}),p&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-3 py-2 text-xs ${p.type==="success"?"border-success/50 text-success":p.type==="error"?"border-error/50 text-error":"border-accent/50 text-accent"}`,children:[p.type==="success"?e.jsx(H,{className:"h-4 w-4"}):p.type==="error"?e.jsx(F,{className:"h-4 w-4"}):e.jsx(U,{className:"h-4 w-4 animate-spin"}),p.message]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(E,{className:"h-4 w-4 text-accent"}),e.jsx("h3",{className:"text-sm font-medium text-text",children:"Autonomy Level"}),e.jsx(P,{active:u("autonomy","mode")==="autonomous"})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:["locked","supervised","autonomous"].map(s=>e.jsxs("button",{onClick:()=>S("autonomy","mode",s),className:`rounded-lg border p-3 text-left transition-all ${u("autonomy","mode")===s?"border-accent bg-accent/10":"border-border hover:border-border-light"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-text capitalize",children:s}),s==="autonomous"&&e.jsx("span",{className:"text-[9px] text-error",children:"High"}),s==="supervised"&&e.jsx("span",{className:"text-[9px] text-warning",children:"Med"}),s==="locked"&&e.jsx("span",{className:"text-[9px] text-success",children:"Low"})]}),e.jsxs("p",{className:"mt-1 text-[10px] text-text-muted leading-relaxed",children:[s==="locked"&&"Asks for approval on every tool call.",s==="supervised"&&"Auto-approves safe tools. Asks for dangerous ops.",s==="autonomous"&&"Full auto. Only asks for destructive/rare ops."]})]},s))})]}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:v.filter(s=>s.field!=="mode").map(s=>{const t=u(s.section,s.field),o=typeof t=="boolean"?t:!1,i=d.has(`${s.section}.${s.field}`);return e.jsxs("div",{className:`flex items-start gap-3 rounded-xl border p-3 transition-colors ${i?"border-accent/40 bg-accent/5":"border-border bg-bg-secondary"}`,children:[e.jsx("div",{className:`mt-0.5 flex-shrink-0 rounded-lg p-2 ${o?"bg-accent/15 text-accent":"bg-bg-tertiary text-text-muted"}`,children:s.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-text",children:s.label}),e.jsx(P,{active:o})]}),e.jsx("p",{className:"mt-0.5 text-[11px] text-text-muted leading-relaxed",children:s.description})]}),e.jsxs("label",{className:"flex-shrink-0 relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:o,onChange:a=>S(s.section,s.field,a.target.checked),className:"sr-only peer"}),e.jsx("div",{className:`relative w-9 h-5 rounded-full transition-colors ${o?"bg-accent":"bg-border"}`,children:e.jsx("div",{className:`absolute top-[2px] left-[2px] bg-white w-4 h-4 rounded-full transition-transform ${o?"translate-x-4":"translate-x-0"}`})})]})]},s.key)})}),e.jsx("div",{className:"rounded-xl border border-warning/30 bg-warning/5 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(R,{className:"h-4 w-4 text-warning mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:"Restart TITAN"}),e.jsx("p",{className:"mt-0.5 text-[11px] text-text-muted",children:"Some feature changes require a full restart to take effect. This will briefly interrupt service."})]}),e.jsxs("button",{onClick:_,disabled:f,className:"flex items-center gap-1.5 rounded-lg border border-warning/50 px-3 py-1.5 text-xs font-medium text-warning transition-colors hover:bg-warning/10 disabled:opacity-50",children:[f?e.jsx(C,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(R,{className:"h-3.5 w-3.5"}),f?"Restarting…":"Restart"]})]})})]})}export{Je as default};
@@ -1 +1 @@
1
- import{r,b as n,j as e}from"./index-CUgepw5Q.js";import{P as c}from"./PageHeader-bnc85wQN.js";import"./chevron-right-CQ1NTOtd.js";function p(){const[t,s]=r.useState(null),[l,i]=r.useState(!0);return r.useEffect(()=>{n("/api/config",{headers:{"Content-Type":"application/json"}}).then(a=>a.json()).then(a=>{var o,d;return s({mode:((o=a.autonomy)==null?void 0:o.mode)||"supervised",interval:(d=a.autonomy)==null?void 0:d.autopilotIntervalMs})}).catch(()=>s({mode:"supervised"})).finally(()=>i(!1))},[]),l?e.jsx("div",{className:"text-[var(--text-muted)]",children:"Loading autopilot config..."}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(c,{title:"Autopilot",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Agent"},{label:"Autopilot"}]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Mode"}),e.jsx("p",{className:"text-lg font-semibold text-[var(--text)] capitalize",children:t==null?void 0:t.mode})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Interval"}),e.jsx("p",{className:"text-lg font-semibold text-[var(--text)]",children:t!=null&&t.interval?`${Math.round(t.interval/6e4)} min`:"Not set"})]})]}),e.jsx("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Autopilot mode enables TITAN to run scheduled tasks automatically. Configure via titan.json."})})]})}export{p as default};
1
+ import{r,b as n,j as e}from"./index-Cml2x9pA.js";import{P as c}from"./PageHeader-DdrbS1aq.js";import"./chevron-right-DbLSHmff.js";function p(){const[t,s]=r.useState(null),[l,i]=r.useState(!0);return r.useEffect(()=>{n("/api/config",{headers:{"Content-Type":"application/json"}}).then(a=>a.json()).then(a=>{var o,d;return s({mode:((o=a.autonomy)==null?void 0:o.mode)||"supervised",interval:(d=a.autonomy)==null?void 0:d.autopilotIntervalMs})}).catch(()=>s({mode:"supervised"})).finally(()=>i(!1))},[]),l?e.jsx("div",{className:"text-[var(--text-muted)]",children:"Loading autopilot config..."}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(c,{title:"Autopilot",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Agent"},{label:"Autopilot"}]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Mode"}),e.jsx("p",{className:"text-lg font-semibold text-[var(--text)] capitalize",children:t==null?void 0:t.mode})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Interval"}),e.jsx("p",{className:"text-lg font-semibold text-[var(--text)]",children:t!=null&&t.interval?`${Math.round(t.interval/6e4)} min`:"Not set"})]})]}),e.jsx("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Autopilot mode enables TITAN to run scheduled tasks automatically. Configure via titan.json."})})]})}export{p as default};
@@ -1,6 +1,6 @@
1
- import{c as q,r as p,b as A,j as e,a7 as O,V as W}from"./index-CUgepw5Q.js";import{P as B}from"./PageHeader-bnc85wQN.js";import{P as M}from"./play-BjdwtYMk.js";import{P as H}from"./pause-BukaK6rs.js";import{R as V}from"./refresh-cw-CwDpzXUn.js";import{F as P}from"./flask-conical-BGn5PgFX.js";import{T as G}from"./trophy-D0LhJSPA.js";import{T as U}from"./trending-up-DDGHQZY1.js";import{C as J}from"./clock-CF9BCIpL.js";import{C as K}from"./chevron-right-CQ1NTOtd.js";/**
1
+ import{c as q,r as p,b as A,j as e,a9 as O,$ as W}from"./index-Cml2x9pA.js";import{P as B}from"./PageHeader-DdrbS1aq.js";import{P as M}from"./play-Cl1nC_gc.js";import{P as H}from"./pause-BT1Bc2q3.js";import{R as G}from"./refresh-cw-C-iZkzuS.js";import{F as P}from"./flask-conical-Ql8QxhgY.js";import{T as U}from"./trophy-DbVdXRtU.js";import{T as V}from"./trending-up-CXPRjRV4.js";import{C as J}from"./clock-JyQAYy6X.js";import{C as K}from"./chevron-right-DbLSHmff.js";/**
2
2
  * @license lucide-react v0.513.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const X=[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Y=q("settings-2",X);function L(t){const x=Date.now()-new Date(t).getTime(),i=Math.floor(x/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;const a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function D(t){if(t<60)return`${Math.round(t)}s`;const x=Math.floor(t/60),i=Math.round(t%60);return`${x}m ${i}s`}function Q({runs:t}){if(t.length<2)return e.jsx("div",{className:"flex items-center justify-center h-[200px] rounded-xl border border-bg-tertiary bg-bg-secondary text-text-muted text-sm",children:"Need at least 2 runs to show chart"});const x=800,i=200,a={top:20,right:20,bottom:30,left:50},b=x-a.left-a.right,$=i-a.top-a.bottom,N=t.map(r=>r.val_score),y=Math.max(0,Math.min(...N)-5),_=Math.min(100,Math.max(...N)+5),j=t.length>0?t[0].val_score:null,f=r=>a.left+r/(t.length-1)*b,S=r=>a.top+$-(r-y)/(_-y)*$,v=t.map((r,l)=>`${l===0?"M":"L"} ${f(l)} ${S(r.val_score)}`).join(" "),d=j!=null?S(j):null;return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4 overflow-x-auto",children:[e.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Val Score Over Time"}),e.jsxs("svg",{viewBox:`0 0 ${x} ${i}`,className:"w-full",style:{minWidth:400},children:[[0,.25,.5,.75,1].map(r=>{const l=a.top+$*(1-r),R=y+(_-y)*r;return e.jsxs("g",{children:[e.jsx("line",{x1:a.left,y1:l,x2:x-a.right,y2:l,stroke:"#27272a",strokeWidth:"1"}),e.jsx("text",{x:a.left-8,y:l+4,textAnchor:"end",fill:"#52525b",fontSize:"10",children:R.toFixed(0)})]},r)}),j!=null&&j>=y&&j<=_&&d!=null&&e.jsxs("g",{children:[e.jsx("line",{x1:a.left,y1:d,x2:x-a.right,y2:d,stroke:"#eab308",strokeWidth:"1",strokeDasharray:"6,4"}),e.jsx("text",{x:x-a.right+4,y:d+3,fill:"#eab308",fontSize:"9",children:"baseline"})]}),e.jsx("path",{d:v,fill:"none",stroke:"#8b5cf6",strokeWidth:"2"}),t.map((r,l)=>{const R=l>0&&r.val_score>t[l-1].val_score,m=l>0&&r.val_score<t[l-1].val_score?"var(--color-error)":R?"var(--color-success)":"var(--color-purple)";return e.jsx("circle",{cx:f(l),cy:S(r.val_score),r:"4",fill:m,stroke:"#18181b",strokeWidth:"2",children:e.jsxs("title",{children:["Run ",l+1,": ",r.val_score," (",L(r.timestamp),")"]})},l)}),t.map((r,l)=>t.length>10&&l%Math.ceil(t.length/10)!==0&&l!==t.length-1?null:e.jsxs("text",{x:f(l),y:i-5,textAnchor:"middle",fill:"#52525b",fontSize:"9",children:["#",l+1]},l))]})]})}function C({icon:t,label:x,value:i,sub:a,color:b="text-text"}){return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-text-muted",children:t}),e.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wider",children:x})]}),e.jsx("div",{className:`text-2xl font-bold ${b}`,children:i}),a&&e.jsx("div",{className:"text-[10px] text-text-muted mt-0.5",children:a})]})}function ie(){const[t,x]=p.useState([]),[i,a]=p.useState(!0),[b,$]=p.useState(!1),[N,y]=p.useState(null),[_,j]=p.useState(!1),[f,S]=p.useState(!1),v=p.useRef(null),d=p.useCallback((s,h)=>{y({type:s,message:h}),setTimeout(()=>y(null),3e3)},[]),r=p.useCallback(async()=>{try{const s=await A("/api/autoresearch/results");if(s.ok){const h=await s.json();x(h.runs||[])}}catch{}finally{a(!1)}},[]);p.useEffect(()=>{r()},[r]),p.useEffect(()=>(f?v.current&&(clearInterval(v.current),v.current=null):v.current=setInterval(r,3e4),()=>{v.current&&clearInterval(v.current)}),[f,r]);const l=async()=>{j(!0);try{(await A("/api/autoresearch/trigger",{method:"POST"})).ok?d("success","Autoresearch experiment started"):d("error","Failed to trigger experiment")}catch{d("error","Failed to connect to API")}finally{j(!1)}},R=async()=>{try{(await A("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:"Deploy the best autoresearch LoRA adapter to Ollama. Use train_deploy."})})).ok?d("success","Deploying best model to Ollama..."):d("error","Failed to start deployment")}catch{d("error","Connection error")}},w=t.length>0?Math.max(...t.map(s=>s.val_score)):0,m=t.length>0?t[0].val_score:null,k=m!=null&&t.length>0?t.reduce((s,h)=>s+(h.val_score-m),0)/t.length:null,u=t.length>0?t[t.length-1]:null,g=u==null?void 0:u.hyperparams,F=(s,h)=>{const c=[],o=s.hyperparams,n=h.hyperparams;return o.lr!==n.lr&&c.push(`LR: ${n.lr} → ${o.lr}`),o.rank!==n.rank&&c.push(`Rank: ${n.rank} → ${o.rank}`),o.alpha!==n.alpha&&c.push(`Alpha: ${n.alpha} → ${o.alpha}`),o.epochs!==n.epochs&&c.push(`Epochs: ${n.epochs} → ${o.epochs}`),o.batch_size!==n.batch_size&&c.push(`Batch: ${n.batch_size} → ${o.batch_size}`),o.dropout!==n.dropout&&c.push(`Dropout: ${n.dropout} → ${o.dropout}`),o.grad_accum!==n.grad_accum&&c.push(`GradAccum: ${n.grad_accum} → ${o.grad_accum}`),o.max_seq_len!==n.max_seq_len&&c.push(`SeqLen: ${n.max_seq_len} → ${o.max_seq_len}`),c.length>0?c:["No changes"]};return i?e.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>e.jsx("div",{className:"h-20 animate-pulse rounded-xl border border-border bg-bg-secondary"},s))}):e.jsxs("div",{className:"space-y-6 max-w-6xl",children:[N&&e.jsx("div",{className:`fixed top-4 right-4 z-50 rounded-lg px-4 py-2.5 text-sm font-medium shadow-lg ${N.type==="success"?"bg-success/20 text-success border border-success/30":"bg-error/20 text-error border border-error/30"}`,children:N.message}),e.jsx(B,{title:"Autoresearch",subtitle:"Autonomous hyper-parameter search and LoRA fine-tuning",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Knowledge"},{label:"Autoresearch"}],actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>S(!f),className:"flex items-center gap-1 rounded-lg border border-bg-tertiary px-2.5 py-1.5 text-xs text-text-secondary hover:bg-bg-tertiary",children:[f?e.jsx(M,{className:"h-3 w-3"}):e.jsx(H,{className:"h-3 w-3"}),f?"Resume":"Pause"]}),e.jsx("button",{onClick:r,className:"flex items-center gap-1 rounded-lg border border-bg-tertiary px-2.5 py-1.5 text-xs text-text-secondary hover:bg-bg-tertiary",children:e.jsx(V,{className:"h-3 w-3"})})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(C,{icon:e.jsx(P,{className:"h-4 w-4"}),label:"Total Runs",value:t.length}),e.jsx(C,{icon:e.jsx(G,{className:"h-4 w-4"}),label:"Best Val Score",value:w>0?w.toFixed(1):"—",sub:m!=null&&w>m?`+${(w-m).toFixed(1)} from baseline`:void 0,color:m!=null&&w>m?"text-success":"text-text"}),e.jsx(C,{icon:e.jsx(U,{className:"h-4 w-4"}),label:"Avg Improvement",value:k!=null?`${k>=0?"+":""}${k.toFixed(1)}`:"—",color:k!=null?k>0?"text-success":k<0?"text-error":"text-text":"text-text"}),e.jsx(C,{icon:e.jsx(J,{className:"h-4 w-4"}),label:"Last Run",value:u?L(u.timestamp):"Never",sub:u?`Score: ${u.val_score}`:void 0})]}),e.jsx(Q,{runs:t}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:l,disabled:_,className:"flex items-center gap-2 rounded-lg bg-purple px-4 py-2 text-sm font-medium text-white hover:bg-[#7c3aed] disabled:opacity-50",children:[e.jsx(M,{className:"h-4 w-4"}),_?"Starting...":"Run Experiment"]}),e.jsxs("button",{onClick:R,disabled:t.length===0,className:"flex items-center gap-2 rounded-lg border border-bg-tertiary px-4 py-2 text-sm font-medium text-text-secondary hover:bg-bg-tertiary disabled:opacity-50",children:[e.jsx(O,{className:"h-4 w-4"}),"Deploy Best Model"]}),u&&e.jsxs("span",{className:"text-xs text-text-muted",children:[u.num_examples," training examples · ",D(u.training_time_s)]})]}),t.length>0&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-bg-tertiary",children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:"What Made TITAN Better"}),e.jsx("p",{className:"text-[10px] text-text-muted",children:"Experiment history — how each change affected val_score"})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-bg-tertiary",children:[e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted",children:"#"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted",children:"Date"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted",children:"Changes"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted text-right",children:"Score"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted text-right",children:"Δ"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted text-right",children:"Duration"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted text-right",children:"Examples"})]})}),e.jsx("tbody",{children:[...t].reverse().map((s,h)=>{const c=t.length-1-h,o=c>0?t[c-1]:null,n=o?s.val_score-o.val_score:m!=null?s.val_score-m:0,z=o?F(s,o):["Initial run"],T=new Date(s.timestamp);return e.jsxs("tr",{className:"border-b border-bg-tertiary last:border-0 hover:bg-[#27272a30]",children:[e.jsx("td",{className:"px-4 py-2 text-text-muted font-mono",children:c+1}),e.jsxs("td",{className:"px-4 py-2 text-text-secondary",children:[T.toLocaleDateString()," ",T.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]}),e.jsx("td",{className:"px-4 py-2 text-text-secondary",children:z.map((E,I)=>e.jsx("span",{className:"inline-block mr-1.5 rounded bg-bg-tertiary px-1.5 py-0.5 text-[10px] font-mono",children:E},I))}),e.jsx("td",{className:"px-4 py-2 text-right font-mono text-text font-medium",children:s.val_score.toFixed(1)}),e.jsx("td",{className:"px-4 py-2 text-right font-mono",children:e.jsxs("span",{className:n>0?"text-success":n<0?"text-error":"text-text-muted",children:[n>0?"+":"",n.toFixed(1)]})}),e.jsx("td",{className:"px-4 py-2 text-right text-text-muted",children:D(s.training_time_s)}),e.jsx("td",{className:"px-4 py-2 text-right text-text-muted",children:s.num_examples})]},c)})})]})})]}),e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>$(!b),className:"flex w-full items-center gap-2 text-xs font-medium text-text-secondary uppercase tracking-wider hover:text-text",children:[b?e.jsx(W,{className:"h-3.5 w-3.5"}):e.jsx(K,{className:"h-3.5 w-3.5"}),e.jsx(Y,{className:"h-3.5 w-3.5"}),"Current Hyperparameters"]}),b&&g&&e.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2 sm:grid-cols-4",children:[{label:"Learning Rate",value:g.lr},{label:"LoRA Rank",value:g.rank},{label:"LoRA Alpha",value:g.alpha},{label:"Dropout",value:g.dropout},{label:"Epochs",value:g.epochs},{label:"Batch Size",value:g.batch_size},{label:"Grad Accum",value:g.grad_accum},{label:"Max Seq Len",value:g.max_seq_len}].map(({label:s,value:h})=>e.jsxs("div",{className:"rounded-lg border border-bg-tertiary bg-bg-secondary px-3 py-2",children:[e.jsx("div",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:s}),e.jsx("div",{className:"text-sm font-mono text-text mt-0.5",children:h})]},s))}),b&&!g&&e.jsx("div",{className:"mt-3 rounded-lg border border-bg-tertiary bg-bg-secondary px-4 py-3 text-xs text-text-muted",children:"No runs yet — hyperparameters will appear after the first experiment"})]}),t.length===0&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-8 text-center",children:[e.jsx(P,{className:"h-8 w-8 text-text-muted mx-auto mb-3"}),e.jsx("p",{className:"text-sm text-text-secondary",children:"No autoresearch runs yet"}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:'Click "Run Experiment" to start fine-tuning qwen3.5:35b on the RTX 5090'})]})]})}export{ie as default};
6
+ */const X=[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Y=q("settings-2",X);function L(t){const x=Date.now()-new Date(t).getTime(),i=Math.floor(x/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;const a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function D(t){if(t<60)return`${Math.round(t)}s`;const x=Math.floor(t/60),i=Math.round(t%60);return`${x}m ${i}s`}function Q({runs:t}){if(t.length<2)return e.jsx("div",{className:"flex items-center justify-center h-[200px] rounded-xl border border-bg-tertiary bg-bg-secondary text-text-muted text-sm",children:"Need at least 2 runs to show chart"});const x=800,i=200,a={top:20,right:20,bottom:30,left:50},b=x-a.left-a.right,$=i-a.top-a.bottom,N=t.map(r=>r.val_score),y=Math.max(0,Math.min(...N)-5),_=Math.min(100,Math.max(...N)+5),j=t.length>0?t[0].val_score:null,f=r=>a.left+r/(t.length-1)*b,S=r=>a.top+$-(r-y)/(_-y)*$,v=t.map((r,l)=>`${l===0?"M":"L"} ${f(l)} ${S(r.val_score)}`).join(" "),d=j!=null?S(j):null;return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4 overflow-x-auto",children:[e.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Val Score Over Time"}),e.jsxs("svg",{viewBox:`0 0 ${x} ${i}`,className:"w-full",style:{minWidth:400},children:[[0,.25,.5,.75,1].map(r=>{const l=a.top+$*(1-r),R=y+(_-y)*r;return e.jsxs("g",{children:[e.jsx("line",{x1:a.left,y1:l,x2:x-a.right,y2:l,stroke:"#27272a",strokeWidth:"1"}),e.jsx("text",{x:a.left-8,y:l+4,textAnchor:"end",fill:"#52525b",fontSize:"10",children:R.toFixed(0)})]},r)}),j!=null&&j>=y&&j<=_&&d!=null&&e.jsxs("g",{children:[e.jsx("line",{x1:a.left,y1:d,x2:x-a.right,y2:d,stroke:"#eab308",strokeWidth:"1",strokeDasharray:"6,4"}),e.jsx("text",{x:x-a.right+4,y:d+3,fill:"#eab308",fontSize:"9",children:"baseline"})]}),e.jsx("path",{d:v,fill:"none",stroke:"#8b5cf6",strokeWidth:"2"}),t.map((r,l)=>{const R=l>0&&r.val_score>t[l-1].val_score,m=l>0&&r.val_score<t[l-1].val_score?"var(--color-error)":R?"var(--color-success)":"var(--color-purple)";return e.jsx("circle",{cx:f(l),cy:S(r.val_score),r:"4",fill:m,stroke:"#18181b",strokeWidth:"2",children:e.jsxs("title",{children:["Run ",l+1,": ",r.val_score," (",L(r.timestamp),")"]})},l)}),t.map((r,l)=>t.length>10&&l%Math.ceil(t.length/10)!==0&&l!==t.length-1?null:e.jsxs("text",{x:f(l),y:i-5,textAnchor:"middle",fill:"#52525b",fontSize:"9",children:["#",l+1]},l))]})]})}function C({icon:t,label:x,value:i,sub:a,color:b="text-text"}){return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-text-muted",children:t}),e.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wider",children:x})]}),e.jsx("div",{className:`text-2xl font-bold ${b}`,children:i}),a&&e.jsx("div",{className:"text-[10px] text-text-muted mt-0.5",children:a})]})}function ie(){const[t,x]=p.useState([]),[i,a]=p.useState(!0),[b,$]=p.useState(!1),[N,y]=p.useState(null),[_,j]=p.useState(!1),[f,S]=p.useState(!1),v=p.useRef(null),d=p.useCallback((s,h)=>{y({type:s,message:h}),setTimeout(()=>y(null),3e3)},[]),r=p.useCallback(async()=>{try{const s=await A("/api/autoresearch/results");if(s.ok){const h=await s.json();x(h.runs||[])}}catch{}finally{a(!1)}},[]);p.useEffect(()=>{r()},[r]),p.useEffect(()=>(f?v.current&&(clearInterval(v.current),v.current=null):v.current=setInterval(r,3e4),()=>{v.current&&clearInterval(v.current)}),[f,r]);const l=async()=>{j(!0);try{(await A("/api/autoresearch/trigger",{method:"POST"})).ok?d("success","Autoresearch experiment started"):d("error","Failed to trigger experiment")}catch{d("error","Failed to connect to API")}finally{j(!1)}},R=async()=>{try{(await A("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:"Deploy the best autoresearch LoRA adapter to Ollama. Use train_deploy."})})).ok?d("success","Deploying best model to Ollama..."):d("error","Failed to start deployment")}catch{d("error","Connection error")}},w=t.length>0?Math.max(...t.map(s=>s.val_score)):0,m=t.length>0?t[0].val_score:null,k=m!=null&&t.length>0?t.reduce((s,h)=>s+(h.val_score-m),0)/t.length:null,u=t.length>0?t[t.length-1]:null,g=u==null?void 0:u.hyperparams,F=(s,h)=>{const c=[],o=s.hyperparams,n=h.hyperparams;return o.lr!==n.lr&&c.push(`LR: ${n.lr} → ${o.lr}`),o.rank!==n.rank&&c.push(`Rank: ${n.rank} → ${o.rank}`),o.alpha!==n.alpha&&c.push(`Alpha: ${n.alpha} → ${o.alpha}`),o.epochs!==n.epochs&&c.push(`Epochs: ${n.epochs} → ${o.epochs}`),o.batch_size!==n.batch_size&&c.push(`Batch: ${n.batch_size} → ${o.batch_size}`),o.dropout!==n.dropout&&c.push(`Dropout: ${n.dropout} → ${o.dropout}`),o.grad_accum!==n.grad_accum&&c.push(`GradAccum: ${n.grad_accum} → ${o.grad_accum}`),o.max_seq_len!==n.max_seq_len&&c.push(`SeqLen: ${n.max_seq_len} → ${o.max_seq_len}`),c.length>0?c:["No changes"]};return i?e.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>e.jsx("div",{className:"h-20 animate-pulse rounded-xl border border-border bg-bg-secondary"},s))}):e.jsxs("div",{className:"space-y-6 max-w-6xl",children:[N&&e.jsx("div",{className:`fixed top-4 right-4 z-50 rounded-lg px-4 py-2.5 text-sm font-medium shadow-lg ${N.type==="success"?"bg-success/20 text-success border border-success/30":"bg-error/20 text-error border border-error/30"}`,children:N.message}),e.jsx(B,{title:"Autoresearch",subtitle:"Autonomous hyper-parameter search and LoRA fine-tuning",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Knowledge"},{label:"Autoresearch"}],actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>S(!f),className:"flex items-center gap-1 rounded-lg border border-bg-tertiary px-2.5 py-1.5 text-xs text-text-secondary hover:bg-bg-tertiary",children:[f?e.jsx(M,{className:"h-3 w-3"}):e.jsx(H,{className:"h-3 w-3"}),f?"Resume":"Pause"]}),e.jsx("button",{onClick:r,className:"flex items-center gap-1 rounded-lg border border-bg-tertiary px-2.5 py-1.5 text-xs text-text-secondary hover:bg-bg-tertiary",children:e.jsx(G,{className:"h-3 w-3"})})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(C,{icon:e.jsx(P,{className:"h-4 w-4"}),label:"Total Runs",value:t.length}),e.jsx(C,{icon:e.jsx(U,{className:"h-4 w-4"}),label:"Best Val Score",value:w>0?w.toFixed(1):"—",sub:m!=null&&w>m?`+${(w-m).toFixed(1)} from baseline`:void 0,color:m!=null&&w>m?"text-success":"text-text"}),e.jsx(C,{icon:e.jsx(V,{className:"h-4 w-4"}),label:"Avg Improvement",value:k!=null?`${k>=0?"+":""}${k.toFixed(1)}`:"—",color:k!=null?k>0?"text-success":k<0?"text-error":"text-text":"text-text"}),e.jsx(C,{icon:e.jsx(J,{className:"h-4 w-4"}),label:"Last Run",value:u?L(u.timestamp):"Never",sub:u?`Score: ${u.val_score}`:void 0})]}),e.jsx(Q,{runs:t}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:l,disabled:_,className:"flex items-center gap-2 rounded-lg bg-purple px-4 py-2 text-sm font-medium text-white hover:bg-[#7c3aed] disabled:opacity-50",children:[e.jsx(M,{className:"h-4 w-4"}),_?"Starting...":"Run Experiment"]}),e.jsxs("button",{onClick:R,disabled:t.length===0,className:"flex items-center gap-2 rounded-lg border border-bg-tertiary px-4 py-2 text-sm font-medium text-text-secondary hover:bg-bg-tertiary disabled:opacity-50",children:[e.jsx(O,{className:"h-4 w-4"}),"Deploy Best Model"]}),u&&e.jsxs("span",{className:"text-xs text-text-muted",children:[u.num_examples," training examples · ",D(u.training_time_s)]})]}),t.length>0&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-bg-tertiary",children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:"What Made TITAN Better"}),e.jsx("p",{className:"text-[10px] text-text-muted",children:"Experiment history — how each change affected val_score"})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-bg-tertiary",children:[e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted",children:"#"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted",children:"Date"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted",children:"Changes"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted text-right",children:"Score"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted text-right",children:"Δ"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted text-right",children:"Duration"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted text-right",children:"Examples"})]})}),e.jsx("tbody",{children:[...t].reverse().map((s,h)=>{const c=t.length-1-h,o=c>0?t[c-1]:null,n=o?s.val_score-o.val_score:m!=null?s.val_score-m:0,z=o?F(s,o):["Initial run"],T=new Date(s.timestamp);return e.jsxs("tr",{className:"border-b border-bg-tertiary last:border-0 hover:bg-[#27272a30]",children:[e.jsx("td",{className:"px-4 py-2 text-text-muted font-mono",children:c+1}),e.jsxs("td",{className:"px-4 py-2 text-text-secondary",children:[T.toLocaleDateString()," ",T.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]}),e.jsx("td",{className:"px-4 py-2 text-text-secondary",children:z.map((E,I)=>e.jsx("span",{className:"inline-block mr-1.5 rounded bg-bg-tertiary px-1.5 py-0.5 text-[10px] font-mono",children:E},I))}),e.jsx("td",{className:"px-4 py-2 text-right font-mono text-text font-medium",children:s.val_score.toFixed(1)}),e.jsx("td",{className:"px-4 py-2 text-right font-mono",children:e.jsxs("span",{className:n>0?"text-success":n<0?"text-error":"text-text-muted",children:[n>0?"+":"",n.toFixed(1)]})}),e.jsx("td",{className:"px-4 py-2 text-right text-text-muted",children:D(s.training_time_s)}),e.jsx("td",{className:"px-4 py-2 text-right text-text-muted",children:s.num_examples})]},c)})})]})})]}),e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>$(!b),className:"flex w-full items-center gap-2 text-xs font-medium text-text-secondary uppercase tracking-wider hover:text-text",children:[b?e.jsx(W,{className:"h-3.5 w-3.5"}):e.jsx(K,{className:"h-3.5 w-3.5"}),e.jsx(Y,{className:"h-3.5 w-3.5"}),"Current Hyperparameters"]}),b&&g&&e.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2 sm:grid-cols-4",children:[{label:"Learning Rate",value:g.lr},{label:"LoRA Rank",value:g.rank},{label:"LoRA Alpha",value:g.alpha},{label:"Dropout",value:g.dropout},{label:"Epochs",value:g.epochs},{label:"Batch Size",value:g.batch_size},{label:"Grad Accum",value:g.grad_accum},{label:"Max Seq Len",value:g.max_seq_len}].map(({label:s,value:h})=>e.jsxs("div",{className:"rounded-lg border border-bg-tertiary bg-bg-secondary px-3 py-2",children:[e.jsx("div",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:s}),e.jsx("div",{className:"text-sm font-mono text-text mt-0.5",children:h})]},s))}),b&&!g&&e.jsx("div",{className:"mt-3 rounded-lg border border-bg-tertiary bg-bg-secondary px-4 py-3 text-xs text-text-muted",children:"No runs yet — hyperparameters will appear after the first experiment"})]}),t.length===0&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-8 text-center",children:[e.jsx(P,{className:"h-8 w-8 text-text-muted mx-auto mb-3"}),e.jsx("p",{className:"text-sm text-text-secondary",children:"No autoresearch runs yet"}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:'Click "Run Experiment" to start fine-tuning qwen3.5:35b on the RTX 5090'})]})]})}export{ie as default};
@@ -0,0 +1 @@
1
+ import{t as h,r as t,aQ as g,j as e,aR as b,aS as y}from"./index-Cml2x9pA.js";import{P as k}from"./PageHeader-DdrbS1aq.js";import{P as j}from"./plus-Dpo1qfrl.js";import{R as v}from"./refresh-cw-C-iZkzuS.js";import{A as N}from"./archive-Bh689DNg.js";import{C as B}from"./circle-check-big-Bkba568b.js";import"./chevron-right-DbLSHmff.js";function $(){const{toast:s}=h(),[i,u]=t.useState([]),[c,l]=t.useState(!0),[n,d]=t.useState(!1),[o,m]=t.useState(null),r=t.useCallback(async()=>{l(!0);try{const a=await g();u(a.backups||[])}catch(a){s("error",`Couldn't load backups — try again. (${a.message})`)}l(!1)},[s]);t.useEffect(()=>{r()},[r]);const p=async()=>{d(!0);try{await b(),await r(),s("success","Backup created.")}catch(a){s("error",`Couldn't create backup — try again. (${a.message})`)}d(!1)},x=async a=>{m(a);try{await y(a),s("success","Backup verified successfully.")}catch(f){s("error",`Backup verification failed. (${f.message})`)}m(null)};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(k,{title:"Backup Manager",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"System"},{label:"Backups"}]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:p,disabled:n,className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-[#6366f1] text-white text-sm font-medium hover:bg-[#4f46e5] disabled:opacity-50",children:[e.jsx(j,{className:"w-4 h-4"})," ",n?"Creating...":"Create Backup"]}),e.jsxs("button",{onClick:r,disabled:c,className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46] disabled:opacity-50",children:[e.jsx(v,{className:`w-4 h-4 ${c?"animate-spin":""}`})," Refresh"]})]}),i.length===0&&!c&&e.jsx("div",{className:"text-sm text-[#52525b]",children:"No backups found."}),e.jsx("div",{className:"space-y-2",children:i.map(a=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(N,{className:"w-4 h-4 text-[#6366f1]"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-[#e4e4e7]",children:new Date(a.createdAt).toLocaleString()}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[(a.sizeBytes/1024/1024).toFixed(1)," MB"]})]})]}),e.jsxs("button",{onClick:()=>x(a.path),disabled:o===a.path,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] text-xs hover:bg-[#3f3f46] disabled:opacity-50",children:[e.jsx(B,{className:"w-3.5 h-3.5"})," ",o===a.path?"Verifying...":"Verify"]})]},a.path))})]})}export{$ as default};
@@ -1,6 +1,6 @@
1
- import{c as i,r as s,j as e,G as m,ax as p}from"./index-CUgepw5Q.js";import{P as x}from"./PageHeader-bnc85wQN.js";import"./chevron-right-CQ1NTOtd.js";/**
1
+ import{c as i,r as s,j as e,G as m,az as p}from"./index-Cml2x9pA.js";import{P as h}from"./PageHeader-DdrbS1aq.js";import"./chevron-right-DbLSHmff.js";/**
2
2
  * @license lucide-react v0.513.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const h=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],u=i("wand-sparkles",h);function v(){const[t,n]=s.useState(""),[r,o]=s.useState(""),[l,d]=s.useState(!1),c=async()=>{if(t.trim()){d(!0);try{const a=await p(t);o(a.token||a.error||"No result")}catch(a){o(String(a))}d(!1)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(x,{title:"Browser Tools",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"Browser"}]}),e.jsxs("div",{className:"p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(m,{className:"w-4 h-4 text-[#6366f1]"}),e.jsx("span",{className:"text-sm font-medium text-[#e4e4e7]",children:"Captcha Solver"})]}),e.jsx("textarea",{value:t,onChange:a=>n(a.target.value),placeholder:"Paste base64 image...",className:"w-full h-24 p-2 rounded-md bg-[#27272a] border border-[#3f3f46] text-xs text-[#e4e4e7] placeholder-[#52525b] font-mono resize-none"}),e.jsxs("button",{onClick:c,disabled:l,className:"mt-2 flex items-center gap-2 px-3 py-2 rounded-lg bg-[#6366f1] text-white text-sm font-medium hover:bg-[#4f46e5] disabled:opacity-50",children:[e.jsx(u,{className:"w-4 h-4"})," ",l?"Solving...":"Solve Captcha"]}),r&&e.jsx("div",{className:"mt-2 p-2 rounded-md bg-[#27272a] text-xs text-[#e4e4e7] font-mono break-all",children:r})]})]})}export{v as default};
6
+ */const x=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],u=i("wand-sparkles",x);function v(){const[t,n]=s.useState(""),[r,o]=s.useState(""),[l,d]=s.useState(!1),c=async()=>{if(t.trim()){d(!0);try{const a=await p(t);o(a.token||a.error||"No result")}catch(a){o(String(a))}d(!1)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{title:"Browser Tools",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"Browser"}]}),e.jsxs("div",{className:"p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(m,{className:"w-4 h-4 text-[#6366f1]"}),e.jsx("span",{className:"text-sm font-medium text-[#e4e4e7]",children:"Captcha Solver"})]}),e.jsx("textarea",{value:t,onChange:a=>n(a.target.value),placeholder:"Paste base64 image...",className:"w-full h-24 p-2 rounded-md bg-[#27272a] border border-[#3f3f46] text-xs text-[#e4e4e7] placeholder-[#52525b] font-mono resize-none"}),e.jsxs("button",{onClick:c,disabled:l,className:"mt-2 flex items-center gap-2 px-3 py-2 rounded-lg bg-[#6366f1] text-white text-sm font-medium hover:bg-[#4f46e5] disabled:opacity-50",children:[e.jsx(u,{className:"w-4 h-4"})," ",l?"Solving...":"Solve Captcha"]}),r&&e.jsx("div",{className:"mt-2 p-2 rounded-md bg-[#27272a] text-xs text-[#e4e4e7] font-mono break-all",children:r})]})]})}export{v as default};
@@ -0,0 +1 @@
1
+ import{r as c,j as t,L as m}from"./index-Cml2x9pA.js";import{c as x}from"./clsx-B-dksMZM.js";const g={primary:"text-white shadow-sm glow-accent-hover bg-[image:var(--gradient-accent)] hover:brightness-110",secondary:"bg-bg-tertiary text-text border border-border hover:border-border-light hover:bg-bg-secondary",ghost:"text-text-secondary hover:text-text hover:bg-bg-tertiary",danger:"bg-error/10 text-error border border-error/20 hover:bg-error/20"},l={sm:"px-2.5 py-1 text-xs gap-1.5 rounded-md",md:"px-3.5 py-2 text-sm gap-2 rounded-lg",lg:"px-5 py-2.5 text-sm gap-2 rounded-lg"},p=c.forwardRef(({variant:o="primary",size:r="md",icon:s,loading:e,disabled:a,children:i,className:n,...d},b)=>t.jsxs("button",{ref:b,disabled:a||e,"aria-busy":e||void 0,className:x("inline-flex items-center justify-center font-medium transition-all","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50","disabled:opacity-50 disabled:pointer-events-none",g[o],l[r],n),...d,children:[e?t.jsx(m,{size:r==="sm"?14:16,className:"animate-spin"}):s,i]}));p.displayName="Button";export{p as B};
@@ -0,0 +1 @@
1
+ import{r as a,z as b,j as e,A as u,Z as j,W as S,P as A,J as E}from"./index-Cml2x9pA.js";import"./Button-MdXmb4_n.js";import"./Input-CBTwa_Iw.js";import{P as N}from"./PageHeader-DdrbS1aq.js";import{E as C}from"./EmptyState-D9kQf1PX.js";import{T}from"./Tabs-DdUThlp1.js";import{S as w}from"./SkeletonLoader-r6OGXaU9.js";import{S as P}from"./shield-check-CXlDJyAW.js";import{D as $}from"./dollar-sign-XxwPAA2a.js";import{B as k}from"./bot-DvEcyQcD.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DbLSHmff.js";function I(s){const r=Math.floor((Date.now()-new Date(s).getTime())/1e3);return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}const D={agent:k,goal:E,budget:$,approval:P,error:A,tool:S,system:j},M={agent:"text-accent",goal:"text-success",budget:"text-warning",approval:"text-info",error:"text-error",tool:"text-text-secondary",system:"text-text-muted"};function U(){const[s,r]=a.useState([]),[i,f]=a.useState(!0),[o,x]=a.useState(null),[n,h]=a.useState("all"),l=a.useRef(null),c=a.useCallback(async()=>{try{const t=await b(100);r(t),x(null)}catch(t){x(t instanceof Error?t.message:"Failed to load activity")}f(!1)},[]);a.useEffect(()=>(c(),l.current=setInterval(c,1e4),()=>{l.current&&clearInterval(l.current)}),[c]);const p=Array.from(new Set(s.map(t=>t.type))),g=[{id:"all",label:"All",count:s.length},...p.map(t=>({id:t,label:t.charAt(0).toUpperCase()+t.slice(1),count:s.filter(d=>d.type===t).length}))],m=n==="all"?s:s.filter(t=>t.type===n);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(N,{title:"Activity",subtitle:"Auto-refreshes every 10s",breadcrumbs:[{label:"Command Post"},{label:"Activity"}]}),p.length>0&&e.jsx(T,{tabs:g,activeTab:n,onChange:h}),i&&e.jsx(w,{variant:"row",count:8}),o&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:o}),!i&&!o&&m.length===0&&e.jsx(C,{icon:e.jsx(u,{size:32}),title:"No activity",description:"Agent activity will appear here as events occur."}),!i&&!o&&m.length>0&&e.jsx("div",{className:"divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden",children:m.map((t,d)=>{const v=D[t.type]??u,y=M[t.type]??"text-text-muted";return e.jsxs("div",{className:"flex items-start gap-3 px-4 py-2.5",children:[e.jsx(v,{size:14,className:`${y} mt-0.5 flex-shrink-0`}),e.jsx("span",{className:"flex-1 text-sm text-text-secondary",children:t.message}),t.agentId&&e.jsx("span",{className:"text-[10px] text-text-muted flex-shrink-0",children:t.agentId}),e.jsx("span",{className:"text-xs text-text-muted flex-shrink-0",children:I(t.timestamp)})]},`${t.id}-${d}`)})})]})}export{U as default};
@@ -0,0 +1 @@
1
+ import{q as G,u as K,r as s,a1 as O,a0 as J,D as Q,aG as V,j as e,K as A,bh as W}from"./index-Cml2x9pA.js";import{B as T}from"./Button-MdXmb4_n.js";import"./Input-CBTwa_Iw.js";import{S as c}from"./StatusBadge-BqlvIbdj.js";import{P as x}from"./PageHeader-DdrbS1aq.js";import{E as X}from"./EmptyState-D9kQf1PX.js";import{T as Y}from"./Tabs-DdUThlp1.js";import{S as Z}from"./SkeletonLoader-r6OGXaU9.js";import{A as _}from"./arrow-left-WkVYLm80.js";import{C as ee}from"./circle-check-big-Bkba568b.js";import{D as te}from"./dollar-sign-XxwPAA2a.js";import{C as se}from"./clock-JyQAYy6X.js";import{S as ae}from"./save-DwR9wQVu.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DbLSHmff.js";function k(a){const o=Math.floor((Date.now()-new Date(a).getTime())/1e3);return o<60?`${o}s`:o<3600?`${Math.floor(o/60)}m`:o<86400?`${Math.floor(o/3600)}h`:`${Math.floor(o/86400)}d`}function re(a){return a?a<1e3?`${a}ms`:`${(a/1e3).toFixed(1)}s`:"-"}function ve(){const{id:a}=G(),o=K(),[r,m]=s.useState(null),[n,E]=s.useState([]),[u,M]=s.useState([]),[P,b]=s.useState(!0),[p,i]=s.useState(null),[d,D]=s.useState("overview"),[h,g]=s.useState(""),[f,j]=s.useState(""),[v,N]=s.useState(""),[y,S]=s.useState(""),[z,C]=s.useState(!1),[R,$]=s.useState([]),w=s.useCallback(async()=>{if(a){try{const l=(await O()).find(q=>q.id===a);if(!l){i("Agent not found"),b(!1);return}m(l),g(l.role),j(l.reportsTo??""),N(l.title??""),S(l.model??"");const[H,U]=await Promise.all([J(a),Q({assignee:a})]);E(H),M(U),i(null)}catch(t){i(t instanceof Error?t.message:"Failed to load agent")}b(!1)}},[a]);s.useEffect(()=>{w()},[w]),s.useEffect(()=>{V().then(t=>$(t)).catch(()=>{})},[]);const B=async()=>{if(a){C(!0);try{const t=await W(a,{role:h,reportsTo:f||void 0,title:v||void 0,model:y||void 0});m(t)}catch{}C(!1)}},L=[{id:"overview",label:"Overview"},{id:"runs",label:"Runs",count:n.length},{id:"config",label:"Config"}];if(P)return e.jsxs("div",{className:"space-y-6",children:[e.jsx(x,{title:"Agent",breadcrumbs:[{label:"Command Post"},{label:"Agents",href:"/command-post/agents"},{label:"..."}]}),e.jsx(Z,{variant:"card",count:1})]});if(p||!r)return e.jsxs("div",{className:"space-y-6",children:[e.jsx(x,{title:"Agent",breadcrumbs:[{label:"Command Post"},{label:"Agents",href:"/command-post/agents"},{label:"Error"}]}),e.jsxs("div",{className:"text-center py-12",children:[e.jsx("p",{className:"text-error text-sm mb-4",children:p??"Agent not found"}),e.jsx(T,{variant:"secondary",size:"sm",onClick:()=>o("/command-post/agents"),children:"Back to Agents"})]})]});const I=Date.now()-new Date(r.createdAt).getTime(),F=Math.floor(I/36e5);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(x,{title:r.name,subtitle:r.title??r.role,breadcrumbs:[{label:"Command Post"},{label:"Agents",href:"/command-post/agents"},{label:r.name}],actions:e.jsxs(A,{to:"/command-post/agents",className:"flex items-center gap-1 text-xs text-text-muted hover:text-text",children:[e.jsx(_,{size:14})," Back"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{status:r.status}),e.jsxs("span",{className:"text-xs text-text-muted",children:["Last heartbeat: ",k(r.lastHeartbeat)," ago"]})]}),e.jsx(Y,{tabs:L,activeTab:d,onChange:D}),d==="overview"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"bg-bg-tertiary/50 border border-border rounded-xl p-4 text-center",children:[e.jsx(ee,{size:16,className:"text-success mx-auto mb-1"}),e.jsx("div",{className:"text-xl font-bold text-text",children:r.totalTasksCompleted}),e.jsx("div",{className:"text-[10px] text-text-muted",children:"Tasks Completed"})]}),e.jsxs("div",{className:"bg-bg-tertiary/50 border border-border rounded-xl p-4 text-center",children:[e.jsx(te,{size:16,className:"text-warning mx-auto mb-1"}),e.jsxs("div",{className:"text-xl font-bold text-text",children:["$",r.totalCostUsd.toFixed(4)]}),e.jsx("div",{className:"text-[10px] text-text-muted",children:"Total Cost"})]}),e.jsxs("div",{className:"bg-bg-tertiary/50 border border-border rounded-xl p-4 text-center",children:[e.jsx(se,{size:16,className:"text-accent mx-auto mb-1"}),e.jsxs("div",{className:"text-xl font-bold text-text",children:[F,"h"]}),e.jsx("div",{className:"text-[10px] text-text-muted",children:"Uptime"})]})]}),e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:[e.jsx("div",{className:"px-4 py-3 border-b border-border",children:e.jsx("h3",{className:"text-sm font-semibold text-text",children:"Assigned Issues"})}),u.length===0?e.jsx("div",{className:"py-8 text-center text-xs text-text-muted",children:"No assigned issues"}):e.jsx("div",{className:"divide-y divide-border",children:u.map(t=>e.jsxs(A,{to:`/command-post/issues/${t.id}`,className:"flex items-center gap-2 px-4 py-2 hover:bg-bg-tertiary transition-colors",children:[e.jsx(c,{status:t.status,variant:"dot",size:"sm"}),e.jsx("span",{className:"text-xs text-text flex-1 truncate",children:t.title}),e.jsx("span",{className:"text-[10px] text-text-muted font-mono",children:t.identifier})]},t.id))})]})]}),d==="runs"&&e.jsx("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:n.length===0?e.jsx(X,{title:"No runs",description:"This agent has not executed any runs yet."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left",children:[e.jsx("th",{className:"px-4 py-2 text-text-muted font-medium",children:"Source"}),e.jsx("th",{className:"px-4 py-2 text-text-muted font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-2 text-text-muted font-medium",children:"Duration"}),e.jsx("th",{className:"px-4 py-2 text-text-muted font-medium",children:"Tools"}),e.jsx("th",{className:"px-4 py-2 text-text-muted font-medium",children:"Started"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:n.map(t=>e.jsxs("tr",{className:"hover:bg-bg-tertiary/50 transition-colors",children:[e.jsx("td",{className:"px-4 py-2 text-text-secondary capitalize",children:t.source}),e.jsx("td",{className:"px-4 py-2",children:e.jsx(c,{status:t.status,size:"sm"})}),e.jsx("td",{className:"px-4 py-2 text-text-secondary",children:re(t.durationMs)}),e.jsx("td",{className:"px-4 py-2 text-text-muted",children:t.toolsUsed.length}),e.jsxs("td",{className:"px-4 py-2 text-text-muted",children:[k(t.startedAt)," ago"]})]},t.id))})]})})}),d==="config"&&e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-4 space-y-4 max-w-md",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Role"}),e.jsx("select",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text focus:outline-none focus:border-accent",value:h,onChange:t=>g(t.target.value),children:["ceo","manager","engineer","researcher","general"].map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Reports To"}),e.jsx("input",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:"Agent ID...",value:f,onChange:t=>j(t.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Title"}),e.jsx("input",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:"e.g. Senior Engineer",value:v,onChange:t=>N(t.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Model"}),e.jsx("input",{list:"cp-agent-models",className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:"e.g. ollama/qwen3.5:cloud",value:y,onChange:t=>S(t.target.value)}),e.jsx("datalist",{id:"cp-agent-models",children:R.map(t=>e.jsx("option",{value:t.id,children:t.name??t.id},t.id))})]}),e.jsx(T,{size:"sm",icon:e.jsx(ae,{size:14}),onClick:B,loading:z,children:"Save"})]})]})}export{ve as default};
@@ -0,0 +1 @@
1
+ import{r,a1 as m,j as e,U as p,K as u,X as h,b as j}from"./index-Cml2x9pA.js";import"./Button-MdXmb4_n.js";import"./Input-CBTwa_Iw.js";import{S as g}from"./StatusBadge-BqlvIbdj.js";import{P as f}from"./PageHeader-DdrbS1aq.js";import{E as b}from"./EmptyState-D9kQf1PX.js";import{S as N}from"./SkeletonLoader-r6OGXaU9.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DbLSHmff.js";function y(a){const s=Math.floor((Date.now()-new Date(a).getTime())/1e3);return s<60?`${s}s`:s<3600?`${Math.floor(s/60)}m`:s<86400?`${Math.floor(s/3600)}h`:`${Math.floor(s/86400)}d`}function v(a){const s=a.split("/");return s[s.length-1]}function L(){const[a,s]=r.useState([]),[c,d]=r.useState(!0),[o,l]=r.useState(null),i=r.useCallback(async()=>{try{const t=await m();s(t),l(null)}catch(t){l(t instanceof Error?t.message:"Failed to load agents")}d(!1)},[]);r.useEffect(()=>{i()},[i]);const x=async(t,n)=>{n.preventDefault(),n.stopPropagation();try{await j(`/api/command-post/agents/${t}`,{method:"DELETE"}),await i()}catch{}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(f,{title:"Agents",breadcrumbs:[{label:"Command Post"},{label:"Agents"}]}),c&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.jsx(N,{variant:"card",count:6})}),o&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:o}),!c&&!o&&a.length===0&&e.jsx(b,{icon:e.jsx(p,{size:32}),title:"No agents registered",description:"Agents will appear here once they connect to Command Post."}),!c&&!o&&a.length>0&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:a.map(t=>e.jsxs(u,{to:`/command-post/agents/${t.id}`,className:"relative bg-bg-secondary border border-border rounded-xl p-4 hover:border-border-light transition-colors group",children:[t.role!=="ceo"&&e.jsx("button",{onClick:n=>x(t.id,n),className:"absolute top-3 right-3 p-1 rounded-md text-text-muted hover:text-error hover:bg-error/10 opacity-0 group-hover:opacity-100 transition-all",title:"Remove agent",children:e.jsx(h,{size:14})}),e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:"text-sm font-semibold text-text",children:t.name}),e.jsx(g,{status:t.status,size:"sm"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase",children:"Role"}),e.jsx("span",{className:"text-xs text-text-secondary capitalize",children:t.role})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase",children:"Model"}),e.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[140px]",children:v(t.model)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase",children:"Last Heartbeat"}),e.jsxs("span",{className:"text-xs text-text-secondary",children:[y(t.lastHeartbeat)," ago"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase",children:"Tasks Done"}),e.jsx("span",{className:"text-xs text-text-secondary",children:t.totalTasksCompleted})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase",children:"Cost"}),e.jsxs("span",{className:"text-xs text-text-secondary",children:["$",t.totalCostUsd.toFixed(4)]})]})]})]},t.id))})]})}export{L as default};
@@ -0,0 +1 @@
1
+ import{r as a,t as P,F as B,j as t,P as z,X as R,Q as $,V as _}from"./index-Cml2x9pA.js";import{B as A}from"./Button-MdXmb4_n.js";import"./Input-CBTwa_Iw.js";import{S as D}from"./StatusBadge-BqlvIbdj.js";import{P as M}from"./PageHeader-DdrbS1aq.js";import{E as F}from"./EmptyState-D9kQf1PX.js";import{T as L}from"./Tabs-DdUThlp1.js";import{S as W}from"./SkeletonLoader-r6OGXaU9.js";import{e as H}from"./approvalHeadline-DB9SgR-9.js";import{S as I}from"./shield-check-CXlDJyAW.js";import{C as U}from"./check-CuRYh4Zh.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DbLSHmff.js";function q(r){const o=Math.floor((Date.now()-new Date(r).getTime())/1e3);return o<60?`${o}s`:o<3600?`${Math.floor(o/60)}m`:o<86400?`${Math.floor(o/3600)}h`:`${Math.floor(o/86400)}d`}function K(r){return r==="high"?"text-error bg-error/10 border-error/30":r==="medium"?"text-warn bg-warn/10 border-warn/30":"text-text-muted bg-bg-tertiary border-border"}const Q=[{id:"all",label:"All"},{id:"pending",label:"Pending"},{id:"approved",label:"Approved"},{id:"rejected",label:"Rejected"}];function ne(){const[r,o]=a.useState([]),[m,k]=a.useState(!0),[i,d]=a.useState(null),[l,w]=a.useState("all"),[h,c]=a.useState(null),[b,v]=a.useState({}),[u,j]=a.useState(null),{toast:p}=P(),x=a.useCallback(async()=>{try{const e=await B();o(e),d(null)}catch(e){d(e instanceof Error?e.message:"Failed to load approvals")}k(!1)},[]);a.useEffect(()=>{x()},[x]);const y=async e=>{var s;c(e.id);try{const n=(s=b[e.id])==null?void 0:s.trim();await $(e.id,"user",n||void 0),await x();const f=e.type==="goal_proposal"||e.type==="soma_proposal",T=e.type==="custom"&&e.payload.kind==="driver_blocked";p("success",f?"Work approved — TITAN is starting…":T?"Unblocked — TITAN is resuming…":"Approved"),v(E=>{const N={...E};return delete N[e.id],N}),j(null)}catch(n){d(n instanceof Error?n.message:"Approve failed"),p("error","Approval failed")}c(null)},S=async e=>{c(e.id);try{await _(e.id,"user"),await x(),p("success","Rejected")}catch(s){d(s instanceof Error?s.message:"Reject failed"),p("error","Rejection failed")}c(null)},g=l==="all"?r:r.filter(e=>e.status===l),C=Q.map(e=>({...e,count:e.id==="all"?r.length:r.filter(s=>s.status===e.id).length}));return t.jsxs("div",{className:"space-y-4",children:[t.jsx(M,{title:"Approvals",breadcrumbs:[{label:"Command Post"},{label:"Approvals"}]}),t.jsx(L,{tabs:C,activeTab:l,onChange:w}),m&&t.jsx(W,{variant:"row",count:5}),i&&t.jsx("div",{className:"text-center py-8 text-error text-sm",children:i}),!m&&!i&&g.length===0&&t.jsx(F,{icon:t.jsx(I,{size:32}),title:"No approvals",description:l==="pending"?"No pending approvals.":"No approvals to show."}),!m&&!i&&g.length>0&&t.jsx("div",{className:"divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden",children:g.map(e=>{const s=H(e);return t.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[t.jsxs("span",{className:`text-[10px] px-1.5 py-0.5 rounded border font-medium uppercase tracking-wide ${K(s.urgency)}`,children:[s.urgency==="high"&&t.jsx(z,{size:10,className:"inline mr-0.5"}),s.kindLabel]}),t.jsx(D,{status:e.status,size:"sm"}),t.jsxs("span",{className:"text-xs text-text-muted",children:["from ",t.jsx("span",{className:"font-medium text-text-secondary",children:e.requestedBy})]})]}),t.jsx("div",{className:"text-sm text-text font-medium leading-snug mb-0.5",children:s.headline}),s.detail&&t.jsx("div",{className:"text-xs text-text-secondary leading-snug",children:s.detail}),e.decidedBy&&t.jsxs("div",{className:"text-[10px] text-text-muted mt-1",children:["Decided by ",e.decidedBy,e.decisionNote?`: ${e.decisionNote}`:""]})]}),t.jsx("span",{className:"text-xs text-text-muted flex-shrink-0 pt-0.5",children:q(e.createdAt)}),e.status==="pending"&&t.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[e.type==="custom"&&e.payload.kind==="driver_blocked"&&t.jsx("button",{onClick:()=>j(u===e.id?null:e.id),className:"text-[10px] text-text-muted hover:text-text-secondary px-2 py-1 rounded hover:bg-bg-tertiary transition-colors",children:u===e.id?"Cancel":"Answer"}),t.jsx(A,{size:"sm",variant:"ghost",onClick:()=>y(e),loading:h===e.id,icon:t.jsx(U,{size:14}),children:"Approve"}),t.jsx(A,{size:"sm",variant:"ghost",onClick:()=>S(e),loading:h===e.id,icon:t.jsx(R,{size:14}),children:"Reject"})]}),u===e.id&&t.jsx("input",{type:"text",value:b[e.id]||"",onChange:n=>v(f=>({...f,[e.id]:n.target.value})),placeholder:"Type your answer...",className:"w-64 rounded-md border border-border bg-bg px-3 py-1.5 text-xs text-text outline-none focus:border-accent mt-1",onKeyDown:n=>{n.key==="Enter"&&y(e)},autoFocus:!0})]})]},e.id)})})]})}export{ne as default};
@@ -0,0 +1 @@
1
+ import{r as s,a4 as F,j as e,a5 as I,a6 as $}from"./index-Cml2x9pA.js";import{B as u}from"./Button-MdXmb4_n.js";import"./Input-CBTwa_Iw.js";import{S as w}from"./StatusBadge-BqlvIbdj.js";import{P as A}from"./PageHeader-DdrbS1aq.js";import{E as L}from"./EmptyState-D9kQf1PX.js";import{M as W}from"./Modal-ybPGvlQs.js";import{S as M}from"./SkeletonLoader-r6OGXaU9.js";import{P as G}from"./plus-Dpo1qfrl.js";import{D as H}from"./dollar-sign-XxwPAA2a.js";import{T as R}from"./trash-2-CTeyjxD_.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DbLSHmff.js";function q(r){const l=r.limitUsd>0?r.currentSpend/r.limitUsd*100:0;return l>=100?"exceeded":l>=r.warningThresholdPercent?"warning":"healthy"}function ae(){const[r,l]=s.useState([]),[c,C]=s.useState(!0),[n,m]=s.useState(null),[S,a]=s.useState(!1),[k,g]=s.useState(!1),[o,p]=s.useState(""),[i,P]=s.useState("global"),[h,b]=s.useState(""),[j,B]=s.useState("monthly"),[f,v]=s.useState("10"),[y,z]=s.useState("80"),[N,T]=s.useState("warn"),d=s.useCallback(async()=>{try{const t=await F();l(t),m(null)}catch(t){m(t instanceof Error?t.message:"Failed to load budgets")}C(!1)},[]);s.useEffect(()=>{d()},[d]);const D=async()=>{if(o.trim()){g(!0);try{await $({name:o.trim(),scope:{type:i,targetId:h||void 0},period:j,limitUsd:parseFloat(f)||10,warningThresholdPercent:parseInt(y)||80,action:N,enabled:!0}),a(!1),p(""),b(""),v("10"),await d()}catch{}g(!1)}},E=async t=>{try{await I(t),await d()}catch{}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(A,{title:"Costs & Budgets",breadcrumbs:[{label:"Command Post"},{label:"Costs"}],actions:e.jsx(u,{size:"sm",icon:e.jsx(G,{size:14}),onClick:()=>a(!0),children:"Create Budget"})}),c&&e.jsx(M,{variant:"row",count:4}),n&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:n}),!c&&!n&&r.length===0&&e.jsx(L,{icon:e.jsx(H,{size:32}),title:"No budgets",description:"Create budget policies to control agent spending.",action:{label:"Create Budget",onClick:()=>a(!0)}}),!c&&!n&&r.length>0&&e.jsx("div",{className:"divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden",children:r.map(t=>{const U=t.limitUsd>0?t.currentSpend/t.limitUsd*100:0,x=q(t);return e.jsxs("div",{className:"flex items-center gap-4 px-4 py-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-sm font-medium text-text",children:t.name}),e.jsx(w,{status:x,size:"sm"}),!t.enabled&&e.jsx(w,{status:"disabled",size:"sm"})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted",children:[e.jsxs("span",{className:"capitalize",children:[t.scope.type,t.scope.targetId?`: ${t.scope.targetId}`:""]}),e.jsx("span",{className:"capitalize",children:t.period}),e.jsxs("span",{children:["Action: ",t.action]})]})]}),e.jsxs("div",{className:"text-right flex-shrink-0",children:[e.jsxs("div",{className:"text-sm font-medium text-text",children:["$",t.currentSpend.toFixed(2)," / $",t.limitUsd.toFixed(2)]}),e.jsx("div",{className:"w-24 h-1.5 bg-bg-tertiary rounded-full overflow-hidden mt-1",children:e.jsx("div",{className:`h-full rounded-full transition-all ${x==="exceeded"?"bg-error":x==="warning"?"bg-warning":"bg-success"}`,style:{width:`${Math.min(100,U)}%`}})})]}),e.jsx("button",{onClick:()=>E(t.id),className:"p-1.5 rounded-md text-text-muted hover:text-error hover:bg-error/10 transition-colors flex-shrink-0",title:"Delete budget",children:e.jsx(R,{size:14})})]},t.id)})}),e.jsx(W,{open:S,onClose:()=>a(!1),title:"Create Budget Policy",footer:e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"secondary",size:"sm",onClick:()=>a(!1),children:"Cancel"}),e.jsx(u,{size:"sm",onClick:D,loading:k,disabled:!o.trim(),children:"Create"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Name"}),e.jsx("input",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:"Budget name...",value:o,onChange:t=>p(t.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Scope"}),e.jsxs("select",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text focus:outline-none focus:border-accent",value:i,onChange:t=>P(t.target.value),children:[e.jsx("option",{value:"global",children:"Global"}),e.jsx("option",{value:"agent",children:"Agent"}),e.jsx("option",{value:"goal",children:"Goal"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Period"}),e.jsxs("select",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text focus:outline-none focus:border-accent",value:j,onChange:t=>B(t.target.value),children:[e.jsx("option",{value:"daily",children:"Daily"}),e.jsx("option",{value:"weekly",children:"Weekly"}),e.jsx("option",{value:"monthly",children:"Monthly"})]})]})]}),i!=="global"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Target ID"}),e.jsx("input",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:`${i} ID...`,value:h,onChange:t=>b(t.target.value)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Limit (USD)"}),e.jsx("input",{type:"number",className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text focus:outline-none focus:border-accent",value:f,onChange:t=>v(t.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Warning %"}),e.jsx("input",{type:"number",className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text focus:outline-none focus:border-accent",value:y,onChange:t=>z(t.target.value)})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Action on Threshold"}),e.jsxs("select",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text focus:outline-none focus:border-accent",value:N,onChange:t=>T(t.target.value),children:[e.jsx("option",{value:"warn",children:"Warn"}),e.jsx("option",{value:"pause",children:"Pause"}),e.jsx("option",{value:"stop",children:"Stop"})]})]})]})})]})}export{ae as default};
@@ -0,0 +1 @@
1
+ import{r as p,j as t,t as ae,y as re,z as ne,D as ie,F as oe,U as ce,J as de,A as q,K as X}from"./index-Cml2x9pA.js";import"./Button-MdXmb4_n.js";import"./Input-CBTwa_Iw.js";import{S as xe}from"./StatusBadge-BqlvIbdj.js";import{P as J}from"./PageHeader-DdrbS1aq.js";import{S as me}from"./SkeletonLoader-r6OGXaU9.js";import{R as fe}from"./refresh-cw-C-iZkzuS.js";import{L as K}from"./list-todo-BlgfQHup.js";import{D as he}from"./dollar-sign-XxwPAA2a.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DbLSHmff.js";const Q={idle:"textSecondary",active:"success",paused:"warning",error:"error",stopped:"borderLight"},ge={ceo:"C",manager:"M",engineer:"E",researcher:"R",general:"G"};function be({agents:y,activity:i}){const M=p.useRef(null),v=p.useRef(y),A=p.useRef(i);return v.current=y,A.current=i,p.useEffect(()=>{const f=M.current;if(!f)return;const e=f.getContext("2d");if(!e)return;const C=window.devicePixelRatio||1;let L,$=0;const W=()=>{const o=document.documentElement,m=getComputedStyle(o),n=(s,h,l)=>{const S=s?m.getPropertyValue(s).trim():"";return S||m.getPropertyValue(h).trim()||l};return{bg:n("--theme-bg-base","--color-bg","#09090b"),bgTertiary:n("--theme-bg-grain","--color-bg-tertiary","#27272a"),border:n("--theme-metal-dark","--color-border","#3f3f46"),borderLight:n("--theme-metal","--color-border-light","#52525b"),textMuted:n("--theme-ink-soft","--color-text-muted","#71717a"),textSecondary:n("--theme-paper-fg","--color-text-secondary","#a1a1aa"),accent:n("--theme-accent","--color-accent","#6366f1"),accentLight:n(null,"--color-accent-light","#a5b4fc"),success:n(null,"--color-success","#22c55e"),warning:n(null,"--color-warning","#f59e0b"),error:n(null,"--color-error","#ef4444")}},j=()=>{const o=f.clientWidth,m=f.clientHeight;f.width=o*C,f.height=m*C,e.setTransform(C,0,0,C,0,0)};j(),window.addEventListener("resize",j);const w=()=>{$++;const o=$/15,m=f.clientWidth,n=f.clientHeight,s=v.current,h=A.current,l=W();e.fillStyle=l.bg,e.fillRect(0,0,m,n),e.strokeStyle="#141418",e.lineWidth=.5;for(let a=0;a<m;a+=24)e.beginPath(),e.moveTo(a,n*.72),e.lineTo(a,n),e.stroke();for(let a=n*.72;a<n;a+=24)e.beginPath(),e.moveTo(0,a),e.lineTo(m,a),e.stroke();if(s.length===0){e.fillStyle=l.bgTertiary,e.font="12px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center",e.fillText("No agents registered",m/2,n/2-10),e.font="10px -apple-system, BlinkMacSystemFont, sans-serif",e.fillStyle=l.border,e.fillText("Spawn agents to see them here",m/2,n/2+10),e.textAlign="start",L=requestAnimationFrame(w);return}const S=Math.min(s.length,8),I=Math.min(120,(m-20)/S),ee=(m-I*S)/2+I/2;for(let a=0;a<S;a++){const k=s[a],r=ee+a*I,c=n*.55,g=k.status==="active"?"active":k.status,E=l[Q[g]||Q.idle],d=Math.sin(o*.8+a*1.5)*1.5,F=h.some(x=>x.agentId===k.id&&Date.now()-new Date(x.timestamp).getTime()<3e4),D=Math.min(70,I-10),P=10,z=r-D/2,N=c+16;e.fillStyle=l.border,e.fillRect(z,N,D,P),e.fillStyle=l.borderLight,e.fillRect(z+1,N+1,D-2,P-2),e.fillStyle=l.border,e.fillRect(z+3,N+P,3,14),e.fillRect(z+D-6,N+P,3,14);const H=26,O=18,V=r-H/2,U=N-O;e.fillStyle=l.bgTertiary,e.fillRect(V,U,H,O);const Y=g==="error"?l.error:g==="active"?l.success:l.accent;if(e.fillStyle=Y+"30",e.fillRect(V+2,U+2,H-4,O-4),g==="active"||F){e.fillStyle=Y+"60";const x=2+Math.floor(o%3);for(let b=0;b<x;b++){const T=6+Math.sin(o*2+b+a)*5;e.fillRect(V+3,U+3+b*4,T,1.5)}}e.fillStyle=l.border,e.fillRect(r-2,N-1,4,3),e.fillStyle="#1e1e22",e.fillRect(r-10,c+10+d,20,8),e.fillRect(r-11,c-2+d,3,20),e.fillStyle=l.border,e.fillRect(r-7,c+d,14,12);const u=g==="active"&&F?Math.sin(o*1.5+a)*1.5:0;e.fillStyle=l.borderLight,e.fillRect(r-6,c-10+d+u,12,10);const G=Math.sin(o*.3+a*2)>.95?1:2;if(e.fillStyle=E,g==="stopped"?(e.fillRect(r-4,c-7+d+u,2,1),e.fillRect(r-3,c-6+d+u,2,1),e.fillRect(r+1,c-7+d+u,2,1),e.fillRect(r+2,c-6+d+u,2,1)):(e.fillRect(r-4,c-7+d+u,2,G),e.fillRect(r+2,c-7+d+u,2,G)),e.fillStyle=l.borderLight,e.fillRect(r-1,c-14+d+u,2,4),e.fillStyle=E,e.beginPath(),e.arc(r,c-15+d+u,2,0,Math.PI*2),e.fill(),g==="active"&&(e.globalAlpha=.3+Math.sin(o*3+a)*.2,e.beginPath(),e.arc(r,c-15+d+u,5,0,Math.PI*2),e.fill(),e.globalAlpha=1),g==="active"&&F){const x=Math.sin(o*6+a)*2,b=Math.sin(o*6+a+Math.PI)*2;e.fillStyle=l.border,e.fillRect(r-11,c+3+d+x,4,3),e.fillRect(r+7,c+3+d+b,4,3)}else e.fillStyle=l.border,e.fillRect(r-10,c+5+d,3,6),e.fillRect(r+7,c+5+d,3,6);if(g==="active"&&F){for(let x=0;x<2;x++){const b=o*1.5+x*Math.PI+a,T=14+Math.sin(o+x)*4,se=r+Math.cos(b)*T,le=c-3+Math.sin(b)*T*.4+d;e.globalAlpha=.25+Math.sin(o*2+x)*.15,e.fillStyle=E,e.beginPath(),e.arc(se,le,1,0,Math.PI*2),e.fill()}e.globalAlpha=1}if(g==="error"){for(let x=0;x<3;x++){const b=r+Math.sin(o*4+x*2)*12,T=c-5+Math.cos(o*3+x)*8+d;e.globalAlpha=.4+Math.sin(o+x)*.3,e.fillStyle=l.error,e.fillRect(b-1,T-1,2,2)}e.globalAlpha=1}e.fillStyle=g==="stopped"?l.border:l.textMuted,e.font="9px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center";const _=Math.max(44,D+14);let R=k.name;if(e.measureText(R).width>_){for(;R.length>1&&e.measureText(R+"…").width>_;)R=R.slice(0,-1);R=R.trimEnd()+"…"}e.fillText(R,r,N+P+24);const te=ge[k.role]||"G";e.fillStyle=E+"60",e.font="bold 7px -apple-system, BlinkMacSystemFont, sans-serif",e.fillText(te,r,N+P+33),e.textAlign="start"}if(e.fillStyle=l.bgTertiary,e.font="bold 9px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center",e.fillText("COMMAND POST",m/2,n-6),e.textAlign="start",h.length>0){const a=h[h.length-1];if(Date.now()-new Date(a.timestamp).getTime()<6e4){e.fillStyle=l.accent+"40",e.fillRect(0,0,m,16),e.fillStyle=l.accentLight,e.font="8px -apple-system, BlinkMacSystemFont, sans-serif";const r=a.message.length>60?a.message.slice(0,57)+"...":a.message;e.textAlign="center",e.fillText(r,m/2,11),e.textAlign="start"}}L=requestAnimationFrame(w)};return w(),()=>{cancelAnimationFrame(L),window.removeEventListener("resize",j)}},[]),t.jsx("canvas",{ref:M,className:"w-full rounded-xl border border-border",style:{height:220,imageRendering:"pixelated"}})}function Z(y){const i=Math.floor((Date.now()-new Date(y).getTime())/1e3);return i<60?`${i}s`:i<3600?`${Math.floor(i/60)}m`:i<86400?`${Math.floor(i/3600)}h`:`${Math.floor(i/86400)}d`}function B({icon:y,label:i,value:M,sub:v,color:A}){return t.jsxs("div",{className:"bg-bg-tertiary/50 border border-border rounded-xl p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(y,{size:14,className:A}),t.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:i})]}),t.jsx("div",{className:"text-2xl font-bold text-text",children:M}),v&&t.jsx("div",{className:"text-[11px] text-text-muted mt-1",children:v})]})}function Pe(){var n;const{toast:y}=ae(),[i,M]=p.useState(null),[v,A]=p.useState([]),[f,e]=p.useState([]),[C,L]=p.useState(0),[$,W]=p.useState(!0),j=p.useCallback(async()=>{try{const[s,h,l,S]=await Promise.all([re(),ne(20),ie(),oe("pending")]);M(s),A(h),e(l),L(S.length)}catch(s){M(h=>(h===null&&y("error",`Couldn't load the dashboard — try again. ${s.message}`),h))}W(!1)},[y]);if(p.useEffect(()=>{j();const s=setInterval(j,15e3);return()=>clearInterval(s)},[j]),$)return t.jsxs("div",{className:"space-y-6",children:[t.jsx(J,{title:"Dashboard",breadcrumbs:[{label:"Command Post"},{label:"Dashboard"}]}),t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:t.jsx(me,{variant:"metric",count:4})})]});if(!i)return t.jsx("div",{className:"text-center py-12 text-text-muted",children:"Failed to load dashboard"});const w=i.budgetUtilization??0,o=f.filter(s=>s.status==="in_progress").length,m=f.filter(s=>s.status==="blocked").length;return t.jsxs("div",{className:"space-y-6",children:[t.jsx(J,{title:"Dashboard",breadcrumbs:[{label:"Command Post"},{label:"Dashboard"}],actions:t.jsx("button",{onClick:j,className:"p-1.5 text-text-muted hover:text-text rounded-lg hover:bg-bg-tertiary transition-colors",children:t.jsx(fe,{size:16})})}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[t.jsx(B,{icon:ce,label:"Agents Enabled",value:i.totalAgents,sub:`${i.activeAgents} running, ${Math.max(0,i.totalAgents-i.activeAgents)} paused`,color:"text-info"}),t.jsx(B,{icon:K,label:"Tasks In Progress",value:o,sub:`${f.length} open, ${m} blocked`,color:"text-warning"}),t.jsx(B,{icon:he,label:"Budget Used",value:`${Math.round(w)}%`,sub:w>=80?"Nearing limit":"Healthy",color:w>=80?"text-error":"text-success"}),t.jsx(B,{icon:de,label:"Goals",value:((n=i.goalTree)==null?void 0:n.length)??0,sub:"in hierarchy",color:"text-purple"})]}),i.agents.length>0&&t.jsx(be,{agents:i.agents,activity:v}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[t.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(q,{size:14,className:"text-accent"}),t.jsx("h3",{className:"text-sm font-semibold text-text",children:"Recent Activity"})]}),t.jsx(X,{to:"/command-post/activity",className:"text-[10px] text-accent hover:text-accent-hover",children:"View all"})]}),t.jsx("div",{className:"max-h-72 overflow-y-auto divide-y divide-border",children:v.length===0?t.jsx("div",{className:"py-8 text-center text-xs text-text-muted",children:"No activity yet"}):[...v].reverse().slice(0,15).map((s,h)=>t.jsxs("div",{className:"flex items-start gap-2 px-4 py-2",children:[t.jsx(q,{size:12,className:"text-text-muted mt-0.5 flex-shrink-0"}),t.jsx("span",{className:"text-[11px] text-text-secondary flex-1",children:s.message}),t.jsx("span",{className:"text-[10px] text-text-muted flex-shrink-0",children:Z(s.timestamp)})]},`${s.timestamp}-${h}`))})]}),t.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(K,{size:14,className:"text-accent"}),t.jsx("h3",{className:"text-sm font-semibold text-text",children:"Recent Issues"})]}),t.jsx(X,{to:"/command-post/issues",className:"text-[10px] text-accent hover:text-accent-hover",children:"View all"})]}),t.jsx("div",{className:"max-h-72 overflow-y-auto divide-y divide-border",children:f.length===0?t.jsx("div",{className:"py-8 text-center text-xs text-text-muted",children:"No issues yet"}):f.slice(0,10).map(s=>t.jsxs(X,{to:`/command-post/issues/${s.id}`,className:"flex items-center gap-2 px-4 py-2 hover:bg-bg-tertiary transition-colors",children:[t.jsx(xe,{status:s.status,variant:"dot",size:"sm"}),t.jsx("span",{className:"text-[11px] text-text-secondary flex-1 truncate",children:s.title}),s.assigneeAgentId&&t.jsx("span",{className:"text-[10px] text-text-muted",children:s.assigneeAgentId}),t.jsx("span",{className:"text-[10px] text-text-muted flex-shrink-0",children:Z(s.updatedAt)})]},s.id))})]})]})]})}export{Pe as default};
@@ -1 +1 @@
1
- import{r as i,j as e,b as f,X as j}from"./index-CUgepw5Q.js";import{P as v}from"./PageHeader-bnc85wQN.js";import{F as y}from"./folder-BeZZUGnK.js";import{F as N}from"./flask-conical-BGn5PgFX.js";import{S as w}from"./search-BP7VlNxX.js";import{R as p}from"./refresh-cw-CwDpzXUn.js";import{F as k}from"./file-text-DrdTDEYp.js";import"./chevron-right-CQ1NTOtd.js";async function h(t){const a=await f(t);if(!a.ok)throw new Error(`HTTP ${a.status}`);return a.json()}function b(t){return t===void 0?"—":t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}K`:`${(t/1024/1024).toFixed(1)}M`}function g(t){const a=Math.floor((Date.now()-new Date(t).getTime())/1e3);return a<60?`${a}s`:a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}function C({path:t,onClose:a}){const[r,c]=i.useState(null);return i.useEffect(()=>{c(null),h(`/api/files/content?path=${encodeURIComponent(t)}`).then(l=>c(l)).catch(l=>c({error:String(l)}))},[t]),e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 flex items-center justify-center p-4",onClick:a,children:e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl w-full max-w-5xl max-h-[90vh] flex flex-col shadow-2xl",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text truncate",children:t}),r&&"sizeBytes"in r&&e.jsxs("div",{className:"text-xs text-text-muted",children:[b(r.sizeBytes)," · ",r.encoding,r.truncated?" · truncated at 1MB":""]})]}),e.jsx("button",{onClick:a,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted",title:"Close",children:e.jsx(j,{size:18})})]}),e.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[r===null&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),r&&"error"in r&&e.jsx("div",{className:"text-error text-sm py-8 text-center",children:r.error}),r&&"content"in r&&e.jsx("pre",{className:"text-[12px] font-mono leading-snug whitespace-pre-wrap text-text-secondary",children:r.content})]})]})})}function S(){const[t,a]=i.useState([]),[r,c]=i.useState(!0),[l,m]=i.useState(""),[o,n]=i.useState(null),d=i.useCallback(async()=>{c(!0);try{const s=await h("/api/files/edited?limit=300");a(s.files||[])}catch{}c(!1)},[]);i.useEffect(()=>{d()},[d]);const x=l?t.filter(s=>s.path.toLowerCase().includes(l.toLowerCase())):t;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-bg-secondary",children:[e.jsx(w,{size:14,className:"text-text-muted"}),e.jsx("input",{type:"text",placeholder:"Filter by path…",value:l,onChange:s=>m(s.target.value),className:"flex-1 bg-transparent text-sm outline-none"})]}),e.jsxs("button",{onClick:d,className:"px-3 py-1.5 rounded-lg border border-border bg-bg-secondary text-sm hover:bg-bg-tertiary flex items-center gap-1.5",title:"Refresh",children:[e.jsx(p,{size:14,className:r?"animate-spin":""}),r?"Loading":"Refresh"]}),e.jsxs("div",{className:"text-xs text-text-muted",children:[x.length," / ",t.length]})]}),r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),!r&&x.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:l?"No files match filter":"No file edits recorded yet"}),x.length>0&&e.jsx("div",{className:"divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden",children:x.map(s=>e.jsxs("button",{onClick:()=>s.readable&&s.exists&&n(s.path),disabled:!s.readable||!s.exists,className:"w-full flex items-start gap-3 px-4 py-2.5 text-left hover:bg-bg-tertiary transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(k,{size:14,className:s.isSelfMod?"text-accent mt-0.5 flex-shrink-0":"text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-mono text-text truncate",children:s.path}),e.jsxs("div",{className:"text-xs text-text-muted mt-0.5 flex items-center gap-2 flex-wrap",children:[s.isSelfMod&&e.jsx("span",{className:"px-1 rounded bg-accent/15 text-accent text-[10px]",children:"self-mod"}),e.jsxs("span",{children:["×",s.writeCount]}),s.tools.length>0&&e.jsx("span",{children:s.tools.join("+")}),s.channels.length>0&&e.jsxs("span",{children:["via ",s.channels.join(", ")]}),!s.exists&&e.jsx("span",{className:"text-warn",children:"deleted"}),e.jsx("span",{children:b(s.sizeBytes)})]})]}),e.jsx("div",{className:"text-xs text-text-muted flex-shrink-0",children:g(s.lastWrittenAt)})]},s.path))}),o&&e.jsx(C,{path:o,onClose:()=>n(null)})]})}function F(){const[t,a]=i.useState([]),[r,c]=i.useState(!0),[l,m]=i.useState(null),o=i.useCallback(async()=>{c(!0);try{const n=await h("/api/research/recent?limit=50");a(n.research||[])}catch{}c(!1)},[]);return i.useEffect(()=>{o()},[o]),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:o,className:"px-3 py-1.5 rounded-lg border border-border bg-bg-secondary text-sm hover:bg-bg-tertiary flex items-center gap-1.5",children:[e.jsx(p,{size:14,className:r?"animate-spin":""}),r?"Loading":"Refresh"]}),e.jsxs("div",{className:"text-xs text-text-muted",children:[t.length," items"]})]}),r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),!r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"No research recorded yet. Complete a goal and results will appear here."}),e.jsx("div",{className:"space-y-2",children:t.map(n=>{var u;const d=l===n.id,x=n.content.slice(0,200),s=n.subtaskTitle?`${n.goalTitle} — ${n.subtaskTitle}`:((u=n.tags)==null?void 0:u.join(" · "))||n.kind;return e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary overflow-hidden",children:[e.jsxs("button",{onClick:()=>m(d?null:n.id),className:"w-full text-left px-4 py-3 hover:bg-bg-tertiary transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary text-text-muted uppercase tracking-wide font-medium",children:n.kind.replace(/_/g," ")}),e.jsx("span",{className:"text-xs text-text-muted",children:g(n.at)})]}),e.jsx("div",{className:"text-sm font-medium text-text truncate",children:s}),!d&&e.jsxs("div",{className:"text-xs text-text-secondary mt-1 line-clamp-2",children:[x,n.content.length>200?"…":""]})]}),d&&e.jsx("div",{className:"px-4 pb-4",children:e.jsx("pre",{className:"text-[12px] font-mono leading-snug whitespace-pre-wrap text-text-secondary",children:n.content})})]},n.id)})})]})}function P(){const[t,a]=i.useState("files");return e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{title:"Files & Research",subtitle:"Files edited by agents and research notes captured during missions",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"Files"}]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>a("files"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors ${t==="files"?"bg-accent/15 text-accent border border-accent/30":"text-text-secondary hover:text-text hover:bg-bg-tertiary border border-transparent"}`,children:[e.jsx(y,{size:14})," Files edited"]}),e.jsxs("button",{onClick:()=>a("research"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors ${t==="research"?"bg-accent/15 text-accent border border-accent/30":"text-text-secondary hover:text-text hover:bg-bg-tertiary border border-transparent"}`,children:[e.jsx(N,{size:14})," Research"]})]}),t==="files"?e.jsx(S,{}):e.jsx(F,{})]})}export{P as default};
1
+ import{r as i,j as e,b as f,X as j}from"./index-Cml2x9pA.js";import{P as v}from"./PageHeader-DdrbS1aq.js";import{F as y}from"./folder-DAdIw-Pb.js";import{F as N}from"./flask-conical-Ql8QxhgY.js";import{S as w}from"./search-D10l0m3-.js";import{R as p}from"./refresh-cw-C-iZkzuS.js";import{F as k}from"./file-text-Cfawu8Bs.js";import"./chevron-right-DbLSHmff.js";async function h(t){const a=await f(t);if(!a.ok)throw new Error(`HTTP ${a.status}`);return a.json()}function b(t){return t===void 0?"—":t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}K`:`${(t/1024/1024).toFixed(1)}M`}function g(t){const a=Math.floor((Date.now()-new Date(t).getTime())/1e3);return a<60?`${a}s`:a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}function C({path:t,onClose:a}){const[r,c]=i.useState(null);return i.useEffect(()=>{c(null),h(`/api/files/content?path=${encodeURIComponent(t)}`).then(l=>c(l)).catch(l=>c({error:String(l)}))},[t]),e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 flex items-center justify-center p-4",onClick:a,children:e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl w-full max-w-5xl max-h-[90vh] flex flex-col shadow-2xl",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text truncate",children:t}),r&&"sizeBytes"in r&&e.jsxs("div",{className:"text-xs text-text-muted",children:[b(r.sizeBytes)," · ",r.encoding,r.truncated?" · truncated at 1MB":""]})]}),e.jsx("button",{onClick:a,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted",title:"Close",children:e.jsx(j,{size:18})})]}),e.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[r===null&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),r&&"error"in r&&e.jsx("div",{className:"text-error text-sm py-8 text-center",children:r.error}),r&&"content"in r&&e.jsx("pre",{className:"text-[12px] font-mono leading-snug whitespace-pre-wrap text-text-secondary",children:r.content})]})]})})}function S(){const[t,a]=i.useState([]),[r,c]=i.useState(!0),[l,m]=i.useState(""),[o,n]=i.useState(null),d=i.useCallback(async()=>{c(!0);try{const s=await h("/api/files/edited?limit=300");a(s.files||[])}catch{}c(!1)},[]);i.useEffect(()=>{d()},[d]);const x=l?t.filter(s=>s.path.toLowerCase().includes(l.toLowerCase())):t;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-bg-secondary",children:[e.jsx(w,{size:14,className:"text-text-muted"}),e.jsx("input",{type:"text",placeholder:"Filter by path…",value:l,onChange:s=>m(s.target.value),className:"flex-1 bg-transparent text-sm outline-none"})]}),e.jsxs("button",{onClick:d,className:"px-3 py-1.5 rounded-lg border border-border bg-bg-secondary text-sm hover:bg-bg-tertiary flex items-center gap-1.5",title:"Refresh",children:[e.jsx(p,{size:14,className:r?"animate-spin":""}),r?"Loading":"Refresh"]}),e.jsxs("div",{className:"text-xs text-text-muted",children:[x.length," / ",t.length]})]}),r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),!r&&x.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:l?"No files match filter":"No file edits recorded yet"}),x.length>0&&e.jsx("div",{className:"divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden",children:x.map(s=>e.jsxs("button",{onClick:()=>s.readable&&s.exists&&n(s.path),disabled:!s.readable||!s.exists,className:"w-full flex items-start gap-3 px-4 py-2.5 text-left hover:bg-bg-tertiary transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(k,{size:14,className:s.isSelfMod?"text-accent mt-0.5 flex-shrink-0":"text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-mono text-text truncate",children:s.path}),e.jsxs("div",{className:"text-xs text-text-muted mt-0.5 flex items-center gap-2 flex-wrap",children:[s.isSelfMod&&e.jsx("span",{className:"px-1 rounded bg-accent/15 text-accent text-[10px]",children:"self-mod"}),e.jsxs("span",{children:["×",s.writeCount]}),s.tools.length>0&&e.jsx("span",{children:s.tools.join("+")}),s.channels.length>0&&e.jsxs("span",{children:["via ",s.channels.join(", ")]}),!s.exists&&e.jsx("span",{className:"text-warn",children:"deleted"}),e.jsx("span",{children:b(s.sizeBytes)})]})]}),e.jsx("div",{className:"text-xs text-text-muted flex-shrink-0",children:g(s.lastWrittenAt)})]},s.path))}),o&&e.jsx(C,{path:o,onClose:()=>n(null)})]})}function F(){const[t,a]=i.useState([]),[r,c]=i.useState(!0),[l,m]=i.useState(null),o=i.useCallback(async()=>{c(!0);try{const n=await h("/api/research/recent?limit=50");a(n.research||[])}catch{}c(!1)},[]);return i.useEffect(()=>{o()},[o]),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:o,className:"px-3 py-1.5 rounded-lg border border-border bg-bg-secondary text-sm hover:bg-bg-tertiary flex items-center gap-1.5",children:[e.jsx(p,{size:14,className:r?"animate-spin":""}),r?"Loading":"Refresh"]}),e.jsxs("div",{className:"text-xs text-text-muted",children:[t.length," items"]})]}),r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),!r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"No research recorded yet. Complete a goal and results will appear here."}),e.jsx("div",{className:"space-y-2",children:t.map(n=>{var u;const d=l===n.id,x=n.content.slice(0,200),s=n.subtaskTitle?`${n.goalTitle} — ${n.subtaskTitle}`:((u=n.tags)==null?void 0:u.join(" · "))||n.kind;return e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary overflow-hidden",children:[e.jsxs("button",{onClick:()=>m(d?null:n.id),className:"w-full text-left px-4 py-3 hover:bg-bg-tertiary transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary text-text-muted uppercase tracking-wide font-medium",children:n.kind.replace(/_/g," ")}),e.jsx("span",{className:"text-xs text-text-muted",children:g(n.at)})]}),e.jsx("div",{className:"text-sm font-medium text-text truncate",children:s}),!d&&e.jsxs("div",{className:"text-xs text-text-secondary mt-1 line-clamp-2",children:[x,n.content.length>200?"…":""]})]}),d&&e.jsx("div",{className:"px-4 pb-4",children:e.jsx("pre",{className:"text-[12px] font-mono leading-snug whitespace-pre-wrap text-text-secondary",children:n.content})})]},n.id)})})]})}function P(){const[t,a]=i.useState("files");return e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{title:"Files & Research",subtitle:"Files edited by agents and research notes captured during missions",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"Files"}]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>a("files"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors ${t==="files"?"bg-accent/15 text-accent border border-accent/30":"text-text-secondary hover:text-text hover:bg-bg-tertiary border border-transparent"}`,children:[e.jsx(y,{size:14})," Files edited"]}),e.jsxs("button",{onClick:()=>a("research"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors ${t==="research"?"bg-accent/15 text-accent border border-accent/30":"text-text-secondary hover:text-text hover:bg-bg-tertiary border border-transparent"}`,children:[e.jsx(N,{size:14})," Research"]})]}),t==="files"?e.jsx(S,{}):e.jsx(F,{})]})}export{P as default};
@@ -0,0 +1 @@
1
+ import{r as i,Y as D,j as e,J as N,$,X as M,b as y}from"./index-Cml2x9pA.js";import{B as j}from"./Button-MdXmb4_n.js";import"./Input-CBTwa_Iw.js";import{S as z}from"./StatusBadge-BqlvIbdj.js";import{P as O}from"./PageHeader-DdrbS1aq.js";import{E as A}from"./EmptyState-D9kQf1PX.js";import{M as F}from"./Modal-ybPGvlQs.js";import{S as L}from"./SkeletonLoader-r6OGXaU9.js";import{P as B}from"./plus-Dpo1qfrl.js";import{C as I}from"./chevron-right-DbLSHmff.js";import{T as J}from"./trash-2-CTeyjxD_.js";import"./clsx-B-dksMZM.js";function U(t){const a=Math.floor((Date.now()-new Date(t).getTime())/1e3);return a<60?`${a}s`:a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}const _=["pending","in_progress","completed","blocked"];function H({node:t,onClose:a,onRefresh:l}){const[d,c]=i.useState(!1),[x,m]=i.useState(!1),r=t.goal,g=async()=>{c(!0);try{await y(`/api/goals/${r.id}`,{method:"DELETE"}),l(),a()}catch{}c(!1)},o=async n=>{m(!0);try{await y(`/api/goals/${r.id}`,{method:"PATCH",body:JSON.stringify({status:n})}),l()}catch{}m(!1)};return e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-text",children:r.title}),r.description&&e.jsx("p",{className:"text-sm text-text-secondary mt-1",children:r.description})]}),e.jsx("button",{onClick:a,className:"p-1 text-text-muted hover:text-text rounded-lg hover:bg-bg-tertiary transition-colors",children:e.jsx(M,{size:16})})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 text-xs",children:[e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Status: "}),e.jsx(z,{status:r.status,size:"sm"})]}),r.progress>0&&e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Progress: "}),e.jsxs("span",{className:"text-text font-medium",children:[Math.round(r.progress),"%"]})]}),t.children.length>0&&e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Sub-goals: "}),e.jsxs("span",{className:"text-text font-medium",children:[t.children.filter(n=>n.goal.status==="completed"||n.goal.status==="done").length,"/",t.children.length," done"]})]}),e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Updated: "}),e.jsxs("span",{className:"text-text font-medium",children:[U(r.updatedAt||r.createdAt||new Date().toISOString())," ago"]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-2",children:"Change Status"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:_.map(n=>e.jsx("button",{disabled:x||r.status===n,onClick:()=>o(n),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${r.status===n?"bg-accent/20 text-accent border border-accent/30":"bg-bg-tertiary text-text-secondary hover:bg-bg-tertiary/80 border border-border"} disabled:opacity-50`,children:n.replace("_"," ")},n))})]}),e.jsx("div",{className:"pt-2 border-t border-border flex justify-end",children:e.jsxs("button",{onClick:g,disabled:d,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-error hover:bg-error/10 transition-colors disabled:opacity-50",children:[e.jsx(J,{size:12}),d?"Deleting...":"Delete Goal"]})})]})}function T({node:t,expanded:a,toggleExpand:l,selectedId:d,onSelect:c}){const x=t.children.length>0,m=a.has(t.goal.id),r=d===t.goal.id,g=t.children.filter(o=>o.goal.status==="completed"||o.goal.status==="done").length;return e.jsxs("div",{children:[e.jsxs("div",{className:`flex items-center gap-2 py-2 px-3 rounded-lg transition-colors cursor-pointer group ${r?"bg-accent/10 border-l-2 border-accent":"hover:bg-bg-tertiary/50"}`,style:{paddingLeft:`${t.depth*24+12}px`},onClick:()=>c(t),children:[x?e.jsx("button",{onClick:o=>{o.stopPropagation(),l(t.goal.id)},className:"p-0.5 rounded hover:bg-bg-tertiary transition-colors",children:m?e.jsx($,{size:14,className:"text-text-muted"}):e.jsx(I,{size:14,className:"text-text-muted"})}):e.jsx("span",{className:"w-[18px] flex-shrink-0"}),e.jsx(N,{size:14,className:r?"text-accent":"text-text-muted"}),e.jsx("span",{className:"text-sm text-text flex-1 truncate",children:t.goal.title}),e.jsx(z,{status:t.goal.status,size:"sm"}),x&&e.jsxs("span",{className:"text-[10px] text-text-muted",children:[g,"/",t.children.length]}),t.goal.progress>0&&e.jsx("div",{className:"w-16 h-1.5 bg-bg-tertiary rounded-full overflow-hidden flex-shrink-0",children:e.jsx("div",{className:"h-full bg-accent rounded-full transition-all",style:{width:`${Math.min(100,t.goal.progress)}%`}})})]}),x&&m&&e.jsx("div",{children:t.children.map(o=>e.jsx(T,{node:o,expanded:a,toggleExpand:l,selectedId:d,onSelect:c},o.goal.id))})]})}function E(t,a){for(const l of t){if(l.goal.id===a)return l;const d=E(l.children,a);if(d)return d}return null}function ae(){const[t,a]=i.useState([]),[l,d]=i.useState(!0),[c,x]=i.useState(null),[m,r]=i.useState(new Set),[g,o]=i.useState(null),[n,u]=i.useState(!1),[p,v]=i.useState(""),[P,S]=i.useState(!1),b=i.useCallback(async()=>{try{const s=await D();a(s),r(new Set(s.map(h=>h.goal.id))),x(null)}catch(s){x(s instanceof Error?s.message:"Failed to load goals")}d(!1)},[]);i.useEffect(()=>{b()},[b]);const C=s=>{r(h=>{const f=new Set(h);return f.has(s)?f.delete(s):f.add(s),f})},G=s=>{o(h=>h===s.goal.id?null:s.goal.id),s.children.length>0&&!m.has(s.goal.id)&&C(s.goal.id)},w=async()=>{if(p.trim()){S(!0);try{await y("/api/command-post/goals",{method:"POST",body:JSON.stringify({title:p.trim()})}),u(!1),v(""),await b()}catch{}S(!1)}},k=g?E(t,g):null;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(O,{title:"Goals",breadcrumbs:[{label:"Command Post"},{label:"Goals"}],actions:e.jsx(j,{size:"sm",icon:e.jsx(B,{size:14}),onClick:()=>u(!0),children:"Create Goal"})}),l&&e.jsx(L,{variant:"row",count:5}),c&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:c}),!l&&!c&&t.length===0&&e.jsx(A,{icon:e.jsx(N,{size:32}),title:"No goals",description:"Create your first goal to start organizing agent work.",action:{label:"Create Goal",onClick:()=>u(!0)}}),!l&&!c&&t.length>0&&e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"lg:col-span-2 rounded-xl border border-border bg-bg-secondary overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-text-muted",children:[t.length," top-level goal",t.length!==1?"s":""]}),e.jsx("span",{className:"text-[10px] text-text-muted",children:"Click a goal to view details"})]}),e.jsx("div",{className:"divide-y divide-border",children:t.map(s=>e.jsx(T,{node:s,expanded:m,toggleExpand:C,selectedId:g,onSelect:G},s.goal.id))})]}),e.jsx("div",{className:"lg:col-span-1",children:k?e.jsx(H,{node:k,onClose:()=>o(null),onRefresh:b}):e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-8 text-center",children:[e.jsx(N,{size:24,className:"text-text-muted mx-auto mb-2"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Select a goal to view details"})]})})]}),e.jsx(F,{open:n,onClose:()=>u(!1),title:"Create Goal",footer:e.jsxs(e.Fragment,{children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:()=>u(!1),children:"Cancel"}),e.jsx(j,{size:"sm",onClick:w,loading:P,disabled:!p.trim(),children:"Create"})]}),children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Goal Title"}),e.jsx("input",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:"Enter goal title...",value:p,onChange:s=>v(s.target.value),onKeyDown:s=>s.key==="Enter"&&w(),autoFocus:!0})]})})]})}export{ae as default};
@@ -0,0 +1,11 @@
1
+ import{c as P,r as d,t as D,j as e,bl as G,bN as J,u as Y,F as Z,a0 as ee,a1 as te,D as se,m as re,P as T,X as I,$ as ae,K as E,bO as ne,Q as ie,V as oe,bP as le,b as de}from"./index-Cml2x9pA.js";import{B as m}from"./Button-MdXmb4_n.js";import"./Input-CBTwa_Iw.js";import{P as ce}from"./PageHeader-DdrbS1aq.js";import{E as xe}from"./EmptyState-D9kQf1PX.js";import{T as ue}from"./Tabs-DdUThlp1.js";import{S as pe}from"./SkeletonLoader-r6OGXaU9.js";import{e as he}from"./approvalHeadline-DB9SgR-9.js";import{M as F}from"./message-square-CRsG9u6_.js";import{B as U}from"./bot-DvEcyQcD.js";import{C}from"./clock-JyQAYy6X.js";import{S as me}from"./send-DtXGsaFW.js";import{S as ge}from"./shield-check-CXlDJyAW.js";import{C as B}from"./check-CuRYh4Zh.js";import{F as fe}from"./funnel-FycfZcXo.js";import{S as be,C as ve}from"./square-BBC-JKzY.js";import{R as je}from"./rotate-ccw-qzrB3SNw.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DbLSHmff.js";/**
2
+ * @license lucide-react v0.513.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ye=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],ke=P("inbox",ye);/**
7
+ * @license lucide-react v0.513.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const we=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ne=P("square-check-big",we);function Se(o){return new Date(o).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function ze({approval:o,onReply:l}){const[u,y]=d.useState(""),[f,j]=d.useState(!1),{toast:x}=D(),k=o.thread||[],p=async()=>{if(u.trim()){j(!0);try{await J(o.id,"user",u.trim()),y(""),l==null||l(),x("success","Reply sent")}catch{x("error","Failed to send reply")}j(!1)}};return e.jsxs("div",{className:"space-y-3 mt-3",children:[k.length===0&&e.jsxs("div",{className:"text-xs text-text-muted italic flex items-center gap-1",children:[e.jsx(F,{size:12}),"No replies yet. Start the conversation below."]}),k.map(r=>e.jsxs("div",{className:`flex gap-2 ${r.authorUser?"flex-row":"flex-row-reverse"}`,children:[e.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 ${r.authorUser?"bg-accent/20 text-accent":"bg-warning/20 text-warning"}`,children:r.authorUser?e.jsx(G,{size:12}):e.jsx(U,{size:12})}),e.jsxs("div",{className:`max-w-[80%] rounded-lg px-3 py-2 text-xs ${r.authorUser?"bg-bg-tertiary text-text":"bg-warning/10 text-text border border-warning/20"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("span",{className:"font-semibold",children:r.authorUser||r.authorAgentId||"Agent"}),e.jsx(C,{size:10,className:"text-text-muted"}),e.jsx("span",{className:"text-text-muted",children:Se(r.createdAt)})]}),e.jsx("div",{className:"whitespace-pre-wrap",children:r.body})]})]},r.id)),e.jsxs("div",{className:"flex items-end gap-2 pt-2",children:[e.jsx("textarea",{value:u,onChange:r=>y(r.target.value),placeholder:"Reply to this agent...",className:"flex-1 min-h-[60px] rounded-lg border border-border bg-bg px-3 py-2 text-xs text-text outline-none focus:border-accent resize-none",onKeyDown:r=>{r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),p())}}),e.jsx("button",{onClick:p,disabled:f||!u.trim(),className:"h-8 w-8 rounded-lg bg-accent text-white flex items-center justify-center disabled:opacity-40 hover:bg-accent/90 transition-colors",children:e.jsx(me,{size:14})})]})]})}function Ce(o){const l=Math.floor((Date.now()-new Date(o).getTime())/1e3);return l<60?`${l}s`:l<3600?`${Math.floor(l/60)}m`:l<86400?`${Math.floor(l/3600)}h`:`${Math.floor(l/86400)}d`}function Ae(o){return!!o.snoozedUntil&&new Date(o.snoozedUntil)>new Date}function Xe(){const[o,l]=d.useState([]),[u,y]=d.useState(!0),[f,j]=d.useState(null),[x,k]=d.useState("all"),[p,r]=d.useState(null),[q,M]=d.useState(null),[w,S]=d.useState(new Set),[N,L]=d.useState("all"),{toast:c}=D(),V=Y(),h=d.useCallback(async()=>{try{const[t,n,a,b]=await Promise.all([Z("pending"),ee(void 0,50),te(),se({status:"blocked"})]),i=[];t.forEach(s=>{const v=he(s),g=s.type==="custom"&&s.payload.kind==="driver_blocked",R=s.type==="custom"&&s.payload.kind==="self_mod_pr";i.push({id:`approval-${s.id}`,kind:"approval",icon:ge,iconColor:g?"text-error":R?"text-warning":"text-accent",urgency:g||R?"high":"medium",message:`${v.kindLabel}: ${v.headline}`,timestamp:s.createdAt,data:s})}),n.filter(s=>s.status==="failed"||s.status==="error").forEach(s=>i.push({id:`run-${s.id}`,kind:"failed_run",icon:re,iconColor:"text-error",urgency:"high",message:`Run failed: ${s.agentId} — ${s.error??"unknown error"}`,timestamp:s.finishedAt??s.startedAt,data:s})),a.filter(s=>s.status==="error").forEach(s=>i.push({id:`agent-${s.id}`,kind:"error_agent",icon:T,iconColor:"text-error",urgency:"high",message:`Agent error: ${s.name}`,timestamp:s.lastHeartbeat,data:s})),b.forEach(s=>i.push({id:`issue-${s.id}`,kind:"blocked_issue",icon:T,iconColor:"text-warning",urgency:"medium",message:`Blocked: ${s.identifier} — ${s.title}`,timestamp:s.updatedAt,data:s})),i.sort((s,v)=>{const g={high:0,medium:1,low:2};return g[s.urgency]!==g[v.urgency]?g[s.urgency]-g[v.urgency]:new Date(v.timestamp).getTime()-new Date(s.timestamp).getTime()}),l(i),j(null)}catch(t){j(t instanceof Error?t.message:"Failed to load inbox")}y(!1)},[]);d.useEffect(()=>{h()},[h]);const H=async t=>{r(t.id);try{await ie(t.id,"user"),await h();const n=t.type==="goal_proposal"||t.type==="soma_proposal",a=t.type==="custom"&&t.payload.kind==="driver_blocked";c("success",n?"Work approved — TITAN is starting…":a?"Unblocked — TITAN is resuming…":"Approved"),(n||a)&&V("/command-post",{state:{tab:"Work"}})}catch{c("error","Approval failed")}r(null)},O=async t=>{r(t.id);try{await oe(t.id,"user"),await h(),c("success","Rejected")}catch{c("error","Reject failed")}r(null)},K=async(t,n)=>{r(t.id);try{const a=new Date(Date.now()+n*6e4).toISOString();await le(t.id,a),await h(),c("success",`Snoozed for ${n}m`)}catch{c("error","Snooze failed")}r(null)},W=async t=>{r(t.id);try{const n=await de(`/api/command-post/runs/${t.id}/retry`,{method:"POST"});if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);await h(),c("success","Retry queued — TITAN will try again")}catch{c("error","Retry failed")}r(null)},X=t=>{S(n=>{const a=new Set(n);return a.has(t)?a.delete(t):a.add(t),a})},A=async t=>{const n=Array.from(w).map(a=>{var b;return(b=o.find(i=>i.id===a))==null?void 0:b.data}).filter(a=>(a==null?void 0:a.id)!==void 0).map(a=>a.id);if(n.length!==0){r("batch");try{await ne(n,t,"user"),S(new Set),await h(),c("success",`${t==="approve"?"Approved":"Rejected"} ${n.length} item(s)`)}catch{c("error","Batch action failed")}r(null)}},z=o.filter(t=>x==="all"?!0:x==="approvals"?t.kind==="approval":x==="failed_runs"?t.kind==="failed_run":x==="errors"?t.kind==="error_agent"||t.kind==="blocked_issue":!0).filter(t=>N==="all"?!0:t.kind==="approval"?t.data.requestedBy===N:t.kind==="failed_run"?t.data.agentId===N:!0),$=o.filter(t=>t.kind==="approval"),Q=[{id:"all",label:"All",count:o.length},{id:"approvals",label:"Approvals",count:$.length},{id:"failed_runs",label:"Failed Runs",count:o.filter(t=>t.kind==="failed_run").length},{id:"errors",label:"Errors",count:o.filter(t=>t.kind==="error_agent"||t.kind==="blocked_issue").length}],_=Array.from(new Set($.map(t=>t.data.requestedBy))).filter(Boolean);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(ce,{title:"Inbox",breadcrumbs:[{label:"Command Post"},{label:"Inbox"}]}),w.size>0&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-accent/10 border border-accent/20",children:[e.jsxs("span",{className:"text-xs font-medium text-accent",children:[w.size," selected"]}),e.jsx("div",{className:"flex-1"}),e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>A("approve"),loading:p==="batch",icon:e.jsx(B,{size:14}),children:"Approve All"}),e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>A("reject"),loading:p==="batch",icon:e.jsx(I,{size:14}),children:"Reject All"}),e.jsx("button",{onClick:()=>S(new Set),className:"text-xs text-text-muted hover:text-text px-2",children:"Clear"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ue,{tabs:Q,activeTab:x,onChange:k}),e.jsx("div",{className:"flex-1"}),x==="approvals"&&_.length>0&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(fe,{size:12,className:"text-text-muted"}),e.jsxs("select",{value:N,onChange:t=>L(t.target.value),className:"text-xs bg-bg border border-border rounded px-2 py-1 outline-none focus:border-accent",children:[e.jsx("option",{value:"all",children:"All agents"}),_.map(t=>e.jsx("option",{value:t,children:t},t))]})]})]}),u&&e.jsx(pe,{variant:"row",count:5}),f&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:f}),!u&&!f&&z.length===0&&e.jsx(xe,{icon:e.jsx(ke,{size:32}),title:"Inbox empty",description:"No pending items require your attention."}),!u&&!f&&z.length>0&&e.jsx("div",{className:"space-y-2",children:z.map(t=>{const n=t.icon,a=q===t.id,b=w.has(t.id),i=t.kind==="approval"?t.data:null;return e.jsxs("div",{className:`rounded-xl border overflow-hidden transition-colors ${t.urgency==="high"?"border-error/30 bg-error/5":t.urgency==="medium"?"border-warning/20 bg-warning/[0.03]":"border-border bg-bg-secondary"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[t.kind==="approval"&&e.jsx("button",{onClick:()=>X(t.id),className:"text-text-muted hover:text-accent transition-colors",children:b?e.jsx(Ne,{size:16,className:"text-accent"}):e.jsx(be,{size:16})}),e.jsx(n,{size:16,className:t.iconColor}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-text font-medium truncate",children:t.message}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-text-muted mt-0.5",children:[i&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(U,{size:10}),i.requestedBy]}),i.thread&&i.thread.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent",children:[e.jsx(F,{size:10}),i.thread.length]}),Ae(i)&&e.jsxs("span",{className:"flex items-center gap-1 text-warning",children:[e.jsx(C,{size:10}),"Snoozed"]})]}),e.jsx("span",{children:Ce(t.timestamp)})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[t.kind==="approval"&&e.jsxs(e.Fragment,{children:[e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>H(t.data),loading:p===t.data.id,icon:e.jsx(B,{size:14}),children:"Approve"}),e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>O(t.data),loading:p===t.data.id,icon:e.jsx(I,{size:14}),children:"Reject"}),e.jsxs("div",{className:"relative group",children:[e.jsx(m,{size:"sm",variant:"ghost",icon:e.jsx(C,{size:14}),children:"Snooze"}),e.jsx("div",{className:"absolute right-0 top-full mt-1 hidden group-hover:flex flex-col gap-1 bg-bg border border-border rounded-lg p-1 shadow-lg z-10",children:[15,60,240,1440].map(s=>e.jsx("button",{onClick:()=>K(t.data,s),className:"text-xs text-left px-2 py-1 rounded hover:bg-bg-tertiary whitespace-nowrap",children:s<60?`${s}m`:s<1440?`${s/60}h`:`${s/1440}d`},s))})]}),e.jsx("button",{onClick:()=>M(a?null:t.id),className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted",children:a?e.jsx(ve,{size:14}):e.jsx(ae,{size:14})})]}),t.kind==="failed_run"&&e.jsx(m,{size:"sm",variant:"ghost",onClick:()=>W(t.data),loading:p===t.data.id,icon:e.jsx(je,{size:14}),children:"Retry"}),t.kind==="blocked_issue"&&e.jsx(E,{to:`/command-post/issues/${t.data.id}`,children:e.jsx(m,{size:"sm",variant:"ghost",children:"View"})}),t.kind==="error_agent"&&e.jsx(E,{to:`/command-post/agents/${t.data.id}`,children:e.jsx(m,{size:"sm",variant:"ghost",children:"View"})})]})]}),a&&i&&e.jsxs("div",{className:"px-4 pb-4 border-t border-border/50",children:[i.payload&&!!i.payload.shadowVerdict&&e.jsxs("div",{className:"mt-3 p-2 rounded-lg bg-bg-tertiary/50 text-xs",children:[e.jsx("div",{className:"font-medium text-text-muted mb-1",children:"Shadow Rehearsal"}),e.jsx("div",{className:"text-text-secondary",children:(()=>{const s=i.payload.shadowVerdict;return s?e.jsxs("div",{className:"space-y-1",children:[s.estimatedCostUsd?e.jsxs("div",{children:["Cost: $",Number(s.estimatedCostUsd).toFixed(2)]}):null,s.reversibilityScore!==void 0?e.jsxs("div",{children:["Reversibility: ",Number(s.reversibilityScore).toFixed(2)]}):null,s.breakRisks&&Array.isArray(s.breakRisks)&&s.breakRisks.length>0?e.jsxs("div",{className:"text-error",children:["Risks: ",s.breakRisks.join(", ")]}):null]}):null})()})]}),e.jsx(ze,{approval:i,onReply:h})]})]},t.id)})})]})}export{Xe as default};
@@ -0,0 +1 @@
1
+ import{q as $,u as B,r,bL as D,b as S,bM as M,j as e,K as L,bd as C}from"./index-Cml2x9pA.js";import{B as c}from"./Button-MdXmb4_n.js";import"./Input-CBTwa_Iw.js";import{S as O}from"./StatusBadge-BqlvIbdj.js";import{P as h}from"./PageHeader-DdrbS1aq.js";import{S as U}from"./SkeletonLoader-r6OGXaU9.js";import{A as K}from"./arrow-left-WkVYLm80.js";import{M as R}from"./message-square-CRsG9u6_.js";import{S as _}from"./send-DtXGsaFW.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DbLSHmff.js";function b(a){const i=Math.floor((Date.now()-new Date(a).getTime())/1e3);return i<60?`${i}s`:i<3600?`${Math.floor(i/60)}m`:i<86400?`${Math.floor(i/3600)}h`:`${Math.floor(i/86400)}d`}const F={critical:"text-error",high:"text-warning",medium:"text-accent",low:"text-text-muted"},q=["backlog","todo","in_progress","in_review","done","blocked","cancelled"];function se(){const{id:a}=$(),i=B(),[s,o]=r.useState(null),[l,k]=r.useState([]),[I,P]=r.useState(!0),[g,f]=r.useState(null),[A,x]=r.useState(!1),[m,u]=r.useState(""),[n,j]=r.useState(""),[E,y]=r.useState(!1),[v,T]=r.useState(""),p=r.useCallback(async()=>{if(a){try{const t=await D(a);o(t),u(t.title);try{const d=await S(`/api/command-post/issues/${a}/comments`);d.ok&&k(await d.json())}catch{}f(null)}catch(t){f(t instanceof Error?t.message:"Failed to load issue")}P(!1)}},[a]);r.useEffect(()=>{p()},[p]),r.useEffect(()=>{s!=null&&s.id&&M(s.id).then(t=>T(t.ancestry)).catch(()=>{})},[s==null?void 0:s.id]);const z=async t=>{if(!(!a||!s))try{const d=await C(a,{status:t});o(d)}catch{}},N=async()=>{if(!(!a||!s||!m.trim()))try{const t=await C(a,{title:m.trim()});o(t),x(!1)}catch{}},w=async()=>{if(!(!a||!n.trim())){y(!0);try{await S(`/api/command-post/issues/${a}/comments`,{method:"POST",body:JSON.stringify({body:n.trim()})}),j(""),await p()}catch{}y(!1)}};return I?e.jsxs("div",{className:"space-y-6",children:[e.jsx(h,{title:"Issue",breadcrumbs:[{label:"Command Post"},{label:"Issues",href:"/command-post/issues"},{label:"..."}]}),e.jsx(U,{variant:"card",count:1})]}):g||!s?e.jsxs("div",{className:"space-y-6",children:[e.jsx(h,{title:"Issue",breadcrumbs:[{label:"Command Post"},{label:"Issues",href:"/command-post/issues"},{label:"Error"}]}),e.jsxs("div",{className:"text-center py-12",children:[e.jsx("p",{className:"text-error text-sm mb-4",children:g??"Issue not found"}),e.jsx(c,{variant:"secondary",size:"sm",onClick:()=>i("/command-post/issues"),children:"Back to Issues"})]})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(h,{title:s.identifier,breadcrumbs:[{label:"Command Post"},{label:"Issues",href:"/command-post/issues"},{label:s.identifier}],actions:e.jsxs(L,{to:"/command-post/issues",className:"flex items-center gap-1 text-xs text-text-muted hover:text-text",children:[e.jsx(K,{size:14})," Back"]})}),v&&e.jsx("div",{className:"bg-bg-tertiary/30 border border-border rounded-lg px-4 py-3 mb-4",children:e.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap font-mono leading-relaxed",children:v})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-4",children:[A?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{className:"flex-1 rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-base font-semibold text-text focus:outline-none focus:border-accent",value:m,onChange:t=>u(t.target.value),onKeyDown:t=>t.key==="Enter"&&N(),autoFocus:!0}),e.jsx(c,{size:"sm",onClick:N,children:"Save"}),e.jsx(c,{size:"sm",variant:"ghost",onClick:()=>{x(!1),u(s.title)},children:"Cancel"})]}):e.jsx("h2",{className:"text-lg font-semibold text-text cursor-pointer hover:text-accent transition-colors",onClick:()=>x(!0),title:"Click to edit",children:s.title}),s.description&&e.jsx("p",{className:"mt-3 text-sm text-text-secondary whitespace-pre-wrap",children:s.description})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:q.map(t=>e.jsx("button",{onClick:()=>z(t),disabled:s.status===t,className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors border ${s.status===t?"border-accent bg-accent/10 text-accent":"border-border bg-bg-tertiary text-text-muted hover:text-text hover:border-border-light"}`,children:t.replace(/_/g," ")},t))}),e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[e.jsx(R,{size:14,className:"text-accent"}),e.jsx("h3",{className:"text-sm font-semibold text-text",children:"Comments"}),e.jsxs("span",{className:"text-xs text-text-muted",children:["(",l.length,")"]})]}),l.length===0?e.jsx("div",{className:"py-8 text-center text-xs text-text-muted",children:"No comments yet"}):e.jsx("div",{className:"divide-y divide-border max-h-96 overflow-y-auto",children:l.map(t=>e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-xs font-medium text-text",children:t.authorAgentId??t.authorUser??"Unknown"}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:[b(t.createdAt)," ago"]})]}),e.jsx("p",{className:"text-sm text-text-secondary whitespace-pre-wrap",children:t.body})]},t.id))}),e.jsxs("div",{className:"border-t border-border px-4 py-3 flex items-center gap-2",children:[e.jsx("input",{className:"flex-1 rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:"Add a comment...",value:n,onChange:t=>j(t.target.value),onKeyDown:t=>t.key==="Enter"&&!t.shiftKey&&w()}),e.jsx(c,{size:"sm",onClick:w,loading:E,disabled:!n.trim(),icon:e.jsx(_,{size:14}),children:"Send"})]})]})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Status"}),e.jsx("div",{className:"mt-1",children:e.jsx(O,{status:s.status})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Priority"}),e.jsx("div",{className:`mt-1 text-sm font-medium capitalize ${F[s.priority]??"text-text"}`,children:s.priority})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Assignee"}),e.jsx("div",{className:"mt-1 text-sm text-text-secondary",children:s.assigneeAgentId??"Unassigned"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Identifier"}),e.jsx("div",{className:"mt-1 text-sm text-text font-mono",children:s.identifier})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Created"}),e.jsxs("div",{className:"mt-1 text-sm text-text-secondary",children:[b(s.createdAt)," ago"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Updated"}),e.jsxs("div",{className:"mt-1 text-sm text-text-secondary",children:[b(s.updatedAt)," ago"]})]})]})})]})]})}export{se as default};
@@ -0,0 +1 @@
1
+ import{r as s,D as k,j as e,K as T,O as P}from"./index-Cml2x9pA.js";import{B as u}from"./Button-MdXmb4_n.js";import"./Input-CBTwa_Iw.js";import{S as D}from"./StatusBadge-BqlvIbdj.js";import{P as z}from"./PageHeader-DdrbS1aq.js";import{E}from"./EmptyState-D9kQf1PX.js";import{T as L}from"./Tabs-DdUThlp1.js";import{M}from"./Modal-ybPGvlQs.js";import{S as $}from"./SkeletonLoader-r6OGXaU9.js";import{P as A}from"./plus-Dpo1qfrl.js";import{L as B}from"./list-todo-BlgfQHup.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DbLSHmff.js";function R(a){const r=Math.floor((Date.now()-new Date(a).getTime())/1e3);return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}const _={critical:"text-error",high:"text-warning",medium:"text-accent",low:"text-text-muted"},O=[{id:"all",label:"All"},{id:"backlog",label:"Backlog"},{id:"todo",label:"Todo"},{id:"in_progress",label:"In Progress"},{id:"in_review",label:"In Review"},{id:"done",label:"Done"},{id:"blocked",label:"Blocked"}];function ee(){const[a,r]=s.useState([]),[c,w]=s.useState(!0),[l,m]=s.useState(null),[o,v]=s.useState("all"),[y,i]=s.useState(!1),[n,h]=s.useState(""),[p,b]=s.useState("medium"),[f,g]=s.useState(""),[C,j]=s.useState(!1),d=s.useCallback(async()=>{try{const t=await k();r(t),m(null)}catch(t){m(t instanceof Error?t.message:"Failed to load issues")}w(!1)},[]);s.useEffect(()=>{d()},[d]);const N=async()=>{if(n.trim()){j(!0);try{await P({title:n,description:f,priority:p}),i(!1),h(""),g(""),b("medium"),await d()}catch{}j(!1)}},x=o==="all"?a:a.filter(t=>t.status===o),S=O.map(t=>({...t,count:t.id==="all"?a.length:a.filter(I=>I.status===t.id).length}));return e.jsxs("div",{className:"space-y-4",children:[e.jsx(z,{title:"Issues",breadcrumbs:[{label:"Command Post"},{label:"Issues"}],actions:e.jsx(u,{size:"sm",icon:e.jsx(A,{size:14}),onClick:()=>i(!0),children:"New Issue"})}),e.jsx(L,{tabs:S,activeTab:o,onChange:v}),c&&e.jsx($,{variant:"row",count:6}),l&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:l}),!c&&!l&&x.length===0&&e.jsx(E,{icon:e.jsx(B,{size:32}),title:"No issues",description:o==="all"?"Create your first issue to get started.":`No ${o.replace(/_/g," ")} issues.`,action:{label:"New Issue",onClick:()=>i(!0)}}),!c&&!l&&x.length>0&&e.jsx("div",{className:"divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden",children:x.map(t=>e.jsxs(T,{to:`/command-post/issues/${t.id}`,className:"flex items-center gap-3 px-4 py-3 hover:bg-bg-tertiary/50 transition-colors",children:[e.jsx(D,{status:t.status,variant:"dot",size:"sm"}),e.jsx("span",{className:"text-sm text-text flex-1 truncate",children:t.title}),e.jsx("span",{className:`text-xs font-medium uppercase ${_[t.priority]??"text-text-muted"}`,children:t.priority}),t.assigneeAgentId&&e.jsx("span",{className:"text-xs text-text-muted truncate max-w-[100px]",children:t.assigneeAgentId}),e.jsx("span",{className:"text-xs text-text-muted font-mono",children:t.identifier}),e.jsx("span",{className:"text-xs text-text-muted flex-shrink-0",children:R(t.updatedAt)})]},t.id))}),e.jsx(M,{open:y,onClose:()=>i(!1),title:"New Issue",footer:e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"secondary",size:"sm",onClick:()=>i(!1),children:"Cancel"}),e.jsx(u,{size:"sm",onClick:N,loading:C,disabled:!n.trim(),children:"Create"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Title"}),e.jsx("input",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:"Issue title...",value:n,onChange:t=>h(t.target.value),autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Priority"}),e.jsxs("select",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text focus:outline-none focus:border-accent",value:p,onChange:t=>b(t.target.value),children:[e.jsx("option",{value:"low",children:"Low"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"critical",children:"Critical"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Description"}),e.jsx("textarea",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent min-h-[80px] resize-y",placeholder:"Describe the issue...",value:f,onChange:t=>g(t.target.value)})]})]})})]})}export{ee as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CommandPostHub-B_L1CAss.js","assets/index-Cml2x9pA.js","assets/index-yWybhcfI.css","assets/Button-MdXmb4_n.js","assets/clsx-B-dksMZM.js","assets/Input-CBTwa_Iw.js","assets/Modal-ybPGvlQs.js","assets/InlineEditableField-DgMrLDj1.js","assets/check-CuRYh4Zh.js","assets/pencil-BK5IU6o0.js","assets/ConfirmDialog-VErHWAbo.js","assets/Tooltip-C2tXJcrN.js","assets/approvalHeadline-DB9SgR-9.js","assets/chevron-right-DbLSHmff.js","assets/bot-DvEcyQcD.js","assets/pause-BT1Bc2q3.js","assets/dollar-sign-XxwPAA2a.js","assets/git-branch-C2qrhGGu.js","assets/chart-column-w3goFd5f.js","assets/clock-JyQAYy6X.js","assets/message-square-CRsG9u6_.js","assets/file-text-Cfawu8Bs.js","assets/terminal-DaBIlWEM.js","assets/refresh-cw-C-iZkzuS.js","assets/circle-stop-Bx2ohEg8.js","assets/send-DtXGsaFW.js","assets/plus-Dpo1qfrl.js","assets/trash-2-CTeyjxD_.js","assets/CPIssues-BzX6Rckx.js","assets/StatusBadge-BqlvIbdj.js","assets/PageHeader-DdrbS1aq.js","assets/EmptyState-D9kQf1PX.js","assets/Tabs-DdUThlp1.js","assets/SkeletonLoader-r6OGXaU9.js","assets/list-todo-BlgfQHup.js","assets/CPIssueDetail-NAGfmJg8.js","assets/arrow-left-WkVYLm80.js","assets/CPAgents-BSUKucTe.js","assets/CPAgentDetail-BYji6tT8.js","assets/circle-check-big-Bkba568b.js","assets/save-DwR9wQVu.js","assets/CPApprovals-B4v0em6e.js","assets/shield-check-CXlDJyAW.js","assets/CPActivity-B1Se9VVc.js","assets/CPGoals-8Z1yOY8e.js","assets/CPRuns-D-cpPw_M.js","assets/play-Cl1nC_gc.js","assets/CPCosts-9ikh61Kv.js","assets/CPOrg-B7DQ4UQP.js","assets/network-C9RXQGrV.js","assets/CPFiles-DB2nY5JE.js","assets/folder-DAdIw-Pb.js","assets/flask-conical-Ql8QxhgY.js","assets/search-D10l0m3-.js"])))=>i.map(i=>d[i]);
2
+ import{j as t,r as s,w as _,x as e,N as l,_ as o}from"./index-Cml2x9pA.js";const a=s.lazy(()=>o(()=>import("./CommandPostHub-B_L1CAss.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]))),i=s.lazy(()=>o(()=>import("./CPIssues-BzX6Rckx.js"),__vite__mapDeps([28,1,2,3,4,5,29,30,13,31,32,6,33,26,34]))),r=s.lazy(()=>o(()=>import("./CPIssueDetail-NAGfmJg8.js"),__vite__mapDeps([35,1,2,3,4,5,29,30,13,33,36,20,25]))),n=s.lazy(()=>o(()=>import("./CPAgents-BSUKucTe.js"),__vite__mapDeps([37,1,2,3,4,5,29,30,13,31,33]))),x=s.lazy(()=>o(()=>import("./CPAgentDetail-BYji6tT8.js"),__vite__mapDeps([38,1,2,3,4,5,29,30,13,31,32,33,36,39,16,19,40]))),m=s.lazy(()=>o(()=>import("./CPApprovals-B4v0em6e.js"),__vite__mapDeps([41,1,2,3,4,5,29,30,13,31,32,33,12,42,8]))),j=s.lazy(()=>o(()=>import("./CPActivity-B1Se9VVc.js"),__vite__mapDeps([43,1,2,3,4,5,30,13,31,32,33,42,16,14]))),p=s.lazy(()=>o(()=>import("./CPGoals-8Z1yOY8e.js"),__vite__mapDeps([44,1,2,3,4,5,29,30,13,31,6,33,26,27]))),u=s.lazy(()=>o(()=>import("./CPRuns-D-cpPw_M.js"),__vite__mapDeps([45,1,2,3,4,5,29,30,13,31,33,46]))),c=s.lazy(()=>o(()=>import("./CPCosts-9ikh61Kv.js"),__vite__mapDeps([47,1,2,3,4,5,29,30,13,31,6,33,26,16,27]))),d=s.lazy(()=>o(()=>import("./CPOrg-B7DQ4UQP.js"),__vite__mapDeps([48,1,2,3,4,5,29,30,13,31,33,10,6,49,27]))),P=s.lazy(()=>o(()=>import("./CPFiles-DB2nY5JE.js"),__vite__mapDeps([50,1,2,30,13,51,52,53,23,21])));function E(){return t.jsx("div",{className:"flex items-center justify-center h-full text-sm",style:{color:"#c4b49a"},children:"Loading..."})}function v(){return t.jsx("div",{className:"h-full overflow-hidden",children:t.jsx("div",{className:"h-full overflow-auto",children:t.jsx(s.Suspense,{fallback:t.jsx(E,{}),children:t.jsxs(_,{children:[t.jsx(e,{index:!0,element:t.jsx(a,{})}),t.jsx(e,{path:"dashboard",element:t.jsx(a,{})}),t.jsx(e,{path:"issues",element:t.jsx(i,{})}),t.jsx(e,{path:"issues/:id",element:t.jsx(r,{})}),t.jsx(e,{path:"agents",element:t.jsx(n,{})}),t.jsx(e,{path:"agents/:id",element:t.jsx(x,{})}),t.jsx(e,{path:"approvals",element:t.jsx(m,{})}),t.jsx(e,{path:"activity",element:t.jsx(j,{})}),t.jsx(e,{path:"goals",element:t.jsx(p,{})}),t.jsx(e,{path:"runs",element:t.jsx(u,{})}),t.jsx(e,{path:"costs",element:t.jsx(c,{})}),t.jsx(e,{path:"org",element:t.jsx(d,{})}),t.jsx(e,{path:"files",element:t.jsx(P,{})}),t.jsx(e,{path:"*",element:t.jsx(l,{to:"/command-post",replace:!0})})]})})})})}export{v as CPLayout,v as default};
@@ -0,0 +1 @@
1
+ import{t as j,r as o,a2 as y,a3 as v,j as e}from"./index-Cml2x9pA.js";import"./Button-MdXmb4_n.js";import"./Input-CBTwa_Iw.js";import{S as N}from"./StatusBadge-BqlvIbdj.js";import{P as C}from"./PageHeader-DdrbS1aq.js";import{E as w}from"./EmptyState-D9kQf1PX.js";import{S}from"./SkeletonLoader-r6OGXaU9.js";import{C as k}from"./ConfirmDialog-VErHWAbo.js";import{N as E}from"./network-C9RXQGrV.js";import{T as D}from"./trash-2-CTeyjxD_.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DbLSHmff.js";import"./Modal-ybPGvlQs.js";function O(t){const r=t.split("/");return r[r.length-1]}function u({node:t,depth:r,onDelete:i}){const a=t.role==="Company";return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start gap-3 py-2",style:{paddingLeft:`${r*32+16}px`},children:[r>0&&e.jsx("div",{className:"flex items-center gap-0 -ml-5",children:e.jsx("div",{className:"w-4 border-t border-border-light"})}),e.jsxs("div",{className:`border rounded-lg p-3 flex-1 max-w-sm transition-colors group ${a?"bg-accent/5 border-accent/20 hover:border-accent/40":"bg-bg-secondary border-border hover:border-border-light"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-text",children:t.name}),e.jsx(N,{status:t.status,size:"sm"})]}),a&&i&&e.jsx("button",{onClick:l=>{l.stopPropagation(),i(t.id,t.name)},className:"opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-error/20 text-text-muted hover:text-error transition-all",title:`Delete ${t.name}`,children:e.jsx(D,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted",children:[a&&e.jsx("span",{className:"text-accent text-[9px] font-medium uppercase tracking-wider",children:"Company"}),!a&&e.jsx("span",{className:"capitalize",children:t.role}),t.title&&e.jsx("span",{children:t.title}),t.model&&e.jsx("span",{children:O(t.model)})]}),a&&t.reports.length>0&&e.jsxs("div",{className:"text-[10px] text-text-muted mt-1",children:[t.reports.length," agent",t.reports.length!==1?"s":""]})]})]}),t.reports.length>0&&e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute border-l border-border-light",style:{left:`${(r+1)*32+16}px`,top:0,height:"100%"}}),t.reports.map(l=>e.jsx(u,{node:l,depth:r+1,onDelete:i},l.id))]})]})}function I(){const{toast:t}=j(),[r,i]=o.useState([]),[a,l]=o.useState(!0),[m,p]=o.useState(null),[h,g]=o.useState(null),[n,x]=o.useState(null),c=o.useCallback(async()=>{try{const s=await y();i(s),p(null)}catch(s){p(s instanceof Error?s.message:"Failed to load org chart")}l(!1)},[]);o.useEffect(()=>{c()},[c]);const b=o.useCallback(async()=>{if(!n)return;const{id:s}=n;x(null),g(s);try{await v(s),t("success","Company deleted."),await c()}catch(d){t("error",`Couldn't delete company — try again. ${d instanceof Error?d.message:"Unknown error"}`)}g(null)},[n,c,t]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(C,{title:"Organization Chart",breadcrumbs:[{label:"Command Post"},{label:"Org Chart"}]}),a&&e.jsx(S,{variant:"row",count:5}),m&&e.jsxs("div",{className:"rounded-xl border border-error/50 bg-bg-secondary p-6",children:[e.jsx("p",{className:"text-sm font-medium text-error",children:"Failed to load org chart"}),e.jsx("p",{className:"mt-2 text-sm text-text-secondary",children:m}),e.jsx("button",{onClick:c,className:"mt-4 rounded-lg bg-bg-tertiary px-4 py-2 text-sm text-text hover:bg-border transition-colors",children:"Retry"})]}),!a&&!m&&r.length===0&&e.jsx(w,{icon:e.jsx(E,{size:32}),title:"No org structure",description:"Register agents or create companies to see the org chart."}),!a&&!m&&r.length>0&&e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4 overflow-x-auto",children:[r.map(s=>e.jsx(u,{node:s,depth:0,onDelete:(d,f)=>x({id:d,name:f})},s.id)),h&&e.jsx("div",{className:"text-xs text-text-muted text-center py-2 animate-pulse",children:"Deleting..."})]}),e.jsx(k,{open:!!n,title:`Delete company "${(n==null?void 0:n.name)||""}"?`,message:"This stops the heartbeat runner and archives all of the company's agents, goals, and issues. This can't be undone.",confirmLabel:"Delete",onConfirm:b,onCancel:()=>x(null)})]})}export{I as default};
@@ -0,0 +1 @@
1
+ import{r as a,a0 as h,a1 as f,j as e}from"./index-Cml2x9pA.js";import"./Button-MdXmb4_n.js";import"./Input-CBTwa_Iw.js";import{S as j}from"./StatusBadge-BqlvIbdj.js";import{P as g}from"./PageHeader-DdrbS1aq.js";import{E as y}from"./EmptyState-D9kQf1PX.js";import{S as b}from"./SkeletonLoader-r6OGXaU9.js";import{P as N}from"./play-Cl1nC_gc.js";import"./clsx-B-dksMZM.js";import"./chevron-right-DbLSHmff.js";function v(s){const r=Math.floor((Date.now()-new Date(s).getTime())/1e3);return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}function S(s){return s?s<1e3?`${s}ms`:s<6e4?`${(s/1e3).toFixed(1)}s`:`${(s/6e4).toFixed(1)}m`:"-"}function U(){const[s,r]=a.useState([]),[x,m]=a.useState([]),[n,d]=a.useState(!0),[o,i]=a.useState(null),[l,u]=a.useState(""),c=a.useCallback(async()=>{try{const[t,p]=await Promise.all([h(l||void 0,100),f()]);r(t),m(p),i(null)}catch(t){i(t instanceof Error?t.message:"Failed to load runs")}d(!1)},[l]);return a.useEffect(()=>{d(!0),c()},[c]),e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{title:"Runs",breadcrumbs:[{label:"Command Post"},{label:"Runs"}],actions:e.jsxs("select",{className:"rounded-lg border border-border bg-bg-tertiary px-3 py-1.5 text-xs text-text focus:outline-none focus:border-accent",value:l,onChange:t=>u(t.target.value),children:[e.jsx("option",{value:"",children:"All agents"}),x.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]})}),n&&e.jsx(b,{variant:"row",count:8}),o&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:o}),!n&&!o&&s.length===0&&e.jsx(y,{icon:e.jsx(N,{size:32}),title:"No runs",description:"Agent runs will appear here as they execute."}),!n&&!o&&s.length>0&&e.jsx("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left",children:[e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Agent"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Source"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Duration"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Tools"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Started"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:s.map(t=>e.jsxs("tr",{className:"hover:bg-bg-tertiary/50 transition-colors",children:[e.jsx("td",{className:"px-4 py-2.5 text-text font-medium",children:t.agentId}),e.jsx("td",{className:"px-4 py-2.5 text-text-secondary capitalize",children:t.source}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(j,{status:t.status,size:"sm"})}),e.jsx("td",{className:"px-4 py-2.5 text-text-secondary font-mono",children:S(t.durationMs)}),e.jsx("td",{className:"px-4 py-2.5 text-text-muted",children:t.toolsUsed.length>0?e.jsxs("span",{title:t.toolsUsed.join(", "),children:[t.toolsUsed.length," tool",t.toolsUsed.length!==1?"s":""]}):"-"}),e.jsxs("td",{className:"px-4 py-2.5 text-text-muted",children:[v(t.startedAt)," ago"]})]},t.id))})]})})})]})}export{U as default};