@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 e,r as d}from"./index-Bli6bTLU.js";import{p as v,a as b}from"./api-DEHEgJ9m.js";import{u as Q,d as Z}from"./Provider-Ve8yXaWR.js";import{P as ee,d as te}from"./router-B0YclXYg.js";import{u as se}from"./sse-CSozY6mp.js";import{o as oe,i as D}from"./surface-activity-B1rgWB1i.js";/* empty css */import{AgentsSubnav as ne}from"./AgentsSubnav-3_vpn2bT.js";import{AgentsLibrary as ie}from"./library-BSVrjn_m.js";import{r as re,d as ae}from"./NewChatComposer-Bgqes0UQ.js";import{AgentDetailWithRail as de,AgentProfileBar as le}from"./profile-BkmuseW7.js";/* empty css *//* empty css *//* empty css */import"./provider-CX9EWecp.js";import"./colors-BtO5_zlx.js";import"./scoutbot-D4vuKzOL.js";import"./DocumentFocusViewer-DmtFisY9.js";import"./createLucideIcon-DLlxGjKt.js";import"./TextDocumentSurface-C7fGlzY8.js";import"./file-text-BVhkMWyC.js";import"./x-BJyPzFnn.js";import"./chevron-right-BMqtBds_.js";import"./code-xml-ByQsfOI_.js";import"./arrow-left-i-h6JAgs.js";import"./arrow-right-B0Yi01Zr.js";import"./scout-voice-DvG_3stJ.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-7iEtvu9P.js";import"./chunk-HRAB3GC3-BUVYXXAp.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-D4dHTRkt.js";import"./index-BWHgHrtv.js";import"./SecondaryNav-cYTw2p39.js";import"./secondaryNavConfig-DyC_P9Wx.js";import"./message-square-DlY4EneU.js";import"./search-BbgsEMXa.js";import"./compass-BepM5iWH.js";import"./settings-BzWCF3NF.js";import"./terminal-BiNIXhna.js";import"./git-branch-q8Ayc8py.js";import"./scroll-text-DRidbcse.js";/* empty css */import"./time-Dhsh_2EG.js";import"./SpriteAvatar-DMrSssNZ.js";import"./agent-identity-DzHGhLdJ.js";import"./HarnessMark-DGZ6o6Ct.js";import"./AgentSessions-czl5zT7A.js";import"./openContent-C6XO6kr5.js";import"./clipboard-e3fSpeo7.js";import"./text-BR9Bap0E.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-DoT8gpw6.js";import"./conversation-model-CigSPlKA.js";import"./index-DFdlQs_c.js";import"./NewChatOrigin-DpHS2Wmt.js";import"./chevron-down-Da5tV19_.js";import"./agents-project-model-UYiamtrU.js";import"./AgentAvatar-B1xvQ7ej.js";import"./context-budget-DX_fwUs3.js";import"./session-catalog-CUQ8LUJY.js";import"./terminal-relay-pSm7_An6.js";import"./BackToPicker-CqYhOaLB.js";import"./ConversationScreen-CjWWmuuh.js";import"./ConversationComposer-Ce7Byw48.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"./eye-BeCSqJn1.js";import"./message-visibility-kJM8XcSG.js";import"./sessionRead-CvFz2RHv.js";import"./types-B0PlfpKc.js";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"./tail-events-CrN-Rmxj.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";import"./AgentDefinitionsWorkspace-rw3vh8Lm.js";import"./agent-specialization-CNrsRbKA.js";import"./project-overview-helpers-BQTc_Ous.js";import"./FileViewerPane-Dg7_88pv.js";/* empty css */import"./agent-essentials-CngjUhQj.js";const K=new Set(["0","false","off","no","clear","none"]),ce=new Set(["1","true","on","yes"]),me=new Set(["localhost","127.0.0.1","::1"]);function ue(t){return t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1):t}function L(t){const o=t?.trim().toLowerCase();return o==="before"||o==="after"?o:null}function z(t){if(!t)return null;const o=t.trim().toLowerCase();return ce.has(o)?!0:K.has(o)?!1:null}function M(t,o,i=[]){const r=z(t);if(r!==null)return r;if(!t)return null;const l=o.toLowerCase(),a=new Set([l,l.replace(/-/g,""),...i.map(n=>n.trim().toLowerCase()).filter(Boolean)]),s=t.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean);return s.some(n=>K.has(n))?!1:s.some(n=>a.has(n))?!0:null}function pe({studyId:t,aliases:o,href:i,storedEnabled:r,storedMode:l,dev:a,defaultMode:s="after"}){const n=i?new URL(i,"http://localhost"):null,p=M(n?.searchParams.get("studio"),t,o)??M(n?.searchParams.get(`studio.${t}`),t,o)??M(n?.searchParams.get("studioInjection"),t,o),c=n?me.has(ue(n.hostname)):!1;if(!a&&!c)return{enabled:!1,mode:s};const u=p??z(r)??!1,g=L(n?.searchParams.get("studioMode"))??L(n?.searchParams.get(`studioMode.${t}`))??L(l)??s;return{enabled:u,mode:g}}const he="openscout.studio.inject.",fe="openscout.studio.mode.";function O(t){return`${he}${t}`}function T(t){return`${fe}${t}`}function $(t){if(typeof window>"u")return null;try{return window.localStorage.getItem(t)}catch{return null}}function I(t,o){if(!(typeof window>"u"))try{window.localStorage.setItem(t,o)}catch{}}function ge(){return import.meta.env?.DEV===!0}function je(t){return t==="before"?"after":"before"}function xe(t){typeof window>"u"||ee({searchPatch:{studio:null,[`studio.${t}`]:null,studioInjection:null,studioMode:null,[`studioMode.${t}`]:null},replace:!0})}function ve(t,o=[]){const[i,r]=d.useState(()=>pe({studyId:t,aliases:o,href:typeof window>"u"?void 0:window.location.href,storedEnabled:$(O(t)),storedMode:$(T(t)),dev:ge()})),[l,a]=d.useState(!1);d.useEffect(()=>{if(!i.enabled){a(!1);return}const c=j=>{j.altKey&&a(!0)},u=j=>{j.altKey||a(!1)},g=()=>a(!1);return window.addEventListener("keydown",c),window.addEventListener("keyup",u),window.addEventListener("blur",g),()=>{window.removeEventListener("keydown",c),window.removeEventListener("keyup",u),window.removeEventListener("blur",g)}},[i.enabled]);const s=d.useCallback(c=>{I(O(t),c?"1":"0"),r(u=>({...u,enabled:c}))},[t]),n=d.useCallback(c=>{I(T(t),c),r(u=>({...u,mode:c}))},[t]),p=l?je(i.mode):i.mode;return d.useMemo(()=>({...i,renderedMode:p,peeking:p!==i.mode,setEnabled:s,setMode:n}),[p,s,n,i])}function Se({studyId:t,aliases:o,anchor:i,title:r,children:l,renderStudy:a}){const s=ve(t,o);return s.enabled?e.jsxs("div",{className:"s-studio-injection","data-studio-anchor":i,children:[e.jsxs("div",{className:"s-studio-injection-bar",children:[e.jsxs("div",{className:"s-studio-injection-label",children:[e.jsx("span",{className:"s-studio-injection-kicker",children:"Studio injection"}),e.jsx("span",{className:"s-studio-injection-title",children:r}),e.jsx("span",{className:"s-studio-injection-anchor",children:i})]}),e.jsxs("div",{className:"s-studio-injection-controls",role:"group","aria-label":`${r} mode`,children:[e.jsx("button",{type:"button",className:"s-studio-injection-mode","data-active":s.mode==="before","aria-pressed":s.mode==="before",onClick:()=>s.setMode("before"),children:"Before"}),e.jsx("button",{type:"button",className:"s-studio-injection-mode","data-active":s.mode==="after","aria-pressed":s.mode==="after",onClick:()=>s.setMode("after"),children:"After"})]}),e.jsx("span",{className:"s-studio-injection-state",children:s.peeking?`Option: ${s.renderedMode}`:s.renderedMode}),e.jsx("button",{type:"button",className:"s-studio-injection-close",onClick:()=>{xe(t),s.setEnabled(!1)},children:"Close"})]}),e.jsx("div",{className:"s-studio-injection-body","data-studio-mode":s.renderedMode,children:s.renderedMode==="before"?l:a()})]}):e.jsx(e.Fragment,{children:l})}const N=[{id:"openscout",title:"openscout",root:"~/dev/openscout",signal:"Studio mode injection for agent directory",sessions:9,agents:[{id:"hudson",name:"Hudson",handle:"@hudson",state:"working",role:"web design system",branch:"feat/studio-mode",task:"Refactoring the agent directory into insertion points",last:"18s"},{id:"scout",name:"Scout",handle:"@scout",state:"attention",role:"operator assistant",branch:"main",task:"Needs placement decision",last:"1m"},{id:"quill",name:"Quill",handle:"@quill",state:"ready",role:"docs",branch:"docs/agent-view",task:"Ready to write the study summary",last:"7m"}]},{id:"hudson",title:"hudson",root:"~/dev/hudson",signal:"Slot contracts and chrome primitives",sessions:4,agents:[{id:"atlas",name:"Atlas",handle:"@atlas",state:"working",role:"framework",branch:"slots/studio-anchor",task:"Mapping chrome slots to page anchors",last:"3m"},{id:"mira",name:"Mira",handle:"@mira",state:"ready",role:"qa",branch:"main",task:"Idle",last:"12m"}]},{id:"lattices",title:"lattices",root:"~/dev/lattices",signal:"macOS web view parity pass",sessions:2,agents:[{id:"north",name:"North",handle:"@north",state:"offline",role:"native",branch:"main",task:"No active session",last:"1h"}]}],we={working:"working",ready:"ready",attention:"attention",offline:"offline"};function ye({children:t}){return e.jsx(Se,{studyId:"agent-directory",aliases:["agents","agent","agent-directory-before-after"],anchor:"agents.directory",title:"Agent Directory",renderStudy:()=>e.jsx(be,{}),children:t})}function be(){const t=N.flatMap(s=>s.agents),o=t.filter(s=>s.state==="working"),i=t.filter(s=>s.state==="ready"),r=t.filter(s=>s.state==="attention"),l=N.reduce((s,n)=>s+n.sessions,0),a=o[0]??t[0];return e.jsxs("section",{className:"s-agent-studio-study","aria-label":"Agent directory injected study",children:[e.jsxs("div",{className:"s-agent-studio-banner",children:[e.jsx("span",{children:"After study"}),e.jsx("strong",{children:"Injected static view inside the live Agents route"}),e.jsx("em",{children:"Fixture data · insertion-point prototype · no backend writes"})]}),e.jsxs("header",{className:"s-agent-studio-head","data-studio-anchor":"agent.directory.header",children:[e.jsxs("div",{className:"s-agent-studio-title-block",children:[e.jsx("span",{className:"s-agent-studio-kicker",children:"Studio / agents.directory / after"}),e.jsx("h1",{className:"s-agent-studio-title",children:"Project command center"}),e.jsxs("span",{className:"s-agent-studio-subtitle",children:[t.length," agents across ",N.length," projects"]})]}),e.jsxs("div",{className:"s-agent-studio-metrics","aria-label":"Agent study summary",children:[e.jsx(A,{label:"working",value:o.length,tone:"working"}),e.jsx(A,{label:"ready",value:i.length}),e.jsx(A,{label:"attention",value:r.length,tone:"attention"}),e.jsx(A,{label:"sessions",value:l})]})]}),e.jsxs("div",{className:"s-agent-studio-layout",children:[e.jsxs("div",{className:"s-agent-studio-main",children:[e.jsxs("section",{className:"s-agent-studio-pressure","data-studio-anchor":"agent.active-strip",children:[e.jsxs("div",{className:"s-agent-studio-section-head",children:[e.jsx("span",{children:"Pressure queue"}),e.jsx("strong",{children:o.length+r.length})]}),e.jsx("div",{className:"s-agent-studio-pressure-list",children:[...o,...r].map(s=>e.jsxs("article",{className:`s-agent-studio-pressure-card s-agent-studio-pressure-card--${s.state}`,children:[e.jsx("span",{className:"s-agent-studio-dot","data-state":s.state}),e.jsxs("div",{className:"s-agent-studio-pressure-copy",children:[e.jsx("strong",{children:s.name}),e.jsx("span",{children:s.task})]}),e.jsx("time",{children:s.last})]},s.id))})]}),e.jsx("section",{className:"s-agent-studio-projects","data-studio-anchor":"agent.project-board",children:N.map(s=>e.jsxs("article",{className:"s-agent-studio-project",children:[e.jsxs("div",{className:"s-agent-studio-project-main",children:[e.jsxs("div",{children:[e.jsx("span",{className:"s-agent-studio-project-root",children:s.root}),e.jsx("h2",{children:s.title})]}),e.jsxs("span",{className:"s-agent-studio-project-sessions",children:[s.sessions," sessions"]})]}),e.jsx("p",{children:s.signal}),e.jsx("div",{className:"s-agent-studio-agent-row",children:s.agents.map(n=>e.jsxs("span",{className:`s-agent-studio-agent-pill s-agent-studio-agent-pill--${n.state}`,children:[e.jsx("span",{className:"s-agent-studio-dot","data-state":n.state}),n.name]},n.id))})]},s.id))})]}),e.jsxs("aside",{className:"s-agent-studio-detail","data-studio-anchor":"agent.detail-preview",children:[e.jsx("span",{className:"s-agent-studio-kicker",children:"Pinned agent"}),e.jsx("h2",{children:a.name}),e.jsx("span",{className:`s-agent-studio-state s-agent-studio-state--${a.state}`,children:we[a.state]}),e.jsxs("dl",{children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Handle"}),e.jsx("dd",{children:a.handle})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Role"}),e.jsx("dd",{children:a.role})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Branch"}),e.jsx("dd",{children:a.branch})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Current task"}),e.jsx("dd",{children:a.task})]})]})]})]})]})}function A({label:t,value:o,tone:i}){return e.jsxs("div",{className:`s-agent-studio-metric${i?` s-agent-studio-metric--${i}`:""}`,children:[e.jsx("strong",{children:o}),e.jsx("span",{children:t})]})}const P="/api/conversations",H="/api/fleet",F="/api/tail/discover",U="/api/topology/snapshot?force=1",S=3e4;function ys({navigate:t,selectedAgentId:o,conversationId:i,tab:r,activeRoute:l}){const{agents:a,agentsLoaded:s,route:n}=Q(),[p,c]=d.useState(()=>v(P,S)??[]),[u,g]=d.useState(()=>v(H,S)),[j,G]=d.useState(()=>v(F,S)),[q,W]=d.useState(()=>v(U,S)),[X,Y]=d.useState(()=>v(P,S)===null),R=te(n),k=d.useMemo(()=>Z(a,R),[a,R]),x=d.useCallback(async()=>{const[h,f,y,C]=await Promise.allSettled([b(P),b(H),b(F),b(U)]);h.status==="fulfilled"&&c(h.value),f.status==="fulfilled"&&g(f.value),y.status==="fulfilled"&&G(y.value),C.status==="fulfilled"&&W(C.value),Y(!1)},[]);d.useEffect(()=>{x()},[x]),d.useEffect(()=>{const h=()=>{D()&&x()},f=window.setInterval(h,1e4),y=oe(h);return()=>{window.clearInterval(f),y()}},[x]),se(()=>{D()&&x()});const m=re(k,o),_=!!(o&&m&&m.id!==o),w=n.view==="agents-v2"?n.projectSlug:void 0,E=!!(w&&!r),{conversationByAgentId:B,sessionByAgentId:J}=ae(p);if(d.useEffect(()=>{!o||!m||!_||t({view:"agents-v2",agentId:m.id,...E&&w?{projectSlug:w}:{},...i?{conversationId:i}:{},...r?{tab:r}:{}})},[i,r,E,t,w,m,o,_]),m&&!E){const h=i??B.get(m.id)??m.conversationId??null,f=r??(i?"message":"profile");return e.jsx(V,{activeRoute:l??n,navigate:t,bar:e.jsx(le,{agent:m,conversationId:h,activeTab:f,navigate:t}),children:e.jsx(de,{agent:m,allAgents:k,conversationId:h,navigate:t,activeTab:f})})}return e.jsx(V,{activeRoute:l??n,navigate:t,children:e.jsx(ye,{children:e.jsx(ie,{agents:k,fleet:u,sessionByAgentId:J,conversationByAgentId:B,sessions:p,discovery:j,topologySnapshot:q,loading:!s||X,navigate:t,selectedAgentId:m?.id??o})})})}function V({activeRoute:t,children:o,navigate:i,bar:r}){return e.jsxs("div",{className:"s-secondary-nav-shell",children:[e.jsx("div",{className:"s-secondary-nav-bar",children:r??e.jsx(ne,{activeRoute:t,navigate:i})}),e.jsx("div",{className:"s-secondary-nav-body",children:o})]})}export{ys as AgentsScreen};
1
+ import{j as e,r as d}from"./index-NRbRrZw-.js";import{p as v,a as b}from"./api-DEHEgJ9m.js";import{u as Q,c as Z}from"./Provider-Cd-QZltN.js";import{P as ee,d as te}from"./router-Bx1tiwVe.js";import{u as se}from"./sse-QSbhyq9A.js";import{o as oe,i as D}from"./surface-activity-B1rgWB1i.js";/* empty css */import{AgentsSubnav as ne}from"./AgentsSubnav-CsvYzzQ-.js";import{AgentsLibrary as ie}from"./library-Dx14WNGd.js";import{r as re,d as ae}from"./NewChatComposer-BPsg8shF.js";import{AgentDetailWithRail as de,AgentProfileBar as le}from"./profile-Y0X7HZHc.js";/* empty css *//* empty css *//* empty css */import"./provider-Bq0ScH3v.js";import"./colors-BtO5_zlx.js";import"./scoutbot-D4vuKzOL.js";import"./DocumentFocusViewer-CetjnYut.js";import"./createLucideIcon-Da0lq809.js";import"./TextDocumentSurface-B29xZNlI.js";import"./file-text-BGVkHS4_.js";import"./x-DuzAbpk5.js";import"./chevron-right-CV7sEVBS.js";import"./code-xml-CPzpZkhu.js";import"./arrow-left-B0CdJdAC.js";import"./arrow-right-YRBoTTyf.js";import"./scout-voice-BT3gYDhU.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-feLCB3Zm.js";import"./chunk-HRAB3GC3-BYQZ1LOn.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-D4dHTRkt.js";import"./index-BWHgHrtv.js";import"./SecondaryNav-CCQqTT3e.js";import"./secondaryNavConfig-BVQiyAXu.js";import"./message-square-DURSOrUr.js";import"./search-HmdKXdtR.js";import"./compass-D5Io6BIV.js";import"./settings-BpKRzxOD.js";import"./terminal-DNZTCr6a.js";import"./git-branch-CdJU49Af.js";import"./scroll-text-uulNqrf7.js";/* empty css */import"./time-Dhsh_2EG.js";import"./SpriteAvatar-vpHO-rXs.js";import"./agent-identity-CIMT7oV6.js";import"./HarnessMark-CEzmPFHC.js";import"./AgentSessions-C_tAfGN2.js";import"./openContent-C6XO6kr5.js";import"./clipboard-e3fSpeo7.js";import"./text-B2UZi3l9.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-Be0T8xv2.js";import"./conversation-model-CIzM7aXT.js";import"./index-CD2foMB8.js";import"./NewChatOrigin-CCiPg_WR.js";import"./chevron-down-Jh540uf3.js";import"./agents-project-model-UYiamtrU.js";import"./AgentAvatar-CQqJcwOQ.js";import"./context-budget-DX_fwUs3.js";import"./session-catalog-b7B1Sof1.js";import"./terminal-relay-C2TUIuh1.js";import"./BackToPicker-CXsbxbHM.js";import"./ConversationScreen-D77SoLos.js";import"./ConversationComposer-DPWu3HvK.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"./eye-B908WSFH.js";import"./message-visibility-kJM8XcSG.js";import"./sessionRead-CvFz2RHv.js";import"./types-B0PlfpKc.js";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"./tail-events-B7BrDaFi.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";import"./AgentDefinitionsWorkspace-D0LDEqfl.js";import"./agent-specialization-D3-sqwhU.js";import"./project-overview-helpers-BQTc_Ous.js";import"./FileViewerPane-ebbCtnHE.js";/* empty css */import"./agent-essentials-DbbJm3ne.js";const K=new Set(["0","false","off","no","clear","none"]),ce=new Set(["1","true","on","yes"]),me=new Set(["localhost","127.0.0.1","::1"]);function ue(t){return t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1):t}function L(t){const o=t?.trim().toLowerCase();return o==="before"||o==="after"?o:null}function z(t){if(!t)return null;const o=t.trim().toLowerCase();return ce.has(o)?!0:K.has(o)?!1:null}function M(t,o,i=[]){const r=z(t);if(r!==null)return r;if(!t)return null;const l=o.toLowerCase(),a=new Set([l,l.replace(/-/g,""),...i.map(n=>n.trim().toLowerCase()).filter(Boolean)]),s=t.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean);return s.some(n=>K.has(n))?!1:s.some(n=>a.has(n))?!0:null}function pe({studyId:t,aliases:o,href:i,storedEnabled:r,storedMode:l,dev:a,defaultMode:s="after"}){const n=i?new URL(i,"http://localhost"):null,p=M(n?.searchParams.get("studio"),t,o)??M(n?.searchParams.get(`studio.${t}`),t,o)??M(n?.searchParams.get("studioInjection"),t,o),c=n?me.has(ue(n.hostname)):!1;if(!a&&!c)return{enabled:!1,mode:s};const u=p??z(r)??!1,g=L(n?.searchParams.get("studioMode"))??L(n?.searchParams.get(`studioMode.${t}`))??L(l)??s;return{enabled:u,mode:g}}const he="openscout.studio.inject.",fe="openscout.studio.mode.";function O(t){return`${he}${t}`}function T(t){return`${fe}${t}`}function $(t){if(typeof window>"u")return null;try{return window.localStorage.getItem(t)}catch{return null}}function I(t,o){if(!(typeof window>"u"))try{window.localStorage.setItem(t,o)}catch{}}function ge(){return import.meta.env?.DEV===!0}function je(t){return t==="before"?"after":"before"}function xe(t){typeof window>"u"||ee({searchPatch:{studio:null,[`studio.${t}`]:null,studioInjection:null,studioMode:null,[`studioMode.${t}`]:null},replace:!0})}function ve(t,o=[]){const[i,r]=d.useState(()=>pe({studyId:t,aliases:o,href:typeof window>"u"?void 0:window.location.href,storedEnabled:$(O(t)),storedMode:$(T(t)),dev:ge()})),[l,a]=d.useState(!1);d.useEffect(()=>{if(!i.enabled){a(!1);return}const c=j=>{j.altKey&&a(!0)},u=j=>{j.altKey||a(!1)},g=()=>a(!1);return window.addEventListener("keydown",c),window.addEventListener("keyup",u),window.addEventListener("blur",g),()=>{window.removeEventListener("keydown",c),window.removeEventListener("keyup",u),window.removeEventListener("blur",g)}},[i.enabled]);const s=d.useCallback(c=>{I(O(t),c?"1":"0"),r(u=>({...u,enabled:c}))},[t]),n=d.useCallback(c=>{I(T(t),c),r(u=>({...u,mode:c}))},[t]),p=l?je(i.mode):i.mode;return d.useMemo(()=>({...i,renderedMode:p,peeking:p!==i.mode,setEnabled:s,setMode:n}),[p,s,n,i])}function Se({studyId:t,aliases:o,anchor:i,title:r,children:l,renderStudy:a}){const s=ve(t,o);return s.enabled?e.jsxs("div",{className:"s-studio-injection","data-studio-anchor":i,children:[e.jsxs("div",{className:"s-studio-injection-bar",children:[e.jsxs("div",{className:"s-studio-injection-label",children:[e.jsx("span",{className:"s-studio-injection-kicker",children:"Studio injection"}),e.jsx("span",{className:"s-studio-injection-title",children:r}),e.jsx("span",{className:"s-studio-injection-anchor",children:i})]}),e.jsxs("div",{className:"s-studio-injection-controls",role:"group","aria-label":`${r} mode`,children:[e.jsx("button",{type:"button",className:"s-studio-injection-mode","data-active":s.mode==="before","aria-pressed":s.mode==="before",onClick:()=>s.setMode("before"),children:"Before"}),e.jsx("button",{type:"button",className:"s-studio-injection-mode","data-active":s.mode==="after","aria-pressed":s.mode==="after",onClick:()=>s.setMode("after"),children:"After"})]}),e.jsx("span",{className:"s-studio-injection-state",children:s.peeking?`Option: ${s.renderedMode}`:s.renderedMode}),e.jsx("button",{type:"button",className:"s-studio-injection-close",onClick:()=>{xe(t),s.setEnabled(!1)},children:"Close"})]}),e.jsx("div",{className:"s-studio-injection-body","data-studio-mode":s.renderedMode,children:s.renderedMode==="before"?l:a()})]}):e.jsx(e.Fragment,{children:l})}const N=[{id:"openscout",title:"openscout",root:"~/dev/openscout",signal:"Studio mode injection for agent directory",sessions:9,agents:[{id:"hudson",name:"Hudson",handle:"@hudson",state:"working",role:"web design system",branch:"feat/studio-mode",task:"Refactoring the agent directory into insertion points",last:"18s"},{id:"scout",name:"Scout",handle:"@scout",state:"attention",role:"operator assistant",branch:"main",task:"Needs placement decision",last:"1m"},{id:"quill",name:"Quill",handle:"@quill",state:"ready",role:"docs",branch:"docs/agent-view",task:"Ready to write the study summary",last:"7m"}]},{id:"hudson",title:"hudson",root:"~/dev/hudson",signal:"Slot contracts and chrome primitives",sessions:4,agents:[{id:"atlas",name:"Atlas",handle:"@atlas",state:"working",role:"framework",branch:"slots/studio-anchor",task:"Mapping chrome slots to page anchors",last:"3m"},{id:"mira",name:"Mira",handle:"@mira",state:"ready",role:"qa",branch:"main",task:"Idle",last:"12m"}]},{id:"lattices",title:"lattices",root:"~/dev/lattices",signal:"macOS web view parity pass",sessions:2,agents:[{id:"north",name:"North",handle:"@north",state:"offline",role:"native",branch:"main",task:"No active session",last:"1h"}]}],we={working:"working",ready:"ready",attention:"attention",offline:"offline"};function ye({children:t}){return e.jsx(Se,{studyId:"agent-directory",aliases:["agents","agent","agent-directory-before-after"],anchor:"agents.directory",title:"Agent Directory",renderStudy:()=>e.jsx(be,{}),children:t})}function be(){const t=N.flatMap(s=>s.agents),o=t.filter(s=>s.state==="working"),i=t.filter(s=>s.state==="ready"),r=t.filter(s=>s.state==="attention"),l=N.reduce((s,n)=>s+n.sessions,0),a=o[0]??t[0];return e.jsxs("section",{className:"s-agent-studio-study","aria-label":"Agent directory injected study",children:[e.jsxs("div",{className:"s-agent-studio-banner",children:[e.jsx("span",{children:"After study"}),e.jsx("strong",{children:"Injected static view inside the live Agents route"}),e.jsx("em",{children:"Fixture data · insertion-point prototype · no backend writes"})]}),e.jsxs("header",{className:"s-agent-studio-head","data-studio-anchor":"agent.directory.header",children:[e.jsxs("div",{className:"s-agent-studio-title-block",children:[e.jsx("span",{className:"s-agent-studio-kicker",children:"Studio / agents.directory / after"}),e.jsx("h1",{className:"s-agent-studio-title",children:"Project command center"}),e.jsxs("span",{className:"s-agent-studio-subtitle",children:[t.length," agents across ",N.length," projects"]})]}),e.jsxs("div",{className:"s-agent-studio-metrics","aria-label":"Agent study summary",children:[e.jsx(A,{label:"working",value:o.length,tone:"working"}),e.jsx(A,{label:"ready",value:i.length}),e.jsx(A,{label:"attention",value:r.length,tone:"attention"}),e.jsx(A,{label:"sessions",value:l})]})]}),e.jsxs("div",{className:"s-agent-studio-layout",children:[e.jsxs("div",{className:"s-agent-studio-main",children:[e.jsxs("section",{className:"s-agent-studio-pressure","data-studio-anchor":"agent.active-strip",children:[e.jsxs("div",{className:"s-agent-studio-section-head",children:[e.jsx("span",{children:"Pressure queue"}),e.jsx("strong",{children:o.length+r.length})]}),e.jsx("div",{className:"s-agent-studio-pressure-list",children:[...o,...r].map(s=>e.jsxs("article",{className:`s-agent-studio-pressure-card s-agent-studio-pressure-card--${s.state}`,children:[e.jsx("span",{className:"s-agent-studio-dot","data-state":s.state}),e.jsxs("div",{className:"s-agent-studio-pressure-copy",children:[e.jsx("strong",{children:s.name}),e.jsx("span",{children:s.task})]}),e.jsx("time",{children:s.last})]},s.id))})]}),e.jsx("section",{className:"s-agent-studio-projects","data-studio-anchor":"agent.project-board",children:N.map(s=>e.jsxs("article",{className:"s-agent-studio-project",children:[e.jsxs("div",{className:"s-agent-studio-project-main",children:[e.jsxs("div",{children:[e.jsx("span",{className:"s-agent-studio-project-root",children:s.root}),e.jsx("h2",{children:s.title})]}),e.jsxs("span",{className:"s-agent-studio-project-sessions",children:[s.sessions," sessions"]})]}),e.jsx("p",{children:s.signal}),e.jsx("div",{className:"s-agent-studio-agent-row",children:s.agents.map(n=>e.jsxs("span",{className:`s-agent-studio-agent-pill s-agent-studio-agent-pill--${n.state}`,children:[e.jsx("span",{className:"s-agent-studio-dot","data-state":n.state}),n.name]},n.id))})]},s.id))})]}),e.jsxs("aside",{className:"s-agent-studio-detail","data-studio-anchor":"agent.detail-preview",children:[e.jsx("span",{className:"s-agent-studio-kicker",children:"Pinned agent"}),e.jsx("h2",{children:a.name}),e.jsx("span",{className:`s-agent-studio-state s-agent-studio-state--${a.state}`,children:we[a.state]}),e.jsxs("dl",{children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Handle"}),e.jsx("dd",{children:a.handle})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Role"}),e.jsx("dd",{children:a.role})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Branch"}),e.jsx("dd",{children:a.branch})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Current task"}),e.jsx("dd",{children:a.task})]})]})]})]})]})}function A({label:t,value:o,tone:i}){return e.jsxs("div",{className:`s-agent-studio-metric${i?` s-agent-studio-metric--${i}`:""}`,children:[e.jsx("strong",{children:o}),e.jsx("span",{children:t})]})}const P="/api/conversations",H="/api/fleet",F="/api/tail/discover",U="/api/topology/snapshot?force=1",S=3e4;function ys({navigate:t,selectedAgentId:o,conversationId:i,tab:r,activeRoute:l}){const{agents:a,agentsLoaded:s,route:n}=Q(),[p,c]=d.useState(()=>v(P,S)??[]),[u,g]=d.useState(()=>v(H,S)),[j,G]=d.useState(()=>v(F,S)),[q,W]=d.useState(()=>v(U,S)),[X,Y]=d.useState(()=>v(P,S)===null),R=te(n),k=d.useMemo(()=>Z(a,R),[a,R]),x=d.useCallback(async()=>{const[h,f,y,C]=await Promise.allSettled([b(P),b(H),b(F),b(U)]);h.status==="fulfilled"&&c(h.value),f.status==="fulfilled"&&g(f.value),y.status==="fulfilled"&&G(y.value),C.status==="fulfilled"&&W(C.value),Y(!1)},[]);d.useEffect(()=>{x()},[x]),d.useEffect(()=>{const h=()=>{D()&&x()},f=window.setInterval(h,1e4),y=oe(h);return()=>{window.clearInterval(f),y()}},[x]),se(()=>{D()&&x()});const m=re(k,o),_=!!(o&&m&&m.id!==o),w=n.view==="agents-v2"?n.projectSlug:void 0,E=!!(w&&!r),{conversationByAgentId:B,sessionByAgentId:J}=ae(p);if(d.useEffect(()=>{!o||!m||!_||t({view:"agents-v2",agentId:m.id,...E&&w?{projectSlug:w}:{},...i?{conversationId:i}:{},...r?{tab:r}:{}})},[i,r,E,t,w,m,o,_]),m&&!E){const h=i??B.get(m.id)??m.conversationId??null,f=r??(i?"message":"profile");return e.jsx(V,{activeRoute:l??n,navigate:t,bar:e.jsx(le,{agent:m,conversationId:h,activeTab:f,navigate:t}),children:e.jsx(de,{agent:m,allAgents:k,conversationId:h,navigate:t,activeTab:f})})}return e.jsx(V,{activeRoute:l??n,navigate:t,children:e.jsx(ye,{children:e.jsx(ie,{agents:k,fleet:u,sessionByAgentId:J,conversationByAgentId:B,sessions:p,discovery:j,topologySnapshot:q,loading:!s||X,navigate:t,selectedAgentId:m?.id??o})})})}function V({activeRoute:t,children:o,navigate:i,bar:r}){return e.jsxs("div",{className:"s-secondary-nav-shell",children:[e.jsx("div",{className:"s-secondary-nav-bar",children:r??e.jsx(ne,{activeRoute:t,navigate:i})}),e.jsx("div",{className:"s-secondary-nav-body",children:o})]})}export{ys as AgentsScreen};
@@ -0,0 +1 @@
1
+ import{j as t}from"./index-NRbRrZw-.js";import{S as i}from"./SecondaryNav-CCQqTT3e.js";import{A as m}from"./secondaryNavConfig-BVQiyAXu.js";import"./createLucideIcon-Da0lq809.js";import"./message-square-DURSOrUr.js";import"./file-text-BGVkHS4_.js";import"./search-HmdKXdtR.js";import"./compass-D5Io6BIV.js";import"./settings-BpKRzxOD.js";import"./terminal-DNZTCr6a.js";import"./git-branch-CdJU49Af.js";import"./code-xml-CPzpZkhu.js";import"./scroll-text-uulNqrf7.js";function j({activeRoute:r,navigate:o}){return t.jsx(i,{ariaLabel:"Agents sections",activeRoute:r,groups:m,navigate:o})}export{j as AgentsSubnav};
@@ -1 +1 @@
1
- import{j as t}from"./index-Bli6bTLU.js";function r(){return t.jsxs("svg",{className:"s-thread-participant-suit",viewBox:"0 0 42 42","aria-hidden":"true",children:[t.jsx("path",{d:"M 21 30.5 C 31 30.5 40 34.5 41.5 42 L 0.5 42 C 2 34.5 11 30.5 21 30.5 Z",fill:"var(--fp-suit)"}),t.jsx("rect",{x:"15.5",y:"26.5",width:"11",height:"4",rx:"2",fill:"var(--fp-suit-light)"}),t.jsx("path",{d:"M 8.5 15 A 13 13 0 0 1 19 5.5",fill:"none",stroke:"var(--fp-visor)",strokeWidth:"2.4",strokeLinecap:"round"})]})}export{r as AstronautSuit};
1
+ import{j as t}from"./index-NRbRrZw-.js";function r(){return t.jsxs("svg",{className:"s-thread-participant-suit",viewBox:"0 0 42 42","aria-hidden":"true",children:[t.jsx("path",{d:"M 21 30.5 C 31 30.5 40 34.5 41.5 42 L 0.5 42 C 2 34.5 11 30.5 21 30.5 Z",fill:"var(--fp-suit)"}),t.jsx("rect",{x:"15.5",y:"26.5",width:"11",height:"4",rx:"2",fill:"var(--fp-suit-light)"}),t.jsx("path",{d:"M 8.5 15 A 13 13 0 0 1 19 5.5",fill:"none",stroke:"var(--fp-visor)",strokeWidth:"2.4",strokeLinecap:"round"})]})}export{r as AstronautSuit};
@@ -1 +1 @@
1
- import{r as d,j as e}from"./index-Bli6bTLU.js";/* empty css */import{D as ys}from"./DataTable-oJP339bX.js";import{H,h as F}from"./HarnessMark-DGZ6o6Ct.js";import{O as vs}from"./ObservedTopologyPanel-D85P6RAk.js";import{a as es}from"./api-DEHEgJ9m.js";import{o as ts,i as U}from"./surface-activity-B1rgWB1i.js";import{a as Ns,d as gs}from"./time-Dhsh_2EG.js";import{u as Is}from"./tail-events-CrN-Rmxj.js";/* empty css */import"./index-BWHgHrtv.js";const ns=4e3,bs=500,Cs=5e3,Es=5e3,Ss=6e4,q={"scout-managed":"scout","hudson-managed":"hudson",unattributed:"native"},X={tool:"working",run:"active",idle:"idle"};function G(s){const n=s.split(/\s+/)[0]??"",l=n.lastIndexOf("/");return l>=0?n.slice(l+1):n}function ws(s,n=60){const l=s.split(/\s+/);if(l.length===0)return s;l[0]=G(l[0]);const c=l.join(" ");return c.length<=n?c:c.slice(0,n-1)+"…"}function Ms(s){for(const n of s){const l=G(n.command);if(l&&!(l==="sh"||l==="zsh"||l==="bash"||l==="login"))return l}return s[0]?.command?G(s[0].command):"—"}function As(s){const n=s.match(/^(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)$/);if(!n){const u=s.match(/^(\d+)$/);return u?Number.parseInt(u[1],10):0}const[,l,c,m,p]=n;let f=Number.parseInt(p,10)+Number.parseInt(m,10)*60;return c&&(f+=Number.parseInt(c,10)*3600),l&&(f+=Number.parseInt(l,10)*86400),f}function rs(s){if(s<60)return`${s}s`;if(s<3600)return`${Math.floor(s/60)}m${String(s%60).padStart(2,"0")}`;if(s<86400){const c=Math.floor(s/3600),m=Math.floor(s%3600/60);return`${c}h${String(m).padStart(2,"0")}`}const n=Math.floor(s/86400),l=Math.floor(s%86400/3600);return`${n}d${String(l).padStart(2,"0")}h`}function is(s,n){return Ns(s,n)||"—"}function $s(s){return gs(s)||"—"}function Q(s){return s?s.slice(0,8):"—"}function cs(s){return s?.trim().toLowerCase()||"unknown"}function Rs(s){return cs(s).replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function Z(s){return`s-atop-chip s-atop-chip--harness s-atop-chip--harness-${Rs(s)}`}const Ts=/permission-mode/i;function as(s){return s.kind!=="system"?!1:Ts.test(s.summary)}function J(s){return s.kind==="assistant"}function Ws(s,n,l){if(!s)return[];const c=new Map,m=new Map;for(const t of n){let r=c.get(t.pid);if(r||(r={firstEventAt:t.ts,lastEventAt:t.ts,lastKind:t.kind,lastSummary:t.summary,reqCount:0,toolCount:0,permCount:0,eventCount:0,sessionId:t.sessionId||null,model:null,tokIn:null,tokOut:null,cacheReadIn:null,cacheWriteIn:null},c.set(t.pid,r)),t.ts<r.firstEventAt&&(r.firstEventAt=t.ts),t.ts>=r.lastEventAt&&(r.lastEventAt=t.ts,r.lastKind=t.kind,r.lastSummary=t.summary),r.eventCount++,t.kind==="tool"&&r.toolCount++,J(t)&&r.reqCount++,as(t)&&r.permCount++,t.sessionId&&!r.sessionId&&(r.sessionId=t.sessionId),t.sessionId){let a=m.get(t.sessionId);a||(a={firstEventAt:t.ts,lastEventAt:t.ts,lastKind:t.kind,lastSummary:t.summary,reqCount:0,toolCount:0,permCount:0,eventCount:0,sessionId:t.sessionId,model:null,tokIn:null,tokOut:null,cacheReadIn:null,cacheWriteIn:null},m.set(t.sessionId,a)),t.ts<a.firstEventAt&&(a.firstEventAt=t.ts),t.ts>=a.lastEventAt&&(a.lastEventAt=t.ts,a.lastKind=t.kind,a.lastSummary=t.summary),a.eventCount++,t.kind==="tool"&&a.toolCount++,J(t)&&a.reqCount++,as(t)&&a.permCount++}}const p=new Map;for(const t of s.processes){if(!t.cwd)continue;const r=Y(t.source,t.cwd),a=p.get(r);(!a||t.pid<a.pid)&&p.set(r,t)}const f=new Map,u=new Map;for(const t of s.transcripts??[]){const r=Y(t.source,t.cwd),a=os(t),j=u.get(r)??Number.NEGATIVE_INFINITY,N=f.get(r)??"";(t.mtimeMs>j||t.mtimeMs===j&&a>N)&&(u.set(r,t.mtimeMs),f.set(r,a))}const h=new Set,I=(t,r,a,j)=>{r&&h.add(r.pid);let N="idle";const w=Math.max(a?.lastEventAt??0,j?.mtimeMs??0);a&&l-a.lastEventAt<Es&&(N=a.lastKind==="tool"?"tool":"run"),N==="idle"&&l-w<6e4&&(N="run");const L=r?As(r.etime):0,D=a?.firstEventAt??null,V=a&&a.firstEventAt<a.lastEventAt?Math.min(Math.max(0,Math.round((a.lastEventAt-a.firstEventAt)/1e3)),L||Number.POSITIVE_INFINITY):0,_=r?.pid??Os(t),R=j?.cwd??r?.cwd??"";return{key:t,pid:_,ppid:r?.ppid??0,sessionId:j?.sessionId??a?.sessionId??null,transcriptPath:j?.transcriptPath??null,harness:cs(j?.source??r?.source),attribution:r?.harness??j?.harness??"unattributed",project:j?.project?.trim()||(R?Ps(R):"(unknown)"),cwd:R,command:r?.command??`${j?.source??"unknown"} transcript`,parentLabel:r?Ms(r.parentChain??[]):"transcript",procRuntimeSec:L,procEtime:r?.etime??"0",sessionStartAt:D,sessionRuntimeSec:V,status:N,lastEventAt:w||null,lastEventKind:a?.lastKind??null,lastSummary:a?.lastSummary??null,reqCount:a?.reqCount??0,toolCount:a?.toolCount??0,permCount:a?.permCount??0,eventCount:a?.eventCount??0,model:a?.model??null,tokIn:a?.tokIn??null,tokOut:a?.tokOut??null,cacheReadIn:a?.cacheReadIn??null,cacheWriteIn:a?.cacheWriteIn??null}},k=(s.transcripts??[]).map(t=>{const r=os(t),a=Y(t.source,t.cwd),j=f.get(a)===r?p.get(a)??null:null,N=t.sessionId?m.get(t.sessionId):void 0;return I(r,j,N,t)}),y=s.processes.filter(t=>!h.has(t.pid)).map(t=>I(Ls(t),t,c.get(t.pid),null));return[...k,...y]}function $(s){if(s.cacheReadIn==null||s.tokIn==null)return null;const n=s.cacheReadIn+s.tokIn;return n===0?null:s.cacheReadIn/n}function S(s){return s==null?"—":s===0?"0":s>=1e6?(s/1e6).toFixed(s>=1e7?0:1)+"M":s>=1e3?(s/1e3).toFixed(s>=1e4?0:1)+"k":String(s)}function us(s){return s==null?"—":`${Math.round(s*100)}%`}function Ps(s){if(!s)return"";const n=s.lastIndexOf("/");return n>=0?s.slice(n+1):s}function os(s){return`session:${s.source}:${s.sessionId??s.transcriptPath}`}function Ls(s){return`process:${s.source}:${s.pid}`}function Os(s){let n=2166136261;for(let l=0;l<s.length;l+=1)n^=s.charCodeAt(l),n=Math.imul(n,16777619);return-((n>>>0)%9e5+1e3)}function Y(s,n){return`${s}\0${n??""}`}function Ks(s,n,l){const c=l-Ss;let m=0;for(const u of n)J(u)&&u.ts>=c&&m++;const p={total:s.length,running:0,tooling:0,idle:0,harnesses:[],reqsPerMin:m},f=new Map;for(const u of s)u.status==="tool"?(p.tooling++,p.running++):u.status==="run"?p.running++:p.idle++,f.set(u.harness,(f.get(u.harness)??0)+1);return p.harnesses=[...f.entries()].map(([u,h])=>({harness:u,count:h})).sort((u,h)=>h.count-u.count||u.harness.localeCompare(h.harness)),p}const P={tool:0,run:1,idle:2};function A(s){return s??-1}function qs(s,n,l,c){switch(l){case"status":return(P[s.status]-P[n.status])*c;case"agent":{const m=s.harness.localeCompare(n.harness);return m!==0?m*c:(s.sessionId??"").localeCompare(n.sessionId??"")*c}case"project":return s.project.localeCompare(n.project)*c;case"reqs":return(s.reqCount-n.reqCount)*c;case"tokIn":return(A(s.tokIn)-A(n.tokIn))*c;case"tokOut":return(A(s.tokOut)-A(n.tokOut))*c;case"cache":return(A($(s))-A($(n)))*c;case"tools":return(s.toolCount-n.toolCount)*c;case"perms":return(s.permCount-n.permCount)*c;case"last":{const m=s.lastEventAt??0,p=n.lastEventAt??0;return(m-p)*c}case"runtime":return(s.sessionRuntimeSec-n.sessionRuntimeSec)*c}}function ls({values:s,color:n}){if(s.length<2)return e.jsx("svg",{className:"s-atop-spark",width:88,height:18,viewBox:"0 0 88 18"});const m=Math.max(1,...s),p=88/(s.length-1),f=s.map((u,h)=>`${(h*p).toFixed(1)},${(18-u/m*18).toFixed(1)}`).join(" ");return e.jsx("svg",{className:"s-atop-spark",width:88,height:18,viewBox:"0 0 88 18",children:e.jsx("polyline",{fill:"none",stroke:n,strokeWidth:"1.25",points:f})})}function ne(){const[s,n]=d.useState([]),[l,c]=d.useState(null),[m,p]=d.useState(()=>Date.now()),[f,u]=d.useState(""),[h,I]=d.useState(()=>new Set),[k,y]=d.useState(()=>new Set),[t,r]=d.useState({key:"status",dir:1}),[a,j]=d.useState(null),N=d.useRef([]),w=d.useRef([]),[L,D]=d.useState([]),[V,_]=d.useState([]),R=d.useCallback(o=>{n(i=>i.length>=ns?[...i.slice(i.length-ns+1),o]:[...i,o])},[]);Is(R),d.useEffect(()=>{let o=!1,i=!1;const x=async()=>{if(!(i||!U()))try{const O=await es(`/api/tail/recent?limit=${bs}`);o||(i=!0,n(O.events??[]))}catch{}};x();const E=ts(()=>{x()});return()=>{o=!0,E()}},[]);const T=d.useCallback(async()=>{if(U())try{const o=await es("/api/tail/discover");c(o)}catch{}},[]);d.useEffect(()=>{T();const o=setInterval(()=>{T()},Cs),i=ts(()=>{T()});return()=>{clearInterval(o),i()}},[T]),d.useEffect(()=>{const o=setInterval(()=>{U()&&p(Date.now())},1e3);return()=>clearInterval(o)},[]);const v=d.useMemo(()=>Ws(l,s,m),[l,s,m]),M=d.useMemo(()=>Ks(v,s,m),[v,s,m]);d.useEffect(()=>{N.current=[...N.current,M.running].slice(-24),w.current=[...w.current,M.tooling].slice(-24),D(N.current),_(w.current)},[M.running,M.tooling]);const ds=d.useMemo(()=>{const o=new Set;return v.forEach(i=>o.add(i.harness)),[...o]},[v]),ms=d.useMemo(()=>{const o=new Set;return v.forEach(i=>o.add(i.status)),[...o]},[v]),z=d.useMemo(()=>{const o=f.trim().toLowerCase();return v.filter(i=>{if(h.size>0&&!h.has(i.harness)||k.size>0&&!k.has(i.status))return!1;if(!o)return!0;const x=q[i.attribution];return`${i.pid} ${i.project} ${i.command} ${i.harness} ${i.attribution} ${x} ${i.sessionId??""} ${i.transcriptPath??""} ${i.lastSummary??""}`.toLowerCase().includes(o)})},[v,f,h,k]),B=d.useMemo(()=>t.key==="status"?void 0:(o,i)=>P[o.status]-P[i.status],[t.key]),C=d.useMemo(()=>z.map((o,i)=>({row:o,index:i})).sort((o,i)=>{const x=qs(o.row,i.row,t.key,t.dir);if(x!==0)return x;const E=B?.(o.row,i.row)??0;return E!==0?E:o.index-i.index}).map(o=>o.row),[z,t,B]);d.useEffect(()=>{a!=null&&(v.some(o=>o.key===a)||j(null))},[v,a]),d.useEffect(()=>{const o=i=>{const x=i.target,E=x instanceof HTMLInputElement||x instanceof HTMLTextAreaElement||(x?.isContentEditable??!1);if(i.key==="Escape"&&a!=null){i.preventDefault(),j(null);return}if(E)return;const O=i.key==="j"||i.key==="ArrowDown",js=i.key==="k"||i.key==="ArrowUp";if(O||js){if(C.length===0)return;i.preventDefault();const K=C.findIndex(ks=>ks.key===a),ss=O?C[Math.min(C.length-1,K<0?0:K+1)]:C[Math.max(0,K<0?0:K-1)];ss&&j(ss.key);return}if(i.key==="Enter"&&a!=null){i.preventDefault();return}};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[C,a]);const ps=o=>{I(i=>{const x=new Set(i);return x.has(o)?x.delete(o):x.add(o),x})},hs=o=>{y(i=>{const x=new Set(i);return x.has(o)?x.delete(o):x.add(o),x})},g=d.useMemo(()=>a!=null?v.find(o=>o.key===a)??null:null,[v,a]),fs=d.useMemo(()=>g?l?.processes.find(o=>o.pid===g.pid)??null:null,[l,g]),xs=d.useMemo(()=>g?s.filter(o=>g.sessionId?o.sessionId===g.sessionId:o.pid===g.pid).slice(-40):[],[s,g]);return e.jsxs("div",{className:"s-atop",children:[e.jsx(Hs,{summary:M,runHistory:L,toolHistory:V}),e.jsx(vs,{title:"Harness families",size:"compact",maxAgents:6,maxTasks:3,showEmpty:!0}),e.jsx(Fs,{search:f,onSearch:u,harnessOptions:ds,harnessFilter:h,onToggleHarness:ps,statusOptions:ms,statusFilter:k,onToggleStatus:hs,summary:M}),e.jsx(ys,{rows:z,columns:Ds,rowId:o=>o.key,storageKey:"openscout.atop.cols",sort:t,onSortChange:r,secondarySort:B,onRowClick:o=>j(o.key),rowClassName:o=>a===o.key?"s-atop-row--selected":void 0,empty:{title:"no agents match",body:"adjust filters or start a session to populate"},density:"compact",className:"s-atop-data-table",ariaLabel:"Agent activity inventory"}),e.jsx(_s,{shown:C.length,total:v.length,hasSelection:a!=null}),g&&e.jsx(zs,{row:g,process:fs,events:xs,now:m,onClose:()=>j(null)})]})}function Hs({summary:s,runHistory:n,toolHistory:l}){return e.jsxs("div",{className:"s-atop-summary",children:[e.jsxs("div",{className:"s-atop-summary-cell s-atop-summary-cell--primary",children:[e.jsxs("div",{className:"s-atop-summary-num",children:[e.jsx("strong",{children:s.running}),e.jsxs("span",{className:"s-atop-summary-of",children:["/ ",s.total]})]}),e.jsx("span",{className:"s-atop-summary-lbl",children:"active"}),e.jsx(ls,{values:n,color:"var(--green)"})]}),e.jsxs("div",{className:"s-atop-summary-cell",children:[e.jsx("div",{className:"s-atop-summary-num",children:e.jsx("strong",{children:s.tooling})}),e.jsx("span",{className:"s-atop-summary-lbl",children:"working"}),e.jsx(ls,{values:l,color:"var(--accent)"})]}),e.jsxs("div",{className:"s-atop-summary-cell",children:[e.jsx("div",{className:"s-atop-summary-num",children:e.jsx("strong",{children:s.idle})}),e.jsx("span",{className:"s-atop-summary-lbl",children:"idle"})]}),e.jsxs("div",{className:"s-atop-summary-cell s-atop-summary-cell--breakdown",children:[e.jsx("span",{className:"s-atop-summary-lbl",children:"harness"}),e.jsx("div",{className:"s-atop-summary-row",children:s.harnesses.length>0?s.harnesses.slice(0,4).map(c=>e.jsxs("span",{className:Z(c.harness),children:[e.jsx(H,{harness:c.harness,size:11,title:null}),F(c.harness)," ",c.count]},c.harness)):e.jsx("span",{className:"s-atop-chip s-atop-chip--mute",children:"none"})})]}),e.jsx("div",{className:"s-atop-summary-spacer"}),e.jsxs("div",{className:"s-atop-summary-cell s-atop-summary-cell--rate",children:[e.jsxs("div",{className:"s-atop-summary-num",children:[e.jsx("strong",{children:s.reqsPerMin}),e.jsx("span",{className:"s-atop-summary-of",children:"/ min"})]}),e.jsx("span",{className:"s-atop-summary-lbl",children:"requests"})]})]})}function Fs({search:s,onSearch:n,harnessOptions:l,harnessFilter:c,onToggleHarness:m,statusOptions:p,statusFilter:f,onToggleStatus:u,summary:h}){const I=t=>h.harnesses.find(r=>r.harness===t)?.count??0,k=t=>t==="tool"?h.tooling:t==="run"?h.running-h.tooling:h.idle,y=d.useRef(null);return d.useEffect(()=>{const t=r=>{if(r.key!=="/")return;const a=r.target;a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||(a?.isContentEditable??!1)||(r.preventDefault(),y.current?.focus())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[]),e.jsxs("div",{className:"s-atop-fbar",children:[e.jsxs("div",{className:"s-atop-search",children:[e.jsx("span",{className:"s-atop-search-prompt",children:"▸"}),e.jsx("input",{ref:y,className:"s-atop-search-input",value:s,onChange:t=>n(t.target.value),placeholder:"filter by pid · project · command · summary",spellCheck:!1}),e.jsx("span",{className:"s-atop-search-kbd",children:"/"})]}),l.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"s-atop-fbar-label",children:"harness"}),l.map(t=>{const r=c.has(t);return e.jsxs("button",{className:`s-atop-pill s-atop-pill--harness${r?" s-atop-pill--on":""}`,onClick:()=>m(t),children:[e.jsx(H,{harness:t,size:11,title:null}),F(t),e.jsx("span",{className:"s-atop-pill-ct",children:I(t)})]},t)})]}),p.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"s-atop-fbar-label",children:"status"}),["tool","run","idle"].filter(t=>p.includes(t)).map(t=>{const r=f.has(t);return e.jsxs("button",{className:`s-atop-pill s-atop-pill--status-${t}${r?" s-atop-pill--on":""}`,onClick:()=>u(t),children:[X[t],e.jsx("span",{className:"s-atop-pill-ct",children:k(t)})]},t)})]}),e.jsx("div",{className:"s-atop-fbar-spacer"})]})}const Ds=[{key:"status",label:"Status",cls:"s-atop-col-status",kind:"text",defaultWidth:96,minWidth:70,sortValue:s=>P[s.status],render:s=>e.jsxs("span",{className:`s-atop-status s-atop-status--${s.status}`,children:[e.jsx("span",{className:"s-atop-status-dot"}),X[s.status]]})},{key:"agent",label:"Agent",cls:"s-atop-col-agent",kind:"text",tip:"Harness · short session id",defaultWidth:168,minWidth:110,sortValue:s=>`${s.harness}\0${s.sessionId??""}`,render:s=>e.jsxs("div",{className:"s-atop-agent-cell",children:[e.jsxs("span",{className:Z(s.harness),title:`origin: ${q[s.attribution]}`,children:[e.jsx(H,{harness:s.harness,size:11,title:null}),F(s.harness)]}),e.jsx("span",{className:"s-atop-agent-id",title:s.sessionId??`pid ${s.pid}`,children:Q(s.sessionId)})]})},{key:"project",label:"Project",cls:"s-atop-col-project",kind:"text",defaultWidth:200,minWidth:96,maxWidth:480,sortValue:s=>s.project,render:s=>e.jsx("span",{title:s.cwd,children:s.project})},{key:"reqs",label:"Reqs",cls:"s-atop-col-num",kind:"number",tip:"Model invocations (assistant turns) for this session",defaultWidth:64,minWidth:56,sortValue:s=>s.reqCount,render:s=>e.jsx(W,{value:s.reqCount||null})},{key:"tokIn",label:"Tok ↓",cls:"s-atop-col-num",kind:"number",tip:"Input tokens — populated when backend emits usage",defaultWidth:64,minWidth:56,sortValue:s=>s.tokIn,render:s=>e.jsx(W,{value:s.tokIn})},{key:"tokOut",label:"Tok ↑",cls:"s-atop-col-num",kind:"number",tip:"Output tokens — populated when backend emits usage",defaultWidth:64,minWidth:56,sortValue:s=>s.tokOut,render:s=>e.jsx(W,{value:s.tokOut})},{key:"cache",label:"Cache",cls:"s-atop-col-num",kind:"number",tip:"Cache hit rate — populated when backend emits usage",defaultWidth:64,minWidth:56,sortValue:s=>$(s),render:s=>e.jsx(Vs,{value:$(s)})},{key:"tools",label:"Tools",cls:"s-atop-col-num",kind:"number",defaultWidth:64,minWidth:56,sortValue:s=>s.toolCount,render:s=>e.jsx(W,{value:s.toolCount||null})},{key:"perms",label:"Perms",cls:"s-atop-col-num",kind:"number",tip:"Permission requests — heuristic count of permission-mode events",defaultWidth:64,minWidth:56,sortValue:s=>s.permCount,render:s=>e.jsx(W,{value:s.permCount||null,accent:s.permCount>0?"amber":void 0})},{key:"last",label:"Last",cls:"s-atop-col-last",kind:"time",defaultWidth:86,minWidth:64,sortValue:s=>s.lastEventAt,render:s=>is(s.lastEventAt,Date.now())},{key:"runtime",label:"Runtime",cls:"s-atop-col-runtime",kind:"number",tip:"Session duration (active period in current buffer)",defaultWidth:80,minWidth:64,sortValue:s=>s.sessionRuntimeSec,render:s=>rs(s.sessionRuntimeSec)}];function W({value:s,accent:n}){const l=s==null?"s-atop-col-num s-atop-col-num--dim":`s-atop-col-num${n?` s-atop-col-num--${n}`:""}`;return e.jsx("span",{className:l,children:S(s)})}function Vs({value:s}){const n=s==null?"s-atop-col-num s-atop-col-num--dim":"s-atop-col-num";return e.jsx("span",{className:n,children:us(s)})}function _s({shown:s,total:n,hasSelection:l}){return e.jsxs("div",{className:"s-atop-keys",children:[e.jsxs("span",{className:"s-atop-keys-count",children:[e.jsx("strong",{children:s})," / ",n," agents"]}),e.jsx("span",{className:"s-atop-keys-spacer"}),e.jsxs("span",{children:[e.jsx("kbd",{children:"/"})," filter"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"j"}),"/",e.jsx("kbd",{children:"k"})," select"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"click"})," drill in"]}),l&&e.jsxs("span",{children:[e.jsx("kbd",{children:"esc"})," close"]})]})}function zs({row:s,process:n,events:l,now:c,onClose:m}){const p=d.useMemo(()=>{const u={};for(const k of l){if(k.kind!=="tool")continue;const y=k.summary.match(/^([a-z_][a-z0-9_]*)/i),t=y?y[1]:"(tool)";u[t]=(u[t]??0)+1}const h=Object.entries(u).sort((k,y)=>y[1]-k[1]).slice(0,6),I=Math.max(1,...h.map(k=>k[1]));return h.map(([k,y])=>({name:k,count:y,frac:y/I}))},[l]),f=l.slice(-40).reverse();return e.jsxs("aside",{className:"s-atop-drawer","aria-label":`Agent ${s.key}`,children:[e.jsxs("header",{className:"s-atop-drawer-head",children:[e.jsxs("div",{className:"s-atop-drawer-head-meta",children:[e.jsxs("span",{className:`s-atop-status s-atop-status--${s.status}`,children:[e.jsx("span",{className:"s-atop-status-dot"}),X[s.status]]}),e.jsx("span",{className:"s-atop-drawer-pid",children:s.pid>0?`pid ${s.pid}`:"transcript"}),e.jsxs("span",{className:Z(s.harness),title:`origin: ${q[s.attribution]}`,children:[e.jsx(H,{harness:s.harness,size:11,title:null}),F(s.harness)]}),e.jsxs("span",{className:"s-atop-drawer-session",children:["session ",Q(s.sessionId)]})]}),e.jsx("h2",{className:"s-atop-drawer-title",children:s.project}),e.jsxs("p",{className:"s-atop-drawer-sub",children:["session ",Q(s.sessionId)," · runtime ",rs(s.sessionRuntimeSec)," · last activity ",is(s.lastEventAt,c)]}),e.jsx("button",{className:"s-atop-drawer-close",onClick:m,"aria-label":"Close (Esc)",children:"✕"})]}),e.jsxs("div",{className:"s-atop-drawer-body",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"s-atop-drawer-h3",children:"Activity"}),e.jsxs("div",{className:"s-atop-metrics",children:[e.jsx(b,{label:"Requests",value:S(s.reqCount||null)}),e.jsx(b,{label:"Tools",value:S(s.toolCount||null)}),e.jsx(b,{label:"Permissions",value:S(s.permCount||null),accent:s.permCount>0?"amber":void 0}),e.jsx(b,{label:"Tok in",value:S(s.tokIn),dim:s.tokIn==null}),e.jsx(b,{label:"Tok out",value:S(s.tokOut),dim:s.tokOut==null}),e.jsx(b,{label:"Cache hit",value:us($(s)),dim:$(s)==null}),e.jsx(b,{label:"Model",value:s.model??"—",dim:s.model==null}),e.jsx(b,{label:"Events",value:S(s.eventCount||null)})]})]}),p.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"s-atop-drawer-h3",children:"Tool calls"}),e.jsx("ul",{className:"s-atop-histo",children:p.map(u=>e.jsxs("li",{children:[e.jsx("span",{className:"s-atop-histo-name",children:u.name}),e.jsx("span",{className:"s-atop-histo-bar",children:e.jsx("span",{className:"s-atop-histo-fill",style:{width:`${(u.frac*100).toFixed(1)}%`}})}),e.jsx("span",{className:"s-atop-histo-count",children:u.count})]},u.name))})]}),e.jsxs("section",{children:[e.jsxs("h3",{className:"s-atop-drawer-h3",children:["Recent activity",e.jsxs("span",{className:"s-atop-drawer-h3-aside",children:[l.length," buffered"]})]}),f.length===0?e.jsx("div",{className:"s-atop-peek-empty",children:"no events buffered for this agent yet"}):e.jsx("ol",{className:"s-atop-peek",children:f.map(u=>e.jsxs("li",{className:`s-atop-peek-row s-atop-peek-row--${u.kind}`,children:[e.jsx("span",{className:"s-atop-peek-time",children:$s(u.ts)}),e.jsx("span",{className:"s-atop-peek-kind",children:u.kind}),e.jsx("span",{className:"s-atop-peek-text",children:u.summary})]},u.id))})]}),e.jsxs("section",{className:"s-atop-drawer-section--secondary",children:[e.jsx("h3",{className:"s-atop-drawer-h3",children:"Process"}),e.jsx("code",{className:"s-atop-codeblock",children:s.command}),e.jsxs("dl",{className:"s-atop-kvs",children:[e.jsx("dt",{children:"PID"}),e.jsx("dd",{children:s.pid>0?s.pid:"transcript-only"}),e.jsx("dt",{children:"Parent"}),e.jsxs("dd",{children:[s.parentLabel," (ppid ",s.ppid,")"]}),e.jsx("dt",{children:"Process etime"}),e.jsx("dd",{children:s.procEtime}),s.transcriptPath&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Transcript"}),e.jsx("dd",{children:s.transcriptPath})]}),e.jsx("dt",{children:"Origin"}),e.jsx("dd",{children:q[s.attribution]}),e.jsx("dt",{children:"CWD"}),e.jsx("dd",{children:s.cwd||"(none)"})]}),n?.parentChain&&n.parentChain.length>0&&e.jsx("ol",{className:"s-atop-chain",children:n.parentChain.map(u=>e.jsxs("li",{children:[e.jsx("span",{className:"s-atop-chain-pid",children:u.pid}),e.jsx("span",{className:"s-atop-chain-cmd",children:ws(u.command,80)})]},u.pid))})]})]})]})}function b({label:s,value:n,dim:l,accent:c}){const m=`s-atop-metric${l?" s-atop-metric--dim":""}${c?` s-atop-metric--${c}`:""}`;return e.jsxs("div",{className:m,children:[e.jsx("span",{className:"s-atop-metric-lbl",children:s}),e.jsx("span",{className:"s-atop-metric-val",children:n})]})}export{ne as AtopView};
1
+ import{r as d,j as e}from"./index-NRbRrZw-.js";/* empty css */import{D as ys}from"./DataTable-DFacT2uu.js";import{H,h as F}from"./HarnessMark-CEzmPFHC.js";import{O as vs}from"./ObservedTopologyPanel-CfHYu-4Z.js";import{a as es}from"./api-DEHEgJ9m.js";import{o as ts,i as U}from"./surface-activity-B1rgWB1i.js";import{a as Ns,d as gs}from"./time-Dhsh_2EG.js";import{u as Is}from"./tail-events-B7BrDaFi.js";/* empty css */import"./index-BWHgHrtv.js";const ns=4e3,bs=500,Cs=5e3,Es=5e3,Ss=6e4,q={"scout-managed":"scout","hudson-managed":"hudson",unattributed:"native"},X={tool:"working",run:"active",idle:"idle"};function G(s){const n=s.split(/\s+/)[0]??"",l=n.lastIndexOf("/");return l>=0?n.slice(l+1):n}function ws(s,n=60){const l=s.split(/\s+/);if(l.length===0)return s;l[0]=G(l[0]);const c=l.join(" ");return c.length<=n?c:c.slice(0,n-1)+"…"}function Ms(s){for(const n of s){const l=G(n.command);if(l&&!(l==="sh"||l==="zsh"||l==="bash"||l==="login"))return l}return s[0]?.command?G(s[0].command):"—"}function As(s){const n=s.match(/^(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)$/);if(!n){const u=s.match(/^(\d+)$/);return u?Number.parseInt(u[1],10):0}const[,l,c,m,p]=n;let f=Number.parseInt(p,10)+Number.parseInt(m,10)*60;return c&&(f+=Number.parseInt(c,10)*3600),l&&(f+=Number.parseInt(l,10)*86400),f}function rs(s){if(s<60)return`${s}s`;if(s<3600)return`${Math.floor(s/60)}m${String(s%60).padStart(2,"0")}`;if(s<86400){const c=Math.floor(s/3600),m=Math.floor(s%3600/60);return`${c}h${String(m).padStart(2,"0")}`}const n=Math.floor(s/86400),l=Math.floor(s%86400/3600);return`${n}d${String(l).padStart(2,"0")}h`}function is(s,n){return Ns(s,n)||"—"}function $s(s){return gs(s)||"—"}function Q(s){return s?s.slice(0,8):"—"}function cs(s){return s?.trim().toLowerCase()||"unknown"}function Rs(s){return cs(s).replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function Z(s){return`s-atop-chip s-atop-chip--harness s-atop-chip--harness-${Rs(s)}`}const Ts=/permission-mode/i;function as(s){return s.kind!=="system"?!1:Ts.test(s.summary)}function J(s){return s.kind==="assistant"}function Ws(s,n,l){if(!s)return[];const c=new Map,m=new Map;for(const t of n){let r=c.get(t.pid);if(r||(r={firstEventAt:t.ts,lastEventAt:t.ts,lastKind:t.kind,lastSummary:t.summary,reqCount:0,toolCount:0,permCount:0,eventCount:0,sessionId:t.sessionId||null,model:null,tokIn:null,tokOut:null,cacheReadIn:null,cacheWriteIn:null},c.set(t.pid,r)),t.ts<r.firstEventAt&&(r.firstEventAt=t.ts),t.ts>=r.lastEventAt&&(r.lastEventAt=t.ts,r.lastKind=t.kind,r.lastSummary=t.summary),r.eventCount++,t.kind==="tool"&&r.toolCount++,J(t)&&r.reqCount++,as(t)&&r.permCount++,t.sessionId&&!r.sessionId&&(r.sessionId=t.sessionId),t.sessionId){let a=m.get(t.sessionId);a||(a={firstEventAt:t.ts,lastEventAt:t.ts,lastKind:t.kind,lastSummary:t.summary,reqCount:0,toolCount:0,permCount:0,eventCount:0,sessionId:t.sessionId,model:null,tokIn:null,tokOut:null,cacheReadIn:null,cacheWriteIn:null},m.set(t.sessionId,a)),t.ts<a.firstEventAt&&(a.firstEventAt=t.ts),t.ts>=a.lastEventAt&&(a.lastEventAt=t.ts,a.lastKind=t.kind,a.lastSummary=t.summary),a.eventCount++,t.kind==="tool"&&a.toolCount++,J(t)&&a.reqCount++,as(t)&&a.permCount++}}const p=new Map;for(const t of s.processes){if(!t.cwd)continue;const r=Y(t.source,t.cwd),a=p.get(r);(!a||t.pid<a.pid)&&p.set(r,t)}const f=new Map,u=new Map;for(const t of s.transcripts??[]){const r=Y(t.source,t.cwd),a=os(t),j=u.get(r)??Number.NEGATIVE_INFINITY,N=f.get(r)??"";(t.mtimeMs>j||t.mtimeMs===j&&a>N)&&(u.set(r,t.mtimeMs),f.set(r,a))}const h=new Set,I=(t,r,a,j)=>{r&&h.add(r.pid);let N="idle";const w=Math.max(a?.lastEventAt??0,j?.mtimeMs??0);a&&l-a.lastEventAt<Es&&(N=a.lastKind==="tool"?"tool":"run"),N==="idle"&&l-w<6e4&&(N="run");const L=r?As(r.etime):0,D=a?.firstEventAt??null,V=a&&a.firstEventAt<a.lastEventAt?Math.min(Math.max(0,Math.round((a.lastEventAt-a.firstEventAt)/1e3)),L||Number.POSITIVE_INFINITY):0,_=r?.pid??Os(t),R=j?.cwd??r?.cwd??"";return{key:t,pid:_,ppid:r?.ppid??0,sessionId:j?.sessionId??a?.sessionId??null,transcriptPath:j?.transcriptPath??null,harness:cs(j?.source??r?.source),attribution:r?.harness??j?.harness??"unattributed",project:j?.project?.trim()||(R?Ps(R):"(unknown)"),cwd:R,command:r?.command??`${j?.source??"unknown"} transcript`,parentLabel:r?Ms(r.parentChain??[]):"transcript",procRuntimeSec:L,procEtime:r?.etime??"0",sessionStartAt:D,sessionRuntimeSec:V,status:N,lastEventAt:w||null,lastEventKind:a?.lastKind??null,lastSummary:a?.lastSummary??null,reqCount:a?.reqCount??0,toolCount:a?.toolCount??0,permCount:a?.permCount??0,eventCount:a?.eventCount??0,model:a?.model??null,tokIn:a?.tokIn??null,tokOut:a?.tokOut??null,cacheReadIn:a?.cacheReadIn??null,cacheWriteIn:a?.cacheWriteIn??null}},k=(s.transcripts??[]).map(t=>{const r=os(t),a=Y(t.source,t.cwd),j=f.get(a)===r?p.get(a)??null:null,N=t.sessionId?m.get(t.sessionId):void 0;return I(r,j,N,t)}),y=s.processes.filter(t=>!h.has(t.pid)).map(t=>I(Ls(t),t,c.get(t.pid),null));return[...k,...y]}function $(s){if(s.cacheReadIn==null||s.tokIn==null)return null;const n=s.cacheReadIn+s.tokIn;return n===0?null:s.cacheReadIn/n}function S(s){return s==null?"—":s===0?"0":s>=1e6?(s/1e6).toFixed(s>=1e7?0:1)+"M":s>=1e3?(s/1e3).toFixed(s>=1e4?0:1)+"k":String(s)}function us(s){return s==null?"—":`${Math.round(s*100)}%`}function Ps(s){if(!s)return"";const n=s.lastIndexOf("/");return n>=0?s.slice(n+1):s}function os(s){return`session:${s.source}:${s.sessionId??s.transcriptPath}`}function Ls(s){return`process:${s.source}:${s.pid}`}function Os(s){let n=2166136261;for(let l=0;l<s.length;l+=1)n^=s.charCodeAt(l),n=Math.imul(n,16777619);return-((n>>>0)%9e5+1e3)}function Y(s,n){return`${s}\0${n??""}`}function Ks(s,n,l){const c=l-Ss;let m=0;for(const u of n)J(u)&&u.ts>=c&&m++;const p={total:s.length,running:0,tooling:0,idle:0,harnesses:[],reqsPerMin:m},f=new Map;for(const u of s)u.status==="tool"?(p.tooling++,p.running++):u.status==="run"?p.running++:p.idle++,f.set(u.harness,(f.get(u.harness)??0)+1);return p.harnesses=[...f.entries()].map(([u,h])=>({harness:u,count:h})).sort((u,h)=>h.count-u.count||u.harness.localeCompare(h.harness)),p}const P={tool:0,run:1,idle:2};function A(s){return s??-1}function qs(s,n,l,c){switch(l){case"status":return(P[s.status]-P[n.status])*c;case"agent":{const m=s.harness.localeCompare(n.harness);return m!==0?m*c:(s.sessionId??"").localeCompare(n.sessionId??"")*c}case"project":return s.project.localeCompare(n.project)*c;case"reqs":return(s.reqCount-n.reqCount)*c;case"tokIn":return(A(s.tokIn)-A(n.tokIn))*c;case"tokOut":return(A(s.tokOut)-A(n.tokOut))*c;case"cache":return(A($(s))-A($(n)))*c;case"tools":return(s.toolCount-n.toolCount)*c;case"perms":return(s.permCount-n.permCount)*c;case"last":{const m=s.lastEventAt??0,p=n.lastEventAt??0;return(m-p)*c}case"runtime":return(s.sessionRuntimeSec-n.sessionRuntimeSec)*c}}function ls({values:s,color:n}){if(s.length<2)return e.jsx("svg",{className:"s-atop-spark",width:88,height:18,viewBox:"0 0 88 18"});const m=Math.max(1,...s),p=88/(s.length-1),f=s.map((u,h)=>`${(h*p).toFixed(1)},${(18-u/m*18).toFixed(1)}`).join(" ");return e.jsx("svg",{className:"s-atop-spark",width:88,height:18,viewBox:"0 0 88 18",children:e.jsx("polyline",{fill:"none",stroke:n,strokeWidth:"1.25",points:f})})}function ne(){const[s,n]=d.useState([]),[l,c]=d.useState(null),[m,p]=d.useState(()=>Date.now()),[f,u]=d.useState(""),[h,I]=d.useState(()=>new Set),[k,y]=d.useState(()=>new Set),[t,r]=d.useState({key:"status",dir:1}),[a,j]=d.useState(null),N=d.useRef([]),w=d.useRef([]),[L,D]=d.useState([]),[V,_]=d.useState([]),R=d.useCallback(o=>{n(i=>i.length>=ns?[...i.slice(i.length-ns+1),o]:[...i,o])},[]);Is(R),d.useEffect(()=>{let o=!1,i=!1;const x=async()=>{if(!(i||!U()))try{const O=await es(`/api/tail/recent?limit=${bs}`);o||(i=!0,n(O.events??[]))}catch{}};x();const E=ts(()=>{x()});return()=>{o=!0,E()}},[]);const T=d.useCallback(async()=>{if(U())try{const o=await es("/api/tail/discover");c(o)}catch{}},[]);d.useEffect(()=>{T();const o=setInterval(()=>{T()},Cs),i=ts(()=>{T()});return()=>{clearInterval(o),i()}},[T]),d.useEffect(()=>{const o=setInterval(()=>{U()&&p(Date.now())},1e3);return()=>clearInterval(o)},[]);const v=d.useMemo(()=>Ws(l,s,m),[l,s,m]),M=d.useMemo(()=>Ks(v,s,m),[v,s,m]);d.useEffect(()=>{N.current=[...N.current,M.running].slice(-24),w.current=[...w.current,M.tooling].slice(-24),D(N.current),_(w.current)},[M.running,M.tooling]);const ds=d.useMemo(()=>{const o=new Set;return v.forEach(i=>o.add(i.harness)),[...o]},[v]),ms=d.useMemo(()=>{const o=new Set;return v.forEach(i=>o.add(i.status)),[...o]},[v]),z=d.useMemo(()=>{const o=f.trim().toLowerCase();return v.filter(i=>{if(h.size>0&&!h.has(i.harness)||k.size>0&&!k.has(i.status))return!1;if(!o)return!0;const x=q[i.attribution];return`${i.pid} ${i.project} ${i.command} ${i.harness} ${i.attribution} ${x} ${i.sessionId??""} ${i.transcriptPath??""} ${i.lastSummary??""}`.toLowerCase().includes(o)})},[v,f,h,k]),B=d.useMemo(()=>t.key==="status"?void 0:(o,i)=>P[o.status]-P[i.status],[t.key]),C=d.useMemo(()=>z.map((o,i)=>({row:o,index:i})).sort((o,i)=>{const x=qs(o.row,i.row,t.key,t.dir);if(x!==0)return x;const E=B?.(o.row,i.row)??0;return E!==0?E:o.index-i.index}).map(o=>o.row),[z,t,B]);d.useEffect(()=>{a!=null&&(v.some(o=>o.key===a)||j(null))},[v,a]),d.useEffect(()=>{const o=i=>{const x=i.target,E=x instanceof HTMLInputElement||x instanceof HTMLTextAreaElement||(x?.isContentEditable??!1);if(i.key==="Escape"&&a!=null){i.preventDefault(),j(null);return}if(E)return;const O=i.key==="j"||i.key==="ArrowDown",js=i.key==="k"||i.key==="ArrowUp";if(O||js){if(C.length===0)return;i.preventDefault();const K=C.findIndex(ks=>ks.key===a),ss=O?C[Math.min(C.length-1,K<0?0:K+1)]:C[Math.max(0,K<0?0:K-1)];ss&&j(ss.key);return}if(i.key==="Enter"&&a!=null){i.preventDefault();return}};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[C,a]);const ps=o=>{I(i=>{const x=new Set(i);return x.has(o)?x.delete(o):x.add(o),x})},hs=o=>{y(i=>{const x=new Set(i);return x.has(o)?x.delete(o):x.add(o),x})},g=d.useMemo(()=>a!=null?v.find(o=>o.key===a)??null:null,[v,a]),fs=d.useMemo(()=>g?l?.processes.find(o=>o.pid===g.pid)??null:null,[l,g]),xs=d.useMemo(()=>g?s.filter(o=>g.sessionId?o.sessionId===g.sessionId:o.pid===g.pid).slice(-40):[],[s,g]);return e.jsxs("div",{className:"s-atop",children:[e.jsx(Hs,{summary:M,runHistory:L,toolHistory:V}),e.jsx(vs,{title:"Harness families",size:"compact",maxAgents:6,maxTasks:3,showEmpty:!0}),e.jsx(Fs,{search:f,onSearch:u,harnessOptions:ds,harnessFilter:h,onToggleHarness:ps,statusOptions:ms,statusFilter:k,onToggleStatus:hs,summary:M}),e.jsx(ys,{rows:z,columns:Ds,rowId:o=>o.key,storageKey:"openscout.atop.cols",sort:t,onSortChange:r,secondarySort:B,onRowClick:o=>j(o.key),rowClassName:o=>a===o.key?"s-atop-row--selected":void 0,empty:{title:"no agents match",body:"adjust filters or start a session to populate"},density:"compact",className:"s-atop-data-table",ariaLabel:"Agent activity inventory"}),e.jsx(_s,{shown:C.length,total:v.length,hasSelection:a!=null}),g&&e.jsx(zs,{row:g,process:fs,events:xs,now:m,onClose:()=>j(null)})]})}function Hs({summary:s,runHistory:n,toolHistory:l}){return e.jsxs("div",{className:"s-atop-summary",children:[e.jsxs("div",{className:"s-atop-summary-cell s-atop-summary-cell--primary",children:[e.jsxs("div",{className:"s-atop-summary-num",children:[e.jsx("strong",{children:s.running}),e.jsxs("span",{className:"s-atop-summary-of",children:["/ ",s.total]})]}),e.jsx("span",{className:"s-atop-summary-lbl",children:"active"}),e.jsx(ls,{values:n,color:"var(--green)"})]}),e.jsxs("div",{className:"s-atop-summary-cell",children:[e.jsx("div",{className:"s-atop-summary-num",children:e.jsx("strong",{children:s.tooling})}),e.jsx("span",{className:"s-atop-summary-lbl",children:"working"}),e.jsx(ls,{values:l,color:"var(--accent)"})]}),e.jsxs("div",{className:"s-atop-summary-cell",children:[e.jsx("div",{className:"s-atop-summary-num",children:e.jsx("strong",{children:s.idle})}),e.jsx("span",{className:"s-atop-summary-lbl",children:"idle"})]}),e.jsxs("div",{className:"s-atop-summary-cell s-atop-summary-cell--breakdown",children:[e.jsx("span",{className:"s-atop-summary-lbl",children:"harness"}),e.jsx("div",{className:"s-atop-summary-row",children:s.harnesses.length>0?s.harnesses.slice(0,4).map(c=>e.jsxs("span",{className:Z(c.harness),children:[e.jsx(H,{harness:c.harness,size:11,title:null}),F(c.harness)," ",c.count]},c.harness)):e.jsx("span",{className:"s-atop-chip s-atop-chip--mute",children:"none"})})]}),e.jsx("div",{className:"s-atop-summary-spacer"}),e.jsxs("div",{className:"s-atop-summary-cell s-atop-summary-cell--rate",children:[e.jsxs("div",{className:"s-atop-summary-num",children:[e.jsx("strong",{children:s.reqsPerMin}),e.jsx("span",{className:"s-atop-summary-of",children:"/ min"})]}),e.jsx("span",{className:"s-atop-summary-lbl",children:"requests"})]})]})}function Fs({search:s,onSearch:n,harnessOptions:l,harnessFilter:c,onToggleHarness:m,statusOptions:p,statusFilter:f,onToggleStatus:u,summary:h}){const I=t=>h.harnesses.find(r=>r.harness===t)?.count??0,k=t=>t==="tool"?h.tooling:t==="run"?h.running-h.tooling:h.idle,y=d.useRef(null);return d.useEffect(()=>{const t=r=>{if(r.key!=="/")return;const a=r.target;a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||(a?.isContentEditable??!1)||(r.preventDefault(),y.current?.focus())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[]),e.jsxs("div",{className:"s-atop-fbar",children:[e.jsxs("div",{className:"s-atop-search",children:[e.jsx("span",{className:"s-atop-search-prompt",children:"▸"}),e.jsx("input",{ref:y,className:"s-atop-search-input",value:s,onChange:t=>n(t.target.value),placeholder:"filter by pid · project · command · summary",spellCheck:!1}),e.jsx("span",{className:"s-atop-search-kbd",children:"/"})]}),l.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"s-atop-fbar-label",children:"harness"}),l.map(t=>{const r=c.has(t);return e.jsxs("button",{className:`s-atop-pill s-atop-pill--harness${r?" s-atop-pill--on":""}`,onClick:()=>m(t),children:[e.jsx(H,{harness:t,size:11,title:null}),F(t),e.jsx("span",{className:"s-atop-pill-ct",children:I(t)})]},t)})]}),p.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"s-atop-fbar-label",children:"status"}),["tool","run","idle"].filter(t=>p.includes(t)).map(t=>{const r=f.has(t);return e.jsxs("button",{className:`s-atop-pill s-atop-pill--status-${t}${r?" s-atop-pill--on":""}`,onClick:()=>u(t),children:[X[t],e.jsx("span",{className:"s-atop-pill-ct",children:k(t)})]},t)})]}),e.jsx("div",{className:"s-atop-fbar-spacer"})]})}const Ds=[{key:"status",label:"Status",cls:"s-atop-col-status",kind:"text",defaultWidth:96,minWidth:70,sortValue:s=>P[s.status],render:s=>e.jsxs("span",{className:`s-atop-status s-atop-status--${s.status}`,children:[e.jsx("span",{className:"s-atop-status-dot"}),X[s.status]]})},{key:"agent",label:"Agent",cls:"s-atop-col-agent",kind:"text",tip:"Harness · short session id",defaultWidth:168,minWidth:110,sortValue:s=>`${s.harness}\0${s.sessionId??""}`,render:s=>e.jsxs("div",{className:"s-atop-agent-cell",children:[e.jsxs("span",{className:Z(s.harness),title:`origin: ${q[s.attribution]}`,children:[e.jsx(H,{harness:s.harness,size:11,title:null}),F(s.harness)]}),e.jsx("span",{className:"s-atop-agent-id",title:s.sessionId??`pid ${s.pid}`,children:Q(s.sessionId)})]})},{key:"project",label:"Project",cls:"s-atop-col-project",kind:"text",defaultWidth:200,minWidth:96,maxWidth:480,sortValue:s=>s.project,render:s=>e.jsx("span",{title:s.cwd,children:s.project})},{key:"reqs",label:"Reqs",cls:"s-atop-col-num",kind:"number",tip:"Model invocations (assistant turns) for this session",defaultWidth:64,minWidth:56,sortValue:s=>s.reqCount,render:s=>e.jsx(W,{value:s.reqCount||null})},{key:"tokIn",label:"Tok ↓",cls:"s-atop-col-num",kind:"number",tip:"Input tokens — populated when backend emits usage",defaultWidth:64,minWidth:56,sortValue:s=>s.tokIn,render:s=>e.jsx(W,{value:s.tokIn})},{key:"tokOut",label:"Tok ↑",cls:"s-atop-col-num",kind:"number",tip:"Output tokens — populated when backend emits usage",defaultWidth:64,minWidth:56,sortValue:s=>s.tokOut,render:s=>e.jsx(W,{value:s.tokOut})},{key:"cache",label:"Cache",cls:"s-atop-col-num",kind:"number",tip:"Cache hit rate — populated when backend emits usage",defaultWidth:64,minWidth:56,sortValue:s=>$(s),render:s=>e.jsx(Vs,{value:$(s)})},{key:"tools",label:"Tools",cls:"s-atop-col-num",kind:"number",defaultWidth:64,minWidth:56,sortValue:s=>s.toolCount,render:s=>e.jsx(W,{value:s.toolCount||null})},{key:"perms",label:"Perms",cls:"s-atop-col-num",kind:"number",tip:"Permission requests — heuristic count of permission-mode events",defaultWidth:64,minWidth:56,sortValue:s=>s.permCount,render:s=>e.jsx(W,{value:s.permCount||null,accent:s.permCount>0?"amber":void 0})},{key:"last",label:"Last",cls:"s-atop-col-last",kind:"time",defaultWidth:86,minWidth:64,sortValue:s=>s.lastEventAt,render:s=>is(s.lastEventAt,Date.now())},{key:"runtime",label:"Runtime",cls:"s-atop-col-runtime",kind:"number",tip:"Session duration (active period in current buffer)",defaultWidth:80,minWidth:64,sortValue:s=>s.sessionRuntimeSec,render:s=>rs(s.sessionRuntimeSec)}];function W({value:s,accent:n}){const l=s==null?"s-atop-col-num s-atop-col-num--dim":`s-atop-col-num${n?` s-atop-col-num--${n}`:""}`;return e.jsx("span",{className:l,children:S(s)})}function Vs({value:s}){const n=s==null?"s-atop-col-num s-atop-col-num--dim":"s-atop-col-num";return e.jsx("span",{className:n,children:us(s)})}function _s({shown:s,total:n,hasSelection:l}){return e.jsxs("div",{className:"s-atop-keys",children:[e.jsxs("span",{className:"s-atop-keys-count",children:[e.jsx("strong",{children:s})," / ",n," agents"]}),e.jsx("span",{className:"s-atop-keys-spacer"}),e.jsxs("span",{children:[e.jsx("kbd",{children:"/"})," filter"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"j"}),"/",e.jsx("kbd",{children:"k"})," select"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"click"})," drill in"]}),l&&e.jsxs("span",{children:[e.jsx("kbd",{children:"esc"})," close"]})]})}function zs({row:s,process:n,events:l,now:c,onClose:m}){const p=d.useMemo(()=>{const u={};for(const k of l){if(k.kind!=="tool")continue;const y=k.summary.match(/^([a-z_][a-z0-9_]*)/i),t=y?y[1]:"(tool)";u[t]=(u[t]??0)+1}const h=Object.entries(u).sort((k,y)=>y[1]-k[1]).slice(0,6),I=Math.max(1,...h.map(k=>k[1]));return h.map(([k,y])=>({name:k,count:y,frac:y/I}))},[l]),f=l.slice(-40).reverse();return e.jsxs("aside",{className:"s-atop-drawer","aria-label":`Agent ${s.key}`,children:[e.jsxs("header",{className:"s-atop-drawer-head",children:[e.jsxs("div",{className:"s-atop-drawer-head-meta",children:[e.jsxs("span",{className:`s-atop-status s-atop-status--${s.status}`,children:[e.jsx("span",{className:"s-atop-status-dot"}),X[s.status]]}),e.jsx("span",{className:"s-atop-drawer-pid",children:s.pid>0?`pid ${s.pid}`:"transcript"}),e.jsxs("span",{className:Z(s.harness),title:`origin: ${q[s.attribution]}`,children:[e.jsx(H,{harness:s.harness,size:11,title:null}),F(s.harness)]}),e.jsxs("span",{className:"s-atop-drawer-session",children:["session ",Q(s.sessionId)]})]}),e.jsx("h2",{className:"s-atop-drawer-title",children:s.project}),e.jsxs("p",{className:"s-atop-drawer-sub",children:["session ",Q(s.sessionId)," · runtime ",rs(s.sessionRuntimeSec)," · last activity ",is(s.lastEventAt,c)]}),e.jsx("button",{className:"s-atop-drawer-close",onClick:m,"aria-label":"Close (Esc)",children:"✕"})]}),e.jsxs("div",{className:"s-atop-drawer-body",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"s-atop-drawer-h3",children:"Activity"}),e.jsxs("div",{className:"s-atop-metrics",children:[e.jsx(b,{label:"Requests",value:S(s.reqCount||null)}),e.jsx(b,{label:"Tools",value:S(s.toolCount||null)}),e.jsx(b,{label:"Permissions",value:S(s.permCount||null),accent:s.permCount>0?"amber":void 0}),e.jsx(b,{label:"Tok in",value:S(s.tokIn),dim:s.tokIn==null}),e.jsx(b,{label:"Tok out",value:S(s.tokOut),dim:s.tokOut==null}),e.jsx(b,{label:"Cache hit",value:us($(s)),dim:$(s)==null}),e.jsx(b,{label:"Model",value:s.model??"—",dim:s.model==null}),e.jsx(b,{label:"Events",value:S(s.eventCount||null)})]})]}),p.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"s-atop-drawer-h3",children:"Tool calls"}),e.jsx("ul",{className:"s-atop-histo",children:p.map(u=>e.jsxs("li",{children:[e.jsx("span",{className:"s-atop-histo-name",children:u.name}),e.jsx("span",{className:"s-atop-histo-bar",children:e.jsx("span",{className:"s-atop-histo-fill",style:{width:`${(u.frac*100).toFixed(1)}%`}})}),e.jsx("span",{className:"s-atop-histo-count",children:u.count})]},u.name))})]}),e.jsxs("section",{children:[e.jsxs("h3",{className:"s-atop-drawer-h3",children:["Recent activity",e.jsxs("span",{className:"s-atop-drawer-h3-aside",children:[l.length," buffered"]})]}),f.length===0?e.jsx("div",{className:"s-atop-peek-empty",children:"no events buffered for this agent yet"}):e.jsx("ol",{className:"s-atop-peek",children:f.map(u=>e.jsxs("li",{className:`s-atop-peek-row s-atop-peek-row--${u.kind}`,children:[e.jsx("span",{className:"s-atop-peek-time",children:$s(u.ts)}),e.jsx("span",{className:"s-atop-peek-kind",children:u.kind}),e.jsx("span",{className:"s-atop-peek-text",children:u.summary})]},u.id))})]}),e.jsxs("section",{className:"s-atop-drawer-section--secondary",children:[e.jsx("h3",{className:"s-atop-drawer-h3",children:"Process"}),e.jsx("code",{className:"s-atop-codeblock",children:s.command}),e.jsxs("dl",{className:"s-atop-kvs",children:[e.jsx("dt",{children:"PID"}),e.jsx("dd",{children:s.pid>0?s.pid:"transcript-only"}),e.jsx("dt",{children:"Parent"}),e.jsxs("dd",{children:[s.parentLabel," (ppid ",s.ppid,")"]}),e.jsx("dt",{children:"Process etime"}),e.jsx("dd",{children:s.procEtime}),s.transcriptPath&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Transcript"}),e.jsx("dd",{children:s.transcriptPath})]}),e.jsx("dt",{children:"Origin"}),e.jsx("dd",{children:q[s.attribution]}),e.jsx("dt",{children:"CWD"}),e.jsx("dd",{children:s.cwd||"(none)"})]}),n?.parentChain&&n.parentChain.length>0&&e.jsx("ol",{className:"s-atop-chain",children:n.parentChain.map(u=>e.jsxs("li",{children:[e.jsx("span",{className:"s-atop-chain-pid",children:u.pid}),e.jsx("span",{className:"s-atop-chain-cmd",children:ws(u.command,80)})]},u.pid))})]})]})]})}function b({label:s,value:n,dim:l,accent:c}){const m=`s-atop-metric${l?" s-atop-metric--dim":""}${c?` s-atop-metric--${c}`:""}`;return e.jsxs("div",{className:m,children:[e.jsx("span",{className:"s-atop-metric-lbl",children:s}),e.jsx("span",{className:"s-atop-metric-val",children:n})]})}export{ne as AtopView};
@@ -1 +1 @@
1
- import{r as k,j as s}from"./index-Bli6bTLU.js";import{u as d,m as B,n as m}from"./router-B0YclXYg.js";function p(t){switch(t.view){case"mesh":return"Back to mesh";case"ops":return"Back to ops";case"agents-v2":return t.agentId?"Registry":"All agents";case"messages":return"Back to conversations";case"conversation":return"Back to conversation";case"inbox":return"Back to inbox";case"sessions":return"Back to sessions";case"terminal":return"Terminal Control";case"work":return"Back to work";case"broker":return"Back to broker";case"activity":return"Back to activity";default:return"Back"}}function w({slot:t,fallback:n,navigate:c,className:r,label:i}){const e=d(),o=k.useMemo(()=>B(e.state),[e.state]),a=o??n,u=i??p(a),l=m(e.state)&&!!o;return s.jsxs("button",{type:"button",className:`s-back-pill${r?` ${r}`:""}`,onClick:()=>{if(l&&typeof window<"u"&&window.history.length>1){window.history.back();return}c(a)},children:[s.jsx("span",{"aria-hidden":!0,className:"s-back-pill-glyph",children:"←"}),s.jsx("span",{children:u})]})}export{w as B};
1
+ import{r as k,j as s}from"./index-NRbRrZw-.js";import{u as d,m as B,n as m}from"./router-Bx1tiwVe.js";function p(t){switch(t.view){case"mesh":return"Back to mesh";case"ops":return"Back to ops";case"agents-v2":return t.agentId?"Registry":"All agents";case"messages":return"Back to conversations";case"conversation":return"Back to conversation";case"inbox":return"Back to inbox";case"sessions":return"Back to sessions";case"terminal":return"Terminal Control";case"work":return"Back to work";case"broker":return"Back to broker";case"activity":return"Back to activity";default:return"Back"}}function w({slot:t,fallback:n,navigate:c,className:r,label:i}){const e=d(),o=k.useMemo(()=>B(e.state),[e.state]),a=o??n,u=i??p(a),l=m(e.state)&&!!o;return s.jsxs("button",{type:"button",className:`s-back-pill${r?` ${r}`:""}`,onClick:()=>{if(l&&typeof window<"u"&&window.history.length>1){window.history.back();return}c(a)},children:[s.jsx("span",{"aria-hidden":!0,className:"s-back-pill-glyph",children:"←"}),s.jsx("span",{children:u})]})}export{w as B};
@@ -1 +1 @@
1
- import{r as o,j as e}from"./index-Bli6bTLU.js";import{E as p}from"./EmptyState-BnDda92b.js";import{a as f}from"./api-DEHEgJ9m.js";import{S as b}from"./scoutbot-markdown-BJJyaPu2.js";import{b as h,t as u}from"./time-Dhsh_2EG.js";/* empty css *//* empty css */import"./Provider-Ve8yXaWR.js";import"./provider-CX9EWecp.js";import"./router-B0YclXYg.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-D4dHTRkt.js";import"./sse-CSozY6mp.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-D4vuKzOL.js";import"./DocumentFocusViewer-DmtFisY9.js";import"./createLucideIcon-DLlxGjKt.js";import"./TextDocumentSurface-C7fGlzY8.js";import"./file-text-BVhkMWyC.js";import"./x-BJyPzFnn.js";import"./chevron-right-BMqtBds_.js";import"./code-xml-ByQsfOI_.js";import"./arrow-left-i-h6JAgs.js";import"./arrow-right-B0Yi01Zr.js";import"./scout-voice-DvG_3stJ.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-7iEtvu9P.js";import"./NewChatComposer-Bgqes0UQ.js";import"./text-BR9Bap0E.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-DoT8gpw6.js";import"./conversation-model-CigSPlKA.js";import"./index-DFdlQs_c.js";import"./HarnessMark-DGZ6o6Ct.js";import"./NewChatOrigin-DpHS2Wmt.js";import"./chevron-down-Da5tV19_.js";import"./search-BbgsEMXa.js";import"./chunk-HRAB3GC3-BUVYXXAp.js";import"./external-link-BGHC_naA.js";const g={"fleet-home":"fleet briefing",tour:"tour briefing"};function fe({briefingId:s,navigate:i}){const[r,n]=o.useState(null),[t,a]=o.useState(null),c=o.useCallback(async()=>{try{const d=await f(`/api/briefings/${encodeURIComponent(s)}`);n(d),a(null)}catch(d){a(d instanceof Error?d.message:"Failed to load briefing")}},[s]);return o.useEffect(()=>{c()},[c]),t?e.jsxs("div",{className:"sys-surface-page sys-surface-page-wide",children:[e.jsx("button",{type:"button",className:"briefing-detail-back",onClick:()=>i({view:"briefings"}),children:"← back to briefings"}),e.jsx(p,{title:"Couldn't load briefing",body:t})]}):r?e.jsxs("div",{className:"sys-surface-page sys-surface-page-wide briefing-detail",children:[e.jsx("button",{type:"button",className:"briefing-detail-back",onClick:()=>i({view:"briefings"}),children:"← back to briefings"}),e.jsxs("header",{className:"briefing-detail-header",children:[e.jsx("h2",{children:r.title}),e.jsxs("div",{className:"briefing-detail-header-meta",children:[e.jsx("span",{className:`briefing-kind briefing-kind-${r.kind}`,children:g[r.kind]}),e.jsx("span",{children:h(r.preparedAt)}),e.jsxs("span",{children:["· ",u(r.preparedAt)]})]}),e.jsx("p",{className:"briefing-detail-summary",children:r.summary}),r.recommendation?e.jsx("div",{className:"briefing-detail-recommendation",children:r.recommendation}):null]}),r.markdown?e.jsx(x,{markdown:r.markdown}):null,r.brief?.presented?e.jsx(y,{presented:r.brief.presented}):null,e.jsx(j,{call:r.call}),e.jsx(N,{brief:r.brief,navigate:i}),e.jsx(k,{observations:r.observations,navigate:i}),e.jsx(v,{snapshot:r.snapshot,call:r.call})]}):e.jsx("div",{className:"sys-surface-page sys-surface-page-wide",children:e.jsx("div",{className:"briefings-placeholder",children:"Loading briefing..."})})}function x({markdown:s}){return e.jsxs("section",{className:"briefing-layer briefing-layer-markdown",children:[e.jsx(l,{eyebrow:"Layer 0",title:"Brief (markdown)"}),e.jsx("div",{className:"briefing-markdown",children:e.jsx(b,{text:s})})]})}function j({call:s}){return!s||!s.telemetry&&!s.presenter?null:e.jsxs("section",{className:"briefing-layer briefing-layer-telemetry",children:[e.jsx(l,{eyebrow:"Telemetry",title:"Calls & usage"}),e.jsxs("dl",{className:"briefing-telemetry",children:[e.jsx(m,{label:"Analyst",model:s.model,responseId:s.responseId,telemetry:s.telemetry??null}),s.presenter?e.jsx(m,{label:"Presenter",model:s.presenter.model,responseId:s.presenter.responseId,telemetry:s.presenter,note:s.presenter.skipped==="rate-guard"?"skipped — rate-guard hit":s.presenter.skipped==="error"?`failed — ${s.presenter.errorMessage??"unknown"}`:null}):null]})]})}function m({label:s,model:i,responseId:r,telemetry:n,note:t}){const a=n?.usage??null;return e.jsxs("div",{className:"briefing-telemetry-row",children:[e.jsxs("div",{className:"briefing-telemetry-row-head",children:[e.jsx("span",{className:"briefing-telemetry-label",children:s}),e.jsx("span",{className:"briefing-telemetry-model",children:i}),t?e.jsx("span",{className:"briefing-telemetry-note",children:t}):null]}),e.jsxs("div",{className:"briefing-telemetry-stats",children:[e.jsx("span",{children:n&&n.elapsedMs>0?`${(n.elapsedMs/1e3).toFixed(2)}s`:"—"}),e.jsxs("span",{children:["in ",a?.inputTokens??"—"]}),e.jsxs("span",{children:["out ",a?.outputTokens??"—"]}),e.jsxs("span",{children:["total ",a?.totalTokens??"—"]}),r?e.jsx("span",{className:"briefing-telemetry-response",children:r}):null]})]})}function y({presented:s}){return e.jsxs("section",{className:"briefing-layer briefing-layer-presented",children:[e.jsx(l,{eyebrow:"Spoken",title:`Presented as · ${s.voiceSpec.persona}, ~${s.voiceSpec.targetWords} words`}),e.jsx("ol",{className:"briefing-presented-sentences",children:s.sentences.map((i,r)=>e.jsx("li",{className:"briefing-presented-sentence",children:i},r))}),e.jsxs("div",{className:"briefing-presented-meta",children:["model: ",s.model,s.responseId?` · response: ${s.responseId}`:""]})]})}function N({brief:s,navigate:i}){return s?e.jsxs("section",{className:"briefing-layer",children:[e.jsx(l,{eyebrow:"Layer 3",title:"Brief"}),s.steps.length>0?e.jsx("ol",{className:"briefing-steps",children:s.steps.map((r,n)=>e.jsxs("li",{className:"briefing-step",children:[e.jsxs("div",{className:"briefing-step-label",children:[n+1,". ",r.label]}),r.narration?e.jsx("p",{className:"briefing-step-narration",children:r.narration}):null]},r.id??n))}):null,s.actions.length>0?e.jsx("div",{className:"briefing-actions",children:s.actions.map((r,n)=>e.jsx("button",{type:"button",className:"s-btn",onClick:()=>{r.route&&i(r.route)},children:r.label},`${r.label}-${n}`))}):null]}):e.jsxs("section",{className:"briefing-layer",children:[e.jsx(l,{eyebrow:"Layer 3",title:"Brief & call"}),e.jsx("p",{className:"briefings-placeholder",children:"No brief body persisted."})]})}function k({observations:s,navigate:i}){return e.jsxs("section",{className:"briefing-layer",children:[e.jsx(l,{eyebrow:"Layer 2",title:`Observations (${s.length})`}),s.length===0?e.jsx("p",{className:"briefings-placeholder",children:"No observations on this brief."}):e.jsx("div",{className:"briefing-observations",children:s.map((r,n)=>{const t=r.tone==="warn"?"briefing-observation-warn":r.tone==="err"||r.tone==="error"?"briefing-observation-err":"";return e.jsxs("div",{className:`briefing-observation ${t}`.trim(),children:[e.jsx("div",{className:"briefing-observation-text",children:r.text}),r.references.length>0?e.jsx("div",{className:"briefing-observation-refs",children:r.references.map((a,c)=>e.jsx(w,{reference:a,navigate:i},`${a.label}-${c}`))}):null]},n)})})]})}function w({reference:s,navigate:i}){const r=!!s.route,n=s.detail?`${s.label} · ${s.detail}`:s.label;return r?e.jsx("button",{type:"button",className:"briefing-ref-chip",onClick:()=>i(s.route),children:n}):e.jsx("span",{className:"briefing-ref-chip briefing-ref-chip-static",children:n})}function v({snapshot:s,call:i}){const r=o.useMemo(()=>C(s),[s]),[n,t]=o.useState(!1);return e.jsxs("section",{className:"briefing-layer",children:[e.jsx(l,{eyebrow:"Layer 1",title:"Read snapshot"}),r.length>0?e.jsx("div",{className:"briefing-snapshot-counts",children:r.map(a=>e.jsxs("span",{className:"briefing-snapshot-count",children:[e.jsx("strong",{children:a.value})," ",a.label]},a.label))}):null,i?e.jsxs("details",{className:"briefing-snapshot-section",children:[e.jsx("summary",{className:"briefing-snapshot-section-head",children:"Call metadata"}),e.jsxs("dl",{className:"briefing-call-grid",children:[e.jsx("dt",{children:"Model"}),e.jsx("dd",{children:i.model}),e.jsx("dt",{children:"Response ID"}),e.jsx("dd",{children:i.responseId??"—"}),e.jsx("dt",{children:"System prompt"}),e.jsx("dd",{children:e.jsx("pre",{className:"briefing-call-prompt",children:i.systemPrompt})}),e.jsx("dt",{children:"Operator request"}),e.jsx("dd",{children:e.jsx("pre",{className:"briefing-call-prompt",children:i.operatorRequest})})]})]}):null,e.jsxs("div",{className:"briefing-snapshot-section",children:[e.jsx("button",{type:"button",className:"briefing-detail-back",onClick:()=>t(a=>!a),children:n?"Hide raw snapshot":"Show raw snapshot JSON"}),n?e.jsx("pre",{className:"briefing-snapshot-raw",children:JSON.stringify(s??{},null,2)}):null]})]})}function l({eyebrow:s,title:i}){return e.jsxs("div",{className:"briefing-layer-head",children:[e.jsx("span",{className:"briefing-layer-eyebrow",children:s}),e.jsx("span",{className:"briefing-layer-title",children:i})]})}function C(s){if(!s?.state)return[];const i=s.state,r=[],n=(t,a)=>{Array.isArray(a)&&r.push({label:t,value:a.length})};if(n("agents",i.agents),i.fleet&&typeof i.fleet=="object"){const t=i.fleet;n("active requests",t.activeAsks),n("attention",t.needsAttention),n("recent",t.recentCompleted)}if(i.broker&&typeof i.broker=="object"){const t=i.broker;n("broker msgs",t.recentMessages)}if(n("scout chatter",i.scoutChatter),n("tail events",i.agentLogMessages),i.operatorAttention&&typeof i.operatorAttention=="object"){const t=i.operatorAttention;n("operator items",t.items)}return r}export{fe as BriefingDetailScreen};
1
+ import{r as o,j as e}from"./index-NRbRrZw-.js";import{E as p}from"./EmptyState-uQbB-bvP.js";import{a as f}from"./api-DEHEgJ9m.js";import{S as b}from"./scoutbot-markdown-DIhLsYxz.js";import{b as h,t as u}from"./time-Dhsh_2EG.js";/* empty css *//* empty css */import"./Provider-Cd-QZltN.js";import"./provider-Bq0ScH3v.js";import"./router-Bx1tiwVe.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-D4dHTRkt.js";import"./sse-QSbhyq9A.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-D4vuKzOL.js";import"./DocumentFocusViewer-CetjnYut.js";import"./createLucideIcon-Da0lq809.js";import"./TextDocumentSurface-B29xZNlI.js";import"./file-text-BGVkHS4_.js";import"./x-DuzAbpk5.js";import"./chevron-right-CV7sEVBS.js";import"./code-xml-CPzpZkhu.js";import"./arrow-left-B0CdJdAC.js";import"./arrow-right-YRBoTTyf.js";import"./scout-voice-BT3gYDhU.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-feLCB3Zm.js";import"./NewChatComposer-BPsg8shF.js";import"./text-B2UZi3l9.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-Be0T8xv2.js";import"./conversation-model-CIzM7aXT.js";import"./index-CD2foMB8.js";import"./HarnessMark-CEzmPFHC.js";import"./NewChatOrigin-CCiPg_WR.js";import"./chevron-down-Jh540uf3.js";import"./search-HmdKXdtR.js";import"./chunk-HRAB3GC3-BYQZ1LOn.js";import"./external-link-BheHazeW.js";const g={"fleet-home":"fleet briefing",tour:"tour briefing"};function fe({briefingId:s,navigate:i}){const[r,n]=o.useState(null),[t,a]=o.useState(null),c=o.useCallback(async()=>{try{const d=await f(`/api/briefings/${encodeURIComponent(s)}`);n(d),a(null)}catch(d){a(d instanceof Error?d.message:"Failed to load briefing")}},[s]);return o.useEffect(()=>{c()},[c]),t?e.jsxs("div",{className:"sys-surface-page sys-surface-page-wide",children:[e.jsx("button",{type:"button",className:"briefing-detail-back",onClick:()=>i({view:"briefings"}),children:"← back to briefings"}),e.jsx(p,{title:"Couldn't load briefing",body:t})]}):r?e.jsxs("div",{className:"sys-surface-page sys-surface-page-wide briefing-detail",children:[e.jsx("button",{type:"button",className:"briefing-detail-back",onClick:()=>i({view:"briefings"}),children:"← back to briefings"}),e.jsxs("header",{className:"briefing-detail-header",children:[e.jsx("h2",{children:r.title}),e.jsxs("div",{className:"briefing-detail-header-meta",children:[e.jsx("span",{className:`briefing-kind briefing-kind-${r.kind}`,children:g[r.kind]}),e.jsx("span",{children:h(r.preparedAt)}),e.jsxs("span",{children:["· ",u(r.preparedAt)]})]}),e.jsx("p",{className:"briefing-detail-summary",children:r.summary}),r.recommendation?e.jsx("div",{className:"briefing-detail-recommendation",children:r.recommendation}):null]}),r.markdown?e.jsx(x,{markdown:r.markdown}):null,r.brief?.presented?e.jsx(y,{presented:r.brief.presented}):null,e.jsx(j,{call:r.call}),e.jsx(N,{brief:r.brief,navigate:i}),e.jsx(k,{observations:r.observations,navigate:i}),e.jsx(v,{snapshot:r.snapshot,call:r.call})]}):e.jsx("div",{className:"sys-surface-page sys-surface-page-wide",children:e.jsx("div",{className:"briefings-placeholder",children:"Loading briefing..."})})}function x({markdown:s}){return e.jsxs("section",{className:"briefing-layer briefing-layer-markdown",children:[e.jsx(l,{eyebrow:"Layer 0",title:"Brief (markdown)"}),e.jsx("div",{className:"briefing-markdown",children:e.jsx(b,{text:s})})]})}function j({call:s}){return!s||!s.telemetry&&!s.presenter?null:e.jsxs("section",{className:"briefing-layer briefing-layer-telemetry",children:[e.jsx(l,{eyebrow:"Telemetry",title:"Calls & usage"}),e.jsxs("dl",{className:"briefing-telemetry",children:[e.jsx(m,{label:"Analyst",model:s.model,responseId:s.responseId,telemetry:s.telemetry??null}),s.presenter?e.jsx(m,{label:"Presenter",model:s.presenter.model,responseId:s.presenter.responseId,telemetry:s.presenter,note:s.presenter.skipped==="rate-guard"?"skipped — rate-guard hit":s.presenter.skipped==="error"?`failed — ${s.presenter.errorMessage??"unknown"}`:null}):null]})]})}function m({label:s,model:i,responseId:r,telemetry:n,note:t}){const a=n?.usage??null;return e.jsxs("div",{className:"briefing-telemetry-row",children:[e.jsxs("div",{className:"briefing-telemetry-row-head",children:[e.jsx("span",{className:"briefing-telemetry-label",children:s}),e.jsx("span",{className:"briefing-telemetry-model",children:i}),t?e.jsx("span",{className:"briefing-telemetry-note",children:t}):null]}),e.jsxs("div",{className:"briefing-telemetry-stats",children:[e.jsx("span",{children:n&&n.elapsedMs>0?`${(n.elapsedMs/1e3).toFixed(2)}s`:"—"}),e.jsxs("span",{children:["in ",a?.inputTokens??"—"]}),e.jsxs("span",{children:["out ",a?.outputTokens??"—"]}),e.jsxs("span",{children:["total ",a?.totalTokens??"—"]}),r?e.jsx("span",{className:"briefing-telemetry-response",children:r}):null]})]})}function y({presented:s}){return e.jsxs("section",{className:"briefing-layer briefing-layer-presented",children:[e.jsx(l,{eyebrow:"Spoken",title:`Presented as · ${s.voiceSpec.persona}, ~${s.voiceSpec.targetWords} words`}),e.jsx("ol",{className:"briefing-presented-sentences",children:s.sentences.map((i,r)=>e.jsx("li",{className:"briefing-presented-sentence",children:i},r))}),e.jsxs("div",{className:"briefing-presented-meta",children:["model: ",s.model,s.responseId?` · response: ${s.responseId}`:""]})]})}function N({brief:s,navigate:i}){return s?e.jsxs("section",{className:"briefing-layer",children:[e.jsx(l,{eyebrow:"Layer 3",title:"Brief"}),s.steps.length>0?e.jsx("ol",{className:"briefing-steps",children:s.steps.map((r,n)=>e.jsxs("li",{className:"briefing-step",children:[e.jsxs("div",{className:"briefing-step-label",children:[n+1,". ",r.label]}),r.narration?e.jsx("p",{className:"briefing-step-narration",children:r.narration}):null]},r.id??n))}):null,s.actions.length>0?e.jsx("div",{className:"briefing-actions",children:s.actions.map((r,n)=>e.jsx("button",{type:"button",className:"s-btn",onClick:()=>{r.route&&i(r.route)},children:r.label},`${r.label}-${n}`))}):null]}):e.jsxs("section",{className:"briefing-layer",children:[e.jsx(l,{eyebrow:"Layer 3",title:"Brief & call"}),e.jsx("p",{className:"briefings-placeholder",children:"No brief body persisted."})]})}function k({observations:s,navigate:i}){return e.jsxs("section",{className:"briefing-layer",children:[e.jsx(l,{eyebrow:"Layer 2",title:`Observations (${s.length})`}),s.length===0?e.jsx("p",{className:"briefings-placeholder",children:"No observations on this brief."}):e.jsx("div",{className:"briefing-observations",children:s.map((r,n)=>{const t=r.tone==="warn"?"briefing-observation-warn":r.tone==="err"||r.tone==="error"?"briefing-observation-err":"";return e.jsxs("div",{className:`briefing-observation ${t}`.trim(),children:[e.jsx("div",{className:"briefing-observation-text",children:r.text}),r.references.length>0?e.jsx("div",{className:"briefing-observation-refs",children:r.references.map((a,c)=>e.jsx(w,{reference:a,navigate:i},`${a.label}-${c}`))}):null]},n)})})]})}function w({reference:s,navigate:i}){const r=!!s.route,n=s.detail?`${s.label} · ${s.detail}`:s.label;return r?e.jsx("button",{type:"button",className:"briefing-ref-chip",onClick:()=>i(s.route),children:n}):e.jsx("span",{className:"briefing-ref-chip briefing-ref-chip-static",children:n})}function v({snapshot:s,call:i}){const r=o.useMemo(()=>C(s),[s]),[n,t]=o.useState(!1);return e.jsxs("section",{className:"briefing-layer",children:[e.jsx(l,{eyebrow:"Layer 1",title:"Read snapshot"}),r.length>0?e.jsx("div",{className:"briefing-snapshot-counts",children:r.map(a=>e.jsxs("span",{className:"briefing-snapshot-count",children:[e.jsx("strong",{children:a.value})," ",a.label]},a.label))}):null,i?e.jsxs("details",{className:"briefing-snapshot-section",children:[e.jsx("summary",{className:"briefing-snapshot-section-head",children:"Call metadata"}),e.jsxs("dl",{className:"briefing-call-grid",children:[e.jsx("dt",{children:"Model"}),e.jsx("dd",{children:i.model}),e.jsx("dt",{children:"Response ID"}),e.jsx("dd",{children:i.responseId??"—"}),e.jsx("dt",{children:"System prompt"}),e.jsx("dd",{children:e.jsx("pre",{className:"briefing-call-prompt",children:i.systemPrompt})}),e.jsx("dt",{children:"Operator request"}),e.jsx("dd",{children:e.jsx("pre",{className:"briefing-call-prompt",children:i.operatorRequest})})]})]}):null,e.jsxs("div",{className:"briefing-snapshot-section",children:[e.jsx("button",{type:"button",className:"briefing-detail-back",onClick:()=>t(a=>!a),children:n?"Hide raw snapshot":"Show raw snapshot JSON"}),n?e.jsx("pre",{className:"briefing-snapshot-raw",children:JSON.stringify(s??{},null,2)}):null]})]})}function l({eyebrow:s,title:i}){return e.jsxs("div",{className:"briefing-layer-head",children:[e.jsx("span",{className:"briefing-layer-eyebrow",children:s}),e.jsx("span",{className:"briefing-layer-title",children:i})]})}function C(s){if(!s?.state)return[];const i=s.state,r=[],n=(t,a)=>{Array.isArray(a)&&r.push({label:t,value:a.length})};if(n("agents",i.agents),i.fleet&&typeof i.fleet=="object"){const t=i.fleet;n("active requests",t.activeAsks),n("attention",t.needsAttention),n("recent",t.recentCompleted)}if(i.broker&&typeof i.broker=="object"){const t=i.broker;n("broker msgs",t.recentMessages)}if(n("scout chatter",i.scoutChatter),n("tail events",i.agentLogMessages),i.operatorAttention&&typeof i.operatorAttention=="object"){const t=i.operatorAttention;n("operator items",t.items)}return r}export{fe as BriefingDetailScreen};
@@ -1 +1 @@
1
- import{r as i,j as e}from"./index-Bli6bTLU.js";import{E as c}from"./EmptyState-BnDda92b.js";import{a as h}from"./api-DEHEgJ9m.js";import{t as m}from"./time-Dhsh_2EG.js";/* empty css *//* empty css */const g={"fleet-home":"fleet",tour:"tour"};function N({navigate:d}){const[r,f]=i.useState(null),[n,t]=i.useState(null),[l,o]=i.useState(!1),a=i.useCallback(async()=>{o(!0);try{const s=await h("/api/briefings?limit=50");f(s.briefings),t(null)}catch(s){t(s instanceof Error?s.message:"Failed to load briefings")}finally{o(!1)}},[]);return i.useEffect(()=>{a()},[a]),e.jsxs("div",{className:"sys-surface-page sys-surface-page-wide",children:[e.jsxs("div",{className:"sys-page-head",children:[e.jsxs("div",{className:"sys-page-title-group",children:[e.jsx("h2",{className:"sys-page-title",children:"Briefings"}),e.jsx("p",{className:"sys-page-subtitle",children:"Scoutbot's archived fleet briefs — what it told you, when, and what it saw. Rolling 100."})]}),e.jsx("div",{className:"sys-page-actions",children:e.jsx("button",{type:"button",className:"s-btn",disabled:l,onClick:()=>{a()},children:l?"Refreshing...":"Refresh"})})]}),n?e.jsx(c,{title:"Couldn't load briefings",body:n}):r===null?e.jsx("div",{className:"briefings-placeholder",children:"Loading briefings..."}):r.length===0?e.jsx(c,{title:"No briefings yet",body:"Scoutbot writes here when it generates a fleet brief — either on Home or via tour. Briefs land in this archive automatically."}):e.jsx("ul",{className:"briefings-list",children:r.map(s=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:"briefing-row",onClick:()=>d({view:"briefings",briefingId:s.id}),children:[e.jsxs("div",{className:"briefing-row-head",children:[e.jsx("span",{className:`briefing-kind briefing-kind-${s.kind}`,children:g[s.kind]}),e.jsx("span",{className:"briefing-row-title",children:s.title}),e.jsx("span",{className:"briefing-row-time",children:m(s.preparedAt)})]}),e.jsx("div",{className:"briefing-row-summary",children:s.summary}),e.jsxs("div",{className:"briefing-row-meta",children:[e.jsxs("span",{children:[s.observationCount," observations"]}),s.recommendation?e.jsxs("span",{children:["· ",s.recommendation]}):null]})]})},s.id))})]})}export{N as BriefingsScreen};
1
+ import{r as i,j as e}from"./index-NRbRrZw-.js";import{E as c}from"./EmptyState-uQbB-bvP.js";import{a as h}from"./api-DEHEgJ9m.js";import{t as m}from"./time-Dhsh_2EG.js";/* empty css *//* empty css */const g={"fleet-home":"fleet",tour:"tour"};function N({navigate:d}){const[r,f]=i.useState(null),[n,t]=i.useState(null),[l,o]=i.useState(!1),a=i.useCallback(async()=>{o(!0);try{const s=await h("/api/briefings?limit=50");f(s.briefings),t(null)}catch(s){t(s instanceof Error?s.message:"Failed to load briefings")}finally{o(!1)}},[]);return i.useEffect(()=>{a()},[a]),e.jsxs("div",{className:"sys-surface-page sys-surface-page-wide",children:[e.jsxs("div",{className:"sys-page-head",children:[e.jsxs("div",{className:"sys-page-title-group",children:[e.jsx("h2",{className:"sys-page-title",children:"Briefings"}),e.jsx("p",{className:"sys-page-subtitle",children:"Scoutbot's archived fleet briefs — what it told you, when, and what it saw. Rolling 100."})]}),e.jsx("div",{className:"sys-page-actions",children:e.jsx("button",{type:"button",className:"s-btn",disabled:l,onClick:()=>{a()},children:l?"Refreshing...":"Refresh"})})]}),n?e.jsx(c,{title:"Couldn't load briefings",body:n}):r===null?e.jsx("div",{className:"briefings-placeholder",children:"Loading briefings..."}):r.length===0?e.jsx(c,{title:"No briefings yet",body:"Scoutbot writes here when it generates a fleet brief — either on Home or via tour. Briefs land in this archive automatically."}):e.jsx("ul",{className:"briefings-list",children:r.map(s=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:"briefing-row",onClick:()=>d({view:"briefings",briefingId:s.id}),children:[e.jsxs("div",{className:"briefing-row-head",children:[e.jsx("span",{className:`briefing-kind briefing-kind-${s.kind}`,children:g[s.kind]}),e.jsx("span",{className:"briefing-row-title",children:s.title}),e.jsx("span",{className:"briefing-row-time",children:m(s.preparedAt)})]}),e.jsx("div",{className:"briefing-row-summary",children:s.summary}),e.jsxs("div",{className:"briefing-row-meta",children:[e.jsxs("span",{children:[s.observationCount," observations"]}),s.recommendation?e.jsxs("span",{children:["· ",s.recommendation]}):null]})]})},s.id))})]})}export{N as BriefingsScreen};
@@ -1 +1 @@
1
- import{r as m,j as s}from"./index-Bli6bTLU.js";import{a as y,c as p,d as b,f as x}from"./broker-display-Q75fupqG.js";import{C as u}from"./chevron-down-Da5tV19_.js";import{C as j}from"./chevron-right-BMqtBds_.js";import"./status-tone-BM_zuRy1.js";import"./createLucideIcon-DLlxGjKt.js";function i({label:e,value:a}){return s.jsxs("div",{className:"sys-broker-metadata-row",children:[s.jsx("span",{className:"sys-broker-metadata-key",children:e}),s.jsx("code",{className:"sys-broker-metadata-value",children:a})]})}function h({label:e,value:a,depth:t=0,defaultOpen:d=!0}){const[n,l]=m.useState(d&&t<2);if(a==null)return s.jsx(i,{label:e,value:"—"});if(Array.isArray(a))return a.length===0?s.jsx(i,{label:e,value:"[]"}):a.every(r=>typeof r!="object"||r===null)?s.jsx(i,{label:e,value:a.map(r=>x(r)).join(", ")}):s.jsxs("div",{className:"sys-broker-metadata-group",style:{marginLeft:t*12},children:[s.jsxs("button",{type:"button",className:"sys-broker-metadata-group-toggle",onClick:()=>l(r=>!r),"aria-expanded":n,children:[n?s.jsx(u,{size:12,"aria-hidden":"true"}):s.jsx(j,{size:12,"aria-hidden":"true"}),s.jsx("span",{className:"sys-broker-metadata-group-label",children:e}),s.jsxs("span",{className:"sys-broker-metadata-count",children:[a.length," items"]})]}),n&&s.jsx("div",{className:"sys-broker-metadata-children",children:a.map((r,c)=>s.jsx(h,{label:`[${c}]`,value:r,depth:t+1,defaultOpen:t<1},`${e}-${c}`))})]});if(typeof a=="object"){const o=Object.entries(a);return o.length===0?s.jsx(i,{label:e,value:"{}"}):s.jsxs("div",{className:"sys-broker-metadata-group",style:{marginLeft:t*12},children:[s.jsxs("button",{type:"button",className:"sys-broker-metadata-group-toggle",onClick:()=>l(r=>!r),"aria-expanded":n,children:[n?s.jsx(u,{size:12,"aria-hidden":"true"}):s.jsx(j,{size:12,"aria-hidden":"true"}),s.jsx("span",{className:"sys-broker-metadata-group-label",children:e}),s.jsxs("span",{className:"sys-broker-metadata-count",children:[o.length," fields"]})]}),n&&s.jsx("div",{className:"sys-broker-metadata-children",children:o.map(([r,c])=>s.jsx(h,{label:r,value:c,depth:t+1,defaultOpen:t<1},`${e}-${r}`))})]})}return s.jsx(i,{label:e,value:x(a)})}function k({entries:e}){return e.length===0?null:s.jsx("div",{className:"sys-broker-inspector-rows",children:e.map(a=>s.jsxs("div",{className:"sys-broker-inspector-row",children:[s.jsx("span",{className:"sys-detail-label",children:a.key}),s.jsx("code",{className:"sys-detail-value",children:a.value})]},a.key))})}function S({metadata:e,rawJson:a}){const t=m.useMemo(()=>y(e),[e]),d=m.useMemo(()=>p(e),[e]),[n,l]=m.useState(!1);return!e||Object.keys(e).length===0?s.jsx("div",{className:"sys-broker-metadata-empty",children:"No metadata payload attached to this dispatch row."}):s.jsxs("div",{className:"sys-broker-metadata-panel",children:[t.length>0&&s.jsxs("section",{className:"sys-broker-metadata-section",children:[s.jsx("div",{className:"sys-broker-metadata-section-head",children:s.jsx("span",{className:"sys-detail-label",children:"Summary"})}),s.jsx(k,{entries:t})]}),d!==null&&s.jsxs("section",{className:"sys-broker-metadata-section",children:[s.jsx("div",{className:"sys-broker-metadata-section-head",children:s.jsx("span",{className:"sys-detail-label",children:"Payload"})}),s.jsx("div",{className:"sys-broker-metadata-tree",children:s.jsx(h,{label:"payload",value:d,defaultOpen:!0})})]}),s.jsxs("section",{className:"sys-broker-metadata-section",children:[s.jsxs("button",{type:"button",className:"sys-broker-metadata-raw-toggle",onClick:()=>l(o=>!o),"aria-expanded":n,children:[n?s.jsx(u,{size:12,"aria-hidden":"true"}):s.jsx(j,{size:12,"aria-hidden":"true"}),"Raw JSON"]}),n&&s.jsx("pre",{className:"sys-broker-metadata-raw",children:a||b(e)})]})]})}export{S as BrokerMetadataPanel};
1
+ import{r as m,j as s}from"./index-NRbRrZw-.js";import{a as y,c as p,d as b,f as x}from"./broker-display-Q75fupqG.js";import{C as u}from"./chevron-down-Jh540uf3.js";import{C as j}from"./chevron-right-CV7sEVBS.js";import"./status-tone-BM_zuRy1.js";import"./createLucideIcon-Da0lq809.js";function i({label:e,value:a}){return s.jsxs("div",{className:"sys-broker-metadata-row",children:[s.jsx("span",{className:"sys-broker-metadata-key",children:e}),s.jsx("code",{className:"sys-broker-metadata-value",children:a})]})}function h({label:e,value:a,depth:t=0,defaultOpen:d=!0}){const[n,l]=m.useState(d&&t<2);if(a==null)return s.jsx(i,{label:e,value:"—"});if(Array.isArray(a))return a.length===0?s.jsx(i,{label:e,value:"[]"}):a.every(r=>typeof r!="object"||r===null)?s.jsx(i,{label:e,value:a.map(r=>x(r)).join(", ")}):s.jsxs("div",{className:"sys-broker-metadata-group",style:{marginLeft:t*12},children:[s.jsxs("button",{type:"button",className:"sys-broker-metadata-group-toggle",onClick:()=>l(r=>!r),"aria-expanded":n,children:[n?s.jsx(u,{size:12,"aria-hidden":"true"}):s.jsx(j,{size:12,"aria-hidden":"true"}),s.jsx("span",{className:"sys-broker-metadata-group-label",children:e}),s.jsxs("span",{className:"sys-broker-metadata-count",children:[a.length," items"]})]}),n&&s.jsx("div",{className:"sys-broker-metadata-children",children:a.map((r,c)=>s.jsx(h,{label:`[${c}]`,value:r,depth:t+1,defaultOpen:t<1},`${e}-${c}`))})]});if(typeof a=="object"){const o=Object.entries(a);return o.length===0?s.jsx(i,{label:e,value:"{}"}):s.jsxs("div",{className:"sys-broker-metadata-group",style:{marginLeft:t*12},children:[s.jsxs("button",{type:"button",className:"sys-broker-metadata-group-toggle",onClick:()=>l(r=>!r),"aria-expanded":n,children:[n?s.jsx(u,{size:12,"aria-hidden":"true"}):s.jsx(j,{size:12,"aria-hidden":"true"}),s.jsx("span",{className:"sys-broker-metadata-group-label",children:e}),s.jsxs("span",{className:"sys-broker-metadata-count",children:[o.length," fields"]})]}),n&&s.jsx("div",{className:"sys-broker-metadata-children",children:o.map(([r,c])=>s.jsx(h,{label:r,value:c,depth:t+1,defaultOpen:t<1},`${e}-${r}`))})]})}return s.jsx(i,{label:e,value:x(a)})}function k({entries:e}){return e.length===0?null:s.jsx("div",{className:"sys-broker-inspector-rows",children:e.map(a=>s.jsxs("div",{className:"sys-broker-inspector-row",children:[s.jsx("span",{className:"sys-detail-label",children:a.key}),s.jsx("code",{className:"sys-detail-value",children:a.value})]},a.key))})}function S({metadata:e,rawJson:a}){const t=m.useMemo(()=>y(e),[e]),d=m.useMemo(()=>p(e),[e]),[n,l]=m.useState(!1);return!e||Object.keys(e).length===0?s.jsx("div",{className:"sys-broker-metadata-empty",children:"No metadata payload attached to this dispatch row."}):s.jsxs("div",{className:"sys-broker-metadata-panel",children:[t.length>0&&s.jsxs("section",{className:"sys-broker-metadata-section",children:[s.jsx("div",{className:"sys-broker-metadata-section-head",children:s.jsx("span",{className:"sys-detail-label",children:"Summary"})}),s.jsx(k,{entries:t})]}),d!==null&&s.jsxs("section",{className:"sys-broker-metadata-section",children:[s.jsx("div",{className:"sys-broker-metadata-section-head",children:s.jsx("span",{className:"sys-detail-label",children:"Payload"})}),s.jsx("div",{className:"sys-broker-metadata-tree",children:s.jsx(h,{label:"payload",value:d,defaultOpen:!0})})]}),s.jsxs("section",{className:"sys-broker-metadata-section",children:[s.jsxs("button",{type:"button",className:"sys-broker-metadata-raw-toggle",onClick:()=>l(o=>!o),"aria-expanded":n,children:[n?s.jsx(u,{size:12,"aria-hidden":"true"}):s.jsx(j,{size:12,"aria-hidden":"true"}),"Raw JSON"]}),n&&s.jsx("pre",{className:"sys-broker-metadata-raw",children:a||b(e)})]})]})}export{S as BrokerMetadataPanel};
@@ -1,4 +1,4 @@
1
- import{r as a,j as e}from"./index-Bli6bTLU.js";import{r as us}from"./index-DFdlQs_c.js";import{D as hs}from"./text-BR9Bap0E.js";import{E as Ce}from"./EmptyState-BnDda92b.js";import{y as fs,C as ms,z as ps,R as bs,A as ys,B as gs}from"./NewChatComposer-Bgqes0UQ.js";import{a as ne}from"./api-DEHEgJ9m.js";import{c as xs}from"./clipboard-e3fSpeo7.js";import{u as js}from"./sse-CSozY6mp.js";import{b as Ee}from"./status-tone-BM_zuRy1.js";import{t as Ie,b as Ye,n as V}from"./time-Dhsh_2EG.js";import{u as Ge}from"./Provider-Ve8yXaWR.js";import{o as Oe}from"./openContent-C6XO6kr5.js";import{g as ks,b as oe,h as Xe,d as vs,i as ws,j as Ns,k as Ss,l as Rs}from"./broker-display-Q75fupqG.js";import{BrokerMetadataPanel as As}from"./BrokerMetadataPanel-DFAH-NO6.js";import{DispatchAftermath as Cs}from"./DispatchAftermath-CH02HAVw.js";import{i as Is,c as $s,n as _e}from"./keyboard-nav-7iEtvu9P.js";import{ShikiPane as Ds}from"./ShikiPane-DyEJdcvb.js";import{d as Es}from"./types-B0PlfpKc.js";/* empty css */import{L as ke}from"./loader-circle-DoT8gpw6.js";import{R as Fs}from"./refresh-cw-IgN2fZLM.js";import{X as $e}from"./x-BJyPzFnn.js";import{c as Ne}from"./createLucideIcon-DLlxGjKt.js";import{E as Ke}from"./external-link-BGHC_naA.js";import{C as Ms}from"./chevron-down-Da5tV19_.js";import{S as Ls}from"./sparkles-ytTwpCbZ.js";import{P as Ts}from"./plus-64n9qucr.js";import{S as Ps}from"./send-horizontal-BXo2uz3Z.js";import{A as Ue}from"./arrow-right-B0Yi01Zr.js";import{C as Bs}from"./check-Bfs7hMb1.js";import{C as zs}from"./copy-De4s38o2.js";import{M as qs}from"./message-square-DlY4EneU.js";import{R as Os}from"./radio-BjpQTKT0.js";import{M as _s,b as Ks}from"./DocumentFocusViewer-DmtFisY9.js";import{B as Us}from"./bot-r2IuAuJd.js";const Hs=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Js=Ne("arrow-down",Hs);const Qs=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],Ws=Ne("at-sign",Qs);const Vs=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Ys=Ne("hash",Vs);const Gs=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Xs=Ne("paperclip",Gs),Zs=160;function He(s){const t=new URLSearchParams({limit:String(Zs)});return s&&t.set("cursor",s),`/api/broker?${t.toString()}`}const Je={index:-1,request:0};function er(s,t){return{index:t,request:s.request+1}}function Ze(s,t){return t===s.index?s:{index:t,request:s.request}}function sr(s,t){return s.index<t?s:Ze(s,t>0?t-1:-1)}function rr(s,t){return s.request!==t}function tr({enabled:s,rowCount:t,onActivateRow:n,onClearSelection:o}){const[d,u]=a.useState(Je),b=d.index,f=a.useRef(new Map),c=a.useRef(Je.request),v=a.useCallback(y=>{u(m=>er(m,typeof y=="function"?y(m.index):y))},[]),j=a.useCallback(y=>{u(m=>Ze(m,typeof y=="function"?y(m.index):y))},[]);a.useEffect(()=>{if(!rr(d,c.current)||(c.current=d.request,d.index<0))return;const y=f.current.get(d.index);y?.scrollIntoView({block:"nearest"}),y?.focus()},[d]),a.useEffect(()=>{u(y=>sr(y,t))},[t]);const I=a.useCallback((y,m)=>{m?f.current.set(y,m):f.current.delete(y)},[]);a.useEffect(()=>{if(!s)return;const y=m=>{if(document.querySelector(".sys-broker-page")&&!(Is(m.target)||$s())&&t!==0){if(m.key==="Escape"){o&&(m.preventDefault(),o(),j(-1));return}if(m.key==="ArrowDown"||m.key==="j"){m.preventDefault(),v(N=>_e(N,t,1));return}if(m.key==="ArrowUp"||m.key==="k"){m.preventDefault(),v(N=>_e(N,t,-1));return}if(m.key==="Home"||m.key==="g"&&!m.shiftKey){m.preventDefault(),v(0);return}if(m.key==="End"||m.key==="G"){m.preventDefault(),v(t-1);return}if(m.key==="Enter"||m.key===" "){const N=b<0?0:b;m.preventDefault(),v(N),n(N)}}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[s,b,v,n,o,t,j]);const U=a.useCallback(y=>({tabIndex:b===y?0:-1,ref:m=>I(y,m),onFocus:()=>j(y)}),[b,I,j]);return{focusedIndex:b,setFocusedIndex:j,getRowFocusProps:U}}const be=["all","delivered","failed"],ar={all:"All",delivered:"Delivered",failed:"Failed"};function nr(s){switch(s){case"success":return"Success";case"failed_query":return"Query failure";case"failed_delivery":return"Delivery failure";default:return"Delivery attempt"}}function es(s){return s.messageId??s.deliveryId??s.invocationId??s.id}function ss(s){switch(Ee(s.kind,s.status)){case"success":return"Delivered";case"danger":return"Failed";case"working":return"Pending";case"warning":return"Held";default:return s.status?s.status.charAt(0).toUpperCase()+s.status.slice(1):"Queued"}}function ve(s){if(!s)return"··";const t=s.trim().split(/\s+/).filter(Boolean);if(t.length===0)return"··";const n=t[t.length-1];return/^\d+$/.test(n)?n.slice(-2):t.length>=2?(t[0][0]+t[1][0]).toUpperCase():s.trim().slice(0,2).toUpperCase()}function or(s){const t=V(s)??0;return new Date(t).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Qe(s){const t=V(s);return t===null?"—":new Date(t).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Se(s,t,n=0){if(!s||typeof s!="object"||Array.isArray(s)||n>3)return;const o=s;for(const d of t)if(o[d]!==void 0&&o[d]!==null)return o[d];for(const d of Object.values(o)){const u=Se(d,t,n+1);if(u!==void 0)return u}}function K(s,...t){const n=Se(s.metadata,t);return typeof n!="string"&&typeof n!="number"?null:String(n).trim()||null}function we(s,...t){const n=Se(s.metadata,t);return typeof n=="number"||typeof n=="string"?V(n):null}function rs(s){switch(s){case"dm":return"Direct · agent";case"channel":return"Channel";case"broadcast":return"Broadcast";case null:return"No route";default:return s.replaceAll("_"," ")}}function De(s,t){if(t==="to")return s.route==="channel"?"Channel":s.route==="broadcast"?"Broadcast":s.target?.toLowerCase().includes("operator")?"Operator":"Agent lane";const n=K(s,"class","actorClass")?.toLowerCase();return n==="operator"||n==="human"?"Operator":n==="agent"?"Agent":s.actorName?.toLowerCase().includes("operator")?"Operator":"Sender"}function ir(s){const t=Se(s.metadata,["latencyMs","durationMs"]);if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t<1e3?`${Math.round(t)}ms`:`${(t/1e3).toFixed(t<1e4?1:0)}s`;const n=we(s,"sentAt","createdAt")??V(s.ts),o=we(s,"deliveredAt","completedAt");if(n===null||o===null||o<n)return"—";const d=o-n;return d<1e3?`${d}ms`:`${(d/1e3).toFixed(d<1e4?1:0)}s`}function Fe({route:s}){switch(s){case"channel":return e.jsx(Ys,{size:12,"aria-hidden":"true"});case"broadcast":return e.jsx(Os,{size:12,"aria-hidden":"true"});case"dm":return e.jsx(Ws,{size:12,"aria-hidden":"true"});default:return e.jsx(qs,{size:12,"aria-hidden":"true"})}}function lr(s,t){if(!t)return null;const n=t.trim().replace(/^@/,"").toLowerCase();return s.find(o=>[o.id,o.name,o.handle,o.selector,o.defaultSelector,o.conversationId,o.harnessSessionId].some(d=>d?.trim().replace(/^@/,"").toLowerCase()===n))??null}function We(s,t,n){const o=n==="from"?s.actorName:s.target,d=lr(t,o),u=d?.name??o??(n==="from"?"Unknown":"No target"),b=d?"Agent":n==="to"&&s.conversationId?"Session route":De(s,n);return{label:u,kind:b,agent:d}}function cr(s,t,n){const o=n.agent??t.agent;return[{label:"From",value:t.kind},{label:"To",value:n.kind},{label:"Target",value:s.target??n.label},{label:"Channel",value:rs(s.route)},{label:"Project",value:o?.project??K(s,"project","projectName")},{label:"Branch",value:o?.branch??K(s,"branch")},{label:"Runtime",value:o?[o.harness,o.model,o.reasoningEffort].filter(Boolean).join(" · ")||null:[K(s,"harness"),K(s,"model")].filter(Boolean).join(" · ")||null},{label:"Machine",value:o?.authorityNodeName??o?.homeNodeName??o?.authorityNodeId??o?.homeNodeId??K(s,"machine","machineName","nodeName")}].filter(d=>!!d.value)}function Ve({party:s,route:t,side:n}){return e.jsxs("span",{className:`sys-broker-route-end sys-broker-route-end--${n}`,children:[e.jsx("span",{className:"sys-broker-avatar sys-broker-endpoint-avatar","aria-hidden":"true",children:s.agent||n==="from"?ve(s.label):e.jsx(Fe,{route:t})}),e.jsx("span",{className:"sys-broker-endpoint-name",title:s.label,children:s.label})]})}function dr({attempt:s,agents:t}){const n=We(s,t,"from"),o=We(s,t,"to"),d=cr(s,n,o),u=`dispatch-route-${s.id}`;return e.jsxs("span",{className:"sys-broker-route",tabIndex:0,"aria-describedby":u,children:[e.jsx(Ve,{party:n,route:s.route,side:"from"}),e.jsx(Ue,{className:"sys-broker-route-arrow",size:11,"aria-hidden":"true"}),e.jsx(Ve,{party:o,route:s.route,side:"to"}),e.jsxs("span",{className:"sys-broker-endpoint-card",id:u,role:"tooltip",children:[e.jsx("span",{className:"sys-broker-endpoint-card-head",children:e.jsxs("span",{className:"sys-broker-endpoint-card-edge",children:[e.jsx("span",{className:"sys-broker-avatar sys-broker-endpoint-avatar","aria-hidden":"true",children:ve(n.label)}),e.jsx("strong",{children:n.label}),e.jsx(Ue,{className:"sys-broker-route-arrow",size:11,"aria-hidden":"true"}),e.jsx("span",{className:"sys-broker-avatar sys-broker-endpoint-avatar","aria-hidden":"true",children:o.agent?ve(o.label):e.jsx(Fe,{route:s.route})}),e.jsx("strong",{children:o.label})]})}),e.jsx("span",{className:"sys-broker-endpoint-card-body",children:d.map(b=>e.jsxs("span",{className:"sys-broker-endpoint-card-field",children:[e.jsx("small",{children:b.label}),e.jsx("code",{title:b.value,children:b.value})]},b.label))})]})]})}function ye(s){const t=V(s)??0,n=new Date(t);return`${n.getFullYear()}-${n.getMonth()}-${n.getDate()}`}function ur(s,t=Date.now()){const n=V(s)??0,o=new Date(n),d=new Date(t),u=new Date(t);return u.setDate(u.getDate()-1),ye(s)===ye(d.getTime())?"Today":ye(s)===ye(u.getTime())?"Yesterday":o.toLocaleDateString(void 0,{month:"short",day:"numeric",year:o.getFullYear()===d.getFullYear()?void 0:"numeric"})}function hr(s,t,n){return{...t,source:s.source,attempts:[...s.attempts,...t.attempts],failedQueries:s.failedQueries,failedDeliveries:s.failedDeliveries,dialogue:s.dialogue,ledger:{...t.ledger,cursors:{...s.ledger.cursors,[n]:t.ledger.cursors[n]},hasMore:{...s.ledger.hasMore,[n]:t.ledger.hasMore[n]}}}}function fr({navigate:s,embedded:t=!1,initialAttemptId:n}){const{route:o,agents:d,selectedBrokerAttempt:u,inspectBrokerAttempt:b,clearBrokerAttempt:f}=Ge(),[c,v]=a.useState(null),j=o.view==="broker"?o.filter??"all":"all",[I,U]=a.useState(!0),[y,m]=a.useState(!1),[N,Y]=a.useState(!1),[ae,B]=a.useState(null),E=a.useRef(null),F=a.useRef(0),z=a.useRef(null),M=a.useCallback(async(i="initial")=>{const h=++F.current;!E.current&&i!=="background"?(U(!0),B(null)):m(!0);try{const x=await ne(He());if(h!==F.current)return;E.current=x,v(x),B(null)}catch(x){if(h!==F.current)return;B(x instanceof Error?x.message:String(x))}finally{h===F.current&&(U(!1),m(!1))}},[]),G=a.useCallback(async()=>{const i=E.current;if(!i||N)return;const h="attempts",x=i.ledger.cursors[h];if(!x||!i.ledger.hasMore[h])return;const T=++F.current;Y(!0),B(null);try{const P=await ne(He(x));if(T!==F.current)return;const se=E.current,ue=se?hr(se,P,h):P;E.current=ue,v(ue)}catch(P){if(T!==F.current)return;B(P instanceof Error?P.message:String(P))}finally{T===F.current&&Y(!1)}},[N]),le=a.useCallback(()=>{z.current||(z.current=setTimeout(()=>{z.current=null,M("background")},250))},[M]);a.useEffect(()=>(M("initial"),()=>{z.current&&clearTimeout(z.current)}),[M]),js(i=>{(i.kind==="message.posted"||i.kind==="delivery.planned"||i.kind==="delivery.attempted"||i.kind==="delivery.state.changed"||i.kind==="scout.dispatched")&&le()});const k=a.useMemo(()=>{if(!c)return[];const i=new Map(c.dialogue.map(h=>[h.id,h.body]));return ks(c.attempts).map(h=>{const x=h.messageId?i.get(h.messageId):null;return x&&x!==h.detail?{...h,detail:x}:h})},[c]),A=a.useMemo(()=>{switch(j){case"delivered":return k.filter(i=>!oe(i));case"failed":return k.filter(oe);default:return k}},[j,k]),ge=c?.ledger.hasMore.attempts??!1,X=a.useMemo(()=>({all:k.length,delivered:k.filter(i=>!oe(i)).length,failed:k.filter(oe).length}),[k]),$=a.useMemo(()=>{const i=o.view==="broker"?o.attemptId:void 0;return!c||!i?null:k.find(h=>h.id===i)??c.attempts.find(h=>h.id===i)??c.failedQueries.find(h=>h.id===i)??c.failedDeliveries.find(h=>h.id===i)??null},[c,k,o]),Z=$?`${$.id}\0${$.status}\0${$.ts}`:null,D=u?`${u.id}\0${u.status}\0${u.ts}`:null;a.useEffect(()=>{$&&Z!==D&&b($)},[D,b,$,Z]);const[C,S]=a.useState(null),q=a.useRef(!1),O=a.useCallback(i=>{if(t){q.current=!0,S(i);return}b(i)},[t,b]),H=a.useCallback(()=>{if(t){q.current=!0,S(null);return}f()},[f,t]),J=a.useCallback(i=>{const h=A[i];h&&(O(h),window.dispatchEvent(new CustomEvent("scout:set-inspector-width",{detail:{width:520}})))},[A,O]),{getRowFocusProps:ce,setFocusedIndex:xe}=tr({enabled:!!c&&A.length>0,rowCount:A.length,onActivateRow:J,onClearSelection:H}),de=C?.id??null,L=C?`${C.id} ${C.status} ${C.ts}`:null;a.useEffect(()=>{if(!t||!de)return;const i=k.find(h=>h.id===de);i&&`${i.id} ${i.status} ${i.ts}`!==L&&S(i)},[t,de,L,k]),a.useEffect(()=>{if(!t||!n||!c||q.current||C)return;const i=k.find(h=>h.id===n)??c.attempts.find(h=>h.id===n)??c.failedQueries.find(h=>h.id===n)??c.failedDeliveries.find(h=>h.id===n);i&&(q.current=!0,S(i))},[c,t,C,k,n]),a.useEffect(()=>{const i=o.view==="broker"?o.attemptId:void 0;if(!i)return;const h=A.findIndex(x=>x.id===i);h>=0&&xe(h)},[A,j,o,xe]);const ee=a.useCallback(i=>{const x=(be.indexOf(j)+i+be.length)%be.length,T=be[x];s({view:"broker",...T==="all"?{}:{filter:T}})},[j,s]),R=t?C:null;return e.jsx("div",{className:`s-ops${t?" s-ops--embedded":""}${R?" s-ops--split":""}`,children:e.jsxs("div",{className:"s-ops-body",children:[e.jsxs("div",{className:"sys-surface-page sys-surface-page-wide sys-surface-page-fluid sys-broker-page",children:[e.jsxs("div",{className:"sys-ledger-toolbar","aria-label":"Dispatch controls",children:[c?e.jsx("div",{className:"sys-tab-row sys-tab-row--toolbar",role:"tablist","aria-label":"Dispatch message filters",onKeyDown:i=>{i.key==="ArrowRight"?(i.preventDefault(),ee(1)):i.key==="ArrowLeft"&&(i.preventDefault(),ee(-1))},children:be.map(i=>e.jsxs("button",{type:"button",role:"tab","aria-selected":j===i,className:`sys-tab${j===i?" sys-tab-active":""}`,onClick:()=>s({view:"broker",...i==="all"?{}:{filter:i}}),children:[e.jsx("span",{children:ar[i]}),e.jsx("span",{className:"sys-tab-count",children:X[i]})]},i))}):e.jsx("div",{className:"sys-ledger-kicker",children:"Dispatch ledger"}),e.jsxs("div",{className:"sys-page-actions sys-ledger-actions",children:[e.jsx("div",{className:"sys-sync-note",children:I?"Loading dispatch ledger...":c?`Updated ${Ie(c.generatedAt)}${c.source?.latestMessageAt?` · latest message ${Ie(c.source.latestMessageAt)}`:""}`:"Waiting for dispatch data"}),e.jsx("button",{type:"button",className:"s-btn",disabled:I||y,onClick:()=>{M("manual")},children:y?"Refreshing...":"Refresh"})]})]}),ae&&e.jsxs("div",{className:"sys-banner sys-banner-warning",children:[e.jsx("strong",{children:"Refresh failed."}),e.jsx("span",{children:ae})]}),y&&c&&e.jsxs("div",{className:"sys-broker-source-note",role:"status","aria-live":"polite",children:[e.jsx(ke,{className:"sys-broker-source-spinner",size:12,"aria-hidden":"true"}),e.jsx("strong",{children:"Updating dispatches…"})]}),!y&&c?.source?.mode==="sqlite_projection"&&c.source.status==="degraded"&&c.source.detail&&e.jsxs("div",{className:"sys-broker-source-note sys-broker-source-note--warning",role:"status","aria-label":c.source.detail,title:c.source.detail,children:[e.jsx("span",{className:"sys-broker-source-dot","aria-hidden":"true"}),e.jsx("strong",{children:"Dispatch may be out of date"}),e.jsx("span",{children:"Live broker unavailable; showing saved dispatch history."})]}),I&&!c&&e.jsx(Ce,{title:"Loading dispatch",body:"Reading the dispatch database snapshot."}),!I&&!c&&!ae&&e.jsx(Ce,{title:"No dispatch data",body:"No dispatch rows are available yet."}),c&&e.jsxs(e.Fragment,{children:[e.jsx(mr,{attempts:A,agents:d,selectedAttemptId:t?C?.id??null:u?.id??(o.view==="broker"?o.attemptId??null:null),onInspect:O,getRowFocusProps:ce}),A.length>0&&ge&&e.jsx("div",{className:"sys-ledger-footer",children:e.jsx("button",{type:"button",className:"s-btn",disabled:N,onClick:()=>{G()},children:N?"Loading older...":"Load older"})})]})]}),R&&e.jsx("div",{className:"s-broker-embed-detail",children:e.jsx(ts,{attempt:R,navigate:s,onClose:H})})]})})}function mr({attempts:s,agents:t,selectedAttemptId:n,onInspect:o,getRowFocusProps:d}){if(s.length===0)return e.jsx(Ce,{title:"No dispatch rows",body:"No dispatch rows are available yet."});const u=s.reduce((b,f,c)=>{const v=ye(f.ts),j=b[b.length-1];return j?.key===v?j.attempts.push({attempt:f,index:c}):b.push({key:v,label:ur(f.ts),attempts:[{attempt:f,index:c}]}),b},[]);return e.jsxs("div",{className:"sys-broker-wire","aria-label":"Dispatch ledger",children:[e.jsxs("div",{className:"sys-broker-wire-head","aria-hidden":"true",children:[e.jsx("span",{className:"sys-broker-col sys-broker-col--route",children:"Route"}),e.jsx("span",{className:"sys-broker-col sys-broker-col--msg",children:"Message"}),e.jsx("span",{className:"sys-broker-col sys-broker-col--time",children:"Time"})]}),u.map(b=>e.jsxs("section",{className:"sys-broker-day","aria-labelledby":`dispatch-day-${b.key}`,children:[e.jsxs("header",{className:"sys-broker-day-head",children:[e.jsx("h2",{id:`dispatch-day-${b.key}`,children:b.label}),e.jsxs("span",{children:[b.attempts.length," ",b.attempts.length===1?"dispatch":"dispatches"]})]}),e.jsx("div",{className:"sys-broker-wire-body",role:"list",children:b.attempts.map(({attempt:f,index:c})=>{const v=Ee(f.kind,f.status),j=oe(f),I=!j&&(v==="working"||v==="warning"),U=Xe(f),y=ss(f),m=j?U:I?y:null,N=()=>{o(f),window.dispatchEvent(new CustomEvent("scout:set-inspector-width",{detail:{width:520}}))};return e.jsxs("div",{role:"listitem",className:`sys-broker-wire-row${j?" sys-broker-wire-row--failure":I?" sys-broker-wire-row--pending":""}${n===f.id?" sys-broker-wire-row--selected":""}`,"aria-label":`${y}. Inspect ${f.detail}`,onClick:N,...d(c),children:[e.jsx("div",{className:"sys-broker-cell sys-broker-col--route",children:e.jsx(dr,{attempt:f,agents:t})}),e.jsxs("div",{className:"sys-broker-cell sys-broker-col--msg",children:[e.jsx("span",{className:"sys-broker-msg",title:f.detail,children:f.detail}),m&&e.jsx("span",{className:`sys-broker-msg-error sys-broker-msg-error--${j?"danger":"warning"}`,title:m,children:m})]}),e.jsx("div",{className:"sys-broker-cell sys-broker-col--time",children:e.jsx("time",{className:"sys-broker-time-abs",title:`${Ie(f.ts)} · ${Ye(f.ts)}`,children:or(f.ts)})})]},f.id)})})]},b.key))]})}function pr(s){const t=es(s);return[{label:"Kind",value:nr(s.kind)},{label:"Time",value:Ye(s.ts)},{label:"Actor",value:s.actorName},{label:"Target",value:s.target},{label:"Route",value:s.route},{label:"Conversation",value:s.conversationId},{label:"Reference",value:t},{label:"Message",value:s.messageId===t?null:s.messageId},{label:"Delivery",value:s.deliveryId===t?null:s.deliveryId},{label:"Invocation",value:s.invocationId===t?null:s.invocationId}].filter(n=>!!n.value)}function ie({value:s,subject:t,className:n}){const[o,d]=a.useState("idle"),u=a.useRef(null);a.useEffect(()=>{d("idle")},[s]),a.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const b=a.useCallback(async()=>{const v=await xs(s);u.current&&clearTimeout(u.current),d(v?"copied":"failed"),u.current=setTimeout(()=>{d("idle"),u.current=null},1500)},[s]),f=o==="copied",c=o==="failed";return e.jsx("button",{type:"button",className:`sys-copy-btn${n?` ${n}`:""}${f?" sys-copy-btn--copied":""}${c?" sys-copy-btn--failed":""}`,onClick:()=>{b()},title:f?`Copied ${t}`:c?"Copy failed":`Copy ${t}`,"aria-label":f?`Copied ${t}`:c?`Copy ${t} failed`:`Copy ${t}`,children:f?e.jsx(Bs,{size:14,"aria-hidden":"true"}):e.jsx(zs,{size:14,"aria-hidden":"true"})})}function br(s){const t=s.trim();if(t.startsWith("{")||t.startsWith("["))try{return{code:JSON.stringify(JSON.parse(t),null,2),path:"payload.json",language:"JSON"}}catch{}return{code:s,path:"payload.md",language:"Text · Markdown"}}function yr({payload:s}){const t=a.useMemo(()=>br(s),[s]),[n,o]=a.useState(!1),d=a.useRef(null),u=t.code.split(`
1
+ import{r as a,j as e}from"./index-NRbRrZw-.js";import{r as us}from"./index-CD2foMB8.js";import{D as hs}from"./text-B2UZi3l9.js";import{E as Ce}from"./EmptyState-uQbB-bvP.js";import{y as fs,C as ms,z as ps,R as bs,A as ys,B as gs}from"./NewChatComposer-BPsg8shF.js";import{a as ne}from"./api-DEHEgJ9m.js";import{c as xs}from"./clipboard-e3fSpeo7.js";import{u as js}from"./sse-QSbhyq9A.js";import{b as Ee}from"./status-tone-BM_zuRy1.js";import{t as Ie,b as Ye,n as V}from"./time-Dhsh_2EG.js";import{u as Ge}from"./Provider-Cd-QZltN.js";import{o as Oe}from"./openContent-C6XO6kr5.js";import{g as ks,b as oe,h as Xe,d as vs,i as ws,j as Ns,k as Ss,l as Rs}from"./broker-display-Q75fupqG.js";import{BrokerMetadataPanel as As}from"./BrokerMetadataPanel-C8WERmHF.js";import{DispatchAftermath as Cs}from"./DispatchAftermath-D797PbCe.js";import{i as Is,c as $s,n as _e}from"./keyboard-nav-feLCB3Zm.js";import{ShikiPane as Ds}from"./ShikiPane-CiVH-45m.js";import{d as Es}from"./types-B0PlfpKc.js";/* empty css */import{L as ke}from"./loader-circle-Be0T8xv2.js";import{R as Fs}from"./refresh-cw-C4E58VJK.js";import{X as $e}from"./x-DuzAbpk5.js";import{c as Ne}from"./createLucideIcon-Da0lq809.js";import{E as Ke}from"./external-link-BheHazeW.js";import{C as Ms}from"./chevron-down-Jh540uf3.js";import{S as Ls}from"./sparkles-CgTby-ap.js";import{P as Ts}from"./plus-ZReaTFF-.js";import{S as Ps}from"./send-horizontal-DOjHkZCD.js";import{A as Ue}from"./arrow-right-YRBoTTyf.js";import{C as Bs}from"./check-BdovFDz8.js";import{C as zs}from"./copy-DQAM0eSY.js";import{M as qs}from"./message-square-DURSOrUr.js";import{R as Os}from"./radio-BC9TO5Pl.js";import{M as _s,b as Ks}from"./DocumentFocusViewer-CetjnYut.js";import{B as Us}from"./bot-Ba3gcRVa.js";const Hs=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Js=Ne("arrow-down",Hs);const Qs=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],Ws=Ne("at-sign",Qs);const Vs=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Ys=Ne("hash",Vs);const Gs=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Xs=Ne("paperclip",Gs),Zs=160;function He(s){const t=new URLSearchParams({limit:String(Zs)});return s&&t.set("cursor",s),`/api/broker?${t.toString()}`}const Je={index:-1,request:0};function er(s,t){return{index:t,request:s.request+1}}function Ze(s,t){return t===s.index?s:{index:t,request:s.request}}function sr(s,t){return s.index<t?s:Ze(s,t>0?t-1:-1)}function rr(s,t){return s.request!==t}function tr({enabled:s,rowCount:t,onActivateRow:n,onClearSelection:o}){const[d,u]=a.useState(Je),b=d.index,f=a.useRef(new Map),c=a.useRef(Je.request),v=a.useCallback(y=>{u(m=>er(m,typeof y=="function"?y(m.index):y))},[]),j=a.useCallback(y=>{u(m=>Ze(m,typeof y=="function"?y(m.index):y))},[]);a.useEffect(()=>{if(!rr(d,c.current)||(c.current=d.request,d.index<0))return;const y=f.current.get(d.index);y?.scrollIntoView({block:"nearest"}),y?.focus()},[d]),a.useEffect(()=>{u(y=>sr(y,t))},[t]);const I=a.useCallback((y,m)=>{m?f.current.set(y,m):f.current.delete(y)},[]);a.useEffect(()=>{if(!s)return;const y=m=>{if(document.querySelector(".sys-broker-page")&&!(Is(m.target)||$s())&&t!==0){if(m.key==="Escape"){o&&(m.preventDefault(),o(),j(-1));return}if(m.key==="ArrowDown"||m.key==="j"){m.preventDefault(),v(N=>_e(N,t,1));return}if(m.key==="ArrowUp"||m.key==="k"){m.preventDefault(),v(N=>_e(N,t,-1));return}if(m.key==="Home"||m.key==="g"&&!m.shiftKey){m.preventDefault(),v(0);return}if(m.key==="End"||m.key==="G"){m.preventDefault(),v(t-1);return}if(m.key==="Enter"||m.key===" "){const N=b<0?0:b;m.preventDefault(),v(N),n(N)}}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[s,b,v,n,o,t,j]);const U=a.useCallback(y=>({tabIndex:b===y?0:-1,ref:m=>I(y,m),onFocus:()=>j(y)}),[b,I,j]);return{focusedIndex:b,setFocusedIndex:j,getRowFocusProps:U}}const be=["all","delivered","failed"],ar={all:"All",delivered:"Delivered",failed:"Failed"};function nr(s){switch(s){case"success":return"Success";case"failed_query":return"Query failure";case"failed_delivery":return"Delivery failure";default:return"Delivery attempt"}}function es(s){return s.messageId??s.deliveryId??s.invocationId??s.id}function ss(s){switch(Ee(s.kind,s.status)){case"success":return"Delivered";case"danger":return"Failed";case"working":return"Pending";case"warning":return"Held";default:return s.status?s.status.charAt(0).toUpperCase()+s.status.slice(1):"Queued"}}function ve(s){if(!s)return"··";const t=s.trim().split(/\s+/).filter(Boolean);if(t.length===0)return"··";const n=t[t.length-1];return/^\d+$/.test(n)?n.slice(-2):t.length>=2?(t[0][0]+t[1][0]).toUpperCase():s.trim().slice(0,2).toUpperCase()}function or(s){const t=V(s)??0;return new Date(t).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Qe(s){const t=V(s);return t===null?"—":new Date(t).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Se(s,t,n=0){if(!s||typeof s!="object"||Array.isArray(s)||n>3)return;const o=s;for(const d of t)if(o[d]!==void 0&&o[d]!==null)return o[d];for(const d of Object.values(o)){const u=Se(d,t,n+1);if(u!==void 0)return u}}function K(s,...t){const n=Se(s.metadata,t);return typeof n!="string"&&typeof n!="number"?null:String(n).trim()||null}function we(s,...t){const n=Se(s.metadata,t);return typeof n=="number"||typeof n=="string"?V(n):null}function rs(s){switch(s){case"dm":return"Direct · agent";case"channel":return"Channel";case"broadcast":return"Broadcast";case null:return"No route";default:return s.replaceAll("_"," ")}}function De(s,t){if(t==="to")return s.route==="channel"?"Channel":s.route==="broadcast"?"Broadcast":s.target?.toLowerCase().includes("operator")?"Operator":"Agent lane";const n=K(s,"class","actorClass")?.toLowerCase();return n==="operator"||n==="human"?"Operator":n==="agent"?"Agent":s.actorName?.toLowerCase().includes("operator")?"Operator":"Sender"}function ir(s){const t=Se(s.metadata,["latencyMs","durationMs"]);if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t<1e3?`${Math.round(t)}ms`:`${(t/1e3).toFixed(t<1e4?1:0)}s`;const n=we(s,"sentAt","createdAt")??V(s.ts),o=we(s,"deliveredAt","completedAt");if(n===null||o===null||o<n)return"—";const d=o-n;return d<1e3?`${d}ms`:`${(d/1e3).toFixed(d<1e4?1:0)}s`}function Fe({route:s}){switch(s){case"channel":return e.jsx(Ys,{size:12,"aria-hidden":"true"});case"broadcast":return e.jsx(Os,{size:12,"aria-hidden":"true"});case"dm":return e.jsx(Ws,{size:12,"aria-hidden":"true"});default:return e.jsx(qs,{size:12,"aria-hidden":"true"})}}function lr(s,t){if(!t)return null;const n=t.trim().replace(/^@/,"").toLowerCase();return s.find(o=>[o.id,o.name,o.handle,o.selector,o.defaultSelector,o.conversationId,o.harnessSessionId].some(d=>d?.trim().replace(/^@/,"").toLowerCase()===n))??null}function We(s,t,n){const o=n==="from"?s.actorName:s.target,d=lr(t,o),u=d?.name??o??(n==="from"?"Unknown":"No target"),b=d?"Agent":n==="to"&&s.conversationId?"Session route":De(s,n);return{label:u,kind:b,agent:d}}function cr(s,t,n){const o=n.agent??t.agent;return[{label:"From",value:t.kind},{label:"To",value:n.kind},{label:"Target",value:s.target??n.label},{label:"Channel",value:rs(s.route)},{label:"Project",value:o?.project??K(s,"project","projectName")},{label:"Branch",value:o?.branch??K(s,"branch")},{label:"Runtime",value:o?[o.harness,o.model,o.reasoningEffort].filter(Boolean).join(" · ")||null:[K(s,"harness"),K(s,"model")].filter(Boolean).join(" · ")||null},{label:"Machine",value:o?.authorityNodeName??o?.homeNodeName??o?.authorityNodeId??o?.homeNodeId??K(s,"machine","machineName","nodeName")}].filter(d=>!!d.value)}function Ve({party:s,route:t,side:n}){return e.jsxs("span",{className:`sys-broker-route-end sys-broker-route-end--${n}`,children:[e.jsx("span",{className:"sys-broker-avatar sys-broker-endpoint-avatar","aria-hidden":"true",children:s.agent||n==="from"?ve(s.label):e.jsx(Fe,{route:t})}),e.jsx("span",{className:"sys-broker-endpoint-name",title:s.label,children:s.label})]})}function dr({attempt:s,agents:t}){const n=We(s,t,"from"),o=We(s,t,"to"),d=cr(s,n,o),u=`dispatch-route-${s.id}`;return e.jsxs("span",{className:"sys-broker-route",tabIndex:0,"aria-describedby":u,children:[e.jsx(Ve,{party:n,route:s.route,side:"from"}),e.jsx(Ue,{className:"sys-broker-route-arrow",size:11,"aria-hidden":"true"}),e.jsx(Ve,{party:o,route:s.route,side:"to"}),e.jsxs("span",{className:"sys-broker-endpoint-card",id:u,role:"tooltip",children:[e.jsx("span",{className:"sys-broker-endpoint-card-head",children:e.jsxs("span",{className:"sys-broker-endpoint-card-edge",children:[e.jsx("span",{className:"sys-broker-avatar sys-broker-endpoint-avatar","aria-hidden":"true",children:ve(n.label)}),e.jsx("strong",{children:n.label}),e.jsx(Ue,{className:"sys-broker-route-arrow",size:11,"aria-hidden":"true"}),e.jsx("span",{className:"sys-broker-avatar sys-broker-endpoint-avatar","aria-hidden":"true",children:o.agent?ve(o.label):e.jsx(Fe,{route:s.route})}),e.jsx("strong",{children:o.label})]})}),e.jsx("span",{className:"sys-broker-endpoint-card-body",children:d.map(b=>e.jsxs("span",{className:"sys-broker-endpoint-card-field",children:[e.jsx("small",{children:b.label}),e.jsx("code",{title:b.value,children:b.value})]},b.label))})]})]})}function ye(s){const t=V(s)??0,n=new Date(t);return`${n.getFullYear()}-${n.getMonth()}-${n.getDate()}`}function ur(s,t=Date.now()){const n=V(s)??0,o=new Date(n),d=new Date(t),u=new Date(t);return u.setDate(u.getDate()-1),ye(s)===ye(d.getTime())?"Today":ye(s)===ye(u.getTime())?"Yesterday":o.toLocaleDateString(void 0,{month:"short",day:"numeric",year:o.getFullYear()===d.getFullYear()?void 0:"numeric"})}function hr(s,t,n){return{...t,source:s.source,attempts:[...s.attempts,...t.attempts],failedQueries:s.failedQueries,failedDeliveries:s.failedDeliveries,dialogue:s.dialogue,ledger:{...t.ledger,cursors:{...s.ledger.cursors,[n]:t.ledger.cursors[n]},hasMore:{...s.ledger.hasMore,[n]:t.ledger.hasMore[n]}}}}function fr({navigate:s,embedded:t=!1,initialAttemptId:n}){const{route:o,agents:d,selectedBrokerAttempt:u,inspectBrokerAttempt:b,clearBrokerAttempt:f}=Ge(),[c,v]=a.useState(null),j=o.view==="broker"?o.filter??"all":"all",[I,U]=a.useState(!0),[y,m]=a.useState(!1),[N,Y]=a.useState(!1),[ae,B]=a.useState(null),E=a.useRef(null),F=a.useRef(0),z=a.useRef(null),M=a.useCallback(async(i="initial")=>{const h=++F.current;!E.current&&i!=="background"?(U(!0),B(null)):m(!0);try{const x=await ne(He());if(h!==F.current)return;E.current=x,v(x),B(null)}catch(x){if(h!==F.current)return;B(x instanceof Error?x.message:String(x))}finally{h===F.current&&(U(!1),m(!1))}},[]),G=a.useCallback(async()=>{const i=E.current;if(!i||N)return;const h="attempts",x=i.ledger.cursors[h];if(!x||!i.ledger.hasMore[h])return;const T=++F.current;Y(!0),B(null);try{const P=await ne(He(x));if(T!==F.current)return;const se=E.current,ue=se?hr(se,P,h):P;E.current=ue,v(ue)}catch(P){if(T!==F.current)return;B(P instanceof Error?P.message:String(P))}finally{T===F.current&&Y(!1)}},[N]),le=a.useCallback(()=>{z.current||(z.current=setTimeout(()=>{z.current=null,M("background")},250))},[M]);a.useEffect(()=>(M("initial"),()=>{z.current&&clearTimeout(z.current)}),[M]),js(i=>{(i.kind==="message.posted"||i.kind==="delivery.planned"||i.kind==="delivery.attempted"||i.kind==="delivery.state.changed"||i.kind==="scout.dispatched")&&le()});const k=a.useMemo(()=>{if(!c)return[];const i=new Map(c.dialogue.map(h=>[h.id,h.body]));return ks(c.attempts).map(h=>{const x=h.messageId?i.get(h.messageId):null;return x&&x!==h.detail?{...h,detail:x}:h})},[c]),A=a.useMemo(()=>{switch(j){case"delivered":return k.filter(i=>!oe(i));case"failed":return k.filter(oe);default:return k}},[j,k]),ge=c?.ledger.hasMore.attempts??!1,X=a.useMemo(()=>({all:k.length,delivered:k.filter(i=>!oe(i)).length,failed:k.filter(oe).length}),[k]),$=a.useMemo(()=>{const i=o.view==="broker"?o.attemptId:void 0;return!c||!i?null:k.find(h=>h.id===i)??c.attempts.find(h=>h.id===i)??c.failedQueries.find(h=>h.id===i)??c.failedDeliveries.find(h=>h.id===i)??null},[c,k,o]),Z=$?`${$.id}\0${$.status}\0${$.ts}`:null,D=u?`${u.id}\0${u.status}\0${u.ts}`:null;a.useEffect(()=>{$&&Z!==D&&b($)},[D,b,$,Z]);const[C,S]=a.useState(null),q=a.useRef(!1),O=a.useCallback(i=>{if(t){q.current=!0,S(i);return}b(i)},[t,b]),H=a.useCallback(()=>{if(t){q.current=!0,S(null);return}f()},[f,t]),J=a.useCallback(i=>{const h=A[i];h&&(O(h),window.dispatchEvent(new CustomEvent("scout:set-inspector-width",{detail:{width:520}})))},[A,O]),{getRowFocusProps:ce,setFocusedIndex:xe}=tr({enabled:!!c&&A.length>0,rowCount:A.length,onActivateRow:J,onClearSelection:H}),de=C?.id??null,L=C?`${C.id} ${C.status} ${C.ts}`:null;a.useEffect(()=>{if(!t||!de)return;const i=k.find(h=>h.id===de);i&&`${i.id} ${i.status} ${i.ts}`!==L&&S(i)},[t,de,L,k]),a.useEffect(()=>{if(!t||!n||!c||q.current||C)return;const i=k.find(h=>h.id===n)??c.attempts.find(h=>h.id===n)??c.failedQueries.find(h=>h.id===n)??c.failedDeliveries.find(h=>h.id===n);i&&(q.current=!0,S(i))},[c,t,C,k,n]),a.useEffect(()=>{const i=o.view==="broker"?o.attemptId:void 0;if(!i)return;const h=A.findIndex(x=>x.id===i);h>=0&&xe(h)},[A,j,o,xe]);const ee=a.useCallback(i=>{const x=(be.indexOf(j)+i+be.length)%be.length,T=be[x];s({view:"broker",...T==="all"?{}:{filter:T}})},[j,s]),R=t?C:null;return e.jsx("div",{className:`s-ops${t?" s-ops--embedded":""}${R?" s-ops--split":""}`,children:e.jsxs("div",{className:"s-ops-body",children:[e.jsxs("div",{className:"sys-surface-page sys-surface-page-wide sys-surface-page-fluid sys-broker-page",children:[e.jsxs("div",{className:"sys-ledger-toolbar","aria-label":"Dispatch controls",children:[c?e.jsx("div",{className:"sys-tab-row sys-tab-row--toolbar",role:"tablist","aria-label":"Dispatch message filters",onKeyDown:i=>{i.key==="ArrowRight"?(i.preventDefault(),ee(1)):i.key==="ArrowLeft"&&(i.preventDefault(),ee(-1))},children:be.map(i=>e.jsxs("button",{type:"button",role:"tab","aria-selected":j===i,className:`sys-tab${j===i?" sys-tab-active":""}`,onClick:()=>s({view:"broker",...i==="all"?{}:{filter:i}}),children:[e.jsx("span",{children:ar[i]}),e.jsx("span",{className:"sys-tab-count",children:X[i]})]},i))}):e.jsx("div",{className:"sys-ledger-kicker",children:"Dispatch ledger"}),e.jsxs("div",{className:"sys-page-actions sys-ledger-actions",children:[e.jsx("div",{className:"sys-sync-note",children:I?"Loading dispatch ledger...":c?`Updated ${Ie(c.generatedAt)}${c.source?.latestMessageAt?` · latest message ${Ie(c.source.latestMessageAt)}`:""}`:"Waiting for dispatch data"}),e.jsx("button",{type:"button",className:"s-btn",disabled:I||y,onClick:()=>{M("manual")},children:y?"Refreshing...":"Refresh"})]})]}),ae&&e.jsxs("div",{className:"sys-banner sys-banner-warning",children:[e.jsx("strong",{children:"Refresh failed."}),e.jsx("span",{children:ae})]}),y&&c&&e.jsxs("div",{className:"sys-broker-source-note",role:"status","aria-live":"polite",children:[e.jsx(ke,{className:"sys-broker-source-spinner",size:12,"aria-hidden":"true"}),e.jsx("strong",{children:"Updating dispatches…"})]}),!y&&c?.source?.mode==="sqlite_projection"&&c.source.status==="degraded"&&c.source.detail&&e.jsxs("div",{className:"sys-broker-source-note sys-broker-source-note--warning",role:"status","aria-label":c.source.detail,title:c.source.detail,children:[e.jsx("span",{className:"sys-broker-source-dot","aria-hidden":"true"}),e.jsx("strong",{children:"Dispatch may be out of date"}),e.jsx("span",{children:"Live broker unavailable; showing saved dispatch history."})]}),I&&!c&&e.jsx(Ce,{title:"Loading dispatch",body:"Reading the dispatch database snapshot."}),!I&&!c&&!ae&&e.jsx(Ce,{title:"No dispatch data",body:"No dispatch rows are available yet."}),c&&e.jsxs(e.Fragment,{children:[e.jsx(mr,{attempts:A,agents:d,selectedAttemptId:t?C?.id??null:u?.id??(o.view==="broker"?o.attemptId??null:null),onInspect:O,getRowFocusProps:ce}),A.length>0&&ge&&e.jsx("div",{className:"sys-ledger-footer",children:e.jsx("button",{type:"button",className:"s-btn",disabled:N,onClick:()=>{G()},children:N?"Loading older...":"Load older"})})]})]}),R&&e.jsx("div",{className:"s-broker-embed-detail",children:e.jsx(ts,{attempt:R,navigate:s,onClose:H})})]})})}function mr({attempts:s,agents:t,selectedAttemptId:n,onInspect:o,getRowFocusProps:d}){if(s.length===0)return e.jsx(Ce,{title:"No dispatch rows",body:"No dispatch rows are available yet."});const u=s.reduce((b,f,c)=>{const v=ye(f.ts),j=b[b.length-1];return j?.key===v?j.attempts.push({attempt:f,index:c}):b.push({key:v,label:ur(f.ts),attempts:[{attempt:f,index:c}]}),b},[]);return e.jsxs("div",{className:"sys-broker-wire","aria-label":"Dispatch ledger",children:[e.jsxs("div",{className:"sys-broker-wire-head","aria-hidden":"true",children:[e.jsx("span",{className:"sys-broker-col sys-broker-col--route",children:"Route"}),e.jsx("span",{className:"sys-broker-col sys-broker-col--msg",children:"Message"}),e.jsx("span",{className:"sys-broker-col sys-broker-col--time",children:"Time"})]}),u.map(b=>e.jsxs("section",{className:"sys-broker-day","aria-labelledby":`dispatch-day-${b.key}`,children:[e.jsxs("header",{className:"sys-broker-day-head",children:[e.jsx("h2",{id:`dispatch-day-${b.key}`,children:b.label}),e.jsxs("span",{children:[b.attempts.length," ",b.attempts.length===1?"dispatch":"dispatches"]})]}),e.jsx("div",{className:"sys-broker-wire-body",role:"list",children:b.attempts.map(({attempt:f,index:c})=>{const v=Ee(f.kind,f.status),j=oe(f),I=!j&&(v==="working"||v==="warning"),U=Xe(f),y=ss(f),m=j?U:I?y:null,N=()=>{o(f),window.dispatchEvent(new CustomEvent("scout:set-inspector-width",{detail:{width:520}}))};return e.jsxs("div",{role:"listitem",className:`sys-broker-wire-row${j?" sys-broker-wire-row--failure":I?" sys-broker-wire-row--pending":""}${n===f.id?" sys-broker-wire-row--selected":""}`,"aria-label":`${y}. Inspect ${f.detail}`,onClick:N,...d(c),children:[e.jsx("div",{className:"sys-broker-cell sys-broker-col--route",children:e.jsx(dr,{attempt:f,agents:t})}),e.jsxs("div",{className:"sys-broker-cell sys-broker-col--msg",children:[e.jsx("span",{className:"sys-broker-msg",title:f.detail,children:f.detail}),m&&e.jsx("span",{className:`sys-broker-msg-error sys-broker-msg-error--${j?"danger":"warning"}`,title:m,children:m})]}),e.jsx("div",{className:"sys-broker-cell sys-broker-col--time",children:e.jsx("time",{className:"sys-broker-time-abs",title:`${Ie(f.ts)} · ${Ye(f.ts)}`,children:or(f.ts)})})]},f.id)})})]},b.key))]})}function pr(s){const t=es(s);return[{label:"Kind",value:nr(s.kind)},{label:"Time",value:Ye(s.ts)},{label:"Actor",value:s.actorName},{label:"Target",value:s.target},{label:"Route",value:s.route},{label:"Conversation",value:s.conversationId},{label:"Reference",value:t},{label:"Message",value:s.messageId===t?null:s.messageId},{label:"Delivery",value:s.deliveryId===t?null:s.deliveryId},{label:"Invocation",value:s.invocationId===t?null:s.invocationId}].filter(n=>!!n.value)}function ie({value:s,subject:t,className:n}){const[o,d]=a.useState("idle"),u=a.useRef(null);a.useEffect(()=>{d("idle")},[s]),a.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const b=a.useCallback(async()=>{const v=await xs(s);u.current&&clearTimeout(u.current),d(v?"copied":"failed"),u.current=setTimeout(()=>{d("idle"),u.current=null},1500)},[s]),f=o==="copied",c=o==="failed";return e.jsx("button",{type:"button",className:`sys-copy-btn${n?` ${n}`:""}${f?" sys-copy-btn--copied":""}${c?" sys-copy-btn--failed":""}`,onClick:()=>{b()},title:f?`Copied ${t}`:c?"Copy failed":`Copy ${t}`,"aria-label":f?`Copied ${t}`:c?`Copy ${t} failed`:`Copy ${t}`,children:f?e.jsx(Bs,{size:14,"aria-hidden":"true"}):e.jsx(zs,{size:14,"aria-hidden":"true"})})}function br(s){const t=s.trim();if(t.startsWith("{")||t.startsWith("["))try{return{code:JSON.stringify(JSON.parse(t),null,2),path:"payload.json",language:"JSON"}}catch{}return{code:s,path:"payload.md",language:"Text · Markdown"}}function yr({payload:s}){const t=a.useMemo(()=>br(s),[s]),[n,o]=a.useState(!1),d=a.useRef(null),u=t.code.split(`
2
2
  `).length;a.useEffect(()=>{const f=d.current;!f||!n||f.open||f.showModal()},[n]),a.useEffect(()=>{o(!1)},[s]);const b=e.jsx("div",{className:"sys-broker-payload-code","data-language":t.path==="payload.json"?"json":"markdown",role:"region","aria-label":`Dispatch payload, ${t.language}`,tabIndex:0,children:e.jsx(Ds,{code:t.code,path:t.path})});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sys-broker-payload-head",children:[e.jsx("span",{className:"sys-detail-label",children:"Payload"}),e.jsxs("span",{className:"sys-broker-payload-meta",children:[t.language," · ",u," ",u===1?"line":"lines"]}),e.jsx(ie,{value:s,subject:"payload"}),e.jsx("button",{type:"button",className:"sys-copy-btn sys-broker-payload-expand",onClick:()=>o(!0),title:"Expand payload","aria-label":"Expand payload",children:e.jsx(_s,{size:14,"aria-hidden":"true"})})]}),e.jsx("div",{className:"sys-broker-payload-resizer",children:b}),n&&us.createPortal(e.jsxs("dialog",{ref:d,className:"sys-broker-payload-dialog","aria-label":"Expanded dispatch payload",onCancel:f=>{f.preventDefault(),o(!1)},onClose:()=>o(!1),children:[e.jsxs("header",{className:"sys-broker-payload-dialog-head",children:[e.jsxs("div",{children:[e.jsx("span",{className:"sys-detail-label",children:"Dispatch payload"}),e.jsxs("span",{className:"sys-broker-payload-meta",children:[t.language," · ",u," ",u===1?"line":"lines"]})]}),e.jsx(ie,{value:s,subject:"payload"}),e.jsx("button",{type:"button",className:"sys-copy-btn",onClick:()=>o(!1),title:"Return payload to inspector","aria-label":"Return payload to inspector",children:e.jsx(Ks,{size:14,"aria-hidden":"true"})})]}),e.jsx("div",{className:"sys-broker-payload-dialog-body",children:b})]}),document.body)]})}function gr({attempt:s}){const t=Rs(s);return e.jsxs("div",{className:"sys-broker-route-failure",role:"status",children:[e.jsx("span",{className:"sys-broker-route-failure-mark","aria-hidden":"true",children:e.jsx($e,{size:14})}),e.jsxs("div",{children:[e.jsx("span",{className:"sys-detail-label",children:"Routing stopped"}),e.jsx("strong",{children:t}),e.jsx("p",{children:s.detail})]}),e.jsx(ie,{value:s.detail,subject:"failure detail"})]})}function ts({attempt:s,navigate:t,onClose:n}){const{route:o,agents:d,scoutbotAgentId:u}=Ge(),b=pr(s),f=vs(s.metadata),c=oe(s),v=s.kind==="failed_query",j=Xe(s),I=Ee(s.kind,s.status),U=we(s,"sentAt","createdAt")??V(s.ts),y=we(s,"deliveredAt","completedAt")??V(s.ts),m=es(s),[N,Y]=a.useState("idle"),[ae,B]=a.useState(null),[E,F]=a.useState(null),[z,M]=a.useState(""),[G,le]=a.useState(""),[k,A]=a.useState("idle"),[ge,X]=a.useState(null),[$,Z]=a.useState(""),[D,C]=a.useState(""),[S,q]=a.useState(""),[O,H]=a.useState(""),[J,ce]=a.useState("medium"),[xe,de]=a.useState(null),[L,ee]=a.useState([]),[R,i]=a.useState("idle"),[h,x]=a.useState(null),T=K(s,"harness"),P=K(s,"model"),se=K(s,"reasoningEffort","effort"),ue=a.useRef(null),Me=a.useRef(null),Re=a.useMemo(()=>ws(s),[s]),w=a.useMemo(()=>d.filter(r=>!r.retiredFromFleet&&!r.staleLocalRegistration).slice().sort((r,l)=>r.id===u?-1:l.id===u?1:(l.updatedAt??0)-(r.updatedAt??0)||r.name.localeCompare(l.name)),[d,u]),he=a.useMemo(()=>Ns(s,w)?.id??"",[s,w]),fe=w.some(r=>r.id===u)?u:w[0]?.id??"",je=w[0]?.id??"",re=w.find(r=>r.id===fe)??null,as=a.useMemo(()=>{const r=new Map;for(const l of w){const p=l.projectRoot?.trim()||l.cwd?.trim();if(!p)continue;const g=p.split("/").filter(Boolean).at(-1)??p;r.set(p,l.project?.trim()||g)}return[...r.entries()].map(([l,p])=>({path:l,label:p}))},[w]),Le=a.useRef({originalTargetAgentId:he,firstRoutableAgentId:je,defaultForwardAgentId:fe,defaultForwardAgent:re,effort:"medium"});Le.current={originalTargetAgentId:he,firstRoutableAgentId:je,defaultForwardAgentId:fe,defaultForwardAgent:re,effort:K(s,"reasoningEffort","effort")||"medium"};const me=a.useRef(!1);a.useEffect(()=>{const r=Le.current;me.current=!1,Y("idle"),B(null),F(null),M(""),le(r.originalTargetAgentId||r.firstRoutableAgentId),A("idle"),X(null),Z(r.defaultForwardAgentId),C(r.defaultForwardAgent?.projectRoot?.trim()||r.defaultForwardAgent?.cwd?.trim()||""),q(r.defaultForwardAgent?.harness?.trim()||""),H(r.defaultForwardAgent?.model?.trim()||""),ce(r.effort),ee([]),i("idle"),x(null)},[s.id]),a.useEffect(()=>{me.current||(le(r=>r||he||je),Z(r=>r||fe),C(r=>r||re?.projectRoot?.trim()||re?.cwd?.trim()||""),q(r=>r||re?.harness?.trim()||""),H(r=>r||re?.model?.trim()||""))},[re,fe,je,he]),a.useEffect(()=>{const r=new URLSearchParams({scope:"global+project"});D&&r.set("projectRoot",D);let l=!1;return ne(`/api/runner/options?${r.toString()}`).then(p=>{!l&&p.schemaVersion==="openscout.runtime-capabilities.v1"&&de(p)}).catch(()=>{}),()=>{l=!0}},[D]);const ns=a.useCallback(r=>{M(r),window.requestAnimationFrame(()=>ue.current?.focus())},[]),os=a.useCallback(async()=>{const r=w.find(l=>l.id===G);if(!(!r||k==="sending")){A("sending"),X(null);try{const l=await ne("/api/ask",{method:"POST",body:JSON.stringify({body:s.detail,targetAgentId:r.id,targetLabel:r.name,...T||P||se?{execution:{...T?{harness:T}:{},...P?{model:P}:{},...se?{reasoningEffort:se}:{},session:"new"}}:{},metadata:{source:"scout-dispatch-redispatch",originalDispatchId:s.id,...s.messageId?{originalMessageId:s.messageId}:{},...s.conversationId?{originalConversationId:s.conversationId}:{}}})}),p=l.flightId??l.flight?.id;A("sent"),X(`New dispatch sent to ${r.name}${p?` · ${p}`:""}`)}catch(l){A("failed"),X(`Retry failed. ${l instanceof Error?l.message:String(l)}`)}}},[s,G,k,se,T,P,w]),Te=a.useCallback(async()=>{const r=z.trim(),l=w.find(p=>p.id===$);if(!(!r||!l||R==="sending")){i("sending"),x(L.length>0?`Uploading ${L.length} ${L.length===1?"attachment":"attachments"}…`:null);try{const p=L.length>0?await fs(L):[],g=await ne("/api/ask",{method:"POST",body:JSON.stringify({body:`${r}
3
3
 
4
4
  Attached dispatch context:
@@ -1 +1 @@
1
- import{r as n,j as i}from"./index-Bli6bTLU.js";const _=({panOffset:h,scale:a,onPan:R,onPanStart:E,onPanEnd:u,isPanLocked:d=!1,onClick:k,showGuides:g=!1,onGuidesChange:$,gridOpacity:C=1})=>{const[B,X]=n.useState(g),[G,K]=n.useState(!1),o=n.useRef(!1),v=n.useRef({x:0,y:0}),r=n.useRef({active:!1,startX:0,startY:0}),j=n.useRef(null),x=n.useRef(null),y=n.useRef(null),A=4,H=n.useRef({x:0,y:0}),w=n.useRef(0),b=n.useRef(!1);n.useEffect(()=>{X(g)},[g]);const Y=n.useCallback(e=>{const s=e;return s?s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.isContentEditable:!1},[]),z=n.useCallback(e=>{const s=e;return s?!!s.closest('button, [role="button"], a, input, textarea, select, [data-interactive="true"]'):!1},[]),c=n.useCallback(e=>{o.current=e,K(e)},[]);n.useEffect(()=>{const e=t=>{if(w.current=t.buttons,r.current.active&&(t.buttons&1)!==1&&(r.current.active=!1),o.current&&(t.buttons&1)!==1){c(!1),r.current.active=!1,u?.(),document.body.style.cursor="";return}if(d&&o.current){c(!1),r.current.active=!1,u?.(),document.body.style.cursor="";return}const l=j.current?.getBoundingClientRect(),f=l?t.clientX-l.left:t.clientX,V=l?t.clientY-l.top:t.clientY;if(H.current={x:f,y:V},x.current&&(x.current.style.left=`${f}px`),y.current&&(y.current.style.top=`${V}px`),r.current.active&&!o.current){const P=t.clientX-r.current.startX,Q=t.clientY-r.current.startY;Math.hypot(P,Q)>=A&&(r.current.active=!1,c(!0),b.current=!0,E?.(),v.current={x:t.clientX,y:t.clientY},document.body.style.cursor="grabbing")}o.current&&(R({x:(t.clientX-v.current.x)/a,y:(t.clientY-v.current.y)/a}),v.current={x:t.clientX,y:t.clientY})},s=t=>{w.current=t.buttons,r.current.active=!1,o.current&&(c(!1),u?.(),document.body.style.cursor="")},I=t=>{(t.metaKey||t.ctrlKey)&&t.key==="\\"&&(t.preventDefault(),X(l=>{const f=!l;return $?.(f),f}))},m=()=>{r.current.active=!1,s(new MouseEvent("mouseup"))};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",s),window.addEventListener("keydown",I),window.addEventListener("blur",m),document.addEventListener("visibilitychange",m),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",s),window.removeEventListener("keydown",I),window.removeEventListener("blur",m),document.removeEventListener("visibilitychange",m)}},[R,u,E,a,Y,z,d,c,$]),n.useEffect(()=>{!d||!o.current||(c(!1),u?.(),document.body.style.cursor="")},[d,u,c]);const U=e=>{b.current=!1,!(d||e.button!==0)&&(Y(e.target)||z(e.target)||(w.current=e.buttons,r.current={active:!0,startX:e.clientX,startY:e.clientY},e.preventDefault()))},F=e=>{!b.current&&k&&k(e),b.current=!1},[M,W]=n.useState({w:0,h:0});n.useEffect(()=>{const e=()=>W({w:window.innerWidth,h:window.innerHeight});return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const S=Math.max(.4,Math.min(2,a)),p=100*S,L=20*S,q="var(--hud-canvas-dot-minor)",J="var(--hud-canvas-dot-major)",N="color-mix(in srgb, oklch(var(--accent)) 18%, transparent)",T=(M.w/2+h.x*a)%p,D=(M.h/2+h.y*a)%p;return i.jsxs("div",{ref:j,className:`absolute inset-0 z-0 overflow-hidden bg-background ${G?"cursor-grabbing":"cursor-grab"}`,onMouseDown:U,onClick:F,children:[i.jsx("div",{className:"absolute pointer-events-none",style:{inset:"-100px",opacity:.8*C,transition:"opacity 1s ease",backgroundImage:`radial-gradient(circle, ${q} 1px, transparent 1px)`,backgroundSize:`${L}px ${L}px`,backgroundPosition:`${T+100}px ${D+100}px`}}),i.jsx("div",{className:"absolute pointer-events-none",style:{inset:"-100px",opacity:.45*C,transition:"opacity 1s ease",backgroundImage:`radial-gradient(circle, ${J} 1.5px, transparent 1.5px)`,backgroundSize:`${p}px ${p}px`,backgroundPosition:`${T+100}px ${D+100}px`}}),B&&i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:x,className:"absolute top-0 bottom-0 w-px pointer-events-none",style:{left:0,backgroundColor:N}}),i.jsx("div",{ref:y,className:"absolute left-0 right-0 h-px pointer-events-none",style:{top:0,backgroundColor:N}})]})]})};export{_ as C};
1
+ import{r as n,j as i}from"./index-NRbRrZw-.js";const _=({panOffset:h,scale:a,onPan:R,onPanStart:E,onPanEnd:u,isPanLocked:d=!1,onClick:k,showGuides:g=!1,onGuidesChange:$,gridOpacity:C=1})=>{const[B,X]=n.useState(g),[G,K]=n.useState(!1),o=n.useRef(!1),v=n.useRef({x:0,y:0}),r=n.useRef({active:!1,startX:0,startY:0}),j=n.useRef(null),x=n.useRef(null),y=n.useRef(null),A=4,H=n.useRef({x:0,y:0}),w=n.useRef(0),b=n.useRef(!1);n.useEffect(()=>{X(g)},[g]);const Y=n.useCallback(e=>{const s=e;return s?s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.isContentEditable:!1},[]),z=n.useCallback(e=>{const s=e;return s?!!s.closest('button, [role="button"], a, input, textarea, select, [data-interactive="true"]'):!1},[]),c=n.useCallback(e=>{o.current=e,K(e)},[]);n.useEffect(()=>{const e=t=>{if(w.current=t.buttons,r.current.active&&(t.buttons&1)!==1&&(r.current.active=!1),o.current&&(t.buttons&1)!==1){c(!1),r.current.active=!1,u?.(),document.body.style.cursor="";return}if(d&&o.current){c(!1),r.current.active=!1,u?.(),document.body.style.cursor="";return}const l=j.current?.getBoundingClientRect(),f=l?t.clientX-l.left:t.clientX,V=l?t.clientY-l.top:t.clientY;if(H.current={x:f,y:V},x.current&&(x.current.style.left=`${f}px`),y.current&&(y.current.style.top=`${V}px`),r.current.active&&!o.current){const P=t.clientX-r.current.startX,Q=t.clientY-r.current.startY;Math.hypot(P,Q)>=A&&(r.current.active=!1,c(!0),b.current=!0,E?.(),v.current={x:t.clientX,y:t.clientY},document.body.style.cursor="grabbing")}o.current&&(R({x:(t.clientX-v.current.x)/a,y:(t.clientY-v.current.y)/a}),v.current={x:t.clientX,y:t.clientY})},s=t=>{w.current=t.buttons,r.current.active=!1,o.current&&(c(!1),u?.(),document.body.style.cursor="")},I=t=>{(t.metaKey||t.ctrlKey)&&t.key==="\\"&&(t.preventDefault(),X(l=>{const f=!l;return $?.(f),f}))},m=()=>{r.current.active=!1,s(new MouseEvent("mouseup"))};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",s),window.addEventListener("keydown",I),window.addEventListener("blur",m),document.addEventListener("visibilitychange",m),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",s),window.removeEventListener("keydown",I),window.removeEventListener("blur",m),document.removeEventListener("visibilitychange",m)}},[R,u,E,a,Y,z,d,c,$]),n.useEffect(()=>{!d||!o.current||(c(!1),u?.(),document.body.style.cursor="")},[d,u,c]);const U=e=>{b.current=!1,!(d||e.button!==0)&&(Y(e.target)||z(e.target)||(w.current=e.buttons,r.current={active:!0,startX:e.clientX,startY:e.clientY},e.preventDefault()))},F=e=>{!b.current&&k&&k(e),b.current=!1},[M,W]=n.useState({w:0,h:0});n.useEffect(()=>{const e=()=>W({w:window.innerWidth,h:window.innerHeight});return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const S=Math.max(.4,Math.min(2,a)),p=100*S,L=20*S,q="var(--hud-canvas-dot-minor)",J="var(--hud-canvas-dot-major)",N="color-mix(in srgb, oklch(var(--accent)) 18%, transparent)",T=(M.w/2+h.x*a)%p,D=(M.h/2+h.y*a)%p;return i.jsxs("div",{ref:j,className:`absolute inset-0 z-0 overflow-hidden bg-background ${G?"cursor-grabbing":"cursor-grab"}`,onMouseDown:U,onClick:F,children:[i.jsx("div",{className:"absolute pointer-events-none",style:{inset:"-100px",opacity:.8*C,transition:"opacity 1s ease",backgroundImage:`radial-gradient(circle, ${q} 1px, transparent 1px)`,backgroundSize:`${L}px ${L}px`,backgroundPosition:`${T+100}px ${D+100}px`}}),i.jsx("div",{className:"absolute pointer-events-none",style:{inset:"-100px",opacity:.45*C,transition:"opacity 1s ease",backgroundImage:`radial-gradient(circle, ${J} 1.5px, transparent 1.5px)`,backgroundSize:`${p}px ${p}px`,backgroundPosition:`${T+100}px ${D+100}px`}}),B&&i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:x,className:"absolute top-0 bottom-0 w-px pointer-events-none",style:{left:0,backgroundColor:N}}),i.jsx("div",{ref:y,className:"absolute left-0 right-0 h-px pointer-events-none",style:{top:0,backgroundColor:N}})]})]})};export{_ as C};
@@ -1 +1 @@
1
- import{j as s,r as j}from"./index-Bli6bTLU.js";import{i as $,d as B,e as w,a as W}from"./conversation-model-CigSPlKA.js";import{l as O,i as q,a as E,p as T}from"./conversation-prefs-DNre-Lcx.js";import{u as G,m as J,e as K}from"./Provider-Ve8yXaWR.js";import{d as Q}from"./router-B0YclXYg.js";import{l as D,i as C,s as X}from"./sessionRead-CvFz2RHv.js";import{u as Y}from"./use-conversation-list-C0bEXFeH.js";import{u as Z}from"./use-fleet-active-asks-CK4aw-3G.js";import{i as ee}from"./colors-BtO5_zlx.js";import{A as se}from"./AgentAvatar-B1xvQ7ej.js";/* empty css */function te({children:n,count:t,tone:a="default",title:l,onClick:i}){const d=["collapsed-strip-label",a!=="default"&&`collapsed-strip-label--${a}`,t!=null&&"collapsed-strip-label--has-count",i&&"collapsed-strip-label--button"].filter(Boolean).join(" "),o=s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"collapsed-strip-label-mark","aria-hidden":!0}),i?s.jsx("span",{className:"collapsed-strip-label-expand","aria-hidden":!0,children:"›"}):null,s.jsx("span",{className:"collapsed-strip-label-text",children:n}),t!=null?s.jsx("span",{className:"collapsed-strip-label-count",children:t}):null]});return i?s.jsx("button",{type:"button",className:d,title:l??n,"aria-label":l??n,onClick:i,children:o}):s.jsx("div",{className:d,title:l??n,children:o})}function ae({label:n,emptyMark:t="·",showLabel:a=!0,labelTone:l="default",labelCount:i,onLabelClick:d,children:o}){const v=!o||Array.isArray(o)&&o.length===0,p=a?s.jsx(te,{tone:l,count:i,onClick:d,title:d?`Expand ${n}`:void 0,children:n}):null;return v?s.jsxs("div",{className:"collapsed-strip collapsed-strip--empty","aria-hidden":!0,children:[p,s.jsx("span",{className:"collapsed-strip-empty-mark",children:t})]}):s.jsxs("div",{className:"collapsed-strip",role:"list","aria-label":n,children:[p,o]})}function Ce(){return s.jsx("div",{className:"collapsed-strip-rule","aria-hidden":!0})}function ne({title:n,active:t,tone:a="default",ava:l,avaColor:i,glyph:d,avatarNode:o,dot:v,pinned:p,onClick:b}){const m=["collapsed-chip",a==="channel"&&"collapsed-chip--channel",a==="neutral"&&"collapsed-chip--neutral",a==="attention"&&"collapsed-chip--attention",a==="unread"&&"collapsed-chip--unread",t&&"collapsed-chip--active",p&&"collapsed-chip--pinned"].filter(Boolean).join(" ");return s.jsxs("button",{type:"button",role:"listitem",className:m,title:n,"aria-label":n,"aria-current":t?"page":void 0,onClick:b,children:[o?s.jsx("span",{className:"collapsed-chip-avatar-wrap",children:o}):l?s.jsx("span",{className:"collapsed-chip-ava",style:i?{"--ava-color":i}:void 0,children:l}):s.jsx("span",{className:`collapsed-chip-glyph${typeof d=="string"&&d.length>1?" collapsed-chip-glyph--long":""}`,children:d}),v?s.jsx("span",{className:["collapsed-chip-dot",v==="attention"&&"collapsed-chip-dot--attention",v==="live"&&"collapsed-chip-dot--live"].filter(Boolean).join(" "),"aria-hidden":!0}):null,p?s.jsx("span",{className:"collapsed-chip-pin","aria-hidden":!0}):null]})}function Ie(n){const t=n.trim(),a=t.split(/[\s/_-]+/).filter(Boolean);if(a.length>=2){const l=a[a.length-1];return/^\d+$/.test(l)&&a.length>=3?(a[a.length-2][0]??"?").toUpperCase():(l[0]??"?").toUpperCase()}return(t[0]??"?").toUpperCase()}const le=3,ie=3,oe=4,re=3;function y(n,t){return[...n].sort((a,l)=>{const i=C(a.lastMessageAt,a.id,t)?0:1,d=C(l.lastMessageAt,l.id,t)?0:1;return i!==d?i-d:(l.lastMessageAt??0)-(a.lastMessageAt??0)})}function ce({onExpand:n}){const{route:t,navigate:a,agents:l}=G(),{sessions:i}=Y(),d=Z(),[o,v]=j.useState(()=>O()),[p,b]=j.useState(()=>D()),m=Q(t),S=j.useMemo(()=>J(l,m),[l,m]),P=j.useMemo(()=>{const e=new Map;for(const f of l)e.set(f.id,f);return e},[l]),R=t.view==="messages"||t.view==="conversation"?t.conversationId:void 0;j.useEffect(()=>{v(O()),b(D())},[]);const r=j.useMemo(()=>{const e=K(i,S,m).filter(c=>!q(c.id,o)),f=e.filter(c=>E(c.id,o)).sort((c,x)=>T(x.id,o)-T(c.id,o)||(x.lastMessageAt??0)-(c.lastMessageAt??0)).slice(0,le),g=new Set(f.map(c=>c.id)),h=e.filter(c=>!g.has(c.id));return{pinned:f,channels:y(h.filter(w),p).slice(0,ie),dms:y(h.filter(B),p).slice(0,oe),observed:y(h.filter($),p).slice(0,re),totals:{channels:h.filter(w).length,dms:h.filter(B).length,observed:h.filter($).length,pinned:e.filter(c=>E(c.id,o)).length}}},[i,S,m,o,p]),U=e=>{b(X(e.id)),a({view:"messages",conversationId:e.id,...m?{machineId:m}:{}})},k=[...r.pinned,...r.channels,...r.dms,...r.observed],I=k.filter(e=>C(e.lastMessageAt,e.id,p)).length,M=(e,f=!1)=>{const g=W(e),h=w(e),c=C(e.lastMessageAt,e.id,p),x=h?void 0:pe(e,g),V=x??g,A=e.agentId?P.get(e.agentId):void 0,L=e.agentId?d.get(e.agentId):void 0,_=L?.status==="needs_attention",z=L?.status==="working",F=A?ee(A.state):!1,H=_?"attention":c?"unread":z||F?"live":null;return s.jsx(ne,{title:f?`${g} · pinned`:x?`${g} · ${x}`:g,active:e.id===R,tone:h?"channel":_?"attention":c?"unread":"default",avatarNode:h?void 0:s.jsx(se,{agent:A,name:V,size:28,tile:!0,presence:!1}),glyph:h?de(g):void 0,dot:H,pinned:f,onClick:()=>U(e)},e.id)},u=[];return r.pinned.length&&u.push(s.jsx(N,{mark:"Pin",count:r.totals.pinned,showMark:u.length>0,children:r.pinned.map(e=>M(e,!0))},"pin")),r.channels.length&&u.push(s.jsx(N,{mark:"#",count:r.totals.channels,showMark:u.length>0,children:r.channels.map(e=>M(e))},"ch")),r.dms.length&&u.push(s.jsx(N,{mark:"DM",count:r.totals.dms,showMark:u.length>0,children:r.dms.map(e=>M(e))},"dm")),r.observed.length&&u.push(s.jsx(N,{mark:"Obs",count:r.totals.observed,showMark:u.length>0,children:r.observed.map(e=>M(e))},"obs")),s.jsx(ae,{label:"Chat",emptyMark:"#",labelTone:I>0?"accent":"default",labelCount:I>0?I:k.length||void 0,onLabelClick:n,children:u})}function de(n){const a=n.replace(/^#+/,"").match(/[a-z0-9]/i)?.[0]?.toLowerCase()??"?";return s.jsxs("span",{className:"collapsed-chip-channel-badge",children:[s.jsx("span",{className:"collapsed-chip-channel-hash","aria-hidden":!0,children:"#"}),s.jsx("span",{className:"collapsed-chip-channel-text",children:a})]})}function pe(n,t){const a=t.toLowerCase();for(const l of n.participants??[]){const i=l.displayName||l.label;if(i&&i.toLowerCase()!==a)return i}}function N({mark:n,count:t,showMark:a=!0,children:l}){return s.jsxs("div",{className:"collapsed-strip-section",role:"group","aria-label":n,children:[a?s.jsxs("div",{className:"collapsed-strip-section-mark",title:t!=null?`${n} · ${t}`:n,children:[s.jsx("span",{className:"collapsed-strip-section-mark-text",children:n}),t!=null&&t>0?s.jsx("span",{className:"collapsed-strip-section-mark-count",children:t>99?"99+":t}):null]}):null,l]})}const Ae=Object.freeze(Object.defineProperty({__proto__:null,ChatCollapsedStrip:ce},Symbol.toStringTag,{value:"Module"}));export{ae as C,ce as a,ne as b,Ie as c,Ce as d,Ae as e};
1
+ import{j as s,r as j}from"./index-NRbRrZw-.js";import{i as $,d as B,e as w,a as W}from"./conversation-model-CIzM7aXT.js";import{l as O,i as q,a as E,p as T}from"./conversation-prefs-DNre-Lcx.js";import{u as G,m as J,d as K}from"./Provider-Cd-QZltN.js";import{d as Q}from"./router-Bx1tiwVe.js";import{l as D,i as C,s as X}from"./sessionRead-CvFz2RHv.js";import{u as Y}from"./use-conversation-list-htp0Ui63.js";import{u as Z}from"./use-fleet-active-asks-BhuTn5mV.js";import{i as ee}from"./colors-BtO5_zlx.js";import{A as se}from"./AgentAvatar-CQqJcwOQ.js";/* empty css */function te({children:n,count:t,tone:a="default",title:l,onClick:i}){const d=["collapsed-strip-label",a!=="default"&&`collapsed-strip-label--${a}`,t!=null&&"collapsed-strip-label--has-count",i&&"collapsed-strip-label--button"].filter(Boolean).join(" "),o=s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"collapsed-strip-label-mark","aria-hidden":!0}),i?s.jsx("span",{className:"collapsed-strip-label-expand","aria-hidden":!0,children:"›"}):null,s.jsx("span",{className:"collapsed-strip-label-text",children:n}),t!=null?s.jsx("span",{className:"collapsed-strip-label-count",children:t}):null]});return i?s.jsx("button",{type:"button",className:d,title:l??n,"aria-label":l??n,onClick:i,children:o}):s.jsx("div",{className:d,title:l??n,children:o})}function ae({label:n,emptyMark:t="·",showLabel:a=!0,labelTone:l="default",labelCount:i,onLabelClick:d,children:o}){const v=!o||Array.isArray(o)&&o.length===0,p=a?s.jsx(te,{tone:l,count:i,onClick:d,title:d?`Expand ${n}`:void 0,children:n}):null;return v?s.jsxs("div",{className:"collapsed-strip collapsed-strip--empty","aria-hidden":!0,children:[p,s.jsx("span",{className:"collapsed-strip-empty-mark",children:t})]}):s.jsxs("div",{className:"collapsed-strip",role:"list","aria-label":n,children:[p,o]})}function Ce(){return s.jsx("div",{className:"collapsed-strip-rule","aria-hidden":!0})}function ne({title:n,active:t,tone:a="default",ava:l,avaColor:i,glyph:d,avatarNode:o,dot:v,pinned:p,onClick:b}){const m=["collapsed-chip",a==="channel"&&"collapsed-chip--channel",a==="neutral"&&"collapsed-chip--neutral",a==="attention"&&"collapsed-chip--attention",a==="unread"&&"collapsed-chip--unread",t&&"collapsed-chip--active",p&&"collapsed-chip--pinned"].filter(Boolean).join(" ");return s.jsxs("button",{type:"button",role:"listitem",className:m,title:n,"aria-label":n,"aria-current":t?"page":void 0,onClick:b,children:[o?s.jsx("span",{className:"collapsed-chip-avatar-wrap",children:o}):l?s.jsx("span",{className:"collapsed-chip-ava",style:i?{"--ava-color":i}:void 0,children:l}):s.jsx("span",{className:`collapsed-chip-glyph${typeof d=="string"&&d.length>1?" collapsed-chip-glyph--long":""}`,children:d}),v?s.jsx("span",{className:["collapsed-chip-dot",v==="attention"&&"collapsed-chip-dot--attention",v==="live"&&"collapsed-chip-dot--live"].filter(Boolean).join(" "),"aria-hidden":!0}):null,p?s.jsx("span",{className:"collapsed-chip-pin","aria-hidden":!0}):null]})}function Ie(n){const t=n.trim(),a=t.split(/[\s/_-]+/).filter(Boolean);if(a.length>=2){const l=a[a.length-1];return/^\d+$/.test(l)&&a.length>=3?(a[a.length-2][0]??"?").toUpperCase():(l[0]??"?").toUpperCase()}return(t[0]??"?").toUpperCase()}const le=3,ie=3,oe=4,re=3;function y(n,t){return[...n].sort((a,l)=>{const i=C(a.lastMessageAt,a.id,t)?0:1,d=C(l.lastMessageAt,l.id,t)?0:1;return i!==d?i-d:(l.lastMessageAt??0)-(a.lastMessageAt??0)})}function ce({onExpand:n}){const{route:t,navigate:a,agents:l}=G(),{sessions:i}=Y(),d=Z(),[o,v]=j.useState(()=>O()),[p,b]=j.useState(()=>D()),m=Q(t),S=j.useMemo(()=>J(l,m),[l,m]),P=j.useMemo(()=>{const e=new Map;for(const f of l)e.set(f.id,f);return e},[l]),R=t.view==="messages"||t.view==="conversation"?t.conversationId:void 0;j.useEffect(()=>{v(O()),b(D())},[]);const r=j.useMemo(()=>{const e=K(i,S,m).filter(c=>!q(c.id,o)),f=e.filter(c=>E(c.id,o)).sort((c,x)=>T(x.id,o)-T(c.id,o)||(x.lastMessageAt??0)-(c.lastMessageAt??0)).slice(0,le),g=new Set(f.map(c=>c.id)),h=e.filter(c=>!g.has(c.id));return{pinned:f,channels:y(h.filter(w),p).slice(0,ie),dms:y(h.filter(B),p).slice(0,oe),observed:y(h.filter($),p).slice(0,re),totals:{channels:h.filter(w).length,dms:h.filter(B).length,observed:h.filter($).length,pinned:e.filter(c=>E(c.id,o)).length}}},[i,S,m,o,p]),U=e=>{b(X(e.id)),a({view:"messages",conversationId:e.id,...m?{machineId:m}:{}})},k=[...r.pinned,...r.channels,...r.dms,...r.observed],I=k.filter(e=>C(e.lastMessageAt,e.id,p)).length,M=(e,f=!1)=>{const g=W(e),h=w(e),c=C(e.lastMessageAt,e.id,p),x=h?void 0:pe(e,g),V=x??g,A=e.agentId?P.get(e.agentId):void 0,L=e.agentId?d.get(e.agentId):void 0,_=L?.status==="needs_attention",z=L?.status==="working",F=A?ee(A.state):!1,H=_?"attention":c?"unread":z||F?"live":null;return s.jsx(ne,{title:f?`${g} · pinned`:x?`${g} · ${x}`:g,active:e.id===R,tone:h?"channel":_?"attention":c?"unread":"default",avatarNode:h?void 0:s.jsx(se,{agent:A,name:V,size:28,tile:!0,presence:!1}),glyph:h?de(g):void 0,dot:H,pinned:f,onClick:()=>U(e)},e.id)},u=[];return r.pinned.length&&u.push(s.jsx(N,{mark:"Pin",count:r.totals.pinned,showMark:u.length>0,children:r.pinned.map(e=>M(e,!0))},"pin")),r.channels.length&&u.push(s.jsx(N,{mark:"#",count:r.totals.channels,showMark:u.length>0,children:r.channels.map(e=>M(e))},"ch")),r.dms.length&&u.push(s.jsx(N,{mark:"DM",count:r.totals.dms,showMark:u.length>0,children:r.dms.map(e=>M(e))},"dm")),r.observed.length&&u.push(s.jsx(N,{mark:"Obs",count:r.totals.observed,showMark:u.length>0,children:r.observed.map(e=>M(e))},"obs")),s.jsx(ae,{label:"Chat",emptyMark:"#",labelTone:I>0?"accent":"default",labelCount:I>0?I:k.length||void 0,onLabelClick:n,children:u})}function de(n){const a=n.replace(/^#+/,"").match(/[a-z0-9]/i)?.[0]?.toLowerCase()??"?";return s.jsxs("span",{className:"collapsed-chip-channel-badge",children:[s.jsx("span",{className:"collapsed-chip-channel-hash","aria-hidden":!0,children:"#"}),s.jsx("span",{className:"collapsed-chip-channel-text",children:a})]})}function pe(n,t){const a=t.toLowerCase();for(const l of n.participants??[]){const i=l.displayName||l.label;if(i&&i.toLowerCase()!==a)return i}}function N({mark:n,count:t,showMark:a=!0,children:l}){return s.jsxs("div",{className:"collapsed-strip-section",role:"group","aria-label":n,children:[a?s.jsxs("div",{className:"collapsed-strip-section-mark",title:t!=null?`${n} · ${t}`:n,children:[s.jsx("span",{className:"collapsed-strip-section-mark-text",children:n}),t!=null&&t>0?s.jsx("span",{className:"collapsed-strip-section-mark-count",children:t>99?"99+":t}):null]}):null,l]})}const Ae=Object.freeze(Object.defineProperty({__proto__:null,ChatCollapsedStrip:ce},Symbol.toStringTag,{value:"Module"}));export{ae as C,ce as a,ne as b,Ie as c,Ce as d,Ae as e};
@@ -1 +1 @@
1
- import{r as o,j as a}from"./index-Bli6bTLU.js";import{f as k}from"./cache-BO2Bd_LV.js";import{u as F,f as I,l as N,L as _,D}from"./usePierreRuntime-Bq6mXrgd.js";/* empty css */const R=["unstaged","staged","branch"];function L(n){if(!n.startsWith("/"))return null;const t=[];for(const e of n.split("/"))if(!(!e||e==="."))if(e===".."){if(t.length===0)return null;t.pop()}else t.push(e);return t}function A(n,t){const e=L(n),s=L(t);return!e||!s||s.length<=e.length||e.some((c,u)=>s[u]!==c)?null:s.slice(e.length).join("/")}function y(n,t){return n.files.findIndex(e=>e.newPath===t||e.oldPath===t)}function K(n,t){return n.find(e=>y(e,t)>=0)?.kind??null}const M=()=>{},T=()=>{};function O({root:n,file:t}){const e=o.useMemo(()=>A(n,t),[t,n]),[s,c]=o.useState(null),[u,d]=o.useState("loading"),[P,m]=o.useState(null),[S,h]=o.useState(null),{pierre:j,pierrePhase:v,pierreError:C,pierreTheme:b,retryPierre:E}=F(s);o.useEffect(()=>{let r=!1;if(c(null),d("loading"),m(null),h(null),!e){d("ready");return}return k(n,R,{files:[e],tier:"patch"}).then(i=>{r||(c(i.snapshot),h(K(i.snapshot.layers,e)),d("ready"))},i=>{r||(m(i instanceof Error?i.message:String(i)),d("error"))}),()=>{r=!0}},[e,n]);const f=o.useMemo(()=>e?s?.layers.filter(r=>y(r,e)>=0)??[]:[],[e,s]),l=f.find(r=>r.kind===S)??f[0]??null,p=l&&e?y(l,e):-1,g=l&&p>=0?I(l.files[p],p):null;return u==="loading"?a.jsx("div",{className:"s-code-empty",children:"Loading file changes…"}):u==="error"?a.jsx("div",{className:"s-code-empty",children:P??"Couldn’t load this file’s changes."}):!s||!l||!g?a.jsx("div",{className:"s-code-empty",children:"No tracked patch is available. The file is clean, or it is untracked and has no Git baseline yet."}):a.jsxs("div",{className:"s-code-diff",children:[f.length>1?a.jsx("div",{className:"s-code-diffLayers",role:"tablist","aria-label":"Change layer",children:f.map(r=>{const i=N(r),x=r.kind===l.kind;return a.jsxs("button",{type:"button",role:"tab","aria-selected":x,className:"s-code-diffLayer","data-selected":x||void 0,onClick:()=>h(r.kind),children:[_[r.kind],a.jsxs("span",{children:["+",i.add," −",i.del]})]},r.kind)})}):null,a.jsx(D,{layer:l,patchLayer:l,patchPhase:"ready",patchError:null,selectedFileKey:g,renderKey:s.render.renderKey,theme:b,layout:"split",pierre:j,pierrePhase:v,pierreError:C,onRetryPierre:E,onIncludeLineContext:M,onIncludeSelectionContext:T,contextActions:!1})]})}const G=Object.freeze(Object.defineProperty({__proto__:null,CodeDiffPane:O},Symbol.toStringTag,{value:"Module"}));export{O as C,G as a,A as r};
1
+ import{r as o,j as a}from"./index-NRbRrZw-.js";import{f as k}from"./cache-BO2Bd_LV.js";import{u as F,f as I,l as N,L as _,D}from"./usePierreRuntime-CVTMzChM.js";/* empty css */const R=["unstaged","staged","branch"];function L(n){if(!n.startsWith("/"))return null;const t=[];for(const e of n.split("/"))if(!(!e||e==="."))if(e===".."){if(t.length===0)return null;t.pop()}else t.push(e);return t}function A(n,t){const e=L(n),s=L(t);return!e||!s||s.length<=e.length||e.some((c,u)=>s[u]!==c)?null:s.slice(e.length).join("/")}function y(n,t){return n.files.findIndex(e=>e.newPath===t||e.oldPath===t)}function K(n,t){return n.find(e=>y(e,t)>=0)?.kind??null}const M=()=>{},T=()=>{};function O({root:n,file:t}){const e=o.useMemo(()=>A(n,t),[t,n]),[s,c]=o.useState(null),[u,d]=o.useState("loading"),[P,m]=o.useState(null),[S,h]=o.useState(null),{pierre:j,pierrePhase:v,pierreError:C,pierreTheme:b,retryPierre:E}=F(s);o.useEffect(()=>{let r=!1;if(c(null),d("loading"),m(null),h(null),!e){d("ready");return}return k(n,R,{files:[e],tier:"patch"}).then(i=>{r||(c(i.snapshot),h(K(i.snapshot.layers,e)),d("ready"))},i=>{r||(m(i instanceof Error?i.message:String(i)),d("error"))}),()=>{r=!0}},[e,n]);const f=o.useMemo(()=>e?s?.layers.filter(r=>y(r,e)>=0)??[]:[],[e,s]),l=f.find(r=>r.kind===S)??f[0]??null,p=l&&e?y(l,e):-1,g=l&&p>=0?I(l.files[p],p):null;return u==="loading"?a.jsx("div",{className:"s-code-empty",children:"Loading file changes…"}):u==="error"?a.jsx("div",{className:"s-code-empty",children:P??"Couldn’t load this file’s changes."}):!s||!l||!g?a.jsx("div",{className:"s-code-empty",children:"No tracked patch is available. The file is clean, or it is untracked and has no Git baseline yet."}):a.jsxs("div",{className:"s-code-diff",children:[f.length>1?a.jsx("div",{className:"s-code-diffLayers",role:"tablist","aria-label":"Change layer",children:f.map(r=>{const i=N(r),x=r.kind===l.kind;return a.jsxs("button",{type:"button",role:"tab","aria-selected":x,className:"s-code-diffLayer","data-selected":x||void 0,onClick:()=>h(r.kind),children:[_[r.kind],a.jsxs("span",{children:["+",i.add," −",i.del]})]},r.kind)})}):null,a.jsx(D,{layer:l,patchLayer:l,patchPhase:"ready",patchError:null,selectedFileKey:g,renderKey:s.render.renderKey,theme:b,layout:"split",pierre:j,pierrePhase:v,pierreError:C,onRetryPierre:E,onIncludeLineContext:M,onIncludeSelectionContext:T,contextActions:!1})]})}const G=Object.freeze(Object.defineProperty({__proto__:null,CodeDiffPane:O},Symbol.toStringTag,{value:"Module"}));export{O as C,G as a,A as r};