titan-agent 6.1.0-beta.2 → 6.1.0-beta.21

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 (235) hide show
  1. package/LICENSE +1 -29
  2. package/README.md +1 -1
  3. package/dist/agent/agentLessons.js +2 -2
  4. package/dist/agent/agentLessons.js.map +1 -1
  5. package/dist/agent/autoModeClassifier.js +95 -0
  6. package/dist/agent/autoModeClassifier.js.map +1 -0
  7. package/dist/agent/durableJournal.js +2 -2
  8. package/dist/agent/durableJournal.js.map +1 -1
  9. package/dist/agent/goalDriver.js +67 -0
  10. package/dist/agent/goalDriver.js.map +1 -1
  11. package/dist/agent/goalPlanFile.js +3 -3
  12. package/dist/agent/goalPlanFile.js.map +1 -1
  13. package/dist/agent/missionLifecycle.js +2 -2
  14. package/dist/agent/missionLifecycle.js.map +1 -1
  15. package/dist/agent/subAgent.js +41 -0
  16. package/dist/agent/subAgent.js.map +1 -1
  17. package/dist/agent/toolContract.js +49 -0
  18. package/dist/agent/toolContract.js.map +1 -0
  19. package/dist/agent/toolRunner.js +72 -11
  20. package/dist/agent/toolRunner.js.map +1 -1
  21. package/dist/agent/trajectoryRecorder.js +185 -0
  22. package/dist/agent/trajectoryRecorder.js.map +1 -0
  23. package/dist/agent/verification.js +164 -0
  24. package/dist/agent/verification.js.map +1 -0
  25. package/dist/agent/worktreeExecutor.js +207 -0
  26. package/dist/agent/worktreeExecutor.js.map +1 -0
  27. package/dist/config/schema.js +28 -1
  28. package/dist/config/schema.js.map +1 -1
  29. package/dist/gateway/server.js +54 -0
  30. package/dist/gateway/server.js.map +1 -1
  31. package/dist/memory/facade.js +137 -0
  32. package/dist/memory/facade.js.map +1 -0
  33. package/dist/migrations/003-soma-profile-default.js +2 -2
  34. package/dist/migrations/003-soma-profile-default.js.map +1 -1
  35. package/dist/migrations/005-route-redirects.js +3 -1
  36. package/dist/migrations/005-route-redirects.js.map +1 -1
  37. package/dist/migrations/runner.js +2 -2
  38. package/dist/migrations/runner.js.map +1 -1
  39. package/dist/providers/defaultModel.js +14 -0
  40. package/dist/providers/defaultModel.js.map +1 -1
  41. package/dist/providers/router.js +4 -0
  42. package/dist/providers/router.js.map +1 -1
  43. package/dist/providers/stub.js +185 -0
  44. package/dist/providers/stub.js.map +1 -0
  45. package/dist/skills/builtin/backup.js +1 -2
  46. package/dist/skills/builtin/backup.js.map +1 -1
  47. package/dist/skills/builtin/contracts.js +254 -0
  48. package/dist/skills/builtin/contracts.js.map +1 -0
  49. package/dist/skills/builtin/download_image.js +9 -0
  50. package/dist/skills/builtin/download_image.js.map +1 -1
  51. package/dist/skills/builtin/filesystem.js +70 -20
  52. package/dist/skills/builtin/filesystem.js.map +1 -1
  53. package/dist/skills/registry.js +7 -0
  54. package/dist/skills/registry.js.map +1 -1
  55. package/dist/storage/patterns.js +2 -2
  56. package/dist/storage/patterns.js.map +1 -1
  57. package/dist/storage/personalGallery.js +2 -2
  58. package/dist/storage/personalGallery.js.map +1 -1
  59. package/dist/storage/somaProfile.js +2 -2
  60. package/dist/storage/somaProfile.js.map +1 -1
  61. package/dist/utils/constants.js +1 -1
  62. package/dist/utils/constants.js.map +1 -1
  63. package/package.json +2 -2
  64. package/ui/dist/assets/{AuditPanel-DrDvXZ9u.js → AuditPanel-RNrvKmfX.js} +1 -1
  65. package/ui/dist/assets/{AutonomyPanel-BfhW-PRX.js → AutonomyPanel-D0nmt79R.js} +2 -2
  66. package/ui/dist/assets/{AutopilotPanel-C3yQBxAp.js → AutopilotPanel-DlcdfRRy.js} +1 -1
  67. package/ui/dist/assets/{AutoresearchPanel-BgpR3EcK.js → AutoresearchPanel-CXeO6kGK.js} +2 -2
  68. package/ui/dist/assets/BackupPanel-CKb-cDsk.js +1 -0
  69. package/ui/dist/assets/{BrowserPanel-BNaKZOnn.js → BrowserPanel-CDaoF6n5.js} +1 -1
  70. package/ui/dist/assets/CPActivity-BZbeztg1.js +1 -0
  71. package/ui/dist/assets/CPAgentDetail-C9fvLxKi.js +1 -0
  72. package/ui/dist/assets/CPAgents-BsBA9kb2.js +1 -0
  73. package/ui/dist/assets/CPApprovals-Di5itVIK.js +1 -0
  74. package/ui/dist/assets/CPCosts-DmgckHli.js +1 -0
  75. package/ui/dist/assets/CPDashboard-CmSb7woK.js +1 -0
  76. package/ui/dist/assets/{CPFiles-CUpP5I82.js → CPFiles-Dd0NGcpX.js} +1 -1
  77. package/ui/dist/assets/CPGoals-DeILFq0A.js +1 -0
  78. package/ui/dist/assets/{CPInbox-DUW_hntB.js → CPInbox-DAtidZez.js} +2 -2
  79. package/ui/dist/assets/CPIssueDetail-BvwoGI57.js +1 -0
  80. package/ui/dist/assets/CPIssues-CZ1hIKDP.js +1 -0
  81. package/ui/dist/assets/{CPLayout-J0fa-it4.js → CPLayout-luPwhNpA.js} +3 -3
  82. package/ui/dist/assets/CPOrg-BlYp_KP6.js +8 -0
  83. package/ui/dist/assets/CPRuns-D0HMCjIo.js +1 -0
  84. package/ui/dist/assets/{CPSocial-By_FStZ4.js → CPSocial-CZaGi14s.js} +2 -2
  85. package/ui/dist/assets/ChannelsPanel-khiBHwx3.js +1 -0
  86. package/ui/dist/assets/{CheckpointsPanel-DvKUd2VF.js → CheckpointsPanel-n2y3jzzT.js} +1 -1
  87. package/ui/dist/assets/{CommandPostHub-CQqRYBjf.js → CommandPostHub-iWf-zt5p.js} +4 -4
  88. package/ui/dist/assets/{CronPanel-Brmnnu8_.js → CronPanel-BkRJl8u6.js} +1 -1
  89. package/ui/dist/assets/{DataTable-seaktPzB.js → DataTable-DZ2cG3Cv.js} +1 -1
  90. package/ui/dist/assets/{DreamPanel-CO7iSdjn.js → DreamPanel-DF6l0WB-.js} +1 -1
  91. package/ui/dist/assets/{EmptyState-CmK9fywh.js → EmptyState-D7xwm8hA.js} +1 -1
  92. package/ui/dist/assets/{EvalHarnessPanel-2RVBKbym.js → EvalHarnessPanel-BHabu49z.js} +2 -2
  93. package/ui/dist/assets/{EvalPanel-CqAwhFQ5.js → EvalPanel-yAesMLSP.js} +1 -1
  94. package/ui/dist/assets/{FileViewer-D98m-vF5.js → FileViewer-DOWUQccc.js} +52 -14
  95. package/ui/dist/assets/{FilesPanel-dRQM0apb.js → FilesPanel-BjuDhqaX.js} +2 -2
  96. package/ui/dist/assets/FleetPanel-B0ZhS2XX.js +1 -0
  97. package/ui/dist/assets/{HomelabPanel-DjMUrO2B.js → HomelabPanel-D373ddvj.js} +1 -1
  98. package/ui/dist/assets/InfraView-CI99NZbI.js +2 -0
  99. package/ui/dist/assets/InlineEditableField-fDk3eGVo.js +1 -0
  100. package/ui/dist/assets/Input-j10hONMY.js +1 -0
  101. package/ui/dist/assets/IntegrationsPanel-kPa5Qq-f.js +1 -0
  102. package/ui/dist/assets/IntelligenceView-DeKBaAlY.js +2 -0
  103. package/ui/dist/assets/LearningPanel-B8tqHeEZ.js +1 -0
  104. package/ui/dist/assets/{LogsPanel-Bs9IsTCH.js → LogsPanel-sXc__trb.js} +1 -1
  105. package/ui/dist/assets/McpPanel-DEr8pZwB.js +1 -0
  106. package/ui/dist/assets/{MemoryGraphPanel-F1P9COyY.js → MemoryGraphPanel-DZl7USJ6.js} +1 -1
  107. package/ui/dist/assets/MemoryWikiPanel-DTNVWvVT.js +11 -0
  108. package/ui/dist/assets/{MeshPanel-CgIAh5ZX.js → MeshPanel-b77zyQx4.js} +1 -1
  109. package/ui/dist/assets/MissionCanvas-D_quSl5F.js +69 -0
  110. package/ui/dist/assets/MissionChat-rQ5rUPAt.js +7 -0
  111. package/ui/dist/assets/MissionLibrary-Cxw7sLxv.js +5 -0
  112. package/ui/dist/assets/MissionStart-ChMWO1rr.js +1 -0
  113. package/ui/dist/assets/Modal-Dl5b6Yaj.js +1 -0
  114. package/ui/dist/assets/NvidiaPanel-D7qFbbeJ.js +1 -0
  115. package/ui/dist/assets/{OrganismPanel-CNZM3eof.js → OrganismPanel-EiQ9Gfqx.js} +1 -1
  116. package/ui/dist/assets/OverviewPanel-Bectj1Z5.js +1 -0
  117. package/ui/dist/assets/{PageHeader-llOXO43Z.js → PageHeader-CiuoyvDR.js} +1 -1
  118. package/ui/dist/assets/{PersonaProfilesPanel-CfsQTMra.js → PersonaProfilesPanel-BO87DSVG.js} +1 -1
  119. package/ui/dist/assets/{PersonasPanel-DIac_kZ3.js → PersonasPanel-BNogLwM0.js} +1 -1
  120. package/ui/dist/assets/RecipesPanel-DyqfWlaY.js +1 -0
  121. package/ui/dist/assets/{SecurityPanel-_gqMk8hJ.js → SecurityPanel-OMC-Tvbz.js} +1 -1
  122. package/ui/dist/assets/SelfImprovePanel-DXIfG_df.js +1 -0
  123. package/ui/dist/assets/{SelfProposalsPanel-DuA0zsGH.js → SelfProposalsPanel-CmgEz1TQ.js} +2 -2
  124. package/ui/dist/assets/SessionsPanel-gJXosEGf.js +1 -0
  125. package/ui/dist/assets/{SessionsTab-bFYaFvTZ.js → SessionsTab-BOVzzjTO.js} +1 -1
  126. package/ui/dist/assets/SettingsPanel-DifFGEvi.js +1 -0
  127. package/ui/dist/assets/SettingsView-BNpj0iym.js +2 -0
  128. package/ui/dist/assets/SkeletonLoader-CNSsfH3f.js +1 -0
  129. package/ui/dist/assets/{SkillsPanel-D08WcRGp.js → SkillsPanel-6fbRov-m.js} +1 -1
  130. package/ui/dist/assets/{SomaView-CYukE7Fp.js → SomaView-D3boPl5D.js} +1 -1
  131. package/ui/dist/assets/{StatCard-DT4Bx1mY.js → StatCard-2BmOlamJ.js} +1 -1
  132. package/ui/dist/assets/StatusBadge-CdVHF1nG.js +1 -0
  133. package/ui/dist/assets/Tabs-DW9ytf9H.js +1 -0
  134. package/ui/dist/assets/{TeamsPanel-DOBe72TK.js → TeamsPanel-CNaQ8Dbw.js} +1 -1
  135. package/ui/dist/assets/TelemetryPanel-DL81QlAW.js +1 -0
  136. package/ui/dist/assets/TitanCanvas-DLIN_wV3.js +1152 -0
  137. package/ui/dist/assets/ToolsView-BlChEE4n.js +2 -0
  138. package/ui/dist/assets/Tooltip-oR5JnwoN.js +6 -0
  139. package/ui/dist/assets/{TraceViewer-0bCz0x_a.js → TraceViewer-DtJXjCXV.js} +1 -1
  140. package/ui/dist/assets/TrainingPanel-4XMGaRN_.js +1 -0
  141. package/ui/dist/assets/{VoiceOverlay-B08Sw918.js → VoiceOverlay-B3fXJ-EC.js} +1 -1
  142. package/ui/dist/assets/{VramPanel-CJiic8y4.js → VramPanel-HisAYiqI.js} +1 -1
  143. package/ui/dist/assets/{WatchView-CaQMDEAy.js → WatchView-C92y0hU7.js} +1 -1
  144. package/ui/dist/assets/{WorkTab-D5bi2WRi.js → WorkTab-BYAWcvA1.js} +1 -1
  145. package/ui/dist/assets/{WorkflowsPanel-DdY6E93C.js → WorkflowsPanel-D2DiOBLA.js} +1 -1
  146. package/ui/dist/assets/{arrow-left-CHJyrO8S.js → arrow-left-thXQMJQ6.js} +1 -1
  147. package/ui/dist/assets/{briefcase-ROIEmiah.js → briefcase-ByMhDqlL.js} +1 -1
  148. package/ui/dist/assets/{chart-column-wFkjV3Ni.js → chart-column-CYHJVuxN.js} +1 -1
  149. package/ui/dist/assets/{check-BcOm5jPO.js → check-ChWLFWCx.js} +1 -1
  150. package/ui/dist/assets/{chevron-down-CM11GPpR.js → chevron-down-CU_O_5h3.js} +1 -1
  151. package/ui/dist/assets/{chevron-right-aFDDgFsL.js → chevron-right-DAiXsK24.js} +1 -1
  152. package/ui/dist/assets/{chevron-up-D6g7FB6i.js → chevron-up-BudRYwvy.js} +1 -1
  153. package/ui/dist/assets/{circle-check-big-DPz64kZW.js → circle-check-big-gkA-V2JW.js} +1 -1
  154. package/ui/dist/assets/{clock-BbCCaukN.js → clock-qO5kIED9.js} +1 -1
  155. package/ui/dist/assets/clsx-B-dksMZM.js +1 -0
  156. package/ui/dist/assets/{dollar-sign-Dy5-qkg3.js → dollar-sign-1gQNJK3V.js} +1 -1
  157. package/ui/dist/assets/{download-DjheLEns.js → download-DMD1m87c.js} +1 -1
  158. package/ui/dist/assets/{external-link-BgxGF7ZQ.js → external-link-ByafQkZ7.js} +1 -1
  159. package/ui/dist/assets/{folder-DY4eeMdo.js → folder-DeG4RuOD.js} +1 -1
  160. package/ui/dist/assets/{funnel-LWmcwhj-.js → funnel-wE8i5V9Y.js} +1 -1
  161. package/ui/dist/assets/{git-branch-CPZciK10.js → git-branch-BWSuK1LU.js} +1 -1
  162. package/ui/dist/assets/index-B8YEFBRH.js +277 -0
  163. package/ui/dist/assets/index-Cb5bSxRB.css +1 -0
  164. package/ui/dist/assets/{layers-Bn7bgu2Z.js → layers-tN-wIpE0.js} +1 -1
  165. package/ui/dist/assets/{legacy-BVPeht6t.js → legacy-BSZBdyop.js} +2 -2
  166. package/ui/dist/assets/{lightbulb-tzuCyEQk.js → lightbulb-TUHKCda3.js} +1 -1
  167. package/ui/dist/assets/{list-todo-say4NbSw.js → list-todo-DtxcUGz2.js} +1 -1
  168. package/ui/dist/assets/{missions-DbC8UmMc.js → missions-C3EC4uKT.js} +1 -1
  169. package/ui/dist/assets/{network-v9O7MmZT.js → network-ephW7nah.js} +1 -1
  170. package/ui/dist/assets/{pause-CZo33QlA.js → pause-DeggUVZc.js} +1 -1
  171. package/ui/dist/assets/{play-DbCJhc5H.js → play-Dfc0ia6v.js} +1 -1
  172. package/ui/dist/assets/{plug-CtpCZg2z.js → plug-Bl_6i_9u.js} +1 -1
  173. package/ui/dist/assets/{plus-O61rB_YF.js → plus-CQwCh7WY.js} +1 -1
  174. package/ui/dist/assets/{proxy-BAUTNyg6.js → proxy-BjQ4lsww.js} +1 -1
  175. package/ui/dist/assets/{rotate-ccw-n5WkWR51.js → rotate-ccw-CUuN2ebi.js} +1 -1
  176. package/ui/dist/assets/{save-D2Qh8KyN.js → save-PlTUvsN5.js} +1 -1
  177. package/ui/dist/assets/{search-C9SdcZJq.js → search-BHgLDT-j.js} +1 -1
  178. package/ui/dist/assets/{send-DZ_5M5QQ.js → send-pflQNBoT.js} +1 -1
  179. package/ui/dist/assets/{shield-check-DyP5PmaY.js → shield-check-CrD-s89i.js} +1 -1
  180. package/ui/dist/assets/{target-CWfn705s.js → target-D4oh8GME.js} +1 -1
  181. package/ui/dist/assets/{terminal-CdhfA0Kr.js → terminal-BvJZ1R3x.js} +1 -1
  182. package/ui/dist/assets/{toggle-right-CmYQLQRS.js → toggle-right-Dl7x_ed7.js} +1 -1
  183. package/ui/dist/assets/{trash-2-TQcEJEv4.js → trash-2-lPcFwnW5.js} +1 -1
  184. package/ui/dist/assets/{trending-up-Cw22bM4J.js → trending-up-DqUbZfDe.js} +1 -1
  185. package/ui/dist/assets/{trophy-DUF8Bcas.js → trophy-Dv6zFfKM.js} +1 -1
  186. package/ui/dist/assets/{users-BX_ZaByZ.js → users-NPyAWbs5.js} +1 -1
  187. package/ui/dist/assets/{wrench-Cfp7nYhG.js → wrench-BCKgeHj3.js} +1 -1
  188. package/ui/dist/index.html +2 -2
  189. package/ui/dist/sw.js +1 -1
  190. package/ui/dist/assets/BackupPanel-BNxMlNIP.js +0 -1
  191. package/ui/dist/assets/CPActivity-CjIgehOq.js +0 -1
  192. package/ui/dist/assets/CPAgentDetail-oaymYRNI.js +0 -1
  193. package/ui/dist/assets/CPAgents-CWQ6iJfO.js +0 -1
  194. package/ui/dist/assets/CPApprovals-DzATBhtM.js +0 -1
  195. package/ui/dist/assets/CPCosts-xVQR148_.js +0 -1
  196. package/ui/dist/assets/CPDashboard-Dt6Jr7Zw.js +0 -1
  197. package/ui/dist/assets/CPGoals-Bt1a3C9T.js +0 -1
  198. package/ui/dist/assets/CPIssueDetail-DHxqtiuh.js +0 -1
  199. package/ui/dist/assets/CPIssues-D0l3fgUs.js +0 -1
  200. package/ui/dist/assets/CPOrg-DQ3tbYld.js +0 -8
  201. package/ui/dist/assets/CPRuns-0vncicUW.js +0 -1
  202. package/ui/dist/assets/ChannelsPanel-CiJs4gyw.js +0 -1
  203. package/ui/dist/assets/FleetPanel-Bg-f3_ip.js +0 -1
  204. package/ui/dist/assets/InfraView-CHYaZqMK.js +0 -2
  205. package/ui/dist/assets/InlineEditableField-BOLRKQq1.js +0 -1
  206. package/ui/dist/assets/Input-4pNffAw-.js +0 -1
  207. package/ui/dist/assets/IntegrationsPanel-CFucvr-Q.js +0 -1
  208. package/ui/dist/assets/IntelligenceView-Dh-Wuf13.js +0 -2
  209. package/ui/dist/assets/LearningPanel-CtlougkF.js +0 -1
  210. package/ui/dist/assets/McpPanel-BobqpLsh.js +0 -1
  211. package/ui/dist/assets/MemoryWikiPanel-BfYksjoI.js +0 -11
  212. package/ui/dist/assets/MissionCanvas-0V_vtqiu.js +0 -50
  213. package/ui/dist/assets/MissionChat-9hGhc9Zw.js +0 -7
  214. package/ui/dist/assets/MissionLibrary-dFkT8pGp.js +0 -5
  215. package/ui/dist/assets/MissionStart-CZSEie0Q.js +0 -1
  216. package/ui/dist/assets/Modal-V2yNnkKk.js +0 -1
  217. package/ui/dist/assets/NvidiaPanel-qLJysI9M.js +0 -1
  218. package/ui/dist/assets/OverviewPanel-Be6LukJ_.js +0 -1
  219. package/ui/dist/assets/RecipesPanel-DDYOCx3w.js +0 -1
  220. package/ui/dist/assets/SelfImprovePanel-B8o_fO30.js +0 -1
  221. package/ui/dist/assets/SessionsPanel-DeCBkSgY.js +0 -1
  222. package/ui/dist/assets/SettingsPanel-BlsRDAt7.js +0 -1
  223. package/ui/dist/assets/SettingsView-Dsa7Zr4e.js +0 -2
  224. package/ui/dist/assets/SkeletonLoader-BkQoZllJ.js +0 -1
  225. package/ui/dist/assets/StatusBadge-BFEHCdgi.js +0 -1
  226. package/ui/dist/assets/Tabs-g2Gs9sK0.js +0 -1
  227. package/ui/dist/assets/TelemetryPanel-DXAGuV0R.js +0 -1
  228. package/ui/dist/assets/TitanCanvas-DCl3gxSl.js +0 -1072
  229. package/ui/dist/assets/ToolsView-CnUjq0Js.js +0 -2
  230. package/ui/dist/assets/Tooltip-DJ99YlFF.js +0 -6
  231. package/ui/dist/assets/TrainingPanel-BLf_KMaE.js +0 -1
  232. package/ui/dist/assets/eye-off-CYR4nH5I.js +0 -6
  233. package/ui/dist/assets/index-PwwKjgT3.css +0 -1
  234. package/ui/dist/assets/index-slWylU2o.js +0 -244
  235. package/ui/dist/assets/loader-circle-E8aLxmMz.js +0 -6
