@openscout/scout 0.2.96 → 0.2.98

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 (395) hide show
  1. package/README.md +0 -1
  2. package/bin/scoutd +0 -0
  3. package/dist/build-manifest.json +3 -3
  4. package/dist/client/assets/ActivityScreen-sfonf5SR.js +1 -0
  5. package/dist/client/assets/{AddProjectForm-IqOtJfRs.js → AddProjectForm-fXndbzXT.js} +1 -1
  6. package/dist/client/assets/{AgentAvatar-6-KBVKUu.js → AgentAvatar-Dz79iTxB.js} +1 -1
  7. package/dist/client/assets/AgentConfigurationScreen-DDc3udYM.js +1 -0
  8. package/dist/client/assets/AgentDefinitionsWorkspace-DHDS9Pgd.js +1 -0
  9. package/dist/client/assets/{AgentDetailCard-C9rn3Fj5.js → AgentDetailCard-8viaEY8b.js} +1 -1
  10. package/dist/client/assets/AgentFloorView-DuyvyMMj.js +1 -0
  11. package/dist/client/assets/AgentInfoScreen-qntgg2q2.js +1 -0
  12. package/dist/client/assets/{AgentLaneCard-DI2iW9zO.js → AgentLaneCard-Cc9uyfBr.js} +1 -1
  13. package/dist/client/assets/{AgentLaneChrome-D8bARHMx.js → AgentLaneChrome-Dv2lBFoH.js} +1 -1
  14. package/dist/client/assets/{AgentLaneDetailSheet-52un7dKC.js → AgentLaneDetailSheet-CGqtqSHQ.js} +1 -1
  15. package/dist/client/assets/{AgentLaneSummaryResize-CEBjmPTa.js → AgentLaneSummaryResize-Di4u6df2.js} +1 -1
  16. package/dist/client/assets/AgentLanesEmbedScreen-BA6fRwkD.js +1 -0
  17. package/dist/client/assets/{AgentLanesPreflight-q20mTjms.js → AgentLanesPreflight-CCGBArIb.js} +1 -1
  18. package/dist/client/assets/AgentLanesView-96lHsoX7.js +2 -0
  19. package/dist/client/assets/{AgentLiveActions-DrEJDJef.js → AgentLiveActions-DlSKL60c.js} +1 -1
  20. package/dist/client/assets/AgentMasterScreen-DHrMuQ6_.js +1 -0
  21. package/dist/client/assets/{AgentSessions-DCPCG4xb.js → AgentSessions-DV9v34aq.js} +2 -2
  22. package/dist/client/assets/AgentsConsole-DTpVhS67.js +1 -0
  23. package/dist/client/assets/AgentsScreen-hZ4o2I-e.js +1 -0
  24. package/dist/client/assets/AgentsSubnav-Ci7uWM7P.js +1 -0
  25. package/dist/client/assets/{AstronautSuit-DbjQtfD_.js → AstronautSuit-CwB4Dw07.js} +1 -1
  26. package/dist/client/assets/{AtopView-Daq_ob3z.js → AtopView-D7vyQDtE.js} +1 -1
  27. package/dist/client/assets/{BackToPicker-CXZjBRAe.js → BackToPicker-BHicJyfc.js} +1 -1
  28. package/dist/client/assets/BriefingDetailScreen-B-wD_Bot.js +1 -0
  29. package/dist/client/assets/{BriefingsScreen-B5oMTGKv.js → BriefingsScreen-Cn4Mbam9.js} +1 -1
  30. package/dist/client/assets/{BrokerMetadataPanel-BsiU8lTD.js → BrokerMetadataPanel-BJSwU9XZ.js} +1 -1
  31. package/dist/client/assets/BrokerScreen-C8FQ5rlg.js +5 -0
  32. package/dist/client/assets/{CastPicker-_5E5hNUe.js → CastPicker-CkgTalIt.js} +1 -1
  33. package/dist/client/assets/{ChatCollapsedStrip-D-eXhzPf.js → ChatCollapsedStrip-7Wrg8Ge0.js} +1 -1
  34. package/dist/client/assets/{CodeDiffPane-n7W4iGUG.js → CodeDiffPane-DfluIWmO.js} +1 -1
  35. package/dist/client/assets/{CodeProjectPicker-CMsbSTDq.js → CodeProjectPicker-By_Wz9ex.js} +1 -1
  36. package/dist/client/assets/CodeScreen-cLC0tJ4S.js +1 -0
  37. package/dist/client/assets/ConversationComposer-BUIjWMBi.js +1 -0
  38. package/dist/client/assets/ConversationFeedRows-Bx0gFyG_.js +1 -0
  39. package/dist/client/assets/ConversationHeader-Bt2RBj93.js +1 -0
  40. package/dist/client/assets/{ConversationPanels-Dujvnmup.js → ConversationPanels-o6W-cOoU.js} +2 -2
  41. package/dist/client/assets/ConversationScreen-DIU7m_aC.js +2 -0
  42. package/dist/client/assets/{ConversationStatus-DVzSb2Hv.js → ConversationStatus-CTYOywFh.js} +1 -1
  43. package/dist/client/assets/{CrewAvatar-BwXjyg8N.js → CrewAvatar-CZ_faQ_s.js} +1 -1
  44. package/dist/client/assets/CrewWorkspaces-DNX-QQ1h.js +1 -0
  45. package/dist/client/assets/CrewWorkspaces-Diq11KDq.css +1 -0
  46. package/dist/client/assets/{DataTable-Bp8tU9AK.js → DataTable-C6aMSilS.js} +1 -1
  47. package/dist/client/assets/{DispatchAftermath-B-6rmXzL.js → DispatchAftermath-ZCEB75hh.js} +1 -1
  48. package/dist/client/assets/{DocumentFocusViewer-Do3wQ_3Z.js → DocumentFocusViewer-D8iB6SMt.js} +1 -1
  49. package/dist/client/assets/{EmbeddableSurfacesLab-C1orRyP9.js → EmbeddableSurfacesLab-D3iZiS8o.js} +1 -1
  50. package/dist/client/assets/{EmptyState-CJzXj1l5.js → EmptyState-CKPWFSjq.js} +1 -1
  51. package/dist/client/assets/{FileViewerPane-Df6VzXjA.js → FileViewerPane-CxNbcTYf.js} +1 -1
  52. package/dist/client/assets/FlightObserveScreen-BTe1YRPr.js +1 -0
  53. package/dist/client/assets/{FollowScreen-DvnxYLVh.js → FollowScreen-CkR-okdL.js} +1 -1
  54. package/dist/client/assets/{HarnessMark-B979GCSB.js → HarnessMark-DttReffF.js} +1 -1
  55. package/dist/client/assets/HarnessesScreen-COO_Q8VY.js +1 -0
  56. package/dist/client/assets/{HerdrSession-B3McuYgi.js → HerdrSession-DsuxCtfX.js} +1 -1
  57. package/dist/client/assets/{HomeHero-CdUVPjkG.js → HomeHero-DXJo2QSO.js} +1 -1
  58. package/dist/client/assets/{HostAdvisorView-Bok5Sk5c.js → HostAdvisorView-DeJ-8RZV.js} +1 -1
  59. package/dist/client/assets/{KnowledgeSearchInspector-B7XSoJsu.js → KnowledgeSearchInspector-W_zNIBRV.js} +1 -1
  60. package/dist/client/assets/KnowledgeSearchScreen-_rxJNUUh.js +1 -0
  61. package/dist/client/assets/{LaneToolHoverCard-HByf2ndx.js → LaneToolHoverCard-t7-XJP-h.js} +1 -1
  62. package/dist/client/assets/LaneTraceDetailSheet-DNIECgEl.js +1 -0
  63. package/dist/client/assets/{LaneTraceEventFocus-DM-hoPxG.js → LaneTraceEventFocus-BB5DhFQm.js} +1 -1
  64. package/dist/client/assets/{MeshCanvas-DCLJRsBy.js → MeshCanvas-DZv2ipsy.js} +1 -1
  65. package/dist/client/assets/{MeshCanvasMinimap-cEFS9eW7.js → MeshCanvasMinimap-BXHRNb7l.js} +1 -1
  66. package/dist/client/assets/MeshScreen-DuNvpDC5.js +1 -0
  67. package/dist/client/assets/{MeshTopologyView-CCRPd8PU.js → MeshTopologyView-Dc0GSrKa.js} +2 -2
  68. package/dist/client/assets/MessagesScreen-dNNPFwAc.js +1 -0
  69. package/dist/client/assets/{MissionContextRail-DF0_kiU7.js → MissionContextRail-DnCWPzAM.js} +1 -1
  70. package/dist/client/assets/MissionControlView-DmaThhNR.js +1 -0
  71. package/dist/client/assets/MissionFocusOverlay-K21ssTxv.js +1 -0
  72. package/dist/client/assets/MissionLeftAgentRow-CbQm4BLv.js +1 -0
  73. package/dist/client/assets/{MissionLogPane-BbdDKjUl.js → MissionLogPane-BLvSSIdT.js} +1 -1
  74. package/dist/client/assets/{NewAgentModal-DfHxad34.js → NewAgentModal-B7qxjZlW.js} +1 -1
  75. package/dist/client/assets/NewChatComposer-D2Ah4T-W.js +19 -0
  76. package/dist/client/assets/{NewChatOrigin-B1u7ki70.js → NewChatOrigin-DCn5cWPZ.js} +1 -1
  77. package/dist/client/assets/{ObserveEmbedScreen-Co0xTii6.js → ObserveEmbedScreen-DvKGsaLv.js} +2 -2
  78. package/dist/client/assets/{ObserveTextFlow-ZQWwrK3i.js → ObserveTextFlow-DCJ5EmD8.js} +2 -2
  79. package/dist/client/assets/{ObservedTopologyPanel-BJUhDSuQ.js → ObservedTopologyPanel-CJVqIqQ2.js} +1 -1
  80. package/dist/client/assets/{OpenScoutAppShell-CUd2yOLu.js → OpenScoutAppShell-C9TOLB7u.js} +2 -2
  81. package/dist/client/assets/OpsAgentsView-vIoY-AW1.js +1 -0
  82. package/dist/client/assets/OpsScreen-CJBwshEp.js +1 -0
  83. package/dist/client/assets/OpsSubnav-CjDTnp64.js +1 -0
  84. package/dist/client/assets/ProjectAgentProfile-Br1eTD7G.js +1 -0
  85. package/dist/client/assets/ProjectAgentProfileBar-CUzZ4Rpx.js +1 -0
  86. package/dist/client/assets/ProjectAgentProfileHero-mjxNcRvw.js +1 -0
  87. package/dist/client/assets/ProjectsInbox-Bq29DE_o.js +2 -0
  88. package/dist/client/assets/ProjectsRail-kMDA0yn4.js +1 -0
  89. package/dist/client/assets/ProjectsScreen-BDaJYhc0.js +1 -0
  90. package/dist/client/assets/ProjectsThreadAside-B940p3vW.js +1 -0
  91. package/dist/client/assets/Provider-D0bB7q6y.js +1 -0
  92. package/dist/client/assets/{RailRow-CEH2MFBw.js → RailRow-B88JVr62.js} +1 -1
  93. package/dist/client/assets/RawSessionsTable-CzGhEdiZ.js +1 -0
  94. package/dist/client/assets/RealtimeVoiceScreen-CyP1CWsX.js +1 -0
  95. package/dist/client/assets/{RepoDiffEmbedScreen-kY2pHjIs.js → RepoDiffEmbedScreen-mexrJPhW.js} +1 -1
  96. package/dist/client/assets/{RepoDiffPageScreen-C6LhoKrn.js → RepoDiffPageScreen-DbqX4L3q.js} +1 -1
  97. package/dist/client/assets/{RepoDiffViewer-BhcIIQQg.js → RepoDiffViewer-Bw5yMC4A.js} +1 -1
  98. package/dist/client/assets/{RepoDiffViewerLazy-Csy_j9LD.js → RepoDiffViewerLazy-DzfoFhbl.js} +2 -2
  99. package/dist/client/assets/{ReposScreen-B_cB0zu7.js → ReposScreen-CzbO1Fuy.js} +2 -2
  100. package/dist/client/assets/{ScoutDeckSurface-CSy_fjcG.js → ScoutDeckSurface-DQoZofzH.js} +1 -1
  101. package/dist/client/assets/{ScoutSurface-CQVcSrin.js → ScoutSurface-NlhDsPzg.js} +1 -1
  102. package/dist/client/assets/{ScoutbotFxLab-DqGiLYNy.js → ScoutbotFxLab-l2WAahCg.js} +1 -1
  103. package/dist/client/assets/{SecondaryNav-BR4VRdgh.js → SecondaryNav-Cs0_FQdj.js} +1 -1
  104. package/dist/client/assets/{SessionEmbedScreen-BTlZ9gAg.js → SessionEmbedScreen-CpduQ0O9.js} +1 -1
  105. package/dist/client/assets/{SessionObserve-dQDN23pP.js → SessionObserve-BVeTkcIl.js} +1 -1
  106. package/dist/client/assets/{SessionObserveEvidence-BRBGKAgd.js → SessionObserveEvidence-BkOezTGV.js} +1 -1
  107. package/dist/client/assets/SessionRefScreen-DetLMkTT.js +1 -0
  108. package/dist/client/assets/SessionsScreen-B-McKw6d.js +1 -0
  109. package/dist/client/assets/{SettingsDrawer-RGVK_bmE.js → SettingsDrawer-CPB32w0n.js} +3 -3
  110. package/dist/client/assets/SettingsScreen-BEzYFdjz.js +1 -0
  111. package/dist/client/assets/{ShikiPane-DYI9Hkge.js → ShikiPane-C0TuCATU.js} +1 -1
  112. package/dist/client/assets/{SlidePanel-B9ugxWgA.js → SlidePanel-CETQ5NTx.js} +1 -1
  113. package/dist/client/assets/{SpriteAvatar-z5hHesx9.js → SpriteAvatar-DFO4Kb4Z.js} +1 -1
  114. package/dist/client/assets/{StatusPill-BFvMjmZV.js → StatusPill-BllrY-eg.js} +1 -1
  115. package/dist/client/assets/{TailView-0uEIj2JH.js → TailView-_gKWfaQM.js} +2 -2
  116. package/dist/client/assets/Terminal-DWyZTZdY.js +1 -0
  117. package/dist/client/assets/TerminalEmbedScreen-_SSzwhWa.js +1 -0
  118. package/dist/client/assets/{TerminalHeaderMount-BL07cd0q.js → TerminalHeaderMount-CY7uIWBg.js} +1 -1
  119. package/dist/client/assets/{TextDocumentSurface-BflAwXeZ.js → TextDocumentSurface-2X1Gw4eA.js} +1 -1
  120. package/dist/client/assets/{TmuxPeek-BTnjOQi0.js → TmuxPeek-CqTJRhkI.js} +1 -1
  121. package/dist/client/assets/{VoicePermissionsPanel-CgQ6GGS-.js → VoicePermissionsPanel-C4vkU-sU.js} +1 -1
  122. package/dist/client/assets/{WorkDetailScreen-CaLG-zDs.js → WorkDetailScreen-DqGnuK0e.js} +3 -3
  123. package/dist/client/assets/{WorkFilesViewer-B9Sil_No.js → WorkFilesViewer-D8-4vF5l.js} +1 -1
  124. package/dist/client/assets/{activity-DcrMApUY.js → activity-CzTJ-YMX.js} +1 -1
  125. package/dist/client/assets/{addon-fit-DMVrz5Sv.js → addon-fit-Zx3A7pGS.js} +1 -1
  126. package/dist/client/assets/{addon-webgl-BYvpZUyu.js → addon-webgl-DitJj-N0.js} +1 -1
  127. package/dist/client/assets/{agent-autocomplete-B-5QTeas.js → agent-autocomplete-BlK8wY06.js} +1 -1
  128. package/dist/client/assets/{agent-essentials-D7KRGYvF.js → agent-essentials-K9B6kbTS.js} +1 -1
  129. package/dist/client/assets/{agent-lane-card-model-CNZMPkhc.js → agent-lane-card-model-CY3OE1Xu.js} +1 -1
  130. package/dist/client/assets/{agent-lanes-model-DXqjs0OK.js → agent-lanes-model-tc-1hE6q.js} +1 -1
  131. package/dist/client/assets/{agent-master-model-DqjrVI2h.js → agent-master-model-DMcHeNq3.js} +1 -1
  132. package/dist/client/assets/agent-specialization-CtF_jI34.js +1 -0
  133. package/dist/client/assets/agents-project-DgbqDc65.css +1 -0
  134. package/dist/client/assets/{arc.es-NHqHWohb.js → arc.es-BNXJqSw7.js} +1 -1
  135. package/dist/client/assets/{arrow-down-CKtSUjmW.js → arrow-down-BAGkhHA6.js} +1 -1
  136. package/dist/client/assets/{arrow-left-Czpf-AE4.js → arrow-left-eToA6GxC.js} +1 -1
  137. package/dist/client/assets/{arrow-right-BuzMnLYP.js → arrow-right-DTX42clh.js} +1 -1
  138. package/dist/client/assets/{arrow-up-right-C6Wl-1uw.js → arrow-up-right-B09GPwFl.js} +1 -1
  139. package/dist/client/assets/{bot-rd0awxD3.js → bot-WxKXYtEX.js} +1 -1
  140. package/dist/client/assets/{check-ofKUE8yH.js → check-Dz2SRHft.js} +1 -1
  141. package/dist/client/assets/{chevron-down-wciXnOQz.js → chevron-down-D120PY4g.js} +1 -1
  142. package/dist/client/assets/{chevron-right-D-HdlPg8.js → chevron-right-CowuvuE6.js} +1 -1
  143. package/dist/client/assets/{chunk-HRAB3GC3-Tyv9rzx7.js → chunk-HRAB3GC3-KjjrTLCU.js} +1 -1
  144. package/dist/client/assets/{chunk-JTPDIGGW-BC2Mandc.js → chunk-JTPDIGGW-COJ00z94.js} +3 -3
  145. package/dist/client/assets/{chunk-T65CQEWV-C1AWTYZZ.js → chunk-T65CQEWV-H2QEKfr1.js} +1 -1
  146. package/dist/client/assets/{chunk-YOZR3KYS-DwHPHa6f.js → chunk-YOZR3KYS-CrCgXw9l.js} +1 -1
  147. package/dist/client/assets/{clock-B88r8OrZ.js → clock-_9FDplIT.js} +1 -1
  148. package/dist/client/assets/{code-xml-D7pOQM9l.js → code-xml-CkkNdRmu.js} +1 -1
  149. package/dist/client/assets/{compass-Dt1AMXz2.js → compass-BdpImt_W.js} +1 -1
  150. package/dist/client/assets/content-0RBfbCIJ.js +1 -0
  151. package/dist/client/assets/content-BTmnk2bl.js +1 -0
  152. package/dist/client/assets/content-Bk5DKhyP.js +1 -0
  153. package/dist/client/assets/{content-nkx0swDe.js → content-Bw_8GE_S.js} +1 -1
  154. package/dist/client/assets/content-CI4gLEWi.js +1 -0
  155. package/dist/client/assets/content-CLCtp9Rb.js +1 -0
  156. package/dist/client/assets/content-C_FAGTNk.js +1 -0
  157. package/dist/client/assets/content-CnnzWOE3.js +1 -0
  158. package/dist/client/assets/content-DKlY98pO.js +1 -0
  159. package/dist/client/assets/content-Df7ndXTG.js +1 -0
  160. package/dist/client/assets/content-DkZDzzx3.js +1 -0
  161. package/dist/client/assets/content-DnGmb2L0.js +1 -0
  162. package/dist/client/assets/content-Ds-zs-Ss.js +1 -0
  163. package/dist/client/assets/content-JIWSyC0f.js +1 -0
  164. package/dist/client/assets/content-Q3TIYC8q.js +1 -0
  165. package/dist/client/assets/content-evaBfvxD.js +1 -0
  166. package/dist/client/assets/{context-budget-DX_fwUs3.js → context-budget-DqxWzalx.js} +1 -1
  167. package/dist/client/assets/{conversation-icons-tp9BX6X2.js → conversation-icons-DHGc9wbT.js} +1 -1
  168. package/dist/client/assets/conversation-model-C2KuZUXc.js +1 -0
  169. package/dist/client/assets/conversation-motion-features-BJnHs3Ul.js +1 -0
  170. package/dist/client/assets/{copy-CWWAJ75H.js → copy-BzdzWsQd.js} +1 -1
  171. package/dist/client/assets/{cpu-DrqejfkB.js → cpu-CHFIGw87.js} +1 -1
  172. package/dist/client/assets/{createLucideIcon-DezKXSG2.js → createLucideIcon-Dv8H8m7J.js} +1 -1
  173. package/dist/client/assets/discover-DutlV0ZU.js +2 -0
  174. package/dist/client/assets/embed-entry-CJG7WEVw.js +2 -0
  175. package/dist/client/assets/{external-link-Dp_a2vRZ.js → external-link-BvX5PfLh.js} +1 -1
  176. package/dist/client/assets/{eye-BRyD0jno.js → eye-C9cGk5z6.js} +1 -1
  177. package/dist/client/assets/{file-code-corner-muIVH_xO.js → file-code-corner-jlGFdr8d.js} +1 -1
  178. package/dist/client/assets/{file-text-CqJgwxmv.js → file-text-BHro8MkG.js} +1 -1
  179. package/dist/client/assets/{gauge-hU--hKVP.js → gauge-DSflSery.js} +1 -1
  180. package/dist/client/assets/{gestures-DN4hEeqv.js → gestures-YA5IIwp-.js} +1 -1
  181. package/dist/client/assets/{git-branch-CK5v8F2v.js → git-branch-Bc_eDIpG.js} +1 -1
  182. package/dist/client/assets/{home-moving-signal-BjDtEJUP.js → home-moving-signal-PHSqSBu_.js} +1 -1
  183. package/dist/client/assets/home-now-card-C_qsI6C6.js +1 -0
  184. package/dist/client/assets/{home-now-card-nano-C-r_bBg5.js → home-now-card-nano-Jmy7eJ6H.js} +1 -1
  185. package/dist/client/assets/{hooks-D46bABUP.js → hooks-ME7rmhpE.js} +1 -1
  186. package/dist/client/assets/{index-DvLtl7rV.js → index-C1VaWNuD.js} +2 -2
  187. package/dist/client/assets/index-C8UCRm2W.js +1 -0
  188. package/dist/client/assets/index-Cn0I2Hgi.js +1 -0
  189. package/dist/client/assets/index-Cx6Gbr6n.js +1 -0
  190. package/dist/client/assets/{inspector-panel-Dkc7rLvY.js → inspector-panel-CwrHjRaQ.js} +2 -2
  191. package/dist/client/assets/{keyboard-nav-BLYDhL3Z.js → keyboard-nav-B8sQ_8IF.js} +1 -1
  192. package/dist/client/assets/{lane-roster-store-DOdI1O13.js → lane-roster-store-DN2jxXF-.js} +1 -1
  193. package/dist/client/assets/{layers-CSsg3JVP.js → layers-CW2-qHsG.js} +1 -1
  194. package/dist/client/assets/{layout-grid-DOChPJdZ.js → layout-grid-BoVnPOk-.js} +1 -1
  195. package/dist/client/assets/left-BRu9pnqx.js +2 -0
  196. package/dist/client/assets/left-BjS1dKNV.js +2 -0
  197. package/dist/client/assets/left-CL-TVLJ7.js +1 -0
  198. package/dist/client/assets/left-DLpsDi55.js +1 -0
  199. package/dist/client/assets/left-DPcM9o8Y.js +1 -0
  200. package/dist/client/assets/left-MmTJf1tK.js +1 -0
  201. package/dist/client/assets/left-P80i5V8L.js +1 -0
  202. package/dist/client/assets/left-advisor-CbXVzAqS.js +1 -0
  203. package/dist/client/assets/left-agents-7mJsiNyr.js +1 -0
  204. package/dist/client/assets/left-default-COK26l3H.js +1 -0
  205. package/dist/client/assets/left-lanes-Dbdm9Veu.js +1 -0
  206. package/dist/client/assets/left-mission-DqGR5jby.js +1 -0
  207. package/dist/client/assets/library-COnWzUWv.js +1 -0
  208. package/dist/client/assets/{loader-circle-pM56HNhR.js → loader-circle-DmUG_YC7.js} +1 -1
  209. package/dist/client/assets/{local-agents-C8xAhbO5.js → local-agents-VP1-ZlPw.js} +1 -1
  210. package/dist/client/assets/{mentions-DG6OQrsc.js → mentions-BZ5SBMtc.js} +1 -1
  211. package/dist/client/assets/mesh-buckets-CLYS8Jx8.js +1 -0
  212. package/dist/client/assets/{mesh-ops-BZ1h5RQs.js → mesh-ops-CKSWgax2.js} +1 -1
  213. package/dist/client/assets/{mesh-view-store-ChUOASK8.js → mesh-view-store-CBM1za_N.js} +1 -1
  214. package/dist/client/assets/{message-circle-mZCv8tvB.js → message-circle-joGFxfj1.js} +1 -1
  215. package/dist/client/assets/{message-markup-C2LQDm_k.js → message-markup-DC0QFEZn.js} +1 -1
  216. package/dist/client/assets/{message-square-C7t_qtuj.js → message-square-BLiFqpe_.js} +1 -1
  217. package/dist/client/assets/{mission-control-store-nDLdUZPA.js → mission-control-store-CM8mQGg8.js} +1 -1
  218. package/dist/client/assets/model-CBkMvT1w.js +1 -0
  219. package/dist/client/assets/{observe-BpEm1INu.js → observe-BLmy4quB.js} +1 -1
  220. package/dist/client/assets/{page-status-E5jnk48p.js → page-status-BE0-J1xY.js} +1 -1
  221. package/dist/client/assets/{paperclip-C64lkcbM.js → paperclip-Br7wUDFl.js} +1 -1
  222. package/dist/client/assets/{persistent-state-EHXw8WNy.js → persistent-state-BubPQ7tT.js} +1 -1
  223. package/dist/client/assets/{plus-Co-dqKul.js → plus-BWKhylds.js} +1 -1
  224. package/dist/client/assets/profile-BCvk8jOQ.js +1 -0
  225. package/dist/client/assets/projects-inbox-BIW7nv-H.css +1 -0
  226. package/dist/client/assets/projects-inbox-DFbgVlXL.js +1 -0
  227. package/dist/client/assets/{proxy-BiW5suC7.js → proxy-DVDRhSRR.js} +1 -1
  228. package/dist/client/assets/{radio-BOxBQX-T.js → radio-CxIXS1nU.js} +1 -1
  229. package/dist/client/assets/{refresh-cw-DMxGzDwn.js → refresh-cw-Bkh7Cvnd.js} +1 -1
  230. package/dist/client/assets/resolve-panes-DhD5qmQO.js +1 -0
  231. package/dist/client/assets/resolve-sidebar-context-GqhZNRPY.js +1 -0
  232. package/dist/client/assets/right-B_08ilv6.js +1 -0
  233. package/dist/client/assets/right-Brm67HOL.js +1 -0
  234. package/dist/client/assets/right-BveAPKBW.js +1 -0
  235. package/dist/client/assets/right-CpTB_-Ya.js +1 -0
  236. package/dist/client/assets/right-CqC4Qdot.js +1 -0
  237. package/dist/client/assets/right-D91j9d5Y.js +1 -0
  238. package/dist/client/assets/{right-CimaAvQN.js → right-DVUq5374.js} +1 -1
  239. package/dist/client/assets/right-DaLRhYl3.js +1 -0
  240. package/dist/client/assets/right-Dt1wOwA5.js +1 -0
  241. package/dist/client/assets/right-DtzqIZQF.js +1 -0
  242. package/dist/client/assets/{rocket-BQm5_CvR.js → rocket-CnxqjX_K.js} +1 -1
  243. package/dist/client/assets/{router-B9vQkNJL.js → router-kfcaYqZr.js} +1 -1
  244. package/dist/client/assets/runtime-picker-C20lTGhV.js +1 -0
  245. package/dist/client/assets/{scope-views-1IYJdl41.js → scope-views-KPY85UUx.js} +1 -1
  246. package/dist/client/assets/{scout-voice-BVUqGhth.js → scout-voice-Cg1qfepC.js} +1 -1
  247. package/dist/client/assets/scoutbot-D7kGGyK_.js +3 -0
  248. package/dist/client/assets/{scoutbot-markdown-BQ_Ee2Ic.js → scoutbot-markdown-yb87JlSE.js} +1 -1
  249. package/dist/client/assets/{scroll-text-Dze_dXtQ.js → scroll-text-DFcBYy5J.js} +1 -1
  250. package/dist/client/assets/{search-CDko0PKE.js → search-FB2vVxCp.js} +1 -1
  251. package/dist/client/assets/{secondaryNavConfig-BoQ_zYR9.js → secondaryNavConfig-C0Srrmy8.js} +1 -1
  252. package/dist/client/assets/{selection-bridge-Din6yV3h.js → selection-bridge-qBGFCJv8.js} +1 -1
  253. package/dist/client/assets/{send-horizontal-CSjIm6xg.js → send-horizontal-CS7mxVhX.js} +1 -1
  254. package/dist/client/assets/{server-Bzj7lPIx.js → server-WY6gsbZz.js} +1 -1
  255. package/dist/client/assets/{session-catalog-DsaZJXZt.js → session-catalog-CG4oL_yN.js} +1 -1
  256. package/dist/client/assets/{session-table-BQfR7u6r.js → session-table-uJh3v-ly.js} +1 -1
  257. package/dist/client/assets/{settings-Dyvpkb1D.js → settings-DQEtqkM9.js} +1 -1
  258. package/dist/client/assets/{sliders-horizontal-C8njVwfg.js → sliders-horizontal-57e99_qO.js} +1 -1
  259. package/dist/client/assets/{sparkles-CETYrxGA.js → sparkles-D0vWLTyC.js} +1 -1
  260. package/dist/client/assets/{sse-CD9MMUxl.js → sse-B29iGBnw.js} +1 -1
  261. package/dist/client/assets/{system-surfaces-redesign-QVXNeGYw.css → system-surfaces-redesign-kuf3wuE_.css} +1 -1
  262. package/dist/client/assets/{tail-events-Ps8KpKah.js → tail-events-LK29oCKm.js} +1 -1
  263. package/dist/client/assets/{terminal-9GRS_Qdc.js → terminal-UDy4lzV1.js} +1 -1
  264. package/dist/client/assets/{terminal-relay-GYMIvKs1.js → terminal-relay-CXHMdain.js} +1 -1
  265. package/dist/client/assets/{terminal-screen-BLk4PAYt.css → terminal-screen-vMICbBJh.css} +1 -1
  266. package/dist/client/assets/{terminal-sessions-BQ6t92tJ.js → terminal-sessions-Bdt2W3Y4.js} +1 -1
  267. package/dist/client/assets/{terminal-takeover-_Jyys4me.js → terminal-takeover-BMeBjBB2.js} +1 -1
  268. package/dist/client/assets/{use-conversation-list-C9ABzjXI.js → use-conversation-list-UG-tMN67.js} +1 -1
  269. package/dist/client/assets/{use-fleet-active-asks-DAspZQjE.js → use-fleet-active-asks-CCGrll5q.js} +1 -1
  270. package/dist/client/assets/{use-mesh-ops-items-Dh54ymEp.js → use-mesh-ops-items-BjyeFJTz.js} +1 -1
  271. package/dist/client/assets/{use-reduced-motion-x8pJMVrG.js → use-reduced-motion-CPoX8iV2.js} +1 -1
  272. package/dist/client/assets/{use-scout-dev-flags-DhCbiDK3.js → use-scout-dev-flags-DTseRrFi.js} +1 -1
  273. package/dist/client/assets/{useAgentHoverCard-DoBwV0LX.js → useAgentHoverCard-BgTLNcF-.js} +1 -1
  274. package/dist/client/assets/useContentSecondaryNav-CoIoz7JU.js +1 -0
  275. package/dist/client/assets/useEmbedHeadline-DuUnwTB7.js +1 -0
  276. package/dist/client/assets/{usePierreRuntime-ejq9dCWV.js → usePierreRuntime-35AHf9RQ.js} +1 -1
  277. package/dist/client/assets/{wrench-DjkoAOQt.js → wrench-BfVeded5.js} +1 -1
  278. package/dist/client/assets/{x-CAbNespN.js → x-DgmmnPKt.js} +1 -1
  279. package/dist/client/assets/{xterm-Cf-ngcGP.js → xterm-DnJJmrCA.js} +1 -1
  280. package/dist/client/assets/{zap-Cq8eWkcF.js → zap-Bcja1lHG.js} +1 -1
  281. package/dist/client/index.html +1 -1
  282. package/dist/main.mjs +5180 -9874
  283. package/dist/node/main.mjs +18 -2
  284. package/dist/pairing-runtime-controller.mjs +31 -2
  285. package/dist/runtime/broker-daemon.mjs +87 -13
  286. package/dist/scout-control-plane-web.mjs +35 -3
  287. package/package.json +2 -5
  288. package/dist/client/assets/ActivityScreen-BnoaUkVZ.js +0 -1
  289. package/dist/client/assets/AgentConfigurationScreen-CuZJy07q.js +0 -1
  290. package/dist/client/assets/AgentDefinitionsWorkspace-Iyl4BesU.js +0 -1
  291. package/dist/client/assets/AgentFloorView-YT-Jjccf.js +0 -1
  292. package/dist/client/assets/AgentInfoScreen-Dr99gQEZ.js +0 -1
  293. package/dist/client/assets/AgentLanesEmbedScreen-Dgcm7zd_.js +0 -1
  294. package/dist/client/assets/AgentLanesView-CetZZDyF.js +0 -2
  295. package/dist/client/assets/AgentMasterScreen-DJPnstoD.js +0 -1
  296. package/dist/client/assets/AgentsConsole-CsYOoFJi.js +0 -1
  297. package/dist/client/assets/AgentsScreen-k8LvBuU_.js +0 -1
  298. package/dist/client/assets/AgentsSubnav-C4xpQhsv.js +0 -1
  299. package/dist/client/assets/BriefingDetailScreen-CUCXO-KH.js +0 -1
  300. package/dist/client/assets/BrokerScreen-BPbOHhCS.js +0 -5
  301. package/dist/client/assets/CodeScreen-CeuO3EhR.js +0 -1
  302. package/dist/client/assets/ConversationComposer-CXPKx86g.js +0 -1
  303. package/dist/client/assets/ConversationFeedRows-WrH-YI3L.js +0 -1
  304. package/dist/client/assets/ConversationHeader-BQWzGzLK.js +0 -1
  305. package/dist/client/assets/ConversationScreen-CR9pWB65.js +0 -2
  306. package/dist/client/assets/CrewWorkspaces-CkQDhyie.css +0 -1
  307. package/dist/client/assets/CrewWorkspaces-NKujRzwh.js +0 -1
  308. package/dist/client/assets/FlightObserveScreen-6mGnmWQA.js +0 -1
  309. package/dist/client/assets/HarnessesScreen-CHTuv8p6.js +0 -1
  310. package/dist/client/assets/KnowledgeSearchScreen-D3o3IODW.js +0 -1
  311. package/dist/client/assets/LaneTraceDetailSheet-BUgHz-sd.js +0 -1
  312. package/dist/client/assets/MeshScreen-BcxPkhm6.js +0 -1
  313. package/dist/client/assets/MessagesScreen-Bb5l13MO.js +0 -1
  314. package/dist/client/assets/MissionControlView-E3V7bENU.js +0 -1
  315. package/dist/client/assets/MissionFocusOverlay-h15sQFvP.js +0 -1
  316. package/dist/client/assets/MissionLeftAgentRow-KPdk9rSa.js +0 -1
  317. package/dist/client/assets/NewChatComposer-_Stj0fZy.js +0 -19
  318. package/dist/client/assets/OpsAgentsView-DI5wu1si.js +0 -1
  319. package/dist/client/assets/OpsScreen-D8fQafCl.js +0 -1
  320. package/dist/client/assets/OpsSubnav-1K4Jaf__.js +0 -1
  321. package/dist/client/assets/ProjectAgentProfile-Bdjd_dAx.js +0 -1
  322. package/dist/client/assets/ProjectAgentProfileBar-k2QHHHsQ.js +0 -1
  323. package/dist/client/assets/ProjectAgentProfileHero-Bpxk1ui2.js +0 -1
  324. package/dist/client/assets/ProjectsInbox-C_bMHLCc.js +0 -2
  325. package/dist/client/assets/ProjectsRail-J-aH_pxT.js +0 -1
  326. package/dist/client/assets/ProjectsScreen-cVUkGbPz.js +0 -1
  327. package/dist/client/assets/ProjectsThreadAside-_ourdM-Q.js +0 -1
  328. package/dist/client/assets/Provider-CtXJeLrP.js +0 -1
  329. package/dist/client/assets/RawSessionsTable-CDyrom-F.js +0 -1
  330. package/dist/client/assets/RealtimeVoiceScreen-DBl3DN1H.js +0 -1
  331. package/dist/client/assets/SessionRefScreen-COVQMbtE.js +0 -1
  332. package/dist/client/assets/SessionsScreen--5OJ3p3v.js +0 -1
  333. package/dist/client/assets/SettingsScreen-CCxzy5IU.js +0 -1
  334. package/dist/client/assets/Terminal-DouZeNxc.js +0 -1
  335. package/dist/client/assets/TerminalEmbedScreen-dMNUbzXr.js +0 -1
  336. package/dist/client/assets/agent-specialization-BujJVUTD.js +0 -1
  337. package/dist/client/assets/agents-project-COzHxZAF.css +0 -1
  338. package/dist/client/assets/agents-project-model-UYiamtrU.js +0 -1
  339. package/dist/client/assets/content-9K38QchR.js +0 -1
  340. package/dist/client/assets/content-BRgnyXWh.js +0 -1
  341. package/dist/client/assets/content-BWPNyXJ0.js +0 -1
  342. package/dist/client/assets/content-BdkI07v3.js +0 -1
  343. package/dist/client/assets/content-C4oWa8SB.js +0 -1
  344. package/dist/client/assets/content-C9ijJxyl.js +0 -1
  345. package/dist/client/assets/content-CFZ4rghn.js +0 -1
  346. package/dist/client/assets/content-CIqu_Ci_.js +0 -1
  347. package/dist/client/assets/content-CnJF9DGO.js +0 -1
  348. package/dist/client/assets/content-CriW8Y8u.js +0 -1
  349. package/dist/client/assets/content-DDCyPPk_.js +0 -1
  350. package/dist/client/assets/content-DtcZeh5m.js +0 -1
  351. package/dist/client/assets/content-U9tsdtle.js +0 -1
  352. package/dist/client/assets/content-hFLK3CON.js +0 -1
  353. package/dist/client/assets/content-p00KQrtD.js +0 -1
  354. package/dist/client/assets/conversation-model-Dc02NsGp.js +0 -1
  355. package/dist/client/assets/conversation-motion-features-D9-RmBSq.js +0 -1
  356. package/dist/client/assets/discover-C2CZO4Tk.js +0 -2
  357. package/dist/client/assets/embed-entry-BSMUykuG.js +0 -2
  358. package/dist/client/assets/home-now-card-nF8OotI-.js +0 -1
  359. package/dist/client/assets/index-CPrU5q04.js +0 -1
  360. package/dist/client/assets/index-kL1WLbeS.js +0 -1
  361. package/dist/client/assets/index-zvhpRHao.js +0 -1
  362. package/dist/client/assets/left-B-SdEJSJ.js +0 -1
  363. package/dist/client/assets/left-B3wSE6ql.js +0 -1
  364. package/dist/client/assets/left-BNRFiRsb.js +0 -2
  365. package/dist/client/assets/left-BggzhgXN.js +0 -1
  366. package/dist/client/assets/left-CARCvvxS.js +0 -2
  367. package/dist/client/assets/left-CpokZYHt.js +0 -1
  368. package/dist/client/assets/left-YT7mIGuH.js +0 -1
  369. package/dist/client/assets/left-advisor-CCY0vkcO.js +0 -1
  370. package/dist/client/assets/left-agents-trhO5sL8.js +0 -1
  371. package/dist/client/assets/left-default-CG33elBs.js +0 -1
  372. package/dist/client/assets/left-lanes-CitMgeTp.js +0 -1
  373. package/dist/client/assets/left-mission-Zl2m_5eU.js +0 -1
  374. package/dist/client/assets/library-DkALuCh5.js +0 -1
  375. package/dist/client/assets/mesh-buckets-6y3ZIibI.js +0 -1
  376. package/dist/client/assets/mesh-roster-Bc7T4b7z.js +0 -1
  377. package/dist/client/assets/model-IGCUEsMy.js +0 -1
  378. package/dist/client/assets/profile-APxDsN2P.js +0 -1
  379. package/dist/client/assets/projects-inbox-Cg4X2lUQ.js +0 -1
  380. package/dist/client/assets/projects-inbox-DRBl2N85.css +0 -1
  381. package/dist/client/assets/resolve-panes-DeVJbS9c.js +0 -1
  382. package/dist/client/assets/resolve-sidebar-context-BQe5J6xF.js +0 -1
  383. package/dist/client/assets/right-Bmfd3pjP.js +0 -1
  384. package/dist/client/assets/right-BqI-nr9G.js +0 -1
  385. package/dist/client/assets/right-BuCgE0fZ.js +0 -1
  386. package/dist/client/assets/right-BwlW6E57.js +0 -1
  387. package/dist/client/assets/right-C0ybUw0j.js +0 -1
  388. package/dist/client/assets/right-CdkcrmeD.js +0 -1
  389. package/dist/client/assets/right-CkCCPbCX.js +0 -1
  390. package/dist/client/assets/right-D3eSiy41.js +0 -1
  391. package/dist/client/assets/right-Dz_xD0Vj.js +0 -1
  392. package/dist/client/assets/scoutbot-BJIamJOH.js +0 -3
  393. package/dist/client/assets/text-BP3oyl8-.js +0 -1
  394. package/dist/client/assets/useContentSecondaryNav-pZe2Zfk1.js +0 -1
  395. /package/dist/client/assets/{text-BYAFNLNq.css → runtime-picker-BYAFNLNq.css} +0 -0
