@openscout/scout 0.2.96 → 0.2.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) hide show
  1. package/README.md +0 -1
  2. package/bin/scoutd +0 -0
  3. package/dist/build-manifest.json +3 -3
  4. package/dist/client/assets/ActivityScreen-sfonf5SR.js +1 -0
  5. package/dist/client/assets/{AddProjectForm-IqOtJfRs.js → AddProjectForm-fXndbzXT.js} +1 -1
  6. package/dist/client/assets/{AgentAvatar-6-KBVKUu.js → AgentAvatar-Dz79iTxB.js} +1 -1
  7. package/dist/client/assets/AgentConfigurationScreen-DDc3udYM.js +1 -0
  8. package/dist/client/assets/AgentDefinitionsWorkspace-DHDS9Pgd.js +1 -0
  9. package/dist/client/assets/{AgentDetailCard-C9rn3Fj5.js → AgentDetailCard-8viaEY8b.js} +1 -1
  10. package/dist/client/assets/AgentFloorView-DuyvyMMj.js +1 -0
  11. package/dist/client/assets/AgentInfoScreen-qntgg2q2.js +1 -0
  12. package/dist/client/assets/{AgentLaneCard-DI2iW9zO.js → AgentLaneCard-Cc9uyfBr.js} +1 -1
  13. package/dist/client/assets/{AgentLaneChrome-D8bARHMx.js → AgentLaneChrome-Dv2lBFoH.js} +1 -1
  14. package/dist/client/assets/{AgentLaneDetailSheet-52un7dKC.js → AgentLaneDetailSheet-CGqtqSHQ.js} +1 -1
  15. package/dist/client/assets/{AgentLaneSummaryResize-CEBjmPTa.js → AgentLaneSummaryResize-Di4u6df2.js} +1 -1
  16. package/dist/client/assets/AgentLanesEmbedScreen-BA6fRwkD.js +1 -0
  17. package/dist/client/assets/{AgentLanesPreflight-q20mTjms.js → AgentLanesPreflight-CCGBArIb.js} +1 -1
  18. package/dist/client/assets/AgentLanesView-96lHsoX7.js +2 -0
  19. package/dist/client/assets/{AgentLiveActions-DrEJDJef.js → AgentLiveActions-DlSKL60c.js} +1 -1
  20. package/dist/client/assets/AgentMasterScreen-DHrMuQ6_.js +1 -0
  21. package/dist/client/assets/{AgentSessions-DCPCG4xb.js → AgentSessions-DV9v34aq.js} +2 -2
  22. package/dist/client/assets/AgentsConsole-DTpVhS67.js +1 -0
  23. package/dist/client/assets/AgentsScreen-hZ4o2I-e.js +1 -0
  24. package/dist/client/assets/AgentsSubnav-Ci7uWM7P.js +1 -0
  25. package/dist/client/assets/{AstronautSuit-DbjQtfD_.js → AstronautSuit-CwB4Dw07.js} +1 -1
  26. package/dist/client/assets/{AtopView-Daq_ob3z.js → AtopView-D7vyQDtE.js} +1 -1
  27. package/dist/client/assets/{BackToPicker-CXZjBRAe.js → BackToPicker-BHicJyfc.js} +1 -1
  28. package/dist/client/assets/BriefingDetailScreen-B-wD_Bot.js +1 -0
  29. package/dist/client/assets/{BriefingsScreen-B5oMTGKv.js → BriefingsScreen-Cn4Mbam9.js} +1 -1
  30. package/dist/client/assets/{BrokerMetadataPanel-BsiU8lTD.js → BrokerMetadataPanel-BJSwU9XZ.js} +1 -1
  31. package/dist/client/assets/BrokerScreen-C8FQ5rlg.js +5 -0
  32. package/dist/client/assets/{CastPicker-_5E5hNUe.js → CastPicker-CkgTalIt.js} +1 -1
  33. package/dist/client/assets/{ChatCollapsedStrip-D-eXhzPf.js → ChatCollapsedStrip-7Wrg8Ge0.js} +1 -1
  34. package/dist/client/assets/{CodeDiffPane-n7W4iGUG.js → CodeDiffPane-DfluIWmO.js} +1 -1
  35. package/dist/client/assets/{CodeProjectPicker-CMsbSTDq.js → CodeProjectPicker-By_Wz9ex.js} +1 -1
  36. package/dist/client/assets/CodeScreen-cLC0tJ4S.js +1 -0
  37. package/dist/client/assets/ConversationComposer-BUIjWMBi.js +1 -0
  38. package/dist/client/assets/ConversationFeedRows-Bx0gFyG_.js +1 -0
  39. package/dist/client/assets/ConversationHeader-Bt2RBj93.js +1 -0
  40. package/dist/client/assets/{ConversationPanels-Dujvnmup.js → ConversationPanels-o6W-cOoU.js} +2 -2
  41. package/dist/client/assets/ConversationScreen-DIU7m_aC.js +2 -0
  42. package/dist/client/assets/{ConversationStatus-DVzSb2Hv.js → ConversationStatus-CTYOywFh.js} +1 -1
  43. package/dist/client/assets/{CrewAvatar-BwXjyg8N.js → CrewAvatar-CZ_faQ_s.js} +1 -1
  44. package/dist/client/assets/CrewWorkspaces-DNX-QQ1h.js +1 -0
  45. package/dist/client/assets/CrewWorkspaces-Diq11KDq.css +1 -0
  46. package/dist/client/assets/{DataTable-Bp8tU9AK.js → DataTable-C6aMSilS.js} +1 -1
  47. package/dist/client/assets/{DispatchAftermath-B-6rmXzL.js → DispatchAftermath-ZCEB75hh.js} +1 -1
  48. package/dist/client/assets/{DocumentFocusViewer-Do3wQ_3Z.js → DocumentFocusViewer-D8iB6SMt.js} +1 -1
  49. package/dist/client/assets/{EmbeddableSurfacesLab-C1orRyP9.js → EmbeddableSurfacesLab-D3iZiS8o.js} +1 -1
  50. package/dist/client/assets/{EmptyState-CJzXj1l5.js → EmptyState-CKPWFSjq.js} +1 -1
  51. package/dist/client/assets/{FileViewerPane-Df6VzXjA.js → FileViewerPane-CxNbcTYf.js} +1 -1
  52. package/dist/client/assets/FlightObserveScreen-BTe1YRPr.js +1 -0
  53. package/dist/client/assets/{FollowScreen-DvnxYLVh.js → FollowScreen-CkR-okdL.js} +1 -1
  54. package/dist/client/assets/{HarnessMark-B979GCSB.js → HarnessMark-DttReffF.js} +1 -1
  55. package/dist/client/assets/HarnessesScreen-COO_Q8VY.js +1 -0
  56. package/dist/client/assets/{HerdrSession-B3McuYgi.js → HerdrSession-DsuxCtfX.js} +1 -1
  57. package/dist/client/assets/{HomeHero-CdUVPjkG.js → HomeHero-DXJo2QSO.js} +1 -1
  58. package/dist/client/assets/{HostAdvisorView-Bok5Sk5c.js → HostAdvisorView-DeJ-8RZV.js} +1 -1
  59. package/dist/client/assets/{KnowledgeSearchInspector-B7XSoJsu.js → KnowledgeSearchInspector-W_zNIBRV.js} +1 -1
  60. package/dist/client/assets/KnowledgeSearchScreen-_rxJNUUh.js +1 -0
  61. package/dist/client/assets/{LaneToolHoverCard-HByf2ndx.js → LaneToolHoverCard-t7-XJP-h.js} +1 -1
  62. package/dist/client/assets/LaneTraceDetailSheet-DNIECgEl.js +1 -0
  63. package/dist/client/assets/{LaneTraceEventFocus-DM-hoPxG.js → LaneTraceEventFocus-BB5DhFQm.js} +1 -1
  64. package/dist/client/assets/{MeshCanvas-DCLJRsBy.js → MeshCanvas-DZv2ipsy.js} +1 -1
  65. package/dist/client/assets/{MeshCanvasMinimap-cEFS9eW7.js → MeshCanvasMinimap-BXHRNb7l.js} +1 -1
  66. package/dist/client/assets/MeshScreen-DuNvpDC5.js +1 -0
  67. package/dist/client/assets/{MeshTopologyView-CCRPd8PU.js → MeshTopologyView-Dc0GSrKa.js} +2 -2
  68. package/dist/client/assets/MessagesScreen-dNNPFwAc.js +1 -0
  69. package/dist/client/assets/{MissionContextRail-DF0_kiU7.js → MissionContextRail-DnCWPzAM.js} +1 -1
  70. package/dist/client/assets/MissionControlView-DmaThhNR.js +1 -0
  71. package/dist/client/assets/MissionFocusOverlay-K21ssTxv.js +1 -0
  72. package/dist/client/assets/MissionLeftAgentRow-CbQm4BLv.js +1 -0
  73. package/dist/client/assets/{MissionLogPane-BbdDKjUl.js → MissionLogPane-BLvSSIdT.js} +1 -1
  74. package/dist/client/assets/{NewAgentModal-DfHxad34.js → NewAgentModal-B7qxjZlW.js} +1 -1
  75. package/dist/client/assets/NewChatComposer-D2Ah4T-W.js +19 -0
  76. package/dist/client/assets/{NewChatOrigin-B1u7ki70.js → NewChatOrigin-DCn5cWPZ.js} +1 -1
  77. package/dist/client/assets/{ObserveEmbedScreen-Co0xTii6.js → ObserveEmbedScreen-DvKGsaLv.js} +2 -2
  78. package/dist/client/assets/{ObserveTextFlow-ZQWwrK3i.js → ObserveTextFlow-DCJ5EmD8.js} +2 -2
  79. package/dist/client/assets/{ObservedTopologyPanel-BJUhDSuQ.js → ObservedTopologyPanel-CJVqIqQ2.js} +1 -1
  80. package/dist/client/assets/{OpenScoutAppShell-CUd2yOLu.js → OpenScoutAppShell-C9TOLB7u.js} +2 -2
  81. package/dist/client/assets/OpsAgentsView-vIoY-AW1.js +1 -0
  82. package/dist/client/assets/OpsScreen-CJBwshEp.js +1 -0
  83. package/dist/client/assets/OpsSubnav-CjDTnp64.js +1 -0
  84. package/dist/client/assets/ProjectAgentProfile-Br1eTD7G.js +1 -0
  85. package/dist/client/assets/ProjectAgentProfileBar-CUzZ4Rpx.js +1 -0
  86. package/dist/client/assets/ProjectAgentProfileHero-mjxNcRvw.js +1 -0
  87. package/dist/client/assets/ProjectsInbox-Bq29DE_o.js +2 -0
  88. package/dist/client/assets/ProjectsRail-kMDA0yn4.js +1 -0
  89. package/dist/client/assets/ProjectsScreen-BDaJYhc0.js +1 -0
  90. package/dist/client/assets/ProjectsThreadAside-B940p3vW.js +1 -0
  91. package/dist/client/assets/Provider-D0bB7q6y.js +1 -0
  92. package/dist/client/assets/{RailRow-CEH2MFBw.js → RailRow-B88JVr62.js} +1 -1
  93. package/dist/client/assets/RawSessionsTable-CzGhEdiZ.js +1 -0
  94. package/dist/client/assets/RealtimeVoiceScreen-CyP1CWsX.js +1 -0
  95. package/dist/client/assets/{RepoDiffEmbedScreen-kY2pHjIs.js → RepoDiffEmbedScreen-mexrJPhW.js} +1 -1
  96. package/dist/client/assets/{RepoDiffPageScreen-C6LhoKrn.js → RepoDiffPageScreen-DbqX4L3q.js} +1 -1
  97. package/dist/client/assets/{RepoDiffViewer-BhcIIQQg.js → RepoDiffViewer-Bw5yMC4A.js} +1 -1
  98. package/dist/client/assets/{RepoDiffViewerLazy-Csy_j9LD.js → RepoDiffViewerLazy-DzfoFhbl.js} +2 -2
  99. package/dist/client/assets/{ReposScreen-B_cB0zu7.js → ReposScreen-CzbO1Fuy.js} +2 -2
  100. package/dist/client/assets/{ScoutDeckSurface-CSy_fjcG.js → ScoutDeckSurface-DQoZofzH.js} +1 -1
  101. package/dist/client/assets/{ScoutSurface-CQVcSrin.js → ScoutSurface-NlhDsPzg.js} +1 -1
  102. package/dist/client/assets/{ScoutbotFxLab-DqGiLYNy.js → ScoutbotFxLab-l2WAahCg.js} +1 -1
  103. package/dist/client/assets/{SecondaryNav-BR4VRdgh.js → SecondaryNav-Cs0_FQdj.js} +1 -1
  104. package/dist/client/assets/{SessionEmbedScreen-BTlZ9gAg.js → SessionEmbedScreen-CpduQ0O9.js} +1 -1
  105. package/dist/client/assets/{SessionObserve-dQDN23pP.js → SessionObserve-BVeTkcIl.js} +1 -1
  106. package/dist/client/assets/{SessionObserveEvidence-BRBGKAgd.js → SessionObserveEvidence-BkOezTGV.js} +1 -1
  107. package/dist/client/assets/SessionRefScreen-DetLMkTT.js +1 -0
  108. package/dist/client/assets/SessionsScreen-B-McKw6d.js +1 -0
  109. package/dist/client/assets/{SettingsDrawer-RGVK_bmE.js → SettingsDrawer-CPB32w0n.js} +3 -3
  110. package/dist/client/assets/SettingsScreen-BEzYFdjz.js +1 -0
  111. package/dist/client/assets/{ShikiPane-DYI9Hkge.js → ShikiPane-C0TuCATU.js} +1 -1
  112. package/dist/client/assets/{SlidePanel-B9ugxWgA.js → SlidePanel-CETQ5NTx.js} +1 -1
  113. package/dist/client/assets/{SpriteAvatar-z5hHesx9.js → SpriteAvatar-DFO4Kb4Z.js} +1 -1
  114. package/dist/client/assets/{StatusPill-BFvMjmZV.js → StatusPill-BllrY-eg.js} +1 -1
  115. package/dist/client/assets/{TailView-0uEIj2JH.js → TailView-_gKWfaQM.js} +2 -2
  116. package/dist/client/assets/Terminal-DWyZTZdY.js +1 -0
  117. package/dist/client/assets/TerminalEmbedScreen-_SSzwhWa.js +1 -0
  118. package/dist/client/assets/{TerminalHeaderMount-BL07cd0q.js → TerminalHeaderMount-CY7uIWBg.js} +1 -1
  119. package/dist/client/assets/{TextDocumentSurface-BflAwXeZ.js → TextDocumentSurface-2X1Gw4eA.js} +1 -1
  120. package/dist/client/assets/{TmuxPeek-BTnjOQi0.js → TmuxPeek-CqTJRhkI.js} +1 -1
  121. package/dist/client/assets/{VoicePermissionsPanel-CgQ6GGS-.js → VoicePermissionsPanel-C4vkU-sU.js} +1 -1
  122. package/dist/client/assets/{WorkDetailScreen-CaLG-zDs.js → WorkDetailScreen-DqGnuK0e.js} +3 -3
  123. package/dist/client/assets/{WorkFilesViewer-B9Sil_No.js → WorkFilesViewer-D8-4vF5l.js} +1 -1
  124. package/dist/client/assets/{activity-DcrMApUY.js → activity-CzTJ-YMX.js} +1 -1
  125. package/dist/client/assets/{addon-fit-DMVrz5Sv.js → addon-fit-Zx3A7pGS.js} +1 -1
  126. package/dist/client/assets/{addon-webgl-BYvpZUyu.js → addon-webgl-DitJj-N0.js} +1 -1
  127. package/dist/client/assets/{agent-autocomplete-B-5QTeas.js → agent-autocomplete-BlK8wY06.js} +1 -1
  128. package/dist/client/assets/{agent-essentials-D7KRGYvF.js → agent-essentials-K9B6kbTS.js} +1 -1
  129. package/dist/client/assets/{agent-lane-card-model-CNZMPkhc.js → agent-lane-card-model-CY3OE1Xu.js} +1 -1
  130. package/dist/client/assets/{agent-lanes-model-DXqjs0OK.js → agent-lanes-model-tc-1hE6q.js} +1 -1
  131. package/dist/client/assets/{agent-master-model-DqjrVI2h.js → agent-master-model-DMcHeNq3.js} +1 -1
  132. package/dist/client/assets/agent-specialization-CtF_jI34.js +1 -0
  133. package/dist/client/assets/agents-project-DgbqDc65.css +1 -0
  134. package/dist/client/assets/{arc.es-NHqHWohb.js → arc.es-BNXJqSw7.js} +1 -1
  135. package/dist/client/assets/{arrow-down-CKtSUjmW.js → arrow-down-BAGkhHA6.js} +1 -1
  136. package/dist/client/assets/{arrow-left-Czpf-AE4.js → arrow-left-eToA6GxC.js} +1 -1
  137. package/dist/client/assets/{arrow-right-BuzMnLYP.js → arrow-right-DTX42clh.js} +1 -1
  138. package/dist/client/assets/{arrow-up-right-C6Wl-1uw.js → arrow-up-right-B09GPwFl.js} +1 -1
  139. package/dist/client/assets/{bot-rd0awxD3.js → bot-WxKXYtEX.js} +1 -1
  140. package/dist/client/assets/{check-ofKUE8yH.js → check-Dz2SRHft.js} +1 -1
  141. package/dist/client/assets/{chevron-down-wciXnOQz.js → chevron-down-D120PY4g.js} +1 -1
  142. package/dist/client/assets/{chevron-right-D-HdlPg8.js → chevron-right-CowuvuE6.js} +1 -1
  143. package/dist/client/assets/{chunk-HRAB3GC3-Tyv9rzx7.js → chunk-HRAB3GC3-KjjrTLCU.js} +1 -1
  144. package/dist/client/assets/{chunk-JTPDIGGW-BC2Mandc.js → chunk-JTPDIGGW-COJ00z94.js} +3 -3
  145. package/dist/client/assets/{chunk-T65CQEWV-C1AWTYZZ.js → chunk-T65CQEWV-H2QEKfr1.js} +1 -1
  146. package/dist/client/assets/{chunk-YOZR3KYS-DwHPHa6f.js → chunk-YOZR3KYS-CrCgXw9l.js} +1 -1
  147. package/dist/client/assets/{clock-B88r8OrZ.js → clock-_9FDplIT.js} +1 -1
  148. package/dist/client/assets/{code-xml-D7pOQM9l.js → code-xml-CkkNdRmu.js} +1 -1
  149. package/dist/client/assets/{compass-Dt1AMXz2.js → compass-BdpImt_W.js} +1 -1
  150. package/dist/client/assets/content-0RBfbCIJ.js +1 -0
  151. package/dist/client/assets/content-BTmnk2bl.js +1 -0
  152. package/dist/client/assets/content-Bk5DKhyP.js +1 -0
  153. package/dist/client/assets/{content-nkx0swDe.js → content-Bw_8GE_S.js} +1 -1
  154. package/dist/client/assets/content-CI4gLEWi.js +1 -0
  155. package/dist/client/assets/content-CLCtp9Rb.js +1 -0
  156. package/dist/client/assets/content-C_FAGTNk.js +1 -0
  157. package/dist/client/assets/content-CnnzWOE3.js +1 -0
  158. package/dist/client/assets/content-DKlY98pO.js +1 -0
  159. package/dist/client/assets/content-Df7ndXTG.js +1 -0
  160. package/dist/client/assets/content-DkZDzzx3.js +1 -0
  161. package/dist/client/assets/content-DnGmb2L0.js +1 -0
  162. package/dist/client/assets/content-Ds-zs-Ss.js +1 -0
  163. package/dist/client/assets/content-JIWSyC0f.js +1 -0
  164. package/dist/client/assets/content-Q3TIYC8q.js +1 -0
  165. package/dist/client/assets/content-evaBfvxD.js +1 -0
  166. package/dist/client/assets/{context-budget-DX_fwUs3.js → context-budget-DqxWzalx.js} +1 -1
  167. package/dist/client/assets/{conversation-icons-tp9BX6X2.js → conversation-icons-DHGc9wbT.js} +1 -1
  168. package/dist/client/assets/conversation-model-C2KuZUXc.js +1 -0
  169. package/dist/client/assets/conversation-motion-features-BJnHs3Ul.js +1 -0
  170. package/dist/client/assets/{copy-CWWAJ75H.js → copy-BzdzWsQd.js} +1 -1
  171. package/dist/client/assets/{cpu-DrqejfkB.js → cpu-CHFIGw87.js} +1 -1
  172. package/dist/client/assets/{createLucideIcon-DezKXSG2.js → createLucideIcon-Dv8H8m7J.js} +1 -1
  173. package/dist/client/assets/discover-DutlV0ZU.js +2 -0
  174. package/dist/client/assets/embed-entry-CJG7WEVw.js +2 -0
  175. package/dist/client/assets/{external-link-Dp_a2vRZ.js → external-link-BvX5PfLh.js} +1 -1
  176. package/dist/client/assets/{eye-BRyD0jno.js → eye-C9cGk5z6.js} +1 -1
  177. package/dist/client/assets/{file-code-corner-muIVH_xO.js → file-code-corner-jlGFdr8d.js} +1 -1
  178. package/dist/client/assets/{file-text-CqJgwxmv.js → file-text-BHro8MkG.js} +1 -1
  179. package/dist/client/assets/{gauge-hU--hKVP.js → gauge-DSflSery.js} +1 -1
  180. package/dist/client/assets/{gestures-DN4hEeqv.js → gestures-YA5IIwp-.js} +1 -1
  181. package/dist/client/assets/{git-branch-CK5v8F2v.js → git-branch-Bc_eDIpG.js} +1 -1
  182. package/dist/client/assets/{home-moving-signal-BjDtEJUP.js → home-moving-signal-PHSqSBu_.js} +1 -1
  183. package/dist/client/assets/home-now-card-C_qsI6C6.js +1 -0
  184. package/dist/client/assets/{home-now-card-nano-C-r_bBg5.js → home-now-card-nano-Jmy7eJ6H.js} +1 -1
  185. package/dist/client/assets/{hooks-D46bABUP.js → hooks-ME7rmhpE.js} +1 -1
  186. package/dist/client/assets/{index-DvLtl7rV.js → index-C1VaWNuD.js} +2 -2
  187. package/dist/client/assets/index-C8UCRm2W.js +1 -0
  188. package/dist/client/assets/index-Cn0I2Hgi.js +1 -0
  189. package/dist/client/assets/index-Cx6Gbr6n.js +1 -0
  190. package/dist/client/assets/{inspector-panel-Dkc7rLvY.js → inspector-panel-CwrHjRaQ.js} +2 -2
  191. package/dist/client/assets/{keyboard-nav-BLYDhL3Z.js → keyboard-nav-B8sQ_8IF.js} +1 -1
  192. package/dist/client/assets/{lane-roster-store-DOdI1O13.js → lane-roster-store-DN2jxXF-.js} +1 -1
  193. package/dist/client/assets/{layers-CSsg3JVP.js → layers-CW2-qHsG.js} +1 -1
  194. package/dist/client/assets/{layout-grid-DOChPJdZ.js → layout-grid-BoVnPOk-.js} +1 -1
  195. package/dist/client/assets/left-BRu9pnqx.js +2 -0
  196. package/dist/client/assets/left-BjS1dKNV.js +2 -0
  197. package/dist/client/assets/left-CL-TVLJ7.js +1 -0
  198. package/dist/client/assets/left-DLpsDi55.js +1 -0
  199. package/dist/client/assets/left-DPcM9o8Y.js +1 -0
  200. package/dist/client/assets/left-MmTJf1tK.js +1 -0
  201. package/dist/client/assets/left-P80i5V8L.js +1 -0
  202. package/dist/client/assets/left-advisor-CbXVzAqS.js +1 -0
  203. package/dist/client/assets/left-agents-7mJsiNyr.js +1 -0
  204. package/dist/client/assets/left-default-COK26l3H.js +1 -0
  205. package/dist/client/assets/left-lanes-Dbdm9Veu.js +1 -0
  206. package/dist/client/assets/left-mission-DqGR5jby.js +1 -0
  207. package/dist/client/assets/library-COnWzUWv.js +1 -0
  208. package/dist/client/assets/{loader-circle-pM56HNhR.js → loader-circle-DmUG_YC7.js} +1 -1
  209. package/dist/client/assets/{local-agents-C8xAhbO5.js → local-agents-VP1-ZlPw.js} +1 -1
  210. package/dist/client/assets/{mentions-DG6OQrsc.js → mentions-BZ5SBMtc.js} +1 -1
  211. package/dist/client/assets/mesh-buckets-CLYS8Jx8.js +1 -0
  212. package/dist/client/assets/{mesh-ops-BZ1h5RQs.js → mesh-ops-CKSWgax2.js} +1 -1
  213. package/dist/client/assets/{mesh-view-store-ChUOASK8.js → mesh-view-store-CBM1za_N.js} +1 -1
  214. package/dist/client/assets/{message-circle-mZCv8tvB.js → message-circle-joGFxfj1.js} +1 -1
  215. package/dist/client/assets/{message-markup-C2LQDm_k.js → message-markup-DC0QFEZn.js} +1 -1
  216. package/dist/client/assets/{message-square-C7t_qtuj.js → message-square-BLiFqpe_.js} +1 -1
  217. package/dist/client/assets/{mission-control-store-nDLdUZPA.js → mission-control-store-CM8mQGg8.js} +1 -1
  218. package/dist/client/assets/model-CBkMvT1w.js +1 -0
  219. package/dist/client/assets/{observe-BpEm1INu.js → observe-BLmy4quB.js} +1 -1
  220. package/dist/client/assets/{page-status-E5jnk48p.js → page-status-BE0-J1xY.js} +1 -1
  221. package/dist/client/assets/{paperclip-C64lkcbM.js → paperclip-Br7wUDFl.js} +1 -1
  222. package/dist/client/assets/{persistent-state-EHXw8WNy.js → persistent-state-BubPQ7tT.js} +1 -1
  223. package/dist/client/assets/{plus-Co-dqKul.js → plus-BWKhylds.js} +1 -1
  224. package/dist/client/assets/profile-BCvk8jOQ.js +1 -0
  225. package/dist/client/assets/projects-inbox-BIW7nv-H.css +1 -0
  226. package/dist/client/assets/projects-inbox-DFbgVlXL.js +1 -0
  227. package/dist/client/assets/{proxy-BiW5suC7.js → proxy-DVDRhSRR.js} +1 -1
  228. package/dist/client/assets/{radio-BOxBQX-T.js → radio-CxIXS1nU.js} +1 -1
  229. package/dist/client/assets/{refresh-cw-DMxGzDwn.js → refresh-cw-Bkh7Cvnd.js} +1 -1
  230. package/dist/client/assets/resolve-panes-DhD5qmQO.js +1 -0
  231. package/dist/client/assets/resolve-sidebar-context-GqhZNRPY.js +1 -0
  232. package/dist/client/assets/right-B_08ilv6.js +1 -0
  233. package/dist/client/assets/right-Brm67HOL.js +1 -0
  234. package/dist/client/assets/right-BveAPKBW.js +1 -0
  235. package/dist/client/assets/right-CpTB_-Ya.js +1 -0
  236. package/dist/client/assets/right-CqC4Qdot.js +1 -0
  237. package/dist/client/assets/right-D91j9d5Y.js +1 -0
  238. package/dist/client/assets/{right-CimaAvQN.js → right-DVUq5374.js} +1 -1
  239. package/dist/client/assets/right-DaLRhYl3.js +1 -0
  240. package/dist/client/assets/right-Dt1wOwA5.js +1 -0
  241. package/dist/client/assets/right-DtzqIZQF.js +1 -0
  242. package/dist/client/assets/{rocket-BQm5_CvR.js → rocket-CnxqjX_K.js} +1 -1
  243. package/dist/client/assets/{router-B9vQkNJL.js → router-kfcaYqZr.js} +1 -1
  244. package/dist/client/assets/runtime-picker-C20lTGhV.js +1 -0
  245. package/dist/client/assets/{scope-views-1IYJdl41.js → scope-views-KPY85UUx.js} +1 -1
  246. package/dist/client/assets/{scout-voice-BVUqGhth.js → scout-voice-Cg1qfepC.js} +1 -1
  247. package/dist/client/assets/scoutbot-D7kGGyK_.js +3 -0
  248. package/dist/client/assets/{scoutbot-markdown-BQ_Ee2Ic.js → scoutbot-markdown-yb87JlSE.js} +1 -1
  249. package/dist/client/assets/{scroll-text-Dze_dXtQ.js → scroll-text-DFcBYy5J.js} +1 -1
  250. package/dist/client/assets/{search-CDko0PKE.js → search-FB2vVxCp.js} +1 -1
  251. package/dist/client/assets/{secondaryNavConfig-BoQ_zYR9.js → secondaryNavConfig-C0Srrmy8.js} +1 -1
  252. package/dist/client/assets/{selection-bridge-Din6yV3h.js → selection-bridge-qBGFCJv8.js} +1 -1
  253. package/dist/client/assets/{send-horizontal-CSjIm6xg.js → send-horizontal-CS7mxVhX.js} +1 -1
  254. package/dist/client/assets/{server-Bzj7lPIx.js → server-WY6gsbZz.js} +1 -1
  255. package/dist/client/assets/{session-catalog-DsaZJXZt.js → session-catalog-CG4oL_yN.js} +1 -1
  256. package/dist/client/assets/{session-table-BQfR7u6r.js → session-table-uJh3v-ly.js} +1 -1
  257. package/dist/client/assets/{settings-Dyvpkb1D.js → settings-DQEtqkM9.js} +1 -1
  258. package/dist/client/assets/{sliders-horizontal-C8njVwfg.js → sliders-horizontal-57e99_qO.js} +1 -1
  259. package/dist/client/assets/{sparkles-CETYrxGA.js → sparkles-D0vWLTyC.js} +1 -1
  260. package/dist/client/assets/{sse-CD9MMUxl.js → sse-B29iGBnw.js} +1 -1
  261. package/dist/client/assets/{system-surfaces-redesign-QVXNeGYw.css → system-surfaces-redesign-kuf3wuE_.css} +1 -1
  262. package/dist/client/assets/{tail-events-Ps8KpKah.js → tail-events-LK29oCKm.js} +1 -1
  263. package/dist/client/assets/{terminal-9GRS_Qdc.js → terminal-UDy4lzV1.js} +1 -1
  264. package/dist/client/assets/{terminal-relay-GYMIvKs1.js → terminal-relay-CXHMdain.js} +1 -1
  265. package/dist/client/assets/{terminal-screen-BLk4PAYt.css → terminal-screen-vMICbBJh.css} +1 -1
  266. package/dist/client/assets/{terminal-sessions-BQ6t92tJ.js → terminal-sessions-Bdt2W3Y4.js} +1 -1
  267. package/dist/client/assets/{terminal-takeover-_Jyys4me.js → terminal-takeover-BMeBjBB2.js} +1 -1
  268. package/dist/client/assets/{use-conversation-list-C9ABzjXI.js → use-conversation-list-UG-tMN67.js} +1 -1
  269. package/dist/client/assets/{use-fleet-active-asks-DAspZQjE.js → use-fleet-active-asks-CCGrll5q.js} +1 -1
  270. package/dist/client/assets/{use-mesh-ops-items-Dh54ymEp.js → use-mesh-ops-items-BjyeFJTz.js} +1 -1
  271. package/dist/client/assets/{use-reduced-motion-x8pJMVrG.js → use-reduced-motion-CPoX8iV2.js} +1 -1
  272. package/dist/client/assets/{use-scout-dev-flags-DhCbiDK3.js → use-scout-dev-flags-DTseRrFi.js} +1 -1
  273. package/dist/client/assets/{useAgentHoverCard-DoBwV0LX.js → useAgentHoverCard-BgTLNcF-.js} +1 -1
  274. package/dist/client/assets/useContentSecondaryNav-CoIoz7JU.js +1 -0
  275. package/dist/client/assets/useEmbedHeadline-DuUnwTB7.js +1 -0
  276. package/dist/client/assets/{usePierreRuntime-ejq9dCWV.js → usePierreRuntime-35AHf9RQ.js} +1 -1
  277. package/dist/client/assets/{wrench-DjkoAOQt.js → wrench-BfVeded5.js} +1 -1
  278. package/dist/client/assets/{x-CAbNespN.js → x-DgmmnPKt.js} +1 -1
  279. package/dist/client/assets/{xterm-Cf-ngcGP.js → xterm-DnJJmrCA.js} +1 -1
  280. package/dist/client/assets/{zap-Cq8eWkcF.js → zap-Bcja1lHG.js} +1 -1
  281. package/dist/client/index.html +1 -1
  282. package/dist/main.mjs +5180 -9874
  283. package/dist/node/main.mjs +18 -2
  284. package/dist/pairing-runtime-controller.mjs +31 -2
  285. package/dist/runtime/broker-daemon.mjs +87 -13
  286. package/dist/scout-control-plane-web.mjs +35 -3
  287. package/package.json +2 -5
  288. package/dist/client/assets/ActivityScreen-BnoaUkVZ.js +0 -1
  289. package/dist/client/assets/AgentConfigurationScreen-CuZJy07q.js +0 -1
  290. package/dist/client/assets/AgentDefinitionsWorkspace-Iyl4BesU.js +0 -1
  291. package/dist/client/assets/AgentFloorView-YT-Jjccf.js +0 -1
  292. package/dist/client/assets/AgentInfoScreen-Dr99gQEZ.js +0 -1
  293. package/dist/client/assets/AgentLanesEmbedScreen-Dgcm7zd_.js +0 -1
  294. package/dist/client/assets/AgentLanesView-CetZZDyF.js +0 -2
  295. package/dist/client/assets/AgentMasterScreen-DJPnstoD.js +0 -1
  296. package/dist/client/assets/AgentsConsole-CsYOoFJi.js +0 -1
  297. package/dist/client/assets/AgentsScreen-k8LvBuU_.js +0 -1
  298. package/dist/client/assets/AgentsSubnav-C4xpQhsv.js +0 -1
  299. package/dist/client/assets/BriefingDetailScreen-CUCXO-KH.js +0 -1
  300. package/dist/client/assets/BrokerScreen-BPbOHhCS.js +0 -5
  301. package/dist/client/assets/CodeScreen-CeuO3EhR.js +0 -1
  302. package/dist/client/assets/ConversationComposer-CXPKx86g.js +0 -1
  303. package/dist/client/assets/ConversationFeedRows-WrH-YI3L.js +0 -1
  304. package/dist/client/assets/ConversationHeader-BQWzGzLK.js +0 -1
  305. package/dist/client/assets/ConversationScreen-CR9pWB65.js +0 -2
  306. package/dist/client/assets/CrewWorkspaces-CkQDhyie.css +0 -1
  307. package/dist/client/assets/CrewWorkspaces-NKujRzwh.js +0 -1
  308. package/dist/client/assets/FlightObserveScreen-6mGnmWQA.js +0 -1
  309. package/dist/client/assets/HarnessesScreen-CHTuv8p6.js +0 -1
  310. package/dist/client/assets/KnowledgeSearchScreen-D3o3IODW.js +0 -1
  311. package/dist/client/assets/LaneTraceDetailSheet-BUgHz-sd.js +0 -1
  312. package/dist/client/assets/MeshScreen-BcxPkhm6.js +0 -1
  313. package/dist/client/assets/MessagesScreen-Bb5l13MO.js +0 -1
  314. package/dist/client/assets/MissionControlView-E3V7bENU.js +0 -1
  315. package/dist/client/assets/MissionFocusOverlay-h15sQFvP.js +0 -1
  316. package/dist/client/assets/MissionLeftAgentRow-KPdk9rSa.js +0 -1
  317. package/dist/client/assets/NewChatComposer-_Stj0fZy.js +0 -19
  318. package/dist/client/assets/OpsAgentsView-DI5wu1si.js +0 -1
  319. package/dist/client/assets/OpsScreen-D8fQafCl.js +0 -1
  320. package/dist/client/assets/OpsSubnav-1K4Jaf__.js +0 -1
  321. package/dist/client/assets/ProjectAgentProfile-Bdjd_dAx.js +0 -1
  322. package/dist/client/assets/ProjectAgentProfileBar-k2QHHHsQ.js +0 -1
  323. package/dist/client/assets/ProjectAgentProfileHero-Bpxk1ui2.js +0 -1
  324. package/dist/client/assets/ProjectsInbox-C_bMHLCc.js +0 -2
  325. package/dist/client/assets/ProjectsRail-J-aH_pxT.js +0 -1
  326. package/dist/client/assets/ProjectsScreen-cVUkGbPz.js +0 -1
  327. package/dist/client/assets/ProjectsThreadAside-_ourdM-Q.js +0 -1
  328. package/dist/client/assets/Provider-CtXJeLrP.js +0 -1
  329. package/dist/client/assets/RawSessionsTable-CDyrom-F.js +0 -1
  330. package/dist/client/assets/RealtimeVoiceScreen-DBl3DN1H.js +0 -1
  331. package/dist/client/assets/SessionRefScreen-COVQMbtE.js +0 -1
  332. package/dist/client/assets/SessionsScreen--5OJ3p3v.js +0 -1
  333. package/dist/client/assets/SettingsScreen-CCxzy5IU.js +0 -1
  334. package/dist/client/assets/Terminal-DouZeNxc.js +0 -1
  335. package/dist/client/assets/TerminalEmbedScreen-dMNUbzXr.js +0 -1
  336. package/dist/client/assets/agent-specialization-BujJVUTD.js +0 -1
  337. package/dist/client/assets/agents-project-COzHxZAF.css +0 -1
  338. package/dist/client/assets/agents-project-model-UYiamtrU.js +0 -1
  339. package/dist/client/assets/content-9K38QchR.js +0 -1
  340. package/dist/client/assets/content-BRgnyXWh.js +0 -1
  341. package/dist/client/assets/content-BWPNyXJ0.js +0 -1
  342. package/dist/client/assets/content-BdkI07v3.js +0 -1
  343. package/dist/client/assets/content-C4oWa8SB.js +0 -1
  344. package/dist/client/assets/content-C9ijJxyl.js +0 -1
  345. package/dist/client/assets/content-CFZ4rghn.js +0 -1
  346. package/dist/client/assets/content-CIqu_Ci_.js +0 -1
  347. package/dist/client/assets/content-CnJF9DGO.js +0 -1
  348. package/dist/client/assets/content-CriW8Y8u.js +0 -1
  349. package/dist/client/assets/content-DDCyPPk_.js +0 -1
  350. package/dist/client/assets/content-DtcZeh5m.js +0 -1
  351. package/dist/client/assets/content-U9tsdtle.js +0 -1
  352. package/dist/client/assets/content-hFLK3CON.js +0 -1
  353. package/dist/client/assets/content-p00KQrtD.js +0 -1
  354. package/dist/client/assets/conversation-model-Dc02NsGp.js +0 -1
  355. package/dist/client/assets/conversation-motion-features-D9-RmBSq.js +0 -1
  356. package/dist/client/assets/discover-C2CZO4Tk.js +0 -2
  357. package/dist/client/assets/embed-entry-BSMUykuG.js +0 -2
  358. package/dist/client/assets/home-now-card-nF8OotI-.js +0 -1
  359. package/dist/client/assets/index-CPrU5q04.js +0 -1
  360. package/dist/client/assets/index-kL1WLbeS.js +0 -1
  361. package/dist/client/assets/index-zvhpRHao.js +0 -1
  362. package/dist/client/assets/left-B-SdEJSJ.js +0 -1
  363. package/dist/client/assets/left-B3wSE6ql.js +0 -1
  364. package/dist/client/assets/left-BNRFiRsb.js +0 -2
  365. package/dist/client/assets/left-BggzhgXN.js +0 -1
  366. package/dist/client/assets/left-CARCvvxS.js +0 -2
  367. package/dist/client/assets/left-CpokZYHt.js +0 -1
  368. package/dist/client/assets/left-YT7mIGuH.js +0 -1
  369. package/dist/client/assets/left-advisor-CCY0vkcO.js +0 -1
  370. package/dist/client/assets/left-agents-trhO5sL8.js +0 -1
  371. package/dist/client/assets/left-default-CG33elBs.js +0 -1
  372. package/dist/client/assets/left-lanes-CitMgeTp.js +0 -1
  373. package/dist/client/assets/left-mission-Zl2m_5eU.js +0 -1
  374. package/dist/client/assets/library-DkALuCh5.js +0 -1
  375. package/dist/client/assets/mesh-buckets-6y3ZIibI.js +0 -1
  376. package/dist/client/assets/mesh-roster-Bc7T4b7z.js +0 -1
  377. package/dist/client/assets/model-IGCUEsMy.js +0 -1
  378. package/dist/client/assets/profile-APxDsN2P.js +0 -1
  379. package/dist/client/assets/projects-inbox-Cg4X2lUQ.js +0 -1
  380. package/dist/client/assets/projects-inbox-DRBl2N85.css +0 -1
  381. package/dist/client/assets/resolve-panes-DeVJbS9c.js +0 -1
  382. package/dist/client/assets/resolve-sidebar-context-BQe5J6xF.js +0 -1
  383. package/dist/client/assets/right-Bmfd3pjP.js +0 -1
  384. package/dist/client/assets/right-BqI-nr9G.js +0 -1
  385. package/dist/client/assets/right-BuCgE0fZ.js +0 -1
  386. package/dist/client/assets/right-BwlW6E57.js +0 -1
  387. package/dist/client/assets/right-C0ybUw0j.js +0 -1
  388. package/dist/client/assets/right-CdkcrmeD.js +0 -1
  389. package/dist/client/assets/right-CkCCPbCX.js +0 -1
  390. package/dist/client/assets/right-D3eSiy41.js +0 -1
  391. package/dist/client/assets/right-Dz_xD0Vj.js +0 -1
  392. package/dist/client/assets/scoutbot-BJIamJOH.js +0 -3
  393. package/dist/client/assets/text-BP3oyl8-.js +0 -1
  394. package/dist/client/assets/useContentSecondaryNav-pZe2Zfk1.js +0 -1
  395. /package/dist/client/assets/{text-BYAFNLNq.css → runtime-picker-BYAFNLNq.css} +0 -0
