@openscout/scout 0.2.76 → 0.2.78

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 (372) hide show
  1. package/README.md +41 -2
  2. package/bin/openscout-runtime.mjs +48 -30
  3. package/bin/scout.mjs +2 -2
  4. package/bin/scoutd +0 -0
  5. package/dist/build-manifest.json +3 -3
  6. package/dist/client/assets/ActivityScreen-Cu_1V4bq.js +1 -0
  7. package/dist/client/assets/AddProjectForm-DMnobKch.js +1 -0
  8. package/dist/client/assets/AgentAvatar-D90c1Rzk.js +1 -0
  9. package/dist/client/assets/AgentConfigurationScreen-BqfOz90D.js +1 -0
  10. package/dist/client/assets/AgentDefinitionsWorkspace-CUpUrY57.js +1 -0
  11. package/dist/client/assets/AgentDetailCard-BcRBRp88.js +1 -0
  12. package/dist/client/assets/AgentDetailCard-C4WVeJvJ.css +1 -0
  13. package/dist/client/assets/AgentFloorView-8LoAEBwS.js +1 -0
  14. package/dist/client/assets/AgentInfoScreen-DZs2_ibL.js +1 -0
  15. package/dist/client/assets/AgentLaneCard-RrNnDZu8.js +1 -0
  16. package/dist/client/assets/AgentLaneChrome-D9ZwUKrl.js +1 -0
  17. package/dist/client/assets/AgentLaneDetailSheet-BXbPls9N.js +5 -0
  18. package/dist/client/assets/AgentLaneSummaryResize-BhFmGNzT.js +1 -0
  19. package/dist/client/assets/AgentLanesEmbedScreen-W3qs022h.js +1 -0
  20. package/dist/client/assets/AgentLanesPreflight-eSAoDsPi.js +1 -0
  21. package/dist/client/assets/AgentLanesView-B9vuEEmZ.js +2 -0
  22. package/dist/client/assets/AgentLiveActions-CGS-Bxb7.css +1 -0
  23. package/dist/client/assets/AgentLiveActions-DBtnD0qE.js +1 -0
  24. package/dist/client/assets/AgentSessions-DyqOf4nG.js +6 -0
  25. package/dist/client/assets/AgentsConsole-BgiYP2wR.js +1 -0
  26. package/dist/client/assets/AgentsConsole-BjSTs-TV.css +1 -0
  27. package/dist/client/assets/AgentsScreen-DBi8x4MB.js +1 -0
  28. package/dist/client/assets/AgentsSubnav-DIEO4NPx.js +1 -0
  29. package/dist/client/assets/AtopView-BCkae3e1.js +1 -0
  30. package/dist/client/assets/BackToPicker-BRvfostO.js +1 -0
  31. package/dist/client/assets/BackToPicker-CdgVu-to.css +1 -0
  32. package/dist/client/assets/BriefingDetailScreen-BwFyysT8.js +6 -0
  33. package/dist/client/assets/BriefingsScreen-BQEevztH.js +1 -0
  34. package/dist/client/assets/BrokerMetadataPanel-7UjcuNjd.js +1 -0
  35. package/dist/client/assets/BrokerScreen-7ekklu88.js +5 -0
  36. package/dist/client/assets/ChatCollapsedStrip-CQSYSd8s.js +1 -0
  37. package/dist/client/assets/CodeDiffPane-DDPt6KPh.js +1 -0
  38. package/dist/client/assets/CodeProjectPicker-DqKFCpLU.js +2 -0
  39. package/dist/client/assets/CodeScreen-BxCrpRHd.js +1 -0
  40. package/dist/client/assets/ContextMenu-bARZqTzD.js +1 -0
  41. package/dist/client/assets/ConversationComposer-Bla3DDvM.js +1 -0
  42. package/dist/client/assets/ConversationFeedRows-B_gPxcqA.js +1 -0
  43. package/dist/client/assets/ConversationHeader-DE3FC0m-.js +1 -0
  44. package/dist/client/assets/ConversationPanels-DLek4H6A.js +2 -0
  45. package/dist/client/assets/ConversationScreen-BDRhx-RU.js +1 -0
  46. package/dist/client/assets/ConversationScreen-C9yMAMYF.css +1 -0
  47. package/dist/client/assets/ConversationStatus-BwVLiiO4.js +1 -0
  48. package/dist/client/assets/DataTable-E8s_MmoA.js +1 -0
  49. package/dist/client/assets/DispatchAftermath-Dpe88DFX.js +1 -0
  50. package/dist/client/assets/DocumentFocusViewer-BeVwwl26.js +1 -0
  51. package/dist/client/assets/EmbeddableSurfacesLab-BQqFQVnI.js +1 -0
  52. package/dist/client/assets/EmptyState-4F9XDFQm.js +1 -0
  53. package/dist/client/assets/FileViewerPane-CLgUhSm4.js +3 -0
  54. package/dist/client/assets/FleetSearch-Dz5euQJe.js +1 -0
  55. package/dist/client/assets/FleetSearch-EXOe8ulE.css +1 -0
  56. package/dist/client/assets/FlightObserveScreen-6RpZYwVz.js +1 -0
  57. package/dist/client/assets/FollowScreen-DZ4qfYOY.js +1 -0
  58. package/dist/client/assets/HarnessMark-Cbv3Ib0c.js +1 -0
  59. package/dist/client/assets/HarnessesScreen-CznAImej.js +1 -0
  60. package/dist/client/assets/HomeHero-B3uYd-pP.js +1 -0
  61. package/dist/client/assets/HomeHero-DEl-WBsT.css +1 -0
  62. package/dist/client/assets/KnowledgeSearchInspector-Dgdkfvvz.js +1 -0
  63. package/dist/client/assets/KnowledgeSearchScreen-DJDGGaqC.js +1 -0
  64. package/dist/client/assets/LaneToolHoverCard-Bla0gBdm.js +1 -0
  65. package/dist/client/assets/LaneTraceDetailSheet-D1CspRbl.js +1 -0
  66. package/dist/client/assets/LaneTraceEventFocus-BF9ERP5O.js +1 -0
  67. package/dist/client/assets/MeshCanvas-DFEPkpqY.js +3 -0
  68. package/dist/client/assets/MeshCanvasMinimap-CyVFYixr.js +1 -0
  69. package/dist/client/assets/MeshCanvasMinimap-Dv7nMbl5.css +1 -0
  70. package/dist/client/assets/MeshScreen-DFgevn8N.js +1 -0
  71. package/dist/client/assets/MeshTopologyView-CalkZghg.js +2 -0
  72. package/dist/client/assets/MessageComposerSuggestions-DpxN9WiB.js +1 -0
  73. package/dist/client/assets/MessagesScreen-C8YKW10Y.js +1 -0
  74. package/dist/client/assets/MissionControlView-lUeAiSVg.js +1 -0
  75. package/dist/client/assets/MissionFocusOverlay-wlCmWDCT.js +1 -0
  76. package/dist/client/assets/MissionLeftAgentRow-BpZWntfl.js +1 -0
  77. package/dist/client/assets/MissionLogPane-__MVtEl9.js +1 -0
  78. package/dist/client/assets/NewAgentModal-Bg-eWHpY.js +1 -0
  79. package/dist/client/assets/NewAgentModal-ru8u5YdJ.css +1 -0
  80. package/dist/client/assets/NewChatComposer-Cs6OsxK6.js +19 -0
  81. package/dist/client/assets/NewChatComposer-W-t-L4oV.css +1 -0
  82. package/dist/client/assets/NewChatOrigin-Bk2OyVjI.js +1 -0
  83. package/dist/client/assets/ObserveEmbedScreen-y2EpuqRZ.js +2 -0
  84. package/dist/client/assets/ObserveTextFlow-rsFj_rVo.js +2 -0
  85. package/dist/client/assets/ObservedTopologyPanel-BsBsvVPL.css +1 -0
  86. package/dist/client/assets/ObservedTopologyPanel-DyUeV98H.js +2 -0
  87. package/dist/client/assets/OpenScoutAppShell-Bh6FnEJO.css +1 -0
  88. package/dist/client/assets/OpenScoutAppShell-C_URc8sV.js +87 -0
  89. package/dist/client/assets/OpsAgentsView-UN7iOscs.js +1 -0
  90. package/dist/client/assets/OpsScreen-Buf3LKjb.js +1 -0
  91. package/dist/client/assets/OpsSubnav-DsuXzHah.js +1 -0
  92. package/dist/client/assets/PlanView-C1CjH3PG.js +1 -0
  93. package/dist/client/assets/ProjectAgentProfile-DJusrAV-.js +1 -0
  94. package/dist/client/assets/ProjectAgentProfileBar-CtTpj6fU.js +1 -0
  95. package/dist/client/assets/ProjectAgentProfileHero-BFwNJo_N.js +1 -0
  96. package/dist/client/assets/ProjectsInbox-GhVMxOhw.js +2 -0
  97. package/dist/client/assets/ProjectsRail-BgiuV4LR.js +1 -0
  98. package/dist/client/assets/ProjectsScreen-eNUBy4YU.js +1 -0
  99. package/dist/client/assets/ProjectsThreadAside-CoBgnHmr.js +1 -0
  100. package/dist/client/assets/Provider-C7UKGHQy.js +1 -0
  101. package/dist/client/assets/Provider-CCzjtkda.css +1 -0
  102. package/dist/client/assets/RailRow-BoGxAHNF.js +1 -0
  103. package/dist/client/assets/RailRow-Cf9LOiEj.css +1 -0
  104. package/dist/client/assets/RawSessionsTable-DL8y_eEy.js +1 -0
  105. package/dist/client/assets/RealtimeVoiceScreen-ffS-39zy.js +1 -0
  106. package/dist/client/assets/RepoDiffEmbedScreen-C0rumUME.js +1 -0
  107. package/dist/client/assets/RepoDiffPageScreen-DMv6DioL.js +1 -0
  108. package/dist/client/assets/RepoDiffViewer-D_exm6xK.js +7 -0
  109. package/dist/client/assets/RepoDiffViewerLazy-BPgF92Bg.js +2 -0
  110. package/dist/client/assets/ReposScreen-CB_YBWYf.js +6 -0
  111. package/dist/client/assets/ScoutDeckSurface-CxIYFyWx.js +1 -0
  112. package/dist/client/assets/ScoutDeckSurface-uhmuZRzC.css +1 -0
  113. package/dist/client/assets/ScoutSurface-CYz_TcWC.js +1 -0
  114. package/dist/client/assets/ScoutbotBroadcastChip-CxtYZWPZ.css +1 -0
  115. package/dist/client/assets/ScoutbotBroadcastChip-L_R9atj0.js +2 -0
  116. package/dist/client/assets/ScoutbotFxLab-CgiZMDMW.js +4 -0
  117. package/dist/client/assets/ScoutbotRealtimeVoiceCall-FMQOr1Np.js +1 -0
  118. package/dist/client/assets/SecondaryNav-B3-nh5dM.js +1 -0
  119. package/dist/client/assets/SessionEmbedScreen-BVC7yvWF.js +1 -0
  120. package/dist/client/assets/SessionObserve-BpggNO_M.css +1 -0
  121. package/dist/client/assets/SessionObserve-yfXFafp8.js +12 -0
  122. package/dist/client/assets/SessionRefScreen-DRgJu7Jo.js +1 -0
  123. package/dist/client/assets/SessionsScreen-D6XUsZfA.js +1 -0
  124. package/dist/client/assets/SettingsDrawer-CmJt72ww.css +1 -0
  125. package/dist/client/assets/SettingsDrawer-XfdAa_nD.js +3 -0
  126. package/dist/client/assets/SettingsScreen-Cy8z-EuR.js +1 -0
  127. package/dist/client/assets/ShikiPane-Ap1iPxYb.js +15 -0
  128. package/dist/client/assets/SlidePanel-Bg5dVaIa.css +1 -0
  129. package/dist/client/assets/SlidePanel-COwtoJqR.js +1 -0
  130. package/dist/client/assets/SpriteAvatar-DyaGuhik.js +1 -0
  131. package/dist/client/assets/StatusPill-DhBL__p8.js +1 -0
  132. package/dist/client/assets/TailView-DGj_5HA9.js +2 -0
  133. package/dist/client/assets/TailView-Mj3AU2u0.css +1 -0
  134. package/dist/client/assets/Terminal-CqvGbjXU.js +1 -0
  135. package/dist/client/assets/TerminalEmbedScreen-DuZZFFzW.js +1 -0
  136. package/dist/client/assets/TextDocumentSurface-BpAw4eQS.js +4 -0
  137. package/dist/client/assets/TmuxPeek-m1osv33Q.js +1 -0
  138. package/dist/client/assets/VoicePermissionsPanel-DsK53ar4.js +1 -0
  139. package/dist/client/assets/VoicePermissionsPanel-RijAZ1gP.css +1 -0
  140. package/dist/client/assets/WorkDetailScreen-Bx0JimPC.js +5 -0
  141. package/dist/client/assets/WorkFilesViewer-Btl6C2Q1.js +1 -0
  142. package/dist/client/assets/activity-CA8qS6PI.js +1 -0
  143. package/dist/client/assets/{addon-fit-BOSszMLK.js → addon-fit-BZ-kXjeN.js} +1 -1
  144. package/dist/client/assets/{addon-webgl-WE840gr0.js → addon-webgl-D9-EQVEK.js} +1 -1
  145. package/dist/client/assets/agent-chat-Bfjd9y6c.js +1 -0
  146. package/dist/client/assets/agent-definitions-CymTYqvo.css +1 -0
  147. package/dist/client/assets/agent-directory-studio-injection-Bc8590z5.css +1 -0
  148. package/dist/client/assets/agent-essentials-BSY1o46q.js +1 -0
  149. package/dist/client/assets/agent-floor-CuJr1iK1.css +1 -0
  150. package/dist/client/assets/agent-lane-card-Dm7YWoew.css +1 -0
  151. package/dist/client/assets/agent-lane-card-model-r2frk57c.js +1 -0
  152. package/dist/client/assets/agent-lane-detail-Djm3YJEa.js +1 -0
  153. package/dist/client/assets/agent-lane-preview-CmHVe3dU.js +4 -0
  154. package/dist/client/assets/agent-lanes-BDNktFBZ.css +1 -0
  155. package/dist/client/assets/agent-lanes-model-B4YTt4OF.js +2 -0
  156. package/dist/client/assets/agents-detail-redesign-h34ROjOW.css +1 -0
  157. package/dist/client/assets/agents-project-COzHxZAF.css +1 -0
  158. package/dist/client/assets/agents-project-model-UYiamtrU.js +1 -0
  159. package/dist/client/assets/agents-screen-BMu6PpRY.css +1 -0
  160. package/dist/client/assets/api-BkjHJfgJ.js +1 -0
  161. package/dist/client/assets/api-h5zurxmi.js +1 -0
  162. package/dist/client/assets/{arc.es-KGqGKGIy.js → arc.es-CQBb-dVu.js} +1 -1
  163. package/dist/client/assets/arrow-down-BPLe0am9.js +1 -0
  164. package/dist/client/assets/arrow-left-DEZzHiPS.js +1 -0
  165. package/dist/client/assets/arrow-up-right-ClxBnsi7.js +1 -0
  166. package/dist/client/assets/bash-format-BRV5C6Gv.js +1 -0
  167. package/dist/client/assets/bot-eu8pBNvI.js +1 -0
  168. package/dist/client/assets/briefings-BwuAFQK6.css +1 -0
  169. package/dist/client/assets/broker-display-pp33bLsu.js +2 -0
  170. package/dist/client/assets/cache-Dr0why2k.js +2 -0
  171. package/dist/client/assets/check-DjgFiBxb.js +1 -0
  172. package/dist/client/assets/chevron-down-BGk5qoEw.js +1 -0
  173. package/dist/client/assets/chevron-right-XiIHsk4m.js +1 -0
  174. package/dist/client/assets/chunk-T65CQEWV-CrzwSeEt.js +1 -0
  175. package/dist/client/assets/chunk-YOZR3KYS-Bet8khjg.js +47 -0
  176. package/dist/client/assets/clipboard-e3fSpeo7.js +1 -0
  177. package/dist/client/assets/code-screen-DrKinCyh.css +1 -0
  178. package/dist/client/assets/code-xml-B6jOCM4V.js +1 -0
  179. package/dist/client/assets/collapsed-strip-Dz-of2SM.css +1 -0
  180. package/dist/client/assets/colors-BtO5_zlx.js +1 -0
  181. package/dist/client/assets/console-B1IBqLI_.css +1 -0
  182. package/dist/client/assets/content-BDt9VBPk.js +1 -0
  183. package/dist/client/assets/content-BIXf4cKR.js +1 -0
  184. package/dist/client/assets/content-BLm0NBJM.js +1 -0
  185. package/dist/client/assets/content-C2EwTb2y.js +1 -0
  186. package/dist/client/assets/content-C5UbLsDF.js +1 -0
  187. package/dist/client/assets/content-CHU0wwA3.css +1 -0
  188. package/dist/client/assets/content-CR3vdrYY.js +1 -0
  189. package/dist/client/assets/content-CSPVmo2s.js +1 -0
  190. package/dist/client/assets/content-C_FGqx1X.js +1 -0
  191. package/dist/client/assets/content-CvlVUOG8.js +1 -0
  192. package/dist/client/assets/content-D5kJmfgl.js +1 -0
  193. package/dist/client/assets/content-DTpQsomG.js +1 -0
  194. package/dist/client/assets/content-DikVsqLf.js +1 -0
  195. package/dist/client/assets/content-DlUe5Ono.js +1 -0
  196. package/dist/client/assets/content-GIBv_55n.js +1 -0
  197. package/dist/client/assets/content-Q2oclDzi.js +1 -0
  198. package/dist/client/assets/context-budget-CbB4BDcO.js +1 -0
  199. package/dist/client/assets/conversation-icons-IIG5ha6D.js +1 -0
  200. package/dist/client/assets/conversation-model-B47vYmWN.js +1 -0
  201. package/dist/client/assets/conversation-motion-features-BdAONVls.js +1 -0
  202. package/dist/client/assets/conversation-prefs-DNre-Lcx.js +1 -0
  203. package/dist/client/assets/copy-CQGYbxdu.js +1 -0
  204. package/dist/client/assets/createLucideIcon-OpA4Amw5.js +1 -0
  205. package/dist/client/assets/ctx-panel-B4s49N9e.css +1 -0
  206. package/dist/client/assets/discover-C1YwpBDE.js +2 -0
  207. package/dist/client/assets/document-focus-viewer-BSC_JwVE.css +1 -0
  208. package/dist/client/assets/embed-entry-BAcGL3g9.js +2 -0
  209. package/dist/client/assets/external-link-CXBytO9o.js +1 -0
  210. package/dist/client/assets/eye-0PvebX_a.js +1 -0
  211. package/dist/client/assets/file-text-BODxCjcz.js +1 -0
  212. package/dist/client/assets/flight-observe-GFg9L8ft.css +1 -0
  213. package/dist/client/assets/follow-route-BvcGtBIL.js +1 -0
  214. package/dist/client/assets/fx-z37u1o2z.js +1 -0
  215. package/dist/client/assets/gestures-CcwOTu8C.js +1 -0
  216. package/dist/client/assets/harnesses-screen-DBZoTZz8.css +1 -0
  217. package/dist/client/assets/home-live-action-B22u89j7.js +1 -0
  218. package/dist/client/assets/home-moving-signal-CAa0V91u.css +1 -0
  219. package/dist/client/assets/home-moving-signal-CK147hxn.js +1 -0
  220. package/dist/client/assets/home-now-card-BgvNWuea.js +1 -0
  221. package/dist/client/assets/home-now-card-nano-BcjnOU9H.js +1 -0
  222. package/dist/client/assets/hooks-B6y_O2FB.js +2 -0
  223. package/dist/client/assets/hooks-D6NI15f6.css +1 -0
  224. package/dist/client/assets/inbox-thread-redesign-Bz4FjWzr.css +1 -0
  225. package/dist/client/assets/index-BWHgHrtv.js +1 -0
  226. package/dist/client/assets/index-BcuhqXLe.js +1 -0
  227. package/dist/client/assets/index-CJXzfjo9.js +1 -0
  228. package/dist/client/assets/index-CvF09yvf.css +1 -0
  229. package/dist/client/assets/index-DMiGbrBt.js +10 -0
  230. package/dist/client/assets/index-DQPvraRS.js +1 -0
  231. package/dist/client/assets/index-DxGoC5l5.css +1 -0
  232. package/dist/client/assets/inspector-panel-DPoCWxKs.js +2 -0
  233. package/dist/client/assets/keyboard-nav-2kv_tGUS.js +1 -0
  234. package/dist/client/assets/knowledge-search-CVxQwxPn.js +1 -0
  235. package/dist/client/assets/knowledge-search-DjrQdiiW.css +1 -0
  236. package/dist/client/assets/lane-ask-display-B6iCAVcd.js +18 -0
  237. package/dist/client/assets/lane-edit-display-C_Aujldz.js +9 -0
  238. package/dist/client/assets/lane-observe-D0rfKDnU.js +7 -0
  239. package/dist/client/assets/lane-roster-store-D8x1jac2.js +1 -0
  240. package/dist/client/assets/lane-tool-detail-0WhMf4Vj.js +9 -0
  241. package/dist/client/assets/left-Bk3XnxPD.css +1 -0
  242. package/dist/client/assets/left-C--GiIh8.js +2 -0
  243. package/dist/client/assets/left-CAaRBK9S.css +1 -0
  244. package/dist/client/assets/left-CCoobxPS.css +1 -0
  245. package/dist/client/assets/left-Cj7Rt89X.js +1 -0
  246. package/dist/client/assets/left-CpNEtFEg.js +1 -0
  247. package/dist/client/assets/left-CzXAuK_t.js +2 -0
  248. package/dist/client/assets/left-agents-Bo9sO1by.js +1 -0
  249. package/dist/client/assets/left-bN4PCAXa.js +1 -0
  250. package/dist/client/assets/left-default-DV9GdvYi.js +1 -0
  251. package/dist/client/assets/left-jYYGAOYD.js +1 -0
  252. package/dist/client/assets/left-lanes-D0l_Co7V.js +1 -0
  253. package/dist/client/assets/left-mission-Ci7zREkQ.js +1 -0
  254. package/dist/client/assets/left-mission-DSenPIyb.css +1 -0
  255. package/dist/client/assets/left-plan-D4U1uflW.js +2 -0
  256. package/dist/client/assets/library-D-RxGiCw.js +1 -0
  257. package/dist/client/assets/loader-circle-CbHjZsz1.js +1 -0
  258. package/dist/client/assets/local-agents--00gLMqr.js +1 -0
  259. package/dist/client/assets/mentions-jSuTGeet.js +1 -0
  260. package/dist/client/assets/mesh-buckets-CfAukILK.js +1 -0
  261. package/dist/client/assets/mesh-screen-BSDUjrnV.css +1 -0
  262. package/dist/client/assets/mesh-view-store-CWidRbTE.js +1 -0
  263. package/dist/client/assets/message-circle-CG-96zts.js +1 -0
  264. package/dist/client/assets/message-markup-3J9pi3nx.js +15 -0
  265. package/dist/client/assets/message-square-DSaGpjFU.js +1 -0
  266. package/dist/client/assets/message-visibility-kJM8XcSG.js +1 -0
  267. package/dist/client/assets/mission-control-D3ikEPND.css +1 -0
  268. package/dist/client/assets/mission-control-model-C0fByIjm.js +1 -0
  269. package/dist/client/assets/mission-control-store-BlnEhiCq.js +1 -0
  270. package/dist/client/assets/model-Co0zkMIc.js +1 -0
  271. package/dist/client/assets/model-CpAxGuis.js +1 -0
  272. package/dist/client/assets/observe-CuLGD9Zp.js +1 -0
  273. package/dist/client/assets/openAgent-Bjt57GdM.js +1 -0
  274. package/dist/client/assets/openContent-C6XO6kr5.js +1 -0
  275. package/dist/client/assets/operator-attention-BwSPeheT.js +1 -0
  276. package/dist/client/assets/ops-agents-BOYxzPTm.css +1 -0
  277. package/dist/client/assets/ops-atop-BB4B4JdE.css +1 -0
  278. package/dist/client/assets/ops-screen-giu3If_N.css +1 -0
  279. package/dist/client/assets/page-status-DpkedE1F.js +1 -0
  280. package/dist/client/assets/page-status-bar-ByUD7VPM.css +1 -0
  281. package/dist/client/assets/plan-view-D56fneVF.css +1 -0
  282. package/dist/client/assets/plus--b1raV_O.js +1 -0
  283. package/dist/client/assets/profile-CVRziEDA.js +1 -0
  284. package/dist/client/assets/project-overview-helpers-BQTc_Ous.js +1 -0
  285. package/dist/client/assets/projects-inbox-CHyUFQ6w.js +1 -0
  286. package/dist/client/assets/projects-inbox-COZ23dLR.css +1 -0
  287. package/dist/client/assets/radio-Bz8ZePxj.js +1 -0
  288. package/dist/client/assets/refresh-cw-BBmAnCB7.js +1 -0
  289. package/dist/client/assets/repo-diff-C9Qs-bEn.css +1 -0
  290. package/dist/client/assets/resizable-columns-C7ygvLt8.css +1 -0
  291. package/dist/client/assets/resolve-panes-r9B3mpW7.js +1 -0
  292. package/dist/client/assets/resolve-sidebar-context-DcG8xGaB.js +1 -0
  293. package/dist/client/assets/right-BHeiIaty.js +1 -0
  294. package/dist/client/assets/right-BkgKo9VT.js +1 -0
  295. package/dist/client/assets/right-BpEU5jWE.js +1 -0
  296. package/dist/client/assets/right-CRZXoy-X.js +1 -0
  297. package/dist/client/assets/right-ChF_pbPy.js +1 -0
  298. package/dist/client/assets/right-DMoUT3KN.js +1 -0
  299. package/dist/client/assets/right-DjRXbnRP.js +2 -0
  300. package/dist/client/assets/right-T4Ue6EqM.js +1 -0
  301. package/dist/client/assets/right-wzrLXKur.js +1 -0
  302. package/dist/client/assets/rocket-BSNS_rLs.js +1 -0
  303. package/dist/client/assets/router-Bq5dwf78.js +1 -0
  304. package/dist/client/assets/runtime-picker-Bcl5iIX5.js +1 -0
  305. package/dist/client/assets/runtime-picker-vhm0gtLs.css +1 -0
  306. package/dist/client/assets/scope-views-4khCg2_z.css +1 -0
  307. package/dist/client/assets/scope-views-U-ucT9m0.js +1 -0
  308. package/dist/client/assets/scout-voice-CU5c0LGi.js +1 -0
  309. package/dist/client/assets/scoutbot-BTIErYHo.js +3 -0
  310. package/dist/client/assets/scroll-text-D6Pdnar7.js +1 -0
  311. package/dist/client/assets/search-CWfZtOt2.js +1 -0
  312. package/dist/client/assets/secondaryNavConfig-DqUIp0Es.js +1 -0
  313. package/dist/client/assets/secondaryNavConfig-xssF_ubT.css +1 -0
  314. package/dist/client/assets/selection-bridge-16pk1qyG.js +1 -0
  315. package/dist/client/assets/send-horizontal-Bg5-QggH.js +1 -0
  316. package/dist/client/assets/server-CPp4ZJhZ.js +1 -0
  317. package/dist/client/assets/session-catalog-BmoyVTJ_.js +1 -0
  318. package/dist/client/assets/session-table-DZcrKoIH.js +1 -0
  319. package/dist/client/assets/sessionRead-CvFz2RHv.js +1 -0
  320. package/dist/client/assets/sliders-horizontal-1oW76Xc9.js +1 -0
  321. package/dist/client/assets/sparkles-ClfRJQ6w.js +1 -0
  322. package/dist/client/assets/sse-CjIkKo46.js +1 -0
  323. package/dist/client/assets/status-tone-BM_zuRy1.js +1 -0
  324. package/dist/client/assets/surface-activity-B1rgWB1i.js +1 -0
  325. package/dist/client/assets/system-surfaces-redesign-CD26LFc0.css +1 -0
  326. package/dist/client/assets/tail-display-BdyoLvzY.js +2 -0
  327. package/dist/client/assets/tail-events-D19uAGe3.js +1 -0
  328. package/dist/client/assets/terminal-B9AOZQKR.js +1 -0
  329. package/dist/client/assets/terminal-relay-CWbJ1RCW.js +1 -0
  330. package/dist/client/assets/terminal-screen-19jAI0Cw.css +1 -0
  331. package/dist/client/assets/terminal-sessions-D5CIR2OL.js +1 -0
  332. package/dist/client/assets/terminal-takeover-B8UeD9OX.js +1 -0
  333. package/dist/client/assets/text-DsBWV_4k.js +1 -0
  334. package/dist/client/assets/time-DltNTpLl.js +1 -0
  335. package/dist/client/assets/types-B0PlfpKc.js +1 -0
  336. package/dist/client/assets/ui-LM8pS8qE.js +1 -0
  337. package/dist/client/assets/use-conversation-list-Byab41G6.js +1 -0
  338. package/dist/client/assets/use-fleet-active-asks-BIbQx5AS.js +1 -0
  339. package/dist/client/assets/use-reduced-motion-RRBkmVkk.js +1 -0
  340. package/dist/client/assets/useAgentHoverCard-DMrbBif0.js +1 -0
  341. package/dist/client/assets/useContentSecondaryNav-DMl1WNm7.js +1 -0
  342. package/dist/client/assets/usePierreRuntime-wC-yMtBb.js +50 -0
  343. package/dist/client/assets/voice-levels-Dcr3jglk.js +1 -0
  344. package/dist/client/assets/wrench-Bkc_0lKF.js +1 -0
  345. package/dist/client/assets/x-D3GElQbe.js +1 -0
  346. package/dist/client/assets/{xterm-6eL7V7pF.js → xterm-BKR8oAkR.js} +1 -1
  347. package/dist/client/index.html +6 -3
  348. package/dist/drizzle/0003_harsh_meltdown.sql +45 -0
  349. package/dist/drizzle/0004_medical_aaron_stack.sql +40 -0
  350. package/dist/drizzle/0005_wet_shriek.sql +57 -0
  351. package/dist/drizzle/0006_woozy_dark_beast.sql +1 -0
  352. package/dist/drizzle/README.md +7 -0
  353. package/dist/drizzle/meta/0003_snapshot.json +4952 -0
  354. package/dist/drizzle/meta/0004_snapshot.json +5235 -0
  355. package/dist/drizzle/meta/0005_snapshot.json +5599 -0
  356. package/dist/drizzle/meta/0006_snapshot.json +5606 -0
  357. package/dist/drizzle/meta/_journal.json +28 -0
  358. package/dist/main.mjs +24907 -12910
  359. package/dist/node/main.mjs +10212 -195
  360. package/dist/openscout-terminal-relay.mjs +507 -64
  361. package/dist/pairing-runtime-controller.mjs +10793 -5165
  362. package/dist/runtime/base-daemon.mjs +627 -159
  363. package/dist/runtime/broker-daemon.mjs +65039 -30990
  364. package/dist/runtime/broker-process-manager.mjs +247 -54
  365. package/dist/runtime/mesh-discover.mjs +246 -54
  366. package/dist/scout-control-plane-web.mjs +56699 -47427
  367. package/dist/scout-web-server.mjs +56699 -47427
  368. package/package.json +1 -1
  369. package/dist/client/assets/RepoDiffViewer-DLVleMPW.js +0 -56
  370. package/dist/client/assets/embed-entry-BdmREZuc.js +0 -1
  371. package/dist/client/assets/index-DPFmfHm5.js +0 -271
  372. package/dist/client/assets/index-jpYnsyHM.css +0 -1
