@openscout/scout 0.2.90 → 0.2.92

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 (283) hide show
  1. package/README.md +12 -4
  2. package/bin/scoutd +0 -0
  3. package/dist/build-manifest.json +3 -3
  4. package/dist/client/assets/{ActivityScreen-BUeb4ERK.js → ActivityScreen-DkUP7V7M.js} +1 -1
  5. package/dist/client/assets/{AddProjectForm-DtTfn4Zk.js → AddProjectForm-CpyytDf2.js} +1 -1
  6. package/dist/client/assets/{AgentAvatar-CneOa70z.js → AgentAvatar-D8ZtMluU.js} +1 -1
  7. package/dist/client/assets/{AgentConfigurationScreen-CkZ7EjZh.js → AgentConfigurationScreen-BlGI6fuM.js} +1 -1
  8. package/dist/client/assets/{AgentDefinitionsWorkspace-0Y3kqMtv.js → AgentDefinitionsWorkspace-CfaDVCVt.js} +1 -1
  9. package/dist/client/assets/{AgentDetailCard-Dtc02KUO.js → AgentDetailCard-BTiOmh-a.js} +1 -1
  10. package/dist/client/assets/{AgentFloorView-B5raPB_U.js → AgentFloorView-DjNLILLt.js} +1 -1
  11. package/dist/client/assets/{AgentInfoScreen-DFG4ElZD.js → AgentInfoScreen-DG5dlHb_.js} +1 -1
  12. package/dist/client/assets/{AgentLaneCard-BRAkw8YJ.js → AgentLaneCard-lfRNb7JD.js} +1 -1
  13. package/dist/client/assets/{AgentLaneChrome-T8QE5742.js → AgentLaneChrome-Dlwrbq3g.js} +1 -1
  14. package/dist/client/assets/{AgentLaneDetailSheet-C8RYotnv.js → AgentLaneDetailSheet-BzYzBfcW.js} +1 -1
  15. package/dist/client/assets/{AgentLaneSummaryResize-FyYweLo_.js → AgentLaneSummaryResize-6SOEWUnr.js} +1 -1
  16. package/dist/client/assets/AgentLanesEmbedScreen-Crxx1srt.js +1 -0
  17. package/dist/client/assets/{AgentLanesPreflight-Cil3dNwu.js → AgentLanesPreflight-C3uOiOzd.js} +1 -1
  18. package/dist/client/assets/{AgentLanesView-DPfO8MOo.js → AgentLanesView-ChNlmY-F.js} +1 -1
  19. package/dist/client/assets/{AgentLiveActions-DwScaVRF.js → AgentLiveActions-BJ5dIfL3.js} +1 -1
  20. package/dist/client/assets/{AgentSessions-DKoWA0Lm.js → AgentSessions-DpY0htZV.js} +1 -1
  21. package/dist/client/assets/{AgentsConsole-DoBIWGoq.js → AgentsConsole-CHyXrjhm.js} +1 -1
  22. package/dist/client/assets/{AgentsScreen-JuUiSuwY.js → AgentsScreen-BhCjX2lD.js} +1 -1
  23. package/dist/client/assets/AgentsSubnav-az_VDkri.js +1 -0
  24. package/dist/client/assets/{AtopView-ycxMrRwp.js → AtopView-BjjPM8OX.js} +1 -1
  25. package/dist/client/assets/{BackToPicker-D6WgIDb-.js → BackToPicker-D1LV6Cqp.js} +1 -1
  26. package/dist/client/assets/{BriefingDetailScreen-Zw-taW1s.js → BriefingDetailScreen-B7qJ90Np.js} +1 -1
  27. package/dist/client/assets/{BriefingsScreen-BerYOoWS.js → BriefingsScreen-CW6N829d.js} +1 -1
  28. package/dist/client/assets/{BrokerMetadataPanel-Cu93j-Ga.js → BrokerMetadataPanel-BhjECqOK.js} +1 -1
  29. package/dist/client/assets/{BrokerScreen-CeN90URH.js → BrokerScreen-X3z50712.js} +1 -1
  30. package/dist/client/assets/{ChatCollapsedStrip-DdKyMSEM.js → ChatCollapsedStrip-DNR9osDy.js} +1 -1
  31. package/dist/client/assets/{CodeDiffPane-BjCOBLze.js → CodeDiffPane-Bx_2VAzv.js} +1 -1
  32. package/dist/client/assets/{CodeProjectPicker-NSGdCaK0.js → CodeProjectPicker-C1yOJKvs.js} +1 -1
  33. package/dist/client/assets/{CodeScreen-CA9Sq6Dx.js → CodeScreen-CIKK1LcZ.js} +1 -1
  34. package/dist/client/assets/{ContextMenu-DnFcmfMR.js → ContextMenu-CHIuVKz7.js} +1 -1
  35. package/dist/client/assets/{ConversationComposer-CjRXFkvY.js → ConversationComposer-Bf7Ga_49.js} +1 -1
  36. package/dist/client/assets/{ConversationFeedRows-CgRTIpAv.js → ConversationFeedRows-Cm1Lgo43.js} +1 -1
  37. package/dist/client/assets/{ConversationHeader-CRmdtuL7.js → ConversationHeader-B_GXrKR0.js} +1 -1
  38. package/dist/client/assets/{ConversationPanels-DCkcLIHk.js → ConversationPanels-BTBbEvrP.js} +2 -2
  39. package/dist/client/assets/{ConversationScreen-Br0QQ3xo.js → ConversationScreen-B3l2m3JI.js} +1 -1
  40. package/dist/client/assets/{ConversationStatus-BJ1CMbAv.js → ConversationStatus-BqhUHD85.js} +1 -1
  41. package/dist/client/assets/{DataTable-Dzqiaha4.js → DataTable-CJbbgBdA.js} +1 -1
  42. package/dist/client/assets/{DispatchAftermath-B0WMg_z3.js → DispatchAftermath-BDA9CrOd.js} +1 -1
  43. package/dist/client/assets/{DocumentFocusViewer-CZVVIAD5.js → DocumentFocusViewer-B9vodVmG.js} +1 -1
  44. package/dist/client/assets/{EmbeddableSurfacesLab-C3a7hJWO.js → EmbeddableSurfacesLab-BdsYRDky.js} +1 -1
  45. package/dist/client/assets/{EmptyState-CYNJZMrZ.js → EmptyState-BRY5jTpz.js} +1 -1
  46. package/dist/client/assets/{FileViewerPane-Fwt8_KmD.js → FileViewerPane-9Bveqm9c.js} +1 -1
  47. package/dist/client/assets/{FleetSearch-Dsi_l2KW.js → FleetSearch-Bj9SCl2f.js} +1 -1
  48. package/dist/client/assets/{FlightObserveScreen-g_tiGmvz.js → FlightObserveScreen-BVMdsiCC.js} +1 -1
  49. package/dist/client/assets/{FollowScreen-Bb_rcrzi.js → FollowScreen-BifwHWOV.js} +1 -1
  50. package/dist/client/assets/{HarnessMark-DrE57dUq.js → HarnessMark-BPAphNjx.js} +1 -1
  51. package/dist/client/assets/{HarnessesScreen-CAsCJ_tG.js → HarnessesScreen-fMnbnrD4.js} +1 -1
  52. package/dist/client/assets/{HerdrSession-1eVu9Owj.js → HerdrSession-BujfGzrP.js} +1 -1
  53. package/dist/client/assets/{HomeHero-W445QrG1.js → HomeHero-BgM6S39l.js} +1 -1
  54. package/dist/client/assets/{KnowledgeSearchInspector-CbPVg3fr.js → KnowledgeSearchInspector-B4ZY24xE.js} +1 -1
  55. package/dist/client/assets/{KnowledgeSearchScreen-C1lN1xJk.js → KnowledgeSearchScreen-Ch_WENUC.js} +1 -1
  56. package/dist/client/assets/{LaneToolHoverCard-BkBcDYm-.js → LaneToolHoverCard-B7KdvQvf.js} +1 -1
  57. package/dist/client/assets/{LaneTraceDetailSheet-CzTd44rf.js → LaneTraceDetailSheet-H3AnN-vN.js} +1 -1
  58. package/dist/client/assets/{LaneTraceEventFocus-BmMmPTyJ.js → LaneTraceEventFocus-mkMw2wJU.js} +1 -1
  59. package/dist/client/assets/{MeshCanvas-DwkjsiJ5.js → MeshCanvas-CpKcWxKy.js} +1 -1
  60. package/dist/client/assets/{MeshCanvasMinimap-vmCpU1sD.js → MeshCanvasMinimap-C9IoGHbe.js} +1 -1
  61. package/dist/client/assets/{MeshScreen-CkMepUpT.js → MeshScreen-48QkJSDI.js} +1 -1
  62. package/dist/client/assets/{MeshTopologyView-BD2xLE2C.js → MeshTopologyView-DFzr0IZM.js} +2 -2
  63. package/dist/client/assets/{MessageComposerSuggestions-qbalTne_.js → MessageComposerSuggestions-FdVHnT_q.js} +1 -1
  64. package/dist/client/assets/{MessagesScreen-C8UynyLC.js → MessagesScreen-BMOOfbWX.js} +1 -1
  65. package/dist/client/assets/{MissionContextRail-D5MEP2f4.js → MissionContextRail-Y8QxUZGE.js} +1 -1
  66. package/dist/client/assets/{MissionControlView-K_I7eftL.js → MissionControlView-BpsHKu1F.js} +1 -1
  67. package/dist/client/assets/{MissionFocusOverlay-CWKLdUKG.js → MissionFocusOverlay-BPnAEA3F.js} +1 -1
  68. package/dist/client/assets/{MissionLeftAgentRow-ByGrNAcs.js → MissionLeftAgentRow-iOZ6ds9L.js} +1 -1
  69. package/dist/client/assets/{MissionLogPane-ZwHJ137T.js → MissionLogPane-B0csI89E.js} +1 -1
  70. package/dist/client/assets/{NewAgentModal-Do9aVvan.js → NewAgentModal-DBHJR9Qm.js} +1 -1
  71. package/dist/client/assets/{NewChatComposer-DKlNX1UA.js → NewChatComposer-Hd7pI5Ac.js} +1 -1
  72. package/dist/client/assets/{NewChatOrigin-DXPvX-hh.js → NewChatOrigin-DmuJ32wa.js} +1 -1
  73. package/dist/client/assets/{ObserveEmbedScreen-Dghsq2on.js → ObserveEmbedScreen-DyArn7Id.js} +1 -1
  74. package/dist/client/assets/{ObserveTextFlow-DWNlmTVm.js → ObserveTextFlow-CkMrtT8s.js} +2 -2
  75. package/dist/client/assets/{ObservedTopologyPanel-BlmGoxCE.js → ObservedTopologyPanel-CaSZZP05.js} +1 -1
  76. package/dist/client/assets/{OpenScoutAppShell-DDqQi-oe.js → OpenScoutAppShell-BtlKkiuF.js} +1 -1
  77. package/dist/client/assets/{OpsAgentsView-Bn_fGBdo.js → OpsAgentsView-CnqrwbC2.js} +1 -1
  78. package/dist/client/assets/OpsScreen-DOlmlVkP.js +1 -0
  79. package/dist/client/assets/OpsSubnav-Dj3ShAKv.js +1 -0
  80. package/dist/client/assets/{PlanView-B6gKo543.js → PlanView-BLGdWDx6.js} +1 -1
  81. package/dist/client/assets/ProjectAgentProfile-Dv1sVnQl.js +1 -0
  82. package/dist/client/assets/{ProjectAgentProfileBar-C5QWwZCn.js → ProjectAgentProfileBar-BLVg5EeA.js} +1 -1
  83. package/dist/client/assets/{ProjectAgentProfileHero-DC7Dd8VL.js → ProjectAgentProfileHero-0-GDhsPT.js} +1 -1
  84. package/dist/client/assets/{ProjectsInbox-DCLrDmj1.js → ProjectsInbox-B3DpAI5b.js} +1 -1
  85. package/dist/client/assets/{ProjectsRail-C4hiXYSb.js → ProjectsRail-BDl7U9Jq.js} +1 -1
  86. package/dist/client/assets/ProjectsScreen-Dl2FcGrR.js +1 -0
  87. package/dist/client/assets/{ProjectsThreadAside-DYmL2dCY.js → ProjectsThreadAside-BcGC5mHE.js} +1 -1
  88. package/dist/client/assets/{Provider-p-xuaAoE.js → Provider-cJCdHAxu.js} +1 -1
  89. package/dist/client/assets/{RailRow-bRkkXIpR.js → RailRow-CLcVmywd.js} +1 -1
  90. package/dist/client/assets/{RawSessionsTable-B7WKmXrk.js → RawSessionsTable-DBto4Ts-.js} +1 -1
  91. package/dist/client/assets/{RealtimeVoiceScreen-BzP3BQq9.js → RealtimeVoiceScreen-DXEU5v3g.js} +1 -1
  92. package/dist/client/assets/{RepoDiffEmbedScreen-xjzjcJ_c.js → RepoDiffEmbedScreen-BCDXFE3D.js} +1 -1
  93. package/dist/client/assets/{RepoDiffPageScreen-DRzIY-dk.js → RepoDiffPageScreen-m62FiWXC.js} +1 -1
  94. package/dist/client/assets/{RepoDiffViewer-CNDp01KM.js → RepoDiffViewer-PaNeZMhJ.js} +1 -1
  95. package/dist/client/assets/RepoDiffViewerLazy-CWE5GxMP.js +2 -0
  96. package/dist/client/assets/{ReposScreen-CpaLC_NU.js → ReposScreen-Cksv1cAD.js} +1 -1
  97. package/dist/client/assets/{ScoutDeckSurface-DkpZ-0DH.js → ScoutDeckSurface-BCjPl7C4.js} +1 -1
  98. package/dist/client/assets/{ScoutSurface-BENBUt5-.js → ScoutSurface-CkgT7A-c.js} +1 -1
  99. package/dist/client/assets/{ScoutbotBroadcastChip-CGZyxS5H.js → ScoutbotBroadcastChip-DkiRCHuK.js} +1 -1
  100. package/dist/client/assets/{ScoutbotFxLab-Bk2ZsfPp.js → ScoutbotFxLab-D-kV5j4T.js} +1 -1
  101. package/dist/client/assets/{ScoutbotRealtimeVoiceCall-n63LdBZs.js → ScoutbotRealtimeVoiceCall-1ixiEn1L.js} +1 -1
  102. package/dist/client/assets/{SecondaryNav-B4IsujYh.js → SecondaryNav-_wyKjwNf.js} +1 -1
  103. package/dist/client/assets/{SessionEmbedScreen-CPfH-jqN.js → SessionEmbedScreen-CJZmIBV7.js} +1 -1
  104. package/dist/client/assets/{SessionObserve-B-SkP3tu.js → SessionObserve-yYA8Gy5s.js} +1 -1
  105. package/dist/client/assets/{SessionObserveEvidence-CF5jnH3-.js → SessionObserveEvidence-cHdjYOJe.js} +1 -1
  106. package/dist/client/assets/{SessionRefScreen-C-4jjmVG.js → SessionRefScreen-OkTY7Szg.js} +1 -1
  107. package/dist/client/assets/SessionsScreen-B-GFjxIA.js +1 -0
  108. package/dist/client/assets/{SettingsDrawer-DATxwZrn.js → SettingsDrawer-Co11RFX0.js} +1 -1
  109. package/dist/client/assets/{SettingsScreen-Bu53X7J_.js → SettingsScreen-Cn09nq5_.js} +1 -1
  110. package/dist/client/assets/{ShikiPane-DH8yYDks.js → ShikiPane-dBS9hD-z.js} +1 -1
  111. package/dist/client/assets/{SlidePanel-RFXJpfUa.js → SlidePanel-CH-3-8_2.js} +1 -1
  112. package/dist/client/assets/{SpriteAvatar-CEYdCzem.js → SpriteAvatar-DS6Tmyua.js} +1 -1
  113. package/dist/client/assets/{StatusPill-9uy70ttd.js → StatusPill-C8m9ZymF.js} +1 -1
  114. package/dist/client/assets/{TailView-6bIrgdxN.js → TailView-B0BSopPs.js} +1 -1
  115. package/dist/client/assets/{Terminal-BI6km7H4.js → Terminal-U8gjIdm3.js} +1 -1
  116. package/dist/client/assets/{TerminalEmbedScreen-D4JOWwtm.js → TerminalEmbedScreen-CTmdE7us.js} +1 -1
  117. package/dist/client/assets/{TextDocumentSurface-BcP9vvji.js → TextDocumentSurface-BWJCGBZf.js} +1 -1
  118. package/dist/client/assets/{TmuxPeek-IaWqCgyJ.js → TmuxPeek-B4QdHbGm.js} +1 -1
  119. package/dist/client/assets/{VoicePermissionsPanel-C80iZxgy.js → VoicePermissionsPanel-Dd4ITJy_.js} +1 -1
  120. package/dist/client/assets/{WorkDetailScreen-CweZ6fEd.js → WorkDetailScreen-mJs0mb99.js} +1 -1
  121. package/dist/client/assets/{WorkFilesViewer-Dy_-06iI.js → WorkFilesViewer-ODzLXKxj.js} +1 -1
  122. package/dist/client/assets/{activity-DS0u0Itf.js → activity-CC8JzJNH.js} +1 -1
  123. package/dist/client/assets/{addon-fit-CN888B3D.js → addon-fit-CaZ-uLrg.js} +1 -1
  124. package/dist/client/assets/{addon-webgl-CoAnanQS.js → addon-webgl-B8utL3bM.js} +1 -1
  125. package/dist/client/assets/{agent-essentials-CuK4G_zS.js → agent-essentials-B3wcxg_v.js} +1 -1
  126. package/dist/client/assets/{arc.es-BET9ev6q.js → arc.es-uFv9UrHn.js} +1 -1
  127. package/dist/client/assets/{arrow-down-DxxPnPwh.js → arrow-down-w1HPzDSE.js} +1 -1
  128. package/dist/client/assets/{arrow-left-CXDkJuCg.js → arrow-left-B-3GJ7ct.js} +1 -1
  129. package/dist/client/assets/{arrow-up-right-Bj8RjSqW.js → arrow-up-right-G6bJXxhK.js} +1 -1
  130. package/dist/client/assets/{bot-BSGSicKC.js → bot-DzCOGKi6.js} +1 -1
  131. package/dist/client/assets/{check-BfA0T8UD.js → check-BX8nRgop.js} +1 -1
  132. package/dist/client/assets/{chevron-down-BVg09D6U.js → chevron-down-B3VVRJcV.js} +1 -1
  133. package/dist/client/assets/{chevron-right-CaEwYkxE.js → chevron-right-BYMV1511.js} +1 -1
  134. package/dist/client/assets/{chunk-HRAB3GC3-HhKwnZCi.js → chunk-HRAB3GC3-dRd2eQMJ.js} +1 -1
  135. package/dist/client/assets/{chunk-JTPDIGGW-DX2eTIQ_.js → chunk-JTPDIGGW-BjX67kHU.js} +3 -3
  136. package/dist/client/assets/{chunk-T65CQEWV-D-bOfuCH.js → chunk-T65CQEWV-kP6nJjkU.js} +1 -1
  137. package/dist/client/assets/{chunk-YOZR3KYS-oS9dlQCI.js → chunk-YOZR3KYS-C13bZPVd.js} +1 -1
  138. package/dist/client/assets/{clock-C3TUL7D7.js → clock-B9ukVaVn.js} +1 -1
  139. package/dist/client/assets/{code-xml-Dbvjk9Kw.js → code-xml-BFc3TMSm.js} +1 -1
  140. package/dist/client/assets/{content-CiOMtgQc.js → content-B8gahuBy.js} +1 -1
  141. package/dist/client/assets/content-BIqX06OQ.js +1 -0
  142. package/dist/client/assets/content-BKDZ6Fxe.js +1 -0
  143. package/dist/client/assets/content-C15Ya-iu.js +1 -0
  144. package/dist/client/assets/content-CDE9tJDF.js +1 -0
  145. package/dist/client/assets/content-CSAfI-PX.js +1 -0
  146. package/dist/client/assets/content-CTF9D60D.js +1 -0
  147. package/dist/client/assets/{content-CJuH5cDP.js → content-CbAGkYQO.js} +1 -1
  148. package/dist/client/assets/content-CtqLJOVp.js +1 -0
  149. package/dist/client/assets/content-Dvs1KRfo.js +1 -0
  150. package/dist/client/assets/content-DyJdVZjI.js +1 -0
  151. package/dist/client/assets/{content-C2TZOKSE.js → content-Ji7ATaf7.js} +1 -1
  152. package/dist/client/assets/content-eqZXKWcP.js +1 -0
  153. package/dist/client/assets/content-iyyQKwvA.js +1 -0
  154. package/dist/client/assets/content-pDE7Fpb9.js +1 -0
  155. package/dist/client/assets/content-pPSd2dua.js +1 -0
  156. package/dist/client/assets/{conversation-icons-DmC_Ak3z.js → conversation-icons-gpsv650H.js} +1 -1
  157. package/dist/client/assets/conversation-motion-features-DXtKlmuM.js +1 -0
  158. package/dist/client/assets/{copy-C79v_7D-.js → copy-BFmOcWof.js} +1 -1
  159. package/dist/client/assets/{createLucideIcon-DCq_3fQn.js → createLucideIcon-CFBn0Sdk.js} +1 -1
  160. package/dist/client/assets/{discover-IEnbrH8_.js → discover-DKf0aTr_.js} +2 -2
  161. package/dist/client/assets/embed-entry-RlQUTtc4.js +2 -0
  162. package/dist/client/assets/{external-link-Dd8xaveL.js → external-link-B1TI5yIt.js} +1 -1
  163. package/dist/client/assets/{eye-DkU59kfl.js → eye-1J4yOUoG.js} +1 -1
  164. package/dist/client/assets/{file-text-BITQqGtF.js → file-text-DcYSrI4v.js} +1 -1
  165. package/dist/client/assets/{gestures-B5rLNRpi.js → gestures-CcEOV6Sr.js} +1 -1
  166. package/dist/client/assets/{home-moving-signal-Bs635mVw.js → home-moving-signal-Bh2FugbH.js} +1 -1
  167. package/dist/client/assets/{home-now-card-VxlLjg1A.js → home-now-card-ByRH5fFx.js} +1 -1
  168. package/dist/client/assets/{home-now-card-nano-C06GMiwD.js → home-now-card-nano-y1EhBvVL.js} +1 -1
  169. package/dist/client/assets/{hooks-BWiLxTw1.js → hooks-DUZwL3Aq.js} +1 -1
  170. package/dist/client/assets/index-BBznYVWk.css +1 -0
  171. package/dist/client/assets/{index-BTj2MguM.js → index-BTuq-8Iv.js} +1 -1
  172. package/dist/client/assets/index-CmwGCxUk.js +1 -0
  173. package/dist/client/assets/{index-BZovGpDk.js → index-DmFAhGPj.js} +2 -2
  174. package/dist/client/assets/{index-vbaJ8sin.js → index-Dtaswdsh.js} +1 -1
  175. package/dist/client/assets/{inspector-panel-C96HcyK5.js → inspector-panel-DzgS5_Mv.js} +1 -1
  176. package/dist/client/assets/{keyboard-nav-CHo_xmjw.js → keyboard-nav-h1IdakpD.js} +1 -1
  177. package/dist/client/assets/{lane-roster-store-B6ybJlHJ.js → lane-roster-store-71vFgAem.js} +1 -1
  178. package/dist/client/assets/{left-DMJkmJOF.js → left-8NITBvFX.js} +1 -1
  179. package/dist/client/assets/{left-COMAiMfB.js → left-B2HEqrTM.js} +1 -1
  180. package/dist/client/assets/{left-C6Zj3cR4.js → left-CTYUvXbe.js} +1 -1
  181. package/dist/client/assets/{left-BuJ0wJW1.js → left-CwDRT50z.js} +1 -1
  182. package/dist/client/assets/{left-l92tw5Kc.js → left-CxlDLJlw.js} +1 -1
  183. package/dist/client/assets/{left-Ce4WKYPK.js → left-XFXxNd4g.js} +1 -1
  184. package/dist/client/assets/{left-agents-BuSyVNGE.js → left-agents-Ck4Xn-R8.js} +1 -1
  185. package/dist/client/assets/{left-default-DRHywOKX.js → left-default-BeOyS0bR.js} +1 -1
  186. package/dist/client/assets/{left-lanes-4-aUyyrV.js → left-lanes-DZp3jJMo.js} +1 -1
  187. package/dist/client/assets/{left-mission-e849d_Td.js → left-mission-CuKFQ5xL.js} +1 -1
  188. package/dist/client/assets/left-p1hkO6P0.js +1 -0
  189. package/dist/client/assets/{left-plan-MchYwAB_.js → left-plan-3rrFENhp.js} +1 -1
  190. package/dist/client/assets/{library-DygjpA6u.js → library-E--gKzEZ.js} +1 -1
  191. package/dist/client/assets/{loader-circle-B-l2Wj3-.js → loader-circle-d6PKL_KD.js} +1 -1
  192. package/dist/client/assets/{local-agents-Wof5knTJ.js → local-agents-B5pq17tZ.js} +1 -1
  193. package/dist/client/assets/{mentions-BjXfeF7t.js → mentions-agCGDgyA.js} +1 -1
  194. package/dist/client/assets/{mesh-ops-C1gq8zKf.js → mesh-ops-5pZCYptW.js} +1 -1
  195. package/dist/client/assets/{mesh-view-store-B56D3f77.js → mesh-view-store-KJzABIkN.js} +1 -1
  196. package/dist/client/assets/{message-circle-BwVx5X0q.js → message-circle-CJO-pi7b.js} +1 -1
  197. package/dist/client/assets/{message-markup-DlVX-iuc.js → message-markup-CyRDLdOn.js} +1 -1
  198. package/dist/client/assets/{message-square-BnkG6tae.js → message-square-D1hMsMj_.js} +1 -1
  199. package/dist/client/assets/{mission-control-store-CMgIVjLJ.js → mission-control-store-Ce6dOvnZ.js} +1 -1
  200. package/dist/client/assets/{observe-DVHAcIrv.js → observe-BSWVM8YA.js} +1 -1
  201. package/dist/client/assets/{page-status-Bg2hd27j.js → page-status-D2FQLJOX.js} +1 -1
  202. package/dist/client/assets/{paperclip-DblaLD_N.js → paperclip-iZmDMOS5.js} +1 -1
  203. package/dist/client/assets/{plus-BAI0t5g9.js → plus-gZ0T0eBI.js} +1 -1
  204. package/dist/client/assets/{profile-3Q4sUtvJ.js → profile-Dxj3VVOM.js} +1 -1
  205. package/dist/client/assets/{projects-inbox-Da2hYEn6.js → projects-inbox-Dzt_GQDv.js} +1 -1
  206. package/dist/client/assets/{radio-BGtkyCG9.js → radio-RMLfV4EO.js} +1 -1
  207. package/dist/client/assets/{refresh-cw-DtF8xPqX.js → refresh-cw-C4x1x6b_.js} +1 -1
  208. package/dist/client/assets/resolve-panes-C9gF0w4e.js +1 -0
  209. package/dist/client/assets/resolve-sidebar-context-DxbY5RCH.js +1 -0
  210. package/dist/client/assets/{right-Dd2DscRz.js → right-5L7Tn0zG.js} +1 -1
  211. package/dist/client/assets/{right-BU_W1kSH.js → right-CYtkMmRu.js} +1 -1
  212. package/dist/client/assets/{right-CUP-NIDG.js → right-CreoQzPP.js} +1 -1
  213. package/dist/client/assets/{right-c4PAdFYZ.js → right-D-k9Z1Fe.js} +1 -1
  214. package/dist/client/assets/{right-ByptvkVX.js → right-D9xFfy2b.js} +1 -1
  215. package/dist/client/assets/{right-BlR7h0US.js → right-DI7zHADe.js} +1 -1
  216. package/dist/client/assets/{right-BwgwTGGd.js → right-DUbJ3WVc.js} +1 -1
  217. package/dist/client/assets/{right-DmVHd8Xj.js → right-DiybhsiK.js} +1 -1
  218. package/dist/client/assets/{right-Ch_jrNe2.js → right-Jh_1Q88s.js} +1 -1
  219. package/dist/client/assets/{right-B8qg3JdB.js → right-udr1qTJG.js} +1 -1
  220. package/dist/client/assets/{rocket-BWh18pt_.js → rocket-CMM-IdLy.js} +1 -1
  221. package/dist/client/assets/{router-63XV_E7f.js → router-Cn_s9IGH.js} +1 -1
  222. package/dist/client/assets/{runtime-picker-BXKJbLot.js → runtime-picker--IW3cRry.js} +1 -1
  223. package/dist/client/assets/{scope-views-Dm2_-NPi.js → scope-views-BIfMTXU4.js} +1 -1
  224. package/dist/client/assets/{scout-voice-D8Q5sZOL.js → scout-voice-CwbOz6EN.js} +1 -1
  225. package/dist/client/assets/{scroll-text-DZb3mmYo.js → scroll-text-DPPYrqB9.js} +1 -1
  226. package/dist/client/assets/{search-1QMVOxF3.js → search-DAyagUtF.js} +1 -1
  227. package/dist/client/assets/{secondaryNavConfig-c0cz3MkJ.js → secondaryNavConfig-Dw3gS1jR.js} +1 -1
  228. package/dist/client/assets/{selection-bridge-O9C4kGfF.js → selection-bridge-BXw09aRF.js} +1 -1
  229. package/dist/client/assets/{send-horizontal-DbyEkGql.js → send-horizontal-IcG46D2M.js} +1 -1
  230. package/dist/client/assets/{server-Bncn9S7r.js → server-BySujhDV.js} +1 -1
  231. package/dist/client/assets/{session-catalog-DC6BlBBC.js → session-catalog-ClS9xf6i.js} +1 -1
  232. package/dist/client/assets/{session-table-BUPq9Viy.js → session-table-BdpHs1GN.js} +1 -1
  233. package/dist/client/assets/{sliders-horizontal-CMe8Bay1.js → sliders-horizontal-R5pWUUcH.js} +1 -1
  234. package/dist/client/assets/{sparkles-_7cTZsIH.js → sparkles-DJOBD_8l.js} +1 -1
  235. package/dist/client/assets/{sse-Bb0EOcU9.js → sse-CxXt4tqI.js} +1 -1
  236. package/dist/client/assets/{tail-events-C12pfUax.js → tail-events-BdvqZHLr.js} +1 -1
  237. package/dist/client/assets/{terminal-xGf_F3y7.js → terminal-DJPUp_Qn.js} +1 -1
  238. package/dist/client/assets/{terminal-relay-BgfVJXIL.js → terminal-relay-TffuSPGs.js} +1 -1
  239. package/dist/client/assets/{terminal-takeover--05EYhJm.js → terminal-takeover-BOFPRPjR.js} +1 -1
  240. package/dist/client/assets/{use-conversation-list-DWX02INv.js → use-conversation-list-C-dPcjQe.js} +1 -1
  241. package/dist/client/assets/{use-fleet-active-asks-Cnwa4hTK.js → use-fleet-active-asks-BHzeBZSW.js} +1 -1
  242. package/dist/client/assets/{use-mesh-ops-items-BRFm37oY.js → use-mesh-ops-items-KmaauBr_.js} +1 -1
  243. package/dist/client/assets/{use-reduced-motion-C8cWvIZ3.js → use-reduced-motion-CYqhYqHO.js} +1 -1
  244. package/dist/client/assets/{use-scout-dev-flags-FkMreOOb.js → use-scout-dev-flags-BJbw87PK.js} +1 -1
  245. package/dist/client/assets/{useAgentHoverCard-DvPZSJK3.js → useAgentHoverCard-C6o0tlat.js} +1 -1
  246. package/dist/client/assets/useContentSecondaryNav-DjHBrgnS.js +1 -0
  247. package/dist/client/assets/{usePierreRuntime-C8WJ0X3F.js → usePierreRuntime-Cm7-qdm0.js} +1 -1
  248. package/dist/client/assets/{wrench-_tHBGTop.js → wrench-CvRjjByE.js} +1 -1
  249. package/dist/client/assets/{x-CrGUKNRv.js → x-C8ayPBtj.js} +1 -1
  250. package/dist/client/assets/{xterm-Ks-VlLTq.js → xterm-B0ci4Q9a.js} +1 -1
  251. package/dist/client/index.html +2 -2
  252. package/dist/main.mjs +348 -254
  253. package/dist/scout-web-server.mjs +2 -96660
  254. package/package.json +3 -3
  255. package/dist/client/assets/AgentLanesEmbedScreen-Br7cmZVO.js +0 -1
  256. package/dist/client/assets/AgentsSubnav-BV0WAgzf.js +0 -1
  257. package/dist/client/assets/OpsScreen-DHnT-Q9R.js +0 -1
  258. package/dist/client/assets/OpsSubnav-CJRD7MjM.js +0 -1
  259. package/dist/client/assets/ProjectAgentProfile-Be1VOkI4.js +0 -1
  260. package/dist/client/assets/ProjectsScreen-jruZRjgD.js +0 -1
  261. package/dist/client/assets/RepoDiffViewerLazy-b6vjYxez.js +0 -2
  262. package/dist/client/assets/SessionsScreen-HAjFvmIq.js +0 -1
  263. package/dist/client/assets/content-BQuEedeL.js +0 -1
  264. package/dist/client/assets/content-BUae-L_N.js +0 -1
  265. package/dist/client/assets/content-BfG98J1k.js +0 -1
  266. package/dist/client/assets/content-BkVTfkAC.js +0 -1
  267. package/dist/client/assets/content-BsNMos_d.js +0 -1
  268. package/dist/client/assets/content-CCn98eSk.js +0 -1
  269. package/dist/client/assets/content-CYnPp9yo.js +0 -1
  270. package/dist/client/assets/content-CcrUhm4P.js +0 -1
  271. package/dist/client/assets/content-CxuVONeQ.js +0 -1
  272. package/dist/client/assets/content-Dmq9n1_L.js +0 -1
  273. package/dist/client/assets/content-DskHP2NI.js +0 -1
  274. package/dist/client/assets/content-DvvzL2HK.js +0 -1
  275. package/dist/client/assets/content-snCAUbwv.js +0 -1
  276. package/dist/client/assets/conversation-motion-features-DPiGTO21.js +0 -1
  277. package/dist/client/assets/embed-entry-XUPb-AzL.js +0 -2
  278. package/dist/client/assets/index-9as_JTUs.css +0 -1
  279. package/dist/client/assets/index-DiiEQwdc.js +0 -1
  280. package/dist/client/assets/left-DrCbY6ja.js +0 -1
  281. package/dist/client/assets/resolve-panes-D4tlKNCT.js +0 -1
  282. package/dist/client/assets/resolve-sidebar-context-B27lj3Ci.js +0 -1
  283. package/dist/client/assets/useContentSecondaryNav-CNlrhvvx.js +0 -1
