@openscout/scout 0.2.92 → 0.2.94

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 (507) hide show
  1. package/README.md +22 -28
  2. package/bin/scoutd +0 -0
  3. package/dist/build-manifest.json +3 -3
  4. package/dist/client/apple-touch-icon.png +0 -0
  5. package/dist/client/assets/ActivityScreen--eANwuxa.js +1 -0
  6. package/dist/client/assets/{AddProjectForm-CpyytDf2.js → AddProjectForm-CcD6qvV8.js} +1 -1
  7. package/dist/client/assets/AgentAvatar-CYhf6twS.js +1 -0
  8. package/dist/client/assets/AgentConfigurationScreen-BTI24HQX.js +1 -0
  9. package/dist/client/assets/AgentDefinitionsWorkspace-srmN6-vj.js +1 -0
  10. package/dist/client/assets/{AgentDetailCard-BTiOmh-a.js → AgentDetailCard-UqPNpcvB.js} +1 -1
  11. package/dist/client/assets/AgentFloorView-XXNgI5Cj.js +1 -0
  12. package/dist/client/assets/AgentInfoScreen-CimdOnZ9.js +1 -0
  13. package/dist/client/assets/{AgentLaneCard-lfRNb7JD.js → AgentLaneCard-Z-aOBR3W.js} +1 -1
  14. package/dist/client/assets/{AgentLaneChrome-Dlwrbq3g.js → AgentLaneChrome-CyhA1reW.js} +1 -1
  15. package/dist/client/assets/AgentLaneDetailSheet-BNzjMjIH.js +4 -0
  16. package/dist/client/assets/{AgentLaneSummaryResize-6SOEWUnr.js → AgentLaneSummaryResize-Box8-_rS.js} +1 -1
  17. package/dist/client/assets/AgentLanesEmbedScreen-BmLnN4on.js +1 -0
  18. package/dist/client/assets/{AgentLanesPreflight-C3uOiOzd.js → AgentLanesPreflight-5B6sXvRB.js} +1 -1
  19. package/dist/client/assets/AgentLanesView-DHyzVBk6.js +2 -0
  20. package/dist/client/assets/{AgentLiveActions-BJ5dIfL3.js → AgentLiveActions-BwuzOE8h.js} +1 -1
  21. package/dist/client/assets/AgentSessions-CsZwoukw.js +6 -0
  22. package/dist/client/assets/AgentsConsole-KCao4XmX.js +1 -0
  23. package/dist/client/assets/AgentsScreen-CtPAmwRX.js +1 -0
  24. package/dist/client/assets/AgentsSubnav-CDMjKeYC.js +1 -0
  25. package/dist/client/assets/AstronautSuit-Ckx7lu7G.js +1 -0
  26. package/dist/client/assets/AtopView-DYlpgEHf.js +1 -0
  27. package/dist/client/assets/{BackToPicker-D1LV6Cqp.js → BackToPicker-4JaeRvDm.js} +1 -1
  28. package/dist/client/assets/BriefingDetailScreen-D6-xqrpo.js +1 -0
  29. package/dist/client/assets/BriefingsScreen-DKxSDEmk.js +1 -0
  30. package/dist/client/assets/{BrokerMetadataPanel-BhjECqOK.js → BrokerMetadataPanel-BbREmsbK.js} +1 -1
  31. package/dist/client/assets/BrokerScreen-fbPIouMw.js +5 -0
  32. package/dist/client/assets/CastPicker-BcA2vDDV.js +1 -0
  33. package/dist/client/assets/CastPicker-zXsnkTIy.css +1 -0
  34. package/dist/client/assets/ChatCollapsedStrip-Ycm0ecaX.js +1 -0
  35. package/dist/client/assets/{CodeDiffPane-Bx_2VAzv.js → CodeDiffPane-Cn8Y9hAt.js} +1 -1
  36. package/dist/client/assets/{CodeProjectPicker-C1yOJKvs.js → CodeProjectPicker-nPFktrco.js} +1 -1
  37. package/dist/client/assets/CodeScreen-BlAxtxE5.js +1 -0
  38. package/dist/client/assets/ConversationComposer-2HjbGPL9.js +1 -0
  39. package/dist/client/assets/ConversationFeedRows-C6wUqJrx.js +1 -0
  40. package/dist/client/assets/ConversationHeader-C8vfXaTF.js +1 -0
  41. package/dist/client/assets/ConversationPanels-CNCIbpqU.js +6 -0
  42. package/dist/client/assets/ConversationScreen-BNULZAp2.js +2 -0
  43. package/dist/client/assets/ConversationScreen-CkWnKXt6.css +1 -0
  44. package/dist/client/assets/ConversationStatus-DZuyKsWN.js +1 -0
  45. package/dist/client/assets/CrewAvatar-CTIuxp4G.js +1 -0
  46. package/dist/client/assets/CrewAvatar-D0c9z5Qr.css +1 -0
  47. package/dist/client/assets/CrewWorkspaces-CJhBKVoZ.css +1 -0
  48. package/dist/client/assets/CrewWorkspaces-CkPYIA46.js +1 -0
  49. package/dist/client/assets/{DataTable-CJbbgBdA.js → DataTable-6IDhanr5.js} +1 -1
  50. package/dist/client/assets/DispatchAftermath-DC1u9itO.js +1 -0
  51. package/dist/client/assets/DocumentFocusViewer-DZVhS7as.js +1 -0
  52. package/dist/client/assets/{EmbeddableSurfacesLab-BdsYRDky.js → EmbeddableSurfacesLab-BKUFJMCV.js} +1 -1
  53. package/dist/client/assets/{EmptyState-BRY5jTpz.js → EmptyState-CeBl0iGd.js} +1 -1
  54. package/dist/client/assets/{FileViewerPane-9Bveqm9c.js → FileViewerPane-DQlpNt2S.js} +2 -2
  55. package/dist/client/assets/FlightObserveScreen-CDWGSKZg.js +1 -0
  56. package/dist/client/assets/FollowScreen-BXHOp3gb.js +1 -0
  57. package/dist/client/assets/{HarnessMark-BPAphNjx.js → HarnessMark-D5CA5uSp.js} +1 -1
  58. package/dist/client/assets/HarnessesScreen-DhFXq1qz.js +1 -0
  59. package/dist/client/assets/{HerdrSession-BujfGzrP.js → HerdrSession-BRhs5LIR.js} +1 -1
  60. package/dist/client/assets/HomeHero-7JwycwFY.css +1 -0
  61. package/dist/client/assets/HomeHero-DMABJuze.js +1 -0
  62. package/dist/client/assets/HostAdvisorView-RAociATV.js +1 -0
  63. package/dist/client/assets/{KnowledgeSearchInspector-B4ZY24xE.js → KnowledgeSearchInspector-CZPyVNSw.js} +1 -1
  64. package/dist/client/assets/KnowledgeSearchScreen-mGTKIg00.js +1 -0
  65. package/dist/client/assets/{LaneToolHoverCard-B7KdvQvf.js → LaneToolHoverCard-D_DMlBeT.js} +1 -1
  66. package/dist/client/assets/LaneTraceDetailSheet-BEHg3LmH.js +1 -0
  67. package/dist/client/assets/{LaneTraceEventFocus-mkMw2wJU.js → LaneTraceEventFocus-DVimcizS.js} +1 -1
  68. package/dist/client/assets/{MeshCanvas-CpKcWxKy.js → MeshCanvas-BOuZx4AM.js} +2 -2
  69. package/dist/client/assets/{MeshCanvasMinimap-C9IoGHbe.js → MeshCanvasMinimap-wL-1N94e.js} +1 -1
  70. package/dist/client/assets/MeshScreen-DMY9Bmh5.js +1 -0
  71. package/dist/client/assets/{MeshTopologyView-DFzr0IZM.js → MeshTopologyView-DiDcX5f4.js} +2 -2
  72. package/dist/client/assets/MessagesScreen-Eulveud3.js +1 -0
  73. package/dist/client/assets/{MissionContextRail-Y8QxUZGE.js → MissionContextRail-DrNKXG5u.js} +1 -1
  74. package/dist/client/assets/MissionControlView-ByBlHVN8.js +1 -0
  75. package/dist/client/assets/MissionFocusOverlay-D1i6R6Zt.js +1 -0
  76. package/dist/client/assets/MissionLeftAgentRow-DN9NcCML.js +1 -0
  77. package/dist/client/assets/MissionLogPane-DSeIv3Xo.js +1 -0
  78. package/dist/client/assets/NewAgentModal-V7yK6J6j.js +1 -0
  79. package/dist/client/assets/NewChatComposer-hlWT-nbR.js +19 -0
  80. package/dist/client/assets/{NewChatOrigin-DmuJ32wa.js → NewChatOrigin-DdpzE4kz.js} +1 -1
  81. package/dist/client/assets/ObserveEmbedScreen-l_Q3ts2q.js +2 -0
  82. package/dist/client/assets/ObserveTextFlow-BSEtYTxU.js +2 -0
  83. package/dist/client/assets/ObservedTopologyPanel-CdGUXxGR.js +2 -0
  84. package/dist/client/assets/OpenScoutAppShell-DN8dOSK4.js +79 -0
  85. package/dist/client/assets/OpsAgentsView-ntGr4pz4.js +1 -0
  86. package/dist/client/assets/OpsScreen-Ppen_Lmj.js +1 -0
  87. package/dist/client/assets/OpsSubnav-GAKsoSor.js +1 -0
  88. package/dist/client/assets/ProjectAgentProfile-BLlp2e6t.js +1 -0
  89. package/dist/client/assets/{ProjectAgentProfileBar-BLVg5EeA.js → ProjectAgentProfileBar-BQET-qrY.js} +1 -1
  90. package/dist/client/assets/ProjectAgentProfileHero-Ck8mThtx.js +1 -0
  91. package/dist/client/assets/ProjectsInbox-Dlt8OQ8O.js +2 -0
  92. package/dist/client/assets/ProjectsRail-DCfNMmnW.js +1 -0
  93. package/dist/client/assets/ProjectsScreen-BP-hmI1m.js +1 -0
  94. package/dist/client/assets/ProjectsThreadAside-CWpMjGIH.js +1 -0
  95. package/dist/client/assets/Provider-B2xuo3rf.js +1 -0
  96. package/dist/client/assets/RailRow-B-GycCBx.js +1 -0
  97. package/dist/client/assets/RailRow-B0sRaJc6.css +1 -0
  98. package/dist/client/assets/RawSessionsTable-AQThi6sm.js +1 -0
  99. package/dist/client/assets/RealtimeVoiceScreen-D7zZHK_t.js +1 -0
  100. package/dist/client/assets/{RepoDiffEmbedScreen-BCDXFE3D.js → RepoDiffEmbedScreen-DXWoRF_c.js} +1 -1
  101. package/dist/client/assets/{RepoDiffPageScreen-m62FiWXC.js → RepoDiffPageScreen-D_274ExO.js} +1 -1
  102. package/dist/client/assets/RepoDiffViewer-DbedmHDX.js +7 -0
  103. package/dist/client/assets/RepoDiffViewerLazy-C0--fPtk.js +2 -0
  104. package/dist/client/assets/ReposScreen-D39_YG4H.js +6 -0
  105. package/dist/client/assets/ScoutDeckSurface-CKT3qdqY.js +1 -0
  106. package/dist/client/assets/{ScoutSurface-CkgT7A-c.js → ScoutSurface-UsRy0t-I.js} +1 -1
  107. package/dist/client/assets/{ScoutbotFxLab-D-kV5j4T.js → ScoutbotFxLab-Fmdfboxs.js} +1 -1
  108. package/dist/client/assets/{SecondaryNav-_wyKjwNf.js → SecondaryNav-o2RL9H8H.js} +1 -1
  109. package/dist/client/assets/{SessionEmbedScreen-CJZmIBV7.js → SessionEmbedScreen-RD5XOx7R.js} +1 -1
  110. package/dist/client/assets/{SessionObserve-yYA8Gy5s.js → SessionObserve-Dsd0j05N.js} +9 -9
  111. package/dist/client/assets/{SessionObserveEvidence-cHdjYOJe.js → SessionObserveEvidence-DopQYDkD.js} +1 -1
  112. package/dist/client/assets/SessionRefScreen-B_cTv47v.js +1 -0
  113. package/dist/client/assets/SessionsScreen-Bq0Z77On.js +1 -0
  114. package/dist/client/assets/SettingsDrawer-R8a0TlJD.css +1 -0
  115. package/dist/client/assets/SettingsDrawer-_AwuopMS.js +3 -0
  116. package/dist/client/assets/SettingsScreen-Cw4DDfJP.js +1 -0
  117. package/dist/client/assets/{ShikiPane-dBS9hD-z.js → ShikiPane-BfHc_3pM.js} +1 -1
  118. package/dist/client/assets/{SlidePanel-CH-3-8_2.js → SlidePanel-C-q7XwTa.js} +1 -1
  119. package/dist/client/assets/SpriteAvatar-Bs68ZENy.js +1 -0
  120. package/dist/client/assets/{StatusPill-C8m9ZymF.js → StatusPill-ZZQwxB1a.js} +1 -1
  121. package/dist/client/assets/{TailView-B0BSopPs.js → TailView-Q4FVMsUH.js} +2 -2
  122. package/dist/client/assets/Terminal-D7zqHwHV.js +1 -0
  123. package/dist/client/assets/TerminalEmbedScreen-CXIJ7qv6.js +1 -0
  124. package/dist/client/assets/TerminalHeaderMount-BnBLOPbb.js +1 -0
  125. package/dist/client/assets/{TextDocumentSurface-BWJCGBZf.js → TextDocumentSurface-CKQP-cBT.js} +1 -1
  126. package/dist/client/assets/{TmuxPeek-B4QdHbGm.js → TmuxPeek-V9dGESfO.js} +1 -1
  127. package/dist/client/assets/{VoicePermissionsPanel-Dd4ITJy_.js → VoicePermissionsPanel-k7sbLXx2.js} +1 -1
  128. package/dist/client/assets/WorkDetailScreen-60p9litn.js +5 -0
  129. package/dist/client/assets/WorkFilesViewer-BjJS7GyM.js +1 -0
  130. package/dist/client/assets/{activity-CC8JzJNH.js → activity-Bj3Hnbj3.js} +1 -1
  131. package/dist/client/assets/{addon-fit-CaZ-uLrg.js → addon-fit-BL-NTWRU.js} +1 -1
  132. package/dist/client/assets/{addon-webgl-B8utL3bM.js → addon-webgl-CIMgmNjg.js} +1 -1
  133. package/dist/client/assets/{ScoutbotBroadcastChip-CxtYZWPZ.css → agent-autocomplete-C7xwIcwd.css} +1 -1
  134. package/dist/client/assets/agent-autocomplete-DXlvdc4b.js +10 -0
  135. package/dist/client/assets/{agent-essentials-B3wcxg_v.js → agent-essentials-BOMHR0_U.js} +1 -1
  136. package/dist/client/assets/{agent-lane-card-model-q4cwzLX4.js → agent-lane-card-model-CTLxf3R4.js} +1 -1
  137. package/dist/client/assets/agent-lane-detail-ppJId6Jc.js +2 -0
  138. package/dist/client/assets/{agent-lane-preview-C33Dwpn7.js → agent-lane-preview-BhplDYGf.js} +1 -1
  139. package/dist/client/assets/{agent-lanes-BDNktFBZ.css → agent-lanes-DlqcEf0l.css} +1 -1
  140. package/dist/client/assets/{agent-lanes-model-VYQ5a68i.js → agent-lanes-model-AfrjRNK5.js} +2 -2
  141. package/dist/client/assets/agent-specialization-BIPIBW8u.js +1 -0
  142. package/dist/client/assets/api-Co9aQ2Jw.js +1 -0
  143. package/dist/client/assets/{api-BkjHJfgJ.js → api-HFH8wFyb.js} +1 -1
  144. package/dist/client/assets/{arc.es-uFv9UrHn.js → arc.es-IR5r6sj_.js} +1 -1
  145. package/dist/client/assets/archive-BjcGiAy8.js +1 -0
  146. package/dist/client/assets/{arrow-down-w1HPzDSE.js → arrow-down-BydciYFZ.js} +1 -1
  147. package/dist/client/assets/{arrow-left-B-3GJ7ct.js → arrow-left-CghA0kTw.js} +1 -1
  148. package/dist/client/assets/arrow-right-iJFv3jNh.js +1 -0
  149. package/dist/client/assets/{arrow-up-right-G6bJXxhK.js → arrow-up-right-CCfZXPqD.js} +1 -1
  150. package/dist/client/assets/{bot-DzCOGKi6.js → bot-B5sub1-i.js} +1 -1
  151. package/dist/client/assets/broker-display-Q75fupqG.js +2 -0
  152. package/dist/client/assets/{cache-Dr0why2k.js → cache-CeWH_KzJ.js} +1 -1
  153. package/dist/client/assets/{check-BX8nRgop.js → check-C18YQC90.js} +1 -1
  154. package/dist/client/assets/{chevron-down-B3VVRJcV.js → chevron-down-Mp9mu_yd.js} +1 -1
  155. package/dist/client/assets/{chevron-right-BYMV1511.js → chevron-right-CzH-TaSF.js} +1 -1
  156. package/dist/client/assets/{chunk-HRAB3GC3-dRd2eQMJ.js → chunk-HRAB3GC3-swV8PA2k.js} +1 -1
  157. package/dist/client/assets/{chunk-JTPDIGGW-BjX67kHU.js → chunk-JTPDIGGW-BKXqcLKw.js} +3 -3
  158. package/dist/client/assets/{chunk-T65CQEWV-kP6nJjkU.js → chunk-T65CQEWV-vYbNJ8E6.js} +1 -1
  159. package/dist/client/assets/{chunk-YOZR3KYS-C13bZPVd.js → chunk-YOZR3KYS-U65yUmqt.js} +1 -1
  160. package/dist/client/assets/{clock-B9ukVaVn.js → clock-B4PTFi5m.js} +1 -1
  161. package/dist/client/assets/{code-xml-BFc3TMSm.js → code-xml-Jtxsp5d1.js} +1 -1
  162. package/dist/client/assets/collapsed-strip-raJWthAH.css +1 -0
  163. package/dist/client/assets/compass-0_54-vz3.js +1 -0
  164. package/dist/client/assets/content-6RvWTrtk.js +1 -0
  165. package/dist/client/assets/content-BCgwMUqz.js +1 -0
  166. package/dist/client/assets/content-Bf2VLhx0.js +1 -0
  167. package/dist/client/assets/content-BrU_38-m.js +1 -0
  168. package/dist/client/assets/content-BvvJN8rN.js +1 -0
  169. package/dist/client/assets/content-CAeEqYPw.js +1 -0
  170. package/dist/client/assets/content-CHghn-rT.js +1 -0
  171. package/dist/client/assets/{content-Uqt8AG-s.css → content-CINHz-rZ.css} +1 -1
  172. package/dist/client/assets/content-CI_Z9DXk.js +1 -0
  173. package/dist/client/assets/content-CbyKONhW.js +1 -0
  174. package/dist/client/assets/content-Czogvp43.js +1 -0
  175. package/dist/client/assets/content-DFk0zNzX.js +1 -0
  176. package/dist/client/assets/content-DHe4DgkA.js +1 -0
  177. package/dist/client/assets/content-DMbawvqU.js +1 -0
  178. package/dist/client/assets/content-DTz7cKjo.js +1 -0
  179. package/dist/client/assets/content-E3kudY-W.js +1 -0
  180. package/dist/client/assets/content-LpO0aO_U.js +1 -0
  181. package/dist/client/assets/{conversation-icons-gpsv650H.js → conversation-icons-BV10B2Me.js} +1 -1
  182. package/dist/client/assets/conversation-model-CwF6Y9gx.js +1 -0
  183. package/dist/client/assets/conversation-motion-features-BKkCRaWR.js +1 -0
  184. package/dist/client/assets/{copy-BFmOcWof.js → copy-Dtpx4FOE.js} +1 -1
  185. package/dist/client/assets/cpu-BjVis9mc.js +1 -0
  186. package/dist/client/assets/{createLucideIcon-CFBn0Sdk.js → createLucideIcon-DXpqZP7I.js} +1 -1
  187. package/dist/client/assets/credentials-BTce3VP1.js +1 -0
  188. package/dist/client/assets/ctx-panel-D_HJ3nhb.css +1 -0
  189. package/dist/client/assets/discover-CHbrEItO.js +2 -0
  190. package/dist/client/assets/embed-entry-vil28MyU.js +2 -0
  191. package/dist/client/assets/{external-link-B1TI5yIt.js → external-link-Ckiyzjwo.js} +1 -1
  192. package/dist/client/assets/{eye-1J4yOUoG.js → eye-CpfyvdLq.js} +1 -1
  193. package/dist/client/assets/file-code-corner-7mo7EviR.js +1 -0
  194. package/dist/client/assets/{file-text-DcYSrI4v.js → file-text-KijGBnME.js} +1 -1
  195. package/dist/client/assets/gauge-y-Xg8Mrv.js +1 -0
  196. package/dist/client/assets/gestures-Bq9XnSqY.js +1 -0
  197. package/dist/client/assets/git-branch-BQ_x8KZL.js +1 -0
  198. package/dist/client/assets/harnesses-screen-2z36fJKE.css +1 -0
  199. package/dist/client/assets/home-moving-signal-DMguaRWR.css +1 -0
  200. package/dist/client/assets/home-moving-signal-DtRpiNa0.js +1 -0
  201. package/dist/client/assets/home-now-card-DFb4GOgM.js +1 -0
  202. package/dist/client/assets/{home-now-card-nano-y1EhBvVL.js → home-now-card-nano-D--m9jpq.js} +1 -1
  203. package/dist/client/assets/hooks-9d1SoaQA.js +2 -0
  204. package/dist/client/assets/host-advisor-B2Fqs5Dd.css +1 -0
  205. package/dist/client/assets/index-BVlMw8x_.js +1 -0
  206. package/dist/client/assets/index-CZ-05hKz.js +10 -0
  207. package/dist/client/assets/index-Cn0GR-q1.js +1 -0
  208. package/dist/client/assets/index-DosI4AG9.js +1 -0
  209. package/dist/client/assets/index-i7TMxlwW.css +1 -0
  210. package/dist/client/assets/index-wLwc74Pu.css +1 -0
  211. package/dist/client/assets/inspector-panel-C-EhEDYy.js +2 -0
  212. package/dist/client/assets/{keyboard-nav-h1IdakpD.js → keyboard-nav-DFhAJkW3.js} +1 -1
  213. package/dist/client/assets/{lane-observe-BA3g9aVd.js → lane-observe-vfyACHi0.js} +1 -1
  214. package/dist/client/assets/{lane-roster-store-71vFgAem.js → lane-roster-store-gUBsydNf.js} +1 -1
  215. package/dist/client/assets/layers-CGou-LwV.js +1 -0
  216. package/dist/client/assets/layout-grid-BrZt31QH.js +1 -0
  217. package/dist/client/assets/left-B_o51JV6.js +1 -0
  218. package/dist/client/assets/left-BpgWnaah.js +1 -0
  219. package/dist/client/assets/left-CwHZCGO3.js +2 -0
  220. package/dist/client/assets/left-CwLs0okF.js +1 -0
  221. package/dist/client/assets/left-Cx0kv6pe.js +1 -0
  222. package/dist/client/assets/left-DA0amyfu.js +1 -0
  223. package/dist/client/assets/left-DH44V4I_.css +1 -0
  224. package/dist/client/assets/left-R2OOE7VG.css +1 -0
  225. package/dist/client/assets/left-advisor-DU3s01gk.js +1 -0
  226. package/dist/client/assets/left-agents-qL5PpUY-.js +1 -0
  227. package/dist/client/assets/left-default-uvuvDmt0.js +1 -0
  228. package/dist/client/assets/left-lanes-DnNLgec8.js +1 -0
  229. package/dist/client/assets/left-mission-DN3-NLPC.js +1 -0
  230. package/dist/client/assets/left-z-6CkuBe.js +2 -0
  231. package/dist/client/assets/library-DIo5NiGP.js +1 -0
  232. package/dist/client/assets/{loader-circle-d6PKL_KD.js → loader-circle-BiohlpM3.js} +1 -1
  233. package/dist/client/assets/{local-agents-B5pq17tZ.js → local-agents-wUIaBcEr.js} +1 -1
  234. package/dist/client/assets/{mentions-agCGDgyA.js → mentions-CcPFMbmZ.js} +1 -1
  235. package/dist/client/assets/mesh-buckets-ByyFXdKT.js +1 -0
  236. package/dist/client/assets/{mesh-ops-5pZCYptW.js → mesh-ops-CvGyjK84.js} +1 -1
  237. package/dist/client/assets/mesh-roster-n2nDpEmA.js +1 -0
  238. package/dist/client/assets/{mesh-screen-BSDUjrnV.css → mesh-screen-D1Yvo8fU.css} +1 -1
  239. package/dist/client/assets/{mesh-view-store-KJzABIkN.js → mesh-view-store-BpxGm71b.js} +1 -1
  240. package/dist/client/assets/{message-circle-CJO-pi7b.js → message-circle-B2ddzBrX.js} +1 -1
  241. package/dist/client/assets/{message-markup-CyRDLdOn.js → message-markup-RkfmDfME.js} +1 -1
  242. package/dist/client/assets/{message-square-D1hMsMj_.js → message-square-D9YYWE0x.js} +1 -1
  243. package/dist/client/assets/message-visibility-DwxgcgYK.js +1 -0
  244. package/dist/client/assets/mission-control-CnU7dNt1.css +1 -0
  245. package/dist/client/assets/{mission-control-store-Ce6dOvnZ.js → mission-control-store-Bf4b54MV.js} +1 -1
  246. package/dist/client/assets/{observe-BSWVM8YA.js → observe-CJRIvOCn.js} +1 -1
  247. package/dist/client/assets/{operator-attention-BwSPeheT.js → operator-attention-RqieiSY8.js} +1 -1
  248. package/dist/client/assets/{page-status-D2FQLJOX.js → page-status-BptpTdQ-.js} +1 -1
  249. package/dist/client/assets/{paperclip-iZmDMOS5.js → paperclip-B1UNGl5d.js} +1 -1
  250. package/dist/client/assets/perf-PX8Rx0EP.js +1 -0
  251. package/dist/client/assets/persistent-state-YI-WHSCF.js +1 -0
  252. package/dist/client/assets/{plus-gZ0T0eBI.js → plus-CuU_X0-8.js} +1 -1
  253. package/dist/client/assets/profile-rY8jO38P.js +1 -0
  254. package/dist/client/assets/projects-inbox-BBs1hG13.css +1 -0
  255. package/dist/client/assets/projects-inbox-D-zAb9Gp.js +1 -0
  256. package/dist/client/assets/proxy-DnLpZIi9.js +1 -0
  257. package/dist/client/assets/{radio-RMLfV4EO.js → radio-Dm1ItnA4.js} +1 -1
  258. package/dist/client/assets/{refresh-cw-C4x1x6b_.js → refresh-cw-BRn9Oxxl.js} +1 -1
  259. package/dist/client/assets/resolve-panes-DO6LkwhQ.js +1 -0
  260. package/dist/client/assets/resolve-sidebar-context-CIF288wY.js +1 -0
  261. package/dist/client/assets/right-BJltPRnd.js +1 -0
  262. package/dist/client/assets/right-BbyYdzHn.js +1 -0
  263. package/dist/client/assets/right-Beh3nCUB.js +1 -0
  264. package/dist/client/assets/right-C1yumXNx.js +1 -0
  265. package/dist/client/assets/{right-D-k9Z1Fe.js → right-CJnB_Bg7.js} +2 -2
  266. package/dist/client/assets/right-CPP7GyOm.js +1 -0
  267. package/dist/client/assets/right-D3aTKf1F.js +1 -0
  268. package/dist/client/assets/right-DI1B79nR.js +1 -0
  269. package/dist/client/assets/right-DtsRNX5b.js +1 -0
  270. package/dist/client/assets/right-Shpw_xDy.js +1 -0
  271. package/dist/client/assets/{rocket-CMM-IdLy.js → rocket-DOwXHKWA.js} +1 -1
  272. package/dist/client/assets/router-DJj2WbDg.js +1 -0
  273. package/dist/client/assets/{scope-views-BIfMTXU4.js → scope-views-A4_vP97W.js} +1 -1
  274. package/dist/client/assets/scout-voice-BhPzrc6P.js +1 -0
  275. package/dist/client/assets/{scoutbot-BTIErYHo.js → scoutbot-BJIamJOH.js} +2 -2
  276. package/dist/client/assets/scoutbot-markdown-jh7tzFB1.js +6 -0
  277. package/dist/client/assets/{scroll-text-DPPYrqB9.js → scroll-text-DO0GQzvN.js} +1 -1
  278. package/dist/client/assets/{search-DAyagUtF.js → search-D1tJSAWe.js} +1 -1
  279. package/dist/client/assets/secondaryNavConfig-B9IF8wXl.js +1 -0
  280. package/dist/client/assets/{selection-bridge-BXw09aRF.js → selection-bridge-i2S9zpf8.js} +1 -1
  281. package/dist/client/assets/{send-horizontal-IcG46D2M.js → send-horizontal-CgLppsIC.js} +1 -1
  282. package/dist/client/assets/{server-BySujhDV.js → server-Dymv5Emh.js} +1 -1
  283. package/dist/client/assets/{session-catalog-ClS9xf6i.js → session-catalog-DNaOEzoQ.js} +1 -1
  284. package/dist/client/assets/{session-table-BdpHs1GN.js → session-table-PTQVoTyc.js} +1 -1
  285. package/dist/client/assets/settings-2fC_G9nX.js +1 -0
  286. package/dist/client/assets/{sliders-horizontal-R5pWUUcH.js → sliders-horizontal-BPSMHhbm.js} +1 -1
  287. package/dist/client/assets/{sparkles-DJOBD_8l.js → sparkles-Dy8p5xN8.js} +1 -1
  288. package/dist/client/assets/sse-CiOSzE5n.js +1 -0
  289. package/dist/client/assets/system-surfaces-redesign-QVXNeGYw.css +1 -0
  290. package/dist/client/assets/{tail-display-BRcJltQa.js → tail-display-DcliDVkW.js} +1 -1
  291. package/dist/client/assets/{tail-events-BdvqZHLr.js → tail-events-BMQmSx1n.js} +1 -1
  292. package/dist/client/assets/{terminal-relay-TffuSPGs.js → terminal-relay-9lhzEp2V.js} +1 -1
  293. package/dist/client/assets/terminal-screen-BLk4PAYt.css +1 -0
  294. package/dist/client/assets/terminal-sessions-BQ6t92tJ.js +1 -0
  295. package/dist/client/assets/{terminal-takeover-BOFPRPjR.js → terminal-takeover-DANQfTcy.js} +1 -1
  296. package/dist/client/assets/{terminal-DJPUp_Qn.js → terminal-yN9xN-h9.js} +1 -1
  297. package/dist/client/assets/{runtime-picker--IW3cRry.js → text-CnZ0e1-V.js} +1 -1
  298. package/dist/client/assets/text-rLpBg4_z.css +1 -0
  299. package/dist/client/assets/use-conversation-list-D9BNLfnW.js +1 -0
  300. package/dist/client/assets/{use-fleet-active-asks-BHzeBZSW.js → use-fleet-active-asks-BeAdcl09.js} +1 -1
  301. package/dist/client/assets/{use-mesh-ops-items-KmaauBr_.js → use-mesh-ops-items-BIvIHlqe.js} +1 -1
  302. package/dist/client/assets/use-reduced-motion-CKkhq9c5.js +1 -0
  303. package/dist/client/assets/{use-scout-dev-flags-BJbw87PK.js → use-scout-dev-flags-B2KCzPxn.js} +1 -1
  304. package/dist/client/assets/{useAgentHoverCard-C6o0tlat.js → useAgentHoverCard-CHBsxcbp.js} +1 -1
  305. package/dist/client/assets/useContentSecondaryNav-D0mUhxTF.js +1 -0
  306. package/dist/client/assets/{usePierreRuntime-Cm7-qdm0.js → usePierreRuntime-DUuXH5yp.js} +1 -1
  307. package/dist/client/assets/{wrench-CvRjjByE.js → wrench-YcXMlsh2.js} +1 -1
  308. package/dist/client/assets/{x-C8ayPBtj.js → x-e3h2hDsp.js} +1 -1
  309. package/dist/client/assets/{xterm-B0ci4Q9a.js → xterm-Byp1Hep_.js} +1 -1
  310. package/dist/client/assets/zap-nMcjPoWB.js +1 -0
  311. package/dist/client/favicon-16.png +0 -0
  312. package/dist/client/favicon-32.png +0 -0
  313. package/dist/client/favicon.ico +0 -0
  314. package/dist/client/favicon.svg +20 -47
  315. package/dist/client/index.html +5 -5
  316. package/dist/client/openscout-icon.png +0 -0
  317. package/dist/client/site.webmanifest +2 -2
  318. package/dist/client/web-app-icon-192.png +0 -0
  319. package/dist/client/web-app-icon-512.png +0 -0
  320. package/dist/main.mjs +20093 -78203
  321. package/dist/node/main.mjs +322 -252
  322. package/dist/pairing-runtime-controller.mjs +1032 -804
  323. package/dist/runtime/base-daemon.mjs +49 -121
  324. package/dist/runtime/broker-daemon.mjs +1105 -281
  325. package/dist/runtime/broker-process-manager.mjs +6 -0
  326. package/dist/runtime/mesh-discover.mjs +6 -0
  327. package/dist/scout-control-plane-web.mjs +3326 -1912
  328. package/package.json +7 -4
  329. package/dist/client/assets/ActivityScreen-DkUP7V7M.js +0 -1
  330. package/dist/client/assets/AgentAvatar-D8ZtMluU.js +0 -1
  331. package/dist/client/assets/AgentConfigurationScreen-BlGI6fuM.js +0 -1
  332. package/dist/client/assets/AgentDefinitionsWorkspace-CfaDVCVt.js +0 -1
  333. package/dist/client/assets/AgentFloorView-DjNLILLt.js +0 -1
  334. package/dist/client/assets/AgentInfoScreen-DG5dlHb_.js +0 -1
  335. package/dist/client/assets/AgentLaneDetailSheet-BzYzBfcW.js +0 -4
  336. package/dist/client/assets/AgentLanesEmbedScreen-Crxx1srt.js +0 -1
  337. package/dist/client/assets/AgentLanesView-ChNlmY-F.js +0 -2
  338. package/dist/client/assets/AgentSessions-DpY0htZV.js +0 -6
  339. package/dist/client/assets/AgentsConsole-CHyXrjhm.js +0 -1
  340. package/dist/client/assets/AgentsScreen-BhCjX2lD.js +0 -1
  341. package/dist/client/assets/AgentsSubnav-az_VDkri.js +0 -1
  342. package/dist/client/assets/AtopView-BjjPM8OX.js +0 -1
  343. package/dist/client/assets/BriefingDetailScreen-B7qJ90Np.js +0 -6
  344. package/dist/client/assets/BriefingsScreen-CW6N829d.js +0 -1
  345. package/dist/client/assets/BrokerScreen-X3z50712.js +0 -5
  346. package/dist/client/assets/ChatCollapsedStrip-DNR9osDy.js +0 -1
  347. package/dist/client/assets/CodeScreen-CIKK1LcZ.js +0 -1
  348. package/dist/client/assets/ContextMenu-CHIuVKz7.js +0 -1
  349. package/dist/client/assets/ConversationComposer-Bf7Ga_49.js +0 -1
  350. package/dist/client/assets/ConversationFeedRows-Cm1Lgo43.js +0 -1
  351. package/dist/client/assets/ConversationHeader-B_GXrKR0.js +0 -1
  352. package/dist/client/assets/ConversationPanels-BTBbEvrP.js +0 -2
  353. package/dist/client/assets/ConversationScreen-B3l2m3JI.js +0 -1
  354. package/dist/client/assets/ConversationScreen-yIKEsm-8.css +0 -1
  355. package/dist/client/assets/ConversationStatus-BqhUHD85.js +0 -1
  356. package/dist/client/assets/DispatchAftermath-BDA9CrOd.js +0 -1
  357. package/dist/client/assets/DocumentFocusViewer-B9vodVmG.js +0 -1
  358. package/dist/client/assets/FleetSearch-Bj9SCl2f.js +0 -1
  359. package/dist/client/assets/FleetSearch-EXOe8ulE.css +0 -1
  360. package/dist/client/assets/FlightObserveScreen-BVMdsiCC.js +0 -1
  361. package/dist/client/assets/FollowScreen-BifwHWOV.js +0 -1
  362. package/dist/client/assets/HarnessesScreen-fMnbnrD4.js +0 -1
  363. package/dist/client/assets/HomeHero-BgM6S39l.js +0 -1
  364. package/dist/client/assets/HomeHero-DEl-WBsT.css +0 -1
  365. package/dist/client/assets/KnowledgeSearchScreen-Ch_WENUC.js +0 -1
  366. package/dist/client/assets/LaneTraceDetailSheet-H3AnN-vN.js +0 -1
  367. package/dist/client/assets/MeshScreen-48QkJSDI.js +0 -1
  368. package/dist/client/assets/MessageComposerSuggestions-FdVHnT_q.js +0 -1
  369. package/dist/client/assets/MessagesScreen-BMOOfbWX.js +0 -1
  370. package/dist/client/assets/MissionControlView-BpsHKu1F.js +0 -1
  371. package/dist/client/assets/MissionFocusOverlay-BPnAEA3F.js +0 -1
  372. package/dist/client/assets/MissionLeftAgentRow-iOZ6ds9L.js +0 -1
  373. package/dist/client/assets/MissionLogPane-B0csI89E.js +0 -1
  374. package/dist/client/assets/NewAgentModal-DBHJR9Qm.js +0 -1
  375. package/dist/client/assets/NewChatComposer-Hd7pI5Ac.js +0 -19
  376. package/dist/client/assets/ObserveEmbedScreen-DyArn7Id.js +0 -2
  377. package/dist/client/assets/ObserveTextFlow-CkMrtT8s.js +0 -2
  378. package/dist/client/assets/ObservedTopologyPanel-CaSZZP05.js +0 -2
  379. package/dist/client/assets/OpenScoutAppShell-BtlKkiuF.js +0 -87
  380. package/dist/client/assets/OpsAgentsView-CnqrwbC2.js +0 -1
  381. package/dist/client/assets/OpsScreen-DOlmlVkP.js +0 -1
  382. package/dist/client/assets/OpsSubnav-Dj3ShAKv.js +0 -1
  383. package/dist/client/assets/PlanView-BLGdWDx6.js +0 -1
  384. package/dist/client/assets/ProjectAgentProfile-Dv1sVnQl.js +0 -1
  385. package/dist/client/assets/ProjectAgentProfileHero-0-GDhsPT.js +0 -1
  386. package/dist/client/assets/ProjectsInbox-B3DpAI5b.js +0 -2
  387. package/dist/client/assets/ProjectsRail-BDl7U9Jq.js +0 -1
  388. package/dist/client/assets/ProjectsScreen-Dl2FcGrR.js +0 -1
  389. package/dist/client/assets/ProjectsThreadAside-BcGC5mHE.js +0 -1
  390. package/dist/client/assets/Provider-cJCdHAxu.js +0 -1
  391. package/dist/client/assets/RailRow-CLcVmywd.js +0 -1
  392. package/dist/client/assets/RailRow-Cf9LOiEj.css +0 -1
  393. package/dist/client/assets/RawSessionsTable-DBto4Ts-.js +0 -1
  394. package/dist/client/assets/RealtimeVoiceScreen-DXEU5v3g.js +0 -1
  395. package/dist/client/assets/RepoDiffViewer-PaNeZMhJ.js +0 -7
  396. package/dist/client/assets/RepoDiffViewerLazy-CWE5GxMP.js +0 -2
  397. package/dist/client/assets/ReposScreen-Cksv1cAD.js +0 -6
  398. package/dist/client/assets/ScoutDeckSurface-BCjPl7C4.js +0 -1
  399. package/dist/client/assets/ScoutbotBroadcastChip-DkiRCHuK.js +0 -2
  400. package/dist/client/assets/ScoutbotRealtimeVoiceCall-1ixiEn1L.js +0 -1
  401. package/dist/client/assets/SessionRefScreen-OkTY7Szg.js +0 -1
  402. package/dist/client/assets/SessionsScreen-B-GFjxIA.js +0 -1
  403. package/dist/client/assets/SettingsDrawer-Co11RFX0.js +0 -3
  404. package/dist/client/assets/SettingsDrawer-UX7pFJU_.css +0 -1
  405. package/dist/client/assets/SettingsScreen-Cn09nq5_.js +0 -1
  406. package/dist/client/assets/SpriteAvatar-DS6Tmyua.js +0 -1
  407. package/dist/client/assets/Terminal-U8gjIdm3.js +0 -1
  408. package/dist/client/assets/TerminalEmbedScreen-CTmdE7us.js +0 -1
  409. package/dist/client/assets/WorkDetailScreen-mJs0mb99.js +0 -5
  410. package/dist/client/assets/WorkFilesViewer-ODzLXKxj.js +0 -1
  411. package/dist/client/assets/agent-identity-BxCsXnDp.js +0 -1
  412. package/dist/client/assets/agent-lane-detail-BNNm6FNu.js +0 -2
  413. package/dist/client/assets/api-h5zurxmi.js +0 -1
  414. package/dist/client/assets/broker-display-pp33bLsu.js +0 -2
  415. package/dist/client/assets/collapsed-strip-Dz-of2SM.css +0 -1
  416. package/dist/client/assets/content-B8gahuBy.js +0 -1
  417. package/dist/client/assets/content-BIqX06OQ.js +0 -1
  418. package/dist/client/assets/content-BKDZ6Fxe.js +0 -1
  419. package/dist/client/assets/content-C15Ya-iu.js +0 -1
  420. package/dist/client/assets/content-CDE9tJDF.js +0 -1
  421. package/dist/client/assets/content-CSAfI-PX.js +0 -1
  422. package/dist/client/assets/content-CTF9D60D.js +0 -1
  423. package/dist/client/assets/content-CbAGkYQO.js +0 -1
  424. package/dist/client/assets/content-CtqLJOVp.js +0 -1
  425. package/dist/client/assets/content-Dvs1KRfo.js +0 -1
  426. package/dist/client/assets/content-DyJdVZjI.js +0 -1
  427. package/dist/client/assets/content-Ji7ATaf7.js +0 -1
  428. package/dist/client/assets/content-eqZXKWcP.js +0 -1
  429. package/dist/client/assets/content-iyyQKwvA.js +0 -1
  430. package/dist/client/assets/content-pDE7Fpb9.js +0 -1
  431. package/dist/client/assets/content-pPSd2dua.js +0 -1
  432. package/dist/client/assets/conversation-model-CHwHZNw-.js +0 -1
  433. package/dist/client/assets/conversation-motion-features-DXtKlmuM.js +0 -1
  434. package/dist/client/assets/ctx-panel-B4s49N9e.css +0 -1
  435. package/dist/client/assets/discover-DKf0aTr_.js +0 -2
  436. package/dist/client/assets/embed-entry-RlQUTtc4.js +0 -2
  437. package/dist/client/assets/gestures-CcEOV6Sr.js +0 -1
  438. package/dist/client/assets/harnesses-screen-DBZoTZz8.css +0 -1
  439. package/dist/client/assets/home-moving-signal-Bh2FugbH.js +0 -1
  440. package/dist/client/assets/home-moving-signal-CAa0V91u.css +0 -1
  441. package/dist/client/assets/home-now-card-ByRH5fFx.js +0 -1
  442. package/dist/client/assets/hooks-DUZwL3Aq.js +0 -2
  443. package/dist/client/assets/index-BBznYVWk.css +0 -1
  444. package/dist/client/assets/index-BTuq-8Iv.js +0 -1
  445. package/dist/client/assets/index-CmwGCxUk.js +0 -1
  446. package/dist/client/assets/index-CvF09yvf.css +0 -1
  447. package/dist/client/assets/index-DmFAhGPj.js +0 -10
  448. package/dist/client/assets/index-Dtaswdsh.js +0 -1
  449. package/dist/client/assets/inspector-panel-DzgS5_Mv.js +0 -2
  450. package/dist/client/assets/left-8NITBvFX.js +0 -1
  451. package/dist/client/assets/left-B2HEqrTM.js +0 -2
  452. package/dist/client/assets/left-Bk3XnxPD.css +0 -1
  453. package/dist/client/assets/left-CCoobxPS.css +0 -1
  454. package/dist/client/assets/left-CTYUvXbe.js +0 -1
  455. package/dist/client/assets/left-CwDRT50z.js +0 -2
  456. package/dist/client/assets/left-CxlDLJlw.js +0 -1
  457. package/dist/client/assets/left-XFXxNd4g.js +0 -1
  458. package/dist/client/assets/left-agents-Ck4Xn-R8.js +0 -1
  459. package/dist/client/assets/left-default-BeOyS0bR.js +0 -1
  460. package/dist/client/assets/left-lanes-DZp3jJMo.js +0 -1
  461. package/dist/client/assets/left-mission-CuKFQ5xL.js +0 -1
  462. package/dist/client/assets/left-p1hkO6P0.js +0 -1
  463. package/dist/client/assets/left-plan-3rrFENhp.js +0 -2
  464. package/dist/client/assets/library-E--gKzEZ.js +0 -1
  465. package/dist/client/assets/mesh-buckets-CfAukILK.js +0 -1
  466. package/dist/client/assets/message-visibility-kJM8XcSG.js +0 -1
  467. package/dist/client/assets/mission-control-m3BTDQ9l.css +0 -1
  468. package/dist/client/assets/model-Co0zkMIc.js +0 -1
  469. package/dist/client/assets/plan-view-D56fneVF.css +0 -1
  470. package/dist/client/assets/profile-Dxj3VVOM.js +0 -1
  471. package/dist/client/assets/projects-inbox-COZ23dLR.css +0 -1
  472. package/dist/client/assets/projects-inbox-Dzt_GQDv.js +0 -1
  473. package/dist/client/assets/resolve-panes-C9gF0w4e.js +0 -1
  474. package/dist/client/assets/resolve-sidebar-context-DxbY5RCH.js +0 -1
  475. package/dist/client/assets/right-5L7Tn0zG.js +0 -1
  476. package/dist/client/assets/right-CYtkMmRu.js +0 -1
  477. package/dist/client/assets/right-CreoQzPP.js +0 -1
  478. package/dist/client/assets/right-D9xFfy2b.js +0 -1
  479. package/dist/client/assets/right-DI7zHADe.js +0 -1
  480. package/dist/client/assets/right-DUbJ3WVc.js +0 -1
  481. package/dist/client/assets/right-DiybhsiK.js +0 -1
  482. package/dist/client/assets/right-Jh_1Q88s.js +0 -1
  483. package/dist/client/assets/right-udr1qTJG.js +0 -1
  484. package/dist/client/assets/router-Cn_s9IGH.js +0 -1
  485. package/dist/client/assets/runtime-picker-vhm0gtLs.css +0 -1
  486. package/dist/client/assets/scout-voice-CwbOz6EN.js +0 -1
  487. package/dist/client/assets/secondaryNavConfig-Dw3gS1jR.js +0 -1
  488. package/dist/client/assets/sse-CxXt4tqI.js +0 -1
  489. package/dist/client/assets/system-surfaces-redesign-B7GQhfpw.css +0 -1
  490. package/dist/client/assets/terminal-screen-BqVnCwl0.css +0 -1
  491. package/dist/client/assets/terminal-sessions-AmSgHklm.js +0 -1
  492. package/dist/client/assets/text-DsBWV_4k.js +0 -1
  493. package/dist/client/assets/use-conversation-list-C-dPcjQe.js +0 -1
  494. package/dist/client/assets/use-reduced-motion-CYqhYqHO.js +0 -1
  495. package/dist/client/assets/useContentSecondaryNav-DjHBrgnS.js +0 -1
  496. package/dist/highlights-eq9cgrbb.scm +0 -604
  497. package/dist/highlights-ghv9g403.scm +0 -205
  498. package/dist/highlights-hk7bwhj4.scm +0 -284
  499. package/dist/highlights-r812a2qc.scm +0 -150
  500. package/dist/highlights-x6tmsnaa.scm +0 -115
  501. package/dist/injections-73j83es3.scm +0 -27
  502. package/dist/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
  503. package/dist/tree-sitter-markdown-411r6y9b.wasm +0 -0
  504. package/dist/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
  505. package/dist/tree-sitter-typescript-zxjzwt75.wasm +0 -0
  506. package/dist/tree-sitter-zig-e78zbjpm.wasm +0 -0
  507. /package/dist/client/assets/{document-focus-viewer-BSC_JwVE.css → DocumentFocusViewer-BSC_JwVE.css} +0 -0
