@openscout/scout 0.2.95 → 0.2.96

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 (360) hide show
  1. package/bin/scout +26 -10
  2. package/bin/scoutd +0 -0
  3. package/dist/build-manifest.json +3 -3
  4. package/dist/client/assets/{ActivityScreen--eANwuxa.js → ActivityScreen-BnoaUkVZ.js} +1 -1
  5. package/dist/client/assets/{AddProjectForm-CcD6qvV8.js → AddProjectForm-IqOtJfRs.js} +1 -1
  6. package/dist/client/assets/{AgentAvatar-CYhf6twS.js → AgentAvatar-6-KBVKUu.js} +1 -1
  7. package/dist/client/assets/{AgentConfigurationScreen-BTI24HQX.js → AgentConfigurationScreen-CuZJy07q.js} +1 -1
  8. package/dist/client/assets/{AgentDefinitionsWorkspace-srmN6-vj.js → AgentDefinitionsWorkspace-Iyl4BesU.js} +1 -1
  9. package/dist/client/assets/{AgentDetailCard-UqPNpcvB.js → AgentDetailCard-C9rn3Fj5.js} +1 -1
  10. package/dist/client/assets/{AgentFloorView-XXNgI5Cj.js → AgentFloorView-YT-Jjccf.js} +1 -1
  11. package/dist/client/assets/{AgentInfoScreen-CimdOnZ9.js → AgentInfoScreen-Dr99gQEZ.js} +1 -1
  12. package/dist/client/assets/{AgentLaneCard-Z-aOBR3W.js → AgentLaneCard-DI2iW9zO.js} +1 -1
  13. package/dist/client/assets/{AgentLaneChrome-CyhA1reW.js → AgentLaneChrome-D8bARHMx.js} +1 -1
  14. package/dist/client/assets/{AgentLaneDetailSheet-BNzjMjIH.js → AgentLaneDetailSheet-52un7dKC.js} +1 -1
  15. package/dist/client/assets/{AgentLaneSummaryResize-Box8-_rS.js → AgentLaneSummaryResize-CEBjmPTa.js} +1 -1
  16. package/dist/client/assets/AgentLanesEmbedScreen-Dgcm7zd_.js +1 -0
  17. package/dist/client/assets/AgentLanesPreflight-q20mTjms.js +1 -0
  18. package/dist/client/assets/AgentLanesView-CetZZDyF.js +2 -0
  19. package/dist/client/assets/{AgentLiveActions-BwuzOE8h.js → AgentLiveActions-DrEJDJef.js} +1 -1
  20. package/dist/client/assets/AgentMasterScreen-DJPnstoD.js +1 -0
  21. package/dist/client/assets/{AgentSessions-CsZwoukw.js → AgentSessions-DCPCG4xb.js} +1 -1
  22. package/dist/client/assets/{AgentsConsole-KCao4XmX.js → AgentsConsole-CsYOoFJi.js} +1 -1
  23. package/dist/client/assets/{AgentsScreen-CtPAmwRX.js → AgentsScreen-k8LvBuU_.js} +1 -1
  24. package/dist/client/assets/AgentsSubnav-C4xpQhsv.js +1 -0
  25. package/dist/client/assets/{AstronautSuit-Ckx7lu7G.js → AstronautSuit-DbjQtfD_.js} +1 -1
  26. package/dist/client/assets/{AtopView-DYlpgEHf.js → AtopView-Daq_ob3z.js} +1 -1
  27. package/dist/client/assets/{BackToPicker-4JaeRvDm.js → BackToPicker-CXZjBRAe.js} +1 -1
  28. package/dist/client/assets/{BriefingDetailScreen-D6-xqrpo.js → BriefingDetailScreen-CUCXO-KH.js} +1 -1
  29. package/dist/client/assets/{BriefingsScreen-DKxSDEmk.js → BriefingsScreen-B5oMTGKv.js} +1 -1
  30. package/dist/client/assets/{BrokerMetadataPanel-BbREmsbK.js → BrokerMetadataPanel-BsiU8lTD.js} +1 -1
  31. package/dist/client/assets/{BrokerScreen-fbPIouMw.js → BrokerScreen-BPbOHhCS.js} +1 -1
  32. package/dist/client/assets/{CastPicker-BcA2vDDV.js → CastPicker-_5E5hNUe.js} +1 -1
  33. package/dist/client/assets/ChatCollapsedStrip-D-eXhzPf.js +1 -0
  34. package/dist/client/assets/{CodeDiffPane-Cn8Y9hAt.js → CodeDiffPane-n7W4iGUG.js} +1 -1
  35. package/dist/client/assets/{CodeProjectPicker-nPFktrco.js → CodeProjectPicker-CMsbSTDq.js} +1 -1
  36. package/dist/client/assets/{CodeScreen-BlAxtxE5.js → CodeScreen-CeuO3EhR.js} +1 -1
  37. package/dist/client/assets/{ConversationComposer-2HjbGPL9.js → ConversationComposer-CXPKx86g.js} +1 -1
  38. package/dist/client/assets/{ConversationFeedRows-C6wUqJrx.js → ConversationFeedRows-WrH-YI3L.js} +1 -1
  39. package/dist/client/assets/{ConversationHeader-C8vfXaTF.js → ConversationHeader-BQWzGzLK.js} +1 -1
  40. package/dist/client/assets/{ConversationPanels-CNCIbpqU.js → ConversationPanels-Dujvnmup.js} +2 -2
  41. package/dist/client/assets/ConversationScreen-CR9pWB65.js +2 -0
  42. package/dist/client/assets/{ConversationStatus-DZuyKsWN.js → ConversationStatus-DVzSb2Hv.js} +1 -1
  43. package/dist/client/assets/{CrewAvatar-CTIuxp4G.js → CrewAvatar-BwXjyg8N.js} +1 -1
  44. package/dist/client/assets/CrewWorkspaces-CkQDhyie.css +1 -0
  45. package/dist/client/assets/CrewWorkspaces-NKujRzwh.js +1 -0
  46. package/dist/client/assets/{DataTable-6IDhanr5.js → DataTable-Bp8tU9AK.js} +1 -1
  47. package/dist/client/assets/{DispatchAftermath-DC1u9itO.js → DispatchAftermath-B-6rmXzL.js} +1 -1
  48. package/dist/client/assets/{DocumentFocusViewer-DZVhS7as.js → DocumentFocusViewer-Do3wQ_3Z.js} +1 -1
  49. package/dist/client/assets/{EmbeddableSurfacesLab-BKUFJMCV.js → EmbeddableSurfacesLab-C1orRyP9.js} +1 -1
  50. package/dist/client/assets/{EmptyState-CeBl0iGd.js → EmptyState-CJzXj1l5.js} +1 -1
  51. package/dist/client/assets/{FileViewerPane-DQlpNt2S.js → FileViewerPane-Df6VzXjA.js} +1 -1
  52. package/dist/client/assets/FlightObserveScreen-6mGnmWQA.js +1 -0
  53. package/dist/client/assets/{FollowScreen-BXHOp3gb.js → FollowScreen-DvnxYLVh.js} +1 -1
  54. package/dist/client/assets/{HarnessMark-D5CA5uSp.js → HarnessMark-B979GCSB.js} +1 -1
  55. package/dist/client/assets/{HarnessesScreen-DhFXq1qz.js → HarnessesScreen-CHTuv8p6.js} +1 -1
  56. package/dist/client/assets/{HerdrSession-BRhs5LIR.js → HerdrSession-B3McuYgi.js} +1 -1
  57. package/dist/client/assets/{HomeHero-DMABJuze.js → HomeHero-CdUVPjkG.js} +1 -1
  58. package/dist/client/assets/{HostAdvisorView-RAociATV.js → HostAdvisorView-Bok5Sk5c.js} +1 -1
  59. package/dist/client/assets/{KnowledgeSearchInspector-CZPyVNSw.js → KnowledgeSearchInspector-B7XSoJsu.js} +1 -1
  60. package/dist/client/assets/{KnowledgeSearchScreen-mGTKIg00.js → KnowledgeSearchScreen-D3o3IODW.js} +1 -1
  61. package/dist/client/assets/{LaneToolHoverCard-D_DMlBeT.js → LaneToolHoverCard-HByf2ndx.js} +1 -1
  62. package/dist/client/assets/{LaneTraceDetailSheet-BEHg3LmH.js → LaneTraceDetailSheet-BUgHz-sd.js} +1 -1
  63. package/dist/client/assets/{LaneTraceEventFocus-DVimcizS.js → LaneTraceEventFocus-DM-hoPxG.js} +1 -1
  64. package/dist/client/assets/{MeshCanvas-BOuZx4AM.js → MeshCanvas-DCLJRsBy.js} +1 -1
  65. package/dist/client/assets/{MeshCanvasMinimap-wL-1N94e.js → MeshCanvasMinimap-cEFS9eW7.js} +1 -1
  66. package/dist/client/assets/{MeshScreen-DMY9Bmh5.js → MeshScreen-BcxPkhm6.js} +1 -1
  67. package/dist/client/assets/{MeshTopologyView-DiDcX5f4.js → MeshTopologyView-CCRPd8PU.js} +2 -2
  68. package/dist/client/assets/MessagesScreen-Bb5l13MO.js +1 -0
  69. package/dist/client/assets/{MissionContextRail-DrNKXG5u.js → MissionContextRail-DF0_kiU7.js} +1 -1
  70. package/dist/client/assets/{MissionControlView-ByBlHVN8.js → MissionControlView-E3V7bENU.js} +1 -1
  71. package/dist/client/assets/{MissionFocusOverlay-D1i6R6Zt.js → MissionFocusOverlay-h15sQFvP.js} +1 -1
  72. package/dist/client/assets/{MissionLeftAgentRow-DN9NcCML.js → MissionLeftAgentRow-KPdk9rSa.js} +1 -1
  73. package/dist/client/assets/{MissionLogPane-DSeIv3Xo.js → MissionLogPane-BbdDKjUl.js} +1 -1
  74. package/dist/client/assets/{NewAgentModal-V7yK6J6j.js → NewAgentModal-DfHxad34.js} +1 -1
  75. package/dist/client/assets/NewChatComposer-_Stj0fZy.js +19 -0
  76. package/dist/client/assets/{NewChatOrigin-DdpzE4kz.js → NewChatOrigin-B1u7ki70.js} +1 -1
  77. package/dist/client/assets/{ObserveEmbedScreen-l_Q3ts2q.js → ObserveEmbedScreen-Co0xTii6.js} +1 -1
  78. package/dist/client/assets/{ObserveTextFlow-BSEtYTxU.js → ObserveTextFlow-ZQWwrK3i.js} +2 -2
  79. package/dist/client/assets/{ObservedTopologyPanel-CdGUXxGR.js → ObservedTopologyPanel-BJUhDSuQ.js} +1 -1
  80. package/dist/client/assets/{OpenScoutAppShell-DN8dOSK4.js → OpenScoutAppShell-CUd2yOLu.js} +25 -25
  81. package/dist/client/assets/{OpsAgentsView-ntGr4pz4.js → OpsAgentsView-DI5wu1si.js} +1 -1
  82. package/dist/client/assets/OpsScreen-D8fQafCl.js +1 -0
  83. package/dist/client/assets/OpsSubnav-1K4Jaf__.js +1 -0
  84. package/dist/client/assets/ProjectAgentProfile-Bdjd_dAx.js +1 -0
  85. package/dist/client/assets/{ProjectAgentProfileBar-BQET-qrY.js → ProjectAgentProfileBar-k2QHHHsQ.js} +1 -1
  86. package/dist/client/assets/{ProjectAgentProfileHero-Ck8mThtx.js → ProjectAgentProfileHero-Bpxk1ui2.js} +1 -1
  87. package/dist/client/assets/ProjectsInbox-C_bMHLCc.js +2 -0
  88. package/dist/client/assets/ProjectsRail-J-aH_pxT.js +1 -0
  89. package/dist/client/assets/ProjectsScreen-cVUkGbPz.js +1 -0
  90. package/dist/client/assets/ProjectsThreadAside-_ourdM-Q.js +1 -0
  91. package/dist/client/assets/{Provider-B2xuo3rf.js → Provider-CtXJeLrP.js} +1 -1
  92. package/dist/client/assets/{RailRow-B-GycCBx.js → RailRow-CEH2MFBw.js} +1 -1
  93. package/dist/client/assets/{RawSessionsTable-AQThi6sm.js → RawSessionsTable-CDyrom-F.js} +1 -1
  94. package/dist/client/assets/RealtimeVoiceScreen-DBl3DN1H.js +1 -0
  95. package/dist/client/assets/{RepoDiffEmbedScreen-DXWoRF_c.js → RepoDiffEmbedScreen-kY2pHjIs.js} +1 -1
  96. package/dist/client/assets/{RepoDiffPageScreen-D_274ExO.js → RepoDiffPageScreen-C6LhoKrn.js} +1 -1
  97. package/dist/client/assets/{RepoDiffViewer-DbedmHDX.js → RepoDiffViewer-BhcIIQQg.js} +1 -1
  98. package/dist/client/assets/{RepoDiffViewerLazy-C0--fPtk.js → RepoDiffViewerLazy-Csy_j9LD.js} +2 -2
  99. package/dist/client/assets/{ReposScreen-D39_YG4H.js → ReposScreen-B_cB0zu7.js} +1 -1
  100. package/dist/client/assets/ScoutDeckSurface-CSy_fjcG.js +1 -0
  101. package/dist/client/assets/{ScoutSurface-UsRy0t-I.js → ScoutSurface-CQVcSrin.js} +1 -1
  102. package/dist/client/assets/{ScoutbotFxLab-Fmdfboxs.js → ScoutbotFxLab-DqGiLYNy.js} +1 -1
  103. package/dist/client/assets/{SecondaryNav-o2RL9H8H.js → SecondaryNav-BR4VRdgh.js} +1 -1
  104. package/dist/client/assets/SessionEmbedScreen-BTlZ9gAg.js +1 -0
  105. package/dist/client/assets/{SessionObserve-Dsd0j05N.js → SessionObserve-dQDN23pP.js} +1 -1
  106. package/dist/client/assets/{SessionObserveEvidence-DopQYDkD.js → SessionObserveEvidence-BRBGKAgd.js} +1 -1
  107. package/dist/client/assets/SessionRefScreen-COVQMbtE.js +1 -0
  108. package/dist/client/assets/SessionsScreen--5OJ3p3v.js +1 -0
  109. package/dist/client/assets/{SettingsDrawer-_AwuopMS.js → SettingsDrawer-RGVK_bmE.js} +1 -1
  110. package/dist/client/assets/{SettingsScreen-Cw4DDfJP.js → SettingsScreen-CCxzy5IU.js} +1 -1
  111. package/dist/client/assets/{ShikiPane-BfHc_3pM.js → ShikiPane-DYI9Hkge.js} +1 -1
  112. package/dist/client/assets/{SlidePanel-C-q7XwTa.js → SlidePanel-B9ugxWgA.js} +1 -1
  113. package/dist/client/assets/{SpriteAvatar-Bs68ZENy.js → SpriteAvatar-z5hHesx9.js} +1 -1
  114. package/dist/client/assets/{StatusPill-ZZQwxB1a.js → StatusPill-BFvMjmZV.js} +1 -1
  115. package/dist/client/assets/{TailView-Q4FVMsUH.js → TailView-0uEIj2JH.js} +1 -1
  116. package/dist/client/assets/{Terminal-D7zqHwHV.js → Terminal-DouZeNxc.js} +1 -1
  117. package/dist/client/assets/{TerminalEmbedScreen-CXIJ7qv6.js → TerminalEmbedScreen-dMNUbzXr.js} +1 -1
  118. package/dist/client/assets/{TerminalHeaderMount-BnBLOPbb.js → TerminalHeaderMount-BL07cd0q.js} +1 -1
  119. package/dist/client/assets/{TextDocumentSurface-CKQP-cBT.js → TextDocumentSurface-BflAwXeZ.js} +1 -1
  120. package/dist/client/assets/{TmuxPeek-V9dGESfO.js → TmuxPeek-BTnjOQi0.js} +1 -1
  121. package/dist/client/assets/{VoicePermissionsPanel-k7sbLXx2.js → VoicePermissionsPanel-CgQ6GGS-.js} +1 -1
  122. package/dist/client/assets/{WorkDetailScreen-60p9litn.js → WorkDetailScreen-CaLG-zDs.js} +1 -1
  123. package/dist/client/assets/{WorkFilesViewer-BjJS7GyM.js → WorkFilesViewer-B9Sil_No.js} +1 -1
  124. package/dist/client/assets/{activity-Bj3Hnbj3.js → activity-DcrMApUY.js} +1 -1
  125. package/dist/client/assets/{addon-fit-BL-NTWRU.js → addon-fit-DMVrz5Sv.js} +1 -1
  126. package/dist/client/assets/{addon-webgl-CIMgmNjg.js → addon-webgl-BYvpZUyu.js} +1 -1
  127. package/dist/client/assets/{agent-autocomplete-DXlvdc4b.js → agent-autocomplete-B-5QTeas.js} +1 -1
  128. package/dist/client/assets/{agent-essentials-BOMHR0_U.js → agent-essentials-D7KRGYvF.js} +1 -1
  129. package/dist/client/assets/{agent-lane-card-model-CTLxf3R4.js → agent-lane-card-model-CNZMPkhc.js} +1 -1
  130. package/dist/client/assets/{agent-lanes-model-AfrjRNK5.js → agent-lanes-model-DXqjs0OK.js} +2 -2
  131. package/dist/client/assets/agent-master-I1W-5d-x.css +1 -0
  132. package/dist/client/assets/agent-master-model-DqjrVI2h.js +1 -0
  133. package/dist/client/assets/{agent-specialization-BIPIBW8u.js → agent-specialization-BujJVUTD.js} +1 -1
  134. package/dist/client/assets/{arc.es-IR5r6sj_.js → arc.es-NHqHWohb.js} +1 -1
  135. package/dist/client/assets/{arrow-down-BydciYFZ.js → arrow-down-CKtSUjmW.js} +1 -1
  136. package/dist/client/assets/{arrow-left-CghA0kTw.js → arrow-left-Czpf-AE4.js} +1 -1
  137. package/dist/client/assets/{arrow-right-iJFv3jNh.js → arrow-right-BuzMnLYP.js} +1 -1
  138. package/dist/client/assets/{arrow-up-right-CCfZXPqD.js → arrow-up-right-C6Wl-1uw.js} +1 -1
  139. package/dist/client/assets/{bot-B5sub1-i.js → bot-rd0awxD3.js} +1 -1
  140. package/dist/client/assets/{check-C18YQC90.js → check-ofKUE8yH.js} +1 -1
  141. package/dist/client/assets/{chevron-down-Mp9mu_yd.js → chevron-down-wciXnOQz.js} +1 -1
  142. package/dist/client/assets/{chevron-right-CzH-TaSF.js → chevron-right-D-HdlPg8.js} +1 -1
  143. package/dist/client/assets/{chunk-HRAB3GC3-swV8PA2k.js → chunk-HRAB3GC3-Tyv9rzx7.js} +1 -1
  144. package/dist/client/assets/{chunk-JTPDIGGW-BKXqcLKw.js → chunk-JTPDIGGW-BC2Mandc.js} +3 -3
  145. package/dist/client/assets/{chunk-T65CQEWV-vYbNJ8E6.js → chunk-T65CQEWV-C1AWTYZZ.js} +1 -1
  146. package/dist/client/assets/{chunk-YOZR3KYS-U65yUmqt.js → chunk-YOZR3KYS-DwHPHa6f.js} +1 -1
  147. package/dist/client/assets/{clock-B4PTFi5m.js → clock-B88r8OrZ.js} +1 -1
  148. package/dist/client/assets/{code-xml-Jtxsp5d1.js → code-xml-D7pOQM9l.js} +1 -1
  149. package/dist/client/assets/{compass-0_54-vz3.js → compass-Dt1AMXz2.js} +1 -1
  150. package/dist/client/assets/content-9K38QchR.js +1 -0
  151. package/dist/client/assets/content-BRgnyXWh.js +1 -0
  152. package/dist/client/assets/{content-CHghn-rT.js → content-BWPNyXJ0.js} +1 -1
  153. package/dist/client/assets/content-BdkI07v3.js +1 -0
  154. package/dist/client/assets/content-C4oWa8SB.js +1 -0
  155. package/dist/client/assets/content-C9ijJxyl.js +1 -0
  156. package/dist/client/assets/content-CFZ4rghn.js +1 -0
  157. package/dist/client/assets/content-CIqu_Ci_.js +1 -0
  158. package/dist/client/assets/content-CnJF9DGO.js +1 -0
  159. package/dist/client/assets/content-CriW8Y8u.js +1 -0
  160. package/dist/client/assets/content-DDCyPPk_.js +1 -0
  161. package/dist/client/assets/content-DtcZeh5m.js +1 -0
  162. package/dist/client/assets/content-U9tsdtle.js +1 -0
  163. package/dist/client/assets/content-hFLK3CON.js +1 -0
  164. package/dist/client/assets/{content-DMbawvqU.js → content-nkx0swDe.js} +1 -1
  165. package/dist/client/assets/content-p00KQrtD.js +1 -0
  166. package/dist/client/assets/{conversation-icons-BV10B2Me.js → conversation-icons-tp9BX6X2.js} +1 -1
  167. package/dist/client/assets/{conversation-model-CwF6Y9gx.js → conversation-model-Dc02NsGp.js} +1 -1
  168. package/dist/client/assets/conversation-motion-features-D9-RmBSq.js +1 -0
  169. package/dist/client/assets/{copy-Dtpx4FOE.js → copy-CWWAJ75H.js} +1 -1
  170. package/dist/client/assets/{cpu-BjVis9mc.js → cpu-DrqejfkB.js} +1 -1
  171. package/dist/client/assets/{createLucideIcon-DXpqZP7I.js → createLucideIcon-DezKXSG2.js} +1 -1
  172. package/dist/client/assets/{ctx-panel-D_HJ3nhb.css → ctx-panel-F05jXK4Q.css} +1 -1
  173. package/dist/client/assets/discover-C2CZO4Tk.js +2 -0
  174. package/dist/client/assets/embed-entry-BSMUykuG.js +2 -0
  175. package/dist/client/assets/{external-link-Ckiyzjwo.js → external-link-Dp_a2vRZ.js} +1 -1
  176. package/dist/client/assets/{eye-CpfyvdLq.js → eye-BRyD0jno.js} +1 -1
  177. package/dist/client/assets/{file-code-corner-7mo7EviR.js → file-code-corner-muIVH_xO.js} +1 -1
  178. package/dist/client/assets/{file-text-KijGBnME.js → file-text-CqJgwxmv.js} +1 -1
  179. package/dist/client/assets/{gauge-y-Xg8Mrv.js → gauge-hU--hKVP.js} +1 -1
  180. package/dist/client/assets/{gestures-Bq9XnSqY.js → gestures-DN4hEeqv.js} +1 -1
  181. package/dist/client/assets/{git-branch-BQ_x8KZL.js → git-branch-CK5v8F2v.js} +1 -1
  182. package/dist/client/assets/{home-moving-signal-DtRpiNa0.js → home-moving-signal-BjDtEJUP.js} +1 -1
  183. package/dist/client/assets/{home-now-card-DFb4GOgM.js → home-now-card-nF8OotI-.js} +1 -1
  184. package/dist/client/assets/{home-now-card-nano-D--m9jpq.js → home-now-card-nano-C-r_bBg5.js} +1 -1
  185. package/dist/client/assets/{hooks-9d1SoaQA.js → hooks-D46bABUP.js} +1 -1
  186. package/dist/client/assets/index-CPrU5q04.js +1 -0
  187. package/dist/client/assets/{index-CZ-05hKz.js → index-DvLtl7rV.js} +5 -5
  188. package/dist/client/assets/index-kL1WLbeS.js +1 -0
  189. package/dist/client/assets/index-zvhpRHao.js +1 -0
  190. package/dist/client/assets/{inspector-panel-C-EhEDYy.js → inspector-panel-Dkc7rLvY.js} +1 -1
  191. package/dist/client/assets/{keyboard-nav-DFhAJkW3.js → keyboard-nav-BLYDhL3Z.js} +1 -1
  192. package/dist/client/assets/{lane-roster-store-gUBsydNf.js → lane-roster-store-DOdI1O13.js} +1 -1
  193. package/dist/client/assets/{layers-CGou-LwV.js → layers-CSsg3JVP.js} +1 -1
  194. package/dist/client/assets/{layout-grid-BrZt31QH.js → layout-grid-DOChPJdZ.js} +1 -1
  195. package/dist/client/assets/left-B-SdEJSJ.js +1 -0
  196. package/dist/client/assets/{left-B_o51JV6.js → left-B3wSE6ql.js} +1 -1
  197. package/dist/client/assets/{left-CwHZCGO3.js → left-BNRFiRsb.js} +1 -1
  198. package/dist/client/assets/{left-DA0amyfu.js → left-BggzhgXN.js} +1 -1
  199. package/dist/client/assets/left-CARCvvxS.js +2 -0
  200. package/dist/client/assets/left-CpokZYHt.js +1 -0
  201. package/dist/client/assets/{left-CwLs0okF.js → left-YT7mIGuH.js} +1 -1
  202. package/dist/client/assets/{left-advisor-DU3s01gk.js → left-advisor-CCY0vkcO.js} +1 -1
  203. package/dist/client/assets/left-agents-trhO5sL8.js +1 -0
  204. package/dist/client/assets/{left-default-uvuvDmt0.js → left-default-CG33elBs.js} +1 -1
  205. package/dist/client/assets/{left-lanes-DnNLgec8.js → left-lanes-CitMgeTp.js} +1 -1
  206. package/dist/client/assets/{left-mission-DN3-NLPC.js → left-mission-Zl2m_5eU.js} +1 -1
  207. package/dist/client/assets/{library-DIo5NiGP.js → library-DkALuCh5.js} +1 -1
  208. package/dist/client/assets/{loader-circle-BiohlpM3.js → loader-circle-pM56HNhR.js} +1 -1
  209. package/dist/client/assets/{local-agents-wUIaBcEr.js → local-agents-C8xAhbO5.js} +1 -1
  210. package/dist/client/assets/{mentions-CcPFMbmZ.js → mentions-DG6OQrsc.js} +1 -1
  211. package/dist/client/assets/{mesh-buckets-ByyFXdKT.js → mesh-buckets-6y3ZIibI.js} +1 -1
  212. package/dist/client/assets/{mesh-ops-CvGyjK84.js → mesh-ops-BZ1h5RQs.js} +1 -1
  213. package/dist/client/assets/{mesh-roster-n2nDpEmA.js → mesh-roster-Bc7T4b7z.js} +1 -1
  214. package/dist/client/assets/{mesh-view-store-BpxGm71b.js → mesh-view-store-ChUOASK8.js} +1 -1
  215. package/dist/client/assets/{message-circle-B2ddzBrX.js → message-circle-mZCv8tvB.js} +1 -1
  216. package/dist/client/assets/{message-markup-RkfmDfME.js → message-markup-C2LQDm_k.js} +1 -1
  217. package/dist/client/assets/{message-square-D9YYWE0x.js → message-square-C7t_qtuj.js} +1 -1
  218. package/dist/client/assets/{message-visibility-DwxgcgYK.js → message-visibility-CGOmSSKs.js} +1 -1
  219. package/dist/client/assets/{mission-control-store-Bf4b54MV.js → mission-control-store-nDLdUZPA.js} +1 -1
  220. package/dist/client/assets/{observe-CJRIvOCn.js → observe-BpEm1INu.js} +1 -1
  221. package/dist/client/assets/{page-status-BptpTdQ-.js → page-status-E5jnk48p.js} +1 -1
  222. package/dist/client/assets/{paperclip-B1UNGl5d.js → paperclip-C64lkcbM.js} +1 -1
  223. package/dist/client/assets/{persistent-state-YI-WHSCF.js → persistent-state-EHXw8WNy.js} +1 -1
  224. package/dist/client/assets/{plus-CuU_X0-8.js → plus-Co-dqKul.js} +1 -1
  225. package/dist/client/assets/{profile-rY8jO38P.js → profile-APxDsN2P.js} +1 -1
  226. package/dist/client/assets/projects-inbox-Cg4X2lUQ.js +1 -0
  227. package/dist/client/assets/projects-inbox-DRBl2N85.css +1 -0
  228. package/dist/client/assets/{proxy-DnLpZIi9.js → proxy-BiW5suC7.js} +1 -1
  229. package/dist/client/assets/{radio-Dm1ItnA4.js → radio-BOxBQX-T.js} +1 -1
  230. package/dist/client/assets/{refresh-cw-BRn9Oxxl.js → refresh-cw-DMxGzDwn.js} +1 -1
  231. package/dist/client/assets/resolve-panes-DeVJbS9c.js +1 -0
  232. package/dist/client/assets/resolve-sidebar-context-BQe5J6xF.js +1 -0
  233. package/dist/client/assets/{right-BJltPRnd.js → right-Bmfd3pjP.js} +1 -1
  234. package/dist/client/assets/{right-Beh3nCUB.js → right-BqI-nr9G.js} +1 -1
  235. package/dist/client/assets/{right-D3aTKf1F.js → right-BuCgE0fZ.js} +1 -1
  236. package/dist/client/assets/{right-Shpw_xDy.js → right-BwlW6E57.js} +1 -1
  237. package/dist/client/assets/{right-CPP7GyOm.js → right-C0ybUw0j.js} +1 -1
  238. package/dist/client/assets/{right-BbyYdzHn.js → right-CdkcrmeD.js} +1 -1
  239. package/dist/client/assets/{right-CJnB_Bg7.js → right-CimaAvQN.js} +1 -1
  240. package/dist/client/assets/{right-C1yumXNx.js → right-CkCCPbCX.js} +1 -1
  241. package/dist/client/assets/{right-DI1B79nR.js → right-D3eSiy41.js} +1 -1
  242. package/dist/client/assets/{right-DtsRNX5b.js → right-Dz_xD0Vj.js} +1 -1
  243. package/dist/client/assets/{rocket-DOwXHKWA.js → rocket-BQm5_CvR.js} +1 -1
  244. package/dist/client/assets/router-B9vQkNJL.js +1 -0
  245. package/dist/client/assets/{scope-views-A4_vP97W.js → scope-views-1IYJdl41.js} +1 -1
  246. package/dist/client/assets/{scout-voice-BhPzrc6P.js → scout-voice-BVUqGhth.js} +1 -1
  247. package/dist/client/assets/{scoutbot-markdown-jh7tzFB1.js → scoutbot-markdown-BQ_Ee2Ic.js} +1 -1
  248. package/dist/client/assets/{scroll-text-DO0GQzvN.js → scroll-text-Dze_dXtQ.js} +1 -1
  249. package/dist/client/assets/{search-D1tJSAWe.js → search-CDko0PKE.js} +1 -1
  250. package/dist/client/assets/{secondaryNavConfig-B9IF8wXl.js → secondaryNavConfig-BoQ_zYR9.js} +1 -1
  251. package/dist/client/assets/{selection-bridge-i2S9zpf8.js → selection-bridge-Din6yV3h.js} +1 -1
  252. package/dist/client/assets/{send-horizontal-CgLppsIC.js → send-horizontal-CSjIm6xg.js} +1 -1
  253. package/dist/client/assets/{server-Dymv5Emh.js → server-Bzj7lPIx.js} +1 -1
  254. package/dist/client/assets/{session-catalog-DNaOEzoQ.js → session-catalog-DsaZJXZt.js} +1 -1
  255. package/dist/client/assets/session-ref-lookup-state-SATH_jAP.js +1 -0
  256. package/dist/client/assets/{session-table-PTQVoTyc.js → session-table-BQfR7u6r.js} +1 -1
  257. package/dist/client/assets/{settings-2fC_G9nX.js → settings-Dyvpkb1D.js} +1 -1
  258. package/dist/client/assets/{sliders-horizontal-BPSMHhbm.js → sliders-horizontal-C8njVwfg.js} +1 -1
  259. package/dist/client/assets/{sparkles-Dy8p5xN8.js → sparkles-CETYrxGA.js} +1 -1
  260. package/dist/client/assets/{sse-CiOSzE5n.js → sse-CD9MMUxl.js} +1 -1
  261. package/dist/client/assets/{tail-events-BMQmSx1n.js → tail-events-Ps8KpKah.js} +1 -1
  262. package/dist/client/assets/{terminal-yN9xN-h9.js → terminal-9GRS_Qdc.js} +1 -1
  263. package/dist/client/assets/{terminal-relay-9lhzEp2V.js → terminal-relay-GYMIvKs1.js} +1 -1
  264. package/dist/client/assets/{terminal-takeover-DANQfTcy.js → terminal-takeover-_Jyys4me.js} +1 -1
  265. package/dist/client/assets/{text-CnZ0e1-V.js → text-BP3oyl8-.js} +1 -1
  266. package/dist/client/assets/{text-rLpBg4_z.css → text-BYAFNLNq.css} +1 -1
  267. package/dist/client/assets/{use-conversation-list-D9BNLfnW.js → use-conversation-list-C9ABzjXI.js} +1 -1
  268. package/dist/client/assets/use-fleet-active-asks-DAspZQjE.js +1 -0
  269. package/dist/client/assets/{use-mesh-ops-items-BIvIHlqe.js → use-mesh-ops-items-Dh54ymEp.js} +1 -1
  270. package/dist/client/assets/{use-reduced-motion-CKkhq9c5.js → use-reduced-motion-x8pJMVrG.js} +1 -1
  271. package/dist/client/assets/{use-scout-dev-flags-B2KCzPxn.js → use-scout-dev-flags-DhCbiDK3.js} +1 -1
  272. package/dist/client/assets/{useAgentHoverCard-CHBsxcbp.js → useAgentHoverCard-DoBwV0LX.js} +1 -1
  273. package/dist/client/assets/useContentSecondaryNav-pZe2Zfk1.js +1 -0
  274. package/dist/client/assets/{usePierreRuntime-DUuXH5yp.js → usePierreRuntime-ejq9dCWV.js} +1 -1
  275. package/dist/client/assets/{wrench-YcXMlsh2.js → wrench-DjkoAOQt.js} +1 -1
  276. package/dist/client/assets/{x-e3h2hDsp.js → x-CAbNespN.js} +1 -1
  277. package/dist/client/assets/{xterm-Byp1Hep_.js → xterm-Cf-ngcGP.js} +1 -1
  278. package/dist/client/assets/{zap-nMcjPoWB.js → zap-Cq8eWkcF.js} +1 -1
  279. package/dist/client/index.html +1 -1
  280. package/dist/drizzle/0009_old_korg.sql +72 -0
  281. package/dist/drizzle/0010_sparkling_colonel_america.sql +2 -0
  282. package/dist/drizzle/0011_funny_onslaught.sql +4 -0
  283. package/dist/drizzle/0012_high_blazing_skull.sql +16 -0
  284. package/dist/drizzle/0013_perfect_juggernaut.sql +1 -0
  285. package/dist/drizzle/0014_legal_meggan.sql +6 -0
  286. package/dist/drizzle/0015_lame_marvel_boy.sql +12 -0
  287. package/dist/drizzle/0016_early_goliath.sql +6 -0
  288. package/dist/drizzle/meta/0009_snapshot.json +6262 -0
  289. package/dist/drizzle/meta/0010_snapshot.json +6286 -0
  290. package/dist/drizzle/meta/0011_snapshot.json +6337 -0
  291. package/dist/drizzle/meta/0012_snapshot.json +6458 -0
  292. package/dist/drizzle/meta/0013_snapshot.json +6465 -0
  293. package/dist/drizzle/meta/0014_snapshot.json +6503 -0
  294. package/dist/drizzle/meta/0015_snapshot.json +6596 -0
  295. package/dist/drizzle/meta/0016_snapshot.json +6611 -0
  296. package/dist/drizzle/meta/_journal.json +56 -0
  297. package/dist/main.mjs +1306 -360
  298. package/dist/node/main.mjs +314 -12
  299. package/dist/pairing-runtime-controller.mjs +608 -108
  300. package/dist/runtime/base-daemon.mjs +30 -3
  301. package/dist/runtime/broker-daemon.mjs +4771 -529
  302. package/dist/runtime/broker-process-manager.mjs +23 -2
  303. package/dist/runtime/mesh-discover.mjs +23 -2
  304. package/dist/scout-control-plane-web.mjs +1914 -478
  305. package/package.json +2 -2
  306. package/dist/client/assets/AgentLanesEmbedScreen-BmLnN4on.js +0 -1
  307. package/dist/client/assets/AgentLanesPreflight-5B6sXvRB.js +0 -1
  308. package/dist/client/assets/AgentLanesView-DHyzVBk6.js +0 -2
  309. package/dist/client/assets/AgentsSubnav-CDMjKeYC.js +0 -1
  310. package/dist/client/assets/ChatCollapsedStrip-Ycm0ecaX.js +0 -1
  311. package/dist/client/assets/ConversationScreen-BNULZAp2.js +0 -2
  312. package/dist/client/assets/CrewWorkspaces-CJhBKVoZ.css +0 -1
  313. package/dist/client/assets/CrewWorkspaces-CkPYIA46.js +0 -1
  314. package/dist/client/assets/FlightObserveScreen-CDWGSKZg.js +0 -1
  315. package/dist/client/assets/MessagesScreen-Eulveud3.js +0 -1
  316. package/dist/client/assets/NewChatComposer-hlWT-nbR.js +0 -19
  317. package/dist/client/assets/OpsScreen-Ppen_Lmj.js +0 -1
  318. package/dist/client/assets/OpsSubnav-GAKsoSor.js +0 -1
  319. package/dist/client/assets/ProjectAgentProfile-BLlp2e6t.js +0 -1
  320. package/dist/client/assets/ProjectsInbox-Dlt8OQ8O.js +0 -2
  321. package/dist/client/assets/ProjectsRail-DCfNMmnW.js +0 -1
  322. package/dist/client/assets/ProjectsScreen-BP-hmI1m.js +0 -1
  323. package/dist/client/assets/ProjectsThreadAside-CWpMjGIH.js +0 -1
  324. package/dist/client/assets/RealtimeVoiceScreen-D7zZHK_t.js +0 -1
  325. package/dist/client/assets/ScoutDeckSurface-CKT3qdqY.js +0 -1
  326. package/dist/client/assets/SessionEmbedScreen-RD5XOx7R.js +0 -1
  327. package/dist/client/assets/SessionRefScreen-B_cTv47v.js +0 -1
  328. package/dist/client/assets/SessionsScreen-Bq0Z77On.js +0 -1
  329. package/dist/client/assets/archive-BjcGiAy8.js +0 -1
  330. package/dist/client/assets/content-6RvWTrtk.js +0 -1
  331. package/dist/client/assets/content-BCgwMUqz.js +0 -1
  332. package/dist/client/assets/content-Bf2VLhx0.js +0 -1
  333. package/dist/client/assets/content-BrU_38-m.js +0 -1
  334. package/dist/client/assets/content-BvvJN8rN.js +0 -1
  335. package/dist/client/assets/content-CAeEqYPw.js +0 -1
  336. package/dist/client/assets/content-CI_Z9DXk.js +0 -1
  337. package/dist/client/assets/content-CbyKONhW.js +0 -1
  338. package/dist/client/assets/content-Czogvp43.js +0 -1
  339. package/dist/client/assets/content-DFk0zNzX.js +0 -1
  340. package/dist/client/assets/content-DHe4DgkA.js +0 -1
  341. package/dist/client/assets/content-DTz7cKjo.js +0 -1
  342. package/dist/client/assets/content-E3kudY-W.js +0 -1
  343. package/dist/client/assets/content-LpO0aO_U.js +0 -1
  344. package/dist/client/assets/conversation-motion-features-BKkCRaWR.js +0 -1
  345. package/dist/client/assets/discover-CHbrEItO.js +0 -2
  346. package/dist/client/assets/embed-entry-vil28MyU.js +0 -2
  347. package/dist/client/assets/index-BVlMw8x_.js +0 -1
  348. package/dist/client/assets/index-Cn0GR-q1.js +0 -1
  349. package/dist/client/assets/index-DosI4AG9.js +0 -1
  350. package/dist/client/assets/left-BpgWnaah.js +0 -1
  351. package/dist/client/assets/left-Cx0kv6pe.js +0 -1
  352. package/dist/client/assets/left-agents-qL5PpUY-.js +0 -1
  353. package/dist/client/assets/left-z-6CkuBe.js +0 -2
  354. package/dist/client/assets/projects-inbox-BBs1hG13.css +0 -1
  355. package/dist/client/assets/projects-inbox-D-zAb9Gp.js +0 -1
  356. package/dist/client/assets/resolve-panes-DO6LkwhQ.js +0 -1
  357. package/dist/client/assets/resolve-sidebar-context-CIF288wY.js +0 -1
  358. package/dist/client/assets/router-DJj2WbDg.js +0 -1
  359. package/dist/client/assets/use-fleet-active-asks-BeAdcl09.js +0 -1
  360. package/dist/client/assets/useContentSecondaryNav-D0mUhxTF.js +0 -1