@@ -1 +1 @@
1
- import{j as i,r as o,J as Te,b as et,K as tt,L as nt,C as rt}from"./index-BZovGpDk.js";import{u as Pe,b as ot,as as st}from"./router-63XV_E7f.js";import{a as $}from"./api-h5zurxmi.js";import{u as it}from"./sse-Bb0EOcU9.js";import{o as at,i as Re}from"./surface-activity-B1rgWB1i.js";import{i as ct}from"./colors-BtO5_zlx.js";import{e as Me,s as lt,i as Ie,r as ut,a as dt,f as ft}from"./scoutbot-BTIErYHo.js";import{C as pt}from"./ContextMenu-DnFcmfMR.js";import{F as ht,a as mt,D as vt}from"./DocumentFocusViewer-CZVVIAD5.js";import{c as Fe,T as Be}from"./TextDocumentSurface-BcP9vvji.js";import{C as gt}from"./chevron-right-CaEwYkxE.js";import{F as wt}from"./file-text-BITQqGtF.js";import{c as Ue}from"./createLucideIcon-DCq_3fQn.js";import{C as bt}from"./code-xml-Dbvjk9Kw.js";import{A as yt}from"./arrow-left-CXDkJuCg.js";import{h as St}from"./scout-voice-D8Q5sZOL.js";import{i as Ct}from"./keyboard-nav-CHo_xmjw.js";import{d as pe,b as Ne,i as Oe}from"./MessageComposerSuggestions-qbalTne_.js";import{o as kt,N as Et}from"./NewChatComposer-DKlNX1UA.js";import{u as xt}from"./chunk-HRAB3GC3-HhKwnZCi.js";function At(e){const t=e instanceof Error?e.message:String(e);return Rt(t)?"Scout server is unreachable":t}function Tt(e){return e==="Scout server is unreachable"}function Rt(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 It=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Nt=Ue("arrow-right",It);const Ot=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],_t=Ue("chevron-up",Ot),Lt={id:"audio",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("audio/"),render:({resource:e})=>{const t=e;return i.jsx("div",{className:"s-file-preview-media-wrap",children:i.jsx("div",{className:"s-file-preview-audio-stage",children:i.jsx("audio",{className:"s-file-preview-audio",src:t.rawUrl,controls:!0})})})}},jt={id:"binary",canHandle:()=>!0,render:({resource:e})=>{const t=e;return i.jsxs("div",{className:"s-file-preview-callout",children:[i.jsxs("div",{className:"s-file-preview-callout-title",children:[t.previewReason," — open in OS"]}),i.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."]})]})}},Dt=new Set(["text/typescript","text/javascript","text/css","text/html","application/json","text/yaml","text/toml","text/x-shellscript","text/plain"]),Pt={id:"code",canHandle:e=>e.kind==="file"&&e.previewable&&Dt.has(e.mediaType),render:({resource:e})=>{const t=e,n=Fe({id:t.realPath,title:t.title,uri:t.realPath,mediaType:t.mediaType,value:t.content,filename:t.title,kind:"code",readOnly:!0});return i.jsx(Be,{document:n,mode:"read",className:"s-doc-focus-document"})}},Mt={id:"directory",canHandle:e=>e.kind==="directory",render:({resource:e,openFilePreview:t})=>{const n=e,r=Ft(n.realPath,n.rootPath);return i.jsxs("div",{className:"s-file-preview-directory",children:[i.jsx("div",{className:"s-file-preview-breadcrumb","aria-label":"Directory breadcrumb",children:r.map((s,a)=>{const c=a===r.length-1;return i.jsxs("div",{className:"s-file-preview-breadcrumb-item",children:[a>0&&i.jsx(gt,{size:12,"aria-hidden":"true"}),c?i.jsx("span",{className:"s-file-preview-breadcrumb-current",children:s.label}):i.jsx("button",{type:"button",className:"s-file-preview-breadcrumb-link",onClick:()=>t(s.path),children:s.label})]},s.path)})}),i.jsxs("div",{className:"s-file-preview-directory-list",role:"list",children:[n.entries.map(s=>i.jsxs("button",{type:"button",className:"s-file-preview-entry",onClick:()=>t(s.path),children:[i.jsx("span",{className:"s-file-preview-entry-icon","aria-hidden":"true",children:s.kind==="directory"?i.jsx(ht,{size:14}):i.jsx(wt,{size:14})}),i.jsx("span",{className:"s-file-preview-entry-name",children:s.name}),i.jsx("span",{className:"s-file-preview-entry-kind",children:s.kind==="directory"?"dir":"file"})]},s.realPath)),n.entries.length===0&&i.jsx("div",{className:"s-file-preview-directory-empty",children:"This directory is empty."})]})]})}};function Ft(e,t){const n=t==="/"?"/":t.replace(/\/+$/u,""),r=e==="/"?"/":e.replace(/\/+$/u,""),s=n.split("/").filter(Boolean),a=r.split("/").filter(Boolean),c=[{label:s[s.length-1]??"/",path:n||"/"}];let p=n||"/";for(let f=s.length;f<a.length;f+=1){const A=a[f];A&&(p=p==="/"?`/${A}`:`${p}/${A}`,c.push({label:A,path:p}))}return c}const Bt={id:"html",canHandle:e=>e.kind==="file"&&e.previewable&&e.mediaType==="text/html",render:({resource:e})=>i.jsx("div",{className:"s-file-preview-html-wrap",children:i.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"})})},Ut={id:"image",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("image/"),render:({resource:e})=>i.jsx("div",{className:"s-file-preview-image-wrap",children:i.jsx("div",{className:"s-file-preview-image-stage",children:i.jsx("img",{className:"s-file-preview-image",src:e.kind==="file"?e.rawUrl:"",alt:e.title})})})},qt={id:"markdown",canHandle:e=>e.kind==="file"&&e.previewable&&e.mediaType==="text/markdown",render:({resource:e})=>{const t=e,n=Fe({id:t.realPath,title:t.title,uri:t.realPath,mediaType:t.mediaType,value:t.content,filename:t.title,kind:"markdown",readOnly:!0});return i.jsx(Be,{document:n,mode:"preview",className:"s-doc-focus-document"})}},Vt={id:"video",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("video/"),render:({resource:e})=>{const t=e;return i.jsx("div",{className:"s-file-preview-media-wrap",children:i.jsx("div",{className:"s-file-preview-media-stage",children:i.jsx("video",{className:"s-file-preview-video",src:t.rawUrl,controls:!0})})})}},Ht=[Mt,qt,Bt,Pt,Ut,Vt,Lt,jt];function $t({path:e,onOpenPath:t,onOpenInCode:n,onClose:r}){const[s,a]=o.useState(null),[c,p]=o.useState(null),[f,A]=o.useState(!1),[w,T]=o.useState(null),P=o.useRef(null);o.useEffect(()=>{P.current=w},[w]),o.useEffect(()=>{if(!e){a(null),p(null),A(!1);return}let d=!1;return A(!0),p(null),a(null),$(`/api/file/preview?path=${encodeURIComponent(e)}`).then(h=>{d||(a(h),Jt(h,P.current,T))}).catch(h=>{d||p(h instanceof Error?h.message:"could not load file")}).finally(()=>{d||A(!1)}),()=>{d=!0}},[e]);const{currentIndex:j,prevPath:u,nextPath:g}=o.useMemo(()=>{if(!s||s.kind!=="file"||!w)return{currentIndex:-1,prevPath:null,nextPath:null};const d=w.files.findIndex(h=>h.realPath===s.realPath);return d<0?{currentIndex:-1,prevPath:null,nextPath:null}:{currentIndex:d,prevPath:d>0?w.files[d-1].path:null,nextPath:d<w.files.length-1?w.files[d+1].path:null}},[s,w]);if(o.useEffect(()=>{if(!e)return;const d=h=>{if(h.key==="Escape"){r();return}if(h.target instanceof HTMLElement){const b=h.target.tagName;if(b==="INPUT"||b==="TEXTAREA"||h.target.isContentEditable)return}h.metaKey||h.ctrlKey||h.altKey||(h.key==="ArrowLeft"&&u?(h.preventDefault(),t(u)):h.key==="ArrowRight"&&g?(h.preventDefault(),t(g)):h.key==="Backspace"&&w&&s?.kind==="file"&&(h.preventDefault(),t(w.dirPath)))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,r,t,u,g,w,s]),!e)return null;const S=()=>{$("/api/file/reveal",{method:"POST",body:JSON.stringify({path:s?.realPath??e})}).catch(d=>{p(d instanceof Error?d.message:"reveal failed")})},O=s?Ht.find(d=>d.canHandle(s))??null:null,k=!!(s&&s.kind==="file"&&w&&j>=0&&w.files.length>1),E=[];k&&w&&E.push({label:`Folder: ${w.dirTitle}`,icon:i.jsx(_t,{size:12}),onClick:()=>t(w.dirPath),title:`Back to ${w.dirTitle} (Backspace)`}),E.push({label:"Open in Code",icon:i.jsx(bt,{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"}),E.push({label:"Show in folder",icon:i.jsx(mt,{size:12}),onClick:S,title:"Show this file in its operating system folder",hideLabel:!0});const _=s?zt(s):[];k&&_.unshift(`${j+1} / ${w.files.length}`);const I=s&&O?O.render({resource:s,openFilePreview:t}):null;return i.jsx(vt,{open:!0,kind:Kt(s),document:null,title:s?.title??e.split("/").pop()??"File",eyebrow:"File preview",subtitle:s?.realPath??e,meta:_,state:f?"Loading…":null,error:c,body:I?i.jsxs("div",{className:`s-file-preview-shell${k?" s-file-preview-shell-nav":""}`,children:[k&&i.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:i.jsx(yt,{size:18,strokeWidth:1.8,"aria-hidden":"true"})}),i.jsx("div",{className:"s-file-preview-shell-body",children:I}),k&&i.jsx("button",{type:"button",className:"s-file-preview-side-nav s-file-preview-side-nav-right",onClick:()=>g&&t(g),disabled:!g,"aria-label":"Next file",title:"Next file (→)",children:i.jsx(Nt,{size:18,strokeWidth:1.8,"aria-hidden":"true"})})]}):null,actions:E,onClose:r})}function Jt(e,t,n){if(e.kind==="directory"){const s=e.entries.filter(a=>a.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 Kt(e){return!e||e.kind==="directory"||e.mediaType==="text/markdown"||e.mediaType==="text/plain"?"doc":"code"}function zt(e){return e.kind==="directory"?[`${e.entries.length} ${e.entries.length===1?"entry":"entries"}`]:[...e.previewable&&e.truncated?["truncated"]:[],Gt(e.sizeBytes),e.mediaType]}function Gt(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const qe={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}},z=()=>{},Ve={focusScoutbot:z,triggerBrief:z,triggerAskState:z,toggleVoiceReplies:z,openScoutbotSettings:z,startNewChat:z,dismissReminder:z,askReminderStatus:z},we=o.createContext(null);function Wt({children:e}){const[t,n]=o.useState(qe),r=o.useRef(Ve),s=o.useCallback(f=>{n(A=>Qt(A,f)?A:f)},[]),a=o.useCallback(f=>{r.current=f},[]),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:f=>r.current.dismissReminder(f),askReminderStatus:f=>r.current.askReminderStatus(f)}),[]),p=o.useMemo(()=>({state:t,actions:c,publishState:s,registerActions:a}),[t,c,s,a]);return i.jsx(we.Provider,{value:p,children:e})}function fr(){const e=o.useContext(we);return e?{state:e.state,actions:e.actions}:{state:qe,actions:Ve}}function pr(){const e=o.useContext(we);return e?{publishState:e.publishState,registerActions:e.registerActions}:null}function Qt(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&&Xt(e.reminders.due,t.reminders.due)&&He(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 Xt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!He(e[n],t[n]))return!1;return!0}function He(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 Yt="/api/voice/realtime/call",$e="/api/voice/realtime/lease",Zt="x-openscout-realtime-voice-lease",Je="surface.realtime-voice",hr="scout:realtime-voice-stop",en={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}},tn={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}},nn="/api/scoutbot/chat",rn=25e3;async function on(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,a=null,c=null,p=0,f=0;const A=(u,g,S="voice")=>{f+=1,e.onTrace?.({id:`voice-${f}`,at:Date.now(),kind:S,label:u,...g?{detail:g}:{}})};let w=null;const T=()=>{if(w)return w;r=!0,e.signal?.removeEventListener("abort",j),c&&clearInterval(c),c=null,s?.getTracks().forEach(g=>g.stop()),n.pause(),n.srcObject=null,t.close();const u=a;return a=null,w=(async()=>{u&&await vn(u),e.onState?.("ended")})(),w},P=()=>{T().catch(u=>{e.onError?.(u instanceof Error?u.message:"Could not release the realtime voice lease."),e.onState?.("error")})},j=()=>{P()};e.signal?.addEventListener("abort",j,{once:!0}),t.ontrack=({streams:u})=>{const g=u[0];if(!g||r)return;const[S]=g.getAudioTracks();S&&S.addEventListener("ended",()=>{r||e.onError?.("Realtime voice audio ended unexpectedly.")}),n.srcObject=g,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"),A("Realtime channel connected","Scoutbot bridge is ready")):(t.connectionState==="failed"||t.connectionState==="disconnected")&&(e.onError?.("Realtime voice connection ended unexpectedly."),P()))};try{s=await hn(e.inputDeviceName,e.signal),ie(e.signal);for(const m of s.getTracks())t.addTrack(m,s);const u=t.createDataChannel("oai-events"),g=new Set;let S=Promise.resolve(),O=!1,k=null;const E=[],_=m=>{if(r||u.readyState!=="open")return!1;try{return u.send(JSON.stringify(m)),!0}catch{return e.onError?.("Realtime voice events channel closed unexpectedly."),!1}},I=()=>{if(O||k||E.length===0)return;const m=E.shift();if(m){if(k=m,!_({type:"response.create",response:{instructions:m}})){k=null,E.unshift(m);return}O=!0}},d=m=>{E.push(m),I()};u.addEventListener("open",()=>{if(r)return;const m=pn(e.inputDeviceName);if(!_({type:"session.update",session:{type:"realtime",audio:{input:m}}})){e.onError?.("Could not configure Scout's realtime microphone processing.");return}A("Scoutbot bridge ready","Live fleet context is available"),d("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",m=>{const L=an(m.data);if(L?.type==="error"){if(Ke(L.message)){k&&(E.unshift(k),k=null),O=!0,A("Scoutbot reply queued","Waiting for the current spoken response to finish","scoutbot");return}e.onError?.(L.message??"OpenAI Realtime reported an error.");return}if(L?.type==="response.created"){O=!0,k=null;return}if(L?.type==="response.done"){O=!1,k=null;for(const D of cn(L))D.name!=="ask_scoutbot"||g.has(D.callId)||(g.add(D.callId),S=S.then(()=>sn({functionCall:D,route:e.getRoute?.()??e.route,uiContext:e.getUiContext?.(),onReply:e.onScoutbotReply,onTrace:A,send:_,requestResponse:d})).catch(V=>{e.onError?.(V instanceof Error?V.message:"Scoutbot could not complete the voice request.")}));I()}});const h=await he(t.createOffer(),e.signal);if(await he(t.setLocalDescription(h),e.signal),!h.sdp)throw new Error("Could not create a WebRTC offer.");const b=await fetch(Yt,{method:"POST",headers:{"content-type":"application/sdp"},body:h.sdp,signal:e.signal});a=b.headers.get(Zt)?.trim()||null;const y=await he(b.text(),e.signal);if(!b.ok)throw new Error(dn(y,b.status));if(!a)throw new Error("Scout started the audio connection without a concurrency lease. Please try again.");return c=setInterval(()=>{if(!a||r)return;const m=a;mn(m).then(L=>{if(!(r||m!==a)){if(L){p=0;return}e.onError?.("Realtime voice lost its server lease. Reconnect to continue safely."),P()}}).catch(()=>{p+=1,!(p<2||r)&&(e.onError?.("Realtime voice could not renew its server lease. Check the connection and try again."),P())})},rn),await he(t.setRemoteDescription({type:"answer",sdp:y}),e.signal),ie(e.signal),{leaseId:a,stop:T}}catch(u){throw await T(),u}}async function sn(e){const t=ln(e.functionCall.arguments);if(!t){e.onTrace("Scoutbot request could not be read",void 0,"error"),ve(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(nn,{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(un(r,n.status));const s=JSON.parse(r),a=typeof s.reply?.body=="string"?s.reply.body.trim():"";if(!a)throw new Error("Scoutbot returned an empty reply.");const c=Me(a).filter(A=>A.type==="ask-agent").length,p=e.onReply?await e.onReply(a):{agentRequests:{requested:c,sent:0,failed:c}},f=lt(a);e.onTrace("Scoutbot reply ready",void 0,"scoutbot"),ve(e,{ok:!0,reply:f,...p.agentRequests.requested>0?{agentRequests:p.agentRequests}:{}})}catch(n){const r=n instanceof Error?n.message:"Scoutbot could not complete the voice request.";e.onTrace("Scoutbot request failed",r,"error"),ve(e,{ok:!1,error:r})}}function ve(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 Ke(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 an(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 cn(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 ln(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 un(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 dn(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(be(t));t.addEventListener("abort",s,{once:!0}),e.then(a=>{t.removeEventListener("abort",s),n(a)},a=>{t.removeEventListener("abort",s),r(a)})})):e}async function _e(e,t){return t?(ie(t),new Promise((n,r)=>{let s=!1;const a=()=>{s=!0,r(be(t))};t.addEventListener("abort",a,{once:!0}),e.then(c=>{if(t.removeEventListener("abort",a),s||t.aborted){c.getTracks().forEach(p=>p.stop());return}n(c)},c=>{t.removeEventListener("abort",a),s||r(c)})})):e}const Le={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1},fn=/\b(?:airpods?|earbuds?|earphones?|headsets?|headphones?|buds?|hands[- ]?free)\b/iu;function pn(e){return fn.test(e?.trim()??"")?tn:en}async function hn(e,t){const n=await je(e);let r=await _e(navigator.mediaDevices.getUserMedia({audio:{...Le,...n?{deviceId:{exact:n.deviceId}}:{}}}),t);if(!n&&e?.trim()){const s=await je(e),a=r.getAudioTracks?.()[0]?.label?.trim().toLocaleLowerCase()??"";if(s&&s.label.trim().toLocaleLowerCase()!==a)try{const c=await _e(navigator.mediaDevices.getUserMedia({audio:{...Le,deviceId:{exact:s.deviceId}}}),t);r.getTracks().forEach(p=>p.stop()),r=c}catch(c){if(t?.aborted)throw r.getTracks().forEach(p=>p.stop()),c}}for(const s of r.getAudioTracks?.()??[])s.contentHint="speech";return r}async function je(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 be(e)}function be(e){return e.reason instanceof Error?e.reason:new DOMException("Realtime voice connection was cancelled.","AbortError")}async function mn(e){return(await fetch(`${$e}/${encodeURIComponent(e)}`,{method:"PUT"})).ok}async function vn(e){const t=await fetch(`${$e}/${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 gn=[{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"}}],wn=[{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 bn(e){const t=e==="macos";return{host:e,shellLabel:t?"Scout for macOS":"OpenScout web",destinations:t?wn:gn,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 yn="scout:scoutbot-realtime-reply",me="scout:scoutbot-session-changed",Sn={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:()=>{}},ze=o.createContext(Sn);function Cn({children:e}){const{route:t,applyScoutbotUiAction:n}=Qe(),r=Pe(Je,!1),[s,a]=o.useState(!1),[c,p]=o.useState("idle"),[f,A]=o.useState(null),[w,T]=o.useState(null),[P,j]=o.useState([]),[u,g]=o.useState(null),[S,O]=o.useState(null),k=o.useRef(null),E=o.useRef(null),_=o.useRef(null),I=o.useRef(0),d=o.useRef(!1),h=o.useRef(!1),b=o.useRef({route:t,applyScoutbotUiAction:n});b.current={route:t,applyScoutbotUiAction:n};const y=o.useCallback((v,C,R="voice")=>{j(M=>[...M,{id:`voice-ui-${Date.now()}-${M.length}`,at:Date.now(),kind:R,label:v,...C?{detail:C}:{}}].slice(-100))},[]),m=o.useCallback(()=>j([]),[]),L=o.useCallback(async()=>{const v=await $("/api/scoutbot/session");return d.current||g(v),v},[]);o.useEffect(()=>{if(!r)return;const v=()=>{L().catch(C=>{d.current||T(C instanceof Error?C.message:"Could not load Scoutbot chats.")})};return v(),window.addEventListener(me,v),()=>window.removeEventListener(me,v)},[r,L]);const D=o.useCallback(async()=>{I.current+=1;const v=_.current;E.current?.abort(),E.current=null;const C=k.current;k.current=null;try{await C?.stop(),await v}catch(R){return d.current||(p("error"),T(R instanceof Error?R.message:"Could not end realtime voice cleanly.")),!1}return d.current||(A(null),p("ended"),y("Live voice ended","Microphone and host lease released","voice")),!0},[y]);o.useEffect(()=>{r||(a(!1),(k.current||c==="connecting"||c==="live")&&D())},[r,D,c]),o.useEffect(()=>(d.current=!1,()=>{d.current=!0,I.current+=1,E.current?.abort(),E.current=null,k.current?.stop().catch(()=>{}),k.current=null}),[]);const V=o.useCallback(async v=>{window.dispatchEvent(new CustomEvent(yn,{detail:{body:v}}));const C=v.replace(/```[\s\S]*?```/gu,"").trim();C&&y("Scoutbot replied",C.slice(0,2e3),"scoutbot");let R=0,M=0,K=0;for(const B of Me(v))if(B.type==="ask-agent")R+=1,await An(B,y,T)?M+=1:K+=1;else if(B.type!=="reminder"){const N=xn(B),U=B.type==="navigate"||B.type==="view-file"?"navigation":"scoutbot";y(En(B),N,U),b.current.applyScoutbotUiAction(B),y(Ie()?"Action sent to Scout for macOS":"Action applied in OpenScout",N,U)}return await L().catch(()=>null),{agentRequests:{requested:R,sent:M,failed:K}}},[y,L]),Y=o.useCallback(()=>{const v={type:"navigate",route:{view:"settings",section:"voice"}};y("Voice settings requested",void 0,"navigation"),b.current.applyScoutbotUiAction(v)},[y]),Z=o.useCallback(async()=>{if(!r){T("Turn on live voice in Settings → Voice before starting a call."),a(!1);return}if(h.current||c==="connecting"||c==="live")return;h.current=!0,E.current?.abort();const v=k.current;k.current=null;try{await v?.stop(),A(null)}catch(N){p("error"),T(N instanceof Error?N.message:"Could not end the previous realtime voice call."),h.current=!1;return}const C=new AbortController;E.current=C;const R=I.current+1;I.current=R;let M=()=>{};const K=new Promise(N=>{M=N});_.current=K;let B=!1;T(null),j([{id:"connecting",at:Date.now(),label:"Connecting secure audio"}]),p("connecting");try{const N=await St().then(({settings:q})=>q.inputDeviceName).catch(()=>null),U=await on({signal:C.signal,inputDeviceName:N,getRoute:()=>b.current.route,getUiContext:()=>bn(Ie()?"macos":"web"),onState:q=>{!d.current&&I.current===R&&p(q)},onError:q=>{if(!(d.current||I.current!==R)){if(Ke(q)){y("Scoutbot reply queued","Waiting for the current spoken response to finish","scoutbot");return}T(q),y("Voice issue",q,"error")}},onTrace:q=>{!d.current&&I.current===R&&j(ae=>[...ae,q].slice(-100))},onScoutbotReply:q=>!d.current&&I.current===R?V(q):{agentRequests:{requested:0,sent:0,failed:0}}});if(d.current||C.signal.aborted||I.current!==R){await U.stop();return}k.current=U,A(U.leaseId),B=!0}catch(N){if(!d.current&&I.current===R&&!kn(N)){p("error");const U=N instanceof Error?N.message:"Could not start realtime voice.";T(U),y("Live voice could not start",U,"error")}}finally{!B&&E.current===C&&(E.current=null),M(),_.current===K&&(_.current=null),h.current=!1}},[y,V,r,c]),ee=o.useCallback(async()=>{if(!S){O("new"),T(null);try{if((k.current||c==="connecting"||c==="live")&&!await D())return;if(u?.session.messages.length===0){j([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"New live chat ready"}]);return}const v=await $("/api/scoutbot/session/reset",{method:"POST"});g(v),j([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"New live chat ready"}]),window.dispatchEvent(new CustomEvent(me,{detail:{id:v.session.id}}))}catch(v){const C=v instanceof Error?v.message:"Could not start a new Scoutbot chat.";T(C),y("Could not start a new live chat",C,"error")}finally{O(null)}}},[y,u?.session.messages.length,D,S,c]),te=o.useCallback(async v=>{if(!(!v||S||v===u?.session.id)){O(v),T(null);try{if((k.current||c==="connecting"||c==="live")&&!await D())return;const C=await $("/api/scoutbot/session/switch",{method:"POST",body:JSON.stringify({id:v})});g(C),j([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"Live chat restored",detail:C.session.title}]),window.dispatchEvent(new CustomEvent(me,{detail:{id:C.session.id}}))}catch(C){const R=C instanceof Error?C.message:"Could not switch Scoutbot chats.";T(R),y("Could not restore the live chat",R,"error")}finally{O(null)}}},[y,u?.session.id,D,S,c]),ne=o.useCallback(async v=>{const C=v.trim();if(!C)throw new Error("Preferred model is required.");const R=await $("/api/scoutbot/config",{method:"POST",body:JSON.stringify({model:C})});return g(M=>M&&{...M,config:{...M.config,...R.config}}),y("Scoutbot preferred model updated",R.config.model,"scoutbot"),R.config.model},[y]),re=o.useMemo(()=>({enabled:r,open:s,state:c,leaseId:f,error:w,trace:P,chatState:u,sessionAction:S,setOpen:a,startCall:Z,endCall:D,startNewChat:ee,switchChat:te,updatePreferredModel:ne,clearTrace:m,openVoiceSettings:Y}),[r,s,c,f,w,P,u,S,Z,D,ee,te,ne,m,Y]);return i.jsx(ze.Provider,{value:re,children:e})}function kn(e){return(e instanceof DOMException||e instanceof Error)&&e.name==="AbortError"}function mr(){return o.useContext(ze)}function En(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 xn(e){return e.type==="navigate"?JSON.stringify(e.route):e.type==="view-file"?e.path:e.reason?.trim()||e.type}async function An(e,t,n){t("Scoutbot is coordinating",`Asking ${e.targetLabel}`,"agent");try{const r=await $("/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 ge(e,t){const n=t?.trim();n&&e.add(n)}function Tn(e,t){const n=new Set;return ge(n,e.authorityNodeId),ge(n,e.homeNodeId),n.size===0&&ge(n,t),n}function Ge(e,t,n){return t?Tn(e,n).has(t):!0}function Rn(e,t,n){return t?e.filter(r=>Ge(r,t,n)):e}function vr(e,t,n){return t?new Set(e.filter(r=>Ge(r,t,n)).map(r=>r.id)):null}function G(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 In(e,t,n){return G(e,t,n)}function gr(e,t,n){return!t&&!n?e:e.filter(r=>In(r,t,n))}function Nn(e,t){return G(e,t)}function On(e,t){return t?e.filter(n=>Nn(n,t)):e}function De(e,t){return G(e,t)}function wr(e,t){if(!e||!t)return e;const n=e.activeAsks.filter(c=>G(c,t)),r=e.recentCompleted.filter(c=>G(c,t)),s=e.needsAttention.filter(c=>G(c,t)),a=On(e.activity,t);return{...e,totals:{active:n.length,recentCompleted:r.length,needsAttention:s.length,activity:a.length},activeAsks:n,recentCompleted:r,needsAttention:s,activity:a}}function br(e,t){if(!t)return e;const n=e.activeFlights.filter(a=>G(a,t)),r=e.childWork.filter(a=>De(a,t));return De(e,t)||n.length>0||r.length>0?{...e,activeFlights:n,childWork:r}:null}function _n(e){return!!(e&&(e.message.trim().length>0||e.files.length>0||e.forwardContext))}function Ln(e){return[e.name,e.type,e.size,e.lastModified].join(":")}function jn(e,t){const n=new Set;return[...e,...t].filter(r=>{const s=Ln(r);return n.has(s)?!1:(n.add(s),!0)})}function Dn(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:jn(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 Pn({request:e,onClose:t,onOpenCapture:n}){const{agents:r,route:s,navigate:a}=Qe(),c=ot(s),p=Rn(r,c),f=kt(s,p),[A,w]=o.useState(0),[T,P]=o.useState(null),[j,u]=o.useState(null),g=o.useRef(0),S=e?Dn(j,e):null,O=o.useCallback((E,_)=>{if(E.length===0)return;const I=!!(f.agentId||f.conversationId);n({intent:I?"route-capture":"new-task",files:E,attachmentFeedback:_,agentId:f.agentId??void 0,conversationId:f.conversationId??void 0,preferExistingChat:f.canUseExistingChat})},[n,f]);o.useEffect(()=>{if(!T)return;const E=window.setTimeout(()=>P(null),5e3);return()=>window.clearTimeout(E)},[T]),o.useEffect(()=>{const E=b=>{pe(b.dataTransfer)&&(b.preventDefault(),g.current+=1,w(g.current))},_=b=>{pe(b.dataTransfer)&&(b.preventDefault(),b.dataTransfer&&(b.dataTransfer.dropEffect="copy"))},I=()=>{g.current!==0&&(g.current=Math.max(0,g.current-1),w(g.current))},d=b=>{if(!pe(b.dataTransfer))return;b.preventDefault();const y=Ne(b.dataTransfer),m=y.filter(Oe),L=y.length-m.length;if(g.current=0,w(0),m.length===0){P(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 D=m.length===1?`Dropped ${m[0]?.name||"1 attachment"}.`:`Dropped ${m.length} attachments.`,V=L>0?`${D} Skipped ${L} unsupported ${L===1?"file":"files"}.`:D;P(null),O(m,V)},h=b=>{if(Ct(b.target)||!pe(b.clipboardData))return;b.preventDefault();const y=Ne(b.clipboardData),m=y.filter(Oe);if(m.length===0){P(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}O(m,m.length===1?`Pasted ${m[0]?.name||"1 attachment"}.`:`Pasted ${m.length} attachments.`)};return window.addEventListener("dragenter",E),window.addEventListener("dragover",_),window.addEventListener("dragleave",I),window.addEventListener("drop",d),window.addEventListener("paste",h),()=>{window.removeEventListener("dragenter",E),window.removeEventListener("dragover",_),window.removeEventListener("dragleave",I),window.removeEventListener("drop",d),window.removeEventListener("paste",h)}},[O]);const k=A>0&&!e;return i.jsxs(i.Fragment,{children:[k?i.jsx("div",{className:"s-capture-drop",role:"presentation",children:i.jsxs("div",{className:"s-capture-drop-card",children:[i.jsx("div",{className:"s-capture-drop-title",children:"Route capture"}),i.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,T?i.jsx("div",{className:"s-capture-feedback",role:"alert",children:T}):null,e?i.jsx(Et,{agents:p,route:s,navigate:a,onClose:t,initialAgentId:S?.agentId,initialConversationId:S?.conversationId,initialMessage:S?.message,initialFiles:S?.files,initialAttachmentFeedback:S?.attachmentFeedback??void 0,initialIntent:S?.intent,initialProjectPath:S?.projectPath,initialProjectQuery:S?.projectQuery,initialForwardContext:S?.forwardContext,initialForwardContextMode:S?.forwardContextMode,defaultMode:S?.mode,draftRestored:_n(j),onDraftChange:u,onDraftConsumed:()=>u(null)}):null]})}const We=o.createContext(null),Mn=["hello","node.upserted","actor.registered","agent.registered","agent.endpoint.upserted","invocation.requested","flight.updated","delivery.state.changed","scout.dispatched"],Fn=new Set(Mn),Bn=3e4,Un=250;function qn(e,t){try{return JSON.stringify(e)===JSON.stringify(t)?e:t}catch{return t}}const Vn={"--hud-bg":"oklch(0.132 0.004 260)","--hud-surface":"oklch(0.178 0.005 260)","--hud-ink":"oklch(0.965 0.006 260)","--hud-muted":"oklch(0.72 0.008 260)","--hud-dim":"oklch(0.57 0.007 260)","--hud-border":"oklch(0.965 0.006 260 / 0.04)","--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.965 0.006 260 / 0.012)","--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) 92%, transparent)","--scout-chrome-ink":"color-mix(in srgb, var(--hud-ink) 78%, transparent)","--scout-chrome-ink-soft":"color-mix(in srgb, var(--hud-ink) 58%, transparent)","--scout-chrome-ink-faint":"color-mix(in srgb, var(--hud-ink) 55%, transparent)","--scout-chrome-ink-ghost":"color-mix(in srgb, var(--hud-ink) 48%, 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-ink) 4%, 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)"},Hn={"--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)"},$n=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 Jn(e){return Object.fromEntries(Object.entries(e==="light"?Hn:Vn).filter(([n])=>!$n.has(n)))}function Qe(){const e=o.useContext(We);if(!e)throw new Error("useScout must be used inside ScoutProvider");return e}function yr({children:e,initialTheme:t="dark"}){const{route:n,navigate:r,navigateBack:s,canNavigateBack:a}=st(),c=xt(),p=Pe(Je,!1),[f,A]=o.useState([]),[w,T]=o.useState(!1),[P,j]=o.useState({status:"checking",message:null,lastCheckedAt:null}),[u,g]=o.useState(Te),[S,O]=o.useState(null),[k,E]=o.useState(!1),[_,I]=o.useState(null),[d,h]=o.useState(null),[b,y]=o.useState(""),[m,L]=o.useState(null),D=n.view==="settings",V=o.useMemo(()=>n.view!=="broker"||!n.attemptId?null:_?.id===n.attemptId?_:null,[_,n]),Y=o.useMemo(()=>n.view!=="search"||!n.hitId?null:d?.id===n.hitId?d:null,[d,n]),Z=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]),ee=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]),te=o.useCallback(()=>{r({view:"settings",section:"appearance"})},[r]),ne=o.useCallback(()=>{n.view==="settings"&&r({view:"inbox"})},[r,n.view]),re=o.useCallback(l=>{L(l??{intent:"new-task"})},[]),v=o.useCallback(()=>L(null),[]),C=o.useCallback(l=>{I(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]),R=o.useCallback(()=>{I(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(h(l),typeof x=="string"&&y(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]),K=o.useCallback(()=>{h(null),y(""),n.view==="search"&&n.hitId&&r({view:"search",...n.mode?{mode:n.mode}:{},...n.filters?{filters:n.filters}:{}},{replace:!0})},[r,n]),B=o.useMemo(()=>et(),[]),N=c?.resolvedTheme??t,U=c?.template??"hudson",q=o.useMemo(()=>({...Jn(N),...B??{}}),[B,N]),ae=o.useCallback(l=>{g(x=>({...x,...l}))},[]);o.useEffect(()=>{tt(N,U,u),nt(u)},[U,u,N]),o.useEffect(()=>{const l=x=>{x.key!==null&&x.key!==rt||g(Te())};return window.addEventListener("storage",l),()=>window.removeEventListener("storage",l)},[]);const ye=o.useMemo(()=>ut(f),[f]),Se=ye?.id??dt(f),Ce=ye?.conversationId??null,ce=o.useRef(null),W=o.useRef(null),le=n.view==="ops"?"/api/agents":"/api/agents?detail=summary",ue=o.useCallback(()=>{j({status:"online",message:null,lastCheckedAt:Date.now()})},[]),de=o.useCallback(l=>{const x=At(l);j({status:Tt(x)?"offline":"degraded",message:x,lastCheckedAt:Date.now()})},[]),J=o.useCallback(async()=>{const l=ce.current;if(l&&(await l.promise,l.url===le))return;const x=(async()=>{try{const F=await $(le);A(H=>qn(H,F)),ue()}catch(F){de(F)}finally{T(!0)}})();ce.current={url:le,promise:x};try{await x}finally{ce.current?.promise===x&&(ce.current=null)}},[le,de,ue]),Q=o.useCallback(async()=>{try{const l=await $("/api/onboarding/state");O(l),ue()}catch(l){de(l),O({hasLocalConfig:!0,hasProjectConfig:!0,hasOperatorName:!0,localConfigPath:null,projectRoot:null,currentDirectory:null,operatorName:null,operatorNameSuggestion:null})}},[de,ue]),ke=o.useCallback(()=>{E(!0),$("/api/onboarding/skip",{method:"POST",body:"{}"}).then(()=>Q()).catch(()=>null)},[Q]);o.useEffect(()=>{J(),Q()},[J,Q]),o.useEffect(()=>{const l=()=>{Re()&&J()},x=window.setInterval(l,Bn),F=at(l);return()=>{window.clearInterval(x),F()}},[J]);const Ee=o.useMemo(()=>f.filter(l=>ct(l.state)).length,[f]),[Xe,xe]=o.useState(null),oe=o.useCallback(l=>{l?.trim()&&xe(l.trim())},[]),se=o.useCallback(()=>xe(null),[]),X=o.useCallback(l=>{if(!ft(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":J();break;case"view-file":oe(l.path);break}},[r,oe,J]),Ye=o.useCallback((l,x)=>{const F=l.trim(),H=x.trim();if(!F||!H)return;const Ae=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,...Ae?{returnConversationId:Ae}:{}}})},[X,se,n]),fe=o.useRef({applyScoutbotUiAction:X});fe.current={applyScoutbotUiAction:X},it(l=>{Re()&&Fn.has(l.kind)&&(W.current!==null&&window.clearTimeout(W.current),W.current=window.setTimeout(()=>{W.current=null,J()},Un))}),o.useEffect(()=>()=>{W.current!==null&&window.clearTimeout(W.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 Ze=o.useMemo(()=>({route:n,navigate:r,navigateBack:s,canNavigateBack:a,agents:f,agentsLoaded:w,onlineCount:Ee,apiConnection:P,reload:J,appearanceDetails:u,updateAppearanceDetails:ae,onboarding:S,refreshOnboarding:Q,onboardingSkipped:k,skipOnboarding:ke,settingsOpen:D,openSettings:te,closeSettings:ne,scoutbotAgentId:Se,scoutbotConversationId:Ce,applyScoutbotUiAction:X,selectedBrokerAttempt:V,inspectBrokerAttempt:C,clearBrokerAttempt:R,selectedKnowledgeHit:Y,selectedKnowledgeQuery:b,inspectKnowledgeHit:M,clearKnowledgeHit:K,focusedSession:Z,focusSession:ee,openFilePreview:oe,closeFilePreview:se,openContextCapture:re,closeContextCapture:v}),[n,r,s,a,f,w,Ee,P,J,u,ae,S,Q,k,ke,D,te,ne,Se,Ce,X,V,C,R,Y,b,M,K,Z,ee,oe,se,re,v]);return i.jsx(We.Provider,{value:Ze,children:i.jsx("div",{"data-scout-theme-mode":N,"data-scout-palette":u.palette,"data-scout-contrast":u.contrast,"data-scout-accent":u.accent,"data-scout-shell":u.shell,"data-hudson-theme":N,"data-hudson-template":U,style:{...q},children:i.jsx("div",{"data-scout-theme":N,style:{display:"contents"},children:i.jsx(pt,{children:i.jsxs(Wt,{children:[p?i.jsx(Cn,{children:e}):e,i.jsx($t,{path:Xe,onOpenPath:oe,onOpenInCode:Ye,onClose:se}),i.jsx(Pn,{request:m,onClose:v,onOpenCapture:re})]})})})})})}export{Nt as A,_t as C,Vn as D,Hn as L,We as S,Je as a,mr as b,hr as c,On as d,Rn as e,At as f,gr as g,wr as h,Tt as i,yr as j,br as k,fr as l,vr as m,pr as n,me as o,yn as p,bn as s,Qe as u};
1
+ import{j as i,r as o,J as Te,b as et,K as tt,L as nt,C as rt}from"./index-DmFAhGPj.js";import{u as Pe,b as ot,as as st}from"./router-Cn_s9IGH.js";import{a as $}from"./api-h5zurxmi.js";import{u as it}from"./sse-CxXt4tqI.js";import{o as at,i as Re}from"./surface-activity-B1rgWB1i.js";import{i as ct}from"./colors-BtO5_zlx.js";import{e as Me,s as lt,i as Ie,r as ut,a as dt,f as ft}from"./scoutbot-BTIErYHo.js";import{C as pt}from"./ContextMenu-CHIuVKz7.js";import{F as ht,a as mt,D as vt}from"./DocumentFocusViewer-B9vodVmG.js";import{c as Fe,T as Be}from"./TextDocumentSurface-BWJCGBZf.js";import{C as gt}from"./chevron-right-BYMV1511.js";import{F as wt}from"./file-text-DcYSrI4v.js";import{c as Ue}from"./createLucideIcon-CFBn0Sdk.js";import{C as bt}from"./code-xml-BFc3TMSm.js";import{A as yt}from"./arrow-left-B-3GJ7ct.js";import{h as St}from"./scout-voice-CwbOz6EN.js";import{i as Ct}from"./keyboard-nav-h1IdakpD.js";import{d as pe,b as Ne,i as Oe}from"./MessageComposerSuggestions-FdVHnT_q.js";import{o as kt,N as Et}from"./NewChatComposer-Hd7pI5Ac.js";import{u as xt}from"./chunk-HRAB3GC3-dRd2eQMJ.js";function At(e){const t=e instanceof Error?e.message:String(e);return Rt(t)?"Scout server is unreachable":t}function Tt(e){return e==="Scout server is unreachable"}function Rt(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 It=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Nt=Ue("arrow-right",It);const Ot=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],_t=Ue("chevron-up",Ot),Lt={id:"audio",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("audio/"),render:({resource:e})=>{const t=e;return i.jsx("div",{className:"s-file-preview-media-wrap",children:i.jsx("div",{className:"s-file-preview-audio-stage",children:i.jsx("audio",{className:"s-file-preview-audio",src:t.rawUrl,controls:!0})})})}},jt={id:"binary",canHandle:()=>!0,render:({resource:e})=>{const t=e;return i.jsxs("div",{className:"s-file-preview-callout",children:[i.jsxs("div",{className:"s-file-preview-callout-title",children:[t.previewReason," — open in OS"]}),i.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."]})]})}},Dt=new Set(["text/typescript","text/javascript","text/css","text/html","application/json","text/yaml","text/toml","text/x-shellscript","text/plain"]),Pt={id:"code",canHandle:e=>e.kind==="file"&&e.previewable&&Dt.has(e.mediaType),render:({resource:e})=>{const t=e,n=Fe({id:t.realPath,title:t.title,uri:t.realPath,mediaType:t.mediaType,value:t.content,filename:t.title,kind:"code",readOnly:!0});return i.jsx(Be,{document:n,mode:"read",className:"s-doc-focus-document"})}},Mt={id:"directory",canHandle:e=>e.kind==="directory",render:({resource:e,openFilePreview:t})=>{const n=e,r=Ft(n.realPath,n.rootPath);return i.jsxs("div",{className:"s-file-preview-directory",children:[i.jsx("div",{className:"s-file-preview-breadcrumb","aria-label":"Directory breadcrumb",children:r.map((s,a)=>{const c=a===r.length-1;return i.jsxs("div",{className:"s-file-preview-breadcrumb-item",children:[a>0&&i.jsx(gt,{size:12,"aria-hidden":"true"}),c?i.jsx("span",{className:"s-file-preview-breadcrumb-current",children:s.label}):i.jsx("button",{type:"button",className:"s-file-preview-breadcrumb-link",onClick:()=>t(s.path),children:s.label})]},s.path)})}),i.jsxs("div",{className:"s-file-preview-directory-list",role:"list",children:[n.entries.map(s=>i.jsxs("button",{type:"button",className:"s-file-preview-entry",onClick:()=>t(s.path),children:[i.jsx("span",{className:"s-file-preview-entry-icon","aria-hidden":"true",children:s.kind==="directory"?i.jsx(ht,{size:14}):i.jsx(wt,{size:14})}),i.jsx("span",{className:"s-file-preview-entry-name",children:s.name}),i.jsx("span",{className:"s-file-preview-entry-kind",children:s.kind==="directory"?"dir":"file"})]},s.realPath)),n.entries.length===0&&i.jsx("div",{className:"s-file-preview-directory-empty",children:"This directory is empty."})]})]})}};function Ft(e,t){const n=t==="/"?"/":t.replace(/\/+$/u,""),r=e==="/"?"/":e.replace(/\/+$/u,""),s=n.split("/").filter(Boolean),a=r.split("/").filter(Boolean),c=[{label:s[s.length-1]??"/",path:n||"/"}];let p=n||"/";for(let f=s.length;f<a.length;f+=1){const A=a[f];A&&(p=p==="/"?`/${A}`:`${p}/${A}`,c.push({label:A,path:p}))}return c}const Bt={id:"html",canHandle:e=>e.kind==="file"&&e.previewable&&e.mediaType==="text/html",render:({resource:e})=>i.jsx("div",{className:"s-file-preview-html-wrap",children:i.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"})})},Ut={id:"image",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("image/"),render:({resource:e})=>i.jsx("div",{className:"s-file-preview-image-wrap",children:i.jsx("div",{className:"s-file-preview-image-stage",children:i.jsx("img",{className:"s-file-preview-image",src:e.kind==="file"?e.rawUrl:"",alt:e.title})})})},qt={id:"markdown",canHandle:e=>e.kind==="file"&&e.previewable&&e.mediaType==="text/markdown",render:({resource:e})=>{const t=e,n=Fe({id:t.realPath,title:t.title,uri:t.realPath,mediaType:t.mediaType,value:t.content,filename:t.title,kind:"markdown",readOnly:!0});return i.jsx(Be,{document:n,mode:"preview",className:"s-doc-focus-document"})}},Vt={id:"video",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("video/"),render:({resource:e})=>{const t=e;return i.jsx("div",{className:"s-file-preview-media-wrap",children:i.jsx("div",{className:"s-file-preview-media-stage",children:i.jsx("video",{className:"s-file-preview-video",src:t.rawUrl,controls:!0})})})}},Ht=[Mt,qt,Bt,Pt,Ut,Vt,Lt,jt];function $t({path:e,onOpenPath:t,onOpenInCode:n,onClose:r}){const[s,a]=o.useState(null),[c,p]=o.useState(null),[f,A]=o.useState(!1),[w,T]=o.useState(null),P=o.useRef(null);o.useEffect(()=>{P.current=w},[w]),o.useEffect(()=>{if(!e){a(null),p(null),A(!1);return}let d=!1;return A(!0),p(null),a(null),$(`/api/file/preview?path=${encodeURIComponent(e)}`).then(h=>{d||(a(h),Jt(h,P.current,T))}).catch(h=>{d||p(h instanceof Error?h.message:"could not load file")}).finally(()=>{d||A(!1)}),()=>{d=!0}},[e]);const{currentIndex:j,prevPath:u,nextPath:g}=o.useMemo(()=>{if(!s||s.kind!=="file"||!w)return{currentIndex:-1,prevPath:null,nextPath:null};const d=w.files.findIndex(h=>h.realPath===s.realPath);return d<0?{currentIndex:-1,prevPath:null,nextPath:null}:{currentIndex:d,prevPath:d>0?w.files[d-1].path:null,nextPath:d<w.files.length-1?w.files[d+1].path:null}},[s,w]);if(o.useEffect(()=>{if(!e)return;const d=h=>{if(h.key==="Escape"){r();return}if(h.target instanceof HTMLElement){const b=h.target.tagName;if(b==="INPUT"||b==="TEXTAREA"||h.target.isContentEditable)return}h.metaKey||h.ctrlKey||h.altKey||(h.key==="ArrowLeft"&&u?(h.preventDefault(),t(u)):h.key==="ArrowRight"&&g?(h.preventDefault(),t(g)):h.key==="Backspace"&&w&&s?.kind==="file"&&(h.preventDefault(),t(w.dirPath)))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,r,t,u,g,w,s]),!e)return null;const S=()=>{$("/api/file/reveal",{method:"POST",body:JSON.stringify({path:s?.realPath??e})}).catch(d=>{p(d instanceof Error?d.message:"reveal failed")})},O=s?Ht.find(d=>d.canHandle(s))??null:null,k=!!(s&&s.kind==="file"&&w&&j>=0&&w.files.length>1),E=[];k&&w&&E.push({label:`Folder: ${w.dirTitle}`,icon:i.jsx(_t,{size:12}),onClick:()=>t(w.dirPath),title:`Back to ${w.dirTitle} (Backspace)`}),E.push({label:"Open in Code",icon:i.jsx(bt,{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"}),E.push({label:"Show in folder",icon:i.jsx(mt,{size:12}),onClick:S,title:"Show this file in its operating system folder",hideLabel:!0});const _=s?zt(s):[];k&&_.unshift(`${j+1} / ${w.files.length}`);const I=s&&O?O.render({resource:s,openFilePreview:t}):null;return i.jsx(vt,{open:!0,kind:Kt(s),document:null,title:s?.title??e.split("/").pop()??"File",eyebrow:"File preview",subtitle:s?.realPath??e,meta:_,state:f?"Loading…":null,error:c,body:I?i.jsxs("div",{className:`s-file-preview-shell${k?" s-file-preview-shell-nav":""}`,children:[k&&i.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:i.jsx(yt,{size:18,strokeWidth:1.8,"aria-hidden":"true"})}),i.jsx("div",{className:"s-file-preview-shell-body",children:I}),k&&i.jsx("button",{type:"button",className:"s-file-preview-side-nav s-file-preview-side-nav-right",onClick:()=>g&&t(g),disabled:!g,"aria-label":"Next file",title:"Next file (→)",children:i.jsx(Nt,{size:18,strokeWidth:1.8,"aria-hidden":"true"})})]}):null,actions:E,onClose:r})}function Jt(e,t,n){if(e.kind==="directory"){const s=e.entries.filter(a=>a.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 Kt(e){return!e||e.kind==="directory"||e.mediaType==="text/markdown"||e.mediaType==="text/plain"?"doc":"code"}function zt(e){return e.kind==="directory"?[`${e.entries.length} ${e.entries.length===1?"entry":"entries"}`]:[...e.previewable&&e.truncated?["truncated"]:[],Gt(e.sizeBytes),e.mediaType]}function Gt(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const qe={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}},z=()=>{},Ve={focusScoutbot:z,triggerBrief:z,triggerAskState:z,toggleVoiceReplies:z,openScoutbotSettings:z,startNewChat:z,dismissReminder:z,askReminderStatus:z},we=o.createContext(null);function Wt({children:e}){const[t,n]=o.useState(qe),r=o.useRef(Ve),s=o.useCallback(f=>{n(A=>Qt(A,f)?A:f)},[]),a=o.useCallback(f=>{r.current=f},[]),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:f=>r.current.dismissReminder(f),askReminderStatus:f=>r.current.askReminderStatus(f)}),[]),p=o.useMemo(()=>({state:t,actions:c,publishState:s,registerActions:a}),[t,c,s,a]);return i.jsx(we.Provider,{value:p,children:e})}function fr(){const e=o.useContext(we);return e?{state:e.state,actions:e.actions}:{state:qe,actions:Ve}}function pr(){const e=o.useContext(we);return e?{publishState:e.publishState,registerActions:e.registerActions}:null}function Qt(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&&Xt(e.reminders.due,t.reminders.due)&&He(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 Xt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!He(e[n],t[n]))return!1;return!0}function He(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 Yt="/api/voice/realtime/call",$e="/api/voice/realtime/lease",Zt="x-openscout-realtime-voice-lease",Je="surface.realtime-voice",hr="scout:realtime-voice-stop",en={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}},tn={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}},nn="/api/scoutbot/chat",rn=25e3;async function on(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,a=null,c=null,p=0,f=0;const A=(u,g,S="voice")=>{f+=1,e.onTrace?.({id:`voice-${f}`,at:Date.now(),kind:S,label:u,...g?{detail:g}:{}})};let w=null;const T=()=>{if(w)return w;r=!0,e.signal?.removeEventListener("abort",j),c&&clearInterval(c),c=null,s?.getTracks().forEach(g=>g.stop()),n.pause(),n.srcObject=null,t.close();const u=a;return a=null,w=(async()=>{u&&await vn(u),e.onState?.("ended")})(),w},P=()=>{T().catch(u=>{e.onError?.(u instanceof Error?u.message:"Could not release the realtime voice lease."),e.onState?.("error")})},j=()=>{P()};e.signal?.addEventListener("abort",j,{once:!0}),t.ontrack=({streams:u})=>{const g=u[0];if(!g||r)return;const[S]=g.getAudioTracks();S&&S.addEventListener("ended",()=>{r||e.onError?.("Realtime voice audio ended unexpectedly.")}),n.srcObject=g,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"),A("Realtime channel connected","Scoutbot bridge is ready")):(t.connectionState==="failed"||t.connectionState==="disconnected")&&(e.onError?.("Realtime voice connection ended unexpectedly."),P()))};try{s=await hn(e.inputDeviceName,e.signal),ie(e.signal);for(const m of s.getTracks())t.addTrack(m,s);const u=t.createDataChannel("oai-events"),g=new Set;let S=Promise.resolve(),O=!1,k=null;const E=[],_=m=>{if(r||u.readyState!=="open")return!1;try{return u.send(JSON.stringify(m)),!0}catch{return e.onError?.("Realtime voice events channel closed unexpectedly."),!1}},I=()=>{if(O||k||E.length===0)return;const m=E.shift();if(m){if(k=m,!_({type:"response.create",response:{instructions:m}})){k=null,E.unshift(m);return}O=!0}},d=m=>{E.push(m),I()};u.addEventListener("open",()=>{if(r)return;const m=pn(e.inputDeviceName);if(!_({type:"session.update",session:{type:"realtime",audio:{input:m}}})){e.onError?.("Could not configure Scout's realtime microphone processing.");return}A("Scoutbot bridge ready","Live fleet context is available"),d("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",m=>{const L=an(m.data);if(L?.type==="error"){if(Ke(L.message)){k&&(E.unshift(k),k=null),O=!0,A("Scoutbot reply queued","Waiting for the current spoken response to finish","scoutbot");return}e.onError?.(L.message??"OpenAI Realtime reported an error.");return}if(L?.type==="response.created"){O=!0,k=null;return}if(L?.type==="response.done"){O=!1,k=null;for(const D of cn(L))D.name!=="ask_scoutbot"||g.has(D.callId)||(g.add(D.callId),S=S.then(()=>sn({functionCall:D,route:e.getRoute?.()??e.route,uiContext:e.getUiContext?.(),onReply:e.onScoutbotReply,onTrace:A,send:_,requestResponse:d})).catch(V=>{e.onError?.(V instanceof Error?V.message:"Scoutbot could not complete the voice request.")}));I()}});const h=await he(t.createOffer(),e.signal);if(await he(t.setLocalDescription(h),e.signal),!h.sdp)throw new Error("Could not create a WebRTC offer.");const b=await fetch(Yt,{method:"POST",headers:{"content-type":"application/sdp"},body:h.sdp,signal:e.signal});a=b.headers.get(Zt)?.trim()||null;const y=await he(b.text(),e.signal);if(!b.ok)throw new Error(dn(y,b.status));if(!a)throw new Error("Scout started the audio connection without a concurrency lease. Please try again.");return c=setInterval(()=>{if(!a||r)return;const m=a;mn(m).then(L=>{if(!(r||m!==a)){if(L){p=0;return}e.onError?.("Realtime voice lost its server lease. Reconnect to continue safely."),P()}}).catch(()=>{p+=1,!(p<2||r)&&(e.onError?.("Realtime voice could not renew its server lease. Check the connection and try again."),P())})},rn),await he(t.setRemoteDescription({type:"answer",sdp:y}),e.signal),ie(e.signal),{leaseId:a,stop:T}}catch(u){throw await T(),u}}async function sn(e){const t=ln(e.functionCall.arguments);if(!t){e.onTrace("Scoutbot request could not be read",void 0,"error"),ve(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(nn,{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(un(r,n.status));const s=JSON.parse(r),a=typeof s.reply?.body=="string"?s.reply.body.trim():"";if(!a)throw new Error("Scoutbot returned an empty reply.");const c=Me(a).filter(A=>A.type==="ask-agent").length,p=e.onReply?await e.onReply(a):{agentRequests:{requested:c,sent:0,failed:c}},f=lt(a);e.onTrace("Scoutbot reply ready",void 0,"scoutbot"),ve(e,{ok:!0,reply:f,...p.agentRequests.requested>0?{agentRequests:p.agentRequests}:{}})}catch(n){const r=n instanceof Error?n.message:"Scoutbot could not complete the voice request.";e.onTrace("Scoutbot request failed",r,"error"),ve(e,{ok:!1,error:r})}}function ve(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 Ke(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 an(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 cn(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 ln(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 un(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 dn(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(be(t));t.addEventListener("abort",s,{once:!0}),e.then(a=>{t.removeEventListener("abort",s),n(a)},a=>{t.removeEventListener("abort",s),r(a)})})):e}async function _e(e,t){return t?(ie(t),new Promise((n,r)=>{let s=!1;const a=()=>{s=!0,r(be(t))};t.addEventListener("abort",a,{once:!0}),e.then(c=>{if(t.removeEventListener("abort",a),s||t.aborted){c.getTracks().forEach(p=>p.stop());return}n(c)},c=>{t.removeEventListener("abort",a),s||r(c)})})):e}const Le={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1},fn=/\b(?:airpods?|earbuds?|earphones?|headsets?|headphones?|buds?|hands[- ]?free)\b/iu;function pn(e){return fn.test(e?.trim()??"")?tn:en}async function hn(e,t){const n=await je(e);let r=await _e(navigator.mediaDevices.getUserMedia({audio:{...Le,...n?{deviceId:{exact:n.deviceId}}:{}}}),t);if(!n&&e?.trim()){const s=await je(e),a=r.getAudioTracks?.()[0]?.label?.trim().toLocaleLowerCase()??"";if(s&&s.label.trim().toLocaleLowerCase()!==a)try{const c=await _e(navigator.mediaDevices.getUserMedia({audio:{...Le,deviceId:{exact:s.deviceId}}}),t);r.getTracks().forEach(p=>p.stop()),r=c}catch(c){if(t?.aborted)throw r.getTracks().forEach(p=>p.stop()),c}}for(const s of r.getAudioTracks?.()??[])s.contentHint="speech";return r}async function je(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 be(e)}function be(e){return e.reason instanceof Error?e.reason:new DOMException("Realtime voice connection was cancelled.","AbortError")}async function mn(e){return(await fetch(`${$e}/${encodeURIComponent(e)}`,{method:"PUT"})).ok}async function vn(e){const t=await fetch(`${$e}/${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 gn=[{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"}}],wn=[{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 bn(e){const t=e==="macos";return{host:e,shellLabel:t?"Scout for macOS":"OpenScout web",destinations:t?wn:gn,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 yn="scout:scoutbot-realtime-reply",me="scout:scoutbot-session-changed",Sn={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:()=>{}},ze=o.createContext(Sn);function Cn({children:e}){const{route:t,applyScoutbotUiAction:n}=Qe(),r=Pe(Je,!1),[s,a]=o.useState(!1),[c,p]=o.useState("idle"),[f,A]=o.useState(null),[w,T]=o.useState(null),[P,j]=o.useState([]),[u,g]=o.useState(null),[S,O]=o.useState(null),k=o.useRef(null),E=o.useRef(null),_=o.useRef(null),I=o.useRef(0),d=o.useRef(!1),h=o.useRef(!1),b=o.useRef({route:t,applyScoutbotUiAction:n});b.current={route:t,applyScoutbotUiAction:n};const y=o.useCallback((v,C,R="voice")=>{j(M=>[...M,{id:`voice-ui-${Date.now()}-${M.length}`,at:Date.now(),kind:R,label:v,...C?{detail:C}:{}}].slice(-100))},[]),m=o.useCallback(()=>j([]),[]),L=o.useCallback(async()=>{const v=await $("/api/scoutbot/session");return d.current||g(v),v},[]);o.useEffect(()=>{if(!r)return;const v=()=>{L().catch(C=>{d.current||T(C instanceof Error?C.message:"Could not load Scoutbot chats.")})};return v(),window.addEventListener(me,v),()=>window.removeEventListener(me,v)},[r,L]);const D=o.useCallback(async()=>{I.current+=1;const v=_.current;E.current?.abort(),E.current=null;const C=k.current;k.current=null;try{await C?.stop(),await v}catch(R){return d.current||(p("error"),T(R instanceof Error?R.message:"Could not end realtime voice cleanly.")),!1}return d.current||(A(null),p("ended"),y("Live voice ended","Microphone and host lease released","voice")),!0},[y]);o.useEffect(()=>{r||(a(!1),(k.current||c==="connecting"||c==="live")&&D())},[r,D,c]),o.useEffect(()=>(d.current=!1,()=>{d.current=!0,I.current+=1,E.current?.abort(),E.current=null,k.current?.stop().catch(()=>{}),k.current=null}),[]);const V=o.useCallback(async v=>{window.dispatchEvent(new CustomEvent(yn,{detail:{body:v}}));const C=v.replace(/```[\s\S]*?```/gu,"").trim();C&&y("Scoutbot replied",C.slice(0,2e3),"scoutbot");let R=0,M=0,K=0;for(const B of Me(v))if(B.type==="ask-agent")R+=1,await An(B,y,T)?M+=1:K+=1;else if(B.type!=="reminder"){const N=xn(B),U=B.type==="navigate"||B.type==="view-file"?"navigation":"scoutbot";y(En(B),N,U),b.current.applyScoutbotUiAction(B),y(Ie()?"Action sent to Scout for macOS":"Action applied in OpenScout",N,U)}return await L().catch(()=>null),{agentRequests:{requested:R,sent:M,failed:K}}},[y,L]),Y=o.useCallback(()=>{const v={type:"navigate",route:{view:"settings",section:"voice"}};y("Voice settings requested",void 0,"navigation"),b.current.applyScoutbotUiAction(v)},[y]),Z=o.useCallback(async()=>{if(!r){T("Turn on live voice in Settings → Voice before starting a call."),a(!1);return}if(h.current||c==="connecting"||c==="live")return;h.current=!0,E.current?.abort();const v=k.current;k.current=null;try{await v?.stop(),A(null)}catch(N){p("error"),T(N instanceof Error?N.message:"Could not end the previous realtime voice call."),h.current=!1;return}const C=new AbortController;E.current=C;const R=I.current+1;I.current=R;let M=()=>{};const K=new Promise(N=>{M=N});_.current=K;let B=!1;T(null),j([{id:"connecting",at:Date.now(),label:"Connecting secure audio"}]),p("connecting");try{const N=await St().then(({settings:q})=>q.inputDeviceName).catch(()=>null),U=await on({signal:C.signal,inputDeviceName:N,getRoute:()=>b.current.route,getUiContext:()=>bn(Ie()?"macos":"web"),onState:q=>{!d.current&&I.current===R&&p(q)},onError:q=>{if(!(d.current||I.current!==R)){if(Ke(q)){y("Scoutbot reply queued","Waiting for the current spoken response to finish","scoutbot");return}T(q),y("Voice issue",q,"error")}},onTrace:q=>{!d.current&&I.current===R&&j(ae=>[...ae,q].slice(-100))},onScoutbotReply:q=>!d.current&&I.current===R?V(q):{agentRequests:{requested:0,sent:0,failed:0}}});if(d.current||C.signal.aborted||I.current!==R){await U.stop();return}k.current=U,A(U.leaseId),B=!0}catch(N){if(!d.current&&I.current===R&&!kn(N)){p("error");const U=N instanceof Error?N.message:"Could not start realtime voice.";T(U),y("Live voice could not start",U,"error")}}finally{!B&&E.current===C&&(E.current=null),M(),_.current===K&&(_.current=null),h.current=!1}},[y,V,r,c]),ee=o.useCallback(async()=>{if(!S){O("new"),T(null);try{if((k.current||c==="connecting"||c==="live")&&!await D())return;if(u?.session.messages.length===0){j([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"New live chat ready"}]);return}const v=await $("/api/scoutbot/session/reset",{method:"POST"});g(v),j([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"New live chat ready"}]),window.dispatchEvent(new CustomEvent(me,{detail:{id:v.session.id}}))}catch(v){const C=v instanceof Error?v.message:"Could not start a new Scoutbot chat.";T(C),y("Could not start a new live chat",C,"error")}finally{O(null)}}},[y,u?.session.messages.length,D,S,c]),te=o.useCallback(async v=>{if(!(!v||S||v===u?.session.id)){O(v),T(null);try{if((k.current||c==="connecting"||c==="live")&&!await D())return;const C=await $("/api/scoutbot/session/switch",{method:"POST",body:JSON.stringify({id:v})});g(C),j([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"Live chat restored",detail:C.session.title}]),window.dispatchEvent(new CustomEvent(me,{detail:{id:C.session.id}}))}catch(C){const R=C instanceof Error?C.message:"Could not switch Scoutbot chats.";T(R),y("Could not restore the live chat",R,"error")}finally{O(null)}}},[y,u?.session.id,D,S,c]),ne=o.useCallback(async v=>{const C=v.trim();if(!C)throw new Error("Preferred model is required.");const R=await $("/api/scoutbot/config",{method:"POST",body:JSON.stringify({model:C})});return g(M=>M&&{...M,config:{...M.config,...R.config}}),y("Scoutbot preferred model updated",R.config.model,"scoutbot"),R.config.model},[y]),re=o.useMemo(()=>({enabled:r,open:s,state:c,leaseId:f,error:w,trace:P,chatState:u,sessionAction:S,setOpen:a,startCall:Z,endCall:D,startNewChat:ee,switchChat:te,updatePreferredModel:ne,clearTrace:m,openVoiceSettings:Y}),[r,s,c,f,w,P,u,S,Z,D,ee,te,ne,m,Y]);return i.jsx(ze.Provider,{value:re,children:e})}function kn(e){return(e instanceof DOMException||e instanceof Error)&&e.name==="AbortError"}function mr(){return o.useContext(ze)}function En(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 xn(e){return e.type==="navigate"?JSON.stringify(e.route):e.type==="view-file"?e.path:e.reason?.trim()||e.type}async function An(e,t,n){t("Scoutbot is coordinating",`Asking ${e.targetLabel}`,"agent");try{const r=await $("/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 ge(e,t){const n=t?.trim();n&&e.add(n)}function Tn(e,t){const n=new Set;return ge(n,e.authorityNodeId),ge(n,e.homeNodeId),n.size===0&&ge(n,t),n}function Ge(e,t,n){return t?Tn(e,n).has(t):!0}function Rn(e,t,n){return t?e.filter(r=>Ge(r,t,n)):e}function vr(e,t,n){return t?new Set(e.filter(r=>Ge(r,t,n)).map(r=>r.id)):null}function G(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 In(e,t,n){return G(e,t,n)}function gr(e,t,n){return!t&&!n?e:e.filter(r=>In(r,t,n))}function Nn(e,t){return G(e,t)}function On(e,t){return t?e.filter(n=>Nn(n,t)):e}function De(e,t){return G(e,t)}function wr(e,t){if(!e||!t)return e;const n=e.activeAsks.filter(c=>G(c,t)),r=e.recentCompleted.filter(c=>G(c,t)),s=e.needsAttention.filter(c=>G(c,t)),a=On(e.activity,t);return{...e,totals:{active:n.length,recentCompleted:r.length,needsAttention:s.length,activity:a.length},activeAsks:n,recentCompleted:r,needsAttention:s,activity:a}}function br(e,t){if(!t)return e;const n=e.activeFlights.filter(a=>G(a,t)),r=e.childWork.filter(a=>De(a,t));return De(e,t)||n.length>0||r.length>0?{...e,activeFlights:n,childWork:r}:null}function _n(e){return!!(e&&(e.message.trim().length>0||e.files.length>0||e.forwardContext))}function Ln(e){return[e.name,e.type,e.size,e.lastModified].join(":")}function jn(e,t){const n=new Set;return[...e,...t].filter(r=>{const s=Ln(r);return n.has(s)?!1:(n.add(s),!0)})}function Dn(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:jn(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 Pn({request:e,onClose:t,onOpenCapture:n}){const{agents:r,route:s,navigate:a}=Qe(),c=ot(s),p=Rn(r,c),f=kt(s,p),[A,w]=o.useState(0),[T,P]=o.useState(null),[j,u]=o.useState(null),g=o.useRef(0),S=e?Dn(j,e):null,O=o.useCallback((E,_)=>{if(E.length===0)return;const I=!!(f.agentId||f.conversationId);n({intent:I?"route-capture":"new-task",files:E,attachmentFeedback:_,agentId:f.agentId??void 0,conversationId:f.conversationId??void 0,preferExistingChat:f.canUseExistingChat})},[n,f]);o.useEffect(()=>{if(!T)return;const E=window.setTimeout(()=>P(null),5e3);return()=>window.clearTimeout(E)},[T]),o.useEffect(()=>{const E=b=>{pe(b.dataTransfer)&&(b.preventDefault(),g.current+=1,w(g.current))},_=b=>{pe(b.dataTransfer)&&(b.preventDefault(),b.dataTransfer&&(b.dataTransfer.dropEffect="copy"))},I=()=>{g.current!==0&&(g.current=Math.max(0,g.current-1),w(g.current))},d=b=>{if(!pe(b.dataTransfer))return;b.preventDefault();const y=Ne(b.dataTransfer),m=y.filter(Oe),L=y.length-m.length;if(g.current=0,w(0),m.length===0){P(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 D=m.length===1?`Dropped ${m[0]?.name||"1 attachment"}.`:`Dropped ${m.length} attachments.`,V=L>0?`${D} Skipped ${L} unsupported ${L===1?"file":"files"}.`:D;P(null),O(m,V)},h=b=>{if(Ct(b.target)||!pe(b.clipboardData))return;b.preventDefault();const y=Ne(b.clipboardData),m=y.filter(Oe);if(m.length===0){P(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}O(m,m.length===1?`Pasted ${m[0]?.name||"1 attachment"}.`:`Pasted ${m.length} attachments.`)};return window.addEventListener("dragenter",E),window.addEventListener("dragover",_),window.addEventListener("dragleave",I),window.addEventListener("drop",d),window.addEventListener("paste",h),()=>{window.removeEventListener("dragenter",E),window.removeEventListener("dragover",_),window.removeEventListener("dragleave",I),window.removeEventListener("drop",d),window.removeEventListener("paste",h)}},[O]);const k=A>0&&!e;return i.jsxs(i.Fragment,{children:[k?i.jsx("div",{className:"s-capture-drop",role:"presentation",children:i.jsxs("div",{className:"s-capture-drop-card",children:[i.jsx("div",{className:"s-capture-drop-title",children:"Route capture"}),i.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,T?i.jsx("div",{className:"s-capture-feedback",role:"alert",children:T}):null,e?i.jsx(Et,{agents:p,route:s,navigate:a,onClose:t,initialAgentId:S?.agentId,initialConversationId:S?.conversationId,initialMessage:S?.message,initialFiles:S?.files,initialAttachmentFeedback:S?.attachmentFeedback??void 0,initialIntent:S?.intent,initialProjectPath:S?.projectPath,initialProjectQuery:S?.projectQuery,initialForwardContext:S?.forwardContext,initialForwardContextMode:S?.forwardContextMode,defaultMode:S?.mode,draftRestored:_n(j),onDraftChange:u,onDraftConsumed:()=>u(null)}):null]})}const We=o.createContext(null),Mn=["hello","node.upserted","actor.registered","agent.registered","agent.endpoint.upserted","invocation.requested","flight.updated","delivery.state.changed","scout.dispatched"],Fn=new Set(Mn),Bn=3e4,Un=250;function qn(e,t){try{return JSON.stringify(e)===JSON.stringify(t)?e:t}catch{return t}}const Vn={"--hud-bg":"oklch(0.132 0.004 260)","--hud-surface":"oklch(0.178 0.005 260)","--hud-ink":"oklch(0.965 0.006 260)","--hud-muted":"oklch(0.72 0.008 260)","--hud-dim":"oklch(0.57 0.007 260)","--hud-border":"oklch(0.965 0.006 260 / 0.04)","--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.965 0.006 260 / 0.012)","--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) 92%, transparent)","--scout-chrome-ink":"color-mix(in srgb, var(--hud-ink) 78%, transparent)","--scout-chrome-ink-soft":"color-mix(in srgb, var(--hud-ink) 58%, transparent)","--scout-chrome-ink-faint":"color-mix(in srgb, var(--hud-ink) 55%, transparent)","--scout-chrome-ink-ghost":"color-mix(in srgb, var(--hud-ink) 48%, 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-ink) 4%, 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)"},Hn={"--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)"},$n=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 Jn(e){return Object.fromEntries(Object.entries(e==="light"?Hn:Vn).filter(([n])=>!$n.has(n)))}function Qe(){const e=o.useContext(We);if(!e)throw new Error("useScout must be used inside ScoutProvider");return e}function yr({children:e,initialTheme:t="dark"}){const{route:n,navigate:r,navigateBack:s,canNavigateBack:a}=st(),c=xt(),p=Pe(Je,!1),[f,A]=o.useState([]),[w,T]=o.useState(!1),[P,j]=o.useState({status:"checking",message:null,lastCheckedAt:null}),[u,g]=o.useState(Te),[S,O]=o.useState(null),[k,E]=o.useState(!1),[_,I]=o.useState(null),[d,h]=o.useState(null),[b,y]=o.useState(""),[m,L]=o.useState(null),D=n.view==="settings",V=o.useMemo(()=>n.view!=="broker"||!n.attemptId?null:_?.id===n.attemptId?_:null,[_,n]),Y=o.useMemo(()=>n.view!=="search"||!n.hitId?null:d?.id===n.hitId?d:null,[d,n]),Z=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]),ee=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]),te=o.useCallback(()=>{r({view:"settings",section:"appearance"})},[r]),ne=o.useCallback(()=>{n.view==="settings"&&r({view:"inbox"})},[r,n.view]),re=o.useCallback(l=>{L(l??{intent:"new-task"})},[]),v=o.useCallback(()=>L(null),[]),C=o.useCallback(l=>{I(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]),R=o.useCallback(()=>{I(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(h(l),typeof x=="string"&&y(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]),K=o.useCallback(()=>{h(null),y(""),n.view==="search"&&n.hitId&&r({view:"search",...n.mode?{mode:n.mode}:{},...n.filters?{filters:n.filters}:{}},{replace:!0})},[r,n]),B=o.useMemo(()=>et(),[]),N=c?.resolvedTheme??t,U=c?.template??"hudson",q=o.useMemo(()=>({...Jn(N),...B??{}}),[B,N]),ae=o.useCallback(l=>{g(x=>({...x,...l}))},[]);o.useEffect(()=>{tt(N,U,u),nt(u)},[U,u,N]),o.useEffect(()=>{const l=x=>{x.key!==null&&x.key!==rt||g(Te())};return window.addEventListener("storage",l),()=>window.removeEventListener("storage",l)},[]);const ye=o.useMemo(()=>ut(f),[f]),Se=ye?.id??dt(f),Ce=ye?.conversationId??null,ce=o.useRef(null),W=o.useRef(null),le=n.view==="ops"?"/api/agents":"/api/agents?detail=summary",ue=o.useCallback(()=>{j({status:"online",message:null,lastCheckedAt:Date.now()})},[]),de=o.useCallback(l=>{const x=At(l);j({status:Tt(x)?"offline":"degraded",message:x,lastCheckedAt:Date.now()})},[]),J=o.useCallback(async()=>{const l=ce.current;if(l&&(await l.promise,l.url===le))return;const x=(async()=>{try{const F=await $(le);A(H=>qn(H,F)),ue()}catch(F){de(F)}finally{T(!0)}})();ce.current={url:le,promise:x};try{await x}finally{ce.current?.promise===x&&(ce.current=null)}},[le,de,ue]),Q=o.useCallback(async()=>{try{const l=await $("/api/onboarding/state");O(l),ue()}catch(l){de(l),O({hasLocalConfig:!0,hasProjectConfig:!0,hasOperatorName:!0,localConfigPath:null,projectRoot:null,currentDirectory:null,operatorName:null,operatorNameSuggestion:null})}},[de,ue]),ke=o.useCallback(()=>{E(!0),$("/api/onboarding/skip",{method:"POST",body:"{}"}).then(()=>Q()).catch(()=>null)},[Q]);o.useEffect(()=>{J(),Q()},[J,Q]),o.useEffect(()=>{const l=()=>{Re()&&J()},x=window.setInterval(l,Bn),F=at(l);return()=>{window.clearInterval(x),F()}},[J]);const Ee=o.useMemo(()=>f.filter(l=>ct(l.state)).length,[f]),[Xe,xe]=o.useState(null),oe=o.useCallback(l=>{l?.trim()&&xe(l.trim())},[]),se=o.useCallback(()=>xe(null),[]),X=o.useCallback(l=>{if(!ft(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":J();break;case"view-file":oe(l.path);break}},[r,oe,J]),Ye=o.useCallback((l,x)=>{const F=l.trim(),H=x.trim();if(!F||!H)return;const Ae=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,...Ae?{returnConversationId:Ae}:{}}})},[X,se,n]),fe=o.useRef({applyScoutbotUiAction:X});fe.current={applyScoutbotUiAction:X},it(l=>{Re()&&Fn.has(l.kind)&&(W.current!==null&&window.clearTimeout(W.current),W.current=window.setTimeout(()=>{W.current=null,J()},Un))}),o.useEffect(()=>()=>{W.current!==null&&window.clearTimeout(W.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 Ze=o.useMemo(()=>({route:n,navigate:r,navigateBack:s,canNavigateBack:a,agents:f,agentsLoaded:w,onlineCount:Ee,apiConnection:P,reload:J,appearanceDetails:u,updateAppearanceDetails:ae,onboarding:S,refreshOnboarding:Q,onboardingSkipped:k,skipOnboarding:ke,settingsOpen:D,openSettings:te,closeSettings:ne,scoutbotAgentId:Se,scoutbotConversationId:Ce,applyScoutbotUiAction:X,selectedBrokerAttempt:V,inspectBrokerAttempt:C,clearBrokerAttempt:R,selectedKnowledgeHit:Y,selectedKnowledgeQuery:b,inspectKnowledgeHit:M,clearKnowledgeHit:K,focusedSession:Z,focusSession:ee,openFilePreview:oe,closeFilePreview:se,openContextCapture:re,closeContextCapture:v}),[n,r,s,a,f,w,Ee,P,J,u,ae,S,Q,k,ke,D,te,ne,Se,Ce,X,V,C,R,Y,b,M,K,Z,ee,oe,se,re,v]);return i.jsx(We.Provider,{value:Ze,children:i.jsx("div",{"data-scout-theme-mode":N,"data-scout-palette":u.palette,"data-scout-contrast":u.contrast,"data-scout-accent":u.accent,"data-scout-shell":u.shell,"data-hudson-theme":N,"data-hudson-template":U,style:{...q},children:i.jsx("div",{"data-scout-theme":N,style:{display:"contents"},children:i.jsx(pt,{children:i.jsxs(Wt,{children:[p?i.jsx(Cn,{children:e}):e,i.jsx($t,{path:Xe,onOpenPath:oe,onOpenInCode:Ye,onClose:se}),i.jsx(Pn,{request:m,onClose:v,onOpenCapture:re})]})})})})})}export{Nt as A,_t as C,Vn as D,Hn as L,We as S,Je as a,mr as b,hr as c,On as d,Rn as e,At as f,gr as g,wr as h,Tt as i,yr as j,br as k,fr as l,vr as m,pr as n,me as o,yn as p,bn as s,Qe as u};
@@ -1 +1 @@
1
- import{j as r}from"./index-BZovGpDk.js";import{n as x,a as M,s as v,b as S}from"./colors-BtO5_zlx.js";import{A as m}from"./AgentAvatar-CneOa70z.js";function T({state:n,className:e,style:s}){x(typeof n=="string"?n:n??null);const a=x(typeof n=="string"?n:n??null)!=="blocked"?M(typeof n=="string"?n:n??null)?"working":"available":null;return r.jsx("span",{className:e,style:{background:v(a),...s}})}function F({name:n,meta:e,sub:s,tone:a="neutral",avatarName:c,avatarKind:o="user",leadingIcon:i,caret:l,active:f,selected:g,unread:N,depth:k=0,detail:t,expanded:d,activityLabel:h,worktreeLabel:p,activityTone:y="working",actions:u,pinned:w,onClick:b,onKeyDown:C,onContextMenu:A,onPointerEnter:P,onPointerLeave:B,title:R,tabIndex:$}){const z=l?l==="open":t!==void 0?!!d:void 0,L=["rr-row",k===1&&"rr-row--child",f&&"rr-row--active",g&&"rr-row--selected",N&&"rr-row--unread",d&&"rr-row--expanded",h&&"rr-row--motion",w&&"rr-row--pinned",u&&"rr-row--has-actions"].filter(Boolean).join(" ");return r.jsxs("div",{className:L,children:[r.jsxs("button",{type:"button",className:"rr-row-head",onClick:b,onKeyDown:C,onContextMenu:A,onPointerEnter:P,onPointerLeave:B,title:R,tabIndex:$,"aria-expanded":z,children:[r.jsx(D,{icon:i,tone:a,caret:l,avatarName:c,avatarKind:o}),r.jsxs("span",{className:"rr-row-body",children:[r.jsxs("span",{className:"rr-row-name",children:[w?r.jsx("span",{className:"rr-row-pin-mark","aria-label":"Pinned",title:"Pinned",children:r.jsx(I,{})}):null,n]}),s&&r.jsx("span",{className:"rr-row-sub",children:s}),p&&r.jsx("span",{className:"rr-row-worktree",children:p}),h&&r.jsxs("span",{className:`rr-row-activity rr-row-activity--${y}`,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:h})]})]}),e&&r.jsx("span",{className:"rr-row-meta",children:e})]}),u?r.jsx("div",{className:"rr-row-actions",onClick:E=>E.stopPropagation(),children:u}):null,d&&t&&r.jsx("div",{className:"rr-row-detail",children:t})]})}function D({icon:n,tone:e,caret:s,avatarName:a,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(a){if(c==="channel")return r.jsx(m,{kind:"channel",name:a,channelClassName:"rr-row-hash"});const i=j(e),l=i==="active"||i==="available";return r.jsxs("span",{className:"rr-row-avatar-wrap","aria-hidden":!0,children:[r.jsx(m,{name:a,placement:"roster",className:"rr-row-avatar"}),l&&r.jsx(T,{state:i,className:`rr-row-presence rr-row-presence--${i}`})]})}if(n)return r.jsx("span",{className:"rr-row-icon","aria-hidden":!0,children:n});const o=j(e);return r.jsx("span",{className:`rr-row-dot rr-row-dot--${o}`,style:o==="active"||o==="available"?{background:v(o)}:void 0,"aria-hidden":!0})}function G({open:n}){return r.jsx("svg",{className:`rr-chevron${n?" 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 j(n){return n==="channel"||n==="dm"||n==="neutral"?n:S(n)}function I(){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{F as R};
1
+ import{j as r}from"./index-DmFAhGPj.js";import{n as x,a as M,s as v,b as S}from"./colors-BtO5_zlx.js";import{A as m}from"./AgentAvatar-D8ZtMluU.js";function T({state:n,className:e,style:s}){x(typeof n=="string"?n:n??null);const a=x(typeof n=="string"?n:n??null)!=="blocked"?M(typeof n=="string"?n:n??null)?"working":"available":null;return r.jsx("span",{className:e,style:{background:v(a),...s}})}function F({name:n,meta:e,sub:s,tone:a="neutral",avatarName:c,avatarKind:o="user",leadingIcon:i,caret:l,active:f,selected:g,unread:N,depth:k=0,detail:t,expanded:d,activityLabel:h,worktreeLabel:p,activityTone:y="working",actions:u,pinned:w,onClick:b,onKeyDown:C,onContextMenu:A,onPointerEnter:P,onPointerLeave:B,title:R,tabIndex:$}){const z=l?l==="open":t!==void 0?!!d:void 0,L=["rr-row",k===1&&"rr-row--child",f&&"rr-row--active",g&&"rr-row--selected",N&&"rr-row--unread",d&&"rr-row--expanded",h&&"rr-row--motion",w&&"rr-row--pinned",u&&"rr-row--has-actions"].filter(Boolean).join(" ");return r.jsxs("div",{className:L,children:[r.jsxs("button",{type:"button",className:"rr-row-head",onClick:b,onKeyDown:C,onContextMenu:A,onPointerEnter:P,onPointerLeave:B,title:R,tabIndex:$,"aria-expanded":z,children:[r.jsx(D,{icon:i,tone:a,caret:l,avatarName:c,avatarKind:o}),r.jsxs("span",{className:"rr-row-body",children:[r.jsxs("span",{className:"rr-row-name",children:[w?r.jsx("span",{className:"rr-row-pin-mark","aria-label":"Pinned",title:"Pinned",children:r.jsx(I,{})}):null,n]}),s&&r.jsx("span",{className:"rr-row-sub",children:s}),p&&r.jsx("span",{className:"rr-row-worktree",children:p}),h&&r.jsxs("span",{className:`rr-row-activity rr-row-activity--${y}`,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:h})]})]}),e&&r.jsx("span",{className:"rr-row-meta",children:e})]}),u?r.jsx("div",{className:"rr-row-actions",onClick:E=>E.stopPropagation(),children:u}):null,d&&t&&r.jsx("div",{className:"rr-row-detail",children:t})]})}function D({icon:n,tone:e,caret:s,avatarName:a,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(a){if(c==="channel")return r.jsx(m,{kind:"channel",name:a,channelClassName:"rr-row-hash"});const i=j(e),l=i==="active"||i==="available";return r.jsxs("span",{className:"rr-row-avatar-wrap","aria-hidden":!0,children:[r.jsx(m,{name:a,placement:"roster",className:"rr-row-avatar"}),l&&r.jsx(T,{state:i,className:`rr-row-presence rr-row-presence--${i}`})]})}if(n)return r.jsx("span",{className:"rr-row-icon","aria-hidden":!0,children:n});const o=j(e);return r.jsx("span",{className:`rr-row-dot rr-row-dot--${o}`,style:o==="active"||o==="available"?{background:v(o)}:void 0,"aria-hidden":!0})}function G({open:n}){return r.jsx("svg",{className:`rr-chevron${n?" 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 j(n){return n==="channel"||n==="dm"||n==="neutral"?n:S(n)}function I(){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{F as R};
@@ -1 +1 @@
1
- import{r as o,j as n}from"./index-BZovGpDk.js";/* empty css */import{D as O}from"./DataTable-Dzqiaha4.js";import{p as W,a as L}from"./api-h5zurxmi.js";import{t as U,n as R,f as Y}from"./time-Dhsh_2EG.js";import{u as G}from"./tail-events-C12pfUax.js";import{o as Q}from"./openContent-C6XO6kr5.js";import{u as X}from"./Provider-p-xuaAoE.js";/* empty css */import"./index-BWHgHrtv.js";import"./router-63XV_E7f.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-AmSgHklm.js";import"./sse-Bb0EOcU9.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-DnFcmfMR.js";import"./DocumentFocusViewer-CZVVIAD5.js";import"./createLucideIcon-DCq_3fQn.js";import"./TextDocumentSurface-BcP9vvji.js";/* empty css */import"./file-text-BITQqGtF.js";import"./x-CrGUKNRv.js";import"./chevron-right-CaEwYkxE.js";import"./code-xml-Dbvjk9Kw.js";import"./arrow-left-CXDkJuCg.js";import"./scout-voice-D8Q5sZOL.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-CHo_xmjw.js";import"./MessageComposerSuggestions-qbalTne_.js";import"./NewChatComposer-DKlNX1UA.js";import"./runtime-picker-BXKJbLot.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-B-l2Wj3-.js";import"./index-DiiEQwdc.js";import"./HarnessMark-DrE57dUq.js";import"./conversation-model-CHwHZNw-.js";import"./NewChatOrigin-DXPvX-hh.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-BVg09D6U.js";import"./search-1QMVOxF3.js";import"./chunk-HRAB3GC3-HhKwnZCi.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 qt({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{qt as RawSessionsTable};
1
+ import{r as o,j as n}from"./index-DmFAhGPj.js";/* empty css */import{D as O}from"./DataTable-CJbbgBdA.js";import{p as W,a as L}from"./api-h5zurxmi.js";import{t as U,n as R,f as Y}from"./time-Dhsh_2EG.js";import{u as G}from"./tail-events-BdvqZHLr.js";import{o as Q}from"./openContent-C6XO6kr5.js";import{u as X}from"./Provider-cJCdHAxu.js";/* empty css */import"./index-BWHgHrtv.js";import"./router-Cn_s9IGH.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-AmSgHklm.js";import"./sse-CxXt4tqI.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-CHIuVKz7.js";import"./DocumentFocusViewer-B9vodVmG.js";import"./createLucideIcon-CFBn0Sdk.js";import"./TextDocumentSurface-BWJCGBZf.js";/* empty css */import"./file-text-DcYSrI4v.js";import"./x-C8ayPBtj.js";import"./chevron-right-BYMV1511.js";import"./code-xml-BFc3TMSm.js";import"./arrow-left-B-3GJ7ct.js";import"./scout-voice-CwbOz6EN.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-h1IdakpD.js";import"./MessageComposerSuggestions-FdVHnT_q.js";import"./NewChatComposer-Hd7pI5Ac.js";import"./runtime-picker--IW3cRry.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-d6PKL_KD.js";import"./index-CmwGCxUk.js";import"./HarnessMark-BPAphNjx.js";import"./conversation-model-CHwHZNw-.js";import"./NewChatOrigin-DmuJ32wa.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-B3VVRJcV.js";import"./search-DAyagUtF.js";import"./chunk-HRAB3GC3-dRd2eQMJ.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 qt({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{qt as RawSessionsTable};
@@ -1 +1 @@
1
- import{j as e,r}from"./index-BZovGpDk.js";import{u as w}from"./router-63XV_E7f.js";import{a as p,b,c as g}from"./Provider-p-xuaAoE.js";import{S as j,a as E}from"./ScoutbotRealtimeVoiceCall-n63LdBZs.js";import{d as _}from"./types-B0PlfpKc.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-AmSgHklm.js";import"./api-h5zurxmi.js";import"./sse-Bb0EOcU9.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-DnFcmfMR.js";import"./DocumentFocusViewer-CZVVIAD5.js";import"./createLucideIcon-DCq_3fQn.js";import"./TextDocumentSurface-BcP9vvji.js";/* empty css */import"./file-text-BITQqGtF.js";import"./x-CrGUKNRv.js";import"./chevron-right-CaEwYkxE.js";import"./code-xml-Dbvjk9Kw.js";import"./arrow-left-CXDkJuCg.js";import"./scout-voice-D8Q5sZOL.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-CHo_xmjw.js";import"./MessageComposerSuggestions-qbalTne_.js";import"./NewChatComposer-DKlNX1UA.js";import"./runtime-picker-BXKJbLot.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-B-l2Wj3-.js";import"./index-DiiEQwdc.js";import"./HarnessMark-DrE57dUq.js";import"./conversation-model-CHwHZNw-.js";import"./time-Dhsh_2EG.js";import"./NewChatOrigin-DXPvX-hh.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-BVg09D6U.js";import"./search-1QMVOxF3.js";import"./chunk-HRAB3GC3-HhKwnZCi.js";import"./radio-BGtkyCG9.js";import"./plus-BAI0t5g9.js";function N({dictationActive:t=!1,autoStart:c=!1}){const a=w(p,!1),{enabled:l,state:i,leaseId:u,startCall:f,endCall:x}=b(),h=r.useRef(!1),n=r.useRef(null),[m,S]=r.useState(()=>window.innerWidth>=720&&window.innerHeight>=520?"page":"compact"),s=window.webkit?.messageHandlers?.scoutRealtimeVoice;return r.useEffect(()=>{const o=()=>{S(window.innerWidth>=720&&window.innerHeight>=520?"page":"compact")};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),r.useEffect(()=>{s?.postMessage({kind:"session-state",state:i,leaseId:u})},[u,s,i]),r.useEffect(()=>{const o=()=>{if(n.current)return n.current;const d=x().finally(()=>{n.current===d&&(n.current=null)});return n.current=d,d},v=()=>{o()};return window.__scoutRealtimeVoiceStop=o,window.addEventListener(g,v),window.__scoutRealtimeVoiceStopRequested&&o(),()=>{window.removeEventListener(g,v),window.__scoutRealtimeVoiceStop===o&&delete window.__scoutRealtimeVoiceStop}},[x]),r.useEffect(()=>{!c||t||!a||!l||h.current||i!=="idle"&&i!=="ended"&&i!=="error"||(h.current=!0,f())},[c,t,a,l,f,i]),a?l?e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(j,{state:i,onMinimize:s?()=>s.postMessage("minimize"):void 0,onExpand:s?()=>s.postMessage(m==="page"?"restore":"expand"):void 0,layout:m}),e.jsx(E,{dictationActive:t,layout:m})]}):e.jsxs("div",{className:"flex h-full flex-col justify-center gap-2 p-4",children:[e.jsx("p",{className:"font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:"Live voice is disabled"}),e.jsx("p",{className:"text-sm leading-snug text-[var(--scout-chrome-ink-faint)]",children:"Enable realtime voice in Settings → Voice. The footer Voice control starts and manages calls."})]}):e.jsxs("div",{className:"flex h-full flex-col justify-center gap-2 p-4",children:[e.jsx("p",{className:"font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:"Live voice is off"}),e.jsxs("p",{className:"text-sm leading-snug text-[var(--scout-chrome-ink-faint)]",children:["Turn on the ",e.jsx("span",{className:"font-mono",children:p})," flag to hold live conversations with Scoutbot. Calls use the configured OpenAI API account."]})]})}function xe(){const t=w(p,!1),{enabled:c,state:a}=b();return!t||!c?e.jsx(N,{}):e.jsxs("main",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-[var(--scout-chrome-bg)]",children:[e.jsxs("div",{className:"border-b border-[var(--scout-chrome-border-soft)] px-6 py-5",children:[e.jsx("p",{className:"font-mono text-xs uppercase tracking-[0.14em] text-[var(--scout-chrome-ink-faint)]",children:"Scoutbot"}),e.jsx("h1",{className:"mt-1 text-3xl font-medium text-[var(--scout-chrome-ink-strong)]",children:"Live voice"}),e.jsx("p",{className:"mt-1 max-w-2xl text-xs leading-relaxed text-[var(--scout-chrome-ink-faint)]",children:"Hold a live conversation, inspect navigation attempts, and audit what Scoutbot tried without leaving the call."})]}),e.jsx("div",{className:"min-h-0 flex-1 p-5",children:e.jsxs("section",{className:"mx-auto flex h-full min-h-[26rem] w-full max-w-5xl flex-col overflow-hidden rounded-xl border border-[color-mix(in_srgb,var(--hud-ink)_11%,transparent)] bg-[color-mix(in_srgb,var(--scout-chrome-bg)_96%,black)] shadow-[0_18px_48px_rgba(0,0,0,0.24)]",children:[e.jsx(j,{state:a,layout:"page"}),e.jsx(E,{dictationActive:!1,layout:"page"})]})})]})}const he=_({id:"voice",label:"Live voice",route:{view:"voice"},webPath:"/voice",screen:"RealtimeVoiceScreen",embed:{path:"/embed/voice",profile:"macos.voice",rootClassName:"s-voice-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},hosts:{macos:!0},resolveEmbedProps:t=>({dictationActive:t.get("dictationActive")==="1",autoStart:t.get("autoStart")==="1"})}});export{xe as RealtimeVoicePage,N as RealtimeVoiceScreen,he as scoutSurface};
1
+ import{j as e,r}from"./index-DmFAhGPj.js";import{u as w}from"./router-Cn_s9IGH.js";import{a as p,b,c as g}from"./Provider-cJCdHAxu.js";import{S as j,a as E}from"./ScoutbotRealtimeVoiceCall-1ixiEn1L.js";import{d as _}from"./types-B0PlfpKc.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-AmSgHklm.js";import"./api-h5zurxmi.js";import"./sse-CxXt4tqI.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-CHIuVKz7.js";import"./DocumentFocusViewer-B9vodVmG.js";import"./createLucideIcon-CFBn0Sdk.js";import"./TextDocumentSurface-BWJCGBZf.js";/* empty css */import"./file-text-DcYSrI4v.js";import"./x-C8ayPBtj.js";import"./chevron-right-BYMV1511.js";import"./code-xml-BFc3TMSm.js";import"./arrow-left-B-3GJ7ct.js";import"./scout-voice-CwbOz6EN.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-h1IdakpD.js";import"./MessageComposerSuggestions-FdVHnT_q.js";import"./NewChatComposer-Hd7pI5Ac.js";import"./runtime-picker--IW3cRry.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-d6PKL_KD.js";import"./index-CmwGCxUk.js";import"./HarnessMark-BPAphNjx.js";import"./conversation-model-CHwHZNw-.js";import"./time-Dhsh_2EG.js";import"./NewChatOrigin-DmuJ32wa.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-B3VVRJcV.js";import"./search-DAyagUtF.js";import"./chunk-HRAB3GC3-dRd2eQMJ.js";import"./radio-RMLfV4EO.js";import"./plus-gZ0T0eBI.js";function N({dictationActive:t=!1,autoStart:c=!1}){const a=w(p,!1),{enabled:l,state:i,leaseId:u,startCall:f,endCall:x}=b(),h=r.useRef(!1),n=r.useRef(null),[m,S]=r.useState(()=>window.innerWidth>=720&&window.innerHeight>=520?"page":"compact"),s=window.webkit?.messageHandlers?.scoutRealtimeVoice;return r.useEffect(()=>{const o=()=>{S(window.innerWidth>=720&&window.innerHeight>=520?"page":"compact")};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),r.useEffect(()=>{s?.postMessage({kind:"session-state",state:i,leaseId:u})},[u,s,i]),r.useEffect(()=>{const o=()=>{if(n.current)return n.current;const d=x().finally(()=>{n.current===d&&(n.current=null)});return n.current=d,d},v=()=>{o()};return window.__scoutRealtimeVoiceStop=o,window.addEventListener(g,v),window.__scoutRealtimeVoiceStopRequested&&o(),()=>{window.removeEventListener(g,v),window.__scoutRealtimeVoiceStop===o&&delete window.__scoutRealtimeVoiceStop}},[x]),r.useEffect(()=>{!c||t||!a||!l||h.current||i!=="idle"&&i!=="ended"&&i!=="error"||(h.current=!0,f())},[c,t,a,l,f,i]),a?l?e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(j,{state:i,onMinimize:s?()=>s.postMessage("minimize"):void 0,onExpand:s?()=>s.postMessage(m==="page"?"restore":"expand"):void 0,layout:m}),e.jsx(E,{dictationActive:t,layout:m})]}):e.jsxs("div",{className:"flex h-full flex-col justify-center gap-2 p-4",children:[e.jsx("p",{className:"font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:"Live voice is disabled"}),e.jsx("p",{className:"text-sm leading-snug text-[var(--scout-chrome-ink-faint)]",children:"Enable realtime voice in Settings → Voice. The footer Voice control starts and manages calls."})]}):e.jsxs("div",{className:"flex h-full flex-col justify-center gap-2 p-4",children:[e.jsx("p",{className:"font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:"Live voice is off"}),e.jsxs("p",{className:"text-sm leading-snug text-[var(--scout-chrome-ink-faint)]",children:["Turn on the ",e.jsx("span",{className:"font-mono",children:p})," flag to hold live conversations with Scoutbot. Calls use the configured OpenAI API account."]})]})}function xe(){const t=w(p,!1),{enabled:c,state:a}=b();return!t||!c?e.jsx(N,{}):e.jsxs("main",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-[var(--scout-chrome-bg)]",children:[e.jsxs("div",{className:"border-b border-[var(--scout-chrome-border-soft)] px-6 py-5",children:[e.jsx("p",{className:"font-mono text-xs uppercase tracking-[0.14em] text-[var(--scout-chrome-ink-faint)]",children:"Scoutbot"}),e.jsx("h1",{className:"mt-1 text-3xl font-medium text-[var(--scout-chrome-ink-strong)]",children:"Live voice"}),e.jsx("p",{className:"mt-1 max-w-2xl text-xs leading-relaxed text-[var(--scout-chrome-ink-faint)]",children:"Hold a live conversation, inspect navigation attempts, and audit what Scoutbot tried without leaving the call."})]}),e.jsx("div",{className:"min-h-0 flex-1 p-5",children:e.jsxs("section",{className:"mx-auto flex h-full min-h-[26rem] w-full max-w-5xl flex-col overflow-hidden rounded-xl border border-[color-mix(in_srgb,var(--hud-ink)_11%,transparent)] bg-[color-mix(in_srgb,var(--scout-chrome-bg)_96%,black)] shadow-[0_18px_48px_rgba(0,0,0,0.24)]",children:[e.jsx(j,{state:a,layout:"page"}),e.jsx(E,{dictationActive:!1,layout:"page"})]})})]})}const he=_({id:"voice",label:"Live voice",route:{view:"voice"},webPath:"/voice",screen:"RealtimeVoiceScreen",embed:{path:"/embed/voice",profile:"macos.voice",rootClassName:"s-voice-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},hosts:{macos:!0},resolveEmbedProps:t=>({dictationActive:t.get("dictationActive")==="1",autoStart:t.get("autoStart")==="1"})}});export{xe as RealtimeVoicePage,N as RealtimeVoiceScreen,he as scoutSurface};
@@ -1 +1 @@
1
- import{j as s}from"./index-BZovGpDk.js";import{R as c}from"./RepoDiffViewerLazy-b6vjYxez.js";/* empty css */const l=["unstaged","staged","branch"];function o(e){const t=e.getAll("layer").filter(r=>l.includes(r));return t.length>0?t:void 0}function p(){const e=typeof window>"u"?new URLSearchParams:new URLSearchParams(window.location.search),t=e.get("path")?.trim()??"",r=e.getAll("file").map(i=>i.trim()).filter(Boolean),a=e.get("sessionId")?.trim()||void 0,n=e.get("agentId")?.trim()||void 0,d=e.get("include")==="all"||e.get("include")==="touched"?"all":"changed";return t?s.jsx(c,{path:t,layers:o(e),files:r,session:a||n?{sessionId:a,agentId:n,include:d}:null,className:"rd-embed"}):s.jsx("div",{className:"rd-viewer rd-embed","data-scout-theme":!0,children:s.jsx("div",{className:"rd-center",children:s.jsxs("div",{className:"rd-center-card",children:[s.jsx("div",{className:"rd-center-title",children:"No worktree path"}),s.jsxs("div",{className:"rd-center-body",children:["This embed needs a ",s.jsx("code",{children:"?path=<absolute-path>"})," query parameter."]})]})})})}export{p as RepoDiffEmbedScreen,p as default};
1
+ import{j as s}from"./index-DmFAhGPj.js";import{R as c}from"./RepoDiffViewerLazy-CWE5GxMP.js";/* empty css */const l=["unstaged","staged","branch"];function o(e){const t=e.getAll("layer").filter(r=>l.includes(r));return t.length>0?t:void 0}function p(){const e=typeof window>"u"?new URLSearchParams:new URLSearchParams(window.location.search),t=e.get("path")?.trim()??"",r=e.getAll("file").map(i=>i.trim()).filter(Boolean),a=e.get("sessionId")?.trim()||void 0,n=e.get("agentId")?.trim()||void 0,d=e.get("include")==="all"||e.get("include")==="touched"?"all":"changed";return t?s.jsx(c,{path:t,layers:o(e),files:r,session:a||n?{sessionId:a,agentId:n,include:d}:null,className:"rd-embed"}):s.jsx("div",{className:"rd-viewer rd-embed","data-scout-theme":!0,children:s.jsx("div",{className:"rd-center",children:s.jsxs("div",{className:"rd-center-card",children:[s.jsx("div",{className:"rd-center-title",children:"No worktree path"}),s.jsxs("div",{className:"rd-center-body",children:["This embed needs a ",s.jsx("code",{children:"?path=<absolute-path>"})," query parameter."]})]})})})}export{p as RepoDiffEmbedScreen,p as default};
@@ -1 +1 @@
1
- import{j as e}from"./index-BZovGpDk.js";import{R as l}from"./RepoDiffViewerLazy-b6vjYxez.js";/* empty css */const f=1;function m(t=typeof performance>"u"?void 0:performance){const r=(t?.getEntriesByType?.("navigation")??[]).find(i=>typeof i.type=="string");return r?r.type==="reload":t?.navigation?.type===f}function u({path:t,layers:n,files:r,sessionId:i,agentId:o,include:s,navigate:c}){const a=t.trim();if(!a)return e.jsx("div",{className:"rd-viewer",children:e.jsx("div",{className:"rd-center",children:e.jsxs("div",{className:"rd-center-card",children:[e.jsx("div",{className:"rd-center-title",children:"No worktree path"}),e.jsxs("div",{className:"rd-center-body",children:["This page needs a ",e.jsx("code",{children:"?path=<absolute-path>"})," query parameter."]})]})})});const d=[a,n?.join(",")??"",r?.join("\0")??"",i??"",o??"",s??""].join(""),p=m();return e.jsx(l,{path:a,layers:n,files:r,session:i||o?{sessionId:i,agentId:o,include:s}:null,forceInitialLoad:p,onClose:()=>c({view:"repos"})},d)}export{u as RepoDiffPageScreen,u as default};
1
+ import{j as e}from"./index-DmFAhGPj.js";import{R as l}from"./RepoDiffViewerLazy-CWE5GxMP.js";/* empty css */const f=1;function m(t=typeof performance>"u"?void 0:performance){const r=(t?.getEntriesByType?.("navigation")??[]).find(i=>typeof i.type=="string");return r?r.type==="reload":t?.navigation?.type===f}function u({path:t,layers:n,files:r,sessionId:i,agentId:o,include:s,navigate:c}){const a=t.trim();if(!a)return e.jsx("div",{className:"rd-viewer",children:e.jsx("div",{className:"rd-center",children:e.jsxs("div",{className:"rd-center-card",children:[e.jsx("div",{className:"rd-center-title",children:"No worktree path"}),e.jsxs("div",{className:"rd-center-body",children:["This page needs a ",e.jsx("code",{children:"?path=<absolute-path>"})," query parameter."]})]})})});const d=[a,n?.join(",")??"",r?.join("\0")??"",i??"",o??"",s??""].join(""),p=m();return e.jsx(l,{path:a,layers:n,files:r,session:i||o?{sessionId:i,agentId:o,include:s}:null,forceInitialLoad:p,onClose:()=>c({view:"repos"})},d)}export{u as RepoDiffPageScreen,u as default};
@@ -1,4 +1,4 @@
1
- import{r as l,j as n}from"./index-BZovGpDk.js";import{a as X,p as Z}from"./ui-LM8pS8qE.js";/* empty css */import{a as T,s as q,l as ee,L as te,f as K,S as ne,r as se,b as re,c as _,d as ie,u as ae,V as A,C as H,D as le,e as oe}from"./usePierreRuntime-C8WJ0X3F.js";import{C as ce}from"./chevron-down-BVg09D6U.js";import{C as de}from"./check-BfA0T8UD.js";import{L as ue}from"./loader-circle-B-l2Wj3-.js";import{S as fe}from"./send-horizontal-DbyEkGql.js";import{c as he}from"./createLucideIcon-DCq_3fQn.js";import{C as me}from"./code-xml-Dbvjk9Kw.js";import{X as pe}from"./x-CrGUKNRv.js";import{r as O,a as V,f as Y}from"./cache-Dr0why2k.js";import{M as xe}from"./message-square-BnkG6tae.js";import{R as ge}from"./refresh-cw-DtF8xPqX.js";import{P as be}from"./plus-BAI0t5g9.js";import{a as B}from"./api-h5zurxmi.js";import"./chunk-HRAB3GC3-HhKwnZCi.js";const ye=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],je=he("file-code-corner",ye);function ke({snapshot:e,selectedFile:t,targets:r,targetId:s,onTargetId:i,draft:c,onDraft:f,contextItems:o,onRemoveContextItem:p,pending:a,status:d,error:g,textareaRef:$,onSubmit:S}){const[u,j]=l.useState(!1),b=l.useRef(null),w=r.find(h=>h.id===s)??null,m=w?.label??"Scout",k=r[0]?.id??null,N=t?T(t):null,I=(c.trim().length>0||o.length>0)&&!a,R=l.useMemo(()=>[...r.map(h=>({id:h.id,label:h.label,suffix:h.id===k?"best context":null})),{id:"scout",label:"Scout",suffix:null}],[k,r]);return l.useEffect(()=>{if(!u)return;const h=C=>{const D=b.current;D&&C.target instanceof Node&&D.contains(C.target)||j(!1)};return document.addEventListener("pointerdown",h),()=>document.removeEventListener("pointerdown",h)},[u]),n.jsxs("div",{className:"rd-comment",children:[o.length>0?n.jsx("div",{className:"rd-comment-context","aria-label":"Included diff context",children:o.map(h=>n.jsx(Ce,{item:h,disabled:a,onRemove:p},h.id))}):null,n.jsxs("div",{className:"rd-comment-main",children:[n.jsxs("div",{className:"rd-target-picker",ref:b,children:[n.jsxs("button",{type:"button",className:"rd-target-button",onClick:()=>j(h=>!h),onKeyDown:h=>{h.stopPropagation(),h.key==="Escape"&&j(!1)},disabled:a,"aria-label":"Diff comment target","aria-haspopup":"listbox","aria-expanded":u,title:"Diff comment target",children:[n.jsx("span",{children:m}),n.jsx(ce,{size:13,strokeWidth:2,"aria-hidden":!0})]}),u?n.jsx("div",{className:"rd-target-menu",role:"listbox","aria-label":"Diff comment target",children:R.map(h=>{const C=h.id===(w?.id??"scout");return n.jsxs("button",{type:"button",className:"rd-target-option",role:"option","aria-selected":C,onClick:()=>{i(h.id),j(!1)},children:[n.jsx("span",{className:"rd-target-option-label",children:h.label}),h.suffix?n.jsx("span",{className:"rd-target-option-suffix",children:h.suffix}):null,n.jsx("span",{className:"rd-target-option-check","aria-hidden":!0,children:C?n.jsx(de,{size:12,strokeWidth:2.2}):null})]},h.id)})}):null]}),n.jsx("textarea",{ref:$,value:c,onChange:h=>f(h.currentTarget.value),onKeyDown:h=>{h.stopPropagation(),(h.metaKey||h.ctrlKey)&&h.key==="Enter"&&(h.preventDefault(),S())},rows:1,disabled:a,placeholder:o.length>0?`Send to ${m} with included context`:"Leave a note on this diff…","aria-label":"Diff comment"}),n.jsxs("button",{type:"button",className:"rd-comment-send",disabled:!I,onClick:S,title:"Send diff comment","aria-label":"Send diff comment",children:[a?n.jsx(ue,{size:13,className:"rd-comment-spin","aria-hidden":!0}):n.jsx(fe,{size:13,"aria-hidden":!0}),n.jsx("span",{children:a?"Sending":"Send"})]})]}),n.jsx("div",{className:"rd-comment-meta",children:g?n.jsx("span",{className:"err",children:g}):d?n.jsx("span",{className:"ok",children:d}):n.jsxs("span",{children:[e.scope?.kind==="session"?"Session diff":"Worktree diff",N?` · ${N}`:""]})})]})}function Ce({item:e,disabled:t,onRemove:r}){const s=e.kind==="file"?je:me;return n.jsxs("div",{className:`rd-context-item ${e.kind}`,children:[n.jsxs("div",{className:"rd-context-head",children:[n.jsx("span",{className:"rd-context-icon","aria-hidden":!0,children:n.jsx(s,{size:12,strokeWidth:2})}),n.jsx("span",{className:"rd-context-label",title:e.label,children:e.label}),n.jsx("span",{className:"rd-context-detail",children:e.detail}),n.jsx("button",{type:"button",className:"rd-context-remove",onClick:()=>r(e.id),disabled:t,title:"Remove included context","aria-label":"Remove included context",children:n.jsx(pe,{size:11,strokeWidth:2.2,"aria-hidden":!0})})]}),e.preview?n.jsx("pre",{className:"rd-context-preview",children:e.preview}):null]})}function $e({heading:e,worktreePath:t,snapshot:r,freshness:s,activeLayer:i,onLayer:c,layout:f,onLayout:o,refreshing:p,onRefresh:a,onFocusComment:d,onClose:g,onOpenAsPage:$}){const{dir:S}=q(t);return n.jsxs("div",{className:"rd-header",children:[n.jsxs("div",{className:"rd-header-id",children:[n.jsxs("div",{className:"rd-header-title",children:[n.jsx("span",{className:"rd-header-name",title:t,children:e}),r.scope?n.jsx(Ne,{snapshot:r}):null,S?n.jsx("span",{className:"rd-header-dir",children:S}):null]}),n.jsx("div",{className:"rd-header-sub",children:n.jsx(ve,{layers:r.layers,activeLayer:i,onLayer:c})}),n.jsx(we,{freshness:s,generatedAt:r.generatedAt})]}),n.jsxs("div",{className:"rd-header-actions",children:[n.jsx("button",{type:"button",className:"rd-close","aria-label":"Comment on diff",title:"Comment on diff",onClick:d,children:n.jsx(xe,{size:14,strokeWidth:2,"aria-hidden":!0})}),n.jsxs("div",{className:"rd-segmented",role:"group","aria-label":"Diff layout",children:[n.jsx("button",{type:"button",className:f==="unified"?"on":"","aria-pressed":f==="unified",onClick:()=>o("unified"),children:"Unified"}),n.jsx("button",{type:"button",className:f==="split"?"on":"","aria-pressed":f==="split",onClick:()=>o("split"),children:"Split"})]}),n.jsx("button",{type:"button",className:`rd-close${p?" spinning":""}`,"aria-label":"Refresh diff",title:"Fetch fresh diff",onClick:a,disabled:p,children:n.jsx(ge,{size:14,strokeWidth:2,"aria-hidden":!0})}),$?n.jsx("button",{type:"button",className:"rd-close","aria-label":"Open diff as page",title:"Open as full page",onClick:$,children:"↗"}):null,g?n.jsx("button",{type:"button",className:"rd-close","aria-label":"Close",onClick:g,children:"✕"}):null]})]})}function Se({snapshot:e}){const t=[];e.coverage.truncatedLayers>0&&t.push({level:"warning",text:`${e.coverage.truncatedLayers} layer${e.coverage.truncatedLayers===1?"":"s"} truncated — the native diff hit a size budget; some files or hunks are omitted.`}),e.coverage.scanBudgetReached&&t.push({level:"warning",text:"Scan budget reached — this diff is partial."});for(const r of e.diagnostics)t.push({level:r.level,text:r.path?`${r.message} (${r.path})`:r.message});return t.length===0?null:n.jsx(n.Fragment,{children:t.map((r,s)=>n.jsxs("div",{className:`rd-banner ${r.level}`,children:[n.jsx("span",{className:"rd-banner-dot","aria-hidden":!0}),n.jsx("span",{children:r.text})]},s))})}function Ne({snapshot:e}){const t=e.scope;if(!t)return null;const r=t.kind==="session"?`Session · ${t.filteredPaths.length} files`:t.filteredPaths.length>0?`Filtered · ${t.filteredPaths.length} files`:"Worktree",s=t.kind==="session"?`${t.label}: path-filtered diff from ${t.changedFiles} changed / ${t.touchedFiles} touched session files`:t.label;return n.jsx("span",{className:`rd-scope-pill ${t.kind}`,title:s,children:r})}function we({freshness:e,generatedAt:t}){const r=e?.fetchedAt??t,s=Math.max(0,Date.now()-r),i=e?.cacheHit?`Prefetched ${O(s)}`:`Updated ${O(s)}`;return n.jsxs("div",{className:"rd-freshness",title:new Date(r).toLocaleString(),children:[n.jsx("span",{children:i}),e?.refreshing?n.jsx("span",{children:"Refreshing…"}):null,e?.refreshError?n.jsx("span",{children:"Refresh failed"}):null]})}function ve({layers:e,activeLayer:t,onLayer:r}){return n.jsx("div",{className:"rd-layers",role:"tablist","aria-label":"Diff layers",children:e.map(s=>{const i=ee(s);return n.jsxs("button",{type:"button",role:"tab","aria-selected":s.kind===t,className:"rd-layer-tab"+(s.kind===t?" on":""),onClick:()=>r(s.kind),title:s.shortstat??void 0,children:[n.jsx("span",{children:te[s.kind]??s.kind}),n.jsx("span",{className:"rd-layer-stat",children:s.files.length===0?"clean":n.jsxs(n.Fragment,{children:[s.files.length,"f"," ",n.jsxs("span",{style:{color:"var(--rd-add)"},children:["+",i.add]})," ",n.jsxs("span",{style:{color:"var(--rd-del)"},children:["−",i.del]}),s.truncated?" ⚠":""]})})]},s.kind)})})}const G="openscout.repo-diff.files-rail-width",U=268,Ie=196,De=520;function Re(e,t){if(e.length<=t)return e;const r=e.lastIndexOf(".");if(r<=0){const p=Math.max(1,Math.floor((t-1)/2)),a=t-p-1;return e.slice(0,p)+"…"+e.slice(-Math.max(1,a))}const s=e.slice(0,r),i=e.slice(r),c=t-i.length-1;if(c<2){const p=Math.max(1,t-i.length-1);return s.slice(0,p)+"…"+i}const f=Math.max(1,Math.floor(c/2)),o=Math.max(1,c-f);return s.slice(0,f)+"…"+s.slice(-o)+i}function Le(e,t){return Math.max(8,Math.floor((e-178-t*14)/6.7))}function W(e){return Math.max(Ie,Math.min(De,Math.round(e)))}function Pe(){if(typeof window>"u")return U;const e=Number(window.localStorage.getItem(G));return Number.isFinite(e)?W(e):U}function Me(e){const t={name:"",path:"",firstIndex:Number.MAX_SAFE_INTEGER,children:new Map,files:[]};for(const r of e){t.firstIndex=Math.min(t.firstIndex,r.index);const s=r.dir?r.dir.split("/").filter(Boolean):[];let i=t;for(const c of s){const f=i.path?`${i.path}/${c}`:c;let o=i.children.get(c);o||(o={name:c,path:f,firstIndex:r.index,children:new Map,files:[]},i.children.set(c,o)),o.firstIndex=Math.min(o.firstIndex,r.index),i=o}i.files.push(r)}return t}function J(e){let t=e.files.length;for(const r of e.children.values())t+=J(r);return t}function Ee({layer:e,selectedFileKey:t,onSelect:r,onIncludeFile:s}){const[i,c]=l.useState(Pe),[f,o]=l.useState(()=>new Set),p=l.useMemo(()=>(e?.files??[]).map((u,j)=>{const b=K(u,j),w=T(u),{name:m,dir:k}=q(w),N=(u.status==="renamed"||u.status==="copied")&&u.oldPath&&u.newPath&&u.oldPath!==u.newPath;return{file:u,index:j,key:b,display:w,name:m,dir:k,renamed:!!N}}),[e]),a=l.useMemo(()=>Me(p),[p]),d=l.useCallback(u=>{o(j=>{const b=new Set(j);return b.has(u)?b.delete(u):b.add(u),b})},[]),g=l.useCallback(u=>{u.preventDefault();const j=u.clientX,b=i,w=k=>{c(W(b+k.clientX-j))},m=()=>{window.removeEventListener("pointermove",w),window.removeEventListener("pointerup",m),c(k=>{const N=W(k);return window.localStorage.setItem(G,String(N)),N})};window.addEventListener("pointermove",w),window.addEventListener("pointerup",m,{once:!0})},[i]),$=(u,j)=>n.jsx(Fe,{entry:u,depth:j,railWidth:i,selected:u.key===t,onSelect:r,onIncludeFile:s},u.key),S=(u,j)=>{const b=[],w=[...u.children.values()].sort((m,k)=>m.firstIndex!==k.firstIndex?m.firstIndex-k.firstIndex:m.name.localeCompare(k.name));for(const m of w){const k=f.has(m.path);b.push(n.jsxs("button",{type:"button",className:"rd-dir-row",style:{paddingLeft:12+j*14},onClick:()=>d(m.path),title:m.path,children:[n.jsx("span",{className:"rd-dir-caret",children:k?"›":"⌄"}),n.jsx("span",{className:"rd-dir-name",children:m.name}),n.jsx("span",{className:"rd-dir-count",children:J(m)})]},`dir:${m.path}`)),k||b.push(...S(m,j+1))}for(const m of u.files)b.push($(m,j));return b};return n.jsxs("div",{className:"rd-rail",style:{width:i},children:[n.jsx("div",{className:"rd-rail-head",children:e?`Changed files · ${e.files.length}`:"Changed files"}),n.jsx("div",{className:"rd-rail-list",children:S(a,0)}),n.jsx("div",{className:"rd-rail-resizer",role:"separator","aria-orientation":"vertical","aria-label":"Resize file navigation",onPointerDown:g})]})}function Fe({entry:e,depth:t,railWidth:r,selected:s,onSelect:i,onIncludeFile:c}){const{file:f,key:o,display:p,name:a,dir:d,renamed:g}=e,$=Le(r,t),S=Re(a,$);return n.jsxs("div",{className:"rd-file-row"+(s?" on":""),title:g?`${f.oldPath} → ${f.newPath}`:p,children:[n.jsxs("button",{type:"button",className:"rd-file-pick",style:{paddingLeft:18+t*14},onClick:()=>i(o),children:[n.jsx("span",{className:`rd-file-glyph ${f.status}`,children:ne[f.status]}),n.jsxs("span",{className:"rd-file-id",children:[n.jsx("span",{className:"rd-file-name",children:S}),n.jsx("span",{className:"rd-file-dir",children:g?`${f.oldPath} → ${d||a}`:d}),n.jsx(Te,{file:f})]})]}),n.jsx("span",{className:"rd-file-churn",children:f.binary?n.jsx("span",{className:"add",style:{color:"var(--muted)"},children:"bin"}):n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"add",children:["+",f.additions??0]}),n.jsxs("span",{className:"del",children:["−",f.deletions??0]})]})}),n.jsx("button",{type:"button",className:"rd-file-include",onClick:u=>{u.stopPropagation(),c(f,o)},"aria-label":`Include ${p} in comment`,title:"Include in comment",children:n.jsx(be,{size:12,strokeWidth:2,"aria-hidden":!0})})]})}function Te({file:e}){const t=[];return e.binary&&t.push("BINARY"),e.truncated&&t.push("TRUNCATED"),e.status==="conflict"&&t.push("CONFLICT"),t.length===0?null:n.jsx("span",{className:"rd-file-tags",children:t.map(r=>n.jsx("span",{className:"rd-file-tag",children:r},r))})}function Ae(e){switch(e?.trim().toLowerCase()){case"active":case"working":case"running":case"in_turn":return 80;case"queued":case"waiting":case"waking":case"in_flight":return 50;case"idle":case"available":return 25;case"offline":case"retired":case"stale":return-40;default:return 0}}function Ke(e){return e.newPath??e.oldPath??"(unknown)"}function Q(e){const t=e.scope?.kind==="session"?e.scope.agentId:null,r=new Map;for(const s of e.scout.hints)s.agentId&&r.set(s.agentId,(r.get(s.agentId)??0)+1);return e.scout.agents.map(s=>({id:s.id,label:X(s),score:Ae(s.state)+(s.id===t?1e3:0)+(r.get(s.id)??0)*10})).sort((s,i)=>{const c=i.score-s.score;return c!==0?c:s.label.localeCompare(i.label)})}function We(e){return Q(e)[0]??null}function ze(e){const t=e.files.reduce((r,s)=>({add:r.add+(s.additions??0),del:r.del+(s.deletions??0)}),{add:0,del:0});return`${e.kind}: ${e.files.length} file${e.files.length===1?"":"s"}, +${t.add} -${t.del}${e.truncated?", truncated":""}`}function z(e){const t=e.binary?"binary":`+${e.additions??0} -${e.deletions??0}`;return`${e.status}: ${Ke(e)} (${t}${e.truncated?", truncated":""})`}function _e(e){const t=e.scope;return t?t.kind==="session"?`session ${t.sessionId??t.refId??"(unknown)"} (${t.changedFiles} changed / ${t.touchedFiles} touched files, ${t.include})`:t.filteredPaths.length>0?`filtered worktree (${t.filteredPaths.length} paths)`:"worktree":"worktree"}function He(e){const{comment:t,includedContext:r=[],snapshot:s,activeLayer:i,selectedFile:c}=e,o=((i?s.layers.find(d=>d.kind===i)??null:null)?.files??s.layers.flatMap(d=>d.files)).slice(0,12).map(z),p=s.scout.agents.map(d=>X(d)).slice(0,8),a=["Operator comment on repo diff:",t,"","Repo Diff context:",`- Worktree: ${s.worktreePath}`,`- Scope: ${_e(s)}`,`- Active layer: ${i??"none"}`];return r.length>0&&a.splice(3,0,"Included diff context:",...r.map(d=>d.trim()).filter(Boolean),""),c&&a.push(`- Selected file: ${z(c)}`),a.push(`- Layers: ${s.layers.map(ze).join("; ")}`),p.length>0&&a.push(`- Attached agents: ${p.join(", ")}`),s.scout.sessions.length>0&&a.push(`- Sessions: ${s.scout.sessions.map(d=>d.id).slice(0,8).join(", ")}`),o.length>0&&a.push(`- Changed files: ${o.join(", ")}`),s.diagnostics.length>0&&a.push(`- Diagnostics: ${s.diagnostics.map(d=>d.message).join("; ")}`),a.join(`
1
+ import{r as l,j as n}from"./index-DmFAhGPj.js";import{a as X,p as Z}from"./ui-LM8pS8qE.js";/* empty css */import{a as T,s as q,l as ee,L as te,f as K,S as ne,r as se,b as re,c as _,d as ie,u as ae,V as A,C as H,D as le,e as oe}from"./usePierreRuntime-Cm7-qdm0.js";import{C as ce}from"./chevron-down-B3VVRJcV.js";import{C as de}from"./check-BX8nRgop.js";import{L as ue}from"./loader-circle-d6PKL_KD.js";import{S as fe}from"./send-horizontal-IcG46D2M.js";import{c as he}from"./createLucideIcon-CFBn0Sdk.js";import{C as me}from"./code-xml-BFc3TMSm.js";import{X as pe}from"./x-C8ayPBtj.js";import{r as O,a as V,f as Y}from"./cache-Dr0why2k.js";import{M as xe}from"./message-square-D1hMsMj_.js";import{R as ge}from"./refresh-cw-C4x1x6b_.js";import{P as be}from"./plus-gZ0T0eBI.js";import{a as B}from"./api-h5zurxmi.js";import"./chunk-HRAB3GC3-dRd2eQMJ.js";const ye=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],je=he("file-code-corner",ye);function ke({snapshot:e,selectedFile:t,targets:r,targetId:s,onTargetId:i,draft:c,onDraft:f,contextItems:o,onRemoveContextItem:p,pending:a,status:d,error:g,textareaRef:$,onSubmit:S}){const[u,j]=l.useState(!1),b=l.useRef(null),w=r.find(h=>h.id===s)??null,m=w?.label??"Scout",k=r[0]?.id??null,N=t?T(t):null,I=(c.trim().length>0||o.length>0)&&!a,R=l.useMemo(()=>[...r.map(h=>({id:h.id,label:h.label,suffix:h.id===k?"best context":null})),{id:"scout",label:"Scout",suffix:null}],[k,r]);return l.useEffect(()=>{if(!u)return;const h=C=>{const D=b.current;D&&C.target instanceof Node&&D.contains(C.target)||j(!1)};return document.addEventListener("pointerdown",h),()=>document.removeEventListener("pointerdown",h)},[u]),n.jsxs("div",{className:"rd-comment",children:[o.length>0?n.jsx("div",{className:"rd-comment-context","aria-label":"Included diff context",children:o.map(h=>n.jsx(Ce,{item:h,disabled:a,onRemove:p},h.id))}):null,n.jsxs("div",{className:"rd-comment-main",children:[n.jsxs("div",{className:"rd-target-picker",ref:b,children:[n.jsxs("button",{type:"button",className:"rd-target-button",onClick:()=>j(h=>!h),onKeyDown:h=>{h.stopPropagation(),h.key==="Escape"&&j(!1)},disabled:a,"aria-label":"Diff comment target","aria-haspopup":"listbox","aria-expanded":u,title:"Diff comment target",children:[n.jsx("span",{children:m}),n.jsx(ce,{size:13,strokeWidth:2,"aria-hidden":!0})]}),u?n.jsx("div",{className:"rd-target-menu",role:"listbox","aria-label":"Diff comment target",children:R.map(h=>{const C=h.id===(w?.id??"scout");return n.jsxs("button",{type:"button",className:"rd-target-option",role:"option","aria-selected":C,onClick:()=>{i(h.id),j(!1)},children:[n.jsx("span",{className:"rd-target-option-label",children:h.label}),h.suffix?n.jsx("span",{className:"rd-target-option-suffix",children:h.suffix}):null,n.jsx("span",{className:"rd-target-option-check","aria-hidden":!0,children:C?n.jsx(de,{size:12,strokeWidth:2.2}):null})]},h.id)})}):null]}),n.jsx("textarea",{ref:$,value:c,onChange:h=>f(h.currentTarget.value),onKeyDown:h=>{h.stopPropagation(),(h.metaKey||h.ctrlKey)&&h.key==="Enter"&&(h.preventDefault(),S())},rows:1,disabled:a,placeholder:o.length>0?`Send to ${m} with included context`:"Leave a note on this diff…","aria-label":"Diff comment"}),n.jsxs("button",{type:"button",className:"rd-comment-send",disabled:!I,onClick:S,title:"Send diff comment","aria-label":"Send diff comment",children:[a?n.jsx(ue,{size:13,className:"rd-comment-spin","aria-hidden":!0}):n.jsx(fe,{size:13,"aria-hidden":!0}),n.jsx("span",{children:a?"Sending":"Send"})]})]}),n.jsx("div",{className:"rd-comment-meta",children:g?n.jsx("span",{className:"err",children:g}):d?n.jsx("span",{className:"ok",children:d}):n.jsxs("span",{children:[e.scope?.kind==="session"?"Session diff":"Worktree diff",N?` · ${N}`:""]})})]})}function Ce({item:e,disabled:t,onRemove:r}){const s=e.kind==="file"?je:me;return n.jsxs("div",{className:`rd-context-item ${e.kind}`,children:[n.jsxs("div",{className:"rd-context-head",children:[n.jsx("span",{className:"rd-context-icon","aria-hidden":!0,children:n.jsx(s,{size:12,strokeWidth:2})}),n.jsx("span",{className:"rd-context-label",title:e.label,children:e.label}),n.jsx("span",{className:"rd-context-detail",children:e.detail}),n.jsx("button",{type:"button",className:"rd-context-remove",onClick:()=>r(e.id),disabled:t,title:"Remove included context","aria-label":"Remove included context",children:n.jsx(pe,{size:11,strokeWidth:2.2,"aria-hidden":!0})})]}),e.preview?n.jsx("pre",{className:"rd-context-preview",children:e.preview}):null]})}function $e({heading:e,worktreePath:t,snapshot:r,freshness:s,activeLayer:i,onLayer:c,layout:f,onLayout:o,refreshing:p,onRefresh:a,onFocusComment:d,onClose:g,onOpenAsPage:$}){const{dir:S}=q(t);return n.jsxs("div",{className:"rd-header",children:[n.jsxs("div",{className:"rd-header-id",children:[n.jsxs("div",{className:"rd-header-title",children:[n.jsx("span",{className:"rd-header-name",title:t,children:e}),r.scope?n.jsx(Ne,{snapshot:r}):null,S?n.jsx("span",{className:"rd-header-dir",children:S}):null]}),n.jsx("div",{className:"rd-header-sub",children:n.jsx(ve,{layers:r.layers,activeLayer:i,onLayer:c})}),n.jsx(we,{freshness:s,generatedAt:r.generatedAt})]}),n.jsxs("div",{className:"rd-header-actions",children:[n.jsx("button",{type:"button",className:"rd-close","aria-label":"Comment on diff",title:"Comment on diff",onClick:d,children:n.jsx(xe,{size:14,strokeWidth:2,"aria-hidden":!0})}),n.jsxs("div",{className:"rd-segmented",role:"group","aria-label":"Diff layout",children:[n.jsx("button",{type:"button",className:f==="unified"?"on":"","aria-pressed":f==="unified",onClick:()=>o("unified"),children:"Unified"}),n.jsx("button",{type:"button",className:f==="split"?"on":"","aria-pressed":f==="split",onClick:()=>o("split"),children:"Split"})]}),n.jsx("button",{type:"button",className:`rd-close${p?" spinning":""}`,"aria-label":"Refresh diff",title:"Fetch fresh diff",onClick:a,disabled:p,children:n.jsx(ge,{size:14,strokeWidth:2,"aria-hidden":!0})}),$?n.jsx("button",{type:"button",className:"rd-close","aria-label":"Open diff as page",title:"Open as full page",onClick:$,children:"↗"}):null,g?n.jsx("button",{type:"button",className:"rd-close","aria-label":"Close",onClick:g,children:"✕"}):null]})]})}function Se({snapshot:e}){const t=[];e.coverage.truncatedLayers>0&&t.push({level:"warning",text:`${e.coverage.truncatedLayers} layer${e.coverage.truncatedLayers===1?"":"s"} truncated — the native diff hit a size budget; some files or hunks are omitted.`}),e.coverage.scanBudgetReached&&t.push({level:"warning",text:"Scan budget reached — this diff is partial."});for(const r of e.diagnostics)t.push({level:r.level,text:r.path?`${r.message} (${r.path})`:r.message});return t.length===0?null:n.jsx(n.Fragment,{children:t.map((r,s)=>n.jsxs("div",{className:`rd-banner ${r.level}`,children:[n.jsx("span",{className:"rd-banner-dot","aria-hidden":!0}),n.jsx("span",{children:r.text})]},s))})}function Ne({snapshot:e}){const t=e.scope;if(!t)return null;const r=t.kind==="session"?`Session · ${t.filteredPaths.length} files`:t.filteredPaths.length>0?`Filtered · ${t.filteredPaths.length} files`:"Worktree",s=t.kind==="session"?`${t.label}: path-filtered diff from ${t.changedFiles} changed / ${t.touchedFiles} touched session files`:t.label;return n.jsx("span",{className:`rd-scope-pill ${t.kind}`,title:s,children:r})}function we({freshness:e,generatedAt:t}){const r=e?.fetchedAt??t,s=Math.max(0,Date.now()-r),i=e?.cacheHit?`Prefetched ${O(s)}`:`Updated ${O(s)}`;return n.jsxs("div",{className:"rd-freshness",title:new Date(r).toLocaleString(),children:[n.jsx("span",{children:i}),e?.refreshing?n.jsx("span",{children:"Refreshing…"}):null,e?.refreshError?n.jsx("span",{children:"Refresh failed"}):null]})}function ve({layers:e,activeLayer:t,onLayer:r}){return n.jsx("div",{className:"rd-layers",role:"tablist","aria-label":"Diff layers",children:e.map(s=>{const i=ee(s);return n.jsxs("button",{type:"button",role:"tab","aria-selected":s.kind===t,className:"rd-layer-tab"+(s.kind===t?" on":""),onClick:()=>r(s.kind),title:s.shortstat??void 0,children:[n.jsx("span",{children:te[s.kind]??s.kind}),n.jsx("span",{className:"rd-layer-stat",children:s.files.length===0?"clean":n.jsxs(n.Fragment,{children:[s.files.length,"f"," ",n.jsxs("span",{style:{color:"var(--rd-add)"},children:["+",i.add]})," ",n.jsxs("span",{style:{color:"var(--rd-del)"},children:["−",i.del]}),s.truncated?" ⚠":""]})})]},s.kind)})})}const G="openscout.repo-diff.files-rail-width",U=268,Ie=196,De=520;function Re(e,t){if(e.length<=t)return e;const r=e.lastIndexOf(".");if(r<=0){const p=Math.max(1,Math.floor((t-1)/2)),a=t-p-1;return e.slice(0,p)+"…"+e.slice(-Math.max(1,a))}const s=e.slice(0,r),i=e.slice(r),c=t-i.length-1;if(c<2){const p=Math.max(1,t-i.length-1);return s.slice(0,p)+"…"+i}const f=Math.max(1,Math.floor(c/2)),o=Math.max(1,c-f);return s.slice(0,f)+"…"+s.slice(-o)+i}function Le(e,t){return Math.max(8,Math.floor((e-178-t*14)/6.7))}function W(e){return Math.max(Ie,Math.min(De,Math.round(e)))}function Pe(){if(typeof window>"u")return U;const e=Number(window.localStorage.getItem(G));return Number.isFinite(e)?W(e):U}function Me(e){const t={name:"",path:"",firstIndex:Number.MAX_SAFE_INTEGER,children:new Map,files:[]};for(const r of e){t.firstIndex=Math.min(t.firstIndex,r.index);const s=r.dir?r.dir.split("/").filter(Boolean):[];let i=t;for(const c of s){const f=i.path?`${i.path}/${c}`:c;let o=i.children.get(c);o||(o={name:c,path:f,firstIndex:r.index,children:new Map,files:[]},i.children.set(c,o)),o.firstIndex=Math.min(o.firstIndex,r.index),i=o}i.files.push(r)}return t}function J(e){let t=e.files.length;for(const r of e.children.values())t+=J(r);return t}function Ee({layer:e,selectedFileKey:t,onSelect:r,onIncludeFile:s}){const[i,c]=l.useState(Pe),[f,o]=l.useState(()=>new Set),p=l.useMemo(()=>(e?.files??[]).map((u,j)=>{const b=K(u,j),w=T(u),{name:m,dir:k}=q(w),N=(u.status==="renamed"||u.status==="copied")&&u.oldPath&&u.newPath&&u.oldPath!==u.newPath;return{file:u,index:j,key:b,display:w,name:m,dir:k,renamed:!!N}}),[e]),a=l.useMemo(()=>Me(p),[p]),d=l.useCallback(u=>{o(j=>{const b=new Set(j);return b.has(u)?b.delete(u):b.add(u),b})},[]),g=l.useCallback(u=>{u.preventDefault();const j=u.clientX,b=i,w=k=>{c(W(b+k.clientX-j))},m=()=>{window.removeEventListener("pointermove",w),window.removeEventListener("pointerup",m),c(k=>{const N=W(k);return window.localStorage.setItem(G,String(N)),N})};window.addEventListener("pointermove",w),window.addEventListener("pointerup",m,{once:!0})},[i]),$=(u,j)=>n.jsx(Fe,{entry:u,depth:j,railWidth:i,selected:u.key===t,onSelect:r,onIncludeFile:s},u.key),S=(u,j)=>{const b=[],w=[...u.children.values()].sort((m,k)=>m.firstIndex!==k.firstIndex?m.firstIndex-k.firstIndex:m.name.localeCompare(k.name));for(const m of w){const k=f.has(m.path);b.push(n.jsxs("button",{type:"button",className:"rd-dir-row",style:{paddingLeft:12+j*14},onClick:()=>d(m.path),title:m.path,children:[n.jsx("span",{className:"rd-dir-caret",children:k?"›":"⌄"}),n.jsx("span",{className:"rd-dir-name",children:m.name}),n.jsx("span",{className:"rd-dir-count",children:J(m)})]},`dir:${m.path}`)),k||b.push(...S(m,j+1))}for(const m of u.files)b.push($(m,j));return b};return n.jsxs("div",{className:"rd-rail",style:{width:i},children:[n.jsx("div",{className:"rd-rail-head",children:e?`Changed files · ${e.files.length}`:"Changed files"}),n.jsx("div",{className:"rd-rail-list",children:S(a,0)}),n.jsx("div",{className:"rd-rail-resizer",role:"separator","aria-orientation":"vertical","aria-label":"Resize file navigation",onPointerDown:g})]})}function Fe({entry:e,depth:t,railWidth:r,selected:s,onSelect:i,onIncludeFile:c}){const{file:f,key:o,display:p,name:a,dir:d,renamed:g}=e,$=Le(r,t),S=Re(a,$);return n.jsxs("div",{className:"rd-file-row"+(s?" on":""),title:g?`${f.oldPath} → ${f.newPath}`:p,children:[n.jsxs("button",{type:"button",className:"rd-file-pick",style:{paddingLeft:18+t*14},onClick:()=>i(o),children:[n.jsx("span",{className:`rd-file-glyph ${f.status}`,children:ne[f.status]}),n.jsxs("span",{className:"rd-file-id",children:[n.jsx("span",{className:"rd-file-name",children:S}),n.jsx("span",{className:"rd-file-dir",children:g?`${f.oldPath} → ${d||a}`:d}),n.jsx(Te,{file:f})]})]}),n.jsx("span",{className:"rd-file-churn",children:f.binary?n.jsx("span",{className:"add",style:{color:"var(--muted)"},children:"bin"}):n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"add",children:["+",f.additions??0]}),n.jsxs("span",{className:"del",children:["−",f.deletions??0]})]})}),n.jsx("button",{type:"button",className:"rd-file-include",onClick:u=>{u.stopPropagation(),c(f,o)},"aria-label":`Include ${p} in comment`,title:"Include in comment",children:n.jsx(be,{size:12,strokeWidth:2,"aria-hidden":!0})})]})}function Te({file:e}){const t=[];return e.binary&&t.push("BINARY"),e.truncated&&t.push("TRUNCATED"),e.status==="conflict"&&t.push("CONFLICT"),t.length===0?null:n.jsx("span",{className:"rd-file-tags",children:t.map(r=>n.jsx("span",{className:"rd-file-tag",children:r},r))})}function Ae(e){switch(e?.trim().toLowerCase()){case"active":case"working":case"running":case"in_turn":return 80;case"queued":case"waiting":case"waking":case"in_flight":return 50;case"idle":case"available":return 25;case"offline":case"retired":case"stale":return-40;default:return 0}}function Ke(e){return e.newPath??e.oldPath??"(unknown)"}function Q(e){const t=e.scope?.kind==="session"?e.scope.agentId:null,r=new Map;for(const s of e.scout.hints)s.agentId&&r.set(s.agentId,(r.get(s.agentId)??0)+1);return e.scout.agents.map(s=>({id:s.id,label:X(s),score:Ae(s.state)+(s.id===t?1e3:0)+(r.get(s.id)??0)*10})).sort((s,i)=>{const c=i.score-s.score;return c!==0?c:s.label.localeCompare(i.label)})}function We(e){return Q(e)[0]??null}function ze(e){const t=e.files.reduce((r,s)=>({add:r.add+(s.additions??0),del:r.del+(s.deletions??0)}),{add:0,del:0});return`${e.kind}: ${e.files.length} file${e.files.length===1?"":"s"}, +${t.add} -${t.del}${e.truncated?", truncated":""}`}function z(e){const t=e.binary?"binary":`+${e.additions??0} -${e.deletions??0}`;return`${e.status}: ${Ke(e)} (${t}${e.truncated?", truncated":""})`}function _e(e){const t=e.scope;return t?t.kind==="session"?`session ${t.sessionId??t.refId??"(unknown)"} (${t.changedFiles} changed / ${t.touchedFiles} touched files, ${t.include})`:t.filteredPaths.length>0?`filtered worktree (${t.filteredPaths.length} paths)`:"worktree":"worktree"}function He(e){const{comment:t,includedContext:r=[],snapshot:s,activeLayer:i,selectedFile:c}=e,o=((i?s.layers.find(d=>d.kind===i)??null:null)?.files??s.layers.flatMap(d=>d.files)).slice(0,12).map(z),p=s.scout.agents.map(d=>X(d)).slice(0,8),a=["Operator comment on repo diff:",t,"","Repo Diff context:",`- Worktree: ${s.worktreePath}`,`- Scope: ${_e(s)}`,`- Active layer: ${i??"none"}`];return r.length>0&&a.splice(3,0,"Included diff context:",...r.map(d=>d.trim()).filter(Boolean),""),c&&a.push(`- Selected file: ${z(c)}`),a.push(`- Layers: ${s.layers.map(ze).join("; ")}`),p.length>0&&a.push(`- Attached agents: ${p.join(", ")}`),s.scout.sessions.length>0&&a.push(`- Sessions: ${s.scout.sessions.map(d=>d.id).slice(0,8).join(", ")}`),o.length>0&&a.push(`- Changed files: ${o.join(", ")}`),s.diagnostics.length>0&&a.push(`- Diagnostics: ${s.diagnostics.map(d=>d.message).join("; ")}`),a.join(`
2
2
  `)}function Oe(e){const{snapshot:t,activeLayer:r,file:s}=e,i=[r??"diff",z(s)];return t.scope?.kind==="session"&&i.push(`session ${t.scope.sessionId??t.scope.refId??"scope"}`),`[Diff context: ${i.join(" · ")}]`}function Be(e,t,r){return!e||!t?null:e.files.find((s,i)=>r(s,i)===t)??null}function Ue(e,t=120){const r=e.replace(/\s+/g," ").trim();return r.length>t?`${r.slice(0,t-3)}...`:r}function Xe(e,t=7){const r=e.trimEnd().split(`
3
3
  `),s=r.slice(0,t),i=r.length-s.length;return i>0?`${s.join(`
4
4
  `)}
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RepoDiffViewer-PaNeZMhJ.js","assets/index-DmFAhGPj.js","assets/index-BBznYVWk.css","assets/ui-LM8pS8qE.js","assets/usePierreRuntime-Cm7-qdm0.js","assets/chunk-HRAB3GC3-dRd2eQMJ.js","assets/chevron-down-B3VVRJcV.js","assets/createLucideIcon-CFBn0Sdk.js","assets/check-BX8nRgop.js","assets/loader-circle-d6PKL_KD.js","assets/send-horizontal-IcG46D2M.js","assets/code-xml-BFc3TMSm.js","assets/x-C8ayPBtj.js","assets/cache-Dr0why2k.js","assets/api-h5zurxmi.js","assets/message-square-D1hMsMj_.js","assets/refresh-cw-C4x1x6b_.js","assets/plus-gZ0T0eBI.js","assets/repo-diff-DyYmQMSA.css"])))=>i.map(i=>d[i]);
2
+ import{j as e,r as i,_ as s}from"./index-DmFAhGPj.js";/* empty css */const a=i.lazy(()=>s(()=>import("./RepoDiffViewer-PaNeZMhJ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])).then(r=>({default:r.RepoDiffViewer})));function t(){return e.jsx("div",{className:"rd-viewer","data-scout-theme":!0,children:e.jsx("div",{className:"rd-center",children:e.jsxs("div",{className:"rd-center-card",children:[e.jsx("div",{className:"rd-spinner","aria-hidden":!0}),e.jsx("div",{className:"rd-center-title",children:"Opening diff viewer…"})]})})})}function c(r){return e.jsx(i.Suspense,{fallback:e.jsx(t,{}),children:e.jsx(a,{...r})})}export{c as R};