@openscout/scout 0.2.86 → 0.2.87

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 (327) hide show
  1. package/bin/scoutd +0 -0
  2. package/dist/build-manifest.json +3 -3
  3. package/dist/client/assets/{ActivityScreen-C7AwUogt.js → ActivityScreen-DRHTQIxu.js} +1 -1
  4. package/dist/client/assets/{AddProjectForm-BNRpRPod.js → AddProjectForm-Dw2oyCcz.js} +1 -1
  5. package/dist/client/assets/AgentAvatar-CQqJcwOQ.js +1 -0
  6. package/dist/client/assets/AgentAvatar-CUZZARWG.css +1 -0
  7. package/dist/client/assets/{AgentConfigurationScreen-BoBQpyz5.js → AgentConfigurationScreen-C3OI6JmZ.js} +1 -1
  8. package/dist/client/assets/{AgentDefinitionsWorkspace-rw3vh8Lm.js → AgentDefinitionsWorkspace-D0LDEqfl.js} +1 -1
  9. package/dist/client/assets/{AgentDetailCard-FelCxQrT.js → AgentDetailCard-2DZQahiN.js} +1 -1
  10. package/dist/client/assets/{AgentFloorView-Crdw8Uo5.js → AgentFloorView-CoGh2q5f.js} +1 -1
  11. package/dist/client/assets/{AgentInfoScreen-Cge7HHbV.js → AgentInfoScreen-5ybfIL9p.js} +1 -1
  12. package/dist/client/assets/{AgentLaneCard-CRDG74C1.js → AgentLaneCard-CeSjWWwh.js} +1 -1
  13. package/dist/client/assets/{AgentLaneChrome-CWFqUdch.js → AgentLaneChrome-Do7CXwin.js} +1 -1
  14. package/dist/client/assets/{AgentLaneDetailSheet-DCIIg3Zp.js → AgentLaneDetailSheet-BD8B51ka.js} +1 -1
  15. package/dist/client/assets/{AgentLaneSummaryResize-yTM4GQAJ.js → AgentLaneSummaryResize--lHgnncr.js} +1 -1
  16. package/dist/client/assets/AgentLanesEmbedScreen-FRTVASPw.js +1 -0
  17. package/dist/client/assets/{AgentLanesPreflight-DJeDRTAN.js → AgentLanesPreflight-BwkGk8JH.js} +1 -1
  18. package/dist/client/assets/{AgentLanesView-CbY9qD0z.js → AgentLanesView-Bm85ittm.js} +1 -1
  19. package/dist/client/assets/{AgentLiveActions-Bn3zeZBN.js → AgentLiveActions-BmXDRxER.js} +1 -1
  20. package/dist/client/assets/{AgentSessions-czl5zT7A.js → AgentSessions-C_tAfGN2.js} +1 -1
  21. package/dist/client/assets/{AgentsConsole-CoT2crwq.js → AgentsConsole-DsHWsaOJ.js} +1 -1
  22. package/dist/client/assets/{AgentsScreen-BcPM-z1T.js → AgentsScreen-Bod6AHlA.js} +1 -1
  23. package/dist/client/assets/AgentsSubnav-CsvYzzQ-.js +1 -0
  24. package/dist/client/assets/{AstronautSuit-BADl7m8x.js → AstronautSuit-C05Ezxl9.js} +1 -1
  25. package/dist/client/assets/{AtopView-DymBCiXv.js → AtopView-DOKJbiJL.js} +1 -1
  26. package/dist/client/assets/{BackToPicker-CqYhOaLB.js → BackToPicker-CXsbxbHM.js} +1 -1
  27. package/dist/client/assets/{BriefingDetailScreen-DDfZ8ci1.js → BriefingDetailScreen-Uvnk3t0v.js} +1 -1
  28. package/dist/client/assets/{BriefingsScreen-CLvSOJjy.js → BriefingsScreen-DLIJ8eYj.js} +1 -1
  29. package/dist/client/assets/{BrokerMetadataPanel-DFAH-NO6.js → BrokerMetadataPanel-C8WERmHF.js} +1 -1
  30. package/dist/client/assets/{BrokerScreen-Bkvu92jk.js → BrokerScreen-LZ3T7hGG.js} +1 -1
  31. package/dist/client/assets/{Canvas-KyTsDJlB.js → Canvas-BO9mx5_P.js} +1 -1
  32. package/dist/client/assets/{ChatCollapsedStrip-Bjjqa30K.js → ChatCollapsedStrip-CtLPTLTY.js} +1 -1
  33. package/dist/client/assets/{CodeDiffPane-C9HT1dCT.js → CodeDiffPane-CtgqIuS0.js} +1 -1
  34. package/dist/client/assets/{CodeProjectPicker-5Y3GvXkM.js → CodeProjectPicker-C4W_udc7.js} +1 -1
  35. package/dist/client/assets/{CodeScreen-DpN9kQvm.js → CodeScreen-WhTvVUKY.js} +1 -1
  36. package/dist/client/assets/{ConversationComposer-Ce7Byw48.js → ConversationComposer-DPWu3HvK.js} +1 -1
  37. package/dist/client/assets/{ConversationFeedRows-DygDfQn_.js → ConversationFeedRows-MhcPfxUr.js} +1 -1
  38. package/dist/client/assets/{ConversationHeader-C3sg0ULI.js → ConversationHeader-Ce7TENb9.js} +1 -1
  39. package/dist/client/assets/{ConversationPanels-Dg4Y2GgX.js → ConversationPanels-D-b5SLO-.js} +2 -2
  40. package/dist/client/assets/ConversationScreen-C5HnXd5w.css +1 -0
  41. package/dist/client/assets/{ConversationScreen-CjWWmuuh.js → ConversationScreen-D77SoLos.js} +1 -1
  42. package/dist/client/assets/{ConversationStatus-BhVIYQza.js → ConversationStatus-lIvSKRic.js} +1 -1
  43. package/dist/client/assets/CrewWorkspaces-CJhBKVoZ.css +1 -0
  44. package/dist/client/assets/CrewWorkspaces-CdojnRMG.js +1 -0
  45. package/dist/client/assets/{DataTable-oJP339bX.js → DataTable-DFacT2uu.js} +1 -1
  46. package/dist/client/assets/{DispatchAftermath-CH02HAVw.js → DispatchAftermath-D797PbCe.js} +1 -1
  47. package/dist/client/assets/{DocumentFocusViewer-DmtFisY9.js → DocumentFocusViewer-CetjnYut.js} +1 -1
  48. package/dist/client/assets/{EmbeddableSurfacesLab-84b9I3fy.js → EmbeddableSurfacesLab-JczLmmF-.js} +1 -1
  49. package/dist/client/assets/{EmptyState-BnDda92b.js → EmptyState-uQbB-bvP.js} +1 -1
  50. package/dist/client/assets/{FileViewerPane-Dg7_88pv.js → FileViewerPane-ebbCtnHE.js} +1 -1
  51. package/dist/client/assets/{FlightObserveScreen-DL3Xhl0h.js → FlightObserveScreen-sqvt7HUO.js} +1 -1
  52. package/dist/client/assets/{FollowScreen-DcFBqr6l.js → FollowScreen-Bfu2_KtU.js} +1 -1
  53. package/dist/client/assets/{HarnessMark-DGZ6o6Ct.js → HarnessMark-CEzmPFHC.js} +1 -1
  54. package/dist/client/assets/{HarnessesScreen-DTDL-XaA.js → HarnessesScreen-CGhRsqD5.js} +1 -1
  55. package/dist/client/assets/{HerdrSession-DV2hD6Yh.js → HerdrSession-BDLa_rrK.js} +1 -1
  56. package/dist/client/assets/{HomeHero-CENwVZ45.js → HomeHero-DdxTQ-6a.js} +1 -1
  57. package/dist/client/assets/{HostAdvisorView-PgiZUkd_.js → HostAdvisorView-BAUi5ZxX.js} +1 -1
  58. package/dist/client/assets/{KnowledgeSearchInspector-DNQjeWZO.js → KnowledgeSearchInspector-GjmxYBi_.js} +1 -1
  59. package/dist/client/assets/{KnowledgeSearchScreen-Bj80IgR0.js → KnowledgeSearchScreen-CRei9pyl.js} +1 -1
  60. package/dist/client/assets/{LaneToolHoverCard-197xYmRp.js → LaneToolHoverCard-DCY-m0JK.js} +1 -1
  61. package/dist/client/assets/{LaneTraceDetailSheet-BztwvOv9.js → LaneTraceDetailSheet-CFsCvKa3.js} +1 -1
  62. package/dist/client/assets/{LaneTraceEventFocus-C9cmqxnK.js → LaneTraceEventFocus-BfKZ7G5c.js} +1 -1
  63. package/dist/client/assets/{MeshCanvas-C3_2p9B6.js → MeshCanvas-CZYHLTvw.js} +1 -1
  64. package/dist/client/assets/{MeshCanvasMinimap-ZTjYWXTZ.js → MeshCanvasMinimap-D3mJ78CM.js} +1 -1
  65. package/dist/client/assets/{MeshScreen-lJKaOyGB.js → MeshScreen-dxNxRtKm.js} +1 -1
  66. package/dist/client/assets/{MeshTopologyView-CBjHbAZw.js → MeshTopologyView-A-wh0Ad1.js} +2 -2
  67. package/dist/client/assets/{MessagesScreen-D6MVLvdg.js → MessagesScreen-CR5v-WIE.js} +1 -1
  68. package/dist/client/assets/{MissionContextRail-DXkrbcnZ.js → MissionContextRail-MTL2EAnr.js} +1 -1
  69. package/dist/client/assets/{MissionControlView-BCH-Zsp4.js → MissionControlView-BGj1qnI2.js} +1 -1
  70. package/dist/client/assets/{MissionFocusOverlay-DbAliOSF.js → MissionFocusOverlay-hWi6y87j.js} +1 -1
  71. package/dist/client/assets/{MissionLeftAgentRow-Bx6Pg8_O.js → MissionLeftAgentRow-BSRRiiig.js} +1 -1
  72. package/dist/client/assets/{MissionLogPane-D06c29Y8.js → MissionLogPane-bbG_pM9B.js} +1 -1
  73. package/dist/client/assets/{NewAgentModal-C18Ajovd.js → NewAgentModal-Ctixol4_.js} +1 -1
  74. package/dist/client/assets/{NewChatComposer-Bgqes0UQ.js → NewChatComposer-BPsg8shF.js} +1 -1
  75. package/dist/client/assets/{NewChatOrigin-DpHS2Wmt.js → NewChatOrigin-CCiPg_WR.js} +1 -1
  76. package/dist/client/assets/{ObserveEmbedScreen-Cmhwai4X.js → ObserveEmbedScreen-Be87Chod.js} +1 -1
  77. package/dist/client/assets/{ObserveTextFlow-C1f5oize.js → ObserveTextFlow-CKYltTPJ.js} +2 -2
  78. package/dist/client/assets/{ObservedTopologyPanel-D85P6RAk.js → ObservedTopologyPanel-CfHYu-4Z.js} +1 -1
  79. package/dist/client/assets/{OpenScoutAppShell-IDI4fuUE.js → OpenScoutAppShell-DPeP1vtK.js} +2 -2
  80. package/dist/client/assets/{OpsAgentsView-yt0JavoB.js → OpsAgentsView-dEtw9yt-.js} +1 -1
  81. package/dist/client/assets/OpsScreen-QXRJY8Vf.js +1 -0
  82. package/dist/client/assets/OpsSubnav-BK9Fj3gU.js +1 -0
  83. package/dist/client/assets/ProjectAgentProfile-BjykZ2Xd.js +1 -0
  84. package/dist/client/assets/{ProjectAgentProfileBar-IDEpKZvI.js → ProjectAgentProfileBar-B4RqrI0Q.js} +1 -1
  85. package/dist/client/assets/{ProjectAgentProfileHero-Bh_aISs-.js → ProjectAgentProfileHero-Bc0g8rhW.js} +1 -1
  86. package/dist/client/assets/{ProjectsInbox-B8Srlklk.js → ProjectsInbox--ZIqo-IE.js} +1 -1
  87. package/dist/client/assets/{ProjectsRail-DqAbdvCf.js → ProjectsRail-CzS0qTCI.js} +1 -1
  88. package/dist/client/assets/ProjectsScreen-0gx7f30h.js +1 -0
  89. package/dist/client/assets/{ProjectsThreadAside-DpkjYLL2.js → ProjectsThreadAside-BsQRFbdy.js} +1 -1
  90. package/dist/client/assets/{Provider-Ve8yXaWR.js → Provider-Cd-QZltN.js} +1 -1
  91. package/dist/client/assets/{RailRow-C4GNGR80.js → RailRow-BY6fxePa.js} +1 -1
  92. package/dist/client/assets/{RawSessionsTable-Co3vzwsf.js → RawSessionsTable-CbopOF34.js} +1 -1
  93. package/dist/client/assets/{RealtimeVoiceScreen-DMd1CBAf.js → RealtimeVoiceScreen-CU4uXz4C.js} +1 -1
  94. package/dist/client/assets/{RepoDiffEmbedScreen-C97Euf4s.js → RepoDiffEmbedScreen-Cr1SL5ht.js} +1 -1
  95. package/dist/client/assets/{RepoDiffPageScreen-DUKLzkrW.js → RepoDiffPageScreen-DeC8fsh_.js} +1 -1
  96. package/dist/client/assets/{RepoDiffViewer-CovKjSgb.js → RepoDiffViewer-CiTOWK_Z.js} +1 -1
  97. package/dist/client/assets/{RepoDiffViewerLazy-zIiEmh-e.js → RepoDiffViewerLazy-BU3V7Kwq.js} +2 -2
  98. package/dist/client/assets/{ReposScreen-BR1LqTf1.js → ReposScreen-BQwIShXf.js} +1 -1
  99. package/dist/client/assets/{ScoutDeckSurface-BGsVicc2.js → ScoutDeckSurface-BncYKicb.js} +1 -1
  100. package/dist/client/assets/{ScoutSurface-BMKW7hSu.js → ScoutSurface-DdVzN3DA.js} +1 -1
  101. package/dist/client/assets/{ScoutbotFxLab-0O2iDRrF.js → ScoutbotFxLab-sLjfSKtS.js} +1 -1
  102. package/dist/client/assets/{SecondaryNav-cYTw2p39.js → SecondaryNav-CCQqTT3e.js} +1 -1
  103. package/dist/client/assets/{SessionEmbedScreen-mNjT0R6j.js → SessionEmbedScreen-BrLMZJ3N.js} +1 -1
  104. package/dist/client/assets/{SessionObserve-zAlFbwFn.js → SessionObserve-pbozyqVv.js} +1 -1
  105. package/dist/client/assets/{SessionObserveEvidence-BVawzqoE.js → SessionObserveEvidence-C54Xvbps.js} +1 -1
  106. package/dist/client/assets/{SessionRefScreen-BmKhf29o.js → SessionRefScreen-UVNVrwAf.js} +1 -1
  107. package/dist/client/assets/SessionsScreen-KeDb5gz4.js +1 -0
  108. package/dist/client/assets/SettingsDrawer-CWdj0VvN.js +3 -0
  109. package/dist/client/assets/SettingsDrawer-J-8x1eII.css +1 -0
  110. package/dist/client/assets/SettingsScreen-C7zJgZzj.js +1 -0
  111. package/dist/client/assets/{ShikiPane-DyEJdcvb.js → ShikiPane-CiVH-45m.js} +1 -1
  112. package/dist/client/assets/{SlidePanel-Dg8_styW.js → SlidePanel-BLrLF9dt.js} +1 -1
  113. package/dist/client/assets/{SpriteAvatar-DMrSssNZ.js → SpriteAvatar-vpHO-rXs.js} +1 -1
  114. package/dist/client/assets/{StatusPill-NFFnphtx.js → StatusPill-a3XBw1GG.js} +1 -1
  115. package/dist/client/assets/{TailView-BfObcZu3.js → TailView-C3rjOV7i.js} +1 -1
  116. package/dist/client/assets/{Terminal-Dr-M9U4u.js → Terminal-CMQFmHnn.js} +1 -1
  117. package/dist/client/assets/{TerminalEmbedScreen-BmyZkonh.js → TerminalEmbedScreen-GvpoGERN.js} +1 -1
  118. package/dist/client/assets/{TerminalRelay-lJ2KdMCW.js → TerminalRelay-CIHlLVf1.js} +3 -3
  119. package/dist/client/assets/{TextDocumentSurface-C7fGlzY8.js → TextDocumentSurface-B29xZNlI.js} +1 -1
  120. package/dist/client/assets/{TmuxPeek-BSeKIjnX.js → TmuxPeek-eVfqPB4m.js} +1 -1
  121. package/dist/client/assets/{VoicePermissionsPanel-BkIGTzgw.js → VoicePermissionsPanel-DpInOlVq.js} +1 -1
  122. package/dist/client/assets/{WorkDetailScreen-Cwe-KWK4.js → WorkDetailScreen-DYwgGaJs.js} +1 -1
  123. package/dist/client/assets/{WorkFilesViewer-BBtKRBPv.js → WorkFilesViewer-C7H5fXaZ.js} +1 -1
  124. package/dist/client/assets/{activity-D4W2XZY2.js → activity-DTqqWiyV.js} +1 -1
  125. package/dist/client/assets/{addon-fit-Celjj2yn.js → addon-fit-CcaylYTX.js} +1 -1
  126. package/dist/client/assets/{addon-webgl-Cu4tJ21-.js → addon-webgl-B37iuzOG.js} +1 -1
  127. package/dist/client/assets/{agent-autocomplete-Dv-_9dAw.js → agent-autocomplete-cOPLtuhM.js} +1 -1
  128. package/dist/client/assets/{agent-essentials-CngjUhQj.js → agent-essentials-DbbJm3ne.js} +1 -1
  129. package/dist/client/assets/{agent-identity-DzHGhLdJ.js → agent-identity-CIMT7oV6.js} +1 -1
  130. package/dist/client/assets/{agent-specialization-CNrsRbKA.js → agent-specialization-D3-sqwhU.js} +1 -1
  131. package/dist/client/assets/{arc.es-DNT50Y-_.js → arc.es-BRPqOKIx.js} +1 -1
  132. package/dist/client/assets/{archive-DH49QqFG.js → archive-DPMdoW_D.js} +1 -1
  133. package/dist/client/assets/{arrow-left-i-h6JAgs.js → arrow-left-B0CdJdAC.js} +1 -1
  134. package/dist/client/assets/{arrow-right-B0Yi01Zr.js → arrow-right-YRBoTTyf.js} +1 -1
  135. package/dist/client/assets/{arrow-up-right-RBC6k8nn.js → arrow-up-right-CilNLf4t.js} +1 -1
  136. package/dist/client/assets/{bot-r2IuAuJd.js → bot-Ba3gcRVa.js} +1 -1
  137. package/dist/client/assets/{check-Bfs7hMb1.js → check-BdovFDz8.js} +1 -1
  138. package/dist/client/assets/{chevron-down-Da5tV19_.js → chevron-down-Jh540uf3.js} +1 -1
  139. package/dist/client/assets/{chevron-right-BMqtBds_.js → chevron-right-CV7sEVBS.js} +1 -1
  140. package/dist/client/assets/{chunk-HRAB3GC3-BUVYXXAp.js → chunk-HRAB3GC3-BYQZ1LOn.js} +1 -1
  141. package/dist/client/assets/{clock-DaKLp6Xd.js → clock-DpfYdWcr.js} +1 -1
  142. package/dist/client/assets/{code-xml-ByQsfOI_.js → code-xml-CPzpZkhu.js} +1 -1
  143. package/dist/client/assets/{compass-BepM5iWH.js → compass-D5Io6BIV.js} +1 -1
  144. package/dist/client/assets/{content-Bgl_X3ao.js → content-3b_jmxEx.js} +1 -1
  145. package/dist/client/assets/content-B-i0XY-t.js +1 -0
  146. package/dist/client/assets/content-BD-DNFmb.js +1 -0
  147. package/dist/client/assets/content-BGeo5tgd.js +1 -0
  148. package/dist/client/assets/content-BMvXPLiQ.js +1 -0
  149. package/dist/client/assets/content-BWTbfMDg.js +1 -0
  150. package/dist/client/assets/content-BwCmeUmF.js +1 -0
  151. package/dist/client/assets/content-C1K3NcZa.js +1 -0
  152. package/dist/client/assets/{content-Cv2tSAbv.js → content-C34J5_Af.js} +1 -1
  153. package/dist/client/assets/content-CGRtIS2m.js +1 -0
  154. package/dist/client/assets/content-CIJo_-JS.js +1 -0
  155. package/dist/client/assets/content-CvqIqVAV.js +1 -0
  156. package/dist/client/assets/content-DRnwm-Vu.js +1 -0
  157. package/dist/client/assets/{content-5hnDC9WE.js → content-Dh39SSvP.js} +1 -1
  158. package/dist/client/assets/content-DoypqDj5.js +1 -0
  159. package/dist/client/assets/content-n3mvc6NQ.js +1 -0
  160. package/dist/client/assets/{conversation-icons-C4amK8Sa.js → conversation-icons-bHIIZ9z3.js} +1 -1
  161. package/dist/client/assets/{conversation-model-CigSPlKA.js → conversation-model-CIzM7aXT.js} +1 -1
  162. package/dist/client/assets/conversation-motion-features-CrP5K-dk.js +1 -0
  163. package/dist/client/assets/{copy-De4s38o2.js → copy-DQAM0eSY.js} +1 -1
  164. package/dist/client/assets/{cpu-Bc268H9Q.js → cpu-CtQc0Z9D.js} +1 -1
  165. package/dist/client/assets/{createLucideIcon-DLlxGjKt.js → createLucideIcon-Da0lq809.js} +1 -1
  166. package/dist/client/assets/discover-DdkMhTAV.js +2 -0
  167. package/dist/client/assets/embed-entry-DoSM1GZB.js +2 -0
  168. package/dist/client/assets/{external-link-BGHC_naA.js → external-link-BheHazeW.js} +1 -1
  169. package/dist/client/assets/{eye-BeCSqJn1.js → eye-B908WSFH.js} +1 -1
  170. package/dist/client/assets/{file-code-corner-CX53Cd9y.js → file-code-corner-C5Pc6znt.js} +1 -1
  171. package/dist/client/assets/{file-text-BVhkMWyC.js → file-text-BGVkHS4_.js} +1 -1
  172. package/dist/client/assets/{gauge-CPcEPmNt.js → gauge-sc_gb5Zw.js} +1 -1
  173. package/dist/client/assets/{gestures-BXIGYk_p.js → gestures-AzPBSf20.js} +1 -1
  174. package/dist/client/assets/{git-branch-q8Ayc8py.js → git-branch-CdJU49Af.js} +1 -1
  175. package/dist/client/assets/{home-moving-signal-Dm2Z2x0p.js → home-moving-signal-CZo2bYBi.js} +1 -1
  176. package/dist/client/assets/{home-now-card-xU5LGP7q.js → home-now-card-DgxfZHcR.js} +1 -1
  177. package/dist/client/assets/{home-now-card-nano-Djhy6ax0.js → home-now-card-nano-iwd10r9G.js} +1 -1
  178. package/dist/client/assets/{hooks-CdKx1CxP.js → hooks-CeCCO6Yg.js} +1 -1
  179. package/dist/client/assets/{index-DhfOMK0D.js → index-BIiI9gfa.js} +1 -1
  180. package/dist/client/assets/index-CD2foMB8.js +1 -0
  181. package/dist/client/assets/{index-D7UEHxaY.js → index-DReHD_4U.js} +1 -1
  182. package/dist/client/assets/{index-Bli6bTLU.js → index-NRbRrZw-.js} +6 -6
  183. package/dist/client/assets/{inspector-panel-B8pigRsg.js → inspector-panel-CBf8pW7s.js} +1 -1
  184. package/dist/client/assets/{keyboard-nav-7iEtvu9P.js → keyboard-nav-feLCB3Zm.js} +1 -1
  185. package/dist/client/assets/{lane-roster-store-pHT3TAVs.js → lane-roster-store-BAmj273z.js} +1 -1
  186. package/dist/client/assets/{layers-BiZA-Clc.js → layers-D9fblkql.js} +1 -1
  187. package/dist/client/assets/{layout-grid-DMpv9CZM.js → layout-grid-Vd1chalc.js} +1 -1
  188. package/dist/client/assets/left-41_3QKk1.js +1 -0
  189. package/dist/client/assets/{left-Dy403II2.js → left-B3ofA1Pr.js} +2 -2
  190. package/dist/client/assets/{left-BhgU6NOA.js → left-BWBZQhxQ.js} +1 -1
  191. package/dist/client/assets/{left-CY_FGnN7.js → left-BhA6essi.js} +1 -1
  192. package/dist/client/assets/{left-Cq8mjamr.js → left-BmTKCv4f.js} +1 -1
  193. package/dist/client/assets/{left-Dnqla0b5.js → left-CCGR6tIF.js} +1 -1
  194. package/dist/client/assets/{left-BhZhSrS2.js → left-Dfwzkwh_.js} +1 -1
  195. package/dist/client/assets/{left-advisor-oOAtJ9YE.js → left-advisor-yrzW1Kwz.js} +1 -1
  196. package/dist/client/assets/{left-agents-TIKe8vW8.js → left-agents-Bgahk0FF.js} +1 -1
  197. package/dist/client/assets/{left-default-owH0Lwxo.js → left-default-CtkfAquc.js} +1 -1
  198. package/dist/client/assets/{left-lanes-BE_co2lP.js → left-lanes-CpujaVN3.js} +1 -1
  199. package/dist/client/assets/{left-mission-C_nWUtfA.js → left-mission-Bbd-fW6W.js} +1 -1
  200. package/dist/client/assets/{library-BSVrjn_m.js → library-Dx14WNGd.js} +1 -1
  201. package/dist/client/assets/{loader-circle-DoT8gpw6.js → loader-circle-Be0T8xv2.js} +1 -1
  202. package/dist/client/assets/{local-agents-BMadXuP1.js → local-agents-Q6KQ12B9.js} +1 -1
  203. package/dist/client/assets/{mentions-Cd6XticV.js → mentions-KNASbAjG.js} +1 -1
  204. package/dist/client/assets/{mesh-ops-C0zCLTR8.js → mesh-ops-C-i8OMiM.js} +1 -1
  205. package/dist/client/assets/{mesh-view-store-Cpqil_2D.js → mesh-view-store-B0lqpw8M.js} +1 -1
  206. package/dist/client/assets/{message-circle-44KSmbvQ.js → message-circle-2v9Udia0.js} +1 -1
  207. package/dist/client/assets/{message-markup-DAnnGpWr.js → message-markup-BP2nH9kQ.js} +1 -1
  208. package/dist/client/assets/{message-square-DlY4EneU.js → message-square-DURSOrUr.js} +1 -1
  209. package/dist/client/assets/{mission-control-store-DtjtRs9Z.js → mission-control-store-HeCy97KT.js} +1 -1
  210. package/dist/client/assets/{observe-DL5_8-Zj.js → observe-DkAhvkfn.js} +1 -1
  211. package/dist/client/assets/{page-status-CW8co39E.js → page-status-CEP5pGf3.js} +1 -1
  212. package/dist/client/assets/{persistent-state-DYjP8lqN.js → persistent-state-Bm_0TmZL.js} +1 -1
  213. package/dist/client/assets/{plus-64n9qucr.js → plus-ZReaTFF-.js} +1 -1
  214. package/dist/client/assets/{profile-BkmuseW7.js → profile-Y0X7HZHc.js} +1 -1
  215. package/dist/client/assets/{projects-inbox-C0umZMSY.js → projects-inbox-Cbfj4Hx7.js} +1 -1
  216. package/dist/client/assets/{provider-CX9EWecp.js → provider-Bq0ScH3v.js} +1 -1
  217. package/dist/client/assets/{proxy-C35W-YHZ.js → proxy-DtC2iXnT.js} +1 -1
  218. package/dist/client/assets/{radio-BjpQTKT0.js → radio-BC9TO5Pl.js} +1 -1
  219. package/dist/client/assets/{refresh-cw-IgN2fZLM.js → refresh-cw-C4E58VJK.js} +1 -1
  220. package/dist/client/assets/resolve-panes-BI3WdDS-.js +1 -0
  221. package/dist/client/assets/resolve-sidebar-context-_g0pIxOr.js +1 -0
  222. package/dist/client/assets/{right-B3PQUHd5.js → right-BA0F8fPI.js} +1 -1
  223. package/dist/client/assets/{right-B96CBzrV.js → right-BarpRgcv.js} +1 -1
  224. package/dist/client/assets/{right-BPirlFC8.js → right-C4GXB45w.js} +1 -1
  225. package/dist/client/assets/{right-DqiVyo8v.js → right-CIzaNH58.js} +1 -1
  226. package/dist/client/assets/{right-C2aOC2li.js → right-CXetlD8X.js} +1 -1
  227. package/dist/client/assets/{right-CtPJjgOV.js → right-CnRcQS_I.js} +1 -1
  228. package/dist/client/assets/{right-BVWYPIFX.js → right-D2_rmbAH.js} +1 -1
  229. package/dist/client/assets/{right-SfSu0zHC.js → right-Dqp--KwX.js} +1 -1
  230. package/dist/client/assets/{right-BUP2Ro_M.js → right-HJJzRuGD.js} +1 -1
  231. package/dist/client/assets/{right-BoAJxwA3.js → right-WCMb8YXJ.js} +1 -1
  232. package/dist/client/assets/{rocket-DnmN_YOD.js → rocket-BahfIwFz.js} +1 -1
  233. package/dist/client/assets/{router-B0YclXYg.js → router-Bx1tiwVe.js} +1 -1
  234. package/dist/client/assets/{scope-views-Z8aoAmtU.js → scope-views-CmG2X_S0.js} +1 -1
  235. package/dist/client/assets/{scout-voice-DvG_3stJ.js → scout-voice-BT3gYDhU.js} +1 -1
  236. package/dist/client/assets/{scoutbot-markdown-BJJyaPu2.js → scoutbot-markdown-DIhLsYxz.js} +1 -1
  237. package/dist/client/assets/{scroll-text-DRidbcse.js → scroll-text-uulNqrf7.js} +1 -1
  238. package/dist/client/assets/{search-BbgsEMXa.js → search-HmdKXdtR.js} +1 -1
  239. package/dist/client/assets/{secondaryNavConfig-DyC_P9Wx.js → secondaryNavConfig-BVQiyAXu.js} +1 -1
  240. package/dist/client/assets/{selection-bridge-CpzFGx3-.js → selection-bridge-n4wNTm1B.js} +1 -1
  241. package/dist/client/assets/{send-horizontal-BXo2uz3Z.js → send-horizontal-DOjHkZCD.js} +1 -1
  242. package/dist/client/assets/{server-Dt3tpiBj.js → server-CX-xQjJA.js} +1 -1
  243. package/dist/client/assets/{session-catalog-CUQ8LUJY.js → session-catalog-b7B1Sof1.js} +1 -1
  244. package/dist/client/assets/{session-table-B4JOKevn.js → session-table-Djain1Qr.js} +1 -1
  245. package/dist/client/assets/{settings-BzWCF3NF.js → settings-BpKRzxOD.js} +1 -1
  246. package/dist/client/assets/{sliders-horizontal-7V8B3xsf.js → sliders-horizontal-D2O6QiDN.js} +1 -1
  247. package/dist/client/assets/{sparkles-ytTwpCbZ.js → sparkles-CgTby-ap.js} +1 -1
  248. package/dist/client/assets/{sse-CSozY6mp.js → sse-QSbhyq9A.js} +1 -1
  249. package/dist/client/assets/{tail-events-CrN-Rmxj.js → tail-events-B7BrDaFi.js} +1 -1
  250. package/dist/client/assets/{terminal-BiNIXhna.js → terminal-DNZTCr6a.js} +1 -1
  251. package/dist/client/assets/{terminal-relay-pSm7_An6.js → terminal-relay-C2TUIuh1.js} +1 -1
  252. package/dist/client/assets/{terminal-takeover-CtA3wcXh.js → terminal-takeover-BArLfNtd.js} +1 -1
  253. package/dist/client/assets/{text-BR9Bap0E.js → text-B2UZi3l9.js} +1 -1
  254. package/dist/client/assets/{use-conversation-list-C0bEXFeH.js → use-conversation-list-htp0Ui63.js} +1 -1
  255. package/dist/client/assets/{use-fleet-active-asks-CK4aw-3G.js → use-fleet-active-asks-BhuTn5mV.js} +1 -1
  256. package/dist/client/assets/{use-mesh-ops-items-QixBijmT.js → use-mesh-ops-items-CD-qsvNX.js} +1 -1
  257. package/dist/client/assets/{use-reduced-motion-BLn59zLn.js → use-reduced-motion-0fAsybdo.js} +1 -1
  258. package/dist/client/assets/{use-scout-dev-flags-JKb1EhFh.js → use-scout-dev-flags-DV_I6URU.js} +1 -1
  259. package/dist/client/assets/{useAgentHoverCard-6N8b7qsU.js → useAgentHoverCard-BIrm8esH.js} +1 -1
  260. package/dist/client/assets/useContentSecondaryNav-4atpGgFw.js +1 -0
  261. package/dist/client/assets/{usePersistentState-DOEahRlt.js → usePersistentState-InmPXIN4.js} +1 -1
  262. package/dist/client/assets/{usePierreRuntime-Bq6mXrgd.js → usePierreRuntime-CVTMzChM.js} +1 -1
  263. package/dist/client/assets/{wrench-CQvdf7KT.js → wrench-DwFKomxg.js} +1 -1
  264. package/dist/client/assets/{x-BJyPzFnn.js → x-DuzAbpk5.js} +1 -1
  265. package/dist/client/assets/{xterm-D6dE_wMr.js → xterm-xQGYNyB-.js} +1 -1
  266. package/dist/client/assets/{zap-rw7uwZht.js → zap-CocRNtyr.js} +1 -1
  267. package/dist/client/crew/brik-bust.webp +0 -0
  268. package/dist/client/crew/brik-chip-id.webp +0 -0
  269. package/dist/client/crew/lulu-bust.webp +0 -0
  270. package/dist/client/crew/milo-bust.webp +0 -0
  271. package/dist/client/crew/milo-chip-id.webp +0 -0
  272. package/dist/client/crew/nori-bust.webp +0 -0
  273. package/dist/client/crew/sheets/eye-plate-v1/blink-half.webp +0 -0
  274. package/dist/client/crew/sheets/eye-plate-v1/blink-shut.webp +0 -0
  275. package/dist/client/crew/sheets/eye-plate-v1/look-left.webp +0 -0
  276. package/dist/client/crew/sheets/eye-plate-v1/look-right.webp +0 -0
  277. package/dist/client/crew/sheets/eye-plate-v1/look-up.webp +0 -0
  278. package/dist/client/crew/sheets/eye-plate-v1/rest.webp +0 -0
  279. package/dist/client/crew/sheets/sprout/blink-half.webp +0 -0
  280. package/dist/client/crew/sheets/sprout/blink-shut.webp +0 -0
  281. package/dist/client/crew/sheets/sprout/look-left.webp +0 -0
  282. package/dist/client/crew/sheets/sprout/look-right.webp +0 -0
  283. package/dist/client/crew/sheets/sprout/look-up.webp +0 -0
  284. package/dist/client/crew/sprout-bust.webp +0 -0
  285. package/dist/client/crew/sprout-chip-id.webp +0 -0
  286. package/dist/client/crew/vex-bust.webp +0 -0
  287. package/dist/client/crew/vex-chip-id.webp +0 -0
  288. package/dist/client/crew/wrench-bust.webp +0 -0
  289. package/dist/client/crew/wrench-chip-id.webp +0 -0
  290. package/dist/client/index.html +1 -1
  291. package/dist/main.mjs +1 -1
  292. package/package.json +1 -1
  293. package/dist/client/assets/AgentAvatar-B1xvQ7ej.js +0 -1
  294. package/dist/client/assets/AgentLanesEmbedScreen-BJLwXSNp.js +0 -1
  295. package/dist/client/assets/AgentsSubnav-3_vpn2bT.js +0 -1
  296. package/dist/client/assets/ConversationScreen-BP5tdz2k.css +0 -1
  297. package/dist/client/assets/CrewWorkspaces-B6YIyw1z.css +0 -1
  298. package/dist/client/assets/CrewWorkspaces-CDU-wy1Y.js +0 -1
  299. package/dist/client/assets/OpsScreen-C3yNQqJE.js +0 -1
  300. package/dist/client/assets/OpsSubnav-BijKI3yG.js +0 -1
  301. package/dist/client/assets/ProjectAgentProfile-DnIeC16r.js +0 -1
  302. package/dist/client/assets/ProjectsScreen-DKHQ2iEv.js +0 -1
  303. package/dist/client/assets/SessionsScreen-CsSqjIY2.js +0 -1
  304. package/dist/client/assets/SettingsDrawer-Dsj-On_x.css +0 -1
  305. package/dist/client/assets/SettingsDrawer-DwYQTGi8.js +0 -3
  306. package/dist/client/assets/SettingsScreen-Btaku7YM.js +0 -1
  307. package/dist/client/assets/content-BRFZ-a6m.js +0 -1
  308. package/dist/client/assets/content-BYykncDo.js +0 -1
  309. package/dist/client/assets/content-Be6yyWbJ.js +0 -1
  310. package/dist/client/assets/content-BopJW1Zx.js +0 -1
  311. package/dist/client/assets/content-Bv2sfg0w.js +0 -1
  312. package/dist/client/assets/content-CMBiIZTg.js +0 -1
  313. package/dist/client/assets/content-CPVqvf5o.js +0 -1
  314. package/dist/client/assets/content-CbwyFqdI.js +0 -1
  315. package/dist/client/assets/content-ClQjAWYi.js +0 -1
  316. package/dist/client/assets/content-DFFe3-Ot.js +0 -1
  317. package/dist/client/assets/content-DY5hwBmm.js +0 -1
  318. package/dist/client/assets/content-_IXoxGno.js +0 -1
  319. package/dist/client/assets/content-j_tewJdE.js +0 -1
  320. package/dist/client/assets/conversation-motion-features-_95aZx_1.js +0 -1
  321. package/dist/client/assets/discover-DOlk1hG7.js +0 -2
  322. package/dist/client/assets/embed-entry-BqDJfa87.js +0 -2
  323. package/dist/client/assets/index-DFdlQs_c.js +0 -1
  324. package/dist/client/assets/left-BayK4ocL.js +0 -1
  325. package/dist/client/assets/resolve-panes-CCqRkQdM.js +0 -1
  326. package/dist/client/assets/resolve-sidebar-context-JkxY8qsV.js +0 -1
  327. package/dist/client/assets/useContentSecondaryNav-D-hVKzM9.js +0 -1
