@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 s}from"./index-Bli6bTLU.js";import{A as R}from"./AgentAvatar-B1xvQ7ej.js";import{H as O}from"./HarnessMark-DGZ6o6Ct.js";import{t as P}from"./time-Dhsh_2EG.js";import{s as y}from"./project-overview-helpers-BQTc_Ous.js";import{u as H,t as T,a as B,s as C}from"./projects-inbox-C0umZMSY.js";import{A as g}from"./arrow-up-right-RBC6k8nn.js";import"./Provider-Ve8yXaWR.js";import"./provider-CX9EWecp.js";import"./router-B0YclXYg.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-D4dHTRkt.js";import"./api-DEHEgJ9m.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"./NewChatOrigin-DpHS2Wmt.js";import"./chevron-down-Da5tV19_.js";import"./search-BbgsEMXa.js";import"./chunk-HRAB3GC3-BUVYXXAp.js";import"./SpriteAvatar-DMrSssNZ.js";import"./agent-identity-DzHGhLdJ.js";import"./agents-project-model-UYiamtrU.js";import"./model-IGCUEsMy.js";function L(i,r,t){if(t.sessionId){const d=r.find(a=>a.sessionId===t.sessionId||a.conversationId===t.sessionId||a.id===t.sessionId);if(d)return{kind:"session",session:d};const o=i.find(a=>a.kind==="native"&&a.sessionId===t.sessionId)??null;if(o)return{kind:"thread",thread:o}}if(t.selectedAgentId){const d=i.find(a=>a.agentId===t.selectedAgentId)??null;if(d)return{kind:"thread",thread:d};const o=r.find(a=>!a.sessionId&&a.agentId===t.selectedAgentId)??null;if(o)return{kind:"session",session:o}}return null}function p({label:i,value:r}){return s.jsxs("span",{className:"pi-stat",children:[s.jsx("span",{className:"pi-statLabel",children:i}),s.jsx("span",{className:"pi-statValue",children:r})]})}function Ss({route:i,navigate:r}){const{model:t,nowMs:d,loading:o,error:a}=H(i);if(!i.sessionId&&!i.selectedAgentId)return null;const l=L(t.threads,t.sessions,i);if(!l)return s.jsxs("div",{className:"s-pi s-pi-aside",children:[s.jsx("header",{className:"pi-asideHead",children:s.jsxs("div",{className:"pi-asideIdent",children:[s.jsx("div",{className:"pi-asideTop",children:s.jsx("span",{className:"pi-asideName",children:o?"Resolving selection":a?"Project data unavailable":"Selection unavailable"})}),s.jsx("div",{className:"pi-asideSub",children:s.jsxs("span",{className:"pi-asideStatus","data-tone":o?"working":"recent",children:[o?s.jsx("span",{className:"pi-asidePulse","aria-hidden":!0}):null,o?"loading":"idle"]})})]})}),s.jsx("div",{className:"pi-asideBody",children:s.jsx("p",{className:"pi-asideMuted",children:a??"The selected item is not in the current project snapshot."})})]});const n=l.kind==="thread"?l.thread:null,e=l.kind==="session"?l.session:null,m=n?.agentName??e?.agentName??"Session",h=n?.harness??e?.harness??"session",I=n?.projectTitle??e?.projectTitle??i.projectSlug??"project",x=n?.branch??e?.branch??null,c=n?.working??e?.working??!1,f=n?.needs?"needs":c?"working":"recent",b=n?.needs?"your turn":c?"working":e?"selected":"idle",k=n?.work??e?.work??"No session detail available.",v=n?.lastActivityAt??e?.lastActivityAt??0,j=e?.sessionId??n?.sessionId??null,u=n?.projectRoot??e?.projectRoot??null,N=n?T(n,i):null,w=n?B(n,i):e?C(e,i):i,A=e?e.route?.view==="conversation"?"Open conversation":e.route?.view==="sessions"?"Open session":e.agentId?"Open agent":"Open project":n?.kind==="native"?"Open session":n?.conversationId?"Open conversation":"Open agent",S={view:"agents-v2",...i.projectSlug?{projectSlug:i.projectSlug}:{},...i.indexView?{indexView:i.indexView}:{},...i.machineId?{machineId:i.machineId}:{},...i.showEphemeral?{showEphemeral:!0}:{}};return s.jsxs("div",{className:"s-pi s-pi-aside",children:[s.jsxs("header",{className:"pi-asideHead",children:[s.jsx("span",{className:"pi-asideAvatar",children:s.jsx(R,{agent:{name:m,harness:h,state:c?"in_turn":null},placement:"row",size:38})}),s.jsxs("div",{className:"pi-asideIdent",children:[s.jsxs("div",{className:"pi-asideTop",children:[s.jsx("span",{className:"pi-asideName",title:m,children:m}),s.jsx("span",{className:"pi-asideHmark","aria-hidden":!0,children:s.jsx(O,{harness:h,size:13})}),s.jsxs("span",{className:"pi-asideProj",children:["/",I]})]}),s.jsxs("div",{className:"pi-asideSub",children:[x?s.jsx("span",{className:"pi-asideBranch",children:x}):null,s.jsxs("span",{className:"pi-asideStatus","data-tone":f,children:[c?s.jsx("span",{className:"pi-asidePulse","aria-hidden":!0}):null,b]})]})]})]}),s.jsxs("div",{className:"pi-asideBody",children:[s.jsx("h2",{className:"pi-asideHeadline",children:k}),s.jsxs("div",{className:"pi-asideReadouts",children:[s.jsx(p,{label:"Last active",value:v?P(v,d):"—"}),s.jsx(p,{label:e?"Session":"Conversations",value:e?"1":String(n?.sessionCount??0)}),s.jsx(p,{label:"Harness",value:h}),n?.contextPct!=null?s.jsx(p,{label:"Context",value:`${n.contextPct}%`}):null]}),e?s.jsxs("div",{className:"pi-asideSection",children:[s.jsx("div",{className:"pi-asideSectionHead",children:"Session context"}),s.jsxs("div",{className:"pi-asideLine",children:[j?s.jsxs("span",{title:j,children:["ref · ",j]}):s.jsx("span",{children:"No stable session reference yet."}),u?s.jsxs("span",{title:u,children:["root · ",y(u)]}):null,e.conversationId?s.jsxs("span",{title:e.conversationId,children:["conversation · ",e.conversationId]}):null]})]}):null,s.jsxs("div",{className:"pi-asideActions",children:[s.jsxs("button",{type:"button",className:"pi-asideBtn pi-asideBtnPrimary",onClick:()=>r(w),children:[A,s.jsx(g,{size:13,strokeWidth:2,"aria-hidden":!0})]}),N?s.jsxs("button",{type:"button",className:"pi-asideBtn",onClick:()=>r(N),children:["Observe",s.jsx(g,{size:13,strokeWidth:2,"aria-hidden":!0})]}):null,s.jsx("button",{type:"button",className:"pi-asideBtn",onClick:()=>r(S),children:"Clear"})]})]})]})}export{Ss as ProjectsThreadAside};
1
+ import{j as s}from"./index-NRbRrZw-.js";import{A as R}from"./AgentAvatar-CQqJcwOQ.js";import{H as O}from"./HarnessMark-CEzmPFHC.js";import{t as P}from"./time-Dhsh_2EG.js";import{s as y}from"./project-overview-helpers-BQTc_Ous.js";import{u as H,t as T,a as B,s as C}from"./projects-inbox-Cbfj4Hx7.js";import{A as g}from"./arrow-up-right-CilNLf4t.js";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"./api-DEHEgJ9m.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"./NewChatOrigin-CCiPg_WR.js";import"./chevron-down-Jh540uf3.js";import"./search-HmdKXdtR.js";import"./chunk-HRAB3GC3-BYQZ1LOn.js";import"./SpriteAvatar-vpHO-rXs.js";import"./agent-identity-CIMT7oV6.js";import"./agents-project-model-UYiamtrU.js";import"./model-IGCUEsMy.js";function L(i,r,t){if(t.sessionId){const d=r.find(a=>a.sessionId===t.sessionId||a.conversationId===t.sessionId||a.id===t.sessionId);if(d)return{kind:"session",session:d};const o=i.find(a=>a.kind==="native"&&a.sessionId===t.sessionId)??null;if(o)return{kind:"thread",thread:o}}if(t.selectedAgentId){const d=i.find(a=>a.agentId===t.selectedAgentId)??null;if(d)return{kind:"thread",thread:d};const o=r.find(a=>!a.sessionId&&a.agentId===t.selectedAgentId)??null;if(o)return{kind:"session",session:o}}return null}function p({label:i,value:r}){return s.jsxs("span",{className:"pi-stat",children:[s.jsx("span",{className:"pi-statLabel",children:i}),s.jsx("span",{className:"pi-statValue",children:r})]})}function Ss({route:i,navigate:r}){const{model:t,nowMs:d,loading:o,error:a}=H(i);if(!i.sessionId&&!i.selectedAgentId)return null;const l=L(t.threads,t.sessions,i);if(!l)return s.jsxs("div",{className:"s-pi s-pi-aside",children:[s.jsx("header",{className:"pi-asideHead",children:s.jsxs("div",{className:"pi-asideIdent",children:[s.jsx("div",{className:"pi-asideTop",children:s.jsx("span",{className:"pi-asideName",children:o?"Resolving selection":a?"Project data unavailable":"Selection unavailable"})}),s.jsx("div",{className:"pi-asideSub",children:s.jsxs("span",{className:"pi-asideStatus","data-tone":o?"working":"recent",children:[o?s.jsx("span",{className:"pi-asidePulse","aria-hidden":!0}):null,o?"loading":"idle"]})})]})}),s.jsx("div",{className:"pi-asideBody",children:s.jsx("p",{className:"pi-asideMuted",children:a??"The selected item is not in the current project snapshot."})})]});const n=l.kind==="thread"?l.thread:null,e=l.kind==="session"?l.session:null,m=n?.agentName??e?.agentName??"Session",h=n?.harness??e?.harness??"session",I=n?.projectTitle??e?.projectTitle??i.projectSlug??"project",x=n?.branch??e?.branch??null,c=n?.working??e?.working??!1,f=n?.needs?"needs":c?"working":"recent",b=n?.needs?"your turn":c?"working":e?"selected":"idle",k=n?.work??e?.work??"No session detail available.",v=n?.lastActivityAt??e?.lastActivityAt??0,j=e?.sessionId??n?.sessionId??null,u=n?.projectRoot??e?.projectRoot??null,N=n?T(n,i):null,w=n?B(n,i):e?C(e,i):i,A=e?e.route?.view==="conversation"?"Open conversation":e.route?.view==="sessions"?"Open session":e.agentId?"Open agent":"Open project":n?.kind==="native"?"Open session":n?.conversationId?"Open conversation":"Open agent",S={view:"agents-v2",...i.projectSlug?{projectSlug:i.projectSlug}:{},...i.indexView?{indexView:i.indexView}:{},...i.machineId?{machineId:i.machineId}:{},...i.showEphemeral?{showEphemeral:!0}:{}};return s.jsxs("div",{className:"s-pi s-pi-aside",children:[s.jsxs("header",{className:"pi-asideHead",children:[s.jsx("span",{className:"pi-asideAvatar",children:s.jsx(R,{agent:{name:m,harness:h,state:c?"in_turn":null},placement:"row",size:38})}),s.jsxs("div",{className:"pi-asideIdent",children:[s.jsxs("div",{className:"pi-asideTop",children:[s.jsx("span",{className:"pi-asideName",title:m,children:m}),s.jsx("span",{className:"pi-asideHmark","aria-hidden":!0,children:s.jsx(O,{harness:h,size:13})}),s.jsxs("span",{className:"pi-asideProj",children:["/",I]})]}),s.jsxs("div",{className:"pi-asideSub",children:[x?s.jsx("span",{className:"pi-asideBranch",children:x}):null,s.jsxs("span",{className:"pi-asideStatus","data-tone":f,children:[c?s.jsx("span",{className:"pi-asidePulse","aria-hidden":!0}):null,b]})]})]})]}),s.jsxs("div",{className:"pi-asideBody",children:[s.jsx("h2",{className:"pi-asideHeadline",children:k}),s.jsxs("div",{className:"pi-asideReadouts",children:[s.jsx(p,{label:"Last active",value:v?P(v,d):"—"}),s.jsx(p,{label:e?"Session":"Conversations",value:e?"1":String(n?.sessionCount??0)}),s.jsx(p,{label:"Harness",value:h}),n?.contextPct!=null?s.jsx(p,{label:"Context",value:`${n.contextPct}%`}):null]}),e?s.jsxs("div",{className:"pi-asideSection",children:[s.jsx("div",{className:"pi-asideSectionHead",children:"Session context"}),s.jsxs("div",{className:"pi-asideLine",children:[j?s.jsxs("span",{title:j,children:["ref · ",j]}):s.jsx("span",{children:"No stable session reference yet."}),u?s.jsxs("span",{title:u,children:["root · ",y(u)]}):null,e.conversationId?s.jsxs("span",{title:e.conversationId,children:["conversation · ",e.conversationId]}):null]})]}):null,s.jsxs("div",{className:"pi-asideActions",children:[s.jsxs("button",{type:"button",className:"pi-asideBtn pi-asideBtnPrimary",onClick:()=>r(w),children:[A,s.jsx(g,{size:13,strokeWidth:2,"aria-hidden":!0})]}),N?s.jsxs("button",{type:"button",className:"pi-asideBtn",onClick:()=>r(N),children:["Observe",s.jsx(g,{size:13,strokeWidth:2,"aria-hidden":!0})]}):null,s.jsx("button",{type:"button",className:"pi-asideBtn",onClick:()=>r(S),children:"Clear"})]})]})]})}export{Ss as ProjectsThreadAside};
@@ -1 +1 @@
1
- import{r as o,j as a,J as Oe,b as st,K as it,L as at,q as ct}from"./index-Bli6bTLU.js";import{a as Ue}from"./provider-CX9EWecp.js";import{d as lt,as as ut}from"./router-B0YclXYg.js";import{a as V}from"./api-DEHEgJ9m.js";import{u as dt}from"./sse-CSozY6mp.js";import{o as ft,i as Le}from"./surface-activity-B1rgWB1i.js";import{i as pt}from"./colors-BtO5_zlx.js";import{e as qe,s as ht,i as _e,r as mt,a as vt,f as gt}from"./scoutbot-D4vuKzOL.js";import{F as wt,a as bt,D as yt}from"./DocumentFocusViewer-DmtFisY9.js";import{c as He,T as Ve}from"./TextDocumentSurface-C7fGlzY8.js";import{C as St}from"./chevron-right-BMqtBds_.js";import{F as Ct}from"./file-text-BVhkMWyC.js";import{c as kt}from"./createLucideIcon-DLlxGjKt.js";import{C as Et}from"./code-xml-ByQsfOI_.js";import{A as xt}from"./arrow-left-i-h6JAgs.js";import{A as At}from"./arrow-right-B0Yi01Zr.js";import{d as Tt}from"./scout-voice-DvG_3stJ.js";import{i as Rt}from"./keyboard-nav-7iEtvu9P.js";import{J as It,N as Nt,E as pe,K as je,C as De}from"./NewChatComposer-Bgqes0UQ.js";import{u as Ot}from"./chunk-HRAB3GC3-BUVYXXAp.js";const $e={current:null,setMenu:null};function yr(){return o.useCallback((e,t)=>{e.preventDefault(),e.stopPropagation(),$e.setMenu?.({position:{x:e.clientX,y:e.clientY},items:t})},[])}function Lt({children:e}){const[t,n]=o.useState(null),r=o.useRef(null);$e.setMenu=n;const s=o.useCallback(()=>{n(null)},[]);return o.useEffect(()=>{if(!t)return;const i=h=>{h.target instanceof Node&&r.current?.contains(h.target)||s()},c=h=>{h.key==="Escape"&&s()},f=()=>s(),d=h=>{h.defaultPrevented||s()};return window.addEventListener("mousedown",i,!0),window.addEventListener("keydown",c),window.addEventListener("wheel",f,!0),window.addEventListener("contextmenu",d),()=>{window.removeEventListener("mousedown",i,!0),window.removeEventListener("keydown",c),window.removeEventListener("wheel",f,!0),window.removeEventListener("contextmenu",d)}},[t,s]),o.useLayoutEffect(()=>{if(!t||!r.current)return;const i=r.current,c=i.getBoundingClientRect(),f=window.innerWidth,d=window.innerHeight;let h=t.position.x,m=t.position.y;h+c.width>f-8&&(h=f-c.width-8),m+c.height>d-8&&(m=d-c.height-8),h<8&&(h=8),m<8&&(m=8),i.style.left=`${h}px`,i.style.top=`${m}px`,i.style.visibility="visible"},[t]),a.jsxs(a.Fragment,{children:[e,t&&a.jsx("div",{ref:r,className:"s-context-menu",style:{left:t.position.x,top:t.position.y,visibility:"hidden"},role:"menu",onMouseDown:i=>i.stopPropagation(),children:t.items.map((i,c)=>i.kind==="separator"?a.jsx("div",{className:"s-context-menu-sep",role:"separator"},c):a.jsxs("button",{type:"button",className:"s-context-menu-item",role:"menuitem",onClick:()=>{i.onSelect(),s()},children:[a.jsx("span",{className:"s-context-menu-label",children:i.label}),i.shortcut&&a.jsx("span",{className:"s-context-menu-shortcut",children:i.shortcut})]},c))})]})}function _t(e){const t=e instanceof Error?e.message:String(e);return Dt(t)?"Scout server is unreachable":t}function jt(e){return e==="Scout server is unreachable"}function Dt(e){return/failed to fetch|fetch failed|networkerror|load failed|couldn'?t connect|could not connect|connection refused|econnrefused|server is unreachable/i.test(e)}const be="openscout.operator.name",Pt=new Set(["operator","you","user","unknown","null","undefined"]);function Je(e){const t=e?.trim();return!t||t.length>64||Pt.has(t.toLowerCase())?null:t}function Mt(){if(typeof window>"u")return null;try{return Je(window.localStorage.getItem(be))}catch{return null}}function Ft(e){if(!(typeof window>"u"))try{const t=Je(e);t?window.localStorage.setItem(be,t):window.localStorage.removeItem(be)}catch{}}const Bt=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ut=kt("chevron-up",Bt),qt={id:"audio",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("audio/"),render:({resource:e})=>{const t=e;return a.jsx("div",{className:"s-file-preview-media-wrap",children:a.jsx("div",{className:"s-file-preview-audio-stage",children:a.jsx("audio",{className:"s-file-preview-audio",src:t.rawUrl,controls:!0})})})}},Ht={id:"binary",canHandle:()=>!0,render:({resource:e})=>{const t=e;return a.jsxs("div",{className:"s-file-preview-callout",children:[a.jsxs("div",{className:"s-file-preview-callout-title",children:[t.previewReason," — open in OS"]}),a.jsxs("div",{className:"s-file-preview-callout-copy",children:["Scout can resolve this file, but it does not have an inline preview for ",t.mediaType," yet."]})]})}},Vt=new Set(["text/typescript","text/javascript","text/css","text/html","application/json","text/yaml","text/toml","text/x-shellscript","text/plain"]),$t={id:"code",canHandle:e=>e.kind==="file"&&e.previewable&&Vt.has(e.mediaType),render:({resource:e})=>{const t=e,n=He({id:t.realPath,title:t.title,uri:t.realPath,mediaType:t.mediaType,value:t.content,filename:t.title,kind:"code",readOnly:!0});return a.jsx(Ve,{document:n,mode:"read",className:"s-doc-focus-document"})}},Jt={id:"directory",canHandle:e=>e.kind==="directory",render:({resource:e,openFilePreview:t})=>{const n=e,r=Kt(n.realPath,n.rootPath);return a.jsxs("div",{className:"s-file-preview-directory",children:[a.jsx("div",{className:"s-file-preview-breadcrumb","aria-label":"Directory breadcrumb",children:r.map((s,i)=>{const c=i===r.length-1;return a.jsxs("div",{className:"s-file-preview-breadcrumb-item",children:[i>0&&a.jsx(St,{size:12,"aria-hidden":"true"}),c?a.jsx("span",{className:"s-file-preview-breadcrumb-current",children:s.label}):a.jsx("button",{type:"button",className:"s-file-preview-breadcrumb-link",onClick:()=>t(s.path),children:s.label})]},s.path)})}),a.jsxs("div",{className:"s-file-preview-directory-list",role:"list",children:[n.entries.map(s=>a.jsxs("button",{type:"button",className:"s-file-preview-entry",onClick:()=>t(s.path),children:[a.jsx("span",{className:"s-file-preview-entry-icon","aria-hidden":"true",children:s.kind==="directory"?a.jsx(wt,{size:14}):a.jsx(Ct,{size:14})}),a.jsx("span",{className:"s-file-preview-entry-name",children:s.name}),a.jsx("span",{className:"s-file-preview-entry-kind",children:s.kind==="directory"?"dir":"file"})]},s.realPath)),n.entries.length===0&&a.jsx("div",{className:"s-file-preview-directory-empty",children:"This directory is empty."})]})]})}};function Kt(e,t){const n=t==="/"?"/":t.replace(/\/+$/u,""),r=e==="/"?"/":e.replace(/\/+$/u,""),s=n.split("/").filter(Boolean),i=r.split("/").filter(Boolean),c=[{label:s[s.length-1]??"/",path:n||"/"}];let f=n||"/";for(let d=s.length;d<i.length;d+=1){const h=i[d];h&&(f=f==="/"?`/${h}`:`${f}/${h}`,c.push({label:h,path:f}))}return c}const zt={id:"html",canHandle:e=>e.kind==="file"&&e.previewable&&e.mediaType==="text/html",render:({resource:e})=>a.jsx("div",{className:"s-file-preview-html-wrap",children:a.jsx("iframe",{className:"s-file-preview-html-frame",src:e.kind==="file"?e.rawUrl:"",title:e.title,sandbox:"allow-forms allow-popups allow-popups-to-escape-sandbox allow-scripts",referrerPolicy:"no-referrer"})})},Wt={id:"image",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("image/"),render:({resource:e})=>a.jsx("div",{className:"s-file-preview-image-wrap",children:a.jsx("div",{className:"s-file-preview-image-stage",children:a.jsx("img",{className:"s-file-preview-image",src:e.kind==="file"?e.rawUrl:"",alt:e.title})})})},Gt={id:"markdown",canHandle:e=>e.kind==="file"&&e.previewable&&e.mediaType==="text/markdown",render:({resource:e})=>{const t=e,n=He({id:t.realPath,title:t.title,uri:t.realPath,mediaType:t.mediaType,value:t.content,filename:t.title,kind:"markdown",readOnly:!0});return a.jsx(Ve,{document:n,mode:"preview",className:"s-doc-focus-document"})}},Qt={id:"video",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("video/"),render:({resource:e})=>{const t=e;return a.jsx("div",{className:"s-file-preview-media-wrap",children:a.jsx("div",{className:"s-file-preview-media-stage",children:a.jsx("video",{className:"s-file-preview-video",src:t.rawUrl,controls:!0})})})}},Yt=[Jt,Gt,zt,$t,Wt,Qt,qt,Ht];function Xt({path:e,onOpenPath:t,onOpenInCode:n,onClose:r}){const[s,i]=o.useState(null),[c,f]=o.useState(null),[d,h]=o.useState(!1),[m,R]=o.useState(null),j=o.useRef(null);o.useEffect(()=>{j.current=m},[m]),o.useEffect(()=>{if(!e){i(null),f(null),h(!1);return}let p=!1;return h(!0),f(null),i(null),V(`/api/file/preview?path=${encodeURIComponent(e)}`).then(v=>{p||(i(v),Zt(v,j.current,R))}).catch(v=>{p||f(v instanceof Error?v.message:"could not load file")}).finally(()=>{p||h(!1)}),()=>{p=!0}},[e]);const{currentIndex:L,prevPath:u,nextPath:w}=o.useMemo(()=>{if(!s||s.kind!=="file"||!m)return{currentIndex:-1,prevPath:null,nextPath:null};const p=m.files.findIndex(v=>v.realPath===s.realPath);return p<0?{currentIndex:-1,prevPath:null,nextPath:null}:{currentIndex:p,prevPath:p>0?m.files[p-1].path:null,nextPath:p<m.files.length-1?m.files[p+1].path:null}},[s,m]);if(o.useEffect(()=>{if(!e)return;const p=v=>{if(v.key==="Escape"){r();return}if(v.target instanceof HTMLElement){const S=v.target.tagName;if(S==="INPUT"||S==="TEXTAREA"||v.target.isContentEditable)return}v.metaKey||v.ctrlKey||v.altKey||(v.key==="ArrowLeft"&&u?(v.preventDefault(),t(u)):v.key==="ArrowRight"&&w?(v.preventDefault(),t(w)):v.key==="Backspace"&&m&&s?.kind==="file"&&(v.preventDefault(),t(m.dirPath)))};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[e,r,t,u,w,m,s]),!e)return null;const C=()=>{V("/api/file/reveal",{method:"POST",body:JSON.stringify({path:s?.realPath??e})}).catch(p=>{f(p instanceof Error?p.message:"reveal failed")})},N=s?Yt.find(p=>p.canHandle(s))??null:null,k=!!(s&&s.kind==="file"&&m&&L>=0&&m.files.length>1),A=[];k&&m&&A.push({label:`Folder: ${m.dirTitle}`,icon:a.jsx(Ut,{size:12}),onClick:()=>t(m.dirPath),title:`Back to ${m.dirTitle} (Backspace)`}),A.push({label:"Open in Code",icon:a.jsx(Et,{size:12}),onClick:()=>{s?.kind==="file"&&n(s.realPath,s.rootPath)},title:"Continue with this file in Scout’s Code browser",disabled:s?.kind!=="file"}),A.push({label:"Show in folder",icon:a.jsx(bt,{size:12}),onClick:C,title:"Show this file in its operating system folder",hideLabel:!0});const D=s?tn(s):[];k&&D.unshift(`${L+1} / ${m.files.length}`);const I=s&&N?N.render({resource:s,openFilePreview:t}):null;return a.jsx(yt,{open:!0,kind:en(s),document:null,title:s?.title??e.split("/").pop()??"File",eyebrow:"File preview",subtitle:s?.realPath??e,meta:D,state:d?"Loading…":null,error:c,body:I?a.jsxs("div",{className:`s-file-preview-shell${k?" s-file-preview-shell-nav":""}`,children:[k&&a.jsx("button",{type:"button",className:"s-file-preview-side-nav s-file-preview-side-nav-left",onClick:()=>u&&t(u),disabled:!u,"aria-label":"Previous file",title:"Previous file (←)",children:a.jsx(xt,{size:18,strokeWidth:1.8,"aria-hidden":"true"})}),a.jsx("div",{className:"s-file-preview-shell-body",children:I}),k&&a.jsx("button",{type:"button",className:"s-file-preview-side-nav s-file-preview-side-nav-right",onClick:()=>w&&t(w),disabled:!w,"aria-label":"Next file",title:"Next file (→)",children:a.jsx(At,{size:18,strokeWidth:1.8,"aria-hidden":"true"})})]}):null,actions:A,onClose:r})}function Zt(e,t,n){if(e.kind==="directory"){const s=e.entries.filter(i=>i.kind==="file");n({dirPath:e.path,dirTitle:e.title,files:s});return}if(!t){n(null);return}t.files.some(s=>s.realPath===e.realPath)||n(null)}function en(e){return!e||e.kind==="directory"||e.mediaType==="text/markdown"||e.mediaType==="text/plain"?"doc":"code"}function tn(e){return e.kind==="directory"?[`${e.entries.length} ${e.entries.length===1?"entry":"entries"}`]:[...e.previewable&&e.truncated?["truncated"]:[],nn(e.sizeBytes),e.mediaType]}function nn(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const Ke={activity:"idle",brief:{lastDeliveredAt:null},reminders:{dueCount:0,upcomingCount:0,due:[],next:null},voice:{available:null,setupBlocked:!1,replies:!1},error:null,session:{title:null,lastActivityAt:null},conversation:{messageCount:0,loading:!0}},G=()=>{},ze={focusScoutbot:G,triggerBrief:G,triggerAskState:G,toggleVoiceReplies:G,openScoutbotSettings:G,startNewChat:G,dismissReminder:G,askReminderStatus:G},ye=o.createContext(null);function rn({children:e}){const[t,n]=o.useState(Ke),r=o.useRef(ze),s=o.useCallback(d=>{n(h=>on(h,d)?h:d)},[]),i=o.useCallback(d=>{r.current=d},[]),c=o.useMemo(()=>({focusScoutbot:()=>r.current.focusScoutbot(),triggerBrief:()=>r.current.triggerBrief(),triggerAskState:()=>r.current.triggerAskState(),toggleVoiceReplies:()=>r.current.toggleVoiceReplies(),openScoutbotSettings:()=>r.current.openScoutbotSettings(),startNewChat:()=>r.current.startNewChat(),dismissReminder:d=>r.current.dismissReminder(d),askReminderStatus:d=>r.current.askReminderStatus(d)}),[]),f=o.useMemo(()=>({state:t,actions:c,publishState:s,registerActions:i}),[t,c,s,i]);return a.jsx(ye.Provider,{value:f,children:e})}function Sr(){const e=o.useContext(ye);return e?{state:e.state,actions:e.actions}:{state:Ke,actions:ze}}function Cr(){const e=o.useContext(ye);return e?{publishState:e.publishState,registerActions:e.registerActions}:null}function on(e,t){return e.activity===t.activity&&e.brief.lastDeliveredAt===t.brief.lastDeliveredAt&&e.reminders.dueCount===t.reminders.dueCount&&e.reminders.upcomingCount===t.reminders.upcomingCount&&sn(e.reminders.due,t.reminders.due)&&We(e.reminders.next,t.reminders.next)&&e.voice.available===t.voice.available&&e.voice.setupBlocked===t.voice.setupBlocked&&e.voice.replies===t.voice.replies&&e.error===t.error&&e.session.title===t.session.title&&e.session.lastActivityAt===t.session.lastActivityAt&&e.conversation.messageCount===t.conversation.messageCount&&e.conversation.loading===t.conversation.loading}function sn(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!We(e[n],t[n]))return!1;return!0}function We(e,t){return e===t?!0:!e||!t?!1:e.id===t.id&&e.body===t.body&&e.status===t.status&&e.dueAt===t.dueAt}const an="/api/voice/realtime/call",Ge="/api/voice/realtime/lease",cn="x-openscout-realtime-voice-lease",Qe="surface.realtime-voice",kr="scout:realtime-voice-stop",ln={noise_reduction:{type:"far_field"},turn_detection:{type:"server_vad",threshold:.6,prefix_padding_ms:300,silence_duration_ms:500,create_response:!0,interrupt_response:!0}},un={noise_reduction:{type:"near_field"},turn_detection:{type:"server_vad",threshold:.5,prefix_padding_ms:300,silence_duration_ms:500,create_response:!0,interrupt_response:!0}},dn="/api/scoutbot/chat",fn=25e3;async function pn(e={}){if(ie(e.signal),!globalThis.RTCPeerConnection||!navigator.mediaDevices?.getUserMedia)throw new Error("This browser does not support realtime audio calls.");e.onState?.("connecting");const t=new RTCPeerConnection,n=new Audio;n.autoplay=!0;let r=!1,s=null,i=null,c=null,f=0,d=0;const h=(u,w,C="voice")=>{d+=1,e.onTrace?.({id:`voice-${d}`,at:Date.now(),kind:C,label:u,...w?{detail:w}:{}})};let m=null;const R=()=>{if(m)return m;r=!0,e.signal?.removeEventListener("abort",L),c&&clearInterval(c),c=null,s?.getTracks().forEach(w=>w.stop()),n.pause(),n.srcObject=null,t.close();const u=i;return i=null,m=(async()=>{u&&await En(u),e.onState?.("ended")})(),m},j=()=>{R().catch(u=>{e.onError?.(u instanceof Error?u.message:"Could not release the realtime voice lease."),e.onState?.("error")})},L=()=>{j()};e.signal?.addEventListener("abort",L,{once:!0}),t.ontrack=({streams:u})=>{const w=u[0];if(!w||r)return;const[C]=w.getAudioTracks();C&&C.addEventListener("ended",()=>{r||e.onError?.("Realtime voice audio ended unexpectedly.")}),n.srcObject=w,n.play().catch(()=>{e.onError?.("Browser playback was blocked. Interact with the page, then start the call again.")})},t.onconnectionstatechange=()=>{r||(t.connectionState==="connected"?(e.onState?.("live"),h("Realtime channel connected","Scoutbot bridge is ready")):(t.connectionState==="failed"||t.connectionState==="disconnected")&&(e.onError?.("Realtime voice connection ended unexpectedly."),j()))};try{s=await Cn(e.inputDeviceName,e.signal),ie(e.signal);for(const g of s.getTracks())t.addTrack(g,s);const u=t.createDataChannel("oai-events"),w=new Set;let C=Promise.resolve(),N=!1,k=null;const A=[],D=g=>{if(r||u.readyState!=="open")return!1;try{return u.send(JSON.stringify(g)),!0}catch{return e.onError?.("Realtime voice events channel closed unexpectedly."),!1}},I=()=>{if(N||k||A.length===0)return;const g=A.shift();if(g){if(k=g,!D({type:"response.create",response:{instructions:g}})){k=null,A.unshift(g);return}N=!0}},p=g=>{A.push(g),I()};u.addEventListener("open",()=>{if(r)return;const g=Sn(e.inputDeviceName);if(!D({type:"session.update",session:{type:"realtime",audio:{input:g}}})){e.onError?.("Could not configure Scout's realtime microphone processing.");return}h("Scoutbot bridge ready","Live fleet context is available"),p("Open with one brief audible greeting: 'Hi, I’m Scoutbot. I can check the fleet and coordinate through Scout. What would you like to work on?'")}),u.addEventListener("error",()=>{r||e.onError?.("Realtime voice events channel closed unexpectedly.")}),u.addEventListener("message",g=>{const O=mn(g.data);if(O?.type==="error"){if(Ye(O.message)){k&&(A.unshift(k),k=null),N=!0,h("Scoutbot reply queued","Waiting for the current spoken response to finish","scoutbot");return}e.onError?.(O.message??"OpenAI Realtime reported an error.");return}if(O?.type==="response.created"){N=!0,k=null;return}if(O?.type==="response.done"){N=!1,k=null;for(const _ of vn(O))_.name!=="ask_scoutbot"||w.has(_.callId)||(w.add(_.callId),C=C.then(()=>hn({functionCall:_,route:e.getRoute?.()??e.route,uiContext:e.getUiContext?.(),onReply:e.onScoutbotReply,onTrace:h,send:D,requestResponse:p})).catch($=>{e.onError?.($ instanceof Error?$.message:"Scoutbot could not complete the voice request.")}));I()}});const v=await he(t.createOffer(),e.signal);if(await he(t.setLocalDescription(v),e.signal),!v.sdp)throw new Error("Could not create a WebRTC offer.");const S=await fetch(an,{method:"POST",headers:{"content-type":"application/sdp"},body:v.sdp,signal:e.signal});i=S.headers.get(cn)?.trim()||null;const y=await he(S.text(),e.signal);if(!S.ok)throw new Error(bn(y,S.status));if(!i)throw new Error("Scout started the audio connection without a concurrency lease. Please try again.");return c=setInterval(()=>{if(!i||r)return;const g=i;kn(g).then(O=>{if(!(r||g!==i)){if(O){f=0;return}e.onError?.("Realtime voice lost its server lease. Reconnect to continue safely."),j()}}).catch(()=>{f+=1,!(f<2||r)&&(e.onError?.("Realtime voice could not renew its server lease. Check the connection and try again."),j())})},fn),await he(t.setRemoteDescription({type:"answer",sdp:y}),e.signal),ie(e.signal),{leaseId:i,stop:R}}catch(u){throw await R(),u}}async function hn(e){const t=gn(e.functionCall.arguments);if(!t){e.onTrace("Scoutbot request could not be read",void 0,"error"),ge(e,{ok:!1,error:"The voice request did not include a usable Scoutbot prompt."});return}e.onTrace("Scoutbot is checking the control plane",t,"scoutbot");try{const n=await fetch(dn,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({body:t,route:e.route,uiContext:e.uiContext})}),r=await n.text();if(!n.ok)throw new Error(wn(r,n.status));const s=JSON.parse(r),i=typeof s.reply?.body=="string"?s.reply.body.trim():"";if(!i)throw new Error("Scoutbot returned an empty reply.");const c=qe(i).filter(h=>h.type==="ask-agent").length,f=e.onReply?await e.onReply(i):{agentRequests:{requested:c,sent:0,failed:c}},d=ht(i);e.onTrace("Scoutbot reply ready",void 0,"scoutbot"),ge(e,{ok:!0,reply:d,...f.agentRequests.requested>0?{agentRequests:f.agentRequests}:{}})}catch(n){const r=n instanceof Error?n.message:"Scoutbot could not complete the voice request.";e.onTrace("Scoutbot request failed",r,"error"),ge(e,{ok:!1,error:r})}}function ge(e,t){if(!e.send({type:"conversation.item.create",item:{type:"function_call_output",call_id:e.functionCall.callId,output:JSON.stringify(t)}}))return;const r=t.agentRequests;e.requestResponse(t.ok?r&&r.requested>0?r.failed>0?"Answer using the Scoutbot result. Say clearly that Scoutbot tried to send the agent request automatically but delivery failed, and tell the operator to check the activity log. Be concise and do not mention tools, JSON, fences, or implementation details.":"Answer using the Scoutbot result. Say clearly that the agent request was sent automatically. Do not claim the requested work is complete. Be concise and do not mention tools, JSON, fences, or implementation details.":"Answer using the Scoutbot result. Speak the useful answer naturally and concisely. Do not mention tools, JSON, fences, or implementation details.":"Briefly tell the operator that Scoutbot could not complete the live lookup and state the returned error plainly.")}function Ye(e){const t=e?.toLowerCase()??"";return t.includes("active response in progress")||t.includes("conversation already has an active response")||t.includes("response is already in progress")}function mn(e){if(typeof e!="string")return null;try{const t=JSON.parse(e);return{...typeof t.type=="string"?{type:t.type}:{},...typeof t.error?.message=="string"?{message:t.error.message}:{},...t.response&&typeof t.response=="object"?{response:t.response}:{}}}catch{return null}}function vn(e){return Array.isArray(e.response?.output)?e.response.output.flatMap(t=>{if(!t||typeof t!="object")return[];const n=t;return n.type!=="function_call"||typeof n.call_id!="string"||typeof n.name!="string"||typeof n.arguments!="string"?[]:[{callId:n.call_id,name:n.name,arguments:n.arguments}]}):[]}function gn(e){try{const t=JSON.parse(e);if(typeof t.request!="string")return null;const n=t.request.trim();return n?n.slice(0,8e3):null}catch{return null}}function wn(e,t){try{const n=JSON.parse(e);if(typeof n.error=="string"&&n.error.trim())return n.error}catch{}return`Scoutbot could not complete the live lookup (HTTP ${t}).`}function bn(e,t){try{const n=JSON.parse(e);if(typeof n.error=="string"&&n.error.trim())return n.error}catch{}return`Could not start realtime voice (HTTP ${t}).`}async function he(e,t){return t?(ie(t),new Promise((n,r)=>{const s=()=>r(Se(t));t.addEventListener("abort",s,{once:!0}),e.then(i=>{t.removeEventListener("abort",s),n(i)},i=>{t.removeEventListener("abort",s),r(i)})})):e}async function Pe(e,t){return t?(ie(t),new Promise((n,r)=>{let s=!1;const i=()=>{s=!0,r(Se(t))};t.addEventListener("abort",i,{once:!0}),e.then(c=>{if(t.removeEventListener("abort",i),s||t.aborted){c.getTracks().forEach(f=>f.stop());return}n(c)},c=>{t.removeEventListener("abort",i),s||r(c)})})):e}const Me={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1},yn=/\b(?:airpods?|earbuds?|earphones?|headsets?|headphones?|buds?|hands[- ]?free)\b/iu;function Sn(e){return yn.test(e?.trim()??"")?un:ln}async function Cn(e,t){const n=await Fe(e);let r=await Pe(navigator.mediaDevices.getUserMedia({audio:{...Me,...n?{deviceId:{exact:n.deviceId}}:{}}}),t);if(!n&&e?.trim()){const s=await Fe(e),i=r.getAudioTracks?.()[0]?.label?.trim().toLocaleLowerCase()??"";if(s&&s.label.trim().toLocaleLowerCase()!==i)try{const c=await Pe(navigator.mediaDevices.getUserMedia({audio:{...Me,deviceId:{exact:s.deviceId}}}),t);r.getTracks().forEach(f=>f.stop()),r=c}catch(c){if(t?.aborted)throw r.getTracks().forEach(f=>f.stop()),c}}for(const s of r.getAudioTracks?.()??[])s.contentHint="speech";return r}async function Fe(e){const t=e?.trim().toLocaleLowerCase();if(!t||typeof navigator.mediaDevices.enumerateDevices!="function")return null;try{const n=(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="audioinput"&&r.deviceId&&r.label.trim());return n.find(r=>r.label.trim().toLocaleLowerCase()===t)??n.find(r=>{const s=r.label.trim().toLocaleLowerCase();return s.includes(t)||t.includes(s)})??null}catch{return null}}function ie(e){if(e?.aborted)throw Se(e)}function Se(e){return e.reason instanceof Error?e.reason:new DOMException("Realtime voice connection was cancelled.","AbortError")}async function kn(e){return(await fetch(`${Ge}/${encodeURIComponent(e)}`,{method:"PUT"})).ok}async function En(e){const t=await fetch(`${Ge}/${encodeURIComponent(e)}`,{method:"DELETE",keepalive:!0});if(!t.ok&&t.status!==404)throw new Error(`Could not release realtime voice lease (HTTP ${t.status}).`)}const xn=[{id:"home",label:"Home",description:"Fleet overview, briefings, and recent activity.",route:{view:"inbox"}},{id:"projects",label:"Projects",description:"Projects, agents, and project-scoped work.",route:{view:"agents-v2"},deepActions:["Open a project by projectSlug.","Open an agent by agentId."]},{id:"sessions",label:"Sessions",description:"Active and recent harness sessions.",route:{view:"sessions"},deepActions:["Open a session by sessionId."]},{id:"messages",label:"Messages",description:"Direct conversations and channels.",route:{view:"messages"},deepActions:["Open a conversation by conversationId.","Filter by all, direct messages, or channels."]},{id:"dispatch",label:"Dispatch",description:"Requests, flights, work, and delivery state.",route:{view:"broker"}},{id:"search",label:"Search",description:"Knowledge and indexed workspace search.",route:{view:"search"}},{id:"operations",label:"Operations",description:"Mission Control, live activity, agent lanes, runtime, and mesh health.",route:{view:"ops",mode:"mission"}},{id:"repositories",label:"Repositories",description:"Repository and worktree status, including diffs.",route:{view:"repos"},deepActions:["Open a repository by absolute root."]},{id:"code-browser",label:"Code Browser",description:"Read files in a project or worktree.",route:{view:"code"},deepActions:["Select a project with the project field; it accepts the displayed project name or slug.","Open a file inside it with path and optional wt.","Alternatively use absolute root and file fields.","Focus a line with line and optional endLine.","Deep links: scout://{project}/{path}, scout:///{absolute/path}, or legacy scout://code/{project}/{path}."]},{id:"terminals",label:"Terminals",description:"Observe or take over terminal sessions.",route:{view:"terminal"}},{id:"settings",label:"Settings",description:"Connections, agents, communications, credentials, voice, and devices.",route:{view:"settings"}}],An=[{id:"comms",label:"Comms",description:"Native conversations and channels.",route:{view:"messages"},deepActions:["Open a conversation by conversationId.","Open a channel by channelId."]},{id:"projects",label:"Projects",description:"Native project and agent browser.",route:{view:"agents-v2"},deepActions:["Filter to a project by projectSlug.","Select an agent by agentId."]},{id:"terminals",label:"Terminals",description:"Native terminal workspace.",route:{view:"terminal"},deepActions:["Select an agent terminal by agentId."]},{id:"tail",label:"Tail",description:"Live agent and harness activity.",route:{view:"ops",mode:"tail"}},{id:"dispatch",label:"Dispatch",description:"Dispatch and coordination overview.",route:{view:"broker"}},{id:"agent-lanes",label:"Agent Lanes",description:"Native lane overview for active agents.",route:{view:"ops",mode:"lanes"}},{id:"repositories",label:"Repositories",description:"Native repository and worktree status.",route:{view:"repos"}},{id:"code-browser",label:"Code Browser",description:"Embedded read-only project browser.",route:{view:"code"},deepActions:["Select a project with the project field; it accepts the displayed project name or slug.","Open a file inside it with path and optional wt.","Alternatively use absolute root and file fields.","Focus a line with line and optional endLine.","Deep links: scout://{project}/{path}, scout:///{absolute/path}, or legacy scout://code/{project}/{path}."]},{id:"settings",label:"Settings",description:"Native app settings; Voice is directly addressable.",route:{view:"settings"},deepActions:["Open Voice settings with section=voice."]}];function Tn(e){const t=e==="macos";return{host:e,shellLabel:t?"Scout for macOS":"OpenScout web",destinations:t?An:xn,rules:["When asked what navigation is available, list only these human labels and short descriptions.","Never expose internal Route.view names, aliases, URL fragments, or implementation vocabulary in the human reply.","Emit only a destination route or deep action explicitly described by this host context.","If the requested destination or deep action is absent, say it is not available in this app instead of approximating it with another page."]}}const Rn="scout:scoutbot-realtime-reply",me="scout:scoutbot-session-changed",In={enabled:!1,open:!1,state:"idle",leaseId:null,error:null,trace:[],chatState:null,sessionAction:null,setOpen:()=>{},startCall:async()=>{},endCall:async()=>!0,startNewChat:async()=>{},switchChat:async()=>{},updatePreferredModel:async e=>e,clearTrace:()=>{},openVoiceSettings:()=>{}},Xe=o.createContext(In);function Nn({children:e}){const{route:t,applyScoutbotUiAction:n}=et(),r=Ue(Qe,!1),[s,i]=o.useState(!1),[c,f]=o.useState("idle"),[d,h]=o.useState(null),[m,R]=o.useState(null),[j,L]=o.useState([]),[u,w]=o.useState(null),[C,N]=o.useState(null),k=o.useRef(null),A=o.useRef(null),D=o.useRef(null),I=o.useRef(0),p=o.useRef(!1),v=o.useRef(!1),S=o.useRef({route:t,applyScoutbotUiAction:n});S.current={route:t,applyScoutbotUiAction:n};const y=o.useCallback((b,E,T="voice")=>{L(P=>[...P,{id:`voice-ui-${Date.now()}-${P.length}`,at:Date.now(),kind:T,label:b,...E?{detail:E}:{}}].slice(-100))},[]),g=o.useCallback(()=>L([]),[]),O=o.useCallback(async()=>{const b=await V("/api/scoutbot/session");return p.current||w(b),b},[]);o.useEffect(()=>{if(!r)return;const b=()=>{O().catch(E=>{p.current||R(E instanceof Error?E.message:"Could not load Scoutbot chats.")})};return b(),window.addEventListener(me,b),()=>window.removeEventListener(me,b)},[r,O]);const _=o.useCallback(async()=>{I.current+=1;const b=D.current;A.current?.abort(),A.current=null;const E=k.current;k.current=null;try{await E?.stop(),await b}catch(T){return p.current||(f("error"),R(T instanceof Error?T.message:"Could not end realtime voice cleanly.")),!1}return p.current||(h(null),f("ended"),y("Live voice ended","Microphone and host lease released","voice")),!0},[y]);o.useEffect(()=>{r||(i(!1),(k.current||c==="connecting"||c==="live")&&_())},[r,_,c]),o.useEffect(()=>(p.current=!1,()=>{p.current=!0,I.current+=1,A.current?.abort(),A.current=null,k.current?.stop().catch(()=>{}),k.current=null}),[]);const $=o.useCallback(async b=>{window.dispatchEvent(new CustomEvent(Rn,{detail:{body:b}}));const E=b.replace(/```[\s\S]*?```/gu,"").trim();E&&y("Scoutbot replied",E.slice(0,2e3),"scoutbot");let T=0,P=0,z=0;for(const B of qe(b))if(B.type==="ask-agent")T+=1,await jn(B,y,R)?P+=1:z+=1;else if(B.type!=="reminder"){const M=_n(B),q=B.type==="navigate"||B.type==="view-file"?"navigation":"scoutbot";y(Ln(B),M,q),S.current.applyScoutbotUiAction(B),y(_e()?"Action sent to Scout for macOS":"Action applied in OpenScout",M,q)}return await O().catch(()=>null),{agentRequests:{requested:T,sent:P,failed:z}}},[y,O]),Z=o.useCallback(()=>{const b={type:"navigate",route:{view:"settings",section:"voice"}};y("Voice settings requested",void 0,"navigation"),S.current.applyScoutbotUiAction(b)},[y]),ee=o.useCallback(async()=>{if(!r){R("Turn on live voice in Settings → Voice before starting a call."),i(!1);return}if(v.current||c==="connecting"||c==="live")return;v.current=!0,A.current?.abort();const b=k.current;k.current=null;try{await b?.stop(),h(null)}catch(M){f("error"),R(M instanceof Error?M.message:"Could not end the previous realtime voice call."),v.current=!1;return}const E=new AbortController;A.current=E;const T=I.current+1;I.current=T;let P=()=>{};const z=new Promise(M=>{P=M});D.current=z;let B=!1;R(null),L([{id:"connecting",at:Date.now(),label:"Connecting secure audio"}]),f("connecting");try{const M=await Tt().then(({settings:U})=>U.inputDeviceName).catch(()=>null),q=await pn({signal:E.signal,inputDeviceName:M,getRoute:()=>S.current.route,getUiContext:()=>Tn(_e()?"macos":"web"),onState:U=>{!p.current&&I.current===T&&f(U)},onError:U=>{if(!(p.current||I.current!==T)){if(Ye(U)){y("Scoutbot reply queued","Waiting for the current spoken response to finish","scoutbot");return}R(U),y("Voice issue",U,"error")}},onTrace:U=>{!p.current&&I.current===T&&L(J=>[...J,U].slice(-100))},onScoutbotReply:U=>!p.current&&I.current===T?$(U):{agentRequests:{requested:0,sent:0,failed:0}}});if(p.current||E.signal.aborted||I.current!==T){await q.stop();return}k.current=q,h(q.leaseId),B=!0}catch(M){if(!p.current&&I.current===T&&!On(M)){f("error");const q=M instanceof Error?M.message:"Could not start realtime voice.";R(q),y("Live voice could not start",q,"error")}}finally{!B&&A.current===E&&(A.current=null),P(),D.current===z&&(D.current=null),v.current=!1}},[y,$,r,c]),te=o.useCallback(async()=>{if(!C){N("new"),R(null);try{if((k.current||c==="connecting"||c==="live")&&!await _())return;if(u?.session.messages.length===0){L([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"New live chat ready"}]);return}const b=await V("/api/scoutbot/session/reset",{method:"POST"});w(b),L([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"New live chat ready"}]),window.dispatchEvent(new CustomEvent(me,{detail:{id:b.session.id}}))}catch(b){const E=b instanceof Error?b.message:"Could not start a new Scoutbot chat.";R(E),y("Could not start a new live chat",E,"error")}finally{N(null)}}},[y,u?.session.messages.length,_,C,c]),ne=o.useCallback(async b=>{if(!(!b||C||b===u?.session.id)){N(b),R(null);try{if((k.current||c==="connecting"||c==="live")&&!await _())return;const E=await V("/api/scoutbot/session/switch",{method:"POST",body:JSON.stringify({id:b})});w(E),L([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"Live chat restored",detail:E.session.title}]),window.dispatchEvent(new CustomEvent(me,{detail:{id:E.session.id}}))}catch(E){const T=E instanceof Error?E.message:"Could not switch Scoutbot chats.";R(T),y("Could not restore the live chat",T,"error")}finally{N(null)}}},[y,u?.session.id,_,C,c]),re=o.useCallback(async b=>{const E=b.trim();if(!E)throw new Error("Preferred model is required.");const T=await V("/api/scoutbot/config",{method:"POST",body:JSON.stringify({model:E})});return w(P=>P&&{...P,config:{...P.config,...T.config}}),y("Scoutbot preferred model updated",T.config.model,"scoutbot"),T.config.model},[y]),ae=o.useMemo(()=>({enabled:r,open:s,state:c,leaseId:d,error:m,trace:j,chatState:u,sessionAction:C,setOpen:i,startCall:ee,endCall:_,startNewChat:te,switchChat:ne,updatePreferredModel:re,clearTrace:g,openVoiceSettings:Z}),[r,s,c,d,m,j,u,C,ee,_,te,ne,re,g,Z]);return a.jsx(Xe.Provider,{value:ae,children:e})}function On(e){return(e instanceof DOMException||e instanceof Error)&&e.name==="AbortError"}function Er(){return o.useContext(Xe)}function Ln(e){return e.type==="navigate"?"Navigation requested":e.type==="open-scoutbot"?"Scoutbot opened its panel":e.type==="refresh"?"Scoutbot refreshed live state":"Scoutbot opened the requested file"}function _n(e){return e.type==="navigate"?JSON.stringify(e.route):e.type==="view-file"?e.path:e.reason?.trim()||e.type}async function jn(e,t,n){t("Scoutbot is coordinating",`Asking ${e.targetLabel}`,"agent");try{const r=await V("/api/scoutbot/actions/ask",{method:"POST",body:JSON.stringify({targetLabel:e.targetLabel,targetAgentId:e.targetAgentId,body:e.body,channel:e.channel})});return t("Scoutbot sent the request",r.flightId?`${r.targetAgentId??r.targetLabel} · run ${r.flightId}`:r.targetAgentId??r.targetLabel,"agent"),!0}catch(r){const s=r instanceof Error?r.message:"Could not send to agent.";return t("Scoutbot could not send the request",s,"error"),n(s),!1}}function we(e,t){const n=t?.trim();n&&e.add(n)}function Dn(e,t){const n=new Set;return we(n,e.authorityNodeId),we(n,e.homeNodeId),n.size===0&&we(n,t),n}function Ze(e,t,n){return t?Dn(e,n).has(t):!0}function Pn(e,t,n){return t?e.filter(r=>Ze(r,t,n)):e}function xr(e,t,n){return t?new Set(e.filter(r=>Ze(r,t,n)).map(r=>r.id)):null}function Q(e,t,n){return!t&&!n||n&&e.authorityNodeId===n?!0:t?e.agentId&&t.has(e.agentId)||e.actorId&&t.has(e.actorId)||e.ownerId&&t.has(e.ownerId)||e.nextMoveOwnerId&&t.has(e.nextMoveOwnerId)?!0:!!e.participantIds?.some(r=>t.has(r)):!1}function Mn(e,t,n){return Q(e,t,n)}function Ar(e,t,n){return!t&&!n?e:e.filter(r=>Mn(r,t,n))}function Fn(e,t){return Q(e,t)}function Bn(e,t){return t?e.filter(n=>Fn(n,t)):e}function Be(e,t){return Q(e,t)}function Tr(e,t){if(!e||!t)return e;const n=e.activeAsks.filter(c=>Q(c,t)),r=e.recentCompleted.filter(c=>Q(c,t)),s=e.needsAttention.filter(c=>Q(c,t)),i=Bn(e.activity,t);return{...e,totals:{active:n.length,recentCompleted:r.length,needsAttention:s.length,activity:i.length},activeAsks:n,recentCompleted:r,needsAttention:s,activity:i}}function Rr(e,t){if(!t)return e;const n=e.activeFlights.filter(i=>Q(i,t)),r=e.childWork.filter(i=>Be(i,t));return Be(e,t)||n.length>0||r.length>0?{...e,activeFlights:n,childWork:r}:null}function Un(e){return!!(e&&(e.message.trim().length>0||e.files.length>0||e.forwardContext))}function qn(e){return[e.name,e.type,e.size,e.lastModified].join(":")}function Hn(e,t){const n=new Set;return[...e,...t].filter(r=>{const s=qn(r);return n.has(s)?!1:(n.add(s),!0)})}function Vn(e,t){const n=t.intent??e?.intent??"new-task",r=n==="route-capture",s=n==="forward-message";return{intent:n,...r&&(t.agentId??e?.agentId)?{agentId:t.agentId??e?.agentId}:{},...r&&(t.conversationId??e?.conversationId)?{conversationId:t.conversationId??e?.conversationId}:{},message:t.message??e?.message??"",files:Hn(e?.files??[],t.files??[]),attachmentFeedback:t.attachmentFeedback??e?.attachmentFeedback??null,mode:r?t.preferExistingChat===void 0?e?.mode??"new-session":t.preferExistingChat?"existing-chat":"new-session":"new-session",projectPath:t.projectPath??e?.projectPath??"",projectQuery:e?.projectQuery??"",...s&&(t.forwardContext??e?.forwardContext)?{forwardContext:t.forwardContext??e?.forwardContext}:{},forwardContextMode:s?t.forwardContextMode??e?.forwardContextMode??"selected-message":"selected-message"}}function $n({request:e,onClose:t,onOpenCapture:n}){const{agents:r,route:s,navigate:i}=et(),c=lt(s),f=Pn(r,c),d=It(s,f),[h,m]=o.useState(0),[R,j]=o.useState(null),[L,u]=o.useState(null),w=o.useRef(0),C=e?Vn(L,e):null,N=o.useCallback((A,D)=>{if(A.length===0)return;const I=!!(d.agentId||d.conversationId);n({intent:I?"route-capture":"new-task",files:A,attachmentFeedback:D,agentId:d.agentId??void 0,conversationId:d.conversationId??void 0,preferExistingChat:d.canUseExistingChat})},[n,d]);o.useEffect(()=>{if(!R)return;const A=window.setTimeout(()=>j(null),5e3);return()=>window.clearTimeout(A)},[R]),o.useEffect(()=>{const A=S=>{pe(S.dataTransfer)&&(S.preventDefault(),w.current+=1,m(w.current))},D=S=>{pe(S.dataTransfer)&&(S.preventDefault(),S.dataTransfer&&(S.dataTransfer.dropEffect="copy"))},I=()=>{w.current!==0&&(w.current=Math.max(0,w.current-1),m(w.current))},p=S=>{if(!pe(S.dataTransfer))return;S.preventDefault();const y=je(S.dataTransfer),g=y.filter(De),O=y.length-g.length;if(w.current=0,m(0),g.length===0){j(y.length===0?"Scout could not read that file. Try the attachment picker instead.":"That file type is not supported. Drop markdown, code, an image, or a video clip.");return}const _=g.length===1?`Dropped ${g[0]?.name||"1 attachment"}.`:`Dropped ${g.length} attachments.`,$=O>0?`${_} Skipped ${O} unsupported ${O===1?"file":"files"}.`:_;j(null),N(g,$)},v=S=>{if(Rt(S.target)||!pe(S.clipboardData))return;S.preventDefault();const y=je(S.clipboardData),g=y.filter(De);if(g.length===0){j(y.length===0?"Scout could not read that pasted file. Try the attachment picker instead.":"That pasted file type is not supported. Paste an image or video, or attach markdown or code.");return}N(g,g.length===1?`Pasted ${g[0]?.name||"1 attachment"}.`:`Pasted ${g.length} attachments.`)};return window.addEventListener("dragenter",A),window.addEventListener("dragover",D),window.addEventListener("dragleave",I),window.addEventListener("drop",p),window.addEventListener("paste",v),()=>{window.removeEventListener("dragenter",A),window.removeEventListener("dragover",D),window.removeEventListener("dragleave",I),window.removeEventListener("drop",p),window.removeEventListener("paste",v)}},[N]);const k=h>0&&!e;return a.jsxs(a.Fragment,{children:[k?a.jsx("div",{className:"s-capture-drop",role:"presentation",children:a.jsxs("div",{className:"s-capture-drop-card",children:[a.jsx("div",{className:"s-capture-drop-title",children:"Route capture"}),a.jsx("div",{className:"s-capture-drop-copy",children:"Drop markdown, code, an image, or a video clip to send it to the right agent or chat."})]})}):null,R?a.jsx("div",{className:"s-capture-feedback",role:"alert",children:R}):null,e?a.jsx(Nt,{agents:f,route:s,navigate:i,onClose:t,initialAgentId:C?.agentId,initialConversationId:C?.conversationId,initialMessage:C?.message,initialFiles:C?.files,initialAttachmentFeedback:C?.attachmentFeedback??void 0,initialIntent:C?.intent,initialProjectPath:C?.projectPath,initialProjectQuery:C?.projectQuery,initialForwardContext:C?.forwardContext,initialForwardContextMode:C?.forwardContextMode,defaultMode:C?.mode,draftRestored:Un(L),onDraftChange:u,onDraftConsumed:()=>u(null)}):null]})}const Ce=o.createContext(null),Jn=["hello","node.upserted","actor.registered","agent.registered","agent.endpoint.upserted","invocation.requested","flight.updated","delivery.state.changed","scout.dispatched"],Kn=new Set(Jn),zn=3e4,Wn=250;function Gn(e,t){try{return JSON.stringify(e)===JSON.stringify(t)?e:t}catch{return t}}const Qn={"--hud-bg":"oklch(0.118 0.004 260)","--hud-surface":"oklch(0.205 0.005 260)","--hud-ink":"oklch(0.975 0.006 260)","--hud-muted":"oklch(0.80 0.008 260)","--hud-dim":"oklch(0.70 0.007 260)","--hud-border":"oklch(0.975 0.006 260 / 0.08)","--hud-accent":"oklch(0.86 0.17 125)","--hud-accent-soft":"oklch(0.86 0.17 125 / 0.08)","--hud-shadow-soft":"oklch(0.08 0.004 260 / 0.42)","--hud-chrome-border":"oklch(0.975 0.006 260 / 0.04)","--hud-shadow-panel":"0 12px 34px oklch(0.08 0.004 260 / 0.45)","--hud-shadow-panel-hover":"0 14px 38px oklch(0.08 0.004 260 / 0.52)","--hud-shadow-bar":"0 -10px 28px oklch(0.08 0.004 260 / 0.38)","--hud-shadow-nav":"0 8px 24px oklch(0.08 0.004 260 / 0.32)","--hud-shadow-minimap":"0 10px 24px oklch(0.08 0.004 260 / 0.38)","--hud-status-ok":"oklch(0.80 0.15 155)","--hud-status-warn":"oklch(0.82 0.15 85)","--hud-status-error":"oklch(0.72 0.18 25)","--background":"0.132 0.004 260","--foreground":"0.965 0.006 260","--card":"0.178 0.005 260","--card-foreground":"0.965 0.006 260","--popover":"0.178 0.005 260","--popover-foreground":"0.965 0.006 260","--muted-foreground":"0.72 0.008 260","--scrim":"rgba(0, 0, 0, 0.5)","--scrim-soft":"rgba(0, 0, 0, 0.3)","--info":"#62b6ff","--shadow-card":"0 8px 22px rgba(0, 0, 0, 0.22)","--shadow-card-hover":"0 14px 36px rgba(0, 0, 0, 0.30)","--cat-gold":"#d7a978","--cat-purple":"#c58cff","--cat-sky":"#38bdf8","--scout-chrome-ink-strong":"color-mix(in srgb, var(--hud-ink) 94%, transparent)","--scout-chrome-ink":"color-mix(in srgb, var(--hud-ink) 84%, transparent)","--scout-chrome-ink-soft":"color-mix(in srgb, var(--hud-ink) 68%, transparent)","--scout-chrome-ink-faint":"color-mix(in srgb, var(--hud-ink) 64%, transparent)","--scout-chrome-ink-ghost":"color-mix(in srgb, var(--hud-ink) 56%, transparent)","--scout-chrome-hover":"color-mix(in srgb, var(--hud-ink) 5%, transparent)","--scout-chrome-active":"color-mix(in srgb, var(--hud-ink) 9%, transparent)","--scout-chrome-border-soft":"color-mix(in srgb, var(--hud-ink) 8%, transparent)","--scout-chrome-avatar-ink":"#111111","--hud-font-sans":"'Inter', ui-sans-serif, system-ui, sans-serif","--hud-font-mono":"'JetBrains Mono', ui-monospace, Menlo, monospace","--hud-font-serif":"'Spectral', 'Cormorant Garamond', Georgia, serif","--hud-font-accent-title":"'Inter Tight', var(--hud-font-sans)"},Yn={"--hud-bg":"oklch(0.982 0.008 78)","--hud-surface":"oklch(0.994 0.006 78)","--hud-ink":"oklch(0.26 0.018 72)","--hud-muted":"oklch(0.50 0.028 70)","--hud-dim":"oklch(0.64 0.022 72)","--hud-border":"oklch(0.86 0.016 75 / 0.92)","--hud-accent":"oklch(0.72 0.16 125)","--hud-accent-soft":"oklch(0.72 0.16 125 / 0.11)","--hud-shadow-soft":"oklch(0.42 0.02 70 / 0.11)","--hud-status-ok":"oklch(0.64 0.16 155)","--hud-status-warn":"oklch(0.72 0.15 85)","--hud-status-error":"oklch(0.62 0.19 25)","--background":"0.978 0.004 85","--foreground":"0.24 0.01 80","--card":"0.992 0.003 85","--card-foreground":"0.24 0.01 80","--popover":"0.992 0.003 85","--popover-foreground":"0.24 0.01 80","--muted-foreground":"0.56 0.014 80","--scrim":"rgba(28, 24, 20, 0.30)","--scrim-soft":"rgba(28, 24, 20, 0.16)","--info":"#2f7fd6","--shadow-card":"0 8px 22px oklch(0.42 0.02 70 / 0.09)","--shadow-card-hover":"0 14px 36px oklch(0.42 0.02 70 / 0.13)","--cat-gold":"#a9824f","--cat-purple":"#8b5cf6","--cat-sky":"#0ea5e9","--scout-chrome-ink-strong":"color-mix(in srgb, var(--hud-ink) 94%, transparent)","--scout-chrome-ink":"color-mix(in srgb, var(--hud-ink) 78%, transparent)","--scout-chrome-ink-soft":"color-mix(in srgb, var(--hud-ink) 60%, transparent)","--scout-chrome-ink-faint":"color-mix(in srgb, var(--hud-ink) 56%, transparent)","--scout-chrome-ink-ghost":"color-mix(in srgb, var(--hud-ink) 50%, transparent)","--scout-chrome-hover":"color-mix(in srgb, var(--hud-ink) 4%, transparent)","--scout-chrome-active":"color-mix(in srgb, var(--hud-ink) 8%, transparent)","--scout-chrome-border-soft":"color-mix(in srgb, var(--hud-border) 80%, transparent)","--scout-chrome-avatar-ink":"#ffffff","--hud-font-sans":"'Inter', ui-sans-serif, system-ui, sans-serif","--hud-font-mono":"'JetBrains Mono', ui-monospace, Menlo, monospace","--hud-font-serif":"'Spectral', 'Cormorant Garamond', Georgia, serif","--hud-font-accent-title":"'Inter Tight', var(--hud-font-sans)"},Xn=new Set(["--hud-bg","--hud-surface","--hud-ink","--hud-muted","--hud-dim","--hud-border","--hud-accent","--hud-accent-soft","--hud-shadow-soft","--hud-chrome-border","--hud-shadow-panel","--hud-shadow-panel-hover","--hud-shadow-bar","--hud-shadow-nav","--hud-shadow-minimap","--hud-status-ok","--hud-status-warn","--hud-status-error"]);function Zn(e){return Object.fromEntries(Object.entries(e==="light"?Yn:Qn).filter(([n])=>!Xn.has(n)))}function Ir(){return o.useContext(Ce)}function et(){const e=o.useContext(Ce);if(!e)throw new Error("useScout must be used inside ScoutProvider");return e}function Nr({children:e,initialTheme:t="dark"}){const{route:n,navigate:r,navigateBack:s,canNavigateBack:i}=ut(),c=Ot(),f=Ue(Qe,!1),[d,h]=o.useState([]),[m,R]=o.useState(!1),[j,L]=o.useState({status:"checking",message:null,lastCheckedAt:null}),[u,w]=o.useState(Oe),[C,N]=o.useState(null),k=o.useRef(!1),[A,D]=o.useState(Mt),[I,p]=o.useState(!1),[v,S]=o.useState(null),[y,g]=o.useState(null),[O,_]=o.useState(""),[$,Z]=o.useState(null),ee=n.view==="settings",te=o.useMemo(()=>n.view!=="broker"||!n.attemptId?null:v?.id===n.attemptId?v:null,[v,n]),ne=o.useMemo(()=>n.view!=="search"||!n.hitId?null:y?.id===n.hitId?y:null,[y,n]),re=o.useMemo(()=>n.view==="agents-v2"&&n.agentId&&n.sessionId?{agentId:n.agentId,sessionId:n.sessionId}:n.view==="sessions"&&n.sessionId?{agentId:n.agentId??"",sessionId:n.sessionId}:null,[n]),ae=o.useCallback((l,x)=>{if(n.view==="agents-v2"&&n.agentId===l){r({...n,sessionId:x},{replace:!0});return}if(n.view==="sessions"){r({view:"sessions",sessionId:x,agentId:l},{replace:!0});return}r({view:"agents-v2",agentId:l,sessionId:x},{replace:!0})},[r,n]),b=o.useCallback(()=>{r({view:"settings",section:"appearance"})},[r]),E=o.useCallback(()=>{n.view==="settings"&&r({view:"inbox"})},[r,n.view]),T=o.useCallback(l=>{Z(l??{intent:"new-task"})},[]),P=o.useCallback(()=>Z(null),[]),z=o.useCallback(l=>{S(l),!(n.view==="broker"&&n.attemptId===l.id)&&r({view:"broker",attemptId:l.id,...n.view==="broker"&&n.filter?{filter:n.filter}:{}},{replace:n.view==="broker"})},[r,n]),B=o.useCallback(()=>{S(null),n.view==="broker"&&n.attemptId&&r({view:"broker",...n.filter?{filter:n.filter}:{}},{replace:!0})},[r,n]),M=o.useCallback((l,x,F)=>{if(g(l),typeof x=="string"&&_(x.trim()),n.view==="search"&&n.hitId===l.id)return;const H=F??(n.view==="search"?n.filters:void 0);r({view:"search",...n.view==="search"&&n.mode?{mode:n.mode}:{},...H?{filters:H}:{},hitId:l.id},{replace:n.view==="search"})},[r,n]),q=o.useCallback(()=>{g(null),_(""),n.view==="search"&&n.hitId&&r({view:"search",...n.mode?{mode:n.mode}:{},...n.filters?{filters:n.filters}:{}},{replace:!0})},[r,n]),U=o.useMemo(()=>st(),[]),J=c?.resolvedTheme??t,ve=c?.template??"hudson",tt=o.useMemo(()=>({...Zn(J),...U??{}}),[U,J]),ke=o.useCallback(l=>{w(x=>({...x,...l}))},[]);o.useEffect(()=>{it(J,ve,u),at(u)},[ve,u,J]),o.useEffect(()=>{const l=x=>{x.key!==null&&x.key!==ct||w(Oe())};return window.addEventListener("storage",l),()=>window.removeEventListener("storage",l)},[]);const Ee=o.useMemo(()=>mt(d),[d]),xe=Ee?.id??vt(d),Ae=Ee?.conversationId??null,ce=o.useRef(null),Y=o.useRef(null),le=n.view==="ops"?"/api/agents":"/api/agents?detail=summary",ue=o.useCallback(()=>{L({status:"online",message:null,lastCheckedAt:Date.now()})},[]),de=o.useCallback(l=>{const x=_t(l);L({status:jt(x)?"offline":"degraded",message:x,lastCheckedAt:Date.now()})},[]),K=o.useCallback(async()=>{const l=ce.current;if(l&&(await l.promise,l.url===le))return;const x=(async()=>{try{const F=await V(le);h(H=>Gn(H,F)),ue()}catch(F){de(F)}finally{R(!0)}})();ce.current={url:le,promise:x};try{await x}finally{ce.current?.promise===x&&(ce.current=null)}},[le,de,ue]),W=o.useCallback(async()=>{try{const l=await V("/api/onboarding/state");k.current=!1,N(l);const x=l.operatorName?.trim()||l.operatorNameSuggestion?.trim()||null;D(x),Ft(x),ue()}catch(l){de(l),k.current=!0,N({hasLocalConfig:!0,hasProjectConfig:!0,hasOperatorName:!0,localConfigPath:null,projectRoot:null,currentDirectory:null,operatorName:null,operatorNameSuggestion:null,needed:!1})}},[de,ue]),Te=o.useCallback(()=>{p(!0),V("/api/onboarding/skip",{method:"POST",body:"{}"}).then(()=>W()).catch(()=>null)},[W]);o.useEffect(()=>{K(),W()},[K,W]),o.useEffect(()=>{const l=()=>{Le()&&(K(),k.current&&W())},x=window.setInterval(l,zn),F=ft(l);return()=>{window.clearInterval(x),F()}},[K,W]);const Re=o.useMemo(()=>d.filter(l=>pt(l.state)).length,[d]),[nt,Ie]=o.useState(null),oe=o.useCallback(l=>{l?.trim()&&Ie(l.trim())},[]),se=o.useCallback(()=>Ie(null),[]),X=o.useCallback(l=>{if(!gt(l))switch(l.type){case"navigate":r(l.route);break;case"focus-composer":window.dispatchEvent(new CustomEvent("scout:composer-focus"));break;case"open-scoutbot":window.dispatchEvent(new CustomEvent("scout:scoutbot-panel-open",{detail:l}));break;case"refresh":K();break;case"view-file":oe(l.path);break}},[r,oe,K]),rt=o.useCallback((l,x)=>{const F=l.trim(),H=x.trim();if(!F||!H)return;const Ne=n.view==="conversation"||n.view==="messages"?n.conversationId:window.location.pathname==="/embed/thread"&&new URLSearchParams(window.location.search).get("conversationId")?.trim()||void 0;se(),X({type:"navigate",route:{view:"code",root:H,file:F,...Ne?{returnConversationId:Ne}:{}}})},[X,se,n]),fe=o.useRef({applyScoutbotUiAction:X});fe.current={applyScoutbotUiAction:X},dt(l=>{Le()&&Kn.has(l.kind)&&(Y.current!==null&&window.clearTimeout(Y.current),Y.current=window.setTimeout(()=>{Y.current=null,K()},Wn))}),o.useEffect(()=>()=>{Y.current!==null&&window.clearTimeout(Y.current)},[]),o.useEffect(()=>{const l=x=>{const F=x.detail,H=F&&typeof F=="object"&&"type"in F?F:null;H&&fe.current.applyScoutbotUiAction(H)};return window.addEventListener("scout:scoutbot-ui-action",l),window.scoutScoutbot={applyUiAction:x=>fe.current.applyScoutbotUiAction(x),navigate:x=>fe.current.applyScoutbotUiAction({type:"navigate",route:x})},()=>{window.removeEventListener("scout:scoutbot-ui-action",l),window.scoutScoutbot?.applyUiAction&&delete window.scoutScoutbot}},[]);const ot=o.useMemo(()=>({route:n,navigate:r,navigateBack:s,canNavigateBack:i,agents:d,agentsLoaded:m,onlineCount:Re,apiConnection:j,reload:K,appearanceDetails:u,updateAppearanceDetails:ke,onboarding:C,operatorName:A,refreshOnboarding:W,onboardingSkipped:I,skipOnboarding:Te,settingsOpen:ee,openSettings:b,closeSettings:E,scoutbotAgentId:xe,scoutbotConversationId:Ae,applyScoutbotUiAction:X,selectedBrokerAttempt:te,inspectBrokerAttempt:z,clearBrokerAttempt:B,selectedKnowledgeHit:ne,selectedKnowledgeQuery:O,inspectKnowledgeHit:M,clearKnowledgeHit:q,focusedSession:re,focusSession:ae,openFilePreview:oe,closeFilePreview:se,openContextCapture:T,closeContextCapture:P}),[n,r,s,i,d,m,Re,j,K,u,ke,C,A,W,I,Te,ee,b,E,xe,Ae,X,te,z,B,ne,O,M,q,re,ae,oe,se,T,P]);return a.jsx(Ce.Provider,{value:ot,children:a.jsx("div",{"data-scout-theme-mode":J,"data-scout-palette":u.palette,"data-scout-contrast":u.contrast,"data-scout-accent":u.accent,"data-scout-shell":u.shell,"data-hudson-theme":J,"data-hudson-template":ve,style:{...tt},children:a.jsx("div",{"data-scout-theme":J,style:{display:"contents"},children:a.jsx(Lt,{children:a.jsxs(rn,{children:[f?a.jsx(Nn,{children:e}):e,a.jsx(Xt,{path:nt,onOpenPath:oe,onOpenInCode:rt,onClose:se}),a.jsx($n,{request:$,onClose:P,onOpenCapture:T})]})})})})})}export{Lt as C,Qn as D,Yn as L,Ce as S,yr as a,Bn as b,Ir as c,Pn as d,Ar as e,_t as f,Tr as g,Nr as h,jt as i,Rr as j,Ut as k,Er as l,xr as m,Sr as n,Cr as o,Qe as p,me as q,Rn as r,Tn as s,kr as t,et as u};
1
+ import{r as o,j as a,J as Oe,b as st,K as it,L as at,q as ct}from"./index-NRbRrZw-.js";import{a as Ue}from"./provider-Bq0ScH3v.js";import{d as lt,as as ut}from"./router-Bx1tiwVe.js";import{a as V}from"./api-DEHEgJ9m.js";import{u as dt}from"./sse-QSbhyq9A.js";import{o as ft,i as Le}from"./surface-activity-B1rgWB1i.js";import{i as pt}from"./colors-BtO5_zlx.js";import{e as qe,s as ht,i as _e,r as mt,a as vt,f as gt}from"./scoutbot-D4vuKzOL.js";import{F as wt,a as bt,D as yt}from"./DocumentFocusViewer-CetjnYut.js";import{c as He,T as Ve}from"./TextDocumentSurface-B29xZNlI.js";import{C as St}from"./chevron-right-CV7sEVBS.js";import{F as Ct}from"./file-text-BGVkHS4_.js";import{c as kt}from"./createLucideIcon-Da0lq809.js";import{C as Et}from"./code-xml-CPzpZkhu.js";import{A as xt}from"./arrow-left-B0CdJdAC.js";import{A as At}from"./arrow-right-YRBoTTyf.js";import{d as Tt}from"./scout-voice-BT3gYDhU.js";import{i as Rt}from"./keyboard-nav-feLCB3Zm.js";import{J as It,N as Nt,E as pe,K as je,C as De}from"./NewChatComposer-BPsg8shF.js";import{u as Ot}from"./chunk-HRAB3GC3-BYQZ1LOn.js";const $e={current:null,setMenu:null};function yr(){return o.useCallback((e,t)=>{e.preventDefault(),e.stopPropagation(),$e.setMenu?.({position:{x:e.clientX,y:e.clientY},items:t})},[])}function Lt({children:e}){const[t,n]=o.useState(null),r=o.useRef(null);$e.setMenu=n;const s=o.useCallback(()=>{n(null)},[]);return o.useEffect(()=>{if(!t)return;const i=h=>{h.target instanceof Node&&r.current?.contains(h.target)||s()},c=h=>{h.key==="Escape"&&s()},f=()=>s(),d=h=>{h.defaultPrevented||s()};return window.addEventListener("mousedown",i,!0),window.addEventListener("keydown",c),window.addEventListener("wheel",f,!0),window.addEventListener("contextmenu",d),()=>{window.removeEventListener("mousedown",i,!0),window.removeEventListener("keydown",c),window.removeEventListener("wheel",f,!0),window.removeEventListener("contextmenu",d)}},[t,s]),o.useLayoutEffect(()=>{if(!t||!r.current)return;const i=r.current,c=i.getBoundingClientRect(),f=window.innerWidth,d=window.innerHeight;let h=t.position.x,m=t.position.y;h+c.width>f-8&&(h=f-c.width-8),m+c.height>d-8&&(m=d-c.height-8),h<8&&(h=8),m<8&&(m=8),i.style.left=`${h}px`,i.style.top=`${m}px`,i.style.visibility="visible"},[t]),a.jsxs(a.Fragment,{children:[e,t&&a.jsx("div",{ref:r,className:"s-context-menu",style:{left:t.position.x,top:t.position.y,visibility:"hidden"},role:"menu",onMouseDown:i=>i.stopPropagation(),children:t.items.map((i,c)=>i.kind==="separator"?a.jsx("div",{className:"s-context-menu-sep",role:"separator"},c):a.jsxs("button",{type:"button",className:"s-context-menu-item",role:"menuitem",onClick:()=>{i.onSelect(),s()},children:[a.jsx("span",{className:"s-context-menu-label",children:i.label}),i.shortcut&&a.jsx("span",{className:"s-context-menu-shortcut",children:i.shortcut})]},c))})]})}function _t(e){const t=e instanceof Error?e.message:String(e);return Dt(t)?"Scout server is unreachable":t}function jt(e){return e==="Scout server is unreachable"}function Dt(e){return/failed to fetch|fetch failed|networkerror|load failed|couldn'?t connect|could not connect|connection refused|econnrefused|server is unreachable/i.test(e)}const be="openscout.operator.name",Pt=new Set(["operator","you","user","unknown","null","undefined"]);function Je(e){const t=e?.trim();return!t||t.length>64||Pt.has(t.toLowerCase())?null:t}function Mt(){if(typeof window>"u")return null;try{return Je(window.localStorage.getItem(be))}catch{return null}}function Ft(e){if(!(typeof window>"u"))try{const t=Je(e);t?window.localStorage.setItem(be,t):window.localStorage.removeItem(be)}catch{}}const Bt=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ut=kt("chevron-up",Bt),qt={id:"audio",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("audio/"),render:({resource:e})=>{const t=e;return a.jsx("div",{className:"s-file-preview-media-wrap",children:a.jsx("div",{className:"s-file-preview-audio-stage",children:a.jsx("audio",{className:"s-file-preview-audio",src:t.rawUrl,controls:!0})})})}},Ht={id:"binary",canHandle:()=>!0,render:({resource:e})=>{const t=e;return a.jsxs("div",{className:"s-file-preview-callout",children:[a.jsxs("div",{className:"s-file-preview-callout-title",children:[t.previewReason," — open in OS"]}),a.jsxs("div",{className:"s-file-preview-callout-copy",children:["Scout can resolve this file, but it does not have an inline preview for ",t.mediaType," yet."]})]})}},Vt=new Set(["text/typescript","text/javascript","text/css","text/html","application/json","text/yaml","text/toml","text/x-shellscript","text/plain"]),$t={id:"code",canHandle:e=>e.kind==="file"&&e.previewable&&Vt.has(e.mediaType),render:({resource:e})=>{const t=e,n=He({id:t.realPath,title:t.title,uri:t.realPath,mediaType:t.mediaType,value:t.content,filename:t.title,kind:"code",readOnly:!0});return a.jsx(Ve,{document:n,mode:"read",className:"s-doc-focus-document"})}},Jt={id:"directory",canHandle:e=>e.kind==="directory",render:({resource:e,openFilePreview:t})=>{const n=e,r=Kt(n.realPath,n.rootPath);return a.jsxs("div",{className:"s-file-preview-directory",children:[a.jsx("div",{className:"s-file-preview-breadcrumb","aria-label":"Directory breadcrumb",children:r.map((s,i)=>{const c=i===r.length-1;return a.jsxs("div",{className:"s-file-preview-breadcrumb-item",children:[i>0&&a.jsx(St,{size:12,"aria-hidden":"true"}),c?a.jsx("span",{className:"s-file-preview-breadcrumb-current",children:s.label}):a.jsx("button",{type:"button",className:"s-file-preview-breadcrumb-link",onClick:()=>t(s.path),children:s.label})]},s.path)})}),a.jsxs("div",{className:"s-file-preview-directory-list",role:"list",children:[n.entries.map(s=>a.jsxs("button",{type:"button",className:"s-file-preview-entry",onClick:()=>t(s.path),children:[a.jsx("span",{className:"s-file-preview-entry-icon","aria-hidden":"true",children:s.kind==="directory"?a.jsx(wt,{size:14}):a.jsx(Ct,{size:14})}),a.jsx("span",{className:"s-file-preview-entry-name",children:s.name}),a.jsx("span",{className:"s-file-preview-entry-kind",children:s.kind==="directory"?"dir":"file"})]},s.realPath)),n.entries.length===0&&a.jsx("div",{className:"s-file-preview-directory-empty",children:"This directory is empty."})]})]})}};function Kt(e,t){const n=t==="/"?"/":t.replace(/\/+$/u,""),r=e==="/"?"/":e.replace(/\/+$/u,""),s=n.split("/").filter(Boolean),i=r.split("/").filter(Boolean),c=[{label:s[s.length-1]??"/",path:n||"/"}];let f=n||"/";for(let d=s.length;d<i.length;d+=1){const h=i[d];h&&(f=f==="/"?`/${h}`:`${f}/${h}`,c.push({label:h,path:f}))}return c}const zt={id:"html",canHandle:e=>e.kind==="file"&&e.previewable&&e.mediaType==="text/html",render:({resource:e})=>a.jsx("div",{className:"s-file-preview-html-wrap",children:a.jsx("iframe",{className:"s-file-preview-html-frame",src:e.kind==="file"?e.rawUrl:"",title:e.title,sandbox:"allow-forms allow-popups allow-popups-to-escape-sandbox allow-scripts",referrerPolicy:"no-referrer"})})},Wt={id:"image",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("image/"),render:({resource:e})=>a.jsx("div",{className:"s-file-preview-image-wrap",children:a.jsx("div",{className:"s-file-preview-image-stage",children:a.jsx("img",{className:"s-file-preview-image",src:e.kind==="file"?e.rawUrl:"",alt:e.title})})})},Gt={id:"markdown",canHandle:e=>e.kind==="file"&&e.previewable&&e.mediaType==="text/markdown",render:({resource:e})=>{const t=e,n=He({id:t.realPath,title:t.title,uri:t.realPath,mediaType:t.mediaType,value:t.content,filename:t.title,kind:"markdown",readOnly:!0});return a.jsx(Ve,{document:n,mode:"preview",className:"s-doc-focus-document"})}},Qt={id:"video",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("video/"),render:({resource:e})=>{const t=e;return a.jsx("div",{className:"s-file-preview-media-wrap",children:a.jsx("div",{className:"s-file-preview-media-stage",children:a.jsx("video",{className:"s-file-preview-video",src:t.rawUrl,controls:!0})})})}},Yt=[Jt,Gt,zt,$t,Wt,Qt,qt,Ht];function Xt({path:e,onOpenPath:t,onOpenInCode:n,onClose:r}){const[s,i]=o.useState(null),[c,f]=o.useState(null),[d,h]=o.useState(!1),[m,R]=o.useState(null),j=o.useRef(null);o.useEffect(()=>{j.current=m},[m]),o.useEffect(()=>{if(!e){i(null),f(null),h(!1);return}let p=!1;return h(!0),f(null),i(null),V(`/api/file/preview?path=${encodeURIComponent(e)}`).then(v=>{p||(i(v),Zt(v,j.current,R))}).catch(v=>{p||f(v instanceof Error?v.message:"could not load file")}).finally(()=>{p||h(!1)}),()=>{p=!0}},[e]);const{currentIndex:L,prevPath:u,nextPath:w}=o.useMemo(()=>{if(!s||s.kind!=="file"||!m)return{currentIndex:-1,prevPath:null,nextPath:null};const p=m.files.findIndex(v=>v.realPath===s.realPath);return p<0?{currentIndex:-1,prevPath:null,nextPath:null}:{currentIndex:p,prevPath:p>0?m.files[p-1].path:null,nextPath:p<m.files.length-1?m.files[p+1].path:null}},[s,m]);if(o.useEffect(()=>{if(!e)return;const p=v=>{if(v.key==="Escape"){r();return}if(v.target instanceof HTMLElement){const S=v.target.tagName;if(S==="INPUT"||S==="TEXTAREA"||v.target.isContentEditable)return}v.metaKey||v.ctrlKey||v.altKey||(v.key==="ArrowLeft"&&u?(v.preventDefault(),t(u)):v.key==="ArrowRight"&&w?(v.preventDefault(),t(w)):v.key==="Backspace"&&m&&s?.kind==="file"&&(v.preventDefault(),t(m.dirPath)))};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[e,r,t,u,w,m,s]),!e)return null;const C=()=>{V("/api/file/reveal",{method:"POST",body:JSON.stringify({path:s?.realPath??e})}).catch(p=>{f(p instanceof Error?p.message:"reveal failed")})},N=s?Yt.find(p=>p.canHandle(s))??null:null,k=!!(s&&s.kind==="file"&&m&&L>=0&&m.files.length>1),A=[];k&&m&&A.push({label:`Folder: ${m.dirTitle}`,icon:a.jsx(Ut,{size:12}),onClick:()=>t(m.dirPath),title:`Back to ${m.dirTitle} (Backspace)`}),A.push({label:"Open in Code",icon:a.jsx(Et,{size:12}),onClick:()=>{s?.kind==="file"&&n(s.realPath,s.rootPath)},title:"Continue with this file in Scout’s Code browser",disabled:s?.kind!=="file"}),A.push({label:"Show in folder",icon:a.jsx(bt,{size:12}),onClick:C,title:"Show this file in its operating system folder",hideLabel:!0});const D=s?tn(s):[];k&&D.unshift(`${L+1} / ${m.files.length}`);const I=s&&N?N.render({resource:s,openFilePreview:t}):null;return a.jsx(yt,{open:!0,kind:en(s),document:null,title:s?.title??e.split("/").pop()??"File",eyebrow:"File preview",subtitle:s?.realPath??e,meta:D,state:d?"Loading…":null,error:c,body:I?a.jsxs("div",{className:`s-file-preview-shell${k?" s-file-preview-shell-nav":""}`,children:[k&&a.jsx("button",{type:"button",className:"s-file-preview-side-nav s-file-preview-side-nav-left",onClick:()=>u&&t(u),disabled:!u,"aria-label":"Previous file",title:"Previous file (←)",children:a.jsx(xt,{size:18,strokeWidth:1.8,"aria-hidden":"true"})}),a.jsx("div",{className:"s-file-preview-shell-body",children:I}),k&&a.jsx("button",{type:"button",className:"s-file-preview-side-nav s-file-preview-side-nav-right",onClick:()=>w&&t(w),disabled:!w,"aria-label":"Next file",title:"Next file (→)",children:a.jsx(At,{size:18,strokeWidth:1.8,"aria-hidden":"true"})})]}):null,actions:A,onClose:r})}function Zt(e,t,n){if(e.kind==="directory"){const s=e.entries.filter(i=>i.kind==="file");n({dirPath:e.path,dirTitle:e.title,files:s});return}if(!t){n(null);return}t.files.some(s=>s.realPath===e.realPath)||n(null)}function en(e){return!e||e.kind==="directory"||e.mediaType==="text/markdown"||e.mediaType==="text/plain"?"doc":"code"}function tn(e){return e.kind==="directory"?[`${e.entries.length} ${e.entries.length===1?"entry":"entries"}`]:[...e.previewable&&e.truncated?["truncated"]:[],nn(e.sizeBytes),e.mediaType]}function nn(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const Ke={activity:"idle",brief:{lastDeliveredAt:null},reminders:{dueCount:0,upcomingCount:0,due:[],next:null},voice:{available:null,setupBlocked:!1,replies:!1},error:null,session:{title:null,lastActivityAt:null},conversation:{messageCount:0,loading:!0}},G=()=>{},ze={focusScoutbot:G,triggerBrief:G,triggerAskState:G,toggleVoiceReplies:G,openScoutbotSettings:G,startNewChat:G,dismissReminder:G,askReminderStatus:G},ye=o.createContext(null);function rn({children:e}){const[t,n]=o.useState(Ke),r=o.useRef(ze),s=o.useCallback(d=>{n(h=>on(h,d)?h:d)},[]),i=o.useCallback(d=>{r.current=d},[]),c=o.useMemo(()=>({focusScoutbot:()=>r.current.focusScoutbot(),triggerBrief:()=>r.current.triggerBrief(),triggerAskState:()=>r.current.triggerAskState(),toggleVoiceReplies:()=>r.current.toggleVoiceReplies(),openScoutbotSettings:()=>r.current.openScoutbotSettings(),startNewChat:()=>r.current.startNewChat(),dismissReminder:d=>r.current.dismissReminder(d),askReminderStatus:d=>r.current.askReminderStatus(d)}),[]),f=o.useMemo(()=>({state:t,actions:c,publishState:s,registerActions:i}),[t,c,s,i]);return a.jsx(ye.Provider,{value:f,children:e})}function Sr(){const e=o.useContext(ye);return e?{state:e.state,actions:e.actions}:{state:Ke,actions:ze}}function Cr(){const e=o.useContext(ye);return e?{publishState:e.publishState,registerActions:e.registerActions}:null}function on(e,t){return e.activity===t.activity&&e.brief.lastDeliveredAt===t.brief.lastDeliveredAt&&e.reminders.dueCount===t.reminders.dueCount&&e.reminders.upcomingCount===t.reminders.upcomingCount&&sn(e.reminders.due,t.reminders.due)&&We(e.reminders.next,t.reminders.next)&&e.voice.available===t.voice.available&&e.voice.setupBlocked===t.voice.setupBlocked&&e.voice.replies===t.voice.replies&&e.error===t.error&&e.session.title===t.session.title&&e.session.lastActivityAt===t.session.lastActivityAt&&e.conversation.messageCount===t.conversation.messageCount&&e.conversation.loading===t.conversation.loading}function sn(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!We(e[n],t[n]))return!1;return!0}function We(e,t){return e===t?!0:!e||!t?!1:e.id===t.id&&e.body===t.body&&e.status===t.status&&e.dueAt===t.dueAt}const an="/api/voice/realtime/call",Ge="/api/voice/realtime/lease",cn="x-openscout-realtime-voice-lease",Qe="surface.realtime-voice",kr="scout:realtime-voice-stop",ln={noise_reduction:{type:"far_field"},turn_detection:{type:"server_vad",threshold:.6,prefix_padding_ms:300,silence_duration_ms:500,create_response:!0,interrupt_response:!0}},un={noise_reduction:{type:"near_field"},turn_detection:{type:"server_vad",threshold:.5,prefix_padding_ms:300,silence_duration_ms:500,create_response:!0,interrupt_response:!0}},dn="/api/scoutbot/chat",fn=25e3;async function pn(e={}){if(ie(e.signal),!globalThis.RTCPeerConnection||!navigator.mediaDevices?.getUserMedia)throw new Error("This browser does not support realtime audio calls.");e.onState?.("connecting");const t=new RTCPeerConnection,n=new Audio;n.autoplay=!0;let r=!1,s=null,i=null,c=null,f=0,d=0;const h=(u,w,C="voice")=>{d+=1,e.onTrace?.({id:`voice-${d}`,at:Date.now(),kind:C,label:u,...w?{detail:w}:{}})};let m=null;const R=()=>{if(m)return m;r=!0,e.signal?.removeEventListener("abort",L),c&&clearInterval(c),c=null,s?.getTracks().forEach(w=>w.stop()),n.pause(),n.srcObject=null,t.close();const u=i;return i=null,m=(async()=>{u&&await En(u),e.onState?.("ended")})(),m},j=()=>{R().catch(u=>{e.onError?.(u instanceof Error?u.message:"Could not release the realtime voice lease."),e.onState?.("error")})},L=()=>{j()};e.signal?.addEventListener("abort",L,{once:!0}),t.ontrack=({streams:u})=>{const w=u[0];if(!w||r)return;const[C]=w.getAudioTracks();C&&C.addEventListener("ended",()=>{r||e.onError?.("Realtime voice audio ended unexpectedly.")}),n.srcObject=w,n.play().catch(()=>{e.onError?.("Browser playback was blocked. Interact with the page, then start the call again.")})},t.onconnectionstatechange=()=>{r||(t.connectionState==="connected"?(e.onState?.("live"),h("Realtime channel connected","Scoutbot bridge is ready")):(t.connectionState==="failed"||t.connectionState==="disconnected")&&(e.onError?.("Realtime voice connection ended unexpectedly."),j()))};try{s=await Cn(e.inputDeviceName,e.signal),ie(e.signal);for(const g of s.getTracks())t.addTrack(g,s);const u=t.createDataChannel("oai-events"),w=new Set;let C=Promise.resolve(),N=!1,k=null;const A=[],D=g=>{if(r||u.readyState!=="open")return!1;try{return u.send(JSON.stringify(g)),!0}catch{return e.onError?.("Realtime voice events channel closed unexpectedly."),!1}},I=()=>{if(N||k||A.length===0)return;const g=A.shift();if(g){if(k=g,!D({type:"response.create",response:{instructions:g}})){k=null,A.unshift(g);return}N=!0}},p=g=>{A.push(g),I()};u.addEventListener("open",()=>{if(r)return;const g=Sn(e.inputDeviceName);if(!D({type:"session.update",session:{type:"realtime",audio:{input:g}}})){e.onError?.("Could not configure Scout's realtime microphone processing.");return}h("Scoutbot bridge ready","Live fleet context is available"),p("Open with one brief audible greeting: 'Hi, I’m Scoutbot. I can check the fleet and coordinate through Scout. What would you like to work on?'")}),u.addEventListener("error",()=>{r||e.onError?.("Realtime voice events channel closed unexpectedly.")}),u.addEventListener("message",g=>{const O=mn(g.data);if(O?.type==="error"){if(Ye(O.message)){k&&(A.unshift(k),k=null),N=!0,h("Scoutbot reply queued","Waiting for the current spoken response to finish","scoutbot");return}e.onError?.(O.message??"OpenAI Realtime reported an error.");return}if(O?.type==="response.created"){N=!0,k=null;return}if(O?.type==="response.done"){N=!1,k=null;for(const _ of vn(O))_.name!=="ask_scoutbot"||w.has(_.callId)||(w.add(_.callId),C=C.then(()=>hn({functionCall:_,route:e.getRoute?.()??e.route,uiContext:e.getUiContext?.(),onReply:e.onScoutbotReply,onTrace:h,send:D,requestResponse:p})).catch($=>{e.onError?.($ instanceof Error?$.message:"Scoutbot could not complete the voice request.")}));I()}});const v=await he(t.createOffer(),e.signal);if(await he(t.setLocalDescription(v),e.signal),!v.sdp)throw new Error("Could not create a WebRTC offer.");const S=await fetch(an,{method:"POST",headers:{"content-type":"application/sdp"},body:v.sdp,signal:e.signal});i=S.headers.get(cn)?.trim()||null;const y=await he(S.text(),e.signal);if(!S.ok)throw new Error(bn(y,S.status));if(!i)throw new Error("Scout started the audio connection without a concurrency lease. Please try again.");return c=setInterval(()=>{if(!i||r)return;const g=i;kn(g).then(O=>{if(!(r||g!==i)){if(O){f=0;return}e.onError?.("Realtime voice lost its server lease. Reconnect to continue safely."),j()}}).catch(()=>{f+=1,!(f<2||r)&&(e.onError?.("Realtime voice could not renew its server lease. Check the connection and try again."),j())})},fn),await he(t.setRemoteDescription({type:"answer",sdp:y}),e.signal),ie(e.signal),{leaseId:i,stop:R}}catch(u){throw await R(),u}}async function hn(e){const t=gn(e.functionCall.arguments);if(!t){e.onTrace("Scoutbot request could not be read",void 0,"error"),ge(e,{ok:!1,error:"The voice request did not include a usable Scoutbot prompt."});return}e.onTrace("Scoutbot is checking the control plane",t,"scoutbot");try{const n=await fetch(dn,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({body:t,route:e.route,uiContext:e.uiContext})}),r=await n.text();if(!n.ok)throw new Error(wn(r,n.status));const s=JSON.parse(r),i=typeof s.reply?.body=="string"?s.reply.body.trim():"";if(!i)throw new Error("Scoutbot returned an empty reply.");const c=qe(i).filter(h=>h.type==="ask-agent").length,f=e.onReply?await e.onReply(i):{agentRequests:{requested:c,sent:0,failed:c}},d=ht(i);e.onTrace("Scoutbot reply ready",void 0,"scoutbot"),ge(e,{ok:!0,reply:d,...f.agentRequests.requested>0?{agentRequests:f.agentRequests}:{}})}catch(n){const r=n instanceof Error?n.message:"Scoutbot could not complete the voice request.";e.onTrace("Scoutbot request failed",r,"error"),ge(e,{ok:!1,error:r})}}function ge(e,t){if(!e.send({type:"conversation.item.create",item:{type:"function_call_output",call_id:e.functionCall.callId,output:JSON.stringify(t)}}))return;const r=t.agentRequests;e.requestResponse(t.ok?r&&r.requested>0?r.failed>0?"Answer using the Scoutbot result. Say clearly that Scoutbot tried to send the agent request automatically but delivery failed, and tell the operator to check the activity log. Be concise and do not mention tools, JSON, fences, or implementation details.":"Answer using the Scoutbot result. Say clearly that the agent request was sent automatically. Do not claim the requested work is complete. Be concise and do not mention tools, JSON, fences, or implementation details.":"Answer using the Scoutbot result. Speak the useful answer naturally and concisely. Do not mention tools, JSON, fences, or implementation details.":"Briefly tell the operator that Scoutbot could not complete the live lookup and state the returned error plainly.")}function Ye(e){const t=e?.toLowerCase()??"";return t.includes("active response in progress")||t.includes("conversation already has an active response")||t.includes("response is already in progress")}function mn(e){if(typeof e!="string")return null;try{const t=JSON.parse(e);return{...typeof t.type=="string"?{type:t.type}:{},...typeof t.error?.message=="string"?{message:t.error.message}:{},...t.response&&typeof t.response=="object"?{response:t.response}:{}}}catch{return null}}function vn(e){return Array.isArray(e.response?.output)?e.response.output.flatMap(t=>{if(!t||typeof t!="object")return[];const n=t;return n.type!=="function_call"||typeof n.call_id!="string"||typeof n.name!="string"||typeof n.arguments!="string"?[]:[{callId:n.call_id,name:n.name,arguments:n.arguments}]}):[]}function gn(e){try{const t=JSON.parse(e);if(typeof t.request!="string")return null;const n=t.request.trim();return n?n.slice(0,8e3):null}catch{return null}}function wn(e,t){try{const n=JSON.parse(e);if(typeof n.error=="string"&&n.error.trim())return n.error}catch{}return`Scoutbot could not complete the live lookup (HTTP ${t}).`}function bn(e,t){try{const n=JSON.parse(e);if(typeof n.error=="string"&&n.error.trim())return n.error}catch{}return`Could not start realtime voice (HTTP ${t}).`}async function he(e,t){return t?(ie(t),new Promise((n,r)=>{const s=()=>r(Se(t));t.addEventListener("abort",s,{once:!0}),e.then(i=>{t.removeEventListener("abort",s),n(i)},i=>{t.removeEventListener("abort",s),r(i)})})):e}async function Pe(e,t){return t?(ie(t),new Promise((n,r)=>{let s=!1;const i=()=>{s=!0,r(Se(t))};t.addEventListener("abort",i,{once:!0}),e.then(c=>{if(t.removeEventListener("abort",i),s||t.aborted){c.getTracks().forEach(f=>f.stop());return}n(c)},c=>{t.removeEventListener("abort",i),s||r(c)})})):e}const Me={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1},yn=/\b(?:airpods?|earbuds?|earphones?|headsets?|headphones?|buds?|hands[- ]?free)\b/iu;function Sn(e){return yn.test(e?.trim()??"")?un:ln}async function Cn(e,t){const n=await Fe(e);let r=await Pe(navigator.mediaDevices.getUserMedia({audio:{...Me,...n?{deviceId:{exact:n.deviceId}}:{}}}),t);if(!n&&e?.trim()){const s=await Fe(e),i=r.getAudioTracks?.()[0]?.label?.trim().toLocaleLowerCase()??"";if(s&&s.label.trim().toLocaleLowerCase()!==i)try{const c=await Pe(navigator.mediaDevices.getUserMedia({audio:{...Me,deviceId:{exact:s.deviceId}}}),t);r.getTracks().forEach(f=>f.stop()),r=c}catch(c){if(t?.aborted)throw r.getTracks().forEach(f=>f.stop()),c}}for(const s of r.getAudioTracks?.()??[])s.contentHint="speech";return r}async function Fe(e){const t=e?.trim().toLocaleLowerCase();if(!t||typeof navigator.mediaDevices.enumerateDevices!="function")return null;try{const n=(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="audioinput"&&r.deviceId&&r.label.trim());return n.find(r=>r.label.trim().toLocaleLowerCase()===t)??n.find(r=>{const s=r.label.trim().toLocaleLowerCase();return s.includes(t)||t.includes(s)})??null}catch{return null}}function ie(e){if(e?.aborted)throw Se(e)}function Se(e){return e.reason instanceof Error?e.reason:new DOMException("Realtime voice connection was cancelled.","AbortError")}async function kn(e){return(await fetch(`${Ge}/${encodeURIComponent(e)}`,{method:"PUT"})).ok}async function En(e){const t=await fetch(`${Ge}/${encodeURIComponent(e)}`,{method:"DELETE",keepalive:!0});if(!t.ok&&t.status!==404)throw new Error(`Could not release realtime voice lease (HTTP ${t.status}).`)}const xn=[{id:"home",label:"Home",description:"Fleet overview, briefings, and recent activity.",route:{view:"inbox"}},{id:"projects",label:"Projects",description:"Projects, agents, and project-scoped work.",route:{view:"agents-v2"},deepActions:["Open a project by projectSlug.","Open an agent by agentId."]},{id:"sessions",label:"Sessions",description:"Active and recent harness sessions.",route:{view:"sessions"},deepActions:["Open a session by sessionId."]},{id:"messages",label:"Messages",description:"Direct conversations and channels.",route:{view:"messages"},deepActions:["Open a conversation by conversationId.","Filter by all, direct messages, or channels."]},{id:"dispatch",label:"Dispatch",description:"Requests, flights, work, and delivery state.",route:{view:"broker"}},{id:"search",label:"Search",description:"Knowledge and indexed workspace search.",route:{view:"search"}},{id:"operations",label:"Operations",description:"Mission Control, live activity, agent lanes, runtime, and mesh health.",route:{view:"ops",mode:"mission"}},{id:"repositories",label:"Repositories",description:"Repository and worktree status, including diffs.",route:{view:"repos"},deepActions:["Open a repository by absolute root."]},{id:"code-browser",label:"Code Browser",description:"Read files in a project or worktree.",route:{view:"code"},deepActions:["Select a project with the project field; it accepts the displayed project name or slug.","Open a file inside it with path and optional wt.","Alternatively use absolute root and file fields.","Focus a line with line and optional endLine.","Deep links: scout://{project}/{path}, scout:///{absolute/path}, or legacy scout://code/{project}/{path}."]},{id:"terminals",label:"Terminals",description:"Observe or take over terminal sessions.",route:{view:"terminal"}},{id:"settings",label:"Settings",description:"Connections, agents, communications, credentials, voice, and devices.",route:{view:"settings"}}],An=[{id:"comms",label:"Comms",description:"Native conversations and channels.",route:{view:"messages"},deepActions:["Open a conversation by conversationId.","Open a channel by channelId."]},{id:"projects",label:"Projects",description:"Native project and agent browser.",route:{view:"agents-v2"},deepActions:["Filter to a project by projectSlug.","Select an agent by agentId."]},{id:"terminals",label:"Terminals",description:"Native terminal workspace.",route:{view:"terminal"},deepActions:["Select an agent terminal by agentId."]},{id:"tail",label:"Tail",description:"Live agent and harness activity.",route:{view:"ops",mode:"tail"}},{id:"dispatch",label:"Dispatch",description:"Dispatch and coordination overview.",route:{view:"broker"}},{id:"agent-lanes",label:"Agent Lanes",description:"Native lane overview for active agents.",route:{view:"ops",mode:"lanes"}},{id:"repositories",label:"Repositories",description:"Native repository and worktree status.",route:{view:"repos"}},{id:"code-browser",label:"Code Browser",description:"Embedded read-only project browser.",route:{view:"code"},deepActions:["Select a project with the project field; it accepts the displayed project name or slug.","Open a file inside it with path and optional wt.","Alternatively use absolute root and file fields.","Focus a line with line and optional endLine.","Deep links: scout://{project}/{path}, scout:///{absolute/path}, or legacy scout://code/{project}/{path}."]},{id:"settings",label:"Settings",description:"Native app settings; Voice is directly addressable.",route:{view:"settings"},deepActions:["Open Voice settings with section=voice."]}];function Tn(e){const t=e==="macos";return{host:e,shellLabel:t?"Scout for macOS":"OpenScout web",destinations:t?An:xn,rules:["When asked what navigation is available, list only these human labels and short descriptions.","Never expose internal Route.view names, aliases, URL fragments, or implementation vocabulary in the human reply.","Emit only a destination route or deep action explicitly described by this host context.","If the requested destination or deep action is absent, say it is not available in this app instead of approximating it with another page."]}}const Rn="scout:scoutbot-realtime-reply",me="scout:scoutbot-session-changed",In={enabled:!1,open:!1,state:"idle",leaseId:null,error:null,trace:[],chatState:null,sessionAction:null,setOpen:()=>{},startCall:async()=>{},endCall:async()=>!0,startNewChat:async()=>{},switchChat:async()=>{},updatePreferredModel:async e=>e,clearTrace:()=>{},openVoiceSettings:()=>{}},Xe=o.createContext(In);function Nn({children:e}){const{route:t,applyScoutbotUiAction:n}=et(),r=Ue(Qe,!1),[s,i]=o.useState(!1),[c,f]=o.useState("idle"),[d,h]=o.useState(null),[m,R]=o.useState(null),[j,L]=o.useState([]),[u,w]=o.useState(null),[C,N]=o.useState(null),k=o.useRef(null),A=o.useRef(null),D=o.useRef(null),I=o.useRef(0),p=o.useRef(!1),v=o.useRef(!1),S=o.useRef({route:t,applyScoutbotUiAction:n});S.current={route:t,applyScoutbotUiAction:n};const y=o.useCallback((b,E,T="voice")=>{L(P=>[...P,{id:`voice-ui-${Date.now()}-${P.length}`,at:Date.now(),kind:T,label:b,...E?{detail:E}:{}}].slice(-100))},[]),g=o.useCallback(()=>L([]),[]),O=o.useCallback(async()=>{const b=await V("/api/scoutbot/session");return p.current||w(b),b},[]);o.useEffect(()=>{if(!r)return;const b=()=>{O().catch(E=>{p.current||R(E instanceof Error?E.message:"Could not load Scoutbot chats.")})};return b(),window.addEventListener(me,b),()=>window.removeEventListener(me,b)},[r,O]);const _=o.useCallback(async()=>{I.current+=1;const b=D.current;A.current?.abort(),A.current=null;const E=k.current;k.current=null;try{await E?.stop(),await b}catch(T){return p.current||(f("error"),R(T instanceof Error?T.message:"Could not end realtime voice cleanly.")),!1}return p.current||(h(null),f("ended"),y("Live voice ended","Microphone and host lease released","voice")),!0},[y]);o.useEffect(()=>{r||(i(!1),(k.current||c==="connecting"||c==="live")&&_())},[r,_,c]),o.useEffect(()=>(p.current=!1,()=>{p.current=!0,I.current+=1,A.current?.abort(),A.current=null,k.current?.stop().catch(()=>{}),k.current=null}),[]);const $=o.useCallback(async b=>{window.dispatchEvent(new CustomEvent(Rn,{detail:{body:b}}));const E=b.replace(/```[\s\S]*?```/gu,"").trim();E&&y("Scoutbot replied",E.slice(0,2e3),"scoutbot");let T=0,P=0,z=0;for(const B of qe(b))if(B.type==="ask-agent")T+=1,await jn(B,y,R)?P+=1:z+=1;else if(B.type!=="reminder"){const M=_n(B),q=B.type==="navigate"||B.type==="view-file"?"navigation":"scoutbot";y(Ln(B),M,q),S.current.applyScoutbotUiAction(B),y(_e()?"Action sent to Scout for macOS":"Action applied in OpenScout",M,q)}return await O().catch(()=>null),{agentRequests:{requested:T,sent:P,failed:z}}},[y,O]),Z=o.useCallback(()=>{const b={type:"navigate",route:{view:"settings",section:"voice"}};y("Voice settings requested",void 0,"navigation"),S.current.applyScoutbotUiAction(b)},[y]),ee=o.useCallback(async()=>{if(!r){R("Turn on live voice in Settings → Voice before starting a call."),i(!1);return}if(v.current||c==="connecting"||c==="live")return;v.current=!0,A.current?.abort();const b=k.current;k.current=null;try{await b?.stop(),h(null)}catch(M){f("error"),R(M instanceof Error?M.message:"Could not end the previous realtime voice call."),v.current=!1;return}const E=new AbortController;A.current=E;const T=I.current+1;I.current=T;let P=()=>{};const z=new Promise(M=>{P=M});D.current=z;let B=!1;R(null),L([{id:"connecting",at:Date.now(),label:"Connecting secure audio"}]),f("connecting");try{const M=await Tt().then(({settings:U})=>U.inputDeviceName).catch(()=>null),q=await pn({signal:E.signal,inputDeviceName:M,getRoute:()=>S.current.route,getUiContext:()=>Tn(_e()?"macos":"web"),onState:U=>{!p.current&&I.current===T&&f(U)},onError:U=>{if(!(p.current||I.current!==T)){if(Ye(U)){y("Scoutbot reply queued","Waiting for the current spoken response to finish","scoutbot");return}R(U),y("Voice issue",U,"error")}},onTrace:U=>{!p.current&&I.current===T&&L(J=>[...J,U].slice(-100))},onScoutbotReply:U=>!p.current&&I.current===T?$(U):{agentRequests:{requested:0,sent:0,failed:0}}});if(p.current||E.signal.aborted||I.current!==T){await q.stop();return}k.current=q,h(q.leaseId),B=!0}catch(M){if(!p.current&&I.current===T&&!On(M)){f("error");const q=M instanceof Error?M.message:"Could not start realtime voice.";R(q),y("Live voice could not start",q,"error")}}finally{!B&&A.current===E&&(A.current=null),P(),D.current===z&&(D.current=null),v.current=!1}},[y,$,r,c]),te=o.useCallback(async()=>{if(!C){N("new"),R(null);try{if((k.current||c==="connecting"||c==="live")&&!await _())return;if(u?.session.messages.length===0){L([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"New live chat ready"}]);return}const b=await V("/api/scoutbot/session/reset",{method:"POST"});w(b),L([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"New live chat ready"}]),window.dispatchEvent(new CustomEvent(me,{detail:{id:b.session.id}}))}catch(b){const E=b instanceof Error?b.message:"Could not start a new Scoutbot chat.";R(E),y("Could not start a new live chat",E,"error")}finally{N(null)}}},[y,u?.session.messages.length,_,C,c]),ne=o.useCallback(async b=>{if(!(!b||C||b===u?.session.id)){N(b),R(null);try{if((k.current||c==="connecting"||c==="live")&&!await _())return;const E=await V("/api/scoutbot/session/switch",{method:"POST",body:JSON.stringify({id:b})});w(E),L([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"Live chat restored",detail:E.session.title}]),window.dispatchEvent(new CustomEvent(me,{detail:{id:E.session.id}}))}catch(E){const T=E instanceof Error?E.message:"Could not switch Scoutbot chats.";R(T),y("Could not restore the live chat",T,"error")}finally{N(null)}}},[y,u?.session.id,_,C,c]),re=o.useCallback(async b=>{const E=b.trim();if(!E)throw new Error("Preferred model is required.");const T=await V("/api/scoutbot/config",{method:"POST",body:JSON.stringify({model:E})});return w(P=>P&&{...P,config:{...P.config,...T.config}}),y("Scoutbot preferred model updated",T.config.model,"scoutbot"),T.config.model},[y]),ae=o.useMemo(()=>({enabled:r,open:s,state:c,leaseId:d,error:m,trace:j,chatState:u,sessionAction:C,setOpen:i,startCall:ee,endCall:_,startNewChat:te,switchChat:ne,updatePreferredModel:re,clearTrace:g,openVoiceSettings:Z}),[r,s,c,d,m,j,u,C,ee,_,te,ne,re,g,Z]);return a.jsx(Xe.Provider,{value:ae,children:e})}function On(e){return(e instanceof DOMException||e instanceof Error)&&e.name==="AbortError"}function Er(){return o.useContext(Xe)}function Ln(e){return e.type==="navigate"?"Navigation requested":e.type==="open-scoutbot"?"Scoutbot opened its panel":e.type==="refresh"?"Scoutbot refreshed live state":"Scoutbot opened the requested file"}function _n(e){return e.type==="navigate"?JSON.stringify(e.route):e.type==="view-file"?e.path:e.reason?.trim()||e.type}async function jn(e,t,n){t("Scoutbot is coordinating",`Asking ${e.targetLabel}`,"agent");try{const r=await V("/api/scoutbot/actions/ask",{method:"POST",body:JSON.stringify({targetLabel:e.targetLabel,targetAgentId:e.targetAgentId,body:e.body,channel:e.channel})});return t("Scoutbot sent the request",r.flightId?`${r.targetAgentId??r.targetLabel} · run ${r.flightId}`:r.targetAgentId??r.targetLabel,"agent"),!0}catch(r){const s=r instanceof Error?r.message:"Could not send to agent.";return t("Scoutbot could not send the request",s,"error"),n(s),!1}}function we(e,t){const n=t?.trim();n&&e.add(n)}function Dn(e,t){const n=new Set;return we(n,e.authorityNodeId),we(n,e.homeNodeId),n.size===0&&we(n,t),n}function Ze(e,t,n){return t?Dn(e,n).has(t):!0}function Pn(e,t,n){return t?e.filter(r=>Ze(r,t,n)):e}function xr(e,t,n){return t?new Set(e.filter(r=>Ze(r,t,n)).map(r=>r.id)):null}function Q(e,t,n){return!t&&!n||n&&e.authorityNodeId===n?!0:t?e.agentId&&t.has(e.agentId)||e.actorId&&t.has(e.actorId)||e.ownerId&&t.has(e.ownerId)||e.nextMoveOwnerId&&t.has(e.nextMoveOwnerId)?!0:!!e.participantIds?.some(r=>t.has(r)):!1}function Mn(e,t,n){return Q(e,t,n)}function Ar(e,t,n){return!t&&!n?e:e.filter(r=>Mn(r,t,n))}function Fn(e,t){return Q(e,t)}function Bn(e,t){return t?e.filter(n=>Fn(n,t)):e}function Be(e,t){return Q(e,t)}function Tr(e,t){if(!e||!t)return e;const n=e.activeAsks.filter(c=>Q(c,t)),r=e.recentCompleted.filter(c=>Q(c,t)),s=e.needsAttention.filter(c=>Q(c,t)),i=Bn(e.activity,t);return{...e,totals:{active:n.length,recentCompleted:r.length,needsAttention:s.length,activity:i.length},activeAsks:n,recentCompleted:r,needsAttention:s,activity:i}}function Rr(e,t){if(!t)return e;const n=e.activeFlights.filter(i=>Q(i,t)),r=e.childWork.filter(i=>Be(i,t));return Be(e,t)||n.length>0||r.length>0?{...e,activeFlights:n,childWork:r}:null}function Un(e){return!!(e&&(e.message.trim().length>0||e.files.length>0||e.forwardContext))}function qn(e){return[e.name,e.type,e.size,e.lastModified].join(":")}function Hn(e,t){const n=new Set;return[...e,...t].filter(r=>{const s=qn(r);return n.has(s)?!1:(n.add(s),!0)})}function Vn(e,t){const n=t.intent??e?.intent??"new-task",r=n==="route-capture",s=n==="forward-message";return{intent:n,...r&&(t.agentId??e?.agentId)?{agentId:t.agentId??e?.agentId}:{},...r&&(t.conversationId??e?.conversationId)?{conversationId:t.conversationId??e?.conversationId}:{},message:t.message??e?.message??"",files:Hn(e?.files??[],t.files??[]),attachmentFeedback:t.attachmentFeedback??e?.attachmentFeedback??null,mode:r?t.preferExistingChat===void 0?e?.mode??"new-session":t.preferExistingChat?"existing-chat":"new-session":"new-session",projectPath:t.projectPath??e?.projectPath??"",projectQuery:e?.projectQuery??"",...s&&(t.forwardContext??e?.forwardContext)?{forwardContext:t.forwardContext??e?.forwardContext}:{},forwardContextMode:s?t.forwardContextMode??e?.forwardContextMode??"selected-message":"selected-message"}}function $n({request:e,onClose:t,onOpenCapture:n}){const{agents:r,route:s,navigate:i}=et(),c=lt(s),f=Pn(r,c),d=It(s,f),[h,m]=o.useState(0),[R,j]=o.useState(null),[L,u]=o.useState(null),w=o.useRef(0),C=e?Vn(L,e):null,N=o.useCallback((A,D)=>{if(A.length===0)return;const I=!!(d.agentId||d.conversationId);n({intent:I?"route-capture":"new-task",files:A,attachmentFeedback:D,agentId:d.agentId??void 0,conversationId:d.conversationId??void 0,preferExistingChat:d.canUseExistingChat})},[n,d]);o.useEffect(()=>{if(!R)return;const A=window.setTimeout(()=>j(null),5e3);return()=>window.clearTimeout(A)},[R]),o.useEffect(()=>{const A=S=>{pe(S.dataTransfer)&&(S.preventDefault(),w.current+=1,m(w.current))},D=S=>{pe(S.dataTransfer)&&(S.preventDefault(),S.dataTransfer&&(S.dataTransfer.dropEffect="copy"))},I=()=>{w.current!==0&&(w.current=Math.max(0,w.current-1),m(w.current))},p=S=>{if(!pe(S.dataTransfer))return;S.preventDefault();const y=je(S.dataTransfer),g=y.filter(De),O=y.length-g.length;if(w.current=0,m(0),g.length===0){j(y.length===0?"Scout could not read that file. Try the attachment picker instead.":"That file type is not supported. Drop markdown, code, an image, or a video clip.");return}const _=g.length===1?`Dropped ${g[0]?.name||"1 attachment"}.`:`Dropped ${g.length} attachments.`,$=O>0?`${_} Skipped ${O} unsupported ${O===1?"file":"files"}.`:_;j(null),N(g,$)},v=S=>{if(Rt(S.target)||!pe(S.clipboardData))return;S.preventDefault();const y=je(S.clipboardData),g=y.filter(De);if(g.length===0){j(y.length===0?"Scout could not read that pasted file. Try the attachment picker instead.":"That pasted file type is not supported. Paste an image or video, or attach markdown or code.");return}N(g,g.length===1?`Pasted ${g[0]?.name||"1 attachment"}.`:`Pasted ${g.length} attachments.`)};return window.addEventListener("dragenter",A),window.addEventListener("dragover",D),window.addEventListener("dragleave",I),window.addEventListener("drop",p),window.addEventListener("paste",v),()=>{window.removeEventListener("dragenter",A),window.removeEventListener("dragover",D),window.removeEventListener("dragleave",I),window.removeEventListener("drop",p),window.removeEventListener("paste",v)}},[N]);const k=h>0&&!e;return a.jsxs(a.Fragment,{children:[k?a.jsx("div",{className:"s-capture-drop",role:"presentation",children:a.jsxs("div",{className:"s-capture-drop-card",children:[a.jsx("div",{className:"s-capture-drop-title",children:"Route capture"}),a.jsx("div",{className:"s-capture-drop-copy",children:"Drop markdown, code, an image, or a video clip to send it to the right agent or chat."})]})}):null,R?a.jsx("div",{className:"s-capture-feedback",role:"alert",children:R}):null,e?a.jsx(Nt,{agents:f,route:s,navigate:i,onClose:t,initialAgentId:C?.agentId,initialConversationId:C?.conversationId,initialMessage:C?.message,initialFiles:C?.files,initialAttachmentFeedback:C?.attachmentFeedback??void 0,initialIntent:C?.intent,initialProjectPath:C?.projectPath,initialProjectQuery:C?.projectQuery,initialForwardContext:C?.forwardContext,initialForwardContextMode:C?.forwardContextMode,defaultMode:C?.mode,draftRestored:Un(L),onDraftChange:u,onDraftConsumed:()=>u(null)}):null]})}const Ce=o.createContext(null),Jn=["hello","node.upserted","actor.registered","agent.registered","agent.endpoint.upserted","invocation.requested","flight.updated","delivery.state.changed","scout.dispatched"],Kn=new Set(Jn),zn=3e4,Wn=250;function Gn(e,t){try{return JSON.stringify(e)===JSON.stringify(t)?e:t}catch{return t}}const Qn={"--hud-bg":"oklch(0.118 0.004 260)","--hud-surface":"oklch(0.205 0.005 260)","--hud-ink":"oklch(0.975 0.006 260)","--hud-muted":"oklch(0.80 0.008 260)","--hud-dim":"oklch(0.70 0.007 260)","--hud-border":"oklch(0.975 0.006 260 / 0.08)","--hud-accent":"oklch(0.86 0.17 125)","--hud-accent-soft":"oklch(0.86 0.17 125 / 0.08)","--hud-shadow-soft":"oklch(0.08 0.004 260 / 0.42)","--hud-chrome-border":"oklch(0.975 0.006 260 / 0.04)","--hud-shadow-panel":"0 12px 34px oklch(0.08 0.004 260 / 0.45)","--hud-shadow-panel-hover":"0 14px 38px oklch(0.08 0.004 260 / 0.52)","--hud-shadow-bar":"0 -10px 28px oklch(0.08 0.004 260 / 0.38)","--hud-shadow-nav":"0 8px 24px oklch(0.08 0.004 260 / 0.32)","--hud-shadow-minimap":"0 10px 24px oklch(0.08 0.004 260 / 0.38)","--hud-status-ok":"oklch(0.80 0.15 155)","--hud-status-warn":"oklch(0.82 0.15 85)","--hud-status-error":"oklch(0.72 0.18 25)","--background":"0.132 0.004 260","--foreground":"0.965 0.006 260","--card":"0.178 0.005 260","--card-foreground":"0.965 0.006 260","--popover":"0.178 0.005 260","--popover-foreground":"0.965 0.006 260","--muted-foreground":"0.72 0.008 260","--scrim":"rgba(0, 0, 0, 0.5)","--scrim-soft":"rgba(0, 0, 0, 0.3)","--info":"#62b6ff","--shadow-card":"0 8px 22px rgba(0, 0, 0, 0.22)","--shadow-card-hover":"0 14px 36px rgba(0, 0, 0, 0.30)","--cat-gold":"#d7a978","--cat-purple":"#c58cff","--cat-sky":"#38bdf8","--scout-chrome-ink-strong":"color-mix(in srgb, var(--hud-ink) 94%, transparent)","--scout-chrome-ink":"color-mix(in srgb, var(--hud-ink) 84%, transparent)","--scout-chrome-ink-soft":"color-mix(in srgb, var(--hud-ink) 68%, transparent)","--scout-chrome-ink-faint":"color-mix(in srgb, var(--hud-ink) 64%, transparent)","--scout-chrome-ink-ghost":"color-mix(in srgb, var(--hud-ink) 56%, transparent)","--scout-chrome-hover":"color-mix(in srgb, var(--hud-ink) 5%, transparent)","--scout-chrome-active":"color-mix(in srgb, var(--hud-ink) 9%, transparent)","--scout-chrome-border-soft":"color-mix(in srgb, var(--hud-ink) 8%, transparent)","--scout-chrome-avatar-ink":"#111111","--hud-font-sans":"'Inter', ui-sans-serif, system-ui, sans-serif","--hud-font-mono":"'JetBrains Mono', ui-monospace, Menlo, monospace","--hud-font-serif":"'Spectral', 'Cormorant Garamond', Georgia, serif","--hud-font-accent-title":"'Inter Tight', var(--hud-font-sans)"},Yn={"--hud-bg":"oklch(0.982 0.008 78)","--hud-surface":"oklch(0.994 0.006 78)","--hud-ink":"oklch(0.26 0.018 72)","--hud-muted":"oklch(0.50 0.028 70)","--hud-dim":"oklch(0.64 0.022 72)","--hud-border":"oklch(0.86 0.016 75 / 0.92)","--hud-accent":"oklch(0.72 0.16 125)","--hud-accent-soft":"oklch(0.72 0.16 125 / 0.11)","--hud-shadow-soft":"oklch(0.42 0.02 70 / 0.11)","--hud-status-ok":"oklch(0.64 0.16 155)","--hud-status-warn":"oklch(0.72 0.15 85)","--hud-status-error":"oklch(0.62 0.19 25)","--background":"0.978 0.004 85","--foreground":"0.24 0.01 80","--card":"0.992 0.003 85","--card-foreground":"0.24 0.01 80","--popover":"0.992 0.003 85","--popover-foreground":"0.24 0.01 80","--muted-foreground":"0.56 0.014 80","--scrim":"rgba(28, 24, 20, 0.30)","--scrim-soft":"rgba(28, 24, 20, 0.16)","--info":"#2f7fd6","--shadow-card":"0 8px 22px oklch(0.42 0.02 70 / 0.09)","--shadow-card-hover":"0 14px 36px oklch(0.42 0.02 70 / 0.13)","--cat-gold":"#a9824f","--cat-purple":"#8b5cf6","--cat-sky":"#0ea5e9","--scout-chrome-ink-strong":"color-mix(in srgb, var(--hud-ink) 94%, transparent)","--scout-chrome-ink":"color-mix(in srgb, var(--hud-ink) 78%, transparent)","--scout-chrome-ink-soft":"color-mix(in srgb, var(--hud-ink) 60%, transparent)","--scout-chrome-ink-faint":"color-mix(in srgb, var(--hud-ink) 56%, transparent)","--scout-chrome-ink-ghost":"color-mix(in srgb, var(--hud-ink) 50%, transparent)","--scout-chrome-hover":"color-mix(in srgb, var(--hud-ink) 4%, transparent)","--scout-chrome-active":"color-mix(in srgb, var(--hud-ink) 8%, transparent)","--scout-chrome-border-soft":"color-mix(in srgb, var(--hud-border) 80%, transparent)","--scout-chrome-avatar-ink":"#ffffff","--hud-font-sans":"'Inter', ui-sans-serif, system-ui, sans-serif","--hud-font-mono":"'JetBrains Mono', ui-monospace, Menlo, monospace","--hud-font-serif":"'Spectral', 'Cormorant Garamond', Georgia, serif","--hud-font-accent-title":"'Inter Tight', var(--hud-font-sans)"},Xn=new Set(["--hud-bg","--hud-surface","--hud-ink","--hud-muted","--hud-dim","--hud-border","--hud-accent","--hud-accent-soft","--hud-shadow-soft","--hud-chrome-border","--hud-shadow-panel","--hud-shadow-panel-hover","--hud-shadow-bar","--hud-shadow-nav","--hud-shadow-minimap","--hud-status-ok","--hud-status-warn","--hud-status-error"]);function Zn(e){return Object.fromEntries(Object.entries(e==="light"?Yn:Qn).filter(([n])=>!Xn.has(n)))}function Ir(){return o.useContext(Ce)}function et(){const e=o.useContext(Ce);if(!e)throw new Error("useScout must be used inside ScoutProvider");return e}function Nr({children:e,initialTheme:t="dark"}){const{route:n,navigate:r,navigateBack:s,canNavigateBack:i}=ut(),c=Ot(),f=Ue(Qe,!1),[d,h]=o.useState([]),[m,R]=o.useState(!1),[j,L]=o.useState({status:"checking",message:null,lastCheckedAt:null}),[u,w]=o.useState(Oe),[C,N]=o.useState(null),k=o.useRef(!1),[A,D]=o.useState(Mt),[I,p]=o.useState(!1),[v,S]=o.useState(null),[y,g]=o.useState(null),[O,_]=o.useState(""),[$,Z]=o.useState(null),ee=n.view==="settings",te=o.useMemo(()=>n.view!=="broker"||!n.attemptId?null:v?.id===n.attemptId?v:null,[v,n]),ne=o.useMemo(()=>n.view!=="search"||!n.hitId?null:y?.id===n.hitId?y:null,[y,n]),re=o.useMemo(()=>n.view==="agents-v2"&&n.agentId&&n.sessionId?{agentId:n.agentId,sessionId:n.sessionId}:n.view==="sessions"&&n.sessionId?{agentId:n.agentId??"",sessionId:n.sessionId}:null,[n]),ae=o.useCallback((l,x)=>{if(n.view==="agents-v2"&&n.agentId===l){r({...n,sessionId:x},{replace:!0});return}if(n.view==="sessions"){r({view:"sessions",sessionId:x,agentId:l},{replace:!0});return}r({view:"agents-v2",agentId:l,sessionId:x},{replace:!0})},[r,n]),b=o.useCallback(()=>{r({view:"settings",section:"appearance"})},[r]),E=o.useCallback(()=>{n.view==="settings"&&r({view:"inbox"})},[r,n.view]),T=o.useCallback(l=>{Z(l??{intent:"new-task"})},[]),P=o.useCallback(()=>Z(null),[]),z=o.useCallback(l=>{S(l),!(n.view==="broker"&&n.attemptId===l.id)&&r({view:"broker",attemptId:l.id,...n.view==="broker"&&n.filter?{filter:n.filter}:{}},{replace:n.view==="broker"})},[r,n]),B=o.useCallback(()=>{S(null),n.view==="broker"&&n.attemptId&&r({view:"broker",...n.filter?{filter:n.filter}:{}},{replace:!0})},[r,n]),M=o.useCallback((l,x,F)=>{if(g(l),typeof x=="string"&&_(x.trim()),n.view==="search"&&n.hitId===l.id)return;const H=F??(n.view==="search"?n.filters:void 0);r({view:"search",...n.view==="search"&&n.mode?{mode:n.mode}:{},...H?{filters:H}:{},hitId:l.id},{replace:n.view==="search"})},[r,n]),q=o.useCallback(()=>{g(null),_(""),n.view==="search"&&n.hitId&&r({view:"search",...n.mode?{mode:n.mode}:{},...n.filters?{filters:n.filters}:{}},{replace:!0})},[r,n]),U=o.useMemo(()=>st(),[]),J=c?.resolvedTheme??t,ve=c?.template??"hudson",tt=o.useMemo(()=>({...Zn(J),...U??{}}),[U,J]),ke=o.useCallback(l=>{w(x=>({...x,...l}))},[]);o.useEffect(()=>{it(J,ve,u),at(u)},[ve,u,J]),o.useEffect(()=>{const l=x=>{x.key!==null&&x.key!==ct||w(Oe())};return window.addEventListener("storage",l),()=>window.removeEventListener("storage",l)},[]);const Ee=o.useMemo(()=>mt(d),[d]),xe=Ee?.id??vt(d),Ae=Ee?.conversationId??null,ce=o.useRef(null),Y=o.useRef(null),le=n.view==="ops"?"/api/agents":"/api/agents?detail=summary",ue=o.useCallback(()=>{L({status:"online",message:null,lastCheckedAt:Date.now()})},[]),de=o.useCallback(l=>{const x=_t(l);L({status:jt(x)?"offline":"degraded",message:x,lastCheckedAt:Date.now()})},[]),K=o.useCallback(async()=>{const l=ce.current;if(l&&(await l.promise,l.url===le))return;const x=(async()=>{try{const F=await V(le);h(H=>Gn(H,F)),ue()}catch(F){de(F)}finally{R(!0)}})();ce.current={url:le,promise:x};try{await x}finally{ce.current?.promise===x&&(ce.current=null)}},[le,de,ue]),W=o.useCallback(async()=>{try{const l=await V("/api/onboarding/state");k.current=!1,N(l);const x=l.operatorName?.trim()||l.operatorNameSuggestion?.trim()||null;D(x),Ft(x),ue()}catch(l){de(l),k.current=!0,N({hasLocalConfig:!0,hasProjectConfig:!0,hasOperatorName:!0,localConfigPath:null,projectRoot:null,currentDirectory:null,operatorName:null,operatorNameSuggestion:null,needed:!1})}},[de,ue]),Te=o.useCallback(()=>{p(!0),V("/api/onboarding/skip",{method:"POST",body:"{}"}).then(()=>W()).catch(()=>null)},[W]);o.useEffect(()=>{K(),W()},[K,W]),o.useEffect(()=>{const l=()=>{Le()&&(K(),k.current&&W())},x=window.setInterval(l,zn),F=ft(l);return()=>{window.clearInterval(x),F()}},[K,W]);const Re=o.useMemo(()=>d.filter(l=>pt(l.state)).length,[d]),[nt,Ie]=o.useState(null),oe=o.useCallback(l=>{l?.trim()&&Ie(l.trim())},[]),se=o.useCallback(()=>Ie(null),[]),X=o.useCallback(l=>{if(!gt(l))switch(l.type){case"navigate":r(l.route);break;case"focus-composer":window.dispatchEvent(new CustomEvent("scout:composer-focus"));break;case"open-scoutbot":window.dispatchEvent(new CustomEvent("scout:scoutbot-panel-open",{detail:l}));break;case"refresh":K();break;case"view-file":oe(l.path);break}},[r,oe,K]),rt=o.useCallback((l,x)=>{const F=l.trim(),H=x.trim();if(!F||!H)return;const Ne=n.view==="conversation"||n.view==="messages"?n.conversationId:window.location.pathname==="/embed/thread"&&new URLSearchParams(window.location.search).get("conversationId")?.trim()||void 0;se(),X({type:"navigate",route:{view:"code",root:H,file:F,...Ne?{returnConversationId:Ne}:{}}})},[X,se,n]),fe=o.useRef({applyScoutbotUiAction:X});fe.current={applyScoutbotUiAction:X},dt(l=>{Le()&&Kn.has(l.kind)&&(Y.current!==null&&window.clearTimeout(Y.current),Y.current=window.setTimeout(()=>{Y.current=null,K()},Wn))}),o.useEffect(()=>()=>{Y.current!==null&&window.clearTimeout(Y.current)},[]),o.useEffect(()=>{const l=x=>{const F=x.detail,H=F&&typeof F=="object"&&"type"in F?F:null;H&&fe.current.applyScoutbotUiAction(H)};return window.addEventListener("scout:scoutbot-ui-action",l),window.scoutScoutbot={applyUiAction:x=>fe.current.applyScoutbotUiAction(x),navigate:x=>fe.current.applyScoutbotUiAction({type:"navigate",route:x})},()=>{window.removeEventListener("scout:scoutbot-ui-action",l),window.scoutScoutbot?.applyUiAction&&delete window.scoutScoutbot}},[]);const ot=o.useMemo(()=>({route:n,navigate:r,navigateBack:s,canNavigateBack:i,agents:d,agentsLoaded:m,onlineCount:Re,apiConnection:j,reload:K,appearanceDetails:u,updateAppearanceDetails:ke,onboarding:C,operatorName:A,refreshOnboarding:W,onboardingSkipped:I,skipOnboarding:Te,settingsOpen:ee,openSettings:b,closeSettings:E,scoutbotAgentId:xe,scoutbotConversationId:Ae,applyScoutbotUiAction:X,selectedBrokerAttempt:te,inspectBrokerAttempt:z,clearBrokerAttempt:B,selectedKnowledgeHit:ne,selectedKnowledgeQuery:O,inspectKnowledgeHit:M,clearKnowledgeHit:q,focusedSession:re,focusSession:ae,openFilePreview:oe,closeFilePreview:se,openContextCapture:T,closeContextCapture:P}),[n,r,s,i,d,m,Re,j,K,u,ke,C,A,W,I,Te,ee,b,E,xe,Ae,X,te,z,B,ne,O,M,q,re,ae,oe,se,T,P]);return a.jsx(Ce.Provider,{value:ot,children:a.jsx("div",{"data-scout-theme-mode":J,"data-scout-palette":u.palette,"data-scout-contrast":u.contrast,"data-scout-accent":u.accent,"data-scout-shell":u.shell,"data-scout-avatar-style":u.avatarStyle,"data-hudson-theme":J,"data-hudson-template":ve,style:{...tt},children:a.jsx("div",{"data-scout-theme":J,style:{display:"contents"},children:a.jsx(Lt,{children:a.jsxs(rn,{children:[f?a.jsx(Nn,{children:e}):e,a.jsx(Xt,{path:nt,onOpenPath:oe,onOpenInCode:rt,onClose:se}),a.jsx($n,{request:$,onClose:P,onOpenCapture:T})]})})})})})}export{Lt as C,Qn as D,Yn as L,Ce as S,yr as a,Bn as b,Pn as c,Ar as d,Tr as e,_t as f,Nr as g,Ir as h,jt as i,Rr as j,Ut as k,Er as l,xr as m,Sr as n,Cr as o,Qe as p,me as q,Rn as r,Tn as s,kr as t,et as u};
@@ -1 +1 @@
1
- import{j as r}from"./index-Bli6bTLU.js";import{s as $,b as E}from"./colors-BtO5_zlx.js";import{A as M}from"./AgentAvatar-B1xvQ7ej.js";function q({name:a,meta:i,sub:s,tone:o="neutral",agent:t,avatarName:c,avatarKind:e="user",leadingIcon:n,caret:l,active:j,selected:v,unread:N,depth:f=0,detail:d,expanded:h,activityLabel:w,worktreeLabel:u,activityTone:g="working",actions:p,pinned:x,onClick:k,onKeyDown:b,onContextMenu:y,onPointerEnter:C,onPointerLeave:P,title:R,tabIndex:z}){const A=l?l==="open":d!==void 0?!!h:void 0,B=["rr-row",f===1&&"rr-row--child",j&&"rr-row--active",v&&"rr-row--selected",N&&"rr-row--unread",h&&"rr-row--expanded",w&&"rr-row--motion",x&&"rr-row--pinned",p&&"rr-row--has-actions"].filter(Boolean).join(" ");return r.jsxs("div",{className:B,children:[r.jsxs("button",{type:"button",className:"rr-row-head",onClick:k,onKeyDown:b,onContextMenu:y,onPointerEnter:C,onPointerLeave:P,title:R,tabIndex:z,"aria-expanded":A,children:[r.jsx(T,{icon:n,tone:o,caret:l,agent:t,avatarName:c,avatarKind:e}),r.jsxs("span",{className:"rr-row-body",children:[r.jsxs("span",{className:"rr-row-name",children:[x?r.jsx("span",{className:"rr-row-pin-mark","aria-label":"Pinned",title:"Pinned",children:r.jsx(S,{})}):null,a]}),s&&r.jsx("span",{className:"rr-row-sub",children:s}),u&&r.jsx("span",{className:"rr-row-worktree",children:u}),w&&r.jsxs("span",{className:`rr-row-activity rr-row-activity--${g}`,children:[r.jsxs("span",{className:"rr-row-activity-bars","aria-hidden":!0,children:[r.jsx("span",{}),r.jsx("span",{}),r.jsx("span",{}),r.jsx("span",{})]}),r.jsx("span",{className:"rr-row-activity-label",children:w})]})]}),i&&r.jsx("span",{className:"rr-row-meta",children:i})]}),p?r.jsx("div",{className:"rr-row-actions",onClick:L=>L.stopPropagation(),children:p}):null,h&&d&&r.jsx("div",{className:"rr-row-detail",children:d})]})}function T({icon:a,tone:i,caret:s,agent:o,avatarName:t,avatarKind:c}){if(s)return r.jsx("span",{className:`rr-row-caret rr-row-caret--leading rr-row-caret--${s}`,"aria-hidden":!0,children:r.jsx(G,{open:s==="open"})});if(t||o){if(c==="channel")return r.jsx("span",{className:"rr-row-hash","aria-hidden":!0,children:"#"});const n=m(i),l=n==="active"||n==="available"||n==="working"||n==="in_turn";return r.jsx("span",{className:"rr-row-avatar-wrap","aria-hidden":!0,children:r.jsx(M,{agent:o,name:t??o?.name,placement:"row",size:20,tile:!0,presence:l})})}if(a)return r.jsx("span",{className:"rr-row-icon","aria-hidden":!0,children:a});const e=m(i);return r.jsx("span",{className:`rr-row-dot rr-row-dot--${e}`,style:e==="active"||e==="available"?{background:$(e)}:void 0,"aria-hidden":!0})}function G({open:a}){return r.jsx("svg",{className:`rr-chevron${a?" rr-chevron--open":""}`,viewBox:"0 0 12 12",width:"12",height:"12",fill:"none","aria-hidden":!0,children:r.jsx("path",{d:"M4.25 3L7.75 6L4.25 9",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function m(a){return a==="channel"||a==="dm"||a==="neutral"?a:E(a)}function S(){return r.jsx("svg",{width:"9",height:"9",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M9.8 1.6 14.4 6.2a1 1 0 0 1-.2 1.6l-2.7 1.1-.9 3.4a.7.7 0 0 1-1.2.3L6.3 9.5 2.8 13 1.7 11.9l3.5-3.5L2.1 5.3a.7.7 0 0 1 .3-1.2l3.4-.9 1.1-2.7a1 1 0 0 1 1.6-.2Z"})})}export{q as R};
1
+ import{j as r}from"./index-NRbRrZw-.js";import{s as $,b as E}from"./colors-BtO5_zlx.js";import{A as M}from"./AgentAvatar-CQqJcwOQ.js";function q({name:a,meta:i,sub:s,tone:o="neutral",agent:t,avatarName:c,avatarKind:e="user",leadingIcon:n,caret:l,active:j,selected:v,unread:N,depth:f=0,detail:d,expanded:h,activityLabel:w,worktreeLabel:u,activityTone:g="working",actions:p,pinned:x,onClick:k,onKeyDown:b,onContextMenu:y,onPointerEnter:C,onPointerLeave:P,title:R,tabIndex:z}){const A=l?l==="open":d!==void 0?!!h:void 0,B=["rr-row",f===1&&"rr-row--child",j&&"rr-row--active",v&&"rr-row--selected",N&&"rr-row--unread",h&&"rr-row--expanded",w&&"rr-row--motion",x&&"rr-row--pinned",p&&"rr-row--has-actions"].filter(Boolean).join(" ");return r.jsxs("div",{className:B,children:[r.jsxs("button",{type:"button",className:"rr-row-head",onClick:k,onKeyDown:b,onContextMenu:y,onPointerEnter:C,onPointerLeave:P,title:R,tabIndex:z,"aria-expanded":A,children:[r.jsx(T,{icon:n,tone:o,caret:l,agent:t,avatarName:c,avatarKind:e}),r.jsxs("span",{className:"rr-row-body",children:[r.jsxs("span",{className:"rr-row-name",children:[x?r.jsx("span",{className:"rr-row-pin-mark","aria-label":"Pinned",title:"Pinned",children:r.jsx(S,{})}):null,a]}),s&&r.jsx("span",{className:"rr-row-sub",children:s}),u&&r.jsx("span",{className:"rr-row-worktree",children:u}),w&&r.jsxs("span",{className:`rr-row-activity rr-row-activity--${g}`,children:[r.jsxs("span",{className:"rr-row-activity-bars","aria-hidden":!0,children:[r.jsx("span",{}),r.jsx("span",{}),r.jsx("span",{}),r.jsx("span",{})]}),r.jsx("span",{className:"rr-row-activity-label",children:w})]})]}),i&&r.jsx("span",{className:"rr-row-meta",children:i})]}),p?r.jsx("div",{className:"rr-row-actions",onClick:L=>L.stopPropagation(),children:p}):null,h&&d&&r.jsx("div",{className:"rr-row-detail",children:d})]})}function T({icon:a,tone:i,caret:s,agent:o,avatarName:t,avatarKind:c}){if(s)return r.jsx("span",{className:`rr-row-caret rr-row-caret--leading rr-row-caret--${s}`,"aria-hidden":!0,children:r.jsx(G,{open:s==="open"})});if(t||o){if(c==="channel")return r.jsx("span",{className:"rr-row-hash","aria-hidden":!0,children:"#"});const n=m(i),l=n==="active"||n==="available"||n==="working"||n==="in_turn";return r.jsx("span",{className:"rr-row-avatar-wrap","aria-hidden":!0,children:r.jsx(M,{agent:o,name:t??o?.name,placement:"row",size:20,tile:!0,presence:l})})}if(a)return r.jsx("span",{className:"rr-row-icon","aria-hidden":!0,children:a});const e=m(i);return r.jsx("span",{className:`rr-row-dot rr-row-dot--${e}`,style:e==="active"||e==="available"?{background:$(e)}:void 0,"aria-hidden":!0})}function G({open:a}){return r.jsx("svg",{className:`rr-chevron${a?" rr-chevron--open":""}`,viewBox:"0 0 12 12",width:"12",height:"12",fill:"none","aria-hidden":!0,children:r.jsx("path",{d:"M4.25 3L7.75 6L4.25 9",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function m(a){return a==="channel"||a==="dm"||a==="neutral"?a:E(a)}function S(){return r.jsx("svg",{width:"9",height:"9",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M9.8 1.6 14.4 6.2a1 1 0 0 1-.2 1.6l-2.7 1.1-.9 3.4a.7.7 0 0 1-1.2.3L6.3 9.5 2.8 13 1.7 11.9l3.5-3.5L2.1 5.3a.7.7 0 0 1 .3-1.2l3.4-.9 1.1-2.7a1 1 0 0 1 1.6-.2Z"})})}export{q as R};
@@ -1 +1 @@
1
- import{r as o,j as n}from"./index-Bli6bTLU.js";/* empty css */import{D as O}from"./DataTable-oJP339bX.js";import{p as W,a as L}from"./api-DEHEgJ9m.js";import{t as U,n as R,f as Y}from"./time-Dhsh_2EG.js";import{u as G}from"./tail-events-CrN-Rmxj.js";import{o as Q}from"./openContent-C6XO6kr5.js";import{u as X}from"./Provider-Ve8yXaWR.js";/* empty css */import"./index-BWHgHrtv.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"./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";const q=1e4,J=500,$=1e3,Z=6e4,D="/api/tail/discover",_=`/api/tail/recent?limit=${J}`,P=3e4,tt=[{key:"status",label:"status",cls:"s-atop-col-status",kind:"text",sortable:!1,defaultWidth:96,minWidth:70,render:t=>n.jsxs("span",{className:`s-atop-status s-atop-status--${t.status}`,children:[n.jsx("span",{className:"s-atop-status-dot","aria-hidden":"true"}),t.statusLabel]})},{key:"session",label:"session",cls:"s-atop-col-agent",kind:"text",sortable:!1,defaultWidth:168,minWidth:110,maxWidth:280,render:t=>n.jsxs("div",{className:"s-atop-agent-cell",title:t.sessionId??t.refId,children:[n.jsx("span",{className:`s-atop-chip s-atop-chip--harness s-atop-chip--harness-${st(t.source)}`,children:t.source}),n.jsx("span",{className:"s-atop-agent-id",children:t.refId.slice(0,8)})]})},{key:"project",label:"project",cls:"s-atop-col-project",kind:"text",sortable:!1,defaultWidth:200,minWidth:96,maxWidth:360,render:t=>n.jsx("span",{title:t.cwd??t.project,children:t.project})},{key:"updated",label:"updated",cls:"s-atop-col-last",kind:"time",sortable:!1,defaultWidth:86,minWidth:64,render:t=>n.jsx("span",{title:Y(t.mtimeMs),children:U(Math.max(R(t.mtimeMs)??0,R(t.lastEvent?.ts)??0))||"-"})},{key:"size",label:"size",cls:"s-atop-col-runtime",kind:"number",sortable:!1,defaultWidth:80,minWidth:64,render:t=>nt(t.size)},{key:"path",label:"path",kind:"text",sortable:!1,defaultWidth:360,minWidth:160,maxWidth:800,render:t=>n.jsx("span",{title:t.transcriptPath,children:t.cwd??t.transcriptPath})}];function z(t){const i=t?.trim();if(!i)return null;const r=F(i);return r.endsWith(".jsonl")?r.slice(0,-6):r}function F(t){const i=t.replace(/[\\/]+$/,"");return i.split(/[\\/]/).filter(Boolean).at(-1)??i}function et(t){const r=t.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean);return r.pop(),r.at(-1)??""}function st(t){return t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function nt(t){if(!Number.isFinite(t)||t<0)return"-";if(t<1024)return`${t} B`;const i=t/1024;if(i<1024)return`${i.toFixed(i>=10?0:1)} KiB`;const r=i/1024;return`${r.toFixed(r>=10?0:1)} MiB`}function at(t,i){return i?[t.refId,t.sessionId??"",t.source,t.project,t.cwd??"",t.transcriptPath,t.lastEvent?.summary??"",t.process?.command??""].join(" ").toLowerCase().includes(i.toLowerCase()):!0}function B(t){return`${t.source}\0${t.cwd??""}`}function ot(t){return`${t.source}\0${t.cwd??""}`}function it(t,i,r){if(!t?.transcripts?.length)return[];const d=new Map;for(const s of i){const l=d.get(s.sessionId);(!l||s.ts>l.ts)&&d.set(s.sessionId,s)}const h=new Map;for(const s of t.processes){if(!s.cwd)continue;const l=h.get(B(s));(!l||s.pid<l.pid)&&h.set(B(s),s)}return t.transcripts.map(s=>{const l=z(s.sessionId)??z(s.transcriptPath);if(!l)return null;const u=s.sessionId?d.get(s.sessionId)??null:null,x=h.get(ot(s))??null,m=Math.max(s.mtimeMs,u?.ts??0),j=!!x||r-m<=Z,p=s.project?.trim()||(s.cwd?F(s.cwd):et(s.transcriptPath))||"unknown";return{refId:l,source:s.source||"unknown",project:p,cwd:s.cwd,transcriptPath:s.transcriptPath,sessionId:s.sessionId,mtimeMs:s.mtimeMs,size:s.size,status:j?"run":"idle",statusLabel:j?"active":"idle",lastEvent:u,process:x}}).filter(s=>s!==null).sort((s,l)=>{const u=Math.max(s.mtimeMs,s.lastEvent?.ts??0);return Math.max(l.mtimeMs,l.lastEvent?.ts??0)-u||s.project.localeCompare(l.project)})}function Gt({navigate:t}){const{route:i}=X(),[r]=o.useState(()=>W(D,P)),[d,h]=o.useState(r),[s,l]=o.useState(()=>W(_,P)?.events??[]),[u,x]=o.useState(r===null),[m,j]=o.useState(""),[p,S]=o.useState("all"),[y,k]=o.useState(0),[N,C]=o.useState(null),[T,V]=o.useState(Date.now()),b=o.useRef(null),I=o.useCallback(async()=>{C(null);try{h(await L(D))}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);o.useEffect(()=>{I();const e=setInterval(()=>{I()},q);return()=>clearInterval(e)},[I]),o.useEffect(()=>{let e=!1;return(async()=>{try{const a=await L(_);e||l(a.events??[])}catch{}})(),()=>{e=!0}},[]),G(e=>{l(a=>a.length>=$?[...a.slice(a.length-$+1),e]:[...a,e])}),o.useEffect(()=>{const e=setInterval(()=>V(Date.now()),15e3);return()=>clearInterval(e)},[]);const f=o.useMemo(()=>it(d,s,T),[d,s,T]),H=o.useMemo(()=>[...new Set(f.map(e=>e.source))].sort(),[f]),c=o.useMemo(()=>f.filter(e=>(p==="all"||e.source===p)&&at(e,m.trim())),[f,p,m]);o.useEffect(()=>{y>=c.length&&k(Math.max(0,c.length-1))},[c.length,y]);const M=o.useCallback(e=>{e&&Q(t,{view:"sessions",sessionId:e.refId},{returnTo:i})},[t,i]);o.useEffect(()=>{const e=a=>{const E=a.target,A=E instanceof HTMLInputElement||E instanceof HTMLTextAreaElement||(E?.isContentEditable??!1);if(a.key==="/"&&!A){a.preventDefault(),b.current?.focus();return}if(A){a.key==="Escape"&&E===b.current&&(j(""),b.current?.blur());return}if(a.key==="ArrowDown"||a.key==="j"){a.preventDefault(),k(w=>c.length===0?0:Math.min(c.length-1,w+1));return}if(a.key==="ArrowUp"||a.key==="k"){a.preventDefault(),k(w=>Math.max(0,w-1));return}(a.key==="Enter"||a.key==="o")&&(a.preventDefault(),M(c[y]))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[c,y,M]);const K=N?[]:c,g=o.useCallback(e=>`${e.source}:${e.transcriptPath}`,[]),v=o.useMemo(()=>new Map(c.map((e,a)=>[g(e),a])),[c,g]);return n.jsxs("div",{className:"s-atop s-atop--sessions",children:[n.jsxs("div",{className:"s-atop-fbar",children:[n.jsxs("label",{className:"s-atop-search",children:[n.jsx("span",{className:"s-atop-search-prompt",children:"/"}),n.jsx("input",{ref:b,className:"s-atop-search-input",placeholder:"filter sessions",value:m,onChange:e=>j(e.target.value)}),n.jsx("kbd",{className:"s-atop-search-kbd",children:"/"})]}),n.jsx("span",{className:"s-atop-fbar-label",children:"source"}),n.jsxs("button",{type:"button",className:`s-atop-pill${p==="all"?" s-atop-pill--on":""}`,onClick:()=>S("all"),children:["all",n.jsx("span",{className:"s-atop-pill-ct",children:f.length})]}),H.map(e=>n.jsxs("button",{type:"button",className:`s-atop-pill${p===e?" s-atop-pill--on":""}`,onClick:()=>S(e),children:[e,n.jsx("span",{className:"s-atop-pill-ct",children:f.filter(a=>a.source===e).length})]},e)),n.jsx("div",{className:"s-atop-fbar-spacer"})]}),n.jsx(O,{rows:K,columns:tt,rowId:g,storageKey:"openscout.sessions.cols",rowBindings:e=>({onMouseEnter:()=>{const a=v.get(e);a!=null&&k(a)},onFocus:()=>{const a=v.get(e);a!=null&&k(a)}}),onRowClick:e=>M(e),rowClassName:e=>v.get(g(e))===y?"s-atop-row--selected":void 0,empty:N?{title:"Discovery failed",body:N}:{title:"No raw sessions",body:m?"No sessions match the current filter.":"No transcript sessions were discovered."},loading:u,density:"compact",className:"s-atop-data-table",ariaLabel:"Raw sessions"}),n.jsxs("div",{className:"s-atop-keys",children:[n.jsxs("span",{children:[n.jsx("kbd",{children:"/"}),"filter"]}),n.jsxs("span",{children:[n.jsx("kbd",{children:"j/k"}),"select"]}),n.jsxs("span",{children:[n.jsx("kbd",{children:"enter"}),"open"]}),n.jsx("span",{className:"s-atop-keys-spacer"}),n.jsxs("span",{className:"s-atop-keys-count",children:[n.jsx("strong",{children:c.length})," sessions"]})]})]})}export{Gt as RawSessionsTable};
1
+ import{r as o,j as n}from"./index-NRbRrZw-.js";/* empty css */import{D as O}from"./DataTable-DFacT2uu.js";import{p as W,a as L}from"./api-DEHEgJ9m.js";import{t as U,n as R,f as Y}from"./time-Dhsh_2EG.js";import{u as G}from"./tail-events-B7BrDaFi.js";import{o as Q}from"./openContent-C6XO6kr5.js";import{u as X}from"./Provider-Cd-QZltN.js";/* empty css */import"./index-BWHgHrtv.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"./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";const q=1e4,J=500,$=1e3,Z=6e4,D="/api/tail/discover",_=`/api/tail/recent?limit=${J}`,P=3e4,tt=[{key:"status",label:"status",cls:"s-atop-col-status",kind:"text",sortable:!1,defaultWidth:96,minWidth:70,render:t=>n.jsxs("span",{className:`s-atop-status s-atop-status--${t.status}`,children:[n.jsx("span",{className:"s-atop-status-dot","aria-hidden":"true"}),t.statusLabel]})},{key:"session",label:"session",cls:"s-atop-col-agent",kind:"text",sortable:!1,defaultWidth:168,minWidth:110,maxWidth:280,render:t=>n.jsxs("div",{className:"s-atop-agent-cell",title:t.sessionId??t.refId,children:[n.jsx("span",{className:`s-atop-chip s-atop-chip--harness s-atop-chip--harness-${st(t.source)}`,children:t.source}),n.jsx("span",{className:"s-atop-agent-id",children:t.refId.slice(0,8)})]})},{key:"project",label:"project",cls:"s-atop-col-project",kind:"text",sortable:!1,defaultWidth:200,minWidth:96,maxWidth:360,render:t=>n.jsx("span",{title:t.cwd??t.project,children:t.project})},{key:"updated",label:"updated",cls:"s-atop-col-last",kind:"time",sortable:!1,defaultWidth:86,minWidth:64,render:t=>n.jsx("span",{title:Y(t.mtimeMs),children:U(Math.max(R(t.mtimeMs)??0,R(t.lastEvent?.ts)??0))||"-"})},{key:"size",label:"size",cls:"s-atop-col-runtime",kind:"number",sortable:!1,defaultWidth:80,minWidth:64,render:t=>nt(t.size)},{key:"path",label:"path",kind:"text",sortable:!1,defaultWidth:360,minWidth:160,maxWidth:800,render:t=>n.jsx("span",{title:t.transcriptPath,children:t.cwd??t.transcriptPath})}];function z(t){const i=t?.trim();if(!i)return null;const r=F(i);return r.endsWith(".jsonl")?r.slice(0,-6):r}function F(t){const i=t.replace(/[\\/]+$/,"");return i.split(/[\\/]/).filter(Boolean).at(-1)??i}function et(t){const r=t.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean);return r.pop(),r.at(-1)??""}function st(t){return t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function nt(t){if(!Number.isFinite(t)||t<0)return"-";if(t<1024)return`${t} B`;const i=t/1024;if(i<1024)return`${i.toFixed(i>=10?0:1)} KiB`;const r=i/1024;return`${r.toFixed(r>=10?0:1)} MiB`}function at(t,i){return i?[t.refId,t.sessionId??"",t.source,t.project,t.cwd??"",t.transcriptPath,t.lastEvent?.summary??"",t.process?.command??""].join(" ").toLowerCase().includes(i.toLowerCase()):!0}function B(t){return`${t.source}\0${t.cwd??""}`}function ot(t){return`${t.source}\0${t.cwd??""}`}function it(t,i,r){if(!t?.transcripts?.length)return[];const d=new Map;for(const s of i){const l=d.get(s.sessionId);(!l||s.ts>l.ts)&&d.set(s.sessionId,s)}const h=new Map;for(const s of t.processes){if(!s.cwd)continue;const l=h.get(B(s));(!l||s.pid<l.pid)&&h.set(B(s),s)}return t.transcripts.map(s=>{const l=z(s.sessionId)??z(s.transcriptPath);if(!l)return null;const u=s.sessionId?d.get(s.sessionId)??null:null,x=h.get(ot(s))??null,m=Math.max(s.mtimeMs,u?.ts??0),j=!!x||r-m<=Z,p=s.project?.trim()||(s.cwd?F(s.cwd):et(s.transcriptPath))||"unknown";return{refId:l,source:s.source||"unknown",project:p,cwd:s.cwd,transcriptPath:s.transcriptPath,sessionId:s.sessionId,mtimeMs:s.mtimeMs,size:s.size,status:j?"run":"idle",statusLabel:j?"active":"idle",lastEvent:u,process:x}}).filter(s=>s!==null).sort((s,l)=>{const u=Math.max(s.mtimeMs,s.lastEvent?.ts??0);return Math.max(l.mtimeMs,l.lastEvent?.ts??0)-u||s.project.localeCompare(l.project)})}function Gt({navigate:t}){const{route:i}=X(),[r]=o.useState(()=>W(D,P)),[d,h]=o.useState(r),[s,l]=o.useState(()=>W(_,P)?.events??[]),[u,x]=o.useState(r===null),[m,j]=o.useState(""),[p,S]=o.useState("all"),[y,k]=o.useState(0),[N,C]=o.useState(null),[T,V]=o.useState(Date.now()),b=o.useRef(null),I=o.useCallback(async()=>{C(null);try{h(await L(D))}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);o.useEffect(()=>{I();const e=setInterval(()=>{I()},q);return()=>clearInterval(e)},[I]),o.useEffect(()=>{let e=!1;return(async()=>{try{const a=await L(_);e||l(a.events??[])}catch{}})(),()=>{e=!0}},[]),G(e=>{l(a=>a.length>=$?[...a.slice(a.length-$+1),e]:[...a,e])}),o.useEffect(()=>{const e=setInterval(()=>V(Date.now()),15e3);return()=>clearInterval(e)},[]);const f=o.useMemo(()=>it(d,s,T),[d,s,T]),H=o.useMemo(()=>[...new Set(f.map(e=>e.source))].sort(),[f]),c=o.useMemo(()=>f.filter(e=>(p==="all"||e.source===p)&&at(e,m.trim())),[f,p,m]);o.useEffect(()=>{y>=c.length&&k(Math.max(0,c.length-1))},[c.length,y]);const M=o.useCallback(e=>{e&&Q(t,{view:"sessions",sessionId:e.refId},{returnTo:i})},[t,i]);o.useEffect(()=>{const e=a=>{const E=a.target,A=E instanceof HTMLInputElement||E instanceof HTMLTextAreaElement||(E?.isContentEditable??!1);if(a.key==="/"&&!A){a.preventDefault(),b.current?.focus();return}if(A){a.key==="Escape"&&E===b.current&&(j(""),b.current?.blur());return}if(a.key==="ArrowDown"||a.key==="j"){a.preventDefault(),k(w=>c.length===0?0:Math.min(c.length-1,w+1));return}if(a.key==="ArrowUp"||a.key==="k"){a.preventDefault(),k(w=>Math.max(0,w-1));return}(a.key==="Enter"||a.key==="o")&&(a.preventDefault(),M(c[y]))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[c,y,M]);const K=N?[]:c,g=o.useCallback(e=>`${e.source}:${e.transcriptPath}`,[]),v=o.useMemo(()=>new Map(c.map((e,a)=>[g(e),a])),[c,g]);return n.jsxs("div",{className:"s-atop s-atop--sessions",children:[n.jsxs("div",{className:"s-atop-fbar",children:[n.jsxs("label",{className:"s-atop-search",children:[n.jsx("span",{className:"s-atop-search-prompt",children:"/"}),n.jsx("input",{ref:b,className:"s-atop-search-input",placeholder:"filter sessions",value:m,onChange:e=>j(e.target.value)}),n.jsx("kbd",{className:"s-atop-search-kbd",children:"/"})]}),n.jsx("span",{className:"s-atop-fbar-label",children:"source"}),n.jsxs("button",{type:"button",className:`s-atop-pill${p==="all"?" s-atop-pill--on":""}`,onClick:()=>S("all"),children:["all",n.jsx("span",{className:"s-atop-pill-ct",children:f.length})]}),H.map(e=>n.jsxs("button",{type:"button",className:`s-atop-pill${p===e?" s-atop-pill--on":""}`,onClick:()=>S(e),children:[e,n.jsx("span",{className:"s-atop-pill-ct",children:f.filter(a=>a.source===e).length})]},e)),n.jsx("div",{className:"s-atop-fbar-spacer"})]}),n.jsx(O,{rows:K,columns:tt,rowId:g,storageKey:"openscout.sessions.cols",rowBindings:e=>({onMouseEnter:()=>{const a=v.get(e);a!=null&&k(a)},onFocus:()=>{const a=v.get(e);a!=null&&k(a)}}),onRowClick:e=>M(e),rowClassName:e=>v.get(g(e))===y?"s-atop-row--selected":void 0,empty:N?{title:"Discovery failed",body:N}:{title:"No raw sessions",body:m?"No sessions match the current filter.":"No transcript sessions were discovered."},loading:u,density:"compact",className:"s-atop-data-table",ariaLabel:"Raw sessions"}),n.jsxs("div",{className:"s-atop-keys",children:[n.jsxs("span",{children:[n.jsx("kbd",{children:"/"}),"filter"]}),n.jsxs("span",{children:[n.jsx("kbd",{children:"j/k"}),"select"]}),n.jsxs("span",{children:[n.jsx("kbd",{children:"enter"}),"open"]}),n.jsx("span",{className:"s-atop-keys-spacer"}),n.jsxs("span",{className:"s-atop-keys-count",children:[n.jsx("strong",{children:c.length})," sessions"]})]})]})}export{Gt as RawSessionsTable};