@openscout/scout 0.2.92 → 0.2.95

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 (508) hide show
  1. package/NOTICE +14 -0
  2. package/README.md +164 -348
  3. package/bin/scoutd +0 -0
  4. package/dist/build-manifest.json +3 -3
  5. package/dist/client/apple-touch-icon.png +0 -0
  6. package/dist/client/assets/ActivityScreen--eANwuxa.js +1 -0
  7. package/dist/client/assets/{AddProjectForm-CpyytDf2.js → AddProjectForm-CcD6qvV8.js} +1 -1
  8. package/dist/client/assets/AgentAvatar-CYhf6twS.js +1 -0
  9. package/dist/client/assets/AgentConfigurationScreen-BTI24HQX.js +1 -0
  10. package/dist/client/assets/AgentDefinitionsWorkspace-srmN6-vj.js +1 -0
  11. package/dist/client/assets/{AgentDetailCard-BTiOmh-a.js → AgentDetailCard-UqPNpcvB.js} +1 -1
  12. package/dist/client/assets/AgentFloorView-XXNgI5Cj.js +1 -0
  13. package/dist/client/assets/AgentInfoScreen-CimdOnZ9.js +1 -0
  14. package/dist/client/assets/{AgentLaneCard-lfRNb7JD.js → AgentLaneCard-Z-aOBR3W.js} +1 -1
  15. package/dist/client/assets/{AgentLaneChrome-Dlwrbq3g.js → AgentLaneChrome-CyhA1reW.js} +1 -1
  16. package/dist/client/assets/AgentLaneDetailSheet-BNzjMjIH.js +4 -0
  17. package/dist/client/assets/{AgentLaneSummaryResize-6SOEWUnr.js → AgentLaneSummaryResize-Box8-_rS.js} +1 -1
  18. package/dist/client/assets/AgentLanesEmbedScreen-BmLnN4on.js +1 -0
  19. package/dist/client/assets/{AgentLanesPreflight-C3uOiOzd.js → AgentLanesPreflight-5B6sXvRB.js} +1 -1
  20. package/dist/client/assets/AgentLanesView-DHyzVBk6.js +2 -0
  21. package/dist/client/assets/{AgentLiveActions-BJ5dIfL3.js → AgentLiveActions-BwuzOE8h.js} +1 -1
  22. package/dist/client/assets/AgentSessions-CsZwoukw.js +6 -0
  23. package/dist/client/assets/AgentsConsole-KCao4XmX.js +1 -0
  24. package/dist/client/assets/AgentsScreen-CtPAmwRX.js +1 -0
  25. package/dist/client/assets/AgentsSubnav-CDMjKeYC.js +1 -0
  26. package/dist/client/assets/AstronautSuit-Ckx7lu7G.js +1 -0
  27. package/dist/client/assets/AtopView-DYlpgEHf.js +1 -0
  28. package/dist/client/assets/{BackToPicker-D1LV6Cqp.js → BackToPicker-4JaeRvDm.js} +1 -1
  29. package/dist/client/assets/BriefingDetailScreen-D6-xqrpo.js +1 -0
  30. package/dist/client/assets/BriefingsScreen-DKxSDEmk.js +1 -0
  31. package/dist/client/assets/{BrokerMetadataPanel-BhjECqOK.js → BrokerMetadataPanel-BbREmsbK.js} +1 -1
  32. package/dist/client/assets/BrokerScreen-fbPIouMw.js +5 -0
  33. package/dist/client/assets/CastPicker-BcA2vDDV.js +1 -0
  34. package/dist/client/assets/CastPicker-zXsnkTIy.css +1 -0
  35. package/dist/client/assets/ChatCollapsedStrip-Ycm0ecaX.js +1 -0
  36. package/dist/client/assets/{CodeDiffPane-Bx_2VAzv.js → CodeDiffPane-Cn8Y9hAt.js} +1 -1
  37. package/dist/client/assets/{CodeProjectPicker-C1yOJKvs.js → CodeProjectPicker-nPFktrco.js} +1 -1
  38. package/dist/client/assets/CodeScreen-BlAxtxE5.js +1 -0
  39. package/dist/client/assets/ConversationComposer-2HjbGPL9.js +1 -0
  40. package/dist/client/assets/ConversationFeedRows-C6wUqJrx.js +1 -0
  41. package/dist/client/assets/ConversationHeader-C8vfXaTF.js +1 -0
  42. package/dist/client/assets/ConversationPanels-CNCIbpqU.js +6 -0
  43. package/dist/client/assets/ConversationScreen-BNULZAp2.js +2 -0
  44. package/dist/client/assets/ConversationScreen-CkWnKXt6.css +1 -0
  45. package/dist/client/assets/ConversationStatus-DZuyKsWN.js +1 -0
  46. package/dist/client/assets/CrewAvatar-CTIuxp4G.js +1 -0
  47. package/dist/client/assets/CrewAvatar-D0c9z5Qr.css +1 -0
  48. package/dist/client/assets/CrewWorkspaces-CJhBKVoZ.css +1 -0
  49. package/dist/client/assets/CrewWorkspaces-CkPYIA46.js +1 -0
  50. package/dist/client/assets/{DataTable-CJbbgBdA.js → DataTable-6IDhanr5.js} +1 -1
  51. package/dist/client/assets/DispatchAftermath-DC1u9itO.js +1 -0
  52. package/dist/client/assets/DocumentFocusViewer-DZVhS7as.js +1 -0
  53. package/dist/client/assets/{EmbeddableSurfacesLab-BdsYRDky.js → EmbeddableSurfacesLab-BKUFJMCV.js} +1 -1
  54. package/dist/client/assets/{EmptyState-BRY5jTpz.js → EmptyState-CeBl0iGd.js} +1 -1
  55. package/dist/client/assets/{FileViewerPane-9Bveqm9c.js → FileViewerPane-DQlpNt2S.js} +2 -2
  56. package/dist/client/assets/FlightObserveScreen-CDWGSKZg.js +1 -0
  57. package/dist/client/assets/FollowScreen-BXHOp3gb.js +1 -0
  58. package/dist/client/assets/{HarnessMark-BPAphNjx.js → HarnessMark-D5CA5uSp.js} +1 -1
  59. package/dist/client/assets/HarnessesScreen-DhFXq1qz.js +1 -0
  60. package/dist/client/assets/{HerdrSession-BujfGzrP.js → HerdrSession-BRhs5LIR.js} +1 -1
  61. package/dist/client/assets/HomeHero-7JwycwFY.css +1 -0
  62. package/dist/client/assets/HomeHero-DMABJuze.js +1 -0
  63. package/dist/client/assets/HostAdvisorView-RAociATV.js +1 -0
  64. package/dist/client/assets/{KnowledgeSearchInspector-B4ZY24xE.js → KnowledgeSearchInspector-CZPyVNSw.js} +1 -1
  65. package/dist/client/assets/KnowledgeSearchScreen-mGTKIg00.js +1 -0
  66. package/dist/client/assets/{LaneToolHoverCard-B7KdvQvf.js → LaneToolHoverCard-D_DMlBeT.js} +1 -1
  67. package/dist/client/assets/LaneTraceDetailSheet-BEHg3LmH.js +1 -0
  68. package/dist/client/assets/{LaneTraceEventFocus-mkMw2wJU.js → LaneTraceEventFocus-DVimcizS.js} +1 -1
  69. package/dist/client/assets/{MeshCanvas-CpKcWxKy.js → MeshCanvas-BOuZx4AM.js} +2 -2
  70. package/dist/client/assets/{MeshCanvasMinimap-C9IoGHbe.js → MeshCanvasMinimap-wL-1N94e.js} +1 -1
  71. package/dist/client/assets/MeshScreen-DMY9Bmh5.js +1 -0
  72. package/dist/client/assets/{MeshTopologyView-DFzr0IZM.js → MeshTopologyView-DiDcX5f4.js} +2 -2
  73. package/dist/client/assets/MessagesScreen-Eulveud3.js +1 -0
  74. package/dist/client/assets/{MissionContextRail-Y8QxUZGE.js → MissionContextRail-DrNKXG5u.js} +1 -1
  75. package/dist/client/assets/MissionControlView-ByBlHVN8.js +1 -0
  76. package/dist/client/assets/MissionFocusOverlay-D1i6R6Zt.js +1 -0
  77. package/dist/client/assets/MissionLeftAgentRow-DN9NcCML.js +1 -0
  78. package/dist/client/assets/MissionLogPane-DSeIv3Xo.js +1 -0
  79. package/dist/client/assets/NewAgentModal-V7yK6J6j.js +1 -0
  80. package/dist/client/assets/NewChatComposer-hlWT-nbR.js +19 -0
  81. package/dist/client/assets/{NewChatOrigin-DmuJ32wa.js → NewChatOrigin-DdpzE4kz.js} +1 -1
  82. package/dist/client/assets/ObserveEmbedScreen-l_Q3ts2q.js +2 -0
  83. package/dist/client/assets/ObserveTextFlow-BSEtYTxU.js +2 -0
  84. package/dist/client/assets/ObservedTopologyPanel-CdGUXxGR.js +2 -0
  85. package/dist/client/assets/OpenScoutAppShell-DN8dOSK4.js +79 -0
  86. package/dist/client/assets/OpsAgentsView-ntGr4pz4.js +1 -0
  87. package/dist/client/assets/OpsScreen-Ppen_Lmj.js +1 -0
  88. package/dist/client/assets/OpsSubnav-GAKsoSor.js +1 -0
  89. package/dist/client/assets/ProjectAgentProfile-BLlp2e6t.js +1 -0
  90. package/dist/client/assets/{ProjectAgentProfileBar-BLVg5EeA.js → ProjectAgentProfileBar-BQET-qrY.js} +1 -1
  91. package/dist/client/assets/ProjectAgentProfileHero-Ck8mThtx.js +1 -0
  92. package/dist/client/assets/ProjectsInbox-Dlt8OQ8O.js +2 -0
  93. package/dist/client/assets/ProjectsRail-DCfNMmnW.js +1 -0
  94. package/dist/client/assets/ProjectsScreen-BP-hmI1m.js +1 -0
  95. package/dist/client/assets/ProjectsThreadAside-CWpMjGIH.js +1 -0
  96. package/dist/client/assets/Provider-B2xuo3rf.js +1 -0
  97. package/dist/client/assets/RailRow-B-GycCBx.js +1 -0
  98. package/dist/client/assets/RailRow-B0sRaJc6.css +1 -0
  99. package/dist/client/assets/RawSessionsTable-AQThi6sm.js +1 -0
  100. package/dist/client/assets/RealtimeVoiceScreen-D7zZHK_t.js +1 -0
  101. package/dist/client/assets/{RepoDiffEmbedScreen-BCDXFE3D.js → RepoDiffEmbedScreen-DXWoRF_c.js} +1 -1
  102. package/dist/client/assets/{RepoDiffPageScreen-m62FiWXC.js → RepoDiffPageScreen-D_274ExO.js} +1 -1
  103. package/dist/client/assets/RepoDiffViewer-DbedmHDX.js +7 -0
  104. package/dist/client/assets/RepoDiffViewerLazy-C0--fPtk.js +2 -0
  105. package/dist/client/assets/ReposScreen-D39_YG4H.js +6 -0
  106. package/dist/client/assets/ScoutDeckSurface-CKT3qdqY.js +1 -0
  107. package/dist/client/assets/{ScoutSurface-CkgT7A-c.js → ScoutSurface-UsRy0t-I.js} +1 -1
  108. package/dist/client/assets/{ScoutbotFxLab-D-kV5j4T.js → ScoutbotFxLab-Fmdfboxs.js} +1 -1
  109. package/dist/client/assets/{SecondaryNav-_wyKjwNf.js → SecondaryNav-o2RL9H8H.js} +1 -1
  110. package/dist/client/assets/{SessionEmbedScreen-CJZmIBV7.js → SessionEmbedScreen-RD5XOx7R.js} +1 -1
  111. package/dist/client/assets/{SessionObserve-yYA8Gy5s.js → SessionObserve-Dsd0j05N.js} +9 -9
  112. package/dist/client/assets/{SessionObserveEvidence-cHdjYOJe.js → SessionObserveEvidence-DopQYDkD.js} +1 -1
  113. package/dist/client/assets/SessionRefScreen-B_cTv47v.js +1 -0
  114. package/dist/client/assets/SessionsScreen-Bq0Z77On.js +1 -0
  115. package/dist/client/assets/SettingsDrawer-R8a0TlJD.css +1 -0
  116. package/dist/client/assets/SettingsDrawer-_AwuopMS.js +3 -0
  117. package/dist/client/assets/SettingsScreen-Cw4DDfJP.js +1 -0
  118. package/dist/client/assets/{ShikiPane-dBS9hD-z.js → ShikiPane-BfHc_3pM.js} +1 -1
  119. package/dist/client/assets/{SlidePanel-CH-3-8_2.js → SlidePanel-C-q7XwTa.js} +1 -1
  120. package/dist/client/assets/SpriteAvatar-Bs68ZENy.js +1 -0
  121. package/dist/client/assets/{StatusPill-C8m9ZymF.js → StatusPill-ZZQwxB1a.js} +1 -1
  122. package/dist/client/assets/{TailView-B0BSopPs.js → TailView-Q4FVMsUH.js} +2 -2
  123. package/dist/client/assets/Terminal-D7zqHwHV.js +1 -0
  124. package/dist/client/assets/TerminalEmbedScreen-CXIJ7qv6.js +1 -0
  125. package/dist/client/assets/TerminalHeaderMount-BnBLOPbb.js +1 -0
  126. package/dist/client/assets/{TextDocumentSurface-BWJCGBZf.js → TextDocumentSurface-CKQP-cBT.js} +1 -1
  127. package/dist/client/assets/{TmuxPeek-B4QdHbGm.js → TmuxPeek-V9dGESfO.js} +1 -1
  128. package/dist/client/assets/{VoicePermissionsPanel-Dd4ITJy_.js → VoicePermissionsPanel-k7sbLXx2.js} +1 -1
  129. package/dist/client/assets/WorkDetailScreen-60p9litn.js +5 -0
  130. package/dist/client/assets/WorkFilesViewer-BjJS7GyM.js +1 -0
  131. package/dist/client/assets/{activity-CC8JzJNH.js → activity-Bj3Hnbj3.js} +1 -1
  132. package/dist/client/assets/{addon-fit-CaZ-uLrg.js → addon-fit-BL-NTWRU.js} +1 -1
  133. package/dist/client/assets/{addon-webgl-B8utL3bM.js → addon-webgl-CIMgmNjg.js} +1 -1
  134. package/dist/client/assets/{ScoutbotBroadcastChip-CxtYZWPZ.css → agent-autocomplete-C7xwIcwd.css} +1 -1
  135. package/dist/client/assets/agent-autocomplete-DXlvdc4b.js +10 -0
  136. package/dist/client/assets/{agent-essentials-B3wcxg_v.js → agent-essentials-BOMHR0_U.js} +1 -1
  137. package/dist/client/assets/{agent-lane-card-model-q4cwzLX4.js → agent-lane-card-model-CTLxf3R4.js} +1 -1
  138. package/dist/client/assets/agent-lane-detail-ppJId6Jc.js +2 -0
  139. package/dist/client/assets/{agent-lane-preview-C33Dwpn7.js → agent-lane-preview-BhplDYGf.js} +1 -1
  140. package/dist/client/assets/{agent-lanes-BDNktFBZ.css → agent-lanes-DlqcEf0l.css} +1 -1
  141. package/dist/client/assets/{agent-lanes-model-VYQ5a68i.js → agent-lanes-model-AfrjRNK5.js} +2 -2
  142. package/dist/client/assets/agent-specialization-BIPIBW8u.js +1 -0
  143. package/dist/client/assets/api-Co9aQ2Jw.js +1 -0
  144. package/dist/client/assets/{api-BkjHJfgJ.js → api-HFH8wFyb.js} +1 -1
  145. package/dist/client/assets/{arc.es-uFv9UrHn.js → arc.es-IR5r6sj_.js} +1 -1
  146. package/dist/client/assets/archive-BjcGiAy8.js +1 -0
  147. package/dist/client/assets/{arrow-down-w1HPzDSE.js → arrow-down-BydciYFZ.js} +1 -1
  148. package/dist/client/assets/{arrow-left-B-3GJ7ct.js → arrow-left-CghA0kTw.js} +1 -1
  149. package/dist/client/assets/arrow-right-iJFv3jNh.js +1 -0
  150. package/dist/client/assets/{arrow-up-right-G6bJXxhK.js → arrow-up-right-CCfZXPqD.js} +1 -1
  151. package/dist/client/assets/{bot-DzCOGKi6.js → bot-B5sub1-i.js} +1 -1
  152. package/dist/client/assets/broker-display-Q75fupqG.js +2 -0
  153. package/dist/client/assets/{cache-Dr0why2k.js → cache-CeWH_KzJ.js} +1 -1
  154. package/dist/client/assets/{check-BX8nRgop.js → check-C18YQC90.js} +1 -1
  155. package/dist/client/assets/{chevron-down-B3VVRJcV.js → chevron-down-Mp9mu_yd.js} +1 -1
  156. package/dist/client/assets/{chevron-right-BYMV1511.js → chevron-right-CzH-TaSF.js} +1 -1
  157. package/dist/client/assets/{chunk-HRAB3GC3-dRd2eQMJ.js → chunk-HRAB3GC3-swV8PA2k.js} +1 -1
  158. package/dist/client/assets/{chunk-JTPDIGGW-BjX67kHU.js → chunk-JTPDIGGW-BKXqcLKw.js} +3 -3
  159. package/dist/client/assets/{chunk-T65CQEWV-kP6nJjkU.js → chunk-T65CQEWV-vYbNJ8E6.js} +1 -1
  160. package/dist/client/assets/{chunk-YOZR3KYS-C13bZPVd.js → chunk-YOZR3KYS-U65yUmqt.js} +1 -1
  161. package/dist/client/assets/{clock-B9ukVaVn.js → clock-B4PTFi5m.js} +1 -1
  162. package/dist/client/assets/{code-xml-BFc3TMSm.js → code-xml-Jtxsp5d1.js} +1 -1
  163. package/dist/client/assets/collapsed-strip-raJWthAH.css +1 -0
  164. package/dist/client/assets/compass-0_54-vz3.js +1 -0
  165. package/dist/client/assets/content-6RvWTrtk.js +1 -0
  166. package/dist/client/assets/content-BCgwMUqz.js +1 -0
  167. package/dist/client/assets/content-Bf2VLhx0.js +1 -0
  168. package/dist/client/assets/content-BrU_38-m.js +1 -0
  169. package/dist/client/assets/content-BvvJN8rN.js +1 -0
  170. package/dist/client/assets/content-CAeEqYPw.js +1 -0
  171. package/dist/client/assets/content-CHghn-rT.js +1 -0
  172. package/dist/client/assets/{content-Uqt8AG-s.css → content-CINHz-rZ.css} +1 -1
  173. package/dist/client/assets/content-CI_Z9DXk.js +1 -0
  174. package/dist/client/assets/content-CbyKONhW.js +1 -0
  175. package/dist/client/assets/content-Czogvp43.js +1 -0
  176. package/dist/client/assets/content-DFk0zNzX.js +1 -0
  177. package/dist/client/assets/content-DHe4DgkA.js +1 -0
  178. package/dist/client/assets/content-DMbawvqU.js +1 -0
  179. package/dist/client/assets/content-DTz7cKjo.js +1 -0
  180. package/dist/client/assets/content-E3kudY-W.js +1 -0
  181. package/dist/client/assets/content-LpO0aO_U.js +1 -0
  182. package/dist/client/assets/{conversation-icons-gpsv650H.js → conversation-icons-BV10B2Me.js} +1 -1
  183. package/dist/client/assets/conversation-model-CwF6Y9gx.js +1 -0
  184. package/dist/client/assets/conversation-motion-features-BKkCRaWR.js +1 -0
  185. package/dist/client/assets/{copy-BFmOcWof.js → copy-Dtpx4FOE.js} +1 -1
  186. package/dist/client/assets/cpu-BjVis9mc.js +1 -0
  187. package/dist/client/assets/{createLucideIcon-CFBn0Sdk.js → createLucideIcon-DXpqZP7I.js} +1 -1
  188. package/dist/client/assets/credentials-BTce3VP1.js +1 -0
  189. package/dist/client/assets/ctx-panel-D_HJ3nhb.css +1 -0
  190. package/dist/client/assets/discover-CHbrEItO.js +2 -0
  191. package/dist/client/assets/embed-entry-vil28MyU.js +2 -0
  192. package/dist/client/assets/{external-link-B1TI5yIt.js → external-link-Ckiyzjwo.js} +1 -1
  193. package/dist/client/assets/{eye-1J4yOUoG.js → eye-CpfyvdLq.js} +1 -1
  194. package/dist/client/assets/file-code-corner-7mo7EviR.js +1 -0
  195. package/dist/client/assets/{file-text-DcYSrI4v.js → file-text-KijGBnME.js} +1 -1
  196. package/dist/client/assets/gauge-y-Xg8Mrv.js +1 -0
  197. package/dist/client/assets/gestures-Bq9XnSqY.js +1 -0
  198. package/dist/client/assets/git-branch-BQ_x8KZL.js +1 -0
  199. package/dist/client/assets/harnesses-screen-2z36fJKE.css +1 -0
  200. package/dist/client/assets/home-moving-signal-DMguaRWR.css +1 -0
  201. package/dist/client/assets/home-moving-signal-DtRpiNa0.js +1 -0
  202. package/dist/client/assets/home-now-card-DFb4GOgM.js +1 -0
  203. package/dist/client/assets/{home-now-card-nano-y1EhBvVL.js → home-now-card-nano-D--m9jpq.js} +1 -1
  204. package/dist/client/assets/hooks-9d1SoaQA.js +2 -0
  205. package/dist/client/assets/host-advisor-B2Fqs5Dd.css +1 -0
  206. package/dist/client/assets/index-BVlMw8x_.js +1 -0
  207. package/dist/client/assets/index-CZ-05hKz.js +10 -0
  208. package/dist/client/assets/index-Cn0GR-q1.js +1 -0
  209. package/dist/client/assets/index-DosI4AG9.js +1 -0
  210. package/dist/client/assets/index-i7TMxlwW.css +1 -0
  211. package/dist/client/assets/index-wLwc74Pu.css +1 -0
  212. package/dist/client/assets/inspector-panel-C-EhEDYy.js +2 -0
  213. package/dist/client/assets/{keyboard-nav-h1IdakpD.js → keyboard-nav-DFhAJkW3.js} +1 -1
  214. package/dist/client/assets/{lane-observe-BA3g9aVd.js → lane-observe-vfyACHi0.js} +1 -1
  215. package/dist/client/assets/{lane-roster-store-71vFgAem.js → lane-roster-store-gUBsydNf.js} +1 -1
  216. package/dist/client/assets/layers-CGou-LwV.js +1 -0
  217. package/dist/client/assets/layout-grid-BrZt31QH.js +1 -0
  218. package/dist/client/assets/left-B_o51JV6.js +1 -0
  219. package/dist/client/assets/left-BpgWnaah.js +1 -0
  220. package/dist/client/assets/left-CwHZCGO3.js +2 -0
  221. package/dist/client/assets/left-CwLs0okF.js +1 -0
  222. package/dist/client/assets/left-Cx0kv6pe.js +1 -0
  223. package/dist/client/assets/left-DA0amyfu.js +1 -0
  224. package/dist/client/assets/left-DH44V4I_.css +1 -0
  225. package/dist/client/assets/left-R2OOE7VG.css +1 -0
  226. package/dist/client/assets/left-advisor-DU3s01gk.js +1 -0
  227. package/dist/client/assets/left-agents-qL5PpUY-.js +1 -0
  228. package/dist/client/assets/left-default-uvuvDmt0.js +1 -0
  229. package/dist/client/assets/left-lanes-DnNLgec8.js +1 -0
  230. package/dist/client/assets/left-mission-DN3-NLPC.js +1 -0
  231. package/dist/client/assets/left-z-6CkuBe.js +2 -0
  232. package/dist/client/assets/library-DIo5NiGP.js +1 -0
  233. package/dist/client/assets/{loader-circle-d6PKL_KD.js → loader-circle-BiohlpM3.js} +1 -1
  234. package/dist/client/assets/{local-agents-B5pq17tZ.js → local-agents-wUIaBcEr.js} +1 -1
  235. package/dist/client/assets/{mentions-agCGDgyA.js → mentions-CcPFMbmZ.js} +1 -1
  236. package/dist/client/assets/mesh-buckets-ByyFXdKT.js +1 -0
  237. package/dist/client/assets/{mesh-ops-5pZCYptW.js → mesh-ops-CvGyjK84.js} +1 -1
  238. package/dist/client/assets/mesh-roster-n2nDpEmA.js +1 -0
  239. package/dist/client/assets/{mesh-screen-BSDUjrnV.css → mesh-screen-D1Yvo8fU.css} +1 -1
  240. package/dist/client/assets/{mesh-view-store-KJzABIkN.js → mesh-view-store-BpxGm71b.js} +1 -1
  241. package/dist/client/assets/{message-circle-CJO-pi7b.js → message-circle-B2ddzBrX.js} +1 -1
  242. package/dist/client/assets/{message-markup-CyRDLdOn.js → message-markup-RkfmDfME.js} +1 -1
  243. package/dist/client/assets/{message-square-D1hMsMj_.js → message-square-D9YYWE0x.js} +1 -1
  244. package/dist/client/assets/message-visibility-DwxgcgYK.js +1 -0
  245. package/dist/client/assets/mission-control-CnU7dNt1.css +1 -0
  246. package/dist/client/assets/{mission-control-store-Ce6dOvnZ.js → mission-control-store-Bf4b54MV.js} +1 -1
  247. package/dist/client/assets/{observe-BSWVM8YA.js → observe-CJRIvOCn.js} +1 -1
  248. package/dist/client/assets/{operator-attention-BwSPeheT.js → operator-attention-RqieiSY8.js} +1 -1
  249. package/dist/client/assets/{page-status-D2FQLJOX.js → page-status-BptpTdQ-.js} +1 -1
  250. package/dist/client/assets/{paperclip-iZmDMOS5.js → paperclip-B1UNGl5d.js} +1 -1
  251. package/dist/client/assets/perf-PX8Rx0EP.js +1 -0
  252. package/dist/client/assets/persistent-state-YI-WHSCF.js +1 -0
  253. package/dist/client/assets/{plus-gZ0T0eBI.js → plus-CuU_X0-8.js} +1 -1
  254. package/dist/client/assets/profile-rY8jO38P.js +1 -0
  255. package/dist/client/assets/projects-inbox-BBs1hG13.css +1 -0
  256. package/dist/client/assets/projects-inbox-D-zAb9Gp.js +1 -0
  257. package/dist/client/assets/proxy-DnLpZIi9.js +1 -0
  258. package/dist/client/assets/{radio-RMLfV4EO.js → radio-Dm1ItnA4.js} +1 -1
  259. package/dist/client/assets/{refresh-cw-C4x1x6b_.js → refresh-cw-BRn9Oxxl.js} +1 -1
  260. package/dist/client/assets/resolve-panes-DO6LkwhQ.js +1 -0
  261. package/dist/client/assets/resolve-sidebar-context-CIF288wY.js +1 -0
  262. package/dist/client/assets/right-BJltPRnd.js +1 -0
  263. package/dist/client/assets/right-BbyYdzHn.js +1 -0
  264. package/dist/client/assets/right-Beh3nCUB.js +1 -0
  265. package/dist/client/assets/right-C1yumXNx.js +1 -0
  266. package/dist/client/assets/{right-D-k9Z1Fe.js → right-CJnB_Bg7.js} +2 -2
  267. package/dist/client/assets/right-CPP7GyOm.js +1 -0
  268. package/dist/client/assets/right-D3aTKf1F.js +1 -0
  269. package/dist/client/assets/right-DI1B79nR.js +1 -0
  270. package/dist/client/assets/right-DtsRNX5b.js +1 -0
  271. package/dist/client/assets/right-Shpw_xDy.js +1 -0
  272. package/dist/client/assets/{rocket-CMM-IdLy.js → rocket-DOwXHKWA.js} +1 -1
  273. package/dist/client/assets/router-DJj2WbDg.js +1 -0
  274. package/dist/client/assets/{scope-views-BIfMTXU4.js → scope-views-A4_vP97W.js} +1 -1
  275. package/dist/client/assets/scout-voice-BhPzrc6P.js +1 -0
  276. package/dist/client/assets/{scoutbot-BTIErYHo.js → scoutbot-BJIamJOH.js} +2 -2
  277. package/dist/client/assets/scoutbot-markdown-jh7tzFB1.js +6 -0
  278. package/dist/client/assets/{scroll-text-DPPYrqB9.js → scroll-text-DO0GQzvN.js} +1 -1
  279. package/dist/client/assets/{search-DAyagUtF.js → search-D1tJSAWe.js} +1 -1
  280. package/dist/client/assets/secondaryNavConfig-B9IF8wXl.js +1 -0
  281. package/dist/client/assets/{selection-bridge-BXw09aRF.js → selection-bridge-i2S9zpf8.js} +1 -1
  282. package/dist/client/assets/{send-horizontal-IcG46D2M.js → send-horizontal-CgLppsIC.js} +1 -1
  283. package/dist/client/assets/{server-BySujhDV.js → server-Dymv5Emh.js} +1 -1
  284. package/dist/client/assets/{session-catalog-ClS9xf6i.js → session-catalog-DNaOEzoQ.js} +1 -1
  285. package/dist/client/assets/{session-table-BdpHs1GN.js → session-table-PTQVoTyc.js} +1 -1
  286. package/dist/client/assets/settings-2fC_G9nX.js +1 -0
  287. package/dist/client/assets/{sliders-horizontal-R5pWUUcH.js → sliders-horizontal-BPSMHhbm.js} +1 -1
  288. package/dist/client/assets/{sparkles-DJOBD_8l.js → sparkles-Dy8p5xN8.js} +1 -1
  289. package/dist/client/assets/sse-CiOSzE5n.js +1 -0
  290. package/dist/client/assets/system-surfaces-redesign-QVXNeGYw.css +1 -0
  291. package/dist/client/assets/{tail-display-BRcJltQa.js → tail-display-DcliDVkW.js} +1 -1
  292. package/dist/client/assets/{tail-events-BdvqZHLr.js → tail-events-BMQmSx1n.js} +1 -1
  293. package/dist/client/assets/{terminal-relay-TffuSPGs.js → terminal-relay-9lhzEp2V.js} +1 -1
  294. package/dist/client/assets/terminal-screen-BLk4PAYt.css +1 -0
  295. package/dist/client/assets/terminal-sessions-BQ6t92tJ.js +1 -0
  296. package/dist/client/assets/{terminal-takeover-BOFPRPjR.js → terminal-takeover-DANQfTcy.js} +1 -1
  297. package/dist/client/assets/{terminal-DJPUp_Qn.js → terminal-yN9xN-h9.js} +1 -1
  298. package/dist/client/assets/{runtime-picker--IW3cRry.js → text-CnZ0e1-V.js} +1 -1
  299. package/dist/client/assets/text-rLpBg4_z.css +1 -0
  300. package/dist/client/assets/use-conversation-list-D9BNLfnW.js +1 -0
  301. package/dist/client/assets/{use-fleet-active-asks-BHzeBZSW.js → use-fleet-active-asks-BeAdcl09.js} +1 -1
  302. package/dist/client/assets/{use-mesh-ops-items-KmaauBr_.js → use-mesh-ops-items-BIvIHlqe.js} +1 -1
  303. package/dist/client/assets/use-reduced-motion-CKkhq9c5.js +1 -0
  304. package/dist/client/assets/{use-scout-dev-flags-BJbw87PK.js → use-scout-dev-flags-B2KCzPxn.js} +1 -1
  305. package/dist/client/assets/{useAgentHoverCard-C6o0tlat.js → useAgentHoverCard-CHBsxcbp.js} +1 -1
  306. package/dist/client/assets/useContentSecondaryNav-D0mUhxTF.js +1 -0
  307. package/dist/client/assets/{usePierreRuntime-Cm7-qdm0.js → usePierreRuntime-DUuXH5yp.js} +1 -1
  308. package/dist/client/assets/{wrench-CvRjjByE.js → wrench-YcXMlsh2.js} +1 -1
  309. package/dist/client/assets/{x-C8ayPBtj.js → x-e3h2hDsp.js} +1 -1
  310. package/dist/client/assets/{xterm-B0ci4Q9a.js → xterm-Byp1Hep_.js} +1 -1
  311. package/dist/client/assets/zap-nMcjPoWB.js +1 -0
  312. package/dist/client/favicon-16.png +0 -0
  313. package/dist/client/favicon-32.png +0 -0
  314. package/dist/client/favicon.ico +0 -0
  315. package/dist/client/favicon.svg +20 -47
  316. package/dist/client/index.html +5 -5
  317. package/dist/client/openscout-icon.png +0 -0
  318. package/dist/client/site.webmanifest +2 -2
  319. package/dist/client/web-app-icon-192.png +0 -0
  320. package/dist/client/web-app-icon-512.png +0 -0
  321. package/dist/main.mjs +20095 -78203
  322. package/dist/node/main.mjs +322 -252
  323. package/dist/pairing-runtime-controller.mjs +1032 -804
  324. package/dist/runtime/base-daemon.mjs +49 -121
  325. package/dist/runtime/broker-daemon.mjs +1105 -281
  326. package/dist/runtime/broker-process-manager.mjs +6 -0
  327. package/dist/runtime/mesh-discover.mjs +6 -0
  328. package/dist/scout-control-plane-web.mjs +3326 -1912
  329. package/package.json +27 -5
  330. package/dist/client/assets/ActivityScreen-DkUP7V7M.js +0 -1
  331. package/dist/client/assets/AgentAvatar-D8ZtMluU.js +0 -1
  332. package/dist/client/assets/AgentConfigurationScreen-BlGI6fuM.js +0 -1
  333. package/dist/client/assets/AgentDefinitionsWorkspace-CfaDVCVt.js +0 -1
  334. package/dist/client/assets/AgentFloorView-DjNLILLt.js +0 -1
  335. package/dist/client/assets/AgentInfoScreen-DG5dlHb_.js +0 -1
  336. package/dist/client/assets/AgentLaneDetailSheet-BzYzBfcW.js +0 -4
  337. package/dist/client/assets/AgentLanesEmbedScreen-Crxx1srt.js +0 -1
  338. package/dist/client/assets/AgentLanesView-ChNlmY-F.js +0 -2
  339. package/dist/client/assets/AgentSessions-DpY0htZV.js +0 -6
  340. package/dist/client/assets/AgentsConsole-CHyXrjhm.js +0 -1
  341. package/dist/client/assets/AgentsScreen-BhCjX2lD.js +0 -1
  342. package/dist/client/assets/AgentsSubnav-az_VDkri.js +0 -1
  343. package/dist/client/assets/AtopView-BjjPM8OX.js +0 -1
  344. package/dist/client/assets/BriefingDetailScreen-B7qJ90Np.js +0 -6
  345. package/dist/client/assets/BriefingsScreen-CW6N829d.js +0 -1
  346. package/dist/client/assets/BrokerScreen-X3z50712.js +0 -5
  347. package/dist/client/assets/ChatCollapsedStrip-DNR9osDy.js +0 -1
  348. package/dist/client/assets/CodeScreen-CIKK1LcZ.js +0 -1
  349. package/dist/client/assets/ContextMenu-CHIuVKz7.js +0 -1
  350. package/dist/client/assets/ConversationComposer-Bf7Ga_49.js +0 -1
  351. package/dist/client/assets/ConversationFeedRows-Cm1Lgo43.js +0 -1
  352. package/dist/client/assets/ConversationHeader-B_GXrKR0.js +0 -1
  353. package/dist/client/assets/ConversationPanels-BTBbEvrP.js +0 -2
  354. package/dist/client/assets/ConversationScreen-B3l2m3JI.js +0 -1
  355. package/dist/client/assets/ConversationScreen-yIKEsm-8.css +0 -1
  356. package/dist/client/assets/ConversationStatus-BqhUHD85.js +0 -1
  357. package/dist/client/assets/DispatchAftermath-BDA9CrOd.js +0 -1
  358. package/dist/client/assets/DocumentFocusViewer-B9vodVmG.js +0 -1
  359. package/dist/client/assets/FleetSearch-Bj9SCl2f.js +0 -1
  360. package/dist/client/assets/FleetSearch-EXOe8ulE.css +0 -1
  361. package/dist/client/assets/FlightObserveScreen-BVMdsiCC.js +0 -1
  362. package/dist/client/assets/FollowScreen-BifwHWOV.js +0 -1
  363. package/dist/client/assets/HarnessesScreen-fMnbnrD4.js +0 -1
  364. package/dist/client/assets/HomeHero-BgM6S39l.js +0 -1
  365. package/dist/client/assets/HomeHero-DEl-WBsT.css +0 -1
  366. package/dist/client/assets/KnowledgeSearchScreen-Ch_WENUC.js +0 -1
  367. package/dist/client/assets/LaneTraceDetailSheet-H3AnN-vN.js +0 -1
  368. package/dist/client/assets/MeshScreen-48QkJSDI.js +0 -1
  369. package/dist/client/assets/MessageComposerSuggestions-FdVHnT_q.js +0 -1
  370. package/dist/client/assets/MessagesScreen-BMOOfbWX.js +0 -1
  371. package/dist/client/assets/MissionControlView-BpsHKu1F.js +0 -1
  372. package/dist/client/assets/MissionFocusOverlay-BPnAEA3F.js +0 -1
  373. package/dist/client/assets/MissionLeftAgentRow-iOZ6ds9L.js +0 -1
  374. package/dist/client/assets/MissionLogPane-B0csI89E.js +0 -1
  375. package/dist/client/assets/NewAgentModal-DBHJR9Qm.js +0 -1
  376. package/dist/client/assets/NewChatComposer-Hd7pI5Ac.js +0 -19
  377. package/dist/client/assets/ObserveEmbedScreen-DyArn7Id.js +0 -2
  378. package/dist/client/assets/ObserveTextFlow-CkMrtT8s.js +0 -2
  379. package/dist/client/assets/ObservedTopologyPanel-CaSZZP05.js +0 -2
  380. package/dist/client/assets/OpenScoutAppShell-BtlKkiuF.js +0 -87
  381. package/dist/client/assets/OpsAgentsView-CnqrwbC2.js +0 -1
  382. package/dist/client/assets/OpsScreen-DOlmlVkP.js +0 -1
  383. package/dist/client/assets/OpsSubnav-Dj3ShAKv.js +0 -1
  384. package/dist/client/assets/PlanView-BLGdWDx6.js +0 -1
  385. package/dist/client/assets/ProjectAgentProfile-Dv1sVnQl.js +0 -1
  386. package/dist/client/assets/ProjectAgentProfileHero-0-GDhsPT.js +0 -1
  387. package/dist/client/assets/ProjectsInbox-B3DpAI5b.js +0 -2
  388. package/dist/client/assets/ProjectsRail-BDl7U9Jq.js +0 -1
  389. package/dist/client/assets/ProjectsScreen-Dl2FcGrR.js +0 -1
  390. package/dist/client/assets/ProjectsThreadAside-BcGC5mHE.js +0 -1
  391. package/dist/client/assets/Provider-cJCdHAxu.js +0 -1
  392. package/dist/client/assets/RailRow-CLcVmywd.js +0 -1
  393. package/dist/client/assets/RailRow-Cf9LOiEj.css +0 -1
  394. package/dist/client/assets/RawSessionsTable-DBto4Ts-.js +0 -1
  395. package/dist/client/assets/RealtimeVoiceScreen-DXEU5v3g.js +0 -1
  396. package/dist/client/assets/RepoDiffViewer-PaNeZMhJ.js +0 -7
  397. package/dist/client/assets/RepoDiffViewerLazy-CWE5GxMP.js +0 -2
  398. package/dist/client/assets/ReposScreen-Cksv1cAD.js +0 -6
  399. package/dist/client/assets/ScoutDeckSurface-BCjPl7C4.js +0 -1
  400. package/dist/client/assets/ScoutbotBroadcastChip-DkiRCHuK.js +0 -2
  401. package/dist/client/assets/ScoutbotRealtimeVoiceCall-1ixiEn1L.js +0 -1
  402. package/dist/client/assets/SessionRefScreen-OkTY7Szg.js +0 -1
  403. package/dist/client/assets/SessionsScreen-B-GFjxIA.js +0 -1
  404. package/dist/client/assets/SettingsDrawer-Co11RFX0.js +0 -3
  405. package/dist/client/assets/SettingsDrawer-UX7pFJU_.css +0 -1
  406. package/dist/client/assets/SettingsScreen-Cn09nq5_.js +0 -1
  407. package/dist/client/assets/SpriteAvatar-DS6Tmyua.js +0 -1
  408. package/dist/client/assets/Terminal-U8gjIdm3.js +0 -1
  409. package/dist/client/assets/TerminalEmbedScreen-CTmdE7us.js +0 -1
  410. package/dist/client/assets/WorkDetailScreen-mJs0mb99.js +0 -5
  411. package/dist/client/assets/WorkFilesViewer-ODzLXKxj.js +0 -1
  412. package/dist/client/assets/agent-identity-BxCsXnDp.js +0 -1
  413. package/dist/client/assets/agent-lane-detail-BNNm6FNu.js +0 -2
  414. package/dist/client/assets/api-h5zurxmi.js +0 -1
  415. package/dist/client/assets/broker-display-pp33bLsu.js +0 -2
  416. package/dist/client/assets/collapsed-strip-Dz-of2SM.css +0 -1
  417. package/dist/client/assets/content-B8gahuBy.js +0 -1
  418. package/dist/client/assets/content-BIqX06OQ.js +0 -1
  419. package/dist/client/assets/content-BKDZ6Fxe.js +0 -1
  420. package/dist/client/assets/content-C15Ya-iu.js +0 -1
  421. package/dist/client/assets/content-CDE9tJDF.js +0 -1
  422. package/dist/client/assets/content-CSAfI-PX.js +0 -1
  423. package/dist/client/assets/content-CTF9D60D.js +0 -1
  424. package/dist/client/assets/content-CbAGkYQO.js +0 -1
  425. package/dist/client/assets/content-CtqLJOVp.js +0 -1
  426. package/dist/client/assets/content-Dvs1KRfo.js +0 -1
  427. package/dist/client/assets/content-DyJdVZjI.js +0 -1
  428. package/dist/client/assets/content-Ji7ATaf7.js +0 -1
  429. package/dist/client/assets/content-eqZXKWcP.js +0 -1
  430. package/dist/client/assets/content-iyyQKwvA.js +0 -1
  431. package/dist/client/assets/content-pDE7Fpb9.js +0 -1
  432. package/dist/client/assets/content-pPSd2dua.js +0 -1
  433. package/dist/client/assets/conversation-model-CHwHZNw-.js +0 -1
  434. package/dist/client/assets/conversation-motion-features-DXtKlmuM.js +0 -1
  435. package/dist/client/assets/ctx-panel-B4s49N9e.css +0 -1
  436. package/dist/client/assets/discover-DKf0aTr_.js +0 -2
  437. package/dist/client/assets/embed-entry-RlQUTtc4.js +0 -2
  438. package/dist/client/assets/gestures-CcEOV6Sr.js +0 -1
  439. package/dist/client/assets/harnesses-screen-DBZoTZz8.css +0 -1
  440. package/dist/client/assets/home-moving-signal-Bh2FugbH.js +0 -1
  441. package/dist/client/assets/home-moving-signal-CAa0V91u.css +0 -1
  442. package/dist/client/assets/home-now-card-ByRH5fFx.js +0 -1
  443. package/dist/client/assets/hooks-DUZwL3Aq.js +0 -2
  444. package/dist/client/assets/index-BBznYVWk.css +0 -1
  445. package/dist/client/assets/index-BTuq-8Iv.js +0 -1
  446. package/dist/client/assets/index-CmwGCxUk.js +0 -1
  447. package/dist/client/assets/index-CvF09yvf.css +0 -1
  448. package/dist/client/assets/index-DmFAhGPj.js +0 -10
  449. package/dist/client/assets/index-Dtaswdsh.js +0 -1
  450. package/dist/client/assets/inspector-panel-DzgS5_Mv.js +0 -2
  451. package/dist/client/assets/left-8NITBvFX.js +0 -1
  452. package/dist/client/assets/left-B2HEqrTM.js +0 -2
  453. package/dist/client/assets/left-Bk3XnxPD.css +0 -1
  454. package/dist/client/assets/left-CCoobxPS.css +0 -1
  455. package/dist/client/assets/left-CTYUvXbe.js +0 -1
  456. package/dist/client/assets/left-CwDRT50z.js +0 -2
  457. package/dist/client/assets/left-CxlDLJlw.js +0 -1
  458. package/dist/client/assets/left-XFXxNd4g.js +0 -1
  459. package/dist/client/assets/left-agents-Ck4Xn-R8.js +0 -1
  460. package/dist/client/assets/left-default-BeOyS0bR.js +0 -1
  461. package/dist/client/assets/left-lanes-DZp3jJMo.js +0 -1
  462. package/dist/client/assets/left-mission-CuKFQ5xL.js +0 -1
  463. package/dist/client/assets/left-p1hkO6P0.js +0 -1
  464. package/dist/client/assets/left-plan-3rrFENhp.js +0 -2
  465. package/dist/client/assets/library-E--gKzEZ.js +0 -1
  466. package/dist/client/assets/mesh-buckets-CfAukILK.js +0 -1
  467. package/dist/client/assets/message-visibility-kJM8XcSG.js +0 -1
  468. package/dist/client/assets/mission-control-m3BTDQ9l.css +0 -1
  469. package/dist/client/assets/model-Co0zkMIc.js +0 -1
  470. package/dist/client/assets/plan-view-D56fneVF.css +0 -1
  471. package/dist/client/assets/profile-Dxj3VVOM.js +0 -1
  472. package/dist/client/assets/projects-inbox-COZ23dLR.css +0 -1
  473. package/dist/client/assets/projects-inbox-Dzt_GQDv.js +0 -1
  474. package/dist/client/assets/resolve-panes-C9gF0w4e.js +0 -1
  475. package/dist/client/assets/resolve-sidebar-context-DxbY5RCH.js +0 -1
  476. package/dist/client/assets/right-5L7Tn0zG.js +0 -1
  477. package/dist/client/assets/right-CYtkMmRu.js +0 -1
  478. package/dist/client/assets/right-CreoQzPP.js +0 -1
  479. package/dist/client/assets/right-D9xFfy2b.js +0 -1
  480. package/dist/client/assets/right-DI7zHADe.js +0 -1
  481. package/dist/client/assets/right-DUbJ3WVc.js +0 -1
  482. package/dist/client/assets/right-DiybhsiK.js +0 -1
  483. package/dist/client/assets/right-Jh_1Q88s.js +0 -1
  484. package/dist/client/assets/right-udr1qTJG.js +0 -1
  485. package/dist/client/assets/router-Cn_s9IGH.js +0 -1
  486. package/dist/client/assets/runtime-picker-vhm0gtLs.css +0 -1
  487. package/dist/client/assets/scout-voice-CwbOz6EN.js +0 -1
  488. package/dist/client/assets/secondaryNavConfig-Dw3gS1jR.js +0 -1
  489. package/dist/client/assets/sse-CxXt4tqI.js +0 -1
  490. package/dist/client/assets/system-surfaces-redesign-B7GQhfpw.css +0 -1
  491. package/dist/client/assets/terminal-screen-BqVnCwl0.css +0 -1
  492. package/dist/client/assets/terminal-sessions-AmSgHklm.js +0 -1
  493. package/dist/client/assets/text-DsBWV_4k.js +0 -1
  494. package/dist/client/assets/use-conversation-list-C-dPcjQe.js +0 -1
  495. package/dist/client/assets/use-reduced-motion-CYqhYqHO.js +0 -1
  496. package/dist/client/assets/useContentSecondaryNav-DjHBrgnS.js +0 -1
  497. package/dist/highlights-eq9cgrbb.scm +0 -604
  498. package/dist/highlights-ghv9g403.scm +0 -205
  499. package/dist/highlights-hk7bwhj4.scm +0 -284
  500. package/dist/highlights-r812a2qc.scm +0 -150
  501. package/dist/highlights-x6tmsnaa.scm +0 -115
  502. package/dist/injections-73j83es3.scm +0 -27
  503. package/dist/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
  504. package/dist/tree-sitter-markdown-411r6y9b.wasm +0 -0
  505. package/dist/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
  506. package/dist/tree-sitter-typescript-zxjzwt75.wasm +0 -0
  507. package/dist/tree-sitter-zig-e78zbjpm.wasm +0 -0
  508. /package/dist/client/assets/{document-focus-viewer-BSC_JwVE.css → DocumentFocusViewer-BSC_JwVE.css} +0 -0