@@ -0,0 +1,5 @@
1
+ import{r as n,j as e}from"./index-DMiGbrBt.js";import{r as xs}from"./index-CJXzfjo9.js";import{D as js}from"./runtime-picker-Bcl5iIX5.js";import{E as Ee}from"./EmptyState-4F9XDFQm.js";import{u as ks,i as vs}from"./MessageComposerSuggestions-DpxN9WiB.js";import{r as ws,R as Ns,e as Ss,a as Cs}from"./NewChatComposer-Cs6OsxK6.js";import{a as le}from"./api-h5zurxmi.js";import{c as Xe}from"./clipboard-e3fSpeo7.js";import{u as Is}from"./sse-CjIkKo46.js";import{b as Pe}from"./status-tone-BM_zuRy1.js";import{t as Fe,a as Ze,n as X}from"./time-DltNTpLl.js";import{u as es,A as Rs}from"./Provider-C7UKGHQy.js";import{o as $e}from"./openContent-C6XO6kr5.js";import{g as As,b as ce,h as ss,e as $s,i as Ds,d as Es,j as Fs,k as Ms,l as Ls,m as Ts}from"./broker-display-pp33bLsu.js";import{BrokerMetadataPanel as Ps}from"./BrokerMetadataPanel-7UjcuNjd.js";import{DispatchAftermath as zs}from"./DispatchAftermath-Dpe88DFX.js";import{i as Bs,c as qs,n as Ue}from"./keyboard-nav-2kv_tGUS.js";import{ShikiPane as Os}from"./ShikiPane-Ap1iPxYb.js";import{d as _s}from"./types-B0PlfpKc.js";/* empty css */import{L as Se}from"./loader-circle-CbHjZsz1.js";import{X as Me}from"./x-D3GElQbe.js";import{E as De}from"./external-link-CXBytO9o.js";import{A as Ks}from"./arrow-down-BPLe0am9.js";import{B as He}from"./bot-eu8pBNvI.js";import{R as Je}from"./refresh-cw-BBmAnCB7.js";import{C as We}from"./chevron-down-BGk5qoEw.js";import{C as rs}from"./check-DjgFiBxb.js";import{C as as}from"./copy-CQGYbxdu.js";import{M as ts}from"./message-square-DSaGpjFU.js";import{S as Us,P as Hs}from"./sparkles-ClfRJQ6w.js";import{P as Js}from"./plus--b1raV_O.js";import{S as Ws}from"./send-horizontal-Bg5-QggH.js";import{c as ns}from"./createLucideIcon-OpA4Amw5.js";import{R as Qs}from"./radio-Bz8ZePxj.js";import{b as Vs,M as Ys}from"./DocumentFocusViewer-BeVwwl26.js";const Gs=[["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"}]],Xs=ns("at-sign",Gs);const Zs=[["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"}]],er=ns("hash",Zs),sr=160;function Qe(s){const a=new URLSearchParams({limit:String(sr)});return s&&a.set("cursor",s),`/api/broker?${a.toString()}`}const Ve={index:-1,request:0};function rr(s,a){return{index:a,request:s.request+1}}function os(s,a){return a===s.index?s:{index:a,request:s.request}}function ar(s,a){return s.index<a?s:os(s,a>0?a-1:-1)}function tr(s,a){return s.request!==a}function nr({enabled:s,rowCount:a,onActivateRow:t,onClearSelection:i}){const[f,d]=n.useState(Ve),b=f.index,u=n.useRef(new Map),c=n.useRef(Ve.request),x=n.useCallback(y=>{d(m=>rr(m,typeof y=="function"?y(m.index):y))},[]),j=n.useCallback(y=>{d(m=>os(m,typeof y=="function"?y(m.index):y))},[]);n.useEffect(()=>{if(!tr(f,c.current)||(c.current=f.request,f.index<0))return;const y=u.current.get(f.index);y?.scrollIntoView({block:"nearest"}),y?.focus()},[f]),n.useEffect(()=>{d(y=>ar(y,a))},[a]);const R=n.useCallback((y,m)=>{m?u.current.set(y,m):u.current.delete(y)},[]);n.useEffect(()=>{if(!s)return;const y=m=>{if(document.querySelector(".sys-broker-page")&&!(Bs(m.target)||qs())&&a!==0){if(m.key==="Escape"){i&&(m.preventDefault(),i(),j(-1));return}if(m.key==="ArrowDown"||m.key==="j"){m.preventDefault(),x(I=>Ue(I,a,1));return}if(m.key==="ArrowUp"||m.key==="k"){m.preventDefault(),x(I=>Ue(I,a,-1));return}if(m.key==="Home"||m.key==="g"&&!m.shiftKey){m.preventDefault(),x(0);return}if(m.key==="End"||m.key==="G"){m.preventDefault(),x(a-1);return}if(m.key==="Enter"||m.key===" "){const I=b<0?0:b;m.preventDefault(),x(I),t(I)}}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[s,b,x,t,i,a,j]);const U=n.useCallback(y=>({tabIndex:b===y?0:-1,ref:m=>R(y,m),onFocus:()=>j(y)}),[b,R,j]);return{focusedIndex:b,setFocusedIndex:j,getRowFocusProps:U}}const ye=["all","delivered","failed"],or={all:"All",delivered:"Delivered",failed:"Failed"};function ir(s){switch(s){case"success":return"Success";case"failed_query":return"Query failure";case"failed_delivery":return"Delivery failure";default:return"Delivery attempt"}}function is(s){return s.messageId??s.deliveryId??s.invocationId??s.id}function ls(s){switch(Pe(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 Le(s){if(!s)return"··";const a=s.trim().split(/\s+/).filter(Boolean);if(a.length===0)return"··";const t=a[a.length-1];return/^\d+$/.test(t)?t.slice(-2):a.length>=2?(a[0][0]+a[1][0]).toUpperCase():s.trim().slice(0,2).toUpperCase()}function lr(s){const a=X(s)??0;return new Date(a).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Ye(s){const a=X(s);return a===null?"—":new Date(a).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Re(s,a,t=0){if(!s||typeof s!="object"||Array.isArray(s)||t>3)return;const i=s;for(const f of a)if(i[f]!==void 0&&i[f]!==null)return i[f];for(const f of Object.values(i)){const d=Re(f,a,t+1);if(d!==void 0)return d}}function T(s,...a){const t=Re(s.metadata,a);return typeof t!="string"&&typeof t!="number"?null:String(t).trim()||null}function Ce(s,...a){const t=Re(s.metadata,a);return typeof t=="number"||typeof t=="string"?X(t):null}function cs(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 Ie(s,a){if(a==="to")return s.route==="channel"?"Channel":s.route==="broadcast"?"Broadcast":s.target?.toLowerCase().includes("operator")?"Operator":"Agent lane";const t=T(s,"class","actorClass")?.toLowerCase();return t==="operator"||t==="human"?"Operator":t==="agent"?"Agent":s.actorName?.toLowerCase().includes("operator")?"Operator":"Sender"}function cr(s){const a=Re(s.metadata,["latencyMs","durationMs"]);if(typeof a=="number"&&Number.isFinite(a)&&a>=0)return a<1e3?`${Math.round(a)}ms`:`${(a/1e3).toFixed(a<1e4?1:0)}s`;const t=Ce(s,"sentAt","createdAt")??X(s.ts),i=Ce(s,"deliveredAt","completedAt");if(t===null||i===null||i<t)return"—";const f=i-t;return f<1e3?`${f}ms`:`${(f/1e3).toFixed(f<1e4?1:0)}s`}function Te({route:s}){switch(s){case"channel":return e.jsx(er,{size:12,"aria-hidden":"true"});case"broadcast":return e.jsx(Qs,{size:12,"aria-hidden":"true"});case"dm":return e.jsx(Xs,{size:12,"aria-hidden":"true"});default:return e.jsx(ts,{size:12,"aria-hidden":"true"})}}function dr(s,a){if(!a)return null;const t=a.trim().replace(/^@/,"").toLowerCase();return s.find(i=>[i.id,i.name,i.handle,i.selector,i.defaultSelector,i.conversationId,i.harnessSessionId].some(f=>f?.trim().replace(/^@/,"").toLowerCase()===t))??null}function ur(s,a,t){const i=t?.authorityNodeName??t?.homeNodeName??t?.authorityNodeId??t?.homeNodeId??T(s,"machine","machineName","nodeName");return(t?[{label:"Status",value:t.state},{label:"Handle",value:t.handle?`@${t.handle.replace(/^@/,"")}`:null},{label:"Project",value:t.project},{label:"Branch",value:t.branch},{label:"Runtime",value:[t.harness,t.model,t.reasoningEffort].filter(Boolean).join(" · ")||null},{label:"Machine",value:i},{label:"Working dir",value:t.cwd??t.projectRoot},{label:"Session",value:t.harnessSessionId},{label:"Conversation",value:t.conversationId??s.conversationId}]:[{label:"Kind",value:a==="to"&&s.conversationId?"Session route":Ie(s,a)},{label:"Channel",value:cs(s.route)},{label:"Session",value:a==="to"?s.target:T(s,"sessionId","harnessSessionId")},{label:"Conversation",value:s.conversationId},{label:"Harness",value:T(s,"harness")},{label:"Model",value:T(s,"model")},{label:"Project",value:T(s,"project","projectName")},{label:"Branch",value:T(s,"branch")},{label:"Machine",value:i}]).filter(d=>!!d.value)}function Ge({attempt:s,agents:a,side:t}){const i=t==="from"?s.actorName:s.target,f=dr(a,i),d=f?.name??i??(t==="from"?"Unknown":"No target"),b=f?"Agent":t==="to"&&s.conversationId?"Session":Ie(s,t),u=ur(s,t,f),c=`dispatch-endpoint-${s.id}-${t}`;return e.jsxs("span",{className:`sys-broker-endpoint sys-broker-endpoint--${t}`,tabIndex:0,"aria-describedby":c,children:[e.jsx("span",{className:"sys-broker-avatar sys-broker-endpoint-avatar","aria-hidden":"true",children:f||t==="from"?Le(d):e.jsx(Te,{route:s.route})}),e.jsx("span",{className:"sys-broker-endpoint-name",title:d,children:d}),e.jsxs("span",{className:"sys-broker-endpoint-card",id:c,role:"tooltip",children:[e.jsxs("span",{className:"sys-broker-endpoint-card-head",children:[e.jsx("span",{className:"sys-broker-avatar","aria-hidden":"true",children:f||t==="from"?Le(d):e.jsx(Te,{route:s.route})}),e.jsxs("span",{children:[e.jsx("strong",{children:d}),e.jsx("small",{children:b})]})]}),e.jsx("span",{className:"sys-broker-endpoint-card-body",children:u.map(x=>e.jsxs("span",{className:"sys-broker-endpoint-card-field",children:[e.jsx("small",{children:x.label}),e.jsx("code",{title:x.value,children:x.value})]},x.label))})]})]})}function ge(s){const a=X(s)??0,t=new Date(a);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function hr(s,a=Date.now()){const t=X(s)??0,i=new Date(t),f=new Date(a),d=new Date(a);return d.setDate(d.getDate()-1),ge(s)===ge(f.getTime())?"Today":ge(s)===ge(d.getTime())?"Yesterday":i.toLocaleDateString(void 0,{month:"short",day:"numeric",year:i.getFullYear()===f.getFullYear()?void 0:"numeric"})}function fr(s,a,t){return{...a,source:s.source,attempts:[...s.attempts,...a.attempts],failedQueries:s.failedQueries,failedDeliveries:s.failedDeliveries,dialogue:s.dialogue,ledger:{...a.ledger,cursors:{...s.ledger.cursors,[t]:a.ledger.cursors[t]},hasMore:{...s.ledger.hasMore,[t]:a.ledger.hasMore[t]}}}}function mr({navigate:s,embedded:a=!1,initialAttemptId:t}){const{route:i,agents:f,selectedBrokerAttempt:d,inspectBrokerAttempt:b,clearBrokerAttempt:u}=es(),[c,x]=n.useState(null),j=i.view==="broker"?i.filter??"all":"all",[R,U]=n.useState(!0),[y,m]=n.useState(!1),[I,oe]=n.useState(!1),[q,P]=n.useState(null),H=n.useRef(null),D=n.useRef(0),L=n.useRef(null),J=n.useCallback(async(o="initial")=>{const h=++D.current;!H.current&&o!=="background"?(U(!0),P(null)):m(!0);try{const k=await le(Qe());if(h!==D.current)return;H.current=k,x(k),P(null)}catch(k){if(h!==D.current)return;P(k instanceof Error?k.message:String(k))}finally{h===D.current&&(U(!1),m(!1))}},[]),ie=n.useCallback(async()=>{const o=H.current;if(!o||I)return;const h="attempts",k=o.ledger.cursors[h];if(!k||!o.ledger.hasMore[h])return;const w=++D.current;oe(!0),P(null);try{const C=await le(Qe(k));if(w!==D.current)return;const ue=H.current,M=ue?fr(ue,C,h):C;H.current=M,x(M)}catch(C){if(w!==D.current)return;P(C instanceof Error?C.message:String(C))}finally{w===D.current&&oe(!1)}},[I]),Z=n.useCallback(()=>{L.current||(L.current=setTimeout(()=>{L.current=null,J("background")},250))},[J]);n.useEffect(()=>(J("initial"),()=>{L.current&&clearTimeout(L.current)}),[J]),Is(o=>{(o.kind==="message.posted"||o.kind==="delivery.planned"||o.kind==="delivery.attempted"||o.kind==="delivery.state.changed"||o.kind==="scout.dispatched")&&Z()});const v=n.useMemo(()=>{if(!c)return[];const o=new Map(c.dialogue.map(h=>[h.id,h.body]));return As(c.attempts).map(h=>{const k=h.messageId?o.get(h.messageId):null;return k&&k!==h.detail?{...h,detail:k}:h})},[c]),E=n.useMemo(()=>{switch(j){case"delivered":return v.filter(o=>!ce(o));case"failed":return v.filter(ce);default:return v}},[j,v]),O=c?.ledger.hasMore.attempts??!1,ee=n.useMemo(()=>({all:v.length,delivered:v.filter(o=>!ce(o)).length,failed:v.filter(ce).length}),[v]),z=n.useMemo(()=>{const o=i.view==="broker"?i.attemptId:void 0;return!c||!o?null:v.find(h=>h.id===o)??c.attempts.find(h=>h.id===o)??c.failedQueries.find(h=>h.id===o)??c.failedDeliveries.find(h=>h.id===o)??null},[c,v,i]),W=z?`${z.id}\0${z.status}\0${z.ts}`:null,se=d?`${d.id}\0${d.status}\0${d.ts}`:null;n.useEffect(()=>{z&&W!==se&&b(z)},[se,b,z,W]);const[A,$]=n.useState(null),_=n.useRef(!1),S=n.useCallback(o=>{if(a){_.current=!0,$(o);return}b(o)},[a,b]),Q=n.useCallback(()=>{if(a){_.current=!0,$(null);return}u()},[u,a]),V=n.useCallback(o=>{const h=E[o];h&&(S(h),window.dispatchEvent(new CustomEvent("scout:set-inspector-width",{detail:{width:520}})))},[E,S]),{getRowFocusProps:re,setFocusedIndex:K}=nr({enabled:!!c&&E.length>0,rowCount:E.length,onActivateRow:V,onClearSelection:Q}),ae=A?.id??null,xe=A?`${A.id} ${A.status} ${A.ts}`:null;n.useEffect(()=>{if(!a||!ae)return;const o=v.find(h=>h.id===ae);o&&`${o.id} ${o.status} ${o.ts}`!==xe&&$(o)},[a,ae,xe,v]),n.useEffect(()=>{if(!a||!t||!c||_.current||A)return;const o=v.find(h=>h.id===t)??c.attempts.find(h=>h.id===t)??c.failedQueries.find(h=>h.id===t)??c.failedDeliveries.find(h=>h.id===t);o&&(_.current=!0,$(o))},[c,a,A,v,t]),n.useEffect(()=>{const o=i.view==="broker"?i.attemptId:void 0;if(!o)return;const h=E.findIndex(k=>k.id===o);h>=0&&K(h)},[E,j,i,K]);const je=n.useCallback(o=>{const k=(ye.indexOf(j)+o+ye.length)%ye.length,w=ye[k];s({view:"broker",...w==="all"?{}:{filter:w}})},[j,s]),F=a?A:null;return e.jsx("div",{className:`s-ops${a?" s-ops--embedded":""}${F?" 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:o=>{o.key==="ArrowRight"?(o.preventDefault(),je(1)):o.key==="ArrowLeft"&&(o.preventDefault(),je(-1))},children:ye.map(o=>e.jsxs("button",{type:"button",role:"tab","aria-selected":j===o,className:`sys-tab${j===o?" sys-tab-active":""}`,onClick:()=>s({view:"broker",...o==="all"?{}:{filter:o}}),children:[e.jsx("span",{children:or[o]}),e.jsx("span",{className:"sys-tab-count",children:ee[o]})]},o))}):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:R?"Loading dispatch ledger...":c?`Updated ${Fe(c.generatedAt)}${c.source?.latestMessageAt?` · latest message ${Fe(c.source.latestMessageAt)}`:""}`:"Waiting for dispatch data"}),e.jsx("button",{type:"button",className:"s-btn",disabled:R||y,onClick:()=>{J("manual")},children:y?"Refreshing...":"Refresh"})]})]}),q&&e.jsxs("div",{className:"sys-banner sys-banner-warning",children:[e.jsx("strong",{children:"Refresh failed."}),e.jsx("span",{children:q})]}),y&&c&&e.jsxs("div",{className:"sys-broker-source-note",role:"status","aria-live":"polite",children:[e.jsx(Se,{className:"sys-broker-source-spinner",size:12,"aria-hidden":"true"}),e.jsx("strong",{children:"Updating dispatches…"})]}),!y&&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:"Dispatch may be out of date"}),e.jsx("span",{children:"Live broker unavailable; showing saved dispatch history."})]}),R&&!c&&e.jsx(Ee,{title:"Loading dispatch",body:"Reading the dispatch database snapshot."}),!R&&!c&&!q&&e.jsx(Ee,{title:"No dispatch data",body:"No dispatch rows are available yet."}),c&&e.jsxs(e.Fragment,{children:[e.jsx(pr,{attempts:E,agents:f,selectedAttemptId:a?A?.id??null:d?.id??(i.view==="broker"?i.attemptId??null:null),onInspect:S,getRowFocusProps:re}),E.length>0&&O&&e.jsx("div",{className:"sys-ledger-footer",children:e.jsx("button",{type:"button",className:"s-btn",disabled:I,onClick:()=>{ie()},children:I?"Loading older...":"Load older"})})]})]}),F&&e.jsx("div",{className:"s-broker-embed-detail",children:e.jsx(ds,{attempt:F,navigate:s,onClose:Q})})]})})}function pr({attempts:s,agents:a,selectedAttemptId:t,onInspect:i,getRowFocusProps:f}){if(s.length===0)return e.jsx(Ee,{title:"No dispatch rows",body:"No dispatch rows are available yet."});const d=s.reduce((b,u,c)=>{const x=ge(u.ts),j=b[b.length-1];return j?.key===x?j.attempts.push({attempt:u,index:c}):b.push({key:x,label:hr(u.ts),attempts:[{attempt:u,index:c}]}),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--status",children:"Status"}),e.jsx("span",{className:"sys-broker-col sys-broker-col--from",children:"From"}),e.jsx("span",{className:"sys-broker-col sys-broker-col--to",children:"To"}),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"})]}),d.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:u,index:c})=>{const x=Pe(u.kind,u.status),j=ce(u),R=ss(u),U=$s(u.detail,Ds(u)),y=ls(u),m=()=>{i(u),window.dispatchEvent(new CustomEvent("scout:set-inspector-width",{detail:{width:520}}))};return e.jsxs("div",{role:"listitem",className:`sys-broker-wire-row${j?" sys-broker-wire-row--failure":""}${t===u.id?" sys-broker-wire-row--selected":""}`,"aria-label":`Inspect ${u.detail}`,onClick:m,...f(c),children:[e.jsxs("div",{className:"sys-broker-cell sys-broker-col--status",children:[e.jsx("span",{className:`sys-broker-dot sys-broker-dot--${x}`,"aria-hidden":"true"}),e.jsx("span",{className:`sys-broker-state sys-broker-state--${x}`,children:y})]}),e.jsx("div",{className:"sys-broker-cell sys-broker-col--from",children:e.jsx(Ge,{attempt:u,agents:a,side:"from"})}),e.jsxs("div",{className:"sys-broker-cell sys-broker-col--to",children:[e.jsx(Rs,{className:"sys-broker-route-arrow",size:13,"aria-hidden":"true"}),e.jsx(Ge,{attempt:u,agents:a,side:"to"})]}),e.jsxs("div",{className:"sys-broker-cell sys-broker-col--msg",children:[e.jsx("span",{className:"sys-broker-msg",title:u.detail,children:U}),j&&R&&e.jsx("span",{className:"sys-broker-msg-error",title:R,children:R})]}),e.jsxs("div",{className:"sys-broker-cell sys-broker-col--time",children:[e.jsx("time",{className:"sys-broker-time-rel",title:Ze(u.ts),children:Fe(u.ts)}),e.jsx("span",{className:"sys-broker-time-abs",children:lr(u.ts)})]})]},u.id)})})]},b.key))]})}function br(s){const a=is(s);return[{label:"Kind",value:ir(s.kind)},{label:"Time",value:Ze(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:a},{label:"Message",value:s.messageId===a?null:s.messageId},{label:"Delivery",value:s.deliveryId===a?null:s.deliveryId},{label:"Invocation",value:s.invocationId===a?null:s.invocationId}].filter(t=>!!t.value)}function de({value:s,subject:a,className:t}){const[i,f]=n.useState("idle"),d=n.useRef(null);n.useEffect(()=>{f("idle")},[s]),n.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const b=n.useCallback(async()=>{const x=await Xe(s);d.current&&clearTimeout(d.current),f(x?"copied":"failed"),d.current=setTimeout(()=>{f("idle"),d.current=null},1500)},[s]),u=i==="copied",c=i==="failed";return e.jsx("button",{type:"button",className:`sys-copy-btn${t?` ${t}`:""}${u?" sys-copy-btn--copied":""}${c?" sys-copy-btn--failed":""}`,onClick:()=>{b()},title:u?`Copied ${a}`:c?"Copy failed":`Copy ${a}`,"aria-label":u?`Copied ${a}`:c?`Copy ${a} failed`:`Copy ${a}`,children:u?e.jsx(rs,{size:14,"aria-hidden":"true"}):e.jsx(as,{size:14,"aria-hidden":"true"})})}function yr(s){const a=s.trim();if(a.startsWith("{")||a.startsWith("["))try{return{code:JSON.stringify(JSON.parse(a),null,2),path:"payload.json",language:"JSON"}}catch{}return{code:s,path:"payload.md",language:"Text · Markdown"}}function gr({payload:s}){const a=n.useMemo(()=>yr(s),[s]),[t,i]=n.useState(!1),f=n.useRef(null),d=a.code.split(`
2
+ `).length;n.useEffect(()=>{const u=f.current;!u||!t||u.open||u.showModal()},[t]),n.useEffect(()=>{i(!1)},[s]);const b=e.jsx("div",{className:"sys-broker-payload-code","data-language":a.path==="payload.json"?"json":"markdown",role:"region","aria-label":`Dispatch payload, ${a.language}`,tabIndex:0,children:e.jsx(Os,{code:a.code,path:a.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:[a.language," · ",d," ",d===1?"line":"lines"]}),e.jsx(de,{value:s,subject:"payload"}),e.jsx("button",{type:"button",className:"sys-copy-btn sys-broker-payload-expand",onClick:()=>i(!0),title:"Expand payload","aria-label":"Expand payload",children:e.jsx(Vs,{size:14,"aria-hidden":"true"})})]}),e.jsx("div",{className:"sys-broker-payload-resizer",children:b}),t&&xs.createPortal(e.jsxs("dialog",{ref:f,className:"sys-broker-payload-dialog","aria-label":"Expanded dispatch payload",onCancel:u=>{u.preventDefault(),i(!1)},onClose:()=>i(!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:[a.language," · ",d," ",d===1?"line":"lines"]})]}),e.jsx(de,{value:s,subject:"payload"}),e.jsx("button",{type:"button",className:"sys-copy-btn",onClick:()=>i(!1),title:"Return payload to inspector","aria-label":"Return payload to inspector",children:e.jsx(Ys,{size:14,"aria-hidden":"true"})})]}),e.jsx("div",{className:"sys-broker-payload-dialog-body",children:b})]}),document.body)]})}function xr({attempt:s}){const a=Ts(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(Me,{size:14})}),e.jsxs("div",{children:[e.jsx("span",{className:"sys-detail-label",children:"Routing stopped"}),e.jsx("strong",{children:a}),e.jsx("p",{children:s.detail})]}),e.jsx(de,{value:s.detail,subject:"failure detail"})]})}function ds({attempt:s,navigate:a,onClose:t}){const{route:i,agents:f,scoutbotAgentId:d}=es(),b=br(s),u=Es(s.metadata),c=ce(s),x=s.kind==="failed_query",j=ss(s),R=Pe(s.kind,s.status),U=Ce(s,"sentAt","createdAt")??X(s.ts),y=Ce(s,"deliveredAt","completedAt")??X(s.ts),m=is(s),[I,oe]=n.useState("idle"),[q,P]=n.useState("idle"),[H,D]=n.useState(null),[L,J]=n.useState(null),[ie,Z]=n.useState(""),[v,E]=n.useState(""),[O,ee]=n.useState("idle"),[z,W]=n.useState(null),[se,A]=n.useState(""),[$,_]=n.useState(""),[S,Q]=n.useState(""),[V,re]=n.useState(""),[K,ae]=n.useState("medium"),[xe,je]=n.useState(null),[F,o]=n.useState([]),[h,k]=n.useState(!1),[w,C]=n.useState("idle"),[ue,M]=n.useState(null),ke=T(s,"harness"),ve=T(s,"model"),we=T(s,"reasoningEffort","effort"),ze=n.useRef(null),Be=n.useRef(null),he=n.useMemo(()=>Fs(s),[s]),N=n.useMemo(()=>f.filter(r=>!r.retiredFromFleet&&!r.staleLocalRegistration).slice().sort((r,l)=>r.id===d?-1:l.id===d?1:(l.updatedAt??0)-(r.updatedAt??0)||r.name.localeCompare(l.name)),[f,d]),fe=n.useMemo(()=>Ms(s,N)?.id??"",[s,N]),me=N.some(r=>r.id===d)?d:N[0]?.id??"",Ne=N[0]?.id??"",te=N.find(r=>r.id===me)??null,us=n.useMemo(()=>{const r=new Map;for(const l of N){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}))},[N]),qe=n.useRef({originalTargetAgentId:fe,firstRoutableAgentId:Ne,defaultForwardAgentId:me,defaultForwardAgent:te,effort:"medium"});qe.current={originalTargetAgentId:fe,firstRoutableAgentId:Ne,defaultForwardAgentId:me,defaultForwardAgent:te,effort:T(s,"reasoningEffort","effort")||"medium"};const pe=n.useRef(!1);n.useEffect(()=>{const r=qe.current;pe.current=!1,oe("idle"),P("idle"),D(null),J(null),Z(""),E(r.originalTargetAgentId||r.firstRoutableAgentId),ee("idle"),W(null),A(r.defaultForwardAgentId),_(r.defaultForwardAgent?.projectRoot?.trim()||r.defaultForwardAgent?.cwd?.trim()||""),Q(r.defaultForwardAgent?.harness?.trim()||""),re(r.defaultForwardAgent?.model?.trim()||""),ae(r.effort),o([]),k(!1),C("idle"),M(null)},[s.id]),n.useEffect(()=>{pe.current||(E(r=>r||fe||Ne),A(r=>r||me),_(r=>r||te?.projectRoot?.trim()||te?.cwd?.trim()||""),Q(r=>r||te?.harness?.trim()||""),re(r=>r||te?.model?.trim()||""))},[te,me,Ne,fe]),n.useEffect(()=>{const r=new URLSearchParams({scope:"global+project"});$&&r.set("projectRoot",$);let l=!1;return le(`/api/runner/options?${r.toString()}`).then(p=>{!l&&p.schemaVersion==="openscout.runtime-capabilities.v1"&&je(p)}).catch(()=>{}),()=>{l=!0}},[$]);const hs=n.useCallback(async()=>{const r=await Xe(he);oe(r?"copied":"failed"),window.setTimeout(()=>oe("idle"),1500)},[he]),fs=n.useCallback(r=>{k(!0),Z(r),window.requestAnimationFrame(()=>ze.current?.focus())},[]),ms=n.useCallback(async()=>{const r=N.find(l=>l.id===v);if(!(!r||O==="sending")){ee("sending"),W(null);try{const l=await le("/api/ask",{method:"POST",body:JSON.stringify({body:s.detail,targetAgentId:r.id,targetLabel:r.name,...ke||ve||we?{execution:{...ke?{harness:ke}:{},...ve?{model:ve}:{},...we?{reasoningEffort:we}:{},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;ee("sent"),W(`New dispatch sent to ${r.name}${p?` · ${p}`:""}`)}catch(l){ee("failed"),W(`Retry failed. ${l instanceof Error?l.message:String(l)}`)}}},[s,v,O,we,ke,ve,N]),Oe=n.useCallback(async()=>{const r=ie.trim(),l=N.find(p=>p.id===se);if(!(!r||!l||w==="sending")){C("sending"),M(F.length>0?`Uploading ${F.length} ${F.length===1?"attachment":"attachments"}…`:null);try{const p=F.length>0?await ks(F):[],g=await le("/api/ask",{method:"POST",body:JSON.stringify({body:`${r}
3
+
4
+ Attached dispatch context:
5
+ ${he}`,targetAgentId:l.id,targetLabel:l.name,...p.length>0?{attachments:p}:{},execution:{...S?{harness:S}:{},...V?{model:V}:{},...K?{reasoningEffort:K}:{}},metadata:{source:"scout-dispatch-forward",originalDispatchId:s.id,...$?{targetProjectPath:$}:{},...s.messageId?{originalMessageId:s.messageId}:{},...s.conversationId?{originalConversationId:s.conversationId}:{}}})}),Y=g.flightId??g.flight?.id;C("sent"),M(`Request sent to ${l.name}${Y?` · ${Y}`:""}`),Z(""),o([])}catch(p){C("failed"),M(`Request wasn't sent. ${p instanceof Error?p.message:String(p)}`)}}},[s,he,se,K,F,S,V,$,w,ie,N]),ps=n.useCallback(r=>{const l=r.filter(vs),p=r.length-l.length;l.length>0&&(o(g=>[...g,...l]),C("idle"),M(null)),p>0&&(C("failed"),M("Attach markdown, code, an image, or a video clip."))},[]),bs=c?["Get a second opinion","Propose a recovery plan","Draft a follow-up"]:["Summarize this dispatch","Draft a follow-up","What changed?"],B=N.find(r=>r.id===v)??null,ne=N.find(r=>r.id===se)??null,be=N.filter(r=>$?(r.projectRoot?.trim()||r.cwd?.trim())===$:!0),_e=xe??Ns,Ae=n.useMemo(()=>{const r=ws(_e),l=[V,ne?.harness===S?ne.model:null,...be.filter(g=>g.harness===S).map(g=>g.model)].map(g=>g?.trim()).filter(g=>!!g);let p=r.harnesses;return p.some(g=>g.value===S)||(p=[{value:S,label:S||"default",models:[]},...p]),p=p.map(g=>{if(g.value!==S)return g;const Y=g.models.some(G=>G.value==="")?g.models:[{value:"",label:"Default",note:"harness picks"},...g.models],gs=new Set(Y.map(G=>G.value)),Ke=l.filter(G=>!gs.has(G)).map(G=>({value:G,label:G,note:"observed"}));return Ke.length===0&&Y===g.models?g:{...g,models:[...Y,...Ke]}}),{...r,harnesses:p}},[_e,ne,S,V,be]);n.useEffect(()=>{const r=Ss(Ae,S);!r||r.some(l=>l.value===K)||ae(r.find(l=>l.value==="medium")?.value??r[0]?.value??"")},[Ae,S,K]);const ys=n.useCallback(async()=>{P("running"),D(null);try{const r=await le("/api/broker/dispatch-review",{method:"POST",body:JSON.stringify(Ls(s))});P("sent"),J(r.conversationId),D(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){P("failed"),D(`Couldn't start the report. ${r instanceof Error?r.message:String(r)}`)}},[s]);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:ls(s)}),e.jsx("code",{title:m,children:m}),e.jsx(de,{value:he,subject:"dispatch context",className:"sys-broker-inspector-copy"}),e.jsx("button",{type:"button",className:"sys-copy-btn sys-broker-inspector-close",onClick:t,title:"Close inspector","aria-label":"Close inspector",children:e.jsx(Me,{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:Le(s.actorName)}),e.jsxs("div",{className:"sys-broker-route-party-copy",children:[e.jsxs("span",{className:"sys-detail-label",children:["From · ",Ie(s,"from")]}),e.jsx("strong",{children:s.actorName??"Unknown sender"})]}),s.conversationId&&e.jsxs("button",{type:"button",className:"sys-broker-route-button",onClick:()=>$e(a,{view:"conversation",conversationId:s.conversationId},{returnTo:i}),children:[e.jsx(De,{size:11,"aria-hidden":"true"}),"Route"]})]}),e.jsx(Ks,{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(Te,{route:s.route})}),e.jsxs("div",{className:"sys-broker-route-party-copy",children:[e.jsxs("span",{className:"sys-detail-label",children:["To · ",Ie(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:()=>$e(a,{view:"conversation",conversationId:s.conversationId},{returnTo:i}),children:[e.jsx(De,{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:cs(s.route)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Latency"}),e.jsx("dd",{className:"sys-broker-delivery-accent",children:cr(s)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Sent"}),e.jsx("dd",{children:Ye(U)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:c?"Failed":"Delivered"}),e.jsx("dd",{children:Ye(y)})]})]}),e.jsxs("section",{className:"sys-broker-payload",children:[x?e.jsx(xr,{attempt:s}):e.jsx(gr,{payload:s.detail}),c&&!x&&j&&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:j})]})]}),e.jsx(zs,{attempt:s,targetAgentId:fe||null,navigate:a,returnTo:i}),c&&e.jsxs("section",{className:"sys-broker-report","aria-labelledby":"dispatch-report-title",children:[e.jsxs("div",{className:"sys-broker-action-head",children:[e.jsx("span",{className:"sys-broker-action-mark","aria-hidden":"true",children:e.jsx(He,{size:12})}),e.jsxs("div",{children:[e.jsx("span",{id:"dispatch-report-title",children:"Failure report"}),e.jsx("small",{children:"Codex will inspect this dispatch and report the likely cause, confidence, and recommended next step in a new conversation."})]})]}),e.jsxs("button",{type:"button",className:"sys-broker-report-button",disabled:q==="running"||q==="sent"&&!L,onClick:()=>{if(L){$e(a,{view:"conversation",conversationId:L},{returnTo:i});return}ys()},children:[q==="running"?e.jsx(Se,{size:13,className:"sys-broker-action-spinner","aria-hidden":"true"}):L?e.jsx(De,{size:13,"aria-hidden":"true"}):e.jsx(He,{size:13,"aria-hidden":"true"}),q==="running"?"Starting report…":L?"Open report conversation":"Start failure report"]}),H&&e.jsx("div",{className:`sys-broker-review-status sys-broker-review-status--${q}`,role:"status",children:H})]}),e.jsxs("section",{className:"sys-broker-redispatch","aria-labelledby":"dispatch-redispatch-title",children:[e.jsxs("div",{className:"sys-broker-action-head",children:[e.jsx("span",{className:"sys-broker-action-mark","aria-hidden":"true",children:e.jsx(Je,{size:12})}),e.jsxs("div",{children:[e.jsx("span",{id:"dispatch-redispatch-title",children:"Retry delivery"}),e.jsx("small",{children:"Send the original payload as a new dispatch. Use this after the destination is available again."})]})]}),e.jsxs("div",{className:"sys-broker-redispatch-controls",children:[e.jsxs("label",{children:[e.jsx("span",{children:"Destination"}),e.jsx("select",{value:v,disabled:O==="sending"||N.length===0,onChange:r=>{E(r.target.value),ee("idle"),W(null)},children:N.length===0?e.jsx("option",{value:"",children:"No agents available"}):e.jsxs(e.Fragment,{children:[!v&&e.jsx("option",{value:"",children:"Original destination unavailable"}),N.map(r=>e.jsxs("option",{value:r.id,children:[r.id===d?"Scout":r.name,r.project?` · ${r.project}`:""]},r.id))]})})]}),e.jsxs("button",{type:"button",className:"sys-broker-redispatch-send",disabled:!B||O==="sending",onClick:()=>{ms()},children:[O==="sending"?e.jsx(Se,{size:13,className:"sys-broker-action-spinner","aria-hidden":"true"}):e.jsx(Je,{size:13,"aria-hidden":"true"}),O==="sending"?"Retrying…":"Retry dispatch"]})]}),B&&e.jsxs("div",{className:"sys-broker-action-target-meta",children:[B.harness&&e.jsx("span",{children:B.harness}),B.model&&e.jsx("span",{children:B.model}),(B.cwd??B.projectRoot)&&e.jsx("code",{children:B.cwd??B.projectRoot})]}),z&&e.jsx("div",{className:`sys-broker-action-status sys-broker-action-status--${O}`,role:"status",children:z})]}),e.jsxs("details",{className:"sys-broker-technical",children:[e.jsxs("summary",{children:[e.jsx("span",{children:"Technical details"}),e.jsx(We,{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(de,{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(de,{value:u,subject:"metadata",className:"sys-broker-metadata-copy"})]}),e.jsx(Ps,{metadata:s.metadata,rawJson:u})]})]}),e.jsxs("button",{type:"button",className:"sys-broker-copy-context",onClick:()=>{hs()},children:[I==="copied"?e.jsx(rs,{size:12,"aria-hidden":"true"}):e.jsx(as,{size:12,"aria-hidden":"true"}),I==="copied"?"Context copied":I==="failed"?"Copy failed":"Copy dispatch context"]})]}),e.jsxs("section",{className:`sys-broker-forward${h?" sys-broker-forward--expanded":""}`,"aria-labelledby":"dispatch-forward-title",children:[e.jsxs("button",{type:"button",className:"sys-broker-forward-toggle","aria-expanded":h,"aria-controls":"dispatch-forward-content",onClick:()=>k(r=>!r),children:[e.jsxs("div",{className:"sys-broker-action-head",children:[e.jsx("span",{className:"sys-broker-action-mark","aria-hidden":"true",children:e.jsx(ts,{size:12})}),e.jsxs("div",{children:[e.jsx("span",{id:"dispatch-forward-title",children:"Ask another agent"}),e.jsx("small",{children:"Optional · forwards this dispatch context."})]})]}),e.jsx(We,{className:"sys-broker-forward-chevron",size:15,"aria-hidden":"true"})]}),h&&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:bs.map(r=>e.jsxs("button",{type:"button",onClick:()=>fs(r),children:[e.jsx(Us,{size:11,"aria-hidden":"true"}),r]},r))})}),e.jsxs("form",{className:"sys-broker-message-composer",onSubmit:r=>{r.preventDefault(),Oe()},children:[e.jsx("label",{htmlFor:"dispatch-message-input",children:"Request"}),e.jsx("textarea",{ref:ze,id:"dispatch-message-input",value:ie,rows:3,placeholder:`What should ${ne?.id===d?"Scout":ne?.name??"this agent"} investigate or do?`,disabled:w==="sending",onChange:r=>{Z(r.target.value),w!=="idle"&&(C("idle"),M(null))},onKeyDown:r=>{r.key==="Enter"&&(r.metaKey||r.ctrlKey)&&(r.preventDefault(),Oe())}}),F.length>0&&e.jsx("div",{className:"sys-broker-composer-attachments","aria-label":"Attachments",children:F.map((r,l)=>e.jsxs("span",{children:[e.jsx(Hs,{size:10,"aria-hidden":"true"}),e.jsx("span",{title:r.name,children:r.name}),e.jsx("button",{type:"button",onClick:()=>o(p=>p.filter((g,Y)=>Y!==l)),"aria-label":`Remove ${r.name}`,children:e.jsx(Me,{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:Be,type:"file",multiple:!0,hidden:!0,disabled:w==="sending",onChange:r=>{ps([...r.target.files??[]]),r.target.value=""}}),e.jsx("button",{type:"button",className:"sys-broker-composer-attach",disabled:w==="sending",onClick:()=>Be.current?.click(),"aria-label":"Attach files",title:"Attach files",children:e.jsx(Js,{size:16,"aria-hidden":"true"})}),e.jsx("span",{className:"sys-broker-message-attachment",title:m,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:$,disabled:w==="sending",onChange:r=>{const l=r.target.value,p=N.find(g=>!l||(g.projectRoot?.trim()||g.cwd?.trim())===l)??null;pe.current=!0,_(l),p&&(A(p.id),Q(p.harness?.trim()||""),re(p.model?.trim()||""))},children:[e.jsx("option",{value:"",children:"Any project"}),us.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:se,disabled:w==="sending"||be.length===0,onChange:r=>{const l=N.find(p=>p.id===r.target.value)??null;pe.current=!0,A(r.target.value),l&&(_(l.projectRoot?.trim()||l.cwd?.trim()||""),Q(l.harness?.trim()||""),re(l.model?.trim()||"")),C("idle"),M(null)},children:be.length===0?e.jsx("option",{value:"",children:"No agents"}):be.map(r=>e.jsx("option",{value:r.id,children:r.id===d?"Scout":r.name},r.id))})]}),e.jsx(Cs,{catalog:Ae,value:{harness:S,model:V,effort:K},onChange:r=>{pe.current=!0,Q(r.harness),re(r.model),ae(r.effort)},disabled:w==="sending"}),e.jsx(js,{className:"sys-broker-composer-mic",disabled:w==="sending",onAppend:r=>Z(l=>l.trim()?`${l.trimEnd()} ${r}`:r),onError:r=>{C("failed"),M(r)}})]}),e.jsx("button",{type:"submit",className:"sys-broker-composer-send",disabled:!ie.trim()||!ne||w==="sending","aria-label":`Ask ${ne?.name??"recipient"} about this dispatch`,children:w==="sending"?e.jsx(Se,{size:14,className:"sys-broker-action-spinner","aria-hidden":"true"}):e.jsx(Ws,{size:14,"aria-hidden":"true"})})]})]}),ue&&e.jsx("div",{className:`sys-broker-action-status sys-broker-action-status--${w}`,role:"status",children:ue})]})]})]})}const jr=_s({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 a=s.get("attempt")?.trim();return a?{initialAttemptId:a}:{}},hosts:{macos:!0}}}),aa=Object.freeze(Object.defineProperty({__proto__:null,BrokerAttemptInspector:ds,BrokerScreen:mr,scoutSurface:jr},Symbol.toStringTag,{value:"Module"}));export{ds as B,mr as a,Qe as b,aa as c};
@@ -0,0 +1 @@
1
+ import{j as t,r as g}from"./index-DMiGbrBt.js";import{i as A,k,l as N,a as D}from"./conversation-model-B47vYmWN.js";import{l as L,i as E,a as _,p as w}from"./conversation-prefs-DNre-Lcx.js";import{u as O,m as P,g as R}from"./Provider-C7UKGHQy.js";import{b as U}from"./router-Bq5dwf78.js";import{l as T,i as C,s as V}from"./sessionRead-CvFz2RHv.js";import{u as z}from"./use-conversation-list-Byab41G6.js";import{d as H}from"./colors-BtO5_zlx.js";/* empty css */function q({children:a,count:l,tone:s="default",title:n}){return t.jsxs("div",{className:["collapsed-strip-label",s!=="default"&&`collapsed-strip-label--${s}`,l!=null&&"collapsed-strip-label--has-count"].filter(Boolean).join(" "),title:n??a,children:[t.jsx("span",{className:"collapsed-strip-label-mark","aria-hidden":!0}),t.jsx("span",{className:"collapsed-strip-label-text",children:a}),l!=null?t.jsx("span",{className:"collapsed-strip-label-count",children:l}):null]})}function F({label:a,emptyMark:l="·",showLabel:s=!0,labelTone:n="default",labelCount:r,children:d}){const c=!d||Array.isArray(d)&&d.length===0,u=s?t.jsx(q,{tone:n,count:r,children:a}):null;return c?t.jsxs("div",{className:"collapsed-strip collapsed-strip--empty","aria-hidden":!0,children:[u,t.jsx("span",{className:"collapsed-strip-empty-mark",children:l})]}):t.jsxs("div",{className:"collapsed-strip",role:"list","aria-label":a,children:[u,d]})}function G(){return t.jsx("div",{className:"collapsed-strip-rule","aria-hidden":!0})}function J({title:a,active:l,tone:s="default",ava:n,avaColor:r,glyph:d,dot:c,pinned:u,onClick:h}){const j=["collapsed-chip",s==="channel"&&"collapsed-chip--channel",s==="neutral"&&"collapsed-chip--neutral",s==="attention"&&"collapsed-chip--attention",s==="unread"&&"collapsed-chip--unread",l&&"collapsed-chip--active",u&&"collapsed-chip--pinned"].filter(Boolean).join(" ");return t.jsxs("button",{type:"button",role:"listitem",className:j,title:a,"aria-label":a,"aria-current":l?"page":void 0,onClick:h,children:[n?t.jsx("span",{className:"collapsed-chip-ava",style:r?{background:r}:void 0,children:n}):t.jsx("span",{className:"collapsed-chip-glyph",children:d}),c?t.jsx("span",{className:["collapsed-chip-dot",c==="attention"&&"collapsed-chip-dot--attention",c==="live"&&"collapsed-chip-dot--live"].filter(Boolean).join(" "),"aria-hidden":!0}):null,u?t.jsx("span",{className:"collapsed-chip-pin","aria-hidden":!0}):null]})}function K(a){const l=a.trim(),s=l.split(/[\s/_-]+/).filter(Boolean);if(s.length>=2){const n=s[s.length-1];return/^\d+$/.test(n)&&s.length>=3?(s[s.length-2][0]??"?").toUpperCase():(n[0]??"?").toUpperCase()}return(l[0]??"?").toUpperCase()}const Q=3,W=3,X=4,Y=3;function I(a,l){return[...a].sort((s,n)=>{const r=C(s.lastMessageAt,s.id,l)?0:1,d=C(n.lastMessageAt,n.id,l)?0:1;return r!==d?r-d:(n.lastMessageAt??0)-(s.lastMessageAt??0)})}function Z(){const{route:a,navigate:l,agents:s}=O(),{sessions:n}=z(),[r,d]=g.useState(()=>L()),[c,u]=g.useState(()=>T()),h=U(a),j=g.useMemo(()=>P(s,h),[s,h]),$=a.view==="messages"||a.view==="conversation"?a.conversationId:void 0;g.useEffect(()=>{d(L()),u(T())},[]);const i=g.useMemo(()=>{const e=R(n,j,h).filter(o=>!E(o.id,r)),m=e.filter(o=>_(o.id,r)).sort((o,y)=>w(y.id,r)-w(o.id,r)||(y.lastMessageAt??0)-(o.lastMessageAt??0)).slice(0,Q),f=new Set(m.map(o=>o.id)),p=e.filter(o=>!f.has(o.id));return{pinned:m,channels:I(p.filter(N),c).slice(0,W),dms:I(p.filter(k),c).slice(0,X),observed:I(p.filter(A),c).slice(0,Y),totals:{channels:p.filter(N).length,dms:p.filter(k).length,observed:p.filter(A).length,pinned:e.filter(o=>_(o.id,r)).length}}},[n,j,h,r,c]),B=e=>{u(V(e.id)),l({view:"messages",conversationId:e.id,...h?{machineId:h}:{}})},S=[...i.pinned,...i.channels,...i.dms,...i.observed],M=S.filter(e=>C(e.lastMessageAt,e.id,c)).length,x=(e,m=!1)=>{const f=D(e),p=N(e),o=C(e.lastMessageAt,e.id,c);return t.jsx(J,{title:m?`${f} · pinned`:f,active:e.id===$,tone:p?"channel":o?"unread":"default",ava:p?void 0:K(e.agentName??f),avaColor:p?void 0:H(e.agentName??f),glyph:p?"#":void 0,dot:o?"unread":null,pinned:m,onClick:()=>B(e)},e.id)},v=[];return i.pinned.length&&v.push(t.jsx(b,{mark:"Pin",count:i.totals.pinned,children:i.pinned.map(e=>x(e,!0))},"pin")),i.channels.length&&v.push(t.jsx(b,{mark:"#",count:i.totals.channels,children:i.channels.map(e=>x(e))},"ch")),i.dms.length&&v.push(t.jsx(b,{mark:"DM",count:i.totals.dms,children:i.dms.map(e=>x(e))},"dm")),i.observed.length&&v.push(t.jsx(b,{mark:"Obs",count:i.totals.observed,children:i.observed.map(e=>x(e))},"obs")),t.jsx(F,{label:"Chat",emptyMark:"#",labelTone:M>0?"accent":"default",labelCount:M>0?M:S.length||void 0,children:v.flatMap((e,m)=>m===0?[e]:[t.jsx(G,{},`rule-${m}`),e])})}function b({mark:a,count:l,children:s}){return t.jsxs("div",{className:"collapsed-strip-section",role:"group","aria-label":a,children:[t.jsxs("div",{className:"collapsed-strip-section-mark",title:l!=null?`${a} · ${l}`:a,children:[t.jsx("span",{className:"collapsed-strip-section-mark-text",children:a}),l!=null&&l>0?t.jsx("span",{className:"collapsed-strip-section-mark-count",children:l>99?"99+":l}):null]}),s]})}const ce=Object.freeze(Object.defineProperty({__proto__:null,ChatCollapsedStrip:Z},Symbol.toStringTag,{value:"Module"}));export{F as C,Z as a,J as b,K as c,G as d,ce as e};
@@ -0,0 +1 @@
1
+ import{r as o,j as a}from"./index-DMiGbrBt.js";import{f as E}from"./cache-Dr0why2k.js";import{u as k,f as F,l as I,L as N,D as _}from"./usePierreRuntime-wC-yMtBb.js";/* empty css */const D=["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 R(n,t){const e=L(n),s=L(t);return!e||!s||s.length<=e.length||e.some((c,d)=>s[d]!==c)?null:s.slice(e.length).join("/")}function y(n,t){return n.files.findIndex(e=>e.newPath===t||e.oldPath===t)}function A(n,t){return n.find(e=>y(e,t)>=0)?.kind??null}const K=()=>{},M=()=>{};function T({root:n,file:t}){const e=o.useMemo(()=>R(n,t),[t,n]),[s,c]=o.useState(null),[d,u]=o.useState("loading"),[P,m]=o.useState(null),[S,h]=o.useState(null),{pierre:j,pierrePhase:v,pierreError:C,retryPierre:b}=k(s);o.useEffect(()=>{let r=!1;if(c(null),u("loading"),m(null),h(null),!e){u("ready");return}return E(n,D,{files:[e],tier:"patch"}).then(l=>{r||(c(l.snapshot),h(A(l.snapshot.layers,e)),u("ready"))},l=>{r||(m(l instanceof Error?l.message:String(l)),u("error"))}),()=>{r=!0}},[e,n]);const f=o.useMemo(()=>e?s?.layers.filter(r=>y(r,e)>=0)??[]:[],[e,s]),i=f.find(r=>r.kind===S)??f[0]??null,p=i&&e?y(i,e):-1,g=i&&p>=0?F(i.files[p],p):null;return d==="loading"?a.jsx("div",{className:"s-code-empty",children:"Loading file changes…"}):d==="error"?a.jsx("div",{className:"s-code-empty",children:P??"Couldn’t load this file’s changes."}):!s||!i||!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 l=I(r),x=r.kind===i.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:[N[r.kind],a.jsxs("span",{children:["+",l.add," −",l.del]})]},r.kind)})}):null,a.jsx(_,{layer:i,patchLayer:i,patchPhase:"ready",patchError:null,selectedFileKey:g,renderKey:s.render.renderKey,theme:s.render.preferredTheme,layout:"split",pierre:j,pierrePhase:v,pierreError:C,onRetryPierre:b,onIncludeLineContext:K,onIncludeSelectionContext:M,contextActions:!1})]})}const B=Object.freeze(Object.defineProperty({__proto__:null,CodeDiffPane:T},Symbol.toStringTag,{value:"Module"}));export{T as C,B as a,R as r};
@@ -0,0 +1,2 @@
1
+ import{r as h,j as i}from"./index-DMiGbrBt.js";import{C as ne}from"./chevron-down-BGk5qoEw.js";import{S as oe}from"./search-CWfZtOt2.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
+ ${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,j as i}from"./index-DMiGbrBt.js";import{a as te}from"./api-h5zurxmi.js";import{c as pe}from"./clipboard-e3fSpeo7.js";import{f as Ie}from"./scoutbot-BTIErYHo.js";import{g as Be,f as he}from"./api-BkjHJfgJ.js";import{d as Pe}from"./types-B0PlfpKc.js";import{r as We,C as _e}from"./CodeDiffPane-DDPt6KPh.js";import{r as Ue,a as ze,w as Ae,b as Oe,f as me,C as He,s as Ke}from"./CodeProjectPicker-DqKFCpLU.js";import{ShikiPane as qe}from"./ShikiPane-Ap1iPxYb.js";/* empty css */import{A as Ge}from"./arrow-left-DEZzHiPS.js";import{C as Ve}from"./chevron-right-XiIHsk4m.js";import{C as Xe}from"./check-DjgFiBxb.js";import{C as Je}from"./copy-CQGYbxdu.js";import"./cache-Dr0why2k.js";import"./usePierreRuntime-wC-yMtBb.js";/* empty css */import"./chevron-down-BGk5qoEw.js";import"./createLucideIcon-OpA4Amw5.js";import"./search-CWfZtOt2.js";const Qe=new Set(["node_modules",".git","dist",".next",".build","DerivedData","__pycache__",".venv","target"]);function ke(n){const l=n.lastIndexOf("/");return l>0?n.slice(0,l):"/"}function ne(n){const l=n.lastIndexOf("/");return l>=0?n.slice(l+1):n}function z(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function b(n){return n.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function Ye(n,l,m){const k=b(l),f=n.projects.find(d=>b(d.name)===k||b(ne(d.root))===k);if(!f)return null;const w=m?f.worktrees.find(d=>d.name===m||d.branch.name===m||b(d.name)===b(m)):f.worktrees[0];return{projectName:f.name,root:w?.path??f.root}}function ve(n,l){if(!l.startsWith(`${n}/`))return[];const m=l.slice(n.length+1).split("/"),k=[];let f=n;for(const w of m.slice(0,-1))f=`${f}/${w}`,k.push(f);return k}function Ze(n){switch(n){case"untracked":return"U";case"conflicted":return"C";case"staged":return"S";case"unstaged":return"M";case"staged+unstaged":return"SM";default:return n.charAt(0).toUpperCase()}}function je(n,l,m,k,f){const w=m.get(n);if(!w){f.push({path:`${n}#loading`,name:"Loading…",kind:"file",depth:l,loading:!0});return}for(const d of w)d.kind==="directory"&&Qe.has(d.name)||(f.push({path:d.path,name:d.name,kind:d.kind,depth:l}),d.kind==="directory"&&k.has(d.path)&&je(d.path,l+1,m,k,f))}function wt({route:n,navigate:l,root:m,file:k,project:f,path:w,wt:d,line:we,endLine:Ce,returnConversationId:xe,embedded:A=!1}){const $=m??n?.root??null,M=k??n?.file??null,C=f??n?.project??null,O=w??n?.path??null,se=d??n?.wt??null,g=we??n?.line,x=Ce??n?.endLine,j=xe??n?.returnConversationId??null,[p,re]=r.useState(()=>Be()),[s,H]=r.useState(()=>$??(C?null:Ue())),[S,K]=r.useState(()=>new Map),[y,D]=r.useState(()=>new Set),[ie,q]=r.useState(null),[a,T]=r.useState(M),[c,I]=r.useState(null),[Se,G]=r.useState(!1),[oe,B]=r.useState(null),[ae,V]=r.useState("idle"),[R,X]=r.useState("source"),[h,J]=r.useState(()=>g&&g>0?{line:g,...x&&x>=g?{endLine:x}:{}}:null);r.useEffect(()=>{J(g&&g>0?{line:g,...x&&x>=g?{endLine:x}:{}}:null)},[x,g]),r.useEffect(()=>{if(p)return;let e=!1;return he("quick",!1,2e4).then(t=>{e||re(t)}).catch(()=>{}),()=>{e=!0}},[p]);const L=r.useCallback(async e=>{try{const t=await te(`/api/file/preview?path=${encodeURIComponent(e)}`);if(t.kind!=="directory")return;const o=t.entries.map(u=>({name:u.name,path:u.path,kind:u.kind}));K(u=>new Map(u).set(e,o))}catch(t){q(t instanceof Error?t.message:String(t))}},[]),N=r.useCallback((e,t)=>{if(!t)return;const o=ve(e,t);if(o.length!==0){D(u=>new Set([...u,...o]));for(const u of o)L(u)}},[L]);r.useEffect(()=>{if(!C||!p)return;const e=Ye(p,C,se);if(!e){q(`No project matching "${C}".`);return}const t=O?`${e.root}/${O}`:null;H(e.root),T(t),N(e.root,t)},[C,O,se,p,N]),r.useEffect(()=>{if(s||C||!p)return;const e=p.projects[0];e&&H(e.worktrees[0]?.path??e.root)},[s,C,p]);const ce=r.useRef(a);ce.current=a,r.useEffect(()=>{if(!s)return;q(null);const e=ze(s),t=ce.current,o=t?ve(s,t):[];e?(K(new Map(Object.entries(e.entries))),D(new Set([...e.expanded,...o])),!t&&e.selectedFile&&T(e.selectedFile)):(K(new Map),D(new Set(o)));const u=new Set([s,...e?.expanded??[],...o]);for(const ee of u)L(ee);he("quick",!1,2e4).then(re).catch(()=>{})},[s,L]),r.useEffect(()=>{!s||S.size===0||(Ae(s,{entries:S,expanded:y,selectedFile:a}),Oe(s))},[s,S,y,a]),r.useEffect(()=>{!$||!M||N($,M)},[$,M,N]);const Q=r.useRef(new Map),Y=r.useRef(new Set),be=3e4,P=r.useCallback(e=>{const t=Q.current.get(e);return t?Date.now()-t.at>be?(Q.current.delete(e),null):t.preview:null},[]),W=r.useCallback((e,t)=>{const o=Q.current;if(o.set(e,{at:Date.now(),preview:t}),o.size>80){const u=o.keys().next().value;u&&o.delete(u)}},[]),ye=r.useCallback(e=>{P(e)||Y.current.has(e)||(Y.current.add(e),te(`/api/file/preview?path=${encodeURIComponent(e)}`).then(t=>W(e,t)).catch(()=>{}).finally(()=>Y.current.delete(e)))},[P,W]);r.useEffect(()=>{if(V("idle"),!a){I(null),B(null);return}const e=P(a);if(e){I(e.kind==="file"?e:null),B(null),G(!1);return}let t=!1;return G(!0),B(null),te(`/api/file/preview?path=${encodeURIComponent(a)}`).then(o=>{t||(W(a,o),I(o.kind==="file"?o:null))}).catch(o=>{t||(I(null),B(o instanceof Error?o.message:String(o)))}).finally(()=>{t||G(!1)}),()=>{t=!0}},[a,P,W]);const Le=r.useMemo(()=>{if(!s)return[];const e=[];return je(s,0,S,y,e),e},[s,S,y]),le=r.useCallback((e,t)=>{const o=j?{returnConversationId:j}:{};if(p){for(const u of p.projects)for(const[ee,ue]of u.worktrees.entries())if(ue.path===e){const fe=t&&t.startsWith(`${e}/`)?t.slice(e.length+1):void 0;return{view:"code",project:b(u.name),...fe?{path:fe}:{},...ee>0?{wt:ue.name}:{},...o}}}return{view:"code",root:e,...t?{file:t}:{},...o}},[j,p]),Z=r.useCallback(()=>{if(!j)return;const e={view:"conversation",conversationId:j};Ie({type:"navigate",route:e})||l?.(e)},[l,j]);r.useEffect(()=>{if(!j)return;const e=t=>{if(!(!t.metaKey||t.key!=="[")){if(t.target instanceof HTMLElement){const o=t.target.tagName;if(o==="INPUT"||o==="TEXTAREA"||t.target.isContentEditable)return}t.preventDefault(),Z()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[j,Z]);const _=r.useCallback((e,t)=>{A||!l||l(le(e,t))},[A,l,le]),Ne=r.useCallback(e=>{D(t=>{const o=new Set(t);return o.has(e)?o.delete(e):o.add(e),o}),S.has(e)||L(e)},[S,L]),Ee=r.useCallback(e=>{J(null),T(e),s&&_(s,e)},[s,_]),v=r.useMemo(()=>{if(!p||!s)return null;for(const e of p.projects)for(const t of e.worktrees)if(t.path===s)return{project:e,worktree:t};return null},[p,s]),E=r.useMemo(()=>{const e=new Map;if(!s||!v)return e;for(const t of v.worktree.status.files)e.set(`${s}/${t.path}`,t.status);return e},[s,v]),Re=r.useMemo(()=>{const e=new Set;if(!s)return e;for(const t of E.keys()){let o=ke(t);for(;o.startsWith(s)&&(e.add(o),o!==s);)o=ke(o)}return e},[s,E]),U=!!(s&&a&&We(s,a));r.useEffect(()=>{U||X("source")},[U]);const Fe=a&&s&&a.startsWith(`${s}/`)?a.slice(s.length+1):c?.kind==="file"?c.title:a?ne(a):null,$e=r.useCallback(async()=>{if(!c||c.kind!=="file"||!c.previewable)return;await pe(c.content)&&(V("copied"),window.setTimeout(()=>V("idle"),1500))},[c]),[Me,de]=r.useState("idle"),F=r.useMemo(()=>{if(!s)return null;if(v){const e=a&&a.startsWith(`${s}/`)?a.slice(s.length+1):void 0,t=v.project.worktrees[0]?.path;return me({project:b(v.project.name),...e?{path:e}:{},...t&&t!==s?{wt:v.worktree.name}:{},...h?.line?{line:h.line}:{},...h?.endLine?{endLine:h.endLine}:{}})}return me({...a?{file:a}:{root:s},...h?.line?{line:h.line}:{},...h?.endLine?{endLine:h.endLine}:{}})},[s,a,v,h]),De=r.useCallback(async()=>{if(!F)return;await pe(F)&&(de("copied"),window.setTimeout(()=>de("idle"),1500))},[F]),Te=r.useCallback(e=>{J(e.line&&e.line>0?{line:e.line,...e.endLine&&e.endLine>=e.line?{endLine:e.endLine}:{}}:null),T(e.file??null),H(e.root),e.file&&N(e.root,e.file),_(e.root,e.file??null)},[N,_]);return i.jsxs("div",{className:"s-code-screen","data-embedded":A||void 0,children:[i.jsxs("div",{className:"s-code-head",children:[j?i.jsxs("button",{type:"button",className:"s-code-returnThread",onClick:Z,title:"Back to thread (⌘[)",children:[i.jsx(Ge,{size:13,strokeWidth:1.9,"aria-hidden":!0}),i.jsx("span",{children:"Back to thread"})]}):null,i.jsx(He,{snapshot:p,root:s,onSelect:Te}),v?.worktree.diff.branchShortstat?i.jsx("span",{className:"s-code-headStat",children:v.worktree.diff.branchShortstat}):null,s?i.jsx("span",{className:"s-code-headPath",title:s,children:Ke(s)}):null,F?i.jsx("button",{type:"button",className:"s-code-copyLink",title:F,onClick:()=>{De()},children:Me==="copied"?"Copied scout://":"Copy scout://"}):null]}),i.jsxs("div",{className:"s-code-body",children:[i.jsx("div",{className:"s-code-tree",role:"tree","aria-label":"Files",children:ie?i.jsx("div",{className:"s-code-treeNote",children:ie}):s?Le.map(e=>e.loading?i.jsx("div",{className:"s-code-node s-code-node--loading",style:{paddingLeft:10+e.depth*14},children:e.name},e.path):i.jsxs("button",{type:"button",role:"treeitem",className:"s-code-node","data-selected":e.path===a||void 0,"data-diff":e.kind==="file"?E.get(e.path):void 0,"aria-expanded":e.kind==="directory"?y.has(e.path):void 0,style:{paddingLeft:10+e.depth*14},onClick:()=>e.kind==="directory"?Ne(e.path):Ee(e.path),onMouseEnter:e.kind==="file"?()=>ye(e.path):void 0,children:[e.kind==="directory"?i.jsx(Ve,{size:11,strokeWidth:2,className:"s-code-nodeChevron","data-open":y.has(e.path)||void 0,"aria-hidden":!0}):i.jsx("span",{className:"s-code-nodeSpacer","aria-hidden":!0}),i.jsx("span",{className:"s-code-nodeName",children:e.name}),e.kind==="file"&&E.has(e.path)?i.jsx("span",{className:"s-code-nodeBadge","data-diff":E.get(e.path),children:Ze(E.get(e.path)??"")}):null,e.kind==="directory"&&Re.has(e.path)?i.jsx("span",{className:"s-code-nodeDot","aria-label":"Contains changes"}):null]},e.path)):i.jsx("div",{className:"s-code-treeNote",children:"No repo selected."})}),i.jsxs("div",{className:"s-code-main",children:[a?i.jsxs("div",{className:"s-code-fileHead",children:[i.jsx("span",{className:"s-code-filePath",children:Fe}),U?i.jsxs("div",{className:"s-code-fileMode",role:"tablist","aria-label":"File view",children:[i.jsx("button",{type:"button",role:"tab","aria-selected":R==="source","data-selected":R==="source"||void 0,onClick:()=>X("source"),children:"Source"}),i.jsx("button",{type:"button",role:"tab","aria-selected":R==="changes","data-selected":R==="changes"||void 0,onClick:()=>X("changes"),children:"Changes"})]}):null,c?.kind==="file"?i.jsxs("span",{className:"s-code-fileMeta",children:[z(c.sizeBytes),c.previewable&&c.truncated?" · truncated":"",h?` · L${h.line}${h.endLine?`–${h.endLine}`:""}`:""]}):null,c?.kind==="file"&&c.previewable?i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:"s-code-fileAction",onClick:()=>{$e()},title:"Copy file contents",children:[ae==="copied"?i.jsx(Xe,{size:12,"aria-hidden":!0}):i.jsx(Je,{size:12,"aria-hidden":!0}),ae==="copied"?"Copied":"Copy"]}),i.jsx("a",{className:"s-code-fileAction",href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"Raw"})]}):null]}):null,R==="changes"&&U&&s&&a?i.jsx(_e,{root:s,file:a},`${s}\0${a}`):Se?i.jsxs("div",{className:"s-code-empty",children:["Loading ",a?ne(a):"file","…"]}):oe?i.jsx("div",{className:"s-code-empty",children:oe}):c&&c.kind==="file"&&c.previewable?i.jsxs(i.Fragment,{children:[c.truncated?i.jsxs("div",{className:"s-code-fileNote",children:["Showing the first ",z(256*1024)," of ",z(c.sizeBytes)," ·"," ",i.jsx("a",{href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"open raw"})]}):null,i.jsx(qe,{code:c.content,path:c.path,focusLine:h?.line,endLine:h?.endLine})]}):c&&c.kind==="file"?i.jsxs("div",{className:"s-code-empty",children:[c.previewReason," · ",z(c.sizeBytes)," ·"," ",i.jsx("a",{href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"open raw"})]}):i.jsx("div",{className:"s-code-empty",children:"Pick a file to read."})]})]})]})}const Ct=Pe({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:n=>({root:n.get("root")?.trim()||void 0,file:n.get("file")?.trim()||void 0,project:n.get("project")?.trim()||void 0,path:n.get("path")?.trim()||void 0,wt:n.get("wt")?.trim()||void 0,line:ge(n.get("line")),endLine:ge(n.get("endLine")),returnConversationId:n.get("fromConversation")?.trim()||void 0})}});function ge(n){if(!n)return;const l=Number.parseInt(n,10);return Number.isSafeInteger(l)&&l>0?l:void 0}export{wt as CodeContent,Ct as scoutSurface};
@@ -0,0 +1 @@
1
+ import{r as u,j as s}from"./index-DMiGbrBt.js";const x={current:null,setMenu:null};function p(){return u.useCallback((i,t)=>{i.preventDefault(),i.stopPropagation(),x.setMenu?.({position:{x:i.clientX,y:i.clientY},items:t})},[])}function f({children:i}){const[t,w]=u.useState(null),d=u.useRef(null);x.setMenu=w;const r=u.useCallback(()=>{w(null)},[]);return u.useEffect(()=>{if(!t)return;const e=n=>{n.target instanceof Node&&d.current?.contains(n.target)||r()},o=n=>{n.key==="Escape"&&r()},l=()=>r(),c=n=>{n.defaultPrevented||r()};return window.addEventListener("mousedown",e,!0),window.addEventListener("keydown",o),window.addEventListener("wheel",l,!0),window.addEventListener("contextmenu",c),()=>{window.removeEventListener("mousedown",e,!0),window.removeEventListener("keydown",o),window.removeEventListener("wheel",l,!0),window.removeEventListener("contextmenu",c)}},[t,r]),u.useLayoutEffect(()=>{if(!t||!d.current)return;const e=d.current,o=e.getBoundingClientRect(),l=window.innerWidth,c=window.innerHeight;let n=t.position.x,a=t.position.y;n+o.width>l-8&&(n=l-o.width-8),a+o.height>c-8&&(a=c-o.height-8),n<8&&(n=8),a<8&&(a=8),e.style.left=`${n}px`,e.style.top=`${a}px`,e.style.visibility="visible"},[t]),s.jsxs(s.Fragment,{children:[i,t&&s.jsx("div",{ref:d,className:"s-context-menu",style:{left:t.position.x,top:t.position.y,visibility:"hidden"},role:"menu",onMouseDown:e=>e.stopPropagation(),children:t.items.map((e,o)=>e.kind==="separator"?s.jsx("div",{className:"s-context-menu-sep",role:"separator"},o):s.jsxs("button",{type:"button",className:"s-context-menu-item",role:"menuitem",onClick:()=>{e.onSelect(),r()},children:[s.jsx("span",{className:"s-context-menu-label",children:e.label}),e.shortcut&&s.jsx("span",{className:"s-context-menu-shortcut",children:e.shortcut})]},o))})]})}export{f as C,p as u};
@@ -0,0 +1 @@
1
+ import{r as d,j as e}from"./index-DMiGbrBt.js";import{d as J}from"./colors-BtO5_zlx.js";import{M as Y}from"./runtime-picker-Bcl5iIX5.js";import{i as Z,r as ee,d as M,a as se,M as _}from"./MessageComposerSuggestions-DpxN9WiB.js";import{F as te}from"./file-text-BODxCjcz.js";import"./index-CJXzfjo9.js";import{c as ae}from"./createLucideIcon-OpA4Amw5.js";import{X as ne}from"./x-D3GElQbe.js";const re=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]],oe=ae("reply",re),H="Only markdown, code, images, and video clips can be attached.";function je(){const[o,g]=d.useState([]),[m,x]=d.useState(null),[c,p]=d.useState(null),[u,j]=d.useState(0),a=d.useRef(null),k=d.useCallback((n,l="Attached")=>{const i=n.filter(Z);return i.length===0?(n.length>0&&p(H),0):(p(null),g(C=>{const P=new Set(C.map(h=>`${h.name}:${h.size}:${h.lastModified}`)),R=i.filter(h=>!P.has(`${h.name}:${h.size}:${h.lastModified}`));return R.length>0?[...C,...R]:C}),x(i.length===1?`${l} ${i[0]?.name??"1 attachment"}.`:`${l} ${i.length} attachments.`),i.length)},[]),b=d.useCallback(n=>{g(l=>l.filter(i=>i!==n)),x(null)},[]),$=d.useCallback(()=>{g([]),x(null),p(null),j(0)},[]),q=d.useCallback(()=>{a.current?.click()},[]),E=d.useCallback(n=>{const l=ee(n.clipboardData);l.length!==0&&(n.preventDefault(),k(l,"Pasted"))},[k]),f=d.useMemo(()=>({onDragOver:n=>{M(n.dataTransfer)&&(n.preventDefault(),j(l=>l===0?1:l))},onDragLeave:n=>{n.currentTarget.contains(n.relatedTarget)||j(0)},onDrop:n=>{if(!M(n.dataTransfer))return;n.preventDefault(),j(0);const l=se(n.dataTransfer);if(l.length===0){p(H);return}k(l,"Dropped")}}),[k]);return{files:o,hasFiles:o.length>0,feedback:m,error:c,dragActive:u>0,stage:k,remove:b,clear:$,setError:p,openPicker:q,dropHandlers:f,onPaste:E,inputRef:a}}function le({file:o,onRemove:g}){const m=d.useMemo(()=>URL.createObjectURL(o),[o]);d.useEffect(()=>()=>URL.revokeObjectURL(m),[m]);const x=o.type.startsWith("video/"),c=o.type.startsWith("image/");return e.jsxs("div",{className:"s-msg-compose-attachment",children:[x?e.jsx("video",{src:m,muted:!0,playsInline:!0}):c?e.jsx("img",{src:m,alt:o.name}):e.jsxs("div",{className:"s-msg-compose-attachment-file",title:o.name,children:[e.jsx(te,{size:18,"aria-hidden":"true"}),e.jsx("span",{children:o.name})]}),e.jsx("button",{type:"button",className:"s-msg-compose-attachment-remove","aria-label":`Remove ${o.name}`,onClick:g,children:"×"})]})}function ce({attachments:o,accept:g="image/*,video/*,text/markdown,.md,.markdown,text/plain,.txt"}){const{files:m,feedback:x,error:c,remove:p,stage:u,inputRef:j}=o;return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:j,type:"file",multiple:!0,accept:g,className:"s-msg-compose-file-input",onChange:a=>{u([...a.target.files??[]]),a.target.value=""}}),m.length>0?e.jsx("div",{className:"s-msg-compose-attachments","aria-label":"Staged attachments",children:m.map(a=>e.jsx(le,{file:a,onRemove:()=>p(a)},`${a.name}:${a.size}:${a.lastModified}`))}):null,c?e.jsx("div",{className:"s-msg-compose-attach-note","data-tone":"error",role:"alert",children:c}):x?e.jsx("div",{className:"s-msg-compose-attach-note","data-tone":"muted",role:"status",children:x}):null]})}function ie({composeRef:o,draft:g,setDraft:m,composePlaceholder:x,slashState:c,setSlashState:p,filteredSlashCommands:u,applySlashCommand:j,mentionState:a,setMentionState:k,filteredMentions:b,applyMention:$,updateTriggersFromDraft:q,closeSuggestions:E,replyTarget:f,onCancelReply:n,isStopMode:l,sending:i,composeAction:C,onSend:P,onInterrupt:R,sendReceipt:h,attachments:v,isAgentBusy:I,busyIntent:T,onBusyIntentChange:L,queued:N,queueNote:K,onEditQueued:W,editingQueuedId:w,editingAttachmentCount:A,onCancelEdit:S,onUnqueue:Q,onSendQueuedNow:B}){const V=e.jsxs(e.Fragment,{children:[c.open?e.jsx(_,{label:"Slash commands",items:u.map(s=>({id:s.command,token:s.label,description:s.description})),activeIndex:c.index,onPick:s=>{const t=u[s];t&&j(t)},onActiveIndexChange:s=>p(t=>({...t,index:s}))}):null,a.open?e.jsx(_,{label:"Mention agent",items:b.map(s=>({id:s.id,token:`@${s.handle}`,description:s.name,avatar:{label:s.name[0]?.toUpperCase()??"?",color:J(s.name)}})),activeIndex:a.index,onPick:s=>{const t=b[s];t&&$(t)},onActiveIndexChange:s=>k(t=>({...t,index:s}))}):null]}),X=g.trim().length>0,D=w!==null,O=X||v.hasFiles||A>0,F=I&&O,y=F&&T==="steer",U=D?N.findIndex(s=>s.id===w)+1:0,z=F?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":T==="queue",title:"Hold this draft until the running turn lands",disabled:i,onClick:()=>L("queue"),children:"Queue"}),e.jsx("button",{type:"button",className:"s-msg-compose-mode-btn","data-mode":"steer","aria-pressed":T==="steer",title:"Interrupt the running turn and deliver this now",disabled:i,onClick:()=>L("steer"),children:"Steer"})]}):null,G=N.length>0||z?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:D?y?`Rewriting ${U} — send interrupts this turn`:`Rewriting ${U} — send returns it to its place`:N.length>0?y?"Send interrupts this turn":K??"":y?"Interrupts this turn on send":"Sends when this turn lands"}),z]}),N.map((s,t)=>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:t+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",title:"Stop rewriting — leave this row as it was","aria-label":`Cancel rewriting queued message ${t+1}`,onClick:S,children:"Cancel edit"}):e.jsx("button",{type:"button",className:"s-msg-compose-queue-edit",title:"Pull this back into the input box to rewrite it","aria-label":`Edit queued message ${t+1}`,disabled:i||D,onClick:()=>W(s.id),children:"Edit"}),e.jsx("button",{type:"button",className:"s-msg-compose-queue-now",title:"Interrupt this turn and send this now","aria-label":`Send queued message ${t+1} now`,disabled:i||s.id===w,onClick:()=>B(s.id),children:"Send now"}),e.jsx("button",{type:"button",className:"s-msg-compose-queue-drop",title:"Cancel — drop this from the queue","aria-label":`Cancel queued message ${t+1}`,onClick:()=>Q(s.id),children:"×"})]},s.id))]}):null;return e.jsx(Y,{density:"thread",value:g,onChange:(s,t)=>{m(s),q(s,t?.caret??s.length)},onSend:P,placeholder:x,sending:i,stopMode:l,onStop:R,canSend:O,sendTitle:y?"Steer — interrupt this turn and send now (Cmd+Enter)":F?"Queue for the next turn (Cmd+Enter)":"Send (Cmd+Enter)",sendAriaLabel:y?"Steer — interrupt this turn and send now (Cmd+Enter)":F?"Queue message for the next turn (Cmd+Enter)":C==="steer"?"Send follow-up (Cmd+Enter)":"Send message (Cmd+Enter)",showAttach:!0,onAttach:v.openPicker,onPaste:v.onPaste,dropHandlers:v.dropHandlers,dragActive:v.dragActive,textareaRef:o,overlay:V,above:G,aboveAttached:!0,header:e.jsxs(e.Fragment,{children:[f?e.jsxs("div",{className:"s-thread-compose-reply",role:"status",children:[e.jsx(oe,{className:"s-thread-compose-reply-icon",size:13,strokeWidth:1.8,"aria-hidden":"true"}),e.jsx("span",{className:"s-thread-compose-reply-label",children:"Replying to"}),e.jsx("span",{className:"s-thread-compose-reply-actor",children:f.actorLabel}),e.jsx("span",{className:"s-thread-compose-reply-preview",title:f.preview,children:f.preview}),e.jsx("button",{type:"button",className:"s-thread-compose-reply-cancel","aria-label":"Cancel reply",title:"Cancel reply",onClick:n,children:e.jsx(ne,{size:13,strokeWidth:1.8,"aria-hidden":"true"})})]}):null,D&&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(ce,{attachments:v})]}),status:h?e.jsx("div",{className:"s-thread-compose-receipt","data-tone":h.tone,role:"status",children:h.text}):null,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 t=s.currentTarget;q(t.value,t.selectionStart)},onBlur:()=>{setTimeout(E,120)},onKeyDown:s=>{if(!(c.open&&u.length>0||a.open&&b.length>0))return!1;if(s.key==="ArrowDown")return c.open?p(r=>({...r,index:(r.index+1)%u.length})):a.open&&k(r=>({...r,index:(r.index+1)%b.length})),!0;if(s.key==="ArrowUp")return c.open?p(r=>({...r,index:(r.index-1+u.length)%u.length})):a.open&&k(r=>({...r,index:(r.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(c.open){const r=u[c.index]??u[0];r&&j(r)}else if(a.open){const r=b[a.index]??b[0];r&&$(r)}return!0}return!1}})}const ke=Object.freeze(Object.defineProperty({__proto__:null,ConversationComposer:ie},Symbol.toStringTag,{value:"Module"}));export{ie as C,ke as a,je as u};
@@ -0,0 +1 @@
1
+ import{j as t}from"./index-DMiGbrBt.js";import{M as p}from"./message-markup-3J9pi3nx.js";import{f as n}from"./conversation-model-B47vYmWN.js";import{t as d}from"./time-DltNTpLl.js";import"./mentions-jSuTGeet.js";import"./colors-BtO5_zlx.js";import"./index-CJXzfjo9.js";import"./api-h5zurxmi.js";import"./Provider-C7UKGHQy.js";import"./router-Bq5dwf78.js";import"./terminal-sessions-D5CIR2OL.js";import"./sse-CjIkKo46.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-bARZqTzD.js";import"./DocumentFocusViewer-BeVwwl26.js";import"./createLucideIcon-OpA4Amw5.js";import"./TextDocumentSurface-BpAw4eQS.js";/* empty css */import"./file-text-BODxCjcz.js";import"./x-D3GElQbe.js";import"./chevron-right-XiIHsk4m.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-2kv_tGUS.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./NewChatComposer-Cs6OsxK6.js";import"./runtime-picker-Bcl5iIX5.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-CbHjZsz1.js";import"./HarnessMark-Cbv3Ib0c.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-BGk5qoEw.js";import"./search-CWfZtOt2.js";import"./AgentDetailCard-BcRBRp88.js";import"./AgentLiveActions-DBtnD0qE.js";import"./terminal-takeover-B8UeD9OX.js";import"./openContent-C6XO6kr5.js";import"./eye-0PvebX_a.js";import"./terminal-B9AOZQKR.js";function l({at:a}){const r=n(a);return t.jsxs("div",{className:"s-thread-day-divider","aria-label":r,children:[t.jsx("span",{className:"s-thread-day-line","aria-hidden":"true"}),t.jsx("span",{className:"s-thread-day-label",children:r}),t.jsx("span",{className:"s-thread-day-line","aria-hidden":"true"})]})}function et({row:a,expanded:r,showDayDivider:e,onToggle:s}){const m=`Sent to ${a.recipients.length} agents`;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(i=>t.jsx("span",{id:`msg-${i.id}`,className:"s-thread-fanout-anchor","aria-hidden":"true"},i.id)),t.jsxs("button",{type:"button",className:"s-thread-fanout-summary","aria-expanded":r,onClick:s,title:a.recipients.join(", "),children:[t.jsx("span",{className:"s-thread-fanout-caret","aria-hidden":"true",children:r?"▾":"▸"}),t.jsx("span",{className:"s-thread-fanout-label",children:m}),t.jsx("span",{className:"s-thread-fanout-time",children:d(a.createdAt)})]}),r&&t.jsxs("div",{className:"s-thread-fanout-detail",children:[t.jsx("ul",{className:"s-thread-fanout-recipients",children:a.messages.map((i,o)=>t.jsx("li",{className:"s-thread-fanout-recipient",children:a.recipients[o]},i.id))}),t.jsx("div",{className:"s-thread-fanout-body",children:t.jsx(p,{text:a.messages[0].body})})]})]})}export{et as FanOutRow,l as ThreadDayDivider};
@@ -0,0 +1 @@
1
+ import{j as e}from"./index-DMiGbrBt.js";import{c as p}from"./clipboard-e3fSpeo7.js";import{A as j}from"./AgentAvatar-D90c1Rzk.js";import{u as g}from"./ContextMenu-bARZqTzD.js";import{B as k}from"./BackToPicker-BRvfostO.js";import{o as b}from"./openContent-C6XO6kr5.js";import{s as C,u as w}from"./conversation-model-B47vYmWN.js";import{E as A}from"./eye-0PvebX_a.js";import{c as $}from"./createLucideIcon-OpA4Amw5.js";import"./SpriteAvatar-DyaGuhik.js";import"./colors-BtO5_zlx.js";import"./router-Bq5dwf78.js";import"./terminal-sessions-D5CIR2OL.js";import"./api-h5zurxmi.js";import"./time-DltNTpLl.js";const T=[["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"}]],L=$("user-plus",T);function Y({showBackNav:n,isDm:a,navigate:l,route:i,canonicalConversationId:d,threadTitle:h,agentId:m,visibleParticipants:s,hiddenParticipantCount:u,operator:c,canAddParticipants:v,onToggleAddParticipant:y}){const N=g();return e.jsxs("div",{className:"s-thread-center-header",onClick:t=>{t.target?.closest("button,a,input,select,textarea")||a&&b(l,{view:"agent-info",conversationId:d},{returnTo:i})},style:a?{cursor:"pointer"}:void 0,onContextMenu:t=>{const o=[{kind:"action",label:"Copy Title",onSelect:()=>{p(h)}}];m&&o.push({kind:"action",label:"Copy Agent ID",onSelect:()=>{p(m)}}),o.push({kind:"action",label:"Copy Conversation ID",onSelect:()=>{p(d)}}),N(t,o)},children:[n&&e.jsx(k,{slot:"conversation",fallback:{view:"inbox"},navigate:l,label:"Back",className:"s-thread-header-back"}),e.jsx("div",{className:"s-thread-center-header-info",children:e.jsx("span",{className:"s-thread-center-header-name",children:h})}),e.jsxs("div",{className:"s-thread-center-header-right",children:[s.length>0&&e.jsxs("div",{className:"s-thread-participants","aria-label":"Conversation participants",children:[s.map(t=>{const r=[t.model??(t.harness?"model unknown":null),t.reasoningEffort].filter(Boolean).join(" · ")||null,f=r?`${t.name} · ${r}`:t.title,x=e.jsxs(e.Fragment,{children:[e.jsx(j,{agent:t.agent??void 0,name:t.name,placement:"turn",className:"s-thread-participant-avatar",title:t.name}),e.jsxs("span",{className:"s-thread-participant-identity",children:[e.jsx("span",{className:"s-thread-participant-name",children:t.name}),r&&e.jsx("span",{className:"s-thread-participant-model",title:r,children:r})]})]});return t.agent?e.jsx("button",{type:"button",className:"s-thread-participant-pill s-thread-participant-pill--button",title:`Open ${t.name} profile${r?` · ${r}`:""}`,onClick:()=>b(l,{view:"agents-v2",agentId:t.agent.id},{returnTo:i}),children:x},t.id):e.jsx("span",{className:"s-thread-participant-pill",title:f,children:x},t.id)}),u>0&&e.jsxs("span",{className:"s-thread-participant-overflow",children:["+",u]}),c.active?e.jsxs("span",{className:"s-thread-participant-pill s-thread-participant-pill--operator",title:`${c.name} · in this conversation`,children:[e.jsx(j,{name:c.name,placement:"turn",className:"s-thread-participant-avatar s-thread-participant-avatar--operator",title:c.name}),e.jsx("span",{className:"s-thread-participant-identity",children:e.jsx("span",{className:"s-thread-participant-name",children:"You"})})]}):e.jsxs("span",{className:"s-thread-participant-observer",title:`${c.name} · observing (not in thread)`,children:[e.jsx(A,{size:12,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Observing"})]})]}),v&&e.jsx("button",{type:"button",className:"s-thread-add-participant-trigger",onClick:y,title:"Add participant","aria-label":"Add participant",children:e.jsx(L,{size:14,strokeWidth:1.9,"aria-hidden":"true"})})]})]})}function G({canonicalConversationId:n,conversationAlias:a}){return e.jsxs("div",{className:"s-thread-identity-row",children:[e.jsxs("button",{type:"button",className:"s-thread-identity-chip",title:n,onClick:()=>{p(n)},children:[e.jsx("span",{children:C()}),e.jsx("strong",{children:w(n)})]}),a&&e.jsxs("span",{className:"s-thread-identity-chip",title:a,children:[e.jsx("span",{children:"Alias"}),e.jsx("strong",{children:a})]})]})}function J({agents:n,addParticipantId:a,setAddParticipantId:l,addingParticipant:i,addParticipantError:d,onCancel:h,onSubmit:m}){return e.jsxs("form",{className:"s-thread-add-participant",onSubmit:s=>{s.preventDefault(),m()},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:a,onChange:s=>l(s.target.value),autoFocus:!0,children:n.map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))})]}),e.jsxs("div",{className:"s-thread-add-participant-actions",children:[e.jsx("button",{type:"button",className:"s-btn s-btn-sm",onClick:h,disabled:i,children:"Cancel"}),e.jsx("button",{type:"submit",className:"s-btn s-btn-primary s-btn-sm",disabled:i||a.trim().length===0,children:i?"Adding...":"Add"})]})]}),d&&e.jsx("div",{className:"s-thread-add-participant-error",children:d})]})}export{J as AddParticipantForm,Y as ConversationHeader,G as ConversationIdentityRow};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/conversation-motion-features-BdAONVls.js","assets/gestures-CcwOTu8C.js","assets/index-DMiGbrBt.js","assets/index-DxGoC5l5.css","assets/use-reduced-motion-RRBkmVkk.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,_ as M,r as x}from"./index-DMiGbrBt.js";import{b as L,t as _,g as S,r as R,d as $,m as w,c as E,e as I,p as P}from"./conversation-model-B47vYmWN.js";import{n as W,d as b,f as B,s as z}from"./colors-BtO5_zlx.js";import{i as y}from"./sessionRead-CvFz2RHv.js";import{t as j,f as k}from"./time-DltNTpLl.js";import{u as U}from"./Provider-C7UKGHQy.js";import{o as f}from"./openContent-C6XO6kr5.js";import{u as D,L as F,m as p}from"./use-reduced-motion-RRBkmVkk.js";import{A as O}from"./activity-CA8qS6PI.js";import{T as H}from"./terminal-B9AOZQKR.js";import{M as K}from"./message-circle-CG-96zts.js";import"./router-Bq5dwf78.js";import"./terminal-sessions-D5CIR2OL.js";import"./api-h5zurxmi.js";import"./sse-CjIkKo46.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-bARZqTzD.js";import"./DocumentFocusViewer-BeVwwl26.js";import"./createLucideIcon-OpA4Amw5.js";import"./TextDocumentSurface-BpAw4eQS.js";/* empty css */import"./file-text-BODxCjcz.js";import"./x-D3GElQbe.js";import"./chevron-right-XiIHsk4m.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-2kv_tGUS.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./NewChatComposer-Cs6OsxK6.js";import"./runtime-picker-Bcl5iIX5.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-CbHjZsz1.js";import"./index-CJXzfjo9.js";import"./HarnessMark-Cbv3Ib0c.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-BGk5qoEw.js";import"./search-CWfZtOt2.js";const G=[{head:"30%",body:"88%",short:"62%"},{head:"22%",body:"76%",short:"48%"},{head:"34%",body:"82%",short:"68%"}],J=()=>M(()=>import("./conversation-motion-features-BdAONVls.js"),__vite__mapDeps([0,1,2,3,4])).then(a=>a.default);function Y({onOpenTrace:a,onOpenTerminal:i,onSteer:d,compact:r=!1}){return!a&&!i&&!d?null:e.jsxs("nav",{className:`s-thread-working-actions${r?" s-thread-working-actions--compact":""}`,"aria-label":"Working turn actions",children:[a&&e.jsxs("button",{type:"button",className:"s-thread-working-action s-thread-working-action--primary",onClick:a,title:"Watch this run's live trace",children:[e.jsx(O,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Live trace"})]}),i&&e.jsxs("button",{type:"button",className:"s-thread-working-action",onClick:i,title:"Jump into this agent's terminal",children:[e.jsx(H,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Terminal"})]}),d&&e.jsxs("button",{type:"button",className:"s-thread-working-action",onClick:d,title:"Write an interrupting message to steer this turn",children:[e.jsx(K,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Steer…"})]})]})}const q={think:"Thinking",tool:"Tool",ask:"Prompt",message:"Says",note:"Note",system:"System",boot:"Boot"};function N({steps:a,phase:i,limit:d=5,compact:r=!1}){const l=a.slice(-d),o=a.length-l.length;return l.length===0?i?e.jsxs("div",{className:"s-thread-steps-phase",children:[e.jsx("span",{children:i.label}),e.jsx("strong",{children:i.detail})]}):null:e.jsxs("div",{className:`s-thread-steps${r?" s-thread-steps--compact":""}`,children:[o>0&&e.jsxs("div",{className:"s-thread-steps-elided",children:[o," earlier step",o===1?"":"s"]}),e.jsx("ol",{"aria-label":"Live steps in this turn",children:l.map(s=>e.jsxs("li",{"data-kind":s.kind,children:[e.jsx("span",{className:"s-thread-step-mark","aria-hidden":"true"}),e.jsx("span",{className:"s-thread-step-kind",children:q[s.kind]}),e.jsxs("span",{className:"s-thread-step-body",children:[s.tool?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"s-thread-step-tool",children:s.tool}),s.arg&&e.jsx("span",{className:"s-thread-step-arg",children:s.arg})]}):e.jsx("span",{className:"s-thread-step-text",children:s.text}),s.repeatCount>1&&e.jsxs("span",{className:"s-thread-step-repeat",children:["×",s.repeatCount]}),s.outcome&&e.jsx("span",{className:"s-thread-step-outcome",children:s.outcome})]}),e.jsx("time",{title:k(s.ts),children:j(s.ts)})]},s.id))})]})}function Q({events:a,limit:i=3,compact:d=!1}){const r=a.slice(0,i);return r.length===0?null:e.jsx("ol",{className:`s-thread-motion-events${d?" s-thread-motion-events--compact":""}`,"aria-label":"Latest run activity",children:r.map(l=>e.jsxs("li",{children:[e.jsx("span",{className:"s-thread-motion-event-kind",children:L(l.kind)}),e.jsx("span",{className:"s-thread-motion-event-summary",children:_(l)??"Activity recorded"}),e.jsx("time",{title:k(l.ts),children:j(l.ts)})]},l.id))})}function Oe(){const a=D();return e.jsx(F,{features:J,strict:!0,children:e.jsxs(p.section,{className:"s-thread-skeleton","aria-busy":"true","aria-live":"polite",initial:a?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:[.2,.7,.3,1]},children:[e.jsxs("div",{className:"s-thread-skeleton-intro",role:"status",children:[e.jsxs("div",{className:"s-thread-loader-mark","aria-hidden":"true",children:[e.jsx(p.span,{className:"s-thread-loader-orbit",animate:a?void 0:{rotate:360},transition:{duration:3.2,ease:"linear",repeat:1/0},children:e.jsx("span",{})}),e.jsx(p.span,{className:"s-thread-loader-core",animate:a?void 0:{scale:[.88,1,.88],opacity:[.58,1,.58]},transition:{duration:1.8,ease:"easeInOut",repeat:1/0}})]}),e.jsxs("span",{className:"s-thread-skeleton-copy",children:[e.jsx("strong",{children:"Composer ready"}),e.jsx("span",{children:"Gathering the conversation…"})]})]}),e.jsx("div",{className:"s-thread-skeleton-turns","aria-hidden":"true",children:G.map((i,d)=>e.jsxs(p.div,{className:"s-thread-skeleton-turn",initial:a?!1:{opacity:0,y:7},animate:{opacity:1,y:0},transition:{delay:a?0:.05+d*.055,duration:.24,ease:[.2,.7,.3,1]},children:[e.jsx("span",{className:"s-thread-skeleton-avatar"}),e.jsxs("div",{className:"s-thread-skeleton-lines",children:[e.jsx("span",{className:"s-thread-skeleton-line s-thread-skeleton-line--head",style:{width:i.head}}),e.jsx("span",{className:"s-thread-skeleton-line",style:{width:i.body}}),e.jsx("span",{className:"s-thread-skeleton-line s-thread-skeleton-line--short",style:{width:i.short}})]})]},`${i.head}-${i.body}`))})]})})}function He({sessions:a,activeConversationId:i,needsYouIds:d,lastViewed:r,navigate:l}){const o=a.filter(n=>d.has(n.id)||n.agentId&&d.has(n.agentId)),s=x.useMemo(()=>S(a),[a]);return e.jsx("aside",{className:"s-thread-rail",children:e.jsxs("div",{className:"s-thread-rail-scroll",children:[o.length>0&&e.jsxs("div",{className:"s-thread-rail-section s-thread-rail-section--needs-you",children:[e.jsx("div",{className:"s-thread-rail-section-label",children:"Needs you"}),o.map(n=>e.jsx(g,{session:n,active:n.id===i,unread:y(n.lastMessageAt,n.id,r),needsYou:!0,navigate:l},`needs-${n.id}`))]}),s.map(n=>e.jsxs("div",{className:"s-thread-rail-section",children:[e.jsx("div",{className:"s-thread-rail-section-label",children:n.workspace}),n.sessions.map(c=>e.jsx(g,{session:c,active:c.id===i,unread:y(c.lastMessageAt,c.id,r),needsYou:!1,navigate:l},c.id))]},n.workspace))]})})}function Ke({sessionMeta:a,agents:i,flights:d,conversationId:r,navigate:l,route:o}){const s=x.useMemo(()=>a?a.participantIds.filter(t=>t!=="operator").map(t=>R(i,[t])).filter(t=>t!==null):[],[a,i]),n={id:"operator",name:"You",handle:"operator",activity:null,state:"ready",agent:null},c=x.useMemo(()=>s.map(t=>({id:t.id,name:t.name,handle:w(t)??E(t.id)??t.id,activity:$(t,d,r),state:W(t.state),agent:t})),[s,d,r]),h=[n,...c];return e.jsxs("aside",{className:"s-thread-sidebar",children:[e.jsxs("div",{className:"s-thread-sidebar-section",children:[e.jsx("div",{className:"s-thread-sidebar-label",children:"In this conversation"}),h.map(t=>{const m=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"s-ops-avatar",style:{"--size":"28px",background:b(t.name)},children:t.name[0]?.toUpperCase()??"?"}),e.jsxs("div",{className:"s-thread-sidebar-participant-info",children:[e.jsx("span",{className:"s-thread-sidebar-participant-name",children:t.name}),e.jsxs("span",{className:"s-thread-sidebar-participant-handle",children:["@",t.handle]})]}),e.jsx("div",{className:"s-thread-sidebar-participant-activity",children:t.activity?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"s-thread-sidebar-activity-dot s-thread-sidebar-activity-dot--pulse",style:{background:"var(--green)"}}),e.jsx("span",{className:"s-thread-sidebar-activity-label",children:t.activity})]}):B(t.state)||t.id==="operator"?e.jsx("span",{className:"s-thread-sidebar-activity-dot",style:{background:z(t.state)}}):e.jsx("span",{className:"s-thread-sidebar-activity-dot",style:{background:"var(--dim)"}})})]});return t.agent?e.jsx("button",{type:"button",className:"s-thread-sidebar-participant s-thread-sidebar-participant--clickable",onClick:()=>f(l,{view:"agents-v2",agentId:t.agent.id},{returnTo:o}),title:`Open ${t.name} profile`,children:m},t.id):e.jsx("div",{className:"s-thread-sidebar-participant",children:m},t.id)})]}),c.length>0&&e.jsxs("div",{className:"s-thread-sidebar-section",children:[e.jsx("div",{className:"s-thread-sidebar-label",children:"Conversation mesh"}),e.jsx(V,{participants:c})]})]})}function Ge({agentName:a,title:i,detail:d,snapshot:r,events:l,steps:o,phase:s,tone:n,workspaceName:c,branch:h,startedAt:t,onOpenTrace:m,onOpenTerminal:A,onSteer:C}){const T=t?j(t):"now";return e.jsxs("section",{className:`s-thread-motion-panel s-thread-motion-panel--${n}`,"aria-live":"polite",children:[e.jsxs("div",{className:"s-thread-motion-head",children:[e.jsx("div",{className:"s-thread-motion-beacon","aria-hidden":"true",children:e.jsx("span",{})}),e.jsxs("div",{className:"s-thread-motion-title-block",children:[e.jsx("div",{className:"s-thread-motion-kicker",children:"Currently working"}),e.jsx("h2",{children:i}),e.jsx("p",{children:d})]})]}),e.jsx("div",{className:"s-thread-motion-meter","aria-hidden":"true",children:X.map((u,v)=>e.jsx("span",{style:{"--bar-height":`${u}%`,"--bar-delay":`${v*74}ms`}},`${u}-${v}`))}),e.jsxs("dl",{className:"s-thread-motion-stats",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Session"}),e.jsx("dd",{children:T})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Activity"}),e.jsx("dd",{children:r.activityLabel})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Last"}),e.jsx("dd",{children:r.lastActivityLabel})]})]}),e.jsxs("div",{className:"s-thread-motion-latest",children:[e.jsx("span",{children:a}),e.jsx("strong",{children:r.latest})]}),o.length>0?e.jsx(N,{steps:o,phase:null,limit:6}):l.length>0?e.jsx(Q,{events:l,limit:4}):s?e.jsx(N,{steps:o,phase:s,limit:6}):e.jsxs("div",{className:"s-thread-motion-waiting",children:[e.jsx("span",{children:"Session created"}),e.jsx("strong",{children:"waiting for the first trace event"})]}),(c||h)&&e.jsxs("div",{className:"s-thread-motion-chips",children:[c&&e.jsx("span",{children:c}),h&&e.jsx("span",{children:h})]}),e.jsx(Y,{onOpenTrace:m,onOpenTerminal:A,onSteer:C})]})}function g({session:a,active:i,unread:d,needsYou:r,navigate:l}){const{route:o}=U(),s=I(a),n=(a.agentName??s)[0]?.toUpperCase()??"?",c=a.kind==="direct",h=P(a.workspaceRoot)??a.kind;return e.jsxs("button",{type:"button",className:["s-thread-rail-item",i&&"s-thread-rail-item--active",r&&"s-thread-rail-item--needs-you"].filter(Boolean).join(" "),onClick:()=>f(l,{view:"conversation",conversationId:a.id},{returnTo:o}),children:[c?e.jsx("div",{className:"s-thread-rail-avatar",style:{background:b(a.agentName??s)},children:n}):e.jsx("div",{className:"s-thread-rail-avatar s-thread-rail-avatar--channel",children:"#"}),e.jsxs("div",{className:"s-thread-rail-body",children:[e.jsx("span",{className:"s-thread-rail-name",children:s}),e.jsx("span",{className:"s-thread-rail-sub",children:h})]}),e.jsxs("div",{className:"s-thread-rail-trailing",children:[d&&!r&&e.jsx("span",{className:"s-thread-rail-presence-dot",style:{background:"var(--accent)"}}),r&&e.jsx("span",{className:"s-thread-rail-badge s-thread-rail-badge--amber",children:"!"})]})]})}function V({participants:a}){const o=a.map((s,n)=>{const c=2*Math.PI*n/a.length-Math.PI/2;return{...s,x:130+55*Math.cos(c),y:80+55*Math.sin(c)}});return e.jsx("div",{className:"s-thread-mini-mesh",children:e.jsxs("svg",{viewBox:"0 0 260 160","aria-label":"Conversation participant mesh",children:[o.map(s=>e.jsx("line",{x1:130,y1:80,x2:s.x,y2:s.y,className:"s-thread-mini-mesh-edge"},`edge-${s.id}`)),e.jsx("circle",{cx:130,cy:80,r:16,className:"s-thread-mini-mesh-node s-thread-mini-mesh-node--center"}),e.jsx("text",{x:130,y:80,className:"s-thread-mini-mesh-label s-thread-mini-mesh-label--center",children:"OP"}),o.map(s=>e.jsxs("g",{children:[e.jsx("circle",{cx:s.x,cy:s.y,r:16,className:"s-thread-mini-mesh-node",style:s.state==="in_turn"||s.state==="in_flight"?{stroke:"var(--green)"}:void 0}),e.jsx("text",{x:s.x,y:s.y,className:"s-thread-mini-mesh-label",children:s.name.slice(0,3).toUpperCase()})]},`node-${s.id}`))]})})}const X=[42,76,54,88,34,66,92,48,72,38,84,58];export{He as ChannelRail,Ke as PresenceSidebar,Oe as ThreadLoadingSkeleton,Ge as ThreadMotionPanel,Y as WorkingTurnActions,Q as WorkingTurnActivityPreview,N as WorkingTurnSteps};
@@ -0,0 +1 @@
1
+ import{j as a,r}from"./index-DMiGbrBt.js";import{b as gt,w as da,p as Xt,c as Ds,h as ua,l as ma,d as ha,s as Ws,f as pa,g as fa,i as ga}from"./NewChatComposer-Cs6OsxK6.js";import{a as U}from"./api-h5zurxmi.js";import{u as ya}from"./MessageComposerSuggestions-DpxN9WiB.js";import"./runtime-picker-Bcl5iIX5.js";import{u as wa,C as Sa}from"./ConversationComposer-Bla3DDvM.js";import"./index-CJXzfjo9.js";import{u as Ta,e as ba}from"./Provider-C7UKGHQy.js";import{v as Y,w as Bs,x as va,y as Ce,z as xa,A as ka,B as Ca,C as Na,D as Ma,c as Us,S as Hs,E as ja,F as Ia,G as Aa,H as Ra,I as Ea,J as La,K as $a,L as Pa,o as Fa,M as Oa,N as qa,O as Da,e as Wa,p as Ba,r as _s,P as Ua,Q as Ha,R as _a,T as Ka,q as Qa,U as Va,V as Ga,W as Yt,X as za,Y as Ja,Z as yt,n as Xa,_ as Ya,$ as Za,a0 as Ks,a1 as er,a2 as tr,a3 as sr,a4 as nr,a5 as ar,a6 as Qs,a7 as rr,a8 as Vs,a9 as or,aa as ir,ab as lr}from"./conversation-model-B47vYmWN.js";import{u as cr}from"./sse-CjIkKo46.js";import{n as ns,t as wt,f as Zt}from"./time-DltNTpLl.js";import{i as dr}from"./colors-BtO5_zlx.js";import{M as ur}from"./message-markup-3J9pi3nx.js";import{i as es}from"./message-visibility-kJM8XcSG.js";import{b as mr}from"./router-Bq5dwf78.js";import{f as hr}from"./scoutbot-BTIErYHo.js";import{s as pr}from"./sessionRead-CvFz2RHv.js";import{o as Ve}from"./openContent-C6XO6kr5.js";import{u as fr}from"./ContextMenu-bARZqTzD.js";import{c as Ge}from"./clipboard-e3fSpeo7.js";import{A as ts}from"./AgentAvatar-D90c1Rzk.js";import{d as gr}from"./types-B0PlfpKc.js";/* empty css */import{ConversationHeader as yr,ConversationIdentityRow as wr,AddParticipantForm as Sr}from"./ConversationHeader-DE3FC0m-.js";import{FanOutRow as Tr,ThreadDayDivider as br}from"./ConversationFeedRows-B_gPxcqA.js";import{ThreadLoadingSkeleton as vr,ThreadMotionPanel as xr,WorkingTurnSteps as kr,WorkingTurnActivityPreview as Cr,WorkingTurnActions as Nr}from"./ConversationPanels-DLek4H6A.js";import{f as Mr,c as jr,d as Ir,e as Ar,g as Rr}from"./tail-display-BdyoLvzY.js";import{u as Er}from"./tail-events-D19uAGe3.js";import{PinnedAskCard as Lr,ConversationStatusStrip as $r}from"./ConversationStatus-BwVLiiO4.js";import{DismissIcon as Pr}from"./conversation-icons-IIG5ha6D.js";import"./HarnessMark-Cbv3Ib0c.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./keyboard-nav-2kv_tGUS.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./x-D3GElQbe.js";import"./createLucideIcon-OpA4Amw5.js";import"./chevron-down-BGk5qoEw.js";import"./search-CWfZtOt2.js";import"./loader-circle-CbHjZsz1.js";import"./file-text-BODxCjcz.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./surface-activity-B1rgWB1i.js";import"./DocumentFocusViewer-BeVwwl26.js";import"./TextDocumentSurface-BpAw4eQS.js";/* empty css */import"./chevron-right-XiIHsk4m.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./index-BWHgHrtv.js";import"./mentions-jSuTGeet.js";import"./AgentDetailCard-BcRBRp88.js";import"./AgentLiveActions-DBtnD0qE.js";import"./terminal-takeover-B8UeD9OX.js";import"./eye-0PvebX_a.js";import"./terminal-B9AOZQKR.js";import"./terminal-sessions-D5CIR2OL.js";import"./SpriteAvatar-DyaGuhik.js";import"./BackToPicker-BRvfostO.js";import"./use-reduced-motion-RRBkmVkk.js";import"./activity-CA8qS6PI.js";import"./message-circle-CG-96zts.js";import"./lane-edit-display-C_Aujldz.js";const Fr=/\.(?:apng|avif|gif|jpe?g|png|svg|webp)(?:$|[?#])/iu,Or=/\bhttps?:\/\/[^\s<>"')\]]+/giu;function ze(s){if(typeof s!="string")return null;try{const i=new URL(s.trim());return i.protocol==="http:"||i.protocol==="https:"?i.toString():null}catch{return null}}function V(s,i){const d=s?.[i];return typeof d=="string"&&d.trim()?d.trim():null}function qr(s){return s.mediaType.toLowerCase().startsWith("image/")}function Dr(s){return Fr.test(s)}function Wr(s){try{const i=new URL(s),d=[i.pathname==="/"?"":i.pathname,i.search].join("").trim();return{host:i.hostname.replace(/^www\./iu,""),detail:d||i.hostname}}catch{return{host:s,detail:s}}}function Br(s){const i=new Set,d=[];for(const h of s.matchAll(Or)){const u=h[0]?.replace(/[.,;:!?]+$/u,""),k=ze(u);!k||i.has(k)||(i.add(k),d.push(k))}return d}function Tt(s){return ze(s.url)??ze(V(s.metadata,"url"))??ze(V(s.metadata,"href"))}function Ur(s){const i=s.metadata??null,d=V(i,"kind")??V(i,"type"),h=Tt(s);if(!h||d!=="link_preview"&&d!=="link-preview"&&s.mediaType!=="text/x-uri")return null;const u=Wr(h);return{id:s.id,url:h,title:V(i,"title")??u.host,description:V(i,"description"),imageUrl:ze(V(i,"imageUrl")??V(i,"image")),siteName:V(i,"siteName")??u.host}}function Hr({src:s,alt:i}){return a.jsx("a",{className:"s-message-embed s-message-embed--image",href:s,target:"_blank",rel:"noreferrer",children:a.jsx("img",{src:s,alt:i,loading:"lazy",decoding:"async"})})}function _r({preview:s}){return a.jsxs("a",{className:"s-message-embed s-message-embed--link",href:s.url,target:"_blank",rel:"noreferrer",children:[s.imageUrl&&a.jsx("span",{className:"s-message-embed-thumb",children:a.jsx("img",{src:s.imageUrl,alt:"",loading:"lazy",decoding:"async"})}),a.jsxs("span",{className:"s-message-embed-copy",children:[s.siteName&&a.jsx("span",{className:"s-message-embed-site",children:s.siteName}),a.jsx("span",{className:"s-message-embed-title",children:s.title}),s.description&&a.jsx("span",{className:"s-message-embed-description",children:s.description})]})]})}function Kr({message:s}){const i=s.attachments??[],d=new Set,h=[],u=[];for(const m of i){const A=Tt(m);if(A&&qr(m)){d.add(m.id),h.push({id:m.id,src:A,alt:m.fileName??"Image attachment"});continue}const b=Ur(m);b&&(d.add(m.id),u.push(b))}const k=new Set(u.map(m=>m.url)),W=new Set(i.map(Tt).filter(m=>!!m));for(const m of Br(s.body))W.has(m)||k.has(m)||Dr(m)&&h.push({id:m,src:m,alt:"Embedded image"});const p=i.filter(m=>!d.has(m.id));return h.length===0&&u.length===0&&p.length===0?null:a.jsxs("div",{className:"s-message-embeds",children:[h.map(m=>a.jsx(Hr,{src:m.src,alt:m.alt},m.id)),u.slice(0,1).map(m=>a.jsx(_r,{preview:m},m.id)),p.map(m=>{const A=Tt(m),b=m.fileName??V(m.metadata,"title")??m.mediaType;return A?a.jsxs("a",{className:"s-message-embed s-message-embed--file",href:A,target:"_blank",rel:"noreferrer",children:[a.jsx("span",{className:"s-message-embed-title",children:b}),a.jsx("span",{className:"s-message-embed-description",children:m.mediaType})]},m.id):a.jsxs("div",{className:"s-message-embed s-message-embed--file",children:[a.jsx("span",{className:"s-message-embed-title",children:b}),a.jsx("span",{className:"s-message-embed-description",children:m.mediaType})]},m.id)})]})}const as=60;function St(s,i,d){const h=d?.trim();if(!h)return;const u=h.toLowerCase();i.has(u)||(i.add(u),s.push(h))}function Qr(s){const i=[],d=new Set;St(i,d,s.observeSessionId);for(const h of s.flight?.sessions??[])St(i,d,h.sessionId);return St(i,d,s.agent?.harnessSessionId),St(i,d,s.sessionMeta?.harnessSessionId),i}function Gs(s,i){const d=s.sessionId?.trim().toLowerCase();return d?i.some(h=>{const u=h.trim().toLowerCase();return u?d.includes(u)||u.includes(d):!1}):!1}function en(s,i){return s.ts!==i.ts?s.ts-i.ts:s.id.localeCompare(i.id)}function zs(s,i){const d=new Map;for(const h of[...s,...i])d.set(h.id,h);return[...d.values()].sort(en).slice(-as)}function Vr(s){const i=Mr(s).sort(en),d=jr(i.map(u=>({event:u,meta:Ir(u)}))),h=[];for(const u of d){if(u.event.kind==="other")continue;if(u.event.kind==="tool-result"){const m=h.at(-1);m?.kind==="tool"&&(m.outcome=u.meta.result?.outcome??m.outcome??"done",m.ts=u.event.ts);continue}const k=Gr(u.event),W=zr(u.event,Ar(u.event,u.meta),k);if(!W&&k!=="think")continue;const p={id:u.event.id,ts:u.event.ts,kind:k,text:W,repeatCount:u.repeatCount};u.meta.tool&&(p.tool=u.meta.tool),u.meta.arg&&(p.arg=bt(u.meta.arg)),u.meta.result?.outcome&&(p.outcome=u.meta.result.outcome),h.push(p)}return h}const Js=160;function bt(s){const i=s.replace(/\s+/gu," ").trim();return i.length>Js?`${i.slice(0,Js-1)}…`:i}const tn=/^\[thinking\]\s*$/iu;function Gr(s){return tn.test(s.summary.trim())?"think":Rr(s)}function zr(s,i,d){return d==="think"&&tn.test(s.summary.trim())?"":bt(i)}const Jr=15e3;function Xr(s){const i=s?.outcome;return typeof i=="string"&&i.trim()?i.trim():void 0}function Yr(s){const{observe:i,flight:d}=s;if(!i||!d)return[];const h=i.data.events.filter(p=>p.kind!=="boot"&&p.kind!=="system");if(h.length===0)return[];const u=ns(d.startedAt),k=u!==null?h.filter(p=>typeof p.at=="number"&&p.at>=u-Jr):[];return(k.length>0?k:i.data.live?h:[]).slice(-as).map(p=>{const m={id:`observe:${i.sessionId??"session"}:${p.id}`,ts:p.at??p.t,kind:p.kind,text:bt(p.text||p.tool||"step"),repeatCount:1};p.tool&&(m.tool=p.tool),p.arg&&(m.arg=bt(p.arg));const A=Xr(p.result);return A&&(m.outcome=A),p.diff&&(m.outcome=`+${p.diff.add} −${p.diff.del}`),m})}function Zr(s){const i=s.at(-1);return i?i.tool?i.arg?`${i.tool} · ${i.arg}`:i.tool:i.kind==="think"?i.text||"Thinking":i.text||null:null}function eo(s){if(s.length===0)return null;const i=s.filter(u=>u.kind==="tool").length,d=s.filter(u=>u.kind==="think").length,h=[];return i>0&&h.push(`${i} tool${i===1?"":"s"}`),d>0&&h.push(`${d} thinking`),h.length===0?`${s.length} step${s.length===1?"":"s"}`:h.join(" · ")}function to(s){const i=s.flight?.state;return i==="queued"?{label:"Queued",detail:"waiting for the session to come online"}:i==="waking"?{label:"Waking",detail:"starting the session"}:i==="running"||i==="waiting"?s.hasSessionScope?{label:"Session live",detail:"waiting for the first trace line"}:{label:"Session live",detail:"no trace stream for this session yet"}:s.awaitingResponse?{label:"Sent",detail:"waiting for the agent to pick this up"}:null}function so(s){const{sessionIds:i,active:d}=s,h=i.join("|"),u=d&&i.length>0,[k,W]=r.useState([]);return r.useEffect(()=>{W([])},[h]),r.useEffect(()=>{if(!u)return;let p=!1;const m=new URLSearchParams({limit:String(as*3),transcripts:"true"});return U(`/api/tail/recent?${m.toString()}`).then(A=>{if(p)return;const b=(A.events??[]).filter(f=>Gs(f,i));b.length!==0&&W(f=>zs(f,b))}).catch(()=>{}),()=>{p=!0}},[u,h]),Er(p=>{u&&Gs(p,i)&&W(m=>zs(m,[p]))},u),r.useMemo(()=>u?Vr(k):[],[u,k])}const no=3500;function Xs(s){const i=s?.trim().replace(/^#/,"");if(!i?.startsWith("msg-"))return null;const d=i.slice(4).trim();if(!d)return null;try{return decodeURIComponent(d)}catch{return d}}const ao=64;function ro(s){const i=s?.clientMessageId;return typeof i=="string"&&i.trim()?i.trim():null}function Ys(s){const i=s.body.replace(/\s+/gu," ").trim();if(i)return i.length>180?`${i.slice(0,179).trimEnd()}…`:i;const d=s.attachments?.length??0;return d===1?"Attachment":d>1?`${d} attachments`:"Message"}function Zs(s,i){const d=s.toLocaleLowerCase().indexOf(i.toLocaleLowerCase());if(d<0)return s;const h=s.slice(0,d),u=s.slice(d+i.length);return!h&&u.startsWith(" ")?u.slice(1):h.endsWith(" ")&&u.startsWith(" ")?`${h}${u.slice(1)}`:`${h}${u}`}function oo(s){return s instanceof TypeError||typeof DOMException<"u"&&s instanceof DOMException&&s.name==="AbortError"}function bi({conversationId:s,initialDraft:i,navigate:d,embedded:h,showBackNav:u=!0,treatment:k="standard"}){const{agents:W,route:p,openContextCapture:m}=Ta(),A=mr(p),b=r.useMemo(()=>ba(W,A),[W,A]),[f,vt]=r.useState(null),rs=r.useRef(null);rs.current=f;const Je=r.useMemo(()=>gt(s),[s]),[sn,nn]=r.useState(()=>Je?{[s]:Je}:{}),C=sn[s]??Je??[],[an,os]=r.useState(()=>Je!==null),Ne=r.useRef(null),rn=r.useMemo(()=>{const t=Ne.current;return t===null?null:new Set(C.filter(e=>!t.has(e.id)).map(e=>e.id))},[C]),is=Ne.current===null&&C.length>0;r.useEffect(()=>{if(C.length===0)return;const t=Ne.current??new Set;for(const e of C)t.add(e.id);Ne.current=t},[C]),r.useEffect(()=>{Ne.current=null,os(gt(s)!==null)},[s]);const ls=!an&&C.length===0,G=r.useCallback(t=>{nn(e=>{const n=e[s]??gt(s)??[],o=typeof t=="function"?t(n):t,l=da(s,o);return{...e,[s]:l}})},[s]),on=Xt(s),[y,we]=r.useState(on),[Me,je]=r.useState([]),[Xe,xt]=r.useState(null),[cs,ln]=r.useState(null),[Ye,Ie]=r.useState(null),[cn,dn]=r.useState(new Set),[ds,us]=r.useState(null),[Ze,un]=r.useState(()=>typeof window>"u"?null:Xs(window.location.hash)),[ms,Se]=r.useState(null),[Te,kt]=r.useState(!1),[mn,Ae]=r.useState(!1),[Ct,et]=r.useState(0),tt=r.useRef(null),Re=r.useRef(null),hs=r.useRef(null),Ee=r.useRef(!0),st=r.useRef(!1),be=r.useRef(null),$=r.useRef(null),Le=r.useRef(new Set),$e=r.useRef(null),ps=r.useRef(0),fs=r.useRef(null),Pe=r.useRef(null),ie=r.useRef(s);ie.current=s;const le=r.useRef(new Map),hn=Ds(s),nt=r.useRef(!1);r.useLayoutEffect(()=>{const t=Re.current,e=tt.current;!t||!e||(e.scrollTop=t.scrollTop+(e.scrollHeight-t.scrollHeight),Re.current=null,nt.current=!0)}),r.useEffect(()=>{kt(!1),Re.current=null,nt.current=!1,Ee.current=!0,st.current=!1,Ae(!1),et(0),Ht(new Set),le.current.clear(),we(Xt(s))},[s]);const v=f?.agentId??null,N=f?.kind==="direct",Nt=r.useMemo(()=>new Set([s,...f?.equivalentConversationIds??[]]),[s,f?.equivalentConversationIds]),z=r.useMemo(()=>v?b.find(t=>t.id===v)??null:null,[b,v]),[gs,ys]=r.useState(null);r.useEffect(()=>{U("/api/fleet").then(t=>{ys(e=>Y(e,Bs(t.activeAsks,s,v)))}).catch(()=>{})},[s,v]);const H=r.useCallback(async(t={})=>{const e=t.messageMode??"none",n=t.includeMetadata??!0;Se(null);try{const o=n?await U(`/api/session/${encodeURIComponent(s)}`).catch(()=>null):rs.current;if(ie.current!==s)return;vt(I=>Y(I,o));const l=o?.agentId??null,c=o?.id&&o.id!==s?o.id:s;if(c!==s){d({view:"conversation",conversationId:c});return}const g=gt(c),E=ua(c),T=e==="initial"&&!E,w=e==="refresh"||e==="initial",[S,_,P,Q]=await Promise.all([T?ma(c):w?ha(c,{refresh:!0}):Promise.resolve(g),U(`/api/flights?conversationId=${encodeURIComponent(c)}`),o?.kind==="direct"?U(`/api/flights?conversationId=${encodeURIComponent(c)}&active=false`).catch(()=>[]):Promise.resolve([]),U("/api/fleet?limit=24&activityLimit=160").catch(()=>va())]);if(ie.current!==s)return;const q=Ce(S??[]),D=q.filter(I=>!es(I));S&&G(I=>Y(I,xa(I,D))),os(!0),pr(c);const j=q.at(-1);j&&Pe.current!==j.id&&(Pe.current=j.id,U(`/api/conversations/${encodeURIComponent(c)}/read-cursor`,{method:"POST",body:JSON.stringify({lastReadMessageId:j.id})}).catch(()=>{Pe.current===j.id&&(Pe.current=null)}));const re=ka(P,D);us(I=>Y(I,re));const oe=Ca(_),ye=Xt(c),X=oe??ye;Le.current=new Set([..._.map(I=>I.invocationId),...ye?.invocationId?.startsWith("pending:")?[]:ye?.invocationId?[ye.invocationId]:[]]),oe&&ye?.id===oe.id&&Ws(c,oe.id);const L=X?.agentId??l??null,pt=Na(Q.activity,X,c,L),ft=Ma(Q.activeAsks,X,c,L);we(I=>Y(I,X)),je(I=>Y(I,pt)),Ie(I=>Y(I,ft)),ys(I=>Y(I,Bs(Q.activeAsks,c,l)))}catch(o){if(ie.current!==s)return;Se(o instanceof Error?o.message:String(o))}},[s,d,G]);r.useEffect(()=>{H({messageMode:"initial"})},[H]),r.useEffect(()=>{Pe.current=null},[s]),r.useEffect(()=>{$e.current=y},[y]);const pn=r.useCallback(()=>{y?.id&&dn(t=>{const e=new Set(t);return e.add(y.id),e})},[y?.id]),fn=r.useCallback(async()=>{if(Te||!Ds(s))return;const t=tt.current,e=t?{scrollHeight:t.scrollHeight,scrollTop:t.scrollTop}:null;kt(!0),Se(null);try{const n=await pa(s);if(ie.current!==s)return;e&&(Re.current=e),G(Ce(n).filter(o=>!es(o)))}catch(n){ie.current===s&&Se(n instanceof Error?n.message:String(n))}finally{ie.current===s&&kt(!1)}},[s,Te,G]),[R,B]=r.useState(()=>i??""),[ce,de]=r.useState(null),[Z,at]=r.useState(!1),[gn,ve]=r.useState(null),[M,yn]=r.useState("operator"),[ue,Fe]=r.useState({open:!1,query:"",triggerStart:-1,index:0}),[me,Oe]=r.useState({open:!1,query:"",triggerStart:-1,index:0}),[F,ee]=r.useState(null),[Mt,rt]=r.useState(!1),[jt,ot]=r.useState(""),[wn,qe]=r.useState(null),[Sn,It]=r.useState(!1);r.useEffect(()=>{rt(!1),ot(""),qe(null),It(!1),ve(null)},[s]),r.useEffect(()=>{if(!i)return;const t=`${s}:${i}`;fs.current!==t&&(fs.current=t,B(i),requestAnimationFrame(()=>$.current?.focus()))},[s,i]);const te=r.useMemo(()=>{const t=new Map;for(const e of f?.participants??[])t.set(e.actorId,e),e.agentId&&t.set(e.agentId,e);return t},[f]),At=r.useMemo(()=>{const t=new Set,e=[];for(const n of f?.participantIds??[]){if(n==="operator")continue;const o=te.get(n),l=o?.scopedAlias?.trim().replace(/^@+/,"");if(!l)continue;const c=l.toLowerCase();t.has(c)||(t.add(c),e.push({id:n,label:o?.label??o?.displayName??l,name:o?.displayName??l,handle:l}))}for(const n of b){const o=n.handle?.trim().replace(/^@+/,"")??Us(n.id)??n.id;if(!o)continue;const l=o.toLowerCase();t.has(l)||(t.add(l),e.push({id:n.id,label:o,name:n.name??o,handle:o}))}return e.sort((n,o)=>n.handle.localeCompare(o.handle))},[te,b,f]),Tn=r.useMemo(()=>{if(!ue.open)return[];const t=ue.query.toLowerCase();return t?Hs.filter(e=>e.command.toLowerCase().startsWith("/"+t)||e.command.toLowerCase().includes(t)):Hs},[ue.open,ue.query]),bn=r.useMemo(()=>{if(!me.open)return[];const t=me.query.toLowerCase();return t?At.filter(e=>e.handle.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)).slice(0,8):At.slice(0,8)},[me.open,me.query,At]),vn=r.useCallback(()=>{Fe(t=>t.open?{...t,open:!1}:t),Oe(t=>t.open?{...t,open:!1}:t)},[]),xn=r.useCallback((t,e)=>{const n=ja(t,e);Fe(n?l=>({open:!0,query:n.query,triggerStart:n.start,index:l.open&&l.triggerStart===n.start?l.index:0}):l=>l.open?{...l,open:!1}:l);const o=Ia(t,e);Oe(o?l=>({open:!0,query:o.query,triggerStart:o.start,index:l.open&&l.triggerStart===o.start?l.index:0}):l=>l.open?{...l,open:!1}:l)},[]),kn=r.useCallback(t=>{const e=$.current,n=ue.triggerStart;if(n<0)return;const o=e?.selectionStart??R.length,l=R.slice(0,n),c=R.slice(o),g=t.insert,E=`${l}${g}${c}`;B(E),Fe(T=>({...T,open:!1})),requestAnimationFrame(()=>{const T=$.current;if(!T)return;const w=l.length+g.length;T.focus(),T.setSelectionRange(w,w)})},[R,ue.triggerStart]),Cn=r.useCallback(t=>{const e=$.current,n=me.triggerStart;if(n<0)return;const o=e?.selectionStart??R.length,l=R.slice(0,n),c=R.slice(o),g=c.length===0||!c.startsWith(" "),E=`@${t.handle}${g?" ":""}`,T=`${l}${E}${c}`;B(T),Oe(w=>({...w,open:!1})),requestAnimationFrame(()=>{const w=$.current;if(!w)return;const S=l.length+E.length;w.focus(),w.setSelectionRange(S,S)})},[R,me.triggerStart]);r.useEffect(()=>{const t=$.current;if(!t)return;t.style.height="0px";const e=Math.min(Math.max(t.scrollHeight,40),160);t.style.height=`${e}px`,t.style.overflowY=t.scrollHeight>e?"auto":"hidden"},[R]),r.useEffect(()=>{U("/api/user").then(t=>yn(t.name)).catch(()=>{})},[]);const it=r.useMemo(()=>Aa(C,M),[C,M]);r.useEffect(()=>{F===null||it===null||it>=F&&ee(null)},[F,it]);const Nn=r.useMemo(()=>Ra(y),[y]),J=Date.now(),Mn=!(cs!==null&&J-cs<=ar)&&Ea(y,J),jn=La(y,it,J),In=y?cn.has(y.id):!1,De=Nn&&!jn&&!In,Rt=De&&Mn,ws=De&&$a(y),lt=Rt&&!dr(z?.state??null),Ss=N&&(Z||F!==null||De),Ts=N&&Pa({sending:Z,awaitingResponse:F!==null,currentFlight:y}),O=Fa({name:z?.name,agentName:f?.agentName,id:v,title:f?.title}),x=r.useMemo(()=>N?Oa({agentName:O,agentState:z?.state??null,sending:Z,currentFlight:y,showWorkingTurn:De,awaitingResponse:F!==null,workingTurnIsGone:lt,workingTurnHasNoRecentUpdate:Rt,nowMs:J}):{label:"Open",detail:"",tone:"idle",showStrip:!1,showTyping:!1},[z?.state,O,F,y,J,N,Z,De,lt,Rt]),We=x.tone==="quiet",K=We||ws,Et=y?.startedAt??Ye?.startedAt??F,Lt=ns(Et),bs=rr(Et,J),[,An]=r.useState(0);r.useEffect(()=>{if(!x.showTyping||K||Lt===null)return;const t=Math.max(0,Date.now()-Lt),e=[Qs.sustained,Qs.long].find(o=>o>t);if(e===void 0)return;const n=window.setTimeout(()=>An(o=>o+1),e-t+50);return()=>window.clearTimeout(n)},[K,Lt,x.showTyping,bs]);const Rn=ws?"Not delivered":We?x.label:"Live",$t=r.useMemo(()=>qa({currentFlight:y,presence:x,turnActivity:Me,turnAsk:Ye,awaitingResponseSince:F,nowMs:J}),[F,y,J,x,Me,Ye]),se=r.useMemo(()=>Da(ds),[ds]),En=["s-thread-msg-card","s-thread-msg-working-card","s-thread-msg-card--avatar-row",K?"s-thread-msg-working-card--quiet":null].filter(Boolean).join(" "),Ln=["s-thread-msg-kind",K?"s-thread-msg-kind--quiet":null,lt?"s-thread-msg-kind--gone":null].filter(Boolean).join(" "),$n=["s-thread-no-recent-update-indicator",lt?"s-thread-no-recent-update-indicator--gone":null].filter(Boolean).join(" "),Pn=["s-thread-turn-snapshot",K?"s-thread-turn-snapshot--quiet":null].filter(Boolean).join(" "),Fn=["s-thread-turn-snapshot-pulse",K?"s-thread-turn-snapshot-pulse--quiet":null].filter(Boolean).join(" "),On=["s-thread-presence-line",K?"s-thread-presence-line--quiet":null].filter(Boolean).join(" "),qn=["s-thread-presence-strip",K?null:`s-thread-presence-strip--${bs}`,K?"s-thread-presence-strip--quiet":null].filter(Boolean).join(" "),Pt=f?Wa(f):O,vs=f?.id??s,Dn=f?.alias?.trim()||null,ct=Ba(f?.workspaceRoot),Wn=We?"quiet":x.tone,Ft=C.length===0&&N&&(x.showTyping||y!==null||Me.length>0||Ye!==null||F!==null),xs=r.useMemo(()=>f?f.participantIds.includes("operator"):N,[N,f]),Be=y?.agentId??v,Ue=Be?_s(b,[Be]):null,He=Ue?.id??Be,_e=y?.sessions.at(-1)?.sessionId??Ue?.harnessSessionId??void 0,ks=y?.id?()=>{Ve(d,{view:"sessions",flightId:y.id,...He?{agentId:He}:{},..._e?{sessionId:_e}:{},...A?{machineId:A}:{}},{returnTo:p})}:void 0,Cs=y?.id??null;r.useEffect(()=>{if(!Cs||!He){xt(null);return}let t=!1;const e=_e?`?sessionId=${encodeURIComponent(_e)}`:"",n=async()=>{try{const l=await U(`/api/agents/${encodeURIComponent(He)}/observe${e}`);if(t)return;xt(c=>Y(c,l))}catch{}};n();const o=window.setInterval(()=>{n()},no);return()=>{t=!0,window.clearInterval(o),xt(null)}},[Cs,He,_e]);const Ot=r.useMemo(()=>Qr({flight:y,agent:Ue??z,sessionMeta:f,observeSessionId:Xe?.sessionId}),[z,y,f,Xe?.sessionId,Ue]),Ns=so({sessionIds:Ot,active:x.showTyping||Ft}),Bn=r.useMemo(()=>Yr({observe:Xe,flight:y}),[y,Xe]),ne=Ns.length>0?Ns:Bn,qt=r.useMemo(()=>ne.length>0?null:to({flight:y,hasSessionScope:Ot.length>0,awaitingResponse:F!==null}),[F,y,Ot.length,ne.length]),Dt=eo(ne),Wt=Zr(ne),Bt=ne.at(-1)??null,Ut=Bt?wt(Bt.ts,J):null,Ms=Bt?.ts??null;r.useEffect(()=>{ln(Ms)},[Ms]);const he=r.useMemo(()=>Wt?{...$t,latest:Wt,...Dt?{activityLabel:Dt}:{},...Ut?{lastActivityLabel:Ut}:{}}:$t,[Ut,Wt,$t,Dt]),Un=We?x.detail:`${O}: ${he.latest}`,js=Be&&Ua(Ue)?()=>{Ve(d,{view:"terminal",agentId:Be,mode:"takeover"},{returnTo:p})}:void 0,Is=N?()=>{h&&hr({type:"focus-composer",reason:"Steer the active conversation"})||requestAnimationFrame(()=>{$.current?.focus({preventScroll:!0}),$.current?.scrollIntoView({block:"nearest"})})}:void 0,As=r.useMemo(()=>(f?f.participantIds.filter(e=>e!=="operator"):v?[v]:[]).map(e=>{const n=_s(b,[e]),o=te.get(e);return{id:e,name:o?.scopedAlias??n?.name??o?.displayName??Us(e)??e,title:o?.label??n?.id??e,agent:n,harness:n?.harness??o?.harness??null,model:n?.model??null,reasoningEffort:n?.reasoningEffort??null}}),[v,te,b,f]),Rs=As.slice(0,4),Hn=Math.max(As.length-Rs.length,0),_n=r.useMemo(()=>({name:M,active:xs}),[xs,M]),dt=r.useMemo(()=>new Map(C.map(t=>[t.id,t])),[C]),ut=r.useMemo(()=>Ha(C),[C]),[Kn,Ht]=r.useState(()=>new Set),Qn=r.useCallback(t=>{Ht(e=>{const n=new Set(e);return n.delete(t)||n.add(t),n})},[]),Es=r.useMemo(()=>{const t=new Map;for(const e of ut)if(e.kind==="fanout")for(const n of e.messages)t.set(n.id,e.key);return t},[ut]),mt=r.useCallback(t=>{const e=Es.get(t);e&&Ht(c=>c.has(e)?c:new Set(c).add(e));const n=document.getElementById(`msg-${t}`);if(!n)return;const o=n.closest(".s-thread-fanout")??n,l=o===n?"s-thread-msg--flash":"s-thread-fanout--flash";o.scrollIntoView({behavior:"smooth",block:"center"}),o.classList.add(l),window.setTimeout(()=>o.classList.remove(l),1200)},[Es]);r.useEffect(()=>{const t=()=>un(Xs(window.location.hash));return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)},[]),r.useEffect(()=>{if(!Ze||!dt.has(Ze))return;const t=window.setTimeout(()=>mt(Ze),50);return()=>window.clearTimeout(t)},[Ze,dt,mt]),cr(r.useCallback(t=>{if(t.kind==="message.posted"){const e=t.payload?.message;if(!e||!Nt.has(e.conversationId))return;const n=e.actorId==="operator",o=N&&!n&&e.class==="agent",l={id:e.id,conversationId:e.conversationId,actorId:e.actorId,actorName:o?O:_a(e.actorId,b,M),body:e.body,createdAt:e.createdAt,class:n?"operator":e.class,attachments:e.attachments,metadata:e.metadata,replyToMessageId:e.replyToMessageId??e.n??null};if(es(l))return;if(G(c=>{const g=ro(e.metadata),E=g?le.current.get(g):void 0;if(c.some(T=>T.id===e.id))return g&&le.current.delete(g),c;if(n&&g){const T=Ka(c,g,E);if(T!==-1){const w=[...c];return w[T]=l,le.current.delete(g),Ce(w)}}return Ce([...c,l])}),o){const c=ns(e.createdAt)??Date.now();ee(g=>g===null||c<g||Qa($e.current)?g:null),we(g=>Va(g)?null:g)}return}if(t.kind==="invocation.requested"){const e=t.payload?.invocation;if(!e||e.targetAgentId!==v||!e.conversationId||!Nt.has(e.conversationId))return;Le.current.add(e.id),je([]),Ie(null),ee(n=>n??Date.now());return}if(t.kind==="flight.updated"){const e=t.payload?.flight;if(!e||e.targetAgentId!==v||!(Le.current.has(e.invocationId)||$e.current?.id===e.id))return;if(Ga.has(e.state)){Ws(s,e.id),us(Yt(e,s,v??"")),we(c=>c?.id===e.id?null:c),je([]),Ie(null),ee(null),H({messageMode:"refresh",includeMetadata:!1});return}Le.current.add(e.invocationId);const o=$e.current?.id===e.id,l=Yt(e,s,v??"",$e.current);za(l)&&ee(null),we(l),o||(je([]),Ie(null));return}t.kind!=="agent.endpoint.upserted"&&t.kind==="unknown"&&H({messageMode:"refresh"})},[v,O,s,Nt,N,H,M,b])),r.useEffect(()=>{if(!Ss)return;const t=setInterval(()=>{H({messageMode:"refresh",includeMetadata:!1})},5e3);return()=>clearInterval(t)},[Ss,H]),r.useEffect(()=>{const t=()=>{if(document.visibilityState!=="visible")return;const e=Date.now();e-ps.current<1e3||(ps.current=e,H({messageMode:"refresh"}))};return window.addEventListener("focus",t),document.addEventListener("visibilitychange",t),()=>{window.removeEventListener("focus",t),document.removeEventListener("visibilitychange",t)}},[H]);const _t=r.useRef(null),Ls=r.useRef(!1),Kt=r.useRef(!1),Qt=r.useCallback(t=>{const e=hs.current;e&&(st.current=!0,be.current!==null&&clearTimeout(be.current),e.scrollIntoView({behavior:t}),be.current=setTimeout(()=>{st.current=!1,be.current=null},t==="smooth"?700:0))},[]);r.useEffect(()=>()=>{be.current!==null&&clearTimeout(be.current)},[]);const Vn=r.useCallback(()=>{const t=tt.current;if(!t||st.current)return;const n=t.scrollHeight-t.clientHeight-t.scrollTop<=ao;Ee.current=n,n?(Ae(!1),et(0)):Ae(!0)},[]),Gn=r.useCallback(()=>{Ee.current=!0,Ae(!1),et(0),Qt("smooth")},[Qt]);r.useEffect(()=>{const t=C.at(-1)?.id??null,e=!!(t&&t!==_t.current),n=Ja({newestMessageId:t,previousNewestMessageId:_t.current,showTyping:x.showTyping,previousShowTyping:Ls.current,historyRestorePending:nt.current||Re.current!==null,initialScrollDone:Kt.current,nearBottom:Ee.current});n!=="none"?(Qt(n),Kt.current=!0):e&&Kt.current&&!Ee.current&&(Ae(!0),et(o=>o+1)),nt.current=!1,_t.current=t,Ls.current=x.showTyping});const[,zn]=r.useState(0);r.useEffect(()=>{const t=setInterval(()=>zn(e=>e+1),15e3);return()=>clearInterval(t)},[]);const pe=wa(),[fe,ae]=r.useState([]),[$s,ht]=r.useState("queue"),[xe,ke]=r.useState(null),Ke=async(t,e)=>{const n=t.trim(),o=e?.attachments??[],l=e?.replyTarget??null;if(!n&&o.length===0||Z)return"failed";const g=e?.forceAction??Vs({isDm:N,hasOutstandingReply:Ts}),E=Date.now(),T=ga(),w={id:`optimistic-${T}`,conversationId:s,actorId:"operator",actorName:M,body:n,createdAt:E,class:"operator",...l?{replyToMessageId:l.messageId}:{},metadata:{clientMessageId:T,deliveryState:"sending"},...o.length>0?{attachments:o}:{}};at(!0),ve(null),g!=="message"&&ee(E),Se(null),le.current.set(T,w.id),G(S=>Ce([...S,w]));try{const S=await U(`/api/chats/${encodeURIComponent(s)}/messages`,{method:"POST",body:JSON.stringify({body:n,clientMessageId:T,...l?{replyToMessageId:l.messageId}:{},...o.length>0?{attachments:o}:{}})}),_=S.chatId?.trim()??S.conversationId?.trim();if(_&&_!==s)throw new Error(`Send returned a different Chat (${_}) instead of appending to ${s}.`);if(S.messageId?.trim()){const q=S.messageId.trim();G(D=>Ce(D.map(j=>j.id===w.id?{...j,id:q,metadata:{clientMessageId:T}}:j))),le.current.delete(T)}S.flight?(Le.current.add(S.flight.invocationId),we(Yt(S.flight,s,v??"")),je([]),Ie(null)):g!=="message"&&ee(null);const P=S.unresolvedTargets??[],Q=S.invokedTargets?.length?S.invokedTargets:S.notifiedTargets??[];if(P.length>0)ve({tone:"warning",text:`Posted, but not delivered to ${P.join(", ")}`});else if(Q.length>0){const q=Q.map(D=>{const j=te.get(D);return`@${j?.scopedAlias?.trim()||j?.displayName?.trim()||D}`});ve({tone:"success",text:`Sent to ${q.join(", ")}`})}else ve({tone:"success",text:"Posted to this room"});return"sent"}catch(S){return oo(S)?(G(_=>_.map(P=>P.id===w.id?{...P,metadata:{...P.metadata??{},deliveryState:"unknown"}}:P)),ve({tone:"warning",text:"Delivery unknown — waiting for broker reconciliation"}),"unknown"):(G(_=>_.filter(P=>P.id!==w.id)),le.current.delete(T),ee(null),Se(S instanceof Error?S.message:String(S)),"failed")}finally{at(!1)}},Jn=async()=>{const t=R.trim(),e=ce,n=pe.files,o=xe?.attachments??[];if(!t&&n.length===0&&o.length===0)return null;let l=[];if(n.length>0){at(!0);try{l=await ya(n)}catch(c){return pe.setError(c instanceof Error?c.message:String(c)),null}finally{at(!1)}}return B(""),de(null),pe.clear(),ke(null),{body:t,attachments:[...o,...l],replyTarget:e}},Xn=async()=>{const t=ir({isAgentBusy:ge,intent:$s}),e=xe?.id??null,n=await Jn();if(!n)return;if(t==="queue"){ae(c=>e?c.map(g=>g.id===e?{...g,body:n.body,attachments:n.attachments,replyTarget:n.replyTarget}:g):[...c,{id:`queued-${Date.now()}-${c.length}`,body:n.body,attachments:n.attachments,replyTarget:n.replyTarget,queuedAt:Date.now()}]);return}e&&ae(c=>c.filter(g=>g.id!==e));const o=()=>{B(n.body),ke(n.attachments.length>0?{id:null,attachments:n.attachments}:null),de(n.replyTarget),requestAnimationFrame(()=>$.current?.focus())};if(t==="steer"){ht("queue"),await zt(),await Ke(n.body,{forceAction:"steer",attachments:n.attachments,replyTarget:n.replyTarget})==="failed"&&o();return}await Ke(n.body,{attachments:n.attachments,replyTarget:n.replyTarget})==="failed"&&o()},Yn=t=>{ae(e=>e.filter(n=>n.id!==t)),ke(e=>e?.id===t?null:e)},Zn=t=>{const e=fe.find(n=>n.id===t);e&&(B(e.body),de(e.replyTarget??null),ke({id:t,attachments:e.attachments}),requestAnimationFrame(()=>{const n=$.current;n&&(n.focus(),n.setSelectionRange(n.value.length,n.value.length))}))},ea=()=>{ke(null),B(""),de(null),pe.clear()},ta=async t=>{const e=fe.find(o=>o.id===t);if(!e)return;ae(o=>o.filter(l=>l.id!==t)),await zt(),await Ke(e.body,{forceAction:"steer",attachments:e.attachments,replyTarget:e.replyTarget??null})==="failed"&&ae(o=>[e,...o])},Vt=r.useCallback((t,e)=>{const n=e?.trim().replace(/^@+/,"")||null,o=n?`@${n}`:null,l=ce?.insertedMention?Zs(R,ce.insertedMention):R,c=!!(!N&&o&&!l.toLocaleLowerCase().includes(o.toLocaleLowerCase())),g=c&&o?l.trim()?`${l.trimEnd()} ${o} `:`${o} `:l;B(g),de({messageId:t.id,actorLabel:n?`@${n}`:t.actorName,preview:Ys(t),insertedMention:c?o:null}),requestAnimationFrame(()=>$.current?.focus())},[R,N,ce?.insertedMention]),sa=r.useCallback(()=>{const t=ce?.insertedMention;de(null),t&&B(e=>Zs(e,t)),requestAnimationFrame(()=>$.current?.focus())},[ce]),Gt=r.useCallback(t=>{const e=new URL(window.location.href);p.view==="agents-v2"&&e.searchParams.set("tab","message"),e.hash=`msg-${t}`,Ge(e.toString())},[p.view]),Ps=r.useCallback((t,e,n)=>{const o=fa({conversationId:s,selectedMessageId:t.id,messages:C.map(l=>({id:l.id,actorLabel:l.id===t.id?e:yt(l,M)?M:l.actorName,body:l.body,attachmentCount:l.attachments?.length??0}))});m({intent:"forward-message",forwardContext:o,forwardContextMode:"selected-message",...n?{projectPath:n}:{}})},[s,C,m,M]),zt=async()=>{if(v)try{await U("/api/agents/"+encodeURIComponent(v)+"/interrupt",{method:"POST",body:JSON.stringify({})})}catch{}},ge=x.tone==="working"||x.tone==="pending",na=Vs({isDm:N,hasOutstandingReply:Ts}),aa=N?`Message ${O} — type / to route or @ to mention an agent`:f?.kind==="channel"?`Comment in #${Xa(f)} — mention @agent to request a reply`:`Comment in ${Pt} — mention @agent to request a reply`,Fs=xe?.attachments??[],ra=!R.trim()&&!pe.hasFiles&&Fs.length===0&&ge,Jt=r.useRef(!1);r.useEffect(()=>{const t=xe?.id??null,e=t?fe.filter(o=>o.id!==t):fe;if(!Ya({isAgentBusy:ge,sending:Z,queued:e})||Jt.current)return;const n=e[0];n&&(Jt.current=!0,ae(o=>o.filter(l=>l.id!==n.id)),Ke(n.body,{attachments:n.attachments,replyTarget:n.replyTarget??null}).then(o=>{o==="failed"&&ae(l=>[n,...l])}).finally(()=>{Jt.current=!1}))},[ge,Z,fe,xe]),r.useEffect(()=>{ge||ht("queue")},[ge]),r.useEffect(()=>{ae([]),ke(null),de(null),ht("queue"),pe.clear()},[s]);const oa=Za(fe),Os=fr(),ia=r.useCallback((t,e)=>{const n=window.getSelection()?.toString().trim(),o=yt(e,M),l=e.actorId?te.get(e.actorId):null,c=o?null:Ks(e,b,v),g=(l?.scopedAlias?.trim()||c?.handle?.trim()||null)?.replace(/^@+/,"")??null,E=g?`@${g}`:e.actorName,T=(c?.id||l?.agentId||e.actorId||"").trim(),w=[];o||w.push({kind:"action",label:"Reply",onSelect:()=>Vt(e,g)}),w.push({kind:"action",label:"Forward to new task…",onSelect:()=>Ps(e,E,l?.workspaceRoot??c?.projectRoot??c?.cwd??void 0)}),w.push({kind:"separator"}),n&&w.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>{Ge(n)}}),w.push({kind:"action",label:"Copy Message",onSelect:()=>{Ge(e.body)}}),w.push({kind:"action",label:"Copy Link",onSelect:()=>Gt(e.id)}),w.push({kind:"separator"}),!o&&T&&w.push({kind:"action",label:"Copy Agent ID",onSelect:()=>{Ge(T)}}),w.push({kind:"action",label:"Copy Message ID",onSelect:()=>{Ge(e.id)}}),Os(t,w)},[v,Vt,Gt,Ps,M,te,b,Os]),la=async(t,e)=>{const n=`@${e.agentId} `,o=R.trim();if(o){B(""),await Ke(`${n}${o}`,{forceAction:"invoke"});return}B(n),$.current?.focus()},Qe=r.useMemo(()=>{if(!f)return[];const t=new Set(f.participantIds);return b.filter(e=>!t.has(e.id)&&!e.retiredFromFleet).sort((e,n)=>e.name.localeCompare(n.name))},[f,b]);r.useEffect(()=>{Mt&&ot(t=>t&&Qe.some(e=>e.id===t)?t:Qe[0]?.id??"")},[Mt,Qe]);const qs=!!(f&&["direct","group_direct","channel"].includes(f.kind)&&Qe.length>0),ca=r.useCallback(async()=>{if(!f)return;const t=jt.trim();if(t){It(!0),qe(null);try{const e=await U(`/api/conversations/${encodeURIComponent(f.id)}/members`,{method:"POST",body:JSON.stringify({actorId:t})});e.session?vt(e.session):vt(n=>n&&{...n,kind:e.kind,participantIds:e.participantIds}),rt(!1),ot(""),await H({messageMode:"none"})}catch(e){qe(e instanceof Error?e.message:String(e))}finally{It(!1)}}},[jt,H,f]);return a.jsx("div",{className:`s-thread-layout${h?" s-thread-layout--embedded":""}`,"data-thread-treatment":k==="standard"?void 0:k,children:a.jsxs("div",{className:"s-thread-center",children:[!h&&a.jsx(yr,{showBackNav:u,isDm:N,navigate:d,route:p,canonicalConversationId:vs,threadTitle:Pt,agentId:v,visibleParticipants:Rs,hiddenParticipantCount:Hn,operator:_n,canAddParticipants:qs,onToggleAddParticipant:()=>{qe(null),rt(t=>!t)}}),!h&&f&&a.jsx(wr,{canonicalConversationId:vs,conversationAlias:Dn}),!h&&Mt&&qs&&a.jsx(Sr,{agents:Qe,addParticipantId:jt,setAddParticipantId:ot,addingParticipant:Sn,addParticipantError:wn,onCancel:()=>{rt(!1),qe(null)},onSubmit:()=>{ca()}}),gs&&a.jsx(Lr,{pinnedAsk:gs,onAnswer:()=>{$.current?.focus()}}),a.jsx($r,{presence:x,agent:z}),ms&&a.jsx("p",{className:"s-thread-error",children:ms}),a.jsxs("div",{className:"s-thread-feed",ref:tt,onScroll:Vn,children:[!ls&&C.length>0&&hn&&a.jsx("div",{className:"s-thread-history-control",children:a.jsxs("button",{type:"button",className:"s-thread-history-button",disabled:Te,"aria-busy":Te,onClick:()=>{fn()},children:[Te&&a.jsx("span",{className:"s-thread-history-spinner","aria-hidden":"true"}),Te?"Loading earlier messages…":"Load earlier messages"]})}),ls?a.jsx(vr,{}):C.length===0?Ft?a.jsx(xr,{agentName:O,title:x.label,detail:x.detail||he.latest,snapshot:he,events:Me,steps:ne,phase:qt,tone:Wn,workspaceName:ct,branch:f?.currentBranch,startedAt:Et,onOpenTrace:ks,onOpenTerminal:js,onSteer:Is}):a.jsxs("div",{className:"s-thread-empty",children:[a.jsx("div",{className:"s-thread-empty-glyph","aria-hidden":"true",children:N?"@":"#"}),a.jsx("p",{children:Pt}),a.jsx("p",{children:N?"No messages yet. Send a message to start working with this agent.":"No messages yet. Start the conversation below."}),(ct||f?.currentBranch)&&a.jsxs("div",{className:"s-thread-empty-chips",children:[ct&&a.jsx("span",{className:"s-thread-empty-chip",children:ct}),f?.currentBranch&&a.jsx("span",{className:"s-thread-empty-chip",children:f.currentBranch})]})]}):ut.map((t,e)=>{const n=er(t,e);if(t.kind==="fanout")return a.jsx(Tr,{row:t,expanded:Kn.has(t.key),showDayDivider:n,onToggle:()=>Qn(t.key)},t.key);const o=t.message,l=yt(o,M),c=tr(o),g=c?"scout.dispatch":o.class,E=or(g),T=g==="status",w=Zt(o.createdAt),S=l?null:Ks(o,b,v),P=te.get(o.actorId)?.scopedAlias?.trim()||null,Q=!l&&P?P:o.actorName,q=l?M.toLowerCase():P??S?.handle??null,D=sr(o.body),j=D?nr({flightId:D.flightId,replyToMessageId:o.replyToMessageId,messagesById:dt,agents:b,operatorName:M}):null,re=!D&&o.replyToMessageId?dt.get(o.replyToMessageId)??null:null,oe=re?yt(re,M)?M:re.actorName:null,ye=D?D.body:o.body,X=l&&typeof o.metadata?.deliveryState=="string"?o.metadata.deliveryState:null;return a.jsxs("div",{className:["s-thread-feed-block",l&&"s-thread-feed-block--you",n&&"s-thread-feed-block--full-width"].filter(Boolean).join(" "),children:[n&&a.jsx(br,{at:o.createdAt}),a.jsx("article",{id:`msg-${o.id}`,className:["s-thread-msg",l&&"s-thread-msg--you",T&&"s-thread-msg--tool",(is||rn?.has(o.id))&&"s-thread-msg--enter"].filter(Boolean).join(" "),style:is?{animationDelay:`${Math.max(0,7-(ut.length-1-e))*26}ms`}:void 0,"data-class":g,onContextMenu:L=>ia(L,o),children:a.jsx("div",{className:"s-thread-msg-card",children:a.jsxs("div",{className:"s-thread-msg-card-content",children:[a.jsxs("div",{className:"s-thread-msg-header",children:[a.jsxs("div",{className:"s-thread-msg-meta",children:[(()=>{const L=!l&&S?()=>Ve(d,{view:"agents-v2",agentId:S.id},{returnTo:p}):null,pt=l?M:Q??"?",ft=a.jsx(ts,{agent:S??void 0,name:pt,placement:"turn",className:"s-thread-msg-avatar",title:pt});return L?a.jsx("button",{type:"button",className:"s-thread-msg-avatar--nav",onClick:L,"aria-label":`View profile for ${o.actorName??"agent"}`,title:`View profile for ${o.actorName??"agent"}`,children:ft}):ft})(),!l&&S?a.jsx("button",{type:"button",className:"s-thread-msg-actor s-thread-msg-actor--nav",onClick:()=>Ve(d,{view:"agents-v2",agentId:S.id},{returnTo:p}),title:`View profile for ${o.actorName}`,children:Q}):a.jsx("span",{className:"s-thread-msg-actor",children:l?M:Q}),q&&a.jsxs("span",{className:"s-thread-msg-handle",children:["@",q]}),E&&a.jsx("span",{className:"s-thread-msg-kind",children:E}),X&&a.jsx("span",{className:"s-thread-msg-delivery","data-state":X,"aria-live":X==="unknown"?"polite":void 0,children:X==="unknown"?"Delivery unknown":"Sending"})]}),a.jsx("span",{className:"s-thread-msg-time",title:w,children:wt(o.createdAt)}),a.jsxs("span",{className:"s-thread-msg-actions",children:[!l&&q&&a.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":`Reply to @${q}`,title:`Reply to @${q}`,onClick:()=>Vt(o,q),children:a.jsx(ss,{})}),a.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":"Copy link to message",title:"Copy link to message",onClick:()=>Gt(o.id),children:a.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:[a.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"}),a.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"})]})})]})]}),j&&a.jsxs("button",{type:"button",className:"s-thread-reply-ctx",title:`Open the originating request${j.flightId?` · ${j.flightId}`:""}`,onClick:()=>mt(j.originatingMessageId),children:[a.jsx(ss,{}),a.jsx("span",{className:"s-thread-reply-ctx-label",children:"reply to"}),a.jsx("span",{className:"s-thread-reply-ctx-title",children:j.title}),a.jsxs("span",{className:"s-thread-reply-ctx-from",children:["· ",j.from]}),a.jsx("span",{className:"s-thread-reply-ctx-status",children:"· done"})]}),re&&oe&&a.jsxs("button",{type:"button",className:"s-thread-reply-ctx",title:`Open message from ${oe}`,onClick:()=>mt(re.id),children:[a.jsx(ss,{}),a.jsx("span",{className:"s-thread-reply-ctx-label",children:"reply to"}),a.jsx("span",{className:"s-thread-reply-ctx-title",children:Ys(re)}),a.jsxs("span",{className:"s-thread-reply-ctx-from",children:["· ",oe]})]}),a.jsx("div",{className:"s-thread-msg-body",title:w,children:a.jsx(ur,{text:ye})}),a.jsx(Kr,{message:o}),c&&c.candidates.length>0&&a.jsx("div",{className:"s-thread-dispatch",children:c.candidates.map(L=>a.jsxs("button",{type:"button",className:"s-thread-dispatch-tile",onClick:()=>{la(c,L)},children:[a.jsxs("span",{className:"s-thread-dispatch-tile-id",children:["@",L.agentId]}),a.jsx("span",{className:"s-thread-dispatch-tile-state",children:L.endpointState}),a.jsx("span",{className:"s-thread-dispatch-tile-meta",children:[L.workspace,L.node,L.projectRoot].filter(Boolean).join(" · ")||L.displayName})]},L.agentId))})]})})})]},o.id)}),x.showTyping&&!Ft&&a.jsx("div",{className:"s-thread-feed-block",children:a.jsx("div",{className:"s-thread-msg","aria-live":"polite",children:a.jsxs("div",{className:En,children:[a.jsx(ts,{agent:z??void 0,name:O,placement:"turn",className:"s-thread-msg-avatar s-thread-msg-avatar--working",title:O}),a.jsxs("div",{className:"s-thread-msg-card-content",children:[a.jsxs("div",{className:"s-thread-msg-header",children:[a.jsxs("div",{className:"s-thread-msg-meta",children:[a.jsx("span",{className:"s-thread-msg-actor",children:O}),a.jsx("span",{className:Ln,children:Rn})]}),a.jsx("span",{className:"s-thread-msg-time",title:y?.startedAt?Zt(y.startedAt):"now",children:y?.startedAt?wt(y.startedAt):"now"}),We&&a.jsx("button",{type:"button",className:"s-thread-msg-dismiss","aria-label":"Dismiss no recent update turn",title:"Dismiss no recent update turn",onClick:pn,children:a.jsx(Pr,{})})]}),a.jsxs("div",{className:"s-thread-msg-working-body",children:[a.jsxs("div",{className:Pn,children:[K?a.jsx("span",{className:$n,"aria-hidden":"true"}):a.jsx("span",{className:Fn,"aria-hidden":"true"}),a.jsxs("div",{className:"s-thread-turn-snapshot-main",children:[a.jsx("span",{className:"s-thread-turn-snapshot-label",children:"Latest"}),a.jsx("span",{className:"s-thread-msg-working-copy",children:he.latest})]})]}),a.jsxs("dl",{className:"s-thread-turn-snapshot-stats",children:[a.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[a.jsx("dt",{children:"Activity"}),a.jsx("dd",{children:he.activityLabel})]}),a.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[a.jsx("dt",{children:"Elapsed"}),a.jsx("dd",{children:he.elapsedLabel})]}),a.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[a.jsx("dt",{children:"Last"}),a.jsx("dd",{children:he.lastActivityLabel})]})]}),ne.length>0||qt?a.jsx(kr,{steps:ne,phase:qt,limit:5,compact:!0}):a.jsx(Cr,{events:Me,limit:4,compact:!0}),a.jsx(Nr,{onOpenTrace:ks,onOpenTerminal:js,onSteer:Is,compact:!0})]})]})]})})}),N&&se&&!x.showTyping&&a.jsx("div",{className:"s-thread-feed-block s-thread-feed-block--terminal",children:a.jsxs("div",{className:"s-thread-terminal-receipt","data-tone":se.tone,"aria-live":"polite",children:[a.jsx("span",{className:"dot","aria-hidden":"true"}),a.jsxs("div",{className:"s-thread-terminal-receipt-copy",children:[a.jsx("span",{className:"s-thread-terminal-receipt-label",children:se.label}),a.jsx("span",{className:"s-thread-terminal-receipt-detail",children:se.detail})]}),a.jsxs("div",{className:"s-thread-terminal-receipt-meta",children:[se.completedAt&&a.jsx("time",{title:Zt(se.completedAt),children:wt(se.completedAt)}),a.jsx("button",{type:"button",onClick:()=>{Ve(d,{view:"sessions",flightId:se.flightId,...A?{machineId:A}:{}},{returnTo:p})},children:"Run details"})]})]})}),mn&&Ct>0&&a.jsxs("button",{type:"button",className:"s-thread-new-messages",onClick:Gn,children:[a.jsx("span",{"aria-hidden":"true",children:"↓"})," ",Ct," new ",Ct===1?"message":"messages"," · jump to latest"]}),a.jsx("div",{ref:hs})]}),x.showTyping&&a.jsxs("div",{className:On,children:[a.jsx("div",{className:"s-thread-presence-line-avatars",children:a.jsx(ts,{agent:z??void 0,name:O,placement:"turn",className:"s-thread-presence-line-avatar",title:O})}),a.jsx("span",{className:"s-thread-presence-line-label",children:Un}),a.jsx("div",{className:qn,"aria-hidden":"true"})]}),a.jsx(Sa,{composeRef:$,draft:R,setDraft:B,composePlaceholder:aa,slashState:ue,setSlashState:Fe,filteredSlashCommands:Tn,applySlashCommand:kn,mentionState:me,setMentionState:Oe,filteredMentions:bn,applyMention:Cn,updateTriggersFromDraft:xn,closeSuggestions:vn,replyTarget:ce,onCancelReply:sa,isStopMode:ra,sending:Z,composeAction:na,onSend:()=>{Xn()},onInterrupt:()=>{zt()},sendReceipt:gn,attachments:pe,isAgentBusy:ge,busyIntent:$s,onBusyIntentChange:ht,queued:fe,queueNote:oa,onEditQueued:Zn,editingQueuedId:xe?.id??null,editingAttachmentCount:Fs.length,onCancelEdit:ea,onUnqueue:Yn,onSendQueuedNow:t=>{ta(t)}})]})})}function ss(){return a.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:[a.jsx("polyline",{points:"9 14 4 9 9 4"}),a.jsx("path",{d:"M20 20v-7a4 4 0 0 0-4-4H4"})]})}const vi=gr({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:lr}});export{bi as ConversationScreen,vi as scoutSurface};