titan-agent 6.5.2 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/README.md +180 -53
  2. package/assets/agent-skills/NOTICE-ECC.md +39 -0
  3. package/assets/agent-skills/agent-introspection-debugging/SKILL.md +153 -0
  4. package/assets/agent-skills/continuous-agent-loop/SKILL.md +45 -0
  5. package/assets/agent-skills/continuous-learning/SKILL.md +131 -0
  6. package/assets/agent-skills/continuous-learning/config.json +18 -0
  7. package/assets/agent-skills/continuous-learning/evaluate-session.sh +69 -0
  8. package/assets/agent-skills/production-audit/SKILL.md +206 -0
  9. package/assets/agent-skills/recursive-decision-ledger/SKILL.md +79 -0
  10. package/assets/agent-skills/scientific-thinking-literature-review/SKILL.md +192 -0
  11. package/assets/agent-skills/scientific-thinking-scholar-evaluation/SKILL.md +160 -0
  12. package/assets/agent-skills/verification-loop/SKILL.md +126 -0
  13. package/dist/agent/agent.js +67 -26
  14. package/dist/agent/agent.js.map +1 -1
  15. package/dist/agent/agentLoop.js +6 -2
  16. package/dist/agent/agentLoop.js.map +1 -1
  17. package/dist/agent/autoModeClassifier.js +26 -2
  18. package/dist/agent/autoModeClassifier.js.map +1 -1
  19. package/dist/agent/goalDriver.js +2 -0
  20. package/dist/agent/goalDriver.js.map +1 -1
  21. package/dist/agent/goalSpec.js +229 -0
  22. package/dist/agent/goalSpec.js.map +1 -0
  23. package/dist/agent/heartbeat.js +130 -0
  24. package/dist/agent/heartbeat.js.map +1 -0
  25. package/dist/agent/missionDecompose.js +38 -0
  26. package/dist/agent/missionDecompose.js.map +1 -0
  27. package/dist/agent/muscleMemory.js +291 -0
  28. package/dist/agent/muscleMemory.js.map +1 -0
  29. package/dist/agent/observationWriter.js +56 -0
  30. package/dist/agent/observationWriter.js.map +1 -0
  31. package/dist/agent/promptSectionCaps.js +6 -0
  32. package/dist/agent/promptSectionCaps.js.map +1 -1
  33. package/dist/agent/reminders.js +101 -0
  34. package/dist/agent/reminders.js.map +1 -0
  35. package/dist/agent/systemWidgets.js +41 -0
  36. package/dist/agent/systemWidgets.js.map +1 -0
  37. package/dist/agent/toolRunner.js +24 -0
  38. package/dist/agent/toolRunner.js.map +1 -1
  39. package/dist/agent/toolSearch.js +3 -0
  40. package/dist/agent/toolSearch.js.map +1 -1
  41. package/dist/channels/messenger.js +39 -0
  42. package/dist/channels/messenger.js.map +1 -1
  43. package/dist/config/config.js +7 -0
  44. package/dist/config/config.js.map +1 -1
  45. package/dist/config/schema.js +18 -1
  46. package/dist/config/schema.js.map +1 -1
  47. package/dist/eval/harness.js +13 -3
  48. package/dist/eval/harness.js.map +1 -1
  49. package/dist/gateway/onboarding.js +91 -0
  50. package/dist/gateway/onboarding.js.map +1 -0
  51. package/dist/gateway/routes/skills.js +2 -1
  52. package/dist/gateway/routes/skills.js.map +1 -1
  53. package/dist/gateway/routes/studioRouter.js +88 -0
  54. package/dist/gateway/routes/studioRouter.js.map +1 -0
  55. package/dist/gateway/routes/watchRouter.js +4 -4
  56. package/dist/gateway/routes/watchRouter.js.map +1 -1
  57. package/dist/gateway/server.js +251 -43
  58. package/dist/gateway/server.js.map +1 -1
  59. package/dist/memory/taxonomy.js +117 -0
  60. package/dist/memory/taxonomy.js.map +1 -0
  61. package/dist/providers/modelCapabilities.js +13 -0
  62. package/dist/providers/modelCapabilities.js.map +1 -1
  63. package/dist/providers/ollama.js +8 -2
  64. package/dist/providers/ollama.js.map +1 -1
  65. package/dist/providers/openai.js +1 -1
  66. package/dist/providers/openai.js.map +1 -1
  67. package/dist/providers/openai_compat.js +38 -2
  68. package/dist/providers/openai_compat.js.map +1 -1
  69. package/dist/providers/router.js +14 -0
  70. package/dist/providers/router.js.map +1 -1
  71. package/dist/recipes/runner.js +8 -1
  72. package/dist/recipes/runner.js.map +1 -1
  73. package/dist/recipes/store.js +2 -1
  74. package/dist/recipes/store.js.map +1 -1
  75. package/dist/skills/builtin/codebase_explore.js +214 -0
  76. package/dist/skills/builtin/codebase_explore.js.map +1 -0
  77. package/dist/skills/builtin/config_audit.js +160 -0
  78. package/dist/skills/builtin/config_audit.js.map +1 -0
  79. package/dist/skills/builtin/delegate_agent.js +107 -0
  80. package/dist/skills/builtin/delegate_agent.js.map +1 -0
  81. package/dist/skills/builtin/memory_map.js +38 -0
  82. package/dist/skills/builtin/memory_map.js.map +1 -0
  83. package/dist/skills/builtin/reminders.js +67 -0
  84. package/dist/skills/builtin/reminders.js.map +1 -0
  85. package/dist/skills/builtin/spec.js +139 -0
  86. package/dist/skills/builtin/spec.js.map +1 -0
  87. package/dist/skills/builtin/widget_gallery.js +12 -5
  88. package/dist/skills/builtin/widget_gallery.js.map +1 -1
  89. package/dist/skills/frontmatterLoader.js +7 -1
  90. package/dist/skills/frontmatterLoader.js.map +1 -1
  91. package/dist/skills/registry.js +12 -0
  92. package/dist/skills/registry.js.map +1 -1
  93. package/dist/substrate/traceBus.js.map +1 -1
  94. package/dist/telemetry/traceStore.js +127 -0
  95. package/dist/telemetry/traceStore.js.map +1 -0
  96. package/dist/utils/constants.js +1 -1
  97. package/dist/utils/constants.js.map +1 -1
  98. package/dist/utils/contrast.js +69 -0
  99. package/dist/utils/contrast.js.map +1 -0
  100. package/dist/watch/sessionContext.js +14 -0
  101. package/dist/watch/sessionContext.js.map +1 -0
  102. package/dist/watch/sessionTrace.js +51 -0
  103. package/dist/watch/sessionTrace.js.map +1 -0
  104. package/dist/watch/studioBuffer.js +53 -0
  105. package/dist/watch/studioBuffer.js.map +1 -0
  106. package/package.json +4 -3
  107. package/ui/dist/assets/AboutYouMemory-CZKEOd_O.js +11 -0
  108. package/ui/dist/assets/AuditPanel-Bu71N5Er.js +1 -0
  109. package/ui/dist/assets/{AutonomyPanel-CmaXJV8d.js → AutonomyPanel-DB-39dX4.js} +2 -2
  110. package/ui/dist/assets/{AutopilotPanel-CbohPtXW.js → AutopilotPanel-Cj8oKxWv.js} +1 -1
  111. package/ui/dist/assets/{AutoresearchPanel-DCwiQ2v2.js → AutoresearchPanel-3s8pjm6Z.js} +2 -2
  112. package/ui/dist/assets/BackupPanel-EUQJMJE7.js +1 -0
  113. package/ui/dist/assets/{BrowserPanel-D6UaSxap.js → BrowserPanel-Beo4F5Ar.js} +2 -2
  114. package/ui/dist/assets/Button-MdXmb4_n.js +1 -0
  115. package/ui/dist/assets/CPActivity-B1Se9VVc.js +1 -0
  116. package/ui/dist/assets/CPAgentDetail-BYji6tT8.js +1 -0
  117. package/ui/dist/assets/CPAgents-BSUKucTe.js +1 -0
  118. package/ui/dist/assets/CPApprovals-B4v0em6e.js +1 -0
  119. package/ui/dist/assets/CPCosts-9ikh61Kv.js +1 -0
  120. package/ui/dist/assets/CPDashboard-sOok2T5v.js +1 -0
  121. package/ui/dist/assets/{CPFiles-BO73EZwJ.js → CPFiles-DB2nY5JE.js} +1 -1
  122. package/ui/dist/assets/CPGoals-8Z1yOY8e.js +1 -0
  123. package/ui/dist/assets/CPInbox-Cq6-UY8F.js +11 -0
  124. package/ui/dist/assets/CPIssueDetail-NAGfmJg8.js +1 -0
  125. package/ui/dist/assets/CPIssues-BzX6Rckx.js +1 -0
  126. package/ui/dist/assets/CPLayout-BcRM6QSg.js +2 -0
  127. package/ui/dist/assets/CPOrg-B7DQ4UQP.js +1 -0
  128. package/ui/dist/assets/CPRuns-D-cpPw_M.js +1 -0
  129. package/ui/dist/assets/{CPSocial-Qw5rKy_4.js → CPSocial-DshtmcK0.js} +3 -3
  130. package/ui/dist/assets/CPVoice-DfXRnQVU.js +1 -0
  131. package/ui/dist/assets/{ChannelsPanel-DS21E-Iz.js → ChannelsPanel-BnaTOeyf.js} +1 -1
  132. package/ui/dist/assets/CheckpointsPanel-C62naE4U.js +1 -0
  133. package/ui/dist/assets/CommandPostHub-B_L1CAss.js +24 -0
  134. package/ui/dist/assets/ConfirmDialog-VErHWAbo.js +1 -0
  135. package/ui/dist/assets/CronPanel-BwMrrZ5d.js +1 -0
  136. package/ui/dist/assets/{DataTable-PnhPeDBG.js → DataTable-BCqSUuN7.js} +1 -1
  137. package/ui/dist/assets/{DreamPanel-DIrtlk2K.js → DreamPanel-BNAcCLBB.js} +2 -2
  138. package/ui/dist/assets/EmptyState-D9kQf1PX.js +1 -0
  139. package/ui/dist/assets/{EvalHarnessPanel-uYb_ZEQG.js → EvalHarnessPanel-BaMLdBNm.js} +2 -2
  140. package/ui/dist/assets/EvalPanel-CW-SSjtg.js +1 -0
  141. package/ui/dist/assets/{FileViewer-CVO3TRs3.js → FileViewer-BL00nsd7.js} +1 -1
  142. package/ui/dist/assets/FilesPanel-CeC6YUSd.js +16 -0
  143. package/ui/dist/assets/FleetPanel-EyWF7l3W.js +1 -0
  144. package/ui/dist/assets/{HomelabPanel-BZvN4LPM.js → HomelabPanel-BRfKRYe7.js} +2 -2
  145. package/ui/dist/assets/InfraView-Jmqhg_Yc.js +2 -0
  146. package/ui/dist/assets/{InlineEditableField-mBzpbcLB.js → InlineEditableField-DgMrLDj1.js} +1 -1
  147. package/ui/dist/assets/Input-CBTwa_Iw.js +1 -0
  148. package/ui/dist/assets/IntegrationsPanel-DQL-7Ec6.js +1 -0
  149. package/ui/dist/assets/IntelligenceView-DxD78qfP.js +2 -0
  150. package/ui/dist/assets/LearningPanel-C_JzSbJU.js +1 -0
  151. package/ui/dist/assets/LiveStudio-Db5yeaWo.js +7 -0
  152. package/ui/dist/assets/{LogsPanel-DbP3Mwnr.js → LogsPanel-CpinKwaZ.js} +1 -1
  153. package/ui/dist/assets/McpPanel-D-MqN_f-.js +1 -0
  154. package/ui/dist/assets/MemoryGraphPanel-BnD5jRqf.js +1 -0
  155. package/ui/dist/assets/MemoryTaxonomyPanel-BBI202dd.js +6 -0
  156. package/ui/dist/assets/MemoryWikiPanel-Dn3XZHL0.js +6 -0
  157. package/ui/dist/assets/{MeshPanel-Bf-4brXL.js → MeshPanel-C-mRJpr0.js} +1 -1
  158. package/ui/dist/assets/{MissionCanvas-CJyhnauG.js → MissionCanvas-CbZW83Ch.js} +1 -1
  159. package/ui/dist/assets/{MissionChat-C2Nto3zM.js → MissionChat-Bs75jPAD.js} +1 -1
  160. package/ui/dist/assets/{MissionLibrary-RXyBHsLL.js → MissionLibrary-BxQ6SxPe.js} +1 -1
  161. package/ui/dist/assets/MissionStart-CBuBPasl.js +1 -0
  162. package/ui/dist/assets/Modal-ybPGvlQs.js +9 -0
  163. package/ui/dist/assets/{NvidiaPanel-4DlcQlyl.js → NvidiaPanel-DdG13OX4.js} +1 -1
  164. package/ui/dist/assets/OrganismPanel-xZWUJKyr.js +1 -0
  165. package/ui/dist/assets/OverviewPanel-B45ZYhJV.js +1 -0
  166. package/ui/dist/assets/{PageHeader-bnc85wQN.js → PageHeader-DdrbS1aq.js} +1 -1
  167. package/ui/dist/assets/PersonaProfilesPanel-CKER-EU5.js +8 -0
  168. package/ui/dist/assets/{PersonasPanel-dR8VppcD.js → PersonasPanel-CMMQ3nh3.js} +1 -1
  169. package/ui/dist/assets/{PhoneDeskPanel-CdVOY7H9.js → PhoneDeskPanel-Bw_Y-cVE.js} +2 -2
  170. package/ui/dist/assets/RecipesPanel-DzMcxpJJ.js +1 -0
  171. package/ui/dist/assets/SecurityPanel-BCq3Fzbr.js +1 -0
  172. package/ui/dist/assets/SelfImprovePanel-YE3hT8jK.js +1 -0
  173. package/ui/dist/assets/SelfProposalsPanel-DXuqBM6p.js +1 -0
  174. package/ui/dist/assets/SessionsPanel-DORz5goR.js +1 -0
  175. package/ui/dist/assets/SessionsTab-qYHDOuC8.js +1 -0
  176. package/ui/dist/assets/SettingsPanel-BbwPu1i7.js +1 -0
  177. package/ui/dist/assets/SettingsView-zgqkDDBJ.js +2 -0
  178. package/ui/dist/assets/{SkeletonLoader-Cax7YTqW.js → SkeletonLoader-r6OGXaU9.js} +1 -1
  179. package/ui/dist/assets/SkillsPanel-BjEOBMRo.js +11 -0
  180. package/ui/dist/assets/{SomaView-eG3wI4S1.js → SomaView-DLzApZVW.js} +2 -2
  181. package/ui/dist/assets/{StatCard-Djr487DV.js → StatCard-DLq8aBps.js} +1 -1
  182. package/ui/dist/assets/{StatusBadge-JpCoA33_.js → StatusBadge-BqlvIbdj.js} +1 -1
  183. package/ui/dist/assets/{Tabs-DJHu-roP.js → Tabs-DdUThlp1.js} +1 -1
  184. package/ui/dist/assets/TeamsPanel-uIIKoU7I.js +1 -0
  185. package/ui/dist/assets/{TelemetryPanel-D4PXsd-X.js → TelemetryPanel-dVr3yQQr.js} +1 -1
  186. package/ui/dist/assets/TitanCanvas-xHAJqwG2.js +945 -0
  187. package/ui/dist/assets/ToolsView-CG1mZdiy.js +2 -0
  188. package/ui/dist/assets/{Tooltip-B1LhTXJ8.js → Tooltip-C2tXJcrN.js} +1 -1
  189. package/ui/dist/assets/TraceViewer-BIMD_Osr.js +1 -0
  190. package/ui/dist/assets/TracesPanel-nMUiyMj5.js +1 -0
  191. package/ui/dist/assets/TrainingPanel-CT5R4HWm.js +1 -0
  192. package/ui/dist/assets/{VoiceOverlay-B_ss7Zg_.js → VoiceOverlay-Br4QnCtw.js} +3 -3
  193. package/ui/dist/assets/VramPanel-CdnJYytg.js +1 -0
  194. package/ui/dist/assets/WatchView-TNU6Ns1Q.js +13 -0
  195. package/ui/dist/assets/WorkTab-wTlX_UKP.js +1 -0
  196. package/ui/dist/assets/WorkflowBuilderPanel-CDpVt5ux.js +6 -0
  197. package/ui/dist/assets/WorkflowsPanel-zsFqsLdn.js +11 -0
  198. package/ui/dist/assets/{archive-gZFnGd5A.js → archive-Bh689DNg.js} +1 -1
  199. package/ui/dist/assets/{arrow-left-qA0Qer2h.js → arrow-left-WkVYLm80.js} +1 -1
  200. package/ui/dist/assets/{book-open-DIxdPqmD.js → book-open-ohEXgUsS.js} +1 -1
  201. package/ui/dist/assets/{bot-CvIF1uHi.js → bot-DvEcyQcD.js} +1 -1
  202. package/ui/dist/assets/{chart-column-BQiM-Td4.js → chart-column-w3goFd5f.js} +1 -1
  203. package/ui/dist/assets/{check-DgyDEFtq.js → check-CuRYh4Zh.js} +1 -1
  204. package/ui/dist/assets/{chevron-right-CQ1NTOtd.js → chevron-right-DbLSHmff.js} +1 -1
  205. package/ui/dist/assets/{circle-check-big-CAFcaPPH.js → circle-check-big-Bkba568b.js} +1 -1
  206. package/ui/dist/assets/{circle-stop-C-8xGv0n.js → circle-stop-Bx2ohEg8.js} +1 -1
  207. package/ui/dist/assets/{clipboard-list-9DdqBj1F.js → clipboard-list-Dj9tORnu.js} +1 -1
  208. package/ui/dist/assets/{clock-CF9BCIpL.js → clock-JyQAYy6X.js} +1 -1
  209. package/ui/dist/assets/{dollar-sign-LDRZBae6.js → dollar-sign-XxwPAA2a.js} +1 -1
  210. package/ui/dist/assets/{download-BBNXvBO0.js → download-D1izVEOL.js} +1 -1
  211. package/ui/dist/assets/{external-link-D_ji4Bec.js → external-link-DZ_rZsIt.js} +1 -1
  212. package/ui/dist/assets/{file-text-DrdTDEYp.js → file-text-Cfawu8Bs.js} +1 -1
  213. package/ui/dist/assets/{flask-conical-BGn5PgFX.js → flask-conical-Ql8QxhgY.js} +1 -1
  214. package/ui/dist/assets/{folder-BeZZUGnK.js → folder-DAdIw-Pb.js} +1 -1
  215. package/ui/dist/assets/{funnel-CAJgGO5M.js → funnel-FycfZcXo.js} +1 -1
  216. package/ui/dist/assets/{git-branch-BcXabeOs.js → git-branch-C2qrhGGu.js} +1 -1
  217. package/ui/dist/assets/index-Cml2x9pA.js +507 -0
  218. package/ui/dist/assets/index-yWybhcfI.css +1 -0
  219. package/ui/dist/assets/{layers-DxYDmPA_.js → layers-yzjtGlHB.js} +1 -1
  220. package/ui/dist/assets/{legacy-dHWI7k8P.js → legacy-D21WSMF1.js} +1 -1
  221. package/ui/dist/assets/{lightbulb-B0Du4SM4.js → lightbulb-BZJNK69S.js} +1 -1
  222. package/ui/dist/assets/{link-CUpaumqr.js → link-CnFkBkaY.js} +1 -1
  223. package/ui/dist/assets/{list-todo-CDDhmPQB.js → list-todo-BlgfQHup.js} +1 -1
  224. package/ui/dist/assets/{message-square-D5VWlv-Q.js → message-square-CRsG9u6_.js} +1 -1
  225. package/ui/dist/assets/{mic-Ddcc6Ann.js → mic-B32RHc7Y.js} +1 -1
  226. package/ui/dist/assets/{missions-2zox16Tc.js → missions-1iw8Z2_0.js} +1 -1
  227. package/ui/dist/assets/{network-DaJ7ugwX.js → network-C9RXQGrV.js} +1 -1
  228. package/ui/dist/assets/{pause-BukaK6rs.js → pause-BT1Bc2q3.js} +1 -1
  229. package/ui/dist/assets/{pencil-D_YwQBeg.js → pencil-BK5IU6o0.js} +1 -1
  230. package/ui/dist/assets/{play-BjdwtYMk.js → play-Cl1nC_gc.js} +1 -1
  231. package/ui/dist/assets/{plug-yISDdeW2.js → plug-DvcpOalj.js} +1 -1
  232. package/ui/dist/assets/{plus-BSjTdepW.js → plus-Dpo1qfrl.js} +1 -1
  233. package/ui/dist/assets/{radio-B7kX_yWE.js → radio-C5c9IyqX.js} +1 -1
  234. package/ui/dist/assets/{refresh-cw-CwDpzXUn.js → refresh-cw-C-iZkzuS.js} +1 -1
  235. package/ui/dist/assets/{rotate-ccw-7SQDTI0_.js → rotate-ccw-qzrB3SNw.js} +1 -1
  236. package/ui/dist/assets/{save-CjTPAQM0.js → save-DwR9wQVu.js} +1 -1
  237. package/ui/dist/assets/{search-BP7VlNxX.js → search-D10l0m3-.js} +1 -1
  238. package/ui/dist/assets/{send-C2XDuRPf.js → send-DtXGsaFW.js} +1 -1
  239. package/ui/dist/assets/{server-BE8W-AT4.js → server-BzisF3LL.js} +1 -1
  240. package/ui/dist/assets/settings-Dbwd1_-c.js +6 -0
  241. package/ui/dist/assets/{shield-check-s7la2J2K.js → shield-check-CXlDJyAW.js} +1 -1
  242. package/ui/dist/assets/square-BBC-JKzY.js +11 -0
  243. package/ui/dist/assets/{terminal-B8IK4WsO.js → terminal-DaBIlWEM.js} +1 -1
  244. package/ui/dist/assets/{test-tube-Xfn9DJeg.js → test-tube-CDATRD5t.js} +1 -1
  245. package/ui/dist/assets/{toggle-right-CHpzOIlj.js → toggle-right-DTmrC5RD.js} +1 -1
  246. package/ui/dist/assets/{trash-2-B1C85ePK.js → trash-2-CTeyjxD_.js} +1 -1
  247. package/ui/dist/assets/{trending-up-DDGHQZY1.js → trending-up-CXPRjRV4.js} +1 -1
  248. package/ui/dist/assets/{trophy-D0LhJSPA.js → trophy-DbVdXRtU.js} +1 -1
  249. package/ui/dist/assets/{volume-2-DMaE91b5.js → volume-2-DYDBmm3M.js} +1 -1
  250. package/ui/dist/assets/{wifi-off-DR9h8HGA.js → wifi-off-BBuIGbiP.js} +1 -1
  251. package/ui/dist/assets/zoom-out-D47_pRAO.js +16 -0
  252. package/ui/dist/index.html +2 -2
  253. package/ui/dist/sw.js +1 -1
  254. package/ui/dist/assets/AuditPanel-BaftX5MP.js +0 -1
  255. package/ui/dist/assets/BackupPanel-DAy9G7Wt.js +0 -1
  256. package/ui/dist/assets/CPActivity-BYDsUoMn.js +0 -1
  257. package/ui/dist/assets/CPAgentDetail-Bb9-GAJY.js +0 -1
  258. package/ui/dist/assets/CPAgents-BTZuGnki.js +0 -1
  259. package/ui/dist/assets/CPApprovals-BME2ARkO.js +0 -1
  260. package/ui/dist/assets/CPCosts-mOXwWq0i.js +0 -1
  261. package/ui/dist/assets/CPDashboard-CTlKGXXQ.js +0 -1
  262. package/ui/dist/assets/CPGoals-BNWhNP14.js +0 -1
  263. package/ui/dist/assets/CPInbox-ybe4r8LW.js +0 -16
  264. package/ui/dist/assets/CPIssueDetail-DaMMGbjw.js +0 -1
  265. package/ui/dist/assets/CPIssues-BgpQOISw.js +0 -1
  266. package/ui/dist/assets/CPLayout-bgErauTx.js +0 -2
  267. package/ui/dist/assets/CPOrg-C8l5SIWJ.js +0 -8
  268. package/ui/dist/assets/CPRuns-DB8S7loF.js +0 -1
  269. package/ui/dist/assets/CPVoice-DfwHPewA.js +0 -1
  270. package/ui/dist/assets/CheckpointsPanel-9-l_8GdG.js +0 -1
  271. package/ui/dist/assets/CommandPostHub-z55Yrhj1.js +0 -24
  272. package/ui/dist/assets/CronPanel-kEZK3gpx.js +0 -1
  273. package/ui/dist/assets/EmptyState-CfvU7SdB.js +0 -1
  274. package/ui/dist/assets/EvalPanel-CDG-njyj.js +0 -1
  275. package/ui/dist/assets/FilesPanel-CaLPog2e.js +0 -16
  276. package/ui/dist/assets/FleetPanel-BtlaV6pH.js +0 -1
  277. package/ui/dist/assets/InfraView-C0zEuFrR.js +0 -2
  278. package/ui/dist/assets/Input-CbrMbLgn.js +0 -1
  279. package/ui/dist/assets/IntegrationsPanel-B4TyR6jC.js +0 -1
  280. package/ui/dist/assets/IntelligenceView-DZ4HxYZ3.js +0 -2
  281. package/ui/dist/assets/LearningPanel-B4RIm_iQ.js +0 -1
  282. package/ui/dist/assets/McpPanel-BmNUFozc.js +0 -1
  283. package/ui/dist/assets/MemoryGraphPanel-JPurHV0L.js +0 -16
  284. package/ui/dist/assets/MemoryWikiPanel-DdvCAZHa.js +0 -6
  285. package/ui/dist/assets/MissionStart-wUkcEP0T.js +0 -1
  286. package/ui/dist/assets/Modal-BmS7C6FN.js +0 -1
  287. package/ui/dist/assets/OrganismPanel-C2LYDPrn.js +0 -1
  288. package/ui/dist/assets/OverviewPanel-DK8uuq4D.js +0 -1
  289. package/ui/dist/assets/PersonaProfilesPanel-DGtokXUu.js +0 -8
  290. package/ui/dist/assets/RecipesPanel-D3Zs2wxr.js +0 -1
  291. package/ui/dist/assets/SecurityPanel-BMERf796.js +0 -1
  292. package/ui/dist/assets/SelfImprovePanel-BxqWHXCU.js +0 -1
  293. package/ui/dist/assets/SelfProposalsPanel-CuC94vdx.js +0 -2
  294. package/ui/dist/assets/SessionsPanel-CQ8qvzp7.js +0 -1
  295. package/ui/dist/assets/SessionsTab-B3eHV3jf.js +0 -1
  296. package/ui/dist/assets/SettingsPanel-Cumls7N2.js +0 -1
  297. package/ui/dist/assets/SettingsView-BtA67pol.js +0 -2
  298. package/ui/dist/assets/SkillsPanel-CA415CT8.js +0 -11
  299. package/ui/dist/assets/TeamsPanel-C_Vu6vnY.js +0 -1
  300. package/ui/dist/assets/TitanCanvas-TuYZSZO7.js +0 -1117
  301. package/ui/dist/assets/ToolsView-BvTN6vFn.js +0 -2
  302. package/ui/dist/assets/TraceViewer-Bh8Jo3Dr.js +0 -1
  303. package/ui/dist/assets/TrainingPanel-Dmbd1rJ-.js +0 -1
  304. package/ui/dist/assets/VramPanel-CPICbZ2s.js +0 -1
  305. package/ui/dist/assets/WatchView-BCgLVfiV.js +0 -13
  306. package/ui/dist/assets/WorkTab-iptofXO9.js +0 -1
  307. package/ui/dist/assets/WorkflowsPanel-3RYkFHyf.js +0 -11
  308. package/ui/dist/assets/chevron-up-UyfdjRp6.js +0 -6
  309. package/ui/dist/assets/index-CUgepw5Q.js +0 -337
  310. package/ui/dist/assets/index-Dm6zcSTS.css +0 -1
  311. package/ui/dist/assets/proxy-CWET5FFX.js +0 -9
