@openscout/scout 0.2.96 → 0.2.97

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 (305) hide show
  1. package/bin/scoutd +0 -0
  2. package/dist/build-manifest.json +3 -3
  3. package/dist/client/assets/{ActivityScreen-BnoaUkVZ.js → ActivityScreen-y-5DLleY.js} +1 -1
  4. package/dist/client/assets/{AddProjectForm-IqOtJfRs.js → AddProjectForm-r_1tVuWk.js} +1 -1
  5. package/dist/client/assets/{AgentAvatar-6-KBVKUu.js → AgentAvatar-B7c0egdP.js} +1 -1
  6. package/dist/client/assets/{AgentConfigurationScreen-CuZJy07q.js → AgentConfigurationScreen-BD7Unt2P.js} +1 -1
  7. package/dist/client/assets/{AgentDefinitionsWorkspace-Iyl4BesU.js → AgentDefinitionsWorkspace-BbcZc9Xk.js} +1 -1
  8. package/dist/client/assets/{AgentDetailCard-C9rn3Fj5.js → AgentDetailCard-B_KLcgsP.js} +1 -1
  9. package/dist/client/assets/{AgentFloorView-YT-Jjccf.js → AgentFloorView-DMFiHs21.js} +1 -1
  10. package/dist/client/assets/{AgentInfoScreen-Dr99gQEZ.js → AgentInfoScreen-DHGLRddI.js} +1 -1
  11. package/dist/client/assets/{AgentLaneCard-DI2iW9zO.js → AgentLaneCard-ajZvcfdW.js} +1 -1
  12. package/dist/client/assets/{AgentLaneChrome-D8bARHMx.js → AgentLaneChrome-CTp39syR.js} +1 -1
  13. package/dist/client/assets/{AgentLaneDetailSheet-52un7dKC.js → AgentLaneDetailSheet-DRc-TpMB.js} +1 -1
  14. package/dist/client/assets/{AgentLaneSummaryResize-CEBjmPTa.js → AgentLaneSummaryResize-VMNDo7kD.js} +1 -1
  15. package/dist/client/assets/AgentLanesEmbedScreen-C5k_dDS8.js +1 -0
  16. package/dist/client/assets/{AgentLanesPreflight-q20mTjms.js → AgentLanesPreflight-CFadSaia.js} +1 -1
  17. package/dist/client/assets/{AgentLanesView-CetZZDyF.js → AgentLanesView-u5vpLwQf.js} +1 -1
  18. package/dist/client/assets/{AgentLiveActions-DrEJDJef.js → AgentLiveActions-CsQA3pu_.js} +1 -1
  19. package/dist/client/assets/{AgentMasterScreen-DJPnstoD.js → AgentMasterScreen-C5WlWNmk.js} +1 -1
  20. package/dist/client/assets/{AgentSessions-DCPCG4xb.js → AgentSessions-BePq5Lgc.js} +1 -1
  21. package/dist/client/assets/{AgentsConsole-CsYOoFJi.js → AgentsConsole-BuiZ_bDo.js} +1 -1
  22. package/dist/client/assets/{AgentsScreen-k8LvBuU_.js → AgentsScreen-CRi-hG2k.js} +1 -1
  23. package/dist/client/assets/AgentsSubnav-DUsya4WK.js +1 -0
  24. package/dist/client/assets/{AstronautSuit-DbjQtfD_.js → AstronautSuit-Cjjcv6yQ.js} +1 -1
  25. package/dist/client/assets/{AtopView-Daq_ob3z.js → AtopView-PxWQd-sX.js} +1 -1
  26. package/dist/client/assets/{BackToPicker-CXZjBRAe.js → BackToPicker-Cto0Ioz9.js} +1 -1
  27. package/dist/client/assets/{BriefingDetailScreen-CUCXO-KH.js → BriefingDetailScreen-C29smC5d.js} +1 -1
  28. package/dist/client/assets/{BriefingsScreen-B5oMTGKv.js → BriefingsScreen-DNyFBrPn.js} +1 -1
  29. package/dist/client/assets/{BrokerMetadataPanel-BsiU8lTD.js → BrokerMetadataPanel-DbaCQlhw.js} +1 -1
  30. package/dist/client/assets/{BrokerScreen-BPbOHhCS.js → BrokerScreen-CS0s4Gm4.js} +1 -1
  31. package/dist/client/assets/{CastPicker-_5E5hNUe.js → CastPicker-CTBHjjGw.js} +1 -1
  32. package/dist/client/assets/{ChatCollapsedStrip-D-eXhzPf.js → ChatCollapsedStrip-D4rc7wBQ.js} +1 -1
  33. package/dist/client/assets/{CodeDiffPane-n7W4iGUG.js → CodeDiffPane-QvxCUzTi.js} +1 -1
  34. package/dist/client/assets/{CodeProjectPicker-CMsbSTDq.js → CodeProjectPicker-DplkpM7f.js} +1 -1
  35. package/dist/client/assets/{CodeScreen-CeuO3EhR.js → CodeScreen-CrR2JaVj.js} +1 -1
  36. package/dist/client/assets/{ConversationComposer-CXPKx86g.js → ConversationComposer-H8_hsYSc.js} +1 -1
  37. package/dist/client/assets/{ConversationFeedRows-WrH-YI3L.js → ConversationFeedRows-hlEFlURs.js} +1 -1
  38. package/dist/client/assets/{ConversationHeader-BQWzGzLK.js → ConversationHeader-B0ZBhE_E.js} +1 -1
  39. package/dist/client/assets/{ConversationPanels-Dujvnmup.js → ConversationPanels-fMo6Uy1v.js} +2 -2
  40. package/dist/client/assets/{ConversationScreen-CR9pWB65.js → ConversationScreen-CXAHQwQ3.js} +1 -1
  41. package/dist/client/assets/{ConversationStatus-DVzSb2Hv.js → ConversationStatus-DI5GCiyW.js} +1 -1
  42. package/dist/client/assets/{CrewAvatar-BwXjyg8N.js → CrewAvatar-CXJHLNVM.js} +1 -1
  43. package/dist/client/assets/CrewWorkspaces-Bz2Dcnt4.js +1 -0
  44. package/dist/client/assets/CrewWorkspaces-Diq11KDq.css +1 -0
  45. package/dist/client/assets/{DataTable-Bp8tU9AK.js → DataTable-DXIlOlVu.js} +1 -1
  46. package/dist/client/assets/{DispatchAftermath-B-6rmXzL.js → DispatchAftermath-CrELgl2e.js} +1 -1
  47. package/dist/client/assets/{DocumentFocusViewer-Do3wQ_3Z.js → DocumentFocusViewer-DFFE85Tq.js} +1 -1
  48. package/dist/client/assets/{EmbeddableSurfacesLab-C1orRyP9.js → EmbeddableSurfacesLab-DgpewB3y.js} +1 -1
  49. package/dist/client/assets/{EmptyState-CJzXj1l5.js → EmptyState-D9X16fKq.js} +1 -1
  50. package/dist/client/assets/{FileViewerPane-Df6VzXjA.js → FileViewerPane-CY0RN78e.js} +1 -1
  51. package/dist/client/assets/{FlightObserveScreen-6mGnmWQA.js → FlightObserveScreen-qyzHzxLa.js} +1 -1
  52. package/dist/client/assets/{FollowScreen-DvnxYLVh.js → FollowScreen-wZ-z67mX.js} +1 -1
  53. package/dist/client/assets/{HarnessMark-B979GCSB.js → HarnessMark-DAaWPiT_.js} +1 -1
  54. package/dist/client/assets/{HarnessesScreen-CHTuv8p6.js → HarnessesScreen-DbKkQM4o.js} +1 -1
  55. package/dist/client/assets/{HerdrSession-B3McuYgi.js → HerdrSession-CYKRfBad.js} +1 -1
  56. package/dist/client/assets/{HomeHero-CdUVPjkG.js → HomeHero-DYyd3cpz.js} +1 -1
  57. package/dist/client/assets/{HostAdvisorView-Bok5Sk5c.js → HostAdvisorView-NtM0bsg8.js} +1 -1
  58. package/dist/client/assets/{KnowledgeSearchInspector-B7XSoJsu.js → KnowledgeSearchInspector-CU6BCFcS.js} +1 -1
  59. package/dist/client/assets/{KnowledgeSearchScreen-D3o3IODW.js → KnowledgeSearchScreen-DvbRRPQB.js} +1 -1
  60. package/dist/client/assets/{LaneToolHoverCard-HByf2ndx.js → LaneToolHoverCard-Bo2Zl-1a.js} +1 -1
  61. package/dist/client/assets/{LaneTraceDetailSheet-BUgHz-sd.js → LaneTraceDetailSheet-C3C8UjXv.js} +1 -1
  62. package/dist/client/assets/{LaneTraceEventFocus-DM-hoPxG.js → LaneTraceEventFocus-Cek_64zR.js} +1 -1
  63. package/dist/client/assets/{MeshCanvas-DCLJRsBy.js → MeshCanvas-TvsID4fe.js} +1 -1
  64. package/dist/client/assets/{MeshCanvasMinimap-cEFS9eW7.js → MeshCanvasMinimap-CxqeVVco.js} +1 -1
  65. package/dist/client/assets/{MeshScreen-BcxPkhm6.js → MeshScreen-BJ-j9YXv.js} +1 -1
  66. package/dist/client/assets/{MeshTopologyView-CCRPd8PU.js → MeshTopologyView-BjprutE8.js} +2 -2
  67. package/dist/client/assets/{MessagesScreen-Bb5l13MO.js → MessagesScreen-CyNIZ3-X.js} +1 -1
  68. package/dist/client/assets/{MissionContextRail-DF0_kiU7.js → MissionContextRail-Be0uXljQ.js} +1 -1
  69. package/dist/client/assets/{MissionControlView-E3V7bENU.js → MissionControlView-Bj7cAbZd.js} +1 -1
  70. package/dist/client/assets/{MissionFocusOverlay-h15sQFvP.js → MissionFocusOverlay-DvTw6ts5.js} +1 -1
  71. package/dist/client/assets/{MissionLeftAgentRow-KPdk9rSa.js → MissionLeftAgentRow-B0QG7Gys.js} +1 -1
  72. package/dist/client/assets/{MissionLogPane-BbdDKjUl.js → MissionLogPane-EsM_S3ro.js} +1 -1
  73. package/dist/client/assets/{NewAgentModal-DfHxad34.js → NewAgentModal-Cqiq1CE1.js} +1 -1
  74. package/dist/client/assets/{NewChatComposer-_Stj0fZy.js → NewChatComposer-C_1op4dH.js} +1 -1
  75. package/dist/client/assets/{NewChatOrigin-B1u7ki70.js → NewChatOrigin-D7hwp6dm.js} +1 -1
  76. package/dist/client/assets/{ObserveEmbedScreen-Co0xTii6.js → ObserveEmbedScreen-CGHI_hb5.js} +1 -1
  77. package/dist/client/assets/{ObserveTextFlow-ZQWwrK3i.js → ObserveTextFlow-BcrGQet8.js} +2 -2
  78. package/dist/client/assets/{ObservedTopologyPanel-BJUhDSuQ.js → ObservedTopologyPanel-BhVsvwkh.js} +1 -1
  79. package/dist/client/assets/{OpenScoutAppShell-CUd2yOLu.js → OpenScoutAppShell-BtfvMkAp.js} +1 -1
  80. package/dist/client/assets/{OpsAgentsView-DI5wu1si.js → OpsAgentsView-DBYtmLnh.js} +1 -1
  81. package/dist/client/assets/OpsScreen-CuYVgkC_.js +1 -0
  82. package/dist/client/assets/OpsSubnav-BEU4kKXm.js +1 -0
  83. package/dist/client/assets/ProjectAgentProfile-BhXAZEkW.js +1 -0
  84. package/dist/client/assets/{ProjectAgentProfileBar-k2QHHHsQ.js → ProjectAgentProfileBar-uJw9Wdfk.js} +1 -1
  85. package/dist/client/assets/{ProjectAgentProfileHero-Bpxk1ui2.js → ProjectAgentProfileHero-CIMS4Dy_.js} +1 -1
  86. package/dist/client/assets/{ProjectsInbox-C_bMHLCc.js → ProjectsInbox-JgU0lrY8.js} +1 -1
  87. package/dist/client/assets/{ProjectsRail-J-aH_pxT.js → ProjectsRail-p99BRBOa.js} +1 -1
  88. package/dist/client/assets/ProjectsScreen-BB45DU53.js +1 -0
  89. package/dist/client/assets/{ProjectsThreadAside-_ourdM-Q.js → ProjectsThreadAside-BHDTJWOz.js} +1 -1
  90. package/dist/client/assets/{Provider-CtXJeLrP.js → Provider-Bu-C8Hxc.js} +1 -1
  91. package/dist/client/assets/{RailRow-CEH2MFBw.js → RailRow-ClMmtaIE.js} +1 -1
  92. package/dist/client/assets/{RawSessionsTable-CDyrom-F.js → RawSessionsTable-BtKdQPiv.js} +1 -1
  93. package/dist/client/assets/{RealtimeVoiceScreen-DBl3DN1H.js → RealtimeVoiceScreen-KPHJgO1l.js} +1 -1
  94. package/dist/client/assets/{RepoDiffEmbedScreen-kY2pHjIs.js → RepoDiffEmbedScreen-CjZ5ew3y.js} +1 -1
  95. package/dist/client/assets/{RepoDiffPageScreen-C6LhoKrn.js → RepoDiffPageScreen-CdTFfmbk.js} +1 -1
  96. package/dist/client/assets/{RepoDiffViewer-BhcIIQQg.js → RepoDiffViewer-BFperHQg.js} +1 -1
  97. package/dist/client/assets/{RepoDiffViewerLazy-Csy_j9LD.js → RepoDiffViewerLazy-BkBmbi1Z.js} +2 -2
  98. package/dist/client/assets/{ReposScreen-B_cB0zu7.js → ReposScreen-C8dT4bK0.js} +1 -1
  99. package/dist/client/assets/{ScoutDeckSurface-CSy_fjcG.js → ScoutDeckSurface-BcJsm2Kq.js} +1 -1
  100. package/dist/client/assets/{ScoutSurface-CQVcSrin.js → ScoutSurface-DmzEtrx8.js} +1 -1
  101. package/dist/client/assets/{ScoutbotFxLab-DqGiLYNy.js → ScoutbotFxLab-DU15Plja.js} +1 -1
  102. package/dist/client/assets/{SecondaryNav-BR4VRdgh.js → SecondaryNav-BrXMtvKE.js} +1 -1
  103. package/dist/client/assets/{SessionEmbedScreen-BTlZ9gAg.js → SessionEmbedScreen-Bt4flmAx.js} +1 -1
  104. package/dist/client/assets/{SessionObserve-dQDN23pP.js → SessionObserve-BCehTlO8.js} +1 -1
  105. package/dist/client/assets/{SessionObserveEvidence-BRBGKAgd.js → SessionObserveEvidence-Bb6U-dem.js} +1 -1
  106. package/dist/client/assets/{SessionRefScreen-COVQMbtE.js → SessionRefScreen-C8BiRVPx.js} +1 -1
  107. package/dist/client/assets/SessionsScreen-BNvjUflN.js +1 -0
  108. package/dist/client/assets/{SettingsDrawer-RGVK_bmE.js → SettingsDrawer-BieUmb8g.js} +1 -1
  109. package/dist/client/assets/{SettingsScreen-CCxzy5IU.js → SettingsScreen-3JvX1WFL.js} +1 -1
  110. package/dist/client/assets/{ShikiPane-DYI9Hkge.js → ShikiPane-DPWsVNtn.js} +1 -1
  111. package/dist/client/assets/{SlidePanel-B9ugxWgA.js → SlidePanel-BMRIR6bH.js} +1 -1
  112. package/dist/client/assets/{SpriteAvatar-z5hHesx9.js → SpriteAvatar-56DTXxSV.js} +1 -1
  113. package/dist/client/assets/{StatusPill-BFvMjmZV.js → StatusPill-BcuYUgsD.js} +1 -1
  114. package/dist/client/assets/{TailView-0uEIj2JH.js → TailView-BDy8c2VB.js} +1 -1
  115. package/dist/client/assets/{Terminal-DouZeNxc.js → Terminal-BlUQY9_Z.js} +1 -1
  116. package/dist/client/assets/{TerminalEmbedScreen-dMNUbzXr.js → TerminalEmbedScreen-DTjxktyr.js} +1 -1
  117. package/dist/client/assets/{TerminalHeaderMount-BL07cd0q.js → TerminalHeaderMount-Cy-uxkey.js} +1 -1
  118. package/dist/client/assets/{TextDocumentSurface-BflAwXeZ.js → TextDocumentSurface-BeSwe3Yl.js} +1 -1
  119. package/dist/client/assets/{TmuxPeek-BTnjOQi0.js → TmuxPeek-B4no_aGI.js} +1 -1
  120. package/dist/client/assets/{VoicePermissionsPanel-CgQ6GGS-.js → VoicePermissionsPanel-Bd16scwz.js} +1 -1
  121. package/dist/client/assets/{WorkDetailScreen-CaLG-zDs.js → WorkDetailScreen-DIFQufak.js} +1 -1
  122. package/dist/client/assets/{WorkFilesViewer-B9Sil_No.js → WorkFilesViewer-CT5XEFGf.js} +1 -1
  123. package/dist/client/assets/{activity-DcrMApUY.js → activity-CqZafWfx.js} +1 -1
  124. package/dist/client/assets/{addon-fit-DMVrz5Sv.js → addon-fit-CM6F_JRD.js} +1 -1
  125. package/dist/client/assets/{addon-webgl-BYvpZUyu.js → addon-webgl-DRTiePFC.js} +1 -1
  126. package/dist/client/assets/{agent-autocomplete-B-5QTeas.js → agent-autocomplete-DXUBnlkN.js} +1 -1
  127. package/dist/client/assets/{agent-essentials-D7KRGYvF.js → agent-essentials-vytdybaX.js} +1 -1
  128. package/dist/client/assets/{agent-master-model-DqjrVI2h.js → agent-master-model-DAZL92oe.js} +1 -1
  129. package/dist/client/assets/{agent-specialization-BujJVUTD.js → agent-specialization-BtxLN4UR.js} +1 -1
  130. package/dist/client/assets/agents-project-DgbqDc65.css +1 -0
  131. package/dist/client/assets/{arc.es-NHqHWohb.js → arc.es-Bh84oHJ7.js} +1 -1
  132. package/dist/client/assets/{arrow-down-CKtSUjmW.js → arrow-down-DvTsLokL.js} +1 -1
  133. package/dist/client/assets/{arrow-left-Czpf-AE4.js → arrow-left-DHfdXJVZ.js} +1 -1
  134. package/dist/client/assets/{arrow-right-BuzMnLYP.js → arrow-right-BBsrogWf.js} +1 -1
  135. package/dist/client/assets/{arrow-up-right-C6Wl-1uw.js → arrow-up-right-CY0Vw_67.js} +1 -1
  136. package/dist/client/assets/{bot-rd0awxD3.js → bot-DzkOUFBb.js} +1 -1
  137. package/dist/client/assets/{check-ofKUE8yH.js → check-DbIkldnK.js} +1 -1
  138. package/dist/client/assets/{chevron-down-wciXnOQz.js → chevron-down-C475vltS.js} +1 -1
  139. package/dist/client/assets/{chevron-right-D-HdlPg8.js → chevron-right-CnZRSd-V.js} +1 -1
  140. package/dist/client/assets/{chunk-HRAB3GC3-Tyv9rzx7.js → chunk-HRAB3GC3-DLNT8aOo.js} +1 -1
  141. package/dist/client/assets/{chunk-JTPDIGGW-BC2Mandc.js → chunk-JTPDIGGW-Ci5j4vzV.js} +3 -3
  142. package/dist/client/assets/{chunk-T65CQEWV-C1AWTYZZ.js → chunk-T65CQEWV-BtNvicWs.js} +1 -1
  143. package/dist/client/assets/{chunk-YOZR3KYS-DwHPHa6f.js → chunk-YOZR3KYS-DN5EJulq.js} +1 -1
  144. package/dist/client/assets/{clock-B88r8OrZ.js → clock-DVvENUU5.js} +1 -1
  145. package/dist/client/assets/{code-xml-D7pOQM9l.js → code-xml-CvKBY3KA.js} +1 -1
  146. package/dist/client/assets/{compass-Dt1AMXz2.js → compass-BcRI_YXo.js} +1 -1
  147. package/dist/client/assets/content--T3p6akp.js +1 -0
  148. package/dist/client/assets/content-4nFMLuzF.js +1 -0
  149. package/dist/client/assets/content-BJ4nHvcu.js +1 -0
  150. package/dist/client/assets/{content-nkx0swDe.js → content-BNyAjpUl.js} +1 -1
  151. package/dist/client/assets/content-BmGp9wNl.js +1 -0
  152. package/dist/client/assets/content-CBWhwaRo.js +1 -0
  153. package/dist/client/assets/{content-C9ijJxyl.js → content-CQlykFbe.js} +1 -1
  154. package/dist/client/assets/content-CevL0DgF.js +1 -0
  155. package/dist/client/assets/content-Ch8pf2bj.js +1 -0
  156. package/dist/client/assets/content-Cpvdcm_l.js +1 -0
  157. package/dist/client/assets/content-DfS3vgAu.js +1 -0
  158. package/dist/client/assets/content-DpQdNePJ.js +1 -0
  159. package/dist/client/assets/content-Dqpibejl.js +1 -0
  160. package/dist/client/assets/content-TV0nd6-r.js +1 -0
  161. package/dist/client/assets/{content-BWPNyXJ0.js → content-odbb5H4U.js} +1 -1
  162. package/dist/client/assets/content-uXHLPHe0.js +1 -0
  163. package/dist/client/assets/{conversation-icons-tp9BX6X2.js → conversation-icons-CBMKBGHd.js} +1 -1
  164. package/dist/client/assets/{conversation-model-Dc02NsGp.js → conversation-model-QsJVfSeG.js} +1 -1
  165. package/dist/client/assets/conversation-motion-features-BFLHX2eg.js +1 -0
  166. package/dist/client/assets/{copy-CWWAJ75H.js → copy-Cj-owMb-.js} +1 -1
  167. package/dist/client/assets/{cpu-DrqejfkB.js → cpu-DuD3RFX5.js} +1 -1
  168. package/dist/client/assets/{createLucideIcon-DezKXSG2.js → createLucideIcon-DthwWQIg.js} +1 -1
  169. package/dist/client/assets/{discover-C2CZO4Tk.js → discover-B3uQlh5L.js} +2 -2
  170. package/dist/client/assets/embed-entry-DkRcHKTh.js +2 -0
  171. package/dist/client/assets/{external-link-Dp_a2vRZ.js → external-link-C_nxk0MJ.js} +1 -1
  172. package/dist/client/assets/{eye-BRyD0jno.js → eye-FnaaPfja.js} +1 -1
  173. package/dist/client/assets/{file-code-corner-muIVH_xO.js → file-code-corner-DDPq4Cur.js} +1 -1
  174. package/dist/client/assets/{file-text-CqJgwxmv.js → file-text--hfhwZH1.js} +1 -1
  175. package/dist/client/assets/{gauge-hU--hKVP.js → gauge-BVEknshP.js} +1 -1
  176. package/dist/client/assets/{gestures-DN4hEeqv.js → gestures-3gw5VgUS.js} +1 -1
  177. package/dist/client/assets/{git-branch-CK5v8F2v.js → git-branch-DJyvr0k-.js} +1 -1
  178. package/dist/client/assets/{home-moving-signal-BjDtEJUP.js → home-moving-signal-BPqBoNSm.js} +1 -1
  179. package/dist/client/assets/{home-now-card-nF8OotI-.js → home-now-card-UspVW2-2.js} +1 -1
  180. package/dist/client/assets/{home-now-card-nano-C-r_bBg5.js → home-now-card-nano-G8kMB32m.js} +1 -1
  181. package/dist/client/assets/{hooks-D46bABUP.js → hooks-BMsQzo9j.js} +1 -1
  182. package/dist/client/assets/{index-DvLtl7rV.js → index-BI9AljSD.js} +2 -2
  183. package/dist/client/assets/{index-kL1WLbeS.js → index-C-v0Z6ZS.js} +1 -1
  184. package/dist/client/assets/{index-CPrU5q04.js → index-D9DzUORB.js} +1 -1
  185. package/dist/client/assets/index-DfsTyYDx.js +1 -0
  186. package/dist/client/assets/{inspector-panel-Dkc7rLvY.js → inspector-panel-CFSArQ8Y.js} +1 -1
  187. package/dist/client/assets/{keyboard-nav-BLYDhL3Z.js → keyboard-nav-e6yGeorb.js} +1 -1
  188. package/dist/client/assets/{lane-roster-store-DOdI1O13.js → lane-roster-store-Q7pcblY5.js} +1 -1
  189. package/dist/client/assets/{layers-CSsg3JVP.js → layers-Dz2dKOnU.js} +1 -1
  190. package/dist/client/assets/{layout-grid-DOChPJdZ.js → layout-grid-Bvs5fdB4.js} +1 -1
  191. package/dist/client/assets/{left-BNRFiRsb.js → left-B4Ak-Ibt.js} +1 -1
  192. package/dist/client/assets/{left-BggzhgXN.js → left-BMb493FZ.js} +1 -1
  193. package/dist/client/assets/{left-YT7mIGuH.js → left-BjFLvVOC.js} +1 -1
  194. package/dist/client/assets/{left-B3wSE6ql.js → left-CsXQ8Q3G.js} +1 -1
  195. package/dist/client/assets/left-FNH7faCI.js +1 -0
  196. package/dist/client/assets/{left-CARCvvxS.js → left-POkqE8gI.js} +1 -1
  197. package/dist/client/assets/{left-CpokZYHt.js → left-UulOTcWh.js} +1 -1
  198. package/dist/client/assets/{left-advisor-CCY0vkcO.js → left-advisor-CJkQS2d6.js} +1 -1
  199. package/dist/client/assets/{left-agents-trhO5sL8.js → left-agents-CFMxyEjT.js} +1 -1
  200. package/dist/client/assets/{left-default-CG33elBs.js → left-default-rnX5HANc.js} +1 -1
  201. package/dist/client/assets/{left-lanes-CitMgeTp.js → left-lanes-BpLXT_qH.js} +1 -1
  202. package/dist/client/assets/{left-mission-Zl2m_5eU.js → left-mission-B0bhseWw.js} +1 -1
  203. package/dist/client/assets/library-D1iXfda2.js +1 -0
  204. package/dist/client/assets/{loader-circle-pM56HNhR.js → loader-circle-B2W9DPG5.js} +1 -1
  205. package/dist/client/assets/{local-agents-C8xAhbO5.js → local-agents-DKr-gIDC.js} +1 -1
  206. package/dist/client/assets/{mentions-DG6OQrsc.js → mentions-DuLQnEcn.js} +1 -1
  207. package/dist/client/assets/{mesh-ops-BZ1h5RQs.js → mesh-ops-CRR-KnCG.js} +1 -1
  208. package/dist/client/assets/{mesh-view-store-ChUOASK8.js → mesh-view-store-CiET-yN8.js} +1 -1
  209. package/dist/client/assets/{message-circle-mZCv8tvB.js → message-circle-B2DoYKDO.js} +1 -1
  210. package/dist/client/assets/{message-markup-C2LQDm_k.js → message-markup-Cc_O-WdA.js} +1 -1
  211. package/dist/client/assets/{message-square-C7t_qtuj.js → message-square-O-Hu9Mk2.js} +1 -1
  212. package/dist/client/assets/{mission-control-store-nDLdUZPA.js → mission-control-store-DDAgWKUl.js} +1 -1
  213. package/dist/client/assets/{observe-BpEm1INu.js → observe-Da2mRAsc.js} +1 -1
  214. package/dist/client/assets/{page-status-E5jnk48p.js → page-status-Crtgjbq3.js} +1 -1
  215. package/dist/client/assets/{paperclip-C64lkcbM.js → paperclip-BudMKSyr.js} +1 -1
  216. package/dist/client/assets/{persistent-state-EHXw8WNy.js → persistent-state-xJz-qAFc.js} +1 -1
  217. package/dist/client/assets/{plus-Co-dqKul.js → plus-BJ1If8vj.js} +1 -1
  218. package/dist/client/assets/{profile-APxDsN2P.js → profile-B3qDSbrH.js} +1 -1
  219. package/dist/client/assets/{projects-inbox-Cg4X2lUQ.js → projects-inbox-CLek3QaG.js} +1 -1
  220. package/dist/client/assets/{proxy-BiW5suC7.js → proxy-1BABCaDb.js} +1 -1
  221. package/dist/client/assets/{radio-BOxBQX-T.js → radio-B5OpHrrK.js} +1 -1
  222. package/dist/client/assets/{refresh-cw-DMxGzDwn.js → refresh-cw-DmNAhaH0.js} +1 -1
  223. package/dist/client/assets/resolve-panes-DXw-cHaj.js +1 -0
  224. package/dist/client/assets/resolve-sidebar-context-CDdbRDEa.js +1 -0
  225. package/dist/client/assets/{right-Bmfd3pjP.js → right-BgJ4mQLf.js} +1 -1
  226. package/dist/client/assets/{right-Dz_xD0Vj.js → right-Bk6h7o-Z.js} +1 -1
  227. package/dist/client/assets/{right-CkCCPbCX.js → right-BrICCmEt.js} +1 -1
  228. package/dist/client/assets/{right-CdkcrmeD.js → right-C1QIbqFZ.js} +1 -1
  229. package/dist/client/assets/{right-BwlW6E57.js → right-CfliKiHY.js} +1 -1
  230. package/dist/client/assets/{right-BuCgE0fZ.js → right-CtOLXB9s.js} +1 -1
  231. package/dist/client/assets/{right-CimaAvQN.js → right-D8id_DWQ.js} +1 -1
  232. package/dist/client/assets/{right-C0ybUw0j.js → right-DJ34yMAi.js} +1 -1
  233. package/dist/client/assets/{right-D3eSiy41.js → right-DiFmtw6d.js} +1 -1
  234. package/dist/client/assets/{right-BqI-nr9G.js → right-Lx79pxpG.js} +1 -1
  235. package/dist/client/assets/{rocket-BQm5_CvR.js → rocket-D3-TUJ2m.js} +1 -1
  236. package/dist/client/assets/{router-B9vQkNJL.js → router-DTtux5sP.js} +1 -1
  237. package/dist/client/assets/{scope-views-1IYJdl41.js → scope-views-CPM0sBw_.js} +1 -1
  238. package/dist/client/assets/{scout-voice-BVUqGhth.js → scout-voice-BZKsdquE.js} +1 -1
  239. package/dist/client/assets/{scoutbot-markdown-BQ_Ee2Ic.js → scoutbot-markdown-CQ7Y1McC.js} +1 -1
  240. package/dist/client/assets/{scroll-text-Dze_dXtQ.js → scroll-text-kPhYbh-M.js} +1 -1
  241. package/dist/client/assets/{search-CDko0PKE.js → search-DmFM_9jm.js} +1 -1
  242. package/dist/client/assets/{secondaryNavConfig-BoQ_zYR9.js → secondaryNavConfig-C9bQ9_IA.js} +1 -1
  243. package/dist/client/assets/{selection-bridge-Din6yV3h.js → selection-bridge-Dy2mtMyi.js} +1 -1
  244. package/dist/client/assets/{send-horizontal-CSjIm6xg.js → send-horizontal-qyjNgEaV.js} +1 -1
  245. package/dist/client/assets/{server-Bzj7lPIx.js → server-nWqndnxu.js} +1 -1
  246. package/dist/client/assets/{session-catalog-DsaZJXZt.js → session-catalog-BkmktBHI.js} +1 -1
  247. package/dist/client/assets/{session-table-BQfR7u6r.js → session-table-DKSF0mrS.js} +1 -1
  248. package/dist/client/assets/{settings-Dyvpkb1D.js → settings-C6h9y5XX.js} +1 -1
  249. package/dist/client/assets/{sliders-horizontal-C8njVwfg.js → sliders-horizontal-BhHKxsCO.js} +1 -1
  250. package/dist/client/assets/{sparkles-CETYrxGA.js → sparkles-Cf8gin88.js} +1 -1
  251. package/dist/client/assets/{sse-CD9MMUxl.js → sse-DDHEHUgz.js} +1 -1
  252. package/dist/client/assets/{tail-events-Ps8KpKah.js → tail-events-BdUrO0kb.js} +1 -1
  253. package/dist/client/assets/{terminal-9GRS_Qdc.js → terminal-C3YRPfyz.js} +1 -1
  254. package/dist/client/assets/{terminal-relay-GYMIvKs1.js → terminal-relay-BFhdIstF.js} +1 -1
  255. package/dist/client/assets/{terminal-takeover-_Jyys4me.js → terminal-takeover-B6H4llRR.js} +1 -1
  256. package/dist/client/assets/{text-BP3oyl8-.js → text-Faa3ZStB.js} +1 -1
  257. package/dist/client/assets/{use-conversation-list-C9ABzjXI.js → use-conversation-list-DO5J8T1H.js} +1 -1
  258. package/dist/client/assets/{use-fleet-active-asks-DAspZQjE.js → use-fleet-active-asks-BtgNnRgK.js} +1 -1
  259. package/dist/client/assets/{use-mesh-ops-items-Dh54ymEp.js → use-mesh-ops-items-N1HHhChY.js} +1 -1
  260. package/dist/client/assets/{use-reduced-motion-x8pJMVrG.js → use-reduced-motion-8WuxLa5l.js} +1 -1
  261. package/dist/client/assets/{use-scout-dev-flags-DhCbiDK3.js → use-scout-dev-flags-B31qTy6m.js} +1 -1
  262. package/dist/client/assets/{useAgentHoverCard-DoBwV0LX.js → useAgentHoverCard-Bkv-Uz_V.js} +1 -1
  263. package/dist/client/assets/useContentSecondaryNav-Bpkc8ayb.js +1 -0
  264. package/dist/client/assets/{usePierreRuntime-ejq9dCWV.js → usePierreRuntime-BfZHKAkI.js} +1 -1
  265. package/dist/client/assets/{wrench-DjkoAOQt.js → wrench-DkxnZRlR.js} +1 -1
  266. package/dist/client/assets/{x-CAbNespN.js → x-DfRJbqrh.js} +1 -1
  267. package/dist/client/assets/{xterm-Cf-ngcGP.js → xterm-CJw8Epxv.js} +1 -1
  268. package/dist/client/assets/{zap-Cq8eWkcF.js → zap-CIo8msJB.js} +1 -1
  269. package/dist/client/index.html +1 -1
  270. package/dist/main.mjs +65 -21
  271. package/dist/pairing-runtime-controller.mjs +8 -0
  272. package/dist/runtime/broker-daemon.mjs +58 -10
  273. package/dist/scout-control-plane-web.mjs +8 -0
  274. package/package.json +2 -2
  275. package/dist/client/assets/AgentLanesEmbedScreen-Dgcm7zd_.js +0 -1
  276. package/dist/client/assets/AgentsSubnav-C4xpQhsv.js +0 -1
  277. package/dist/client/assets/CrewWorkspaces-CkQDhyie.css +0 -1
  278. package/dist/client/assets/CrewWorkspaces-NKujRzwh.js +0 -1
  279. package/dist/client/assets/OpsScreen-D8fQafCl.js +0 -1
  280. package/dist/client/assets/OpsSubnav-1K4Jaf__.js +0 -1
  281. package/dist/client/assets/ProjectAgentProfile-Bdjd_dAx.js +0 -1
  282. package/dist/client/assets/ProjectsScreen-cVUkGbPz.js +0 -1
  283. package/dist/client/assets/SessionsScreen--5OJ3p3v.js +0 -1
  284. package/dist/client/assets/agents-project-COzHxZAF.css +0 -1
  285. package/dist/client/assets/content-9K38QchR.js +0 -1
  286. package/dist/client/assets/content-BRgnyXWh.js +0 -1
  287. package/dist/client/assets/content-BdkI07v3.js +0 -1
  288. package/dist/client/assets/content-C4oWa8SB.js +0 -1
  289. package/dist/client/assets/content-CFZ4rghn.js +0 -1
  290. package/dist/client/assets/content-CIqu_Ci_.js +0 -1
  291. package/dist/client/assets/content-CnJF9DGO.js +0 -1
  292. package/dist/client/assets/content-CriW8Y8u.js +0 -1
  293. package/dist/client/assets/content-DDCyPPk_.js +0 -1
  294. package/dist/client/assets/content-DtcZeh5m.js +0 -1
  295. package/dist/client/assets/content-U9tsdtle.js +0 -1
  296. package/dist/client/assets/content-hFLK3CON.js +0 -1
  297. package/dist/client/assets/content-p00KQrtD.js +0 -1
  298. package/dist/client/assets/conversation-motion-features-D9-RmBSq.js +0 -1
  299. package/dist/client/assets/embed-entry-BSMUykuG.js +0 -2
  300. package/dist/client/assets/index-zvhpRHao.js +0 -1
  301. package/dist/client/assets/left-B-SdEJSJ.js +0 -1
  302. package/dist/client/assets/library-DkALuCh5.js +0 -1
  303. package/dist/client/assets/resolve-panes-DeVJbS9c.js +0 -1
  304. package/dist/client/assets/resolve-sidebar-context-BQe5J6xF.js +0 -1
  305. package/dist/client/assets/useContentSecondaryNav-pZe2Zfk1.js +0 -1