@@ -0,0 +1,5 @@
1
+ import{r as a,j as e}from"./index-C1VaWNuD.js";import{r as us}from"./index-Cx6Gbr6n.js";import{D as hs}from"./runtime-picker-C20lTGhV.js";import{E as Ie}from"./EmptyState-CKPWFSjq.js";import{B as fs,j as ms,F as ps,R as bs,G as ys,H as gs}from"./NewChatComposer-D2Ah4T-W.js";import{p as xs,a as ne}from"./api-Co9aQ2Jw.js";import{c as js}from"./clipboard-e3fSpeo7.js";import{u as ks}from"./sse-B29iGBnw.js";import{b as Fe}from"./status-tone-BM_zuRy1.js";import{t as $e,b as We,n as X}from"./time-Dhsh_2EG.js";import{u as Ve}from"./Provider-D0bB7q6y.js";import{o as Oe}from"./openContent-C6XO6kr5.js";import{g as vs,b as oe,h as Ye,d as ws,i as Ns,j as Ss,k as Rs,l as As}from"./broker-display-Q75fupqG.js";import{BrokerMetadataPanel as Cs}from"./BrokerMetadataPanel-BJSwU9XZ.js";import{DispatchAftermath as Is}from"./DispatchAftermath-ZCEB75hh.js";import{i as $s,c as Ds,n as _e}from"./keyboard-nav-B8sQ_8IF.js";import{ShikiPane as Es}from"./ShikiPane-C0TuCATU.js";import{d as Fs}from"./types-B0PlfpKc.js";import{u as Ms}from"./useEmbedHeadline-DuUnwTB7.js";/* empty css */import{L as xe}from"./loader-circle-DmUG_YC7.js";import{R as Ts}from"./refresh-cw-Bkh7Cvnd.js";import{X as De}from"./x-DgmmnPKt.js";import{A as Ls}from"./arrow-down-BAGkhHA6.js";import{E as Ue}from"./external-link-BvX5PfLh.js";import{C as Ps}from"./chevron-down-D120PY4g.js";import{S as Bs}from"./sparkles-D0vWLTyC.js";import{P as zs}from"./paperclip-Br7wUDFl.js";import{P as qs}from"./plus-BWKhylds.js";import{S as Os}from"./send-horizontal-CS7mxVhX.js";import{A as Ke}from"./arrow-right-DTX42clh.js";import{C as _s}from"./check-Dz2SRHft.js";import{C as Us}from"./copy-BzdzWsQd.js";import{M as Ks}from"./message-square-BLiFqpe_.js";import{c as Xe}from"./createLucideIcon-Dv8H8m7J.js";import{R as Hs}from"./radio-CxIXS1nU.js";import{M as Js,b as Gs}from"./DocumentFocusViewer-D8iB6SMt.js";import{B as Qs}from"./bot-WxKXYtEX.js";const Ws=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],Vs=Xe("at-sign",Ws);const Ys=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Xs=Xe("hash",Ys),Zs=160;function Ce(s){const t=new URLSearchParams({limit:String(Zs)});return s&&t.set("cursor",s),`/api/broker?${t.toString()}`}const He={index:-1,request:0};function er(s,t){return{index:t,request:s.request+1}}function Ze(s,t){return t===s.index?s:{index:t,request:s.request}}function sr(s,t){return s.index<t?s:Ze(s,t>0?t-1:-1)}function rr(s,t){return s.request!==t}function tr({enabled:s,rowCount:t,onActivateRow:n,onClearSelection:o}){const[u,h]=a.useState(He),b=u.index,m=a.useRef(new Map),k=a.useRef(He.request),c=a.useCallback(y=>{h(f=>er(f,typeof y=="function"?y(f.index):y))},[]),N=a.useCallback(y=>{h(f=>Ze(f,typeof y=="function"?y(f.index):y))},[]);a.useEffect(()=>{if(!rr(u,k.current)||(k.current=u.request,u.index<0))return;const y=m.current.get(u.index);y?.scrollIntoView({block:"nearest"}),y?.focus()},[u]),a.useEffect(()=>{h(y=>sr(y,t))},[t]);const R=a.useCallback((y,f)=>{f?m.current.set(y,f):m.current.delete(y)},[]);a.useEffect(()=>{if(!s)return;const y=f=>{if(document.querySelector(".sys-broker-page")&&!($s(f.target)||Ds())&&t!==0){if(f.key==="Escape"){o&&(f.preventDefault(),o(),N(-1));return}if(f.key==="ArrowDown"||f.key==="j"){f.preventDefault(),c(S=>_e(S,t,1));return}if(f.key==="ArrowUp"||f.key==="k"){f.preventDefault(),c(S=>_e(S,t,-1));return}if(f.key==="Home"||f.key==="g"&&!f.shiftKey){f.preventDefault(),c(0);return}if(f.key==="End"||f.key==="G"){f.preventDefault(),c(t-1);return}if(f.key==="Enter"||f.key===" "){const S=b<0?0:b;f.preventDefault(),c(S),n(S)}}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[s,b,c,n,o,t,N]);const q=a.useCallback(y=>({tabIndex:b===y?0:-1,ref:f=>R(y,f),onFocus:()=>N(y)}),[b,R,N]);return{focusedIndex:b,setFocusedIndex:N,getRowFocusProps:q}}const ye=["all","delivered","failed"],ar=3e4,nr={all:"All",delivered:"Delivered",failed:"Failed"};function or(s){switch(s){case"success":return"Success";case"failed_query":return"Query failure";case"failed_delivery":return"Delivery failure";default:return"Delivery attempt"}}function es(s){return s.messageId??s.deliveryId??s.invocationId??s.id}function ss(s){switch(Fe(s.kind,s.status)){case"success":return"Delivered";case"danger":return"Failed";case"working":return"Pending";case"warning":return"Held";default:return s.status?s.status.charAt(0).toUpperCase()+s.status.slice(1):"Queued"}}function ve(s){if(!s)return"··";const t=s.trim().split(/\s+/).filter(Boolean);if(t.length===0)return"··";const n=t[t.length-1];return/^\d+$/.test(n)?n.slice(-2):t.length>=2?(t[0][0]+t[1][0]).toUpperCase():s.trim().slice(0,2).toUpperCase()}function ir(s){const t=X(s)??0;return new Date(t).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Je(s){const t=X(s);return t===null?"—":new Date(t).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Ne(s,t,n=0){if(!s||typeof s!="object"||Array.isArray(s)||n>3)return;const o=s;for(const u of t)if(o[u]!==void 0&&o[u]!==null)return o[u];for(const u of Object.values(o)){const h=Ne(u,t,n+1);if(h!==void 0)return h}}function U(s,...t){const n=Ne(s.metadata,t);return typeof n!="string"&&typeof n!="number"?null:String(n).trim()||null}function we(s,...t){const n=Ne(s.metadata,t);return typeof n=="number"||typeof n=="string"?X(n):null}function rs(s){switch(s){case"dm":return"Direct · agent";case"channel":return"Channel";case"broadcast":return"Broadcast";case null:return"No route";default:return s.replaceAll("_"," ")}}function Ee(s,t){if(t==="to")return s.route==="channel"?"Channel":s.route==="broadcast"?"Broadcast":s.target?.toLowerCase().includes("operator")?"Operator":"Agent lane";const n=U(s,"class","actorClass")?.toLowerCase();return n==="operator"||n==="human"?"Operator":n==="agent"?"Agent":s.actorName?.toLowerCase().includes("operator")?"Operator":"Sender"}function lr(s){const t=Ne(s.metadata,["latencyMs","durationMs"]);if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t<1e3?`${Math.round(t)}ms`:`${(t/1e3).toFixed(t<1e4?1:0)}s`;const n=we(s,"sentAt","createdAt")??X(s.ts),o=we(s,"deliveredAt","completedAt");if(n===null||o===null||o<n)return"—";const u=o-n;return u<1e3?`${u}ms`:`${(u/1e3).toFixed(u<1e4?1:0)}s`}function Me({route:s}){switch(s){case"channel":return e.jsx(Xs,{size:12,"aria-hidden":"true"});case"broadcast":return e.jsx(Hs,{size:12,"aria-hidden":"true"});case"dm":return e.jsx(Vs,{size:12,"aria-hidden":"true"});default:return e.jsx(Ks,{size:12,"aria-hidden":"true"})}}function cr(s,t){if(!t)return null;const n=t.trim().replace(/^@/,"").toLowerCase();return s.find(o=>[o.id,o.name,o.handle,o.selector,o.defaultSelector,o.conversationId,o.harnessSessionId].some(u=>u?.trim().replace(/^@/,"").toLowerCase()===n))??null}function Ge(s,t,n){const o=n==="from"?s.actorName:s.target,u=cr(t,o),h=u?.name??o??(n==="from"?"Unknown":"No target"),b=u?"Agent":n==="to"&&s.conversationId?"Session route":Ee(s,n);return{label:h,kind:b,agent:u}}function dr(s,t,n){const o=n.agent??t.agent;return[{label:"From",value:t.kind},{label:"To",value:n.kind},{label:"Target",value:s.target??n.label},{label:"Channel",value:rs(s.route)},{label:"Project",value:o?.project??U(s,"project","projectName")},{label:"Branch",value:o?.branch??U(s,"branch")},{label:"Runtime",value:o?[o.harness,o.model,o.reasoningEffort].filter(Boolean).join(" · ")||null:[U(s,"harness"),U(s,"model")].filter(Boolean).join(" · ")||null},{label:"Machine",value:o?.authorityNodeName??o?.homeNodeName??o?.authorityNodeId??o?.homeNodeId??U(s,"machine","machineName","nodeName")}].filter(u=>!!u.value)}function Qe({party:s,route:t,side:n}){return e.jsxs("span",{className:`sys-broker-route-end sys-broker-route-end--${n}`,children:[e.jsx("span",{className:"sys-broker-avatar sys-broker-endpoint-avatar","aria-hidden":"true",children:s.agent||n==="from"?ve(s.label):e.jsx(Me,{route:t})}),e.jsx("span",{className:"sys-broker-endpoint-name",title:s.label,children:s.label})]})}function ur({attempt:s,agents:t}){const n=Ge(s,t,"from"),o=Ge(s,t,"to"),u=dr(s,n,o),h=`dispatch-route-${s.id}`;return e.jsxs("span",{className:"sys-broker-route",tabIndex:0,"aria-describedby":h,children:[e.jsx(Qe,{party:n,route:s.route,side:"from"}),e.jsx(Ke,{className:"sys-broker-route-arrow",size:11,"aria-hidden":"true"}),e.jsx(Qe,{party:o,route:s.route,side:"to"}),e.jsxs("span",{className:"sys-broker-endpoint-card",id:h,role:"tooltip",children:[e.jsx("span",{className:"sys-broker-endpoint-card-head",children:e.jsxs("span",{className:"sys-broker-endpoint-card-edge",children:[e.jsx("span",{className:"sys-broker-avatar sys-broker-endpoint-avatar","aria-hidden":"true",children:ve(n.label)}),e.jsx("strong",{children:n.label}),e.jsx(Ke,{className:"sys-broker-route-arrow",size:11,"aria-hidden":"true"}),e.jsx("span",{className:"sys-broker-avatar sys-broker-endpoint-avatar","aria-hidden":"true",children:o.agent?ve(o.label):e.jsx(Me,{route:s.route})}),e.jsx("strong",{children:o.label})]})}),e.jsx("span",{className:"sys-broker-endpoint-card-body",children:u.map(b=>e.jsxs("span",{className:"sys-broker-endpoint-card-field",children:[e.jsx("small",{children:b.label}),e.jsx("code",{title:b.value,children:b.value})]},b.label))})]})]})}function ge(s){const t=X(s)??0,n=new Date(t);return`${n.getFullYear()}-${n.getMonth()}-${n.getDate()}`}function hr(s,t=Date.now()){const n=X(s)??0,o=new Date(n),u=new Date(t),h=new Date(t);return h.setDate(h.getDate()-1),ge(s)===ge(u.getTime())?"Today":ge(s)===ge(h.getTime())?"Yesterday":o.toLocaleDateString(void 0,{month:"short",day:"numeric",year:o.getFullYear()===u.getFullYear()?void 0:"numeric"})}function fr(s,t,n){return{...t,source:s.source,attempts:[...s.attempts,...t.attempts],failedQueries:s.failedQueries,failedDeliveries:s.failedDeliveries,dialogue:s.dialogue,ledger:{...t.ledger,cursors:{...s.ledger.cursors,[n]:t.ledger.cursors[n]},hasMore:{...s.ledger.hasMore,[n]:t.ledger.hasMore[n]}}}}function mr({navigate:s,embedded:t=!1,initialAttemptId:n}){Ms("Dispatch",t);const{route:o,agents:u,selectedBrokerAttempt:h,inspectBrokerAttempt:b,clearBrokerAttempt:m}=Ve(),[k]=a.useState(()=>xs(Ce(),ar)),[c,N]=a.useState(k),R=o.view==="broker"?o.filter??"all":"all",[q,y]=a.useState(k===null),[f,S]=a.useState(!1),[K,le]=a.useState(!1),[Q,F]=a.useState(null),W=a.useRef(k),C=a.useRef(0),M=a.useRef(null),T=a.useCallback(async(i="initial")=>{const d=++C.current;!W.current&&i!=="background"?(y(!0),F(null)):S(!0);try{const j=await ne(Ce());if(d!==C.current)return;W.current=j,N(j),F(null)}catch(j){if(d!==C.current)return;F(j instanceof Error?j.message:String(j))}finally{d===C.current&&(y(!1),S(!1))}},[]),ce=a.useCallback(async()=>{const i=W.current;if(!i||K)return;const d="attempts",j=i.ledger.cursors[d];if(!j||!i.ledger.hasMore[d])return;const B=++C.current;le(!0),F(null);try{const z=await ne(Ce(j));if(B!==C.current)return;const ue=W.current,he=ue?fr(ue,z,d):z;W.current=he,N(he)}catch(z){if(B!==C.current)return;F(z instanceof Error?z.message:String(z))}finally{B===C.current&&le(!1)}},[K]),H=a.useCallback(()=>{M.current||(M.current=setTimeout(()=>{M.current=null,T("background")},250))},[T]);a.useEffect(()=>(T("initial"),()=>{M.current&&clearTimeout(M.current)}),[T]),ks(i=>{(i.kind==="message.posted"||i.kind==="delivery.planned"||i.kind==="delivery.attempted"||i.kind==="delivery.state.changed"||i.kind==="scout.dispatched")&&H()});const v=a.useMemo(()=>{if(!c)return[];const i=new Map(c.dialogue.map(d=>[d.id,d.body]));return vs(c.attempts).map(d=>{const j=d.messageId?i.get(d.messageId):null;return j&&j!==d.detail?{...d,detail:j}:d})},[c]),L=a.useMemo(()=>{switch(R){case"delivered":return v.filter(i=>!oe(i));case"failed":return v.filter(oe);default:return v}},[R,v]),Z=c?.ledger.hasMore.attempts??!1,ae=a.useMemo(()=>({all:v.length,delivered:v.filter(i=>!oe(i)).length,failed:v.filter(oe).length}),[v]),$=a.useMemo(()=>{const i=o.view==="broker"?o.attemptId:void 0;return!c||!i?null:v.find(d=>d.id===i)??c.attempts.find(d=>d.id===i)??c.failedQueries.find(d=>d.id===i)??c.failedDeliveries.find(d=>d.id===i)??null},[c,v,o]),D=$?`${$.id}\0${$.status}\0${$.ts}`:null,ee=h?`${h.id}\0${h.status}\0${h.ts}`:null;a.useEffect(()=>{$&&D!==ee&&b($)},[ee,b,$,D]);const[x,O]=a.useState(null),P=a.useRef(!1),J=a.useCallback(i=>{if(t){P.current=!0,O(i);return}b(i)},[t,b]),G=a.useCallback(()=>{if(t){P.current=!0,O(null);return}m()},[m,t]),de=a.useCallback(i=>{const d=L[i];d&&(J(d),window.dispatchEvent(new CustomEvent("scout:set-inspector-width",{detail:{width:520}})))},[L,J]),{getRowFocusProps:Se,setFocusedIndex:je}=tr({enabled:!!c&&L.length>0,rowCount:L.length,onActivateRow:de,onClearSelection:G}),E=x?.id??null,se=x?`${x.id} ${x.status} ${x.ts}`:null;a.useEffect(()=>{if(!t||!E)return;const i=v.find(d=>d.id===E);i&&`${i.id} ${i.status} ${i.ts}`!==se&&O(i)},[t,E,se,v]),a.useEffect(()=>{if(!t||!n||!c||P.current||x)return;const i=v.find(d=>d.id===n)??c.attempts.find(d=>d.id===n)??c.failedQueries.find(d=>d.id===n)??c.failedDeliveries.find(d=>d.id===n);i&&(P.current=!0,O(i))},[c,t,x,v,n]),a.useEffect(()=>{const i=o.view==="broker"?o.attemptId:void 0;if(!i)return;const d=L.findIndex(j=>j.id===i);d>=0&&je(d)},[L,R,o,je]);const A=a.useCallback(i=>{const j=(ye.indexOf(R)+i+ye.length)%ye.length,B=ye[j];s({view:"broker",...B==="all"?{}:{filter:B}})},[R,s]),I=t?x:null;return e.jsx("div",{className:`s-ops${t?" s-ops--embedded":""}${I?" s-ops--split":""}`,children:e.jsxs("div",{className:"s-ops-body",children:[e.jsxs("div",{className:"sys-surface-page sys-surface-page-wide sys-surface-page-fluid sys-broker-page",children:[e.jsxs("div",{className:"sys-ledger-toolbar","aria-label":"Dispatch controls",children:[c?e.jsx("div",{className:"sys-tab-row sys-tab-row--toolbar",role:"tablist","aria-label":"Dispatch message filters",onKeyDown:i=>{i.key==="ArrowRight"?(i.preventDefault(),A(1)):i.key==="ArrowLeft"&&(i.preventDefault(),A(-1))},children:ye.map(i=>e.jsxs("button",{type:"button",role:"tab","aria-selected":R===i,className:`sys-tab${R===i?" sys-tab-active":""}`,onClick:()=>s({view:"broker",...i==="all"?{}:{filter:i}}),children:[e.jsx("span",{children:nr[i]}),e.jsx("span",{className:"sys-tab-count",children:ae[i]})]},i))}):e.jsx("div",{className:"sys-ledger-kicker",children:"Dispatch ledger"}),e.jsxs("div",{className:"sys-page-actions sys-ledger-actions",children:[e.jsx("div",{className:"sys-sync-note",children:q?"Loading dispatch ledger...":c?`Updated ${$e(c.generatedAt)}${c.source?.latestMessageAt?` · latest message ${$e(c.source.latestMessageAt)}`:""}`:"Waiting for dispatch data"}),e.jsx("button",{type:"button",className:"s-btn",disabled:q||f,onClick:()=>{T("manual")},children:f?"Refreshing...":"Refresh"})]})]}),Q&&e.jsxs("div",{className:"sys-banner sys-banner-warning",children:[e.jsx("strong",{children:"Refresh failed."}),e.jsx("span",{children:Q})]}),f&&c&&e.jsxs("div",{className:"sys-broker-source-note",role:"status","aria-live":"polite",children:[e.jsx(xe,{className:"sys-broker-source-spinner",size:12,"aria-hidden":"true"}),e.jsx("strong",{children:"Updating dispatches…"})]}),!f&&c?.source?.mode==="sqlite_projection"&&c.source.status==="degraded"&&c.source.detail&&e.jsxs("div",{className:"sys-broker-source-note sys-broker-source-note--warning",role:"status","aria-label":c.source.detail,title:c.source.detail,children:[e.jsx("span",{className:"sys-broker-source-dot","aria-hidden":"true"}),e.jsx("strong",{children:c.source.brokerReachable?"Dispatch history is loading":"Dispatch may be out of date"}),e.jsx("span",{children:c.source.brokerReachable?"Broker online; showing saved dispatch history while live messages load.":"Live broker unavailable; showing saved dispatch history."})]}),q&&!c&&e.jsx("div",{className:"sys-broker-empty-wrap",children:e.jsx(Ie,{className:"sys-state-card-centered",icon:e.jsx(xe,{className:"sys-broker-source-spinner",size:24,"aria-hidden":"true"}),title:"Loading dispatch",body:"Reading the dispatch database snapshot."})}),!q&&!c&&!Q&&e.jsx("div",{className:"sys-broker-empty-wrap",children:e.jsx(Ie,{className:"sys-state-card-centered",title:"No dispatch data",body:"No dispatch rows are available yet."})}),c&&e.jsxs(e.Fragment,{children:[e.jsx(pr,{attempts:L,agents:u,selectedAttemptId:t?x?.id??null:h?.id??(o.view==="broker"?o.attemptId??null:null),onInspect:J,getRowFocusProps:Se}),L.length>0&&Z&&e.jsx("div",{className:"sys-ledger-footer",children:e.jsx("button",{type:"button",className:"s-btn",disabled:K,onClick:()=>{ce()},children:K?"Loading older...":"Load older"})})]})]}),I&&e.jsx("div",{className:"s-broker-embed-detail",children:e.jsx(ts,{attempt:I,navigate:s,onClose:G})})]})})}function pr({attempts:s,agents:t,selectedAttemptId:n,onInspect:o,getRowFocusProps:u}){if(s.length===0)return e.jsx("div",{className:"sys-broker-empty-wrap",children:e.jsx(Ie,{className:"sys-state-card-centered",title:"No dispatch rows",body:"No dispatch rows are available yet."})});const h=s.reduce((b,m,k)=>{const c=ge(m.ts),N=b[b.length-1];return N?.key===c?N.attempts.push({attempt:m,index:k}):b.push({key:c,label:hr(m.ts),attempts:[{attempt:m,index:k}]}),b},[]);return e.jsxs("div",{className:"sys-broker-wire","aria-label":"Dispatch ledger",children:[e.jsxs("div",{className:"sys-broker-wire-head","aria-hidden":"true",children:[e.jsx("span",{className:"sys-broker-col sys-broker-col--route",children:"Route"}),e.jsx("span",{className:"sys-broker-col sys-broker-col--msg",children:"Message"}),e.jsx("span",{className:"sys-broker-col sys-broker-col--time",children:"Time"})]}),h.map(b=>e.jsxs("section",{className:"sys-broker-day","aria-labelledby":`dispatch-day-${b.key}`,children:[e.jsxs("header",{className:"sys-broker-day-head",children:[e.jsx("h2",{id:`dispatch-day-${b.key}`,children:b.label}),e.jsxs("span",{children:[b.attempts.length," ",b.attempts.length===1?"dispatch":"dispatches"]})]}),e.jsx("div",{className:"sys-broker-wire-body",role:"list",children:b.attempts.map(({attempt:m,index:k})=>{const c=Fe(m.kind,m.status),N=oe(m),R=!N&&(c==="working"||c==="warning"),q=Ye(m),y=ss(m),f=N?q:R?y:null,S=()=>{o(m),window.dispatchEvent(new CustomEvent("scout:set-inspector-width",{detail:{width:520}}))};return e.jsxs("div",{role:"listitem",className:`sys-broker-wire-row${N?" sys-broker-wire-row--failure":R?" sys-broker-wire-row--pending":""}${n===m.id?" sys-broker-wire-row--selected":""}`,"aria-label":`${y}. Inspect ${m.detail}`,onClick:S,...u(k),children:[e.jsx("div",{className:"sys-broker-cell sys-broker-col--route",children:e.jsx(ur,{attempt:m,agents:t})}),e.jsxs("div",{className:"sys-broker-cell sys-broker-col--msg",children:[e.jsx("span",{className:"sys-broker-msg",title:m.detail,children:m.detail}),f&&e.jsx("span",{className:`sys-broker-msg-error sys-broker-msg-error--${N?"danger":"warning"}`,title:f,children:f})]}),e.jsx("div",{className:"sys-broker-cell sys-broker-col--time",children:e.jsx("time",{className:"sys-broker-time-abs",title:`${$e(m.ts)} · ${We(m.ts)}`,children:ir(m.ts)})})]},m.id)})})]},b.key))]})}function br(s){const t=es(s);return[{label:"Kind",value:or(s.kind)},{label:"Time",value:We(s.ts)},{label:"Actor",value:s.actorName},{label:"Target",value:s.target},{label:"Route",value:s.route},{label:"Conversation",value:s.conversationId},{label:"Reference",value:t},{label:"Message",value:s.messageId===t?null:s.messageId},{label:"Delivery",value:s.deliveryId===t?null:s.deliveryId},{label:"Invocation",value:s.invocationId===t?null:s.invocationId}].filter(n=>!!n.value)}function ie({value:s,subject:t,className:n}){const[o,u]=a.useState("idle"),h=a.useRef(null);a.useEffect(()=>{u("idle")},[s]),a.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const b=a.useCallback(async()=>{const c=await js(s);h.current&&clearTimeout(h.current),u(c?"copied":"failed"),h.current=setTimeout(()=>{u("idle"),h.current=null},1500)},[s]),m=o==="copied",k=o==="failed";return e.jsx("button",{type:"button",className:`sys-copy-btn${n?` ${n}`:""}${m?" sys-copy-btn--copied":""}${k?" sys-copy-btn--failed":""}`,onClick:()=>{b()},title:m?`Copied ${t}`:k?"Copy failed":`Copy ${t}`,"aria-label":m?`Copied ${t}`:k?`Copy ${t} failed`:`Copy ${t}`,children:m?e.jsx(_s,{size:14,"aria-hidden":"true"}):e.jsx(Us,{size:14,"aria-hidden":"true"})})}function yr(s){const t=s.trim();if(t.startsWith("{")||t.startsWith("["))try{return{code:JSON.stringify(JSON.parse(t),null,2),path:"payload.json",language:"JSON"}}catch{}return{code:s,path:"payload.md",language:"Text · Markdown"}}function gr({payload:s}){const t=a.useMemo(()=>yr(s),[s]),[n,o]=a.useState(!1),u=a.useRef(null),h=t.code.split(`
2
+ `).length;a.useEffect(()=>{const m=u.current;!m||!n||m.open||m.showModal()},[n]),a.useEffect(()=>{o(!1)},[s]);const b=e.jsx("div",{className:"sys-broker-payload-code","data-language":t.path==="payload.json"?"json":"markdown",role:"region","aria-label":`Dispatch payload, ${t.language}`,tabIndex:0,children:e.jsx(Es,{code:t.code,path:t.path})});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sys-broker-payload-head",children:[e.jsx("span",{className:"sys-detail-label",children:"Payload"}),e.jsxs("span",{className:"sys-broker-payload-meta",children:[t.language," · ",h," ",h===1?"line":"lines"]}),e.jsx(ie,{value:s,subject:"payload"}),e.jsx("button",{type:"button",className:"sys-copy-btn sys-broker-payload-expand",onClick:()=>o(!0),title:"Expand payload","aria-label":"Expand payload",children:e.jsx(Js,{size:14,"aria-hidden":"true"})})]}),e.jsx("div",{className:"sys-broker-payload-resizer",children:b}),n&&us.createPortal(e.jsxs("dialog",{ref:u,className:"sys-broker-payload-dialog","aria-label":"Expanded dispatch payload",onCancel:m=>{m.preventDefault(),o(!1)},onClose:()=>o(!1),children:[e.jsxs("header",{className:"sys-broker-payload-dialog-head",children:[e.jsxs("div",{children:[e.jsx("span",{className:"sys-detail-label",children:"Dispatch payload"}),e.jsxs("span",{className:"sys-broker-payload-meta",children:[t.language," · ",h," ",h===1?"line":"lines"]})]}),e.jsx(ie,{value:s,subject:"payload"}),e.jsx("button",{type:"button",className:"sys-copy-btn",onClick:()=>o(!1),title:"Return payload to inspector","aria-label":"Return payload to inspector",children:e.jsx(Gs,{size:14,"aria-hidden":"true"})})]}),e.jsx("div",{className:"sys-broker-payload-dialog-body",children:b})]}),document.body)]})}function xr({attempt:s}){const t=As(s);return e.jsxs("div",{className:"sys-broker-route-failure",role:"status",children:[e.jsx("span",{className:"sys-broker-route-failure-mark","aria-hidden":"true",children:e.jsx(De,{size:14})}),e.jsxs("div",{children:[e.jsx("span",{className:"sys-detail-label",children:"Routing stopped"}),e.jsx("strong",{children:t}),e.jsx("p",{children:s.detail})]}),e.jsx(ie,{value:s.detail,subject:"failure detail"})]})}function ts({attempt:s,navigate:t,onClose:n}){const{route:o,agents:u,scoutbotAgentId:h}=Ve(),b=br(s),m=ws(s.metadata),k=oe(s),c=s.kind==="failed_query",N=Ye(s),R=Fe(s.kind,s.status),q=we(s,"sentAt","createdAt")??X(s.ts),y=we(s,"deliveredAt","completedAt")??X(s.ts),f=es(s),[S,K]=a.useState("idle"),[le,Q]=a.useState(null),[F,W]=a.useState(null),[C,M]=a.useState(""),[T,ce]=a.useState(""),[H,v]=a.useState("idle"),[L,Z]=a.useState(null),[ae,$]=a.useState(""),[D,ee]=a.useState(""),[x,O]=a.useState(""),[P,J]=a.useState(""),[G,de]=a.useState("medium"),[Se,je]=a.useState(null),[E,se]=a.useState([]),[A,I]=a.useState("idle"),[i,d]=a.useState(null),j=U(s,"harness"),B=U(s,"model"),z=U(s,"reasoningEffort","effort"),ue=a.useRef(null),he=a.useRef(null),Re=a.useMemo(()=>Ns(s),[s]),w=a.useMemo(()=>u.filter(r=>!r.retiredFromFleet&&!r.staleLocalRegistration).slice().sort((r,l)=>r.id===h?-1:l.id===h?1:(l.updatedAt??0)-(r.updatedAt??0)||r.name.localeCompare(l.name)),[u,h]),fe=a.useMemo(()=>Ss(s,w)?.id??"",[s,w]),me=w.some(r=>r.id===h)?h:w[0]?.id??"",ke=w[0]?.id??"",re=w.find(r=>r.id===me)??null,as=a.useMemo(()=>{const r=new Map;for(const l of w){const p=l.projectRoot?.trim()||l.cwd?.trim();if(!p)continue;const g=p.split("/").filter(Boolean).at(-1)??p;r.set(p,l.project?.trim()||g)}return[...r.entries()].map(([l,p])=>({path:l,label:p}))},[w]),Te=a.useRef({originalTargetAgentId:fe,firstRoutableAgentId:ke,defaultForwardAgentId:me,defaultForwardAgent:re,effort:"medium"});Te.current={originalTargetAgentId:fe,firstRoutableAgentId:ke,defaultForwardAgentId:me,defaultForwardAgent:re,effort:U(s,"reasoningEffort","effort")||"medium"};const pe=a.useRef(!1);a.useEffect(()=>{const r=Te.current;pe.current=!1,K("idle"),Q(null),W(null),M(""),ce(r.originalTargetAgentId||r.firstRoutableAgentId),v("idle"),Z(null),$(r.defaultForwardAgentId),ee(r.defaultForwardAgent?.projectRoot?.trim()||r.defaultForwardAgent?.cwd?.trim()||""),O(r.defaultForwardAgent?.harness?.trim()||""),J(r.defaultForwardAgent?.model?.trim()||""),de(r.effort),se([]),I("idle"),d(null)},[s.id]),a.useEffect(()=>{pe.current||(ce(r=>r||fe||ke),$(r=>r||me),ee(r=>r||re?.projectRoot?.trim()||re?.cwd?.trim()||""),O(r=>r||re?.harness?.trim()||""),J(r=>r||re?.model?.trim()||""))},[re,me,ke,fe]),a.useEffect(()=>{const r=new URLSearchParams({scope:"global+project"});D&&r.set("projectRoot",D);let l=!1;return ne(`/api/runner/options?${r.toString()}`).then(p=>{!l&&p.schemaVersion==="openscout.runtime-capabilities.v1"&&je(p)}).catch(()=>{}),()=>{l=!0}},[D]);const ns=a.useCallback(r=>{M(r),window.requestAnimationFrame(()=>ue.current?.focus())},[]),os=a.useCallback(async()=>{const r=w.find(l=>l.id===T);if(!(!r||H==="sending")){v("sending"),Z(null);try{const l=await ne("/api/ask",{method:"POST",body:JSON.stringify({body:s.detail,targetAgentId:r.id,targetLabel:r.name,...j||B||z?{execution:{...j?{harness:j}:{},...B?{model:B}:{},...z?{reasoningEffort:z}:{},session:"new"}}:{},metadata:{source:"scout-dispatch-redispatch",originalDispatchId:s.id,...s.messageId?{originalMessageId:s.messageId}:{},...s.conversationId?{originalConversationId:s.conversationId}:{}}})}),p=l.flightId??l.flight?.id;v("sent"),Z(`New dispatch sent to ${r.name}${p?` · ${p}`:""}`)}catch(l){v("failed"),Z(`Retry failed. ${l instanceof Error?l.message:String(l)}`)}}},[s,T,H,z,j,B,w]),Le=a.useCallback(async()=>{const r=C.trim(),l=w.find(p=>p.id===ae);if(!(!r||!l||A==="sending")){I("sending"),d(E.length>0?`Uploading ${E.length} ${E.length===1?"attachment":"attachments"}…`:null);try{const p=E.length>0?await fs(E):[],g=await ne("/api/ask",{method:"POST",body:JSON.stringify({body:`${r}
3
+
4
+ Attached dispatch context:
5
+ ${Re}`,targetAgentId:l.id,targetLabel:l.name,...p.length>0?{attachments:p}:{},execution:{...x?{harness:x}:{},...P?{model:P}:{},...G?{reasoningEffort:G}:{}},metadata:{source:"scout-dispatch-forward",originalDispatchId:s.id,...D?{targetProjectPath:D}:{},...s.messageId?{originalMessageId:s.messageId}:{},...s.conversationId?{originalConversationId:s.conversationId}:{}}})}),V=g.flightId??g.flight?.id;I("sent"),d(`Request sent to ${l.name}${V?` · ${V}`:""}`),M(""),se([])}catch(p){I("failed"),d(`Request wasn't sent. ${p instanceof Error?p.message:String(p)}`)}}},[s,Re,ae,G,E,x,P,D,A,C,w]),is=a.useCallback(r=>{const l=r.filter(ms),p=r.length-l.length;l.length>0&&(se(g=>[...g,...l]),I("idle"),d(null)),p>0&&(I("failed"),d("Attach markdown, code, an image, or a video clip."))},[]),ls=k?["Get a second opinion","Propose a recovery plan","Draft a follow-up"]:["Summarize this dispatch","Draft a follow-up","What changed?"],_=w.find(r=>r.id===T)??null,te=w.find(r=>r.id===ae)??null,be=w.filter(r=>D?(r.projectRoot?.trim()||r.cwd?.trim())===D:!0),Pe=Se??bs,Ae=a.useMemo(()=>{const r=ps(Pe),l=[P,te?.harness===x?te.model:null,...be.filter(g=>g.harness===x).map(g=>g.model)].map(g=>g?.trim()).filter(g=>!!g);let p=r.harnesses;return p.some(g=>g.value===x)||(p=[{value:x,label:x||"default",models:[]},...p]),p=p.map(g=>{if(g.value!==x)return g;const V=g.models.some(Y=>Y.value==="")?g.models:[{value:"",label:"Default",note:"harness picks"},...g.models],ds=new Set(V.map(Y=>Y.value)),qe=l.filter(Y=>!ds.has(Y)).map(Y=>({value:Y,label:Y,note:"observed"}));return qe.length===0&&V===g.models?g:{...g,models:[...V,...qe]}}),{...r,harnesses:p}},[Pe,te,x,P,be]);a.useEffect(()=>{const r=ys(Ae,x);!r||r.some(l=>l.value===G)||de(r.find(l=>l.value==="medium")?.value??r[0]?.value??"")},[Ae,x,G]);const cs=a.useCallback(async()=>{K("running"),Q(null);try{const r=await ne("/api/broker/dispatch-review",{method:"POST",body:JSON.stringify(Rs(s))});K("sent"),W(r.conversationId),Q(r.conversationId?`Report started${r.targetLabel?` with ${r.targetLabel}`:""}. Open the conversation to follow it.`:`Report started${r.targetLabel?` with ${r.targetLabel}`:""}${r.flightId?` · ${r.flightId}`:""}.`)}catch(r){K("failed"),Q(`Couldn't start the report. ${r instanceof Error?r.message:String(r)}`)}},[s]),Be=k?e.jsxs("div",{className:"sys-broker-action-row",children:[e.jsxs("div",{className:"sys-broker-action-line",children:[e.jsx("span",{className:"sys-broker-action-label",id:"dispatch-report-title",children:"Failure report"}),e.jsxs("button",{type:"button",className:"sys-broker-report-button",disabled:S==="running"||S==="sent"&&!F,onClick:()=>{if(F){Oe(t,{view:"conversation",conversationId:F},{returnTo:o});return}cs()},children:[S==="running"?e.jsx(xe,{size:13,className:"sys-broker-action-spinner","aria-hidden":"true"}):F?e.jsx(Ue,{size:13,"aria-hidden":"true"}):e.jsx(Qs,{size:13,"aria-hidden":"true"}),S==="running"?"Starting report…":F?"Open report conversation":"Start failure report"]})]}),le&&e.jsx("div",{className:`sys-broker-review-status sys-broker-review-status--${S}`,role:"status",children:le})]}):null,ze=e.jsxs("div",{className:"sys-broker-action-row",children:[e.jsxs("div",{className:"sys-broker-action-line",children:[e.jsx("span",{className:"sys-broker-action-label",id:"dispatch-redispatch-title",children:"Retry"}),e.jsxs("div",{className:"sys-broker-redispatch-controls",children:[e.jsx("select",{"aria-label":"Retry destination",value:T,disabled:H==="sending"||w.length===0,onChange:r=>{ce(r.target.value),v("idle"),Z(null)},children:w.length===0?e.jsx("option",{value:"",children:"No agents available"}):e.jsxs(e.Fragment,{children:[!T&&e.jsx("option",{value:"",children:"Original destination unavailable"}),w.map(r=>e.jsxs("option",{value:r.id,children:[r.id===h?"Scout":r.name,r.project?` · ${r.project}`:""]},r.id))]})}),e.jsxs("button",{type:"button",className:"sys-broker-redispatch-send",disabled:!_||H==="sending",onClick:()=>{os()},children:[H==="sending"?e.jsx(xe,{size:13,className:"sys-broker-action-spinner","aria-hidden":"true"}):e.jsx(Ts,{size:13,"aria-hidden":"true"}),H==="sending"?"Retrying…":"Retry dispatch"]})]})]}),_&&e.jsxs("div",{className:"sys-broker-action-target-meta",children:[_.harness&&e.jsx("span",{children:_.harness}),_.model&&e.jsx("span",{children:_.model}),(_.cwd??_.projectRoot)&&e.jsx("code",{children:_.cwd??_.projectRoot})]}),L&&e.jsx("div",{className:`sys-broker-action-status sys-broker-action-status--${H}`,role:"status",children:L})]});return e.jsxs("aside",{className:"sys-panel sys-broker-inspector","aria-label":"Dispatch route inspector",children:[e.jsx("header",{className:"sys-broker-inspector-head",children:e.jsxs("div",{className:"sys-broker-inspector-status",children:[e.jsx("span",{className:`sys-broker-dot sys-broker-dot--${R}`,"aria-hidden":"true"}),e.jsx("strong",{className:`sys-broker-state sys-broker-state--${R}`,children:ss(s)}),e.jsx("code",{title:f,children:f}),e.jsx(ie,{value:Re,subject:"dispatch context",className:"sys-broker-inspector-copy"}),e.jsx("button",{type:"button",className:"sys-copy-btn sys-broker-inspector-close",onClick:n,title:"Close inspector","aria-label":"Close inspector",children:e.jsx(De,{size:14,"aria-hidden":"true"})})]})}),e.jsxs("div",{className:"sys-broker-inspector-body",children:[e.jsxs("section",{className:"sys-broker-route-stack","aria-label":"Dispatch route",children:[e.jsxs("div",{className:"sys-broker-route-party",children:[e.jsx("span",{className:"sys-broker-avatar sys-broker-route-avatar","aria-hidden":"true",children:ve(s.actorName)}),e.jsxs("div",{className:"sys-broker-route-party-copy",children:[e.jsxs("span",{className:"sys-detail-label",children:["From · ",Ee(s,"from")]}),e.jsx("strong",{children:s.actorName??"Unknown sender"})]})]}),e.jsx(Ls,{className:"sys-broker-route-down",size:17,"aria-hidden":"true"}),e.jsxs("div",{className:"sys-broker-route-party",children:[e.jsx("span",{className:"sys-broker-route-target-icon","aria-hidden":"true",children:e.jsx(Me,{route:s.route})}),e.jsxs("div",{className:"sys-broker-route-party-copy",children:[e.jsxs("span",{className:"sys-detail-label",children:["To · ",Ee(s,"to")]}),e.jsx("code",{title:s.target??"No target",children:s.target??"No target"})]}),s.conversationId&&e.jsxs("button",{type:"button",className:"sys-broker-route-button",onClick:()=>Oe(t,{view:"conversation",conversationId:s.conversationId},{returnTo:o}),children:[e.jsx(Ue,{size:11,"aria-hidden":"true"}),"Route"]})]})]}),e.jsxs("dl",{className:"sys-broker-delivery-grid",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Channel"}),e.jsx("dd",{children:rs(s.route)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Latency"}),e.jsx("dd",{className:"sys-broker-delivery-accent",children:lr(s)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Sent"}),e.jsx("dd",{children:Je(q)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:k?"Failed":"Delivered"}),e.jsx("dd",{children:Je(y)})]})]}),e.jsxs("section",{className:"sys-broker-payload",children:[c?e.jsx(xr,{attempt:s}):e.jsx(gr,{payload:s.detail}),k&&!c&&N&&e.jsxs("div",{className:"sys-broker-inspector-error",role:"status",children:[e.jsx("span",{className:"sys-broker-inspector-error-label",children:"Error"}),e.jsx("p",{children:N})]})]}),e.jsx(Is,{attempt:s,targetAgentId:fe||null,navigate:t,returnTo:o}),e.jsx("section",{className:"sys-broker-actions","aria-label":"Dispatch actions",children:c?e.jsxs(e.Fragment,{children:[Be,ze]}):e.jsxs(e.Fragment,{children:[ze,Be]})}),e.jsxs("details",{className:"sys-broker-technical",children:[e.jsxs("summary",{children:[e.jsx("span",{children:"Technical details"}),e.jsx(Ps,{size:13,"aria-hidden":"true"})]}),e.jsx("div",{className:"sys-broker-inspector-rows",children:b.map(r=>e.jsxs("div",{className:"sys-broker-inspector-row",children:[e.jsx("span",{className:"sys-detail-label",children:r.label}),e.jsx("code",{className:"sys-detail-value",children:r.value}),e.jsx(ie,{value:r.value,subject:r.label.toLowerCase()})]},r.label))}),e.jsxs("div",{className:"sys-broker-metadata",children:[e.jsxs("div",{className:"sys-broker-metadata-head",children:[e.jsx("span",{className:"sys-detail-label",children:"Metadata"}),e.jsx(ie,{value:m,subject:"metadata",className:"sys-broker-metadata-copy"})]}),e.jsx(Cs,{metadata:s.metadata,rawJson:m})]})]})]}),e.jsxs("section",{className:"sys-broker-forward","aria-labelledby":"dispatch-forward-title",children:[e.jsx("div",{className:"sys-broker-forward-head",children:e.jsx("span",{id:"dispatch-forward-title",className:"sys-broker-action-label",children:"Follow up"})}),e.jsxs("div",{id:"dispatch-forward-content",children:[e.jsx("div",{className:"sys-broker-forward-intro",children:e.jsx("div",{className:"sys-broker-ask-prompts","aria-label":"Suggested requests",children:ls.map(r=>e.jsxs("button",{type:"button",onClick:()=>ns(r),children:[e.jsx(Bs,{size:11,"aria-hidden":"true"}),r]},r))})}),e.jsxs("form",{className:"sys-broker-message-composer",onSubmit:r=>{r.preventDefault(),Le()},children:[e.jsx("label",{htmlFor:"dispatch-message-input",children:"Request"}),e.jsx("textarea",{ref:ue,id:"dispatch-message-input",value:C,rows:3,placeholder:`What should ${te?.id===h?"Scout":te?.name??"this agent"} investigate or do?`,disabled:A==="sending",onChange:r=>{M(r.target.value),A!=="idle"&&(I("idle"),d(null))},onKeyDown:r=>{r.key==="Enter"&&(r.metaKey||r.ctrlKey)&&(r.preventDefault(),Le())}}),E.length>0&&e.jsx("div",{className:"sys-broker-composer-attachments","aria-label":"Attachments",children:E.map((r,l)=>e.jsxs("span",{children:[e.jsx(zs,{size:10,"aria-hidden":"true"}),e.jsx("span",{title:r.name,children:r.name}),e.jsx("button",{type:"button",onClick:()=>se(p=>p.filter((g,V)=>V!==l)),"aria-label":`Remove ${r.name}`,children:e.jsx(De,{size:10,"aria-hidden":"true"})})]},`${r.name}:${r.size}:${l}`))}),e.jsxs("footer",{children:[e.jsxs("div",{className:"sys-broker-composer-left",children:[e.jsx("input",{ref:he,type:"file",multiple:!0,hidden:!0,disabled:A==="sending",onChange:r=>{is([...r.target.files??[]]),r.target.value=""}}),e.jsx("button",{type:"button",className:"sys-broker-composer-attach",disabled:A==="sending",onClick:()=>he.current?.click(),"aria-label":"Attach files",title:"Attach files",children:e.jsx(qs,{size:16,"aria-hidden":"true"})}),e.jsx("span",{className:"sys-broker-message-attachment",title:f,children:"Dispatch context included"})]}),e.jsxs("div",{className:"sys-broker-composer-targets",children:[e.jsx("span",{className:"sys-broker-composer-route-label",children:"Send to"}),e.jsxs("label",{title:"Project target",children:[e.jsx("span",{children:"Project"}),e.jsxs("select",{"aria-label":"Project target",value:D,disabled:A==="sending",onChange:r=>{const l=r.target.value,p=w.find(g=>!l||(g.projectRoot?.trim()||g.cwd?.trim())===l)??null;pe.current=!0,ee(l),p&&($(p.id),O(p.harness?.trim()||""),J(p.model?.trim()||""))},children:[e.jsx("option",{value:"",children:"Any project"}),as.map(r=>e.jsx("option",{value:r.path,children:r.label},r.path))]})]}),e.jsxs("label",{title:"Agent target",children:[e.jsx("span",{children:"Agent"}),e.jsx("select",{"aria-label":"Agent target",value:ae,disabled:A==="sending"||be.length===0,onChange:r=>{const l=w.find(p=>p.id===r.target.value)??null;pe.current=!0,$(r.target.value),l&&(ee(l.projectRoot?.trim()||l.cwd?.trim()||""),O(l.harness?.trim()||""),J(l.model?.trim()||"")),I("idle"),d(null)},children:be.length===0?e.jsx("option",{value:"",children:"No agents"}):be.map(r=>e.jsx("option",{value:r.id,children:r.id===h?"Scout":r.name},r.id))})]}),e.jsx(gs,{catalog:Ae,value:{harness:x,model:P,effort:G},onChange:r=>{pe.current=!0,O(r.harness),J(r.model),de(r.effort)},disabled:A==="sending"}),e.jsx(hs,{className:"sys-broker-composer-mic",disabled:A==="sending",onAppend:r=>M(l=>l.trim()?`${l.trimEnd()} ${r}`:r),onError:r=>{I("failed"),d(r)}})]}),e.jsx("button",{type:"submit",className:"sys-broker-composer-send",disabled:!C.trim()||!te||A==="sending","aria-label":`Ask ${te?.name??"recipient"} about this dispatch`,children:A==="sending"?e.jsx(xe,{size:14,className:"sys-broker-action-spinner","aria-hidden":"true"}):e.jsx(Os,{size:14,"aria-hidden":"true"})})]})]}),i&&e.jsx("div",{className:`sys-broker-action-status sys-broker-action-status--${A}`,role:"status",children:i})]})]})]})}const jr=Fs({id:"dispatch",label:"Dispatch",route:{view:"broker"},webPath:"/dispatch",screen:"BrokerScreen",embed:{path:"/embed/dispatch",profile:"macos.dispatch",rootClassName:"s-broker-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},ownsInternalRoutes:!0,resolveEmbedProps:s=>{const t=s.get("attempt")?.trim();return t?{initialAttemptId:t}:{}},hosts:{macos:!0}}}),nt=Object.freeze(Object.defineProperty({__proto__:null,BrokerAttemptInspector:ts,BrokerScreen:mr,scoutSurface:jr},Symbol.toStringTag,{value:"Module"}));export{ts as B,mr as a,Ce as b,nt as c};
@@ -1 +1 @@
1
- import{v as n,j as a,w as o}from"./index-DvLtl7rV.js";import{C as l}from"./CrewAvatar-BwXjyg8N.js";import{C as g}from"./check-ofKUE8yH.js";function C({selectedSlug:r,onSelect:c,size:i=44}){const e=n("crew");return a.jsxs("div",{className:"s-settings-cast-grid",role:"group","aria-label":"Character assignment",children:[o.map(s=>{const t=r?.toLowerCase()===s.slug.toLowerCase();return a.jsxs("button",{type:"button",className:"s-settings-cast-choice","data-cast-slug":s.slug,"data-active":t||void 0,"aria-pressed":t,onClick:()=>c(s.slug),children:[a.jsx(l,{slug:s.slug,size:i,ring:t,state:t?"working":"idle"}),a.jsx("span",{className:"s-settings-cast-name",children:s.name}),a.jsx("span",{className:"s-settings-cast-title",children:s.title}),t&&a.jsx(g,{className:"s-settings-cast-check",size:14,"aria-hidden":!0})]},s.slug)}),e?a.jsxs("span",{className:"s-cast-picker-coverage","aria-hidden":!0,children:[e.covered," of ",e.total," cast"]}):null]})}export{C};
1
+ import{v as n,j as a,w as o}from"./index-C1VaWNuD.js";import{C as l}from"./CrewAvatar-CZ_faQ_s.js";import{C as g}from"./check-Dz2SRHft.js";function C({selectedSlug:r,onSelect:c,size:i=44}){const e=n("crew");return a.jsxs("div",{className:"s-settings-cast-grid",role:"group","aria-label":"Character assignment",children:[o.map(s=>{const t=r?.toLowerCase()===s.slug.toLowerCase();return a.jsxs("button",{type:"button",className:"s-settings-cast-choice","data-cast-slug":s.slug,"data-active":t||void 0,"aria-pressed":t,onClick:()=>c(s.slug),children:[a.jsx(l,{slug:s.slug,size:i,ring:t,state:t?"working":"idle"}),a.jsx("span",{className:"s-settings-cast-name",children:s.name}),a.jsx("span",{className:"s-settings-cast-title",children:s.title}),t&&a.jsx(g,{className:"s-settings-cast-check",size:14,"aria-hidden":!0})]},s.slug)}),e?a.jsxs("span",{className:"s-cast-picker-coverage","aria-hidden":!0,children:[e.covered," of ",e.total," cast"]}):null]})}export{C};
@@ -1 +1 @@
1
- import{j as e,r as j}from"./index-DvLtl7rV.js";import{i as $,h as O,q as w,a as H}from"./conversation-model-Dc02NsGp.js";import{l as B,i as W,a as E,p as T}from"./conversation-prefs-DNre-Lcx.js";import{u as G,m as J,e as K}from"./Provider-CtXJeLrP.js";import{u as Q,f as X}from"./use-fleet-active-asks-DAspZQjE.js";import{b as Y}from"./router-B9vQkNJL.js";import{l as D,i as C,s as Z}from"./sessionRead-CvFz2RHv.js";import{u as ee}from"./use-conversation-list-C9ABzjXI.js";import{i as se}from"./colors-BtO5_zlx.js";import{A as te}from"./AgentAvatar-6-KBVKUu.js";/* empty css */function ae({children:n,count:t,tone:a="default",title:l,onClick:i}){const d=["collapsed-strip-label",a!=="default"&&`collapsed-strip-label--${a}`,t!=null&&"collapsed-strip-label--has-count",i&&"collapsed-strip-label--button"].filter(Boolean).join(" "),o=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"collapsed-strip-label-mark","aria-hidden":!0}),i?e.jsx("span",{className:"collapsed-strip-label-expand","aria-hidden":!0,children:"›"}):null,e.jsx("span",{className:"collapsed-strip-label-text",children:n}),t!=null?e.jsx("span",{className:"collapsed-strip-label-count",children:t}):null]});return i?e.jsx("button",{type:"button",className:d,title:l??n,"aria-label":l??n,onClick:i,children:o}):e.jsx("div",{className:d,title:l??n,children:o})}function ne({label:n,emptyMark:t="·",showLabel:a=!0,labelTone:l="default",labelCount:i,onLabelClick:d,children:o}){const v=!o||Array.isArray(o)&&o.length===0,p=a?e.jsx(ae,{tone:l,count:i,onClick:d,title:d?`Expand ${n}`:void 0,children:n}):null;return v?e.jsxs("div",{className:"collapsed-strip collapsed-strip--empty","aria-hidden":!0,children:[p,e.jsx("span",{className:"collapsed-strip-empty-mark",children:t})]}):e.jsxs("div",{className:"collapsed-strip",role:"list","aria-label":n,children:[p,o]})}function Ae(){return e.jsx("div",{className:"collapsed-strip-rule","aria-hidden":!0})}function le({title:n,active:t,tone:a="default",ava:l,avaColor:i,glyph:d,avatarNode:o,dot:v,pinned:p,onClick:b}){const m=["collapsed-chip",a==="channel"&&"collapsed-chip--channel",a==="neutral"&&"collapsed-chip--neutral",a==="attention"&&"collapsed-chip--attention",a==="unread"&&"collapsed-chip--unread",t&&"collapsed-chip--active",p&&"collapsed-chip--pinned"].filter(Boolean).join(" ");return e.jsxs("button",{type:"button",role:"listitem",className:m,title:n,"aria-label":n,"aria-current":t?"page":void 0,onClick:b,children:[o?e.jsx("span",{className:"collapsed-chip-avatar-wrap",children:o}):l?e.jsx("span",{className:"collapsed-chip-ava",style:i?{"--ava-color":i}:void 0,children:l}):e.jsx("span",{className:`collapsed-chip-glyph${typeof d=="string"&&d.length>1?" collapsed-chip-glyph--long":""}`,children:d}),v?e.jsx("span",{className:["collapsed-chip-dot",v==="attention"&&"collapsed-chip-dot--attention",v==="live"&&"collapsed-chip-dot--live"].filter(Boolean).join(" "),"aria-hidden":!0}):null,p?e.jsx("span",{className:"collapsed-chip-pin","aria-hidden":!0}):null]})}function Ie(n){const t=n.trim(),a=t.split(/[\s/_-]+/).filter(Boolean);if(a.length>=2){const l=a[a.length-1];return/^\d+$/.test(l)&&a.length>=3?(a[a.length-2][0]??"?").toUpperCase():(l[0]??"?").toUpperCase()}return(t[0]??"?").toUpperCase()}const ie=3,oe=3,re=4,ce=3;function S(n,t){return[...n].sort((a,l)=>{const i=C(a.lastMessageAt,a.id,t)?0:1,d=C(l.lastMessageAt,l.id,t)?0:1;return i!==d?i-d:(l.lastMessageAt??0)-(a.lastMessageAt??0)})}function de({onExpand:n}){const{route:t,navigate:a,agents:l}=G(),{sessions:i}=ee(),d=Q(),[o,v]=j.useState(()=>B()),[p,b]=j.useState(()=>D()),m=Y(t),y=j.useMemo(()=>J(l,m),[l,m]),P=j.useMemo(()=>{const s=new Map;for(const f of l)s.set(f.id,f);return s},[l]),R=t.view==="messages"||t.view==="conversation"?t.conversationId:void 0;j.useEffect(()=>{v(B()),b(D())},[]);const r=j.useMemo(()=>{const s=K(i,y,m).filter(c=>!W(c.id,o)),f=s.filter(c=>E(c.id,o)).sort((c,x)=>T(x.id,o)-T(c.id,o)||(x.lastMessageAt??0)-(c.lastMessageAt??0)).slice(0,ie),g=new Set(f.map(c=>c.id)),h=s.filter(c=>!g.has(c.id));return{pinned:f,channels:S(h.filter(w),p).slice(0,oe),dms:S(h.filter(O),p).slice(0,re),observed:S(h.filter($),p).slice(0,ce),totals:{channels:h.filter(w).length,dms:h.filter(O).length,observed:h.filter($).length,pinned:s.filter(c=>E(c.id,o)).length}}},[i,y,m,o,p]),U=s=>{b(Z(s.id)),a({view:"messages",conversationId:s.id,...m?{machineId:m}:{}})},k=[...r.pinned,...r.channels,...r.dms,...r.observed],A=k.filter(s=>C(s.lastMessageAt,s.id,p)).length,M=(s,f=!1)=>{const g=H(s),h=w(s),c=C(s.lastMessageAt,s.id,p),x=h?void 0:he(s,g),V=x??g,I=s.agentId?P.get(s.agentId):void 0,L=X(d,s),_=L?.status==="needs_attention",z=L?.status==="working",F=I?se(I.state):!1,q=_?"attention":c?"unread":z||F?"live":null;return e.jsx(le,{title:f?`${g} · pinned`:x?`${g} · ${x}`:g,active:s.id===R,tone:h?"channel":_?"attention":c?"unread":"default",avatarNode:h?void 0:e.jsx(te,{agent:I,name:V,size:28,tile:!0,presence:!1}),glyph:h?pe(g):void 0,dot:q,pinned:f,onClick:()=>U(s)},s.id)},u=[];return r.pinned.length&&u.push(e.jsx(N,{mark:"Pin",count:r.totals.pinned,showMark:u.length>0,children:r.pinned.map(s=>M(s,!0))},"pin")),r.channels.length&&u.push(e.jsx(N,{mark:"#",count:r.totals.channels,showMark:u.length>0,children:r.channels.map(s=>M(s))},"ch")),r.dms.length&&u.push(e.jsx(N,{mark:"DM",count:r.totals.dms,showMark:u.length>0,children:r.dms.map(s=>M(s))},"dm")),r.observed.length&&u.push(e.jsx(N,{mark:"Obs",count:r.totals.observed,showMark:u.length>0,children:r.observed.map(s=>M(s))},"obs")),e.jsx(ne,{label:"Chat",emptyMark:"#",labelTone:A>0?"accent":"default",labelCount:A>0?A:k.length||void 0,onLabelClick:n,children:u})}function pe(n){const a=n.replace(/^#+/,"").match(/[a-z0-9]/i)?.[0]?.toLowerCase()??"?";return e.jsxs("span",{className:"collapsed-chip-channel-badge",children:[e.jsx("span",{className:"collapsed-chip-channel-hash","aria-hidden":!0,children:"#"}),e.jsx("span",{className:"collapsed-chip-channel-text",children:a})]})}function he(n,t){const a=t.toLowerCase();for(const l of n.participants??[]){const i=l.displayName||l.label;if(i&&i.toLowerCase()!==a)return i}}function N({mark:n,count:t,showMark:a=!0,children:l}){return e.jsxs("div",{className:"collapsed-strip-section",role:"group","aria-label":n,children:[a?e.jsxs("div",{className:"collapsed-strip-section-mark",title:t!=null?`${n} · ${t}`:n,children:[e.jsx("span",{className:"collapsed-strip-section-mark-text",children:n}),t!=null&&t>0?e.jsx("span",{className:"collapsed-strip-section-mark-count",children:t>99?"99+":t}):null]}):null,l]})}const we=Object.freeze(Object.defineProperty({__proto__:null,ChatCollapsedStrip:de},Symbol.toStringTag,{value:"Module"}));export{ne as C,de as a,le as b,Ie as c,Ae as d,we as e};
1
+ import{j as e,r as j}from"./index-C1VaWNuD.js";import{i as $,h as O,q as w,a as H}from"./conversation-model-C2KuZUXc.js";import{l as B,i as W,a as E,p as T}from"./conversation-prefs-DNre-Lcx.js";import{u as G,m as J,j as K}from"./Provider-D0bB7q6y.js";import{u as Q,f as X}from"./use-fleet-active-asks-CCGrll5q.js";import{b as Y}from"./router-kfcaYqZr.js";import{l as D,i as C,s as Z}from"./sessionRead-CvFz2RHv.js";import{u as ee}from"./use-conversation-list-UG-tMN67.js";import{i as se}from"./colors-BtO5_zlx.js";import{A as te}from"./AgentAvatar-Dz79iTxB.js";/* empty css */function ae({children:n,count:t,tone:a="default",title:l,onClick:i}){const d=["collapsed-strip-label",a!=="default"&&`collapsed-strip-label--${a}`,t!=null&&"collapsed-strip-label--has-count",i&&"collapsed-strip-label--button"].filter(Boolean).join(" "),o=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"collapsed-strip-label-mark","aria-hidden":!0}),i?e.jsx("span",{className:"collapsed-strip-label-expand","aria-hidden":!0,children:"›"}):null,e.jsx("span",{className:"collapsed-strip-label-text",children:n}),t!=null?e.jsx("span",{className:"collapsed-strip-label-count",children:t}):null]});return i?e.jsx("button",{type:"button",className:d,title:l??n,"aria-label":l??n,onClick:i,children:o}):e.jsx("div",{className:d,title:l??n,children:o})}function ne({label:n,emptyMark:t="·",showLabel:a=!0,labelTone:l="default",labelCount:i,onLabelClick:d,children:o}){const v=!o||Array.isArray(o)&&o.length===0,p=a?e.jsx(ae,{tone:l,count:i,onClick:d,title:d?`Expand ${n}`:void 0,children:n}):null;return v?e.jsxs("div",{className:"collapsed-strip collapsed-strip--empty","aria-hidden":!0,children:[p,e.jsx("span",{className:"collapsed-strip-empty-mark",children:t})]}):e.jsxs("div",{className:"collapsed-strip",role:"list","aria-label":n,children:[p,o]})}function Ae(){return e.jsx("div",{className:"collapsed-strip-rule","aria-hidden":!0})}function le({title:n,active:t,tone:a="default",ava:l,avaColor:i,glyph:d,avatarNode:o,dot:v,pinned:p,onClick:b}){const m=["collapsed-chip",a==="channel"&&"collapsed-chip--channel",a==="neutral"&&"collapsed-chip--neutral",a==="attention"&&"collapsed-chip--attention",a==="unread"&&"collapsed-chip--unread",t&&"collapsed-chip--active",p&&"collapsed-chip--pinned"].filter(Boolean).join(" ");return e.jsxs("button",{type:"button",role:"listitem",className:m,title:n,"aria-label":n,"aria-current":t?"page":void 0,onClick:b,children:[o?e.jsx("span",{className:"collapsed-chip-avatar-wrap",children:o}):l?e.jsx("span",{className:"collapsed-chip-ava",style:i?{"--ava-color":i}:void 0,children:l}):e.jsx("span",{className:`collapsed-chip-glyph${typeof d=="string"&&d.length>1?" collapsed-chip-glyph--long":""}`,children:d}),v?e.jsx("span",{className:["collapsed-chip-dot",v==="attention"&&"collapsed-chip-dot--attention",v==="live"&&"collapsed-chip-dot--live"].filter(Boolean).join(" "),"aria-hidden":!0}):null,p?e.jsx("span",{className:"collapsed-chip-pin","aria-hidden":!0}):null]})}function Ie(n){const t=n.trim(),a=t.split(/[\s/_-]+/).filter(Boolean);if(a.length>=2){const l=a[a.length-1];return/^\d+$/.test(l)&&a.length>=3?(a[a.length-2][0]??"?").toUpperCase():(l[0]??"?").toUpperCase()}return(t[0]??"?").toUpperCase()}const ie=3,oe=3,re=4,ce=3;function S(n,t){return[...n].sort((a,l)=>{const i=C(a.lastMessageAt,a.id,t)?0:1,d=C(l.lastMessageAt,l.id,t)?0:1;return i!==d?i-d:(l.lastMessageAt??0)-(a.lastMessageAt??0)})}function de({onExpand:n}){const{route:t,navigate:a,agents:l}=G(),{sessions:i}=ee(),d=Q(),[o,v]=j.useState(()=>B()),[p,b]=j.useState(()=>D()),m=Y(t),y=j.useMemo(()=>J(l,m),[l,m]),P=j.useMemo(()=>{const s=new Map;for(const f of l)s.set(f.id,f);return s},[l]),R=t.view==="messages"||t.view==="conversation"?t.conversationId:void 0;j.useEffect(()=>{v(B()),b(D())},[]);const r=j.useMemo(()=>{const s=K(i,y,m).filter(c=>!W(c.id,o)),f=s.filter(c=>E(c.id,o)).sort((c,x)=>T(x.id,o)-T(c.id,o)||(x.lastMessageAt??0)-(c.lastMessageAt??0)).slice(0,ie),g=new Set(f.map(c=>c.id)),h=s.filter(c=>!g.has(c.id));return{pinned:f,channels:S(h.filter(w),p).slice(0,oe),dms:S(h.filter(O),p).slice(0,re),observed:S(h.filter($),p).slice(0,ce),totals:{channels:h.filter(w).length,dms:h.filter(O).length,observed:h.filter($).length,pinned:s.filter(c=>E(c.id,o)).length}}},[i,y,m,o,p]),U=s=>{b(Z(s.id)),a({view:"messages",conversationId:s.id,...m?{machineId:m}:{}})},k=[...r.pinned,...r.channels,...r.dms,...r.observed],A=k.filter(s=>C(s.lastMessageAt,s.id,p)).length,M=(s,f=!1)=>{const g=H(s),h=w(s),c=C(s.lastMessageAt,s.id,p),x=h?void 0:he(s,g),V=x??g,I=s.agentId?P.get(s.agentId):void 0,L=X(d,s),_=L?.status==="needs_attention",z=L?.status==="working",F=I?se(I.state):!1,q=_?"attention":c?"unread":z||F?"live":null;return e.jsx(le,{title:f?`${g} · pinned`:x?`${g} · ${x}`:g,active:s.id===R,tone:h?"channel":_?"attention":c?"unread":"default",avatarNode:h?void 0:e.jsx(te,{agent:I,name:V,size:28,tile:!0,presence:!1}),glyph:h?pe(g):void 0,dot:q,pinned:f,onClick:()=>U(s)},s.id)},u=[];return r.pinned.length&&u.push(e.jsx(N,{mark:"Pin",count:r.totals.pinned,showMark:u.length>0,children:r.pinned.map(s=>M(s,!0))},"pin")),r.channels.length&&u.push(e.jsx(N,{mark:"#",count:r.totals.channels,showMark:u.length>0,children:r.channels.map(s=>M(s))},"ch")),r.dms.length&&u.push(e.jsx(N,{mark:"DM",count:r.totals.dms,showMark:u.length>0,children:r.dms.map(s=>M(s))},"dm")),r.observed.length&&u.push(e.jsx(N,{mark:"Obs",count:r.totals.observed,showMark:u.length>0,children:r.observed.map(s=>M(s))},"obs")),e.jsx(ne,{label:"Chat",emptyMark:"#",labelTone:A>0?"accent":"default",labelCount:A>0?A:k.length||void 0,onLabelClick:n,children:u})}function pe(n){const a=n.replace(/^#+/,"").match(/[a-z0-9]/i)?.[0]?.toLowerCase()??"?";return e.jsxs("span",{className:"collapsed-chip-channel-badge",children:[e.jsx("span",{className:"collapsed-chip-channel-hash","aria-hidden":!0,children:"#"}),e.jsx("span",{className:"collapsed-chip-channel-text",children:a})]})}function he(n,t){const a=t.toLowerCase();for(const l of n.participants??[]){const i=l.displayName||l.label;if(i&&i.toLowerCase()!==a)return i}}function N({mark:n,count:t,showMark:a=!0,children:l}){return e.jsxs("div",{className:"collapsed-strip-section",role:"group","aria-label":n,children:[a?e.jsxs("div",{className:"collapsed-strip-section-mark",title:t!=null?`${n} · ${t}`:n,children:[e.jsx("span",{className:"collapsed-strip-section-mark-text",children:n}),t!=null&&t>0?e.jsx("span",{className:"collapsed-strip-section-mark-count",children:t>99?"99+":t}):null]}):null,l]})}const we=Object.freeze(Object.defineProperty({__proto__:null,ChatCollapsedStrip:de},Symbol.toStringTag,{value:"Module"}));export{ne as C,de as a,le as b,Ie as c,Ae as d,we as e};
@@ -1 +1 @@
1
- import{r as o,j as a}from"./index-DvLtl7rV.js";import{f as k}from"./cache-CeWH_KzJ.js";import{u as F,f as I,l as N,L as _,D}from"./usePierreRuntime-ejq9dCWV.js";/* empty css */const R=["unstaged","staged","branch"];function L(n){if(!n.startsWith("/"))return null;const t=[];for(const e of n.split("/"))if(!(!e||e==="."))if(e===".."){if(t.length===0)return null;t.pop()}else t.push(e);return t}function A(n,t){const e=L(n),s=L(t);return!e||!s||s.length<=e.length||e.some((c,u)=>s[u]!==c)?null:s.slice(e.length).join("/")}function y(n,t){return n.files.findIndex(e=>e.newPath===t||e.oldPath===t)}function K(n,t){return n.find(e=>y(e,t)>=0)?.kind??null}const M=()=>{},T=()=>{};function O({root:n,file:t}){const e=o.useMemo(()=>A(n,t),[t,n]),[s,c]=o.useState(null),[u,d]=o.useState("loading"),[P,m]=o.useState(null),[S,h]=o.useState(null),{pierre:j,pierrePhase:v,pierreError:C,pierreTheme:b,retryPierre:E}=F(s);o.useEffect(()=>{let r=!1;if(c(null),d("loading"),m(null),h(null),!e){d("ready");return}return k(n,R,{files:[e],tier:"patch"}).then(i=>{r||(c(i.snapshot),h(K(i.snapshot.layers,e)),d("ready"))},i=>{r||(m(i instanceof Error?i.message:String(i)),d("error"))}),()=>{r=!0}},[e,n]);const f=o.useMemo(()=>e?s?.layers.filter(r=>y(r,e)>=0)??[]:[],[e,s]),l=f.find(r=>r.kind===S)??f[0]??null,p=l&&e?y(l,e):-1,g=l&&p>=0?I(l.files[p],p):null;return u==="loading"?a.jsx("div",{className:"s-code-empty",children:"Loading file changes…"}):u==="error"?a.jsx("div",{className:"s-code-empty",children:P??"Couldn’t load this file’s changes."}):!s||!l||!g?a.jsx("div",{className:"s-code-empty",children:"No tracked patch is available. The file is clean, or it is untracked and has no Git baseline yet."}):a.jsxs("div",{className:"s-code-diff",children:[f.length>1?a.jsx("div",{className:"s-code-diffLayers",role:"tablist","aria-label":"Change layer",children:f.map(r=>{const i=N(r),x=r.kind===l.kind;return a.jsxs("button",{type:"button",role:"tab","aria-selected":x,className:"s-code-diffLayer","data-selected":x||void 0,onClick:()=>h(r.kind),children:[_[r.kind],a.jsxs("span",{children:["+",i.add," −",i.del]})]},r.kind)})}):null,a.jsx(D,{layer:l,patchLayer:l,patchPhase:"ready",patchError:null,selectedFileKey:g,renderKey:s.render.renderKey,theme:b,layout:"split",pierre:j,pierrePhase:v,pierreError:C,onRetryPierre:E,onIncludeLineContext:M,onIncludeSelectionContext:T,contextActions:!1})]})}const G=Object.freeze(Object.defineProperty({__proto__:null,CodeDiffPane:O},Symbol.toStringTag,{value:"Module"}));export{O as C,G as a,A as r};
1
+ import{r as o,j as a}from"./index-C1VaWNuD.js";import{f as k}from"./cache-CeWH_KzJ.js";import{u as F,f as I,l as N,L as _,D}from"./usePierreRuntime-35AHf9RQ.js";/* empty css */const R=["unstaged","staged","branch"];function L(n){if(!n.startsWith("/"))return null;const t=[];for(const e of n.split("/"))if(!(!e||e==="."))if(e===".."){if(t.length===0)return null;t.pop()}else t.push(e);return t}function A(n,t){const e=L(n),s=L(t);return!e||!s||s.length<=e.length||e.some((c,u)=>s[u]!==c)?null:s.slice(e.length).join("/")}function y(n,t){return n.files.findIndex(e=>e.newPath===t||e.oldPath===t)}function K(n,t){return n.find(e=>y(e,t)>=0)?.kind??null}const M=()=>{},T=()=>{};function O({root:n,file:t}){const e=o.useMemo(()=>A(n,t),[t,n]),[s,c]=o.useState(null),[u,d]=o.useState("loading"),[P,m]=o.useState(null),[S,h]=o.useState(null),{pierre:j,pierrePhase:v,pierreError:C,pierreTheme:b,retryPierre:E}=F(s);o.useEffect(()=>{let r=!1;if(c(null),d("loading"),m(null),h(null),!e){d("ready");return}return k(n,R,{files:[e],tier:"patch"}).then(i=>{r||(c(i.snapshot),h(K(i.snapshot.layers,e)),d("ready"))},i=>{r||(m(i instanceof Error?i.message:String(i)),d("error"))}),()=>{r=!0}},[e,n]);const f=o.useMemo(()=>e?s?.layers.filter(r=>y(r,e)>=0)??[]:[],[e,s]),l=f.find(r=>r.kind===S)??f[0]??null,p=l&&e?y(l,e):-1,g=l&&p>=0?I(l.files[p],p):null;return u==="loading"?a.jsx("div",{className:"s-code-empty",children:"Loading file changes…"}):u==="error"?a.jsx("div",{className:"s-code-empty",children:P??"Couldn’t load this file’s changes."}):!s||!l||!g?a.jsx("div",{className:"s-code-empty",children:"No tracked patch is available. The file is clean, or it is untracked and has no Git baseline yet."}):a.jsxs("div",{className:"s-code-diff",children:[f.length>1?a.jsx("div",{className:"s-code-diffLayers",role:"tablist","aria-label":"Change layer",children:f.map(r=>{const i=N(r),x=r.kind===l.kind;return a.jsxs("button",{type:"button",role:"tab","aria-selected":x,className:"s-code-diffLayer","data-selected":x||void 0,onClick:()=>h(r.kind),children:[_[r.kind],a.jsxs("span",{children:["+",i.add," −",i.del]})]},r.kind)})}):null,a.jsx(D,{layer:l,patchLayer:l,patchPhase:"ready",patchError:null,selectedFileKey:g,renderKey:s.render.renderKey,theme:b,layout:"split",pierre:j,pierrePhase:v,pierreError:C,onRetryPierre:E,onIncludeLineContext:M,onIncludeSelectionContext:T,contextActions:!1})]})}const G=Object.freeze(Object.defineProperty({__proto__:null,CodeDiffPane:O},Symbol.toStringTag,{value:"Module"}));export{O as C,G as a,A as r};
@@ -1,2 +1,2 @@
1
- import{r as h,j as i}from"./index-DvLtl7rV.js";import{C as ne}from"./chevron-down-wciXnOQz.js";import{S as oe}from"./search-CDko0PKE.js";const se=new Set(["hud","tail","terminal","services","pair","osn-auth","notification","code","file"]);function L(e){const t=e?.trim();return t||void 0}function q(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isSafeInteger(t)&&t>0?t:void 0}function ce(e){return e.split("/").filter(t=>t.length>0).map(encodeURIComponent).join("/")}function R(e){return e.map(t=>{try{return decodeURIComponent(t)}catch{return t}}).join("/")}function ie(e){const t=q(e.get("line")),n=q(e.get("endLine")),r=t&&n&&n>=t?n:void 0;return{...L(e.get("wt"))?{wt:L(e.get("wt"))}:{},...t?{line:t}:{},...r?{endLine:r}:{}}}function G(e){const t=e.trim();if(!t)return null;if(t.startsWith("/")||t.startsWith("~/")){const u=t.replace(/^~/,""),d=t.startsWith("~")?t:u;return{root:d,file:d}}if(!/^scout:/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol.toLowerCase()!=="scout:")return null;const r=(n.hostname||n.host||"").toLowerCase(),c=n.pathname.split("/").filter(u=>u.length>0),s=ie(n.searchParams);if(!r||r==="file"){const u=c;if(u.length===0)return null;const d=`/${R(u)}`,m=L(n.searchParams.get("root")),j=L(n.searchParams.get("file"));return{root:m??d,file:j??d,...s}}if(r==="code"){if(c.length===0){const m=L(n.searchParams.get("root")),j=L(n.searchParams.get("file")),b=L(n.searchParams.get("project")),y=L(n.searchParams.get("path"));return!m&&!j&&!b?{...s}:{...m?{root:m}:{},...j?{file:j}:{},...b?{project:b}:{},...y?{path:y}:{},...s}}const u=R([c[0]]),d=c.length>1?R(c.slice(1)):void 0;return{project:u,...d?{path:d}:{},...s}}if(se.has(r))return null;const a=decodeURIComponent(r),l=c.length>0?R(c):void 0;return{project:a,...l?{path:l}:{},...s}}function ae(e){const t=new URLSearchParams;e.wt&&t.set("wt",e.wt),e.line&&e.line>0&&t.set("line",String(e.line)),e.line&&e.endLine&&e.endLine>=e.line&&t.set("endLine",String(e.endLine));const n=t.toString(),r=n?`?${n}`:"";if(e.project)return`scout://${e.path?`${encodeURIComponent(e.project)}/${ce(e.path)}`:encodeURIComponent(e.project)}${r}`;const c=e.file??e.root;return c?`scout://${c.startsWith("/")?c:`/${c}`}${r}`:`scout://code${r}`}function le(e,t){const n=e.trim();if(!n)return null;let r=null;for(const c of t)(n===c||n.startsWith(`${c}/`))&&(!r||c.length>r.length)&&(r=c);return r?{root:r,file:n===r?null:n}:null}function ue(e){const t=e.trim();return t?!!(t.startsWith("/")||t.startsWith("~/")||/^scout:/i.test(t)):!1}function B(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function de(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function fe(e){return e.branch.detached?"detached":e.branch.name??"no branch"}function pe(e){return e.status.clean?"":`${e.status.changedFiles} changed`}function he(e){const t=[];for(const n of e)for(const[r,c]of n.worktrees.entries())t.push({root:c.path,projectId:n.id,projectName:n.name,projectSlug:B(n.name)||B(de(n.name)),worktreeName:c.name,branchLabel:fe(c),dirtyLabel:pe(c),isPrimary:r===0,changedFiles:c.status.changedFiles});return t}function v(e){return e.toLocaleLowerCase().replace(/[\s/_-]+/g," ").trim()}function me(e,t,n=0){const r=v(t);if(!r)return n;const c=r.split(" ").filter(Boolean),s=v(e.projectName),a=v(e.root),l=v(e.branchLabel),u=v(e.worktreeName),d=`${s} ${a} ${l} ${u} ${e.projectSlug}`;if(!c.every(j=>d.includes(j)))return-1;let m=n/100;return s===r||e.projectSlug===r.replace(/\s+/g,"-")?m+=120:s.startsWith(r)||e.projectSlug.startsWith(r.replace(/\s+/g,"-"))?m+=80:s.includes(r)&&(m+=48),(l.startsWith(r)||l.includes(r))&&(m+=34),u.includes(r)&&(m+=24),a.includes(r)&&(m+=20),m+=c.reduce((j,b)=>j+(s.startsWith(b)?12:0),0),m}function ge(e,t,n,r=12){const c=new Map(n.map((a,l)=>[a,n.length-l])),s=e.map(a=>({option:a,score:me(a,t,c.get(a.root)??0)})).filter(a=>a.score>=0);return t.trim()?s.sort((a,l)=>l.score-a.score||a.option.projectName.localeCompare(l.option.projectName)):s.sort((a,l)=>{const u=c.get(a.option.root)??-1,d=c.get(l.option.root)??-1;return u!==d?d-u:a.option.projectName.localeCompare(l.option.projectName)||a.option.branchLabel.localeCompare(l.option.branchLabel)}),s.slice(0,r).map(a=>a.option)}function Y(e){return e.isPrimary?e.projectName:`${e.projectName} · ${e.branchLabel}`}function D(e){return e.dirtyLabel?`${e.branchLabel} · ${e.dirtyLabel}`:e.branchLabel}function O(e){const t=typeof window<"u"?window.__OPEN_SCOUT_HOME:void 0;if(t&&e.startsWith(`${t}/`))return`~/${e.slice(t.length+1)}`;if(e.startsWith("/Users/")){const n=e.slice(7),r=n.indexOf("/");if(r>0)return`~${n.slice(r)}`}if(e.startsWith("/home/")){const n=e.slice(6),r=n.indexOf("/");if(r>0)return`~${n.slice(r)}`}return e}const Q="openscout.code.tree:",_="openscout.code.lastRoot",V="openscout.code.recentRoots",je=8;function Ce(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(Q+e);if(!t)return null;const n=JSON.parse(t);return!n||typeof n.entries!="object"||!Array.isArray(n.expanded)?null:n}catch{return null}}function Re(e,t){if(typeof window>"u")return;const n={};for(const r of[e,...t.expanded]){const c=t.entries.get(r);c&&(n[r]=c)}try{window.localStorage.setItem(Q+e,JSON.stringify({entries:n,expanded:[...t.expanded],selectedFile:t.selectedFile,savedAt:Date.now()}))}catch{}}function Oe(){if(typeof window>"u")return null;try{return window.localStorage.getItem(_)}catch{return null}}function M(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(V);if(!e){const n=window.localStorage.getItem(_);return n?[n]:[]}const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"&&n.length>0):[]}catch{return[]}}function Pe(e){if(!(typeof window>"u"))try{window.localStorage.setItem(_,e);const t=M().filter(r=>r!==e),n=[e,...t].slice(0,je);window.localStorage.setItem(V,JSON.stringify(n))}catch{}}const we=6,be=12;function k(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function W(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function X(e,t,n){const r=G(e);if(!r)return null;if(r.root||r.file){const c=t.map(u=>u.root),s=xe(r.file??r.root,c),a=le(s,c);if(a)return{root:a.root,file:a.file,line:r.line,endLine:r.endLine};const l=W(s).includes(".");return{root:l?Le(s):s,file:l?s:null,line:r.line,endLine:r.endLine}}if(r.project){const c=ke(n,r.project,r.wt??null,t);if(!c)return null;const s=r.path?`${c.root}/${r.path}`:null;return{root:c.root,file:s,project:r.project,path:r.path,wt:r.wt,line:r.line,endLine:r.endLine}}return null}function xe(e,t){if(!e.startsWith("~/")&&e!=="~")return e;for(const n of t){const r=n.match(/^(\/Users\/[^/]+)/)??n.match(/^(\/home\/[^/]+)/);if(r)return`${r[1]}${e.slice(1)}`}return e}function Le(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):e}function ke(e,t,n,r){if(e){const a=k(t),l=e.projects.find(u=>k(u.name)===a||k(W(u.root))===a);if(l)return{root:(n?l.worktrees.find(d=>d.name===n||d.branch.name===n||k(d.name)===k(n)):l.worktrees[0])?.path??l.root}}const c=k(t),s=r.find(a=>a.projectSlug===c);return s?{root:s.root}:null}function ye(e){if(e.project)return ae({project:e.project,path:e.path,wt:e.wt,line:e.line,endLine:e.endLine});const t=e.file??e.root;return t?O(t):"Deep link"}function Ne({snapshot:e,root:t,onSelect:n}){const[r,c]=h.useState(!1),[s,a]=h.useState(""),[l,u]=h.useState(0),[d,m]=h.useState(()=>M()),j=h.useRef(null),b=h.useRef(null),y=h.useRef(null),N=h.useId().replaceAll(":",""),P=`code-project-results-${N}`,x=h.useMemo(()=>he(e?.projects??[]),[e]),I=h.useMemo(()=>{const o=new Map;for(const f of x)o.set(f.root,f);return o},[x]),C=t?I.get(t)??null:null;h.useEffect(()=>{m(M())},[t,r]);const U=h.useMemo(()=>{const o=[];for(const f of d){const $=I.get(f);if($&&o.push($),o.length>=we)break}return o},[d,I]),w=ue(s),A=w?G(s):null,p=w?X(s,x,e):null,g=h.useMemo(()=>w?[]:ge(x,s,d,be),[x,s,d,w]),Z=(p?1:0)+g.length,S=h.useMemo(()=>{if(!s.trim()||w)return"";const o=g.find(f=>f.projectName.toLocaleLowerCase().startsWith(s.toLocaleLowerCase()));return o&&o.projectName.length>s.length?o.projectName:""},[s,g,w]);h.useEffect(()=>u(0),[s,r]),h.useEffect(()=>{if(!r)return;const o=window.setTimeout(()=>b.current?.focus(),20);return()=>window.clearTimeout(o)},[r]),h.useEffect(()=>{if(!r)return;function o(f){j.current?.contains(f.target)||(c(!1),a(""))}return document.addEventListener("pointerdown",o),()=>document.removeEventListener("pointerdown",o)},[r]);const E=()=>{a(""),c(!1),window.setTimeout(()=>y.current?.focus(),0)},T=o=>{n({root:o}),E()},F=()=>{p&&(n(p),E())},ee=o=>{if(o.key==="ArrowDown")o.preventDefault(),u(f=>Math.min(f+1,Math.max(Z-1,0)));else if(o.key==="ArrowUp")o.preventDefault(),u(f=>Math.max(f-1,0));else if(o.key==="Enter"){if(o.preventDefault(),p&&(l===0||g.length===0)){F();return}const f=p?l-1:l;g[f]&&T(g[f].root)}else o.key==="ArrowRight"&&S&&o.currentTarget.selectionStart===s.length?(o.preventDefault(),a(S)):o.key==="Escape"&&(o.preventDefault(),E())},te=C?Y(C):t?O(t):"Pick a project…",z=C?D(C):null,H=!!p&&l===0,re=p&&l===0?`${N}-deeplink`:g[p?l-1:l]?`${N}-opt-${g[p?l-1:l].root}`:void 0;return i.jsxs("div",{className:"s-code-picker",ref:j,children:[i.jsxs("button",{ref:y,type:"button",className:"s-code-pickerTrigger","aria-haspopup":"listbox","aria-expanded":r,"aria-controls":r?P:void 0,"aria-label":"Project or worktree",onClick:()=>c(o=>!o),children:[i.jsx("span",{className:"s-code-pickerTriggerName",children:te}),z?i.jsx("span",{className:"s-code-pickerTriggerDetail",children:z}):null,i.jsx(ne,{size:13,"aria-hidden":!0,className:"s-code-pickerChevron","data-open":r||void 0})]}),r?i.jsxs("div",{className:"s-code-pickerPanel",role:"dialog","aria-label":"Choose a project",children:[U.length>0&&!w?i.jsx("div",{className:"s-code-pickerRecents","aria-label":"Recent projects",children:U.map(o=>i.jsx("button",{type:"button",className:"s-code-pickerChip","data-active":o.root===t||void 0,title:`${o.projectName} · ${D(o)}
1
+ import{r as h,j as i}from"./index-C1VaWNuD.js";import{C as ne}from"./chevron-down-D120PY4g.js";import{S as oe}from"./search-FB2vVxCp.js";const se=new Set(["hud","tail","terminal","services","pair","osn-auth","notification","code","file"]);function L(e){const t=e?.trim();return t||void 0}function q(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isSafeInteger(t)&&t>0?t:void 0}function ce(e){return e.split("/").filter(t=>t.length>0).map(encodeURIComponent).join("/")}function R(e){return e.map(t=>{try{return decodeURIComponent(t)}catch{return t}}).join("/")}function ie(e){const t=q(e.get("line")),n=q(e.get("endLine")),r=t&&n&&n>=t?n:void 0;return{...L(e.get("wt"))?{wt:L(e.get("wt"))}:{},...t?{line:t}:{},...r?{endLine:r}:{}}}function G(e){const t=e.trim();if(!t)return null;if(t.startsWith("/")||t.startsWith("~/")){const u=t.replace(/^~/,""),d=t.startsWith("~")?t:u;return{root:d,file:d}}if(!/^scout:/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol.toLowerCase()!=="scout:")return null;const r=(n.hostname||n.host||"").toLowerCase(),c=n.pathname.split("/").filter(u=>u.length>0),s=ie(n.searchParams);if(!r||r==="file"){const u=c;if(u.length===0)return null;const d=`/${R(u)}`,m=L(n.searchParams.get("root")),j=L(n.searchParams.get("file"));return{root:m??d,file:j??d,...s}}if(r==="code"){if(c.length===0){const m=L(n.searchParams.get("root")),j=L(n.searchParams.get("file")),b=L(n.searchParams.get("project")),y=L(n.searchParams.get("path"));return!m&&!j&&!b?{...s}:{...m?{root:m}:{},...j?{file:j}:{},...b?{project:b}:{},...y?{path:y}:{},...s}}const u=R([c[0]]),d=c.length>1?R(c.slice(1)):void 0;return{project:u,...d?{path:d}:{},...s}}if(se.has(r))return null;const a=decodeURIComponent(r),l=c.length>0?R(c):void 0;return{project:a,...l?{path:l}:{},...s}}function ae(e){const t=new URLSearchParams;e.wt&&t.set("wt",e.wt),e.line&&e.line>0&&t.set("line",String(e.line)),e.line&&e.endLine&&e.endLine>=e.line&&t.set("endLine",String(e.endLine));const n=t.toString(),r=n?`?${n}`:"";if(e.project)return`scout://${e.path?`${encodeURIComponent(e.project)}/${ce(e.path)}`:encodeURIComponent(e.project)}${r}`;const c=e.file??e.root;return c?`scout://${c.startsWith("/")?c:`/${c}`}${r}`:`scout://code${r}`}function le(e,t){const n=e.trim();if(!n)return null;let r=null;for(const c of t)(n===c||n.startsWith(`${c}/`))&&(!r||c.length>r.length)&&(r=c);return r?{root:r,file:n===r?null:n}:null}function ue(e){const t=e.trim();return t?!!(t.startsWith("/")||t.startsWith("~/")||/^scout:/i.test(t)):!1}function B(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function de(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function fe(e){return e.branch.detached?"detached":e.branch.name??"no branch"}function pe(e){return e.status.clean?"":`${e.status.changedFiles} changed`}function he(e){const t=[];for(const n of e)for(const[r,c]of n.worktrees.entries())t.push({root:c.path,projectId:n.id,projectName:n.name,projectSlug:B(n.name)||B(de(n.name)),worktreeName:c.name,branchLabel:fe(c),dirtyLabel:pe(c),isPrimary:r===0,changedFiles:c.status.changedFiles});return t}function v(e){return e.toLocaleLowerCase().replace(/[\s/_-]+/g," ").trim()}function me(e,t,n=0){const r=v(t);if(!r)return n;const c=r.split(" ").filter(Boolean),s=v(e.projectName),a=v(e.root),l=v(e.branchLabel),u=v(e.worktreeName),d=`${s} ${a} ${l} ${u} ${e.projectSlug}`;if(!c.every(j=>d.includes(j)))return-1;let m=n/100;return s===r||e.projectSlug===r.replace(/\s+/g,"-")?m+=120:s.startsWith(r)||e.projectSlug.startsWith(r.replace(/\s+/g,"-"))?m+=80:s.includes(r)&&(m+=48),(l.startsWith(r)||l.includes(r))&&(m+=34),u.includes(r)&&(m+=24),a.includes(r)&&(m+=20),m+=c.reduce((j,b)=>j+(s.startsWith(b)?12:0),0),m}function ge(e,t,n,r=12){const c=new Map(n.map((a,l)=>[a,n.length-l])),s=e.map(a=>({option:a,score:me(a,t,c.get(a.root)??0)})).filter(a=>a.score>=0);return t.trim()?s.sort((a,l)=>l.score-a.score||a.option.projectName.localeCompare(l.option.projectName)):s.sort((a,l)=>{const u=c.get(a.option.root)??-1,d=c.get(l.option.root)??-1;return u!==d?d-u:a.option.projectName.localeCompare(l.option.projectName)||a.option.branchLabel.localeCompare(l.option.branchLabel)}),s.slice(0,r).map(a=>a.option)}function Y(e){return e.isPrimary?e.projectName:`${e.projectName} · ${e.branchLabel}`}function D(e){return e.dirtyLabel?`${e.branchLabel} · ${e.dirtyLabel}`:e.branchLabel}function O(e){const t=typeof window<"u"?window.__OPEN_SCOUT_HOME:void 0;if(t&&e.startsWith(`${t}/`))return`~/${e.slice(t.length+1)}`;if(e.startsWith("/Users/")){const n=e.slice(7),r=n.indexOf("/");if(r>0)return`~${n.slice(r)}`}if(e.startsWith("/home/")){const n=e.slice(6),r=n.indexOf("/");if(r>0)return`~${n.slice(r)}`}return e}const Q="openscout.code.tree:",_="openscout.code.lastRoot",V="openscout.code.recentRoots",je=8;function Ce(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(Q+e);if(!t)return null;const n=JSON.parse(t);return!n||typeof n.entries!="object"||!Array.isArray(n.expanded)?null:n}catch{return null}}function Re(e,t){if(typeof window>"u")return;const n={};for(const r of[e,...t.expanded]){const c=t.entries.get(r);c&&(n[r]=c)}try{window.localStorage.setItem(Q+e,JSON.stringify({entries:n,expanded:[...t.expanded],selectedFile:t.selectedFile,savedAt:Date.now()}))}catch{}}function Oe(){if(typeof window>"u")return null;try{return window.localStorage.getItem(_)}catch{return null}}function M(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(V);if(!e){const n=window.localStorage.getItem(_);return n?[n]:[]}const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"&&n.length>0):[]}catch{return[]}}function Pe(e){if(!(typeof window>"u"))try{window.localStorage.setItem(_,e);const t=M().filter(r=>r!==e),n=[e,...t].slice(0,je);window.localStorage.setItem(V,JSON.stringify(n))}catch{}}const we=6,be=12;function k(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function W(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function X(e,t,n){const r=G(e);if(!r)return null;if(r.root||r.file){const c=t.map(u=>u.root),s=xe(r.file??r.root,c),a=le(s,c);if(a)return{root:a.root,file:a.file,line:r.line,endLine:r.endLine};const l=W(s).includes(".");return{root:l?Le(s):s,file:l?s:null,line:r.line,endLine:r.endLine}}if(r.project){const c=ke(n,r.project,r.wt??null,t);if(!c)return null;const s=r.path?`${c.root}/${r.path}`:null;return{root:c.root,file:s,project:r.project,path:r.path,wt:r.wt,line:r.line,endLine:r.endLine}}return null}function xe(e,t){if(!e.startsWith("~/")&&e!=="~")return e;for(const n of t){const r=n.match(/^(\/Users\/[^/]+)/)??n.match(/^(\/home\/[^/]+)/);if(r)return`${r[1]}${e.slice(1)}`}return e}function Le(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):e}function ke(e,t,n,r){if(e){const a=k(t),l=e.projects.find(u=>k(u.name)===a||k(W(u.root))===a);if(l)return{root:(n?l.worktrees.find(d=>d.name===n||d.branch.name===n||k(d.name)===k(n)):l.worktrees[0])?.path??l.root}}const c=k(t),s=r.find(a=>a.projectSlug===c);return s?{root:s.root}:null}function ye(e){if(e.project)return ae({project:e.project,path:e.path,wt:e.wt,line:e.line,endLine:e.endLine});const t=e.file??e.root;return t?O(t):"Deep link"}function Ne({snapshot:e,root:t,onSelect:n}){const[r,c]=h.useState(!1),[s,a]=h.useState(""),[l,u]=h.useState(0),[d,m]=h.useState(()=>M()),j=h.useRef(null),b=h.useRef(null),y=h.useRef(null),N=h.useId().replaceAll(":",""),P=`code-project-results-${N}`,x=h.useMemo(()=>he(e?.projects??[]),[e]),I=h.useMemo(()=>{const o=new Map;for(const f of x)o.set(f.root,f);return o},[x]),C=t?I.get(t)??null:null;h.useEffect(()=>{m(M())},[t,r]);const U=h.useMemo(()=>{const o=[];for(const f of d){const $=I.get(f);if($&&o.push($),o.length>=we)break}return o},[d,I]),w=ue(s),A=w?G(s):null,p=w?X(s,x,e):null,g=h.useMemo(()=>w?[]:ge(x,s,d,be),[x,s,d,w]),Z=(p?1:0)+g.length,S=h.useMemo(()=>{if(!s.trim()||w)return"";const o=g.find(f=>f.projectName.toLocaleLowerCase().startsWith(s.toLocaleLowerCase()));return o&&o.projectName.length>s.length?o.projectName:""},[s,g,w]);h.useEffect(()=>u(0),[s,r]),h.useEffect(()=>{if(!r)return;const o=window.setTimeout(()=>b.current?.focus(),20);return()=>window.clearTimeout(o)},[r]),h.useEffect(()=>{if(!r)return;function o(f){j.current?.contains(f.target)||(c(!1),a(""))}return document.addEventListener("pointerdown",o),()=>document.removeEventListener("pointerdown",o)},[r]);const E=()=>{a(""),c(!1),window.setTimeout(()=>y.current?.focus(),0)},T=o=>{n({root:o}),E()},F=()=>{p&&(n(p),E())},ee=o=>{if(o.key==="ArrowDown")o.preventDefault(),u(f=>Math.min(f+1,Math.max(Z-1,0)));else if(o.key==="ArrowUp")o.preventDefault(),u(f=>Math.max(f-1,0));else if(o.key==="Enter"){if(o.preventDefault(),p&&(l===0||g.length===0)){F();return}const f=p?l-1:l;g[f]&&T(g[f].root)}else o.key==="ArrowRight"&&S&&o.currentTarget.selectionStart===s.length?(o.preventDefault(),a(S)):o.key==="Escape"&&(o.preventDefault(),E())},te=C?Y(C):t?O(t):"Pick a project…",z=C?D(C):null,H=!!p&&l===0,re=p&&l===0?`${N}-deeplink`:g[p?l-1:l]?`${N}-opt-${g[p?l-1:l].root}`:void 0;return i.jsxs("div",{className:"s-code-picker",ref:j,children:[i.jsxs("button",{ref:y,type:"button",className:"s-code-pickerTrigger","aria-haspopup":"listbox","aria-expanded":r,"aria-controls":r?P:void 0,"aria-label":"Project or worktree",onClick:()=>c(o=>!o),children:[i.jsx("span",{className:"s-code-pickerTriggerName",children:te}),z?i.jsx("span",{className:"s-code-pickerTriggerDetail",children:z}):null,i.jsx(ne,{size:13,"aria-hidden":!0,className:"s-code-pickerChevron","data-open":r||void 0})]}),r?i.jsxs("div",{className:"s-code-pickerPanel",role:"dialog","aria-label":"Choose a project",children:[U.length>0&&!w?i.jsx("div",{className:"s-code-pickerRecents","aria-label":"Recent projects",children:U.map(o=>i.jsx("button",{type:"button",className:"s-code-pickerChip","data-active":o.root===t||void 0,title:`${o.projectName} · ${D(o)}
2
2
  ${o.root}`,onClick:()=>T(o.root),children:Y(o)},o.root))}):null,i.jsxs("div",{className:"s-code-pickerSearch",children:[i.jsx(oe,{size:13,"aria-hidden":!0,className:"s-code-pickerSearchIcon"}),i.jsxs("div",{className:"s-code-pickerInputStack",children:[S?i.jsxs("div",{className:"s-code-pickerGhost","aria-hidden":!0,children:[i.jsx("span",{children:s}),S.slice(s.length)]}):null,i.jsx("input",{ref:b,className:"s-code-pickerInput",type:"search",role:"combobox",value:s,onChange:o=>a(o.currentTarget.value),onKeyDown:ee,placeholder:"Project, scout:// path, or branch…","aria-label":"Find a project","aria-autocomplete":"both","aria-expanded":"true","aria-controls":P,"aria-activedescendant":re,autoComplete:"off",spellCheck:!1})]}),S?i.jsx("kbd",{className:"s-code-pickerHint",children:"→"}):null]}),i.jsxs("div",{className:"s-code-pickerHeading",children:[i.jsx("span",{children:w?p?"Deep link":"Unrecognized link":s.trim()?g.length?"Matches":"No matches":"All projects"}),i.jsx("span",{children:w?p?"open with ↵":"no match":s.trim()?`${g.length} shown`:x.length?`${Math.min(g.length,x.length)} of ${x.length}`:e?"No repos yet":"Loading…"})]}),i.jsxs("div",{id:P,className:"s-code-pickerResults",role:"listbox","aria-label":"Projects",children:[p?i.jsxs("button",{id:`${N}-deeplink`,type:"button",role:"option","aria-selected":H,tabIndex:-1,className:"s-code-pickerOption s-code-pickerOption--deep","data-active":H||void 0,onMouseEnter:()=>u(0),onClick:F,children:[i.jsx("span",{className:"s-code-pickerOptionMain",children:i.jsx("strong",{children:"Open deep link"})}),i.jsx("span",{className:"s-code-pickerOptionPath",title:s.trim(),children:A?ye(A):s.trim()}),i.jsxs("span",{className:"s-code-pickerOptionMeta",children:[O(p.root),p.file?` · ${W(p.file)}`:""]})]}):null,g.map((o,f)=>{const $=p?f+1:f,J=$===l,K=o.root===t;return i.jsxs("button",{id:`${N}-opt-${o.root}`,type:"button",role:"option","aria-selected":J,"aria-current":K||void 0,tabIndex:-1,className:"s-code-pickerOption","data-active":J||void 0,"data-selected":K||void 0,onMouseEnter:()=>u($),onClick:()=>T(o.root),children:[i.jsxs("span",{className:"s-code-pickerOptionMain",children:[i.jsx("strong",{children:o.projectName}),o.isPrimary?null:i.jsx("span",{className:"s-code-pickerWorktree",children:"worktree"})]}),i.jsx("span",{className:"s-code-pickerOptionPath",title:o.root,children:O(o.root)}),i.jsx("span",{className:"s-code-pickerOptionMeta",children:D(o)})]},o.root)})]}),g.length===0&&s.trim()&&!p?i.jsx("div",{className:"s-code-pickerEmpty",role:"status",children:w?"Could not resolve that scout:// link. Try a project slug or absolute path.":`No project matches “${s}”. Try a folder name, branch, path, or scout:// link.`}):null,i.jsxs("div",{className:"s-code-pickerGuide",children:[i.jsxs("span",{children:[i.jsx("kbd",{children:"↑"}),i.jsx("kbd",{children:"↓"})," move"]}),i.jsxs("span",{children:[i.jsx("kbd",{children:"↵"})," open"]}),i.jsxs("span",{children:[i.jsx("kbd",{children:"esc"})," close"]})]})]}):null]})}const Ie=Object.freeze(Object.defineProperty({__proto__:null,CodeProjectPicker:Ne,resolvePickerDeepLink:X},Symbol.toStringTag,{value:"Module"}));export{Ne as C,Ce as a,Pe as b,Ie as c,ae as f,Oe as r,O as s,Re as w};
@@ -0,0 +1 @@
1
+ import{r as s,j as r}from"./index-C1VaWNuD.js";import{a as V}from"./api-Co9aQ2Jw.js";import{c as je}from"./clipboard-e3fSpeo7.js";import{f as ze}from"./scoutbot-D7kGGyK_.js";import{g as Ae,f as Ce}from"./api-HFH8wFyb.js";import{d as Ke}from"./types-B0PlfpKc.js";import{u as Oe}from"./useEmbedHeadline-DuUnwTB7.js";import{r as He,C as qe}from"./CodeDiffPane-DfluIWmO.js";import{r as Ge,a as Ve,w as Xe,b as Je,f as xe,C as Qe,s as Ye}from"./CodeProjectPicker-By_Wz9ex.js";import{ShikiPane as Ze}from"./ShikiPane-C0TuCATU.js";/* empty css */import{A as et}from"./arrow-left-eToA6GxC.js";import{C as tt}from"./chevron-right-CowuvuE6.js";import{C as nt}from"./check-Dz2SRHft.js";import{C as st}from"./copy-BzdzWsQd.js";import"./perf-PX8Rx0EP.js";import"./cache-CeWH_KzJ.js";import"./usePierreRuntime-35AHf9RQ.js";import"./chunk-HRAB3GC3-KjjrTLCU.js";/* empty css */import"./chevron-down-D120PY4g.js";import"./createLucideIcon-Dv8H8m7J.js";import"./search-FB2vVxCp.js";const rt=new Set(["node_modules",".git","dist",".next",".build","DerivedData","__pycache__",".venv","target"]);function we(i){const l=i.lastIndexOf("/");return l>0?i.slice(0,l):"/"}function ce(i){const l=i.lastIndexOf("/");return l>=0?i.slice(l+1):i}function X(i){return i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/(1024*1024)).toFixed(1)} MB`}function S(i){return i.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function it(i,l,k){const g=S(l),f=i.projects.find(u=>S(u.name)===g||S(ce(u.root))===g);if(!f)return null;const x=k?f.worktrees.find(u=>u.name===k||u.branch.name===k||S(u.name)===S(k)):f.worktrees[0];return{projectName:f.name,root:x?.path??f.root}}function ye(i,l){if(!l.startsWith(`${i}/`))return[];const k=l.slice(i.length+1).split("/"),g=[];let f=i;for(const x of k.slice(0,-1))f=`${f}/${x}`,g.push(f);return g}function ot(i){switch(i){case"untracked":return"U";case"conflicted":return"C";case"staged":return"S";case"unstaged":return"M";case"staged+unstaged":return"SM";default:return i.charAt(0).toUpperCase()}}function be(i,l,k,g,f){const x=k.get(i);if(!x){f.push({path:`${i}#loading`,name:"Loading…",kind:"file",depth:l,loading:!0});return}for(const u of x)u.kind==="directory"&&rt.has(u.name)||(f.push({path:u.path,name:u.name,kind:u.kind,depth:l}),u.kind==="directory"&&g.has(u.path)&&be(u.path,l+1,k,g,f))}function $t({route:i,navigate:l,root:k,file:g,project:f,path:x,wt:u,line:Le,endLine:Ne,returnConversationId:Re,embedded:I=!1}){Oe("Code",I);const B=k??i?.root??null,P=g??i?.file??null,p=f??i?.project??null,b=x??i?.path??null,U=u??i?.wt??null,j=Le??i?.line,w=Ne??i?.endLine,C=Re??i?.returnConversationId??null,[h,le]=s.useState(()=>Ae()),[o,J]=s.useState(()=>B??(p?null:Ge())),[y,Q]=s.useState(()=>new Map),[L,W]=s.useState(()=>new Set),[de,ue]=s.useState(null),[a,_]=s.useState(P),[c,z]=s.useState(null),[Ee,Y]=s.useState(!1),[fe,A]=s.useState(null),[pe,Z]=s.useState("idle"),[M,ee]=s.useState("source"),[m,te]=s.useState(()=>j&&j>0?{line:j,...w&&w>=j?{endLine:w}:{}}:null),[N,K]=s.useState(()=>p?{phase:"resolving"}:{phase:"idle"}),ne=p?`${p}\0${b??""}\0${U??""}`:null,R=s.useRef(null),se=s.useRef(null),T=s.useRef(ne);T.current!==ne&&(T.current=ne,R.current=null,se.current=null),s.useEffect(()=>{te(j&&j>0?{line:j,...w&&w>=j?{endLine:w}:{}}:null)},[w,j]),s.useEffect(()=>{if(h)return;let e=!1;return Ce("quick",!1,2e4).then(t=>{e||le(t)}).catch(()=>{}),()=>{e=!0}},[h]);const E=s.useCallback(async e=>{try{const t=await V(`/api/file/preview?path=${encodeURIComponent(e)}`);if(t.kind!=="directory")return;const n=t.entries.map(d=>({name:d.name,path:d.path,kind:d.kind}));Q(d=>new Map(d).set(e,n))}catch(t){ue(t instanceof Error?t.message:String(t))}},[]),$=s.useCallback((e,t)=>{if(!t)return;const n=ye(e,t);if(n.length!==0){W(d=>new Set([...d,...n]));for(const d of n)E(d)}},[E]);s.useEffect(()=>{if(!p)return;const e=`${p}\0${b??""}\0${U??""}`;if(R.current===e)return;const t=n=>{R.current=e;const d=b?`${n}/${b}`:null;K({phase:"idle"}),J(n),_(d),$(n,d)};if(h){const n=it(h,p,U);if(n){t(n.root);return}}se.current!==e&&(K({phase:"resolving"}),V(`/api/code/resolve-project?slug=${encodeURIComponent(p)}`).then(n=>{R.current===e||T.current!==e||t(n.root)}).catch(n=>{if(R.current===e||T.current!==e)return;se.current=e;const d=n instanceof Error?n.message:String(n);K({phase:"failed",message:d.includes(p)?d:`Can't resolve project "${p}": ${d}`})}))},[p,b,U,h,$]),s.useEffect(()=>{if(o||p||!h)return;const e=h.projects[0];e&&J(e.worktrees[0]?.path??e.root)},[o,p,h]);const he=s.useRef(a);he.current=a,s.useEffect(()=>{if(!o)return;ue(null);const e=Ve(o),t=he.current,n=t?ye(o,t):[];e?(Q(new Map(Object.entries(e.entries))),W(new Set([...e.expanded,...n])),!t&&e.selectedFile&&_(e.selectedFile)):(Q(new Map),W(new Set(n)));const d=new Set([o,...e?.expanded??[],...n]);for(const ae of d)E(ae);Ce("quick",!1,2e4).then(le).catch(()=>{})},[o,E]),s.useEffect(()=>{!o||y.size===0||(Xe(o,{entries:y,expanded:L,selectedFile:a}),Je(o))},[o,y,L,a]),s.useEffect(()=>{!B||!P||$(B,P)},[B,P,$]);const re=s.useRef(new Map),ie=s.useRef(new Set),$e=3e4,O=s.useCallback(e=>{const t=re.current.get(e);return t?Date.now()-t.at>$e?(re.current.delete(e),null):t.preview:null},[]),H=s.useCallback((e,t)=>{const n=re.current;if(n.set(e,{at:Date.now(),preview:t}),n.size>80){const d=n.keys().next().value;d&&n.delete(d)}},[]),Fe=s.useCallback(e=>{O(e)||ie.current.has(e)||(ie.current.add(e),V(`/api/file/preview?path=${encodeURIComponent(e)}`).then(t=>H(e,t)).catch(()=>{}).finally(()=>ie.current.delete(e)))},[O,H]);s.useEffect(()=>{if(Z("idle"),!a){z(null),A(null);return}const e=O(a);if(e){z(e.kind==="file"?e:null),A(null),Y(!1);return}let t=!1;return Y(!0),A(null),V(`/api/file/preview?path=${encodeURIComponent(a)}`).then(n=>{t||(H(a,n),z(n.kind==="file"?n:null))}).catch(n=>{t||(z(null),A(n instanceof Error?n.message:String(n)))}).finally(()=>{t||Y(!1)}),()=>{t=!0}},[a,O,H]);const Me=s.useMemo(()=>{if(!o)return[];const e=[];return be(o,0,y,L,e),e},[o,y,L]),me=s.useCallback((e,t)=>{const n=C?{returnConversationId:C}:{};if(h){for(const d of h.projects)for(const[ae,ge]of d.worktrees.entries())if(ge.path===e){const ve=t&&t.startsWith(`${e}/`)?t.slice(e.length+1):void 0;return{view:"code",project:S(d.name),...ve?{path:ve}:{},...ae>0?{wt:ge.name}:{},...n}}}return{view:"code",root:e,...t?{file:t}:{},...n}},[C,h]),oe=s.useCallback(()=>{if(!C)return;const e={view:"conversation",conversationId:C};ze({type:"navigate",route:e})||l?.(e)},[l,C]);s.useEffect(()=>{if(!C)return;const e=t=>{if(!t.defaultPrevented&&!(!t.metaKey||t.key!=="[")){if(t.target instanceof HTMLElement){const n=t.target.tagName;if(n==="INPUT"||n==="TEXTAREA"||t.target.isContentEditable)return}t.preventDefault(),oe()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[C,oe]);const q=s.useCallback((e,t)=>{I||!l||l(me(e,t))},[I,l,me]),Te=s.useCallback(e=>{W(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),y.has(e)||E(e)},[y,E]),De=s.useCallback(e=>{te(null),_(e),o&&q(o,e)},[o,q]),v=s.useMemo(()=>{if(!h||!o)return null;for(const e of h.projects)for(const t of e.worktrees)if(t.path===o)return{project:e,worktree:t};return null},[h,o]),F=s.useMemo(()=>{const e=new Map;if(!o||!v)return e;for(const t of v.worktree.status.files)e.set(`${o}/${t.path}`,t.status);return e},[o,v]),Ie=s.useMemo(()=>{const e=new Set;if(!o)return e;for(const t of F.keys()){let n=we(t);for(;n.startsWith(o)&&(e.add(n),n!==o);)n=we(n)}return e},[o,F]),G=!!(o&&a&&He(o,a));s.useEffect(()=>{G||ee("source")},[G]);const Be=a&&o&&a.startsWith(`${o}/`)?a.slice(o.length+1):c?.kind==="file"?c.title:a?ce(a):null,Pe=s.useCallback(async()=>{if(!c||c.kind!=="file"||!c.previewable)return;await je(c.content)&&(Z("copied"),window.setTimeout(()=>Z("idle"),1500))},[c]),[Ue,ke]=s.useState("idle"),D=s.useMemo(()=>{if(!o)return null;if(v){const e=a&&a.startsWith(`${o}/`)?a.slice(o.length+1):void 0,t=v.project.worktrees[0]?.path;return xe({project:S(v.project.name),...e?{path:e}:{},...t&&t!==o?{wt:v.worktree.name}:{},...m?.line?{line:m.line}:{},...m?.endLine?{endLine:m.endLine}:{}})}return xe({...a?{file:a}:{root:o},...m?.line?{line:m.line}:{},...m?.endLine?{endLine:m.endLine}:{}})},[o,a,v,m]),We=s.useCallback(async()=>{if(!D)return;await je(D)&&(ke("copied"),window.setTimeout(()=>ke("idle"),1500))},[D]),_e=s.useCallback(e=>{R.current=T.current,K({phase:"idle"}),te(e.line&&e.line>0?{line:e.line,...e.endLine&&e.endLine>=e.line?{endLine:e.endLine}:{}}:null),_(e.file??null),J(e.root),e.file&&$(e.root,e.file),q(e.root,e.file??null)},[$,q]);return r.jsxs("div",{className:"s-code-screen","data-embedded":I||void 0,children:[r.jsxs("div",{className:"s-code-head",children:[C?r.jsxs("button",{type:"button",className:"s-code-returnThread",onClick:oe,title:"Back to thread (⌘[)",children:[r.jsx(et,{size:13,strokeWidth:1.9,"aria-hidden":!0}),r.jsx("span",{children:"Back to thread"})]}):null,r.jsx(Qe,{snapshot:h,root:o,onSelect:_e}),v?.worktree.diff.branchShortstat?r.jsx("span",{className:"s-code-headStat",children:v.worktree.diff.branchShortstat}):null,o?r.jsx("span",{className:"s-code-headPath",title:o,children:Ye(o)}):null,D?r.jsx("button",{type:"button",className:"s-code-copyLink",title:D,onClick:()=>{We()},children:Ue==="copied"?"Copied scout://":"Copy scout://"}):null]}),r.jsxs("div",{className:"s-code-body",children:[r.jsx("div",{className:"s-code-tree",role:"tree","aria-label":"Files",children:de?r.jsx("div",{className:"s-code-treeNote",children:de}):o?Me.map(e=>e.loading?r.jsx("div",{className:"s-code-node s-code-node--loading",style:{paddingLeft:10+e.depth*14},children:e.name},e.path):r.jsxs("button",{type:"button",role:"treeitem",className:"s-code-node","data-selected":e.path===a||void 0,"data-diff":e.kind==="file"?F.get(e.path):void 0,"aria-expanded":e.kind==="directory"?L.has(e.path):void 0,style:{paddingLeft:10+e.depth*14},onClick:()=>e.kind==="directory"?Te(e.path):De(e.path),onMouseEnter:e.kind==="file"?()=>Fe(e.path):void 0,children:[e.kind==="directory"?r.jsx(tt,{size:11,strokeWidth:2,className:"s-code-nodeChevron","data-open":L.has(e.path)||void 0,"aria-hidden":!0}):r.jsx("span",{className:"s-code-nodeSpacer","aria-hidden":!0}),r.jsx("span",{className:"s-code-nodeName",children:e.name}),e.kind==="file"&&F.has(e.path)?r.jsx("span",{className:"s-code-nodeBadge","data-diff":F.get(e.path),children:ot(F.get(e.path)??"")}):null,e.kind==="directory"&&Ie.has(e.path)?r.jsx("span",{className:"s-code-nodeDot","aria-label":"Contains changes"}):null]},e.path)):N.phase==="resolving"?r.jsxs("div",{className:"s-code-treeNote",children:["Resolving “",p,"”…"]}):N.phase==="failed"?r.jsx("div",{className:"s-code-treeNote",children:N.message}):r.jsx("div",{className:"s-code-treeNote",children:"No repo selected."})}),r.jsxs("div",{className:"s-code-main",children:[a?r.jsxs("div",{className:"s-code-fileHead",children:[r.jsx("span",{className:"s-code-filePath",children:Be}),G?r.jsxs("div",{className:"s-code-fileMode",role:"tablist","aria-label":"File view",children:[r.jsx("button",{type:"button",role:"tab","aria-selected":M==="source","data-selected":M==="source"||void 0,onClick:()=>ee("source"),children:"Source"}),r.jsx("button",{type:"button",role:"tab","aria-selected":M==="changes","data-selected":M==="changes"||void 0,onClick:()=>ee("changes"),children:"Changes"})]}):null,c?.kind==="file"?r.jsxs("span",{className:"s-code-fileMeta",children:[X(c.sizeBytes),c.previewable&&c.truncated?" · truncated":"",m?` · L${m.line}${m.endLine?`–${m.endLine}`:""}`:""]}):null,c?.kind==="file"&&c.previewable?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"s-code-fileAction",onClick:()=>{Pe()},title:"Copy file contents",children:[pe==="copied"?r.jsx(nt,{size:12,"aria-hidden":!0}):r.jsx(st,{size:12,"aria-hidden":!0}),pe==="copied"?"Copied":"Copy"]}),r.jsx("a",{className:"s-code-fileAction",href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"Raw"})]}):null]}):null,M==="changes"&&G&&o&&a?r.jsx(qe,{root:o,file:a},`${o}\0${a}`):Ee?r.jsxs("div",{className:"s-code-empty",children:["Loading ",a?ce(a):"file","…"]}):fe?r.jsx("div",{className:"s-code-empty",children:fe}):c&&c.kind==="file"&&c.previewable?r.jsxs(r.Fragment,{children:[c.truncated?r.jsxs("div",{className:"s-code-fileNote",children:["Showing the first ",X(256*1024)," of ",X(c.sizeBytes)," ·"," ",r.jsx("a",{href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"open raw"})]}):null,r.jsx(Ze,{code:c.content,path:c.path,focusLine:m?.line,endLine:m?.endLine})]}):c&&c.kind==="file"?r.jsxs("div",{className:"s-code-empty",children:[c.previewReason," · ",X(c.sizeBytes)," ·"," ",r.jsx("a",{href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"open raw"})]}):N.phase==="resolving"?r.jsxs("div",{className:"s-code-empty",children:["Opening ",b??`“${p}”`,"…"]}):N.phase==="failed"?r.jsx("div",{className:"s-code-empty",children:N.message}):r.jsx("div",{className:"s-code-empty",children:"Pick a file to read."})]})]})]})}const Ft=Ke({id:"code",label:"Code Browser",route:{view:"code"},webPath:"/code",screen:"CodeContent",embed:{path:"/embed/code",profile:"macos.code",rootClassName:"s-code-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},hosts:{macos:!0},resolveEmbedProps:i=>({root:i.get("root")?.trim()||void 0,file:i.get("file")?.trim()||void 0,project:i.get("project")?.trim()||void 0,path:i.get("path")?.trim()||void 0,wt:i.get("wt")?.trim()||void 0,line:Se(i.get("line")),endLine:Se(i.get("endLine")),returnConversationId:i.get("fromConversation")?.trim()||void 0})}});function Se(i){if(!i)return;const l=Number.parseInt(i,10);return Number.isSafeInteger(l)&&l>0?l:void 0}export{$t as CodeContent,Ft as scoutSurface};
@@ -0,0 +1 @@
1
+ import{r as h,j as e}from"./index-C1VaWNuD.js";import{A as G}from"./AgentAvatar-Dz79iTxB.js";import{M as J}from"./runtime-picker-C20lTGhV.js";import{j as Y,k as ee,l as O,m as se,M as _}from"./NewChatComposer-D2Ah4T-W.js";import{F as te}from"./file-text-BHro8MkG.js";import"./index-Cx6Gbr6n.js";import{c as I}from"./createLucideIcon-Dv8H8m7J.js";import{Z as ae}from"./zap-Bcja1lHG.js";import{X as ne}from"./x-DgmmnPKt.js";const re=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],oe=I("pencil",re);const ce=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]],ie=I("reply",ce),U="Only markdown, code, images, and video clips can be attached.";function we(){const[t,c]=h.useState([]),[g,x]=h.useState(null),[d,p]=h.useState(null),[i,j]=h.useState(0),n=h.useRef(null),f=h.useCallback((r,l="Attached")=>{const m=r.filter(Y);return m.length===0?(r.length>0&&p(U),0):(p(null),c(v=>{const F=new Set(v.map(u=>`${u.name}:${u.size}:${u.lastModified}`)),R=m.filter(u=>!F.has(`${u.name}:${u.size}:${u.lastModified}`));return R.length>0?[...v,...R]:v}),x(m.length===1?`${l} ${m[0]?.name??"1 attachment"}.`:`${l} ${m.length} attachments.`),m.length)},[]),b=h.useCallback(r=>{c(l=>l.filter(m=>m!==r)),x(null)},[]),$=h.useCallback(()=>{c([]),x(null),p(null),j(0)},[]),y=h.useCallback(()=>{n.current?.click()},[]),E=h.useCallback(r=>{const l=ee(r.clipboardData);l.length!==0&&(r.preventDefault(),f(l,"Pasted"))},[f]),k=h.useMemo(()=>({onDragOver:r=>{O(r.dataTransfer)&&(r.preventDefault(),j(l=>l===0?1:l))},onDragLeave:r=>{r.currentTarget.contains(r.relatedTarget)||j(0)},onDrop:r=>{if(!O(r.dataTransfer))return;r.preventDefault(),j(0);const l=se(r.dataTransfer);if(l.length===0){p(U);return}f(l,"Dropped")}}),[f]);return{files:t,hasFiles:t.length>0,feedback:g,error:d,dragActive:i>0,stage:f,remove:b,clear:$,setError:p,openPicker:y,dropHandlers:k,onPaste:E,inputRef:n}}function le(t){if(t<1024)return`${t} B`;const c=t/1024;return c<1024?`${c.toFixed(0)} KB`:`${(c/1024).toFixed(1)} MB`}function de(t){return(t.split(".").pop()?.toUpperCase()??"FILE").slice(0,4)}function me({file:t,onRemove:c}){const g=h.useMemo(()=>URL.createObjectURL(t),[t]);h.useEffect(()=>()=>URL.revokeObjectURL(g),[g]);const x=t.type.startsWith("video/"),d=t.type.startsWith("image/"),p=de(t.name),i=le(t.size);return e.jsxs("div",{className:"s-msg-compose-attachment surface-card surface-card--inset",children:[x?e.jsx("video",{src:g,muted:!0,playsInline:!0}):d?e.jsx("img",{src:g,alt:t.name}):e.jsxs("div",{className:"s-msg-compose-attachment-file",title:`${t.name} (${i})`,children:[e.jsxs("div",{className:"s-msg-compose-attachment-file-icon",children:[e.jsx(te,{size:16,"aria-hidden":"true"}),e.jsx("span",{className:"s-msg-compose-attachment-ext label-xs",children:p})]}),e.jsx("span",{className:"s-msg-compose-attachment-name",children:t.name}),e.jsx("span",{className:"s-msg-compose-attachment-size label-xs text-dim",children:i})]}),e.jsx("button",{type:"button",className:"s-msg-compose-attachment-remove btn btn--ghost btn--icon","aria-label":`Remove ${t.name}`,title:`Remove ${t.name}`,onClick:c,children:"×"})]})}function ue({attachments:t,accept:c="image/*,video/*,text/markdown,.md,.markdown,text/plain,.txt"}){const{files:g,feedback:x,error:d,remove:p,stage:i,inputRef:j}=t;return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:j,type:"file",multiple:!0,accept:c,className:"s-msg-compose-file-input",onChange:n=>{i([...n.target.files??[]]),n.target.value=""}}),g.length>0?e.jsx("div",{className:"s-msg-compose-attachments","aria-label":"Staged attachments",children:g.map(n=>e.jsx(me,{file:n,onRemove:()=>p(n)},`${n.name}:${n.size}:${n.lastModified}`))}):null,d?e.jsx("div",{className:"s-msg-compose-attach-note","data-tone":"error",role:"alert",children:d}):x?e.jsx("div",{className:"s-msg-compose-attach-note","data-tone":"muted",role:"status",children:x}):null]})}function pe({composeRef:t,draft:c,setDraft:g,composePlaceholder:x,slashState:d,setSlashState:p,filteredSlashCommands:i,applySlashCommand:j,mentionState:n,setMentionState:f,filteredMentions:b,applyMention:$,updateTriggersFromDraft:y,closeSuggestions:E,replyTarget:k,onCancelReply:r,isStopMode:l,sending:m,composeAction:v,onSend:F,onInterrupt:R,attachments:u,isAgentBusy:H,busyIntent:D,onBusyIntentChange:L,queued:N,queueNote:K,onEditQueued:B,editingQueuedId:w,editingAttachmentCount:A,onCancelEdit:W,onUnqueue:S,onSendQueuedNow:Q}){const Z=e.jsxs(e.Fragment,{children:[d.open?e.jsx(_,{label:"Slash commands",items:i.map(s=>({id:s.command,token:s.label,description:s.description})),activeIndex:d.index,onPick:s=>{const a=i[s];a&&j(a)},onActiveIndexChange:s=>p(a=>({...a,index:s}))}):null,n.open?e.jsx(_,{label:"Mention agent",items:b.map(s=>({id:s.id,token:`@${s.handle}`,description:s.name,avatarNode:e.jsx(G,{name:s.name,size:20,tile:!0,presence:!1})})),activeIndex:n.index,onPick:s=>{const a=b[s];a&&$(a)},onActiveIndexChange:s=>f(a=>({...a,index:s}))}):null]}),V=c.trim().length>0,q=w!==null,P=V||u.hasFiles||A>0,z=H&&P,C=z&&D==="steer",T=q?N.findIndex(s=>s.id===w)+1:0,M=z?e.jsxs("div",{className:"s-msg-compose-mode",role:"group","aria-label":"What Send does while this turn is running",children:[e.jsx("button",{type:"button",className:"s-msg-compose-mode-btn","data-mode":"queue","aria-pressed":D==="queue",title:"Hold this draft until the running turn lands",disabled:m,onClick:()=>L("queue"),children:"Queue"}),e.jsx("button",{type:"button",className:"s-msg-compose-mode-btn","data-mode":"steer","aria-pressed":D==="steer",title:"Interrupt the running turn and deliver this now",disabled:m,onClick:()=>L("steer"),children:"Steer"})]}):null,X=N.length>0||M?e.jsxs("div",{className:"s-msg-compose-queue",role:"group","aria-label":"Queued messages",children:[e.jsxs("div",{className:"s-msg-compose-queue-head",children:[e.jsx("span",{className:"s-msg-compose-queue-kicker",children:N.length>0?`Queue · ${N.length}`:"Queues next"}),e.jsx("span",{className:"s-msg-compose-queue-hint",children:q?C?`Rewriting ${T} — send interrupts this turn`:`Rewriting ${T} — send returns it to its place`:N.length>0?C?"Send interrupts this turn":K??"":C?"Interrupts this turn on send":"Sends when this turn lands"}),M]}),N.map((s,a)=>e.jsxs("div",{className:"s-msg-compose-queue-row","data-editing":s.id===w?"true":void 0,children:[e.jsx("span",{className:"s-msg-compose-queue-index",children:a+1}),e.jsx("span",{className:"s-msg-compose-queue-body",children:s.body.trim()||"Attachments only"}),s.attachments.length>0?e.jsxs("span",{className:"s-msg-compose-queue-clip",children:[s.attachments.length," file",s.attachments.length===1?"":"s"]}):null,s.id===w?e.jsx("button",{type:"button",className:"s-msg-compose-queue-edit btn btn--sm btn--ghost",title:"Stop rewriting — leave this row as it was","aria-label":`Cancel rewriting queued message ${a+1}`,onClick:W,children:"Cancel edit"}):e.jsxs("button",{type:"button",className:"s-msg-compose-queue-edit btn btn--sm btn--ghost",title:"Pull this back into the input box to rewrite it","aria-label":`Edit queued message ${a+1}`,disabled:m||q,onClick:()=>B(s.id),children:[e.jsx(oe,{size:11,"aria-hidden":"true"}),e.jsx("span",{children:"Edit"})]}),e.jsxs("button",{type:"button",className:"s-msg-compose-queue-now btn btn--sm btn--accent",title:"Interrupt this turn and send this now","aria-label":`Send queued message ${a+1} now`,disabled:m||s.id===w,onClick:()=>Q(s.id),children:[e.jsx(ae,{size:11,"aria-hidden":"true"}),e.jsx("span",{children:"Send now"})]}),e.jsx("button",{type:"button",className:"s-msg-compose-queue-drop btn btn--ghost btn--icon",title:"Cancel — drop this from the queue","aria-label":`Cancel queued message ${a+1}`,onClick:()=>S(s.id),children:"×"})]},s.id))]}):null;return e.jsx(J,{density:"thread",value:c,onChange:(s,a)=>{g(s),y(s,a?.caret??s.length)},onSend:F,placeholder:x,sending:m,stopMode:l,onStop:R,canSend:P,sendTitle:C?"Steer — interrupt this turn and send now (Cmd+Enter)":z?"Queue for the next turn (Cmd+Enter)":"Send (Cmd+Enter)",sendAriaLabel:C?"Steer — interrupt this turn and send now (Cmd+Enter)":z?"Queue message for the next turn (Cmd+Enter)":v==="steer"?"Send follow-up (Cmd+Enter)":"Send message (Cmd+Enter)",showAttach:!0,onAttach:u.openPicker,onPaste:u.onPaste,dropHandlers:u.dropHandlers,dragActive:u.dragActive,textareaRef:t,overlay:Z,above:X,aboveAttached:!0,header:e.jsxs(e.Fragment,{children:[k?e.jsxs("div",{className:"s-thread-compose-reply surface-card surface-card--inset",role:"status",children:[e.jsx(ie,{className:"s-thread-compose-reply-icon text-muted",size:13,strokeWidth:1.8,"aria-hidden":"true"}),e.jsx("span",{className:"s-thread-compose-reply-label label-xs text-muted",children:"Replying to"}),e.jsx("span",{className:"s-thread-compose-reply-actor chip chip--sm chip--mono chip--neutral",children:k.actorLabel}),e.jsx("span",{className:"s-thread-compose-reply-preview text-muted",title:k.preview,children:k.preview}),e.jsx("button",{type:"button",className:"s-thread-compose-reply-cancel btn btn--ghost btn--icon","aria-label":"Cancel reply",title:"Cancel reply",onClick:r,children:e.jsx(ne,{size:13,strokeWidth:1.8,"aria-hidden":"true"})})]}):null,q&&A>0?e.jsxs("div",{className:"s-msg-compose-carried",role:"status",children:[A," file",A===1?"":"s"," stay attached to this draft"]}):null,e.jsx(ue,{attachments:u})]}),tools:e.jsxs("span",{className:"s-thread-compose-hint s-msg-compose-tools-hint",children:[e.jsx("kbd",{className:"s-kbd",children:"/"})," commands"," · ",e.jsx("kbd",{className:"s-kbd",children:"@"})," agents"]}),onSelect:s=>{const a=s.currentTarget;y(a.value,a.selectionStart)},onBlur:()=>{setTimeout(E,120)},onKeyDown:s=>{if(!(d.open&&i.length>0||n.open&&b.length>0))return!1;if(s.key==="ArrowDown")return d.open?p(o=>({...o,index:(o.index+1)%i.length})):n.open&&f(o=>({...o,index:(o.index+1)%b.length})),!0;if(s.key==="ArrowUp")return d.open?p(o=>({...o,index:(o.index-1+i.length)%i.length})):n.open&&f(o=>({...o,index:(o.index-1+b.length)%b.length})),!0;if(s.key==="Escape")return E(),!0;if((s.key==="Enter"||s.key==="Tab")&&!s.shiftKey&&!s.metaKey&&!s.ctrlKey&&!s.altKey){if(d.open){const o=i[d.index]??i[0];o&&j(o)}else if(n.open){const o=b[n.index]??b[0];o&&$(o)}return!0}return!1}})}const Ce=Object.freeze(Object.defineProperty({__proto__:null,ConversationComposer:pe},Symbol.toStringTag,{value:"Module"}));export{pe as C,Ce as a,we as u};
@@ -0,0 +1 @@
1
+ import{j as t}from"./index-C1VaWNuD.js";import{M as p}from"./message-markup-DC0QFEZn.js";import{f as d}from"./conversation-model-C2KuZUXc.js";import{t as n}from"./time-Dhsh_2EG.js";import"./mentions-BZ5SBMtc.js";import"./colors-BtO5_zlx.js";import"./index-Cx6Gbr6n.js";import"./api-Co9aQ2Jw.js";import"./perf-PX8Rx0EP.js";import"./Provider-D0bB7q6y.js";import"./router-kfcaYqZr.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-Bdt2W3Y4.js";import"./sse-B29iGBnw.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-D7kGGyK_.js";import"./NewChatComposer-D2Ah4T-W.js";import"./runtime-picker-C20lTGhV.js";import"./scout-voice-Cg1qfepC.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-DmUG_YC7.js";import"./createLucideIcon-Dv8H8m7J.js";import"./HarnessMark-DttReffF.js";import"./NewChatOrigin-DCn5cWPZ.js";import"./keyboard-nav-B8sQ_8IF.js";import"./x-DgmmnPKt.js";import"./chevron-down-D120PY4g.js";import"./search-FB2vVxCp.js";import"./file-text-BHro8MkG.js";import"./model-CBkMvT1w.js";import"./DocumentFocusViewer-D8iB6SMt.js";import"./TextDocumentSurface-2X1Gw4eA.js";import"./chevron-right-CowuvuE6.js";import"./code-xml-CkkNdRmu.js";import"./arrow-left-eToA6GxC.js";import"./arrow-right-DTX42clh.js";import"./chunk-HRAB3GC3-KjjrTLCU.js";import"./AgentDetailCard-8viaEY8b.js";import"./AgentLiveActions-DlSKL60c.js";import"./terminal-takeover-BMeBjBB2.js";import"./openContent-C6XO6kr5.js";import"./eye-C9cGk5z6.js";import"./terminal-UDy4lzV1.js";function l({at:a}){const i=d(a);return t.jsxs("div",{className:"s-thread-day-divider","aria-label":i,children:[t.jsx("span",{className:"s-thread-day-line","aria-hidden":"true"}),t.jsx("span",{className:"s-thread-day-label",children:i}),t.jsx("span",{className:"s-thread-day-line","aria-hidden":"true"})]})}function rt({row:a,expanded:i,showDayDivider:e,onToggle:s}){const m=`${a.recipients.length} recipients`;return t.jsxs("div",{className:["s-thread-feed-block","s-thread-fanout",e&&"s-thread-feed-block--full-width"].filter(Boolean).join(" "),children:[e&&t.jsx(l,{at:a.createdAt}),a.messages.map(r=>t.jsx("span",{id:`msg-${r.id}`,className:"s-thread-fanout-anchor","aria-hidden":"true"},r.id)),t.jsxs("button",{type:"button",className:"s-thread-fanout-summary","aria-expanded":i,onClick:s,title:a.recipients.join(", "),children:[t.jsx("span",{className:"s-thread-fanout-caret","aria-hidden":"true",children:i?"▾":"▸"}),t.jsx("span",{className:"s-thread-fanout-label",children:m}),t.jsx("span",{className:"s-thread-fanout-time",children:n(a.createdAt)})]}),i&&t.jsxs("div",{className:"s-thread-fanout-detail",children:[t.jsx("ul",{className:"s-thread-fanout-recipients",children:a.messages.map((r,o)=>t.jsx("li",{className:"s-thread-fanout-recipient",children:a.recipients[o]},r.id))}),t.jsx("div",{className:"s-thread-fanout-body",children:t.jsx(p,{text:a.messages[0].body})})]})]})}export{rt as FanOutRow,l as ThreadDayDivider};
@@ -0,0 +1 @@
1
+ import{r as k,j as e,H as G}from"./index-C1VaWNuD.js";import{c as A}from"./clipboard-e3fSpeo7.js";import{b as K}from"./router-kfcaYqZr.js";import{A as M}from"./AgentAvatar-Dz79iTxB.js";import{H as J}from"./HarnessMark-DttReffF.js";import{b as Q}from"./Provider-D0bB7q6y.js";import{n as Z,c as ee}from"./colors-BtO5_zlx.js";import{B as te}from"./BackToPicker-BHicJyfc.js";import{o as P}from"./openContent-C6XO6kr5.js";import{AstronautSuit as se}from"./AstronautSuit-CwB4Dw07.js";import{w as ne,x as ae}from"./conversation-model-C2KuZUXc.js";import{E as re}from"./eye-C9cGk5z6.js";import{c as oe}from"./createLucideIcon-Dv8H8m7J.js";import"./perf-PX8Rx0EP.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-Bdt2W3Y4.js";import"./api-Co9aQ2Jw.js";import"./SpriteAvatar-DFO4Kb4Z.js";import"./CrewAvatar-CZ_faQ_s.js";import"./sse-B29iGBnw.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-D7kGGyK_.js";import"./NewChatComposer-D2Ah4T-W.js";import"./runtime-picker-C20lTGhV.js";import"./scout-voice-Cg1qfepC.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-DmUG_YC7.js";import"./index-Cx6Gbr6n.js";import"./NewChatOrigin-DCn5cWPZ.js";import"./keyboard-nav-B8sQ_8IF.js";import"./x-DgmmnPKt.js";import"./chevron-down-D120PY4g.js";import"./search-FB2vVxCp.js";import"./file-text-BHro8MkG.js";import"./model-CBkMvT1w.js";import"./time-Dhsh_2EG.js";import"./DocumentFocusViewer-D8iB6SMt.js";import"./TextDocumentSurface-2X1Gw4eA.js";import"./chevron-right-CowuvuE6.js";import"./code-xml-CkkNdRmu.js";import"./arrow-left-eToA6GxC.js";import"./arrow-right-DTX42clh.js";import"./chunk-HRAB3GC3-KjjrTLCU.js";const ie=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],le=oe("user-plus",ie),X=150,_=320,ce=1.4,de=1.1,V=5,me=22,W=5200,he=1,pe=1200;function ue(n){k.useEffect(()=>{const s=n.current;if(!s||window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;let i=[],r=[],x=-9999,m=-9999,u=0;const c=()=>{i=[],r=[],s.querySelectorAll(".sprite-cell--eye circle").forEach(o=>{const a=o.getBoundingClientRect();if(!a.width)return;const h=o.closest("[data-state]");i.push({el:o,cx:a.left+a.width/2,cy:a.top+a.height/2,working:h?.dataset.state==="in_flight"})}),s.querySelectorAll(".s-thread-participant-avatar svg").forEach(o=>{const a=o.getBoundingClientRect();a.width&&r.push({el:o,cx:a.left+a.width/2,cy:a.top+a.height/2})})},y=o=>o<X?1:o>_?0:(_-o)/(_-X),f=o=>{for(const a of i){const h=x-a.cx,N=m-a.cy,b=Math.hypot(h,N),p=y(b),v=b<1?1:b;let j=h/v*ce*p;const w=N/v*de*p;if(a.working&&p<1){const S=o%W/W;j+=Math.sin(S*Math.PI*2)*he*(1-p)}a.el.style.transform=`translate(${j.toFixed(2)}px, ${w.toFixed(2)}px)`}for(const a of r){const h=x-a.cx,N=Math.hypot(h,m-a.cy),b=y(N),p=Math.max(-V,Math.min(V,h/me))*b;a.el.style.transform=p===0?"":`rotate(${p.toFixed(2)}deg)`}u=requestAnimationFrame(f)},d=o=>{x=o.clientX,m=o.clientY};c();const L=window.setInterval(c,pe);return u=requestAnimationFrame(f),window.addEventListener("resize",c),document.addEventListener("pointermove",d,{passive:!0}),()=>{cancelAnimationFrame(u),window.clearInterval(L),window.removeEventListener("resize",c),document.removeEventListener("pointermove",d);for(const o of i)o.el.style.transform="";for(const o of r)o.el.style.transform=""}},[n])}function E(n,s,i){const r=i?G[i.trim().toLowerCase()]:void 0;return{"--fp-z":String(n-s),"--fp-i":String(s),...r==null?{}:{"--fp-suit-hue":String(r)}}}function xe(n){if(n<1e3)return String(n);const s=n/1e3;return s<10?`${s.toFixed(1).replace(/\.0$/,"")}k`:`${Math.round(s)}k`}function O({name:n,runtime:s,state:i,action:r}){return e.jsxs("span",{className:"s-thread-participant-card","aria-hidden":"true",children:[e.jsx("strong",{children:n}),s?e.jsx("span",{children:s}):null,e.jsx("span",{children:i}),r?e.jsx("span",{className:"s-thread-participant-card-action",children:r}):null]})}function R({count:n,className:s,style:i,rosterId:r,expanded:x,onClick:m}){const u=`${n} more participant${n===1?"":"s"}`;return e.jsx("button",{type:"button",className:`s-thread-participant s-thread-participant--button ${s}`,style:i,"aria-label":`${u}; open participant list`,"aria-haspopup":"dialog","aria-controls":r,"aria-expanded":x,onClick:m,children:e.jsxs("span",{className:"s-thread-participant-face s-thread-participant-face--overflow",children:["+",xe(n)]})})}function it({showBackNav:n,isDm:s,navigate:i,route:r,canonicalConversationId:x,threadTitle:m,agentId:u,sessionId:c,detailRoute:y,participants:f,operator:d,canAddParticipants:L,onToggleAddParticipant:o}){const a=Q(),h=K(r),N=k.useRef(null),b=k.useRef(null),p=k.useId(),[v,j]=k.useState(!1);ue(N);const w=f.slice(0,4),S=Math.max(f.length-w.length,0),z=Math.max(f.length-2,0),B=Math.max(f.length-1,0),C=w.length+(S>0?1:0)+(d.active?1:0);k.useEffect(()=>{if(!v)return;const t=g=>{b.current?.contains(g.target)||j(!1)},l=g=>{g.key==="Escape"&&j(!1)};return document.addEventListener("mousedown",t),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("keydown",l)}},[v]);const $=t=>t.agent?{view:"agents-v2",agentId:t.agent.id,...h?{machineId:h}:{}}:t.sessionId?{view:"sessions",sessionId:t.sessionId,...h?{machineId:h}:{}}:null,H=t=>{const l=$(t);l&&(j(!1),P(i,l,{returnTo:r}))};return e.jsxs("div",{className:"s-thread-center-header",onClick:t=>{t.target?.closest("button,a,input,select,textarea")||!s||!y||P(i,y,{returnTo:r})},style:s&&y?{cursor:"pointer"}:void 0,onContextMenu:t=>{const l=[{kind:"action",label:"Copy Title",onSelect:()=>{A(m)}}];u&&l.push({kind:"action",label:"Copy Agent ID",onSelect:()=>{A(u)}}),!u&&c&&l.push({kind:"action",label:"Copy Session ID",onSelect:()=>{A(c)}}),l.push({kind:"action",label:"Copy Conversation ID",onSelect:()=>{A(x)}}),a(t,l)},children:[n&&e.jsx(te,{slot:"conversation",fallback:{view:"inbox"},navigate:i,label:"Back",className:"s-thread-header-back"}),e.jsx("div",{className:"s-thread-center-header-info",children:s&&y?e.jsx("button",{type:"button",className:"s-thread-center-header-name",title:`Open ${m} details`,onClick:()=>P(i,y,{returnTo:r}),children:m}):e.jsx("span",{className:"s-thread-center-header-name",children:m})}),e.jsxs("div",{className:"s-thread-center-header-right",children:[f.length>0&&e.jsxs("div",{className:"s-thread-participants",ref:t=>{N.current=t,b.current=t},"aria-label":"Conversation participants",children:[w.map((t,l)=>{const g=[t.harness,t.model,t.reasoningEffort].filter(Boolean).join(" · ")||null,I=t.agent?Z(t.agent.state??null,t.agent):null,U=t.agent?ee(t.agent.state??null,t.agent):"Session participant",q=$(t),T=q?t.agent?"Open profile":"Open session":null,Y=[t.name,g,U,T].filter(Boolean).join(", "),D=e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"s-thread-participant-face",children:[e.jsx(se,{}),e.jsx(M,{agent:t.agent??void 0,name:t.name,placement:"turn",size:28,className:"s-thread-participant-avatar"})]}),t.harness?e.jsx(J,{harness:t.harness,size:9,className:"s-thread-participant-harness",title:null}):null,e.jsx(O,{name:t.name,runtime:g,state:U,action:T})]}),F={className:"s-thread-participant",style:E(C,l,t.harness),"data-state":I??void 0,"data-compact-hidden":l>=2?"true":void 0,"data-narrow-hidden":l>=1?"true":void 0,"aria-label":Y};return q?e.jsx("button",{type:"button",...F,className:`${F.className} s-thread-participant--button`,onClick:()=>H(t),children:D},t.id):e.jsx("span",{...F,role:"group",tabIndex:0,children:D},t.id)}),S>0?e.jsx(R,{count:S,className:"s-thread-participant--desktop-overflow",style:E(C,w.length),rosterId:p,expanded:v,onClick:()=>j(t=>!t)}):null,z>0?e.jsx(R,{count:z,className:"s-thread-participant--compact-overflow",style:E(C,2),rosterId:p,expanded:v,onClick:()=>j(t=>!t)}):null,B>0?e.jsx(R,{count:B,className:"s-thread-participant--narrow-overflow",style:E(C,1),rosterId:p,expanded:v,onClick:()=>j(t=>!t)}):null,d.active?e.jsxs("span",{className:"s-thread-participant s-thread-participant--operator",style:E(C,C-1),role:"group",tabIndex:0,"aria-label":`${d.name}, you, in this conversation`,children:[e.jsx("span",{className:"s-thread-participant-face",children:e.jsx(M,{name:d.name,placement:"turn",size:28,className:"s-thread-participant-avatar"})}),e.jsx(O,{name:`${d.name} (you)`,runtime:null,state:"In this conversation",action:null})]}):e.jsxs("span",{className:"s-thread-participant-observer",role:"group",tabIndex:0,"aria-label":`${d.name}, observing, not in this conversation`,children:[e.jsx(re,{size:15,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx(O,{name:d.name,runtime:null,state:"Observing, not in this conversation",action:null})]}),v?e.jsxs("div",{id:p,className:"s-thread-participant-roster",role:"dialog","aria-label":"Conversation participants",onClick:t=>t.stopPropagation(),children:[e.jsx("strong",{className:"s-thread-participant-roster-title",children:"Participants"}),e.jsxs("div",{className:"s-thread-participant-roster-list",children:[f.map(t=>{const l=$(t),g=[t.harness,t.model].filter(Boolean).join(" · "),I=e.jsxs(e.Fragment,{children:[e.jsx(M,{agent:t.agent??void 0,name:t.name,placement:"turn",size:24,className:"s-thread-participant-roster-avatar"}),e.jsxs("span",{children:[e.jsx("strong",{children:t.name}),g?e.jsx("small",{children:g}):null]})]});return l?e.jsx("button",{type:"button",className:"s-thread-participant-roster-row",onClick:()=>H(t),children:I},t.id):e.jsx("div",{className:"s-thread-participant-roster-row",children:I},t.id)}),d.active?e.jsxs("div",{className:"s-thread-participant-roster-row",children:[e.jsx(M,{name:d.name,placement:"turn",size:24,className:"s-thread-participant-roster-avatar"}),e.jsxs("span",{children:[e.jsxs("strong",{children:[d.name," (you)"]}),e.jsx("small",{children:"Operator"})]})]}):null]})]}):null]}),L&&e.jsx("button",{type:"button",className:"s-thread-add-participant-trigger",onClick:o,title:"Add participant","aria-label":"Add participant",children:e.jsx(le,{size:14,strokeWidth:1.9,"aria-hidden":"true"})})]})]})}function lt({canonicalConversationId:n,conversationAlias:s}){return e.jsxs("div",{className:"s-thread-identity-row",children:[e.jsxs("button",{type:"button",className:"s-thread-identity-chip",title:n,onClick:()=>{A(n)},children:[e.jsx("span",{children:ne()}),e.jsx("strong",{children:ae(n)})]}),s&&e.jsxs("span",{className:"s-thread-identity-chip",title:s,children:[e.jsx("span",{children:"Alias"}),e.jsx("strong",{children:s})]})]})}function ct({agents:n,addParticipantId:s,setAddParticipantId:i,addingParticipant:r,addParticipantError:x,onCancel:m,onSubmit:u}){return e.jsxs("form",{className:"s-thread-add-participant",onSubmit:c=>{c.preventDefault(),u()},children:[e.jsxs("div",{className:"s-thread-add-participant-row",children:[e.jsxs("div",{className:"s-thread-add-participant-field",children:[e.jsx("label",{className:"s-thread-add-participant-label",htmlFor:"thread-add-participant-select",children:"Agent"}),e.jsx("select",{id:"thread-add-participant-select",className:"s-thread-add-participant-select",value:s,onChange:c=>i(c.target.value),autoFocus:!0,children:n.map(c=>e.jsx("option",{value:c.id,children:c.name},c.id))})]}),e.jsxs("div",{className:"s-thread-add-participant-actions",children:[e.jsx("button",{type:"button",className:"s-btn s-btn-sm",onClick:m,disabled:r,children:"Cancel"}),e.jsx("button",{type:"submit",className:"s-btn s-btn-primary s-btn-sm",disabled:r||s.trim().length===0,children:r?"Adding...":"Add"})]})]}),x&&e.jsx("div",{className:"s-thread-add-participant-error",children:x})]})}export{ct as AddParticipantForm,it as ConversationHeader,lt as ConversationIdentityRow};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/conversation-motion-features-D9-RmBSq.js","assets/gestures-DN4hEeqv.js","assets/index-DvLtl7rV.js","assets/index-i7TMxlwW.css","assets/use-reduced-motion-x8pJMVrG.js"])))=>i.map(i=>d[i]);
2
- import{j as e,r as g,_ as z}from"./index-DvLtl7rV.js";import{j as W,t as B,k as O,r as D,l as U,m as F,c as K,n as H,p as q}from"./conversation-model-Dc02NsGp.js";import{n as G,d as L,f as V,s as J}from"./colors-BtO5_zlx.js";import{i as C}from"./sessionRead-CvFz2RHv.js";import{n as Q,t as w,f as b}from"./time-Dhsh_2EG.js";import{u as X}from"./Provider-CtXJeLrP.js";import{o as E}from"./openContent-C6XO6kr5.js";import{g as Y,c as Z,b as ee,e as te,f as se}from"./tail-display-DcliDVkW.js";import{u as ae}from"./use-reduced-motion-x8pJMVrG.js";import{L as ie,m as f}from"./proxy-BiW5suC7.js";import{C as ne}from"./chevron-down-wciXnOQz.js";import{C as re}from"./chevron-right-D-HdlPg8.js";import{A as oe}from"./activity-DcrMApUY.js";import{T as ce}from"./terminal-9GRS_Qdc.js";import{M as le}from"./message-circle-mZCv8tvB.js";const M=60,de={planning:"Planning",inspection:"Inspection",mutation:"Mutations",execution:"Execution",verification:"Verification",coordination:"Coordination"};function N(s){if(s.kind==="think")return"planning";const t=s.tool?.toLowerCase()??"",o=s.arg?.toLowerCase()??"",r=s.text?.toLowerCase()??"",i=s.outcome?.toLowerCase()??"";return t.includes("test")||t.includes("check")||t.includes("lint")||t.includes("typecheck")||t.includes("verify")||/\b(?:bun|npm|pnpm|yarn|cargo|pytest|go|vitest|jest|playwright|cypress)\s+(?:test|run\s+(?:check|test|lint)|check|typecheck)/i.test(o)||/\b(?:\d+\s+pass|all tests passed|test passed|lint clean|tsc clean)\b/i.test(i)?"verification":t==="write"||t==="edit"||t==="strreplace"||t==="str_replace"||t==="delete"||t==="write_file"||t==="edit_file"||t==="patch"||t==="apply_patch"||t==="todowrite"||t==="todo_write"||/\b(?:git\s+apply|git\s+commit|git\s+add|rm\s+|mkdir\s+|touch\s+|sed\s+|awk\s+)/i.test(o)||/^\+\d+\s+[−-]\d+/u.test(i)?"mutation":t==="read"||t==="glob"||t==="grep"||t==="filesearch"||t==="file_search"||t==="list_dir"||t==="list_directory"||t==="view"||t==="fetch"||t==="webfetch"||t==="websearch"||t==="scout_search"||t==="search"||/\b(?:grep|find|rg|cat|head|tail|ls|git\s+status|git\s+diff|git\s+log|git\s+branch)/i.test(o)?"inspection":s.kind==="note"||/\b(?:planning|plan|evaluating|analyzing|reasoning|strategy)\b/i.test(r)?"planning":s.kind==="tool"||t==="bash"||t==="shell"||t==="terminal"||t==="exec"||t==="run"||t==="command"||t==="task"?"execution":"coordination"}function y(s){const t=s.outcome?.toLowerCase()??"";return t.includes("error")||t.includes("fail")||t.includes("exit 1")||t.includes("rejected")||t.includes("timed out")?"error":t.includes("warn")||t.includes("skipped")?"warning":s.outcome||!s.isLatest?"success":s.isActive?"working":"success"}function he(s){if(s<1e3)return`${Math.round(s)}ms`;const t=s/1e3;if(t<60)return`${t.toFixed(1).replace(/\.0$/,"")}s`;const o=Math.floor(t/60),r=Math.round(t%60);return`${o}m ${r}s`}function me(s){if(s.length===0)return[];const t=new Map;for(const c of s)t.set(c.phase,(t.get(c.phase)??0)+(c.repeatCount||1));const r=s.at(-1)?.phase??"planning";return["planning","inspection","mutation","execution","verification","coordination"].filter(c=>(t.get(c)??0)>0).map(c=>({phase:c,label:de[c],count:t.get(c)??0,active:c===r}))}function j(s,t,o){const r=o?.trim();if(!r)return;const i=r.toLowerCase();t.has(i)||(t.add(i),s.push(r))}function De(s){const t=[],o=new Set;j(t,o,s.observeSessionId);for(const r of s.flight?.sessions??[])j(t,o,r.sessionId);return j(t,o,s.agent?.harnessSessionId),j(t,o,s.sessionMeta?.harnessSessionId),t}function Ue(s,t){const o=s.sessionId?.trim().toLowerCase();return o?t.some(r=>{const i=r.trim().toLowerCase();return i?o.includes(i)||i.includes(o):!1}):!1}function A(s,t){return s.ts!==t.ts?s.ts-t.ts:s.id.localeCompare(t.id)}function Fe(s,t){const o=new Map;for(const r of[...s,...t])o.set(r.id,r);return[...o.values()].sort(A).slice(-M)}function Ke(s){const t=Y(s).sort(A),o=Z(t.map(i=>({event:i,meta:ee(i)}))),r=[];for(const i of o){if(i.event.kind==="other")continue;if(i.event.kind==="tool-result"){const m=r.at(-1);m?.kind==="tool"&&(m.outcome=i.meta.result?.outcome??m.outcome??"done",m.ts=i.event.ts,m.status=y({outcome:m.outcome}),m.phase=N({kind:m.kind,tool:m.tool,arg:m.arg,text:m.text,outcome:m.outcome}));continue}const c=ue(i.event),l=pe(i.event,te(i.event,i.meta),c);if(!l&&c!=="think")continue;const d=i.meta.tool,n=i.meta.arg?v(i.meta.arg):void 0,h=i.meta.result?.outcome,a=N({kind:c,tool:d,arg:n,text:l,outcome:h}),p=y({outcome:h}),u={id:i.event.id,ts:i.event.ts,kind:c,text:l,repeatCount:i.repeatCount,phase:a,status:p};d&&(u.tool=d),n&&(u.arg=n),h&&(u.outcome=h),r.push(u)}for(let i=0;i<r.length-1;i++){const c=r[i],l=r[i+1];c&&l&&l.ts>=c.ts&&(c.durationMs=l.ts-c.ts)}return r}const $=160;function v(s){const t=s.replace(/\s+/gu," ").trim();return t.length>$?`${t.slice(0,$-1)}…`:t}const I=/^\[thinking\]\s*$/iu;function ue(s){return I.test(s.summary.trim())?"think":se(s)}function pe(s,t,o){return o==="think"&&I.test(s.summary.trim())?"":v(t)}const xe=15e3;function ge(s){const t=s?.outcome;return typeof t=="string"&&t.trim()?t.trim():void 0}function He(s){const{observe:t,flight:o}=s;if(!t||!o)return[];const r=t.data.events.filter(n=>n.kind!=="boot"&&n.kind!=="system");if(r.length===0)return[];const i=Q(o.startedAt),c=i!==null?r.filter(n=>typeof n.at=="number"&&n.at>=i-xe):[],d=(c.length>0?c:t.data.live?r:[]).slice(-M).map(n=>{const h=ge(n.result),p=(n.diff?`+${n.diff.add} −${n.diff.del}`:void 0)||h,u=N({kind:n.kind,tool:n.tool,arg:n.arg,text:n.text,outcome:p}),m=y({outcome:p}),x={id:`observe:${t.sessionId??"session"}:${n.id}`,ts:n.at??n.t,kind:n.kind,text:v(n.text||n.tool||"step"),repeatCount:1,phase:u,status:m};return n.tool&&(x.tool=n.tool),n.arg&&(x.arg=v(n.arg)),p&&(x.outcome=p),x});for(let n=0;n<d.length-1;n++){const h=d[n],a=d[n+1];h&&a&&a.ts>=h.ts&&(h.durationMs=a.ts-h.ts)}return d}function qe(s){const t=s.at(-1);return t?t.tool?t.arg?`${t.tool} · ${t.arg}`:t.tool:t.kind==="think"?t.text||"Thinking":t.text||null:null}function Ge(s){if(s.length===0)return null;const t=s.filter(i=>i.kind==="tool").length,o=s.filter(i=>i.kind==="think").length,r=[];return t>0&&r.push(`${t} tool${t===1?"":"s"}`),o>0&&r.push(`${o} thinking`),r.length===0?`${s.length} step${s.length===1?"":"s"}`:r.join(" · ")}function Ve(s){const t=s.flight?.state;return t==="queued"?{label:"Queued",detail:"waiting for the session to come online"}:t==="waking"?{label:"Waking",detail:"starting the session"}:t==="running"||t==="waiting"?s.hasSessionScope?{label:"Session live",detail:"waiting for the first trace line"}:{label:"Session live",detail:"no trace stream for this session yet"}:s.awaitingResponse?{label:"Sent",detail:"waiting for the agent to pick this up"}:null}const fe=[{head:"30%",body:"88%",short:"62%"},{head:"22%",body:"76%",short:"48%"},{head:"34%",body:"82%",short:"68%"}],je=()=>z(()=>import("./conversation-motion-features-D9-RmBSq.js"),__vite__mapDeps([0,1,2,3,4])).then(s=>s.default);function P({onOpenTrace:s,onOpenTerminal:t,onSteer:o,compact:r=!1}){return!s&&!t&&!o?null:e.jsxs("nav",{className:`s-thread-working-actions${r?" s-thread-working-actions--compact":""}`,"aria-label":"Working turn actions",children:[s&&e.jsxs("button",{type:"button",className:"s-thread-working-action s-thread-working-action--primary",onClick:s,title:"Watch this run's live trace",children:[e.jsx(oe,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Live trace"})]}),t&&e.jsxs("button",{type:"button",className:"s-thread-working-action",onClick:t,title:"Jump into this agent's terminal",children:[e.jsx(ce,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Terminal"})]}),o&&e.jsxs("button",{type:"button",className:"s-thread-working-action",onClick:o,title:"Write an interrupting message to steer this turn",children:[e.jsx(le,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Steer…"})]})]})}const ve={think:"Thinking",tool:"Tool",ask:"Prompt",message:"Says",note:"Note",system:"System",boot:"Boot"};function k({steps:s,phase:t,limit:o=5,compact:r=!1}){const[i,c]=g.useState(()=>new Set),l=g.useCallback(a=>{c(p=>{const u=new Set(p);return u.has(a)?u.delete(a):u.add(a),u})},[]),d=g.useMemo(()=>me(s),[s]),n=s.slice(-o),h=s.length-n.length;return n.length===0?t?e.jsxs("div",{className:"s-thread-steps-phase surface-card surface-card--inset",children:[e.jsxs("div",{className:"s-thread-steps-phase-header",children:[e.jsx("span",{className:"dot dot--sm dot--working dot--pulse dot--glow","aria-hidden":"true"}),e.jsx("span",{className:"label-xs text-muted",children:t.label})]}),e.jsx("strong",{className:"s-thread-steps-phase-detail",children:t.detail})]}):null:e.jsxs("div",{className:`s-thread-steps${r?" s-thread-steps--compact":""}`,children:[d.length>0&&e.jsx("div",{className:"s-thread-turn-phases-ribbon",role:"status","aria-label":"Execution phases",children:d.map(a=>e.jsxs("span",{className:`s-thread-turn-phase-chip chip chip--sm chip--mono ${a.active?"chip--working s-thread-turn-phase-chip--active":"chip--neutral"}`,children:[a.active&&e.jsx("span",{className:"dot dot--sm dot--working dot--pulse dot--glow","aria-hidden":"true"}),e.jsx("span",{className:"s-thread-turn-phase-name",children:a.label}),e.jsx("span",{className:"s-thread-turn-phase-count",children:a.count})]},a.phase))}),h>0&&e.jsxs("div",{className:"s-thread-steps-elided label-xs",children:[h," earlier step",h===1?"":"s"]}),e.jsx("ol",{className:"s-thread-steps-list","aria-label":"Live steps in this turn",children:n.map((a,p)=>{const u=p===n.length-1,m=i.has(a.id),x=!!(a.arg&&a.arg.length>30||a.outcome||a.text.length>50);return e.jsxs("li",{className:`s-thread-step-card s-thread-step-card--${a.status}${u?" s-thread-step-card--latest":""}${m?" s-thread-step-card--expanded":""}`,"data-kind":a.kind,"data-phase":a.phase,"data-status":a.status,children:[e.jsxs("div",{className:"s-thread-step-header",children:[e.jsx("span",{className:"s-thread-step-mark s-thread-step-indicator","aria-hidden":"true",children:a.status==="working"||u&&!a.outcome?e.jsx("span",{className:"dot dot--sm dot--working dot--pulse dot--glow"}):a.status==="error"?e.jsx("span",{className:"dot dot--sm dot--danger"}):a.status==="warning"?e.jsx("span",{className:"dot dot--sm dot--warning"}):e.jsx("span",{className:"dot dot--sm dot--success"})}),e.jsx("span",{className:"s-thread-step-kind chip chip--sm chip--mono chip--ghost",children:a.tool?a.tool:ve[a.kind]}),e.jsxs("div",{className:"s-thread-step-body",children:[a.tool?e.jsx("span",{className:"s-thread-step-tool-arg",children:a.arg?e.jsx("code",{className:"s-thread-step-arg-code",children:a.arg}):e.jsx("span",{className:"s-thread-step-tool",children:a.tool})}):e.jsx("span",{className:"s-thread-step-text",children:a.text}),a.repeatCount>1&&e.jsxs("span",{className:"s-thread-step-repeat chip chip--sm chip--mono chip--neutral",children:["×",a.repeatCount]})]}),e.jsxs("div",{className:"s-thread-step-meta",children:[a.outcome&&e.jsx("span",{className:`s-thread-step-outcome chip chip--sm chip--mono ${a.outcome.includes("+")?"chip--success":a.status==="error"?"chip--danger":"chip--neutral"}`,children:a.outcome}),a.durationMs?e.jsx("span",{className:"s-thread-step-duration label-xs",children:he(a.durationMs)}):null,e.jsx("time",{className:"label-xs",title:b(a.ts),children:w(a.ts)}),x&&e.jsx("button",{type:"button",className:"s-thread-step-toggle btn btn--ghost btn--icon","aria-expanded":m,onClick:()=>l(a.id),title:m?"Collapse output":"Expand output",children:m?e.jsx(ne,{size:12}):e.jsx(re,{size:12})})]})]}),m&&e.jsxs("div",{className:"s-thread-step-output surface-card surface-card--inset",children:[e.jsxs("div",{className:"s-thread-step-output-header",children:[e.jsx("span",{className:"label-xs text-muted",children:"Telemetry Detail"}),e.jsxs("span",{className:"label-xs text-dim",children:[a.phase.toUpperCase()," · ",a.status.toUpperCase()]})]}),e.jsx("pre",{className:"s-thread-step-output-code",children:e.jsxs("code",{children:[a.tool?`tool: ${a.tool}
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/conversation-motion-features-BJnHs3Ul.js","assets/gestures-YA5IIwp-.js","assets/index-C1VaWNuD.js","assets/index-i7TMxlwW.css","assets/use-reduced-motion-CPoX8iV2.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,r as g,_ as z}from"./index-C1VaWNuD.js";import{j as W,t as B,k as O,r as D,l as U,m as F,c as K,n as H,p as q}from"./conversation-model-C2KuZUXc.js";import{n as G,d as L,f as V,s as J}from"./colors-BtO5_zlx.js";import{i as C}from"./sessionRead-CvFz2RHv.js";import{n as Q,t as w,f as b}from"./time-Dhsh_2EG.js";import{u as X}from"./Provider-D0bB7q6y.js";import{o as E}from"./openContent-C6XO6kr5.js";import{g as Y,c as Z,b as ee,e as te,f as se}from"./tail-display-DcliDVkW.js";import{u as ae}from"./use-reduced-motion-CPoX8iV2.js";import{L as ie,m as f}from"./proxy-DVDRhSRR.js";import{C as ne}from"./chevron-down-D120PY4g.js";import{C as re}from"./chevron-right-CowuvuE6.js";import{A as oe}from"./activity-CzTJ-YMX.js";import{T as ce}from"./terminal-UDy4lzV1.js";import{M as le}from"./message-circle-joGFxfj1.js";const M=60,de={planning:"Planning",inspection:"Inspection",mutation:"Mutations",execution:"Execution",verification:"Verification",coordination:"Coordination"};function N(s){if(s.kind==="think")return"planning";const t=s.tool?.toLowerCase()??"",o=s.arg?.toLowerCase()??"",r=s.text?.toLowerCase()??"",i=s.outcome?.toLowerCase()??"";return t.includes("test")||t.includes("check")||t.includes("lint")||t.includes("typecheck")||t.includes("verify")||/\b(?:bun|npm|pnpm|yarn|cargo|pytest|go|vitest|jest|playwright|cypress)\s+(?:test|run\s+(?:check|test|lint)|check|typecheck)/i.test(o)||/\b(?:\d+\s+pass|all tests passed|test passed|lint clean|tsc clean)\b/i.test(i)?"verification":t==="write"||t==="edit"||t==="strreplace"||t==="str_replace"||t==="delete"||t==="write_file"||t==="edit_file"||t==="patch"||t==="apply_patch"||t==="todowrite"||t==="todo_write"||/\b(?:git\s+apply|git\s+commit|git\s+add|rm\s+|mkdir\s+|touch\s+|sed\s+|awk\s+)/i.test(o)||/^\+\d+\s+[−-]\d+/u.test(i)?"mutation":t==="read"||t==="glob"||t==="grep"||t==="filesearch"||t==="file_search"||t==="list_dir"||t==="list_directory"||t==="view"||t==="fetch"||t==="webfetch"||t==="websearch"||t==="scout_search"||t==="search"||/\b(?:grep|find|rg|cat|head|tail|ls|git\s+status|git\s+diff|git\s+log|git\s+branch)/i.test(o)?"inspection":s.kind==="note"||/\b(?:planning|plan|evaluating|analyzing|reasoning|strategy)\b/i.test(r)?"planning":s.kind==="tool"||t==="bash"||t==="shell"||t==="terminal"||t==="exec"||t==="run"||t==="command"||t==="task"?"execution":"coordination"}function y(s){const t=s.outcome?.toLowerCase()??"";return t.includes("error")||t.includes("fail")||t.includes("exit 1")||t.includes("rejected")||t.includes("timed out")?"error":t.includes("warn")||t.includes("skipped")?"warning":s.outcome||!s.isLatest?"success":s.isActive?"working":"success"}function he(s){if(s<1e3)return`${Math.round(s)}ms`;const t=s/1e3;if(t<60)return`${t.toFixed(1).replace(/\.0$/,"")}s`;const o=Math.floor(t/60),r=Math.round(t%60);return`${o}m ${r}s`}function me(s){if(s.length===0)return[];const t=new Map;for(const c of s)t.set(c.phase,(t.get(c.phase)??0)+(c.repeatCount||1));const r=s.at(-1)?.phase??"planning";return["planning","inspection","mutation","execution","verification","coordination"].filter(c=>(t.get(c)??0)>0).map(c=>({phase:c,label:de[c],count:t.get(c)??0,active:c===r}))}function j(s,t,o){const r=o?.trim();if(!r)return;const i=r.toLowerCase();t.has(i)||(t.add(i),s.push(r))}function De(s){const t=[],o=new Set;j(t,o,s.observeSessionId);for(const r of s.flight?.sessions??[])j(t,o,r.sessionId);return j(t,o,s.agent?.harnessSessionId),j(t,o,s.sessionMeta?.harnessSessionId),t}function Ue(s,t){const o=s.sessionId?.trim().toLowerCase();return o?t.some(r=>{const i=r.trim().toLowerCase();return i?o.includes(i)||i.includes(o):!1}):!1}function A(s,t){return s.ts!==t.ts?s.ts-t.ts:s.id.localeCompare(t.id)}function Fe(s,t){const o=new Map;for(const r of[...s,...t])o.set(r.id,r);return[...o.values()].sort(A).slice(-M)}function Ke(s){const t=Y(s).sort(A),o=Z(t.map(i=>({event:i,meta:ee(i)}))),r=[];for(const i of o){if(i.event.kind==="other")continue;if(i.event.kind==="tool-result"){const m=r.at(-1);m?.kind==="tool"&&(m.outcome=i.meta.result?.outcome??m.outcome??"done",m.ts=i.event.ts,m.status=y({outcome:m.outcome}),m.phase=N({kind:m.kind,tool:m.tool,arg:m.arg,text:m.text,outcome:m.outcome}));continue}const c=ue(i.event),l=pe(i.event,te(i.event,i.meta),c);if(!l&&c!=="think")continue;const d=i.meta.tool,n=i.meta.arg?v(i.meta.arg):void 0,h=i.meta.result?.outcome,a=N({kind:c,tool:d,arg:n,text:l,outcome:h}),p=y({outcome:h}),u={id:i.event.id,ts:i.event.ts,kind:c,text:l,repeatCount:i.repeatCount,phase:a,status:p};d&&(u.tool=d),n&&(u.arg=n),h&&(u.outcome=h),r.push(u)}for(let i=0;i<r.length-1;i++){const c=r[i],l=r[i+1];c&&l&&l.ts>=c.ts&&(c.durationMs=l.ts-c.ts)}return r}const $=160;function v(s){const t=s.replace(/\s+/gu," ").trim();return t.length>$?`${t.slice(0,$-1)}…`:t}const I=/^\[thinking\]\s*$/iu;function ue(s){return I.test(s.summary.trim())?"think":se(s)}function pe(s,t,o){return o==="think"&&I.test(s.summary.trim())?"":v(t)}const xe=15e3;function ge(s){const t=s?.outcome;return typeof t=="string"&&t.trim()?t.trim():void 0}function He(s){const{observe:t,flight:o}=s;if(!t||!o)return[];const r=t.data.events.filter(n=>n.kind!=="boot"&&n.kind!=="system");if(r.length===0)return[];const i=Q(o.startedAt),c=i!==null?r.filter(n=>typeof n.at=="number"&&n.at>=i-xe):[],d=(c.length>0?c:t.data.live?r:[]).slice(-M).map(n=>{const h=ge(n.result),p=(n.diff?`+${n.diff.add} −${n.diff.del}`:void 0)||h,u=N({kind:n.kind,tool:n.tool,arg:n.arg,text:n.text,outcome:p}),m=y({outcome:p}),x={id:`observe:${t.sessionId??"session"}:${n.id}`,ts:n.at??n.t,kind:n.kind,text:v(n.text||n.tool||"step"),repeatCount:1,phase:u,status:m};return n.tool&&(x.tool=n.tool),n.arg&&(x.arg=v(n.arg)),p&&(x.outcome=p),x});for(let n=0;n<d.length-1;n++){const h=d[n],a=d[n+1];h&&a&&a.ts>=h.ts&&(h.durationMs=a.ts-h.ts)}return d}function qe(s){const t=s.at(-1);return t?t.tool?t.arg?`${t.tool} · ${t.arg}`:t.tool:t.kind==="think"?t.text||"Thinking":t.text||null:null}function Ge(s){if(s.length===0)return null;const t=s.filter(i=>i.kind==="tool").length,o=s.filter(i=>i.kind==="think").length,r=[];return t>0&&r.push(`${t} tool${t===1?"":"s"}`),o>0&&r.push(`${o} thinking`),r.length===0?`${s.length} step${s.length===1?"":"s"}`:r.join(" · ")}function Ve(s){const t=s.flight?.state;return t==="queued"?{label:"Queued",detail:"waiting for the session to come online"}:t==="waking"?{label:"Waking",detail:"starting the session"}:t==="running"||t==="waiting"?s.hasSessionScope?{label:"Session live",detail:"waiting for the first trace line"}:{label:"Session live",detail:"no trace stream for this session yet"}:s.awaitingResponse?{label:"Sent",detail:"waiting for the agent to pick this up"}:null}const fe=[{head:"30%",body:"88%",short:"62%"},{head:"22%",body:"76%",short:"48%"},{head:"34%",body:"82%",short:"68%"}],je=()=>z(()=>import("./conversation-motion-features-BJnHs3Ul.js"),__vite__mapDeps([0,1,2,3,4])).then(s=>s.default);function P({onOpenTrace:s,onOpenTerminal:t,onSteer:o,compact:r=!1}){return!s&&!t&&!o?null:e.jsxs("nav",{className:`s-thread-working-actions${r?" s-thread-working-actions--compact":""}`,"aria-label":"Working turn actions",children:[s&&e.jsxs("button",{type:"button",className:"s-thread-working-action s-thread-working-action--primary",onClick:s,title:"Watch this run's live trace",children:[e.jsx(oe,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Live trace"})]}),t&&e.jsxs("button",{type:"button",className:"s-thread-working-action",onClick:t,title:"Jump into this agent's terminal",children:[e.jsx(ce,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Terminal"})]}),o&&e.jsxs("button",{type:"button",className:"s-thread-working-action",onClick:o,title:"Write an interrupting message to steer this turn",children:[e.jsx(le,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Steer…"})]})]})}const ve={think:"Thinking",tool:"Tool",ask:"Prompt",message:"Says",note:"Note",system:"System",boot:"Boot"};function k({steps:s,phase:t,limit:o=5,compact:r=!1}){const[i,c]=g.useState(()=>new Set),l=g.useCallback(a=>{c(p=>{const u=new Set(p);return u.has(a)?u.delete(a):u.add(a),u})},[]),d=g.useMemo(()=>me(s),[s]),n=s.slice(-o),h=s.length-n.length;return n.length===0?t?e.jsxs("div",{className:"s-thread-steps-phase surface-card surface-card--inset",children:[e.jsxs("div",{className:"s-thread-steps-phase-header",children:[e.jsx("span",{className:"dot dot--sm dot--working dot--pulse dot--glow","aria-hidden":"true"}),e.jsx("span",{className:"label-xs text-muted",children:t.label})]}),e.jsx("strong",{className:"s-thread-steps-phase-detail",children:t.detail})]}):null:e.jsxs("div",{className:`s-thread-steps${r?" s-thread-steps--compact":""}`,children:[d.length>0&&e.jsx("div",{className:"s-thread-turn-phases-ribbon",role:"status","aria-label":"Execution phases",children:d.map(a=>e.jsxs("span",{className:`s-thread-turn-phase-chip chip chip--sm chip--mono ${a.active?"chip--working s-thread-turn-phase-chip--active":"chip--neutral"}`,children:[a.active&&e.jsx("span",{className:"dot dot--sm dot--working dot--pulse dot--glow","aria-hidden":"true"}),e.jsx("span",{className:"s-thread-turn-phase-name",children:a.label}),e.jsx("span",{className:"s-thread-turn-phase-count",children:a.count})]},a.phase))}),h>0&&e.jsxs("div",{className:"s-thread-steps-elided label-xs",children:[h," earlier step",h===1?"":"s"]}),e.jsx("ol",{className:"s-thread-steps-list","aria-label":"Live steps in this turn",children:n.map((a,p)=>{const u=p===n.length-1,m=i.has(a.id),x=!!(a.arg&&a.arg.length>30||a.outcome||a.text.length>50);return e.jsxs("li",{className:`s-thread-step-card s-thread-step-card--${a.status}${u?" s-thread-step-card--latest":""}${m?" s-thread-step-card--expanded":""}`,"data-kind":a.kind,"data-phase":a.phase,"data-status":a.status,children:[e.jsxs("div",{className:"s-thread-step-header",children:[e.jsx("span",{className:"s-thread-step-mark s-thread-step-indicator","aria-hidden":"true",children:a.status==="working"||u&&!a.outcome?e.jsx("span",{className:"dot dot--sm dot--working dot--pulse dot--glow"}):a.status==="error"?e.jsx("span",{className:"dot dot--sm dot--danger"}):a.status==="warning"?e.jsx("span",{className:"dot dot--sm dot--warning"}):e.jsx("span",{className:"dot dot--sm dot--success"})}),e.jsx("span",{className:"s-thread-step-kind chip chip--sm chip--mono chip--ghost",children:a.tool?a.tool:ve[a.kind]}),e.jsxs("div",{className:"s-thread-step-body",children:[a.tool?e.jsx("span",{className:"s-thread-step-tool-arg",children:a.arg?e.jsx("code",{className:"s-thread-step-arg-code",children:a.arg}):e.jsx("span",{className:"s-thread-step-tool",children:a.tool})}):e.jsx("span",{className:"s-thread-step-text",children:a.text}),a.repeatCount>1&&e.jsxs("span",{className:"s-thread-step-repeat chip chip--sm chip--mono chip--neutral",children:["×",a.repeatCount]})]}),e.jsxs("div",{className:"s-thread-step-meta",children:[a.outcome&&e.jsx("span",{className:`s-thread-step-outcome chip chip--sm chip--mono ${a.outcome.includes("+")?"chip--success":a.status==="error"?"chip--danger":"chip--neutral"}`,children:a.outcome}),a.durationMs?e.jsx("span",{className:"s-thread-step-duration label-xs",children:he(a.durationMs)}):null,e.jsx("time",{className:"label-xs",title:b(a.ts),children:w(a.ts)}),x&&e.jsx("button",{type:"button",className:"s-thread-step-toggle btn btn--ghost btn--icon","aria-expanded":m,onClick:()=>l(a.id),title:m?"Collapse output":"Expand output",children:m?e.jsx(ne,{size:12}):e.jsx(re,{size:12})})]})]}),m&&e.jsxs("div",{className:"s-thread-step-output surface-card surface-card--inset",children:[e.jsxs("div",{className:"s-thread-step-output-header",children:[e.jsx("span",{className:"label-xs text-muted",children:"Telemetry Detail"}),e.jsxs("span",{className:"label-xs text-dim",children:[a.phase.toUpperCase()," · ",a.status.toUpperCase()]})]}),e.jsx("pre",{className:"s-thread-step-output-code",children:e.jsxs("code",{children:[a.tool?`tool: ${a.tool}
3
3
  `:"",a.arg?`args: ${a.arg}
4
4
  `:"",a.outcome?`outcome: ${a.outcome}
5
5
  `:"",a.text?`text: ${a.text}
@@ -0,0 +1,2 @@
1
+ import{j as r,r as o}from"./index-C1VaWNuD.js";import{o as pt,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-D2Ah4T-W.js";import{a as U}from"./api-Co9aQ2Jw.js";import"./runtime-picker-C20lTGhV.js";import{u as ma,C as ha}from"./ConversationComposer-BUIjWMBi.js";import"./index-Cx6Gbr6n.js";import{u as pa,i as fa,b as ga}from"./Provider-D0bB7q6y.js";import{d as ya,b as ba,v as ne,y as Ps,z as wa,A as Ce,B as Sa,D as Ta,E as va,F as xa,c as qs,S as Ds,G as Ca,H as Ma,I as ka,J as Na,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 Ha,X as Us,Y as Wa,Z as _a,_ as Qe,u as Ka,$ as Qa,a0 as za,a1 as Hs,a2 as Va,a3 as Ja,a4 as Ga,a5 as Ya,a6 as Ws,a7 as Xa,a8 as _s,a9 as Za,aa as er,ab as tr}from"./conversation-model-C2KuZUXc.js";import{u as sr}from"./sse-B29iGBnw.js";import{n as Yt,t as ft,f as Ks}from"./time-Dhsh_2EG.js";import{M as nr}from"./message-markup-DC0QFEZn.js";import{c as Qs,i as Xt,b as ar}from"./message-visibility-CGOmSSKs.js";import{d as rr}from"./operator-attention-RqieiSY8.js";import{b as or}from"./router-kfcaYqZr.js";import{f as Zt,a as ir}from"./scoutbot-D7kGGyK_.js";import{s as lr}from"./sessionRead-CvFz2RHv.js";import{o as gt}from"./openContent-C6XO6kr5.js";import{c as ze}from"./clipboard-e3fSpeo7.js";import{A as es}from"./AgentAvatar-Dz79iTxB.js";import{d as cr}from"./types-B0PlfpKc.js";/* empty css */import{ConversationHeader as dr,ConversationIdentityRow as ur,AddParticipantForm as mr}from"./ConversationHeader-Bt2RBj93.js";import{FanOutRow as hr,ThreadDayDivider as pr}from"./ConversationFeedRows-Bx0gFyG_.js";import{T as fr,t as zs,m as Vs,a as gr,b as yr,o as br,d as wr,s as Sr,l as Tr,c as vr,e as xr,W as Cr,f as Mr,g as kr}from"./ConversationPanels-o6W-cOoU.js";import{u as Nr}from"./tail-events-LK29oCKm.js";import{PinnedAskCard as Ar,ConversationStatusStrip as Ir}from"./ConversationStatus-CTYOywFh.js";import"./HarnessMark-DttReffF.js";import"./colors-BtO5_zlx.js";import"./NewChatOrigin-DCn5cWPZ.js";import"./keyboard-nav-B8sQ_8IF.js";import"./x-DgmmnPKt.js";import"./createLucideIcon-Dv8H8m7J.js";import"./chevron-down-D120PY4g.js";import"./search-FB2vVxCp.js";import"./loader-circle-DmUG_YC7.js";import"./file-text-BHro8MkG.js";import"./perf-PX8Rx0EP.js";import"./scout-voice-Cg1qfepC.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./zap-Bcja1lHG.js";import"./surface-activity-B1rgWB1i.js";import"./model-CBkMvT1w.js";import"./DocumentFocusViewer-D8iB6SMt.js";import"./TextDocumentSurface-2X1Gw4eA.js";import"./chevron-right-CowuvuE6.js";import"./code-xml-CkkNdRmu.js";import"./arrow-left-eToA6GxC.js";import"./arrow-right-DTX42clh.js";import"./chunk-HRAB3GC3-KjjrTLCU.js";import"./index-BWHgHrtv.js";import"./mentions-BZ5SBMtc.js";import"./AgentDetailCard-8viaEY8b.js";import"./AgentLiveActions-DlSKL60c.js";import"./terminal-takeover-BMeBjBB2.js";import"./eye-C9cGk5z6.js";import"./terminal-UDy4lzV1.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-Bdt2W3Y4.js";import"./SpriteAvatar-DFO4Kb4Z.js";import"./CrewAvatar-CZ_faQ_s.js";import"./BackToPicker-BHicJyfc.js";import"./AstronautSuit-CwB4Dw07.js";import"./tail-display-DcliDVkW.js";import"./lane-edit-display-C_Aujldz.js";import"./use-reduced-motion-CPoX8iV2.js";import"./proxy-DVDRhSRR.js";import"./activity-CzTJ-YMX.js";import"./message-circle-joGFxfj1.js";import"./check-Dz2SRHft.js";import"./sparkles-D0vWLTyC.js";const Zs="scout:conversations:failure-dismissals:v1",jr=64;let ns={};function en(){try{if(typeof localStorage<"u"){const n=JSON.parse(localStorage.getItem(Zs)??"null");Lr(n)&&(ns=as(n))}}catch{}return as(ns)}function Rr(n){ns=as(n);try{typeof localStorage<"u"&&localStorage.setItem(Zs,JSON.stringify(n))}catch{}}function Js(n){return new Set(en()[n]??[])}function Er(n,c){const d=en(),f=(d[n]??[]).filter(N=>N!==c);f.push(c),d[n]=f.slice(-100);const y=Object.keys(d);for(const N of y.slice(0,Math.max(0,y.length-jr)))delete d[N];return Rr(d),new Set(d[n])}function as(n){return Object.fromEntries(Object.entries(n).map(([c,d])=>[c,[...d]]))}function Lr(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 $r=/\.(?:apng|avif|gif|jpe?g|png|svg|webp)(?:$|[?#])/iu,Fr=/\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 Or(n){return n.mediaType.toLowerCase().startsWith("image/")}function Pr(n){return $r.test(n)}function qr(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 Dr(n){const c=new Set,d=[];for(const f of n.matchAll(Fr)){const y=f[0]?.replace(/[.,;:!?]+$/u,""),N=Ve(y);!N||c.has(N)||(c.add(N),d.push(N))}return d}const Br=/^\/api\/blobs\/[^/]+$/u;function ts(n){try{const c=new URL(n);return Br.test(c.pathname)?`${c.pathname}${c.search}`:n}catch{return n}}function yt(n){return Ve(n.url)??Ve(z(n.metadata,"url"))??Ve(z(n.metadata,"href"))}function Ur(n){const c=n.metadata??null,d=z(c,"kind")??z(c,"type"),f=yt(n);if(!f||d!=="link_preview"&&d!=="link-preview"&&n.mediaType!=="text/x-uri")return null;const y=qr(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 Hr({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 Wr({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 _r({message:n}){const c=n.attachments??[],d=new Set,f=[],y=[];for(const h of c){const $=yt(h);if($&&Or(h)){d.add(h.id),f.push({id:h.id,src:ts($),alt:h.fileName??"Image attachment"});continue}const b=Ur(h);b&&(d.add(h.id),y.push(b))}const N=new Set(y.map(h=>h.url)),G=new Set(c.map(yt).filter(h=>!!h));for(const h of Dr(n.body))G.has(h)||N.has(h)||Pr(h)&&f.push({id:h,src:ts(h),alt:"Embedded image"});const k=c.filter(h=>!d.has(h.id));return f.length===0&&y.length===0&&k.length===0?null:r.jsxs("div",{className:"s-message-embeds",children:[f.map(h=>r.jsx(Hr,{src:h.src,alt:h.alt},h.id)),y.slice(0,1).map(h=>r.jsx(Wr,{preview:h},h.id)),k.map(h=>{const $=yt(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 Kr(n){const{sessionIds:c,active:d}=n,f=c.join("|"),y=d&&c.length>0,[N,G]=o.useState([]);return o.useEffect(()=>{G([])},[f]),o.useEffect(()=>{if(!y)return;let k=!1;const h=new URLSearchParams({limit:String(fr*3),transcripts:"true"});return U(`/api/tail/recent?${h.toString()}`).then($=>{if(k)return;const b=($.events??[]).filter(u=>zs(u,c));b.length!==0&&G(u=>Vs(u,b))}).catch(()=>{}),()=>{k=!0}},[y,f]),Nr(k=>{y&&zs(k,c)&&G(h=>Vs(h,[k]))},y),o.useMemo(()=>y?gr(N):[],[y,N])}const Qr=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 zr=64;function Vr(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 Jr(n){return n instanceof TypeError||typeof DOMException<"u"&&n instanceof DOMException&&n.name==="AbortError"}function pi({conversationId:n,initialDraft:c,navigate:d,embedded:f,showBackNav:y=!0,treatment:N="standard"}){const{agents:G,route:k,openContextCapture:h}=pa(),$=or(k),b=o.useMemo(()=>fa(G,$),[G,$]),[u,bt]=o.useState(null),rs=o.useRef(null);rs.current=u;const Je=o.useMemo(()=>pt(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 e=Me.current;return e===null?null:new Set(T.filter(t=>!e.has(t.id)).map(t=>t.id))},[T]),Ge=Me.current===null&&T.length>0;o.useEffect(()=>{if(T.length===0)return;const e=Me.current??new Set;for(const t of T)e.add(t.id);Me.current=e},[T]),o.useEffect(()=>{Me.current=null,os(pt(n)!==null)},[n]);const ls=!nn&&T.length===0,V=o.useCallback(e=>{sn(t=>{const s=t[n]??pt(n)??[],a=typeof e=="function"?e(s):e,i=aa(n,a);return{...t,[n]:i}})},[n]),an=Jt(n),[g,ge]=o.useState(an),[ke,Ne]=o.useState([]),[Ye,wt]=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),[St,ds]=o.useState(()=>Js(n)),[ye,Tt]=o.useState(!1),[on,Ie]=o.useState(!1),[vt,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 e=Re.current,t=je.current;!e||!t||(t.scrollTop=e.scrollTop+(t.scrollHeight-e.scrollHeight),Re.current=null,st.current=!0)}),o.useEffect(()=>{Tt(!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 e=>{let s=typeof e.metadata?.flightId=="string"?e.metadata.flightId.trim():"";if(!s&&e.replyToMessageId)try{s=(await U(`/api/flights?conversationId=${encodeURIComponent(n)}&active=false`)).find(i=>i.messageId===e.replyToMessageId)?.id??""}catch{}await rr({...s?{flightId:s}:{},conversationId:n,messageId:e.replyToMessageId??e.id,itemUpdatedAt:Yt(e.createdAt)??Date.now()})},[n]),hs=o.useCallback(e=>{const t=e.replyToMessageId??e.id;ds(Er(n,e.id)),Zt({type:"dismiss-conversation-failure",conversationId:n,messageId:t,reason:"The operator cleared this delivery issue"});const s=`${n}:${e.id}`;Oe.current.add(s),nt(e).catch(()=>{Oe.current.delete(s)})},[n,nt]);o.useEffect(()=>{for(const e of T){if(!St.has(e.id)||!Qs(e))continue;const t=`${n}:${e.id}`;Oe.current.has(t)||(Oe.current.add(t),nt(e).catch(()=>{Oe.current.delete(t)}))}},[n,St,T,nt]);const C=u?.agentId??null,M=u?.kind==="direct",at=o.useMemo(()=>new Set([n,...u?.equivalentConversationIds??[]]),[n,u?.equivalentConversationIds]),K=o.useMemo(()=>C?b.find(e=>e.id===C)??null:null,[b,C]),ps=ya(u),dn=ba({resolvedAgentId:K?.id,sessionId:ps,machineId:$}),[xt,fs]=o.useState(null);o.useEffect(()=>{U("/api/fleet").then(e=>{fs(t=>ne(t,Ps(e.activeAsks,n,C)))}).catch(()=>{})},[n,C]);const D=o.useCallback(async(e={})=>{const t=e.messageMode??"none",s=e.includeMetadata??!0;ae(null);try{const a=s?await U(`/api/session/${encodeURIComponent(n)}`).catch(()=>null):rs.current;if(Y.current!==n)return;bt(v=>ne(v,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=pt(l),R=ra(l),w=t==="initial"&&!R,p=t==="refresh"||t==="initial",S=Promise.all([U(`/api/flights?conversationId=${encodeURIComponent(l)}`).catch(()=>[]),U("/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(v=>!Xt(v));W&&V(v=>ne(v,Sa(v,fe))),os(!0),lr(l);const E=L.at(-1);E&&Fe.current!==E.id&&(Fe.current=E.id,U(`/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),xe=_??J;Le.current=new Set([...se.map(v=>v.invocationId),...J?.invocationId?.startsWith("pending:")?[]:J?.invocationId?[J.invocationId]:[]]),_&&J?.id===_.id&&Os(l,_.id);const P=xe?.agentId??i??null,Vt=va(Q.activity,xe,l,P),ht=xa(Q.activeAsks,xe,l,P);ge(v=>ne(v,xe)),Ne(v=>ne(v,Vt)),Ae(v=>ne(v,ht)),fs(v=>ne(v,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(()=>{D({messageMode:"initial"})},[D]),o.useEffect(()=>{Fe.current=null},[n]),o.useEffect(()=>{$e.current=g},[g]);const un=o.useCallback(async()=>{if(ye||!Fs(n))return;const e=je.current,t=e?{scrollHeight:e.scrollHeight,scrollTop:e.scrollTop}:null;Tt(!0),ae(null);try{const s=await la(n);if(Y.current!==n)return;t&&(Re.current=t),V(Ce(s).filter(a=>!Xt(a)))}catch(s){Y.current===n&&ae(s instanceof Error?s.message:String(s))}finally{Y.current===n&&Tt(!1)}},[n,ye,V]),[I,B]=o.useState(()=>c??""),[oe,ie]=o.useState(null),[H,rt]=o.useState(!1),[x,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,ot]=o.useState(!1),[Mt,it]=o.useState(""),[hn,De]=o.useState(null),[pn,kt]=o.useState(!1);o.useEffect(()=>{ot(!1),it(""),De(null),kt(!1)},[n]),o.useEffect(()=>{if(!c)return;const e=`${n}:${c}`;ms.current!==e&&(ms.current=e,B(c),requestAnimationFrame(()=>A.current?.focus()))},[n,c]);const Z=o.useMemo(()=>{const e=new Map;for(const t of u?.participants??[])e.set(t.actorId,t),t.agentId&&e.set(t.agentId,t);return e},[u]),Nt=o.useMemo(()=>{const e=new Set,t=[];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();e.has(l)||(e.add(l),t.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();e.has(i)||(e.add(i),t.push({id:s.id,label:a,name:s.name??a,handle:a}))}return t.sort((s,a)=>s.handle.localeCompare(a.handle))},[Z,b,u]),fn=o.useMemo(()=>{if(!le.open)return[];const e=le.query.toLowerCase();return e?Ds.filter(t=>t.command.toLowerCase().startsWith("/"+e)||t.command.toLowerCase().includes(e)):Ds},[le.open,le.query]),gn=o.useMemo(()=>{if(!ce.open)return[];const e=ce.query.toLowerCase();return e?Nt.filter(t=>t.handle.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)||t.label.toLowerCase().includes(e)).slice(0,8):Nt.slice(0,8)},[ce.open,ce.query,Nt]),yn=o.useCallback(()=>{Pe(e=>e.open?{...e,open:!1}:e),qe(e=>e.open?{...e,open:!1}:e)},[]),bn=o.useCallback((e,t)=>{const s=Ca(e,t);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(e,t);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(e=>{const t=A.current,s=le.triggerStart;if(s<0)return;const a=t?.selectionStart??I.length,i=I.slice(0,s),l=I.slice(a),m=e.insert,R=`${i}${m}${l}`;B(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(e=>{const t=A.current,s=ce.triggerStart;if(s<0)return;const a=t?.selectionStart??I.length,i=I.slice(0,s),l=I.slice(a),m=l.length===0||!l.startsWith(" "),R=`@${e.handle}${m?" ":""}`,w=`${i}${R}${l}`;B(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 e=A.current;if(!e)return;e.style.height="0px";const t=Math.min(Math.max(e.scrollHeight,40),160);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>t?"auto":"hidden"},[I]),o.useEffect(()=>{U("/api/user").then(e=>mn(e.name)).catch(()=>{})},[]);const lt=o.useMemo(()=>ka(T,x),[T,x]);o.useEffect(()=>{F===null||lt===null||lt>=F&&X(null)},[F,lt]);const Tn=o.useMemo(()=>Na(g),[g]),we=Date.now(),vn=Aa(g,lt,we),At=Tn&&!Ia(g)&&!vn,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:C,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=Xa(It,we),[,xn]=o.useState(0);o.useEffect(()=>{if(!j.showTyping||jt===null)return;const e=Math.max(0,Date.now()-jt),t=[Ws.sustained,Ws.long].find(a=>a>e);if(t===void 0)return;const s=window.setTimeout(()=>xn(a=>a+1),t-e+50);return()=>window.clearTimeout(s)},[jt,j.showTyping,bs]);const Cn="Live",Rt=o.useMemo(()=>Ea({currentFlight:g,presence:j,turnActivity:ke,turnAsk:Xe,awaitingResponseSince:F,nowMs:we}),[F,g,we,j,ke,Xe]),Mn="s-thread-msg-card s-thread-msg-working-card s-thread-msg-card--avatar-row",kn="s-thread-msg-kind",Nn="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,ct=$a(u?.workspaceRoot),En=j.tone,Lt=T.length===0&&M&&(j.showTyping||g!==null||ke.length>0||Xe!==null||F!==null),Ss=o.useMemo(()=>u?u.participantIds.includes("operator"):M,[M,u]),Be=g?.agentId??C,Ue=Be?Gt(b,[Be]):null,He=Ue?.id??Be,We=g?.sessions.at(-1)?.sessionId??Ue?.harnessSessionId??void 0,Ts=g?.id?()=>{gt(d,{view:"sessions",flightId:g.id,...He?{agentId:He}:{},...We?{sessionId:We}:{},...$?{machineId:$}:{}},{returnTo:k})}:void 0,vs=g?.id??null;o.useEffect(()=>{if(!vs||!He){wt(null);return}let e=!1;const t=We?`?sessionId=${encodeURIComponent(We)}`:"",s=async()=>{try{const i=await U(`/api/agents/${encodeURIComponent(He)}/observe${t}`);if(e)return;wt(l=>ne(l,i))}catch{}};s();const a=window.setInterval(()=>{s()},Qr);return()=>{e=!0,window.clearInterval(a),wt(null)}},[vs,He,We]);const $t=o.useMemo(()=>yr({flight:g,agent:Ue??K,sessionMeta:u,observeSessionId:Ye?.sessionId}),[K,g,u,Ye?.sessionId,Ue]),xs=Kr({sessionIds:$t,active:j.showTyping||Lt}),Ln=o.useMemo(()=>br({observe:Ye,flight:g}),[g,Ye]),ee=xs.length>0?xs:Ln,Ft=o.useMemo(()=>ee.length>0?null:wr({flight:g,hasSessionScope:$t.length>0,awaitingResponse:F!==null}),[F,g,$t.length,ee.length]),Ot=Sr(ee),Pt=Tr(ee),Cs=ee.at(-1)??null,qt=Cs?ft(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)?()=>{gt(d,{view:"terminal",agentId:Be,mode:"takeover"},{returnTo:k})}: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(t=>t!=="operator"):C?[C]:[]).map(t=>{const s=Gt(b,[t]),a=Z.get(t);return{id:t,name:a?.scopedAlias??s?.name??a?.displayName??qs(t)??t,title:a?.label??s?.id??t,agent:s,sessionId:a?.sessionId??null,harness:s?.harness??a?.harness??null,model:s?.model??null,reasoningEffort:s?.reasoningEffort??null}}),[C,Z,b,u]),On=o.useMemo(()=>({name:x,active:Ss}),[Ss,x]),ue=o.useMemo(()=>new Map(T.map(e=>[e.id,e])),[T]),Bt=o.useMemo(()=>b.find(e=>ir(e)&&!!e.conversationId?.trim())?.conversationId?.trim()??null,[b]),_e=o.useMemo(()=>Oa(T),[T]),[Pn,Ut]=o.useState(()=>new Set),qn=o.useCallback(e=>{Ut(t=>{const s=new Set(t);return s.delete(e)||s.add(e),s})},[]),ks=o.useMemo(()=>{const e=new Map;for(const t of _e)if(t.kind==="fanout")for(const s of t.messages)e.set(s.id,t.key);return e},[_e]),dt=o.useCallback(e=>{const t=ks.get(e);t&&Ut(l=>l.has(t)?l:new Set(l).add(t));const s=document.getElementById(`msg-${e}`);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)},[ks]);o.useEffect(()=>{const e=()=>rn(Gs(window.location.hash));return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]),o.useEffect(()=>{if(!Ze||!ue.has(Ze))return;const e=window.setTimeout(()=>dt(Ze),50);return()=>window.clearTimeout(e)},[Ze,ue,dt]),sr(o.useCallback(e=>{if(e.kind==="message.posted"){const t=e.payload?.message;if(!t||!at.has(t.conversationId))return;const s=t.actorId==="operator",a=M&&!s&&t.class==="agent",i={id:t.id,conversationId:t.conversationId,actorId:t.actorId,actorName:a?O:Pa(t.actorId,b,x),body:t.body,createdAt:t.createdAt,class:s?"operator":t.class,attachments:t.attachments,metadata:t.metadata,replyToMessageId:t.replyToMessageId??t.n??null};if(Xt(i))return;if(V(l=>{const m=Vr(t.metadata),R=m?re.current.get(m):void 0;if(l.some(w=>w.id===t.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(t.createdAt)??Date.now();X(m=>m===null||l<m||Da($e.current)?m:null),ge(m=>Ba(m)?null:m)}return}if(e.kind==="invocation.requested"){const t=e.payload?.invocation;if(!Ua(t,at))return;Le.current.add(t.id),Ne([]),Ae(null),X(s=>s??Date.now());return}if(e.kind==="conversation.upserted"){const t=e.payload?.conversation;t?.id&&at.has(t.id)&&D({messageMode:"none",includeMetadata:!1});return}if(e.kind==="flight.updated"){const t=e.payload?.flight;if(!t||t.targetAgentId!==C||!(Le.current.has(t.invocationId)||$e.current?.id===t.id))return;if(Ha.has(t.state)){Os(n,t.id),ge(l=>l?.id===t.id?null:l),Ne([]),Ae(null),X(null),D({messageMode:"refresh",includeMetadata:!1});return}Le.current.add(t.invocationId);const a=$e.current?.id===t.id,i=Us(t,n,C??"",$e.current);Wa(i)&&X(null),ge(i),a||(Ne([]),Ae(null));return}e.kind!=="agent.endpoint.upserted"&&e.kind==="unknown"&&D({messageMode:"refresh"})},[C,O,n,at,M,D,x,b])),o.useEffect(()=>{if(!gs)return;const e=setInterval(()=>{D({messageMode:"refresh",includeMetadata:!1})},5e3);return()=>clearInterval(e)},[gs,D]),o.useEffect(()=>{const e=()=>{if(document.visibilityState!=="visible")return;const t=Date.now();t-us.current<1e3||(us.current=t,D({messageMode:"refresh"}))};return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[D]);const Ht=o.useRef(null),Ns=o.useRef(!1),Wt=o.useRef(!1),_t=o.useCallback(e=>{const t=je.current;t&&(tt.current=!0,be.current!==null&&clearTimeout(be.current),e==="instant"?t.scrollTop=t.scrollHeight:t.scrollTo({top:t.scrollHeight,behavior:"smooth"}),be.current=setTimeout(()=>{tt.current=!1,be.current=null},e==="smooth"?700:0))},[]);o.useEffect(()=>()=>{be.current!==null&&clearTimeout(be.current)},[]);const Dn=o.useCallback(()=>{const e=je.current;if(!e||tt.current)return;const s=e.scrollHeight-e.clientHeight-e.scrollTop<=zr;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 e=T.at(-1)?.id??null,t=!!(e&&e!==Ht.current),s=_a({newestMessageId:e,previousNewestMessageId:Ht.current,showTyping:j.showTyping,previousShowTyping:Ns.current,historyRestorePending:st.current||Re.current!==null,initialScrollDone:Wt.current,nearBottom:Ee.current});s!=="none"?(_t(s),Wt.current=!0):t&&Wt.current&&!Ee.current&&(Ie(!0),et(a=>a+1)),st.current=!1,Ht.current=e,Ns.current=j.showTyping});const[,Un]=o.useState(0);o.useEffect(()=>{const e=setInterval(()=>Un(t=>t+1),15e3);return()=>clearInterval(e)},[]);const me=ma(),[he,te]=o.useState([]),[As,ut]=o.useState("queue"),[Se,Te]=o.useState(null),ve=async(e,t)=>{const s=e.trim(),a=t?.attachments??[],i=t?.replyTarget??null;if(!s&&a.length===0||H)return"failed";const m=t?.forceAction??_s({isDm:M,hasOutstandingReply:ys}),R=Date.now(),w=da(),p={id:`optimistic-${w}`,conversationId:n,actorId:"operator",actorName:x,body:s,createdAt:R,class:"operator",...i?{replyToMessageId:i.messageId}:{},metadata:{clientMessageId:w,deliveryState:"sending"},...a.length>0?{attachments:a}:{}};rt(!0),m!=="message"&&X(R),ae(null),re.current.set(w,p.id),V(S=>Ce([...S,p]));try{const S=await U(`/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,C??"")),Ne([]),Ae(null)):m!=="message"&&X(null),"sent"}catch(S){return Jr(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{rt(!1)}},Hn=async e=>{const t=e.replyToMessageId?ue.get(e.replyToMessageId):null;if(!t||H)return;const s=[];for(const i of t.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 ve(t.body,{forceAction:"invoke",attachments:s})!=="failed"&&hs(e)},Wn=(e,t,s)=>{if(!Bt)return;const a=e.replyToMessageId?ue.get(e.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 ${t}.`,s,"","Original request:",i].join(`
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 e=I.trim(),t=oe,s=me.files,a=Se?.attachments??[];if(!e&&s.length===0&&a.length===0)return null;let i=[];if(s.length>0){rt(!0);try{i=await ua(s)}catch(l){return me.setError(l instanceof Error?l.message:String(l)),null}finally{rt(!1)}}return B(""),ie(null),me.clear(),Te(null),{body:e,attachments:[...a,...i],replyTarget:t}},Kn=async()=>{const e=er({isAgentBusy:pe,intent:As}),t=Se?.id??null,s=await _n();if(!s)return;if(e==="queue"){te(l=>t?l.map(m=>m.id===t?{...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}t&&te(l=>l.filter(m=>m.id!==t));const a=()=>{B(s.body),Te(s.attachments.length>0?{id:null,attachments:s.attachments}:null),ie(s.replyTarget),requestAnimationFrame(()=>A.current?.focus())};if(e==="steer"){ut("queue"),await Qt(),await ve(s.body,{forceAction:"steer",attachments:s.attachments,replyTarget:s.replyTarget})==="failed"&&a();return}await ve(s.body,{attachments:s.attachments,replyTarget:s.replyTarget})==="failed"&&a()},Qn=e=>{te(t=>t.filter(s=>s.id!==e)),Te(t=>t?.id===e?null:t)},zn=e=>{const t=he.find(s=>s.id===e);t&&(B(t.body),ie(t.replyTarget??null),Te({id:e,attachments:t.attachments}),requestAnimationFrame(()=>{const s=A.current;s&&(s.focus(),s.setSelectionRange(s.value.length,s.value.length))}))},Vn=()=>{Te(null),B(""),ie(null),me.clear()},Jn=async e=>{const t=he.find(a=>a.id===e);if(!t)return;te(a=>a.filter(i=>i.id!==e)),await Qt(),await ve(t.body,{forceAction:"steer",attachments:t.attachments,replyTarget:t.replyTarget??null})==="failed"&&te(a=>[t,...a])},mt=o.useCallback((e,t)=>{const s=t?.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;B(m),ie({messageId:e.id,actorLabel:s?`@${s}`:e.actorName,preview:Ys(e),insertedMention:l?a:null}),requestAnimationFrame(()=>A.current?.focus())},[I,M,oe?.insertedMention]),Gn=o.useCallback(()=>{const e=oe?.insertedMention;ie(null),e&&B(t=>Xs(t,e)),requestAnimationFrame(()=>A.current?.focus())},[oe]),Kt=o.useCallback(e=>{const t=new URL(window.location.href);k.view==="agents-v2"&&t.searchParams.set("tab","message"),t.hash=`msg-${e}`,ze(t.toString())},[k.view]),Is=o.useCallback((e,t,s)=>{const a=ca({conversationId:n,selectedMessageId:e.id,messages:T.map(i=>({id:i.id,actorLabel:i.id===e.id?t:Qe(i,x)?x: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,x]),Qt=async()=>{if(C)try{await U("/api/agents/"+encodeURIComponent(C)+"/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 #${Ka(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 e=Se?.id??null,t=e?he.filter(a=>a.id!==e):he;if(!Qa({isAgentBusy:pe,sending:H,queued:t})||zt.current)return;const s=t[0];s&&(zt.current=!0,te(a=>a.filter(i=>i.id!==s.id)),ve(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||ut("queue")},[pe]),o.useEffect(()=>{te([]),Te(null),ie(null),ut("queue"),me.clear()},[n]);const ea=za(he),Rs=ga(),ta=o.useCallback((e,t)=>{const s=window.getSelection()?.toString().trim(),a=Qe(t,x),i=t.actorId?Z.get(t.actorId):null,l=a?null:Hs(t,b,C),m=(i?.scopedAlias?.trim()||l?.handle?.trim()||null)?.replace(/^@+/,"")??null,R=m?`@${m}`:t.actorName,w=(l?.id||i?.agentId||t.actorId||"").trim(),p=[];a||p.push({kind:"action",label:"Reply",onSelect:()=>mt(t,m)}),p.push({kind:"action",label:"Forward to new task…",onSelect:()=>Is(t,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(t.body)}}),p.push({kind:"action",label:"Copy Link",onSelect:()=>Kt(t.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(t.id)}}),Rs(e,p)},[C,mt,Kt,Is,x,Z,b,Rs]),sa=async(e,t)=>{const s=`@${t.agentId} `,a=I.trim();if(a){B(""),await ve(`${s}${a}`,{forceAction:"invoke"});return}B(s),A.current?.focus()},Ke=o.useMemo(()=>{if(!u)return[];const e=new Set(u.participantIds);return b.filter(t=>!e.has(t.id)&&!t.retiredFromFleet).sort((t,s)=>t.name.localeCompare(s.name))},[u,b]);o.useEffect(()=>{Ct&&it(e=>e&&Ke.some(t=>t.id===e)?e: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 e=Mt.trim();if(e){kt(!0),De(null);try{const t=await U(`/api/conversations/${encodeURIComponent(u.id)}/members`,{method:"POST",body:JSON.stringify({actorId:e})});t.session?bt(t.session):bt(s=>s&&{...s,kind:t.kind,participantIds:t.participantIds}),ot(!1),it(""),await D({messageMode:"none"})}catch(t){De(t instanceof Error?t.message:String(t))}finally{kt(!1)}}},[Mt,D,u]);return r.jsx("div",{className:`s-thread-layout${f?" s-thread-layout--embedded":""}`,"data-thread-treatment":N==="standard"?void 0:N,children:r.jsxs("div",{className:"s-thread-center",children:[!f&&r.jsx(dr,{showBackNav:y,isDm:M,navigate:d,route:k,canonicalConversationId:ws,threadTitle:Et,agentId:K?.id??null,sessionId:ps,detailRoute:dn,participants:Fn,operator:On,canAddParticipants:Es,onToggleAddParticipant:()=>{De(null),ot(e=>!e)}}),!f&&u&&r.jsx(ur,{canonicalConversationId:ws,conversationAlias:Rn}),!f&&Ct&&Es&&r.jsx(mr,{agents:Ke,addParticipantId:Mt,setAddParticipantId:it,addingParticipant:pn,addParticipantError:hn,onCancel:()=>{ot(!1),De(null)},onSubmit:()=>{na()}}),xt&&r.jsx(Ar,{pinnedAsk:xt,onAnswer:()=>{const e=[...T].reverse().find(t=>t.actorId===xt.agentId)??[...T].reverse().find(t=>!Qe(t,x)&&t.class!=="status"&&t.class!=="system");e?mt(e,e.actorId?Z.get(e.actorId)?.scopedAlias??null:null):A.current?.focus()},onSteer:Dt}),r.jsx(Ir,{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(vr,{}):T.length===0?Lt?r.jsx(xr,{agentName:O,title:j.label,detail:j.detail||de.latest,snapshot:de,events:ke,steps:ee,phase:Ft,tone:En,workspaceName:ct,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."}),(ct||u?.currentBranch)&&r.jsxs("div",{className:"s-thread-empty-chips",children:[ct&&r.jsx("span",{className:"s-thread-empty-chip",children:ct}),u?.currentBranch&&r.jsx("span",{className:"s-thread-empty-chip",children:u.currentBranch})]})]}):_e.map((e,t)=>{const s=Va(e,t);if(e.kind==="fanout")return r.jsx(hr,{row:e,expanded:Pn.has(e.key),showDayDivider:s,onToggle:()=>qn(e.key)},e.key);const a=e.message,i=Qe(a,x),l=Ja(a),m=l?"scout.dispatch":a.class,R=Za(m),w=m==="status",p=Ks(a.createdAt),S=i?null:Hs(a,b,C),L=Z.get(a.actorId)?.scopedAlias?.trim()||null,fe=!i&&L?L:a.actorName,E=i?x.toLowerCase():L??S?.handle??null,se=Ga(a.body),Q=se?Ya({flightId:se.flightId,replyToMessageId:a.replyToMessageId,messagesById:ue,agents:b,operatorName:x}):null,_=!se&&a.replyToMessageId?ue.get(a.replyToMessageId)??null:null,J=_?Qe(_,x)?x:_.actorName:null,xe=se?se.body:a.body,P=Qs(a);if(P&&St.has(a.id))return null;const Vt=typeof a.metadata?.targetAgentId=="string"?a.metadata.targetAgentId:null,ht=P?Gt(b,[Vt,P.target]):null,v=P?Bs({name:ht?.name,id:ht?.id,title:ar(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(pr,{at:a.createdAt}),P&&v?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-t))*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:[v," 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,v,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 ${v}`,children:"Clear"})]})]}),r.jsx("span",{className:"s-thread-failure-notice-time",title:p,children:ft(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-t))*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?()=>gt(d,{view:"agents-v2",agentId:S.id},{returnTo:k}):null,Ls=i?x: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:()=>gt(d,{view:"agents-v2",agentId:S.id},{returnTo:k}),title:`View profile for ${a.actorName}`,children:fe}):r.jsx("span",{className:"s-thread-msg-actor",children:i?x: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:ft(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:()=>mt(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:()=>dt(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:()=>dt(_.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(nr,{text:xe})}),r.jsx(_r,{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:kn,children:Cn})]}),r.jsx("span",{className:"s-thread-msg-time",title:g?.startedAt?Ks(g.startedAt):"now",children:g?.startedAt?ft(g.startedAt):"now"})]}),r.jsxs("div",{className:"s-thread-msg-working-body",children:[r.jsxs("div",{className:Nn,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(Cr,{steps:ee,phase:Ft,limit:5,compact:!0}):r.jsx(Mr,{events:ke,limit:4,compact:!0}),r.jsx(kr,{onOpenTrace:Ts,onOpenTerminal:Ms,onSteer:Dt,compact:!0})]})]})]})})}),on&&vt>0&&r.jsxs("button",{type:"button",className:"s-thread-new-messages",onClick:Bn,children:[r.jsx("span",{"aria-hidden":"true",children:"↓"})," ",vt," new ",vt===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:B,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:ut,queued:he,queueNote:ea,onEditQueued:zn,editingQueuedId:Se?.id??null,editingAttachmentCount:js.length,onCancelEdit:Vn,onUnqueue:Qn,onSendQueuedNow:e=>{Jn(e)}})]})})}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 fi=cr({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:tr}});export{pi as ConversationScreen,fi as scoutSurface};