@openscout/scout 0.2.80 → 0.2.82

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 (358) hide show
  1. package/README.md +1 -1
  2. package/bin/scoutd +0 -0
  3. package/dist/build-manifest.json +4 -4
  4. package/dist/client/assets/ActivityScreen-aewI4Ul1.js +1 -0
  5. package/dist/client/assets/{AddProjectForm-CtEiLQnm.js → AddProjectForm-Czb5uwou.js} +1 -1
  6. package/dist/client/assets/{AgentAvatar-CszU5eaU.js → AgentAvatar-DMov24_o.js} +1 -1
  7. package/dist/client/assets/AgentConfigurationScreen-BjG6ECjl.js +1 -0
  8. package/dist/client/assets/AgentDefinitionsWorkspace-D4MbSMXp.js +1 -0
  9. package/dist/client/assets/{AgentDetailCard-sZuHl1de.js → AgentDetailCard-Biq8b2gv.js} +1 -1
  10. package/dist/client/assets/AgentFloorView-h9KDJdw0.js +1 -0
  11. package/dist/client/assets/AgentInfoScreen-SjhK_SBh.js +1 -0
  12. package/dist/client/assets/{AgentLaneCard-nB68f2CI.js → AgentLaneCard-C4DMQR-c.js} +1 -1
  13. package/dist/client/assets/{AgentLaneChrome-O9Yf0uR-.js → AgentLaneChrome-D1xNNf7A.js} +1 -1
  14. package/dist/client/assets/{AgentLaneDetailSheet-BfhpaEQ3.js → AgentLaneDetailSheet-DnAKe4e3.js} +1 -1
  15. package/dist/client/assets/{AgentLaneSummaryResize-Ct3b0TQR.js → AgentLaneSummaryResize-C9loK-st.js} +1 -1
  16. package/dist/client/assets/AgentLanesEmbedScreen-BNOYF16R.js +1 -0
  17. package/dist/client/assets/{AgentLanesPreflight-DNGvZvjd.js → AgentLanesPreflight-M7iDXdP2.js} +1 -1
  18. package/dist/client/assets/{AgentLanesView-DqRK5-d2.js → AgentLanesView-Ct-Gz5WD.js} +1 -1
  19. package/dist/client/assets/{AgentLiveActions-DI4ooSHW.js → AgentLiveActions-0iy8QZ1T.js} +1 -1
  20. package/dist/client/assets/{AgentSessions-BxWIPkWh.js → AgentSessions-CDfSfNiE.js} +2 -2
  21. package/dist/client/assets/{AgentsConsole-D6VHSCfZ.js → AgentsConsole-BVxhBqRa.js} +1 -1
  22. package/dist/client/assets/AgentsScreen-Bww6HgFs.js +1 -0
  23. package/dist/client/assets/AgentsSubnav-CiIuzxnZ.js +1 -0
  24. package/dist/client/assets/{AtopView-VZkk40v0.js → AtopView-h_aFoNkP.js} +1 -1
  25. package/dist/client/assets/BackToPicker-BXp5E2ck.js +1 -0
  26. package/dist/client/assets/{BriefingDetailScreen-BZU4qMwE.js → BriefingDetailScreen-C83o2YfN.js} +1 -1
  27. package/dist/client/assets/{BriefingsScreen-Bfc3tqPp.js → BriefingsScreen-BTsvr5fv.js} +1 -1
  28. package/dist/client/assets/{BrokerMetadataPanel-CaFe6kdh.js → BrokerMetadataPanel-jg7odHQp.js} +1 -1
  29. package/dist/client/assets/BrokerScreen-DplF8d_X.js +5 -0
  30. package/dist/client/assets/Canvas-BePL08RR.js +1 -0
  31. package/dist/client/assets/{ChatCollapsedStrip-Cov54p9V.js → ChatCollapsedStrip-BRljIymi.js} +1 -1
  32. package/dist/client/assets/{CodeDiffPane-C1ebFt-Y.js → CodeDiffPane-86odpBSt.js} +1 -1
  33. package/dist/client/assets/{CodeProjectPicker-tsCly-f3.js → CodeProjectPicker-8svr_S_A.js} +1 -1
  34. package/dist/client/assets/{CodeScreen-D0hpZNLP.js → CodeScreen-CJ2RgB32.js} +1 -1
  35. package/dist/client/assets/{ContextMenu-N-Z6X0Z1.js → ContextMenu-CxkmFQcN.js} +1 -1
  36. package/dist/client/assets/{ConversationComposer-CiEF7dhd.js → ConversationComposer-CWohCCmn.js} +1 -1
  37. package/dist/client/assets/ConversationFeedRows-IWh0JSIL.js +1 -0
  38. package/dist/client/assets/{ConversationHeader-BGgbITvr.js → ConversationHeader-BxTzXl8e.js} +1 -1
  39. package/dist/client/assets/ConversationPanels-D9UCwNkS.js +2 -0
  40. package/dist/client/assets/ConversationScreen-oZSitVtX.js +1 -0
  41. package/dist/client/assets/{ConversationStatus-COEj5loj.js → ConversationStatus-B6pAbo2w.js} +1 -1
  42. package/dist/client/assets/{DataTable-BoofV-_4.js → DataTable-CGw5CECG.js} +1 -1
  43. package/dist/client/assets/{DispatchAftermath-OXYlMbT1.js → DispatchAftermath-DowTb7uO.js} +1 -1
  44. package/dist/client/assets/{DocumentFocusViewer-BCG2kOmd.js → DocumentFocusViewer-DRKjNG9s.js} +1 -1
  45. package/dist/client/assets/{EmbeddableSurfacesLab-C2SZvrHJ.js → EmbeddableSurfacesLab-CxfJXS2g.js} +1 -1
  46. package/dist/client/assets/{EmptyState-DypEjx0V.js → EmptyState-BUvllvA6.js} +1 -1
  47. package/dist/client/assets/{FileViewerPane-CXCq-oKj.js → FileViewerPane-BM4AD_bo.js} +1 -1
  48. package/dist/client/assets/{FleetSearch-Dj7-CfNi.js → FleetSearch-CYeWn85V.js} +1 -1
  49. package/dist/client/assets/FlightObserveScreen-DYJJ3Z2B.js +1 -0
  50. package/dist/client/assets/{FollowScreen-DRgYuAvp.js → FollowScreen-DG0osbUp.js} +1 -1
  51. package/dist/client/assets/{HarnessMark-BE-YSyci.js → HarnessMark-MztYnrGK.js} +1 -1
  52. package/dist/client/assets/HarnessesScreen-BWqirBjK.js +1 -0
  53. package/dist/client/assets/{HerdrSession-DKFCJMst.js → HerdrSession-6sFln7WX.js} +1 -1
  54. package/dist/client/assets/{HomeHero-CAEg8Yg5.js → HomeHero-BPBArHXa.js} +1 -1
  55. package/dist/client/assets/{KnowledgeSearchInspector-C2EZsQ5i.js → KnowledgeSearchInspector-BOIhFWd2.js} +1 -1
  56. package/dist/client/assets/KnowledgeSearchScreen-BP8tD-Bh.js +1 -0
  57. package/dist/client/assets/{LaneToolHoverCard-DrPXYZvQ.js → LaneToolHoverCard-CcEiQC6B.js} +1 -1
  58. package/dist/client/assets/LaneTraceDetailSheet-B4i1Ut4R.js +1 -0
  59. package/dist/client/assets/{LaneTraceEventFocus-X4-DDFEo.js → LaneTraceEventFocus-Bl9L0EYb.js} +1 -1
  60. package/dist/client/assets/{MeshCanvas-rtCBD7s6.js → MeshCanvas-ZjIuMiRo.js} +1 -1
  61. package/dist/client/assets/{MeshCanvasMinimap-CuvXOkc7.js → MeshCanvasMinimap-C-LQtiX6.js} +1 -1
  62. package/dist/client/assets/MeshScreen-Bs3soujg.js +1 -0
  63. package/dist/client/assets/{MeshTopologyView-CeTShs-U.js → MeshTopologyView-C0LUyT3K.js} +2 -2
  64. package/dist/client/assets/{MessageComposerSuggestions-Cs9u-F_3.js → MessageComposerSuggestions-Dfc3PH2y.js} +1 -1
  65. package/dist/client/assets/MessagesScreen-TgSL5KMc.js +1 -0
  66. package/dist/client/assets/{MissionContextRail-0O-Zu1Tn.js → MissionContextRail-CjGAEGu8.js} +1 -1
  67. package/dist/client/assets/MissionControlView-D629w2A8.js +1 -0
  68. package/dist/client/assets/{MissionFocusOverlay-LnjmqBiW.js → MissionFocusOverlay-Bubrr8Gc.js} +1 -1
  69. package/dist/client/assets/{MissionLeftAgentRow-nc1Jyq3D.js → MissionLeftAgentRow-DokImu4Y.js} +1 -1
  70. package/dist/client/assets/{MissionLogPane-lZ9vUftY.js → MissionLogPane-Cs0LuIkn.js} +1 -1
  71. package/dist/client/assets/{NewAgentModal-K1cvdmZr.js → NewAgentModal-D5e0YUAo.js} +1 -1
  72. package/dist/client/assets/{NewChatComposer-DXDxV2Mh.js → NewChatComposer-S08F6_La.js} +1 -1
  73. package/dist/client/assets/{NewChatOrigin-CnjoswTG.js → NewChatOrigin-BEz6jyqf.js} +1 -1
  74. package/dist/client/assets/{ObserveEmbedScreen-CRpzYf0Y.js → ObserveEmbedScreen-CHx2sEAA.js} +2 -2
  75. package/dist/client/assets/ObserveTextFlow-_ApDwRCO.js +2 -0
  76. package/dist/client/assets/{ObservedTopologyPanel-C1AQM0Mq.js → ObservedTopologyPanel-ByW7Ar7p.js} +1 -1
  77. package/dist/client/assets/OpenScoutAppShell-DTmnbG-h.js +88 -0
  78. package/dist/client/assets/OpsAgentsView-DiFuHcJs.js +1 -0
  79. package/dist/client/assets/OpsScreen-CCR3U_9P.js +1 -0
  80. package/dist/client/assets/OpsSubnav-CZs_OL2N.js +1 -0
  81. package/dist/client/assets/{PlanView-DDXdC19M.js → PlanView-C54eAzig.js} +1 -1
  82. package/dist/client/assets/ProjectAgentProfile-BEfYOaxc.js +1 -0
  83. package/dist/client/assets/{ProjectAgentProfileBar-MODhG0P6.js → ProjectAgentProfileBar-B1VpwzGD.js} +1 -1
  84. package/dist/client/assets/{ProjectAgentProfileHero-C1ImgGDu.js → ProjectAgentProfileHero-B4f_AoCr.js} +1 -1
  85. package/dist/client/assets/ProjectsInbox-DoPZ17FC.js +2 -0
  86. package/dist/client/assets/{ProjectsRail-B1zrQLZe.js → ProjectsRail-CWOkZjsY.js} +1 -1
  87. package/dist/client/assets/ProjectsScreen-Dse0Q6p6.js +1 -0
  88. package/dist/client/assets/ProjectsThreadAside-DMnfyPLE.js +1 -0
  89. package/dist/client/assets/Provider-DKZWuzSR.js +1 -0
  90. package/dist/client/assets/{RailRow-DerXOXQS.js → RailRow-DIGd3MMM.js} +1 -1
  91. package/dist/client/assets/RawSessionsTable-Zkl4YDvz.js +1 -0
  92. package/dist/client/assets/RealtimeVoiceScreen-B_PMJxY_.js +1 -0
  93. package/dist/client/assets/{RepoDiffEmbedScreen-C9oLCcZX.js → RepoDiffEmbedScreen-VLg4caej.js} +1 -1
  94. package/dist/client/assets/{RepoDiffPageScreen-CGEMAv2Z.js → RepoDiffPageScreen-BelnvgnP.js} +1 -1
  95. package/dist/client/assets/{RepoDiffViewer-CB8PSVey.js → RepoDiffViewer-VrUJw33u.js} +1 -1
  96. package/dist/client/assets/RepoDiffViewerLazy-BPg_JkYW.js +2 -0
  97. package/dist/client/assets/{ReposScreen-BN1lVjOj.js → ReposScreen-IINK-CFn.js} +2 -2
  98. package/dist/client/assets/ScoutDeckSurface-MbwGp6Ab.js +1 -0
  99. package/dist/client/assets/{ScoutSurface-BEnDlynn.js → ScoutSurface-x_QbcRyk.js} +1 -1
  100. package/dist/client/assets/ScoutbotBroadcastChip-DAKQKB25.js +2 -0
  101. package/dist/client/assets/{ScoutbotFxLab-fAROyIfz.js → ScoutbotFxLab-7t9JVvZg.js} +1 -1
  102. package/dist/client/assets/{ScoutbotRealtimeVoiceCall-CDyFJX8m.js → ScoutbotRealtimeVoiceCall-Br4bYVAx.js} +1 -1
  103. package/dist/client/assets/{SecondaryNav-Hv5AJ3Fv.js → SecondaryNav-Dj30epYF.js} +1 -1
  104. package/dist/client/assets/{SessionEmbedScreen-CDRpQc3g.js → SessionEmbedScreen-s2mJ5Fg9.js} +1 -1
  105. package/dist/client/assets/{SessionObserve-BmmJ8dEh.js → SessionObserve-DaUrJCMq.js} +1 -1
  106. package/dist/client/assets/{SessionObserveEvidence-CEedIk2a.js → SessionObserveEvidence-ClUW8jpV.js} +1 -1
  107. package/dist/client/assets/SessionRefScreen-DLZNFZFK.js +1 -0
  108. package/dist/client/assets/SessionsScreen-D-hN1n4k.js +1 -0
  109. package/dist/client/assets/{SettingsDrawer-DL-SVLdd.js → SettingsDrawer-BFsnww-k.js} +3 -3
  110. package/dist/client/assets/SettingsScreen-Bc3Xtv5V.js +1 -0
  111. package/dist/client/assets/{ShikiPane-B7O4if20.js → ShikiPane-Dkwyx--r.js} +1 -1
  112. package/dist/client/assets/{SlidePanel-B3gc5HnM.js → SlidePanel-CuTeirnk.js} +1 -1
  113. package/dist/client/assets/{SpriteAvatar-BpQDpOkq.js → SpriteAvatar-DQ3PTb8L.js} +1 -1
  114. package/dist/client/assets/{StatusPill-B33sQinT.js → StatusPill-BJ1ierIR.js} +1 -1
  115. package/dist/client/assets/{TailView-DL3YZkzE.js → TailView-CufWcrvf.js} +2 -2
  116. package/dist/client/assets/Terminal-D_OmdFmr.js +1 -0
  117. package/dist/client/assets/TerminalEmbedScreen-D21ytNXW.js +1 -0
  118. package/dist/client/assets/TerminalRelay-rvUzI9Ek.js +46 -0
  119. package/dist/client/assets/{TextDocumentSurface-DRjctOIt.js → TextDocumentSurface-Bc-kHPgG.js} +1 -1
  120. package/dist/client/assets/{TmuxPeek-DNC4uWky.js → TmuxPeek-DLyDkq_D.js} +1 -1
  121. package/dist/client/assets/{VoicePermissionsPanel-WLN0V-Xv.js → VoicePermissionsPanel-CD903y9K.js} +1 -1
  122. package/dist/client/assets/{WorkDetailScreen-D2Yl0mYZ.js → WorkDetailScreen-D51oI0dH.js} +2 -2
  123. package/dist/client/assets/{WorkFilesViewer-BbVfcUN-.js → WorkFilesViewer-BDMNbxE4.js} +1 -1
  124. package/dist/client/assets/{activity-BxwKkT8z.js → activity-BvGruxWG.js} +1 -1
  125. package/dist/client/assets/{addon-fit-B9O2vJoh.js → addon-fit-Cfq4Ayjd.js} +1 -1
  126. package/dist/client/assets/{addon-webgl-BhRZFDcn.js → addon-webgl-B8sIf9-s.js} +1 -1
  127. package/dist/client/assets/{agent-essentials-SrzMYEXV.js → agent-essentials-yb4wIJlX.js} +1 -1
  128. package/dist/client/assets/{agent-lane-card-model-DSWdGu-v.js → agent-lane-card-model-q4cwzLX4.js} +1 -1
  129. package/dist/client/assets/{agent-lanes-model-CPgQRenB.js → agent-lanes-model-VYQ5a68i.js} +1 -1
  130. package/dist/client/assets/{arc.es-NlJw-19N.js → arc.es-BBTfhvLE.js} +1 -1
  131. package/dist/client/assets/{arrow-left-_vS7itsV.js → arrow-left-BOht-YQu.js} +1 -1
  132. package/dist/client/assets/{arrow-up-right-CcrWONpD.js → arrow-up-right-hoR8_oUz.js} +1 -1
  133. package/dist/client/assets/{bot-BRINYlC6.js → bot-BUK7dOPS.js} +1 -1
  134. package/dist/client/assets/{check-COxArFXG.js → check--esHw52j.js} +1 -1
  135. package/dist/client/assets/{chevron-down-DRCbnzyY.js → chevron-down-NAhBUkFd.js} +1 -1
  136. package/dist/client/assets/{chevron-right-CNE6QAVr.js → chevron-right-C10o7t_X.js} +1 -1
  137. package/dist/client/assets/{chunk-HRAB3GC3-CAeEKaf5.js → chunk-HRAB3GC3-DF8R9rPv.js} +1 -1
  138. package/dist/client/assets/{clock-CyfvRmj6.js → clock-of01sAB6.js} +1 -1
  139. package/dist/client/assets/{code-xml--LjSM4Mv.js → code-xml-CLn3TDWF.js} +1 -1
  140. package/dist/client/assets/content-B-SUUhXj.js +1 -0
  141. package/dist/client/assets/content-BRY2vo1_.js +1 -0
  142. package/dist/client/assets/content-BTm0mVyD.js +1 -0
  143. package/dist/client/assets/content-BTqvyb5E.js +1 -0
  144. package/dist/client/assets/content-BjDaXmSD.js +1 -0
  145. package/dist/client/assets/content-BrR6deGh.js +1 -0
  146. package/dist/client/assets/content-C5yvBEMy.js +1 -0
  147. package/dist/client/assets/content-Cgj5AWqT.js +1 -0
  148. package/dist/client/assets/content-CkhG__-v.js +1 -0
  149. package/dist/client/assets/content-CudIBsiP.js +1 -0
  150. package/dist/client/assets/content-DBb7ppd5.js +1 -0
  151. package/dist/client/assets/content-DEw_kGyK.js +1 -0
  152. package/dist/client/assets/content-DIy0DCzK.js +1 -0
  153. package/dist/client/assets/content-THl9hRAo.js +1 -0
  154. package/dist/client/assets/content-vi9FbmV9.js +1 -0
  155. package/dist/client/assets/content-wcgPMGVf.js +1 -0
  156. package/dist/client/assets/{conversation-icons-c-hXv7hY.js → conversation-icons-ClBJi21l.js} +1 -1
  157. package/dist/client/assets/conversation-motion-features-zU0k3Agz.js +1 -0
  158. package/dist/client/assets/{copy-4LfKIdQJ.js → copy-Dty8ZYsM.js} +1 -1
  159. package/dist/client/assets/{createLucideIcon-ClCdc3F9.js → createLucideIcon-Bt67PWH-.js} +1 -1
  160. package/dist/client/assets/discover-NDAqNvKt.js +2 -0
  161. package/dist/client/assets/embed-entry-BVR09F6e.js +2 -0
  162. package/dist/client/assets/{external-link-CnaI1QFS.js → external-link-Dem738OJ.js} +1 -1
  163. package/dist/client/assets/{eye-BFlhMzQL.js → eye-B3lBIwJZ.js} +1 -1
  164. package/dist/client/assets/{file-text-DG-pufl1.js → file-text-iF0hyVyU.js} +1 -1
  165. package/dist/client/assets/{home-moving-signal-aNJusIzL.js → home-moving-signal-C8dTXieA.js} +1 -1
  166. package/dist/client/assets/{home-now-card-BQK4EFHx.js → home-now-card-BgvVcE83.js} +1 -1
  167. package/dist/client/assets/{home-now-card-nano-CdtzqSIF.js → home-now-card-nano-hZl9klbP.js} +1 -1
  168. package/dist/client/assets/hooks-DBIezYS2.js +2 -0
  169. package/dist/client/assets/index-BMwKgdz_.js +1 -0
  170. package/dist/client/assets/index-Bu-fckyR.css +1 -0
  171. package/dist/client/assets/index-BxoufAPA.js +1 -0
  172. package/dist/client/assets/index-Cj7NnSxI.js +1 -0
  173. package/dist/client/assets/{index-CzVeWScw.js → index-o4FKpU7Z.js} +2 -2
  174. package/dist/client/assets/{inspector-panel-DgOM8nCo.js → inspector-panel-Dy2cVTCi.js} +2 -2
  175. package/dist/client/assets/{keyboard-nav-BJnFoFDP.js → keyboard-nav-Chf51dns.js} +1 -1
  176. package/dist/client/assets/{lane-roster-store-pR4ZaYQm.js → lane-roster-store-BiIVlYmG.js} +1 -1
  177. package/dist/client/assets/left-BC7p5QbT.js +1 -0
  178. package/dist/client/assets/left-BCSGqccQ.js +1 -0
  179. package/dist/client/assets/left-BSyj8PuJ.js +2 -0
  180. package/dist/client/assets/left-DDnxNUxd.js +1 -0
  181. package/dist/client/assets/left-DLoDKxT5.js +2 -0
  182. package/dist/client/assets/left-O-TBH7JB.js +1 -0
  183. package/dist/client/assets/left-agents-Dk9Y89lb.js +1 -0
  184. package/dist/client/assets/left-default-B3JBRQNJ.js +1 -0
  185. package/dist/client/assets/left-lanes-30Oe_3RM.js +1 -0
  186. package/dist/client/assets/left-mission-DEl4-7xu.js +1 -0
  187. package/dist/client/assets/left-plan-B4qdm4Gn.js +2 -0
  188. package/dist/client/assets/left-rvUOB14X.js +1 -0
  189. package/dist/client/assets/library-DDKSLFJ_.js +1 -0
  190. package/dist/client/assets/{loader-circle-Byb9kSFx.js → loader-circle-4LDsy4Ke.js} +1 -1
  191. package/dist/client/assets/{local-agents-DBaUbP-_.js → local-agents-DIi2EacM.js} +1 -1
  192. package/dist/client/assets/{mentions-fbQJ2mBI.js → mentions-CvDaviLJ.js} +1 -1
  193. package/dist/client/assets/{mesh-ops-Cnw3vwAu.js → mesh-ops-JZwGuAPn.js} +1 -1
  194. package/dist/client/assets/{mesh-view-store-Btlyc7rW.js → mesh-view-store-Du7VqIT_.js} +1 -1
  195. package/dist/client/assets/{message-circle-aGOfQWm2.js → message-circle-BM3XgevU.js} +1 -1
  196. package/dist/client/assets/{message-markup-mGF07emJ.js → message-markup-BcY1lShv.js} +1 -1
  197. package/dist/client/assets/{message-square-CIXda-Y7.js → message-square-ER1_q2pe.js} +1 -1
  198. package/dist/client/assets/{mission-control-store-CcoNeQHG.js → mission-control-store-C6w5iVfg.js} +1 -1
  199. package/dist/client/assets/{observe-BNFzh-7B.js → observe-3-jn4SXb.js} +1 -1
  200. package/dist/client/assets/{page-status-DDvNdA8s.js → page-status-0LPfBC8S.js} +1 -1
  201. package/dist/client/assets/{plus-CmFQp9Uj.js → plus-C-2gTcPK.js} +1 -1
  202. package/dist/client/assets/profile-DW80Gn5k.js +1 -0
  203. package/dist/client/assets/{projects-inbox-Diddml6e.js → projects-inbox-DCeD3FfV.js} +1 -1
  204. package/dist/client/assets/provider-BvAxRQfE.js +1 -0
  205. package/dist/client/assets/{radio-PauJIekM.js → radio-v7UAMZGh.js} +1 -1
  206. package/dist/client/assets/{refresh-cw-4oeFn1Jn.js → refresh-cw-B5To7b6B.js} +1 -1
  207. package/dist/client/assets/resolve-panes-BDi9Qx4R.js +1 -0
  208. package/dist/client/assets/resolve-sidebar-context-HE-5eZYa.js +1 -0
  209. package/dist/client/assets/right-BDf_yTv6.js +1 -0
  210. package/dist/client/assets/{right-BcFnuse9.js → right-BvoGOUKH.js} +1 -1
  211. package/dist/client/assets/right-C-bgjYg-.js +1 -0
  212. package/dist/client/assets/right-C3JdEfYQ.js +1 -0
  213. package/dist/client/assets/right-CYIs2tEe.js +1 -0
  214. package/dist/client/assets/right-CyRCv6Up.js +1 -0
  215. package/dist/client/assets/right-DBYGtoRv.js +1 -0
  216. package/dist/client/assets/right-o3LHMiKa.js +1 -0
  217. package/dist/client/assets/right-oPrcx9MX.js +1 -0
  218. package/dist/client/assets/right-sSvBUK-j.js +1 -0
  219. package/dist/client/assets/{rocket-C-AskjZH.js → rocket-BQQQv2L5.js} +1 -1
  220. package/dist/client/assets/router-C65cZYPn.js +1 -0
  221. package/dist/client/assets/{runtime-picker-BCQD7d4K.js → runtime-picker-eDEvx2Mz.js} +1 -1
  222. package/dist/client/assets/{scope-views-BhkbIFPY.js → scope-views-BOOmgmwx.js} +1 -1
  223. package/dist/client/assets/{scout-voice-S5_YZ2v8.js → scout-voice-B7kXlkcl.js} +1 -1
  224. package/dist/client/assets/{scroll-text-BV-BB7v-.js → scroll-text-BuneRiAD.js} +1 -1
  225. package/dist/client/assets/{search-C3bSJluv.js → search-7_n7CxWl.js} +1 -1
  226. package/dist/client/assets/{secondaryNavConfig-Bg4Tc0gT.js → secondaryNavConfig-CSFDCQAf.js} +1 -1
  227. package/dist/client/assets/{selection-bridge-B1dmkX3P.js → selection-bridge-SlGsgHw2.js} +1 -1
  228. package/dist/client/assets/{send-horizontal-CqogPmbY.js → send-horizontal-DP16OOIW.js} +1 -1
  229. package/dist/client/assets/{server-Brw5Y1Gh.js → server-pYOMFjrT.js} +1 -1
  230. package/dist/client/assets/{session-catalog-9FqXmjBw.js → session-catalog-_QfQ7fhZ.js} +1 -1
  231. package/dist/client/assets/{session-table-1xdSxSXq.js → session-table-CYN8e4s3.js} +1 -1
  232. package/dist/client/assets/{sliders-horizontal-CUiOH26y.js → sliders-horizontal-D2Z8gz6J.js} +1 -1
  233. package/dist/client/assets/{sparkles-BjCA3Evu.js → sparkles-Bth2iK7t.js} +1 -1
  234. package/dist/client/assets/{sse-QcU9bikk.js → sse-CL6gctHY.js} +1 -1
  235. package/dist/client/assets/{tail-events-C6K7bCWB.js → tail-events-NLIWLq27.js} +1 -1
  236. package/dist/client/assets/{terminal-DrTkVXIj.js → terminal-By1Lw2i2.js} +1 -1
  237. package/dist/client/assets/{terminal-relay-BkXjjSkq.js → terminal-relay-CjkI5aUy.js} +1 -1
  238. package/dist/client/assets/{terminal-sessions-C3qU8tnY.js → terminal-sessions-AmSgHklm.js} +1 -1
  239. package/dist/client/assets/{terminal-takeover-KvmTwABa.js → terminal-takeover-7AvNpnkC.js} +1 -1
  240. package/dist/client/assets/{use-conversation-list-C5sF6WBR.js → use-conversation-list-BCzY032j.js} +1 -1
  241. package/dist/client/assets/{use-fleet-active-asks-BOMPW0nl.js → use-fleet-active-asks-CJ6-oj5k.js} +1 -1
  242. package/dist/client/assets/{use-mesh-ops-items-Co05vcTV.js → use-mesh-ops-items-D5L-CKe_.js} +1 -1
  243. package/dist/client/assets/use-reduced-motion-CqXpVXv-.js +1 -0
  244. package/dist/client/assets/use-scout-dev-flags-BohC8seq.js +1 -0
  245. package/dist/client/assets/{useAgentHoverCard-FtCmY-b9.js → useAgentHoverCard-RsLUYyeh.js} +1 -1
  246. package/dist/client/assets/useContentSecondaryNav-DOr5yHbT.js +1 -0
  247. package/dist/client/assets/usePersistentState-D3M4m2Ou.js +1 -0
  248. package/dist/client/assets/{usePierreRuntime-Bo4lD7Ui.js → usePierreRuntime-B4hbNWTz.js} +1 -1
  249. package/dist/client/assets/{wrench-CeCdjiPF.js → wrench-M4G7WtYB.js} +1 -1
  250. package/dist/client/assets/{x-D4X_y1j_.js → x-ynOfVadO.js} +1 -1
  251. package/dist/client/assets/{xterm-D2a5wrkJ.js → xterm-DZHyijPp.js} +1 -1
  252. package/dist/client/index.html +2 -2
  253. package/dist/main.mjs +41 -26
  254. package/dist/node/main.mjs +19 -5
  255. package/dist/pairing-runtime-controller.mjs +2 -2
  256. package/dist/runtime/broker-daemon.mjs +2 -2
  257. package/dist/scout-control-plane-web.mjs +21 -7
  258. package/dist/scout-web-server.mjs +21 -7
  259. package/package.json +4 -4
  260. package/dist/client/assets/ActivityScreen-BXm6nJ6L.js +0 -1
  261. package/dist/client/assets/AgentConfigurationScreen-CfBXxrsD.js +0 -1
  262. package/dist/client/assets/AgentDefinitionsWorkspace-4Z0aN8AR.js +0 -1
  263. package/dist/client/assets/AgentFloorView-DMivAYHU.js +0 -1
  264. package/dist/client/assets/AgentInfoScreen-CPkLg1pK.js +0 -1
  265. package/dist/client/assets/AgentLanesEmbedScreen-CjHMvy3v.js +0 -1
  266. package/dist/client/assets/AgentsScreen-zR6b2bUL.js +0 -1
  267. package/dist/client/assets/AgentsSubnav-q0xcZi6C.js +0 -1
  268. package/dist/client/assets/BackToPicker-DZg_4nHL.js +0 -1
  269. package/dist/client/assets/BrokerScreen-Chh8sGen.js +0 -5
  270. package/dist/client/assets/ConversationFeedRows-5it6QNBV.js +0 -1
  271. package/dist/client/assets/ConversationPanels-vI9YuQJh.js +0 -2
  272. package/dist/client/assets/ConversationScreen-C-PrCRz1.js +0 -1
  273. package/dist/client/assets/FlightObserveScreen-Yq5NtQQJ.js +0 -1
  274. package/dist/client/assets/HarnessesScreen-L-emPcXd.js +0 -1
  275. package/dist/client/assets/KnowledgeSearchScreen-DvdOFh-b.js +0 -1
  276. package/dist/client/assets/LaneTraceDetailSheet-Dl7foF88.js +0 -1
  277. package/dist/client/assets/MeshScreen-D5zzTn0o.js +0 -1
  278. package/dist/client/assets/MessagesScreen-BhOJ7_tj.js +0 -1
  279. package/dist/client/assets/MissionControlView-D2JO9u-y.js +0 -1
  280. package/dist/client/assets/ObserveTextFlow-DJxQc2H6.js +0 -2
  281. package/dist/client/assets/OpenScoutAppShell-DrHYD_pd.js +0 -87
  282. package/dist/client/assets/OpsAgentsView-BnMX0vEY.js +0 -1
  283. package/dist/client/assets/OpsScreen-BeC0lieE.js +0 -1
  284. package/dist/client/assets/OpsSubnav-D5Bpowtk.js +0 -1
  285. package/dist/client/assets/ProjectAgentProfile-zE1cApxw.js +0 -1
  286. package/dist/client/assets/ProjectsInbox-C3Jd6JTk.js +0 -2
  287. package/dist/client/assets/ProjectsScreen-PW_NH5VK.js +0 -1
  288. package/dist/client/assets/ProjectsThreadAside-DaCEUWN1.js +0 -1
  289. package/dist/client/assets/Provider-DSsb2gLR.js +0 -1
  290. package/dist/client/assets/RawSessionsTable-LWEvXJzj.js +0 -1
  291. package/dist/client/assets/RealtimeVoiceScreen-XtxbCjOs.js +0 -1
  292. package/dist/client/assets/RepoDiffViewerLazy-DIxkiMto.js +0 -2
  293. package/dist/client/assets/ScoutDeckSurface-BCpl0QCx.js +0 -1
  294. package/dist/client/assets/ScoutbotBroadcastChip-z9R_pC_U.js +0 -2
  295. package/dist/client/assets/SessionRefScreen-Dk-O4OVt.js +0 -1
  296. package/dist/client/assets/SessionsScreen-BJEjuo2X.js +0 -1
  297. package/dist/client/assets/SettingsScreen-DJ-BhBwR.js +0 -1
  298. package/dist/client/assets/Terminal-Dp1FSGIS.js +0 -1
  299. package/dist/client/assets/TerminalEmbedScreen-DP9IM4xf.js +0 -1
  300. package/dist/client/assets/arrow-down-D3-IbArq.js +0 -1
  301. package/dist/client/assets/chunk-JTPDIGGW-s6WbxdjC.js +0 -46
  302. package/dist/client/assets/chunk-T65CQEWV-CiZ_ICHW.js +0 -1
  303. package/dist/client/assets/chunk-YOZR3KYS-DLOc92uD.js +0 -2
  304. package/dist/client/assets/content-7ZeCPAEt.js +0 -1
  305. package/dist/client/assets/content-BHUcUCH5.js +0 -1
  306. package/dist/client/assets/content-BUhvLPkv.js +0 -1
  307. package/dist/client/assets/content-BomQ5YWo.js +0 -1
  308. package/dist/client/assets/content-C39ELNgC.js +0 -1
  309. package/dist/client/assets/content-C4RYKHut.js +0 -1
  310. package/dist/client/assets/content-CCiZfG4H.js +0 -1
  311. package/dist/client/assets/content-CDpDtVI-.js +0 -1
  312. package/dist/client/assets/content-CO-9CeFd.js +0 -1
  313. package/dist/client/assets/content-CuOLxp1x.js +0 -1
  314. package/dist/client/assets/content-CvtLIjXS.js +0 -1
  315. package/dist/client/assets/content-CzwTUb9n.js +0 -1
  316. package/dist/client/assets/content-DQXbo2RO.js +0 -1
  317. package/dist/client/assets/content-DRTQ9QQb.js +0 -1
  318. package/dist/client/assets/content-LCELs6zg.js +0 -1
  319. package/dist/client/assets/content-qsDjA4Au.js +0 -1
  320. package/dist/client/assets/conversation-motion-features-T8vF9zED.js +0 -1
  321. package/dist/client/assets/discover-7Ks00w-M.js +0 -2
  322. package/dist/client/assets/embed-entry-n2ThmSSX.js +0 -2
  323. package/dist/client/assets/gestures-CxG3Dphs.js +0 -1
  324. package/dist/client/assets/hooks-Dst1TH7n.js +0 -2
  325. package/dist/client/assets/index-9as_JTUs.css +0 -1
  326. package/dist/client/assets/index-CU9dtwJk.js +0 -1
  327. package/dist/client/assets/index-Dewd56RX.js +0 -1
  328. package/dist/client/assets/index-_YQXKEhb.js +0 -1
  329. package/dist/client/assets/left-BhzPp-_E.js +0 -1
  330. package/dist/client/assets/left-CN1MABD0.js +0 -2
  331. package/dist/client/assets/left-DDgbsio7.js +0 -1
  332. package/dist/client/assets/left-Dpf2R9uD.js +0 -1
  333. package/dist/client/assets/left-HwwbMVtl.js +0 -2
  334. package/dist/client/assets/left-YfH0daht.js +0 -1
  335. package/dist/client/assets/left-agents-CYUwAy2Z.js +0 -1
  336. package/dist/client/assets/left-default-vEGZALPv.js +0 -1
  337. package/dist/client/assets/left-lanes-bphF-vlX.js +0 -1
  338. package/dist/client/assets/left-mission-B54-c3hq.js +0 -1
  339. package/dist/client/assets/left-np5USKqG.js +0 -1
  340. package/dist/client/assets/left-plan-BNBuDoPQ.js +0 -2
  341. package/dist/client/assets/library-DbCVJG_O.js +0 -1
  342. package/dist/client/assets/paperclip-DfpJkR4s.js +0 -1
  343. package/dist/client/assets/profile-s3KRbip1.js +0 -1
  344. package/dist/client/assets/resolve-panes-cp6eNewO.js +0 -1
  345. package/dist/client/assets/resolve-sidebar-context-Dbo-5PWx.js +0 -1
  346. package/dist/client/assets/right-09W2JJFg.js +0 -1
  347. package/dist/client/assets/right-B-MKhiJ6.js +0 -1
  348. package/dist/client/assets/right-B91Zl8lQ.js +0 -1
  349. package/dist/client/assets/right-BdtMzn35.js +0 -1
  350. package/dist/client/assets/right-BqmKXLtf.js +0 -1
  351. package/dist/client/assets/right-BzeB-Dpt.js +0 -1
  352. package/dist/client/assets/right-CkGOs-sq.js +0 -1
  353. package/dist/client/assets/right-CzGiNBzB.js +0 -1
  354. package/dist/client/assets/right-Dc7uqv7l.js +0 -1
  355. package/dist/client/assets/router-B-K15T7B.js +0 -1
  356. package/dist/client/assets/use-reduced-motion-Dla-G_Jz.js +0 -1
  357. package/dist/client/assets/use-scout-dev-flags-BOQF3fW2.js +0 -1
  358. package/dist/client/assets/useContentSecondaryNav-BX7Sq7vy.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as i,j as e}from"./index-o4FKpU7Z.js";import{u as ct}from"./Provider-DKZWuzSR.js";import{o as $e}from"./openContent-C6XO6kr5.js";import{a as B}from"./api-h5zurxmi.js";import{u as rt}from"./sse-CL6gctHY.js";import{u as lt}from"./tail-events-NLIWLq27.js";import{n as ot,a as dt,s as Me,c as _e}from"./colors-BtO5_zlx.js";import{A as ut}from"./AgentLiveActions-0iy8QZ1T.js";import{i as mt}from"./message-visibility-kJM8XcSG.js";import{o as pt,q as ht,s as vt,m as xt,c as Be,u as ft}from"./conversation-model-CHwHZNw-.js";import{c as jt,e as gt,t as W,f as oe}from"./time-Dhsh_2EG.js";import{d as Nt}from"./router-C65cZYPn.js";import{T as yt}from"./TmuxPeek-DLyDkq_D.js";import{S as It}from"./scroll-text-BuneRiAD.js";import"./provider-BvAxRQfE.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-CxkmFQcN.js";import"./DocumentFocusViewer-DRKjNG9s.js";import"./createLucideIcon-Bt67PWH-.js";import"./TextDocumentSurface-Bc-kHPgG.js";/* empty css */import"./file-text-iF0hyVyU.js";import"./x-ynOfVadO.js";import"./chevron-right-C10o7t_X.js";import"./code-xml-CLn3TDWF.js";import"./arrow-left-BOht-YQu.js";import"./scout-voice-B7kXlkcl.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-Chf51dns.js";import"./MessageComposerSuggestions-Dfc3PH2y.js";import"./NewChatComposer-S08F6_La.js";import"./runtime-picker-eDEvx2Mz.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-4LDsy4Ke.js";import"./index-BMwKgdz_.js";import"./HarnessMark-MztYnrGK.js";import"./NewChatOrigin-BEz6jyqf.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-NAhBUkFd.js";import"./search-7_n7CxWl.js";import"./chunk-HRAB3GC3-DF8R9rPv.js";import"./index-BWHgHrtv.js";import"./terminal-takeover-7AvNpnkC.js";import"./eye-B3lBIwJZ.js";import"./terminal-By1Lw2i2.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-AmSgHklm.js";/* empty css */import"./refresh-cw-B5To7b6B.js";const wt=20;function de(t){if(!t)return null;const s=t.replace(/[\\/]+$/,"");return s?s.split(/[\\/]/).filter(Boolean).at(-1)??s:null}function ue(t){const s=t?.trim();return s?s.length>18?`${s.slice(0,8)}...${s.slice(-6)}`:s:null}function b(t){const s=new Set,a=[];for(const c of t){const m=c?.trim();if(!m)continue;const h=m.toLowerCase();s.has(h)||(s.add(h),a.push(m))}return a}function Ue(t,s){const a=t?.trim().replace(/[\\/]+$/,""),c=s.trim().replace(/[\\/]+$/,"");if(!a||!c)return!1;if(a===c)return!0;if(c.startsWith("~/")){const m=c.slice(1);if(a.endsWith(m)||a.includes(`${m}/`))return!0}if(a.startsWith("~/")){const m=a.slice(1);if(c.endsWith(m)||c.includes(`${m}/`))return!0}return a.startsWith(`${c}/`)||c.startsWith(`${a}/`)}function Fe(t,s){const a=t?.trim().toLowerCase(),c=s.trim().toLowerCase();return!a||!c?!1:a.includes(c)||c.includes(a)}function Ve(t,s){const a=t?.trim().toLowerCase(),c=s.trim().toLowerCase();return!a||!c?!1:a===c}function St(t){const{activeSessionId:s,agent:a,sessionMeta:c}=t,m=b([s,a?.harnessSessionId]),h=b([a?.cwd,a?.projectRoot,c?.workspaceRoot]),r=b([a?.project,de(a?.cwd),de(a?.projectRoot),de(c?.workspaceRoot)]).filter(U=>U.length>2),o=b([...m.slice(0,2),...r.slice(0,2)]).join("|");return{sessionIds:m,paths:h,projects:r,query:o}}function he(t,s){return!!(s.sessionIds.some(a=>Fe(t.sessionId,a))||s.paths.some(a=>Ue(t.cwd,a))||s.projects.some(a=>Ve(t.project,a)))}function Tt(t,s){const a=s.filter(r=>he(r,t)),c=b(a.filter(r=>t.sessionIds.some(o=>Fe(r.sessionId,o))).map(r=>r.sessionId));if(c[0])return c[0];const m=b(a.filter(r=>t.paths.some(o=>Ue(r.cwd,o))).map(r=>r.sessionId));if(m[0])return m[0];const h=b(a.filter(r=>t.projects.some(o=>Ve(r.project,o))).map(r=>r.sessionId));return h[0]?h[0]:t.paths[0]?t.paths[0]:t.sessionIds[0]?t.sessionIds[0]:t.projects[0]?t.projects[0]:t.query}function X(t,s){const a=new Map;for(const c of[...s,...t])a.set(c.id,c);return[...a.values()].sort((c,m)=>jt(c.ts,m.ts)).slice(0,wt)}function bt(t){return t==="tool-result"?"tool result":t}function kt(t){const s=t.replace(/\s+/g," ").trim();return s.length<=180?s:`${s.slice(0,177)}...`}const At={direct:"Conversation",channel:"Conversation",group_direct:"Conversation",thread:"Thread"},Ct=1800,Et=4800,We=2,Lt=120,Rt=650,Pt=1800;function me(t,s){try{return JSON.stringify(t)===JSON.stringify(s)?t:s}catch{return s}}function ze(t){if(!t)return null;const s=t.replace(/[\\/]+$/,"");return s?s.split(/[\\/]/).filter(Boolean).at(-1)??s:null}function $t(t){if(!t)return null;const s=t.replace(/[\\/]+$/,"");return s?s.replace(/^\/Users\/[^/]+(?=\/|$)/,"~"):null}function z(t){switch(t){case"queued":return"Queued";case"waking":return"Waking";case"waiting":return"Thinking";case"running":return"Working";default:return t.replace(/_/g," ")}}function zs(){const{route:t,agents:s,navigate:a,apiConnection:c,reload:m}=ct(),h=Nt(t),r=t.view==="conversation"||t.view==="messages"?t.conversationId??null:null,[o,U]=i.useState(null),[E,ve]=i.useState([]),[G,xe]=i.useState(null),[He,F]=i.useState(!1),V=i.useCallback(async()=>{if(!r){U(null),ve([]),xe(null),F(!0);return}try{const[n,l,f]=await Promise.all([B(`/api/session/${encodeURIComponent(r)}`).catch(()=>null),B(`/api/flights?conversationId=${encodeURIComponent(r)}`).catch(()=>[]),B(`/api/messages?conversationId=${encodeURIComponent(r)}&limit=8`).catch(()=>[])]);U(p=>me(p,n)),ve(p=>me(p,l??[])),xe(p=>me(p,f?.filter(_=>!mt(_)).sort((_,it)=>gt(_.createdAt,it.createdAt)).at(-1)??null)),F(!0)}catch{F(!0)}},[r]);i.useEffect(()=>{F(!1),V()},[V]);const j=o?.agentId??null,d=i.useMemo(()=>j?s.find(n=>n.id===j)??null:null,[s,j]),H=d?.id??null,fe=pt(o),ee=ht({resolvedAgentId:H,sessionId:fe,machineId:h}),[je,ge]=i.useState(null),[L,te]=i.useState([]),[w,se]=i.useState([]),Ne=i.useRef([]),S=i.useRef(null),q=i.useRef(null),x=i.useRef([]),g=i.useRef(null),N=i.useRef(null),R=i.useRef(new Set),O=i.useCallback(()=>{S.current!==null&&(window.clearTimeout(S.current),S.current=null),q.current=null},[]),P=i.useCallback(()=>{if(!r)return;const n=Date.now(),l=q.current??n;q.current=l;const p=n-l>=Et?0:Ct;S.current!==null&&window.clearTimeout(S.current),S.current=window.setTimeout(()=>{S.current=null,q.current=null,V()},p)},[r,V]);i.useEffect(()=>O,[O]),i.useEffect(()=>{if(ge(null),!H)return;let n=!1;return B(`/api/agents/${encodeURIComponent(H)}/session-catalog`).then(l=>{n||ge(l)}).catch(()=>{}),()=>{n=!0}},[H]);const qe=vt({name:d?.name,agentName:o?.agentName,id:j,title:o?.title}),ye=d?xt(d)??Be(d.id)??d.id:j?Be(j)??j:null,u=i.useMemo(()=>E.filter(ft).sort((n,l)=>(l.startedAt??0)-(n.startedAt??0))[0]??null,[E]);i.useEffect(()=>{R.current=new Set(E.map(n=>n.invocationId))},[E]),i.useEffect(()=>{O(),R.current.clear()},[O,r]),rt(n=>{if(r){if(n.kind==="message.posted"){n.payload?.message?.conversationId===r&&P();return}if(n.kind==="conversation.upserted"){n.payload?.conversation?.id===r&&P();return}if(n.kind==="invocation.requested"){const l=n.payload?.invocation;if(l?.conversationId===r){R.current.add(l.id),P();return}!l?.conversationId&&j&&l?.targetAgentId===j&&(R.current.add(l.id),P());return}if(n.kind==="flight.updated"){const l=n.payload?.flight;if(!l)return;(u?.id===l.id||u?.invocationId===l.invocationId||R.current.has(l.invocationId)||E.some(p=>p.id===l.id||p.invocationId===l.invocationId))&&P()}}});const v=je?.activeSessionId??d?.harnessSessionId??fe??o?.harnessSessionId??null,I=d?.harnessSessionId??o?.harnessSessionId??null,k=d?.harnessLogPath??null,y=i.useMemo(()=>St({activeSessionId:v,agent:d,sessionMeta:o}),[v,d,o]),ne=JSON.stringify({sessionIds:y.sessionIds,paths:y.paths,projects:y.projects}),$=y.sessionIds.length>0||y.paths.length>0||y.projects.length>0,D=i.useCallback(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null),N.current!==null&&(window.clearInterval(N.current),N.current=null),x.current=[]},[]),K=i.useCallback(()=>{D()},[D]),Ie=i.useCallback(()=>{if(N.current!==null||(g.current!==null&&(window.clearTimeout(g.current),g.current=null),x.current.length===0))return;const l=()=>{const f=x.current.slice(0,We);x.current=x.current.slice(We),f.length>0&&se(p=>X(p,f)),!(x.current.length>0)&&N.current!==null&&(window.clearInterval(N.current),N.current=null)};l(),x.current.length>0&&(N.current=window.setInterval(l,Lt))},[]),we=i.useCallback(n=>{N.current===null&&g.current===null&&(g.current=window.setTimeout(()=>{g.current=null,Ie()},n))},[Ie]);i.useEffect(()=>{Ne.current=w},[w]),i.useEffect(()=>D,[D]),i.useEffect(()=>{K(),te([]),se([])},[K,ne]),i.useEffect(()=>{if(!$)return;let n=!1;const l=new URLSearchParams({limit:"180",transcripts:"true"});return B(`/api/tail/recent?${l.toString()}`).then(f=>{if(n)return;const p=(f.events??[]).filter(_=>he(_,y));te(X([],p))}).catch(()=>{}),()=>{n=!0}},[$,ne]),lt(i.useCallback(n=>{$&&he(n,y)&&te(l=>X(l,[n]))},[$,ne])),i.useEffect(()=>{if(L.length===0){K(),se([]);return}const n=Ne.current,l=new Set([...n.map(p=>p.id),...x.current.map(p=>p.id)]),f=L.filter(p=>!l.has(p.id));f.length!==0&&(x.current=X(x.current,f),x.current.length>0&&we(n.length===0?Rt:Pt))},[we,K,L]);const ae=i.useMemo(()=>w.flatMap(Bt).slice(0,5),[w]);if(!r)return e.jsx(Mt,{apiOffline:c.status==="offline",onRetry:()=>{m()}});if(!He)return e.jsx("div",{className:"ctx-panel ctx-panel--conversation",children:e.jsx("div",{className:"ctx-panel-empty-state",children:e.jsx("div",{className:"ctx-panel-empty-hint",children:"Loading conversation…"})})});const Oe=o?.kind?At[o.kind]??o.kind:"Conversation",J=o?.workspaceRoot??null,ie=ze(J),Q=$t(J),Se=o?.currentBranch??null,ce=d?.harness??o?.harness??null,Y=o?.lastMessageAt??G?.createdAt??null,Te=o?.messageCount??null,be=o?o.participantIds.filter(n=>n!=="operator").length+1:null,A=d?.state??null,De=ot(A),ke=G?.body?.trim()||o?.preview?.trim()||null,Ae=G?.actorName??null,Ce=ue(v),M=v??I,Ee=ue(M),Ke=ue(I),Le=!!(I&&I!==M),Re=[ce,d?.transport].filter(Boolean).join(" · "),Je=!!(v||I||k),T=!!(d?.terminalSurface?.backend==="tmux"||d?.transport==="tmux"&&d.harnessSessionId),C=!!(u||dt(A,d)),Qe=C?u?z(u.state):"In motion":"At rest",Ye=u?.summary?.trim()??(Y?`Last update ${W(Y)??"recently"}`:"No recent activity recorded"),re=[Se?`branch ${Se}`:null,ce,d?.transport].filter(Boolean),Ze=!!(ie||Q||re.length>0),Xe=C?"Live activity":T?"Terminal":"Activity",le=u?.summary?.trim()??(v&&!T?"Terminal session is live.":w.length>0&&!T?"Streaming matching Tail events.":null),Z=Tt(y,L),Ge=!!(d&&(u||v||L.length>0||T)),et=!T,tt=v?T?"Terminal session":"Trace session":u?"Session starting":"Session context",st=v?Ee??v:u?z(u.state):"Waiting for a session id",Pe=v?[ce,d?.transport,u?z(u.state):null].filter(Boolean).join(" · "):u?.summary?.trim()??le??null,nt=()=>{ee&&$e(a,ee,{returnTo:t})},at=()=>{$e(a,{view:"ops",mode:"tail",...Z?{tailQuery:Z}:{}},{returnTo:t})};return e.jsxs("div",{className:"ctx-panel ctx-panel--conversation",children:[e.jsxs("section",{className:"ctx-panel-section ctx-panel-conversation-summary",children:[e.jsx("div",{className:"ctx-panel-section-label",children:Oe}),e.jsxs("div",{className:"ctx-panel-conversation-card",children:[e.jsx("div",{className:"ctx-panel-conversation-title",children:qe}),ye&&e.jsxs("div",{className:"ctx-panel-conversation-handle",children:["@",ye]}),e.jsxs("div",{className:"ctx-panel-conversation-state",children:[e.jsx("span",{className:"ctx-panel-conversation-state-dot",style:{background:Me(A)}}),e.jsx("span",{children:_e(A)})]})]})]}),u&&e.jsxs("section",{className:"ctx-panel-section",children:[e.jsx("div",{className:"ctx-panel-section-label",children:"Now"}),e.jsxs("div",{className:"ctx-panel-conversation-flight",children:[e.jsxs("div",{className:"ctx-panel-conversation-flight-row",children:[e.jsx("span",{className:"ctx-panel-conversation-flight-label",children:z(u.state)}),u.startedAt&&e.jsx("span",{className:"ctx-panel-conversation-flight-time",children:W(u.startedAt)})]}),u.summary&&e.jsx("div",{className:"ctx-panel-conversation-flight-summary",children:u.summary})]})]}),e.jsxs("section",{className:"ctx-panel-section",children:[e.jsx("div",{className:"ctx-panel-section-label",children:"Workspace"}),Ze?e.jsxs("div",{className:"ctx-panel-workspace-card",children:[e.jsxs("div",{className:"ctx-panel-workspace-head",children:[e.jsx("div",{className:"ctx-panel-workspace-kicker",children:"Project"}),e.jsx("div",{className:"ctx-panel-workspace-title",title:J??ie??void 0,children:ie??"Unscoped workspace"})]}),Q&&e.jsx("div",{className:"ctx-panel-workspace-path",title:J??Q,children:Q}),re.length>0&&e.jsx("div",{className:"ctx-panel-workspace-strip",children:re.map(n=>e.jsx("span",{className:"ctx-panel-workspace-chip",children:n},n))})]}):e.jsx("div",{className:"ctx-panel-empty",children:"No workspace metadata yet"})]}),Je&&e.jsxs("section",{className:"ctx-panel-section",children:[e.jsx("div",{className:"ctx-panel-section-label",children:"Session"}),e.jsxs("div",{className:"ctx-panel-session-card",children:[e.jsx("div",{className:"ctx-panel-session-head",children:e.jsxs("div",{className:"ctx-panel-session-primary",children:[Re&&e.jsx("div",{className:"ctx-panel-session-kind",children:Re}),M&&e.jsx("div",{className:"ctx-panel-session-id",title:M,children:Ee??M})]})}),(Le||k)&&e.jsxs("div",{className:"ctx-panel-session-meta",children:[Le&&I&&e.jsxs("div",{className:"ctx-panel-session-meta-item",children:[e.jsx("span",{children:"Harness session"}),e.jsx("strong",{title:I,children:Ke??I})]}),k&&e.jsxs("div",{className:"ctx-panel-session-meta-item",children:[e.jsx("span",{children:"Harness log"}),e.jsx("strong",{title:k,children:ze(k)??k})]})]})]})]}),e.jsxs("section",{className:"ctx-panel-section",children:[e.jsx("div",{className:"ctx-panel-section-label",children:"Activity"}),e.jsxs("div",{className:`ctx-panel-activity-card${C?" ctx-panel-activity-card--active":""}`,children:[e.jsxs("div",{className:"ctx-panel-activity-head",children:[e.jsx("span",{className:"ctx-panel-activity-dot",style:{background:C?"var(--green)":Me(A)}}),e.jsxs("div",{className:"ctx-panel-activity-main",children:[e.jsx("div",{className:"ctx-panel-activity-title",children:Qe}),e.jsx("div",{className:"ctx-panel-activity-sub",title:Y?oe(Y):void 0,children:Ye})]})]}),u&&e.jsxs("div",{className:"ctx-panel-activity-ledger",children:[e.jsx("span",{className:"ctx-panel-activity-ledger-label",children:z(u.state)}),u.startedAt&&e.jsx("span",{className:"ctx-panel-activity-ledger-time",title:oe(u.startedAt),children:W(u.startedAt)})]}),e.jsxs("div",{className:"ctx-panel-activity-facts",children:[typeof Te=="number"&&e.jsx(pe,{label:"Messages",value:`${Te}`}),typeof be=="number"&&e.jsx(pe,{label:"People",value:`${be}`}),De&&e.jsx(pe,{label:"Agent",value:_e(A)})]})]})]}),ke&&e.jsxs("section",{className:"ctx-panel-section ctx-panel-conversation-preview",children:[e.jsx("div",{className:"ctx-panel-section-label",children:Ae?`Latest · ${Ae}`:"Latest"}),e.jsx("div",{className:"ctx-panel-conversation-preview-body",children:ke})]}),Ge&&d&&e.jsxs("section",{className:"ctx-panel-section ctx-panel-conversation-live-section",children:[e.jsxs("div",{className:"ctx-panel-section-label",children:[e.jsx("span",{children:Xe}),Ce&&e.jsx("span",{className:"ctx-panel-live-session",title:v??void 0,children:Ce})]}),e.jsxs("div",{className:`ctx-panel-live-card${C?" ctx-panel-live-card--active":""}`,children:[e.jsxs("div",{className:`ctx-panel-live-session-card${C?" ctx-panel-live-session-card--active":""}`,children:[e.jsxs("div",{className:"ctx-panel-live-session-copy",children:[e.jsx("span",{children:tt}),e.jsx("strong",{title:v??void 0,children:st}),Pe&&e.jsx("small",{children:Pe})]}),e.jsx("div",{className:"ctx-panel-live-session-pulse","aria-hidden":"true",children:e.jsx("span",{})})]}),e.jsx(ut,{agent:d,catalog:je,navigate:a,returnTo:t,variant:"compact",className:"ctx-panel-live-actions"}),le&&e.jsx("div",{className:"ctx-panel-live-summary",children:le}),T&&e.jsx(yt,{agentId:d.id,lines:24,columns:132,className:"ctx-panel-tmux-peek--conversation"}),ae.length>0&&e.jsxs("div",{className:"ctx-panel-live-files","aria-live":"polite",children:[e.jsxs("div",{className:"ctx-panel-live-files-label",children:[e.jsx("span",{children:"Files"}),e.jsx("strong",{children:ae.length})]}),e.jsx("ol",{className:"ctx-panel-live-file-list",children:ae.map(n=>e.jsxs("li",{className:`ctx-panel-live-file ctx-panel-live-file--${n.tone}`,title:`${n.path} · ${n.verb}`,children:[e.jsx("span",{className:"ctx-panel-live-file-mark",children:n.mark}),e.jsx("span",{className:"ctx-panel-live-file-path",children:Ft(n.path)}),e.jsx("span",{className:"ctx-panel-live-file-time",children:W(n.ts)})]},`${n.eventId}:${n.path}`))})]}),et&&e.jsx("div",{className:"ctx-panel-live-stream","aria-live":"polite",children:w.length>0?e.jsx("ol",{className:"ctx-panel-live-events",children:w.map(n=>e.jsxs("li",{className:"ctx-panel-live-event",children:[e.jsx("span",{className:"ctx-panel-live-event-kind",children:bt(n.kind)}),e.jsx("span",{className:"ctx-panel-live-event-summary",children:kt(n.summary)}),e.jsx("span",{className:"ctx-panel-live-event-time",title:oe(n.ts),children:W(n.ts)})]},n.id))}):e.jsx("div",{className:"ctx-panel-live-stream-empty",children:"Waiting for matching Tail events"})}),$&&e.jsxs("button",{type:"button",className:"ctx-panel-live-tail-button",onClick:at,title:Z?`Tail filter: ${Z}`:"Open Tail",children:[e.jsx(It,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Tail"})]})]})]}),ee&&e.jsx("section",{className:"ctx-panel-section ctx-panel-conversation-profile-section",children:e.jsxs("button",{type:"button",className:"ctx-panel-roster-button ctx-panel-conversation-profile-button",onClick:nt,children:[e.jsx("span",{className:"ctx-panel-roster-label",children:d?"Open agent profile":"Open session trace"}),e.jsx("span",{className:"ctx-panel-roster-count",children:e.jsx("span",{children:"→"})})]})})]})}function Mt({apiOffline:t,onRetry:s}){return e.jsx("div",{className:"ctx-panel ctx-panel--conversation",children:e.jsx("div",{className:"ctx-panel-empty-state",children:e.jsxs("div",{className:"ctx-panel-empty-card","data-tone":t?"error":"neutral",children:[e.jsx("div",{className:"ctx-panel-empty-card-title",children:t?"Context unavailable":"No conversation selected"}),e.jsx("div",{className:"ctx-panel-empty-card-detail",children:t?"Scout context will load after the server reconnects.":"Select a chat to inspect participants, sessions, and recent activity."}),t&&e.jsx("button",{type:"button",className:"ctx-panel-empty-card-action",onClick:s,children:"Retry"})]})})})}function pe({label:t,value:s}){return e.jsxs("div",{className:"ctx-panel-fact",children:[e.jsx("span",{className:"ctx-panel-fact-value",children:s}),e.jsx("span",{className:"ctx-panel-fact-label",children:t})]})}const _t=/(?:["'`])?((?:~|\/|\.{1,2}\/|[A-Za-z0-9_.-]+\/)[^\s"'`),;]+?\.(?:ts|tsx|js|jsx|mjs|cjs|css|scss|swift|md|json|jsonc|yml|yaml|toml|sql|py|rs|go|sh|html|m|mm))(?:["'`])?/gi;function Bt(t){const s=new Set,a=[],c=Wt(t.summary);for(const m of t.summary.matchAll(_t)){const h=m[1]?.trim();if(!h)continue;const r=h.toLowerCase();s.has(r)||(s.add(r),a.push({eventId:t.id,path:h,verb:c,mark:Ut(c),tone:zt(c),ts:t.ts}))}return a}function Wt(t){return/\b(created|create|wrote|write|edited|edit|modified|modify|updated|update|changed|change|patched|patch)\b/i.test(t)?"changed":/\b(read|opened|viewed|cat|sed)\b/i.test(t)?"read":"touched"}function zt(t){return t==="changed"?"changed":t==="read"?"read":"touched"}function Ut(t){return t==="changed"?"+":t==="read"?"r":"·"}function Ft(t){const s=t.replace(/[\\/]+$/g,""),a=s.split(/[\\/]/).filter(Boolean);return a.length<=2?s:`${a.at(-2)}/${a.at(-1)}`}export{zs as ConversationInspector};
@@ -0,0 +1 @@
1
+ import{r as p,j as s}from"./index-o4FKpU7Z.js";import{u as R,s as v,a as b}from"./mesh-view-store-Du7VqIT_.js";import{u as E}from"./local-agents-DIi2EacM.js";import{n as _,b as B,a as P}from"./colors-BtO5_zlx.js";import{a as g}from"./api-h5zurxmi.js";import{t as U}from"./time-Dhsh_2EG.js";/* empty css *//* empty css */import"./Provider-DKZWuzSR.js";import"./provider-BvAxRQfE.js";import"./router-C65cZYPn.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-AmSgHklm.js";import"./sse-CL6gctHY.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-CxkmFQcN.js";import"./DocumentFocusViewer-DRKjNG9s.js";import"./createLucideIcon-Bt67PWH-.js";import"./TextDocumentSurface-Bc-kHPgG.js";/* empty css */import"./file-text-iF0hyVyU.js";import"./x-ynOfVadO.js";import"./chevron-right-C10o7t_X.js";import"./code-xml-CLn3TDWF.js";import"./arrow-left-BOht-YQu.js";import"./scout-voice-B7kXlkcl.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-Chf51dns.js";import"./MessageComposerSuggestions-Dfc3PH2y.js";import"./NewChatComposer-S08F6_La.js";import"./runtime-picker-eDEvx2Mz.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-4LDsy4Ke.js";import"./index-BMwKgdz_.js";import"./HarnessMark-MztYnrGK.js";import"./conversation-model-CHwHZNw-.js";import"./NewChatOrigin-BEz6jyqf.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-NAhBUkFd.js";import"./search-7_n7CxWl.js";import"./chunk-HRAB3GC3-DF8R9rPv.js";function D(e){return e.issues.some(t=>t.code==="mesh_loopback")?"loopback":e.identity.discoverable?"discoverable":e.tailscale.available?e.tailscale.running?"local-only":"tailnet-stopped":"unavailable"}function F(e){const t=new Map;for(const i of e){const r=(i.harness??i.agentClass??"agent").toLowerCase(),c=t.get(r)??{total:0,working:0};c.total+=1,P(i.state)&&(c.working+=1),t.set(r,c)}return Array.from(t.entries()).map(([i,r])=>({label:i,total:r.total,working:r.working})).sort((i,r)=>r.total-i.total).slice(0,6)}function S(e){return e?e.replace(/^https?:\/\//,"").split("/")[0]??e:"Unavailable"}function z(e){return e.split("/")[0]}function H(e){return new Promise(t=>window.setTimeout(t,e))}async function T(e,t){let i=null,r=null;for(let c=0;c<=t.attempts;c+=1){try{if(i=await g("/api/mesh"),v(i),e(i))return i}catch(u){r=u}c<t.attempts&&await H(t.intervalMs)}if(i)return i;throw r instanceof Error?r:new Error("Mesh status is temporarily unavailable.")}function W(e){return e.issues.find(t=>t.code==="local_only"||t.code==="mesh_loopback"||t.code==="tailscale_stopped")?.summary??null}function _s(){const{meshSnapshot:e,selectedId:t,selectedType:i,probeCache:r}=R(),{agents:c}=E(),[u,f]=p.useState(!1),[C,k]=p.useState(!1),[x,h]=p.useState(null),A=p.useCallback(async()=>{f(!0),h({tone:"info",text:"Restarting broker with mesh discovery enabled..."});try{const l=await g("/api/mesh/announce",{method:"POST",body:"{}"});v(l);const a=l.identity.discoverable?l:await T(n=>n.identity.discoverable,{attempts:6,intervalMs:750});a.identity.discoverable?h({tone:"success",text:`Discoverable at ${S(a.identity.announceUrl??a.brokerUrl)}.`}):h({tone:"warning",text:W(a)??"Scout restarted the broker, but it is not discoverable yet."})}catch(l){h({tone:"error",text:l instanceof Error?l.message:String(l)})}finally{f(!1)}},[]),M=p.useCallback(async()=>{k(!0),h({tone:"info",text:"Opening Tailscale and waiting for the backend..."});try{const l=await g("/api/mesh/tailscale",{method:"POST",body:JSON.stringify({action:"open_app"})});v(l);const a=l.tailscale.running?l:await T(n=>n.tailscale.running,{attempts:12,intervalMs:1e3});a.tailscale.running?h({tone:"success",text:`Tailscale is running with ${a.tailscale.onlineCount} online peer${a.tailscale.onlineCount===1?"":"s"}.`}):h({tone:"warning",text:`Tailscale opened, but the backend is still ${a.tailscale.backendState??"not running"}. Finish startup or sign-in in Tailscale.app.`})}catch(l){h({tone:"error",text:l instanceof Error?l.message:String(l)})}finally{k(!1)}},[]),y=p.useMemo(()=>{const l={total:c.length,working:0,ready:0,notReady:0};for(const a of c){const n=_(a.state);n==="in_turn"||n==="in_flight"?l.working+=1:n==="callable"?l.ready+=1:l.notReady+=1}return l},[c]),w=p.useMemo(()=>F(c),[c]);if(!e)return s.jsx("div",{className:"sys-inspector-empty",children:s.jsx("p",{children:"Loading mesh…"})});if(t?.startsWith("tailnet:")&&i==="node"){const l=t.slice(8),a=e.tailscale.peers.find(m=>m.id===l),n=r[t]??null,d=a?.addresses?.[0]?z(a.addresses[0]):null,N=a?.hostName?.split(".")[0]??a?.hostName??"Tailnet peer";return s.jsxs("div",{className:"sys-inspector-content",children:[s.jsxs("div",{className:"sys-inspector-head",children:[s.jsx("h3",{className:"sys-inspector-title",children:N}),s.jsx("span",{className:`sys-chip sys-chip-${a?.online?"success":"failed"}`,children:a?.online?"Online":"Offline"})]}),s.jsxs("div",{className:"sys-detail-grid",children:[d&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Address"}),s.jsx("code",{className:"sys-detail-value",children:d})]}),a?.os&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Platform"}),s.jsx("span",{className:"sys-detail-value",children:a.os})]}),n?.result?.node?.meshId&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Mesh ID"}),s.jsxs("code",{className:"sys-detail-value",children:[n.result.node.meshId.slice(0,14),"…"]})]}),n?.result?.node?.name&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Node name"}),s.jsx("span",{className:"sys-detail-value",children:n.result.node.name})]})]}),(!n||n.status==="loading")&&s.jsx("div",{className:"sys-banner sys-banner-muted",style:{marginTop:8},children:s.jsx("span",{children:"Connecting to Scout broker…"})}),n?.status==="error"&&s.jsxs("div",{className:"sys-banner sys-banner-warning",style:{marginTop:8},children:[s.jsx("strong",{children:"Broker unreachable."}),s.jsx("span",{children:n.result?.error??"Could not reach the remote broker."})]}),n?.status==="done"&&n.result?.node?.capabilities?.length&&s.jsxs("div",{style:{marginTop:10},children:[s.jsx("div",{className:"sys-inspector-section-label",children:"Capabilities"}),s.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:n.result.node.capabilities.map(m=>s.jsx("span",{className:"sys-chip sys-chip-neutral",children:m},m))})]}),n?.status==="done"&&n.result?.home&&s.jsxs("div",{style:{marginTop:14},children:[s.jsxs("div",{className:"sys-inspector-section-label",children:["Agents — ",n.result.home.agents.length," registered"]}),n.result.home.agents.length===0?s.jsx("div",{className:"sys-list-empty",style:{marginTop:4},children:s.jsx("p",{children:"No agents registered on this broker."})}):s.jsx("div",{className:"mesh-agent-table",style:{marginTop:4},children:n.result.home.agents.map(m=>{const j=B(m.state);return s.jsxs("div",{className:"mesh-detail-agent",style:{padding:"4px 0"},children:[s.jsx("span",{className:`mesh-detail-dot mesh-detail-dot--${j}`}),s.jsxs("div",{className:"mesh-detail-agent-body",children:[s.jsx("span",{className:"mesh-detail-agent-name",style:{fontSize:12},children:m.title}),m.activeTask&&s.jsx("span",{className:"mesh-detail-agent-task",children:m.activeTask})]}),s.jsx("span",{className:`mesh-detail-agent-state mesh-detail-agent-state--${j}`,children:m.statusLabel||j})]},m.id)})})]}),s.jsx("button",{type:"button",className:"s-btn",style:{marginTop:14},onClick:()=>b(null,null),children:"Clear selection"})]})}if(t&&i==="node"){const a=Object.values(e.nodes).find(d=>d.id===t)??(e.localNode?.id===t?e.localNode:null),n=e.localNode?.id===t;return a?s.jsxs("div",{className:"sys-inspector-content",children:[s.jsxs("div",{className:"sys-inspector-head",children:[s.jsx("h3",{className:"sys-inspector-title",children:a.hostName?.split(".")[0]??a.name??"Node"}),n&&s.jsx("span",{className:"sys-chip sys-chip-neutral",children:"this broker"})]}),s.jsxs("div",{className:"sys-detail-grid",children:[s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Node ID"}),s.jsxs("code",{className:"sys-detail-value",children:[a.id.slice(0,16),"…"]})]}),a.brokerUrl&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Broker URL"}),s.jsx("code",{className:"sys-detail-value",children:S(a.brokerUrl)})]}),a.hostName&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Host"}),s.jsx("span",{className:"sys-detail-value",children:a.hostName})]}),!n&&"lastSeenAt"in a&&typeof a.lastSeenAt=="number"&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Last seen"}),s.jsx("span",{className:"sys-detail-value",children:U(a.lastSeenAt)})]}),!n&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Scope"}),s.jsx("span",{className:"sys-detail-value",children:a.advertiseScope==="mesh"?"Announced to mesh":"Local only"})]})]}),n&&e.issues.length>0&&s.jsx("div",{className:"sys-issue-grid",style:{marginTop:12},children:e.issues.map((d,N)=>s.jsxs("article",{className:`sys-issue-card sys-issue-card-${d.severity==="error"?"error":"warning"}`,children:[s.jsx("div",{className:"sys-issue-head",children:s.jsx("h3",{className:"sys-issue-title",children:d.title})}),s.jsx("p",{className:"sys-issue-body",children:d.summary}),d.actionCommand&&s.jsx("div",{className:"sys-issue-action",children:s.jsx("code",{className:"sys-code-inline",children:d.actionCommand})})]},N))}),s.jsx("button",{type:"button",className:"s-btn",style:{marginTop:12},onClick:()=>b(null,null),children:"Clear selection"})]}):s.jsxs("div",{className:"sys-inspector-empty",children:[s.jsx("p",{children:"Node not found."}),s.jsx("button",{type:"button",className:"s-btn",onClick:()=>b(null,null),children:"Clear"})]})}const o=e,L=D(o),$=Object.values(o.nodes).filter(l=>l.id!==o.localNode?.id).length,I=o.tailscale.onlineCount??0,O=o.localNode?.hostName?.split(".")[0]??o.localNode?.name??o.identity.name??"this broker";return s.jsxs("div",{className:"sys-inspector-content mesh-summary",children:[s.jsxs("div",{className:"sys-inspector-head",children:[s.jsx("h3",{className:"sys-inspector-title",children:O}),s.jsx("span",{className:"mesh-summary-mode",children:o.identity.modeLabel})]}),s.jsx("section",{className:"mesh-summary-section",children:s.jsxs("div",{className:"mesh-summary-counts",children:[s.jsxs("div",{className:"mesh-summary-count",children:[s.jsx("span",{className:"mesh-summary-count-value",children:y.total}),s.jsx("span",{className:"mesh-summary-count-label",children:"agents"})]}),s.jsxs("div",{className:"mesh-summary-count mesh-summary-count--working",children:[s.jsx("span",{className:"mesh-summary-count-value",children:y.working}),s.jsx("span",{className:"mesh-summary-count-label",children:"working"})]}),s.jsxs("div",{className:"mesh-summary-count",children:[s.jsx("span",{className:"mesh-summary-count-value",children:y.ready}),s.jsx("span",{className:"mesh-summary-count-label",children:"ready"})]}),s.jsxs("div",{className:"mesh-summary-count mesh-summary-count--offline",children:[s.jsx("span",{className:"mesh-summary-count-value",children:y.notReady}),s.jsx("span",{className:"mesh-summary-count-label",children:"not ready"})]})]})}),w.length>0&&s.jsxs("section",{className:"mesh-summary-section",children:[s.jsx("div",{className:"sys-inspector-section-label",children:"By harness"}),s.jsx("div",{className:"mesh-summary-harness",children:w.map(l=>s.jsxs("div",{className:"mesh-summary-harness-row",children:[s.jsx("span",{className:"mesh-summary-harness-name",children:l.label}),s.jsx("span",{className:"mesh-summary-harness-count",children:l.total}),l.working>0&&s.jsxs("span",{className:"mesh-summary-harness-working",children:[l.working," working"]})]},l.label))})]}),s.jsxs("section",{className:"mesh-summary-section",children:[s.jsx("div",{className:"sys-inspector-section-label",children:"Peers"}),s.jsxs("div",{className:"mesh-summary-peers",children:[s.jsxs("div",{className:"mesh-summary-peer-row",children:[s.jsx("span",{className:"mesh-summary-peer-label",children:"Mesh"}),s.jsx("span",{className:"mesh-summary-peer-value",children:$})]}),o.tailscale.available&&s.jsxs("div",{className:"mesh-summary-peer-row",children:[s.jsx("span",{className:"mesh-summary-peer-label",children:"Tailnet"}),s.jsx("span",{className:`mesh-summary-peer-value${o.tailscale.running?"":" mesh-summary-peer-value--dim"}`,children:o.tailscale.running?`${I} online`:"stopped"})]})]})]}),s.jsxs("section",{className:"mesh-summary-section mesh-summary-reach",children:[s.jsx("div",{className:"sys-inspector-section-label",children:"Reach"}),s.jsx(J,{state:L,tailscaleAvailable:o.tailscale.available,announcing:u,tailscaleBusy:C,onAnnounce:()=>{A()},onStartTailscale:()=>{M()}}),x&&s.jsx("div",{className:`sys-banner mesh-action-message sys-banner-${x.tone}`,children:s.jsx("span",{children:x.text})})]})]})}function J({state:e,tailscaleAvailable:t,announcing:i,tailscaleBusy:r,onAnnounce:c,onStartTailscale:u}){return e==="discoverable"?s.jsxs("div",{className:"mesh-reach mesh-reach--on",children:[s.jsx("span",{className:"mesh-reach-dot"}),s.jsx("span",{className:"mesh-reach-label",children:"Discoverable on mesh"})]}):e==="tailnet-stopped"?s.jsxs("div",{className:"mesh-reach",children:[s.jsxs("div",{className:"mesh-reach-row",children:[s.jsx("span",{className:"mesh-reach-dot mesh-reach-dot--off"}),s.jsx("span",{className:"mesh-reach-label",children:"Tailscale stopped"})]}),s.jsx("button",{type:"button",className:"s-btn mesh-reach-action",disabled:r,onClick:u,children:r?"Opening…":"Start Tailscale"})]}):e==="loopback"?s.jsxs("div",{className:"mesh-reach",children:[s.jsxs("div",{className:"mesh-reach-row",children:[s.jsx("span",{className:"mesh-reach-dot mesh-reach-dot--off"}),s.jsx("span",{className:"mesh-reach-label",children:"Announcement broken"})]}),s.jsx("button",{type:"button",className:"s-btn mesh-reach-action",disabled:i,onClick:c,children:i?"Fixing…":"Fix announcement"})]}):e==="unavailable"?s.jsxs("div",{className:"mesh-reach mesh-reach--neutral",children:[s.jsx("span",{className:"mesh-reach-dot mesh-reach-dot--off"}),s.jsx("span",{className:"mesh-reach-label",children:"Local only — no tailnet on this host"})]}):s.jsxs("div",{className:"mesh-reach",children:[s.jsxs("div",{className:"mesh-reach-row",children:[s.jsx("span",{className:"mesh-reach-dot mesh-reach-dot--off"}),s.jsx("span",{className:"mesh-reach-label",children:"Local only"})]}),s.jsx("button",{type:"button",className:"s-btn s-btn-primary mesh-reach-action",disabled:i||!t,onClick:c,children:i?"Announcing…":"Make discoverable"})]})}export{_s as MeshInspectorPanel};
@@ -1 +1 @@
1
- import{c}from"./createLucideIcon-ClCdc3F9.js";const e=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],t=c("rocket",e);export{t as R};
1
+ import{c}from"./createLucideIcon-Bt67PWH-.js";const e=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],t=c("rocket",e);export{t as R};
@@ -0,0 +1 @@
1
+ import{p as ie,q as Dn,t as je,v as Ne,k as Fn,w as On,s as k,l as g,x as xn,y as Z,z as jn,A as Nn,r as P}from"./index-o4FKpU7Z.js";import{n as ce}from"./synthetic-agent-routing-aduMYO7P.js";import{o as Mn,q as Me,n as Bn,u as zn}from"./terminal-sessions-AmSgHklm.js";const Be=["local","url","sharedConfig","env"];function Wn(e){const n=Kn(e),t=e.audienceIncludes??Gn(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 u=r[a];if(!u)return o(a),{key:a,enabled:!1,value:!1,layer:"default",audience:n,reason:"unknown-flag"};const d=Hn(e.layers,a);return d?{key:a,enabled:d.value,value:d.value,layer:d.layer,audience:n,requiredTier:u.tier,reason:"override",definition:u}:u.defaultEnabled?u.tier&&!t(n,u.tier)?{key:a,enabled:!1,value:!1,layer:"default",audience:n,requiredTier:u.tier,reason:"audience-denied",definition:u}:{key:a,enabled:!0,value:!0,layer:"default",audience:n,requiredTier:u.tier,reason:"default",definition:u}:{key:a,enabled:!1,value:!1,layer:"default",audience:n,requiredTier:u.tier,reason:"default",definition:u}}return{registry:e.registry,isEnabled:a=>i(String(a)).enabled,explain:a=>i(String(a)),all:()=>Object.keys(e.registry).sort().map(i),audience:()=>n}}function Kn(e){let n=e.audience.tier;for(const t of Be.slice().reverse()){const s=e.layers?.[t]?.audience;s&&(n=s)}return{...e.audience,tier:n}}function Gn(e){return(n,t)=>{if(n.tier===t)return!0;if(!e||e.length===0)return!1;const s=e.indexOf(n.tier),o=e.indexOf(t);return s<0||o<0?!1:s>=o}}function Hn(e,n){for(const t of Be){const s=Vn(e?.[t]?.flags?.[n]);if(s!==null)return{layer:t,value:s}}return null}function Vn(e){return e===!0||e==="on"?!0:e===!1||e==="off"?!1:null}function Yn(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 n=e.trim().toLowerCase();if(["1","true","on","yes","enabled","enable"].includes(n))return!0;if(["0","false","off","no","disabled","disable"].includes(n))return!1;if(["default","null","unset","clear"].includes(n))return"default"}function qn(e,n={}){const t=n.paramPrefix??"ff.",s=n.audienceParam??"ffAudience",o=typeof e=="string"?new URL(e,"http://hudson.local"):e,r={};let i;for(const[a,u]of o.searchParams.entries()){if(a===s&&u.trim()&&(i=u.trim()),!a.startsWith(t))continue;const d=a.slice(t.length),f=Yn(u);d&&f!==void 0&&(r[d]=f)}return{flags:r,audience:i}}const D=1;function Qn(e){if(typeof window>"u")return{version:D};try{const n=window.localStorage?.getItem(e);return Xn(n)}catch{return{version:D}}}function _s(e,n){if(typeof window>"u")return;const t=ze(n),s=JSON.stringify(t);try{window.localStorage?.setItem(e,s)}catch{}Zn(e,s)}function Xn(e){if(!e)return{version:D};try{const n=JSON.parse(e);return!n||typeof n!="object"?{version:D}:ze(n)}catch{return{version:D}}}function ze(e){const n={version:D};if(e.audience&&(n.audience=e.audience),e.flags&&typeof e.flags=="object"){n.flags={};for(const[t,s]of Object.entries(e.flags))(s===!0||s===!1)&&(n.flags[t]=s);Object.keys(n.flags).length===0&&delete n.flags}return n}function Zn(e,n){if(!(typeof document>"u"))try{const t=encodeURIComponent(n);document.cookie=`${encodeURIComponent(e)}=${t}; Path=/; SameSite=Lax; Max-Age=31536000`}catch{}}const Jn=["ops.control","ops.mesh","ops.runtime","ops.plans","ops.terminal"],et=["surface.search","surface.sessions","surface.briefings","surface.work","surface.activity","surface.follow","surface.scoutbot","surface.workflows"];function Le(e,n){return Object.fromEntries(e.map(t=>[t,n]))}const We={label:"Surface · Scope",description:`Scope presentation on Scout infra — lean lanes/tail/sessions/agents at ${Dn}/*.`,defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","scope","observability"]},nt={...We,label:"Surface · Scope (legacy alias)",description:`Legacy alias for ${ie}. Prefer the primary flag; ${je} remains for old dev links.`},Us=ie;function tt(){return{audience:"everyone",flags:{"ops.control":!0,"ops.lanes":!0,...Le(Jn,!1),...Le(et,!1)}}}const Ke=["ffBundle","ffVariant","scoutBundle","scoutExperience","ab"],Ge=["ffGlobal","scoutGlobalBundle"],He=["ffPersist","persistBundle"],st=new Set(["no-ops","ffAudience",...Ke,...Ge,...He]);function ks(e){for(const n of[...e.searchParams.keys()])(st.has(n)||n.startsWith("ff."))&&e.searchParams.delete(n);return e}const ot=["everyone","internal","power"],rt="openscout.flags",J="openscout.flagBundle",at={tier:"power"},ye=["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.realtime-voice","surface.workflows"],it={"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.",defaultEnabled:!1,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"]},[ie]:We,[je]:nt},ct={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",...On},Ee=new Set(["clear","default","none","reset","unset"]);function K(e,n){return Object.fromEntries(e.map(t=>[t,n]))}function Ve(...e){const n={};for(const t of e)t.audience&&(n.audience=t.audience),t.flags&&Object.keys(t.flags).length>0&&(n.flags={...n.flags??{},...t.flags});return n}function ue(e){switch(e){case"light-prod":return{audience:"everyone",flags:{...K(ye,!1),...K($e,!1)}};case"max-pro":return{audience:"power",flags:{...K(ye,!0),...K($e,!0)}};case Fn:return tt()}}function O(e){return e?ct[e.trim().toLowerCase()]??null:null}function ee(e,n){for(const t of n){const s=e.get(t);if(s!==null)return s}return null}function Ye(e){const n=ee(e,Ke);return O(n)}function ut(e){const n=ee(e,Ge);if(n){const i=n.trim().toLowerCase();if(Ee.has(i))return{action:"clear"};const a=O(n);return a?{action:"set",bundle:a}:null}const t=ee(e,He);if(!t)return null;const s=t.trim().toLowerCase();if(Ee.has(s))return{action:"clear"};if(["0","false","no"].includes(s))return null;const o=O(t);if(o)return{action:"set",bundle:o};const r=Ye(e);return r?{action:"set",bundle:r}:null}function qe(){if(typeof window>"u")return null;try{return O(window.localStorage.getItem(J))}catch{return null}}function lt(e){if(!(typeof window>"u"))try{e.action==="clear"?window.localStorage.removeItem(J):window.localStorage.setItem(J,e.bundle)}catch{}}function Ts(){return qe()??O(Ne())??Xe}function Qe(){const e=qe();return e?ue(e):{}}const Xe="light-prod";function Ze(){const e=O(Ne())??Xe;return ue(e)}function dt(e){const n=ut(e);n&&lt(n)}function Je(e=new URLSearchParams(window.location.search)){const n=qn(window.location.href),t=Ye(e),s=t?ue(t):{},o={audience:n.audience??s.audience,flags:{...s.flags??{},...n.flags??{}}};return e.has("no-ops")&&(o.flags={...o.flags,"ops.control":!1}),o}function ft(){const e=Qn(rt);return{flags:e.flags,audience:e.audience??void 0}}function Ds(){if(typeof window>"u")return{};const e=new URLSearchParams(window.location.search);return dt(e),{sharedConfig:Ve(Ze(),Qe()),url:Je(e)}}function mt(e){const n=typeof window>"u"?{}:{sharedConfig:Ve(Ze(),Qe()),url:Je(),local:ft()};return Wn({registry:it,audience:at,audienceOrder:ot,layers:n,warnOnUnknown:!1}).isEnabled(e)}function en(){return mt("ops.control")}const ne={sm:408,md:512,lg:616},nn=240,tn=640,pt=24,sn="openscout:lane-deck:v1",gt=new Set(["web.ops","macos.lanes","hud.tail","web.embed"]),le=new Set(["sm","md","lg"]),on={"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}},ht=on["web.ops"];function de(e){return rn(e)?on[e]:ht}const H={pinned_left:0,main:1,pinned_right:2};function rn(e){return gt.has(e)}function Fs(e=window.location.search,n=window.location.pathname){const t=new URLSearchParams(e),s=t.get("profile")?.trim().toLowerCase();if(s&&rn(s))return s;const o=t.get("embed")?.trim().toLowerCase();return o==="hud"?"hud.tail":o==="app"?"macos.lanes":n.includes("/lanes/embed")?"web.embed":(n.includes("/ops/lanes"),"web.ops")}function Os(e=window.location.search){const n=new URLSearchParams(e),t=(n.get("lanes")??n.get("size"))?.trim().toLowerCase();return t&&le.has(t)?t:"lg"}function xs(e,n){if(typeof e=="number"&&Number.isFinite(e))return Math.min(tn,Math.max(nn,Math.round(e)));const t=typeof e=="string"&&le.has(e)?e:n;return ne[t]}function js(e){const n=Math.min(tn,Math.max(nn,Math.round(e)));let t=null,s=Number.POSITIVE_INFINITY;for(const[o,r]of Object.entries(ne)){const i=Math.abs(r-n);i<s&&(s=i,t=o)}return t&&s<=pt?{px:ne[t],tier:t}:{px:n,tier:null}}function fe(e,n,t){return{version:1,profileId:e,defaultLaneWidth:n??t.defaultLaneWidth,defaultHorizon:t.defaultHorizon,laneWidths:{},laneDefs:[],slots:[],showAutoLanes:t.showAutoLanes,updatedAt:Date.now()}}function Re(e,n){const t=de(e);return fe(e,n,t)}function te(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="string"&&le.has(e))return e}function wt(e){if(!e||typeof e!="object")return null;const n=e;return typeof n.id!="string"||!n.id.trim()||n.kind!=="session"&&n.kind!=="harness"&&n.kind!=="project"&&n.kind!=="attention"||typeof n.title!="string"||!n.title.trim()?null:{id:n.id.trim(),kind:n.kind,title:n.title.trim(),sessionId:typeof n.sessionId=="string"?n.sessionId.trim():void 0,harness:typeof n.harness=="string"?n.harness.trim():void 0,projectPath:typeof n.projectPath=="string"?n.projectPath.trim():void 0}}function It(e){if(!e||typeof e!="object")return null;const n=e;return typeof n.id!="string"||!n.id.trim()||typeof n.laneDefId!="string"||!n.laneDefId.trim()||n.zone!=="pinned_left"&&n.zone!=="main"&&n.zone!=="pinned_right"||typeof n.position!="number"||!Number.isFinite(n.position)?null:{id:n.id.trim(),laneDefId:n.laneDefId.trim(),zone:n.zone,position:n.position,width:te(n.width)}}function an(e,n,t,s){if(!e||typeof e!="object")return fe(n,t,s);const o=e,r=Array.isArray(o.laneDefs)?o.laneDefs.map(wt).filter(d=>d!==null):[],i=Array.isArray(o.slots)?o.slots.map(It).filter(d=>d!==null):[],a={};if(o.laneWidths&&typeof o.laneWidths=="object")for(const[d,f]of Object.entries(o.laneWidths)){const L=te(f);L!==void 0&&(a[d]=L)}const u=te(o.defaultLaneWidth);return{version:1,profileId:n,defaultLaneWidth:(typeof u=="string"?u:void 0)??t??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 vt(e,n,t){return an(e,n,t,de(n))}function Ns(e,n){const t=de(e),s=n??t.defaultLaneWidth;try{const o=localStorage.getItem(`${sn}:${e}`);return o?vt(JSON.parse(o),e,s):Re(e,s)}catch{return Re(e,s)}}function St(e){try{localStorage.setItem(`${sn}:${e.profileId}`,JSON.stringify({...e,updatedAt:Date.now()}))}catch{}}function Ms(e){return[...e].sort((n,t)=>{const s=H[n.zone]-H[t.zone];return s!==0?s:n.position-t.position})}function Bs(e,n){return H[e]-H[n]}function cn(){return`slot:${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function me(e){return e.trim().toLowerCase().replace(/['"]/gu,"").replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function Y(e){return`session:${e}`}function bt(e){return`harness:${me(e)}`}function Lt(e){return`project:${me(e)}`}const yt="attention:needs-input";function un(e,n){const t=e.filter(s=>s.zone===n);return t.length===0?0:Math.max(...t.map(s=>s.position))+1}function ln(e,n){const t=e.laneDefs.some(s=>s.id===n.id);return{...e,laneDefs:t?e.laneDefs.map(s=>s.id===n.id?n:s):[...e.laneDefs,n]}}function dn(e,n){const t=e.slots.some(s=>s.id===n.id);return{...e,slots:t?e.slots.map(s=>s.id===n.id?n:s):[...e.slots,n]}}function fn(e,n){return{...e,slots:e.slots.filter(t=>t.laneDefId!==n)}}function $t(e,n){const t=Y(n);return{...fn(e,t),laneDefs:e.laneDefs.filter(s=>s.id!==t)}}function zs(e,n){const t=Y(n);return e.slots.some(s=>s.laneDefId===t&&s.zone!=="main")}function Ws(e,n){const t=Y(n),s=e.slots.find(o=>o.laneDefId===t);return!s||s.zone==="main"?null:s.zone}function Ks(e,n){const t=n.zone??"pinned_left",s=Y(n.laneId),o=$t(e,n.laneId),r=ln(o,{id:s,kind:"session",title:n.title,sessionId:n.laneId});return dn(r,{id:cn(),laneDefId:s,zone:t,position:un(r.slots,t),width:n.width})}function Gs(e,n){const t=n.zone??"pinned_left",s=n.kind==="attention"?yt:n.kind==="harness"&&n.harness?bt(n.harness):n.kind==="project"&&n.projectPath?Lt(n.projectPath):`${n.kind}:${me(n.title)}`,o=fn(e,s),r=ln(o,{id:s,kind:n.kind,title:n.title,harness:n.harness,projectPath:n.projectPath});return dn(r,{id:cn(),laneDefId:s,zone:t,position:un(r.slots,t),width:n.width})}function Hs(e,n,t){return{...e,laneWidths:{...e.laneWidths,[n]:t},updatedAt:Date.now()}}function Vs(e,n){return{...e,defaultLaneWidth:n,updatedAt:Date.now()}}function Ys(e){const n=new Set(e.slots.filter(t=>t.zone!=="main").map(t=>t.laneDefId));return{...e,slots:e.slots.filter(t=>t.zone==="main"),laneDefs:e.laneDefs.filter(t=>!n.has(t.id))}}const V="scope.lanes",se={defaultLaneWidth:"md",showAutoLanes:!0,defaultHorizon:"30m"},Et="openscout:lane-deck:v1";function Pe(e){return fe(V,e,se)}function qs(e){const n=e??se.defaultLaneWidth;try{const t=localStorage.getItem(`${Et}:${V}`);return t?an(JSON.parse(t),V,n,se):Pe(n)}catch{return Pe(n)}}function Qs(e){St(e)}const Rt=[g.lanes,g.tail,g.sessions,g.agents];function Pt(e){return Rt.includes(e)}function Ct(e){return e===jn||e===Nn}function mn(e){return xn(e)}function q(e,n={}){switch(e){case g.tail:{const t=new URLSearchParams;n.tailQuery&&t.set("q",n.tailQuery);const s=t.toString();return k(e,s?`?${s}`:"")}case g.sessions:return n.sessionId?k(e,`/${encodeURIComponent(n.sessionId)}`):k(e);case g.lanes:return k(Z);case g.agents:return k(e);default:return k(Z)}}function pn(e){switch(e.view){case"ops":return!e.mode||e.mode==="lanes"?g.lanes:e.mode==="tail"?g.tail:null;case"sessions":return e.agentId?null:g.sessions;case"agents-v2":return e.agentId||e.projectSlug||e.sessionId||e.conversationId?null:g.agents;default:return null}}function At(e){const n=pn(e);return n?n===g.tail&&e.view==="ops"?q(n,{tailQuery:e.tailQuery}):n===g.sessions&&e.view==="sessions"?q(n,{sessionId:e.sessionId}):q(n):null}function _t(e,n,t){if(!Ct(e[0]))return null;const s=e[1]??Z;if(!Pt(s))return{view:"ops",mode:"lanes"};switch(s){case g.tail:{const o=n.searchParams.get("q")?.trim();return{view:"ops",mode:"tail",...o?{tailQuery:o}:{}}}case g.sessions:return e[2]?t({view:"sessions",sessionId:decodeURIComponent(e[2])}):t({view:"sessions"});case g.agents:return t({view:"agents-v2"});case g.lanes:default:return{view:"ops",mode:"lanes"}}}const Ut=new Set(["no-ops","ffBundle","ffVariant","scoutBundle","scoutExperience","ab","ffGlobal","scoutGlobalBundle","ffPersist","persistBundle","ffAudience","studio","studioInjection","studioMode"]),kt=["ff.","studio.","studioMode."];function Tt(e){return Ut.has(e)||kt.some(n=>e.startsWith(n))}function gn(e,n=""){const t=new URL(e,"http://scout.local");new URLSearchParams(n).forEach((r,i)=>{Tt(i)&&(t.searchParams.has(i)||t.searchParams.set(i,r))});const o=t.searchParams.toString();return`${t.pathname}${o?`?${o}`:""}`}function Xs(e){switch(e){case g.tail:return{view:"ops",mode:"tail"};case g.sessions:return{view:"sessions"};case g.agents:return{view:"agents-v2"};case g.lanes:default:return{view:"ops",mode:"lanes"}}}function Dt(e=typeof window<"u"?window.location.pathname:""){return mn(e)}function Zs(){return V}function Js(e=Dt()){return e?{"data-scope-presentation":!0}:void 0}function hn(e,n=typeof window<"u"?window.location.pathname:""){return mn(n)?At(e):null}function Ft(e,n=typeof window<"u"?window.location.pathname:""){return hn(e,n)!==null}function eo(e,n=typeof window<"u"?window.location.pathname:""){return Ft(e,n)?pn(e):null}const no={days:3,sessionLimit:200,hitLimit:60,debounceMs:180};function oe(e){return e.root==="HOME"?`~/${e.relPath}`:e.root==="ABSOLUTE"?e.relPath:`$${e.root}/${e.relPath}`}function Ce(e){const n=e?.trim();if(!n)return null;const t=n.replace(/[\\/]+$/,""),s=t.split(/[\\/]/).filter(Boolean).at(-1)??t;return s.endsWith(".jsonl")?s.slice(0,-6):s}function _(e){return e.sourceRefs.find(n=>n.kind==="harness_transcript")??null}function wn(e){return e.sourceRefs.find(n=>n.kind==="file")??null}function pe(e){return e?Ce(e.sessionId)??Ce(oe(e.path)):null}function to(e){const n=pe(e);if(!n)return null;const t=e?.recordRange;return t?`${n}|records ${t[0]}..${t[1]}`:n}function B(e,n){const t=e.facets[n];return Array.isArray(t)?t.filter(Boolean).join(", "):typeof t=="string"?t:""}function N(e){const n=new Set;return e.split(/[^A-Za-z0-9_./-]+/u).map(t=>t.trim()).filter(t=>t.length>1).filter(t=>{const s=t.toLowerCase();return n.has(s)?!1:(n.add(s),!0)}).slice(0,12)}const Ot=/^(events?\s+window(\s+\d+)?|files?\s+touched|tool\s+calls?|indexed\s+snippet|manifest|summary|decisions?|context\s+pack)\b/iu,Ae=/^(claude|codex|kimi|cursor|gpt|gemini)\b/iu,_e=/^(?: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 In(e){return Ot.test(e.replace(/\s+/g," ").trim())}function xt(e){let n=e.replace(/\s+/g," ").trim();if(!n)return"";if(n=n.replace(/<[^>\n]+>/g," ").replace(/\s+/g," ").trim(),_e.test(n))n=n.replace(_e,"").trim();else{const t=n.match(/^(.{6,72}?)\s[-–—]\s+(.+)$/u);if(t){const s=t[1]??"",o=t[2]??"";(Ae.test(s)||/\b(?:am|pm|\d{1,2}:\d{2}|plugin|session|openscout)\b/iu.test(s))&&(n=o.trim())}}return n=n.replace(Ae,"").replace(/^\s*[-–—:]\s*/,"").trim(),n=n.replace(/\s{2,}/g," ").trim(),n.length>72&&(n=`${n.slice(0,69).replace(/\s+\S*$/u,"").trimEnd()}…`),n}function jt(e){const n=B(e,"project"),t=e.title.replace(/\s+/g," ").trim();if(t&&!In(t)){const o=xt(t);if(o&&o.toLowerCase()!==n.toLowerCase()||o)return o}if(n)return n;const s=pe(_(e));return s?s.length>18?`${s.slice(0,16)}…`:s:"Session match"}function vn(e){const n=M(e,"recordKind",8).map(s=>s.toLowerCase());if(n.length===0&&n.push(...M(e,"recordTag",8).map(s=>s.toLowerCase())),n.some(s=>s.includes("assistant")))return"assistant";if(n.some(s=>s.includes("user")))return"user";if(n.some(s=>s.includes("tool")||s.includes("command")||s.includes("response")))return"tool";const t=he(e);return t==="tool activity"?"tool":t==="overview"?"overview":""}function so(e,n){const t=we(e.snippet,n),s=vn(e),o=ge(e);let r="";if(t){const i=N(n).map(d=>d.toLowerCase()),a=t.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=>re(d,f)>=0)):void 0)??a[0]??t).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||jt(e)}function Nt(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 Ue(e){const n=e.trim().toLowerCase();return n?n==="events"||n.startsWith("events")?"conversation":n==="overview"||n==="summary"?"overview":n==="tool-calls"||n==="tools"?"tool activity":n==="files"||n==="files-touched"?"files touched":n==="manifest"?"session index":n.replace(/[-_]+/g," "):""}function Mt(e){const n=e.trim();return n?n.charAt(0).toUpperCase()+n.slice(1):""}function Bt(e){const n=B(e,"harness")||_(e)?.harness||"";if(!n)return"";const t=n.toLowerCase();return t==="claude"?"Claude":t==="codex"?"Codex":t==="kimi"?"Kimi":t==="cursor"?"Cursor":Mt(n)}function zt(e){const n=B(e,"sessionId").trim(),t=pe(_(e)),s=(n||t||"").trim();return s?s.length>14?s.slice(0,8):s:""}function ge(e){const n=_(e)?.recordRange;if(n){const[s,o]=n;return s===o?`turn ${s}`:o-s<=1?`turns ${s}–${o}`:`turns ${s}–${o}`}const t=e.title.match(/events?\s+window\s+(\d+)/iu);return t?`window ${Number(t[1])}`:""}function Wt(e){const n=M(e,"recordKind",8).map(s=>s.toLowerCase());n.length===0&&n.push(...M(e,"recordTag",8).map(s=>s.toLowerCase()));const t=[];return n.some(s=>s.includes("user"))&&t.push("user"),n.some(s=>s.includes("assistant"))&&t.push("assistant"),n.some(s=>s.includes("tool")||s.includes("command")||s.includes("response"))&&t.push("tool"),t.length===0?"":t.join(" · ")}function he(e){const n=B(e,"documentKind");if(n){const s=n.split(",")[0]?.trim()??n;return Ue(s)}return In(e.title)?Ue(e.title):wn(e)?"file":_(e)?"conversation":""}function M(e,n,t=3){const s=e.facets[n];return(Array.isArray(s)?s:typeof s=="string"?s.split(","):[]).map(r=>r.trim()).filter(Boolean).slice(0,t)}function oo(e){return{agent:Bt(e),project:B(e,"project"),session:zt(e),when:Nt(e),turn:ge(e),role:Wt(e),where:he(e)}}function ro(e){const n=[],t=ge(e);t&&n.push(t);const s=vn(e);s&&n.push(s);const o=he(e);o&&o!=="conversation"&&n.push(o);const r=M(e,"toolName",2);r.length===1&&n.push(r[0]),r.length>1&&n.push(r.join(", "));const i=new Set;return n.filter(a=>{const u=a.toLowerCase();return i.has(u)?!1:(i.add(u),!0)})}function re(e,n){return new RegExp(`(?<![A-Za-z0-9_./~-])${Ln(n)}(?![A-Za-z0-9_./~-])`,"iu").exec(e)?.index??-1}function we(e,n=""){let t=e.replace(/\s+/g," ").trim();if(!t)return"";if(t=t.replace(/\s*-\s*\[\d{3,}\]\s*`[^`]+`(?:\s*\([^)]*\))?\s*-\s*/gu," "),t=t.replace(/\[\d{3,}\]\s*`[^`]+`\s*/gu,""),t=t.replace(/\*\*/gu,""),t=t.replace(/\b(?:assistant_turn|user_turn|agent_reasoning|command_or_tool|response_item|system_record)\b/giu," "),t=t.replace(/(?:~\/|\.\.?\/|\/(?:Users|home|var|tmp|opt)\/)\S+/gu," "),t=t.replace(/https?:\/\/\S+/gu," "),t=t.replace(/\b[\w.-]+\.(?:com|net|org|io|dev|app)(?:\/\S*)?/giu," "),t=t.replace(/\{[^{}]{0,160}\}/gu," "),t=t.replace(/`[^`]{0,64}`/gu,r=>{const i=r.slice(1,-1);return N(n).some(a=>re(i,a)>=0)||/^[A-Za-z][\w.-]{0,24}$/u.test(i)?i:" "}),t=t.replace(/\s{2,}/g," ").trim(),t=t.replace(/^[\s,;:.\-–—|/]+/u,"").trim(),t.includes("{")||t.includes("[")){const r=t.search(/[\[{]/u);if(r>18){const i=t.slice(0,r).trim().replace(/[-–—,:;]+$/u,"").trim();i&&(t=i)}}const s=N(n),o=200;if(s.length>0&&t.length>o){let r=-1;for(const i of s){const a=re(t,i);a>=0&&(r<0||a<r)&&(r=a)}if(r<0)for(const i of s){if(i.length<4)continue;const a=t.toLowerCase().indexOf(i.toLowerCase());a>=0&&(r<0||a<r)&&(r=a)}if(r>=0){const a=Math.max(0,r-48),u=Math.min(t.length,a+o),d=t.slice(a,u).trim();t=`${a>0?"…":""}${d}${u<t.length?"…":""}`}else t=`${t.slice(0,o-1).replace(/\s+\S*$/u,"").trimEnd()}…`}else t.length>o&&(t=`${t.slice(0,o-1).replace(/\s+\S*$/u,"").trimEnd()}…`);return t.replace(/\s{2,}/g," ").trim()}function ao(e,n,t){const s=we(e.snippet,n);return s.length<=t?s:`${s.slice(0,t-1).replace(/\s+\S*$/u,"").trimEnd()}…`}function Kt(e,n){return N(n).filter(t=>{const s=t.toLowerCase();return e.title.toLowerCase().includes(s)||e.snippet.toLowerCase().includes(s)||we(e.snippet,n).toLowerCase().includes(s)})}function Sn(e){const n=(e.kind||e.role||e.type||"record").toLowerCase();return n==="assistant_turn"||n==="assistant"?"assistant":n==="user_turn"||n==="user"?"user":n==="system_record"||n==="system"?"system":n==="command_or_tool"||n==="tool_use"?"tool":n==="response_item"?"tool output":n==="agent_reasoning"||n==="reasoning"?"reasoning":n.replace(/_/gu," ")}function bn(e){const n=(e.kind||e.role||e.type||"").toLowerCase();return n==="assistant"||n==="assistant_turn"||n==="user"||n==="user_turn"||n==="last-prompt"||n==="ai-title"?0:n==="system"||n==="system_record"||n.includes("reasoning")?1:2}function io(e){return e.scoreSource==="hybrid"?"Words and meaning":e.scoreSource==="vector"?"Similar in meaning":"Exact words"}function co(e,n,t){const s=Kt(e,n),o=s.length===1?`Matched “${s[0]}”`:s.length>1?`Matched ${s.length} terms`:"Matched in this session";if(!t?.matched)return o;const r=[t.renderedText,t.summary].filter(Boolean).join(" ").toLowerCase(),i=s.filter(d=>r.includes(d.toLowerCase()));if(i.length===0)return o;const a=Sn(t),u=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 ${u}`:`Matched ${i.length} terms in ${u}`}function uo(e){const n=_(e);if(n){const s=oe(n.path),o=n.recordRange;return o?`${s}#R${o[0]}-R${o[1]}`:s}const t=wn(e);if(t){const s=oe(t.path),o=t.lineRange;return o?`${s}#L${o[0]}-L${o[1]}`:s}return e.id}function Gt(e){const n=e.filter(o=>bn(o)===2).length,t=e.length-n,s=e.some(o=>o.matched)?" · match inside":"";return n>0&&t===0?`${n} tool step${n===1?"":"s"}${s}`:n===0?`${t} process step${t===1?"":"s"}${s}`:`${n} tool + ${t} process step${e.length===1?"":"s"}${s}`}function Ht(e){return`${e.length} more conversation turn${e.length===1?"":"s"}`}function lo(e,n={}){if(e.length===0)return[];const t=n.contextRadius??3,s=n.maxTurns??6,o=n.centerRecordIndex===void 0?-1:e.findIndex(v=>v.index===n.centerRecordIndex),r=e.findIndex(v=>v.matched),i=o>=0?o:r>=0?r:0,a=e.slice(Math.max(0,i-t),Math.min(e.length,i+t+1)),u=[];let d=[],f=[],L=0;const C=()=>{d.length!==0&&(u.push({kind:"folded",records:d,summary:Gt(d)}),d=[])},R=()=>{f.length!==0&&(u.push({kind:"folded",records:f,summary:Ht(f)}),f=[])};for(const v of a){if(bn(v)>0){R(),d.push(v);continue}if(C(),L>=s){f.push(v);continue}u.push({kind:"turn",record:v,role:Sn(v)}),L+=1}return C(),R(),u}function ke(e){const n=_(e)?.recordRange;return n?n[0]:Number.MAX_SAFE_INTEGER}function fo(e){const n=[],t=new Map;for(const s of e){const o=s.collectionId||s.id,r=t.get(o);r?r.push(s):(n.push(o),t.set(o,[s]))}return n.map(s=>{const o=[...t.get(s)??[]].sort((i,a)=>{const u=ke(i)-ke(a);return u!==0?u:i.score-a.score}),r=t.get(s)?.[0]??o[0];return{collectionId:s,best:r,moments:o}})}function Ln(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mo(e,n){const t=N(n);if(t.length===0||e.length===0)return[{text:e,match:!1}];const s=t.map(a=>`(?<![A-Za-z0-9_./~-])${Ln(a)}(?![A-Za-z0-9_./~-])`),o=new RegExp(`(${s.join("|")})`,"giu"),r=[];let i=0;for(const a of e.matchAll(o)){const u=a.index??0;u>i&&r.push({text:e.slice(i,u),match:!1}),r.push({text:a[0],match:!0}),i=u+a[0].length}return i<e.length&&r.push({text:e.slice(i),match:!1}),r.length>0?r:[{text:e,match:!1}]}const po={sessions:"Sessions",skills:"Skills",mcp:"MCP",codebase:"Codebase",context_pack:"Context packs",mixed:"Mixed"},yn=[{value:"1",label:"Last 24h"},{value:"3",label:"Last 3 days"},{value:"7",label:"Last 7 days"},{value:"30",label:"Last 30 days"}],go=["sessions","skills","mcp","codebase","context_pack"];function ho(){return{query:"",sourceKinds:[],harness:[],project:[],timeWindow:"all"}}function Vt(e){return e?yn.some(n=>n.value===e):!1}function Q(e){return e?e.split(",").map(n=>n.trim()).filter(n=>n.length>0):[]}function Yt(e){const n=e==null?new URLSearchParams:typeof e=="string"?new URLSearchParams(e):e,t=n.get("time"),s=Vt(t)?t:"all";return{query:n.get("q")?.trim()??"",sourceKinds:Q(n.get("source")),harness:Q(n.get("harness")),project:Q(n.get("project")),timeWindow:s}}function qt(e,n={}){const t=new URLSearchParams,s=e.query.trim();return s&&t.set("q",s),e.sourceKinds.length>0&&t.set("source",e.sourceKinds.join(",")),e.harness.length>0&&t.set("harness",e.harness.join(",")),e.project.length>0&&t.set("project",e.project.join(",")),e.timeWindow!=="all"&&t.set("time",e.timeWindow),n.hitId&&t.set("hit",n.hitId),t}function wo(e,n){return e.query.trim()===n.query.trim()&&e.timeWindow===n.timeWindow&&X(e.sourceKinds,n.sourceKinds)&&X(e.harness,n.harness)&&X(e.project,n.project)}function X(e,n){if(e.length!==n.length)return!1;const t=[...e].map(o=>o.trim().toLowerCase()).sort(),s=[...n].map(o=>o.trim().toLowerCase()).sort();return t.every((o,r)=>o===s[r])}function Qt(e){return e.query.trim().length>0||e.sourceKinds.length>0||e.harness.length>0||e.project.length>0||e.timeWindow!=="all"}function Io(e){if(e==="all")return null;const n=Number.parseInt(e,10);return!Number.isFinite(n)||n<=0?null:Date.now()-n*24*60*60*1e3}function vo(e){return e==="all"?"Any time":yn.find(t=>t.value===e)?.label??e}const $n=typeof window<"u"?window.location.href:"http://scout.local/";function Xt(e){const n=e.toString();return new URL(n,$n)}function Zt(e){switch(e){case"profile":case"config":case"definitions":return e==="definitions"?"config":e;case"observe":case"message":return e;default:return}}function Jt(e){const n=e.trim().replace(/^#/,"");if(!n.startsWith("msg-"))return null;const t=n.slice(4).trim();if(!t)return null;try{return decodeURIComponent(t)}catch{return t}}function es(e){switch(e){case"control":case"mission":case"command":case"warroom":case"conduct":case"conductor":return"mission";case"plan":return"plan";case"issues":case"errors":case"warnings":return"issues";case"agents":case"tail":case"atop":case"lanes":return e;default:return}}function ns(e){return e==="delivered"||e==="failed"||e==="all"?e:void 0}function ts(e){return e==="indexer"||e==="knowledge"?e:void 0}function ss(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 os(e){switch(e){case"tail":case"session":case"chat":case"work":return e;default:return}}function rs(e){const n=e?.trim().replace(/\.+$/u,"");return n==="observe"||n==="takeover"?n:void 0}function as(e){const n=e?.trim().toLowerCase();return n==="pty"||n==="tmux"||n==="zellij"||n==="herdr"?n:void 0}function is(e){const n=e?.trim().toLowerCase();return n==="shell"||n==="claude"||n==="codex"||n==="pi"?n:void 0}function cs(e){return e==="all"||e==="touched"?"all":e==="changed"?"changed":void 0}function Te(e){if(!e)return;const n=Number.parseInt(e,10);return Number.isSafeInteger(n)&&n>0?n:void 0}function De(e){return e==="mission"?"control":e}function us(e){return e.searchParams.has("no-ops")?!1:typeof window>"u"?!0:en()}function ls(e){return e==="tail"}function ds(e){return e==="lanes"}function En(e){return ls(e)||ds(e)}const Ie="machineId",Rn=new Set(["inbox","conversation","agents-v2","messages","sessions","repos","harnesses","mesh","mesh-ops","activity","work","follow"]);function fs(e){return e.searchParams.get(Ie)?.trim()||void 0}function ms(e,n){return!n||!Rn.has(e.view)?e:{...e,machineId:n}}function ve(e){return Rn.has(e.view)}function ps(e){return"machineId"in e&&e.machineId?e.machineId:null}function Fe(e,n){if(!ve(e))return e;const t={...e},s=n?.trim();return s?t.machineId=s:delete t.machineId,t}function So(e){return ve(e)?{...e,machineId:""}:e}function gs(e,n){return ve(e)?"machineId"in e?Fe(e,e.machineId??null):Fe(e,ps(n)):e}function A(e,n){"machineId"in n&&n.machineId&&e.set(Ie,n.machineId)}function w(e){const n=e.toString();return n?`?${n}`:""}function T(e,n){const t=new URLSearchParams;return A(t,n),`${e}${w(t)}`}function hs(e){return"machineId"in e&&e.machineId?`:machine:${e.machineId}`:""}function Pn(e){const n=Xt(e),t=n.pathname.replace(/^\/+/,"").split("/").filter(Boolean),s=fs(n),o=c=>ms(c,s),r=_t(t,n,o);if(r)return r;const i=Jt(n.hash),a=Zt(n.searchParams.get("tab"))??(i?"message":void 0),u=n.searchParams.get("project")?.trim()||void 0,d=n.searchParams.get("agentId")?.trim()||void 0;if(t[0]==="agent"&&t[1])return{view:"agent-info",conversationId:decodeURIComponent(t[1])};const f=n.searchParams.get("project")?.trim()||void 0,L=n.searchParams.get("harness")?.trim()||void 0,C=n.searchParams.get("node")?.trim()||void 0,R=n.searchParams.get("set")?.trim(),v=R==="live"||R==="ephemeral"||R==="archived"?R:void 0,x=n.searchParams.get("view")?.trim(),z=x==="sessions"||x==="agents"?x:void 0,U=n.searchParams.get("state")?.trim(),Se=U==="needs"||U==="live"||U==="idle"?U:void 0,Tn=n.searchParams.get("ephemeral")==="1",W=n.searchParams.get("session")?.trim()||void 0,S=n.searchParams.get("select")?.trim()||void 0,y={...L?{harness:L}:{},...C?{node:C}:{},...v?{set:v}:{},...z?{indexView:z}:{},...Se?{stateFilter:Se}:{},...Tn?{showEphemeral:!0}:{}};if(t[0]==="projects"){const c=t[1]?decodeURIComponent(t[1]):void 0;if(!c)return o({view:"agents-v2",...S?{selectedAgentId:S}:{},...y});if(t[2]==="agents"){const l=t[3]?decodeURIComponent(t[3]):void 0;if(l){if(t[4]==="c"&&t[5])return o({view:"agents-v2",projectSlug:c,agentId:l,conversationId:decodeURIComponent(t[5]),tab:a??"message",...y});const m=t[4]==="sessions"&&t[5]?decodeURIComponent(t[5]):W;return o({view:"agents-v2",projectSlug:c,agentId:l,...m?{sessionId:m}:{},...a?{tab:a}:{},...y})}return o({view:"agents-v2",projectSlug:c,indexView:"agents",...S?{selectedAgentId:S}:{},...y})}return t[2]==="sessions"?o({view:"agents-v2",projectSlug:c,indexView:"sessions",...t[3]?{sessionId:decodeURIComponent(t[3])}:{},...S?{selectedAgentId:S}:{},...y}):o({view:"agents-v2",projectSlug:c,...S?{selectedAgentId:S}:{},...y})}if(t[0]==="agents-v2"&&t[1]==="sessions"&&t[2])return o({view:"agents-v2",sessionId:decodeURIComponent(t[2]),...S?{selectedAgentId:S}:{},...f?{projectSlug:f}:{},...y});if(t[0]==="agents-v2"&&t[1]){const c=decodeURIComponent(t[1]);return o({view:"agents-v2",agentId:c,...a?{tab:a}:{},...W?{sessionId:W}:{},...f?{projectSlug:f}:{},...y})}if(t[0]==="agents-v2")return o({view:"agents-v2",...S?{selectedAgentId:S}:{},...f?{projectSlug:f}:{},...y});if(t[0]==="agents"&&t[1]){const c=decodeURIComponent(t[1]),l=t[2]==="sessions"&&t[3]?decodeURIComponent(t[3]):W;return t[2]==="c"&&t[3]?o({view:"agents-v2",agentId:c,conversationId:decodeURIComponent(t[3]),tab:a??"message",...y}):o({view:"agents-v2",agentId:c,...l?{sessionId:l}:{},...a?{tab:a}:{},...y})}if(t[0]==="agents")return o({view:"agents-v2",...S?{selectedAgentId:S}:{},...f?{projectSlug:f}:{},...y});if(t[0]==="agents.deprecated"&&t[1]&&t[2]==="sessions"&&t[3])return o({view:"sessions",agentId:decodeURIComponent(t[1]),sessionId:decodeURIComponent(t[3])});if(t[0]==="agents.deprecated"&&t[1]&&t[2]==="c"&&t[3])return o({view:"agents-v2",agentId:decodeURIComponent(t[1]),conversationId:decodeURIComponent(t[3]),tab:a??"message"});if(t[0]==="agents.deprecated"&&t[1]){const c=decodeURIComponent(t[1]);return o({view:"agents-v2",agentId:c,...a?{tab:a}:{},...!a&&u?{projectSlug:u}:{}})}if(t[0]==="agents.deprecated")return o({view:"agents-v2",...u?{projectSlug:u}:{}});if(t[0]==="fleet")return o({view:"inbox"});if(t[0]==="c"&&t[1])return o({view:"conversation",conversationId:decodeURIComponent(t[1])});if(t[0]==="flights"&&t[1]&&t[2]==="observe"){const c=n.searchParams.get("session")?.trim()||void 0,l=n.searchParams.get("compare")?.trim()||void 0;return o({view:"sessions",flightId:decodeURIComponent(t[1]),...c?{sessionId:c}:{},...l?{compareSessionId:l}:{}})}if(t[0]==="sessions"&&t[1])return o({view:"sessions",sessionId:decodeURIComponent(t[1]),...d?{agentId:d}:{}});if(t[0]==="conversations")return o({view:"messages"});if(t[0]==="messages"){const c={view:"messages",...t[1]?{conversationId:decodeURIComponent(t[1])}:{}};return o(c)}if(t[0]==="sessions")return o({view:"sessions",...d?{agentId:d}:{}});if(t[0]==="repos"){const c=n.searchParams.get("root")?.trim()||void 0;return o({view:"repos",...c?{root:c}:{}})}if(t[0]==="providers"||t[0]==="harnesses")return o({view:"harnesses"});if(t[0]==="repo-diff"){const c=n.searchParams.get("path")?.trim();if(c){const l=n.searchParams.getAll("layer").filter(h=>h==="unstaged"||h==="staged"||h==="branch"),m=n.searchParams.getAll("file").map(h=>h.trim()).filter(Boolean),p=n.searchParams.get("sessionId")?.trim()||void 0,I=n.searchParams.get("agentId")?.trim()||void 0,b=cs(n.searchParams.get("include"));return{view:"repo-diff",path:c,...l.length>0?{layers:l}:{},...m.length>0?{files:m}:{},...p?{sessionId:p}:{},...I?{agentId:I}:{},...b?{include:b}:{}}}}if(t[0]==="search"){const c=ts(t[1]),l=n.searchParams.get("hit")?.trim()||void 0,m=Yt(n.searchParams);return{view:"search",...c&&c!=="knowledge"?{mode:c}:{},...l?{hitId:l}:{},...Qt(m)?{filters:m}:{}}}if(t[0]==="channels"&&t[1])return o({view:"messages",conversationId:decodeURIComponent(t[1])});if(t[0]==="channels")return o({view:"messages"});if(t[0]==="mesh")return o({view:"mesh"});if(t[0]==="mesh-ops")return o({view:"mesh-ops",...t[1]?{itemId:decodeURIComponent(t[1])}:{}});if(t[0]==="dispatch"||t[0]==="broker"){const c=n.searchParams.get("attempt")?.trim()||void 0,l=ns(n.searchParams.get("filter"));return{view:"broker",...c?{attemptId:c}:{},...l&&l!=="all"?{filter:l}:{}}}if(t[0]==="code"){const c=n.searchParams.get("wt")?.trim()||void 0,l=n.searchParams.get("fromConversation")?.trim()||void 0,m=Te(n.searchParams.get("line")),p=Te(n.searchParams.get("endLine")),I=m&&p&&p>=m?p:void 0;if(t[1]){const E=decodeURIComponent(t[1]),$=t.length>2?t.slice(2).map(decodeURIComponent).join("/"):void 0;return{view:"code",project:E,...$?{path:$}:{},...c?{wt:c}:{},...m?{line:m}:{},...I?{endLine:I}:{},...l?{returnConversationId:l}:{}}}const b=n.searchParams.get("root")?.trim()||void 0,h=n.searchParams.get("file")?.trim()||void 0;return{view:"code",...b?{root:b}:{},...h?{file:h}:{},...c?{wt:c}:{},...m?{line:m}:{},...I?{endLine:I}:{},...l?{returnConversationId:l}:{}}}if(t[0]==="briefings"&&t[1])return{view:"briefings",briefingId:decodeURIComponent(t[1])};if(t[0]==="briefings")return{view:"briefings"};if(t[0]==="activity")return o({view:"activity"});if(t[0]==="voice")return{view:"voice"};if(t[0]==="work"&&t[1])return o({view:"work",workId:decodeURIComponent(t[1])});if(t[0]==="follow"){const c=os(n.searchParams.get("view")),l={view:"follow",...c?{preferredView:c}:{}},m=t[1],p=t[2]?decodeURIComponent(t[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 I=n.searchParams.get("flightId"),b=n.searchParams.get("invocationId"),h=n.searchParams.get("conversationId"),E=n.searchParams.get("workId"),$=n.searchParams.get("sessionId"),be=n.searchParams.get("targetAgentId");return I&&(l.flightId=I),b&&(l.invocationId=b),h&&(l.conversationId=h),E&&(l.workId=E),$&&(l.sessionId=$),be&&(l.targetAgentId=be),o(l)}if(t[0]==="settings"){if(t[1]==="agents")return{view:"settings",section:"agents",...t[2]?{agentId:decodeURIComponent(t[2])}:{}};const c=ss(t[1]);return{view:"settings",...c?{section:c}:{}}}if(t[0]==="terminal"){const c=rs(n.searchParams.get("mode")),l=n.searchParams.get("session")?.trim()||void 0,m=Mn(n.searchParams.get("surface"))??void 0;if(t[1]==="new"){const I=as(n.searchParams.get("backend"))??"pty",b=is(n.searchParams.get("agent"))??"shell",h=n.searchParams.get("name")?.trim()||void 0,E=n.searchParams.get("tab")?.trim()||void 0,$=n.searchParams.get("socketDir")?.trim()||void 0;return{view:"terminal",terminalBackend:I,terminalAgent:b,...h?{terminalSessionName:h}:{},...E?{terminalTabId:E}:{},...$?{zellijSocketDir:$}:{}}}const p=t[1]==="s"&&t[2]?Me(decodeURIComponent(t.slice(2).join("/")))?decodeURIComponent(t.slice(2).join("/")):null:Bn(t[1]?decodeURIComponent(t[1]):void 0,t[2]?decodeURIComponent(t.slice(2).join("/")):void 0);return p?{view:"terminal",terminalSurfaceKey:p,...l?{terminalSessionId:l}:{},...c?{mode:c}:{}}:{view:"terminal",...t[1]?{agentId:decodeURIComponent(t[1])}:{},...c?{mode:c}:{},...!t[1]&&l?{terminalSessionId:l}:{},...!t[1]&&m?{terminalSurfaceKey:m}:{}}}if(t[0]==="ops"){const c=es(t[1])??"mission";if(!En(c)&&!us(n))return o({view:"inbox"});const l=c==="tail"?n.searchParams.get("q")?.trim():"",m=c==="plan"?n.searchParams.get("plan")?.trim():"",p=n.searchParams.get("flightId")?.trim(),I=n.searchParams.get("invocationId")?.trim(),b=n.searchParams.get("conversationId")?.trim(),h=n.searchParams.get("workId")?.trim(),E=n.searchParams.get("sessionId")?.trim(),$=n.searchParams.get("targetAgentId")?.trim()??n.searchParams.get("agentId")?.trim();return{view:"ops",mode:c,...l?{tailQuery:l}:{},...m?{planDocumentId:m}:{},...p?{flightId:p}:{},...I?{invocationId:I}:{},...b?{conversationId:b}:{},...h?{workId:h}:{},...E?{sessionId:E}:{},...$?{targetAgentId:$}:{}}}return o({view:"inbox"})}function Cn(e,n){const t=e.view==="sessions"&&e.flightId?null:hn(e,n);if(t)return t;switch(e.view){case"inbox":return T("/",e);case"conversation":{const s=new URLSearchParams;return A(s,e),`/c/${encodeURIComponent(e.conversationId)}${w(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),A(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"}${w(s)}`}case"messages":{const s=new URLSearchParams;return A(s,e),`${e.conversationId?`/messages/${encodeURIComponent(e.conversationId)}`:"/messages"}${w(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),A(s,e),`/flights/${encodeURIComponent(e.flightId)}/observe${w(s)}`):(A(s,e),`${e.sessionId?`/sessions/${encodeURIComponent(e.sessionId)}`:"/sessions"}${w(s)}`)}case"repos":{const s=new URLSearchParams;return e.root&&s.set("root",e.root),A(s,e),`/repos${w(s)}`}case"harnesses":return T("/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${w(s)}`}case"search":{const s=e.mode==="indexer"?"/search/indexer":"/search",o=e.filters?qt(e.filters,{hitId:e.hitId??null}):new URLSearchParams;return!e.filters&&e.hitId&&o.set("hit",e.hitId),`${s}${w(o)}`}case"mesh":return T("/mesh",e);case"mesh-ops":return T(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${w(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("/")}`}${w(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 T("/activity",e);case"voice":return"/voice";case"work":return T(`/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==="plan"){const s=new URLSearchParams;return e.mode==="tail"&&e.tailQuery&&s.set("q",e.tailQuery),e.mode==="plan"&&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/${De(e.mode)}${w(s)}`}return`/ops/${De(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(Ie,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)}${w(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${w(s)}`;e.mode&&s.set("mode",e.mode);const o=zn(e.terminalSurfaceKey);return o?`/terminal/${encodeURIComponent(o.backend)}/${encodeURIComponent(o.sessionName)}${w(s)}`:Me(e.terminalSurfaceKey)?`/terminal/s/${encodeURIComponent(e.terminalSurfaceKey)}${w(s)}`:(e.terminalSessionId&&s.set("session",e.terminalSessionId),e.terminalSurfaceKey&&s.set("surface",e.terminalSurfaceKey),`/terminal${w(s)}`)}}}function j(e){const n=hs(e);switch(e.view){case"conversation":return`conv:${e.conversationId}${n}`;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??"",n].join(":");case"sessions":return e.flightId?`flight-observe:${e.flightId}:${e.sessionId??""}:${e.compareSessionId??""}${n}`:e.sessionId?`session:${e.agentId??""}:${e.sessionId}${n}`:`sessions${n}`;case"messages":return e.conversationId?`messages:${e.conversationId}${n}`:`messages${n}`;case"work":return`work:${e.workId}${n}`;case"ops":return`ops:${e.mode??"plan"}:${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??""}${n}`;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}${n}`}}function G(e,n){return ce(Pn(`${e}${n}`))}function An(e){return e?`#${e}`:""}function ws(e){return e.startsWith("/embed/")||e==="/ops/lanes/embed"}function Oe(){if(typeof window>"u"){const e=new URL($n);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 Is(e,n){return e.pathname===n.pathname&&e.searchStr===n.searchStr&&e.hash===n.hash&&Object.is(e.state,n.state)}function vs(e){let n=e.read();const t=new Set;let s=null;const o=()=>{const r=e.read();if(!Is(n,r)){n=r;for(const i of t)i()}};return{getSnapshot:()=>n,subscribe(r){return s||(s=e.observe(o)),t.add(r),()=>{t.delete(r)}},navigateTo(r,i={}){const a=i.state===void 0?n.state:i.state;i.replace?e.replace(r,a):e.push(r,a),o()}}}function Ss(){return typeof window>"u"?{read:Oe,push:()=>{},replace:()=>{},observe:()=>()=>{}}:{read:Oe,push:(e,n)=>window.history.pushState(n,"",e),replace:(e,n)=>window.history.replaceState(n,"",e),observe:e=>(window.addEventListener("popstate",e),window.addEventListener("hashchange",e),()=>{window.removeEventListener("popstate",e),window.removeEventListener("hashchange",e)})}}const F=vs(Ss());function bs(){return P.useSyncExternalStore(F.subscribe,F.getSnapshot,F.getSnapshot)}function ae(e,n={}){F.navigateTo(e,n)}function _n(){return typeof window>"u"?null:window.navigation??null}function Un(){if(typeof window>"u")return!1;const e=_n();return e?e.canGoBack:window.history.length>1}function Ls(){if(!Un())return;const e=_n();if(e){e.back();return}window.history.back()}function bo(e){if(!e||typeof e!="object")return null;const n=e.returnTo;return!n||typeof n!="object"||typeof n.view!="string"?null:n}function Lo(e){return!e||typeof e!="object"?!1:e.returnUseHistory===!0}function xe(e){if(!e||typeof e!="object")return e;const{returnTo:n,returnUseHistory:t,settingsEntry:s,...o}=e;return o}function ys(e,n){if(n.returnTo!==void 0){const t=n.state!==void 0?n.state:xe(e),s=t&&typeof t=="object"?{...t}:{};return s.returnTo=n.returnTo,s.returnUseHistory=n.replace!==!0,s}return n.state!==void 0?n.state:n.replace?e:xe(e)}function kn(e){return e?e.replace(/^#/,""):""}function $s(e,n,t={}){const s=G(e.pathname,e.searchStr),o=gs(n,s),r=t.preserveSearch===!1?"":e.searchStr,i=gn(Cn(o,e.pathname),r),a=kn(t.hash);return{route:o,href:`${i}${a?`#${a}`:""}`}}function Es(e,n){const t=new URLSearchParams(e.searchStr);for(const[r,i]of Object.entries(n.searchPatch??{}))i===null?t.delete(r):t.set(r,i);const s=t.toString(),o=n.hash===void 0?e.hash:kn(n.hash);return`${e.pathname}${s?`?${s}`:""}${o?`#${o}`:""}`}function yo(e){const n=F.getSnapshot(),t=Es(n,e),s=`${n.pathname}${n.searchStr}${An(n.hash)}`;t!==s&&ae(t,{replace:e.replace??!0,state:e.state})}function Rs(e,n,t){if(ws(e))return null;const s=`${e}${n}`,o=Pn(s),r=ce(o),i=gn(Cn(r,e),n);return!(j(o)!==j(r)||r.view==="agents-v2"||s!==i)||s===i?null:`${i}${An(t)}`}function $o(){const{pathname:e,searchStr:n,hash:t}=bs(),s=`${e}${n}`,o=P.useMemo(()=>G(e,n),[e,n]),r=P.useRef({}),i=P.useRef(s);P.useEffect(()=>{const f=Rs(e,n,t);f&&ae(f,{replace:!0})},[e,n,t]),P.useEffect(()=>{if(i.current===s)return;const f=G(e,n);requestAnimationFrame(()=>{window.scrollTo(0,r.current[j(f)]??0)}),i.current=s},[s,e,n]);const a=P.useCallback((f,L={})=>{const C=ce(f.view==="ops"&&!en()&&!En(f.mode)?{view:"inbox"}:f),R=G(e,n),{route:v,href:x}=$s({pathname:e,searchStr:n},C,L);r.current[j(R)]=window.scrollY;const z=F.getSnapshot().state,U=ys(z,L);ae(x,{replace:L.replace,state:U}),requestAnimationFrame(()=>{window.scrollTo(0,r.current[j(v)]??0)})},[e,n]),u=P.useCallback(()=>Ls(),[]),d=Un();return{route:o,navigate:a,navigateBack:u,canNavigateBack:d}}export{Ks as $,jt as A,pe as B,_ as C,so as D,ao as E,ro as F,Io as G,mo as H,vo as I,rt as J,no as K,ot as L,at as M,it as N,Ds as O,yo as P,Xs as Q,pn as R,go as S,mn as T,Js as U,Ms as V,xs as W,Bs as X,yt as Y,Ns as Z,St as _,Cn as a,$t as a0,Hs as a1,Vs as a2,Gs as a3,Ys as a4,zs as a5,Ws as a6,js as a7,tn as a8,nn as a9,oe as aA,co as aB,io as aC,Sn as aD,ve as aa,qs as ab,Qs as ac,V as ad,ne as ae,Us as af,se as ag,q as ah,At as ai,Dt as aj,_t as ak,gn as al,Ft as am,tt as an,Zs as ao,hn as ap,We as aq,eo as ar,$o as as,Vn as at,wn as au,B as av,to as aw,uo as ax,bn as ay,lo as az,Qn as b,Wn as c,ps as d,So as e,qe as f,Ts as g,ue as h,lt as i,ks as j,Fs as k,Os as l,bo as m,Lo as n,ho as o,Yt as p,fo as q,Pn as r,Fe as s,Qt as t,bs as u,wo as v,_s as w,po as x,yn as y,oo as z};
@@ -1 +1 @@
1
- import{r,j as t,u as Ce}from"./index-CzVeWScw.js";import{g as ke,e as Ne,s as Me,a as de,f as Re}from"./scout-voice-S5_YZ2v8.js";import{createLevelHistory as Ee,energyFromPartialDelta as me,tryStartMicLevelMeter as Le,VOICE_WAVE_BARS as he}from"./voice-levels-Dcr3jglk.js";import{L as Ve}from"./loader-circle-Byb9kSFx.js";import{c as ge}from"./createLucideIcon-ClCdc3F9.js";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=ge("mic",Ae);const _e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Pe=ge("square",_e);function Te(e,n=!1){return e.key==="Enter"&&!e.shiftKey&&(n||!!(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,n,l){if(l)return l;switch(e){case"starting":return"Starting voice…";case"recording":return n.trim()?n.trim():null;case"processing":return"Transcribing…";default:return null}}function fe(e){return new Promise(n=>window.setTimeout(n,e))}function Fe({onAppend:e,onError:n,onStatus:l,disabled:L,className:m}){const h=r.useRef(ke()),u=r.useRef(null),g=r.useRef(Ee(he)),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(s=>{W(s),n?.(s)},[n]),X=r.useCallback((s,i,o)=>{l?.({state:s,partial:i,message:qe(s,i,o),tone:o?"error":s==="recording"?"recording":s==="processing"?"processing":"neutral",levels:s==="idle"&&!o?[]:g.current.snapshot(),levelsLive:C.current})},[l]);r.useEffect(()=>{X(v,G,P)},[X,P,G,v,Q]);const A=r.useCallback(async(s=!1)=>{const i=h.current;D(x=>x==="launching"?x:"probing");const o=await i.probe(s?{force:!0}:void 0);return q(o),V(null),D("idle"),o},[]);r.useEffect(()=>{Ne();const s=h.current,i=Me(o=>{q(o.ok),V(null),D("idle")});return s.connectionState==="unknown"?A():(q(s.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(s=>{g.current.push(s),y(i=>i+1)},[]),Z=r.useCallback(()=>{if(b.current)return;let s=performance.now();const i=o=>{if(o-s>=36){s=o;const x=o-(T.current||o),w=me(S.current,S.current,x);g.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 s=h.current;W(null),_(""),S.current="",T.current=performance.now(),g.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 s.startLive({onState:p=>k(De(p)),onPartial:p=>{const U=S.current;if(S.current=p,T.current=performance.now(),_(p),!C.current){const ce=me(U,p,0);B(ce)}},onLevel:p=>{w=!0,C.current=!0,b.current&&(window.cancelAnimationFrame(b.current),b.current=0),B(p)}}),u.current=x,k("recording"),await fe(140),u.current&&!w&&!C.current){const p=await Le(U=>{w=!0,C.current=!0,b.current&&(window.cancelAnimationFrame(b.current),b.current=0),B(U)});p&&u.current?K.current=p: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),g.current.clear(),y(p=>p+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="",g.current.clear(),y(p=>p+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 s=u.current;if(!s)return;k("processing"),N();const i=window.setInterval(()=>{g.current.decay(.82),y(o=>o+1)},50);window.setTimeout(()=>window.clearInterval(i),600);try{await s.stop()}catch(o){try{await s.cancel()}catch{}u.current=null,k("idle");const x=S.current.trim();_(""),S.current="",g.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=(h.current.canRequestMicrophone||R?.action==="request_microphone"||R?.action==="request_speech")&&!f&&!M,O=(h.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:n,processing:l=!1,className:L}){const m=$e(e,he,l?.06:.04),h=["s-msg-compose-wave",n?"s-msg-compose-wave--live":"",l?"s-msg-compose-wave--processing":"",L??""].filter(Boolean).join(" ");return t.jsx("div",{className:h,"aria-hidden":"true","data-wave-source":e&&e.length>0?"levels":"floor",children:m.map((u,g)=>t.jsx("span",{className:"s-msg-compose-wave-bar",style:{transform:`scaleY(${Math.max(.08,u)})`,opacity:l?.28+u*.35:n?.4+u*.55:.25}},g))})}function $e(e,n,l){if(!e||e.length===0)return Array.from({length:n},()=>l);if(e.length===n)return e.map(m=>Math.max(l,Math.min(1,m)));const L=new Array(n);for(let m=0;m<n;m+=1){const h=Math.min(e.length-1,Math.round(m/Math.max(1,n-1)*(e.length-1)));L[m]=Math.max(l,Math.min(1,e[h]??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 pe(e,n){e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,n)}px`}function Oe(e){return e.tone==="error"?"Voice":e.state==="recording"?"Listening":e.state==="processing"?"Transcribing":e.state==="starting"?"Starting":"Voice"}function Xe({renderWhenEmbedded:e=!1,...n}){return Ce()&&!e?null:t.jsx(He,{...n})}function He({value:e,onChange:n,onSend:l,placeholder:L="Type a message…",disabled:m=!1,sending:h=!1,canSend:u,stopMode:g=!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,s]=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&&pe(a,I)},[e,F,I]);const o=(u??e.trim().length>0)&&!h&&!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(()=>{g||!(u??e.trim().length>0)||h||m||l()},[u,m,l,h,g,e]),p=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;n(Y,{caret:a.target.selectionStart??Y.length}),F&&pe(a.target,I)},ve=a=>{const Y=e.trim()?`${e.trimEnd()} ${a}`:a;n(Y,{caret:Y.length}),requestAnimationFrame(()=>H.current?.focus())},be=r.useCallback(a=>{s(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":"",g?"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||h,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||h}):null,R?t.jsx("div",{className:"s-msg-compose-secondary",children:R}):null,g?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:p,children:ue})}export{Fe as D,Xe as M,Pe as S,Be as a,Te as i};
1
+ import{r,j as t,u as Ce}from"./index-o4FKpU7Z.js";import{g as ke,e as Ne,s as Me,a as de,f as Re}from"./scout-voice-B7kXlkcl.js";import{createLevelHistory as Ee,energyFromPartialDelta as me,tryStartMicLevelMeter as Le,VOICE_WAVE_BARS as he}from"./voice-levels-Dcr3jglk.js";import{L as Ve}from"./loader-circle-4LDsy4Ke.js";import{c as ge}from"./createLucideIcon-Bt67PWH-.js";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=ge("mic",Ae);const _e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Pe=ge("square",_e);function Te(e,n=!1){return e.key==="Enter"&&!e.shiftKey&&(n||!!(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,n,l){if(l)return l;switch(e){case"starting":return"Starting voice…";case"recording":return n.trim()?n.trim():null;case"processing":return"Transcribing…";default:return null}}function fe(e){return new Promise(n=>window.setTimeout(n,e))}function Fe({onAppend:e,onError:n,onStatus:l,disabled:L,className:m}){const h=r.useRef(ke()),u=r.useRef(null),g=r.useRef(Ee(he)),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(s=>{W(s),n?.(s)},[n]),X=r.useCallback((s,i,o)=>{l?.({state:s,partial:i,message:qe(s,i,o),tone:o?"error":s==="recording"?"recording":s==="processing"?"processing":"neutral",levels:s==="idle"&&!o?[]:g.current.snapshot(),levelsLive:C.current})},[l]);r.useEffect(()=>{X(v,G,P)},[X,P,G,v,Q]);const A=r.useCallback(async(s=!1)=>{const i=h.current;D(x=>x==="launching"?x:"probing");const o=await i.probe(s?{force:!0}:void 0);return q(o),V(null),D("idle"),o},[]);r.useEffect(()=>{Ne();const s=h.current,i=Me(o=>{q(o.ok),V(null),D("idle")});return s.connectionState==="unknown"?A():(q(s.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(s=>{g.current.push(s),y(i=>i+1)},[]),Z=r.useCallback(()=>{if(b.current)return;let s=performance.now();const i=o=>{if(o-s>=36){s=o;const x=o-(T.current||o),w=me(S.current,S.current,x);g.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 s=h.current;W(null),_(""),S.current="",T.current=performance.now(),g.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 s.startLive({onState:p=>k(De(p)),onPartial:p=>{const U=S.current;if(S.current=p,T.current=performance.now(),_(p),!C.current){const ce=me(U,p,0);B(ce)}},onLevel:p=>{w=!0,C.current=!0,b.current&&(window.cancelAnimationFrame(b.current),b.current=0),B(p)}}),u.current=x,k("recording"),await fe(140),u.current&&!w&&!C.current){const p=await Le(U=>{w=!0,C.current=!0,b.current&&(window.cancelAnimationFrame(b.current),b.current=0),B(U)});p&&u.current?K.current=p: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),g.current.clear(),y(p=>p+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="",g.current.clear(),y(p=>p+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 s=u.current;if(!s)return;k("processing"),N();const i=window.setInterval(()=>{g.current.decay(.82),y(o=>o+1)},50);window.setTimeout(()=>window.clearInterval(i),600);try{await s.stop()}catch(o){try{await s.cancel()}catch{}u.current=null,k("idle");const x=S.current.trim();_(""),S.current="",g.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=(h.current.canRequestMicrophone||R?.action==="request_microphone"||R?.action==="request_speech")&&!f&&!M,O=(h.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:n,processing:l=!1,className:L}){const m=$e(e,he,l?.06:.04),h=["s-msg-compose-wave",n?"s-msg-compose-wave--live":"",l?"s-msg-compose-wave--processing":"",L??""].filter(Boolean).join(" ");return t.jsx("div",{className:h,"aria-hidden":"true","data-wave-source":e&&e.length>0?"levels":"floor",children:m.map((u,g)=>t.jsx("span",{className:"s-msg-compose-wave-bar",style:{transform:`scaleY(${Math.max(.08,u)})`,opacity:l?.28+u*.35:n?.4+u*.55:.25}},g))})}function $e(e,n,l){if(!e||e.length===0)return Array.from({length:n},()=>l);if(e.length===n)return e.map(m=>Math.max(l,Math.min(1,m)));const L=new Array(n);for(let m=0;m<n;m+=1){const h=Math.min(e.length-1,Math.round(m/Math.max(1,n-1)*(e.length-1)));L[m]=Math.max(l,Math.min(1,e[h]??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 pe(e,n){e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,n)}px`}function Oe(e){return e.tone==="error"?"Voice":e.state==="recording"?"Listening":e.state==="processing"?"Transcribing":e.state==="starting"?"Starting":"Voice"}function Xe({renderWhenEmbedded:e=!1,...n}){return Ce()&&!e?null:t.jsx(He,{...n})}function He({value:e,onChange:n,onSend:l,placeholder:L="Type a message…",disabled:m=!1,sending:h=!1,canSend:u,stopMode:g=!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,s]=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&&pe(a,I)},[e,F,I]);const o=(u??e.trim().length>0)&&!h&&!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(()=>{g||!(u??e.trim().length>0)||h||m||l()},[u,m,l,h,g,e]),p=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;n(Y,{caret:a.target.selectionStart??Y.length}),F&&pe(a.target,I)},ve=a=>{const Y=e.trim()?`${e.trimEnd()} ${a}`:a;n(Y,{caret:Y.length}),requestAnimationFrame(()=>H.current?.focus())},be=r.useCallback(a=>{s(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":"",g?"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||h,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||h}):null,R?t.jsx("div",{className:"s-msg-compose-secondary",children:R}):null,g?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:p,children:ue})}export{Fe as D,Xe as M,Pe as S,Be as a,Te as i};
@@ -1 +1 @@
1
- import{k as a,s as l,l as n,m as r,r as m}from"./index-CzVeWScw.js";import{Q as p,R as i,T as c,k as E,U as S}from"./router-B-K15T7B.js";const _={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}],b=o.map(e=>({key:e.key,label:e.label,route:p(e.segment)}));function A(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{b as S,u as a,_ as b,d as c,T as d,L as i,A as s,P as u};
1
+ import{k as a,s as l,l as n,m as r,r as m}from"./index-o4FKpU7Z.js";import{Q as p,R as i,T as c,u as E,U as S}from"./router-C65cZYPn.js";const _={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}],b=o.map(e=>({key:e.key,label:e.label,route:p(e.segment)}));function A(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{b as S,u as a,_ as b,d as c,T as d,L as i,A as s,P as u};
@@ -1 +1 @@
1
- import{_ as x}from"./index-CzVeWScw.js";import{b as k,p as D,V as A,D as q}from"./fx-z37u1o2z.js";function le(t){return t?t.hint?`${t.message} ${t.hint}`:t.message:"Scout voice is unavailable."}async function pe(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(g(n,e.status))}return await e.json()}async function j(t={}){const e=await ce(),n=e.settings,i=e.devices,r=i.length>0||(n.permissions?.length??0)>0,o=n.permissions?.find(f=>f.kind==="microphone")??null,a=n.permissions?.find(f=>f.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 N(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 H=6e4,G=3e3,J=2e4,z=8e3,B=45e3;let M=null,E=null,l=null,_=!1;const R=new Set;function W(){return typeof window>"u"?!1:typeof fetch=="function"}function X(){return M||(M=new K),M}function he(t){return R.add(t),l&&t(l),()=>{R.delete(t)}}function fe(){if(_||!W())return;_=!0;const t=X();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?J:z;return e-t.probedAt<n}class K{state="unknown";unavailableReason=null;captureMode=null;hostReachable=!1;microphoneGranted=null;microphoneCanRequest=null;get connectionState(){return this.state}get lastUnavailableReason(){return this.unavailableReason}get preferredCaptureMode(){return this.captureMode}get isVoiceHostReachable(){return this.hostReachable}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<B?(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??G,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=o.capture==="browser"?"browser":"native",f=r.ok&&o.ok===!0,v=f?null:o.detail??o.error??(a?"Scout voice is not ready.":"Scout voice service is unavailable."),w={ok:f,reason:v,captureMode:f?d:null,hostReachable:a,microphoneGranted:u,microphoneCanRequest:h,probedAt:Date.now()};return l=w,this.applyProbeSnapshot(w),I(w),f}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,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,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 Q(e,n):await Y(e)}}async function Q(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(g(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 f=()=>{d&&window.clearTimeout(d),d=window.setTimeout(()=>{w(new Error("Scout voice transcription timed out. Try again or check voice settings."))},H)},v=()=>{d&&(window.clearTimeout(d),d=null)},w=(s,p="error")=>{o||(o=!0,v(),m.close(),t.onState?.(p),u(s))},y=s=>{o||(o=!0,v(),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 S={};try{S=JSON.parse(p.data)}catch{return}if(s==="session.partial"){const b=typeof S.text=="string"?S.text:"";t.onPartial?.(b);return}if(s==="session.state"){const b=Z(S.state);b&&(t.onState?.(b),b==="processing"&&f());return}if(s==="session.final"){y({sessionId:r,text:typeof S.text=="string"?S.text.trim():"",durationMs:Number(S.durationMs??0)});return}if(s==="session.cancelled"){w(T(),"cancelled");return}if(s==="session.error"){const b=typeof S.message=="string"?S.message:"Scout voice session failed.",L=typeof S.code=="string"?S.code:null;w(new Error(N(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||w(new Error("Scout voice event stream disconnected."))},{get sessionId(){return r},result:h,stop:async()=>{t.onState?.("processing"),f();const s=await fetch(`/api/voice/session/${encodeURIComponent(r)}/stop`,{method:"POST"});if(!s.ok){const p=await s.text().catch(()=>"");throw new Error(g(p,s.status))}},cancel:async()=>{o=!0,v(),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(g(p,s.status))}t.onState?.("cancelled"),u(T())}}}async function Y(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=ae(),i=[];let r=null,o=null,a=null,u=!1,h=!1,d,f;const v=new Promise((c,s)=>{d=c,f=s}),w=()=>{a?.stop(),a=null;for(const c of r?.getTracks()??[])c.stop();r=null},y=(c,s="error")=>{h||(h=!0,w(),t.onState?.(s),f(c))},m=async()=>{if(h)return;if(w(),u){y(T(),"cancelled");return}t.onState?.("processing");const c=o?.mimeType||V()||"application/octet-stream",s=new Blob(i,{type:c});if(s.size===0){y(new Error("No voice audio was captured."));return}try{const p=await ne(s,{sessionId:n});if(h)return;h=!0,t.onFinal?.(p),t.onState?.("done"),d(p)}catch(p){y(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",()=>{y(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 y(s),v.catch(()=>{}),s}return{get sessionId(){return n},result:v,stop:async()=>{!o||o.state==="inactive"||o.stop()},cancel:async()=>{if(u=!0,o&&o.state!=="inactive"){o.stop();return}y(T(),"cancelled")}}}function Z(t){return t==="starting"||t==="recording"||t==="processing"||t==="done"||t==="cancelled"||t==="error"?t:null}function g(t,e){try{return JSON.parse(t).error??`Scout voice returned HTTP ${e}`}catch{return t||`Scout voice returned HTTP ${e}`}}function me(t){return t instanceof Error&&t.name==="AbortError"}async function ee(t,e={}){const n={text:t,speed:se(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 we(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 Se(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 te(t,e={}){const n=await ee(t,e);if(e.signal?.aborted)throw P();const i=await k(n.audioBase64,n.contentType),r=ie(e.presetId,e.params);return await D(i,{params:r,signal:e.signal}).promise,n}function ge(t,e={}){const n=new AbortController;return{promise:te(t,{...e,signal:n.signal}),stop:()=>n.abort()}}async function ne(t,e){const n=new FormData,i=oe(t.type);n.append("audio",t,`audio.${re(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 oe(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 re(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 ie(t,e){const n=t?A.find(i=>i.id===t)?.params:void 0;return{...q,...n??{},...e??{}}}function se(t){if(!(t===void 0||!Number.isFinite(t)))return Math.min(2,Math.max(.5,Number(t.toFixed(2))))}function ae(){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 ce(){const t=await fetch("/api/voice/settings");if(!t.ok){const e=await t.text().catch(()=>"");throw new Error(g(e,t.status))}return await t.json()}async function ve(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(g(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(g(n,e.status))}}async function ye(t=12){const e=await fetch(`/api/voice/history?limit=${t}`);if(!e.ok){const i=await e.text().catch(()=>"");throw new Error(g(i,e.status))}return(await e.json()).sessions??[]}async function be(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(g(n,e.status))}return await e.json()}export{pe as a,we as b,Se as c,ge as d,fe as e,le as f,X as g,ce as h,me as i,ye as j,be as k,ve as o,ee as p,C as r,he as s};
1
+ import{_ as x}from"./index-o4FKpU7Z.js";import{b as k,p as D,V as A,D as q}from"./fx-z37u1o2z.js";function le(t){return t?t.hint?`${t.message} ${t.hint}`:t.message:"Scout voice is unavailable."}async function pe(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(g(n,e.status))}return await e.json()}async function j(t={}){const e=await ce(),n=e.settings,i=e.devices,r=i.length>0||(n.permissions?.length??0)>0,o=n.permissions?.find(f=>f.kind==="microphone")??null,a=n.permissions?.find(f=>f.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 N(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 H=6e4,G=3e3,J=2e4,z=8e3,B=45e3;let M=null,E=null,l=null,_=!1;const R=new Set;function W(){return typeof window>"u"?!1:typeof fetch=="function"}function X(){return M||(M=new K),M}function he(t){return R.add(t),l&&t(l),()=>{R.delete(t)}}function fe(){if(_||!W())return;_=!0;const t=X();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?J:z;return e-t.probedAt<n}class K{state="unknown";unavailableReason=null;captureMode=null;hostReachable=!1;microphoneGranted=null;microphoneCanRequest=null;get connectionState(){return this.state}get lastUnavailableReason(){return this.unavailableReason}get preferredCaptureMode(){return this.captureMode}get isVoiceHostReachable(){return this.hostReachable}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<B?(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??G,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=o.capture==="browser"?"browser":"native",f=r.ok&&o.ok===!0,v=f?null:o.detail??o.error??(a?"Scout voice is not ready.":"Scout voice service is unavailable."),w={ok:f,reason:v,captureMode:f?d:null,hostReachable:a,microphoneGranted:u,microphoneCanRequest:h,probedAt:Date.now()};return l=w,this.applyProbeSnapshot(w),I(w),f}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,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,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 Q(e,n):await Y(e)}}async function Q(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(g(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 f=()=>{d&&window.clearTimeout(d),d=window.setTimeout(()=>{w(new Error("Scout voice transcription timed out. Try again or check voice settings."))},H)},v=()=>{d&&(window.clearTimeout(d),d=null)},w=(s,p="error")=>{o||(o=!0,v(),m.close(),t.onState?.(p),u(s))},y=s=>{o||(o=!0,v(),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 S={};try{S=JSON.parse(p.data)}catch{return}if(s==="session.partial"){const b=typeof S.text=="string"?S.text:"";t.onPartial?.(b);return}if(s==="session.state"){const b=Z(S.state);b&&(t.onState?.(b),b==="processing"&&f());return}if(s==="session.final"){y({sessionId:r,text:typeof S.text=="string"?S.text.trim():"",durationMs:Number(S.durationMs??0)});return}if(s==="session.cancelled"){w(T(),"cancelled");return}if(s==="session.error"){const b=typeof S.message=="string"?S.message:"Scout voice session failed.",L=typeof S.code=="string"?S.code:null;w(new Error(N(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||w(new Error("Scout voice event stream disconnected."))},{get sessionId(){return r},result:h,stop:async()=>{t.onState?.("processing"),f();const s=await fetch(`/api/voice/session/${encodeURIComponent(r)}/stop`,{method:"POST"});if(!s.ok){const p=await s.text().catch(()=>"");throw new Error(g(p,s.status))}},cancel:async()=>{o=!0,v(),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(g(p,s.status))}t.onState?.("cancelled"),u(T())}}}async function Y(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=ae(),i=[];let r=null,o=null,a=null,u=!1,h=!1,d,f;const v=new Promise((c,s)=>{d=c,f=s}),w=()=>{a?.stop(),a=null;for(const c of r?.getTracks()??[])c.stop();r=null},y=(c,s="error")=>{h||(h=!0,w(),t.onState?.(s),f(c))},m=async()=>{if(h)return;if(w(),u){y(T(),"cancelled");return}t.onState?.("processing");const c=o?.mimeType||V()||"application/octet-stream",s=new Blob(i,{type:c});if(s.size===0){y(new Error("No voice audio was captured."));return}try{const p=await ne(s,{sessionId:n});if(h)return;h=!0,t.onFinal?.(p),t.onState?.("done"),d(p)}catch(p){y(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",()=>{y(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 y(s),v.catch(()=>{}),s}return{get sessionId(){return n},result:v,stop:async()=>{!o||o.state==="inactive"||o.stop()},cancel:async()=>{if(u=!0,o&&o.state!=="inactive"){o.stop();return}y(T(),"cancelled")}}}function Z(t){return t==="starting"||t==="recording"||t==="processing"||t==="done"||t==="cancelled"||t==="error"?t:null}function g(t,e){try{return JSON.parse(t).error??`Scout voice returned HTTP ${e}`}catch{return t||`Scout voice returned HTTP ${e}`}}function me(t){return t instanceof Error&&t.name==="AbortError"}async function ee(t,e={}){const n={text:t,speed:se(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 we(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 Se(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 te(t,e={}){const n=await ee(t,e);if(e.signal?.aborted)throw P();const i=await k(n.audioBase64,n.contentType),r=ie(e.presetId,e.params);return await D(i,{params:r,signal:e.signal}).promise,n}function ge(t,e={}){const n=new AbortController;return{promise:te(t,{...e,signal:n.signal}),stop:()=>n.abort()}}async function ne(t,e){const n=new FormData,i=oe(t.type);n.append("audio",t,`audio.${re(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 oe(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 re(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 ie(t,e){const n=t?A.find(i=>i.id===t)?.params:void 0;return{...q,...n??{},...e??{}}}function se(t){if(!(t===void 0||!Number.isFinite(t)))return Math.min(2,Math.max(.5,Number(t.toFixed(2))))}function ae(){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 ce(){const t=await fetch("/api/voice/settings");if(!t.ok){const e=await t.text().catch(()=>"");throw new Error(g(e,t.status))}return await t.json()}async function ve(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(g(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(g(n,e.status))}}async function ye(t=12){const e=await fetch(`/api/voice/history?limit=${t}`);if(!e.ok){const i=await e.text().catch(()=>"");throw new Error(g(i,e.status))}return(await e.json()).sessions??[]}async function be(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(g(n,e.status))}return await e.json()}export{pe as a,we as b,Se as c,ge as d,fe as e,le as f,X as g,ce as h,me as i,ye as j,be as k,ve as o,ee as p,C as r,he as s};
@@ -1 +1 @@
1
- import{c as a}from"./createLucideIcon-ClCdc3F9.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-Bt67PWH-.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-ClCdc3F9.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-Bt67PWH-.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 +1 @@
1
- import{c as a}from"./createLucideIcon-ClCdc3F9.js";import{M as w}from"./message-square-CIXda-Y7.js";import{F as l}from"./file-text-DG-pufl1.js";import{S as c}from"./search-C3bSJluv.js";import{T as y}from"./terminal-DrTkVXIj.js";import{C as k}from"./code-xml--LjSM4Mv.js";import{S as g}from"./scroll-text-BV-BB7v-.js";const O=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]],p=a("compass",O);const S=[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]],_=a("folder-kanban",S);const A=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],N=a("git-branch",A);const j=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],v=a("house",j);const E=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],u=a("send",E);const R=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],C=a("settings",R),M=[{id:"home",label:"Home",icon:v,defaultRoute:{view:"inbox"},section:"navigate"},{id:"chat",label:"Messages",icon:w,defaultRoute:{view:"messages"},section:"navigate"},{id:"projects",label:"Projects",icon:_,defaultRoute:{view:"agents-v2"},section:"navigate"},{id:"sessions",label:"Sessions",icon:l,defaultRoute:{view:"sessions"},section:"navigate"},{id:"dispatch",label:"Dispatch",icon:u,defaultRoute:{view:"broker"},section:"navigate"},{id:"search",label:"Search",icon:c,defaultRoute:{view:"search"},section:"navigate"},{id:"ops",label:"Operations",icon:p,defaultRoute:{view:"ops",mode:"mission"},section:"system"},{id:"settings",label:"Settings",icon:C,defaultRoute:{view:"settings",section:"appearance"},section:"system"}],d={inbox:"home",activity:"home",briefings:"home","agents-v2":"projects","agent-info":"projects",repos:"projects","repo-diff":"projects",code:"projects",sessions:"sessions",terminal:"sessions",messages:"chat",conversation:"chat",broker:"dispatch",work:"dispatch",follow:"dispatch",search:"search",ops:"ops",mesh:"ops","mesh-ops":"ops",harnesses:"ops",settings:"settings",voice:"settings"},T=new Map(M.map(e=>[e.id,e]));function G(e){const i=T.get(e);if(!i)throw new Error(`Unknown primary area: ${e}`);return i}function se(e){if(e.view==="follow"&&e.preferredView)switch(e.preferredView){case"tail":return"ops";case"session":return"sessions";case"chat":return"chat";case"work":return"dispatch"}return d[e.view]}function ae(e,i){const t=G(e);return e==="ops"?i?.opsControlEnabled??!0?{view:"ops",mode:"mission"}:{view:"ops",mode:"tail"}:t.defaultRoute}function P(e){return e.view==="ops"&&(e.mode===void 0||e.mode==="mission"||e.mode==="issues")}const D=[{id:"home",label:"Home",route:{view:"inbox"},active:e=>e.view==="inbox"},{id:"projects",label:"Projects",route:{view:"agents-v2"},active:e=>e.view==="agents-v2"||e.view==="agent-info"},{id:"sessions",label:"Sessions",route:{view:"sessions"},active:e=>e.view==="sessions"},{id:"chat",label:"Messages",route:{view:"messages"},active:e=>e.view==="messages"||e.view==="conversation"},{id:"search",label:"Search",route:{view:"search"},active:e=>e.view==="search"},{id:"terminals",label:"Terminals",route:{view:"terminal"},active:e=>e.view==="terminal"},{id:"tail",label:"Live Activity",route:{view:"ops",mode:"tail"},active:e=>e.view==="ops"&&e.mode==="tail"},{id:"dispatch",label:"Dispatch",route:{view:"broker"},active:e=>e.view==="broker"},{id:"activity",label:"Activity Log",route:{view:"activity"},active:e=>e.view==="activity"},{id:"mesh",label:"Network",route:{view:"mesh"},active:e=>e.view==="mesh"},{id:"mesh-ops",label:"Mesh Ops",route:{view:"mesh-ops"},active:e=>e.view==="mesh-ops",capability:"surface.mesh-ops"},{id:"mission-control",label:"Mission Control",route:{view:"ops",mode:"mission"},active:P,capability:"ops.control"},{id:"lanes",label:"Agent Lanes",route:{view:"ops",mode:"lanes"},active:e=>e.view==="ops"&&e.mode==="lanes"},{id:"repos",label:"Repositories",route:{view:"repos"},active:e=>e.view==="repos"||e.view==="repo-diff"},{id:"code",label:"Code Browser",route:{view:"code"},active:e=>e.view==="code"},{id:"providers",label:"Agent Providers",route:{view:"harnesses"},active:e=>e.view==="harnesses"},{id:"runtime",label:"Runtime Monitor",route:{view:"ops",mode:"atop"},active:e=>e.view==="ops"&&e.mode==="atop",capability:"ops.control"},{id:"plans",label:"Plans",route:{view:"ops",mode:"plan"},active:e=>e.view==="ops"&&e.mode==="plan"},{id:"agent-config",label:"Agent Configuration",route:{view:"settings",section:"agents"},active:e=>e.view==="settings"&&e.section==="agents"}],x=new Map(D.map(e=>[e.id,e]));function s(e){const i=x.get(e);if(!i)throw new Error(`Unknown nav destination: ${e}`);return i}function n(e,i){const t=s(e);return{id:t.id,label:i?.label??t.label,route:i?.route??t.route,active:i?.active??t.active,capability:t.capability}}const V=[{destinationId:"home",key:"home"},{destinationId:"projects",key:"agents",label:"Projects"},{destinationId:"sessions",key:"sessions"},{destinationId:"chat",key:"chat",label:"Messages"}];function ne(){return V.map(e=>{const i=s(e.destinationId);return{key:e.key,label:e.label??i.label,route:i.route}})}const B=[{destinationId:"search",key:"search"},{destinationId:"terminals",key:"terminals"},{destinationId:"tail",key:"tail"},{destinationId:"dispatch",key:"dispatch"}],J=[{destinationId:"mission-control",key:"control"},{destinationId:"lanes",key:"lanes"},{destinationId:"repos",key:"repos"},{destinationId:"code",key:"code"},{destinationId:"providers",key:"providers"},{destinationId:"mesh",key:"mesh"},{destinationId:"mesh-ops",key:"mesh-ops"},{destinationId:"runtime",key:"runtime"},{destinationId:"plans",key:"plans"}];function b(e){const i=n(e.destinationId,{label:e.label});return{key:e.key,label:i.label,route:i.route,active:i.active,destinationId:i.id,capability:i.capability}}function de(){return B.map(b)}function re(){return J.map(b)}function m(e){return{items:e.map(i=>{const t=n(i.destinationId,{label:i.label,route:i.route,active:i.active});return{id:i.id,label:t.label,route:t.route,active:t.active}})}}function U(){return[m([{destinationId:"agent-config",id:"config",label:"Agent Configuration"}])]}function F(){return[m([{destinationId:"lanes",id:"lanes"},{destinationId:"mission-control",id:"control"},{destinationId:"providers",id:"harnesses",label:"Agent Providers"},{destinationId:"mesh",id:"mesh"},{destinationId:"tail",id:"tail"},{destinationId:"runtime",id:"runtime"},{destinationId:"plans",id:"plans"}])]}const L=[{key:"h",label:"Go home",destinationId:"home"},{key:"i",label:"Go to messages",destinationId:"chat"},{key:"c",label:"Go to messages",destinationId:"chat"},{key:"p",label:"Go to projects",destinationId:"projects"},{key:"s",label:"Go to sessions",destinationId:"sessions"},{key:"t",label:"Go to terminals",destinationId:"terminals"},{key:"r",label:"Go to repositories",destinationId:"repos"},{key:"b",label:"Go to code browser",destinationId:"code"},{key:"f",label:"Go to search",destinationId:"search"},{key:"l",label:"Go to live activity",destinationId:"tail"},{key:"o",label:"Go to operations",destinationId:"mission-control",route:{view:"ops"}},{key:"d",label:"Go to dispatch",destinationId:"dispatch"},{key:"m",label:"Go to network",destinationId:"mesh"},{key:"a",label:"Go to activity log",destinationId:"activity"}];function le(){return L.map(e=>{const i=s(e.destinationId);return{key:e.key,label:e.label,route:e.route??i.route,destinationId:e.destinationId}})}const Y=[{destinationId:"sessions",id:"sessions",icon:l},{destinationId:"terminals",id:"terminals",icon:y},{destinationId:"repos",id:"repos",icon:N},{destinationId:"code",id:"code",icon:k},{destinationId:"search",id:"search",icon:c},{destinationId:"tail",id:"tail",icon:g},{destinationId:"mission-control",id:"ops",label:"Operations",icon:p,route:{view:"ops",mode:"mission"},opsGated:!0},{destinationId:"home",id:"home",icon:v},{destinationId:"dispatch",id:"dispatch",icon:u}];function ce(){return Y.map(e=>{const i=s(e.destinationId);return{id:e.id,label:e.label??i.label,icon:e.icon,route:e.route??i.route,destinationId:e.destinationId,opsGated:e.opsGated??i.capability==="ops.control"}})}const H=[{id:"nav:home",label:"Go to Home",destinationId:"home",shortcut:"Cmd+1"},{id:"nav:agents",label:"Go to Projects",destinationId:"projects",shortcut:"Cmd+2"},{id:"nav:messages",label:"Go to Chat",destinationId:"chat",shortcut:"Cmd+3"},{id:"nav:sessions",label:"Open Sessions",destinationId:"sessions"},{id:"nav:terminals",label:"Open Terminals",destinationId:"terminals"},{id:"nav:search",label:"Go to Search",destinationId:"search",shortcut:"Cmd+4"},{id:"nav:activity",label:"Open Activity",destinationId:"activity"},{id:"nav:mesh",label:"Open Mesh",destinationId:"mesh"},{id:"nav:dispatch",label:"Open Dispatch",destinationId:"dispatch"},{id:"nav:repos",label:"Open Repos",destinationId:"repos"},{id:"nav:code",label:"Open Code Browser",destinationId:"code"},{id:"nav:harnesses",label:"Open Providers",destinationId:"providers"},{id:"nav:ops-lanes",label:"Open Agent Lanes",destinationId:"lanes"},{id:"nav:ops",label:"Go to Ops",destinationId:"mission-control",route:{view:"ops"},shortcut:"Cmd+5",capability:"ops.control"},{id:"nav:ops-atop",label:"Open Runtime",destinationId:"runtime",capability:"ops.control"},{id:"nav:agent-config",label:"Open Agent Configuration",destinationId:"agent-config"}];function $(e){const i=e?.opsEnabled??!0;return H.filter(t=>!((t.capability??s(t.destinationId).capability)==="ops.control"&&!i)).map(t=>{const o=s(t.destinationId);return{id:t.id,label:t.label,destinationId:t.destinationId,route:t.route??o.route,shortcut:t.shortcut,capability:t.capability??o.capability}})}function pe(e,i){return $(i).map(t=>({id:t.id,label:t.label,action:()=>e(t.route),shortcut:t.shortcut}))}const h={projects:[{destinationId:"projects",id:"projects",label:"Projects"},{destinationId:"repos",id:"repos"},{destinationId:"code",id:"code"}],sessions:[{destinationId:"sessions",id:"sessions"},{destinationId:"terminals",id:"terminals"}]};function z(e){const i=n(e.destinationId,{label:e.label});return{id:e.id,label:i.label,route:i.route,active:i.active,destinationId:i.id}}function q(e){return h[e].map(z)}function ve(e){const i=d[e.view];if(i!=="projects"&&i!=="sessions")return null;const t=i;return{areaId:t,items:q(t)}}const r={...h,dispatch:[{destinationId:"dispatch",id:"dispatch-all",label:"All Dispatches",route:{view:"broker"},active:e=>e.view==="broker"&&(e.filter===void 0||e.filter==="all")},{destinationId:"dispatch",id:"dispatch-delivered",label:"Delivered",route:{view:"broker",filter:"delivered"},active:e=>e.view==="broker"&&e.filter==="delivered"},{destinationId:"dispatch",id:"dispatch-failed",label:"Failed",route:{view:"broker",filter:"failed"},active:e=>e.view==="broker"&&e.filter==="failed"}],ops:[{destinationId:"lanes",id:"lanes",label:"Lanes"},{destinationId:"mission-control",id:"control"},{destinationId:"providers",id:"harnesses",label:"Providers"},{destinationId:"runtime",id:"runtime",label:"Runtime"},{destinationId:"mesh",id:"mesh"},{destinationId:"tail",id:"tail"},{destinationId:"plans",id:"plans"}]};function K(e){const i=n(e.destinationId,{label:e.label,route:e.route,active:e.active});return{id:e.id,label:i.label,route:i.route,active:i.active,destinationId:i.id}}function ue(e,i){const t=d[e.view];if(!(t in r))return null;const o=t,I=r[o].map(K).filter(f=>s(f.destinationId).capability!=="ops.control"||i?.opsControlEnabled!==!1);return{areaId:o,items:I}}const be=U(),me=F();export{be as A,me as O,M as P,C as S,de as a,re as b,pe as c,ce as d,le as e,se as f,ae as g,G as h,ve as i,ne as p,ue as s};
1
+ import{c as a}from"./createLucideIcon-Bt67PWH-.js";import{M as w}from"./message-square-ER1_q2pe.js";import{F as l}from"./file-text-iF0hyVyU.js";import{S as c}from"./search-7_n7CxWl.js";import{T as y}from"./terminal-By1Lw2i2.js";import{C as k}from"./code-xml-CLn3TDWF.js";import{S as g}from"./scroll-text-BuneRiAD.js";const O=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]],p=a("compass",O);const S=[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]],_=a("folder-kanban",S);const A=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],N=a("git-branch",A);const j=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],v=a("house",j);const E=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],u=a("send",E);const R=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],C=a("settings",R),M=[{id:"home",label:"Home",icon:v,defaultRoute:{view:"inbox"},section:"navigate"},{id:"chat",label:"Messages",icon:w,defaultRoute:{view:"messages"},section:"navigate"},{id:"projects",label:"Projects",icon:_,defaultRoute:{view:"agents-v2"},section:"navigate"},{id:"sessions",label:"Sessions",icon:l,defaultRoute:{view:"sessions"},section:"navigate"},{id:"dispatch",label:"Dispatch",icon:u,defaultRoute:{view:"broker"},section:"navigate"},{id:"search",label:"Search",icon:c,defaultRoute:{view:"search"},section:"navigate"},{id:"ops",label:"Operations",icon:p,defaultRoute:{view:"ops",mode:"mission"},section:"system"},{id:"settings",label:"Settings",icon:C,defaultRoute:{view:"settings",section:"appearance"},section:"system"}],d={inbox:"home",activity:"home",briefings:"home","agents-v2":"projects","agent-info":"projects",repos:"projects","repo-diff":"projects",code:"projects",sessions:"sessions",terminal:"sessions",messages:"chat",conversation:"chat",broker:"dispatch",work:"dispatch",follow:"dispatch",search:"search",ops:"ops",mesh:"ops","mesh-ops":"ops",harnesses:"ops",settings:"settings",voice:"settings"},T=new Map(M.map(e=>[e.id,e]));function G(e){const i=T.get(e);if(!i)throw new Error(`Unknown primary area: ${e}`);return i}function se(e){if(e.view==="follow"&&e.preferredView)switch(e.preferredView){case"tail":return"ops";case"session":return"sessions";case"chat":return"chat";case"work":return"dispatch"}return d[e.view]}function ae(e,i){const t=G(e);return e==="ops"?i?.opsControlEnabled??!0?{view:"ops",mode:"mission"}:{view:"ops",mode:"tail"}:t.defaultRoute}function P(e){return e.view==="ops"&&(e.mode===void 0||e.mode==="mission"||e.mode==="issues")}const D=[{id:"home",label:"Home",route:{view:"inbox"},active:e=>e.view==="inbox"},{id:"projects",label:"Projects",route:{view:"agents-v2"},active:e=>e.view==="agents-v2"||e.view==="agent-info"},{id:"sessions",label:"Sessions",route:{view:"sessions"},active:e=>e.view==="sessions"},{id:"chat",label:"Messages",route:{view:"messages"},active:e=>e.view==="messages"||e.view==="conversation"},{id:"search",label:"Search",route:{view:"search"},active:e=>e.view==="search"},{id:"terminals",label:"Terminals",route:{view:"terminal"},active:e=>e.view==="terminal"},{id:"tail",label:"Live Activity",route:{view:"ops",mode:"tail"},active:e=>e.view==="ops"&&e.mode==="tail"},{id:"dispatch",label:"Dispatch",route:{view:"broker"},active:e=>e.view==="broker"},{id:"activity",label:"Activity Log",route:{view:"activity"},active:e=>e.view==="activity"},{id:"mesh",label:"Network",route:{view:"mesh"},active:e=>e.view==="mesh"},{id:"mesh-ops",label:"Mesh Ops",route:{view:"mesh-ops"},active:e=>e.view==="mesh-ops",capability:"surface.mesh-ops"},{id:"mission-control",label:"Mission Control",route:{view:"ops",mode:"mission"},active:P,capability:"ops.control"},{id:"lanes",label:"Agent Lanes",route:{view:"ops",mode:"lanes"},active:e=>e.view==="ops"&&e.mode==="lanes"},{id:"repos",label:"Repositories",route:{view:"repos"},active:e=>e.view==="repos"||e.view==="repo-diff"},{id:"code",label:"Code Browser",route:{view:"code"},active:e=>e.view==="code"},{id:"providers",label:"Agent Providers",route:{view:"harnesses"},active:e=>e.view==="harnesses"},{id:"runtime",label:"Runtime Monitor",route:{view:"ops",mode:"atop"},active:e=>e.view==="ops"&&e.mode==="atop",capability:"ops.control"},{id:"plans",label:"Plans",route:{view:"ops",mode:"plan"},active:e=>e.view==="ops"&&e.mode==="plan"},{id:"agent-config",label:"Agent Configuration",route:{view:"settings",section:"agents"},active:e=>e.view==="settings"&&e.section==="agents"}],x=new Map(D.map(e=>[e.id,e]));function s(e){const i=x.get(e);if(!i)throw new Error(`Unknown nav destination: ${e}`);return i}function n(e,i){const t=s(e);return{id:t.id,label:i?.label??t.label,route:i?.route??t.route,active:i?.active??t.active,capability:t.capability}}const V=[{destinationId:"home",key:"home"},{destinationId:"projects",key:"agents",label:"Projects"},{destinationId:"sessions",key:"sessions"},{destinationId:"chat",key:"chat",label:"Messages"}];function ne(){return V.map(e=>{const i=s(e.destinationId);return{key:e.key,label:e.label??i.label,route:i.route}})}const B=[{destinationId:"search",key:"search"},{destinationId:"terminals",key:"terminals"},{destinationId:"tail",key:"tail"},{destinationId:"dispatch",key:"dispatch"}],J=[{destinationId:"mission-control",key:"control"},{destinationId:"lanes",key:"lanes"},{destinationId:"repos",key:"repos"},{destinationId:"code",key:"code"},{destinationId:"providers",key:"providers"},{destinationId:"mesh",key:"mesh"},{destinationId:"mesh-ops",key:"mesh-ops"},{destinationId:"runtime",key:"runtime"},{destinationId:"plans",key:"plans"}];function b(e){const i=n(e.destinationId,{label:e.label});return{key:e.key,label:i.label,route:i.route,active:i.active,destinationId:i.id,capability:i.capability}}function de(){return B.map(b)}function re(){return J.map(b)}function m(e){return{items:e.map(i=>{const t=n(i.destinationId,{label:i.label,route:i.route,active:i.active});return{id:i.id,label:t.label,route:t.route,active:t.active}})}}function U(){return[m([{destinationId:"agent-config",id:"config",label:"Agent Configuration"}])]}function F(){return[m([{destinationId:"lanes",id:"lanes"},{destinationId:"mission-control",id:"control"},{destinationId:"providers",id:"harnesses",label:"Agent Providers"},{destinationId:"mesh",id:"mesh"},{destinationId:"tail",id:"tail"},{destinationId:"runtime",id:"runtime"},{destinationId:"plans",id:"plans"}])]}const L=[{key:"h",label:"Go home",destinationId:"home"},{key:"i",label:"Go to messages",destinationId:"chat"},{key:"c",label:"Go to messages",destinationId:"chat"},{key:"p",label:"Go to projects",destinationId:"projects"},{key:"s",label:"Go to sessions",destinationId:"sessions"},{key:"t",label:"Go to terminals",destinationId:"terminals"},{key:"r",label:"Go to repositories",destinationId:"repos"},{key:"b",label:"Go to code browser",destinationId:"code"},{key:"f",label:"Go to search",destinationId:"search"},{key:"l",label:"Go to live activity",destinationId:"tail"},{key:"o",label:"Go to operations",destinationId:"mission-control",route:{view:"ops"}},{key:"d",label:"Go to dispatch",destinationId:"dispatch"},{key:"m",label:"Go to network",destinationId:"mesh"},{key:"a",label:"Go to activity log",destinationId:"activity"}];function le(){return L.map(e=>{const i=s(e.destinationId);return{key:e.key,label:e.label,route:e.route??i.route,destinationId:e.destinationId}})}const Y=[{destinationId:"sessions",id:"sessions",icon:l},{destinationId:"terminals",id:"terminals",icon:y},{destinationId:"repos",id:"repos",icon:N},{destinationId:"code",id:"code",icon:k},{destinationId:"search",id:"search",icon:c},{destinationId:"tail",id:"tail",icon:g},{destinationId:"mission-control",id:"ops",label:"Operations",icon:p,route:{view:"ops",mode:"mission"},opsGated:!0},{destinationId:"home",id:"home",icon:v},{destinationId:"dispatch",id:"dispatch",icon:u}];function ce(){return Y.map(e=>{const i=s(e.destinationId);return{id:e.id,label:e.label??i.label,icon:e.icon,route:e.route??i.route,destinationId:e.destinationId,opsGated:e.opsGated??i.capability==="ops.control"}})}const H=[{id:"nav:home",label:"Go to Home",destinationId:"home",shortcut:"Cmd+1"},{id:"nav:agents",label:"Go to Projects",destinationId:"projects",shortcut:"Cmd+2"},{id:"nav:messages",label:"Go to Chat",destinationId:"chat",shortcut:"Cmd+3"},{id:"nav:sessions",label:"Open Sessions",destinationId:"sessions"},{id:"nav:terminals",label:"Open Terminals",destinationId:"terminals"},{id:"nav:search",label:"Go to Search",destinationId:"search",shortcut:"Cmd+4"},{id:"nav:activity",label:"Open Activity",destinationId:"activity"},{id:"nav:mesh",label:"Open Mesh",destinationId:"mesh"},{id:"nav:dispatch",label:"Open Dispatch",destinationId:"dispatch"},{id:"nav:repos",label:"Open Repos",destinationId:"repos"},{id:"nav:code",label:"Open Code Browser",destinationId:"code"},{id:"nav:harnesses",label:"Open Providers",destinationId:"providers"},{id:"nav:ops-lanes",label:"Open Agent Lanes",destinationId:"lanes"},{id:"nav:ops",label:"Go to Ops",destinationId:"mission-control",route:{view:"ops"},shortcut:"Cmd+5",capability:"ops.control"},{id:"nav:ops-atop",label:"Open Runtime",destinationId:"runtime",capability:"ops.control"},{id:"nav:agent-config",label:"Open Agent Configuration",destinationId:"agent-config"}];function $(e){const i=e?.opsEnabled??!0;return H.filter(t=>!((t.capability??s(t.destinationId).capability)==="ops.control"&&!i)).map(t=>{const o=s(t.destinationId);return{id:t.id,label:t.label,destinationId:t.destinationId,route:t.route??o.route,shortcut:t.shortcut,capability:t.capability??o.capability}})}function pe(e,i){return $(i).map(t=>({id:t.id,label:t.label,action:()=>e(t.route),shortcut:t.shortcut}))}const h={projects:[{destinationId:"projects",id:"projects",label:"Projects"},{destinationId:"repos",id:"repos"},{destinationId:"code",id:"code"}],sessions:[{destinationId:"sessions",id:"sessions"},{destinationId:"terminals",id:"terminals"}]};function z(e){const i=n(e.destinationId,{label:e.label});return{id:e.id,label:i.label,route:i.route,active:i.active,destinationId:i.id}}function q(e){return h[e].map(z)}function ve(e){const i=d[e.view];if(i!=="projects"&&i!=="sessions")return null;const t=i;return{areaId:t,items:q(t)}}const r={...h,dispatch:[{destinationId:"dispatch",id:"dispatch-all",label:"All Dispatches",route:{view:"broker"},active:e=>e.view==="broker"&&(e.filter===void 0||e.filter==="all")},{destinationId:"dispatch",id:"dispatch-delivered",label:"Delivered",route:{view:"broker",filter:"delivered"},active:e=>e.view==="broker"&&e.filter==="delivered"},{destinationId:"dispatch",id:"dispatch-failed",label:"Failed",route:{view:"broker",filter:"failed"},active:e=>e.view==="broker"&&e.filter==="failed"}],ops:[{destinationId:"lanes",id:"lanes",label:"Lanes"},{destinationId:"mission-control",id:"control"},{destinationId:"providers",id:"harnesses",label:"Providers"},{destinationId:"runtime",id:"runtime",label:"Runtime"},{destinationId:"mesh",id:"mesh"},{destinationId:"tail",id:"tail"},{destinationId:"plans",id:"plans"}]};function K(e){const i=n(e.destinationId,{label:e.label,route:e.route,active:e.active});return{id:e.id,label:i.label,route:i.route,active:i.active,destinationId:i.id}}function ue(e,i){const t=d[e.view];if(!(t in r))return null;const o=t,I=r[o].map(K).filter(f=>s(f.destinationId).capability!=="ops.control"||i?.opsControlEnabled!==!1);return{areaId:o,items:I}}const be=U(),me=F();export{be as A,me as O,M as P,C as S,de as a,re as b,pe as c,ce as d,le as e,se as f,ae as g,G as h,ve as i,ne as p,ue as s};
@@ -1 +1 @@
1
- import{j as r,r as o}from"./index-CzVeWScw.js";import{j as l}from"./ui-LM8pS8qE.js";function p({branch:t,fallback:s}){const e=l(t,s);return e.detached?r.jsx("span",{className:"pre",children:e.sha??"detached"}):e.prefix?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"pre",children:e.prefix}),e.leaf]}):r.jsx(r.Fragment,{children:e.leaf})}const a={worktree:null,project:null,generatedAt:0,tone:"warm"};let n=a;const c=new Set;function i(){for(const t of c)t()}function h(t){n=t,i()}function d(){n!==a&&(n=a,i())}function m(){const[t,s]=o.useState(()=>n);return o.useEffect(()=>{s(n);const e=()=>s(n);return c.add(e),()=>{c.delete(e)}},[]),t}export{p as B,d as c,h as p,m as u};
1
+ import{j as r,r as o}from"./index-o4FKpU7Z.js";import{j as l}from"./ui-LM8pS8qE.js";function p({branch:t,fallback:s}){const e=l(t,s);return e.detached?r.jsx("span",{className:"pre",children:e.sha??"detached"}):e.prefix?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"pre",children:e.prefix}),e.leaf]}):r.jsx(r.Fragment,{children:e.leaf})}const a={worktree:null,project:null,generatedAt:0,tone:"warm"};let n=a;const c=new Set;function i(){for(const t of c)t()}function h(t){n=t,i()}function d(){n!==a&&(n=a,i())}function m(){const[t,s]=o.useState(()=>n);return o.useEffect(()=>{s(n);const e=()=>s(n);return c.add(e),()=>{c.delete(e)}},[]),t}export{p as B,d as c,h as p,m as u};
@@ -1 +1 @@
1
- import{c as a}from"./createLucideIcon-ClCdc3F9.js";const o=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],e=a("send-horizontal",o);export{e as S};
1
+ import{c as a}from"./createLucideIcon-Bt67PWH-.js";const o=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],e=a("send-horizontal",o);export{e as S};
@@ -1 +1 @@
1
- import{c as e}from"./createLucideIcon-ClCdc3F9.js";const r=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],i=e("server",r);export{i as S};
1
+ import{c as e}from"./createLucideIcon-Bt67PWH-.js";const r=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],i=e("server",r);export{i as S};
@@ -1 +1 @@
1
- import{r as d}from"./terminal-relay-BkXjjSkq.js";function S(r,e){const s=d(r),n=s?r.harnessSessionId??s.sessionName:null;return e?.activeSessionId??n}function I(r,e){return[...r].sort((s,n)=>{const t=s.id===e?1:0,o=n.id===e?1:0;return t!==o?o-t:(n.endedAt??n.startedAt)-(s.endedAt??s.startedAt)})}function c(r){const e=r;return[e.id,e.surfaceSessionId,e.harnessSessionId,e.externalSessionId,e.threadId,e.runtimeSessionId,e.runtimeSessionRef,e.runtimeRef,e.sourceSessionId,e.sessionId,e.refId].flatMap(s=>{const n=s?.trim();return n?[n]:[]})}function u(r){const e=/^relay-(.+)-(claude|codex)$/iu.exec(r);return e?{scope:e[1].toLowerCase(),harness:e[2].toLowerCase()}:null}function l(r,e){const s=u(r),n=u(e);return!s||!n?!1:s.harness===n.harness&&(s.scope===n.scope||s.scope.startsWith(`${n.scope}-`))}function f(r,e){const s=r?.trim();if(!s)return null;const n=e.find(a=>c(a).some(i=>i===s));if(n)return n.id;const t=e.filter(a=>c(a).some(i=>l(i,s)));return new Set(t.map(a=>a.id)).size===1?t[0]?.id??null:null}function h(r,e,s,n,t){const o=f(t,n);return o||(s??n[0]?.id??null)}function A(r,e,s,n){const t=!!d(r),o=n&&(!!s.canObserve||t),a=n&&(!!s.canTakeover||t||!!e?.resumeCommand);return{canObserve:o,canTakeover:a}}export{h as a,f as b,A as c,S as r,I as s};
1
+ import{r as d}from"./terminal-relay-CjkI5aUy.js";function S(r,e){const s=d(r),n=s?r.harnessSessionId??s.sessionName:null;return e?.activeSessionId??n}function I(r,e){return[...r].sort((s,n)=>{const t=s.id===e?1:0,o=n.id===e?1:0;return t!==o?o-t:(n.endedAt??n.startedAt)-(s.endedAt??s.startedAt)})}function c(r){const e=r;return[e.id,e.surfaceSessionId,e.harnessSessionId,e.externalSessionId,e.threadId,e.runtimeSessionId,e.runtimeSessionRef,e.runtimeRef,e.sourceSessionId,e.sessionId,e.refId].flatMap(s=>{const n=s?.trim();return n?[n]:[]})}function u(r){const e=/^relay-(.+)-(claude|codex)$/iu.exec(r);return e?{scope:e[1].toLowerCase(),harness:e[2].toLowerCase()}:null}function l(r,e){const s=u(r),n=u(e);return!s||!n?!1:s.harness===n.harness&&(s.scope===n.scope||s.scope.startsWith(`${n.scope}-`))}function f(r,e){const s=r?.trim();if(!s)return null;const n=e.find(a=>c(a).some(i=>i===s));if(n)return n.id;const t=e.filter(a=>c(a).some(i=>l(i,s)));return new Set(t.map(a=>a.id)).size===1?t[0]?.id??null:null}function h(r,e,s,n,t){const o=f(t,n);return o||(s??n[0]?.id??null)}function A(r,e,s,n){const t=!!d(r),o=n&&(!!s.canObserve||t),a=n&&(!!s.canTakeover||t||!!e?.resumeCommand);return{canObserve:o,canTakeover:a}}export{h as a,f as b,A as c,S as r,I as s};