@@ -1,4 +1,4 @@
1
- import{c as E,r,as as me,at as pe,j as e,X as q,au as ue,av as he,aw as I,ax as ve,ay as fe}from"./index-slWylU2o.js";import{P as be}from"./plus-O61rB_YF.js";import{R as ge,P as U}from"./terminal-CdhfA0Kr.js";import{H as je,D as J,S as Ne}from"./TitanCanvas-DCl3gxSl.js";import{C as Z}from"./chevron-right-aFDDgFsL.js";import{A as ye}from"./arrow-left-CHJyrO8S.js";import{C as we}from"./clock-BbCCaukN.js";import{T as X}from"./trash-2-TQcEJEv4.js";import{S as ke}from"./save-D2Qh8KyN.js";import{D as Ce}from"./download-DjheLEns.js";import{C as G}from"./check-BcOm5jPO.js";import{F as Q}from"./users-BX_ZaByZ.js";import"./chevron-up-D6g7FB6i.js";import"./wrench-Cfp7nYhG.js";import"./network-v9O7MmZT.js";import"./rotate-ccw-n5WkWR51.js";import"./search-C9SdcZJq.js";import"./send-DZ_5M5QQ.js";import"./VoiceOverlay-B08Sw918.js";import"./chevron-down-CM11GPpR.js";import"./folder-DY4eeMdo.js";import"./shield-check-DyP5PmaY.js";import"./external-link-BgxGF7ZQ.js";import"./loader-circle-E8aLxmMz.js";/**
1
+ import{c as E,r,au as me,av as pe,j as e,X as q,aw as ue,ax as he,ay as I,az as ve,aA as fe}from"./index-B8YEFBRH.js";import{P as be}from"./plus-CQwCh7WY.js";import{R as ge,P as U}from"./terminal-BvJZ1R3x.js";import{H as je,D as J,S as Ne}from"./TitanCanvas-DLIN_wV3.js";import{C as Z}from"./chevron-right-DAiXsK24.js";import{A as ye}from"./arrow-left-thXQMJQ6.js";import{C as we}from"./clock-qO5kIED9.js";import{T as X}from"./trash-2-lPcFwnW5.js";import{S as ke}from"./save-PlTUvsN5.js";import{D as Ce}from"./download-DMD1m87c.js";import{C as G}from"./check-ChWLFWCx.js";import{F as Q}from"./users-NPyAWbs5.js";import"./chevron-up-BudRYwvy.js";import"./wrench-BCKgeHj3.js";import"./network-ephW7nah.js";import"./rotate-ccw-CUuN2ebi.js";import"./search-BHgLDT-j.js";import"./send-pflQNBoT.js";import"./VoiceOverlay-B3fXJ-EC.js";import"./chevron-down-CU_O_5h3.js";import"./folder-DeG4RuOD.js";import"./shield-check-CrD-s89i.js";import"./external-link-ByafQkZ7.js";/**
2
2
  * @license lucide-react v0.513.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -13,4 +13,4 @@ import{c as E,r,as as me,at as pe,j as e,X as q,au as ue,av as he,aw as I,ax as
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const Ee=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],De=E("folder-plus",Ee);function tt(){var O;const[w,Y]=r.useState([]),[n,D]=r.useState(""),[o,P]=r.useState(""),[R,ee]=r.useState([]),[a,d]=r.useState(null),[te,$]=r.useState(!0),[se,L]=r.useState(!1),[k,x]=r.useState(!1),[b,C]=r.useState(""),[W,B]=r.useState(!1),[ae,g]=r.useState(!1),[re,j]=r.useState(!1),[l,m]=r.useState(""),[p,N]=r.useState(null),[v,T]=r.useState(""),z=r.useRef(null),[u,f]=r.useState(null),[M,i]=r.useState("");r.useEffect(()=>{me().then(t=>{Y(t.roots),t.roots.length>0&&!n&&D(t.roots[0].path)}).catch(()=>{})},[]);const h=r.useCallback(async t=>{$(!0);try{const s=await pe(t??o,n||void 0);ee(s.entries)}catch{}$(!1)},[o,n]);r.useEffect(()=>{n&&h(o)},[o,n]);const y=t=>{P(t),d(null),x(!1)},ne=()=>{const t=o.split("/").filter(Boolean);t.pop(),y(t.join("/"))},oe=async t=>{if(t.type==="directory"){y(t.path);return}L(!0),x(!1);try{const s=await he(t.path,n||void 0);d(s)}catch{}L(!1)},ie=async()=>{if(a){B(!0),i("");try{await I(a.path,b,n||void 0),d({...a,content:b,size:new Blob([b]).size}),x(!1)}catch(t){i(t.message)}B(!1)}},A=async()=>{if(l.trim()){i("");try{const t=o?`${o}/${l.trim()}`:l.trim();await I(t,"",n||void 0),g(!1),m(""),h()}catch(t){i(t.message)}}},H=async()=>{if(l.trim()){i("");try{const t=o?`${o}/${l.trim()}`:l.trim();await ve(t,n||void 0),j(!1),m(""),h()}catch(t){i(t.message)}}},_=async t=>{if(!v.trim()||v===t.name){N(null);return}i("");try{const s=t.path.split("/").slice(0,-1).join("/"),c=s?`${s}/${v.trim()}`:v.trim();await ue(t.path,c,n||void 0),N(null),h()}catch(s){i(s.message)}},le=async()=>{if(u){i("");try{await fe(u.path,n||void 0),f(null),(a==null?void 0:a.path)===u.path&&d(null),h()}catch(t){i(t.message),f(null)}}};r.useEffect(()=>{p&&z.current&&z.current.focus()},[p]);const V=t=>t===0?"0 B":t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(1)} MB`,ce=t=>{if(!t)return"";try{const s=new Date(t),c=Date.now()-s.getTime();return c<36e5?`${Math.round(c/6e4)}m ago`:c<864e5?`${Math.round(c/36e5)}h ago`:c<6048e5?`${Math.round(c/864e5)}d ago`:s.toLocaleDateString()}catch{return""}},K=t=>t.endsWith(".json")||t.endsWith(".jsonl")?e.jsx(J,{size:14,className:"text-yellow-400"}):t.endsWith(".md")?e.jsx(Q,{size:14,className:"text-blue-400"}):t.endsWith(".db")?e.jsx(J,{size:14,className:"text-purple-400"}):t.endsWith(".log")?e.jsx(Q,{size:14,className:"text-[var(--text-muted)]"}):t==="titan.json"?e.jsx(Ne,{size:14,className:"text-[var(--accent)]"}):e.jsx(Fe,{size:14,className:"text-[var(--text-muted)]"}),de=t=>t.endsWith(".json")||t.endsWith(".jsonl")?"json":t.endsWith(".md")?"markdown":t.endsWith(".ts")||t.endsWith(".tsx")?"typescript":t.endsWith(".js")?"javascript":t.endsWith(".yaml")||t.endsWith(".yml")?"yaml":"text",F=o?o.split("/").filter(Boolean):[],xe=((O=w.find(t=>t.path===n))==null?void 0:O.label)||"~/.titan";return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(S,{className:"w-6 h-6 text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-[var(--text)]",children:"File Manager"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Browse, edit, and manage TITAN files"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{g(!0),m("")},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-[var(--border)] text-xs text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",title:"New File",children:[e.jsx(be,{size:12})," File"]}),e.jsxs("button",{onClick:()=>{j(!0),m("")},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-[var(--border)] text-xs text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",title:"New Folder",children:[e.jsx(De,{size:12})," Folder"]}),e.jsx("button",{onClick:()=>h(),className:"p-2 rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(ge,{size:14})})]})]}),M&&e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-red-500/10 border border-red-500/20 rounded-lg text-sm text-red-400",children:[e.jsx("span",{children:M}),e.jsx("button",{onClick:()=>i(""),children:e.jsx(q,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[w.length>1&&e.jsx("select",{value:n,onChange:t=>{D(t.target.value),P(""),d(null)},className:"px-2 py-1.5 rounded-md border border-[var(--border)] bg-[var(--bg-secondary)] text-[var(--text)] text-xs",children:w.map(t=>e.jsx("option",{value:t.path,children:t.label},t.path))}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg px-3 py-2 overflow-x-auto",children:[e.jsxs("button",{onClick:()=>y(""),className:"flex items-center gap-1 text-[var(--accent)] hover:underline flex-shrink-0",children:[e.jsx(je,{size:14})," ",xe]}),F.map((t,s)=>e.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(Z,{size:12,className:"text-[var(--text-muted)]"}),e.jsx("button",{onClick:()=>y(F.slice(0,s+1).join("/")),className:s===F.length-1?"text-[var(--text)] font-medium":"text-[var(--accent)] hover:underline",children:t})]},s))]})]}),e.jsxs("div",{className:"flex gap-4",style:{height:"calc(100vh - 280px)"},children:[e.jsxs("div",{className:`${a?"w-1/3":"w-full"} bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden flex flex-col transition-all`,children:[o&&e.jsxs("button",{onClick:ne,className:"flex items-center gap-2 px-4 py-2 text-sm text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] border-b border-[var(--border)] transition-colors",children:[e.jsx(ye,{size:14})," Back"]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:te?e.jsx("div",{className:"p-4 text-[var(--text-muted)] text-sm",children:"Loading..."}):R.length===0?e.jsxs("div",{className:"p-8 text-center text-[var(--text-muted)]",children:[e.jsx(S,{className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"Empty directory"})]}):R.map(t=>e.jsxs("div",{className:`group w-full flex items-center gap-3 px-4 py-2.5 text-left hover:bg-[var(--bg-tertiary)] border-b border-[var(--border)]/30 transition-colors cursor-pointer ${(a==null?void 0:a.path)===t.path?"bg-[var(--accent)]/10 border-l-2 border-l-[var(--accent)]":""}`,onClick:()=>p!==t.path&&oe(t),children:[t.type==="directory"?e.jsx(S,{size:14,className:"text-[var(--accent)] flex-shrink-0"}):K(t.name),e.jsx("div",{className:"flex-1 min-w-0",children:p===t.path?e.jsx("input",{ref:z,value:v,onChange:s=>T(s.target.value),onKeyDown:s=>{s.key==="Enter"&&_(t),s.key==="Escape"&&N(null)},onBlur:()=>_(t),className:"text-sm bg-[var(--bg-tertiary)] border border-[var(--accent)] rounded px-1.5 py-0.5 text-[var(--text)] w-full outline-none",onClick:s=>s.stopPropagation()}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`text-sm truncate ${t.type==="directory"?"text-[var(--accent)] font-medium":"text-[var(--text)]"}`,children:t.name}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-[var(--text-muted)]",children:[t.type==="file"&&e.jsx("span",{children:V(t.size)}),t.modified&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(we,{size:10})," ",ce(t.modified)]})]})]})}),p!==t.path&&e.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:[e.jsx("button",{onClick:s=>{s.stopPropagation(),N(t.path),T(t.name)},className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-secondary)]",title:"Rename",children:e.jsx(U,{size:12})}),e.jsx("button",{onClick:s=>{s.stopPropagation(),f(t)},className:"p-1 rounded text-[var(--text-muted)] hover:text-red-400 hover:bg-red-500/10",title:"Delete",children:e.jsx(X,{size:12})})]}),t.type==="directory"&&p!==t.path&&e.jsx(Z,{size:14,className:"text-[var(--text-muted)] flex-shrink-0"})]},t.path))})]}),a&&e.jsxs("div",{className:"flex-1 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-[var(--border)] bg-[var(--bg-tertiary)]",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[K(a.path),e.jsx("span",{className:"text-sm font-medium text-[var(--text)] truncate",children:a.path.split("/").pop()}),e.jsx("span",{className:"text-[10px] text-[var(--text-muted)] flex-shrink-0",children:V(a.size)}),a.truncated&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--warning)]/15 text-[var(--warning)] border border-[var(--warning)]/20 flex-shrink-0",children:"Truncated (1MB limit)"}),k&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--accent)]/15 text-[var(--accent)] border border-[var(--accent)]/20 flex-shrink-0",children:"Editing"})]}),e.jsx("div",{className:"flex gap-1.5",children:k?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:ie,disabled:W,className:"flex items-center gap-1 px-2 py-1 rounded text-xs bg-[var(--accent)] text-white hover:opacity-90 disabled:opacity-50",children:[e.jsx(ke,{size:12})," ",W?"Saving...":"Save"]}),e.jsxs("button",{onClick:()=>{x(!1),C("")},className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-secondary)]",children:[e.jsx(q,{size:12})," Cancel"]})]}):e.jsxs(e.Fragment,{children:[!a.truncated&&e.jsx("button",{onClick:()=>{x(!0),C(a.content)},className:"flex items-center gap-1 p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-secondary)] transition-colors",title:"Edit",children:e.jsx(U,{size:14})}),e.jsx("button",{onClick:()=>{const t=new Blob([a.content],{type:"text/plain"}),s=document.createElement("a");s.href=URL.createObjectURL(t),s.download=a.path.split("/").pop()||"file.txt",s.click()},className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-secondary)] transition-colors",title:"Download",children:e.jsx(Ce,{size:14})}),e.jsx("button",{onClick:()=>{d(null),x(!1)},className:"text-xs text-[var(--text-muted)] hover:text-[var(--text)] px-1",children:"Close"})]})})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:se?e.jsx("div",{className:"p-4 text-[var(--text-muted)] text-sm",children:"Loading file..."}):k?e.jsx("textarea",{value:b,onChange:t=>C(t.target.value),className:"w-full h-full p-4 text-xs font-mono text-[var(--text-secondary)] bg-transparent resize-none outline-none leading-relaxed",spellCheck:!1}):de(a.path)==="json"?e.jsx("pre",{className:"p-4 text-xs font-mono text-[var(--text-secondary)] whitespace-pre-wrap break-words leading-relaxed",children:(()=>{try{return JSON.stringify(JSON.parse(a.content),null,2)}catch{return a.content}})()}):e.jsx("pre",{className:"p-4 text-xs font-mono text-[var(--text-secondary)] whitespace-pre-wrap break-words leading-relaxed",children:a.content})})]})]}),ae&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>g(!1),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text)]",children:"New File"}),e.jsx("input",{autoFocus:!0,value:l,onChange:t=>m(t.target.value),onKeyDown:t=>t.key==="Enter"&&A(),placeholder:"filename.txt",className:"w-full px-3 py-2 rounded-md border border-[var(--border)] bg-[var(--bg-tertiary)] text-sm text-[var(--text)] outline-none focus:border-[var(--accent)]"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>g(!1),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:A,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--accent)] text-white rounded-md hover:opacity-90",children:[e.jsx(G,{size:12})," Create"]})]})]})}),re&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>j(!1),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text)]",children:"New Folder"}),e.jsx("input",{autoFocus:!0,value:l,onChange:t=>m(t.target.value),onKeyDown:t=>t.key==="Enter"&&H(),placeholder:"folder-name",className:"w-full px-3 py-2 rounded-md border border-[var(--border)] bg-[var(--bg-tertiary)] text-sm text-[var(--text)] outline-none focus:border-[var(--accent)]"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>j(!1),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:H,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--accent)] text-white rounded-md hover:opacity-90",children:[e.jsx(G,{size:12})," Create"]})]})]})}),u&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>f(null),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsxs("h3",{className:"text-sm font-semibold text-[var(--text)]",children:["Delete ",u.type==="directory"?"Folder":"File","?"]}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["Are you sure you want to delete ",e.jsx("span",{className:"font-mono text-[var(--text)]",children:u.name}),"? This cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>f(null),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:le,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-red-500 text-white rounded-md hover:opacity-90",children:[e.jsx(X,{size:12})," Delete"]})]})]})})]})}export{tt as default};
16
+ */const Ee=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],De=E("folder-plus",Ee);function et(){var O;const[w,Y]=r.useState([]),[n,D]=r.useState(""),[o,P]=r.useState(""),[R,ee]=r.useState([]),[s,d]=r.useState(null),[te,$]=r.useState(!0),[ae,L]=r.useState(!1),[k,x]=r.useState(!1),[b,C]=r.useState(""),[W,B]=r.useState(!1),[se,g]=r.useState(!1),[re,j]=r.useState(!1),[l,m]=r.useState(""),[p,N]=r.useState(null),[v,T]=r.useState(""),z=r.useRef(null),[u,f]=r.useState(null),[M,i]=r.useState("");r.useEffect(()=>{me().then(t=>{Y(t.roots),t.roots.length>0&&!n&&D(t.roots[0].path)}).catch(()=>{})},[]);const h=r.useCallback(async t=>{$(!0);try{const a=await pe(t??o,n||void 0);ee(a.entries)}catch{}$(!1)},[o,n]);r.useEffect(()=>{n&&h(o)},[o,n]);const y=t=>{P(t),d(null),x(!1)},ne=()=>{const t=o.split("/").filter(Boolean);t.pop(),y(t.join("/"))},oe=async t=>{if(t.type==="directory"){y(t.path);return}L(!0),x(!1);try{const a=await he(t.path,n||void 0);d(a)}catch{}L(!1)},ie=async()=>{if(s){B(!0),i("");try{await I(s.path,b,n||void 0),d({...s,content:b,size:new Blob([b]).size}),x(!1)}catch(t){i(t.message)}B(!1)}},A=async()=>{if(l.trim()){i("");try{const t=o?`${o}/${l.trim()}`:l.trim();await I(t,"",n||void 0),g(!1),m(""),h()}catch(t){i(t.message)}}},H=async()=>{if(l.trim()){i("");try{const t=o?`${o}/${l.trim()}`:l.trim();await ve(t,n||void 0),j(!1),m(""),h()}catch(t){i(t.message)}}},_=async t=>{if(!v.trim()||v===t.name){N(null);return}i("");try{const a=t.path.split("/").slice(0,-1).join("/"),c=a?`${a}/${v.trim()}`:v.trim();await ue(t.path,c,n||void 0),N(null),h()}catch(a){i(a.message)}},le=async()=>{if(u){i("");try{await fe(u.path,n||void 0),f(null),(s==null?void 0:s.path)===u.path&&d(null),h()}catch(t){i(t.message),f(null)}}};r.useEffect(()=>{p&&z.current&&z.current.focus()},[p]);const V=t=>t===0?"0 B":t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(1)} MB`,ce=t=>{if(!t)return"";try{const a=new Date(t),c=Date.now()-a.getTime();return c<36e5?`${Math.round(c/6e4)}m ago`:c<864e5?`${Math.round(c/36e5)}h ago`:c<6048e5?`${Math.round(c/864e5)}d ago`:a.toLocaleDateString()}catch{return""}},K=t=>t.endsWith(".json")||t.endsWith(".jsonl")?e.jsx(J,{size:14,className:"text-yellow-400"}):t.endsWith(".md")?e.jsx(Q,{size:14,className:"text-blue-400"}):t.endsWith(".db")?e.jsx(J,{size:14,className:"text-purple-400"}):t.endsWith(".log")?e.jsx(Q,{size:14,className:"text-[var(--text-muted)]"}):t==="titan.json"?e.jsx(Ne,{size:14,className:"text-[var(--accent)]"}):e.jsx(Fe,{size:14,className:"text-[var(--text-muted)]"}),de=t=>t.endsWith(".json")||t.endsWith(".jsonl")?"json":t.endsWith(".md")?"markdown":t.endsWith(".ts")||t.endsWith(".tsx")?"typescript":t.endsWith(".js")?"javascript":t.endsWith(".yaml")||t.endsWith(".yml")?"yaml":"text",F=o?o.split("/").filter(Boolean):[],xe=((O=w.find(t=>t.path===n))==null?void 0:O.label)||"~/.titan";return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(S,{className:"w-6 h-6 text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-[var(--text)]",children:"File Manager"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Browse, edit, and manage TITAN files"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{g(!0),m("")},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-[var(--border)] text-xs text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",title:"New File",children:[e.jsx(be,{size:12})," File"]}),e.jsxs("button",{onClick:()=>{j(!0),m("")},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-[var(--border)] text-xs text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",title:"New Folder",children:[e.jsx(De,{size:12})," Folder"]}),e.jsx("button",{onClick:()=>h(),className:"p-2 rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(ge,{size:14})})]})]}),M&&e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-red-500/10 border border-red-500/20 rounded-lg text-sm text-red-400",children:[e.jsx("span",{children:M}),e.jsx("button",{onClick:()=>i(""),children:e.jsx(q,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[w.length>1&&e.jsx("select",{value:n,onChange:t=>{D(t.target.value),P(""),d(null)},className:"px-2 py-1.5 rounded-md border border-[var(--border)] bg-[var(--bg-secondary)] text-[var(--text)] text-xs",children:w.map(t=>e.jsx("option",{value:t.path,children:t.label},t.path))}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg px-3 py-2 overflow-x-auto",children:[e.jsxs("button",{onClick:()=>y(""),className:"flex items-center gap-1 text-[var(--accent)] hover:underline flex-shrink-0",children:[e.jsx(je,{size:14})," ",xe]}),F.map((t,a)=>e.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(Z,{size:12,className:"text-[var(--text-muted)]"}),e.jsx("button",{onClick:()=>y(F.slice(0,a+1).join("/")),className:a===F.length-1?"text-[var(--text)] font-medium":"text-[var(--accent)] hover:underline",children:t})]},a))]})]}),e.jsxs("div",{className:"flex gap-4",style:{height:"calc(100vh - 280px)"},children:[e.jsxs("div",{className:`${s?"w-1/3":"w-full"} bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden flex flex-col transition-all`,children:[o&&e.jsxs("button",{onClick:ne,className:"flex items-center gap-2 px-4 py-2 text-sm text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] border-b border-[var(--border)] transition-colors",children:[e.jsx(ye,{size:14})," Back"]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:te?e.jsx("div",{className:"p-4 text-[var(--text-muted)] text-sm",children:"Loading..."}):R.length===0?e.jsxs("div",{className:"p-8 text-center text-[var(--text-muted)]",children:[e.jsx(S,{className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"Empty directory"})]}):R.map(t=>e.jsxs("div",{className:`group w-full flex items-center gap-3 px-4 py-2.5 text-left hover:bg-[var(--bg-tertiary)] border-b border-[var(--border)]/30 transition-colors cursor-pointer ${(s==null?void 0:s.path)===t.path?"bg-[var(--accent)]/10 border-l-2 border-l-[var(--accent)]":""}`,onClick:()=>p!==t.path&&oe(t),children:[t.type==="directory"?e.jsx(S,{size:14,className:"text-[var(--accent)] flex-shrink-0"}):K(t.name),e.jsx("div",{className:"flex-1 min-w-0",children:p===t.path?e.jsx("input",{ref:z,value:v,onChange:a=>T(a.target.value),onKeyDown:a=>{a.key==="Enter"&&_(t),a.key==="Escape"&&N(null)},onBlur:()=>_(t),className:"text-sm bg-[var(--bg-tertiary)] border border-[var(--accent)] rounded px-1.5 py-0.5 text-[var(--text)] w-full outline-none",onClick:a=>a.stopPropagation()}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`text-sm truncate ${t.type==="directory"?"text-[var(--accent)] font-medium":"text-[var(--text)]"}`,children:t.name}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-[var(--text-muted)]",children:[t.type==="file"&&e.jsx("span",{children:V(t.size)}),t.modified&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(we,{size:10})," ",ce(t.modified)]})]})]})}),p!==t.path&&e.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:[e.jsx("button",{onClick:a=>{a.stopPropagation(),N(t.path),T(t.name)},className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-secondary)]",title:"Rename",children:e.jsx(U,{size:12})}),e.jsx("button",{onClick:a=>{a.stopPropagation(),f(t)},className:"p-1 rounded text-[var(--text-muted)] hover:text-red-400 hover:bg-red-500/10",title:"Delete",children:e.jsx(X,{size:12})})]}),t.type==="directory"&&p!==t.path&&e.jsx(Z,{size:14,className:"text-[var(--text-muted)] flex-shrink-0"})]},t.path))})]}),s&&e.jsxs("div",{className:"flex-1 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-[var(--border)] bg-[var(--bg-tertiary)]",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[K(s.path),e.jsx("span",{className:"text-sm font-medium text-[var(--text)] truncate",children:s.path.split("/").pop()}),e.jsx("span",{className:"text-[10px] text-[var(--text-muted)] flex-shrink-0",children:V(s.size)}),s.truncated&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--warning)]/15 text-[var(--warning)] border border-[var(--warning)]/20 flex-shrink-0",children:"Truncated (1MB limit)"}),k&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--accent)]/15 text-[var(--accent)] border border-[var(--accent)]/20 flex-shrink-0",children:"Editing"})]}),e.jsx("div",{className:"flex gap-1.5",children:k?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:ie,disabled:W,className:"flex items-center gap-1 px-2 py-1 rounded text-xs bg-[var(--accent)] text-white hover:opacity-90 disabled:opacity-50",children:[e.jsx(ke,{size:12})," ",W?"Saving...":"Save"]}),e.jsxs("button",{onClick:()=>{x(!1),C("")},className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-secondary)]",children:[e.jsx(q,{size:12})," Cancel"]})]}):e.jsxs(e.Fragment,{children:[!s.truncated&&e.jsx("button",{onClick:()=>{x(!0),C(s.content)},className:"flex items-center gap-1 p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-secondary)] transition-colors",title:"Edit",children:e.jsx(U,{size:14})}),e.jsx("button",{onClick:()=>{const t=new Blob([s.content],{type:"text/plain"}),a=document.createElement("a");a.href=URL.createObjectURL(t),a.download=s.path.split("/").pop()||"file.txt",a.click()},className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-secondary)] transition-colors",title:"Download",children:e.jsx(Ce,{size:14})}),e.jsx("button",{onClick:()=>{d(null),x(!1)},className:"text-xs text-[var(--text-muted)] hover:text-[var(--text)] px-1",children:"Close"})]})})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:ae?e.jsx("div",{className:"p-4 text-[var(--text-muted)] text-sm",children:"Loading file..."}):k?e.jsx("textarea",{value:b,onChange:t=>C(t.target.value),className:"w-full h-full p-4 text-xs font-mono text-[var(--text-secondary)] bg-transparent resize-none outline-none leading-relaxed",spellCheck:!1}):de(s.path)==="json"?e.jsx("pre",{className:"p-4 text-xs font-mono text-[var(--text-secondary)] whitespace-pre-wrap break-words leading-relaxed",children:(()=>{try{return JSON.stringify(JSON.parse(s.content),null,2)}catch{return s.content}})()}):e.jsx("pre",{className:"p-4 text-xs font-mono text-[var(--text-secondary)] whitespace-pre-wrap break-words leading-relaxed",children:s.content})})]})]}),se&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>g(!1),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text)]",children:"New File"}),e.jsx("input",{autoFocus:!0,value:l,onChange:t=>m(t.target.value),onKeyDown:t=>t.key==="Enter"&&A(),placeholder:"filename.txt",className:"w-full px-3 py-2 rounded-md border border-[var(--border)] bg-[var(--bg-tertiary)] text-sm text-[var(--text)] outline-none focus:border-[var(--accent)]"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>g(!1),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:A,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--accent)] text-white rounded-md hover:opacity-90",children:[e.jsx(G,{size:12})," Create"]})]})]})}),re&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>j(!1),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text)]",children:"New Folder"}),e.jsx("input",{autoFocus:!0,value:l,onChange:t=>m(t.target.value),onKeyDown:t=>t.key==="Enter"&&H(),placeholder:"folder-name",className:"w-full px-3 py-2 rounded-md border border-[var(--border)] bg-[var(--bg-tertiary)] text-sm text-[var(--text)] outline-none focus:border-[var(--accent)]"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>j(!1),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:H,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--accent)] text-white rounded-md hover:opacity-90",children:[e.jsx(G,{size:12})," Create"]})]})]})}),u&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>f(null),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsxs("h3",{className:"text-sm font-semibold text-[var(--text)]",children:["Delete ",u.type==="directory"?"Folder":"File","?"]}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["Are you sure you want to delete ",e.jsx("span",{className:"font-mono text-[var(--text)]",children:u.name}),"? This cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>f(null),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:le,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-red-500 text-white rounded-md hover:opacity-90",children:[e.jsx(X,{size:12})," Delete"]})]})]})})]})}export{et as default};
@@ -0,0 +1 @@
1
+ import{r as s,bk as l,j as e}from"./index-B8YEFBRH.js";import{P as d}from"./PageHeader-CiuoyvDR.js";import{R as c}from"./terminal-BvJZ1R3x.js";import{R as p}from"./TitanCanvas-DLIN_wV3.js";import"./chevron-right-DAiXsK24.js";import"./chevron-up-BudRYwvy.js";import"./plus-CQwCh7WY.js";import"./users-NPyAWbs5.js";import"./wrench-BCKgeHj3.js";import"./network-ephW7nah.js";import"./save-PlTUvsN5.js";import"./rotate-ccw-CUuN2ebi.js";import"./search-BHgLDT-j.js";import"./send-pflQNBoT.js";import"./VoiceOverlay-B3fXJ-EC.js";import"./chevron-down-CU_O_5h3.js";import"./folder-DeG4RuOD.js";import"./clock-qO5kIED9.js";import"./check-ChWLFWCx.js";import"./shield-check-CrD-s89i.js";import"./external-link-ByafQkZ7.js";function H(){const[o,m]=s.useState([]),[r,i]=s.useState(!0),a=s.useCallback(async()=>{i(!0);try{const t=await l();m(t.nodes||[])}catch{}i(!1)},[]);return s.useEffect(()=>{a()},[a]),e.jsxs("div",{className:"space-y-4",children:[e.jsx(d,{title:"Fleet Router",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Mesh"},{label:"Fleet"}]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:a,disabled:r,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(c,{className:`w-4 h-4 ${r?"animate-spin":""}`})," Refresh"]})}),e.jsx("div",{className:"space-y-2",children:o.map(t=>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(p,{className:`w-4 h-4 ${t.status==="online"?"text-emerald-400":t.status==="busy"?"text-amber-400":"text-red-400"}`}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-[#e4e4e7]",children:t.name}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[t.address," • ",t.capabilities.join(", ")]})]})]}),e.jsx("div",{className:"text-xs text-[#52525b]",children:t.status})]},t.id))})]})}export{H as default};
@@ -1,4 +1,4 @@
1
- import{c as ee,r as o,b as m,j as e,Z as I,C as se,H as te,A as w,W as ae,k as ne,T as re}from"./index-slWylU2o.js";import{P as B}from"./PageHeader-llOXO43Z.js";import{S as h}from"./StatCard-DT4Bx1mY.js";import{S as le}from"./SkeletonLoader-BkQoZllJ.js";import{R as ie}from"./terminal-CdhfA0Kr.js";import{C as ce}from"./clock-BbCCaukN.js";import{M as oe,U as de}from"./users-BX_ZaByZ.js";import{b as xe,W as me}from"./TitanCanvas-DCl3gxSl.js";import{C as he}from"./chart-column-wFkjV3Ni.js";import{N as D}from"./network-v9O7MmZT.js";import{C as A}from"./circle-check-big-DPz64kZW.js";import{D as pe}from"./dollar-sign-Dy5-qkg3.js";import"./chevron-right-aFDDgFsL.js";import"./chevron-up-D6g7FB6i.js";import"./plus-O61rB_YF.js";import"./wrench-Cfp7nYhG.js";import"./save-D2Qh8KyN.js";import"./rotate-ccw-n5WkWR51.js";import"./search-C9SdcZJq.js";import"./send-DZ_5M5QQ.js";import"./VoiceOverlay-B08Sw918.js";import"./chevron-down-CM11GPpR.js";import"./folder-DY4eeMdo.js";import"./check-BcOm5jPO.js";import"./shield-check-DyP5PmaY.js";import"./external-link-BgxGF7ZQ.js";import"./loader-circle-E8aLxmMz.js";/**
1
+ import{c as ee,r as o,b as m,j as e,Z as I,C as se,H as te,A as w,W as ae,k as ne,T as re}from"./index-B8YEFBRH.js";import{P as B}from"./PageHeader-CiuoyvDR.js";import{S as h}from"./StatCard-2BmOlamJ.js";import{S as le}from"./SkeletonLoader-CNSsfH3f.js";import{R as ie}from"./terminal-BvJZ1R3x.js";import{C as ce}from"./clock-qO5kIED9.js";import{M as oe,U as de}from"./users-NPyAWbs5.js";import{b as xe,W as me}from"./TitanCanvas-DLIN_wV3.js";import{C as he}from"./chart-column-CYHJVuxN.js";import{N as D}from"./network-ephW7nah.js";import{C as A}from"./circle-check-big-gkA-V2JW.js";import{D as pe}from"./dollar-sign-1gQNJK3V.js";import"./chevron-right-DAiXsK24.js";import"./clsx-B-dksMZM.js";import"./chevron-up-BudRYwvy.js";import"./plus-CQwCh7WY.js";import"./wrench-BCKgeHj3.js";import"./save-PlTUvsN5.js";import"./rotate-ccw-CUuN2ebi.js";import"./search-BHgLDT-j.js";import"./send-pflQNBoT.js";import"./VoiceOverlay-B3fXJ-EC.js";import"./chevron-down-CU_O_5h3.js";import"./folder-DeG4RuOD.js";import"./check-ChWLFWCx.js";import"./shield-check-CrD-s89i.js";import"./external-link-ByafQkZ7.js";/**
2
2
  * @license lucide-react v0.513.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomelabPanel-D373ddvj.js","assets/index-B8YEFBRH.js","assets/index-Cb5bSxRB.css","assets/PageHeader-CiuoyvDR.js","assets/chevron-right-DAiXsK24.js","assets/StatCard-2BmOlamJ.js","assets/SkeletonLoader-CNSsfH3f.js","assets/clsx-B-dksMZM.js","assets/terminal-BvJZ1R3x.js","assets/clock-qO5kIED9.js","assets/users-NPyAWbs5.js","assets/TitanCanvas-DLIN_wV3.js","assets/chevron-up-BudRYwvy.js","assets/plus-CQwCh7WY.js","assets/wrench-BCKgeHj3.js","assets/network-ephW7nah.js","assets/save-PlTUvsN5.js","assets/rotate-ccw-CUuN2ebi.js","assets/search-BHgLDT-j.js","assets/send-pflQNBoT.js","assets/VoiceOverlay-B3fXJ-EC.js","assets/chevron-down-CU_O_5h3.js","assets/folder-DeG4RuOD.js","assets/check-ChWLFWCx.js","assets/shield-check-CrD-s89i.js","assets/external-link-ByafQkZ7.js","assets/TitanCanvas-BfitWg9R.css","assets/chart-column-CYHJVuxN.js","assets/circle-check-big-gkA-V2JW.js","assets/dollar-sign-1gQNJK3V.js","assets/NvidiaPanel-D7qFbbeJ.js","assets/FilesPanel-BjuDhqaX.js","assets/arrow-left-thXQMJQ6.js","assets/trash-2-lPcFwnW5.js","assets/download-DMD1m87c.js","assets/LogsPanel-sXc__trb.js","assets/TelemetryPanel-DL81QlAW.js","assets/git-branch-BWSuK1LU.js"])))=>i.map(i=>d[i]);
2
+ import{r as t,j as e,_ as a}from"./index-B8YEFBRH.js";import{c as i}from"./clsx-B-dksMZM.js";const r=t.lazy(()=>a(()=>import("./HomelabPanel-D373ddvj.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]))),d=t.lazy(()=>a(()=>import("./NvidiaPanel-D7qFbbeJ.js"),__vite__mapDeps([30,1,2,8,16,28,25,18]))),n=t.lazy(()=>a(()=>import("./FilesPanel-BjuDhqaX.js"),__vite__mapDeps([31,1,2,13,8,11,12,10,14,15,16,17,18,19,20,4,21,22,9,23,24,25,26,32,33,34]))),c=t.lazy(()=>a(()=>import("./LogsPanel-sXc__trb.js"),__vite__mapDeps([35,1,2,8]))),m=t.lazy(()=>a(()=>import("./TelemetryPanel-DL81QlAW.js"),__vite__mapDeps([36,1,2,5,9,37,27,11,12,13,10,14,15,8,16,17,18,19,20,4,21,22,23,24,25,26]))),x=[{id:"homelab",label:"Homelab"},{id:"gpu",label:"GPU / NVIDIA"},{id:"files",label:"Files"},{id:"logs",label:"Logs"},{id:"telemetry",label:"Telemetry"}];function p(){const[l,o]=t.useState("homelab");return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"shrink-0 px-5 pt-4 pb-0",children:[e.jsx("h1",{className:"text-sm font-semibold text-text mb-3",children:"Infrastructure"}),e.jsx("div",{className:"flex items-center gap-0.5 border-b border-border/50",children:x.map(s=>e.jsxs("button",{onClick:()=>o(s.id),className:i("px-3 py-2 text-xs font-medium transition-colors relative",l===s.id?"text-accent":"text-text-muted hover:text-text-secondary"),children:[s.label,l===s.id&&e.jsx("div",{className:"absolute bottom-0 left-1 right-1 h-[2px] bg-accent rounded-full"})]},s.id))})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-5",children:e.jsxs(t.Suspense,{fallback:e.jsx("div",{className:"skeleton-shimmer h-40 rounded-lg"}),children:[l==="homelab"&&e.jsx(r,{}),l==="gpu"&&e.jsx(d,{}),l==="files"&&e.jsx(n,{}),l==="logs"&&e.jsx(c,{}),l==="telemetry"&&e.jsx(m,{})]})})]})}export{p as default};
@@ -0,0 +1 @@
1
+ import{r,j as t,X as N}from"./index-B8YEFBRH.js";import{c as g}from"./clsx-B-dksMZM.js";import{C as w}from"./check-ChWLFWCx.js";import{P as S}from"./terminal-BvJZ1R3x.js";function P({value:s,onSave:h,placeholder:p,multiline:a=!1,className:k,displayValue:E,emptyLabel:j="—",hidePencil:C=!1,maxLength:x,title:v}){const[i,o]=r.useState(!1),[c,l]=r.useState(s),[f,y]=r.useState(!1),n=r.useRef(null);r.useEffect(()=>{i&&n.current&&(n.current.focus(),"select"in n.current&&n.current.select())},[i]),r.useEffect(()=>{i||l(s)},[s,i]);const u=async()=>{if(c===s){o(!1);return}y(!0);try{await h(c),o(!1)}catch{}finally{y(!1)}},m=()=>{l(s),o(!1)},b=e=>{e.key==="Enter"&&!a||e.key==="Enter"&&a&&e.metaKey?(e.preventDefault(),u()):e.key==="Escape"&&(e.preventDefault(),m())};if(i){const e=g("bg-bg-tertiary border border-accent/60 rounded px-2 py-1 text-sm text-text","focus:outline-none focus:border-accent","w-full",a&&"resize-none min-h-[60px]");return t.jsxs("span",{className:"inline-flex items-start gap-1 w-full",children:[a?t.jsx("textarea",{ref:n,value:c,onChange:d=>l(d.target.value),onKeyDown:b,placeholder:p,maxLength:x,className:e,disabled:f}):t.jsx("input",{ref:n,type:"text",value:c,onChange:d=>l(d.target.value),onKeyDown:b,placeholder:p,maxLength:x,className:e,disabled:f}),t.jsx("button",{onClick:u,disabled:f,className:"text-success hover:bg-success/10 rounded p-1 shrink-0",title:a?"Save (Cmd+Enter)":"Save (Enter)",type:"button",children:t.jsx(w,{size:14})}),t.jsx("button",{onClick:m,disabled:f,className:"text-text-muted hover:bg-bg-tertiary rounded p-1 shrink-0",title:"Cancel (Esc)",type:"button",children:t.jsx(N,{size:14})})]})}const D=E??(s&&s.length>0?s:j);return t.jsxs("span",{className:g("inline-flex items-center gap-1 cursor-pointer group","hover:bg-bg-tertiary rounded px-1 -mx-1",k),onClick:()=>o(!0),title:v??"Click to edit",role:"button",tabIndex:0,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),o(!0))},children:[t.jsx("span",{children:D}),!C&&t.jsx(S,{size:10,className:"text-text-muted opacity-0 group-hover:opacity-60 transition-opacity shrink-0"})]})}export{P as I};
@@ -0,0 +1 @@
1
+ import{r as n,j as e,L as b}from"./index-B8YEFBRH.js";import{c as d}from"./clsx-B-dksMZM.js";const m={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"},p={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"},g=n.forwardRef(({variant:r="primary",size:t="md",icon:o,loading:s,disabled:a,children:i,className:l,...c},x)=>e.jsxs("button",{ref:x,disabled:a||s,className:d("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",m[r],p[t],l),...c,children:[s?e.jsx(b,{size:t==="sm"?14:16,className:"animate-spin"}):o,i]}));g.displayName="Button";const u=n.forwardRef(({icon:r,error:t,className:o,...s},a)=>e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"relative",children:[r&&e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-muted pointer-events-none",children:r}),e.jsx("input",{ref:a,className:d("w-full rounded-lg border bg-bg py-2 text-sm text-text outline-none transition-colors","placeholder:text-text-muted",r?"pl-10 pr-3":"px-3",t?"border-error focus:border-error":"border-border focus:border-accent",o),...s})]}),t&&e.jsx("p",{className:"mt-1 text-xs text-error",children:t})]}));u.displayName="Input";export{g as B};
@@ -0,0 +1 @@
1
+ import{r as l,j as e,h as F,at as T,E as I,a9 as S,b as C,ah as K}from"./index-B8YEFBRH.js";import{P as A}from"./plug-Bl_6i_9u.js";import{C as U}from"./circle-check-big-gkA-V2JW.js";import{S as O}from"./save-PlTUvsN5.js";import{C as R}from"./chevron-down-CU_O_5h3.js";import{C as q}from"./chevron-right-DAiXsK24.js";const k=[{id:"anthropic",label:"Anthropic",fieldKey:"anthropicKey",fieldType:"key",placeholder:"sk-ant-..."},{id:"openai",label:"OpenAI",fieldKey:"openaiKey",fieldType:"key",placeholder:"sk-..."},{id:"google",label:"Google AI",fieldKey:"googleKey",fieldType:"key",placeholder:"AIza..."},{id:"groq",label:"Groq",fieldKey:"groqKey",fieldType:"key",placeholder:"gsk_..."},{id:"mistral",label:"Mistral",fieldKey:"mistralKey",fieldType:"key",placeholder:"API key"},{id:"openrouter",label:"OpenRouter",fieldKey:"openrouterKey",fieldType:"key",placeholder:"sk-or-..."},{id:"fireworks",label:"Fireworks AI",fieldKey:"fireworksKey",fieldType:"key",placeholder:"API key"},{id:"xai",label:"xAI (Grok)",fieldKey:"xaiKey",fieldType:"key",placeholder:"xai-..."},{id:"together",label:"Together AI",fieldKey:"togetherKey",fieldType:"key",placeholder:"API key"},{id:"deepseek",label:"DeepSeek",fieldKey:"deepseekKey",fieldType:"key",placeholder:"sk-..."},{id:"perplexity",label:"Perplexity",fieldKey:"perplexityKey",fieldType:"key",placeholder:"pplx-..."},{id:"ollama",label:"Ollama",fieldKey:"ollamaUrl",fieldType:"url",placeholder:"http://localhost:11434"}];function P({configured:a}){return e.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${a?"bg-success/10 text-success":"bg-border-light/20 text-text-muted"}`,children:[e.jsx("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${a?"bg-success":"bg-border-light"}`}),a?"Configured":"Not configured"]})}function M({provider:a,configured:b,currentUrl:o,onSave:p,saving:v}){const[f,y]=l.useState(!1),[c,d]=l.useState(a.fieldType==="url"&&o||""),[x,u]=l.useState(!1),h=a.fieldType==="key",i=v===a.id;return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary",children:[e.jsxs("button",{onClick:()=>y(!f),className:"flex w-full items-center justify-between px-4 py-3 text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[f?e.jsx(R,{className:"h-4 w-4 text-text-muted"}):e.jsx(q,{className:"h-4 w-4 text-text-muted"}),e.jsx("span",{className:"text-sm font-medium text-text",children:a.label})]}),e.jsx(P,{configured:b})]}),f&&e.jsxs("div",{className:"border-t border-bg-tertiary px-4 py-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:h?"API Key":"Base URL"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:`integration-${a.id}`,name:`integration-${a.id}`,type:h&&!x?"password":"text",value:c,onChange:j=>d(j.target.value),placeholder:a.placeholder,className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-accent"}),h&&e.jsx("button",{type:"button",onClick:()=>u(!x),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:x?e.jsx(T,{className:"h-4 w-4"}):e.jsx(I,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:()=>p(a.fieldKey,c),disabled:i||!c,className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50",children:[e.jsx(O,{className:"h-3.5 w-3.5"}),i?"Saving...":"Save"]})})]})]})}function Q(){const[a,b]=l.useState({}),[o,p]=l.useState({clientIdSet:!1,clientSecretSet:!1}),[v,f]=l.useState(!0),[y,c]=l.useState(null),[d,x]=l.useState(null),[u,h]=l.useState(""),[i,j]=l.useState(""),[N,G]=l.useState(!1);l.useEffect(()=>{(async()=>{var t;try{const n=await S();if(n.providers&&b(n.providers),(t=n.oauth)!=null&&t.google){const g=n.oauth.google;try{const r=await(await C("/api/auth/google/status")).json();g.connected=r.connected,g.email=r.email}catch{}p(g)}}catch{}finally{f(!1)}})()},[]);const E=()=>{window.location.href="/api/auth/google/start"},D=async()=>{try{await C("/api/auth/google/disconnect",{method:"POST"}),p(s=>({...s,connected:!1,email:void 0})),m("success","Google account disconnected")}catch{m("error","Failed to disconnect")}},m=(s,t)=>{x({type:s,message:t}),setTimeout(()=>x(null),3e3)},$=async(s,t)=>{var g,w;const n=((g=k.find(r=>r.fieldKey===s))==null?void 0:g.id)||s;c(n);try{await K({[s]:t});const r=await S();r.providers&&b(r.providers),m("success",`${((w=k.find(B=>B.fieldKey===s))==null?void 0:w.label)||"Provider"} saved`)}catch(r){m("error",r instanceof Error?r.message:"Failed to save")}finally{c(null)}},L=async()=>{var s;c("oauth");try{const t={};u&&(t.googleOAuthClientId=u),i&&(t.googleOAuthClientSecret=i),await K(t);const n=await S();(s=n.oauth)!=null&&s.google&&p(n.oauth.google),m("success","Google OAuth settings saved"),h(""),j("")}catch(t){m("error",t instanceof Error?t.message:"Failed to save")}finally{c(null)}};return v?e.jsx("div",{className:"space-y-4",children:Array.from({length:4}).map((s,t)=>e.jsx("div",{className:"h-14 animate-pulse rounded-xl border border-border bg-bg-secondary"},t))}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-accent/10",children:e.jsx(A,{className:"h-4 w-4 text-accent-hover"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-text",children:"Integrations"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Configure LLM providers and external service connections"})]})]}),d&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${d.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[d.type==="success"?e.jsx(U,{className:"h-4 w-4"}):e.jsx(F,{className:"h-4 w-4"}),d.message]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"LLM Providers"}),e.jsx("div",{className:"space-y-2",children:k.map(s=>{const t=a[s.id],n=s.id==="ollama"?!!(t!=null&&t.baseUrl):!!(t!=null&&t.configured);return e.jsx(M,{provider:s,configured:n,currentUrl:s.fieldType==="url"?(t==null?void 0:t.baseUrl)||"":void 0,onSave:$,saving:y},s.id)})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Google Services (OAuth)"}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:"Google OAuth 2.0"}),e.jsx("p",{className:"text-xs text-text-muted mt-0.5",children:o.connected&&o.email?`Connected as ${o.email}`:"Gmail, Drive, Calendar, Docs, Sheets, Tasks"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{configured:!!o.connected}),o.clientIdSet&&!o.connected&&e.jsxs("button",{onClick:E,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white hover:bg-accent/80 transition-colors",children:[e.jsx(A,{className:"h-3.5 w-3.5"}),"Connect Google"]}),o.connected&&e.jsx("button",{onClick:D,className:"flex items-center gap-1.5 rounded-lg border border-red-500/30 px-3 py-1.5 text-xs font-medium text-red-400 hover:bg-red-500/10 transition-colors",children:"Disconnect"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"Client ID"}),e.jsx("input",{id:"integration-google-client-id",name:"integration-google-client-id",type:"text",value:u,onChange:s=>h(s.target.value),placeholder:o.clientIdSet?"(configured)":"your-client-id.apps.googleusercontent.com",className:"w-full rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"Client Secret"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:"integration-google-client-secret",name:"integration-google-client-secret",type:N?"text":"password",value:i,onChange:s=>j(s.target.value),placeholder:o.clientSecretSet?"(configured)":"GOCSPX-...",className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-accent"}),e.jsx("button",{type:"button",onClick:()=>G(!N),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:N?e.jsx(T,{className:"h-4 w-4"}):e.jsx(I,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:L,disabled:y==="oauth"||!u&&!i,className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50",children:[e.jsx(O,{className:"h-3.5 w-3.5"}),y==="oauth"?"Saving...":"Save OAuth Settings"]})})]})]})]})}export{Q as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AutopilotPanel-DlcdfRRy.js","assets/index-B8YEFBRH.js","assets/index-Cb5bSxRB.css","assets/PageHeader-CiuoyvDR.js","assets/chevron-right-DAiXsK24.js","assets/WorkflowsPanel-D2DiOBLA.js","assets/Input-j10hONMY.js","assets/clsx-B-dksMZM.js","assets/InlineEditableField-fDk3eGVo.js","assets/check-ChWLFWCx.js","assets/terminal-BvJZ1R3x.js","assets/target-D4oh8GME.js","assets/plus-CQwCh7WY.js","assets/chevron-down-CU_O_5h3.js","assets/play-Dfc0ia6v.js","assets/pause-DeggUVZc.js","assets/trash-2-lPcFwnW5.js","assets/clock-qO5kIED9.js","assets/toggle-right-Dl7x_ed7.js","assets/TitanCanvas-DLIN_wV3.js","assets/chevron-up-BudRYwvy.js","assets/users-NPyAWbs5.js","assets/wrench-BCKgeHj3.js","assets/network-ephW7nah.js","assets/save-PlTUvsN5.js","assets/rotate-ccw-CUuN2ebi.js","assets/search-BHgLDT-j.js","assets/send-pflQNBoT.js","assets/VoiceOverlay-B3fXJ-EC.js","assets/folder-DeG4RuOD.js","assets/shield-check-CrD-s89i.js","assets/external-link-ByafQkZ7.js","assets/TitanCanvas-BfitWg9R.css","assets/LearningPanel-B8tqHeEZ.js","assets/lightbulb-TUHKCda3.js","assets/trending-up-DqUbZfDe.js","assets/MemoryGraphPanel-DZl7USJ6.js","assets/SelfImprovePanel-DXIfG_df.js","assets/circle-check-big-gkA-V2JW.js","assets/trophy-Dv6zFfKM.js","assets/PersonasPanel-BNogLwM0.js"])))=>i.map(i=>d[i]);
2
+ import{r as o,j as e,_ as t}from"./index-B8YEFBRH.js";import{c as a}from"./clsx-B-dksMZM.js";const i=o.lazy(()=>t(()=>import("./AutopilotPanel-DlcdfRRy.js"),__vite__mapDeps([0,1,2,3,4]))),n=o.lazy(()=>t(()=>import("./WorkflowsPanel-D2DiOBLA.js"),__vite__mapDeps([5,1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]))),d=o.lazy(()=>t(()=>import("./LearningPanel-B8tqHeEZ.js"),__vite__mapDeps([33,1,2,3,4,10,19,20,12,21,22,23,24,25,26,27,28,13,29,17,9,30,31,32,34,35]))),c=o.lazy(()=>t(()=>import("./MemoryGraphPanel-DZl7USJ6.js"),__vite__mapDeps([36,1,2,23,10,16,26]))),m=o.lazy(()=>t(()=>import("./SelfImprovePanel-DXIfG_df.js"),__vite__mapDeps([37,1,2,19,20,12,21,22,23,10,24,25,26,27,28,4,13,29,17,9,30,31,32,38,39,35,14,16]))),x=o.lazy(()=>t(()=>import("./PersonasPanel-BNogLwM0.js"),__vite__mapDeps([40,1,2]))),p=[{id:"autopilot",label:"Autopilot"},{id:"workflows",label:"Workflows"},{id:"learning",label:"Learning"},{id:"memory",label:"Memory & Graph"},{id:"self-improve",label:"Self-Improve"},{id:"personas",label:"Personas"}];function f(){const[l,r]=o.useState("autopilot");return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"shrink-0 px-5 pt-4 pb-0",children:[e.jsx("h1",{className:"text-sm font-semibold text-text mb-3",children:"Intelligence"}),e.jsx("div",{className:"flex items-center gap-0.5 border-b border-border/50",children:p.map(s=>e.jsxs("button",{onClick:()=>r(s.id),className:a("px-3 py-2 text-xs font-medium transition-colors relative",l===s.id?"text-accent":"text-text-muted hover:text-text-secondary"),children:[s.label,l===s.id&&e.jsx("div",{className:"absolute bottom-0 left-1 right-1 h-[2px] bg-accent rounded-full"})]},s.id))})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-5",children:e.jsxs(o.Suspense,{fallback:e.jsx("div",{className:"skeleton-shimmer h-40 rounded-lg"}),children:[l==="autopilot"&&e.jsx(i,{}),l==="workflows"&&e.jsx(n,{}),l==="learning"&&e.jsx(d,{}),l==="memory"&&e.jsx(c,{}),l==="self-improve"&&e.jsx(m,{}),l==="personas"&&e.jsx(x,{})]})})]})}export{f as default};
@@ -0,0 +1 @@
1
+ import{r as l,j as e,T as g,b as x}from"./index-B8YEFBRH.js";import{P as j}from"./PageHeader-CiuoyvDR.js";import{R as f}from"./terminal-BvJZ1R3x.js";import{B as p,D as N}from"./TitanCanvas-DLIN_wV3.js";import{W as v}from"./wrench-BCKgeHj3.js";import{L as y}from"./lightbulb-TUHKCda3.js";import{T as C}from"./trending-up-DqUbZfDe.js";import"./chevron-right-DAiXsK24.js";import"./chevron-up-BudRYwvy.js";import"./plus-CQwCh7WY.js";import"./users-NPyAWbs5.js";import"./network-ephW7nah.js";import"./save-PlTUvsN5.js";import"./rotate-ccw-CUuN2ebi.js";import"./search-BHgLDT-j.js";import"./send-pflQNBoT.js";import"./VoiceOverlay-B3fXJ-EC.js";import"./chevron-down-CU_O_5h3.js";import"./folder-DeG4RuOD.js";import"./clock-qO5kIED9.js";import"./check-ChWLFWCx.js";import"./shield-check-CrD-s89i.js";import"./external-link-ByafQkZ7.js";function w(t){return t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`:`${Math.floor(t/86400)}d ${Math.floor(t%86400/3600)}h`}function k(t){return t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(1)}K`:`${(t/1e6).toFixed(2)}M`}function a({icon:t,label:d,value:r,color:i,sub:o}){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-2",children:[e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md",style:{backgroundColor:i+"15"},children:e.jsx(t,{className:"h-3.5 w-3.5",style:{color:i}})}),e.jsx("p",{className:"text-xs text-text-muted",children:d})]}),e.jsx("p",{className:"text-2xl font-bold text-text",children:r}),o&&e.jsx("p",{className:"text-[10px] text-text-muted mt-1",children:o})]})}function Q(){const[t,d]=l.useState(null),[r,i]=l.useState(null),[o,b]=l.useState(null),[h,m]=l.useState(!0),u=()=>{m(!0),Promise.all([x("/api/learning").then(s=>s.ok?s.json():null).catch(()=>null),x("/api/stats").then(s=>s.ok?s.json():null).catch(()=>null),x("/api/graphiti").then(s=>s.ok?s.json():null).catch(()=>null)]).then(([s,c,n])=>{d(s),i(c),b(n?{nodeCount:n.nodeCount||0,edgeCount:n.edgeCount||0,episodeCount:n.episodeCount||0}:null)}).finally(()=>m(!1))};return l.useEffect(()=>{u()},[]),h?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-10 animate-pulse rounded-xl bg-bg-secondary"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:Array.from({length:8}).map((s,c)=>e.jsx("div",{className:"h-24 animate-pulse rounded-xl bg-bg-secondary"},c))})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(j,{title:"Learning",subtitle:"Knowledge base, tool mastery, and memory systems",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Memory"},{label:"Learning"}],actions:e.jsxs("button",{onClick:u,className:"flex items-center gap-1.5 rounded-lg bg-bg-tertiary px-3 py-1.5 text-xs text-text-secondary hover:bg-border hover:text-text transition-colors",children:[e.jsx(f,{className:"h-3.5 w-3.5"})," Refresh"]})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Knowledge Base"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(a,{icon:p,label:"Knowledge Entries",value:(t==null?void 0:t.knowledgeEntries)??0,color:"#6366f1",sub:"Facts, patterns, corrections"}),e.jsx(a,{icon:v,label:"Tools Tracked",value:(t==null?void 0:t.toolsTracked)??0,color:"#22d3ee",sub:"Success rates learned"}),e.jsx(a,{icon:g,label:"Error Patterns",value:(t==null?void 0:t.errorPatterns)??0,color:"#f59e0b",sub:"Known failure modes"}),e.jsx(a,{icon:y,label:"Corrections",value:(t==null?void 0:t.corrections)??0,color:"#34d399",sub:"User-taught improvements"})]})]}),o&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Memory Graph"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(a,{icon:N,label:"Entities",value:o.nodeCount,color:"#818cf8",sub:"People, topics, projects"}),e.jsx(a,{icon:C,label:"Relationships",value:o.edgeCount,color:"#22d3ee",sub:"Connections between entities"}),e.jsx(a,{icon:p,label:"Episodes",value:o.episodeCount,color:"#34d399",sub:"Conversation memories"})]})]}),r&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"System"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Tokens Used"}),e.jsx("p",{className:"text-xl font-bold text-text",children:k(r.totalTokens)})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Requests"}),e.jsx("p",{className:"text-xl font-bold text-text",children:r.totalRequests})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Uptime"}),e.jsx("p",{className:"text-xl font-bold text-text",children:w(r.uptime)})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Memory"}),e.jsxs("p",{className:"text-xl font-bold text-text",children:[r.memoryMB,"MB"]})]})]})]})]})}export{Q as default};
@@ -1 +1 @@
1
- import{r,az as v,j as e}from"./index-slWylU2o.js";import{R as j}from"./terminal-CdhfA0Kr.js";const x={debug:"bg-text-muted/20 text-text-secondary",info:"bg-info/20 text-info",warn:"bg-warning/20 text-warning",warning:"bg-warning/20 text-warning",error:"bg-error/20 text-error"};function w(){const[c,u]=r.useState([]),[g,m]=r.useState(!0),[i,d]=r.useState(null),[a,b]=r.useState(""),[o,h]=r.useState(100),[l,p]=r.useState(!1),s=r.useRef(null),n=r.useCallback(async()=>{try{const t=await v(a||void 0,o);u(t),d(null)}catch(t){d(t instanceof Error?t.message:"Failed to fetch logs")}finally{m(!1)}},[a,o]);return r.useEffect(()=>{n()},[n]),r.useEffect(()=>(l?s.current=setInterval(n,5e3):s.current&&(clearInterval(s.current),s.current=null),()=>{s.current&&clearInterval(s.current)}),[l,n]),g?e.jsx("div",{className:"h-96 animate-pulse rounded-xl border border-border bg-bg-secondary"}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-text",children:"Logs"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("select",{value:a,onChange:t=>b(t.target.value),className:"rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent",children:[e.jsx("option",{value:"",children:"All levels"}),e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warn"}),e.jsx("option",{value:"error",children:"Error"})]}),e.jsxs("select",{value:o,onChange:t=>h(Number(t.target.value)),className:"rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent",children:[e.jsx("option",{value:50,children:"50 entries"}),e.jsx("option",{value:100,children:"100 entries"}),e.jsx("option",{value:200,children:"200 entries"})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-secondary",children:[e.jsx("input",{type:"checkbox",checked:l,onChange:t=>p(t.target.checked),className:"h-4 w-4 rounded border-border accent-accent"}),"Auto-refresh (5s)"]}),e.jsx("button",{onClick:n,className:"ml-auto rounded-lg p-2 text-text-secondary transition-colors hover:bg-bg-tertiary hover:text-text",title:"Refresh",children:e.jsx(j,{className:"h-4 w-4"})})]}),i&&e.jsx("div",{className:"rounded-lg border border-error/50 bg-bg-secondary px-4 py-2 text-sm text-error",children:i}),e.jsx("div",{className:"max-h-[600px] overflow-y-auto rounded-xl border border-border bg-bg-secondary",children:c.length===0?e.jsx("p",{className:"px-4 py-12 text-center text-text-muted",children:"No logs found"}):e.jsx("div",{className:"divide-y divide-border",children:c.map((t,f)=>e.jsxs("div",{className:"flex items-start gap-3 px-4 py-2.5",children:[e.jsx("span",{className:"shrink-0 font-mono text-xs text-text-muted",children:new Date(t.timestamp).toLocaleTimeString()}),e.jsx("span",{className:`shrink-0 rounded px-1.5 py-0.5 text-xs font-medium uppercase ${x[t.level]??x.debug}`,children:t.level}),e.jsx("span",{className:"min-w-0 break-all text-sm text-text",children:t.message})]},f))})})]})}export{w as default};
1
+ import{r,aB as v,j as e}from"./index-B8YEFBRH.js";import{R as j}from"./terminal-BvJZ1R3x.js";const x={debug:"bg-text-muted/20 text-text-secondary",info:"bg-info/20 text-info",warn:"bg-warning/20 text-warning",warning:"bg-warning/20 text-warning",error:"bg-error/20 text-error"};function w(){const[c,u]=r.useState([]),[g,m]=r.useState(!0),[i,d]=r.useState(null),[a,b]=r.useState(""),[o,h]=r.useState(100),[l,p]=r.useState(!1),s=r.useRef(null),n=r.useCallback(async()=>{try{const t=await v(a||void 0,o);u(t),d(null)}catch(t){d(t instanceof Error?t.message:"Failed to fetch logs")}finally{m(!1)}},[a,o]);return r.useEffect(()=>{n()},[n]),r.useEffect(()=>(l?s.current=setInterval(n,5e3):s.current&&(clearInterval(s.current),s.current=null),()=>{s.current&&clearInterval(s.current)}),[l,n]),g?e.jsx("div",{className:"h-96 animate-pulse rounded-xl border border-border bg-bg-secondary"}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-text",children:"Logs"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("select",{value:a,onChange:t=>b(t.target.value),className:"rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent",children:[e.jsx("option",{value:"",children:"All levels"}),e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warn"}),e.jsx("option",{value:"error",children:"Error"})]}),e.jsxs("select",{value:o,onChange:t=>h(Number(t.target.value)),className:"rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent",children:[e.jsx("option",{value:50,children:"50 entries"}),e.jsx("option",{value:100,children:"100 entries"}),e.jsx("option",{value:200,children:"200 entries"})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-secondary",children:[e.jsx("input",{type:"checkbox",checked:l,onChange:t=>p(t.target.checked),className:"h-4 w-4 rounded border-border accent-accent"}),"Auto-refresh (5s)"]}),e.jsx("button",{onClick:n,className:"ml-auto rounded-lg p-2 text-text-secondary transition-colors hover:bg-bg-tertiary hover:text-text",title:"Refresh",children:e.jsx(j,{className:"h-4 w-4"})})]}),i&&e.jsx("div",{className:"rounded-lg border border-error/50 bg-bg-secondary px-4 py-2 text-sm text-error",children:i}),e.jsx("div",{className:"max-h-[600px] overflow-y-auto rounded-xl border border-border bg-bg-secondary",children:c.length===0?e.jsx("p",{className:"px-4 py-12 text-center text-text-muted",children:"No logs found"}):e.jsx("div",{className:"divide-y divide-border",children:c.map((t,f)=>e.jsxs("div",{className:"flex items-start gap-3 px-4 py-2.5",children:[e.jsx("span",{className:"shrink-0 font-mono text-xs text-text-muted",children:new Date(t.timestamp).toLocaleTimeString()}),e.jsx("span",{className:`shrink-0 rounded px-1.5 py-0.5 text-xs font-medium uppercase ${x[t.level]??x.debug}`,children:t.level}),e.jsx("span",{className:"min-w-0 break-all text-sm text-text",children:t.message})]},f))})})]})}export{w as default};
@@ -0,0 +1 @@
1
+ import{r as d,j as e,G as k,aI as z,aJ as $,aK as b,aL as I,aM as R,aN as E}from"./index-B8YEFBRH.js";import{P as h}from"./plug-Bl_6i_9u.js";import{R as D}from"./terminal-BvJZ1R3x.js";import{P as L}from"./plus-CQwCh7WY.js";import{b as g,T as G,P as B}from"./TitanCanvas-DLIN_wV3.js";import{T as F}from"./trash-2-lPcFwnW5.js";import"./chevron-up-BudRYwvy.js";import"./users-NPyAWbs5.js";import"./wrench-BCKgeHj3.js";import"./network-ephW7nah.js";import"./save-PlTUvsN5.js";import"./rotate-ccw-CUuN2ebi.js";import"./search-BHgLDT-j.js";import"./send-pflQNBoT.js";import"./VoiceOverlay-B3fXJ-EC.js";import"./chevron-right-DAiXsK24.js";import"./chevron-down-CU_O_5h3.js";import"./folder-DeG4RuOD.js";import"./clock-qO5kIED9.js";import"./check-ChWLFWCx.js";import"./shield-check-CrD-s89i.js";import"./external-link-ByafQkZ7.js";function ce(){const[l,j]=d.useState([]),[N,y]=d.useState([]),[f,x]=d.useState(!0),[m,c]=d.useState(!1),[v,p]=d.useState(null),[o,i]=d.useState(null),[s,a]=d.useState({id:"",name:"",description:"",type:"stdio",command:"",args:"",url:""}),n=async()=>{x(!0);try{const[t,r]=await Promise.all([z(),$()]);j(t),y(r)}catch{}x(!1)};d.useEffect(()=>{n()},[]);const C=async()=>{try{await b({id:s.id,name:s.name,description:s.description,type:s.type,...s.type==="stdio"?{command:s.command,args:s.args.split(/\s+/).filter(Boolean)}:{url:s.url}}),c(!1),a({id:"",name:"",description:"",type:"stdio",command:"",args:"",url:""}),n()}catch(t){alert(t.message)}},P=async t=>{try{await b({presetId:t}),n()}catch(r){alert(r.message)}},w=async t=>{confirm(`Remove MCP server "${t}"?`)&&(await E(t),n())},M=async(t,r)=>{await R(t,r),n()},T=async t=>{p(t),i(null);try{const r=await I(t);i({id:t,...r})}catch(r){i({id:t,ok:!1,tools:0,error:r.message})}p(null)},S=t=>t==="connected"?"text-[var(--success)]":t==="error"?"text-[var(--error)]":"text-[var(--text-muted)]",A=t=>t==="connected"?"bg-[var(--success)]":t==="error"?"bg-[var(--error)]":"bg-[var(--text-muted)]",u=N.filter(t=>!l.some(r=>r.id===t.id));return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(h,{className:"w-6 h-6 text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-[var(--text)]",children:"MCP Connections"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Connect to external tools via Model Context Protocol"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:n,className:"px-3 py-1.5 text-sm rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(D,{size:14})}),e.jsxs("button",{onClick:()=>c(!m),className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded-md bg-[var(--accent)] text-white hover:bg-[var(--accent-hover)] transition-colors",children:[e.jsx(L,{size:14})," Add Server"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 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:"Configured Servers"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--text)]",children:l.length})]}),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:"Connected"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--success)]",children:l.filter(t=>t.status==="connected").length})]}),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:"External Tools"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--accent)]",children:l.reduce((t,r)=>t+r.toolCount,0)})]})]}),m&&e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4 space-y-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--text)]",children:"Add MCP Server"}),u.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)] mb-2",children:"Quick Add Presets"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(t=>e.jsxs("button",{onClick:()=>P(t.id),className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:[e.jsx(g,{size:12})," ",t.name]},t.id))})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"ID"}),e.jsx("input",{id:"mcp-server-id",name:"mcp-server-id",value:s.id,onChange:t=>a({...s,id:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"my-server"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Name"}),e.jsx("input",{id:"mcp-server-name",name:"mcp-server-name",value:s.name,onChange:t=>a({...s,name:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"My MCP Server"})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Description"}),e.jsx("input",{id:"mcp-server-description",name:"mcp-server-description",value:s.description,onChange:t=>a({...s,description:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"What does this server do?"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Type"}),e.jsxs("select",{id:"mcp-server-type",name:"mcp-server-type",value:s.type,onChange:t=>a({...s,type:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",children:[e.jsx("option",{value:"stdio",children:"stdio (local process)"}),e.jsx("option",{value:"http",children:"HTTP (remote server)"})]})]}),s.type==="stdio"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Command"}),e.jsx("input",{id:"mcp-server-command",name:"mcp-server-command",value:s.command,onChange:t=>a({...s,command:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"npx @modelcontextprotocol/server-xxx"})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Arguments (space-separated)"}),e.jsx("input",{id:"mcp-server-args",name:"mcp-server-args",value:s.args,onChange:t=>a({...s,args:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"--port 3000"})]})]}):e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Server URL"}),e.jsx("input",{id:"mcp-server-url",name:"mcp-server-url",value:s.url,onChange:t=>a({...s,url:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"http://localhost:3000/mcp"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:C,disabled:!s.id||!s.name,className:"px-4 py-1.5 text-sm rounded-md bg-[var(--accent)] text-white hover:bg-[var(--accent-hover)] disabled:opacity-40 transition-colors",children:"Add Server"}),e.jsx("button",{onClick:()=>c(!1),className:"px-4 py-1.5 text-sm rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:"Cancel"})]})]}),f?e.jsx("div",{className:"text-[var(--text-muted)] text-sm",children:"Loading MCP servers..."}):l.length===0?e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-8 text-center",children:[e.jsx(h,{className:"w-10 h-10 text-[var(--text-muted)] mx-auto mb-3"}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-1",children:"No MCP servers configured"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Add an MCP server to connect TITAN to external tools like databases, APIs, and services."})]}):e.jsx("div",{className:"space-y-3",children:l.map(t=>e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:t.type==="stdio"?e.jsx(g,{size:18,className:"text-[var(--text-muted)]"}):e.jsx(k,{size:18,className:"text-[var(--text-muted)]"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-[var(--text)]",children:t.name}),e.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${A(t.status)}`}),e.jsx("span",{className:S(t.status),children:t.status})]}),t.toolCount>0&&e.jsxs("span",{className:"text-xs px-1.5 py-0.5 rounded bg-[var(--accent)]/10 text-[var(--accent)]",children:[t.toolCount," tools"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-0.5",children:t.description}),e.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-1 font-mono",children:t.type==="stdio"?`${t.command} ${(t.args||[]).join(" ")}`:t.url})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>T(t.id),disabled:v===t.id,title:"Test connection",className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-tertiary)] transition-colors disabled:opacity-40",children:e.jsx(G,{size:14,className:v===t.id?"animate-pulse":""})}),e.jsx("button",{onClick:()=>M(t.id,!t.enabled),title:t.enabled?"Disable":"Enable",className:`p-1.5 rounded-md transition-colors hover:bg-[var(--bg-tertiary)] ${t.enabled?"text-[var(--success)]":"text-[var(--text-muted)]"}`,children:e.jsx(B,{size:14})}),e.jsx("button",{onClick:()=>w(t.id),title:"Remove",className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--error)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(F,{size:14})})]})]}),(o==null?void 0:o.id)===t.id&&e.jsx("div",{className:`mt-3 px-3 py-2 rounded-md text-xs ${o.ok?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:o.ok?`Connected successfully — ${o.tools} tools discovered`:`Connection failed: ${o.error}`})]},t.id))}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--text)] mb-2",children:"About MCP"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)] leading-relaxed",children:["Model Context Protocol (MCP) is the universal standard for connecting AI agents to external tools. TITAN acts as both an MCP ",e.jsx("strong",{className:"text-[var(--text-secondary)]",children:"server"})," (exposing its tools to other agents) and an MCP ",e.jsx("strong",{className:"text-[var(--text-secondary)]",children:"client"})," (connecting to external MCP servers). Add any MCP-compatible server and its tools automatically become available in TITAN."]})]})]})}export{ce as default};
@@ -1,4 +1,4 @@
1
- import{c as ye,r as j,b as be,j as o,X as Se}from"./index-slWylU2o.js";import{N as ve}from"./network-v9O7MmZT.js";import{R as Ce}from"./terminal-CdhfA0Kr.js";import{T as ke}from"./trash-2-TQcEJEv4.js";import{S as $e}from"./search-C9SdcZJq.js";/**
1
+ import{c as ye,r as j,b as be,j as o,X as Se}from"./index-B8YEFBRH.js";import{N as ve}from"./network-ephW7nah.js";import{R as Ce}from"./terminal-BvJZ1R3x.js";import{T as ke}from"./trash-2-lPcFwnW5.js";import{S as $e}from"./search-BHgLDT-j.js";/**
2
2
  * @license lucide-react v0.513.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,11 @@
1
+ import{c as g,r as n,b as h,j as e}from"./index-B8YEFBRH.js";import{P as u}from"./PageHeader-CiuoyvDR.js";import{A as v}from"./arrow-left-thXQMJQ6.js";import{C as w}from"./clock-qO5kIED9.js";import{S as k}from"./search-BHgLDT-j.js";import{B as S}from"./TitanCanvas-DLIN_wV3.js";import"./chevron-right-DAiXsK24.js";import"./chevron-up-BudRYwvy.js";import"./plus-CQwCh7WY.js";import"./users-NPyAWbs5.js";import"./wrench-BCKgeHj3.js";import"./network-ephW7nah.js";import"./terminal-BvJZ1R3x.js";import"./save-PlTUvsN5.js";import"./rotate-ccw-CUuN2ebi.js";import"./send-pflQNBoT.js";import"./VoiceOverlay-B3fXJ-EC.js";import"./chevron-down-CU_O_5h3.js";import"./folder-DeG4RuOD.js";import"./check-ChWLFWCx.js";import"./shield-check-CrD-s89i.js";import"./external-link-ByafQkZ7.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 C=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],M=g("link",C);/**
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 L=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],A=g("tag",L),E={person:"var(--color-accent-hover)",topic:"var(--color-cyan)",project:"var(--color-emerald)",place:"#fbbf24",company:"#facc15",technology:"#2dd4bf",event:"#fb7185"};function i(a){return E[a==null?void 0:a.toLowerCase()]??"#94a3b8"}function b(a){const l=Math.floor((Date.now()-new Date(a).getTime())/1e3);return l<60?"just now":l<3600?`${Math.floor(l/60)}m ago`:l<86400?`${Math.floor(l/3600)}h ago`:`${Math.floor(l/86400)}d ago`}function Z(){const[a,l]=n.useState([]),[s,d]=n.useState(null),[f,j]=n.useState(!0),[o,y]=n.useState(""),[c,N]=n.useState(""),x=n.useCallback(async()=>{try{const t=new URLSearchParams;o&&t.set("q",o),c&&t.set("type",c);const r=await h(`/api/wiki/entities?${t}`);r.ok&&l(await r.json())}catch{}finally{j(!1)}},[o,c]),m=async t=>{try{const r=await h(`/api/wiki/entity/${encodeURIComponent(t)}`);r.ok&&d(await r.json())}catch{}};n.useEffect(()=>{x()},[x]);const p=[...new Set(a.map(t=>t.type))].sort();return s?e.jsxs("div",{className:"space-y-4",children:[e.jsx(u,{title:s.name,breadcrumbs:[{label:"Memory"},{label:"Wiki",href:"/memory-wiki"},{label:s.name}],actions:e.jsxs("button",{onClick:()=>d(null),className:"flex items-center gap-1.5 rounded-lg bg-bg-tertiary px-3 py-1.5 text-xs text-text-secondary hover:text-text transition-colors",children:[e.jsx(v,{className:"h-3.5 w-3.5"})," Back to list"]})}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-5",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"h-4 w-4 rounded-full",style:{backgroundColor:i(s.type),boxShadow:`0 0 10px ${i(s.type)}50`}}),e.jsx("h2",{className:"text-xl font-bold text-text",children:s.name}),e.jsx("span",{className:"rounded-md bg-bg-tertiary px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-text-secondary",children:s.type})]}),s.summary&&e.jsx("p",{className:"text-sm text-text-secondary mb-2",children:s.summary}),s.aliases.length>0&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[e.jsx(A,{className:"h-3 w-3"})," Also known as: ",s.aliases.join(", ")]}),e.jsxs("div",{className:"flex gap-4 mt-3 text-[10px] text-text-muted",children:[e.jsxs("span",{children:["First seen: ",new Date(s.firstSeen).toLocaleDateString()]}),e.jsxs("span",{children:["Last seen: ",b(s.lastSeen)]})]})]}),s.facts.length>0&&e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider text-text-muted mb-3",children:["Facts (",s.facts.length,")"]}),e.jsx("div",{className:"space-y-2",children:s.facts.map((t,r)=>e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[e.jsx("span",{className:"text-accent mt-0.5",children:"•"}),e.jsx("span",{className:"text-text-secondary",children:t})]},r))})]}),s.related.length>0&&e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider text-text-muted mb-3",children:[e.jsx(M,{className:"h-3 w-3 inline mr-1"})," Related (",s.related.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.related.map(t=>e.jsxs("button",{onClick:()=>m(t.name),className:"inline-flex items-center gap-1.5 rounded-lg border border-border bg-bg px-3 py-1.5 text-xs hover:border-accent transition-colors",children:[e.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:i(t.type)}}),e.jsx("span",{className:"text-text",children:t.name}),e.jsxs("span",{className:"text-text-muted",children:["(",t.relation,")"]})]},t.id))})]}),s.episodes.length>0&&e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider text-text-muted mb-3",children:[e.jsx(w,{className:"h-3 w-3 inline mr-1"})," Episode History (",s.episodes.length,")"]}),e.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:s.episodes.map(t=>e.jsxs("div",{className:"border-l-2 border-border pl-3 py-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-text-muted mb-0.5",children:[e.jsx("span",{children:new Date(t.createdAt).toLocaleString()}),e.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:t.source})]}),e.jsx("p",{className:"text-xs text-text-secondary",children:t.content})]},t.id))})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(u,{title:"Memory Wiki",breadcrumbs:[{label:"Memory"},{label:"Wiki"}]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(k,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted"}),e.jsx("input",{type:"text",value:o,onChange:t=>y(t.target.value),placeholder:"Search entities, facts, summaries...",className:"w-full rounded-lg border border-border bg-bg-secondary py-2 pl-9 pr-4 text-sm text-text placeholder:text-text-muted focus:border-accent focus:outline-none"})]}),e.jsxs("select",{value:c,onChange:t=>N(t.target.value),className:"rounded-lg border border-border bg-bg-secondary px-3 py-2 text-sm text-text-secondary focus:border-accent focus:outline-none",children:[e.jsx("option",{value:"",children:"All types"}),p.map(t=>e.jsx("option",{value:t,children:t},t))]})]}),e.jsxs("div",{className:"flex gap-3 text-xs text-text-muted",children:[e.jsxs("span",{children:[a.length," entities"]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:[p.length," types"]})]}),f?e.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:Array.from({length:9}).map((t,r)=>e.jsx("div",{className:"h-24 animate-pulse rounded-xl border border-border bg-bg-secondary"},r))}):e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[a.map(t=>e.jsxs("button",{onClick:()=>m(t.name),className:"rounded-xl border border-border bg-bg-secondary p-4 text-left hover:border-accent transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:i(t.type)}}),e.jsx("span",{className:"font-medium text-sm text-text truncate",children:t.name})]}),e.jsx("p",{className:"text-xs text-text-secondary line-clamp-2 mb-2",children:t.summary||"No summary"}),e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-text-muted",children:[e.jsx("span",{className:"capitalize",children:t.type}),e.jsxs("span",{children:[t.factCount," facts"]}),e.jsx("span",{children:b(t.lastSeen)})]})]},t.id)),a.length===0&&e.jsxs("div",{className:"col-span-full py-12 text-center",children:[e.jsx(S,{className:"h-8 w-8 text-text-muted mx-auto mb-2"}),e.jsx("p",{className:"text-text-muted",children:"No entities found"})]})]})]})}export{Z as default};
@@ -1,4 +1,4 @@
1
- import{c as l,r as n,j as e,aP as y,aQ as j,aR as N,aS as f,aT as k}from"./index-slWylU2o.js";import{D as v}from"./DataTable-seaktPzB.js";import{R as w}from"./terminal-CdhfA0Kr.js";import{S as P}from"./shield-check-DyP5PmaY.js";/**
1
+ import{c as l,r as n,j as e,aR as y,aS as j,aT as N,aU as f,aV as k}from"./index-B8YEFBRH.js";import{D as v}from"./DataTable-DZ2cG3Cv.js";import{R as w}from"./terminal-BvJZ1R3x.js";import{S as P}from"./shield-check-CrD-s89i.js";/**
2
2
  * @license lucide-react v0.513.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,69 @@
1
+ import{r as o,j as e,l as be,u as ve,q as ye}from"./index-B8YEFBRH.js";import{p as J,f as ke,h as we,i as je,g as Ne,a as se,s as Se,b as Ce,d as Me,e as $e}from"./missions-C3EC4uKT.js";import{F as De}from"./FileViewer-DOWUQccc.js";function Te({member:t,room:a,anchor:n,availableModels:i,onClose:x,onTalkInChat:m}){const f=o.useRef(null),[d,y]=o.useState("main"),[v,u]=o.useState(""),[b,l]=o.useState(!1),[h,c]=o.useState(!1),[j,k]=o.useState(null);o.useEffect(()=>{const w=$=>{$.key==="Escape"&&x()};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[x]);const p=320,M=360,N=Oe(n,p,M);async function A(){c(!0),k(null);try{await J(a.id,`@${t.name} quick check-in — how's it going? Anything I can clear for you?`),x()}catch(w){k(w.message)}finally{c(!1)}}async function E(w){const $=v.trim();if(!(!$||b)){l(!0),k(null);try{await J(a.id,`@${t.name} ${w}${$}`),u(""),x()}catch(B){k(B.message)}finally{l(!1)}}}async function F(w){c(!0),k(null);try{await je(a.id,t.agentId,w),y("main")}catch($){k($.message)}finally{c(!1)}}async function R(){c(!0),k(null);try{await ke(a.id,t.agentId,!t.paused)}catch(w){k(w.message)}finally{c(!1)}}async function L(){c(!0),k(null);try{await we(a.id,!a.longRunningMode)}catch(w){k(w.message)}finally{c(!1)}}return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[60]",onClick:x,"aria-hidden":!0}),e.jsxs("div",{ref:f,className:"absolute z-[61] flex flex-col titan-modal-surface overflow-hidden",style:{left:N.x,top:N.y,width:p,maxHeight:M,borderRadius:12},onClick:w=>w.stopPropagation(),children:[e.jsx("div",{className:"h-1.5",style:{background:`linear-gradient(90deg, ${t.color}, ${ie(t.color,-25)})`}}),e.jsxs("div",{className:"px-4 pt-3 pb-2 flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-md flex items-center justify-center text-white font-bold text-[14px]",style:{background:`linear-gradient(135deg, ${t.color}, ${ie(t.color,-25)})`},children:t.name[0]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-sm",children:t.name}),e.jsxs("div",{className:"text-[11px] text-text-muted",children:[t.role," · ",Ae(t)]})]}),e.jsx("button",{onClick:x,"aria-label":"Close",className:"titan-close-btn w-7 h-7 rounded-full flex items-center justify-center text-sm",style:{border:"1px solid var(--theme-menu-border)"},children:"✕"})]}),t.currentActivity&&e.jsxs("div",{className:"px-4 pb-2 text-[11px] text-text-secondary italic leading-snug border-b border-border/60",children:['"',t.currentActivity,'"']}),j&&e.jsx("div",{className:"px-4 py-2 text-[11px] text-error bg-error/10 border-b border-error/30",children:j}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[d==="main"&&e.jsxs("div",{className:"p-2 grid grid-cols-2 gap-2",children:[e.jsx(I,{icon:"👋",label:"Nudge",hint:"A friendly check-in",onClick:A,disabled:h}),e.jsx(I,{icon:"💬",label:"Talk to them",hint:"Send a message just to them",onClick:()=>{m?(m(t.agentId,`@${t.name} `),x()):y("talk")},disabled:h}),e.jsx(I,{icon:"🧭",label:"Steer",hint:"Redirect them mid-task",onClick:()=>y("steer"),disabled:h}),e.jsx(I,{icon:"🧠",label:"Model",hint:t.modelOverride?Fe(t.modelOverride):"default",onClick:()=>y("model"),disabled:h}),e.jsx(I,{icon:t.paused?"▶":"⏸",label:t.paused?"Resume agent":"Pause agent",hint:t.paused?"Bring them back":"Skip them for now",onClick:R,disabled:h,wide:!1}),e.jsx(I,{icon:"🏃",label:a.longRunningMode?"Marathon ON":"Marathon mode",hint:a.longRunningMode?"running 72h goal":"72h auto-run",onClick:L,disabled:h,active:!!a.longRunningMode})]}),(d==="talk"||d==="steer")&&e.jsxs("div",{className:"p-3 flex flex-col gap-2",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-text-muted",children:d==="talk"?`Message ${t.name}`:`Steer ${t.name}`}),e.jsx("textarea",{autoFocus:!0,value:v,onChange:w=>u(w.target.value),rows:4,onKeyDown:w=>{w.key==="Enter"&&(w.metaKey||w.ctrlKey)&&(w.preventDefault(),E(d==="steer"?"steer: ":""))},placeholder:d==="steer"?'e.g. "skip the chart, focus on cost comparison"':"Type a private note to them…",className:"bg-bg-tertiary border border-border rounded-lg p-2 text-sm text-text outline-none focus:border-accent resize-none"}),d==="steer"&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:["Slow down","Be thorough","Wrap it up","Skip the chart"].map(w=>e.jsx("button",{onClick:()=>u(w.toLowerCase()),className:"px-2 py-0.5 text-[11px] bg-bg-tertiary border border-border rounded-full text-text-muted hover:text-text",children:w},w))}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("button",{onClick:()=>y("main"),className:"text-xs text-text-muted hover:text-text",children:"← Back"}),e.jsx("button",{onClick:()=>E(d==="steer"?"steer: ":""),disabled:!v.trim()||b,className:"px-3 py-1.5 rounded-lg font-bold text-bg-deep bg-gradient-to-br from-accent to-accent2 disabled:opacity-50 text-xs",children:b?"Sending…":"Send ⌘↵"})]})]}),d==="model"&&e.jsxs("div",{className:"p-3 flex flex-col gap-2",children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-widest text-text-muted",children:[t.name,"'s brain"]}),e.jsx("div",{className:"text-[11px] text-text-secondary leading-snug",children:"Pick a specific model for this agent on this mission. Empty = the role's default."}),t.modelOverride&&e.jsxs("div",{className:"px-2.5 py-1.5 rounded-lg bg-accent/10 border border-accent/40 text-[12px] text-text flex items-center justify-between",children:[e.jsxs("span",{className:"truncate",children:["Now: ",e.jsx("b",{children:t.modelOverride})]}),e.jsx("button",{onClick:()=>F(null),className:"text-[11px] text-text-muted hover:text-text shrink-0",children:"clear"})]}),e.jsx("div",{className:"flex flex-col gap-1 max-h-48 overflow-y-auto",children:i.length===0?e.jsx("div",{className:"text-[11px] text-text-muted italic",children:"No models discovered. /api/models returned empty."}):i.map(w=>{const $=t.modelOverride===w.id;return e.jsxs("button",{onClick:()=>F(w.id),disabled:h,className:`flex items-center justify-between px-2.5 py-1.5 rounded-lg text-[12px] border text-left ${$?"bg-accent/10 border-accent/60 text-text":"bg-bg-tertiary/40 border-border text-text-secondary hover:text-text hover:border-border-light"}`,children:[e.jsx("span",{className:"truncate",children:w.id}),e.jsx("span",{className:"text-[10px] text-text-muted ml-2 shrink-0",children:w.provider})]},w.id)})}),e.jsx("button",{onClick:()=>y("main"),className:"text-xs text-text-muted hover:text-text self-start mt-1",children:"← Back"})]})]})]})]})}function I({icon:t,label:a,hint:n,onClick:i,disabled:x,wide:m,active:f}){return e.jsxs("button",{onClick:i,disabled:x,className:`text-left p-2.5 rounded-xl border transition-colors ${f?"bg-accent/15 border-accent/50 text-text":"bg-bg-tertiary/40 border-border text-text-secondary hover:text-text hover:border-border-light"} ${m?"col-span-2":""} disabled:opacity-50`,children:[e.jsx("div",{className:"text-lg leading-none mb-1",children:t}),e.jsx("div",{className:"text-[12px] font-semibold leading-tight",children:a}),n&&e.jsx("div",{className:"text-[10px] text-text-muted leading-snug mt-0.5 truncate",children:n})]})}function Oe({x:t,y:a},n,i){const x=window.innerWidth,m=window.innerHeight;return{x:Math.max(8,Math.min(t,x-n-8)),y:Math.max(8,Math.min(a,m-i-8))}}function Ae(t){return t.paused?"paused (by you)":t.state==="working"?"working":t.state==="editing"?"editing":t.state==="blocked"?"needs you":t.state==="done"?"done":"idle"}function Fe(t){return t.length<=24?t:t.slice(0,22)+"…"}function ie(t,a){const n=t.replace("#","");if(n.length!==6)return t;const i=parseInt(n,16);let x=i>>16&255,m=i>>8&255,f=i&255;const d=Math.round(255*(a/100));return x=Math.max(0,Math.min(255,x+d)),m=Math.max(0,Math.min(255,m+d)),f=Math.max(0,Math.min(255,f+d)),"#"+(x<<16|m<<8|f).toString(16).padStart(6,"0")}const ze=[{cmd:"/slow down",label:"Slow down",hint:"be more careful"},{cmd:"/be thorough",label:"Be thorough",hint:"dig deeper"},{cmd:"/wrap it up",label:"Wrap it up",hint:"finish what you have"},{cmd:"/pause",label:"Pause",hint:"pause the team"}];function Ee(t){try{const a=localStorage.getItem(le(t));return a?JSON.parse(a):{}}catch{return{}}}function Le(t,a){try{localStorage.setItem(le(t),JSON.stringify(a))}catch{}}function le(t){return`titan-desk:${t}`}function de(t){return`titan-desk-furniture:${t}`}function Pe(t){const a={cabinet:[],trash:[],permanentlyHidden:[],cabinetOpen:!1,trashOpen:!1};try{const n=localStorage.getItem(de(t));if(!n)return a;const i=JSON.parse(n);return{cabinet:Array.isArray(i.cabinet)?i.cabinet:[],trash:Array.isArray(i.trash)?i.trash:[],permanentlyHidden:Array.isArray(i.permanentlyHidden)?i.permanentlyHidden:[],cabinetOpen:!!i.cabinetOpen,trashOpen:!!i.trashOpen}}catch{return a}}function Re(t,a){try{localStorage.setItem(de(t),JSON.stringify(a))}catch{}}function yt(){const{id:t}=be(),a=ve(),[n,i]=o.useState(null),[x,m]=o.useState(!0),[f,d]=o.useState(null),[y,v]=o.useState(""),[u,b]=o.useState(!1),[l,h]=o.useState(!1),[c,j]=o.useState({});o.useEffect(()=>{t&&j(Ee(t))},[t]);const k=o.useCallback(r=>{j(r),t&&Le(t,r)},[t]),[p,M]=o.useState({cabinet:[],trash:[],permanentlyHidden:[],cabinetOpen:!1,trashOpen:!1});o.useEffect(()=>{t&&M(Pe(t))},[t]);const N=o.useCallback(r=>{M(r),t&&Re(t,r)},[t]),[A,E]=o.useState([]);o.useEffect(()=>{ye().then(E).catch(()=>E([]))},[]);const[F,R]=o.useState(null),[L,w]=o.useState(null),$=o.useCallback(async r=>{if(t){w({ref:r,loading:!0});try{const s=await Ne(t,r);w({ref:r,loading:!1,file:s})}catch(s){w({ref:r,loading:!1,error:s.message})}}},[t]);o.useEffect(()=>{if(!t)return;let r=!0;return m(!0),se(t).then(({mission:s})=>{r&&(i(s),m(!1))}).catch(s=>{r&&(d(s.message),m(!1))}),()=>{r=!1}},[t]),o.useEffect(()=>t?Se(t,s=>{if(s.kind==="mission_deleted"){a("/mission");return}s.kind!=="hello"&&se(t).then(({mission:g})=>i(g)).catch(()=>{})}):void 0,[t,a]);const B=o.useCallback(async r=>{if(!(!n||!r.trim()||u)){b(!0);try{await J(n.id,r.trim()),v("")}catch(s){d(s.message)}finally{b(!1)}}},[n,u]),V=o.useCallback(async(r,s)=>{if(n)try{await Ce(n.id,r,s)}catch(g){d(g.message)}},[n]),xe=o.useCallback(async()=>{if(!n)return;const r=n.status==="paused"?"working":"paused";try{await Me(n.id,r)}catch(s){d(s.message)}},[n]),ue=o.useCallback(async()=>{if(!(!n||!window.confirm(`Delete this mission?
2
+
3
+ "${n.goal.slice(0,120)}${n.goal.length>120?"…":""}"
4
+
5
+ The file is renamed on disk (recoverable manually), but the mission disappears from the UI immediately.`)))try{await $e(n.id),a("/mission")}catch(s){d(s.message)}},[n,a]),W=o.useMemo(()=>n?[...n.messages].reverse().find(s=>s.kind==="question"&&!s.answer):void 0,[n]),H=o.useMemo(()=>{if(!n)return[];const r=new Map;for(const s of n.messages)if(!(s.kind!=="agent"||!Array.isArray(s.sources)))for(const g of s.sources)(g.type==="file"||g.type==="report")&&r.set(g.ref,{ref:g.ref,description:g.description,type:g.type});return Array.from(r.values())},[n]),G=o.useMemo(()=>{if(!n)return[];const r=[];for(const s of n.team){const g=s.activityLog??[];for(const C of g)r.push({id:`${s.agentId}:${C.at}:${C.icon}`,agentId:s.agentId,agentName:s.name,agentColor:s.color,icon:C.icon,activity:C.activity,detail:C.detail,at:C.at})}return r.sort((s,g)=>s.at<g.at?1:-1),r.slice(0,12)},[n]),K=o.useMemo(()=>{if(!n)return[];const r=new Map;for(const s of n.messages)if(!(s.kind!=="agent"||!Array.isArray(s.sources)))for(const g of s.sources)g.type==="fact"&&r.set(g.ref,{ref:g.ref,description:g.description});return Array.from(r.values()).slice(0,8)},[n]),D=o.useMemo(()=>{if(!n)return[];const r=[];r.push({id:"goal",kind:"goal"}),r.push({id:"document",kind:"document"}),r.push({id:"cost",kind:"cost"}),r.push({id:"clock",kind:"clock"}),r.push({id:"cabinet",kind:"cabinet"}),r.push({id:"trash",kind:"trash"});for(const s of n.team)r.push({id:`agent:${s.agentId}`,kind:"agent",ref:s.agentId});for(const s of H)r.push({id:`file:${s.ref}`,kind:"file",ref:s.ref});for(const s of K)r.push({id:`fact:${s.ref}`,kind:"fact",ref:s.ref});for(const s of G)r.push({id:s.id,kind:"activity",ref:s.id});return W&&r.push({id:`q:${W.approvalId}`,kind:"question",ref:W.approvalId}),r},[n,H,K,G,W]),Z=o.useCallback(r=>p.cabinet.includes(r)||p.trash.includes(r)||p.permanentlyHidden.includes(r),[p]),he=o.useCallback((r,s)=>s==="cabinet"?(N({...p,cabinet:[...new Set([...p.cabinet,r])],trash:p.trash.filter(g=>g!==r)}),!0):s==="trash"?(N({...p,trash:[...new Set([...p.trash,r])],cabinet:p.cabinet.filter(g=>g!==r)}),!0):!1,[p,N]),Q=o.useCallback(r=>{N({...p,cabinet:p.cabinet.filter(s=>s!==r),trash:p.trash.filter(s=>s!==r)})},[p,N]),ee=o.useCallback(()=>{N({...p,cabinetOpen:!p.cabinetOpen})},[p,N]),te=o.useCallback(()=>{N({...p,trashOpen:!p.trashOpen})},[p,N]),fe=o.useCallback(r=>{N({...p,trash:p.trash.filter(s=>s!==r),permanentlyHidden:[...new Set([...p.permanentlyHidden,r])]})},[p,N]),Y=o.useCallback((r,s)=>{const g=typeof window>"u"?1400:window.innerWidth,C=typeof window>"u"?800:window.innerHeight,T=g/2,_=C/2;if(r.kind==="goal")return{x:T-220,y:90,z:5,rotation:-1.2};if(r.kind==="document")return{x:T-240,y:_-220,z:4,rotation:.4};if(r.kind==="cost")return{x:g-130,y:90,z:6,rotation:2};if(r.kind==="clock")return{x:g-440,y:C-240,z:7,rotation:-1.5};if(r.kind==="cabinet")return{x:30,y:C-280,z:3,rotation:0};if(r.kind==="trash")return{x:g-130,y:C-220,z:13,rotation:0};if(r.kind==="question")return{x:T+120,y:200,z:30,rotation:-3};if(r.kind==="agent"){const S=s.filter(O=>O.kind==="agent").findIndex(O=>O.id===r.id),z=S%2,P=Math.floor(S/2);return{x:g-280+z*20,y:200+P*180+z*30,z:10+S,rotation:(S%2===0?-1:1)*(1.5+S*.5)}}if(r.kind==="file"){const S=s.filter(O=>O.kind==="file").findIndex(O=>O.id===r.id),z=S%2,P=Math.floor(S/2);return{x:60+z*30,y:180+P*180+z*25,z:8+S,rotation:(S%2===0?1:-1)*(2+S*.3)}}if(r.kind==="fact"){const S=s.filter(O=>O.kind==="fact").findIndex(O=>O.id===r.id),z=S%3,P=Math.floor(S/3);return{x:T-160+z*100+(P%2===0?0:25),y:C-280+P*80,z:12+S,rotation:(S%2===0?-1:1)*(4+S*.7)}}if(r.kind==="activity"){const S=s.filter(q=>q.kind==="activity").findIndex(q=>q.id===r.id),z=Math.max(4,Math.floor((g-120)/180)),P=S%z,O=Math.floor(S/z);return{x:40+P*180+(O%2===0?0:40),y:C-200-O*110,z:14+S,rotation:(S%2===0?-1:1)*(2+S*.3)}}return{x:100,y:100,z:1,rotation:0}},[]),ae=o.useCallback(r=>c[r.id]??Y(r,D),[c,D,Y]),X=o.useCallback((r,s)=>{const g={...c,[r]:s};k(g)},[c,k]),pe=o.useCallback(r=>{const s=Math.max(0,...D.map(C=>(c[C.id]??Y(C,D)).z)),g=c[r]??Y(D.find(C=>C.id===r),D);g.z>=s||X(r,{...g,z:s+1})},[D,c,Y,X]),ge=o.useCallback(()=>{t&&k({})},[t,k]),me=o.useCallback((r,s,g)=>{N({...p,cabinet:p.cabinet.filter(S=>S!==r),trash:p.trash.filter(S=>S!==r)});const C=Math.max(0,...D.map(S=>(c[S.id]??Y(S,D)).z)),T=c[r],_=(T==null?void 0:T.rotation)??Math.random()*6-3;X(r,{x:s-80,y:g-20,z:C+1,rotation:_})},[p,N,D,c,Y,X]);if(x)return e.jsx("div",{className:"fixed inset-0 flex items-center justify-center text-sm",style:{background:"var(--theme-bg-base, #3a2a1c)",color:"var(--theme-paper-fg, #f3e9d0)"},children:"Setting the desk…"});if(f||!n)return e.jsxs("div",{className:"fixed inset-0 flex items-center justify-center flex-col gap-3",style:{background:"var(--theme-bg-base, #3a2a1c)"},children:[e.jsx("div",{className:"text-[#ffb4a2] text-sm",children:f??"Mission not found."}),e.jsx("button",{onClick:()=>a("/mission"),className:"text-sm hover:underline",style:{color:"var(--theme-paper-fg, #f3e9d0)"},children:"← Start a new mission"})]});const{working:re,blocked:ne}=ce(n);return e.jsxs("div",{className:"fixed inset-0 overflow-hidden font-sans",style:{...nt,color:"var(--theme-paper-fg, #f3e9d0)",fontFamily:"var(--theme-font-display, ui-sans-serif, system-ui)"},children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:st}),e.jsx("div",{className:"pointer-events-none absolute inset-0",style:it}),e.jsxs("header",{className:"relative z-30 flex items-center justify-between px-5 py-3.5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>a("/mission"),className:"hover:text-white text-sm",style:{color:"var(--theme-metal-bright, #e7d6a8)"},title:"New mission",children:"←"}),e.jsx("button",{onClick:()=>a("/mission/library"),className:"text-[10px] uppercase tracking-widest hover:text-white rounded-full px-2 py-0.5",style:{color:"var(--theme-ink-soft, #d9c08c)",border:"1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))"},title:"Browse past missions",children:"Library"}),e.jsx("button",{onClick:()=>a("/space/home"),className:"text-[10px] uppercase tracking-widest hover:text-white rounded-full px-2 py-0.5 inline-flex items-center gap-1",style:{color:"var(--theme-ink-soft, #d9c08c)",border:"1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))"},title:"Back to the canvas spaces",children:"🌌 Canvas"}),e.jsxs("div",{className:"font-semibold tracking-tight",style:{color:"var(--theme-paper-fg, #f3e9d0)"},children:[e.jsx("span",{style:{background:"linear-gradient(90deg, var(--theme-metal-bright, #f3d27a), var(--theme-metal, #d8a85a))",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"},children:"TITAN"}),e.jsx("span",{className:"font-normal",style:{color:"var(--theme-ink-soft, #d9c08c)"},children:"  ›  "}),e.jsx("span",{className:"font-normal",style:{color:"var(--theme-metal-bright, #e7d6a8)"},children:"Desk"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs",style:{background:"var(--theme-leather, rgba(42,29,17,0.7))",border:"1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))"},children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${ne>0?"bg-error animate-pulse":re>0?"bg-accent animate-pulse":"bg-success"}`}),e.jsx("span",{style:{color:"var(--theme-metal-bright, #e7d6a8)"},children:ct(n.status,re,ne)})]}),n.longRunningMode&&e.jsx("div",{className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-semibold",style:{background:"linear-gradient(90deg, rgba(245,210,122,0.18), rgba(176,138,58,0.18))",border:"1px solid var(--theme-metal-dark, #b08a3a)",color:"var(--theme-metal-bright, #ffd86e)"},title:"Marathon mode — long-running multi-agent collaboration (72h cap)",children:"🏃 Marathon"}),e.jsx("button",{onClick:ge,className:"px-3 py-1.5 text-xs rounded-full hover:text-white",style:{background:"var(--theme-leather, rgba(42,29,17,0.7))",border:"1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))",color:"var(--theme-metal-bright, #e7d6a8)"},title:"Reset every item to a sensible starting position",children:"Tidy up"}),e.jsx("button",{onClick:()=>a(`/mission/${n.id}`),className:"px-3 py-1.5 text-xs rounded-full hover:text-white",style:{background:"var(--theme-leather, rgba(42,29,17,0.7))",border:"1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))",color:"var(--theme-metal-bright, #e7d6a8)"},title:"Switch to the chat thread view",children:"Chat view"}),e.jsx("button",{onClick:xe,className:"px-3 py-1.5 text-xs rounded-full hover:text-white",style:{background:"var(--theme-leather, rgba(42,29,17,0.7))",border:"1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))",color:"var(--theme-metal-bright, #e7d6a8)"},children:n.status==="paused"?"Resume":"Pause"}),e.jsx("button",{onClick:ue,className:"px-3 py-1.5 text-xs rounded-full hover:text-[#ff9c9c] hover:border-[#ff9c9c]/50 transition-colors",style:{background:"var(--theme-leather, rgba(42,29,17,0.7))",border:"1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))",color:"var(--theme-ink-soft, #d9c08c)"},title:"Delete this mission",children:"🗑 Delete"}),e.jsx("button",{onClick:()=>h(r=>!r),className:"w-8 h-8 rounded-full hover:text-white font-semibold text-sm flex items-center justify-center",style:{background:"var(--theme-leather, rgba(42,29,17,0.7))",border:"1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))",color:"var(--theme-metal-bright, #e7d6a8)"},title:"What's this?",children:"?"})]})]}),e.jsx(lt,{items:D,room:n,poseOf:ae,isHidden:Z}),e.jsx("div",{className:"absolute inset-0 z-10 pointer-events-none",children:D.map(r=>{if(Z(r.id))return null;const s=ae(r),g=r.kind==="agent",C=r.kind==="file"||r.kind==="fact"||r.kind==="activity";return e.jsx(Be,{pose:s,onGrab:()=>pe(r.id),onPose:T=>X(r.id,T),onClick:g?(T,_)=>R({agentId:r.ref,anchor:{x:T,y:_}}):void 0,onDrop:C?T=>he(r.id,T):void 0,children:e.jsx(Ye,{item:r,room:n,openQuestion:W,fileSources:H,factSources:K,activityStickies:G,furniture:p,onOpenCabinet:ee,onOpenTrash:te,onOpenFile:$,onAnswer:V})},r.id)})}),p.cabinetOpen&&e.jsx(at,{itemIds:p.cabinet,items:D,fileSources:H,factSources:K,activityStickies:G,onRestore:Q,onRestoreAt:me,onOpenFile:$,onClose:ee}),p.trashOpen&&e.jsx(rt,{itemIds:p.trash,items:D,fileSources:H,factSources:K,activityStickies:G,onRestore:Q,onDeleteForever:fe,onClose:te}),F&&(()=>{const r=n.team.find(g=>g.agentId===F.agentId);if(!r)return null;const s=A.map(g=>({id:g.id,label:g.name,provider:g.provider}));return e.jsx(Te,{member:r,room:n,anchor:F.anchor,availableModels:s,onClose:()=>R(null)})})(),e.jsxs("footer",{className:"absolute left-0 right-0 bottom-0 z-30 px-5 pb-5 pt-3 flex flex-col gap-2",style:{background:"linear-gradient(to top, var(--theme-leather-edge, rgba(29,19,10,0.95)), transparent)"},children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 max-w-5xl mx-auto w-full",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-widest",style:{color:"var(--theme-ink-soft, #d9c08c)"},children:"quick steer"}),ze.map(r=>e.jsx("button",{onClick:()=>B(r.cmd),disabled:u,title:r.hint,className:"px-2.5 py-1 text-[11px] rounded-full hover:text-white disabled:opacity-50",style:{color:"var(--theme-metal-bright, #e7d6a8)",background:"var(--theme-leather, rgba(42,29,17,0.7))",border:"1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))"},children:r.label},r.cmd))]}),e.jsx("div",{className:"flex items-center gap-3 max-w-5xl mx-auto w-full",children:e.jsxs("form",{onSubmit:r=>{r.preventDefault(),B(y)},className:"flex-1 h-11 flex items-center gap-2.5 px-3.5 rounded-full",style:{background:"var(--theme-leather, rgba(42,29,17,0.8))",border:"1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))"},children:[e.jsx("input",{value:y,onChange:r=>v(r.target.value),placeholder:'Tell the team — "Add a one-line risk note at the top"',className:"flex-1 bg-transparent outline-none text-sm placeholder:text-[#d9c08c]/50",style:{color:"var(--theme-paper-fg, #f3e9d0)"}}),e.jsx("span",{className:"px-2 py-1 text-[10px] uppercase tracking-widest rounded",style:{color:"var(--theme-ink-soft, #d9c08c)",border:"1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))"},children:"↵"})]})}),e.jsx("div",{className:"max-w-5xl mx-auto w-full text-center text-[11px] italic",style:{color:"var(--theme-ink-soft, #d9c08c)",opacity:.7},children:"Your team works independently, but asks before risky or sensitive changes."})]}),L&&e.jsx(De,{state:L,onClose:()=>w(null)}),l&&e.jsxs("div",{className:"fixed top-16 right-5 w-80 rounded-xl p-4 backdrop-blur-xl shadow-2xl z-40",style:{background:"var(--theme-leather, rgba(42,29,17,0.95))",border:"1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))"},children:[e.jsx("button",{onClick:()=>h(!1),className:"absolute top-3 right-3 hover:text-white text-sm",style:{color:"var(--theme-ink-soft, #d9c08c)"},children:"✕"}),e.jsx("h3",{className:"font-semibold text-sm mb-2",style:{color:"var(--theme-paper-fg, #f3e9d0)"},children:"The desk"}),e.jsxs("p",{className:"text-xs leading-relaxed mb-3",style:{color:"var(--theme-metal-bright, #e7d6a8)"},children:["Everything the team produces lands on this desk as a physical object. Drag anything anywhere. ",e.jsx("b",{children:"Tidy up"})," resets the layout if it gets cluttered."]}),e.jsxs("ul",{className:"space-y-2 text-xs",style:{color:"var(--theme-metal-bright, #e7d6a8)"},children:[e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{children:"📜"}),e.jsxs("span",{children:[e.jsx("b",{className:"text-white",children:"Leather placard"})," — your mission goal."]})]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{children:"📄"}),e.jsxs("span",{children:[e.jsx("b",{className:"text-white",children:"Paper sheets"})," — files the team wrote. Double-click to open."]})]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{children:"👤"}),e.jsxs("span",{children:[e.jsx("b",{className:"text-white",children:"Index cards"})," — each AI helper, showing what they're doing now."]})]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{children:"💡"}),e.jsxs("span",{children:[e.jsx("b",{className:"text-white",children:"Sticky notes"})," — facts the team picked up while working."]})]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{children:"📕"}),e.jsxs("span",{children:[e.jsx("b",{className:"text-white",children:"Pink card"})," — a question waiting on you."]})]})]})]}),e.jsx("style",{children:ot})]})}function Be({pose:t,onGrab:a,onPose:n,onClick:i,onDrop:x,children:m}){const[f,d]=o.useState(null),y=f?{x:f.x,y:f.y}:{x:t.x,y:t.y},v=o.useCallback(u=>{if(u.target.closest("[data-no-drag]"))return;u.preventDefault(),a();const l=u.clientX,h=u.clientY,c=t.x,j=t.y;d({dx:0,dy:0,x:c,y:j});const k=M=>{const N=M.clientX-l,A=M.clientY-h;d({dx:N,dy:A,x:c+N,y:j+A})},p=M=>{const N=M.clientX-l,A=M.clientY-h;window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",p);const E=c+N,F=j+A;if(d(null),!(Math.abs(N)>4||Math.abs(A)>4)){i&&i(M.clientX,M.clientY);return}if(x){const L=document.elementsFromPoint(M.clientX,M.clientY);for(const w of L){const $=w.closest("[data-drop-target]");if(!$||$.contains(u.currentTarget))continue;const B=$.getAttribute("data-drop-target");if(B){if(x(B)!==!1)return;break}}}n({...t,x:E,y:F})};window.addEventListener("mousemove",k),window.addEventListener("mouseup",p)},[t,a,n,i,x]);return e.jsx("div",{onMouseDown:v,className:"absolute select-none pointer-events-auto cursor-grab active:cursor-grabbing",style:{left:y.x,top:y.y,zIndex:f?999:t.z,transform:`rotate(${t.rotation}deg) ${f?"scale(1.03)":""}`,transition:f?"transform 80ms ease-out":"transform 200ms ease-out",filter:f?"drop-shadow(0 22px 32px rgba(0,0,0,0.55))":"drop-shadow(0 6px 14px rgba(0,0,0,0.42))",willChange:f?"left, top":void 0},children:m})}function Ye({item:t,room:a,openQuestion:n,fileSources:i,factSources:x,activityStickies:m,furniture:f,onOpenCabinet:d,onOpenTrash:y,onOpenFile:v,onAnswer:u}){if(t.kind==="goal")return e.jsx(Ie,{goal:a.goal,status:a.status});if(t.kind==="document")return e.jsx(We,{room:a});if(t.kind==="cost")return e.jsx(Ge,{room:a});if(t.kind==="clock")return e.jsx(Ke,{room:a});if(t.kind==="cabinet")return e.jsx(et,{count:f.cabinet.length,onOpen:d});if(t.kind==="trash")return e.jsx(tt,{count:f.trash.length,onOpen:y});if(t.kind==="agent"){const b=a.team.find(l=>l.agentId===t.ref);return b?e.jsx(_e,{member:b}):null}if(t.kind==="file"){const b=i.find(l=>l.ref===t.ref);return b?e.jsx(Ue,{file:b,onOpen:()=>v(b.ref)}):null}if(t.kind==="fact"){const b=x.find(l=>l.ref===t.ref);return b?e.jsx(Je,{fact:b}):null}if(t.kind==="activity"){const b=m.find(l=>l.id===t.ref);return b?e.jsx(Ve,{sticky:b}):null}return t.kind==="question"&&n?e.jsx(Qe,{msg:n,onAnswer:b=>u(n.approvalId,b)}):null}function Ie({goal:t,status:a}){const n={forming:{text:"forming the team…",dotColor:"#c4a14a",dotGlow:"#c4a14a"},working:{text:"in progress — TITAN",dotColor:"#8ed1ff",dotGlow:"#8ed1ff"},paused:{text:"paused — your call",dotColor:"#d9c08c",dotGlow:"#d9c08c"},blocked:{text:"needs your input",dotColor:"#ff9c9c",dotGlow:"#ff9c9c"},done:{text:"complete · signed off",dotColor:"#22c55e",dotGlow:"#22c55e"},failed:{text:"stopped — see chat",dotColor:"#ef4444",dotGlow:"#ef4444"}},i=n[a]??n.working;return e.jsxs("div",{className:"w-[420px] px-5 py-4 relative",style:{background:"linear-gradient(140deg, var(--theme-leather, #6b2c2a) 0%, var(--theme-leather-edge, #4a1816) 60%, var(--theme-bolt, #3b110f) 100%)",border:"1px solid var(--theme-bolt, #2a0908)",borderRadius:10,boxShadow:"inset 0 0 24px var(--theme-shadow, rgba(0,0,0,0.5)), 0 0 0 4px rgba(0,0,0,0.08), 0 0 32px color-mix(in srgb, var(--theme-accent, #c45a30) 28%, transparent)",backgroundBlendMode:"multiply",color:"var(--theme-paper-fg, #f3e9d0)"},children:[e.jsx("div",{className:"text-[10px] uppercase mb-1.5",style:{letterSpacing:"0.16em",color:"var(--theme-ink-soft, #d9c08c)",fontWeight:600},children:"Active Mission"}),e.jsx("div",{className:"leading-snug font-semibold tracking-tight",style:{fontSize:22,color:"var(--theme-paper-fg, #f3e9d0)"},children:t}),e.jsxs("div",{className:"mt-2 flex items-center gap-2 text-[10px] uppercase tracking-widest",style:{color:"var(--theme-ink-soft, rgba(217,192,140,0.7))"},children:[e.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${a==="working"||a==="blocked"||a==="forming"?"animate-pulse":""}`,style:{background:i.dotColor,boxShadow:`0 0 6px ${i.dotGlow}`}}),e.jsx("span",{children:i.text})]})]})}function We({room:t}){var v;const a=((v=t.artifact)==null?void 0:v.content)??"",n=o.useRef(a.length),[i,x]=o.useState(!1);o.useEffect(()=>{if(a.length>n.current){x(!0);const u=setTimeout(()=>x(!1),2e3);return n.current=a.length,()=>clearTimeout(u)}n.current=a.length},[a]);const m=o.useMemo(()=>a.split(`
6
+ `).filter(b=>b.trim().length>0).slice(0,10),[a]),f=a.trim().split(/\s+/).filter(Boolean).length,d=t.team.some(u=>u.state==="working"||u.state==="editing"),y=d&&t.team.some(u=>(u.state==="working"||u.state==="editing")&&(u.name.toLowerCase().includes("analyst")||(u.role??"").toLowerCase().includes("analyst")));return e.jsxs("div",{className:"w-[620px] max-w-[92vw] rounded-md p-8 pt-7 relative",style:{background:"var(--theme-paper, #f7f5ee)",color:"var(--theme-ink, #1a1f2e)",fontFamily:'var(--theme-font-display, "Iowan Old Style", "Charter", "Georgia", serif)',backgroundImage:"repeating-linear-gradient(180deg, transparent 0 26px, var(--theme-paper-line, #d8d3c2) 26px 27px)",backgroundPosition:"0 56px",boxShadow:"0 18px 40px var(--theme-shadow, rgba(0,0,0,0.45)), 0 6px 14px var(--theme-shadow, rgba(0,0,0,0.35)), 0 0 0 1px color-mix(in srgb, var(--theme-accent, #c45a30) 12%, transparent)"},children:[e.jsx("h1",{className:"text-[22px] font-semibold tracking-tight leading-tight mb-1",children:ut(t.goal,70)}),e.jsxs("div",{className:"text-[11px] uppercase tracking-widest mb-4 flex items-center gap-2",style:{color:"var(--theme-ink-soft, #8a8472)"},children:[e.jsxs("span",{children:["Draft · ",f," words · ",xt(t.status)]}),i&&d&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse",style:{background:"var(--theme-accent, #c4a35a)"}}),e.jsx("span",{className:"text-[10px] italic",children:"Writing…"})]})]}),m.length>0?e.jsx("div",{className:"text-[14px] leading-[1.6] space-y-3",children:m.map((u,b)=>e.jsxs("p",{children:[u,i&&d&&b===m.length-1&&e.jsx("span",{className:"inline-block w-0.5 h-3.5 ml-0.5 align-middle animate-pulse",style:{background:"var(--theme-accent, #c4a35a)"}})]},b))}):e.jsx("div",{className:"text-[12px] italic py-6 text-center",style:{color:"var(--theme-ink-soft, #8a8472)"},children:"The team is just getting started — your document fills in as they work."}),y&&e.jsx(He,{})]})}function He(){return e.jsxs("div",{className:"mt-5 pt-4",style:{borderTop:"1px dashed var(--theme-paper-line, #d8d3c2)"},children:[e.jsxs("svg",{viewBox:"0 0 320 110",className:"w-full h-[110px]","aria-hidden":!0,style:{overflow:"visible"},children:[e.jsx("line",{x1:"22",y1:"6",x2:"22",y2:"92",stroke:"var(--theme-ink-soft, #8a8472)",strokeWidth:"1",opacity:"0.5"}),e.jsx("line",{x1:"22",y1:"92",x2:"312",y2:"92",stroke:"var(--theme-ink-soft, #8a8472)",strokeWidth:"1",opacity:"0.5"}),[20,44,68].map(t=>e.jsx("line",{x1:"18",y1:t,x2:"22",y2:t,stroke:"var(--theme-ink-soft, #8a8472)",strokeWidth:"1",opacity:"0.35"},t)),[{x:40,h:52},{x:82,h:68},{x:124,h:32},{x:166,h:78},{x:208,h:46},{x:250,h:62},{x:292,h:40}].map((t,a)=>e.jsx("rect",{x:t.x-12,y:92-t.h,width:24,height:t.h,fill:"none",stroke:"var(--theme-accent, #c45a30)",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.55",style:{animation:"tetherFlow 2.4s linear infinite"}},a))]}),e.jsx("div",{className:"text-[11px] italic mt-1 text-center",style:{color:"var(--theme-ink-soft, #8a8472)"},children:"Analyst computing…"})]})}function Ge({room:t}){return e.jsxs("div",{className:"w-[110px] h-[110px] rounded-full flex flex-col items-center justify-center",style:{background:"radial-gradient(circle at 35% 30%, var(--theme-leather, #2b1a14) 0%, var(--theme-leather-edge, #1a0e08) 70%)",boxShadow:"inset 0 0 18px var(--theme-shadow, rgba(0,0,0,0.6)), 0 0 0 5px var(--theme-metal-dark, #6e4a26), 0 0 0 6px var(--theme-bolt, #382213)",color:"var(--theme-paper-fg, #f3e9d0)"},title:"Tokens + dollars spent this mission",children:[e.jsx("span",{className:"text-[9px] uppercase tracking-widest",style:{color:"var(--theme-ink-soft, #d9c08c)"},children:"spent"}),e.jsxs("span",{className:"text-[20px] font-bold tabular-nums",children:["$",t.cost.usd.toFixed(2)]}),e.jsxs("span",{className:"text-[9px] tabular-nums",style:{color:"var(--theme-ink-soft, rgba(217,192,140,0.8))"},children:[(t.cost.tokens/1e3).toFixed(1),"k tok"]})]})}function Ke({room:t}){const[a,n]=o.useState(()=>new Date);o.useEffect(()=>{const h=setInterval(()=>n(new Date),1e3);return()=>clearInterval(h)},[]);const i=String(a.getHours()).padStart(2,"0"),x=String(a.getMinutes()).padStart(2,"0"),m=String(a.getSeconds()).padStart(2,"0"),f=o.useMemo(()=>{try{const h=new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(new Date).find(c=>c.type==="timeZoneName");return(h==null?void 0:h.value)??""}catch{return""}},[]),d=o.useMemo(()=>new Date(t.createdAt).getTime(),[t.createdAt]),y=t.status==="paused"||t.status==="done"||t.status==="failed",v=y?Math.max(0,new Date(t.updatedAt).getTime()-d):Math.max(0,a.getTime()-d),u=Xe(v),{working:b,blocked:l}=ce(t);return e.jsxs("div",{className:"w-[260px] p-4 pb-3",style:{background:"radial-gradient(ellipse at 30% 25%, var(--theme-leather, #4a2e18) 0%, var(--theme-bolt, #2a1808) 75%, var(--theme-leather-edge, #1a0e04) 100%)",borderRadius:14,boxShadow:"0 0 0 3px var(--theme-metal-dark, #b08a3a), 0 0 0 5px var(--theme-bolt, #5a3a14), 0 12px 22px var(--theme-shadow, rgba(0,0,0,0.5)), inset 0 0 16px rgba(0,0,0,0.6)",color:"var(--theme-metal-bright, #f5d27a)"},children:[e.jsxs("div",{className:"text-[9px] uppercase tracking-[0.28em] text-center mb-1.5",style:{color:"var(--theme-metal, #c4a14a)"},children:["TITAN",f?" · "+f:""]}),e.jsxs("div",{className:"flex items-baseline justify-center gap-1 mb-1",style:{fontFamily:'"DSEG7 Classic", "Orbitron", "Menlo", monospace',textShadow:"0 0 10px rgba(245,210,122,0.65), 0 0 22px rgba(245,210,122,0.35)"},children:[e.jsx(oe,{value:i}),e.jsx("span",{className:"text-[28px] font-bold opacity-80 -translate-y-0.5 animate-pulse",children:":"}),e.jsx(oe,{value:x}),e.jsx("span",{className:"text-[20px] font-bold opacity-60 -translate-y-0.5",children:":"}),e.jsx("span",{className:"text-[24px] font-bold opacity-80 tabular-nums",children:m})]}),e.jsxs("div",{className:"text-center text-[10px] uppercase tracking-[0.22em] mb-1.5",style:{fontFamily:"system-ui",color:"var(--theme-metal, rgba(196,161,74,0.85))"},children:["Mission · ",u.hh,":",u.mm,":",u.ss,y&&e.jsxs("span",{className:"ml-1.5",style:{color:"var(--theme-ink-soft, rgba(217,192,140,0.7))"},children:["· ",t.status]})]}),e.jsxs("div",{className:"flex items-center justify-center gap-3 pt-2",style:{fontFamily:"system-ui",borderTop:"1px solid var(--theme-bolt, rgba(90,58,20,0.6))"},children:[e.jsx(U,{n:b,label:"working",tone:"accent"}),e.jsx(U,{n:l,label:l===1?"needs you":"need you",tone:"warn"}),e.jsx(U,{n:t.team.length,label:"on team",tone:"muted"})]})]})}function oe({value:t}){return e.jsx("span",{className:"text-[34px] font-bold tabular-nums leading-none",children:t})}function U({n:t,label:a,tone:n}){const i=n==="accent"?"#8ed1ff":n==="warn"?"#ff9c9c":"var(--theme-metal, #c4a14a)";return e.jsxs("div",{className:"flex flex-col items-center leading-tight",children:[e.jsx("span",{className:"text-[18px] font-bold tabular-nums",style:{color:i},children:t}),e.jsx("span",{className:"text-[9px] uppercase tracking-widest",style:{color:"var(--theme-metal, rgba(196,161,74,0.8))"},children:a})]})}function Xe(t){const a=Math.floor(t/1e3),n=String(Math.floor(a/3600)).padStart(2,"0"),i=String(Math.floor(a%3600/60)).padStart(2,"0"),x=String(a%60).padStart(2,"0");return{hh:n,mm:i,ss:x}}function _e({member:t}){const a=t.state==="blocked",n=t.state==="editing",i=t.state==="working",x=t.state==="done",m=i||n,f=qe(t.color,a),d=m?`${t.agentId.charCodeAt(0)%10*.34}s`:"0s",y=a?"stickyBreatheUrgent 1.2s ease-in-out infinite":i?"stickyBreathe 1.8s ease-in-out infinite":n?"stickyBreathe 2.4s ease-in-out infinite":"none",v=x?.65:1,u=pt(t.state),b=t.currentActivity??(x?"wrapped up":a?"awaiting your call":"standing by");return e.jsxs("div",{className:"w-[220px] p-3.5 pt-5 text-[#2a2418] relative",style:{background:f,boxShadow:"0 1px 0 rgba(255,255,255,0.55) inset, 0 12px 18px rgba(0,0,0,0.42)",fontFamily:'"Bradley Hand", "Marker Felt", "Comic Sans MS", cursive',animation:y,animationDelay:d,opacity:v,transition:"opacity 400ms ease-out"},children:[e.jsx("div",{className:"absolute -top-1.5 left-1/2 -translate-x-1/2 w-20 h-4 opacity-70 pointer-events-none",style:{background:"linear-gradient(180deg, rgba(255,255,255,0.75), rgba(255,255,255,0.25))",boxShadow:"0 1px 2px rgba(0,0,0,0.15)"}}),e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("div",{className:"w-7 h-7 rounded-md flex items-center justify-center text-white font-bold text-[13px]",style:{background:`linear-gradient(135deg, ${t.color}, ${gt(t.color,-25)})`,boxShadow:`0 2px 6px ${t.color}55`,fontFamily:"system-ui"},children:t.name[0]}),e.jsxs("div",{className:"leading-tight",children:[e.jsx("div",{className:"font-semibold text-[15px] text-[#2a2418]",children:t.name}),e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-[#6b5a3a]",style:{fontFamily:"system-ui"},children:t.role})]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1 text-[10px] text-[#6b5a3a]",style:{fontFamily:"system-ui"},children:[x?e.jsx("span",{className:"text-[12px] leading-none","aria-label":"done",children:"✓"}):e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${ht(t.state)}`,style:{boxShadow:`0 0 6px ${ft(t.state)}`}}),e.jsx("span",{children:u})]})]}),e.jsx("div",{className:"text-[14px] text-[#2a2418] leading-snug min-h-[2.4rem] break-words",children:t.currentActivity??e.jsx("span",{className:"italic text-[#6b5a3a]",children:b})}),(m||a)&&e.jsx("div",{className:"absolute -inset-1 -z-10 pointer-events-none rounded-[2px] blur-md",style:{background:a?"radial-gradient(circle at 50% 50%, rgba(239,68,68,0.6), transparent 70%)":`radial-gradient(circle at 30% 30%, ${t.color}55, transparent 70%)`,animation:a?"deskAlarm 1.2s ease-in-out infinite":"deskGlow 4.2s ease-in-out infinite"}})]})}function qe(t,a){if(a)return"linear-gradient(165deg, #ffd6d6 0%, #ffbaba 100%), linear-gradient(45deg, transparent 49%, rgba(0,0,0,0.04) 49% 51%, transparent 51%)";const n=t.toLowerCase();return n.includes("6366f1")||n.includes("8b5cf6")?"linear-gradient(160deg, #e7e1ff 0%, #cfc4ff 100%)":n.includes("22c55e")||n.includes("10b981")?"linear-gradient(160deg, #d9f7d9 0%, #b8edb8 100%)":n.includes("f59e0b")||n.includes("eab308")?"linear-gradient(160deg, #fff2a8 0%, #ffe88a 100%)":n.includes("ef4444")||n.includes("f97316")?"linear-gradient(160deg, #ffd6c2 0%, #ffbf9e 100%)":n.includes("06b6d4")||n.includes("0ea5e9")?"linear-gradient(160deg, #cef3f7 0%, #a8e4ec 100%)":"linear-gradient(160deg, #fff2a8 0%, #ffe88a 100%)"}function Ue({file:t,onOpen:a}){const n=o.useMemo(()=>{const i=t.ref.lastIndexOf("/");return i>=0?t.ref.slice(i+1):t.ref},[t.ref]);return e.jsxs("div",{onDoubleClick:a,title:"Double-click to open",className:"w-[200px] p-3",style:{background:"linear-gradient(170deg, var(--theme-paper, #fdfbf3) 0%, var(--theme-paper, #f1eada) 100%)",color:"var(--theme-ink, #1a1f2e)",borderRadius:4,boxShadow:"0 1px 0 rgba(255,255,255,0.6) inset, 0 0 0 1px rgba(0,0,0,0.06)"},children:[e.jsx("div",{className:"absolute top-0 right-0 w-4 h-4",style:{background:"linear-gradient(225deg, var(--theme-paper-line, #d8cdb3) 0%, var(--theme-paper, #f1eada) 50%, transparent 50%)",borderBottomLeftRadius:4}}),e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx("span",{className:"text-base leading-none",children:t.type==="report"?"📊":"📄"}),e.jsx("span",{className:"text-[9px] uppercase tracking-widest",style:{color:"var(--theme-ink-soft, #8a8472)"},children:t.type})]}),e.jsx("div",{className:"font-semibold text-[12px] leading-tight break-words",style:{color:"var(--theme-ink, #1a1f2e)"},children:n}),t.description&&e.jsx("div",{className:"text-[10px] mt-1 leading-snug line-clamp-2",style:{color:"var(--theme-ink-soft, #5a5240)"},children:t.description}),e.jsx("button",{"data-no-drag":!0,onClick:a,className:"mt-2 w-full px-2 py-1 text-[10px] font-semibold uppercase tracking-widest rounded",style:{background:"var(--theme-ink, #1a1f2e)",color:"var(--theme-paper-fg, #f3e9d0)"},children:"Open ↗"})]})}function Je({fact:t}){const a=t.description??t.ref;return e.jsxs("div",{className:"w-[160px] p-3",style:{background:"linear-gradient(160deg, var(--theme-sticky-yellow, #fff2a8) 0%, var(--theme-sticky-yellow, #ffe88a) 100%)",boxShadow:"0 1px 0 rgba(255,255,255,0.5) inset, 0 8px 14px var(--theme-shadow, rgba(0,0,0,0.35))",fontFamily:'"Bradley Hand", "Comic Sans MS", cursive',color:"var(--theme-ink, #3a2e10)"},children:[e.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2 w-12 h-3.5 opacity-60",style:{background:"linear-gradient(180deg, var(--theme-sticky-tape, rgba(255,255,255,0.65)), rgba(255,255,255,0.25))"}}),e.jsx("div",{className:"text-[12px] leading-snug",children:a})]})}function Ve({sticky:t}){const a=Ze(t.agentColor);return e.jsxs("div",{className:"w-[170px] p-2.5 relative",title:`${t.agentName} ${t.activity}${t.detail?": "+t.detail:""} · ${new Date(t.at).toLocaleTimeString()}`,style:{background:a,boxShadow:"0 1px 0 rgba(255,255,255,0.55) inset, 0 6px 10px var(--theme-shadow, rgba(0,0,0,0.32))",fontFamily:'"Bradley Hand", "Marker Felt", "Comic Sans MS", cursive',color:"var(--theme-ink, #2a2418)"},children:[e.jsx("div",{className:"absolute -top-1.5 left-1/2 -translate-x-1/2 w-10 h-3 opacity-60 pointer-events-none",style:{background:"linear-gradient(180deg, var(--theme-sticky-tape, rgba(255,255,255,0.7)), rgba(255,255,255,0.25))"}}),e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("span",{className:"text-base leading-none",children:t.icon}),e.jsx("span",{className:"text-[10px] uppercase tracking-widest truncate",style:{fontFamily:"system-ui",color:"var(--theme-ink-soft, #6b5a3a)"},children:t.agentName})]}),e.jsx("div",{className:"text-[12px] leading-snug",children:t.activity}),t.detail&&e.jsx("div",{className:"text-[11px] mt-1 leading-snug break-words line-clamp-3",style:{color:"var(--theme-ink-soft, #5a4818)"},children:t.detail})]})}function Ze(t){const a=t.toLowerCase();return a.includes("6366f1")||a.includes("8b5cf6")?"linear-gradient(160deg, #efeaff 0%, #e0d5ff 100%)":a.includes("22c55e")||a.includes("10b981")||a.includes("4adbb5")?"linear-gradient(160deg, #e7faea 0%, #cef0d4 100%)":a.includes("f59e0b")||a.includes("eab308")||a.includes("ff9a4a")?"linear-gradient(160deg, #fff8c8 0%, #ffefa3 100%)":a.includes("ef4444")||a.includes("f97316")||a.includes("ff5d6c")?"linear-gradient(160deg, #ffe2d4 0%, #ffcfba 100%)":a.includes("06b6d4")||a.includes("0ea5e9")||a.includes("6ea8ff")?"linear-gradient(160deg, #e0f5fa 0%, #c5e9f1 100%)":"linear-gradient(160deg, #fff8c8 0%, #ffefa3 100%)"}function Qe({msg:t,onAnswer:a}){const[n,i]=o.useState(!1),[x,m]=o.useState(""),f=o.useRef(null);return o.useEffect(()=>{n&&f.current&&f.current.focus()},[n]),e.jsxs("div",{className:"w-[300px] p-4 rounded-xl",style:{background:"linear-gradient(180deg, var(--theme-sticky-pink, #ffe9eb), var(--theme-sticky-pink, #ffd0d4))",boxShadow:"0 18px 36px rgba(255,93,108,0.45), 0 0 0 1.5px var(--theme-accent, rgba(196,90,48,0.6)), 0 0 0 4px rgba(255,93,108,0.12)",animation:"questionLift 4s ease-in-out infinite",color:"#5c1820",transform:"translateY(-10px)"},children:[e.jsx("div",{className:"absolute -top-2 -right-2 w-5 h-5 rounded-full",style:{background:"radial-gradient(circle at 35% 30%, var(--theme-metal-bright, #ffd86e) 0%, var(--theme-metal-dark, #b07a1a) 70%, var(--theme-bolt, #6a4710) 100%)",boxShadow:"0 2px 4px var(--theme-shadow, rgba(0,0,0,0.5))"}}),e.jsxs("div",{className:"text-[10px] uppercase mb-1.5",style:{letterSpacing:"0.16em",color:"rgba(92,24,32,0.7)",fontWeight:600},children:[t.from.name," asks"]}),e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 mb-2 bg-[#5c1820] text-[#ffd0d4] text-[10px] uppercase tracking-widest font-bold rounded-full",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-white animate-pulse"}),"TITAN paused — your call."]}),e.jsx("div",{className:"text-[13px] leading-snug",children:t.content}),n?e.jsxs("div",{className:"mt-3",children:[e.jsx("textarea",{ref:f,"data-no-drag":!0,value:x,onChange:d=>m(d.target.value),onKeyDown:d=>{if(d.key==="Enter"&&(d.metaKey||d.ctrlKey)){d.preventDefault();const y=x.trim();y&&a(y)}else d.key==="Escape"&&i(!1)},rows:2,placeholder:"Your answer…",className:"w-full bg-white/90 border border-[rgba(160,41,56,0.25)] rounded-lg p-2 text-[12px] text-[#5c1820] outline-none"}),e.jsxs("div",{className:"flex items-center justify-end gap-2 mt-1",children:[e.jsx("button",{"data-no-drag":!0,onClick:()=>i(!1),className:"text-[10px] text-[#5c1820]/70 hover:text-[#5c1820]",children:"cancel"}),e.jsx("button",{"data-no-drag":!0,onClick:()=>{const d=x.trim();d&&a(d)},disabled:!x.trim(),className:"px-2 py-0.5 rounded text-[11px] font-semibold disabled:opacity-50 text-[var(--theme-paper,#f3e9d0)] bg-[var(--theme-ink,#1a1f2e)]",children:"Send"})]})]}):e.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[t.quickReplies.map((d,y)=>e.jsx("button",{"data-no-drag":!0,onClick:()=>a(d),className:`px-2.5 py-1 rounded-lg text-[11px] font-semibold border ${y===t.quickReplies.length-1?"border-transparent text-[var(--theme-paper,#f3e9d0)] bg-[var(--theme-ink,#1a1f2e)]":"bg-white border-[rgba(160,41,56,0.25)] text-[#5c1820]"}`,children:d},d)),e.jsx("button",{"data-no-drag":!0,onClick:()=>i(!0),className:"px-2.5 py-1 rounded-lg text-[11px] font-medium underline underline-offset-2 text-[#5c1820]/80 hover:text-[#5c1820]",children:"or type…"})]})]})}function et({count:t,onOpen:a}){return e.jsxs("div",{"data-drop-target":"cabinet",className:"w-[140px] flex flex-col",style:{color:"var(--theme-metal-bright, #f5d27a)"},title:t>0?`${t} filed — click to open`:"Drop files & notes here",children:[e.jsx("button",{"data-no-drag":!0,onClick:a,className:"text-left flex flex-col gap-1 p-0 bg-transparent border-none",children:[0,1].map(n=>e.jsxs("div",{className:"relative w-full h-[58px] flex items-center justify-center",style:{background:"linear-gradient(180deg, var(--theme-leather, #5a3a18) 0%, var(--theme-leather-edge, #3a230b) 100%), repeating-linear-gradient(90deg, rgba(255,180,90,0.05) 0px, rgba(60,30,10,0.08) 2px)",border:"1px solid var(--theme-bolt, #2a1808)",boxShadow:"inset 0 -2px 0 rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.08) inset"},children:[e.jsx("div",{className:"px-3 py-0.5 text-[10px] uppercase tracking-widest font-bold",style:{background:"linear-gradient(180deg, var(--theme-metal-bright, #ffd86e) 0%, var(--theme-metal-dark, #b07a1a) 100%)",borderRadius:2,boxShadow:"0 1px 2px var(--theme-shadow, rgba(0,0,0,0.4))",color:"var(--theme-bolt, #3a2a10)"},children:n===0?"Files":"Drafts"}),e.jsx("div",{className:"absolute right-3 w-6 h-1.5 rounded",style:{background:"linear-gradient(180deg, var(--theme-metal-bright, #ffd86e) 0%, var(--theme-metal-dark, #8a5810) 100%)",boxShadow:"0 1px 2px var(--theme-shadow, rgba(0,0,0,0.5))"}})]},n))}),t>0&&e.jsxs("div",{className:"mt-1 text-center text-[10px] uppercase tracking-widest",style:{color:"var(--theme-ink-soft, #d9c08c)"},children:[t," ",t===1?"item":"items"," inside"]})]})}function tt({count:t,onOpen:a}){const n=Math.min(t,6);return e.jsxs("button",{type:"button","data-drop-target":"trash","data-no-drag":!0,onClick:a,className:"relative w-[110px] h-[120px] p-0 bg-transparent border-none cursor-pointer",title:t>0?`${t} tossed — click to open the bin`:"Drop notes here to toss them",children:[e.jsx("div",{className:"absolute inset-x-3 top-3 bottom-12 flex flex-wrap gap-1 items-end justify-center overflow-hidden",children:Array.from({length:n}).map((i,x)=>e.jsx("div",{className:"rounded-full",style:{width:18+x*5%14,height:18+x*7%12,background:"radial-gradient(circle at 35% 30%, var(--theme-paper, #fffaee) 0%, var(--theme-paper-line, #d6cdb1) 70%, var(--theme-ink-soft, #a99b71) 100%)",boxShadow:"inset -2px -2px 4px rgba(0,0,0,0.18), 0 1px 2px var(--theme-shadow, rgba(0,0,0,0.3))",transform:`rotate(${x*37%60-30}deg)`}},x))}),e.jsx("div",{className:"absolute left-2 right-2 bottom-0 h-[80px] overflow-hidden",style:{clipPath:"polygon(8% 0%, 92% 0%, 100% 100%, 0% 100%)",background:"repeating-linear-gradient(90deg, var(--theme-leather, #5a3a18) 0px, var(--theme-leather, #5a3a18) 2px, var(--theme-leather-edge, #3a230b) 2px, var(--theme-leather-edge, #3a230b) 4px),repeating-linear-gradient(0deg, transparent 0 6px, rgba(0,0,0,0.25) 6px 7px)",border:"1px solid var(--theme-bolt, #2a1808)",borderRadius:4,boxShadow:"inset 0 4px 8px var(--theme-shadow, rgba(0,0,0,0.5))"}}),e.jsx("div",{className:"absolute left-1 right-1 bottom-[78px] h-2.5 rounded-sm",style:{background:"linear-gradient(180deg, var(--theme-metal-dark, #6b4720) 0%, var(--theme-leather-edge, #3a230b) 100%)",border:"1px solid var(--theme-bolt, #1a0f05)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.1)"}}),t>0&&e.jsxs("div",{className:"absolute -bottom-5 left-1/2 -translate-x-1/2 text-[10px] uppercase tracking-widest whitespace-nowrap",style:{color:"var(--theme-ink-soft, #d9c08c)"},children:[t," tossed"]})]})}function at({itemIds:t,items:a,fileSources:n,factSources:i,activityStickies:x,onRestore:m,onRestoreAt:f,onOpenFile:d,onClose:y}){const[v,u]=o.useState(null);o.useEffect(()=>{if(!v)return;const l=c=>{u(j=>j?{...j,x:c.clientX,y:c.clientY}:null)},h=c=>{f(v.itemId,c.clientX,c.clientY),u(null)};return window.addEventListener("mousemove",l),window.addEventListener("mouseup",h),()=>{window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",h)}},[v,f]);function b(l,h,c,j){l.target.closest("[data-no-drag]")||(l.preventDefault(),u({itemId:h,label:c,icon:j,x:l.clientX,y:l.clientY}),y())}return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:y,children:[e.jsxs("div",{className:"relative w-full max-w-2xl max-h-[80vh] flex flex-col rounded-2xl overflow-hidden",onClick:l=>l.stopPropagation(),style:{background:"linear-gradient(180deg, var(--theme-leather, #4a2e18) 0%, var(--theme-bolt, #2a1808) 100%)",boxShadow:"0 0 0 3px var(--theme-metal-dark, #b08a3a), 0 30px 60px var(--theme-shadow, rgba(0,0,0,0.6))",color:"var(--theme-metal-bright, #f5d27a)"},children:[e.jsxs("div",{className:"flex items-center gap-3 px-5 py-3",style:{borderBottom:"1px solid var(--theme-metal-dark, #6e4724)"},children:[e.jsx("span",{className:"text-2xl",children:"🗄️"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-semibold tracking-tight",children:"Filing cabinet"}),e.jsxs("div",{className:"text-[11px]",style:{color:"var(--theme-ink-soft, #d9c08c)"},children:[t.length," item",t.length===1?"":"s"," filed · drag a row out, or click ",e.jsx("b",{children:"to desk"})]})]}),e.jsx("button",{"data-no-drag":!0,onClick:y,className:"w-8 h-8 rounded-full hover:text-white flex items-center justify-center",style:{background:"var(--theme-leather-edge, #1a0f05)",border:"1px solid var(--theme-metal-dark, #6e4724)",color:"var(--theme-ink-soft, #d9c08c)"},children:"✕"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col gap-2",children:[t.length===0&&e.jsx("div",{className:"text-center py-12 italic",style:{color:"var(--theme-ink-soft, #d9c08c)"},children:"Nothing filed yet. Drag a file or sticky note onto the cabinet to file it."}),t.map(l=>{const h=a.find(N=>N.id===l);if(!h)return e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg",style:{background:"var(--theme-leather-edge, rgba(26,15,5,0.4))",border:"1px solid var(--theme-metal-dark, rgba(110,71,36,0.5))",color:"var(--theme-ink-soft, rgba(217,192,140,0.7))"},children:[e.jsxs("span",{className:"text-xs italic",children:[l," (no longer in mission)"]}),e.jsx("button",{"data-no-drag":!0,onClick:()=>m(l),className:"text-[11px] hover:text-white",children:"remove"})]},l);const c=h.kind==="file"?n.find(N=>N.ref===h.ref):void 0,j=h.kind==="fact"?i.find(N=>N.ref===h.ref):void 0,k=h.kind==="activity"?x.find(N=>N.id===h.ref):void 0,p=c?c.type==="report"?"📊":"📄":j?"💡":k?k.icon:"📌",M=(c==null?void 0:c.ref)??(j==null?void 0:j.ref)??(k?`${k.agentName} · ${k.activity}`:l);return e.jsxs("div",{onMouseDown:N=>b(N,l,M,p),className:"flex items-center gap-3 px-3 py-2 rounded-lg transition-colors cursor-grab active:cursor-grabbing",style:{background:"var(--theme-leather-edge, rgba(26,15,5,0.4))",border:"1px solid var(--theme-metal-dark, rgba(110,71,36,0.5))"},title:"Drag out to place on the desk, or use the buttons →",children:[e.jsx("span",{className:"text-lg leading-none",children:p}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs truncate",style:{color:"var(--theme-metal-bright, #f5d27a)"},children:M}),((c==null?void 0:c.description)??(j==null?void 0:j.description))&&e.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--theme-ink-soft, #d9c08c)"},children:(c==null?void 0:c.description)??(j==null?void 0:j.description)})]}),c&&e.jsx("button",{"data-no-drag":!0,onClick:()=>d(c.ref),className:"px-2 py-1 text-[10px] rounded hover:text-white",style:{background:"var(--theme-metal-dark, #6e4724)",border:"1px solid var(--theme-metal-dark, #b08a3a)",color:"var(--theme-metal-bright, #f5d27a)"},children:"Open ↗"}),e.jsx("button",{"data-no-drag":!0,onClick:()=>m(l),className:"px-2 py-1 text-[10px] rounded hover:text-white",style:{background:"var(--theme-leather-edge, #1a0f05)",border:"1px solid var(--theme-metal-dark, #6e4724)",color:"var(--theme-ink-soft, #d9c08c)"},children:"to desk"})]},l)})]})]}),v&&e.jsx("div",{className:"fixed z-[70] pointer-events-none",style:{left:v.x-80,top:v.y-20},children:e.jsxs("div",{className:"px-3 py-2 rounded text-xs flex items-center gap-2 shadow-2xl",style:{transform:"rotate(-2deg)",background:"var(--theme-paper, #fdfbf3)",color:"var(--theme-ink, #1a1f2e)"},children:[e.jsx("span",{children:v.icon}),e.jsx("span",{className:"font-semibold truncate max-w-[200px]",children:v.label})]})})]})}function rt({itemIds:t,items:a,fileSources:n,factSources:i,activityStickies:x,onRestore:m,onDeleteForever:f,onClose:d}){return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:d,children:e.jsxs("div",{className:"relative w-full max-w-2xl max-h-[80vh] flex flex-col rounded-2xl overflow-hidden text-[#f5d27a]",onClick:y=>y.stopPropagation(),style:{background:"linear-gradient(180deg, #4a2018 0%, #2a0e08 100%)",boxShadow:"0 0 0 3px #c46a52, 0 30px 60px var(--theme-shadow, rgba(0,0,0,0.6))"},children:[e.jsxs("div",{className:"flex items-center gap-3 px-5 py-3 border-b border-[#6e3024]",children:[e.jsx("span",{className:"text-2xl",children:"🗑️"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-semibold tracking-tight",children:"Wastebasket"}),e.jsxs("div",{className:"text-[11px] text-[#e9b09a]",children:[t.length," item",t.length===1?"":"s"," tossed ·",e.jsx("span",{className:"ml-1",children:"restore to desk, or delete forever"})]})]}),e.jsx("button",{onClick:d,className:"w-8 h-8 rounded-full bg-[#1a0a08] border border-[#6e3024] text-[#e9b09a] hover:text-white flex items-center justify-center",children:"✕"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col gap-2",children:[t.length===0&&e.jsx("div",{className:"text-center py-12 text-[#e9b09a] italic",children:"Nothing in the bin. Drag a file, sticky, or activity onto the wastebasket to toss it."}),t.map(y=>{const v=a.find(k=>k.id===y),u=(v==null?void 0:v.kind)==="file"?n.find(k=>k.ref===v.ref):void 0,b=(v==null?void 0:v.kind)==="fact"?i.find(k=>k.ref===v.ref):void 0,l=(v==null?void 0:v.kind)==="activity"?x.find(k=>k.id===v.ref):void 0,h=u?u.type==="report"?"📊":"📄":b?"💡":l?l.icon:"📌",c=(u==null?void 0:u.ref)??(b==null?void 0:b.ref)??(l?`${l.agentName} · ${l.activity}`:y),j=(u==null?void 0:u.description)??(b==null?void 0:b.description)??(l==null?void 0:l.detail);return e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 bg-[#1a0a08]/60 border border-[#6e3024]/50 rounded-lg hover:bg-[#1a0a08]/80 transition-colors",title:v?"Restore to the desk or delete forever":"This item no longer exists in the mission",children:[e.jsx("span",{className:"text-lg leading-none opacity-70",children:h}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs text-[#f5d27a] truncate line-through decoration-[#c46a52]/50",children:c}),j&&e.jsx("div",{className:"text-[10px] text-[#e9b09a]/80 truncate",children:j})]}),e.jsx("button",{"data-no-drag":!0,onClick:()=>m(y),className:"px-2.5 py-1 text-[10px] bg-[#1a0a08] border border-[#6e3024] rounded text-[#e9b09a] hover:text-white hover:border-[#c46a52]",title:"Pull this item back out of the bin and put it on the desk",children:"↩ to desk"}),e.jsx("button",{"data-no-drag":!0,onClick:()=>{window.confirm(`Delete this forever?
7
+
8
+ "${c.slice(0,100)}${c.length>100?"…":""}"
9
+
10
+ The item will never reappear on the desk again, even after a reload. This is UI-only — the underlying mission file/note isn't deleted on disk.`)&&f(y)},className:"px-2.5 py-1 text-[10px] bg-[#3a0a08] border border-[#c46a52]/60 rounded text-[#ff9c9c] hover:text-white hover:bg-[#5a0e0a] hover:border-[#ff9c9c]",title:"Permanently hide this item — gone for good",children:"✕ Delete forever"})]},y)})]}),t.length>0&&e.jsx("div",{className:"px-5 py-2 border-t border-[#6e3024] text-center text-[10px] text-[#e9b09a]/70 uppercase tracking-widest",children:"tip: drag items onto the wastebasket from the desk · restore is non-destructive"})]})})}const nt={background:["radial-gradient(ellipse 120px 80px at 78% 28%, rgba(40,18,8,0.55) 0%, rgba(40,18,8,0) 70%)","radial-gradient(ellipse 90px 60px at 22% 72%, rgba(40,18,8,0.45) 0%, rgba(40,18,8,0) 75%)","repeating-linear-gradient(92deg, rgba(255,180,90,0.05) 0px, rgba(60,30,10,0.08) 3px, rgba(255,180,90,0.04) 7px, rgba(60,30,10,0.10) 11px, rgba(255,180,90,0.06) 16px)","repeating-linear-gradient(0deg, rgba(0,0,0,0.04) 0px, rgba(0,0,0,0) 2px, rgba(0,0,0,0.03) 4px)","linear-gradient(180deg, var(--theme-bg-base, #6e4724) 0%, var(--theme-bg-grain, #5a3717) 50%, var(--theme-leather-edge, #482a13) 100%)"].join(",")},st={background:"radial-gradient(ellipse 80% 60% at 20% 0%, rgba(255,220,140,0.18) 0%, rgba(0,0,0,0) 55%)"},it={background:"radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 50%, var(--theme-bg-vignette, rgba(0,0,0,0.45)) 100%)"},ot=`
11
+ @keyframes deskGlow {
12
+ 0%, 100% { opacity: 0.5; }
13
+ 50% { opacity: 0.8; }
14
+ }
15
+ @keyframes deskAlarm {
16
+ 0%, 100% { opacity: 0.5; }
17
+ 50% { opacity: 1; }
18
+ }
19
+ @keyframes deskFloat {
20
+ 0%, 100% { transform: translateY(0); }
21
+ 50% { transform: translateY(-3px); }
22
+ }
23
+ /* Phase 3 polish — Sage decision card sits ~10px elevated and
24
+ floats gently. Uses an offset baseline so the card stays raised
25
+ relative to the rest of the desk furniture. */
26
+ @keyframes questionLift {
27
+ 0%, 100% { transform: translateY(-10px); }
28
+ 50% { transform: translateY(-13px); }
29
+ }
30
+ /* v6.1.0-alpha.24 — gentle bob on working sticky notes. Lives on an
31
+ INNER wrapper so it composes with the parent Draggable's rotation
32
+ transform. */
33
+ @keyframes stickyBreathe {
34
+ 0%, 100% { transform: translateY(0); }
35
+ 50% { transform: translateY(-2.5px); }
36
+ }
37
+ /* Phase 2 polish — faster breath for "needs you" cards (1.2s). */
38
+ @keyframes stickyBreatheUrgent {
39
+ 0%, 100% { transform: translateY(0); }
40
+ 50% { transform: translateY(-3.5px); }
41
+ }
42
+ /* Phase 2 polish — generic bead-fade keyframe. Actual path travel
43
+ is implemented via SVG animateMotion + mpath in LivingDeskLayer
44
+ so it works without offset-path support. Kept as a fallback. */
45
+ @keyframes beadFlow {
46
+ 0%, 100% { opacity: 0; }
47
+ 10%, 90% { opacity: 0.9; }
48
+ }
49
+ /* Tether-line dash flow — animates stroke-dashoffset to give the
50
+ thread a moving-current feel. The dasharray defines the segment
51
+ pattern. */
52
+ @keyframes tetherFlow {
53
+ to { stroke-dashoffset: -20; }
54
+ }
55
+ /* Dust mote drift — slow vertical drift with a gentle horizontal
56
+ wobble. Two duration variants so motes don't tick in unison. */
57
+ @keyframes mote1 {
58
+ 0% { transform: translate(0, 0) scale(1); opacity: 0; }
59
+ 10% { opacity: 0.55; }
60
+ 90% { opacity: 0.45; }
61
+ 100% { transform: translate(14px, -90vh) scale(1.1); opacity: 0; }
62
+ }
63
+ @keyframes mote2 {
64
+ 0% { transform: translate(0, 0) scale(0.9); opacity: 0; }
65
+ 10% { opacity: 0.4; }
66
+ 90% { opacity: 0.3; }
67
+ 100% { transform: translate(-12px, -90vh) scale(1); opacity: 0; }
68
+ }
69
+ `;function lt({items:t,room:a,poseOf:n,isHidden:i}){const x=t.find(l=>l.kind==="document"),m=x&&!i(x.id)?n(x):null,f=o.useMemo(()=>{if(!m)return[];const l=[];for(const h of t){if(h.kind!=="agent"||i(h.id))continue;const c=a.team.find(j=>j.agentId===h.ref);c&&(c.paused||c.state!=="working"&&c.state!=="editing"||l.push({item:h,member:c,pose:n(h)}))}return l},[t,a.team,n,i,m]),d=f.length>0,y=220,v=110,u=620,b=300;return e.jsxs(e.Fragment,{children:[m&&f.length>0&&e.jsxs("svg",{className:"absolute inset-0 w-full h-full pointer-events-none",style:{zIndex:5},"aria-hidden":!0,children:[e.jsx("defs",{children:e.jsxs("radialGradient",{id:"tetherNodeGlow",children:[e.jsx("stop",{offset:"0%",stopColor:"var(--theme-metal-bright, #ffd86e)",stopOpacity:"0.9"}),e.jsx("stop",{offset:"100%",stopColor:"var(--theme-metal-bright, #ffd86e)",stopOpacity:"0"})]})}),f.map(({item:l,member:h,pose:c})=>{const j=c.x+y/2,k=c.y+v/2,p=m.x+u/2,M=m.y+b/2,N=(j+p)/2,A=(k+M)/2-40,E=`M ${j} ${k} Q ${N} ${A}, ${p} ${M}`,F=h.state==="editing"?"rgba(245, 158, 11, 0.55)":h.state==="blocked"?"rgba(239, 68, 68, 0.7)":"rgba(255, 216, 110, 0.55)",R=h.color,L=`tether-path-${l.id}`;return e.jsxs("g",{children:[e.jsx("path",{id:L,d:E,fill:"none",stroke:F,strokeWidth:1.4,strokeDasharray:"8 8",style:{animation:"tetherFlow 1.6s linear infinite"}}),e.jsx("circle",{cx:j,cy:k,r:14,fill:"url(#tetherNodeGlow)"}),e.jsx("circle",{r:3.2,fill:R,opacity:.95,children:e.jsx("animateMotion",{dur:"2.2s",repeatCount:"indefinite",children:e.jsx("mpath",{href:`#${L}`})})})]},l.id)})]}),d&&e.jsx("div",{className:"absolute inset-0 pointer-events-none overflow-hidden",style:{zIndex:6},"aria-hidden":!0,children:dt.map((l,h)=>e.jsx("span",{className:"absolute rounded-full",style:{left:`${l.left}vw`,bottom:`${-5+l.delay%12}vh`,width:l.size,height:l.size,background:"radial-gradient(circle at 35% 30%, rgba(255,250,235,0.85) 0%, rgba(212,196,158,0.4) 60%, rgba(0,0,0,0) 100%)",animation:`${h%2===0?"mote1":"mote2"} ${l.duration}s linear infinite`,animationDelay:`${l.delay}s`,filter:"blur(0.4px)"}},h))})]})}const dt=[{left:6,size:3,duration:28,delay:0},{left:14,size:2,duration:36,delay:3},{left:22,size:4,duration:30,delay:8},{left:30,size:2,duration:40,delay:1},{left:38,size:3,duration:26,delay:5},{left:46,size:3,duration:34,delay:11},{left:54,size:2,duration:38,delay:2},{left:62,size:4,duration:32,delay:7},{left:70,size:3,duration:30,delay:9},{left:78,size:2,duration:36,delay:4},{left:86,size:3,duration:28,delay:12},{left:94,size:4,duration:34,delay:6}];function ce(t){let a=0,n=0;for(const i of t.team)(i.state==="working"||i.state==="editing")&&a++,i.state==="blocked"&&n++;return{working:a,blocked:n}}function ct(t,a,n){return t==="paused"?"Paused":t==="done"?"Done":t==="failed"?"Stopped":n>0?`${a} working · ${n} needs you`:a>0?`${a} working`:t==="forming"?"Forming team…":"Idle"}function xt(t){return t==="paused"?"paused":t==="done"?"done":t==="failed"?"stopped":t==="blocked"?"waiting on you":"auto-saving"}function ut(t,a){return t.length<=a?t:t.slice(0,a-1)+"…"}function ht(t){switch(t){case"working":return"bg-accent animate-pulse";case"editing":return"bg-warning animate-pulse";case"blocked":return"bg-error animate-pulse";case"done":return"bg-success";default:return"bg-text-muted"}}function ft(t){switch(t){case"working":return"#6366f1";case"editing":return"#f59e0b";case"blocked":return"#ef4444";case"done":return"#22c55e";default:return"#71717a"}}function pt(t){return t==="working"?"working":t==="editing"?"editing":t==="blocked"?"needs you":t==="done"?"done":"idle"}function gt(t,a){const n=t.replace("#","");if(n.length!==6)return t;const i=parseInt(n,16);let x=i>>16&255,m=i>>8&255,f=i&255;const d=Math.round(255*(a/100));return x=Math.max(0,Math.min(255,x+d)),m=Math.max(0,Math.min(255,m+d)),f=Math.max(0,Math.min(255,f+d)),"#"+(x<<16|m<<8|f).toString(16).padStart(6,"0")}export{yt as default};