@@ -1 +0,0 @@
1
- import{j as e,r as d}from"./index-DmFAhGPj.js";import{p as v,a as b}from"./api-h5zurxmi.js";import{u as Q,e as Z}from"./Provider-cJCdHAxu.js";import{P as ee,b as te}from"./router-Cn_s9IGH.js";import{u as se}from"./sse-CxXt4tqI.js";import{o as oe,i as D}from"./surface-activity-B1rgWB1i.js";/* empty css */import{AgentsSubnav as ne}from"./AgentsSubnav-az_VDkri.js";import{AgentsLibrary as ie}from"./library-E--gKzEZ.js";import{r as re,d as ae}from"./model-Co0zkMIc.js";import{AgentDetailWithRail as de,AgentProfileBar as le}from"./profile-Dxj3VVOM.js";/* empty css *//* empty css *//* empty css */import"./colors-BtO5_zlx.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-CHIuVKz7.js";import"./DocumentFocusViewer-B9vodVmG.js";import"./createLucideIcon-CFBn0Sdk.js";import"./TextDocumentSurface-BWJCGBZf.js";/* empty css */import"./file-text-DcYSrI4v.js";import"./x-C8ayPBtj.js";import"./chevron-right-BYMV1511.js";import"./code-xml-BFc3TMSm.js";import"./arrow-left-B-3GJ7ct.js";import"./scout-voice-CwbOz6EN.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-h1IdakpD.js";import"./MessageComposerSuggestions-FdVHnT_q.js";import"./NewChatComposer-Hd7pI5Ac.js";import"./runtime-picker--IW3cRry.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-d6PKL_KD.js";import"./index-CmwGCxUk.js";import"./HarnessMark-BPAphNjx.js";import"./conversation-model-CHwHZNw-.js";import"./time-Dhsh_2EG.js";import"./NewChatOrigin-DmuJ32wa.js";import"./chevron-down-B3VVRJcV.js";import"./search-DAyagUtF.js";import"./chunk-HRAB3GC3-dRd2eQMJ.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-AmSgHklm.js";import"./index-BWHgHrtv.js";import"./SecondaryNav-_wyKjwNf.js";import"./secondaryNavConfig-Dw3gS1jR.js";import"./message-square-D1hMsMj_.js";import"./terminal-DJPUp_Qn.js";import"./scroll-text-DPPYrqB9.js";/* empty css */import"./SpriteAvatar-DS6Tmyua.js";import"./agent-identity-BxCsXnDp.js";import"./AgentSessions-DpY0htZV.js";import"./openContent-C6XO6kr5.js";import"./clipboard-e3fSpeo7.js";import"./text-DsBWV_4k.js";import"./agents-project-model-UYiamtrU.js";import"./AgentAvatar-D8ZtMluU.js";import"./context-budget-DX_fwUs3.js";import"./session-catalog-ClS9xf6i.js";import"./terminal-relay-TffuSPGs.js";import"./BackToPicker-D1LV6Cqp.js";import"./ConversationScreen-B3l2m3JI.js";import"./ConversationComposer-Bf7Ga_49.js";import"./message-markup-CyRDLdOn.js";import"./mentions-agCGDgyA.js";import"./AgentDetailCard-BTiOmh-a.js";import"./AgentLiveActions-BJ5dIfL3.js";import"./terminal-takeover-BOFPRPjR.js";import"./eye-1J4yOUoG.js";import"./message-visibility-kJM8XcSG.js";import"./sessionRead-CvFz2RHv.js";import"./types-B0PlfpKc.js";import"./ConversationHeader-B_GXrKR0.js";import"./ConversationFeedRows-Cm1Lgo43.js";import"./ConversationPanels-BTBbEvrP.js";import"./use-reduced-motion-CYqhYqHO.js";import"./activity-CC8JzJNH.js";import"./message-circle-CJO-pi7b.js";import"./tail-display-BRcJltQa.js";import"./lane-edit-display-C_Aujldz.js";import"./tail-events-BdvqZHLr.js";import"./ConversationStatus-BqhUHD85.js";import"./SessionObserve-yYA8Gy5s.js";import"./bash-format-BRV5C6Gv.js";import"./lane-tool-detail-0WhMf4Vj.js";import"./LaneToolHoverCard-B7KdvQvf.js";import"./lane-observe-BA3g9aVd.js";import"./lane-ask-display-B6iCAVcd.js";import"./ObservedTopologyPanel-CaSZZP05.js";import"./ObserveTextFlow-CkMrtT8s.js";import"./SessionObserveEvidence-cHdjYOJe.js";import"./wrench-CvRjjByE.js";import"./external-link-B1TI5yIt.js";import"./AgentDefinitionsWorkspace-CfaDVCVt.js";import"./project-overview-helpers-BQTc_Ous.js";import"./FileViewerPane-9Bveqm9c.js";/* empty css */import"./agent-essentials-B3wcxg_v.js";const K=new Set(["0","false","off","no","clear","none"]),ce=new Set(["1","true","on","yes"]),ue=new Set(["localhost","127.0.0.1","::1"]);function me(t){return t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1):t}function L(t){const o=t?.trim().toLowerCase();return o==="before"||o==="after"?o:null}function z(t){if(!t)return null;const o=t.trim().toLowerCase();return ce.has(o)?!0:K.has(o)?!1:null}function M(t,o,i=[]){const r=z(t);if(r!==null)return r;if(!t)return null;const l=o.toLowerCase(),a=new Set([l,l.replace(/-/g,""),...i.map(n=>n.trim().toLowerCase()).filter(Boolean)]),s=t.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean);return s.some(n=>K.has(n))?!1:s.some(n=>a.has(n))?!0:null}function pe({studyId:t,aliases:o,href:i,storedEnabled:r,storedMode:l,dev:a,defaultMode:s="after"}){const n=i?new URL(i,"http://localhost"):null,p=M(n?.searchParams.get("studio"),t,o)??M(n?.searchParams.get(`studio.${t}`),t,o)??M(n?.searchParams.get("studioInjection"),t,o),c=n?ue.has(me(n.hostname)):!1;if(!a&&!c)return{enabled:!1,mode:s};const m=p??z(r)??!1,g=L(n?.searchParams.get("studioMode"))??L(n?.searchParams.get(`studioMode.${t}`))??L(l)??s;return{enabled:m,mode:g}}const he="openscout.studio.inject.",fe="openscout.studio.mode.";function O(t){return`${he}${t}`}function T(t){return`${fe}${t}`}function $(t){if(typeof window>"u")return null;try{return window.localStorage.getItem(t)}catch{return null}}function I(t,o){if(!(typeof window>"u"))try{window.localStorage.setItem(t,o)}catch{}}function ge(){return import.meta.env?.DEV===!0}function je(t){return t==="before"?"after":"before"}function xe(t){typeof window>"u"||ee({searchPatch:{studio:null,[`studio.${t}`]:null,studioInjection:null,studioMode:null,[`studioMode.${t}`]:null},replace:!0})}function ve(t,o=[]){const[i,r]=d.useState(()=>pe({studyId:t,aliases:o,href:typeof window>"u"?void 0:window.location.href,storedEnabled:$(O(t)),storedMode:$(T(t)),dev:ge()})),[l,a]=d.useState(!1);d.useEffect(()=>{if(!i.enabled){a(!1);return}const c=j=>{j.altKey&&a(!0)},m=j=>{j.altKey||a(!1)},g=()=>a(!1);return window.addEventListener("keydown",c),window.addEventListener("keyup",m),window.addEventListener("blur",g),()=>{window.removeEventListener("keydown",c),window.removeEventListener("keyup",m),window.removeEventListener("blur",g)}},[i.enabled]);const s=d.useCallback(c=>{I(O(t),c?"1":"0"),r(m=>({...m,enabled:c}))},[t]),n=d.useCallback(c=>{I(T(t),c),r(m=>({...m,mode:c}))},[t]),p=l?je(i.mode):i.mode;return d.useMemo(()=>({...i,renderedMode:p,peeking:p!==i.mode,setEnabled:s,setMode:n}),[p,s,n,i])}function Se({studyId:t,aliases:o,anchor:i,title:r,children:l,renderStudy:a}){const s=ve(t,o);return s.enabled?e.jsxs("div",{className:"s-studio-injection","data-studio-anchor":i,children:[e.jsxs("div",{className:"s-studio-injection-bar",children:[e.jsxs("div",{className:"s-studio-injection-label",children:[e.jsx("span",{className:"s-studio-injection-kicker",children:"Studio injection"}),e.jsx("span",{className:"s-studio-injection-title",children:r}),e.jsx("span",{className:"s-studio-injection-anchor",children:i})]}),e.jsxs("div",{className:"s-studio-injection-controls",role:"group","aria-label":`${r} mode`,children:[e.jsx("button",{type:"button",className:"s-studio-injection-mode","data-active":s.mode==="before","aria-pressed":s.mode==="before",onClick:()=>s.setMode("before"),children:"Before"}),e.jsx("button",{type:"button",className:"s-studio-injection-mode","data-active":s.mode==="after","aria-pressed":s.mode==="after",onClick:()=>s.setMode("after"),children:"After"})]}),e.jsx("span",{className:"s-studio-injection-state",children:s.peeking?`Option: ${s.renderedMode}`:s.renderedMode}),e.jsx("button",{type:"button",className:"s-studio-injection-close",onClick:()=>{xe(t),s.setEnabled(!1)},children:"Close"})]}),e.jsx("div",{className:"s-studio-injection-body","data-studio-mode":s.renderedMode,children:s.renderedMode==="before"?l:a()})]}):e.jsx(e.Fragment,{children:l})}const N=[{id:"openscout",title:"openscout",root:"~/dev/openscout",signal:"Studio mode injection for agent directory",sessions:9,agents:[{id:"hudson",name:"Hudson",handle:"@hudson",state:"working",role:"web design system",branch:"feat/studio-mode",task:"Refactoring the agent directory into insertion points",last:"18s"},{id:"scout",name:"Scout",handle:"@scout",state:"attention",role:"operator assistant",branch:"main",task:"Needs placement decision",last:"1m"},{id:"quill",name:"Quill",handle:"@quill",state:"ready",role:"docs",branch:"docs/agent-view",task:"Ready to write the study summary",last:"7m"}]},{id:"hudson",title:"hudson",root:"~/dev/hudson",signal:"Slot contracts and chrome primitives",sessions:4,agents:[{id:"atlas",name:"Atlas",handle:"@atlas",state:"working",role:"framework",branch:"slots/studio-anchor",task:"Mapping chrome slots to page anchors",last:"3m"},{id:"mira",name:"Mira",handle:"@mira",state:"ready",role:"qa",branch:"main",task:"Idle",last:"12m"}]},{id:"lattices",title:"lattices",root:"~/dev/lattices",signal:"macOS web view parity pass",sessions:2,agents:[{id:"north",name:"North",handle:"@north",state:"offline",role:"native",branch:"main",task:"No active session",last:"1h"}]}],we={working:"working",ready:"ready",attention:"attention",offline:"offline"};function ye({children:t}){return e.jsx(Se,{studyId:"agent-directory",aliases:["agents","agent","agent-directory-before-after"],anchor:"agents.directory",title:"Agent Directory",renderStudy:()=>e.jsx(be,{}),children:t})}function be(){const t=N.flatMap(s=>s.agents),o=t.filter(s=>s.state==="working"),i=t.filter(s=>s.state==="ready"),r=t.filter(s=>s.state==="attention"),l=N.reduce((s,n)=>s+n.sessions,0),a=o[0]??t[0];return e.jsxs("section",{className:"s-agent-studio-study","aria-label":"Agent directory injected study",children:[e.jsxs("div",{className:"s-agent-studio-banner",children:[e.jsx("span",{children:"After study"}),e.jsx("strong",{children:"Injected static view inside the live Agents route"}),e.jsx("em",{children:"Fixture data · insertion-point prototype · no backend writes"})]}),e.jsxs("header",{className:"s-agent-studio-head","data-studio-anchor":"agent.directory.header",children:[e.jsxs("div",{className:"s-agent-studio-title-block",children:[e.jsx("span",{className:"s-agent-studio-kicker",children:"Studio / agents.directory / after"}),e.jsx("h1",{className:"s-agent-studio-title",children:"Project command center"}),e.jsxs("span",{className:"s-agent-studio-subtitle",children:[t.length," agents across ",N.length," projects"]})]}),e.jsxs("div",{className:"s-agent-studio-metrics","aria-label":"Agent study summary",children:[e.jsx(A,{label:"working",value:o.length,tone:"working"}),e.jsx(A,{label:"ready",value:i.length}),e.jsx(A,{label:"attention",value:r.length,tone:"attention"}),e.jsx(A,{label:"sessions",value:l})]})]}),e.jsxs("div",{className:"s-agent-studio-layout",children:[e.jsxs("div",{className:"s-agent-studio-main",children:[e.jsxs("section",{className:"s-agent-studio-pressure","data-studio-anchor":"agent.active-strip",children:[e.jsxs("div",{className:"s-agent-studio-section-head",children:[e.jsx("span",{children:"Pressure queue"}),e.jsx("strong",{children:o.length+r.length})]}),e.jsx("div",{className:"s-agent-studio-pressure-list",children:[...o,...r].map(s=>e.jsxs("article",{className:`s-agent-studio-pressure-card s-agent-studio-pressure-card--${s.state}`,children:[e.jsx("span",{className:"s-agent-studio-dot","data-state":s.state}),e.jsxs("div",{className:"s-agent-studio-pressure-copy",children:[e.jsx("strong",{children:s.name}),e.jsx("span",{children:s.task})]}),e.jsx("time",{children:s.last})]},s.id))})]}),e.jsx("section",{className:"s-agent-studio-projects","data-studio-anchor":"agent.project-board",children:N.map(s=>e.jsxs("article",{className:"s-agent-studio-project",children:[e.jsxs("div",{className:"s-agent-studio-project-main",children:[e.jsxs("div",{children:[e.jsx("span",{className:"s-agent-studio-project-root",children:s.root}),e.jsx("h2",{children:s.title})]}),e.jsxs("span",{className:"s-agent-studio-project-sessions",children:[s.sessions," sessions"]})]}),e.jsx("p",{children:s.signal}),e.jsx("div",{className:"s-agent-studio-agent-row",children:s.agents.map(n=>e.jsxs("span",{className:`s-agent-studio-agent-pill s-agent-studio-agent-pill--${n.state}`,children:[e.jsx("span",{className:"s-agent-studio-dot","data-state":n.state}),n.name]},n.id))})]},s.id))})]}),e.jsxs("aside",{className:"s-agent-studio-detail","data-studio-anchor":"agent.detail-preview",children:[e.jsx("span",{className:"s-agent-studio-kicker",children:"Pinned agent"}),e.jsx("h2",{children:a.name}),e.jsx("span",{className:`s-agent-studio-state s-agent-studio-state--${a.state}`,children:we[a.state]}),e.jsxs("dl",{children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Handle"}),e.jsx("dd",{children:a.handle})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Role"}),e.jsx("dd",{children:a.role})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Branch"}),e.jsx("dd",{children:a.branch})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Current task"}),e.jsx("dd",{children:a.task})]})]})]})]})]})}function A({label:t,value:o,tone:i}){return e.jsxs("div",{className:`s-agent-studio-metric${i?` s-agent-studio-metric--${i}`:""}`,children:[e.jsx("strong",{children:o}),e.jsx("span",{children:t})]})}const P="/api/conversations",H="/api/fleet",F="/api/tail/discover",U="/api/topology/snapshot?force=1",S=3e4;function gs({navigate:t,selectedAgentId:o,conversationId:i,tab:r,activeRoute:l}){const{agents:a,agentsLoaded:s,route:n}=Q(),[p,c]=d.useState(()=>v(P,S)??[]),[m,g]=d.useState(()=>v(H,S)),[j,G]=d.useState(()=>v(F,S)),[q,W]=d.useState(()=>v(U,S)),[X,Y]=d.useState(()=>v(P,S)===null),R=te(n),k=d.useMemo(()=>Z(a,R),[a,R]),x=d.useCallback(async()=>{const[h,f,y,C]=await Promise.allSettled([b(P),b(H),b(F),b(U)]);h.status==="fulfilled"&&c(h.value),f.status==="fulfilled"&&g(f.value),y.status==="fulfilled"&&G(y.value),C.status==="fulfilled"&&W(C.value),Y(!1)},[]);d.useEffect(()=>{x()},[x]),d.useEffect(()=>{const h=()=>{D()&&x()},f=window.setInterval(h,1e4),y=oe(h);return()=>{window.clearInterval(f),y()}},[x]),se(()=>{D()&&x()});const u=re(k,o),_=!!(o&&u&&u.id!==o),w=n.view==="agents-v2"?n.projectSlug:void 0,E=!!(w&&!r),{conversationByAgentId:B,sessionByAgentId:J}=ae(p);if(d.useEffect(()=>{!o||!u||!_||t({view:"agents-v2",agentId:u.id,...E&&w?{projectSlug:w}:{},...i?{conversationId:i}:{},...r?{tab:r}:{}})},[i,r,E,t,w,u,o,_]),u&&!E){const h=i??B.get(u.id)??u.conversationId??null,f=r??(i?"message":"profile");return e.jsx(V,{activeRoute:l??n,navigate:t,bar:e.jsx(le,{agent:u,conversationId:h,activeTab:f,navigate:t}),children:e.jsx(de,{agent:u,allAgents:k,conversationId:h,navigate:t,activeTab:f})})}return e.jsx(V,{activeRoute:l??n,navigate:t,children:e.jsx(ye,{children:e.jsx(ie,{agents:k,fleet:m,sessionByAgentId:J,conversationByAgentId:B,sessions:p,discovery:j,topologySnapshot:q,loading:!s||X,navigate:t,selectedAgentId:u?.id??o})})})}function V({activeRoute:t,children:o,navigate:i,bar:r}){return e.jsxs("div",{className:"s-secondary-nav-shell",children:[e.jsx("div",{className:"s-secondary-nav-bar",children:r??e.jsx(ne,{activeRoute:t,navigate:i})}),e.jsx("div",{className:"s-secondary-nav-body",children:o})]})}export{gs as AgentsScreen};
@@ -1 +0,0 @@
1
- import{j as t}from"./index-DmFAhGPj.js";import{S as i}from"./SecondaryNav-_wyKjwNf.js";import{A as m}from"./secondaryNavConfig-Dw3gS1jR.js";import"./createLucideIcon-CFBn0Sdk.js";import"./message-square-D1hMsMj_.js";import"./file-text-DcYSrI4v.js";import"./search-DAyagUtF.js";import"./terminal-DJPUp_Qn.js";import"./code-xml-BFc3TMSm.js";import"./scroll-text-DPPYrqB9.js";function N({activeRoute:r,navigate:o}){return t.jsx(i,{ariaLabel:"Agents sections",activeRoute:r,groups:m,navigate:o})}export{N as AgentsSubnav};
@@ -1 +0,0 @@
1
- import{r as d,j as e}from"./index-DmFAhGPj.js";/* empty css */import{D as ys}from"./DataTable-CJbbgBdA.js";import{H,h as F}from"./HarnessMark-BPAphNjx.js";import{O as vs}from"./ObservedTopologyPanel-CaSZZP05.js";import{a as es}from"./api-h5zurxmi.js";import{o as ts,i as U}from"./surface-activity-B1rgWB1i.js";import{a as Ns,d as gs}from"./time-Dhsh_2EG.js";import{u as Is}from"./tail-events-BdvqZHLr.js";/* empty css */import"./index-BWHgHrtv.js";const ns=4e3,bs=500,Cs=5e3,Es=5e3,Ss=6e4,q={"scout-managed":"scout","hudson-managed":"hudson",unattributed:"native"},X={tool:"working",run:"active",idle:"idle"};function G(s){const n=s.split(/\s+/)[0]??"",l=n.lastIndexOf("/");return l>=0?n.slice(l+1):n}function ws(s,n=60){const l=s.split(/\s+/);if(l.length===0)return s;l[0]=G(l[0]);const c=l.join(" ");return c.length<=n?c:c.slice(0,n-1)+"…"}function Ms(s){for(const n of s){const l=G(n.command);if(l&&!(l==="sh"||l==="zsh"||l==="bash"||l==="login"))return l}return s[0]?.command?G(s[0].command):"—"}function As(s){const n=s.match(/^(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)$/);if(!n){const u=s.match(/^(\d+)$/);return u?Number.parseInt(u[1],10):0}const[,l,c,m,p]=n;let f=Number.parseInt(p,10)+Number.parseInt(m,10)*60;return c&&(f+=Number.parseInt(c,10)*3600),l&&(f+=Number.parseInt(l,10)*86400),f}function rs(s){if(s<60)return`${s}s`;if(s<3600)return`${Math.floor(s/60)}m${String(s%60).padStart(2,"0")}`;if(s<86400){const c=Math.floor(s/3600),m=Math.floor(s%3600/60);return`${c}h${String(m).padStart(2,"0")}`}const n=Math.floor(s/86400),l=Math.floor(s%86400/3600);return`${n}d${String(l).padStart(2,"0")}h`}function is(s,n){return Ns(s,n)||"—"}function $s(s){return gs(s)||"—"}function Q(s){return s?s.slice(0,8):"—"}function cs(s){return s?.trim().toLowerCase()||"unknown"}function Rs(s){return cs(s).replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function Z(s){return`s-atop-chip s-atop-chip--harness s-atop-chip--harness-${Rs(s)}`}const Ts=/permission-mode/i;function as(s){return s.kind!=="system"?!1:Ts.test(s.summary)}function J(s){return s.kind==="assistant"}function Ws(s,n,l){if(!s)return[];const c=new Map,m=new Map;for(const t of n){let r=c.get(t.pid);if(r||(r={firstEventAt:t.ts,lastEventAt:t.ts,lastKind:t.kind,lastSummary:t.summary,reqCount:0,toolCount:0,permCount:0,eventCount:0,sessionId:t.sessionId||null,model:null,tokIn:null,tokOut:null,cacheReadIn:null,cacheWriteIn:null},c.set(t.pid,r)),t.ts<r.firstEventAt&&(r.firstEventAt=t.ts),t.ts>=r.lastEventAt&&(r.lastEventAt=t.ts,r.lastKind=t.kind,r.lastSummary=t.summary),r.eventCount++,t.kind==="tool"&&r.toolCount++,J(t)&&r.reqCount++,as(t)&&r.permCount++,t.sessionId&&!r.sessionId&&(r.sessionId=t.sessionId),t.sessionId){let a=m.get(t.sessionId);a||(a={firstEventAt:t.ts,lastEventAt:t.ts,lastKind:t.kind,lastSummary:t.summary,reqCount:0,toolCount:0,permCount:0,eventCount:0,sessionId:t.sessionId,model:null,tokIn:null,tokOut:null,cacheReadIn:null,cacheWriteIn:null},m.set(t.sessionId,a)),t.ts<a.firstEventAt&&(a.firstEventAt=t.ts),t.ts>=a.lastEventAt&&(a.lastEventAt=t.ts,a.lastKind=t.kind,a.lastSummary=t.summary),a.eventCount++,t.kind==="tool"&&a.toolCount++,J(t)&&a.reqCount++,as(t)&&a.permCount++}}const p=new Map;for(const t of s.processes){if(!t.cwd)continue;const r=Y(t.source,t.cwd),a=p.get(r);(!a||t.pid<a.pid)&&p.set(r,t)}const f=new Map,u=new Map;for(const t of s.transcripts??[]){const r=Y(t.source,t.cwd),a=os(t),j=u.get(r)??Number.NEGATIVE_INFINITY,N=f.get(r)??"";(t.mtimeMs>j||t.mtimeMs===j&&a>N)&&(u.set(r,t.mtimeMs),f.set(r,a))}const h=new Set,I=(t,r,a,j)=>{r&&h.add(r.pid);let N="idle";const w=Math.max(a?.lastEventAt??0,j?.mtimeMs??0);a&&l-a.lastEventAt<Es&&(N=a.lastKind==="tool"?"tool":"run"),N==="idle"&&l-w<6e4&&(N="run");const L=r?As(r.etime):0,D=a?.firstEventAt??null,V=a&&a.firstEventAt<a.lastEventAt?Math.min(Math.max(0,Math.round((a.lastEventAt-a.firstEventAt)/1e3)),L||Number.POSITIVE_INFINITY):0,_=r?.pid??Os(t),R=j?.cwd??r?.cwd??"";return{key:t,pid:_,ppid:r?.ppid??0,sessionId:j?.sessionId??a?.sessionId??null,transcriptPath:j?.transcriptPath??null,harness:cs(j?.source??r?.source),attribution:r?.harness??j?.harness??"unattributed",project:j?.project?.trim()||(R?Ps(R):"(unknown)"),cwd:R,command:r?.command??`${j?.source??"unknown"} transcript`,parentLabel:r?Ms(r.parentChain??[]):"transcript",procRuntimeSec:L,procEtime:r?.etime??"0",sessionStartAt:D,sessionRuntimeSec:V,status:N,lastEventAt:w||null,lastEventKind:a?.lastKind??null,lastSummary:a?.lastSummary??null,reqCount:a?.reqCount??0,toolCount:a?.toolCount??0,permCount:a?.permCount??0,eventCount:a?.eventCount??0,model:a?.model??null,tokIn:a?.tokIn??null,tokOut:a?.tokOut??null,cacheReadIn:a?.cacheReadIn??null,cacheWriteIn:a?.cacheWriteIn??null}},k=(s.transcripts??[]).map(t=>{const r=os(t),a=Y(t.source,t.cwd),j=f.get(a)===r?p.get(a)??null:null,N=t.sessionId?m.get(t.sessionId):void 0;return I(r,j,N,t)}),y=s.processes.filter(t=>!h.has(t.pid)).map(t=>I(Ls(t),t,c.get(t.pid),null));return[...k,...y]}function $(s){if(s.cacheReadIn==null||s.tokIn==null)return null;const n=s.cacheReadIn+s.tokIn;return n===0?null:s.cacheReadIn/n}function S(s){return s==null?"—":s===0?"0":s>=1e6?(s/1e6).toFixed(s>=1e7?0:1)+"M":s>=1e3?(s/1e3).toFixed(s>=1e4?0:1)+"k":String(s)}function us(s){return s==null?"—":`${Math.round(s*100)}%`}function Ps(s){if(!s)return"";const n=s.lastIndexOf("/");return n>=0?s.slice(n+1):s}function os(s){return`session:${s.source}:${s.sessionId??s.transcriptPath}`}function Ls(s){return`process:${s.source}:${s.pid}`}function Os(s){let n=2166136261;for(let l=0;l<s.length;l+=1)n^=s.charCodeAt(l),n=Math.imul(n,16777619);return-((n>>>0)%9e5+1e3)}function Y(s,n){return`${s}\0${n??""}`}function Ks(s,n,l){const c=l-Ss;let m=0;for(const u of n)J(u)&&u.ts>=c&&m++;const p={total:s.length,running:0,tooling:0,idle:0,harnesses:[],reqsPerMin:m},f=new Map;for(const u of s)u.status==="tool"?(p.tooling++,p.running++):u.status==="run"?p.running++:p.idle++,f.set(u.harness,(f.get(u.harness)??0)+1);return p.harnesses=[...f.entries()].map(([u,h])=>({harness:u,count:h})).sort((u,h)=>h.count-u.count||u.harness.localeCompare(h.harness)),p}const P={tool:0,run:1,idle:2};function A(s){return s??-1}function qs(s,n,l,c){switch(l){case"status":return(P[s.status]-P[n.status])*c;case"agent":{const m=s.harness.localeCompare(n.harness);return m!==0?m*c:(s.sessionId??"").localeCompare(n.sessionId??"")*c}case"project":return s.project.localeCompare(n.project)*c;case"reqs":return(s.reqCount-n.reqCount)*c;case"tokIn":return(A(s.tokIn)-A(n.tokIn))*c;case"tokOut":return(A(s.tokOut)-A(n.tokOut))*c;case"cache":return(A($(s))-A($(n)))*c;case"tools":return(s.toolCount-n.toolCount)*c;case"perms":return(s.permCount-n.permCount)*c;case"last":{const m=s.lastEventAt??0,p=n.lastEventAt??0;return(m-p)*c}case"runtime":return(s.sessionRuntimeSec-n.sessionRuntimeSec)*c}}function ls({values:s,color:n}){if(s.length<2)return e.jsx("svg",{className:"s-atop-spark",width:88,height:18,viewBox:"0 0 88 18"});const m=Math.max(1,...s),p=88/(s.length-1),f=s.map((u,h)=>`${(h*p).toFixed(1)},${(18-u/m*18).toFixed(1)}`).join(" ");return e.jsx("svg",{className:"s-atop-spark",width:88,height:18,viewBox:"0 0 88 18",children:e.jsx("polyline",{fill:"none",stroke:n,strokeWidth:"1.25",points:f})})}function ne(){const[s,n]=d.useState([]),[l,c]=d.useState(null),[m,p]=d.useState(()=>Date.now()),[f,u]=d.useState(""),[h,I]=d.useState(()=>new Set),[k,y]=d.useState(()=>new Set),[t,r]=d.useState({key:"status",dir:1}),[a,j]=d.useState(null),N=d.useRef([]),w=d.useRef([]),[L,D]=d.useState([]),[V,_]=d.useState([]),R=d.useCallback(o=>{n(i=>i.length>=ns?[...i.slice(i.length-ns+1),o]:[...i,o])},[]);Is(R),d.useEffect(()=>{let o=!1,i=!1;const x=async()=>{if(!(i||!U()))try{const O=await es(`/api/tail/recent?limit=${bs}`);o||(i=!0,n(O.events??[]))}catch{}};x();const E=ts(()=>{x()});return()=>{o=!0,E()}},[]);const T=d.useCallback(async()=>{if(U())try{const o=await es("/api/tail/discover");c(o)}catch{}},[]);d.useEffect(()=>{T();const o=setInterval(()=>{T()},Cs),i=ts(()=>{T()});return()=>{clearInterval(o),i()}},[T]),d.useEffect(()=>{const o=setInterval(()=>{U()&&p(Date.now())},1e3);return()=>clearInterval(o)},[]);const v=d.useMemo(()=>Ws(l,s,m),[l,s,m]),M=d.useMemo(()=>Ks(v,s,m),[v,s,m]);d.useEffect(()=>{N.current=[...N.current,M.running].slice(-24),w.current=[...w.current,M.tooling].slice(-24),D(N.current),_(w.current)},[M.running,M.tooling]);const ds=d.useMemo(()=>{const o=new Set;return v.forEach(i=>o.add(i.harness)),[...o]},[v]),ms=d.useMemo(()=>{const o=new Set;return v.forEach(i=>o.add(i.status)),[...o]},[v]),z=d.useMemo(()=>{const o=f.trim().toLowerCase();return v.filter(i=>{if(h.size>0&&!h.has(i.harness)||k.size>0&&!k.has(i.status))return!1;if(!o)return!0;const x=q[i.attribution];return`${i.pid} ${i.project} ${i.command} ${i.harness} ${i.attribution} ${x} ${i.sessionId??""} ${i.transcriptPath??""} ${i.lastSummary??""}`.toLowerCase().includes(o)})},[v,f,h,k]),B=d.useMemo(()=>t.key==="status"?void 0:(o,i)=>P[o.status]-P[i.status],[t.key]),C=d.useMemo(()=>z.map((o,i)=>({row:o,index:i})).sort((o,i)=>{const x=qs(o.row,i.row,t.key,t.dir);if(x!==0)return x;const E=B?.(o.row,i.row)??0;return E!==0?E:o.index-i.index}).map(o=>o.row),[z,t,B]);d.useEffect(()=>{a!=null&&(v.some(o=>o.key===a)||j(null))},[v,a]),d.useEffect(()=>{const o=i=>{const x=i.target,E=x instanceof HTMLInputElement||x instanceof HTMLTextAreaElement||(x?.isContentEditable??!1);if(i.key==="Escape"&&a!=null){i.preventDefault(),j(null);return}if(E)return;const O=i.key==="j"||i.key==="ArrowDown",js=i.key==="k"||i.key==="ArrowUp";if(O||js){if(C.length===0)return;i.preventDefault();const K=C.findIndex(ks=>ks.key===a),ss=O?C[Math.min(C.length-1,K<0?0:K+1)]:C[Math.max(0,K<0?0:K-1)];ss&&j(ss.key);return}if(i.key==="Enter"&&a!=null){i.preventDefault();return}};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[C,a]);const ps=o=>{I(i=>{const x=new Set(i);return x.has(o)?x.delete(o):x.add(o),x})},hs=o=>{y(i=>{const x=new Set(i);return x.has(o)?x.delete(o):x.add(o),x})},g=d.useMemo(()=>a!=null?v.find(o=>o.key===a)??null:null,[v,a]),fs=d.useMemo(()=>g?l?.processes.find(o=>o.pid===g.pid)??null:null,[l,g]),xs=d.useMemo(()=>g?s.filter(o=>g.sessionId?o.sessionId===g.sessionId:o.pid===g.pid).slice(-40):[],[s,g]);return e.jsxs("div",{className:"s-atop",children:[e.jsx(Hs,{summary:M,runHistory:L,toolHistory:V}),e.jsx(vs,{title:"Harness families",size:"compact",maxAgents:6,maxTasks:3,showEmpty:!0}),e.jsx(Fs,{search:f,onSearch:u,harnessOptions:ds,harnessFilter:h,onToggleHarness:ps,statusOptions:ms,statusFilter:k,onToggleStatus:hs,summary:M}),e.jsx(ys,{rows:z,columns:Ds,rowId:o=>o.key,storageKey:"openscout.atop.cols",sort:t,onSortChange:r,secondarySort:B,onRowClick:o=>j(o.key),rowClassName:o=>a===o.key?"s-atop-row--selected":void 0,empty:{title:"no agents match",body:"adjust filters or start a session to populate"},density:"compact",className:"s-atop-data-table",ariaLabel:"Agent activity inventory"}),e.jsx(_s,{shown:C.length,total:v.length,hasSelection:a!=null}),g&&e.jsx(zs,{row:g,process:fs,events:xs,now:m,onClose:()=>j(null)})]})}function Hs({summary:s,runHistory:n,toolHistory:l}){return e.jsxs("div",{className:"s-atop-summary",children:[e.jsxs("div",{className:"s-atop-summary-cell s-atop-summary-cell--primary",children:[e.jsxs("div",{className:"s-atop-summary-num",children:[e.jsx("strong",{children:s.running}),e.jsxs("span",{className:"s-atop-summary-of",children:["/ ",s.total]})]}),e.jsx("span",{className:"s-atop-summary-lbl",children:"active"}),e.jsx(ls,{values:n,color:"var(--green)"})]}),e.jsxs("div",{className:"s-atop-summary-cell",children:[e.jsx("div",{className:"s-atop-summary-num",children:e.jsx("strong",{children:s.tooling})}),e.jsx("span",{className:"s-atop-summary-lbl",children:"working"}),e.jsx(ls,{values:l,color:"var(--accent)"})]}),e.jsxs("div",{className:"s-atop-summary-cell",children:[e.jsx("div",{className:"s-atop-summary-num",children:e.jsx("strong",{children:s.idle})}),e.jsx("span",{className:"s-atop-summary-lbl",children:"idle"})]}),e.jsxs("div",{className:"s-atop-summary-cell s-atop-summary-cell--breakdown",children:[e.jsx("span",{className:"s-atop-summary-lbl",children:"harness"}),e.jsx("div",{className:"s-atop-summary-row",children:s.harnesses.length>0?s.harnesses.slice(0,4).map(c=>e.jsxs("span",{className:Z(c.harness),children:[e.jsx(H,{harness:c.harness,size:11,title:null}),F(c.harness)," ",c.count]},c.harness)):e.jsx("span",{className:"s-atop-chip s-atop-chip--mute",children:"none"})})]}),e.jsx("div",{className:"s-atop-summary-spacer"}),e.jsxs("div",{className:"s-atop-summary-cell s-atop-summary-cell--rate",children:[e.jsxs("div",{className:"s-atop-summary-num",children:[e.jsx("strong",{children:s.reqsPerMin}),e.jsx("span",{className:"s-atop-summary-of",children:"/ min"})]}),e.jsx("span",{className:"s-atop-summary-lbl",children:"requests"})]})]})}function Fs({search:s,onSearch:n,harnessOptions:l,harnessFilter:c,onToggleHarness:m,statusOptions:p,statusFilter:f,onToggleStatus:u,summary:h}){const I=t=>h.harnesses.find(r=>r.harness===t)?.count??0,k=t=>t==="tool"?h.tooling:t==="run"?h.running-h.tooling:h.idle,y=d.useRef(null);return d.useEffect(()=>{const t=r=>{if(r.key!=="/")return;const a=r.target;a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||(a?.isContentEditable??!1)||(r.preventDefault(),y.current?.focus())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[]),e.jsxs("div",{className:"s-atop-fbar",children:[e.jsxs("div",{className:"s-atop-search",children:[e.jsx("span",{className:"s-atop-search-prompt",children:"▸"}),e.jsx("input",{ref:y,className:"s-atop-search-input",value:s,onChange:t=>n(t.target.value),placeholder:"filter by pid · project · command · summary",spellCheck:!1}),e.jsx("span",{className:"s-atop-search-kbd",children:"/"})]}),l.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"s-atop-fbar-label",children:"harness"}),l.map(t=>{const r=c.has(t);return e.jsxs("button",{className:`s-atop-pill s-atop-pill--harness${r?" s-atop-pill--on":""}`,onClick:()=>m(t),children:[e.jsx(H,{harness:t,size:11,title:null}),F(t),e.jsx("span",{className:"s-atop-pill-ct",children:I(t)})]},t)})]}),p.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"s-atop-fbar-label",children:"status"}),["tool","run","idle"].filter(t=>p.includes(t)).map(t=>{const r=f.has(t);return e.jsxs("button",{className:`s-atop-pill s-atop-pill--status-${t}${r?" s-atop-pill--on":""}`,onClick:()=>u(t),children:[X[t],e.jsx("span",{className:"s-atop-pill-ct",children:k(t)})]},t)})]}),e.jsx("div",{className:"s-atop-fbar-spacer"})]})}const Ds=[{key:"status",label:"Status",cls:"s-atop-col-status",kind:"text",defaultWidth:96,minWidth:70,sortValue:s=>P[s.status],render:s=>e.jsxs("span",{className:`s-atop-status s-atop-status--${s.status}`,children:[e.jsx("span",{className:"s-atop-status-dot"}),X[s.status]]})},{key:"agent",label:"Agent",cls:"s-atop-col-agent",kind:"text",tip:"Harness · short session id",defaultWidth:168,minWidth:110,sortValue:s=>`${s.harness}\0${s.sessionId??""}`,render:s=>e.jsxs("div",{className:"s-atop-agent-cell",children:[e.jsxs("span",{className:Z(s.harness),title:`origin: ${q[s.attribution]}`,children:[e.jsx(H,{harness:s.harness,size:11,title:null}),F(s.harness)]}),e.jsx("span",{className:"s-atop-agent-id",title:s.sessionId??`pid ${s.pid}`,children:Q(s.sessionId)})]})},{key:"project",label:"Project",cls:"s-atop-col-project",kind:"text",defaultWidth:200,minWidth:96,maxWidth:480,sortValue:s=>s.project,render:s=>e.jsx("span",{title:s.cwd,children:s.project})},{key:"reqs",label:"Reqs",cls:"s-atop-col-num",kind:"number",tip:"Model invocations (assistant turns) for this session",defaultWidth:64,minWidth:56,sortValue:s=>s.reqCount,render:s=>e.jsx(W,{value:s.reqCount||null})},{key:"tokIn",label:"Tok ↓",cls:"s-atop-col-num",kind:"number",tip:"Input tokens — populated when backend emits usage",defaultWidth:64,minWidth:56,sortValue:s=>s.tokIn,render:s=>e.jsx(W,{value:s.tokIn})},{key:"tokOut",label:"Tok ↑",cls:"s-atop-col-num",kind:"number",tip:"Output tokens — populated when backend emits usage",defaultWidth:64,minWidth:56,sortValue:s=>s.tokOut,render:s=>e.jsx(W,{value:s.tokOut})},{key:"cache",label:"Cache",cls:"s-atop-col-num",kind:"number",tip:"Cache hit rate — populated when backend emits usage",defaultWidth:64,minWidth:56,sortValue:s=>$(s),render:s=>e.jsx(Vs,{value:$(s)})},{key:"tools",label:"Tools",cls:"s-atop-col-num",kind:"number",defaultWidth:64,minWidth:56,sortValue:s=>s.toolCount,render:s=>e.jsx(W,{value:s.toolCount||null})},{key:"perms",label:"Perms",cls:"s-atop-col-num",kind:"number",tip:"Permission requests — heuristic count of permission-mode events",defaultWidth:64,minWidth:56,sortValue:s=>s.permCount,render:s=>e.jsx(W,{value:s.permCount||null,accent:s.permCount>0?"amber":void 0})},{key:"last",label:"Last",cls:"s-atop-col-last",kind:"time",defaultWidth:86,minWidth:64,sortValue:s=>s.lastEventAt,render:s=>is(s.lastEventAt,Date.now())},{key:"runtime",label:"Runtime",cls:"s-atop-col-runtime",kind:"number",tip:"Session duration (active period in current buffer)",defaultWidth:80,minWidth:64,sortValue:s=>s.sessionRuntimeSec,render:s=>rs(s.sessionRuntimeSec)}];function W({value:s,accent:n}){const l=s==null?"s-atop-col-num s-atop-col-num--dim":`s-atop-col-num${n?` s-atop-col-num--${n}`:""}`;return e.jsx("span",{className:l,children:S(s)})}function Vs({value:s}){const n=s==null?"s-atop-col-num s-atop-col-num--dim":"s-atop-col-num";return e.jsx("span",{className:n,children:us(s)})}function _s({shown:s,total:n,hasSelection:l}){return e.jsxs("div",{className:"s-atop-keys",children:[e.jsxs("span",{className:"s-atop-keys-count",children:[e.jsx("strong",{children:s})," / ",n," agents"]}),e.jsx("span",{className:"s-atop-keys-spacer"}),e.jsxs("span",{children:[e.jsx("kbd",{children:"/"})," filter"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"j"}),"/",e.jsx("kbd",{children:"k"})," select"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"click"})," drill in"]}),l&&e.jsxs("span",{children:[e.jsx("kbd",{children:"esc"})," close"]})]})}function zs({row:s,process:n,events:l,now:c,onClose:m}){const p=d.useMemo(()=>{const u={};for(const k of l){if(k.kind!=="tool")continue;const y=k.summary.match(/^([a-z_][a-z0-9_]*)/i),t=y?y[1]:"(tool)";u[t]=(u[t]??0)+1}const h=Object.entries(u).sort((k,y)=>y[1]-k[1]).slice(0,6),I=Math.max(1,...h.map(k=>k[1]));return h.map(([k,y])=>({name:k,count:y,frac:y/I}))},[l]),f=l.slice(-40).reverse();return e.jsxs("aside",{className:"s-atop-drawer","aria-label":`Agent ${s.key}`,children:[e.jsxs("header",{className:"s-atop-drawer-head",children:[e.jsxs("div",{className:"s-atop-drawer-head-meta",children:[e.jsxs("span",{className:`s-atop-status s-atop-status--${s.status}`,children:[e.jsx("span",{className:"s-atop-status-dot"}),X[s.status]]}),e.jsx("span",{className:"s-atop-drawer-pid",children:s.pid>0?`pid ${s.pid}`:"transcript"}),e.jsxs("span",{className:Z(s.harness),title:`origin: ${q[s.attribution]}`,children:[e.jsx(H,{harness:s.harness,size:11,title:null}),F(s.harness)]}),e.jsxs("span",{className:"s-atop-drawer-session",children:["session ",Q(s.sessionId)]})]}),e.jsx("h2",{className:"s-atop-drawer-title",children:s.project}),e.jsxs("p",{className:"s-atop-drawer-sub",children:["session ",Q(s.sessionId)," · runtime ",rs(s.sessionRuntimeSec)," · last activity ",is(s.lastEventAt,c)]}),e.jsx("button",{className:"s-atop-drawer-close",onClick:m,"aria-label":"Close (Esc)",children:"✕"})]}),e.jsxs("div",{className:"s-atop-drawer-body",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"s-atop-drawer-h3",children:"Activity"}),e.jsxs("div",{className:"s-atop-metrics",children:[e.jsx(b,{label:"Requests",value:S(s.reqCount||null)}),e.jsx(b,{label:"Tools",value:S(s.toolCount||null)}),e.jsx(b,{label:"Permissions",value:S(s.permCount||null),accent:s.permCount>0?"amber":void 0}),e.jsx(b,{label:"Tok in",value:S(s.tokIn),dim:s.tokIn==null}),e.jsx(b,{label:"Tok out",value:S(s.tokOut),dim:s.tokOut==null}),e.jsx(b,{label:"Cache hit",value:us($(s)),dim:$(s)==null}),e.jsx(b,{label:"Model",value:s.model??"—",dim:s.model==null}),e.jsx(b,{label:"Events",value:S(s.eventCount||null)})]})]}),p.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"s-atop-drawer-h3",children:"Tool calls"}),e.jsx("ul",{className:"s-atop-histo",children:p.map(u=>e.jsxs("li",{children:[e.jsx("span",{className:"s-atop-histo-name",children:u.name}),e.jsx("span",{className:"s-atop-histo-bar",children:e.jsx("span",{className:"s-atop-histo-fill",style:{width:`${(u.frac*100).toFixed(1)}%`}})}),e.jsx("span",{className:"s-atop-histo-count",children:u.count})]},u.name))})]}),e.jsxs("section",{children:[e.jsxs("h3",{className:"s-atop-drawer-h3",children:["Recent activity",e.jsxs("span",{className:"s-atop-drawer-h3-aside",children:[l.length," buffered"]})]}),f.length===0?e.jsx("div",{className:"s-atop-peek-empty",children:"no events buffered for this agent yet"}):e.jsx("ol",{className:"s-atop-peek",children:f.map(u=>e.jsxs("li",{className:`s-atop-peek-row s-atop-peek-row--${u.kind}`,children:[e.jsx("span",{className:"s-atop-peek-time",children:$s(u.ts)}),e.jsx("span",{className:"s-atop-peek-kind",children:u.kind}),e.jsx("span",{className:"s-atop-peek-text",children:u.summary})]},u.id))})]}),e.jsxs("section",{className:"s-atop-drawer-section--secondary",children:[e.jsx("h3",{className:"s-atop-drawer-h3",children:"Process"}),e.jsx("code",{className:"s-atop-codeblock",children:s.command}),e.jsxs("dl",{className:"s-atop-kvs",children:[e.jsx("dt",{children:"PID"}),e.jsx("dd",{children:s.pid>0?s.pid:"transcript-only"}),e.jsx("dt",{children:"Parent"}),e.jsxs("dd",{children:[s.parentLabel," (ppid ",s.ppid,")"]}),e.jsx("dt",{children:"Process etime"}),e.jsx("dd",{children:s.procEtime}),s.transcriptPath&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Transcript"}),e.jsx("dd",{children:s.transcriptPath})]}),e.jsx("dt",{children:"Origin"}),e.jsx("dd",{children:q[s.attribution]}),e.jsx("dt",{children:"CWD"}),e.jsx("dd",{children:s.cwd||"(none)"})]}),n?.parentChain&&n.parentChain.length>0&&e.jsx("ol",{className:"s-atop-chain",children:n.parentChain.map(u=>e.jsxs("li",{children:[e.jsx("span",{className:"s-atop-chain-pid",children:u.pid}),e.jsx("span",{className:"s-atop-chain-cmd",children:ws(u.command,80)})]},u.pid))})]})]})]})}function b({label:s,value:n,dim:l,accent:c}){const m=`s-atop-metric${l?" s-atop-metric--dim":""}${c?` s-atop-metric--${c}`:""}`;return e.jsxs("div",{className:m,children:[e.jsx("span",{className:"s-atop-metric-lbl",children:s}),e.jsx("span",{className:"s-atop-metric-val",children:n})]})}export{ne as AtopView};
@@ -1,6 +0,0 @@
1
- import{j as e,r as c}from"./index-DmFAhGPj.js";import{E as g}from"./EmptyState-BRY5jTpz.js";import{a as b}from"./api-h5zurxmi.js";import{u as j}from"./Provider-cJCdHAxu.js";import{E as y}from"./external-link-B1TI5yIt.js";import{b as N,t as k}from"./time-Dhsh_2EG.js";/* empty css *//* empty css */const f=new RegExp("(?:^|(?<=[\\s(`'\"<>]))(?:~\\/|\\/(?:Users|home|opt|var|etc|tmp|private)\\/)[^\\s)`'\"<>]+\\.[A-Za-z0-9]{1,8}\\b","g");function v(s){const r=s.replace(/\r\n?/g,`
2
- `).split(`
3
- `),n=[];let t=0;for(;t<r.length;){const i=r[t];if(i.trim()===""){t+=1;continue}if(i.startsWith("```")){const o=[];for(t+=1;t<r.length&&!r[t].startsWith("```");)o.push(r[t]),t+=1;t<r.length&&(t+=1),n.push({kind:"code",body:o.join(`
4
- `)});continue}const a=i.match(/^(#{1,3})\s+(.*\S)\s*$/);if(a){const o=a[1].length;n.push({kind:"heading",level:o,tokens:p(a[2])}),t+=1;continue}if(h(i)){const o=[];for(;t<r.length&&h(r[t]);)o.push(p(w(r[t]))),t+=1;n.push({kind:"list",items:o});continue}const l=[];for(;t<r.length&&r[t].trim()!==""&&!r[t].startsWith("```")&&!h(r[t])&&!/^#{1,3}\s+\S/.test(r[t]);)l.push(p(r[t])),t+=1;n.push({kind:"paragraph",lines:l})}return n}const x=/^\s*[-*]\s+/;function h(s){return x.test(s)}function w(s){return s.replace(x,"")}function p(s){const r=[];let n=0,t="";const i=()=>{t&&(r.push({kind:"text",body:t}),t="")};for(;n<s.length;){const a=s[n];if(a==="`"){const l=s.indexOf("`",n+1);if(l!==-1&&l>n+1){i(),r.push({kind:"code",body:s.slice(n+1,l)}),n=l+1;continue}}else if(a==="*"&&s[n+1]==="*"){const l=s.indexOf("**",n+2);if(l!==-1&&l>n+2){i(),r.push({kind:"bold",body:s.slice(n+2,l)}),n=l+2;continue}}else if(a==="*"||a==="_"){const l=C(s,n+1,a);if(l!==-1){i(),r.push({kind:"italic",body:s.slice(n+1,l)}),n=l+1;continue}}t+=a,n+=1}return i(),S(r)}function S(s){const r=[];for(const n of s){if(n.kind!=="text"){r.push(n);continue}const t=$(n.body);t.length===1&&t[0].kind==="text"?r.push(n):r.push(...t)}return r}function $(s){if(!s)return[];const r=[];let n=0;f.lastIndex=0;let t;for(;(t=f.exec(s))!==null;){const i=t.index,a=i+t[0].length;i>n&&r.push({kind:"text",body:s.slice(n,i)}),r.push({kind:"file-path",body:t[0]}),n=a}return n===0?[{kind:"text",body:s}]:(n<s.length&&r.push({kind:"text",body:s.slice(n)}),r)}function C(s,r,n){if(s[r]===void 0||/\s/.test(s[r]))return-1;for(let t=r;t<s.length;t+=1){const i=s[t];if(i===n){const a=s[t-1];if(a&&!/\s/.test(a)&&s[t+1]!==n)return t}if(i===`
5
- `)return-1}return-1}function L({text:s}){const r=v(s);return r.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5 text-sm leading-relaxed text-[var(--scout-chrome-ink)]",children:r.map((n,t)=>e.jsx(A,{block:n},t))})}function A({block:s}){switch(s.kind){case"paragraph":return e.jsx("p",{className:"whitespace-pre-wrap break-words",children:s.lines.map((r,n)=>e.jsxs(c.Fragment,{children:[n>0&&`
6
- `,e.jsx(u,{tokens:r})]},n))});case"list":return e.jsx("ul",{className:"ml-3 flex list-disc flex-col gap-1 marker:text-[var(--scout-chrome-ink-ghost)]",children:s.items.map((r,n)=>e.jsx("li",{className:"break-words pl-0.5",children:e.jsx(u,{tokens:r})},n))});case"code":return e.jsx("pre",{className:"overflow-x-auto rounded border border-[var(--scout-chrome-border-soft)] bg-black/25 px-2 py-1.5 text-xs leading-relaxed text-lime-100/90",children:s.body});case"heading":{const r="font-mono text-[var(--scout-chrome-ink-strong)] mt-2 first:mt-0";return s.level===1?e.jsx("h2",{className:`${r} text-lg font-bold uppercase tracking-[0.12em]`,children:e.jsx(u,{tokens:s.tokens})}):s.level===2?e.jsx("h3",{className:`${r} text-sm font-bold uppercase tracking-[0.14em] text-[var(--scout-chrome-ink)]`,children:e.jsx(u,{tokens:s.tokens})}):e.jsx("h4",{className:`${r} text-xs font-bold uppercase tracking-[0.16em] text-[var(--scout-chrome-ink-faint)]`,children:e.jsx(u,{tokens:s.tokens})})}}}function u({tokens:s}){return e.jsx(e.Fragment,{children:s.map((r,n)=>{switch(r.kind){case"text":return e.jsx(c.Fragment,{children:r.body},n);case"code":return e.jsx("code",{className:"rounded bg-black/25 px-1 text-xs text-lime-100/90",children:r.body},n);case"bold":return e.jsx("strong",{className:"font-bold text-[var(--scout-chrome-ink-strong)]",children:r.body},n);case"italic":return e.jsx("em",{className:"italic",children:r.body},n);case"file-path":return e.jsx(O,{path:r.body},n)}})})}function O({path:s}){const{openFilePreview:r}=j(),n=P(s),t=i=>{i.stopPropagation(),b("/api/file/reveal",{method:"POST",body:JSON.stringify({path:s})}).catch(()=>{})};return e.jsxs("span",{className:"inline-flex items-center gap-1 align-baseline",children:[e.jsx("button",{type:"button",onClick:()=>r(s),title:`Preview ${s} in Scout`,className:"inline-flex items-center gap-1 rounded border border-lime-300/30 bg-lime-300/[0.05] px-1.5 py-[1px] font-mono text-xs text-lime-200 transition-colors hover:bg-lime-300/[0.12] hover:text-lime-100",children:e.jsx("span",{className:"truncate",children:n})}),e.jsx("button",{type:"button",onClick:t,title:`Open ${s} in your OS`,"aria-label":"Open in OS",className:"inline-flex items-center justify-center rounded border border-[var(--scout-chrome-border-soft)] p-[2px] text-[var(--scout-chrome-ink-faint)] transition-colors hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]",children:e.jsx(y,{size:10})})]})}function P(s){const r=s.split("/").filter(Boolean);return r.length<=3?s:`…/${r.slice(-2).join("/")}`}const I={"fleet-home":"fleet briefing",tour:"tour briefing"};function T({briefingId:s,navigate:r}){const[n,t]=c.useState(null),[i,a]=c.useState(null),l=c.useCallback(async()=>{try{const o=await b(`/api/briefings/${encodeURIComponent(s)}`);t(o),a(null)}catch(o){a(o instanceof Error?o.message:"Failed to load briefing")}},[s]);return c.useEffect(()=>{l()},[l]),i?e.jsxs("div",{className:"sys-surface-page sys-surface-page-wide",children:[e.jsx("button",{type:"button",className:"briefing-detail-back",onClick:()=>r({view:"briefings"}),children:"← back to briefings"}),e.jsx(g,{title:"Couldn't load briefing",body:i})]}):n?e.jsxs("div",{className:"sys-surface-page sys-surface-page-wide briefing-detail",children:[e.jsx("button",{type:"button",className:"briefing-detail-back",onClick:()=>r({view:"briefings"}),children:"← back to briefings"}),e.jsxs("header",{className:"briefing-detail-header",children:[e.jsx("h2",{children:n.title}),e.jsxs("div",{className:"briefing-detail-header-meta",children:[e.jsx("span",{className:`briefing-kind briefing-kind-${n.kind}`,children:I[n.kind]}),e.jsx("span",{children:N(n.preparedAt)}),e.jsxs("span",{children:["· ",k(n.preparedAt)]})]}),e.jsx("p",{className:"briefing-detail-summary",children:n.summary}),n.recommendation?e.jsx("div",{className:"briefing-detail-recommendation",children:n.recommendation}):null]}),n.markdown?e.jsx(B,{markdown:n.markdown}):null,n.brief?.presented?e.jsx(M,{presented:n.brief.presented}):null,e.jsx(E,{call:n.call}),e.jsx(R,{brief:n.brief,navigate:r}),e.jsx(F,{observations:n.observations,navigate:r}),e.jsx(D,{snapshot:n.snapshot,call:n.call})]}):e.jsx("div",{className:"sys-surface-page sys-surface-page-wide",children:e.jsx("div",{className:"briefings-placeholder",children:"Loading briefing..."})})}function B({markdown:s}){return e.jsxs("section",{className:"briefing-layer briefing-layer-markdown",children:[e.jsx(d,{eyebrow:"Layer 0",title:"Brief (markdown)"}),e.jsx("div",{className:"briefing-markdown",children:e.jsx(L,{text:s})})]})}function E({call:s}){return!s||!s.telemetry&&!s.presenter?null:e.jsxs("section",{className:"briefing-layer briefing-layer-telemetry",children:[e.jsx(d,{eyebrow:"Telemetry",title:"Calls & usage"}),e.jsxs("dl",{className:"briefing-telemetry",children:[e.jsx(m,{label:"Analyst",model:s.model,responseId:s.responseId,telemetry:s.telemetry??null}),s.presenter?e.jsx(m,{label:"Presenter",model:s.presenter.model,responseId:s.presenter.responseId,telemetry:s.presenter,note:s.presenter.skipped==="rate-guard"?"skipped — rate-guard hit":s.presenter.skipped==="error"?`failed — ${s.presenter.errorMessage??"unknown"}`:null}):null]})]})}function m({label:s,model:r,responseId:n,telemetry:t,note:i}){const a=t?.usage??null;return e.jsxs("div",{className:"briefing-telemetry-row",children:[e.jsxs("div",{className:"briefing-telemetry-row-head",children:[e.jsx("span",{className:"briefing-telemetry-label",children:s}),e.jsx("span",{className:"briefing-telemetry-model",children:r}),i?e.jsx("span",{className:"briefing-telemetry-note",children:i}):null]}),e.jsxs("div",{className:"briefing-telemetry-stats",children:[e.jsx("span",{children:t&&t.elapsedMs>0?`${(t.elapsedMs/1e3).toFixed(2)}s`:"—"}),e.jsxs("span",{children:["in ",a?.inputTokens??"—"]}),e.jsxs("span",{children:["out ",a?.outputTokens??"—"]}),e.jsxs("span",{children:["total ",a?.totalTokens??"—"]}),n?e.jsx("span",{className:"briefing-telemetry-response",children:n}):null]})]})}function M({presented:s}){return e.jsxs("section",{className:"briefing-layer briefing-layer-presented",children:[e.jsx(d,{eyebrow:"Spoken",title:`Presented as · ${s.voiceSpec.persona}, ~${s.voiceSpec.targetWords} words`}),e.jsx("ol",{className:"briefing-presented-sentences",children:s.sentences.map((r,n)=>e.jsx("li",{className:"briefing-presented-sentence",children:r},n))}),e.jsxs("div",{className:"briefing-presented-meta",children:["model: ",s.model,s.responseId?` · response: ${s.responseId}`:""]})]})}function R({brief:s,navigate:r}){return s?e.jsxs("section",{className:"briefing-layer",children:[e.jsx(d,{eyebrow:"Layer 3",title:"Brief"}),s.steps.length>0?e.jsx("ol",{className:"briefing-steps",children:s.steps.map((n,t)=>e.jsxs("li",{className:"briefing-step",children:[e.jsxs("div",{className:"briefing-step-label",children:[t+1,". ",n.label]}),n.narration?e.jsx("p",{className:"briefing-step-narration",children:n.narration}):null]},n.id??t))}):null,s.actions.length>0?e.jsx("div",{className:"briefing-actions",children:s.actions.map((n,t)=>e.jsx("button",{type:"button",className:"s-btn",onClick:()=>{n.route&&r(n.route)},children:n.label},`${n.label}-${t}`))}):null]}):e.jsxs("section",{className:"briefing-layer",children:[e.jsx(d,{eyebrow:"Layer 3",title:"Brief & call"}),e.jsx("p",{className:"briefings-placeholder",children:"No brief body persisted."})]})}function F({observations:s,navigate:r}){return e.jsxs("section",{className:"briefing-layer",children:[e.jsx(d,{eyebrow:"Layer 2",title:`Observations (${s.length})`}),s.length===0?e.jsx("p",{className:"briefings-placeholder",children:"No observations on this brief."}):e.jsx("div",{className:"briefing-observations",children:s.map((n,t)=>{const i=n.tone==="warn"?"briefing-observation-warn":n.tone==="err"||n.tone==="error"?"briefing-observation-err":"";return e.jsxs("div",{className:`briefing-observation ${i}`.trim(),children:[e.jsx("div",{className:"briefing-observation-text",children:n.text}),n.references.length>0?e.jsx("div",{className:"briefing-observation-refs",children:n.references.map((a,l)=>e.jsx(_,{reference:a,navigate:r},`${a.label}-${l}`))}):null]},t)})})]})}function _({reference:s,navigate:r}){const n=!!s.route,t=s.detail?`${s.label} · ${s.detail}`:s.label;return n?e.jsx("button",{type:"button",className:"briefing-ref-chip",onClick:()=>r(s.route),children:t}):e.jsx("span",{className:"briefing-ref-chip briefing-ref-chip-static",children:t})}function D({snapshot:s,call:r}){const n=c.useMemo(()=>W(s),[s]),[t,i]=c.useState(!1);return e.jsxs("section",{className:"briefing-layer",children:[e.jsx(d,{eyebrow:"Layer 1",title:"Read snapshot"}),n.length>0?e.jsx("div",{className:"briefing-snapshot-counts",children:n.map(a=>e.jsxs("span",{className:"briefing-snapshot-count",children:[e.jsx("strong",{children:a.value})," ",a.label]},a.label))}):null,r?e.jsxs("details",{className:"briefing-snapshot-section",children:[e.jsx("summary",{className:"briefing-snapshot-section-head",children:"Call metadata"}),e.jsxs("dl",{className:"briefing-call-grid",children:[e.jsx("dt",{children:"Model"}),e.jsx("dd",{children:r.model}),e.jsx("dt",{children:"Response ID"}),e.jsx("dd",{children:r.responseId??"—"}),e.jsx("dt",{children:"System prompt"}),e.jsx("dd",{children:e.jsx("pre",{className:"briefing-call-prompt",children:r.systemPrompt})}),e.jsx("dt",{children:"Operator request"}),e.jsx("dd",{children:e.jsx("pre",{className:"briefing-call-prompt",children:r.operatorRequest})})]})]}):null,e.jsxs("div",{className:"briefing-snapshot-section",children:[e.jsx("button",{type:"button",className:"briefing-detail-back",onClick:()=>i(a=>!a),children:t?"Hide raw snapshot":"Show raw snapshot JSON"}),t?e.jsx("pre",{className:"briefing-snapshot-raw",children:JSON.stringify(s??{},null,2)}):null]})]})}function d({eyebrow:s,title:r}){return e.jsxs("div",{className:"briefing-layer-head",children:[e.jsx("span",{className:"briefing-layer-eyebrow",children:s}),e.jsx("span",{className:"briefing-layer-title",children:r})]})}function W(s){if(!s?.state)return[];const r=s.state,n=[],t=(i,a)=>{Array.isArray(a)&&n.push({label:i,value:a.length})};if(t("agents",r.agents),r.fleet&&typeof r.fleet=="object"){const i=r.fleet;t("active requests",i.activeAsks),t("attention",i.needsAttention),t("recent",i.recentCompleted)}if(r.broker&&typeof r.broker=="object"){const i=r.broker;t("broker msgs",i.recentMessages)}if(t("scout chatter",r.scoutChatter),t("tail events",r.agentLogMessages),r.operatorAttention&&typeof r.operatorAttention=="object"){const i=r.operatorAttention;t("operator items",i.items)}return n}const Q=Object.freeze(Object.defineProperty({__proto__:null,BriefingDetailScreen:T},Symbol.toStringTag,{value:"Module"}));export{T as B,L as S,Q as a};
@@ -1 +0,0 @@
1
- import{r as i,j as e}from"./index-DmFAhGPj.js";import{E as c}from"./EmptyState-BRY5jTpz.js";import{a as h}from"./api-h5zurxmi.js";import{t as m}from"./time-Dhsh_2EG.js";/* empty css *//* empty css */const g={"fleet-home":"fleet",tour:"tour"};function N({navigate:d}){const[r,f]=i.useState(null),[n,t]=i.useState(null),[l,o]=i.useState(!1),a=i.useCallback(async()=>{o(!0);try{const s=await h("/api/briefings?limit=50");f(s.briefings),t(null)}catch(s){t(s instanceof Error?s.message:"Failed to load briefings")}finally{o(!1)}},[]);return i.useEffect(()=>{a()},[a]),e.jsxs("div",{className:"sys-surface-page sys-surface-page-wide",children:[e.jsxs("div",{className:"sys-page-head",children:[e.jsxs("div",{className:"sys-page-title-group",children:[e.jsx("h2",{className:"sys-page-title",children:"Briefings"}),e.jsx("p",{className:"sys-page-subtitle",children:"Scoutbot's archived fleet briefs — what it told you, when, and what it saw. Rolling 100."})]}),e.jsx("div",{className:"sys-page-actions",children:e.jsx("button",{type:"button",className:"s-btn",disabled:l,onClick:()=>{a()},children:l?"Refreshing...":"Refresh"})})]}),n?e.jsx(c,{title:"Couldn't load briefings",body:n}):r===null?e.jsx("div",{className:"briefings-placeholder",children:"Loading briefings..."}):r.length===0?e.jsx(c,{title:"No briefings yet",body:"Scoutbot writes here when it generates a fleet brief — either on Home or via tour. Briefs land in this archive automatically."}):e.jsx("ul",{className:"briefings-list",children:r.map(s=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:"briefing-row",onClick:()=>d({view:"briefings",briefingId:s.id}),children:[e.jsxs("div",{className:"briefing-row-head",children:[e.jsx("span",{className:`briefing-kind briefing-kind-${s.kind}`,children:g[s.kind]}),e.jsx("span",{className:"briefing-row-title",children:s.title}),e.jsx("span",{className:"briefing-row-time",children:m(s.preparedAt)})]}),e.jsx("div",{className:"briefing-row-summary",children:s.summary}),e.jsxs("div",{className:"briefing-row-meta",children:[e.jsxs("span",{children:[s.observationCount," observations"]}),s.recommendation?e.jsxs("span",{children:["· ",s.recommendation]}):null]})]})},s.id))})]})}export{N as BriefingsScreen};
@@ -1,5 +0,0 @@
1
- import{r as n,j as e}from"./index-DmFAhGPj.js";import{r as cs}from"./index-CmwGCxUk.js";import{D as ds}from"./runtime-picker--IW3cRry.js";import{E as Re}from"./EmptyState-BRY5jTpz.js";import{u as us,i as hs}from"./MessageComposerSuggestions-FdVHnT_q.js";import{r as fs,R as ms,a as ps,b as bs}from"./NewChatComposer-Hd7pI5Ac.js";import{a as ne}from"./api-h5zurxmi.js";import{c as ys}from"./clipboard-e3fSpeo7.js";import{u as gs}from"./sse-CxXt4tqI.js";import{b as Ee}from"./status-tone-BM_zuRy1.js";import{t as Ie,b as We,n as V}from"./time-Dhsh_2EG.js";import{u as Qe,A as xs}from"./Provider-cJCdHAxu.js";import{o as qe}from"./openContent-C6XO6kr5.js";import{g as js,b as oe,h as Ve,e as ks,i as vs,d as ws,j as Ns,k as Ss,l as As,m as Rs}from"./broker-display-pp33bLsu.js";import{BrokerMetadataPanel as Is}from"./BrokerMetadataPanel-BhjECqOK.js";import{DispatchAftermath as Cs}from"./DispatchAftermath-BDA9CrOd.js";import{i as $s,c as Ds,n as Oe}from"./keyboard-nav-h1IdakpD.js";import{ShikiPane as Es}from"./ShikiPane-dBS9hD-z.js";import{d as Fs}from"./types-B0PlfpKc.js";/* empty css */import{L as ke}from"./loader-circle-d6PKL_KD.js";import{R as Ms}from"./refresh-cw-C4x1x6b_.js";import{X as Ce}from"./x-C8ayPBtj.js";import{A as Ls}from"./arrow-down-w1HPzDSE.js";import{E as _e}from"./external-link-B1TI5yIt.js";import{C as Ts}from"./chevron-down-B3VVRJcV.js";import{S as Ps}from"./sparkles-DJOBD_8l.js";import{P as Bs}from"./paperclip-iZmDMOS5.js";import{P as zs}from"./plus-gZ0T0eBI.js";import{S as qs}from"./send-horizontal-IcG46D2M.js";import{C as Os}from"./check-BX8nRgop.js";import{C as _s}from"./copy-BFmOcWof.js";import{M as Ks}from"./message-square-D1hMsMj_.js";import{c as Ye}from"./createLucideIcon-CFBn0Sdk.js";import{R as Us}from"./radio-RMLfV4EO.js";import{b as Hs,M as Js}from"./DocumentFocusViewer-B9vodVmG.js";import{B as Ws}from"./bot-DzCOGKi6.js";const Qs=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],Vs=Ye("at-sign",Qs);const Ys=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Gs=Ye("hash",Ys),Xs=160;function Ke(s){const a=new URLSearchParams({limit:String(Xs)});return s&&a.set("cursor",s),`/api/broker?${a.toString()}`}const Ue={index:-1,request:0};function Zs(s,a){return{index:a,request:s.request+1}}function Ge(s,a){return a===s.index?s:{index:a,request:s.request}}function er(s,a){return s.index<a?s:Ge(s,a>0?a-1:-1)}function sr(s,a){return s.request!==a}function rr({enabled:s,rowCount:a,onActivateRow:t,onClearSelection:i}){const[f,d]=n.useState(Ue),b=f.index,u=n.useRef(new Map),c=n.useRef(Ue.request),j=n.useCallback(y=>{d(m=>Zs(m,typeof y=="function"?y(m.index):y))},[]),k=n.useCallback(y=>{d(m=>Ge(m,typeof y=="function"?y(m.index):y))},[]);n.useEffect(()=>{if(!sr(f,c.current)||(c.current=f.request,f.index<0))return;const y=u.current.get(f.index);y?.scrollIntoView({block:"nearest"}),y?.focus()},[f]),n.useEffect(()=>{d(y=>er(y,a))},[a]);const R=n.useCallback((y,m)=>{m?u.current.set(y,m):u.current.delete(y)},[]);n.useEffect(()=>{if(!s)return;const y=m=>{if(document.querySelector(".sys-broker-page")&&!($s(m.target)||Ds())&&a!==0){if(m.key==="Escape"){i&&(m.preventDefault(),i(),k(-1));return}if(m.key==="ArrowDown"||m.key==="j"){m.preventDefault(),j(S=>Oe(S,a,1));return}if(m.key==="ArrowUp"||m.key==="k"){m.preventDefault(),j(S=>Oe(S,a,-1));return}if(m.key==="Home"||m.key==="g"&&!m.shiftKey){m.preventDefault(),j(0);return}if(m.key==="End"||m.key==="G"){m.preventDefault(),j(a-1);return}if(m.key==="Enter"||m.key===" "){const S=b<0?0:b;m.preventDefault(),j(S),t(S)}}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[s,b,j,t,i,a,k]);const U=n.useCallback(y=>({tabIndex:b===y?0:-1,ref:m=>R(y,m),onFocus:()=>k(y)}),[b,R,k]);return{focusedIndex:b,setFocusedIndex:k,getRowFocusProps:U}}const be=["all","delivered","failed"],ar={all:"All",delivered:"Delivered",failed:"Failed"};function tr(s){switch(s){case"success":return"Success";case"failed_query":return"Query failure";case"failed_delivery":return"Delivery failure";default:return"Delivery attempt"}}function Xe(s){return s.messageId??s.deliveryId??s.invocationId??s.id}function Ze(s){switch(Ee(s.kind,s.status)){case"success":return"Delivered";case"danger":return"Failed";case"working":return"Pending";case"warning":return"Held";default:return s.status?s.status.charAt(0).toUpperCase()+s.status.slice(1):"Queued"}}function $e(s){if(!s)return"··";const a=s.trim().split(/\s+/).filter(Boolean);if(a.length===0)return"··";const t=a[a.length-1];return/^\d+$/.test(t)?t.slice(-2):a.length>=2?(a[0][0]+a[1][0]).toUpperCase():s.trim().slice(0,2).toUpperCase()}function nr(s){const a=V(s)??0;return new Date(a).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function He(s){const a=V(s);return a===null?"—":new Date(a).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Ne(s,a,t=0){if(!s||typeof s!="object"||Array.isArray(s)||t>3)return;const i=s;for(const f of a)if(i[f]!==void 0&&i[f]!==null)return i[f];for(const f of Object.values(i)){const d=Ne(f,a,t+1);if(d!==void 0)return d}}function B(s,...a){const t=Ne(s.metadata,a);return typeof t!="string"&&typeof t!="number"?null:String(t).trim()||null}function ve(s,...a){const t=Ne(s.metadata,a);return typeof t=="number"||typeof t=="string"?V(t):null}function es(s){switch(s){case"dm":return"Direct · agent";case"channel":return"Channel";case"broadcast":return"Broadcast";case null:return"No route";default:return s.replaceAll("_"," ")}}function we(s,a){if(a==="to")return s.route==="channel"?"Channel":s.route==="broadcast"?"Broadcast":s.target?.toLowerCase().includes("operator")?"Operator":"Agent lane";const t=B(s,"class","actorClass")?.toLowerCase();return t==="operator"||t==="human"?"Operator":t==="agent"?"Agent":s.actorName?.toLowerCase().includes("operator")?"Operator":"Sender"}function or(s){const a=Ne(s.metadata,["latencyMs","durationMs"]);if(typeof a=="number"&&Number.isFinite(a)&&a>=0)return a<1e3?`${Math.round(a)}ms`:`${(a/1e3).toFixed(a<1e4?1:0)}s`;const t=ve(s,"sentAt","createdAt")??V(s.ts),i=ve(s,"deliveredAt","completedAt");if(t===null||i===null||i<t)return"—";const f=i-t;return f<1e3?`${f}ms`:`${(f/1e3).toFixed(f<1e4?1:0)}s`}function De({route:s}){switch(s){case"channel":return e.jsx(Gs,{size:12,"aria-hidden":"true"});case"broadcast":return e.jsx(Us,{size:12,"aria-hidden":"true"});case"dm":return e.jsx(Vs,{size:12,"aria-hidden":"true"});default:return e.jsx(Ks,{size:12,"aria-hidden":"true"})}}function ir(s,a){if(!a)return null;const t=a.trim().replace(/^@/,"").toLowerCase();return s.find(i=>[i.id,i.name,i.handle,i.selector,i.defaultSelector,i.conversationId,i.harnessSessionId].some(f=>f?.trim().replace(/^@/,"").toLowerCase()===t))??null}function lr(s,a,t){const i=t?.authorityNodeName??t?.homeNodeName??t?.authorityNodeId??t?.homeNodeId??B(s,"machine","machineName","nodeName");return(t?[{label:"Status",value:t.state},{label:"Handle",value:t.handle?`@${t.handle.replace(/^@/,"")}`:null},{label:"Project",value:t.project},{label:"Branch",value:t.branch},{label:"Runtime",value:[t.harness,t.model,t.reasoningEffort].filter(Boolean).join(" · ")||null},{label:"Machine",value:i},{label:"Working dir",value:t.cwd??t.projectRoot},{label:"Session",value:t.harnessSessionId},{label:"Conversation",value:t.conversationId??s.conversationId}]:[{label:"Kind",value:a==="to"&&s.conversationId?"Session route":we(s,a)},{label:"Channel",value:es(s.route)},{label:"Session",value:a==="to"?s.target:B(s,"sessionId","harnessSessionId")},{label:"Conversation",value:s.conversationId},{label:"Harness",value:B(s,"harness")},{label:"Model",value:B(s,"model")},{label:"Project",value:B(s,"project","projectName")},{label:"Branch",value:B(s,"branch")},{label:"Machine",value:i}]).filter(d=>!!d.value)}function Je({attempt:s,agents:a,side:t}){const i=t==="from"?s.actorName:s.target,f=ir(a,i),d=f?.name??i??(t==="from"?"Unknown":"No target"),b=f?"Agent":t==="to"&&s.conversationId?"Session":we(s,t),u=lr(s,t,f),c=`dispatch-endpoint-${s.id}-${t}`;return e.jsxs("span",{className:`sys-broker-endpoint sys-broker-endpoint--${t}`,tabIndex:0,"aria-describedby":c,children:[e.jsx("span",{className:"sys-broker-avatar sys-broker-endpoint-avatar","aria-hidden":"true",children:f||t==="from"?$e(d):e.jsx(De,{route:s.route})}),e.jsx("span",{className:"sys-broker-endpoint-name",title:d,children:d}),e.jsxs("span",{className:"sys-broker-endpoint-card",id:c,role:"tooltip",children:[e.jsxs("span",{className:"sys-broker-endpoint-card-head",children:[e.jsx("span",{className:"sys-broker-avatar","aria-hidden":"true",children:f||t==="from"?$e(d):e.jsx(De,{route:s.route})}),e.jsxs("span",{children:[e.jsx("strong",{children:d}),e.jsx("small",{children:b})]})]}),e.jsx("span",{className:"sys-broker-endpoint-card-body",children:u.map(j=>e.jsxs("span",{className:"sys-broker-endpoint-card-field",children:[e.jsx("small",{children:j.label}),e.jsx("code",{title:j.value,children:j.value})]},j.label))})]})]})}function ye(s){const a=V(s)??0,t=new Date(a);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function cr(s,a=Date.now()){const t=V(s)??0,i=new Date(t),f=new Date(a),d=new Date(a);return d.setDate(d.getDate()-1),ye(s)===ye(f.getTime())?"Today":ye(s)===ye(d.getTime())?"Yesterday":i.toLocaleDateString(void 0,{month:"short",day:"numeric",year:i.getFullYear()===f.getFullYear()?void 0:"numeric"})}function dr(s,a,t){return{...a,source:s.source,attempts:[...s.attempts,...a.attempts],failedQueries:s.failedQueries,failedDeliveries:s.failedDeliveries,dialogue:s.dialogue,ledger:{...a.ledger,cursors:{...s.ledger.cursors,[t]:a.ledger.cursors[t]},hasMore:{...s.ledger.hasMore,[t]:a.ledger.hasMore[t]}}}}function ur({navigate:s,embedded:a=!1,initialAttemptId:t}){const{route:i,agents:f,selectedBrokerAttempt:d,inspectBrokerAttempt:b,clearBrokerAttempt:u}=Qe(),[c,j]=n.useState(null),k=i.view==="broker"?i.filter??"all":"all",[R,U]=n.useState(!0),[y,m]=n.useState(!1),[S,Y]=n.useState(!1),[te,z]=n.useState(null),E=n.useRef(null),F=n.useRef(0),q=n.useRef(null),M=n.useCallback(async(o="initial")=>{const h=++F.current;!E.current&&o!=="background"?(U(!0),z(null)):m(!0);try{const x=await ne(Ke());if(h!==F.current)return;E.current=x,j(x),z(null)}catch(x){if(h!==F.current)return;z(x instanceof Error?x.message:String(x))}finally{h===F.current&&(U(!1),m(!1))}},[]),G=n.useCallback(async()=>{const o=E.current;if(!o||S)return;const h="attempts",x=o.ledger.cursors[h];if(!x||!o.ledger.hasMore[h])return;const T=++F.current;Y(!0),z(null);try{const P=await ne(Ke(x));if(T!==F.current)return;const se=E.current,ue=se?dr(se,P,h):P;E.current=ue,j(ue)}catch(P){if(T!==F.current)return;z(P instanceof Error?P.message:String(P))}finally{T===F.current&&Y(!1)}},[S]),le=n.useCallback(()=>{q.current||(q.current=setTimeout(()=>{q.current=null,M("background")},250))},[M]);n.useEffect(()=>(M("initial"),()=>{q.current&&clearTimeout(q.current)}),[M]),gs(o=>{(o.kind==="message.posted"||o.kind==="delivery.planned"||o.kind==="delivery.attempted"||o.kind==="delivery.state.changed"||o.kind==="scout.dispatched")&&le()});const v=n.useMemo(()=>{if(!c)return[];const o=new Map(c.dialogue.map(h=>[h.id,h.body]));return js(c.attempts).map(h=>{const x=h.messageId?o.get(h.messageId):null;return x&&x!==h.detail?{...h,detail:x}:h})},[c]),I=n.useMemo(()=>{switch(k){case"delivered":return v.filter(o=>!oe(o));case"failed":return v.filter(oe);default:return v}},[k,v]),ge=c?.ledger.hasMore.attempts??!1,X=n.useMemo(()=>({all:v.length,delivered:v.filter(o=>!oe(o)).length,failed:v.filter(oe).length}),[v]),$=n.useMemo(()=>{const o=i.view==="broker"?i.attemptId:void 0;return!c||!o?null:v.find(h=>h.id===o)??c.attempts.find(h=>h.id===o)??c.failedQueries.find(h=>h.id===o)??c.failedDeliveries.find(h=>h.id===o)??null},[c,v,i]),Z=$?`${$.id}\0${$.status}\0${$.ts}`:null,D=d?`${d.id}\0${d.status}\0${d.ts}`:null;n.useEffect(()=>{$&&Z!==D&&b($)},[D,b,$,Z]);const[C,N]=n.useState(null),O=n.useRef(!1),_=n.useCallback(o=>{if(a){O.current=!0,N(o);return}b(o)},[a,b]),H=n.useCallback(()=>{if(a){O.current=!0,N(null);return}u()},[u,a]),J=n.useCallback(o=>{const h=I[o];h&&(_(h),window.dispatchEvent(new CustomEvent("scout:set-inspector-width",{detail:{width:520}})))},[I,_]),{getRowFocusProps:ce,setFocusedIndex:xe}=rr({enabled:!!c&&I.length>0,rowCount:I.length,onActivateRow:J,onClearSelection:H}),de=C?.id??null,L=C?`${C.id} ${C.status} ${C.ts}`:null;n.useEffect(()=>{if(!a||!de)return;const o=v.find(h=>h.id===de);o&&`${o.id} ${o.status} ${o.ts}`!==L&&N(o)},[a,de,L,v]),n.useEffect(()=>{if(!a||!t||!c||O.current||C)return;const o=v.find(h=>h.id===t)??c.attempts.find(h=>h.id===t)??c.failedQueries.find(h=>h.id===t)??c.failedDeliveries.find(h=>h.id===t);o&&(O.current=!0,N(o))},[c,a,C,v,t]),n.useEffect(()=>{const o=i.view==="broker"?i.attemptId:void 0;if(!o)return;const h=I.findIndex(x=>x.id===o);h>=0&&xe(h)},[I,k,i,xe]);const ee=n.useCallback(o=>{const x=(be.indexOf(k)+o+be.length)%be.length,T=be[x];s({view:"broker",...T==="all"?{}:{filter:T}})},[k,s]),A=a?C:null;return e.jsx("div",{className:`s-ops${a?" s-ops--embedded":""}${A?" s-ops--split":""}`,children:e.jsxs("div",{className:"s-ops-body",children:[e.jsxs("div",{className:"sys-surface-page sys-surface-page-wide sys-surface-page-fluid sys-broker-page",children:[e.jsxs("div",{className:"sys-ledger-toolbar","aria-label":"Dispatch controls",children:[c?e.jsx("div",{className:"sys-tab-row sys-tab-row--toolbar",role:"tablist","aria-label":"Dispatch message filters",onKeyDown:o=>{o.key==="ArrowRight"?(o.preventDefault(),ee(1)):o.key==="ArrowLeft"&&(o.preventDefault(),ee(-1))},children:be.map(o=>e.jsxs("button",{type:"button",role:"tab","aria-selected":k===o,className:`sys-tab${k===o?" sys-tab-active":""}`,onClick:()=>s({view:"broker",...o==="all"?{}:{filter:o}}),children:[e.jsx("span",{children:ar[o]}),e.jsx("span",{className:"sys-tab-count",children:X[o]})]},o))}):e.jsx("div",{className:"sys-ledger-kicker",children:"Dispatch ledger"}),e.jsxs("div",{className:"sys-page-actions sys-ledger-actions",children:[e.jsx("div",{className:"sys-sync-note",children:R?"Loading dispatch ledger...":c?`Updated ${Ie(c.generatedAt)}${c.source?.latestMessageAt?` · latest message ${Ie(c.source.latestMessageAt)}`:""}`:"Waiting for dispatch data"}),e.jsx("button",{type:"button",className:"s-btn",disabled:R||y,onClick:()=>{M("manual")},children:y?"Refreshing...":"Refresh"})]})]}),te&&e.jsxs("div",{className:"sys-banner sys-banner-warning",children:[e.jsx("strong",{children:"Refresh failed."}),e.jsx("span",{children:te})]}),y&&c&&e.jsxs("div",{className:"sys-broker-source-note",role:"status","aria-live":"polite",children:[e.jsx(ke,{className:"sys-broker-source-spinner",size:12,"aria-hidden":"true"}),e.jsx("strong",{children:"Updating dispatches…"})]}),!y&&c?.source?.mode==="sqlite_projection"&&c.source.status==="degraded"&&c.source.detail&&e.jsxs("div",{className:"sys-broker-source-note sys-broker-source-note--warning",role:"status","aria-label":c.source.detail,title:c.source.detail,children:[e.jsx("span",{className:"sys-broker-source-dot","aria-hidden":"true"}),e.jsx("strong",{children:"Dispatch may be out of date"}),e.jsx("span",{children:"Live broker unavailable; showing saved dispatch history."})]}),R&&!c&&e.jsx(Re,{title:"Loading dispatch",body:"Reading the dispatch database snapshot."}),!R&&!c&&!te&&e.jsx(Re,{title:"No dispatch data",body:"No dispatch rows are available yet."}),c&&e.jsxs(e.Fragment,{children:[e.jsx(hr,{attempts:I,agents:f,selectedAttemptId:a?C?.id??null:d?.id??(i.view==="broker"?i.attemptId??null:null),onInspect:_,getRowFocusProps:ce}),I.length>0&&ge&&e.jsx("div",{className:"sys-ledger-footer",children:e.jsx("button",{type:"button",className:"s-btn",disabled:S,onClick:()=>{G()},children:S?"Loading older...":"Load older"})})]})]}),A&&e.jsx("div",{className:"s-broker-embed-detail",children:e.jsx(ss,{attempt:A,navigate:s,onClose:H})})]})})}function hr({attempts:s,agents:a,selectedAttemptId:t,onInspect:i,getRowFocusProps:f}){if(s.length===0)return e.jsx(Re,{title:"No dispatch rows",body:"No dispatch rows are available yet."});const d=s.reduce((b,u,c)=>{const j=ye(u.ts),k=b[b.length-1];return k?.key===j?k.attempts.push({attempt:u,index:c}):b.push({key:j,label:cr(u.ts),attempts:[{attempt:u,index:c}]}),b},[]);return e.jsxs("div",{className:"sys-broker-wire","aria-label":"Dispatch ledger",children:[e.jsxs("div",{className:"sys-broker-wire-head","aria-hidden":"true",children:[e.jsx("span",{className:"sys-broker-col sys-broker-col--status",children:"Status"}),e.jsx("span",{className:"sys-broker-col sys-broker-col--from",children:"From"}),e.jsx("span",{className:"sys-broker-col sys-broker-col--to",children:"To"}),e.jsx("span",{className:"sys-broker-col sys-broker-col--msg",children:"Message"}),e.jsx("span",{className:"sys-broker-col sys-broker-col--time",children:"Time"})]}),d.map(b=>e.jsxs("section",{className:"sys-broker-day","aria-labelledby":`dispatch-day-${b.key}`,children:[e.jsxs("header",{className:"sys-broker-day-head",children:[e.jsx("h2",{id:`dispatch-day-${b.key}`,children:b.label}),e.jsxs("span",{children:[b.attempts.length," ",b.attempts.length===1?"dispatch":"dispatches"]})]}),e.jsx("div",{className:"sys-broker-wire-body",role:"list",children:b.attempts.map(({attempt:u,index:c})=>{const j=Ee(u.kind,u.status),k=oe(u),R=Ve(u),U=ks(u.detail,vs(u)),y=Ze(u),m=()=>{i(u),window.dispatchEvent(new CustomEvent("scout:set-inspector-width",{detail:{width:520}}))};return e.jsxs("div",{role:"listitem",className:`sys-broker-wire-row${k?" sys-broker-wire-row--failure":""}${t===u.id?" sys-broker-wire-row--selected":""}`,"aria-label":`Inspect ${u.detail}`,onClick:m,...f(c),children:[e.jsxs("div",{className:"sys-broker-cell sys-broker-col--status",children:[e.jsx("span",{className:`sys-broker-dot sys-broker-dot--${j}`,"aria-hidden":"true"}),e.jsx("span",{className:`sys-broker-state sys-broker-state--${j}`,children:y})]}),e.jsx("div",{className:"sys-broker-cell sys-broker-col--from",children:e.jsx(Je,{attempt:u,agents:a,side:"from"})}),e.jsxs("div",{className:"sys-broker-cell sys-broker-col--to",children:[e.jsx(xs,{className:"sys-broker-route-arrow",size:13,"aria-hidden":"true"}),e.jsx(Je,{attempt:u,agents:a,side:"to"})]}),e.jsxs("div",{className:"sys-broker-cell sys-broker-col--msg",children:[e.jsx("span",{className:"sys-broker-msg",title:u.detail,children:U}),k&&R&&e.jsx("span",{className:"sys-broker-msg-error",title:R,children:R})]}),e.jsxs("div",{className:"sys-broker-cell sys-broker-col--time",children:[e.jsx("time",{className:"sys-broker-time-rel",title:We(u.ts),children:Ie(u.ts)}),e.jsx("span",{className:"sys-broker-time-abs",children:nr(u.ts)})]})]},u.id)})})]},b.key))]})}function fr(s){const a=Xe(s);return[{label:"Kind",value:tr(s.kind)},{label:"Time",value:We(s.ts)},{label:"Actor",value:s.actorName},{label:"Target",value:s.target},{label:"Route",value:s.route},{label:"Conversation",value:s.conversationId},{label:"Reference",value:a},{label:"Message",value:s.messageId===a?null:s.messageId},{label:"Delivery",value:s.deliveryId===a?null:s.deliveryId},{label:"Invocation",value:s.invocationId===a?null:s.invocationId}].filter(t=>!!t.value)}function ie({value:s,subject:a,className:t}){const[i,f]=n.useState("idle"),d=n.useRef(null);n.useEffect(()=>{f("idle")},[s]),n.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const b=n.useCallback(async()=>{const j=await ys(s);d.current&&clearTimeout(d.current),f(j?"copied":"failed"),d.current=setTimeout(()=>{f("idle"),d.current=null},1500)},[s]),u=i==="copied",c=i==="failed";return e.jsx("button",{type:"button",className:`sys-copy-btn${t?` ${t}`:""}${u?" sys-copy-btn--copied":""}${c?" sys-copy-btn--failed":""}`,onClick:()=>{b()},title:u?`Copied ${a}`:c?"Copy failed":`Copy ${a}`,"aria-label":u?`Copied ${a}`:c?`Copy ${a} failed`:`Copy ${a}`,children:u?e.jsx(Os,{size:14,"aria-hidden":"true"}):e.jsx(_s,{size:14,"aria-hidden":"true"})})}function mr(s){const a=s.trim();if(a.startsWith("{")||a.startsWith("["))try{return{code:JSON.stringify(JSON.parse(a),null,2),path:"payload.json",language:"JSON"}}catch{}return{code:s,path:"payload.md",language:"Text · Markdown"}}function pr({payload:s}){const a=n.useMemo(()=>mr(s),[s]),[t,i]=n.useState(!1),f=n.useRef(null),d=a.code.split(`
2
- `).length;n.useEffect(()=>{const u=f.current;!u||!t||u.open||u.showModal()},[t]),n.useEffect(()=>{i(!1)},[s]);const b=e.jsx("div",{className:"sys-broker-payload-code","data-language":a.path==="payload.json"?"json":"markdown",role:"region","aria-label":`Dispatch payload, ${a.language}`,tabIndex:0,children:e.jsx(Es,{code:a.code,path:a.path})});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sys-broker-payload-head",children:[e.jsx("span",{className:"sys-detail-label",children:"Payload"}),e.jsxs("span",{className:"sys-broker-payload-meta",children:[a.language," · ",d," ",d===1?"line":"lines"]}),e.jsx(ie,{value:s,subject:"payload"}),e.jsx("button",{type:"button",className:"sys-copy-btn sys-broker-payload-expand",onClick:()=>i(!0),title:"Expand payload","aria-label":"Expand payload",children:e.jsx(Hs,{size:14,"aria-hidden":"true"})})]}),e.jsx("div",{className:"sys-broker-payload-resizer",children:b}),t&&cs.createPortal(e.jsxs("dialog",{ref:f,className:"sys-broker-payload-dialog","aria-label":"Expanded dispatch payload",onCancel:u=>{u.preventDefault(),i(!1)},onClose:()=>i(!1),children:[e.jsxs("header",{className:"sys-broker-payload-dialog-head",children:[e.jsxs("div",{children:[e.jsx("span",{className:"sys-detail-label",children:"Dispatch payload"}),e.jsxs("span",{className:"sys-broker-payload-meta",children:[a.language," · ",d," ",d===1?"line":"lines"]})]}),e.jsx(ie,{value:s,subject:"payload"}),e.jsx("button",{type:"button",className:"sys-copy-btn",onClick:()=>i(!1),title:"Return payload to inspector","aria-label":"Return payload to inspector",children:e.jsx(Js,{size:14,"aria-hidden":"true"})})]}),e.jsx("div",{className:"sys-broker-payload-dialog-body",children:b})]}),document.body)]})}function br({attempt:s}){const a=Rs(s);return e.jsxs("div",{className:"sys-broker-route-failure",role:"status",children:[e.jsx("span",{className:"sys-broker-route-failure-mark","aria-hidden":"true",children:e.jsx(Ce,{size:14})}),e.jsxs("div",{children:[e.jsx("span",{className:"sys-detail-label",children:"Routing stopped"}),e.jsx("strong",{children:a}),e.jsx("p",{children:s.detail})]}),e.jsx(ie,{value:s.detail,subject:"failure detail"})]})}function ss({attempt:s,navigate:a,onClose:t}){const{route:i,agents:f,scoutbotAgentId:d}=Qe(),b=fr(s),u=ws(s.metadata),c=oe(s),j=s.kind==="failed_query",k=Ve(s),R=Ee(s.kind,s.status),U=ve(s,"sentAt","createdAt")??V(s.ts),y=ve(s,"deliveredAt","completedAt")??V(s.ts),m=Xe(s),[S,Y]=n.useState("idle"),[te,z]=n.useState(null),[E,F]=n.useState(null),[q,M]=n.useState(""),[G,le]=n.useState(""),[v,I]=n.useState("idle"),[ge,X]=n.useState(null),[$,Z]=n.useState(""),[D,C]=n.useState(""),[N,O]=n.useState(""),[_,H]=n.useState(""),[J,ce]=n.useState("medium"),[xe,de]=n.useState(null),[L,ee]=n.useState([]),[A,o]=n.useState("idle"),[h,x]=n.useState(null),T=B(s,"harness"),P=B(s,"model"),se=B(s,"reasoningEffort","effort"),ue=n.useRef(null),Fe=n.useRef(null),Se=n.useMemo(()=>Ns(s),[s]),w=n.useMemo(()=>f.filter(r=>!r.retiredFromFleet&&!r.staleLocalRegistration).slice().sort((r,l)=>r.id===d?-1:l.id===d?1:(l.updatedAt??0)-(r.updatedAt??0)||r.name.localeCompare(l.name)),[f,d]),he=n.useMemo(()=>Ss(s,w)?.id??"",[s,w]),fe=w.some(r=>r.id===d)?d:w[0]?.id??"",je=w[0]?.id??"",re=w.find(r=>r.id===fe)??null,rs=n.useMemo(()=>{const r=new Map;for(const l of w){const p=l.projectRoot?.trim()||l.cwd?.trim();if(!p)continue;const g=p.split("/").filter(Boolean).at(-1)??p;r.set(p,l.project?.trim()||g)}return[...r.entries()].map(([l,p])=>({path:l,label:p}))},[w]),Me=n.useRef({originalTargetAgentId:he,firstRoutableAgentId:je,defaultForwardAgentId:fe,defaultForwardAgent:re,effort:"medium"});Me.current={originalTargetAgentId:he,firstRoutableAgentId:je,defaultForwardAgentId:fe,defaultForwardAgent:re,effort:B(s,"reasoningEffort","effort")||"medium"};const me=n.useRef(!1);n.useEffect(()=>{const r=Me.current;me.current=!1,Y("idle"),z(null),F(null),M(""),le(r.originalTargetAgentId||r.firstRoutableAgentId),I("idle"),X(null),Z(r.defaultForwardAgentId),C(r.defaultForwardAgent?.projectRoot?.trim()||r.defaultForwardAgent?.cwd?.trim()||""),O(r.defaultForwardAgent?.harness?.trim()||""),H(r.defaultForwardAgent?.model?.trim()||""),ce(r.effort),ee([]),o("idle"),x(null)},[s.id]),n.useEffect(()=>{me.current||(le(r=>r||he||je),Z(r=>r||fe),C(r=>r||re?.projectRoot?.trim()||re?.cwd?.trim()||""),O(r=>r||re?.harness?.trim()||""),H(r=>r||re?.model?.trim()||""))},[re,fe,je,he]),n.useEffect(()=>{const r=new URLSearchParams({scope:"global+project"});D&&r.set("projectRoot",D);let l=!1;return ne(`/api/runner/options?${r.toString()}`).then(p=>{!l&&p.schemaVersion==="openscout.runtime-capabilities.v1"&&de(p)}).catch(()=>{}),()=>{l=!0}},[D]);const as=n.useCallback(r=>{M(r),window.requestAnimationFrame(()=>ue.current?.focus())},[]),ts=n.useCallback(async()=>{const r=w.find(l=>l.id===G);if(!(!r||v==="sending")){I("sending"),X(null);try{const l=await ne("/api/ask",{method:"POST",body:JSON.stringify({body:s.detail,targetAgentId:r.id,targetLabel:r.name,...T||P||se?{execution:{...T?{harness:T}:{},...P?{model:P}:{},...se?{reasoningEffort:se}:{},session:"new"}}:{},metadata:{source:"scout-dispatch-redispatch",originalDispatchId:s.id,...s.messageId?{originalMessageId:s.messageId}:{},...s.conversationId?{originalConversationId:s.conversationId}:{}}})}),p=l.flightId??l.flight?.id;I("sent"),X(`New dispatch sent to ${r.name}${p?` · ${p}`:""}`)}catch(l){I("failed"),X(`Retry failed. ${l instanceof Error?l.message:String(l)}`)}}},[s,G,v,se,T,P,w]),Le=n.useCallback(async()=>{const r=q.trim(),l=w.find(p=>p.id===$);if(!(!r||!l||A==="sending")){o("sending"),x(L.length>0?`Uploading ${L.length} ${L.length===1?"attachment":"attachments"}…`:null);try{const p=L.length>0?await us(L):[],g=await ne("/api/ask",{method:"POST",body:JSON.stringify({body:`${r}
3
-
4
- Attached dispatch context:
5
- ${Se}`,targetAgentId:l.id,targetLabel:l.name,...p.length>0?{attachments:p}:{},execution:{...N?{harness:N}:{},..._?{model:_}:{},...J?{reasoningEffort:J}:{}},metadata:{source:"scout-dispatch-forward",originalDispatchId:s.id,...D?{targetProjectPath:D}:{},...s.messageId?{originalMessageId:s.messageId}:{},...s.conversationId?{originalConversationId:s.conversationId}:{}}})}),W=g.flightId??g.flight?.id;o("sent"),x(`Request sent to ${l.name}${W?` · ${W}`:""}`),M(""),ee([])}catch(p){o("failed"),x(`Request wasn't sent. ${p instanceof Error?p.message:String(p)}`)}}},[s,Se,$,J,L,N,_,D,A,q,w]),ns=n.useCallback(r=>{const l=r.filter(hs),p=r.length-l.length;l.length>0&&(ee(g=>[...g,...l]),o("idle"),x(null)),p>0&&(o("failed"),x("Attach markdown, code, an image, or a video clip."))},[]),os=c?["Get a second opinion","Propose a recovery plan","Draft a follow-up"]:["Summarize this dispatch","Draft a follow-up","What changed?"],K=w.find(r=>r.id===G)??null,ae=w.find(r=>r.id===$)??null,pe=w.filter(r=>D?(r.projectRoot?.trim()||r.cwd?.trim())===D:!0),Te=xe??ms,Ae=n.useMemo(()=>{const r=fs(Te),l=[_,ae?.harness===N?ae.model:null,...pe.filter(g=>g.harness===N).map(g=>g.model)].map(g=>g?.trim()).filter(g=>!!g);let p=r.harnesses;return p.some(g=>g.value===N)||(p=[{value:N,label:N||"default",models:[]},...p]),p=p.map(g=>{if(g.value!==N)return g;const W=g.models.some(Q=>Q.value==="")?g.models:[{value:"",label:"Default",note:"harness picks"},...g.models],ls=new Set(W.map(Q=>Q.value)),ze=l.filter(Q=>!ls.has(Q)).map(Q=>({value:Q,label:Q,note:"observed"}));return ze.length===0&&W===g.models?g:{...g,models:[...W,...ze]}}),{...r,harnesses:p}},[Te,ae,N,_,pe]);n.useEffect(()=>{const r=ps(Ae,N);!r||r.some(l=>l.value===J)||ce(r.find(l=>l.value==="medium")?.value??r[0]?.value??"")},[Ae,N,J]);const is=n.useCallback(async()=>{Y("running"),z(null);try{const r=await ne("/api/broker/dispatch-review",{method:"POST",body:JSON.stringify(As(s))});Y("sent"),F(r.conversationId),z(r.conversationId?`Report started${r.targetLabel?` with ${r.targetLabel}`:""}. Open the conversation to follow it.`:`Report started${r.targetLabel?` with ${r.targetLabel}`:""}${r.flightId?` · ${r.flightId}`:""}.`)}catch(r){Y("failed"),z(`Couldn't start the report. ${r instanceof Error?r.message:String(r)}`)}},[s]),Pe=c?e.jsxs("div",{className:"sys-broker-action-row",children:[e.jsxs("div",{className:"sys-broker-action-line",children:[e.jsx("span",{className:"sys-broker-action-label",id:"dispatch-report-title",children:"Failure report"}),e.jsxs("button",{type:"button",className:"sys-broker-report-button",disabled:S==="running"||S==="sent"&&!E,onClick:()=>{if(E){qe(a,{view:"conversation",conversationId:E},{returnTo:i});return}is()},children:[S==="running"?e.jsx(ke,{size:13,className:"sys-broker-action-spinner","aria-hidden":"true"}):E?e.jsx(_e,{size:13,"aria-hidden":"true"}):e.jsx(Ws,{size:13,"aria-hidden":"true"}),S==="running"?"Starting report…":E?"Open report conversation":"Start failure report"]})]}),te&&e.jsx("div",{className:`sys-broker-review-status sys-broker-review-status--${S}`,role:"status",children:te})]}):null,Be=e.jsxs("div",{className:"sys-broker-action-row",children:[e.jsxs("div",{className:"sys-broker-action-line",children:[e.jsx("span",{className:"sys-broker-action-label",id:"dispatch-redispatch-title",children:"Retry"}),e.jsxs("div",{className:"sys-broker-redispatch-controls",children:[e.jsx("select",{"aria-label":"Retry destination",value:G,disabled:v==="sending"||w.length===0,onChange:r=>{le(r.target.value),I("idle"),X(null)},children:w.length===0?e.jsx("option",{value:"",children:"No agents available"}):e.jsxs(e.Fragment,{children:[!G&&e.jsx("option",{value:"",children:"Original destination unavailable"}),w.map(r=>e.jsxs("option",{value:r.id,children:[r.id===d?"Scout":r.name,r.project?` · ${r.project}`:""]},r.id))]})}),e.jsxs("button",{type:"button",className:"sys-broker-redispatch-send",disabled:!K||v==="sending",onClick:()=>{ts()},children:[v==="sending"?e.jsx(ke,{size:13,className:"sys-broker-action-spinner","aria-hidden":"true"}):e.jsx(Ms,{size:13,"aria-hidden":"true"}),v==="sending"?"Retrying…":"Retry dispatch"]})]})]}),K&&e.jsxs("div",{className:"sys-broker-action-target-meta",children:[K.harness&&e.jsx("span",{children:K.harness}),K.model&&e.jsx("span",{children:K.model}),(K.cwd??K.projectRoot)&&e.jsx("code",{children:K.cwd??K.projectRoot})]}),ge&&e.jsx("div",{className:`sys-broker-action-status sys-broker-action-status--${v}`,role:"status",children:ge})]});return e.jsxs("aside",{className:"sys-panel sys-broker-inspector","aria-label":"Dispatch route inspector",children:[e.jsx("header",{className:"sys-broker-inspector-head",children:e.jsxs("div",{className:"sys-broker-inspector-status",children:[e.jsx("span",{className:`sys-broker-dot sys-broker-dot--${R}`,"aria-hidden":"true"}),e.jsx("strong",{className:`sys-broker-state sys-broker-state--${R}`,children:Ze(s)}),e.jsx("code",{title:m,children:m}),e.jsx(ie,{value:Se,subject:"dispatch context",className:"sys-broker-inspector-copy"}),e.jsx("button",{type:"button",className:"sys-copy-btn sys-broker-inspector-close",onClick:t,title:"Close inspector","aria-label":"Close inspector",children:e.jsx(Ce,{size:14,"aria-hidden":"true"})})]})}),e.jsxs("div",{className:"sys-broker-inspector-body",children:[e.jsxs("section",{className:"sys-broker-route-stack","aria-label":"Dispatch route",children:[e.jsxs("div",{className:"sys-broker-route-party",children:[e.jsx("span",{className:"sys-broker-avatar sys-broker-route-avatar","aria-hidden":"true",children:$e(s.actorName)}),e.jsxs("div",{className:"sys-broker-route-party-copy",children:[e.jsxs("span",{className:"sys-detail-label",children:["From · ",we(s,"from")]}),e.jsx("strong",{children:s.actorName??"Unknown sender"})]})]}),e.jsx(Ls,{className:"sys-broker-route-down",size:17,"aria-hidden":"true"}),e.jsxs("div",{className:"sys-broker-route-party",children:[e.jsx("span",{className:"sys-broker-route-target-icon","aria-hidden":"true",children:e.jsx(De,{route:s.route})}),e.jsxs("div",{className:"sys-broker-route-party-copy",children:[e.jsxs("span",{className:"sys-detail-label",children:["To · ",we(s,"to")]}),e.jsx("code",{title:s.target??"No target",children:s.target??"No target"})]}),s.conversationId&&e.jsxs("button",{type:"button",className:"sys-broker-route-button",onClick:()=>qe(a,{view:"conversation",conversationId:s.conversationId},{returnTo:i}),children:[e.jsx(_e,{size:11,"aria-hidden":"true"}),"Route"]})]})]}),e.jsxs("dl",{className:"sys-broker-delivery-grid",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Channel"}),e.jsx("dd",{children:es(s.route)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Latency"}),e.jsx("dd",{className:"sys-broker-delivery-accent",children:or(s)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Sent"}),e.jsx("dd",{children:He(U)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:c?"Failed":"Delivered"}),e.jsx("dd",{children:He(y)})]})]}),e.jsxs("section",{className:"sys-broker-payload",children:[j?e.jsx(br,{attempt:s}):e.jsx(pr,{payload:s.detail}),c&&!j&&k&&e.jsxs("div",{className:"sys-broker-inspector-error",role:"status",children:[e.jsx("span",{className:"sys-broker-inspector-error-label",children:"Error"}),e.jsx("p",{children:k})]})]}),e.jsx(Cs,{attempt:s,targetAgentId:he||null,navigate:a,returnTo:i}),e.jsx("section",{className:"sys-broker-actions","aria-label":"Dispatch actions",children:j?e.jsxs(e.Fragment,{children:[Pe,Be]}):e.jsxs(e.Fragment,{children:[Be,Pe]})}),e.jsxs("details",{className:"sys-broker-technical",children:[e.jsxs("summary",{children:[e.jsx("span",{children:"Technical details"}),e.jsx(Ts,{size:13,"aria-hidden":"true"})]}),e.jsx("div",{className:"sys-broker-inspector-rows",children:b.map(r=>e.jsxs("div",{className:"sys-broker-inspector-row",children:[e.jsx("span",{className:"sys-detail-label",children:r.label}),e.jsx("code",{className:"sys-detail-value",children:r.value}),e.jsx(ie,{value:r.value,subject:r.label.toLowerCase()})]},r.label))}),e.jsxs("div",{className:"sys-broker-metadata",children:[e.jsxs("div",{className:"sys-broker-metadata-head",children:[e.jsx("span",{className:"sys-detail-label",children:"Metadata"}),e.jsx(ie,{value:u,subject:"metadata",className:"sys-broker-metadata-copy"})]}),e.jsx(Is,{metadata:s.metadata,rawJson:u})]})]})]}),e.jsxs("section",{className:"sys-broker-forward","aria-labelledby":"dispatch-forward-title",children:[e.jsx("div",{className:"sys-broker-forward-head",children:e.jsx("span",{id:"dispatch-forward-title",className:"sys-broker-action-label",children:"Follow up"})}),e.jsxs("div",{id:"dispatch-forward-content",children:[e.jsx("div",{className:"sys-broker-forward-intro",children:e.jsx("div",{className:"sys-broker-ask-prompts","aria-label":"Suggested requests",children:os.map(r=>e.jsxs("button",{type:"button",onClick:()=>as(r),children:[e.jsx(Ps,{size:11,"aria-hidden":"true"}),r]},r))})}),e.jsxs("form",{className:"sys-broker-message-composer",onSubmit:r=>{r.preventDefault(),Le()},children:[e.jsx("label",{htmlFor:"dispatch-message-input",children:"Request"}),e.jsx("textarea",{ref:ue,id:"dispatch-message-input",value:q,rows:3,placeholder:`What should ${ae?.id===d?"Scout":ae?.name??"this agent"} investigate or do?`,disabled:A==="sending",onChange:r=>{M(r.target.value),A!=="idle"&&(o("idle"),x(null))},onKeyDown:r=>{r.key==="Enter"&&(r.metaKey||r.ctrlKey)&&(r.preventDefault(),Le())}}),L.length>0&&e.jsx("div",{className:"sys-broker-composer-attachments","aria-label":"Attachments",children:L.map((r,l)=>e.jsxs("span",{children:[e.jsx(Bs,{size:10,"aria-hidden":"true"}),e.jsx("span",{title:r.name,children:r.name}),e.jsx("button",{type:"button",onClick:()=>ee(p=>p.filter((g,W)=>W!==l)),"aria-label":`Remove ${r.name}`,children:e.jsx(Ce,{size:10,"aria-hidden":"true"})})]},`${r.name}:${r.size}:${l}`))}),e.jsxs("footer",{children:[e.jsxs("div",{className:"sys-broker-composer-left",children:[e.jsx("input",{ref:Fe,type:"file",multiple:!0,hidden:!0,disabled:A==="sending",onChange:r=>{ns([...r.target.files??[]]),r.target.value=""}}),e.jsx("button",{type:"button",className:"sys-broker-composer-attach",disabled:A==="sending",onClick:()=>Fe.current?.click(),"aria-label":"Attach files",title:"Attach files",children:e.jsx(zs,{size:16,"aria-hidden":"true"})}),e.jsx("span",{className:"sys-broker-message-attachment",title:m,children:"Dispatch context included"})]}),e.jsxs("div",{className:"sys-broker-composer-targets",children:[e.jsx("span",{className:"sys-broker-composer-route-label",children:"Send to"}),e.jsxs("label",{title:"Project target",children:[e.jsx("span",{children:"Project"}),e.jsxs("select",{"aria-label":"Project target",value:D,disabled:A==="sending",onChange:r=>{const l=r.target.value,p=w.find(g=>!l||(g.projectRoot?.trim()||g.cwd?.trim())===l)??null;me.current=!0,C(l),p&&(Z(p.id),O(p.harness?.trim()||""),H(p.model?.trim()||""))},children:[e.jsx("option",{value:"",children:"Any project"}),rs.map(r=>e.jsx("option",{value:r.path,children:r.label},r.path))]})]}),e.jsxs("label",{title:"Agent target",children:[e.jsx("span",{children:"Agent"}),e.jsx("select",{"aria-label":"Agent target",value:$,disabled:A==="sending"||pe.length===0,onChange:r=>{const l=w.find(p=>p.id===r.target.value)??null;me.current=!0,Z(r.target.value),l&&(C(l.projectRoot?.trim()||l.cwd?.trim()||""),O(l.harness?.trim()||""),H(l.model?.trim()||"")),o("idle"),x(null)},children:pe.length===0?e.jsx("option",{value:"",children:"No agents"}):pe.map(r=>e.jsx("option",{value:r.id,children:r.id===d?"Scout":r.name},r.id))})]}),e.jsx(bs,{catalog:Ae,value:{harness:N,model:_,effort:J},onChange:r=>{me.current=!0,O(r.harness),H(r.model),ce(r.effort)},disabled:A==="sending"}),e.jsx(ds,{className:"sys-broker-composer-mic",disabled:A==="sending",onAppend:r=>M(l=>l.trim()?`${l.trimEnd()} ${r}`:r),onError:r=>{o("failed"),x(r)}})]}),e.jsx("button",{type:"submit",className:"sys-broker-composer-send",disabled:!q.trim()||!ae||A==="sending","aria-label":`Ask ${ae?.name??"recipient"} about this dispatch`,children:A==="sending"?e.jsx(ke,{size:14,className:"sys-broker-action-spinner","aria-hidden":"true"}):e.jsx(qs,{size:14,"aria-hidden":"true"})})]})]}),h&&e.jsx("div",{className:`sys-broker-action-status sys-broker-action-status--${A}`,role:"status",children:h})]})]})]})}const yr=Fs({id:"dispatch",label:"Dispatch",route:{view:"broker"},webPath:"/dispatch",screen:"BrokerScreen",embed:{path:"/embed/dispatch",profile:"macos.dispatch",rootClassName:"s-broker-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},ownsInternalRoutes:!0,resolveEmbedProps:s=>{const a=s.get("attempt")?.trim();return a?{initialAttemptId:a}:{}},hosts:{macos:!0}}}),sa=Object.freeze(Object.defineProperty({__proto__:null,BrokerAttemptInspector:ss,BrokerScreen:ur,scoutSurface:yr},Symbol.toStringTag,{value:"Module"}));export{ss as B,ur as a,Ke as b,sa as c};
@@ -1 +0,0 @@
1
- import{j as t,r as g}from"./index-DmFAhGPj.js";import{i as A,k,l as N,a as D}from"./conversation-model-CHwHZNw-.js";import{l as L,i as E,a as _,p as w}from"./conversation-prefs-DNre-Lcx.js";import{u as O,m as P,g as R}from"./Provider-cJCdHAxu.js";import{b as U}from"./router-Cn_s9IGH.js";import{l as T,i as C,s as V}from"./sessionRead-CvFz2RHv.js";import{u as z}from"./use-conversation-list-C-dPcjQe.js";import{d as H}from"./colors-BtO5_zlx.js";/* empty css */function q({children:a,count:l,tone:s="default",title:n}){return t.jsxs("div",{className:["collapsed-strip-label",s!=="default"&&`collapsed-strip-label--${s}`,l!=null&&"collapsed-strip-label--has-count"].filter(Boolean).join(" "),title:n??a,children:[t.jsx("span",{className:"collapsed-strip-label-mark","aria-hidden":!0}),t.jsx("span",{className:"collapsed-strip-label-text",children:a}),l!=null?t.jsx("span",{className:"collapsed-strip-label-count",children:l}):null]})}function F({label:a,emptyMark:l="·",showLabel:s=!0,labelTone:n="default",labelCount:r,children:d}){const c=!d||Array.isArray(d)&&d.length===0,u=s?t.jsx(q,{tone:n,count:r,children:a}):null;return c?t.jsxs("div",{className:"collapsed-strip collapsed-strip--empty","aria-hidden":!0,children:[u,t.jsx("span",{className:"collapsed-strip-empty-mark",children:l})]}):t.jsxs("div",{className:"collapsed-strip",role:"list","aria-label":a,children:[u,d]})}function G(){return t.jsx("div",{className:"collapsed-strip-rule","aria-hidden":!0})}function J({title:a,active:l,tone:s="default",ava:n,avaColor:r,glyph:d,dot:c,pinned:u,onClick:h}){const j=["collapsed-chip",s==="channel"&&"collapsed-chip--channel",s==="neutral"&&"collapsed-chip--neutral",s==="attention"&&"collapsed-chip--attention",s==="unread"&&"collapsed-chip--unread",l&&"collapsed-chip--active",u&&"collapsed-chip--pinned"].filter(Boolean).join(" ");return t.jsxs("button",{type:"button",role:"listitem",className:j,title:a,"aria-label":a,"aria-current":l?"page":void 0,onClick:h,children:[n?t.jsx("span",{className:"collapsed-chip-ava",style:r?{background:r}:void 0,children:n}):t.jsx("span",{className:"collapsed-chip-glyph",children:d}),c?t.jsx("span",{className:["collapsed-chip-dot",c==="attention"&&"collapsed-chip-dot--attention",c==="live"&&"collapsed-chip-dot--live"].filter(Boolean).join(" "),"aria-hidden":!0}):null,u?t.jsx("span",{className:"collapsed-chip-pin","aria-hidden":!0}):null]})}function K(a){const l=a.trim(),s=l.split(/[\s/_-]+/).filter(Boolean);if(s.length>=2){const n=s[s.length-1];return/^\d+$/.test(n)&&s.length>=3?(s[s.length-2][0]??"?").toUpperCase():(n[0]??"?").toUpperCase()}return(l[0]??"?").toUpperCase()}const Q=3,W=3,X=4,Y=3;function I(a,l){return[...a].sort((s,n)=>{const r=C(s.lastMessageAt,s.id,l)?0:1,d=C(n.lastMessageAt,n.id,l)?0:1;return r!==d?r-d:(n.lastMessageAt??0)-(s.lastMessageAt??0)})}function Z(){const{route:a,navigate:l,agents:s}=O(),{sessions:n}=z(),[r,d]=g.useState(()=>L()),[c,u]=g.useState(()=>T()),h=U(a),j=g.useMemo(()=>P(s,h),[s,h]),$=a.view==="messages"||a.view==="conversation"?a.conversationId:void 0;g.useEffect(()=>{d(L()),u(T())},[]);const i=g.useMemo(()=>{const e=R(n,j,h).filter(o=>!E(o.id,r)),m=e.filter(o=>_(o.id,r)).sort((o,y)=>w(y.id,r)-w(o.id,r)||(y.lastMessageAt??0)-(o.lastMessageAt??0)).slice(0,Q),f=new Set(m.map(o=>o.id)),p=e.filter(o=>!f.has(o.id));return{pinned:m,channels:I(p.filter(N),c).slice(0,W),dms:I(p.filter(k),c).slice(0,X),observed:I(p.filter(A),c).slice(0,Y),totals:{channels:p.filter(N).length,dms:p.filter(k).length,observed:p.filter(A).length,pinned:e.filter(o=>_(o.id,r)).length}}},[n,j,h,r,c]),B=e=>{u(V(e.id)),l({view:"messages",conversationId:e.id,...h?{machineId:h}:{}})},S=[...i.pinned,...i.channels,...i.dms,...i.observed],M=S.filter(e=>C(e.lastMessageAt,e.id,c)).length,x=(e,m=!1)=>{const f=D(e),p=N(e),o=C(e.lastMessageAt,e.id,c);return t.jsx(J,{title:m?`${f} · pinned`:f,active:e.id===$,tone:p?"channel":o?"unread":"default",ava:p?void 0:K(e.agentName??f),avaColor:p?void 0:H(e.agentName??f),glyph:p?"#":void 0,dot:o?"unread":null,pinned:m,onClick:()=>B(e)},e.id)},v=[];return i.pinned.length&&v.push(t.jsx(b,{mark:"Pin",count:i.totals.pinned,children:i.pinned.map(e=>x(e,!0))},"pin")),i.channels.length&&v.push(t.jsx(b,{mark:"#",count:i.totals.channels,children:i.channels.map(e=>x(e))},"ch")),i.dms.length&&v.push(t.jsx(b,{mark:"DM",count:i.totals.dms,children:i.dms.map(e=>x(e))},"dm")),i.observed.length&&v.push(t.jsx(b,{mark:"Obs",count:i.totals.observed,children:i.observed.map(e=>x(e))},"obs")),t.jsx(F,{label:"Chat",emptyMark:"#",labelTone:M>0?"accent":"default",labelCount:M>0?M:S.length||void 0,children:v.flatMap((e,m)=>m===0?[e]:[t.jsx(G,{},`rule-${m}`),e])})}function b({mark:a,count:l,children:s}){return t.jsxs("div",{className:"collapsed-strip-section",role:"group","aria-label":a,children:[t.jsxs("div",{className:"collapsed-strip-section-mark",title:l!=null?`${a} · ${l}`:a,children:[t.jsx("span",{className:"collapsed-strip-section-mark-text",children:a}),l!=null&&l>0?t.jsx("span",{className:"collapsed-strip-section-mark-count",children:l>99?"99+":l}):null]}),s]})}const ce=Object.freeze(Object.defineProperty({__proto__:null,ChatCollapsedStrip:Z},Symbol.toStringTag,{value:"Module"}));export{F as C,Z as a,J as b,K as c,G as d,ce as e};
@@ -1 +0,0 @@
1
- import{r as s,j as r}from"./index-DmFAhGPj.js";import{a as G}from"./api-h5zurxmi.js";import{c as je}from"./clipboard-e3fSpeo7.js";import{f as ze}from"./scoutbot-BTIErYHo.js";import{g as Ae,f as Ce}from"./api-BkjHJfgJ.js";import{d as Ke}from"./types-B0PlfpKc.js";import{r as Oe,C as He}from"./CodeDiffPane-Bx_2VAzv.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-C1yOJKvs.js";import{ShikiPane as Ye}from"./ShikiPane-dBS9hD-z.js";/* empty css */import{A as Ze}from"./arrow-left-B-3GJ7ct.js";import{C as et}from"./chevron-right-BYMV1511.js";import{C as tt}from"./check-BX8nRgop.js";import{C as nt}from"./copy-BFmOcWof.js";import"./cache-Dr0why2k.js";import"./usePierreRuntime-Cm7-qdm0.js";import"./chunk-HRAB3GC3-dRd2eQMJ.js";/* empty css */import"./chevron-down-B3VVRJcV.js";import"./createLucideIcon-CFBn0Sdk.js";import"./search-DAyagUtF.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 Nt({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 Rt=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{Nt as CodeContent,Rt as scoutSurface};
@@ -1 +0,0 @@
1
- import{r as u,j as s}from"./index-DmFAhGPj.js";const x={current:null,setMenu:null};function p(){return u.useCallback((i,t)=>{i.preventDefault(),i.stopPropagation(),x.setMenu?.({position:{x:i.clientX,y:i.clientY},items:t})},[])}function f({children:i}){const[t,w]=u.useState(null),d=u.useRef(null);x.setMenu=w;const r=u.useCallback(()=>{w(null)},[]);return u.useEffect(()=>{if(!t)return;const e=n=>{n.target instanceof Node&&d.current?.contains(n.target)||r()},o=n=>{n.key==="Escape"&&r()},l=()=>r(),c=n=>{n.defaultPrevented||r()};return window.addEventListener("mousedown",e,!0),window.addEventListener("keydown",o),window.addEventListener("wheel",l,!0),window.addEventListener("contextmenu",c),()=>{window.removeEventListener("mousedown",e,!0),window.removeEventListener("keydown",o),window.removeEventListener("wheel",l,!0),window.removeEventListener("contextmenu",c)}},[t,r]),u.useLayoutEffect(()=>{if(!t||!d.current)return;const e=d.current,o=e.getBoundingClientRect(),l=window.innerWidth,c=window.innerHeight;let n=t.position.x,a=t.position.y;n+o.width>l-8&&(n=l-o.width-8),a+o.height>c-8&&(a=c-o.height-8),n<8&&(n=8),a<8&&(a=8),e.style.left=`${n}px`,e.style.top=`${a}px`,e.style.visibility="visible"},[t]),s.jsxs(s.Fragment,{children:[i,t&&s.jsx("div",{ref:d,className:"s-context-menu",style:{left:t.position.x,top:t.position.y,visibility:"hidden"},role:"menu",onMouseDown:e=>e.stopPropagation(),children:t.items.map((e,o)=>e.kind==="separator"?s.jsx("div",{className:"s-context-menu-sep",role:"separator"},o):s.jsxs("button",{type:"button",className:"s-context-menu-item",role:"menuitem",onClick:()=>{e.onSelect(),r()},children:[s.jsx("span",{className:"s-context-menu-label",children:e.label}),e.shortcut&&s.jsx("span",{className:"s-context-menu-shortcut",children:e.shortcut})]},o))})]})}export{f as C,p as u};
@@ -1 +0,0 @@
1
- import{r as u,j as e}from"./index-DmFAhGPj.js";import{d as G}from"./colors-BtO5_zlx.js";import{M as J}from"./runtime-picker--IW3cRry.js";import{i as Y,r as Z,d as z,a as ee,M}from"./MessageComposerSuggestions-FdVHnT_q.js";import{F as se}from"./file-text-DcYSrI4v.js";import"./index-CmwGCxUk.js";import{c as te}from"./createLucideIcon-CFBn0Sdk.js";import{X as ae}from"./x-C8ayPBtj.js";const ne=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]],re=te("reply",ne),_="Only markdown, code, images, and video clips can be attached.";function be(){const[o,g]=u.useState([]),[p,x]=u.useState(null),[c,h]=u.useState(null),[m,j]=u.useState(0),a=u.useRef(null),k=u.useCallback((n,l="Attached")=>{const i=n.filter(Y);return i.length===0?(n.length>0&&h(_),0):(h(null),g(N=>{const F=new Set(N.map(d=>`${d.name}:${d.size}:${d.lastModified}`)),q=i.filter(d=>!F.has(`${d.name}:${d.size}:${d.lastModified}`));return q.length>0?[...N,...q]:N}),x(i.length===1?`${l} ${i[0]?.name??"1 attachment"}.`:`${l} ${i.length} attachments.`),i.length)},[]),b=u.useCallback(n=>{g(l=>l.filter(i=>i!==n)),x(null)},[]),y=u.useCallback(()=>{g([]),x(null),h(null),j(0)},[]),$=u.useCallback(()=>{a.current?.click()},[]),R=u.useCallback(n=>{const l=Z(n.clipboardData);l.length!==0&&(n.preventDefault(),k(l,"Pasted"))},[k]),f=u.useMemo(()=>({onDragOver:n=>{z(n.dataTransfer)&&(n.preventDefault(),j(l=>l===0?1:l))},onDragLeave:n=>{n.currentTarget.contains(n.relatedTarget)||j(0)},onDrop:n=>{if(!z(n.dataTransfer))return;n.preventDefault(),j(0);const l=ee(n.dataTransfer);if(l.length===0){h(_);return}k(l,"Dropped")}}),[k]);return{files:o,hasFiles:o.length>0,feedback:p,error:c,dragActive:m>0,stage:k,remove:b,clear:y,setError:h,openPicker:$,dropHandlers:f,onPaste:R,inputRef:a}}function oe({file:o,onRemove:g}){const p=u.useMemo(()=>URL.createObjectURL(o),[o]);u.useEffect(()=>()=>URL.revokeObjectURL(p),[p]);const x=o.type.startsWith("video/"),c=o.type.startsWith("image/");return e.jsxs("div",{className:"s-msg-compose-attachment",children:[x?e.jsx("video",{src:p,muted:!0,playsInline:!0}):c?e.jsx("img",{src:p,alt:o.name}):e.jsxs("div",{className:"s-msg-compose-attachment-file",title:o.name,children:[e.jsx(se,{size:18,"aria-hidden":"true"}),e.jsx("span",{children:o.name})]}),e.jsx("button",{type:"button",className:"s-msg-compose-attachment-remove","aria-label":`Remove ${o.name}`,onClick:g,children:"×"})]})}function le({attachments:o,accept:g="image/*,video/*,text/markdown,.md,.markdown,text/plain,.txt"}){const{files:p,feedback:x,error:c,remove:h,stage:m,inputRef:j}=o;return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:j,type:"file",multiple:!0,accept:g,className:"s-msg-compose-file-input",onChange:a=>{m([...a.target.files??[]]),a.target.value=""}}),p.length>0?e.jsx("div",{className:"s-msg-compose-attachments","aria-label":"Staged attachments",children:p.map(a=>e.jsx(oe,{file:a,onRemove:()=>h(a)},`${a.name}:${a.size}:${a.lastModified}`))}):null,c?e.jsx("div",{className:"s-msg-compose-attach-note","data-tone":"error",role:"alert",children:c}):x?e.jsx("div",{className:"s-msg-compose-attach-note","data-tone":"muted",role:"status",children:x}):null]})}function ce({composeRef:o,draft:g,setDraft:p,composePlaceholder:x,slashState:c,setSlashState:h,filteredSlashCommands:m,applySlashCommand:j,mentionState:a,setMentionState:k,filteredMentions:b,applyMention:y,updateTriggersFromDraft:$,closeSuggestions:R,replyTarget:f,onCancelReply:n,isStopMode:l,sending:i,composeAction:N,onSend:F,onInterrupt:q,attachments:d,isAgentBusy:H,busyIntent:P,onBusyIntentChange:T,queued:v,queueNote:I,onEditQueued:K,editingQueuedId:C,editingAttachmentCount:E,onCancelEdit:W,onUnqueue:S,onSendQueuedNow:Q}){const B=e.jsxs(e.Fragment,{children:[c.open?e.jsx(M,{label:"Slash commands",items:m.map(s=>({id:s.command,token:s.label,description:s.description})),activeIndex:c.index,onPick:s=>{const t=m[s];t&&j(t)},onActiveIndexChange:s=>h(t=>({...t,index:s}))}):null,a.open?e.jsx(M,{label:"Mention agent",items:b.map(s=>({id:s.id,token:`@${s.handle}`,description:s.name,avatar:{label:s.name[0]?.toUpperCase()??"?",color:G(s.name)}})),activeIndex:a.index,onPick:s=>{const t=b[s];t&&y(t)},onActiveIndexChange:s=>k(t=>({...t,index:s}))}):null]}),V=g.trim().length>0,A=C!==null,L=V||d.hasFiles||E>0,D=H&&L,w=D&&P==="steer",O=A?v.findIndex(s=>s.id===C)+1:0,U=D?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":P==="queue",title:"Hold this draft until the running turn lands",disabled:i,onClick:()=>T("queue"),children:"Queue"}),e.jsx("button",{type:"button",className:"s-msg-compose-mode-btn","data-mode":"steer","aria-pressed":P==="steer",title:"Interrupt the running turn and deliver this now",disabled:i,onClick:()=>T("steer"),children:"Steer"})]}):null,X=v.length>0||U?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:v.length>0?`Queue · ${v.length}`:"Queues next"}),e.jsx("span",{className:"s-msg-compose-queue-hint",children:A?w?`Rewriting ${O} — send interrupts this turn`:`Rewriting ${O} — send returns it to its place`:v.length>0?w?"Send interrupts this turn":I??"":w?"Interrupts this turn on send":"Sends when this turn lands"}),U]}),v.map((s,t)=>e.jsxs("div",{className:"s-msg-compose-queue-row","data-editing":s.id===C?"true":void 0,children:[e.jsx("span",{className:"s-msg-compose-queue-index",children:t+1}),e.jsx("span",{className:"s-msg-compose-queue-body",children:s.body.trim()||"Attachments only"}),s.attachments.length>0?e.jsxs("span",{className:"s-msg-compose-queue-clip",children:[s.attachments.length," file",s.attachments.length===1?"":"s"]}):null,s.id===C?e.jsx("button",{type:"button",className:"s-msg-compose-queue-edit",title:"Stop rewriting — leave this row as it was","aria-label":`Cancel rewriting queued message ${t+1}`,onClick:W,children:"Cancel edit"}):e.jsx("button",{type:"button",className:"s-msg-compose-queue-edit",title:"Pull this back into the input box to rewrite it","aria-label":`Edit queued message ${t+1}`,disabled:i||A,onClick:()=>K(s.id),children:"Edit"}),e.jsx("button",{type:"button",className:"s-msg-compose-queue-now",title:"Interrupt this turn and send this now","aria-label":`Send queued message ${t+1} now`,disabled:i||s.id===C,onClick:()=>Q(s.id),children:"Send now"}),e.jsx("button",{type:"button",className:"s-msg-compose-queue-drop",title:"Cancel — drop this from the queue","aria-label":`Cancel queued message ${t+1}`,onClick:()=>S(s.id),children:"×"})]},s.id))]}):null;return e.jsx(J,{density:"thread",value:g,onChange:(s,t)=>{p(s),$(s,t?.caret??s.length)},onSend:F,placeholder:x,sending:i,stopMode:l,onStop:q,canSend:L,sendTitle:w?"Steer — interrupt this turn and send now (Cmd+Enter)":D?"Queue for the next turn (Cmd+Enter)":"Send (Cmd+Enter)",sendAriaLabel:w?"Steer — interrupt this turn and send now (Cmd+Enter)":D?"Queue message for the next turn (Cmd+Enter)":N==="steer"?"Send follow-up (Cmd+Enter)":"Send message (Cmd+Enter)",showAttach:!0,onAttach:d.openPicker,onPaste:d.onPaste,dropHandlers:d.dropHandlers,dragActive:d.dragActive,textareaRef:o,overlay:B,above:X,aboveAttached:!0,header:e.jsxs(e.Fragment,{children:[f?e.jsxs("div",{className:"s-thread-compose-reply",role:"status",children:[e.jsx(re,{className:"s-thread-compose-reply-icon",size:13,strokeWidth:1.8,"aria-hidden":"true"}),e.jsx("span",{className:"s-thread-compose-reply-label",children:"Replying to"}),e.jsx("span",{className:"s-thread-compose-reply-actor",children:f.actorLabel}),e.jsx("span",{className:"s-thread-compose-reply-preview",title:f.preview,children:f.preview}),e.jsx("button",{type:"button",className:"s-thread-compose-reply-cancel","aria-label":"Cancel reply",title:"Cancel reply",onClick:n,children:e.jsx(ae,{size:13,strokeWidth:1.8,"aria-hidden":"true"})})]}):null,A&&E>0?e.jsxs("div",{className:"s-msg-compose-carried",role:"status",children:[E," file",E===1?"":"s"," stay attached to this draft"]}):null,e.jsx(le,{attachments:d})]}),tools:e.jsxs("span",{className:"s-thread-compose-hint s-msg-compose-tools-hint",children:[e.jsx("kbd",{className:"s-kbd",children:"/"})," commands"," · ",e.jsx("kbd",{className:"s-kbd",children:"@"})," agents"]}),onSelect:s=>{const t=s.currentTarget;$(t.value,t.selectionStart)},onBlur:()=>{setTimeout(R,120)},onKeyDown:s=>{if(!(c.open&&m.length>0||a.open&&b.length>0))return!1;if(s.key==="ArrowDown")return c.open?h(r=>({...r,index:(r.index+1)%m.length})):a.open&&k(r=>({...r,index:(r.index+1)%b.length})),!0;if(s.key==="ArrowUp")return c.open?h(r=>({...r,index:(r.index-1+m.length)%m.length})):a.open&&k(r=>({...r,index:(r.index-1+b.length)%b.length})),!0;if(s.key==="Escape")return R(),!0;if((s.key==="Enter"||s.key==="Tab")&&!s.shiftKey&&!s.metaKey&&!s.ctrlKey&&!s.altKey){if(c.open){const r=m[c.index]??m[0];r&&j(r)}else if(a.open){const r=b[a.index]??b[0];r&&y(r)}return!0}return!1}})}const je=Object.freeze(Object.defineProperty({__proto__:null,ConversationComposer:ce},Symbol.toStringTag,{value:"Module"}));export{ce as C,je as a,be as u};
@@ -1 +0,0 @@
1
- import{j as t}from"./index-DmFAhGPj.js";import{M as p}from"./message-markup-CyRDLdOn.js";import{f as d}from"./conversation-model-CHwHZNw-.js";import{t as n}from"./time-Dhsh_2EG.js";import"./mentions-agCGDgyA.js";import"./colors-BtO5_zlx.js";import"./index-CmwGCxUk.js";import"./api-h5zurxmi.js";import"./Provider-cJCdHAxu.js";import"./router-Cn_s9IGH.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-AmSgHklm.js";import"./sse-CxXt4tqI.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-CHIuVKz7.js";import"./DocumentFocusViewer-B9vodVmG.js";import"./createLucideIcon-CFBn0Sdk.js";import"./TextDocumentSurface-BWJCGBZf.js";/* empty css */import"./file-text-DcYSrI4v.js";import"./x-C8ayPBtj.js";import"./chevron-right-BYMV1511.js";import"./code-xml-BFc3TMSm.js";import"./arrow-left-B-3GJ7ct.js";import"./scout-voice-CwbOz6EN.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-h1IdakpD.js";import"./MessageComposerSuggestions-FdVHnT_q.js";import"./NewChatComposer-Hd7pI5Ac.js";import"./runtime-picker--IW3cRry.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-d6PKL_KD.js";import"./HarnessMark-BPAphNjx.js";import"./NewChatOrigin-DmuJ32wa.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-B3VVRJcV.js";import"./search-DAyagUtF.js";import"./chunk-HRAB3GC3-dRd2eQMJ.js";import"./AgentDetailCard-BTiOmh-a.js";import"./AgentLiveActions-BJ5dIfL3.js";import"./terminal-takeover-BOFPRPjR.js";import"./openContent-C6XO6kr5.js";import"./eye-1J4yOUoG.js";import"./terminal-DJPUp_Qn.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 st({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{st as FanOutRow,l as ThreadDayDivider};
@@ -1 +0,0 @@
1
- import{j as e}from"./index-DmFAhGPj.js";import{c as p}from"./clipboard-e3fSpeo7.js";import{b as A}from"./router-Cn_s9IGH.js";import{A as f}from"./AgentAvatar-D8ZtMluU.js";import{u as $}from"./ContextMenu-CHIuVKz7.js";import{B as I}from"./BackToPicker-D1LV6Cqp.js";import{o as j}from"./openContent-C6XO6kr5.js";import{v as S,w as L}from"./conversation-model-CHwHZNw-.js";import{E as M}from"./eye-1J4yOUoG.js";import{c as T}from"./createLucideIcon-CFBn0Sdk.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-AmSgHklm.js";import"./api-h5zurxmi.js";import"./SpriteAvatar-DS6Tmyua.js";import"./agent-identity-BxCsXnDp.js";import"./colors-BtO5_zlx.js";import"./time-Dhsh_2EG.js";const B=[["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"}]],F=T("user-plus",B);function R({showBackNav:r,isDm:t,navigate:l,route:n,canonicalConversationId:x,threadTitle:d,agentId:c,sessionId:a,detailRoute:h,visibleParticipants:b,hiddenParticipantCount:v,operator:m,canAddParticipants:k,onToggleAddParticipant:g}){const C=$(),u=A(n);return e.jsxs("div",{className:"s-thread-center-header",onClick:s=>{s.target?.closest("button,a,input,select,textarea")||!t||!h||j(l,h,{returnTo:n})},style:t&&h?{cursor:"pointer"}:void 0,onContextMenu:s=>{const o=[{kind:"action",label:"Copy Title",onSelect:()=>{p(d)}}];c&&o.push({kind:"action",label:"Copy Agent ID",onSelect:()=>{p(c)}}),!c&&a&&o.push({kind:"action",label:"Copy Session ID",onSelect:()=>{p(a)}}),o.push({kind:"action",label:"Copy Conversation ID",onSelect:()=>{p(x)}}),C(s,o)},children:[r&&e.jsx(I,{slot:"conversation",fallback:{view:"inbox"},navigate:l,label:"Back",className:"s-thread-header-back"}),e.jsx("div",{className:"s-thread-center-header-info",children:t&&h?e.jsx("button",{type:"button",className:"s-thread-center-header-name",title:`Open ${d} details`,onClick:()=>j(l,h,{returnTo:n}),children:d}):e.jsx("span",{className:"s-thread-center-header-name",children:d})}),e.jsxs("div",{className:"s-thread-center-header-right",children:[b.length>0&&e.jsxs("div",{className:"s-thread-participants","aria-label":"Conversation participants",children:[b.map(s=>{const i=[s.model??(s.harness?"model unknown":null),s.reasoningEffort].filter(Boolean).join(" · ")||null,w=i?`${s.name} · ${i}`:s.title,y=e.jsxs(e.Fragment,{children:[e.jsx(f,{agent:s.agent??void 0,name:s.name,placement:"turn",className:"s-thread-participant-avatar",title:s.name}),e.jsxs("span",{className:"s-thread-participant-identity",children:[e.jsx("span",{className:"s-thread-participant-name",children:s.name}),i&&e.jsx("span",{className:"s-thread-participant-model",title:i,children:i})]})]}),N=s.agent?{view:"agents-v2",agentId:s.agent.id,...u?{machineId:u}:{}}:s.sessionId?{view:"sessions",sessionId:s.sessionId,...u?{machineId:u}:{}}:null;return N?e.jsx("button",{type:"button",className:"s-thread-participant-pill s-thread-participant-pill--button",title:`Open ${s.name} ${s.agent?"profile":"session"}${i?` · ${i}`:""}`,onClick:()=>j(l,N,{returnTo:n}),children:y},s.id):e.jsx("span",{className:"s-thread-participant-pill",title:w,children:y},s.id)}),v>0&&e.jsxs("span",{className:"s-thread-participant-overflow",children:["+",v]}),m.active?e.jsxs("span",{className:"s-thread-participant-pill s-thread-participant-pill--operator",title:`${m.name} · in this conversation`,children:[e.jsx(f,{name:m.name,placement:"turn",className:"s-thread-participant-avatar s-thread-participant-avatar--operator",title:m.name}),e.jsx("span",{className:"s-thread-participant-identity",children:e.jsx("span",{className:"s-thread-participant-name",children:"You"})})]}):e.jsxs("span",{className:"s-thread-participant-observer",title:`${m.name} · observing (not in thread)`,children:[e.jsx(M,{size:12,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Observing"})]})]}),k&&e.jsx("button",{type:"button",className:"s-thread-add-participant-trigger",onClick:g,title:"Add participant","aria-label":"Add participant",children:e.jsx(F,{size:14,strokeWidth:1.9,"aria-hidden":"true"})})]})]})}function P({canonicalConversationId:r,conversationAlias:t}){return e.jsxs("div",{className:"s-thread-identity-row",children:[e.jsxs("button",{type:"button",className:"s-thread-identity-chip",title:r,onClick:()=>{p(r)},children:[e.jsx("span",{children:S()}),e.jsx("strong",{children:L(r)})]}),t&&e.jsxs("span",{className:"s-thread-identity-chip",title:t,children:[e.jsx("span",{children:"Alias"}),e.jsx("strong",{children:t})]})]})}function ee({agents:r,addParticipantId:t,setAddParticipantId:l,addingParticipant:n,addParticipantError:x,onCancel:d,onSubmit:c}){return e.jsxs("form",{className:"s-thread-add-participant",onSubmit:a=>{a.preventDefault(),c()},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:t,onChange:a=>l(a.target.value),autoFocus:!0,children:r.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))})]}),e.jsxs("div",{className:"s-thread-add-participant-actions",children:[e.jsx("button",{type:"button",className:"s-btn s-btn-sm",onClick:d,disabled:n,children:"Cancel"}),e.jsx("button",{type:"submit",className:"s-btn s-btn-primary s-btn-sm",disabled:n||t.trim().length===0,children:n?"Adding...":"Add"})]})]}),x&&e.jsx("div",{className:"s-thread-add-participant-error",children:x})]})}export{ee as AddParticipantForm,R as ConversationHeader,P as ConversationIdentityRow};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/conversation-motion-features-DXtKlmuM.js","assets/gestures-CcEOV6Sr.js","assets/index-DmFAhGPj.js","assets/index-BBznYVWk.css","assets/use-reduced-motion-CYqhYqHO.js"])))=>i.map(i=>d[i]);
2
- import{j as e,_ as M,r as x}from"./index-DmFAhGPj.js";import{b as L,t as _,g as S,r as R,d as $,m as w,c as E,e as I,p as P}from"./conversation-model-CHwHZNw-.js";import{n as W,d as b,f as B,s as z}from"./colors-BtO5_zlx.js";import{i as y}from"./sessionRead-CvFz2RHv.js";import{t as j,f as k}from"./time-Dhsh_2EG.js";import{u as U}from"./Provider-cJCdHAxu.js";import{o as f}from"./openContent-C6XO6kr5.js";import{u as D,L as F,m as p}from"./use-reduced-motion-CYqhYqHO.js";import{A as O}from"./activity-CC8JzJNH.js";import{T as H}from"./terminal-DJPUp_Qn.js";import{M as K}from"./message-circle-CJO-pi7b.js";import"./router-Cn_s9IGH.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-AmSgHklm.js";import"./api-h5zurxmi.js";import"./sse-CxXt4tqI.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-CHIuVKz7.js";import"./DocumentFocusViewer-B9vodVmG.js";import"./createLucideIcon-CFBn0Sdk.js";import"./TextDocumentSurface-BWJCGBZf.js";/* empty css */import"./file-text-DcYSrI4v.js";import"./x-C8ayPBtj.js";import"./chevron-right-BYMV1511.js";import"./code-xml-BFc3TMSm.js";import"./arrow-left-B-3GJ7ct.js";import"./scout-voice-CwbOz6EN.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-h1IdakpD.js";import"./MessageComposerSuggestions-FdVHnT_q.js";import"./NewChatComposer-Hd7pI5Ac.js";import"./runtime-picker--IW3cRry.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-d6PKL_KD.js";import"./index-CmwGCxUk.js";import"./HarnessMark-BPAphNjx.js";import"./NewChatOrigin-DmuJ32wa.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-B3VVRJcV.js";import"./search-DAyagUtF.js";import"./chunk-HRAB3GC3-dRd2eQMJ.js";const G=[{head:"30%",body:"88%",short:"62%"},{head:"22%",body:"76%",short:"48%"},{head:"34%",body:"82%",short:"68%"}],J=()=>M(()=>import("./conversation-motion-features-DXtKlmuM.js"),__vite__mapDeps([0,1,2,3,4])).then(a=>a.default);function Y({onOpenTrace:a,onOpenTerminal:i,onSteer:d,compact:r=!1}){return!a&&!i&&!d?null:e.jsxs("nav",{className:`s-thread-working-actions${r?" s-thread-working-actions--compact":""}`,"aria-label":"Working turn actions",children:[a&&e.jsxs("button",{type:"button",className:"s-thread-working-action s-thread-working-action--primary",onClick:a,title:"Watch this run's live trace",children:[e.jsx(O,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Live trace"})]}),i&&e.jsxs("button",{type:"button",className:"s-thread-working-action",onClick:i,title:"Jump into this agent's terminal",children:[e.jsx(H,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Terminal"})]}),d&&e.jsxs("button",{type:"button",className:"s-thread-working-action",onClick:d,title:"Write an interrupting message to steer this turn",children:[e.jsx(K,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Steer…"})]})]})}const q={think:"Thinking",tool:"Tool",ask:"Prompt",message:"Says",note:"Note",system:"System",boot:"Boot"};function N({steps:a,phase:i,limit:d=5,compact:r=!1}){const l=a.slice(-d),o=a.length-l.length;return l.length===0?i?e.jsxs("div",{className:"s-thread-steps-phase",children:[e.jsx("span",{children:i.label}),e.jsx("strong",{children:i.detail})]}):null:e.jsxs("div",{className:`s-thread-steps${r?" s-thread-steps--compact":""}`,children:[o>0&&e.jsxs("div",{className:"s-thread-steps-elided",children:[o," earlier step",o===1?"":"s"]}),e.jsx("ol",{"aria-label":"Live steps in this turn",children:l.map(s=>e.jsxs("li",{"data-kind":s.kind,children:[e.jsx("span",{className:"s-thread-step-mark","aria-hidden":"true"}),e.jsx("span",{className:"s-thread-step-kind",children:q[s.kind]}),e.jsxs("span",{className:"s-thread-step-body",children:[s.tool?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"s-thread-step-tool",children:s.tool}),s.arg&&e.jsx("span",{className:"s-thread-step-arg",children:s.arg})]}):e.jsx("span",{className:"s-thread-step-text",children:s.text}),s.repeatCount>1&&e.jsxs("span",{className:"s-thread-step-repeat",children:["×",s.repeatCount]}),s.outcome&&e.jsx("span",{className:"s-thread-step-outcome",children:s.outcome})]}),e.jsx("time",{title:k(s.ts),children:j(s.ts)})]},s.id))})]})}function Q({events:a,limit:i=3,compact:d=!1}){const r=a.slice(0,i);return r.length===0?null:e.jsx("ol",{className:`s-thread-motion-events${d?" s-thread-motion-events--compact":""}`,"aria-label":"Latest run activity",children:r.map(l=>e.jsxs("li",{children:[e.jsx("span",{className:"s-thread-motion-event-kind",children:L(l.kind)}),e.jsx("span",{className:"s-thread-motion-event-summary",children:_(l)??"Activity recorded"}),e.jsx("time",{title:k(l.ts),children:j(l.ts)})]},l.id))})}function He(){const a=D();return e.jsx(F,{features:J,strict:!0,children:e.jsxs(p.section,{className:"s-thread-skeleton","aria-busy":"true","aria-live":"polite",initial:a?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:[.2,.7,.3,1]},children:[e.jsxs("div",{className:"s-thread-skeleton-intro",role:"status",children:[e.jsxs("div",{className:"s-thread-loader-mark","aria-hidden":"true",children:[e.jsx(p.span,{className:"s-thread-loader-orbit",animate:a?void 0:{rotate:360},transition:{duration:3.2,ease:"linear",repeat:1/0},children:e.jsx("span",{})}),e.jsx(p.span,{className:"s-thread-loader-core",animate:a?void 0:{scale:[.88,1,.88],opacity:[.58,1,.58]},transition:{duration:1.8,ease:"easeInOut",repeat:1/0}})]}),e.jsxs("span",{className:"s-thread-skeleton-copy",children:[e.jsx("strong",{children:"Composer ready"}),e.jsx("span",{children:"Gathering the conversation…"})]})]}),e.jsx("div",{className:"s-thread-skeleton-turns","aria-hidden":"true",children:G.map((i,d)=>e.jsxs(p.div,{className:"s-thread-skeleton-turn",initial:a?!1:{opacity:0,y:7},animate:{opacity:1,y:0},transition:{delay:a?0:.05+d*.055,duration:.24,ease:[.2,.7,.3,1]},children:[e.jsx("span",{className:"s-thread-skeleton-avatar"}),e.jsxs("div",{className:"s-thread-skeleton-lines",children:[e.jsx("span",{className:"s-thread-skeleton-line s-thread-skeleton-line--head",style:{width:i.head}}),e.jsx("span",{className:"s-thread-skeleton-line",style:{width:i.body}}),e.jsx("span",{className:"s-thread-skeleton-line s-thread-skeleton-line--short",style:{width:i.short}})]})]},`${i.head}-${i.body}`))})]})})}function Ke({sessions:a,activeConversationId:i,needsYouIds:d,lastViewed:r,navigate:l}){const o=a.filter(n=>d.has(n.id)||n.agentId&&d.has(n.agentId)),s=x.useMemo(()=>S(a),[a]);return e.jsx("aside",{className:"s-thread-rail",children:e.jsxs("div",{className:"s-thread-rail-scroll",children:[o.length>0&&e.jsxs("div",{className:"s-thread-rail-section s-thread-rail-section--needs-you",children:[e.jsx("div",{className:"s-thread-rail-section-label",children:"Needs you"}),o.map(n=>e.jsx(g,{session:n,active:n.id===i,unread:y(n.lastMessageAt,n.id,r),needsYou:!0,navigate:l},`needs-${n.id}`))]}),s.map(n=>e.jsxs("div",{className:"s-thread-rail-section",children:[e.jsx("div",{className:"s-thread-rail-section-label",children:n.workspace}),n.sessions.map(c=>e.jsx(g,{session:c,active:c.id===i,unread:y(c.lastMessageAt,c.id,r),needsYou:!1,navigate:l},c.id))]},n.workspace))]})})}function Ge({sessionMeta:a,agents:i,flights:d,conversationId:r,navigate:l,route:o}){const s=x.useMemo(()=>a?a.participantIds.filter(t=>t!=="operator").map(t=>R(i,[t])).filter(t=>t!==null):[],[a,i]),n={id:"operator",name:"You",handle:"operator",activity:null,state:"ready",agent:null},c=x.useMemo(()=>s.map(t=>({id:t.id,name:t.name,handle:w(t)??E(t.id)??t.id,activity:$(t,d,r),state:W(t.state),agent:t})),[s,d,r]),h=[n,...c];return e.jsxs("aside",{className:"s-thread-sidebar",children:[e.jsxs("div",{className:"s-thread-sidebar-section",children:[e.jsx("div",{className:"s-thread-sidebar-label",children:"In this conversation"}),h.map(t=>{const m=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"s-ops-avatar",style:{"--size":"28px",background:b(t.name)},children:t.name[0]?.toUpperCase()??"?"}),e.jsxs("div",{className:"s-thread-sidebar-participant-info",children:[e.jsx("span",{className:"s-thread-sidebar-participant-name",children:t.name}),e.jsxs("span",{className:"s-thread-sidebar-participant-handle",children:["@",t.handle]})]}),e.jsx("div",{className:"s-thread-sidebar-participant-activity",children:t.activity?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"s-thread-sidebar-activity-dot s-thread-sidebar-activity-dot--pulse",style:{background:"var(--green)"}}),e.jsx("span",{className:"s-thread-sidebar-activity-label",children:t.activity})]}):B(t.state)||t.id==="operator"?e.jsx("span",{className:"s-thread-sidebar-activity-dot",style:{background:z(t.state)}}):e.jsx("span",{className:"s-thread-sidebar-activity-dot",style:{background:"var(--dim)"}})})]});return t.agent?e.jsx("button",{type:"button",className:"s-thread-sidebar-participant s-thread-sidebar-participant--clickable",onClick:()=>f(l,{view:"agents-v2",agentId:t.agent.id},{returnTo:o}),title:`Open ${t.name} profile`,children:m},t.id):e.jsx("div",{className:"s-thread-sidebar-participant",children:m},t.id)})]}),c.length>0&&e.jsxs("div",{className:"s-thread-sidebar-section",children:[e.jsx("div",{className:"s-thread-sidebar-label",children:"Conversation mesh"}),e.jsx(V,{participants:c})]})]})}function Je({agentName:a,title:i,detail:d,snapshot:r,events:l,steps:o,phase:s,tone:n,workspaceName:c,branch:h,startedAt:t,onOpenTrace:m,onOpenTerminal:A,onSteer:C}){const T=t?j(t):"now";return e.jsxs("section",{className:`s-thread-motion-panel s-thread-motion-panel--${n}`,"aria-live":"polite",children:[e.jsxs("div",{className:"s-thread-motion-head",children:[e.jsx("div",{className:"s-thread-motion-beacon","aria-hidden":"true",children:e.jsx("span",{})}),e.jsxs("div",{className:"s-thread-motion-title-block",children:[e.jsx("div",{className:"s-thread-motion-kicker",children:"Currently working"}),e.jsx("h2",{children:i}),e.jsx("p",{children:d})]})]}),e.jsx("div",{className:"s-thread-motion-meter","aria-hidden":"true",children:X.map((u,v)=>e.jsx("span",{style:{"--bar-height":`${u}%`,"--bar-delay":`${v*74}ms`}},`${u}-${v}`))}),e.jsxs("dl",{className:"s-thread-motion-stats",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Session"}),e.jsx("dd",{children:T})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Activity"}),e.jsx("dd",{children:r.activityLabel})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Last"}),e.jsx("dd",{children:r.lastActivityLabel})]})]}),e.jsxs("div",{className:"s-thread-motion-latest",children:[e.jsx("span",{children:a}),e.jsx("strong",{children:r.latest})]}),o.length>0?e.jsx(N,{steps:o,phase:null,limit:6}):l.length>0?e.jsx(Q,{events:l,limit:4}):s?e.jsx(N,{steps:o,phase:s,limit:6}):e.jsxs("div",{className:"s-thread-motion-waiting",children:[e.jsx("span",{children:"Session created"}),e.jsx("strong",{children:"waiting for the first trace event"})]}),(c||h)&&e.jsxs("div",{className:"s-thread-motion-chips",children:[c&&e.jsx("span",{children:c}),h&&e.jsx("span",{children:h})]}),e.jsx(Y,{onOpenTrace:m,onOpenTerminal:A,onSteer:C})]})}function g({session:a,active:i,unread:d,needsYou:r,navigate:l}){const{route:o}=U(),s=I(a),n=(a.agentName??s)[0]?.toUpperCase()??"?",c=a.kind==="direct",h=P(a.workspaceRoot)??a.kind;return e.jsxs("button",{type:"button",className:["s-thread-rail-item",i&&"s-thread-rail-item--active",r&&"s-thread-rail-item--needs-you"].filter(Boolean).join(" "),onClick:()=>f(l,{view:"conversation",conversationId:a.id},{returnTo:o}),children:[c?e.jsx("div",{className:"s-thread-rail-avatar",style:{background:b(a.agentName??s)},children:n}):e.jsx("div",{className:"s-thread-rail-avatar s-thread-rail-avatar--channel",children:"#"}),e.jsxs("div",{className:"s-thread-rail-body",children:[e.jsx("span",{className:"s-thread-rail-name",children:s}),e.jsx("span",{className:"s-thread-rail-sub",children:h})]}),e.jsxs("div",{className:"s-thread-rail-trailing",children:[d&&!r&&e.jsx("span",{className:"s-thread-rail-presence-dot",style:{background:"var(--accent)"}}),r&&e.jsx("span",{className:"s-thread-rail-badge s-thread-rail-badge--amber",children:"!"})]})]})}function V({participants:a}){const o=a.map((s,n)=>{const c=2*Math.PI*n/a.length-Math.PI/2;return{...s,x:130+55*Math.cos(c),y:80+55*Math.sin(c)}});return e.jsx("div",{className:"s-thread-mini-mesh",children:e.jsxs("svg",{viewBox:"0 0 260 160","aria-label":"Conversation participant mesh",children:[o.map(s=>e.jsx("line",{x1:130,y1:80,x2:s.x,y2:s.y,className:"s-thread-mini-mesh-edge"},`edge-${s.id}`)),e.jsx("circle",{cx:130,cy:80,r:16,className:"s-thread-mini-mesh-node s-thread-mini-mesh-node--center"}),e.jsx("text",{x:130,y:80,className:"s-thread-mini-mesh-label s-thread-mini-mesh-label--center",children:"OP"}),o.map(s=>e.jsxs("g",{children:[e.jsx("circle",{cx:s.x,cy:s.y,r:16,className:"s-thread-mini-mesh-node",style:s.state==="in_turn"||s.state==="in_flight"?{stroke:"var(--green)"}:void 0}),e.jsx("text",{x:s.x,y:s.y,className:"s-thread-mini-mesh-label",children:s.name.slice(0,3).toUpperCase()})]},`node-${s.id}`))]})})}const X=[42,76,54,88,34,66,92,48,72,38,84,58];export{Ke as ChannelRail,Ge as PresenceSidebar,He as ThreadLoadingSkeleton,Je as ThreadMotionPanel,Y as WorkingTurnActions,Q as WorkingTurnActivityPreview,N as WorkingTurnSteps};
@@ -1 +0,0 @@
1
- import{j as o,r as a}from"./index-DmFAhGPj.js";import{c as it,w as Qn,p as Ht,d as Ms,h as Vn,l as zn,f as Gn,s as Ns,g as Jn,i as Xn,j as Yn}from"./NewChatComposer-Hd7pI5Ac.js";import{a as K}from"./api-h5zurxmi.js";import{u as Zn}from"./MessageComposerSuggestions-FdVHnT_q.js";import"./runtime-picker--IW3cRry.js";import{u as ea,C as ta}from"./ConversationComposer-Bf7Ga_49.js";import"./index-CmwGCxUk.js";import{u as sa,e as na}from"./Provider-cJCdHAxu.js";import{o as aa,q as ra,x as te,y as Is,z as oa,A as be,B as ia,C as la,D as ca,E as da,c as As,S as js,F as ua,G as ma,H as ha,I as pa,J as fa,K as ga,L as ya,s as wa,M as Sa,N as ba,e as Ta,p as xa,r as Rs,O as va,P as ka,Q as Ca,R as Ma,u as Na,T as Ia,U as Aa,V as Es,W as ja,X as Ra,Y as lt,n as Ea,Z as La,_ as $a,$ as Ls,a0 as Pa,a1 as Fa,a2 as Oa,a3 as qa,a4 as $s,a5 as Da,a6 as Ps,a7 as Ba,a8 as Ha,a9 as Ua}from"./conversation-model-CHwHZNw-.js";import{u as _a}from"./sse-CxXt4tqI.js";import{n as Vt,t as Ut,f as Fs}from"./time-Dhsh_2EG.js";import{M as Wa}from"./message-markup-CyRDLdOn.js";import{i as _t}from"./message-visibility-kJM8XcSG.js";import{b as Ka}from"./router-Cn_s9IGH.js";import{f as Qa}from"./scoutbot-BTIErYHo.js";import{s as Va}from"./sessionRead-CvFz2RHv.js";import{o as ct}from"./openContent-C6XO6kr5.js";import{u as za}from"./ContextMenu-CHIuVKz7.js";import{c as Be}from"./clipboard-e3fSpeo7.js";import{A as Wt}from"./AgentAvatar-D8ZtMluU.js";import{d as Ga}from"./types-B0PlfpKc.js";/* empty css */import{ConversationHeader as Ja,ConversationIdentityRow as Xa,AddParticipantForm as Ya}from"./ConversationHeader-B_GXrKR0.js";import{FanOutRow as Za,ThreadDayDivider as er}from"./ConversationFeedRows-Cm1Lgo43.js";import{ThreadLoadingSkeleton as tr,ThreadMotionPanel as sr,WorkingTurnSteps as nr,WorkingTurnActivityPreview as ar,WorkingTurnActions as rr}from"./ConversationPanels-BTBbEvrP.js";import{g as or,c as ir,d as lr,e as cr,f as dr}from"./tail-display-BRcJltQa.js";import{u as ur}from"./tail-events-BdvqZHLr.js";import{PinnedAskCard as mr,ConversationStatusStrip as hr}from"./ConversationStatus-BqhUHD85.js";import"./HarnessMark-BPAphNjx.js";import"./colors-BtO5_zlx.js";import"./NewChatOrigin-DmuJ32wa.js";import"./keyboard-nav-h1IdakpD.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./x-C8ayPBtj.js";import"./createLucideIcon-CFBn0Sdk.js";import"./chevron-down-B3VVRJcV.js";import"./search-DAyagUtF.js";import"./loader-circle-d6PKL_KD.js";import"./file-text-DcYSrI4v.js";import"./scout-voice-CwbOz6EN.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./surface-activity-B1rgWB1i.js";import"./DocumentFocusViewer-B9vodVmG.js";import"./TextDocumentSurface-BWJCGBZf.js";/* empty css */import"./chevron-right-BYMV1511.js";import"./code-xml-BFc3TMSm.js";import"./arrow-left-B-3GJ7ct.js";import"./chunk-HRAB3GC3-dRd2eQMJ.js";import"./index-BWHgHrtv.js";import"./mentions-agCGDgyA.js";import"./AgentDetailCard-BTiOmh-a.js";import"./AgentLiveActions-BJ5dIfL3.js";import"./terminal-takeover-BOFPRPjR.js";import"./eye-1J4yOUoG.js";import"./terminal-DJPUp_Qn.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-AmSgHklm.js";import"./SpriteAvatar-DS6Tmyua.js";import"./agent-identity-BxCsXnDp.js";import"./BackToPicker-D1LV6Cqp.js";import"./use-reduced-motion-CYqhYqHO.js";import"./activity-CC8JzJNH.js";import"./message-circle-CJO-pi7b.js";import"./lane-edit-display-C_Aujldz.js";const pr=/\.(?:apng|avif|gif|jpe?g|png|svg|webp)(?:$|[?#])/iu,fr=/\bhttps?:\/\/[^\s<>"')\]]+/giu;function He(s){if(typeof s!="string")return null;try{const i=new URL(s.trim());return i.protocol==="http:"||i.protocol==="https:"?i.toString():null}catch{return null}}function V(s,i){const d=s?.[i];return typeof d=="string"&&d.trim()?d.trim():null}function gr(s){return s.mediaType.toLowerCase().startsWith("image/")}function yr(s){return pr.test(s)}function wr(s){try{const i=new URL(s),d=[i.pathname==="/"?"":i.pathname,i.search].join("").trim();return{host:i.hostname.replace(/^www\./iu,""),detail:d||i.hostname}}catch{return{host:s,detail:s}}}function Sr(s){const i=new Set,d=[];for(const h of s.matchAll(fr)){const u=h[0]?.replace(/[.,;:!?]+$/u,""),v=He(u);!v||i.has(v)||(i.add(v),d.push(v))}return d}const br=/^\/api\/blobs\/[^/]+$/u;function Kt(s){try{const i=new URL(s);return br.test(i.pathname)?`${i.pathname}${i.search}`:s}catch{return s}}function ut(s){return He(s.url)??He(V(s.metadata,"url"))??He(V(s.metadata,"href"))}function Tr(s){const i=s.metadata??null,d=V(i,"kind")??V(i,"type"),h=ut(s);if(!h||d!=="link_preview"&&d!=="link-preview"&&s.mediaType!=="text/x-uri")return null;const u=wr(h);return{id:s.id,url:h,title:V(i,"title")??u.host,description:V(i,"description"),imageUrl:He(V(i,"imageUrl")??V(i,"image")),siteName:V(i,"siteName")??u.host}}function xr({src:s,alt:i}){const[d,h]=a.useState(!1);return d?o.jsxs("a",{className:"s-message-embed s-message-embed--file",href:s,target:"_blank",rel:"noreferrer",children:[o.jsx("span",{className:"s-message-embed-title",children:i}),o.jsx("span",{className:"s-message-embed-description",children:"Preview unavailable"})]}):o.jsx("a",{className:"s-message-embed s-message-embed--image",href:s,target:"_blank",rel:"noreferrer",children:o.jsx("img",{src:s,alt:i,loading:"lazy",decoding:"async",onError:()=>h(!0)})})}function vr({preview:s}){return o.jsxs("a",{className:"s-message-embed s-message-embed--link",href:s.url,target:"_blank",rel:"noreferrer",children:[s.imageUrl&&o.jsx("span",{className:"s-message-embed-thumb",children:o.jsx("img",{src:s.imageUrl,alt:"",loading:"lazy",decoding:"async"})}),o.jsxs("span",{className:"s-message-embed-copy",children:[s.siteName&&o.jsx("span",{className:"s-message-embed-site",children:s.siteName}),o.jsx("span",{className:"s-message-embed-title",children:s.title}),s.description&&o.jsx("span",{className:"s-message-embed-description",children:s.description})]})]})}function kr({message:s}){const i=s.attachments??[],d=new Set,h=[],u=[];for(const m of i){const I=ut(m);if(I&&gr(m)){d.add(m.id),h.push({id:m.id,src:Kt(I),alt:m.fileName??"Image attachment"});continue}const T=Tr(m);T&&(d.add(m.id),u.push(T))}const v=new Set(u.map(m=>m.url)),O=new Set(i.map(ut).filter(m=>!!m));for(const m of Sr(s.body))O.has(m)||v.has(m)||yr(m)&&h.push({id:m,src:Kt(m),alt:"Embedded image"});const f=i.filter(m=>!d.has(m.id));return h.length===0&&u.length===0&&f.length===0?null:o.jsxs("div",{className:"s-message-embeds",children:[h.map(m=>o.jsx(xr,{src:m.src,alt:m.alt},m.id)),u.slice(0,1).map(m=>o.jsx(vr,{preview:m},m.id)),f.map(m=>{const I=ut(m),T=I?Kt(I):null,p=m.fileName??V(m.metadata,"title")??m.mediaType;return T?o.jsxs("a",{className:"s-message-embed s-message-embed--file",href:T,target:"_blank",rel:"noreferrer",children:[o.jsx("span",{className:"s-message-embed-title",children:p}),o.jsx("span",{className:"s-message-embed-description",children:m.mediaType})]},m.id):o.jsxs("div",{className:"s-message-embed s-message-embed--file",children:[o.jsx("span",{className:"s-message-embed-title",children:p}),o.jsx("span",{className:"s-message-embed-description",children:m.mediaType})]},m.id)})]})}const zt=60;function dt(s,i,d){const h=d?.trim();if(!h)return;const u=h.toLowerCase();i.has(u)||(i.add(u),s.push(h))}function Cr(s){const i=[],d=new Set;dt(i,d,s.observeSessionId);for(const h of s.flight?.sessions??[])dt(i,d,h.sessionId);return dt(i,d,s.agent?.harnessSessionId),dt(i,d,s.sessionMeta?.harnessSessionId),i}function Os(s,i){const d=s.sessionId?.trim().toLowerCase();return d?i.some(h=>{const u=h.trim().toLowerCase();return u?d.includes(u)||u.includes(d):!1}):!1}function _s(s,i){return s.ts!==i.ts?s.ts-i.ts:s.id.localeCompare(i.id)}function qs(s,i){const d=new Map;for(const h of[...s,...i])d.set(h.id,h);return[...d.values()].sort(_s).slice(-zt)}function Mr(s){const i=or(s).sort(_s),d=ir(i.map(u=>({event:u,meta:lr(u)}))),h=[];for(const u of d){if(u.event.kind==="other")continue;if(u.event.kind==="tool-result"){const m=h.at(-1);m?.kind==="tool"&&(m.outcome=u.meta.result?.outcome??m.outcome??"done",m.ts=u.event.ts);continue}const v=Nr(u.event),O=Ir(u.event,cr(u.event,u.meta),v);if(!O&&v!=="think")continue;const f={id:u.event.id,ts:u.event.ts,kind:v,text:O,repeatCount:u.repeatCount};u.meta.tool&&(f.tool=u.meta.tool),u.meta.arg&&(f.arg=mt(u.meta.arg)),u.meta.result?.outcome&&(f.outcome=u.meta.result.outcome),h.push(f)}return h}const Ds=160;function mt(s){const i=s.replace(/\s+/gu," ").trim();return i.length>Ds?`${i.slice(0,Ds-1)}…`:i}const Ws=/^\[thinking\]\s*$/iu;function Nr(s){return Ws.test(s.summary.trim())?"think":dr(s)}function Ir(s,i,d){return d==="think"&&Ws.test(s.summary.trim())?"":mt(i)}const Ar=15e3;function jr(s){const i=s?.outcome;return typeof i=="string"&&i.trim()?i.trim():void 0}function Rr(s){const{observe:i,flight:d}=s;if(!i||!d)return[];const h=i.data.events.filter(f=>f.kind!=="boot"&&f.kind!=="system");if(h.length===0)return[];const u=Vt(d.startedAt),v=u!==null?h.filter(f=>typeof f.at=="number"&&f.at>=u-Ar):[];return(v.length>0?v:i.data.live?h:[]).slice(-zt).map(f=>{const m={id:`observe:${i.sessionId??"session"}:${f.id}`,ts:f.at??f.t,kind:f.kind,text:mt(f.text||f.tool||"step"),repeatCount:1};f.tool&&(m.tool=f.tool),f.arg&&(m.arg=mt(f.arg));const I=jr(f.result);return I&&(m.outcome=I),f.diff&&(m.outcome=`+${f.diff.add} −${f.diff.del}`),m})}function Er(s){const i=s.at(-1);return i?i.tool?i.arg?`${i.tool} · ${i.arg}`:i.tool:i.kind==="think"?i.text||"Thinking":i.text||null:null}function Lr(s){if(s.length===0)return null;const i=s.filter(u=>u.kind==="tool").length,d=s.filter(u=>u.kind==="think").length,h=[];return i>0&&h.push(`${i} tool${i===1?"":"s"}`),d>0&&h.push(`${d} thinking`),h.length===0?`${s.length} step${s.length===1?"":"s"}`:h.join(" · ")}function $r(s){const i=s.flight?.state;return i==="queued"?{label:"Queued",detail:"waiting for the session to come online"}:i==="waking"?{label:"Waking",detail:"starting the session"}:i==="running"||i==="waiting"?s.hasSessionScope?{label:"Session live",detail:"waiting for the first trace line"}:{label:"Session live",detail:"no trace stream for this session yet"}:s.awaitingResponse?{label:"Sent",detail:"waiting for the agent to pick this up"}:null}function Pr(s){const{sessionIds:i,active:d}=s,h=i.join("|"),u=d&&i.length>0,[v,O]=a.useState([]);return a.useEffect(()=>{O([])},[h]),a.useEffect(()=>{if(!u)return;let f=!1;const m=new URLSearchParams({limit:String(zt*3),transcripts:"true"});return K(`/api/tail/recent?${m.toString()}`).then(I=>{if(f)return;const T=(I.events??[]).filter(p=>Os(p,i));T.length!==0&&O(p=>qs(p,T))}).catch(()=>{}),()=>{f=!0}},[u,h]),ur(f=>{u&&Os(f,i)&&O(m=>qs(m,[f]))},u),a.useMemo(()=>u?Mr(v):[],[u,v])}const Fr=3500;function Bs(s){const i=s?.trim().replace(/^#/,"");if(!i?.startsWith("msg-"))return null;const d=i.slice(4).trim();if(!d)return null;try{return decodeURIComponent(d)}catch{return d}}const Or=64;function qr(s){const i=s?.clientMessageId;return typeof i=="string"&&i.trim()?i.trim():null}function Hs(s){const i=s.body.replace(/\s+/gu," ").trim();if(i)return i.length>180?`${i.slice(0,179).trimEnd()}…`:i;const d=s.attachments?.length??0;return d===1?"Attachment":d>1?`${d} attachments`:"Message"}function Us(s,i){const d=s.toLocaleLowerCase().indexOf(i.toLocaleLowerCase());if(d<0)return s;const h=s.slice(0,d),u=s.slice(d+i.length);return!h&&u.startsWith(" ")?u.slice(1):h.endsWith(" ")&&u.startsWith(" ")?`${h}${u.slice(1)}`:`${h}${u}`}function Dr(s){return s instanceof TypeError||typeof DOMException<"u"&&s instanceof DOMException&&s.name==="AbortError"}function ei({conversationId:s,initialDraft:i,navigate:d,embedded:h,showBackNav:u=!0,treatment:v="standard"}){const{agents:O,route:f,openContextCapture:m}=sa(),I=Ka(f),T=a.useMemo(()=>na(O,I),[O,I]),[p,ht]=a.useState(null),Gt=a.useRef(null);Gt.current=p;const Ue=a.useMemo(()=>it(s),[s]),[Ks,Qs]=a.useState(()=>Ue?{[s]:Ue}:{}),k=Ks[s]??Ue??[],[Vs,Jt]=a.useState(()=>Ue!==null),Te=a.useRef(null),zs=a.useMemo(()=>{const t=Te.current;return t===null?null:new Set(k.filter(e=>!t.has(e.id)).map(e=>e.id))},[k]),Xt=Te.current===null&&k.length>0;a.useEffect(()=>{if(k.length===0)return;const t=Te.current??new Set;for(const e of k)t.add(e.id);Te.current=t},[k]),a.useEffect(()=>{Te.current=null,Jt(it(s)!==null)},[s]);const Yt=!Vs&&k.length===0,z=a.useCallback(t=>{Qs(e=>{const n=e[s]??it(s)??[],r=typeof t=="function"?t(n):t,l=Qn(s,r);return{...e,[s]:l}})},[s]),Gs=Ht(s),[w,he]=a.useState(Gs),[xe,ve]=a.useState([]),[_e,pt]=a.useState(null),[We,ke]=a.useState(null),[Ke,Js]=a.useState(()=>typeof window>"u"?null:Bs(window.location.hash)),[Zt,pe]=a.useState(null),[fe,ft]=a.useState(!1),[Xs,Ce]=a.useState(!1),[gt,Qe]=a.useState(0),Ve=a.useRef(null),Me=a.useRef(null),es=a.useRef(null),Ne=a.useRef(!0),ze=a.useRef(!1),ge=a.useRef(null),L=a.useRef(null),Ie=a.useRef(new Set),Ae=a.useRef(null),ts=a.useRef(0),ss=a.useRef(null),je=a.useRef(null),se=a.useRef(s);se.current=s;const ne=a.useRef(new Map),Ys=Ms(s),Ge=a.useRef(!1);a.useLayoutEffect(()=>{const t=Me.current,e=Ve.current;!t||!e||(e.scrollTop=t.scrollTop+(e.scrollHeight-t.scrollHeight),Me.current=null,Ge.current=!0)}),a.useEffect(()=>{ft(!1),Me.current=null,Ge.current=!1,Ne.current=!0,ze.current=!1,Ce(!1),Qe(0),Lt(new Set),ne.current.clear(),he(Ht(s))},[s]);const x=p?.agentId??null,N=p?.kind==="direct",yt=a.useMemo(()=>new Set([s,...p?.equivalentConversationIds??[]]),[s,p?.equivalentConversationIds]),Q=a.useMemo(()=>x?T.find(t=>t.id===x)??null:null,[T,x]),ns=aa(p),Zs=ra({resolvedAgentId:Q?.id,sessionId:ns,machineId:I}),[as,rs]=a.useState(null);a.useEffect(()=>{K("/api/fleet").then(t=>{rs(e=>te(e,Is(t.activeAsks,s,x)))}).catch(()=>{})},[s,x]);const H=a.useCallback(async(t={})=>{const e=t.messageMode??"none",n=t.includeMetadata??!0;pe(null);try{const r=n?await K(`/api/session/${encodeURIComponent(s)}`).catch(()=>null):Gt.current;if(se.current!==s)return;ht(M=>te(M,r));const l=r?.agentId??null,c=r?.id&&r.id!==s?r.id:s;if(c!==s){d({view:"conversation",conversationId:c});return}const g=it(c),R=Vn(c),S=e==="initial"&&!R,y=e==="refresh"||e==="initial",[b,U,E]=await Promise.all([S?zn(c):y?Gn(c,{refresh:!0}):Promise.resolve(g),K(`/api/flights?conversationId=${encodeURIComponent(c)}`),K("/api/fleet?limit=24&activityLimit=160").catch(()=>oa())]);if(se.current!==s)return;const Z=be(b??[]),D=Z.filter(M=>!_t(M));b&&z(M=>te(M,ia(M,D))),Jt(!0),Va(c);const _=Z.at(-1);_&&je.current!==_.id&&(je.current=_.id,K(`/api/conversations/${encodeURIComponent(c)}/read-cursor`,{method:"POST",body:JSON.stringify({lastReadMessageId:_.id})}).catch(()=>{je.current===_.id&&(je.current=null)}));const W=la(U),B=Ht(c),ee=W??B;Ie.current=new Set([...U.map(M=>M.invocationId),...B?.invocationId?.startsWith("pending:")?[]:B?.invocationId?[B.invocationId]:[]]),W&&B?.id===W.id&&Ns(c,W.id);const rt=ee?.agentId??l??null,$=ca(E.activity,ee,c,rt),ot=da(E.activeAsks,ee,c,rt);he(M=>te(M,ee)),ve(M=>te(M,$)),ke(M=>te(M,ot)),rs(M=>te(M,Is(E.activeAsks,c,l)))}catch(r){if(se.current!==s)return;pe(r instanceof Error?r.message:String(r))}},[s,d,z]);a.useEffect(()=>{H({messageMode:"initial"})},[H]),a.useEffect(()=>{je.current=null},[s]),a.useEffect(()=>{Ae.current=w},[w]);const en=a.useCallback(async()=>{if(fe||!Ms(s))return;const t=Ve.current,e=t?{scrollHeight:t.scrollHeight,scrollTop:t.scrollTop}:null;ft(!0),pe(null);try{const n=await Jn(s);if(se.current!==s)return;e&&(Me.current=e),z(be(n).filter(r=>!_t(r)))}catch(n){se.current===s&&pe(n instanceof Error?n.message:String(n))}finally{se.current===s&&ft(!1)}},[s,fe,z]),[A,q]=a.useState(()=>i??""),[ae,re]=a.useState(null),[G,Je]=a.useState(!1),[C,tn]=a.useState("operator"),[oe,Re]=a.useState({open:!1,query:"",triggerStart:-1,index:0}),[ie,Ee]=a.useState({open:!1,query:"",triggerStart:-1,index:0}),[P,J]=a.useState(null),[wt,Xe]=a.useState(!1),[St,Ye]=a.useState(""),[sn,Le]=a.useState(null),[nn,bt]=a.useState(!1);a.useEffect(()=>{Xe(!1),Ye(""),Le(null),bt(!1)},[s]),a.useEffect(()=>{if(!i)return;const t=`${s}:${i}`;ss.current!==t&&(ss.current=t,q(i),requestAnimationFrame(()=>L.current?.focus()))},[s,i]);const le=a.useMemo(()=>{const t=new Map;for(const e of p?.participants??[])t.set(e.actorId,e),e.agentId&&t.set(e.agentId,e);return t},[p]),Tt=a.useMemo(()=>{const t=new Set,e=[];for(const n of p?.participantIds??[]){if(n==="operator")continue;const r=le.get(n),l=r?.scopedAlias?.trim().replace(/^@+/,"");if(!l)continue;const c=l.toLowerCase();t.has(c)||(t.add(c),e.push({id:n,label:r?.label??r?.displayName??l,name:r?.displayName??l,handle:l}))}for(const n of T){const r=n.handle?.trim().replace(/^@+/,"")??As(n.id)??n.id;if(!r)continue;const l=r.toLowerCase();t.has(l)||(t.add(l),e.push({id:n.id,label:r,name:n.name??r,handle:r}))}return e.sort((n,r)=>n.handle.localeCompare(r.handle))},[le,T,p]),an=a.useMemo(()=>{if(!oe.open)return[];const t=oe.query.toLowerCase();return t?js.filter(e=>e.command.toLowerCase().startsWith("/"+t)||e.command.toLowerCase().includes(t)):js},[oe.open,oe.query]),rn=a.useMemo(()=>{if(!ie.open)return[];const t=ie.query.toLowerCase();return t?Tt.filter(e=>e.handle.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)).slice(0,8):Tt.slice(0,8)},[ie.open,ie.query,Tt]),on=a.useCallback(()=>{Re(t=>t.open?{...t,open:!1}:t),Ee(t=>t.open?{...t,open:!1}:t)},[]),ln=a.useCallback((t,e)=>{const n=ua(t,e);Re(n?l=>({open:!0,query:n.query,triggerStart:n.start,index:l.open&&l.triggerStart===n.start?l.index:0}):l=>l.open?{...l,open:!1}:l);const r=ma(t,e);Ee(r?l=>({open:!0,query:r.query,triggerStart:r.start,index:l.open&&l.triggerStart===r.start?l.index:0}):l=>l.open?{...l,open:!1}:l)},[]),cn=a.useCallback(t=>{const e=L.current,n=oe.triggerStart;if(n<0)return;const r=e?.selectionStart??A.length,l=A.slice(0,n),c=A.slice(r),g=t.insert,R=`${l}${g}${c}`;q(R),Re(S=>({...S,open:!1})),requestAnimationFrame(()=>{const S=L.current;if(!S)return;const y=l.length+g.length;S.focus(),S.setSelectionRange(y,y)})},[A,oe.triggerStart]),dn=a.useCallback(t=>{const e=L.current,n=ie.triggerStart;if(n<0)return;const r=e?.selectionStart??A.length,l=A.slice(0,n),c=A.slice(r),g=c.length===0||!c.startsWith(" "),R=`@${t.handle}${g?" ":""}`,S=`${l}${R}${c}`;q(S),Ee(y=>({...y,open:!1})),requestAnimationFrame(()=>{const y=L.current;if(!y)return;const b=l.length+R.length;y.focus(),y.setSelectionRange(b,b)})},[A,ie.triggerStart]);a.useEffect(()=>{const t=L.current;if(!t)return;t.style.height="0px";const e=Math.min(Math.max(t.scrollHeight,40),160);t.style.height=`${e}px`,t.style.overflowY=t.scrollHeight>e?"auto":"hidden"},[A]),a.useEffect(()=>{K("/api/user").then(t=>tn(t.name)).catch(()=>{})},[]);const Ze=a.useMemo(()=>ha(k,C),[k,C]);a.useEffect(()=>{P===null||Ze===null||Ze>=P&&J(null)},[P,Ze]);const un=a.useMemo(()=>pa(w),[w]),ye=Date.now(),mn=fa(w,Ze,ye),xt=un&&!ga(w)&&!mn,os=N&&(G||P!==null||xt),is=N&&ya({sending:G,awaitingResponse:P!==null,currentFlight:w}),F=wa({name:Q?.name,agentName:p?.agentName,id:x,title:p?.title}),j=a.useMemo(()=>N?Sa({agentName:F,agentState:Q?.state??null,sending:G,currentFlight:w,showWorkingTurn:xt,awaitingResponse:P!==null}):{label:"Open",detail:"",tone:"idle",showStrip:!1,showTyping:!1},[Q?.state,F,P,w,ye,N,G,xt]),vt=w?.startedAt??We?.startedAt??P,kt=Vt(vt),ls=Da(vt,ye),[,hn]=a.useState(0);a.useEffect(()=>{if(!j.showTyping||kt===null)return;const t=Math.max(0,Date.now()-kt),e=[$s.sustained,$s.long].find(r=>r>t);if(e===void 0)return;const n=window.setTimeout(()=>hn(r=>r+1),e-t+50);return()=>window.clearTimeout(n)},[kt,j.showTyping,ls]);const pn="Live",Ct=a.useMemo(()=>ba({currentFlight:w,presence:j,turnActivity:xe,turnAsk:We,awaitingResponseSince:P,nowMs:ye}),[P,w,ye,j,xe,We]),fn="s-thread-msg-card s-thread-msg-working-card s-thread-msg-card--avatar-row",gn="s-thread-msg-kind",yn="s-thread-turn-snapshot",wn="s-thread-turn-snapshot-pulse",Sn="s-thread-presence-line",bn=["s-thread-presence-strip",`s-thread-presence-strip--${ls}`].filter(Boolean).join(" "),Mt=p?Ta(p):F,cs=p?.id??s,Tn=p?.alias?.trim()||null,et=xa(p?.workspaceRoot),xn=j.tone,Nt=k.length===0&&N&&(j.showTyping||w!==null||xe.length>0||We!==null||P!==null),ds=a.useMemo(()=>p?p.participantIds.includes("operator"):N,[N,p]),$e=w?.agentId??x,Pe=$e?Rs(T,[$e]):null,Fe=Pe?.id??$e,Oe=w?.sessions.at(-1)?.sessionId??Pe?.harnessSessionId??void 0,us=w?.id?()=>{ct(d,{view:"sessions",flightId:w.id,...Fe?{agentId:Fe}:{},...Oe?{sessionId:Oe}:{},...I?{machineId:I}:{}},{returnTo:f})}:void 0,ms=w?.id??null;a.useEffect(()=>{if(!ms||!Fe){pt(null);return}let t=!1;const e=Oe?`?sessionId=${encodeURIComponent(Oe)}`:"",n=async()=>{try{const l=await K(`/api/agents/${encodeURIComponent(Fe)}/observe${e}`);if(t)return;pt(c=>te(c,l))}catch{}};n();const r=window.setInterval(()=>{n()},Fr);return()=>{t=!0,window.clearInterval(r),pt(null)}},[ms,Fe,Oe]);const It=a.useMemo(()=>Cr({flight:w,agent:Pe??Q,sessionMeta:p,observeSessionId:_e?.sessionId}),[Q,w,p,_e?.sessionId,Pe]),hs=Pr({sessionIds:It,active:j.showTyping||Nt}),vn=a.useMemo(()=>Rr({observe:_e,flight:w}),[w,_e]),X=hs.length>0?hs:vn,At=a.useMemo(()=>X.length>0?null:$r({flight:w,hasSessionScope:It.length>0,awaitingResponse:P!==null}),[P,w,It.length,X.length]),jt=Lr(X),Rt=Er(X),ps=X.at(-1)??null,Et=ps?Ut(ps.ts,ye):null,ce=a.useMemo(()=>Rt?{...Ct,latest:Rt,...jt?{activityLabel:jt}:{},...Et?{lastActivityLabel:Et}:{}}:Ct,[Et,Rt,Ct,jt]),kn=`${F}: ${ce.latest}`,fs=$e&&va(Pe)?()=>{ct(d,{view:"terminal",agentId:$e,mode:"takeover"},{returnTo:f})}:void 0,gs=N?()=>{h&&Qa({type:"focus-composer",reason:"Steer the active conversation"})||requestAnimationFrame(()=>{L.current?.focus({preventScroll:!0}),L.current?.scrollIntoView({block:"nearest"})})}:void 0,ys=a.useMemo(()=>(p?p.participantIds.filter(e=>e!=="operator"):x?[x]:[]).map(e=>{const n=Rs(T,[e]),r=le.get(e);return{id:e,name:r?.scopedAlias??n?.name??r?.displayName??As(e)??e,title:r?.label??n?.id??e,agent:n,sessionId:r?.sessionId??null,harness:n?.harness??r?.harness??null,model:n?.model??null,reasoningEffort:n?.reasoningEffort??null}}),[x,le,T,p]),ws=ys.slice(0,4),Cn=Math.max(ys.length-ws.length,0),Mn=a.useMemo(()=>({name:C,active:ds}),[ds,C]),tt=a.useMemo(()=>new Map(k.map(t=>[t.id,t])),[k]),st=a.useMemo(()=>ka(k),[k]),[Nn,Lt]=a.useState(()=>new Set),In=a.useCallback(t=>{Lt(e=>{const n=new Set(e);return n.delete(t)||n.add(t),n})},[]),Ss=a.useMemo(()=>{const t=new Map;for(const e of st)if(e.kind==="fanout")for(const n of e.messages)t.set(n.id,e.key);return t},[st]),nt=a.useCallback(t=>{const e=Ss.get(t);e&&Lt(c=>c.has(e)?c:new Set(c).add(e));const n=document.getElementById(`msg-${t}`);if(!n)return;const r=n.closest(".s-thread-fanout")??n,l=r===n?"s-thread-msg--flash":"s-thread-fanout--flash";r.scrollIntoView({behavior:"smooth",block:"center"}),r.classList.add(l),window.setTimeout(()=>r.classList.remove(l),1200)},[Ss]);a.useEffect(()=>{const t=()=>Js(Bs(window.location.hash));return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)},[]),a.useEffect(()=>{if(!Ke||!tt.has(Ke))return;const t=window.setTimeout(()=>nt(Ke),50);return()=>window.clearTimeout(t)},[Ke,tt,nt]),_a(a.useCallback(t=>{if(t.kind==="message.posted"){const e=t.payload?.message;if(!e||!yt.has(e.conversationId))return;const n=e.actorId==="operator",r=N&&!n&&e.class==="agent",l={id:e.id,conversationId:e.conversationId,actorId:e.actorId,actorName:r?F:Ca(e.actorId,T,C),body:e.body,createdAt:e.createdAt,class:n?"operator":e.class,attachments:e.attachments,metadata:e.metadata,replyToMessageId:e.replyToMessageId??e.n??null};if(_t(l))return;if(z(c=>{const g=qr(e.metadata),R=g?ne.current.get(g):void 0;if(c.some(S=>S.id===e.id))return g&&ne.current.delete(g),c;if(n&&g){const S=Ma(c,g,R);if(S!==-1){const y=[...c];return y[S]=l,ne.current.delete(g),be(y)}}return be([...c,l])}),r){const c=Vt(e.createdAt)??Date.now();J(g=>g===null||c<g||Na(Ae.current)?g:null),he(g=>Ia(g)?null:g)}return}if(t.kind==="invocation.requested"){const e=t.payload?.invocation;if(!e||e.targetAgentId!==x||!e.conversationId||!yt.has(e.conversationId))return;Ie.current.add(e.id),ve([]),ke(null),J(n=>n??Date.now());return}if(t.kind==="flight.updated"){const e=t.payload?.flight;if(!e||e.targetAgentId!==x||!(Ie.current.has(e.invocationId)||Ae.current?.id===e.id))return;if(Aa.has(e.state)){Ns(s,e.id),he(c=>c?.id===e.id?null:c),ve([]),ke(null),J(null),H({messageMode:"refresh",includeMetadata:!1});return}Ie.current.add(e.invocationId);const r=Ae.current?.id===e.id,l=Es(e,s,x??"",Ae.current);ja(l)&&J(null),he(l),r||(ve([]),ke(null));return}t.kind!=="agent.endpoint.upserted"&&t.kind==="unknown"&&H({messageMode:"refresh"})},[x,F,s,yt,N,H,C,T])),a.useEffect(()=>{if(!os)return;const t=setInterval(()=>{H({messageMode:"refresh",includeMetadata:!1})},5e3);return()=>clearInterval(t)},[os,H]),a.useEffect(()=>{const t=()=>{if(document.visibilityState!=="visible")return;const e=Date.now();e-ts.current<1e3||(ts.current=e,H({messageMode:"refresh"}))};return window.addEventListener("focus",t),document.addEventListener("visibilitychange",t),()=>{window.removeEventListener("focus",t),document.removeEventListener("visibilitychange",t)}},[H]);const $t=a.useRef(null),bs=a.useRef(!1),Pt=a.useRef(!1),Ft=a.useCallback(t=>{const e=es.current;e&&(ze.current=!0,ge.current!==null&&clearTimeout(ge.current),e.scrollIntoView({behavior:t}),ge.current=setTimeout(()=>{ze.current=!1,ge.current=null},t==="smooth"?700:0))},[]);a.useEffect(()=>()=>{ge.current!==null&&clearTimeout(ge.current)},[]);const An=a.useCallback(()=>{const t=Ve.current;if(!t||ze.current)return;const n=t.scrollHeight-t.clientHeight-t.scrollTop<=Or;Ne.current=n,n?(Ce(!1),Qe(0)):Ce(!0)},[]),jn=a.useCallback(()=>{Ne.current=!0,Ce(!1),Qe(0),Ft("smooth")},[Ft]);a.useEffect(()=>{const t=k.at(-1)?.id??null,e=!!(t&&t!==$t.current),n=Ra({newestMessageId:t,previousNewestMessageId:$t.current,showTyping:j.showTyping,previousShowTyping:bs.current,historyRestorePending:Ge.current||Me.current!==null,initialScrollDone:Pt.current,nearBottom:Ne.current});n!=="none"?(Ft(n),Pt.current=!0):e&&Pt.current&&!Ne.current&&(Ce(!0),Qe(r=>r+1)),Ge.current=!1,$t.current=t,bs.current=j.showTyping});const[,Rn]=a.useState(0);a.useEffect(()=>{const t=setInterval(()=>Rn(e=>e+1),15e3);return()=>clearInterval(t)},[]);const de=ea(),[ue,Y]=a.useState([]),[Ts,at]=a.useState("queue"),[we,Se]=a.useState(null),qe=async(t,e)=>{const n=t.trim(),r=e?.attachments??[],l=e?.replyTarget??null;if(!n&&r.length===0||G)return"failed";const g=e?.forceAction??Ps({isDm:N,hasOutstandingReply:is}),R=Date.now(),S=Yn(),y={id:`optimistic-${S}`,conversationId:s,actorId:"operator",actorName:C,body:n,createdAt:R,class:"operator",...l?{replyToMessageId:l.messageId}:{},metadata:{clientMessageId:S,deliveryState:"sending"},...r.length>0?{attachments:r}:{}};Je(!0),g!=="message"&&J(R),pe(null),ne.current.set(S,y.id),z(b=>be([...b,y]));try{const b=await K(`/api/chats/${encodeURIComponent(s)}/messages`,{method:"POST",body:JSON.stringify({body:n,clientMessageId:S,...l?{replyToMessageId:l.messageId}:{},...r.length>0?{attachments:r}:{}})}),U=b.chatId?.trim()??b.conversationId?.trim();if(U&&U!==s)throw new Error(`Send returned a different Chat (${U}) instead of appending to ${s}.`);if(b.messageId?.trim()){const E=b.messageId.trim();z(Z=>be(Z.map(D=>D.id===y.id?{...D,id:E,metadata:{clientMessageId:S}}:D))),ne.current.delete(S)}return b.flight?(Ie.current.add(b.flight.invocationId),he(Es(b.flight,s,x??"")),ve([]),ke(null)):g!=="message"&&J(null),"sent"}catch(b){return Dr(b)?(z(U=>U.map(E=>E.id===y.id?{...E,metadata:{...E.metadata??{},deliveryState:"unknown"}}:E)),"unknown"):(z(U=>U.filter(E=>E.id!==y.id)),ne.current.delete(S),J(null),pe(b instanceof Error?b.message:String(b)),"failed")}finally{Je(!1)}},En=async()=>{const t=A.trim(),e=ae,n=de.files,r=we?.attachments??[];if(!t&&n.length===0&&r.length===0)return null;let l=[];if(n.length>0){Je(!0);try{l=await Zn(n)}catch(c){return de.setError(c instanceof Error?c.message:String(c)),null}finally{Je(!1)}}return q(""),re(null),de.clear(),Se(null),{body:t,attachments:[...r,...l],replyTarget:e}},Ln=async()=>{const t=Ha({isAgentBusy:me,intent:Ts}),e=we?.id??null,n=await En();if(!n)return;if(t==="queue"){Y(c=>e?c.map(g=>g.id===e?{...g,body:n.body,attachments:n.attachments,replyTarget:n.replyTarget}:g):[...c,{id:`queued-${Date.now()}-${c.length}`,body:n.body,attachments:n.attachments,replyTarget:n.replyTarget,queuedAt:Date.now()}]);return}e&&Y(c=>c.filter(g=>g.id!==e));const r=()=>{q(n.body),Se(n.attachments.length>0?{id:null,attachments:n.attachments}:null),re(n.replyTarget),requestAnimationFrame(()=>L.current?.focus())};if(t==="steer"){at("queue"),await Dt(),await qe(n.body,{forceAction:"steer",attachments:n.attachments,replyTarget:n.replyTarget})==="failed"&&r();return}await qe(n.body,{attachments:n.attachments,replyTarget:n.replyTarget})==="failed"&&r()},$n=t=>{Y(e=>e.filter(n=>n.id!==t)),Se(e=>e?.id===t?null:e)},Pn=t=>{const e=ue.find(n=>n.id===t);e&&(q(e.body),re(e.replyTarget??null),Se({id:t,attachments:e.attachments}),requestAnimationFrame(()=>{const n=L.current;n&&(n.focus(),n.setSelectionRange(n.value.length,n.value.length))}))},Fn=()=>{Se(null),q(""),re(null),de.clear()},On=async t=>{const e=ue.find(r=>r.id===t);if(!e)return;Y(r=>r.filter(l=>l.id!==t)),await Dt(),await qe(e.body,{forceAction:"steer",attachments:e.attachments,replyTarget:e.replyTarget??null})==="failed"&&Y(r=>[e,...r])},Ot=a.useCallback((t,e)=>{const n=e?.trim().replace(/^@+/,"")||null,r=n?`@${n}`:null,l=ae?.insertedMention?Us(A,ae.insertedMention):A,c=!!(!N&&r&&!l.toLocaleLowerCase().includes(r.toLocaleLowerCase())),g=c&&r?l.trim()?`${l.trimEnd()} ${r} `:`${r} `:l;q(g),re({messageId:t.id,actorLabel:n?`@${n}`:t.actorName,preview:Hs(t),insertedMention:c?r:null}),requestAnimationFrame(()=>L.current?.focus())},[A,N,ae?.insertedMention]),qn=a.useCallback(()=>{const t=ae?.insertedMention;re(null),t&&q(e=>Us(e,t)),requestAnimationFrame(()=>L.current?.focus())},[ae]),qt=a.useCallback(t=>{const e=new URL(window.location.href);f.view==="agents-v2"&&e.searchParams.set("tab","message"),e.hash=`msg-${t}`,Be(e.toString())},[f.view]),xs=a.useCallback((t,e,n)=>{const r=Xn({conversationId:s,selectedMessageId:t.id,messages:k.map(l=>({id:l.id,actorLabel:l.id===t.id?e:lt(l,C)?C:l.actorName,body:l.body,attachmentCount:l.attachments?.length??0}))});m({intent:"forward-message",forwardContext:r,forwardContextMode:"selected-message",...n?{projectPath:n}:{}})},[s,k,m,C]),Dt=async()=>{if(x)try{await K("/api/agents/"+encodeURIComponent(x)+"/interrupt",{method:"POST",body:JSON.stringify({})})}catch{}},me=j.tone==="working"||j.tone==="pending",Dn=Ps({isDm:N,hasOutstandingReply:is}),Bn=N?`Message ${F} — type / to route or @ to mention an agent`:p?.kind==="channel"?`Comment in #${Ea(p)} — mention @agent to request a reply`:`Comment in ${Mt} — mention @agent to request a reply`,vs=we?.attachments??[],Hn=!A.trim()&&!de.hasFiles&&vs.length===0&&me,Bt=a.useRef(!1);a.useEffect(()=>{const t=we?.id??null,e=t?ue.filter(r=>r.id!==t):ue;if(!La({isAgentBusy:me,sending:G,queued:e})||Bt.current)return;const n=e[0];n&&(Bt.current=!0,Y(r=>r.filter(l=>l.id!==n.id)),qe(n.body,{attachments:n.attachments,replyTarget:n.replyTarget??null}).then(r=>{r==="failed"&&Y(l=>[n,...l])}).finally(()=>{Bt.current=!1}))},[me,G,ue,we]),a.useEffect(()=>{me||at("queue")},[me]),a.useEffect(()=>{Y([]),Se(null),re(null),at("queue"),de.clear()},[s]);const Un=$a(ue),ks=za(),_n=a.useCallback((t,e)=>{const n=window.getSelection()?.toString().trim(),r=lt(e,C),l=e.actorId?le.get(e.actorId):null,c=r?null:Ls(e,T,x),g=(l?.scopedAlias?.trim()||c?.handle?.trim()||null)?.replace(/^@+/,"")??null,R=g?`@${g}`:e.actorName,S=(c?.id||l?.agentId||e.actorId||"").trim(),y=[];r||y.push({kind:"action",label:"Reply",onSelect:()=>Ot(e,g)}),y.push({kind:"action",label:"Forward to new task…",onSelect:()=>xs(e,R,l?.workspaceRoot??c?.projectRoot??c?.cwd??void 0)}),y.push({kind:"separator"}),n&&y.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>{Be(n)}}),y.push({kind:"action",label:"Copy Message",onSelect:()=>{Be(e.body)}}),y.push({kind:"action",label:"Copy Link",onSelect:()=>qt(e.id)}),y.push({kind:"separator"}),!r&&S&&y.push({kind:"action",label:"Copy Agent ID",onSelect:()=>{Be(S)}}),y.push({kind:"action",label:"Copy Message ID",onSelect:()=>{Be(e.id)}}),ks(t,y)},[x,Ot,qt,xs,C,le,T,ks]),Wn=async(t,e)=>{const n=`@${e.agentId} `,r=A.trim();if(r){q(""),await qe(`${n}${r}`,{forceAction:"invoke"});return}q(n),L.current?.focus()},De=a.useMemo(()=>{if(!p)return[];const t=new Set(p.participantIds);return T.filter(e=>!t.has(e.id)&&!e.retiredFromFleet).sort((e,n)=>e.name.localeCompare(n.name))},[p,T]);a.useEffect(()=>{wt&&Ye(t=>t&&De.some(e=>e.id===t)?t:De[0]?.id??"")},[wt,De]);const Cs=!!(p&&["direct","group_direct","channel"].includes(p.kind)&&De.length>0),Kn=a.useCallback(async()=>{if(!p)return;const t=St.trim();if(t){bt(!0),Le(null);try{const e=await K(`/api/conversations/${encodeURIComponent(p.id)}/members`,{method:"POST",body:JSON.stringify({actorId:t})});e.session?ht(e.session):ht(n=>n&&{...n,kind:e.kind,participantIds:e.participantIds}),Xe(!1),Ye(""),await H({messageMode:"none"})}catch(e){Le(e instanceof Error?e.message:String(e))}finally{bt(!1)}}},[St,H,p]);return o.jsx("div",{className:`s-thread-layout${h?" s-thread-layout--embedded":""}`,"data-thread-treatment":v==="standard"?void 0:v,children:o.jsxs("div",{className:"s-thread-center",children:[!h&&o.jsx(Ja,{showBackNav:u,isDm:N,navigate:d,route:f,canonicalConversationId:cs,threadTitle:Mt,agentId:Q?.id??null,sessionId:ns,detailRoute:Zs,visibleParticipants:ws,hiddenParticipantCount:Cn,operator:Mn,canAddParticipants:Cs,onToggleAddParticipant:()=>{Le(null),Xe(t=>!t)}}),!h&&p&&o.jsx(Xa,{canonicalConversationId:cs,conversationAlias:Tn}),!h&&wt&&Cs&&o.jsx(Ya,{agents:De,addParticipantId:St,setAddParticipantId:Ye,addingParticipant:nn,addParticipantError:sn,onCancel:()=>{Xe(!1),Le(null)},onSubmit:()=>{Kn()}}),as&&o.jsx(mr,{pinnedAsk:as,onAnswer:()=>{L.current?.focus()}}),o.jsx(hr,{presence:j,agent:Q}),Zt&&o.jsx("p",{className:"s-thread-error",children:Zt}),o.jsxs("div",{className:"s-thread-feed",ref:Ve,onScroll:An,children:[!Yt&&k.length>0&&Ys&&o.jsx("div",{className:"s-thread-history-control",children:o.jsxs("button",{type:"button",className:"s-thread-history-button",disabled:fe,"aria-busy":fe,onClick:()=>{en()},children:[fe&&o.jsx("span",{className:"s-thread-history-spinner","aria-hidden":"true"}),fe?"Loading earlier messages…":"Load earlier messages"]})}),Yt?o.jsx(tr,{}):k.length===0?Nt?o.jsx(sr,{agentName:F,title:j.label,detail:j.detail||ce.latest,snapshot:ce,events:xe,steps:X,phase:At,tone:xn,workspaceName:et,branch:p?.currentBranch,startedAt:vt,onOpenTrace:us,onOpenTerminal:fs,onSteer:gs}):o.jsxs("div",{className:"s-thread-empty",children:[o.jsx("div",{className:"s-thread-empty-glyph","aria-hidden":"true",children:N?"@":"#"}),o.jsx("p",{children:Mt}),o.jsx("p",{children:N?"No messages yet. Send a message to start working with this agent.":"No messages yet. Start the conversation below."}),(et||p?.currentBranch)&&o.jsxs("div",{className:"s-thread-empty-chips",children:[et&&o.jsx("span",{className:"s-thread-empty-chip",children:et}),p?.currentBranch&&o.jsx("span",{className:"s-thread-empty-chip",children:p.currentBranch})]})]}):st.map((t,e)=>{const n=Pa(t,e);if(t.kind==="fanout")return o.jsx(Za,{row:t,expanded:Nn.has(t.key),showDayDivider:n,onToggle:()=>In(t.key)},t.key);const r=t.message,l=lt(r,C),c=Fa(r),g=c?"scout.dispatch":r.class,R=Ba(g),S=g==="status",y=Fs(r.createdAt),b=l?null:Ls(r,T,x),E=le.get(r.actorId)?.scopedAlias?.trim()||null,Z=!l&&E?E:r.actorName,D=l?C.toLowerCase():E??b?.handle??null,_=Oa(r.body),W=_?qa({flightId:_.flightId,replyToMessageId:r.replyToMessageId,messagesById:tt,agents:T,operatorName:C}):null,B=!_&&r.replyToMessageId?tt.get(r.replyToMessageId)??null:null,ee=B?lt(B,C)?C:B.actorName:null,rt=_?_.body:r.body;return o.jsxs("div",{className:["s-thread-feed-block",l&&"s-thread-feed-block--you",n&&"s-thread-feed-block--full-width"].filter(Boolean).join(" "),children:[n&&o.jsx(er,{at:r.createdAt}),o.jsx("article",{id:`msg-${r.id}`,className:["s-thread-msg",l&&"s-thread-msg--you",S&&"s-thread-msg--tool",(Xt||zs?.has(r.id))&&"s-thread-msg--enter"].filter(Boolean).join(" "),style:Xt?{animationDelay:`${Math.max(0,7-(st.length-1-e))*26}ms`}:void 0,"data-class":g,onContextMenu:$=>_n($,r),children:o.jsx("div",{className:"s-thread-msg-card",children:o.jsxs("div",{className:"s-thread-msg-card-content",children:[o.jsxs("div",{className:"s-thread-msg-header",children:[o.jsxs("div",{className:"s-thread-msg-meta",children:[(()=>{const $=!l&&b?()=>ct(d,{view:"agents-v2",agentId:b.id},{returnTo:f}):null,ot=l?C:Z??"?",M=o.jsx(Wt,{agent:b??void 0,name:ot,placement:"turn",className:"s-thread-msg-avatar",title:ot});return $?o.jsx("button",{type:"button",className:"s-thread-msg-avatar--nav",onClick:$,"aria-label":`View profile for ${r.actorName??"agent"}`,title:`View profile for ${r.actorName??"agent"}`,children:M}):M})(),!l&&b?o.jsx("button",{type:"button",className:"s-thread-msg-actor s-thread-msg-actor--nav",onClick:()=>ct(d,{view:"agents-v2",agentId:b.id},{returnTo:f}),title:`View profile for ${r.actorName}`,children:Z}):o.jsx("span",{className:"s-thread-msg-actor",children:l?C:Z}),D&&o.jsxs("span",{className:"s-thread-msg-handle",children:["@",D]}),R&&o.jsx("span",{className:"s-thread-msg-kind",children:R})]}),o.jsx("span",{className:"s-thread-msg-time",title:y,children:Ut(r.createdAt)}),o.jsxs("span",{className:"s-thread-msg-actions",children:[!l&&D&&o.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":`Reply to @${D}`,title:`Reply to @${D}`,onClick:()=>Ot(r,D),children:o.jsx(Qt,{})}),o.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":"Copy link to message",title:"Copy link to message",onClick:()=>qt(r.id),children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M6.5 9.5a2.5 2.5 0 0 0 3.54 0l2.12-2.12a2.5 2.5 0 0 0-3.54-3.54l-.7.7"}),o.jsx("path",{d:"M9.5 6.5a2.5 2.5 0 0 0-3.54 0L3.84 8.62a2.5 2.5 0 0 0 3.54 3.54l.7-.7"})]})})]})]}),W&&o.jsxs("button",{type:"button",className:"s-thread-reply-ctx",title:`Open the originating request${W.flightId?` · ${W.flightId}`:""}`,onClick:()=>nt(W.originatingMessageId),children:[o.jsx(Qt,{}),o.jsx("span",{className:"s-thread-reply-ctx-label",children:"reply to"}),o.jsx("span",{className:"s-thread-reply-ctx-title",children:W.title}),o.jsxs("span",{className:"s-thread-reply-ctx-from",children:["· ",W.from]}),o.jsx("span",{className:"s-thread-reply-ctx-status",children:"· done"})]}),B&&ee&&o.jsxs("button",{type:"button",className:"s-thread-reply-ctx",title:`Open message from ${ee}`,onClick:()=>nt(B.id),children:[o.jsx(Qt,{}),o.jsx("span",{className:"s-thread-reply-ctx-label",children:"reply to"}),o.jsx("span",{className:"s-thread-reply-ctx-title",children:Hs(B)}),o.jsxs("span",{className:"s-thread-reply-ctx-from",children:["· ",ee]})]}),o.jsx("div",{className:"s-thread-msg-body",title:y,children:o.jsx(Wa,{text:rt})}),o.jsx(kr,{message:r}),c&&c.candidates.length>0&&o.jsx("div",{className:"s-thread-dispatch",children:c.candidates.map($=>o.jsxs("button",{type:"button",className:"s-thread-dispatch-tile",onClick:()=>{Wn(c,$)},children:[o.jsxs("span",{className:"s-thread-dispatch-tile-id",children:["@",$.agentId]}),o.jsx("span",{className:"s-thread-dispatch-tile-state",children:$.endpointState}),o.jsx("span",{className:"s-thread-dispatch-tile-meta",children:[$.workspace,$.node,$.projectRoot].filter(Boolean).join(" · ")||$.displayName})]},$.agentId))})]})})})]},r.id)}),j.showTyping&&!Nt&&o.jsx("div",{className:"s-thread-feed-block",children:o.jsx("div",{className:"s-thread-msg","aria-live":"polite",children:o.jsxs("div",{className:fn,children:[o.jsx(Wt,{agent:Q??void 0,name:F,placement:"turn",className:"s-thread-msg-avatar s-thread-msg-avatar--working",title:F}),o.jsxs("div",{className:"s-thread-msg-card-content",children:[o.jsxs("div",{className:"s-thread-msg-header",children:[o.jsxs("div",{className:"s-thread-msg-meta",children:[o.jsx("span",{className:"s-thread-msg-actor",children:F}),o.jsx("span",{className:gn,children:pn})]}),o.jsx("span",{className:"s-thread-msg-time",title:w?.startedAt?Fs(w.startedAt):"now",children:w?.startedAt?Ut(w.startedAt):"now"})]}),o.jsxs("div",{className:"s-thread-msg-working-body",children:[o.jsxs("div",{className:yn,children:[o.jsx("span",{className:wn,"aria-hidden":"true"}),o.jsxs("div",{className:"s-thread-turn-snapshot-main",children:[o.jsx("span",{className:"s-thread-turn-snapshot-label",children:"Latest"}),o.jsx("span",{className:"s-thread-msg-working-copy",children:ce.latest})]})]}),o.jsxs("dl",{className:"s-thread-turn-snapshot-stats",children:[o.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[o.jsx("dt",{children:"Activity"}),o.jsx("dd",{children:ce.activityLabel})]}),o.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[o.jsx("dt",{children:"Elapsed"}),o.jsx("dd",{children:ce.elapsedLabel})]}),o.jsxs("div",{className:"s-thread-turn-snapshot-stat",children:[o.jsx("dt",{children:"Last"}),o.jsx("dd",{children:ce.lastActivityLabel})]})]}),X.length>0||At?o.jsx(nr,{steps:X,phase:At,limit:5,compact:!0}):o.jsx(ar,{events:xe,limit:4,compact:!0}),o.jsx(rr,{onOpenTrace:us,onOpenTerminal:fs,onSteer:gs,compact:!0})]})]})]})})}),Xs&&gt>0&&o.jsxs("button",{type:"button",className:"s-thread-new-messages",onClick:jn,children:[o.jsx("span",{"aria-hidden":"true",children:"↓"})," ",gt," new ",gt===1?"message":"messages"," · jump to latest"]}),o.jsx("div",{ref:es})]}),j.showTyping&&o.jsxs("div",{className:Sn,children:[o.jsx("div",{className:"s-thread-presence-line-avatars",children:o.jsx(Wt,{agent:Q??void 0,name:F,placement:"turn",className:"s-thread-presence-line-avatar",title:F})}),o.jsx("span",{className:"s-thread-presence-line-label",children:kn}),o.jsx("div",{className:bn,"aria-hidden":"true"})]}),o.jsx(ta,{composeRef:L,draft:A,setDraft:q,composePlaceholder:Bn,slashState:oe,setSlashState:Re,filteredSlashCommands:an,applySlashCommand:cn,mentionState:ie,setMentionState:Ee,filteredMentions:rn,applyMention:dn,updateTriggersFromDraft:ln,closeSuggestions:on,replyTarget:ae,onCancelReply:qn,isStopMode:Hn,sending:G,composeAction:Dn,onSend:()=>{Ln()},onInterrupt:()=>{Dt()},attachments:de,isAgentBusy:me,busyIntent:Ts,onBusyIntentChange:at,queued:ue,queueNote:Un,onEditQueued:Pn,editingQueuedId:we?.id??null,editingAttachmentCount:vs.length,onCancelEdit:Fn,onUnqueue:$n,onSendQueuedNow:t=>{On(t)}})]})})}function Qt(){return o.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("polyline",{points:"9 14 4 9 9 4"}),o.jsx("path",{d:"M20 20v-7a4 4 0 0 0-4-4H4"})]})}const ti=Ga({id:"thread",label:"Thread",route:{view:"conversation",conversationId:""},webPath:"/chat",screen:"ConversationScreen",embed:{path:"/embed/thread",profile:"macos.thread",rootClassName:"s-thread-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},hosts:{macos:!0},resolveEmbedProps:Ua}});export{ei as ConversationScreen,ti as scoutSurface};