@@ -1 +1 @@
1
- import{r as L,j as jt,N as ce,O as Nt,P as Ne,Q as Me,A as Mt,R as Bt,B as k,D as h,T as zt,U as J,V as Wt,W as Kt}from"./index-DvLtl7rV.js";import{b as Gt}from"./perf-PX8Rx0EP.js";import{n as ue}from"./synthetic-agent-routing-aduMYO7P.js";import{o as Ht,q as Be,n as Vt,u as Yt}from"./terminal-sessions-BQ6t92tJ.js";var ze=["local","url","sharedConfig","env"];function We(e){const t=qt(e),n=e.audienceIncludes??Qt(e.audienceOrder),s=new Set;function o(a){!e.warnOnUnknown||s.has(a)||(s.add(a),typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[hudsonkit/flags] Unknown feature flag "${a}" resolved false.`))}const r=e.registry;function i(a){const c=r[a];if(!c)return o(a),{key:a,enabled:!1,value:!1,layer:"default",audience:t,reason:"unknown-flag"};const d=Xt(e.layers,a);return d?{key:a,enabled:d.value,value:d.value,layer:d.layer,audience:t,requiredTier:c.tier,reason:"override",definition:c}:c.defaultEnabled?c.tier&&!n(t,c.tier)?{key:a,enabled:!1,value:!1,layer:"default",audience:t,requiredTier:c.tier,reason:"audience-denied",definition:c}:{key:a,enabled:!0,value:!0,layer:"default",audience:t,requiredTier:c.tier,reason:"default",definition:c}:{key:a,enabled:!1,value:!1,layer:"default",audience:t,requiredTier:c.tier,reason:"default",definition:c}}return{registry:e.registry,isEnabled:a=>i(String(a)).enabled,explain:a=>i(String(a)),all:()=>Object.keys(e.registry).sort().map(i),audience:()=>t}}function qt(e){let t=e.audience.tier;for(const n of ze.slice().reverse()){const s=e.layers?.[n]?.audience;s&&(t=s)}return{...e.audience,tier:t}}function Qt(e){return(t,n)=>{if(t.tier===n)return!0;if(!e||e.length===0)return!1;const s=e.indexOf(t.tier),o=e.indexOf(n);return s<0||o<0?!1:s>=o}}function Xt(e,t){for(const n of ze){const s=Zt(e?.[n]?.flags?.[t]);if(s!==null)return{layer:n,value:s}}return null}function Zt(e){return e===!0||e==="on"?!0:e===!1||e==="off"?!1:null}function Jt(e){if(e===!0||e===!1)return e;if(typeof e=="number"){if(e===1)return!0;if(e===0)return!1}if(typeof e!="string")return;const t=e.trim().toLowerCase();if(["1","true","on","yes","enabled","enable"].includes(t))return!0;if(["0","false","off","no","disabled","disable"].includes(t))return!1;if(["default","null","unset","clear"].includes(t))return"default"}function en(e,t={}){const n=t.paramPrefix??"ff.",s=t.audienceParam??"ffAudience",o=typeof e=="string"?new URL(e,"http://hudson.local"):e,r={};let i;for(const[a,c]of o.searchParams.entries()){if(a===s&&c.trim()&&(i=c.trim()),!a.startsWith(n))continue;const d=a.slice(n.length),f=Jt(c);d&&f!==void 0&&(r[d]=f)}return{flags:r,audience:i}}var D=1;function Ke(e){if(typeof window>"u")return{version:D};try{const t=window.localStorage?.getItem(e);return tn(t)}catch{return{version:D}}}function q(e,t){if(typeof window>"u")return;const n=Ge(t),s=JSON.stringify(n);try{window.localStorage?.setItem(e,s)}catch{}nn(e,s)}function tn(e){if(!e)return{version:D};try{const t=JSON.parse(e);return!t||typeof t!="object"?{version:D}:Ge(t)}catch{return{version:D}}}function Ge(e){const t={version:D};if(e.audience&&(t.audience=e.audience),e.flags&&typeof e.flags=="object"){t.flags={};for(const[n,s]of Object.entries(e.flags))(s===!0||s===!1)&&(t.flags[n]=s);Object.keys(t.flags).length===0&&delete t.flags}return t}function nn(e,t){if(!(typeof document>"u"))try{const n=encodeURIComponent(t);document.cookie=`${encodeURIComponent(e)}=${n}; Path=/; SameSite=Lax; Max-Age=31536000`}catch{}}var sn="hudson.flags",He=L.createContext(null);function js({registry:e,audience:t,audienceOrder:n,audienceIncludes:s,initialLayers:o,storageKey:r=sn,warnOnUnknown:i=!1,children:a}){const[c,d]=L.useState(()=>{const g=o?.local;return{version:1,audience:g?.audience??void 0,flags:on(g)}});L.useEffect(()=>{const g=Ke(r);(g.audience||Object.keys(g.flags??{}).length>0)&&d(g)},[r]);const f=L.useMemo(()=>({...o,local:{...o?.local,audience:c.audience??o?.local?.audience,flags:{...o?.local?.flags??{},...c.flags??{}}}}),[o,c]),S=L.useMemo(()=>We({registry:e,audience:t,audienceOrder:n,audienceIncludes:s,layers:f,warnOnUnknown:i}),[e,t,n,s,f,i]),A=L.useMemo(()=>({...S,layers:f,storageKey:r,setLocalOverride:(g,w)=>{d(R=>{const U={...R.flags??{}};w===null?delete U[g]:U[g]=w;const _={...R,version:1,flags:U};return q(r,_),_})},setLocalAudienceOverride:g=>{d(w=>{const R={...w,version:1,audience:g??void 0};return q(r,R),R})},resetLocalOverrides:()=>{const g={version:1};q(r,g),d(g)}}),[S,f,r]);return jt.jsx(He.Provider,{value:A,children:a})}function Ve(){return L.useContext(He)}function Ns(){const e=Ve();if(!e)throw new Error("useFeatureFlags must be used within FeatureFlagsProvider");return e}function Ms(e,t=!0){return Ve()?.isEnabled(e)??t}function on(e){if(!e?.flags)return;const t={};for(const[n,s]of Object.entries(e.flags))(s===!0||s===!1)&&(t[n]=s);return Object.keys(t).length>0?t:void 0}const rn=["ops.control","ops.mesh","ops.runtime","ops.plans","ops.terminal"],an=["surface.search","surface.sessions","surface.briefings","surface.work","surface.activity","surface.follow","surface.scoutbot","surface.workflows"];function ye(e,t){return Object.fromEntries(e.map(n=>[n,t]))}const Ye={label:"Surface · Scope",description:`Scope presentation on Scout infra — lean lanes/tail/sessions/agents at ${Nt}/*.`,defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","scope","observability"]},cn={...Ye,label:"Surface · Scope (legacy alias)",description:`Legacy alias for ${ce}. Prefer the primary flag; ${Ne} remains for old dev links.`},Bs=ce;function un(){return{audience:"everyone",flags:{"ops.control":!0,"ops.lanes":!0,...ye(rn,!1),...ye(an,!1)}}}const qe=["ffBundle","ffVariant","scoutBundle","scoutExperience","ab"],Qe=["ffGlobal","scoutGlobalBundle"],Xe=["ffPersist","persistBundle"],ln=new Set(["no-ops","ffAudience",...qe,...Qe,...Xe]);function zs(e){for(const t of[...e.searchParams.keys()])(ln.has(t)||t.startsWith("ff."))&&e.searchParams.delete(t);return e}const dn=["everyone","internal","power"],fn="openscout.flags",ee="openscout.flagBundle",mn={tier:"power"},Ee=["ops.control","ops.mesh","ops.runtime","ops.plans","ops.terminal","ops.lanes"],$e=["surface.search","surface.sessions","surface.briefings","surface.work","surface.activity","surface.follow","surface.mesh-ops","surface.scoutbot","surface.workflows"],pn={"nav.sidebar":{label:"Nav · Sidebar",description:"Classic sidebar chrome (8 primary areas + icon rail). Default on since sco-083 soak; opt out with ?ff.nav.sidebar=off. Not included in max-pro.",defaultEnabled:!0,tier:"everyone",owner:"scout-web",tags:["nav","chrome"]},"ops.control":{label:"Ops · Control",description:"Mission control, issues, and the Ops section shell.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops","nav"]},"ops.mesh":{label:"Ops · Mesh",description:"Mesh topology and peer status.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"ops.runtime":{label:"Ops · Runtime",description:"Runtime / atop process telemetry.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"ops.plans":{label:"Ops · Plans",description:"Plan documents and plan-mode review.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"ops.terminal":{label:"Ops · Terminal",description:"Observe / takeover terminal sessions.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"ops.lanes":{label:"Ops · Agent Lanes",description:"One column per local agent — follow live harness work in power-user mode.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"surface.search":{label:"Surface · Search",description:"Knowledge + indexer search as a top-level nav entry.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","nav"]},"surface.sessions":{label:"Surface · Sessions",description:"Standalone top-level Sessions entry (still reachable under Agents).",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","nav"]},"surface.briefings":{label:"Surface · Briefings",description:"Briefings list + detail.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface"]},"surface.work":{label:"Surface · Work",description:"Work item detail.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface"]},"surface.activity":{label:"Surface · Activity",description:"Activity stream.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface"]},"surface.follow":{label:"Surface · Follow",description:"Follow view.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface"]},"surface.mesh-ops":{label:"Surface · Mesh Ops",description:"Mesh Ops — work-item triage over the mesh (hosts rail, item list, inspector).",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","ops"]},"surface.scoutbot":{label:"Surface · Scoutbot",description:"Scoutbot assistant — the inspector panel, the status-bar broadcast chip, and the Message-Scout command-palette actions.",defaultEnabled:!0,tier:"everyone",owner:"scout-web",tags:["surface","assistant"]},"surface.realtime-voice":{label:"Surface · Realtime voice",description:"Live WebRTC voice conversations with Scoutbot through OpenAI Realtime. Operator enablement lives in Settings → Voice; this flag is a build-level kill switch.",defaultEnabled:!0,tier:"everyone",owner:"scout-web",tags:["surface","assistant","voice"]},"surface.workflows":{label:"Surface · Workflows",description:"Observed harness families / workflow topology telemetry on the Agents directory. Off in the lean view — the directory is just the project-grouped agent board.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","observability"]},[ce]:Ye,[Ne]:cn},gn={a:"light-prod",control:"light-prod",light:"light-prod","light-prod":"light-prod",prod:"light-prod",production:"light-prod",b:"max-pro",max:"max-pro","max-pro":"max-pro",pro:"max-pro",treatment:"max-pro",...Bt},Re=new Set(["clear","default","none","reset","unset"]);function K(e,t){return Object.fromEntries(e.map(n=>[n,t]))}function Ze(...e){const t={};for(const n of e)n.audience&&(t.audience=n.audience),n.flags&&Object.keys(n.flags).length>0&&(t.flags={...t.flags??{},...n.flags});return t}function le(e){switch(e){case"light-prod":return{audience:"everyone",flags:{...K(Ee,!1),...K($e,!1)}};case"max-pro":return{audience:"power",flags:{...K(Ee,!0),...K($e,!0)}};case Mt:return un()}}function j(e){return e?gn[e.trim().toLowerCase()]??null:null}function te(e,t){for(const n of t){const s=e.get(n);if(s!==null)return s}return null}function Je(e){const t=te(e,qe);return j(t)}function hn(e){const t=te(e,Qe);if(t){const i=t.trim().toLowerCase();if(Re.has(i))return{action:"clear"};const a=j(t);return a?{action:"set",bundle:a}:null}const n=te(e,Xe);if(!n)return null;const s=n.trim().toLowerCase();if(Re.has(s))return{action:"clear"};if(["0","false","no"].includes(s))return null;const o=j(n);if(o)return{action:"set",bundle:o};const r=Je(e);return r?{action:"set",bundle:r}:null}function et(){if(typeof window>"u")return null;try{return j(window.localStorage.getItem(ee))}catch{return null}}function wn(e){if(!(typeof window>"u"))try{e.action==="clear"?window.localStorage.removeItem(ee):window.localStorage.setItem(ee,e.bundle)}catch{}}function Ws(){return et()??j(Me())??nt}function tt(){const e=et();return e?le(e):{}}const nt="light-prod";function st(){const e=j(Me())??nt;return le(e)}function In(e){const t=hn(e);t&&wn(t)}function ot(e=new URLSearchParams(window.location.search)){const t=en(window.location.href),n=Je(e),s=n?le(n):{},o={audience:t.audience??s.audience,flags:{...s.flags??{},...t.flags??{}}};return e.has("no-ops")&&(o.flags={...o.flags,"ops.control":!1}),o}function vn(){const e=Ke(fn);return{flags:e.flags,audience:e.audience??void 0}}function Ks(){if(typeof window>"u")return{};const e=new URLSearchParams(window.location.search);return In(e),{sharedConfig:Ze(st(),tt()),url:ot(e)}}function Sn(e){const t=typeof window>"u"?{}:{sharedConfig:Ze(st(),tt()),url:ot(),local:vn()};return We({registry:pn,audience:mn,audienceOrder:dn,layers:t,warnOnUnknown:!1}).isEnabled(e)}function rt(){return Sn("ops.control")}const ne={sm:408,md:512,lg:616},at=240,it=640,bn=24,ct="openscout:lane-deck:v1",Ln=new Set(["web.ops","macos.lanes","hud.tail","web.embed"]),de=new Set(["sm","md","lg"]),ut={"web.ops":{defaultLaneWidth:"lg",showAutoLanes:!0},"macos.lanes":{defaultLaneWidth:"md",showAutoLanes:!0},"hud.tail":{defaultLaneWidth:"sm",showAutoLanes:!0,defaultHorizon:"30m"},"web.embed":{defaultLaneWidth:"md",showAutoLanes:!0}},yn=ut["web.ops"];function fe(e){return lt(e)?ut[e]:yn}const H={pinned_left:0,main:1,pinned_right:2};function lt(e){return Ln.has(e)}function Gs(e=window.location.search,t=window.location.pathname){const n=new URLSearchParams(e),s=n.get("profile")?.trim().toLowerCase();if(s&&lt(s))return s;const o=n.get("embed")?.trim().toLowerCase();return o==="hud"?"hud.tail":o==="app"?"macos.lanes":t.includes("/lanes/embed")?"web.embed":(t.includes("/ops/lanes"),"web.ops")}function Hs(e=window.location.search){const t=new URLSearchParams(e),n=(t.get("lanes")??t.get("size"))?.trim().toLowerCase();return n&&de.has(n)?n:"lg"}function Vs(e,t){if(typeof e=="number"&&Number.isFinite(e))return Math.min(it,Math.max(at,Math.round(e)));const n=typeof e=="string"&&de.has(e)?e:t;return ne[n]}function Ys(e){const t=Math.min(it,Math.max(at,Math.round(e)));let n=null,s=Number.POSITIVE_INFINITY;for(const[o,r]of Object.entries(ne)){const i=Math.abs(r-t);i<s&&(s=i,n=o)}return n&&s<=bn?{px:ne[n],tier:n}:{px:t,tier:null}}function me(e,t,n){return{version:1,profileId:e,defaultLaneWidth:t??n.defaultLaneWidth,defaultHorizon:n.defaultHorizon,laneWidths:{},laneDefs:[],slots:[],showAutoLanes:n.showAutoLanes,updatedAt:Date.now()}}function Pe(e,t){const n=fe(e);return me(e,t,n)}function se(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="string"&&de.has(e))return e}function En(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.id!="string"||!t.id.trim()||t.kind!=="session"&&t.kind!=="harness"&&t.kind!=="project"&&t.kind!=="attention"||typeof t.title!="string"||!t.title.trim()?null:{id:t.id.trim(),kind:t.kind,title:t.title.trim(),sessionId:typeof t.sessionId=="string"?t.sessionId.trim():void 0,harness:typeof t.harness=="string"?t.harness.trim():void 0,projectPath:typeof t.projectPath=="string"?t.projectPath.trim():void 0}}function $n(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.id!="string"||!t.id.trim()||typeof t.laneDefId!="string"||!t.laneDefId.trim()||t.zone!=="pinned_left"&&t.zone!=="main"&&t.zone!=="pinned_right"||typeof t.position!="number"||!Number.isFinite(t.position)?null:{id:t.id.trim(),laneDefId:t.laneDefId.trim(),zone:t.zone,position:t.position,width:se(t.width)}}function dt(e,t,n,s){if(!e||typeof e!="object")return me(t,n,s);const o=e,r=Array.isArray(o.laneDefs)?o.laneDefs.map(En).filter(d=>d!==null):[],i=Array.isArray(o.slots)?o.slots.map($n).filter(d=>d!==null):[],a={};if(o.laneWidths&&typeof o.laneWidths=="object")for(const[d,f]of Object.entries(o.laneWidths)){const S=se(f);S!==void 0&&(a[d]=S)}const c=se(o.defaultLaneWidth);return{version:1,profileId:t,defaultLaneWidth:(typeof c=="string"?c:void 0)??n??s.defaultLaneWidth,defaultHorizon:typeof o.defaultHorizon=="string"?o.defaultHorizon:s.defaultHorizon,laneWidths:a,laneDefs:r,slots:i,showAutoLanes:typeof o.showAutoLanes=="boolean"?o.showAutoLanes:s.showAutoLanes,updatedAt:typeof o.updatedAt=="number"?o.updatedAt:Date.now()}}function Rn(e,t,n){return dt(e,t,n,fe(t))}function qs(e,t){const n=fe(e),s=t??n.defaultLaneWidth;try{const o=localStorage.getItem(`${ct}:${e}`);return o?Rn(JSON.parse(o),e,s):Pe(e,s)}catch{return Pe(e,s)}}function Pn(e){try{localStorage.setItem(`${ct}:${e.profileId}`,JSON.stringify({...e,updatedAt:Date.now()}))}catch{}}function Qs(e){return[...e].sort((t,n)=>{const s=H[t.zone]-H[n.zone];return s!==0?s:t.position-n.position})}function Xs(e,t){return H[e]-H[t]}function ft(){return`slot:${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function pe(e){return e.trim().toLowerCase().replace(/['"]/gu,"").replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function Y(e){return`session:${e}`}function Cn(e){return`harness:${pe(e)}`}function An(e){return`project:${pe(e)}`}const _n="attention:needs-input";function mt(e,t){const n=e.filter(s=>s.zone===t);return n.length===0?0:Math.max(...n.map(s=>s.position))+1}function pt(e,t){const n=e.laneDefs.some(s=>s.id===t.id);return{...e,laneDefs:n?e.laneDefs.map(s=>s.id===t.id?t:s):[...e.laneDefs,t]}}function gt(e,t){const n=e.slots.some(s=>s.id===t.id);return{...e,slots:n?e.slots.map(s=>s.id===t.id?t:s):[...e.slots,t]}}function ht(e,t){return{...e,slots:e.slots.filter(n=>n.laneDefId!==t)}}function Un(e,t){const n=Y(t);return{...ht(e,n),laneDefs:e.laneDefs.filter(s=>s.id!==n)}}function Zs(e,t){const n=Y(t);return e.slots.some(s=>s.laneDefId===n&&s.zone!=="main")}function Js(e,t){const n=Y(t),s=e.slots.find(o=>o.laneDefId===n);return!s||s.zone==="main"?null:s.zone}function eo(e,t){const n=t.zone??"pinned_left",s=Y(t.laneId),o=Un(e,t.laneId),r=pt(o,{id:s,kind:"session",title:t.title,sessionId:t.laneId});return gt(r,{id:ft(),laneDefId:s,zone:n,position:mt(r.slots,n),width:t.width})}function to(e,t){const n=t.zone??"pinned_left",s=t.kind==="attention"?_n:t.kind==="harness"&&t.harness?Cn(t.harness):t.kind==="project"&&t.projectPath?An(t.projectPath):`${t.kind}:${pe(t.title)}`,o=ht(e,s),r=pt(o,{id:s,kind:t.kind,title:t.title,harness:t.harness,projectPath:t.projectPath});return gt(r,{id:ft(),laneDefId:s,zone:n,position:mt(r.slots,n),width:t.width})}function no(e,t,n){return{...e,laneWidths:{...e.laneWidths,[t]:n},updatedAt:Date.now()}}function so(e,t){return{...e,defaultLaneWidth:t,updatedAt:Date.now()}}function oo(e){const t=new Set(e.slots.filter(n=>n.zone!=="main").map(n=>n.laneDefId));return{...e,slots:e.slots.filter(n=>n.zone==="main"),laneDefs:e.laneDefs.filter(n=>!t.has(n.id))}}const V="scope.lanes",oe={defaultLaneWidth:"md",showAutoLanes:!0,defaultHorizon:"30m"},Fn="openscout:lane-deck:v1";function Ce(e){return me(V,e,oe)}function ro(e){const t=e??oe.defaultLaneWidth;try{const n=localStorage.getItem(`${Fn}:${V}`);return n?dt(JSON.parse(n),V,t,oe):Ce(t)}catch{return Ce(t)}}function ao(e){Pn(e)}const Tn=[h.lanes,h.tail,h.sessions,h.agents];function kn(e){return Tn.includes(e)}function On(e){return e===Wt||e===Kt}function wt(e){return zt(e)}function Q(e,t={}){switch(e){case h.tail:{const n=new URLSearchParams;t.tailQuery&&n.set("q",t.tailQuery);const s=n.toString();return k(e,s?`?${s}`:"")}case h.sessions:return t.sessionId?k(e,`/${encodeURIComponent(t.sessionId)}`):k(e);case h.lanes:return k(J);case h.agents:return k(e);default:return k(J)}}function It(e){switch(e.view){case"ops":return!e.mode||e.mode==="lanes"?h.lanes:e.mode==="tail"?h.tail:null;case"sessions":return e.agentId?null:h.sessions;case"agents-v2":return e.agentId||e.projectSlug||e.sessionId||e.conversationId?null:h.agents;default:return null}}function Dn(e){const t=It(e);return t?t===h.tail&&e.view==="ops"?Q(t,{tailQuery:e.tailQuery}):t===h.sessions&&e.view==="sessions"?Q(t,{sessionId:e.sessionId}):Q(t):null}function xn(e,t,n){if(!On(e[0]))return null;const s=e[1]??J;if(!kn(s))return{view:"ops",mode:"lanes"};switch(s){case h.tail:{const o=t.searchParams.get("q")?.trim();return{view:"ops",mode:"tail",...o?{tailQuery:o}:{}}}case h.sessions:return e[2]?n({view:"sessions",sessionId:decodeURIComponent(e[2])}):n({view:"sessions"});case h.agents:return n({view:"agents-v2"});case h.lanes:default:return{view:"ops",mode:"lanes"}}}const jn=new Set(["no-ops","ffBundle","ffVariant","scoutBundle","scoutExperience","ab","ffGlobal","scoutGlobalBundle","ffPersist","persistBundle","ffAudience","studio","studioInjection","studioMode"]),Nn=["ff.","studio.","studioMode."];function Mn(e){return jn.has(e)||Nn.some(t=>e.startsWith(t))}function vt(e,t=""){const n=new URL(e,"http://scout.local");new URLSearchParams(t).forEach((r,i)=>{Mn(i)&&(n.searchParams.has(i)||n.searchParams.set(i,r))});const o=n.searchParams.toString();return`${n.pathname}${o?`?${o}`:""}`}function io(e){switch(e){case h.tail:return{view:"ops",mode:"tail"};case h.sessions:return{view:"sessions"};case h.agents:return{view:"agents-v2"};case h.lanes:default:return{view:"ops",mode:"lanes"}}}function Bn(e=typeof window<"u"?window.location.pathname:""){return wt(e)}function co(){return V}function uo(e=Bn()){return e?{"data-scope-presentation":!0}:void 0}function St(e,t=typeof window<"u"?window.location.pathname:""){return wt(t)?Dn(e):null}function zn(e,t=typeof window<"u"?window.location.pathname:""){return St(e,t)!==null}function lo(e,t=typeof window<"u"?window.location.pathname:""){return zn(e,t)?It(e):null}const fo={days:3,sessionLimit:200,hitLimit:60,debounceMs:180};function re(e){return e.root==="HOME"?`~/${e.relPath}`:e.root==="ABSOLUTE"?e.relPath:`$${e.root}/${e.relPath}`}function Ae(e){const t=e?.trim();if(!t)return null;const n=t.replace(/[\\/]+$/,""),s=n.split(/[\\/]/).filter(Boolean).at(-1)??n;return s.endsWith(".jsonl")?s.slice(0,-6):s}function T(e){return e.sourceRefs.find(t=>t.kind==="harness_transcript")??null}function bt(e){return e.sourceRefs.find(t=>t.kind==="file")??null}function ge(e){return e?Ae(e.sessionId)??Ae(re(e.path)):null}function mo(e){const t=ge(e);if(!t)return null;const n=e?.recordRange;return n?`${t}|records ${n[0]}..${n[1]}`:t}function z(e,t){const n=e.facets[t];return Array.isArray(n)?n.filter(Boolean).join(", "):typeof n=="string"?n:""}function M(e){const t=new Set;return e.split(/[^A-Za-z0-9_./-]+/u).map(n=>n.trim()).filter(n=>n.length>1).filter(n=>{const s=n.toLowerCase();return t.has(s)?!1:(t.add(s),!0)}).slice(0,12)}const Wn=/^(events?\s+window(\s+\d+)?|files?\s+touched|tool\s+calls?|indexed\s+snippet|manifest|summary|decisions?|context\s+pack)\b/iu,_e=/^(claude|codex|kimi|cursor|gpt|gemini)\b/iu,Ue=/^(?:claude|codex|kimi|cursor|gpt|gemini)?\s*[a-z0-9._/-]*\s*(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*\s+\d{1,2}(?:\s+at\s+\d{1,2}:\d{2}\s*(?:am|pm)?)?\s*[-–—:]\s*/iu;function Lt(e){return Wn.test(e.replace(/\s+/g," ").trim())}function Kn(e){let t=e.replace(/\s+/g," ").trim();if(!t)return"";if(t=t.replace(/<[^>\n]+>/g," ").replace(/\s+/g," ").trim(),Ue.test(t))t=t.replace(Ue,"").trim();else{const n=t.match(/^(.{6,72}?)\s[-–—]\s+(.+)$/u);if(n){const s=n[1]??"",o=n[2]??"";(_e.test(s)||/\b(?:am|pm|\d{1,2}:\d{2}|plugin|session|openscout)\b/iu.test(s))&&(t=o.trim())}}return t=t.replace(_e,"").replace(/^\s*[-–—:]\s*/,"").trim(),t=t.replace(/\s{2,}/g," ").trim(),t.length>72&&(t=`${t.slice(0,69).replace(/\s+\S*$/u,"").trimEnd()}…`),t}function Gn(e){const t=z(e,"project"),n=e.title.replace(/\s+/g," ").trim();if(n&&!Lt(n)){const o=Kn(n);if(o&&o.toLowerCase()!==t.toLowerCase()||o)return o}if(t)return t;const s=ge(T(e));return s?s.length>18?`${s.slice(0,16)}…`:s:"Session match"}function yt(e){const t=B(e,"recordKind",8).map(s=>s.toLowerCase());if(t.length===0&&t.push(...B(e,"recordTag",8).map(s=>s.toLowerCase())),t.some(s=>s.includes("assistant")))return"assistant";if(t.some(s=>s.includes("user")))return"user";if(t.some(s=>s.includes("tool")||s.includes("command")||s.includes("response")))return"tool";const n=we(e);return n==="tool activity"?"tool":n==="overview"?"overview":""}function po(e,t){const n=Ie(e.snippet,t),s=yt(e),o=he(e);let r="";if(n){const i=M(t).map(d=>d.toLowerCase()),a=n.split(new RegExp("(?<=[.!?])\\s+|\\s+[–—]\\s+|\\s+·\\s+","u")).map(d=>d.replace(/^…+|…+$/gu,"").trim()).filter(d=>d.length>12);r=((i.length>0?a.find(d=>i.some(f=>ae(d,f)>=0)):void 0)??a[0]??n).replace(/^…+|…+$/gu,"").trim()}return r?(r.length>78&&(r=`${r.slice(0,75).replace(/\s+\S*$/u,"").trimEnd()}…`),r):s&&o?`${s} · ${o}`:o||s||Gn(e)}function Hn(e){return e.freshness&&e.freshness!=="unknown"?e.freshness:e.title.replace(/\s+/g," ").trim().match(/\b((?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\s+\d{1,2}(?:\s+at\s+\d{1,2}:\d{2}\s*(?:AM|PM)?)?)\b/iu)?.[1]??""}function Fe(e){const t=e.trim().toLowerCase();return t?t==="events"||t.startsWith("events")?"conversation":t==="overview"||t==="summary"?"overview":t==="tool-calls"||t==="tools"?"tool activity":t==="files"||t==="files-touched"?"files touched":t==="manifest"?"session index":t.replace(/[-_]+/g," "):""}function Vn(e){const t=e.trim();return t?t.charAt(0).toUpperCase()+t.slice(1):""}function Yn(e){const t=z(e,"harness")||T(e)?.harness||"";if(!t)return"";const n=t.toLowerCase();return n==="claude"?"Claude":n==="codex"?"Codex":n==="kimi"?"Kimi":n==="cursor"?"Cursor":Vn(t)}function qn(e){const t=z(e,"sessionId").trim(),n=ge(T(e)),s=(t||n||"").trim();return s?s.length>14?s.slice(0,8):s:""}function he(e){const t=T(e)?.recordRange;if(t){const[s,o]=t;return s===o?`turn ${s}`:o-s<=1?`turns ${s}–${o}`:`turns ${s}–${o}`}const n=e.title.match(/events?\s+window\s+(\d+)/iu);return n?`window ${Number(n[1])}`:""}function Qn(e){const t=B(e,"recordKind",8).map(s=>s.toLowerCase());t.length===0&&t.push(...B(e,"recordTag",8).map(s=>s.toLowerCase()));const n=[];return t.some(s=>s.includes("user"))&&n.push("user"),t.some(s=>s.includes("assistant"))&&n.push("assistant"),t.some(s=>s.includes("tool")||s.includes("command")||s.includes("response"))&&n.push("tool"),n.length===0?"":n.join(" · ")}function we(e){const t=z(e,"documentKind");if(t){const s=t.split(",")[0]?.trim()??t;return Fe(s)}return Lt(e.title)?Fe(e.title):bt(e)?"file":T(e)?"conversation":""}function B(e,t,n=3){const s=e.facets[t];return(Array.isArray(s)?s:typeof s=="string"?s.split(","):[]).map(r=>r.trim()).filter(Boolean).slice(0,n)}function go(e){return{agent:Yn(e),project:z(e,"project"),session:qn(e),when:Hn(e),turn:he(e),role:Qn(e),where:we(e)}}function ho(e){const t=[],n=he(e);n&&t.push(n);const s=yt(e);s&&t.push(s);const o=we(e);o&&o!=="conversation"&&t.push(o);const r=B(e,"toolName",2);r.length===1&&t.push(r[0]),r.length>1&&t.push(r.join(", "));const i=new Set;return t.filter(a=>{const c=a.toLowerCase();return i.has(c)?!1:(i.add(c),!0)})}function ae(e,t){return new RegExp(`(?<![A-Za-z0-9_./~-])${Rt(t)}(?![A-Za-z0-9_./~-])`,"iu").exec(e)?.index??-1}function Ie(e,t=""){let n=e.replace(/\s+/g," ").trim();if(!n)return"";if(n=n.replace(/\s*-\s*\[\d{3,}\]\s*`[^`]+`(?:\s*\([^)]*\))?\s*-\s*/gu," "),n=n.replace(/\[\d{3,}\]\s*`[^`]+`\s*/gu,""),n=n.replace(/\*\*/gu,""),n=n.replace(/\b(?:assistant_turn|user_turn|agent_reasoning|command_or_tool|response_item|system_record)\b/giu," "),n=n.replace(/(?:~\/|\.\.?\/|\/(?:Users|home|var|tmp|opt)\/)\S+/gu," "),n=n.replace(/https?:\/\/\S+/gu," "),n=n.replace(/\b[\w.-]+\.(?:com|net|org|io|dev|app)(?:\/\S*)?/giu," "),n=n.replace(/\{[^{}]{0,160}\}/gu," "),n=n.replace(/`[^`]{0,64}`/gu,r=>{const i=r.slice(1,-1);return M(t).some(a=>ae(i,a)>=0)||/^[A-Za-z][\w.-]{0,24}$/u.test(i)?i:" "}),n=n.replace(/\s{2,}/g," ").trim(),n=n.replace(/^[\s,;:.\-–—|/]+/u,"").trim(),n.includes("{")||n.includes("[")){const r=n.search(/[\[{]/u);if(r>18){const i=n.slice(0,r).trim().replace(/[-–—,:;]+$/u,"").trim();i&&(n=i)}}const s=M(t),o=200;if(s.length>0&&n.length>o){let r=-1;for(const i of s){const a=ae(n,i);a>=0&&(r<0||a<r)&&(r=a)}if(r<0)for(const i of s){if(i.length<4)continue;const a=n.toLowerCase().indexOf(i.toLowerCase());a>=0&&(r<0||a<r)&&(r=a)}if(r>=0){const a=Math.max(0,r-48),c=Math.min(n.length,a+o),d=n.slice(a,c).trim();n=`${a>0?"…":""}${d}${c<n.length?"…":""}`}else n=`${n.slice(0,o-1).replace(/\s+\S*$/u,"").trimEnd()}…`}else n.length>o&&(n=`${n.slice(0,o-1).replace(/\s+\S*$/u,"").trimEnd()}…`);return n.replace(/\s{2,}/g," ").trim()}function wo(e,t,n){const s=Ie(e.snippet,t);return s.length<=n?s:`${s.slice(0,n-1).replace(/\s+\S*$/u,"").trimEnd()}…`}function Xn(e,t){return M(t).filter(n=>{const s=n.toLowerCase();return e.title.toLowerCase().includes(s)||e.snippet.toLowerCase().includes(s)||Ie(e.snippet,t).toLowerCase().includes(s)})}function Et(e){const t=(e.kind||e.role||e.type||"record").toLowerCase();return t==="assistant_turn"||t==="assistant"?"assistant":t==="user_turn"||t==="user"?"user":t==="system_record"||t==="system"?"system":t==="command_or_tool"||t==="tool_use"?"tool":t==="response_item"?"tool output":t==="agent_reasoning"||t==="reasoning"?"reasoning":t.replace(/_/gu," ")}function $t(e){const t=(e.kind||e.role||e.type||"").toLowerCase();return t==="assistant"||t==="assistant_turn"||t==="user"||t==="user_turn"||t==="last-prompt"||t==="ai-title"?0:t==="system"||t==="system_record"||t.includes("reasoning")?1:2}function Io(e){return e.scoreSource==="hybrid"?"Words and meaning":e.scoreSource==="vector"?"Similar in meaning":"Exact words"}function vo(e,t,n){const s=Xn(e,t),o=s.length===1?`Matched “${s[0]}”`:s.length>1?`Matched ${s.length} terms`:"Matched in this session";if(!n?.matched)return o;const r=[n.renderedText,n.summary].filter(Boolean).join(" ").toLowerCase(),i=s.filter(d=>r.includes(d.toLowerCase()));if(i.length===0)return o;const a=Et(n),c=a==="assistant"?"an assistant reply":a==="user"?"your message":a==="tool"?"a tool call":a==="tool output"?"tool output":a==="system"?"a system record":a==="reasoning"?"agent reasoning":`a ${a} record`;return i.length===1?`Matched “${i[0]}” in ${c}`:`Matched ${i.length} terms in ${c}`}function So(e){const t=T(e);if(t){const s=re(t.path),o=t.recordRange;return o?`${s}#R${o[0]}-R${o[1]}`:s}const n=bt(e);if(n){const s=re(n.path),o=n.lineRange;return o?`${s}#L${o[0]}-L${o[1]}`:s}return e.id}function Zn(e){const t=e.filter(o=>$t(o)===2).length,n=e.length-t,s=e.some(o=>o.matched)?" · match inside":"";return t>0&&n===0?`${t} tool step${t===1?"":"s"}${s}`:t===0?`${n} process step${n===1?"":"s"}${s}`:`${t} tool + ${n} process step${e.length===1?"":"s"}${s}`}function Jn(e){return`${e.length} more conversation turn${e.length===1?"":"s"}`}function bo(e,t={}){if(e.length===0)return[];const n=t.contextRadius??3,s=t.maxTurns??6,o=t.centerRecordIndex===void 0?-1:e.findIndex(w=>w.index===t.centerRecordIndex),r=e.findIndex(w=>w.matched),i=o>=0?o:r>=0?r:0,a=e.slice(Math.max(0,i-n),Math.min(e.length,i+n+1)),c=[];let d=[],f=[],S=0;const A=()=>{d.length!==0&&(c.push({kind:"folded",records:d,summary:Zn(d)}),d=[])},g=()=>{f.length!==0&&(c.push({kind:"folded",records:f,summary:Jn(f)}),f=[])};for(const w of a){if($t(w)>0){g(),d.push(w);continue}if(A(),S>=s){f.push(w);continue}c.push({kind:"turn",record:w,role:Et(w)}),S+=1}return A(),g(),c}function Te(e){const t=T(e)?.recordRange;return t?t[0]:Number.MAX_SAFE_INTEGER}function Lo(e){const t=[],n=new Map;for(const s of e){const o=s.collectionId||s.id,r=n.get(o);r?r.push(s):(t.push(o),n.set(o,[s]))}return t.map(s=>{const o=[...n.get(s)??[]].sort((i,a)=>{const c=Te(i)-Te(a);return c!==0?c:i.score-a.score}),r=n.get(s)?.[0]??o[0];return{collectionId:s,best:r,moments:o}})}function Rt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yo(e,t){const n=M(t);if(n.length===0||e.length===0)return[{text:e,match:!1}];const s=n.map(a=>`(?<![A-Za-z0-9_./~-])${Rt(a)}(?![A-Za-z0-9_./~-])`),o=new RegExp(`(${s.join("|")})`,"giu"),r=[];let i=0;for(const a of e.matchAll(o)){const c=a.index??0;c>i&&r.push({text:e.slice(i,c),match:!1}),r.push({text:a[0],match:!0}),i=c+a[0].length}return i<e.length&&r.push({text:e.slice(i),match:!1}),r.length>0?r:[{text:e,match:!1}]}const Eo={sessions:"Sessions",skills:"Skills",mcp:"MCP",codebase:"Codebase",context_pack:"Context packs",mixed:"Mixed"},Pt=[{value:"1",label:"Last 24h"},{value:"3",label:"Last 3 days"},{value:"7",label:"Last 7 days"},{value:"30",label:"Last 30 days"}],$o=["sessions","skills","mcp","codebase","context_pack"];function Ro(){return{query:"",sourceKinds:[],harness:[],project:[],timeWindow:"all"}}function es(e){return e?Pt.some(t=>t.value===e):!1}function X(e){return e?e.split(",").map(t=>t.trim()).filter(t=>t.length>0):[]}function ts(e){const t=e==null?new URLSearchParams:typeof e=="string"?new URLSearchParams(e):e,n=t.get("time"),s=es(n)?n:"all";return{query:t.get("q")?.trim()??"",sourceKinds:X(t.get("source")),harness:X(t.get("harness")),project:X(t.get("project")),timeWindow:s}}function ns(e,t={}){const n=new URLSearchParams,s=e.query.trim();return s&&n.set("q",s),e.sourceKinds.length>0&&n.set("source",e.sourceKinds.join(",")),e.harness.length>0&&n.set("harness",e.harness.join(",")),e.project.length>0&&n.set("project",e.project.join(",")),e.timeWindow!=="all"&&n.set("time",e.timeWindow),t.hitId&&n.set("hit",t.hitId),n}function Po(e,t){return e.query.trim()===t.query.trim()&&e.timeWindow===t.timeWindow&&Z(e.sourceKinds,t.sourceKinds)&&Z(e.harness,t.harness)&&Z(e.project,t.project)}function Z(e,t){if(e.length!==t.length)return!1;const n=[...e].map(o=>o.trim().toLowerCase()).sort(),s=[...t].map(o=>o.trim().toLowerCase()).sort();return n.every((o,r)=>o===s[r])}function ss(e){return e.query.trim().length>0||e.sourceKinds.length>0||e.harness.length>0||e.project.length>0||e.timeWindow!=="all"}function Co(e){if(e==="all")return null;const t=Number.parseInt(e,10);return!Number.isFinite(t)||t<=0?null:Date.now()-t*24*60*60*1e3}function Ao(e){return e==="all"?"Any time":Pt.find(n=>n.value===e)?.label??e}const Ct=typeof window<"u"?window.location.href:"http://scout.local/";function os(e){const t=e.toString();return new URL(t,Ct)}function rs(e){switch(e){case"profile":case"config":case"definitions":return e==="definitions"?"config":e;case"observe":case"message":return e;default:return}}function as(e){const t=e.trim().replace(/^#/,"");if(!t.startsWith("msg-"))return null;const n=t.slice(4).trim();if(!n)return null;try{return decodeURIComponent(n)}catch{return n}}function is(e){switch(e){case"control":case"mission":case"command":case"warroom":case"conduct":case"conductor":return"mission";case"plan":case"advisor":return"advisor";case"issues":case"errors":case"warnings":return"issues";case"agents":case"tail":case"atop":case"lanes":return e;default:return}}function cs(e){return e==="delivered"||e==="failed"||e==="all"?e:void 0}function us(e){return e==="indexer"||e==="knowledge"?e:void 0}function ls(e){switch(e){case"pairing":case"agents":case"appearance":case"operator":case"comms":case"credentials":case"voice":case"devices":case"about":return e;case"communications":return"comms";default:return}}function ds(e){switch(e){case"tail":case"session":case"chat":case"work":return e;default:return}}function fs(e){const t=e?.trim().replace(/\.+$/u,"");return t==="observe"||t==="takeover"?t:void 0}function ms(e){const t=e?.trim().toLowerCase();return t==="pty"||t==="tmux"||t==="zellij"||t==="herdr"?t:void 0}function ps(e){const t=e?.trim().toLowerCase();return t==="shell"||t==="claude"||t==="codex"||t==="pi"?t:void 0}function gs(e){return e==="all"||e==="touched"?"all":e==="changed"?"changed":void 0}function ke(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isSafeInteger(t)&&t>0?t:void 0}function Oe(e){return e==="mission"?"control":e}function hs(e){return e.searchParams.has("no-ops")?!1:typeof window>"u"?!0:rt()}function ws(e){return e==="tail"}function Is(e){return e==="lanes"}function At(e){return ws(e)||Is(e)}const ve="machineId",_t=new Set(["inbox","conversation","agents-v2","messages","sessions","repos","harnesses","mesh","mesh-ops","activity","work","follow"]);function vs(e){return e.searchParams.get(ve)?.trim()||void 0}function Ss(e,t){return!t||!_t.has(e.view)?e:{...e,machineId:t}}function Se(e){return _t.has(e.view)}function bs(e){return"machineId"in e&&e.machineId?e.machineId:null}function De(e,t){if(!Se(e))return e;const n={...e},s=t?.trim();return s?n.machineId=s:delete n.machineId,n}function _o(e){return Se(e)?{...e,machineId:""}:e}function Ls(e,t){return Se(e)?"machineId"in e?De(e,e.machineId??null):De(e,bs(t)):e}function F(e,t){"machineId"in t&&t.machineId&&e.set(ve,t.machineId)}function v(e){const t=e.toString();return t?`?${t}`:""}function O(e,t){const n=new URLSearchParams;return F(n,t),`${e}${v(n)}`}function ys(e){return"machineId"in e&&e.machineId?`:machine:${e.machineId}`:""}function Ut(e){const t=os(e),n=t.pathname.replace(/^\/+/,"").split("/").filter(Boolean),s=vs(t),o=u=>Ss(u,s),r=xn(n,t,o);if(r)return r;const i=as(t.hash),a=rs(t.searchParams.get("tab"))??(i?"message":void 0),c=t.searchParams.get("project")?.trim()||void 0,d=t.searchParams.get("agentId")?.trim()||void 0;if(n[0]==="agent"&&n[1])return{view:"agent-info",conversationId:decodeURIComponent(n[1])};const f=t.searchParams.get("project")?.trim()||void 0,S=t.searchParams.get("harness")?.trim()||void 0,A=t.searchParams.get("node")?.trim()||void 0,g=t.searchParams.get("set")?.trim(),w=g==="live"||g==="ephemeral"||g==="archived"?g:void 0,R=t.searchParams.get("view")?.trim(),U=R==="sessions"||R==="agents"?R:void 0,_=t.searchParams.get("state")?.trim(),be=_==="needs"||_==="live"||_==="idle"?_:void 0,xt=t.searchParams.get("ephemeral")==="1",W=t.searchParams.get("session")?.trim()||void 0,y=t.searchParams.get("select")?.trim()||void 0,$={...S?{harness:S}:{},...A?{node:A}:{},...w?{set:w}:{},...U?{indexView:U}:{},...be?{stateFilter:be}:{},...xt?{showEphemeral:!0}:{}};if(n[0]==="projects"){const u=n[1]?decodeURIComponent(n[1]):void 0;if(!u)return o({view:"agents-v2",...y?{selectedAgentId:y}:{},...$});if(n[2]==="agents"){const l=n[3]?decodeURIComponent(n[3]):void 0;if(l){if(n[4]==="c"&&n[5])return o({view:"agents-v2",projectSlug:u,agentId:l,conversationId:decodeURIComponent(n[5]),tab:a??"message",...$});const m=n[4]==="sessions"&&n[5]?decodeURIComponent(n[5]):W;return o({view:"agents-v2",projectSlug:u,agentId:l,...m?{sessionId:m}:{},...a?{tab:a}:{},...$})}return o({view:"agents-v2",projectSlug:u,indexView:"agents",...y?{selectedAgentId:y}:{},...$})}return n[2]==="sessions"?o({view:"agents-v2",projectSlug:u,indexView:"sessions",...n[3]?{sessionId:decodeURIComponent(n[3])}:{},...y?{selectedAgentId:y}:{},...$}):o({view:"agents-v2",projectSlug:u,...y?{selectedAgentId:y}:{},...$})}if(n[0]==="agents-v2"&&n[1]==="sessions"&&n[2])return o({view:"agents-v2",sessionId:decodeURIComponent(n[2]),...y?{selectedAgentId:y}:{},...f?{projectSlug:f}:{},...$});if(n[0]==="agents-v2"&&n[1]){const u=decodeURIComponent(n[1]);return o({view:"agents-v2",agentId:u,...a?{tab:a}:{},...W?{sessionId:W}:{},...f?{projectSlug:f}:{},...$})}if(n[0]==="agents-v2")return o({view:"agents-v2",...y?{selectedAgentId:y}:{},...f?{projectSlug:f}:{},...$});if(n[0]==="agents"&&n[1]){const u=decodeURIComponent(n[1]),l=n[2]==="sessions"&&n[3]?decodeURIComponent(n[3]):W;return n[2]==="c"&&n[3]?o({view:"agents-v2",agentId:u,conversationId:decodeURIComponent(n[3]),tab:a??"message",...$}):o({view:"agents-v2",agentId:u,...l?{sessionId:l}:{},...a?{tab:a}:{},...$})}if(n[0]==="agents")return o({view:"agents-v2",...y?{selectedAgentId:y}:{},...f?{projectSlug:f}:{},...$});if(n[0]==="agents.deprecated"&&n[1]&&n[2]==="sessions"&&n[3])return o({view:"sessions",agentId:decodeURIComponent(n[1]),sessionId:decodeURIComponent(n[3])});if(n[0]==="agents.deprecated"&&n[1]&&n[2]==="c"&&n[3])return o({view:"agents-v2",agentId:decodeURIComponent(n[1]),conversationId:decodeURIComponent(n[3]),tab:a??"message"});if(n[0]==="agents.deprecated"&&n[1]){const u=decodeURIComponent(n[1]);return o({view:"agents-v2",agentId:u,...a?{tab:a}:{},...!a&&c?{projectSlug:c}:{}})}if(n[0]==="agents.deprecated")return o({view:"agents-v2",...c?{projectSlug:c}:{}});if(n[0]==="fleet")return o({view:"inbox"});if(n[0]==="c"&&n[1])return o({view:"conversation",conversationId:decodeURIComponent(n[1])});if(n[0]==="flights"&&n[1]&&n[2]==="observe"){const u=t.searchParams.get("session")?.trim()||void 0,l=t.searchParams.get("compare")?.trim()||void 0;return o({view:"sessions",flightId:decodeURIComponent(n[1]),...u?{sessionId:u}:{},...l?{compareSessionId:l}:{}})}if(n[0]==="sessions"&&n[1])return o({view:"sessions",sessionId:decodeURIComponent(n[1]),...d?{agentId:d}:{}});if(n[0]==="conversations")return o({view:"messages"});if(n[0]==="messages"){if(n[1]==="agent"&&n[2]){const l=t.searchParams.get("thread")?.trim()||void 0;return o({view:"messages",agentId:decodeURIComponent(n[2]),...l?{threadId:l}:{}})}const u={view:"messages",...n[1]?{conversationId:decodeURIComponent(n[1])}:{}};return o(u)}if(n[0]==="sessions")return o({view:"sessions",...d?{agentId:d}:{}});if(n[0]==="repos"){const u=t.searchParams.get("root")?.trim()||void 0;return o({view:"repos",...u?{root:u}:{}})}if(n[0]==="providers"||n[0]==="harnesses")return o({view:"harnesses"});if(n[0]==="repo-diff"){const u=t.searchParams.get("path")?.trim();if(u){const l=t.searchParams.getAll("layer").filter(I=>I==="unstaged"||I==="staged"||I==="branch"),m=t.searchParams.getAll("file").map(I=>I.trim()).filter(Boolean),p=t.searchParams.get("sessionId")?.trim()||void 0,b=t.searchParams.get("agentId")?.trim()||void 0,E=gs(t.searchParams.get("include"));return{view:"repo-diff",path:u,...l.length>0?{layers:l}:{},...m.length>0?{files:m}:{},...p?{sessionId:p}:{},...b?{agentId:b}:{},...E?{include:E}:{}}}}if(n[0]==="search"){const u=us(n[1]),l=t.searchParams.get("hit")?.trim()||void 0,m=ts(t.searchParams);return{view:"search",...u&&u!=="knowledge"?{mode:u}:{},...l?{hitId:l}:{},...ss(m)?{filters:m}:{}}}if(n[0]==="channels"&&n[1])return o({view:"messages",conversationId:decodeURIComponent(n[1])});if(n[0]==="channels")return o({view:"messages"});if(n[0]==="mesh")return o({view:"mesh"});if(n[0]==="mesh-ops")return o({view:"mesh-ops",...n[1]?{itemId:decodeURIComponent(n[1])}:{}});if(n[0]==="dispatch"||n[0]==="broker"){const u=t.searchParams.get("attempt")?.trim()||void 0,l=cs(t.searchParams.get("filter"));return{view:"broker",...u?{attemptId:u}:{},...l&&l!=="all"?{filter:l}:{}}}if(n[0]==="code"){const u=t.searchParams.get("wt")?.trim()||void 0,l=t.searchParams.get("fromConversation")?.trim()||void 0,m=ke(t.searchParams.get("line")),p=ke(t.searchParams.get("endLine")),b=m&&p&&p>=m?p:void 0;if(n[1]){const C=decodeURIComponent(n[1]),P=n.length>2?n.slice(2).map(decodeURIComponent).join("/"):void 0;return{view:"code",project:C,...P?{path:P}:{},...u?{wt:u}:{},...m?{line:m}:{},...b?{endLine:b}:{},...l?{returnConversationId:l}:{}}}const E=t.searchParams.get("root")?.trim()||void 0,I=t.searchParams.get("file")?.trim()||void 0;return{view:"code",...E?{root:E}:{},...I?{file:I}:{},...u?{wt:u}:{},...m?{line:m}:{},...b?{endLine:b}:{},...l?{returnConversationId:l}:{}}}if(n[0]==="briefings"&&n[1])return{view:"briefings",briefingId:decodeURIComponent(n[1])};if(n[0]==="briefings")return{view:"briefings"};if(n[0]==="activity")return o({view:"activity"});if(n[0]==="voice")return{view:"voice"};if(n[0]==="work"&&n[1])return o({view:"work",workId:decodeURIComponent(n[1])});if(n[0]==="follow"){const u=ds(t.searchParams.get("view")),l={view:"follow",...u?{preferredView:u}:{}},m=n[1],p=n[2]?decodeURIComponent(n[2]):"";m==="flight"&&p&&(l.flightId=p),m==="invocation"&&p&&(l.invocationId=p),m==="conversation"&&p&&(l.conversationId=p),m==="work"&&p&&(l.workId=p),m==="session"&&p&&(l.sessionId=p),m==="agent"&&p&&(l.targetAgentId=p);const b=t.searchParams.get("flightId"),E=t.searchParams.get("invocationId"),I=t.searchParams.get("conversationId"),C=t.searchParams.get("workId"),P=t.searchParams.get("sessionId"),Le=t.searchParams.get("targetAgentId");return b&&(l.flightId=b),E&&(l.invocationId=E),I&&(l.conversationId=I),C&&(l.workId=C),P&&(l.sessionId=P),Le&&(l.targetAgentId=Le),o(l)}if(n[0]==="settings"){if(n[1]==="agents")return{view:"settings",section:"agents",...n[2]?{agentId:decodeURIComponent(n[2])}:{}};const u=ls(n[1]);return{view:"settings",...u?{section:u}:{}}}if(n[0]==="terminal"){const u=fs(t.searchParams.get("mode")),l=t.searchParams.get("session")?.trim()||void 0,m=Ht(t.searchParams.get("surface"))??void 0;if(n[1]==="new"){const b=ms(t.searchParams.get("backend"))??"pty",E=ps(t.searchParams.get("agent"))??"shell",I=t.searchParams.get("name")?.trim()||void 0,C=t.searchParams.get("tab")?.trim()||void 0,P=t.searchParams.get("socketDir")?.trim()||void 0;return{view:"terminal",terminalBackend:b,terminalAgent:E,...I?{terminalSessionName:I}:{},...C?{terminalTabId:C}:{},...P?{zellijSocketDir:P}:{}}}const p=n[1]==="s"&&n[2]?Be(decodeURIComponent(n.slice(2).join("/")))?decodeURIComponent(n.slice(2).join("/")):null:Vt(n[1]?decodeURIComponent(n[1]):void 0,n[2]?decodeURIComponent(n.slice(2).join("/")):void 0);return p?{view:"terminal",terminalSurfaceKey:p,...l?{terminalSessionId:l}:{},...u?{mode:u}:{}}:{view:"terminal",...n[1]?{agentId:decodeURIComponent(n[1])}:{},...u?{mode:u}:{},...!n[1]&&l?{terminalSessionId:l}:{},...!n[1]&&m?{terminalSurfaceKey:m}:{}}}if(n[0]==="ops"){const u=is(n[1])??"mission";if(!At(u)&&!hs(t))return o({view:"inbox"});const l=u==="tail"?t.searchParams.get("q")?.trim():"",m=u==="advisor"?t.searchParams.get("plan")?.trim():"",p=t.searchParams.get("flightId")?.trim(),b=t.searchParams.get("invocationId")?.trim(),E=t.searchParams.get("conversationId")?.trim(),I=t.searchParams.get("workId")?.trim(),C=t.searchParams.get("sessionId")?.trim(),P=t.searchParams.get("targetAgentId")?.trim()??t.searchParams.get("agentId")?.trim();return{view:"ops",mode:u,...l?{tailQuery:l}:{},...m?{planDocumentId:m}:{},...p?{flightId:p}:{},...b?{invocationId:b}:{},...E?{conversationId:E}:{},...I?{workId:I}:{},...C?{sessionId:C}:{},...P?{targetAgentId:P}:{}}}return o({view:"inbox"})}function Ft(e,t){const n=e.view==="sessions"&&e.flightId?null:St(e,t);if(n)return n;switch(e.view){case"inbox":return O("/",e);case"conversation":{const s=new URLSearchParams;return F(s,e),`/c/${encodeURIComponent(e.conversationId)}${v(s)}`}case"agent-info":return`/agent/${encodeURIComponent(e.conversationId)}`;case"agents-v2":{const s=new URLSearchParams;e.harness&&s.set("harness",e.harness),e.node&&s.set("node",e.node),e.set&&s.set("set",e.set),!e.projectSlug&&e.indexView&&e.indexView!=="agents"&&s.set("view",e.indexView),e.stateFilter&&s.set("state",e.stateFilter),e.showEphemeral&&s.set("ephemeral","1"),e.selectedAgentId&&!e.agentId&&!e.sessionId&&s.set("select",e.selectedAgentId);const o=e.conversationId?"message":"profile";e.agentId&&e.tab&&e.tab!==o&&s.set("tab",e.tab),F(s,e);const r=e.projectSlug?`/projects/${encodeURIComponent(e.projectSlug)}`:null;return`${r?e.agentId?e.conversationId?`${r}/agents/${encodeURIComponent(e.agentId)}/c/${encodeURIComponent(e.conversationId)}`:e.sessionId?`${r}/agents/${encodeURIComponent(e.agentId)}/sessions/${encodeURIComponent(e.sessionId)}`:`${r}/agents/${encodeURIComponent(e.agentId)}`:e.sessionId?`${r}/sessions/${encodeURIComponent(e.sessionId)}`:e.indexView==="sessions"?`${r}/sessions`:e.indexView==="agents"?`${r}/agents`:r:e.agentId?e.conversationId?`/agents/${encodeURIComponent(e.agentId)}/c/${encodeURIComponent(e.conversationId)}`:e.sessionId?`/agents/${encodeURIComponent(e.agentId)}/sessions/${encodeURIComponent(e.sessionId)}`:`/agents/${encodeURIComponent(e.agentId)}`:e.sessionId?`/sessions/${encodeURIComponent(e.sessionId)}`:"/projects"}${v(s)}`}case"messages":{const s=new URLSearchParams;return e.agentId&&e.threadId&&s.set("thread",e.threadId),F(s,e),`${e.agentId?`/messages/agent/${encodeURIComponent(e.agentId)}`:e.conversationId?`/messages/${encodeURIComponent(e.conversationId)}`:"/messages"}${v(s)}`}case"sessions":{const s=new URLSearchParams;return e.agentId&&s.set("agentId",e.agentId),e.flightId?(e.sessionId&&s.set("session",e.sessionId),e.compareSessionId&&s.set("compare",e.compareSessionId),F(s,e),`/flights/${encodeURIComponent(e.flightId)}/observe${v(s)}`):(F(s,e),`${e.sessionId?`/sessions/${encodeURIComponent(e.sessionId)}`:"/sessions"}${v(s)}`)}case"repos":{const s=new URLSearchParams;return e.root&&s.set("root",e.root),F(s,e),`/repos${v(s)}`}case"harnesses":return O("/providers",e);case"repo-diff":{const s=new URLSearchParams;s.set("path",e.path);for(const o of e.layers??[])s.append("layer",o);for(const o of e.files??[])s.append("file",o);return e.sessionId&&s.set("sessionId",e.sessionId),e.agentId&&s.set("agentId",e.agentId),e.include&&s.set("include",e.include),`/repo-diff${v(s)}`}case"search":{const s=e.mode==="indexer"?"/search/indexer":"/search",o=e.filters?ns(e.filters,{hitId:e.hitId??null}):new URLSearchParams;return!e.filters&&e.hitId&&o.set("hit",e.hitId),`${s}${v(o)}`}case"mesh":return O("/mesh",e);case"mesh-ops":return O(e.itemId?`/mesh-ops/${encodeURIComponent(e.itemId)}`:"/mesh-ops",e);case"broker":{const s=new URLSearchParams;return e.attemptId&&s.set("attempt",e.attemptId),e.filter&&e.filter!=="all"&&s.set("filter",e.filter),`/dispatch${v(s)}`}case"code":{const s=new URLSearchParams;if(e.wt&&s.set("wt",e.wt),e.line&&s.set("line",String(e.line)),e.line&&e.endLine&&e.endLine>=e.line&&s.set("endLine",String(e.endLine)),e.project){e.returnConversationId&&s.set("fromConversation",e.returnConversationId);const r=[encodeURIComponent(e.project)];return e.path&&r.push(...e.path.split("/").map(encodeURIComponent)),`${`/code/${r.join("/")}`}${v(s)}`}e.root&&s.set("root",e.root),e.file&&s.set("file",e.file),e.returnConversationId&&s.set("fromConversation",e.returnConversationId);const o=s.toString();return o?`/code?${o}`:"/code"}case"briefings":return e.briefingId?`/briefings/${encodeURIComponent(e.briefingId)}`:"/briefings";case"activity":return O("/activity",e);case"voice":return"/voice";case"work":return O(`/work/${encodeURIComponent(e.workId)}`,e);case"settings":return e.section==="agents"?e.agentId?`/settings/agents/${encodeURIComponent(e.agentId)}`:"/settings/agents":e.section?e.section==="pairing"?"/settings/pairing":e.section==="comms"?"/settings/comms":`/settings/${e.section}`:"/settings";case"ops":if(!e.mode)return"/ops";if(e.mode==="tail"||e.mode==="advisor"){const s=new URLSearchParams;return e.mode==="tail"&&e.tailQuery&&s.set("q",e.tailQuery),e.mode==="advisor"&&e.planDocumentId&&s.set("plan",e.planDocumentId),e.flightId&&s.set("flightId",e.flightId),e.invocationId&&s.set("invocationId",e.invocationId),e.conversationId&&s.set("conversationId",e.conversationId),e.workId&&s.set("workId",e.workId),e.sessionId&&s.set("sessionId",e.sessionId),e.targetAgentId&&s.set("targetAgentId",e.targetAgentId),`/ops/${Oe(e.mode)}${v(s)}`}return`/ops/${Oe(e.mode)}`;case"follow":{const s=new URLSearchParams;e.preferredView&&s.set("view",e.preferredView),e.flightId&&s.set("flightId",e.flightId),e.invocationId&&s.set("invocationId",e.invocationId),e.conversationId&&s.set("conversationId",e.conversationId),e.workId&&s.set("workId",e.workId),e.sessionId&&s.set("sessionId",e.sessionId),e.targetAgentId&&s.set("targetAgentId",e.targetAgentId),e.machineId&&s.set(ve,e.machineId);const o=s.toString();return`/follow${o?`?${o}`:""}`}case"terminal":if(e.agentId){const s=new URLSearchParams;return e.mode&&s.set("mode",e.mode),`/terminal/${encodeURIComponent(e.agentId)}${v(s)}`}{const s=new URLSearchParams;if(e.terminalBackend)return e.terminalBackend!=="pty"&&s.set("backend",e.terminalBackend),e.terminalAgent&&e.terminalAgent!=="shell"&&s.set("agent",e.terminalAgent),e.terminalSessionName&&s.set("name",e.terminalSessionName),e.terminalTabId&&s.set("tab",e.terminalTabId),e.zellijSocketDir&&s.set("socketDir",e.zellijSocketDir),`/terminal/new${v(s)}`;e.mode&&s.set("mode",e.mode);const o=Yt(e.terminalSurfaceKey);return o?`/terminal/${encodeURIComponent(o.backend)}/${encodeURIComponent(o.sessionName)}${v(s)}`:Be(e.terminalSurfaceKey)?`/terminal/s/${encodeURIComponent(e.terminalSurfaceKey)}${v(s)}`:(e.terminalSessionId&&s.set("session",e.terminalSessionId),e.terminalSurfaceKey&&s.set("surface",e.terminalSurfaceKey),`/terminal${v(s)}`)}}}function N(e){const t=ys(e);switch(e.view){case"conversation":return`conv:${e.conversationId}${t}`;case"agent-info":return`agent-info:${e.conversationId}`;case"settings":return`settings:${e.section??"pairing"}:${e.agentId??""}`;case"agents-v2":return["agents-v2",e.projectSlug??"",e.harness??"",e.node??"",e.set??"",e.indexView??"agents",e.stateFilter??"",e.showEphemeral?"eph":"",e.agentId??"",e.sessionId??"",t].join(":");case"sessions":return e.flightId?`flight-observe:${e.flightId}:${e.sessionId??""}:${e.compareSessionId??""}${t}`:e.sessionId?`session:${e.agentId??""}:${e.sessionId}${t}`:`sessions${t}`;case"messages":return["messages",e.conversationId??"",e.agentId??"",e.threadId??"",t].join(":");case"work":return`work:${e.workId}${t}`;case"ops":return`ops:${e.mode??"advisor"}:${e.tailQuery??""}:${e.planDocumentId??""}:${e.flightId??""}:${e.invocationId??""}:${e.workId??""}:${e.conversationId??""}:${e.sessionId??""}:${e.targetAgentId??""}`;case"search":return`search:${e.mode??"knowledge"}:${e.hitId??""}`;case"broker":return`broker:${e.attemptId??""}`;case"follow":return`follow:${e.flightId??e.invocationId??e.conversationId??e.workId??e.sessionId??e.targetAgentId??""}:${e.preferredView??""}${t}`;case"terminal":return`terminal:${e.agentId??""}:${e.terminalSessionId??""}:${e.terminalSurfaceKey??""}:${e.terminalBackend??""}:${e.terminalAgent??""}:${e.terminalSessionName??""}:${e.terminalTabId??""}:${e.mode??"detail"}`;case"repo-diff":return`repo-diff:${e.path}`;default:return`${e.view}${t}`}}function G(e,t){return ue(Ut(`${e}${t}`))}function Tt(e){return e?`#${e}`:""}function Es(e){return e.startsWith("/embed/")||e==="/ops/lanes/embed"}function xe(){if(typeof window>"u"){const e=new URL(Ct);return{pathname:e.pathname,searchStr:e.search,hash:e.hash.replace(/^#/,""),state:null}}return{pathname:window.location.pathname,searchStr:window.location.search,hash:window.location.hash.replace(/^#/,""),state:window.history.state}}function $s(e,t){return e.pathname===t.pathname&&e.searchStr===t.searchStr&&e.hash===t.hash&&Object.is(e.state,t.state)}function Rs(e){let t=e.read();const n=new Set;let s=null;const o=()=>{const r=e.read();if(!$s(t,r)){t=r;for(const i of n)i()}};return{getSnapshot:()=>t,subscribe(r){return s||(s=e.observe(o)),n.add(r),()=>{n.delete(r)}},navigateTo(r,i={}){const a=t.pathname,c=i.state===void 0?t.state:i.state;i.replace?e.replace(r,c):e.push(r,c),o(),t.pathname!==a&&Gt(a,t.pathname)}}}function Ps(){return typeof window>"u"?{read:xe,push:()=>{},replace:()=>{},observe:()=>()=>{}}:{read:xe,push:(e,t)=>window.history.pushState(t,"",e),replace:(e,t)=>window.history.replaceState(t,"",e),observe:e=>(window.addEventListener("popstate",e),window.addEventListener("hashchange",e),()=>{window.removeEventListener("popstate",e),window.removeEventListener("hashchange",e)})}}const x=Rs(Ps());function Cs(){return L.useSyncExternalStore(x.subscribe,x.getSnapshot,x.getSnapshot)}function ie(e,t={}){x.navigateTo(e,t)}function kt(){return typeof window>"u"?null:window.navigation??null}function Ot(){if(typeof window>"u")return!1;const e=kt();return e?e.canGoBack:window.history.length>1}function As(){if(!Ot())return;const e=kt();if(e){e.back();return}window.history.back()}function Uo(e){if(!e||typeof e!="object")return null;const t=e.returnTo;return!t||typeof t!="object"||typeof t.view!="string"?null:t}function Fo(e){return!e||typeof e!="object"?!1:e.returnUseHistory===!0}function je(e){if(!e||typeof e!="object")return e;const{returnTo:t,returnUseHistory:n,settingsEntry:s,...o}=e;return o}function _s(e,t){if(t.returnTo!==void 0){const n=t.state!==void 0?t.state:je(e),s=n&&typeof n=="object"?{...n}:{};return s.returnTo=t.returnTo,s.returnUseHistory=t.replace!==!0,s}return t.state!==void 0?t.state:t.replace?e:je(e)}function Dt(e){return e?e.replace(/^#/,""):""}function Us(e,t,n={}){const s=G(e.pathname,e.searchStr),o=Ls(t,s),r=n.preserveSearch===!1?"":e.searchStr,i=vt(Ft(o,e.pathname),r),a=Dt(n.hash);return{route:o,href:`${i}${a?`#${a}`:""}`}}function Fs(e,t){const n=new URLSearchParams(e.searchStr);for(const[r,i]of Object.entries(t.searchPatch??{}))i===null?n.delete(r):n.set(r,i);const s=n.toString(),o=t.hash===void 0?e.hash:Dt(t.hash);return`${e.pathname}${s?`?${s}`:""}${o?`#${o}`:""}`}function To(e){const t=x.getSnapshot(),n=Fs(t,e),s=`${t.pathname}${t.searchStr}${Tt(t.hash)}`;n!==s&&ie(n,{replace:e.replace??!0,state:e.state})}function Ts(e,t,n){if(Es(e))return null;const s=`${e}${t}`,o=Ut(s),r=ue(o),i=vt(Ft(r,e),t);return!(N(o)!==N(r)||r.view==="agents-v2"||s!==i)||s===i?null:`${i}${Tt(n)}`}function ko(){const{pathname:e,searchStr:t,hash:n}=Cs(),s=`${e}${t}`,o=L.useMemo(()=>G(e,t),[e,t]),r=L.useRef({}),i=L.useRef(s);L.useEffect(()=>{const f=Ts(e,t,n);f&&ie(f,{replace:!0})},[e,t,n]),L.useEffect(()=>{if(i.current===s)return;const f=G(e,t);requestAnimationFrame(()=>{window.scrollTo(0,r.current[N(f)]??0)}),i.current=s},[s,e,t]);const a=L.useCallback((f,S={})=>{const A=ue(f.view==="ops"&&!rt()&&!At(f.mode)?{view:"inbox"}:f),g=G(e,t),{route:w,href:R}=Us({pathname:e,searchStr:t},A,S);r.current[N(g)]=window.scrollY;const U=x.getSnapshot().state,_=_s(U,S);ie(R,{replace:S.replace,state:_}),requestAnimationFrame(()=>{window.scrollTo(0,r.current[N(w)]??0)})},[e,t]),c=L.useCallback(()=>As(),[]),d=Ot();return{route:o,navigate:a,navigateBack:c,canNavigateBack:d}}export{qs as $,Po as A,$o as B,Eo as C,Pt as D,go as E,js as F,Gn as G,ge as H,T as I,po as J,fo as K,wo as L,ho as M,Co as N,yo as O,Ao as P,To as Q,io as R,fn as S,It as T,wt as U,uo as V,Qs as W,Vs as X,Xs as Y,An as Z,_n as _,Ft as a,Pn as a0,eo as a1,Un as a2,no as a3,so as a4,to as a5,oo as a6,Zs as a7,Js as a8,Ys as a9,So as aA,$t as aB,bo as aC,re as aD,vo as aE,Io as aF,Et as aG,it as aa,at as ab,Se as ac,ro as ad,ao as ae,V as af,ne as ag,Bs as ah,oe as ai,Q as aj,Dn as ak,Bn as al,xn as am,vt as an,zn as ao,un as ap,co as aq,St as ar,Ye as as,lo as at,ko as au,Ve as av,Zt as aw,bt as ax,z as ay,mo as az,bs as b,_o as c,et as d,Ws as e,le as f,zs as g,Ms as h,Gs as i,Hs as j,Cs as k,Uo as l,Fo as m,dn as n,mn as o,pn as p,Ks as q,Ut as r,De as s,ns as t,Ns as u,Ro as v,wn as w,ts as x,Lo as y,ss as z};
1
+ import{r as L,j as jt,N as ce,O as Nt,P as Ne,Q as Me,A as Mt,R as Bt,B as T,D as h,T as zt,U as J,V as Wt,W as Kt}from"./index-C1VaWNuD.js";import{b as Gt}from"./perf-PX8Rx0EP.js";import{n as ue}from"./synthetic-agent-routing-aduMYO7P.js";import{g as Ht,h as Be,j as Vt,k as Yt}from"./terminal-sessions-Bdt2W3Y4.js";var ze=["local","url","sharedConfig","env"];function We(e){const t=qt(e),n=e.audienceIncludes??Qt(e.audienceOrder),s=new Set;function o(a){!e.warnOnUnknown||s.has(a)||(s.add(a),typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[hudsonkit/flags] Unknown feature flag "${a}" resolved false.`))}const r=e.registry;function i(a){const c=r[a];if(!c)return o(a),{key:a,enabled:!1,value:!1,layer:"default",audience:t,reason:"unknown-flag"};const d=Xt(e.layers,a);return d?{key:a,enabled:d.value,value:d.value,layer:d.layer,audience:t,requiredTier:c.tier,reason:"override",definition:c}:c.defaultEnabled?c.tier&&!n(t,c.tier)?{key:a,enabled:!1,value:!1,layer:"default",audience:t,requiredTier:c.tier,reason:"audience-denied",definition:c}:{key:a,enabled:!0,value:!0,layer:"default",audience:t,requiredTier:c.tier,reason:"default",definition:c}:{key:a,enabled:!1,value:!1,layer:"default",audience:t,requiredTier:c.tier,reason:"default",definition:c}}return{registry:e.registry,isEnabled:a=>i(String(a)).enabled,explain:a=>i(String(a)),all:()=>Object.keys(e.registry).sort().map(i),audience:()=>t}}function qt(e){let t=e.audience.tier;for(const n of ze.slice().reverse()){const s=e.layers?.[n]?.audience;s&&(t=s)}return{...e.audience,tier:t}}function Qt(e){return(t,n)=>{if(t.tier===n)return!0;if(!e||e.length===0)return!1;const s=e.indexOf(t.tier),o=e.indexOf(n);return s<0||o<0?!1:s>=o}}function Xt(e,t){for(const n of ze){const s=Zt(e?.[n]?.flags?.[t]);if(s!==null)return{layer:n,value:s}}return null}function Zt(e){return e===!0||e==="on"?!0:e===!1||e==="off"?!1:null}function Jt(e){if(e===!0||e===!1)return e;if(typeof e=="number"){if(e===1)return!0;if(e===0)return!1}if(typeof e!="string")return;const t=e.trim().toLowerCase();if(["1","true","on","yes","enabled","enable"].includes(t))return!0;if(["0","false","off","no","disabled","disable"].includes(t))return!1;if(["default","null","unset","clear"].includes(t))return"default"}function en(e,t={}){const n=t.paramPrefix??"ff.",s=t.audienceParam??"ffAudience",o=typeof e=="string"?new URL(e,"http://hudson.local"):e,r={};let i;for(const[a,c]of o.searchParams.entries()){if(a===s&&c.trim()&&(i=c.trim()),!a.startsWith(n))continue;const d=a.slice(n.length),f=Jt(c);d&&f!==void 0&&(r[d]=f)}return{flags:r,audience:i}}var D=1;function Ke(e){if(typeof window>"u")return{version:D};try{const t=window.localStorage?.getItem(e);return tn(t)}catch{return{version:D}}}function q(e,t){if(typeof window>"u")return;const n=Ge(t),s=JSON.stringify(n);try{window.localStorage?.setItem(e,s)}catch{}nn(e,s)}function tn(e){if(!e)return{version:D};try{const t=JSON.parse(e);return!t||typeof t!="object"?{version:D}:Ge(t)}catch{return{version:D}}}function Ge(e){const t={version:D};if(e.audience&&(t.audience=e.audience),e.flags&&typeof e.flags=="object"){t.flags={};for(const[n,s]of Object.entries(e.flags))(s===!0||s===!1)&&(t.flags[n]=s);Object.keys(t.flags).length===0&&delete t.flags}return t}function nn(e,t){if(!(typeof document>"u"))try{const n=encodeURIComponent(t);document.cookie=`${encodeURIComponent(e)}=${n}; Path=/; SameSite=Lax; Max-Age=31536000`}catch{}}var sn="hudson.flags",He=L.createContext(null);function js({registry:e,audience:t,audienceOrder:n,audienceIncludes:s,initialLayers:o,storageKey:r=sn,warnOnUnknown:i=!1,children:a}){const[c,d]=L.useState(()=>{const g=o?.local;return{version:1,audience:g?.audience??void 0,flags:on(g)}});L.useEffect(()=>{const g=Ke(r);(g.audience||Object.keys(g.flags??{}).length>0)&&d(g)},[r]);const f=L.useMemo(()=>({...o,local:{...o?.local,audience:c.audience??o?.local?.audience,flags:{...o?.local?.flags??{},...c.flags??{}}}}),[o,c]),S=L.useMemo(()=>We({registry:e,audience:t,audienceOrder:n,audienceIncludes:s,layers:f,warnOnUnknown:i}),[e,t,n,s,f,i]),A=L.useMemo(()=>({...S,layers:f,storageKey:r,setLocalOverride:(g,w)=>{d(R=>{const U={...R.flags??{}};w===null?delete U[g]:U[g]=w;const _={...R,version:1,flags:U};return q(r,_),_})},setLocalAudienceOverride:g=>{d(w=>{const R={...w,version:1,audience:g??void 0};return q(r,R),R})},resetLocalOverrides:()=>{const g={version:1};q(r,g),d(g)}}),[S,f,r]);return jt.jsx(He.Provider,{value:A,children:a})}function Ve(){return L.useContext(He)}function Ns(){const e=Ve();if(!e)throw new Error("useFeatureFlags must be used within FeatureFlagsProvider");return e}function Ms(e,t=!0){return Ve()?.isEnabled(e)??t}function on(e){if(!e?.flags)return;const t={};for(const[n,s]of Object.entries(e.flags))(s===!0||s===!1)&&(t[n]=s);return Object.keys(t).length>0?t:void 0}const rn=["ops.control","ops.mesh","ops.runtime","ops.plans","ops.terminal"],an=["surface.search","surface.sessions","surface.briefings","surface.work","surface.activity","surface.follow","surface.scoutbot","surface.workflows"];function ye(e,t){return Object.fromEntries(e.map(n=>[n,t]))}const Ye={label:"Surface · Scope",description:`Scope presentation on Scout infra — lean lanes/tail/sessions/agents at ${Nt}/*.`,defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","scope","observability"]},cn={...Ye,label:"Surface · Scope (legacy alias)",description:`Legacy alias for ${ce}. Prefer the primary flag; ${Ne} remains for old dev links.`},Bs=ce;function un(){return{audience:"everyone",flags:{"ops.control":!0,"ops.lanes":!0,...ye(rn,!1),...ye(an,!1)}}}const qe=["ffBundle","ffVariant","scoutBundle","scoutExperience","ab"],Qe=["ffGlobal","scoutGlobalBundle"],Xe=["ffPersist","persistBundle"],ln=new Set(["no-ops","ffAudience",...qe,...Qe,...Xe]);function zs(e){for(const t of[...e.searchParams.keys()])(ln.has(t)||t.startsWith("ff."))&&e.searchParams.delete(t);return e}const dn=["everyone","internal","power"],fn="openscout.flags",ee="openscout.flagBundle",mn={tier:"power"},Ee=["ops.control","ops.mesh","ops.runtime","ops.plans","ops.terminal","ops.lanes"],$e=["surface.search","surface.sessions","surface.briefings","surface.work","surface.activity","surface.follow","surface.mesh-ops","surface.scoutbot","surface.workflows"],pn={"nav.sidebar":{label:"Nav · Sidebar",description:"Classic sidebar chrome (8 primary areas + icon rail). Default on since sco-083 soak; opt out with ?ff.nav.sidebar=off. Not included in max-pro.",defaultEnabled:!0,tier:"everyone",owner:"scout-web",tags:["nav","chrome"]},"ops.control":{label:"Ops · Control",description:"Mission control, issues, and the Ops section shell.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops","nav"]},"ops.mesh":{label:"Ops · Mesh",description:"Mesh topology and peer status.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"ops.runtime":{label:"Ops · Runtime",description:"Runtime / atop process telemetry.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"ops.plans":{label:"Ops · Plans",description:"Plan documents and plan-mode review.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"ops.terminal":{label:"Ops · Terminal",description:"Observe / takeover terminal sessions.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"ops.lanes":{label:"Ops · Agent Lanes",description:"One column per local agent — follow live harness work in power-user mode.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"surface.search":{label:"Surface · Search",description:"Knowledge + indexer search as a top-level nav entry.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","nav"]},"surface.sessions":{label:"Surface · Sessions",description:"Standalone top-level Sessions entry (still reachable under Agents).",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","nav"]},"surface.briefings":{label:"Surface · Briefings",description:"Briefings list + detail.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface"]},"surface.work":{label:"Surface · Work",description:"Work item detail.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface"]},"surface.activity":{label:"Surface · Activity",description:"Activity stream.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface"]},"surface.follow":{label:"Surface · Follow",description:"Follow view.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface"]},"surface.mesh-ops":{label:"Surface · Mesh Ops",description:"Mesh Ops — work-item triage over the mesh (hosts rail, item list, inspector).",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","ops"]},"surface.scoutbot":{label:"Surface · Scoutbot",description:"Scoutbot assistant — the inspector panel, the status-bar broadcast chip, and the Message-Scout command-palette actions.",defaultEnabled:!0,tier:"everyone",owner:"scout-web",tags:["surface","assistant"]},"surface.realtime-voice":{label:"Surface · Realtime voice",description:"Live WebRTC voice conversations with Scoutbot through OpenAI Realtime. Operator enablement lives in Settings → Voice; this flag is a build-level kill switch.",defaultEnabled:!0,tier:"everyone",owner:"scout-web",tags:["surface","assistant","voice"]},"surface.workflows":{label:"Surface · Workflows",description:"Observed harness families / workflow topology telemetry on the Agents directory. Off in the lean view — the directory is just the project-grouped agent board.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","observability"]},[ce]:Ye,[Ne]:cn},gn={a:"light-prod",control:"light-prod",light:"light-prod","light-prod":"light-prod",prod:"light-prod",production:"light-prod",b:"max-pro",max:"max-pro","max-pro":"max-pro",pro:"max-pro",treatment:"max-pro",...Bt},Re=new Set(["clear","default","none","reset","unset"]);function K(e,t){return Object.fromEntries(e.map(n=>[n,t]))}function Ze(...e){const t={};for(const n of e)n.audience&&(t.audience=n.audience),n.flags&&Object.keys(n.flags).length>0&&(t.flags={...t.flags??{},...n.flags});return t}function le(e){switch(e){case"light-prod":return{audience:"everyone",flags:{...K(Ee,!1),...K($e,!1)}};case"max-pro":return{audience:"power",flags:{...K(Ee,!0),...K($e,!0)}};case Mt:return un()}}function j(e){return e?gn[e.trim().toLowerCase()]??null:null}function te(e,t){for(const n of t){const s=e.get(n);if(s!==null)return s}return null}function Je(e){const t=te(e,qe);return j(t)}function hn(e){const t=te(e,Qe);if(t){const i=t.trim().toLowerCase();if(Re.has(i))return{action:"clear"};const a=j(t);return a?{action:"set",bundle:a}:null}const n=te(e,Xe);if(!n)return null;const s=n.trim().toLowerCase();if(Re.has(s))return{action:"clear"};if(["0","false","no"].includes(s))return null;const o=j(n);if(o)return{action:"set",bundle:o};const r=Je(e);return r?{action:"set",bundle:r}:null}function et(){if(typeof window>"u")return null;try{return j(window.localStorage.getItem(ee))}catch{return null}}function wn(e){if(!(typeof window>"u"))try{e.action==="clear"?window.localStorage.removeItem(ee):window.localStorage.setItem(ee,e.bundle)}catch{}}function Ws(){return et()??j(Me())??nt}function tt(){const e=et();return e?le(e):{}}const nt="light-prod";function st(){const e=j(Me())??nt;return le(e)}function In(e){const t=hn(e);t&&wn(t)}function ot(e=new URLSearchParams(window.location.search)){const t=en(window.location.href),n=Je(e),s=n?le(n):{},o={audience:t.audience??s.audience,flags:{...s.flags??{},...t.flags??{}}};return e.has("no-ops")&&(o.flags={...o.flags,"ops.control":!1}),o}function vn(){const e=Ke(fn);return{flags:e.flags,audience:e.audience??void 0}}function Ks(){if(typeof window>"u")return{};const e=new URLSearchParams(window.location.search);return In(e),{sharedConfig:Ze(st(),tt()),url:ot(e)}}function Sn(e){const t=typeof window>"u"?{}:{sharedConfig:Ze(st(),tt()),url:ot(),local:vn()};return We({registry:pn,audience:mn,audienceOrder:dn,layers:t,warnOnUnknown:!1}).isEnabled(e)}function rt(){return Sn("ops.control")}const ne={sm:408,md:512,lg:616},at=240,it=640,bn=24,ct="openscout:lane-deck:v1",Ln=new Set(["web.ops","macos.lanes","hud.tail","web.embed"]),de=new Set(["sm","md","lg"]),ut={"web.ops":{defaultLaneWidth:"lg",showAutoLanes:!0},"macos.lanes":{defaultLaneWidth:"md",showAutoLanes:!0},"hud.tail":{defaultLaneWidth:"sm",showAutoLanes:!0,defaultHorizon:"30m"},"web.embed":{defaultLaneWidth:"md",showAutoLanes:!0}},yn=ut["web.ops"];function fe(e){return lt(e)?ut[e]:yn}const H={pinned_left:0,main:1,pinned_right:2};function lt(e){return Ln.has(e)}function Gs(e=window.location.search,t=window.location.pathname){const n=new URLSearchParams(e),s=n.get("profile")?.trim().toLowerCase();if(s&&lt(s))return s;const o=n.get("embed")?.trim().toLowerCase();return o==="hud"?"hud.tail":o==="app"?"macos.lanes":t.includes("/lanes/embed")?"web.embed":(t.includes("/ops/lanes"),"web.ops")}function Hs(e=window.location.search){const t=new URLSearchParams(e),n=(t.get("lanes")??t.get("size"))?.trim().toLowerCase();return n&&de.has(n)?n:"lg"}function Vs(e,t){if(typeof e=="number"&&Number.isFinite(e))return Math.min(it,Math.max(at,Math.round(e)));const n=typeof e=="string"&&de.has(e)?e:t;return ne[n]}function Ys(e){const t=Math.min(it,Math.max(at,Math.round(e)));let n=null,s=Number.POSITIVE_INFINITY;for(const[o,r]of Object.entries(ne)){const i=Math.abs(r-t);i<s&&(s=i,n=o)}return n&&s<=bn?{px:ne[n],tier:n}:{px:t,tier:null}}function me(e,t,n){return{version:1,profileId:e,defaultLaneWidth:t??n.defaultLaneWidth,defaultHorizon:n.defaultHorizon,laneWidths:{},laneDefs:[],slots:[],showAutoLanes:n.showAutoLanes,updatedAt:Date.now()}}function Pe(e,t){const n=fe(e);return me(e,t,n)}function se(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="string"&&de.has(e))return e}function En(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.id!="string"||!t.id.trim()||t.kind!=="session"&&t.kind!=="harness"&&t.kind!=="project"&&t.kind!=="attention"||typeof t.title!="string"||!t.title.trim()?null:{id:t.id.trim(),kind:t.kind,title:t.title.trim(),sessionId:typeof t.sessionId=="string"?t.sessionId.trim():void 0,harness:typeof t.harness=="string"?t.harness.trim():void 0,projectPath:typeof t.projectPath=="string"?t.projectPath.trim():void 0}}function $n(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.id!="string"||!t.id.trim()||typeof t.laneDefId!="string"||!t.laneDefId.trim()||t.zone!=="pinned_left"&&t.zone!=="main"&&t.zone!=="pinned_right"||typeof t.position!="number"||!Number.isFinite(t.position)?null:{id:t.id.trim(),laneDefId:t.laneDefId.trim(),zone:t.zone,position:t.position,width:se(t.width)}}function dt(e,t,n,s){if(!e||typeof e!="object")return me(t,n,s);const o=e,r=Array.isArray(o.laneDefs)?o.laneDefs.map(En).filter(d=>d!==null):[],i=Array.isArray(o.slots)?o.slots.map($n).filter(d=>d!==null):[],a={};if(o.laneWidths&&typeof o.laneWidths=="object")for(const[d,f]of Object.entries(o.laneWidths)){const S=se(f);S!==void 0&&(a[d]=S)}const c=se(o.defaultLaneWidth);return{version:1,profileId:t,defaultLaneWidth:(typeof c=="string"?c:void 0)??n??s.defaultLaneWidth,defaultHorizon:typeof o.defaultHorizon=="string"?o.defaultHorizon:s.defaultHorizon,laneWidths:a,laneDefs:r,slots:i,showAutoLanes:typeof o.showAutoLanes=="boolean"?o.showAutoLanes:s.showAutoLanes,updatedAt:typeof o.updatedAt=="number"?o.updatedAt:Date.now()}}function Rn(e,t,n){return dt(e,t,n,fe(t))}function qs(e,t){const n=fe(e),s=t??n.defaultLaneWidth;try{const o=localStorage.getItem(`${ct}:${e}`);return o?Rn(JSON.parse(o),e,s):Pe(e,s)}catch{return Pe(e,s)}}function Pn(e){try{localStorage.setItem(`${ct}:${e.profileId}`,JSON.stringify({...e,updatedAt:Date.now()}))}catch{}}function Qs(e){return[...e].sort((t,n)=>{const s=H[t.zone]-H[n.zone];return s!==0?s:t.position-n.position})}function Xs(e,t){return H[e]-H[t]}function ft(){return`slot:${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function pe(e){return e.trim().toLowerCase().replace(/['"]/gu,"").replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function Y(e){return`session:${e}`}function Cn(e){return`harness:${pe(e)}`}function An(e){return`project:${pe(e)}`}const _n="attention:needs-input";function mt(e,t){const n=e.filter(s=>s.zone===t);return n.length===0?0:Math.max(...n.map(s=>s.position))+1}function pt(e,t){const n=e.laneDefs.some(s=>s.id===t.id);return{...e,laneDefs:n?e.laneDefs.map(s=>s.id===t.id?t:s):[...e.laneDefs,t]}}function gt(e,t){const n=e.slots.some(s=>s.id===t.id);return{...e,slots:n?e.slots.map(s=>s.id===t.id?t:s):[...e.slots,t]}}function ht(e,t){return{...e,slots:e.slots.filter(n=>n.laneDefId!==t)}}function Un(e,t){const n=Y(t);return{...ht(e,n),laneDefs:e.laneDefs.filter(s=>s.id!==n)}}function Zs(e,t){const n=Y(t);return e.slots.some(s=>s.laneDefId===n&&s.zone!=="main")}function Js(e,t){const n=Y(t),s=e.slots.find(o=>o.laneDefId===n);return!s||s.zone==="main"?null:s.zone}function eo(e,t){const n=t.zone??"pinned_left",s=Y(t.laneId),o=Un(e,t.laneId),r=pt(o,{id:s,kind:"session",title:t.title,sessionId:t.laneId});return gt(r,{id:ft(),laneDefId:s,zone:n,position:mt(r.slots,n),width:t.width})}function to(e,t){const n=t.zone??"pinned_left",s=t.kind==="attention"?_n:t.kind==="harness"&&t.harness?Cn(t.harness):t.kind==="project"&&t.projectPath?An(t.projectPath):`${t.kind}:${pe(t.title)}`,o=ht(e,s),r=pt(o,{id:s,kind:t.kind,title:t.title,harness:t.harness,projectPath:t.projectPath});return gt(r,{id:ft(),laneDefId:s,zone:n,position:mt(r.slots,n),width:t.width})}function no(e,t,n){return{...e,laneWidths:{...e.laneWidths,[t]:n},updatedAt:Date.now()}}function so(e,t){return{...e,defaultLaneWidth:t,updatedAt:Date.now()}}function oo(e){const t=new Set(e.slots.filter(n=>n.zone!=="main").map(n=>n.laneDefId));return{...e,slots:e.slots.filter(n=>n.zone==="main"),laneDefs:e.laneDefs.filter(n=>!t.has(n.id))}}const V="scope.lanes",oe={defaultLaneWidth:"md",showAutoLanes:!0,defaultHorizon:"30m"},kn="openscout:lane-deck:v1";function Ce(e){return me(V,e,oe)}function ro(e){const t=e??oe.defaultLaneWidth;try{const n=localStorage.getItem(`${kn}:${V}`);return n?dt(JSON.parse(n),V,t,oe):Ce(t)}catch{return Ce(t)}}function ao(e){Pn(e)}const Fn=[h.lanes,h.tail,h.sessions,h.agents];function Tn(e){return Fn.includes(e)}function On(e){return e===Wt||e===Kt}function wt(e){return zt(e)}function Q(e,t={}){switch(e){case h.tail:{const n=new URLSearchParams;t.tailQuery&&n.set("q",t.tailQuery);const s=n.toString();return T(e,s?`?${s}`:"")}case h.sessions:return t.sessionId?T(e,`/${encodeURIComponent(t.sessionId)}`):T(e);case h.lanes:return T(J);case h.agents:return T(e);default:return T(J)}}function It(e){switch(e.view){case"ops":return!e.mode||e.mode==="lanes"?h.lanes:e.mode==="tail"?h.tail:null;case"sessions":return e.agentId?null:h.sessions;case"agents-v2":return e.agentId||e.projectSlug||e.sessionId||e.conversationId?null:h.agents;default:return null}}function Dn(e){const t=It(e);return t?t===h.tail&&e.view==="ops"?Q(t,{tailQuery:e.tailQuery}):t===h.sessions&&e.view==="sessions"?Q(t,{sessionId:e.sessionId}):Q(t):null}function xn(e,t,n){if(!On(e[0]))return null;const s=e[1]??J;if(!Tn(s))return{view:"ops",mode:"lanes"};switch(s){case h.tail:{const o=t.searchParams.get("q")?.trim();return{view:"ops",mode:"tail",...o?{tailQuery:o}:{}}}case h.sessions:return e[2]?n({view:"sessions",sessionId:decodeURIComponent(e[2])}):n({view:"sessions"});case h.agents:return n({view:"agents-v2"});case h.lanes:default:return{view:"ops",mode:"lanes"}}}const jn=new Set(["no-ops","ffBundle","ffVariant","scoutBundle","scoutExperience","ab","ffGlobal","scoutGlobalBundle","ffPersist","persistBundle","ffAudience","studio","studioInjection","studioMode"]),Nn=["ff.","studio.","studioMode."];function Mn(e){return jn.has(e)||Nn.some(t=>e.startsWith(t))}function vt(e,t=""){const n=new URL(e,"http://scout.local");new URLSearchParams(t).forEach((r,i)=>{Mn(i)&&(n.searchParams.has(i)||n.searchParams.set(i,r))});const o=n.searchParams.toString();return`${n.pathname}${o?`?${o}`:""}`}function io(e){switch(e){case h.tail:return{view:"ops",mode:"tail"};case h.sessions:return{view:"sessions"};case h.agents:return{view:"agents-v2"};case h.lanes:default:return{view:"ops",mode:"lanes"}}}function Bn(e=typeof window<"u"?window.location.pathname:""){return wt(e)}function co(){return V}function uo(e=Bn()){return e?{"data-scope-presentation":!0}:void 0}function St(e,t=typeof window<"u"?window.location.pathname:""){return wt(t)?Dn(e):null}function zn(e,t=typeof window<"u"?window.location.pathname:""){return St(e,t)!==null}function lo(e,t=typeof window<"u"?window.location.pathname:""){return zn(e,t)?It(e):null}const fo={days:3,sessionLimit:200,hitLimit:60,debounceMs:180};function re(e){return e.root==="HOME"?`~/${e.relPath}`:e.root==="ABSOLUTE"?e.relPath:`$${e.root}/${e.relPath}`}function Ae(e){const t=e?.trim();if(!t)return null;const n=t.replace(/[\\/]+$/,""),s=n.split(/[\\/]/).filter(Boolean).at(-1)??n;return s.endsWith(".jsonl")?s.slice(0,-6):s}function F(e){return e.sourceRefs.find(t=>t.kind==="harness_transcript")??null}function bt(e){return e.sourceRefs.find(t=>t.kind==="file")??null}function ge(e){return e?Ae(e.sessionId)??Ae(re(e.path)):null}function mo(e){const t=ge(e);if(!t)return null;const n=e?.recordRange;return n?`${t}|records ${n[0]}..${n[1]}`:t}function z(e,t){const n=e.facets[t];return Array.isArray(n)?n.filter(Boolean).join(", "):typeof n=="string"?n:""}function M(e){const t=new Set;return e.split(/[^A-Za-z0-9_./-]+/u).map(n=>n.trim()).filter(n=>n.length>1).filter(n=>{const s=n.toLowerCase();return t.has(s)?!1:(t.add(s),!0)}).slice(0,12)}const Wn=/^(events?\s+window(\s+\d+)?|files?\s+touched|tool\s+calls?|indexed\s+snippet|manifest|summary|decisions?|context\s+pack)\b/iu,_e=/^(claude|codex|kimi|cursor|gpt|gemini)\b/iu,Ue=/^(?:claude|codex|kimi|cursor|gpt|gemini)?\s*[a-z0-9._/-]*\s*(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*\s+\d{1,2}(?:\s+at\s+\d{1,2}:\d{2}\s*(?:am|pm)?)?\s*[-–—:]\s*/iu;function Lt(e){return Wn.test(e.replace(/\s+/g," ").trim())}function Kn(e){let t=e.replace(/\s+/g," ").trim();if(!t)return"";if(t=t.replace(/<[^>\n]+>/g," ").replace(/\s+/g," ").trim(),Ue.test(t))t=t.replace(Ue,"").trim();else{const n=t.match(/^(.{6,72}?)\s[-–—]\s+(.+)$/u);if(n){const s=n[1]??"",o=n[2]??"";(_e.test(s)||/\b(?:am|pm|\d{1,2}:\d{2}|plugin|session|openscout)\b/iu.test(s))&&(t=o.trim())}}return t=t.replace(_e,"").replace(/^\s*[-–—:]\s*/,"").trim(),t=t.replace(/\s{2,}/g," ").trim(),t.length>72&&(t=`${t.slice(0,69).replace(/\s+\S*$/u,"").trimEnd()}…`),t}function Gn(e){const t=z(e,"project"),n=e.title.replace(/\s+/g," ").trim();if(n&&!Lt(n)){const o=Kn(n);if(o&&o.toLowerCase()!==t.toLowerCase()||o)return o}if(t)return t;const s=ge(F(e));return s?s.length>18?`${s.slice(0,16)}…`:s:"Session match"}function yt(e){const t=B(e,"recordKind",8).map(s=>s.toLowerCase());if(t.length===0&&t.push(...B(e,"recordTag",8).map(s=>s.toLowerCase())),t.some(s=>s.includes("assistant")))return"assistant";if(t.some(s=>s.includes("user")))return"user";if(t.some(s=>s.includes("tool")||s.includes("command")||s.includes("response")))return"tool";const n=we(e);return n==="tool activity"?"tool":n==="overview"?"overview":""}function po(e,t){const n=Ie(e.snippet,t),s=yt(e),o=he(e);let r="";if(n){const i=M(t).map(d=>d.toLowerCase()),a=n.split(new RegExp("(?<=[.!?])\\s+|\\s+[–—]\\s+|\\s+·\\s+","u")).map(d=>d.replace(/^…+|…+$/gu,"").trim()).filter(d=>d.length>12);r=((i.length>0?a.find(d=>i.some(f=>ae(d,f)>=0)):void 0)??a[0]??n).replace(/^…+|…+$/gu,"").trim()}return r?(r.length>78&&(r=`${r.slice(0,75).replace(/\s+\S*$/u,"").trimEnd()}…`),r):s&&o?`${s} · ${o}`:o||s||Gn(e)}function Hn(e){return e.freshness&&e.freshness!=="unknown"?e.freshness:e.title.replace(/\s+/g," ").trim().match(/\b((?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\s+\d{1,2}(?:\s+at\s+\d{1,2}:\d{2}\s*(?:AM|PM)?)?)\b/iu)?.[1]??""}function ke(e){const t=e.trim().toLowerCase();return t?t==="events"||t.startsWith("events")?"conversation":t==="overview"||t==="summary"?"overview":t==="tool-calls"||t==="tools"?"tool activity":t==="files"||t==="files-touched"?"files touched":t==="manifest"?"session index":t.replace(/[-_]+/g," "):""}function Vn(e){const t=e.trim();return t?t.charAt(0).toUpperCase()+t.slice(1):""}function Yn(e){const t=z(e,"harness")||F(e)?.harness||"";if(!t)return"";const n=t.toLowerCase();return n==="claude"?"Claude":n==="codex"?"Codex":n==="kimi"?"Kimi":n==="cursor"?"Cursor":Vn(t)}function qn(e){const t=z(e,"sessionId").trim(),n=ge(F(e)),s=(t||n||"").trim();return s?s.length>14?s.slice(0,8):s:""}function he(e){const t=F(e)?.recordRange;if(t){const[s,o]=t;return s===o?`turn ${s}`:o-s<=1?`turns ${s}–${o}`:`turns ${s}–${o}`}const n=e.title.match(/events?\s+window\s+(\d+)/iu);return n?`window ${Number(n[1])}`:""}function Qn(e){const t=B(e,"recordKind",8).map(s=>s.toLowerCase());t.length===0&&t.push(...B(e,"recordTag",8).map(s=>s.toLowerCase()));const n=[];return t.some(s=>s.includes("user"))&&n.push("user"),t.some(s=>s.includes("assistant"))&&n.push("assistant"),t.some(s=>s.includes("tool")||s.includes("command")||s.includes("response"))&&n.push("tool"),n.length===0?"":n.join(" · ")}function we(e){const t=z(e,"documentKind");if(t){const s=t.split(",")[0]?.trim()??t;return ke(s)}return Lt(e.title)?ke(e.title):bt(e)?"file":F(e)?"conversation":""}function B(e,t,n=3){const s=e.facets[t];return(Array.isArray(s)?s:typeof s=="string"?s.split(","):[]).map(r=>r.trim()).filter(Boolean).slice(0,n)}function go(e){return{agent:Yn(e),project:z(e,"project"),session:qn(e),when:Hn(e),turn:he(e),role:Qn(e),where:we(e)}}function ho(e){const t=[],n=he(e);n&&t.push(n);const s=yt(e);s&&t.push(s);const o=we(e);o&&o!=="conversation"&&t.push(o);const r=B(e,"toolName",2);r.length===1&&t.push(r[0]),r.length>1&&t.push(r.join(", "));const i=new Set;return t.filter(a=>{const c=a.toLowerCase();return i.has(c)?!1:(i.add(c),!0)})}function ae(e,t){return new RegExp(`(?<![A-Za-z0-9_./~-])${Rt(t)}(?![A-Za-z0-9_./~-])`,"iu").exec(e)?.index??-1}function Ie(e,t=""){let n=e.replace(/\s+/g," ").trim();if(!n)return"";if(n=n.replace(/\s*-\s*\[\d{3,}\]\s*`[^`]+`(?:\s*\([^)]*\))?\s*-\s*/gu," "),n=n.replace(/\[\d{3,}\]\s*`[^`]+`\s*/gu,""),n=n.replace(/\*\*/gu,""),n=n.replace(/\b(?:assistant_turn|user_turn|agent_reasoning|command_or_tool|response_item|system_record)\b/giu," "),n=n.replace(/(?:~\/|\.\.?\/|\/(?:Users|home|var|tmp|opt)\/)\S+/gu," "),n=n.replace(/https?:\/\/\S+/gu," "),n=n.replace(/\b[\w.-]+\.(?:com|net|org|io|dev|app)(?:\/\S*)?/giu," "),n=n.replace(/\{[^{}]{0,160}\}/gu," "),n=n.replace(/`[^`]{0,64}`/gu,r=>{const i=r.slice(1,-1);return M(t).some(a=>ae(i,a)>=0)||/^[A-Za-z][\w.-]{0,24}$/u.test(i)?i:" "}),n=n.replace(/\s{2,}/g," ").trim(),n=n.replace(/^[\s,;:.\-–—|/]+/u,"").trim(),n.includes("{")||n.includes("[")){const r=n.search(/[\[{]/u);if(r>18){const i=n.slice(0,r).trim().replace(/[-–—,:;]+$/u,"").trim();i&&(n=i)}}const s=M(t),o=200;if(s.length>0&&n.length>o){let r=-1;for(const i of s){const a=ae(n,i);a>=0&&(r<0||a<r)&&(r=a)}if(r<0)for(const i of s){if(i.length<4)continue;const a=n.toLowerCase().indexOf(i.toLowerCase());a>=0&&(r<0||a<r)&&(r=a)}if(r>=0){const a=Math.max(0,r-48),c=Math.min(n.length,a+o),d=n.slice(a,c).trim();n=`${a>0?"…":""}${d}${c<n.length?"…":""}`}else n=`${n.slice(0,o-1).replace(/\s+\S*$/u,"").trimEnd()}…`}else n.length>o&&(n=`${n.slice(0,o-1).replace(/\s+\S*$/u,"").trimEnd()}…`);return n.replace(/\s{2,}/g," ").trim()}function wo(e,t,n){const s=Ie(e.snippet,t);return s.length<=n?s:`${s.slice(0,n-1).replace(/\s+\S*$/u,"").trimEnd()}…`}function Xn(e,t){return M(t).filter(n=>{const s=n.toLowerCase();return e.title.toLowerCase().includes(s)||e.snippet.toLowerCase().includes(s)||Ie(e.snippet,t).toLowerCase().includes(s)})}function Et(e){const t=(e.kind||e.role||e.type||"record").toLowerCase();return t==="assistant_turn"||t==="assistant"?"assistant":t==="user_turn"||t==="user"?"user":t==="system_record"||t==="system"?"system":t==="command_or_tool"||t==="tool_use"?"tool":t==="response_item"?"tool output":t==="agent_reasoning"||t==="reasoning"?"reasoning":t.replace(/_/gu," ")}function $t(e){const t=(e.kind||e.role||e.type||"").toLowerCase();return t==="assistant"||t==="assistant_turn"||t==="user"||t==="user_turn"||t==="last-prompt"||t==="ai-title"?0:t==="system"||t==="system_record"||t.includes("reasoning")?1:2}function Io(e){return e.scoreSource==="hybrid"?"Words and meaning":e.scoreSource==="vector"?"Similar in meaning":"Exact words"}function vo(e,t,n){const s=Xn(e,t),o=s.length===1?`Matched “${s[0]}”`:s.length>1?`Matched ${s.length} terms`:"Matched in this session";if(!n?.matched)return o;const r=[n.renderedText,n.summary].filter(Boolean).join(" ").toLowerCase(),i=s.filter(d=>r.includes(d.toLowerCase()));if(i.length===0)return o;const a=Et(n),c=a==="assistant"?"an assistant reply":a==="user"?"your message":a==="tool"?"a tool call":a==="tool output"?"tool output":a==="system"?"a system record":a==="reasoning"?"agent reasoning":`a ${a} record`;return i.length===1?`Matched “${i[0]}” in ${c}`:`Matched ${i.length} terms in ${c}`}function So(e){const t=F(e);if(t){const s=re(t.path),o=t.recordRange;return o?`${s}#R${o[0]}-R${o[1]}`:s}const n=bt(e);if(n){const s=re(n.path),o=n.lineRange;return o?`${s}#L${o[0]}-L${o[1]}`:s}return e.id}function Zn(e){const t=e.filter(o=>$t(o)===2).length,n=e.length-t,s=e.some(o=>o.matched)?" · match inside":"";return t>0&&n===0?`${t} tool step${t===1?"":"s"}${s}`:t===0?`${n} process step${n===1?"":"s"}${s}`:`${t} tool + ${n} process step${e.length===1?"":"s"}${s}`}function Jn(e){return`${e.length} more conversation turn${e.length===1?"":"s"}`}function bo(e,t={}){if(e.length===0)return[];const n=t.contextRadius??3,s=t.maxTurns??6,o=t.centerRecordIndex===void 0?-1:e.findIndex(w=>w.index===t.centerRecordIndex),r=e.findIndex(w=>w.matched),i=o>=0?o:r>=0?r:0,a=e.slice(Math.max(0,i-n),Math.min(e.length,i+n+1)),c=[];let d=[],f=[],S=0;const A=()=>{d.length!==0&&(c.push({kind:"folded",records:d,summary:Zn(d)}),d=[])},g=()=>{f.length!==0&&(c.push({kind:"folded",records:f,summary:Jn(f)}),f=[])};for(const w of a){if($t(w)>0){g(),d.push(w);continue}if(A(),S>=s){f.push(w);continue}c.push({kind:"turn",record:w,role:Et(w)}),S+=1}return A(),g(),c}function Fe(e){const t=F(e)?.recordRange;return t?t[0]:Number.MAX_SAFE_INTEGER}function Lo(e){const t=[],n=new Map;for(const s of e){const o=s.collectionId||s.id,r=n.get(o);r?r.push(s):(t.push(o),n.set(o,[s]))}return t.map(s=>{const o=[...n.get(s)??[]].sort((i,a)=>{const c=Fe(i)-Fe(a);return c!==0?c:i.score-a.score}),r=n.get(s)?.[0]??o[0];return{collectionId:s,best:r,moments:o}})}function Rt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yo(e,t){const n=M(t);if(n.length===0||e.length===0)return[{text:e,match:!1}];const s=n.map(a=>`(?<![A-Za-z0-9_./~-])${Rt(a)}(?![A-Za-z0-9_./~-])`),o=new RegExp(`(${s.join("|")})`,"giu"),r=[];let i=0;for(const a of e.matchAll(o)){const c=a.index??0;c>i&&r.push({text:e.slice(i,c),match:!1}),r.push({text:a[0],match:!0}),i=c+a[0].length}return i<e.length&&r.push({text:e.slice(i),match:!1}),r.length>0?r:[{text:e,match:!1}]}const Eo={sessions:"Sessions",skills:"Skills",mcp:"MCP",codebase:"Codebase",context_pack:"Context packs",mixed:"Mixed"},Pt=[{value:"1",label:"Last 24h"},{value:"3",label:"Last 3 days"},{value:"7",label:"Last 7 days"},{value:"30",label:"Last 30 days"}],$o=["sessions","skills","mcp","codebase","context_pack"];function Ro(){return{query:"",sourceKinds:[],harness:[],project:[],timeWindow:"all"}}function es(e){return e?Pt.some(t=>t.value===e):!1}function X(e){return e?e.split(",").map(t=>t.trim()).filter(t=>t.length>0):[]}function ts(e){const t=e==null?new URLSearchParams:typeof e=="string"?new URLSearchParams(e):e,n=t.get("time"),s=es(n)?n:"all";return{query:t.get("q")?.trim()??"",sourceKinds:X(t.get("source")),harness:X(t.get("harness")),project:X(t.get("project")),timeWindow:s}}function ns(e,t={}){const n=new URLSearchParams,s=e.query.trim();return s&&n.set("q",s),e.sourceKinds.length>0&&n.set("source",e.sourceKinds.join(",")),e.harness.length>0&&n.set("harness",e.harness.join(",")),e.project.length>0&&n.set("project",e.project.join(",")),e.timeWindow!=="all"&&n.set("time",e.timeWindow),t.hitId&&n.set("hit",t.hitId),n}function Po(e,t){return e.query.trim()===t.query.trim()&&e.timeWindow===t.timeWindow&&Z(e.sourceKinds,t.sourceKinds)&&Z(e.harness,t.harness)&&Z(e.project,t.project)}function Z(e,t){if(e.length!==t.length)return!1;const n=[...e].map(o=>o.trim().toLowerCase()).sort(),s=[...t].map(o=>o.trim().toLowerCase()).sort();return n.every((o,r)=>o===s[r])}function ss(e){return e.query.trim().length>0||e.sourceKinds.length>0||e.harness.length>0||e.project.length>0||e.timeWindow!=="all"}function Co(e){if(e==="all")return null;const t=Number.parseInt(e,10);return!Number.isFinite(t)||t<=0?null:Date.now()-t*24*60*60*1e3}function Ao(e){return e==="all"?"Any time":Pt.find(n=>n.value===e)?.label??e}const Ct=typeof window<"u"?window.location.href:"http://scout.local/";function os(e){const t=e.toString();return new URL(t,Ct)}function rs(e){switch(e){case"profile":case"config":case"definitions":return e==="definitions"?"config":e;case"observe":case"message":return e;default:return}}function as(e){const t=e.trim().replace(/^#/,"");if(!t.startsWith("msg-"))return null;const n=t.slice(4).trim();if(!n)return null;try{return decodeURIComponent(n)}catch{return n}}function is(e){switch(e){case"control":case"mission":case"command":case"warroom":case"conduct":case"conductor":return"mission";case"plan":case"advisor":return"advisor";case"issues":case"errors":case"warnings":return"issues";case"agents":case"tail":case"atop":case"lanes":return e;default:return}}function cs(e){return e==="delivered"||e==="failed"||e==="all"?e:void 0}function us(e){return e==="indexer"||e==="knowledge"?e:void 0}function ls(e){switch(e){case"pairing":case"agents":case"appearance":case"operator":case"comms":case"credentials":case"voice":case"devices":case"about":return e;case"communications":return"comms";default:return}}function ds(e){switch(e){case"tail":case"session":case"chat":case"work":return e;default:return}}function fs(e){const t=e?.trim().replace(/\.+$/u,"");return t==="observe"||t==="takeover"?t:void 0}function ms(e){const t=e?.trim().toLowerCase();return t==="pty"||t==="tmux"||t==="zellij"||t==="herdr"?t:void 0}function ps(e){const t=e?.trim().toLowerCase();return t==="shell"||t==="claude"||t==="codex"||t==="pi"?t:void 0}function gs(e){return e==="all"||e==="touched"?"all":e==="changed"?"changed":void 0}function Te(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isSafeInteger(t)&&t>0?t:void 0}function Oe(e){return e==="mission"?"control":e}function hs(e){return e.searchParams.has("no-ops")?!1:typeof window>"u"?!0:rt()}function ws(e){return e==="tail"}function Is(e){return e==="lanes"}function At(e){return ws(e)||Is(e)}const ve="machineId",_t=new Set(["inbox","conversation","agents-v2","messages","sessions","repos","harnesses","mesh","mesh-ops","activity","work","follow"]);function vs(e){return e.searchParams.get(ve)?.trim()||void 0}function Ss(e,t){return!t||!_t.has(e.view)?e:{...e,machineId:t}}function Se(e){return _t.has(e.view)}function bs(e){return"machineId"in e&&e.machineId?e.machineId:null}function De(e,t){if(!Se(e))return e;const n={...e},s=t?.trim();return s?n.machineId=s:delete n.machineId,n}function _o(e){return Se(e)?{...e,machineId:""}:e}function Ls(e,t){return Se(e)?"machineId"in e?De(e,e.machineId??null):De(e,bs(t)):e}function k(e,t){"machineId"in t&&t.machineId&&e.set(ve,t.machineId)}function v(e){const t=e.toString();return t?`?${t}`:""}function O(e,t){const n=new URLSearchParams;return k(n,t),`${e}${v(n)}`}function ys(e){return"machineId"in e&&e.machineId?`:machine:${e.machineId}`:""}function Ut(e){const t=os(e),n=t.pathname.replace(/^\/+/,"").split("/").filter(Boolean),s=vs(t),o=u=>Ss(u,s),r=xn(n,t,o);if(r)return r;const i=as(t.hash),a=rs(t.searchParams.get("tab"))??(i?"message":void 0),c=t.searchParams.get("project")?.trim()||void 0,d=t.searchParams.get("agentId")?.trim()||void 0;if(n[0]==="agent"&&n[1])return{view:"agent-info",conversationId:decodeURIComponent(n[1])};const f=t.searchParams.get("project")?.trim()||void 0,S=t.searchParams.get("harness")?.trim()||void 0,A=t.searchParams.get("node")?.trim()||void 0,g=t.searchParams.get("set")?.trim(),w=g==="live"||g==="ephemeral"||g==="archived"?g:void 0,R=t.searchParams.get("view")?.trim(),U=R==="sessions"||R==="agents"?R:void 0,_=t.searchParams.get("state")?.trim(),be=_==="needs"||_==="live"||_==="idle"?_:void 0,xt=t.searchParams.get("ephemeral")==="1",W=t.searchParams.get("session")?.trim()||void 0,y=t.searchParams.get("select")?.trim()||void 0,$={...S?{harness:S}:{},...A?{node:A}:{},...w?{set:w}:{},...U?{indexView:U}:{},...be?{stateFilter:be}:{},...xt?{showEphemeral:!0}:{}};if(n[0]==="projects"){const u=n[1]?decodeURIComponent(n[1]):void 0;if(!u)return o({view:"agents-v2",...y?{selectedAgentId:y}:{},...$});if(n[2]==="agents"){const l=n[3]?decodeURIComponent(n[3]):void 0;if(l){if(n[4]==="c"&&n[5])return o({view:"agents-v2",projectSlug:u,agentId:l,conversationId:decodeURIComponent(n[5]),tab:a??"message",...$});const m=n[4]==="sessions"&&n[5]?decodeURIComponent(n[5]):W;return o({view:"agents-v2",projectSlug:u,agentId:l,...m?{sessionId:m}:{},...a?{tab:a}:{},...$})}return o({view:"agents-v2",projectSlug:u,indexView:"agents",...y?{selectedAgentId:y}:{},...$})}return n[2]==="sessions"?o({view:"agents-v2",projectSlug:u,indexView:"sessions",...n[3]?{sessionId:decodeURIComponent(n[3])}:{},...y?{selectedAgentId:y}:{},...$}):o({view:"agents-v2",projectSlug:u,...y?{selectedAgentId:y}:{},...$})}if(n[0]==="agents-v2"&&n[1]==="sessions"&&n[2])return o({view:"agents-v2",sessionId:decodeURIComponent(n[2]),...y?{selectedAgentId:y}:{},...f?{projectSlug:f}:{},...$});if(n[0]==="agents-v2"&&n[1]){const u=decodeURIComponent(n[1]);return o({view:"agents-v2",agentId:u,...a?{tab:a}:{},...W?{sessionId:W}:{},...f?{projectSlug:f}:{},...$})}if(n[0]==="agents-v2")return o({view:"agents-v2",...y?{selectedAgentId:y}:{},...f?{projectSlug:f}:{},...$});if(n[0]==="agents"&&n[1]){const u=decodeURIComponent(n[1]),l=n[2]==="sessions"&&n[3]?decodeURIComponent(n[3]):W;return n[2]==="c"&&n[3]?o({view:"agents-v2",agentId:u,conversationId:decodeURIComponent(n[3]),tab:a??"message",...$}):o({view:"agents-v2",agentId:u,...l?{sessionId:l}:{},...a?{tab:a}:{},...$})}if(n[0]==="agents")return o({view:"agents-v2",...y?{selectedAgentId:y}:{},...f?{projectSlug:f}:{},...$});if(n[0]==="agents.deprecated"&&n[1]&&n[2]==="sessions"&&n[3])return o({view:"sessions",agentId:decodeURIComponent(n[1]),sessionId:decodeURIComponent(n[3])});if(n[0]==="agents.deprecated"&&n[1]&&n[2]==="c"&&n[3])return o({view:"agents-v2",agentId:decodeURIComponent(n[1]),conversationId:decodeURIComponent(n[3]),tab:a??"message"});if(n[0]==="agents.deprecated"&&n[1]){const u=decodeURIComponent(n[1]);return o({view:"agents-v2",agentId:u,...a?{tab:a}:{},...!a&&c?{projectSlug:c}:{}})}if(n[0]==="agents.deprecated")return o({view:"agents-v2",...c?{projectSlug:c}:{}});if(n[0]==="fleet")return o({view:"inbox"});if(n[0]==="c"&&n[1])return o({view:"conversation",conversationId:decodeURIComponent(n[1])});if(n[0]==="flights"&&n[1]&&n[2]==="observe"){const u=t.searchParams.get("session")?.trim()||void 0,l=t.searchParams.get("compare")?.trim()||void 0;return o({view:"sessions",flightId:decodeURIComponent(n[1]),...u?{sessionId:u}:{},...l?{compareSessionId:l}:{}})}if(n[0]==="sessions"&&n[1])return o({view:"sessions",sessionId:decodeURIComponent(n[1]),...d?{agentId:d}:{}});if(n[0]==="conversations")return o({view:"messages"});if(n[0]==="messages"){if(n[1]==="agent"&&n[2]){const l=t.searchParams.get("thread")?.trim()||void 0;return o({view:"messages",agentId:decodeURIComponent(n[2]),...l?{threadId:l}:{}})}const u={view:"messages",...n[1]?{conversationId:decodeURIComponent(n[1])}:{}};return o(u)}if(n[0]==="sessions")return o({view:"sessions",...d?{agentId:d}:{}});if(n[0]==="repos"){const u=t.searchParams.get("root")?.trim()||void 0;return o({view:"repos",...u?{root:u}:{}})}if(n[0]==="providers"||n[0]==="harnesses")return o({view:"harnesses"});if(n[0]==="repo-diff"){const u=t.searchParams.get("path")?.trim();if(u){const l=t.searchParams.getAll("layer").filter(I=>I==="unstaged"||I==="staged"||I==="branch"),m=t.searchParams.getAll("file").map(I=>I.trim()).filter(Boolean),p=t.searchParams.get("sessionId")?.trim()||void 0,b=t.searchParams.get("agentId")?.trim()||void 0,E=gs(t.searchParams.get("include"));return{view:"repo-diff",path:u,...l.length>0?{layers:l}:{},...m.length>0?{files:m}:{},...p?{sessionId:p}:{},...b?{agentId:b}:{},...E?{include:E}:{}}}}if(n[0]==="search"){const u=us(n[1]),l=t.searchParams.get("hit")?.trim()||void 0,m=ts(t.searchParams);return{view:"search",...u&&u!=="knowledge"?{mode:u}:{},...l?{hitId:l}:{},...ss(m)?{filters:m}:{}}}if(n[0]==="channels"&&n[1])return o({view:"messages",conversationId:decodeURIComponent(n[1])});if(n[0]==="channels")return o({view:"messages"});if(n[0]==="mesh")return o({view:"mesh"});if(n[0]==="mesh-ops")return o({view:"mesh-ops",...n[1]?{itemId:decodeURIComponent(n[1])}:{}});if(n[0]==="dispatch"||n[0]==="broker"){const u=t.searchParams.get("attempt")?.trim()||void 0,l=cs(t.searchParams.get("filter"));return{view:"broker",...u?{attemptId:u}:{},...l&&l!=="all"?{filter:l}:{}}}if(n[0]==="code"){const u=t.searchParams.get("wt")?.trim()||void 0,l=t.searchParams.get("fromConversation")?.trim()||void 0,m=Te(t.searchParams.get("line")),p=Te(t.searchParams.get("endLine")),b=m&&p&&p>=m?p:void 0;if(n[1]){const C=decodeURIComponent(n[1]),P=n.length>2?n.slice(2).map(decodeURIComponent).join("/"):void 0;return{view:"code",project:C,...P?{path:P}:{},...u?{wt:u}:{},...m?{line:m}:{},...b?{endLine:b}:{},...l?{returnConversationId:l}:{}}}const E=t.searchParams.get("root")?.trim()||void 0,I=t.searchParams.get("file")?.trim()||void 0;return{view:"code",...E?{root:E}:{},...I?{file:I}:{},...u?{wt:u}:{},...m?{line:m}:{},...b?{endLine:b}:{},...l?{returnConversationId:l}:{}}}if(n[0]==="briefings"&&n[1])return{view:"briefings",briefingId:decodeURIComponent(n[1])};if(n[0]==="briefings")return{view:"briefings"};if(n[0]==="activity")return o({view:"activity"});if(n[0]==="voice")return{view:"voice"};if(n[0]==="work"&&n[1])return o({view:"work",workId:decodeURIComponent(n[1])});if(n[0]==="follow"){const u=ds(t.searchParams.get("view")),l={view:"follow",...u?{preferredView:u}:{}},m=n[1],p=n[2]?decodeURIComponent(n[2]):"";m==="flight"&&p&&(l.flightId=p),m==="invocation"&&p&&(l.invocationId=p),m==="conversation"&&p&&(l.conversationId=p),m==="work"&&p&&(l.workId=p),m==="session"&&p&&(l.sessionId=p),m==="agent"&&p&&(l.targetAgentId=p);const b=t.searchParams.get("flightId"),E=t.searchParams.get("invocationId"),I=t.searchParams.get("conversationId"),C=t.searchParams.get("workId"),P=t.searchParams.get("sessionId"),Le=t.searchParams.get("targetAgentId");return b&&(l.flightId=b),E&&(l.invocationId=E),I&&(l.conversationId=I),C&&(l.workId=C),P&&(l.sessionId=P),Le&&(l.targetAgentId=Le),o(l)}if(n[0]==="settings"){if(n[1]==="agents")return{view:"settings",section:"agents",...n[2]?{agentId:decodeURIComponent(n[2])}:{}};const u=ls(n[1]);return{view:"settings",...u?{section:u}:{}}}if(n[0]==="terminal"){const u=fs(t.searchParams.get("mode")),l=t.searchParams.get("session")?.trim()||void 0,m=Ht(t.searchParams.get("surface"))??void 0;if(n[1]==="new"){const b=ms(t.searchParams.get("backend"))??"pty",E=ps(t.searchParams.get("agent"))??"shell",I=t.searchParams.get("name")?.trim()||void 0,C=t.searchParams.get("tab")?.trim()||void 0,P=t.searchParams.get("socketDir")?.trim()||void 0;return{view:"terminal",terminalBackend:b,terminalAgent:E,...I?{terminalSessionName:I}:{},...C?{terminalTabId:C}:{},...P?{zellijSocketDir:P}:{}}}const p=n[1]==="s"&&n[2]?Be(decodeURIComponent(n.slice(2).join("/")))?decodeURIComponent(n.slice(2).join("/")):null:Vt(n[1]?decodeURIComponent(n[1]):void 0,n[2]?decodeURIComponent(n.slice(2).join("/")):void 0);return p?{view:"terminal",terminalSurfaceKey:p,...l?{terminalSessionId:l}:{},...u?{mode:u}:{}}:{view:"terminal",...n[1]?{agentId:decodeURIComponent(n[1])}:{},...u?{mode:u}:{},...!n[1]&&l?{terminalSessionId:l}:{},...!n[1]&&m?{terminalSurfaceKey:m}:{}}}if(n[0]==="ops"){const u=is(n[1])??"mission";if(!At(u)&&!hs(t))return o({view:"inbox"});const l=u==="tail"?t.searchParams.get("q")?.trim():"",m=u==="advisor"?t.searchParams.get("plan")?.trim():"",p=t.searchParams.get("flightId")?.trim(),b=t.searchParams.get("invocationId")?.trim(),E=t.searchParams.get("conversationId")?.trim(),I=t.searchParams.get("workId")?.trim(),C=t.searchParams.get("sessionId")?.trim(),P=t.searchParams.get("targetAgentId")?.trim()??t.searchParams.get("agentId")?.trim();return{view:"ops",mode:u,...l?{tailQuery:l}:{},...m?{planDocumentId:m}:{},...p?{flightId:p}:{},...b?{invocationId:b}:{},...E?{conversationId:E}:{},...I?{workId:I}:{},...C?{sessionId:C}:{},...P?{targetAgentId:P}:{}}}return o({view:"inbox"})}function kt(e,t){const n=e.view==="sessions"&&e.flightId?null:St(e,t);if(n)return n;switch(e.view){case"inbox":return O("/",e);case"conversation":{const s=new URLSearchParams;return k(s,e),`/c/${encodeURIComponent(e.conversationId)}${v(s)}`}case"agent-info":return`/agent/${encodeURIComponent(e.conversationId)}`;case"agents-v2":{const s=new URLSearchParams;e.harness&&s.set("harness",e.harness),e.node&&s.set("node",e.node),e.set&&s.set("set",e.set),!e.projectSlug&&e.indexView&&e.indexView!=="agents"&&s.set("view",e.indexView),e.stateFilter&&s.set("state",e.stateFilter),e.showEphemeral&&s.set("ephemeral","1"),e.selectedAgentId&&!e.agentId&&!e.sessionId&&s.set("select",e.selectedAgentId);const o=e.conversationId?"message":"profile";e.agentId&&e.tab&&e.tab!==o&&s.set("tab",e.tab),k(s,e);const r=e.projectSlug?`/projects/${encodeURIComponent(e.projectSlug)}`:null;return`${r?e.agentId?e.conversationId?`${r}/agents/${encodeURIComponent(e.agentId)}/c/${encodeURIComponent(e.conversationId)}`:e.sessionId?`${r}/agents/${encodeURIComponent(e.agentId)}/sessions/${encodeURIComponent(e.sessionId)}`:`${r}/agents/${encodeURIComponent(e.agentId)}`:e.sessionId?`${r}/sessions/${encodeURIComponent(e.sessionId)}`:e.indexView==="sessions"?`${r}/sessions`:e.indexView==="agents"?`${r}/agents`:r:e.agentId?e.conversationId?`/agents/${encodeURIComponent(e.agentId)}/c/${encodeURIComponent(e.conversationId)}`:e.sessionId?`/agents/${encodeURIComponent(e.agentId)}/sessions/${encodeURIComponent(e.sessionId)}`:`/agents/${encodeURIComponent(e.agentId)}`:e.sessionId?`/sessions/${encodeURIComponent(e.sessionId)}`:"/projects"}${v(s)}`}case"messages":{const s=new URLSearchParams;return e.agentId&&e.threadId&&s.set("thread",e.threadId),k(s,e),`${e.agentId?`/messages/agent/${encodeURIComponent(e.agentId)}`:e.conversationId?`/messages/${encodeURIComponent(e.conversationId)}`:"/messages"}${v(s)}`}case"sessions":{const s=new URLSearchParams;return e.agentId&&s.set("agentId",e.agentId),e.flightId?(e.sessionId&&s.set("session",e.sessionId),e.compareSessionId&&s.set("compare",e.compareSessionId),k(s,e),`/flights/${encodeURIComponent(e.flightId)}/observe${v(s)}`):(k(s,e),`${e.sessionId?`/sessions/${encodeURIComponent(e.sessionId)}`:"/sessions"}${v(s)}`)}case"repos":{const s=new URLSearchParams;return e.root&&s.set("root",e.root),k(s,e),`/repos${v(s)}`}case"harnesses":return O("/providers",e);case"repo-diff":{const s=new URLSearchParams;s.set("path",e.path);for(const o of e.layers??[])s.append("layer",o);for(const o of e.files??[])s.append("file",o);return e.sessionId&&s.set("sessionId",e.sessionId),e.agentId&&s.set("agentId",e.agentId),e.include&&s.set("include",e.include),`/repo-diff${v(s)}`}case"search":{const s=e.mode==="indexer"?"/search/indexer":"/search",o=e.filters?ns(e.filters,{hitId:e.hitId??null}):new URLSearchParams;return!e.filters&&e.hitId&&o.set("hit",e.hitId),`${s}${v(o)}`}case"mesh":return O("/mesh",e);case"mesh-ops":return O(e.itemId?`/mesh-ops/${encodeURIComponent(e.itemId)}`:"/mesh-ops",e);case"broker":{const s=new URLSearchParams;return e.attemptId&&s.set("attempt",e.attemptId),e.filter&&e.filter!=="all"&&s.set("filter",e.filter),`/dispatch${v(s)}`}case"code":{const s=new URLSearchParams;if(e.wt&&s.set("wt",e.wt),e.line&&s.set("line",String(e.line)),e.line&&e.endLine&&e.endLine>=e.line&&s.set("endLine",String(e.endLine)),e.project){e.returnConversationId&&s.set("fromConversation",e.returnConversationId);const r=[encodeURIComponent(e.project)];return e.path&&r.push(...e.path.split("/").map(encodeURIComponent)),`${`/code/${r.join("/")}`}${v(s)}`}e.root&&s.set("root",e.root),e.file&&s.set("file",e.file),e.returnConversationId&&s.set("fromConversation",e.returnConversationId);const o=s.toString();return o?`/code?${o}`:"/code"}case"briefings":return e.briefingId?`/briefings/${encodeURIComponent(e.briefingId)}`:"/briefings";case"activity":return O("/activity",e);case"voice":return"/voice";case"work":return O(`/work/${encodeURIComponent(e.workId)}`,e);case"settings":return e.section==="agents"?e.agentId?`/settings/agents/${encodeURIComponent(e.agentId)}`:"/settings/agents":e.section?e.section==="pairing"?"/settings/pairing":e.section==="comms"?"/settings/comms":`/settings/${e.section}`:"/settings";case"ops":if(!e.mode)return"/ops";if(e.mode==="tail"||e.mode==="advisor"){const s=new URLSearchParams;return e.mode==="tail"&&e.tailQuery&&s.set("q",e.tailQuery),e.mode==="advisor"&&e.planDocumentId&&s.set("plan",e.planDocumentId),e.flightId&&s.set("flightId",e.flightId),e.invocationId&&s.set("invocationId",e.invocationId),e.conversationId&&s.set("conversationId",e.conversationId),e.workId&&s.set("workId",e.workId),e.sessionId&&s.set("sessionId",e.sessionId),e.targetAgentId&&s.set("targetAgentId",e.targetAgentId),`/ops/${Oe(e.mode)}${v(s)}`}return`/ops/${Oe(e.mode)}`;case"follow":{const s=new URLSearchParams;e.preferredView&&s.set("view",e.preferredView),e.flightId&&s.set("flightId",e.flightId),e.invocationId&&s.set("invocationId",e.invocationId),e.conversationId&&s.set("conversationId",e.conversationId),e.workId&&s.set("workId",e.workId),e.sessionId&&s.set("sessionId",e.sessionId),e.targetAgentId&&s.set("targetAgentId",e.targetAgentId),e.machineId&&s.set(ve,e.machineId);const o=s.toString();return`/follow${o?`?${o}`:""}`}case"terminal":if(e.agentId){const s=new URLSearchParams;return e.mode&&s.set("mode",e.mode),`/terminal/${encodeURIComponent(e.agentId)}${v(s)}`}{const s=new URLSearchParams;if(e.terminalBackend)return e.terminalBackend!=="pty"&&s.set("backend",e.terminalBackend),e.terminalAgent&&e.terminalAgent!=="shell"&&s.set("agent",e.terminalAgent),e.terminalSessionName&&s.set("name",e.terminalSessionName),e.terminalTabId&&s.set("tab",e.terminalTabId),e.zellijSocketDir&&s.set("socketDir",e.zellijSocketDir),`/terminal/new${v(s)}`;e.mode&&s.set("mode",e.mode);const o=Yt(e.terminalSurfaceKey);return o?`/terminal/${encodeURIComponent(o.backend)}/${encodeURIComponent(o.sessionName)}${v(s)}`:Be(e.terminalSurfaceKey)?`/terminal/s/${encodeURIComponent(e.terminalSurfaceKey)}${v(s)}`:(e.terminalSessionId&&s.set("session",e.terminalSessionId),e.terminalSurfaceKey&&s.set("surface",e.terminalSurfaceKey),`/terminal${v(s)}`)}}}function N(e){const t=ys(e);switch(e.view){case"conversation":return`conv:${e.conversationId}${t}`;case"agent-info":return`agent-info:${e.conversationId}`;case"settings":return`settings:${e.section??"pairing"}:${e.agentId??""}`;case"agents-v2":return["agents-v2",e.projectSlug??"",e.harness??"",e.node??"",e.set??"",e.indexView??"agents",e.stateFilter??"",e.showEphemeral?"eph":"",e.agentId??"",e.sessionId??"",t].join(":");case"sessions":return e.flightId?`flight-observe:${e.flightId}:${e.sessionId??""}:${e.compareSessionId??""}${t}`:e.sessionId?`session:${e.agentId??""}:${e.sessionId}${t}`:`sessions${t}`;case"messages":return["messages",e.conversationId??"",e.agentId??"",e.threadId??"",t].join(":");case"work":return`work:${e.workId}${t}`;case"ops":return`ops:${e.mode??"advisor"}:${e.tailQuery??""}:${e.planDocumentId??""}:${e.flightId??""}:${e.invocationId??""}:${e.workId??""}:${e.conversationId??""}:${e.sessionId??""}:${e.targetAgentId??""}`;case"search":return`search:${e.mode??"knowledge"}:${e.hitId??""}`;case"broker":return`broker:${e.attemptId??""}`;case"follow":return`follow:${e.flightId??e.invocationId??e.conversationId??e.workId??e.sessionId??e.targetAgentId??""}:${e.preferredView??""}${t}`;case"terminal":return`terminal:${e.agentId??""}:${e.terminalSessionId??""}:${e.terminalSurfaceKey??""}:${e.terminalBackend??""}:${e.terminalAgent??""}:${e.terminalSessionName??""}:${e.terminalTabId??""}:${e.mode??"detail"}`;case"repo-diff":return`repo-diff:${e.path}`;default:return`${e.view}${t}`}}function G(e,t){return ue(Ut(`${e}${t}`))}function Ft(e){return e?`#${e}`:""}function Es(e){return e.startsWith("/embed/")||e==="/ops/lanes/embed"}function xe(){if(typeof window>"u"){const e=new URL(Ct);return{pathname:e.pathname,searchStr:e.search,hash:e.hash.replace(/^#/,""),state:null}}return{pathname:window.location.pathname,searchStr:window.location.search,hash:window.location.hash.replace(/^#/,""),state:window.history.state}}function $s(e,t){return e.pathname===t.pathname&&e.searchStr===t.searchStr&&e.hash===t.hash&&Object.is(e.state,t.state)}function Rs(e){let t=e.read();const n=new Set;let s=null;const o=()=>{const r=e.read();if(!$s(t,r)){t=r;for(const i of n)i()}};return{getSnapshot:()=>t,subscribe(r){return s||(s=e.observe(o)),n.add(r),()=>{n.delete(r)}},navigateTo(r,i={}){const a=t.pathname,c=i.state===void 0?t.state:i.state;i.replace?e.replace(r,c):e.push(r,c),o(),t.pathname!==a&&Gt(a,t.pathname)}}}function Ps(){return typeof window>"u"?{read:xe,push:()=>{},replace:()=>{},observe:()=>()=>{}}:{read:xe,push:(e,t)=>window.history.pushState(t,"",e),replace:(e,t)=>window.history.replaceState(t,"",e),observe:e=>(window.addEventListener("popstate",e),window.addEventListener("hashchange",e),()=>{window.removeEventListener("popstate",e),window.removeEventListener("hashchange",e)})}}const x=Rs(Ps());function Cs(){return L.useSyncExternalStore(x.subscribe,x.getSnapshot,x.getSnapshot)}function ie(e,t={}){x.navigateTo(e,t)}function Tt(){return typeof window>"u"?null:window.navigation??null}function Ot(){if(typeof window>"u")return!1;const e=Tt();return e?e.canGoBack:window.history.length>1}function As(){if(!Ot())return;const e=Tt();if(e){e.back();return}window.history.back()}function Uo(e){if(!e||typeof e!="object")return null;const t=e.returnTo;return!t||typeof t!="object"||typeof t.view!="string"?null:t}function ko(e){return!e||typeof e!="object"?!1:e.returnUseHistory===!0}function je(e){if(!e||typeof e!="object")return e;const{returnTo:t,returnUseHistory:n,settingsEntry:s,...o}=e;return o}function _s(e,t){if(t.returnTo!==void 0){const n=t.state!==void 0?t.state:je(e),s=n&&typeof n=="object"?{...n}:{};return s.returnTo=t.returnTo,s.returnUseHistory=t.replace!==!0,s}return t.state!==void 0?t.state:t.replace?e:je(e)}function Dt(e){return e?e.replace(/^#/,""):""}function Us(e,t,n={}){const s=G(e.pathname,e.searchStr),o=Ls(t,s),r=n.preserveSearch===!1?"":e.searchStr,i=vt(kt(o,e.pathname),r),a=Dt(n.hash);return{route:o,href:`${i}${a?`#${a}`:""}`}}function ks(e,t){const n=new URLSearchParams(e.searchStr);for(const[r,i]of Object.entries(t.searchPatch??{}))i===null?n.delete(r):n.set(r,i);const s=n.toString(),o=t.hash===void 0?e.hash:Dt(t.hash);return`${e.pathname}${s?`?${s}`:""}${o?`#${o}`:""}`}function Fo(e){const t=x.getSnapshot(),n=ks(t,e),s=`${t.pathname}${t.searchStr}${Ft(t.hash)}`;n!==s&&ie(n,{replace:e.replace??!0,state:e.state})}function Fs(e,t,n){if(Es(e))return null;const s=`${e}${t}`,o=Ut(s),r=ue(o),i=vt(kt(r,e),t);return!(N(o)!==N(r)||r.view==="agents-v2"||s!==i)||s===i?null:`${i}${Ft(n)}`}function To(){const{pathname:e,searchStr:t,hash:n}=Cs(),s=`${e}${t}`,o=L.useMemo(()=>G(e,t),[e,t]),r=L.useRef({}),i=L.useRef(s);L.useEffect(()=>{const f=Fs(e,t,n);f&&ie(f,{replace:!0})},[e,t,n]),L.useEffect(()=>{if(i.current===s)return;const f=G(e,t);requestAnimationFrame(()=>{window.scrollTo(0,r.current[N(f)]??0)}),i.current=s},[s,e,t]);const a=L.useCallback((f,S={})=>{const A=ue(f.view==="ops"&&!rt()&&!At(f.mode)?{view:"inbox"}:f),g=G(e,t),{route:w,href:R}=Us({pathname:e,searchStr:t},A,S);r.current[N(g)]=window.scrollY;const U=x.getSnapshot().state,_=_s(U,S);ie(R,{replace:S.replace,state:_}),requestAnimationFrame(()=>{window.scrollTo(0,r.current[N(w)]??0)})},[e,t]),c=L.useCallback(()=>As(),[]),d=Ot();return{route:o,navigate:a,navigateBack:c,canNavigateBack:d}}export{qs as $,Po as A,$o as B,Eo as C,Pt as D,go as E,js as F,Gn as G,ge as H,F as I,po as J,fo as K,wo as L,ho as M,Co as N,yo as O,Ao as P,Fo as Q,io as R,fn as S,It as T,wt as U,uo as V,Qs as W,Vs as X,Xs as Y,An as Z,_n as _,kt as a,Pn as a0,eo as a1,Un as a2,no as a3,so as a4,to as a5,oo as a6,Zs as a7,Js as a8,Ys as a9,So as aA,$t as aB,bo as aC,re as aD,vo as aE,Io as aF,Et as aG,it as aa,at as ab,Se as ac,ro as ad,ao as ae,V as af,ne as ag,Bs as ah,oe as ai,Q as aj,Dn as ak,Bn as al,xn as am,vt as an,zn as ao,un as ap,co as aq,St as ar,Ye as as,lo as at,To as au,Ve as av,Zt as aw,bt as ax,z as ay,mo as az,bs as b,_o as c,et as d,Ws as e,le as f,zs as g,Ms as h,Gs as i,Hs as j,Cs as k,Uo as l,ko as m,dn as n,mn as o,pn as p,Ks as q,Ut as r,De as s,ns as t,Ns as u,Ro as v,wn as w,ts as x,Lo as y,ss as z};
@@ -0,0 +1 @@
1
+ import{r,j as t,L as Ce}from"./index-C1VaWNuD.js";import{g as ke,e as Ne,s as Me,a as de,f as Re}from"./scout-voice-Cg1qfepC.js";import{createLevelHistory as Ee,energyFromPartialDelta as me,tryStartMicLevelMeter as Le,VOICE_WAVE_BARS as pe}from"./voice-levels-Dcr3jglk.js";import{L as Ve}from"./loader-circle-DmUG_YC7.js";import{c as he}from"./createLucideIcon-Dv8H8m7J.js";function Xe(e){if(!e)return null;const s=e.replace(/_/g," ");return s.toLowerCase()==="relay agent"?"agent":s}const Ae=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],Be=he("mic",Ae);const _e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Pe=he("square",_e);function Te(e,s=!1){return e.key==="Enter"&&!e.shiftKey&&(s||!!(e.metaKey||e.ctrlKey))&&!e.nativeEvent?.isComposing}function De(e){switch(e){case"starting":return"starting";case"recording":return"recording";case"processing":return"processing";default:return"idle"}}function qe(e,s,l){if(l)return l;switch(e){case"starting":return"Starting voice…";case"recording":return s.trim()?s.trim():null;case"processing":return"Transcribing…";default:return null}}function fe(e){return new Promise(s=>window.setTimeout(s,e))}function Fe({onAppend:e,onError:s,onStatus:l,disabled:L,className:m}){const p=r.useRef(ke()),u=r.useRef(null),h=r.useRef(Ee(pe)),K=r.useRef(null),C=r.useRef(!1),S=r.useRef(""),T=r.useRef(0),b=r.useRef(0),[v,k]=r.useState("idle"),[G,_]=r.useState(""),[J,D]=r.useState("probing"),[se,q]=r.useState(null),[R,V]=r.useState(null),[P,W]=r.useState(null),[Q,y]=r.useState(0),N=r.useCallback(()=>{b.current&&(window.cancelAnimationFrame(b.current),b.current=0),K.current?.stop(),K.current=null,C.current=!1},[]),j=r.useCallback(n=>{W(n),s?.(n)},[s]),X=r.useCallback((n,i,o)=>{l?.({state:n,partial:i,message:qe(n,i,o),tone:o?"error":n==="recording"?"recording":n==="processing"?"processing":"neutral",levels:n==="idle"&&!o?[]:h.current.snapshot(),levelsLive:C.current})},[l]);r.useEffect(()=>{X(v,G,P)},[X,P,G,v,Q]);const A=r.useCallback(async(n=!1)=>{const i=p.current;D(x=>x==="launching"?x:"probing");const o=await i.probe(n?{force:!0}:void 0);return q(o),V(null),D("idle"),o},[]);r.useEffect(()=>{Ne();const n=p.current,i=Me(o=>{q(o.ok),V(null),D("idle")});return n.connectionState==="unknown"?A():(q(n.connectionState==="connected"),V(null),D("idle")),()=>{i(),N();const o=u.current;o&&(o.cancel().catch(()=>{}),u.current=null)}},[A,N]);const B=r.useCallback(n=>{h.current.push(n),y(i=>i+1)},[]),Z=r.useCallback(()=>{if(b.current)return;let n=performance.now();const i=o=>{if(o-n>=36){n=o;const x=o-(T.current||o),w=me(S.current,S.current,x);h.current.push(Math.max(.05,w)),y(c=>c+1)}b.current=window.requestAnimationFrame(i)};b.current=window.requestAnimationFrame(i)},[]),ee=r.useCallback(async()=>{const n=p.current;W(null),_(""),S.current="",T.current=performance.now(),h.current.clear(),y(c=>c+1),k("starting"),N();let i=await de({surface:"chat-composer",requestPermissions:!0});if(!i.ready&&i.issue?.code==="microphone_not_requested"&&(await fe(1800),i=await de({surface:"chat-composer"})),!(i.ready||i.issue?.code==="microphone_not_requested")){k("idle");const c=i.issue;c?(V(c),j(Re(c))):j("Scout voice is not ready."),A(!0);return}V(null),q(!0);let x=null,w=!1;try{if(x=await n.startLive({onState:g=>k(De(g)),onPartial:g=>{const U=S.current;if(S.current=g,T.current=performance.now(),_(g),!C.current){const ce=me(U,g,0);B(ce)}},onLevel:g=>{w=!0,C.current=!0,b.current&&(window.cancelAnimationFrame(b.current),b.current=0),B(g)}}),u.current=x,k("recording"),await fe(140),u.current&&!w&&!C.current){const g=await Le(U=>{w=!0,C.current=!0,b.current&&(window.cancelAnimationFrame(b.current),b.current=0),B(U)});g&&u.current?K.current=g:u.current&&!C.current&&(C.current=!1,Z())}const c=await x.result;u.current=null,N(),k("idle");const $=S.current.trim();_(""),S.current="",W(null),h.current.clear(),y(g=>g+1);const E=c.text?.trim()||$;E?e(E):j("No speech was detected. Check your microphone in Settings → Voice."),A(!0)}catch(c){u.current=null,N(),k("idle");const $=S.current.trim();_(""),S.current="",h.current.clear(),y(g=>g+1);const E=c instanceof Error?c.message:"Scout voice recording failed.";if($){e($),c instanceof Error&&c.name==="AbortError"||j(`Recording ended early, but Scout recovered the partial transcript. ${E}`);return}if(c instanceof Error&&c.name==="AbortError")return;j(E),A(!0)}},[e,A,B,j,Z,N]),te=r.useCallback(async()=>{const n=u.current;if(!n)return;k("processing"),N();const i=window.setInterval(()=>{h.current.decay(.82),y(o=>o+1)},50);window.setTimeout(()=>window.clearInterval(i),600);try{await n.stop()}catch(o){try{await n.cancel()}catch{}u.current=null,k("idle");const x=S.current.trim();_(""),S.current="",h.current.clear(),y(c=>c+1);const w=o instanceof Error?o.message:"Scout voice recording did not finish.";x?(e(x),j(`Recording ended early, but Scout recovered the partial transcript. ${w}`)):j(w)}},[e,j,N]),ne=r.useCallback(()=>{if(v==="recording"){te();return}v==="processing"||v==="starting"||ee()},[v,ee,te]),f=v==="recording",M=J==="launching"||v==="starting"||v==="processing",z=(p.current.canRequestMicrophone||R?.action==="request_microphone"||R?.action==="request_speech")&&!f&&!M,O=(p.current.isMicrophoneHardDenied||R?.action==="open_microphone_settings")&&!f&&!M,F=(se===!1||R!==null)&&!z&&!O&&!f&&!M,I=P||(R?R.title:O?"Microphone blocked. Open Privacy & Security → Microphone to change it.":z?"Allow microphone access":F?"Scout voice is not ready":J==="probing"?"Checking voice…":f?"Stop recording":v==="processing"?"Transcribing…":v==="starting"?"Starting voice…":"Start recording"),oe=P?"s-dictation-mic--error":f?"s-dictation-mic--recording":O?"s-dictation-mic--error":z?"s-dictation-mic--needs-permission":F?"s-dictation-mic--unavailable":M?"s-dictation-mic--busy":"",H=M?Ve:f?Pe:Be,d=f?12:14;return t.jsx("button",{type:"button",title:I,"aria-label":I,"aria-pressed":f,onClick:ne,disabled:L||v==="processing",className:["s-dictation-mic",oe,m].filter(Boolean).join(" "),children:t.jsx(H,{size:d,className:M?"s-dictation-mic-spin":f?"fill-current":""})})}function Ie({samples:e,active:s,processing:l=!1,className:L}){const m=$e(e,pe,l?.06:.04),p=["s-msg-compose-wave",s?"s-msg-compose-wave--live":"",l?"s-msg-compose-wave--processing":"",L??""].filter(Boolean).join(" ");return t.jsx("div",{className:p,"aria-hidden":"true","data-wave-source":e&&e.length>0?"levels":"floor",children:m.map((u,h)=>t.jsx("span",{className:"s-msg-compose-wave-bar",style:{transform:`scaleY(${Math.max(.08,u)})`,opacity:l?.28+u*.35:s?.4+u*.55:.25}},h))})}function $e(e,s,l){if(!e||e.length===0)return Array.from({length:s},()=>l);if(e.length===s)return e.map(m=>Math.max(l,Math.min(1,m)));const L=new Array(s);for(let m=0;m<s;m+=1){const p=Math.min(e.length-1,Math.round(m/Math.max(1,s-1)*(e.length-1)));L[m]=Math.max(l,Math.min(1,e[p]??l))}return L}function Ke(){return t.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("path",{d:"M12 19V5"}),t.jsx("path",{d:"m5 12 7-7 7 7"})]})}function We(){return t.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:t.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})}function ze(){return t.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t.jsx("path",{d:"M21.44 11.05 12.05 20.44a5.5 5.5 0 0 1-7.78-7.78l9.19-9.19a3.5 3.5 0 0 1 4.95 4.95l-9.2 9.19a1.5 1.5 0 0 1-2.12-2.12l8.49-8.48"})})}function ge(e,s){e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,s)}px`}function Oe(e){return e.tone==="error"?"Voice":e.state==="recording"?"Listening":e.state==="processing"?"Transcribing":e.state==="starting"?"Starting":"Voice"}function Ze({renderWhenEmbedded:e=!1,...s}){return Ce()&&!e?null:t.jsx(He,{...s})}function He({value:e,onChange:s,onSend:l,placeholder:L="Type a message…",disabled:m=!1,sending:p=!1,canSend:u,stopMode:h=!1,onStop:K,sendTitle:C="Send (Cmd+Enter)",sendAriaLabel:S="Send message (Cmd+Enter)",stopAriaLabel:T="Stop agent",showDictation:b=!0,onDictationStatusChange:v,showAttach:k=!1,onAttach:G,attachTitle:_="Add attachment",attachAriaLabel:J="Add attachment",onPaste:D,dropHandlers:se,dragActive:q=!1,secondaryAction:R,leadingTools:V,tools:P,footer:W,header:Q,above:y,aboveAttached:N=!1,input:j,overlay:X,status:A,textareaRef:B,onKeyDown:Z,sendOnEnter:ee=!1,onSelect:te,onBlur:ne,density:f="panel",as:M="form",className:z,rows:O=1,autoResize:F=!0,maxHeightPx:I=160,"aria-label":oe="Message"}){const H=r.useRef(null),[d,n]=r.useState(null),i=r.useCallback(a=>{H.current=a,B&&(B.current=a)},[B]);r.useEffect(()=>{if(!F)return;const a=H.current;a&&ge(a,I)},[e,F,I]);const o=(u??e.trim().length>0)&&!p&&!m,x=P??W,w=d?.state==="recording"||d?.state==="starting",c=d?.state==="processing",$=!!(d&&(d.tone==="error"||w||c||d.partial&&d.partial.trim())),E=r.useCallback(()=>{h||!(u??e.trim().length>0)||p||m||l()},[u,m,l,p,h,e]),g=a=>{a.preventDefault(),E()},U=a=>{if(Z?.(a)){a.preventDefault();return}if(Te(a,ee)){a.preventDefault(),E();return}},ce=a=>{const Y=a.target.value;s(Y,{caret:a.target.selectionStart??Y.length}),F&&ge(a.target,I)},ve=a=>{const Y=e.trim()?`${e.trimEnd()} ${a}`:a;s(Y,{caret:Y.length}),requestAnimationFrame(()=>H.current?.focus())},be=r.useCallback(a=>{n(a),v?.(a)},[v]),ie=["s-msg-compose",`s-msg-compose--${f}`,f==="thread"?"s-thread-compose":"",z??""].filter(Boolean).join(" "),xe=["s-msg-compose-shell",f==="thread"?"s-thread-compose-shell":""].filter(Boolean).join(" "),Se=["s-msg-compose-input",f==="thread"?"s-thread-compose-input":""].filter(Boolean).join(" "),ae=["s-msg-compose-send",f==="thread"?"s-thread-compose-send":"",h?"s-msg-compose-send--agent-stop s-thread-compose-send--stop":""].filter(Boolean).join(" "),we=["s-msg-compose-voice",d?.tone==="recording"||w?"s-msg-compose-voice--recording":"",d?.tone==="processing"||c?"s-msg-compose-voice--processing":"",d?.tone==="error"?"s-msg-compose-voice--error":""].filter(Boolean).join(" "),re=d?.tone==="error",ye=d?.partial?.trim()||null,le=re?d?.message:c?"Finalizing transcript…":ye,je=t.jsxs("div",{className:xe,"data-drag-active":q?"true":void 0,...se,children:[Q?t.jsx("div",{className:"s-msg-compose-header",children:Q}):null,t.jsxs("div",{className:"s-msg-compose-body",children:[j??t.jsx("textarea",{ref:i,className:Se,placeholder:L,value:e,disabled:m,rows:O,"aria-label":oe,onChange:ce,onKeyDown:U,onSelect:te,onBlur:ne,onPaste:D}),$?t.jsxs("div",{className:we,role:re?"alert":"status","aria-live":re?"assertive":"polite",children:[!re&&(w||c)?t.jsx(Ie,{samples:d?.levels,active:w,processing:c}):null,t.jsxs("div",{className:"s-msg-compose-voice-meta",children:[t.jsx("span",{className:"s-msg-compose-voice-label",children:d?Oe(d):"Voice"}),le?t.jsx("span",{className:"s-msg-compose-voice-text",children:le}):null]})]}):null]}),t.jsxs("div",{className:["s-msg-compose-toolbar",f==="thread"?"s-thread-compose-footer":""].filter(Boolean).join(" "),children:[t.jsxs("div",{className:"s-msg-compose-toolbar-start",children:[V,k?t.jsx("button",{type:"button",className:"s-msg-compose-icon-btn",title:_,"aria-label":J,disabled:m||p,onClick:G,children:t.jsx(ze,{})}):V?null:t.jsx("span",{className:"s-msg-compose-toolbar-spacer","aria-hidden":"true"})]}),t.jsxs("div",{className:"s-msg-compose-toolbar-end",children:[x?t.jsx("div",{className:"s-msg-compose-tools",children:x}):null,b?t.jsx(Fe,{onAppend:ve,onStatus:be,disabled:m||p}):null,R?t.jsx("div",{className:"s-msg-compose-secondary",children:R}):null,h?t.jsx("button",{type:"button",className:ae,onClick:K,title:T,"aria-label":T,children:t.jsx(We,{})}):t.jsx("button",{type:M==="form"?"submit":"button",className:ae,disabled:!o,title:C,"aria-label":S,"data-action":"send",onClick:M==="div"?()=>E():void 0,children:t.jsx(Ke,{})})]})]}),A]}),ue=t.jsxs("div",{className:"s-msg-compose-frame","data-above-attached":y&&N?"true":void 0,children:[X,y?t.jsx("div",{className:"s-msg-compose-above",children:y}):null,je]});return M==="div"?t.jsx("div",{className:ie,children:ue}):t.jsx("form",{className:ie,onSubmit:g,children:ue})}export{Fe as D,Ze as M,Pe as S,Be as a,Xe as f,Te as i};
@@ -1 +1 @@
1
- import{A as a,B as l,D as n,E as r,r as m}from"./index-DvLtl7rV.js";import{R as p,T as i,U as c,k as E,V as S}from"./router-B9vQkNJL.js";const A={path:l(n.lanes),bundle:`?ffBundle=${a}`,deploy:`OPENSCOUT_WEB_FLAG_BUNDLE=${a}`},o=[{key:"lanes",label:"Agent Lanes",segment:n.lanes},{key:"sessions",label:"Sessions",segment:n.sessions},{key:"tail",label:"Live Activity",segment:n.tail},{key:"agents",label:"Agents",segment:n.agents}],_=o.map(e=>({key:e.key,label:e.label,route:p(e.segment)}));function b(e){const t=i(e);return o.find(s=>s.segment===t)?.key??"lanes"}function d(e){const t=i(e);return o.find(s=>s.segment===t)?.label??r}function u(){const{pathname:e}=E();return c(e)}function P(){return S(u())}function T(e){const t=u();return m.useEffect(()=>(t?document.documentElement.setAttribute("data-scope-presentation",""):document.documentElement.removeAttribute("data-scope-presentation"),()=>document.documentElement.removeAttribute("data-scope-presentation")),[t]),{active:t,brandLabel:t?d(e.route):r}}function L(){return c(typeof window<"u"?window.location.pathname:"")}export{_ as S,u as a,A as b,d as c,T as d,L as i,b as s,P as u};
1
+ import{A as a,B as l,D as n,E as r,r as m}from"./index-C1VaWNuD.js";import{R as p,T as i,U as c,k as E,V as S}from"./router-kfcaYqZr.js";const A={path:l(n.lanes),bundle:`?ffBundle=${a}`,deploy:`OPENSCOUT_WEB_FLAG_BUNDLE=${a}`},o=[{key:"lanes",label:"Agent Lanes",segment:n.lanes},{key:"sessions",label:"Sessions",segment:n.sessions},{key:"tail",label:"Live Activity",segment:n.tail},{key:"agents",label:"Agents",segment:n.agents}],_=o.map(e=>({key:e.key,label:e.label,route:p(e.segment)}));function b(e){const t=i(e);return o.find(s=>s.segment===t)?.key??"lanes"}function d(e){const t=i(e);return o.find(s=>s.segment===t)?.label??r}function u(){const{pathname:e}=E();return c(e)}function P(){return S(u())}function T(e){const t=u();return m.useEffect(()=>(t?document.documentElement.setAttribute("data-scope-presentation",""):document.documentElement.removeAttribute("data-scope-presentation"),()=>document.documentElement.removeAttribute("data-scope-presentation")),[t]),{active:t,brandLabel:t?d(e.route):r}}function L(){return c(typeof window<"u"?window.location.pathname:"")}export{_ as S,u as a,A as b,d as c,T as d,L as i,b as s,P as u};
@@ -1 +1 @@
1
- import{_ as x}from"./index-DvLtl7rV.js";import{b as k,p as A,V as q,D as N}from"./fx-z37u1o2z.js";function he(t){return t?t.hint?`${t.message} ${t.hint}`:t.message:"Scout voice is unavailable."}async function fe(t={}){const e=await fetch("/api/voice/engage",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(e.status===404)return j(t);if(!e.ok){const n=await e.text().catch(()=>"");throw new Error(y(n,e.status))}return await e.json()}async function j(t={}){const e=await de(),n=e.settings,i=e.devices,r=i.length>0||(n.permissions?.length??0)>0,o=n.permissions?.find(w=>w.kind==="microphone")??null,a=n.permissions?.find(w=>w.kind==="speechRecognition")??null,u=U(n,i);if(t.requestPermissions&&(o&&!o.granted&&o.status!=="restricted"?await C("microphone").catch(()=>{}):(o?.granted??!1)&&a&&!a.granted&&a.status!=="restricted"&&await C("speechRecognition").catch(()=>{})),!r)return{ready:!1,issue:{code:"host_offline",title:"Scout Menu is not running",message:"Launch Scout Menu on this Mac to dictate in web chat.",hint:"Restart the web server if you just updated Scout — `scout server restart` or restart `bun run server/index.ts`.",action:"launch_host"},warnings:[],settings:n,devices:i,inputDevice:null,hostOnline:!1};const h=$(o);if(h)return{ready:!1,issue:h,warnings:[],settings:n,devices:i,inputDevice:u,hostOnline:r};if(!u)return{ready:!1,issue:{code:"no_input_device",title:"No microphone detected",message:"Scout Menu did not report any audio input devices.",hint:"Plug in a microphone, check Sound settings, then refresh Settings → Voice.",action:"open_voice_settings"},warnings:[],settings:n,devices:i,inputDevice:null,hostOnline:r};const d=F(a);return{ready:!0,issue:null,warnings:d?[d]:[],settings:n,devices:i,inputDevice:u,hostOnline:r}}function U(t,e){if(e.length===0)return null;const n=t.inputDeviceId?e.find(o=>o.id===t.inputDeviceId):null,i=e.find(o=>o.isDefault)??e[0]??null,r=n??i;return r?{id:r.id,name:r.name}:null}function $(t){return!t||t.granted?null:t.canRequest?{code:"microphone_not_requested",title:"Microphone access needed",message:"Scout Menu needs microphone access before dictation can start.",hint:"Request access or tap the mic again to show the macOS prompt.",action:"request_microphone"}:{code:"microphone_denied",title:"Microphone blocked",message:"Scout Menu cannot record because microphone access is off.",hint:"Scout is opening macOS Microphone settings and will detect the change automatically.",action:"open_microphone_settings"}}function F(t){return!t||t.granted?null:t.canRequest?{code:"speech_not_requested",title:"Speech recognition needed",message:"Scout Menu needs speech recognition for live partials.",hint:"Request access to show the macOS prompt.",action:"request_speech"}:{code:"speech_denied",title:"Speech recognition blocked",message:"Speech recognition is off for Scout Menu.",hint:"Choose Retry access to reopen macOS Speech Recognition settings.",action:"open_speech_settings"}}function H(t,e){switch(e){case"microphone_permission":return"Microphone access is off for Scout Menu. Tap the mic to retry; Scout will open macOS Microphone settings.";case"empty_transcript":return"No speech was detected. Check your microphone input in Settings → Voice.";default:return t}}const G=6e4,J=3e3,z=2e4,B=8e3,W=45e3;let M=null,E=null,l=null,_=!1;const R=new Set;function X(){return typeof window>"u"?!1:typeof fetch=="function"}function K(){return M||(M=new Q),M}function me(t){return R.add(t),l&&t(l),()=>{R.delete(t)}}function we(){if(_||!X())return;_=!0;const t=K();t.probe();const e=()=>{t.probeIfStale()};window.addEventListener("focus",e),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&e()})}function I(t){for(const e of R)e(t)}function O(t,e=Date.now()){const n=t.ok?z:B;return e-t.probedAt<n}class Q{state="unknown";unavailableReason=null;captureMode=null;hostReachable=!1;microphoneGranted=null;microphoneCanRequest=null;inputDeviceName=null;get connectionState(){return this.state}get lastUnavailableReason(){return this.unavailableReason}get preferredCaptureMode(){return this.captureMode}get isVoiceHostReachable(){return this.hostReachable}get activeInputDeviceName(){return this.inputDeviceName}get isMicrophoneGranted(){return this.microphoneGranted}get canRequestMicrophone(){return this.hostReachable&&this.microphoneGranted===!1&&this.microphoneCanRequest===!0}get isMicrophoneHardDenied(){return this.hostReachable&&this.microphoneGranted===!1&&this.microphoneCanRequest===!1}get isMicrophoneDenied(){return this.isMicrophoneHardDenied}async probeIfStale(){const e=Date.now();return l&&O(l,e)?(this.applyProbeSnapshot(l),l.ok):l&&l.ok&&e-l.probedAt<W?(this.applyProbeSnapshot(l),!0):l&&!l.ok?this.probe({force:!0}):this.probe()}async probe(e={}){const n=typeof e=="number"?{timeoutMs:e}:e,i=n.force??!1,r=n.timeoutMs??J,o=Date.now();return!i&&l&&O(l,o)?(this.applyProbeSnapshot(l),l.ok):E||(this.state="probing",E=this.fetchProbe(r).finally(()=>{E=null}),E)}async fetchProbe(e){const n=new AbortController,i=window.setTimeout(()=>n.abort(),e);try{const r=await fetch("/api/voice/health?quiet=1",{signal:n.signal}),o=await r.json().catch(()=>({})),a=!!o.host?.hostId,u=typeof o.microphoneGranted=="boolean"?o.microphoneGranted:null,h=typeof o.microphoneCanRequest=="boolean"?o.microphoneCanRequest:null,d=typeof o.inputDevice?.name=="string"&&o.inputDevice.name.trim()?o.inputDevice.name.trim():null,w=o.capture==="browser"?"browser":"native",S=r.ok&&o.ok===!0,v=S?null:o.detail??o.error??(a?"Scout voice is not ready.":"Scout voice service is unavailable."),f={ok:S,reason:v,captureMode:S?w:null,hostReachable:a,microphoneGranted:u,microphoneCanRequest:h,inputDeviceName:d,probedAt:Date.now()};return l=f,this.applyProbeSnapshot(f),I(f),S}catch(r){const a={ok:!1,reason:r instanceof Error&&r.name==="AbortError"?"Scout voice service did not respond.":"Scout voice service is unavailable.",captureMode:null,hostReachable:!1,microphoneGranted:null,microphoneCanRequest:null,inputDeviceName:null,probedAt:Date.now()};return l=a,this.applyProbeSnapshot(a),I(a),!1}finally{window.clearTimeout(i)}}applyProbeSnapshot(e){if(this.hostReachable=e.hostReachable,this.microphoneGranted=e.microphoneGranted,this.microphoneCanRequest=e.microphoneCanRequest,this.inputDeviceName=e.inputDeviceName,e.ok){this.unavailableReason=null,this.captureMode=e.captureMode,this.state="connected";return}this.unavailableReason=e.reason,this.captureMode=null,this.state="unavailable"}async launch(e={}){try{const i=await(await fetch("/api/scout-services/restart-link",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({target:"all"})})).json().catch(()=>({}));if(i.url?.startsWith("scout://services/restart/")){window.location.href=i.url;return}}catch{}window.location.href="scout://hud/show"}async startLive(e={},n={}){return this.captureMode!=="browser"?await Y(e,n):await Z(e)}}async function Y(t={},e={}){t.onState?.("starting");const n=await fetch("/api/voice/session",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({clientId:"openscout-web",surface:e.surface?.trim()||"chat-composer"})});if(!n.ok){const s=await n.text().catch(()=>"");throw new Error(y(s,n.status))}const r=(await n.json()).sessionId?.trim();if(!r)throw new Error("Scout voice did not return a session id.");let o=!1,a,u;const h=new Promise((s,p)=>{a=s,u=p});let d=null;const w=()=>{d&&window.clearTimeout(d),d=window.setTimeout(()=>{v(new Error("Scout voice transcription timed out. Try again or check voice settings."))},G)},S=()=>{d&&(window.clearTimeout(d),d=null)},v=(s,p="error")=>{o||(o=!0,S(),m.close(),t.onState?.(p),u(s))},f=s=>{o||(o=!0,S(),m.close(),t.onFinal?.(s),t.onState?.("done"),a(s))},m=new EventSource(`/api/voice/session/${encodeURIComponent(r)}/events`),c=s=>p=>{if(o)return;let g={};try{g=JSON.parse(p.data)}catch{return}if(s==="session.partial"){const b=typeof g.text=="string"?g.text:"";t.onPartial?.(b);return}if(s==="session.state"){const b=ee(g.state);b&&(t.onState?.(b),b==="processing"&&w());return}if(s==="session.final"){f({sessionId:r,text:typeof g.text=="string"?g.text.trim():"",durationMs:Number(g.durationMs??0)});return}if(s==="session.cancelled"){v(T(),"cancelled");return}if(s==="session.error"){const b=typeof g.message=="string"?g.message:"Scout voice session failed.",L=typeof g.code=="string"?g.code:null;v(new Error(H(b,L)))}};return m.addEventListener("session.started",()=>{t.onState?.("starting")}),m.addEventListener("session.state",c("session.state")),m.addEventListener("session.partial",c("session.partial")),m.addEventListener("session.final",c("session.final")),m.addEventListener("session.cancelled",c("session.cancelled")),m.addEventListener("session.error",c("session.error")),m.onerror=()=>{o||v(new Error("Scout voice event stream disconnected."))},{get sessionId(){return r},result:h,stop:async()=>{t.onState?.("processing"),w();const s=await fetch(`/api/voice/session/${encodeURIComponent(r)}/stop`,{method:"POST"});if(!s.ok){const p=await s.text().catch(()=>"");throw new Error(y(p,s.status))}},cancel:async()=>{o=!0,S(),m.close();const s=await fetch(`/api/voice/session/${encodeURIComponent(r)}/cancel`,{method:"POST"});if(!s.ok){const p=await s.text().catch(()=>"");throw new Error(y(p,s.status))}t.onState?.("cancelled"),u(T())}}}async function Z(t={}){if(typeof MediaRecorder>"u"||!navigator.mediaDevices?.getUserMedia)throw new Error("Scout voice capture is unavailable in this browser.");const{startStreamLevelMeter:e}=await x(async()=>{const{startStreamLevelMeter:c}=await import("./voice-levels-Dcr3jglk.js");return{startStreamLevelMeter:c}},[]),n=ue(),i=[];let r=null,o=null,a=null,u=!1,h=!1,d,w;const S=new Promise((c,s)=>{d=c,w=s}),v=()=>{a?.stop(),a=null;for(const c of r?.getTracks()??[])c.stop();r=null},f=(c,s="error")=>{h||(h=!0,v(),t.onState?.(s),w(c))},m=async()=>{if(h)return;if(v(),u){f(T(),"cancelled");return}t.onState?.("processing");const c=o?.mimeType||V()||"application/octet-stream",s=new Blob(i,{type:c});if(s.size===0){f(new Error("No voice audio was captured."));return}try{const p=await re(s,{sessionId:n});if(h)return;h=!0,t.onFinal?.(p),t.onState?.("done"),d(p)}catch(p){f(p instanceof Error?p:new Error(String(p)))}};try{t.onState?.("starting"),r=await navigator.mediaDevices.getUserMedia({audio:!0}),t.onLevel&&(a=e(r,t.onLevel));const c=V();o=new MediaRecorder(r,c?{mimeType:c}:void 0),o.addEventListener("dataavailable",s=>{s.data.size>0&&i.push(s.data)}),o.addEventListener("error",()=>{f(new Error("Scout voice recorder failed."))}),o.addEventListener("stop",()=>{m()},{once:!0}),o.start(),t.onPartial?.(""),t.onState?.("recording")}catch(c){const s=c instanceof Error?c:new Error(String(c));throw f(s),S.catch(()=>{}),s}return{get sessionId(){return n},result:S,stop:async()=>{!o||o.state==="inactive"||o.stop()},cancel:async()=>{if(u=!0,o&&o.state!=="inactive"){o.stop();return}f(T(),"cancelled")}}}function ee(t){return t==="starting"||t==="recording"||t==="processing"||t==="done"||t==="cancelled"||t==="error"?t:null}function y(t,e){try{return JSON.parse(t).error??`Scout voice returned HTTP ${e}`}catch{return t||`Scout voice returned HTTP ${e}`}}function Se(t){return t instanceof Error&&t.name==="AbortError"}async function D(t,e={}){const n={text:t,speed:ce(e.speed)};e.modelId&&(n.modelId=e.modelId),e.voiceId&&(n.voiceId=e.voiceId),e.originAppId&&(n.originAppId=e.originAppId),e.utteranceId&&(n.utteranceId=e.utteranceId),e.instructions&&(n.instructions=e.instructions),e.speechTiming?.enabled&&(n.speechTiming=e.speechTiming);const i=await fetch("/api/voice/speak",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n),signal:e.signal});if(!i.ok){const r=await i.text().catch(()=>"");try{const o=JSON.parse(r);throw new Error(o.error??`Scout voice returned HTTP ${i.status}`)}catch(o){throw o instanceof SyntaxError?new Error(r||`Scout voice returned HTTP ${i.status}`):o}}return await i.json()}async function ge(t){const e=t?`?modelId=${encodeURIComponent(t)}`:"",n=await fetch(`/api/voice/catalog${e}`,{headers:{accept:"application/json"}});if(!n.ok)throw new Error(`Scout voice catalog returned HTTP ${n.status}`);return await n.json()}async function te(t,e={}){if(e.signal?.aborted)throw P();const n=new Audio(`data:${t.contentType};base64,${t.audioBase64}`),i=()=>{n.pause(),n.currentTime=0};e.signal?.addEventListener("abort",i,{once:!0}),await n.play(),e.onPlaybackStart?.();try{return await new Promise((r,o)=>{const a=()=>{n.removeEventListener("ended",u),n.removeEventListener("error",h),e.signal?.removeEventListener("abort",d)},u=()=>{a(),r()},h=()=>{a(),o(new Error("Scout voice playback failed."))},d=()=>{a(),o(P())};if(e.signal?.aborted){d();return}n.addEventListener("ended",u,{once:!0}),n.addEventListener("error",h,{once:!0}),e.signal?.addEventListener("abort",d,{once:!0})}),t}finally{e.signal?.removeEventListener("abort",i)}}async function ne(t,e={}){const n=await D(t,e);return await te(n,{signal:e.signal})}function ve(t,e={}){const n=new AbortController;return{promise:ne(t,{...e,signal:n.signal}),stop:()=>n.abort()}}async function oe(t,e={}){const n=await D(t,e);if(e.signal?.aborted)throw P();const i=await k(n.audioBase64,n.contentType),r=ae(e.presetId,e.params);return await A(i,{params:r,signal:e.signal}).promise,n}function ye(t,e={}){const n=new AbortController;return{promise:oe(t,{...e,signal:n.signal}),stop:()=>n.abort()}}async function re(t,e){const n=new FormData,i=ie(t.type);n.append("audio",t,`audio.${se(t.type)}`),n.append("sessionId",e.sessionId),i&&n.append("format",i);const r=await fetch("/api/voice/transcribe",{method:"POST",body:n});if(!r.ok){const a=await r.text().catch(()=>"");try{const u=JSON.parse(a);throw new Error(u.error??`Scout voice returned HTTP ${r.status}`)}catch(u){throw u instanceof SyntaxError?new Error(a||`Scout voice returned HTTP ${r.status}`):u}}const o=await r.json();return{sessionId:e.sessionId,text:o.text?.trim()??"",durationMs:Number(o.durationMs??0)}}function P(){const t=new Error("Speech stopped.");return t.name="AbortError",t}function T(){const t=new Error("Voice recording was cancelled.");return t.name="AbortError",t}function V(){return typeof MediaRecorder>"u"||typeof MediaRecorder.isTypeSupported!="function"?void 0:["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4","audio/webm","audio/wav"].find(e=>{try{return MediaRecorder.isTypeSupported(e)}catch{return!1}})}function ie(t){const e=t.toLowerCase();if(e.includes("mp3")||e.includes("mpeg"))return"mp3";if(e.includes("wav"))return"wav";if(e.includes("aac")||e.includes("mp4"))return"aac";if(e.includes("opus")||e.includes("ogg")||e.includes("webm"))return"opus"}function se(t){const e=t.toLowerCase();return e.includes("webm")?"webm":e.includes("ogg")||e.includes("opus")?"opus":e.includes("mp4")||e.includes("aac")?"m4a":e.includes("wav")?"wav":e.includes("mp3")||e.includes("mpeg")?"mp3":"audio"}function ae(t,e){const n=t?q.find(i=>i.id===t)?.params:void 0;return{...N,...n??{},...e??{}}}function ce(t){if(!(t===void 0||!Number.isFinite(t)))return Math.min(2,Math.max(.5,Number(t.toFixed(2))))}function ue(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`scout-voice:${crypto.randomUUID()}`:`scout-voice:${Date.now().toString(36)}:${Math.random().toString(36).slice(2)}`}async function de(){const t=await fetch("/api/voice/settings");if(!t.ok){const e=await t.text().catch(()=>"");throw new Error(y(e,t.status))}return await t.json()}async function be(t="microphone"){const e=await fetch("/api/voice/permissions/open",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({kind:t})});if(!e.ok){const n=await e.text().catch(()=>"");throw new Error(y(n,e.status))}}async function C(t="microphone"){const e=await fetch("/api/voice/permissions/request",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({kind:t})});if(!e.ok){const n=await e.text().catch(()=>"");throw new Error(y(n,e.status))}}async function Ee(t=12){const e=await fetch(`/api/voice/history?limit=${t}`);if(!e.ok){const i=await e.text().catch(()=>"");throw new Error(y(i,e.status))}return(await e.json()).sessions??[]}async function Te(t){const e=await fetch("/api/voice/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(!e.ok){const n=await e.text().catch(()=>"");throw new Error(y(n,e.status))}return await e.json()}export{fe as a,ve as b,ye as c,ge as d,we as e,he as f,K as g,te as h,Se as i,de as j,Ee as k,Te as l,be as o,D as p,C as r,me as s};
1
+ import{_ as x}from"./index-C1VaWNuD.js";import{b as k,p as A,V as q,D as N}from"./fx-z37u1o2z.js";function he(t){return t?t.hint?`${t.message} ${t.hint}`:t.message:"Scout voice is unavailable."}async function fe(t={}){const e=await fetch("/api/voice/engage",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(e.status===404)return j(t);if(!e.ok){const n=await e.text().catch(()=>"");throw new Error(y(n,e.status))}return await e.json()}async function j(t={}){const e=await de(),n=e.settings,i=e.devices,r=i.length>0||(n.permissions?.length??0)>0,o=n.permissions?.find(w=>w.kind==="microphone")??null,a=n.permissions?.find(w=>w.kind==="speechRecognition")??null,u=U(n,i);if(t.requestPermissions&&(o&&!o.granted&&o.status!=="restricted"?await C("microphone").catch(()=>{}):(o?.granted??!1)&&a&&!a.granted&&a.status!=="restricted"&&await C("speechRecognition").catch(()=>{})),!r)return{ready:!1,issue:{code:"host_offline",title:"Scout Menu is not running",message:"Launch Scout Menu on this Mac to dictate in web chat.",hint:"Restart the web server if you just updated Scout — `scout server restart` or restart `bun run server/index.ts`.",action:"launch_host"},warnings:[],settings:n,devices:i,inputDevice:null,hostOnline:!1};const h=$(o);if(h)return{ready:!1,issue:h,warnings:[],settings:n,devices:i,inputDevice:u,hostOnline:r};if(!u)return{ready:!1,issue:{code:"no_input_device",title:"No microphone detected",message:"Scout Menu did not report any audio input devices.",hint:"Plug in a microphone, check Sound settings, then refresh Settings → Voice.",action:"open_voice_settings"},warnings:[],settings:n,devices:i,inputDevice:null,hostOnline:r};const d=F(a);return{ready:!0,issue:null,warnings:d?[d]:[],settings:n,devices:i,inputDevice:u,hostOnline:r}}function U(t,e){if(e.length===0)return null;const n=t.inputDeviceId?e.find(o=>o.id===t.inputDeviceId):null,i=e.find(o=>o.isDefault)??e[0]??null,r=n??i;return r?{id:r.id,name:r.name}:null}function $(t){return!t||t.granted?null:t.canRequest?{code:"microphone_not_requested",title:"Microphone access needed",message:"Scout Menu needs microphone access before dictation can start.",hint:"Request access or tap the mic again to show the macOS prompt.",action:"request_microphone"}:{code:"microphone_denied",title:"Microphone blocked",message:"Scout Menu cannot record because microphone access is off.",hint:"Scout is opening macOS Microphone settings and will detect the change automatically.",action:"open_microphone_settings"}}function F(t){return!t||t.granted?null:t.canRequest?{code:"speech_not_requested",title:"Speech recognition needed",message:"Scout Menu needs speech recognition for live partials.",hint:"Request access to show the macOS prompt.",action:"request_speech"}:{code:"speech_denied",title:"Speech recognition blocked",message:"Speech recognition is off for Scout Menu.",hint:"Choose Retry access to reopen macOS Speech Recognition settings.",action:"open_speech_settings"}}function H(t,e){switch(e){case"microphone_permission":return"Microphone access is off for Scout Menu. Tap the mic to retry; Scout will open macOS Microphone settings.";case"empty_transcript":return"No speech was detected. Check your microphone input in Settings → Voice.";default:return t}}const G=6e4,J=3e3,z=2e4,B=8e3,W=45e3;let M=null,E=null,l=null,_=!1;const R=new Set;function X(){return typeof window>"u"?!1:typeof fetch=="function"}function K(){return M||(M=new Q),M}function me(t){return R.add(t),l&&t(l),()=>{R.delete(t)}}function we(){if(_||!X())return;_=!0;const t=K();t.probe();const e=()=>{t.probeIfStale()};window.addEventListener("focus",e),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&e()})}function I(t){for(const e of R)e(t)}function O(t,e=Date.now()){const n=t.ok?z:B;return e-t.probedAt<n}class Q{state="unknown";unavailableReason=null;captureMode=null;hostReachable=!1;microphoneGranted=null;microphoneCanRequest=null;inputDeviceName=null;get connectionState(){return this.state}get lastUnavailableReason(){return this.unavailableReason}get preferredCaptureMode(){return this.captureMode}get isVoiceHostReachable(){return this.hostReachable}get activeInputDeviceName(){return this.inputDeviceName}get isMicrophoneGranted(){return this.microphoneGranted}get canRequestMicrophone(){return this.hostReachable&&this.microphoneGranted===!1&&this.microphoneCanRequest===!0}get isMicrophoneHardDenied(){return this.hostReachable&&this.microphoneGranted===!1&&this.microphoneCanRequest===!1}get isMicrophoneDenied(){return this.isMicrophoneHardDenied}async probeIfStale(){const e=Date.now();return l&&O(l,e)?(this.applyProbeSnapshot(l),l.ok):l&&l.ok&&e-l.probedAt<W?(this.applyProbeSnapshot(l),!0):l&&!l.ok?this.probe({force:!0}):this.probe()}async probe(e={}){const n=typeof e=="number"?{timeoutMs:e}:e,i=n.force??!1,r=n.timeoutMs??J,o=Date.now();return!i&&l&&O(l,o)?(this.applyProbeSnapshot(l),l.ok):E||(this.state="probing",E=this.fetchProbe(r).finally(()=>{E=null}),E)}async fetchProbe(e){const n=new AbortController,i=window.setTimeout(()=>n.abort(),e);try{const r=await fetch("/api/voice/health?quiet=1",{signal:n.signal}),o=await r.json().catch(()=>({})),a=!!o.host?.hostId,u=typeof o.microphoneGranted=="boolean"?o.microphoneGranted:null,h=typeof o.microphoneCanRequest=="boolean"?o.microphoneCanRequest:null,d=typeof o.inputDevice?.name=="string"&&o.inputDevice.name.trim()?o.inputDevice.name.trim():null,w=o.capture==="browser"?"browser":"native",S=r.ok&&o.ok===!0,v=S?null:o.detail??o.error??(a?"Scout voice is not ready.":"Scout voice service is unavailable."),f={ok:S,reason:v,captureMode:S?w:null,hostReachable:a,microphoneGranted:u,microphoneCanRequest:h,inputDeviceName:d,probedAt:Date.now()};return l=f,this.applyProbeSnapshot(f),I(f),S}catch(r){const a={ok:!1,reason:r instanceof Error&&r.name==="AbortError"?"Scout voice service did not respond.":"Scout voice service is unavailable.",captureMode:null,hostReachable:!1,microphoneGranted:null,microphoneCanRequest:null,inputDeviceName:null,probedAt:Date.now()};return l=a,this.applyProbeSnapshot(a),I(a),!1}finally{window.clearTimeout(i)}}applyProbeSnapshot(e){if(this.hostReachable=e.hostReachable,this.microphoneGranted=e.microphoneGranted,this.microphoneCanRequest=e.microphoneCanRequest,this.inputDeviceName=e.inputDeviceName,e.ok){this.unavailableReason=null,this.captureMode=e.captureMode,this.state="connected";return}this.unavailableReason=e.reason,this.captureMode=null,this.state="unavailable"}async launch(e={}){try{const i=await(await fetch("/api/scout-services/restart-link",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({target:"all"})})).json().catch(()=>({}));if(i.url?.startsWith("scout://services/restart/")){window.location.href=i.url;return}}catch{}window.location.href="scout://hud/show"}async startLive(e={},n={}){return this.captureMode!=="browser"?await Y(e,n):await Z(e)}}async function Y(t={},e={}){t.onState?.("starting");const n=await fetch("/api/voice/session",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({clientId:"openscout-web",surface:e.surface?.trim()||"chat-composer"})});if(!n.ok){const s=await n.text().catch(()=>"");throw new Error(y(s,n.status))}const r=(await n.json()).sessionId?.trim();if(!r)throw new Error("Scout voice did not return a session id.");let o=!1,a,u;const h=new Promise((s,p)=>{a=s,u=p});let d=null;const w=()=>{d&&window.clearTimeout(d),d=window.setTimeout(()=>{v(new Error("Scout voice transcription timed out. Try again or check voice settings."))},G)},S=()=>{d&&(window.clearTimeout(d),d=null)},v=(s,p="error")=>{o||(o=!0,S(),m.close(),t.onState?.(p),u(s))},f=s=>{o||(o=!0,S(),m.close(),t.onFinal?.(s),t.onState?.("done"),a(s))},m=new EventSource(`/api/voice/session/${encodeURIComponent(r)}/events`),c=s=>p=>{if(o)return;let g={};try{g=JSON.parse(p.data)}catch{return}if(s==="session.partial"){const b=typeof g.text=="string"?g.text:"";t.onPartial?.(b);return}if(s==="session.state"){const b=ee(g.state);b&&(t.onState?.(b),b==="processing"&&w());return}if(s==="session.final"){f({sessionId:r,text:typeof g.text=="string"?g.text.trim():"",durationMs:Number(g.durationMs??0)});return}if(s==="session.cancelled"){v(T(),"cancelled");return}if(s==="session.error"){const b=typeof g.message=="string"?g.message:"Scout voice session failed.",L=typeof g.code=="string"?g.code:null;v(new Error(H(b,L)))}};return m.addEventListener("session.started",()=>{t.onState?.("starting")}),m.addEventListener("session.state",c("session.state")),m.addEventListener("session.partial",c("session.partial")),m.addEventListener("session.final",c("session.final")),m.addEventListener("session.cancelled",c("session.cancelled")),m.addEventListener("session.error",c("session.error")),m.onerror=()=>{o||v(new Error("Scout voice event stream disconnected."))},{get sessionId(){return r},result:h,stop:async()=>{t.onState?.("processing"),w();const s=await fetch(`/api/voice/session/${encodeURIComponent(r)}/stop`,{method:"POST"});if(!s.ok){const p=await s.text().catch(()=>"");throw new Error(y(p,s.status))}},cancel:async()=>{o=!0,S(),m.close();const s=await fetch(`/api/voice/session/${encodeURIComponent(r)}/cancel`,{method:"POST"});if(!s.ok){const p=await s.text().catch(()=>"");throw new Error(y(p,s.status))}t.onState?.("cancelled"),u(T())}}}async function Z(t={}){if(typeof MediaRecorder>"u"||!navigator.mediaDevices?.getUserMedia)throw new Error("Scout voice capture is unavailable in this browser.");const{startStreamLevelMeter:e}=await x(async()=>{const{startStreamLevelMeter:c}=await import("./voice-levels-Dcr3jglk.js");return{startStreamLevelMeter:c}},[]),n=ue(),i=[];let r=null,o=null,a=null,u=!1,h=!1,d,w;const S=new Promise((c,s)=>{d=c,w=s}),v=()=>{a?.stop(),a=null;for(const c of r?.getTracks()??[])c.stop();r=null},f=(c,s="error")=>{h||(h=!0,v(),t.onState?.(s),w(c))},m=async()=>{if(h)return;if(v(),u){f(T(),"cancelled");return}t.onState?.("processing");const c=o?.mimeType||V()||"application/octet-stream",s=new Blob(i,{type:c});if(s.size===0){f(new Error("No voice audio was captured."));return}try{const p=await re(s,{sessionId:n});if(h)return;h=!0,t.onFinal?.(p),t.onState?.("done"),d(p)}catch(p){f(p instanceof Error?p:new Error(String(p)))}};try{t.onState?.("starting"),r=await navigator.mediaDevices.getUserMedia({audio:!0}),t.onLevel&&(a=e(r,t.onLevel));const c=V();o=new MediaRecorder(r,c?{mimeType:c}:void 0),o.addEventListener("dataavailable",s=>{s.data.size>0&&i.push(s.data)}),o.addEventListener("error",()=>{f(new Error("Scout voice recorder failed."))}),o.addEventListener("stop",()=>{m()},{once:!0}),o.start(),t.onPartial?.(""),t.onState?.("recording")}catch(c){const s=c instanceof Error?c:new Error(String(c));throw f(s),S.catch(()=>{}),s}return{get sessionId(){return n},result:S,stop:async()=>{!o||o.state==="inactive"||o.stop()},cancel:async()=>{if(u=!0,o&&o.state!=="inactive"){o.stop();return}f(T(),"cancelled")}}}function ee(t){return t==="starting"||t==="recording"||t==="processing"||t==="done"||t==="cancelled"||t==="error"?t:null}function y(t,e){try{return JSON.parse(t).error??`Scout voice returned HTTP ${e}`}catch{return t||`Scout voice returned HTTP ${e}`}}function Se(t){return t instanceof Error&&t.name==="AbortError"}async function D(t,e={}){const n={text:t,speed:ce(e.speed)};e.modelId&&(n.modelId=e.modelId),e.voiceId&&(n.voiceId=e.voiceId),e.originAppId&&(n.originAppId=e.originAppId),e.utteranceId&&(n.utteranceId=e.utteranceId),e.instructions&&(n.instructions=e.instructions),e.speechTiming?.enabled&&(n.speechTiming=e.speechTiming);const i=await fetch("/api/voice/speak",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n),signal:e.signal});if(!i.ok){const r=await i.text().catch(()=>"");try{const o=JSON.parse(r);throw new Error(o.error??`Scout voice returned HTTP ${i.status}`)}catch(o){throw o instanceof SyntaxError?new Error(r||`Scout voice returned HTTP ${i.status}`):o}}return await i.json()}async function ge(t){const e=t?`?modelId=${encodeURIComponent(t)}`:"",n=await fetch(`/api/voice/catalog${e}`,{headers:{accept:"application/json"}});if(!n.ok)throw new Error(`Scout voice catalog returned HTTP ${n.status}`);return await n.json()}async function te(t,e={}){if(e.signal?.aborted)throw P();const n=new Audio(`data:${t.contentType};base64,${t.audioBase64}`),i=()=>{n.pause(),n.currentTime=0};e.signal?.addEventListener("abort",i,{once:!0}),await n.play(),e.onPlaybackStart?.();try{return await new Promise((r,o)=>{const a=()=>{n.removeEventListener("ended",u),n.removeEventListener("error",h),e.signal?.removeEventListener("abort",d)},u=()=>{a(),r()},h=()=>{a(),o(new Error("Scout voice playback failed."))},d=()=>{a(),o(P())};if(e.signal?.aborted){d();return}n.addEventListener("ended",u,{once:!0}),n.addEventListener("error",h,{once:!0}),e.signal?.addEventListener("abort",d,{once:!0})}),t}finally{e.signal?.removeEventListener("abort",i)}}async function ne(t,e={}){const n=await D(t,e);return await te(n,{signal:e.signal})}function ve(t,e={}){const n=new AbortController;return{promise:ne(t,{...e,signal:n.signal}),stop:()=>n.abort()}}async function oe(t,e={}){const n=await D(t,e);if(e.signal?.aborted)throw P();const i=await k(n.audioBase64,n.contentType),r=ae(e.presetId,e.params);return await A(i,{params:r,signal:e.signal}).promise,n}function ye(t,e={}){const n=new AbortController;return{promise:oe(t,{...e,signal:n.signal}),stop:()=>n.abort()}}async function re(t,e){const n=new FormData,i=ie(t.type);n.append("audio",t,`audio.${se(t.type)}`),n.append("sessionId",e.sessionId),i&&n.append("format",i);const r=await fetch("/api/voice/transcribe",{method:"POST",body:n});if(!r.ok){const a=await r.text().catch(()=>"");try{const u=JSON.parse(a);throw new Error(u.error??`Scout voice returned HTTP ${r.status}`)}catch(u){throw u instanceof SyntaxError?new Error(a||`Scout voice returned HTTP ${r.status}`):u}}const o=await r.json();return{sessionId:e.sessionId,text:o.text?.trim()??"",durationMs:Number(o.durationMs??0)}}function P(){const t=new Error("Speech stopped.");return t.name="AbortError",t}function T(){const t=new Error("Voice recording was cancelled.");return t.name="AbortError",t}function V(){return typeof MediaRecorder>"u"||typeof MediaRecorder.isTypeSupported!="function"?void 0:["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4","audio/webm","audio/wav"].find(e=>{try{return MediaRecorder.isTypeSupported(e)}catch{return!1}})}function ie(t){const e=t.toLowerCase();if(e.includes("mp3")||e.includes("mpeg"))return"mp3";if(e.includes("wav"))return"wav";if(e.includes("aac")||e.includes("mp4"))return"aac";if(e.includes("opus")||e.includes("ogg")||e.includes("webm"))return"opus"}function se(t){const e=t.toLowerCase();return e.includes("webm")?"webm":e.includes("ogg")||e.includes("opus")?"opus":e.includes("mp4")||e.includes("aac")?"m4a":e.includes("wav")?"wav":e.includes("mp3")||e.includes("mpeg")?"mp3":"audio"}function ae(t,e){const n=t?q.find(i=>i.id===t)?.params:void 0;return{...N,...n??{},...e??{}}}function ce(t){if(!(t===void 0||!Number.isFinite(t)))return Math.min(2,Math.max(.5,Number(t.toFixed(2))))}function ue(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`scout-voice:${crypto.randomUUID()}`:`scout-voice:${Date.now().toString(36)}:${Math.random().toString(36).slice(2)}`}async function de(){const t=await fetch("/api/voice/settings");if(!t.ok){const e=await t.text().catch(()=>"");throw new Error(y(e,t.status))}return await t.json()}async function be(t="microphone"){const e=await fetch("/api/voice/permissions/open",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({kind:t})});if(!e.ok){const n=await e.text().catch(()=>"");throw new Error(y(n,e.status))}}async function C(t="microphone"){const e=await fetch("/api/voice/permissions/request",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({kind:t})});if(!e.ok){const n=await e.text().catch(()=>"");throw new Error(y(n,e.status))}}async function Ee(t=12){const e=await fetch(`/api/voice/history?limit=${t}`);if(!e.ok){const i=await e.text().catch(()=>"");throw new Error(y(i,e.status))}return(await e.json()).sessions??[]}async function Te(t){const e=await fetch("/api/voice/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(!e.ok){const n=await e.text().catch(()=>"");throw new Error(y(n,e.status))}return await e.json()}export{fe as a,ve as b,ye as c,ge as d,we as e,he as f,K as g,te as h,Se as i,de as j,Ee as k,Te as l,be as o,D as p,C as r,me as s};
@@ -0,0 +1,3 @@
1
+ const g="scoutbot",E="scout:scoutbot-submit",h=new Set([g,"scoutbot","@scoutbot"]),S=new Set(["advisor","plan","conductor","conduct","warroom","command","mission","control","issues","errors","warnings","agents","tail","atop"]),_=new Set(["available","working","active","idle","waiting","registered"]);function O(t=globalThis.window){const e=t.webkit?.messageHandlers;return!!(e?.scoutNativeUI??e?.scoutRealtimeVoice)}function U(t,e=globalThis.window){const o=e.webkit?.messageHandlers,n=o?.scoutNativeUI??o?.scoutRealtimeVoice;if(!n)return!1;try{return n.postMessage({kind:"ui-action",action:t}),!0}catch{return!1}}function y(t){return[t.id,t.name,t.handle??"",t.selector??"",t.role??""].map(o=>o.trim().toLowerCase()).some(o=>h.has(o)||o==="scoutbot"||o.startsWith("scoutbot.")||o.includes(".scoutbot.")||o.includes(" scoutbot"))}function A(t){return _.has(t.state?.trim().toLowerCase()??"")}function m(t){if(!y(t))return Number.NEGATIVE_INFINITY;let e=0;return A(t)&&(e+=100),t.handle?.trim().toLowerCase()==="scoutbot"&&(e+=20),t.selector?.trim().toLowerCase()==="@scoutbot"&&(e+=20),t.role?.trim().toLowerCase()==="scoutbot"&&(e+=10),t.id===g&&(e+=1),e}function N(t){return t.filter(y).sort((e,o)=>{const n=m(o)-m(e);return n!==0?n:(o.updatedAt??0)-(e.updatedAt??0)})[0]??null}function C(t){return N(t)?.id??g}const T=new Set(["scout-ui","scout-ui-action","scoutbot-ui"]),b=/```([a-zA-Z0-9_-]*)\s*([\s\S]*?)```/g;function I(t){const e=[];let o="",n=0;b.lastIndex=0;let s;for(;(s=b.exec(t))!==null;){const[l,r,i]=s,c=(r??"").toLowerCase(),u=i??"";let d=[],f=!1;T.has(c)?(f=!0,d=w(u)):(c==="json"||c==="")&&(d=w(u),d.length>0&&(f=!0)),f&&(e.push(...d),o+=t.slice(n,s.index),n=s.index+l.length)}return o+=t.slice(n),{stripped:o.replace(/\n{3,}/g,`
2
+
3
+ `).trim(),actions:e}}function x(t){return I(t).actions}function F(t){return I(t).stripped}function w(t){const e=t.trim();if(!e)return[];try{const o=JSON.parse(e);return(Array.isArray(o)?o:[o]).map(s=>v(s)).filter(s=>!!s)}catch{return[]}}function v(t){if(!t||typeof t!="object")return null;const e=t,o=e.scoutUi??e.scout_ui??e.scoutbotUi??e.scoutbot_ui;if(o)return v(o);const n=typeof e.type=="string"?e.type:typeof e.action=="string"?e.action:"",s=typeof e.reason=="string"?e.reason:void 0;if(n==="open-scoutbot"||n==="open_scoutbot"){const r=e.mode==="tell"?"tell":e.mode==="ask"?"ask":void 0;return{type:"open-scoutbot",...r?{mode:r}:{},...s?{reason:s}:{}}}if(n==="refresh")return{type:"refresh",...s?{reason:s}:{}};if(n==="ask-agent"||n==="ask_agent"||n==="scout-ask"||n==="scout_ask"){const r=a(e.targetLabel,e.target_label,e.target,e.to,e.agent,e.handle),i=a(e.targetAgentId,e.target_agent_id,e.agentId,e.agent_id),c=a(e.body,e.message,e.prompt,e.task,e.question),u=a(e.channel);return!c?.trim()||!r?.trim()&&!i?.trim()?null:{type:"ask-agent",targetLabel:(r??i??"").trim(),body:c.trim(),...i?.trim()?{targetAgentId:i.trim()}:{},...u?.trim()?{channel:u.trim()}:{},...s?{reason:s}:{}}}if(n==="view-file"||n==="view_file"||n==="open-file"||n==="open_file"){const r=a(e.path,e.file,e.target);return r?.trim()?{type:"view-file",path:r.trim(),...s?{reason:s}:{}}:null}if(n==="select-project"||n==="select_project"){const r=e.root;return r===null?{type:"select-project",root:null,...s?{reason:s}:{}}:typeof r=="string"?{type:"select-project",root:r.trim()||null,...s?{reason:s}:{}}:null}if(n==="reminder"||n==="set-reminder"||n==="set_reminder"||n==="remind"){const r=a(e.body,e.text,e.prompt,e.message);if(!r?.trim())return null;const i=a(e.title,e.label),c=k(e.dueAt??e.due_at),u=p(e.delayMs??e.delay_ms),d=p(e.delayMinutes??e.delay_minutes);return{type:"reminder",body:r.trim(),...i?.trim()?{title:i.trim()}:{},...c!==null?{dueAt:c}:{},...u!==null?{delayMs:u}:{},...d!==null?{delayMinutes:d}:{},...s?{reason:s}:{}}}if(n!=="navigate"&&n!=="open")return null;const l=j(e.route??e);return l?{type:"navigate",route:l,...s?{reason:s}:{}}:null}function a(...t){for(const e of t)if(typeof e=="string"&&e.trim())return e;return null}function p(t){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t!="string")return null;const e=Number(t.trim());return Number.isFinite(e)?e:null}function k(t){const e=p(t);if(e!==null)return e;if(typeof t!="string")return null;const o=Date.parse(t);return Number.isFinite(o)?o:null}function j(t){if(!t||typeof t!="object")return null;const e=t;switch(typeof e.view=="string"?e.view:""){case"home":case"inbox":return{view:"inbox"};case"fleet":return{view:"inbox"};case"agents":case"projects":case"agents-v2":return{view:"agents-v2",...typeof e.agentId=="string"?{agentId:e.agentId}:{},...typeof e.conversationId=="string"?{conversationId:e.conversationId}:{},...typeof e.sessionId=="string"?{sessionId:e.sessionId}:{},...typeof e.projectSlug=="string"?{projectSlug:e.projectSlug}:{},...e.tab==="profile"||e.tab==="observe"||e.tab==="message"?{tab:e.tab}:{}};case"chat":case"messages":return{view:"messages",...typeof e.conversationId=="string"?{conversationId:e.conversationId}:{}};case"sessions":return{view:"sessions",...typeof e.sessionId=="string"?{sessionId:e.sessionId}:{}};case"repos":return{view:"repos",...typeof e.root=="string"?{root:e.root}:{}};case"harnesses":return{view:"harnesses"};case"repo-diff":return typeof e.path=="string"?{view:"repo-diff",path:e.path,...typeof e.sessionId=="string"?{sessionId:e.sessionId}:{},...typeof e.agentId=="string"?{agentId:e.agentId}:{}}:null;case"search":return{view:"search",...e.mode==="knowledge"||e.mode==="indexer"?{mode:e.mode}:{},...typeof e.hitId=="string"?{hitId:e.hitId}:{}};case"channels":return{view:"messages",...typeof e.channelId=="string"?{conversationId:e.channelId}:{}};case"mesh":return{view:"mesh"};case"broker":return{view:"broker"};case"activity":return{view:"activity"};case"settings":return{view:"settings",...e.section==="pairing"||e.section==="agents"||e.section==="operator"||e.section==="comms"||e.section==="credentials"||e.section==="voice"||e.section==="devices"?{section:e.section}:{},...typeof e.agentId=="string"?{agentId:e.agentId}:{}};case"code":{const n=a(e.project,e.projectSlug,e.project_slug,e.projectName,e.project_name,e.repository,e.repo),s=a(e.path,e.relativePath,e.relative_path),l=a(e.wt,e.worktree,e.worktreeName,e.worktree_name),r=typeof e.line=="number"&&Number.isSafeInteger(e.line)&&e.line>0?e.line:void 0,i=typeof e.endLine=="number"&&Number.isSafeInteger(e.endLine)&&e.endLine>0?e.endLine:void 0,c=r&&i&&i>=r?i:void 0;return{view:"code",...typeof e.root=="string"?{root:e.root}:{},...typeof e.file=="string"?{file:e.file}:{},...n?{project:n}:{},...s?{path:s}:{},...l?{wt:l}:{},...r?{line:r}:{},...c?{endLine:c}:{}}}case"briefings":return{view:"briefings",...typeof e.briefingId=="string"?{briefingId:e.briefingId}:{}};case"terminal":return{view:"terminal",...typeof e.agentId=="string"?{agentId:e.agentId}:{}};case"work":return typeof e.workId=="string"?{view:"work",workId:e.workId}:null;case"conversation":return typeof e.conversationId=="string"?{view:"conversation",conversationId:e.conversationId}:null;case"ops":{const n=typeof e.mode=="string"&&S.has(e.mode)?L(e.mode):void 0;return{view:"ops",...n?{mode:n}:{}}}default:return null}}function L(t){switch(t){case"control":case"mission":case"command":case"warroom":case"conduct":case"conductor":return"mission";case"advisor":case"plan":return"advisor";case"issues":case"errors":case"warnings":return"issues";case"agents":case"tail":case"atop":case"lanes":return t;default:return}}export{E as S,y as a,C as b,x as e,U as f,O as i,N as r,F as s};
@@ -1,4 +1,4 @@
1
- import{j as i,r as p}from"./index-DvLtl7rV.js";import{u as m}from"./Provider-CtXJeLrP.js";import{a as x}from"./api-Co9aQ2Jw.js";import{E as g}from"./external-link-Dp_a2vRZ.js";const h=new RegExp("(?:^|(?<=[\\s(`'\"<>]))(?:~\\/|\\/(?:Users|home|opt|var|etc|tmp|private)\\/)[^\\s)`'\"<>]+\\.[A-Za-z0-9]{1,8}\\b","g");function b(n){const e=n.replace(/\r\n?/g,`
1
+ import{j as i,r as p}from"./index-C1VaWNuD.js";import{u as m}from"./Provider-D0bB7q6y.js";import{a as x}from"./api-Co9aQ2Jw.js";import{E as g}from"./external-link-BvX5PfLh.js";const h=new RegExp("(?:^|(?<=[\\s(`'\"<>]))(?:~\\/|\\/(?:Users|home|opt|var|etc|tmp|private)\\/)[^\\s)`'\"<>]+\\.[A-Za-z0-9]{1,8}\\b","g");function b(n){const e=n.replace(/\r\n?/g,`
2
2
  `).split(`
3
3
  `),t=[];let s=0;for(;s<e.length;){const r=e[s];if(r.trim()===""){s+=1;continue}if(r.startsWith("```")){const l=[];for(s+=1;s<e.length&&!e[s].startsWith("```");)l.push(e[s]),s+=1;s<e.length&&(s+=1),t.push({kind:"code",body:l.join(`
4
4
  `)});continue}const c=r.match(/^(#{1,3})\s+(.*\S)\s*$/);if(c){const l=c[1].length;t.push({kind:"heading",level:l,tokens:d(c[2])}),s+=1;continue}if(u(r)){const l=[];for(;s<e.length&&u(e[s]);)l.push(d(k(e[s]))),s+=1;t.push({kind:"list",items:l});continue}const o=[];for(;s<e.length&&e[s].trim()!==""&&!e[s].startsWith("```")&&!u(e[s])&&!/^#{1,3}\s+\S/.test(e[s]);)o.push(d(e[s])),s+=1;t.push({kind:"paragraph",lines:o})}return t}const f=/^\s*[-*]\s+/;function u(n){return f.test(n)}function k(n){return n.replace(f,"")}function d(n){const e=[];let t=0,s="";const r=()=>{s&&(e.push({kind:"text",body:s}),s="")};for(;t<n.length;){const c=n[t];if(c==="`"){const o=n.indexOf("`",t+1);if(o!==-1&&o>t+1){r(),e.push({kind:"code",body:n.slice(t+1,o)}),t=o+1;continue}}else if(c==="*"&&n[t+1]==="*"){const o=n.indexOf("**",t+2);if(o!==-1&&o>t+2){r(),e.push({kind:"bold",body:n.slice(t+2,o)}),t=o+2;continue}}else if(c==="*"||c==="_"){const o=y(n,t+1,c);if(o!==-1){r(),e.push({kind:"italic",body:n.slice(t+1,o)}),t=o+1;continue}}s+=c,t+=1}return r(),j(e)}function j(n){const e=[];for(const t of n){if(t.kind!=="text"){e.push(t);continue}const s=v(t.body);s.length===1&&s[0].kind==="text"?e.push(t):e.push(...s)}return e}function v(n){if(!n)return[];const e=[];let t=0;h.lastIndex=0;let s;for(;(s=h.exec(n))!==null;){const r=s.index,c=r+s[0].length;r>t&&e.push({kind:"text",body:n.slice(t,r)}),e.push({kind:"file-path",body:s[0]}),t=c}return t===0?[{kind:"text",body:n}]:(t<n.length&&e.push({kind:"text",body:n.slice(t)}),e)}function y(n,e,t){if(n[e]===void 0||/\s/.test(n[e]))return-1;for(let s=e;s<n.length;s+=1){const r=n[s];if(r===t){const c=n[s-1];if(c&&!/\s/.test(c)&&n[s+1]!==t)return s}if(r===`
@@ -1 +1 @@
1
- import{c as a}from"./createLucideIcon-DezKXSG2.js";const t=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],c=a("scroll-text",t);export{c as S};
1
+ import{c as a}from"./createLucideIcon-Dv8H8m7J.js";const t=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],c=a("scroll-text",t);export{c as S};
@@ -1 +1 @@
1
- import{c}from"./createLucideIcon-DezKXSG2.js";const e=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],o=c("search",e);export{o as S};
1
+ import{c}from"./createLucideIcon-Dv8H8m7J.js";const e=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],o=c("search",e);export{o as S};