@@ -1,2 +1,2 @@
1
- import{r as h,j as i}from"./index-DmFAhGPj.js";import{C as ne}from"./chevron-down-B3VVRJcV.js";import{S as oe}from"./search-DAyagUtF.js";const se=new Set(["hud","tail","terminal","services","pair","osn-auth","notification","code","file"]);function L(e){const t=e?.trim();return t||void 0}function q(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isSafeInteger(t)&&t>0?t:void 0}function ce(e){return e.split("/").filter(t=>t.length>0).map(encodeURIComponent).join("/")}function R(e){return e.map(t=>{try{return decodeURIComponent(t)}catch{return t}}).join("/")}function ie(e){const t=q(e.get("line")),n=q(e.get("endLine")),r=t&&n&&n>=t?n:void 0;return{...L(e.get("wt"))?{wt:L(e.get("wt"))}:{},...t?{line:t}:{},...r?{endLine:r}:{}}}function G(e){const t=e.trim();if(!t)return null;if(t.startsWith("/")||t.startsWith("~/")){const u=t.replace(/^~/,""),d=t.startsWith("~")?t:u;return{root:d,file:d}}if(!/^scout:/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol.toLowerCase()!=="scout:")return null;const r=(n.hostname||n.host||"").toLowerCase(),c=n.pathname.split("/").filter(u=>u.length>0),s=ie(n.searchParams);if(!r||r==="file"){const u=c;if(u.length===0)return null;const d=`/${R(u)}`,m=L(n.searchParams.get("root")),j=L(n.searchParams.get("file"));return{root:m??d,file:j??d,...s}}if(r==="code"){if(c.length===0){const m=L(n.searchParams.get("root")),j=L(n.searchParams.get("file")),b=L(n.searchParams.get("project")),y=L(n.searchParams.get("path"));return!m&&!j&&!b?{...s}:{...m?{root:m}:{},...j?{file:j}:{},...b?{project:b}:{},...y?{path:y}:{},...s}}const u=R([c[0]]),d=c.length>1?R(c.slice(1)):void 0;return{project:u,...d?{path:d}:{},...s}}if(se.has(r))return null;const a=decodeURIComponent(r),l=c.length>0?R(c):void 0;return{project:a,...l?{path:l}:{},...s}}function ae(e){const t=new URLSearchParams;e.wt&&t.set("wt",e.wt),e.line&&e.line>0&&t.set("line",String(e.line)),e.line&&e.endLine&&e.endLine>=e.line&&t.set("endLine",String(e.endLine));const n=t.toString(),r=n?`?${n}`:"";if(e.project)return`scout://${e.path?`${encodeURIComponent(e.project)}/${ce(e.path)}`:encodeURIComponent(e.project)}${r}`;const c=e.file??e.root;return c?`scout://${c.startsWith("/")?c:`/${c}`}${r}`:`scout://code${r}`}function le(e,t){const n=e.trim();if(!n)return null;let r=null;for(const c of t)(n===c||n.startsWith(`${c}/`))&&(!r||c.length>r.length)&&(r=c);return r?{root:r,file:n===r?null:n}:null}function ue(e){const t=e.trim();return t?!!(t.startsWith("/")||t.startsWith("~/")||/^scout:/i.test(t)):!1}function B(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function de(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function fe(e){return e.branch.detached?"detached":e.branch.name??"no branch"}function pe(e){return e.status.clean?"":`${e.status.changedFiles} changed`}function he(e){const t=[];for(const n of e)for(const[r,c]of n.worktrees.entries())t.push({root:c.path,projectId:n.id,projectName:n.name,projectSlug:B(n.name)||B(de(n.name)),worktreeName:c.name,branchLabel:fe(c),dirtyLabel:pe(c),isPrimary:r===0,changedFiles:c.status.changedFiles});return t}function v(e){return e.toLocaleLowerCase().replace(/[\s/_-]+/g," ").trim()}function me(e,t,n=0){const r=v(t);if(!r)return n;const c=r.split(" ").filter(Boolean),s=v(e.projectName),a=v(e.root),l=v(e.branchLabel),u=v(e.worktreeName),d=`${s} ${a} ${l} ${u} ${e.projectSlug}`;if(!c.every(j=>d.includes(j)))return-1;let m=n/100;return s===r||e.projectSlug===r.replace(/\s+/g,"-")?m+=120:s.startsWith(r)||e.projectSlug.startsWith(r.replace(/\s+/g,"-"))?m+=80:s.includes(r)&&(m+=48),(l.startsWith(r)||l.includes(r))&&(m+=34),u.includes(r)&&(m+=24),a.includes(r)&&(m+=20),m+=c.reduce((j,b)=>j+(s.startsWith(b)?12:0),0),m}function ge(e,t,n,r=12){const c=new Map(n.map((a,l)=>[a,n.length-l])),s=e.map(a=>({option:a,score:me(a,t,c.get(a.root)??0)})).filter(a=>a.score>=0);return t.trim()?s.sort((a,l)=>l.score-a.score||a.option.projectName.localeCompare(l.option.projectName)):s.sort((a,l)=>{const u=c.get(a.option.root)??-1,d=c.get(l.option.root)??-1;return u!==d?d-u:a.option.projectName.localeCompare(l.option.projectName)||a.option.branchLabel.localeCompare(l.option.branchLabel)}),s.slice(0,r).map(a=>a.option)}function Y(e){return e.isPrimary?e.projectName:`${e.projectName} · ${e.branchLabel}`}function D(e){return e.dirtyLabel?`${e.branchLabel} · ${e.dirtyLabel}`:e.branchLabel}function O(e){const t=typeof window<"u"?window.__OPEN_SCOUT_HOME:void 0;if(t&&e.startsWith(`${t}/`))return`~/${e.slice(t.length+1)}`;if(e.startsWith("/Users/")){const n=e.slice(7),r=n.indexOf("/");if(r>0)return`~${n.slice(r)}`}if(e.startsWith("/home/")){const n=e.slice(6),r=n.indexOf("/");if(r>0)return`~${n.slice(r)}`}return e}const Q="openscout.code.tree:",_="openscout.code.lastRoot",V="openscout.code.recentRoots",je=8;function Ce(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(Q+e);if(!t)return null;const n=JSON.parse(t);return!n||typeof n.entries!="object"||!Array.isArray(n.expanded)?null:n}catch{return null}}function Re(e,t){if(typeof window>"u")return;const n={};for(const r of[e,...t.expanded]){const c=t.entries.get(r);c&&(n[r]=c)}try{window.localStorage.setItem(Q+e,JSON.stringify({entries:n,expanded:[...t.expanded],selectedFile:t.selectedFile,savedAt:Date.now()}))}catch{}}function Oe(){if(typeof window>"u")return null;try{return window.localStorage.getItem(_)}catch{return null}}function M(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(V);if(!e){const n=window.localStorage.getItem(_);return n?[n]:[]}const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"&&n.length>0):[]}catch{return[]}}function Pe(e){if(!(typeof window>"u"))try{window.localStorage.setItem(_,e);const t=M().filter(r=>r!==e),n=[e,...t].slice(0,je);window.localStorage.setItem(V,JSON.stringify(n))}catch{}}const we=6,be=12;function k(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function W(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function X(e,t,n){const r=G(e);if(!r)return null;if(r.root||r.file){const c=t.map(u=>u.root),s=xe(r.file??r.root,c),a=le(s,c);if(a)return{root:a.root,file:a.file,line:r.line,endLine:r.endLine};const l=W(s).includes(".");return{root:l?Le(s):s,file:l?s:null,line:r.line,endLine:r.endLine}}if(r.project){const c=ke(n,r.project,r.wt??null,t);if(!c)return null;const s=r.path?`${c.root}/${r.path}`:null;return{root:c.root,file:s,project:r.project,path:r.path,wt:r.wt,line:r.line,endLine:r.endLine}}return null}function xe(e,t){if(!e.startsWith("~/")&&e!=="~")return e;for(const n of t){const r=n.match(/^(\/Users\/[^/]+)/)??n.match(/^(\/home\/[^/]+)/);if(r)return`${r[1]}${e.slice(1)}`}return e}function Le(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):e}function ke(e,t,n,r){if(e){const a=k(t),l=e.projects.find(u=>k(u.name)===a||k(W(u.root))===a);if(l)return{root:(n?l.worktrees.find(d=>d.name===n||d.branch.name===n||k(d.name)===k(n)):l.worktrees[0])?.path??l.root}}const c=k(t),s=r.find(a=>a.projectSlug===c);return s?{root:s.root}:null}function ye(e){if(e.project)return ae({project:e.project,path:e.path,wt:e.wt,line:e.line,endLine:e.endLine});const t=e.file??e.root;return t?O(t):"Deep link"}function Ne({snapshot:e,root:t,onSelect:n}){const[r,c]=h.useState(!1),[s,a]=h.useState(""),[l,u]=h.useState(0),[d,m]=h.useState(()=>M()),j=h.useRef(null),b=h.useRef(null),y=h.useRef(null),N=h.useId().replaceAll(":",""),P=`code-project-results-${N}`,x=h.useMemo(()=>he(e?.projects??[]),[e]),I=h.useMemo(()=>{const o=new Map;for(const f of x)o.set(f.root,f);return o},[x]),C=t?I.get(t)??null:null;h.useEffect(()=>{m(M())},[t,r]);const U=h.useMemo(()=>{const o=[];for(const f of d){const $=I.get(f);if($&&o.push($),o.length>=we)break}return o},[d,I]),w=ue(s),A=w?G(s):null,p=w?X(s,x,e):null,g=h.useMemo(()=>w?[]:ge(x,s,d,be),[x,s,d,w]),Z=(p?1:0)+g.length,S=h.useMemo(()=>{if(!s.trim()||w)return"";const o=g.find(f=>f.projectName.toLocaleLowerCase().startsWith(s.toLocaleLowerCase()));return o&&o.projectName.length>s.length?o.projectName:""},[s,g,w]);h.useEffect(()=>u(0),[s,r]),h.useEffect(()=>{if(!r)return;const o=window.setTimeout(()=>b.current?.focus(),20);return()=>window.clearTimeout(o)},[r]),h.useEffect(()=>{if(!r)return;function o(f){j.current?.contains(f.target)||(c(!1),a(""))}return document.addEventListener("pointerdown",o),()=>document.removeEventListener("pointerdown",o)},[r]);const E=()=>{a(""),c(!1),window.setTimeout(()=>y.current?.focus(),0)},T=o=>{n({root:o}),E()},F=()=>{p&&(n(p),E())},ee=o=>{if(o.key==="ArrowDown")o.preventDefault(),u(f=>Math.min(f+1,Math.max(Z-1,0)));else if(o.key==="ArrowUp")o.preventDefault(),u(f=>Math.max(f-1,0));else if(o.key==="Enter"){if(o.preventDefault(),p&&(l===0||g.length===0)){F();return}const f=p?l-1:l;g[f]&&T(g[f].root)}else o.key==="ArrowRight"&&S&&o.currentTarget.selectionStart===s.length?(o.preventDefault(),a(S)):o.key==="Escape"&&(o.preventDefault(),E())},te=C?Y(C):t?O(t):"Pick a project…",z=C?D(C):null,H=!!p&&l===0,re=p&&l===0?`${N}-deeplink`:g[p?l-1:l]?`${N}-opt-${g[p?l-1:l].root}`:void 0;return i.jsxs("div",{className:"s-code-picker",ref:j,children:[i.jsxs("button",{ref:y,type:"button",className:"s-code-pickerTrigger","aria-haspopup":"listbox","aria-expanded":r,"aria-controls":r?P:void 0,"aria-label":"Project or worktree",onClick:()=>c(o=>!o),children:[i.jsx("span",{className:"s-code-pickerTriggerName",children:te}),z?i.jsx("span",{className:"s-code-pickerTriggerDetail",children:z}):null,i.jsx(ne,{size:13,"aria-hidden":!0,className:"s-code-pickerChevron","data-open":r||void 0})]}),r?i.jsxs("div",{className:"s-code-pickerPanel",role:"dialog","aria-label":"Choose a project",children:[U.length>0&&!w?i.jsx("div",{className:"s-code-pickerRecents","aria-label":"Recent projects",children:U.map(o=>i.jsx("button",{type:"button",className:"s-code-pickerChip","data-active":o.root===t||void 0,title:`${o.projectName} · ${D(o)}
1
+ import{r as h,j as i}from"./index-CZ-05hKz.js";import{C as ne}from"./chevron-down-Mp9mu_yd.js";import{S as oe}from"./search-D1tJSAWe.js";const se=new Set(["hud","tail","terminal","services","pair","osn-auth","notification","code","file"]);function L(e){const t=e?.trim();return t||void 0}function q(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isSafeInteger(t)&&t>0?t:void 0}function ce(e){return e.split("/").filter(t=>t.length>0).map(encodeURIComponent).join("/")}function R(e){return e.map(t=>{try{return decodeURIComponent(t)}catch{return t}}).join("/")}function ie(e){const t=q(e.get("line")),n=q(e.get("endLine")),r=t&&n&&n>=t?n:void 0;return{...L(e.get("wt"))?{wt:L(e.get("wt"))}:{},...t?{line:t}:{},...r?{endLine:r}:{}}}function G(e){const t=e.trim();if(!t)return null;if(t.startsWith("/")||t.startsWith("~/")){const u=t.replace(/^~/,""),d=t.startsWith("~")?t:u;return{root:d,file:d}}if(!/^scout:/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol.toLowerCase()!=="scout:")return null;const r=(n.hostname||n.host||"").toLowerCase(),c=n.pathname.split("/").filter(u=>u.length>0),s=ie(n.searchParams);if(!r||r==="file"){const u=c;if(u.length===0)return null;const d=`/${R(u)}`,m=L(n.searchParams.get("root")),j=L(n.searchParams.get("file"));return{root:m??d,file:j??d,...s}}if(r==="code"){if(c.length===0){const m=L(n.searchParams.get("root")),j=L(n.searchParams.get("file")),b=L(n.searchParams.get("project")),y=L(n.searchParams.get("path"));return!m&&!j&&!b?{...s}:{...m?{root:m}:{},...j?{file:j}:{},...b?{project:b}:{},...y?{path:y}:{},...s}}const u=R([c[0]]),d=c.length>1?R(c.slice(1)):void 0;return{project:u,...d?{path:d}:{},...s}}if(se.has(r))return null;const a=decodeURIComponent(r),l=c.length>0?R(c):void 0;return{project:a,...l?{path:l}:{},...s}}function ae(e){const t=new URLSearchParams;e.wt&&t.set("wt",e.wt),e.line&&e.line>0&&t.set("line",String(e.line)),e.line&&e.endLine&&e.endLine>=e.line&&t.set("endLine",String(e.endLine));const n=t.toString(),r=n?`?${n}`:"";if(e.project)return`scout://${e.path?`${encodeURIComponent(e.project)}/${ce(e.path)}`:encodeURIComponent(e.project)}${r}`;const c=e.file??e.root;return c?`scout://${c.startsWith("/")?c:`/${c}`}${r}`:`scout://code${r}`}function le(e,t){const n=e.trim();if(!n)return null;let r=null;for(const c of t)(n===c||n.startsWith(`${c}/`))&&(!r||c.length>r.length)&&(r=c);return r?{root:r,file:n===r?null:n}:null}function ue(e){const t=e.trim();return t?!!(t.startsWith("/")||t.startsWith("~/")||/^scout:/i.test(t)):!1}function B(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function de(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function fe(e){return e.branch.detached?"detached":e.branch.name??"no branch"}function pe(e){return e.status.clean?"":`${e.status.changedFiles} changed`}function he(e){const t=[];for(const n of e)for(const[r,c]of n.worktrees.entries())t.push({root:c.path,projectId:n.id,projectName:n.name,projectSlug:B(n.name)||B(de(n.name)),worktreeName:c.name,branchLabel:fe(c),dirtyLabel:pe(c),isPrimary:r===0,changedFiles:c.status.changedFiles});return t}function v(e){return e.toLocaleLowerCase().replace(/[\s/_-]+/g," ").trim()}function me(e,t,n=0){const r=v(t);if(!r)return n;const c=r.split(" ").filter(Boolean),s=v(e.projectName),a=v(e.root),l=v(e.branchLabel),u=v(e.worktreeName),d=`${s} ${a} ${l} ${u} ${e.projectSlug}`;if(!c.every(j=>d.includes(j)))return-1;let m=n/100;return s===r||e.projectSlug===r.replace(/\s+/g,"-")?m+=120:s.startsWith(r)||e.projectSlug.startsWith(r.replace(/\s+/g,"-"))?m+=80:s.includes(r)&&(m+=48),(l.startsWith(r)||l.includes(r))&&(m+=34),u.includes(r)&&(m+=24),a.includes(r)&&(m+=20),m+=c.reduce((j,b)=>j+(s.startsWith(b)?12:0),0),m}function ge(e,t,n,r=12){const c=new Map(n.map((a,l)=>[a,n.length-l])),s=e.map(a=>({option:a,score:me(a,t,c.get(a.root)??0)})).filter(a=>a.score>=0);return t.trim()?s.sort((a,l)=>l.score-a.score||a.option.projectName.localeCompare(l.option.projectName)):s.sort((a,l)=>{const u=c.get(a.option.root)??-1,d=c.get(l.option.root)??-1;return u!==d?d-u:a.option.projectName.localeCompare(l.option.projectName)||a.option.branchLabel.localeCompare(l.option.branchLabel)}),s.slice(0,r).map(a=>a.option)}function Y(e){return e.isPrimary?e.projectName:`${e.projectName} · ${e.branchLabel}`}function D(e){return e.dirtyLabel?`${e.branchLabel} · ${e.dirtyLabel}`:e.branchLabel}function O(e){const t=typeof window<"u"?window.__OPEN_SCOUT_HOME:void 0;if(t&&e.startsWith(`${t}/`))return`~/${e.slice(t.length+1)}`;if(e.startsWith("/Users/")){const n=e.slice(7),r=n.indexOf("/");if(r>0)return`~${n.slice(r)}`}if(e.startsWith("/home/")){const n=e.slice(6),r=n.indexOf("/");if(r>0)return`~${n.slice(r)}`}return e}const Q="openscout.code.tree:",_="openscout.code.lastRoot",V="openscout.code.recentRoots",je=8;function Ce(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(Q+e);if(!t)return null;const n=JSON.parse(t);return!n||typeof n.entries!="object"||!Array.isArray(n.expanded)?null:n}catch{return null}}function Re(e,t){if(typeof window>"u")return;const n={};for(const r of[e,...t.expanded]){const c=t.entries.get(r);c&&(n[r]=c)}try{window.localStorage.setItem(Q+e,JSON.stringify({entries:n,expanded:[...t.expanded],selectedFile:t.selectedFile,savedAt:Date.now()}))}catch{}}function Oe(){if(typeof window>"u")return null;try{return window.localStorage.getItem(_)}catch{return null}}function M(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(V);if(!e){const n=window.localStorage.getItem(_);return n?[n]:[]}const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"&&n.length>0):[]}catch{return[]}}function Pe(e){if(!(typeof window>"u"))try{window.localStorage.setItem(_,e);const t=M().filter(r=>r!==e),n=[e,...t].slice(0,je);window.localStorage.setItem(V,JSON.stringify(n))}catch{}}const we=6,be=12;function k(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function W(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function X(e,t,n){const r=G(e);if(!r)return null;if(r.root||r.file){const c=t.map(u=>u.root),s=xe(r.file??r.root,c),a=le(s,c);if(a)return{root:a.root,file:a.file,line:r.line,endLine:r.endLine};const l=W(s).includes(".");return{root:l?Le(s):s,file:l?s:null,line:r.line,endLine:r.endLine}}if(r.project){const c=ke(n,r.project,r.wt??null,t);if(!c)return null;const s=r.path?`${c.root}/${r.path}`:null;return{root:c.root,file:s,project:r.project,path:r.path,wt:r.wt,line:r.line,endLine:r.endLine}}return null}function xe(e,t){if(!e.startsWith("~/")&&e!=="~")return e;for(const n of t){const r=n.match(/^(\/Users\/[^/]+)/)??n.match(/^(\/home\/[^/]+)/);if(r)return`${r[1]}${e.slice(1)}`}return e}function Le(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):e}function ke(e,t,n,r){if(e){const a=k(t),l=e.projects.find(u=>k(u.name)===a||k(W(u.root))===a);if(l)return{root:(n?l.worktrees.find(d=>d.name===n||d.branch.name===n||k(d.name)===k(n)):l.worktrees[0])?.path??l.root}}const c=k(t),s=r.find(a=>a.projectSlug===c);return s?{root:s.root}:null}function ye(e){if(e.project)return ae({project:e.project,path:e.path,wt:e.wt,line:e.line,endLine:e.endLine});const t=e.file??e.root;return t?O(t):"Deep link"}function Ne({snapshot:e,root:t,onSelect:n}){const[r,c]=h.useState(!1),[s,a]=h.useState(""),[l,u]=h.useState(0),[d,m]=h.useState(()=>M()),j=h.useRef(null),b=h.useRef(null),y=h.useRef(null),N=h.useId().replaceAll(":",""),P=`code-project-results-${N}`,x=h.useMemo(()=>he(e?.projects??[]),[e]),I=h.useMemo(()=>{const o=new Map;for(const f of x)o.set(f.root,f);return o},[x]),C=t?I.get(t)??null:null;h.useEffect(()=>{m(M())},[t,r]);const U=h.useMemo(()=>{const o=[];for(const f of d){const $=I.get(f);if($&&o.push($),o.length>=we)break}return o},[d,I]),w=ue(s),A=w?G(s):null,p=w?X(s,x,e):null,g=h.useMemo(()=>w?[]:ge(x,s,d,be),[x,s,d,w]),Z=(p?1:0)+g.length,S=h.useMemo(()=>{if(!s.trim()||w)return"";const o=g.find(f=>f.projectName.toLocaleLowerCase().startsWith(s.toLocaleLowerCase()));return o&&o.projectName.length>s.length?o.projectName:""},[s,g,w]);h.useEffect(()=>u(0),[s,r]),h.useEffect(()=>{if(!r)return;const o=window.setTimeout(()=>b.current?.focus(),20);return()=>window.clearTimeout(o)},[r]),h.useEffect(()=>{if(!r)return;function o(f){j.current?.contains(f.target)||(c(!1),a(""))}return document.addEventListener("pointerdown",o),()=>document.removeEventListener("pointerdown",o)},[r]);const E=()=>{a(""),c(!1),window.setTimeout(()=>y.current?.focus(),0)},T=o=>{n({root:o}),E()},F=()=>{p&&(n(p),E())},ee=o=>{if(o.key==="ArrowDown")o.preventDefault(),u(f=>Math.min(f+1,Math.max(Z-1,0)));else if(o.key==="ArrowUp")o.preventDefault(),u(f=>Math.max(f-1,0));else if(o.key==="Enter"){if(o.preventDefault(),p&&(l===0||g.length===0)){F();return}const f=p?l-1:l;g[f]&&T(g[f].root)}else o.key==="ArrowRight"&&S&&o.currentTarget.selectionStart===s.length?(o.preventDefault(),a(S)):o.key==="Escape"&&(o.preventDefault(),E())},te=C?Y(C):t?O(t):"Pick a project…",z=C?D(C):null,H=!!p&&l===0,re=p&&l===0?`${N}-deeplink`:g[p?l-1:l]?`${N}-opt-${g[p?l-1:l].root}`:void 0;return i.jsxs("div",{className:"s-code-picker",ref:j,children:[i.jsxs("button",{ref:y,type:"button",className:"s-code-pickerTrigger","aria-haspopup":"listbox","aria-expanded":r,"aria-controls":r?P:void 0,"aria-label":"Project or worktree",onClick:()=>c(o=>!o),children:[i.jsx("span",{className:"s-code-pickerTriggerName",children:te}),z?i.jsx("span",{className:"s-code-pickerTriggerDetail",children:z}):null,i.jsx(ne,{size:13,"aria-hidden":!0,className:"s-code-pickerChevron","data-open":r||void 0})]}),r?i.jsxs("div",{className:"s-code-pickerPanel",role:"dialog","aria-label":"Choose a project",children:[U.length>0&&!w?i.jsx("div",{className:"s-code-pickerRecents","aria-label":"Recent projects",children:U.map(o=>i.jsx("button",{type:"button",className:"s-code-pickerChip","data-active":o.root===t||void 0,title:`${o.projectName} · ${D(o)}
2
2
  ${o.root}`,onClick:()=>T(o.root),children:Y(o)},o.root))}):null,i.jsxs("div",{className:"s-code-pickerSearch",children:[i.jsx(oe,{size:13,"aria-hidden":!0,className:"s-code-pickerSearchIcon"}),i.jsxs("div",{className:"s-code-pickerInputStack",children:[S?i.jsxs("div",{className:"s-code-pickerGhost","aria-hidden":!0,children:[i.jsx("span",{children:s}),S.slice(s.length)]}):null,i.jsx("input",{ref:b,className:"s-code-pickerInput",type:"search",role:"combobox",value:s,onChange:o=>a(o.currentTarget.value),onKeyDown:ee,placeholder:"Project, scout:// path, or branch…","aria-label":"Find a project","aria-autocomplete":"both","aria-expanded":"true","aria-controls":P,"aria-activedescendant":re,autoComplete:"off",spellCheck:!1})]}),S?i.jsx("kbd",{className:"s-code-pickerHint",children:"→"}):null]}),i.jsxs("div",{className:"s-code-pickerHeading",children:[i.jsx("span",{children:w?p?"Deep link":"Unrecognized link":s.trim()?g.length?"Matches":"No matches":"All projects"}),i.jsx("span",{children:w?p?"open with ↵":"no match":s.trim()?`${g.length} shown`:x.length?`${Math.min(g.length,x.length)} of ${x.length}`:e?"No repos yet":"Loading…"})]}),i.jsxs("div",{id:P,className:"s-code-pickerResults",role:"listbox","aria-label":"Projects",children:[p?i.jsxs("button",{id:`${N}-deeplink`,type:"button",role:"option","aria-selected":H,tabIndex:-1,className:"s-code-pickerOption s-code-pickerOption--deep","data-active":H||void 0,onMouseEnter:()=>u(0),onClick:F,children:[i.jsx("span",{className:"s-code-pickerOptionMain",children:i.jsx("strong",{children:"Open deep link"})}),i.jsx("span",{className:"s-code-pickerOptionPath",title:s.trim(),children:A?ye(A):s.trim()}),i.jsxs("span",{className:"s-code-pickerOptionMeta",children:[O(p.root),p.file?` · ${W(p.file)}`:""]})]}):null,g.map((o,f)=>{const $=p?f+1:f,J=$===l,K=o.root===t;return i.jsxs("button",{id:`${N}-opt-${o.root}`,type:"button",role:"option","aria-selected":J,"aria-current":K||void 0,tabIndex:-1,className:"s-code-pickerOption","data-active":J||void 0,"data-selected":K||void 0,onMouseEnter:()=>u($),onClick:()=>T(o.root),children:[i.jsxs("span",{className:"s-code-pickerOptionMain",children:[i.jsx("strong",{children:o.projectName}),o.isPrimary?null:i.jsx("span",{className:"s-code-pickerWorktree",children:"worktree"})]}),i.jsx("span",{className:"s-code-pickerOptionPath",title:o.root,children:O(o.root)}),i.jsx("span",{className:"s-code-pickerOptionMeta",children:D(o)})]},o.root)})]}),g.length===0&&s.trim()&&!p?i.jsx("div",{className:"s-code-pickerEmpty",role:"status",children:w?"Could not resolve that scout:// link. Try a project slug or absolute path.":`No project matches “${s}”. Try a folder name, branch, path, or scout:// link.`}):null,i.jsxs("div",{className:"s-code-pickerGuide",children:[i.jsxs("span",{children:[i.jsx("kbd",{children:"↑"}),i.jsx("kbd",{children:"↓"})," move"]}),i.jsxs("span",{children:[i.jsx("kbd",{children:"↵"})," open"]}),i.jsxs("span",{children:[i.jsx("kbd",{children:"esc"})," close"]})]})]}):null]})}const Ie=Object.freeze(Object.defineProperty({__proto__:null,CodeProjectPicker:Ne,resolvePickerDeepLink:X},Symbol.toStringTag,{value:"Module"}));export{Ne as C,Ce as a,Pe as b,Ie as c,ae as f,Oe as r,O as s,Re as w};
@@ -0,0 +1 @@
1
+ import{r as s,j as r}from"./index-CZ-05hKz.js";import{a as G}from"./api-Co9aQ2Jw.js";import{c as je}from"./clipboard-e3fSpeo7.js";import{f as ze}from"./scoutbot-BJIamJOH.js";import{g as Ae,f as Ce}from"./api-HFH8wFyb.js";import{d as Ke}from"./types-B0PlfpKc.js";import{r as Oe,C as He}from"./CodeDiffPane-Cn8Y9hAt.js";import{r as qe,a as Ge,w as Ve,b as Xe,f as xe,C as Je,s as Qe}from"./CodeProjectPicker-nPFktrco.js";import{ShikiPane as Ye}from"./ShikiPane-BfHc_3pM.js";/* empty css */import{A as Ze}from"./arrow-left-CghA0kTw.js";import{C as et}from"./chevron-right-CzH-TaSF.js";import{C as tt}from"./check-C18YQC90.js";import{C as nt}from"./copy-Dtpx4FOE.js";import"./perf-PX8Rx0EP.js";import"./cache-CeWH_KzJ.js";import"./usePierreRuntime-DUuXH5yp.js";import"./chunk-HRAB3GC3-swV8PA2k.js";/* empty css */import"./chevron-down-Mp9mu_yd.js";import"./createLucideIcon-DXpqZP7I.js";import"./search-D1tJSAWe.js";const st=new Set(["node_modules",".git","dist",".next",".build","DerivedData","__pycache__",".venv","target"]);function we(i){const l=i.lastIndexOf("/");return l>0?i.slice(0,l):"/"}function ce(i){const l=i.lastIndexOf("/");return l>=0?i.slice(l+1):i}function V(i){return i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/(1024*1024)).toFixed(1)} MB`}function S(i){return i.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function rt(i,l,k){const g=S(l),f=i.projects.find(u=>S(u.name)===g||S(ce(u.root))===g);if(!f)return null;const x=k?f.worktrees.find(u=>u.name===k||u.branch.name===k||S(u.name)===S(k)):f.worktrees[0];return{projectName:f.name,root:x?.path??f.root}}function ye(i,l){if(!l.startsWith(`${i}/`))return[];const k=l.slice(i.length+1).split("/"),g=[];let f=i;for(const x of k.slice(0,-1))f=`${f}/${x}`,g.push(f);return g}function it(i){switch(i){case"untracked":return"U";case"conflicted":return"C";case"staged":return"S";case"unstaged":return"M";case"staged+unstaged":return"SM";default:return i.charAt(0).toUpperCase()}}function be(i,l,k,g,f){const x=k.get(i);if(!x){f.push({path:`${i}#loading`,name:"Loading…",kind:"file",depth:l,loading:!0});return}for(const u of x)u.kind==="directory"&&st.has(u.name)||(f.push({path:u.path,name:u.name,kind:u.kind,depth:l}),u.kind==="directory"&&g.has(u.path)&&be(u.path,l+1,k,g,f))}function Rt({route:i,navigate:l,root:k,file:g,project:f,path:x,wt:u,line:Le,endLine:Ne,returnConversationId:Re,embedded:X=!1}){const I=k??i?.root??null,B=g??i?.file??null,p=f??i?.project??null,b=x??i?.path??null,P=u??i?.wt??null,j=Le??i?.line,w=Ne??i?.endLine,C=Re??i?.returnConversationId??null,[h,le]=s.useState(()=>Ae()),[o,J]=s.useState(()=>I??(p?null:qe())),[y,Q]=s.useState(()=>new Map),[L,U]=s.useState(()=>new Set),[de,ue]=s.useState(null),[a,W]=s.useState(B),[c,_]=s.useState(null),[Ee,Y]=s.useState(!1),[fe,z]=s.useState(null),[pe,Z]=s.useState("idle"),[M,ee]=s.useState("source"),[m,te]=s.useState(()=>j&&j>0?{line:j,...w&&w>=j?{endLine:w}:{}}:null),[N,A]=s.useState(()=>p?{phase:"resolving"}:{phase:"idle"}),ne=p?`${p}\0${b??""}\0${P??""}`:null,R=s.useRef(null),se=s.useRef(null),T=s.useRef(ne);T.current!==ne&&(T.current=ne,R.current=null,se.current=null),s.useEffect(()=>{te(j&&j>0?{line:j,...w&&w>=j?{endLine:w}:{}}:null)},[w,j]),s.useEffect(()=>{if(h)return;let e=!1;return Ce("quick",!1,2e4).then(t=>{e||le(t)}).catch(()=>{}),()=>{e=!0}},[h]);const E=s.useCallback(async e=>{try{const t=await G(`/api/file/preview?path=${encodeURIComponent(e)}`);if(t.kind!=="directory")return;const n=t.entries.map(d=>({name:d.name,path:d.path,kind:d.kind}));Q(d=>new Map(d).set(e,n))}catch(t){ue(t instanceof Error?t.message:String(t))}},[]),$=s.useCallback((e,t)=>{if(!t)return;const n=ye(e,t);if(n.length!==0){U(d=>new Set([...d,...n]));for(const d of n)E(d)}},[E]);s.useEffect(()=>{if(!p)return;const e=`${p}\0${b??""}\0${P??""}`;if(R.current===e)return;const t=n=>{R.current=e;const d=b?`${n}/${b}`:null;A({phase:"idle"}),J(n),W(d),$(n,d)};if(h){const n=rt(h,p,P);if(n){t(n.root);return}}se.current!==e&&(A({phase:"resolving"}),G(`/api/code/resolve-project?slug=${encodeURIComponent(p)}`).then(n=>{R.current===e||T.current!==e||t(n.root)}).catch(n=>{if(R.current===e||T.current!==e)return;se.current=e;const d=n instanceof Error?n.message:String(n);A({phase:"failed",message:d.includes(p)?d:`Can't resolve project "${p}": ${d}`})}))},[p,b,P,h,$]),s.useEffect(()=>{if(o||p||!h)return;const e=h.projects[0];e&&J(e.worktrees[0]?.path??e.root)},[o,p,h]);const he=s.useRef(a);he.current=a,s.useEffect(()=>{if(!o)return;ue(null);const e=Ge(o),t=he.current,n=t?ye(o,t):[];e?(Q(new Map(Object.entries(e.entries))),U(new Set([...e.expanded,...n])),!t&&e.selectedFile&&W(e.selectedFile)):(Q(new Map),U(new Set(n)));const d=new Set([o,...e?.expanded??[],...n]);for(const ae of d)E(ae);Ce("quick",!1,2e4).then(le).catch(()=>{})},[o,E]),s.useEffect(()=>{!o||y.size===0||(Ve(o,{entries:y,expanded:L,selectedFile:a}),Xe(o))},[o,y,L,a]),s.useEffect(()=>{!I||!B||$(I,B)},[I,B,$]);const re=s.useRef(new Map),ie=s.useRef(new Set),$e=3e4,K=s.useCallback(e=>{const t=re.current.get(e);return t?Date.now()-t.at>$e?(re.current.delete(e),null):t.preview:null},[]),O=s.useCallback((e,t)=>{const n=re.current;if(n.set(e,{at:Date.now(),preview:t}),n.size>80){const d=n.keys().next().value;d&&n.delete(d)}},[]),Fe=s.useCallback(e=>{K(e)||ie.current.has(e)||(ie.current.add(e),G(`/api/file/preview?path=${encodeURIComponent(e)}`).then(t=>O(e,t)).catch(()=>{}).finally(()=>ie.current.delete(e)))},[K,O]);s.useEffect(()=>{if(Z("idle"),!a){_(null),z(null);return}const e=K(a);if(e){_(e.kind==="file"?e:null),z(null),Y(!1);return}let t=!1;return Y(!0),z(null),G(`/api/file/preview?path=${encodeURIComponent(a)}`).then(n=>{t||(O(a,n),_(n.kind==="file"?n:null))}).catch(n=>{t||(_(null),z(n instanceof Error?n.message:String(n)))}).finally(()=>{t||Y(!1)}),()=>{t=!0}},[a,K,O]);const Me=s.useMemo(()=>{if(!o)return[];const e=[];return be(o,0,y,L,e),e},[o,y,L]),me=s.useCallback((e,t)=>{const n=C?{returnConversationId:C}:{};if(h){for(const d of h.projects)for(const[ae,ge]of d.worktrees.entries())if(ge.path===e){const ve=t&&t.startsWith(`${e}/`)?t.slice(e.length+1):void 0;return{view:"code",project:S(d.name),...ve?{path:ve}:{},...ae>0?{wt:ge.name}:{},...n}}}return{view:"code",root:e,...t?{file:t}:{},...n}},[C,h]),oe=s.useCallback(()=>{if(!C)return;const e={view:"conversation",conversationId:C};ze({type:"navigate",route:e})||l?.(e)},[l,C]);s.useEffect(()=>{if(!C)return;const e=t=>{if(!t.defaultPrevented&&!(!t.metaKey||t.key!=="[")){if(t.target instanceof HTMLElement){const n=t.target.tagName;if(n==="INPUT"||n==="TEXTAREA"||t.target.isContentEditable)return}t.preventDefault(),oe()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[C,oe]);const H=s.useCallback((e,t)=>{X||!l||l(me(e,t))},[X,l,me]),Te=s.useCallback(e=>{U(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),y.has(e)||E(e)},[y,E]),De=s.useCallback(e=>{te(null),W(e),o&&H(o,e)},[o,H]),v=s.useMemo(()=>{if(!h||!o)return null;for(const e of h.projects)for(const t of e.worktrees)if(t.path===o)return{project:e,worktree:t};return null},[h,o]),F=s.useMemo(()=>{const e=new Map;if(!o||!v)return e;for(const t of v.worktree.status.files)e.set(`${o}/${t.path}`,t.status);return e},[o,v]),Ie=s.useMemo(()=>{const e=new Set;if(!o)return e;for(const t of F.keys()){let n=we(t);for(;n.startsWith(o)&&(e.add(n),n!==o);)n=we(n)}return e},[o,F]),q=!!(o&&a&&Oe(o,a));s.useEffect(()=>{q||ee("source")},[q]);const Be=a&&o&&a.startsWith(`${o}/`)?a.slice(o.length+1):c?.kind==="file"?c.title:a?ce(a):null,Pe=s.useCallback(async()=>{if(!c||c.kind!=="file"||!c.previewable)return;await je(c.content)&&(Z("copied"),window.setTimeout(()=>Z("idle"),1500))},[c]),[Ue,ke]=s.useState("idle"),D=s.useMemo(()=>{if(!o)return null;if(v){const e=a&&a.startsWith(`${o}/`)?a.slice(o.length+1):void 0,t=v.project.worktrees[0]?.path;return xe({project:S(v.project.name),...e?{path:e}:{},...t&&t!==o?{wt:v.worktree.name}:{},...m?.line?{line:m.line}:{},...m?.endLine?{endLine:m.endLine}:{}})}return xe({...a?{file:a}:{root:o},...m?.line?{line:m.line}:{},...m?.endLine?{endLine:m.endLine}:{}})},[o,a,v,m]),We=s.useCallback(async()=>{if(!D)return;await je(D)&&(ke("copied"),window.setTimeout(()=>ke("idle"),1500))},[D]),_e=s.useCallback(e=>{R.current=T.current,A({phase:"idle"}),te(e.line&&e.line>0?{line:e.line,...e.endLine&&e.endLine>=e.line?{endLine:e.endLine}:{}}:null),W(e.file??null),J(e.root),e.file&&$(e.root,e.file),H(e.root,e.file??null)},[$,H]);return r.jsxs("div",{className:"s-code-screen","data-embedded":X||void 0,children:[r.jsxs("div",{className:"s-code-head",children:[C?r.jsxs("button",{type:"button",className:"s-code-returnThread",onClick:oe,title:"Back to thread (⌘[)",children:[r.jsx(Ze,{size:13,strokeWidth:1.9,"aria-hidden":!0}),r.jsx("span",{children:"Back to thread"})]}):null,r.jsx(Je,{snapshot:h,root:o,onSelect:_e}),v?.worktree.diff.branchShortstat?r.jsx("span",{className:"s-code-headStat",children:v.worktree.diff.branchShortstat}):null,o?r.jsx("span",{className:"s-code-headPath",title:o,children:Qe(o)}):null,D?r.jsx("button",{type:"button",className:"s-code-copyLink",title:D,onClick:()=>{We()},children:Ue==="copied"?"Copied scout://":"Copy scout://"}):null]}),r.jsxs("div",{className:"s-code-body",children:[r.jsx("div",{className:"s-code-tree",role:"tree","aria-label":"Files",children:de?r.jsx("div",{className:"s-code-treeNote",children:de}):o?Me.map(e=>e.loading?r.jsx("div",{className:"s-code-node s-code-node--loading",style:{paddingLeft:10+e.depth*14},children:e.name},e.path):r.jsxs("button",{type:"button",role:"treeitem",className:"s-code-node","data-selected":e.path===a||void 0,"data-diff":e.kind==="file"?F.get(e.path):void 0,"aria-expanded":e.kind==="directory"?L.has(e.path):void 0,style:{paddingLeft:10+e.depth*14},onClick:()=>e.kind==="directory"?Te(e.path):De(e.path),onMouseEnter:e.kind==="file"?()=>Fe(e.path):void 0,children:[e.kind==="directory"?r.jsx(et,{size:11,strokeWidth:2,className:"s-code-nodeChevron","data-open":L.has(e.path)||void 0,"aria-hidden":!0}):r.jsx("span",{className:"s-code-nodeSpacer","aria-hidden":!0}),r.jsx("span",{className:"s-code-nodeName",children:e.name}),e.kind==="file"&&F.has(e.path)?r.jsx("span",{className:"s-code-nodeBadge","data-diff":F.get(e.path),children:it(F.get(e.path)??"")}):null,e.kind==="directory"&&Ie.has(e.path)?r.jsx("span",{className:"s-code-nodeDot","aria-label":"Contains changes"}):null]},e.path)):N.phase==="resolving"?r.jsxs("div",{className:"s-code-treeNote",children:["Resolving “",p,"”…"]}):N.phase==="failed"?r.jsx("div",{className:"s-code-treeNote",children:N.message}):r.jsx("div",{className:"s-code-treeNote",children:"No repo selected."})}),r.jsxs("div",{className:"s-code-main",children:[a?r.jsxs("div",{className:"s-code-fileHead",children:[r.jsx("span",{className:"s-code-filePath",children:Be}),q?r.jsxs("div",{className:"s-code-fileMode",role:"tablist","aria-label":"File view",children:[r.jsx("button",{type:"button",role:"tab","aria-selected":M==="source","data-selected":M==="source"||void 0,onClick:()=>ee("source"),children:"Source"}),r.jsx("button",{type:"button",role:"tab","aria-selected":M==="changes","data-selected":M==="changes"||void 0,onClick:()=>ee("changes"),children:"Changes"})]}):null,c?.kind==="file"?r.jsxs("span",{className:"s-code-fileMeta",children:[V(c.sizeBytes),c.previewable&&c.truncated?" · truncated":"",m?` · L${m.line}${m.endLine?`–${m.endLine}`:""}`:""]}):null,c?.kind==="file"&&c.previewable?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"s-code-fileAction",onClick:()=>{Pe()},title:"Copy file contents",children:[pe==="copied"?r.jsx(tt,{size:12,"aria-hidden":!0}):r.jsx(nt,{size:12,"aria-hidden":!0}),pe==="copied"?"Copied":"Copy"]}),r.jsx("a",{className:"s-code-fileAction",href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"Raw"})]}):null]}):null,M==="changes"&&q&&o&&a?r.jsx(He,{root:o,file:a},`${o}\0${a}`):Ee?r.jsxs("div",{className:"s-code-empty",children:["Loading ",a?ce(a):"file","…"]}):fe?r.jsx("div",{className:"s-code-empty",children:fe}):c&&c.kind==="file"&&c.previewable?r.jsxs(r.Fragment,{children:[c.truncated?r.jsxs("div",{className:"s-code-fileNote",children:["Showing the first ",V(256*1024)," of ",V(c.sizeBytes)," ·"," ",r.jsx("a",{href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"open raw"})]}):null,r.jsx(Ye,{code:c.content,path:c.path,focusLine:m?.line,endLine:m?.endLine})]}):c&&c.kind==="file"?r.jsxs("div",{className:"s-code-empty",children:[c.previewReason," · ",V(c.sizeBytes)," ·"," ",r.jsx("a",{href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"open raw"})]}):N.phase==="resolving"?r.jsxs("div",{className:"s-code-empty",children:["Opening ",b??`“${p}”`,"…"]}):N.phase==="failed"?r.jsx("div",{className:"s-code-empty",children:N.message}):r.jsx("div",{className:"s-code-empty",children:"Pick a file to read."})]})]})]})}const Et=Ke({id:"code",label:"Code Browser",route:{view:"code"},webPath:"/code",screen:"CodeContent",embed:{path:"/embed/code",profile:"macos.code",rootClassName:"s-code-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},hosts:{macos:!0},resolveEmbedProps:i=>({root:i.get("root")?.trim()||void 0,file:i.get("file")?.trim()||void 0,project:i.get("project")?.trim()||void 0,path:i.get("path")?.trim()||void 0,wt:i.get("wt")?.trim()||void 0,line:Se(i.get("line")),endLine:Se(i.get("endLine")),returnConversationId:i.get("fromConversation")?.trim()||void 0})}});function Se(i){if(!i)return;const l=Number.parseInt(i,10);return Number.isSafeInteger(l)&&l>0?l:void 0}export{Rt as CodeContent,Et as scoutSurface};
@@ -0,0 +1 @@
1
+ import{r as h,j as e}from"./index-CZ-05hKz.js";import{A as G}from"./AgentAvatar-CYhf6twS.js";import{M as J}from"./text-CnZ0e1-V.js";import{j as Y,k as ee,l as O,m as se,M as _}from"./NewChatComposer-hlWT-nbR.js";import{F as te}from"./file-text-KijGBnME.js";import"./index-BVlMw8x_.js";import{c as I}from"./createLucideIcon-DXpqZP7I.js";import{Z as ae}from"./zap-nMcjPoWB.js";import{X as ne}from"./x-e3h2hDsp.js";const re=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],oe=I("pencil",re);const ce=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]],ie=I("reply",ce),U="Only markdown, code, images, and video clips can be attached.";function we(){const[t,c]=h.useState([]),[g,x]=h.useState(null),[d,p]=h.useState(null),[i,j]=h.useState(0),n=h.useRef(null),f=h.useCallback((r,l="Attached")=>{const m=r.filter(Y);return m.length===0?(r.length>0&&p(U),0):(p(null),c(v=>{const F=new Set(v.map(u=>`${u.name}:${u.size}:${u.lastModified}`)),R=m.filter(u=>!F.has(`${u.name}:${u.size}:${u.lastModified}`));return R.length>0?[...v,...R]:v}),x(m.length===1?`${l} ${m[0]?.name??"1 attachment"}.`:`${l} ${m.length} attachments.`),m.length)},[]),b=h.useCallback(r=>{c(l=>l.filter(m=>m!==r)),x(null)},[]),$=h.useCallback(()=>{c([]),x(null),p(null),j(0)},[]),y=h.useCallback(()=>{n.current?.click()},[]),E=h.useCallback(r=>{const l=ee(r.clipboardData);l.length!==0&&(r.preventDefault(),f(l,"Pasted"))},[f]),k=h.useMemo(()=>({onDragOver:r=>{O(r.dataTransfer)&&(r.preventDefault(),j(l=>l===0?1:l))},onDragLeave:r=>{r.currentTarget.contains(r.relatedTarget)||j(0)},onDrop:r=>{if(!O(r.dataTransfer))return;r.preventDefault(),j(0);const l=se(r.dataTransfer);if(l.length===0){p(U);return}f(l,"Dropped")}}),[f]);return{files:t,hasFiles:t.length>0,feedback:g,error:d,dragActive:i>0,stage:f,remove:b,clear:$,setError:p,openPicker:y,dropHandlers:k,onPaste:E,inputRef:n}}function le(t){if(t<1024)return`${t} B`;const c=t/1024;return c<1024?`${c.toFixed(0)} KB`:`${(c/1024).toFixed(1)} MB`}function de(t){return(t.split(".").pop()?.toUpperCase()??"FILE").slice(0,4)}function me({file:t,onRemove:c}){const g=h.useMemo(()=>URL.createObjectURL(t),[t]);h.useEffect(()=>()=>URL.revokeObjectURL(g),[g]);const x=t.type.startsWith("video/"),d=t.type.startsWith("image/"),p=de(t.name),i=le(t.size);return e.jsxs("div",{className:"s-msg-compose-attachment surface-card surface-card--inset",children:[x?e.jsx("video",{src:g,muted:!0,playsInline:!0}):d?e.jsx("img",{src:g,alt:t.name}):e.jsxs("div",{className:"s-msg-compose-attachment-file",title:`${t.name} (${i})`,children:[e.jsxs("div",{className:"s-msg-compose-attachment-file-icon",children:[e.jsx(te,{size:16,"aria-hidden":"true"}),e.jsx("span",{className:"s-msg-compose-attachment-ext label-xs",children:p})]}),e.jsx("span",{className:"s-msg-compose-attachment-name",children:t.name}),e.jsx("span",{className:"s-msg-compose-attachment-size label-xs text-dim",children:i})]}),e.jsx("button",{type:"button",className:"s-msg-compose-attachment-remove btn btn--ghost btn--icon","aria-label":`Remove ${t.name}`,title:`Remove ${t.name}`,onClick:c,children:"×"})]})}function ue({attachments:t,accept:c="image/*,video/*,text/markdown,.md,.markdown,text/plain,.txt"}){const{files:g,feedback:x,error:d,remove:p,stage:i,inputRef:j}=t;return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:j,type:"file",multiple:!0,accept:c,className:"s-msg-compose-file-input",onChange:n=>{i([...n.target.files??[]]),n.target.value=""}}),g.length>0?e.jsx("div",{className:"s-msg-compose-attachments","aria-label":"Staged attachments",children:g.map(n=>e.jsx(me,{file:n,onRemove:()=>p(n)},`${n.name}:${n.size}:${n.lastModified}`))}):null,d?e.jsx("div",{className:"s-msg-compose-attach-note","data-tone":"error",role:"alert",children:d}):x?e.jsx("div",{className:"s-msg-compose-attach-note","data-tone":"muted",role:"status",children:x}):null]})}function pe({composeRef:t,draft:c,setDraft:g,composePlaceholder:x,slashState:d,setSlashState:p,filteredSlashCommands:i,applySlashCommand:j,mentionState:n,setMentionState:f,filteredMentions:b,applyMention:$,updateTriggersFromDraft:y,closeSuggestions:E,replyTarget:k,onCancelReply:r,isStopMode:l,sending:m,composeAction:v,onSend:F,onInterrupt:R,attachments:u,isAgentBusy:H,busyIntent:D,onBusyIntentChange:L,queued:N,queueNote:K,onEditQueued:B,editingQueuedId:w,editingAttachmentCount:A,onCancelEdit:W,onUnqueue:S,onSendQueuedNow:Q}){const Z=e.jsxs(e.Fragment,{children:[d.open?e.jsx(_,{label:"Slash commands",items:i.map(s=>({id:s.command,token:s.label,description:s.description})),activeIndex:d.index,onPick:s=>{const a=i[s];a&&j(a)},onActiveIndexChange:s=>p(a=>({...a,index:s}))}):null,n.open?e.jsx(_,{label:"Mention agent",items:b.map(s=>({id:s.id,token:`@${s.handle}`,description:s.name,avatarNode:e.jsx(G,{name:s.name,size:20,tile:!0,presence:!1})})),activeIndex:n.index,onPick:s=>{const a=b[s];a&&$(a)},onActiveIndexChange:s=>f(a=>({...a,index:s}))}):null]}),V=c.trim().length>0,q=w!==null,P=V||u.hasFiles||A>0,z=H&&P,C=z&&D==="steer",T=q?N.findIndex(s=>s.id===w)+1:0,M=z?e.jsxs("div",{className:"s-msg-compose-mode",role:"group","aria-label":"What Send does while this turn is running",children:[e.jsx("button",{type:"button",className:"s-msg-compose-mode-btn","data-mode":"queue","aria-pressed":D==="queue",title:"Hold this draft until the running turn lands",disabled:m,onClick:()=>L("queue"),children:"Queue"}),e.jsx("button",{type:"button",className:"s-msg-compose-mode-btn","data-mode":"steer","aria-pressed":D==="steer",title:"Interrupt the running turn and deliver this now",disabled:m,onClick:()=>L("steer"),children:"Steer"})]}):null,X=N.length>0||M?e.jsxs("div",{className:"s-msg-compose-queue",role:"group","aria-label":"Queued messages",children:[e.jsxs("div",{className:"s-msg-compose-queue-head",children:[e.jsx("span",{className:"s-msg-compose-queue-kicker",children:N.length>0?`Queue · ${N.length}`:"Queues next"}),e.jsx("span",{className:"s-msg-compose-queue-hint",children:q?C?`Rewriting ${T} — send interrupts this turn`:`Rewriting ${T} — send returns it to its place`:N.length>0?C?"Send interrupts this turn":K??"":C?"Interrupts this turn on send":"Sends when this turn lands"}),M]}),N.map((s,a)=>e.jsxs("div",{className:"s-msg-compose-queue-row","data-editing":s.id===w?"true":void 0,children:[e.jsx("span",{className:"s-msg-compose-queue-index",children:a+1}),e.jsx("span",{className:"s-msg-compose-queue-body",children:s.body.trim()||"Attachments only"}),s.attachments.length>0?e.jsxs("span",{className:"s-msg-compose-queue-clip",children:[s.attachments.length," file",s.attachments.length===1?"":"s"]}):null,s.id===w?e.jsx("button",{type:"button",className:"s-msg-compose-queue-edit btn btn--sm btn--ghost",title:"Stop rewriting — leave this row as it was","aria-label":`Cancel rewriting queued message ${a+1}`,onClick:W,children:"Cancel edit"}):e.jsxs("button",{type:"button",className:"s-msg-compose-queue-edit btn btn--sm btn--ghost",title:"Pull this back into the input box to rewrite it","aria-label":`Edit queued message ${a+1}`,disabled:m||q,onClick:()=>B(s.id),children:[e.jsx(oe,{size:11,"aria-hidden":"true"}),e.jsx("span",{children:"Edit"})]}),e.jsxs("button",{type:"button",className:"s-msg-compose-queue-now btn btn--sm btn--accent",title:"Interrupt this turn and send this now","aria-label":`Send queued message ${a+1} now`,disabled:m||s.id===w,onClick:()=>Q(s.id),children:[e.jsx(ae,{size:11,"aria-hidden":"true"}),e.jsx("span",{children:"Send now"})]}),e.jsx("button",{type:"button",className:"s-msg-compose-queue-drop btn btn--ghost btn--icon",title:"Cancel — drop this from the queue","aria-label":`Cancel queued message ${a+1}`,onClick:()=>S(s.id),children:"×"})]},s.id))]}):null;return e.jsx(J,{density:"thread",value:c,onChange:(s,a)=>{g(s),y(s,a?.caret??s.length)},onSend:F,placeholder:x,sending:m,stopMode:l,onStop:R,canSend:P,sendTitle:C?"Steer — interrupt this turn and send now (Cmd+Enter)":z?"Queue for the next turn (Cmd+Enter)":"Send (Cmd+Enter)",sendAriaLabel:C?"Steer — interrupt this turn and send now (Cmd+Enter)":z?"Queue message for the next turn (Cmd+Enter)":v==="steer"?"Send follow-up (Cmd+Enter)":"Send message (Cmd+Enter)",showAttach:!0,onAttach:u.openPicker,onPaste:u.onPaste,dropHandlers:u.dropHandlers,dragActive:u.dragActive,textareaRef:t,overlay:Z,above:X,aboveAttached:!0,header:e.jsxs(e.Fragment,{children:[k?e.jsxs("div",{className:"s-thread-compose-reply surface-card surface-card--inset",role:"status",children:[e.jsx(ie,{className:"s-thread-compose-reply-icon text-muted",size:13,strokeWidth:1.8,"aria-hidden":"true"}),e.jsx("span",{className:"s-thread-compose-reply-label label-xs text-muted",children:"Replying to"}),e.jsx("span",{className:"s-thread-compose-reply-actor chip chip--sm chip--mono chip--neutral",children:k.actorLabel}),e.jsx("span",{className:"s-thread-compose-reply-preview text-muted",title:k.preview,children:k.preview}),e.jsx("button",{type:"button",className:"s-thread-compose-reply-cancel btn btn--ghost btn--icon","aria-label":"Cancel reply",title:"Cancel reply",onClick:r,children:e.jsx(ne,{size:13,strokeWidth:1.8,"aria-hidden":"true"})})]}):null,q&&A>0?e.jsxs("div",{className:"s-msg-compose-carried",role:"status",children:[A," file",A===1?"":"s"," stay attached to this draft"]}):null,e.jsx(ue,{attachments:u})]}),tools:e.jsxs("span",{className:"s-thread-compose-hint s-msg-compose-tools-hint",children:[e.jsx("kbd",{className:"s-kbd",children:"/"})," commands"," · ",e.jsx("kbd",{className:"s-kbd",children:"@"})," agents"]}),onSelect:s=>{const a=s.currentTarget;y(a.value,a.selectionStart)},onBlur:()=>{setTimeout(E,120)},onKeyDown:s=>{if(!(d.open&&i.length>0||n.open&&b.length>0))return!1;if(s.key==="ArrowDown")return d.open?p(o=>({...o,index:(o.index+1)%i.length})):n.open&&f(o=>({...o,index:(o.index+1)%b.length})),!0;if(s.key==="ArrowUp")return d.open?p(o=>({...o,index:(o.index-1+i.length)%i.length})):n.open&&f(o=>({...o,index:(o.index-1+b.length)%b.length})),!0;if(s.key==="Escape")return E(),!0;if((s.key==="Enter"||s.key==="Tab")&&!s.shiftKey&&!s.metaKey&&!s.ctrlKey&&!s.altKey){if(d.open){const o=i[d.index]??i[0];o&&j(o)}else if(n.open){const o=b[n.index]??b[0];o&&$(o)}return!0}return!1}})}const Ce=Object.freeze(Object.defineProperty({__proto__:null,ConversationComposer:pe},Symbol.toStringTag,{value:"Module"}));export{pe as C,Ce as a,we as u};
@@ -0,0 +1 @@
1
+ import{j as t}from"./index-CZ-05hKz.js";import{M as p}from"./message-markup-RkfmDfME.js";import{f as d}from"./conversation-model-CwF6Y9gx.js";import{t as n}from"./time-Dhsh_2EG.js";import"./mentions-CcPFMbmZ.js";import"./colors-BtO5_zlx.js";import"./index-BVlMw8x_.js";import"./api-Co9aQ2Jw.js";import"./perf-PX8Rx0EP.js";import"./Provider-B2xuo3rf.js";import"./router-DJj2WbDg.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-BQ6t92tJ.js";import"./sse-CiOSzE5n.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BJIamJOH.js";import"./DocumentFocusViewer-DZVhS7as.js";import"./createLucideIcon-DXpqZP7I.js";import"./TextDocumentSurface-CKQP-cBT.js";import"./file-text-KijGBnME.js";import"./x-e3h2hDsp.js";import"./chevron-right-CzH-TaSF.js";import"./code-xml-Jtxsp5d1.js";import"./arrow-left-CghA0kTw.js";import"./arrow-right-iJFv3jNh.js";import"./scout-voice-BhPzrc6P.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-DFhAJkW3.js";import"./NewChatComposer-hlWT-nbR.js";import"./text-CnZ0e1-V.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-BiohlpM3.js";import"./HarnessMark-D5CA5uSp.js";import"./NewChatOrigin-DdpzE4kz.js";import"./chevron-down-Mp9mu_yd.js";import"./search-D1tJSAWe.js";import"./chunk-HRAB3GC3-swV8PA2k.js";import"./AgentDetailCard-UqPNpcvB.js";import"./AgentLiveActions-BwuzOE8h.js";import"./terminal-takeover-DANQfTcy.js";import"./openContent-C6XO6kr5.js";import"./eye-CpfyvdLq.js";import"./terminal-yN9xN-h9.js";function l({at:a}){const i=d(a);return t.jsxs("div",{className:"s-thread-day-divider","aria-label":i,children:[t.jsx("span",{className:"s-thread-day-line","aria-hidden":"true"}),t.jsx("span",{className:"s-thread-day-label",children:i}),t.jsx("span",{className:"s-thread-day-line","aria-hidden":"true"})]})}function it({row:a,expanded:i,showDayDivider:e,onToggle:s}){const m=`${a.recipients.length} recipients`;return t.jsxs("div",{className:["s-thread-feed-block","s-thread-fanout",e&&"s-thread-feed-block--full-width"].filter(Boolean).join(" "),children:[e&&t.jsx(l,{at:a.createdAt}),a.messages.map(r=>t.jsx("span",{id:`msg-${r.id}`,className:"s-thread-fanout-anchor","aria-hidden":"true"},r.id)),t.jsxs("button",{type:"button",className:"s-thread-fanout-summary","aria-expanded":i,onClick:s,title:a.recipients.join(", "),children:[t.jsx("span",{className:"s-thread-fanout-caret","aria-hidden":"true",children:i?"▾":"▸"}),t.jsx("span",{className:"s-thread-fanout-label",children:m}),t.jsx("span",{className:"s-thread-fanout-time",children:n(a.createdAt)})]}),i&&t.jsxs("div",{className:"s-thread-fanout-detail",children:[t.jsx("ul",{className:"s-thread-fanout-recipients",children:a.messages.map((r,o)=>t.jsx("li",{className:"s-thread-fanout-recipient",children:a.recipients[o]},r.id))}),t.jsx("div",{className:"s-thread-fanout-body",children:t.jsx(p,{text:a.messages[0].body})})]})]})}export{it as FanOutRow,l as ThreadDayDivider};
@@ -0,0 +1 @@
1
+ import{r as k,j as e,H as G}from"./index-CZ-05hKz.js";import{c as A}from"./clipboard-e3fSpeo7.js";import{b as K}from"./router-DJj2WbDg.js";import{A as M}from"./AgentAvatar-CYhf6twS.js";import{H as J}from"./HarnessMark-D5CA5uSp.js";import{a as Q}from"./Provider-B2xuo3rf.js";import{n as Z,c as ee}from"./colors-BtO5_zlx.js";import{B as te}from"./BackToPicker-4JaeRvDm.js";import{o as P}from"./openContent-C6XO6kr5.js";import{AstronautSuit as se}from"./AstronautSuit-Ckx7lu7G.js";import{v as ne,w as ae}from"./conversation-model-CwF6Y9gx.js";import{E as re}from"./eye-CpfyvdLq.js";import{c as oe}from"./createLucideIcon-DXpqZP7I.js";import"./perf-PX8Rx0EP.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-BQ6t92tJ.js";import"./api-Co9aQ2Jw.js";import"./SpriteAvatar-Bs68ZENy.js";import"./CrewAvatar-CTIuxp4G.js";import"./sse-CiOSzE5n.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BJIamJOH.js";import"./DocumentFocusViewer-DZVhS7as.js";import"./TextDocumentSurface-CKQP-cBT.js";import"./file-text-KijGBnME.js";import"./x-e3h2hDsp.js";import"./chevron-right-CzH-TaSF.js";import"./code-xml-Jtxsp5d1.js";import"./arrow-left-CghA0kTw.js";import"./arrow-right-iJFv3jNh.js";import"./scout-voice-BhPzrc6P.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-DFhAJkW3.js";import"./NewChatComposer-hlWT-nbR.js";import"./text-CnZ0e1-V.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-BiohlpM3.js";import"./index-BVlMw8x_.js";import"./NewChatOrigin-DdpzE4kz.js";import"./chevron-down-Mp9mu_yd.js";import"./search-D1tJSAWe.js";import"./chunk-HRAB3GC3-swV8PA2k.js";import"./time-Dhsh_2EG.js";const ie=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],le=oe("user-plus",ie),X=150,_=320,ce=1.4,de=1.1,V=5,me=22,W=5200,he=1,pe=1200;function ue(n){k.useEffect(()=>{const s=n.current;if(!s||window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;let i=[],r=[],x=-9999,m=-9999,u=0;const c=()=>{i=[],r=[],s.querySelectorAll(".sprite-cell--eye circle").forEach(o=>{const a=o.getBoundingClientRect();if(!a.width)return;const h=o.closest("[data-state]");i.push({el:o,cx:a.left+a.width/2,cy:a.top+a.height/2,working:h?.dataset.state==="in_flight"})}),s.querySelectorAll(".s-thread-participant-avatar svg").forEach(o=>{const a=o.getBoundingClientRect();a.width&&r.push({el:o,cx:a.left+a.width/2,cy:a.top+a.height/2})})},y=o=>o<X?1:o>_?0:(_-o)/(_-X),f=o=>{for(const a of i){const h=x-a.cx,N=m-a.cy,b=Math.hypot(h,N),p=y(b),v=b<1?1:b;let j=h/v*ce*p;const w=N/v*de*p;if(a.working&&p<1){const S=o%W/W;j+=Math.sin(S*Math.PI*2)*he*(1-p)}a.el.style.transform=`translate(${j.toFixed(2)}px, ${w.toFixed(2)}px)`}for(const a of r){const h=x-a.cx,N=Math.hypot(h,m-a.cy),b=y(N),p=Math.max(-V,Math.min(V,h/me))*b;a.el.style.transform=p===0?"":`rotate(${p.toFixed(2)}deg)`}u=requestAnimationFrame(f)},d=o=>{x=o.clientX,m=o.clientY};c();const L=window.setInterval(c,pe);return u=requestAnimationFrame(f),window.addEventListener("resize",c),document.addEventListener("pointermove",d,{passive:!0}),()=>{cancelAnimationFrame(u),window.clearInterval(L),window.removeEventListener("resize",c),document.removeEventListener("pointermove",d);for(const o of i)o.el.style.transform="";for(const o of r)o.el.style.transform=""}},[n])}function E(n,s,i){const r=i?G[i.trim().toLowerCase()]:void 0;return{"--fp-z":String(n-s),"--fp-i":String(s),...r==null?{}:{"--fp-suit-hue":String(r)}}}function xe(n){if(n<1e3)return String(n);const s=n/1e3;return s<10?`${s.toFixed(1).replace(/\.0$/,"")}k`:`${Math.round(s)}k`}function O({name:n,runtime:s,state:i,action:r}){return e.jsxs("span",{className:"s-thread-participant-card","aria-hidden":"true",children:[e.jsx("strong",{children:n}),s?e.jsx("span",{children:s}):null,e.jsx("span",{children:i}),r?e.jsx("span",{className:"s-thread-participant-card-action",children:r}):null]})}function R({count:n,className:s,style:i,rosterId:r,expanded:x,onClick:m}){const u=`${n} more participant${n===1?"":"s"}`;return e.jsx("button",{type:"button",className:`s-thread-participant s-thread-participant--button ${s}`,style:i,"aria-label":`${u}; open participant list`,"aria-haspopup":"dialog","aria-controls":r,"aria-expanded":x,onClick:m,children:e.jsxs("span",{className:"s-thread-participant-face s-thread-participant-face--overflow",children:["+",xe(n)]})})}function ot({showBackNav:n,isDm:s,navigate:i,route:r,canonicalConversationId:x,threadTitle:m,agentId:u,sessionId:c,detailRoute:y,participants:f,operator:d,canAddParticipants:L,onToggleAddParticipant:o}){const a=Q(),h=K(r),N=k.useRef(null),b=k.useRef(null),p=k.useId(),[v,j]=k.useState(!1);ue(N);const w=f.slice(0,4),S=Math.max(f.length-w.length,0),z=Math.max(f.length-2,0),B=Math.max(f.length-1,0),C=w.length+(S>0?1:0)+(d.active?1:0);k.useEffect(()=>{if(!v)return;const t=g=>{b.current?.contains(g.target)||j(!1)},l=g=>{g.key==="Escape"&&j(!1)};return document.addEventListener("mousedown",t),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("keydown",l)}},[v]);const $=t=>t.agent?{view:"agents-v2",agentId:t.agent.id,...h?{machineId:h}:{}}:t.sessionId?{view:"sessions",sessionId:t.sessionId,...h?{machineId:h}:{}}:null,H=t=>{const l=$(t);l&&(j(!1),P(i,l,{returnTo:r}))};return e.jsxs("div",{className:"s-thread-center-header",onClick:t=>{t.target?.closest("button,a,input,select,textarea")||!s||!y||P(i,y,{returnTo:r})},style:s&&y?{cursor:"pointer"}:void 0,onContextMenu:t=>{const l=[{kind:"action",label:"Copy Title",onSelect:()=>{A(m)}}];u&&l.push({kind:"action",label:"Copy Agent ID",onSelect:()=>{A(u)}}),!u&&c&&l.push({kind:"action",label:"Copy Session ID",onSelect:()=>{A(c)}}),l.push({kind:"action",label:"Copy Conversation ID",onSelect:()=>{A(x)}}),a(t,l)},children:[n&&e.jsx(te,{slot:"conversation",fallback:{view:"inbox"},navigate:i,label:"Back",className:"s-thread-header-back"}),e.jsx("div",{className:"s-thread-center-header-info",children:s&&y?e.jsx("button",{type:"button",className:"s-thread-center-header-name",title:`Open ${m} details`,onClick:()=>P(i,y,{returnTo:r}),children:m}):e.jsx("span",{className:"s-thread-center-header-name",children:m})}),e.jsxs("div",{className:"s-thread-center-header-right",children:[f.length>0&&e.jsxs("div",{className:"s-thread-participants",ref:t=>{N.current=t,b.current=t},"aria-label":"Conversation participants",children:[w.map((t,l)=>{const g=[t.harness,t.model,t.reasoningEffort].filter(Boolean).join(" · ")||null,I=t.agent?Z(t.agent.state??null,t.agent):null,U=t.agent?ee(t.agent.state??null,t.agent):"Session participant",q=$(t),T=q?t.agent?"Open profile":"Open session":null,Y=[t.name,g,U,T].filter(Boolean).join(", "),D=e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"s-thread-participant-face",children:[e.jsx(se,{}),e.jsx(M,{agent:t.agent??void 0,name:t.name,placement:"turn",size:28,className:"s-thread-participant-avatar"})]}),t.harness?e.jsx(J,{harness:t.harness,size:9,className:"s-thread-participant-harness",title:null}):null,e.jsx(O,{name:t.name,runtime:g,state:U,action:T})]}),F={className:"s-thread-participant",style:E(C,l,t.harness),"data-state":I??void 0,"data-compact-hidden":l>=2?"true":void 0,"data-narrow-hidden":l>=1?"true":void 0,"aria-label":Y};return q?e.jsx("button",{type:"button",...F,className:`${F.className} s-thread-participant--button`,onClick:()=>H(t),children:D},t.id):e.jsx("span",{...F,role:"group",tabIndex:0,children:D},t.id)}),S>0?e.jsx(R,{count:S,className:"s-thread-participant--desktop-overflow",style:E(C,w.length),rosterId:p,expanded:v,onClick:()=>j(t=>!t)}):null,z>0?e.jsx(R,{count:z,className:"s-thread-participant--compact-overflow",style:E(C,2),rosterId:p,expanded:v,onClick:()=>j(t=>!t)}):null,B>0?e.jsx(R,{count:B,className:"s-thread-participant--narrow-overflow",style:E(C,1),rosterId:p,expanded:v,onClick:()=>j(t=>!t)}):null,d.active?e.jsxs("span",{className:"s-thread-participant s-thread-participant--operator",style:E(C,C-1),role:"group",tabIndex:0,"aria-label":`${d.name}, you, in this conversation`,children:[e.jsx("span",{className:"s-thread-participant-face",children:e.jsx(M,{name:d.name,placement:"turn",size:28,className:"s-thread-participant-avatar"})}),e.jsx(O,{name:`${d.name} (you)`,runtime:null,state:"In this conversation",action:null})]}):e.jsxs("span",{className:"s-thread-participant-observer",role:"group",tabIndex:0,"aria-label":`${d.name}, observing, not in this conversation`,children:[e.jsx(re,{size:15,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx(O,{name:d.name,runtime:null,state:"Observing, not in this conversation",action:null})]}),v?e.jsxs("div",{id:p,className:"s-thread-participant-roster",role:"dialog","aria-label":"Conversation participants",onClick:t=>t.stopPropagation(),children:[e.jsx("strong",{className:"s-thread-participant-roster-title",children:"Participants"}),e.jsxs("div",{className:"s-thread-participant-roster-list",children:[f.map(t=>{const l=$(t),g=[t.harness,t.model].filter(Boolean).join(" · "),I=e.jsxs(e.Fragment,{children:[e.jsx(M,{agent:t.agent??void 0,name:t.name,placement:"turn",size:24,className:"s-thread-participant-roster-avatar"}),e.jsxs("span",{children:[e.jsx("strong",{children:t.name}),g?e.jsx("small",{children:g}):null]})]});return l?e.jsx("button",{type:"button",className:"s-thread-participant-roster-row",onClick:()=>H(t),children:I},t.id):e.jsx("div",{className:"s-thread-participant-roster-row",children:I},t.id)}),d.active?e.jsxs("div",{className:"s-thread-participant-roster-row",children:[e.jsx(M,{name:d.name,placement:"turn",size:24,className:"s-thread-participant-roster-avatar"}),e.jsxs("span",{children:[e.jsxs("strong",{children:[d.name," (you)"]}),e.jsx("small",{children:"Operator"})]})]}):null]})]}):null]}),L&&e.jsx("button",{type:"button",className:"s-thread-add-participant-trigger",onClick:o,title:"Add participant","aria-label":"Add participant",children:e.jsx(le,{size:14,strokeWidth:1.9,"aria-hidden":"true"})})]})]})}function it({canonicalConversationId:n,conversationAlias:s}){return e.jsxs("div",{className:"s-thread-identity-row",children:[e.jsxs("button",{type:"button",className:"s-thread-identity-chip",title:n,onClick:()=>{A(n)},children:[e.jsx("span",{children:ne()}),e.jsx("strong",{children:ae(n)})]}),s&&e.jsxs("span",{className:"s-thread-identity-chip",title:s,children:[e.jsx("span",{children:"Alias"}),e.jsx("strong",{children:s})]})]})}function lt({agents:n,addParticipantId:s,setAddParticipantId:i,addingParticipant:r,addParticipantError:x,onCancel:m,onSubmit:u}){return e.jsxs("form",{className:"s-thread-add-participant",onSubmit:c=>{c.preventDefault(),u()},children:[e.jsxs("div",{className:"s-thread-add-participant-row",children:[e.jsxs("div",{className:"s-thread-add-participant-field",children:[e.jsx("label",{className:"s-thread-add-participant-label",htmlFor:"thread-add-participant-select",children:"Agent"}),e.jsx("select",{id:"thread-add-participant-select",className:"s-thread-add-participant-select",value:s,onChange:c=>i(c.target.value),autoFocus:!0,children:n.map(c=>e.jsx("option",{value:c.id,children:c.name},c.id))})]}),e.jsxs("div",{className:"s-thread-add-participant-actions",children:[e.jsx("button",{type:"button",className:"s-btn s-btn-sm",onClick:m,disabled:r,children:"Cancel"}),e.jsx("button",{type:"submit",className:"s-btn s-btn-primary s-btn-sm",disabled:r||s.trim().length===0,children:r?"Adding...":"Add"})]})]}),x&&e.jsx("div",{className:"s-thread-add-participant-error",children:x})]})}export{lt as AddParticipantForm,ot as ConversationHeader,it as ConversationIdentityRow};
@@ -0,0 +1,6 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/conversation-motion-features-BKkCRaWR.js","assets/gestures-Bq9XnSqY.js","assets/index-CZ-05hKz.js","assets/index-i7TMxlwW.css","assets/use-reduced-motion-CKkhq9c5.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,r as g,_ as z}from"./index-CZ-05hKz.js";import{n as W,t as B,o as O,r as D,p as U,m as F,c as K,q as H,s as q}from"./conversation-model-CwF6Y9gx.js";import{n as G,d as L,f as V,s as J}from"./colors-BtO5_zlx.js";import{i as C}from"./sessionRead-CvFz2RHv.js";import{n as Q,t as w,f as b}from"./time-Dhsh_2EG.js";import{u as X}from"./Provider-B2xuo3rf.js";import{o as E}from"./openContent-C6XO6kr5.js";import{g as Y,c as Z,b as ee,e as te,f as se}from"./tail-display-DcliDVkW.js";import{u as ae}from"./use-reduced-motion-CKkhq9c5.js";import{L as ie,m as f}from"./proxy-DnLpZIi9.js";import{C as ne}from"./chevron-down-Mp9mu_yd.js";import{C as re}from"./chevron-right-CzH-TaSF.js";import{A as oe}from"./activity-Bj3Hnbj3.js";import{T as ce}from"./terminal-yN9xN-h9.js";import{M as le}from"./message-circle-B2ddzBrX.js";const M=60,de={planning:"Planning",inspection:"Inspection",mutation:"Mutations",execution:"Execution",verification:"Verification",coordination:"Coordination"};function N(s){if(s.kind==="think")return"planning";const t=s.tool?.toLowerCase()??"",o=s.arg?.toLowerCase()??"",r=s.text?.toLowerCase()??"",i=s.outcome?.toLowerCase()??"";return t.includes("test")||t.includes("check")||t.includes("lint")||t.includes("typecheck")||t.includes("verify")||/\b(?:bun|npm|pnpm|yarn|cargo|pytest|go|vitest|jest|playwright|cypress)\s+(?:test|run\s+(?:check|test|lint)|check|typecheck)/i.test(o)||/\b(?:\d+\s+pass|all tests passed|test passed|lint clean|tsc clean)\b/i.test(i)?"verification":t==="write"||t==="edit"||t==="strreplace"||t==="str_replace"||t==="delete"||t==="write_file"||t==="edit_file"||t==="patch"||t==="apply_patch"||t==="todowrite"||t==="todo_write"||/\b(?:git\s+apply|git\s+commit|git\s+add|rm\s+|mkdir\s+|touch\s+|sed\s+|awk\s+)/i.test(o)||/^\+\d+\s+[−-]\d+/u.test(i)?"mutation":t==="read"||t==="glob"||t==="grep"||t==="filesearch"||t==="file_search"||t==="list_dir"||t==="list_directory"||t==="view"||t==="fetch"||t==="webfetch"||t==="websearch"||t==="scout_search"||t==="search"||/\b(?:grep|find|rg|cat|head|tail|ls|git\s+status|git\s+diff|git\s+log|git\s+branch)/i.test(o)?"inspection":s.kind==="note"||/\b(?:planning|plan|evaluating|analyzing|reasoning|strategy)\b/i.test(r)?"planning":s.kind==="tool"||t==="bash"||t==="shell"||t==="terminal"||t==="exec"||t==="run"||t==="command"||t==="task"?"execution":"coordination"}function y(s){const t=s.outcome?.toLowerCase()??"";return t.includes("error")||t.includes("fail")||t.includes("exit 1")||t.includes("rejected")||t.includes("timed out")?"error":t.includes("warn")||t.includes("skipped")?"warning":s.outcome||!s.isLatest?"success":s.isActive?"working":"success"}function he(s){if(s<1e3)return`${Math.round(s)}ms`;const t=s/1e3;if(t<60)return`${t.toFixed(1).replace(/\.0$/,"")}s`;const o=Math.floor(t/60),r=Math.round(t%60);return`${o}m ${r}s`}function me(s){if(s.length===0)return[];const t=new Map;for(const c of s)t.set(c.phase,(t.get(c.phase)??0)+(c.repeatCount||1));const r=s.at(-1)?.phase??"planning";return["planning","inspection","mutation","execution","verification","coordination"].filter(c=>(t.get(c)??0)>0).map(c=>({phase:c,label:de[c],count:t.get(c)??0,active:c===r}))}function j(s,t,o){const r=o?.trim();if(!r)return;const i=r.toLowerCase();t.has(i)||(t.add(i),s.push(r))}function De(s){const t=[],o=new Set;j(t,o,s.observeSessionId);for(const r of s.flight?.sessions??[])j(t,o,r.sessionId);return j(t,o,s.agent?.harnessSessionId),j(t,o,s.sessionMeta?.harnessSessionId),t}function Ue(s,t){const o=s.sessionId?.trim().toLowerCase();return o?t.some(r=>{const i=r.trim().toLowerCase();return i?o.includes(i)||i.includes(o):!1}):!1}function A(s,t){return s.ts!==t.ts?s.ts-t.ts:s.id.localeCompare(t.id)}function Fe(s,t){const o=new Map;for(const r of[...s,...t])o.set(r.id,r);return[...o.values()].sort(A).slice(-M)}function Ke(s){const t=Y(s).sort(A),o=Z(t.map(i=>({event:i,meta:ee(i)}))),r=[];for(const i of o){if(i.event.kind==="other")continue;if(i.event.kind==="tool-result"){const m=r.at(-1);m?.kind==="tool"&&(m.outcome=i.meta.result?.outcome??m.outcome??"done",m.ts=i.event.ts,m.status=y({outcome:m.outcome}),m.phase=N({kind:m.kind,tool:m.tool,arg:m.arg,text:m.text,outcome:m.outcome}));continue}const c=ue(i.event),l=pe(i.event,te(i.event,i.meta),c);if(!l&&c!=="think")continue;const d=i.meta.tool,n=i.meta.arg?v(i.meta.arg):void 0,h=i.meta.result?.outcome,a=N({kind:c,tool:d,arg:n,text:l,outcome:h}),p=y({outcome:h}),u={id:i.event.id,ts:i.event.ts,kind:c,text:l,repeatCount:i.repeatCount,phase:a,status:p};d&&(u.tool=d),n&&(u.arg=n),h&&(u.outcome=h),r.push(u)}for(let i=0;i<r.length-1;i++){const c=r[i],l=r[i+1];c&&l&&l.ts>=c.ts&&(c.durationMs=l.ts-c.ts)}return r}const $=160;function v(s){const t=s.replace(/\s+/gu," ").trim();return t.length>$?`${t.slice(0,$-1)}…`:t}const I=/^\[thinking\]\s*$/iu;function ue(s){return I.test(s.summary.trim())?"think":se(s)}function pe(s,t,o){return o==="think"&&I.test(s.summary.trim())?"":v(t)}const xe=15e3;function ge(s){const t=s?.outcome;return typeof t=="string"&&t.trim()?t.trim():void 0}function He(s){const{observe:t,flight:o}=s;if(!t||!o)return[];const r=t.data.events.filter(n=>n.kind!=="boot"&&n.kind!=="system");if(r.length===0)return[];const i=Q(o.startedAt),c=i!==null?r.filter(n=>typeof n.at=="number"&&n.at>=i-xe):[],d=(c.length>0?c:t.data.live?r:[]).slice(-M).map(n=>{const h=ge(n.result),p=(n.diff?`+${n.diff.add} −${n.diff.del}`:void 0)||h,u=N({kind:n.kind,tool:n.tool,arg:n.arg,text:n.text,outcome:p}),m=y({outcome:p}),x={id:`observe:${t.sessionId??"session"}:${n.id}`,ts:n.at??n.t,kind:n.kind,text:v(n.text||n.tool||"step"),repeatCount:1,phase:u,status:m};return n.tool&&(x.tool=n.tool),n.arg&&(x.arg=v(n.arg)),p&&(x.outcome=p),x});for(let n=0;n<d.length-1;n++){const h=d[n],a=d[n+1];h&&a&&a.ts>=h.ts&&(h.durationMs=a.ts-h.ts)}return d}function qe(s){const t=s.at(-1);return t?t.tool?t.arg?`${t.tool} · ${t.arg}`:t.tool:t.kind==="think"?t.text||"Thinking":t.text||null:null}function Ge(s){if(s.length===0)return null;const t=s.filter(i=>i.kind==="tool").length,o=s.filter(i=>i.kind==="think").length,r=[];return t>0&&r.push(`${t} tool${t===1?"":"s"}`),o>0&&r.push(`${o} thinking`),r.length===0?`${s.length} step${s.length===1?"":"s"}`:r.join(" · ")}function Ve(s){const t=s.flight?.state;return t==="queued"?{label:"Queued",detail:"waiting for the session to come online"}:t==="waking"?{label:"Waking",detail:"starting the session"}:t==="running"||t==="waiting"?s.hasSessionScope?{label:"Session live",detail:"waiting for the first trace line"}:{label:"Session live",detail:"no trace stream for this session yet"}:s.awaitingResponse?{label:"Sent",detail:"waiting for the agent to pick this up"}:null}const fe=[{head:"30%",body:"88%",short:"62%"},{head:"22%",body:"76%",short:"48%"},{head:"34%",body:"82%",short:"68%"}],je=()=>z(()=>import("./conversation-motion-features-BKkCRaWR.js"),__vite__mapDeps([0,1,2,3,4])).then(s=>s.default);function P({onOpenTrace:s,onOpenTerminal:t,onSteer:o,compact:r=!1}){return!s&&!t&&!o?null:e.jsxs("nav",{className:`s-thread-working-actions${r?" s-thread-working-actions--compact":""}`,"aria-label":"Working turn actions",children:[s&&e.jsxs("button",{type:"button",className:"s-thread-working-action s-thread-working-action--primary",onClick:s,title:"Watch this run's live trace",children:[e.jsx(oe,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Live trace"})]}),t&&e.jsxs("button",{type:"button",className:"s-thread-working-action",onClick:t,title:"Jump into this agent's terminal",children:[e.jsx(ce,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Terminal"})]}),o&&e.jsxs("button",{type:"button",className:"s-thread-working-action",onClick:o,title:"Write an interrupting message to steer this turn",children:[e.jsx(le,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Steer…"})]})]})}const ve={think:"Thinking",tool:"Tool",ask:"Prompt",message:"Says",note:"Note",system:"System",boot:"Boot"};function k({steps:s,phase:t,limit:o=5,compact:r=!1}){const[i,c]=g.useState(()=>new Set),l=g.useCallback(a=>{c(p=>{const u=new Set(p);return u.has(a)?u.delete(a):u.add(a),u})},[]),d=g.useMemo(()=>me(s),[s]),n=s.slice(-o),h=s.length-n.length;return n.length===0?t?e.jsxs("div",{className:"s-thread-steps-phase surface-card surface-card--inset",children:[e.jsxs("div",{className:"s-thread-steps-phase-header",children:[e.jsx("span",{className:"dot dot--sm dot--working dot--pulse dot--glow","aria-hidden":"true"}),e.jsx("span",{className:"label-xs text-muted",children:t.label})]}),e.jsx("strong",{className:"s-thread-steps-phase-detail",children:t.detail})]}):null:e.jsxs("div",{className:`s-thread-steps${r?" s-thread-steps--compact":""}`,children:[d.length>0&&e.jsx("div",{className:"s-thread-turn-phases-ribbon",role:"status","aria-label":"Execution phases",children:d.map(a=>e.jsxs("span",{className:`s-thread-turn-phase-chip chip chip--sm chip--mono ${a.active?"chip--working s-thread-turn-phase-chip--active":"chip--neutral"}`,children:[a.active&&e.jsx("span",{className:"dot dot--sm dot--working dot--pulse dot--glow","aria-hidden":"true"}),e.jsx("span",{className:"s-thread-turn-phase-name",children:a.label}),e.jsx("span",{className:"s-thread-turn-phase-count",children:a.count})]},a.phase))}),h>0&&e.jsxs("div",{className:"s-thread-steps-elided label-xs",children:[h," earlier step",h===1?"":"s"]}),e.jsx("ol",{className:"s-thread-steps-list","aria-label":"Live steps in this turn",children:n.map((a,p)=>{const u=p===n.length-1,m=i.has(a.id),x=!!(a.arg&&a.arg.length>30||a.outcome||a.text.length>50);return e.jsxs("li",{className:`s-thread-step-card s-thread-step-card--${a.status}${u?" s-thread-step-card--latest":""}${m?" s-thread-step-card--expanded":""}`,"data-kind":a.kind,"data-phase":a.phase,"data-status":a.status,children:[e.jsxs("div",{className:"s-thread-step-header",children:[e.jsx("span",{className:"s-thread-step-mark s-thread-step-indicator","aria-hidden":"true",children:a.status==="working"||u&&!a.outcome?e.jsx("span",{className:"dot dot--sm dot--working dot--pulse dot--glow"}):a.status==="error"?e.jsx("span",{className:"dot dot--sm dot--danger"}):a.status==="warning"?e.jsx("span",{className:"dot dot--sm dot--warning"}):e.jsx("span",{className:"dot dot--sm dot--success"})}),e.jsx("span",{className:"s-thread-step-kind chip chip--sm chip--mono chip--ghost",children:a.tool?a.tool:ve[a.kind]}),e.jsxs("div",{className:"s-thread-step-body",children:[a.tool?e.jsx("span",{className:"s-thread-step-tool-arg",children:a.arg?e.jsx("code",{className:"s-thread-step-arg-code",children:a.arg}):e.jsx("span",{className:"s-thread-step-tool",children:a.tool})}):e.jsx("span",{className:"s-thread-step-text",children:a.text}),a.repeatCount>1&&e.jsxs("span",{className:"s-thread-step-repeat chip chip--sm chip--mono chip--neutral",children:["×",a.repeatCount]})]}),e.jsxs("div",{className:"s-thread-step-meta",children:[a.outcome&&e.jsx("span",{className:`s-thread-step-outcome chip chip--sm chip--mono ${a.outcome.includes("+")?"chip--success":a.status==="error"?"chip--danger":"chip--neutral"}`,children:a.outcome}),a.durationMs?e.jsx("span",{className:"s-thread-step-duration label-xs",children:he(a.durationMs)}):null,e.jsx("time",{className:"label-xs",title:b(a.ts),children:w(a.ts)}),x&&e.jsx("button",{type:"button",className:"s-thread-step-toggle btn btn--ghost btn--icon","aria-expanded":m,onClick:()=>l(a.id),title:m?"Collapse output":"Expand output",children:m?e.jsx(ne,{size:12}):e.jsx(re,{size:12})})]})]}),m&&e.jsxs("div",{className:"s-thread-step-output surface-card surface-card--inset",children:[e.jsxs("div",{className:"s-thread-step-output-header",children:[e.jsx("span",{className:"label-xs text-muted",children:"Telemetry Detail"}),e.jsxs("span",{className:"label-xs text-dim",children:[a.phase.toUpperCase()," · ",a.status.toUpperCase()]})]}),e.jsx("pre",{className:"s-thread-step-output-code",children:e.jsxs("code",{children:[a.tool?`tool: ${a.tool}
3
+ `:"",a.arg?`args: ${a.arg}
4
+ `:"",a.outcome?`outcome: ${a.outcome}
5
+ `:"",a.text?`text: ${a.text}
6
+ `:"",`timestamp: ${b(a.ts)}`]})})]})]},a.id)})})]})}function R({events:s,limit:t=3,compact:o=!1}){const r=s.slice(0,t);return r.length===0?null:e.jsx("ol",{className:`s-thread-motion-events${o?" s-thread-motion-events--compact":""}`,"aria-label":"Latest run activity",children:r.map((i,c)=>e.jsxs("li",{className:"s-thread-motion-event-card",children:[e.jsx("span",{className:"s-thread-motion-event-dot",children:e.jsx("span",{className:`dot dot--sm ${c===0?"dot--working dot--pulse dot--glow":"dot--neutral"}`})}),e.jsx("span",{className:"s-thread-motion-event-kind chip chip--sm chip--mono chip--ghost",children:W(i.kind)}),e.jsx("span",{className:"s-thread-motion-event-summary",children:B(i)??"Activity recorded"}),e.jsx("time",{className:"label-xs",title:b(i.ts),children:w(i.ts)})]},i.id))})}function be(){const s=ae();return e.jsx(ie,{features:je,strict:!0,children:e.jsxs(f.section,{className:"s-thread-skeleton","aria-busy":"true","aria-live":"polite",initial:s?!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(f.span,{className:"s-thread-loader-orbit",animate:s?void 0:{rotate:360},transition:{duration:3.2,ease:"linear",repeat:1/0},children:e.jsx("span",{})}),e.jsx(f.span,{className:"s-thread-loader-core",animate:s?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:fe.map((t,o)=>e.jsxs(f.div,{className:"s-thread-skeleton-turn",initial:s?!1:{opacity:0,y:7},animate:{opacity:1,y:0},transition:{delay:s?0:.05+o*.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:t.head}}),e.jsx("span",{className:"s-thread-skeleton-line",style:{width:t.body}}),e.jsx("span",{className:"s-thread-skeleton-line s-thread-skeleton-line--short",style:{width:t.short}})]})]},`${t.head}-${t.body}`))})]})})}function Ne({sessions:s,activeConversationId:t,needsYouIds:o,lastViewed:r,navigate:i}){const c=s.filter(d=>o.has(d.id)||d.agentId&&o.has(d.agentId)),l=g.useMemo(()=>O(s),[s]);return e.jsx("aside",{className:"s-thread-rail",children:e.jsxs("div",{className:"s-thread-rail-scroll",children:[c.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"}),c.map(d=>e.jsx(_,{session:d,active:d.id===t,unread:C(d.lastMessageAt,d.id,r),needsYou:!0,navigate:i},`needs-${d.id}`))]}),l.map(d=>e.jsxs("div",{className:"s-thread-rail-section",children:[e.jsx("div",{className:"s-thread-rail-section-label",children:d.workspace}),d.sessions.map(n=>e.jsx(_,{session:n,active:n.id===t,unread:C(n.lastMessageAt,n.id,r),needsYou:!1,navigate:i},n.id))]},d.workspace))]})})}function ye({sessionMeta:s,agents:t,flights:o,conversationId:r,navigate:i,route:c}){const l=g.useMemo(()=>s?s.participantIds.filter(a=>a!=="operator").map(a=>D(t,[a])).filter(a=>a!==null):[],[s,t]),d={id:"operator",name:"You",handle:"operator",activity:null,state:"ready",agent:null},n=g.useMemo(()=>l.map(a=>({id:a.id,name:a.name,handle:F(a)??K(a.id)??a.id,activity:U(a,o,r),state:G(a.state),agent:a})),[l,o,r]),h=[d,...n];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(a=>{const p=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"s-ops-avatar",style:{"--size":"28px",background:L(a.name)},children:a.name[0]?.toUpperCase()??"?"}),e.jsxs("div",{className:"s-thread-sidebar-participant-info",children:[e.jsx("span",{className:"s-thread-sidebar-participant-name",children:a.name}),e.jsxs("span",{className:"s-thread-sidebar-participant-handle",children:["@",a.handle]})]}),e.jsx("div",{className:"s-thread-sidebar-participant-activity",children:a.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:a.activity})]}):V(a.state)||a.id==="operator"?e.jsx("span",{className:"s-thread-sidebar-activity-dot",style:{background:J(a.state)}}):e.jsx("span",{className:"s-thread-sidebar-activity-dot",style:{background:"var(--dim)"}})})]});return a.agent?e.jsx("button",{type:"button",className:"s-thread-sidebar-participant s-thread-sidebar-participant--clickable",onClick:()=>E(i,{view:"agents-v2",agentId:a.agent.id},{returnTo:c}),title:`Open ${a.name} profile`,children:p},a.id):e.jsx("div",{className:"s-thread-sidebar-participant",children:p},a.id)})]}),n.length>0&&e.jsxs("div",{className:"s-thread-sidebar-section",children:[e.jsx("div",{className:"s-thread-sidebar-label",children:"Conversation mesh"}),e.jsx(we,{participants:n})]})]})}function ke({agentName:s,title:t,detail:o,snapshot:r,events:i,steps:c,phase:l,tone:d,workspaceName:n,branch:h,startedAt:a,onOpenTrace:p,onOpenTerminal:u,onSteer:m}){const x=a?w(a):"now";return e.jsxs("section",{className:`s-thread-motion-panel s-thread-motion-panel--${d}`,"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:t}),e.jsx("p",{children:o})]})]}),e.jsx("div",{className:"s-thread-motion-meter","aria-hidden":"true",children:Se.map((S,T)=>e.jsx("span",{style:{"--bar-height":`${S}%`,"--bar-delay":`${T*74}ms`}},`${S}-${T}`))}),e.jsxs("dl",{className:"s-thread-motion-stats",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Session"}),e.jsx("dd",{children:x})]}),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:s}),e.jsx("strong",{children:r.latest})]}),c.length>0?e.jsx(k,{steps:c,phase:null,limit:6}):i.length>0?e.jsx(R,{events:i,limit:4}):l?e.jsx(k,{steps:c,phase:l,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"})]}),(n||h)&&e.jsxs("div",{className:"s-thread-motion-chips",children:[n&&e.jsx("span",{children:n}),h&&e.jsx("span",{children:h})]}),e.jsx(P,{onOpenTrace:p,onOpenTerminal:u,onSteer:m})]})}function _({session:s,active:t,unread:o,needsYou:r,navigate:i}){const{route:c}=X(),l=H(s),d=(s.agentName??l)[0]?.toUpperCase()??"?",n=s.kind==="direct",h=q(s.workspaceRoot)??s.kind;return e.jsxs("button",{type:"button",className:["s-thread-rail-item",t&&"s-thread-rail-item--active",r&&"s-thread-rail-item--needs-you"].filter(Boolean).join(" "),onClick:()=>E(i,{view:"conversation",conversationId:s.id},{returnTo:c}),children:[n?e.jsx("div",{className:"s-thread-rail-avatar",style:{background:L(s.agentName??l)},children:d}):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:l}),e.jsx("span",{className:"s-thread-rail-sub",children:h})]}),e.jsxs("div",{className:"s-thread-rail-trailing",children:[o&&!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 we({participants:s}){const c=s.map((l,d)=>{const n=2*Math.PI*d/s.length-Math.PI/2;return{...l,x:130+55*Math.cos(n),y:80+55*Math.sin(n)}});return e.jsx("div",{className:"s-thread-mini-mesh",children:e.jsxs("svg",{viewBox:"0 0 260 160","aria-label":"Conversation participant mesh",children:[c.map(l=>e.jsx("line",{x1:130,y1:80,x2:l.x,y2:l.y,className:"s-thread-mini-mesh-edge"},`edge-${l.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"}),c.map(l=>e.jsxs("g",{children:[e.jsx("circle",{cx:l.x,cy:l.y,r:16,className:"s-thread-mini-mesh-node",style:l.state==="in_turn"||l.state==="in_flight"?{stroke:"var(--green)"}:void 0}),e.jsx("text",{x:l.x,y:l.y,className:"s-thread-mini-mesh-label",children:l.name.slice(0,3).toUpperCase()})]},`node-${l.id}`))]})})}const Se=[42,76,54,88,34,66,92,48,72,38,84,58],Je=Object.freeze(Object.defineProperty({__proto__:null,ChannelRail:Ne,PresenceSidebar:ye,ThreadLoadingSkeleton:be,ThreadMotionPanel:ke,WorkingTurnActions:P,WorkingTurnActivityPreview:R,WorkingTurnSteps:k},Symbol.toStringTag,{value:"Module"}));export{Je as C,M as T,k as W,Ke as a,De as b,be as c,Ve as d,ke as e,R as f,P as g,qe as l,Fe as m,He as o,Ge as s,Ue as t};
@@ -0,0 +1,2 @@
1
+ import{j as r,r as o}from"./index-CZ-05hKz.js";import{o as ht,w as aa,q as Jt,s as Os,t as ra,u as oa,v as ia,x as Ps,y as la,z as ca,A as da,B as ua}from"./NewChatComposer-hlWT-nbR.js";import{a as U}from"./api-Co9aQ2Jw.js";import"./text-CnZ0e1-V.js";import{u as ma,C as ha}from"./ConversationComposer-2HjbGPL9.js";import"./index-BVlMw8x_.js";import{u as pa,d as fa,a as ga}from"./Provider-B2xuo3rf.js";import{h as ya,j as ba,x as ne,y as qs,z as wa,A as ve,B as Sa,D as Ta,E as xa,F as va,c as Ds,S as Bs,G as Ca,H as Ma,I as ka,J as Na,K as Aa,L as Ia,M as ja,k as Us,N as Ra,O as Ea,q as La,s as $a,r as Gt,P as Fa,Q as Oa,R as Pa,T as qa,l as Da,U as Ba,V as Ua,W as Hs,X as Ha,Y as Wa,Z as _e,g as _a,_ as Ka,$ as Qa,a0 as Ws,a1 as Va,a2 as za,a3 as Ja,a4 as Ga,a5 as _s,a6 as Ya,a7 as Ks,a8 as Xa,a9 as Za,aa as er}from"./conversation-model-CwF6Y9gx.js";import{u as tr}from"./sse-CiOSzE5n.js";import{n as Yt,t as pt,f as Qs}from"./time-Dhsh_2EG.js";import{M as sr}from"./message-markup-RkfmDfME.js";import{a as Vs,i as Xt,b as nr}from"./message-visibility-DwxgcgYK.js";import{d as ar}from"./operator-attention-RqieiSY8.js";import{b as rr}from"./router-DJj2WbDg.js";import{f as Zt,a as or}from"./scoutbot-BJIamJOH.js";import{s as ir}from"./sessionRead-CvFz2RHv.js";import{o as ft}from"./openContent-C6XO6kr5.js";import{c as Ke}from"./clipboard-e3fSpeo7.js";import{A as es}from"./AgentAvatar-CYhf6twS.js";import{d as lr}from"./types-B0PlfpKc.js";/* empty css */import{ConversationHeader as cr,ConversationIdentityRow as dr,AddParticipantForm as ur}from"./ConversationHeader-C8vfXaTF.js";import{FanOutRow as mr,ThreadDayDivider as hr}from"./ConversationFeedRows-C6wUqJrx.js";import{T as pr,t as zs,m as Js,a as fr,b as gr,o as yr,d as br,s as wr,l as Sr,c as Tr,e as xr,W as vr,f as Cr,g as Mr}from"./ConversationPanels-CNCIbpqU.js";import{u as kr}from"./tail-events-BMQmSx1n.js";import{PinnedAskCard as Nr,ConversationStatusStrip as Ar}from"./ConversationStatus-DZuyKsWN.js";import"./HarnessMark-D5CA5uSp.js";import"./colors-BtO5_zlx.js";import"./NewChatOrigin-DdpzE4kz.js";import"./keyboard-nav-DFhAJkW3.js";import"./x-e3h2hDsp.js";import"./createLucideIcon-DXpqZP7I.js";import"./chevron-down-Mp9mu_yd.js";import"./search-D1tJSAWe.js";import"./loader-circle-BiohlpM3.js";import"./file-text-KijGBnME.js";import"./perf-PX8Rx0EP.js";import"./scout-voice-BhPzrc6P.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./zap-nMcjPoWB.js";import"./surface-activity-B1rgWB1i.js";import"./DocumentFocusViewer-DZVhS7as.js";import"./TextDocumentSurface-CKQP-cBT.js";import"./chevron-right-CzH-TaSF.js";import"./code-xml-Jtxsp5d1.js";import"./arrow-left-CghA0kTw.js";import"./arrow-right-iJFv3jNh.js";import"./chunk-HRAB3GC3-swV8PA2k.js";import"./index-BWHgHrtv.js";import"./mentions-CcPFMbmZ.js";import"./AgentDetailCard-UqPNpcvB.js";import"./AgentLiveActions-BwuzOE8h.js";import"./terminal-takeover-DANQfTcy.js";import"./eye-CpfyvdLq.js";import"./terminal-yN9xN-h9.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-BQ6t92tJ.js";import"./SpriteAvatar-Bs68ZENy.js";import"./CrewAvatar-CTIuxp4G.js";import"./BackToPicker-4JaeRvDm.js";import"./AstronautSuit-Ckx7lu7G.js";import"./tail-display-DcliDVkW.js";import"./lane-edit-display-C_Aujldz.js";import"./use-reduced-motion-CKkhq9c5.js";import"./proxy-DnLpZIi9.js";import"./activity-Bj3Hnbj3.js";import"./message-circle-B2ddzBrX.js";import"./check-C18YQC90.js";import"./sparkles-Dy8p5xN8.js";const en="scout:conversations:failure-dismissals:v1",Ir=64;let ns={};function tn(){try{if(typeof localStorage<"u"){const n=JSON.parse(localStorage.getItem(en)??"null");Er(n)&&(ns=as(n))}}catch{}return as(ns)}function jr(n){ns=as(n);try{typeof localStorage<"u"&&localStorage.setItem(en,JSON.stringify(n))}catch{}}function Gs(n){return new Set(tn()[n]??[])}function Rr(n,c){const d=tn(),f=(d[n]??[]).filter(N=>N!==c);f.push(c),d[n]=f.slice(-100);const y=Object.keys(d);for(const N of y.slice(0,Math.max(0,y.length-Ir)))delete d[N];return jr(d),new Set(d[n])}function as(n){return Object.fromEntries(Object.entries(n).map(([c,d])=>[c,[...d]]))}function Er(n){return!n||typeof n!="object"||Array.isArray(n)?!1:Object.values(n).every(c=>Array.isArray(c)&&c.every(d=>typeof d=="string"&&d.length>0))}const Lr=/\.(?:apng|avif|gif|jpe?g|png|svg|webp)(?:$|[?#])/iu,$r=/\bhttps?:\/\/[^\s<>"')\]]+/giu;function Qe(n){if(typeof n!="string")return null;try{const c=new URL(n.trim());return c.protocol==="http:"||c.protocol==="https:"?c.toString():null}catch{return null}}function z(n,c){const d=n?.[c];return typeof d=="string"&&d.trim()?d.trim():null}function Fr(n){return n.mediaType.toLowerCase().startsWith("image/")}function Or(n){return Lr.test(n)}function Pr(n){try{const c=new URL(n),d=[c.pathname==="/"?"":c.pathname,c.search].join("").trim();return{host:c.hostname.replace(/^www\./iu,""),detail:d||c.hostname}}catch{return{host:n,detail:n}}}function qr(n){const c=new Set,d=[];for(const f of n.matchAll($r)){const y=f[0]?.replace(/[.,;:!?]+$/u,""),N=Qe(y);!N||c.has(N)||(c.add(N),d.push(N))}return d}const Dr=/^\/api\/blobs\/[^/]+$/u;function ts(n){try{const c=new URL(n);return Dr.test(c.pathname)?`${c.pathname}${c.search}`:n}catch{return n}}function gt(n){return Qe(n.url)??Qe(z(n.metadata,"url"))??Qe(z(n.metadata,"href"))}function Br(n){const c=n.metadata??null,d=z(c,"kind")??z(c,"type"),f=gt(n);if(!f||d!=="link_preview"&&d!=="link-preview"&&n.mediaType!=="text/x-uri")return null;const y=Pr(f);return{id:n.id,url:f,title:z(c,"title")??y.host,description:z(c,"description"),imageUrl:Qe(z(c,"imageUrl")??z(c,"image")),siteName:z(c,"siteName")??y.host}}function Ur({src:n,alt:c}){const[d,f]=o.useState(!1);return d?r.jsxs("a",{className:"s-message-embed s-message-embed--file",href:n,target:"_blank",rel:"noreferrer",children:[r.jsx("span",{className:"s-message-embed-title",children:c}),r.jsx("span",{className:"s-message-embed-description",children:"Preview unavailable"})]}):r.jsx("a",{className:"s-message-embed s-message-embed--image",href:n,target:"_blank",rel:"noreferrer",children:r.jsx("img",{src:n,alt:c,loading:"lazy",decoding:"async",onError:()=>f(!0)})})}function Hr({preview:n}){return r.jsxs("a",{className:"s-message-embed s-message-embed--link",href:n.url,target:"_blank",rel:"noreferrer",children:[n.imageUrl&&r.jsx("span",{className:"s-message-embed-thumb",children:r.jsx("img",{src:n.imageUrl,alt:"",loading:"lazy",decoding:"async"})}),r.jsxs("span",{className:"s-message-embed-copy",children:[n.siteName&&r.jsx("span",{className:"s-message-embed-site",children:n.siteName}),r.jsx("span",{className:"s-message-embed-title",children:n.title}),n.description&&r.jsx("span",{className:"s-message-embed-description",children:n.description})]})]})}function Wr({message:n}){const c=n.attachments??[],d=new Set,f=[],y=[];for(const h of c){const L=gt(h);if(L&&Fr(h)){d.add(h.id),f.push({id:h.id,src:ts(L),alt:h.fileName??"Image attachment"});continue}const b=Br(h);b&&(d.add(h.id),y.push(b))}const N=new Set(y.map(h=>h.url)),G=new Set(c.map(gt).filter(h=>!!h));for(const h of qr(n.body))G.has(h)||N.has(h)||Or(h)&&f.push({id:h,src:ts(h),alt:"Embedded image"});const k=c.filter(h=>!d.has(h.id));return f.length===0&&y.length===0&&k.length===0?null:r.jsxs("div",{className:"s-message-embeds",children:[f.map(h=>r.jsx(Ur,{src:h.src,alt:h.alt},h.id)),y.slice(0,1).map(h=>r.jsx(Hr,{preview:h},h.id)),k.map(h=>{const L=gt(h),b=L?ts(L):null,u=h.fileName??z(h.metadata,"title")??h.mediaType;return b?r.jsxs("a",{className:"s-message-embed s-message-embed--file",href:b,target:"_blank",rel:"noreferrer",children:[r.jsx("span",{className:"s-message-embed-title",children:u}),r.jsx("span",{className:"s-message-embed-description",children:h.mediaType})]},h.id):r.jsxs("div",{className:"s-message-embed s-message-embed--file",children:[r.jsx("span",{className:"s-message-embed-title",children:u}),r.jsx("span",{className:"s-message-embed-description",children:h.mediaType})]},h.id)})]})}function _r(n){const{sessionIds:c,active:d}=n,f=c.join("|"),y=d&&c.length>0,[N,G]=o.useState([]);return o.useEffect(()=>{G([])},[f]),o.useEffect(()=>{if(!y)return;let k=!1;const h=new URLSearchParams({limit:String(pr*3),transcripts:"true"});return U(`/api/tail/recent?${h.toString()}`).then(L=>{if(k)return;const b=(L.events??[]).filter(u=>zs(u,c));b.length!==0&&G(u=>Js(u,b))}).catch(()=>{}),()=>{k=!0}},[y,f]),kr(k=>{y&&zs(k,c)&&G(h=>Js(h,[k]))},y),o.useMemo(()=>y?fr(N):[],[y,N])}const Kr=3500;function Ys(n){const c=n?.trim().replace(/^#/,"");if(!c?.startsWith("msg-"))return null;const d=c.slice(4).trim();if(!d)return null;try{return decodeURIComponent(d)}catch{return d}}const Qr=64;function Vr(n){const c=n?.clientMessageId;return typeof c=="string"&&c.trim()?c.trim():null}function Xs(n){const c=n.body.replace(/\s+/gu," ").trim();if(c)return c.length>180?`${c.slice(0,179).trimEnd()}…`:c;const d=n.attachments?.length??0;return d===1?"Attachment":d>1?`${d} attachments`:"Message"}function Zs(n,c){const d=n.toLocaleLowerCase().indexOf(c.toLocaleLowerCase());if(d<0)return n;const f=n.slice(0,d),y=n.slice(d+c.length);return!f&&y.startsWith(" ")?y.slice(1):f.endsWith(" ")&&y.startsWith(" ")?`${f}${y.slice(1)}`:`${f}${y}`}function zr(n){return n instanceof TypeError||typeof DOMException<"u"&&n instanceof DOMException&&n.name==="AbortError"}function mi({conversationId:n,initialDraft:c,navigate:d,embedded:f,showBackNav:y=!0,treatment:N="standard"}){const{agents:G,route:k,openContextCapture:h}=pa(),L=rr(k),b=o.useMemo(()=>fa(G,L),[G,L]),[u,yt]=o.useState(null),rs=o.useRef(null);rs.current=u;const Ve=o.useMemo(()=>ht(n),[n]),[sn,nn]=o.useState(()=>Ve?{[n]:Ve}:{}),T=sn[n]??Ve??[],[an,os]=o.useState(()=>Ve!==null),Ce=o.useRef(null),is=o.useMemo(()=>{const e=Ce.current;return e===null?null:new Set(T.filter(t=>!e.has(t.id)).map(t=>t.id))},[T]),ze=Ce.current===null&&T.length>0;o.useEffect(()=>{if(T.length===0)return;const e=Ce.current??new Set;for(const t of T)e.add(t.id);Ce.current=e},[T]),o.useEffect(()=>{Ce.current=null,os(ht(n)!==null)},[n]);const ls=!an&&T.length===0,J=o.useCallback(e=>{nn(t=>{const s=t[n]??ht(n)??[],a=typeof e=="function"?e(s):e,i=aa(n,a);return{...t,[n]:i}})},[n]),rn=Jt(n),[g,ge]=o.useState(rn),[Me,ke]=o.useState([]),[Je,bt]=o.useState(null),[Ge,Ne]=o.useState(null),[Ye,on]=o.useState(()=>typeof window>"u"?null:Ys(window.location.hash)),[cs,ae]=o.useState(null),[wt,ds]=o.useState(()=>Gs(n)),[ye,St]=o.useState(!1),[ln,Ae]=o.useState(!1),[Tt,Xe]=o.useState(0),Ze=o.useRef(null),Ie=o.useRef(null),us=o.useRef(null),je=o.useRef(!0),et=o.useRef(!1),be=o.useRef(null),A=o.useRef(null),Re=o.useRef(new Set),Ee=o.useRef(null),ms=o.useRef(0),hs=o.useRef(null),Le=o.useRef(null),$e=o.useRef(new Set),re=o.useRef(n);re.current=n;const oe=o.useRef(new Map),cn=Os(n),tt=o.useRef(!1);o.useLayoutEffect(()=>{const e=Ie.current,t=Ze.current;!e||!t||(t.scrollTop=e.scrollTop+(t.scrollHeight-e.scrollHeight),Ie.current=null,tt.current=!0)}),o.useEffect(()=>{St(!1),Ie.current=null,tt.current=!1,je.current=!0,et.current=!1,Ae(!1),Xe(0),Ut(new Set),oe.current.clear(),ge(Jt(n)),ds(Gs(n))},[n]);const st=o.useCallback(async e=>{let s=typeof e.metadata?.flightId=="string"?e.metadata.flightId.trim():"";if(!s&&e.replyToMessageId)try{s=(await U(`/api/flights?conversationId=${encodeURIComponent(n)}&active=false`)).find(i=>i.messageId===e.replyToMessageId)?.id??""}catch{}await ar({...s?{flightId:s}:{},conversationId:n,messageId:e.replyToMessageId??e.id,itemUpdatedAt:Yt(e.createdAt)??Date.now()})},[n]),ps=o.useCallback(e=>{const t=e.replyToMessageId??e.id;ds(Rr(n,e.id)),Zt({type:"dismiss-conversation-failure",conversationId:n,messageId:t,reason:"The operator cleared this delivery issue"});const s=`${n}:${e.id}`;$e.current.add(s),st(e).catch(()=>{$e.current.delete(s)})},[n,st]);o.useEffect(()=>{for(const e of T){if(!wt.has(e.id)||!Vs(e))continue;const t=`${n}:${e.id}`;$e.current.has(t)||($e.current.add(t),st(e).catch(()=>{$e.current.delete(t)}))}},[n,wt,T,st]);const x=u?.agentId??null,M=u?.kind==="direct",xt=o.useMemo(()=>new Set([n,...u?.equivalentConversationIds??[]]),[n,u?.equivalentConversationIds]),V=o.useMemo(()=>x?b.find(e=>e.id===x)??null:null,[b,x]),fs=ya(u),dn=ba({resolvedAgentId:V?.id,sessionId:fs,machineId:L}),[vt,gs]=o.useState(null);o.useEffect(()=>{U("/api/fleet").then(e=>{gs(t=>ne(t,qs(e.activeAsks,n,x)))}).catch(()=>{})},[n,x]);const H=o.useCallback(async(e={})=>{const t=e.messageMode??"none",s=e.includeMetadata??!0;ae(null);try{const a=s?await U(`/api/session/${encodeURIComponent(n)}`).catch(()=>null):rs.current;if(re.current!==n)return;yt(C=>ne(C,a));const i=a?.agentId??null,l=a?.id&&a.id!==n?a.id:n;if(l!==n){d({view:"conversation",conversationId:l});return}const m=ht(l),R=ra(l),w=t==="initial"&&!R,p=t==="refresh"||t==="initial",[S,_,E]=await Promise.all([w?oa(l):p?ia(l,{refresh:!0}):Promise.resolve(m),U(`/api/flights?conversationId=${encodeURIComponent(l)}`),U("/api/fleet?limit=24&activityLimit=160").catch(()=>wa())]);if(re.current!==n)return;const te=ve(S??[]),q=te.filter(C=>!Xt(C));S&&J(C=>ne(C,Sa(C,q))),os(!0),ir(l);const K=te.at(-1);K&&Le.current!==K.id&&(Le.current=K.id,U(`/api/conversations/${encodeURIComponent(l)}/read-cursor`,{method:"POST",body:JSON.stringify({lastReadMessageId:K.id})}).catch(()=>{Le.current===K.id&&(Le.current=null)}));const Q=Ta(_),D=Jt(l),se=Q??D;Re.current=new Set([..._.map(C=>C.invocationId),...D?.invocationId?.startsWith("pending:")?[]:D?.invocationId?[D.invocationId]:[]]),Q&&D?.id===Q.id&&Ps(l,Q.id);const ut=se?.agentId??i??null,B=xa(E.activity,se,l,ut),zt=va(E.activeAsks,se,l,ut);ge(C=>ne(C,se)),ke(C=>ne(C,B)),Ne(C=>ne(C,zt)),gs(C=>ne(C,qs(E.activeAsks,l,i)))}catch(a){if(re.current!==n)return;ae(a instanceof Error?a.message:String(a))}},[n,d,J]);o.useEffect(()=>{H({messageMode:"initial"})},[H]),o.useEffect(()=>{Le.current=null},[n]),o.useEffect(()=>{Ee.current=g},[g]);const un=o.useCallback(async()=>{if(ye||!Os(n))return;const e=Ze.current,t=e?{scrollHeight:e.scrollHeight,scrollTop:e.scrollTop}:null;St(!0),ae(null);try{const s=await la(n);if(re.current!==n)return;t&&(Ie.current=t),J(ve(s).filter(a=>!Xt(a)))}catch(s){re.current===n&&ae(s instanceof Error?s.message:String(s))}finally{re.current===n&&St(!1)}},[n,ye,J]),[I,P]=o.useState(()=>c??""),[ie,le]=o.useState(null),[W,nt]=o.useState(!1),[v,mn]=o.useState("operator"),[ce,Fe]=o.useState({open:!1,query:"",triggerStart:-1,index:0}),[de,Oe]=o.useState({open:!1,query:"",triggerStart:-1,index:0}),[$,Y]=o.useState(null),[Ct,at]=o.useState(!1),[Mt,rt]=o.useState(""),[hn,Pe]=o.useState(null),[pn,kt]=o.useState(!1);o.useEffect(()=>{at(!1),rt(""),Pe(null),kt(!1)},[n]),o.useEffect(()=>{if(!c)return;const e=`${n}:${c}`;hs.current!==e&&(hs.current=e,P(c),requestAnimationFrame(()=>A.current?.focus()))},[n,c]);const X=o.useMemo(()=>{const e=new Map;for(const t of u?.participants??[])e.set(t.actorId,t),t.agentId&&e.set(t.agentId,t);return e},[u]),Nt=o.useMemo(()=>{const e=new Set,t=[];for(const s of u?.participantIds??[]){if(s==="operator")continue;const a=X.get(s),i=a?.scopedAlias?.trim().replace(/^@+/,"");if(!i)continue;const l=i.toLowerCase();e.has(l)||(e.add(l),t.push({id:s,label:a?.label??a?.displayName??i,name:a?.displayName??i,handle:i}))}for(const s of b){const a=s.handle?.trim().replace(/^@+/,"")??Ds(s.id)??s.id;if(!a)continue;const i=a.toLowerCase();e.has(i)||(e.add(i),t.push({id:s.id,label:a,name:s.name??a,handle:a}))}return t.sort((s,a)=>s.handle.localeCompare(a.handle))},[X,b,u]),fn=o.useMemo(()=>{if(!ce.open)return[];const e=ce.query.toLowerCase();return e?Bs.filter(t=>t.command.toLowerCase().startsWith("/"+e)||t.command.toLowerCase().includes(e)):Bs},[ce.open,ce.query]),gn=o.useMemo(()=>{if(!de.open)return[];const e=de.query.toLowerCase();return e?Nt.filter(t=>t.handle.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)||t.label.toLowerCase().includes(e)).slice(0,8):Nt.slice(0,8)},[de.open,de.query,Nt]),yn=o.useCallback(()=>{Fe(e=>e.open?{...e,open:!1}:e),Oe(e=>e.open?{...e,open:!1}:e)},[]),bn=o.useCallback((e,t)=>{const s=Ca(e,t);Fe(s?i=>({open:!0,query:s.query,triggerStart:s.start,index:i.open&&i.triggerStart===s.start?i.index:0}):i=>i.open?{...i,open:!1}:i);const a=Ma(e,t);Oe(a?i=>({open:!0,query:a.query,triggerStart:a.start,index:i.open&&i.triggerStart===a.start?i.index:0}):i=>i.open?{...i,open:!1}:i)},[]),wn=o.useCallback(e=>{const t=A.current,s=ce.triggerStart;if(s<0)return;const a=t?.selectionStart??I.length,i=I.slice(0,s),l=I.slice(a),m=e.insert,R=`${i}${m}${l}`;P(R),Fe(w=>({...w,open:!1})),requestAnimationFrame(()=>{const w=A.current;if(!w)return;const p=i.length+m.length;w.focus(),w.setSelectionRange(p,p)})},[I,ce.triggerStart]),Sn=o.useCallback(e=>{const t=A.current,s=de.triggerStart;if(s<0)return;const a=t?.selectionStart??I.length,i=I.slice(0,s),l=I.slice(a),m=l.length===0||!l.startsWith(" "),R=`@${e.handle}${m?" ":""}`,w=`${i}${R}${l}`;P(w),Oe(p=>({...p,open:!1})),requestAnimationFrame(()=>{const p=A.current;if(!p)return;const S=i.length+R.length;p.focus(),p.setSelectionRange(S,S)})},[I,de.triggerStart]);o.useEffect(()=>{const e=A.current;if(!e)return;e.style.height="0px";const t=Math.min(Math.max(e.scrollHeight,40),160);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>t?"auto":"hidden"},[I]),o.useEffect(()=>{U("/api/user").then(e=>mn(e.name)).catch(()=>{})},[]);const ot=o.useMemo(()=>ka(T,v),[T,v]);o.useEffect(()=>{$===null||ot===null||ot>=$&&Y(null)},[$,ot]);const Tn=o.useMemo(()=>Na(g),[g]),we=Date.now(),xn=Aa(g,ot,we),At=Tn&&!Ia(g)&&!xn,ys=M&&(W||$!==null||At),bs=M&&ja({sending:W,awaitingResponse:$!==null,currentFlight:g}),F=Us({name:V?.name,agentName:u?.agentName,id:x,title:u?.title}),j=o.useMemo(()=>M?Ra({agentName:F,agentState:V?.state??null,sending:W,currentFlight:g,showWorkingTurn:At,awaitingResponse:$!==null}):{label:"Open",detail:"",tone:"idle",showStrip:!1,showTyping:!1},[V?.state,F,$,g,we,M,W,At]),It=g?.startedAt??Ge?.startedAt??$,jt=Yt(It),ws=Ya(It,we),[,vn]=o.useState(0);o.useEffect(()=>{if(!j.showTyping||jt===null)return;const e=Math.max(0,Date.now()-jt),t=[_s.sustained,_s.long].find(a=>a>e);if(t===void 0)return;const s=window.setTimeout(()=>vn(a=>a+1),t-e+50);return()=>window.clearTimeout(s)},[jt,j.showTyping,ws]);const Cn="Live",Rt=o.useMemo(()=>Ea({currentFlight:g,presence:j,turnActivity:Me,turnAsk:Ge,awaitingResponseSince:$,nowMs:we}),[$,g,we,j,Me,Ge]),Mn="s-thread-msg-card s-thread-msg-working-card s-thread-msg-card--avatar-row",kn="s-thread-msg-kind",Nn="s-thread-turn-snapshot",An="s-thread-turn-snapshot-pulse",In="s-thread-presence-line",jn=["s-thread-presence-strip",`s-thread-presence-strip--${ws}`].filter(Boolean).join(" "),Et=u?La(u):F,Ss=u?.id??n,Rn=u?.alias?.trim()||null,it=$a(u?.workspaceRoot),En=j.tone,Lt=T.length===0&&M&&(j.showTyping||g!==null||Me.length>0||Ge!==null||$!==null),Ts=o.useMemo(()=>u?u.participantIds.includes("operator"):M,[M,u]),qe=g?.agentId??x,De=qe?Gt(b,[qe]):null,Be=De?.id??qe,Ue=g?.sessions.at(-1)?.sessionId??De?.harnessSessionId??void 0,xs=g?.id?()=>{ft(d,{view:"sessions",flightId:g.id,...Be?{agentId:Be}:{},...Ue?{sessionId:Ue}:{},...L?{machineId:L}:{}},{returnTo:k})}:void 0,vs=g?.id??null;o.useEffect(()=>{if(!vs||!Be){bt(null);return}let e=!1;const t=Ue?`?sessionId=${encodeURIComponent(Ue)}`:"",s=async()=>{try{const i=await U(`/api/agents/${encodeURIComponent(Be)}/observe${t}`);if(e)return;bt(l=>ne(l,i))}catch{}};s();const a=window.setInterval(()=>{s()},Kr);return()=>{e=!0,window.clearInterval(a),bt(null)}},[vs,Be,Ue]);const $t=o.useMemo(()=>gr({flight:g,agent:De??V,sessionMeta:u,observeSessionId:Je?.sessionId}),[V,g,u,Je?.sessionId,De]),Cs=_r({sessionIds:$t,active:j.showTyping||Lt}),Ln=o.useMemo(()=>yr({observe:Je,flight:g}),[g,Je]),Z=Cs.length>0?Cs:Ln,Ft=o.useMemo(()=>Z.length>0?null:br({flight:g,hasSessionScope:$t.length>0,awaitingResponse:$!==null}),[$,g,$t.length,Z.length]),Ot=wr(Z),Pt=Sr(Z),Ms=Z.at(-1)??null,qt=Ms?pt(Ms.ts,we):null,ue=o.useMemo(()=>Pt?{...Rt,latest:Pt,...Ot?{activityLabel:Ot}:{},...qt?{lastActivityLabel:qt}:{}}:Rt,[qt,Pt,Rt,Ot]),$n=`${F}: ${ue.latest}`,ks=qe&&Fa(De)?()=>{ft(d,{view:"terminal",agentId:qe,mode:"takeover"},{returnTo:k})}:void 0,Dt=M?()=>{f&&Zt({type:"focus-composer",reason:"Steer the active conversation"})||requestAnimationFrame(()=>{A.current?.focus({preventScroll:!0}),A.current?.scrollIntoView({block:"nearest"})})}:void 0,Fn=o.useMemo(()=>(u?u.participantIds.filter(t=>t!=="operator"):x?[x]:[]).map(t=>{const s=Gt(b,[t]),a=X.get(t);return{id:t,name:a?.scopedAlias??s?.name??a?.displayName??Ds(t)??t,title:a?.label??s?.id??t,agent:s,sessionId:a?.sessionId??null,harness:s?.harness??a?.harness??null,model:s?.model??null,reasoningEffort:s?.reasoningEffort??null}}),[x,X,b,u]),On=o.useMemo(()=>({name:v,active:Ts}),[Ts,v]),me=o.useMemo(()=>new Map(T.map(e=>[e.id,e])),[T]),Bt=o.useMemo(()=>b.find(e=>or(e)&&!!e.conversationId?.trim())?.conversationId?.trim()??null,[b]),He=o.useMemo(()=>Oa(T),[T]),[Pn,Ut]=o.useState(()=>new Set),qn=o.useCallback(e=>{Ut(t=>{const s=new Set(t);return s.delete(e)||s.add(e),s})},[]),Ns=o.useMemo(()=>{const e=new Map;for(const t of He)if(t.kind==="fanout")for(const s of t.messages)e.set(s.id,t.key);return e},[He]),lt=o.useCallback(e=>{const t=Ns.get(e);t&&Ut(l=>l.has(t)?l:new Set(l).add(t));const s=document.getElementById(`msg-${e}`);if(!s)return;const a=s.closest(".s-thread-fanout")??s,i=a===s?"s-thread-msg--flash":"s-thread-fanout--flash";a.scrollIntoView({behavior:"smooth",block:"center"}),a.classList.add(i),window.setTimeout(()=>a.classList.remove(i),1200)},[Ns]);o.useEffect(()=>{const e=()=>on(Ys(window.location.hash));return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]),o.useEffect(()=>{if(!Ye||!me.has(Ye))return;const e=window.setTimeout(()=>lt(Ye),50);return()=>window.clearTimeout(e)},[Ye,me,lt]),tr(o.useCallback(e=>{if(e.kind==="message.posted"){const t=e.payload?.message;if(!t||!xt.has(t.conversationId))return;const s=t.actorId==="operator",a=M&&!s&&t.class==="agent",i={id:t.id,conversationId:t.conversationId,actorId:t.actorId,actorName:a?F:Pa(t.actorId,b,v),body:t.body,createdAt:t.createdAt,class:s?"operator":t.class,attachments:t.attachments,metadata:t.metadata,replyToMessageId:t.replyToMessageId??t.n??null};if(Xt(i))return;if(J(l=>{const m=Vr(t.metadata),R=m?oe.current.get(m):void 0;if(l.some(w=>w.id===t.id))return m&&oe.current.delete(m),l;if(s&&m){const w=qa(l,m,R);if(w!==-1){const p=[...l];return p[w]=i,oe.current.delete(m),ve(p)}}return ve([...l,i])}),a){const l=Yt(t.createdAt)??Date.now();Y(m=>m===null||l<m||Da(Ee.current)?m:null),ge(m=>Ba(m)?null:m)}return}if(e.kind==="invocation.requested"){const t=e.payload?.invocation;if(!t||t.targetAgentId!==x||!t.conversationId||!xt.has(t.conversationId))return;Re.current.add(t.id),ke([]),Ne(null),Y(s=>s??Date.now());return}if(e.kind==="flight.updated"){const t=e.payload?.flight;if(!t||t.targetAgentId!==x||!(Re.current.has(t.invocationId)||Ee.current?.id===t.id))return;if(Ua.has(t.state)){Ps(n,t.id),ge(l=>l?.id===t.id?null:l),ke([]),Ne(null),Y(null),H({messageMode:"refresh",includeMetadata:!1});return}Re.current.add(t.invocationId);const a=Ee.current?.id===t.id,i=Hs(t,n,x??"",Ee.current);Ha(i)&&Y(null),ge(i),a||(ke([]),Ne(null));return}e.kind!=="agent.endpoint.upserted"&&e.kind==="unknown"&&H({messageMode:"refresh"})},[x,F,n,xt,M,H,v,b])),o.useEffect(()=>{if(!ys)return;const e=setInterval(()=>{H({messageMode:"refresh",includeMetadata:!1})},5e3);return()=>clearInterval(e)},[ys,H]),o.useEffect(()=>{const e=()=>{if(document.visibilityState!=="visible")return;const t=Date.now();t-ms.current<1e3||(ms.current=t,H({messageMode:"refresh"}))};return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[H]);const Ht=o.useRef(null),As=o.useRef(!1),Wt=o.useRef(!1),_t=o.useCallback(e=>{const t=us.current;t&&(et.current=!0,be.current!==null&&clearTimeout(be.current),t.scrollIntoView({behavior:e}),be.current=setTimeout(()=>{et.current=!1,be.current=null},e==="smooth"?700:0))},[]);o.useEffect(()=>()=>{be.current!==null&&clearTimeout(be.current)},[]);const Dn=o.useCallback(()=>{const e=Ze.current;if(!e||et.current)return;const s=e.scrollHeight-e.clientHeight-e.scrollTop<=Qr;je.current=s,s?(Ae(!1),Xe(0)):Ae(!0)},[]),Bn=o.useCallback(()=>{je.current=!0,Ae(!1),Xe(0),_t("smooth")},[_t]);o.useEffect(()=>{const e=T.at(-1)?.id??null,t=!!(e&&e!==Ht.current),s=Wa({newestMessageId:e,previousNewestMessageId:Ht.current,showTyping:j.showTyping,previousShowTyping:As.current,historyRestorePending:tt.current||Ie.current!==null,initialScrollDone:Wt.current,nearBottom:je.current});s!=="none"?(_t(s),Wt.current=!0):t&&Wt.current&&!je.current&&(Ae(!0),Xe(a=>a+1)),tt.current=!1,Ht.current=e,As.current=j.showTyping});const[,Un]=o.useState(0);o.useEffect(()=>{const e=setInterval(()=>Un(t=>t+1),15e3);return()=>clearInterval(e)},[]);const he=ma(),[pe,ee]=o.useState([]),[Is,ct]=o.useState("queue"),[Se,Te]=o.useState(null),xe=async(e,t)=>{const s=e.trim(),a=t?.attachments??[],i=t?.replyTarget??null;if(!s&&a.length===0||W)return"failed";const m=t?.forceAction??Ks({isDm:M,hasOutstandingReply:bs}),R=Date.now(),w=da(),p={id:`optimistic-${w}`,conversationId:n,actorId:"operator",actorName:v,body:s,createdAt:R,class:"operator",...i?{replyToMessageId:i.messageId}:{},metadata:{clientMessageId:w,deliveryState:"sending"},...a.length>0?{attachments:a}:{}};nt(!0),m!=="message"&&Y(R),ae(null),oe.current.set(w,p.id),J(S=>ve([...S,p]));try{const S=await U(`/api/chats/${encodeURIComponent(n)}/messages`,{method:"POST",body:JSON.stringify({body:s,clientMessageId:w,...i?{replyToMessageId:i.messageId}:{},...a.length>0?{attachments:a}:{}})}),_=S.chatId?.trim()??S.conversationId?.trim();if(_&&_!==n)throw new Error(`Send returned a different Chat (${_}) instead of appending to ${n}.`);if(S.messageId?.trim()){const E=S.messageId.trim();J(te=>ve(te.map(q=>q.id===p.id?{...q,id:E,metadata:{clientMessageId:w}}:q))),oe.current.delete(w)}return S.flight?(Re.current.add(S.flight.invocationId),ge(Hs(S.flight,n,x??"")),ke([]),Ne(null)):m!=="message"&&Y(null),"sent"}catch(S){return zr(S)?(J(_=>_.map(E=>E.id===p.id?{...E,metadata:{...E.metadata??{},deliveryState:"unknown"}}:E)),"unknown"):(J(_=>_.filter(E=>E.id!==p.id)),oe.current.delete(w),Y(null),ae(S instanceof Error?S.message:String(S)),"failed")}finally{nt(!1)}},Hn=async e=>{const t=e.replyToMessageId?me.get(e.replyToMessageId):null;if(!t||W)return;const s=[];for(const i of t.attachments??[]){if(!i.url){ae("This request includes an attachment that can’t be reused. Add it again, then retry."),requestAnimationFrame(()=>A.current?.focus());return}s.push({id:i.id,mediaType:i.mediaType,...i.fileName?{fileName:i.fileName}:{},url:i.url})}await xe(t.body,{forceAction:"invoke",attachments:s})!=="failed"&&ps(e)},Wn=(e,t,s)=>{if(!Bt)return;const a=e.replyToMessageId?me.get(e.replyToMessageId)?.body.trim():"",i=a?`${a.slice(0,1200)}${a.length>1200?"…":""}`:"(The original request is no longer available in this transcript.)",l=[`Help me recover a failed request to ${t}.`,s,"","Original request:",i].join(`
2
+ `),m={view:"conversation",conversationId:Bt,composeDraft:l};f&&Zt({type:"navigate",route:m,reason:"Ask @scoutbot to help recover a failed conversation request"})||d(m)},_n=async()=>{const e=I.trim(),t=ie,s=he.files,a=Se?.attachments??[];if(!e&&s.length===0&&a.length===0)return null;let i=[];if(s.length>0){nt(!0);try{i=await ua(s)}catch(l){return he.setError(l instanceof Error?l.message:String(l)),null}finally{nt(!1)}}return P(""),le(null),he.clear(),Te(null),{body:e,attachments:[...a,...i],replyTarget:t}},Kn=async()=>{const e=Za({isAgentBusy:fe,intent:Is}),t=Se?.id??null,s=await _n();if(!s)return;if(e==="queue"){ee(l=>t?l.map(m=>m.id===t?{...m,body:s.body,attachments:s.attachments,replyTarget:s.replyTarget}:m):[...l,{id:`queued-${Date.now()}-${l.length}`,body:s.body,attachments:s.attachments,replyTarget:s.replyTarget,queuedAt:Date.now()}]);return}t&&ee(l=>l.filter(m=>m.id!==t));const a=()=>{P(s.body),Te(s.attachments.length>0?{id:null,attachments:s.attachments}:null),le(s.replyTarget),requestAnimationFrame(()=>A.current?.focus())};if(e==="steer"){ct("queue"),await Qt(),await xe(s.body,{forceAction:"steer",attachments:s.attachments,replyTarget:s.replyTarget})==="failed"&&a();return}await xe(s.body,{attachments:s.attachments,replyTarget:s.replyTarget})==="failed"&&a()},Qn=e=>{ee(t=>t.filter(s=>s.id!==e)),Te(t=>t?.id===e?null:t)},Vn=e=>{const t=pe.find(s=>s.id===e);t&&(P(t.body),le(t.replyTarget??null),Te({id:e,attachments:t.attachments}),requestAnimationFrame(()=>{const s=A.current;s&&(s.focus(),s.setSelectionRange(s.value.length,s.value.length))}))},zn=()=>{Te(null),P(""),le(null),he.clear()},Jn=async e=>{const t=pe.find(a=>a.id===e);if(!t)return;ee(a=>a.filter(i=>i.id!==e)),await Qt(),await xe(t.body,{forceAction:"steer",attachments:t.attachments,replyTarget:t.replyTarget??null})==="failed"&&ee(a=>[t,...a])},dt=o.useCallback((e,t)=>{const s=t?.trim().replace(/^@+/,"")||null,a=s?`@${s}`:null,i=ie?.insertedMention?Zs(I,ie.insertedMention):I,l=!!(!M&&a&&!i.toLocaleLowerCase().includes(a.toLocaleLowerCase())),m=l&&a?i.trim()?`${i.trimEnd()} ${a} `:`${a} `:i;P(m),le({messageId:e.id,actorLabel:s?`@${s}`:e.actorName,preview:Xs(e),insertedMention:l?a:null}),requestAnimationFrame(()=>A.current?.focus())},[I,M,ie?.insertedMention]),Gn=o.useCallback(()=>{const e=ie?.insertedMention;le(null),e&&P(t=>Zs(t,e)),requestAnimationFrame(()=>A.current?.focus())},[ie]),Kt=o.useCallback(e=>{const t=new URL(window.location.href);k.view==="agents-v2"&&t.searchParams.set("tab","message"),t.hash=`msg-${e}`,Ke(t.toString())},[k.view]),js=o.useCallback((e,t,s)=>{const a=ca({conversationId:n,selectedMessageId:e.id,messages:T.map(i=>({id:i.id,actorLabel:i.id===e.id?t:_e(i,v)?v:i.actorName,body:i.body,attachmentCount:i.attachments?.length??0}))});h({intent:"forward-message",forwardContext:a,forwardContextMode:"selected-message",...s?{projectPath:s}:{}})},[n,T,h,v]),Qt=async()=>{if(x)try{await U("/api/agents/"+encodeURIComponent(x)+"/interrupt",{method:"POST",body:JSON.stringify({})})}catch{}},fe=j.tone==="working"||j.tone==="pending",Yn=Ks({isDm:M,hasOutstandingReply:bs}),Xn=M?`Message ${F} — type / to route or @ to mention an agent`:u?.kind==="channel"?`Comment in #${_a(u)} — mention @agent to request a reply`:`Comment in ${Et} — mention @agent to request a reply`,Rs=Se?.attachments??[],Zn=!I.trim()&&!he.hasFiles&&Rs.length===0&&fe,Vt=o.useRef(!1);o.useEffect(()=>{const e=Se?.id??null,t=e?pe.filter(a=>a.id!==e):pe;if(!Ka({isAgentBusy:fe,sending:W,queued:t})||Vt.current)return;const s=t[0];s&&(Vt.current=!0,ee(a=>a.filter(i=>i.id!==s.id)),xe(s.body,{attachments:s.attachments,replyTarget:s.replyTarget??null}).then(a=>{a==="failed"&&ee(i=>[s,...i])}).finally(()=>{Vt.current=!1}))},[fe,W,pe,Se]),o.useEffect(()=>{fe||ct("queue")},[fe]),o.useEffect(()=>{ee([]),Te(null),le(null),ct("queue"),he.clear()},[n]);const ea=Qa(pe),Es=ga(),ta=o.useCallback((e,t)=>{const s=window.getSelection()?.toString().trim(),a=_e(t,v),i=t.actorId?X.get(t.actorId):null,l=a?null:Ws(t,b,x),m=(i?.scopedAlias?.trim()||l?.handle?.trim()||null)?.replace(/^@+/,"")??null,R=m?`@${m}`:t.actorName,w=(l?.id||i?.agentId||t.actorId||"").trim(),p=[];a||p.push({kind:"action",label:"Reply",onSelect:()=>dt(t,m)}),p.push({kind:"action",label:"Forward to new task…",onSelect:()=>js(t,R,i?.workspaceRoot??l?.projectRoot??l?.cwd??void 0)}),p.push({kind:"separator"}),s&&p.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>{Ke(s)}}),p.push({kind:"action",label:"Copy Message",onSelect:()=>{Ke(t.body)}}),p.push({kind:"action",label:"Copy Link",onSelect:()=>Kt(t.id)}),p.push({kind:"separator"}),!a&&w&&p.push({kind:"action",label:"Copy Agent ID",onSelect:()=>{Ke(w)}}),p.push({kind:"action",label:"Copy Message ID",onSelect:()=>{Ke(t.id)}}),Es(e,p)},[x,dt,Kt,js,v,X,b,Es]),sa=async(e,t)=>{const s=`@${t.agentId} `,a=I.trim();if(a){P(""),await xe(`${s}${a}`,{forceAction:"invoke"});return}P(s),A.current?.focus()},We=o.useMemo(()=>{if(!u)return[];const e=new Set(u.participantIds);return b.filter(t=>!e.has(t.id)&&!t.retiredFromFleet).sort((t,s)=>t.name.localeCompare(s.name))},[u,b]);o.useEffect(()=>{Ct&&rt(e=>e&&We.some(t=>t.id===e)?e:We[0]?.id??"")},[Ct,We]);const Ls=!!(u&&["direct","group_direct","channel"].includes(u.kind)&&We.length>0),na=o.useCallback(async()=>{if(!u)return;const e=Mt.trim();if(e){kt(!0),Pe(null);try{const t=await U(`/api/conversations/${encodeURIComponent(u.id)}/members`,{method:"POST",body:JSON.stringify({actorId:e})});t.session?yt(t.session):yt(s=>s&&{...s,kind:t.kind,participantIds:t.participantIds}),at(!1),rt(""),await H({messageMode:"none"})}catch(t){Pe(t instanceof Error?t.message:String(t))}finally{kt(!1)}}},[Mt,H,u]);return r.jsx("div",{className:`s-thread-layout${f?" s-thread-layout--embedded":""}`,"data-thread-treatment":N==="standard"?void 0:N,children:r.jsxs("div",{className:"s-thread-center",children:[!f&&r.jsx(cr,{showBackNav:y,isDm:M,navigate:d,route:k,canonicalConversationId:Ss,threadTitle:Et,agentId:V?.id??null,sessionId:fs,detailRoute:dn,participants:Fn,operator:On,canAddParticipants:Ls,onToggleAddParticipant:()=>{Pe(null),at(e=>!e)}}),!f&&u&&r.jsx(dr,{canonicalConversationId:Ss,conversationAlias:Rn}),!f&&Ct&&Ls&&r.jsx(ur,{agents:We,addParticipantId:Mt,setAddParticipantId:rt,addingParticipant:pn,addParticipantError:hn,onCancel:()=>{at(!1),Pe(null)},onSubmit:()=>{na()}}),vt&&r.jsx(Nr,{pinnedAsk:vt,onAnswer:()=>{const e=[...T].reverse().find(t=>t.actorId===vt.agentId)??[...T].reverse().find(t=>!_e(t,v)&&t.class!=="status"&&t.class!=="system");e?dt(e,e.actorId?X.get(e.actorId)?.scopedAlias??null:null):A.current?.focus()},onSteer:Dt}),r.jsx(Ar,{presence:j,agent:V}),cs&&r.jsx("p",{className:"s-thread-error",children:cs}),r.jsxs("div",{className:"s-thread-feed",ref:Ze,onScroll:Dn,children:[!ls&&T.length>0&&cn&&r.jsx("div",{className:"s-thread-history-control",children:r.jsxs("button",{type:"button",className:"s-thread-history-button",disabled:ye,"aria-busy":ye,onClick:()=>{un()},children:[ye&&r.jsx("span",{className:"s-thread-history-spinner","aria-hidden":"true"}),ye?"Loading earlier messages…":"Load earlier messages"]})}),ls?r.jsx(Tr,{}):T.length===0?Lt?r.jsx(xr,{agentName:F,title:j.label,detail:j.detail||ue.latest,snapshot:ue,events:Me,steps:Z,phase:Ft,tone:En,workspaceName:it,branch:u?.currentBranch,startedAt:It,onOpenTrace:xs,onOpenTerminal:ks,onSteer:Dt}):r.jsxs("div",{className:"s-thread-empty",children:[r.jsx("div",{className:"s-thread-empty-glyph","aria-hidden":"true",children:M?"@":"#"}),r.jsx("p",{children:Et}),r.jsx("p",{children:M?"No messages yet. Send a message to start working with this agent.":"No messages yet. Start the conversation below."}),(it||u?.currentBranch)&&r.jsxs("div",{className:"s-thread-empty-chips",children:[it&&r.jsx("span",{className:"s-thread-empty-chip",children:it}),u?.currentBranch&&r.jsx("span",{className:"s-thread-empty-chip",children:u.currentBranch})]})]}):He.map((e,t)=>{const s=Va(e,t);if(e.kind==="fanout")return r.jsx(mr,{row:e,expanded:Pn.has(e.key),showDayDivider:s,onToggle:()=>qn(e.key)},e.key);const a=e.message,i=_e(a,v),l=za(a),m=l?"scout.dispatch":a.class,R=Xa(m),w=m==="status",p=Qs(a.createdAt),S=i?null:Ws(a,b,x),E=X.get(a.actorId)?.scopedAlias?.trim()||null,te=!i&&E?E:a.actorName,q=i?v.toLowerCase():E??S?.handle??null,K=Ja(a.body),Q=K?Ga({flightId:K.flightId,replyToMessageId:a.replyToMessageId,messagesById:me,agents:b,operatorName:v}):null,D=!K&&a.replyToMessageId?me.get(a.replyToMessageId)??null:null,se=D?_e(D,v)?v:D.actorName:null,ut=K?K.body:a.body,B=Vs(a);if(B&&wt.has(a.id))return null;const zt=typeof a.metadata?.targetAgentId=="string"?a.metadata.targetAgentId:null,C=B?Gt(b,[zt,B.target]):null,mt=B?Us({name:C?.name,id:C?.id,title:nr(B.target)}):null;return r.jsxs("div",{className:["s-thread-feed-block",i&&"s-thread-feed-block--you",s&&"s-thread-feed-block--full-width"].filter(Boolean).join(" "),children:[s&&r.jsx(hr,{at:a.createdAt}),B&&mt?r.jsxs("article",{id:`msg-${a.id}`,className:["s-thread-msg","s-thread-failure-notice",(ze||is?.has(a.id))&&"s-thread-msg--enter"].filter(Boolean).join(" "),style:ze?{animationDelay:`${Math.max(0,7-(He.length-1-t))*26}ms`}:void 0,"data-class":m,"aria-label":"Delivery issue",children:[r.jsx("span",{className:"s-thread-failure-notice-mark","aria-hidden":"true",children:"!"}),r.jsxs("div",{className:"s-thread-failure-notice-content",children:[r.jsxs("p",{children:[r.jsxs("strong",{children:[mt," couldn’t reply."]})," ",r.jsx("span",{children:B.explanation})]}),B.technicalDetail&&r.jsxs("details",{className:"s-thread-failure-notice-details",children:[r.jsx("summary",{children:"Technical details"}),r.jsx("pre",{children:B.technicalDetail})]}),r.jsxs("div",{className:"s-thread-failure-notice-actions",children:[a.replyToMessageId&&me.has(a.replyToMessageId)&&r.jsx("button",{className:"s-thread-failure-notice-action s-thread-failure-notice-action--primary",type:"button",disabled:W,onClick:()=>{Hn(a)},children:W?"Retrying…":"Retry"}),Bt&&r.jsx("button",{className:"s-thread-failure-notice-action",type:"button",onClick:()=>Wn(a,mt,B.explanation),children:"Ask @scoutbot"}),r.jsx("button",{className:"s-thread-failure-notice-action s-thread-failure-notice-action--clear",type:"button",onClick:()=>ps(a),"aria-label":`Clear delivery issue for ${mt}`,children:"Clear"})]})]}),r.jsx("span",{className:"s-thread-failure-notice-time",title:p,children:pt(a.createdAt)})]}):r.jsx("article",{id:`msg-${a.id}`,className:["s-thread-msg",i&&"s-thread-msg--you",w&&"s-thread-msg--tool",(ze||is?.has(a.id))&&"s-thread-msg--enter"].filter(Boolean).join(" "),style:ze?{animationDelay:`${Math.max(0,7-(He.length-1-t))*26}ms`}:void 0,"data-class":m,onContextMenu:O=>ta(O,a),children:r.jsx("div",{className:"s-thread-msg-card",children:r.jsxs("div",{className:"s-thread-msg-card-content",children:[r.jsxs("div",{className:"s-thread-msg-header",children:[r.jsxs("div",{className:"s-thread-msg-meta",children:[(()=>{const O=!i&&S?()=>ft(d,{view:"agents-v2",agentId:S.id},{returnTo:k}):null,$s=i?v:te??"?",Fs=r.jsx(es,{agent:S??void 0,name:$s,placement:"turn",size:28,className:"s-thread-msg-avatar",title:$s});return O?r.jsx("button",{type:"button",className:"s-thread-msg-avatar--nav",onClick:O,"aria-label":`View profile for ${a.actorName??"agent"}`,title:`View profile for ${a.actorName??"agent"}`,children:Fs}):Fs})(),!i&&S?r.jsx("button",{type:"button",className:"s-thread-msg-actor s-thread-msg-actor--nav",onClick:()=>ft(d,{view:"agents-v2",agentId:S.id},{returnTo:k}),title:`View profile for ${a.actorName}`,children:te}):r.jsx("span",{className:"s-thread-msg-actor",children:i?v:te}),q&&r.jsxs("span",{className:"s-thread-msg-handle",children:["@",q]}),R&&r.jsx("span",{className:"s-thread-msg-kind",children:R})]}),r.jsx("span",{className:"s-thread-msg-time",title:p,children:pt(a.createdAt)}),r.jsxs("span",{className:"s-thread-msg-actions",children:[!i&&q&&r.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":`Reply to @${q}`,title:`Reply to @${q}`,onClick:()=>dt(a,q),children:r.jsx(ss,{})}),r.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":"Copy link to message",title:"Copy link to message",onClick:()=>Kt(a.id),children:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M6.5 9.5a2.5 2.5 0 0 0 3.54 0l2.12-2.12a2.5 2.5 0 0 0-3.54-3.54l-.7.7"}),r.jsx("path",{d:"M9.5 6.5a2.5 2.5 0 0 0-3.54 0L3.84 8.62a2.5 2.5 0 0 0 3.54 3.54l.7-.7"})]})})]})]}),Q&&r.jsxs("button",{type:"button",className:"s-thread-reply-ctx",title:`Open the originating request${Q.flightId?` · ${Q.flightId}`:""}`,onClick:()=>lt(Q.originatingMessageId),children:[r.jsx(ss,{}),r.jsx("span",{className:"s-thread-reply-ctx-label",children:"reply to"}),r.jsx("span",{className:"s-thread-reply-ctx-title",children:Q.title}),r.jsxs("span",{className:"s-thread-reply-ctx-from",children:["· ",Q.from]}),r.jsx("span",{className:"s-thread-reply-ctx-status",children:"· done"})]}),D&&se&&r.jsxs("button",{type:"button",className:"s-thread-reply-ctx",title:`Open message from ${se}`,onClick:()=>lt(D.id),children:[r.jsx(ss,{}),r.jsx("span",{className:"s-thread-reply-ctx-label",children:"reply to"}),r.jsx("span",{className:"s-thread-reply-ctx-title",children:Xs(D)}),r.jsxs("span",{className:"s-thread-reply-ctx-from",children:["· ",se]})]}),r.jsx("div",{className:"s-thread-msg-body",title:p,children:r.jsx(sr,{text:ut})}),r.jsx(Wr,{message:a}),l&&l.candidates.length>0&&r.jsx("div",{className:"s-thread-dispatch",children:l.candidates.map(O=>r.jsxs("button",{type:"button",className:"s-thread-dispatch-tile",onClick:()=>{sa(l,O)},children:[r.jsxs("span",{className:"s-thread-dispatch-tile-id",children:["@",O.agentId]}),r.jsx("span",{className:"s-thread-dispatch-tile-state",children:O.endpointState}),r.jsx("span",{className:"s-thread-dispatch-tile-meta",children:[O.workspace,O.node,O.projectRoot].filter(Boolean).join(" · ")||O.displayName})]},O.agentId))})]})})})]},a.id)}),j.showTyping&&!Lt&&r.jsx("div",{className:"s-thread-feed-block",children:r.jsx("div",{className:"s-thread-msg","aria-live":"polite",children:r.jsxs("div",{className:Mn,children:[r.jsx(es,{agent:V??void 0,name:F,placement:"turn",size:28,className:"s-thread-msg-avatar s-thread-msg-avatar--working",title:F}),r.jsxs("div",{className:"s-thread-msg-card-content",children:[r.jsxs("div",{className:"s-thread-msg-header",children:[r.jsxs("div",{className:"s-thread-msg-meta",children:[r.jsx("span",{className:"s-thread-msg-actor",children:F}),r.jsx("span",{className:kn,children:Cn})]}),r.jsx("span",{className:"s-thread-msg-time",title:g?.startedAt?Qs(g.startedAt):"now",children:g?.startedAt?pt(g.startedAt):"now"})]}),r.jsxs("div",{className:"s-thread-msg-working-body",children:[r.jsxs("div",{className:Nn,children:[r.jsx("span",{className:An,"aria-hidden":"true"}),r.jsxs("div",{className:"s-thread-turn-snapshot-main",children:[r.jsx("span",{className:"s-thread-turn-snapshot-label",children:"Latest"}),r.jsx("span",{className:"s-thread-msg-working-copy",children:ue.latest})]})]}),r.jsxs("dl",{className:"s-thread-turn-snapshot-stats",children:[r.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[r.jsx("dt",{children:"Activity"}),r.jsx("dd",{children:ue.activityLabel})]}),r.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[r.jsx("dt",{children:"Elapsed"}),r.jsx("dd",{children:ue.elapsedLabel})]}),r.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[r.jsx("dt",{children:"Last"}),r.jsx("dd",{children:ue.lastActivityLabel})]})]}),Z.length>0||Ft?r.jsx(vr,{steps:Z,phase:Ft,limit:5,compact:!0}):r.jsx(Cr,{events:Me,limit:4,compact:!0}),r.jsx(Mr,{onOpenTrace:xs,onOpenTerminal:ks,onSteer:Dt,compact:!0})]})]})]})})}),ln&&Tt>0&&r.jsxs("button",{type:"button",className:"s-thread-new-messages",onClick:Bn,children:[r.jsx("span",{"aria-hidden":"true",children:"↓"})," ",Tt," new ",Tt===1?"message":"messages"," · jump to latest"]}),r.jsx("div",{ref:us})]}),j.showTyping&&r.jsxs("div",{className:In,children:[r.jsx("div",{className:"s-thread-presence-line-avatars",children:r.jsx(es,{agent:V??void 0,name:F,placement:"turn",size:22,className:"s-thread-presence-line-avatar",title:F})}),r.jsx("span",{className:"s-thread-presence-line-label",children:$n}),r.jsx("div",{className:jn,"aria-hidden":"true"})]}),r.jsx(ha,{composeRef:A,draft:I,setDraft:P,composePlaceholder:Xn,slashState:ce,setSlashState:Fe,filteredSlashCommands:fn,applySlashCommand:wn,mentionState:de,setMentionState:Oe,filteredMentions:gn,applyMention:Sn,updateTriggersFromDraft:bn,closeSuggestions:yn,replyTarget:ie,onCancelReply:Gn,isStopMode:Zn,sending:W,composeAction:Yn,onSend:()=>{Kn()},onInterrupt:()=>{Qt()},attachments:he,isAgentBusy:fe,busyIntent:Is,onBusyIntentChange:ct,queued:pe,queueNote:ea,onEditQueued:Vn,editingQueuedId:Se?.id??null,editingAttachmentCount:Rs.length,onCancelEdit:zn,onUnqueue:Qn,onSendQueuedNow:e=>{Jn(e)}})]})})}function ss(){return r.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("polyline",{points:"9 14 4 9 9 4"}),r.jsx("path",{d:"M20 20v-7a4 4 0 0 0-4-4H4"})]})}const hi=lr({id:"thread",label:"Thread",route:{view:"conversation",conversationId:""},webPath:"/chat",screen:"ConversationScreen",embed:{path:"/embed/thread",profile:"macos.thread",rootClassName:"s-thread-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},hosts:{macos:!0},resolveEmbedProps:er}});export{mi as ConversationScreen,hi as scoutSurface};