@openscout/scout 0.2.80 → 0.2.83

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{j as o,r as a}from"./index-o4FKpU7Z.js";import{c as it,w as Qn,p as Ht,d as Ms,h as Vn,l as zn,f as Gn,s as Ns,g as Jn,i as Xn,j as Yn}from"./NewChatComposer-S08F6_La.js";import{a as K}from"./api-h5zurxmi.js";import{u as Zn}from"./MessageComposerSuggestions-Dfc3PH2y.js";import"./runtime-picker-eDEvx2Mz.js";import{u as ea,C as ta}from"./ConversationComposer-CWohCCmn.js";import"./index-BMwKgdz_.js";import{u as sa,e as na}from"./Provider-DKZWuzSR.js";import{o as aa,q as ra,x as te,y as Is,z as oa,A as be,B as ia,C as la,D as ca,E as da,c as As,S as js,F as ua,G as ma,H as ha,I as pa,J as fa,K as ga,L as ya,s as wa,M as Sa,N as ba,e as Ta,p as xa,r as Rs,O as va,P as ka,Q as Ca,R as Ma,u as Na,T as Ia,U as Aa,V as Es,W as ja,X as Ra,Y as lt,n as Ea,Z as La,_ as $a,$ as Ls,a0 as Pa,a1 as Fa,a2 as Oa,a3 as qa,a4 as $s,a5 as Da,a6 as Ps,a7 as Ba,a8 as Ha,a9 as Ua}from"./conversation-model-CHwHZNw-.js";import{u as _a}from"./sse-CL6gctHY.js";import{n as Vt,t as Ut,f as Fs}from"./time-Dhsh_2EG.js";import{M as Wa}from"./message-markup-BcY1lShv.js";import{i as _t}from"./message-visibility-kJM8XcSG.js";import{d as Ka}from"./router-C65cZYPn.js";import{f as Qa}from"./scoutbot-BTIErYHo.js";import{s as Va}from"./sessionRead-CvFz2RHv.js";import{o as ct}from"./openContent-C6XO6kr5.js";import{u as za}from"./ContextMenu-CxkmFQcN.js";import{c as Be}from"./clipboard-e3fSpeo7.js";import{A as Wt}from"./AgentAvatar-DMov24_o.js";import{d as Ga}from"./types-B0PlfpKc.js";/* empty css */import{ConversationHeader as Ja,ConversationIdentityRow as Xa,AddParticipantForm as Ya}from"./ConversationHeader-BxTzXl8e.js";import{FanOutRow as Za,ThreadDayDivider as er}from"./ConversationFeedRows-IWh0JSIL.js";import{ThreadLoadingSkeleton as tr,ThreadMotionPanel as sr,WorkingTurnSteps as nr,WorkingTurnActivityPreview as ar,WorkingTurnActions as rr}from"./ConversationPanels-D9UCwNkS.js";import{g as or,c as ir,d as lr,e as cr,f as dr}from"./tail-display-BRcJltQa.js";import{u as ur}from"./tail-events-NLIWLq27.js";import{PinnedAskCard as mr,ConversationStatusStrip as hr}from"./ConversationStatus-B6pAbo2w.js";import"./HarnessMark-MztYnrGK.js";import"./colors-BtO5_zlx.js";import"./NewChatOrigin-BEz6jyqf.js";import"./keyboard-nav-Chf51dns.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./x-ynOfVadO.js";import"./createLucideIcon-Bt67PWH-.js";import"./chevron-down-NAhBUkFd.js";import"./search-7_n7CxWl.js";import"./loader-circle-4LDsy4Ke.js";import"./file-text-iF0hyVyU.js";import"./scout-voice-B7kXlkcl.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./provider-BvAxRQfE.js";import"./surface-activity-B1rgWB1i.js";import"./DocumentFocusViewer-DRKjNG9s.js";import"./TextDocumentSurface-Bc-kHPgG.js";/* empty css */import"./chevron-right-C10o7t_X.js";import"./code-xml-CLn3TDWF.js";import"./arrow-left-BOht-YQu.js";import"./chunk-HRAB3GC3-DF8R9rPv.js";import"./index-BWHgHrtv.js";import"./mentions-CvDaviLJ.js";import"./AgentDetailCard-Biq8b2gv.js";import"./AgentLiveActions-0iy8QZ1T.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";import"./SpriteAvatar-DQ3PTb8L.js";import"./agent-identity-BxCsXnDp.js";import"./BackToPicker-BXp5E2ck.js";import"./use-reduced-motion-CqXpVXv-.js";import"./activity-BvGruxWG.js";import"./message-circle-BM3XgevU.js";import"./lane-edit-display-C_Aujldz.js";const pr=/\.(?:apng|avif|gif|jpe?g|png|svg|webp)(?:$|[?#])/iu,fr=/\bhttps?:\/\/[^\s<>"')\]]+/giu;function He(s){if(typeof s!="string")return null;try{const i=new URL(s.trim());return i.protocol==="http:"||i.protocol==="https:"?i.toString():null}catch{return null}}function V(s,i){const d=s?.[i];return typeof d=="string"&&d.trim()?d.trim():null}function gr(s){return s.mediaType.toLowerCase().startsWith("image/")}function yr(s){return pr.test(s)}function wr(s){try{const i=new URL(s),d=[i.pathname==="/"?"":i.pathname,i.search].join("").trim();return{host:i.hostname.replace(/^www\./iu,""),detail:d||i.hostname}}catch{return{host:s,detail:s}}}function Sr(s){const i=new Set,d=[];for(const h of s.matchAll(fr)){const u=h[0]?.replace(/[.,;:!?]+$/u,""),v=He(u);!v||i.has(v)||(i.add(v),d.push(v))}return d}const br=/^\/api\/blobs\/[^/]+$/u;function Kt(s){try{const i=new URL(s);return br.test(i.pathname)?`${i.pathname}${i.search}`:s}catch{return s}}function ut(s){return He(s.url)??He(V(s.metadata,"url"))??He(V(s.metadata,"href"))}function Tr(s){const i=s.metadata??null,d=V(i,"kind")??V(i,"type"),h=ut(s);if(!h||d!=="link_preview"&&d!=="link-preview"&&s.mediaType!=="text/x-uri")return null;const u=wr(h);return{id:s.id,url:h,title:V(i,"title")??u.host,description:V(i,"description"),imageUrl:He(V(i,"imageUrl")??V(i,"image")),siteName:V(i,"siteName")??u.host}}function xr({src:s,alt:i}){const[d,h]=a.useState(!1);return d?o.jsxs("a",{className:"s-message-embed s-message-embed--file",href:s,target:"_blank",rel:"noreferrer",children:[o.jsx("span",{className:"s-message-embed-title",children:i}),o.jsx("span",{className:"s-message-embed-description",children:"Preview unavailable"})]}):o.jsx("a",{className:"s-message-embed s-message-embed--image",href:s,target:"_blank",rel:"noreferrer",children:o.jsx("img",{src:s,alt:i,loading:"lazy",decoding:"async",onError:()=>h(!0)})})}function vr({preview:s}){return o.jsxs("a",{className:"s-message-embed s-message-embed--link",href:s.url,target:"_blank",rel:"noreferrer",children:[s.imageUrl&&o.jsx("span",{className:"s-message-embed-thumb",children:o.jsx("img",{src:s.imageUrl,alt:"",loading:"lazy",decoding:"async"})}),o.jsxs("span",{className:"s-message-embed-copy",children:[s.siteName&&o.jsx("span",{className:"s-message-embed-site",children:s.siteName}),o.jsx("span",{className:"s-message-embed-title",children:s.title}),s.description&&o.jsx("span",{className:"s-message-embed-description",children:s.description})]})]})}function kr({message:s}){const i=s.attachments??[],d=new Set,h=[],u=[];for(const m of i){const I=ut(m);if(I&&gr(m)){d.add(m.id),h.push({id:m.id,src:Kt(I),alt:m.fileName??"Image attachment"});continue}const T=Tr(m);T&&(d.add(m.id),u.push(T))}const v=new Set(u.map(m=>m.url)),O=new Set(i.map(ut).filter(m=>!!m));for(const m of Sr(s.body))O.has(m)||v.has(m)||yr(m)&&h.push({id:m,src:Kt(m),alt:"Embedded image"});const f=i.filter(m=>!d.has(m.id));return h.length===0&&u.length===0&&f.length===0?null:o.jsxs("div",{className:"s-message-embeds",children:[h.map(m=>o.jsx(xr,{src:m.src,alt:m.alt},m.id)),u.slice(0,1).map(m=>o.jsx(vr,{preview:m},m.id)),f.map(m=>{const I=ut(m),T=I?Kt(I):null,p=m.fileName??V(m.metadata,"title")??m.mediaType;return T?o.jsxs("a",{className:"s-message-embed s-message-embed--file",href:T,target:"_blank",rel:"noreferrer",children:[o.jsx("span",{className:"s-message-embed-title",children:p}),o.jsx("span",{className:"s-message-embed-description",children:m.mediaType})]},m.id):o.jsxs("div",{className:"s-message-embed s-message-embed--file",children:[o.jsx("span",{className:"s-message-embed-title",children:p}),o.jsx("span",{className:"s-message-embed-description",children:m.mediaType})]},m.id)})]})}const zt=60;function dt(s,i,d){const h=d?.trim();if(!h)return;const u=h.toLowerCase();i.has(u)||(i.add(u),s.push(h))}function Cr(s){const i=[],d=new Set;dt(i,d,s.observeSessionId);for(const h of s.flight?.sessions??[])dt(i,d,h.sessionId);return dt(i,d,s.agent?.harnessSessionId),dt(i,d,s.sessionMeta?.harnessSessionId),i}function Os(s,i){const d=s.sessionId?.trim().toLowerCase();return d?i.some(h=>{const u=h.trim().toLowerCase();return u?d.includes(u)||u.includes(d):!1}):!1}function _s(s,i){return s.ts!==i.ts?s.ts-i.ts:s.id.localeCompare(i.id)}function qs(s,i){const d=new Map;for(const h of[...s,...i])d.set(h.id,h);return[...d.values()].sort(_s).slice(-zt)}function Mr(s){const i=or(s).sort(_s),d=ir(i.map(u=>({event:u,meta:lr(u)}))),h=[];for(const u of d){if(u.event.kind==="other")continue;if(u.event.kind==="tool-result"){const m=h.at(-1);m?.kind==="tool"&&(m.outcome=u.meta.result?.outcome??m.outcome??"done",m.ts=u.event.ts);continue}const v=Nr(u.event),O=Ir(u.event,cr(u.event,u.meta),v);if(!O&&v!=="think")continue;const f={id:u.event.id,ts:u.event.ts,kind:v,text:O,repeatCount:u.repeatCount};u.meta.tool&&(f.tool=u.meta.tool),u.meta.arg&&(f.arg=mt(u.meta.arg)),u.meta.result?.outcome&&(f.outcome=u.meta.result.outcome),h.push(f)}return h}const Ds=160;function mt(s){const i=s.replace(/\s+/gu," ").trim();return i.length>Ds?`${i.slice(0,Ds-1)}…`:i}const Ws=/^\[thinking\]\s*$/iu;function Nr(s){return Ws.test(s.summary.trim())?"think":dr(s)}function Ir(s,i,d){return d==="think"&&Ws.test(s.summary.trim())?"":mt(i)}const Ar=15e3;function jr(s){const i=s?.outcome;return typeof i=="string"&&i.trim()?i.trim():void 0}function Rr(s){const{observe:i,flight:d}=s;if(!i||!d)return[];const h=i.data.events.filter(f=>f.kind!=="boot"&&f.kind!=="system");if(h.length===0)return[];const u=Vt(d.startedAt),v=u!==null?h.filter(f=>typeof f.at=="number"&&f.at>=u-Ar):[];return(v.length>0?v:i.data.live?h:[]).slice(-zt).map(f=>{const m={id:`observe:${i.sessionId??"session"}:${f.id}`,ts:f.at??f.t,kind:f.kind,text:mt(f.text||f.tool||"step"),repeatCount:1};f.tool&&(m.tool=f.tool),f.arg&&(m.arg=mt(f.arg));const I=jr(f.result);return I&&(m.outcome=I),f.diff&&(m.outcome=`+${f.diff.add} −${f.diff.del}`),m})}function Er(s){const i=s.at(-1);return i?i.tool?i.arg?`${i.tool} · ${i.arg}`:i.tool:i.kind==="think"?i.text||"Thinking":i.text||null:null}function Lr(s){if(s.length===0)return null;const i=s.filter(u=>u.kind==="tool").length,d=s.filter(u=>u.kind==="think").length,h=[];return i>0&&h.push(`${i} tool${i===1?"":"s"}`),d>0&&h.push(`${d} thinking`),h.length===0?`${s.length} step${s.length===1?"":"s"}`:h.join(" · ")}function $r(s){const i=s.flight?.state;return i==="queued"?{label:"Queued",detail:"waiting for the session to come online"}:i==="waking"?{label:"Waking",detail:"starting the session"}:i==="running"||i==="waiting"?s.hasSessionScope?{label:"Session live",detail:"waiting for the first trace line"}:{label:"Session live",detail:"no trace stream for this session yet"}:s.awaitingResponse?{label:"Sent",detail:"waiting for the agent to pick this up"}:null}function Pr(s){const{sessionIds:i,active:d}=s,h=i.join("|"),u=d&&i.length>0,[v,O]=a.useState([]);return a.useEffect(()=>{O([])},[h]),a.useEffect(()=>{if(!u)return;let f=!1;const m=new URLSearchParams({limit:String(zt*3),transcripts:"true"});return K(`/api/tail/recent?${m.toString()}`).then(I=>{if(f)return;const T=(I.events??[]).filter(p=>Os(p,i));T.length!==0&&O(p=>qs(p,T))}).catch(()=>{}),()=>{f=!0}},[u,h]),ur(f=>{u&&Os(f,i)&&O(m=>qs(m,[f]))},u),a.useMemo(()=>u?Mr(v):[],[u,v])}const Fr=3500;function Bs(s){const i=s?.trim().replace(/^#/,"");if(!i?.startsWith("msg-"))return null;const d=i.slice(4).trim();if(!d)return null;try{return decodeURIComponent(d)}catch{return d}}const Or=64;function qr(s){const i=s?.clientMessageId;return typeof i=="string"&&i.trim()?i.trim():null}function Hs(s){const i=s.body.replace(/\s+/gu," ").trim();if(i)return i.length>180?`${i.slice(0,179).trimEnd()}…`:i;const d=s.attachments?.length??0;return d===1?"Attachment":d>1?`${d} attachments`:"Message"}function Us(s,i){const d=s.toLocaleLowerCase().indexOf(i.toLocaleLowerCase());if(d<0)return s;const h=s.slice(0,d),u=s.slice(d+i.length);return!h&&u.startsWith(" ")?u.slice(1):h.endsWith(" ")&&u.startsWith(" ")?`${h}${u.slice(1)}`:`${h}${u}`}function Dr(s){return s instanceof TypeError||typeof DOMException<"u"&&s instanceof DOMException&&s.name==="AbortError"}function ti({conversationId:s,initialDraft:i,navigate:d,embedded:h,showBackNav:u=!0,treatment:v="standard"}){const{agents:O,route:f,openContextCapture:m}=sa(),I=Ka(f),T=a.useMemo(()=>na(O,I),[O,I]),[p,ht]=a.useState(null),Gt=a.useRef(null);Gt.current=p;const Ue=a.useMemo(()=>it(s),[s]),[Ks,Qs]=a.useState(()=>Ue?{[s]:Ue}:{}),k=Ks[s]??Ue??[],[Vs,Jt]=a.useState(()=>Ue!==null),Te=a.useRef(null),zs=a.useMemo(()=>{const t=Te.current;return t===null?null:new Set(k.filter(e=>!t.has(e.id)).map(e=>e.id))},[k]),Xt=Te.current===null&&k.length>0;a.useEffect(()=>{if(k.length===0)return;const t=Te.current??new Set;for(const e of k)t.add(e.id);Te.current=t},[k]),a.useEffect(()=>{Te.current=null,Jt(it(s)!==null)},[s]);const Yt=!Vs&&k.length===0,z=a.useCallback(t=>{Qs(e=>{const n=e[s]??it(s)??[],r=typeof t=="function"?t(n):t,l=Qn(s,r);return{...e,[s]:l}})},[s]),Gs=Ht(s),[w,he]=a.useState(Gs),[xe,ve]=a.useState([]),[_e,pt]=a.useState(null),[We,ke]=a.useState(null),[Ke,Js]=a.useState(()=>typeof window>"u"?null:Bs(window.location.hash)),[Zt,pe]=a.useState(null),[fe,ft]=a.useState(!1),[Xs,Ce]=a.useState(!1),[gt,Qe]=a.useState(0),Ve=a.useRef(null),Me=a.useRef(null),es=a.useRef(null),Ne=a.useRef(!0),ze=a.useRef(!1),ge=a.useRef(null),L=a.useRef(null),Ie=a.useRef(new Set),Ae=a.useRef(null),ts=a.useRef(0),ss=a.useRef(null),je=a.useRef(null),se=a.useRef(s);se.current=s;const ne=a.useRef(new Map),Ys=Ms(s),Ge=a.useRef(!1);a.useLayoutEffect(()=>{const t=Me.current,e=Ve.current;!t||!e||(e.scrollTop=t.scrollTop+(e.scrollHeight-t.scrollHeight),Me.current=null,Ge.current=!0)}),a.useEffect(()=>{ft(!1),Me.current=null,Ge.current=!1,Ne.current=!0,ze.current=!1,Ce(!1),Qe(0),Lt(new Set),ne.current.clear(),he(Ht(s))},[s]);const x=p?.agentId??null,N=p?.kind==="direct",yt=a.useMemo(()=>new Set([s,...p?.equivalentConversationIds??[]]),[s,p?.equivalentConversationIds]),Q=a.useMemo(()=>x?T.find(t=>t.id===x)??null:null,[T,x]),ns=aa(p),Zs=ra({resolvedAgentId:Q?.id,sessionId:ns,machineId:I}),[as,rs]=a.useState(null);a.useEffect(()=>{K("/api/fleet").then(t=>{rs(e=>te(e,Is(t.activeAsks,s,x)))}).catch(()=>{})},[s,x]);const H=a.useCallback(async(t={})=>{const e=t.messageMode??"none",n=t.includeMetadata??!0;pe(null);try{const r=n?await K(`/api/session/${encodeURIComponent(s)}`).catch(()=>null):Gt.current;if(se.current!==s)return;ht(M=>te(M,r));const l=r?.agentId??null,c=r?.id&&r.id!==s?r.id:s;if(c!==s){d({view:"conversation",conversationId:c});return}const g=it(c),R=Vn(c),S=e==="initial"&&!R,y=e==="refresh"||e==="initial",[b,U,E]=await Promise.all([S?zn(c):y?Gn(c,{refresh:!0}):Promise.resolve(g),K(`/api/flights?conversationId=${encodeURIComponent(c)}`),K("/api/fleet?limit=24&activityLimit=160").catch(()=>oa())]);if(se.current!==s)return;const Z=be(b??[]),D=Z.filter(M=>!_t(M));b&&z(M=>te(M,ia(M,D))),Jt(!0),Va(c);const _=Z.at(-1);_&&je.current!==_.id&&(je.current=_.id,K(`/api/conversations/${encodeURIComponent(c)}/read-cursor`,{method:"POST",body:JSON.stringify({lastReadMessageId:_.id})}).catch(()=>{je.current===_.id&&(je.current=null)}));const W=la(U),B=Ht(c),ee=W??B;Ie.current=new Set([...U.map(M=>M.invocationId),...B?.invocationId?.startsWith("pending:")?[]:B?.invocationId?[B.invocationId]:[]]),W&&B?.id===W.id&&Ns(c,W.id);const rt=ee?.agentId??l??null,$=ca(E.activity,ee,c,rt),ot=da(E.activeAsks,ee,c,rt);he(M=>te(M,ee)),ve(M=>te(M,$)),ke(M=>te(M,ot)),rs(M=>te(M,Is(E.activeAsks,c,l)))}catch(r){if(se.current!==s)return;pe(r instanceof Error?r.message:String(r))}},[s,d,z]);a.useEffect(()=>{H({messageMode:"initial"})},[H]),a.useEffect(()=>{je.current=null},[s]),a.useEffect(()=>{Ae.current=w},[w]);const en=a.useCallback(async()=>{if(fe||!Ms(s))return;const t=Ve.current,e=t?{scrollHeight:t.scrollHeight,scrollTop:t.scrollTop}:null;ft(!0),pe(null);try{const n=await Jn(s);if(se.current!==s)return;e&&(Me.current=e),z(be(n).filter(r=>!_t(r)))}catch(n){se.current===s&&pe(n instanceof Error?n.message:String(n))}finally{se.current===s&&ft(!1)}},[s,fe,z]),[A,q]=a.useState(()=>i??""),[ae,re]=a.useState(null),[G,Je]=a.useState(!1),[C,tn]=a.useState("operator"),[oe,Re]=a.useState({open:!1,query:"",triggerStart:-1,index:0}),[ie,Ee]=a.useState({open:!1,query:"",triggerStart:-1,index:0}),[P,J]=a.useState(null),[wt,Xe]=a.useState(!1),[St,Ye]=a.useState(""),[sn,Le]=a.useState(null),[nn,bt]=a.useState(!1);a.useEffect(()=>{Xe(!1),Ye(""),Le(null),bt(!1)},[s]),a.useEffect(()=>{if(!i)return;const t=`${s}:${i}`;ss.current!==t&&(ss.current=t,q(i),requestAnimationFrame(()=>L.current?.focus()))},[s,i]);const le=a.useMemo(()=>{const t=new Map;for(const e of p?.participants??[])t.set(e.actorId,e),e.agentId&&t.set(e.agentId,e);return t},[p]),Tt=a.useMemo(()=>{const t=new Set,e=[];for(const n of p?.participantIds??[]){if(n==="operator")continue;const r=le.get(n),l=r?.scopedAlias?.trim().replace(/^@+/,"");if(!l)continue;const c=l.toLowerCase();t.has(c)||(t.add(c),e.push({id:n,label:r?.label??r?.displayName??l,name:r?.displayName??l,handle:l}))}for(const n of T){const r=n.handle?.trim().replace(/^@+/,"")??As(n.id)??n.id;if(!r)continue;const l=r.toLowerCase();t.has(l)||(t.add(l),e.push({id:n.id,label:r,name:n.name??r,handle:r}))}return e.sort((n,r)=>n.handle.localeCompare(r.handle))},[le,T,p]),an=a.useMemo(()=>{if(!oe.open)return[];const t=oe.query.toLowerCase();return t?js.filter(e=>e.command.toLowerCase().startsWith("/"+t)||e.command.toLowerCase().includes(t)):js},[oe.open,oe.query]),rn=a.useMemo(()=>{if(!ie.open)return[];const t=ie.query.toLowerCase();return t?Tt.filter(e=>e.handle.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)).slice(0,8):Tt.slice(0,8)},[ie.open,ie.query,Tt]),on=a.useCallback(()=>{Re(t=>t.open?{...t,open:!1}:t),Ee(t=>t.open?{...t,open:!1}:t)},[]),ln=a.useCallback((t,e)=>{const n=ua(t,e);Re(n?l=>({open:!0,query:n.query,triggerStart:n.start,index:l.open&&l.triggerStart===n.start?l.index:0}):l=>l.open?{...l,open:!1}:l);const r=ma(t,e);Ee(r?l=>({open:!0,query:r.query,triggerStart:r.start,index:l.open&&l.triggerStart===r.start?l.index:0}):l=>l.open?{...l,open:!1}:l)},[]),cn=a.useCallback(t=>{const e=L.current,n=oe.triggerStart;if(n<0)return;const r=e?.selectionStart??A.length,l=A.slice(0,n),c=A.slice(r),g=t.insert,R=`${l}${g}${c}`;q(R),Re(S=>({...S,open:!1})),requestAnimationFrame(()=>{const S=L.current;if(!S)return;const y=l.length+g.length;S.focus(),S.setSelectionRange(y,y)})},[A,oe.triggerStart]),dn=a.useCallback(t=>{const e=L.current,n=ie.triggerStart;if(n<0)return;const r=e?.selectionStart??A.length,l=A.slice(0,n),c=A.slice(r),g=c.length===0||!c.startsWith(" "),R=`@${t.handle}${g?" ":""}`,S=`${l}${R}${c}`;q(S),Ee(y=>({...y,open:!1})),requestAnimationFrame(()=>{const y=L.current;if(!y)return;const b=l.length+R.length;y.focus(),y.setSelectionRange(b,b)})},[A,ie.triggerStart]);a.useEffect(()=>{const t=L.current;if(!t)return;t.style.height="0px";const e=Math.min(Math.max(t.scrollHeight,40),160);t.style.height=`${e}px`,t.style.overflowY=t.scrollHeight>e?"auto":"hidden"},[A]),a.useEffect(()=>{K("/api/user").then(t=>tn(t.name)).catch(()=>{})},[]);const Ze=a.useMemo(()=>ha(k,C),[k,C]);a.useEffect(()=>{P===null||Ze===null||Ze>=P&&J(null)},[P,Ze]);const un=a.useMemo(()=>pa(w),[w]),ye=Date.now(),mn=fa(w,Ze,ye),xt=un&&!ga(w)&&!mn,os=N&&(G||P!==null||xt),is=N&&ya({sending:G,awaitingResponse:P!==null,currentFlight:w}),F=wa({name:Q?.name,agentName:p?.agentName,id:x,title:p?.title}),j=a.useMemo(()=>N?Sa({agentName:F,agentState:Q?.state??null,sending:G,currentFlight:w,showWorkingTurn:xt,awaitingResponse:P!==null}):{label:"Open",detail:"",tone:"idle",showStrip:!1,showTyping:!1},[Q?.state,F,P,w,ye,N,G,xt]),vt=w?.startedAt??We?.startedAt??P,kt=Vt(vt),ls=Da(vt,ye),[,hn]=a.useState(0);a.useEffect(()=>{if(!j.showTyping||kt===null)return;const t=Math.max(0,Date.now()-kt),e=[$s.sustained,$s.long].find(r=>r>t);if(e===void 0)return;const n=window.setTimeout(()=>hn(r=>r+1),e-t+50);return()=>window.clearTimeout(n)},[kt,j.showTyping,ls]);const pn="Live",Ct=a.useMemo(()=>ba({currentFlight:w,presence:j,turnActivity:xe,turnAsk:We,awaitingResponseSince:P,nowMs:ye}),[P,w,ye,j,xe,We]),fn="s-thread-msg-card s-thread-msg-working-card s-thread-msg-card--avatar-row",gn="s-thread-msg-kind",yn="s-thread-turn-snapshot",wn="s-thread-turn-snapshot-pulse",Sn="s-thread-presence-line",bn=["s-thread-presence-strip",`s-thread-presence-strip--${ls}`].filter(Boolean).join(" "),Mt=p?Ta(p):F,cs=p?.id??s,Tn=p?.alias?.trim()||null,et=xa(p?.workspaceRoot),xn=j.tone,Nt=k.length===0&&N&&(j.showTyping||w!==null||xe.length>0||We!==null||P!==null),ds=a.useMemo(()=>p?p.participantIds.includes("operator"):N,[N,p]),$e=w?.agentId??x,Pe=$e?Rs(T,[$e]):null,Fe=Pe?.id??$e,Oe=w?.sessions.at(-1)?.sessionId??Pe?.harnessSessionId??void 0,us=w?.id?()=>{ct(d,{view:"sessions",flightId:w.id,...Fe?{agentId:Fe}:{},...Oe?{sessionId:Oe}:{},...I?{machineId:I}:{}},{returnTo:f})}:void 0,ms=w?.id??null;a.useEffect(()=>{if(!ms||!Fe){pt(null);return}let t=!1;const e=Oe?`?sessionId=${encodeURIComponent(Oe)}`:"",n=async()=>{try{const l=await K(`/api/agents/${encodeURIComponent(Fe)}/observe${e}`);if(t)return;pt(c=>te(c,l))}catch{}};n();const r=window.setInterval(()=>{n()},Fr);return()=>{t=!0,window.clearInterval(r),pt(null)}},[ms,Fe,Oe]);const It=a.useMemo(()=>Cr({flight:w,agent:Pe??Q,sessionMeta:p,observeSessionId:_e?.sessionId}),[Q,w,p,_e?.sessionId,Pe]),hs=Pr({sessionIds:It,active:j.showTyping||Nt}),vn=a.useMemo(()=>Rr({observe:_e,flight:w}),[w,_e]),X=hs.length>0?hs:vn,At=a.useMemo(()=>X.length>0?null:$r({flight:w,hasSessionScope:It.length>0,awaitingResponse:P!==null}),[P,w,It.length,X.length]),jt=Lr(X),Rt=Er(X),ps=X.at(-1)??null,Et=ps?Ut(ps.ts,ye):null,ce=a.useMemo(()=>Rt?{...Ct,latest:Rt,...jt?{activityLabel:jt}:{},...Et?{lastActivityLabel:Et}:{}}:Ct,[Et,Rt,Ct,jt]),kn=`${F}: ${ce.latest}`,fs=$e&&va(Pe)?()=>{ct(d,{view:"terminal",agentId:$e,mode:"takeover"},{returnTo:f})}:void 0,gs=N?()=>{h&&Qa({type:"focus-composer",reason:"Steer the active conversation"})||requestAnimationFrame(()=>{L.current?.focus({preventScroll:!0}),L.current?.scrollIntoView({block:"nearest"})})}:void 0,ys=a.useMemo(()=>(p?p.participantIds.filter(e=>e!=="operator"):x?[x]:[]).map(e=>{const n=Rs(T,[e]),r=le.get(e);return{id:e,name:r?.scopedAlias??n?.name??r?.displayName??As(e)??e,title:r?.label??n?.id??e,agent:n,sessionId:r?.sessionId??null,harness:n?.harness??r?.harness??null,model:n?.model??null,reasoningEffort:n?.reasoningEffort??null}}),[x,le,T,p]),ws=ys.slice(0,4),Cn=Math.max(ys.length-ws.length,0),Mn=a.useMemo(()=>({name:C,active:ds}),[ds,C]),tt=a.useMemo(()=>new Map(k.map(t=>[t.id,t])),[k]),st=a.useMemo(()=>ka(k),[k]),[Nn,Lt]=a.useState(()=>new Set),In=a.useCallback(t=>{Lt(e=>{const n=new Set(e);return n.delete(t)||n.add(t),n})},[]),Ss=a.useMemo(()=>{const t=new Map;for(const e of st)if(e.kind==="fanout")for(const n of e.messages)t.set(n.id,e.key);return t},[st]),nt=a.useCallback(t=>{const e=Ss.get(t);e&&Lt(c=>c.has(e)?c:new Set(c).add(e));const n=document.getElementById(`msg-${t}`);if(!n)return;const r=n.closest(".s-thread-fanout")??n,l=r===n?"s-thread-msg--flash":"s-thread-fanout--flash";r.scrollIntoView({behavior:"smooth",block:"center"}),r.classList.add(l),window.setTimeout(()=>r.classList.remove(l),1200)},[Ss]);a.useEffect(()=>{const t=()=>Js(Bs(window.location.hash));return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)},[]),a.useEffect(()=>{if(!Ke||!tt.has(Ke))return;const t=window.setTimeout(()=>nt(Ke),50);return()=>window.clearTimeout(t)},[Ke,tt,nt]),_a(a.useCallback(t=>{if(t.kind==="message.posted"){const e=t.payload?.message;if(!e||!yt.has(e.conversationId))return;const n=e.actorId==="operator",r=N&&!n&&e.class==="agent",l={id:e.id,conversationId:e.conversationId,actorId:e.actorId,actorName:r?F:Ca(e.actorId,T,C),body:e.body,createdAt:e.createdAt,class:n?"operator":e.class,attachments:e.attachments,metadata:e.metadata,replyToMessageId:e.replyToMessageId??e.n??null};if(_t(l))return;if(z(c=>{const g=qr(e.metadata),R=g?ne.current.get(g):void 0;if(c.some(S=>S.id===e.id))return g&&ne.current.delete(g),c;if(n&&g){const S=Ma(c,g,R);if(S!==-1){const y=[...c];return y[S]=l,ne.current.delete(g),be(y)}}return be([...c,l])}),r){const c=Vt(e.createdAt)??Date.now();J(g=>g===null||c<g||Na(Ae.current)?g:null),he(g=>Ia(g)?null:g)}return}if(t.kind==="invocation.requested"){const e=t.payload?.invocation;if(!e||e.targetAgentId!==x||!e.conversationId||!yt.has(e.conversationId))return;Ie.current.add(e.id),ve([]),ke(null),J(n=>n??Date.now());return}if(t.kind==="flight.updated"){const e=t.payload?.flight;if(!e||e.targetAgentId!==x||!(Ie.current.has(e.invocationId)||Ae.current?.id===e.id))return;if(Aa.has(e.state)){Ns(s,e.id),he(c=>c?.id===e.id?null:c),ve([]),ke(null),J(null),H({messageMode:"refresh",includeMetadata:!1});return}Ie.current.add(e.invocationId);const r=Ae.current?.id===e.id,l=Es(e,s,x??"",Ae.current);ja(l)&&J(null),he(l),r||(ve([]),ke(null));return}t.kind!=="agent.endpoint.upserted"&&t.kind==="unknown"&&H({messageMode:"refresh"})},[x,F,s,yt,N,H,C,T])),a.useEffect(()=>{if(!os)return;const t=setInterval(()=>{H({messageMode:"refresh",includeMetadata:!1})},5e3);return()=>clearInterval(t)},[os,H]),a.useEffect(()=>{const t=()=>{if(document.visibilityState!=="visible")return;const e=Date.now();e-ts.current<1e3||(ts.current=e,H({messageMode:"refresh"}))};return window.addEventListener("focus",t),document.addEventListener("visibilitychange",t),()=>{window.removeEventListener("focus",t),document.removeEventListener("visibilitychange",t)}},[H]);const $t=a.useRef(null),bs=a.useRef(!1),Pt=a.useRef(!1),Ft=a.useCallback(t=>{const e=es.current;e&&(ze.current=!0,ge.current!==null&&clearTimeout(ge.current),e.scrollIntoView({behavior:t}),ge.current=setTimeout(()=>{ze.current=!1,ge.current=null},t==="smooth"?700:0))},[]);a.useEffect(()=>()=>{ge.current!==null&&clearTimeout(ge.current)},[]);const An=a.useCallback(()=>{const t=Ve.current;if(!t||ze.current)return;const n=t.scrollHeight-t.clientHeight-t.scrollTop<=Or;Ne.current=n,n?(Ce(!1),Qe(0)):Ce(!0)},[]),jn=a.useCallback(()=>{Ne.current=!0,Ce(!1),Qe(0),Ft("smooth")},[Ft]);a.useEffect(()=>{const t=k.at(-1)?.id??null,e=!!(t&&t!==$t.current),n=Ra({newestMessageId:t,previousNewestMessageId:$t.current,showTyping:j.showTyping,previousShowTyping:bs.current,historyRestorePending:Ge.current||Me.current!==null,initialScrollDone:Pt.current,nearBottom:Ne.current});n!=="none"?(Ft(n),Pt.current=!0):e&&Pt.current&&!Ne.current&&(Ce(!0),Qe(r=>r+1)),Ge.current=!1,$t.current=t,bs.current=j.showTyping});const[,Rn]=a.useState(0);a.useEffect(()=>{const t=setInterval(()=>Rn(e=>e+1),15e3);return()=>clearInterval(t)},[]);const de=ea(),[ue,Y]=a.useState([]),[Ts,at]=a.useState("queue"),[we,Se]=a.useState(null),qe=async(t,e)=>{const n=t.trim(),r=e?.attachments??[],l=e?.replyTarget??null;if(!n&&r.length===0||G)return"failed";const g=e?.forceAction??Ps({isDm:N,hasOutstandingReply:is}),R=Date.now(),S=Yn(),y={id:`optimistic-${S}`,conversationId:s,actorId:"operator",actorName:C,body:n,createdAt:R,class:"operator",...l?{replyToMessageId:l.messageId}:{},metadata:{clientMessageId:S,deliveryState:"sending"},...r.length>0?{attachments:r}:{}};Je(!0),g!=="message"&&J(R),pe(null),ne.current.set(S,y.id),z(b=>be([...b,y]));try{const b=await K(`/api/chats/${encodeURIComponent(s)}/messages`,{method:"POST",body:JSON.stringify({body:n,clientMessageId:S,...l?{replyToMessageId:l.messageId}:{},...r.length>0?{attachments:r}:{}})}),U=b.chatId?.trim()??b.conversationId?.trim();if(U&&U!==s)throw new Error(`Send returned a different Chat (${U}) instead of appending to ${s}.`);if(b.messageId?.trim()){const E=b.messageId.trim();z(Z=>be(Z.map(D=>D.id===y.id?{...D,id:E,metadata:{clientMessageId:S}}:D))),ne.current.delete(S)}return b.flight?(Ie.current.add(b.flight.invocationId),he(Es(b.flight,s,x??"")),ve([]),ke(null)):g!=="message"&&J(null),"sent"}catch(b){return Dr(b)?(z(U=>U.map(E=>E.id===y.id?{...E,metadata:{...E.metadata??{},deliveryState:"unknown"}}:E)),"unknown"):(z(U=>U.filter(E=>E.id!==y.id)),ne.current.delete(S),J(null),pe(b instanceof Error?b.message:String(b)),"failed")}finally{Je(!1)}},En=async()=>{const t=A.trim(),e=ae,n=de.files,r=we?.attachments??[];if(!t&&n.length===0&&r.length===0)return null;let l=[];if(n.length>0){Je(!0);try{l=await Zn(n)}catch(c){return de.setError(c instanceof Error?c.message:String(c)),null}finally{Je(!1)}}return q(""),re(null),de.clear(),Se(null),{body:t,attachments:[...r,...l],replyTarget:e}},Ln=async()=>{const t=Ha({isAgentBusy:me,intent:Ts}),e=we?.id??null,n=await En();if(!n)return;if(t==="queue"){Y(c=>e?c.map(g=>g.id===e?{...g,body:n.body,attachments:n.attachments,replyTarget:n.replyTarget}:g):[...c,{id:`queued-${Date.now()}-${c.length}`,body:n.body,attachments:n.attachments,replyTarget:n.replyTarget,queuedAt:Date.now()}]);return}e&&Y(c=>c.filter(g=>g.id!==e));const r=()=>{q(n.body),Se(n.attachments.length>0?{id:null,attachments:n.attachments}:null),re(n.replyTarget),requestAnimationFrame(()=>L.current?.focus())};if(t==="steer"){at("queue"),await Dt(),await qe(n.body,{forceAction:"steer",attachments:n.attachments,replyTarget:n.replyTarget})==="failed"&&r();return}await qe(n.body,{attachments:n.attachments,replyTarget:n.replyTarget})==="failed"&&r()},$n=t=>{Y(e=>e.filter(n=>n.id!==t)),Se(e=>e?.id===t?null:e)},Pn=t=>{const e=ue.find(n=>n.id===t);e&&(q(e.body),re(e.replyTarget??null),Se({id:t,attachments:e.attachments}),requestAnimationFrame(()=>{const n=L.current;n&&(n.focus(),n.setSelectionRange(n.value.length,n.value.length))}))},Fn=()=>{Se(null),q(""),re(null),de.clear()},On=async t=>{const e=ue.find(r=>r.id===t);if(!e)return;Y(r=>r.filter(l=>l.id!==t)),await Dt(),await qe(e.body,{forceAction:"steer",attachments:e.attachments,replyTarget:e.replyTarget??null})==="failed"&&Y(r=>[e,...r])},Ot=a.useCallback((t,e)=>{const n=e?.trim().replace(/^@+/,"")||null,r=n?`@${n}`:null,l=ae?.insertedMention?Us(A,ae.insertedMention):A,c=!!(!N&&r&&!l.toLocaleLowerCase().includes(r.toLocaleLowerCase())),g=c&&r?l.trim()?`${l.trimEnd()} ${r} `:`${r} `:l;q(g),re({messageId:t.id,actorLabel:n?`@${n}`:t.actorName,preview:Hs(t),insertedMention:c?r:null}),requestAnimationFrame(()=>L.current?.focus())},[A,N,ae?.insertedMention]),qn=a.useCallback(()=>{const t=ae?.insertedMention;re(null),t&&q(e=>Us(e,t)),requestAnimationFrame(()=>L.current?.focus())},[ae]),qt=a.useCallback(t=>{const e=new URL(window.location.href);f.view==="agents-v2"&&e.searchParams.set("tab","message"),e.hash=`msg-${t}`,Be(e.toString())},[f.view]),xs=a.useCallback((t,e,n)=>{const r=Xn({conversationId:s,selectedMessageId:t.id,messages:k.map(l=>({id:l.id,actorLabel:l.id===t.id?e:lt(l,C)?C:l.actorName,body:l.body,attachmentCount:l.attachments?.length??0}))});m({intent:"forward-message",forwardContext:r,forwardContextMode:"selected-message",...n?{projectPath:n}:{}})},[s,k,m,C]),Dt=async()=>{if(x)try{await K("/api/agents/"+encodeURIComponent(x)+"/interrupt",{method:"POST",body:JSON.stringify({})})}catch{}},me=j.tone==="working"||j.tone==="pending",Dn=Ps({isDm:N,hasOutstandingReply:is}),Bn=N?`Message ${F} — type / to route or @ to mention an agent`:p?.kind==="channel"?`Comment in #${Ea(p)} — mention @agent to request a reply`:`Comment in ${Mt} — mention @agent to request a reply`,vs=we?.attachments??[],Hn=!A.trim()&&!de.hasFiles&&vs.length===0&&me,Bt=a.useRef(!1);a.useEffect(()=>{const t=we?.id??null,e=t?ue.filter(r=>r.id!==t):ue;if(!La({isAgentBusy:me,sending:G,queued:e})||Bt.current)return;const n=e[0];n&&(Bt.current=!0,Y(r=>r.filter(l=>l.id!==n.id)),qe(n.body,{attachments:n.attachments,replyTarget:n.replyTarget??null}).then(r=>{r==="failed"&&Y(l=>[n,...l])}).finally(()=>{Bt.current=!1}))},[me,G,ue,we]),a.useEffect(()=>{me||at("queue")},[me]),a.useEffect(()=>{Y([]),Se(null),re(null),at("queue"),de.clear()},[s]);const Un=$a(ue),ks=za(),_n=a.useCallback((t,e)=>{const n=window.getSelection()?.toString().trim(),r=lt(e,C),l=e.actorId?le.get(e.actorId):null,c=r?null:Ls(e,T,x),g=(l?.scopedAlias?.trim()||c?.handle?.trim()||null)?.replace(/^@+/,"")??null,R=g?`@${g}`:e.actorName,S=(c?.id||l?.agentId||e.actorId||"").trim(),y=[];r||y.push({kind:"action",label:"Reply",onSelect:()=>Ot(e,g)}),y.push({kind:"action",label:"Forward to new task…",onSelect:()=>xs(e,R,l?.workspaceRoot??c?.projectRoot??c?.cwd??void 0)}),y.push({kind:"separator"}),n&&y.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>{Be(n)}}),y.push({kind:"action",label:"Copy Message",onSelect:()=>{Be(e.body)}}),y.push({kind:"action",label:"Copy Link",onSelect:()=>qt(e.id)}),y.push({kind:"separator"}),!r&&S&&y.push({kind:"action",label:"Copy Agent ID",onSelect:()=>{Be(S)}}),y.push({kind:"action",label:"Copy Message ID",onSelect:()=>{Be(e.id)}}),ks(t,y)},[x,Ot,qt,xs,C,le,T,ks]),Wn=async(t,e)=>{const n=`@${e.agentId} `,r=A.trim();if(r){q(""),await qe(`${n}${r}`,{forceAction:"invoke"});return}q(n),L.current?.focus()},De=a.useMemo(()=>{if(!p)return[];const t=new Set(p.participantIds);return T.filter(e=>!t.has(e.id)&&!e.retiredFromFleet).sort((e,n)=>e.name.localeCompare(n.name))},[p,T]);a.useEffect(()=>{wt&&Ye(t=>t&&De.some(e=>e.id===t)?t:De[0]?.id??"")},[wt,De]);const Cs=!!(p&&["direct","group_direct","channel"].includes(p.kind)&&De.length>0),Kn=a.useCallback(async()=>{if(!p)return;const t=St.trim();if(t){bt(!0),Le(null);try{const e=await K(`/api/conversations/${encodeURIComponent(p.id)}/members`,{method:"POST",body:JSON.stringify({actorId:t})});e.session?ht(e.session):ht(n=>n&&{...n,kind:e.kind,participantIds:e.participantIds}),Xe(!1),Ye(""),await H({messageMode:"none"})}catch(e){Le(e instanceof Error?e.message:String(e))}finally{bt(!1)}}},[St,H,p]);return o.jsx("div",{className:`s-thread-layout${h?" s-thread-layout--embedded":""}`,"data-thread-treatment":v==="standard"?void 0:v,children:o.jsxs("div",{className:"s-thread-center",children:[!h&&o.jsx(Ja,{showBackNav:u,isDm:N,navigate:d,route:f,canonicalConversationId:cs,threadTitle:Mt,agentId:Q?.id??null,sessionId:ns,detailRoute:Zs,visibleParticipants:ws,hiddenParticipantCount:Cn,operator:Mn,canAddParticipants:Cs,onToggleAddParticipant:()=>{Le(null),Xe(t=>!t)}}),!h&&p&&o.jsx(Xa,{canonicalConversationId:cs,conversationAlias:Tn}),!h&&wt&&Cs&&o.jsx(Ya,{agents:De,addParticipantId:St,setAddParticipantId:Ye,addingParticipant:nn,addParticipantError:sn,onCancel:()=>{Xe(!1),Le(null)},onSubmit:()=>{Kn()}}),as&&o.jsx(mr,{pinnedAsk:as,onAnswer:()=>{L.current?.focus()}}),o.jsx(hr,{presence:j,agent:Q}),Zt&&o.jsx("p",{className:"s-thread-error",children:Zt}),o.jsxs("div",{className:"s-thread-feed",ref:Ve,onScroll:An,children:[!Yt&&k.length>0&&Ys&&o.jsx("div",{className:"s-thread-history-control",children:o.jsxs("button",{type:"button",className:"s-thread-history-button",disabled:fe,"aria-busy":fe,onClick:()=>{en()},children:[fe&&o.jsx("span",{className:"s-thread-history-spinner","aria-hidden":"true"}),fe?"Loading earlier messages…":"Load earlier messages"]})}),Yt?o.jsx(tr,{}):k.length===0?Nt?o.jsx(sr,{agentName:F,title:j.label,detail:j.detail||ce.latest,snapshot:ce,events:xe,steps:X,phase:At,tone:xn,workspaceName:et,branch:p?.currentBranch,startedAt:vt,onOpenTrace:us,onOpenTerminal:fs,onSteer:gs}):o.jsxs("div",{className:"s-thread-empty",children:[o.jsx("div",{className:"s-thread-empty-glyph","aria-hidden":"true",children:N?"@":"#"}),o.jsx("p",{children:Mt}),o.jsx("p",{children:N?"No messages yet. Send a message to start working with this agent.":"No messages yet. Start the conversation below."}),(et||p?.currentBranch)&&o.jsxs("div",{className:"s-thread-empty-chips",children:[et&&o.jsx("span",{className:"s-thread-empty-chip",children:et}),p?.currentBranch&&o.jsx("span",{className:"s-thread-empty-chip",children:p.currentBranch})]})]}):st.map((t,e)=>{const n=Pa(t,e);if(t.kind==="fanout")return o.jsx(Za,{row:t,expanded:Nn.has(t.key),showDayDivider:n,onToggle:()=>In(t.key)},t.key);const r=t.message,l=lt(r,C),c=Fa(r),g=c?"scout.dispatch":r.class,R=Ba(g),S=g==="status",y=Fs(r.createdAt),b=l?null:Ls(r,T,x),E=le.get(r.actorId)?.scopedAlias?.trim()||null,Z=!l&&E?E:r.actorName,D=l?C.toLowerCase():E??b?.handle??null,_=Oa(r.body),W=_?qa({flightId:_.flightId,replyToMessageId:r.replyToMessageId,messagesById:tt,agents:T,operatorName:C}):null,B=!_&&r.replyToMessageId?tt.get(r.replyToMessageId)??null:null,ee=B?lt(B,C)?C:B.actorName:null,rt=_?_.body:r.body;return o.jsxs("div",{className:["s-thread-feed-block",l&&"s-thread-feed-block--you",n&&"s-thread-feed-block--full-width"].filter(Boolean).join(" "),children:[n&&o.jsx(er,{at:r.createdAt}),o.jsx("article",{id:`msg-${r.id}`,className:["s-thread-msg",l&&"s-thread-msg--you",S&&"s-thread-msg--tool",(Xt||zs?.has(r.id))&&"s-thread-msg--enter"].filter(Boolean).join(" "),style:Xt?{animationDelay:`${Math.max(0,7-(st.length-1-e))*26}ms`}:void 0,"data-class":g,onContextMenu:$=>_n($,r),children:o.jsx("div",{className:"s-thread-msg-card",children:o.jsxs("div",{className:"s-thread-msg-card-content",children:[o.jsxs("div",{className:"s-thread-msg-header",children:[o.jsxs("div",{className:"s-thread-msg-meta",children:[(()=>{const $=!l&&b?()=>ct(d,{view:"agents-v2",agentId:b.id},{returnTo:f}):null,ot=l?C:Z??"?",M=o.jsx(Wt,{agent:b??void 0,name:ot,placement:"turn",className:"s-thread-msg-avatar",title:ot});return $?o.jsx("button",{type:"button",className:"s-thread-msg-avatar--nav",onClick:$,"aria-label":`View profile for ${r.actorName??"agent"}`,title:`View profile for ${r.actorName??"agent"}`,children:M}):M})(),!l&&b?o.jsx("button",{type:"button",className:"s-thread-msg-actor s-thread-msg-actor--nav",onClick:()=>ct(d,{view:"agents-v2",agentId:b.id},{returnTo:f}),title:`View profile for ${r.actorName}`,children:Z}):o.jsx("span",{className:"s-thread-msg-actor",children:l?C:Z}),D&&o.jsxs("span",{className:"s-thread-msg-handle",children:["@",D]}),R&&o.jsx("span",{className:"s-thread-msg-kind",children:R})]}),o.jsx("span",{className:"s-thread-msg-time",title:y,children:Ut(r.createdAt)}),o.jsxs("span",{className:"s-thread-msg-actions",children:[!l&&D&&o.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":`Reply to @${D}`,title:`Reply to @${D}`,onClick:()=>Ot(r,D),children:o.jsx(Qt,{})}),o.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":"Copy link to message",title:"Copy link to message",onClick:()=>qt(r.id),children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M6.5 9.5a2.5 2.5 0 0 0 3.54 0l2.12-2.12a2.5 2.5 0 0 0-3.54-3.54l-.7.7"}),o.jsx("path",{d:"M9.5 6.5a2.5 2.5 0 0 0-3.54 0L3.84 8.62a2.5 2.5 0 0 0 3.54 3.54l.7-.7"})]})})]})]}),W&&o.jsxs("button",{type:"button",className:"s-thread-reply-ctx",title:`Open the originating request${W.flightId?` · ${W.flightId}`:""}`,onClick:()=>nt(W.originatingMessageId),children:[o.jsx(Qt,{}),o.jsx("span",{className:"s-thread-reply-ctx-label",children:"reply to"}),o.jsx("span",{className:"s-thread-reply-ctx-title",children:W.title}),o.jsxs("span",{className:"s-thread-reply-ctx-from",children:["· ",W.from]}),o.jsx("span",{className:"s-thread-reply-ctx-status",children:"· done"})]}),B&&ee&&o.jsxs("button",{type:"button",className:"s-thread-reply-ctx",title:`Open message from ${ee}`,onClick:()=>nt(B.id),children:[o.jsx(Qt,{}),o.jsx("span",{className:"s-thread-reply-ctx-label",children:"reply to"}),o.jsx("span",{className:"s-thread-reply-ctx-title",children:Hs(B)}),o.jsxs("span",{className:"s-thread-reply-ctx-from",children:["· ",ee]})]}),o.jsx("div",{className:"s-thread-msg-body",title:y,children:o.jsx(Wa,{text:rt})}),o.jsx(kr,{message:r}),c&&c.candidates.length>0&&o.jsx("div",{className:"s-thread-dispatch",children:c.candidates.map($=>o.jsxs("button",{type:"button",className:"s-thread-dispatch-tile",onClick:()=>{Wn(c,$)},children:[o.jsxs("span",{className:"s-thread-dispatch-tile-id",children:["@",$.agentId]}),o.jsx("span",{className:"s-thread-dispatch-tile-state",children:$.endpointState}),o.jsx("span",{className:"s-thread-dispatch-tile-meta",children:[$.workspace,$.node,$.projectRoot].filter(Boolean).join(" · ")||$.displayName})]},$.agentId))})]})})})]},r.id)}),j.showTyping&&!Nt&&o.jsx("div",{className:"s-thread-feed-block",children:o.jsx("div",{className:"s-thread-msg","aria-live":"polite",children:o.jsxs("div",{className:fn,children:[o.jsx(Wt,{agent:Q??void 0,name:F,placement:"turn",className:"s-thread-msg-avatar s-thread-msg-avatar--working",title:F}),o.jsxs("div",{className:"s-thread-msg-card-content",children:[o.jsxs("div",{className:"s-thread-msg-header",children:[o.jsxs("div",{className:"s-thread-msg-meta",children:[o.jsx("span",{className:"s-thread-msg-actor",children:F}),o.jsx("span",{className:gn,children:pn})]}),o.jsx("span",{className:"s-thread-msg-time",title:w?.startedAt?Fs(w.startedAt):"now",children:w?.startedAt?Ut(w.startedAt):"now"})]}),o.jsxs("div",{className:"s-thread-msg-working-body",children:[o.jsxs("div",{className:yn,children:[o.jsx("span",{className:wn,"aria-hidden":"true"}),o.jsxs("div",{className:"s-thread-turn-snapshot-main",children:[o.jsx("span",{className:"s-thread-turn-snapshot-label",children:"Latest"}),o.jsx("span",{className:"s-thread-msg-working-copy",children:ce.latest})]})]}),o.jsxs("dl",{className:"s-thread-turn-snapshot-stats",children:[o.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[o.jsx("dt",{children:"Activity"}),o.jsx("dd",{children:ce.activityLabel})]}),o.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[o.jsx("dt",{children:"Elapsed"}),o.jsx("dd",{children:ce.elapsedLabel})]}),o.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[o.jsx("dt",{children:"Last"}),o.jsx("dd",{children:ce.lastActivityLabel})]})]}),X.length>0||At?o.jsx(nr,{steps:X,phase:At,limit:5,compact:!0}):o.jsx(ar,{events:xe,limit:4,compact:!0}),o.jsx(rr,{onOpenTrace:us,onOpenTerminal:fs,onSteer:gs,compact:!0})]})]})]})})}),Xs&&gt>0&&o.jsxs("button",{type:"button",className:"s-thread-new-messages",onClick:jn,children:[o.jsx("span",{"aria-hidden":"true",children:"↓"})," ",gt," new ",gt===1?"message":"messages"," · jump to latest"]}),o.jsx("div",{ref:es})]}),j.showTyping&&o.jsxs("div",{className:Sn,children:[o.jsx("div",{className:"s-thread-presence-line-avatars",children:o.jsx(Wt,{agent:Q??void 0,name:F,placement:"turn",className:"s-thread-presence-line-avatar",title:F})}),o.jsx("span",{className:"s-thread-presence-line-label",children:kn}),o.jsx("div",{className:bn,"aria-hidden":"true"})]}),o.jsx(ta,{composeRef:L,draft:A,setDraft:q,composePlaceholder:Bn,slashState:oe,setSlashState:Re,filteredSlashCommands:an,applySlashCommand:cn,mentionState:ie,setMentionState:Ee,filteredMentions:rn,applyMention:dn,updateTriggersFromDraft:ln,closeSuggestions:on,replyTarget:ae,onCancelReply:qn,isStopMode:Hn,sending:G,composeAction:Dn,onSend:()=>{Ln()},onInterrupt:()=>{Dt()},attachments:de,isAgentBusy:me,busyIntent:Ts,onBusyIntentChange:at,queued:ue,queueNote:Un,onEditQueued:Pn,editingQueuedId:we?.id??null,editingAttachmentCount:vs.length,onCancelEdit:Fn,onUnqueue:$n,onSendQueuedNow:t=>{On(t)}})]})})}function Qt(){return o.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("polyline",{points:"9 14 4 9 9 4"}),o.jsx("path",{d:"M20 20v-7a4 4 0 0 0-4-4H4"})]})}const si=Ga({id:"thread",label:"Thread",route:{view:"conversation",conversationId:""},webPath:"/chat",screen:"ConversationScreen",embed:{path:"/embed/thread",profile:"macos.thread",rootClassName:"s-thread-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},hosts:{macos:!0},resolveEmbedProps:Ua}});export{ti as ConversationScreen,si as scoutSurface};
@@ -1 +1 @@
1
- import{j as s}from"./index-CzVeWScw.js";import{c as e,h as n}from"./conversation-model-CHwHZNw-.js";import"./colors-BtO5_zlx.js";import"./time-Dhsh_2EG.js";function o({pinnedAsk:a,onAnswer:t}){return s.jsxs("div",{className:"s-thread-pinned-ask",children:[s.jsx("div",{className:"s-thread-pinned-ask-label",children:"Agent question · Awaiting operator"}),s.jsx("div",{className:"s-thread-pinned-ask-body",children:a.task}),s.jsxs("div",{className:"s-thread-pinned-ask-routing",children:[s.jsx("span",{children:a.agentName??e(a.agentId)??a.agentId}),s.jsx("span",{className:"s-thread-pinned-ask-routing-arrow",children:"→"}),s.jsx("span",{children:"You"})]}),s.jsx("div",{className:"s-thread-pinned-ask-actions",children:s.jsx("button",{type:"button",className:"s-ops-btn s-ops-btn--primary",onClick:t,children:"Answer"})}),s.jsx("div",{className:"s-thread-pinned-ask-strip"})]})}function c({presence:a,agent:t}){return a.showStrip?s.jsxs("div",{className:`s-thread-status s-thread-status--${a.tone}`,"aria-live":"polite",children:[s.jsx("span",{className:"s-thread-status-dot",style:{background:n(a,t?.state??null)}}),s.jsxs("div",{className:"s-thread-status-copy",children:[s.jsx("span",{className:"s-thread-status-label",children:a.label}),s.jsx("span",{className:"s-thread-status-detail",children:a.detail})]})]}):null}export{c as ConversationStatusStrip,o as PinnedAskCard};
1
+ import{j as s}from"./index-o4FKpU7Z.js";import{c as e,h as n}from"./conversation-model-CHwHZNw-.js";import"./colors-BtO5_zlx.js";import"./time-Dhsh_2EG.js";function o({pinnedAsk:a,onAnswer:t}){return s.jsxs("div",{className:"s-thread-pinned-ask",children:[s.jsx("div",{className:"s-thread-pinned-ask-label",children:"Agent question · Awaiting operator"}),s.jsx("div",{className:"s-thread-pinned-ask-body",children:a.task}),s.jsxs("div",{className:"s-thread-pinned-ask-routing",children:[s.jsx("span",{children:a.agentName??e(a.agentId)??a.agentId}),s.jsx("span",{className:"s-thread-pinned-ask-routing-arrow",children:"→"}),s.jsx("span",{children:"You"})]}),s.jsx("div",{className:"s-thread-pinned-ask-actions",children:s.jsx("button",{type:"button",className:"s-ops-btn s-ops-btn--primary",onClick:t,children:"Answer"})}),s.jsx("div",{className:"s-thread-pinned-ask-strip"})]})}function c({presence:a,agent:t}){return a.showStrip?s.jsxs("div",{className:`s-thread-status s-thread-status--${a.tone}`,"aria-live":"polite",children:[s.jsx("span",{className:"s-thread-status-dot",style:{background:n(a,t?.state??null)}}),s.jsxs("div",{className:"s-thread-status-copy",children:[s.jsx("span",{className:"s-thread-status-label",children:a.label}),s.jsx("span",{className:"s-thread-status-detail",children:a.detail})]})]}):null}export{c as ConversationStatusStrip,o as PinnedAskCard};
@@ -1 +1 @@
1
- import{r as m,j as o}from"./index-CzVeWScw.js";/* empty css */const $=48,I=720;function _(e){if(!e||typeof window>"u")return null;try{const n=window.localStorage.getItem(e);if(!n)return null;const a=JSON.parse(n);if(!a||typeof a!="object")return null;const f={};for(const[c,d]of Object.entries(a))typeof d=="number"&&Number.isFinite(d)&&d>0&&(f[c]=d);return f}catch{return null}}function z(e,n){if(e&&!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(n))}catch{}}function H({storageKey:e,columns:n}){const a=m.useMemo(()=>{const r=_(e)??{},s={};for(const p of n)s[p.key]=r[p.key]??p.defaultWidth;return s},[e,n]),[f,c]=m.useState(a);m.useEffect(()=>{c(r=>{let s=!1;const p={...r};for(const b of n)p[b.key]==null&&(p[b.key]=b.defaultWidth,s=!0);return s?p:r})},[n]);const d=m.useMemo(()=>{const r=new Map;for(const s of n)r.set(s.key,s);return r},[n]),N=m.useRef(null),x=m.useCallback(r=>{const s=N.current;if(!s)return;const p=r.clientX-s.startX,b=Math.min(s.max,Math.max(s.min,s.startWidth+p));c(u=>u[s.key]===b?u:{...u,[s.key]:b})},[]),y=m.useCallback(()=>{N.current&&(N.current=null,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y),c(r=>(z(e,r),r)))},[x,e]);m.useEffect(()=>()=>{window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y)},[x,y]);const D=m.useCallback(r=>{const s=f[r],p=d.get(r),b=p?.minWidth??$,u=p?.maxWidth??I;return{style:{width:s,minWidth:b,maxWidth:u},"data-resize-key":r}},[f,d]),E=m.useCallback(r=>({onPointerDown:u=>{if(u.button!==0)return;u.preventDefault(),u.stopPropagation();const h=d.get(r),j=h?.minWidth??$,v=h?.maxWidth??I,S=f[r]??h?.defaultWidth??j;N.current={key:r,startX:u.clientX,startWidth:S,min:j,max:v},document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",x),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y)},onClick:u=>{u.stopPropagation()},onDoubleClick:u=>{u.preventDefault(),u.stopPropagation();const h=d.get(r);h&&c(j=>{const v={...j,[r]:h.defaultWidth};return z(e,v),v})},role:"separator","aria-orientation":"vertical","aria-label":"Resize column",className:"s-resize-handle"}),[f,d,x,y,e]),C=m.useCallback(()=>{c(()=>{const r={};for(const s of n)r[s.key]=s.defaultWidth;return z(e,r),r})},[n,e]);return{widths:f,getColumnProps:D,getResizeHandleProps:E,resetAll:C}}function J(e){return e==="number"||e==="time"?"right":"left"}function B(e){return e==="number"||e==="time"?-1:1}function T(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"||typeof e=="bigint"?String(e):Array.isArray(e)?e.map(n=>T(n)).join(""):""}function F(e,n){if(e.sortValue)return e.sortValue(n);const a=e.render(n),f=T(a).trim();return f||null}function R(e){if(typeof e=="number")return e;const n=Date.parse(e);return Number.isFinite(n)?n:Number.NaN}function q(e,n,a,f){const c=F(a,e),d=F(a,n);return c==null&&d==null?0:c==null?1:d==null?-1:a.kind==="number"?((Number(c)||0)-(Number(d)||0))*f:a.kind==="time"?(R(c)-R(d))*f:String(c).localeCompare(String(d),void 0,{numeric:!0,sensitivity:"base"})*f}function G(e,n){return a=>{typeof e=="function"&&e(a),a.defaultPrevented||n?.(a)}}function K(e,n){return a=>{typeof e=="function"&&e(a),a.defaultPrevented||n?.(a)}}function Z({rows:e,columns:n,rowId:a,storageKey:f,initialSort:c,sort:d,onSortChange:N,secondarySort:x,onRowClick:y,rowBindings:D,rowState:E,empty:C={title:"No rows"},loading:r=!1,rowClassName:s,density:p="comfortable",className:b,ariaLabel:u="Data table"}){const h=m.useMemo(()=>n.map(t=>{const l=t.kind??"text";return{...t,kind:l,align:t.align??J(l),sortable:t.sortable??l!=="custom",resizable:t.resizable??!0}}),[n]),j=m.useMemo(()=>new Map(h.map(t=>[t.key,t])),[h]),[v,S]=m.useState(()=>{if(!c)return null;const l=n.find(i=>i.key===c.key)?.kind??"text";return{key:c.key,dir:c.dir??B(l)}}),k=d??v,{getColumnProps:X,getResizeHandleProps:O}=H({storageKey:f,columns:h.map(t=>({key:t.key,defaultWidth:t.defaultWidth,minWidth:t.minWidth,maxWidth:t.maxWidth}))}),M=m.useMemo(()=>{const t=e.map((i,w)=>({row:i,index:w}));if(!k)return t.map(i=>i.row);const l=j.get(k.key);return l?.sortable?t.slice().sort((i,w)=>{const W=q(i.row,w.row,l,k.dir);if(W!==0)return W;const P=x?.(i.row,w.row)??0;return P!==0?P:i.index-w.index}).map(i=>i.row):t.map(i=>i.row)},[e,k,j,x]),A=t=>{d==null&&S(t),N?.(t)};return o.jsx("div",{className:`dt-wrap dt-wrap--${p}${b?` ${b}`:""}`,children:o.jsxs("table",{className:"dt-table","aria-label":u,"aria-busy":r||void 0,children:[o.jsx("thead",{children:o.jsx("tr",{children:h.map(t=>{const l=k?.key===t.key,i=l?k.dir===1?"ascending":"descending":"none",w=["dt-th",`dt-align-${t.align}`,t.cls,l?"dt-th--sorted":""].filter(Boolean).join(" ");return o.jsxs("th",{className:w,title:t.tip,"aria-sort":i,...X(t.key),children:[t.sortable?o.jsxs("button",{type:"button",className:"dt-th-sort",onClick:()=>{if(k?.key===t.key){A({key:t.key,dir:k.dir===1?-1:1});return}A({key:t.key,dir:B(t.kind)})},children:[o.jsx("span",{className:"dt-th-label",children:t.label}),o.jsx("span",{className:`dt-th-arrow${l?" dt-th-arrow--active":""}`,"aria-hidden":"true",children:l?k?.dir===1?"↑":"↓":"↕"})]}):o.jsx("div",{className:"dt-th-static",children:o.jsx("span",{className:"dt-th-label",children:t.label})}),t.resizable?o.jsx("span",{...O(t.key)}):null]},t.key)})})}),o.jsx("tbody",{children:r&&M.length===0?o.jsx("tr",{className:"dt-loading-row",children:o.jsx("td",{colSpan:h.length,children:o.jsx("div",{className:"dt-loading",role:"status","aria-label":`Loading ${u.toLowerCase()}`,children:Array.from({length:7},(t,l)=>o.jsx("div",{className:"dt-loading-line","aria-hidden":"true",children:h.map(i=>o.jsx("span",{style:{width:`${Math.min(i.defaultWidth,220)}px`}},i.key))},l))})})}):M.length===0?o.jsx("tr",{className:"dt-empty-row",children:o.jsx("td",{colSpan:h.length,children:o.jsxs("div",{className:"dt-empty",children:[o.jsx("div",{className:"dt-empty-title",children:C.title}),C.body?o.jsx("div",{children:C.body}):null]})})}):M.map(t=>{const l=a(t),i=D?.(l)??{},w=E?.(l)??{isActive:!1,isPinned:!1},W=!!(y||D),P=["dt-row",W?"dt-row--interactive":"",w.isActive?"dt-row--active":"",w.isPinned?"dt-row--pinned":"",s?.(t),typeof i.className=="string"?i.className:""].filter(Boolean).join(" "),U=y?()=>y(t):void 0,V=W?K(i.onKeyDown,g=>{y&&(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),y(t))}):typeof i.onKeyDown=="function"?i.onKeyDown:void 0,L={...i,className:P,onClick:G(i.onClick,U),onKeyDown:V};return W&&L.tabIndex==null&&(L.tabIndex=0),o.jsx("tr",{...L,children:h.map(g=>o.jsx("td",{className:["dt-td",`dt-align-${g.align}`,g.cls].filter(Boolean).join(" "),children:g.render(t)},g.key))},l)})})]})})}export{Z as D};
1
+ import{r as m,j as o}from"./index-o4FKpU7Z.js";/* empty css */const $=48,I=720;function _(e){if(!e||typeof window>"u")return null;try{const n=window.localStorage.getItem(e);if(!n)return null;const a=JSON.parse(n);if(!a||typeof a!="object")return null;const f={};for(const[c,d]of Object.entries(a))typeof d=="number"&&Number.isFinite(d)&&d>0&&(f[c]=d);return f}catch{return null}}function z(e,n){if(e&&!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(n))}catch{}}function H({storageKey:e,columns:n}){const a=m.useMemo(()=>{const r=_(e)??{},s={};for(const p of n)s[p.key]=r[p.key]??p.defaultWidth;return s},[e,n]),[f,c]=m.useState(a);m.useEffect(()=>{c(r=>{let s=!1;const p={...r};for(const b of n)p[b.key]==null&&(p[b.key]=b.defaultWidth,s=!0);return s?p:r})},[n]);const d=m.useMemo(()=>{const r=new Map;for(const s of n)r.set(s.key,s);return r},[n]),N=m.useRef(null),x=m.useCallback(r=>{const s=N.current;if(!s)return;const p=r.clientX-s.startX,b=Math.min(s.max,Math.max(s.min,s.startWidth+p));c(u=>u[s.key]===b?u:{...u,[s.key]:b})},[]),y=m.useCallback(()=>{N.current&&(N.current=null,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y),c(r=>(z(e,r),r)))},[x,e]);m.useEffect(()=>()=>{window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y)},[x,y]);const D=m.useCallback(r=>{const s=f[r],p=d.get(r),b=p?.minWidth??$,u=p?.maxWidth??I;return{style:{width:s,minWidth:b,maxWidth:u},"data-resize-key":r}},[f,d]),E=m.useCallback(r=>({onPointerDown:u=>{if(u.button!==0)return;u.preventDefault(),u.stopPropagation();const h=d.get(r),j=h?.minWidth??$,v=h?.maxWidth??I,S=f[r]??h?.defaultWidth??j;N.current={key:r,startX:u.clientX,startWidth:S,min:j,max:v},document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",x),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y)},onClick:u=>{u.stopPropagation()},onDoubleClick:u=>{u.preventDefault(),u.stopPropagation();const h=d.get(r);h&&c(j=>{const v={...j,[r]:h.defaultWidth};return z(e,v),v})},role:"separator","aria-orientation":"vertical","aria-label":"Resize column",className:"s-resize-handle"}),[f,d,x,y,e]),C=m.useCallback(()=>{c(()=>{const r={};for(const s of n)r[s.key]=s.defaultWidth;return z(e,r),r})},[n,e]);return{widths:f,getColumnProps:D,getResizeHandleProps:E,resetAll:C}}function J(e){return e==="number"||e==="time"?"right":"left"}function B(e){return e==="number"||e==="time"?-1:1}function T(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"||typeof e=="bigint"?String(e):Array.isArray(e)?e.map(n=>T(n)).join(""):""}function F(e,n){if(e.sortValue)return e.sortValue(n);const a=e.render(n),f=T(a).trim();return f||null}function R(e){if(typeof e=="number")return e;const n=Date.parse(e);return Number.isFinite(n)?n:Number.NaN}function q(e,n,a,f){const c=F(a,e),d=F(a,n);return c==null&&d==null?0:c==null?1:d==null?-1:a.kind==="number"?((Number(c)||0)-(Number(d)||0))*f:a.kind==="time"?(R(c)-R(d))*f:String(c).localeCompare(String(d),void 0,{numeric:!0,sensitivity:"base"})*f}function G(e,n){return a=>{typeof e=="function"&&e(a),a.defaultPrevented||n?.(a)}}function K(e,n){return a=>{typeof e=="function"&&e(a),a.defaultPrevented||n?.(a)}}function Z({rows:e,columns:n,rowId:a,storageKey:f,initialSort:c,sort:d,onSortChange:N,secondarySort:x,onRowClick:y,rowBindings:D,rowState:E,empty:C={title:"No rows"},loading:r=!1,rowClassName:s,density:p="comfortable",className:b,ariaLabel:u="Data table"}){const h=m.useMemo(()=>n.map(t=>{const l=t.kind??"text";return{...t,kind:l,align:t.align??J(l),sortable:t.sortable??l!=="custom",resizable:t.resizable??!0}}),[n]),j=m.useMemo(()=>new Map(h.map(t=>[t.key,t])),[h]),[v,S]=m.useState(()=>{if(!c)return null;const l=n.find(i=>i.key===c.key)?.kind??"text";return{key:c.key,dir:c.dir??B(l)}}),k=d??v,{getColumnProps:X,getResizeHandleProps:O}=H({storageKey:f,columns:h.map(t=>({key:t.key,defaultWidth:t.defaultWidth,minWidth:t.minWidth,maxWidth:t.maxWidth}))}),M=m.useMemo(()=>{const t=e.map((i,w)=>({row:i,index:w}));if(!k)return t.map(i=>i.row);const l=j.get(k.key);return l?.sortable?t.slice().sort((i,w)=>{const W=q(i.row,w.row,l,k.dir);if(W!==0)return W;const P=x?.(i.row,w.row)??0;return P!==0?P:i.index-w.index}).map(i=>i.row):t.map(i=>i.row)},[e,k,j,x]),A=t=>{d==null&&S(t),N?.(t)};return o.jsx("div",{className:`dt-wrap dt-wrap--${p}${b?` ${b}`:""}`,children:o.jsxs("table",{className:"dt-table","aria-label":u,"aria-busy":r||void 0,children:[o.jsx("thead",{children:o.jsx("tr",{children:h.map(t=>{const l=k?.key===t.key,i=l?k.dir===1?"ascending":"descending":"none",w=["dt-th",`dt-align-${t.align}`,t.cls,l?"dt-th--sorted":""].filter(Boolean).join(" ");return o.jsxs("th",{className:w,title:t.tip,"aria-sort":i,...X(t.key),children:[t.sortable?o.jsxs("button",{type:"button",className:"dt-th-sort",onClick:()=>{if(k?.key===t.key){A({key:t.key,dir:k.dir===1?-1:1});return}A({key:t.key,dir:B(t.kind)})},children:[o.jsx("span",{className:"dt-th-label",children:t.label}),o.jsx("span",{className:`dt-th-arrow${l?" dt-th-arrow--active":""}`,"aria-hidden":"true",children:l?k?.dir===1?"↑":"↓":"↕"})]}):o.jsx("div",{className:"dt-th-static",children:o.jsx("span",{className:"dt-th-label",children:t.label})}),t.resizable?o.jsx("span",{...O(t.key)}):null]},t.key)})})}),o.jsx("tbody",{children:r&&M.length===0?o.jsx("tr",{className:"dt-loading-row",children:o.jsx("td",{colSpan:h.length,children:o.jsx("div",{className:"dt-loading",role:"status","aria-label":`Loading ${u.toLowerCase()}`,children:Array.from({length:7},(t,l)=>o.jsx("div",{className:"dt-loading-line","aria-hidden":"true",children:h.map(i=>o.jsx("span",{style:{width:`${Math.min(i.defaultWidth,220)}px`}},i.key))},l))})})}):M.length===0?o.jsx("tr",{className:"dt-empty-row",children:o.jsx("td",{colSpan:h.length,children:o.jsxs("div",{className:"dt-empty",children:[o.jsx("div",{className:"dt-empty-title",children:C.title}),C.body?o.jsx("div",{children:C.body}):null]})})}):M.map(t=>{const l=a(t),i=D?.(l)??{},w=E?.(l)??{isActive:!1,isPinned:!1},W=!!(y||D),P=["dt-row",W?"dt-row--interactive":"",w.isActive?"dt-row--active":"",w.isPinned?"dt-row--pinned":"",s?.(t),typeof i.className=="string"?i.className:""].filter(Boolean).join(" "),U=y?()=>y(t):void 0,V=W?K(i.onKeyDown,g=>{y&&(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),y(t))}):typeof i.onKeyDown=="function"?i.onKeyDown:void 0,L={...i,className:P,onClick:G(i.onClick,U),onKeyDown:V};return W&&L.tabIndex==null&&(L.tabIndex=0),o.jsx("tr",{...L,children:h.map(g=>o.jsx("td",{className:["dt-td",`dt-align-${g.align}`,g.cls].filter(Boolean).join(" "),children:g.render(t)},g.key))},l)})})]})})}export{Z as D};
@@ -1 +1 @@
1
- import{r as f,j as r}from"./index-CzVeWScw.js";import{a as y}from"./api-h5zurxmi.js";import{i as j}from"./scoutbot-BTIErYHo.js";import{u as S}from"./sse-QcU9bikk.js";import{t as E}from"./time-Dhsh_2EG.js";import{o as M}from"./openContent-C6XO6kr5.js";import{e as k}from"./broker-display-pp33bLsu.js";import{r as R}from"./follow-route-BvcGtBIL.js";import{L as C}from"./loader-circle-Byb9kSFx.js";import{A as L}from"./arrow-up-right-CcrWONpD.js";import"./index-BWHgHrtv.js";import"./status-tone-BM_zuRy1.js";import"./createLucideIcon-ClCdc3F9.js";const _=3,$=80;function h(e){return Number(e.createdAt)||0}function F(e,s){if(!e.conversationId)return{status:"no-conversation"};const t=s.slice().sort((o,i)=>h(o)-h(i)),n=e.messageId?t.find(o=>o.id===e.messageId)??null:null;let l;if(n){const o=h(n);l=t.filter(i=>i.id!==n.id&&h(i)>=o)}else{const o=t[0];if(o&&h(o)>e.ts)return{status:"beyond-page"};l=t.filter(i=>h(i)>e.ts)}if(l.length===0)return{status:"no-reply"};const u=n?h(n):e.ts,d=l.slice(0,_).map(o=>({id:o.id,actorName:o.actorName||"Unknown",body:o.body??"",createdAt:h(o),afterMs:Math.max(0,h(o)-u),answersDispatch:!!(e.messageId&&o.replyToMessageId===e.messageId)}));return{status:"replies",replies:d,more:Math.max(0,l.length-d.length)}}function b(e,...s){const t=e.metadata??{},n=t.raw&&typeof t.raw=="object"&&!Array.isArray(t.raw)?t.raw:null;for(const l of s)for(const u of[t,n]){const d=u?.[l];if(typeof d=="string"&&d.trim())return d.trim()}return null}function D(e,s){const t=new URLSearchParams,n=e.invocationId??b(e,"invocationId"),l=b(e,"flightId"),u=b(e,"collaborationRecordId","workId","recordId");return l&&t.set("flightId",l),n&&t.set("invocationId",n),e.conversationId&&t.set("conversationId",e.conversationId),u&&t.set("workId",u),s&&t.set("targetAgentId",s),[...t.keys()].length>0?t:null}function H(e,s={}){const t=[];return e.conversationId&&t.push({key:"conversation",label:"Conversation",hint:"The thread this dispatch landed in",route:{view:"conversation",conversationId:e.conversationId}}),(e.flightId||e.sessionId)&&t.push({key:"trace",label:"Live trace",hint:"The session that ran the work",route:{view:"sessions",...e.flightId?{flightId:e.flightId}:{},...e.sessionId?{sessionId:e.sessionId}:{},...e.targetAgentId?{agentId:e.targetAgentId}:{}}}),e.workId&&!s.nativeHost&&t.push({key:"work",label:"Work item",hint:"The collaboration record it belongs to",route:{view:"work",workId:e.workId}}),e.targetAgentId&&t.push({key:"agent",label:"Recipient",hint:"The agent that received it",route:{view:"agents-v2",agentId:e.targetAgentId,tab:"observe"}}),t.length>0&&t.push({key:"tail",label:"Tail",hint:"Raw events for these ids",route:R(e,"tail")}),t}const P={queued:"Queued",dispatched:"Dispatched",running:"Running",succeeded:"Completed",completed:"Completed",failed:"Failed",errored:"Failed",cancelled:"Cancelled",canceled:"Cancelled",timed_out:"Timed out",expired:"Expired"},U=new Set(["failed","errored","timed_out","expired"]),v=new Set(["queued","dispatched","running"]),G=new Set(["succeeded","completed"]);function q(e){if(!e)return null;const s=e.state?.trim().toLowerCase()||"unknown",t=U.has(s)?"danger":v.has(s)?"working":G.has(s)?"success":"neutral",n=e.startedAt&&e.completedAt?Math.max(0,e.completedAt-e.startedAt):null;return{state:s,label:P[s]??s.replace(/_/g," "),tone:t,summary:e.summary?.trim()||null,durationMs:n,settled:!v.has(s)}}function O(e){if(e<1e3)return"instant";const s=Math.round(e/1e3);if(s<60)return`${s}s later`;const t=Math.round(s/60);if(t<60)return`${t}m later`;const n=Math.round(t/60);return n<48?`${n}h later`:`${Math.round(n/24)}d later`}function B(e){if(e<1e3)return`${e}ms`;const s=e/1e3;if(s<60)return`${s.toFixed(s<10?1:0)}s`;const t=Math.floor(s/60),n=Math.round(s%60);return t<60?n>0?`${t}m ${n}s`:`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}const w=180,Q=250,W={loading:!0,target:null,targetUnknown:!1,flight:null,aftermath:{status:"no-conversation"}};function z(e,s){const[t,n]=f.useState(W),[l,u]=f.useState(0),d=f.useRef(0),o=e.conversationId,i=f.useMemo(()=>D(e,s)?.toString()??null,[e,s]);f.useEffect(()=>{const a=++d.current;n(p=>({...p,loading:!0}));const x=i?y(`/api/follow?${i}`).catch(()=>null):Promise.resolve(null),A=o?y(`/api/messages?conversationId=${encodeURIComponent(o)}&limit=${$}`).catch(()=>null):Promise.resolve(null);return(async()=>{const[p,g]=await Promise.all([x,A]);if(a!==d.current)return;const T=p?.flightId?await y(`/api/flights?active=false&flightId=${encodeURIComponent(p.flightId)}`).then(N=>N[0]??null).catch(()=>null):null;a===d.current&&n({loading:!1,target:p,targetUnknown:!!i&&!p,flight:T,aftermath:o?g?F(e,g):{status:"unavailable"}:{status:"no-conversation"}})})(),()=>{d.current+=1}},[e,o,i,l]);const c=f.useRef(null),m=f.useCallback(()=>{c.current||(c.current=setTimeout(()=>{c.current=null,u(a=>a+1)},Q))},[]);f.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const I=t.flight?.id??t.target?.flightId??null;return S(a=>{switch(a.kind){case"message.posted":o&&a.payload.message.conversationId===o&&m();return;case"delivery.state.changed":e.messageId&&a.payload.delivery.messageId===e.messageId&&m();return;case"flight.updated":I&&a.payload.flight.id===I&&m();return}}),{...t,reload:m}}function ie({attempt:e,targetAgentId:s,navigate:t,returnTo:n}){const{loading:l,target:u,targetUnknown:d,flight:o,aftermath:i}=z(e,s),c=q(o),m=u?H(u,{nativeHost:j()}):[],I=f.useCallback(a=>M(t,a,{returnTo:n}),[t,n]);return r.jsxs("section",{className:"sys-broker-aftermath","aria-labelledby":"dispatch-aftermath-title",children:[r.jsxs("div",{className:"sys-broker-aftermath-head",children:[r.jsx("span",{id:"dispatch-aftermath-title",className:"sys-detail-label",children:"What happened next"}),l&&r.jsx(C,{className:"sys-broker-action-spinner",size:12,"aria-hidden":"true"})]}),c&&r.jsxs("div",{className:`sys-broker-aftermath-outcome sys-broker-aftermath-outcome--${c.tone}`,children:[r.jsx("span",{className:`sys-broker-dot sys-broker-dot--${c.tone}`,"aria-hidden":"true"}),r.jsx("strong",{children:c.label}),c.durationMs!==null&&r.jsxs("span",{className:"sys-broker-aftermath-duration",children:["ran ",B(c.durationMs)]}),c.summary&&r.jsx("p",{children:k(c.summary,w)})]}),i.status==="replies"?r.jsxs("ol",{className:"sys-broker-aftermath-replies",children:[i.replies.map(a=>r.jsx("li",{children:r.jsxs("button",{type:"button",className:"sys-broker-aftermath-reply",disabled:!e.conversationId,onClick:()=>e.conversationId&&I({view:"conversation",conversationId:e.conversationId}),children:[r.jsxs("span",{className:"sys-broker-aftermath-reply-head",children:[r.jsx("strong",{children:a.actorName}),a.answersDispatch&&r.jsx("span",{className:"sys-broker-aftermath-answer",children:"reply"}),r.jsx("span",{className:"sys-broker-aftermath-gap",children:O(a.afterMs)})]}),r.jsx("span",{className:"sys-broker-aftermath-reply-body",children:k(a.body,w)})]})},a.id)),i.more>0&&r.jsxs("li",{className:"sys-broker-aftermath-more",children:["+",i.more," more in the thread"]})]}):!l&&r.jsx("p",{className:"sys-broker-aftermath-empty",children:i.status==="no-conversation"?"No conversation followed this dispatch, so there is nothing to open.":i.status==="unavailable"?"The conversation could not be read, so what followed is unknown.":i.status==="beyond-page"?"This dispatch is older than the loaded transcript. Open the conversation to read it in place.":c&&!c.settled?"Still running. Nothing has come back yet.":"Nothing followed this dispatch in its conversation."}),m.length>0?r.jsx("div",{className:"sys-broker-aftermath-links",children:m.map(a=>r.jsxs("button",{type:"button",className:"sys-broker-aftermath-link",title:a.hint,onClick:()=>I(a.route),children:[a.label,r.jsx(L,{size:11,"aria-hidden":"true"})]},a.key))}):!l&&i.status!=="no-conversation"&&r.jsx("p",{className:"sys-broker-aftermath-empty",children:d?"Where this went could not be looked up, so there is nothing to link to yet.":"No session, work item, or recipient could be resolved from this row."}),o?.completedAt&&r.jsxs("div",{className:"sys-broker-aftermath-foot",children:["Settled ",E(o.completedAt)]})]})}export{ie as DispatchAftermath};
1
+ import{r as f,j as r}from"./index-o4FKpU7Z.js";import{a as y}from"./api-h5zurxmi.js";import{i as j}from"./scoutbot-BTIErYHo.js";import{u as S}from"./sse-CL6gctHY.js";import{t as E}from"./time-Dhsh_2EG.js";import{o as M}from"./openContent-C6XO6kr5.js";import{e as k}from"./broker-display-pp33bLsu.js";import{r as R}from"./follow-route-BvcGtBIL.js";import{L as C}from"./loader-circle-4LDsy4Ke.js";import{A as L}from"./arrow-up-right-hoR8_oUz.js";import"./index-BWHgHrtv.js";import"./status-tone-BM_zuRy1.js";import"./createLucideIcon-Bt67PWH-.js";const _=3,$=80;function h(e){return Number(e.createdAt)||0}function F(e,s){if(!e.conversationId)return{status:"no-conversation"};const t=s.slice().sort((o,i)=>h(o)-h(i)),n=e.messageId?t.find(o=>o.id===e.messageId)??null:null;let l;if(n){const o=h(n);l=t.filter(i=>i.id!==n.id&&h(i)>=o)}else{const o=t[0];if(o&&h(o)>e.ts)return{status:"beyond-page"};l=t.filter(i=>h(i)>e.ts)}if(l.length===0)return{status:"no-reply"};const u=n?h(n):e.ts,d=l.slice(0,_).map(o=>({id:o.id,actorName:o.actorName||"Unknown",body:o.body??"",createdAt:h(o),afterMs:Math.max(0,h(o)-u),answersDispatch:!!(e.messageId&&o.replyToMessageId===e.messageId)}));return{status:"replies",replies:d,more:Math.max(0,l.length-d.length)}}function b(e,...s){const t=e.metadata??{},n=t.raw&&typeof t.raw=="object"&&!Array.isArray(t.raw)?t.raw:null;for(const l of s)for(const u of[t,n]){const d=u?.[l];if(typeof d=="string"&&d.trim())return d.trim()}return null}function D(e,s){const t=new URLSearchParams,n=e.invocationId??b(e,"invocationId"),l=b(e,"flightId"),u=b(e,"collaborationRecordId","workId","recordId");return l&&t.set("flightId",l),n&&t.set("invocationId",n),e.conversationId&&t.set("conversationId",e.conversationId),u&&t.set("workId",u),s&&t.set("targetAgentId",s),[...t.keys()].length>0?t:null}function H(e,s={}){const t=[];return e.conversationId&&t.push({key:"conversation",label:"Conversation",hint:"The thread this dispatch landed in",route:{view:"conversation",conversationId:e.conversationId}}),(e.flightId||e.sessionId)&&t.push({key:"trace",label:"Live trace",hint:"The session that ran the work",route:{view:"sessions",...e.flightId?{flightId:e.flightId}:{},...e.sessionId?{sessionId:e.sessionId}:{},...e.targetAgentId?{agentId:e.targetAgentId}:{}}}),e.workId&&!s.nativeHost&&t.push({key:"work",label:"Work item",hint:"The collaboration record it belongs to",route:{view:"work",workId:e.workId}}),e.targetAgentId&&t.push({key:"agent",label:"Recipient",hint:"The agent that received it",route:{view:"agents-v2",agentId:e.targetAgentId,tab:"observe"}}),t.length>0&&t.push({key:"tail",label:"Tail",hint:"Raw events for these ids",route:R(e,"tail")}),t}const P={queued:"Queued",dispatched:"Dispatched",running:"Running",succeeded:"Completed",completed:"Completed",failed:"Failed",errored:"Failed",cancelled:"Cancelled",canceled:"Cancelled",timed_out:"Timed out",expired:"Expired"},U=new Set(["failed","errored","timed_out","expired"]),v=new Set(["queued","dispatched","running"]),G=new Set(["succeeded","completed"]);function q(e){if(!e)return null;const s=e.state?.trim().toLowerCase()||"unknown",t=U.has(s)?"danger":v.has(s)?"working":G.has(s)?"success":"neutral",n=e.startedAt&&e.completedAt?Math.max(0,e.completedAt-e.startedAt):null;return{state:s,label:P[s]??s.replace(/_/g," "),tone:t,summary:e.summary?.trim()||null,durationMs:n,settled:!v.has(s)}}function O(e){if(e<1e3)return"instant";const s=Math.round(e/1e3);if(s<60)return`${s}s later`;const t=Math.round(s/60);if(t<60)return`${t}m later`;const n=Math.round(t/60);return n<48?`${n}h later`:`${Math.round(n/24)}d later`}function B(e){if(e<1e3)return`${e}ms`;const s=e/1e3;if(s<60)return`${s.toFixed(s<10?1:0)}s`;const t=Math.floor(s/60),n=Math.round(s%60);return t<60?n>0?`${t}m ${n}s`:`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}const w=180,Q=250,W={loading:!0,target:null,targetUnknown:!1,flight:null,aftermath:{status:"no-conversation"}};function z(e,s){const[t,n]=f.useState(W),[l,u]=f.useState(0),d=f.useRef(0),o=e.conversationId,i=f.useMemo(()=>D(e,s)?.toString()??null,[e,s]);f.useEffect(()=>{const a=++d.current;n(p=>({...p,loading:!0}));const x=i?y(`/api/follow?${i}`).catch(()=>null):Promise.resolve(null),A=o?y(`/api/messages?conversationId=${encodeURIComponent(o)}&limit=${$}`).catch(()=>null):Promise.resolve(null);return(async()=>{const[p,g]=await Promise.all([x,A]);if(a!==d.current)return;const T=p?.flightId?await y(`/api/flights?active=false&flightId=${encodeURIComponent(p.flightId)}`).then(N=>N[0]??null).catch(()=>null):null;a===d.current&&n({loading:!1,target:p,targetUnknown:!!i&&!p,flight:T,aftermath:o?g?F(e,g):{status:"unavailable"}:{status:"no-conversation"}})})(),()=>{d.current+=1}},[e,o,i,l]);const c=f.useRef(null),m=f.useCallback(()=>{c.current||(c.current=setTimeout(()=>{c.current=null,u(a=>a+1)},Q))},[]);f.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const I=t.flight?.id??t.target?.flightId??null;return S(a=>{switch(a.kind){case"message.posted":o&&a.payload.message.conversationId===o&&m();return;case"delivery.state.changed":e.messageId&&a.payload.delivery.messageId===e.messageId&&m();return;case"flight.updated":I&&a.payload.flight.id===I&&m();return}}),{...t,reload:m}}function ie({attempt:e,targetAgentId:s,navigate:t,returnTo:n}){const{loading:l,target:u,targetUnknown:d,flight:o,aftermath:i}=z(e,s),c=q(o),m=u?H(u,{nativeHost:j()}):[],I=f.useCallback(a=>M(t,a,{returnTo:n}),[t,n]);return r.jsxs("section",{className:"sys-broker-aftermath","aria-labelledby":"dispatch-aftermath-title",children:[r.jsxs("div",{className:"sys-broker-aftermath-head",children:[r.jsx("span",{id:"dispatch-aftermath-title",className:"sys-detail-label",children:"What happened next"}),l&&r.jsx(C,{className:"sys-broker-action-spinner",size:12,"aria-hidden":"true"})]}),c&&r.jsxs("div",{className:`sys-broker-aftermath-outcome sys-broker-aftermath-outcome--${c.tone}`,children:[r.jsx("span",{className:`sys-broker-dot sys-broker-dot--${c.tone}`,"aria-hidden":"true"}),r.jsx("strong",{children:c.label}),c.durationMs!==null&&r.jsxs("span",{className:"sys-broker-aftermath-duration",children:["ran ",B(c.durationMs)]}),c.summary&&r.jsx("p",{children:k(c.summary,w)})]}),i.status==="replies"?r.jsxs("ol",{className:"sys-broker-aftermath-replies",children:[i.replies.map(a=>r.jsx("li",{children:r.jsxs("button",{type:"button",className:"sys-broker-aftermath-reply",disabled:!e.conversationId,onClick:()=>e.conversationId&&I({view:"conversation",conversationId:e.conversationId}),children:[r.jsxs("span",{className:"sys-broker-aftermath-reply-head",children:[r.jsx("strong",{children:a.actorName}),a.answersDispatch&&r.jsx("span",{className:"sys-broker-aftermath-answer",children:"reply"}),r.jsx("span",{className:"sys-broker-aftermath-gap",children:O(a.afterMs)})]}),r.jsx("span",{className:"sys-broker-aftermath-reply-body",children:k(a.body,w)})]})},a.id)),i.more>0&&r.jsxs("li",{className:"sys-broker-aftermath-more",children:["+",i.more," more in the thread"]})]}):!l&&r.jsx("p",{className:"sys-broker-aftermath-empty",children:i.status==="no-conversation"?"No conversation followed this dispatch, so there is nothing to open.":i.status==="unavailable"?"The conversation could not be read, so what followed is unknown.":i.status==="beyond-page"?"This dispatch is older than the loaded transcript. Open the conversation to read it in place.":c&&!c.settled?"Still running. Nothing has come back yet.":"Nothing followed this dispatch in its conversation."}),m.length>0?r.jsx("div",{className:"sys-broker-aftermath-links",children:m.map(a=>r.jsxs("button",{type:"button",className:"sys-broker-aftermath-link",title:a.hint,onClick:()=>I(a.route),children:[a.label,r.jsx(L,{size:11,"aria-hidden":"true"})]},a.key))}):!l&&i.status!=="no-conversation"&&r.jsx("p",{className:"sys-broker-aftermath-empty",children:d?"Where this went could not be looked up, so there is nothing to link to yet.":"No session, work item, or recipient could be resolved from this row."}),o?.completedAt&&r.jsxs("div",{className:"sys-broker-aftermath-foot",children:["Settled ",E(o.completedAt)]})]})}export{ie as DispatchAftermath};
@@ -1 +1 @@
1
- import{c as u}from"./createLucideIcon-ClCdc3F9.js";import{r,j as e}from"./index-CzVeWScw.js";import{T as H}from"./TextDocumentSurface-DRjctOIt.js";/* empty css */import{F as A}from"./file-text-DG-pufl1.js";import{X as R}from"./x-D4X_y1j_.js";const S=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],G=u("folder-open",S);const W=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],J=u("folder",W);const B=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],T=u("maximize-2",B);const V=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],C=u("minimize-2",V);function P({open:a=!0,focusable:M=!0,kind:F,document:t,title:z,eyebrow:v,subtitle:w,meta:x=[],mode:$,actions:L=[],state:p,error:c,notice:j,body:d,onClose:o}){const[i,m]=r.useState(!1),[g,y]=r.useState({}),b=r.useRef(null);if(r.useEffect(()=>{a||m(!1)},[a]),r.useEffect(()=>{if(!a)return;let s=null;const l=b.current?.closest(".frame-scrollbar, .s-content")??null,N=()=>{if(!l){y({});return}const n=l.getBoundingClientRect();y({"--doc-focus-layer-top":`${Math.max(0,n.top)}px`,"--doc-focus-layer-right":`${Math.max(0,window.innerWidth-n.right)}px`,"--doc-focus-layer-bottom":`${Math.max(0,window.innerHeight-n.bottom)}px`,"--doc-focus-layer-left":`${Math.max(0,n.left)}px`})},h=()=>{s!==null&&cancelAnimationFrame(s),s=requestAnimationFrame(N)};N();const E=l?new ResizeObserver(h):null;return l&&E?.observe(l),window.addEventListener("resize",h),()=>{s!==null&&cancelAnimationFrame(s),E?.disconnect(),window.removeEventListener("resize",h)}},[a]),r.useEffect(()=>{if(!a)return;const s=f=>{f.key==="Escape"&&(f.preventDefault(),i?m(!1):o?.())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[i,o,a]),!a)return null;const k=z??t?.title??"Document",D=$??(t?.kind==="markdown"?"preview":"read"),_=M&&!!(t||d);return e.jsxs("div",{ref:b,className:`s-doc-focus-layer${i?" s-doc-focus-layer-focused":""}`,style:g,children:[o&&e.jsx("button",{type:"button",className:"s-doc-focus-scrim","aria-label":"Dismiss document viewer",tabIndex:-1,onClick:o}),e.jsxs("section",{className:`s-doc-focus-viewer s-doc-focus-viewer-${F}${i?" s-doc-focus-viewer-focused":""}`,"aria-label":k,role:"dialog","aria-modal":"true",children:[e.jsxs("div",{className:"s-doc-focus-viewer-head",children:[e.jsxs("div",{className:"s-doc-focus-viewer-title-wrap",children:[e.jsx("div",{className:"s-doc-focus-viewer-icon","aria-hidden":"true",children:e.jsx(A,{size:15,strokeWidth:1.8})}),e.jsxs("div",{className:"s-doc-focus-viewer-title-main",children:[v&&e.jsx("div",{className:"s-doc-focus-viewer-eyebrow",children:v}),e.jsx("h3",{className:"s-doc-focus-viewer-title",children:k}),w&&e.jsx("div",{className:"s-doc-focus-viewer-subtitle",children:w})]})]}),e.jsxs("div",{className:"s-doc-focus-viewer-actions",children:[x.length>0&&e.jsx("div",{className:"s-doc-focus-viewer-meta","aria-label":"Document metadata",children:x.map(s=>e.jsx("span",{children:s},s))}),L.map(s=>e.jsxs("button",{type:"button",className:`s-doc-focus-viewer-action${s.hideLabel?" s-doc-focus-viewer-action-icon":""}`,onClick:s.onClick,title:s.title??s.label,disabled:s.disabled,"aria-label":s.hideLabel?s.label:void 0,children:[s.icon,!s.hideLabel&&e.jsx("span",{children:s.label})]},s.label)),_&&e.jsx("button",{type:"button",className:"s-doc-focus-viewer-close",onClick:()=>m(s=>!s),"aria-label":i?"Exit focus mode":"Enter focus mode",title:i?"Exit focus mode":"Focus",children:i?e.jsx(C,{"aria-hidden":"true",size:14,strokeWidth:1.8}):e.jsx(T,{"aria-hidden":"true",size:14,strokeWidth:1.8})}),o&&e.jsx("button",{type:"button",className:"s-doc-focus-viewer-close",onClick:o,"aria-label":"Close document viewer",title:"Close",children:e.jsx(R,{"aria-hidden":"true",size:14,strokeWidth:1.8})})]})]}),p&&!c&&!t&&!d&&e.jsx("div",{className:"s-doc-focus-viewer-state",children:p}),c&&e.jsx("div",{className:"s-doc-focus-viewer-state s-doc-focus-viewer-error",children:c}),!c&&d&&e.jsx("div",{className:"s-doc-focus-viewer-body",children:d}),!c&&!d&&t&&e.jsx(H,{document:t,mode:D,showHeader:!1,className:"s-doc-focus-document"}),!c&&j&&e.jsx("div",{className:"s-doc-focus-viewer-notice",children:j})]})]})}export{P as D,J as F,C as M,G as a,T as b};
1
+ import{c as u}from"./createLucideIcon-Bt67PWH-.js";import{r,j as e}from"./index-o4FKpU7Z.js";import{T as H}from"./TextDocumentSurface-Bc-kHPgG.js";/* empty css */import{F as A}from"./file-text-iF0hyVyU.js";import{X as R}from"./x-ynOfVadO.js";const S=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],G=u("folder-open",S);const W=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],J=u("folder",W);const B=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],T=u("maximize-2",B);const V=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],C=u("minimize-2",V);function P({open:a=!0,focusable:M=!0,kind:F,document:t,title:z,eyebrow:v,subtitle:w,meta:x=[],mode:$,actions:L=[],state:p,error:c,notice:j,body:d,onClose:o}){const[i,m]=r.useState(!1),[g,y]=r.useState({}),b=r.useRef(null);if(r.useEffect(()=>{a||m(!1)},[a]),r.useEffect(()=>{if(!a)return;let s=null;const l=b.current?.closest(".frame-scrollbar, .s-content")??null,N=()=>{if(!l){y({});return}const n=l.getBoundingClientRect();y({"--doc-focus-layer-top":`${Math.max(0,n.top)}px`,"--doc-focus-layer-right":`${Math.max(0,window.innerWidth-n.right)}px`,"--doc-focus-layer-bottom":`${Math.max(0,window.innerHeight-n.bottom)}px`,"--doc-focus-layer-left":`${Math.max(0,n.left)}px`})},h=()=>{s!==null&&cancelAnimationFrame(s),s=requestAnimationFrame(N)};N();const E=l?new ResizeObserver(h):null;return l&&E?.observe(l),window.addEventListener("resize",h),()=>{s!==null&&cancelAnimationFrame(s),E?.disconnect(),window.removeEventListener("resize",h)}},[a]),r.useEffect(()=>{if(!a)return;const s=f=>{f.key==="Escape"&&(f.preventDefault(),i?m(!1):o?.())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[i,o,a]),!a)return null;const k=z??t?.title??"Document",D=$??(t?.kind==="markdown"?"preview":"read"),_=M&&!!(t||d);return e.jsxs("div",{ref:b,className:`s-doc-focus-layer${i?" s-doc-focus-layer-focused":""}`,style:g,children:[o&&e.jsx("button",{type:"button",className:"s-doc-focus-scrim","aria-label":"Dismiss document viewer",tabIndex:-1,onClick:o}),e.jsxs("section",{className:`s-doc-focus-viewer s-doc-focus-viewer-${F}${i?" s-doc-focus-viewer-focused":""}`,"aria-label":k,role:"dialog","aria-modal":"true",children:[e.jsxs("div",{className:"s-doc-focus-viewer-head",children:[e.jsxs("div",{className:"s-doc-focus-viewer-title-wrap",children:[e.jsx("div",{className:"s-doc-focus-viewer-icon","aria-hidden":"true",children:e.jsx(A,{size:15,strokeWidth:1.8})}),e.jsxs("div",{className:"s-doc-focus-viewer-title-main",children:[v&&e.jsx("div",{className:"s-doc-focus-viewer-eyebrow",children:v}),e.jsx("h3",{className:"s-doc-focus-viewer-title",children:k}),w&&e.jsx("div",{className:"s-doc-focus-viewer-subtitle",children:w})]})]}),e.jsxs("div",{className:"s-doc-focus-viewer-actions",children:[x.length>0&&e.jsx("div",{className:"s-doc-focus-viewer-meta","aria-label":"Document metadata",children:x.map(s=>e.jsx("span",{children:s},s))}),L.map(s=>e.jsxs("button",{type:"button",className:`s-doc-focus-viewer-action${s.hideLabel?" s-doc-focus-viewer-action-icon":""}`,onClick:s.onClick,title:s.title??s.label,disabled:s.disabled,"aria-label":s.hideLabel?s.label:void 0,children:[s.icon,!s.hideLabel&&e.jsx("span",{children:s.label})]},s.label)),_&&e.jsx("button",{type:"button",className:"s-doc-focus-viewer-close",onClick:()=>m(s=>!s),"aria-label":i?"Exit focus mode":"Enter focus mode",title:i?"Exit focus mode":"Focus",children:i?e.jsx(C,{"aria-hidden":"true",size:14,strokeWidth:1.8}):e.jsx(T,{"aria-hidden":"true",size:14,strokeWidth:1.8})}),o&&e.jsx("button",{type:"button",className:"s-doc-focus-viewer-close",onClick:o,"aria-label":"Close document viewer",title:"Close",children:e.jsx(R,{"aria-hidden":"true",size:14,strokeWidth:1.8})})]})]}),p&&!c&&!t&&!d&&e.jsx("div",{className:"s-doc-focus-viewer-state",children:p}),c&&e.jsx("div",{className:"s-doc-focus-viewer-state s-doc-focus-viewer-error",children:c}),!c&&d&&e.jsx("div",{className:"s-doc-focus-viewer-body",children:d}),!c&&!d&&t&&e.jsx(H,{document:t,mode:D,showHeader:!1,className:"s-doc-focus-document"}),!c&&j&&e.jsx("div",{className:"s-doc-focus-viewer-notice",children:j})]})]})}export{P as D,J as F,C as M,G as a,T as b};
@@ -1 +1 @@
1
- import{r as l,j as e}from"./index-CzVeWScw.js";import{l as c}from"./discover-7Ks00w-M.js";import"./types-B0PlfpKc.js";function n(){const[r,a]=l.useState([]);return l.useEffect(()=>{let s=!1;return c().then(d=>{s||a(d)}),()=>{s=!0}},[]),e.jsxs("div",{className:"s-embeddable-surfaces-lab","data-scout-theme":!0,children:[e.jsxs("header",{className:"s-embeddable-surfaces-lab__header",children:[e.jsx("h1",{children:"Embeddable surfaces"}),e.jsxs("p",{children:["Screens that exported ",e.jsx("code",{children:"scoutSurface.embed"})," and were discovered from"," ",e.jsx("code",{children:"client/screens/**"}),". No separate embed registry file — parity comes from the screen declaration."]})]}),e.jsxs("table",{className:"s-embeddable-surfaces-lab__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"ID"}),e.jsx("th",{children:"Label"}),e.jsx("th",{children:"Web"}),e.jsx("th",{children:"Embed"}),e.jsx("th",{children:"Profile"}),e.jsx("th",{children:"Module"})]})}),e.jsx("tbody",{children:r.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{children:s.id})}),e.jsx("td",{children:s.label}),e.jsx("td",{children:e.jsx("a",{href:s.webPath,children:s.webPath})}),e.jsxs("td",{children:[e.jsx("div",{children:e.jsx("a",{href:s.embedPath,children:s.embedPath})}),s.embedAliases.length>0&&e.jsx("div",{className:"s-embeddable-surfaces-lab__aliases",children:s.embedAliases.map(d=>e.jsx("a",{href:d,children:d},d))})]}),e.jsx("td",{children:e.jsx("code",{children:s.profile})}),e.jsx("td",{children:e.jsx("code",{children:s.modulePath.replace("../","")})})]},s.id))})]}),r.length===0&&e.jsx("p",{className:"s-embeddable-surfaces-lab__empty",children:"No embeddable screens discovered yet."})]})}export{n as EmbeddableSurfacesLab};
1
+ import{r as l,j as e}from"./index-o4FKpU7Z.js";import{l as c}from"./discover-NDAqNvKt.js";import"./types-B0PlfpKc.js";function n(){const[r,a]=l.useState([]);return l.useEffect(()=>{let s=!1;return c().then(d=>{s||a(d)}),()=>{s=!0}},[]),e.jsxs("div",{className:"s-embeddable-surfaces-lab","data-scout-theme":!0,children:[e.jsxs("header",{className:"s-embeddable-surfaces-lab__header",children:[e.jsx("h1",{children:"Embeddable surfaces"}),e.jsxs("p",{children:["Screens that exported ",e.jsx("code",{children:"scoutSurface.embed"})," and were discovered from"," ",e.jsx("code",{children:"client/screens/**"}),". No separate embed registry file — parity comes from the screen declaration."]})]}),e.jsxs("table",{className:"s-embeddable-surfaces-lab__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"ID"}),e.jsx("th",{children:"Label"}),e.jsx("th",{children:"Web"}),e.jsx("th",{children:"Embed"}),e.jsx("th",{children:"Profile"}),e.jsx("th",{children:"Module"})]})}),e.jsx("tbody",{children:r.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{children:s.id})}),e.jsx("td",{children:s.label}),e.jsx("td",{children:e.jsx("a",{href:s.webPath,children:s.webPath})}),e.jsxs("td",{children:[e.jsx("div",{children:e.jsx("a",{href:s.embedPath,children:s.embedPath})}),s.embedAliases.length>0&&e.jsx("div",{className:"s-embeddable-surfaces-lab__aliases",children:s.embedAliases.map(d=>e.jsx("a",{href:d,children:d},d))})]}),e.jsx("td",{children:e.jsx("code",{children:s.profile})}),e.jsx("td",{children:e.jsx("code",{children:s.modulePath.replace("../","")})})]},s.id))})]}),r.length===0&&e.jsx("p",{className:"s-embeddable-surfaces-lab__empty",children:"No embeddable screens discovered yet."})]})}export{n as EmbeddableSurfacesLab};
@@ -1 +1 @@
1
- import{j as e}from"./index-CzVeWScw.js";function c({title:n,body:s,icon:i,action:t,className:a}){const l=a?`sys-panel sys-state-card ${a}`:"sys-panel sys-state-card";return e.jsxs("div",{className:l,children:[i,e.jsx("h3",{className:"sys-state-title",children:n}),s!=null&&(typeof s=="string"?e.jsx("p",{className:"sys-state-body",children:s}):s),t&&e.jsx("div",{className:"sys-inline-actions",children:t})]})}export{c as E};
1
+ import{j as e}from"./index-o4FKpU7Z.js";function c({title:n,body:s,icon:i,action:t,className:a}){const l=a?`sys-panel sys-state-card ${a}`:"sys-panel sys-state-card";return e.jsxs("div",{className:l,children:[i,e.jsx("h3",{className:"sys-state-title",children:n}),s!=null&&(typeof s=="string"?e.jsx("p",{className:"sys-state-body",children:s}):s),t&&e.jsx("div",{className:"sys-inline-actions",children:t})]})}export{c as E};
@@ -1,3 +1,3 @@
1
- import{r as n,j as t}from"./index-CzVeWScw.js";import{T as b,c as j}from"./TextDocumentSurface-DRjctOIt.js";import{a as N}from"./api-h5zurxmi.js";function V(e,a,u){const o=e.relativePath.endsWith(".md")||e.relativePath.endsWith(".mdx"),s=e.relativePath.endsWith(".json");return j({id:e.absolutePath,title:e.relativePath,uri:e.absolutePath,filename:e.relativePath.split("/").pop(),kind:o?"markdown":"code",language:s?"json":o?"markdown":"plain",value:u?`${a}
1
+ import{r as n,j as t}from"./index-o4FKpU7Z.js";import{T as b,c as j}from"./TextDocumentSurface-Bc-kHPgG.js";import{a as N}from"./api-h5zurxmi.js";function V(e,a,u){const o=e.relativePath.endsWith(".md")||e.relativePath.endsWith(".mdx"),s=e.relativePath.endsWith(".json");return j({id:e.absolutePath,title:e.relativePath,uri:e.absolutePath,filename:e.relativePath.split("/").pop(),kind:o?"markdown":"code",language:s?"json":o?"markdown":"plain",value:u?`${a}
2
2
 
3
3
  — excerpt —`:a,readOnly:!0})}function y({artifact:e,onOpen:a,onReveal:u,onBrowse:o}){const[s,l]=n.useState(e.excerpt),[c,i]=n.useState(!0),[w,h]=n.useState(!1),[m,p]=n.useState(null);n.useEffect(()=>{l(e.excerpt),i(!0),p(null);let d=!1;return h(!0),N(`/api/file/preview?path=${encodeURIComponent(e.absolutePath)}`).then(r=>{if(!d)if(r.kind==="file"&&r.previewable){const x=r;l(x.content),i(x.truncated)}else e.excerpt?(l(e.excerpt),i(!0)):(l(null),p("Preview not available for this file type."))}).catch(r=>{d||(e.excerpt?(l(e.excerpt),i(!0)):p(r instanceof Error?r.message:"Could not load file."))}).finally(()=>{d||h(!1)}),()=>{d=!0}},[e.absolutePath,e.excerpt]);const v=n.useMemo(()=>s?V(e,s,c):null,[e,s,c]),P=e.relativePath.endsWith(".md")||e.relativePath.endsWith(".mdx");return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"av2-repoViewerHead",children:[t.jsxs("div",{className:"av2-repoViewerPath",children:[t.jsx("span",{className:"av2-repoViewerPathFile",children:e.relativePath}),t.jsx("span",{className:"av2-repoViewerPathAbs",title:e.absolutePath,children:e.absolutePath})]}),t.jsxs("div",{className:"av2-repoViewerActs",children:[t.jsx("button",{type:"button",className:"av2-repoViewerAct","data-primary":!0,onClick:()=>a(e.absolutePath),children:"open"}),o?t.jsx("button",{type:"button",className:"av2-repoViewerAct",onClick:()=>o(e.absolutePath),children:"browse"}):null,t.jsx("button",{type:"button",className:"av2-repoViewerAct",onClick:()=>{u(e.absolutePath)},children:"reveal"})]})]}),t.jsxs("div",{className:"av2-repoViewerBody",children:[w&&!s?t.jsx("div",{className:"av2-repoViewerState",children:"Loading file…"}):m&&!s?t.jsx("div",{className:"av2-repoViewerState av2-repoViewerState--error",children:m}):v?t.jsx(b,{document:v,mode:P?"preview":"read",className:"av2-repoViewerDoc"}):t.jsx("div",{className:"av2-repoViewerState",children:"No content."}),c?t.jsx("div",{className:"av2-repoViewerNotice",children:"Showing excerpt — use open for the full file."}):null]})]})}export{y as FileViewerPane};
@@ -1 +1 @@
1
- import{j as s}from"./index-CzVeWScw.js";function f({value:e,onChange:a,placeholder:t="Search…",onKeyDown:r}){return s.jsx("input",{type:"search",className:"fleet-search",placeholder:t,value:e,onChange:o=>a(o.target.value),onKeyDown:r,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off"})}export{f as F};
1
+ import{j as s}from"./index-o4FKpU7Z.js";function f({value:e,onChange:a,placeholder:t="Search…",onKeyDown:r}){return s.jsx("input",{type:"search",className:"fleet-search",placeholder:t,value:e,onChange:o=>a(o.target.value),onKeyDown:r,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off"})}export{f as F};
@@ -0,0 +1 @@
1
+ import{r as c,j as s}from"./index-o4FKpU7Z.js";import{a as k}from"./api-h5zurxmi.js";import{u as R}from"./sse-CL6gctHY.js";import{d as $,t as F}from"./time-Dhsh_2EG.js";import{SessionRefScreen as j}from"./SessionRefScreen-DLZNFZFK.js";/* empty css */import{c as E}from"./createLucideIcon-Bt67PWH-.js";import{X as A}from"./x-ynOfVadO.js";import"./index-BWHgHrtv.js";import"./tail-events-NLIWLq27.js";import"./BackToPicker-BXp5E2ck.js";import"./router-C65cZYPn.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-AmSgHklm.js";import"./ConversationScreen-oZSitVtX.js";import"./NewChatComposer-S08F6_La.js";import"./runtime-picker-eDEvx2Mz.js";import"./scout-voice-B7kXlkcl.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-4LDsy4Ke.js";import"./MessageComposerSuggestions-Dfc3PH2y.js";import"./index-BMwKgdz_.js";import"./HarnessMark-MztYnrGK.js";import"./conversation-model-CHwHZNw-.js";import"./colors-BtO5_zlx.js";import"./NewChatOrigin-BEz6jyqf.js";import"./keyboard-nav-Chf51dns.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-NAhBUkFd.js";import"./search-7_n7CxWl.js";import"./file-text-iF0hyVyU.js";import"./ConversationComposer-CWohCCmn.js";import"./Provider-DKZWuzSR.js";import"./provider-BvAxRQfE.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-CxkmFQcN.js";import"./DocumentFocusViewer-DRKjNG9s.js";import"./TextDocumentSurface-Bc-kHPgG.js";/* empty css */import"./chevron-right-C10o7t_X.js";import"./code-xml-CLn3TDWF.js";import"./arrow-left-BOht-YQu.js";import"./chunk-HRAB3GC3-DF8R9rPv.js";import"./message-markup-BcY1lShv.js";import"./mentions-CvDaviLJ.js";import"./AgentDetailCard-Biq8b2gv.js";import"./AgentLiveActions-0iy8QZ1T.js";import"./terminal-takeover-7AvNpnkC.js";import"./openContent-C6XO6kr5.js";import"./eye-B3lBIwJZ.js";import"./terminal-By1Lw2i2.js";import"./message-visibility-kJM8XcSG.js";import"./sessionRead-CvFz2RHv.js";import"./clipboard-e3fSpeo7.js";import"./AgentAvatar-DMov24_o.js";import"./SpriteAvatar-DQ3PTb8L.js";import"./agent-identity-BxCsXnDp.js";import"./types-B0PlfpKc.js";/* empty css */import"./ConversationHeader-BxTzXl8e.js";import"./ConversationFeedRows-IWh0JSIL.js";import"./ConversationPanels-D9UCwNkS.js";import"./use-reduced-motion-CqXpVXv-.js";import"./activity-BvGruxWG.js";import"./message-circle-BM3XgevU.js";import"./tail-display-BRcJltQa.js";import"./lane-edit-display-C_Aujldz.js";import"./ConversationStatus-B6pAbo2w.js";import"./SessionObserve-DaUrJCMq.js";import"./bash-format-BRV5C6Gv.js";import"./lane-tool-detail-0WhMf4Vj.js";import"./LaneToolHoverCard-CcEiQC6B.js";import"./lane-observe-BA3g9aVd.js";import"./lane-ask-display-B6iCAVcd.js";import"./ObservedTopologyPanel-ByW7Ar7p.js";import"./ObserveTextFlow-_ApDwRCO.js";import"./SessionObserveEvidence-ClUW8jpV.js";import"./wrench-M4G7WtYB.js";import"./external-link-Dem738OJ.js";/* empty css */const T=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],L=E("columns-2",T);function S(t){const o=new Map;for(const r of t)o.delete(r.sessionId),o.set(r.sessionId,r);return[...o.values()]}function M(t,o){const r=S(t),p=o?.trim()||null;return r.find(n=>n.sessionId===p)?.sessionId??r.at(-1)?.sessionId??p}function O(t){return t.length<=34?t:`${t.slice(0,15)}…${t.slice(-14)}`}function q(t,o){return o===0?t.strategy||"dispatch":t.strategy?`switched via ${t.strategy}`:"session changed"}function y({label:t,sessions:o,value:r,onChange:p}){return s.jsxs("label",{className:"s-flight-observe-select-wrap",children:[s.jsx("span",{children:t}),s.jsx("select",{className:"s-flight-observe-select",value:r,onChange:n=>p(n.currentTarget.value),children:o.map(n=>s.jsxs("option",{value:n.sessionId,children:[n.harness?`${n.harness} · `:"",n.sessionId]},n.sessionId))})]})}function he({route:t,navigate:o}){const[r,p]=c.useState(null),[n,I]=c.useState(!0),[h,N]=c.useState(null),u=c.useCallback(async()=>{try{const e=await k(`/api/flights?active=false&flightId=${encodeURIComponent(t.flightId)}`);p(e[0]??null),N(e.length===0?"This flight is not available on the connected broker.":null)}catch(e){N(e instanceof Error?e.message:String(e))}finally{I(!1)}},[t.flightId]);c.useEffect(()=>{I(!0),u()},[u]),R(()=>{u()});const v=r?.sessions??[],a=c.useMemo(()=>S(v),[v]),g=M(v,t.sessionId),i=a.find(e=>e.sessionId===g)??null,l=a.find(e=>e.sessionId===t.compareSessionId)??null,f=!!(i&&l&&i.sessionId!==l.sessionId),m=c.useCallback((e,d)=>{o({...t,sessionId:e,...d?{compareSessionId:d}:{compareSessionId:void 0}})},[o,t]),w=c.useCallback(()=>{if(!i||a.length<2)return;const e=[...a].reverse().find(d=>d.sessionId!==i.sessionId);e&&m(i.sessionId,e.sessionId)},[i,a,m]),C=c.useCallback(e=>{if(!f||!i||!l){m(e);return}m(e,e===l.sessionId?i.sessionId:l.sessionId)},[l,i,f,m]);return s.jsxs("div",{className:"s-flight-observe",children:[s.jsxs("header",{className:"s-flight-observe-header",children:[s.jsxs("div",{className:"s-flight-observe-heading",children:[s.jsx("div",{className:"s-flight-observe-eyebrow",children:"Flight observe"}),s.jsxs("div",{className:"s-flight-observe-title-row",children:[s.jsx("h2",{children:r?.agentName||r?.agentId||"Flight"}),s.jsx("span",{className:`s-flight-observe-state s-flight-observe-state--${r?.state??"loading"}`,children:r?.state??(n?"loading":"unknown")})]}),s.jsx("div",{className:"s-flight-observe-id",title:t.flightId,children:t.flightId}),r?.summary&&s.jsx("p",{children:r.summary})]}),s.jsxs("div",{className:"s-flight-observe-actions",children:[a.length>1&&!f&&s.jsxs("button",{type:"button",onClick:w,children:[s.jsx(L,{size:13})," Split view"]}),f&&i&&s.jsxs("button",{type:"button",onClick:()=>m(i.sessionId),children:[s.jsx(A,{size:13})," Close split"]})]})]}),v.length>0&&s.jsx("nav",{className:"s-flight-observe-trace","aria-label":"Flight session history",children:v.map((e,d)=>{const b=i?.sessionId===e.sessionId,x=l?.sessionId===e.sessionId;return s.jsxs("div",{className:"s-flight-observe-trace-step",children:[d>0&&s.jsx("span",{className:"s-flight-observe-trace-arrow","aria-hidden":"true",children:"→"}),s.jsxs("button",{type:"button",className:"s-flight-observe-session-chip","data-selected":b||x,"data-observe-role":b?"primary":x?"compare":"idle","aria-pressed":b||x,title:e.sessionId,onClick:()=>C(e.sessionId),children:[s.jsxs("span",{className:"s-flight-observe-session-chip-top",children:[s.jsx("span",{children:e.harness||e.transport||"session"}),s.jsx("time",{title:new Date(e.startedAt).toLocaleString(),children:$(e.startedAt)||F(e.startedAt)})]}),s.jsx("strong",{children:O(e.sessionId)}),s.jsx("small",{children:q(e,d)})]})]},`${e.sessionId}:${e.startedAt}:${d}`)})}),h&&!g&&s.jsx("div",{className:"s-flight-observe-message s-flight-observe-message--error",children:h}),h&&g&&s.jsxs("div",{className:"s-flight-observe-message",children:[s.jsx("strong",{children:"Flight record unavailable"}),s.jsx("span",{children:"Showing the concrete session captured by this link."})]}),!h&&n&&s.jsx("div",{className:"s-flight-observe-message",children:"Resolving the flight’s session trace…"}),!h&&!n&&a.length===0&&!g&&s.jsxs("div",{className:"s-flight-observe-message",children:[s.jsx("strong",{children:"Waiting for a session"}),s.jsx("span",{children:"The flight is stable here; its trace will appear as soon as a harness acknowledges dispatch."})]}),g&&!f&&s.jsx("main",{className:"s-flight-observe-single",children:s.jsx(j,{sessionRef:g,navigate:o})}),!h&&i&&l&&f&&s.jsxs("main",{className:"s-flight-observe-split",children:[s.jsxs("section",{className:"s-flight-observe-pane",children:[s.jsx(y,{label:"Primary session",sessions:a,value:i.sessionId,onChange:e=>m(e,e===l.sessionId?i.sessionId:l.sessionId)}),s.jsx("div",{className:"s-flight-observe-pane-content",children:s.jsx(j,{sessionRef:i.sessionId,navigate:o,showObserveRail:!1})})]}),s.jsxs("section",{className:"s-flight-observe-pane",children:[s.jsx(y,{label:"Compare session",sessions:a.filter(e=>e.sessionId!==i.sessionId),value:l.sessionId,onChange:e=>m(i.sessionId,e)}),s.jsx("div",{className:"s-flight-observe-pane-content",children:s.jsx(j,{sessionRef:l.sessionId,navigate:o,showObserveRail:!1})})]})]})]})}export{he as FlightObserveScreen};
@@ -1 +1 @@
1
- import{r as o,j as r}from"./index-CzVeWScw.js";import{a as h}from"./api-h5zurxmi.js";import{t as p,r as c,m as g}from"./follow-route-BvcGtBIL.js";import{s as l}from"./router-B-K15T7B.js";/* empty css */import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-C3qU8tnY.js";function N({route:e,navigate:t}){const[d,m]=o.useState(null),i=o.useMemo(()=>p(e),[e]);return o.useEffect(()=>{let n=!1;const s=new URLSearchParams;return 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),(async()=>{try{const a=s.toString(),f=a?await h(`/api/follow?${a}`):i;if(n)return;t(l(c(g(f,i),e.preferredView),e.machineId??null))}catch(a){if(n)return;m(a instanceof Error?a.message:String(a)),t(l(c(i,e.preferredView),e.machineId??null))}})(),()=>{n=!0}},[i,t,e]),r.jsx("div",{className:"s-sessions-screen s-inbox-thread-redesign",children:r.jsx("section",{className:"s-thread-overview",children:r.jsxs("div",{className:"s-thread-overview-copy",children:[r.jsxs("div",{className:"s-sessions-header s-thread-overview-heading",children:[r.jsx("h2",{className:"s-page-title",children:"Follow"}),r.jsx("span",{className:"s-meta s-tabular",children:e.preferredView??"auto"})]}),r.jsx("p",{className:"s-thread-overview-summary",children:d?"Opening the closest available Scout view.":"Resolving Scout context..."})]})})})}export{N as FollowScreen};
1
+ import{r as o,j as r}from"./index-o4FKpU7Z.js";import{a as h}from"./api-h5zurxmi.js";import{t as p,r as c,m as g}from"./follow-route-BvcGtBIL.js";import{s as l}from"./router-C65cZYPn.js";/* empty css */import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-AmSgHklm.js";function N({route:e,navigate:t}){const[d,m]=o.useState(null),i=o.useMemo(()=>p(e),[e]);return o.useEffect(()=>{let n=!1;const s=new URLSearchParams;return 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),(async()=>{try{const a=s.toString(),f=a?await h(`/api/follow?${a}`):i;if(n)return;t(l(c(g(f,i),e.preferredView),e.machineId??null))}catch(a){if(n)return;m(a instanceof Error?a.message:String(a)),t(l(c(i,e.preferredView),e.machineId??null))}})(),()=>{n=!0}},[i,t,e]),r.jsx("div",{className:"s-sessions-screen s-inbox-thread-redesign",children:r.jsx("section",{className:"s-thread-overview",children:r.jsxs("div",{className:"s-thread-overview-copy",children:[r.jsxs("div",{className:"s-sessions-header s-thread-overview-heading",children:[r.jsx("h2",{className:"s-page-title",children:"Follow"}),r.jsx("span",{className:"s-meta s-tabular",children:e.preferredView??"auto"})]}),r.jsx("p",{className:"s-thread-overview-summary",children:d?"Opening the closest available Scout view.":"Resolving Scout context..."})]})})})}export{N as FollowScreen};
@@ -1 +1 @@
1
- import{j as e}from"./index-CzVeWScw.js";function p(o){const i=o?.trim().toLowerCase();if(!i)return"unknown";const n=i.replace(/[\s(].*$/,"").replace(/[_-].*$/,""),l={anthropic:"claude",claude:"claude",claudecode:"claude",sonnet:"claude",opus:"claude",openai:"codex",codex:"codex",gpt:"codex",chatgpt:"codex",oai:"codex",xai:"grok",grok:"grok",kimi:"kimi",moonshot:"kimi",google:"gemini",gemini:"gemini",vertex:"gemini",cursor:"cursor",github:"github",opencode:"opencode",oc:"opencode",amp:"amp",sourcegraph:"amp",pi:"pi",inflection:"pi",omp:"pi","oh-my-pi":"pi",claw:"claw",native:"native",worker:"worker",quad:"quad"};return l[n]??l[i.replace(/[\s(].*$/,"")]??i}const m={claude:"Claude",codex:"Codex",grok:"Grok",kimi:"Kimi",gemini:"Gemini",cursor:"Cursor",github:"GitHub",opencode:"OpenCode",amp:"Amp",pi:"Pi",claw:"Claw",native:"Native",worker:"Worker",quad:"Quad"};function g(o){const i=p(o);return m[i]??(o?.trim()||"Unknown")}const c={fill:{fill:"currentColor"},line:{fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}},t={claude:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",gemini:"M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81",cursor:"M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23",github:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12",opencode:"M22 24H2V0h20zM17 4.8H7v14.4h10z"},r=o=>e.jsx("path",{d:o,fill:"currentColor"}),k={amp:{viewBox:"0.6 1.4 8.8 8.8",paths:["M2.37694 9.23487L4.34679 7.23716L5.06365 9.95891L6.10505 9.67408L5.06749 5.72214L1.17831 4.6688L0.901367 5.73289L3.5775 6.45984L1.61584 8.45465L2.37694 9.23487Z","M8.05742 6.91898L9.09885 6.63416L8.0613 2.68224L4.17209 1.62891L3.89515 2.693L7.17936 3.58514L8.05742 6.91898Z","M6.56226 8.43797L7.60365 8.15314L6.5661 4.20121L2.67692 3.14787L2.39998 4.21196L5.68416 5.10411L6.56226 8.43797Z"]},grok:{viewBox:"0 0 34 33",paths:["M13.2371 21.0407L24.3186 12.8506C24.8619 12.4491 25.6384 12.6057 25.8973 13.2294C27.2597 16.5185 26.651 20.4712 23.9403 23.1851C21.2297 25.8989 17.4581 26.4941 14.0108 25.1386L10.2449 26.8843C15.6463 30.5806 22.2053 29.6665 26.304 25.5601C29.5551 22.3051 30.562 17.8683 29.6205 13.8673L29.629 13.8758C28.2637 7.99809 29.9647 5.64871 33.449 0.844576C33.5314 0.730667 33.6139 0.616757 33.6964 0.5L29.1113 5.09055V5.07631L13.2343 21.0436","M10.9503 23.0313C7.07343 19.3235 7.74185 13.5853 11.0498 10.2763C13.4959 7.82722 17.5036 6.82767 21.0021 8.2971L24.7595 6.55998C24.0826 6.07017 23.215 5.54334 22.2195 5.17313C17.7198 3.31926 12.3326 4.24192 8.67479 7.90126C5.15635 11.4239 4.0499 16.8403 5.94992 21.4622C7.36924 24.9165 5.04257 27.3598 2.69884 29.826C1.86829 30.7002 1.0349 31.5745 0.36364 32.5L10.9474 23.0341"]}},C=e.jsx("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"}),j=e.jsxs("g",{fill:"currentColor",children:[e.jsx("path",{d:"M4.5 3h3.4v7.4L14.7 3h4.5l-7.9 8.5L19.8 21h-4.6l-7.3-8.2V21H4.5Z"}),e.jsx("circle",{cx:"20.2",cy:"3.8",r:"1.8"})]}),v=e.jsxs("g",{...c.line,strokeWidth:2,children:[e.jsx("path",{d:"M6.5 8.5h11"}),e.jsx("path",{d:"M10 8.5 9 17M14.2 8.5 15.2 17"})]}),w=e.jsxs("g",{...c.line,children:[e.jsx("path",{d:"M6.5 8 11 12l-4.5 4"}),e.jsx("path",{d:"M12.5 16.5H18",strokeWidth:1.8})]}),M=e.jsxs("g",{...c.line,strokeWidth:1.8,children:[e.jsx("path",{d:"M12 4.5 18.5 8.2v7.6L12 19.5 5.5 15.8V8.2L12 4.5Z"}),e.jsx("circle",{cx:12,cy:12,r:2.7})]}),y=e.jsxs("g",{...c.fill,children:[e.jsx("rect",{x:5.5,y:5.5,width:5.4,height:5.4,rx:1.3}),e.jsx("rect",{x:13.1,y:5.5,width:5.4,height:5.4,rx:1.3}),e.jsx("rect",{x:5.5,y:13.1,width:5.4,height:5.4,rx:1.3}),e.jsx("rect",{x:13.1,y:13.1,width:5.4,height:5.4,rx:1.3})]}),f=e.jsxs("g",{...c.line,strokeWidth:2,children:[e.jsx("path",{d:"M7.5 6Q9.5 12 8.5 18"}),e.jsx("path",{d:"M12 5.5Q14 12 13 18.5"}),e.jsx("path",{d:"M16.5 6Q18.5 12 17.5 18"})]}),b={claude:r(t.claude),codex:C,kimi:j,gemini:r(t.gemini),cursor:r(t.cursor),github:r(t.github),opencode:r(t.opencode),pi:v,native:w,worker:M,quad:y,claw:f};function G({harness:o,size:i=14,className:n,style:l,title:d}){const a=p(o),s=k[a],x=b[a],h=d===null?void 0:d??g(o);return e.jsx("span",{className:n,style:l,title:h,"aria-hidden":h?void 0:!0,children:e.jsx("svg",{viewBox:s?.viewBox??"0 0 24 24",width:i,height:i,style:{display:"block"},role:"img","aria-label":h,children:s?s.paths.map((u,L)=>e.jsx("path",{d:u,fill:"currentColor"},L)):x??e.jsx("text",{x:"12",y:"12",textAnchor:"middle",dominantBaseline:"central",fontSize:"13",fontWeight:"600",fontFamily:"var(--font-mono)",fill:"currentColor",children:(a[0]??"?").toUpperCase()})})})}export{G as H,g as h};
1
+ import{j as e}from"./index-o4FKpU7Z.js";function p(o){const i=o?.trim().toLowerCase();if(!i)return"unknown";const n=i.replace(/[\s(].*$/,"").replace(/[_-].*$/,""),l={anthropic:"claude",claude:"claude",claudecode:"claude",sonnet:"claude",opus:"claude",openai:"codex",codex:"codex",gpt:"codex",chatgpt:"codex",oai:"codex",xai:"grok",grok:"grok",kimi:"kimi",moonshot:"kimi",google:"gemini",gemini:"gemini",vertex:"gemini",cursor:"cursor",github:"github",opencode:"opencode",oc:"opencode",amp:"amp",sourcegraph:"amp",pi:"pi",inflection:"pi",omp:"pi","oh-my-pi":"pi",claw:"claw",native:"native",worker:"worker",quad:"quad"};return l[n]??l[i.replace(/[\s(].*$/,"")]??i}const m={claude:"Claude",codex:"Codex",grok:"Grok",kimi:"Kimi",gemini:"Gemini",cursor:"Cursor",github:"GitHub",opencode:"OpenCode",amp:"Amp",pi:"Pi",claw:"Claw",native:"Native",worker:"Worker",quad:"Quad"};function g(o){const i=p(o);return m[i]??(o?.trim()||"Unknown")}const c={fill:{fill:"currentColor"},line:{fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}},t={claude:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",gemini:"M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81",cursor:"M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23",github:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12",opencode:"M22 24H2V0h20zM17 4.8H7v14.4h10z"},r=o=>e.jsx("path",{d:o,fill:"currentColor"}),k={amp:{viewBox:"0.6 1.4 8.8 8.8",paths:["M2.37694 9.23487L4.34679 7.23716L5.06365 9.95891L6.10505 9.67408L5.06749 5.72214L1.17831 4.6688L0.901367 5.73289L3.5775 6.45984L1.61584 8.45465L2.37694 9.23487Z","M8.05742 6.91898L9.09885 6.63416L8.0613 2.68224L4.17209 1.62891L3.89515 2.693L7.17936 3.58514L8.05742 6.91898Z","M6.56226 8.43797L7.60365 8.15314L6.5661 4.20121L2.67692 3.14787L2.39998 4.21196L5.68416 5.10411L6.56226 8.43797Z"]},grok:{viewBox:"0 0 34 33",paths:["M13.2371 21.0407L24.3186 12.8506C24.8619 12.4491 25.6384 12.6057 25.8973 13.2294C27.2597 16.5185 26.651 20.4712 23.9403 23.1851C21.2297 25.8989 17.4581 26.4941 14.0108 25.1386L10.2449 26.8843C15.6463 30.5806 22.2053 29.6665 26.304 25.5601C29.5551 22.3051 30.562 17.8683 29.6205 13.8673L29.629 13.8758C28.2637 7.99809 29.9647 5.64871 33.449 0.844576C33.5314 0.730667 33.6139 0.616757 33.6964 0.5L29.1113 5.09055V5.07631L13.2343 21.0436","M10.9503 23.0313C7.07343 19.3235 7.74185 13.5853 11.0498 10.2763C13.4959 7.82722 17.5036 6.82767 21.0021 8.2971L24.7595 6.55998C24.0826 6.07017 23.215 5.54334 22.2195 5.17313C17.7198 3.31926 12.3326 4.24192 8.67479 7.90126C5.15635 11.4239 4.0499 16.8403 5.94992 21.4622C7.36924 24.9165 5.04257 27.3598 2.69884 29.826C1.86829 30.7002 1.0349 31.5745 0.36364 32.5L10.9474 23.0341"]}},C=e.jsx("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"}),j=e.jsxs("g",{fill:"currentColor",children:[e.jsx("path",{d:"M4.5 3h3.4v7.4L14.7 3h4.5l-7.9 8.5L19.8 21h-4.6l-7.3-8.2V21H4.5Z"}),e.jsx("circle",{cx:"20.2",cy:"3.8",r:"1.8"})]}),v=e.jsxs("g",{...c.line,strokeWidth:2,children:[e.jsx("path",{d:"M6.5 8.5h11"}),e.jsx("path",{d:"M10 8.5 9 17M14.2 8.5 15.2 17"})]}),w=e.jsxs("g",{...c.line,children:[e.jsx("path",{d:"M6.5 8 11 12l-4.5 4"}),e.jsx("path",{d:"M12.5 16.5H18",strokeWidth:1.8})]}),M=e.jsxs("g",{...c.line,strokeWidth:1.8,children:[e.jsx("path",{d:"M12 4.5 18.5 8.2v7.6L12 19.5 5.5 15.8V8.2L12 4.5Z"}),e.jsx("circle",{cx:12,cy:12,r:2.7})]}),y=e.jsxs("g",{...c.fill,children:[e.jsx("rect",{x:5.5,y:5.5,width:5.4,height:5.4,rx:1.3}),e.jsx("rect",{x:13.1,y:5.5,width:5.4,height:5.4,rx:1.3}),e.jsx("rect",{x:5.5,y:13.1,width:5.4,height:5.4,rx:1.3}),e.jsx("rect",{x:13.1,y:13.1,width:5.4,height:5.4,rx:1.3})]}),f=e.jsxs("g",{...c.line,strokeWidth:2,children:[e.jsx("path",{d:"M7.5 6Q9.5 12 8.5 18"}),e.jsx("path",{d:"M12 5.5Q14 12 13 18.5"}),e.jsx("path",{d:"M16.5 6Q18.5 12 17.5 18"})]}),b={claude:r(t.claude),codex:C,kimi:j,gemini:r(t.gemini),cursor:r(t.cursor),github:r(t.github),opencode:r(t.opencode),pi:v,native:w,worker:M,quad:y,claw:f};function G({harness:o,size:i=14,className:n,style:l,title:d}){const a=p(o),s=k[a],x=b[a],h=d===null?void 0:d??g(o);return e.jsx("span",{className:n,style:l,title:h,"aria-hidden":h?void 0:!0,children:e.jsx("svg",{viewBox:s?.viewBox??"0 0 24 24",width:i,height:i,style:{display:"block"},role:"img","aria-label":h,children:s?s.paths.map((u,L)=>e.jsx("path",{d:u,fill:"currentColor"},L)):x??e.jsx("text",{x:"12",y:"12",textAnchor:"middle",dominantBaseline:"central",fontSize:"13",fontWeight:"600",fontFamily:"var(--font-mono)",fill:"currentColor",children:(a[0]??"?").toUpperCase()})})})}export{G as H,g as h};
@@ -0,0 +1 @@
1
+ import{r as u,j as e}from"./index-o4FKpU7Z.js";import{H as R,h as q}from"./HarnessMark-MztYnrGK.js";import{a as M}from"./api-h5zurxmi.js";import{d as D}from"./router-C65cZYPn.js";import{t as O,n as S,f as L}from"./time-Dhsh_2EG.js";import{u as P}from"./Provider-DKZWuzSR.js";import{u as T}from"./useContentSecondaryNav-DOr5yHbT.js";import{OpsSubnav as E}from"./OpsSubnav-CZs_OL2N.js";/* empty css */import{R as U}from"./refresh-cw-B5To7b6B.js";import{E as $}from"./external-link-Dem738OJ.js";import{c as H}from"./createLucideIcon-Bt67PWH-.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-AmSgHklm.js";import"./provider-BvAxRQfE.js";import"./sse-CL6gctHY.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-CxkmFQcN.js";import"./DocumentFocusViewer-DRKjNG9s.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"./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";import"./SecondaryNav-Dj30epYF.js";import"./secondaryNavConfig-CSFDCQAf.js";import"./message-square-ER1_q2pe.js";import"./terminal-By1Lw2i2.js";import"./scroll-text-BuneRiAD.js";/* empty css */const _=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],z=H("clipboard-paste",_),B={codex:"Codex",claude:"Claude",kimi:"Kimi",minimax:"MiniMax",cursor:"Cursor",native:"Native",worker:"Worker",bridge:"Bridge",http:"HTTP",pi:"Pi",flue:"Flue",github:"GitHub",unknown:"Unknown"},C=[{id:"claude",description:"Anthropic plan windows captured from Claude Code.",links:[{label:"Usage",href:"https://claude.ai/settings/usage"},{label:"Manage plan",href:"https://claude.ai/settings/billing"}]},{id:"codex",description:"OpenAI plan windows reported by local Codex sessions.",links:[{label:"Usage",href:"https://chatgpt.com/codex/settings/usage"},{label:"Open Codex",href:"https://chatgpt.com/codex"}]},{id:"kimi",description:"Kimi Code subscription windows and membership level.",links:[{label:"Kimi Code",href:"https://www.kimi.com/code"},{label:"Docs",href:"https://www.kimi.com/code/docs/en/"}]},{id:"grok",description:"SuperGrok quota reported by local Grok, with dashboard capture and local activity as fallbacks.",links:[{label:"Open Grok",href:"https://grok.com/"},{label:"Billing",href:"https://grok.com/?_s=billing"},{label:"Help",href:"https://docs.x.ai/grok/faq"}]},{id:"minimax",description:"MiniMax Token Plan 5-hour and weekly allowance.",links:[{label:"Usage",href:"https://platform.minimax.io/console/plan"},{label:"Docs",href:"https://platform.minimax.io/docs/token-plan/intro"}]},{id:"cursor",description:"Cursor membership detected locally, plus usage totals from an exported dashboard capture.",links:[{label:"Usage",href:"https://cursor.com/dashboard/usage"},{label:"Manage plan",href:"https://cursor.com/dashboard/billing"}]}],G={cloudflare:[{label:"Dashboard",href:"https://dash.cloudflare.com/"},{label:"Billing",href:"https://dash.cloudflare.com/?to=/:account/billing"}],vercel:[{label:"Dashboard",href:"https://vercel.com/dashboard"},{label:"Billing",href:"https://vercel.com/account/billing"}],exe:[{label:"VMs",href:"https://exe.dev/"},{label:"Billing",href:"https://exe.dev/user/billing"},{label:"Docs",href:"https://exe.dev/docs/what-is-exe"}]},V={exe:{category:"Agent compute",description:"Persistent VMs for remote Scout agents and isolated workloads."},cloudflare:{category:"Edge platform",description:"Workers, networking, and edge infrastructure available for deployment."},vercel:{category:"App hosting",description:"Projects, preview environments, and production deployments."}};function W({provider:s}){return e.jsx("span",{className:`hs-cloud-mark hs-cloud-mark--${s}`,"aria-hidden":"true",children:s==="exe"?e.jsx("img",{src:"https://exe.dev/apple-touch-icon.png",alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer"}):e.jsx("svg",{viewBox:"0 0 24 24",focusable:"false",children:s==="cloudflare"?e.jsx("path",{d:"M16.5088 16.8447c.1475-.5068.0908-.9707-.1553-1.3154-.2246-.3164-.6045-.499-1.0615-.5205l-8.6592-.1123a.1559.1559 0 0 1-.1333-.0713c-.0283-.042-.0351-.0986-.021-.1553.0278-.084.1123-.1484.2036-.1562l8.7359-.1123c1.0351-.0489 2.1601-.8868 2.5537-1.9136l.499-1.3013c.0215-.0561.0293-.1128.0147-.168-.5625-2.5463-2.835-4.4453-5.5499-4.4453-2.5039 0-4.6284 1.6177-5.3876 3.8614-.4927-.3658-1.1187-.5625-1.794-.499-1.2026.119-2.1665 1.083-2.2861 2.2856-.0283.31-.0069.6128.0635.894C1.5683 13.171 0 14.7754 0 16.752c0 .1748.0142.3515.0352.5273.0141.083.0844.1475.1689.1475h15.9814c.0909 0 .1758-.0645.2032-.1553l.12-.4268Zm2.7568-5.5634c-.0771 0-.1611 0-.2383.0112-.0566 0-.1054.0415-.127.0976l-.3378 1.1744c-.1475.5068-.0918.9707.1543 1.3164.2256.3164.6055.498 1.0625.5195l1.8437.1133c.0557 0 .1055.0263.1329.0703.0283.043.0351.1074.0214.1562-.0283.084-.1132.1485-.204.1553l-1.921.1123c-1.041.0488-2.1582.8867-2.5527 1.914l-.1406.3585c-.0283.0713.0215.1416.0986.1416h6.5977c.0771 0 .1474-.0489.169-.126.1122-.4082.1757-.837.1757-1.2803 0-2.6025-2.125-4.727-4.7344-4.727"}):e.jsx("path",{d:"m12 1.608 12 20.784H0Z"})})})}function F(s){const t=(s??"").trim().toLowerCase();return t?t.includes("claude")?"claude":t.includes("codex")?"codex":t.includes("cursor")?"cursor":t.includes("kimi")||t.includes("moonshot")?"kimi":t.includes("minimax")?"minimax":t.includes("github")?"github":t.replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown":"unknown"}function N(s){return B[s]??q(s)}function K(s){switch(s){case"weekly":return"7d";case"req/h":return"1h";default:return s||"quota"}}function v(s){return s.windows&&s.windows.length>0?s.windows:[{label:K(s.unitLabel),fill:s.fill,usedLabel:s.usedLabel,capLabel:s.capLabel,unitLabel:s.unitLabel,resetAt:s.resetAt}]}function Q(s){return s.capLabel==="100%"&&s.usedLabel.endsWith("%")?s.usedLabel:`${s.usedLabel}/${s.capLabel}`}function A(s){return s>=.9?"err":s>=.75?"warn":"ok"}function Z(s,t=30){const a=s??[];if(a.length<=t)return a;if(t<=1)return[a[a.length-1]];const r=(a.length-1)/(t-1);return Array.from({length:t},(n,o)=>a[Math.round(o*r)])}function I(s){const t=Math.floor((s-Date.now())/1e3),a=t<0,r=Math.abs(t);let n;if(r>=86400){const o=Math.floor(r/86400),c=Math.floor(r%86400/3600);n=c>0?`${o}d ${c}h`:`${o}d`}else if(r>=3600){const o=Math.floor(r/3600),c=Math.floor(r%3600/60);n=c>0?`${o}h ${c}m`:`${o}h`}else n=`${Math.max(1,Math.floor(r/60))}m`;return a?`stale ${n}`:n}function J(s){if(!s)return null;const t=S(s.capturedAt);if(t)return t;if(s.kind!=="quota")return null;const a=v(s).reduce((r,n)=>{const o=S(n.capturedAt);return Math.max(r??0,o??0)||r},null);return a||v(s).flatMap(r=>r.history??[]).reduce((r,n)=>{const o=S(n.capturedAt);return Math.max(r??0,o??0)||r},null)}function X({provider:s,onImported:t}){const[a,r]=u.useState(!1),[n,o]=u.useState(""),[c,b]=u.useState(!1),[i,d]=u.useState(null),l=`hs-${s}-dashboard-capture`,m=N(s);if(!a)return e.jsxs("button",{type:"button",className:"hs-dashboard-capture-trigger",onClick:()=>r(!0),children:[e.jsx(z,{size:12,"aria-hidden":"true"}),"Import dashboard"]});const x=async p=>{if(p.preventDefault(),!(!n.trim()||c)){b(!0),d(null);try{await M("/api/service-budgets/dashboard-import",{method:"POST",body:JSON.stringify({provider:s,text:n})}),o(""),d("Usage snapshot imported."),await t()}catch(h){d(h instanceof Error?h.message:String(h))}finally{b(!1)}}};return e.jsxs("form",{className:"hs-dashboard-capture",onSubmit:p=>{x(p)},children:[e.jsxs("label",{htmlFor:l,children:[m," usage snapshot"]}),e.jsxs("p",{children:[s==="cursor"?"Paste the exported Usage CSV or copied usage table.":"Copy the signed-in Usage panel and paste it here."," ","Scout keeps only normalized totals, not this text."]}),e.jsx("textarea",{id:l,value:n,onChange:p=>o(p.target.value),maxLength:128*1024,rows:5,placeholder:s==="cursor"?"Date (UTC),Type,Model,Tokens,Cost…":"Weekly SuperGrok… Limit · 12% used · Resets…","aria-describedby":i?`${l}-message`:void 0}),i?e.jsx("span",{id:`${l}-message`,className:"hs-dashboard-capture-message",role:"status",children:i}):null,e.jsxs("div",{className:"hs-dashboard-capture-actions",children:[e.jsx("button",{type:"button",onClick:()=>{r(!1),d(null)},disabled:c,children:"Cancel"}),e.jsx("button",{type:"submit",disabled:!n.trim()||c,children:c?"Importing…":"Use snapshot"})]})]})}function Y(s){const t=new Map(s.map(a=>[F(a.id),a]));return C.map(({id:a})=>({id:a,label:N(a),gauge:t.get(a)??null}))}function ee({points:s}){const t=Z(s);return t.length===0?e.jsx("span",{className:"hs-history hs-history-empty",children:"live"}):e.jsx("span",{className:"hs-history","aria-label":`${t.length} budget samples`,children:t.map((a,r)=>{const n=Math.max(.06,Math.min(1,a.fill));return e.jsx("span",{className:`hs-history-bar hs-history-bar--${A(a.fill)}`,style:{height:`${Math.round(n*100)}%`},title:`${L(a.capturedAt)||"unknown"} ${a.usedLabel}`},`${a.capturedAt}:${r}`)})})}function se({gauge:s,window:t}){const a=Math.max(0,Math.min(100,Math.round(t.fill*100))),r=100-a,n=A(t.fill),o=Number.isFinite(t.resetAt)?new Date(t.resetAt).toISOString():void 0;return e.jsxs("div",{className:"hs-subscription-window",children:[e.jsxs("div",{className:"hs-subscription-window-head",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"hs-subscription-window-label",children:[t.label," window"]}),e.jsxs("strong",{className:`hs-subscription-usage hs-subscription-usage--${n}`,children:[a,"% used"]})]}),e.jsxs("div",{className:"hs-subscription-remaining",children:[e.jsxs("strong",{children:[r,"%"]}),e.jsx("span",{children:"available"})]})]}),e.jsx("div",{className:"hs-subscription-meter",role:"progressbar","aria-label":`${s.label} ${t.label} usage`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,children:e.jsx("span",{className:`hs-subscription-meter-fill hs-subscription-meter-fill--${n}`,style:{width:`${a}%`}})}),e.jsxs("div",{className:"hs-subscription-window-meta",children:[e.jsxs("span",{children:[Q(t)," ",t.unitLabel==="quota"?"quota":t.unitLabel]}),e.jsxs("span",{children:["resets in ",I(t.resetAt),o?e.jsx("time",{dateTime:o,title:L(t.resetAt)||void 0,children:` · ${L(t.resetAt)||""}`}):null]})]}),e.jsx(ee,{points:t.history})]})}function te(){return e.jsxs("div",{className:"hs-subscription-loading","aria-hidden":"true",children:[e.jsx("span",{className:"hs-loading-line hs-loading-line--label"}),e.jsx("span",{className:"hs-loading-line hs-loading-line--value"}),e.jsx("span",{className:"hs-loading-meter"}),e.jsx("span",{className:"hs-loading-line hs-loading-line--meta"}),e.jsx("span",{className:"hs-loading-history"})]})}function ae({rows:s,loading:t,onImported:a}){const r=C.map(i=>({provider:i,row:s.find(d=>d.id===i.id)??null})),n=r.filter(({row:i})=>i?.gauge).length,o=r.filter(({row:i})=>i?.gauge?.kind==="quota").length,c=r.filter(({row:i})=>i?.gauge?.kind==="quota"&&i.gauge.plan||i?.gauge?.kind==="status").length,b=r.flatMap(({row:i})=>i?.gauge?.kind==="quota"?v(i.gauge):[]).map(i=>i.resetAt).filter(i=>i>Date.now()).sort((i,d)=>i-d)[0];return e.jsxs("section",{className:"hs-subscriptions","aria-labelledby":"hs-subscriptions-title","aria-busy":t,children:[e.jsxs("div",{className:"hs-section-head hs-subscriptions-head",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"hs-subscriptions-title",children:"Subscriptions"}),e.jsx("p",{children:"Plans, remaining allowance, reset windows, and the fastest path to each provider dashboard."})]}),e.jsxs("div",{className:"hs-subscription-summary","aria-label":"Subscription feed summary",children:[e.jsxs("span",{children:[e.jsx("strong",{children:t?"—":n})," detected"]}),e.jsxs("span",{children:[e.jsx("strong",{children:t?"—":o})," usage feeds"]}),e.jsxs("span",{children:[e.jsx("strong",{children:t?"—":c})," plans named"]}),e.jsxs("span",{children:[e.jsx("strong",{children:t?"—":b?I(b):"-"})," next reset"]})]})]}),e.jsx("div",{className:"hs-subscription-grid",children:r.map(({provider:i,row:d})=>{const l=d?.gauge??null,m=t&&!l,x=m?"loading":l?"connected":"missing",p=l?.kind==="quota"?l.plan:l?.kind==="status"?l.statusLabel:null,h=J(l),y=l?.kind==="quota"?"Usage connected":l?.kind==="status"?l.detailLabel||"Subscription detected":m?"Checking":"Not detected";return e.jsxs("article",{className:`hs-subscription-card hs-subscription-card--${x}`,children:[e.jsxs("header",{className:"hs-subscription-card-head",children:[e.jsxs("div",{className:"hs-subscription-provider",children:[e.jsx(R,{harness:i.id,size:18,title:null,className:"hs-subscription-mark"}),e.jsxs("div",{children:[e.jsx("h4",{children:N(i.id)}),e.jsx("span",{children:m?"Checking local plan…":p||"Plan not reported"})]})]}),e.jsx("span",{className:`hs-subscription-state hs-subscription-state--${x}`,children:y})]}),e.jsx("p",{className:"hs-subscription-description",children:i.description}),m?e.jsx(te,{}):l?.kind==="quota"?e.jsx("div",{className:"hs-subscription-windows",children:v(l).map(f=>e.jsx(se,{gauge:l,window:f},`${i.id}:${f.label}`))}):l?.kind==="status"?e.jsxs("div",{className:"hs-subscription-status-detail",children:[e.jsx("strong",{children:l.statusLabel}),e.jsx("span",{children:l.detailLabel||"Subscription detected locally. Open the provider dashboard for live usage."})]}):e.jsxs("div",{className:"hs-subscription-missing",children:[e.jsx("strong",{children:"No local subscription feed yet"}),e.jsx("span",{children:"Open the provider locally, then refresh Scout."})]}),i.id==="cursor"||i.id==="grok"&&l?.kind!=="quota"?e.jsx(X,{provider:i.id,onImported:a}):null,e.jsxs("footer",{className:"hs-subscription-footer",children:[e.jsxs("span",{children:[m?"checking local feed":h?`updated ${O(h)||"now"}`:l?"detected locally":"waiting for provider data",l?.source?` · ${l.source}`:""]}),e.jsx("nav",{"aria-label":`${N(i.id)} quick links`,children:i.links.map(f=>e.jsxs("a",{href:f.href,target:"_blank",rel:"noreferrer",children:[f.label,e.jsx($,{size:11,"aria-hidden":"true"})]},f.href))})]})]},i.id)})})]})}function re({accounts:s,loading:t}){return s.length===0&&!t?null:e.jsxs("section",{className:"hs-cloud-accounts","aria-labelledby":"hs-cloud-accounts-title","aria-busy":t,children:[e.jsxs("div",{className:"hs-section-head hs-cloud-accounts-head",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"hs-cloud-accounts-title",children:"Cloud accounts"}),e.jsx("p",{children:"Infrastructure available to Scout for deployment and agent compute."})]}),e.jsx("span",{className:"hs-section-meta",children:t?"checking accounts":`${s.length} connected`})]}),e.jsxs("div",{className:"hs-cloud-grid",children:[t&&s.length===0?Array.from({length:3},(a,r)=>e.jsxs("article",{className:"hs-cloud-card hs-cloud-card--loading","aria-hidden":"true",children:[e.jsxs("header",{className:"hs-cloud-card-head",children:[e.jsx("span",{className:"hs-loading-mark"}),e.jsx("span",{className:"hs-loading-line hs-loading-line--cloud-title"})]}),e.jsx("span",{className:"hs-loading-line hs-loading-line--cloud-copy"}),e.jsxs("footer",{className:"hs-cloud-card-footer",children:[e.jsx("span",{className:"hs-loading-line hs-loading-line--cloud-meta"}),e.jsx("span",{className:"hs-loading-actions"})]})]},r)):null,s.map(a=>{const r=V[a.id];return e.jsxs("article",{className:"hs-cloud-card",children:[e.jsxs("header",{className:"hs-cloud-card-head",children:[e.jsxs("div",{className:"hs-cloud-identity",children:[e.jsx(W,{provider:a.id}),e.jsxs("div",{children:[e.jsx("span",{className:"hs-cloud-category",children:r.category}),e.jsx("h4",{children:a.label})]})]}),e.jsx("span",{className:"hs-subscription-state hs-subscription-state--connected",children:a.statusLabel})]}),e.jsx("p",{className:"hs-cloud-description",children:r.description}),e.jsxs("footer",{className:"hs-cloud-card-footer",children:[e.jsxs("span",{className:"hs-cloud-connection",children:[e.jsx("span",{className:"hs-cloud-dot","aria-hidden":"true"}),a.detailLabel]}),e.jsx("nav",{"aria-label":`${a.label} quick links`,children:G[a.id].map(n=>e.jsxs("a",{href:n.href,target:"_blank",rel:"noreferrer",children:[n.label,e.jsx($,{size:11,"aria-hidden":"true"})]},n.href))})]})]},a.id)})]})]})}function ts({navigate:s}){const{route:t}=P(),a=D(t),[r,n]=u.useState([]),[o,c]=u.useState([]),[b,i]=u.useState(!0),[d,l]=u.useState(!1),[m,x]=u.useState(null),p=u.useRef(0),h=u.useCallback(async(g=!1,k=!1)=>{const w=++p.current;k&&i(!0),l(!0),x(null);try{const j=await M(`/api/service-budgets${g?"?refresh=1":""}`);if(w!==p.current)return;n(j.gauges??[]),c(j.cloudAccounts??[])}catch(j){w===p.current&&x(j instanceof Error?j.message:String(j))}finally{w===p.current&&(i(!1),l(!1))}},[]);u.useEffect(()=>{let g=!1,k;return h(!1,!0).then(()=>{g||(k=window.setTimeout(()=>{h(!0)},600))}),()=>{g=!0,k!==void 0&&window.clearTimeout(k)}},[h]),u.useEffect(()=>{const g=window.setInterval(()=>{h(!1)},3e4);return()=>window.clearInterval(g)},[h]);const y=u.useMemo(()=>Y(r),[r]),f=T();return e.jsxs("div",{className:"s-ops",children:[f?e.jsx("div",{className:"s-ops-header",children:e.jsx(E,{activeRoute:{view:"harnesses",...a?{machineId:a}:{}},navigate:s})}):null,e.jsx("div",{className:"s-ops-body hs-body",children:e.jsxs("div",{className:"hs-page",children:[e.jsxs("header",{className:"hs-page-head",children:[e.jsxs("div",{className:"hs-title-group",children:[e.jsx("span",{className:"hs-kicker",children:"ops / provider central"}),e.jsx("h2",{children:"Agent Providers"}),e.jsx("p",{children:"See what you pay for, how much remains, and where to use it."})]}),e.jsxs("button",{type:"button",className:"hs-refresh",disabled:d,onClick:()=>{h(!0)},children:[e.jsx(U,{size:14,className:d?"hs-refresh-icon-spinning":"","aria-hidden":"true"}),e.jsx("span",{children:d?"Refreshing":"Refresh"})]})]}),m&&e.jsxs("div",{className:"hs-error",role:"status","aria-live":"polite",children:["refresh: ",m]}),e.jsx(ae,{rows:y,loading:b,onImported:()=>h(!1)}),e.jsx(re,{accounts:o,loading:b})]})})]})}export{ts as HarnessesScreen};
@@ -1,4 +1,4 @@
1
- import{r as d,j as e}from"./index-CzVeWScw.js";import{L as K,u as X}from"./chunk-YOZR3KYS-DLOc92uD.js";import{c as Q}from"./clipboard-e3fSpeo7.js";import{e as A}from"./terminal-sessions-C3qU8tnY.js";import{a as C}from"./api-h5zurxmi.js";import{H as D}from"./HarnessMark-BE-YSyci.js";import{T as H}from"./terminal-DrTkVXIj.js";import{R as V}from"./refresh-cw-4oeFn1Jn.js";import{C as Z}from"./check-COxArFXG.js";import{C as ee}from"./copy-4LfKIdQJ.js";import{E as G}from"./eye-BFlhMzQL.js";import{c as te}from"./createLucideIcon-ClCdc3F9.js";import{X as se}from"./x-D4X_y1j_.js";const ne=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]],J=te("crosshair",ne);async function re(){return C("/api/terminal-hosts")}async function ae(t,s){return C(`/api/terminal-hosts/${encodeURIComponent(t)}/sessions`,{method:"POST",body:JSON.stringify(s)})}let $=null,O=null;function ie(){return $?Promise.resolve($):(O??=re().then(t=>($=t,t)).finally(()=>{O=null}),O)}function Ae(){const[t,s]=d.useState($);return d.useEffect(()=>{if(t)return;let n=!1;return ie().then(a=>{n||s(a)}).catch(()=>{}),()=>{n=!0}},[t]),{hosts:t?.hosts??[],preferredHostId:t?.preferredHostId??null,loaded:t!==null}}async function le(t){return(await C(`/api/terminal-hosts/herdr/sessions/${encodeURIComponent(t)}/topology`)).topology}async function F(t,s){await C(`/api/terminal-hosts/herdr/sessions/${encodeURIComponent(t)}/focus`,{method:"POST",body:JSON.stringify({target:s})})}async function Y(t,s,n=48){const a=new URLSearchParams({backend:"herdr",sessionName:t,paneId:s,lines:String(n)}),i=await C(`/api/terminal-sessions/peek?${a.toString()}`);return i.available?{body:i.body,reason:null}:{body:null,reason:i.reason??"No preview available."}}const oe=3e3;function ce(t,s,n={}){const a=n.enabled??!0,i=n.lines??48,c=n.pollMs??oe,[p,m]=d.useState(null),[u,o]=d.useState(0);return d.useEffect(()=>{if(!t||!s||!a)return;let l=!1;m(null);const b=()=>{Y(t,s,i).then(h=>{l||m(h)}).catch(h=>{if(l)return;const r=h instanceof Error?h.message:String(h);m(g=>({body:g?.body??null,reason:r}))})};b();const j=window.setInterval(()=>{document.visibilityState!=="hidden"&&b()},c);return()=>{l=!0,window.clearInterval(j)}},[t,s,i,a,c,u]),{body:p?.body??null,reason:p?.reason??null,loading:p===null,refresh:()=>o(l=>l+1)}}const de=15e3;function ue(t,s,n={}){const a=n.enabled??!0,i=n.lines??6,c=n.pollMs??de,[p,m]=d.useState({}),u=s.join(`
1
+ import{r as d,j as e}from"./index-o4FKpU7Z.js";import{L as K,u as X}from"./usePersistentState-D3M4m2Ou.js";import{c as Q}from"./clipboard-e3fSpeo7.js";import{e as A}from"./terminal-sessions-AmSgHklm.js";import{a as C}from"./api-h5zurxmi.js";import{H as D}from"./HarnessMark-MztYnrGK.js";import{T as H}from"./terminal-By1Lw2i2.js";import{R as V}from"./refresh-cw-B5To7b6B.js";import{C as Z}from"./check--esHw52j.js";import{C as ee}from"./copy-Dty8ZYsM.js";import{E as G}from"./eye-B3lBIwJZ.js";import{c as te}from"./createLucideIcon-Bt67PWH-.js";import{X as se}from"./x-ynOfVadO.js";const ne=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]],J=te("crosshair",ne);async function re(){return C("/api/terminal-hosts")}async function ae(t,s){return C(`/api/terminal-hosts/${encodeURIComponent(t)}/sessions`,{method:"POST",body:JSON.stringify(s)})}let $=null,O=null;function ie(){return $?Promise.resolve($):(O??=re().then(t=>($=t,t)).finally(()=>{O=null}),O)}function Ae(){const[t,s]=d.useState($);return d.useEffect(()=>{if(t)return;let n=!1;return ie().then(a=>{n||s(a)}).catch(()=>{}),()=>{n=!0}},[t]),{hosts:t?.hosts??[],preferredHostId:t?.preferredHostId??null,loaded:t!==null}}async function le(t){return(await C(`/api/terminal-hosts/herdr/sessions/${encodeURIComponent(t)}/topology`)).topology}async function F(t,s){await C(`/api/terminal-hosts/herdr/sessions/${encodeURIComponent(t)}/focus`,{method:"POST",body:JSON.stringify({target:s})})}async function Y(t,s,n=48){const a=new URLSearchParams({backend:"herdr",sessionName:t,paneId:s,lines:String(n)}),i=await C(`/api/terminal-sessions/peek?${a.toString()}`);return i.available?{body:i.body,reason:null}:{body:null,reason:i.reason??"No preview available."}}const oe=3e3;function ce(t,s,n={}){const a=n.enabled??!0,i=n.lines??48,c=n.pollMs??oe,[p,m]=d.useState(null),[u,o]=d.useState(0);return d.useEffect(()=>{if(!t||!s||!a)return;let l=!1;m(null);const b=()=>{Y(t,s,i).then(h=>{l||m(h)}).catch(h=>{if(l)return;const r=h instanceof Error?h.message:String(h);m(g=>({body:g?.body??null,reason:r}))})};b();const j=window.setInterval(()=>{document.visibilityState!=="hidden"&&b()},c);return()=>{l=!0,window.clearInterval(j)}},[t,s,i,a,c,u]),{body:p?.body??null,reason:p?.reason??null,loading:p===null,refresh:()=>o(l=>l+1)}}const de=15e3;function ue(t,s,n={}){const a=n.enabled??!0,i=n.lines??6,c=n.pollMs??de,[p,m]=d.useState({}),u=s.join(`
2
2
  `);return d.useEffect(()=>{const o=u?u.split(`
3
3
  `):[];if(!t||!a||o.length===0)return;let l=!1;const b=()=>{Promise.all(o.map(async h=>{try{const r=await Y(t,h,i);return[h,r.body]}catch{return[h,void 0]}})).then(h=>{l||m(r=>{const g={};for(const[S,k]of h)g[S]=k===void 0?r[S]??null:k;return g})})};b();const j=window.setInterval(()=>{document.visibilityState!=="hidden"&&b()},c);return()=>{l=!0,window.clearInterval(j)}},[t,u,i,a,c]),p}const he=3e3;function pe(t,s={}){const n=s.enabled??!0,a=s.pollMs??he,[i,c]=d.useState(null),[p,m]=d.useState(null),[u,o]=d.useState(0);return d.useEffect(()=>{if(!t||!n)return;let l=!1;const b=()=>{le(t).then(h=>{l||(c(h),m(null))}).catch(h=>{l||m(h instanceof Error?h.message:String(h))})};b();const j=window.setInterval(()=>{document.visibilityState!=="hidden"&&b()},a);return()=>{l=!0,window.clearInterval(j)}},[t,n,a,u]),{topology:i,error:p,refresh:()=>o(l=>l+1)}}const me={column:"status",direction:"desc"},z=[{id:"pane",label:"Pane",initialDirection:"asc"},{id:"harness",label:"Harness",initialDirection:"asc"},{id:"status",label:"Status",initialDirection:"desc"},{id:"directory",label:"Directory",initialDirection:"asc"},{id:"tab",label:"Tab",initialDirection:"asc"},{id:"drift",label:"Drift",initialDirection:"desc"},{id:"output",label:"Last output",initialDirection:"asc"}];function U(t){switch(t){case"working":return 4;case"blocked":return 3;case"idle":return 2;case"done":return 1;case"unknown":return 0}}function T(t){return t.label??t.paneId}function M(t){return t.foregroundCwd??t.cwd??""}function R(t){return t.scroll?.offsetFromBottom??null}function L(t){if(!t)return null;const n=t.replace(/\x1b\[[0-9;?]*[ -/]*[@-~]/g,"").split(`
4
4
  `);for(let a=n.length-1;a>=0;a-=1){const i=n[a].trim();if(i)return i}return null}function N(t,s){return t.localeCompare(s,void 0,{numeric:!0,sensitivity:"base"})}function be(t,s){const n=s.direction==="asc"?1:-1;return[...t].sort((a,i)=>{const c=fe(a,i,s.column);if(c!==0)return c;const p=xe(a,i,s.column)*n;return p!==0?p:N(T(a.pane),T(i.pane))})}function fe(t,s,n){const a=p=>n==="drift"?R(p.pane):n==="output"?L(p.output):!0,i=a(t),c=a(s);return i===null&&c===null?0:i===null?1:c===null?-1:0}function xe(t,s,n){switch(n){case"pane":return N(T(t.pane),T(s.pane));case"harness":return N(t.pane.agent??"",s.pane.agent??"");case"status":return U(t.pane.agentStatus)-U(s.pane.agentStatus);case"directory":return N(M(t.pane),M(s.pane));case"tab":return N(t.tabLabel,s.tabLabel);case"drift":return B(R(t.pane),R(s.pane));case"output":return B(L(t.output),L(s.output))}}function B(t,s){return t===null&&s===null?0:t===null?-1:s===null?1:typeof t=="string"&&typeof s=="string"?N(t,s):Number(t)-Number(s)}function je(t,s){if(t.column===s)return{column:s,direction:t.direction==="asc"?"desc":"asc"};const n=z.find(a=>a.id===s)?.initialDirection??"asc";return{column:s,direction:n}}const ye="openscout.herdr.pane-table-sort.v1";function W(t){return{view:"terminal",terminalBackend:"herdr",terminalAgent:"shell",terminalTabId:`herdr-${t}`,terminalSessionName:t}}function ge({sessionName:t,navigate:s}){const{topology:n,error:a,refresh:i}=pe(t),[c,p]=d.useState(null),[m,u]=d.useState(null),[o,l]=d.useState("idle"),[b,j]=d.useState(null),h=t==="default"?"herdr":`herdr session attach ${t}`,r=n?.running??!1,g=d.useCallback(()=>{l("starting"),j(null),ae("herdr",{sessionName:t}).then(()=>{l("idle"),i()}).catch(y=>{l("failed"),j(y instanceof Error?y.message:String(y))})},[t,i]),S=d.useCallback(()=>{s(W(t))},[s,t]),k=d.useCallback(y=>{F(t,y.terminalId??y.paneId).catch(()=>{}),s(W(t))},[s,t]);return e.jsxs("div",{className:"s-term s-herdr",children:[e.jsxs("header",{className:"s-herdr-header",children:[e.jsxs("div",{className:"s-herdr-title",children:[e.jsx("span",{className:"s-herdr-mark",children:e.jsx(H,{size:16,strokeWidth:1.8})}),e.jsx("strong",{children:t}),e.jsx("span",{className:`s-herdr-state ${r?"s-herdr-state--live":""}`,children:n?r?"running":"stopped":"loading"})]}),e.jsxs("div",{className:"s-herdr-actions",children:[r&&e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:S,title:"Open a live web terminal attached to this session",children:[e.jsx(K,{size:13,strokeWidth:1.8}),"Open terminal"]}),e.jsx(we,{command:h}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:i,title:"Refresh","aria-label":"Refresh",children:e.jsx(V,{size:14,strokeWidth:1.8})})]})]}),a&&e.jsx("div",{className:"s-herdr-error",children:a}),n&&!r&&e.jsxs("div",{className:"s-herdr-empty",children:[e.jsx(H,{size:22,strokeWidth:1.5}),e.jsx("strong",{children:"This herdr session is stopped."}),e.jsx("span",{children:"The session still exists — herdr sessions are persistent. Start it and the projection fills in."}),e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:g,disabled:o==="starting",children:o==="starting"?"Starting…":"Start it"}),b&&e.jsx("code",{children:b})]}),n&&r&&n.workspaces.length===0&&e.jsxs("div",{className:"s-herdr-empty",children:[e.jsx(H,{size:22,strokeWidth:1.5}),e.jsx("strong",{children:"No workspaces yet."}),e.jsx("span",{children:"Open this session in herdr to create one — layout is herdr's job, Scout just watches."})]}),n&&r&&n.workspaces.length>0&&(()=>{const y=n.workspaces.flatMap(f=>f.tabs.map(x=>({workspace:f,tab:x})));if(y.length===0)return null;const v=n.workspaces.find(f=>f.focused)?.activeTabId??n.workspaces[0]?.activeTabId??null,E=y.find(f=>f.tab.tabId===c)??y.find(f=>f.tab.tabId===v)??y[0],{workspace:w,tab:I}=E,q=f=>{p(f),u(null)};return e.jsxs("section",{className:"s-herdr-workspace",children:[e.jsxs("div",{className:"s-herdr-workspace-head",children:[e.jsx("span",{className:"s-herdr-workspace-label",children:w.label??w.workspaceId}),e.jsx(_,{status:w.agentStatus})]}),e.jsx("div",{className:"s-herdr-tabs",role:"tablist",children:y.map(({workspace:f,tab:x})=>e.jsxs("button",{type:"button",role:"tab","aria-selected":x.tabId===I.tabId,className:`s-herdr-tab ${x.tabId===I.tabId?"s-herdr-tab--active":""}`,title:`${f.label??f.workspaceId} · ${x.label??x.tabId}`,onClick:()=>q(x.tabId),children:[e.jsx(P,{status:x.agentStatus}),e.jsx("span",{children:x.label??`Tab ${x.number??""}`}),e.jsx(Ne,{tab:x}),e.jsx("span",{className:"s-herdr-tab-count",children:x.panes.length})]},x.tabId))}),I.layout&&e.jsx(ke,{tab:I,diveInPaneId:m,onEnterPane:k,onToggleDiveIn:f=>u(x=>x===f?null:f)}),e.jsx(ve,{sessionName:t,tab:I,onEnterPane:k}),m&&(()=>{const f=I.panes.find(x=>x.paneId===m);return f?e.jsx(Se,{sessionName:t,pane:f,onClose:()=>u(null)}):null})()]})})()]})}function ke({tab:t,diveInPaneId:s,onEnterPane:n,onToggleDiveIn:a}){const i=t.layout;if(!i)return null;const{area:c}=i,p=new Map(t.panes.map(u=>[u.paneId,u])),m=`${c.width} / ${Math.max(c.height*2,1)}`;return e.jsxs("div",{className:"s-herdr-layout-window",children:[e.jsxs("div",{className:"s-herdr-layout-titlebar",children:[e.jsxs("span",{className:"s-herdr-layout-lights","aria-hidden":"true",children:[e.jsx("i",{}),e.jsx("i",{}),e.jsx("i",{})]}),e.jsxs("span",{className:"s-herdr-layout-title",children:[t.label??`Tab ${t.number??""}`," — ",i.panes.length," ",i.panes.length===1?"pane":"panes"]}),e.jsx("span",{className:"s-herdr-layout-hint",children:"click a pane to enter"})]}),e.jsx("div",{className:"s-herdr-layout",style:{aspectRatio:m},role:"group","aria-label":`Layout of ${t.label??t.tabId}`,children:i.panes.map(u=>{const o=p.get(u.paneId),{rect:l}=u,b={left:`${(l.x-c.x)/c.width*100}%`,top:`${(l.y-c.y)/c.height*100}%`,width:`${l.width/c.width*100}%`,height:`${l.height/c.height*100}%`},j=o?.paneId===s;return e.jsxs("div",{role:"button",tabIndex:0,className:`s-herdr-layout-pane ${u.focused?"s-herdr-layout-pane--focused":""}`,style:b,onClick:()=>o&&n(o),onKeyDown:h=>{o&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),n(o))},title:o?`Enter ${o.label??o.paneId} — focus it and open the web terminal`:u.paneId,children:[e.jsxs("span",{className:"s-herdr-layout-pane-head",children:[o&&e.jsx(P,{status:o.agentStatus}),o?.agent&&e.jsx(D,{harness:o.agent,size:12,className:"s-herdr-agent-mark"}),e.jsx("strong",{className:"s-herdr-pane-label",children:o?.label??u.paneId})]}),o?.foregroundCwd&&e.jsx("span",{className:"s-herdr-cwd",children:A(o.foregroundCwd)}),o&&e.jsx("button",{type:"button",className:`s-herdr-layout-pane-peek ${j?"s-herdr-layout-pane-peek--active":""}`,onClick:h=>{h.stopPropagation(),a(o.paneId)},title:j?"Close the live view":"Watch this pane live","aria-label":j?"Close the live view":"Watch this pane live","aria-pressed":j,children:e.jsx(G,{size:13,strokeWidth:1.8})})]},u.paneId)})})]})}function ve({sessionName:t,tab:s,onEnterPane:n}){const[a,i]=X(ye,me),[c,p]=d.useState(null),[m,u]=d.useState(null),o=d.useMemo(()=>s.panes.map(r=>r.paneId),[s.panes]),l=ue(t,o,{lines:6}),b=s.label??`Tab ${s.number??""}`,j=d.useMemo(()=>be(s.panes.map(r=>({pane:r,tabLabel:b,output:l[r.paneId]??null})),a),[s.panes,b,l,a]),h=d.useCallback(r=>{u(null),F(t,r.terminalId??r.paneId).catch(g=>u(g instanceof Error?g.message:String(g)))},[t]);return e.jsxs("div",{className:"s-herdr-table-wrap",children:[e.jsxs("table",{className:"s-herdr-table","aria-label":`Panes of ${b}`,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[z.map(r=>e.jsx("th",{scope:"col","aria-sort":a.column===r.id?a.direction==="asc"?"ascending":"descending":"none",children:e.jsxs("button",{type:"button",onClick:()=>i(je(a,r.id)),children:[e.jsx("span",{children:r.label}),e.jsx("em",{"aria-hidden":"true",children:a.column===r.id?a.direction==="asc"?"▲":"▼":"·"})]})},r.id)),e.jsx("th",{scope:"col","aria-label":"Actions"})]})}),e.jsx("tbody",{children:j.map(({pane:r,tabLabel:g,output:S})=>{const k=r.paneId===c,y=L(S),v=R(r),E=M(r);return e.jsxs(d.Fragment,{children:[e.jsxs("tr",{className:r.focused?"is-focused":void 0,onClick:()=>n(r),title:`Enter ${T(r)} — focus it and open the web terminal`,children:[e.jsxs("td",{className:"s-herdr-table-pane",children:[e.jsx(P,{status:r.agentStatus}),e.jsx("strong",{title:r.paneId,children:T(r)}),r.focused&&e.jsx("span",{className:"s-herdr-focused",children:"focused in herdr"})]}),e.jsx("td",{className:"s-herdr-table-harness",children:r.agent?e.jsx("span",{title:r.agent,className:"s-herdr-table-harness-mark",children:e.jsx(D,{harness:r.agent,size:13,className:"s-herdr-agent-mark"})}):e.jsx("span",{title:"shell — no agent running",className:"s-herdr-table-harness-mark",children:e.jsx(H,{size:12,strokeWidth:1.8})})}),e.jsx("td",{children:r.agentStatus==="unknown"?"—":e.jsx(_,{status:r.agentStatus})}),e.jsx("td",{className:"s-herdr-table-dir",title:E||void 0,children:E?A(E):"—"}),e.jsx("td",{children:g}),e.jsx("td",{className:"s-herdr-table-drift",title:v===null?void 0:v===0?"Pinned to live output":`Scrolled up ${v} ${v===1?"line":"lines"} from the live edge`,children:v===null?"—":v===0?"live":`↑${v}`}),e.jsx("td",{className:"s-herdr-table-output",title:y??void 0,children:y??"—"}),e.jsxs("td",{className:"s-herdr-table-actions",children:[e.jsx("button",{type:"button",className:`s-term-icon-button${k?" is-active":""}`,onClick:w=>{w.stopPropagation(),p(I=>I===r.paneId?null:r.paneId)},title:k?"Hide the pane's last lines":"Show the pane's last lines","aria-label":k?"Hide the pane's last lines":"Show the pane's last lines","aria-pressed":k,children:e.jsx(G,{size:13,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:w=>{w.stopPropagation(),h(r)},title:"Focus this pane in the herdr client","aria-label":"Focus this pane in the herdr client",children:e.jsx(J,{size:13,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:w=>{w.stopPropagation(),n(r)},title:"Enter — focus it and open the web terminal","aria-label":"Enter — focus it and open the web terminal",children:e.jsx(K,{size:13,strokeWidth:1.8})})]})]}),k&&e.jsx("tr",{className:"s-herdr-table-expand",children:e.jsx("td",{colSpan:z.length+1,children:S?e.jsx("pre",{children:S}):e.jsx("span",{className:"s-herdr-peek-reason",children:"No output captured yet."})})})]},r.paneId)})})]}),m&&e.jsx("div",{className:"s-herdr-error",children:m})]})}function we({command:t}){const[s,n]=d.useState(!1);return e.jsxs("button",{type:"button",className:"s-herdr-attach",title:"Copy attach command — open this session in the herdr client",onClick:()=>{Q(t).then(()=>{n(!0),window.setTimeout(()=>n(!1),1500)})},children:[s?e.jsx(Z,{size:13,strokeWidth:2}):e.jsx(ee,{size:13,strokeWidth:1.8}),e.jsx("code",{children:t})]})}function Se({sessionName:t,pane:s,onClose:n}){const{body:a,reason:i,loading:c,refresh:p}=ce(t,s.paneId,{lines:48}),[m,u]=d.useState(null);d.useEffect(()=>{const l=b=>{b.key==="Escape"&&n()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[n]);const o=d.useCallback(()=>{u(null),F(t,s.terminalId??s.paneId).catch(l=>u(l instanceof Error?l.message:String(l)))},[t,s.terminalId,s.paneId]);return e.jsx("div",{className:"s-herdr-lightbox",onClick:n,role:"presentation",children:e.jsxs("section",{className:"s-herdr-live","aria-label":`Live view of ${s.label??s.paneId}`,onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"s-herdr-live-head",children:[e.jsx(P,{status:s.agentStatus}),s.agent&&e.jsx(D,{harness:s.agent,size:13,className:"s-herdr-agent-mark"}),e.jsx("strong",{className:"s-herdr-pane-label",children:s.label??s.paneId}),e.jsx(_,{status:s.agentStatus}),s.foregroundCwd&&e.jsx("span",{className:"s-herdr-cwd",children:A(s.foregroundCwd)}),e.jsx("span",{className:"s-herdr-pane-spacer"}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:o,title:"Focus this pane in the herdr client","aria-label":"Focus this pane in the herdr client",children:e.jsx(J,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:p,title:"Refresh now","aria-label":"Refresh now",children:e.jsx(V,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:n,title:"Close the live view (Esc)","aria-label":"Close the live view",children:e.jsx(se,{size:14,strokeWidth:1.8})})]}),e.jsx("div",{className:"s-herdr-live-body",children:a!==null?e.jsx("pre",{children:a}):c?e.jsx("span",{className:"s-herdr-peek-reason",children:"Loading…"}):e.jsx("span",{className:"s-herdr-peek-reason",children:i??"No preview available."})}),m&&e.jsx("div",{className:"s-herdr-error",children:m})]})})}function Ie(t){return t}function P({status:t}){return e.jsx("span",{className:`s-herdr-dot s-herdr-dot--${t}`,"aria-hidden":"true"})}function _({status:t}){return t==="unknown"?null:e.jsx("span",{className:`s-herdr-badge s-herdr-badge--${t}`,children:t})}function Ne({tab:t}){const s=[...new Set(t.panes.map(n=>n.agent).filter(n=>!!n))].slice(0,4);return s.length===0?null:e.jsx("span",{className:"s-herdr-tab-marks",children:s.map(n=>e.jsx(D,{harness:n,size:11,className:"s-herdr-agent-mark"},n))})}function Te(t){return{label:t.label??`Tab ${t.number??""}`,statuses:t.panes.map(s=>s.agentStatus)}}const Fe=Object.freeze(Object.defineProperty({__proto__:null,AgentStatusBadge:_,AgentStatusDot:P,HerdrSessionScreen:ge,herdrAgentStatusLabel:Ie,herdrTabSummary:Te,herdrTerminalRoute:W},Symbol.toStringTag,{value:"Module"}));export{P as A,ge as H,pe as a,Te as b,ae as c,Fe as d,W as h,Ae as u};
@@ -1 +1 @@
1
- import{r as $,j as t}from"./index-CzVeWScw.js";const F=3,H=2;function k(e){return e>=.9?"err":e>=.75?"warn":"ok"}const C=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function E(e,a){const s=e-a.getTime(),i=new Date(e).toDateString()===a.toDateString(),r=new Date(e),n=String(r.getHours()).padStart(2,"0"),l=String(r.getMinutes()).padStart(2,"0"),o=s>0&&s<6*3600*1e3;return i?{label:`${n}:${l}`,imminent:o}:{label:`${C[r.getDay()]} ${n}:${l}`,imminent:o}}function W(e,a){const s=Math.floor((e-a.getTime())/1e3),i=s<0,r=Math.abs(s);let n;if(r>=86400){const l=Math.floor(r/86400),o=Math.floor(r%86400/3600);n=o>0?`${l}d ${o}h`:`${l}d`}else if(r>=3600){const l=Math.floor(r/3600),o=Math.floor(r%3600/60);n=o>0?`${l}h ${o}m`:`${l}h`}else n=`${Math.max(1,Math.floor(r/60))}m`;return i?`stale ${n}`:n}function M(e){return e.windows&&e.windows.length>0?e.windows:[{label:_(e.unitLabel),fill:e.fill,usedLabel:e.usedLabel,capLabel:e.capLabel,unitLabel:e.unitLabel,resetAt:e.resetAt}]}function _(e){switch(e){case"weekly":return"7d";case"req/h":return"1h";default:return e||"quota"}}function S(e,a){return M(e).map(s=>{const i=E(s.resetAt,a),r=W(s.resetAt,a);return`${s.label}: ${s.usedLabel} / ${s.capLabel} ${s.unitLabel} · resets ${i.label} (in ${r})`}).join(" · ")}function L(e){const a=e.trim().match(/^(\d+(?:\.\d+)?)([mhd])$/i);if(!a)return null;const s=Number(a[1]);if(!Number.isFinite(s))return null;switch(a[2]?.toLowerCase()){case"m":return s;case"h":return s*60;case"d":return s*24*60;default:return null}}function I(e){const a=[...e].sort((r,n)=>(L(r.label)??Number.MAX_SAFE_INTEGER)-(L(n.label)??Number.MAX_SAFE_INTEGER)),s=a.find(r=>(L(r.label)??0)>=1440)??(a.length>1?a[a.length-1]:null);return{shortWindow:a.find(r=>r!==s)??null,longWindow:s}}function q(e){return e.capLabel==="100%"&&e.usedLabel.endsWith("%")?e.usedLabel:`${e.usedLabel}/${e.capLabel}`}function N(){return t.jsx("span",{className:"hd-gauge-cell hd-gauge-cell--empty",children:"—"})}function w({window:e}){if(!e)return t.jsx(N,{});const a=Math.round(e.fill*100),s=k(e.fill);return t.jsxs("span",{className:"hd-gauge-cell hd-gauge-cell--usage",children:[t.jsx("span",{className:"hd-gauge-window-name",children:e.label}),t.jsx("span",{className:"hd-gauge-bar","aria-hidden":"true",children:t.jsx("span",{className:`hd-gauge-bar-fill hd-gauge-bar-fill--${s}`,style:{width:`${a}%`}})}),t.jsx("span",{className:"hd-gauge-window-used",children:q(e)})]})}function T({window:e,now:a,featured:s=!1}){if(!e)return t.jsx(N,{});if(s){const n=O(e.resetAt,a);return t.jsxs("span",{className:`hd-gauge-cell hd-gauge-reset hd-gauge-reset--featured hd-gauge-reset--${n.tone}`,"aria-live":"off","aria-label":n.ariaLabel,children:[t.jsx("strong",{children:n.primary}),n.dateTime?t.jsx("time",{dateTime:n.dateTime,children:n.secondary}):t.jsx("span",{children:n.secondary})]})}const i=E(e.resetAt,a),r=W(e.resetAt,a);return t.jsxs("span",{className:`hd-gauge-cell hd-gauge-reset${i.imminent?" hd-gauge-reset--imminent":""}`,children:["↻ ",r]})}function O(e,a){if(!Number.isFinite(e))return{primary:"—",secondary:"unknown",ariaLabel:"Weekly reset time unknown",tone:"stale"};const s=e-a.getTime(),i=new Date(e);if(!Number.isFinite(i.getTime()))return{primary:"—",secondary:"unknown",ariaLabel:"Weekly reset time unknown",tone:"stale"};const r=i.toISOString();if(s<=0){const h=Math.abs(s);if(h<=9e4)return{primary:"reset due",secondary:"refreshing…",ariaLabel:"Weekly reset due; refreshing usage",tone:"due",dateTime:r};const p=Math.floor(h/6e4),y=p>=60?`+${Math.floor(p/60)}h ${p%60}m`:`+${Math.max(1,p)}m`;return{primary:h<=360*6e4?"reset due":"stale",secondary:y,ariaLabel:`Weekly reset data ${y} overdue`,tone:h<=360*6e4?"due":"stale",dateTime:r}}const n=Math.floor(s/1e3),l=Math.floor(n/86400),o=Math.floor(n%86400/3600),c=Math.floor(n%3600/60),u=n%60,d=[o,c,u].map(h=>String(h).padStart(2,"0")).join(":"),j=l>0?`${l}d ${d}`:d,f=i.toDateString()===a.toDateString(),m=i.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),x=f?`today ${m}`:`${i.toLocaleDateString([],{weekday:"short"})} ${m}`,g=l>0?`${l} ${l===1?"day":"days"} ${o} hours`:`${o} hours ${c} minutes`;return{primary:j,secondary:x,ariaLabel:`Weekly quota resets in ${g}; ${x}`,tone:s<360*6e4?"imminent":"normal",dateTime:r}}function P(e){if(e.length===0)return"";if(e.length===1)return`M ${e[0].x} ${e[0].y}`;const a=[`M ${e[0].x} ${e[0].y}`];for(let s=0;s<e.length-1;s++){const i=e[s-1]??e[s],r=e[s],n=e[s+1],l=e[s+2]??n,o=r.x+(n.x-i.x)/6,c=r.y+(n.y-i.y)/6,u=n.x-(l.x-r.x)/6,d=n.y-(l.y-r.y)/6;a.push(`C ${o} ${c}, ${u} ${d}, ${n.x} ${n.y}`)}return a.join(" ")}function B(e){const a=$.useRef(null),[s,i]=$.useState(e);return $.useLayoutEffect(()=>{const r=a.current;if(!r)return;const n=o=>{const c=Math.round(o);c>0&&i(u=>u===c?u:c)};n(r.getBoundingClientRect().width);const l=new ResizeObserver(o=>{n(o[0]?.contentRect.width??0)});return l.observe(r),()=>l.disconnect()},[]),[a,s]}function Q({buckets:e}){const[a,s]=B(372),i=70,r=6,n=56,l=67,o=e.length,c=o<2||e.every(g=>g.count===0),u=Math.max(1,s-3),d={viewBox:`0 0 ${s} ${i}`,style:{width:"100%",height:i,display:"block"}};if(c)return t.jsx("div",{ref:a,children:t.jsx("svg",{...d,children:t.jsx("line",{x1:"0",y1:n,x2:s,y2:n,stroke:"var(--border)"})})});const j=u/(o-1),f=e.map((g,h)=>({x:h*j,y:n-Math.max(0,Math.min(1,g.value))*(n-r)})),m=P(f),x=`${m} L ${u} ${n} L 0 ${n} Z`;return t.jsx("div",{ref:a,children:t.jsxs("svg",{...d,children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:"hrdFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:"var(--accent)",stopOpacity:"0.22"}),t.jsx("stop",{offset:"100%",stopColor:"var(--accent)",stopOpacity:"0"})]})}),t.jsx("line",{x1:"0",y1:r,x2:s,y2:r,stroke:"var(--border)",opacity:"0.18"}),t.jsx("line",{x1:"0",y1:(r+n)/2,x2:s,y2:(r+n)/2,stroke:"var(--border)",opacity:"0.22"}),t.jsx("line",{x1:"0",y1:n,x2:s,y2:n,stroke:"var(--border)"}),t.jsx("path",{d:x,fill:"url(#hrdFill)"}),t.jsx("path",{d:m,fill:"none",stroke:"var(--accent)",strokeWidth:"1.5",strokeLinecap:"round"}),t.jsx("circle",{cx:f[o-1].x,cy:f[o-1].y,r:"2.5",fill:"var(--accent)"}),t.jsx("text",{x:"0",y:l,fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"7d"}),t.jsx("text",{x:s/2,y:l,textAnchor:"middle",fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"3d"}),t.jsx("text",{x:s,y:l,textAnchor:"end",fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"now"})]})})}function V({gauge:e,now:a,onClick:s}){const i=s?"button":"span",r=s?{type:"button",onClick:s}:{};if(e.kind==="status")return t.jsxs(i,{className:`hd-gauge hd-gauge--status hd-gauge--${e.tone}${s?" hd-gauge--interactive":""}`,"aria-label":`${e.label} subscription usage`,...r,children:[t.jsxs("span",{className:"hd-gauge-head",children:[t.jsx("span",{className:"hd-gauge-label",children:e.label}),t.jsx("span",{className:`hd-gauge-dot hd-gauge-dot--${e.tone}`,"aria-hidden":"true"})]}),t.jsx(N,{}),t.jsx(N,{}),t.jsxs("span",{className:"hd-gauge-cell hd-gauge-cell--usage hd-gauge-cell--status",children:[t.jsx("span",{className:"hd-gauge-window-name",children:e.windowLabel??"usage"}),t.jsx("span",{className:"hd-gauge-status",children:e.statusLabel})]}),t.jsx("span",{className:"hd-gauge-cell hd-gauge-reset",children:e.detailLabel??"quota n/a"})]});const n=M(e),{shortWindow:l,longWindow:o}=I(n),c=k(Math.max(...n.map(d=>d.fill))),u=Math.round(Math.max(...n.map(d=>d.fill))*100);return t.jsxs(i,{className:`hd-gauge hd-gauge--${c}${s?" hd-gauge--interactive":""}`,title:S(e,a),"aria-label":`${e.label} subscription usage. ${S(e,a)}`,...r,children:[t.jsxs("span",{className:"hd-gauge-head",children:[t.jsx("span",{className:"hd-gauge-label",children:e.label}),t.jsxs("span",{className:`hd-gauge-pct hd-gauge-pct--${c}`,children:[u,"%"]})]}),t.jsx(w,{window:l}),t.jsx(T,{window:l,now:a}),t.jsx(w,{window:o}),t.jsx(T,{window:o,now:a,featured:!0})]})}function z(e){const a=e.trim().match(/^(\d+(?:\.\d+)?)([kKmM])?$/u);if(!a)return 0;const s=Number(a[1]);if(!Number.isFinite(s))return 0;switch(a[2]?.toLowerCase()){case"m":return s*1e6;case"k":return s*1e3;default:return s}}function U(e){return e.kind==="quota"?Math.max(e.fill,...M(e).map(a=>a.fill)):z(e.statusLabel)>0?.01:0}function X(e){return e.kind==="quota"}function K(e){return R(e).slice(0,H)}function R(e){return e.map((a,s)=>({gauge:a,index:s,score:U(a)})).sort((a,s)=>s.score-a.score||a.index-s.index).map(({gauge:a})=>a)}function Z(e){const{now:a,syncLabel:s,error:i,loading:r,refreshing:n,onRefresh:l,navigate:o,heartrate:c,heartrateWindow:u,heartrateBucketLabel:d,heartrateVisibleEventThreshold:j=F,serviceGauges:f}=e,[m,x]=$.useState(!1),g=i?"err":"ok",h=f.filter(X),p=R(h),y=K(h),v=m?p:y,G=h.length>y.length,A=c.reduce((b,D)=>b+D.count,0)>=j;return t.jsxs("section",{className:"hd",children:[t.jsxs("div",{className:`hd-topbar${v.length>0?"":" hd-topbar--bare"}`,children:[t.jsxs("div",{className:"hd-topbar-r",children:[t.jsx("span",{className:`hd-dot hd-dot--${g}`,"aria-hidden":"true"}),t.jsx("span",{className:`hd-meta hd-meta--${g}`,children:s}),t.jsx("span",{className:"hd-topbar-actions",children:t.jsxs("button",{type:"button",className:"hd-btn",disabled:r||n,onClick:l,children:["[",n?"refreshing":"r refresh","]"]})})]}),v.length>0&&t.jsxs("div",{className:"hd-topbar-c","aria-label":"subscription usage",children:[t.jsxs("div",{className:"hd-gauge-title-row",children:[t.jsx("span",{className:"hd-gauge-window",children:"SUBSCRIPTIONS"}),G&&t.jsxs("button",{type:"button",className:"hd-gauge-toggle","aria-expanded":m,onClick:()=>x(b=>!b),children:["[",m?"top 2":`all ${h.length}`,"]"]})]}),t.jsxs("div",{className:"hd-gauge-set",children:[t.jsxs("div",{className:"hd-gauge-table-head","aria-hidden":"true",children:[t.jsx("span",{children:"service"}),t.jsx("span",{children:"short window"}),t.jsx("span",{children:"resets"}),t.jsx("span",{children:"long window"}),t.jsx("span",{children:"resets in"})]}),v.map(b=>t.jsx("span",{className:"hd-gauge-wrap",children:t.jsx(V,{gauge:b,now:a,onClick:()=>o({view:"harnesses"})})},b.id))]})]})]}),A&&t.jsx("div",{className:"hd-grid hd-grid--single",children:t.jsxs("div",{className:"hd-panel hd-panel--hr",children:[t.jsxs("div",{className:"hd-panel-title",children:[t.jsx("span",{children:"HEART-RATE"}),t.jsx("span",{className:"hd-sep",children:"·"}),t.jsx("span",{children:u}),d?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"hd-sep",children:"·"}),t.jsx("span",{children:d})]}):null]}),t.jsx(Q,{buckets:c})]})})]})}export{Z as default};
1
+ import{r as $,j as t}from"./index-o4FKpU7Z.js";const F=3,H=2;function k(e){return e>=.9?"err":e>=.75?"warn":"ok"}const C=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function E(e,a){const s=e-a.getTime(),i=new Date(e).toDateString()===a.toDateString(),r=new Date(e),n=String(r.getHours()).padStart(2,"0"),l=String(r.getMinutes()).padStart(2,"0"),o=s>0&&s<6*3600*1e3;return i?{label:`${n}:${l}`,imminent:o}:{label:`${C[r.getDay()]} ${n}:${l}`,imminent:o}}function W(e,a){const s=Math.floor((e-a.getTime())/1e3),i=s<0,r=Math.abs(s);let n;if(r>=86400){const l=Math.floor(r/86400),o=Math.floor(r%86400/3600);n=o>0?`${l}d ${o}h`:`${l}d`}else if(r>=3600){const l=Math.floor(r/3600),o=Math.floor(r%3600/60);n=o>0?`${l}h ${o}m`:`${l}h`}else n=`${Math.max(1,Math.floor(r/60))}m`;return i?`stale ${n}`:n}function M(e){return e.windows&&e.windows.length>0?e.windows:[{label:_(e.unitLabel),fill:e.fill,usedLabel:e.usedLabel,capLabel:e.capLabel,unitLabel:e.unitLabel,resetAt:e.resetAt}]}function _(e){switch(e){case"weekly":return"7d";case"req/h":return"1h";default:return e||"quota"}}function S(e,a){return M(e).map(s=>{const i=E(s.resetAt,a),r=W(s.resetAt,a);return`${s.label}: ${s.usedLabel} / ${s.capLabel} ${s.unitLabel} · resets ${i.label} (in ${r})`}).join(" · ")}function L(e){const a=e.trim().match(/^(\d+(?:\.\d+)?)([mhd])$/i);if(!a)return null;const s=Number(a[1]);if(!Number.isFinite(s))return null;switch(a[2]?.toLowerCase()){case"m":return s;case"h":return s*60;case"d":return s*24*60;default:return null}}function I(e){const a=[...e].sort((r,n)=>(L(r.label)??Number.MAX_SAFE_INTEGER)-(L(n.label)??Number.MAX_SAFE_INTEGER)),s=a.find(r=>(L(r.label)??0)>=1440)??(a.length>1?a[a.length-1]:null);return{shortWindow:a.find(r=>r!==s)??null,longWindow:s}}function q(e){return e.capLabel==="100%"&&e.usedLabel.endsWith("%")?e.usedLabel:`${e.usedLabel}/${e.capLabel}`}function N(){return t.jsx("span",{className:"hd-gauge-cell hd-gauge-cell--empty",children:"—"})}function w({window:e}){if(!e)return t.jsx(N,{});const a=Math.round(e.fill*100),s=k(e.fill);return t.jsxs("span",{className:"hd-gauge-cell hd-gauge-cell--usage",children:[t.jsx("span",{className:"hd-gauge-window-name",children:e.label}),t.jsx("span",{className:"hd-gauge-bar","aria-hidden":"true",children:t.jsx("span",{className:`hd-gauge-bar-fill hd-gauge-bar-fill--${s}`,style:{width:`${a}%`}})}),t.jsx("span",{className:"hd-gauge-window-used",children:q(e)})]})}function T({window:e,now:a,featured:s=!1}){if(!e)return t.jsx(N,{});if(s){const n=O(e.resetAt,a);return t.jsxs("span",{className:`hd-gauge-cell hd-gauge-reset hd-gauge-reset--featured hd-gauge-reset--${n.tone}`,"aria-live":"off","aria-label":n.ariaLabel,children:[t.jsx("strong",{children:n.primary}),n.dateTime?t.jsx("time",{dateTime:n.dateTime,children:n.secondary}):t.jsx("span",{children:n.secondary})]})}const i=E(e.resetAt,a),r=W(e.resetAt,a);return t.jsxs("span",{className:`hd-gauge-cell hd-gauge-reset${i.imminent?" hd-gauge-reset--imminent":""}`,children:["↻ ",r]})}function O(e,a){if(!Number.isFinite(e))return{primary:"—",secondary:"unknown",ariaLabel:"Weekly reset time unknown",tone:"stale"};const s=e-a.getTime(),i=new Date(e);if(!Number.isFinite(i.getTime()))return{primary:"—",secondary:"unknown",ariaLabel:"Weekly reset time unknown",tone:"stale"};const r=i.toISOString();if(s<=0){const h=Math.abs(s);if(h<=9e4)return{primary:"reset due",secondary:"refreshing…",ariaLabel:"Weekly reset due; refreshing usage",tone:"due",dateTime:r};const p=Math.floor(h/6e4),y=p>=60?`+${Math.floor(p/60)}h ${p%60}m`:`+${Math.max(1,p)}m`;return{primary:h<=360*6e4?"reset due":"stale",secondary:y,ariaLabel:`Weekly reset data ${y} overdue`,tone:h<=360*6e4?"due":"stale",dateTime:r}}const n=Math.floor(s/1e3),l=Math.floor(n/86400),o=Math.floor(n%86400/3600),c=Math.floor(n%3600/60),u=n%60,d=[o,c,u].map(h=>String(h).padStart(2,"0")).join(":"),j=l>0?`${l}d ${d}`:d,f=i.toDateString()===a.toDateString(),m=i.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),x=f?`today ${m}`:`${i.toLocaleDateString([],{weekday:"short"})} ${m}`,g=l>0?`${l} ${l===1?"day":"days"} ${o} hours`:`${o} hours ${c} minutes`;return{primary:j,secondary:x,ariaLabel:`Weekly quota resets in ${g}; ${x}`,tone:s<360*6e4?"imminent":"normal",dateTime:r}}function P(e){if(e.length===0)return"";if(e.length===1)return`M ${e[0].x} ${e[0].y}`;const a=[`M ${e[0].x} ${e[0].y}`];for(let s=0;s<e.length-1;s++){const i=e[s-1]??e[s],r=e[s],n=e[s+1],l=e[s+2]??n,o=r.x+(n.x-i.x)/6,c=r.y+(n.y-i.y)/6,u=n.x-(l.x-r.x)/6,d=n.y-(l.y-r.y)/6;a.push(`C ${o} ${c}, ${u} ${d}, ${n.x} ${n.y}`)}return a.join(" ")}function B(e){const a=$.useRef(null),[s,i]=$.useState(e);return $.useLayoutEffect(()=>{const r=a.current;if(!r)return;const n=o=>{const c=Math.round(o);c>0&&i(u=>u===c?u:c)};n(r.getBoundingClientRect().width);const l=new ResizeObserver(o=>{n(o[0]?.contentRect.width??0)});return l.observe(r),()=>l.disconnect()},[]),[a,s]}function Q({buckets:e}){const[a,s]=B(372),i=70,r=6,n=56,l=67,o=e.length,c=o<2||e.every(g=>g.count===0),u=Math.max(1,s-3),d={viewBox:`0 0 ${s} ${i}`,style:{width:"100%",height:i,display:"block"}};if(c)return t.jsx("div",{ref:a,children:t.jsx("svg",{...d,children:t.jsx("line",{x1:"0",y1:n,x2:s,y2:n,stroke:"var(--border)"})})});const j=u/(o-1),f=e.map((g,h)=>({x:h*j,y:n-Math.max(0,Math.min(1,g.value))*(n-r)})),m=P(f),x=`${m} L ${u} ${n} L 0 ${n} Z`;return t.jsx("div",{ref:a,children:t.jsxs("svg",{...d,children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:"hrdFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:"var(--accent)",stopOpacity:"0.22"}),t.jsx("stop",{offset:"100%",stopColor:"var(--accent)",stopOpacity:"0"})]})}),t.jsx("line",{x1:"0",y1:r,x2:s,y2:r,stroke:"var(--border)",opacity:"0.18"}),t.jsx("line",{x1:"0",y1:(r+n)/2,x2:s,y2:(r+n)/2,stroke:"var(--border)",opacity:"0.22"}),t.jsx("line",{x1:"0",y1:n,x2:s,y2:n,stroke:"var(--border)"}),t.jsx("path",{d:x,fill:"url(#hrdFill)"}),t.jsx("path",{d:m,fill:"none",stroke:"var(--accent)",strokeWidth:"1.5",strokeLinecap:"round"}),t.jsx("circle",{cx:f[o-1].x,cy:f[o-1].y,r:"2.5",fill:"var(--accent)"}),t.jsx("text",{x:"0",y:l,fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"7d"}),t.jsx("text",{x:s/2,y:l,textAnchor:"middle",fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"3d"}),t.jsx("text",{x:s,y:l,textAnchor:"end",fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"now"})]})})}function V({gauge:e,now:a,onClick:s}){const i=s?"button":"span",r=s?{type:"button",onClick:s}:{};if(e.kind==="status")return t.jsxs(i,{className:`hd-gauge hd-gauge--status hd-gauge--${e.tone}${s?" hd-gauge--interactive":""}`,"aria-label":`${e.label} subscription usage`,...r,children:[t.jsxs("span",{className:"hd-gauge-head",children:[t.jsx("span",{className:"hd-gauge-label",children:e.label}),t.jsx("span",{className:`hd-gauge-dot hd-gauge-dot--${e.tone}`,"aria-hidden":"true"})]}),t.jsx(N,{}),t.jsx(N,{}),t.jsxs("span",{className:"hd-gauge-cell hd-gauge-cell--usage hd-gauge-cell--status",children:[t.jsx("span",{className:"hd-gauge-window-name",children:e.windowLabel??"usage"}),t.jsx("span",{className:"hd-gauge-status",children:e.statusLabel})]}),t.jsx("span",{className:"hd-gauge-cell hd-gauge-reset",children:e.detailLabel??"quota n/a"})]});const n=M(e),{shortWindow:l,longWindow:o}=I(n),c=k(Math.max(...n.map(d=>d.fill))),u=Math.round(Math.max(...n.map(d=>d.fill))*100);return t.jsxs(i,{className:`hd-gauge hd-gauge--${c}${s?" hd-gauge--interactive":""}`,title:S(e,a),"aria-label":`${e.label} subscription usage. ${S(e,a)}`,...r,children:[t.jsxs("span",{className:"hd-gauge-head",children:[t.jsx("span",{className:"hd-gauge-label",children:e.label}),t.jsxs("span",{className:`hd-gauge-pct hd-gauge-pct--${c}`,children:[u,"%"]})]}),t.jsx(w,{window:l}),t.jsx(T,{window:l,now:a}),t.jsx(w,{window:o}),t.jsx(T,{window:o,now:a,featured:!0})]})}function z(e){const a=e.trim().match(/^(\d+(?:\.\d+)?)([kKmM])?$/u);if(!a)return 0;const s=Number(a[1]);if(!Number.isFinite(s))return 0;switch(a[2]?.toLowerCase()){case"m":return s*1e6;case"k":return s*1e3;default:return s}}function U(e){return e.kind==="quota"?Math.max(e.fill,...M(e).map(a=>a.fill)):z(e.statusLabel)>0?.01:0}function X(e){return e.kind==="quota"}function K(e){return R(e).slice(0,H)}function R(e){return e.map((a,s)=>({gauge:a,index:s,score:U(a)})).sort((a,s)=>s.score-a.score||a.index-s.index).map(({gauge:a})=>a)}function Z(e){const{now:a,syncLabel:s,error:i,loading:r,refreshing:n,onRefresh:l,navigate:o,heartrate:c,heartrateWindow:u,heartrateBucketLabel:d,heartrateVisibleEventThreshold:j=F,serviceGauges:f}=e,[m,x]=$.useState(!1),g=i?"err":"ok",h=f.filter(X),p=R(h),y=K(h),v=m?p:y,G=h.length>y.length,A=c.reduce((b,D)=>b+D.count,0)>=j;return t.jsxs("section",{className:"hd",children:[t.jsxs("div",{className:`hd-topbar${v.length>0?"":" hd-topbar--bare"}`,children:[t.jsxs("div",{className:"hd-topbar-r",children:[t.jsx("span",{className:`hd-dot hd-dot--${g}`,"aria-hidden":"true"}),t.jsx("span",{className:`hd-meta hd-meta--${g}`,children:s}),t.jsx("span",{className:"hd-topbar-actions",children:t.jsxs("button",{type:"button",className:"hd-btn",disabled:r||n,onClick:l,children:["[",n?"refreshing":"r refresh","]"]})})]}),v.length>0&&t.jsxs("div",{className:"hd-topbar-c","aria-label":"subscription usage",children:[t.jsxs("div",{className:"hd-gauge-title-row",children:[t.jsx("span",{className:"hd-gauge-window",children:"SUBSCRIPTIONS"}),G&&t.jsxs("button",{type:"button",className:"hd-gauge-toggle","aria-expanded":m,onClick:()=>x(b=>!b),children:["[",m?"top 2":`all ${h.length}`,"]"]})]}),t.jsxs("div",{className:"hd-gauge-set",children:[t.jsxs("div",{className:"hd-gauge-table-head","aria-hidden":"true",children:[t.jsx("span",{children:"service"}),t.jsx("span",{children:"short window"}),t.jsx("span",{children:"resets"}),t.jsx("span",{children:"long window"}),t.jsx("span",{children:"resets in"})]}),v.map(b=>t.jsx("span",{className:"hd-gauge-wrap",children:t.jsx(V,{gauge:b,now:a,onClick:()=>o({view:"harnesses"})})},b.id))]})]})]}),A&&t.jsx("div",{className:"hd-grid hd-grid--single",children:t.jsxs("div",{className:"hd-panel hd-panel--hr",children:[t.jsxs("div",{className:"hd-panel-title",children:[t.jsx("span",{children:"HEART-RATE"}),t.jsx("span",{className:"hd-sep",children:"·"}),t.jsx("span",{children:u}),d?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"hd-sep",children:"·"}),t.jsx("span",{children:d})]}):null]}),t.jsx(Q,{buckets:c})]})})]})}export{Z as default};