@@ -1 +1 @@
1
- import{r,aR as v,j as e}from"./index-CUgepw5Q.js";import{P as j}from"./PageHeader-bnc85wQN.js";import{R as y}from"./refresh-cw-CwDpzXUn.js";import"./chevron-right-CQ1NTOtd.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 k(){const[c,u]=r.useState([]),[g,m]=r.useState(!0),[i,d]=r.useState(null),[n,b]=r.useState(""),[o,h]=r.useState(100),[l,p]=r.useState(!1),s=r.useRef(null),a=r.useCallback(async()=>{try{const t=await v(n||void 0,o);u(t),d(null)}catch(t){d(t instanceof Error?t.message:"Failed to fetch logs")}finally{m(!1)}},[n,o]);return r.useEffect(()=>{a()},[a]),r.useEffect(()=>(l?s.current=setInterval(a,5e3):s.current&&(clearInterval(s.current),s.current=null),()=>{s.current&&clearInterval(s.current)}),[l,a]),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(j,{title:"Logs",subtitle:"Recent gateway and skill activity",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"System"},{label:"Logs"}]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("select",{value:n,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:a,className:"ml-auto rounded-lg p-2 text-text-secondary transition-colors hover:bg-bg-tertiary hover:text-text",title:"Refresh",children:e.jsx(y,{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{k as default};
1
+ import{r,aT as v,j as e}from"./index-Cml2x9pA.js";import{P as j}from"./PageHeader-DdrbS1aq.js";import{R as y}from"./refresh-cw-C-iZkzuS.js";import"./chevron-right-DbLSHmff.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 R(){const[c,u]=r.useState([]),[g,m]=r.useState(!0),[i,d]=r.useState(null),[n,b]=r.useState(""),[o,h]=r.useState(100),[l,p]=r.useState(!1),s=r.useRef(null),a=r.useCallback(async()=>{try{const t=await v(n||void 0,o);u(t),d(null)}catch(t){d(t instanceof Error?t.message:"Failed to fetch logs")}finally{m(!1)}},[n,o]);return r.useEffect(()=>{a()},[a]),r.useEffect(()=>(l?s.current=setInterval(a,5e3):s.current&&(clearInterval(s.current),s.current=null),()=>{s.current&&clearInterval(s.current)}),[l,a]),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(j,{title:"Logs",subtitle:"Recent gateway and skill activity",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"System"},{label:"Logs"}]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("select",{value:n,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:a,className:"ml-auto rounded-lg p-2 text-text-secondary transition-colors hover:bg-bg-tertiary hover:text-text",title:"Refresh",children:e.jsx(y,{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{R as default};
@@ -0,0 +1 @@
1
+ import{t as R,r as d,j as e,G as z,ak as D,al as E,am as j,an as L,ao as F,ap as G}from"./index-Cml2x9pA.js";import{P as H}from"./PageHeader-DdrbS1aq.js";import{C as B}from"./ConfirmDialog-VErHWAbo.js";import{R as Q}from"./refresh-cw-C-iZkzuS.js";import{P as U}from"./plus-Dpo1qfrl.js";import{S as N}from"./server-BzisF3LL.js";import{P as W}from"./plug-DvcpOalj.js";import{T as q,P as J}from"./test-tube-CDATRD5t.js";import{T as K}from"./trash-2-CTeyjxD_.js";import"./chevron-right-DbLSHmff.js";import"./Modal-ybPGvlQs.js";import"./clsx-B-dksMZM.js";import"./Button-MdXmb4_n.js";function le(){const{toast:a}=R(),[n,y]=d.useState([]),[C,f]=d.useState([]),[P,u]=d.useState(!0),[p,i]=d.useState(!1),[b,g]=d.useState(null),[l,x]=d.useState(null),[m,v]=d.useState(null),[r,o]=d.useState({id:"",name:"",description:"",type:"stdio",command:"",args:"",url:""}),c=async()=>{u(!0);try{const[t,s]=await Promise.all([D(),E()]);y(t),f(s)}catch(t){a("error",`Couldn't load MCP servers — try again. (${t.message})`)}u(!1)};d.useEffect(()=>{c()},[]);const M=async()=>{try{await j({id:r.id,name:r.name,description:r.description,type:r.type,...r.type==="stdio"?{command:r.command,args:r.args.split(/\s+/).filter(Boolean)}:{url:r.url}}),i(!1),o({id:"",name:"",description:"",type:"stdio",command:"",args:"",url:""}),c(),a("success","MCP server added.")}catch(t){a("error",`Couldn't add MCP server — ${t.message}`)}},w=async t=>{try{await j({presetId:t}),c(),a("success","MCP server added.")}catch(s){a("error",`Couldn't add MCP server — ${s.message}`)}},T=async t=>{try{await G(t),c(),a("success","MCP server removed.")}catch(s){a("error",`Couldn't remove MCP server — try again. (${s.message})`)}},S=async(t,s)=>{try{await F(t,s),c(),a("success",s?"MCP server enabled.":"MCP server disabled.")}catch(I){a("error",`Couldn't update MCP server — try again. (${I.message})`)}},A=async t=>{g(t),x(null);try{const s=await L(t);x({id:t,...s})}catch(s){x({id:t,ok:!1,tools:0,error:s.message})}g(null)},k=t=>t==="connected"?"text-[var(--success)]":t==="error"?"text-[var(--error)]":"text-[var(--text-muted)]",$=t=>t==="connected"?"bg-[var(--success)]":t==="error"?"bg-[var(--error)]":"bg-[var(--text-muted)]",h=C.filter(t=>!n.some(s=>s.id===t.id));return e.jsxs("div",{className:"space-y-6",children:[e.jsx(H,{title:"MCP Connections",subtitle:"Connect to external tools via Model Context Protocol",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"MCP"}],actions:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:c,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(Q,{size:14})}),e.jsxs("button",{onClick:()=>i(!p),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(U,{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:n.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:n.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:n.reduce((t,s)=>t+s.toolCount,0)})]})]}),p&&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"}),h.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:h.map(t=>e.jsxs("button",{onClick:()=>w(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(N,{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:r.id,onChange:t=>o({...r,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:r.name,onChange:t=>o({...r,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:r.description,onChange:t=>o({...r,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:r.type,onChange:t=>o({...r,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)"})]})]}),r.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:r.command,onChange:t=>o({...r,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:r.args,onChange:t=>o({...r,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:r.url,onChange:t=>o({...r,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:M,disabled:!r.id||!r.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:()=>i(!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"})]})]}),P?e.jsx("div",{className:"text-[var(--text-muted)] text-sm",children:"Loading MCP servers..."}):n.length===0?e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-8 text-center",children:[e.jsx(W,{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:n.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(N,{size:18,className:"text-[var(--text-muted)]"}):e.jsx(z,{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 ${$(t.status)}`}),e.jsx("span",{className:k(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:()=>A(t.id),disabled:b===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(q,{size:14,className:b===t.id?"animate-pulse":""})}),e.jsx("button",{onClick:()=>S(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(J,{size:14})}),e.jsx("button",{onClick:()=>v(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(K,{size:14})})]})]}),(l==null?void 0:l.id)===t.id&&e.jsx("div",{className:`mt-3 px-3 py-2 rounded-md text-xs ${l.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:l.ok?`Connected successfully — ${l.tools} tools discovered`:`Connection failed: ${l.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."]})]}),e.jsx(B,{open:m!==null,title:"Remove MCP server?",message:`This removes "${m}" and its tools from TITAN. This can't be undone.`,confirmLabel:"Remove",onConfirm:async()=>{const t=m;v(null),t&&await T(t)},onCancel:()=>v(null)})]})}export{le as default};
@@ -0,0 +1 @@
1
+ import{t as ze,r as y,b as Me,j as o,X as Re}from"./index-Cml2x9pA.js";import{C as Pe}from"./ConfirmDialog-VErHWAbo.js";import{N as Ce}from"./network-C9RXQGrV.js";import{a as Te,Z as Fe,M as Ee}from"./zoom-out-D47_pRAO.js";import{R as Ie}from"./refresh-cw-C-iZkzuS.js";import{T as Ae}from"./trash-2-CTeyjxD_.js";import{S as Ye}from"./search-D10l0m3-.js";import"./Modal-ybPGvlQs.js";import"./clsx-B-dksMZM.js";import"./Button-MdXmb4_n.js";const Se={person:"#818cf8",topic:"#22d3ee",project:"#34d399",place:"#fbbf24",fact:"#f472b6",tool:"#fb923c",preference:"#a78bfa",software:"#38bdf8",system:"#e879f9",event:"#fb7185",product:"#4ade80",company:"#facc15",file:"#94a3b8",technology:"#2dd4bf",hardware:"#f97316",component:"#c084fc",feature:"#67e8f9",directory:"#a1a1aa",social_post:"#ec4899"},qe={person:"Person",topic:"Topic",project:"Project",place:"Place",fact:"Fact",tool:"Tool",preference:"Preference",software:"Software",system:"System",event:"Event",product:"Product",company:"Company",file:"File",technology:"Technology",hardware:"Hardware",component:"Component",feature:"Feature",directory:"Directory",social_post:"Social Post"},$e=["#f0abfc","#86efac","#fda4af","#7dd3fc","#d9f99d","#fcd34d"];function ce(l){const n=l==null?void 0:l.toLowerCase();if(Se[n])return Se[n];let v=0;for(let C=0;C<((n==null?void 0:n.length)??0);C++)v=(v<<5)-v+n.charCodeAt(C)|0;return $e[Math.abs(v)%$e.length]}function ke(l){const n=parseInt(l.slice(1),16);return[n>>16&255,n>>8&255,n&255]}function we(l){return typeof l=="number"&&Number.isFinite(l)}function Y(l){return we(l.x)&&we(l.y)}function De(l,n,v,C){var ee,le,he;const S=l.length;if(S===0||!Number.isFinite(v)||!Number.isFinite(C)||v<=0||C<=0)return;const q=v/2,O=C/2,$=new Map;for(let m=0;m<S;m++){const p=((ee=l[m].type)==null?void 0:ee.toLowerCase())??"unknown";$.has(p)||$.set(p,[]),$.get(p).push(m)}const P=[...$.keys()],x=new Map,F=Math.min(v,C)*.3;for(let m=0;m<P.length;m++){const p=m/P.length*Math.PI*2-Math.PI/2;x.set(P[m],{x:q+Math.cos(p)*F,y:O+Math.sin(p)*F})}for(let m=0;m<S;m++){const p=l[m];if(Y(p))continue;const W=x.get(((le=p.type)==null?void 0:le.toLowerCase())??"unknown")??{x:q,y:O},V=Math.min(v,C)*.12;p.x=W.x+(Math.random()-.5)*V,p.y=W.y+(Math.random()-.5)*V,p.vx=0,p.vy=0}const U=new Map(l.map(m=>[m.id,m])),K=Math.sqrt(S/50),D=Math.min(200,Math.max(80,Math.round(60+S*.2))),xe=4e3*K,ae=.003/K,pe=.003/K,fe=.015,Z=new Map;for(const m of n)Z.has(m.from)||Z.set(m.from,new Set),Z.has(m.to)||Z.set(m.to,new Set),Z.get(m.from).add(m.to),Z.get(m.to).add(m.from);for(let m=0;m<D;m++){const p=.9-m/D*.35,W=m/D;if(S>200)for(let r=0;r<S;r++){const u=l[r];if(!Y(u))continue;const z=Z.get(u.id)??new Set;for(let R=r+1;R<S;R++){if(!z.has(l[R].id)&&Math.random()>.2)continue;const k=l[R];if(!Y(k))continue;const t=u.x-k.x,e=u.y-k.y,s=t*t+e*e,a=Math.sqrt(s)||1,i=xe/(s+100),d=t/a*i,b=e/a*i;u.vx+=d,u.vy+=b,k.vx-=d,k.vy-=b}}else for(let r=0;r<S;r++)for(let u=r+1;u<S;u++){const z=l[r],R=l[u];if(!Y(z)||!Y(R))continue;const k=z.x-R.x,t=z.y-R.y,e=k*k+t*t,s=Math.sqrt(e)||1,a=xe/(e+100),i=k/s*a,d=t/s*a;z.vx+=i,z.vy+=d,R.vx-=i,R.vy-=d}for(const r of n){const u=U.get(r.from),z=U.get(r.to);if(!u||!z||!Y(u)||!Y(z))continue;const R=z.x-u.x,k=z.y-u.y,t=Math.sqrt(R*R+k*k)||1,e=t*ae,s=R/t*e,a=k/t*e;u.vx+=s,u.vy+=a,z.vx-=s,z.vy-=a}const V=fe*(1-W*.5);for(const r of l){if(!Y(r))continue;const u=x.get(((he=r.type)==null?void 0:he.toLowerCase())??"unknown");u&&(r.vx+=(u.x-r.x)*V,r.vy+=(u.y-r.y)*V)}for(const r of l)Y(r)&&(r.vx+=(q-r.x)*pe,r.vy+=(O-r.y)*pe);const te=40;for(const r of l)Y(r)&&(r.vx*=p,r.vy*=p,r.x+=r.vx,r.y+=r.vy,(!Number.isFinite(r.x)||!Number.isFinite(r.y))&&(r.x=q,r.y=O),r.x=Math.max(te,Math.min(Math.max(te,v-te),r.x)),r.y=Math.max(te,Math.min(Math.max(te,C-te),r.y)))}}function We(l,n,v,C,S){const q=(l+v)/2,O=(n+C)/2,$=v-l,x=-(C-n),F=$,U=Math.sqrt(x*x+F*F)||1;return{cx:q+x/U*S,cy:O+F/U*S}}function Xe(l,n,v,C,S,q,O){const $=Math.atan2(v-S,n-C),P=8,x=n-Math.cos($)*q,F=v-Math.sin($)*q;l.beginPath(),l.moveTo(x,F),l.lineTo(x-Math.cos($-Math.PI/6)*P,F-Math.sin($-Math.PI/6)*P),l.lineTo(x-Math.cos($)*P*.5,F-Math.sin($)*P*.5),l.lineTo(x-Math.cos($+Math.PI/6)*P,F-Math.sin($+Math.PI/6)*P),l.closePath(),l.fillStyle=O,l.fill()}function et(){const{toast:l}=ze(),[n,v]=y.useState(null),[C,S]=y.useState(!0),[q,O]=y.useState(null),[$,P]=y.useState(!1),[x,F]=y.useState(null),[U,K]=y.useState(null),[D,xe]=y.useState(""),[ae,pe]=y.useState(new Set),fe=y.useRef(null),Z=y.useRef(null),ee=y.useRef({x:0,y:0,zoom:1,dragging:!1,startX:0,startY:0}),le=y.useRef(0),he=y.useRef(0),m=y.useRef(new Map),p=y.useCallback(async()=>{var t;try{const e=await Me("/api/graphiti",{headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error(`${e.status}: ${e.statusText}`);const s=await e.json();if((t=s.nodes)!=null&&t.length){const a=Z.current,i=(a==null?void 0:a.clientWidth)??1200,d=(a==null?void 0:a.clientHeight)??600;for(const b of s.nodes){const X=m.current.get(b.id);X&&we(X.x)&&we(X.y)&&(b.x=X.x,b.y=X.y)}De(s.nodes,s.edges??[],i,d);for(const b of s.nodes)Y(b)&&m.current.set(b.id,{x:b.x,y:b.y})}v(s),O(null)}catch(e){O(e instanceof Error?e.message:"Failed to load graph"),v(null)}finally{S(!1)}},[]);y.useEffect(()=>{p()},[p]);const W=y.useMemo(()=>{if(!n)return{nodes:[],edges:[]};const t=D.toLowerCase().trim();let e=n.nodes;if(ae.size>0&&(e=e.filter(i=>{var d;return!ae.has((d=i.type)==null?void 0:d.toLowerCase())})),t){const i=new Set;for(const d of e)(d.label.toLowerCase().includes(t)||d.facts.some(b=>b.toLowerCase().includes(t)))&&i.add(d.id);for(const d of n.edges)i.has(d.from)&&i.add(d.to),i.has(d.to)&&i.add(d.from);e=e.filter(d=>i.has(d.id))}const s=new Set(e.map(i=>i.id)),a=(n.edges??[]).filter(i=>s.has(i.from)&&s.has(i.to));return{nodes:e,edges:a}},[n,D,ae]),V=y.useMemo(()=>{if(!D.trim()||!n)return null;const t=D.toLowerCase().trim(),e=n.nodes.find(s=>s.label.toLowerCase().includes(t));return(e==null?void 0:e.id)??null},[D,n]),te=async()=>{try{await Me("/api/graphiti",{method:"DELETE"}),l("success","Memory graph cleared."),p(),F(null)}catch(t){l("error",`Couldn't clear the memory graph — try again. ${t.message}`)}},r=t=>{const e=ee.current;e.zoom=Math.max(.2,Math.min(4,e.zoom*t)),K(s=>s)},u=()=>{ee.current={x:0,y:0,zoom:1,dragging:!1,startX:0,startY:0},K(t=>t)},z=t=>{pe(e=>{const s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})};y.useEffect(()=>{const t=fe.current;if(!t||!W.nodes.length)return;const e=t.getContext("2d");if(!e)return;const s=window.devicePixelRatio||1,a=t.getBoundingClientRect();if(!Number.isFinite(a.width)||!Number.isFinite(a.height)||a.width<=0||a.height<=0)return;t.width=a.width*s,t.height=a.height*s,e.scale(s,s);const i=a.width,d=a.height,{nodes:b,edges:X}=W,w=b.filter(Y),j=new Map(w.map(E=>[E.id,E])),H=()=>{he.current++;const E=he.current,f=ee.current;e.clearRect(0,0,i,d);const B=e.createRadialGradient(i/2,d/2,0,i/2,d/2,i*.7);B.addColorStop(0,"#0c0c14"),B.addColorStop(1,"#09090b"),e.fillStyle=B,e.fillRect(0,0,i,d),e.fillStyle="rgba(255,255,255,0.02)";const T=35*f.zoom,be=(f.x%T+T)%T,ye=(f.y%T+T)%T;for(let c=be;c<i;c+=T)for(let G=ye;G<d;G+=T)e.fillRect(c,G,1,1);for(let c=0;c<15;c++){const G=(E*.15+c*127)%i,M=(E*.1+c*173)%d,N=.02+Math.sin(E*.008+c)*.01;e.beginPath(),e.arc(G,M,1,0,Math.PI*2),e.fillStyle=`rgba(99,102,241,${N})`,e.fill()}const oe=new Set,_=(x==null?void 0:x.id)??U??V;if(_){oe.add(_);for(const c of X)c.from===_&&oe.add(c.to),c.to===_&&oe.add(c.from)}const ve=_!=null;for(const c of X){const G=j.get(c.from),M=j.get(c.to);if(!G||!M)continue;const N=ve&&(c.from===_||c.to===_);if(ve&&!N&&b.length>100)continue;const se=G.x*f.zoom+f.x,ne=G.y*f.zoom+f.y,h=M.x*f.zoom+f.x,g=M.y*f.zoom+f.y;if(se<-50&&h<-50||ne<-50&&g<-50||se>i+50&&h>i+50||ne>d+50&&g>d+50)continue;const L=X.indexOf(c),Ne=15+L%3*6,{cx:ie,cy:de}=We(se,ne,h,g,Ne*(L%2===0?1:-1));if(N&&(e.beginPath(),e.moveTo(se,ne),e.quadraticCurveTo(ie,de,h,g),e.strokeStyle="rgba(99,102,241,0.12)",e.lineWidth=5,e.stroke()),e.beginPath(),e.moveTo(se,ne),e.quadraticCurveTo(ie,de,h,g),N){const A=ce(G.type),[J,Q,me]=ke(A);e.strokeStyle=`rgba(${J},${Q},${me},0.5)`,e.lineWidth=1.8}else e.strokeStyle="rgba(100,116,139,0.04)",e.lineWidth=.5;if(e.stroke(),N){const A=Math.max(10,Math.min(24,M.size||14))*f.zoom;Xe(e,h,g,ie,de,A+3,"rgba(148,163,184,0.6)")}if(N&&c.label&&c.label!=="co_mentioned"){const J=.25*se+.5*ie+.25*h,Q=(1-.5)*(1-.5)*ne+2*(1-.5)*.5*de+.5*.5*g;e.font=`${Math.max(9,10*f.zoom)}px "Inter", system-ui, sans-serif`;const me=e.measureText(c.label).width+12;e.fillStyle="rgba(15,15,25,0.85)",e.beginPath(),e.roundRect(J-me/2,Q-11,me,18,4),e.fill(),e.strokeStyle="rgba(99,102,241,0.3)",e.lineWidth=.5,e.stroke(),e.fillStyle="var(--color-accent-light)",e.textAlign="center",e.textBaseline="middle",e.fillText(c.label,J,Q)}}for(const c of w){const G=ce(c.type),[M,N,I]=ke(G),se=Math.max(8,Math.min(24,c.size||12)),ne=Math.sin(E*.025+c.id.charCodeAt(0)*.5)*1,h=(se+ne)*f.zoom;if(!Number.isFinite(h)||h<=0)continue;const g=c.x*f.zoom+f.x,L=c.y*f.zoom+f.y;if(!Number.isFinite(g)||!Number.isFinite(L)||g<-h*3||L<-h*3||g>i+h*3||L>d+h*3)continue;const Ne=U===c.id,ie=(x==null?void 0:x.id)===c.id,de=V===c.id,A=Ne||ie||de,J=ve&&!oe.has(c.id);if(!J){const ue=A?.2:.05+Math.sin(E*.02+c.id.charCodeAt(0))*.015,ge=A?h*3.5:h*2,re=e.createRadialGradient(g,L,h*.3,g,L,ge);re.addColorStop(0,`rgba(${M},${N},${I},${ue})`),re.addColorStop(.5,`rgba(${M},${N},${I},${ue*.3})`),re.addColorStop(1,`rgba(${M},${N},${I},0)`),e.fillStyle=re,e.beginPath(),e.arc(g,L,ge,0,Math.PI*2),e.fill()}const Q=e.createRadialGradient(g-h*.3,L-h*.35,0,g,L,h);J?(Q.addColorStop(0,`rgba(${M},${N},${I},0.06)`),Q.addColorStop(1,`rgba(${M},${N},${I},0.02)`)):(Q.addColorStop(0,`rgba(${M},${N},${I},${A?.45:.25})`),Q.addColorStop(1,`rgba(${M},${N},${I},${A?.18:.07})`)),e.beginPath(),e.arc(g,L,h,0,Math.PI*2),e.fillStyle=Q,e.fill(),e.beginPath(),e.arc(g,L,h,0,Math.PI*2),J?(e.strokeStyle=`rgba(${M},${N},${I},0.08)`,e.lineWidth=.5):A?(e.strokeStyle=`rgba(${M},${N},${I},0.9)`,e.lineWidth=2.5):(e.strokeStyle=`rgba(${M},${N},${I},0.4)`,e.lineWidth=1),e.stroke(),ie&&(e.beginPath(),e.arc(g,L,h+5,0,Math.PI*2),e.setLineDash([4,4]),e.lineDashOffset=-E*.3,e.strokeStyle=`rgba(${M},${N},${I},0.4)`,e.lineWidth=1,e.stroke(),e.setLineDash([]));const me=c.facts.length>=3;if(!J&&(A||ve&&oe.has(c.id)||f.zoom>=1.3||f.zoom>=.8&&me)){const ue=f.zoom>1?20:12,ge=c.label.length>ue?c.label.slice(0,ue-1)+"…":c.label,re=Math.max(9,11*f.zoom);e.font=`600 ${re}px "Inter", system-ui, sans-serif`;const je=e.measureText(ge).width+8;if(e.fillStyle="rgba(9,9,11,0.75)",e.beginPath(),e.roundRect(g-je/2,L-re/2-1,je,re+2,3),e.fill(),e.fillStyle=A?"#fafafa":"#a1a1aa",e.textAlign="center",e.textBaseline="middle",e.fillText(ge,g,L),f.zoom>.7){const Le=Math.max(7,8*f.zoom);e.font=`500 ${Le}px "Inter", system-ui, sans-serif`,e.fillStyle=`rgba(${M},${N},${I},${A?.9:.5})`,e.fillText(c.type,g,L+h+Math.max(9,11*f.zoom))}}}le.current=requestAnimationFrame(H)};return le.current=requestAnimationFrame(H),()=>cancelAnimationFrame(le.current)},[W,U,x,V]),y.useEffect(()=>{const t=fe.current;if(!t||!W.nodes.length)return;const e=ee.current,s=(w,j)=>{const H=t.getBoundingClientRect(),E=w-H.left,f=j-H.top;for(const B of[...W.nodes].reverse()){const T=Math.max(8,Math.min(24,B.size||12))*e.zoom;if(!Y(B)||!Number.isFinite(T)||T<=0)continue;const be=B.x*e.zoom+e.x,ye=B.y*e.zoom+e.y;if(!Number.isFinite(be)||!Number.isFinite(ye))continue;const oe=E-be,_=f-ye;if(oe*oe+_*_<=(T+6)*(T+6))return B}return null},a=w=>{w.preventDefault();const j=t.getBoundingClientRect(),H=w.clientX-j.left,E=w.clientY-j.top,f=e.zoom,B=w.deltaY>0?.92:1.08;e.zoom=Math.max(.2,Math.min(4,e.zoom*B)),e.x=H-(H-e.x)*(e.zoom/f),e.y=E-(E-e.y)*(e.zoom/f),K(T=>T)},i=w=>{e.dragging=!0,e.startX=w.clientX-e.x,e.startY=w.clientY-e.y,t.style.cursor="grabbing"},d=w=>{if(e.dragging)e.x=w.clientX-e.startX,e.y=w.clientY-e.startY,K(j=>j);else{const j=s(w.clientX,w.clientY);K((j==null?void 0:j.id)??null),t.style.cursor=j?"pointer":"grab"}},b=()=>{e.dragging=!1,t.style.cursor="grab"},X=w=>{if(e.dragging)return;const j=s(w.clientX,w.clientY);F(H=>(H==null?void 0:H.id)===(j==null?void 0:j.id)?null:j??null)};return t.addEventListener("wheel",a,{passive:!1}),t.addEventListener("mousedown",i),t.addEventListener("mousemove",d),t.addEventListener("mouseup",b),t.addEventListener("mouseleave",b),t.addEventListener("click",X),()=>{t.removeEventListener("wheel",a),t.removeEventListener("mousedown",i),t.removeEventListener("mousemove",d),t.removeEventListener("mouseup",b),t.removeEventListener("mouseleave",b),t.removeEventListener("click",X)}},[W]);const R=y.useMemo(()=>{var e;if(!n)return[];const t=new Map;for(const s of n.nodes){const a=((e=s.type)==null?void 0:e.toLowerCase())??"unknown";t.set(a,(t.get(a)??0)+1)}return[...t.entries()].sort((s,a)=>a[1]-s[1]).map(([s,a])=>({type:s,count:a}))},[n]);if(C)return o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"h-12 animate-pulse rounded-xl bg-bg-secondary"}),o.jsx("div",{className:"animate-pulse rounded-xl border border-border bg-bg",style:{height:"60vh",minHeight:400}})]});const k=n&&n.nodes.length>0;return o.jsxs("div",{className:"space-y-4",ref:Z,children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-accent/10",children:o.jsx(Ce,{className:"h-4 w-4 text-accent-hover"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-text",children:"Memory Graph"}),o.jsx("p",{className:"text-xs text-text-muted",children:"Temporal knowledge graph powered by entity extraction"})]})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[k&&o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>r(1.2),className:"rounded-lg p-1.5 text-text-muted hover:bg-bg-tertiary hover:text-text transition-colors",title:"Zoom in",children:o.jsx(Te,{className:"h-4 w-4"})}),o.jsx("button",{onClick:()=>r(.8),className:"rounded-lg p-1.5 text-text-muted hover:bg-bg-tertiary hover:text-text transition-colors",title:"Zoom out",children:o.jsx(Fe,{className:"h-4 w-4"})}),o.jsx("button",{onClick:u,className:"rounded-lg p-1.5 text-text-muted hover:bg-bg-tertiary hover:text-text transition-colors",title:"Fit view",children:o.jsx(Ee,{className:"h-4 w-4"})}),o.jsx("div",{className:"mx-1 h-4 w-px bg-bg-tertiary"})]}),o.jsxs("button",{onClick:p,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:[o.jsx(Ie,{className:"h-3.5 w-3.5"})," Refresh"]}),o.jsxs("button",{onClick:()=>P(!0),className:"flex items-center gap-1.5 rounded-lg bg-bg-tertiary px-3 py-1.5 text-xs text-error hover:bg-error/10 transition-colors",children:[o.jsx(Ae,{className:"h-3.5 w-3.5"})," Clear"]})]})]}),q&&o.jsx("div",{className:"rounded-xl border border-error/50 bg-error/5 p-4 text-sm text-error",children:q}),o.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{label:"Entities",value:(n==null?void 0:n.nodeCount)??0,color:"var(--color-accent-hover)"},{label:"Relationships",value:(n==null?void 0:n.edgeCount)??0,color:"var(--color-cyan)"},{label:"Episodes",value:(n==null?void 0:n.episodeCount)??0,color:"var(--color-emerald)"}].map(({label:t,value:e,color:s})=>o.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary px-4 py-3",children:[o.jsx("p",{className:"text-xs text-text-muted",children:t}),o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("p",{className:"text-2xl font-bold",style:{color:s},children:e.toLocaleString()}),e>0&&o.jsx("div",{className:"h-1.5 w-1.5 rounded-full animate-pulse",style:{backgroundColor:s}})]})]},t))}),k&&o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"relative",children:[o.jsx(Ye,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted"}),o.jsx("input",{type:"text",value:D,onChange:t=>xe(t.target.value),placeholder:"Search entities and facts...",className:"w-full rounded-lg border border-border bg-bg-secondary py-2 pl-9 pr-8 text-sm text-text placeholder:text-text-muted focus:border-accent focus:outline-none"}),D&&o.jsx("button",{onClick:()=>xe(""),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-0.5 text-text-muted hover:text-text",children:o.jsx(Re,{className:"h-3.5 w-3.5"})})]}),o.jsx("div",{className:"flex flex-wrap gap-1.5",children:R.map(({type:t,count:e})=>{const s=ce(t),a=ae.has(t);return o.jsxs("button",{onClick:()=>z(t),className:`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] font-medium transition-all ${a?"bg-bg-tertiary/50 text-text-muted opacity-40":"bg-bg-tertiary text-text-secondary hover:brightness-110"}`,children:[o.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:a?"var(--color-border-light)":s}}),qe[t]??t.charAt(0).toUpperCase()+t.slice(1),o.jsx("span",{className:"text-text-muted",children:e})]},t)})})]}),k?o.jsxs("div",{className:"relative rounded-xl border border-border bg-bg overflow-hidden shadow-2xl shadow-black/50",style:{height:"60vh",minHeight:400},children:[o.jsx("canvas",{ref:fe,style:{width:"100%",height:"100%",cursor:"grab"}}),o.jsxs("div",{className:"absolute bottom-3 right-3 rounded-md bg-bg/80 px-2 py-1 text-[10px] text-text-muted backdrop-blur-sm border border-bg-tertiary",children:[Math.round(ee.current.zoom*100),"%"]}),(D||ae.size>0)&&o.jsxs("div",{className:"absolute top-3 left-3 rounded-md bg-bg/80 px-2 py-1 text-[10px] text-text-muted backdrop-blur-sm border border-bg-tertiary",children:["Showing ",W.nodes.length," of ",(n==null?void 0:n.nodes.length)??0," entities"]})]}):o.jsxs("div",{className:"relative rounded-xl border border-border bg-bg-secondary overflow-hidden flex flex-col items-center justify-center",style:{height:"60vh",minHeight:400},children:[o.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-2xl bg-accent/10 border border-accent/20 mb-4",children:o.jsx(Ce,{className:"h-7 w-7 text-accent-hover"})}),o.jsx("p",{className:"text-sm font-medium text-text-secondary",children:"No entities in the graph yet"}),o.jsx("p",{className:"mt-1 max-w-sm text-center text-xs text-text-muted",children:"Start chatting with TITAN to build the knowledge graph. Entities, relationships, and facts are extracted automatically from conversations."})]}),x&&o.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-3 border-b border-bg-tertiary px-4 py-3",children:[o.jsx("div",{className:"h-3.5 w-3.5 rounded-full shadow-lg",style:{backgroundColor:ce(x.type),boxShadow:`0 0 8px ${ce(x.type)}40`}}),o.jsx("span",{className:"font-semibold text-text",children:x.label}),o.jsx("span",{className:"rounded-md bg-bg-tertiary px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-text-secondary",children:x.type})]}),o.jsxs("div",{className:"space-y-3 p-4",children:[x.facts.length>0&&o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-xs font-medium uppercase tracking-wider text-text-muted",children:"Facts"}),o.jsx("div",{className:"space-y-1.5",children:x.facts.map((t,e)=>o.jsx("p",{className:"text-xs text-[#d4d4d8] pl-3 border-l-2",style:{borderColor:ce(x.type)+"40"},children:t},e))})]}),n&&(()=>{const t=n.edges.filter(s=>s.from===x.id||s.to===x.id);if(!t.length)return null;const e=new Map(n.nodes.map(s=>[s.id,s]));return o.jsxs("div",{children:[o.jsxs("p",{className:"mb-2 text-xs font-medium uppercase tracking-wider text-text-muted",children:["Relationships (",t.length,")"]}),o.jsxs("div",{className:"space-y-1.5 max-h-48 overflow-y-auto",children:[t.slice(0,30).map((s,a)=>{const i=e.get(s.from===x.id?s.to:s.from),d=i?ce(i.type):"#64748b";return o.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[o.jsx("span",{className:"text-text-secondary",children:s.label}),o.jsx("span",{className:"text-text-muted",children:"→"}),o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:d}}),o.jsx("span",{className:"text-[#d4d4d8]",children:(i==null?void 0:i.label)??"?"})]})]},a)}),t.length>30&&o.jsxs("p",{className:"text-[10px] text-text-muted",children:["+ ",t.length-30," more"]})]})]})})()]})]}),o.jsx(Pe,{open:$,title:"Clear the entire memory graph?",message:"This permanently deletes every entity, relationship, and episode. This cannot be undone.",confirmLabel:"Clear graph",onConfirm:async()=>{P(!1),await te()},onCancel:()=>P(!1)})]})}export{et as default};
@@ -0,0 +1,6 @@
1
+ import{c as o,r as s,b as i,j as e,B as c}from"./index-Cml2x9pA.js";import{P as d}from"./PageHeader-DdrbS1aq.js";import"./chevron-right-DbLSHmff.js";/**
2
+ * @license lucide-react v0.513.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const m=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],x=o("star",m),p={"always-on":"bg-green-500/10 text-green-400 border-green-500/30","opt-in":"bg-green-500/10 text-green-400 border-green-500/30",connected:"bg-blue-500/10 text-blue-400 border-blue-500/30",unavailable:"bg-slate-500/10 text-slate-400 border-slate-500/30"},b={"always-on":"always-on","opt-in":"enabled",connected:"connected",unavailable:"inactive"};function g(){const[t,r]=s.useState(null),[n,l]=s.useState(!0);return s.useEffect(()=>{i("/api/memory/taxonomy",{headers:{"Content-Type":"application/json"}}).then(a=>a.json()).then(r).catch(()=>r(null)).finally(()=>l(!1))},[]),n?e.jsx("div",{className:"text-[var(--text-muted)]",children:"Loading memory taxonomy…"}):t?e.jsxs("div",{className:"space-y-6",children:[e.jsx(d,{title:"Memory Taxonomy",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Knowledge"},{label:"Memory Taxonomy"}]}),e.jsxs("div",{className:"flex items-center gap-2 text-[var(--text-secondary)]",children:[e.jsx(c,{size:18}),e.jsxs("span",{className:"text-sm",children:[t.total," named memory types · ",t.active," active"]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:t.types.map(a=>e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-sm font-semibold text-[var(--text)]",children:a.label}),a.differentiator&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400",title:"Unique to TITAN — no competitor has a drive-backed emotional memory",children:[e.jsx(x,{size:11})," unique"]}),e.jsx("span",{className:`ml-auto text-[10px] px-2 py-0.5 rounded border ${p[a.availability]}`,children:b[a.availability]})]}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:a.captures}),e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)] mt-1",children:[e.jsx("span",{className:"opacity-70",children:"Recall:"})," ",a.recall]}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)] mt-1 font-mono truncate",title:a.module,children:a.module})]},a.key))})]}):e.jsx("div",{className:"text-[var(--text-muted)]",children:"Memory taxonomy unavailable."})}export{g as default};
@@ -0,0 +1,6 @@
1
+ import{c as v,t as w,r as n,b as h,j as e}from"./index-Cml2x9pA.js";import{P as u}from"./PageHeader-DdrbS1aq.js";import{A as k}from"./arrow-left-WkVYLm80.js";import{L as C}from"./link-CnFkBkaY.js";import{C as S}from"./clock-JyQAYy6X.js";import{S as $}from"./search-D10l0m3-.js";import{B as L}from"./book-open-ohEXgUsS.js";import"./chevron-right-DbLSHmff.js";/**
2
+ * @license lucide-react v0.513.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const M=[["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=v("tag",M),E={person:"var(--color-accent-hover)",topic:"var(--color-cyan)",project:"var(--color-emerald)",place:"#fbbf24",company:"#facc15",technology:"#2dd4bf",event:"#fb7185"};function d(r){return E[r==null?void 0:r.toLowerCase()]??"#94a3b8"}function b(r){const l=Math.floor((Date.now()-new Date(r).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 H(){const{toast:r}=w(),[l,g]=n.useState([]),[t,i]=n.useState(null),[f,j]=n.useState(!0),[o,y]=n.useState(""),[c,N]=n.useState(""),x=n.useCallback(async()=>{try{const s=new URLSearchParams;o&&s.set("q",o),c&&s.set("type",c);const a=await h(`/api/wiki/entities?${s}`);a.ok?g(await a.json()):r("error",`Couldn't load the memory wiki — try again. (${a.status})`)}catch(s){r("error",`Couldn't load the memory wiki — try again. ${s.message}`)}finally{j(!1)}},[o,c,r]),m=async s=>{try{const a=await h(`/api/wiki/entity/${encodeURIComponent(s)}`);a.ok?i(await a.json()):r("error",`Couldn't open "${s}" — try again. (${a.status})`)}catch(a){r("error",`Couldn't open "${s}" — try again. ${a.message}`)}};n.useEffect(()=>{x()},[x]);const p=[...new Set(l.map(s=>s.type))].sort();return t?e.jsxs("div",{className:"space-y-4",children:[e.jsx(u,{title:t.name,breadcrumbs:[{label:"Memory"},{label:"Wiki",href:"/memory-wiki"},{label:t.name}],actions:e.jsxs("button",{onClick:()=>i(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(k,{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:d(t.type),boxShadow:`0 0 10px ${d(t.type)}50`}}),e.jsx("h2",{className:"text-xl font-bold text-text",children:t.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:t.type})]}),t.summary&&e.jsx("p",{className:"text-sm text-text-secondary mb-2",children:t.summary}),t.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: ",t.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(t.firstSeen).toLocaleDateString()]}),e.jsxs("span",{children:["Last seen: ",b(t.lastSeen)]})]})]}),t.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 (",t.facts.length,")"]}),e.jsx("div",{className:"space-y-2",children:t.facts.map((s,a)=>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:s})]},a))})]}),t.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(C,{className:"h-3 w-3 inline mr-1"})," Related (",t.related.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t.related.map(s=>e.jsxs("button",{onClick:()=>m(s.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:d(s.type)}}),e.jsx("span",{className:"text-text",children:s.name}),e.jsxs("span",{className:"text-text-muted",children:["(",s.relation,")"]})]},s.id))})]}),t.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(S,{className:"h-3 w-3 inline mr-1"})," Episode History (",t.episodes.length,")"]}),e.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:t.episodes.map(s=>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(s.createdAt).toLocaleString()}),e.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:s.source})]}),e.jsx("p",{className:"text-xs text-text-secondary",children:s.content})]},s.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($,{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:s=>y(s.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:s=>N(s.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(s=>e.jsx("option",{value:s,children:s},s))]})]}),e.jsxs("div",{className:"flex gap-3 text-xs text-text-muted",children:[e.jsxs("span",{children:[l.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((s,a)=>e.jsx("div",{className:"h-24 animate-pulse rounded-xl border border-border bg-bg-secondary"},a))}):e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[l.map(s=>e.jsxs("button",{onClick:()=>m(s.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:d(s.type)}}),e.jsx("span",{className:"font-medium text-sm text-text truncate",children:s.name})]}),e.jsx("p",{className:"text-xs text-text-secondary line-clamp-2 mb-2",children:s.summary||"No summary"}),e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-text-muted",children:[e.jsx("span",{className:"capitalize",children:s.type}),e.jsxs("span",{children:[s.factCount," facts"]}),e.jsx("span",{children:b(s.lastSeen)})]})]},s.id)),l.length===0&&e.jsxs("div",{className:"col-span-full py-12 text-center",children:[e.jsx(L,{className:"h-8 w-8 text-text-muted mx-auto mb-2"}),e.jsx("p",{className:"text-text-muted",children:"No entities found"})]})]})]})}export{H as default};
@@ -1,4 +1,4 @@
1
- import{c as l,r as n,j as e,as as y,at as j,au as N,av as f,aw as v}from"./index-CUgepw5Q.js";import{D as k}from"./DataTable-PnhPeDBG.js";import{P as w}from"./PageHeader-bnc85wQN.js";import{R as P}from"./refresh-cw-CwDpzXUn.js";import{S as C}from"./shield-check-s7la2J2K.js";import"./chevron-right-CQ1NTOtd.js";/**
1
+ import{c as l,r as n,j as e,au as y,av as j,aw as N,ax as f,ay as v}from"./index-Cml2x9pA.js";import{D as k}from"./DataTable-BCqSUuN7.js";import{P as w}from"./PageHeader-DdrbS1aq.js";import{R as P}from"./refresh-cw-C-iZkzuS.js";import{S as C}from"./shield-check-CXlDJyAW.js";import"./chevron-right-DbLSHmff.js";/**
2
2
  * @license lucide-react v0.513.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{r as o,j as e,p as Ne,u as Se,aC as Ce}from"./index-CUgepw5Q.js";import{p as ee,f as Me,h as $e,i as De,g as Te,a as de,s as Ae,b as ze,d as Oe,e as Fe}from"./missions-2zox16Tc.js";import{F as Le}from"./FileViewer-CVO3TRs3.js";function Ee({member:t,room:a,anchor:r,availableModels:s,onClose:d,onTalkInChat:u}){const p=o.useRef(null),[l,v]=o.useState("main"),[y,h]=o.useState(""),[b,c]=o.useState(!1),[m,f]=o.useState(!1),[w,j]=o.useState(null);o.useEffect(()=>{const g=E=>{E.key==="Escape"&&d()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[d]);const A=320,T=360,C=Re(r,A,T);async function S(){f(!0),j(null);try{await ee(a.id,`@${t.name} quick check-in — how's it going? Anything I can clear for you?`),d()}catch(g){j(g.message)}finally{f(!1)}}async function L(g){const E=y.trim();if(!(!E||b)){c(!0),j(null);try{await ee(a.id,`@${t.name} ${g}${E}`),h(""),d()}catch(W){j(W.message)}finally{c(!1)}}}async function z(g){f(!0),j(null);try{await De(a.id,t.agentId,g),v("main")}catch(E){j(E.message)}finally{f(!1)}}async function k(){f(!0),j(null);try{await Me(a.id,t.agentId,!t.paused)}catch(g){j(g.message)}finally{f(!1)}}async function R(){f(!0),j(null);try{await $e(a.id,!a.longRunningMode)}catch(g){j(g.message)}finally{f(!1)}}return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[60]",onClick:d,"aria-hidden":!0}),e.jsxs("div",{ref:p,className:"absolute z-[61] flex flex-col titan-modal-surface overflow-hidden",style:{left:C.x,top:C.y,width:A,maxHeight:T,borderRadius:12},onClick:g=>g.stopPropagation(),children:[e.jsx("div",{className:"h-1.5",style:{background:`linear-gradient(90deg, ${t.color}, ${ue(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}, ${ue(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," · ",Pe(t)]})]}),e.jsx("button",{onClick:d,"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,'"']}),w&&e.jsx("div",{className:"px-4 py-2 text-[11px] text-error bg-error/10 border-b border-error/30",children:w}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[l==="main"&&e.jsxs("div",{className:"p-2 grid grid-cols-2 gap-2",children:[e.jsx(H,{icon:"👋",label:"Nudge",hint:"A friendly check-in",onClick:S,disabled:m}),e.jsx(H,{icon:"💬",label:"Talk to them",hint:"Send a message just to them",onClick:()=>{u?(u(t.agentId,`@${t.name} `),d()):v("talk")},disabled:m}),e.jsx(H,{icon:"🧭",label:"Steer",hint:"Redirect them mid-task",onClick:()=>v("steer"),disabled:m}),e.jsx(H,{icon:"🧠",label:"Model",hint:t.modelOverride?Ie(t.modelOverride):"default",onClick:()=>v("model"),disabled:m}),e.jsx(H,{icon:t.paused?"▶":"⏸",label:t.paused?"Resume agent":"Pause agent",hint:t.paused?"Bring them back":"Skip them for now",onClick:k,disabled:m,wide:!1}),e.jsx(H,{icon:"🏃",label:a.longRunningMode?"Marathon ON":"Marathon mode",hint:a.longRunningMode?"running 72h goal":"72h auto-run",onClick:R,disabled:m,active:!!a.longRunningMode})]}),(l==="talk"||l==="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:l==="talk"?`Message ${t.name}`:`Steer ${t.name}`}),e.jsx("textarea",{autoFocus:!0,value:y,onChange:g=>h(g.target.value),rows:4,onKeyDown:g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&(g.preventDefault(),L(l==="steer"?"steer: ":""))},placeholder:l==="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"}),l==="steer"&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:["Slow down","Be thorough","Wrap it up","Skip the chart"].map(g=>e.jsx("button",{onClick:()=>h(g.toLowerCase()),className:"px-2 py-0.5 text-[11px] bg-bg-tertiary border border-border rounded-full text-text-muted hover:text-text",children:g},g))}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("button",{onClick:()=>v("main"),className:"text-xs text-text-muted hover:text-text",children:"← Back"}),e.jsx("button",{onClick:()=>L(l==="steer"?"steer: ":""),disabled:!y.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 ⌘↵"})]})]}),l==="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:()=>z(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:s.length===0?e.jsx("div",{className:"text-[11px] text-text-muted italic",children:"No models discovered. /api/models returned empty."}):s.map(g=>{const E=t.modelOverride===g.id;return e.jsxs("button",{onClick:()=>z(g.id),disabled:m,className:`flex items-center justify-between px-2.5 py-1.5 rounded-lg text-[12px] border text-left ${E?"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:g.id}),e.jsx("span",{className:"text-[10px] text-text-muted ml-2 shrink-0",children:g.provider})]},g.id)})}),e.jsx("button",{onClick:()=>v("main"),className:"text-xs text-text-muted hover:text-text self-start mt-1",children:"← Back"})]})]})]})]})}function H({icon:t,label:a,hint:r,onClick:s,disabled:d,wide:u,active:p}){return e.jsxs("button",{onClick:s,disabled:d,className:`text-left p-2.5 rounded-xl border transition-colors ${p?"bg-accent/15 border-accent/50 text-text":"bg-bg-tertiary/40 border-border text-text-secondary hover:text-text hover:border-border-light"} ${u?"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}),r&&e.jsx("div",{className:"text-[10px] text-text-muted leading-snug mt-0.5 truncate",children:r})]})}function Re({x:t,y:a},r,s){const d=window.innerWidth,u=window.innerHeight;return{x:Math.max(8,Math.min(t,d-r-8)),y:Math.max(8,Math.min(a,u-s-8))}}function Pe(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 Ie(t){return t.length<=24?t:t.slice(0,22)+"…"}function ue(t,a){const r=t.replace("#","");if(r.length!==6)return t;const s=parseInt(r,16);let d=s>>16&255,u=s>>8&255,p=s&255;const l=Math.round(255*(a/100));return d=Math.max(0,Math.min(255,d+l)),u=Math.max(0,Math.min(255,u+l)),p=Math.max(0,Math.min(255,p+l)),"#"+(d<<16|u<<8|p).toString(16).padStart(6,"0")}const Be=12;function Ye(t){const a=new Map;for(const s of t){const d=s.activityLog??[];for(const u of d){const p=`${s.agentId}::${u.activity}`,l=a.get(p);if(!l){a.set(p,{id:p,agentId:s.agentId,agentName:s.name,agentColor:s.color,icon:u.icon,activity:u.activity,detail:u.detail,at:u.at,count:1,recentDetails:u.detail?[u.detail]:[]});continue}l.count+=1,u.at>l.at&&(l.at=u.at,l.icon=u.icon,u.detail&&(l.detail=u.detail)),u.detail&&(l.recentDetails=[u.detail,...l.recentDetails.filter(v=>v!==u.detail)].slice(0,3))}}return Array.from(a.values()).sort((s,d)=>s.at<d.at?1:-1).slice(0,Be)}const We=[{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 He(t){try{const a=localStorage.getItem(he(t));return a?JSON.parse(a):{}}catch{return{}}}function Ge(t,a){try{localStorage.setItem(he(t),JSON.stringify(a))}catch{}}function he(t){return`titan-desk:${t}`}function fe(t){return`titan-desk-furniture:${t}`}function Ke(t){const a={cabinet:[],trash:[],permanentlyHidden:[],cabinetOpen:!1,trashOpen:!1};try{const r=localStorage.getItem(fe(t));if(!r)return a;const s=JSON.parse(r);return{cabinet:Array.isArray(s.cabinet)?s.cabinet:[],trash:Array.isArray(s.trash)?s.trash:[],permanentlyHidden:Array.isArray(s.permanentlyHidden)?s.permanentlyHidden:[],cabinetOpen:!!s.cabinetOpen,trashOpen:!!s.trashOpen}}catch{return a}}function _e(t,a){try{localStorage.setItem(fe(t),JSON.stringify(a))}catch{}}function $t(){const{id:t}=Ne(),a=Se(),[r,s]=o.useState(null),[d,u]=o.useState(!0),[p,l]=o.useState(null),[v,y]=o.useState(""),[h,b]=o.useState(!1),[c,m]=o.useState(!1),f=o.useRef(null),[w,j]=o.useState(()=>({width:typeof window>"u"?1400:window.innerWidth,height:typeof window>"u"?800:window.innerHeight}));o.useLayoutEffect(()=>{const n=f.current;if(!n)return;const i=()=>{const M=n.getBoundingClientRect();j($=>{const P=Math.max(320,Math.round(M.width)),N=Math.max(320,Math.round(M.height));return $.width===P&&$.height===N?$:{width:P,height:N}})};i();const x=typeof ResizeObserver<"u"?new ResizeObserver(i):null;return x==null||x.observe(n),window.addEventListener("resize",i),()=>{x==null||x.disconnect(),window.removeEventListener("resize",i)}},[d,r==null?void 0:r.id]);const A=o.useCallback(()=>{var i;const n=(i=f.current)==null?void 0:i.getBoundingClientRect();return n||{left:0,top:0,width:typeof window>"u"?1400:window.innerWidth,height:typeof window>"u"?800:window.innerHeight}},[]),T=o.useCallback((n,i)=>{const x=A();return{x:n-x.left,y:i-x.top}},[A]),C=o.useCallback((n,i)=>{const x=T(n,i);return{x:Math.max(8,Math.min(x.x,w.width-328)),y:Math.max(8,Math.min(x.y,w.height-368))}},[w,T]),[S,L]=o.useState({});o.useEffect(()=>{t&&L(He(t))},[t]);const z=o.useCallback(n=>{L(n),t&&Ge(t,n)},[t]),[k,R]=o.useState({cabinet:[],trash:[],permanentlyHidden:[],cabinetOpen:!1,trashOpen:!1});o.useEffect(()=>{t&&R(Ke(t))},[t]);const g=o.useCallback(n=>{R(n),t&&_e(t,n)},[t]),[E,W]=o.useState([]);o.useEffect(()=>{Ce().then(W).catch(()=>W([]))},[]);const[B,G]=o.useState(null),[J,V]=o.useState(null),te=o.useCallback(async n=>{if(t){V({ref:n,loading:!0});try{const i=await Te(t,n);V({ref:n,loading:!1,file:i})}catch(i){V({ref:n,loading:!1,error:i.message})}}},[t]);o.useEffect(()=>{if(!t)return;let n=!0;return u(!0),de(t).then(({mission:i})=>{n&&(s(i),u(!1))}).catch(i=>{n&&(l(i.message),u(!1))}),()=>{n=!1}},[t]),o.useEffect(()=>t?Ae(t,i=>{if(i.kind==="mission_deleted"){a("/mission");return}i.kind!=="hello"&&de(t).then(({mission:x})=>s(x)).catch(()=>{})}):void 0,[t,a]);const ae=o.useCallback(async n=>{if(!(!r||!n.trim()||h)){b(!0);try{await ee(r.id,n.trim()),y("")}catch(i){l(i.message)}finally{b(!1)}}},[r,h]),me=o.useCallback(async(n,i)=>{if(r)try{await ze(r.id,n,i)}catch(x){l(x.message)}},[r]),ge=o.useCallback(async()=>{if(!r)return;const n=r.status==="paused"?"working":"paused";try{await Oe(r.id,n)}catch(i){l(i.message)}},[r]),be=o.useCallback(async()=>{if(!(!r||!window.confirm(`Delete this mission?
1
+ import{r as o,j as e,q as Ne,u as Se,aG as Ce}from"./index-Cml2x9pA.js";import{p as ee,f as Me,h as $e,i as De,g as Te,a as de,s as Ae,b as ze,d as Oe,e as Fe}from"./missions-1iw8Z2_0.js";import{F as Le}from"./FileViewer-BL00nsd7.js";function Ee({member:t,room:a,anchor:r,availableModels:s,onClose:d,onTalkInChat:u}){const p=o.useRef(null),[l,v]=o.useState("main"),[y,h]=o.useState(""),[b,c]=o.useState(!1),[m,f]=o.useState(!1),[w,j]=o.useState(null);o.useEffect(()=>{const g=E=>{E.key==="Escape"&&d()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[d]);const A=320,T=360,C=Re(r,A,T);async function S(){f(!0),j(null);try{await ee(a.id,`@${t.name} quick check-in — how's it going? Anything I can clear for you?`),d()}catch(g){j(g.message)}finally{f(!1)}}async function L(g){const E=y.trim();if(!(!E||b)){c(!0),j(null);try{await ee(a.id,`@${t.name} ${g}${E}`),h(""),d()}catch(W){j(W.message)}finally{c(!1)}}}async function z(g){f(!0),j(null);try{await De(a.id,t.agentId,g),v("main")}catch(E){j(E.message)}finally{f(!1)}}async function k(){f(!0),j(null);try{await Me(a.id,t.agentId,!t.paused)}catch(g){j(g.message)}finally{f(!1)}}async function R(){f(!0),j(null);try{await $e(a.id,!a.longRunningMode)}catch(g){j(g.message)}finally{f(!1)}}return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[60]",onClick:d,"aria-hidden":!0}),e.jsxs("div",{ref:p,className:"absolute z-[61] flex flex-col titan-modal-surface overflow-hidden",style:{left:C.x,top:C.y,width:A,maxHeight:T,borderRadius:12},onClick:g=>g.stopPropagation(),children:[e.jsx("div",{className:"h-1.5",style:{background:`linear-gradient(90deg, ${t.color}, ${ue(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}, ${ue(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," · ",Pe(t)]})]}),e.jsx("button",{onClick:d,"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,'"']}),w&&e.jsx("div",{className:"px-4 py-2 text-[11px] text-error bg-error/10 border-b border-error/30",children:w}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[l==="main"&&e.jsxs("div",{className:"p-2 grid grid-cols-2 gap-2",children:[e.jsx(H,{icon:"👋",label:"Nudge",hint:"A friendly check-in",onClick:S,disabled:m}),e.jsx(H,{icon:"💬",label:"Talk to them",hint:"Send a message just to them",onClick:()=>{u?(u(t.agentId,`@${t.name} `),d()):v("talk")},disabled:m}),e.jsx(H,{icon:"🧭",label:"Steer",hint:"Redirect them mid-task",onClick:()=>v("steer"),disabled:m}),e.jsx(H,{icon:"🧠",label:"Model",hint:t.modelOverride?Ie(t.modelOverride):"default",onClick:()=>v("model"),disabled:m}),e.jsx(H,{icon:t.paused?"▶":"⏸",label:t.paused?"Resume agent":"Pause agent",hint:t.paused?"Bring them back":"Skip them for now",onClick:k,disabled:m,wide:!1}),e.jsx(H,{icon:"🏃",label:a.longRunningMode?"Marathon ON":"Marathon mode",hint:a.longRunningMode?"running 72h goal":"72h auto-run",onClick:R,disabled:m,active:!!a.longRunningMode})]}),(l==="talk"||l==="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:l==="talk"?`Message ${t.name}`:`Steer ${t.name}`}),e.jsx("textarea",{autoFocus:!0,value:y,onChange:g=>h(g.target.value),rows:4,onKeyDown:g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&(g.preventDefault(),L(l==="steer"?"steer: ":""))},placeholder:l==="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"}),l==="steer"&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:["Slow down","Be thorough","Wrap it up","Skip the chart"].map(g=>e.jsx("button",{onClick:()=>h(g.toLowerCase()),className:"px-2 py-0.5 text-[11px] bg-bg-tertiary border border-border rounded-full text-text-muted hover:text-text",children:g},g))}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("button",{onClick:()=>v("main"),className:"text-xs text-text-muted hover:text-text",children:"← Back"}),e.jsx("button",{onClick:()=>L(l==="steer"?"steer: ":""),disabled:!y.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 ⌘↵"})]})]}),l==="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:()=>z(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:s.length===0?e.jsx("div",{className:"text-[11px] text-text-muted italic",children:"No models discovered. /api/models returned empty."}):s.map(g=>{const E=t.modelOverride===g.id;return e.jsxs("button",{onClick:()=>z(g.id),disabled:m,className:`flex items-center justify-between px-2.5 py-1.5 rounded-lg text-[12px] border text-left ${E?"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:g.id}),e.jsx("span",{className:"text-[10px] text-text-muted ml-2 shrink-0",children:g.provider})]},g.id)})}),e.jsx("button",{onClick:()=>v("main"),className:"text-xs text-text-muted hover:text-text self-start mt-1",children:"← Back"})]})]})]})]})}function H({icon:t,label:a,hint:r,onClick:s,disabled:d,wide:u,active:p}){return e.jsxs("button",{onClick:s,disabled:d,className:`text-left p-2.5 rounded-xl border transition-colors ${p?"bg-accent/15 border-accent/50 text-text":"bg-bg-tertiary/40 border-border text-text-secondary hover:text-text hover:border-border-light"} ${u?"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}),r&&e.jsx("div",{className:"text-[10px] text-text-muted leading-snug mt-0.5 truncate",children:r})]})}function Re({x:t,y:a},r,s){const d=window.innerWidth,u=window.innerHeight;return{x:Math.max(8,Math.min(t,d-r-8)),y:Math.max(8,Math.min(a,u-s-8))}}function Pe(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 Ie(t){return t.length<=24?t:t.slice(0,22)+"…"}function ue(t,a){const r=t.replace("#","");if(r.length!==6)return t;const s=parseInt(r,16);let d=s>>16&255,u=s>>8&255,p=s&255;const l=Math.round(255*(a/100));return d=Math.max(0,Math.min(255,d+l)),u=Math.max(0,Math.min(255,u+l)),p=Math.max(0,Math.min(255,p+l)),"#"+(d<<16|u<<8|p).toString(16).padStart(6,"0")}const Be=12;function Ye(t){const a=new Map;for(const s of t){const d=s.activityLog??[];for(const u of d){const p=`${s.agentId}::${u.activity}`,l=a.get(p);if(!l){a.set(p,{id:p,agentId:s.agentId,agentName:s.name,agentColor:s.color,icon:u.icon,activity:u.activity,detail:u.detail,at:u.at,count:1,recentDetails:u.detail?[u.detail]:[]});continue}l.count+=1,u.at>l.at&&(l.at=u.at,l.icon=u.icon,u.detail&&(l.detail=u.detail)),u.detail&&(l.recentDetails=[u.detail,...l.recentDetails.filter(v=>v!==u.detail)].slice(0,3))}}return Array.from(a.values()).sort((s,d)=>s.at<d.at?1:-1).slice(0,Be)}const We=[{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 He(t){try{const a=localStorage.getItem(he(t));return a?JSON.parse(a):{}}catch{return{}}}function Ge(t,a){try{localStorage.setItem(he(t),JSON.stringify(a))}catch{}}function he(t){return`titan-desk:${t}`}function fe(t){return`titan-desk-furniture:${t}`}function Ke(t){const a={cabinet:[],trash:[],permanentlyHidden:[],cabinetOpen:!1,trashOpen:!1};try{const r=localStorage.getItem(fe(t));if(!r)return a;const s=JSON.parse(r);return{cabinet:Array.isArray(s.cabinet)?s.cabinet:[],trash:Array.isArray(s.trash)?s.trash:[],permanentlyHidden:Array.isArray(s.permanentlyHidden)?s.permanentlyHidden:[],cabinetOpen:!!s.cabinetOpen,trashOpen:!!s.trashOpen}}catch{return a}}function _e(t,a){try{localStorage.setItem(fe(t),JSON.stringify(a))}catch{}}function $t(){const{id:t}=Ne(),a=Se(),[r,s]=o.useState(null),[d,u]=o.useState(!0),[p,l]=o.useState(null),[v,y]=o.useState(""),[h,b]=o.useState(!1),[c,m]=o.useState(!1),f=o.useRef(null),[w,j]=o.useState(()=>({width:typeof window>"u"?1400:window.innerWidth,height:typeof window>"u"?800:window.innerHeight}));o.useLayoutEffect(()=>{const n=f.current;if(!n)return;const i=()=>{const M=n.getBoundingClientRect();j($=>{const P=Math.max(320,Math.round(M.width)),N=Math.max(320,Math.round(M.height));return $.width===P&&$.height===N?$:{width:P,height:N}})};i();const x=typeof ResizeObserver<"u"?new ResizeObserver(i):null;return x==null||x.observe(n),window.addEventListener("resize",i),()=>{x==null||x.disconnect(),window.removeEventListener("resize",i)}},[d,r==null?void 0:r.id]);const A=o.useCallback(()=>{var i;const n=(i=f.current)==null?void 0:i.getBoundingClientRect();return n||{left:0,top:0,width:typeof window>"u"?1400:window.innerWidth,height:typeof window>"u"?800:window.innerHeight}},[]),T=o.useCallback((n,i)=>{const x=A();return{x:n-x.left,y:i-x.top}},[A]),C=o.useCallback((n,i)=>{const x=T(n,i);return{x:Math.max(8,Math.min(x.x,w.width-328)),y:Math.max(8,Math.min(x.y,w.height-368))}},[w,T]),[S,L]=o.useState({});o.useEffect(()=>{t&&L(He(t))},[t]);const z=o.useCallback(n=>{L(n),t&&Ge(t,n)},[t]),[k,R]=o.useState({cabinet:[],trash:[],permanentlyHidden:[],cabinetOpen:!1,trashOpen:!1});o.useEffect(()=>{t&&R(Ke(t))},[t]);const g=o.useCallback(n=>{R(n),t&&_e(t,n)},[t]),[E,W]=o.useState([]);o.useEffect(()=>{Ce().then(W).catch(()=>W([]))},[]);const[B,G]=o.useState(null),[J,V]=o.useState(null),te=o.useCallback(async n=>{if(t){V({ref:n,loading:!0});try{const i=await Te(t,n);V({ref:n,loading:!1,file:i})}catch(i){V({ref:n,loading:!1,error:i.message})}}},[t]);o.useEffect(()=>{if(!t)return;let n=!0;return u(!0),de(t).then(({mission:i})=>{n&&(s(i),u(!1))}).catch(i=>{n&&(l(i.message),u(!1))}),()=>{n=!1}},[t]),o.useEffect(()=>t?Ae(t,i=>{if(i.kind==="mission_deleted"){a("/mission");return}i.kind!=="hello"&&de(t).then(({mission:x})=>s(x)).catch(()=>{})}):void 0,[t,a]);const ae=o.useCallback(async n=>{if(!(!r||!n.trim()||h)){b(!0);try{await ee(r.id,n.trim()),y("")}catch(i){l(i.message)}finally{b(!1)}}},[r,h]),me=o.useCallback(async(n,i)=>{if(r)try{await ze(r.id,n,i)}catch(x){l(x.message)}},[r]),ge=o.useCallback(async()=>{if(!r)return;const n=r.status==="paused"?"working":"paused";try{await Oe(r.id,n)}catch(i){l(i.message)}},[r]),be=o.useCallback(async()=>{if(!(!r||!window.confirm(`Delete this mission?
2
2
 
3
3
  "${r.goal.slice(0,120)}${r.goal.length>120?"…":""}"
4
4
 
@@ -1,4 +1,4 @@
1
- import{r as o,j as e,R as E,p as q,u as W}from"./index-CUgepw5Q.js";import{g as G,a as R,s as K,p as V,b as Y,d as Q,e as X}from"./missions-2zox16Tc.js";import{F as J}from"./FileViewer-CVO3TRs3.js";const Z=/\bhttps?:\/\/[^\s<>()[\]"']+[^\s<>()[\]"',.!?;:]/gi;function ee(t){if(!t)return[];const a=[];let r=0;for(const s of t.matchAll(Z))s.index!==void 0&&(s.index>r&&a.push(t.slice(r,s.index)),a.push({url:s[0]}),r=s.index+s[0].length);return r<t.length&&a.push(t.slice(r)),a}function v(t){try{const a=new URL(t),r=a.host.replace(/^www\./,""),s=(a.pathname+a.search+a.hash).replace(/^\//,"");if(s.length===0)return r;const i=`${r}/${s}`;return i.length<=60?i:i.slice(0,57)+"…"}catch{return t.length<=60?t:t.slice(0,57)+"…"}}function te({text:t,sources:a,onOpenFile:r}){const s=o.useMemo(()=>ee(t),[t]),i=o.useMemo(()=>(a??[]).filter(n=>n.type==="url"),[a]),u=o.useMemo(()=>(a??[]).filter(n=>n.type!=="url"),[a]),d=o.useMemo(()=>{const n=new Set;for(const c of s)typeof c!="string"&&n.add(c.url);return n},[s]),m=o.useMemo(()=>i.filter(n=>!d.has(n.ref)),[i,d]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"whitespace-pre-wrap",children:s.map((n,c)=>typeof n=="string"?e.jsx(E.Fragment,{children:n},c):e.jsx("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",onClick:p=>p.stopPropagation(),className:"text-accent hover:text-accent2 underline underline-offset-2 break-all",children:v(n.url)},c))}),(m.length>0||u.length>0)&&e.jsxs("div",{className:"mt-3 pt-2.5 border-t border-border/50",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-text-muted mb-1.5",children:"Sources"}),m.length>0&&e.jsx("ul",{className:"space-y-1 mb-1.5",children:m.map((n,c)=>e.jsxs("li",{className:"text-[12px] leading-snug",children:[e.jsx("span",{className:"mr-1.5",children:"🔗"}),e.jsx("a",{href:n.ref,target:"_blank",rel:"noopener noreferrer",onClick:p=>p.stopPropagation(),className:"text-accent hover:text-accent2 underline underline-offset-2 break-all",title:n.ref,children:n.description??v(n.ref)}),n.description&&e.jsxs("span",{className:"text-text-muted ml-2 text-[11px]",children:["(",v(n.ref),")"]})]},`u-${c}`))}),u.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:u.map((n,c)=>{const p=n.type==="file"?"📄":n.type==="fact"?"💡":"📊",f=n.ref.length>50?n.ref.slice(0,47)+"…":n.ref;return(n.type==="file"||n.type==="report")&&!!r?e.jsxs("button",{type:"button",onClick:j=>{j.stopPropagation(),r(n.ref,n.type)},className:"inline-flex items-center gap-1.5 px-2 py-0.5 bg-bg-tertiary/60 border border-border rounded-full text-[11px] text-text-secondary hover:bg-accent/15 hover:text-text hover:border-accent/40 transition-colors cursor-pointer",title:`Open ${n.ref}${n.description?" — "+n.description:""}`,children:[p," ",e.jsx("b",{className:"text-text font-medium",children:f}),e.jsx("span",{className:"text-text-muted text-[10px]",children:"↗"})]},`o-${c}`):e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 bg-bg-tertiary/60 border border-border rounded-full text-[11px] text-text-secondary",title:n.description??n.ref,children:[p," ",e.jsx("b",{className:"text-text font-medium",children:f})]},`o-${c}`)})})]})]})}function ge(){const{id:t}=q(),a=W(),[r,s]=o.useState(null),[i,u]=o.useState(!0),[d,m]=o.useState(null),[n,c]=o.useState(""),[p,f]=o.useState(!1),[k,j]=o.useState(!1),[I,S]=o.useState(!1),[A,L]=o.useState(new Set),U=o.useCallback(l=>{L(x=>{const h=new Set(x);return h.has(l)?h.delete(l):h.add(l),h})},[]),C=o.useRef(null),$=o.useRef(null),F=o.useRef(!0),[T,b]=o.useState(null),B=o.useCallback(async l=>{if(t){b({ref:l,loading:!0});try{const x=await G(t,l);b({ref:l,loading:!1,file:x})}catch(x){b({ref:l,loading:!1,error:x.message})}}},[t]),O=o.useCallback(()=>b(null),[]);o.useEffect(()=>{if(!t)return;let l=!0;return u(!0),R(t).then(({mission:x})=>{l&&(s(x),u(!1))}).catch(x=>{l&&(m(x.message),u(!1))}),()=>{l=!1}},[t]),o.useEffect(()=>t?K(t,x=>{if(x.kind==="mission_deleted"){a("/mission");return}x.kind!=="hello"&&R(t).then(({mission:h})=>s(h)).catch(()=>{})}):void 0,[t,a]),o.useEffect(()=>{const l=C.current;if(!l)return;const x=()=>{F.current=l.scrollHeight-l.scrollTop-l.clientHeight<100};return x(),l.addEventListener("scroll",x,{passive:!0}),()=>{l.removeEventListener("scroll",x)}},[r==null?void 0:r.id]),o.useEffect(()=>{if(!F.current)return;const l=$.current;l&&l.scrollIntoView({behavior:"smooth",block:"end"})},[r==null?void 0:r.messages.length]);const P=o.useCallback(async()=>{if(!(!r||!n.trim()||p)){f(!0);try{await V(r.id,n.trim()),c("")}catch(l){m(l.message)}finally{f(!1)}}},[r,n,p]),_=o.useCallback(async(l,x)=>{if(r)try{await Y(r.id,l,x)}catch(h){m(h.message)}},[r]),z=o.useCallback(async()=>{if(!r)return;const l=r.status==="paused"?"working":"paused";try{await Q(r.id,l)}catch(x){m(x.message)}},[r]),H=o.useCallback(async()=>{if(!(!r||!window.confirm(`Delete this mission?
1
+ import{r as o,j as e,R as E,q,u as W}from"./index-Cml2x9pA.js";import{g as G,a as R,s as K,p as V,b as Y,d as Q,e as X}from"./missions-1iw8Z2_0.js";import{F as J}from"./FileViewer-BL00nsd7.js";const Z=/\bhttps?:\/\/[^\s<>()[\]"']+[^\s<>()[\]"',.!?;:]/gi;function ee(t){if(!t)return[];const a=[];let r=0;for(const s of t.matchAll(Z))s.index!==void 0&&(s.index>r&&a.push(t.slice(r,s.index)),a.push({url:s[0]}),r=s.index+s[0].length);return r<t.length&&a.push(t.slice(r)),a}function v(t){try{const a=new URL(t),r=a.host.replace(/^www\./,""),s=(a.pathname+a.search+a.hash).replace(/^\//,"");if(s.length===0)return r;const i=`${r}/${s}`;return i.length<=60?i:i.slice(0,57)+"…"}catch{return t.length<=60?t:t.slice(0,57)+"…"}}function te({text:t,sources:a,onOpenFile:r}){const s=o.useMemo(()=>ee(t),[t]),i=o.useMemo(()=>(a??[]).filter(n=>n.type==="url"),[a]),u=o.useMemo(()=>(a??[]).filter(n=>n.type!=="url"),[a]),d=o.useMemo(()=>{const n=new Set;for(const c of s)typeof c!="string"&&n.add(c.url);return n},[s]),m=o.useMemo(()=>i.filter(n=>!d.has(n.ref)),[i,d]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"whitespace-pre-wrap",children:s.map((n,c)=>typeof n=="string"?e.jsx(E.Fragment,{children:n},c):e.jsx("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",onClick:p=>p.stopPropagation(),className:"text-accent hover:text-accent2 underline underline-offset-2 break-all",children:v(n.url)},c))}),(m.length>0||u.length>0)&&e.jsxs("div",{className:"mt-3 pt-2.5 border-t border-border/50",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-text-muted mb-1.5",children:"Sources"}),m.length>0&&e.jsx("ul",{className:"space-y-1 mb-1.5",children:m.map((n,c)=>e.jsxs("li",{className:"text-[12px] leading-snug",children:[e.jsx("span",{className:"mr-1.5",children:"🔗"}),e.jsx("a",{href:n.ref,target:"_blank",rel:"noopener noreferrer",onClick:p=>p.stopPropagation(),className:"text-accent hover:text-accent2 underline underline-offset-2 break-all",title:n.ref,children:n.description??v(n.ref)}),n.description&&e.jsxs("span",{className:"text-text-muted ml-2 text-[11px]",children:["(",v(n.ref),")"]})]},`u-${c}`))}),u.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:u.map((n,c)=>{const p=n.type==="file"?"📄":n.type==="fact"?"💡":"📊",f=n.ref.length>50?n.ref.slice(0,47)+"…":n.ref;return(n.type==="file"||n.type==="report")&&!!r?e.jsxs("button",{type:"button",onClick:j=>{j.stopPropagation(),r(n.ref,n.type)},className:"inline-flex items-center gap-1.5 px-2 py-0.5 bg-bg-tertiary/60 border border-border rounded-full text-[11px] text-text-secondary hover:bg-accent/15 hover:text-text hover:border-accent/40 transition-colors cursor-pointer",title:`Open ${n.ref}${n.description?" — "+n.description:""}`,children:[p," ",e.jsx("b",{className:"text-text font-medium",children:f}),e.jsx("span",{className:"text-text-muted text-[10px]",children:"↗"})]},`o-${c}`):e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 bg-bg-tertiary/60 border border-border rounded-full text-[11px] text-text-secondary",title:n.description??n.ref,children:[p," ",e.jsx("b",{className:"text-text font-medium",children:f})]},`o-${c}`)})})]})]})}function ge(){const{id:t}=q(),a=W(),[r,s]=o.useState(null),[i,u]=o.useState(!0),[d,m]=o.useState(null),[n,c]=o.useState(""),[p,f]=o.useState(!1),[k,j]=o.useState(!1),[I,S]=o.useState(!1),[A,L]=o.useState(new Set),U=o.useCallback(l=>{L(x=>{const h=new Set(x);return h.has(l)?h.delete(l):h.add(l),h})},[]),C=o.useRef(null),$=o.useRef(null),F=o.useRef(!0),[T,b]=o.useState(null),B=o.useCallback(async l=>{if(t){b({ref:l,loading:!0});try{const x=await G(t,l);b({ref:l,loading:!1,file:x})}catch(x){b({ref:l,loading:!1,error:x.message})}}},[t]),O=o.useCallback(()=>b(null),[]);o.useEffect(()=>{if(!t)return;let l=!0;return u(!0),R(t).then(({mission:x})=>{l&&(s(x),u(!1))}).catch(x=>{l&&(m(x.message),u(!1))}),()=>{l=!1}},[t]),o.useEffect(()=>t?K(t,x=>{if(x.kind==="mission_deleted"){a("/mission");return}x.kind!=="hello"&&R(t).then(({mission:h})=>s(h)).catch(()=>{})}):void 0,[t,a]),o.useEffect(()=>{const l=C.current;if(!l)return;const x=()=>{F.current=l.scrollHeight-l.scrollTop-l.clientHeight<100};return x(),l.addEventListener("scroll",x,{passive:!0}),()=>{l.removeEventListener("scroll",x)}},[r==null?void 0:r.id]),o.useEffect(()=>{if(!F.current)return;const l=$.current;l&&l.scrollIntoView({behavior:"smooth",block:"end"})},[r==null?void 0:r.messages.length]);const P=o.useCallback(async()=>{if(!(!r||!n.trim()||p)){f(!0);try{await V(r.id,n.trim()),c("")}catch(l){m(l.message)}finally{f(!1)}}},[r,n,p]),_=o.useCallback(async(l,x)=>{if(r)try{await Y(r.id,l,x)}catch(h){m(h.message)}},[r]),z=o.useCallback(async()=>{if(!r)return;const l=r.status==="paused"?"working":"paused";try{await Q(r.id,l)}catch(x){m(x.message)}},[r]),H=o.useCallback(async()=>{if(!(!r||!window.confirm(`Delete this mission?
2
2
 
3
3
  "${r.goal.slice(0,120)}${r.goal.length>120?"…":""}"
4
4
 
@@ -1,4 +1,4 @@
1
- import{u as M,r as m,j as e}from"./index-CUgepw5Q.js";import{l as j,e as D}from"./missions-2zox16Tc.js";const T=258;function z(){const a=M(),[r,s]=m.useState(null),[o,i]=m.useState(null),[l,c]=m.useState("all"),[d,F]=m.useState("");m.useEffect(()=>{let t=!0;return j().then(({missions:n})=>{t&&s(n)}).catch(n=>{t&&i(n.message)}),()=>{t=!1}},[]);const S=m.useCallback(()=>{s(null),j().then(({missions:t})=>s(t)).catch(t=>i(t.message))},[]),p=m.useCallback(async(t,n)=>{if(window.confirm(`Delete this mission?
1
+ import{u as M,r as m,j as e}from"./index-Cml2x9pA.js";import{l as j,e as D}from"./missions-1iw8Z2_0.js";const T=258;function z(){const a=M(),[r,s]=m.useState(null),[o,i]=m.useState(null),[l,c]=m.useState("all"),[d,F]=m.useState("");m.useEffect(()=>{let t=!0;return j().then(({missions:n})=>{t&&s(n)}).catch(n=>{t&&i(n.message)}),()=>{t=!1}},[]);const S=m.useCallback(()=>{s(null),j().then(({missions:t})=>s(t)).catch(t=>i(t.message))},[]),p=m.useCallback(async(t,n)=>{if(window.confirm(`Delete this mission?
2
2
 
3
3
  "${n.slice(0,120)}${n.length>120?"…":""}"
4
4
 
@@ -0,0 +1 @@
1
+ import{r as b,u as W,j as e}from"./index-Cml2x9pA.js";import{c as _}from"./missions-1iw8Z2_0.js";const G={id:"hourly",label:"Every hour",cron:"0 * * * *",cadence:"24 runs/day"},L={id:"every4h",label:"Every 4 hours",cron:"0 */4 * * *",cadence:"6 runs/day"},A={id:"every6h",label:"Every 6 hours",cron:"0 */6 * * *",cadence:"4 runs/day"},I={id:"daily7",label:"Daily at 7am",cron:"0 7 * * *",cadence:"once/day"},M={id:"weekly",label:"Weekly (Mon 9am)",cron:"0 9 * * 1",cadence:"once/week"},H={id:"nightly",label:"Nightly at 11pm",cron:"0 23 * * *",cadence:"once/day"},D={id:"twice",label:"Twice daily (7am + 7pm)",cron:"0 7,19 * * *",cadence:"2 runs/day"},V=[{id:"research-digest",icon:"📰",title:"Daily research digest",blurb:"Scout researches your topic and writes a fresh briefing for the first run.",goalTemplate:'Research the latest developments on "{{topic}}" and produce a clear HTML briefing (write_file with a .html extension) with 5 highlights, an inline SVG chart of the most important trend, and clickable source links throughout.',suggestedPlayId:"research",fields:[{key:"topic",label:"Your topic",hint:"What you want a fresh briefing on each morning",defaultValue:"AI agents in business",placeholder:"AI agents in business"}],schedules:[I,D,M],whatItDoes:"Scout searches the web for fresh developments on your topic, reads the top 5 sources end-to-end, and writes a one-page briefing. The briefing lands on your desk as a paper sheet, and the chat thread captures every URL Scout looked at so you can dig in further if anything catches your eye.",accent:{from:"#6366f1",to:"#8b5cf6"}},{id:"inbox-triage",icon:"📬",title:"Inbox triage",blurb:"Sage sorts and summarizes incoming email so important threads stay visible.",goalTemplate:'Read my inbox and produce a triaged summary: "needs reply within 24h", "informational", "newsletters", and "junk". Cap at 30 messages per run.',suggestedPlayId:"inbox",fields:[],schedules:[L,A,I],whatItDoes:"Sage opens your inbox, classifies up to 30 recent threads into four buckets (urgent / informational / newsletters / junk), and pins the urgent ones to the desk as sticky notes. The full triage lands as a paper sheet you can scan in under a minute.",accent:{from:"#06b6d4",to:"#0ea5e9"}},{id:"code-review",icon:"🔍",title:"Code review",blurb:"Builder reviews your repo changes and reports only meaningful findings.",goalTemplate:"Review the diff in {{repoPath}} since the last review. Flag bugs, regressions, and obvious improvements. Don't nitpick formatting.",suggestedPlayId:"code-review",fields:[{key:"repoPath",label:"Repo path or URL",hint:"Local path on the host, or a GitHub repo URL",defaultValue:"~/Desktop/MyProject",placeholder:"~/projects/repo"}],schedules:[H,D],whatItDoes:"Builder pulls the latest changes from your repo and writes a concise review focused on real defects (logic bugs, regressions, security smells). Formatting nits are skipped. Findings land as a paper sheet; if there's nothing to report, Builder closes silently.",accent:{from:"#22c55e",to:"#10b981"}},{id:"lead-scout",icon:"🎯",title:"Lead scout",blurb:"Scout scans freelance + opportunity boards and surfaces matches for your skills.",goalTemplate:'Scan Upwork, Indeed, and HackerNews "who is hiring" for new postings matching: {{skills}}. Filter to budget >= ${{minBudget}} and remote OK.',suggestedPlayId:"lead-scout",fields:[{key:"skills",label:"Skills to match",hint:"Comma-separated keywords. Scout fuzzy-matches.",defaultValue:"TypeScript, Node.js, AI agents",placeholder:"React, Python, design"},{key:"minBudget",label:"Minimum budget (USD)",hint:"Skip postings paying less.",defaultValue:"500"}],schedules:[L,A,I],whatItDoes:"Scout sweeps the boards you care about for postings that match your skill keywords and budget floor. New matches land as sticky notes; the running log of every posting seen sits as a paper sheet you can browse anytime.",accent:{from:"#f59e0b",to:"#eab308"}},{id:"market-watch",icon:"📈",title:"Market watch",blurb:"Analyst tracks tickers + crypto and writes a brief if anything moves >3%.",goalTemplate:"Check the latest price + 24h move for: {{tickers}}. If any moved more than 3% (up or down) since the last run, produce an HTML brief (write_file with a .html extension) with a sparkline SVG per ticker and a one-paragraph explanation with 2 source links.",suggestedPlayId:"analyst",fields:[{key:"tickers",label:"Tickers / coins",hint:"Comma-separated. Stocks or crypto.",defaultValue:"BTC, ETH, NVDA, AAPL",placeholder:"TSLA, SPY, BTC"}],schedules:[G,L,A],whatItDoes:"Each cycle, Analyst pulls the latest price and 24-hour move for every ticker you listed. If anything jumped or dropped more than 3%, it writes a one-paragraph explanation with 2 source links. Quiet runs close silently — your desk only fills up when something actually moved.",accent:{from:"#ef4444",to:"#f97316"}},{id:"creative-prompts",icon:"🎨",title:"Daily creative prompt",blurb:"Writer creates a fresh writing, sketching, or music prompt for the first run.",goalTemplate:"Generate a fresh {{discipline}} prompt for me today. Make it specific enough to start in 5 minutes but open enough to take in any direction. Include a 1-line warm-up exercise.",fields:[{key:"discipline",label:"Discipline",hint:"What kind of prompt you want.",defaultValue:"songwriting",placeholder:"short fiction · songwriting · sketching"}],schedules:[I,M],whatItDoes:"Writer creates one fresh creative prompt tailored to the discipline you chose, with a quick warm-up exercise to get started. The prompt lands as a sticky note on the desk so you can grab it when you need it.",accent:{from:"#ec4899",to:"#8b5cf6"}}];function Y(s,n){return s.goalTemplate.replace(/\{\{(\w+)\}\}/g,(i,r)=>{const u=n[r];return u&&u.trim().length>0?u.trim():r})}const z=["Plan my mom's 70th birthday party","Write a thank-you note to my landlord","Summarize this long email I got","Draft the Q1 investor update","Review a code change"],h="var(--theme-font-display, 'Iowan Old Style', 'Charter', Georgia, serif)",d="var(--theme-font-mono, 'IBM Plex Mono', 'JetBrains Mono', ui-monospace, monospace)",c="var(--theme-paper, #f3e9d0)",o="var(--theme-ink-soft, #a0a8d0)",t="var(--theme-metal, #c4a35a)",x="var(--theme-metal-bright, #f3d27a)",m="var(--theme-metal-dark, #8a6a3a)",F="var(--theme-bolt, #2a1808)",E="var(--theme-leather, #4a2818)",v="var(--theme-leather-edge, #2a1408)",U="var(--theme-leather-stitch, #d4a060)",y="var(--theme-bg-base, #1a1235)",R="var(--theme-bg-grain, #0e0820)",K="var(--theme-bg-vignette, rgba(0,0,0,0.6))",j="var(--theme-shadow, rgba(0,0,0,0.55))",Q="var(--theme-accent, #c45a30)";function ee(){const[s,n]=b.useState(""),[i,r]=b.useState(!1),[u,N]=b.useState(null),[$,k]=b.useState(null),S=W();async function g(a,p){const f=a.trim();if(!(!f||i)){r(!0),N(null);try{const{mission:w}=await _(f,p);S(`/mission/${w.id}`)}catch(w){N(w.message),r(!1)}}}return e.jsxs("div",{className:"min-h-full w-full flex flex-col items-center",style:{color:c,fontFamily:h,background:`radial-gradient(120% 80% at 50% -10%, ${R} 0%, ${y} 60%, ${y} 100%)`},children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:`radial-gradient(circle at 50% 12%, ${Q}22 0%, transparent 55%)`}}),e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{boxShadow:`inset 0 0 240px 60px ${K}`}}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-8 w-full max-w-5xl px-6 pt-10 pb-28 md:py-14",children:[e.jsxs("div",{className:"w-full flex items-center",style:{paddingRight:260},children:[e.jsxs("div",{className:"flex items-center gap-3 text-[11px] uppercase tracking-[0.3em]",style:{color:o,fontFamily:d},children:[e.jsx("span",{style:{color:x,fontWeight:700},children:"TITAN"}),e.jsx("span",{style:{opacity:.6},children:"·"}),e.jsx("span",{children:"MISSION CONTROL"})]}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsx(P,{onClick:()=>S("/mission/library"),title:"See your past missions",children:"Past missions →"}),e.jsx(P,{onClick:()=>S("/space/home"),title:"Back to the canvas spaces",children:"🌌 Canvas"})]})]}),e.jsxs("section",{className:"relative w-full max-w-3xl rounded-3xl overflow-hidden",style:{background:`linear-gradient(180deg, ${E} 0%, ${v} 100%)`,border:`1px solid ${v}`,boxShadow:`0 30px 80px ${j}, inset 0 1px 0 ${t}33`,padding:"36px 36px 28px"},children:[e.jsx(C,{position:"tl"}),e.jsx(C,{position:"tr"}),e.jsx(C,{position:"bl"}),e.jsx(C,{position:"br"}),e.jsx("div",{className:"text-[10px] uppercase tracking-[0.4em] mb-3",style:{color:t,fontFamily:d,fontWeight:600},children:"◆ New Mission"}),e.jsx("h1",{className:"text-4xl md:text-5xl tracking-tight",style:{color:c,fontFamily:h,fontWeight:600,letterSpacing:0,textShadow:`0 2px 12px ${j}`},children:"What's the mission?"}),e.jsx("p",{className:"mt-3 text-[15px] leading-relaxed max-w-xl",style:{color:o},children:"Tell me anything — a thank-you note, a birthday plan, a Q1 report. I’ll assemble a small team of AI specialists and we’ll work it out together."}),e.jsxs("form",{onSubmit:a=>{a.preventDefault(),g(s)},className:"mt-6 flex flex-col gap-3",children:[e.jsx("textarea",{autoFocus:!0,value:s,onChange:a=>n(a.target.value),placeholder:"Try: Help me write a birthday speech for my mom",rows:3,disabled:i,className:"w-full resize-none outline-none rounded-2xl px-5 py-4 text-base leading-relaxed",style:{background:`${y}80`,color:c,border:`1px solid ${t}44`,fontFamily:h,boxShadow:`inset 0 2px 8px ${j}`},onKeyDown:a=>{(a.metaKey||a.ctrlKey)&&a.key==="Enter"&&(a.preventDefault(),g(s))}}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"text-[11px] tracking-wide",style:{color:o,fontFamily:d},children:"⌘↵ to dispatch"}),e.jsx("div",{className:"flex w-full items-center gap-2 sm:w-auto",children:e.jsx("button",{type:"submit",disabled:!s.trim()||i,className:"h-11 flex-1 rounded-xl px-5 text-sm font-bold tracking-wide transition-transform sm:flex-none",style:{background:s.trim()&&!i?`linear-gradient(180deg, ${x} 0%, ${t} 60%, ${m} 100%)`:`${m}66`,color:s.trim()&&!i?F:o,border:`1px solid ${m}`,boxShadow:s.trim()&&!i?`0 6px 18px ${j}, inset 0 1px 0 ${x}`:"none",cursor:s.trim()&&!i?"pointer":"not-allowed",fontFamily:h,letterSpacing:"0.04em"},onMouseDown:a=>{s.trim()&&!i&&(a.currentTarget.style.transform="translateY(1px)")},onMouseUp:a=>{a.currentTarget.style.transform=""},onMouseLeave:a=>{a.currentTarget.style.transform=""},children:i?"Dispatching…":"Start mission →"})})]})]}),u&&e.jsx("div",{className:"mt-4 text-sm rounded-lg px-3 py-2",style:{color:"#ffb4a8",background:"#5a1a1a55",border:"1px solid #8a3a3a"},children:u})]}),e.jsxs("div",{className:"w-full max-w-3xl flex flex-col items-center gap-3",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.35em]",style:{color:o,fontFamily:d},children:"— or try a one-shot —"}),e.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:z.map(a=>e.jsx("button",{type:"button",onClick:()=>g(a),disabled:i,className:"px-3 py-1.5 text-xs rounded-full transition-colors disabled:opacity-50",style:{background:`${v}99`,color:c,border:`1px solid ${t}33`,fontFamily:h},onMouseEnter:p=>{p.currentTarget.style.borderColor=`${t}88`,p.currentTarget.style.background=`${E}`},onMouseLeave:p=>{p.currentTarget.style.borderColor=`${t}33`,p.currentTarget.style.background=`${v}99`},children:a},a))})]}),e.jsxs("section",{className:"w-full mt-4 flex flex-col gap-4",children:[e.jsxs("header",{className:"flex items-baseline justify-between pb-3",style:{borderBottom:`1px solid ${t}33`},children:[e.jsxs("h2",{className:"text-xl tracking-tight",style:{color:c,fontFamily:h,fontWeight:600},children:["Mission starters",e.jsx("span",{className:"ml-3 text-[10px] uppercase tracking-[0.3em]",style:{color:o,fontFamily:d},children:"saved cadence"})]}),e.jsx("span",{className:"text-[11px] tracking-wide",style:{color:o,fontFamily:d},children:"click → 3 steps → launch"})]}),e.jsx("p",{className:"text-sm leading-relaxed max-w-2xl",style:{color:o},children:"Pick a starter recipe, customize it, and launch the first run. TITAN saves the cadence with the mission request."}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3 mt-2",children:V.map(a=>e.jsx(J,{template:a,onClick:()=>k(a)},a.id))})]}),e.jsx("div",{className:"h-20"})]}),$&&e.jsx(q,{template:$,onClose:()=>k(null),onLaunch:async(a,p,f)=>{try{const w=JSON.parse(localStorage.getItem("titan-pending-schedules")??"[]");w.push({at:new Date().toISOString(),templateId:$.id,goal:a,scheduleId:p}),localStorage.setItem("titan-pending-schedules",JSON.stringify(w))}catch{}k(null),await g(a,f)}})]})}function P({onClick:s,title:n,children:i}){return e.jsx("button",{onClick:s,title:n,className:"px-3 py-1 text-[10px] uppercase tracking-[0.2em] rounded-full transition-colors",style:{color:o,border:`1px solid ${t}33`,background:"transparent",fontFamily:d},onMouseEnter:r=>{r.currentTarget.style.color=c,r.currentTarget.style.borderColor=`${t}99`},onMouseLeave:r=>{r.currentTarget.style.color=o,r.currentTarget.style.borderColor=`${t}33`},children:i})}function C({position:s}){const n={position:"absolute"};return s==="tl"&&(n.top=10,n.left=10),s==="tr"&&(n.top=10,n.right=10),s==="bl"&&(n.bottom=10,n.left=10),s==="br"&&(n.bottom=10,n.right=10),e.jsx("div",{style:{...n,width:6,height:6,borderRadius:"50%",background:t,boxShadow:`0 0 6px ${x}, inset 0 1px 0 ${x}`,opacity:.7,pointerEvents:"none"}})}function J({template:s,onClick:n}){const[i,r]=b.useState(!1);return e.jsxs("button",{type:"button",onClick:n,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),className:"text-left rounded-2xl relative overflow-hidden transition-all",style:{background:`linear-gradient(180deg, ${E} 0%, ${v} 100%)`,border:`1px solid ${i?t:v}`,boxShadow:i?`0 14px 36px ${j}, inset 0 1px 0 ${t}55`:`0 6px 18px ${j}, inset 0 1px 0 ${t}22`,transform:i?"translateY(-2px)":"translateY(0)",padding:"14px 16px 14px"},children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-md mb-3",style:{background:`linear-gradient(180deg, ${x} 0%, ${t} 55%, ${m} 100%)`,border:`1px solid ${m}`,boxShadow:`inset 0 1px 0 ${x}aa, 0 1px 3px ${j}`,color:F},children:[e.jsx("span",{className:"text-base leading-none",children:s.icon}),e.jsx("span",{className:"text-xs uppercase tracking-[0.16em] truncate",style:{fontFamily:h,fontWeight:700,letterSpacing:"0.12em"},children:s.title})]}),e.jsx("p",{className:"text-[13px] leading-snug mb-3",style:{color:c,opacity:.88},children:s.blurb}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.schedules.slice(0,2).map(u=>e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full",style:{background:`${v}cc`,color:c,border:`1px solid ${U}55`,fontFamily:d,opacity:.85},children:u.label},u.id)),e.jsx("span",{className:"ml-auto text-[10px] uppercase tracking-[0.2em] transition-opacity",style:{color:x,fontFamily:d,opacity:i?1:0},children:"Set up →"})]})]})}function q({template:s,onClose:n,onLaunch:i}){const[r,u]=b.useState(1),[N,$]=b.useState(()=>Object.fromEntries(s.fields.map(l=>[l.key,l.defaultValue]))),[k,S]=b.useState(s.schedules[0]),[g,a]=b.useState(!1),p=Y(s,N),f=r!==1||s.fields.every(l=>(N[l.key]??"").trim().length>0);async function w(){if(!g){a(!0);try{await i(p,k.id,s.suggestedPlayId)}finally{a(!1)}}}const B={background:`${y}aa`,color:c,border:`1px solid ${t}33`,fontFamily:h};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center backdrop-blur-sm p-4 md:p-8",style:{background:`${R}cc`},onClick:n,children:e.jsxs("div",{className:"relative w-full max-w-2xl rounded-2xl overflow-hidden flex flex-col",style:{background:`linear-gradient(180deg, ${E} 0%, ${v} 100%)`,border:`1px solid ${t}55`,boxShadow:`0 40px 100px ${j}, inset 0 1px 0 ${t}55`,color:c,fontFamily:h},onClick:l=>l.stopPropagation(),children:[e.jsx("div",{style:{height:4,background:`linear-gradient(90deg, ${m}, ${x}, ${m})`}}),e.jsxs("div",{className:"flex items-center gap-3 px-5 py-3",style:{borderBottom:`1px solid ${t}22`},children:[e.jsx("span",{className:"text-2xl leading-none",children:s.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-sm truncate",style:{color:c},children:s.title}),e.jsxs("div",{className:"text-[11px]",style:{color:o,fontFamily:d},children:["Step ",r," of 3 · ",r===1?"Customize":r===2?"Cadence":"Launch"]})]}),e.jsx("button",{onClick:n,className:"w-8 h-8 rounded-full flex items-center justify-center text-sm",style:{background:`${y}66`,border:`1px solid ${t}33`,color:o},title:"Close",children:"✕"})]}),e.jsx("div",{className:"px-5 py-2 flex items-center gap-2",style:{borderBottom:`1px solid ${t}11`},children:[1,2,3].map(l=>e.jsx("div",{className:"h-1 flex-1 rounded-full transition-colors",style:{background:l<=r?`linear-gradient(90deg, ${t}, ${x})`:`${y}66`}},l))}),e.jsxs("div",{className:"p-5 max-h-[60vh] overflow-y-auto",children:[r===1&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"text-sm",style:{color:o},children:s.blurb}),s.fields.length===0&&e.jsxs("div",{className:"text-sm italic",style:{color:o},children:["This template runs as-is — no setup needed. Click ",e.jsx("b",{style:{color:c},children:"Next"})," to pick a cadence."]}),s.fields.map(l=>e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-[0.2em]",style:{color:t,fontFamily:d,fontWeight:600},children:l.label}),e.jsx("input",{value:N[l.key]??"",onChange:T=>$(O=>({...O,[l.key]:T.target.value})),placeholder:l.placeholder??l.defaultValue,className:"px-3 py-2 rounded-lg text-sm outline-none",style:B}),l.hint&&e.jsx("span",{className:"text-[11px]",style:{color:o},children:l.hint})]},l.key)),e.jsxs("div",{className:"mt-2 px-3 py-2.5 rounded-lg",style:{background:`${y}66`,border:`1px solid ${t}22`},children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.2em] mb-1",style:{color:t,fontFamily:d},children:"Preview goal"}),e.jsx("div",{className:"text-sm leading-snug",style:{color:c},children:p})]})]}),r===2&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"text-sm",style:{color:o},children:"Which cadence should TITAN remember?"}),s.schedules.map(l=>{const T=l.id===k.id;return e.jsxs("button",{onClick:()=>S(l),className:"flex items-center justify-between p-3 rounded-xl text-left transition-colors",style:{background:T?`${t}1f`:`${y}55`,border:`1px solid ${T?t:`${t}22`}`,color:T?c:o},children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:c},children:l.label}),e.jsx("span",{className:"text-[11px]",style:{color:o,fontFamily:d},children:l.cadence})]}),e.jsx("code",{className:"text-[10px]",style:{color:o,fontFamily:d},children:l.cron})]},l.id)}),e.jsx("div",{className:"text-[11px] italic px-1 pt-1",style:{color:o},children:"This starts the first run immediately and saves the cadence selection for recurring mission support."})]}),r===3&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"text-sm",style:{color:o},children:"Quick recap before we kick off."}),e.jsxs("div",{className:"rounded-xl p-4",style:{background:`${y}55`,border:`1px solid ${t}22`},children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.2em] mb-1",style:{color:t,fontFamily:d},children:"What I'll do"}),e.jsx("div",{className:"text-sm leading-relaxed",style:{color:c},children:s.whatItDoes})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[12px]",children:[e.jsxs("div",{className:"rounded-lg p-3",style:{background:`${y}55`,border:`1px solid ${t}22`},children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.2em] mb-1",style:{color:t,fontFamily:d},children:"Goal"}),e.jsx("div",{className:"leading-snug",style:{color:c},children:p})]}),e.jsxs("div",{className:"rounded-lg p-3",style:{background:`${y}55`,border:`1px solid ${t}22`},children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.2em] mb-1",style:{color:t,fontFamily:d},children:"Cadence"}),e.jsx("div",{className:"font-semibold",style:{color:c},children:k.label}),e.jsx("div",{className:"text-[11px] mt-0.5",style:{color:o,fontFamily:d},children:k.cadence})]})]})]})]}),e.jsxs("div",{className:"px-5 py-3 flex items-center justify-between",style:{borderTop:`1px solid ${t}22`,background:`${v}66`},children:[e.jsx("button",{onClick:()=>r>1?u(l=>l-1):n(),className:"px-4 py-2 text-sm",style:{color:o,background:"transparent",fontFamily:h},children:r>1?"← Back":"Cancel"}),r<3?e.jsx("button",{onClick:()=>u(l=>l+1),disabled:!f,className:"px-5 py-2 rounded-lg text-sm font-bold",style:{background:f?`linear-gradient(180deg, ${x} 0%, ${t} 60%, ${m} 100%)`:`${m}55`,color:F,border:`1px solid ${m}`,opacity:f?1:.5,cursor:f?"pointer":"not-allowed",fontFamily:h,letterSpacing:"0.04em"},children:"Next →"}):e.jsx("button",{onClick:w,disabled:g,className:"px-5 py-2 rounded-lg text-sm font-bold",style:{background:g?`${m}55`:`linear-gradient(180deg, ${x} 0%, ${t} 60%, ${m} 100%)`,color:F,border:`1px solid ${m}`,opacity:g?.6:1,cursor:g?"wait":"pointer",fontFamily:h,letterSpacing:"0.04em"},children:g?"Launching…":"Launch first run 🚀"})]})]})})}export{ee as default};