@@ -1 +1 @@
1
- import{j as r,r as n}from"./index-Bli6bTLU.js";import{k as it,w as qn,l as Bt,m as bs,o as Dn,q as Bn,s as Un,t as xs,u as Hn,v as Wn,x as _n,y as Qn}from"./NewChatComposer-Bgqes0UQ.js";import{a as _}from"./api-DEHEgJ9m.js";import"./text-BR9Bap0E.js";import{u as Kn,C as Vn}from"./ConversationComposer-Ce7Byw48.js";import"./index-DFdlQs_c.js";import{u as zn,d as Gn,a as Jn}from"./Provider-Ve8yXaWR.js";import{h as Yn,j as Xn,v as te,y as Ts,z as Zn,A as be,B as ea,D as ta,E as sa,F as na,c as vs,S as ks,G as aa,H as ra,I as oa,J as ia,K as la,L as ca,M as da,k as ua,N as ma,O as ha,q as pa,s as ga,r as Cs,P as fa,Q as ya,R as wa,T as Sa,l as ba,U as xa,V as Ta,W as Ms,X as va,Y as ka,Z as lt,g as Ca,_ as Ma,$ as Na,a0 as Ns,a1 as Ia,a2 as Aa,a3 as ja,a4 as Ra,a5 as Is,a6 as Ea,a7 as As,a8 as La,a9 as Pa,aa as $a}from"./conversation-model-CigSPlKA.js";import{u as Fa}from"./sse-CSozY6mp.js";import{t as Ut,n as js,f as Rs}from"./time-Dhsh_2EG.js";import{M as Oa}from"./message-markup-DAnnGpWr.js";import{i as Ht}from"./message-visibility-kJM8XcSG.js";import{d as qa}from"./router-B0YclXYg.js";import{f as Da}from"./scoutbot-D4vuKzOL.js";import{s as Ba}from"./sessionRead-CvFz2RHv.js";import{o as ct}from"./openContent-C6XO6kr5.js";import{c as Be}from"./clipboard-e3fSpeo7.js";import{A as Wt}from"./AgentAvatar-B1xvQ7ej.js";import{d as Ua}from"./types-B0PlfpKc.js";/* empty css */import{ConversationHeader as Ha,ConversationIdentityRow as Wa,AddParticipantForm as _a}from"./ConversationHeader-C3sg0ULI.js";import{FanOutRow as Qa,ThreadDayDivider as Ka}from"./ConversationFeedRows-DygDfQn_.js";import{T as Va,t as Es,m as Ls,a as za,b as Ga,o as Ja,d as Ya,s as Xa,l as Za,c as er,e as tr,W as sr,f as nr,g as ar}from"./ConversationPanels-Dg4Y2GgX.js";import{u as rr}from"./tail-events-CrN-Rmxj.js";import{PinnedAskCard as or,ConversationStatusStrip as ir}from"./ConversationStatus-BhVIYQza.js";import"./HarnessMark-DGZ6o6Ct.js";import"./colors-BtO5_zlx.js";import"./NewChatOrigin-DpHS2Wmt.js";import"./keyboard-nav-7iEtvu9P.js";import"./x-BJyPzFnn.js";import"./createLucideIcon-DLlxGjKt.js";import"./chevron-down-Da5tV19_.js";import"./search-BbgsEMXa.js";import"./loader-circle-DoT8gpw6.js";import"./file-text-BVhkMWyC.js";import"./scout-voice-DvG_3stJ.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./zap-rw7uwZht.js";import"./provider-CX9EWecp.js";import"./surface-activity-B1rgWB1i.js";import"./DocumentFocusViewer-DmtFisY9.js";import"./TextDocumentSurface-C7fGlzY8.js";import"./chevron-right-BMqtBds_.js";import"./code-xml-ByQsfOI_.js";import"./arrow-left-i-h6JAgs.js";import"./arrow-right-B0Yi01Zr.js";import"./chunk-HRAB3GC3-BUVYXXAp.js";import"./index-BWHgHrtv.js";import"./mentions-Cd6XticV.js";import"./AgentDetailCard-FelCxQrT.js";import"./AgentLiveActions-Bn3zeZBN.js";import"./terminal-takeover-CtA3wcXh.js";import"./eye-BeCSqJn1.js";import"./terminal-BiNIXhna.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-D4dHTRkt.js";import"./SpriteAvatar-DMrSssNZ.js";import"./agent-identity-DzHGhLdJ.js";import"./BackToPicker-CqYhOaLB.js";import"./AstronautSuit-BADl7m8x.js";import"./tail-display-DcliDVkW.js";import"./lane-edit-display-C_Aujldz.js";import"./use-reduced-motion-BLn59zLn.js";import"./proxy-C35W-YHZ.js";import"./activity-D4W2XZY2.js";import"./message-circle-44KSmbvQ.js";import"./check-Bfs7hMb1.js";import"./sparkles-ytTwpCbZ.js";const lr=/\.(?:apng|avif|gif|jpe?g|png|svg|webp)(?:$|[?#])/iu,cr=/\bhttps?:\/\/[^\s<>"')\]]+/giu;function Ue(o){if(typeof o!="string")return null;try{const c=new URL(o.trim());return c.protocol==="http:"||c.protocol==="https:"?c.toString():null}catch{return null}}function K(o,c){const h=o?.[c];return typeof h=="string"&&h.trim()?h.trim():null}function dr(o){return o.mediaType.toLowerCase().startsWith("image/")}function ur(o){return lr.test(o)}function mr(o){try{const c=new URL(o),h=[c.pathname==="/"?"":c.pathname,c.search].join("").trim();return{host:c.hostname.replace(/^www\./iu,""),detail:h||c.hostname}}catch{return{host:o,detail:o}}}function hr(o){const c=new Set,h=[];for(const w of o.matchAll(cr)){const S=w[0]?.replace(/[.,;:!?]+$/u,""),F=Ue(S);!F||c.has(F)||(c.add(F),h.push(F))}return h}const pr=/^\/api\/blobs\/[^/]+$/u;function _t(o){try{const c=new URL(o);return pr.test(c.pathname)?`${c.pathname}${c.search}`:o}catch{return o}}function dt(o){return Ue(o.url)??Ue(K(o.metadata,"url"))??Ue(K(o.metadata,"href"))}function gr(o){const c=o.metadata??null,h=K(c,"kind")??K(c,"type"),w=dt(o);if(!w||h!=="link_preview"&&h!=="link-preview"&&o.mediaType!=="text/x-uri")return null;const S=mr(w);return{id:o.id,url:w,title:K(c,"title")??S.host,description:K(c,"description"),imageUrl:Ue(K(c,"imageUrl")??K(c,"image")),siteName:K(c,"siteName")??S.host}}function fr({src:o,alt:c}){const[h,w]=n.useState(!1);return h?r.jsxs("a",{className:"s-message-embed s-message-embed--file",href:o,target:"_blank",rel:"noreferrer",children:[r.jsx("span",{className:"s-message-embed-title",children:c}),r.jsx("span",{className:"s-message-embed-description",children:"Preview unavailable"})]}):r.jsx("a",{className:"s-message-embed s-message-embed--image",href:o,target:"_blank",rel:"noreferrer",children:r.jsx("img",{src:o,alt:c,loading:"lazy",decoding:"async",onError:()=>w(!0)})})}function yr({preview:o}){return r.jsxs("a",{className:"s-message-embed s-message-embed--link",href:o.url,target:"_blank",rel:"noreferrer",children:[o.imageUrl&&r.jsx("span",{className:"s-message-embed-thumb",children:r.jsx("img",{src:o.imageUrl,alt:"",loading:"lazy",decoding:"async"})}),r.jsxs("span",{className:"s-message-embed-copy",children:[o.siteName&&r.jsx("span",{className:"s-message-embed-site",children:o.siteName}),r.jsx("span",{className:"s-message-embed-title",children:o.title}),o.description&&r.jsx("span",{className:"s-message-embed-description",children:o.description})]})]})}function wr({message:o}){const c=o.attachments??[],h=new Set,w=[],S=[];for(const u of c){const L=dt(u);if(L&&dr(u)){h.add(u.id),w.push({id:u.id,src:_t(L),alt:u.fileName??"Image attachment"});continue}const b=gr(u);b&&(h.add(u.id),S.push(b))}const F=new Set(S.map(u=>u.url)),z=new Set(c.map(dt).filter(u=>!!u));for(const u of hr(o.body))z.has(u)||F.has(u)||ur(u)&&w.push({id:u,src:_t(u),alt:"Embedded image"});const M=c.filter(u=>!h.has(u.id));return w.length===0&&S.length===0&&M.length===0?null:r.jsxs("div",{className:"s-message-embeds",children:[w.map(u=>r.jsx(fr,{src:u.src,alt:u.alt},u.id)),S.slice(0,1).map(u=>r.jsx(yr,{preview:u},u.id)),M.map(u=>{const L=dt(u),b=L?_t(L):null,d=u.fileName??K(u.metadata,"title")??u.mediaType;return b?r.jsxs("a",{className:"s-message-embed s-message-embed--file",href:b,target:"_blank",rel:"noreferrer",children:[r.jsx("span",{className:"s-message-embed-title",children:d}),r.jsx("span",{className:"s-message-embed-description",children:u.mediaType})]},u.id):r.jsxs("div",{className:"s-message-embed s-message-embed--file",children:[r.jsx("span",{className:"s-message-embed-title",children:d}),r.jsx("span",{className:"s-message-embed-description",children:u.mediaType})]},u.id)})]})}function Sr(o){const{sessionIds:c,active:h}=o,w=c.join("|"),S=h&&c.length>0,[F,z]=n.useState([]);return n.useEffect(()=>{z([])},[w]),n.useEffect(()=>{if(!S)return;let M=!1;const u=new URLSearchParams({limit:String(Va*3),transcripts:"true"});return _(`/api/tail/recent?${u.toString()}`).then(L=>{if(M)return;const b=(L.events??[]).filter(d=>Es(d,c));b.length!==0&&z(d=>Ls(d,b))}).catch(()=>{}),()=>{M=!0}},[S,w]),rr(M=>{S&&Es(M,c)&&z(u=>Ls(u,[M]))},S),n.useMemo(()=>S?za(F):[],[S,F])}const br=3500;function Ps(o){const c=o?.trim().replace(/^#/,"");if(!c?.startsWith("msg-"))return null;const h=c.slice(4).trim();if(!h)return null;try{return decodeURIComponent(h)}catch{return h}}const xr=64;function Tr(o){const c=o?.clientMessageId;return typeof c=="string"&&c.trim()?c.trim():null}function $s(o){const c=o.body.replace(/\s+/gu," ").trim();if(c)return c.length>180?`${c.slice(0,179).trimEnd()}…`:c;const h=o.attachments?.length??0;return h===1?"Attachment":h>1?`${h} attachments`:"Message"}function Fs(o,c){const h=o.toLocaleLowerCase().indexOf(c.toLocaleLowerCase());if(h<0)return o;const w=o.slice(0,h),S=o.slice(h+c.length);return!w&&S.startsWith(" ")?S.slice(1):w.endsWith(" ")&&S.startsWith(" ")?`${w}${S.slice(1)}`:`${w}${S}`}function vr(o){return o instanceof TypeError||typeof DOMException<"u"&&o instanceof DOMException&&o.name==="AbortError"}function Bo({conversationId:o,initialDraft:c,navigate:h,embedded:w,showBackNav:S=!0,treatment:F="standard"}){const{agents:z,route:M,openContextCapture:u}=zn(),L=qa(M),b=n.useMemo(()=>Gn(z,L),[z,L]),[d,ut]=n.useState(null),Kt=n.useRef(null);Kt.current=d;const He=n.useMemo(()=>it(o),[o]),[Os,qs]=n.useState(()=>He?{[o]:He}:{}),T=Os[o]??He??[],[Ds,Vt]=n.useState(()=>He!==null),xe=n.useRef(null),Bs=n.useMemo(()=>{const t=xe.current;return t===null?null:new Set(T.filter(e=>!t.has(e.id)).map(e=>e.id))},[T]),zt=xe.current===null&&T.length>0;n.useEffect(()=>{if(T.length===0)return;const t=xe.current??new Set;for(const e of T)t.add(e.id);xe.current=t},[T]),n.useEffect(()=>{xe.current=null,Vt(it(o)!==null)},[o]);const Gt=!Ds&&T.length===0,V=n.useCallback(t=>{qs(e=>{const s=e[o]??it(o)??[],a=typeof t=="function"?t(s):t,i=qn(o,a);return{...e,[o]:i}})},[o]),Us=Bt(o),[g,he]=n.useState(Us),[Te,ve]=n.useState([]),[We,mt]=n.useState(null),[_e,ke]=n.useState(null),[Qe,Hs]=n.useState(()=>typeof window>"u"?null:Ps(window.location.hash)),[Jt,pe]=n.useState(null),[ge,ht]=n.useState(!1),[Ws,Ce]=n.useState(!1),[pt,Ke]=n.useState(0),Ve=n.useRef(null),Me=n.useRef(null),Yt=n.useRef(null),Ne=n.useRef(!0),ze=n.useRef(!1),fe=n.useRef(null),R=n.useRef(null),Ie=n.useRef(new Set),Ae=n.useRef(null),Xt=n.useRef(0),Zt=n.useRef(null),je=n.useRef(null),se=n.useRef(o);se.current=o;const ne=n.useRef(new Map),_s=bs(o),Ge=n.useRef(!1);n.useLayoutEffect(()=>{const t=Me.current,e=Ve.current;!t||!e||(e.scrollTop=t.scrollTop+(e.scrollHeight-t.scrollHeight),Me.current=null,Ge.current=!0)}),n.useEffect(()=>{ht(!1),Me.current=null,Ge.current=!1,Ne.current=!0,ze.current=!1,Ce(!1),Ke(0),Et(new Set),ne.current.clear(),he(Bt(o))},[o]);const x=d?.agentId??null,C=d?.kind==="direct",gt=n.useMemo(()=>new Set([o,...d?.equivalentConversationIds??[]]),[o,d?.equivalentConversationIds]),Q=n.useMemo(()=>x?b.find(t=>t.id===x)??null:null,[b,x]),es=Yn(d),Qs=Xn({resolvedAgentId:Q?.id,sessionId:es,machineId:L}),[ts,ss]=n.useState(null);n.useEffect(()=>{_("/api/fleet").then(t=>{ss(e=>te(e,Ts(t.activeAsks,o,x)))}).catch(()=>{})},[o,x]);const B=n.useCallback(async(t={})=>{const e=t.messageMode??"none",s=t.includeMetadata??!0;pe(null);try{const a=s?await _(`/api/session/${encodeURIComponent(o)}`).catch(()=>null):Kt.current;if(se.current!==o)return;ut(k=>te(k,a));const i=a?.agentId??null,l=a?.id&&a.id!==o?a.id:o;if(l!==o){h({view:"conversation",conversationId:l});return}const m=it(l),A=Dn(l),f=e==="initial"&&!A,p=e==="refresh"||e==="initial",[y,U,j]=await Promise.all([f?Bn(l):p?Un(l,{refresh:!0}):Promise.resolve(m),_(`/api/flights?conversationId=${encodeURIComponent(l)}`),_("/api/fleet?limit=24&activityLimit=160").catch(()=>Zn())]);if(se.current!==o)return;const Z=be(y??[]),q=Z.filter(k=>!Ht(k));y&&V(k=>te(k,ea(k,q))),Vt(!0),Ba(l);const H=Z.at(-1);H&&je.current!==H.id&&(je.current=H.id,_(`/api/conversations/${encodeURIComponent(l)}/read-cursor`,{method:"POST",body:JSON.stringify({lastReadMessageId:H.id})}).catch(()=>{je.current===H.id&&(je.current=null)}));const W=ta(U),D=Bt(l),ee=W??D;Ie.current=new Set([...U.map(k=>k.invocationId),...D?.invocationId?.startsWith("pending:")?[]:D?.invocationId?[D.invocationId]:[]]),W&&D?.id===W.id&&xs(l,W.id);const rt=ee?.agentId??i??null,E=sa(j.activity,ee,l,rt),ot=na(j.activeAsks,ee,l,rt);he(k=>te(k,ee)),ve(k=>te(k,E)),ke(k=>te(k,ot)),ss(k=>te(k,Ts(j.activeAsks,l,i)))}catch(a){if(se.current!==o)return;pe(a instanceof Error?a.message:String(a))}},[o,h,V]);n.useEffect(()=>{B({messageMode:"initial"})},[B]),n.useEffect(()=>{je.current=null},[o]),n.useEffect(()=>{Ae.current=g},[g]);const Ks=n.useCallback(async()=>{if(ge||!bs(o))return;const t=Ve.current,e=t?{scrollHeight:t.scrollHeight,scrollTop:t.scrollTop}:null;ht(!0),pe(null);try{const s=await Hn(o);if(se.current!==o)return;e&&(Me.current=e),V(be(s).filter(a=>!Ht(a)))}catch(s){se.current===o&&pe(s instanceof Error?s.message:String(s))}finally{se.current===o&&ht(!1)}},[o,ge,V]),[N,O]=n.useState(()=>c??""),[ae,re]=n.useState(null),[G,Je]=n.useState(!1),[v,Vs]=n.useState("operator"),[oe,Re]=n.useState({open:!1,query:"",triggerStart:-1,index:0}),[ie,Ee]=n.useState({open:!1,query:"",triggerStart:-1,index:0}),[P,J]=n.useState(null),[ft,Ye]=n.useState(!1),[yt,Xe]=n.useState(""),[zs,Le]=n.useState(null),[Gs,wt]=n.useState(!1);n.useEffect(()=>{Ye(!1),Xe(""),Le(null),wt(!1)},[o]),n.useEffect(()=>{if(!c)return;const t=`${o}:${c}`;Zt.current!==t&&(Zt.current=t,O(c),requestAnimationFrame(()=>R.current?.focus()))},[o,c]);const le=n.useMemo(()=>{const t=new Map;for(const e of d?.participants??[])t.set(e.actorId,e),e.agentId&&t.set(e.agentId,e);return t},[d]),St=n.useMemo(()=>{const t=new Set,e=[];for(const s of d?.participantIds??[]){if(s==="operator")continue;const a=le.get(s),i=a?.scopedAlias?.trim().replace(/^@+/,"");if(!i)continue;const l=i.toLowerCase();t.has(l)||(t.add(l),e.push({id:s,label:a?.label??a?.displayName??i,name:a?.displayName??i,handle:i}))}for(const s of b){const a=s.handle?.trim().replace(/^@+/,"")??vs(s.id)??s.id;if(!a)continue;const i=a.toLowerCase();t.has(i)||(t.add(i),e.push({id:s.id,label:a,name:s.name??a,handle:a}))}return e.sort((s,a)=>s.handle.localeCompare(a.handle))},[le,b,d]),Js=n.useMemo(()=>{if(!oe.open)return[];const t=oe.query.toLowerCase();return t?ks.filter(e=>e.command.toLowerCase().startsWith("/"+t)||e.command.toLowerCase().includes(t)):ks},[oe.open,oe.query]),Ys=n.useMemo(()=>{if(!ie.open)return[];const t=ie.query.toLowerCase();return t?St.filter(e=>e.handle.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)).slice(0,8):St.slice(0,8)},[ie.open,ie.query,St]),Xs=n.useCallback(()=>{Re(t=>t.open?{...t,open:!1}:t),Ee(t=>t.open?{...t,open:!1}:t)},[]),Zs=n.useCallback((t,e)=>{const s=aa(t,e);Re(s?i=>({open:!0,query:s.query,triggerStart:s.start,index:i.open&&i.triggerStart===s.start?i.index:0}):i=>i.open?{...i,open:!1}:i);const a=ra(t,e);Ee(a?i=>({open:!0,query:a.query,triggerStart:a.start,index:i.open&&i.triggerStart===a.start?i.index:0}):i=>i.open?{...i,open:!1}:i)},[]),en=n.useCallback(t=>{const e=R.current,s=oe.triggerStart;if(s<0)return;const a=e?.selectionStart??N.length,i=N.slice(0,s),l=N.slice(a),m=t.insert,A=`${i}${m}${l}`;O(A),Re(f=>({...f,open:!1})),requestAnimationFrame(()=>{const f=R.current;if(!f)return;const p=i.length+m.length;f.focus(),f.setSelectionRange(p,p)})},[N,oe.triggerStart]),tn=n.useCallback(t=>{const e=R.current,s=ie.triggerStart;if(s<0)return;const a=e?.selectionStart??N.length,i=N.slice(0,s),l=N.slice(a),m=l.length===0||!l.startsWith(" "),A=`@${t.handle}${m?" ":""}`,f=`${i}${A}${l}`;O(f),Ee(p=>({...p,open:!1})),requestAnimationFrame(()=>{const p=R.current;if(!p)return;const y=i.length+A.length;p.focus(),p.setSelectionRange(y,y)})},[N,ie.triggerStart]);n.useEffect(()=>{const t=R.current;if(!t)return;t.style.height="0px";const e=Math.min(Math.max(t.scrollHeight,40),160);t.style.height=`${e}px`,t.style.overflowY=t.scrollHeight>e?"auto":"hidden"},[N]),n.useEffect(()=>{_("/api/user").then(t=>Vs(t.name)).catch(()=>{})},[]);const Ze=n.useMemo(()=>oa(T,v),[T,v]);n.useEffect(()=>{P===null||Ze===null||Ze>=P&&J(null)},[P,Ze]);const sn=n.useMemo(()=>ia(g),[g]),ye=Date.now(),nn=la(g,Ze,ye),bt=sn&&!ca(g)&&!nn,ns=C&&(G||P!==null||bt),as=C&&da({sending:G,awaitingResponse:P!==null,currentFlight:g}),$=ua({name:Q?.name,agentName:d?.agentName,id:x,title:d?.title}),I=n.useMemo(()=>C?ma({agentName:$,agentState:Q?.state??null,sending:G,currentFlight:g,showWorkingTurn:bt,awaitingResponse:P!==null}):{label:"Open",detail:"",tone:"idle",showStrip:!1,showTyping:!1},[Q?.state,$,P,g,ye,C,G,bt]),xt=g?.startedAt??_e?.startedAt??P,Tt=js(xt),rs=Ea(xt,ye),[,an]=n.useState(0);n.useEffect(()=>{if(!I.showTyping||Tt===null)return;const t=Math.max(0,Date.now()-Tt),e=[Is.sustained,Is.long].find(a=>a>t);if(e===void 0)return;const s=window.setTimeout(()=>an(a=>a+1),e-t+50);return()=>window.clearTimeout(s)},[Tt,I.showTyping,rs]);const rn="Live",vt=n.useMemo(()=>ha({currentFlight:g,presence:I,turnActivity:Te,turnAsk:_e,awaitingResponseSince:P,nowMs:ye}),[P,g,ye,I,Te,_e]),on="s-thread-msg-card s-thread-msg-working-card s-thread-msg-card--avatar-row",ln="s-thread-msg-kind",cn="s-thread-turn-snapshot",dn="s-thread-turn-snapshot-pulse",un="s-thread-presence-line",mn=["s-thread-presence-strip",`s-thread-presence-strip--${rs}`].filter(Boolean).join(" "),kt=d?pa(d):$,os=d?.id??o,hn=d?.alias?.trim()||null,et=ga(d?.workspaceRoot),pn=I.tone,Ct=T.length===0&&C&&(I.showTyping||g!==null||Te.length>0||_e!==null||P!==null),is=n.useMemo(()=>d?d.participantIds.includes("operator"):C,[C,d]),Pe=g?.agentId??x,$e=Pe?Cs(b,[Pe]):null,Fe=$e?.id??Pe,Oe=g?.sessions.at(-1)?.sessionId??$e?.harnessSessionId??void 0,ls=g?.id?()=>{ct(h,{view:"sessions",flightId:g.id,...Fe?{agentId:Fe}:{},...Oe?{sessionId:Oe}:{},...L?{machineId:L}:{}},{returnTo:M})}:void 0,cs=g?.id??null;n.useEffect(()=>{if(!cs||!Fe){mt(null);return}let t=!1;const e=Oe?`?sessionId=${encodeURIComponent(Oe)}`:"",s=async()=>{try{const i=await _(`/api/agents/${encodeURIComponent(Fe)}/observe${e}`);if(t)return;mt(l=>te(l,i))}catch{}};s();const a=window.setInterval(()=>{s()},br);return()=>{t=!0,window.clearInterval(a),mt(null)}},[cs,Fe,Oe]);const Mt=n.useMemo(()=>Ga({flight:g,agent:$e??Q,sessionMeta:d,observeSessionId:We?.sessionId}),[Q,g,d,We?.sessionId,$e]),ds=Sr({sessionIds:Mt,active:I.showTyping||Ct}),gn=n.useMemo(()=>Ja({observe:We,flight:g}),[g,We]),Y=ds.length>0?ds:gn,Nt=n.useMemo(()=>Y.length>0?null:Ya({flight:g,hasSessionScope:Mt.length>0,awaitingResponse:P!==null}),[P,g,Mt.length,Y.length]),It=Xa(Y),At=Za(Y),us=Y.at(-1)??null,jt=us?Ut(us.ts,ye):null,ce=n.useMemo(()=>At?{...vt,latest:At,...It?{activityLabel:It}:{},...jt?{lastActivityLabel:jt}:{}}:vt,[jt,At,vt,It]),fn=`${$}: ${ce.latest}`,ms=Pe&&fa($e)?()=>{ct(h,{view:"terminal",agentId:Pe,mode:"takeover"},{returnTo:M})}:void 0,Rt=C?()=>{w&&Da({type:"focus-composer",reason:"Steer the active conversation"})||requestAnimationFrame(()=>{R.current?.focus({preventScroll:!0}),R.current?.scrollIntoView({block:"nearest"})})}:void 0,yn=n.useMemo(()=>(d?d.participantIds.filter(e=>e!=="operator"):x?[x]:[]).map(e=>{const s=Cs(b,[e]),a=le.get(e);return{id:e,name:a?.scopedAlias??s?.name??a?.displayName??vs(e)??e,title:a?.label??s?.id??e,agent:s,sessionId:a?.sessionId??null,harness:s?.harness??a?.harness??null,model:s?.model??null,reasoningEffort:s?.reasoningEffort??null}}),[x,le,b,d]),wn=n.useMemo(()=>({name:v,active:is}),[is,v]),tt=n.useMemo(()=>new Map(T.map(t=>[t.id,t])),[T]),st=n.useMemo(()=>ya(T),[T]),[Sn,Et]=n.useState(()=>new Set),bn=n.useCallback(t=>{Et(e=>{const s=new Set(e);return s.delete(t)||s.add(t),s})},[]),hs=n.useMemo(()=>{const t=new Map;for(const e of st)if(e.kind==="fanout")for(const s of e.messages)t.set(s.id,e.key);return t},[st]),nt=n.useCallback(t=>{const e=hs.get(t);e&&Et(l=>l.has(e)?l:new Set(l).add(e));const s=document.getElementById(`msg-${t}`);if(!s)return;const a=s.closest(".s-thread-fanout")??s,i=a===s?"s-thread-msg--flash":"s-thread-fanout--flash";a.scrollIntoView({behavior:"smooth",block:"center"}),a.classList.add(i),window.setTimeout(()=>a.classList.remove(i),1200)},[hs]);n.useEffect(()=>{const t=()=>Hs(Ps(window.location.hash));return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)},[]),n.useEffect(()=>{if(!Qe||!tt.has(Qe))return;const t=window.setTimeout(()=>nt(Qe),50);return()=>window.clearTimeout(t)},[Qe,tt,nt]),Fa(n.useCallback(t=>{if(t.kind==="message.posted"){const e=t.payload?.message;if(!e||!gt.has(e.conversationId))return;const s=e.actorId==="operator",a=C&&!s&&e.class==="agent",i={id:e.id,conversationId:e.conversationId,actorId:e.actorId,actorName:a?$:wa(e.actorId,b,v),body:e.body,createdAt:e.createdAt,class:s?"operator":e.class,attachments:e.attachments,metadata:e.metadata,replyToMessageId:e.replyToMessageId??e.n??null};if(Ht(i))return;if(V(l=>{const m=Tr(e.metadata),A=m?ne.current.get(m):void 0;if(l.some(f=>f.id===e.id))return m&&ne.current.delete(m),l;if(s&&m){const f=Sa(l,m,A);if(f!==-1){const p=[...l];return p[f]=i,ne.current.delete(m),be(p)}}return be([...l,i])}),a){const l=js(e.createdAt)??Date.now();J(m=>m===null||l<m||ba(Ae.current)?m:null),he(m=>xa(m)?null:m)}return}if(t.kind==="invocation.requested"){const e=t.payload?.invocation;if(!e||e.targetAgentId!==x||!e.conversationId||!gt.has(e.conversationId))return;Ie.current.add(e.id),ve([]),ke(null),J(s=>s??Date.now());return}if(t.kind==="flight.updated"){const e=t.payload?.flight;if(!e||e.targetAgentId!==x||!(Ie.current.has(e.invocationId)||Ae.current?.id===e.id))return;if(Ta.has(e.state)){xs(o,e.id),he(l=>l?.id===e.id?null:l),ve([]),ke(null),J(null),B({messageMode:"refresh",includeMetadata:!1});return}Ie.current.add(e.invocationId);const a=Ae.current?.id===e.id,i=Ms(e,o,x??"",Ae.current);va(i)&&J(null),he(i),a||(ve([]),ke(null));return}t.kind!=="agent.endpoint.upserted"&&t.kind==="unknown"&&B({messageMode:"refresh"})},[x,$,o,gt,C,B,v,b])),n.useEffect(()=>{if(!ns)return;const t=setInterval(()=>{B({messageMode:"refresh",includeMetadata:!1})},5e3);return()=>clearInterval(t)},[ns,B]),n.useEffect(()=>{const t=()=>{if(document.visibilityState!=="visible")return;const e=Date.now();e-Xt.current<1e3||(Xt.current=e,B({messageMode:"refresh"}))};return window.addEventListener("focus",t),document.addEventListener("visibilitychange",t),()=>{window.removeEventListener("focus",t),document.removeEventListener("visibilitychange",t)}},[B]);const Lt=n.useRef(null),ps=n.useRef(!1),Pt=n.useRef(!1),$t=n.useCallback(t=>{const e=Yt.current;e&&(ze.current=!0,fe.current!==null&&clearTimeout(fe.current),e.scrollIntoView({behavior:t}),fe.current=setTimeout(()=>{ze.current=!1,fe.current=null},t==="smooth"?700:0))},[]);n.useEffect(()=>()=>{fe.current!==null&&clearTimeout(fe.current)},[]);const xn=n.useCallback(()=>{const t=Ve.current;if(!t||ze.current)return;const s=t.scrollHeight-t.clientHeight-t.scrollTop<=xr;Ne.current=s,s?(Ce(!1),Ke(0)):Ce(!0)},[]),Tn=n.useCallback(()=>{Ne.current=!0,Ce(!1),Ke(0),$t("smooth")},[$t]);n.useEffect(()=>{const t=T.at(-1)?.id??null,e=!!(t&&t!==Lt.current),s=ka({newestMessageId:t,previousNewestMessageId:Lt.current,showTyping:I.showTyping,previousShowTyping:ps.current,historyRestorePending:Ge.current||Me.current!==null,initialScrollDone:Pt.current,nearBottom:Ne.current});s!=="none"?($t(s),Pt.current=!0):e&&Pt.current&&!Ne.current&&(Ce(!0),Ke(a=>a+1)),Ge.current=!1,Lt.current=t,ps.current=I.showTyping});const[,vn]=n.useState(0);n.useEffect(()=>{const t=setInterval(()=>vn(e=>e+1),15e3);return()=>clearInterval(t)},[]);const de=Kn(),[ue,X]=n.useState([]),[gs,at]=n.useState("queue"),[we,Se]=n.useState(null),qe=async(t,e)=>{const s=t.trim(),a=e?.attachments??[],i=e?.replyTarget??null;if(!s&&a.length===0||G)return"failed";const m=e?.forceAction??As({isDm:C,hasOutstandingReply:as}),A=Date.now(),f=_n(),p={id:`optimistic-${f}`,conversationId:o,actorId:"operator",actorName:v,body:s,createdAt:A,class:"operator",...i?{replyToMessageId:i.messageId}:{},metadata:{clientMessageId:f,deliveryState:"sending"},...a.length>0?{attachments:a}:{}};Je(!0),m!=="message"&&J(A),pe(null),ne.current.set(f,p.id),V(y=>be([...y,p]));try{const y=await _(`/api/chats/${encodeURIComponent(o)}/messages`,{method:"POST",body:JSON.stringify({body:s,clientMessageId:f,...i?{replyToMessageId:i.messageId}:{},...a.length>0?{attachments:a}:{}})}),U=y.chatId?.trim()??y.conversationId?.trim();if(U&&U!==o)throw new Error(`Send returned a different Chat (${U}) instead of appending to ${o}.`);if(y.messageId?.trim()){const j=y.messageId.trim();V(Z=>be(Z.map(q=>q.id===p.id?{...q,id:j,metadata:{clientMessageId:f}}:q))),ne.current.delete(f)}return y.flight?(Ie.current.add(y.flight.invocationId),he(Ms(y.flight,o,x??"")),ve([]),ke(null)):m!=="message"&&J(null),"sent"}catch(y){return vr(y)?(V(U=>U.map(j=>j.id===p.id?{...j,metadata:{...j.metadata??{},deliveryState:"unknown"}}:j)),"unknown"):(V(U=>U.filter(j=>j.id!==p.id)),ne.current.delete(f),J(null),pe(y instanceof Error?y.message:String(y)),"failed")}finally{Je(!1)}},kn=async()=>{const t=N.trim(),e=ae,s=de.files,a=we?.attachments??[];if(!t&&s.length===0&&a.length===0)return null;let i=[];if(s.length>0){Je(!0);try{i=await Qn(s)}catch(l){return de.setError(l instanceof Error?l.message:String(l)),null}finally{Je(!1)}}return O(""),re(null),de.clear(),Se(null),{body:t,attachments:[...a,...i],replyTarget:e}},Cn=async()=>{const t=Pa({isAgentBusy:me,intent:gs}),e=we?.id??null,s=await kn();if(!s)return;if(t==="queue"){X(l=>e?l.map(m=>m.id===e?{...m,body:s.body,attachments:s.attachments,replyTarget:s.replyTarget}:m):[...l,{id:`queued-${Date.now()}-${l.length}`,body:s.body,attachments:s.attachments,replyTarget:s.replyTarget,queuedAt:Date.now()}]);return}e&&X(l=>l.filter(m=>m.id!==e));const a=()=>{O(s.body),Se(s.attachments.length>0?{id:null,attachments:s.attachments}:null),re(s.replyTarget),requestAnimationFrame(()=>R.current?.focus())};if(t==="steer"){at("queue"),await qt(),await qe(s.body,{forceAction:"steer",attachments:s.attachments,replyTarget:s.replyTarget})==="failed"&&a();return}await qe(s.body,{attachments:s.attachments,replyTarget:s.replyTarget})==="failed"&&a()},Mn=t=>{X(e=>e.filter(s=>s.id!==t)),Se(e=>e?.id===t?null:e)},Nn=t=>{const e=ue.find(s=>s.id===t);e&&(O(e.body),re(e.replyTarget??null),Se({id:t,attachments:e.attachments}),requestAnimationFrame(()=>{const s=R.current;s&&(s.focus(),s.setSelectionRange(s.value.length,s.value.length))}))},In=()=>{Se(null),O(""),re(null),de.clear()},An=async t=>{const e=ue.find(a=>a.id===t);if(!e)return;X(a=>a.filter(i=>i.id!==t)),await qt(),await qe(e.body,{forceAction:"steer",attachments:e.attachments,replyTarget:e.replyTarget??null})==="failed"&&X(a=>[e,...a])},Ft=n.useCallback((t,e)=>{const s=e?.trim().replace(/^@+/,"")||null,a=s?`@${s}`:null,i=ae?.insertedMention?Fs(N,ae.insertedMention):N,l=!!(!C&&a&&!i.toLocaleLowerCase().includes(a.toLocaleLowerCase())),m=l&&a?i.trim()?`${i.trimEnd()} ${a} `:`${a} `:i;O(m),re({messageId:t.id,actorLabel:s?`@${s}`:t.actorName,preview:$s(t),insertedMention:l?a:null}),requestAnimationFrame(()=>R.current?.focus())},[N,C,ae?.insertedMention]),jn=n.useCallback(()=>{const t=ae?.insertedMention;re(null),t&&O(e=>Fs(e,t)),requestAnimationFrame(()=>R.current?.focus())},[ae]),Ot=n.useCallback(t=>{const e=new URL(window.location.href);M.view==="agents-v2"&&e.searchParams.set("tab","message"),e.hash=`msg-${t}`,Be(e.toString())},[M.view]),fs=n.useCallback((t,e,s)=>{const a=Wn({conversationId:o,selectedMessageId:t.id,messages:T.map(i=>({id:i.id,actorLabel:i.id===t.id?e:lt(i,v)?v:i.actorName,body:i.body,attachmentCount:i.attachments?.length??0}))});u({intent:"forward-message",forwardContext:a,forwardContextMode:"selected-message",...s?{projectPath:s}:{}})},[o,T,u,v]),qt=async()=>{if(x)try{await _("/api/agents/"+encodeURIComponent(x)+"/interrupt",{method:"POST",body:JSON.stringify({})})}catch{}},me=I.tone==="working"||I.tone==="pending",Rn=As({isDm:C,hasOutstandingReply:as}),En=C?`Message ${$} — type / to route or @ to mention an agent`:d?.kind==="channel"?`Comment in #${Ca(d)} — mention @agent to request a reply`:`Comment in ${kt} — mention @agent to request a reply`,ys=we?.attachments??[],Ln=!N.trim()&&!de.hasFiles&&ys.length===0&&me,Dt=n.useRef(!1);n.useEffect(()=>{const t=we?.id??null,e=t?ue.filter(a=>a.id!==t):ue;if(!Ma({isAgentBusy:me,sending:G,queued:e})||Dt.current)return;const s=e[0];s&&(Dt.current=!0,X(a=>a.filter(i=>i.id!==s.id)),qe(s.body,{attachments:s.attachments,replyTarget:s.replyTarget??null}).then(a=>{a==="failed"&&X(i=>[s,...i])}).finally(()=>{Dt.current=!1}))},[me,G,ue,we]),n.useEffect(()=>{me||at("queue")},[me]),n.useEffect(()=>{X([]),Se(null),re(null),at("queue"),de.clear()},[o]);const Pn=Na(ue),ws=Jn(),$n=n.useCallback((t,e)=>{const s=window.getSelection()?.toString().trim(),a=lt(e,v),i=e.actorId?le.get(e.actorId):null,l=a?null:Ns(e,b,x),m=(i?.scopedAlias?.trim()||l?.handle?.trim()||null)?.replace(/^@+/,"")??null,A=m?`@${m}`:e.actorName,f=(l?.id||i?.agentId||e.actorId||"").trim(),p=[];a||p.push({kind:"action",label:"Reply",onSelect:()=>Ft(e,m)}),p.push({kind:"action",label:"Forward to new task…",onSelect:()=>fs(e,A,i?.workspaceRoot??l?.projectRoot??l?.cwd??void 0)}),p.push({kind:"separator"}),s&&p.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>{Be(s)}}),p.push({kind:"action",label:"Copy Message",onSelect:()=>{Be(e.body)}}),p.push({kind:"action",label:"Copy Link",onSelect:()=>Ot(e.id)}),p.push({kind:"separator"}),!a&&f&&p.push({kind:"action",label:"Copy Agent ID",onSelect:()=>{Be(f)}}),p.push({kind:"action",label:"Copy Message ID",onSelect:()=>{Be(e.id)}}),ws(t,p)},[x,Ft,Ot,fs,v,le,b,ws]),Fn=async(t,e)=>{const s=`@${e.agentId} `,a=N.trim();if(a){O(""),await qe(`${s}${a}`,{forceAction:"invoke"});return}O(s),R.current?.focus()},De=n.useMemo(()=>{if(!d)return[];const t=new Set(d.participantIds);return b.filter(e=>!t.has(e.id)&&!e.retiredFromFleet).sort((e,s)=>e.name.localeCompare(s.name))},[d,b]);n.useEffect(()=>{ft&&Xe(t=>t&&De.some(e=>e.id===t)?t:De[0]?.id??"")},[ft,De]);const Ss=!!(d&&["direct","group_direct","channel"].includes(d.kind)&&De.length>0),On=n.useCallback(async()=>{if(!d)return;const t=yt.trim();if(t){wt(!0),Le(null);try{const e=await _(`/api/conversations/${encodeURIComponent(d.id)}/members`,{method:"POST",body:JSON.stringify({actorId:t})});e.session?ut(e.session):ut(s=>s&&{...s,kind:e.kind,participantIds:e.participantIds}),Ye(!1),Xe(""),await B({messageMode:"none"})}catch(e){Le(e instanceof Error?e.message:String(e))}finally{wt(!1)}}},[yt,B,d]);return r.jsx("div",{className:`s-thread-layout${w?" s-thread-layout--embedded":""}`,"data-thread-treatment":F==="standard"?void 0:F,children:r.jsxs("div",{className:"s-thread-center",children:[!w&&r.jsx(Ha,{showBackNav:S,isDm:C,navigate:h,route:M,canonicalConversationId:os,threadTitle:kt,agentId:Q?.id??null,sessionId:es,detailRoute:Qs,participants:yn,operator:wn,canAddParticipants:Ss,onToggleAddParticipant:()=>{Le(null),Ye(t=>!t)}}),!w&&d&&r.jsx(Wa,{canonicalConversationId:os,conversationAlias:hn}),!w&&ft&&Ss&&r.jsx(_a,{agents:De,addParticipantId:yt,setAddParticipantId:Xe,addingParticipant:Gs,addParticipantError:zs,onCancel:()=>{Ye(!1),Le(null)},onSubmit:()=>{On()}}),ts&&r.jsx(or,{pinnedAsk:ts,onAnswer:()=>{R.current?.focus()},onSteer:Rt}),r.jsx(ir,{presence:I,agent:Q}),Jt&&r.jsx("p",{className:"s-thread-error",children:Jt}),r.jsxs("div",{className:"s-thread-feed",ref:Ve,onScroll:xn,children:[!Gt&&T.length>0&&_s&&r.jsx("div",{className:"s-thread-history-control",children:r.jsxs("button",{type:"button",className:"s-thread-history-button",disabled:ge,"aria-busy":ge,onClick:()=>{Ks()},children:[ge&&r.jsx("span",{className:"s-thread-history-spinner","aria-hidden":"true"}),ge?"Loading earlier messages…":"Load earlier messages"]})}),Gt?r.jsx(er,{}):T.length===0?Ct?r.jsx(tr,{agentName:$,title:I.label,detail:I.detail||ce.latest,snapshot:ce,events:Te,steps:Y,phase:Nt,tone:pn,workspaceName:et,branch:d?.currentBranch,startedAt:xt,onOpenTrace:ls,onOpenTerminal:ms,onSteer:Rt}):r.jsxs("div",{className:"s-thread-empty",children:[r.jsx("div",{className:"s-thread-empty-glyph","aria-hidden":"true",children:C?"@":"#"}),r.jsx("p",{children:kt}),r.jsx("p",{children:C?"No messages yet. Send a message to start working with this agent.":"No messages yet. Start the conversation below."}),(et||d?.currentBranch)&&r.jsxs("div",{className:"s-thread-empty-chips",children:[et&&r.jsx("span",{className:"s-thread-empty-chip",children:et}),d?.currentBranch&&r.jsx("span",{className:"s-thread-empty-chip",children:d.currentBranch})]})]}):st.map((t,e)=>{const s=Ia(t,e);if(t.kind==="fanout")return r.jsx(Qa,{row:t,expanded:Sn.has(t.key),showDayDivider:s,onToggle:()=>bn(t.key)},t.key);const a=t.message,i=lt(a,v),l=Aa(a),m=l?"scout.dispatch":a.class,A=La(m),f=m==="status",p=Rs(a.createdAt),y=i?null:Ns(a,b,x),j=le.get(a.actorId)?.scopedAlias?.trim()||null,Z=!i&&j?j:a.actorName,q=i?v.toLowerCase():j??y?.handle??null,H=ja(a.body),W=H?Ra({flightId:H.flightId,replyToMessageId:a.replyToMessageId,messagesById:tt,agents:b,operatorName:v}):null,D=!H&&a.replyToMessageId?tt.get(a.replyToMessageId)??null:null,ee=D?lt(D,v)?v:D.actorName:null,rt=H?H.body:a.body;return r.jsxs("div",{className:["s-thread-feed-block",i&&"s-thread-feed-block--you",s&&"s-thread-feed-block--full-width"].filter(Boolean).join(" "),children:[s&&r.jsx(Ka,{at:a.createdAt}),r.jsx("article",{id:`msg-${a.id}`,className:["s-thread-msg",i&&"s-thread-msg--you",f&&"s-thread-msg--tool",(zt||Bs?.has(a.id))&&"s-thread-msg--enter"].filter(Boolean).join(" "),style:zt?{animationDelay:`${Math.max(0,7-(st.length-1-e))*26}ms`}:void 0,"data-class":m,onContextMenu:E=>$n(E,a),children:r.jsx("div",{className:"s-thread-msg-card",children:r.jsxs("div",{className:"s-thread-msg-card-content",children:[r.jsxs("div",{className:"s-thread-msg-header",children:[r.jsxs("div",{className:"s-thread-msg-meta",children:[(()=>{const E=!i&&y?()=>ct(h,{view:"agents-v2",agentId:y.id},{returnTo:M}):null,ot=i?v:Z??"?",k=r.jsx(Wt,{agent:y??void 0,name:ot,placement:"turn",size:28,className:"s-thread-msg-avatar",title:ot});return E?r.jsx("button",{type:"button",className:"s-thread-msg-avatar--nav",onClick:E,"aria-label":`View profile for ${a.actorName??"agent"}`,title:`View profile for ${a.actorName??"agent"}`,children:k}):k})(),!i&&y?r.jsx("button",{type:"button",className:"s-thread-msg-actor s-thread-msg-actor--nav",onClick:()=>ct(h,{view:"agents-v2",agentId:y.id},{returnTo:M}),title:`View profile for ${a.actorName}`,children:Z}):r.jsx("span",{className:"s-thread-msg-actor",children:i?v:Z}),q&&r.jsxs("span",{className:"s-thread-msg-handle",children:["@",q]}),A&&r.jsx("span",{className:"s-thread-msg-kind",children:A})]}),r.jsx("span",{className:"s-thread-msg-time",title:p,children:Ut(a.createdAt)}),r.jsxs("span",{className:"s-thread-msg-actions",children:[!i&&q&&r.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":`Reply to @${q}`,title:`Reply to @${q}`,onClick:()=>Ft(a,q),children:r.jsx(Qt,{})}),r.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":"Copy link to message",title:"Copy link to message",onClick:()=>Ot(a.id),children:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M6.5 9.5a2.5 2.5 0 0 0 3.54 0l2.12-2.12a2.5 2.5 0 0 0-3.54-3.54l-.7.7"}),r.jsx("path",{d:"M9.5 6.5a2.5 2.5 0 0 0-3.54 0L3.84 8.62a2.5 2.5 0 0 0 3.54 3.54l.7-.7"})]})})]})]}),W&&r.jsxs("button",{type:"button",className:"s-thread-reply-ctx",title:`Open the originating request${W.flightId?` · ${W.flightId}`:""}`,onClick:()=>nt(W.originatingMessageId),children:[r.jsx(Qt,{}),r.jsx("span",{className:"s-thread-reply-ctx-label",children:"reply to"}),r.jsx("span",{className:"s-thread-reply-ctx-title",children:W.title}),r.jsxs("span",{className:"s-thread-reply-ctx-from",children:["· ",W.from]}),r.jsx("span",{className:"s-thread-reply-ctx-status",children:"· done"})]}),D&&ee&&r.jsxs("button",{type:"button",className:"s-thread-reply-ctx",title:`Open message from ${ee}`,onClick:()=>nt(D.id),children:[r.jsx(Qt,{}),r.jsx("span",{className:"s-thread-reply-ctx-label",children:"reply to"}),r.jsx("span",{className:"s-thread-reply-ctx-title",children:$s(D)}),r.jsxs("span",{className:"s-thread-reply-ctx-from",children:["· ",ee]})]}),r.jsx("div",{className:"s-thread-msg-body",title:p,children:r.jsx(Oa,{text:rt})}),r.jsx(wr,{message:a}),l&&l.candidates.length>0&&r.jsx("div",{className:"s-thread-dispatch",children:l.candidates.map(E=>r.jsxs("button",{type:"button",className:"s-thread-dispatch-tile",onClick:()=>{Fn(l,E)},children:[r.jsxs("span",{className:"s-thread-dispatch-tile-id",children:["@",E.agentId]}),r.jsx("span",{className:"s-thread-dispatch-tile-state",children:E.endpointState}),r.jsx("span",{className:"s-thread-dispatch-tile-meta",children:[E.workspace,E.node,E.projectRoot].filter(Boolean).join(" · ")||E.displayName})]},E.agentId))})]})})})]},a.id)}),I.showTyping&&!Ct&&r.jsx("div",{className:"s-thread-feed-block",children:r.jsx("div",{className:"s-thread-msg","aria-live":"polite",children:r.jsxs("div",{className:on,children:[r.jsx(Wt,{agent:Q??void 0,name:$,placement:"turn",size:28,className:"s-thread-msg-avatar s-thread-msg-avatar--working",title:$}),r.jsxs("div",{className:"s-thread-msg-card-content",children:[r.jsxs("div",{className:"s-thread-msg-header",children:[r.jsxs("div",{className:"s-thread-msg-meta",children:[r.jsx("span",{className:"s-thread-msg-actor",children:$}),r.jsx("span",{className:ln,children:rn})]}),r.jsx("span",{className:"s-thread-msg-time",title:g?.startedAt?Rs(g.startedAt):"now",children:g?.startedAt?Ut(g.startedAt):"now"})]}),r.jsxs("div",{className:"s-thread-msg-working-body",children:[r.jsxs("div",{className:cn,children:[r.jsx("span",{className:dn,"aria-hidden":"true"}),r.jsxs("div",{className:"s-thread-turn-snapshot-main",children:[r.jsx("span",{className:"s-thread-turn-snapshot-label",children:"Latest"}),r.jsx("span",{className:"s-thread-msg-working-copy",children:ce.latest})]})]}),r.jsxs("dl",{className:"s-thread-turn-snapshot-stats",children:[r.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[r.jsx("dt",{children:"Activity"}),r.jsx("dd",{children:ce.activityLabel})]}),r.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[r.jsx("dt",{children:"Elapsed"}),r.jsx("dd",{children:ce.elapsedLabel})]}),r.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[r.jsx("dt",{children:"Last"}),r.jsx("dd",{children:ce.lastActivityLabel})]})]}),Y.length>0||Nt?r.jsx(sr,{steps:Y,phase:Nt,limit:5,compact:!0}):r.jsx(nr,{events:Te,limit:4,compact:!0}),r.jsx(ar,{onOpenTrace:ls,onOpenTerminal:ms,onSteer:Rt,compact:!0})]})]})]})})}),Ws&&pt>0&&r.jsxs("button",{type:"button",className:"s-thread-new-messages",onClick:Tn,children:[r.jsx("span",{"aria-hidden":"true",children:"↓"})," ",pt," new ",pt===1?"message":"messages"," · jump to latest"]}),r.jsx("div",{ref:Yt})]}),I.showTyping&&r.jsxs("div",{className:un,children:[r.jsx("div",{className:"s-thread-presence-line-avatars",children:r.jsx(Wt,{agent:Q??void 0,name:$,placement:"turn",size:22,className:"s-thread-presence-line-avatar",title:$})}),r.jsx("span",{className:"s-thread-presence-line-label",children:fn}),r.jsx("div",{className:mn,"aria-hidden":"true"})]}),r.jsx(Vn,{composeRef:R,draft:N,setDraft:O,composePlaceholder:En,slashState:oe,setSlashState:Re,filteredSlashCommands:Js,applySlashCommand:en,mentionState:ie,setMentionState:Ee,filteredMentions:Ys,applyMention:tn,updateTriggersFromDraft:Zs,closeSuggestions:Xs,replyTarget:ae,onCancelReply:jn,isStopMode:Ln,sending:G,composeAction:Rn,onSend:()=>{Cn()},onInterrupt:()=>{qt()},attachments:de,isAgentBusy:me,busyIntent:gs,onBusyIntentChange:at,queued:ue,queueNote:Pn,onEditQueued:Nn,editingQueuedId:we?.id??null,editingAttachmentCount:ys.length,onCancelEdit:In,onUnqueue:Mn,onSendQueuedNow:t=>{An(t)}})]})})}function Qt(){return r.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("polyline",{points:"9 14 4 9 9 4"}),r.jsx("path",{d:"M20 20v-7a4 4 0 0 0-4-4H4"})]})}const Uo=Ua({id:"thread",label:"Thread",route:{view:"conversation",conversationId:""},webPath:"/chat",screen:"ConversationScreen",embed:{path:"/embed/thread",profile:"macos.thread",rootClassName:"s-thread-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},hosts:{macos:!0},resolveEmbedProps:$a}});export{Bo as ConversationScreen,Uo as scoutSurface};
1
+ import{j as r,r as n}from"./index-NRbRrZw-.js";import{k as it,w as qn,l as Bt,m as bs,o as Dn,q as Bn,s as Un,t as xs,u as Hn,v as Wn,x as _n,y as Qn}from"./NewChatComposer-BPsg8shF.js";import{a as _}from"./api-DEHEgJ9m.js";import"./text-B2UZi3l9.js";import{u as Kn,C as Vn}from"./ConversationComposer-DPWu3HvK.js";import"./index-CD2foMB8.js";import{u as zn,c as Gn,a as Jn}from"./Provider-Cd-QZltN.js";import{h as Yn,j as Xn,v as te,y as Ts,z as Zn,A as be,B as ea,D as ta,E as sa,F as na,c as vs,S as ks,G as aa,H as ra,I as oa,J as ia,K as la,L as ca,M as da,k as ua,N as ma,O as ha,q as pa,s as ga,r as Cs,P as fa,Q as ya,R as wa,T as Sa,l as ba,U as xa,V as Ta,W as Ms,X as va,Y as ka,Z as lt,g as Ca,_ as Ma,$ as Na,a0 as Ns,a1 as Ia,a2 as Aa,a3 as ja,a4 as Ra,a5 as Is,a6 as Ea,a7 as As,a8 as La,a9 as Pa,aa as $a}from"./conversation-model-CIzM7aXT.js";import{u as Fa}from"./sse-QSbhyq9A.js";import{t as Ut,n as js,f as Rs}from"./time-Dhsh_2EG.js";import{M as Oa}from"./message-markup-BP2nH9kQ.js";import{i as Ht}from"./message-visibility-kJM8XcSG.js";import{d as qa}from"./router-Bx1tiwVe.js";import{f as Da}from"./scoutbot-D4vuKzOL.js";import{s as Ba}from"./sessionRead-CvFz2RHv.js";import{o as ct}from"./openContent-C6XO6kr5.js";import{c as Be}from"./clipboard-e3fSpeo7.js";import{A as Wt}from"./AgentAvatar-CQqJcwOQ.js";import{d as Ua}from"./types-B0PlfpKc.js";/* empty css */import{ConversationHeader as Ha,ConversationIdentityRow as Wa,AddParticipantForm as _a}from"./ConversationHeader-Ce7TENb9.js";import{FanOutRow as Qa,ThreadDayDivider as Ka}from"./ConversationFeedRows-MhcPfxUr.js";import{T as Va,t as Es,m as Ls,a as za,b as Ga,o as Ja,d as Ya,s as Xa,l as Za,c as er,e as tr,W as sr,f as nr,g as ar}from"./ConversationPanels-D-b5SLO-.js";import{u as rr}from"./tail-events-B7BrDaFi.js";import{PinnedAskCard as or,ConversationStatusStrip as ir}from"./ConversationStatus-lIvSKRic.js";import"./HarnessMark-CEzmPFHC.js";import"./colors-BtO5_zlx.js";import"./NewChatOrigin-CCiPg_WR.js";import"./keyboard-nav-feLCB3Zm.js";import"./x-DuzAbpk5.js";import"./createLucideIcon-Da0lq809.js";import"./chevron-down-Jh540uf3.js";import"./search-HmdKXdtR.js";import"./loader-circle-Be0T8xv2.js";import"./file-text-BGVkHS4_.js";import"./scout-voice-BT3gYDhU.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./zap-CocRNtyr.js";import"./provider-Bq0ScH3v.js";import"./surface-activity-B1rgWB1i.js";import"./DocumentFocusViewer-CetjnYut.js";import"./TextDocumentSurface-B29xZNlI.js";import"./chevron-right-CV7sEVBS.js";import"./code-xml-CPzpZkhu.js";import"./arrow-left-B0CdJdAC.js";import"./arrow-right-YRBoTTyf.js";import"./chunk-HRAB3GC3-BYQZ1LOn.js";import"./index-BWHgHrtv.js";import"./mentions-KNASbAjG.js";import"./AgentDetailCard-2DZQahiN.js";import"./AgentLiveActions-BmXDRxER.js";import"./terminal-takeover-BArLfNtd.js";import"./eye-B908WSFH.js";import"./terminal-DNZTCr6a.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-D4dHTRkt.js";import"./SpriteAvatar-vpHO-rXs.js";import"./agent-identity-CIMT7oV6.js";import"./BackToPicker-CXsbxbHM.js";import"./AstronautSuit-C05Ezxl9.js";import"./tail-display-DcliDVkW.js";import"./lane-edit-display-C_Aujldz.js";import"./use-reduced-motion-0fAsybdo.js";import"./proxy-DtC2iXnT.js";import"./activity-DTqqWiyV.js";import"./message-circle-2v9Udia0.js";import"./check-BdovFDz8.js";import"./sparkles-CgTby-ap.js";const lr=/\.(?:apng|avif|gif|jpe?g|png|svg|webp)(?:$|[?#])/iu,cr=/\bhttps?:\/\/[^\s<>"')\]]+/giu;function Ue(o){if(typeof o!="string")return null;try{const c=new URL(o.trim());return c.protocol==="http:"||c.protocol==="https:"?c.toString():null}catch{return null}}function K(o,c){const h=o?.[c];return typeof h=="string"&&h.trim()?h.trim():null}function dr(o){return o.mediaType.toLowerCase().startsWith("image/")}function ur(o){return lr.test(o)}function mr(o){try{const c=new URL(o),h=[c.pathname==="/"?"":c.pathname,c.search].join("").trim();return{host:c.hostname.replace(/^www\./iu,""),detail:h||c.hostname}}catch{return{host:o,detail:o}}}function hr(o){const c=new Set,h=[];for(const w of o.matchAll(cr)){const S=w[0]?.replace(/[.,;:!?]+$/u,""),F=Ue(S);!F||c.has(F)||(c.add(F),h.push(F))}return h}const pr=/^\/api\/blobs\/[^/]+$/u;function _t(o){try{const c=new URL(o);return pr.test(c.pathname)?`${c.pathname}${c.search}`:o}catch{return o}}function dt(o){return Ue(o.url)??Ue(K(o.metadata,"url"))??Ue(K(o.metadata,"href"))}function gr(o){const c=o.metadata??null,h=K(c,"kind")??K(c,"type"),w=dt(o);if(!w||h!=="link_preview"&&h!=="link-preview"&&o.mediaType!=="text/x-uri")return null;const S=mr(w);return{id:o.id,url:w,title:K(c,"title")??S.host,description:K(c,"description"),imageUrl:Ue(K(c,"imageUrl")??K(c,"image")),siteName:K(c,"siteName")??S.host}}function fr({src:o,alt:c}){const[h,w]=n.useState(!1);return h?r.jsxs("a",{className:"s-message-embed s-message-embed--file",href:o,target:"_blank",rel:"noreferrer",children:[r.jsx("span",{className:"s-message-embed-title",children:c}),r.jsx("span",{className:"s-message-embed-description",children:"Preview unavailable"})]}):r.jsx("a",{className:"s-message-embed s-message-embed--image",href:o,target:"_blank",rel:"noreferrer",children:r.jsx("img",{src:o,alt:c,loading:"lazy",decoding:"async",onError:()=>w(!0)})})}function yr({preview:o}){return r.jsxs("a",{className:"s-message-embed s-message-embed--link",href:o.url,target:"_blank",rel:"noreferrer",children:[o.imageUrl&&r.jsx("span",{className:"s-message-embed-thumb",children:r.jsx("img",{src:o.imageUrl,alt:"",loading:"lazy",decoding:"async"})}),r.jsxs("span",{className:"s-message-embed-copy",children:[o.siteName&&r.jsx("span",{className:"s-message-embed-site",children:o.siteName}),r.jsx("span",{className:"s-message-embed-title",children:o.title}),o.description&&r.jsx("span",{className:"s-message-embed-description",children:o.description})]})]})}function wr({message:o}){const c=o.attachments??[],h=new Set,w=[],S=[];for(const u of c){const L=dt(u);if(L&&dr(u)){h.add(u.id),w.push({id:u.id,src:_t(L),alt:u.fileName??"Image attachment"});continue}const b=gr(u);b&&(h.add(u.id),S.push(b))}const F=new Set(S.map(u=>u.url)),z=new Set(c.map(dt).filter(u=>!!u));for(const u of hr(o.body))z.has(u)||F.has(u)||ur(u)&&w.push({id:u,src:_t(u),alt:"Embedded image"});const M=c.filter(u=>!h.has(u.id));return w.length===0&&S.length===0&&M.length===0?null:r.jsxs("div",{className:"s-message-embeds",children:[w.map(u=>r.jsx(fr,{src:u.src,alt:u.alt},u.id)),S.slice(0,1).map(u=>r.jsx(yr,{preview:u},u.id)),M.map(u=>{const L=dt(u),b=L?_t(L):null,d=u.fileName??K(u.metadata,"title")??u.mediaType;return b?r.jsxs("a",{className:"s-message-embed s-message-embed--file",href:b,target:"_blank",rel:"noreferrer",children:[r.jsx("span",{className:"s-message-embed-title",children:d}),r.jsx("span",{className:"s-message-embed-description",children:u.mediaType})]},u.id):r.jsxs("div",{className:"s-message-embed s-message-embed--file",children:[r.jsx("span",{className:"s-message-embed-title",children:d}),r.jsx("span",{className:"s-message-embed-description",children:u.mediaType})]},u.id)})]})}function Sr(o){const{sessionIds:c,active:h}=o,w=c.join("|"),S=h&&c.length>0,[F,z]=n.useState([]);return n.useEffect(()=>{z([])},[w]),n.useEffect(()=>{if(!S)return;let M=!1;const u=new URLSearchParams({limit:String(Va*3),transcripts:"true"});return _(`/api/tail/recent?${u.toString()}`).then(L=>{if(M)return;const b=(L.events??[]).filter(d=>Es(d,c));b.length!==0&&z(d=>Ls(d,b))}).catch(()=>{}),()=>{M=!0}},[S,w]),rr(M=>{S&&Es(M,c)&&z(u=>Ls(u,[M]))},S),n.useMemo(()=>S?za(F):[],[S,F])}const br=3500;function Ps(o){const c=o?.trim().replace(/^#/,"");if(!c?.startsWith("msg-"))return null;const h=c.slice(4).trim();if(!h)return null;try{return decodeURIComponent(h)}catch{return h}}const xr=64;function Tr(o){const c=o?.clientMessageId;return typeof c=="string"&&c.trim()?c.trim():null}function $s(o){const c=o.body.replace(/\s+/gu," ").trim();if(c)return c.length>180?`${c.slice(0,179).trimEnd()}…`:c;const h=o.attachments?.length??0;return h===1?"Attachment":h>1?`${h} attachments`:"Message"}function Fs(o,c){const h=o.toLocaleLowerCase().indexOf(c.toLocaleLowerCase());if(h<0)return o;const w=o.slice(0,h),S=o.slice(h+c.length);return!w&&S.startsWith(" ")?S.slice(1):w.endsWith(" ")&&S.startsWith(" ")?`${w}${S.slice(1)}`:`${w}${S}`}function vr(o){return o instanceof TypeError||typeof DOMException<"u"&&o instanceof DOMException&&o.name==="AbortError"}function Bo({conversationId:o,initialDraft:c,navigate:h,embedded:w,showBackNav:S=!0,treatment:F="standard"}){const{agents:z,route:M,openContextCapture:u}=zn(),L=qa(M),b=n.useMemo(()=>Gn(z,L),[z,L]),[d,ut]=n.useState(null),Kt=n.useRef(null);Kt.current=d;const He=n.useMemo(()=>it(o),[o]),[Os,qs]=n.useState(()=>He?{[o]:He}:{}),T=Os[o]??He??[],[Ds,Vt]=n.useState(()=>He!==null),xe=n.useRef(null),Bs=n.useMemo(()=>{const t=xe.current;return t===null?null:new Set(T.filter(e=>!t.has(e.id)).map(e=>e.id))},[T]),zt=xe.current===null&&T.length>0;n.useEffect(()=>{if(T.length===0)return;const t=xe.current??new Set;for(const e of T)t.add(e.id);xe.current=t},[T]),n.useEffect(()=>{xe.current=null,Vt(it(o)!==null)},[o]);const Gt=!Ds&&T.length===0,V=n.useCallback(t=>{qs(e=>{const s=e[o]??it(o)??[],a=typeof t=="function"?t(s):t,i=qn(o,a);return{...e,[o]:i}})},[o]),Us=Bt(o),[g,he]=n.useState(Us),[Te,ve]=n.useState([]),[We,mt]=n.useState(null),[_e,ke]=n.useState(null),[Qe,Hs]=n.useState(()=>typeof window>"u"?null:Ps(window.location.hash)),[Jt,pe]=n.useState(null),[ge,ht]=n.useState(!1),[Ws,Ce]=n.useState(!1),[pt,Ke]=n.useState(0),Ve=n.useRef(null),Me=n.useRef(null),Yt=n.useRef(null),Ne=n.useRef(!0),ze=n.useRef(!1),fe=n.useRef(null),R=n.useRef(null),Ie=n.useRef(new Set),Ae=n.useRef(null),Xt=n.useRef(0),Zt=n.useRef(null),je=n.useRef(null),se=n.useRef(o);se.current=o;const ne=n.useRef(new Map),_s=bs(o),Ge=n.useRef(!1);n.useLayoutEffect(()=>{const t=Me.current,e=Ve.current;!t||!e||(e.scrollTop=t.scrollTop+(e.scrollHeight-t.scrollHeight),Me.current=null,Ge.current=!0)}),n.useEffect(()=>{ht(!1),Me.current=null,Ge.current=!1,Ne.current=!0,ze.current=!1,Ce(!1),Ke(0),Et(new Set),ne.current.clear(),he(Bt(o))},[o]);const x=d?.agentId??null,C=d?.kind==="direct",gt=n.useMemo(()=>new Set([o,...d?.equivalentConversationIds??[]]),[o,d?.equivalentConversationIds]),Q=n.useMemo(()=>x?b.find(t=>t.id===x)??null:null,[b,x]),es=Yn(d),Qs=Xn({resolvedAgentId:Q?.id,sessionId:es,machineId:L}),[ts,ss]=n.useState(null);n.useEffect(()=>{_("/api/fleet").then(t=>{ss(e=>te(e,Ts(t.activeAsks,o,x)))}).catch(()=>{})},[o,x]);const B=n.useCallback(async(t={})=>{const e=t.messageMode??"none",s=t.includeMetadata??!0;pe(null);try{const a=s?await _(`/api/session/${encodeURIComponent(o)}`).catch(()=>null):Kt.current;if(se.current!==o)return;ut(k=>te(k,a));const i=a?.agentId??null,l=a?.id&&a.id!==o?a.id:o;if(l!==o){h({view:"conversation",conversationId:l});return}const m=it(l),A=Dn(l),f=e==="initial"&&!A,p=e==="refresh"||e==="initial",[y,U,j]=await Promise.all([f?Bn(l):p?Un(l,{refresh:!0}):Promise.resolve(m),_(`/api/flights?conversationId=${encodeURIComponent(l)}`),_("/api/fleet?limit=24&activityLimit=160").catch(()=>Zn())]);if(se.current!==o)return;const Z=be(y??[]),q=Z.filter(k=>!Ht(k));y&&V(k=>te(k,ea(k,q))),Vt(!0),Ba(l);const H=Z.at(-1);H&&je.current!==H.id&&(je.current=H.id,_(`/api/conversations/${encodeURIComponent(l)}/read-cursor`,{method:"POST",body:JSON.stringify({lastReadMessageId:H.id})}).catch(()=>{je.current===H.id&&(je.current=null)}));const W=ta(U),D=Bt(l),ee=W??D;Ie.current=new Set([...U.map(k=>k.invocationId),...D?.invocationId?.startsWith("pending:")?[]:D?.invocationId?[D.invocationId]:[]]),W&&D?.id===W.id&&xs(l,W.id);const rt=ee?.agentId??i??null,E=sa(j.activity,ee,l,rt),ot=na(j.activeAsks,ee,l,rt);he(k=>te(k,ee)),ve(k=>te(k,E)),ke(k=>te(k,ot)),ss(k=>te(k,Ts(j.activeAsks,l,i)))}catch(a){if(se.current!==o)return;pe(a instanceof Error?a.message:String(a))}},[o,h,V]);n.useEffect(()=>{B({messageMode:"initial"})},[B]),n.useEffect(()=>{je.current=null},[o]),n.useEffect(()=>{Ae.current=g},[g]);const Ks=n.useCallback(async()=>{if(ge||!bs(o))return;const t=Ve.current,e=t?{scrollHeight:t.scrollHeight,scrollTop:t.scrollTop}:null;ht(!0),pe(null);try{const s=await Hn(o);if(se.current!==o)return;e&&(Me.current=e),V(be(s).filter(a=>!Ht(a)))}catch(s){se.current===o&&pe(s instanceof Error?s.message:String(s))}finally{se.current===o&&ht(!1)}},[o,ge,V]),[N,O]=n.useState(()=>c??""),[ae,re]=n.useState(null),[G,Je]=n.useState(!1),[v,Vs]=n.useState("operator"),[oe,Re]=n.useState({open:!1,query:"",triggerStart:-1,index:0}),[ie,Ee]=n.useState({open:!1,query:"",triggerStart:-1,index:0}),[P,J]=n.useState(null),[ft,Ye]=n.useState(!1),[yt,Xe]=n.useState(""),[zs,Le]=n.useState(null),[Gs,wt]=n.useState(!1);n.useEffect(()=>{Ye(!1),Xe(""),Le(null),wt(!1)},[o]),n.useEffect(()=>{if(!c)return;const t=`${o}:${c}`;Zt.current!==t&&(Zt.current=t,O(c),requestAnimationFrame(()=>R.current?.focus()))},[o,c]);const le=n.useMemo(()=>{const t=new Map;for(const e of d?.participants??[])t.set(e.actorId,e),e.agentId&&t.set(e.agentId,e);return t},[d]),St=n.useMemo(()=>{const t=new Set,e=[];for(const s of d?.participantIds??[]){if(s==="operator")continue;const a=le.get(s),i=a?.scopedAlias?.trim().replace(/^@+/,"");if(!i)continue;const l=i.toLowerCase();t.has(l)||(t.add(l),e.push({id:s,label:a?.label??a?.displayName??i,name:a?.displayName??i,handle:i}))}for(const s of b){const a=s.handle?.trim().replace(/^@+/,"")??vs(s.id)??s.id;if(!a)continue;const i=a.toLowerCase();t.has(i)||(t.add(i),e.push({id:s.id,label:a,name:s.name??a,handle:a}))}return e.sort((s,a)=>s.handle.localeCompare(a.handle))},[le,b,d]),Js=n.useMemo(()=>{if(!oe.open)return[];const t=oe.query.toLowerCase();return t?ks.filter(e=>e.command.toLowerCase().startsWith("/"+t)||e.command.toLowerCase().includes(t)):ks},[oe.open,oe.query]),Ys=n.useMemo(()=>{if(!ie.open)return[];const t=ie.query.toLowerCase();return t?St.filter(e=>e.handle.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)).slice(0,8):St.slice(0,8)},[ie.open,ie.query,St]),Xs=n.useCallback(()=>{Re(t=>t.open?{...t,open:!1}:t),Ee(t=>t.open?{...t,open:!1}:t)},[]),Zs=n.useCallback((t,e)=>{const s=aa(t,e);Re(s?i=>({open:!0,query:s.query,triggerStart:s.start,index:i.open&&i.triggerStart===s.start?i.index:0}):i=>i.open?{...i,open:!1}:i);const a=ra(t,e);Ee(a?i=>({open:!0,query:a.query,triggerStart:a.start,index:i.open&&i.triggerStart===a.start?i.index:0}):i=>i.open?{...i,open:!1}:i)},[]),en=n.useCallback(t=>{const e=R.current,s=oe.triggerStart;if(s<0)return;const a=e?.selectionStart??N.length,i=N.slice(0,s),l=N.slice(a),m=t.insert,A=`${i}${m}${l}`;O(A),Re(f=>({...f,open:!1})),requestAnimationFrame(()=>{const f=R.current;if(!f)return;const p=i.length+m.length;f.focus(),f.setSelectionRange(p,p)})},[N,oe.triggerStart]),tn=n.useCallback(t=>{const e=R.current,s=ie.triggerStart;if(s<0)return;const a=e?.selectionStart??N.length,i=N.slice(0,s),l=N.slice(a),m=l.length===0||!l.startsWith(" "),A=`@${t.handle}${m?" ":""}`,f=`${i}${A}${l}`;O(f),Ee(p=>({...p,open:!1})),requestAnimationFrame(()=>{const p=R.current;if(!p)return;const y=i.length+A.length;p.focus(),p.setSelectionRange(y,y)})},[N,ie.triggerStart]);n.useEffect(()=>{const t=R.current;if(!t)return;t.style.height="0px";const e=Math.min(Math.max(t.scrollHeight,40),160);t.style.height=`${e}px`,t.style.overflowY=t.scrollHeight>e?"auto":"hidden"},[N]),n.useEffect(()=>{_("/api/user").then(t=>Vs(t.name)).catch(()=>{})},[]);const Ze=n.useMemo(()=>oa(T,v),[T,v]);n.useEffect(()=>{P===null||Ze===null||Ze>=P&&J(null)},[P,Ze]);const sn=n.useMemo(()=>ia(g),[g]),ye=Date.now(),nn=la(g,Ze,ye),bt=sn&&!ca(g)&&!nn,ns=C&&(G||P!==null||bt),as=C&&da({sending:G,awaitingResponse:P!==null,currentFlight:g}),$=ua({name:Q?.name,agentName:d?.agentName,id:x,title:d?.title}),I=n.useMemo(()=>C?ma({agentName:$,agentState:Q?.state??null,sending:G,currentFlight:g,showWorkingTurn:bt,awaitingResponse:P!==null}):{label:"Open",detail:"",tone:"idle",showStrip:!1,showTyping:!1},[Q?.state,$,P,g,ye,C,G,bt]),xt=g?.startedAt??_e?.startedAt??P,Tt=js(xt),rs=Ea(xt,ye),[,an]=n.useState(0);n.useEffect(()=>{if(!I.showTyping||Tt===null)return;const t=Math.max(0,Date.now()-Tt),e=[Is.sustained,Is.long].find(a=>a>t);if(e===void 0)return;const s=window.setTimeout(()=>an(a=>a+1),e-t+50);return()=>window.clearTimeout(s)},[Tt,I.showTyping,rs]);const rn="Live",vt=n.useMemo(()=>ha({currentFlight:g,presence:I,turnActivity:Te,turnAsk:_e,awaitingResponseSince:P,nowMs:ye}),[P,g,ye,I,Te,_e]),on="s-thread-msg-card s-thread-msg-working-card s-thread-msg-card--avatar-row",ln="s-thread-msg-kind",cn="s-thread-turn-snapshot",dn="s-thread-turn-snapshot-pulse",un="s-thread-presence-line",mn=["s-thread-presence-strip",`s-thread-presence-strip--${rs}`].filter(Boolean).join(" "),kt=d?pa(d):$,os=d?.id??o,hn=d?.alias?.trim()||null,et=ga(d?.workspaceRoot),pn=I.tone,Ct=T.length===0&&C&&(I.showTyping||g!==null||Te.length>0||_e!==null||P!==null),is=n.useMemo(()=>d?d.participantIds.includes("operator"):C,[C,d]),Pe=g?.agentId??x,$e=Pe?Cs(b,[Pe]):null,Fe=$e?.id??Pe,Oe=g?.sessions.at(-1)?.sessionId??$e?.harnessSessionId??void 0,ls=g?.id?()=>{ct(h,{view:"sessions",flightId:g.id,...Fe?{agentId:Fe}:{},...Oe?{sessionId:Oe}:{},...L?{machineId:L}:{}},{returnTo:M})}:void 0,cs=g?.id??null;n.useEffect(()=>{if(!cs||!Fe){mt(null);return}let t=!1;const e=Oe?`?sessionId=${encodeURIComponent(Oe)}`:"",s=async()=>{try{const i=await _(`/api/agents/${encodeURIComponent(Fe)}/observe${e}`);if(t)return;mt(l=>te(l,i))}catch{}};s();const a=window.setInterval(()=>{s()},br);return()=>{t=!0,window.clearInterval(a),mt(null)}},[cs,Fe,Oe]);const Mt=n.useMemo(()=>Ga({flight:g,agent:$e??Q,sessionMeta:d,observeSessionId:We?.sessionId}),[Q,g,d,We?.sessionId,$e]),ds=Sr({sessionIds:Mt,active:I.showTyping||Ct}),gn=n.useMemo(()=>Ja({observe:We,flight:g}),[g,We]),Y=ds.length>0?ds:gn,Nt=n.useMemo(()=>Y.length>0?null:Ya({flight:g,hasSessionScope:Mt.length>0,awaitingResponse:P!==null}),[P,g,Mt.length,Y.length]),It=Xa(Y),At=Za(Y),us=Y.at(-1)??null,jt=us?Ut(us.ts,ye):null,ce=n.useMemo(()=>At?{...vt,latest:At,...It?{activityLabel:It}:{},...jt?{lastActivityLabel:jt}:{}}:vt,[jt,At,vt,It]),fn=`${$}: ${ce.latest}`,ms=Pe&&fa($e)?()=>{ct(h,{view:"terminal",agentId:Pe,mode:"takeover"},{returnTo:M})}:void 0,Rt=C?()=>{w&&Da({type:"focus-composer",reason:"Steer the active conversation"})||requestAnimationFrame(()=>{R.current?.focus({preventScroll:!0}),R.current?.scrollIntoView({block:"nearest"})})}:void 0,yn=n.useMemo(()=>(d?d.participantIds.filter(e=>e!=="operator"):x?[x]:[]).map(e=>{const s=Cs(b,[e]),a=le.get(e);return{id:e,name:a?.scopedAlias??s?.name??a?.displayName??vs(e)??e,title:a?.label??s?.id??e,agent:s,sessionId:a?.sessionId??null,harness:s?.harness??a?.harness??null,model:s?.model??null,reasoningEffort:s?.reasoningEffort??null}}),[x,le,b,d]),wn=n.useMemo(()=>({name:v,active:is}),[is,v]),tt=n.useMemo(()=>new Map(T.map(t=>[t.id,t])),[T]),st=n.useMemo(()=>ya(T),[T]),[Sn,Et]=n.useState(()=>new Set),bn=n.useCallback(t=>{Et(e=>{const s=new Set(e);return s.delete(t)||s.add(t),s})},[]),hs=n.useMemo(()=>{const t=new Map;for(const e of st)if(e.kind==="fanout")for(const s of e.messages)t.set(s.id,e.key);return t},[st]),nt=n.useCallback(t=>{const e=hs.get(t);e&&Et(l=>l.has(e)?l:new Set(l).add(e));const s=document.getElementById(`msg-${t}`);if(!s)return;const a=s.closest(".s-thread-fanout")??s,i=a===s?"s-thread-msg--flash":"s-thread-fanout--flash";a.scrollIntoView({behavior:"smooth",block:"center"}),a.classList.add(i),window.setTimeout(()=>a.classList.remove(i),1200)},[hs]);n.useEffect(()=>{const t=()=>Hs(Ps(window.location.hash));return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)},[]),n.useEffect(()=>{if(!Qe||!tt.has(Qe))return;const t=window.setTimeout(()=>nt(Qe),50);return()=>window.clearTimeout(t)},[Qe,tt,nt]),Fa(n.useCallback(t=>{if(t.kind==="message.posted"){const e=t.payload?.message;if(!e||!gt.has(e.conversationId))return;const s=e.actorId==="operator",a=C&&!s&&e.class==="agent",i={id:e.id,conversationId:e.conversationId,actorId:e.actorId,actorName:a?$:wa(e.actorId,b,v),body:e.body,createdAt:e.createdAt,class:s?"operator":e.class,attachments:e.attachments,metadata:e.metadata,replyToMessageId:e.replyToMessageId??e.n??null};if(Ht(i))return;if(V(l=>{const m=Tr(e.metadata),A=m?ne.current.get(m):void 0;if(l.some(f=>f.id===e.id))return m&&ne.current.delete(m),l;if(s&&m){const f=Sa(l,m,A);if(f!==-1){const p=[...l];return p[f]=i,ne.current.delete(m),be(p)}}return be([...l,i])}),a){const l=js(e.createdAt)??Date.now();J(m=>m===null||l<m||ba(Ae.current)?m:null),he(m=>xa(m)?null:m)}return}if(t.kind==="invocation.requested"){const e=t.payload?.invocation;if(!e||e.targetAgentId!==x||!e.conversationId||!gt.has(e.conversationId))return;Ie.current.add(e.id),ve([]),ke(null),J(s=>s??Date.now());return}if(t.kind==="flight.updated"){const e=t.payload?.flight;if(!e||e.targetAgentId!==x||!(Ie.current.has(e.invocationId)||Ae.current?.id===e.id))return;if(Ta.has(e.state)){xs(o,e.id),he(l=>l?.id===e.id?null:l),ve([]),ke(null),J(null),B({messageMode:"refresh",includeMetadata:!1});return}Ie.current.add(e.invocationId);const a=Ae.current?.id===e.id,i=Ms(e,o,x??"",Ae.current);va(i)&&J(null),he(i),a||(ve([]),ke(null));return}t.kind!=="agent.endpoint.upserted"&&t.kind==="unknown"&&B({messageMode:"refresh"})},[x,$,o,gt,C,B,v,b])),n.useEffect(()=>{if(!ns)return;const t=setInterval(()=>{B({messageMode:"refresh",includeMetadata:!1})},5e3);return()=>clearInterval(t)},[ns,B]),n.useEffect(()=>{const t=()=>{if(document.visibilityState!=="visible")return;const e=Date.now();e-Xt.current<1e3||(Xt.current=e,B({messageMode:"refresh"}))};return window.addEventListener("focus",t),document.addEventListener("visibilitychange",t),()=>{window.removeEventListener("focus",t),document.removeEventListener("visibilitychange",t)}},[B]);const Lt=n.useRef(null),ps=n.useRef(!1),Pt=n.useRef(!1),$t=n.useCallback(t=>{const e=Yt.current;e&&(ze.current=!0,fe.current!==null&&clearTimeout(fe.current),e.scrollIntoView({behavior:t}),fe.current=setTimeout(()=>{ze.current=!1,fe.current=null},t==="smooth"?700:0))},[]);n.useEffect(()=>()=>{fe.current!==null&&clearTimeout(fe.current)},[]);const xn=n.useCallback(()=>{const t=Ve.current;if(!t||ze.current)return;const s=t.scrollHeight-t.clientHeight-t.scrollTop<=xr;Ne.current=s,s?(Ce(!1),Ke(0)):Ce(!0)},[]),Tn=n.useCallback(()=>{Ne.current=!0,Ce(!1),Ke(0),$t("smooth")},[$t]);n.useEffect(()=>{const t=T.at(-1)?.id??null,e=!!(t&&t!==Lt.current),s=ka({newestMessageId:t,previousNewestMessageId:Lt.current,showTyping:I.showTyping,previousShowTyping:ps.current,historyRestorePending:Ge.current||Me.current!==null,initialScrollDone:Pt.current,nearBottom:Ne.current});s!=="none"?($t(s),Pt.current=!0):e&&Pt.current&&!Ne.current&&(Ce(!0),Ke(a=>a+1)),Ge.current=!1,Lt.current=t,ps.current=I.showTyping});const[,vn]=n.useState(0);n.useEffect(()=>{const t=setInterval(()=>vn(e=>e+1),15e3);return()=>clearInterval(t)},[]);const de=Kn(),[ue,X]=n.useState([]),[gs,at]=n.useState("queue"),[we,Se]=n.useState(null),qe=async(t,e)=>{const s=t.trim(),a=e?.attachments??[],i=e?.replyTarget??null;if(!s&&a.length===0||G)return"failed";const m=e?.forceAction??As({isDm:C,hasOutstandingReply:as}),A=Date.now(),f=_n(),p={id:`optimistic-${f}`,conversationId:o,actorId:"operator",actorName:v,body:s,createdAt:A,class:"operator",...i?{replyToMessageId:i.messageId}:{},metadata:{clientMessageId:f,deliveryState:"sending"},...a.length>0?{attachments:a}:{}};Je(!0),m!=="message"&&J(A),pe(null),ne.current.set(f,p.id),V(y=>be([...y,p]));try{const y=await _(`/api/chats/${encodeURIComponent(o)}/messages`,{method:"POST",body:JSON.stringify({body:s,clientMessageId:f,...i?{replyToMessageId:i.messageId}:{},...a.length>0?{attachments:a}:{}})}),U=y.chatId?.trim()??y.conversationId?.trim();if(U&&U!==o)throw new Error(`Send returned a different Chat (${U}) instead of appending to ${o}.`);if(y.messageId?.trim()){const j=y.messageId.trim();V(Z=>be(Z.map(q=>q.id===p.id?{...q,id:j,metadata:{clientMessageId:f}}:q))),ne.current.delete(f)}return y.flight?(Ie.current.add(y.flight.invocationId),he(Ms(y.flight,o,x??"")),ve([]),ke(null)):m!=="message"&&J(null),"sent"}catch(y){return vr(y)?(V(U=>U.map(j=>j.id===p.id?{...j,metadata:{...j.metadata??{},deliveryState:"unknown"}}:j)),"unknown"):(V(U=>U.filter(j=>j.id!==p.id)),ne.current.delete(f),J(null),pe(y instanceof Error?y.message:String(y)),"failed")}finally{Je(!1)}},kn=async()=>{const t=N.trim(),e=ae,s=de.files,a=we?.attachments??[];if(!t&&s.length===0&&a.length===0)return null;let i=[];if(s.length>0){Je(!0);try{i=await Qn(s)}catch(l){return de.setError(l instanceof Error?l.message:String(l)),null}finally{Je(!1)}}return O(""),re(null),de.clear(),Se(null),{body:t,attachments:[...a,...i],replyTarget:e}},Cn=async()=>{const t=Pa({isAgentBusy:me,intent:gs}),e=we?.id??null,s=await kn();if(!s)return;if(t==="queue"){X(l=>e?l.map(m=>m.id===e?{...m,body:s.body,attachments:s.attachments,replyTarget:s.replyTarget}:m):[...l,{id:`queued-${Date.now()}-${l.length}`,body:s.body,attachments:s.attachments,replyTarget:s.replyTarget,queuedAt:Date.now()}]);return}e&&X(l=>l.filter(m=>m.id!==e));const a=()=>{O(s.body),Se(s.attachments.length>0?{id:null,attachments:s.attachments}:null),re(s.replyTarget),requestAnimationFrame(()=>R.current?.focus())};if(t==="steer"){at("queue"),await qt(),await qe(s.body,{forceAction:"steer",attachments:s.attachments,replyTarget:s.replyTarget})==="failed"&&a();return}await qe(s.body,{attachments:s.attachments,replyTarget:s.replyTarget})==="failed"&&a()},Mn=t=>{X(e=>e.filter(s=>s.id!==t)),Se(e=>e?.id===t?null:e)},Nn=t=>{const e=ue.find(s=>s.id===t);e&&(O(e.body),re(e.replyTarget??null),Se({id:t,attachments:e.attachments}),requestAnimationFrame(()=>{const s=R.current;s&&(s.focus(),s.setSelectionRange(s.value.length,s.value.length))}))},In=()=>{Se(null),O(""),re(null),de.clear()},An=async t=>{const e=ue.find(a=>a.id===t);if(!e)return;X(a=>a.filter(i=>i.id!==t)),await qt(),await qe(e.body,{forceAction:"steer",attachments:e.attachments,replyTarget:e.replyTarget??null})==="failed"&&X(a=>[e,...a])},Ft=n.useCallback((t,e)=>{const s=e?.trim().replace(/^@+/,"")||null,a=s?`@${s}`:null,i=ae?.insertedMention?Fs(N,ae.insertedMention):N,l=!!(!C&&a&&!i.toLocaleLowerCase().includes(a.toLocaleLowerCase())),m=l&&a?i.trim()?`${i.trimEnd()} ${a} `:`${a} `:i;O(m),re({messageId:t.id,actorLabel:s?`@${s}`:t.actorName,preview:$s(t),insertedMention:l?a:null}),requestAnimationFrame(()=>R.current?.focus())},[N,C,ae?.insertedMention]),jn=n.useCallback(()=>{const t=ae?.insertedMention;re(null),t&&O(e=>Fs(e,t)),requestAnimationFrame(()=>R.current?.focus())},[ae]),Ot=n.useCallback(t=>{const e=new URL(window.location.href);M.view==="agents-v2"&&e.searchParams.set("tab","message"),e.hash=`msg-${t}`,Be(e.toString())},[M.view]),fs=n.useCallback((t,e,s)=>{const a=Wn({conversationId:o,selectedMessageId:t.id,messages:T.map(i=>({id:i.id,actorLabel:i.id===t.id?e:lt(i,v)?v:i.actorName,body:i.body,attachmentCount:i.attachments?.length??0}))});u({intent:"forward-message",forwardContext:a,forwardContextMode:"selected-message",...s?{projectPath:s}:{}})},[o,T,u,v]),qt=async()=>{if(x)try{await _("/api/agents/"+encodeURIComponent(x)+"/interrupt",{method:"POST",body:JSON.stringify({})})}catch{}},me=I.tone==="working"||I.tone==="pending",Rn=As({isDm:C,hasOutstandingReply:as}),En=C?`Message ${$} — type / to route or @ to mention an agent`:d?.kind==="channel"?`Comment in #${Ca(d)} — mention @agent to request a reply`:`Comment in ${kt} — mention @agent to request a reply`,ys=we?.attachments??[],Ln=!N.trim()&&!de.hasFiles&&ys.length===0&&me,Dt=n.useRef(!1);n.useEffect(()=>{const t=we?.id??null,e=t?ue.filter(a=>a.id!==t):ue;if(!Ma({isAgentBusy:me,sending:G,queued:e})||Dt.current)return;const s=e[0];s&&(Dt.current=!0,X(a=>a.filter(i=>i.id!==s.id)),qe(s.body,{attachments:s.attachments,replyTarget:s.replyTarget??null}).then(a=>{a==="failed"&&X(i=>[s,...i])}).finally(()=>{Dt.current=!1}))},[me,G,ue,we]),n.useEffect(()=>{me||at("queue")},[me]),n.useEffect(()=>{X([]),Se(null),re(null),at("queue"),de.clear()},[o]);const Pn=Na(ue),ws=Jn(),$n=n.useCallback((t,e)=>{const s=window.getSelection()?.toString().trim(),a=lt(e,v),i=e.actorId?le.get(e.actorId):null,l=a?null:Ns(e,b,x),m=(i?.scopedAlias?.trim()||l?.handle?.trim()||null)?.replace(/^@+/,"")??null,A=m?`@${m}`:e.actorName,f=(l?.id||i?.agentId||e.actorId||"").trim(),p=[];a||p.push({kind:"action",label:"Reply",onSelect:()=>Ft(e,m)}),p.push({kind:"action",label:"Forward to new task…",onSelect:()=>fs(e,A,i?.workspaceRoot??l?.projectRoot??l?.cwd??void 0)}),p.push({kind:"separator"}),s&&p.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>{Be(s)}}),p.push({kind:"action",label:"Copy Message",onSelect:()=>{Be(e.body)}}),p.push({kind:"action",label:"Copy Link",onSelect:()=>Ot(e.id)}),p.push({kind:"separator"}),!a&&f&&p.push({kind:"action",label:"Copy Agent ID",onSelect:()=>{Be(f)}}),p.push({kind:"action",label:"Copy Message ID",onSelect:()=>{Be(e.id)}}),ws(t,p)},[x,Ft,Ot,fs,v,le,b,ws]),Fn=async(t,e)=>{const s=`@${e.agentId} `,a=N.trim();if(a){O(""),await qe(`${s}${a}`,{forceAction:"invoke"});return}O(s),R.current?.focus()},De=n.useMemo(()=>{if(!d)return[];const t=new Set(d.participantIds);return b.filter(e=>!t.has(e.id)&&!e.retiredFromFleet).sort((e,s)=>e.name.localeCompare(s.name))},[d,b]);n.useEffect(()=>{ft&&Xe(t=>t&&De.some(e=>e.id===t)?t:De[0]?.id??"")},[ft,De]);const Ss=!!(d&&["direct","group_direct","channel"].includes(d.kind)&&De.length>0),On=n.useCallback(async()=>{if(!d)return;const t=yt.trim();if(t){wt(!0),Le(null);try{const e=await _(`/api/conversations/${encodeURIComponent(d.id)}/members`,{method:"POST",body:JSON.stringify({actorId:t})});e.session?ut(e.session):ut(s=>s&&{...s,kind:e.kind,participantIds:e.participantIds}),Ye(!1),Xe(""),await B({messageMode:"none"})}catch(e){Le(e instanceof Error?e.message:String(e))}finally{wt(!1)}}},[yt,B,d]);return r.jsx("div",{className:`s-thread-layout${w?" s-thread-layout--embedded":""}`,"data-thread-treatment":F==="standard"?void 0:F,children:r.jsxs("div",{className:"s-thread-center",children:[!w&&r.jsx(Ha,{showBackNav:S,isDm:C,navigate:h,route:M,canonicalConversationId:os,threadTitle:kt,agentId:Q?.id??null,sessionId:es,detailRoute:Qs,participants:yn,operator:wn,canAddParticipants:Ss,onToggleAddParticipant:()=>{Le(null),Ye(t=>!t)}}),!w&&d&&r.jsx(Wa,{canonicalConversationId:os,conversationAlias:hn}),!w&&ft&&Ss&&r.jsx(_a,{agents:De,addParticipantId:yt,setAddParticipantId:Xe,addingParticipant:Gs,addParticipantError:zs,onCancel:()=>{Ye(!1),Le(null)},onSubmit:()=>{On()}}),ts&&r.jsx(or,{pinnedAsk:ts,onAnswer:()=>{R.current?.focus()},onSteer:Rt}),r.jsx(ir,{presence:I,agent:Q}),Jt&&r.jsx("p",{className:"s-thread-error",children:Jt}),r.jsxs("div",{className:"s-thread-feed",ref:Ve,onScroll:xn,children:[!Gt&&T.length>0&&_s&&r.jsx("div",{className:"s-thread-history-control",children:r.jsxs("button",{type:"button",className:"s-thread-history-button",disabled:ge,"aria-busy":ge,onClick:()=>{Ks()},children:[ge&&r.jsx("span",{className:"s-thread-history-spinner","aria-hidden":"true"}),ge?"Loading earlier messages…":"Load earlier messages"]})}),Gt?r.jsx(er,{}):T.length===0?Ct?r.jsx(tr,{agentName:$,title:I.label,detail:I.detail||ce.latest,snapshot:ce,events:Te,steps:Y,phase:Nt,tone:pn,workspaceName:et,branch:d?.currentBranch,startedAt:xt,onOpenTrace:ls,onOpenTerminal:ms,onSteer:Rt}):r.jsxs("div",{className:"s-thread-empty",children:[r.jsx("div",{className:"s-thread-empty-glyph","aria-hidden":"true",children:C?"@":"#"}),r.jsx("p",{children:kt}),r.jsx("p",{children:C?"No messages yet. Send a message to start working with this agent.":"No messages yet. Start the conversation below."}),(et||d?.currentBranch)&&r.jsxs("div",{className:"s-thread-empty-chips",children:[et&&r.jsx("span",{className:"s-thread-empty-chip",children:et}),d?.currentBranch&&r.jsx("span",{className:"s-thread-empty-chip",children:d.currentBranch})]})]}):st.map((t,e)=>{const s=Ia(t,e);if(t.kind==="fanout")return r.jsx(Qa,{row:t,expanded:Sn.has(t.key),showDayDivider:s,onToggle:()=>bn(t.key)},t.key);const a=t.message,i=lt(a,v),l=Aa(a),m=l?"scout.dispatch":a.class,A=La(m),f=m==="status",p=Rs(a.createdAt),y=i?null:Ns(a,b,x),j=le.get(a.actorId)?.scopedAlias?.trim()||null,Z=!i&&j?j:a.actorName,q=i?v.toLowerCase():j??y?.handle??null,H=ja(a.body),W=H?Ra({flightId:H.flightId,replyToMessageId:a.replyToMessageId,messagesById:tt,agents:b,operatorName:v}):null,D=!H&&a.replyToMessageId?tt.get(a.replyToMessageId)??null:null,ee=D?lt(D,v)?v:D.actorName:null,rt=H?H.body:a.body;return r.jsxs("div",{className:["s-thread-feed-block",i&&"s-thread-feed-block--you",s&&"s-thread-feed-block--full-width"].filter(Boolean).join(" "),children:[s&&r.jsx(Ka,{at:a.createdAt}),r.jsx("article",{id:`msg-${a.id}`,className:["s-thread-msg",i&&"s-thread-msg--you",f&&"s-thread-msg--tool",(zt||Bs?.has(a.id))&&"s-thread-msg--enter"].filter(Boolean).join(" "),style:zt?{animationDelay:`${Math.max(0,7-(st.length-1-e))*26}ms`}:void 0,"data-class":m,onContextMenu:E=>$n(E,a),children:r.jsx("div",{className:"s-thread-msg-card",children:r.jsxs("div",{className:"s-thread-msg-card-content",children:[r.jsxs("div",{className:"s-thread-msg-header",children:[r.jsxs("div",{className:"s-thread-msg-meta",children:[(()=>{const E=!i&&y?()=>ct(h,{view:"agents-v2",agentId:y.id},{returnTo:M}):null,ot=i?v:Z??"?",k=r.jsx(Wt,{agent:y??void 0,name:ot,placement:"turn",size:28,className:"s-thread-msg-avatar",title:ot});return E?r.jsx("button",{type:"button",className:"s-thread-msg-avatar--nav",onClick:E,"aria-label":`View profile for ${a.actorName??"agent"}`,title:`View profile for ${a.actorName??"agent"}`,children:k}):k})(),!i&&y?r.jsx("button",{type:"button",className:"s-thread-msg-actor s-thread-msg-actor--nav",onClick:()=>ct(h,{view:"agents-v2",agentId:y.id},{returnTo:M}),title:`View profile for ${a.actorName}`,children:Z}):r.jsx("span",{className:"s-thread-msg-actor",children:i?v:Z}),q&&r.jsxs("span",{className:"s-thread-msg-handle",children:["@",q]}),A&&r.jsx("span",{className:"s-thread-msg-kind",children:A})]}),r.jsx("span",{className:"s-thread-msg-time",title:p,children:Ut(a.createdAt)}),r.jsxs("span",{className:"s-thread-msg-actions",children:[!i&&q&&r.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":`Reply to @${q}`,title:`Reply to @${q}`,onClick:()=>Ft(a,q),children:r.jsx(Qt,{})}),r.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":"Copy link to message",title:"Copy link to message",onClick:()=>Ot(a.id),children:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M6.5 9.5a2.5 2.5 0 0 0 3.54 0l2.12-2.12a2.5 2.5 0 0 0-3.54-3.54l-.7.7"}),r.jsx("path",{d:"M9.5 6.5a2.5 2.5 0 0 0-3.54 0L3.84 8.62a2.5 2.5 0 0 0 3.54 3.54l.7-.7"})]})})]})]}),W&&r.jsxs("button",{type:"button",className:"s-thread-reply-ctx",title:`Open the originating request${W.flightId?` · ${W.flightId}`:""}`,onClick:()=>nt(W.originatingMessageId),children:[r.jsx(Qt,{}),r.jsx("span",{className:"s-thread-reply-ctx-label",children:"reply to"}),r.jsx("span",{className:"s-thread-reply-ctx-title",children:W.title}),r.jsxs("span",{className:"s-thread-reply-ctx-from",children:["· ",W.from]}),r.jsx("span",{className:"s-thread-reply-ctx-status",children:"· done"})]}),D&&ee&&r.jsxs("button",{type:"button",className:"s-thread-reply-ctx",title:`Open message from ${ee}`,onClick:()=>nt(D.id),children:[r.jsx(Qt,{}),r.jsx("span",{className:"s-thread-reply-ctx-label",children:"reply to"}),r.jsx("span",{className:"s-thread-reply-ctx-title",children:$s(D)}),r.jsxs("span",{className:"s-thread-reply-ctx-from",children:["· ",ee]})]}),r.jsx("div",{className:"s-thread-msg-body",title:p,children:r.jsx(Oa,{text:rt})}),r.jsx(wr,{message:a}),l&&l.candidates.length>0&&r.jsx("div",{className:"s-thread-dispatch",children:l.candidates.map(E=>r.jsxs("button",{type:"button",className:"s-thread-dispatch-tile",onClick:()=>{Fn(l,E)},children:[r.jsxs("span",{className:"s-thread-dispatch-tile-id",children:["@",E.agentId]}),r.jsx("span",{className:"s-thread-dispatch-tile-state",children:E.endpointState}),r.jsx("span",{className:"s-thread-dispatch-tile-meta",children:[E.workspace,E.node,E.projectRoot].filter(Boolean).join(" · ")||E.displayName})]},E.agentId))})]})})})]},a.id)}),I.showTyping&&!Ct&&r.jsx("div",{className:"s-thread-feed-block",children:r.jsx("div",{className:"s-thread-msg","aria-live":"polite",children:r.jsxs("div",{className:on,children:[r.jsx(Wt,{agent:Q??void 0,name:$,placement:"turn",size:28,className:"s-thread-msg-avatar s-thread-msg-avatar--working",title:$}),r.jsxs("div",{className:"s-thread-msg-card-content",children:[r.jsxs("div",{className:"s-thread-msg-header",children:[r.jsxs("div",{className:"s-thread-msg-meta",children:[r.jsx("span",{className:"s-thread-msg-actor",children:$}),r.jsx("span",{className:ln,children:rn})]}),r.jsx("span",{className:"s-thread-msg-time",title:g?.startedAt?Rs(g.startedAt):"now",children:g?.startedAt?Ut(g.startedAt):"now"})]}),r.jsxs("div",{className:"s-thread-msg-working-body",children:[r.jsxs("div",{className:cn,children:[r.jsx("span",{className:dn,"aria-hidden":"true"}),r.jsxs("div",{className:"s-thread-turn-snapshot-main",children:[r.jsx("span",{className:"s-thread-turn-snapshot-label",children:"Latest"}),r.jsx("span",{className:"s-thread-msg-working-copy",children:ce.latest})]})]}),r.jsxs("dl",{className:"s-thread-turn-snapshot-stats",children:[r.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[r.jsx("dt",{children:"Activity"}),r.jsx("dd",{children:ce.activityLabel})]}),r.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[r.jsx("dt",{children:"Elapsed"}),r.jsx("dd",{children:ce.elapsedLabel})]}),r.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[r.jsx("dt",{children:"Last"}),r.jsx("dd",{children:ce.lastActivityLabel})]})]}),Y.length>0||Nt?r.jsx(sr,{steps:Y,phase:Nt,limit:5,compact:!0}):r.jsx(nr,{events:Te,limit:4,compact:!0}),r.jsx(ar,{onOpenTrace:ls,onOpenTerminal:ms,onSteer:Rt,compact:!0})]})]})]})})}),Ws&&pt>0&&r.jsxs("button",{type:"button",className:"s-thread-new-messages",onClick:Tn,children:[r.jsx("span",{"aria-hidden":"true",children:"↓"})," ",pt," new ",pt===1?"message":"messages"," · jump to latest"]}),r.jsx("div",{ref:Yt})]}),I.showTyping&&r.jsxs("div",{className:un,children:[r.jsx("div",{className:"s-thread-presence-line-avatars",children:r.jsx(Wt,{agent:Q??void 0,name:$,placement:"turn",size:22,className:"s-thread-presence-line-avatar",title:$})}),r.jsx("span",{className:"s-thread-presence-line-label",children:fn}),r.jsx("div",{className:mn,"aria-hidden":"true"})]}),r.jsx(Vn,{composeRef:R,draft:N,setDraft:O,composePlaceholder:En,slashState:oe,setSlashState:Re,filteredSlashCommands:Js,applySlashCommand:en,mentionState:ie,setMentionState:Ee,filteredMentions:Ys,applyMention:tn,updateTriggersFromDraft:Zs,closeSuggestions:Xs,replyTarget:ae,onCancelReply:jn,isStopMode:Ln,sending:G,composeAction:Rn,onSend:()=>{Cn()},onInterrupt:()=>{qt()},attachments:de,isAgentBusy:me,busyIntent:gs,onBusyIntentChange:at,queued:ue,queueNote:Pn,onEditQueued:Nn,editingQueuedId:we?.id??null,editingAttachmentCount:ys.length,onCancelEdit:In,onUnqueue:Mn,onSendQueuedNow:t=>{An(t)}})]})})}function Qt(){return r.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("polyline",{points:"9 14 4 9 9 4"}),r.jsx("path",{d:"M20 20v-7a4 4 0 0 0-4-4H4"})]})}const Uo=Ua({id:"thread",label:"Thread",route:{view:"conversation",conversationId:""},webPath:"/chat",screen:"ConversationScreen",embed:{path:"/embed/thread",profile:"macos.thread",rootClassName:"s-thread-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},hosts:{macos:!0},resolveEmbedProps:$a}});export{Bo as ConversationScreen,Uo as scoutSurface};
@@ -1 +1 @@
1
- import{r as m,j as s}from"./index-Bli6bTLU.js";import{c as b,C as N,u as k}from"./conversation-model-CigSPlKA.js";import{C as x}from"./check-Bfs7hMb1.js";import{S as g}from"./sparkles-ytTwpCbZ.js";import{X as j}from"./x-BJyPzFnn.js";import{c as f}from"./createLucideIcon-DLlxGjKt.js";import"./colors-BtO5_zlx.js";import"./time-Dhsh_2EG.js";const v=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],y=f("shield-alert",v);function Y({pinnedAsk:a,onAnswer:r,onApprove:n,onReject:t,onSteer:i,enableKeyboard:l=!0}){const d=/\b(?:approve|approval|permission|allow|proceed|confirm|gate)\b/i.test(a.task||""),c=a.agentName??b(a.agentId)??a.agentId,p=m.useCallback(()=>{n?n():r()},[n,r]),h=m.useCallback(()=>{i?i():r()},[i,r]);return m.useEffect(()=>{if(!l)return;const u=e=>{const o=document.activeElement;o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement||o instanceof HTMLElement&&o.isContentEditable||e.metaKey||e.ctrlKey||e.altKey||(e.key==="y"||e.key==="Y"?(e.preventDefault(),p()):e.key==="s"||e.key==="S"?(e.preventDefault(),h()):(e.key==="n"||e.key==="N")&&t&&(e.preventDefault(),t()))};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[l,p,h,t]),s.jsxs("div",{className:`s-thread-pinned-ask surface-card ${d?"s-thread-pinned-ask--approval":"s-thread-pinned-ask--question"}`,role:"alert","aria-live":"assertive",children:[s.jsxs("div",{className:"s-thread-pinned-ask-header",children:[s.jsx("div",{className:"s-thread-pinned-ask-beacon","aria-hidden":"true",children:s.jsx("span",{className:"dot dot--sm dot--warning dot--pulse dot--glow"})}),s.jsxs("div",{className:"s-thread-pinned-ask-kicker",children:[s.jsx("span",{className:"label-sm s-thread-pinned-ask-eyebrow",children:"Operator Attention Required"}),s.jsx("span",{className:"chip chip--sm chip--mono chip--warning",children:d?"Approval Gate":"Question"})]}),s.jsxs("div",{className:"s-thread-pinned-ask-routing",children:[s.jsxs("span",{className:"s-thread-pinned-ask-agent-name chip chip--sm chip--mono chip--neutral",children:["@",c]}),s.jsx("span",{className:"s-thread-pinned-ask-routing-arrow","aria-hidden":"true",children:"→"}),s.jsx("span",{className:"chip chip--sm chip--mono chip--working",children:"You"})]})]}),s.jsxs("div",{className:"s-thread-pinned-ask-body",children:[s.jsx("p",{className:"s-thread-pinned-ask-text",children:a.task}),a.summary&&a.summary!==a.task&&s.jsx("p",{className:"s-thread-pinned-ask-summary text-muted",children:a.summary})]}),s.jsxs("div",{className:"s-thread-pinned-ask-actions",children:[s.jsxs("button",{type:"button",className:"btn btn--primary s-thread-pinned-ask-btn",onClick:p,title:d?"Approve this gate [Y]":"Answer this question [Y]",children:[s.jsx("kbd",{className:"s-kbd",children:"[Y]"}),d?s.jsx(x,{size:13,strokeWidth:2.2}):s.jsx(N,{size:13}),s.jsx("span",{children:d?"Approve":"Answer"})]}),s.jsxs("button",{type:"button",className:"btn btn--accent s-thread-pinned-ask-btn",onClick:h,title:"Provide guidance or steer [S]",children:[s.jsx("kbd",{className:"s-kbd",children:"[S]"}),s.jsx(g,{size:13,strokeWidth:1.9}),s.jsx("span",{children:"Steer"})]}),t&&s.jsxs("button",{type:"button",className:"btn btn--danger s-thread-pinned-ask-btn",onClick:t,title:"Reject or decline [N]",children:[s.jsx("kbd",{className:"s-kbd",children:"[N]"}),s.jsx(j,{size:13,strokeWidth:2.2}),s.jsx("span",{children:"Reject"})]})]}),s.jsx("div",{className:"s-thread-pinned-ask-strip","aria-hidden":"true"})]})}function A({title:a,description:r,diff:n,command:t,risk:i="medium",onApprove:l,onReject:d,onSteer:c}){return s.jsxs("div",{className:"s-thread-approval-gate surface-card",role:"alert",children:[s.jsxs("div",{className:"s-thread-approval-gate-head",children:[s.jsxs("div",{className:"s-thread-approval-gate-title-wrap",children:[s.jsx(y,{size:16,className:"text-amber","aria-hidden":"true"}),s.jsx("span",{className:"label-sm text-amber",children:"Execution Approval Gate"}),i&&s.jsxs("span",{className:`chip chip--sm chip--mono ${i==="high"?"chip--danger":i==="medium"?"chip--warning":"chip--info"}`,children:[i.toUpperCase()," RISK"]})]}),s.jsx("h3",{className:"s-thread-approval-gate-title",children:a}),r&&s.jsx("p",{className:"s-thread-approval-gate-desc",children:r})]}),t&&s.jsxs("div",{className:"s-thread-approval-gate-command surface-card surface-card--inset",children:[s.jsx("span",{className:"label-xs text-muted",children:"Command"}),s.jsx("code",{className:"s-thread-approval-gate-code",children:t})]}),n&&s.jsxs("div",{className:"s-thread-approval-gate-diff surface-card surface-card--inset",children:[s.jsx("span",{className:"label-xs text-muted",children:"Diff Preview"}),s.jsx("pre",{className:"s-thread-approval-gate-diff-pre",children:s.jsx("code",{children:n})})]}),s.jsxs("div",{className:"s-thread-approval-gate-actions",children:[s.jsxs("button",{type:"button",className:"btn btn--primary",onClick:l,children:[s.jsx("kbd",{className:"s-kbd",children:"[Y]"}),s.jsx(x,{size:13}),s.jsx("span",{children:"Approve Action"})]}),s.jsxs("button",{type:"button",className:"btn btn--danger",onClick:d,children:[s.jsx("kbd",{className:"s-kbd",children:"[N]"}),s.jsx(j,{size:13}),s.jsx("span",{children:"Reject"})]}),c&&s.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:c,children:[s.jsx("kbd",{className:"s-kbd",children:"[S]"}),s.jsx("span",{children:"Steer…"})]})]})]})}function K({presence:a,agent:r}){if(!a.showStrip)return null;const n=a.tone==="working",t=a.tone==="pending";return s.jsxs("div",{className:`s-thread-status s-thread-status--${a.tone}`,"aria-live":"polite",children:[s.jsx("span",{className:"s-thread-status-dot-wrap","aria-hidden":"true",children:s.jsx("span",{className:`dot dot--sm ${n?"dot--working dot--pulse dot--glow":t?"dot--warning dot--pulse dot--glow":"dot--neutral"}`,style:{color:k(a,r?.state??null)}})}),s.jsxs("div",{className:"s-thread-status-copy",children:[s.jsx("span",{className:"s-thread-status-label label-xs",children:a.label}),s.jsx("span",{className:"s-thread-status-detail",children:a.detail})]})]})}export{A as ApprovalGateCard,K as ConversationStatusStrip,Y as PinnedAskCard};
1
+ import{r as m,j as s}from"./index-NRbRrZw-.js";import{c as b,C as N,u as k}from"./conversation-model-CIzM7aXT.js";import{C as x}from"./check-BdovFDz8.js";import{S as g}from"./sparkles-CgTby-ap.js";import{X as j}from"./x-DuzAbpk5.js";import{c as f}from"./createLucideIcon-Da0lq809.js";import"./colors-BtO5_zlx.js";import"./time-Dhsh_2EG.js";const v=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],y=f("shield-alert",v);function Y({pinnedAsk:a,onAnswer:r,onApprove:n,onReject:t,onSteer:i,enableKeyboard:l=!0}){const d=/\b(?:approve|approval|permission|allow|proceed|confirm|gate)\b/i.test(a.task||""),c=a.agentName??b(a.agentId)??a.agentId,p=m.useCallback(()=>{n?n():r()},[n,r]),h=m.useCallback(()=>{i?i():r()},[i,r]);return m.useEffect(()=>{if(!l)return;const u=e=>{const o=document.activeElement;o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement||o instanceof HTMLElement&&o.isContentEditable||e.metaKey||e.ctrlKey||e.altKey||(e.key==="y"||e.key==="Y"?(e.preventDefault(),p()):e.key==="s"||e.key==="S"?(e.preventDefault(),h()):(e.key==="n"||e.key==="N")&&t&&(e.preventDefault(),t()))};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[l,p,h,t]),s.jsxs("div",{className:`s-thread-pinned-ask surface-card ${d?"s-thread-pinned-ask--approval":"s-thread-pinned-ask--question"}`,role:"alert","aria-live":"assertive",children:[s.jsxs("div",{className:"s-thread-pinned-ask-header",children:[s.jsx("div",{className:"s-thread-pinned-ask-beacon","aria-hidden":"true",children:s.jsx("span",{className:"dot dot--sm dot--warning dot--pulse dot--glow"})}),s.jsxs("div",{className:"s-thread-pinned-ask-kicker",children:[s.jsx("span",{className:"label-sm s-thread-pinned-ask-eyebrow",children:"Operator Attention Required"}),s.jsx("span",{className:"chip chip--sm chip--mono chip--warning",children:d?"Approval Gate":"Question"})]}),s.jsxs("div",{className:"s-thread-pinned-ask-routing",children:[s.jsxs("span",{className:"s-thread-pinned-ask-agent-name chip chip--sm chip--mono chip--neutral",children:["@",c]}),s.jsx("span",{className:"s-thread-pinned-ask-routing-arrow","aria-hidden":"true",children:"→"}),s.jsx("span",{className:"chip chip--sm chip--mono chip--working",children:"You"})]})]}),s.jsxs("div",{className:"s-thread-pinned-ask-body",children:[s.jsx("p",{className:"s-thread-pinned-ask-text",children:a.task}),a.summary&&a.summary!==a.task&&s.jsx("p",{className:"s-thread-pinned-ask-summary text-muted",children:a.summary})]}),s.jsxs("div",{className:"s-thread-pinned-ask-actions",children:[s.jsxs("button",{type:"button",className:"btn btn--primary s-thread-pinned-ask-btn",onClick:p,title:d?"Approve this gate [Y]":"Answer this question [Y]",children:[s.jsx("kbd",{className:"s-kbd",children:"[Y]"}),d?s.jsx(x,{size:13,strokeWidth:2.2}):s.jsx(N,{size:13}),s.jsx("span",{children:d?"Approve":"Answer"})]}),s.jsxs("button",{type:"button",className:"btn btn--accent s-thread-pinned-ask-btn",onClick:h,title:"Provide guidance or steer [S]",children:[s.jsx("kbd",{className:"s-kbd",children:"[S]"}),s.jsx(g,{size:13,strokeWidth:1.9}),s.jsx("span",{children:"Steer"})]}),t&&s.jsxs("button",{type:"button",className:"btn btn--danger s-thread-pinned-ask-btn",onClick:t,title:"Reject or decline [N]",children:[s.jsx("kbd",{className:"s-kbd",children:"[N]"}),s.jsx(j,{size:13,strokeWidth:2.2}),s.jsx("span",{children:"Reject"})]})]}),s.jsx("div",{className:"s-thread-pinned-ask-strip","aria-hidden":"true"})]})}function A({title:a,description:r,diff:n,command:t,risk:i="medium",onApprove:l,onReject:d,onSteer:c}){return s.jsxs("div",{className:"s-thread-approval-gate surface-card",role:"alert",children:[s.jsxs("div",{className:"s-thread-approval-gate-head",children:[s.jsxs("div",{className:"s-thread-approval-gate-title-wrap",children:[s.jsx(y,{size:16,className:"text-amber","aria-hidden":"true"}),s.jsx("span",{className:"label-sm text-amber",children:"Execution Approval Gate"}),i&&s.jsxs("span",{className:`chip chip--sm chip--mono ${i==="high"?"chip--danger":i==="medium"?"chip--warning":"chip--info"}`,children:[i.toUpperCase()," RISK"]})]}),s.jsx("h3",{className:"s-thread-approval-gate-title",children:a}),r&&s.jsx("p",{className:"s-thread-approval-gate-desc",children:r})]}),t&&s.jsxs("div",{className:"s-thread-approval-gate-command surface-card surface-card--inset",children:[s.jsx("span",{className:"label-xs text-muted",children:"Command"}),s.jsx("code",{className:"s-thread-approval-gate-code",children:t})]}),n&&s.jsxs("div",{className:"s-thread-approval-gate-diff surface-card surface-card--inset",children:[s.jsx("span",{className:"label-xs text-muted",children:"Diff Preview"}),s.jsx("pre",{className:"s-thread-approval-gate-diff-pre",children:s.jsx("code",{children:n})})]}),s.jsxs("div",{className:"s-thread-approval-gate-actions",children:[s.jsxs("button",{type:"button",className:"btn btn--primary",onClick:l,children:[s.jsx("kbd",{className:"s-kbd",children:"[Y]"}),s.jsx(x,{size:13}),s.jsx("span",{children:"Approve Action"})]}),s.jsxs("button",{type:"button",className:"btn btn--danger",onClick:d,children:[s.jsx("kbd",{className:"s-kbd",children:"[N]"}),s.jsx(j,{size:13}),s.jsx("span",{children:"Reject"})]}),c&&s.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:c,children:[s.jsx("kbd",{className:"s-kbd",children:"[S]"}),s.jsx("span",{children:"Steer…"})]})]})]})}function K({presence:a,agent:r}){if(!a.showStrip)return null;const n=a.tone==="working",t=a.tone==="pending";return s.jsxs("div",{className:`s-thread-status s-thread-status--${a.tone}`,"aria-live":"polite",children:[s.jsx("span",{className:"s-thread-status-dot-wrap","aria-hidden":"true",children:s.jsx("span",{className:`dot dot--sm ${n?"dot--working dot--pulse dot--glow":t?"dot--warning dot--pulse dot--glow":"dot--neutral"}`,style:{color:k(a,r?.state??null)}})}),s.jsxs("div",{className:"s-thread-status-copy",children:[s.jsx("span",{className:"s-thread-status-label label-xs",children:a.label}),s.jsx("span",{className:"s-thread-status-detail",children:a.detail})]})]})}export{A as ApprovalGateCard,K as ConversationStatusStrip,Y as PinnedAskCard};
@@ -0,0 +1 @@
1
+ .cw-root{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:var(--space-lg);padding:var(--space-xl) var(--space-2xl) var(--space-6xl)}.cw-toolbar{flex:none;display:flex;align-items:center;flex-wrap:wrap;gap:var(--space-sm)}.cw-modeToggle{display:flex;align-items:center;gap:2px;padding:2px;border:1px solid var(--pi-hairline);border-radius:9px;background:color-mix(in srgb,var(--hud-surface) 40%,transparent)}.cw-modeToggle button{display:flex;align-items:center;gap:6px;height:26px;padding:0 10px;border:none;border-radius:7px;background:transparent;color:var(--pi-dim);font-size:var(--text-xs);font-weight:600;cursor:pointer;transition:background .15s var(--pi-ease),color .15s var(--pi-ease)}.cw-modeToggle button:hover{color:var(--pi-muted)}.cw-modeToggle button[data-active]{background:color-mix(in srgb,var(--hud-ink) 10%,transparent);color:var(--pi-ink);box-shadow:inset 0 0 0 1px var(--pi-hairline-strong)}.cw-search{flex:1 1 220px;min-width:180px;max-width:360px;display:flex;align-items:center;gap:7px;height:30px;padding:0 10px;border:1px solid var(--pi-hairline);border-radius:8px;background:color-mix(in srgb,var(--hud-surface) 34%,transparent);color:var(--pi-dim)}.cw-search input{flex:1;min-width:0;border:none;background:transparent;color:var(--pi-ink);font-size:var(--text-sm);font-family:var(--pi-sans)}.cw-search input:focus{outline:none}.cw-search input::placeholder{color:var(--pi-dim)}.cw-filters{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.cw-filtersIcon{color:var(--pi-dim);margin-right:2px}.cw-filters button{height:26px;padding:0 10px;border:1px solid var(--pi-hairline);border-radius:999px;background:color-mix(in srgb,var(--hud-surface) 30%,transparent);color:var(--pi-dim);font-size:var(--text-2xs);font-weight:600;letter-spacing:.01em;cursor:pointer;transition:background .15s var(--pi-ease),color .15s var(--pi-ease),border-color .15s var(--pi-ease)}.cw-filters button:hover{color:var(--pi-muted);border-color:var(--pi-hairline-strong)}.cw-filters button[data-active]{background:color-mix(in srgb,var(--pi-accent) 16%,transparent);border-color:color-mix(in srgb,var(--pi-accent) 40%,var(--pi-hairline));color:var(--pi-ink)}.cw-harnessSelect{display:flex;align-items:center;height:26px;padding:0 8px;border:1px solid var(--pi-hairline);border-radius:999px;background:color-mix(in srgb,var(--hud-surface) 30%,transparent)}.cw-harnessSelect select{border:none;background:transparent;color:var(--pi-muted);font-size:var(--text-2xs);font-weight:600}.cw-harnessSelect select:focus{outline:none}.cw-addProject{margin-left:auto;display:flex;align-items:center;gap:6px;height:30px;padding:0 12px;border:1px solid var(--pi-hairline);border-radius:8px;background:color-mix(in srgb,var(--hud-surface) 34%,transparent);color:var(--pi-muted);font-size:var(--text-xs);font-weight:600;cursor:pointer;transition:background .15s var(--pi-ease),color .15s var(--pi-ease)}.cw-addProject:hover{color:var(--pi-ink);border-color:var(--pi-hairline-strong)}.cw-digest{flex:none;display:flex;align-items:center;gap:6px;color:var(--pi-dim);font-size:var(--text-xs);font-family:var(--pi-mono)}.cw-digest span[data-tone=live]{color:color-mix(in srgb,var(--pi-accent) 78%,var(--pi-ink))}.cw-digest span[data-tone=needs]{color:color-mix(in srgb,#d9a441 82%,var(--pi-ink));font-weight:650}.cw-digestSep{opacity:.5}.cw-empty{padding:48px 12px;text-align:center;color:var(--pi-dim);font-size:var(--text-sm)}.cw-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:var(--space-lg)}.cw-card{display:flex;flex-direction:column;gap:var(--space-md);padding:var(--space-lg);border:1px solid var(--pi-hairline);border-radius:12px;background:linear-gradient(180deg,color-mix(in srgb,white 2.5%,transparent),transparent 40%),color-mix(in srgb,var(--hud-surface) 30%,transparent);transition:border-color .16s var(--pi-ease),transform .16s var(--pi-ease),background .16s var(--pi-ease)}.cw-card:hover{border-color:var(--pi-hairline-strong);transform:translateY(-1px)}.cw-card[data-status=needs]{border-color:color-mix(in srgb,#d9a441 45%,var(--pi-hairline))}.cw-card[data-status=working]{border-color:color-mix(in srgb,var(--pi-accent) 32%,var(--pi-hairline))}.cw-cardHead{display:flex;align-items:flex-start;gap:var(--space-md)}.cw-cardIdentity{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}.cw-cardNameRow{display:flex;align-items:center;gap:8px;min-width:0}.cw-cardNameRow b{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--pi-ink);font-size:var(--text-md);font-weight:650}.cw-statusPill{flex:none;padding:2px 8px;border-radius:999px;font-size:var(--text-2xs);font-weight:650;letter-spacing:.01em;color:var(--pi-dim);background:color-mix(in srgb,var(--hud-ink) 8%,transparent);box-shadow:inset 0 0 0 1px var(--pi-hairline)}.cw-statusPill[data-status=needs]{color:color-mix(in srgb,#d9a441 88%,var(--pi-ink));background:color-mix(in srgb,#d9a441 14%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,#d9a441 40%,transparent)}.cw-statusPill[data-status=working]{color:color-mix(in srgb,var(--pi-accent) 84%,var(--pi-ink));background:color-mix(in srgb,var(--pi-accent) 12%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--pi-accent) 32%,transparent)}.cw-statusPill[data-status=thinking]{color:color-mix(in srgb,#6fb7c7 86%,var(--pi-ink));background:color-mix(in srgb,#6fb7c7 12%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,#6fb7c7 32%,transparent)}.cw-cardSubline{display:flex;align-items:center;gap:6px;min-width:0;color:var(--pi-muted);font-size:var(--text-xs)}.cw-headline{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cw-kernelPill{flex:none;overflow:hidden;max-width:150px;text-overflow:ellipsis;white-space:nowrap;padding:1px 7px;border-radius:999px;border:1px solid var(--pi-hairline);color:var(--pi-dim);font-family:var(--pi-mono);font-size:var(--text-2xs)}.cw-substrates{display:flex;flex-wrap:wrap;gap:6px}.cw-substrateChip{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;border:1px solid var(--pi-hairline);border-radius:999px;background:color-mix(in srgb,var(--hud-surface) 26%,transparent);color:var(--pi-muted);font-size:var(--text-2xs);cursor:pointer;transition:border-color .15s var(--pi-ease),color .15s var(--pi-ease)}.cw-substrateChip:hover{border-color:var(--pi-hairline-strong);color:var(--pi-ink)}.cw-substrateChip[data-primary]{color:var(--pi-ink);background:color-mix(in srgb,var(--hud-ink) 6%,transparent)}.cw-substrateChip[data-live]{border-color:color-mix(in srgb,var(--pi-accent) 34%,var(--pi-hairline))}.cw-substrateChip em{font-style:normal;color:var(--pi-dim);font-family:var(--pi-mono)}.cw-work{display:flex;align-items:baseline;justify-content:space-between;gap:var(--space-md);padding-top:var(--space-2xs);border-top:1px solid var(--pi-hairline)}.cw-work p{flex:1;min-width:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--pi-ink);font-size:var(--text-sm)}.cw-work time{flex:none;color:var(--pi-dim);font-size:var(--text-2xs);font-family:var(--pi-mono)}.cw-cardActions{display:flex;gap:6px}.cw-cardActions button{flex:1;display:flex;align-items:center;justify-content:center;gap:5px;height:26px;border:1px solid var(--pi-hairline);border-radius:7px;background:transparent;color:var(--pi-muted);font-size:var(--text-2xs);font-weight:600;cursor:pointer;transition:background .15s var(--pi-ease),color .15s var(--pi-ease),border-color .15s var(--pi-ease)}.cw-cardActions button:hover{color:var(--pi-ink);border-color:var(--pi-hairline-strong);background:color-mix(in srgb,var(--hud-ink) 5%,transparent)}.cw-coordStrip{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.cw-runtimeBadge{display:inline-flex;align-items:center;gap:5px;padding:2px 7px;border:1px solid var(--pi-hairline);border-radius:6px;background:color-mix(in srgb,var(--hud-surface) 36%,transparent);color:var(--pi-muted);font-size:var(--text-2xs);font-family:var(--pi-mono)}.cw-runtimeBadge span{color:var(--pi-ink);font-weight:600}.cw-runtimeBadge i{font-style:normal;color:var(--pi-dim)}.cw-runtimeBadge em{font-style:normal;padding:0 4px;border-radius:3px;background:color-mix(in srgb,var(--hud-ink) 8%,transparent);color:var(--pi-dim);font-size:10px}.cw-workspaceList{display:flex;flex-direction:column;gap:var(--space-md)}.cw-workspace{border:1px solid var(--pi-hairline);border-radius:12px;background:color-mix(in srgb,var(--hud-surface) 24%,transparent);overflow:hidden}.cw-workspace[data-state=needs]{border-color:color-mix(in srgb,#d9a441 40%,var(--pi-hairline))}.cw-workspace[data-state=live]{border-color:color-mix(in srgb,var(--pi-accent) 28%,var(--pi-hairline))}.cw-workspaceHead{width:100%;display:flex;align-items:center;gap:var(--space-lg);padding:var(--space-md) var(--space-lg);border:none;background:transparent;color:inherit;text-align:left;cursor:pointer;transition:background .15s var(--pi-ease)}.cw-workspaceHead:hover{background:color-mix(in srgb,var(--hud-ink) 4%,transparent)}.cw-workspaceTitle{flex:none;display:flex;align-items:center;gap:6px;color:var(--pi-ink);font-size:var(--text-md);font-weight:650}.cw-workspaceRoot{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--pi-dim);font-family:var(--pi-mono);font-size:var(--text-xs)}.cw-workspaceMeta{flex:none;display:flex;align-items:center;gap:10px;color:var(--pi-dim);font-size:var(--text-xs)}.cw-workspaceMeta b{font-weight:650;color:var(--pi-muted)}.cw-workspaceMeta b[data-tone=needs]{color:color-mix(in srgb,#d9a441 85%,var(--pi-ink))}.cw-workspaceMeta b[data-tone=live]{color:color-mix(in srgb,var(--pi-accent) 82%,var(--pi-ink))}.cw-workspaceMeta time{font-family:var(--pi-mono)}.cw-workspaceCrew{display:flex;flex-wrap:wrap;gap:6px;padding:0 var(--space-lg) var(--space-md)}.cw-workspaceCrewEmpty{padding:0 var(--space-lg) var(--space-md);color:var(--pi-dim);font-size:var(--text-xs)}.cw-crewChip{display:inline-flex;align-items:center;gap:6px;padding:3px 9px 3px 4px;border:1px solid var(--pi-hairline);border-radius:999px;background:color-mix(in srgb,var(--hud-surface) 30%,transparent);color:var(--pi-muted);font-size:var(--text-2xs);cursor:pointer;transition:border-color .15s var(--pi-ease),color .15s var(--pi-ease)}.cw-crewChip:hover{border-color:var(--pi-hairline-strong);color:var(--pi-ink)}.cw-crewChip[data-status=needs]{border-color:color-mix(in srgb,#d9a441 40%,var(--pi-hairline))}.cw-crewChip[data-status=working]{border-color:color-mix(in srgb,var(--pi-accent) 32%,var(--pi-hairline))}.cw-crewChipName{max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--pi-ink);font-weight:600}.cw-crewChip em{font-style:normal;color:var(--pi-dim);font-family:var(--pi-mono)}.cw-runtimeList{display:flex;flex-direction:column;gap:var(--space-md)}.cw-runtimeRow{border:1px solid var(--pi-hairline);border-radius:12px;background:color-mix(in srgb,var(--hud-surface) 24%,transparent);overflow:hidden;transition:border-color .15s var(--pi-ease)}.cw-runtimeRow[data-state=needs]{border-color:color-mix(in srgb,#d9a441 40%,var(--pi-hairline))}.cw-runtimeRow[data-state=live]{border-color:color-mix(in srgb,var(--pi-accent) 28%,var(--pi-hairline))}.cw-runtimeHead{display:flex;align-items:center;justify-content:space-between;gap:var(--space-lg);padding:var(--space-md) var(--space-lg);background:color-mix(in srgb,var(--hud-surface) 18%,transparent);border-bottom:1px solid var(--pi-hairline)}.cw-runtimeTitle{display:flex;align-items:center;gap:8px;color:var(--pi-ink);font-size:var(--text-md);font-weight:650}.cw-runtimeHarnessIcon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:6px;background:color-mix(in srgb,var(--hud-surface) 40%,transparent);border:1px solid var(--pi-hairline);color:var(--pi-ink)}.cw-runtimeHarnessSlug{font-family:var(--pi-mono);font-size:var(--text-xs);color:var(--pi-dim);font-weight:400;padding:1px 6px;border-radius:4px;background:color-mix(in srgb,var(--hud-ink) 6%,transparent)}.cw-runtimeMeta{flex:none;display:flex;align-items:center;gap:10px;color:var(--pi-dim);font-size:var(--text-xs)}.cw-runtimeMeta b{font-weight:650;color:var(--pi-muted)}.cw-runtimeMeta b[data-tone=needs]{color:color-mix(in srgb,#d9a441 85%,var(--pi-ink))}.cw-runtimeMeta b[data-tone=live]{color:color-mix(in srgb,var(--pi-accent) 82%,var(--pi-ink))}.cw-runtimeMeta time{font-family:var(--pi-mono)}.cw-runtimeCrew{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:var(--space-sm);padding:var(--space-md) var(--space-lg)}.cw-runtimeCrewEmpty{padding:var(--space-md) var(--space-lg);color:var(--pi-dim);font-size:var(--text-xs)}.cw-runtimeCrewChip{display:flex;align-items:center;gap:10px;padding:8px 12px;border:1px solid var(--pi-hairline);border-radius:9px;background:color-mix(in srgb,var(--hud-surface) 32%,transparent);color:var(--pi-muted);text-align:left;cursor:pointer;transition:border-color .15s var(--pi-ease),background .15s var(--pi-ease),transform .15s var(--pi-ease)}.cw-runtimeCrewChip:hover{border-color:var(--pi-hairline-strong);background:color-mix(in srgb,var(--hud-surface) 44%,transparent);color:var(--pi-ink);transform:translateY(-1px)}.cw-runtimeCrewChip[data-status=needs]{border-color:color-mix(in srgb,#d9a441 40%,var(--pi-hairline))}.cw-runtimeCrewChip[data-status=working]{border-color:color-mix(in srgb,var(--pi-accent) 32%,var(--pi-hairline))}.cw-runtimeCrewChipText{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.cw-runtimeCrewChipTop{display:flex;align-items:center;justify-content:space-between;gap:6px}.cw-runtimeCrewChipName{font-size:var(--text-xs);font-weight:650;color:var(--pi-ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cw-runtimeCrewChipStatus{font-size:10px;font-family:var(--pi-mono);color:var(--pi-dim)}.cw-runtimeCrewChipStatus[data-status=needs]{color:color-mix(in srgb,#d9a441 85%,var(--pi-ink))}.cw-runtimeCrewChipStatus[data-status=working]{color:color-mix(in srgb,var(--pi-accent) 80%,var(--pi-ink))}.cw-runtimeCrewChipSub{display:flex;align-items:center;gap:6px;font-size:11px}.cw-runtimeCrewChipProject{color:var(--pi-dim);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cw-runtimeCrewChipModel{font-family:var(--pi-mono);font-size:10px;padding:0 4px;border-radius:3px;background:color-mix(in srgb,var(--hud-ink) 7%,transparent);color:var(--pi-dim)}@media(max-width:720px){.cw-toolbar{flex-direction:column;align-items:stretch}.cw-addProject{margin-left:0}.cw-grid{grid-template-columns:1fr}.cw-workspaceHead{flex-wrap:wrap}.cw-workspaceRoot{flex:1 1 100%;order:3}}
@@ -0,0 +1 @@
1
+ import{r as p,j as s}from"./index-NRbRrZw-.js";import{r as q,C as O,A as C}from"./AgentAvatar-CQqJcwOQ.js";import{H as F}from"./HarnessMark-CEzmPFHC.js";import{t as N}from"./time-Dhsh_2EG.js";import{o as K}from"./model-IGCUEsMy.js";import{s as Q}from"./project-overview-helpers-BQTc_Ous.js";import{F as D,A as V}from"./AddProjectForm-Dw2oyCcz.js";import{a as J}from"./agent-specialization-D3-sqwhU.js";import{c as b}from"./createLucideIcon-Da0lq809.js";import{C as X}from"./cpu-CtQc0Z9D.js";import{S as Y}from"./search-HmdKXdtR.js";import{S as Z}from"./sliders-horizontal-D2O6QiDN.js";import{M as ee}from"./message-square-DURSOrUr.js";import{F as A}from"./DocumentFocusViewer-CetjnYut.js";const se=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],te=b("rows-3",se);const ne=[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]],re=b("telescope",ne);const ae=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],ie=b("users",ae);function ce(e){return e.agentId?`agent:${e.agentId}`:`named:${e.harness}:${e.agentName.toLowerCase()}`}function le(e,a,r){return e?"needs":(r??"").toLowerCase().includes("think")?"thinking":a?"working":"idle"}function T(e){switch(e.status){case"needs":return 3;case"working":return 2;case"thinking":return 1;case"idle":return 0}}function oe(e,a){const r=new Map;for(const t of e){if(t.kind!=="agent")continue;const i=ce(t),o={threadId:t.id,projectSlug:t.projectSlug,projectTitle:t.projectTitle,projectRoot:t.projectRoot,branch:t.branch,working:t.working,needs:t.needs,lastActivityAt:t.lastActivityAt,sessionCount:t.sessionCount,work:t.work,conversationId:t.conversationId},l=r.get(i);if(l){l.substrates.push(o),l.needs=l.needs||t.needs,l.working=l.working||t.working,l.lastActivityAt=Math.max(l.lastActivityAt,t.lastActivityAt),l.sessionCount+=t.sessionCount;continue}const m=t.agentId?a.get(t.agentId)??null:null,d=q(t.agentName,!0)??"milo",h=m?J(m).headline:"Generalist";r.set(i,{key:i,agentId:t.agentId,name:t.agentName,harness:t.harness,model:m?.model??null,effort:m?.reasoningEffort??null,castSlug:d,kernel:O[d]?.kernel??null,headline:h,status:"idle",needs:t.needs,working:t.working,substrates:[o],primary:o,lastActivityAt:t.lastActivityAt,sessionCount:t.sessionCount,rawState:m?.state??null})}const n=[...r.values()].map(t=>{const i=[...t.substrates].sort((m,d)=>Number(d.working)-Number(m.working)||Number(d.needs)-Number(m.needs)||d.lastActivityAt-m.lastActivityAt),{rawState:o,...l}=t;return{...l,substrates:i,primary:i[0]??t.primary,status:le(t.needs,t.working,o)}});return n.sort((t,i)=>T(i)-T(t)||i.lastActivityAt-t.lastActivityAt||t.name.localeCompare(i.name)),n}function de(e,a){const r=new Map;for(const n of e)for(const t of n.substrates){const i=r.get(t.projectSlug)??[];i.push({member:n,substrate:t}),r.set(t.projectSlug,i)}return a.map(n=>{const t=(r.get(n.slug)??[]).sort((i,o)=>Number(o.substrate.working)-Number(i.substrate.working)||Number(o.substrate.needs)-Number(i.substrate.needs)||o.substrate.lastActivityAt-i.substrate.lastActivityAt);return{slug:n.slug,title:n.title,root:n.root,crew:t,needs:n.needs,working:n.working,agentCount:n.agentCount,sessionCount:n.sessionCount,lastActivityAt:n.lastActivityAt}}).sort((n,t)=>+(t.needs>0)-+(n.needs>0)||+(t.working>0)-+(n.working>0)||t.lastActivityAt-n.lastActivityAt||n.title.localeCompare(t.title))}function ue(e){const a=new Map;for(const r of e){const n=r.harness.toLowerCase(),t=a.get(n)??[];t.push({member:r,substrate:r.primary}),a.set(n,t)}return[...a.entries()].map(([r,n])=>{const t=n.sort((h,u)=>+(u.member.status==="needs")-+(h.member.status==="needs")||+(u.member.status==="working")-+(h.member.status==="working")||u.member.lastActivityAt-h.member.lastActivityAt||h.member.name.localeCompare(u.member.name)),i=t.filter(h=>h.member.status==="needs").length,o=t.filter(h=>h.member.status==="working"||h.member.status==="thinking").length,l=t.reduce((h,u)=>h+u.member.sessionCount,0),m=t.reduce((h,u)=>Math.max(h,u.member.lastActivityAt),0),d=r?r.charAt(0).toUpperCase()+r.slice(1):"Unknown";return{harness:r,title:d,crew:t,needs:i,working:o,agentCount:t.length,sessionCount:l,lastActivityAt:m}}).sort((r,n)=>+(n.needs>0)-+(r.needs>0)||+(n.working>0)-+(r.working>0)||n.lastActivityAt-r.lastActivityAt||r.title.localeCompare(n.title))}function k(e,a){switch(a){case"all":return!0;case"active":return e.status==="working"||e.status==="thinking";case"needs":return e.status==="needs";case"idle":return e.status==="idle"}}function y(e,a){return a==="all"||e.harness.toLowerCase()===a.toLowerCase()}function v(e,a){const r=a.trim().toLowerCase();return!r||e.name.toLowerCase().includes(r)||e.headline.toLowerCase().includes(r)||e.harness.toLowerCase().includes(r)||e.model?.toLowerCase().includes(r)||e.castSlug.toLowerCase().includes(r)?!0:e.substrates.some(n=>n.projectTitle.toLowerCase().includes(r)||n.work.toLowerCase().includes(r))}function he(e){return[...new Set(e.map(a=>a.harness.toLowerCase()))].sort()}function S(e){switch(e){case"needs":return"Needs attention";case"working":return"Working";case"thinking":return"Thinking";case"idle":return"Idle"}}const me=[{id:"all",label:"All"},{id:"active",label:"Active"},{id:"needs",label:"Needs attention"},{id:"idle",label:"Idle"}];function f(e){return e?e.charAt(0).toUpperCase()+e.slice(1):"Harness"}function pe(e,a){if(a?.conversationId){e({view:"conversation",conversationId:a.conversationId});return}e({view:"messages"})}function we(e,a){e({view:"code",project:a})}function M(e,a,r){r&&e(K(a,r))}function P(e,a,r){e({view:"agents-v2",projectSlug:r,...a.machineId?{machineId:a.machineId}:{},...a.showEphemeral?{showEphemeral:!0}:{}})}function je({model:e,agents:a,route:r,navigate:n,nowMs:t}){const[i,o]=p.useState("crew"),[l,m]=p.useState("all"),[d,h]=p.useState("all"),[u,_]=p.useState(""),[$,L]=p.useState(!1),W=p.useMemo(()=>new Map(a.map(c=>[c.id,c])),[a]),w=p.useMemo(()=>oe(e.threads,W),[e.threads,W]),x=p.useMemo(()=>de(w,e.projects),[w,e.projects]),g=p.useMemo(()=>ue(w),[w]),E=p.useMemo(()=>he(w),[w]),G=p.useMemo(()=>w.filter(c=>k(c,l)&&y(c,d)&&v(c,u)),[w,l,d,u]),U=p.useMemo(()=>x.map(c=>({...c,crew:c.crew.filter(j=>k(j.member,l)&&y(j.member,d)&&v(j.member,u))})).filter(c=>c.crew.length>0||l==="all"&&d==="all"&&!u.trim()),[x,l,d,u]),B=p.useMemo(()=>g.map(c=>({...c,crew:c.crew.filter(j=>k(j.member,l)&&y(j.member,d)&&v(j.member,u))})).filter(c=>c.crew.length>0||l==="all"&&d==="all"&&!u.trim()),[g,l,d,u]),z=w.filter(c=>c.status==="needs").length,R=w.filter(c=>c.status==="working"||c.status==="thinking").length;return s.jsxs("main",{className:"cw-root","aria-label":"Crew and workspaces",children:[s.jsxs("div",{className:"cw-toolbar",children:[s.jsxs("div",{className:"cw-modeToggle",role:"group","aria-label":"View mode",children:[s.jsxs("button",{type:"button","data-active":i==="crew"||void 0,onClick:()=>o("crew"),title:"Personas & Agent Crew matrix",children:[s.jsx(ie,{size:13,strokeWidth:1.9,"aria-hidden":!0}),"Crew (Personas)"]}),s.jsxs("button",{type:"button","data-active":i==="workspace"||void 0,onClick:()=>o("workspace"),title:"Group by repository workspace",children:[s.jsx(te,{size:13,strokeWidth:1.9,"aria-hidden":!0}),"Workspace lens"]}),s.jsxs("button",{type:"button","data-active":i==="runtime"||void 0,onClick:()=>o("runtime"),title:"Group by runtime engine and models",children:[s.jsx(X,{size:13,strokeWidth:1.9,"aria-hidden":!0}),"Runtime engines"]})]}),s.jsxs("label",{className:"cw-search",role:"search",children:[s.jsx(Y,{size:13,strokeWidth:1.8,"aria-hidden":!0}),s.jsx("input",{type:"search",value:u,placeholder:"Find persona, runtime, workspace, or task","aria-label":"Find persona, runtime, workspace, or task",onChange:c=>_(c.currentTarget.value)})]}),s.jsxs("div",{className:"cw-filters","aria-label":"Status filter",children:[s.jsx(Z,{size:12,strokeWidth:1.9,"aria-hidden":!0,className:"cw-filtersIcon"}),me.map(c=>s.jsx("button",{type:"button","data-active":l===c.id||void 0,onClick:()=>m(c.id),children:c.label},c.id))]}),s.jsxs("label",{className:"cw-harnessSelect",title:"Filter by runtime",children:[s.jsx("span",{className:"pi-srOnly",children:"Filter by runtime"}),s.jsxs("select",{value:d,onChange:c=>h(c.currentTarget.value),children:[s.jsx("option",{value:"all",children:"All runtimes"}),E.map(c=>s.jsx("option",{value:c,children:f(c)},c))]})]}),s.jsxs("button",{type:"button",className:"cw-addProject","aria-expanded":$,onClick:()=>L(c=>!c),children:[s.jsx(D,{size:13,strokeWidth:1.9,"aria-hidden":!0}),"Add project"]})]}),$?s.jsx(V,{onClose:()=>L(!1)}):null,s.jsxs("div",{className:"cw-digest",children:[s.jsxs("span",{children:[w.length," personas"]}),s.jsx("span",{className:"cw-digestSep",children:"·"}),s.jsxs("span",{"data-tone":R>0?"live":void 0,children:[R," moving"]}),z>0?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"cw-digestSep",children:"·"}),s.jsxs("span",{"data-tone":"needs",children:[z," needs you"]})]}):null,s.jsx("span",{className:"cw-digestSep",children:"·"}),s.jsxs("span",{children:[e.projects.length," workspaces"]}),s.jsx("span",{className:"cw-digestSep",children:"·"}),s.jsxs("span",{children:[g.length," runtimes"]})]}),i==="crew"?s.jsx(ge,{members:G,route:r,navigate:n,nowMs:t,allEmpty:w.length===0}):i==="workspace"?s.jsx(ke,{workspaces:U,route:r,navigate:n,nowMs:t,allEmpty:x.length===0}):s.jsx(fe,{runtimes:B,route:r,navigate:n,nowMs:t,allEmpty:g.length===0})]})}function ge({members:e,route:a,navigate:r,nowMs:n,allEmpty:t}){return e.length===0?s.jsx("div",{className:"cw-empty",children:t?"No crew members are registered yet.":"No crew members match these filters."}):s.jsx("div",{className:"cw-grid",children:e.map(i=>s.jsx(xe,{member:i,route:a,navigate:r,nowMs:n},i.key))})}function xe({member:e,route:a,navigate:r,nowMs:n}){const t=e.primary,i=e.substrates.filter(o=>o.threadId!==t.threadId);return s.jsxs("article",{className:"cw-card","data-status":e.status,children:[s.jsxs("header",{className:"cw-cardHead",children:[s.jsx(C,{agent:{name:e.name,harness:e.harness,state:I(e.status)},placement:"hero",size:46,presence:!0}),s.jsxs("div",{className:"cw-cardIdentity",children:[s.jsxs("div",{className:"cw-cardNameRow",children:[s.jsx("b",{title:e.name,children:e.name}),s.jsx("span",{className:"cw-statusPill","data-status":e.status,children:S(e.status)})]}),s.jsxs("div",{className:"cw-cardSubline",children:[s.jsx("span",{className:"cw-headline",children:e.headline}),e.kernel?s.jsx("span",{className:"cw-kernelPill",title:e.kernel,children:e.kernel}):null]})]})]}),s.jsx("div",{className:"cw-coordStrip",children:s.jsxs("div",{className:"cw-runtimeBadge",title:`Runtime: ${f(e.harness)}${e.model?` · ${e.model}`:""}${e.effort?` (${e.effort})`:""}`,children:[s.jsx(F,{harness:e.harness,size:11}),s.jsx("span",{children:f(e.harness)}),e.model?s.jsx("i",{children:e.model}):null,e.effort?s.jsx("em",{children:e.effort}):null]})}),s.jsxs("div",{className:"cw-substrates",children:[s.jsx(H,{substrate:t,route:a,navigate:r,primary:!0}),i.map(o=>s.jsx(H,{substrate:o,route:a,navigate:r},o.threadId))]}),s.jsxs("div",{className:"cw-work",children:[s.jsx("p",{title:t.work,children:t.work}),s.jsx("time",{children:t.lastActivityAt?N(t.lastActivityAt,n):"—"})]}),s.jsxs("footer",{className:"cw-cardActions",children:[s.jsxs("button",{type:"button",onClick:()=>pe(r,t),children:[s.jsx(ee,{size:12,strokeWidth:1.9,"aria-hidden":!0}),"Chat"]}),s.jsxs("button",{type:"button",onClick:()=>we(r,t.projectSlug),children:[s.jsx(A,{size:12,strokeWidth:1.9,"aria-hidden":!0}),"Browse code"]}),s.jsxs("button",{type:"button",onClick:()=>M(r,a,e.agentId),children:[s.jsx(re,{size:12,strokeWidth:1.9,"aria-hidden":!0}),"Inspect"]})]})]})}function I(e){switch(e){case"needs":return"needs_attention";case"working":return"in_turn";case"thinking":return"thinking";case"idle":return"idle"}}function H({substrate:e,route:a,navigate:r,primary:n=!1}){return s.jsxs("button",{type:"button",className:"cw-substrateChip","data-primary":n||void 0,"data-live":e.working||void 0,title:e.projectRoot??void 0,onClick:()=>P(r,a,e.projectSlug),children:[s.jsx(A,{size:11,strokeWidth:1.8,"aria-hidden":!0}),s.jsx("span",{children:e.projectTitle}),e.branch?s.jsxs("em",{children:["git: ",e.branch]}):null]})}function ke({workspaces:e,route:a,navigate:r,nowMs:n,allEmpty:t}){return e.length===0?s.jsx("div",{className:"cw-empty",children:t?"No projects are tracked yet.":"No workspaces match these filters."}):s.jsx("div",{className:"cw-workspaceList",children:e.map(i=>s.jsx(ye,{workspace:i,route:a,navigate:r,nowMs:n},i.slug))})}function ye({workspace:e,route:a,navigate:r,nowMs:n}){return s.jsxs("article",{className:"cw-workspace","data-state":e.needs>0?"needs":e.working>0?"live":void 0,children:[s.jsxs("button",{type:"button",className:"cw-workspaceHead",onClick:()=>P(r,a,e.slug),children:[s.jsxs("span",{className:"cw-workspaceTitle",children:[s.jsx(A,{size:13,strokeWidth:1.7,"aria-hidden":!0}),"/",e.title]}),s.jsx("span",{className:"cw-workspaceRoot",title:e.root??void 0,children:e.root?Q(e.root):"Discovered project"}),s.jsxs("span",{className:"cw-workspaceMeta",children:[e.needs>0?s.jsxs("b",{"data-tone":"needs",children:[e.needs," needs you"]}):null,e.working>0?s.jsxs("b",{"data-tone":"live",children:[e.working," moving"]}):null,s.jsxs("span",{children:[e.sessionCount," sessions"]}),s.jsx("time",{children:e.lastActivityAt?N(e.lastActivityAt,n):"no activity"})]})]}),e.crew.length>0?s.jsx("div",{className:"cw-workspaceCrew","aria-label":"Crew stationed here",children:e.crew.map(t=>s.jsx(ve,{station:t,route:a,navigate:r},`${e.slug}:${t.member.key}`))}):s.jsx("div",{className:"cw-workspaceCrewEmpty",children:"No crew stationed here."})]})}function ve({station:e,route:a,navigate:r}){const{member:n,substrate:t}=e;return s.jsxs("button",{type:"button",className:"cw-crewChip","data-status":n.status,onClick:()=>M(r,a,n.agentId),title:`${n.name} (${n.headline}) · ${t.work}`,children:[s.jsx(C,{agent:{name:n.name,harness:n.harness,state:I(n.status)},size:22,presence:!0}),s.jsx("span",{className:"cw-crewChipName",children:n.name}),s.jsx("span",{className:"cw-crewChipStatus","data-status":n.status,children:S(n.status)}),t.branch?s.jsxs("span",{className:"cw-crewChipBranch",children:["git: ",t.branch]}):null]})}function fe({runtimes:e,route:a,navigate:r,nowMs:n,allEmpty:t}){return e.length===0?s.jsx("div",{className:"cw-empty",children:t?"No runtime engines are active.":"No runtimes match these filters."}):s.jsx("div",{className:"cw-runtimeList",children:e.map(i=>s.jsx(Ce,{runtime:i,route:a,navigate:r,nowMs:n},i.harness))})}function Ce({runtime:e,route:a,navigate:r,nowMs:n}){return s.jsxs("article",{className:"cw-runtimeRow","data-state":e.needs>0?"needs":e.working>0?"live":void 0,children:[s.jsxs("header",{className:"cw-runtimeHead",children:[s.jsxs("div",{className:"cw-runtimeTitle",children:[s.jsx("span",{className:"cw-runtimeHarnessIcon",children:s.jsx(F,{harness:e.harness,size:15})}),s.jsxs("b",{children:[e.title," Engine"]}),s.jsx("span",{className:"cw-runtimeHarnessSlug",children:e.harness})]}),s.jsxs("div",{className:"cw-runtimeMeta",children:[e.needs>0?s.jsxs("b",{"data-tone":"needs",children:[e.needs," needs you"]}):null,e.working>0?s.jsxs("b",{"data-tone":"live",children:[e.working," moving"]}):null,s.jsxs("span",{children:[e.agentCount," ",e.agentCount===1?"persona":"personas"]}),s.jsx("span",{className:"cw-digestSep",children:"·"}),s.jsxs("span",{children:[e.sessionCount," sessions"]}),s.jsx("time",{children:e.lastActivityAt?N(e.lastActivityAt,n):"no activity"})]})]}),e.crew.length>0?s.jsx("div",{className:"cw-runtimeCrew","aria-label":`Crew running on ${e.title}`,children:e.crew.map(t=>s.jsx(Ne,{station:t,route:a,navigate:r},`${e.harness}:${t.member.key}`))}):s.jsx("div",{className:"cw-runtimeCrewEmpty",children:"No crew running on this harness."})]})}function Ne({station:e,route:a,navigate:r}){const{member:n,substrate:t}=e;return s.jsxs("button",{type:"button",className:"cw-runtimeCrewChip","data-status":n.status,onClick:()=>M(r,a,n.agentId),title:`${n.name} (${n.headline}) · ${t.projectTitle} · ${t.work}`,children:[s.jsx(C,{agent:{name:n.name,harness:n.harness,state:I(n.status)},size:24,presence:!0}),s.jsxs("div",{className:"cw-runtimeCrewChipText",children:[s.jsxs("div",{className:"cw-runtimeCrewChipTop",children:[s.jsx("span",{className:"cw-runtimeCrewChipName",children:n.name}),s.jsx("span",{className:"cw-runtimeCrewChipStatus","data-status":n.status,children:S(n.status)})]}),s.jsxs("div",{className:"cw-runtimeCrewChipSub",children:[s.jsx("span",{className:"cw-runtimeCrewChipProject",children:t.projectTitle}),n.model?s.jsx("span",{className:"cw-runtimeCrewChipModel",children:n.model}):null]})]})]})}const _e=Object.freeze(Object.defineProperty({__proto__:null,CrewWorkspaces:je},Symbol.toStringTag,{value:"Module"}));export{je as C,ie as U,_e as a};
@@ -1 +1 @@
1
- import{r as m,j as o}from"./index-Bli6bTLU.js";/* empty css */const $=48,I=720;function _(e){if(!e||typeof window>"u")return null;try{const n=window.localStorage.getItem(e);if(!n)return null;const a=JSON.parse(n);if(!a||typeof a!="object")return null;const f={};for(const[c,d]of Object.entries(a))typeof d=="number"&&Number.isFinite(d)&&d>0&&(f[c]=d);return f}catch{return null}}function z(e,n){if(e&&!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(n))}catch{}}function H({storageKey:e,columns:n}){const a=m.useMemo(()=>{const r=_(e)??{},s={};for(const p of n)s[p.key]=r[p.key]??p.defaultWidth;return s},[e,n]),[f,c]=m.useState(a);m.useEffect(()=>{c(r=>{let s=!1;const p={...r};for(const b of n)p[b.key]==null&&(p[b.key]=b.defaultWidth,s=!0);return s?p:r})},[n]);const d=m.useMemo(()=>{const r=new Map;for(const s of n)r.set(s.key,s);return r},[n]),N=m.useRef(null),x=m.useCallback(r=>{const s=N.current;if(!s)return;const p=r.clientX-s.startX,b=Math.min(s.max,Math.max(s.min,s.startWidth+p));c(u=>u[s.key]===b?u:{...u,[s.key]:b})},[]),y=m.useCallback(()=>{N.current&&(N.current=null,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y),c(r=>(z(e,r),r)))},[x,e]);m.useEffect(()=>()=>{window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y)},[x,y]);const D=m.useCallback(r=>{const s=f[r],p=d.get(r),b=p?.minWidth??$,u=p?.maxWidth??I;return{style:{width:s,minWidth:b,maxWidth:u},"data-resize-key":r}},[f,d]),E=m.useCallback(r=>({onPointerDown:u=>{if(u.button!==0)return;u.preventDefault(),u.stopPropagation();const h=d.get(r),j=h?.minWidth??$,v=h?.maxWidth??I,S=f[r]??h?.defaultWidth??j;N.current={key:r,startX:u.clientX,startWidth:S,min:j,max:v},document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",x),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y)},onClick:u=>{u.stopPropagation()},onDoubleClick:u=>{u.preventDefault(),u.stopPropagation();const h=d.get(r);h&&c(j=>{const v={...j,[r]:h.defaultWidth};return z(e,v),v})},role:"separator","aria-orientation":"vertical","aria-label":"Resize column",className:"s-resize-handle"}),[f,d,x,y,e]),C=m.useCallback(()=>{c(()=>{const r={};for(const s of n)r[s.key]=s.defaultWidth;return z(e,r),r})},[n,e]);return{widths:f,getColumnProps:D,getResizeHandleProps:E,resetAll:C}}function J(e){return e==="number"||e==="time"?"right":"left"}function B(e){return e==="number"||e==="time"?-1:1}function T(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"||typeof e=="bigint"?String(e):Array.isArray(e)?e.map(n=>T(n)).join(""):""}function F(e,n){if(e.sortValue)return e.sortValue(n);const a=e.render(n),f=T(a).trim();return f||null}function R(e){if(typeof e=="number")return e;const n=Date.parse(e);return Number.isFinite(n)?n:Number.NaN}function q(e,n,a,f){const c=F(a,e),d=F(a,n);return c==null&&d==null?0:c==null?1:d==null?-1:a.kind==="number"?((Number(c)||0)-(Number(d)||0))*f:a.kind==="time"?(R(c)-R(d))*f:String(c).localeCompare(String(d),void 0,{numeric:!0,sensitivity:"base"})*f}function G(e,n){return a=>{typeof e=="function"&&e(a),a.defaultPrevented||n?.(a)}}function K(e,n){return a=>{typeof e=="function"&&e(a),a.defaultPrevented||n?.(a)}}function Z({rows:e,columns:n,rowId:a,storageKey:f,initialSort:c,sort:d,onSortChange:N,secondarySort:x,onRowClick:y,rowBindings:D,rowState:E,empty:C={title:"No rows"},loading:r=!1,rowClassName:s,density:p="comfortable",className:b,ariaLabel:u="Data table"}){const h=m.useMemo(()=>n.map(t=>{const l=t.kind??"text";return{...t,kind:l,align:t.align??J(l),sortable:t.sortable??l!=="custom",resizable:t.resizable??!0}}),[n]),j=m.useMemo(()=>new Map(h.map(t=>[t.key,t])),[h]),[v,S]=m.useState(()=>{if(!c)return null;const l=n.find(i=>i.key===c.key)?.kind??"text";return{key:c.key,dir:c.dir??B(l)}}),k=d??v,{getColumnProps:X,getResizeHandleProps:O}=H({storageKey:f,columns:h.map(t=>({key:t.key,defaultWidth:t.defaultWidth,minWidth:t.minWidth,maxWidth:t.maxWidth}))}),M=m.useMemo(()=>{const t=e.map((i,w)=>({row:i,index:w}));if(!k)return t.map(i=>i.row);const l=j.get(k.key);return l?.sortable?t.slice().sort((i,w)=>{const W=q(i.row,w.row,l,k.dir);if(W!==0)return W;const P=x?.(i.row,w.row)??0;return P!==0?P:i.index-w.index}).map(i=>i.row):t.map(i=>i.row)},[e,k,j,x]),A=t=>{d==null&&S(t),N?.(t)};return o.jsx("div",{className:`dt-wrap dt-wrap--${p}${b?` ${b}`:""}`,children:o.jsxs("table",{className:"dt-table","aria-label":u,"aria-busy":r||void 0,children:[o.jsx("thead",{children:o.jsx("tr",{children:h.map(t=>{const l=k?.key===t.key,i=l?k.dir===1?"ascending":"descending":"none",w=["dt-th",`dt-align-${t.align}`,t.cls,l?"dt-th--sorted":""].filter(Boolean).join(" ");return o.jsxs("th",{className:w,title:t.tip,"aria-sort":i,...X(t.key),children:[t.sortable?o.jsxs("button",{type:"button",className:"dt-th-sort",onClick:()=>{if(k?.key===t.key){A({key:t.key,dir:k.dir===1?-1:1});return}A({key:t.key,dir:B(t.kind)})},children:[o.jsx("span",{className:"dt-th-label",children:t.label}),o.jsx("span",{className:`dt-th-arrow${l?" dt-th-arrow--active":""}`,"aria-hidden":"true",children:l?k?.dir===1?"↑":"↓":"↕"})]}):o.jsx("div",{className:"dt-th-static",children:o.jsx("span",{className:"dt-th-label",children:t.label})}),t.resizable?o.jsx("span",{...O(t.key)}):null]},t.key)})})}),o.jsx("tbody",{children:r&&M.length===0?o.jsx("tr",{className:"dt-loading-row",children:o.jsx("td",{colSpan:h.length,children:o.jsx("div",{className:"dt-loading",role:"status","aria-label":`Loading ${u.toLowerCase()}`,children:Array.from({length:7},(t,l)=>o.jsx("div",{className:"dt-loading-line","aria-hidden":"true",children:h.map(i=>o.jsx("span",{style:{width:`${Math.min(i.defaultWidth,220)}px`}},i.key))},l))})})}):M.length===0?o.jsx("tr",{className:"dt-empty-row",children:o.jsx("td",{colSpan:h.length,children:o.jsxs("div",{className:"dt-empty",children:[o.jsx("div",{className:"dt-empty-title",children:C.title}),C.body?o.jsx("div",{children:C.body}):null]})})}):M.map(t=>{const l=a(t),i=D?.(l)??{},w=E?.(l)??{isActive:!1,isPinned:!1},W=!!(y||D),P=["dt-row",W?"dt-row--interactive":"",w.isActive?"dt-row--active":"",w.isPinned?"dt-row--pinned":"",s?.(t),typeof i.className=="string"?i.className:""].filter(Boolean).join(" "),U=y?()=>y(t):void 0,V=W?K(i.onKeyDown,g=>{y&&(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),y(t))}):typeof i.onKeyDown=="function"?i.onKeyDown:void 0,L={...i,className:P,onClick:G(i.onClick,U),onKeyDown:V};return W&&L.tabIndex==null&&(L.tabIndex=0),o.jsx("tr",{...L,children:h.map(g=>o.jsx("td",{className:["dt-td",`dt-align-${g.align}`,g.cls].filter(Boolean).join(" "),children:g.render(t)},g.key))},l)})})]})})}export{Z as D};
1
+ import{r as m,j as o}from"./index-NRbRrZw-.js";/* empty css */const $=48,I=720;function _(e){if(!e||typeof window>"u")return null;try{const n=window.localStorage.getItem(e);if(!n)return null;const a=JSON.parse(n);if(!a||typeof a!="object")return null;const f={};for(const[c,d]of Object.entries(a))typeof d=="number"&&Number.isFinite(d)&&d>0&&(f[c]=d);return f}catch{return null}}function z(e,n){if(e&&!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(n))}catch{}}function H({storageKey:e,columns:n}){const a=m.useMemo(()=>{const r=_(e)??{},s={};for(const p of n)s[p.key]=r[p.key]??p.defaultWidth;return s},[e,n]),[f,c]=m.useState(a);m.useEffect(()=>{c(r=>{let s=!1;const p={...r};for(const b of n)p[b.key]==null&&(p[b.key]=b.defaultWidth,s=!0);return s?p:r})},[n]);const d=m.useMemo(()=>{const r=new Map;for(const s of n)r.set(s.key,s);return r},[n]),N=m.useRef(null),x=m.useCallback(r=>{const s=N.current;if(!s)return;const p=r.clientX-s.startX,b=Math.min(s.max,Math.max(s.min,s.startWidth+p));c(u=>u[s.key]===b?u:{...u,[s.key]:b})},[]),y=m.useCallback(()=>{N.current&&(N.current=null,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y),c(r=>(z(e,r),r)))},[x,e]);m.useEffect(()=>()=>{window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y)},[x,y]);const D=m.useCallback(r=>{const s=f[r],p=d.get(r),b=p?.minWidth??$,u=p?.maxWidth??I;return{style:{width:s,minWidth:b,maxWidth:u},"data-resize-key":r}},[f,d]),E=m.useCallback(r=>({onPointerDown:u=>{if(u.button!==0)return;u.preventDefault(),u.stopPropagation();const h=d.get(r),j=h?.minWidth??$,v=h?.maxWidth??I,S=f[r]??h?.defaultWidth??j;N.current={key:r,startX:u.clientX,startWidth:S,min:j,max:v},document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",x),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y)},onClick:u=>{u.stopPropagation()},onDoubleClick:u=>{u.preventDefault(),u.stopPropagation();const h=d.get(r);h&&c(j=>{const v={...j,[r]:h.defaultWidth};return z(e,v),v})},role:"separator","aria-orientation":"vertical","aria-label":"Resize column",className:"s-resize-handle"}),[f,d,x,y,e]),C=m.useCallback(()=>{c(()=>{const r={};for(const s of n)r[s.key]=s.defaultWidth;return z(e,r),r})},[n,e]);return{widths:f,getColumnProps:D,getResizeHandleProps:E,resetAll:C}}function J(e){return e==="number"||e==="time"?"right":"left"}function B(e){return e==="number"||e==="time"?-1:1}function T(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"||typeof e=="bigint"?String(e):Array.isArray(e)?e.map(n=>T(n)).join(""):""}function F(e,n){if(e.sortValue)return e.sortValue(n);const a=e.render(n),f=T(a).trim();return f||null}function R(e){if(typeof e=="number")return e;const n=Date.parse(e);return Number.isFinite(n)?n:Number.NaN}function q(e,n,a,f){const c=F(a,e),d=F(a,n);return c==null&&d==null?0:c==null?1:d==null?-1:a.kind==="number"?((Number(c)||0)-(Number(d)||0))*f:a.kind==="time"?(R(c)-R(d))*f:String(c).localeCompare(String(d),void 0,{numeric:!0,sensitivity:"base"})*f}function G(e,n){return a=>{typeof e=="function"&&e(a),a.defaultPrevented||n?.(a)}}function K(e,n){return a=>{typeof e=="function"&&e(a),a.defaultPrevented||n?.(a)}}function Z({rows:e,columns:n,rowId:a,storageKey:f,initialSort:c,sort:d,onSortChange:N,secondarySort:x,onRowClick:y,rowBindings:D,rowState:E,empty:C={title:"No rows"},loading:r=!1,rowClassName:s,density:p="comfortable",className:b,ariaLabel:u="Data table"}){const h=m.useMemo(()=>n.map(t=>{const l=t.kind??"text";return{...t,kind:l,align:t.align??J(l),sortable:t.sortable??l!=="custom",resizable:t.resizable??!0}}),[n]),j=m.useMemo(()=>new Map(h.map(t=>[t.key,t])),[h]),[v,S]=m.useState(()=>{if(!c)return null;const l=n.find(i=>i.key===c.key)?.kind??"text";return{key:c.key,dir:c.dir??B(l)}}),k=d??v,{getColumnProps:X,getResizeHandleProps:O}=H({storageKey:f,columns:h.map(t=>({key:t.key,defaultWidth:t.defaultWidth,minWidth:t.minWidth,maxWidth:t.maxWidth}))}),M=m.useMemo(()=>{const t=e.map((i,w)=>({row:i,index:w}));if(!k)return t.map(i=>i.row);const l=j.get(k.key);return l?.sortable?t.slice().sort((i,w)=>{const W=q(i.row,w.row,l,k.dir);if(W!==0)return W;const P=x?.(i.row,w.row)??0;return P!==0?P:i.index-w.index}).map(i=>i.row):t.map(i=>i.row)},[e,k,j,x]),A=t=>{d==null&&S(t),N?.(t)};return o.jsx("div",{className:`dt-wrap dt-wrap--${p}${b?` ${b}`:""}`,children:o.jsxs("table",{className:"dt-table","aria-label":u,"aria-busy":r||void 0,children:[o.jsx("thead",{children:o.jsx("tr",{children:h.map(t=>{const l=k?.key===t.key,i=l?k.dir===1?"ascending":"descending":"none",w=["dt-th",`dt-align-${t.align}`,t.cls,l?"dt-th--sorted":""].filter(Boolean).join(" ");return o.jsxs("th",{className:w,title:t.tip,"aria-sort":i,...X(t.key),children:[t.sortable?o.jsxs("button",{type:"button",className:"dt-th-sort",onClick:()=>{if(k?.key===t.key){A({key:t.key,dir:k.dir===1?-1:1});return}A({key:t.key,dir:B(t.kind)})},children:[o.jsx("span",{className:"dt-th-label",children:t.label}),o.jsx("span",{className:`dt-th-arrow${l?" dt-th-arrow--active":""}`,"aria-hidden":"true",children:l?k?.dir===1?"↑":"↓":"↕"})]}):o.jsx("div",{className:"dt-th-static",children:o.jsx("span",{className:"dt-th-label",children:t.label})}),t.resizable?o.jsx("span",{...O(t.key)}):null]},t.key)})})}),o.jsx("tbody",{children:r&&M.length===0?o.jsx("tr",{className:"dt-loading-row",children:o.jsx("td",{colSpan:h.length,children:o.jsx("div",{className:"dt-loading",role:"status","aria-label":`Loading ${u.toLowerCase()}`,children:Array.from({length:7},(t,l)=>o.jsx("div",{className:"dt-loading-line","aria-hidden":"true",children:h.map(i=>o.jsx("span",{style:{width:`${Math.min(i.defaultWidth,220)}px`}},i.key))},l))})})}):M.length===0?o.jsx("tr",{className:"dt-empty-row",children:o.jsx("td",{colSpan:h.length,children:o.jsxs("div",{className:"dt-empty",children:[o.jsx("div",{className:"dt-empty-title",children:C.title}),C.body?o.jsx("div",{children:C.body}):null]})})}):M.map(t=>{const l=a(t),i=D?.(l)??{},w=E?.(l)??{isActive:!1,isPinned:!1},W=!!(y||D),P=["dt-row",W?"dt-row--interactive":"",w.isActive?"dt-row--active":"",w.isPinned?"dt-row--pinned":"",s?.(t),typeof i.className=="string"?i.className:""].filter(Boolean).join(" "),U=y?()=>y(t):void 0,V=W?K(i.onKeyDown,g=>{y&&(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),y(t))}):typeof i.onKeyDown=="function"?i.onKeyDown:void 0,L={...i,className:P,onClick:G(i.onClick,U),onKeyDown:V};return W&&L.tabIndex==null&&(L.tabIndex=0),o.jsx("tr",{...L,children:h.map(g=>o.jsx("td",{className:["dt-td",`dt-align-${g.align}`,g.cls].filter(Boolean).join(" "),children:g.render(t)},g.key))},l)})})]})})}export{Z as D};
@@ -1 +1 @@
1
- import{r as f,j as r}from"./index-Bli6bTLU.js";import{a as y}from"./api-DEHEgJ9m.js";import{i as j}from"./scoutbot-D4vuKzOL.js";import{u as S}from"./sse-CSozY6mp.js";import{t as E}from"./time-Dhsh_2EG.js";import{o as M}from"./openContent-C6XO6kr5.js";import{e as k}from"./broker-display-Q75fupqG.js";import{r as R}from"./follow-route-BvcGtBIL.js";import{L as C}from"./loader-circle-DoT8gpw6.js";import{A as L}from"./arrow-up-right-RBC6k8nn.js";import"./index-BWHgHrtv.js";import"./status-tone-BM_zuRy1.js";import"./createLucideIcon-DLlxGjKt.js";const _=3,$=80;function h(e){return Number(e.createdAt)||0}function F(e,s){if(!e.conversationId)return{status:"no-conversation"};const t=s.slice().sort((o,i)=>h(o)-h(i)),n=e.messageId?t.find(o=>o.id===e.messageId)??null:null;let l;if(n){const o=h(n);l=t.filter(i=>i.id!==n.id&&h(i)>=o)}else{const o=t[0];if(o&&h(o)>e.ts)return{status:"beyond-page"};l=t.filter(i=>h(i)>e.ts)}if(l.length===0)return{status:"no-reply"};const u=n?h(n):e.ts,d=l.slice(0,_).map(o=>({id:o.id,actorName:o.actorName||"Unknown",body:o.body??"",createdAt:h(o),afterMs:Math.max(0,h(o)-u),answersDispatch:!!(e.messageId&&o.replyToMessageId===e.messageId)}));return{status:"replies",replies:d,more:Math.max(0,l.length-d.length)}}function b(e,...s){const t=e.metadata??{},n=t.raw&&typeof t.raw=="object"&&!Array.isArray(t.raw)?t.raw:null;for(const l of s)for(const u of[t,n]){const d=u?.[l];if(typeof d=="string"&&d.trim())return d.trim()}return null}function D(e,s){const t=new URLSearchParams,n=e.invocationId??b(e,"invocationId"),l=b(e,"flightId"),u=b(e,"collaborationRecordId","workId","recordId");return l&&t.set("flightId",l),n&&t.set("invocationId",n),e.conversationId&&t.set("conversationId",e.conversationId),u&&t.set("workId",u),s&&t.set("targetAgentId",s),[...t.keys()].length>0?t:null}function H(e,s={}){const t=[];return e.conversationId&&t.push({key:"conversation",label:"Conversation",hint:"The thread this dispatch landed in",route:{view:"conversation",conversationId:e.conversationId}}),(e.flightId||e.sessionId)&&t.push({key:"trace",label:"Live trace",hint:"The session that ran the work",route:{view:"sessions",...e.flightId?{flightId:e.flightId}:{},...e.sessionId?{sessionId:e.sessionId}:{},...e.targetAgentId?{agentId:e.targetAgentId}:{}}}),e.workId&&!s.nativeHost&&t.push({key:"work",label:"Work item",hint:"The collaboration record it belongs to",route:{view:"work",workId:e.workId}}),e.targetAgentId&&t.push({key:"agent",label:"Recipient",hint:"The agent that received it",route:{view:"agents-v2",agentId:e.targetAgentId,tab:"observe"}}),t.length>0&&t.push({key:"tail",label:"Tail",hint:"Raw events for these ids",route:R(e,"tail")}),t}const P={queued:"Queued",dispatched:"Dispatched",running:"Running",succeeded:"Completed",completed:"Completed",failed:"Failed",errored:"Failed",cancelled:"Cancelled",canceled:"Cancelled",timed_out:"Timed out",expired:"Expired"},U=new Set(["failed","errored","timed_out","expired"]),v=new Set(["queued","dispatched","running"]),G=new Set(["succeeded","completed"]);function q(e){if(!e)return null;const s=e.state?.trim().toLowerCase()||"unknown",t=U.has(s)?"danger":v.has(s)?"working":G.has(s)?"success":"neutral",n=e.startedAt&&e.completedAt?Math.max(0,e.completedAt-e.startedAt):null;return{state:s,label:P[s]??s.replace(/_/g," "),tone:t,summary:e.summary?.trim()||null,durationMs:n,settled:!v.has(s)}}function O(e){if(e<1e3)return"instant";const s=Math.round(e/1e3);if(s<60)return`${s}s later`;const t=Math.round(s/60);if(t<60)return`${t}m later`;const n=Math.round(t/60);return n<48?`${n}h later`:`${Math.round(n/24)}d later`}function B(e){if(e<1e3)return`${e}ms`;const s=e/1e3;if(s<60)return`${s.toFixed(s<10?1:0)}s`;const t=Math.floor(s/60),n=Math.round(s%60);return t<60?n>0?`${t}m ${n}s`:`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}const w=180,Q=250,W={loading:!0,target:null,targetUnknown:!1,flight:null,aftermath:{status:"no-conversation"}};function z(e,s){const[t,n]=f.useState(W),[l,u]=f.useState(0),d=f.useRef(0),o=e.conversationId,i=f.useMemo(()=>D(e,s)?.toString()??null,[e,s]);f.useEffect(()=>{const a=++d.current;n(p=>({...p,loading:!0}));const x=i?y(`/api/follow?${i}`).catch(()=>null):Promise.resolve(null),A=o?y(`/api/messages?conversationId=${encodeURIComponent(o)}&limit=${$}`).catch(()=>null):Promise.resolve(null);return(async()=>{const[p,g]=await Promise.all([x,A]);if(a!==d.current)return;const T=p?.flightId?await y(`/api/flights?active=false&flightId=${encodeURIComponent(p.flightId)}`).then(N=>N[0]??null).catch(()=>null):null;a===d.current&&n({loading:!1,target:p,targetUnknown:!!i&&!p,flight:T,aftermath:o?g?F(e,g):{status:"unavailable"}:{status:"no-conversation"}})})(),()=>{d.current+=1}},[e,o,i,l]);const c=f.useRef(null),m=f.useCallback(()=>{c.current||(c.current=setTimeout(()=>{c.current=null,u(a=>a+1)},Q))},[]);f.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const I=t.flight?.id??t.target?.flightId??null;return S(a=>{switch(a.kind){case"message.posted":o&&a.payload.message.conversationId===o&&m();return;case"delivery.state.changed":e.messageId&&a.payload.delivery.messageId===e.messageId&&m();return;case"flight.updated":I&&a.payload.flight.id===I&&m();return}}),{...t,reload:m}}function ie({attempt:e,targetAgentId:s,navigate:t,returnTo:n}){const{loading:l,target:u,targetUnknown:d,flight:o,aftermath:i}=z(e,s),c=q(o),m=u?H(u,{nativeHost:j()}):[],I=f.useCallback(a=>M(t,a,{returnTo:n}),[t,n]);return r.jsxs("section",{className:"sys-broker-aftermath","aria-labelledby":"dispatch-aftermath-title",children:[r.jsxs("div",{className:"sys-broker-aftermath-head",children:[r.jsx("span",{id:"dispatch-aftermath-title",className:"sys-detail-label",children:"What happened next"}),l&&r.jsx(C,{className:"sys-broker-action-spinner",size:12,"aria-hidden":"true"})]}),c&&r.jsxs("div",{className:`sys-broker-aftermath-outcome sys-broker-aftermath-outcome--${c.tone}`,children:[r.jsx("span",{className:`sys-broker-dot sys-broker-dot--${c.tone}`,"aria-hidden":"true"}),r.jsx("strong",{children:c.label}),c.durationMs!==null&&r.jsxs("span",{className:"sys-broker-aftermath-duration",children:["ran ",B(c.durationMs)]}),c.summary&&r.jsx("p",{children:k(c.summary,w)})]}),i.status==="replies"?r.jsxs("ol",{className:"sys-broker-aftermath-replies",children:[i.replies.map(a=>r.jsx("li",{children:r.jsxs("button",{type:"button",className:"sys-broker-aftermath-reply",disabled:!e.conversationId,onClick:()=>e.conversationId&&I({view:"conversation",conversationId:e.conversationId}),children:[r.jsxs("span",{className:"sys-broker-aftermath-reply-head",children:[r.jsx("strong",{children:a.actorName}),a.answersDispatch&&r.jsx("span",{className:"sys-broker-aftermath-answer",children:"reply"}),r.jsx("span",{className:"sys-broker-aftermath-gap",children:O(a.afterMs)})]}),r.jsx("span",{className:"sys-broker-aftermath-reply-body",children:k(a.body,w)})]})},a.id)),i.more>0&&r.jsxs("li",{className:"sys-broker-aftermath-more",children:["+",i.more," more in the thread"]})]}):!l&&r.jsx("p",{className:"sys-broker-aftermath-empty",children:i.status==="no-conversation"?"No conversation followed this dispatch, so there is nothing to open.":i.status==="unavailable"?"The conversation could not be read, so what followed is unknown.":i.status==="beyond-page"?"This dispatch is older than the loaded transcript. Open the conversation to read it in place.":c&&!c.settled?"Still running. Nothing has come back yet.":"Nothing followed this dispatch in its conversation."}),m.length>0?r.jsx("div",{className:"sys-broker-aftermath-links",children:m.map(a=>r.jsxs("button",{type:"button",className:"sys-broker-aftermath-link",title:a.hint,onClick:()=>I(a.route),children:[a.label,r.jsx(L,{size:11,"aria-hidden":"true"})]},a.key))}):!l&&i.status!=="no-conversation"&&r.jsx("p",{className:"sys-broker-aftermath-empty",children:d?"Where this went could not be looked up, so there is nothing to link to yet.":"No session, work item, or recipient could be resolved from this row."}),o?.completedAt&&r.jsxs("div",{className:"sys-broker-aftermath-foot",children:["Settled ",E(o.completedAt)]})]})}export{ie as DispatchAftermath};
1
+ import{r as f,j as r}from"./index-NRbRrZw-.js";import{a as y}from"./api-DEHEgJ9m.js";import{i as j}from"./scoutbot-D4vuKzOL.js";import{u as S}from"./sse-QSbhyq9A.js";import{t as E}from"./time-Dhsh_2EG.js";import{o as M}from"./openContent-C6XO6kr5.js";import{e as k}from"./broker-display-Q75fupqG.js";import{r as R}from"./follow-route-BvcGtBIL.js";import{L as C}from"./loader-circle-Be0T8xv2.js";import{A as L}from"./arrow-up-right-CilNLf4t.js";import"./index-BWHgHrtv.js";import"./status-tone-BM_zuRy1.js";import"./createLucideIcon-Da0lq809.js";const _=3,$=80;function h(e){return Number(e.createdAt)||0}function F(e,s){if(!e.conversationId)return{status:"no-conversation"};const t=s.slice().sort((o,i)=>h(o)-h(i)),n=e.messageId?t.find(o=>o.id===e.messageId)??null:null;let l;if(n){const o=h(n);l=t.filter(i=>i.id!==n.id&&h(i)>=o)}else{const o=t[0];if(o&&h(o)>e.ts)return{status:"beyond-page"};l=t.filter(i=>h(i)>e.ts)}if(l.length===0)return{status:"no-reply"};const u=n?h(n):e.ts,d=l.slice(0,_).map(o=>({id:o.id,actorName:o.actorName||"Unknown",body:o.body??"",createdAt:h(o),afterMs:Math.max(0,h(o)-u),answersDispatch:!!(e.messageId&&o.replyToMessageId===e.messageId)}));return{status:"replies",replies:d,more:Math.max(0,l.length-d.length)}}function b(e,...s){const t=e.metadata??{},n=t.raw&&typeof t.raw=="object"&&!Array.isArray(t.raw)?t.raw:null;for(const l of s)for(const u of[t,n]){const d=u?.[l];if(typeof d=="string"&&d.trim())return d.trim()}return null}function D(e,s){const t=new URLSearchParams,n=e.invocationId??b(e,"invocationId"),l=b(e,"flightId"),u=b(e,"collaborationRecordId","workId","recordId");return l&&t.set("flightId",l),n&&t.set("invocationId",n),e.conversationId&&t.set("conversationId",e.conversationId),u&&t.set("workId",u),s&&t.set("targetAgentId",s),[...t.keys()].length>0?t:null}function H(e,s={}){const t=[];return e.conversationId&&t.push({key:"conversation",label:"Conversation",hint:"The thread this dispatch landed in",route:{view:"conversation",conversationId:e.conversationId}}),(e.flightId||e.sessionId)&&t.push({key:"trace",label:"Live trace",hint:"The session that ran the work",route:{view:"sessions",...e.flightId?{flightId:e.flightId}:{},...e.sessionId?{sessionId:e.sessionId}:{},...e.targetAgentId?{agentId:e.targetAgentId}:{}}}),e.workId&&!s.nativeHost&&t.push({key:"work",label:"Work item",hint:"The collaboration record it belongs to",route:{view:"work",workId:e.workId}}),e.targetAgentId&&t.push({key:"agent",label:"Recipient",hint:"The agent that received it",route:{view:"agents-v2",agentId:e.targetAgentId,tab:"observe"}}),t.length>0&&t.push({key:"tail",label:"Tail",hint:"Raw events for these ids",route:R(e,"tail")}),t}const P={queued:"Queued",dispatched:"Dispatched",running:"Running",succeeded:"Completed",completed:"Completed",failed:"Failed",errored:"Failed",cancelled:"Cancelled",canceled:"Cancelled",timed_out:"Timed out",expired:"Expired"},U=new Set(["failed","errored","timed_out","expired"]),v=new Set(["queued","dispatched","running"]),G=new Set(["succeeded","completed"]);function q(e){if(!e)return null;const s=e.state?.trim().toLowerCase()||"unknown",t=U.has(s)?"danger":v.has(s)?"working":G.has(s)?"success":"neutral",n=e.startedAt&&e.completedAt?Math.max(0,e.completedAt-e.startedAt):null;return{state:s,label:P[s]??s.replace(/_/g," "),tone:t,summary:e.summary?.trim()||null,durationMs:n,settled:!v.has(s)}}function O(e){if(e<1e3)return"instant";const s=Math.round(e/1e3);if(s<60)return`${s}s later`;const t=Math.round(s/60);if(t<60)return`${t}m later`;const n=Math.round(t/60);return n<48?`${n}h later`:`${Math.round(n/24)}d later`}function B(e){if(e<1e3)return`${e}ms`;const s=e/1e3;if(s<60)return`${s.toFixed(s<10?1:0)}s`;const t=Math.floor(s/60),n=Math.round(s%60);return t<60?n>0?`${t}m ${n}s`:`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}const w=180,Q=250,W={loading:!0,target:null,targetUnknown:!1,flight:null,aftermath:{status:"no-conversation"}};function z(e,s){const[t,n]=f.useState(W),[l,u]=f.useState(0),d=f.useRef(0),o=e.conversationId,i=f.useMemo(()=>D(e,s)?.toString()??null,[e,s]);f.useEffect(()=>{const a=++d.current;n(p=>({...p,loading:!0}));const x=i?y(`/api/follow?${i}`).catch(()=>null):Promise.resolve(null),A=o?y(`/api/messages?conversationId=${encodeURIComponent(o)}&limit=${$}`).catch(()=>null):Promise.resolve(null);return(async()=>{const[p,g]=await Promise.all([x,A]);if(a!==d.current)return;const T=p?.flightId?await y(`/api/flights?active=false&flightId=${encodeURIComponent(p.flightId)}`).then(N=>N[0]??null).catch(()=>null):null;a===d.current&&n({loading:!1,target:p,targetUnknown:!!i&&!p,flight:T,aftermath:o?g?F(e,g):{status:"unavailable"}:{status:"no-conversation"}})})(),()=>{d.current+=1}},[e,o,i,l]);const c=f.useRef(null),m=f.useCallback(()=>{c.current||(c.current=setTimeout(()=>{c.current=null,u(a=>a+1)},Q))},[]);f.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const I=t.flight?.id??t.target?.flightId??null;return S(a=>{switch(a.kind){case"message.posted":o&&a.payload.message.conversationId===o&&m();return;case"delivery.state.changed":e.messageId&&a.payload.delivery.messageId===e.messageId&&m();return;case"flight.updated":I&&a.payload.flight.id===I&&m();return}}),{...t,reload:m}}function ie({attempt:e,targetAgentId:s,navigate:t,returnTo:n}){const{loading:l,target:u,targetUnknown:d,flight:o,aftermath:i}=z(e,s),c=q(o),m=u?H(u,{nativeHost:j()}):[],I=f.useCallback(a=>M(t,a,{returnTo:n}),[t,n]);return r.jsxs("section",{className:"sys-broker-aftermath","aria-labelledby":"dispatch-aftermath-title",children:[r.jsxs("div",{className:"sys-broker-aftermath-head",children:[r.jsx("span",{id:"dispatch-aftermath-title",className:"sys-detail-label",children:"What happened next"}),l&&r.jsx(C,{className:"sys-broker-action-spinner",size:12,"aria-hidden":"true"})]}),c&&r.jsxs("div",{className:`sys-broker-aftermath-outcome sys-broker-aftermath-outcome--${c.tone}`,children:[r.jsx("span",{className:`sys-broker-dot sys-broker-dot--${c.tone}`,"aria-hidden":"true"}),r.jsx("strong",{children:c.label}),c.durationMs!==null&&r.jsxs("span",{className:"sys-broker-aftermath-duration",children:["ran ",B(c.durationMs)]}),c.summary&&r.jsx("p",{children:k(c.summary,w)})]}),i.status==="replies"?r.jsxs("ol",{className:"sys-broker-aftermath-replies",children:[i.replies.map(a=>r.jsx("li",{children:r.jsxs("button",{type:"button",className:"sys-broker-aftermath-reply",disabled:!e.conversationId,onClick:()=>e.conversationId&&I({view:"conversation",conversationId:e.conversationId}),children:[r.jsxs("span",{className:"sys-broker-aftermath-reply-head",children:[r.jsx("strong",{children:a.actorName}),a.answersDispatch&&r.jsx("span",{className:"sys-broker-aftermath-answer",children:"reply"}),r.jsx("span",{className:"sys-broker-aftermath-gap",children:O(a.afterMs)})]}),r.jsx("span",{className:"sys-broker-aftermath-reply-body",children:k(a.body,w)})]})},a.id)),i.more>0&&r.jsxs("li",{className:"sys-broker-aftermath-more",children:["+",i.more," more in the thread"]})]}):!l&&r.jsx("p",{className:"sys-broker-aftermath-empty",children:i.status==="no-conversation"?"No conversation followed this dispatch, so there is nothing to open.":i.status==="unavailable"?"The conversation could not be read, so what followed is unknown.":i.status==="beyond-page"?"This dispatch is older than the loaded transcript. Open the conversation to read it in place.":c&&!c.settled?"Still running. Nothing has come back yet.":"Nothing followed this dispatch in its conversation."}),m.length>0?r.jsx("div",{className:"sys-broker-aftermath-links",children:m.map(a=>r.jsxs("button",{type:"button",className:"sys-broker-aftermath-link",title:a.hint,onClick:()=>I(a.route),children:[a.label,r.jsx(L,{size:11,"aria-hidden":"true"})]},a.key))}):!l&&i.status!=="no-conversation"&&r.jsx("p",{className:"sys-broker-aftermath-empty",children:d?"Where this went could not be looked up, so there is nothing to link to yet.":"No session, work item, or recipient could be resolved from this row."}),o?.completedAt&&r.jsxs("div",{className:"sys-broker-aftermath-foot",children:["Settled ",E(o.completedAt)]})]})}export{ie as DispatchAftermath};
@@ -1 +1 @@
1
- import{c as u}from"./createLucideIcon-DLlxGjKt.js";import{r,j as e}from"./index-Bli6bTLU.js";import{T as H}from"./TextDocumentSurface-C7fGlzY8.js";import{F as A}from"./file-text-BVhkMWyC.js";import{X as R}from"./x-BJyPzFnn.js";const S=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Z=u("folder-open",S);const W=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],G=u("folder",W);const B=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],T=u("maximize-2",B);const V=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],C=u("minimize-2",V);function J({open:a=!0,focusable:M=!0,kind:F,document:t,title:z,eyebrow:v,subtitle:w,meta:x=[],mode:$,actions:L=[],state:j,error:c,notice:p,body:d,onClose:o}){const[i,m]=r.useState(!1),[g,y]=r.useState({}),b=r.useRef(null);if(r.useEffect(()=>{a||m(!1)},[a]),r.useEffect(()=>{if(!a)return;let s=null;const l=b.current?.closest(".frame-scrollbar, .s-content")??null,N=()=>{if(!l){y({});return}const n=l.getBoundingClientRect();y({"--doc-focus-layer-top":`${Math.max(0,n.top)}px`,"--doc-focus-layer-right":`${Math.max(0,window.innerWidth-n.right)}px`,"--doc-focus-layer-bottom":`${Math.max(0,window.innerHeight-n.bottom)}px`,"--doc-focus-layer-left":`${Math.max(0,n.left)}px`})},h=()=>{s!==null&&cancelAnimationFrame(s),s=requestAnimationFrame(N)};N();const E=l?new ResizeObserver(h):null;return l&&E?.observe(l),window.addEventListener("resize",h),()=>{s!==null&&cancelAnimationFrame(s),E?.disconnect(),window.removeEventListener("resize",h)}},[a]),r.useEffect(()=>{if(!a)return;const s=f=>{f.key==="Escape"&&(f.preventDefault(),i?m(!1):o?.())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[i,o,a]),!a)return null;const k=z??t?.title??"Document",D=$??(t?.kind==="markdown"?"preview":"read"),_=M&&!!(t||d);return e.jsxs("div",{ref:b,className:`s-doc-focus-layer${i?" s-doc-focus-layer-focused":""}`,style:g,children:[o&&e.jsx("button",{type:"button",className:"s-doc-focus-scrim","aria-label":"Dismiss document viewer",tabIndex:-1,onClick:o}),e.jsxs("section",{className:`s-doc-focus-viewer s-doc-focus-viewer-${F}${i?" s-doc-focus-viewer-focused":""}`,"aria-label":k,role:"dialog","aria-modal":"true",children:[e.jsxs("div",{className:"s-doc-focus-viewer-head",children:[e.jsxs("div",{className:"s-doc-focus-viewer-title-wrap",children:[e.jsx("div",{className:"s-doc-focus-viewer-icon","aria-hidden":"true",children:e.jsx(A,{size:15,strokeWidth:1.8})}),e.jsxs("div",{className:"s-doc-focus-viewer-title-main",children:[v&&e.jsx("div",{className:"s-doc-focus-viewer-eyebrow",children:v}),e.jsx("h3",{className:"s-doc-focus-viewer-title",children:k}),w&&e.jsx("div",{className:"s-doc-focus-viewer-subtitle",children:w})]})]}),e.jsxs("div",{className:"s-doc-focus-viewer-actions",children:[x.length>0&&e.jsx("div",{className:"s-doc-focus-viewer-meta","aria-label":"Document metadata",children:x.map(s=>e.jsx("span",{children:s},s))}),L.map(s=>e.jsxs("button",{type:"button",className:`s-doc-focus-viewer-action${s.hideLabel?" s-doc-focus-viewer-action-icon":""}`,onClick:s.onClick,title:s.title??s.label,disabled:s.disabled,"aria-label":s.hideLabel?s.label:void 0,children:[s.icon,!s.hideLabel&&e.jsx("span",{children:s.label})]},s.label)),_&&e.jsx("button",{type:"button",className:"s-doc-focus-viewer-close",onClick:()=>m(s=>!s),"aria-label":i?"Exit focus mode":"Enter focus mode",title:i?"Exit focus mode":"Focus",children:i?e.jsx(C,{"aria-hidden":"true",size:14,strokeWidth:1.8}):e.jsx(T,{"aria-hidden":"true",size:14,strokeWidth:1.8})}),o&&e.jsx("button",{type:"button",className:"s-doc-focus-viewer-close",onClick:o,"aria-label":"Close document viewer",title:"Close",children:e.jsx(R,{"aria-hidden":"true",size:14,strokeWidth:1.8})})]})]}),j&&!c&&!t&&!d&&e.jsx("div",{className:"s-doc-focus-viewer-state",children:j}),c&&e.jsx("div",{className:"s-doc-focus-viewer-state s-doc-focus-viewer-error",children:c}),!c&&d&&e.jsx("div",{className:"s-doc-focus-viewer-body",children:d}),!c&&!d&&t&&e.jsx(H,{document:t,mode:D,showHeader:!1,className:"s-doc-focus-document"}),!c&&p&&e.jsx("div",{className:"s-doc-focus-viewer-notice",children:p})]})]})}export{J as D,G as F,T as M,Z as a,C as b};
1
+ import{c as u}from"./createLucideIcon-Da0lq809.js";import{r,j as e}from"./index-NRbRrZw-.js";import{T as H}from"./TextDocumentSurface-B29xZNlI.js";import{F as A}from"./file-text-BGVkHS4_.js";import{X as R}from"./x-DuzAbpk5.js";const S=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Z=u("folder-open",S);const W=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],G=u("folder",W);const B=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],T=u("maximize-2",B);const V=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],C=u("minimize-2",V);function J({open:a=!0,focusable:M=!0,kind:F,document:t,title:z,eyebrow:v,subtitle:w,meta:x=[],mode:$,actions:L=[],state:j,error:c,notice:p,body:d,onClose:o}){const[i,m]=r.useState(!1),[g,y]=r.useState({}),b=r.useRef(null);if(r.useEffect(()=>{a||m(!1)},[a]),r.useEffect(()=>{if(!a)return;let s=null;const l=b.current?.closest(".frame-scrollbar, .s-content")??null,N=()=>{if(!l){y({});return}const n=l.getBoundingClientRect();y({"--doc-focus-layer-top":`${Math.max(0,n.top)}px`,"--doc-focus-layer-right":`${Math.max(0,window.innerWidth-n.right)}px`,"--doc-focus-layer-bottom":`${Math.max(0,window.innerHeight-n.bottom)}px`,"--doc-focus-layer-left":`${Math.max(0,n.left)}px`})},h=()=>{s!==null&&cancelAnimationFrame(s),s=requestAnimationFrame(N)};N();const E=l?new ResizeObserver(h):null;return l&&E?.observe(l),window.addEventListener("resize",h),()=>{s!==null&&cancelAnimationFrame(s),E?.disconnect(),window.removeEventListener("resize",h)}},[a]),r.useEffect(()=>{if(!a)return;const s=f=>{f.key==="Escape"&&(f.preventDefault(),i?m(!1):o?.())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[i,o,a]),!a)return null;const k=z??t?.title??"Document",D=$??(t?.kind==="markdown"?"preview":"read"),_=M&&!!(t||d);return e.jsxs("div",{ref:b,className:`s-doc-focus-layer${i?" s-doc-focus-layer-focused":""}`,style:g,children:[o&&e.jsx("button",{type:"button",className:"s-doc-focus-scrim","aria-label":"Dismiss document viewer",tabIndex:-1,onClick:o}),e.jsxs("section",{className:`s-doc-focus-viewer s-doc-focus-viewer-${F}${i?" s-doc-focus-viewer-focused":""}`,"aria-label":k,role:"dialog","aria-modal":"true",children:[e.jsxs("div",{className:"s-doc-focus-viewer-head",children:[e.jsxs("div",{className:"s-doc-focus-viewer-title-wrap",children:[e.jsx("div",{className:"s-doc-focus-viewer-icon","aria-hidden":"true",children:e.jsx(A,{size:15,strokeWidth:1.8})}),e.jsxs("div",{className:"s-doc-focus-viewer-title-main",children:[v&&e.jsx("div",{className:"s-doc-focus-viewer-eyebrow",children:v}),e.jsx("h3",{className:"s-doc-focus-viewer-title",children:k}),w&&e.jsx("div",{className:"s-doc-focus-viewer-subtitle",children:w})]})]}),e.jsxs("div",{className:"s-doc-focus-viewer-actions",children:[x.length>0&&e.jsx("div",{className:"s-doc-focus-viewer-meta","aria-label":"Document metadata",children:x.map(s=>e.jsx("span",{children:s},s))}),L.map(s=>e.jsxs("button",{type:"button",className:`s-doc-focus-viewer-action${s.hideLabel?" s-doc-focus-viewer-action-icon":""}`,onClick:s.onClick,title:s.title??s.label,disabled:s.disabled,"aria-label":s.hideLabel?s.label:void 0,children:[s.icon,!s.hideLabel&&e.jsx("span",{children:s.label})]},s.label)),_&&e.jsx("button",{type:"button",className:"s-doc-focus-viewer-close",onClick:()=>m(s=>!s),"aria-label":i?"Exit focus mode":"Enter focus mode",title:i?"Exit focus mode":"Focus",children:i?e.jsx(C,{"aria-hidden":"true",size:14,strokeWidth:1.8}):e.jsx(T,{"aria-hidden":"true",size:14,strokeWidth:1.8})}),o&&e.jsx("button",{type:"button",className:"s-doc-focus-viewer-close",onClick:o,"aria-label":"Close document viewer",title:"Close",children:e.jsx(R,{"aria-hidden":"true",size:14,strokeWidth:1.8})})]})]}),j&&!c&&!t&&!d&&e.jsx("div",{className:"s-doc-focus-viewer-state",children:j}),c&&e.jsx("div",{className:"s-doc-focus-viewer-state s-doc-focus-viewer-error",children:c}),!c&&d&&e.jsx("div",{className:"s-doc-focus-viewer-body",children:d}),!c&&!d&&t&&e.jsx(H,{document:t,mode:D,showHeader:!1,className:"s-doc-focus-document"}),!c&&p&&e.jsx("div",{className:"s-doc-focus-viewer-notice",children:p})]})]})}export{J as D,G as F,T as M,Z as a,C as b};
@@ -1 +1 @@
1
- import{r as l,j as e}from"./index-Bli6bTLU.js";import{l as c}from"./discover-DOlk1hG7.js";import"./types-B0PlfpKc.js";function n(){const[r,a]=l.useState([]);return l.useEffect(()=>{let s=!1;return c().then(d=>{s||a(d)}),()=>{s=!0}},[]),e.jsxs("div",{className:"s-embeddable-surfaces-lab","data-scout-theme":!0,children:[e.jsxs("header",{className:"s-embeddable-surfaces-lab__header",children:[e.jsx("h1",{children:"Embeddable surfaces"}),e.jsxs("p",{children:["Screens that exported ",e.jsx("code",{children:"scoutSurface.embed"})," and were discovered from"," ",e.jsx("code",{children:"client/screens/**"}),". No separate embed registry file — parity comes from the screen declaration."]})]}),e.jsxs("table",{className:"s-embeddable-surfaces-lab__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"ID"}),e.jsx("th",{children:"Label"}),e.jsx("th",{children:"Web"}),e.jsx("th",{children:"Embed"}),e.jsx("th",{children:"Profile"}),e.jsx("th",{children:"Module"})]})}),e.jsx("tbody",{children:r.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{children:s.id})}),e.jsx("td",{children:s.label}),e.jsx("td",{children:e.jsx("a",{href:s.webPath,children:s.webPath})}),e.jsxs("td",{children:[e.jsx("div",{children:e.jsx("a",{href:s.embedPath,children:s.embedPath})}),s.embedAliases.length>0&&e.jsx("div",{className:"s-embeddable-surfaces-lab__aliases",children:s.embedAliases.map(d=>e.jsx("a",{href:d,children:d},d))})]}),e.jsx("td",{children:e.jsx("code",{children:s.profile})}),e.jsx("td",{children:e.jsx("code",{children:s.modulePath.replace("../","")})})]},s.id))})]}),r.length===0&&e.jsx("p",{className:"s-embeddable-surfaces-lab__empty",children:"No embeddable screens discovered yet."})]})}export{n as EmbeddableSurfacesLab};
1
+ import{r as l,j as e}from"./index-NRbRrZw-.js";import{l as c}from"./discover-DdkMhTAV.js";import"./types-B0PlfpKc.js";function n(){const[r,a]=l.useState([]);return l.useEffect(()=>{let s=!1;return c().then(d=>{s||a(d)}),()=>{s=!0}},[]),e.jsxs("div",{className:"s-embeddable-surfaces-lab","data-scout-theme":!0,children:[e.jsxs("header",{className:"s-embeddable-surfaces-lab__header",children:[e.jsx("h1",{children:"Embeddable surfaces"}),e.jsxs("p",{children:["Screens that exported ",e.jsx("code",{children:"scoutSurface.embed"})," and were discovered from"," ",e.jsx("code",{children:"client/screens/**"}),". No separate embed registry file — parity comes from the screen declaration."]})]}),e.jsxs("table",{className:"s-embeddable-surfaces-lab__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"ID"}),e.jsx("th",{children:"Label"}),e.jsx("th",{children:"Web"}),e.jsx("th",{children:"Embed"}),e.jsx("th",{children:"Profile"}),e.jsx("th",{children:"Module"})]})}),e.jsx("tbody",{children:r.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{children:s.id})}),e.jsx("td",{children:s.label}),e.jsx("td",{children:e.jsx("a",{href:s.webPath,children:s.webPath})}),e.jsxs("td",{children:[e.jsx("div",{children:e.jsx("a",{href:s.embedPath,children:s.embedPath})}),s.embedAliases.length>0&&e.jsx("div",{className:"s-embeddable-surfaces-lab__aliases",children:s.embedAliases.map(d=>e.jsx("a",{href:d,children:d},d))})]}),e.jsx("td",{children:e.jsx("code",{children:s.profile})}),e.jsx("td",{children:e.jsx("code",{children:s.modulePath.replace("../","")})})]},s.id))})]}),r.length===0&&e.jsx("p",{className:"s-embeddable-surfaces-lab__empty",children:"No embeddable screens discovered yet."})]})}export{n as EmbeddableSurfacesLab};
@@ -1 +1 @@
1
- import{j as e}from"./index-Bli6bTLU.js";function c({title:n,body:s,icon:i,action:t,className:a}){const l=a?`sys-panel sys-state-card ${a}`:"sys-panel sys-state-card";return e.jsxs("div",{className:l,children:[i,e.jsx("h3",{className:"sys-state-title",children:n}),s!=null&&(typeof s=="string"?e.jsx("p",{className:"sys-state-body",children:s}):s),t&&e.jsx("div",{className:"sys-inline-actions",children:t})]})}export{c as E};
1
+ import{j as e}from"./index-NRbRrZw-.js";function c({title:n,body:s,icon:i,action:t,className:a}){const l=a?`sys-panel sys-state-card ${a}`:"sys-panel sys-state-card";return e.jsxs("div",{className:l,children:[i,e.jsx("h3",{className:"sys-state-title",children:n}),s!=null&&(typeof s=="string"?e.jsx("p",{className:"sys-state-body",children:s}):s),t&&e.jsx("div",{className:"sys-inline-actions",children:t})]})}export{c as E};
@@ -1,3 +1,3 @@
1
- import{r as n,j as t}from"./index-Bli6bTLU.js";import{T as b,c as j}from"./TextDocumentSurface-C7fGlzY8.js";import{a as N}from"./api-DEHEgJ9m.js";function V(e,a,u){const o=e.relativePath.endsWith(".md")||e.relativePath.endsWith(".mdx"),s=e.relativePath.endsWith(".json");return j({id:e.absolutePath,title:e.relativePath,uri:e.absolutePath,filename:e.relativePath.split("/").pop(),kind:o?"markdown":"code",language:s?"json":o?"markdown":"plain",value:u?`${a}
1
+ import{r as n,j as t}from"./index-NRbRrZw-.js";import{T as b,c as j}from"./TextDocumentSurface-B29xZNlI.js";import{a as N}from"./api-DEHEgJ9m.js";function V(e,a,u){const o=e.relativePath.endsWith(".md")||e.relativePath.endsWith(".mdx"),s=e.relativePath.endsWith(".json");return j({id:e.absolutePath,title:e.relativePath,uri:e.absolutePath,filename:e.relativePath.split("/").pop(),kind:o?"markdown":"code",language:s?"json":o?"markdown":"plain",value:u?`${a}
2
2
 
3
3
  — excerpt —`:a,readOnly:!0})}function y({artifact:e,onOpen:a,onReveal:u,onBrowse:o}){const[s,l]=n.useState(e.excerpt),[c,i]=n.useState(!0),[w,h]=n.useState(!1),[m,p]=n.useState(null);n.useEffect(()=>{l(e.excerpt),i(!0),p(null);let d=!1;return h(!0),N(`/api/file/preview?path=${encodeURIComponent(e.absolutePath)}`).then(r=>{if(!d)if(r.kind==="file"&&r.previewable){const x=r;l(x.content),i(x.truncated)}else e.excerpt?(l(e.excerpt),i(!0)):(l(null),p("Preview not available for this file type."))}).catch(r=>{d||(e.excerpt?(l(e.excerpt),i(!0)):p(r instanceof Error?r.message:"Could not load file."))}).finally(()=>{d||h(!1)}),()=>{d=!0}},[e.absolutePath,e.excerpt]);const v=n.useMemo(()=>s?V(e,s,c):null,[e,s,c]),P=e.relativePath.endsWith(".md")||e.relativePath.endsWith(".mdx");return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"av2-repoViewerHead",children:[t.jsxs("div",{className:"av2-repoViewerPath",children:[t.jsx("span",{className:"av2-repoViewerPathFile",children:e.relativePath}),t.jsx("span",{className:"av2-repoViewerPathAbs",title:e.absolutePath,children:e.absolutePath})]}),t.jsxs("div",{className:"av2-repoViewerActs",children:[t.jsx("button",{type:"button",className:"av2-repoViewerAct","data-primary":!0,onClick:()=>a(e.absolutePath),children:"open"}),o?t.jsx("button",{type:"button",className:"av2-repoViewerAct",onClick:()=>o(e.absolutePath),children:"browse"}):null,t.jsx("button",{type:"button",className:"av2-repoViewerAct",onClick:()=>{u(e.absolutePath)},children:"reveal"})]})]}),t.jsxs("div",{className:"av2-repoViewerBody",children:[w&&!s?t.jsx("div",{className:"av2-repoViewerState",children:"Loading file…"}):m&&!s?t.jsx("div",{className:"av2-repoViewerState av2-repoViewerState--error",children:m}):v?t.jsx(b,{document:v,mode:P?"preview":"read",className:"av2-repoViewerDoc"}):t.jsx("div",{className:"av2-repoViewerState",children:"No content."}),c?t.jsx("div",{className:"av2-repoViewerNotice",children:"Showing excerpt — use open for the full file."}):null]})]})}export{y as FileViewerPane};
@@ -1 +1 @@
1
- import{r as c,j as s}from"./index-Bli6bTLU.js";import{a as k}from"./api-DEHEgJ9m.js";import{u as R}from"./sse-CSozY6mp.js";import{d as $,t as F}from"./time-Dhsh_2EG.js";import{SessionRefScreen as j}from"./SessionRefScreen-BmKhf29o.js";/* empty css */import{c as E}from"./createLucideIcon-DLlxGjKt.js";import{X as A}from"./x-BJyPzFnn.js";import"./index-BWHgHrtv.js";import"./tail-events-CrN-Rmxj.js";import"./BackToPicker-CqYhOaLB.js";import"./router-B0YclXYg.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-D4dHTRkt.js";import"./ConversationScreen-CjWWmuuh.js";import"./NewChatComposer-Bgqes0UQ.js";import"./text-BR9Bap0E.js";import"./scout-voice-DvG_3stJ.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-DoT8gpw6.js";import"./conversation-model-CigSPlKA.js";import"./colors-BtO5_zlx.js";import"./index-DFdlQs_c.js";import"./HarnessMark-DGZ6o6Ct.js";import"./NewChatOrigin-DpHS2Wmt.js";import"./keyboard-nav-7iEtvu9P.js";import"./chevron-down-Da5tV19_.js";import"./search-BbgsEMXa.js";import"./file-text-BVhkMWyC.js";import"./ConversationComposer-Ce7Byw48.js";import"./AgentAvatar-B1xvQ7ej.js";import"./Provider-Ve8yXaWR.js";import"./provider-CX9EWecp.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-D4vuKzOL.js";import"./DocumentFocusViewer-DmtFisY9.js";import"./TextDocumentSurface-C7fGlzY8.js";import"./chevron-right-BMqtBds_.js";import"./code-xml-ByQsfOI_.js";import"./arrow-left-i-h6JAgs.js";import"./arrow-right-B0Yi01Zr.js";import"./chunk-HRAB3GC3-BUVYXXAp.js";import"./SpriteAvatar-DMrSssNZ.js";import"./agent-identity-DzHGhLdJ.js";import"./zap-rw7uwZht.js";import"./message-markup-DAnnGpWr.js";import"./mentions-Cd6XticV.js";import"./AgentDetailCard-FelCxQrT.js";import"./AgentLiveActions-Bn3zeZBN.js";import"./terminal-takeover-CtA3wcXh.js";import"./openContent-C6XO6kr5.js";import"./eye-BeCSqJn1.js";import"./terminal-BiNIXhna.js";import"./message-visibility-kJM8XcSG.js";import"./sessionRead-CvFz2RHv.js";import"./clipboard-e3fSpeo7.js";import"./types-B0PlfpKc.js";/* empty css */import"./ConversationHeader-C3sg0ULI.js";import"./AstronautSuit-BADl7m8x.js";import"./ConversationFeedRows-DygDfQn_.js";import"./ConversationPanels-Dg4Y2GgX.js";import"./tail-display-DcliDVkW.js";import"./lane-edit-display-C_Aujldz.js";import"./use-reduced-motion-BLn59zLn.js";import"./proxy-C35W-YHZ.js";import"./activity-D4W2XZY2.js";import"./message-circle-44KSmbvQ.js";import"./ConversationStatus-BhVIYQza.js";import"./check-Bfs7hMb1.js";import"./sparkles-ytTwpCbZ.js";import"./SessionObserve-zAlFbwFn.js";import"./bash-format-BRV5C6Gv.js";import"./lane-tool-detail-0WhMf4Vj.js";import"./LaneToolHoverCard-197xYmRp.js";import"./lane-observe-vfyACHi0.js";import"./lane-ask-display-B6iCAVcd.js";import"./ObservedTopologyPanel-D85P6RAk.js";import"./ObserveTextFlow-C1f5oize.js";import"./SessionObserveEvidence-BVawzqoE.js";import"./wrench-CQvdf7KT.js";import"./external-link-BGHC_naA.js";/* empty css */const T=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],L=E("columns-2",T);function S(t){const o=new Map;for(const r of t)o.delete(r.sessionId),o.set(r.sessionId,r);return[...o.values()]}function M(t,o){const r=S(t),p=o?.trim()||null;return r.find(n=>n.sessionId===p)?.sessionId??r.at(-1)?.sessionId??p}function O(t){return t.length<=34?t:`${t.slice(0,15)}…${t.slice(-14)}`}function q(t,o){return o===0?t.strategy||"dispatch":t.strategy?`switched via ${t.strategy}`:"session changed"}function y({label:t,sessions:o,value:r,onChange:p}){return s.jsxs("label",{className:"s-flight-observe-select-wrap",children:[s.jsx("span",{children:t}),s.jsx("select",{className:"s-flight-observe-select",value:r,onChange:n=>p(n.currentTarget.value),children:o.map(n=>s.jsxs("option",{value:n.sessionId,children:[n.harness?`${n.harness} · `:"",n.sessionId]},n.sessionId))})]})}function ge({route:t,navigate:o}){const[r,p]=c.useState(null),[n,I]=c.useState(!0),[h,N]=c.useState(null),u=c.useCallback(async()=>{try{const e=await k(`/api/flights?active=false&flightId=${encodeURIComponent(t.flightId)}`);p(e[0]??null),N(e.length===0?"This flight is not available on the connected broker.":null)}catch(e){N(e instanceof Error?e.message:String(e))}finally{I(!1)}},[t.flightId]);c.useEffect(()=>{I(!0),u()},[u]),R(()=>{u()});const v=r?.sessions??[],a=c.useMemo(()=>S(v),[v]),g=M(v,t.sessionId),i=a.find(e=>e.sessionId===g)??null,l=a.find(e=>e.sessionId===t.compareSessionId)??null,f=!!(i&&l&&i.sessionId!==l.sessionId),m=c.useCallback((e,d)=>{o({...t,sessionId:e,...d?{compareSessionId:d}:{compareSessionId:void 0}})},[o,t]),w=c.useCallback(()=>{if(!i||a.length<2)return;const e=[...a].reverse().find(d=>d.sessionId!==i.sessionId);e&&m(i.sessionId,e.sessionId)},[i,a,m]),C=c.useCallback(e=>{if(!f||!i||!l){m(e);return}m(e,e===l.sessionId?i.sessionId:l.sessionId)},[l,i,f,m]);return s.jsxs("div",{className:"s-flight-observe",children:[s.jsxs("header",{className:"s-flight-observe-header",children:[s.jsxs("div",{className:"s-flight-observe-heading",children:[s.jsx("div",{className:"s-flight-observe-eyebrow",children:"Flight observe"}),s.jsxs("div",{className:"s-flight-observe-title-row",children:[s.jsx("h2",{children:r?.agentName||r?.agentId||"Flight"}),s.jsx("span",{className:`s-flight-observe-state s-flight-observe-state--${r?.state??"loading"}`,children:r?.state??(n?"loading":"unknown")})]}),s.jsx("div",{className:"s-flight-observe-id",title:t.flightId,children:t.flightId}),r?.summary&&s.jsx("p",{children:r.summary})]}),s.jsxs("div",{className:"s-flight-observe-actions",children:[a.length>1&&!f&&s.jsxs("button",{type:"button",onClick:w,children:[s.jsx(L,{size:13})," Split view"]}),f&&i&&s.jsxs("button",{type:"button",onClick:()=>m(i.sessionId),children:[s.jsx(A,{size:13})," Close split"]})]})]}),v.length>0&&s.jsx("nav",{className:"s-flight-observe-trace","aria-label":"Flight session history",children:v.map((e,d)=>{const b=i?.sessionId===e.sessionId,x=l?.sessionId===e.sessionId;return s.jsxs("div",{className:"s-flight-observe-trace-step",children:[d>0&&s.jsx("span",{className:"s-flight-observe-trace-arrow","aria-hidden":"true",children:"→"}),s.jsxs("button",{type:"button",className:"s-flight-observe-session-chip","data-selected":b||x,"data-observe-role":b?"primary":x?"compare":"idle","aria-pressed":b||x,title:e.sessionId,onClick:()=>C(e.sessionId),children:[s.jsxs("span",{className:"s-flight-observe-session-chip-top",children:[s.jsx("span",{children:e.harness||e.transport||"session"}),s.jsx("time",{title:new Date(e.startedAt).toLocaleString(),children:$(e.startedAt)||F(e.startedAt)})]}),s.jsx("strong",{children:O(e.sessionId)}),s.jsx("small",{children:q(e,d)})]})]},`${e.sessionId}:${e.startedAt}:${d}`)})}),h&&!g&&s.jsx("div",{className:"s-flight-observe-message s-flight-observe-message--error",children:h}),h&&g&&s.jsxs("div",{className:"s-flight-observe-message",children:[s.jsx("strong",{children:"Flight record unavailable"}),s.jsx("span",{children:"Showing the concrete session captured by this link."})]}),!h&&n&&s.jsx("div",{className:"s-flight-observe-message",children:"Resolving the flight’s session trace…"}),!h&&!n&&a.length===0&&!g&&s.jsxs("div",{className:"s-flight-observe-message",children:[s.jsx("strong",{children:"Waiting for a session"}),s.jsx("span",{children:"The flight is stable here; its trace will appear as soon as a harness acknowledges dispatch."})]}),g&&!f&&s.jsx("main",{className:"s-flight-observe-single",children:s.jsx(j,{sessionRef:g,navigate:o})}),!h&&i&&l&&f&&s.jsxs("main",{className:"s-flight-observe-split",children:[s.jsxs("section",{className:"s-flight-observe-pane",children:[s.jsx(y,{label:"Primary session",sessions:a,value:i.sessionId,onChange:e=>m(e,e===l.sessionId?i.sessionId:l.sessionId)}),s.jsx("div",{className:"s-flight-observe-pane-content",children:s.jsx(j,{sessionRef:i.sessionId,navigate:o,showObserveRail:!1})})]}),s.jsxs("section",{className:"s-flight-observe-pane",children:[s.jsx(y,{label:"Compare session",sessions:a.filter(e=>e.sessionId!==i.sessionId),value:l.sessionId,onChange:e=>m(i.sessionId,e)}),s.jsx("div",{className:"s-flight-observe-pane-content",children:s.jsx(j,{sessionRef:l.sessionId,navigate:o,showObserveRail:!1})})]})]})]})}export{ge as FlightObserveScreen};
1
+ import{r as c,j as s}from"./index-NRbRrZw-.js";import{a as k}from"./api-DEHEgJ9m.js";import{u as R}from"./sse-QSbhyq9A.js";import{d as $,t as F}from"./time-Dhsh_2EG.js";import{SessionRefScreen as j}from"./SessionRefScreen-UVNVrwAf.js";/* empty css */import{c as E}from"./createLucideIcon-Da0lq809.js";import{X as A}from"./x-DuzAbpk5.js";import"./index-BWHgHrtv.js";import"./tail-events-B7BrDaFi.js";import"./BackToPicker-CXsbxbHM.js";import"./router-Bx1tiwVe.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-D4dHTRkt.js";import"./ConversationScreen-D77SoLos.js";import"./NewChatComposer-BPsg8shF.js";import"./text-B2UZi3l9.js";import"./scout-voice-BT3gYDhU.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-Be0T8xv2.js";import"./conversation-model-CIzM7aXT.js";import"./colors-BtO5_zlx.js";import"./index-CD2foMB8.js";import"./HarnessMark-CEzmPFHC.js";import"./NewChatOrigin-CCiPg_WR.js";import"./keyboard-nav-feLCB3Zm.js";import"./chevron-down-Jh540uf3.js";import"./search-HmdKXdtR.js";import"./file-text-BGVkHS4_.js";import"./ConversationComposer-DPWu3HvK.js";import"./AgentAvatar-CQqJcwOQ.js";import"./Provider-Cd-QZltN.js";import"./provider-Bq0ScH3v.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-D4vuKzOL.js";import"./DocumentFocusViewer-CetjnYut.js";import"./TextDocumentSurface-B29xZNlI.js";import"./chevron-right-CV7sEVBS.js";import"./code-xml-CPzpZkhu.js";import"./arrow-left-B0CdJdAC.js";import"./arrow-right-YRBoTTyf.js";import"./chunk-HRAB3GC3-BYQZ1LOn.js";import"./SpriteAvatar-vpHO-rXs.js";import"./agent-identity-CIMT7oV6.js";import"./zap-CocRNtyr.js";import"./message-markup-BP2nH9kQ.js";import"./mentions-KNASbAjG.js";import"./AgentDetailCard-2DZQahiN.js";import"./AgentLiveActions-BmXDRxER.js";import"./terminal-takeover-BArLfNtd.js";import"./openContent-C6XO6kr5.js";import"./eye-B908WSFH.js";import"./terminal-DNZTCr6a.js";import"./message-visibility-kJM8XcSG.js";import"./sessionRead-CvFz2RHv.js";import"./clipboard-e3fSpeo7.js";import"./types-B0PlfpKc.js";/* empty css */import"./ConversationHeader-Ce7TENb9.js";import"./AstronautSuit-C05Ezxl9.js";import"./ConversationFeedRows-MhcPfxUr.js";import"./ConversationPanels-D-b5SLO-.js";import"./tail-display-DcliDVkW.js";import"./lane-edit-display-C_Aujldz.js";import"./use-reduced-motion-0fAsybdo.js";import"./proxy-DtC2iXnT.js";import"./activity-DTqqWiyV.js";import"./message-circle-2v9Udia0.js";import"./ConversationStatus-lIvSKRic.js";import"./check-BdovFDz8.js";import"./sparkles-CgTby-ap.js";import"./SessionObserve-pbozyqVv.js";import"./bash-format-BRV5C6Gv.js";import"./lane-tool-detail-0WhMf4Vj.js";import"./LaneToolHoverCard-DCY-m0JK.js";import"./lane-observe-vfyACHi0.js";import"./lane-ask-display-B6iCAVcd.js";import"./ObservedTopologyPanel-CfHYu-4Z.js";import"./ObserveTextFlow-CKYltTPJ.js";import"./SessionObserveEvidence-C54Xvbps.js";import"./wrench-DwFKomxg.js";import"./external-link-BheHazeW.js";/* empty css */const T=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],L=E("columns-2",T);function S(t){const o=new Map;for(const r of t)o.delete(r.sessionId),o.set(r.sessionId,r);return[...o.values()]}function M(t,o){const r=S(t),p=o?.trim()||null;return r.find(n=>n.sessionId===p)?.sessionId??r.at(-1)?.sessionId??p}function O(t){return t.length<=34?t:`${t.slice(0,15)}…${t.slice(-14)}`}function q(t,o){return o===0?t.strategy||"dispatch":t.strategy?`switched via ${t.strategy}`:"session changed"}function y({label:t,sessions:o,value:r,onChange:p}){return s.jsxs("label",{className:"s-flight-observe-select-wrap",children:[s.jsx("span",{children:t}),s.jsx("select",{className:"s-flight-observe-select",value:r,onChange:n=>p(n.currentTarget.value),children:o.map(n=>s.jsxs("option",{value:n.sessionId,children:[n.harness?`${n.harness} · `:"",n.sessionId]},n.sessionId))})]})}function ge({route:t,navigate:o}){const[r,p]=c.useState(null),[n,I]=c.useState(!0),[h,N]=c.useState(null),u=c.useCallback(async()=>{try{const e=await k(`/api/flights?active=false&flightId=${encodeURIComponent(t.flightId)}`);p(e[0]??null),N(e.length===0?"This flight is not available on the connected broker.":null)}catch(e){N(e instanceof Error?e.message:String(e))}finally{I(!1)}},[t.flightId]);c.useEffect(()=>{I(!0),u()},[u]),R(()=>{u()});const v=r?.sessions??[],a=c.useMemo(()=>S(v),[v]),g=M(v,t.sessionId),i=a.find(e=>e.sessionId===g)??null,l=a.find(e=>e.sessionId===t.compareSessionId)??null,f=!!(i&&l&&i.sessionId!==l.sessionId),m=c.useCallback((e,d)=>{o({...t,sessionId:e,...d?{compareSessionId:d}:{compareSessionId:void 0}})},[o,t]),w=c.useCallback(()=>{if(!i||a.length<2)return;const e=[...a].reverse().find(d=>d.sessionId!==i.sessionId);e&&m(i.sessionId,e.sessionId)},[i,a,m]),C=c.useCallback(e=>{if(!f||!i||!l){m(e);return}m(e,e===l.sessionId?i.sessionId:l.sessionId)},[l,i,f,m]);return s.jsxs("div",{className:"s-flight-observe",children:[s.jsxs("header",{className:"s-flight-observe-header",children:[s.jsxs("div",{className:"s-flight-observe-heading",children:[s.jsx("div",{className:"s-flight-observe-eyebrow",children:"Flight observe"}),s.jsxs("div",{className:"s-flight-observe-title-row",children:[s.jsx("h2",{children:r?.agentName||r?.agentId||"Flight"}),s.jsx("span",{className:`s-flight-observe-state s-flight-observe-state--${r?.state??"loading"}`,children:r?.state??(n?"loading":"unknown")})]}),s.jsx("div",{className:"s-flight-observe-id",title:t.flightId,children:t.flightId}),r?.summary&&s.jsx("p",{children:r.summary})]}),s.jsxs("div",{className:"s-flight-observe-actions",children:[a.length>1&&!f&&s.jsxs("button",{type:"button",onClick:w,children:[s.jsx(L,{size:13})," Split view"]}),f&&i&&s.jsxs("button",{type:"button",onClick:()=>m(i.sessionId),children:[s.jsx(A,{size:13})," Close split"]})]})]}),v.length>0&&s.jsx("nav",{className:"s-flight-observe-trace","aria-label":"Flight session history",children:v.map((e,d)=>{const b=i?.sessionId===e.sessionId,x=l?.sessionId===e.sessionId;return s.jsxs("div",{className:"s-flight-observe-trace-step",children:[d>0&&s.jsx("span",{className:"s-flight-observe-trace-arrow","aria-hidden":"true",children:"→"}),s.jsxs("button",{type:"button",className:"s-flight-observe-session-chip","data-selected":b||x,"data-observe-role":b?"primary":x?"compare":"idle","aria-pressed":b||x,title:e.sessionId,onClick:()=>C(e.sessionId),children:[s.jsxs("span",{className:"s-flight-observe-session-chip-top",children:[s.jsx("span",{children:e.harness||e.transport||"session"}),s.jsx("time",{title:new Date(e.startedAt).toLocaleString(),children:$(e.startedAt)||F(e.startedAt)})]}),s.jsx("strong",{children:O(e.sessionId)}),s.jsx("small",{children:q(e,d)})]})]},`${e.sessionId}:${e.startedAt}:${d}`)})}),h&&!g&&s.jsx("div",{className:"s-flight-observe-message s-flight-observe-message--error",children:h}),h&&g&&s.jsxs("div",{className:"s-flight-observe-message",children:[s.jsx("strong",{children:"Flight record unavailable"}),s.jsx("span",{children:"Showing the concrete session captured by this link."})]}),!h&&n&&s.jsx("div",{className:"s-flight-observe-message",children:"Resolving the flight’s session trace…"}),!h&&!n&&a.length===0&&!g&&s.jsxs("div",{className:"s-flight-observe-message",children:[s.jsx("strong",{children:"Waiting for a session"}),s.jsx("span",{children:"The flight is stable here; its trace will appear as soon as a harness acknowledges dispatch."})]}),g&&!f&&s.jsx("main",{className:"s-flight-observe-single",children:s.jsx(j,{sessionRef:g,navigate:o})}),!h&&i&&l&&f&&s.jsxs("main",{className:"s-flight-observe-split",children:[s.jsxs("section",{className:"s-flight-observe-pane",children:[s.jsx(y,{label:"Primary session",sessions:a,value:i.sessionId,onChange:e=>m(e,e===l.sessionId?i.sessionId:l.sessionId)}),s.jsx("div",{className:"s-flight-observe-pane-content",children:s.jsx(j,{sessionRef:i.sessionId,navigate:o,showObserveRail:!1})})]}),s.jsxs("section",{className:"s-flight-observe-pane",children:[s.jsx(y,{label:"Compare session",sessions:a.filter(e=>e.sessionId!==i.sessionId),value:l.sessionId,onChange:e=>m(i.sessionId,e)}),s.jsx("div",{className:"s-flight-observe-pane-content",children:s.jsx(j,{sessionRef:l.sessionId,navigate:o,showObserveRail:!1})})]})]})]})}export{ge as FlightObserveScreen};
@@ -1 +1 @@
1
- import{r as o,j as r}from"./index-Bli6bTLU.js";import{a as h}from"./api-DEHEgJ9m.js";import{t as p,r as c,m as g}from"./follow-route-BvcGtBIL.js";import{s as l}from"./router-B0YclXYg.js";/* empty css */import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-D4dHTRkt.js";function N({route:e,navigate:t}){const[d,m]=o.useState(null),i=o.useMemo(()=>p(e),[e]);return o.useEffect(()=>{let n=!1;const s=new URLSearchParams;return e.flightId&&s.set("flightId",e.flightId),e.invocationId&&s.set("invocationId",e.invocationId),e.conversationId&&s.set("conversationId",e.conversationId),e.workId&&s.set("workId",e.workId),e.sessionId&&s.set("sessionId",e.sessionId),e.targetAgentId&&s.set("targetAgentId",e.targetAgentId),(async()=>{try{const a=s.toString(),f=a?await h(`/api/follow?${a}`):i;if(n)return;t(l(c(g(f,i),e.preferredView),e.machineId??null))}catch(a){if(n)return;m(a instanceof Error?a.message:String(a)),t(l(c(i,e.preferredView),e.machineId??null))}})(),()=>{n=!0}},[i,t,e]),r.jsx("div",{className:"s-sessions-screen s-inbox-thread-redesign",children:r.jsx("section",{className:"s-thread-overview",children:r.jsxs("div",{className:"s-thread-overview-copy",children:[r.jsxs("div",{className:"s-sessions-header s-thread-overview-heading",children:[r.jsx("h2",{className:"s-page-title",children:"Follow"}),r.jsx("span",{className:"s-meta s-tabular",children:e.preferredView??"auto"})]}),r.jsx("p",{className:"s-thread-overview-summary",children:d?"Opening the closest available Scout view.":"Resolving Scout context..."})]})})})}export{N as FollowScreen};
1
+ import{r as o,j as r}from"./index-NRbRrZw-.js";import{a as h}from"./api-DEHEgJ9m.js";import{t as p,r as c,m as g}from"./follow-route-BvcGtBIL.js";import{s as l}from"./router-Bx1tiwVe.js";/* empty css */import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-D4dHTRkt.js";function N({route:e,navigate:t}){const[d,m]=o.useState(null),i=o.useMemo(()=>p(e),[e]);return o.useEffect(()=>{let n=!1;const s=new URLSearchParams;return e.flightId&&s.set("flightId",e.flightId),e.invocationId&&s.set("invocationId",e.invocationId),e.conversationId&&s.set("conversationId",e.conversationId),e.workId&&s.set("workId",e.workId),e.sessionId&&s.set("sessionId",e.sessionId),e.targetAgentId&&s.set("targetAgentId",e.targetAgentId),(async()=>{try{const a=s.toString(),f=a?await h(`/api/follow?${a}`):i;if(n)return;t(l(c(g(f,i),e.preferredView),e.machineId??null))}catch(a){if(n)return;m(a instanceof Error?a.message:String(a)),t(l(c(i,e.preferredView),e.machineId??null))}})(),()=>{n=!0}},[i,t,e]),r.jsx("div",{className:"s-sessions-screen s-inbox-thread-redesign",children:r.jsx("section",{className:"s-thread-overview",children:r.jsxs("div",{className:"s-thread-overview-copy",children:[r.jsxs("div",{className:"s-sessions-header s-thread-overview-heading",children:[r.jsx("h2",{className:"s-page-title",children:"Follow"}),r.jsx("span",{className:"s-meta s-tabular",children:e.preferredView??"auto"})]}),r.jsx("p",{className:"s-thread-overview-summary",children:d?"Opening the closest available Scout view.":"Resolving Scout context..."})]})})})}export{N as FollowScreen};