@@ -1,2 +1,2 @@
1
- import{j as r,r as o}from"./index-DvLtl7rV.js";import{o as ht,w as aa,q as Jt,s as Fs,t as ra,u as oa,v as ia,x as Os,y as la,z as ca,A as da,B as ua}from"./NewChatComposer-_Stj0fZy.js";import{a as B}from"./api-Co9aQ2Jw.js";import"./text-BP3oyl8-.js";import{u as ma,C as ha}from"./ConversationComposer-CXPKx86g.js";import"./index-zvhpRHao.js";import{u as pa,d as fa,a as ga}from"./Provider-CtXJeLrP.js";import{d as ya,b as ba,x as ne,y as Ps,z as wa,A as Ce,B as Sa,D as Ta,E as xa,F as va,c as qs,S as Ds,G as Ca,H as Ma,I as Na,J as ka,K as Aa,L as Ia,M as ja,e as Bs,N as Ra,O as Ea,n as La,p as $a,r as Gt,P as Fa,Q as Oa,R as Pa,T as qa,g as Da,U as Ba,V as Ua,W as Us,X as Ha,Y as Wa,Z as Qe,u as _a,_ as Ka,$ as Qa,a0 as Hs,a1 as za,a2 as Va,a3 as Ja,a4 as Ga,a5 as Ws,a6 as Ya,a7 as _s,a8 as Xa,a9 as Za,aa as er}from"./conversation-model-Dc02NsGp.js";import{u as tr}from"./sse-CD9MMUxl.js";import{n as Yt,t as pt,f as Ks}from"./time-Dhsh_2EG.js";import{M as sr}from"./message-markup-C2LQDm_k.js";import{c as Qs,i as Xt,b as nr}from"./message-visibility-CGOmSSKs.js";import{d as ar}from"./operator-attention-RqieiSY8.js";import{b as rr}from"./router-B9vQkNJL.js";import{f as Zt,a as or}from"./scoutbot-BJIamJOH.js";import{s as ir}from"./sessionRead-CvFz2RHv.js";import{o as ft}from"./openContent-C6XO6kr5.js";import{c as ze}from"./clipboard-e3fSpeo7.js";import{A as es}from"./AgentAvatar-6-KBVKUu.js";import{d as lr}from"./types-B0PlfpKc.js";/* empty css */import{ConversationHeader as cr,ConversationIdentityRow as dr,AddParticipantForm as ur}from"./ConversationHeader-BQWzGzLK.js";import{FanOutRow as mr,ThreadDayDivider as hr}from"./ConversationFeedRows-WrH-YI3L.js";import{T as pr,t as zs,m as Vs,a as fr,b as gr,o as yr,d as br,s as wr,l as Sr,c as Tr,e as xr,W as vr,f as Cr,g as Mr}from"./ConversationPanels-Dujvnmup.js";import{u as Nr}from"./tail-events-Ps8KpKah.js";import{PinnedAskCard as kr,ConversationStatusStrip as Ar}from"./ConversationStatus-DVzSb2Hv.js";import"./HarnessMark-B979GCSB.js";import"./colors-BtO5_zlx.js";import"./NewChatOrigin-B1u7ki70.js";import"./keyboard-nav-BLYDhL3Z.js";import"./x-CAbNespN.js";import"./createLucideIcon-DezKXSG2.js";import"./chevron-down-wciXnOQz.js";import"./search-CDko0PKE.js";import"./loader-circle-pM56HNhR.js";import"./file-text-CqJgwxmv.js";import"./perf-PX8Rx0EP.js";import"./scout-voice-BVUqGhth.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./zap-Cq8eWkcF.js";import"./surface-activity-B1rgWB1i.js";import"./DocumentFocusViewer-Do3wQ_3Z.js";import"./TextDocumentSurface-BflAwXeZ.js";import"./chevron-right-D-HdlPg8.js";import"./code-xml-D7pOQM9l.js";import"./arrow-left-Czpf-AE4.js";import"./arrow-right-BuzMnLYP.js";import"./chunk-HRAB3GC3-Tyv9rzx7.js";import"./index-BWHgHrtv.js";import"./mentions-DG6OQrsc.js";import"./AgentDetailCard-C9rn3Fj5.js";import"./AgentLiveActions-DrEJDJef.js";import"./terminal-takeover-_Jyys4me.js";import"./eye-BRyD0jno.js";import"./terminal-9GRS_Qdc.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-BQ6t92tJ.js";import"./SpriteAvatar-z5hHesx9.js";import"./CrewAvatar-BwXjyg8N.js";import"./BackToPicker-CXZjBRAe.js";import"./AstronautSuit-DbjQtfD_.js";import"./tail-display-DcliDVkW.js";import"./lane-edit-display-C_Aujldz.js";import"./use-reduced-motion-x8pJMVrG.js";import"./proxy-BiW5suC7.js";import"./activity-DcrMApUY.js";import"./message-circle-mZCv8tvB.js";import"./check-ofKUE8yH.js";import"./sparkles-CETYrxGA.js";const Zs="scout:conversations:failure-dismissals:v1",Ir=64;let ns={};function en(){try{if(typeof localStorage<"u"){const n=JSON.parse(localStorage.getItem(Zs)??"null");Er(n)&&(ns=as(n))}}catch{}return as(ns)}function jr(n){ns=as(n);try{typeof localStorage<"u"&&localStorage.setItem(Zs,JSON.stringify(n))}catch{}}function Js(n){return new Set(en()[n]??[])}function Rr(n,c){const d=en(),f=(d[n]??[]).filter(k=>k!==c);f.push(c),d[n]=f.slice(-100);const y=Object.keys(d);for(const k of y.slice(0,Math.max(0,y.length-Ir)))delete d[k];return jr(d),new Set(d[n])}function as(n){return Object.fromEntries(Object.entries(n).map(([c,d])=>[c,[...d]]))}function Er(n){return!n||typeof n!="object"||Array.isArray(n)?!1:Object.values(n).every(c=>Array.isArray(c)&&c.every(d=>typeof d=="string"&&d.length>0))}const Lr=/\.(?:apng|avif|gif|jpe?g|png|svg|webp)(?:$|[?#])/iu,$r=/\bhttps?:\/\/[^\s<>"')\]]+/giu;function Ve(n){if(typeof n!="string")return null;try{const c=new URL(n.trim());return c.protocol==="http:"||c.protocol==="https:"?c.toString():null}catch{return null}}function z(n,c){const d=n?.[c];return typeof d=="string"&&d.trim()?d.trim():null}function Fr(n){return n.mediaType.toLowerCase().startsWith("image/")}function Or(n){return Lr.test(n)}function Pr(n){try{const c=new URL(n),d=[c.pathname==="/"?"":c.pathname,c.search].join("").trim();return{host:c.hostname.replace(/^www\./iu,""),detail:d||c.hostname}}catch{return{host:n,detail:n}}}function qr(n){const c=new Set,d=[];for(const f of n.matchAll($r)){const y=f[0]?.replace(/[.,;:!?]+$/u,""),k=Ve(y);!k||c.has(k)||(c.add(k),d.push(k))}return d}const Dr=/^\/api\/blobs\/[^/]+$/u;function ts(n){try{const c=new URL(n);return Dr.test(c.pathname)?`${c.pathname}${c.search}`:n}catch{return n}}function gt(n){return Ve(n.url)??Ve(z(n.metadata,"url"))??Ve(z(n.metadata,"href"))}function Br(n){const c=n.metadata??null,d=z(c,"kind")??z(c,"type"),f=gt(n);if(!f||d!=="link_preview"&&d!=="link-preview"&&n.mediaType!=="text/x-uri")return null;const y=Pr(f);return{id:n.id,url:f,title:z(c,"title")??y.host,description:z(c,"description"),imageUrl:Ve(z(c,"imageUrl")??z(c,"image")),siteName:z(c,"siteName")??y.host}}function Ur({src:n,alt:c}){const[d,f]=o.useState(!1);return d?r.jsxs("a",{className:"s-message-embed s-message-embed--file",href:n,target:"_blank",rel:"noreferrer",children:[r.jsx("span",{className:"s-message-embed-title",children:c}),r.jsx("span",{className:"s-message-embed-description",children:"Preview unavailable"})]}):r.jsx("a",{className:"s-message-embed s-message-embed--image",href:n,target:"_blank",rel:"noreferrer",children:r.jsx("img",{src:n,alt:c,loading:"lazy",decoding:"async",onError:()=>f(!0)})})}function Hr({preview:n}){return r.jsxs("a",{className:"s-message-embed s-message-embed--link",href:n.url,target:"_blank",rel:"noreferrer",children:[n.imageUrl&&r.jsx("span",{className:"s-message-embed-thumb",children:r.jsx("img",{src:n.imageUrl,alt:"",loading:"lazy",decoding:"async"})}),r.jsxs("span",{className:"s-message-embed-copy",children:[n.siteName&&r.jsx("span",{className:"s-message-embed-site",children:n.siteName}),r.jsx("span",{className:"s-message-embed-title",children:n.title}),n.description&&r.jsx("span",{className:"s-message-embed-description",children:n.description})]})]})}function Wr({message:n}){const c=n.attachments??[],d=new Set,f=[],y=[];for(const h of c){const $=gt(h);if($&&Fr(h)){d.add(h.id),f.push({id:h.id,src:ts($),alt:h.fileName??"Image attachment"});continue}const b=Br(h);b&&(d.add(h.id),y.push(b))}const k=new Set(y.map(h=>h.url)),G=new Set(c.map(gt).filter(h=>!!h));for(const h of qr(n.body))G.has(h)||k.has(h)||Or(h)&&f.push({id:h,src:ts(h),alt:"Embedded image"});const N=c.filter(h=>!d.has(h.id));return f.length===0&&y.length===0&&N.length===0?null:r.jsxs("div",{className:"s-message-embeds",children:[f.map(h=>r.jsx(Ur,{src:h.src,alt:h.alt},h.id)),y.slice(0,1).map(h=>r.jsx(Hr,{preview:h},h.id)),N.map(h=>{const $=gt(h),b=$?ts($):null,u=h.fileName??z(h.metadata,"title")??h.mediaType;return b?r.jsxs("a",{className:"s-message-embed s-message-embed--file",href:b,target:"_blank",rel:"noreferrer",children:[r.jsx("span",{className:"s-message-embed-title",children:u}),r.jsx("span",{className:"s-message-embed-description",children:h.mediaType})]},h.id):r.jsxs("div",{className:"s-message-embed s-message-embed--file",children:[r.jsx("span",{className:"s-message-embed-title",children:u}),r.jsx("span",{className:"s-message-embed-description",children:h.mediaType})]},h.id)})]})}function _r(n){const{sessionIds:c,active:d}=n,f=c.join("|"),y=d&&c.length>0,[k,G]=o.useState([]);return o.useEffect(()=>{G([])},[f]),o.useEffect(()=>{if(!y)return;let N=!1;const h=new URLSearchParams({limit:String(pr*3),transcripts:"true"});return B(`/api/tail/recent?${h.toString()}`).then($=>{if(N)return;const b=($.events??[]).filter(u=>zs(u,c));b.length!==0&&G(u=>Vs(u,b))}).catch(()=>{}),()=>{N=!0}},[y,f]),Nr(N=>{y&&zs(N,c)&&G(h=>Vs(h,[N]))},y),o.useMemo(()=>y?fr(k):[],[y,k])}const Kr=3500;function Gs(n){const c=n?.trim().replace(/^#/,"");if(!c?.startsWith("msg-"))return null;const d=c.slice(4).trim();if(!d)return null;try{return decodeURIComponent(d)}catch{return d}}const Qr=64;function zr(n){const c=n?.clientMessageId;return typeof c=="string"&&c.trim()?c.trim():null}function Ys(n){const c=n.body.replace(/\s+/gu," ").trim();if(c)return c.length>180?`${c.slice(0,179).trimEnd()}…`:c;const d=n.attachments?.length??0;return d===1?"Attachment":d>1?`${d} attachments`:"Message"}function Xs(n,c){const d=n.toLocaleLowerCase().indexOf(c.toLocaleLowerCase());if(d<0)return n;const f=n.slice(0,d),y=n.slice(d+c.length);return!f&&y.startsWith(" ")?y.slice(1):f.endsWith(" ")&&y.startsWith(" ")?`${f}${y.slice(1)}`:`${f}${y}`}function Vr(n){return n instanceof TypeError||typeof DOMException<"u"&&n instanceof DOMException&&n.name==="AbortError"}function mi({conversationId:n,initialDraft:c,navigate:d,embedded:f,showBackNav:y=!0,treatment:k="standard"}){const{agents:G,route:N,openContextCapture:h}=pa(),$=rr(N),b=o.useMemo(()=>fa(G,$),[G,$]),[u,yt]=o.useState(null),rs=o.useRef(null);rs.current=u;const Je=o.useMemo(()=>ht(n),[n]),[tn,sn]=o.useState(()=>Je?{[n]:Je}:{}),T=tn[n]??Je??[],[nn,os]=o.useState(()=>Je!==null),Me=o.useRef(null),is=o.useMemo(()=>{const t=Me.current;return t===null?null:new Set(T.filter(e=>!t.has(e.id)).map(e=>e.id))},[T]),Ge=Me.current===null&&T.length>0;o.useEffect(()=>{if(T.length===0)return;const t=Me.current??new Set;for(const e of T)t.add(e.id);Me.current=t},[T]),o.useEffect(()=>{Me.current=null,os(ht(n)!==null)},[n]);const ls=!nn&&T.length===0,V=o.useCallback(t=>{sn(e=>{const s=e[n]??ht(n)??[],a=typeof t=="function"?t(s):t,i=aa(n,a);return{...e,[n]:i}})},[n]),an=Jt(n),[g,ge]=o.useState(an),[Ne,ke]=o.useState([]),[Ye,bt]=o.useState(null),[Xe,Ae]=o.useState(null),[Ze,rn]=o.useState(()=>typeof window>"u"?null:Gs(window.location.hash)),[cs,ae]=o.useState(null),[wt,ds]=o.useState(()=>Js(n)),[ye,St]=o.useState(!1),[on,Ie]=o.useState(!1),[Tt,et]=o.useState(0),je=o.useRef(null),Re=o.useRef(null),ln=o.useRef(null),Ee=o.useRef(!0),tt=o.useRef(!1),be=o.useRef(null),A=o.useRef(null),Le=o.useRef(new Set),$e=o.useRef(null),us=o.useRef(0),ms=o.useRef(null),Fe=o.useRef(null),Oe=o.useRef(new Set),Y=o.useRef(n);Y.current=n;const re=o.useRef(new Map),cn=Fs(n),st=o.useRef(!1);o.useLayoutEffect(()=>{const t=Re.current,e=je.current;!t||!e||(e.scrollTop=t.scrollTop+(e.scrollHeight-t.scrollHeight),Re.current=null,st.current=!0)}),o.useEffect(()=>{St(!1),Re.current=null,st.current=!1,Ee.current=!0,tt.current=!1,Ie(!1),et(0),Ut(new Set),re.current.clear(),ge(Jt(n)),ds(Js(n))},[n]);const nt=o.useCallback(async t=>{let s=typeof t.metadata?.flightId=="string"?t.metadata.flightId.trim():"";if(!s&&t.replyToMessageId)try{s=(await B(`/api/flights?conversationId=${encodeURIComponent(n)}&active=false`)).find(i=>i.messageId===t.replyToMessageId)?.id??""}catch{}await ar({...s?{flightId:s}:{},conversationId:n,messageId:t.replyToMessageId??t.id,itemUpdatedAt:Yt(t.createdAt)??Date.now()})},[n]),hs=o.useCallback(t=>{const e=t.replyToMessageId??t.id;ds(Rr(n,t.id)),Zt({type:"dismiss-conversation-failure",conversationId:n,messageId:e,reason:"The operator cleared this delivery issue"});const s=`${n}:${t.id}`;Oe.current.add(s),nt(t).catch(()=>{Oe.current.delete(s)})},[n,nt]);o.useEffect(()=>{for(const t of T){if(!wt.has(t.id)||!Qs(t))continue;const e=`${n}:${t.id}`;Oe.current.has(e)||(Oe.current.add(e),nt(t).catch(()=>{Oe.current.delete(e)}))}},[n,wt,T,nt]);const v=u?.agentId??null,M=u?.kind==="direct",xt=o.useMemo(()=>new Set([n,...u?.equivalentConversationIds??[]]),[n,u?.equivalentConversationIds]),K=o.useMemo(()=>v?b.find(t=>t.id===v)??null:null,[b,v]),ps=ya(u),dn=ba({resolvedAgentId:K?.id,sessionId:ps,machineId:$}),[vt,fs]=o.useState(null);o.useEffect(()=>{B("/api/fleet").then(t=>{fs(e=>ne(e,Ps(t.activeAsks,n,v)))}).catch(()=>{})},[n,v]);const U=o.useCallback(async(t={})=>{const e=t.messageMode??"none",s=t.includeMetadata??!0;ae(null);try{const a=s?await B(`/api/session/${encodeURIComponent(n)}`).catch(()=>null):rs.current;if(Y.current!==n)return;yt(x=>ne(x,a));const i=a?.agentId??null,l=a?.id&&a.id!==n?a.id:n;if(l!==n){d({view:"conversation",conversationId:l});return}const m=ht(l),R=ra(l),w=e==="initial"&&!R,p=e==="refresh"||e==="initial",S=Promise.all([B(`/api/flights?conversationId=${encodeURIComponent(l)}`).catch(()=>[]),B("/api/fleet?limit=24&activityLimit=160").catch(()=>wa())]),W=await(w?oa(l):p?ia(l,{refresh:!0}):Promise.resolve(m));if(Y.current!==n)return;const L=Ce(W??[]),fe=L.filter(x=>!Xt(x));W&&V(x=>ne(x,Sa(x,fe))),os(!0),ir(l);const E=L.at(-1);E&&Fe.current!==E.id&&(Fe.current=E.id,B(`/api/conversations/${encodeURIComponent(l)}/read-cursor`,{method:"POST",body:JSON.stringify({lastReadMessageId:E.id})}).catch(()=>{Fe.current===E.id&&(Fe.current=null)}));const[se,Q]=await S;if(Y.current!==n)return;const _=Ta(se),J=Jt(l),ve=_??J;Le.current=new Set([...se.map(x=>x.invocationId),...J?.invocationId?.startsWith("pending:")?[]:J?.invocationId?[J.invocationId]:[]]),_&&J?.id===_.id&&Os(l,_.id);const P=ve?.agentId??i??null,Vt=xa(Q.activity,ve,l,P),mt=va(Q.activeAsks,ve,l,P);ge(x=>ne(x,ve)),ke(x=>ne(x,Vt)),Ae(x=>ne(x,mt)),fs(x=>ne(x,Ps(Q.activeAsks,l,i)))}catch(a){if(Y.current!==n)return;ae(a instanceof Error?a.message:String(a))}},[n,d,V]);o.useEffect(()=>{U({messageMode:"initial"})},[U]),o.useEffect(()=>{Fe.current=null},[n]),o.useEffect(()=>{$e.current=g},[g]);const un=o.useCallback(async()=>{if(ye||!Fs(n))return;const t=je.current,e=t?{scrollHeight:t.scrollHeight,scrollTop:t.scrollTop}:null;St(!0),ae(null);try{const s=await la(n);if(Y.current!==n)return;e&&(Re.current=e),V(Ce(s).filter(a=>!Xt(a)))}catch(s){Y.current===n&&ae(s instanceof Error?s.message:String(s))}finally{Y.current===n&&St(!1)}},[n,ye,V]),[I,D]=o.useState(()=>c??""),[oe,ie]=o.useState(null),[H,at]=o.useState(!1),[C,mn]=o.useState("operator"),[le,Pe]=o.useState({open:!1,query:"",triggerStart:-1,index:0}),[ce,qe]=o.useState({open:!1,query:"",triggerStart:-1,index:0}),[F,X]=o.useState(null),[Ct,rt]=o.useState(!1),[Mt,ot]=o.useState(""),[hn,De]=o.useState(null),[pn,Nt]=o.useState(!1);o.useEffect(()=>{rt(!1),ot(""),De(null),Nt(!1)},[n]),o.useEffect(()=>{if(!c)return;const t=`${n}:${c}`;ms.current!==t&&(ms.current=t,D(c),requestAnimationFrame(()=>A.current?.focus()))},[n,c]);const Z=o.useMemo(()=>{const t=new Map;for(const e of u?.participants??[])t.set(e.actorId,e),e.agentId&&t.set(e.agentId,e);return t},[u]),kt=o.useMemo(()=>{const t=new Set,e=[];for(const s of u?.participantIds??[]){if(s==="operator")continue;const a=Z.get(s),i=a?.scopedAlias?.trim().replace(/^@+/,"");if(!i)continue;const l=i.toLowerCase();t.has(l)||(t.add(l),e.push({id:s,label:a?.label??a?.displayName??i,name:a?.displayName??i,handle:i}))}for(const s of b){const a=s.handle?.trim().replace(/^@+/,"")??qs(s.id)??s.id;if(!a)continue;const i=a.toLowerCase();t.has(i)||(t.add(i),e.push({id:s.id,label:a,name:s.name??a,handle:a}))}return e.sort((s,a)=>s.handle.localeCompare(a.handle))},[Z,b,u]),fn=o.useMemo(()=>{if(!le.open)return[];const t=le.query.toLowerCase();return t?Ds.filter(e=>e.command.toLowerCase().startsWith("/"+t)||e.command.toLowerCase().includes(t)):Ds},[le.open,le.query]),gn=o.useMemo(()=>{if(!ce.open)return[];const t=ce.query.toLowerCase();return t?kt.filter(e=>e.handle.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)).slice(0,8):kt.slice(0,8)},[ce.open,ce.query,kt]),yn=o.useCallback(()=>{Pe(t=>t.open?{...t,open:!1}:t),qe(t=>t.open?{...t,open:!1}:t)},[]),bn=o.useCallback((t,e)=>{const s=Ca(t,e);Pe(s?i=>({open:!0,query:s.query,triggerStart:s.start,index:i.open&&i.triggerStart===s.start?i.index:0}):i=>i.open?{...i,open:!1}:i);const a=Ma(t,e);qe(a?i=>({open:!0,query:a.query,triggerStart:a.start,index:i.open&&i.triggerStart===a.start?i.index:0}):i=>i.open?{...i,open:!1}:i)},[]),wn=o.useCallback(t=>{const e=A.current,s=le.triggerStart;if(s<0)return;const a=e?.selectionStart??I.length,i=I.slice(0,s),l=I.slice(a),m=t.insert,R=`${i}${m}${l}`;D(R),Pe(w=>({...w,open:!1})),requestAnimationFrame(()=>{const w=A.current;if(!w)return;const p=i.length+m.length;w.focus(),w.setSelectionRange(p,p)})},[I,le.triggerStart]),Sn=o.useCallback(t=>{const e=A.current,s=ce.triggerStart;if(s<0)return;const a=e?.selectionStart??I.length,i=I.slice(0,s),l=I.slice(a),m=l.length===0||!l.startsWith(" "),R=`@${t.handle}${m?" ":""}`,w=`${i}${R}${l}`;D(w),qe(p=>({...p,open:!1})),requestAnimationFrame(()=>{const p=A.current;if(!p)return;const S=i.length+R.length;p.focus(),p.setSelectionRange(S,S)})},[I,ce.triggerStart]);o.useEffect(()=>{const t=A.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"},[I]),o.useEffect(()=>{B("/api/user").then(t=>mn(t.name)).catch(()=>{})},[]);const it=o.useMemo(()=>Na(T,C),[T,C]);o.useEffect(()=>{F===null||it===null||it>=F&&X(null)},[F,it]);const Tn=o.useMemo(()=>ka(g),[g]),we=Date.now(),xn=Aa(g,it,we),At=Tn&&!Ia(g)&&!xn,gs=M&&(H||F!==null||At),ys=M&&ja({sending:H,awaitingResponse:F!==null,currentFlight:g}),O=Bs({name:K?.name,agentName:u?.agentName,id:v,title:u?.title}),j=o.useMemo(()=>M?Ra({agentName:O,agentState:K?.state??null,sending:H,currentFlight:g,showWorkingTurn:At,awaitingResponse:F!==null}):{label:"Open",detail:"",tone:"idle",showStrip:!1,showTyping:!1},[K?.state,O,F,g,we,M,H,At]),It=g?.startedAt??Xe?.startedAt??F,jt=Yt(It),bs=Ya(It,we),[,vn]=o.useState(0);o.useEffect(()=>{if(!j.showTyping||jt===null)return;const t=Math.max(0,Date.now()-jt),e=[Ws.sustained,Ws.long].find(a=>a>t);if(e===void 0)return;const s=window.setTimeout(()=>vn(a=>a+1),e-t+50);return()=>window.clearTimeout(s)},[jt,j.showTyping,bs]);const Cn="Live",Rt=o.useMemo(()=>Ea({currentFlight:g,presence:j,turnActivity:Ne,turnAsk:Xe,awaitingResponseSince:F,nowMs:we}),[F,g,we,j,Ne,Xe]),Mn="s-thread-msg-card s-thread-msg-working-card s-thread-msg-card--avatar-row",Nn="s-thread-msg-kind",kn="s-thread-turn-snapshot",An="s-thread-turn-snapshot-pulse",In="s-thread-presence-line",jn=["s-thread-presence-strip",`s-thread-presence-strip--${bs}`].filter(Boolean).join(" "),Et=u?La(u):O,ws=u?.id??n,Rn=u?.alias?.trim()||null,lt=$a(u?.workspaceRoot),En=j.tone,Lt=T.length===0&&M&&(j.showTyping||g!==null||Ne.length>0||Xe!==null||F!==null),Ss=o.useMemo(()=>u?u.participantIds.includes("operator"):M,[M,u]),Be=g?.agentId??v,Ue=Be?Gt(b,[Be]):null,He=Ue?.id??Be,We=g?.sessions.at(-1)?.sessionId??Ue?.harnessSessionId??void 0,Ts=g?.id?()=>{ft(d,{view:"sessions",flightId:g.id,...He?{agentId:He}:{},...We?{sessionId:We}:{},...$?{machineId:$}:{}},{returnTo:N})}:void 0,xs=g?.id??null;o.useEffect(()=>{if(!xs||!He){bt(null);return}let t=!1;const e=We?`?sessionId=${encodeURIComponent(We)}`:"",s=async()=>{try{const i=await B(`/api/agents/${encodeURIComponent(He)}/observe${e}`);if(t)return;bt(l=>ne(l,i))}catch{}};s();const a=window.setInterval(()=>{s()},Kr);return()=>{t=!0,window.clearInterval(a),bt(null)}},[xs,He,We]);const $t=o.useMemo(()=>gr({flight:g,agent:Ue??K,sessionMeta:u,observeSessionId:Ye?.sessionId}),[K,g,u,Ye?.sessionId,Ue]),vs=_r({sessionIds:$t,active:j.showTyping||Lt}),Ln=o.useMemo(()=>yr({observe:Ye,flight:g}),[g,Ye]),ee=vs.length>0?vs:Ln,Ft=o.useMemo(()=>ee.length>0?null:br({flight:g,hasSessionScope:$t.length>0,awaitingResponse:F!==null}),[F,g,$t.length,ee.length]),Ot=wr(ee),Pt=Sr(ee),Cs=ee.at(-1)??null,qt=Cs?pt(Cs.ts,we):null,de=o.useMemo(()=>Pt?{...Rt,latest:Pt,...Ot?{activityLabel:Ot}:{},...qt?{lastActivityLabel:qt}:{}}:Rt,[qt,Pt,Rt,Ot]),$n=`${O}: ${de.latest}`,Ms=Be&&Fa(Ue)?()=>{ft(d,{view:"terminal",agentId:Be,mode:"takeover"},{returnTo:N})}:void 0,Dt=M?()=>{f&&Zt({type:"focus-composer",reason:"Steer the active conversation"})||requestAnimationFrame(()=>{A.current?.focus({preventScroll:!0}),A.current?.scrollIntoView({block:"nearest"})})}:void 0,Fn=o.useMemo(()=>(u?u.participantIds.filter(e=>e!=="operator"):v?[v]:[]).map(e=>{const s=Gt(b,[e]),a=Z.get(e);return{id:e,name:a?.scopedAlias??s?.name??a?.displayName??qs(e)??e,title:a?.label??s?.id??e,agent:s,sessionId:a?.sessionId??null,harness:s?.harness??a?.harness??null,model:s?.model??null,reasoningEffort:s?.reasoningEffort??null}}),[v,Z,b,u]),On=o.useMemo(()=>({name:C,active:Ss}),[Ss,C]),ue=o.useMemo(()=>new Map(T.map(t=>[t.id,t])),[T]),Bt=o.useMemo(()=>b.find(t=>or(t)&&!!t.conversationId?.trim())?.conversationId?.trim()??null,[b]),_e=o.useMemo(()=>Oa(T),[T]),[Pn,Ut]=o.useState(()=>new Set),qn=o.useCallback(t=>{Ut(e=>{const s=new Set(e);return s.delete(t)||s.add(t),s})},[]),Ns=o.useMemo(()=>{const t=new Map;for(const e of _e)if(e.kind==="fanout")for(const s of e.messages)t.set(s.id,e.key);return t},[_e]),ct=o.useCallback(t=>{const e=Ns.get(t);e&&Ut(l=>l.has(e)?l:new Set(l).add(e));const s=document.getElementById(`msg-${t}`);if(!s)return;const a=s.closest(".s-thread-fanout")??s,i=a===s?"s-thread-msg--flash":"s-thread-fanout--flash";a.scrollIntoView({behavior:"smooth",block:"center"}),a.classList.add(i),window.setTimeout(()=>a.classList.remove(i),1200)},[Ns]);o.useEffect(()=>{const t=()=>rn(Gs(window.location.hash));return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)},[]),o.useEffect(()=>{if(!Ze||!ue.has(Ze))return;const t=window.setTimeout(()=>ct(Ze),50);return()=>window.clearTimeout(t)},[Ze,ue,ct]),tr(o.useCallback(t=>{if(t.kind==="message.posted"){const e=t.payload?.message;if(!e||!xt.has(e.conversationId))return;const s=e.actorId==="operator",a=M&&!s&&e.class==="agent",i={id:e.id,conversationId:e.conversationId,actorId:e.actorId,actorName:a?O:Pa(e.actorId,b,C),body:e.body,createdAt:e.createdAt,class:s?"operator":e.class,attachments:e.attachments,metadata:e.metadata,replyToMessageId:e.replyToMessageId??e.n??null};if(Xt(i))return;if(V(l=>{const m=zr(e.metadata),R=m?re.current.get(m):void 0;if(l.some(w=>w.id===e.id))return m&&re.current.delete(m),l;if(s&&m){const w=qa(l,m,R);if(w!==-1){const p=[...l];return p[w]=i,re.current.delete(m),Ce(p)}}return Ce([...l,i])}),a){const l=Yt(e.createdAt)??Date.now();X(m=>m===null||l<m||Da($e.current)?m:null),ge(m=>Ba(m)?null:m)}return}if(t.kind==="invocation.requested"){const e=t.payload?.invocation;if(!e||e.targetAgentId!==v||!e.conversationId||!xt.has(e.conversationId))return;Le.current.add(e.id),ke([]),Ae(null),X(s=>s??Date.now());return}if(t.kind==="flight.updated"){const e=t.payload?.flight;if(!e||e.targetAgentId!==v||!(Le.current.has(e.invocationId)||$e.current?.id===e.id))return;if(Ua.has(e.state)){Os(n,e.id),ge(l=>l?.id===e.id?null:l),ke([]),Ae(null),X(null),U({messageMode:"refresh",includeMetadata:!1});return}Le.current.add(e.invocationId);const a=$e.current?.id===e.id,i=Us(e,n,v??"",$e.current);Ha(i)&&X(null),ge(i),a||(ke([]),Ae(null));return}t.kind!=="agent.endpoint.upserted"&&t.kind==="unknown"&&U({messageMode:"refresh"})},[v,O,n,xt,M,U,C,b])),o.useEffect(()=>{if(!gs)return;const t=setInterval(()=>{U({messageMode:"refresh",includeMetadata:!1})},5e3);return()=>clearInterval(t)},[gs,U]),o.useEffect(()=>{const t=()=>{if(document.visibilityState!=="visible")return;const e=Date.now();e-us.current<1e3||(us.current=e,U({messageMode:"refresh"}))};return window.addEventListener("focus",t),document.addEventListener("visibilitychange",t),()=>{window.removeEventListener("focus",t),document.removeEventListener("visibilitychange",t)}},[U]);const Ht=o.useRef(null),ks=o.useRef(!1),Wt=o.useRef(!1),_t=o.useCallback(t=>{const e=je.current;e&&(tt.current=!0,be.current!==null&&clearTimeout(be.current),t==="instant"?e.scrollTop=e.scrollHeight:e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),be.current=setTimeout(()=>{tt.current=!1,be.current=null},t==="smooth"?700:0))},[]);o.useEffect(()=>()=>{be.current!==null&&clearTimeout(be.current)},[]);const Dn=o.useCallback(()=>{const t=je.current;if(!t||tt.current)return;const s=t.scrollHeight-t.clientHeight-t.scrollTop<=Qr;Ee.current=s,s?(Ie(!1),et(0)):Ie(!0)},[]),Bn=o.useCallback(()=>{Ee.current=!0,Ie(!1),et(0),_t("smooth")},[_t]);o.useEffect(()=>{const t=T.at(-1)?.id??null,e=!!(t&&t!==Ht.current),s=Wa({newestMessageId:t,previousNewestMessageId:Ht.current,showTyping:j.showTyping,previousShowTyping:ks.current,historyRestorePending:st.current||Re.current!==null,initialScrollDone:Wt.current,nearBottom:Ee.current});s!=="none"?(_t(s),Wt.current=!0):e&&Wt.current&&!Ee.current&&(Ie(!0),et(a=>a+1)),st.current=!1,Ht.current=t,ks.current=j.showTyping});const[,Un]=o.useState(0);o.useEffect(()=>{const t=setInterval(()=>Un(e=>e+1),15e3);return()=>clearInterval(t)},[]);const me=ma(),[he,te]=o.useState([]),[As,dt]=o.useState("queue"),[Se,Te]=o.useState(null),xe=async(t,e)=>{const s=t.trim(),a=e?.attachments??[],i=e?.replyTarget??null;if(!s&&a.length===0||H)return"failed";const m=e?.forceAction??_s({isDm:M,hasOutstandingReply:ys}),R=Date.now(),w=da(),p={id:`optimistic-${w}`,conversationId:n,actorId:"operator",actorName:C,body:s,createdAt:R,class:"operator",...i?{replyToMessageId:i.messageId}:{},metadata:{clientMessageId:w,deliveryState:"sending"},...a.length>0?{attachments:a}:{}};at(!0),m!=="message"&&X(R),ae(null),re.current.set(w,p.id),V(S=>Ce([...S,p]));try{const S=await B(`/api/chats/${encodeURIComponent(n)}/messages`,{method:"POST",body:JSON.stringify({body:s,clientMessageId:w,...i?{replyToMessageId:i.messageId}:{},...a.length>0?{attachments:a}:{}})}),W=S.chatId?.trim()??S.conversationId?.trim();if(W&&W!==n)throw new Error(`Send returned a different Chat (${W}) instead of appending to ${n}.`);if(S.messageId?.trim()){const L=S.messageId.trim();V(fe=>Ce(fe.map(E=>E.id===p.id?{...E,id:L,metadata:{clientMessageId:w}}:E))),re.current.delete(w)}return S.flight?(Le.current.add(S.flight.invocationId),ge(Us(S.flight,n,v??"")),ke([]),Ae(null)):m!=="message"&&X(null),"sent"}catch(S){return Vr(S)?(V(W=>W.map(L=>L.id===p.id?{...L,metadata:{...L.metadata??{},deliveryState:"unknown"}}:L)),"unknown"):(V(W=>W.filter(L=>L.id!==p.id)),re.current.delete(w),X(null),ae(S instanceof Error?S.message:String(S)),"failed")}finally{at(!1)}},Hn=async t=>{const e=t.replyToMessageId?ue.get(t.replyToMessageId):null;if(!e||H)return;const s=[];for(const i of e.attachments??[]){if(!i.url){ae("This request includes an attachment that can’t be reused. Add it again, then retry."),requestAnimationFrame(()=>A.current?.focus());return}s.push({id:i.id,mediaType:i.mediaType,...i.fileName?{fileName:i.fileName}:{},url:i.url})}await xe(e.body,{forceAction:"invoke",attachments:s})!=="failed"&&hs(t)},Wn=(t,e,s)=>{if(!Bt)return;const a=t.replyToMessageId?ue.get(t.replyToMessageId)?.body.trim():"",i=a?`${a.slice(0,1200)}${a.length>1200?"…":""}`:"(The original request is no longer available in this transcript.)",l=[`Help me recover a failed request to ${e}.`,s,"","Original request:",i].join(`
1
+ import{j as r,r as o}from"./index-BI9AljSD.js";import{o as ht,w as aa,q as Jt,s as Fs,t as ra,u as oa,v as ia,x as Os,y as la,z as ca,A as da,B as ua}from"./NewChatComposer-C_1op4dH.js";import{a as B}from"./api-Co9aQ2Jw.js";import"./text-Faa3ZStB.js";import{u as ma,C as ha}from"./ConversationComposer-H8_hsYSc.js";import"./index-DfsTyYDx.js";import{u as pa,d as fa,a as ga}from"./Provider-Bu-C8Hxc.js";import{d as ya,b as ba,x as ne,y as Ps,z as wa,A as Ce,B as Sa,D as Ta,E as xa,F as va,c as qs,S as Ds,G as Ca,H as Ma,I as Na,J as ka,K as Aa,L as Ia,M as ja,e as Bs,N as Ra,O as Ea,n as La,p as $a,r as Gt,P as Fa,Q as Oa,R as Pa,T as qa,g as Da,U as Ba,V as Ua,W as Us,X as Ha,Y as Wa,Z as Qe,u as _a,_ as Ka,$ as Qa,a0 as Hs,a1 as za,a2 as Va,a3 as Ja,a4 as Ga,a5 as Ws,a6 as Ya,a7 as _s,a8 as Xa,a9 as Za,aa as er}from"./conversation-model-QsJVfSeG.js";import{u as tr}from"./sse-DDHEHUgz.js";import{n as Yt,t as pt,f as Ks}from"./time-Dhsh_2EG.js";import{M as sr}from"./message-markup-Cc_O-WdA.js";import{c as Qs,i as Xt,b as nr}from"./message-visibility-CGOmSSKs.js";import{d as ar}from"./operator-attention-RqieiSY8.js";import{b as rr}from"./router-DTtux5sP.js";import{f as Zt,a as or}from"./scoutbot-BJIamJOH.js";import{s as ir}from"./sessionRead-CvFz2RHv.js";import{o as ft}from"./openContent-C6XO6kr5.js";import{c as ze}from"./clipboard-e3fSpeo7.js";import{A as es}from"./AgentAvatar-B7c0egdP.js";import{d as lr}from"./types-B0PlfpKc.js";/* empty css */import{ConversationHeader as cr,ConversationIdentityRow as dr,AddParticipantForm as ur}from"./ConversationHeader-B0ZBhE_E.js";import{FanOutRow as mr,ThreadDayDivider as hr}from"./ConversationFeedRows-hlEFlURs.js";import{T as pr,t as zs,m as Vs,a as fr,b as gr,o as yr,d as br,s as wr,l as Sr,c as Tr,e as xr,W as vr,f as Cr,g as Mr}from"./ConversationPanels-fMo6Uy1v.js";import{u as Nr}from"./tail-events-BdUrO0kb.js";import{PinnedAskCard as kr,ConversationStatusStrip as Ar}from"./ConversationStatus-DI5GCiyW.js";import"./HarnessMark-DAaWPiT_.js";import"./colors-BtO5_zlx.js";import"./NewChatOrigin-D7hwp6dm.js";import"./keyboard-nav-e6yGeorb.js";import"./x-DfRJbqrh.js";import"./createLucideIcon-DthwWQIg.js";import"./chevron-down-C475vltS.js";import"./search-DmFM_9jm.js";import"./loader-circle-B2W9DPG5.js";import"./file-text--hfhwZH1.js";import"./perf-PX8Rx0EP.js";import"./scout-voice-BZKsdquE.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./zap-CIo8msJB.js";import"./surface-activity-B1rgWB1i.js";import"./DocumentFocusViewer-DFFE85Tq.js";import"./TextDocumentSurface-BeSwe3Yl.js";import"./chevron-right-CnZRSd-V.js";import"./code-xml-CvKBY3KA.js";import"./arrow-left-DHfdXJVZ.js";import"./arrow-right-BBsrogWf.js";import"./chunk-HRAB3GC3-DLNT8aOo.js";import"./index-BWHgHrtv.js";import"./mentions-DuLQnEcn.js";import"./AgentDetailCard-B_KLcgsP.js";import"./AgentLiveActions-CsQA3pu_.js";import"./terminal-takeover-B6H4llRR.js";import"./eye-FnaaPfja.js";import"./terminal-C3YRPfyz.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-BQ6t92tJ.js";import"./SpriteAvatar-56DTXxSV.js";import"./CrewAvatar-CXJHLNVM.js";import"./BackToPicker-Cto0Ioz9.js";import"./AstronautSuit-Cjjcv6yQ.js";import"./tail-display-DcliDVkW.js";import"./lane-edit-display-C_Aujldz.js";import"./use-reduced-motion-8WuxLa5l.js";import"./proxy-1BABCaDb.js";import"./activity-CqZafWfx.js";import"./message-circle-B2DoYKDO.js";import"./check-DbIkldnK.js";import"./sparkles-Cf8gin88.js";const Zs="scout:conversations:failure-dismissals:v1",Ir=64;let ns={};function en(){try{if(typeof localStorage<"u"){const n=JSON.parse(localStorage.getItem(Zs)??"null");Er(n)&&(ns=as(n))}}catch{}return as(ns)}function jr(n){ns=as(n);try{typeof localStorage<"u"&&localStorage.setItem(Zs,JSON.stringify(n))}catch{}}function Js(n){return new Set(en()[n]??[])}function Rr(n,c){const d=en(),f=(d[n]??[]).filter(k=>k!==c);f.push(c),d[n]=f.slice(-100);const y=Object.keys(d);for(const k of y.slice(0,Math.max(0,y.length-Ir)))delete d[k];return jr(d),new Set(d[n])}function as(n){return Object.fromEntries(Object.entries(n).map(([c,d])=>[c,[...d]]))}function Er(n){return!n||typeof n!="object"||Array.isArray(n)?!1:Object.values(n).every(c=>Array.isArray(c)&&c.every(d=>typeof d=="string"&&d.length>0))}const Lr=/\.(?:apng|avif|gif|jpe?g|png|svg|webp)(?:$|[?#])/iu,$r=/\bhttps?:\/\/[^\s<>"')\]]+/giu;function Ve(n){if(typeof n!="string")return null;try{const c=new URL(n.trim());return c.protocol==="http:"||c.protocol==="https:"?c.toString():null}catch{return null}}function z(n,c){const d=n?.[c];return typeof d=="string"&&d.trim()?d.trim():null}function Fr(n){return n.mediaType.toLowerCase().startsWith("image/")}function Or(n){return Lr.test(n)}function Pr(n){try{const c=new URL(n),d=[c.pathname==="/"?"":c.pathname,c.search].join("").trim();return{host:c.hostname.replace(/^www\./iu,""),detail:d||c.hostname}}catch{return{host:n,detail:n}}}function qr(n){const c=new Set,d=[];for(const f of n.matchAll($r)){const y=f[0]?.replace(/[.,;:!?]+$/u,""),k=Ve(y);!k||c.has(k)||(c.add(k),d.push(k))}return d}const Dr=/^\/api\/blobs\/[^/]+$/u;function ts(n){try{const c=new URL(n);return Dr.test(c.pathname)?`${c.pathname}${c.search}`:n}catch{return n}}function gt(n){return Ve(n.url)??Ve(z(n.metadata,"url"))??Ve(z(n.metadata,"href"))}function Br(n){const c=n.metadata??null,d=z(c,"kind")??z(c,"type"),f=gt(n);if(!f||d!=="link_preview"&&d!=="link-preview"&&n.mediaType!=="text/x-uri")return null;const y=Pr(f);return{id:n.id,url:f,title:z(c,"title")??y.host,description:z(c,"description"),imageUrl:Ve(z(c,"imageUrl")??z(c,"image")),siteName:z(c,"siteName")??y.host}}function Ur({src:n,alt:c}){const[d,f]=o.useState(!1);return d?r.jsxs("a",{className:"s-message-embed s-message-embed--file",href:n,target:"_blank",rel:"noreferrer",children:[r.jsx("span",{className:"s-message-embed-title",children:c}),r.jsx("span",{className:"s-message-embed-description",children:"Preview unavailable"})]}):r.jsx("a",{className:"s-message-embed s-message-embed--image",href:n,target:"_blank",rel:"noreferrer",children:r.jsx("img",{src:n,alt:c,loading:"lazy",decoding:"async",onError:()=>f(!0)})})}function Hr({preview:n}){return r.jsxs("a",{className:"s-message-embed s-message-embed--link",href:n.url,target:"_blank",rel:"noreferrer",children:[n.imageUrl&&r.jsx("span",{className:"s-message-embed-thumb",children:r.jsx("img",{src:n.imageUrl,alt:"",loading:"lazy",decoding:"async"})}),r.jsxs("span",{className:"s-message-embed-copy",children:[n.siteName&&r.jsx("span",{className:"s-message-embed-site",children:n.siteName}),r.jsx("span",{className:"s-message-embed-title",children:n.title}),n.description&&r.jsx("span",{className:"s-message-embed-description",children:n.description})]})]})}function Wr({message:n}){const c=n.attachments??[],d=new Set,f=[],y=[];for(const h of c){const $=gt(h);if($&&Fr(h)){d.add(h.id),f.push({id:h.id,src:ts($),alt:h.fileName??"Image attachment"});continue}const b=Br(h);b&&(d.add(h.id),y.push(b))}const k=new Set(y.map(h=>h.url)),G=new Set(c.map(gt).filter(h=>!!h));for(const h of qr(n.body))G.has(h)||k.has(h)||Or(h)&&f.push({id:h,src:ts(h),alt:"Embedded image"});const N=c.filter(h=>!d.has(h.id));return f.length===0&&y.length===0&&N.length===0?null:r.jsxs("div",{className:"s-message-embeds",children:[f.map(h=>r.jsx(Ur,{src:h.src,alt:h.alt},h.id)),y.slice(0,1).map(h=>r.jsx(Hr,{preview:h},h.id)),N.map(h=>{const $=gt(h),b=$?ts($):null,u=h.fileName??z(h.metadata,"title")??h.mediaType;return b?r.jsxs("a",{className:"s-message-embed s-message-embed--file",href:b,target:"_blank",rel:"noreferrer",children:[r.jsx("span",{className:"s-message-embed-title",children:u}),r.jsx("span",{className:"s-message-embed-description",children:h.mediaType})]},h.id):r.jsxs("div",{className:"s-message-embed s-message-embed--file",children:[r.jsx("span",{className:"s-message-embed-title",children:u}),r.jsx("span",{className:"s-message-embed-description",children:h.mediaType})]},h.id)})]})}function _r(n){const{sessionIds:c,active:d}=n,f=c.join("|"),y=d&&c.length>0,[k,G]=o.useState([]);return o.useEffect(()=>{G([])},[f]),o.useEffect(()=>{if(!y)return;let N=!1;const h=new URLSearchParams({limit:String(pr*3),transcripts:"true"});return B(`/api/tail/recent?${h.toString()}`).then($=>{if(N)return;const b=($.events??[]).filter(u=>zs(u,c));b.length!==0&&G(u=>Vs(u,b))}).catch(()=>{}),()=>{N=!0}},[y,f]),Nr(N=>{y&&zs(N,c)&&G(h=>Vs(h,[N]))},y),o.useMemo(()=>y?fr(k):[],[y,k])}const Kr=3500;function Gs(n){const c=n?.trim().replace(/^#/,"");if(!c?.startsWith("msg-"))return null;const d=c.slice(4).trim();if(!d)return null;try{return decodeURIComponent(d)}catch{return d}}const Qr=64;function zr(n){const c=n?.clientMessageId;return typeof c=="string"&&c.trim()?c.trim():null}function Ys(n){const c=n.body.replace(/\s+/gu," ").trim();if(c)return c.length>180?`${c.slice(0,179).trimEnd()}…`:c;const d=n.attachments?.length??0;return d===1?"Attachment":d>1?`${d} attachments`:"Message"}function Xs(n,c){const d=n.toLocaleLowerCase().indexOf(c.toLocaleLowerCase());if(d<0)return n;const f=n.slice(0,d),y=n.slice(d+c.length);return!f&&y.startsWith(" ")?y.slice(1):f.endsWith(" ")&&y.startsWith(" ")?`${f}${y.slice(1)}`:`${f}${y}`}function Vr(n){return n instanceof TypeError||typeof DOMException<"u"&&n instanceof DOMException&&n.name==="AbortError"}function mi({conversationId:n,initialDraft:c,navigate:d,embedded:f,showBackNav:y=!0,treatment:k="standard"}){const{agents:G,route:N,openContextCapture:h}=pa(),$=rr(N),b=o.useMemo(()=>fa(G,$),[G,$]),[u,yt]=o.useState(null),rs=o.useRef(null);rs.current=u;const Je=o.useMemo(()=>ht(n),[n]),[tn,sn]=o.useState(()=>Je?{[n]:Je}:{}),T=tn[n]??Je??[],[nn,os]=o.useState(()=>Je!==null),Me=o.useRef(null),is=o.useMemo(()=>{const t=Me.current;return t===null?null:new Set(T.filter(e=>!t.has(e.id)).map(e=>e.id))},[T]),Ge=Me.current===null&&T.length>0;o.useEffect(()=>{if(T.length===0)return;const t=Me.current??new Set;for(const e of T)t.add(e.id);Me.current=t},[T]),o.useEffect(()=>{Me.current=null,os(ht(n)!==null)},[n]);const ls=!nn&&T.length===0,V=o.useCallback(t=>{sn(e=>{const s=e[n]??ht(n)??[],a=typeof t=="function"?t(s):t,i=aa(n,a);return{...e,[n]:i}})},[n]),an=Jt(n),[g,ge]=o.useState(an),[Ne,ke]=o.useState([]),[Ye,bt]=o.useState(null),[Xe,Ae]=o.useState(null),[Ze,rn]=o.useState(()=>typeof window>"u"?null:Gs(window.location.hash)),[cs,ae]=o.useState(null),[wt,ds]=o.useState(()=>Js(n)),[ye,St]=o.useState(!1),[on,Ie]=o.useState(!1),[Tt,et]=o.useState(0),je=o.useRef(null),Re=o.useRef(null),ln=o.useRef(null),Ee=o.useRef(!0),tt=o.useRef(!1),be=o.useRef(null),A=o.useRef(null),Le=o.useRef(new Set),$e=o.useRef(null),us=o.useRef(0),ms=o.useRef(null),Fe=o.useRef(null),Oe=o.useRef(new Set),Y=o.useRef(n);Y.current=n;const re=o.useRef(new Map),cn=Fs(n),st=o.useRef(!1);o.useLayoutEffect(()=>{const t=Re.current,e=je.current;!t||!e||(e.scrollTop=t.scrollTop+(e.scrollHeight-t.scrollHeight),Re.current=null,st.current=!0)}),o.useEffect(()=>{St(!1),Re.current=null,st.current=!1,Ee.current=!0,tt.current=!1,Ie(!1),et(0),Ut(new Set),re.current.clear(),ge(Jt(n)),ds(Js(n))},[n]);const nt=o.useCallback(async t=>{let s=typeof t.metadata?.flightId=="string"?t.metadata.flightId.trim():"";if(!s&&t.replyToMessageId)try{s=(await B(`/api/flights?conversationId=${encodeURIComponent(n)}&active=false`)).find(i=>i.messageId===t.replyToMessageId)?.id??""}catch{}await ar({...s?{flightId:s}:{},conversationId:n,messageId:t.replyToMessageId??t.id,itemUpdatedAt:Yt(t.createdAt)??Date.now()})},[n]),hs=o.useCallback(t=>{const e=t.replyToMessageId??t.id;ds(Rr(n,t.id)),Zt({type:"dismiss-conversation-failure",conversationId:n,messageId:e,reason:"The operator cleared this delivery issue"});const s=`${n}:${t.id}`;Oe.current.add(s),nt(t).catch(()=>{Oe.current.delete(s)})},[n,nt]);o.useEffect(()=>{for(const t of T){if(!wt.has(t.id)||!Qs(t))continue;const e=`${n}:${t.id}`;Oe.current.has(e)||(Oe.current.add(e),nt(t).catch(()=>{Oe.current.delete(e)}))}},[n,wt,T,nt]);const v=u?.agentId??null,M=u?.kind==="direct",xt=o.useMemo(()=>new Set([n,...u?.equivalentConversationIds??[]]),[n,u?.equivalentConversationIds]),K=o.useMemo(()=>v?b.find(t=>t.id===v)??null:null,[b,v]),ps=ya(u),dn=ba({resolvedAgentId:K?.id,sessionId:ps,machineId:$}),[vt,fs]=o.useState(null);o.useEffect(()=>{B("/api/fleet").then(t=>{fs(e=>ne(e,Ps(t.activeAsks,n,v)))}).catch(()=>{})},[n,v]);const U=o.useCallback(async(t={})=>{const e=t.messageMode??"none",s=t.includeMetadata??!0;ae(null);try{const a=s?await B(`/api/session/${encodeURIComponent(n)}`).catch(()=>null):rs.current;if(Y.current!==n)return;yt(x=>ne(x,a));const i=a?.agentId??null,l=a?.id&&a.id!==n?a.id:n;if(l!==n){d({view:"conversation",conversationId:l});return}const m=ht(l),R=ra(l),w=e==="initial"&&!R,p=e==="refresh"||e==="initial",S=Promise.all([B(`/api/flights?conversationId=${encodeURIComponent(l)}`).catch(()=>[]),B("/api/fleet?limit=24&activityLimit=160").catch(()=>wa())]),W=await(w?oa(l):p?ia(l,{refresh:!0}):Promise.resolve(m));if(Y.current!==n)return;const L=Ce(W??[]),fe=L.filter(x=>!Xt(x));W&&V(x=>ne(x,Sa(x,fe))),os(!0),ir(l);const E=L.at(-1);E&&Fe.current!==E.id&&(Fe.current=E.id,B(`/api/conversations/${encodeURIComponent(l)}/read-cursor`,{method:"POST",body:JSON.stringify({lastReadMessageId:E.id})}).catch(()=>{Fe.current===E.id&&(Fe.current=null)}));const[se,Q]=await S;if(Y.current!==n)return;const _=Ta(se),J=Jt(l),ve=_??J;Le.current=new Set([...se.map(x=>x.invocationId),...J?.invocationId?.startsWith("pending:")?[]:J?.invocationId?[J.invocationId]:[]]),_&&J?.id===_.id&&Os(l,_.id);const P=ve?.agentId??i??null,Vt=xa(Q.activity,ve,l,P),mt=va(Q.activeAsks,ve,l,P);ge(x=>ne(x,ve)),ke(x=>ne(x,Vt)),Ae(x=>ne(x,mt)),fs(x=>ne(x,Ps(Q.activeAsks,l,i)))}catch(a){if(Y.current!==n)return;ae(a instanceof Error?a.message:String(a))}},[n,d,V]);o.useEffect(()=>{U({messageMode:"initial"})},[U]),o.useEffect(()=>{Fe.current=null},[n]),o.useEffect(()=>{$e.current=g},[g]);const un=o.useCallback(async()=>{if(ye||!Fs(n))return;const t=je.current,e=t?{scrollHeight:t.scrollHeight,scrollTop:t.scrollTop}:null;St(!0),ae(null);try{const s=await la(n);if(Y.current!==n)return;e&&(Re.current=e),V(Ce(s).filter(a=>!Xt(a)))}catch(s){Y.current===n&&ae(s instanceof Error?s.message:String(s))}finally{Y.current===n&&St(!1)}},[n,ye,V]),[I,D]=o.useState(()=>c??""),[oe,ie]=o.useState(null),[H,at]=o.useState(!1),[C,mn]=o.useState("operator"),[le,Pe]=o.useState({open:!1,query:"",triggerStart:-1,index:0}),[ce,qe]=o.useState({open:!1,query:"",triggerStart:-1,index:0}),[F,X]=o.useState(null),[Ct,rt]=o.useState(!1),[Mt,ot]=o.useState(""),[hn,De]=o.useState(null),[pn,Nt]=o.useState(!1);o.useEffect(()=>{rt(!1),ot(""),De(null),Nt(!1)},[n]),o.useEffect(()=>{if(!c)return;const t=`${n}:${c}`;ms.current!==t&&(ms.current=t,D(c),requestAnimationFrame(()=>A.current?.focus()))},[n,c]);const Z=o.useMemo(()=>{const t=new Map;for(const e of u?.participants??[])t.set(e.actorId,e),e.agentId&&t.set(e.agentId,e);return t},[u]),kt=o.useMemo(()=>{const t=new Set,e=[];for(const s of u?.participantIds??[]){if(s==="operator")continue;const a=Z.get(s),i=a?.scopedAlias?.trim().replace(/^@+/,"");if(!i)continue;const l=i.toLowerCase();t.has(l)||(t.add(l),e.push({id:s,label:a?.label??a?.displayName??i,name:a?.displayName??i,handle:i}))}for(const s of b){const a=s.handle?.trim().replace(/^@+/,"")??qs(s.id)??s.id;if(!a)continue;const i=a.toLowerCase();t.has(i)||(t.add(i),e.push({id:s.id,label:a,name:s.name??a,handle:a}))}return e.sort((s,a)=>s.handle.localeCompare(a.handle))},[Z,b,u]),fn=o.useMemo(()=>{if(!le.open)return[];const t=le.query.toLowerCase();return t?Ds.filter(e=>e.command.toLowerCase().startsWith("/"+t)||e.command.toLowerCase().includes(t)):Ds},[le.open,le.query]),gn=o.useMemo(()=>{if(!ce.open)return[];const t=ce.query.toLowerCase();return t?kt.filter(e=>e.handle.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)).slice(0,8):kt.slice(0,8)},[ce.open,ce.query,kt]),yn=o.useCallback(()=>{Pe(t=>t.open?{...t,open:!1}:t),qe(t=>t.open?{...t,open:!1}:t)},[]),bn=o.useCallback((t,e)=>{const s=Ca(t,e);Pe(s?i=>({open:!0,query:s.query,triggerStart:s.start,index:i.open&&i.triggerStart===s.start?i.index:0}):i=>i.open?{...i,open:!1}:i);const a=Ma(t,e);qe(a?i=>({open:!0,query:a.query,triggerStart:a.start,index:i.open&&i.triggerStart===a.start?i.index:0}):i=>i.open?{...i,open:!1}:i)},[]),wn=o.useCallback(t=>{const e=A.current,s=le.triggerStart;if(s<0)return;const a=e?.selectionStart??I.length,i=I.slice(0,s),l=I.slice(a),m=t.insert,R=`${i}${m}${l}`;D(R),Pe(w=>({...w,open:!1})),requestAnimationFrame(()=>{const w=A.current;if(!w)return;const p=i.length+m.length;w.focus(),w.setSelectionRange(p,p)})},[I,le.triggerStart]),Sn=o.useCallback(t=>{const e=A.current,s=ce.triggerStart;if(s<0)return;const a=e?.selectionStart??I.length,i=I.slice(0,s),l=I.slice(a),m=l.length===0||!l.startsWith(" "),R=`@${t.handle}${m?" ":""}`,w=`${i}${R}${l}`;D(w),qe(p=>({...p,open:!1})),requestAnimationFrame(()=>{const p=A.current;if(!p)return;const S=i.length+R.length;p.focus(),p.setSelectionRange(S,S)})},[I,ce.triggerStart]);o.useEffect(()=>{const t=A.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"},[I]),o.useEffect(()=>{B("/api/user").then(t=>mn(t.name)).catch(()=>{})},[]);const it=o.useMemo(()=>Na(T,C),[T,C]);o.useEffect(()=>{F===null||it===null||it>=F&&X(null)},[F,it]);const Tn=o.useMemo(()=>ka(g),[g]),we=Date.now(),xn=Aa(g,it,we),At=Tn&&!Ia(g)&&!xn,gs=M&&(H||F!==null||At),ys=M&&ja({sending:H,awaitingResponse:F!==null,currentFlight:g}),O=Bs({name:K?.name,agentName:u?.agentName,id:v,title:u?.title}),j=o.useMemo(()=>M?Ra({agentName:O,agentState:K?.state??null,sending:H,currentFlight:g,showWorkingTurn:At,awaitingResponse:F!==null}):{label:"Open",detail:"",tone:"idle",showStrip:!1,showTyping:!1},[K?.state,O,F,g,we,M,H,At]),It=g?.startedAt??Xe?.startedAt??F,jt=Yt(It),bs=Ya(It,we),[,vn]=o.useState(0);o.useEffect(()=>{if(!j.showTyping||jt===null)return;const t=Math.max(0,Date.now()-jt),e=[Ws.sustained,Ws.long].find(a=>a>t);if(e===void 0)return;const s=window.setTimeout(()=>vn(a=>a+1),e-t+50);return()=>window.clearTimeout(s)},[jt,j.showTyping,bs]);const Cn="Live",Rt=o.useMemo(()=>Ea({currentFlight:g,presence:j,turnActivity:Ne,turnAsk:Xe,awaitingResponseSince:F,nowMs:we}),[F,g,we,j,Ne,Xe]),Mn="s-thread-msg-card s-thread-msg-working-card s-thread-msg-card--avatar-row",Nn="s-thread-msg-kind",kn="s-thread-turn-snapshot",An="s-thread-turn-snapshot-pulse",In="s-thread-presence-line",jn=["s-thread-presence-strip",`s-thread-presence-strip--${bs}`].filter(Boolean).join(" "),Et=u?La(u):O,ws=u?.id??n,Rn=u?.alias?.trim()||null,lt=$a(u?.workspaceRoot),En=j.tone,Lt=T.length===0&&M&&(j.showTyping||g!==null||Ne.length>0||Xe!==null||F!==null),Ss=o.useMemo(()=>u?u.participantIds.includes("operator"):M,[M,u]),Be=g?.agentId??v,Ue=Be?Gt(b,[Be]):null,He=Ue?.id??Be,We=g?.sessions.at(-1)?.sessionId??Ue?.harnessSessionId??void 0,Ts=g?.id?()=>{ft(d,{view:"sessions",flightId:g.id,...He?{agentId:He}:{},...We?{sessionId:We}:{},...$?{machineId:$}:{}},{returnTo:N})}:void 0,xs=g?.id??null;o.useEffect(()=>{if(!xs||!He){bt(null);return}let t=!1;const e=We?`?sessionId=${encodeURIComponent(We)}`:"",s=async()=>{try{const i=await B(`/api/agents/${encodeURIComponent(He)}/observe${e}`);if(t)return;bt(l=>ne(l,i))}catch{}};s();const a=window.setInterval(()=>{s()},Kr);return()=>{t=!0,window.clearInterval(a),bt(null)}},[xs,He,We]);const $t=o.useMemo(()=>gr({flight:g,agent:Ue??K,sessionMeta:u,observeSessionId:Ye?.sessionId}),[K,g,u,Ye?.sessionId,Ue]),vs=_r({sessionIds:$t,active:j.showTyping||Lt}),Ln=o.useMemo(()=>yr({observe:Ye,flight:g}),[g,Ye]),ee=vs.length>0?vs:Ln,Ft=o.useMemo(()=>ee.length>0?null:br({flight:g,hasSessionScope:$t.length>0,awaitingResponse:F!==null}),[F,g,$t.length,ee.length]),Ot=wr(ee),Pt=Sr(ee),Cs=ee.at(-1)??null,qt=Cs?pt(Cs.ts,we):null,de=o.useMemo(()=>Pt?{...Rt,latest:Pt,...Ot?{activityLabel:Ot}:{},...qt?{lastActivityLabel:qt}:{}}:Rt,[qt,Pt,Rt,Ot]),$n=`${O}: ${de.latest}`,Ms=Be&&Fa(Ue)?()=>{ft(d,{view:"terminal",agentId:Be,mode:"takeover"},{returnTo:N})}:void 0,Dt=M?()=>{f&&Zt({type:"focus-composer",reason:"Steer the active conversation"})||requestAnimationFrame(()=>{A.current?.focus({preventScroll:!0}),A.current?.scrollIntoView({block:"nearest"})})}:void 0,Fn=o.useMemo(()=>(u?u.participantIds.filter(e=>e!=="operator"):v?[v]:[]).map(e=>{const s=Gt(b,[e]),a=Z.get(e);return{id:e,name:a?.scopedAlias??s?.name??a?.displayName??qs(e)??e,title:a?.label??s?.id??e,agent:s,sessionId:a?.sessionId??null,harness:s?.harness??a?.harness??null,model:s?.model??null,reasoningEffort:s?.reasoningEffort??null}}),[v,Z,b,u]),On=o.useMemo(()=>({name:C,active:Ss}),[Ss,C]),ue=o.useMemo(()=>new Map(T.map(t=>[t.id,t])),[T]),Bt=o.useMemo(()=>b.find(t=>or(t)&&!!t.conversationId?.trim())?.conversationId?.trim()??null,[b]),_e=o.useMemo(()=>Oa(T),[T]),[Pn,Ut]=o.useState(()=>new Set),qn=o.useCallback(t=>{Ut(e=>{const s=new Set(e);return s.delete(t)||s.add(t),s})},[]),Ns=o.useMemo(()=>{const t=new Map;for(const e of _e)if(e.kind==="fanout")for(const s of e.messages)t.set(s.id,e.key);return t},[_e]),ct=o.useCallback(t=>{const e=Ns.get(t);e&&Ut(l=>l.has(e)?l:new Set(l).add(e));const s=document.getElementById(`msg-${t}`);if(!s)return;const a=s.closest(".s-thread-fanout")??s,i=a===s?"s-thread-msg--flash":"s-thread-fanout--flash";a.scrollIntoView({behavior:"smooth",block:"center"}),a.classList.add(i),window.setTimeout(()=>a.classList.remove(i),1200)},[Ns]);o.useEffect(()=>{const t=()=>rn(Gs(window.location.hash));return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)},[]),o.useEffect(()=>{if(!Ze||!ue.has(Ze))return;const t=window.setTimeout(()=>ct(Ze),50);return()=>window.clearTimeout(t)},[Ze,ue,ct]),tr(o.useCallback(t=>{if(t.kind==="message.posted"){const e=t.payload?.message;if(!e||!xt.has(e.conversationId))return;const s=e.actorId==="operator",a=M&&!s&&e.class==="agent",i={id:e.id,conversationId:e.conversationId,actorId:e.actorId,actorName:a?O:Pa(e.actorId,b,C),body:e.body,createdAt:e.createdAt,class:s?"operator":e.class,attachments:e.attachments,metadata:e.metadata,replyToMessageId:e.replyToMessageId??e.n??null};if(Xt(i))return;if(V(l=>{const m=zr(e.metadata),R=m?re.current.get(m):void 0;if(l.some(w=>w.id===e.id))return m&&re.current.delete(m),l;if(s&&m){const w=qa(l,m,R);if(w!==-1){const p=[...l];return p[w]=i,re.current.delete(m),Ce(p)}}return Ce([...l,i])}),a){const l=Yt(e.createdAt)??Date.now();X(m=>m===null||l<m||Da($e.current)?m:null),ge(m=>Ba(m)?null:m)}return}if(t.kind==="invocation.requested"){const e=t.payload?.invocation;if(!e||e.targetAgentId!==v||!e.conversationId||!xt.has(e.conversationId))return;Le.current.add(e.id),ke([]),Ae(null),X(s=>s??Date.now());return}if(t.kind==="flight.updated"){const e=t.payload?.flight;if(!e||e.targetAgentId!==v||!(Le.current.has(e.invocationId)||$e.current?.id===e.id))return;if(Ua.has(e.state)){Os(n,e.id),ge(l=>l?.id===e.id?null:l),ke([]),Ae(null),X(null),U({messageMode:"refresh",includeMetadata:!1});return}Le.current.add(e.invocationId);const a=$e.current?.id===e.id,i=Us(e,n,v??"",$e.current);Ha(i)&&X(null),ge(i),a||(ke([]),Ae(null));return}t.kind!=="agent.endpoint.upserted"&&t.kind==="unknown"&&U({messageMode:"refresh"})},[v,O,n,xt,M,U,C,b])),o.useEffect(()=>{if(!gs)return;const t=setInterval(()=>{U({messageMode:"refresh",includeMetadata:!1})},5e3);return()=>clearInterval(t)},[gs,U]),o.useEffect(()=>{const t=()=>{if(document.visibilityState!=="visible")return;const e=Date.now();e-us.current<1e3||(us.current=e,U({messageMode:"refresh"}))};return window.addEventListener("focus",t),document.addEventListener("visibilitychange",t),()=>{window.removeEventListener("focus",t),document.removeEventListener("visibilitychange",t)}},[U]);const Ht=o.useRef(null),ks=o.useRef(!1),Wt=o.useRef(!1),_t=o.useCallback(t=>{const e=je.current;e&&(tt.current=!0,be.current!==null&&clearTimeout(be.current),t==="instant"?e.scrollTop=e.scrollHeight:e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),be.current=setTimeout(()=>{tt.current=!1,be.current=null},t==="smooth"?700:0))},[]);o.useEffect(()=>()=>{be.current!==null&&clearTimeout(be.current)},[]);const Dn=o.useCallback(()=>{const t=je.current;if(!t||tt.current)return;const s=t.scrollHeight-t.clientHeight-t.scrollTop<=Qr;Ee.current=s,s?(Ie(!1),et(0)):Ie(!0)},[]),Bn=o.useCallback(()=>{Ee.current=!0,Ie(!1),et(0),_t("smooth")},[_t]);o.useEffect(()=>{const t=T.at(-1)?.id??null,e=!!(t&&t!==Ht.current),s=Wa({newestMessageId:t,previousNewestMessageId:Ht.current,showTyping:j.showTyping,previousShowTyping:ks.current,historyRestorePending:st.current||Re.current!==null,initialScrollDone:Wt.current,nearBottom:Ee.current});s!=="none"?(_t(s),Wt.current=!0):e&&Wt.current&&!Ee.current&&(Ie(!0),et(a=>a+1)),st.current=!1,Ht.current=t,ks.current=j.showTyping});const[,Un]=o.useState(0);o.useEffect(()=>{const t=setInterval(()=>Un(e=>e+1),15e3);return()=>clearInterval(t)},[]);const me=ma(),[he,te]=o.useState([]),[As,dt]=o.useState("queue"),[Se,Te]=o.useState(null),xe=async(t,e)=>{const s=t.trim(),a=e?.attachments??[],i=e?.replyTarget??null;if(!s&&a.length===0||H)return"failed";const m=e?.forceAction??_s({isDm:M,hasOutstandingReply:ys}),R=Date.now(),w=da(),p={id:`optimistic-${w}`,conversationId:n,actorId:"operator",actorName:C,body:s,createdAt:R,class:"operator",...i?{replyToMessageId:i.messageId}:{},metadata:{clientMessageId:w,deliveryState:"sending"},...a.length>0?{attachments:a}:{}};at(!0),m!=="message"&&X(R),ae(null),re.current.set(w,p.id),V(S=>Ce([...S,p]));try{const S=await B(`/api/chats/${encodeURIComponent(n)}/messages`,{method:"POST",body:JSON.stringify({body:s,clientMessageId:w,...i?{replyToMessageId:i.messageId}:{},...a.length>0?{attachments:a}:{}})}),W=S.chatId?.trim()??S.conversationId?.trim();if(W&&W!==n)throw new Error(`Send returned a different Chat (${W}) instead of appending to ${n}.`);if(S.messageId?.trim()){const L=S.messageId.trim();V(fe=>Ce(fe.map(E=>E.id===p.id?{...E,id:L,metadata:{clientMessageId:w}}:E))),re.current.delete(w)}return S.flight?(Le.current.add(S.flight.invocationId),ge(Us(S.flight,n,v??"")),ke([]),Ae(null)):m!=="message"&&X(null),"sent"}catch(S){return Vr(S)?(V(W=>W.map(L=>L.id===p.id?{...L,metadata:{...L.metadata??{},deliveryState:"unknown"}}:L)),"unknown"):(V(W=>W.filter(L=>L.id!==p.id)),re.current.delete(w),X(null),ae(S instanceof Error?S.message:String(S)),"failed")}finally{at(!1)}},Hn=async t=>{const e=t.replyToMessageId?ue.get(t.replyToMessageId):null;if(!e||H)return;const s=[];for(const i of e.attachments??[]){if(!i.url){ae("This request includes an attachment that can’t be reused. Add it again, then retry."),requestAnimationFrame(()=>A.current?.focus());return}s.push({id:i.id,mediaType:i.mediaType,...i.fileName?{fileName:i.fileName}:{},url:i.url})}await xe(e.body,{forceAction:"invoke",attachments:s})!=="failed"&&hs(t)},Wn=(t,e,s)=>{if(!Bt)return;const a=t.replyToMessageId?ue.get(t.replyToMessageId)?.body.trim():"",i=a?`${a.slice(0,1200)}${a.length>1200?"…":""}`:"(The original request is no longer available in this transcript.)",l=[`Help me recover a failed request to ${e}.`,s,"","Original request:",i].join(`
2
2
  `),m={view:"conversation",conversationId:Bt,composeDraft:l};f&&Zt({type:"navigate",route:m,reason:"Ask @scoutbot to help recover a failed conversation request"})||d(m)},_n=async()=>{const t=I.trim(),e=oe,s=me.files,a=Se?.attachments??[];if(!t&&s.length===0&&a.length===0)return null;let i=[];if(s.length>0){at(!0);try{i=await ua(s)}catch(l){return me.setError(l instanceof Error?l.message:String(l)),null}finally{at(!1)}}return D(""),ie(null),me.clear(),Te(null),{body:t,attachments:[...a,...i],replyTarget:e}},Kn=async()=>{const t=Za({isAgentBusy:pe,intent:As}),e=Se?.id??null,s=await _n();if(!s)return;if(t==="queue"){te(l=>e?l.map(m=>m.id===e?{...m,body:s.body,attachments:s.attachments,replyTarget:s.replyTarget}:m):[...l,{id:`queued-${Date.now()}-${l.length}`,body:s.body,attachments:s.attachments,replyTarget:s.replyTarget,queuedAt:Date.now()}]);return}e&&te(l=>l.filter(m=>m.id!==e));const a=()=>{D(s.body),Te(s.attachments.length>0?{id:null,attachments:s.attachments}:null),ie(s.replyTarget),requestAnimationFrame(()=>A.current?.focus())};if(t==="steer"){dt("queue"),await Qt(),await xe(s.body,{forceAction:"steer",attachments:s.attachments,replyTarget:s.replyTarget})==="failed"&&a();return}await xe(s.body,{attachments:s.attachments,replyTarget:s.replyTarget})==="failed"&&a()},Qn=t=>{te(e=>e.filter(s=>s.id!==t)),Te(e=>e?.id===t?null:e)},zn=t=>{const e=he.find(s=>s.id===t);e&&(D(e.body),ie(e.replyTarget??null),Te({id:t,attachments:e.attachments}),requestAnimationFrame(()=>{const s=A.current;s&&(s.focus(),s.setSelectionRange(s.value.length,s.value.length))}))},Vn=()=>{Te(null),D(""),ie(null),me.clear()},Jn=async t=>{const e=he.find(a=>a.id===t);if(!e)return;te(a=>a.filter(i=>i.id!==t)),await Qt(),await xe(e.body,{forceAction:"steer",attachments:e.attachments,replyTarget:e.replyTarget??null})==="failed"&&te(a=>[e,...a])},ut=o.useCallback((t,e)=>{const s=e?.trim().replace(/^@+/,"")||null,a=s?`@${s}`:null,i=oe?.insertedMention?Xs(I,oe.insertedMention):I,l=!!(!M&&a&&!i.toLocaleLowerCase().includes(a.toLocaleLowerCase())),m=l&&a?i.trim()?`${i.trimEnd()} ${a} `:`${a} `:i;D(m),ie({messageId:t.id,actorLabel:s?`@${s}`:t.actorName,preview:Ys(t),insertedMention:l?a:null}),requestAnimationFrame(()=>A.current?.focus())},[I,M,oe?.insertedMention]),Gn=o.useCallback(()=>{const t=oe?.insertedMention;ie(null),t&&D(e=>Xs(e,t)),requestAnimationFrame(()=>A.current?.focus())},[oe]),Kt=o.useCallback(t=>{const e=new URL(window.location.href);N.view==="agents-v2"&&e.searchParams.set("tab","message"),e.hash=`msg-${t}`,ze(e.toString())},[N.view]),Is=o.useCallback((t,e,s)=>{const a=ca({conversationId:n,selectedMessageId:t.id,messages:T.map(i=>({id:i.id,actorLabel:i.id===t.id?e:Qe(i,C)?C:i.actorName,body:i.body,attachmentCount:i.attachments?.length??0}))});h({intent:"forward-message",forwardContext:a,forwardContextMode:"selected-message",...s?{projectPath:s}:{}})},[n,T,h,C]),Qt=async()=>{if(v)try{await B("/api/agents/"+encodeURIComponent(v)+"/interrupt",{method:"POST",body:JSON.stringify({})})}catch{}},pe=j.tone==="working"||j.tone==="pending",Yn=_s({isDm:M,hasOutstandingReply:ys}),Xn=M?`Message ${O} — type / to route or @ to mention an agent`:u?.kind==="channel"?`Comment in #${_a(u)} — mention @agent to request a reply`:`Comment in ${Et} — mention @agent to request a reply`,js=Se?.attachments??[],Zn=!I.trim()&&!me.hasFiles&&js.length===0&&pe,zt=o.useRef(!1);o.useEffect(()=>{const t=Se?.id??null,e=t?he.filter(a=>a.id!==t):he;if(!Ka({isAgentBusy:pe,sending:H,queued:e})||zt.current)return;const s=e[0];s&&(zt.current=!0,te(a=>a.filter(i=>i.id!==s.id)),xe(s.body,{attachments:s.attachments,replyTarget:s.replyTarget??null}).then(a=>{a==="failed"&&te(i=>[s,...i])}).finally(()=>{zt.current=!1}))},[pe,H,he,Se]),o.useEffect(()=>{pe||dt("queue")},[pe]),o.useEffect(()=>{te([]),Te(null),ie(null),dt("queue"),me.clear()},[n]);const ea=Qa(he),Rs=ga(),ta=o.useCallback((t,e)=>{const s=window.getSelection()?.toString().trim(),a=Qe(e,C),i=e.actorId?Z.get(e.actorId):null,l=a?null:Hs(e,b,v),m=(i?.scopedAlias?.trim()||l?.handle?.trim()||null)?.replace(/^@+/,"")??null,R=m?`@${m}`:e.actorName,w=(l?.id||i?.agentId||e.actorId||"").trim(),p=[];a||p.push({kind:"action",label:"Reply",onSelect:()=>ut(e,m)}),p.push({kind:"action",label:"Forward to new task…",onSelect:()=>Is(e,R,i?.workspaceRoot??l?.projectRoot??l?.cwd??void 0)}),p.push({kind:"separator"}),s&&p.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>{ze(s)}}),p.push({kind:"action",label:"Copy Message",onSelect:()=>{ze(e.body)}}),p.push({kind:"action",label:"Copy Link",onSelect:()=>Kt(e.id)}),p.push({kind:"separator"}),!a&&w&&p.push({kind:"action",label:"Copy Agent ID",onSelect:()=>{ze(w)}}),p.push({kind:"action",label:"Copy Message ID",onSelect:()=>{ze(e.id)}}),Rs(t,p)},[v,ut,Kt,Is,C,Z,b,Rs]),sa=async(t,e)=>{const s=`@${e.agentId} `,a=I.trim();if(a){D(""),await xe(`${s}${a}`,{forceAction:"invoke"});return}D(s),A.current?.focus()},Ke=o.useMemo(()=>{if(!u)return[];const t=new Set(u.participantIds);return b.filter(e=>!t.has(e.id)&&!e.retiredFromFleet).sort((e,s)=>e.name.localeCompare(s.name))},[u,b]);o.useEffect(()=>{Ct&&ot(t=>t&&Ke.some(e=>e.id===t)?t:Ke[0]?.id??"")},[Ct,Ke]);const Es=!!(u&&["direct","group_direct","channel"].includes(u.kind)&&Ke.length>0),na=o.useCallback(async()=>{if(!u)return;const t=Mt.trim();if(t){Nt(!0),De(null);try{const e=await B(`/api/conversations/${encodeURIComponent(u.id)}/members`,{method:"POST",body:JSON.stringify({actorId:t})});e.session?yt(e.session):yt(s=>s&&{...s,kind:e.kind,participantIds:e.participantIds}),rt(!1),ot(""),await U({messageMode:"none"})}catch(e){De(e instanceof Error?e.message:String(e))}finally{Nt(!1)}}},[Mt,U,u]);return r.jsx("div",{className:`s-thread-layout${f?" s-thread-layout--embedded":""}`,"data-thread-treatment":k==="standard"?void 0:k,children:r.jsxs("div",{className:"s-thread-center",children:[!f&&r.jsx(cr,{showBackNav:y,isDm:M,navigate:d,route:N,canonicalConversationId:ws,threadTitle:Et,agentId:K?.id??null,sessionId:ps,detailRoute:dn,participants:Fn,operator:On,canAddParticipants:Es,onToggleAddParticipant:()=>{De(null),rt(t=>!t)}}),!f&&u&&r.jsx(dr,{canonicalConversationId:ws,conversationAlias:Rn}),!f&&Ct&&Es&&r.jsx(ur,{agents:Ke,addParticipantId:Mt,setAddParticipantId:ot,addingParticipant:pn,addParticipantError:hn,onCancel:()=>{rt(!1),De(null)},onSubmit:()=>{na()}}),vt&&r.jsx(kr,{pinnedAsk:vt,onAnswer:()=>{const t=[...T].reverse().find(e=>e.actorId===vt.agentId)??[...T].reverse().find(e=>!Qe(e,C)&&e.class!=="status"&&e.class!=="system");t?ut(t,t.actorId?Z.get(t.actorId)?.scopedAlias??null:null):A.current?.focus()},onSteer:Dt}),r.jsx(Ar,{presence:j,agent:K}),cs&&r.jsx("p",{className:"s-thread-error",children:cs}),r.jsxs("div",{className:"s-thread-feed","data-conversation-id":n,ref:je,onScroll:Dn,children:[!ls&&T.length>0&&cn&&r.jsx("div",{className:"s-thread-history-control",children:r.jsxs("button",{type:"button",className:"s-thread-history-button",disabled:ye,"aria-busy":ye,onClick:()=>{un()},children:[ye&&r.jsx("span",{className:"s-thread-history-spinner","aria-hidden":"true"}),ye?"Loading earlier messages…":"Load earlier messages"]})}),ls?r.jsx(Tr,{}):T.length===0?Lt?r.jsx(xr,{agentName:O,title:j.label,detail:j.detail||de.latest,snapshot:de,events:Ne,steps:ee,phase:Ft,tone:En,workspaceName:lt,branch:u?.currentBranch,startedAt:It,onOpenTrace:Ts,onOpenTerminal:Ms,onSteer:Dt}):r.jsxs("div",{className:"s-thread-empty",children:[r.jsx("div",{className:"s-thread-empty-glyph","aria-hidden":"true",children:M?"@":"#"}),r.jsx("p",{children:Et}),r.jsx("p",{children:M?"No messages yet. Send a message to start working with this agent.":"No messages yet. Start the conversation below."}),(lt||u?.currentBranch)&&r.jsxs("div",{className:"s-thread-empty-chips",children:[lt&&r.jsx("span",{className:"s-thread-empty-chip",children:lt}),u?.currentBranch&&r.jsx("span",{className:"s-thread-empty-chip",children:u.currentBranch})]})]}):_e.map((t,e)=>{const s=za(t,e);if(t.kind==="fanout")return r.jsx(mr,{row:t,expanded:Pn.has(t.key),showDayDivider:s,onToggle:()=>qn(t.key)},t.key);const a=t.message,i=Qe(a,C),l=Va(a),m=l?"scout.dispatch":a.class,R=Xa(m),w=m==="status",p=Ks(a.createdAt),S=i?null:Hs(a,b,v),L=Z.get(a.actorId)?.scopedAlias?.trim()||null,fe=!i&&L?L:a.actorName,E=i?C.toLowerCase():L??S?.handle??null,se=Ja(a.body),Q=se?Ga({flightId:se.flightId,replyToMessageId:a.replyToMessageId,messagesById:ue,agents:b,operatorName:C}):null,_=!se&&a.replyToMessageId?ue.get(a.replyToMessageId)??null:null,J=_?Qe(_,C)?C:_.actorName:null,ve=se?se.body:a.body,P=Qs(a);if(P&&wt.has(a.id))return null;const Vt=typeof a.metadata?.targetAgentId=="string"?a.metadata.targetAgentId:null,mt=P?Gt(b,[Vt,P.target]):null,x=P?Bs({name:mt?.name,id:mt?.id,title:nr(P.target)}):null;return r.jsxs("div",{className:["s-thread-feed-block",i&&"s-thread-feed-block--you",s&&"s-thread-feed-block--full-width"].filter(Boolean).join(" "),children:[s&&r.jsx(hr,{at:a.createdAt}),P&&x?r.jsxs("article",{id:`msg-${a.id}`,className:["s-thread-msg","s-thread-failure-notice",(Ge||is?.has(a.id))&&"s-thread-msg--enter"].filter(Boolean).join(" "),style:Ge?{animationDelay:`${Math.max(0,7-(_e.length-1-e))*26}ms`}:void 0,"data-class":m,"aria-label":"Delivery issue",children:[r.jsx("span",{className:"s-thread-failure-notice-mark","aria-hidden":"true",children:"!"}),r.jsxs("div",{className:"s-thread-failure-notice-content",children:[r.jsxs("p",{children:[r.jsxs("strong",{children:[x," couldn’t reply."]})," ",r.jsx("span",{children:P.explanation})]}),P.technicalDetail&&r.jsxs("details",{className:"s-thread-failure-notice-details",children:[r.jsx("summary",{children:"Technical details"}),r.jsx("pre",{children:P.technicalDetail})]}),r.jsxs("div",{className:"s-thread-failure-notice-actions",children:[a.replyToMessageId&&ue.has(a.replyToMessageId)&&r.jsx("button",{className:"s-thread-failure-notice-action s-thread-failure-notice-action--primary",type:"button",disabled:H,onClick:()=>{Hn(a)},children:H?"Retrying…":"Retry"}),Bt&&r.jsx("button",{className:"s-thread-failure-notice-action",type:"button",onClick:()=>Wn(a,x,P.explanation),children:"Ask @scoutbot"}),r.jsx("button",{className:"s-thread-failure-notice-action s-thread-failure-notice-action--clear",type:"button",onClick:()=>hs(a),"aria-label":`Clear delivery issue for ${x}`,children:"Clear"})]})]}),r.jsx("span",{className:"s-thread-failure-notice-time",title:p,children:pt(a.createdAt)})]}):r.jsx("article",{id:`msg-${a.id}`,className:["s-thread-msg",i&&"s-thread-msg--you",w&&"s-thread-msg--tool",(Ge||is?.has(a.id))&&"s-thread-msg--enter"].filter(Boolean).join(" "),style:Ge?{animationDelay:`${Math.max(0,7-(_e.length-1-e))*26}ms`}:void 0,"data-class":m,onContextMenu:q=>ta(q,a),children:r.jsx("div",{className:"s-thread-msg-card",children:r.jsxs("div",{className:"s-thread-msg-card-content",children:[r.jsxs("div",{className:"s-thread-msg-header",children:[r.jsxs("div",{className:"s-thread-msg-meta",children:[(()=>{const q=!i&&S?()=>ft(d,{view:"agents-v2",agentId:S.id},{returnTo:N}):null,Ls=i?C:fe??"?",$s=r.jsx(es,{agent:S??void 0,name:Ls,placement:"turn",size:28,className:"s-thread-msg-avatar",title:Ls});return q?r.jsx("button",{type:"button",className:"s-thread-msg-avatar--nav",onClick:q,"aria-label":`View profile for ${a.actorName??"agent"}`,title:`View profile for ${a.actorName??"agent"}`,children:$s}):$s})(),!i&&S?r.jsx("button",{type:"button",className:"s-thread-msg-actor s-thread-msg-actor--nav",onClick:()=>ft(d,{view:"agents-v2",agentId:S.id},{returnTo:N}),title:`View profile for ${a.actorName}`,children:fe}):r.jsx("span",{className:"s-thread-msg-actor",children:i?C:fe}),E&&r.jsxs("span",{className:"s-thread-msg-handle",children:["@",E]}),R&&r.jsx("span",{className:"s-thread-msg-kind",children:R})]}),r.jsx("span",{className:"s-thread-msg-time",title:p,children:pt(a.createdAt)}),r.jsxs("span",{className:"s-thread-msg-actions",children:[!i&&E&&r.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":`Reply to @${E}`,title:`Reply to @${E}`,onClick:()=>ut(a,E),children:r.jsx(ss,{})}),r.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":"Copy link to message",title:"Copy link to message",onClick:()=>Kt(a.id),children:r.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:[r.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"}),r.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"})]})})]})]}),Q&&r.jsxs("button",{type:"button",className:"s-thread-reply-ctx",title:`Open the originating request${Q.flightId?` · ${Q.flightId}`:""}`,onClick:()=>ct(Q.originatingMessageId),children:[r.jsx(ss,{}),r.jsx("span",{className:"s-thread-reply-ctx-label",children:"reply to"}),r.jsx("span",{className:"s-thread-reply-ctx-title",children:Q.title}),r.jsxs("span",{className:"s-thread-reply-ctx-from",children:["· ",Q.from]}),r.jsx("span",{className:"s-thread-reply-ctx-status",children:"· done"})]}),_&&J&&r.jsxs("button",{type:"button",className:"s-thread-reply-ctx",title:`Open message from ${J}`,onClick:()=>ct(_.id),children:[r.jsx(ss,{}),r.jsx("span",{className:"s-thread-reply-ctx-label",children:"reply to"}),r.jsx("span",{className:"s-thread-reply-ctx-title",children:Ys(_)}),r.jsxs("span",{className:"s-thread-reply-ctx-from",children:["· ",J]})]}),r.jsx("div",{className:"s-thread-msg-body",title:p,children:r.jsx(sr,{text:ve})}),r.jsx(Wr,{message:a}),l&&l.candidates.length>0&&r.jsx("div",{className:"s-thread-dispatch",children:l.candidates.map(q=>r.jsxs("button",{type:"button",className:"s-thread-dispatch-tile",onClick:()=>{sa(l,q)},children:[r.jsxs("span",{className:"s-thread-dispatch-tile-id",children:["@",q.agentId]}),r.jsx("span",{className:"s-thread-dispatch-tile-state",children:q.endpointState}),r.jsx("span",{className:"s-thread-dispatch-tile-meta",children:[q.workspace,q.node,q.projectRoot].filter(Boolean).join(" · ")||q.displayName})]},q.agentId))})]})})})]},a.id)}),j.showTyping&&!Lt&&r.jsx("div",{className:"s-thread-feed-block",children:r.jsx("div",{className:"s-thread-msg","aria-live":"polite",children:r.jsxs("div",{className:Mn,children:[r.jsx(es,{agent:K??void 0,name:O,placement:"turn",size:28,className:"s-thread-msg-avatar s-thread-msg-avatar--working",title:O}),r.jsxs("div",{className:"s-thread-msg-card-content",children:[r.jsxs("div",{className:"s-thread-msg-header",children:[r.jsxs("div",{className:"s-thread-msg-meta",children:[r.jsx("span",{className:"s-thread-msg-actor",children:O}),r.jsx("span",{className:Nn,children:Cn})]}),r.jsx("span",{className:"s-thread-msg-time",title:g?.startedAt?Ks(g.startedAt):"now",children:g?.startedAt?pt(g.startedAt):"now"})]}),r.jsxs("div",{className:"s-thread-msg-working-body",children:[r.jsxs("div",{className:kn,children:[r.jsx("span",{className:An,"aria-hidden":"true"}),r.jsxs("div",{className:"s-thread-turn-snapshot-main",children:[r.jsx("span",{className:"s-thread-turn-snapshot-label",children:"Latest"}),r.jsx("span",{className:"s-thread-msg-working-copy",children:de.latest})]})]}),r.jsxs("dl",{className:"s-thread-turn-snapshot-stats",children:[r.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[r.jsx("dt",{children:"Activity"}),r.jsx("dd",{children:de.activityLabel})]}),r.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[r.jsx("dt",{children:"Elapsed"}),r.jsx("dd",{children:de.elapsedLabel})]}),r.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[r.jsx("dt",{children:"Last"}),r.jsx("dd",{children:de.lastActivityLabel})]})]}),ee.length>0||Ft?r.jsx(vr,{steps:ee,phase:Ft,limit:5,compact:!0}):r.jsx(Cr,{events:Ne,limit:4,compact:!0}),r.jsx(Mr,{onOpenTrace:Ts,onOpenTerminal:Ms,onSteer:Dt,compact:!0})]})]})]})})}),on&&Tt>0&&r.jsxs("button",{type:"button",className:"s-thread-new-messages",onClick:Bn,children:[r.jsx("span",{"aria-hidden":"true",children:"↓"})," ",Tt," new ",Tt===1?"message":"messages"," · jump to latest"]}),r.jsx("div",{ref:ln})]}),j.showTyping&&r.jsxs("div",{className:In,children:[r.jsx("div",{className:"s-thread-presence-line-avatars",children:r.jsx(es,{agent:K??void 0,name:O,placement:"turn",size:22,className:"s-thread-presence-line-avatar",title:O})}),r.jsx("span",{className:"s-thread-presence-line-label",children:$n}),r.jsx("div",{className:jn,"aria-hidden":"true"})]}),r.jsx(ha,{composeRef:A,draft:I,setDraft:D,composePlaceholder:Xn,slashState:le,setSlashState:Pe,filteredSlashCommands:fn,applySlashCommand:wn,mentionState:ce,setMentionState:qe,filteredMentions:gn,applyMention:Sn,updateTriggersFromDraft:bn,closeSuggestions:yn,replyTarget:oe,onCancelReply:Gn,isStopMode:Zn,sending:H,composeAction:Yn,onSend:()=>{Kn()},onInterrupt:()=>{Qt()},attachments:me,isAgentBusy:pe,busyIntent:As,onBusyIntentChange:dt,queued:he,queueNote:ea,onEditQueued:zn,editingQueuedId:Se?.id??null,editingAttachmentCount:js.length,onCancelEdit:Vn,onUnqueue:Qn,onSendQueuedNow:t=>{Jn(t)}})]})})}function ss(){return r.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:[r.jsx("polyline",{points:"9 14 4 9 9 4"}),r.jsx("path",{d:"M20 20v-7a4 4 0 0 0-4-4H4"})]})}const hi=lr({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:er}});export{mi as ConversationScreen,hi as scoutSurface};
@@ -1 +1 @@
1
- import{r as x,j as s}from"./index-DvLtl7rV.js";import{c as v,C as y,o as w}from"./conversation-model-Dc02NsGp.js";import{C as b}from"./check-ofKUE8yH.js";import{S as C}from"./sparkles-CETYrxGA.js";import{X as k}from"./x-CAbNespN.js";import{c as E}from"./createLucideIcon-DezKXSG2.js";import"./colors-BtO5_zlx.js";import"./time-Dhsh_2EG.js";const L=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],S=E("shield-alert",L);function z(e){const a=e.split(/\r?\n/).map(t=>t.trim()).find(Boolean)??"",r=110;return a.length>r?`${a.slice(0,r-1).trimEnd()}…`:a}function W({pinnedAsk:e,onAnswer:a,onApprove:r,onReject:t,onSteer:i,enableKeyboard:o=!0}){const l=e.summary?.trim()||null,d=z(e.task),p=l&&l!==e.task.trim()?l:d,N=p!==d&&d.length>0,c=/\b(?:approve|approval|permission|allow|proceed|confirm|gate)\b/i.test(p),f=c?"Approval Gate":p.includes("?")?"Question":e.statusLabel,g=e.agentName??v(e.agentId)??e.agentId,m=x.useCallback(()=>{r?r():a()},[r,a]),u=x.useCallback(()=>{i?i():a()},[i,a]);return x.useEffect(()=>{if(!o)return;const j=n=>{const h=document.activeElement;h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement||h instanceof HTMLElement&&h.isContentEditable||n.metaKey||n.ctrlKey||n.altKey||(n.key==="y"||n.key==="Y"?(n.preventDefault(),m()):n.key==="s"||n.key==="S"?(n.preventDefault(),u()):(n.key==="n"||n.key==="N")&&t&&(n.preventDefault(),t()))};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[o,m,u,t]),s.jsxs("div",{className:`s-thread-pinned-ask surface-card ${c?"s-thread-pinned-ask--approval":"s-thread-pinned-ask--question"}`,role:"alert","aria-live":"assertive",children:[s.jsxs("div",{className:"s-thread-pinned-ask-header",children:[s.jsx("div",{className:"s-thread-pinned-ask-beacon","aria-hidden":"true",children:s.jsx("span",{className:"dot dot--sm dot--warning dot--pulse dot--glow"})}),s.jsxs("div",{className:"s-thread-pinned-ask-kicker",children:[s.jsx("span",{className:"label-sm s-thread-pinned-ask-eyebrow",children:"Operator Attention Required"}),s.jsx("span",{className:"chip chip--sm chip--mono chip--warning",children:f})]}),s.jsxs("div",{className:"s-thread-pinned-ask-routing",children:[s.jsxs("span",{className:"s-thread-pinned-ask-agent-name chip chip--sm chip--mono chip--neutral",children:["@",g]}),s.jsx("span",{className:"s-thread-pinned-ask-routing-arrow","aria-hidden":"true",children:"→"}),s.jsx("span",{className:"chip chip--sm chip--mono chip--working",children:"You"})]})]}),s.jsxs("div",{className:"s-thread-pinned-ask-body",children:[s.jsx("p",{className:"s-thread-pinned-ask-text",children:p}),N&&s.jsxs("p",{className:"s-thread-pinned-ask-context text-muted",children:["Re: ",d]})]}),s.jsxs("div",{className:"s-thread-pinned-ask-actions",children:[s.jsxs("button",{type:"button",className:"btn btn--primary s-thread-pinned-ask-btn",onClick:m,title:c?"Approve this gate [Y]":"Answer this question [Y]",children:[s.jsx("kbd",{className:"s-kbd",children:"[Y]"}),c?s.jsx(b,{size:13,strokeWidth:2.2}):s.jsx(y,{size:13}),s.jsx("span",{children:c?"Approve":"Answer"})]}),s.jsxs("button",{type:"button",className:"btn btn--accent s-thread-pinned-ask-btn",onClick:u,title:"Provide guidance or steer [S]",children:[s.jsx("kbd",{className:"s-kbd",children:"[S]"}),s.jsx(C,{size:13,strokeWidth:1.9}),s.jsx("span",{children:"Steer"})]}),t&&s.jsxs("button",{type:"button",className:"btn btn--danger s-thread-pinned-ask-btn",onClick:t,title:"Reject or decline [N]",children:[s.jsx("kbd",{className:"s-kbd",children:"[N]"}),s.jsx(k,{size:13,strokeWidth:2.2}),s.jsx("span",{children:"Reject"})]})]}),s.jsx("div",{className:"s-thread-pinned-ask-strip","aria-hidden":"true"})]})}function q({title:e,description:a,diff:r,command:t,risk:i="medium",onApprove:o,onReject:l,onSteer:d}){return s.jsxs("div",{className:"s-thread-approval-gate surface-card",role:"alert",children:[s.jsxs("div",{className:"s-thread-approval-gate-head",children:[s.jsxs("div",{className:"s-thread-approval-gate-title-wrap",children:[s.jsx(S,{size:16,className:"text-amber","aria-hidden":"true"}),s.jsx("span",{className:"label-sm text-amber",children:"Execution Approval Gate"}),i&&s.jsxs("span",{className:`chip chip--sm chip--mono ${i==="high"?"chip--danger":i==="medium"?"chip--warning":"chip--info"}`,children:[i.toUpperCase()," RISK"]})]}),s.jsx("h3",{className:"s-thread-approval-gate-title",children:e}),a&&s.jsx("p",{className:"s-thread-approval-gate-desc",children:a})]}),t&&s.jsxs("div",{className:"s-thread-approval-gate-command surface-card surface-card--inset",children:[s.jsx("span",{className:"label-xs text-muted",children:"Command"}),s.jsx("code",{className:"s-thread-approval-gate-code",children:t})]}),r&&s.jsxs("div",{className:"s-thread-approval-gate-diff surface-card surface-card--inset",children:[s.jsx("span",{className:"label-xs text-muted",children:"Diff Preview"}),s.jsx("pre",{className:"s-thread-approval-gate-diff-pre",children:s.jsx("code",{children:r})})]}),s.jsxs("div",{className:"s-thread-approval-gate-actions",children:[s.jsxs("button",{type:"button",className:"btn btn--primary",onClick:o,children:[s.jsx("kbd",{className:"s-kbd",children:"[Y]"}),s.jsx(b,{size:13}),s.jsx("span",{children:"Approve Action"})]}),s.jsxs("button",{type:"button",className:"btn btn--danger",onClick:l,children:[s.jsx("kbd",{className:"s-kbd",children:"[N]"}),s.jsx(k,{size:13}),s.jsx("span",{children:"Reject"})]}),d&&s.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:d,children:[s.jsx("kbd",{className:"s-kbd",children:"[S]"}),s.jsx("span",{children:"Steer…"})]})]})]})}function G({presence:e,agent:a}){if(!e.showStrip)return null;const r=e.tone==="working",t=e.tone==="pending";return s.jsxs("div",{className:`s-thread-status s-thread-status--${e.tone}`,"aria-live":"polite",children:[s.jsx("span",{className:"s-thread-status-dot-wrap","aria-hidden":"true",children:s.jsx("span",{className:`dot dot--sm ${r?"dot--working dot--pulse dot--glow":t?"dot--warning dot--pulse dot--glow":"dot--neutral"}`,style:{color:w(e,a?.state??null)}})}),s.jsxs("div",{className:"s-thread-status-copy",children:[s.jsx("span",{className:"s-thread-status-label label-xs",children:e.label}),s.jsx("span",{className:"s-thread-status-detail",children:e.detail})]})]})}export{q as ApprovalGateCard,G as ConversationStatusStrip,W as PinnedAskCard};
1
+ import{r as x,j as s}from"./index-BI9AljSD.js";import{c as v,C as y,o as w}from"./conversation-model-QsJVfSeG.js";import{C as b}from"./check-DbIkldnK.js";import{S as C}from"./sparkles-Cf8gin88.js";import{X as k}from"./x-DfRJbqrh.js";import{c as E}from"./createLucideIcon-DthwWQIg.js";import"./colors-BtO5_zlx.js";import"./time-Dhsh_2EG.js";const L=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],S=E("shield-alert",L);function z(e){const a=e.split(/\r?\n/).map(t=>t.trim()).find(Boolean)??"",r=110;return a.length>r?`${a.slice(0,r-1).trimEnd()}…`:a}function W({pinnedAsk:e,onAnswer:a,onApprove:r,onReject:t,onSteer:i,enableKeyboard:o=!0}){const l=e.summary?.trim()||null,d=z(e.task),p=l&&l!==e.task.trim()?l:d,N=p!==d&&d.length>0,c=/\b(?:approve|approval|permission|allow|proceed|confirm|gate)\b/i.test(p),f=c?"Approval Gate":p.includes("?")?"Question":e.statusLabel,g=e.agentName??v(e.agentId)??e.agentId,m=x.useCallback(()=>{r?r():a()},[r,a]),u=x.useCallback(()=>{i?i():a()},[i,a]);return x.useEffect(()=>{if(!o)return;const j=n=>{const h=document.activeElement;h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement||h instanceof HTMLElement&&h.isContentEditable||n.metaKey||n.ctrlKey||n.altKey||(n.key==="y"||n.key==="Y"?(n.preventDefault(),m()):n.key==="s"||n.key==="S"?(n.preventDefault(),u()):(n.key==="n"||n.key==="N")&&t&&(n.preventDefault(),t()))};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[o,m,u,t]),s.jsxs("div",{className:`s-thread-pinned-ask surface-card ${c?"s-thread-pinned-ask--approval":"s-thread-pinned-ask--question"}`,role:"alert","aria-live":"assertive",children:[s.jsxs("div",{className:"s-thread-pinned-ask-header",children:[s.jsx("div",{className:"s-thread-pinned-ask-beacon","aria-hidden":"true",children:s.jsx("span",{className:"dot dot--sm dot--warning dot--pulse dot--glow"})}),s.jsxs("div",{className:"s-thread-pinned-ask-kicker",children:[s.jsx("span",{className:"label-sm s-thread-pinned-ask-eyebrow",children:"Operator Attention Required"}),s.jsx("span",{className:"chip chip--sm chip--mono chip--warning",children:f})]}),s.jsxs("div",{className:"s-thread-pinned-ask-routing",children:[s.jsxs("span",{className:"s-thread-pinned-ask-agent-name chip chip--sm chip--mono chip--neutral",children:["@",g]}),s.jsx("span",{className:"s-thread-pinned-ask-routing-arrow","aria-hidden":"true",children:"→"}),s.jsx("span",{className:"chip chip--sm chip--mono chip--working",children:"You"})]})]}),s.jsxs("div",{className:"s-thread-pinned-ask-body",children:[s.jsx("p",{className:"s-thread-pinned-ask-text",children:p}),N&&s.jsxs("p",{className:"s-thread-pinned-ask-context text-muted",children:["Re: ",d]})]}),s.jsxs("div",{className:"s-thread-pinned-ask-actions",children:[s.jsxs("button",{type:"button",className:"btn btn--primary s-thread-pinned-ask-btn",onClick:m,title:c?"Approve this gate [Y]":"Answer this question [Y]",children:[s.jsx("kbd",{className:"s-kbd",children:"[Y]"}),c?s.jsx(b,{size:13,strokeWidth:2.2}):s.jsx(y,{size:13}),s.jsx("span",{children:c?"Approve":"Answer"})]}),s.jsxs("button",{type:"button",className:"btn btn--accent s-thread-pinned-ask-btn",onClick:u,title:"Provide guidance or steer [S]",children:[s.jsx("kbd",{className:"s-kbd",children:"[S]"}),s.jsx(C,{size:13,strokeWidth:1.9}),s.jsx("span",{children:"Steer"})]}),t&&s.jsxs("button",{type:"button",className:"btn btn--danger s-thread-pinned-ask-btn",onClick:t,title:"Reject or decline [N]",children:[s.jsx("kbd",{className:"s-kbd",children:"[N]"}),s.jsx(k,{size:13,strokeWidth:2.2}),s.jsx("span",{children:"Reject"})]})]}),s.jsx("div",{className:"s-thread-pinned-ask-strip","aria-hidden":"true"})]})}function q({title:e,description:a,diff:r,command:t,risk:i="medium",onApprove:o,onReject:l,onSteer:d}){return s.jsxs("div",{className:"s-thread-approval-gate surface-card",role:"alert",children:[s.jsxs("div",{className:"s-thread-approval-gate-head",children:[s.jsxs("div",{className:"s-thread-approval-gate-title-wrap",children:[s.jsx(S,{size:16,className:"text-amber","aria-hidden":"true"}),s.jsx("span",{className:"label-sm text-amber",children:"Execution Approval Gate"}),i&&s.jsxs("span",{className:`chip chip--sm chip--mono ${i==="high"?"chip--danger":i==="medium"?"chip--warning":"chip--info"}`,children:[i.toUpperCase()," RISK"]})]}),s.jsx("h3",{className:"s-thread-approval-gate-title",children:e}),a&&s.jsx("p",{className:"s-thread-approval-gate-desc",children:a})]}),t&&s.jsxs("div",{className:"s-thread-approval-gate-command surface-card surface-card--inset",children:[s.jsx("span",{className:"label-xs text-muted",children:"Command"}),s.jsx("code",{className:"s-thread-approval-gate-code",children:t})]}),r&&s.jsxs("div",{className:"s-thread-approval-gate-diff surface-card surface-card--inset",children:[s.jsx("span",{className:"label-xs text-muted",children:"Diff Preview"}),s.jsx("pre",{className:"s-thread-approval-gate-diff-pre",children:s.jsx("code",{children:r})})]}),s.jsxs("div",{className:"s-thread-approval-gate-actions",children:[s.jsxs("button",{type:"button",className:"btn btn--primary",onClick:o,children:[s.jsx("kbd",{className:"s-kbd",children:"[Y]"}),s.jsx(b,{size:13}),s.jsx("span",{children:"Approve Action"})]}),s.jsxs("button",{type:"button",className:"btn btn--danger",onClick:l,children:[s.jsx("kbd",{className:"s-kbd",children:"[N]"}),s.jsx(k,{size:13}),s.jsx("span",{children:"Reject"})]}),d&&s.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:d,children:[s.jsx("kbd",{className:"s-kbd",children:"[S]"}),s.jsx("span",{children:"Steer…"})]})]})]})}function G({presence:e,agent:a}){if(!e.showStrip)return null;const r=e.tone==="working",t=e.tone==="pending";return s.jsxs("div",{className:`s-thread-status s-thread-status--${e.tone}`,"aria-live":"polite",children:[s.jsx("span",{className:"s-thread-status-dot-wrap","aria-hidden":"true",children:s.jsx("span",{className:`dot dot--sm ${r?"dot--working dot--pulse dot--glow":t?"dot--warning dot--pulse dot--glow":"dot--neutral"}`,style:{color:w(e,a?.state??null)}})}),s.jsxs("div",{className:"s-thread-status-copy",children:[s.jsx("span",{className:"s-thread-status-label label-xs",children:e.label}),s.jsx("span",{className:"s-thread-status-detail",children:e.detail})]})]})}export{q as ApprovalGateCard,G as ConversationStatusStrip,W as PinnedAskCard};
@@ -1 +1 @@
1
- import{l as G,n as O,r as d,p as U,o as E,C as q,q as P,t as X,j as r,u as g}from"./index-DvLtl7rV.js";import{H as Y}from"./HarnessMark-B979GCSB.js";const z={idle:{label:"Idle",colour:"var(--hud-dim, #71717a)"},thinking:{label:"Thinking",colour:"var(--info, #6fb7c7)"},working:{label:"Working",colour:"var(--hud-status-ok, #7fb069)"},needs:{label:"Needs attention",colour:"var(--hud-status-warn, #d9a441)"},error:{label:"Error",colour:"var(--hud-status-error, #c74a4a)"},offline:{label:"Offline",colour:"var(--hud-dim, #6e6e72)"}};function D(t){if(!t)return"idle";const e=t.toLowerCase();return e.includes("think")?"thinking":e.includes("work")||e.includes("turn")||e.includes("stream")||e.includes("run")||e.includes("busy")?"working":e.includes("need")||e.includes("wait")||e.includes("block")||e.includes("ask")||e.includes("prompt")?"needs":e.includes("err")||e.includes("fail")||e.includes("crash")?"error":e.includes("off")||e.includes("stop")||e.includes("down")||e.includes("dead")?"offline":"idle"}function J(t){const[e,i]=d.useState(0),s=d.useRef([]);return d.useEffect(()=>{if(t<3||typeof window>"u"||window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;const h=()=>{s.current.push(window.setTimeout(()=>{i(1),s.current.push(window.setTimeout(()=>i(2),40)),s.current.push(window.setTimeout(()=>i(1),90)),s.current.push(window.setTimeout(()=>{i(0),h()},130))},2800+Math.random()*4500))};h();const a=s.current;return()=>{a.forEach(f=>window.clearTimeout(f)),a.length=0}},[t]),t<3?0:e}function V({slug:t,name:e,project:i,harness:s,state:h,size:a,badge:f=!0,ring:C=!0,chip:x=!1,glow:S=!1,className:N,style:j,title:H}){const l=t.toLowerCase(),u=q[l],n=G[l],w=D(h),p=z[w],$=J(n?n.roles.length+1:1),b=n&&$>0?O[$]?.role:void 0,v=d.useMemo(()=>U(i),[i]),k=(x?E[l]?.ink:void 0)??u?.ink??1,M=d.useMemo(()=>P(v,k),[v,k]);if(!u)return null;const c=x?E[l]:void 0,m=a??40,[T,y,o]=X(u,m),A=`${u.w/o*100}%`,R=`${u.h/o*100}%`,F=`${-T/o*100}%`,W=`${-y/o*100}%`,_=e||t.toUpperCase(),I=H??`${_} · ${i||"openscout"} · ${s||"scout"} · ${p.label}`,L=f&&m>=28&&!!(s&&s!=="unknown"),B=a!=null?{width:a,height:a}:{width:"100%",height:"100%"};return r.jsxs("span",{className:`xc-avatar-root ${N||""}`,style:{...B,boxShadow:S?`0 0 ${Math.round(m*.3)}px ${p.colour}`:void 0,...j},title:I,children:[r.jsx("span",{className:"xc-avatar-shell",style:{background:M,opacity:w==="offline"?.55:1},children:c?r.jsx("img",{src:g(`${l}-chip-id.webp`),alt:"",className:"xc-avatar-img xc-avatar-img--pixel",style:{width:`${c.fill*100}%`,height:`${c.fill*100}%`,left:`${(.5-c.fill/2+(c.nudge?.[0]??0))*100}%`,top:`${(.5-c.fill/2+(c.nudge?.[1]??0))*100}%`}}):r.jsxs(r.Fragment,{children:[r.jsx("img",{src:g(`${t.toLowerCase()}-bust.webp`),alt:"",className:"xc-avatar-img",style:{width:A,height:R,left:F,top:W}}),n&&b&&r.jsx("img",{src:g(`${n.dir}/${b}.webp`),alt:"",className:"xc-avatar-patch",style:{width:`${n.patch[2]/o*100}%`,height:`${n.patch[3]/o*100}%`,left:`${(-T+n.patch[0])/o*100}%`,top:`${(-y+n.patch[1])/o*100}%`}})]})}),C&&r.jsx("span",{className:"xc-ring","data-ring":w,style:{"--xc-c":p.colour}}),L&&r.jsx(Y,{harness:s,size:Math.max(8,Math.round(m*.22)),className:"xc-badge-mark",style:{right:"0%",bottom:"0%",width:"32%",height:"32%",minWidth:12,minHeight:12},title:null})]})}export{V as C};
1
+ import{l as G,n as O,r as d,p as U,o as E,C as q,q as P,t as X,j as r,u as g}from"./index-BI9AljSD.js";import{H as Y}from"./HarnessMark-DAaWPiT_.js";const z={idle:{label:"Idle",colour:"var(--hud-dim, #71717a)"},thinking:{label:"Thinking",colour:"var(--info, #6fb7c7)"},working:{label:"Working",colour:"var(--hud-status-ok, #7fb069)"},needs:{label:"Needs attention",colour:"var(--hud-status-warn, #d9a441)"},error:{label:"Error",colour:"var(--hud-status-error, #c74a4a)"},offline:{label:"Offline",colour:"var(--hud-dim, #6e6e72)"}};function D(t){if(!t)return"idle";const e=t.toLowerCase();return e.includes("think")?"thinking":e.includes("work")||e.includes("turn")||e.includes("stream")||e.includes("run")||e.includes("busy")?"working":e.includes("need")||e.includes("wait")||e.includes("block")||e.includes("ask")||e.includes("prompt")?"needs":e.includes("err")||e.includes("fail")||e.includes("crash")?"error":e.includes("off")||e.includes("stop")||e.includes("down")||e.includes("dead")?"offline":"idle"}function J(t){const[e,i]=d.useState(0),s=d.useRef([]);return d.useEffect(()=>{if(t<3||typeof window>"u"||window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;const h=()=>{s.current.push(window.setTimeout(()=>{i(1),s.current.push(window.setTimeout(()=>i(2),40)),s.current.push(window.setTimeout(()=>i(1),90)),s.current.push(window.setTimeout(()=>{i(0),h()},130))},2800+Math.random()*4500))};h();const a=s.current;return()=>{a.forEach(f=>window.clearTimeout(f)),a.length=0}},[t]),t<3?0:e}function V({slug:t,name:e,project:i,harness:s,state:h,size:a,badge:f=!0,ring:C=!0,chip:x=!1,glow:S=!1,className:N,style:j,title:H}){const l=t.toLowerCase(),u=q[l],n=G[l],w=D(h),p=z[w],$=J(n?n.roles.length+1:1),b=n&&$>0?O[$]?.role:void 0,v=d.useMemo(()=>U(i),[i]),k=(x?E[l]?.ink:void 0)??u?.ink??1,M=d.useMemo(()=>P(v,k),[v,k]);if(!u)return null;const c=x?E[l]:void 0,m=a??40,[T,y,o]=X(u,m),A=`${u.w/o*100}%`,R=`${u.h/o*100}%`,F=`${-T/o*100}%`,W=`${-y/o*100}%`,_=e||t.toUpperCase(),I=H??`${_} · ${i||"openscout"} · ${s||"scout"} · ${p.label}`,L=f&&m>=28&&!!(s&&s!=="unknown"),B=a!=null?{width:a,height:a}:{width:"100%",height:"100%"};return r.jsxs("span",{className:`xc-avatar-root ${N||""}`,style:{...B,boxShadow:S?`0 0 ${Math.round(m*.3)}px ${p.colour}`:void 0,...j},title:I,children:[r.jsx("span",{className:"xc-avatar-shell",style:{background:M,opacity:w==="offline"?.55:1},children:c?r.jsx("img",{src:g(`${l}-chip-id.webp`),alt:"",className:"xc-avatar-img xc-avatar-img--pixel",style:{width:`${c.fill*100}%`,height:`${c.fill*100}%`,left:`${(.5-c.fill/2+(c.nudge?.[0]??0))*100}%`,top:`${(.5-c.fill/2+(c.nudge?.[1]??0))*100}%`}}):r.jsxs(r.Fragment,{children:[r.jsx("img",{src:g(`${t.toLowerCase()}-bust.webp`),alt:"",className:"xc-avatar-img",style:{width:A,height:R,left:F,top:W}}),n&&b&&r.jsx("img",{src:g(`${n.dir}/${b}.webp`),alt:"",className:"xc-avatar-patch",style:{width:`${n.patch[2]/o*100}%`,height:`${n.patch[3]/o*100}%`,left:`${(-T+n.patch[0])/o*100}%`,top:`${(-y+n.patch[1])/o*100}%`}})]})}),C&&r.jsx("span",{className:"xc-ring","data-ring":w,style:{"--xc-c":p.colour}}),L&&r.jsx(Y,{harness:s,size:Math.max(8,Math.round(m*.22)),className:"xc-badge-mark",style:{right:"0%",bottom:"0%",width:"32%",height:"32%",minWidth:12,minHeight:12},title:null})]})}export{V as C};
@@ -0,0 +1 @@
1
+ import{j as t,r as w}from"./index-BI9AljSD.js";import{A as E}from"./AgentAvatar-B7c0egdP.js";import{H as Q}from"./HarnessMark-DAaWPiT_.js";import{t as F}from"./time-Dhsh_2EG.js";import{F as D,A as O}from"./AddProjectForm-r_1tVuWk.js";import{i as q,h as U}from"./mesh-roster-Bc7T4b7z.js";import{d as J}from"./Provider-Bu-C8Hxc.js";import{a as K}from"./agent-specialization-BtxLN4UR.js";import{o as G}from"./model-IGCUEsMy.js";import{s as W}from"./project-overview-helpers-BQTc_Ous.js";import{c as M}from"./createLucideIcon-DthwWQIg.js";import{S as V}from"./search-DmFM_9jm.js";import{S as X}from"./sliders-horizontal-BhHKxsCO.js";import{F as x,a as Y}from"./DocumentFocusViewer-DFFE85Tq.js";import{M as Z}from"./message-square-O-Hu9Mk2.js";const ee=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],te=M("rows-3",ee);const se=[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]],ne=M("telescope",se);const re=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],ie=M("users",re);function z(e){return e.needs?3:e.working?2:1}function $(e){return[...e].sort((n,s)=>z(s)-z(n)||s.lastActivityAt-n.lastActivityAt)}function S(e){return[...new Set(e.map(n=>n?.trim().toLowerCase()).filter(n=>!!n))].sort()}function _(e){const n=[...new Set(e.map(s=>s?.trim()).filter(s=>!!s))];return n.length===0?null:n.length===1?n[0]:`${n.length} branches`}function H(e){return e.needs>0?"needs":e.working>0||e.liveSessionCount>0?"working":"idle"}function oe(e){if(e.needs>0)return`${e.needs} ${e.needs===1?"item needs":"items need"} attention`;const n=Math.max(e.working,e.liveSessionCount);return n>0?`${n} active work ${n===1?"stream":"streams"}`:"No active work"}function ae(e,n){const s=$(n.filter(i=>i.projectSlug===e.slug)),r=S(s.map(i=>i.harness)),o={threadId:`project:${e.slug}`,projectSlug:e.slug,projectTitle:e.title,projectRoot:e.root,branch:_(e.branches.length>0?e.branches:s.map(i=>i.branch)),working:e.working>0||e.liveSessionCount>0,needs:e.needs>0,lastActivityAt:e.lastActivityAt,sessionCount:e.sessionCount,work:oe(e),conversationId:null};return{kind:"project",key:`project:${e.slug}`,agentId:null,name:e.title,headline:"Project agent",harnesses:r,model:null,effort:null,status:H(e),needs:o.needs,working:o.working,substrates:[o],primary:o,work:o.work,conversationId:null,lastActivityAt:e.lastActivityAt,sessionCount:e.sessionCount}}function ce(e){const n=$(e),s=n[0];return{threadId:s.id,projectSlug:s.projectSlug,projectTitle:s.projectTitle,projectRoot:s.projectRoot,branch:_(n.map(r=>r.branch)),working:n.some(r=>r.working),needs:n.some(r=>r.needs),lastActivityAt:Math.max(...n.map(r=>r.lastActivityAt)),sessionCount:n.reduce((r,o)=>r+o.sessionCount,0),work:s.work,conversationId:s.conversationId}}function le(e){const n=new Map;for(const s of e){const r=n.get(s.projectSlug)??[];r.push(s),n.set(s.projectSlug,r)}return[...n.values()].map(ce).sort((s,r)=>Number(r.needs)-Number(s.needs)||Number(r.working)-Number(s.working)||r.lastActivityAt-s.lastActivityAt)}function de(e,n){return n.some(s=>s.needs)?"needs":e.some(s=>(s.state??"").toLowerCase().includes("think"))?"thinking":n.some(s=>s.working)||e.some(s=>/work|running|in_turn/iu.test(s.state??""))?"working":"idle"}function b(e){const n=e?.trim().replace(/\/+$/u,"");return n?n.replace(/^\/(?:Users|home)\/[^/]+(?=\/)/u,"~"):null}function ue(e,n){return[n.root,...n.worktrees.map(r=>r.root)].map(b).filter(r=>!!r).some(r=>e===r||e.startsWith(`${r}/`))}function he(e,n,s){const r=new Set;for(const i of s)i.agentId===e.id&&r.add(i.projectSlug);const o=[e.projectRoot,e.cwd].map(b).filter(i=>!!i);for(const i of n){const a=[i.slug,i.title].map(l=>l.trim().toLowerCase());e.project&&a.includes(e.project.trim().toLowerCase())&&r.add(i.slug),e.workspaceQualifier&&a.includes(e.workspaceQualifier.trim().toLowerCase())&&r.add(i.slug),o.some(l=>ue(l,i))&&r.add(i.slug)}if(r.size===0){const i=b(e.projectRoot??e.cwd);i?r.add(`root:${i}`):e.project?.trim()?r.add(`project:${e.project.trim().toLowerCase()}`):e.workspaceQualifier?.trim()&&r.add(`workspace:${e.workspaceQualifier.trim().toLowerCase()}`)}return r}function pe(e,n,s){const r=new Set;for(const o of e)for(const i of he(o,n,s))r.add(i);return r.size>1?!0:e.some(o=>!U(o)&&!o.workspaceQualifier?.trim()&&!o.cwd?.trim())}function je(e,n,s){const r=e.filter(q),o=new Map;for(const i of r){const a=i.definitionId.trim()||i.id,l=o.get(a)??[];l.push(i),o.set(a,l)}return[...o.entries()].flatMap(([i,a])=>{if(!pe(a,n,s))return[];const h=[...a].sort((d,k)=>(k.updatedAt??0)-(d.updatedAt??0))[0],u=new Set(a.map(d=>d.id)),v=s.filter(d=>d.agentId&&u.has(d.agentId)),j=le(v),f=j[0]??null,p=S([...a.map(d=>d.harness),...v.map(d=>d.harness)]),y=S(a.map(d=>d.model)),A=S(a.map(d=>d.reasoningEffort)),m=de(a,j),C=Math.max(0,...a.map(d=>d.updatedAt??0),...j.map(d=>d.lastActivityAt)),g=K(h);return[{kind:"role",key:`role:${i}`,agentId:h.id,name:h.name,headline:g.headline,harnesses:p,model:y.length===1?y[0]:null,effort:A.length===1?A[0]:null,status:m,needs:m==="needs",working:m==="working"||m==="thinking",substrates:j,primary:f,work:f?.work??g.headline,conversationId:f?.conversationId??h.conversationId,lastActivityAt:C,sessionCount:j.reduce((d,k)=>d+k.sessionCount,0)}]})}function R(e){switch(e.status){case"needs":return 3;case"working":return 2;case"thinking":return 1;case"idle":return 0}}function B(e,n,s,r=null){const o=J(s,r);return[...e.map(a=>ae(a,n)),...je(o,e,n)].sort((a,l)=>R(l)-R(a)||l.lastActivityAt-a.lastActivityAt||a.name.localeCompare(l.name))}function we(e,n){switch(n){case"all":return!0;case"active":return e.status==="working"||e.status==="thinking";case"needs":return e.status==="needs";case"idle":return e.status==="idle"}}function me(e,n){const s=H(e);switch(n){case"all":return!0;case"active":return s==="working";case"needs":return s==="needs";case"idle":return s==="idle"}}function fe(e,n){const s=n.trim().toLowerCase();return!s||e.name.toLowerCase().includes(s)||e.headline.toLowerCase().includes(s)||e.work.toLowerCase().includes(s)?!0:e.substrates.some(r=>r.projectTitle.toLowerCase().includes(s)||r.projectSlug.toLowerCase().includes(s)||(r.projectRoot?.toLowerCase().includes(s)??!1))}function ge(e,n){const s=n.trim().toLowerCase();return s?e.title.toLowerCase().includes(s)||e.slug.toLowerCase().includes(s)||(e.root?.toLowerCase().includes(s)??!1):!0}function ke(e){switch(e){case"needs":return"Needs attention";case"working":return"Working";case"thinking":return"Thinking";case"idle":return"Idle"}}const xe=[{id:"all",label:"All"},{id:"active",label:"Active"},{id:"needs",label:"Needs attention"},{id:"idle",label:"Idle"}];function ve(e,n){if(n){e({view:"conversation",conversationId:n});return}e({view:"messages"})}function L(e,n){e({view:"code",project:n})}function ye(e,n,s){e(G(n,s))}function P(e,n,s){e({view:"agents-v2",projectSlug:s,...n.machineId?{machineId:n.machineId}:{},...n.showEphemeral?{showEphemeral:!0}:{}})}function Ae({model:e,agents:n,route:s,navigate:r,nowMs:o}){const[i,a]=w.useState("projects"),[l,h]=w.useState("all"),[u,v]=w.useState(""),[j,f]=w.useState(!1),p=w.useMemo(()=>B(e.projects,e.threads,n,s.machineId??null),[n,e.projects,e.threads,s.machineId]),y=w.useMemo(()=>p.filter(c=>we(c,l)&&fe(c,u)),[p,u,l]),A=w.useMemo(()=>e.projects.filter(c=>me(c,l)&&ge(c,u)),[e.projects,u,l]),m=e.projects.filter(c=>c.working>0||c.liveSessionCount>0).length,C=e.projects.filter(c=>c.needs>0).length,g=p.filter(c=>c.status==="working"||c.status==="thinking").length,d=p.filter(c=>c.status==="needs").length,k=p.filter(c=>c.kind==="project").length,N=p.filter(c=>c.kind==="role").length;return t.jsxs("main",{className:"cw-root","aria-label":"Projects and agents",children:[t.jsxs("div",{className:"cw-toolbar",children:[t.jsxs("div",{className:"cw-modeToggle",role:"group","aria-label":"Directory view",children:[t.jsxs("button",{type:"button","data-active":i==="projects"||void 0,"aria-pressed":i==="projects",onClick:()=>a("projects"),title:"Browse tracked projects",children:[t.jsx(te,{size:13,strokeWidth:1.9,"aria-hidden":!0}),"Projects"]}),t.jsxs("button",{type:"button","data-active":i==="agents"||void 0,"aria-pressed":i==="agents",onClick:()=>a("agents"),title:"Browse durable agent identities",children:[t.jsx(ie,{size:13,strokeWidth:1.9,"aria-hidden":!0}),"Agents"]})]}),t.jsxs("label",{className:"cw-search",role:"search",children:[t.jsx(V,{size:13,strokeWidth:1.8,"aria-hidden":!0}),t.jsx("input",{type:"search",value:u,placeholder:i==="projects"?"Find project":"Find agent or project","aria-label":i==="projects"?"Find project":"Find agent or project",onChange:c=>v(c.currentTarget.value)})]}),t.jsxs("div",{className:"cw-filters","aria-label":"Status filter",children:[t.jsx(X,{size:12,strokeWidth:1.9,"aria-hidden":!0,className:"cw-filtersIcon"}),xe.map(c=>t.jsx("button",{type:"button","data-active":l===c.id||void 0,"aria-pressed":l===c.id,onClick:()=>h(c.id),children:c.label},c.id))]}),t.jsxs("button",{type:"button",className:"cw-addProject","aria-expanded":j,onClick:()=>f(c=>!c),children:[t.jsx(D,{size:13,strokeWidth:1.9,"aria-hidden":!0}),"Add project"]})]}),j?t.jsx(O,{onClose:()=>f(!1)}):null,t.jsx("div",{className:"cw-digest",children:i==="projects"?t.jsxs(t.Fragment,{children:[t.jsxs("span",{children:[e.projects.length," projects"]}),t.jsx("span",{className:"cw-digestSep",children:"·"}),t.jsxs("span",{"data-tone":m>0?"live":void 0,children:[m," active"]}),C>0?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"cw-digestSep",children:"·"}),t.jsxs("span",{"data-tone":"needs",children:[C," need you"]})]}):null]}):t.jsxs(t.Fragment,{children:[t.jsxs("span",{children:[k," project agents"]}),N>0?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"cw-digestSep",children:"·"}),t.jsxs("span",{children:[N," role ",N===1?"agent":"agents"]})]}):null,t.jsx("span",{className:"cw-digestSep",children:"·"}),t.jsxs("span",{"data-tone":g>0?"live":void 0,children:[g," active"]}),d>0?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"cw-digestSep",children:"·"}),t.jsxs("span",{"data-tone":"needs",children:[d," need you"]})]}):null]})}),i==="projects"?t.jsx(Se,{projects:A,route:s,navigate:r,nowMs:o,allEmpty:e.projects.length===0}):t.jsx(be,{members:y,route:s,navigate:r,nowMs:o,allEmpty:p.length===0})]})}function Ce({project:e,threads:n,route:s,navigate:r,nowMs:o}){const i=B([e],n,[])[0];return t.jsx("main",{className:"cw-root cw-root--scoped","aria-label":`${e.title} agent`,children:t.jsx(I,{title:"Project agent",members:[i],route:s,navigate:r,nowMs:o})})}const T=5;function Se({projects:e,route:n,navigate:s,nowMs:r,allEmpty:o}){const[i,a]=w.useState(!1);if(e.length===0)return t.jsx("div",{className:"cw-empty",children:o?"No projects are tracked yet.":"No projects match these filters."});const l=i?e:e.slice(0,T),h=Math.max(0,e.length-T);return t.jsxs("div",{className:"cw-workspaceList",children:[l.map(u=>t.jsx(Ne,{project:u,route:n,navigate:s,nowMs:r},u.slug)),h>0?t.jsx("button",{type:"button",className:"cw-showMore",onClick:()=>a(u=>!u),children:i?"Show fewer projects":`Show ${h} more`}):null]})}function Ne({project:e,route:n,navigate:s,nowMs:r}){const o=e.working>0||e.liveSessionCount>0;return t.jsx("article",{className:"cw-workspace","data-state":e.needs>0?"needs":o?"live":void 0,children:t.jsxs("button",{type:"button",className:"cw-workspaceHead",onClick:()=>P(s,n,e.slug),children:[t.jsxs("span",{className:"cw-workspaceTitle",children:[t.jsx(x,{size:13,strokeWidth:1.7,"aria-hidden":!0}),"/",e.title]}),t.jsx("span",{className:"cw-workspaceRoot",title:e.root??void 0,children:e.root?W(e.root):"Discovered project"}),t.jsxs("span",{className:"cw-workspaceMeta",children:[e.needs>0?t.jsx("b",{"data-tone":"needs",children:"Needs you"}):null,o?t.jsx("b",{"data-tone":"live",children:"Active"}):null,t.jsxs("span",{children:[e.worktreeCount," ",e.worktreeCount===1?"worktree":"worktrees"]}),t.jsxs("span",{children:[e.sessionCount," ",e.sessionCount===1?"session":"sessions"]}),t.jsx("time",{children:e.lastActivityAt?F(e.lastActivityAt,r):"no activity"})]})]})})}function be({members:e,route:n,navigate:s,nowMs:r,allEmpty:o}){if(e.length===0)return t.jsx("div",{className:"cw-empty",children:o?"No durable agents are registered yet.":"No agents match these filters."});const i=e.filter(l=>l.kind==="role"),a=e.filter(l=>l.kind==="project");return t.jsxs("div",{className:"cw-agentDirectory",children:[i.length>0?t.jsx(I,{title:"Role agents",members:i,route:n,navigate:s,nowMs:r}):null,a.length>0?t.jsx(I,{title:"Project agents",members:a,route:n,navigate:s,nowMs:r}):null]})}function I({title:e,members:n,route:s,navigate:r,nowMs:o}){return t.jsxs("section",{className:"cw-agentSection","aria-label":e,children:[t.jsxs("div",{className:"cw-agentSectionHead",children:[t.jsx("h2",{children:e}),t.jsx("span",{children:n.length})]}),t.jsx("div",{className:"cw-grid",children:n.map(i=>t.jsx(Ie,{member:i,route:s,navigate:r,nowMs:o},i.key))})]})}function Ie({member:e,route:n,navigate:s,nowMs:r}){const o=e.primary;return t.jsxs("article",{className:"cw-card","data-status":e.status,"data-kind":e.kind,children:[t.jsxs("header",{className:"cw-cardHead",children:[t.jsx(E,{agent:{name:e.name,state:Me(e.status)},placement:"hero",size:46,presence:!0}),t.jsxs("div",{className:"cw-cardIdentity",children:[t.jsxs("div",{className:"cw-cardNameRow",children:[e.harnesses.length>0?t.jsx("span",{className:"cw-cardHarness","data-idle":e.status==="idle"||void 0,"aria-hidden":!0,children:e.harnesses.map(i=>t.jsx(Q,{harness:i,size:13},i))}):null,t.jsx("b",{title:e.name,children:e.name}),t.jsx("span",{className:"cw-statusPill","data-status":e.status,children:ke(e.status)})]}),t.jsx("div",{className:"cw-cardSubline",children:t.jsx("span",{className:"cw-headline",children:e.headline})})]})]}),e.kind==="project"&&o?t.jsxs("div",{className:"cw-projectContext",title:o.projectRoot??void 0,children:[t.jsx(x,{size:11,strokeWidth:1.8,"aria-hidden":!0}),t.jsx("span",{children:o.projectRoot?W(o.projectRoot):`/${o.projectTitle}`}),t.jsxs("em",{children:[e.sessionCount," ",e.sessionCount===1?"session":"sessions"]})]}):e.substrates.length>0?t.jsx("div",{className:"cw-substrates",children:e.substrates.map((i,a)=>t.jsx(Pe,{substrate:i,route:n,navigate:s,primary:a===0},i.threadId))}):null,t.jsxs("div",{className:"cw-work",children:[t.jsx("p",{title:e.work,children:e.work}),t.jsx("time",{children:e.lastActivityAt?F(e.lastActivityAt,r):"—"})]}),t.jsx("footer",{className:"cw-cardActions",children:e.kind==="project"&&o?t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",onClick:()=>P(s,n,o.projectSlug),children:[t.jsx(Y,{size:12,strokeWidth:1.9,"aria-hidden":!0}),"Open project"]}),t.jsxs("button",{type:"button",onClick:()=>L(s,o.projectSlug),children:[t.jsx(x,{size:12,strokeWidth:1.9,"aria-hidden":!0}),"Browse code"]})]}):t.jsxs(t.Fragment,{children:[e.conversationId?t.jsxs("button",{type:"button",onClick:()=>ve(s,e.conversationId),children:[t.jsx(Z,{size:12,strokeWidth:1.9,"aria-hidden":!0}),"Chat"]}):null,o?t.jsxs("button",{type:"button",onClick:()=>L(s,o.projectSlug),children:[t.jsx(x,{size:12,strokeWidth:1.9,"aria-hidden":!0}),"Browse code"]}):null,e.agentId?t.jsxs("button",{type:"button",onClick:()=>ye(s,n,e.agentId),children:[t.jsx(ne,{size:12,strokeWidth:1.9,"aria-hidden":!0}),"Inspect"]}):null]})})]})}function Me(e){switch(e){case"needs":return"needs_attention";case"working":return"in_turn";case"thinking":return"thinking";case"idle":return"idle"}}function Pe({substrate:e,route:n,navigate:s,primary:r=!1}){return t.jsxs("button",{type:"button",className:"cw-substrateChip","data-primary":r||void 0,"data-live":e.working||void 0,title:e.projectRoot??void 0,onClick:()=>P(s,n,e.projectSlug),children:[t.jsx(x,{size:11,strokeWidth:1.8,"aria-hidden":!0}),t.jsx("span",{children:e.projectTitle}),e.branch?t.jsxs("em",{children:["git: ",e.branch]}):null]})}const Ue=Object.freeze(Object.defineProperty({__proto__:null,CrewWorkspaces:Ae,ProjectAgentDirectory:Ce},Symbol.toStringTag,{value:"Module"}));export{Ae as C,Ce as P,ie as U,Ue as a};
@@ -0,0 +1 @@
1
+ .cw-root{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:var(--space-lg);padding:var(--space-xl) var(--space-2xl) var(--space-6xl)}.cw-root--scoped{padding-top:var(--space-lg)}.cw-toolbar{flex:none;display:flex;align-items:center;flex-wrap:wrap;gap:var(--space-sm)}.cw-modeToggle{display:flex;align-items:center;gap:2px;padding:2px;border:1px solid var(--pi-hairline);border-radius:9px;background:color-mix(in srgb,var(--hud-surface) 40%,transparent)}.cw-modeToggle button{display:flex;align-items:center;gap:6px;height:26px;padding:0 10px;border:none;border-radius:7px;background:transparent;color:var(--pi-dim);font-size:var(--text-xs);font-weight:600;cursor:pointer;transition:background .15s var(--pi-ease),color .15s var(--pi-ease)}.cw-modeToggle button:hover{color:var(--pi-muted)}.cw-modeToggle button[data-active]{background:color-mix(in srgb,var(--hud-ink) 10%,transparent);color:var(--pi-ink);box-shadow:inset 0 0 0 1px var(--pi-hairline-strong)}.cw-search{flex:1 1 220px;min-width:180px;max-width:420px;display:flex;align-items:center;gap:7px;height:30px;padding:0 10px;border:1px solid var(--pi-hairline);border-radius:8px;background:color-mix(in srgb,var(--hud-surface) 34%,transparent);color:var(--pi-dim)}.cw-search input{flex:1;min-width:0;border:none;background:transparent;color:var(--pi-ink);font-size:var(--text-sm);font-family:var(--pi-sans)}.cw-search input:focus{outline:none}.cw-search input::placeholder{color:var(--pi-dim)}.cw-filters{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.cw-filtersIcon{color:var(--pi-dim);margin-right:2px}.cw-filters button{height:26px;padding:0 10px;border:1px solid var(--pi-hairline);border-radius:999px;background:color-mix(in srgb,var(--hud-surface) 30%,transparent);color:var(--pi-dim);font-size:var(--text-2xs);font-weight:600;letter-spacing:.01em;cursor:pointer;transition:background .15s var(--pi-ease),color .15s var(--pi-ease),border-color .15s var(--pi-ease)}.cw-filters button:hover{color:var(--pi-muted);border-color:var(--pi-hairline-strong)}.cw-filters button[data-active]{background:color-mix(in srgb,var(--pi-accent) 16%,transparent);border-color:color-mix(in srgb,var(--pi-accent) 40%,var(--pi-hairline));color:var(--pi-ink)}.cw-addProject{margin-left:auto;display:flex;align-items:center;gap:6px;height:30px;padding:0 12px;border:1px solid var(--pi-hairline);border-radius:8px;background:color-mix(in srgb,var(--hud-surface) 34%,transparent);color:var(--pi-muted);font-size:var(--text-xs);font-weight:600;cursor:pointer;transition:background .15s var(--pi-ease),color .15s var(--pi-ease)}.cw-addProject:hover{color:var(--pi-ink);border-color:var(--pi-hairline-strong)}.cw-digest{flex:none;display:flex;align-items:center;gap:6px;color:var(--pi-dim);font-size:var(--text-xs);font-family:var(--pi-mono)}.cw-digest span[data-tone=live]{color:color-mix(in srgb,var(--pi-accent) 78%,var(--pi-ink))}.cw-digest span[data-tone=needs]{color:color-mix(in srgb,#d9a441 82%,var(--pi-ink));font-weight:650}.cw-digestSep{opacity:.5}.cw-empty{padding:48px 12px;text-align:center;color:var(--pi-dim);font-size:var(--text-sm)}.cw-agentDirectory,.cw-agentSection{display:flex;flex-direction:column;gap:var(--space-lg)}.cw-agentSectionHead{display:flex;align-items:baseline;gap:8px;padding-bottom:var(--space-xs);border-bottom:1px solid var(--pi-hairline)}.cw-agentSectionHead h2{margin:0;color:var(--pi-ink);font-size:var(--text-sm);font-weight:650}.cw-agentSectionHead span{color:var(--pi-dim);font-family:var(--pi-mono);font-size:var(--text-2xs)}.cw-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:var(--space-lg)}.cw-card{display:flex;flex-direction:column;gap:var(--space-md);padding:var(--space-lg);border:1px solid var(--pi-hairline);border-radius:12px;background:linear-gradient(180deg,color-mix(in srgb,white 2.5%,transparent),transparent 40%),color-mix(in srgb,var(--hud-surface) 30%,transparent);transition:border-color .16s var(--pi-ease),transform .16s var(--pi-ease),background .16s var(--pi-ease)}.cw-card:hover{border-color:var(--pi-hairline-strong);transform:translateY(-1px)}.cw-card[data-status=needs]{border-color:color-mix(in srgb,#d9a441 45%,var(--pi-hairline))}.cw-card[data-status=working]{border-color:color-mix(in srgb,var(--pi-accent) 32%,var(--pi-hairline))}.cw-cardHead{display:flex;align-items:flex-start;gap:var(--space-md)}.cw-cardIdentity{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}.cw-cardNameRow{display:flex;align-items:center;gap:8px;min-width:0}.cw-cardHarness{flex:none;display:inline-flex;align-items:center;gap:4px;color:var(--pi-ink)}.cw-cardHarness[data-idle]{color:var(--pi-dim)}.cw-cardNameRow b{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--pi-ink);font-size:var(--text-md);font-weight:650}.cw-statusPill{flex:none;padding:2px 8px;border-radius:999px;font-size:var(--text-2xs);font-weight:650;letter-spacing:.01em;color:var(--pi-dim);background:color-mix(in srgb,var(--hud-ink) 8%,transparent);box-shadow:inset 0 0 0 1px var(--pi-hairline)}.cw-statusPill[data-status=needs]{color:color-mix(in srgb,#d9a441 88%,var(--pi-ink));background:color-mix(in srgb,#d9a441 14%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,#d9a441 40%,transparent)}.cw-statusPill[data-status=working]{color:color-mix(in srgb,var(--pi-accent) 84%,var(--pi-ink));background:color-mix(in srgb,var(--pi-accent) 12%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--pi-accent) 32%,transparent)}.cw-statusPill[data-status=thinking]{color:color-mix(in srgb,#6fb7c7 86%,var(--pi-ink));background:color-mix(in srgb,#6fb7c7 12%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,#6fb7c7 32%,transparent)}.cw-cardSubline{display:flex;align-items:center;gap:6px;min-width:0;color:var(--pi-muted);font-size:var(--text-xs)}.cw-headline{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cw-substrates{display:flex;flex-wrap:wrap;gap:6px}.cw-substrateChip{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;border:1px solid var(--pi-hairline);border-radius:999px;background:color-mix(in srgb,var(--hud-surface) 26%,transparent);color:var(--pi-muted);font-size:var(--text-2xs);cursor:pointer;transition:border-color .15s var(--pi-ease),color .15s var(--pi-ease)}.cw-substrateChip:hover{border-color:var(--pi-hairline-strong);color:var(--pi-ink)}.cw-substrateChip[data-primary]{color:var(--pi-ink);background:color-mix(in srgb,var(--hud-ink) 6%,transparent)}.cw-substrateChip[data-live]{border-color:color-mix(in srgb,var(--pi-accent) 34%,var(--pi-hairline))}.cw-substrateChip em{font-style:normal;color:var(--pi-dim);font-family:var(--pi-mono)}.cw-work{display:flex;align-items:baseline;justify-content:space-between;gap:var(--space-md);padding-top:var(--space-2xs);border-top:1px solid var(--pi-hairline)}.cw-work p{flex:1;min-width:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--pi-ink);font-size:var(--text-sm)}.cw-work time{flex:none;color:var(--pi-dim);font-size:var(--text-2xs);font-family:var(--pi-mono)}.cw-cardActions{display:flex;gap:6px}.cw-cardActions:empty{display:none}.cw-cardActions button{flex:1;display:flex;align-items:center;justify-content:center;gap:5px;height:26px;border:1px solid var(--pi-hairline);border-radius:7px;background:transparent;color:var(--pi-muted);font-size:var(--text-2xs);font-weight:600;cursor:pointer;transition:background .15s var(--pi-ease),color .15s var(--pi-ease),border-color .15s var(--pi-ease)}.cw-cardActions button:hover{color:var(--pi-ink);border-color:var(--pi-hairline-strong);background:color-mix(in srgb,var(--hud-ink) 5%,transparent)}.cw-projectContext{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:6px;padding:5px 8px;border:1px solid var(--pi-hairline);border-radius:7px;background:color-mix(in srgb,var(--hud-surface) 28%,transparent);color:var(--pi-muted);font-size:var(--text-2xs)}.cw-projectContext span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--pi-mono)}.cw-projectContext em{font-style:normal;color:var(--pi-dim)}.cw-workspaceList{display:flex;flex-direction:column;gap:5px}.cw-workspace{border:1px solid var(--pi-hairline);border-radius:8px;background:color-mix(in srgb,var(--hud-surface) 18%,transparent);overflow:hidden}.cw-workspace[data-state=needs]{border-color:color-mix(in srgb,#d9a441 40%,var(--pi-hairline))}.cw-workspace[data-state=live]{border-color:color-mix(in srgb,var(--pi-accent) 28%,var(--pi-hairline))}.cw-workspaceHead{width:100%;display:flex;align-items:center;gap:var(--space-md);min-height:44px;padding:8px 12px;border:none;background:transparent;color:inherit;text-align:left;cursor:pointer;transition:background .15s var(--pi-ease)}.cw-workspaceHead:hover{background:color-mix(in srgb,var(--hud-ink) 4%,transparent)}.cw-workspaceTitle{flex:none;display:flex;align-items:center;gap:6px;color:var(--pi-ink);font-size:var(--text-sm);font-weight:650}.cw-workspaceRoot{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--pi-dim);font-family:var(--pi-mono);font-size:var(--text-xs)}.cw-workspaceMeta{flex:none;display:flex;align-items:center;gap:10px;color:var(--pi-dim);font-size:var(--text-xs)}.cw-workspaceMeta b{font-weight:650;color:var(--pi-muted)}.cw-workspaceMeta b[data-tone=needs]{color:color-mix(in srgb,#d9a441 85%,var(--pi-ink))}.cw-workspaceMeta b[data-tone=live]{color:color-mix(in srgb,var(--pi-accent) 82%,var(--pi-ink))}.cw-workspaceMeta time{font-family:var(--pi-mono)}.cw-showMore{align-self:flex-start;height:28px;padding:0 10px;border:none;background:transparent;color:var(--pi-dim);font-size:var(--text-xs);font-weight:600;cursor:pointer}.cw-showMore:hover{color:var(--pi-ink)}.cw-modeToggle button:focus-visible,.cw-filters button:focus-visible,.cw-addProject:focus-visible,.cw-showMore:focus-visible,.cw-workspaceHead:focus-visible,.cw-substrateChip:focus-visible,.cw-cardActions button:focus-visible{outline:2px solid color-mix(in srgb,var(--pi-accent) 70%,white);outline-offset:2px}@media(max-width:600px){.cw-toolbar{flex-direction:column;align-items:stretch}.cw-search{flex:none;width:100%;min-width:0;max-width:none}.cw-addProject{margin-left:0}.cw-grid{grid-template-columns:1fr}.cw-workspaceHead{flex-wrap:wrap}.cw-workspaceRoot{flex:1 1 100%;order:3}.cw-workspaceMeta{flex-wrap:wrap}}
@@ -1 +1 @@
1
- import{r as m,j as o}from"./index-DvLtl7rV.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-BI9AljSD.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 m,j as r}from"./index-DvLtl7rV.js";import{a as y}from"./api-Co9aQ2Jw.js";import{i as j}from"./scoutbot-BJIamJOH.js";import{u as S}from"./sse-CD9MMUxl.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-Q75fupqG.js";import{r as R}from"./follow-route-BvcGtBIL.js";import{L as C}from"./loader-circle-pM56HNhR.js";import{A as L}from"./arrow-up-right-C6Wl-1uw.js";import"./perf-PX8Rx0EP.js";import"./index-BWHgHrtv.js";import"./status-tone-BM_zuRy1.js";import"./createLucideIcon-DezKXSG2.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]=m.useState(W),[l,u]=m.useState(0),d=m.useRef(0),o=e.conversationId,i=m.useMemo(()=>D(e,s)?.toString()??null,[e,s]);m.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=m.useRef(null),f=m.useCallback(()=>{c.current||(c.current=setTimeout(()=>{c.current=null,u(a=>a+1)},Q))},[]);m.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&&f();return;case"delivery.state.changed":e.messageId&&a.payload.delivery.messageId===e.messageId&&f();return;case"flight.updated":I&&a.payload.flight.id===I&&f();return}}),{...t,reload:f}}function le({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),f=u?H(u,{nativeHost:j()}):[],I=m.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."}),f.length>0?r.jsx("div",{className:"sys-broker-aftermath-links",children:f.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{le as DispatchAftermath};
1
+ import{r as m,j as r}from"./index-BI9AljSD.js";import{a as y}from"./api-Co9aQ2Jw.js";import{i as j}from"./scoutbot-BJIamJOH.js";import{u as S}from"./sse-DDHEHUgz.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-Q75fupqG.js";import{r as R}from"./follow-route-BvcGtBIL.js";import{L as C}from"./loader-circle-B2W9DPG5.js";import{A as L}from"./arrow-up-right-CY0Vw_67.js";import"./perf-PX8Rx0EP.js";import"./index-BWHgHrtv.js";import"./status-tone-BM_zuRy1.js";import"./createLucideIcon-DthwWQIg.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]=m.useState(W),[l,u]=m.useState(0),d=m.useRef(0),o=e.conversationId,i=m.useMemo(()=>D(e,s)?.toString()??null,[e,s]);m.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=m.useRef(null),f=m.useCallback(()=>{c.current||(c.current=setTimeout(()=>{c.current=null,u(a=>a+1)},Q))},[]);m.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&&f();return;case"delivery.state.changed":e.messageId&&a.payload.delivery.messageId===e.messageId&&f();return;case"flight.updated":I&&a.payload.flight.id===I&&f();return}}),{...t,reload:f}}function le({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),f=u?H(u,{nativeHost:j()}):[],I=m.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."}),f.length>0?r.jsx("div",{className:"sys-broker-aftermath-links",children:f.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{le as DispatchAftermath};
@@ -1 +1 @@
1
- import{c as u}from"./createLucideIcon-DezKXSG2.js";import{r,j as e}from"./index-DvLtl7rV.js";import{T as H}from"./TextDocumentSurface-BflAwXeZ.js";import{F as A}from"./file-text-CqJgwxmv.js";import{X as R}from"./x-CAbNespN.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"}]],Z=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"}]],G=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 J({open:a=!0,focusable:M=!0,kind:F,document:t,title:z,eyebrow:v,subtitle:w,meta:x=[],mode:$,actions:L=[],state:j,error:c,notice:p,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})})]})]}),j&&!c&&!t&&!d&&e.jsx("div",{className:"s-doc-focus-viewer-state",children:j}),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&&p&&e.jsx("div",{className:"s-doc-focus-viewer-notice",children:p})]})]})}export{J as D,G as F,T as M,Z as a,C as b};
1
+ import{c as u}from"./createLucideIcon-DthwWQIg.js";import{r,j as e}from"./index-BI9AljSD.js";import{T as H}from"./TextDocumentSurface-BeSwe3Yl.js";import{F as A}from"./file-text--hfhwZH1.js";import{X as R}from"./x-DfRJbqrh.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"}]],Z=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"}]],G=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 J({open:a=!0,focusable:M=!0,kind:F,document:t,title:z,eyebrow:v,subtitle:w,meta:x=[],mode:$,actions:L=[],state:j,error:c,notice:p,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})})]})]}),j&&!c&&!t&&!d&&e.jsx("div",{className:"s-doc-focus-viewer-state",children:j}),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&&p&&e.jsx("div",{className:"s-doc-focus-viewer-notice",children:p})]})]})}export{J as D,G as F,T as M,Z as a,C as b};
@@ -1 +1 @@
1
- import{r as l,j as e}from"./index-DvLtl7rV.js";import{l as c}from"./discover-C2CZO4Tk.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-BI9AljSD.js";import{l as c}from"./discover-B3uQlh5L.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-DvLtl7rV.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-BI9AljSD.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-DvLtl7rV.js";import{T as b,c as j}from"./TextDocumentSurface-BflAwXeZ.js";import{a as N}from"./api-Co9aQ2Jw.js";import"./perf-PX8Rx0EP.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-BI9AljSD.js";import{T as b,c as j}from"./TextDocumentSurface-BeSwe3Yl.js";import{a as N}from"./api-Co9aQ2Jw.js";import"./perf-PX8Rx0EP.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 f({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{f as FileViewerPane};
@@ -1 +1 @@
1
- import{r as c,j as s}from"./index-DvLtl7rV.js";import{a as k}from"./api-Co9aQ2Jw.js";import{u as R}from"./sse-CD9MMUxl.js";import{d as $,t as F}from"./time-Dhsh_2EG.js";import{SessionRefScreen as j}from"./SessionRefScreen-COVQMbtE.js";/* empty css */import{c as E}from"./createLucideIcon-DezKXSG2.js";import{X as A}from"./x-CAbNespN.js";import"./perf-PX8Rx0EP.js";import"./index-BWHgHrtv.js";import"./tail-events-Ps8KpKah.js";import"./BackToPicker-CXZjBRAe.js";import"./router-B9vQkNJL.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-BQ6t92tJ.js";import"./ConversationScreen-CR9pWB65.js";import"./NewChatComposer-_Stj0fZy.js";import"./text-BP3oyl8-.js";import"./scout-voice-BVUqGhth.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-pM56HNhR.js";import"./conversation-model-Dc02NsGp.js";import"./colors-BtO5_zlx.js";import"./index-zvhpRHao.js";import"./HarnessMark-B979GCSB.js";import"./NewChatOrigin-B1u7ki70.js";import"./keyboard-nav-BLYDhL3Z.js";import"./chevron-down-wciXnOQz.js";import"./search-CDko0PKE.js";import"./file-text-CqJgwxmv.js";import"./ConversationComposer-CXPKx86g.js";import"./AgentAvatar-6-KBVKUu.js";import"./Provider-CtXJeLrP.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BJIamJOH.js";import"./DocumentFocusViewer-Do3wQ_3Z.js";import"./TextDocumentSurface-BflAwXeZ.js";import"./chevron-right-D-HdlPg8.js";import"./code-xml-D7pOQM9l.js";import"./arrow-left-Czpf-AE4.js";import"./arrow-right-BuzMnLYP.js";import"./chunk-HRAB3GC3-Tyv9rzx7.js";import"./SpriteAvatar-z5hHesx9.js";import"./CrewAvatar-BwXjyg8N.js";import"./zap-Cq8eWkcF.js";import"./message-markup-C2LQDm_k.js";import"./mentions-DG6OQrsc.js";import"./AgentDetailCard-C9rn3Fj5.js";import"./AgentLiveActions-DrEJDJef.js";import"./terminal-takeover-_Jyys4me.js";import"./openContent-C6XO6kr5.js";import"./eye-BRyD0jno.js";import"./terminal-9GRS_Qdc.js";import"./message-visibility-CGOmSSKs.js";import"./operator-attention-RqieiSY8.js";import"./sessionRead-CvFz2RHv.js";import"./clipboard-e3fSpeo7.js";import"./types-B0PlfpKc.js";/* empty css */import"./ConversationHeader-BQWzGzLK.js";import"./AstronautSuit-DbjQtfD_.js";import"./ConversationFeedRows-WrH-YI3L.js";import"./ConversationPanels-Dujvnmup.js";import"./tail-display-DcliDVkW.js";import"./lane-edit-display-C_Aujldz.js";import"./use-reduced-motion-x8pJMVrG.js";import"./proxy-BiW5suC7.js";import"./activity-DcrMApUY.js";import"./message-circle-mZCv8tvB.js";import"./ConversationStatus-DVzSb2Hv.js";import"./check-ofKUE8yH.js";import"./sparkles-CETYrxGA.js";import"./SessionObserve-dQDN23pP.js";import"./bash-format-BRV5C6Gv.js";import"./lane-tool-detail-0WhMf4Vj.js";import"./LaneToolHoverCard-HByf2ndx.js";import"./lane-observe-vfyACHi0.js";import"./lane-ask-display-B6iCAVcd.js";import"./ObservedTopologyPanel-BJUhDSuQ.js";import"./ObserveTextFlow-ZQWwrK3i.js";import"./SessionObserveEvidence-BRBGKAgd.js";import"./wrench-DjkoAOQt.js";import"./external-link-Dp_a2vRZ.js";import"./session-ref-lookup-state-SATH_jAP.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 ve({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{ve as FlightObserveScreen};
1
+ import{r as c,j as s}from"./index-BI9AljSD.js";import{a as k}from"./api-Co9aQ2Jw.js";import{u as R}from"./sse-DDHEHUgz.js";import{d as $,t as F}from"./time-Dhsh_2EG.js";import{SessionRefScreen as j}from"./SessionRefScreen-C8BiRVPx.js";/* empty css */import{c as E}from"./createLucideIcon-DthwWQIg.js";import{X as A}from"./x-DfRJbqrh.js";import"./perf-PX8Rx0EP.js";import"./index-BWHgHrtv.js";import"./tail-events-BdUrO0kb.js";import"./BackToPicker-Cto0Ioz9.js";import"./router-DTtux5sP.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-BQ6t92tJ.js";import"./ConversationScreen-CXAHQwQ3.js";import"./NewChatComposer-C_1op4dH.js";import"./text-Faa3ZStB.js";import"./scout-voice-BZKsdquE.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-B2W9DPG5.js";import"./conversation-model-QsJVfSeG.js";import"./colors-BtO5_zlx.js";import"./index-DfsTyYDx.js";import"./HarnessMark-DAaWPiT_.js";import"./NewChatOrigin-D7hwp6dm.js";import"./keyboard-nav-e6yGeorb.js";import"./chevron-down-C475vltS.js";import"./search-DmFM_9jm.js";import"./file-text--hfhwZH1.js";import"./ConversationComposer-H8_hsYSc.js";import"./AgentAvatar-B7c0egdP.js";import"./Provider-Bu-C8Hxc.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BJIamJOH.js";import"./DocumentFocusViewer-DFFE85Tq.js";import"./TextDocumentSurface-BeSwe3Yl.js";import"./chevron-right-CnZRSd-V.js";import"./code-xml-CvKBY3KA.js";import"./arrow-left-DHfdXJVZ.js";import"./arrow-right-BBsrogWf.js";import"./chunk-HRAB3GC3-DLNT8aOo.js";import"./SpriteAvatar-56DTXxSV.js";import"./CrewAvatar-CXJHLNVM.js";import"./zap-CIo8msJB.js";import"./message-markup-Cc_O-WdA.js";import"./mentions-DuLQnEcn.js";import"./AgentDetailCard-B_KLcgsP.js";import"./AgentLiveActions-CsQA3pu_.js";import"./terminal-takeover-B6H4llRR.js";import"./openContent-C6XO6kr5.js";import"./eye-FnaaPfja.js";import"./terminal-C3YRPfyz.js";import"./message-visibility-CGOmSSKs.js";import"./operator-attention-RqieiSY8.js";import"./sessionRead-CvFz2RHv.js";import"./clipboard-e3fSpeo7.js";import"./types-B0PlfpKc.js";/* empty css */import"./ConversationHeader-B0ZBhE_E.js";import"./AstronautSuit-Cjjcv6yQ.js";import"./ConversationFeedRows-hlEFlURs.js";import"./ConversationPanels-fMo6Uy1v.js";import"./tail-display-DcliDVkW.js";import"./lane-edit-display-C_Aujldz.js";import"./use-reduced-motion-8WuxLa5l.js";import"./proxy-1BABCaDb.js";import"./activity-CqZafWfx.js";import"./message-circle-B2DoYKDO.js";import"./ConversationStatus-DI5GCiyW.js";import"./check-DbIkldnK.js";import"./sparkles-Cf8gin88.js";import"./SessionObserve-BCehTlO8.js";import"./bash-format-BRV5C6Gv.js";import"./lane-tool-detail-0WhMf4Vj.js";import"./LaneToolHoverCard-Bo2Zl-1a.js";import"./lane-observe-vfyACHi0.js";import"./lane-ask-display-B6iCAVcd.js";import"./ObservedTopologyPanel-BhVsvwkh.js";import"./ObserveTextFlow-BcrGQet8.js";import"./SessionObserveEvidence-Bb6U-dem.js";import"./wrench-DkxnZRlR.js";import"./external-link-C_nxk0MJ.js";import"./session-ref-lookup-state-SATH_jAP.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 ve({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{ve as FlightObserveScreen};
@@ -1 +1 @@
1
- import{r as o,j as r}from"./index-DvLtl7rV.js";import{a as h}from"./api-Co9aQ2Jw.js";import{t as p,r as c,m as g}from"./follow-route-BvcGtBIL.js";import{s as l}from"./router-B9vQkNJL.js";/* empty css */import"./perf-PX8Rx0EP.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-BQ6t92tJ.js";function y({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{y as FollowScreen};
1
+ import{r as o,j as r}from"./index-BI9AljSD.js";import{a as h}from"./api-Co9aQ2Jw.js";import{t as p,r as c,m as g}from"./follow-route-BvcGtBIL.js";import{s as l}from"./router-DTtux5sP.js";/* empty css */import"./perf-PX8Rx0EP.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-BQ6t92tJ.js";function y({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{y as FollowScreen};