@@ -1 +1 @@
1
- import{r as o,j as a,a2 as _e,b as dt,y as ft,a3 as pt,a4 as ht,L as mt}from"./index-CZ-05hKz.js";import{h as $e,b as vt,au as gt}from"./router-DJj2WbDg.js";import{a as q}from"./api-Co9aQ2Jw.js";import{u as wt}from"./sse-CiOSzE5n.js";import{o as bt,i as je}from"./surface-activity-B1rgWB1i.js";import{i as yt}from"./colors-BtO5_zlx.js";import{e as Je,s as St,i as De,r as Ct,b as Et,f as kt}from"./scoutbot-BJIamJOH.js";import{F as xt,a as Tt,D as At}from"./DocumentFocusViewer-DZVhS7as.js";import{c as Ke,T as Ge}from"./TextDocumentSurface-CKQP-cBT.js";import{C as Rt}from"./chevron-right-CzH-TaSF.js";import{F as It}from"./file-text-KijGBnME.js";import{c as Nt}from"./createLucideIcon-DXpqZP7I.js";import{C as Lt}from"./code-xml-Jtxsp5d1.js";import{A as Ot}from"./arrow-left-CghA0kTw.js";import{A as _t}from"./arrow-right-iJFv3jNh.js";import{j as jt}from"./scout-voice-BhPzrc6P.js";import{i as Dt}from"./keyboard-nav-DFhAJkW3.js";import{J as Pt,N as Mt,l as ve,K as Pe,j as Me}from"./NewChatComposer-hlWT-nbR.js";import{u as Ft}from"./chunk-HRAB3GC3-swV8PA2k.js";const We={current:null,setMenu:null};function Tr(){return o.useCallback((e,t)=>{e.preventDefault(),e.stopPropagation(),We.setMenu?.({position:{x:e.clientX,y:e.clientY},items:t})},[])}function Bt({children:e}){const[t,n]=o.useState(null),r=o.useRef(null);We.setMenu=n;const s=o.useCallback(()=>{n(null)},[]);return o.useEffect(()=>{if(!t)return;const i=d=>{d.target instanceof Node&&r.current?.contains(d.target)||s()},c=d=>{d.key==="Escape"&&s()},p=()=>s(),u=d=>{d.defaultPrevented||s()};return window.addEventListener("mousedown",i,!0),window.addEventListener("keydown",c),window.addEventListener("wheel",p,!0),window.addEventListener("contextmenu",u),()=>{window.removeEventListener("mousedown",i,!0),window.removeEventListener("keydown",c),window.removeEventListener("wheel",p,!0),window.removeEventListener("contextmenu",u)}},[t,s]),o.useLayoutEffect(()=>{if(!t||!r.current)return;const i=r.current,c=i.getBoundingClientRect(),p=window.innerWidth,u=window.innerHeight;let d=t.position.x,f=t.position.y;d+c.width>p-8&&(d=p-c.width-8),f+c.height>u-8&&(f=u-c.height-8),d<8&&(d=8),f<8&&(f=8),i.style.left=`${d}px`,i.style.top=`${f}px`,i.style.visibility="visible"},[t]),a.jsxs(a.Fragment,{children:[e,t&&a.jsx("div",{ref:r,className:"s-context-menu",style:{left:t.position.x,top:t.position.y,visibility:"hidden"},role:"menu",onMouseDown:i=>i.stopPropagation(),children:t.items.map((i,c)=>i.kind==="separator"?a.jsx("div",{className:"s-context-menu-sep",role:"separator"},c):a.jsxs("button",{type:"button",className:"s-context-menu-item",role:"menuitem",onClick:()=>{i.onSelect(),s()},children:[a.jsx("span",{className:"s-context-menu-label",children:i.label}),i.shortcut&&a.jsx("span",{className:"s-context-menu-shortcut",children:i.shortcut})]},c))})]})}function Ut(e){const t=e instanceof Error?e.message:String(e);return qt(t)?"Scout server is unreachable":t}function Vt(e){return e==="Scout server is unreachable"}function qt(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 Se="openscout.operator.name",Ht=new Set(["operator","you","user","unknown","null","undefined"]);function ze(e){const t=e?.trim();return!t||t.length>64||Ht.has(t.toLowerCase())?null:t}function $t(){if(typeof window>"u")return null;try{return ze(window.localStorage.getItem(Se))}catch{return null}}function Jt(e){if(!(typeof window>"u"))try{const t=ze(e);t?window.localStorage.setItem(Se,t):window.localStorage.removeItem(Se)}catch{}}const Kt=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Gt=Nt("chevron-up",Kt),Wt={id:"audio",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("audio/"),render:({resource:e})=>{const t=e;return a.jsx("div",{className:"s-file-preview-media-wrap",children:a.jsx("div",{className:"s-file-preview-audio-stage",children:a.jsx("audio",{className:"s-file-preview-audio",src:t.rawUrl,controls:!0})})})}},zt={id:"binary",canHandle:()=>!0,render:({resource:e})=>{const t=e;return a.jsxs("div",{className:"s-file-preview-callout",children:[a.jsxs("div",{className:"s-file-preview-callout-title",children:[t.previewReason," — open in OS"]}),a.jsxs("div",{className:"s-file-preview-callout-copy",children:["Scout can resolve this file, but it does not have an inline preview for ",t.mediaType," yet."]})]})}},Qt=new Set(["text/typescript","text/javascript","text/css","text/html","application/json","text/yaml","text/toml","text/x-shellscript","text/plain"]),Yt={id:"code",canHandle:e=>e.kind==="file"&&e.previewable&&Qt.has(e.mediaType),render:({resource:e})=>{const t=e,n=Ke({id:t.realPath,title:t.title,uri:t.realPath,mediaType:t.mediaType,value:t.content,filename:t.title,kind:"code",readOnly:!0});return a.jsx(Ge,{document:n,mode:"read",className:"s-doc-focus-document"})}},Xt={id:"directory",canHandle:e=>e.kind==="directory",render:({resource:e,openFilePreview:t})=>{const n=e,r=Zt(n.realPath,n.rootPath);return a.jsxs("div",{className:"s-file-preview-directory",children:[a.jsx("div",{className:"s-file-preview-breadcrumb","aria-label":"Directory breadcrumb",children:r.map((s,i)=>{const c=i===r.length-1;return a.jsxs("div",{className:"s-file-preview-breadcrumb-item",children:[i>0&&a.jsx(Rt,{size:12,"aria-hidden":"true"}),c?a.jsx("span",{className:"s-file-preview-breadcrumb-current",children:s.label}):a.jsx("button",{type:"button",className:"s-file-preview-breadcrumb-link",onClick:()=>t(s.path),children:s.label})]},s.path)})}),a.jsxs("div",{className:"s-file-preview-directory-list",role:"list",children:[n.entries.map(s=>a.jsxs("button",{type:"button",className:"s-file-preview-entry",onClick:()=>t(s.path),children:[a.jsx("span",{className:"s-file-preview-entry-icon","aria-hidden":"true",children:s.kind==="directory"?a.jsx(xt,{size:14}):a.jsx(It,{size:14})}),a.jsx("span",{className:"s-file-preview-entry-name",children:s.name}),a.jsx("span",{className:"s-file-preview-entry-kind",children:s.kind==="directory"?"dir":"file"})]},s.realPath)),n.entries.length===0&&a.jsx("div",{className:"s-file-preview-directory-empty",children:"This directory is empty."})]})]})}};function Zt(e,t){const n=t==="/"?"/":t.replace(/\/+$/u,""),r=e==="/"?"/":e.replace(/\/+$/u,""),s=n.split("/").filter(Boolean),i=r.split("/").filter(Boolean),c=[{label:s[s.length-1]??"/",path:n||"/"}];let p=n||"/";for(let u=s.length;u<i.length;u+=1){const d=i[u];d&&(p=p==="/"?`/${d}`:`${p}/${d}`,c.push({label:d,path:p}))}return c}const en={id:"html",canHandle:e=>e.kind==="file"&&e.previewable&&e.mediaType==="text/html",render:({resource:e})=>a.jsx("div",{className:"s-file-preview-html-wrap",children:a.jsx("iframe",{className:"s-file-preview-html-frame",src:e.kind==="file"?e.rawUrl:"",title:e.title,sandbox:"allow-forms allow-popups allow-popups-to-escape-sandbox allow-scripts",referrerPolicy:"no-referrer"})})},tn={id:"image",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("image/"),render:({resource:e})=>a.jsx("div",{className:"s-file-preview-image-wrap",children:a.jsx("div",{className:"s-file-preview-image-stage",children:a.jsx("img",{className:"s-file-preview-image",src:e.kind==="file"?e.rawUrl:"",alt:e.title})})})},nn={id:"markdown",canHandle:e=>e.kind==="file"&&e.previewable&&e.mediaType==="text/markdown",render:({resource:e})=>{const t=e,n=Ke({id:t.realPath,title:t.title,uri:t.realPath,mediaType:t.mediaType,value:t.content,filename:t.title,kind:"markdown",readOnly:!0});return a.jsx(Ge,{document:n,mode:"preview",className:"s-doc-focus-document"})}},rn={id:"video",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("video/"),render:({resource:e})=>{const t=e;return a.jsx("div",{className:"s-file-preview-media-wrap",children:a.jsx("div",{className:"s-file-preview-media-stage",children:a.jsx("video",{className:"s-file-preview-video",src:t.rawUrl,controls:!0})})})}},on=[Xt,nn,en,Yt,tn,rn,Wt,zt];function sn({path:e,onOpenPath:t,onOpenInCode:n,onClose:r}){const[s,i]=o.useState(null),[c,p]=o.useState(null),[u,d]=o.useState(!1),[f,P]=o.useState(null),D=o.useRef(null);o.useEffect(()=>{D.current=f},[f]),o.useEffect(()=>{if(!e){i(null),p(null),d(!1);return}let b=!1;return d(!0),p(null),i(null),q(`/api/file/preview?path=${encodeURIComponent(e)}`).then(y=>{b||(i(y),an(y,D.current,P))}).catch(y=>{b||p(y instanceof Error?y.message:"could not load file")}).finally(()=>{b||d(!1)}),()=>{b=!0}},[e]);const{currentIndex:M,prevPath:v,nextPath:h}=o.useMemo(()=>{if(!s||s.kind!=="file"||!f)return{currentIndex:-1,prevPath:null,nextPath:null};const b=f.files.findIndex(y=>y.realPath===s.realPath);return b<0?{currentIndex:-1,prevPath:null,nextPath:null}:{currentIndex:b,prevPath:b>0?f.files[b-1].path:null,nextPath:b<f.files.length-1?f.files[b+1].path:null}},[s,f]);if(o.useEffect(()=>{if(!e)return;const b=y=>{if(y.key==="Escape"){r();return}if(y.target instanceof HTMLElement){const g=y.target.tagName;if(g==="INPUT"||g==="TEXTAREA"||y.target.isContentEditable)return}y.metaKey||y.ctrlKey||y.altKey||(y.key==="ArrowLeft"&&v?(y.preventDefault(),t(v)):y.key==="ArrowRight"&&h?(y.preventDefault(),t(h)):y.key==="Backspace"&&f&&s?.kind==="file"&&(y.preventDefault(),t(f.dirPath)))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[e,r,t,v,h,f,s]),!e)return null;const w=()=>{q("/api/file/reveal",{method:"POST",body:JSON.stringify({path:s?.realPath??e})}).catch(b=>{p(b instanceof Error?b.message:"reveal failed")})},I=s?on.find(b=>b.canHandle(s))??null:null,O=!!(s&&s.kind==="file"&&f&&M>=0&&f.files.length>1),k=[];O&&f&&k.push({label:`Folder: ${f.dirTitle}`,icon:a.jsx(Gt,{size:12}),onClick:()=>t(f.dirPath),title:`Back to ${f.dirTitle} (Backspace)`}),k.push({label:"Open in Code",icon:a.jsx(Lt,{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"}),k.push({label:"Show in folder",icon:a.jsx(Tt,{size:12}),onClick:w,title:"Show this file in its operating system folder",hideLabel:!0});const j=s?ln(s):[];O&&j.unshift(`${M+1} / ${f.files.length}`);const R=s&&I?I.render({resource:s,openFilePreview:t}):null;return a.jsx(At,{open:!0,kind:cn(s),document:null,title:s?.title??e.split("/").pop()??"File",eyebrow:"File preview",subtitle:s?.realPath??e,meta:j,state:u?"Loading…":null,error:c,body:R?a.jsxs("div",{className:`s-file-preview-shell${O?" s-file-preview-shell-nav":""}`,children:[O&&a.jsx("button",{type:"button",className:"s-file-preview-side-nav s-file-preview-side-nav-left",onClick:()=>v&&t(v),disabled:!v,"aria-label":"Previous file",title:"Previous file (←)",children:a.jsx(Ot,{size:18,strokeWidth:1.8,"aria-hidden":"true"})}),a.jsx("div",{className:"s-file-preview-shell-body",children:R}),O&&a.jsx("button",{type:"button",className:"s-file-preview-side-nav s-file-preview-side-nav-right",onClick:()=>h&&t(h),disabled:!h,"aria-label":"Next file",title:"Next file (→)",children:a.jsx(_t,{size:18,strokeWidth:1.8,"aria-hidden":"true"})})]}):null,actions:k,onClose:r})}function an(e,t,n){if(e.kind==="directory"){const s=e.entries.filter(i=>i.kind==="file");n({dirPath:e.path,dirTitle:e.title,files:s});return}if(!t){n(null);return}t.files.some(s=>s.realPath===e.realPath)||n(null)}function cn(e){return!e||e.kind==="directory"||e.mediaType==="text/markdown"||e.mediaType==="text/plain"?"doc":"code"}function ln(e){return e.kind==="directory"?[`${e.entries.length} ${e.entries.length===1?"entry":"entries"}`]:[...e.previewable&&e.truncated?["truncated"]:[],un(e.sizeBytes),e.mediaType]}function un(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}},Q=()=>{},Ye={focusScoutbot:Q,triggerBrief:Q,triggerAskState:Q,toggleVoiceReplies:Q,openScoutbotSettings:Q,startNewChat:Q,dismissReminder:Q,askReminderStatus:Q},Ee=o.createContext(null);function dn({children:e}){const[t,n]=o.useState(Qe),r=o.useRef(Ye),s=o.useCallback(u=>{n(d=>fn(d,u)?d:u)},[]),i=o.useCallback(u=>{r.current=u},[]),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:u=>r.current.dismissReminder(u),askReminderStatus:u=>r.current.askReminderStatus(u)}),[]),p=o.useMemo(()=>({state:t,actions:c,publishState:s,registerActions:i}),[t,c,s,i]);return a.jsx(Ee.Provider,{value:p,children:e})}function Ar(){const e=o.useContext(Ee);return e?{state:e.state,actions:e.actions}:{state:Qe,actions:Ye}}function Rr(){const e=o.useContext(Ee);return e?{publishState:e.publishState,registerActions:e.registerActions}:null}function fn(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&&pn(e.reminders.due,t.reminders.due)&&Xe(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 pn(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!Xe(e[n],t[n]))return!1;return!0}function Xe(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 hn="/api/voice/realtime/call",Ze="/api/voice/realtime/lease",et="/api/voice/realtime/settings",mn="x-openscout-realtime-voice-lease",tt="surface.realtime-voice",Ir="scout:realtime-voice-stop",Ce="scout:realtime-voice-settings",vn={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}},gn={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}},wn="/api/scoutbot/chat",nt="openscout.realtime-voice-settings";function rt(e){return q(et,{signal:e,cache:"no-store"})}function Nr(e){return q(et,{method:"PUT",body:JSON.stringify({enabled:e})})}function Lr(e){if(window.dispatchEvent(new CustomEvent(Ce,{detail:e})),!("BroadcastChannel"in window))return;const t=new BroadcastChannel(nt);t.postMessage(e),t.close()}function bn(e){const t=r=>{const s=r.detail;Fe(s)&&e(s)};window.addEventListener(Ce,t);const n="BroadcastChannel"in window?new BroadcastChannel(nt):null;return n&&(n.onmessage=r=>{Fe(r.data)&&e(r.data)}),()=>{window.removeEventListener(Ce,t),n?.close()}}function Fe(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.enabled=="boolean"&&typeof t.configuredEnabled=="boolean"&&(t.source==="settings"||t.source==="environment")&&typeof t.locked=="boolean"}const yn=25e3;async function Sn(e={}){if(ee(e.signal),!globalThis.RTCPeerConnection||!navigator.mediaDevices?.getUserMedia)throw new Error("This browser does not support realtime audio calls.");if(!(await rt(e.signal)).enabled)throw new Error("Live voice is off. Turn it on in Settings → Voice before starting a call.");ee(e.signal),e.onState?.("connecting");const n=new RTCPeerConnection,r=new Audio;r.autoplay=!0;let s=!1,i=null,c=null,p=null,u=0,d=0;const f=(h,w,I="voice")=>{d+=1,e.onTrace?.({id:`voice-${d}`,at:Date.now(),kind:I,label:h,...w?{detail:w}:{}})};let P=null;const D=()=>{if(P)return P;s=!0,e.signal?.removeEventListener("abort",v),p&&clearInterval(p),p=null,i?.getTracks().forEach(w=>w.stop()),r.pause(),r.srcObject=null,n.close();const h=c;return c=null,P=(async()=>{h&&await On(h),e.onState?.("ended")})(),P},M=()=>{D().catch(h=>{e.onError?.(h instanceof Error?h.message:"Could not release the realtime voice lease."),e.onState?.("error")})},v=()=>{M()};e.signal?.addEventListener("abort",v,{once:!0}),n.ontrack=({streams:h})=>{const w=h[0];if(!w||s)return;const[I]=w.getAudioTracks();I&&I.addEventListener("ended",()=>{s||e.onError?.("Realtime voice audio ended unexpectedly.")}),r.srcObject=w,r.play().catch(()=>{e.onError?.("Browser playback was blocked. Interact with the page, then start the call again.")})},n.onconnectionstatechange=()=>{s||(n.connectionState==="connected"?(e.onState?.("live"),f("Realtime channel connected","Scoutbot bridge is ready")):(n.connectionState==="failed"||n.connectionState==="disconnected")&&(e.onError?.("Realtime voice connection ended unexpectedly."),M()))};try{i=await Nn(e.inputDeviceName,e.signal),ee(e.signal);for(const x of i.getTracks())n.addTrack(x,i);const h=n.createDataChannel("oai-events"),w=new Set;let I=Promise.resolve(),O=!1,k=null;const j=[],R=x=>{if(s||h.readyState!=="open")return!1;try{return h.send(JSON.stringify(x)),!0}catch{return e.onError?.("Realtime voice events channel closed unexpectedly."),!1}},b=()=>{if(O||k||j.length===0)return;const x=j.shift();if(x){if(k=x,!R({type:"response.create",response:{instructions:x}})){k=null,j.unshift(x);return}O=!0}},y=x=>{j.push(x),b()};h.addEventListener("open",()=>{if(s)return;const x=In(e.inputDeviceName);if(!R({type:"session.update",session:{type:"realtime",audio:{input:x}}})){e.onError?.("Could not configure Scout's realtime microphone processing.");return}f("Scoutbot bridge ready","Live fleet context is available"),y("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?'")}),h.addEventListener("error",()=>{s||e.onError?.("Realtime voice events channel closed unexpectedly.")}),h.addEventListener("message",x=>{const C=En(x.data);if(C?.type==="error"){if(ot(C.message)){k&&(j.unshift(k),k=null),O=!0,f("Scoutbot reply queued","Waiting for the current spoken response to finish","scoutbot");return}e.onError?.(C.message??"OpenAI Realtime reported an error.");return}if(C?.type==="response.created"){O=!0,k=null;return}if(C?.type==="response.done"){O=!1,k=null;for(const H of kn(C))H.name!=="ask_scoutbot"||w.has(H.callId)||(w.add(H.callId),I=I.then(()=>Cn({functionCall:H,route:e.getRoute?.()??e.route,uiContext:e.getUiContext?.(),onReply:e.onScoutbotReply,onTrace:f,send:R,requestResponse:y})).catch(J=>{e.onError?.(J instanceof Error?J.message:"Scoutbot could not complete the voice request.")}));b()}});const g=await ge(n.createOffer(),e.signal);if(await ge(n.setLocalDescription(g),e.signal),!g.sdp)throw new Error("Could not create a WebRTC offer.");const T=await fetch(hn,{method:"POST",headers:{"content-type":"application/sdp"},body:g.sdp,signal:e.signal});c=T.headers.get(mn)?.trim()||null;const L=await ge(T.text(),e.signal);if(!T.ok)throw new Error(An(L,T.status));if(!c)throw new Error("Scout started the audio connection without a concurrency lease. Please try again.");return p=setInterval(()=>{if(!c||s)return;const x=c;Ln(x).then(C=>{if(!(s||x!==c)){if(C){u=0;return}e.onError?.("Realtime voice lost its server lease. Reconnect to continue safely."),M()}}).catch(()=>{u+=1,!(u<2||s)&&(e.onError?.("Realtime voice could not renew its server lease. Check the connection and try again."),M())})},yn),await ge(n.setRemoteDescription({type:"answer",sdp:L}),e.signal),ee(e.signal),{leaseId:c,stop:D}}catch(h){throw await D(),h}}async function Cn(e){const t=xn(e.functionCall.arguments);if(!t){e.onTrace("Scoutbot request could not be read",void 0,"error"),be(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(wn,{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(Tn(r,n.status));const s=JSON.parse(r),i=typeof s.reply?.body=="string"?s.reply.body.trim():"";if(!i)throw new Error("Scoutbot returned an empty reply.");const c=Je(i).filter(d=>d.type==="ask-agent").length,p=e.onReply?await e.onReply(i):{agentRequests:{requested:c,sent:0,failed:c}},u=St(i);e.onTrace("Scoutbot reply ready",void 0,"scoutbot"),be(e,{ok:!0,reply:u,...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"),be(e,{ok:!1,error:r})}}function be(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 ot(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 En(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 kn(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 xn(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 Tn(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 An(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 ge(e,t){return t?(ee(t),new Promise((n,r)=>{const s=()=>r(ke(t));t.addEventListener("abort",s,{once:!0}),e.then(i=>{t.removeEventListener("abort",s),n(i)},i=>{t.removeEventListener("abort",s),r(i)})})):e}async function Be(e,t){return t?(ee(t),new Promise((n,r)=>{let s=!1;const i=()=>{s=!0,r(ke(t))};t.addEventListener("abort",i,{once:!0}),e.then(c=>{if(t.removeEventListener("abort",i),s||t.aborted){c.getTracks().forEach(p=>p.stop());return}n(c)},c=>{t.removeEventListener("abort",i),s||r(c)})})):e}const Ue={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1},Rn=/\b(?:airpods?|earbuds?|earphones?|headsets?|headphones?|buds?|hands[- ]?free)\b/iu;function In(e){return Rn.test(e?.trim()??"")?gn:vn}async function Nn(e,t){const n=await Ve(e);let r=await Be(navigator.mediaDevices.getUserMedia({audio:{...Ue,...n?{deviceId:{exact:n.deviceId}}:{}}}),t);if(!n&&e?.trim()){const s=await Ve(e),i=r.getAudioTracks?.()[0]?.label?.trim().toLocaleLowerCase()??"";if(s&&s.label.trim().toLocaleLowerCase()!==i)try{const c=await Be(navigator.mediaDevices.getUserMedia({audio:{...Ue,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 Ve(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 ee(e){if(e?.aborted)throw ke(e)}function ke(e){return e.reason instanceof Error?e.reason:new DOMException("Realtime voice connection was cancelled.","AbortError")}async function Ln(e){return(await fetch(`${Ze}/${encodeURIComponent(e)}`,{method:"PUT"})).ok}async function On(e){const t=await fetch(`${Ze}/${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 _n=[{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"}}],jn=[{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 Dn(e){const t=e==="macos";return{host:e,shellLabel:t?"Scout for macOS":"OpenScout web",destinations:t?jn:_n,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 Pn="scout:scoutbot-realtime-reply",we="scout:scoutbot-session-changed",Mn={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:()=>{}},st=o.createContext(Mn);function Fn({children:e}){const{route:t,applyScoutbotUiAction:n}=at(),r=$e(tt,!0),[s,i]=o.useState(!1),c=r&&s,[p,u]=o.useState(!1),[d,f]=o.useState("idle"),[P,D]=o.useState(null),[M,v]=o.useState(null),[h,w]=o.useState([]),[I,O]=o.useState(null),[k,j]=o.useState(null),R=o.useRef(null),b=o.useRef(null),y=o.useRef(null),g=o.useRef(0),T=o.useRef(!1),L=o.useRef(!1),x=o.useRef({route:t,applyScoutbotUiAction:n});x.current={route:t,applyScoutbotUiAction:n};const C=o.useCallback((m,S,A="voice")=>{w(N=>[...N,{id:`voice-ui-${Date.now()}-${N.length}`,at:Date.now(),kind:A,label:m,...S?{detail:S}:{}}].slice(-100))},[]),H=o.useCallback(()=>w([]),[]),J=o.useCallback(async()=>{const m=await q("/api/scoutbot/session");return T.current||O(m),m},[]);o.useEffect(()=>{if(!r){i(!1);return}const m=new AbortController;let S=!1;const A=bn(N=>{i(N.enabled)});return rt(m.signal).then(N=>{S||i(N.enabled)}).catch(N=>{S||qe(N)||(i(!1),v(N instanceof Error?N.message:"Could not load live voice settings."))}),()=>{S=!0,m.abort(),A()}},[r]),o.useEffect(()=>{if(!c)return;const m=()=>{J().catch(S=>{T.current||v(S instanceof Error?S.message:"Could not load Scoutbot chats.")})};return m(),window.addEventListener(we,m),()=>window.removeEventListener(we,m)},[c,J]);const $=o.useCallback(async()=>{g.current+=1;const m=y.current;b.current?.abort(),b.current=null;const S=R.current;R.current=null;try{await S?.stop(),await m}catch(A){return T.current||(f("error"),v(A instanceof Error?A.message:"Could not end realtime voice cleanly.")),!1}return T.current||(D(null),f("ended"),C("Live voice ended","Microphone and host lease released","voice")),!0},[C]);o.useEffect(()=>{c||(u(!1),(R.current||d==="connecting"||d==="live")&&$())},[c,$,d]),o.useEffect(()=>(T.current=!1,()=>{T.current=!0,g.current+=1,b.current?.abort(),b.current=null,R.current?.stop().catch(()=>{}),R.current=null}),[]);const te=o.useCallback(async m=>{window.dispatchEvent(new CustomEvent(Pn,{detail:{body:m}}));const S=m.replace(/```[\s\S]*?```/gu,"").trim();S&&C("Scoutbot replied",S.slice(0,2e3),"scoutbot");let A=0,N=0,W=0;for(const B of Je(m))if(B.type==="ask-agent")A+=1,await Vn(B,C,v)?N+=1:W+=1;else if(B.type!=="reminder"){const _=Un(B),U=B.type==="navigate"||B.type==="view-file"?"navigation":"scoutbot";C(Bn(B),_,U),x.current.applyScoutbotUiAction(B),C(De()?"Action sent to Scout for macOS":"Action applied in OpenScout",_,U)}return await J().catch(()=>null),{agentRequests:{requested:A,sent:N,failed:W}}},[C,J]),ne=o.useCallback(()=>{const m={type:"navigate",route:{view:"settings",section:"voice"}};C("Voice settings requested",void 0,"navigation"),x.current.applyScoutbotUiAction(m)},[C]),re=o.useCallback(async()=>{if(!c){v("Turn on live voice in Settings → Voice before starting a call."),u(!1);return}if(L.current||d==="connecting"||d==="live")return;L.current=!0,b.current?.abort();const m=R.current;R.current=null;try{await m?.stop(),D(null)}catch(_){f("error"),v(_ instanceof Error?_.message:"Could not end the previous realtime voice call."),L.current=!1;return}const S=new AbortController;b.current=S;const A=g.current+1;g.current=A;let N=()=>{};const W=new Promise(_=>{N=_});y.current=W;let B=!1;v(null),w([{id:"connecting",at:Date.now(),label:"Connecting secure audio"}]),f("connecting");try{const _=await jt().then(({settings:V})=>V.inputDeviceName).catch(()=>null),U=await Sn({signal:S.signal,inputDeviceName:_,getRoute:()=>x.current.route,getUiContext:()=>Dn(De()?"macos":"web"),onState:V=>{!T.current&&g.current===A&&f(V)},onError:V=>{if(!(T.current||g.current!==A)){if(ot(V)){C("Scoutbot reply queued","Waiting for the current spoken response to finish","scoutbot");return}v(V),C("Voice issue",V,"error")}},onTrace:V=>{!T.current&&g.current===A&&w(ue=>[...ue,V].slice(-100))},onScoutbotReply:V=>!T.current&&g.current===A?te(V):{agentRequests:{requested:0,sent:0,failed:0}}});if(T.current||S.signal.aborted||g.current!==A){await U.stop();return}R.current=U,D(U.leaseId),B=!0}catch(_){if(!T.current&&g.current===A&&!qe(_)){f("error");const U=_ instanceof Error?_.message:"Could not start realtime voice.";v(U),C("Live voice could not start",U,"error")}}finally{!B&&b.current===S&&(b.current=null),N(),y.current===W&&(y.current=null),L.current=!1}},[C,te,c,d]),oe=o.useCallback(async()=>{if(!k){j("new"),v(null);try{if((R.current||d==="connecting"||d==="live")&&!await $())return;if(I?.session.messages.length===0){w([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"New live chat ready"}]);return}const m=await q("/api/scoutbot/session/reset",{method:"POST"});O(m),w([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"New live chat ready"}]),window.dispatchEvent(new CustomEvent(we,{detail:{id:m.session.id}}))}catch(m){const S=m instanceof Error?m.message:"Could not start a new Scoutbot chat.";v(S),C("Could not start a new live chat",S,"error")}finally{j(null)}}},[C,I?.session.messages.length,$,k,d]),se=o.useCallback(async m=>{if(!(!m||k||m===I?.session.id)){j(m),v(null);try{if((R.current||d==="connecting"||d==="live")&&!await $())return;const S=await q("/api/scoutbot/session/switch",{method:"POST",body:JSON.stringify({id:m})});O(S),w([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"Live chat restored",detail:S.session.title}]),window.dispatchEvent(new CustomEvent(we,{detail:{id:S.session.id}}))}catch(S){const A=S instanceof Error?S.message:"Could not switch Scoutbot chats.";v(A),C("Could not restore the live chat",A,"error")}finally{j(null)}}},[C,I?.session.id,$,k,d]),ie=o.useCallback(async m=>{const S=m.trim();if(!S)throw new Error("Preferred model is required.");const A=await q("/api/scoutbot/config",{method:"POST",body:JSON.stringify({model:S})});return O(N=>N&&{...N,config:{...N.config,...A.config}}),C("Scoutbot preferred model updated",A.config.model,"scoutbot"),A.config.model},[C]),ae=o.useMemo(()=>({enabled:c,open:p,state:d,leaseId:P,error:M,trace:h,chatState:I,sessionAction:k,setOpen:u,startCall:re,endCall:$,startNewChat:oe,switchChat:se,updatePreferredModel:ie,clearTrace:H,openVoiceSettings:ne}),[c,p,d,P,M,h,I,k,re,$,oe,se,ie,H,ne]);return a.jsx(st.Provider,{value:ae,children:e})}function qe(e){return(e instanceof DOMException||e instanceof Error)&&e.name==="AbortError"}function Or(){return o.useContext(st)}function Bn(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 Un(e){return e.type==="navigate"?JSON.stringify(e.route):e.type==="view-file"?e.path:e.reason?.trim()||e.type}async function Vn(e,t,n){t("Scoutbot is coordinating",`Asking ${e.targetLabel}`,"agent");try{const r=await q("/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 ye(e,t){const n=t?.trim();n&&e.add(n)}function qn(e,t){const n=new Set;return ye(n,e.authorityNodeId),ye(n,e.homeNodeId),n.size===0&&ye(n,t),n}function it(e,t,n){return t?qn(e,n).has(t):!0}function Hn(e,t,n){return t?e.filter(r=>it(r,t,n)):e}function _r(e,t,n){return t?new Set(e.filter(r=>it(r,t,n)).map(r=>r.id)):null}function Y(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 $n(e,t,n){return Y(e,t,n)}function jr(e,t,n){return!t&&!n?e:e.filter(r=>$n(r,t,n))}function Jn(e,t){return Y(e,t)}function Kn(e,t){return t?e.filter(n=>Jn(n,t)):e}function He(e,t){return Y(e,t)}function Dr(e,t){if(!e||!t)return e;const n=e.activeAsks.filter(c=>Y(c,t)),r=e.recentCompleted.filter(c=>Y(c,t)),s=e.needsAttention.filter(c=>Y(c,t)),i=Kn(e.activity,t);return{...e,totals:{active:n.length,recentCompleted:r.length,needsAttention:s.length,activity:i.length},activeAsks:n,recentCompleted:r,needsAttention:s,activity:i}}function Pr(e,t){if(!t)return e;const n=e.activeFlights.filter(i=>Y(i,t)),r=e.childWork.filter(i=>He(i,t));return He(e,t)||n.length>0||r.length>0?{...e,activeFlights:n,childWork:r}:null}function Gn(e){return!!(e&&(e.message.trim().length>0||e.files.length>0||e.forwardContext))}function Wn(e){return[e.name,e.type,e.size,e.lastModified].join(":")}function zn(e,t){const n=new Set;return[...e,...t].filter(r=>{const s=Wn(r);return n.has(s)?!1:(n.add(s),!0)})}function Qn(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:zn(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 Yn({request:e,onClose:t,onOpenCapture:n}){const{agents:r,route:s,navigate:i}=at(),c=vt(s),p=Hn(r,c),u=Pt(s,p),[d,f]=o.useState(0),[P,D]=o.useState(null),[M,v]=o.useState(null),h=o.useRef(0),w=e?Qn(M,e):null,I=o.useCallback((k,j)=>{if(k.length===0)return;const R=!!(u.agentId||u.conversationId);n({intent:R?"route-capture":"new-task",files:k,attachmentFeedback:j,agentId:u.agentId??void 0,conversationId:u.conversationId??void 0,preferExistingChat:u.canUseExistingChat})},[n,u]);o.useEffect(()=>{if(!P)return;const k=window.setTimeout(()=>D(null),5e3);return()=>window.clearTimeout(k)},[P]),o.useEffect(()=>{const k=g=>{ve(g.dataTransfer)&&(g.preventDefault(),h.current+=1,f(h.current))},j=g=>{ve(g.dataTransfer)&&(g.preventDefault(),g.dataTransfer&&(g.dataTransfer.dropEffect="copy"))},R=()=>{h.current!==0&&(h.current=Math.max(0,h.current-1),f(h.current))},b=g=>{if(!ve(g.dataTransfer))return;g.preventDefault();const T=Pe(g.dataTransfer),L=T.filter(Me),x=T.length-L.length;if(h.current=0,f(0),L.length===0){D(T.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 C=L.length===1?`Dropped ${L[0]?.name||"1 attachment"}.`:`Dropped ${L.length} attachments.`,H=x>0?`${C} Skipped ${x} unsupported ${x===1?"file":"files"}.`:C;D(null),I(L,H)},y=g=>{if(Dt(g.target)||!ve(g.clipboardData))return;g.preventDefault();const T=Pe(g.clipboardData),L=T.filter(Me);if(L.length===0){D(T.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}I(L,L.length===1?`Pasted ${L[0]?.name||"1 attachment"}.`:`Pasted ${L.length} attachments.`)};return window.addEventListener("dragenter",k),window.addEventListener("dragover",j),window.addEventListener("dragleave",R),window.addEventListener("drop",b),window.addEventListener("paste",y),()=>{window.removeEventListener("dragenter",k),window.removeEventListener("dragover",j),window.removeEventListener("dragleave",R),window.removeEventListener("drop",b),window.removeEventListener("paste",y)}},[I]);const O=d>0&&!e;return a.jsxs(a.Fragment,{children:[O?a.jsx("div",{className:"s-capture-drop",role:"presentation",children:a.jsxs("div",{className:"s-capture-drop-card",children:[a.jsx("div",{className:"s-capture-drop-title",children:"Route capture"}),a.jsx("div",{className:"s-capture-drop-copy",children:"Drop markdown, code, an image, or a video clip to send it to the right agent or chat."})]})}):null,P?a.jsx("div",{className:"s-capture-feedback",role:"alert",children:P}):null,e?a.jsx(Mt,{agents:p,route:s,navigate:i,onClose:t,initialAgentId:w?.agentId,initialConversationId:w?.conversationId,initialMessage:w?.message,initialFiles:w?.files,initialAttachmentFeedback:w?.attachmentFeedback??void 0,initialIntent:w?.intent,initialProjectPath:w?.projectPath,initialProjectQuery:w?.projectQuery,initialForwardContext:w?.forwardContext,initialForwardContextMode:w?.forwardContextMode,defaultMode:w?.mode,draftRestored:Gn(M),onDraftChange:v,onDraftConsumed:()=>v(null)}):null]})}const xe=o.createContext(null),Xn=["hello","node.upserted","actor.registered","agent.registered","agent.endpoint.upserted","invocation.requested","flight.updated","delivery.state.changed","scout.dispatched"],Zn=new Set(Xn),er=3e4,tr=250;function nr(e,t){try{return JSON.stringify(e)===JSON.stringify(t)?e:t}catch{return t}}const rr={"--hud-bg":"oklch(0.118 0.004 260)","--hud-surface":"oklch(0.205 0.005 260)","--hud-ink":"oklch(0.975 0.006 260)","--hud-muted":"oklch(0.80 0.008 260)","--hud-dim":"oklch(0.70 0.007 260)","--hud-border":"oklch(0.975 0.006 260 / 0.08)","--hud-accent":"oklch(0.86 0.17 125)","--hud-accent-soft":"oklch(0.86 0.17 125 / 0.08)","--hud-shadow-soft":"oklch(0.08 0.004 260 / 0.42)","--hud-chrome-border":"oklch(0.975 0.006 260 / 0.04)","--hud-shadow-panel":"0 12px 34px oklch(0.08 0.004 260 / 0.45)","--hud-shadow-panel-hover":"0 14px 38px oklch(0.08 0.004 260 / 0.52)","--hud-shadow-bar":"0 -10px 28px oklch(0.08 0.004 260 / 0.38)","--hud-shadow-nav":"0 8px 24px oklch(0.08 0.004 260 / 0.32)","--hud-shadow-minimap":"0 10px 24px oklch(0.08 0.004 260 / 0.38)","--hud-status-ok":"oklch(0.80 0.15 155)","--hud-status-warn":"oklch(0.82 0.15 85)","--hud-status-error":"oklch(0.72 0.18 25)","--background":"0.132 0.004 260","--foreground":"0.965 0.006 260","--card":"0.178 0.005 260","--card-foreground":"0.965 0.006 260","--popover":"0.178 0.005 260","--popover-foreground":"0.965 0.006 260","--muted-foreground":"0.72 0.008 260","--scrim":"rgba(0, 0, 0, 0.5)","--scrim-soft":"rgba(0, 0, 0, 0.3)","--info":"#62b6ff","--shadow-card":"0 8px 22px rgba(0, 0, 0, 0.22)","--shadow-card-hover":"0 14px 36px rgba(0, 0, 0, 0.30)","--cat-gold":"#d7a978","--cat-purple":"#c58cff","--cat-sky":"#38bdf8","--scout-chrome-ink-strong":"color-mix(in srgb, var(--hud-ink) 94%, transparent)","--scout-chrome-ink":"color-mix(in srgb, var(--hud-ink) 84%, transparent)","--scout-chrome-ink-soft":"color-mix(in srgb, var(--hud-ink) 68%, transparent)","--scout-chrome-ink-faint":"color-mix(in srgb, var(--hud-ink) 64%, transparent)","--scout-chrome-ink-ghost":"color-mix(in srgb, var(--hud-ink) 56%, transparent)","--scout-chrome-hover":"color-mix(in srgb, var(--hud-ink) 5%, transparent)","--scout-chrome-active":"color-mix(in srgb, var(--hud-ink) 9%, transparent)","--scout-chrome-border-soft":"color-mix(in srgb, var(--hud-ink) 8%, transparent)","--scout-chrome-avatar-ink":"#111111","--hud-font-sans":"'Inter', ui-sans-serif, system-ui, sans-serif","--hud-font-mono":"'JetBrains Mono', ui-monospace, Menlo, monospace","--hud-font-serif":"'Spectral', 'Cormorant Garamond', Georgia, serif","--hud-font-accent-title":"'Inter Tight', var(--hud-font-sans)"},or={"--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)"},sr=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 ir(e){return Object.fromEntries(Object.entries(e==="light"?or:rr).filter(([n])=>!sr.has(n)))}function Mr(){return o.useContext(xe)}function at(){const e=o.useContext(xe);if(!e)throw new Error("useScout must be used inside ScoutProvider");return e}function Fr({children:e,initialTheme:t="dark"}){const{route:n,navigate:r,navigateBack:s,canNavigateBack:i}=gt(),c=Ft(),p=$e(tt,!0),[u,d]=o.useState([]),[f,P]=o.useState(!1),[D,M]=o.useState({status:"checking",message:null,lastCheckedAt:null}),[v,h]=o.useState(_e),[w,I]=o.useState(null),O=o.useRef(!1),[k,j]=o.useState($t),[R,b]=o.useState(!1),[y,g]=o.useState(null),[T,L]=o.useState(null),[x,C]=o.useState(""),[H,J]=o.useState(null),$=n.view==="settings",te=o.useMemo(()=>n.view!=="broker"||!n.attemptId?null:y?.id===n.attemptId?y:null,[y,n]),ne=o.useMemo(()=>n.view!=="search"||!n.hitId?null:T?.id===n.hitId?T:null,[T,n]),re=o.useMemo(()=>n.view==="agents-v2"&&n.agentId&&n.sessionId?{agentId:n.agentId,sessionId:n.sessionId}:n.view==="sessions"&&n.sessionId?{agentId:n.agentId??"",sessionId:n.sessionId}:null,[n]),oe=o.useCallback((l,E)=>{if(n.view==="agents-v2"&&n.agentId===l){r({...n,sessionId:E},{replace:!0});return}if(n.view==="sessions"){r({view:"sessions",sessionId:E,agentId:l},{replace:!0});return}r({view:"agents-v2",agentId:l,sessionId:E},{replace:!0})},[r,n]),se=o.useCallback(()=>{r({view:"settings",section:"appearance"})},[r]),ie=o.useCallback(()=>{n.view==="settings"&&r({view:"inbox"})},[r,n.view]),ae=o.useCallback(l=>{J(l??{intent:"new-task"})},[]),m=o.useCallback(()=>J(null),[]),S=o.useCallback(l=>{g(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]),A=o.useCallback(()=>{g(null),n.view==="broker"&&n.attemptId&&r({view:"broker",...n.filter?{filter:n.filter}:{}},{replace:!0})},[r,n]),N=o.useCallback((l,E,F)=>{if(L(l),typeof E=="string"&&C(E.trim()),n.view==="search"&&n.hitId===l.id)return;const K=F??(n.view==="search"?n.filters:void 0);r({view:"search",...n.view==="search"&&n.mode?{mode:n.mode}:{},...K?{filters:K}:{},hitId:l.id},{replace:n.view==="search"})},[r,n]),W=o.useCallback(()=>{L(null),C(""),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(()=>dt(),[]),_=c?.resolvedTheme??t,U=c?.template??"hudson",V=o.useMemo(()=>({...ir(_),...B??{}}),[B,_]),ue=o.useCallback(l=>{h(E=>({...E,...l}))},[]);o.useEffect(()=>{!f||u.length===0||h(l=>{const E=ft(l.agentCharacters,u);return E===l.agentCharacters?l:{...l,agentCharacters:E}})},[u,f]),o.useEffect(()=>{pt(_,U,v),ht(v)},[U,v,_]),o.useEffect(()=>{const l=E=>{E.key!==null&&E.key!==mt||h(_e())};return window.addEventListener("storage",l),()=>window.removeEventListener("storage",l)},[]);const Te=o.useMemo(()=>Ct(u),[u]),Ae=Te?.id??Et(u),Re=Te?.conversationId??null,de=o.useRef(null),X=o.useRef(null),fe=n.view==="ops"?"/api/agents":"/api/agents?detail=summary",pe=o.useCallback(()=>{M({status:"online",message:null,lastCheckedAt:Date.now()})},[]),he=o.useCallback(l=>{const E=Ut(l);M({status:Vt(E)?"offline":"degraded",message:E,lastCheckedAt:Date.now()})},[]),G=o.useCallback(async()=>{const l=de.current;if(l&&(await l.promise,l.url===fe))return;const E=(async()=>{try{const F=await q(fe);d(K=>nr(K,F)),pe()}catch(F){he(F)}finally{P(!0)}})();de.current={url:fe,promise:E};try{await E}finally{de.current?.promise===E&&(de.current=null)}},[fe,he,pe]),z=o.useCallback(async()=>{try{const l=await q("/api/onboarding/state");O.current=!1,I(l);const E=l.operatorName?.trim()||l.operatorNameSuggestion?.trim()||null;j(E),Jt(E),pe()}catch(l){he(l),O.current=!0,I({hasLocalConfig:!0,hasProjectConfig:!0,hasOperatorName:!0,localConfigPath:null,projectRoot:null,currentDirectory:null,operatorName:null,operatorNameSuggestion:null,needed:!1})}},[he,pe]),Ie=o.useCallback(()=>{b(!0),q("/api/onboarding/skip",{method:"POST",body:"{}"}).then(()=>z()).catch(()=>null)},[z]);o.useEffect(()=>{G(),z()},[G,z]),o.useEffect(()=>{const l=()=>{je()&&(G(),O.current&&z())},E=window.setInterval(l,er),F=bt(l);return()=>{window.clearInterval(E),F()}},[G,z]);const Ne=o.useMemo(()=>u.filter(l=>yt(l.state)).length,[u]),[ct,Le]=o.useState(null),ce=o.useCallback(l=>{l?.trim()&&Le(l.trim())},[]),le=o.useCallback(()=>Le(null),[]),Z=o.useCallback(l=>{if(!kt(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":G();break;case"view-file":ce(l.path);break}},[r,ce,G]),lt=o.useCallback((l,E)=>{const F=l.trim(),K=E.trim();if(!F||!K)return;const Oe=n.view==="conversation"||n.view==="messages"?n.conversationId:window.location.pathname==="/embed/thread"&&new URLSearchParams(window.location.search).get("conversationId")?.trim()||void 0;le(),Z({type:"navigate",route:{view:"code",root:K,file:F,...Oe?{returnConversationId:Oe}:{}}})},[Z,le,n]),me=o.useRef({applyScoutbotUiAction:Z});me.current={applyScoutbotUiAction:Z},wt(l=>{je()&&Zn.has(l.kind)&&(X.current!==null&&window.clearTimeout(X.current),X.current=window.setTimeout(()=>{X.current=null,G()},tr))}),o.useEffect(()=>()=>{X.current!==null&&window.clearTimeout(X.current)},[]),o.useEffect(()=>{const l=E=>{const F=E.detail,K=F&&typeof F=="object"&&"type"in F?F:null;K&&me.current.applyScoutbotUiAction(K)};return window.addEventListener("scout:scoutbot-ui-action",l),window.scoutScoutbot={applyUiAction:E=>me.current.applyScoutbotUiAction(E),navigate:E=>me.current.applyScoutbotUiAction({type:"navigate",route:E})},()=>{window.removeEventListener("scout:scoutbot-ui-action",l),window.scoutScoutbot?.applyUiAction&&delete window.scoutScoutbot}},[]);const ut=o.useMemo(()=>({route:n,navigate:r,navigateBack:s,canNavigateBack:i,agents:u,agentsLoaded:f,onlineCount:Ne,apiConnection:D,reload:G,appearanceDetails:v,updateAppearanceDetails:ue,onboarding:w,operatorName:k,refreshOnboarding:z,onboardingSkipped:R,skipOnboarding:Ie,settingsOpen:$,openSettings:se,closeSettings:ie,scoutbotAgentId:Ae,scoutbotConversationId:Re,applyScoutbotUiAction:Z,selectedBrokerAttempt:te,inspectBrokerAttempt:S,clearBrokerAttempt:A,selectedKnowledgeHit:ne,selectedKnowledgeQuery:x,inspectKnowledgeHit:N,clearKnowledgeHit:W,focusedSession:re,focusSession:oe,openFilePreview:ce,closeFilePreview:le,openContextCapture:ae,closeContextCapture:m}),[n,r,s,i,u,f,Ne,D,G,v,ue,w,k,z,R,Ie,$,se,ie,Ae,Re,Z,te,S,A,ne,x,N,W,re,oe,ce,le,ae,m]);return a.jsx(xe.Provider,{value:ut,children:a.jsx("div",{"data-scout-theme-mode":_,"data-scout-palette":v.palette,"data-scout-contrast":v.contrast,"data-scout-accent":v.accent,"data-scout-shell":v.shell,"data-scout-avatar-style":v.avatarStyle,"data-hudson-theme":_,"data-hudson-template":U,style:{...V},children:a.jsx("div",{"data-scout-theme":_,style:{display:"contents"},children:a.jsx(Bt,{children:a.jsxs(dn,{children:[p?a.jsx(Fn,{children:e}):e,a.jsx(sn,{path:ct,onOpenPath:ce,onOpenInCode:lt,onClose:le}),a.jsx(Yn,{request:H,onClose:m,onOpenCapture:ae})]})})})})})}export{Bt as C,rr as D,or as L,xe as S,Tr as a,Kn as b,Mr as c,Hn as d,jr as e,Ut as f,Dr as g,Fr as h,Vt as i,Pr as j,Gt as k,Rr as l,_r as m,tt as n,Or as o,we as p,Pn as q,Ir as r,Dn as s,Ar as t,at as u,rt as v,Nr as w,Lr as x};
1
+ import{r as o,j as a,a1 as _e,b as dt,y as ft,a2 as pt,a3 as ht,K as mt}from"./index-DvLtl7rV.js";import{h as $e,b as vt,au as gt}from"./router-B9vQkNJL.js";import{a as q}from"./api-Co9aQ2Jw.js";import{u as wt}from"./sse-CD9MMUxl.js";import{o as bt,i as je}from"./surface-activity-B1rgWB1i.js";import{i as yt}from"./colors-BtO5_zlx.js";import{e as Je,s as St,i as De,r as Ct,b as Et,f as kt}from"./scoutbot-BJIamJOH.js";import{F as xt,a as Tt,D as At}from"./DocumentFocusViewer-Do3wQ_3Z.js";import{c as Ke,T as Ge}from"./TextDocumentSurface-BflAwXeZ.js";import{C as Rt}from"./chevron-right-D-HdlPg8.js";import{F as It}from"./file-text-CqJgwxmv.js";import{c as Nt}from"./createLucideIcon-DezKXSG2.js";import{C as Lt}from"./code-xml-D7pOQM9l.js";import{A as Ot}from"./arrow-left-Czpf-AE4.js";import{A as _t}from"./arrow-right-BuzMnLYP.js";import{j as jt}from"./scout-voice-BVUqGhth.js";import{i as Dt}from"./keyboard-nav-BLYDhL3Z.js";import{J as Pt,N as Mt,l as ve,K as Pe,j as Me}from"./NewChatComposer-_Stj0fZy.js";import{u as Ft}from"./chunk-HRAB3GC3-Tyv9rzx7.js";const We={current:null,setMenu:null};function Tr(){return o.useCallback((e,t)=>{e.preventDefault(),e.stopPropagation(),We.setMenu?.({position:{x:e.clientX,y:e.clientY},items:t})},[])}function Bt({children:e}){const[t,n]=o.useState(null),r=o.useRef(null);We.setMenu=n;const s=o.useCallback(()=>{n(null)},[]);return o.useEffect(()=>{if(!t)return;const i=d=>{d.target instanceof Node&&r.current?.contains(d.target)||s()},c=d=>{d.key==="Escape"&&s()},p=()=>s(),u=d=>{d.defaultPrevented||s()};return window.addEventListener("mousedown",i,!0),window.addEventListener("keydown",c),window.addEventListener("wheel",p,!0),window.addEventListener("contextmenu",u),()=>{window.removeEventListener("mousedown",i,!0),window.removeEventListener("keydown",c),window.removeEventListener("wheel",p,!0),window.removeEventListener("contextmenu",u)}},[t,s]),o.useLayoutEffect(()=>{if(!t||!r.current)return;const i=r.current,c=i.getBoundingClientRect(),p=window.innerWidth,u=window.innerHeight;let d=t.position.x,f=t.position.y;d+c.width>p-8&&(d=p-c.width-8),f+c.height>u-8&&(f=u-c.height-8),d<8&&(d=8),f<8&&(f=8),i.style.left=`${d}px`,i.style.top=`${f}px`,i.style.visibility="visible"},[t]),a.jsxs(a.Fragment,{children:[e,t&&a.jsx("div",{ref:r,className:"s-context-menu",style:{left:t.position.x,top:t.position.y,visibility:"hidden"},role:"menu",onMouseDown:i=>i.stopPropagation(),children:t.items.map((i,c)=>i.kind==="separator"?a.jsx("div",{className:"s-context-menu-sep",role:"separator"},c):a.jsxs("button",{type:"button",className:"s-context-menu-item",role:"menuitem",onClick:()=>{i.onSelect(),s()},children:[a.jsx("span",{className:"s-context-menu-label",children:i.label}),i.shortcut&&a.jsx("span",{className:"s-context-menu-shortcut",children:i.shortcut})]},c))})]})}function Ut(e){const t=e instanceof Error?e.message:String(e);return qt(t)?"Scout server is unreachable":t}function Vt(e){return e==="Scout server is unreachable"}function qt(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 Se="openscout.operator.name",Ht=new Set(["operator","you","user","unknown","null","undefined"]);function ze(e){const t=e?.trim();return!t||t.length>64||Ht.has(t.toLowerCase())?null:t}function $t(){if(typeof window>"u")return null;try{return ze(window.localStorage.getItem(Se))}catch{return null}}function Jt(e){if(!(typeof window>"u"))try{const t=ze(e);t?window.localStorage.setItem(Se,t):window.localStorage.removeItem(Se)}catch{}}const Kt=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Gt=Nt("chevron-up",Kt),Wt={id:"audio",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("audio/"),render:({resource:e})=>{const t=e;return a.jsx("div",{className:"s-file-preview-media-wrap",children:a.jsx("div",{className:"s-file-preview-audio-stage",children:a.jsx("audio",{className:"s-file-preview-audio",src:t.rawUrl,controls:!0})})})}},zt={id:"binary",canHandle:()=>!0,render:({resource:e})=>{const t=e;return a.jsxs("div",{className:"s-file-preview-callout",children:[a.jsxs("div",{className:"s-file-preview-callout-title",children:[t.previewReason," — open in OS"]}),a.jsxs("div",{className:"s-file-preview-callout-copy",children:["Scout can resolve this file, but it does not have an inline preview for ",t.mediaType," yet."]})]})}},Qt=new Set(["text/typescript","text/javascript","text/css","text/html","application/json","text/yaml","text/toml","text/x-shellscript","text/plain"]),Yt={id:"code",canHandle:e=>e.kind==="file"&&e.previewable&&Qt.has(e.mediaType),render:({resource:e})=>{const t=e,n=Ke({id:t.realPath,title:t.title,uri:t.realPath,mediaType:t.mediaType,value:t.content,filename:t.title,kind:"code",readOnly:!0});return a.jsx(Ge,{document:n,mode:"read",className:"s-doc-focus-document"})}},Xt={id:"directory",canHandle:e=>e.kind==="directory",render:({resource:e,openFilePreview:t})=>{const n=e,r=Zt(n.realPath,n.rootPath);return a.jsxs("div",{className:"s-file-preview-directory",children:[a.jsx("div",{className:"s-file-preview-breadcrumb","aria-label":"Directory breadcrumb",children:r.map((s,i)=>{const c=i===r.length-1;return a.jsxs("div",{className:"s-file-preview-breadcrumb-item",children:[i>0&&a.jsx(Rt,{size:12,"aria-hidden":"true"}),c?a.jsx("span",{className:"s-file-preview-breadcrumb-current",children:s.label}):a.jsx("button",{type:"button",className:"s-file-preview-breadcrumb-link",onClick:()=>t(s.path),children:s.label})]},s.path)})}),a.jsxs("div",{className:"s-file-preview-directory-list",role:"list",children:[n.entries.map(s=>a.jsxs("button",{type:"button",className:"s-file-preview-entry",onClick:()=>t(s.path),children:[a.jsx("span",{className:"s-file-preview-entry-icon","aria-hidden":"true",children:s.kind==="directory"?a.jsx(xt,{size:14}):a.jsx(It,{size:14})}),a.jsx("span",{className:"s-file-preview-entry-name",children:s.name}),a.jsx("span",{className:"s-file-preview-entry-kind",children:s.kind==="directory"?"dir":"file"})]},s.realPath)),n.entries.length===0&&a.jsx("div",{className:"s-file-preview-directory-empty",children:"This directory is empty."})]})]})}};function Zt(e,t){const n=t==="/"?"/":t.replace(/\/+$/u,""),r=e==="/"?"/":e.replace(/\/+$/u,""),s=n.split("/").filter(Boolean),i=r.split("/").filter(Boolean),c=[{label:s[s.length-1]??"/",path:n||"/"}];let p=n||"/";for(let u=s.length;u<i.length;u+=1){const d=i[u];d&&(p=p==="/"?`/${d}`:`${p}/${d}`,c.push({label:d,path:p}))}return c}const en={id:"html",canHandle:e=>e.kind==="file"&&e.previewable&&e.mediaType==="text/html",render:({resource:e})=>a.jsx("div",{className:"s-file-preview-html-wrap",children:a.jsx("iframe",{className:"s-file-preview-html-frame",src:e.kind==="file"?e.rawUrl:"",title:e.title,sandbox:"allow-forms allow-popups allow-popups-to-escape-sandbox allow-scripts",referrerPolicy:"no-referrer"})})},tn={id:"image",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("image/"),render:({resource:e})=>a.jsx("div",{className:"s-file-preview-image-wrap",children:a.jsx("div",{className:"s-file-preview-image-stage",children:a.jsx("img",{className:"s-file-preview-image",src:e.kind==="file"?e.rawUrl:"",alt:e.title})})})},nn={id:"markdown",canHandle:e=>e.kind==="file"&&e.previewable&&e.mediaType==="text/markdown",render:({resource:e})=>{const t=e,n=Ke({id:t.realPath,title:t.title,uri:t.realPath,mediaType:t.mediaType,value:t.content,filename:t.title,kind:"markdown",readOnly:!0});return a.jsx(Ge,{document:n,mode:"preview",className:"s-doc-focus-document"})}},rn={id:"video",canHandle:e=>e.kind==="file"&&e.mediaType.startsWith("video/"),render:({resource:e})=>{const t=e;return a.jsx("div",{className:"s-file-preview-media-wrap",children:a.jsx("div",{className:"s-file-preview-media-stage",children:a.jsx("video",{className:"s-file-preview-video",src:t.rawUrl,controls:!0})})})}},on=[Xt,nn,en,Yt,tn,rn,Wt,zt];function sn({path:e,onOpenPath:t,onOpenInCode:n,onClose:r}){const[s,i]=o.useState(null),[c,p]=o.useState(null),[u,d]=o.useState(!1),[f,P]=o.useState(null),D=o.useRef(null);o.useEffect(()=>{D.current=f},[f]),o.useEffect(()=>{if(!e){i(null),p(null),d(!1);return}let b=!1;return d(!0),p(null),i(null),q(`/api/file/preview?path=${encodeURIComponent(e)}`).then(y=>{b||(i(y),an(y,D.current,P))}).catch(y=>{b||p(y instanceof Error?y.message:"could not load file")}).finally(()=>{b||d(!1)}),()=>{b=!0}},[e]);const{currentIndex:M,prevPath:v,nextPath:h}=o.useMemo(()=>{if(!s||s.kind!=="file"||!f)return{currentIndex:-1,prevPath:null,nextPath:null};const b=f.files.findIndex(y=>y.realPath===s.realPath);return b<0?{currentIndex:-1,prevPath:null,nextPath:null}:{currentIndex:b,prevPath:b>0?f.files[b-1].path:null,nextPath:b<f.files.length-1?f.files[b+1].path:null}},[s,f]);if(o.useEffect(()=>{if(!e)return;const b=y=>{if(y.key==="Escape"){r();return}if(y.target instanceof HTMLElement){const g=y.target.tagName;if(g==="INPUT"||g==="TEXTAREA"||y.target.isContentEditable)return}y.metaKey||y.ctrlKey||y.altKey||(y.key==="ArrowLeft"&&v?(y.preventDefault(),t(v)):y.key==="ArrowRight"&&h?(y.preventDefault(),t(h)):y.key==="Backspace"&&f&&s?.kind==="file"&&(y.preventDefault(),t(f.dirPath)))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[e,r,t,v,h,f,s]),!e)return null;const w=()=>{q("/api/file/reveal",{method:"POST",body:JSON.stringify({path:s?.realPath??e})}).catch(b=>{p(b instanceof Error?b.message:"reveal failed")})},I=s?on.find(b=>b.canHandle(s))??null:null,O=!!(s&&s.kind==="file"&&f&&M>=0&&f.files.length>1),k=[];O&&f&&k.push({label:`Folder: ${f.dirTitle}`,icon:a.jsx(Gt,{size:12}),onClick:()=>t(f.dirPath),title:`Back to ${f.dirTitle} (Backspace)`}),k.push({label:"Open in Code",icon:a.jsx(Lt,{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"}),k.push({label:"Show in folder",icon:a.jsx(Tt,{size:12}),onClick:w,title:"Show this file in its operating system folder",hideLabel:!0});const j=s?ln(s):[];O&&j.unshift(`${M+1} / ${f.files.length}`);const R=s&&I?I.render({resource:s,openFilePreview:t}):null;return a.jsx(At,{open:!0,kind:cn(s),document:null,title:s?.title??e.split("/").pop()??"File",eyebrow:"File preview",subtitle:s?.realPath??e,meta:j,state:u?"Loading…":null,error:c,body:R?a.jsxs("div",{className:`s-file-preview-shell${O?" s-file-preview-shell-nav":""}`,children:[O&&a.jsx("button",{type:"button",className:"s-file-preview-side-nav s-file-preview-side-nav-left",onClick:()=>v&&t(v),disabled:!v,"aria-label":"Previous file",title:"Previous file (←)",children:a.jsx(Ot,{size:18,strokeWidth:1.8,"aria-hidden":"true"})}),a.jsx("div",{className:"s-file-preview-shell-body",children:R}),O&&a.jsx("button",{type:"button",className:"s-file-preview-side-nav s-file-preview-side-nav-right",onClick:()=>h&&t(h),disabled:!h,"aria-label":"Next file",title:"Next file (→)",children:a.jsx(_t,{size:18,strokeWidth:1.8,"aria-hidden":"true"})})]}):null,actions:k,onClose:r})}function an(e,t,n){if(e.kind==="directory"){const s=e.entries.filter(i=>i.kind==="file");n({dirPath:e.path,dirTitle:e.title,files:s});return}if(!t){n(null);return}t.files.some(s=>s.realPath===e.realPath)||n(null)}function cn(e){return!e||e.kind==="directory"||e.mediaType==="text/markdown"||e.mediaType==="text/plain"?"doc":"code"}function ln(e){return e.kind==="directory"?[`${e.entries.length} ${e.entries.length===1?"entry":"entries"}`]:[...e.previewable&&e.truncated?["truncated"]:[],un(e.sizeBytes),e.mediaType]}function un(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}},Q=()=>{},Ye={focusScoutbot:Q,triggerBrief:Q,triggerAskState:Q,toggleVoiceReplies:Q,openScoutbotSettings:Q,startNewChat:Q,dismissReminder:Q,askReminderStatus:Q},Ee=o.createContext(null);function dn({children:e}){const[t,n]=o.useState(Qe),r=o.useRef(Ye),s=o.useCallback(u=>{n(d=>fn(d,u)?d:u)},[]),i=o.useCallback(u=>{r.current=u},[]),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:u=>r.current.dismissReminder(u),askReminderStatus:u=>r.current.askReminderStatus(u)}),[]),p=o.useMemo(()=>({state:t,actions:c,publishState:s,registerActions:i}),[t,c,s,i]);return a.jsx(Ee.Provider,{value:p,children:e})}function Ar(){const e=o.useContext(Ee);return e?{state:e.state,actions:e.actions}:{state:Qe,actions:Ye}}function Rr(){const e=o.useContext(Ee);return e?{publishState:e.publishState,registerActions:e.registerActions}:null}function fn(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&&pn(e.reminders.due,t.reminders.due)&&Xe(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 pn(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!Xe(e[n],t[n]))return!1;return!0}function Xe(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 hn="/api/voice/realtime/call",Ze="/api/voice/realtime/lease",et="/api/voice/realtime/settings",mn="x-openscout-realtime-voice-lease",tt="surface.realtime-voice",Ir="scout:realtime-voice-stop",Ce="scout:realtime-voice-settings",vn={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}},gn={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}},wn="/api/scoutbot/chat",nt="openscout.realtime-voice-settings";function rt(e){return q(et,{signal:e,cache:"no-store"})}function Nr(e){return q(et,{method:"PUT",body:JSON.stringify({enabled:e})})}function Lr(e){if(window.dispatchEvent(new CustomEvent(Ce,{detail:e})),!("BroadcastChannel"in window))return;const t=new BroadcastChannel(nt);t.postMessage(e),t.close()}function bn(e){const t=r=>{const s=r.detail;Fe(s)&&e(s)};window.addEventListener(Ce,t);const n="BroadcastChannel"in window?new BroadcastChannel(nt):null;return n&&(n.onmessage=r=>{Fe(r.data)&&e(r.data)}),()=>{window.removeEventListener(Ce,t),n?.close()}}function Fe(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.enabled=="boolean"&&typeof t.configuredEnabled=="boolean"&&(t.source==="settings"||t.source==="environment")&&typeof t.locked=="boolean"}const yn=25e3;async function Sn(e={}){if(ee(e.signal),!globalThis.RTCPeerConnection||!navigator.mediaDevices?.getUserMedia)throw new Error("This browser does not support realtime audio calls.");if(!(await rt(e.signal)).enabled)throw new Error("Live voice is off. Turn it on in Settings → Voice before starting a call.");ee(e.signal),e.onState?.("connecting");const n=new RTCPeerConnection,r=new Audio;r.autoplay=!0;let s=!1,i=null,c=null,p=null,u=0,d=0;const f=(h,w,I="voice")=>{d+=1,e.onTrace?.({id:`voice-${d}`,at:Date.now(),kind:I,label:h,...w?{detail:w}:{}})};let P=null;const D=()=>{if(P)return P;s=!0,e.signal?.removeEventListener("abort",v),p&&clearInterval(p),p=null,i?.getTracks().forEach(w=>w.stop()),r.pause(),r.srcObject=null,n.close();const h=c;return c=null,P=(async()=>{h&&await On(h),e.onState?.("ended")})(),P},M=()=>{D().catch(h=>{e.onError?.(h instanceof Error?h.message:"Could not release the realtime voice lease."),e.onState?.("error")})},v=()=>{M()};e.signal?.addEventListener("abort",v,{once:!0}),n.ontrack=({streams:h})=>{const w=h[0];if(!w||s)return;const[I]=w.getAudioTracks();I&&I.addEventListener("ended",()=>{s||e.onError?.("Realtime voice audio ended unexpectedly.")}),r.srcObject=w,r.play().catch(()=>{e.onError?.("Browser playback was blocked. Interact with the page, then start the call again.")})},n.onconnectionstatechange=()=>{s||(n.connectionState==="connected"?(e.onState?.("live"),f("Realtime channel connected","Scoutbot bridge is ready")):(n.connectionState==="failed"||n.connectionState==="disconnected")&&(e.onError?.("Realtime voice connection ended unexpectedly."),M()))};try{i=await Nn(e.inputDeviceName,e.signal),ee(e.signal);for(const x of i.getTracks())n.addTrack(x,i);const h=n.createDataChannel("oai-events"),w=new Set;let I=Promise.resolve(),O=!1,k=null;const j=[],R=x=>{if(s||h.readyState!=="open")return!1;try{return h.send(JSON.stringify(x)),!0}catch{return e.onError?.("Realtime voice events channel closed unexpectedly."),!1}},b=()=>{if(O||k||j.length===0)return;const x=j.shift();if(x){if(k=x,!R({type:"response.create",response:{instructions:x}})){k=null,j.unshift(x);return}O=!0}},y=x=>{j.push(x),b()};h.addEventListener("open",()=>{if(s)return;const x=In(e.inputDeviceName);if(!R({type:"session.update",session:{type:"realtime",audio:{input:x}}})){e.onError?.("Could not configure Scout's realtime microphone processing.");return}f("Scoutbot bridge ready","Live fleet context is available"),y("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?'")}),h.addEventListener("error",()=>{s||e.onError?.("Realtime voice events channel closed unexpectedly.")}),h.addEventListener("message",x=>{const C=En(x.data);if(C?.type==="error"){if(ot(C.message)){k&&(j.unshift(k),k=null),O=!0,f("Scoutbot reply queued","Waiting for the current spoken response to finish","scoutbot");return}e.onError?.(C.message??"OpenAI Realtime reported an error.");return}if(C?.type==="response.created"){O=!0,k=null;return}if(C?.type==="response.done"){O=!1,k=null;for(const H of kn(C))H.name!=="ask_scoutbot"||w.has(H.callId)||(w.add(H.callId),I=I.then(()=>Cn({functionCall:H,route:e.getRoute?.()??e.route,uiContext:e.getUiContext?.(),onReply:e.onScoutbotReply,onTrace:f,send:R,requestResponse:y})).catch(J=>{e.onError?.(J instanceof Error?J.message:"Scoutbot could not complete the voice request.")}));b()}});const g=await ge(n.createOffer(),e.signal);if(await ge(n.setLocalDescription(g),e.signal),!g.sdp)throw new Error("Could not create a WebRTC offer.");const T=await fetch(hn,{method:"POST",headers:{"content-type":"application/sdp"},body:g.sdp,signal:e.signal});c=T.headers.get(mn)?.trim()||null;const L=await ge(T.text(),e.signal);if(!T.ok)throw new Error(An(L,T.status));if(!c)throw new Error("Scout started the audio connection without a concurrency lease. Please try again.");return p=setInterval(()=>{if(!c||s)return;const x=c;Ln(x).then(C=>{if(!(s||x!==c)){if(C){u=0;return}e.onError?.("Realtime voice lost its server lease. Reconnect to continue safely."),M()}}).catch(()=>{u+=1,!(u<2||s)&&(e.onError?.("Realtime voice could not renew its server lease. Check the connection and try again."),M())})},yn),await ge(n.setRemoteDescription({type:"answer",sdp:L}),e.signal),ee(e.signal),{leaseId:c,stop:D}}catch(h){throw await D(),h}}async function Cn(e){const t=xn(e.functionCall.arguments);if(!t){e.onTrace("Scoutbot request could not be read",void 0,"error"),be(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(wn,{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(Tn(r,n.status));const s=JSON.parse(r),i=typeof s.reply?.body=="string"?s.reply.body.trim():"";if(!i)throw new Error("Scoutbot returned an empty reply.");const c=Je(i).filter(d=>d.type==="ask-agent").length,p=e.onReply?await e.onReply(i):{agentRequests:{requested:c,sent:0,failed:c}},u=St(i);e.onTrace("Scoutbot reply ready",void 0,"scoutbot"),be(e,{ok:!0,reply:u,...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"),be(e,{ok:!1,error:r})}}function be(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 ot(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 En(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 kn(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 xn(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 Tn(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 An(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 ge(e,t){return t?(ee(t),new Promise((n,r)=>{const s=()=>r(ke(t));t.addEventListener("abort",s,{once:!0}),e.then(i=>{t.removeEventListener("abort",s),n(i)},i=>{t.removeEventListener("abort",s),r(i)})})):e}async function Be(e,t){return t?(ee(t),new Promise((n,r)=>{let s=!1;const i=()=>{s=!0,r(ke(t))};t.addEventListener("abort",i,{once:!0}),e.then(c=>{if(t.removeEventListener("abort",i),s||t.aborted){c.getTracks().forEach(p=>p.stop());return}n(c)},c=>{t.removeEventListener("abort",i),s||r(c)})})):e}const Ue={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1},Rn=/\b(?:airpods?|earbuds?|earphones?|headsets?|headphones?|buds?|hands[- ]?free)\b/iu;function In(e){return Rn.test(e?.trim()??"")?gn:vn}async function Nn(e,t){const n=await Ve(e);let r=await Be(navigator.mediaDevices.getUserMedia({audio:{...Ue,...n?{deviceId:{exact:n.deviceId}}:{}}}),t);if(!n&&e?.trim()){const s=await Ve(e),i=r.getAudioTracks?.()[0]?.label?.trim().toLocaleLowerCase()??"";if(s&&s.label.trim().toLocaleLowerCase()!==i)try{const c=await Be(navigator.mediaDevices.getUserMedia({audio:{...Ue,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 Ve(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 ee(e){if(e?.aborted)throw ke(e)}function ke(e){return e.reason instanceof Error?e.reason:new DOMException("Realtime voice connection was cancelled.","AbortError")}async function Ln(e){return(await fetch(`${Ze}/${encodeURIComponent(e)}`,{method:"PUT"})).ok}async function On(e){const t=await fetch(`${Ze}/${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 _n=[{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"}}],jn=[{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 Dn(e){const t=e==="macos";return{host:e,shellLabel:t?"Scout for macOS":"OpenScout web",destinations:t?jn:_n,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 Pn="scout:scoutbot-realtime-reply",we="scout:scoutbot-session-changed",Mn={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:()=>{}},st=o.createContext(Mn);function Fn({children:e}){const{route:t,applyScoutbotUiAction:n}=at(),r=$e(tt,!0),[s,i]=o.useState(!1),c=r&&s,[p,u]=o.useState(!1),[d,f]=o.useState("idle"),[P,D]=o.useState(null),[M,v]=o.useState(null),[h,w]=o.useState([]),[I,O]=o.useState(null),[k,j]=o.useState(null),R=o.useRef(null),b=o.useRef(null),y=o.useRef(null),g=o.useRef(0),T=o.useRef(!1),L=o.useRef(!1),x=o.useRef({route:t,applyScoutbotUiAction:n});x.current={route:t,applyScoutbotUiAction:n};const C=o.useCallback((m,S,A="voice")=>{w(N=>[...N,{id:`voice-ui-${Date.now()}-${N.length}`,at:Date.now(),kind:A,label:m,...S?{detail:S}:{}}].slice(-100))},[]),H=o.useCallback(()=>w([]),[]),J=o.useCallback(async()=>{const m=await q("/api/scoutbot/session");return T.current||O(m),m},[]);o.useEffect(()=>{if(!r){i(!1);return}const m=new AbortController;let S=!1;const A=bn(N=>{i(N.enabled)});return rt(m.signal).then(N=>{S||i(N.enabled)}).catch(N=>{S||qe(N)||(i(!1),v(N instanceof Error?N.message:"Could not load live voice settings."))}),()=>{S=!0,m.abort(),A()}},[r]),o.useEffect(()=>{if(!c)return;const m=()=>{J().catch(S=>{T.current||v(S instanceof Error?S.message:"Could not load Scoutbot chats.")})};return m(),window.addEventListener(we,m),()=>window.removeEventListener(we,m)},[c,J]);const $=o.useCallback(async()=>{g.current+=1;const m=y.current;b.current?.abort(),b.current=null;const S=R.current;R.current=null;try{await S?.stop(),await m}catch(A){return T.current||(f("error"),v(A instanceof Error?A.message:"Could not end realtime voice cleanly.")),!1}return T.current||(D(null),f("ended"),C("Live voice ended","Microphone and host lease released","voice")),!0},[C]);o.useEffect(()=>{c||(u(!1),(R.current||d==="connecting"||d==="live")&&$())},[c,$,d]),o.useEffect(()=>(T.current=!1,()=>{T.current=!0,g.current+=1,b.current?.abort(),b.current=null,R.current?.stop().catch(()=>{}),R.current=null}),[]);const te=o.useCallback(async m=>{window.dispatchEvent(new CustomEvent(Pn,{detail:{body:m}}));const S=m.replace(/```[\s\S]*?```/gu,"").trim();S&&C("Scoutbot replied",S.slice(0,2e3),"scoutbot");let A=0,N=0,W=0;for(const B of Je(m))if(B.type==="ask-agent")A+=1,await Vn(B,C,v)?N+=1:W+=1;else if(B.type!=="reminder"){const _=Un(B),U=B.type==="navigate"||B.type==="view-file"?"navigation":"scoutbot";C(Bn(B),_,U),x.current.applyScoutbotUiAction(B),C(De()?"Action sent to Scout for macOS":"Action applied in OpenScout",_,U)}return await J().catch(()=>null),{agentRequests:{requested:A,sent:N,failed:W}}},[C,J]),ne=o.useCallback(()=>{const m={type:"navigate",route:{view:"settings",section:"voice"}};C("Voice settings requested",void 0,"navigation"),x.current.applyScoutbotUiAction(m)},[C]),re=o.useCallback(async()=>{if(!c){v("Turn on live voice in Settings → Voice before starting a call."),u(!1);return}if(L.current||d==="connecting"||d==="live")return;L.current=!0,b.current?.abort();const m=R.current;R.current=null;try{await m?.stop(),D(null)}catch(_){f("error"),v(_ instanceof Error?_.message:"Could not end the previous realtime voice call."),L.current=!1;return}const S=new AbortController;b.current=S;const A=g.current+1;g.current=A;let N=()=>{};const W=new Promise(_=>{N=_});y.current=W;let B=!1;v(null),w([{id:"connecting",at:Date.now(),label:"Connecting secure audio"}]),f("connecting");try{const _=await jt().then(({settings:V})=>V.inputDeviceName).catch(()=>null),U=await Sn({signal:S.signal,inputDeviceName:_,getRoute:()=>x.current.route,getUiContext:()=>Dn(De()?"macos":"web"),onState:V=>{!T.current&&g.current===A&&f(V)},onError:V=>{if(!(T.current||g.current!==A)){if(ot(V)){C("Scoutbot reply queued","Waiting for the current spoken response to finish","scoutbot");return}v(V),C("Voice issue",V,"error")}},onTrace:V=>{!T.current&&g.current===A&&w(ue=>[...ue,V].slice(-100))},onScoutbotReply:V=>!T.current&&g.current===A?te(V):{agentRequests:{requested:0,sent:0,failed:0}}});if(T.current||S.signal.aborted||g.current!==A){await U.stop();return}R.current=U,D(U.leaseId),B=!0}catch(_){if(!T.current&&g.current===A&&!qe(_)){f("error");const U=_ instanceof Error?_.message:"Could not start realtime voice.";v(U),C("Live voice could not start",U,"error")}}finally{!B&&b.current===S&&(b.current=null),N(),y.current===W&&(y.current=null),L.current=!1}},[C,te,c,d]),oe=o.useCallback(async()=>{if(!k){j("new"),v(null);try{if((R.current||d==="connecting"||d==="live")&&!await $())return;if(I?.session.messages.length===0){w([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"New live chat ready"}]);return}const m=await q("/api/scoutbot/session/reset",{method:"POST"});O(m),w([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"New live chat ready"}]),window.dispatchEvent(new CustomEvent(we,{detail:{id:m.session.id}}))}catch(m){const S=m instanceof Error?m.message:"Could not start a new Scoutbot chat.";v(S),C("Could not start a new live chat",S,"error")}finally{j(null)}}},[C,I?.session.messages.length,$,k,d]),se=o.useCallback(async m=>{if(!(!m||k||m===I?.session.id)){j(m),v(null);try{if((R.current||d==="connecting"||d==="live")&&!await $())return;const S=await q("/api/scoutbot/session/switch",{method:"POST",body:JSON.stringify({id:m})});O(S),w([{id:`voice-chat-${Date.now()}`,at:Date.now(),kind:"scoutbot",label:"Live chat restored",detail:S.session.title}]),window.dispatchEvent(new CustomEvent(we,{detail:{id:S.session.id}}))}catch(S){const A=S instanceof Error?S.message:"Could not switch Scoutbot chats.";v(A),C("Could not restore the live chat",A,"error")}finally{j(null)}}},[C,I?.session.id,$,k,d]),ie=o.useCallback(async m=>{const S=m.trim();if(!S)throw new Error("Preferred model is required.");const A=await q("/api/scoutbot/config",{method:"POST",body:JSON.stringify({model:S})});return O(N=>N&&{...N,config:{...N.config,...A.config}}),C("Scoutbot preferred model updated",A.config.model,"scoutbot"),A.config.model},[C]),ae=o.useMemo(()=>({enabled:c,open:p,state:d,leaseId:P,error:M,trace:h,chatState:I,sessionAction:k,setOpen:u,startCall:re,endCall:$,startNewChat:oe,switchChat:se,updatePreferredModel:ie,clearTrace:H,openVoiceSettings:ne}),[c,p,d,P,M,h,I,k,re,$,oe,se,ie,H,ne]);return a.jsx(st.Provider,{value:ae,children:e})}function qe(e){return(e instanceof DOMException||e instanceof Error)&&e.name==="AbortError"}function Or(){return o.useContext(st)}function Bn(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 Un(e){return e.type==="navigate"?JSON.stringify(e.route):e.type==="view-file"?e.path:e.reason?.trim()||e.type}async function Vn(e,t,n){t("Scoutbot is coordinating",`Asking ${e.targetLabel}`,"agent");try{const r=await q("/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 ye(e,t){const n=t?.trim();n&&e.add(n)}function qn(e,t){const n=new Set;return ye(n,e.authorityNodeId),ye(n,e.homeNodeId),n.size===0&&ye(n,t),n}function it(e,t,n){return t?qn(e,n).has(t):!0}function Hn(e,t,n){return t?e.filter(r=>it(r,t,n)):e}function _r(e,t,n){return t?new Set(e.filter(r=>it(r,t,n)).map(r=>r.id)):null}function Y(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 $n(e,t,n){return Y(e,t,n)}function jr(e,t,n){return!t&&!n?e:e.filter(r=>$n(r,t,n))}function Jn(e,t){return Y(e,t)}function Kn(e,t){return t?e.filter(n=>Jn(n,t)):e}function He(e,t){return Y(e,t)}function Dr(e,t){if(!e||!t)return e;const n=e.activeAsks.filter(c=>Y(c,t)),r=e.recentCompleted.filter(c=>Y(c,t)),s=e.needsAttention.filter(c=>Y(c,t)),i=Kn(e.activity,t);return{...e,totals:{active:n.length,recentCompleted:r.length,needsAttention:s.length,activity:i.length},activeAsks:n,recentCompleted:r,needsAttention:s,activity:i}}function Pr(e,t){if(!t)return e;const n=e.activeFlights.filter(i=>Y(i,t)),r=e.childWork.filter(i=>He(i,t));return He(e,t)||n.length>0||r.length>0?{...e,activeFlights:n,childWork:r}:null}function Gn(e){return!!(e&&(e.message.trim().length>0||e.files.length>0||e.forwardContext))}function Wn(e){return[e.name,e.type,e.size,e.lastModified].join(":")}function zn(e,t){const n=new Set;return[...e,...t].filter(r=>{const s=Wn(r);return n.has(s)?!1:(n.add(s),!0)})}function Qn(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:zn(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 Yn({request:e,onClose:t,onOpenCapture:n}){const{agents:r,route:s,navigate:i}=at(),c=vt(s),p=Hn(r,c),u=Pt(s,p),[d,f]=o.useState(0),[P,D]=o.useState(null),[M,v]=o.useState(null),h=o.useRef(0),w=e?Qn(M,e):null,I=o.useCallback((k,j)=>{if(k.length===0)return;const R=!!(u.agentId||u.conversationId);n({intent:R?"route-capture":"new-task",files:k,attachmentFeedback:j,agentId:u.agentId??void 0,conversationId:u.conversationId??void 0,preferExistingChat:u.canUseExistingChat})},[n,u]);o.useEffect(()=>{if(!P)return;const k=window.setTimeout(()=>D(null),5e3);return()=>window.clearTimeout(k)},[P]),o.useEffect(()=>{const k=g=>{ve(g.dataTransfer)&&(g.preventDefault(),h.current+=1,f(h.current))},j=g=>{ve(g.dataTransfer)&&(g.preventDefault(),g.dataTransfer&&(g.dataTransfer.dropEffect="copy"))},R=()=>{h.current!==0&&(h.current=Math.max(0,h.current-1),f(h.current))},b=g=>{if(!ve(g.dataTransfer))return;g.preventDefault();const T=Pe(g.dataTransfer),L=T.filter(Me),x=T.length-L.length;if(h.current=0,f(0),L.length===0){D(T.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 C=L.length===1?`Dropped ${L[0]?.name||"1 attachment"}.`:`Dropped ${L.length} attachments.`,H=x>0?`${C} Skipped ${x} unsupported ${x===1?"file":"files"}.`:C;D(null),I(L,H)},y=g=>{if(Dt(g.target)||!ve(g.clipboardData))return;g.preventDefault();const T=Pe(g.clipboardData),L=T.filter(Me);if(L.length===0){D(T.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}I(L,L.length===1?`Pasted ${L[0]?.name||"1 attachment"}.`:`Pasted ${L.length} attachments.`)};return window.addEventListener("dragenter",k),window.addEventListener("dragover",j),window.addEventListener("dragleave",R),window.addEventListener("drop",b),window.addEventListener("paste",y),()=>{window.removeEventListener("dragenter",k),window.removeEventListener("dragover",j),window.removeEventListener("dragleave",R),window.removeEventListener("drop",b),window.removeEventListener("paste",y)}},[I]);const O=d>0&&!e;return a.jsxs(a.Fragment,{children:[O?a.jsx("div",{className:"s-capture-drop",role:"presentation",children:a.jsxs("div",{className:"s-capture-drop-card",children:[a.jsx("div",{className:"s-capture-drop-title",children:"Route capture"}),a.jsx("div",{className:"s-capture-drop-copy",children:"Drop markdown, code, an image, or a video clip to send it to the right agent or chat."})]})}):null,P?a.jsx("div",{className:"s-capture-feedback",role:"alert",children:P}):null,e?a.jsx(Mt,{agents:p,route:s,navigate:i,onClose:t,initialAgentId:w?.agentId,initialConversationId:w?.conversationId,initialMessage:w?.message,initialFiles:w?.files,initialAttachmentFeedback:w?.attachmentFeedback??void 0,initialIntent:w?.intent,initialProjectPath:w?.projectPath,initialProjectQuery:w?.projectQuery,initialForwardContext:w?.forwardContext,initialForwardContextMode:w?.forwardContextMode,defaultMode:w?.mode,draftRestored:Gn(M),onDraftChange:v,onDraftConsumed:()=>v(null)}):null]})}const xe=o.createContext(null),Xn=["hello","node.upserted","actor.registered","agent.registered","agent.endpoint.upserted","invocation.requested","flight.updated","delivery.state.changed","scout.dispatched"],Zn=new Set(Xn),er=3e4,tr=250;function nr(e,t){try{return JSON.stringify(e)===JSON.stringify(t)?e:t}catch{return t}}const rr={"--hud-bg":"oklch(0.118 0.004 260)","--hud-surface":"oklch(0.205 0.005 260)","--hud-ink":"oklch(0.975 0.006 260)","--hud-muted":"oklch(0.80 0.008 260)","--hud-dim":"oklch(0.70 0.007 260)","--hud-border":"oklch(0.975 0.006 260 / 0.08)","--hud-accent":"oklch(0.86 0.17 125)","--hud-accent-soft":"oklch(0.86 0.17 125 / 0.08)","--hud-shadow-soft":"oklch(0.08 0.004 260 / 0.42)","--hud-chrome-border":"oklch(0.975 0.006 260 / 0.04)","--hud-shadow-panel":"0 12px 34px oklch(0.08 0.004 260 / 0.45)","--hud-shadow-panel-hover":"0 14px 38px oklch(0.08 0.004 260 / 0.52)","--hud-shadow-bar":"0 -10px 28px oklch(0.08 0.004 260 / 0.38)","--hud-shadow-nav":"0 8px 24px oklch(0.08 0.004 260 / 0.32)","--hud-shadow-minimap":"0 10px 24px oklch(0.08 0.004 260 / 0.38)","--hud-status-ok":"oklch(0.80 0.15 155)","--hud-status-warn":"oklch(0.82 0.15 85)","--hud-status-error":"oklch(0.72 0.18 25)","--background":"0.132 0.004 260","--foreground":"0.965 0.006 260","--card":"0.178 0.005 260","--card-foreground":"0.965 0.006 260","--popover":"0.178 0.005 260","--popover-foreground":"0.965 0.006 260","--muted-foreground":"0.72 0.008 260","--scrim":"rgba(0, 0, 0, 0.5)","--scrim-soft":"rgba(0, 0, 0, 0.3)","--info":"#62b6ff","--shadow-card":"0 8px 22px rgba(0, 0, 0, 0.22)","--shadow-card-hover":"0 14px 36px rgba(0, 0, 0, 0.30)","--cat-gold":"#d7a978","--cat-purple":"#c58cff","--cat-sky":"#38bdf8","--scout-chrome-ink-strong":"color-mix(in srgb, var(--hud-ink) 94%, transparent)","--scout-chrome-ink":"color-mix(in srgb, var(--hud-ink) 84%, transparent)","--scout-chrome-ink-soft":"color-mix(in srgb, var(--hud-ink) 68%, transparent)","--scout-chrome-ink-faint":"color-mix(in srgb, var(--hud-ink) 64%, transparent)","--scout-chrome-ink-ghost":"color-mix(in srgb, var(--hud-ink) 56%, transparent)","--scout-chrome-hover":"color-mix(in srgb, var(--hud-ink) 5%, transparent)","--scout-chrome-active":"color-mix(in srgb, var(--hud-ink) 9%, transparent)","--scout-chrome-border-soft":"color-mix(in srgb, var(--hud-ink) 8%, transparent)","--scout-chrome-avatar-ink":"#111111","--hud-font-sans":"'Inter', ui-sans-serif, system-ui, sans-serif","--hud-font-mono":"'JetBrains Mono', ui-monospace, Menlo, monospace","--hud-font-serif":"'Spectral', 'Cormorant Garamond', Georgia, serif","--hud-font-accent-title":"'Inter Tight', var(--hud-font-sans)"},or={"--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)"},sr=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 ir(e){return Object.fromEntries(Object.entries(e==="light"?or:rr).filter(([n])=>!sr.has(n)))}function Mr(){return o.useContext(xe)}function at(){const e=o.useContext(xe);if(!e)throw new Error("useScout must be used inside ScoutProvider");return e}function Fr({children:e,initialTheme:t="dark"}){const{route:n,navigate:r,navigateBack:s,canNavigateBack:i}=gt(),c=Ft(),p=$e(tt,!0),[u,d]=o.useState([]),[f,P]=o.useState(!1),[D,M]=o.useState({status:"checking",message:null,lastCheckedAt:null}),[v,h]=o.useState(_e),[w,I]=o.useState(null),O=o.useRef(!1),[k,j]=o.useState($t),[R,b]=o.useState(!1),[y,g]=o.useState(null),[T,L]=o.useState(null),[x,C]=o.useState(""),[H,J]=o.useState(null),$=n.view==="settings",te=o.useMemo(()=>n.view!=="broker"||!n.attemptId?null:y?.id===n.attemptId?y:null,[y,n]),ne=o.useMemo(()=>n.view!=="search"||!n.hitId?null:T?.id===n.hitId?T:null,[T,n]),re=o.useMemo(()=>n.view==="agents-v2"&&n.agentId&&n.sessionId?{agentId:n.agentId,sessionId:n.sessionId}:n.view==="sessions"&&n.sessionId?{agentId:n.agentId??"",sessionId:n.sessionId}:null,[n]),oe=o.useCallback((l,E)=>{if(n.view==="agents-v2"&&n.agentId===l){r({...n,sessionId:E},{replace:!0});return}if(n.view==="sessions"){r({view:"sessions",sessionId:E,agentId:l},{replace:!0});return}r({view:"agents-v2",agentId:l,sessionId:E},{replace:!0})},[r,n]),se=o.useCallback(()=>{r({view:"settings",section:"appearance"})},[r]),ie=o.useCallback(()=>{n.view==="settings"&&r({view:"inbox"})},[r,n.view]),ae=o.useCallback(l=>{J(l??{intent:"new-task"})},[]),m=o.useCallback(()=>J(null),[]),S=o.useCallback(l=>{g(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]),A=o.useCallback(()=>{g(null),n.view==="broker"&&n.attemptId&&r({view:"broker",...n.filter?{filter:n.filter}:{}},{replace:!0})},[r,n]),N=o.useCallback((l,E,F)=>{if(L(l),typeof E=="string"&&C(E.trim()),n.view==="search"&&n.hitId===l.id)return;const K=F??(n.view==="search"?n.filters:void 0);r({view:"search",...n.view==="search"&&n.mode?{mode:n.mode}:{},...K?{filters:K}:{},hitId:l.id},{replace:n.view==="search"})},[r,n]),W=o.useCallback(()=>{L(null),C(""),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(()=>dt(),[]),_=c?.resolvedTheme??t,U=c?.template??"hudson",V=o.useMemo(()=>({...ir(_),...B??{}}),[B,_]),ue=o.useCallback(l=>{h(E=>({...E,...l}))},[]);o.useEffect(()=>{!f||u.length===0||h(l=>{const E=ft(l.agentCharacters,u);return E===l.agentCharacters?l:{...l,agentCharacters:E}})},[u,f]),o.useEffect(()=>{pt(_,U,v),ht(v)},[U,v,_]),o.useEffect(()=>{const l=E=>{E.key!==null&&E.key!==mt||h(_e())};return window.addEventListener("storage",l),()=>window.removeEventListener("storage",l)},[]);const Te=o.useMemo(()=>Ct(u),[u]),Ae=Te?.id??Et(u),Re=Te?.conversationId??null,de=o.useRef(null),X=o.useRef(null),fe=n.view==="ops"?"/api/agents":"/api/agents?detail=summary",pe=o.useCallback(()=>{M({status:"online",message:null,lastCheckedAt:Date.now()})},[]),he=o.useCallback(l=>{const E=Ut(l);M({status:Vt(E)?"offline":"degraded",message:E,lastCheckedAt:Date.now()})},[]),G=o.useCallback(async()=>{const l=de.current;if(l&&(await l.promise,l.url===fe))return;const E=(async()=>{try{const F=await q(fe);d(K=>nr(K,F)),pe()}catch(F){he(F)}finally{P(!0)}})();de.current={url:fe,promise:E};try{await E}finally{de.current?.promise===E&&(de.current=null)}},[fe,he,pe]),z=o.useCallback(async()=>{try{const l=await q("/api/onboarding/state");O.current=!1,I(l);const E=l.operatorName?.trim()||l.operatorNameSuggestion?.trim()||null;j(E),Jt(E),pe()}catch(l){he(l),O.current=!0,I({hasLocalConfig:!0,hasProjectConfig:!0,hasOperatorName:!0,localConfigPath:null,projectRoot:null,currentDirectory:null,operatorName:null,operatorNameSuggestion:null,needed:!1})}},[he,pe]),Ie=o.useCallback(()=>{b(!0),q("/api/onboarding/skip",{method:"POST",body:"{}"}).then(()=>z()).catch(()=>null)},[z]);o.useEffect(()=>{G(),z()},[G,z]),o.useEffect(()=>{const l=()=>{je()&&(G(),O.current&&z())},E=window.setInterval(l,er),F=bt(l);return()=>{window.clearInterval(E),F()}},[G,z]);const Ne=o.useMemo(()=>u.filter(l=>yt(l.state)).length,[u]),[ct,Le]=o.useState(null),ce=o.useCallback(l=>{l?.trim()&&Le(l.trim())},[]),le=o.useCallback(()=>Le(null),[]),Z=o.useCallback(l=>{if(!kt(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":G();break;case"view-file":ce(l.path);break}},[r,ce,G]),lt=o.useCallback((l,E)=>{const F=l.trim(),K=E.trim();if(!F||!K)return;const Oe=n.view==="conversation"||n.view==="messages"?n.conversationId:window.location.pathname==="/embed/thread"&&new URLSearchParams(window.location.search).get("conversationId")?.trim()||void 0;le(),Z({type:"navigate",route:{view:"code",root:K,file:F,...Oe?{returnConversationId:Oe}:{}}})},[Z,le,n]),me=o.useRef({applyScoutbotUiAction:Z});me.current={applyScoutbotUiAction:Z},wt(l=>{je()&&Zn.has(l.kind)&&(X.current!==null&&window.clearTimeout(X.current),X.current=window.setTimeout(()=>{X.current=null,G()},tr))}),o.useEffect(()=>()=>{X.current!==null&&window.clearTimeout(X.current)},[]),o.useEffect(()=>{const l=E=>{const F=E.detail,K=F&&typeof F=="object"&&"type"in F?F:null;K&&me.current.applyScoutbotUiAction(K)};return window.addEventListener("scout:scoutbot-ui-action",l),window.scoutScoutbot={applyUiAction:E=>me.current.applyScoutbotUiAction(E),navigate:E=>me.current.applyScoutbotUiAction({type:"navigate",route:E})},()=>{window.removeEventListener("scout:scoutbot-ui-action",l),window.scoutScoutbot?.applyUiAction&&delete window.scoutScoutbot}},[]);const ut=o.useMemo(()=>({route:n,navigate:r,navigateBack:s,canNavigateBack:i,agents:u,agentsLoaded:f,onlineCount:Ne,apiConnection:D,reload:G,appearanceDetails:v,updateAppearanceDetails:ue,onboarding:w,operatorName:k,refreshOnboarding:z,onboardingSkipped:R,skipOnboarding:Ie,settingsOpen:$,openSettings:se,closeSettings:ie,scoutbotAgentId:Ae,scoutbotConversationId:Re,applyScoutbotUiAction:Z,selectedBrokerAttempt:te,inspectBrokerAttempt:S,clearBrokerAttempt:A,selectedKnowledgeHit:ne,selectedKnowledgeQuery:x,inspectKnowledgeHit:N,clearKnowledgeHit:W,focusedSession:re,focusSession:oe,openFilePreview:ce,closeFilePreview:le,openContextCapture:ae,closeContextCapture:m}),[n,r,s,i,u,f,Ne,D,G,v,ue,w,k,z,R,Ie,$,se,ie,Ae,Re,Z,te,S,A,ne,x,N,W,re,oe,ce,le,ae,m]);return a.jsx(xe.Provider,{value:ut,children:a.jsx("div",{"data-scout-theme-mode":_,"data-scout-palette":v.palette,"data-scout-contrast":v.contrast,"data-scout-accent":v.accent,"data-scout-shell":v.shell,"data-scout-avatar-style":v.avatarStyle,"data-hudson-theme":_,"data-hudson-template":U,style:{...V},children:a.jsx("div",{"data-scout-theme":_,style:{display:"contents"},children:a.jsx(Bt,{children:a.jsxs(dn,{children:[p?a.jsx(Fn,{children:e}):e,a.jsx(sn,{path:ct,onOpenPath:ce,onOpenInCode:lt,onClose:le}),a.jsx(Yn,{request:H,onClose:m,onOpenCapture:ae})]})})})})})}export{Bt as C,rr as D,or as L,xe as S,Tr as a,Kn as b,Mr as c,Hn as d,jr as e,Ut as f,Dr as g,Fr as h,Vt as i,Pr as j,Gt as k,Rr as l,_r as m,tt as n,Or as o,we as p,Pn as q,Ir as r,Dn as s,Ar as t,at as u,rt as v,Nr as w,Lr as x};
@@ -1 +1 @@
1
- import{j as r}from"./index-CZ-05hKz.js";import{s as $,b as E}from"./colors-BtO5_zlx.js";import{A as M}from"./AgentAvatar-CYhf6twS.js";function q({name:a,meta:i,sub:s,tone:o="neutral",agent:t,avatarName:c,avatarKind:e="user",leadingIcon:n,caret:l,active:j,selected:v,unread:N,depth:f=0,detail:d,expanded:h,activityLabel:w,worktreeLabel:u,activityTone:g="working",actions:p,pinned:x,onClick:k,onKeyDown:b,onContextMenu:y,onPointerEnter:C,onPointerLeave:P,title:R,tabIndex:z}){const A=l?l==="open":d!==void 0?!!h:void 0,B=["rr-row",f===1&&"rr-row--child",j&&"rr-row--active",v&&"rr-row--selected",N&&"rr-row--unread",h&&"rr-row--expanded",w&&"rr-row--motion",x&&"rr-row--pinned",p&&"rr-row--has-actions"].filter(Boolean).join(" ");return r.jsxs("div",{className:B,children:[r.jsxs("button",{type:"button",className:"rr-row-head",onClick:k,onKeyDown:b,onContextMenu:y,onPointerEnter:C,onPointerLeave:P,title:R,tabIndex:z,"aria-expanded":A,children:[r.jsx(T,{icon:n,tone:o,caret:l,agent:t,avatarName:c,avatarKind:e}),r.jsxs("span",{className:"rr-row-body",children:[r.jsxs("span",{className:"rr-row-name",children:[x?r.jsx("span",{className:"rr-row-pin-mark","aria-label":"Pinned",title:"Pinned",children:r.jsx(S,{})}):null,a]}),s&&r.jsx("span",{className:"rr-row-sub",children:s}),u&&r.jsx("span",{className:"rr-row-worktree",children:u}),w&&r.jsxs("span",{className:`rr-row-activity rr-row-activity--${g}`,children:[r.jsxs("span",{className:"rr-row-activity-bars","aria-hidden":!0,children:[r.jsx("span",{}),r.jsx("span",{}),r.jsx("span",{}),r.jsx("span",{})]}),r.jsx("span",{className:"rr-row-activity-label",children:w})]})]}),i&&r.jsx("span",{className:"rr-row-meta",children:i})]}),p?r.jsx("div",{className:"rr-row-actions",onClick:L=>L.stopPropagation(),children:p}):null,h&&d&&r.jsx("div",{className:"rr-row-detail",children:d})]})}function T({icon:a,tone:i,caret:s,agent:o,avatarName:t,avatarKind:c}){if(s)return r.jsx("span",{className:`rr-row-caret rr-row-caret--leading rr-row-caret--${s}`,"aria-hidden":!0,children:r.jsx(G,{open:s==="open"})});if(t||o){if(c==="channel")return r.jsx("span",{className:"rr-row-hash","aria-hidden":!0,children:"#"});const n=m(i),l=n==="active"||n==="available"||n==="working"||n==="in_turn";return r.jsx("span",{className:"rr-row-avatar-wrap","aria-hidden":!0,children:r.jsx(M,{agent:o,name:t??o?.name,placement:"row",size:20,tile:!0,presence:l})})}if(a)return r.jsx("span",{className:"rr-row-icon","aria-hidden":!0,children:a});const e=m(i);return r.jsx("span",{className:`rr-row-dot rr-row-dot--${e}`,style:e==="active"||e==="available"?{background:$(e)}:void 0,"aria-hidden":!0})}function G({open:a}){return r.jsx("svg",{className:`rr-chevron${a?" rr-chevron--open":""}`,viewBox:"0 0 12 12",width:"12",height:"12",fill:"none","aria-hidden":!0,children:r.jsx("path",{d:"M4.25 3L7.75 6L4.25 9",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function m(a){return a==="channel"||a==="dm"||a==="neutral"?a:E(a)}function S(){return r.jsx("svg",{width:"9",height:"9",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M9.8 1.6 14.4 6.2a1 1 0 0 1-.2 1.6l-2.7 1.1-.9 3.4a.7.7 0 0 1-1.2.3L6.3 9.5 2.8 13 1.7 11.9l3.5-3.5L2.1 5.3a.7.7 0 0 1 .3-1.2l3.4-.9 1.1-2.7a1 1 0 0 1 1.6-.2Z"})})}export{q as R};
1
+ import{j as r}from"./index-DvLtl7rV.js";import{s as $,b as E}from"./colors-BtO5_zlx.js";import{A as M}from"./AgentAvatar-6-KBVKUu.js";function q({name:a,meta:i,sub:s,tone:o="neutral",agent:t,avatarName:c,avatarKind:e="user",leadingIcon:n,caret:l,active:j,selected:v,unread:N,depth:f=0,detail:d,expanded:h,activityLabel:w,worktreeLabel:u,activityTone:g="working",actions:p,pinned:x,onClick:k,onKeyDown:b,onContextMenu:y,onPointerEnter:C,onPointerLeave:P,title:R,tabIndex:z}){const A=l?l==="open":d!==void 0?!!h:void 0,B=["rr-row",f===1&&"rr-row--child",j&&"rr-row--active",v&&"rr-row--selected",N&&"rr-row--unread",h&&"rr-row--expanded",w&&"rr-row--motion",x&&"rr-row--pinned",p&&"rr-row--has-actions"].filter(Boolean).join(" ");return r.jsxs("div",{className:B,children:[r.jsxs("button",{type:"button",className:"rr-row-head",onClick:k,onKeyDown:b,onContextMenu:y,onPointerEnter:C,onPointerLeave:P,title:R,tabIndex:z,"aria-expanded":A,children:[r.jsx(T,{icon:n,tone:o,caret:l,agent:t,avatarName:c,avatarKind:e}),r.jsxs("span",{className:"rr-row-body",children:[r.jsxs("span",{className:"rr-row-name",children:[x?r.jsx("span",{className:"rr-row-pin-mark","aria-label":"Pinned",title:"Pinned",children:r.jsx(S,{})}):null,a]}),s&&r.jsx("span",{className:"rr-row-sub",children:s}),u&&r.jsx("span",{className:"rr-row-worktree",children:u}),w&&r.jsxs("span",{className:`rr-row-activity rr-row-activity--${g}`,children:[r.jsxs("span",{className:"rr-row-activity-bars","aria-hidden":!0,children:[r.jsx("span",{}),r.jsx("span",{}),r.jsx("span",{}),r.jsx("span",{})]}),r.jsx("span",{className:"rr-row-activity-label",children:w})]})]}),i&&r.jsx("span",{className:"rr-row-meta",children:i})]}),p?r.jsx("div",{className:"rr-row-actions",onClick:L=>L.stopPropagation(),children:p}):null,h&&d&&r.jsx("div",{className:"rr-row-detail",children:d})]})}function T({icon:a,tone:i,caret:s,agent:o,avatarName:t,avatarKind:c}){if(s)return r.jsx("span",{className:`rr-row-caret rr-row-caret--leading rr-row-caret--${s}`,"aria-hidden":!0,children:r.jsx(G,{open:s==="open"})});if(t||o){if(c==="channel")return r.jsx("span",{className:"rr-row-hash","aria-hidden":!0,children:"#"});const n=m(i),l=n==="active"||n==="available"||n==="working"||n==="in_turn";return r.jsx("span",{className:"rr-row-avatar-wrap","aria-hidden":!0,children:r.jsx(M,{agent:o,name:t??o?.name,placement:"row",size:20,tile:!0,presence:l})})}if(a)return r.jsx("span",{className:"rr-row-icon","aria-hidden":!0,children:a});const e=m(i);return r.jsx("span",{className:`rr-row-dot rr-row-dot--${e}`,style:e==="active"||e==="available"?{background:$(e)}:void 0,"aria-hidden":!0})}function G({open:a}){return r.jsx("svg",{className:`rr-chevron${a?" rr-chevron--open":""}`,viewBox:"0 0 12 12",width:"12",height:"12",fill:"none","aria-hidden":!0,children:r.jsx("path",{d:"M4.25 3L7.75 6L4.25 9",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function m(a){return a==="channel"||a==="dm"||a==="neutral"?a:E(a)}function S(){return r.jsx("svg",{width:"9",height:"9",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M9.8 1.6 14.4 6.2a1 1 0 0 1-.2 1.6l-2.7 1.1-.9 3.4a.7.7 0 0 1-1.2.3L6.3 9.5 2.8 13 1.7 11.9l3.5-3.5L2.1 5.3a.7.7 0 0 1 .3-1.2l3.4-.9 1.1-2.7a1 1 0 0 1 1.6-.2Z"})})}export{q as R};
@@ -1 +1 @@
1
- import{r as o,j as n}from"./index-CZ-05hKz.js";/* empty css */import{D as O}from"./DataTable-6IDhanr5.js";import{p as W,a as L}from"./api-Co9aQ2Jw.js";import{t as U,n as R,f as Y}from"./time-Dhsh_2EG.js";import{u as G}from"./tail-events-BMQmSx1n.js";import{o as Q}from"./openContent-C6XO6kr5.js";import{u as X}from"./Provider-B2xuo3rf.js";/* empty css */import"./perf-PX8Rx0EP.js";import"./index-BWHgHrtv.js";import"./router-DJj2WbDg.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-BQ6t92tJ.js";import"./sse-CiOSzE5n.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BJIamJOH.js";import"./DocumentFocusViewer-DZVhS7as.js";import"./createLucideIcon-DXpqZP7I.js";import"./TextDocumentSurface-CKQP-cBT.js";import"./file-text-KijGBnME.js";import"./x-e3h2hDsp.js";import"./chevron-right-CzH-TaSF.js";import"./code-xml-Jtxsp5d1.js";import"./arrow-left-CghA0kTw.js";import"./arrow-right-iJFv3jNh.js";import"./scout-voice-BhPzrc6P.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-DFhAJkW3.js";import"./NewChatComposer-hlWT-nbR.js";import"./text-CnZ0e1-V.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-BiohlpM3.js";import"./conversation-model-CwF6Y9gx.js";import"./index-BVlMw8x_.js";import"./HarnessMark-D5CA5uSp.js";import"./NewChatOrigin-DdpzE4kz.js";import"./chevron-down-Mp9mu_yd.js";import"./search-D1tJSAWe.js";import"./chunk-HRAB3GC3-swV8PA2k.js";const q=1e4,J=500,$=1e3,Z=6e4,D="/api/tail/discover",_=`/api/tail/recent?limit=${J}`,P=3e4,tt=[{key:"status",label:"status",cls:"s-atop-col-status",kind:"text",sortable:!1,defaultWidth:96,minWidth:70,render:t=>n.jsxs("span",{className:`s-atop-status s-atop-status--${t.status}`,children:[n.jsx("span",{className:"s-atop-status-dot","aria-hidden":"true"}),t.statusLabel]})},{key:"session",label:"session",cls:"s-atop-col-agent",kind:"text",sortable:!1,defaultWidth:168,minWidth:110,maxWidth:280,render:t=>n.jsxs("div",{className:"s-atop-agent-cell",title:t.sessionId??t.refId,children:[n.jsx("span",{className:`s-atop-chip s-atop-chip--harness s-atop-chip--harness-${st(t.source)}`,children:t.source}),n.jsx("span",{className:"s-atop-agent-id",children:t.refId.slice(0,8)})]})},{key:"project",label:"project",cls:"s-atop-col-project",kind:"text",sortable:!1,defaultWidth:200,minWidth:96,maxWidth:360,render:t=>n.jsx("span",{title:t.cwd??t.project,children:t.project})},{key:"updated",label:"updated",cls:"s-atop-col-last",kind:"time",sortable:!1,defaultWidth:86,minWidth:64,render:t=>n.jsx("span",{title:Y(t.mtimeMs),children:U(Math.max(R(t.mtimeMs)??0,R(t.lastEvent?.ts)??0))||"-"})},{key:"size",label:"size",cls:"s-atop-col-runtime",kind:"number",sortable:!1,defaultWidth:80,minWidth:64,render:t=>nt(t.size)},{key:"path",label:"path",kind:"text",sortable:!1,defaultWidth:360,minWidth:160,maxWidth:800,render:t=>n.jsx("span",{title:t.transcriptPath,children:t.cwd??t.transcriptPath})}];function z(t){const i=t?.trim();if(!i)return null;const r=F(i);return r.endsWith(".jsonl")?r.slice(0,-6):r}function F(t){const i=t.replace(/[\\/]+$/,"");return i.split(/[\\/]/).filter(Boolean).at(-1)??i}function et(t){const r=t.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean);return r.pop(),r.at(-1)??""}function st(t){return t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function nt(t){if(!Number.isFinite(t)||t<0)return"-";if(t<1024)return`${t} B`;const i=t/1024;if(i<1024)return`${i.toFixed(i>=10?0:1)} KiB`;const r=i/1024;return`${r.toFixed(r>=10?0:1)} MiB`}function at(t,i){return i?[t.refId,t.sessionId??"",t.source,t.project,t.cwd??"",t.transcriptPath,t.lastEvent?.summary??"",t.process?.command??""].join(" ").toLowerCase().includes(i.toLowerCase()):!0}function B(t){return`${t.source}\0${t.cwd??""}`}function ot(t){return`${t.source}\0${t.cwd??""}`}function it(t,i,r){if(!t?.transcripts?.length)return[];const d=new Map;for(const s of i){const l=d.get(s.sessionId);(!l||s.ts>l.ts)&&d.set(s.sessionId,s)}const h=new Map;for(const s of t.processes){if(!s.cwd)continue;const l=h.get(B(s));(!l||s.pid<l.pid)&&h.set(B(s),s)}return t.transcripts.map(s=>{const l=z(s.sessionId)??z(s.transcriptPath);if(!l)return null;const u=s.sessionId?d.get(s.sessionId)??null:null,x=h.get(ot(s))??null,m=Math.max(s.mtimeMs,u?.ts??0),j=!!x||r-m<=Z,p=s.project?.trim()||(s.cwd?F(s.cwd):et(s.transcriptPath))||"unknown";return{refId:l,source:s.source||"unknown",project:p,cwd:s.cwd,transcriptPath:s.transcriptPath,sessionId:s.sessionId,mtimeMs:s.mtimeMs,size:s.size,status:j?"run":"idle",statusLabel:j?"active":"idle",lastEvent:u,process:x}}).filter(s=>s!==null).sort((s,l)=>{const u=Math.max(s.mtimeMs,s.lastEvent?.ts??0);return Math.max(l.mtimeMs,l.lastEvent?.ts??0)-u||s.project.localeCompare(l.project)})}function Gt({navigate:t}){const{route:i}=X(),[r]=o.useState(()=>W(D,P)),[d,h]=o.useState(r),[s,l]=o.useState(()=>W(_,P)?.events??[]),[u,x]=o.useState(r===null),[m,j]=o.useState(""),[p,S]=o.useState("all"),[y,k]=o.useState(0),[N,C]=o.useState(null),[T,V]=o.useState(Date.now()),b=o.useRef(null),I=o.useCallback(async()=>{C(null);try{h(await L(D))}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);o.useEffect(()=>{I();const e=setInterval(()=>{I()},q);return()=>clearInterval(e)},[I]),o.useEffect(()=>{let e=!1;return(async()=>{try{const a=await L(_);e||l(a.events??[])}catch{}})(),()=>{e=!0}},[]),G(e=>{l(a=>a.length>=$?[...a.slice(a.length-$+1),e]:[...a,e])}),o.useEffect(()=>{const e=setInterval(()=>V(Date.now()),15e3);return()=>clearInterval(e)},[]);const f=o.useMemo(()=>it(d,s,T),[d,s,T]),H=o.useMemo(()=>[...new Set(f.map(e=>e.source))].sort(),[f]),c=o.useMemo(()=>f.filter(e=>(p==="all"||e.source===p)&&at(e,m.trim())),[f,p,m]);o.useEffect(()=>{y>=c.length&&k(Math.max(0,c.length-1))},[c.length,y]);const M=o.useCallback(e=>{e&&Q(t,{view:"sessions",sessionId:e.refId},{returnTo:i})},[t,i]);o.useEffect(()=>{const e=a=>{const E=a.target,A=E instanceof HTMLInputElement||E instanceof HTMLTextAreaElement||(E?.isContentEditable??!1);if(a.key==="/"&&!A){a.preventDefault(),b.current?.focus();return}if(A){a.key==="Escape"&&E===b.current&&(j(""),b.current?.blur());return}if(a.key==="ArrowDown"||a.key==="j"){a.preventDefault(),k(w=>c.length===0?0:Math.min(c.length-1,w+1));return}if(a.key==="ArrowUp"||a.key==="k"){a.preventDefault(),k(w=>Math.max(0,w-1));return}(a.key==="Enter"||a.key==="o")&&(a.preventDefault(),M(c[y]))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[c,y,M]);const K=N?[]:c,g=o.useCallback(e=>`${e.source}:${e.transcriptPath}`,[]),v=o.useMemo(()=>new Map(c.map((e,a)=>[g(e),a])),[c,g]);return n.jsxs("div",{className:"s-atop s-atop--sessions",children:[n.jsxs("div",{className:"s-atop-fbar",children:[n.jsxs("label",{className:"s-atop-search",children:[n.jsx("span",{className:"s-atop-search-prompt",children:"/"}),n.jsx("input",{ref:b,className:"s-atop-search-input",placeholder:"filter sessions",value:m,onChange:e=>j(e.target.value)}),n.jsx("kbd",{className:"s-atop-search-kbd",children:"/"})]}),n.jsx("span",{className:"s-atop-fbar-label",children:"source"}),n.jsxs("button",{type:"button",className:`s-atop-pill${p==="all"?" s-atop-pill--on":""}`,onClick:()=>S("all"),children:["all",n.jsx("span",{className:"s-atop-pill-ct",children:f.length})]}),H.map(e=>n.jsxs("button",{type:"button",className:`s-atop-pill${p===e?" s-atop-pill--on":""}`,onClick:()=>S(e),children:[e,n.jsx("span",{className:"s-atop-pill-ct",children:f.filter(a=>a.source===e).length})]},e)),n.jsx("div",{className:"s-atop-fbar-spacer"})]}),n.jsx(O,{rows:K,columns:tt,rowId:g,storageKey:"openscout.sessions.cols",rowBindings:e=>({onMouseEnter:()=>{const a=v.get(e);a!=null&&k(a)},onFocus:()=>{const a=v.get(e);a!=null&&k(a)}}),onRowClick:e=>M(e),rowClassName:e=>v.get(g(e))===y?"s-atop-row--selected":void 0,empty:N?{title:"Discovery failed",body:N}:{title:"No raw sessions",body:m?"No sessions match the current filter.":"No transcript sessions were discovered."},loading:u,density:"compact",className:"s-atop-data-table",ariaLabel:"Raw sessions"}),n.jsxs("div",{className:"s-atop-keys",children:[n.jsxs("span",{children:[n.jsx("kbd",{children:"/"}),"filter"]}),n.jsxs("span",{children:[n.jsx("kbd",{children:"j/k"}),"select"]}),n.jsxs("span",{children:[n.jsx("kbd",{children:"enter"}),"open"]}),n.jsx("span",{className:"s-atop-keys-spacer"}),n.jsxs("span",{className:"s-atop-keys-count",children:[n.jsx("strong",{children:c.length})," sessions"]})]})]})}export{Gt as RawSessionsTable};
1
+ import{r as o,j as n}from"./index-DvLtl7rV.js";/* empty css */import{D as O}from"./DataTable-Bp8tU9AK.js";import{p as W,a as L}from"./api-Co9aQ2Jw.js";import{t as U,n as R,f as Y}from"./time-Dhsh_2EG.js";import{u as G}from"./tail-events-Ps8KpKah.js";import{o as Q}from"./openContent-C6XO6kr5.js";import{u as X}from"./Provider-CtXJeLrP.js";/* empty css */import"./perf-PX8Rx0EP.js";import"./index-BWHgHrtv.js";import"./router-B9vQkNJL.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-BQ6t92tJ.js";import"./sse-CD9MMUxl.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BJIamJOH.js";import"./DocumentFocusViewer-Do3wQ_3Z.js";import"./createLucideIcon-DezKXSG2.js";import"./TextDocumentSurface-BflAwXeZ.js";import"./file-text-CqJgwxmv.js";import"./x-CAbNespN.js";import"./chevron-right-D-HdlPg8.js";import"./code-xml-D7pOQM9l.js";import"./arrow-left-Czpf-AE4.js";import"./arrow-right-BuzMnLYP.js";import"./scout-voice-BVUqGhth.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-BLYDhL3Z.js";import"./NewChatComposer-_Stj0fZy.js";import"./text-BP3oyl8-.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-pM56HNhR.js";import"./conversation-model-Dc02NsGp.js";import"./index-zvhpRHao.js";import"./HarnessMark-B979GCSB.js";import"./NewChatOrigin-B1u7ki70.js";import"./chevron-down-wciXnOQz.js";import"./search-CDko0PKE.js";import"./chunk-HRAB3GC3-Tyv9rzx7.js";const q=1e4,J=500,$=1e3,Z=6e4,D="/api/tail/discover",_=`/api/tail/recent?limit=${J}`,P=3e4,tt=[{key:"status",label:"status",cls:"s-atop-col-status",kind:"text",sortable:!1,defaultWidth:96,minWidth:70,render:t=>n.jsxs("span",{className:`s-atop-status s-atop-status--${t.status}`,children:[n.jsx("span",{className:"s-atop-status-dot","aria-hidden":"true"}),t.statusLabel]})},{key:"session",label:"session",cls:"s-atop-col-agent",kind:"text",sortable:!1,defaultWidth:168,minWidth:110,maxWidth:280,render:t=>n.jsxs("div",{className:"s-atop-agent-cell",title:t.sessionId??t.refId,children:[n.jsx("span",{className:`s-atop-chip s-atop-chip--harness s-atop-chip--harness-${st(t.source)}`,children:t.source}),n.jsx("span",{className:"s-atop-agent-id",children:t.refId.slice(0,8)})]})},{key:"project",label:"project",cls:"s-atop-col-project",kind:"text",sortable:!1,defaultWidth:200,minWidth:96,maxWidth:360,render:t=>n.jsx("span",{title:t.cwd??t.project,children:t.project})},{key:"updated",label:"updated",cls:"s-atop-col-last",kind:"time",sortable:!1,defaultWidth:86,minWidth:64,render:t=>n.jsx("span",{title:Y(t.mtimeMs),children:U(Math.max(R(t.mtimeMs)??0,R(t.lastEvent?.ts)??0))||"-"})},{key:"size",label:"size",cls:"s-atop-col-runtime",kind:"number",sortable:!1,defaultWidth:80,minWidth:64,render:t=>nt(t.size)},{key:"path",label:"path",kind:"text",sortable:!1,defaultWidth:360,minWidth:160,maxWidth:800,render:t=>n.jsx("span",{title:t.transcriptPath,children:t.cwd??t.transcriptPath})}];function z(t){const i=t?.trim();if(!i)return null;const r=F(i);return r.endsWith(".jsonl")?r.slice(0,-6):r}function F(t){const i=t.replace(/[\\/]+$/,"");return i.split(/[\\/]/).filter(Boolean).at(-1)??i}function et(t){const r=t.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean);return r.pop(),r.at(-1)??""}function st(t){return t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function nt(t){if(!Number.isFinite(t)||t<0)return"-";if(t<1024)return`${t} B`;const i=t/1024;if(i<1024)return`${i.toFixed(i>=10?0:1)} KiB`;const r=i/1024;return`${r.toFixed(r>=10?0:1)} MiB`}function at(t,i){return i?[t.refId,t.sessionId??"",t.source,t.project,t.cwd??"",t.transcriptPath,t.lastEvent?.summary??"",t.process?.command??""].join(" ").toLowerCase().includes(i.toLowerCase()):!0}function B(t){return`${t.source}\0${t.cwd??""}`}function ot(t){return`${t.source}\0${t.cwd??""}`}function it(t,i,r){if(!t?.transcripts?.length)return[];const d=new Map;for(const s of i){const l=d.get(s.sessionId);(!l||s.ts>l.ts)&&d.set(s.sessionId,s)}const h=new Map;for(const s of t.processes){if(!s.cwd)continue;const l=h.get(B(s));(!l||s.pid<l.pid)&&h.set(B(s),s)}return t.transcripts.map(s=>{const l=z(s.sessionId)??z(s.transcriptPath);if(!l)return null;const u=s.sessionId?d.get(s.sessionId)??null:null,x=h.get(ot(s))??null,m=Math.max(s.mtimeMs,u?.ts??0),j=!!x||r-m<=Z,p=s.project?.trim()||(s.cwd?F(s.cwd):et(s.transcriptPath))||"unknown";return{refId:l,source:s.source||"unknown",project:p,cwd:s.cwd,transcriptPath:s.transcriptPath,sessionId:s.sessionId,mtimeMs:s.mtimeMs,size:s.size,status:j?"run":"idle",statusLabel:j?"active":"idle",lastEvent:u,process:x}}).filter(s=>s!==null).sort((s,l)=>{const u=Math.max(s.mtimeMs,s.lastEvent?.ts??0);return Math.max(l.mtimeMs,l.lastEvent?.ts??0)-u||s.project.localeCompare(l.project)})}function Gt({navigate:t}){const{route:i}=X(),[r]=o.useState(()=>W(D,P)),[d,h]=o.useState(r),[s,l]=o.useState(()=>W(_,P)?.events??[]),[u,x]=o.useState(r===null),[m,j]=o.useState(""),[p,S]=o.useState("all"),[y,k]=o.useState(0),[N,C]=o.useState(null),[T,V]=o.useState(Date.now()),b=o.useRef(null),I=o.useCallback(async()=>{C(null);try{h(await L(D))}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);o.useEffect(()=>{I();const e=setInterval(()=>{I()},q);return()=>clearInterval(e)},[I]),o.useEffect(()=>{let e=!1;return(async()=>{try{const a=await L(_);e||l(a.events??[])}catch{}})(),()=>{e=!0}},[]),G(e=>{l(a=>a.length>=$?[...a.slice(a.length-$+1),e]:[...a,e])}),o.useEffect(()=>{const e=setInterval(()=>V(Date.now()),15e3);return()=>clearInterval(e)},[]);const f=o.useMemo(()=>it(d,s,T),[d,s,T]),H=o.useMemo(()=>[...new Set(f.map(e=>e.source))].sort(),[f]),c=o.useMemo(()=>f.filter(e=>(p==="all"||e.source===p)&&at(e,m.trim())),[f,p,m]);o.useEffect(()=>{y>=c.length&&k(Math.max(0,c.length-1))},[c.length,y]);const M=o.useCallback(e=>{e&&Q(t,{view:"sessions",sessionId:e.refId},{returnTo:i})},[t,i]);o.useEffect(()=>{const e=a=>{const E=a.target,A=E instanceof HTMLInputElement||E instanceof HTMLTextAreaElement||(E?.isContentEditable??!1);if(a.key==="/"&&!A){a.preventDefault(),b.current?.focus();return}if(A){a.key==="Escape"&&E===b.current&&(j(""),b.current?.blur());return}if(a.key==="ArrowDown"||a.key==="j"){a.preventDefault(),k(w=>c.length===0?0:Math.min(c.length-1,w+1));return}if(a.key==="ArrowUp"||a.key==="k"){a.preventDefault(),k(w=>Math.max(0,w-1));return}(a.key==="Enter"||a.key==="o")&&(a.preventDefault(),M(c[y]))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[c,y,M]);const K=N?[]:c,g=o.useCallback(e=>`${e.source}:${e.transcriptPath}`,[]),v=o.useMemo(()=>new Map(c.map((e,a)=>[g(e),a])),[c,g]);return n.jsxs("div",{className:"s-atop s-atop--sessions",children:[n.jsxs("div",{className:"s-atop-fbar",children:[n.jsxs("label",{className:"s-atop-search",children:[n.jsx("span",{className:"s-atop-search-prompt",children:"/"}),n.jsx("input",{ref:b,className:"s-atop-search-input",placeholder:"filter sessions",value:m,onChange:e=>j(e.target.value)}),n.jsx("kbd",{className:"s-atop-search-kbd",children:"/"})]}),n.jsx("span",{className:"s-atop-fbar-label",children:"source"}),n.jsxs("button",{type:"button",className:`s-atop-pill${p==="all"?" s-atop-pill--on":""}`,onClick:()=>S("all"),children:["all",n.jsx("span",{className:"s-atop-pill-ct",children:f.length})]}),H.map(e=>n.jsxs("button",{type:"button",className:`s-atop-pill${p===e?" s-atop-pill--on":""}`,onClick:()=>S(e),children:[e,n.jsx("span",{className:"s-atop-pill-ct",children:f.filter(a=>a.source===e).length})]},e)),n.jsx("div",{className:"s-atop-fbar-spacer"})]}),n.jsx(O,{rows:K,columns:tt,rowId:g,storageKey:"openscout.sessions.cols",rowBindings:e=>({onMouseEnter:()=>{const a=v.get(e);a!=null&&k(a)},onFocus:()=>{const a=v.get(e);a!=null&&k(a)}}),onRowClick:e=>M(e),rowClassName:e=>v.get(g(e))===y?"s-atop-row--selected":void 0,empty:N?{title:"Discovery failed",body:N}:{title:"No raw sessions",body:m?"No sessions match the current filter.":"No transcript sessions were discovered."},loading:u,density:"compact",className:"s-atop-data-table",ariaLabel:"Raw sessions"}),n.jsxs("div",{className:"s-atop-keys",children:[n.jsxs("span",{children:[n.jsx("kbd",{children:"/"}),"filter"]}),n.jsxs("span",{children:[n.jsx("kbd",{children:"j/k"}),"select"]}),n.jsxs("span",{children:[n.jsx("kbd",{children:"enter"}),"open"]}),n.jsx("span",{className:"s-atop-keys-spacer"}),n.jsxs("span",{className:"s-atop-keys-count",children:[n.jsx("strong",{children:c.length})," sessions"]})]})]})}export{Gt as RawSessionsTable};
@@ -0,0 +1 @@
1
+ import{r as n,j as e}from"./index-DvLtl7rV.js";import{h as ot}from"./router-B9vQkNJL.js";import{k as bs,u as Rt,l as gs,n as nt,o as rt,a as vs,p as be,q as Vt,s as Ss,r as Mt}from"./Provider-CtXJeLrP.js";import{H as ks,A as ws,V as Gt,a as Yt,S as ys,b as js,m as qt,o as Ns,c as Cs,d as Jt,e as Qt}from"./agent-autocomplete-B-5QTeas.js";import{a as H}from"./api-Co9aQ2Jw.js";import{c as De}from"./clipboard-e3fSpeo7.js";import{e as Es}from"./credentials-BTce3VP1.js";import{b as Lt,u as Ts,a as ge}from"./persistent-state-EHXw8WNy.js";import{s as ue,e as Is,S as At}from"./scoutbot-BJIamJOH.js";import{g as _s,b as Rs,c as Vs,i as Ms,e as Ls,s as As}from"./scout-voice-BVUqGhth.js";import{d as Ps,f as Pt,n as Se}from"./time-Dhsh_2EG.js";import{S as Os}from"./scoutbot-markdown-BQ_Ee2Ic.js";import{L as K}from"./loader-circle-pM56HNhR.js";import{P as Xt}from"./plus-Co-dqKul.js";import{C as Ke}from"./chevron-down-wciXnOQz.js";import{c as Kt}from"./createLucideIcon-DezKXSG2.js";import{S as Zt,a as es}from"./text-BP3oyl8-.js";import{S as zs}from"./send-horizontal-CSjIm6xg.js";import{C as $s}from"./copy-CWWAJ75H.js";import{u as ts}from"./use-reduced-motion-x8pJMVrG.js";import{R as Ot}from"./rocket-BQm5_CvR.js";import{X as Ds}from"./x-CAbNespN.js";import{R as Bs}from"./refresh-cw-DMxGzDwn.js";import{S as Us}from"./settings-Dyvpkb1D.js";import{V as zt}from"./fx-z37u1o2z.js";import{B as Fs}from"./bot-rd0awxD3.js";import{d as Hs}from"./types-B0PlfpKc.js";const Ws=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Gs=Kt("archive",Ws);const Ys=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],qs=Kt("circle-check",Ys),Js=new Set(["air-local","local","mini","node"]),Qs=new Set(["main","master","trunk"]);function Xs(t){return t.replace(/```[\s\S]*?```/g," code omitted ").replace(/\*\*([^*\n]+)\*\*/g,"$1").replace(/(^|[\s(])\*([^\s*][^*\n]*?[^\s*]|[^\s*])\*(?=[\s)\].,!?;:]|$)/g,"$1$2").replace(/(^|[\s(])_([^\s_][^_\n]*?[^\s_]|[^\s_])_(?=[\s)\].,!?;:]|$)/g,"$1$2").replace(/^\s*[-*]\s+/gm,"").replace(/\bhttps?:\/\/[^\s)]+/gi,o=>Ks(o)).replace(/\b(session|conversation|message|flight|invocation|work)(?:\s+(?:id|ref))?\s*[:#]?\s+([a-z0-9][a-z0-9._:-]{9,})\b/gi,(o,a,i)=>`${a.toLowerCase()} ending in ${Ze(i)}`).replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,o=>`ID ending in ${Ze(o)}`).replace(/@?([a-z][a-z0-9-]*(?:\.[a-z0-9][a-z0-9-]*){2,})\b/gi,(o,a)=>Zs(o)?o:eo(a)).replace(/`([^`]+)`/g,(o,a)=>to(a)).replace(/\s+/g," ").trim()}function Ks(t){try{return new URL(t).hostname.replace(/^www\./,"").replace(/\./g," dot ")}catch{return"link"}}function Zs(t){const o=t.replace(/^@/,"").toLowerCase();return/\.(com|app|dev|org|net|io|local)(?:\b|\/)/.test(o)&&!o.endsWith(".air-local")}function eo(t){const o=t.split(".").filter(Boolean);if(o.length<2)return t;const a=[...o];for(;a.length>1&&Js.has(a.at(-1).toLowerCase());)a.pop();const[i,...c]=a,d=c.filter(p=>!Qs.has(p.toLowerCase())).map(et).filter(Boolean);return[et(i),...d].filter(Boolean).join(", ")}function to(t){return/^[a-z0-9][a-z0-9._:-]{12,}$/i.test(t)?`ID ending in ${Ze(t)}`:et(t)}function Ze(t){return(t.replace(/[^a-z0-9]/gi,"").slice(-4)||t.slice(-4)).split("").join(" ")}function et(t){return t.replace(/^@/,"").replace(/[_./:-]+/g," ").replace(/\s+/g," ").trim()}function so({state:t,chatExpanded:o,onToggleExpanded:a,sessionPickerOpen:i,onToggleSessionPicker:c,onStartNewChat:d,startingNewChat:p,onSwitchSession:j,switchingSessionId:N,sending:g,briefing:M,pendingAsk:C,onArchiveSession:f,archivingSessionId:b,onAssistantContextMenu:h,suggestedPrompts:_,onSelectPrompt:y}){const I=t.session.messages,E=o?I:I.slice(-4),k=o?0:Math.max(0,I.length-E.length),w=I.length,S=t.sessions.length,u=t.retention,T=I.length===0&&!C&&!g&&!M,P=p||g||M||!!N||!!b,W=t.session.createdAt?Ps(t.session.createdAt):null,R=T?"Scout conversation":t.session.title&&t.session.title!=="New Scout Session"?t.session.title:`Session ${t.session.id.slice(0,8)}`,O=n.useRef(null),G=I[I.length-1]?.id??null,Y=I[I.length-1]?.body??"";return n.useEffect(()=>{const x=O.current;x&&(x.scrollTop=x.scrollHeight)},[G,Y,C,g,o,t.session.id]),e.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-hidden rounded border border-[var(--scout-chrome-border-soft)] bg-black/10 font-mono text-xs text-[var(--scout-chrome-ink-faint)]",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-[var(--scout-chrome-border-soft)] px-2.5 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"min-w-0 truncate text-[var(--scout-chrome-ink)]",title:t.session.id,children:R}),W&&!T&&e.jsxs("span",{className:"shrink-0 text-[var(--scout-chrome-ink-ghost)]",children:["· ",W]}),!T&&e.jsxs("span",{className:"shrink-0 text-[var(--scout-chrome-ink-ghost)]",children:["· ",w," msg",w===1?"":"s"]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsxs("button",{type:"button",title:"Start a new chat (keeps this chat in Chats)","aria-label":"Start new chat",onClick:d,disabled:P,className:"flex items-center gap-1 rounded border border-lime-300/30 bg-lime-300/[0.06] px-1.5 py-0.5 text-2xs uppercase tracking-[0.1em] text-lime-100 transition-colors hover:border-lime-300/50 hover:bg-lime-300/10 disabled:cursor-not-allowed disabled:opacity-40",children:[p?e.jsx(K,{size:10,className:"animate-spin"}):e.jsx(Xt,{size:10}),e.jsx("span",{children:p?"Starting":"New chat"})]}),e.jsxs("button",{type:"button",title:`Switch chat (${S} total)`,"aria-label":"Switch chat",onClick:c,className:`flex items-center gap-1 rounded border px-1.5 py-0.5 text-2xs uppercase tracking-[0.1em] transition-colors ${i?"border-lime-300/40 bg-lime-300/10 text-lime-100":"border-[var(--scout-chrome-border-soft)] text-[var(--scout-chrome-ink-faint)] hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]"}`,children:[e.jsx(ks,{size:10}),e.jsx("span",{children:"Chats"}),e.jsx("span",{className:"text-[var(--scout-chrome-ink-ghost)]",children:S}),e.jsx(Ke,{size:9,className:i?"rotate-180 transition-transform":"transition-transform"})]}),w>4&&e.jsxs("button",{type:"button",title:o?"Collapse chat":"View full session","aria-label":o?"Collapse chat":"View full session",onClick:a,className:"flex items-center gap-1 rounded border border-[var(--scout-chrome-border-soft)] px-1.5 py-0.5 text-2xs uppercase tracking-[0.1em] text-[var(--scout-chrome-ink-faint)] transition-colors hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]",children:[e.jsx("span",{children:o?"Collapse":"Full"}),o?e.jsx(bs,{size:9}):e.jsx(Ke,{size:9})]})]})]}),i&&e.jsxs("div",{className:"shrink-0 border-b border-[var(--scout-chrome-border-soft)] px-2 py-1.5",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2 px-0.5 text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-ghost)]",children:[e.jsx("span",{children:"Recent chats"}),u&&u.archivedCount>0&&e.jsxs("span",{children:[u.archivedCount," archived"]})]}),e.jsx("div",{className:"flex max-h-40 flex-col gap-0.5 overflow-y-auto pr-0.5",children:t.sessions.map(x=>{const U=x.id===t.session.id,Z=N===x.id,F=b===x.id,L=Pt(x.updatedAt)||"unknown",z=x.title&&x.title!=="New Scout Session"?x.title:`Session ${x.id.slice(0,8)}`;return e.jsxs("div",{className:`flex items-center gap-2 rounded border px-2 py-1 text-left transition-colors ${U?"border-lime-300/40 bg-lime-300/[0.06] text-lime-100":"border-transparent text-[var(--scout-chrome-ink-faint)] hover:border-[var(--scout-chrome-border-soft)] hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]"}`,children:[e.jsxs("button",{type:"button",onClick:()=>{U||j(x.id)},disabled:U||!!N||!!b,className:"flex min-w-0 flex-1 items-center gap-2 text-left disabled:cursor-not-allowed disabled:opacity-40",children:[e.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${U?"bg-lime-300":"bg-[var(--scout-chrome-ink-ghost)]"}`}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-[var(--scout-chrome-ink)]",children:z}),e.jsxs("span",{className:"shrink-0 text-2xs text-[var(--scout-chrome-ink-ghost)]",children:[x.messageCount," msg"]}),e.jsx("span",{className:"shrink-0 text-2xs text-[var(--scout-chrome-ink-ghost)]",children:L}),Z&&e.jsx(K,{size:10,className:"shrink-0 animate-spin text-lime-200"})]}),e.jsx("button",{type:"button",title:"Archive chat","aria-label":`Archive chat ${z}`,onClick:()=>f(x.id),disabled:!!N||!!b,className:"flex h-5 w-5 shrink-0 items-center justify-center rounded border border-transparent text-[var(--scout-chrome-ink-ghost)] transition-colors hover:border-[var(--scout-chrome-border-soft)] hover:bg-black/20 hover:text-[var(--scout-chrome-ink)] disabled:cursor-not-allowed disabled:opacity-30",children:F?e.jsx(K,{size:10,className:"animate-spin"}):e.jsx(Gs,{size:10})})]},x.id)})})]}),e.jsxs("div",{ref:O,className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto px-2.5 py-2",children:[k>0&&e.jsxs("button",{type:"button",onClick:a,className:"self-start text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-ghost)] hover:text-[var(--scout-chrome-ink)]",children:["↑ ",k," earlier message",k===1?"":"s"]}),T&&e.jsx(oo,{suggestedPrompts:_,onSelectPrompt:y}),E.map((x,U)=>{const Z=ao(E[U-1],x),F=io(x.createdAt);return e.jsxs("div",{className:"flex flex-col gap-1",children:[Z&&e.jsx("div",{className:"self-center rounded-full bg-white/[0.06] px-2.5 py-0.5 font-mono text-2xs font-medium text-[var(--scout-chrome-ink-ghost)]",title:Pt(x.createdAt),"aria-label":F,children:F}),e.jsx($t,{role:x.role,body:x.body,onContextMenu:x.role==="assistant"&&h?L=>h(L,x.body):void 0})]},x.id)}),C&&e.jsx($t,{role:"user",body:C,pending:!0}),g&&!C&&e.jsx("p",{className:"text-[var(--scout-chrome-ink-ghost)]",children:"Reading the control plane…"}),M&&e.jsxs("div",{className:"flex items-center gap-2 rounded border border-lime-300/30 bg-lime-300/[0.06] px-2.5 py-2 font-mono text-xs leading-relaxed text-lime-100",children:[e.jsx(K,{size:12,className:"shrink-0 animate-spin text-lime-300","aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0 flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-xs uppercase tracking-[0.14em] text-lime-300",children:"Briefing"}),e.jsx("span",{className:"text-[var(--scout-chrome-ink)]",children:"Codex is reviewing the control-plane snapshot. Voice will pick up when it lands."})]})]})]})]})}function oo({suggestedPrompts:t=[],onSelectPrompt:o}){return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col justify-start gap-2 px-1 py-2.5",children:[t.length>0?e.jsx("div",{className:"grid gap-1",children:t.slice(0,3).map(a=>e.jsx("button",{type:"button",onClick:()=>o?.(a),className:"min-h-7 truncate rounded border border-[var(--scout-chrome-border-soft)] bg-black/10 px-2.5 text-left font-mono text-xs leading-snug text-[var(--scout-chrome-ink-faint)] transition-colors hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]",children:a},a))}):null,e.jsxs("div",{className:"max-w-[30rem]",children:[e.jsx("div",{className:"font-sans text-lg font-semibold leading-tight text-[var(--scout-chrome-ink)]",children:"Start with a question."}),e.jsx("p",{className:"mt-0.5 font-sans text-xs leading-snug text-[var(--scout-chrome-ink-faint)]",children:"Paste a failed result or ask about what you are seeing. Scout replies when you ask."})]})]})}function no({agents:t,draft:o,onDraftChange:a,onSubmit:i,sending:c,recording:d,voiceLabel:p,voiceBusy:j,voiceUnavailable:N,voiceHeld:g=!1,onMicClick:M,prominent:C=!1,autoFocus:f,focusSignal:b}){const h=n.useRef(null),_=n.useCallback(()=>{const E=h.current;E&&(E.textarea?E.textarea.focus({preventScroll:!0}):E.focus())},[]);n.useEffect(()=>{f&&_()},[f,_]),n.useEffect(()=>{b&&_()},[b,_]);let y="Start talking";N&&(y="Set up Scout voice"),d&&(y="Stop talking"),(j||g)&&(y=p);const v=j||d||g,I=["w-full resize-none rounded border font-mono text-sm leading-relaxed text-[var(--scout-chrome-ink)] placeholder:text-[var(--scout-chrome-ink-ghost)]",C?"min-h-[88px] max-h-[170px] border-lime-300/30 bg-black/25 px-3 py-2 text-md":"min-h-[44px] max-h-[124px] border-[var(--scout-chrome-border-soft)] bg-black/20 px-2 py-1.5"].join(" ");return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:E=>{E.preventDefault(),i()},children:[e.jsx(ws,{ref:h,agents:t,value:o,onChange:a,onSubmit:()=>{o.trim()&&!c&&i()},placeholder:g?"Type while live voice is on…":C?"Ask Scout about what you are seeing…":"Ask Scout…",rows:C?4:2,disabled:c,submitOnEnter:!0,className:"min-w-0",textareaClassName:I}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("button",{type:"button",title:y,"aria-label":y,onClick:M,disabled:c||j||g,className:`flex h-8 items-center justify-center rounded border transition-colors disabled:cursor-not-allowed disabled:opacity-40 ${d?"border-lime-300/50 bg-lime-300/10 text-lime-200":g?"border-lime-300/25 bg-lime-300/[0.05] text-lime-100/70":"border-[var(--scout-chrome-border-soft)] text-[var(--scout-chrome-ink-faint)] hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]"} ${v?"gap-1.5 px-3 font-mono text-xs uppercase tracking-[0.12em]":"w-9"}`,children:[j?e.jsx(K,{size:13,className:"animate-spin"}):d?e.jsx(Zt,{size:12,className:"fill-current"}):e.jsx(es,{size:13}),v&&e.jsx("span",{className:"truncate",children:p})]}),e.jsx("button",{type:"submit",title:"Send","aria-label":"Send",disabled:!o.trim()||c,className:"flex h-8 w-9 items-center justify-center rounded bg-lime-300/90 text-black transition-opacity disabled:cursor-not-allowed disabled:opacity-40",children:c?e.jsx(K,{size:13,className:"animate-spin"}):e.jsx(zs,{size:13})})]})]})}function $t({role:t,body:o,pending:a=!1,onContextMenu:i}){const c=t==="user",d=c?o:ue(o),[p,j]=n.useState(!1),N=n.useCallback(()=>{De(d).then(()=>{j(!0),window.setTimeout(()=>j(!1),1200)}).catch(()=>{})},[d]);return e.jsxs("div",{className:"group flex flex-col gap-0.5",onContextMenu:i,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("span",{className:`text-2xs uppercase tracking-[0.12em] ${c?"text-[var(--scout-chrome-ink-ghost)]":"text-lime-300"}`,children:[c?"You":"Reply",a&&" · sending"]}),e.jsx("button",{type:"button",title:p?"Copied":"Copy message","aria-label":p?"Copied message":"Copy message",disabled:a||!d.trim(),onClick:N,className:"flex h-5 w-5 shrink-0 items-center justify-center rounded border border-[var(--scout-chrome-border-soft)] text-[var(--scout-chrome-ink-ghost)] opacity-70 transition hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)] disabled:cursor-not-allowed disabled:opacity-20 group-hover:opacity-100",children:p?e.jsx(qs,{size:11}):e.jsx($s,{size:11})})]}),c?e.jsx("p",{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-[var(--scout-chrome-ink)] ${a?"opacity-60":""}`,children:d}):e.jsx("div",{className:a?"opacity-60":"",children:e.jsx(Os,{text:d})})]})}const ro=5*6e4;function ao(t,o){if(!t||!tt(t.createdAt,o.createdAt))return!0;const a=Se(t.createdAt),i=Se(o.createdAt);return a===null||i===null?!0:Math.abs(i-a)>=ro}function tt(t,o){const a=Se(t),i=Se(o);if(a===null||i===null)return!1;const c=new Date(a),d=new Date(i);return c.getFullYear()===d.getFullYear()&&c.getMonth()===d.getMonth()&&c.getDate()===d.getDate()}function io(t){const o=Se(t);if(o===null)return"";const a=new Date(o),i=new Date,c=new Date(i);c.setDate(i.getDate()-1);const d=a.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return tt(o,i.getTime())?`Today ${d}`:tt(o,c.getTime())?`Yesterday ${d}`:a.getFullYear()===i.getFullYear()?`${a.toLocaleDateString([],{month:"short",day:"numeric"})} ${d}`:`${a.toLocaleDateString([],{month:"short",day:"numeric",year:"numeric"})} ${d}`}const co={"--scout-chrome-bg":"#f3f0e9","--scout-chrome-ink":"#2a2d2f","--scout-chrome-ink-strong":"#171a1c","--scout-chrome-ink-faint":"#6f716e","--scout-chrome-ink-ghost":"#9b9a94","--scout-chrome-border-soft":"#d9d4ca","--scout-chrome-hover":"#e9e5dc","--scout-chrome-active":"#ded8cc","--scout-accent":"#b58a3f"},Dt=[2,4,7,5,3,6,9,5,3,4,8,6,3,5,9,6,3,5,7,4,2,4,6,3],lo=Dt.map((t,o)=>{const a=o/Dt.length*Math.PI*2-Math.PI/2,i=24-t/2,c=24+t/2;return{x1:36+Math.cos(a)*i,y1:36+Math.sin(a)*i,x2:36+Math.cos(a)*c,y2:36+Math.sin(a)*c}});function uo({recording:t,sending:o,speaking:a,voiceAvailable:i,voiceProbeState:c,voiceState:d}){return a?"speaking":o?"thinking":t&&d==="processing"?"processing":t?"listening":c!=="idle"||d==="starting"||i===null?"checking":i===!1?"unavailable":"ready"}const mo={checking:{label:"Getting voice ready",helper:"Checking your microphone and speech services"},unavailable:{label:"Voice is offline",helper:"Tap to reconnect"},listening:{label:"Listening",helper:"Tap to finish your turn"},processing:{label:"Transcribing",helper:"Turning speech into text"},thinking:{label:"Scout is thinking",helper:"Your turn is in"},speaking:{label:"Scout is speaking",helper:"Tap to interrupt"},ready:{label:"Ready to listen",helper:"Tap to speak"}};function ho(t){switch(t){case"listening":return"Finish and send voice turn";case"speaking":return"Stop spoken reply";case"unavailable":return"Retry voice connection";case"checking":return"Checking voice";case"processing":return"Transcribing voice turn";case"thinking":return"Scout is thinking";case"ready":return"Start voice turn"}}function po(t){return t==="listening"||t==="processing"?"listen":t==="thinking"?"think":t==="speaking"?"speak":null}function xo({phase:t,disabled:o,onClick:a}){const i=ts(),c=t==="listening"||t==="speaking",d=ho(t);return e.jsx(qt.div,{animate:c&&!i?{scale:[1,1.025,1]}:{scale:1},transition:c&&!i?{duration:2.2,ease:"easeInOut",repeat:1/0}:{duration:.18},children:e.jsx("button",{type:"button",onClick:a,disabled:o,"aria-label":d,title:d,className:"group grid h-28 w-28 place-items-center rounded-full border border-[#d4cfc5] bg-white text-[#232729] shadow-[0_14px_34px_rgba(55,48,38,0.12)] outline-none transition-[border-color,box-shadow,transform] duration-200 hover:border-[#b9b2a6] hover:shadow-[0_17px_38px_rgba(55,48,38,0.16)] focus-visible:ring-2 focus-visible:ring-[#9c7736] focus-visible:ring-offset-4 focus-visible:ring-offset-[#f3f0e9] active:scale-[0.98] disabled:cursor-wait disabled:opacity-65",children:e.jsxs("svg",{viewBox:"0 0 72 72",className:"h-[72px] w-[72px]","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"24",fill:"none",stroke:"#d2cec6",strokeWidth:"0.8"}),lo.map((p,j)=>e.jsx("line",{x1:p.x1,y1:p.y1,x2:p.x2,y2:p.y2,stroke:c?"#817b71":"#a5a198",strokeWidth:"1.15",strokeLinecap:"round"},j)),e.jsx("circle",{cx:"36",cy:"36",r:"7.5",fill:c?"#b98a3b":"#d3b16d"})]})})})}const fo=[{id:"listen",label:"Listen"},{id:"think",label:"Think"},{id:"speak",label:"Speak"}];function bo({messages:t,pendingAsk:o,partial:a,error:i,status:c,recording:d,sending:p,speaking:j,voiceAvailable:N,voiceInputSource:g,voiceProbeState:M,voiceState:C,voiceReplies:f,settingsOpen:b,setupPanel:h,settingsPanel:_,assistantModel:y,onPrimaryAction:v,onToggleVoiceReplies:I,onToggleSettings:E,onNewChat:k,onOpenLive:w}){const S=ts(),u=n.useRef(null),T=uo({recording:d,sending:p,speaking:j,voiceAvailable:N,voiceProbeState:M,voiceState:C}),P=mo[T],W=T==="checking"||T==="processing"||T==="thinking",R=g??(N===!0?"Default input from Scout Menu":"Checking microphone…"),O=t.slice(-12),G=a||(p&&O.at(-1)?.body!==o?o:null),Y=O.length===0&&!G,x=po(T),U=y?.trim()||"Turn-based voice",Z=N===!1?"Mic offline":N===null?"Checking mic":"Mic active",F=T==="unavailable"?"bg-[#a25549]":T==="ready"||T==="checking"?"bg-[#a7a49d]":"bg-[#b58a3f]";return n.useEffect(()=>{u.current?.scrollIntoView({block:"nearest"})},[t.length,o]),e.jsxs("section",{className:"relative flex h-full min-h-0 w-full flex-col overflow-hidden bg-[#f3f0e9] text-[#2a2d2f]",style:co,"aria-label":"Direct voice conversation",children:[e.jsxs("header",{className:"flex min-h-14 shrink-0 items-center justify-between gap-2 border-b border-[#d9d4ca] px-3 py-2.5 sm:gap-4 sm:px-7",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("h1",{className:"truncate font-[var(--font-accent-title)] text-[15px] font-semibold tracking-[-0.018em] text-[#171a1c] sm:text-[17px]",children:"Direct Voice"}),e.jsx("span",{className:"hidden h-4 w-px bg-[#d6d1c7] sm:block","aria-hidden":"true"}),e.jsxs("div",{className:"hidden min-w-0 items-center gap-2 sm:flex","aria-live":"polite",children:[e.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${F}`,"aria-hidden":"true"}),e.jsx("span",{className:"truncate text-xs text-[#6f716e]",children:P.label})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 sm:gap-2",children:[e.jsxs("div",{className:"flex rounded-md border border-[#cbc5ba] bg-[#e8e3da] p-0.5",role:"tablist","aria-label":"Voice mode",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":"true",className:"rounded-[4px] bg-[#202426] px-2 py-1.5 text-[11px] font-medium text-white shadow-[0_1px_2px_rgba(0,0,0,0.14)] sm:px-3",children:"Direct"}),e.jsx("button",{type:"button",role:"tab","aria-selected":"false",onClick:w,disabled:!w,className:"rounded-[4px] px-2 py-1.5 text-[11px] font-medium text-[#6a6c69] transition-colors hover:bg-white/65 hover:text-[#232628] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#9c7736] disabled:cursor-default disabled:opacity-45 sm:px-3",children:"Live"})]}),e.jsxs("button",{type:"button",onClick:k,className:"hidden h-8 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-[#4f5352] transition-colors hover:bg-[#e7e2d9] hover:text-[#191c1e] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#9c7736] min-[430px]:flex sm:px-2.5","aria-label":"Start a new voice conversation",title:"New conversation",children:[e.jsx(Xt,{size:14,"aria-hidden":"true"}),e.jsx("span",{className:"hidden md:inline",children:"New chat"})]}),e.jsx("button",{type:"button",onClick:I,className:`grid h-8 w-8 place-items-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#9c7736] ${f?"bg-[#e1d5bd] text-[#765923]":"text-[#6e706d] hover:bg-[#e7e2d9] hover:text-[#191c1e]"}`,"aria-pressed":f,"aria-label":f?"Mute spoken replies":"Enable spoken replies",title:f?"Spoken replies on":"Spoken replies off",children:f?e.jsx(Gt,{size:15}):e.jsx(Yt,{size:15})}),e.jsx("button",{type:"button",onClick:E,className:`grid h-8 w-8 place-items-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#9c7736] ${b?"bg-[#e1d5bd] text-[#765923]":"text-[#6e706d] hover:bg-[#e7e2d9] hover:text-[#191c1e]"}`,"aria-expanded":b,"aria-label":"Voice and Scoutbot settings",title:"Voice and Scoutbot settings",children:e.jsx(ys,{size:15})})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"mx-auto flex min-h-full w-full max-w-[880px] flex-col px-6 py-8 sm:px-10 sm:py-10 lg:px-14",children:e.jsxs("div",{className:"w-full max-w-[720px]",children:[Y?e.jsxs("div",{className:"pt-1",children:[e.jsx("p",{className:"font-mono text-[10px] font-semibold uppercase tracking-[0.12em] text-[#8b8983]",children:"Conversation"}),e.jsx("p",{className:"mt-2 max-w-[38ch] text-sm leading-6 text-[#737570]",children:"Your voice turns and Scout’s replies will appear here."})]}):e.jsxs("div",{className:"space-y-8 sm:space-y-9",children:[O.map(L=>{const z=L.role==="assistant";return e.jsxs("article",{className:"max-w-[68ch]",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.jsx("span",{className:"font-mono text-[10px] font-semibold uppercase tracking-[0.12em] text-[#575a59]",children:z?"Scout":"You"}),z&&e.jsx("span",{className:"text-[10px] text-[#8a8983]",children:U})]}),e.jsx("p",{className:"mt-1.5 whitespace-pre-wrap text-[15px] leading-6 text-[#25292a] sm:text-base sm:leading-7",children:z?ue(L.body):L.body})]},L.id)}),G&&e.jsxs("article",{className:"max-w-[68ch]","aria-live":"polite",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[10px] font-semibold uppercase tracking-[0.12em] text-[#765923]",children:"You"}),e.jsx("span",{className:"text-[10px] text-[#9a7a40]",children:a?"Listening":"Sending"})]}),e.jsx("p",{className:"mt-1.5 whitespace-pre-wrap text-[15px] leading-6 text-[#25292a] sm:text-base sm:leading-7",children:G})]})]}),e.jsx("div",{ref:u})]})})}),e.jsx(js,{initial:!1,children:(h||b||i)&&e.jsx(qt.div,{initial:S?!1:{opacity:0,y:6},animate:{opacity:1,y:0},exit:S?void 0:{opacity:0,y:6},className:"max-h-[34vh] shrink-0 overflow-y-auto border-y border-[#d9d4ca] bg-[#eeeae2]",children:e.jsxs("div",{className:"mx-auto w-full max-w-[880px] px-6 py-4 sm:px-10 lg:px-14",children:[i&&e.jsx("p",{className:"mb-3 text-sm leading-6 text-[#93483f]",children:i}),h,b&&_]})})}),e.jsxs("div",{className:"shrink-0 px-5 pb-4 pt-3 sm:px-8 sm:pb-5",children:[e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx(xo,{phase:T,disabled:W,onClick:v}),e.jsxs("div",{className:"mt-3","aria-live":"polite",children:[e.jsx("p",{className:"text-sm font-semibold text-[#24282a]",children:P.label}),e.jsx("p",{className:"mt-0.5 text-xs text-[#7a7b76]",children:P.helper})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-[#7b6a49]",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[#b58a3f]","aria-hidden":"true"}),e.jsx("span",{children:Z})]})]}),e.jsxs("footer",{className:"mx-auto mt-4 flex w-full max-w-[880px] flex-col items-stretch justify-between gap-2 border-t border-[#d9d4ca] pt-3 text-[11px] text-[#747570] sm:flex-row sm:items-center sm:gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(es,{size:12,className:"shrink-0 text-[#8b7350]","aria-hidden":"true"}),e.jsxs("span",{className:"truncate",children:["Input: ",R]})]}),e.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 sm:justify-start","aria-label":`Voice turn state: ${P.label}`,children:fo.map(L=>{const z=x===L.id;return e.jsx("span",{className:z?"font-medium text-[#5e4821]":"text-[#96948e]",children:L.label},L.id)})}),c&&!p&&T!=="listening"&&e.jsx("span",{className:"hidden max-w-48 truncate text-right text-[#96948e] lg:block",children:c})]})]})]})}function Bt({icon:t,title:o,onClick:a,disabled:i,active:c,badge:d}){return e.jsxs("button",{type:"button",title:o,"aria-label":o,onClick:a,disabled:i,className:`flex shrink-0 items-center gap-1 rounded border p-1 text-xs transition-colors disabled:cursor-not-allowed disabled:opacity-40 ${c?"border-lime-300/50 bg-lime-300/10 text-lime-200":"border-[var(--scout-chrome-border-soft)] text-[var(--scout-chrome-ink-faint)] hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]"}`,children:[t,d&&e.jsx("span",{className:"font-mono text-3xs tracking-tight",children:d})]})}function Ut({issue:t,probeState:o,onLaunch:a,onRetry:i,onSettings:c,onDismiss:d}){const p=o==="probing"||o==="launching";return e.jsxs("div",{className:"rounded border border-[var(--scout-chrome-border-soft)] bg-black/15 px-2.5 py-2 font-mono text-xs text-[var(--scout-chrome-ink)]",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ot,{size:13,className:"mt-0.5 shrink-0 text-[var(--scout-chrome-ink-faint)]"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"uppercase tracking-[0.14em] text-[var(--scout-chrome-ink-faint)]",children:"Scout Voice"}),e.jsx("p",{className:"mt-1 leading-relaxed text-[var(--scout-chrome-ink-ghost)]",children:"Open Scout Menu to use speech."}),t&&e.jsx("p",{className:"mt-2 break-words leading-relaxed text-[var(--scout-chrome-ink-ghost)]",children:t})]}),d?e.jsx("button",{type:"button",title:"Hide voice setup","aria-label":"Hide voice setup",onClick:d,className:"shrink-0 rounded border border-transparent p-1 text-[var(--scout-chrome-ink-ghost)] transition-colors hover:border-[var(--scout-chrome-border-soft)] hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]",children:e.jsx(Ds,{size:11})}):null]}),e.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-1.5",children:[e.jsx(Xe,{icon:o==="launching"?e.jsx(K,{size:12,className:"animate-spin"}):e.jsx(Ot,{size:12}),label:o==="launching"?"Opening":"Open",onClick:a,disabled:o==="probing",title:"Open Scout services"}),e.jsx(Xe,{icon:o==="probing"?e.jsx(K,{size:12,className:"animate-spin"}):e.jsx(Bs,{size:12}),label:"Retry",onClick:i,disabled:p,title:"Check Scout voice again"}),e.jsx(Xe,{icon:e.jsx(Us,{size:12}),label:"Voice",onClick:c,disabled:o==="probing",title:"Open Scoutbot voice settings"})]})]})}function Xe({icon:t,label:o,onClick:a,disabled:i,title:c}){return e.jsxs("button",{type:"button",title:c,onClick:a,disabled:i,className:"flex min-h-7 items-center justify-center gap-1.5 rounded border border-[var(--scout-chrome-border-soft)] px-2 text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)] transition-colors hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)] disabled:cursor-not-allowed disabled:opacity-45",children:[t,o]})}const ve="gpt-4o-mini-tts",st="us-woman",Be=[{id:"us-woman",label:"US Woman",locale:"US English",presentation:"Woman",voiceName:"Marin",description:"Warm, clear, and conversational.",speech:{modelId:ve,voiceId:"marin",instructions:"Speak in clear, natural American English with a warm, grounded feminine presentation. Keep the delivery conversational and responsive."}},{id:"us-man",label:"US Man",locale:"US English",presentation:"Man",voiceName:"Cedar",description:"Grounded, calm, and direct.",speech:{modelId:ve,voiceId:"cedar",instructions:"Speak in clear, natural American English with a warm, grounded masculine presentation. Keep the delivery conversational and responsive."}},{id:"british-woman",label:"British Woman",locale:"British English",presentation:"Woman",voiceName:"Marin",description:"Warm with a subtle British cadence.",speech:{modelId:ve,voiceId:"marin",instructions:"Speak in natural British English with a subtle contemporary British accent and a warm, grounded feminine presentation. Avoid theatrical or exaggerated delivery."}},{id:"british-man",label:"British Man",locale:"British English",presentation:"Man",voiceName:"Cedar",description:"Calm with a subtle British cadence.",speech:{modelId:ve,voiceId:"cedar",instructions:"Speak in natural British English with a subtle contemporary British accent and a calm, grounded masculine presentation. Avoid theatrical or exaggerated delivery."}}],me={modelId:ve,voiceId:"marin",instructions:"Speak naturally, clearly, and conversationally."};function go(t){return t==="custom"||Be.some(o=>o.id===t)}function vo(t,o={}){return t==="custom"?{modelId:o.modelId?.trim()||me.modelId,voiceId:o.voiceId?.trim()||me.voiceId,instructions:o.instructions?.trim()||me.instructions}:Be.find(a=>a.id===t)?.speech??Be.find(a=>a.id===st).speech}function Ft({presentation:t,voicePresetId:o,onVoicePresetId:a,speechSelectionId:i,onSpeechSelectionId:c,customSpeechModelId:d,onCustomSpeechModelId:p,customSpeechVoiceId:j,onCustomSpeechVoiceId:N,customSpeechInstructions:g,onCustomSpeechInstructions:M,voiceDefaults:C,modelDraft:f,onModelDraft:b,promptDraft:h,onPromptDraft:_,configLoading:y,configSaving:v,configError:I,configStatus:E,onSave:k,onReload:w}){const S=t==="direct-voice";return e.jsx("div",{className:`rounded border border-[var(--scout-chrome-border-soft)] p-3 ${S?"bg-[#f8f5ef]":"bg-black/10"}`,children:e.jsxs("div",{className:"flex flex-col gap-3",children:[S?e.jsxs("fieldset",{className:"flex flex-col gap-2",children:[e.jsx("legend",{className:"mb-1 font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:"Scout voice"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",role:"radiogroup","aria-label":"Scout voice",children:Be.map(u=>{const T=i===u.id;return e.jsxs("button",{type:"button",role:"radio","aria-checked":T,onClick:()=>c(u.id),className:`min-h-20 rounded border p-2.5 text-left transition ${T?S?"border-[#b89a5f] bg-[#efe5d0] text-[var(--scout-chrome-ink)]":"border-lime-300/60 bg-lime-300/10 text-[var(--scout-chrome-ink)]":S?"border-[var(--scout-chrome-border-soft)] bg-white/55 text-[var(--scout-chrome-ink-faint)] hover:bg-white":"border-[var(--scout-chrome-border-soft)] bg-black/20 text-[var(--scout-chrome-ink-faint)] hover:bg-[var(--scout-chrome-hover)]"}`,children:[e.jsx("span",{className:"block font-mono text-xs font-bold uppercase tracking-[0.1em]",children:u.label}),e.jsxs("span",{className:"mt-1 block font-mono text-2xs leading-relaxed text-[var(--scout-chrome-ink-ghost)]",children:[u.voiceName," · ",u.description]})]},u.id)})}),e.jsxs("button",{type:"button",role:"radio","aria-checked":i==="custom",onClick:()=>c("custom"),className:`rounded border px-2.5 py-2 text-left font-mono text-xs transition ${i==="custom"?S?"border-[#b89a5f] bg-[#efe5d0] text-[var(--scout-chrome-ink)]":"border-lime-300/60 bg-lime-300/10 text-[var(--scout-chrome-ink)]":S?"border-[var(--scout-chrome-border-soft)] bg-white/55 text-[var(--scout-chrome-ink-faint)] hover:bg-white":"border-[var(--scout-chrome-border-soft)] bg-black/20 text-[var(--scout-chrome-ink-faint)] hover:bg-[var(--scout-chrome-hover)]"}`,children:[e.jsx("span",{className:"font-bold uppercase tracking-[0.1em]",children:"Custom voice"}),e.jsx("span",{className:"ml-2 text-[var(--scout-chrome-ink-ghost)]",children:"Use any supported model, voice, and style."})]}),i==="custom"&&e.jsxs("div",{className:`grid gap-2 rounded border border-[var(--scout-chrome-border-soft)] p-2.5 ${S?"bg-white/55":"bg-black/20"}`,children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("label",{className:"flex flex-col gap-1 font-mono text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:["Speech model",e.jsx("input",{value:d,onChange:u=>p(u.target.value),placeholder:"gpt-4o-mini-tts",className:`rounded border border-[var(--scout-chrome-border-soft)] px-2 py-1.5 font-mono text-xs normal-case tracking-normal text-[var(--scout-chrome-ink)] placeholder:text-[var(--scout-chrome-ink-ghost)] ${S?"bg-white/75":"bg-black/25"}`})]}),e.jsxs("label",{className:"flex flex-col gap-1 font-mono text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:["Voice ID",e.jsx("input",{value:j,onChange:u=>N(u.target.value),placeholder:"marin",className:`rounded border border-[var(--scout-chrome-border-soft)] px-2 py-1.5 font-mono text-xs normal-case tracking-normal text-[var(--scout-chrome-ink)] placeholder:text-[var(--scout-chrome-ink-ghost)] ${S?"bg-white/75":"bg-black/25"}`})]})]}),e.jsxs("label",{className:"flex flex-col gap-1 font-mono text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:["Speaking style",e.jsx("textarea",{value:g,onChange:u=>M(u.target.value),rows:3,placeholder:"Speak naturally, clearly, and conversationally.",className:`w-full resize-y rounded border border-[var(--scout-chrome-border-soft)] px-2 py-1.5 font-mono text-xs normal-case leading-relaxed tracking-normal text-[var(--scout-chrome-ink)] placeholder:text-[var(--scout-chrome-ink-ghost)] ${S?"bg-white/75":"bg-black/25"}`})]})]}),e.jsx("p",{className:"font-mono text-2xs normal-case leading-relaxed text-[var(--scout-chrome-ink-ghost)]",children:"Request-based TTS, separate from GPT Live. Replies are AI-generated speech."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"flex flex-col gap-1 font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:["Voice FX",e.jsx("select",{value:o,onChange:u=>a(u.target.value),className:"rounded border border-[var(--scout-chrome-border-soft)] bg-black/20 px-2 py-1.5 font-mono text-sm normal-case tracking-normal text-[var(--scout-chrome-ink)]",children:zt.map(u=>e.jsxs("option",{value:u.id,children:[u.label," — ",u.family]},u.id))}),e.jsx("span",{className:"font-mono text-2xs normal-case leading-relaxed tracking-normal text-[var(--scout-chrome-ink-ghost)]",children:zt.find(u=>u.id===o)?.description??"Custom voice mood for spoken replies."})]}),e.jsxs("div",{className:"flex flex-col gap-1 font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:["Scout Voice",e.jsx("div",{className:"rounded border border-[var(--scout-chrome-border-soft)] bg-black/20 px-2 py-1.5 font-mono text-sm normal-case tracking-normal text-[var(--scout-chrome-ink)]",children:C?`${C.modelId}${C.voiceId?` / ${C.voiceId}`:""}`:"Unavailable"})]})]}),e.jsxs("label",{className:"flex flex-col gap-1 font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:["Preferred model",e.jsx("input",{value:f,onChange:u=>b(u.target.value),placeholder:"gpt-4.1-mini",className:`rounded border border-[var(--scout-chrome-border-soft)] px-2 py-1.5 font-mono text-sm normal-case tracking-normal text-[var(--scout-chrome-ink)] placeholder:text-[var(--scout-chrome-ink-ghost)] ${S?"bg-white/75":"bg-black/20"}`,disabled:y||v})]}),e.jsxs("label",{className:"flex flex-col gap-1 font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:["System Prompt",e.jsx("textarea",{value:h,onChange:u=>_(u.target.value),rows:6,className:`w-full resize-y rounded border border-[var(--scout-chrome-border-soft)] px-2 py-1.5 font-mono text-xs normal-case leading-relaxed tracking-normal text-[var(--scout-chrome-ink)] ${S?"bg-white/75":"bg-black/20"}`,disabled:y||v})]}),I&&e.jsx("div",{className:`font-mono text-xs leading-relaxed ${S?"text-[#93483f]":"text-red-300"}`,children:I}),E&&e.jsx("div",{className:`font-mono text-xs leading-relaxed ${S?"text-[#765923]":"text-lime-200"}`,children:E}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:k,disabled:y||v||!h.trim(),className:`flex items-center justify-center gap-2 rounded px-2.5 py-2 font-mono text-xs font-bold uppercase tracking-[0.12em] transition-opacity disabled:cursor-not-allowed disabled:opacity-40 ${S?"bg-[#282c2d] text-white hover:bg-[#151819]":"bg-lime-300/90 text-black"}`,children:[(y||v)&&e.jsx(K,{size:13,className:"animate-spin"}),v?"Saving":"Save"]}),e.jsx("button",{type:"button",onClick:w,disabled:y||v,className:"rounded border border-[var(--scout-chrome-border-soft)] px-2.5 py-2 font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)] hover:bg-[var(--scout-chrome-hover)] disabled:cursor-not-allowed disabled:opacity-40",children:"Reload"})]})]})})}const So="chill-dispatcher",ko=6e4,wo=2500,yo=1.2,jo={lowCutHz:160,highCutHz:5200,bandQ:.35,saturationAmount:.035,bitcrushAmount:0,hissGain:0,hissCutoffHz:1800,presencePeakDb:1.5,presenceCenterHz:1500,presenceQ:.65,compressorThresholdDb:-15,compressorRatio:2.2,clickEnabled:!0,clickGain:.24,clickDurationMs:45,squelchTailEnabled:!0,squelchTailGain:.018,squelchTailDurationMs:95,outputGain:1,wetMix:.38};function No(t){const o=Math.min(1,t/8);return{saturationAmount:.035+o*.025,presencePeakDb:1.5+o*1.5}}function Co(t,o){return{...t==="chill-dispatcher"?jo:{},...No(o)}}function ss(t,o,a){return new Promise((i,c)=>{const d=window.setTimeout(()=>c(new Error(a)),o);t.then(i,c).finally(()=>window.clearTimeout(d))})}async function $e(t,o={}){!t.sessionId&&!o.allowCurrentSession||await ss(t.cancel(),wo,"Timed out releasing Scout voice session.").catch(()=>{})}function Eo(t){const o=t instanceof Error?t.message:String(t);return/session_cancelled|was cancelled|cancelled/i.test(o)}const Ht=new RegExp("(?:^|(?<=[\\s(`'\"<>]))(?:~\\/|\\/(?:Users|home|opt|var|etc|tmp|private)\\/)[^\\s)`'\"<>]+\\.[A-Za-z0-9]{1,8}\\b","g");function To(t){const o=[],a=new Set;Ht.lastIndex=0;let i;for(;(i=Ht.exec(t))!==null;)a.has(i[0])||(a.add(i[0]),o.push(i[0]));return o}function Wt(t){const o=t.split("/").filter(Boolean);return o.length<=2?t:`…/${o.slice(-2).join("/")}`}function Io(){return{requesterName:"OpenScout",productName:"Scout Voice",headline:"Turn on local voice",body:"Scout voice handles local speech capture and spoken replies. Start Scout services, then return here to talk with your workspace.",actionLabel:"Return to OpenScout",logo:{url:new URL("/openscout-icon.png",window.location.href).toString(),symbolName:"sparkles"}}}const _o=["Explain what went wrong here.","Help me rewrite this message.","What should I try next?"];function Ro({height:t,forceExpanded:o=!1,fill:a=!1,presentation:i="chat",onOpenLive:c}={}){const{applyScoutbotUiAction:d,agents:p,route:j,onlineCount:N}=Rt(),g=gs(),M=ot(nt,!0),C=rt(),f=M&&(C.state==="connecting"||C.state==="live"),[b,h]=Lt("openscout.scoutbot.collapsed",!0),[_,y]=n.useState(""),[v,I]=n.useState(!1),[E,k]=n.useState(null),[w,S]=n.useState(null),[u,T]=n.useState(null),[P,W]=n.useState("idle"),[R,O]=Lt("openscout.scoutbot.voiceReplies",!1),[G]=Ts("openscout.scoutbot.voiceSpeed",yo),[Y,x]=ge("openscout.scoutbot.voicePresetId",So),[U,Z]=ge("openscout.scoutbot.speechProfileId",st),[F,L]=ge("openscout.scoutbot.customSpeechModelId",me.modelId),[z,at]=ge("openscout.scoutbot.customSpeechVoiceId",me.voiceId),[ke,it]=ge("openscout.scoutbot.customSpeechInstructions",me.instructions),[q,we]=n.useState(!1),[Ue,te]=n.useState(null),[Fe,he]=n.useState(""),[J,He]=n.useState(!1),[ns,ct]=n.useState(null),[lt,We]=n.useState(null),[Lo,ye]=n.useState(null),[Ge,$]=n.useState(null),[oe,pe]=n.useState(!1),[rs,je]=n.useState(!1),[B,ne]=n.useState(null),[re,dt]=n.useState(!1),[Ye,ut]=n.useState(null),[mt,ht]=n.useState(!1),[pt,xt]=n.useState(!1),[ft,Ne]=n.useState(null),[bt,qe]=n.useState(null),[Ce,Ee]=n.useState(""),[Te,Ie]=n.useState(""),[gt,vt]=n.useState(null),[as,ae]=n.useState(!1),[is,ie]=n.useState(0),[cs,_e]=n.useState(!1),[Je,St]=n.useState(null),Re=go(U)?U:st,Ve=n.useMemo(()=>vo(Re,{modelId:F,voiceId:z,instructions:ke}),[ke,F,z,Re]),Me=n.useRef(_s()),ce=n.useRef(!1),Q=n.useRef(null),le=n.useRef(null),se=n.useRef(null),Le=n.useRef(R);Le.current=R,n.useEffect(()=>{i==="direct-voice"&&(Le.current=!0,O(!0))},[i,O]),n.useEffect(()=>(ce.current=!0,()=>{ce.current=!1,le.current="discard";const s=Q.current;Q.current=null,s&&$e(s,{allowCurrentSession:!0}),se.current?.stop(),se.current=null}),[]);const V=n.useCallback(()=>{se.current?.stop(),se.current=null,He(!1)},[]),Ae=n.useCallback(s=>{if(!s)return;V();const r=Xs(s),l=i==="direct-voice"?Rs(r,{speed:G,modelId:Ve.modelId,voiceId:Ve.voiceId,instructions:Ve.instructions}):Vs(r,{speed:G,presetId:Y,params:Co(Y,N)});se.current=l,He(!0),l.promise.catch(m=>{Ms(m)||k(m instanceof Error?m.message:"Scout voice speech failed.")}).finally(()=>{se.current===l&&(se.current=null,He(!1))})},[V,G,Ve,N,i,Y]),kt=n.useCallback(s=>{Le.current&&Ae(s)},[Ae]),wt=n.useCallback(s=>{Ae(ue(s))},[Ae]),{openFilePreview:yt}=Rt(),jt=vs(),ls=n.useCallback((s,r)=>{const l=window.getSelection()?.toString().trim(),m=ue(r),A=To(m),D=[];if(l&&(D.push({kind:"action",label:"Copy selection",shortcut:"⌘C",onSelect:()=>{De(l)}}),D.push({kind:"separator"})),D.push({kind:"action",label:"Copy message",onSelect:()=>{De(m)}}),A.length>0){D.push({kind:"separator"});for(const ee of A.slice(0,5)){const Qe=Wt(ee);D.push({kind:"action",label:`Preview ${Qe}`,onSelect:()=>yt(ee)})}for(const ee of A.slice(0,5)){const Qe=Wt(ee);D.push({kind:"action",label:`Open ${Qe} in OS`,onSelect:()=>{H("/api/file/reveal",{method:"POST",body:JSON.stringify({path:ee})}).catch(()=>{})}})}D.push({kind:"action",label:A.length===1?"Copy path":"Copy first path",onSelect:()=>{De(A[0])}})}D.push({kind:"separator"}),D.push({kind:"action",label:J?"Say again (stop current)":"Say",onSelect:()=>wt(r)}),jt(s,D)},[yt,wt,jt,J]);n.useEffect(()=>()=>{V()},[V]);const ds=_o,de=n.useCallback(s=>{const r=[...s.messages].reverse().find(m=>m.role==="user"),l=[...s.messages].reverse().find(m=>m.role==="assistant");We(r?.body??null),ye(l?ue(l.body):null)},[]),xe=n.useCallback(async()=>{try{const s=await H("/api/scoutbot/session");ne(s),de(s.session)}catch{ne(null)}},[de]);n.useEffect(()=>{xe()},[xe]);const Pe=n.useCallback(async()=>{ht(!0),Ne(null);try{const s=await H("/api/scoutbot/config");Ee(s.model),Ie(s.systemPrompt),qe(null)}catch(s){Ne(s instanceof Error?s.message:"Could not load settings.")}finally{ht(!1)}},[]);n.useEffect(()=>{oe&&Pe()},[Pe,oe]),n.useEffect(()=>{if(!oe)return;let s=!1;return H("/api/voice/defaults").then(r=>{s||vt(r)}).catch(()=>{s||vt(null)}),()=>{s=!0}},[oe]);const Nt=n.useCallback(async()=>{xt(!0),Ne(null),qe(null);try{const s=await H("/api/scoutbot/config",{method:"POST",body:JSON.stringify({model:Ce,systemPrompt:Te})});Ee(s.config.model),Ie(s.config.systemPrompt),qe("Saved")}catch(s){Ne(s instanceof Error?s.message:"Could not save settings.")}finally{xt(!1)}},[Ce,Te]),us=n.useCallback(async s=>{if(!(!s||Je)){St(s),k(null),V();try{const r=await H("/api/scoutbot/session/switch",{method:"POST",body:JSON.stringify({id:s})});ne(r),de(r.session),_e(!1),ae(!1),window.dispatchEvent(new CustomEvent(be,{detail:{id:r.session.id}}))}catch(r){k(r instanceof Error?r.message:"Could not switch session.")}finally{St(null)}}},[V,Je,de]),Oe=n.useCallback(async()=>{if(!(re||v)){if(B?.session.messages.length===0){y(""),k(null),ae(!1),_e(!1),$("New chat ready"),ie(s=>s+1);return}dt(!0),k(null),$("Starting new chat"),V();try{const s=await H("/api/scoutbot/session/reset",{method:"POST"});ne(s),y(""),We(null),ye(null),ae(!1),_e(!1),$("New chat ready"),ie(r=>r+1),window.dispatchEvent(new CustomEvent(be,{detail:{id:s.session.id}}))}catch(s){$(null),k(s instanceof Error?s.message:"Could not start a new chat.")}finally{dt(!1)}}},[re,v,B,V]),ms=n.useCallback(async s=>{if(!(!s||Ye)){ut(s),k(null),V();try{const r=await H("/api/scoutbot/session/archive",{method:"POST",body:JSON.stringify({id:s})});ne(r),de(r.session),ae(!1),$("session archived"),window.dispatchEvent(new CustomEvent(be,{detail:{id:r.session.id}}))}catch(r){k(r instanceof Error?r.message:"Could not archive session.")}finally{ut(null)}}},[Ye,V,de]),ze=n.useCallback((s,r)=>{S(r),ct(s.activeInputDeviceName),T(r?null:s.lastUnavailableReason??"Scout voice service is not reachable."),W("idle")},[]),X=n.useCallback(async(s=!1)=>{const r=Me.current;W(m=>m==="launching"?m:"probing");const l=await r.probe(s?{force:!0}:void 0);return ze(r,l),l},[ze]);n.useEffect(()=>{Ls();const s=Me.current,r=As(l=>{S(l.ok),ct(l.inputDeviceName),T(l.ok?null:l.reason),W("idle")});return s.connectionState==="unknown"?X():ze(s,s.connectionState==="connected"),r},[ze,X]);const Ct=n.useCallback(()=>{const s=Me.current;k(null),W("launching"),s.launch({source:"openscout",context:Io()}),window.setTimeout(()=>{X(!0)},2400)},[X]),Et=n.useCallback(s=>{const r=ue(s);ye(r);for(const l of Is(s))l.type==="ask-agent"?($(`Sending to ${l.targetLabel}`),H("/api/scoutbot/actions/ask",{method:"POST",body:JSON.stringify({targetLabel:l.targetLabel,targetAgentId:l.targetAgentId,body:l.body,channel:l.channel})}).then(m=>{$(m.flightId?`Sent to ${m.targetAgentId??m.targetLabel} · run ${m.flightId}`:`Sent to ${m.targetAgentId??m.targetLabel}`)}).catch(m=>{$(null),k(m instanceof Error?m.message:"Could not send to agent.")})):l.type!=="reminder"&&d(l);kt(r)},[d,kt]);n.useEffect(()=>{const s=()=>{$("Scoutbot replied by voice"),xe()},r=()=>{$("Scoutbot chat changed"),xe()};return window.addEventListener(Vt,s),window.addEventListener(be,r),()=>{window.removeEventListener(Vt,s),window.removeEventListener(be,r)}},[xe]);const fe=n.useCallback(async s=>{const r=s.trim();if(!(!r||v)){I(!0),k(null),We(r),ye(null),$("Sending"),y(l=>l.trim()===r?"":l);try{await Es().catch(()=>null);const l=await H("/api/scoutbot/chat",{method:"POST",body:JSON.stringify({body:r,route:j,uiContext:Ss("web")})});ne({session:l.session,sessions:l.sessions,config:l.config}),$("Reply received"),Et(l.reply.body)}catch(l){$(null),k(l instanceof Error?l.message:"Could not send.")}finally{I(!1)}}},[Et,j,v]),Tt=n.useCallback(async()=>{if(q)return;const s=Me.current;if(le.current=null,k(null),he(""),te("starting"),w!==!0&&!await X(!0)){te(null);return}let r=null,l=!1;const m=async()=>{!r||l||(l=!0,await $e(r,{allowCurrentSession:Q.current===r}),Q.current===r&&(Q.current=null))};try{if(r=await s.startLive({onState:te,onPartial:he},{surface:i==="direct-voice"?"direct-voice":"chat-composer"}),!ce.current){await $e(r,{allowCurrentSession:!0});return}Q.current=r,we(!0);const A=await r.result;if(await m(),!ce.current||(we(!1),he(""),le.current))return;te("done"),A.text&&await fe(A.text)}catch(A){const D=le.current;if(!ce.current)return;const ee=!!D||Eo(A);if(await m(),we(!1),he(""),D==="stop-failed")return;te(ee?null:"error"),ee||k(A instanceof Error?A.message:"Scout voice recording failed.")}finally{ce.current&&await m(),le.current=null}},[fe,i,X,q,w]),It=n.useCallback(async()=>{const s=Q.current;if(s){te("processing");try{await ss(s.stop(),ko,"Scout voice did not finish processing the recording.")}catch(r){le.current="stop-failed",await $e(s,{allowCurrentSession:!0}),Q.current===s&&(Q.current=null,we(!1),he(""),te("error")),k(r instanceof Error?`Scout voice recording did not finish: ${r.message}`:"Scout voice recording did not finish.")}}},[]);n.useEffect(()=>{const s=()=>h(!1);return window.addEventListener("scout:scoutbot-panel-open",s),()=>window.removeEventListener("scout:scoutbot-panel-open",s)},[h]),n.useEffect(()=>Ns(()=>h(!b)),[b,h]),n.useEffect(()=>{const s=r=>{const l=r.detail,m=l&&typeof l=="object"&&"body"in l?l.body:null;typeof m=="string"&&m.trim()&&(h(!1),fe(m))};return window.addEventListener(At,s),()=>window.removeEventListener(At,s)},[fe,h]),n.useEffect(()=>{const s=r=>{const l=r.detail,m=l&&typeof l=="object"&&"body"in l?l.body:null;typeof m=="string"&&m.trim()&&(h(!1),y(m),ie(A=>A+1))};return window.addEventListener("scout:scoutbot-compose",s),()=>window.removeEventListener("scout:scoutbot-compose",s)},[h]);const _t=n.useMemo(()=>{const s=J?"speaking":v?"thinking":q?"listening":"idle",r=B?.session??null,l=r&&r.messages.length>0?r.messages[r.messages.length-1]:null;return{activity:s,brief:{lastDeliveredAt:null},reminders:{dueCount:0,upcomingCount:0,due:[],next:null},voice:{available:w,setupBlocked:w===!1,replies:R},error:E,session:{title:r?.title??null,lastActivityAt:l?.createdAt??r?.updatedAt??null},conversation:{messageCount:r?.messages.length??0,loading:B===null}}},[J,v,q,w,R,E,B]);n.useEffect(()=>{g?.publishState(_t)},[g,_t]),n.useEffect(()=>{if(!g)return;const s={focusScoutbot:()=>h(!1),triggerBrief:()=>{h(!1),ie(r=>r+1)},triggerAskState:()=>{h(!1),ie(r=>r+1)},toggleVoiceReplies:()=>{const r=!R;O(r),r||V()},openScoutbotSettings:()=>{h(!1),pe(!0)},startNewChat:()=>{h(!1),re||Oe()},dismissReminder:()=>{},askReminderStatus:()=>{h(!1),ie(r=>r+1)}};g.registerActions(s)},[g,h,R,O,V,pe,re,Oe]),n.useEffect(()=>{w===!0&&je(!1)},[w]);const hs=f?"Live call":q?Ue==="processing"?"Sending":"Stop":P==="probing"?"Checking Voice":P==="launching"?"Opening Scout":w===!1?"Open Scout":"Start Talking",ps=B!==null&&B.session.messages.length===0&&!v;if(i==="direct-voice")return e.jsx(bo,{messages:B?.session.messages??[],pendingAsk:v?lt:null,partial:Fe,error:E,status:Ge,recording:q,sending:v,speaking:J,voiceAvailable:w,voiceInputSource:ns,voiceProbeState:P,voiceState:Ue,voiceReplies:R,settingsOpen:oe,assistantModel:B?.session.model??B?.config.model??null,setupPanel:w===!1?e.jsx(Ut,{issue:u,probeState:P,onLaunch:Ct,onRetry:()=>{X(!0)},onSettings:()=>pe(!0),onDismiss:()=>je(!1)}):null,settingsPanel:e.jsx(Ft,{presentation:"direct-voice",voicePresetId:Y,onVoicePresetId:x,speechSelectionId:Re,onSpeechSelectionId:Z,customSpeechModelId:F,onCustomSpeechModelId:L,customSpeechVoiceId:z,onCustomSpeechVoiceId:at,customSpeechInstructions:ke,onCustomSpeechInstructions:it,voiceDefaults:gt,modelDraft:Ce,onModelDraft:Ee,promptDraft:Te,onPromptDraft:Ie,configLoading:mt,configSaving:pt,configError:ft,configStatus:bt,onSave:()=>{Nt()},onReload:()=>{Pe()}}),onPrimaryAction:()=>{J?V():q?It():w===!1?X(!0):Tt()},onToggleVoiceReplies:()=>{const s=!R;Le.current=s,O(s),s||V()},onToggleSettings:()=>pe(s=>!s),onNewChat:()=>{re||Oe()},onOpenLive:c});if(b&&!o)return e.jsx("div",{className:"flex shrink-0 items-center border-t border-[var(--scout-chrome-border-soft)] px-3 py-1.5",children:e.jsx(Cs,{})});const xs=a?"flex h-full min-h-0 flex-col overflow-hidden border-t border-[var(--scout-chrome-border-soft)]":t===void 0?"flex max-h-[60vh] shrink-0 flex-col overflow-hidden border-t border-[var(--scout-chrome-border-soft)]":"flex shrink-0 flex-col overflow-hidden border-t border-[var(--scout-chrome-border-soft)]",fs=t===void 0||a?void 0:{height:`${t}px`};return e.jsxs("section",{className:xs,style:fs,children:[e.jsxs("div",{className:"flex shrink-0 flex-col gap-2 px-3 pt-2.5 pb-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-2",children:e.jsx(Fs,{size:20,className:"shrink-0 text-lime-300","aria-hidden":"true"})}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx(Bt,{icon:R?e.jsx(Gt,{size:11}):e.jsx(Yt,{size:11}),title:f?R?"Voice replies on for typed chat (live call has its own audio)":"Voice replies off for typed chat (live call has its own audio)":R?"Voice replies on (click to mute)":"Voice replies off (click to enable)",onClick:()=>{const s=!R;O(s),s||V()},active:R}),!o&&e.jsx(Bt,{icon:e.jsx(Ke,{size:11}),title:"Minimize",onClick:()=>h(!0)})]})]}),oe&&e.jsx(Ft,{presentation:"chat",voicePresetId:Y,onVoicePresetId:x,speechSelectionId:Re,onSpeechSelectionId:Z,customSpeechModelId:F,onCustomSpeechModelId:L,customSpeechVoiceId:z,onCustomSpeechVoiceId:at,customSpeechInstructions:ke,onCustomSpeechInstructions:it,voiceDefaults:gt,modelDraft:Ce,onModelDraft:Ee,promptDraft:Te,onPromptDraft:Ie,configLoading:mt,configSaving:pt,configError:ft,configStatus:bt,onSave:()=>{Nt()},onReload:()=>{Pe()}})]}),e.jsx("div",{className:"flex min-h-0 flex-1 flex-col px-3 pb-1.5",children:B&&e.jsx(so,{state:B,chatExpanded:as,onToggleExpanded:()=>ae(s=>!s),sessionPickerOpen:cs,onToggleSessionPicker:()=>_e(s=>!s),onStartNewChat:()=>{Oe()},startingNewChat:re,onSwitchSession:s=>{us(s)},switchingSessionId:Je,sending:v,briefing:!1,pendingAsk:v?lt:null,onArchiveSession:s=>{ms(s)},archivingSessionId:Ye,onAssistantContextMenu:ls,suggestedPrompts:ds,onSelectPrompt:s=>{y(s),ae(!1)}})}),e.jsxs("div",{className:"flex shrink-0 flex-col gap-1.5 border-t border-[var(--scout-chrome-border-soft)] bg-black/10 px-3 pt-2 pb-2.5",children:[w===!1&&rs&&!f&&e.jsx(Ut,{issue:u,probeState:P,onLaunch:Ct,onRetry:()=>{X(!0)},onSettings:()=>pe(!0),onDismiss:()=>je(!1)}),(Fe||J)&&!f&&e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded border border-[var(--scout-chrome-border-soft)] bg-black/10 px-2.5 py-2 font-mono text-xs leading-relaxed text-[var(--scout-chrome-ink-faint)]",children:[e.jsx("span",{className:"min-w-0 truncate",children:J?"Speaking reply…":Fe}),J&&e.jsx("button",{type:"button",title:"Stop spoken reply",onClick:V,className:"shrink-0 rounded border border-[var(--scout-chrome-border-soft)] p-1 text-[var(--scout-chrome-ink)] hover:bg-[var(--scout-chrome-hover)]",children:e.jsx(Zt,{size:11,className:"fill-current"})})]}),Ge&&!v&&e.jsx("div",{className:"font-mono text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-ghost)]",children:Ge}),e.jsx(no,{agents:p,draft:_,onDraftChange:y,onSubmit:()=>{fe(_)},sending:v,recording:q,voiceLabel:hs,voiceBusy:Ue==="processing"||P==="probing"||P==="launching",voiceUnavailable:w===!1,voiceHeld:f,onMicClick:()=>{if(!f){if(w===!1){je(!0);return}q?It():Tt()}},prominent:ps&&!f,autoFocus:o,focusSignal:is}),E&&e.jsx("div",{className:"rounded border border-red-400/30 bg-red-400/10 px-2.5 py-2 font-mono text-xs leading-relaxed text-red-200",children:E})]})]})}function os({dictationActive:t=!1,autoStart:o=!1}){const a=ot(nt,!0),{enabled:i,state:c,leaseId:d,startCall:p,endCall:j}=rt(),N=n.useRef(!1),g=n.useRef(null),[M,C]=n.useState(()=>window.innerWidth>=720&&window.innerHeight>=520?"page":"compact"),f=window.webkit?.messageHandlers?.scoutRealtimeVoice;return n.useEffect(()=>{const b=()=>{C(window.innerWidth>=720&&window.innerHeight>=520?"page":"compact")};return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[]),n.useEffect(()=>{f?.postMessage({kind:"session-state",state:c,leaseId:d})},[d,f,c]),n.useEffect(()=>{const b=()=>{if(g.current)return g.current;const _=j().finally(()=>{g.current===_&&(g.current=null)});return g.current=_,_},h=()=>{b()};return window.__scoutRealtimeVoiceStop=b,window.addEventListener(Mt,h),window.__scoutRealtimeVoiceStopRequested&&b(),()=>{window.removeEventListener(Mt,h),window.__scoutRealtimeVoiceStop===b&&delete window.__scoutRealtimeVoiceStop}},[j]),n.useEffect(()=>{!o||t||!a||!i||N.current||c!=="idle"&&c!=="ended"&&c!=="error"||(N.current=!0,p())},[o,t,a,i,p,c]),a?i?e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(Jt,{state:c,onMinimize:f?()=>f.postMessage("minimize"):void 0,onExpand:f?()=>f.postMessage(M==="page"?"restore":"expand"):void 0,layout:M}),e.jsx(Qt,{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.jsx("p",{className:"text-sm leading-snug text-[var(--scout-chrome-ink-faint)]",children:"This Scout build has live conversations disabled. Calls use the configured OpenAI API account when the feature is available."})]})}function Vo(){const t=ot(nt,!0),{enabled:o,state:a}=rt(),[i,c]=n.useState("direct"),d=t&&o;return i==="direct"?e.jsx("main",{className:"h-full min-h-0 overflow-hidden bg-[#f3f0e9]",children:e.jsx(Ro,{forceExpanded:!0,fill:!0,presentation:"direct-voice",onOpenLive:()=>c("realtime")})}):e.jsxs("main",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-[var(--scout-chrome-bg)]",children:[e.jsxs("header",{className:"flex min-h-14 shrink-0 items-center justify-between gap-4 border-b border-[var(--scout-chrome-border-soft)] px-4 py-2.5 sm:px-7",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("h1",{className:"truncate font-[var(--font-accent-title)] text-[17px] font-semibold tracking-[-0.018em] text-[var(--scout-chrome-ink-strong)]",children:"GPT Live"}),e.jsx("span",{className:"hidden h-4 w-px bg-[var(--scout-chrome-border-soft)] sm:block","aria-hidden":"true"}),e.jsxs("span",{className:"hidden items-center gap-2 text-xs text-[var(--scout-chrome-ink-faint)] sm:flex",children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${d?"bg-[var(--scout-accent)]":"bg-[var(--scout-chrome-ink-ghost)]"}`,"aria-hidden":"true"}),d?"Ready for a live call":"Live voice unavailable"]})]}),e.jsxs("div",{className:"flex rounded-md border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] p-0.5",role:"tablist","aria-label":"Voice mode",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":"false",onClick:()=>c("direct"),className:"rounded-[4px] px-3 py-1.5 text-[11px] font-medium text-[var(--scout-chrome-ink-faint)] transition-colors hover:text-[var(--scout-chrome-ink-strong)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--scout-accent)]",children:"Direct"}),e.jsx("button",{type:"button",role:"tab","aria-selected":"true",className:"rounded-[4px] bg-[var(--scout-chrome-ink-strong)] px-3 py-1.5 text-[11px] font-medium text-[var(--scout-chrome-bg)] shadow-[0_1px_2px_rgba(0,0,0,0.14)]",children:"Live"})]})]}),e.jsx("section",{className:"min-h-0 flex-1 overflow-hidden",children:d?e.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[e.jsx(Jt,{state:a,layout:"page"}),e.jsx(Qt,{dictationActive:!1,layout:"page"})]}):e.jsx(os,{})})]})}const Mo=Hs({id:"voice",label:"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"})}}),ln=Object.freeze(Object.defineProperty({__proto__:null,RealtimeVoicePage:Vo,RealtimeVoiceScreen:os,scoutSurface:Mo},Symbol.toStringTag,{value:"Module"}));export{Vo as R,Ro as S,ln as a};
@@ -1 +1 @@
1
- import{j as s}from"./index-CZ-05hKz.js";import{R as c}from"./RepoDiffViewerLazy-C0--fPtk.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-DvLtl7rV.js";import{R as c}from"./RepoDiffViewerLazy-Csy_j9LD.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-CZ-05hKz.js";import{R as l}from"./RepoDiffViewerLazy-C0--fPtk.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-DvLtl7rV.js";import{R as l}from"./RepoDiffViewerLazy-Csy_j9LD.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};