@openscout/scout 0.2.78 → 0.2.79

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 (391) hide show
  1. package/README.md +19 -0
  2. package/bin/scoutd +0 -0
  3. package/dist/build-manifest.json +3 -3
  4. package/dist/client/assets/ActivityScreen-DnqqRSlS.js +1 -0
  5. package/dist/client/assets/{AddProjectForm-DMnobKch.js → AddProjectForm-BoVtelSP.js} +1 -1
  6. package/dist/client/assets/{AgentAvatar-D90c1Rzk.js → AgentAvatar-CufDA4A-.js} +1 -1
  7. package/dist/client/assets/AgentConfigurationScreen-CJqoMA0J.js +1 -0
  8. package/dist/client/assets/AgentDefinitionsWorkspace-FpEkb-tu.js +1 -0
  9. package/dist/client/assets/{AgentDetailCard-BcRBRp88.js → AgentDetailCard-DxxVkgT1.js} +1 -1
  10. package/dist/client/assets/AgentFloorView-CycUn0Lv.js +1 -0
  11. package/dist/client/assets/AgentInfoScreen-CAQAxpAK.js +1 -0
  12. package/dist/client/assets/{AgentLaneCard-RrNnDZu8.js → AgentLaneCard-DTUvE96I.js} +1 -1
  13. package/dist/client/assets/{AgentLaneChrome-D9ZwUKrl.js → AgentLaneChrome-BfVygkgL.js} +1 -1
  14. package/dist/client/assets/{AgentLaneDetailSheet-BXbPls9N.js → AgentLaneDetailSheet-CWs9wKWk.js} +1 -1
  15. package/dist/client/assets/{AgentLaneSummaryResize-BhFmGNzT.js → AgentLaneSummaryResize-CMgzYvAA.js} +1 -1
  16. package/dist/client/assets/AgentLanesEmbedScreen-BUCW4nUj.js +1 -0
  17. package/dist/client/assets/{AgentLanesPreflight-eSAoDsPi.js → AgentLanesPreflight-KWfLcaNB.js} +1 -1
  18. package/dist/client/assets/AgentLanesView-CxfbV8Kd.js +2 -0
  19. package/dist/client/assets/{AgentLiveActions-DBtnD0qE.js → AgentLiveActions-CZdAInEu.js} +1 -1
  20. package/dist/client/assets/{AgentSessions-DyqOf4nG.js → AgentSessions-Bkr0lyry.js} +2 -2
  21. package/dist/client/assets/AgentsConsole-WtFVqaPJ.js +1 -0
  22. package/dist/client/assets/AgentsScreen-BMXvuiA2.js +1 -0
  23. package/dist/client/assets/AgentsSubnav-BTNjPYoA.js +1 -0
  24. package/dist/client/assets/{AtopView-BCkae3e1.js → AtopView-_OKDlZ1h.js} +1 -1
  25. package/dist/client/assets/BackToPicker-CkUmHuuo.js +1 -0
  26. package/dist/client/assets/{BriefingDetailScreen-BwFyysT8.js → BriefingDetailScreen-i54EtZKW.js} +1 -1
  27. package/dist/client/assets/{BriefingsScreen-BQEevztH.js → BriefingsScreen-CBrHojlQ.js} +1 -1
  28. package/dist/client/assets/{BrokerMetadataPanel-7UjcuNjd.js → BrokerMetadataPanel-opTLuZU6.js} +1 -1
  29. package/dist/client/assets/{BrokerScreen-7ekklu88.js → BrokerScreen-CObCQvoy.js} +2 -2
  30. package/dist/client/assets/{ChatCollapsedStrip-CQSYSd8s.js → ChatCollapsedStrip-Dr2vmKXQ.js} +1 -1
  31. package/dist/client/assets/CodeDiffPane-CLOGjwul.js +1 -0
  32. package/dist/client/assets/{CodeProjectPicker-DqKFCpLU.js → CodeProjectPicker-DTV8hR6A.js} +1 -1
  33. package/dist/client/assets/CodeScreen-BXqi72NK.js +1 -0
  34. package/dist/client/assets/{ContextMenu-bARZqTzD.js → ContextMenu-BlBQhpax.js} +1 -1
  35. package/dist/client/assets/{ConversationComposer-Bla3DDvM.js → ConversationComposer-BBNPa5S9.js} +1 -1
  36. package/dist/client/assets/ConversationFeedRows-BuejHMCY.js +1 -0
  37. package/dist/client/assets/ConversationHeader-DXMT-YXv.js +1 -0
  38. package/dist/client/assets/ConversationPanels-DHCtilQF.js +2 -0
  39. package/dist/client/assets/ConversationScreen-DSxIt9pq.css +1 -0
  40. package/dist/client/assets/ConversationScreen-Dz2d_Z_F.js +1 -0
  41. package/dist/client/assets/ConversationStatus-DSgdVofa.js +1 -0
  42. package/dist/client/assets/{DataTable-E8s_MmoA.js → DataTable-0DwuXyvW.js} +1 -1
  43. package/dist/client/assets/{DispatchAftermath-Dpe88DFX.js → DispatchAftermath-BrreQifA.js} +1 -1
  44. package/dist/client/assets/{DocumentFocusViewer-BeVwwl26.js → DocumentFocusViewer-DU_9BHsD.js} +1 -1
  45. package/dist/client/assets/{EmbeddableSurfacesLab-BQqFQVnI.js → EmbeddableSurfacesLab-DdaswbfI.js} +1 -1
  46. package/dist/client/assets/{EmptyState-4F9XDFQm.js → EmptyState-CoL-QuUO.js} +1 -1
  47. package/dist/client/assets/{FileViewerPane-CLgUhSm4.js → FileViewerPane-C9Ly01Ef.js} +1 -1
  48. package/dist/client/assets/{FleetSearch-Dz5euQJe.js → FleetSearch-DlWTLl-v.js} +1 -1
  49. package/dist/client/assets/FlightObserveScreen-C-9S0nA5.js +1 -0
  50. package/dist/client/assets/{FollowScreen-DZ4qfYOY.js → FollowScreen--Q04xSSE.js} +1 -1
  51. package/dist/client/assets/{HarnessMark-Cbv3Ib0c.js → HarnessMark-Dm_qm1Ku.js} +1 -1
  52. package/dist/client/assets/HarnessesScreen-Y54viPX8.js +1 -0
  53. package/dist/client/assets/{HomeHero-B3uYd-pP.js → HomeHero-Cfsow7qL.js} +1 -1
  54. package/dist/client/assets/KnowledgeSearchInspector-DKashKoH.js +1 -0
  55. package/dist/client/assets/KnowledgeSearchScreen-DsdDz8wY.js +1 -0
  56. package/dist/client/assets/{LaneToolHoverCard-Bla0gBdm.js → LaneToolHoverCard-BzehBmdi.js} +1 -1
  57. package/dist/client/assets/LaneTraceDetailSheet-CBf_aNZx.js +1 -0
  58. package/dist/client/assets/{LaneTraceEventFocus-BF9ERP5O.js → LaneTraceEventFocus-DYvHfs_3.js} +1 -1
  59. package/dist/client/assets/{MeshCanvas-DFEPkpqY.js → MeshCanvas-DIjlrMPU.js} +2 -2
  60. package/dist/client/assets/{MeshCanvasMinimap-CyVFYixr.js → MeshCanvasMinimap-DEq-PkF0.js} +1 -1
  61. package/dist/client/assets/MeshScreen-TgDtz-1l.js +1 -0
  62. package/dist/client/assets/{MeshTopologyView-CalkZghg.js → MeshTopologyView-BMHpH5BU.js} +2 -2
  63. package/dist/client/assets/{MessageComposerSuggestions-DpxN9WiB.js → MessageComposerSuggestions-zAUUcLOv.js} +1 -1
  64. package/dist/client/assets/MessagesScreen-BTQL0UcE.js +1 -0
  65. package/dist/client/assets/{MissionControlView-lUeAiSVg.js → MissionControlView-D59SPnAm.js} +1 -1
  66. package/dist/client/assets/{MissionFocusOverlay-wlCmWDCT.js → MissionFocusOverlay-C7cPt6eU.js} +1 -1
  67. package/dist/client/assets/MissionLeftAgentRow-CxlH3dON.js +1 -0
  68. package/dist/client/assets/{MissionLogPane-__MVtEl9.js → MissionLogPane-Ye3YlF9s.js} +1 -1
  69. package/dist/client/assets/{NewAgentModal-Bg-eWHpY.js → NewAgentModal-DprvD4EK.js} +1 -1
  70. package/dist/client/assets/NewChatComposer-B5FnPyzS.js +19 -0
  71. package/dist/client/assets/{NewChatOrigin-Bk2OyVjI.js → NewChatOrigin--pHWUb4V.js} +1 -1
  72. package/dist/client/assets/ObserveEmbedScreen-CfvrnOiZ.js +2 -0
  73. package/dist/client/assets/{ObserveTextFlow-rsFj_rVo.js → ObserveTextFlow-CBitljxi.js} +2 -2
  74. package/dist/client/assets/{ObservedTopologyPanel-DyUeV98H.js → ObservedTopologyPanel-Dv6fbHzW.js} +1 -1
  75. package/dist/client/assets/OpenScoutAppShell-BIp0WitK.js +87 -0
  76. package/dist/client/assets/OpsAgentsView-CoBfAigH.js +1 -0
  77. package/dist/client/assets/OpsScreen-Bbo0W64T.js +1 -0
  78. package/dist/client/assets/OpsSubnav-CoN8utF8.js +1 -0
  79. package/dist/client/assets/{PlanView-C1CjH3PG.js → PlanView-DYtt8H37.js} +1 -1
  80. package/dist/client/assets/ProjectAgentProfile-FiiIcB5R.js +1 -0
  81. package/dist/client/assets/{ProjectAgentProfileBar-CtTpj6fU.js → ProjectAgentProfileBar-B3IvVbqS.js} +1 -1
  82. package/dist/client/assets/ProjectAgentProfileHero-D5E8yvDj.js +1 -0
  83. package/dist/client/assets/ProjectsInbox-BWiXjGi7.js +2 -0
  84. package/dist/client/assets/{ProjectsRail-BgiuV4LR.js → ProjectsRail-DEDS-M1c.js} +1 -1
  85. package/dist/client/assets/ProjectsScreen-Cxk4CuYn.js +1 -0
  86. package/dist/client/assets/ProjectsThreadAside-BF66ugT5.js +1 -0
  87. package/dist/client/assets/Provider-tFc3jqZ4.js +1 -0
  88. package/dist/client/assets/{RailRow-BoGxAHNF.js → RailRow-BTlVAnHS.js} +1 -1
  89. package/dist/client/assets/RawSessionsTable-BsGVgZB3.js +1 -0
  90. package/dist/client/assets/RealtimeVoiceScreen-B0Bem5Rc.js +1 -0
  91. package/dist/client/assets/{RepoDiffEmbedScreen-C0rumUME.js → RepoDiffEmbedScreen-CtTdlQ2A.js} +1 -1
  92. package/dist/client/assets/{RepoDiffPageScreen-DMv6DioL.js → RepoDiffPageScreen-BRvaVYoC.js} +1 -1
  93. package/dist/client/assets/RepoDiffViewer-Bo0gREMj.js +7 -0
  94. package/dist/client/assets/RepoDiffViewerLazy-C8UPk4oo.js +2 -0
  95. package/dist/client/assets/{ReposScreen-CB_YBWYf.js → ReposScreen-BBkJf8xT.js} +2 -2
  96. package/dist/client/assets/{ScoutDeckSurface-CxIYFyWx.js → ScoutDeckSurface-Bi9ov9Bm.js} +1 -1
  97. package/dist/client/assets/{ScoutSurface-CYz_TcWC.js → ScoutSurface-DEQg_7Io.js} +1 -1
  98. package/dist/client/assets/{ScoutbotBroadcastChip-L_R9atj0.js → ScoutbotBroadcastChip-DJXuyn73.js} +1 -1
  99. package/dist/client/assets/{ScoutbotFxLab-CgiZMDMW.js → ScoutbotFxLab-BgsuLDjo.js} +1 -1
  100. package/dist/client/assets/{ScoutbotRealtimeVoiceCall-FMQOr1Np.js → ScoutbotRealtimeVoiceCall-Bzyl0BCS.js} +1 -1
  101. package/dist/client/assets/{SecondaryNav-B3-nh5dM.js → SecondaryNav-Bks0CO2h.js} +1 -1
  102. package/dist/client/assets/SessionEmbedScreen-b0Zgmfx5.js +1 -0
  103. package/dist/client/assets/SessionObserve-CLrHfAKZ.css +1 -0
  104. package/dist/client/assets/SessionObserve-Dlx5vDaV.js +12 -0
  105. package/dist/client/assets/SessionObserveEvidence-ChBD1d4c.js +1 -0
  106. package/dist/client/assets/SessionRefScreen-D7TfPYPN.js +1 -0
  107. package/dist/client/assets/SessionsScreen-BlknOWAd.js +1 -0
  108. package/dist/client/assets/{SettingsDrawer-XfdAa_nD.js → SettingsDrawer-C587L1i1.js} +3 -3
  109. package/dist/client/assets/SettingsDrawer-UX7pFJU_.css +1 -0
  110. package/dist/client/assets/SettingsScreen-BIlYxv_a.js +1 -0
  111. package/dist/client/assets/{ShikiPane-Ap1iPxYb.js → ShikiPane-I_OTW5NO.js} +1 -1
  112. package/dist/client/assets/{SlidePanel-COwtoJqR.js → SlidePanel-FCqT1zO3.js} +1 -1
  113. package/dist/client/assets/SpriteAvatar-CQs-jC-v.js +1 -0
  114. package/dist/client/assets/{StatusPill-DhBL__p8.js → StatusPill-CbABggnQ.js} +1 -1
  115. package/dist/client/assets/{TailView-DGj_5HA9.js → TailView-C_MXVSum.js} +2 -2
  116. package/dist/client/assets/Terminal-DwZyo8kA.js +1 -0
  117. package/dist/client/assets/TerminalEmbedScreen-Czp3tQyd.js +1 -0
  118. package/dist/client/assets/{TextDocumentSurface-BpAw4eQS.js → TextDocumentSurface-C-9EtYqt.js} +1 -1
  119. package/dist/client/assets/{TmuxPeek-m1osv33Q.js → TmuxPeek-Dz1gJ2pU.js} +1 -1
  120. package/dist/client/assets/{VoicePermissionsPanel-DsK53ar4.js → VoicePermissionsPanel-MfICy9kk.js} +1 -1
  121. package/dist/client/assets/{WorkDetailScreen-Bx0JimPC.js → WorkDetailScreen-Cs7kdllj.js} +3 -3
  122. package/dist/client/assets/{WorkFilesViewer-Btl6C2Q1.js → WorkFilesViewer-CF-nhtZ4.js} +1 -1
  123. package/dist/client/assets/{activity-CA8qS6PI.js → activity-WhBf3FXP.js} +1 -1
  124. package/dist/client/assets/{addon-fit-BZ-kXjeN.js → addon-fit-q-x_HytU.js} +1 -1
  125. package/dist/client/assets/{addon-webgl-D9-EQVEK.js → addon-webgl-fhhvEA9h.js} +1 -1
  126. package/dist/client/assets/{agent-essentials-BSY1o46q.js → agent-essentials-DyJiUGpZ.js} +1 -1
  127. package/dist/client/assets/agent-identity-xQHedtLl.js +1 -0
  128. package/dist/client/assets/agent-lane-card-BkWVDYM8.css +1 -0
  129. package/dist/client/assets/{agent-lane-card-model-r2frk57c.js → agent-lane-card-model-BCIwPjEh.js} +1 -1
  130. package/dist/client/assets/{agent-lane-detail-Djm3YJEa.js → agent-lane-detail-Cw4QVAgH.js} +1 -1
  131. package/dist/client/assets/{agent-lane-preview-CmHVe3dU.js → agent-lane-preview-BtnfNyFR.js} +1 -1
  132. package/dist/client/assets/{agent-lanes-model-B4YTt4OF.js → agent-lanes-model-Bl6xfviL.js} +1 -1
  133. package/dist/client/assets/{arc.es-CQBb-dVu.js → arc.es-DPJ0xRV6.js} +1 -1
  134. package/dist/client/assets/{arrow-down-BPLe0am9.js → arrow-down-DsD-dYj-.js} +1 -1
  135. package/dist/client/assets/{arrow-left-DEZzHiPS.js → arrow-left-WjQIN9J6.js} +1 -1
  136. package/dist/client/assets/{arrow-up-right-ClxBnsi7.js → arrow-up-right-CtTDrZJr.js} +1 -1
  137. package/dist/client/assets/{bot-eu8pBNvI.js → bot-B_Uzf4_O.js} +1 -1
  138. package/dist/client/assets/{check-DjgFiBxb.js → check-BbgHJX8u.js} +1 -1
  139. package/dist/client/assets/{chevron-down-BGk5qoEw.js → chevron-down-BFai6ZfE.js} +1 -1
  140. package/dist/client/assets/{chevron-right-XiIHsk4m.js → chevron-right-CyUa1zXx.js} +1 -1
  141. package/dist/client/assets/chunk-HRAB3GC3-CvwpNg-G.js +1 -0
  142. package/dist/client/assets/{chunk-T65CQEWV-CrzwSeEt.js → chunk-T65CQEWV-DI4NKdNq.js} +1 -1
  143. package/dist/client/assets/{chunk-YOZR3KYS-Bet8khjg.js → chunk-YOZR3KYS-BW85tiCr.js} +3 -3
  144. package/dist/client/assets/clock-DviOalxA.js +1 -0
  145. package/dist/client/assets/{code-xml-B6jOCM4V.js → code-xml-05TD3uOC.js} +1 -1
  146. package/dist/client/assets/content-2u_eV3fX.js +1 -0
  147. package/dist/client/assets/content-5irOghrY.js +1 -0
  148. package/dist/client/assets/content-8Z_0CwtD.js +1 -0
  149. package/dist/client/assets/content-B38YRDBu.js +1 -0
  150. package/dist/client/assets/content-BE3uK0LB.js +1 -0
  151. package/dist/client/assets/{content-C2EwTb2y.js → content-BtIxSqVY.js} +1 -1
  152. package/dist/client/assets/content-CFsPAihU.js +1 -0
  153. package/dist/client/assets/content-CKj5g5tu.js +1 -0
  154. package/dist/client/assets/{content-D5kJmfgl.js → content-CLDWXf9Z.js} +1 -1
  155. package/dist/client/assets/content-CRr73E0r.js +1 -0
  156. package/dist/client/assets/content-CVR75_Uj.js +1 -0
  157. package/dist/client/assets/content-Czdp7_JQ.js +1 -0
  158. package/dist/client/assets/content-D0_EJ6nP.js +1 -0
  159. package/dist/client/assets/content-DNmxpNhD.js +1 -0
  160. package/dist/client/assets/content-XpbI9uxd.js +1 -0
  161. package/dist/client/assets/content-cyxWdgKQ.js +1 -0
  162. package/dist/client/assets/{context-budget-CbB4BDcO.js → context-budget-DX_fwUs3.js} +1 -1
  163. package/dist/client/assets/{conversation-icons-IIG5ha6D.js → conversation-icons-DohQL6GI.js} +1 -1
  164. package/dist/client/assets/conversation-model-C4yb6_FA.js +1 -0
  165. package/dist/client/assets/conversation-motion-features-CifSdJtm.js +1 -0
  166. package/dist/client/assets/{copy-CQGYbxdu.js → copy-CwCAivnc.js} +1 -1
  167. package/dist/client/assets/{createLucideIcon-OpA4Amw5.js → createLucideIcon-DlxlBfLC.js} +1 -1
  168. package/dist/client/assets/discover-DoiAJo4Z.js +2 -0
  169. package/dist/client/assets/embed-entry-D1Or9S4d.js +2 -0
  170. package/dist/client/assets/{external-link-CXBytO9o.js → external-link-CnjcXf32.js} +1 -1
  171. package/dist/client/assets/{eye-0PvebX_a.js → eye-So8tNNK6.js} +1 -1
  172. package/dist/client/assets/{file-text-BODxCjcz.js → file-text-i3xTDUjJ.js} +1 -1
  173. package/dist/client/assets/{gestures-CcwOTu8C.js → gestures-CgvAMd6F.js} +1 -1
  174. package/dist/client/assets/{home-moving-signal-CK147hxn.js → home-moving-signal-BdkERL6B.js} +1 -1
  175. package/dist/client/assets/home-now-card-lLkv6nQs.js +1 -0
  176. package/dist/client/assets/{home-now-card-nano-BcjnOU9H.js → home-now-card-nano-CkLHUQ4J.js} +1 -1
  177. package/dist/client/assets/hooks-BPLDD9yu.js +2 -0
  178. package/dist/client/assets/inbox-thread-redesign-B_1ocqaX.css +1 -0
  179. package/dist/client/assets/index-DGoLx89y.js +1 -0
  180. package/dist/client/assets/index-DITWsjFb.css +1 -0
  181. package/dist/client/assets/index-m6dFtY5f.js +1 -0
  182. package/dist/client/assets/index-pY8-Mz7y.js +1 -0
  183. package/dist/client/assets/{index-DMiGbrBt.js → index-sUomXsrf.js} +6 -6
  184. package/dist/client/assets/{inspector-panel-DPoCWxKs.js → inspector-panel-DhXd-YbT.js} +2 -2
  185. package/dist/client/assets/{keyboard-nav-2kv_tGUS.js → keyboard-nav-BhZZ5HEq.js} +1 -1
  186. package/dist/client/assets/knowledge-search-D_bLoYtC.css +1 -0
  187. package/dist/client/assets/{lane-observe-D0rfKDnU.js → lane-observe-DrhKkQ3A.js} +1 -1
  188. package/dist/client/assets/{lane-roster-store-D8x1jac2.js → lane-roster-store-NE15Oe6M.js} +1 -1
  189. package/dist/client/assets/left-B6eawimv.js +1 -0
  190. package/dist/client/assets/left-BL2uBHe0.js +2 -0
  191. package/dist/client/assets/left-BNJguPDG.js +1 -0
  192. package/dist/client/assets/left-BvCtvN0f.js +1 -0
  193. package/dist/client/assets/left-CfBb6bxM.js +1 -0
  194. package/dist/client/assets/left-DTrlBF0h.js +2 -0
  195. package/dist/client/assets/left-agents-DsOHgDCY.js +1 -0
  196. package/dist/client/assets/left-d4hlBBxY.js +1 -0
  197. package/dist/client/assets/left-default-BRCwoCJr.js +1 -0
  198. package/dist/client/assets/left-lanes-DNtoRzoV.js +1 -0
  199. package/dist/client/assets/left-mission-DsTu2X5Y.js +1 -0
  200. package/dist/client/assets/left-plan-CtySjsXC.js +2 -0
  201. package/dist/client/assets/library-CLpgWNJO.js +1 -0
  202. package/dist/client/assets/{loader-circle-CbHjZsz1.js → loader-circle-lWOOKezu.js} +1 -1
  203. package/dist/client/assets/{local-agents--00gLMqr.js → local-agents-C7fDHLVC.js} +1 -1
  204. package/dist/client/assets/{mentions-jSuTGeet.js → mentions-CY_wPZc5.js} +1 -1
  205. package/dist/client/assets/mesh-ops-B1kDjizF.css +1 -0
  206. package/dist/client/assets/mesh-ops-Kn8pCtyJ.js +1 -0
  207. package/dist/client/assets/{mesh-view-store-CWidRbTE.js → mesh-view-store-D14ihwkF.js} +1 -1
  208. package/dist/client/assets/{message-circle-CG-96zts.js → message-circle-C5UZ6fO7.js} +1 -1
  209. package/dist/client/assets/{message-markup-3J9pi3nx.js → message-markup-C8Nx04sP.js} +1 -1
  210. package/dist/client/assets/{message-square-DSaGpjFU.js → message-square-BD-4UUdc.js} +1 -1
  211. package/dist/client/assets/{mission-control-store-BlnEhiCq.js → mission-control-store-xQHVQdm8.js} +1 -1
  212. package/dist/client/assets/{model-CpAxGuis.js → model-IGCUEsMy.js} +1 -1
  213. package/dist/client/assets/{observe-CuLGD9Zp.js → observe-uJfIlIUV.js} +1 -1
  214. package/dist/client/assets/{page-status-DpkedE1F.js → page-status-BymFEFai.js} +1 -1
  215. package/dist/client/assets/paperclip-DL9BXPp2.js +1 -0
  216. package/dist/client/assets/{plus--b1raV_O.js → plus-C9lTjsgd.js} +1 -1
  217. package/dist/client/assets/profile-BqY5tesX.js +1 -0
  218. package/dist/client/assets/{projects-inbox-CHyUFQ6w.js → projects-inbox-DfVmGFFk.js} +1 -1
  219. package/dist/client/assets/{radio-Bz8ZePxj.js → radio-DedMyP8J.js} +1 -1
  220. package/dist/client/assets/{refresh-cw-BBmAnCB7.js → refresh-cw-D8PFyhUa.js} +1 -1
  221. package/dist/client/assets/repo-diff-DyYmQMSA.css +1 -0
  222. package/dist/client/assets/resolve-panes-1xeZMuaw.js +1 -0
  223. package/dist/client/assets/resolve-sidebar-context-PLr32WHN.js +1 -0
  224. package/dist/client/assets/right-1x7HzabC.js +1 -0
  225. package/dist/client/assets/{right-DjRXbnRP.js → right-C1sIsSHR.js} +1 -1
  226. package/dist/client/assets/right-CFzPUzlF.js +1 -0
  227. package/dist/client/assets/right-CRKyeJDk.js +1 -0
  228. package/dist/client/assets/right-CagzkLWg.js +1 -0
  229. package/dist/client/assets/right-CsV149pN.js +1 -0
  230. package/dist/client/assets/right-DITNyG2s.js +1 -0
  231. package/dist/client/assets/right-E3nNcLE3.js +1 -0
  232. package/dist/client/assets/right-eUQvSjd7.js +1 -0
  233. package/dist/client/assets/right-ozp4nM44.js +1 -0
  234. package/dist/client/assets/{rocket-BSNS_rLs.js → rocket-CriBwkHM.js} +1 -1
  235. package/dist/client/assets/router-Dja9_ygK.js +1 -0
  236. package/dist/client/assets/{runtime-picker-Bcl5iIX5.js → runtime-picker-DOZpZOlt.js} +1 -1
  237. package/dist/client/assets/{scope-views-U-ucT9m0.js → scope-views-BF_RvGKU.js} +1 -1
  238. package/dist/client/assets/{scout-voice-CU5c0LGi.js → scout-voice-BZ4KqADJ.js} +1 -1
  239. package/dist/client/assets/{scroll-text-D6Pdnar7.js → scroll-text-BIYf6g6N.js} +1 -1
  240. package/dist/client/assets/{search-CWfZtOt2.js → search-DCT_EvPr.js} +1 -1
  241. package/dist/client/assets/secondaryNavConfig-Drb7wPG4.js +1 -0
  242. package/dist/client/assets/{selection-bridge-16pk1qyG.js → selection-bridge-CJOTyYQs.js} +1 -1
  243. package/dist/client/assets/{send-horizontal-Bg5-QggH.js → send-horizontal-DDwOgEs3.js} +1 -1
  244. package/dist/client/assets/{server-CPp4ZJhZ.js → server-CHZCp3cF.js} +1 -1
  245. package/dist/client/assets/{session-catalog-BmoyVTJ_.js → session-catalog-XhGxCtP-.js} +1 -1
  246. package/dist/client/assets/{session-table-DZcrKoIH.js → session-table-sAVe44a4.js} +1 -1
  247. package/dist/client/assets/{sliders-horizontal-1oW76Xc9.js → sliders-horizontal-B9Nj-Y4J.js} +1 -1
  248. package/dist/client/assets/sparkles-up7pVlX-.js +1 -0
  249. package/dist/client/assets/{sse-CjIkKo46.js → sse-CVoGDiKW.js} +1 -1
  250. package/dist/client/assets/{tail-events-D19uAGe3.js → tail-events-CTipUIli.js} +1 -1
  251. package/dist/client/assets/{terminal-B9AOZQKR.js → terminal-DXQISjZn.js} +1 -1
  252. package/dist/client/assets/{terminal-relay-CWbJ1RCW.js → terminal-relay-B5Sma7fK.js} +1 -1
  253. package/dist/client/assets/{terminal-takeover-B8UeD9OX.js → terminal-takeover-X97KCSJk.js} +1 -1
  254. package/dist/client/assets/{time-DltNTpLl.js → time-Dhsh_2EG.js} +1 -1
  255. package/dist/client/assets/{use-conversation-list-Byab41G6.js → use-conversation-list-B1T6J_qE.js} +1 -1
  256. package/dist/client/assets/{use-fleet-active-asks-BIbQx5AS.js → use-fleet-active-asks-DLofGhhK.js} +1 -1
  257. package/dist/client/assets/use-mesh-ops-items-ByGZk8rU.js +1 -0
  258. package/dist/client/assets/{use-reduced-motion-RRBkmVkk.js → use-reduced-motion-Cvk-HRKg.js} +1 -1
  259. package/dist/client/assets/use-scout-dev-flags-BHvg3G2c.js +1 -0
  260. package/dist/client/assets/{useAgentHoverCard-DMrbBif0.js → useAgentHoverCard-D5e8Qg1z.js} +1 -1
  261. package/dist/client/assets/useContentSecondaryNav-ZfBNi3d4.js +1 -0
  262. package/dist/client/assets/usePierreRuntime-DIVunfX0.js +50 -0
  263. package/dist/client/assets/{wrench-Bkc_0lKF.js → wrench-pEVd8JnN.js} +1 -1
  264. package/dist/client/assets/{x-D3GElQbe.js → x-0XjXwGqq.js} +1 -1
  265. package/dist/client/assets/{xterm-BKR8oAkR.js → xterm-CRLlV1Xp.js} +1 -1
  266. package/dist/client/index.html +2 -2
  267. package/dist/drizzle/0007_lean_venus.sql +26 -0
  268. package/dist/drizzle/0008_luxuriant_ted_forrester.sql +1 -0
  269. package/dist/drizzle/meta/0007_snapshot.json +5767 -0
  270. package/dist/drizzle/meta/0008_snapshot.json +5774 -0
  271. package/dist/drizzle/meta/_journal.json +14 -0
  272. package/dist/main.mjs +27836 -4437
  273. package/dist/node/main.mjs +31770 -12098
  274. package/dist/pairing-runtime-controller.mjs +37653 -16847
  275. package/dist/runtime/base-daemon.mjs +109 -18
  276. package/dist/runtime/broker-daemon.mjs +22018 -2739
  277. package/dist/runtime/broker-process-manager.mjs +122 -12
  278. package/dist/runtime/mesh-discover.mjs +90 -13
  279. package/dist/scout-control-plane-web.mjs +22453 -3299
  280. package/dist/scout-web-server.mjs +22453 -3299
  281. package/dist/statusline.mjs +2 -0
  282. package/package.json +3 -1
  283. package/dist/client/assets/ActivityScreen-Cu_1V4bq.js +0 -1
  284. package/dist/client/assets/AgentConfigurationScreen-BqfOz90D.js +0 -1
  285. package/dist/client/assets/AgentDefinitionsWorkspace-CUpUrY57.js +0 -1
  286. package/dist/client/assets/AgentFloorView-8LoAEBwS.js +0 -1
  287. package/dist/client/assets/AgentInfoScreen-DZs2_ibL.js +0 -1
  288. package/dist/client/assets/AgentLanesEmbedScreen-W3qs022h.js +0 -1
  289. package/dist/client/assets/AgentLanesView-B9vuEEmZ.js +0 -2
  290. package/dist/client/assets/AgentsConsole-BgiYP2wR.js +0 -1
  291. package/dist/client/assets/AgentsScreen-DBi8x4MB.js +0 -1
  292. package/dist/client/assets/AgentsSubnav-DIEO4NPx.js +0 -1
  293. package/dist/client/assets/BackToPicker-BRvfostO.js +0 -1
  294. package/dist/client/assets/CodeDiffPane-DDPt6KPh.js +0 -1
  295. package/dist/client/assets/CodeScreen-BxCrpRHd.js +0 -1
  296. package/dist/client/assets/ConversationFeedRows-B_gPxcqA.js +0 -1
  297. package/dist/client/assets/ConversationHeader-DE3FC0m-.js +0 -1
  298. package/dist/client/assets/ConversationPanels-DLek4H6A.js +0 -2
  299. package/dist/client/assets/ConversationScreen-BDRhx-RU.js +0 -1
  300. package/dist/client/assets/ConversationScreen-C9yMAMYF.css +0 -1
  301. package/dist/client/assets/ConversationStatus-BwVLiiO4.js +0 -1
  302. package/dist/client/assets/FlightObserveScreen-6RpZYwVz.js +0 -1
  303. package/dist/client/assets/HarnessesScreen-CznAImej.js +0 -1
  304. package/dist/client/assets/KnowledgeSearchInspector-Dgdkfvvz.js +0 -1
  305. package/dist/client/assets/KnowledgeSearchScreen-DJDGGaqC.js +0 -1
  306. package/dist/client/assets/LaneTraceDetailSheet-D1CspRbl.js +0 -1
  307. package/dist/client/assets/MeshScreen-DFgevn8N.js +0 -1
  308. package/dist/client/assets/MessagesScreen-C8YKW10Y.js +0 -1
  309. package/dist/client/assets/MissionLeftAgentRow-BpZWntfl.js +0 -1
  310. package/dist/client/assets/NewChatComposer-Cs6OsxK6.js +0 -19
  311. package/dist/client/assets/ObserveEmbedScreen-y2EpuqRZ.js +0 -2
  312. package/dist/client/assets/OpenScoutAppShell-C_URc8sV.js +0 -87
  313. package/dist/client/assets/OpsAgentsView-UN7iOscs.js +0 -1
  314. package/dist/client/assets/OpsScreen-Buf3LKjb.js +0 -1
  315. package/dist/client/assets/OpsSubnav-DsuXzHah.js +0 -1
  316. package/dist/client/assets/ProjectAgentProfile-DJusrAV-.js +0 -1
  317. package/dist/client/assets/ProjectAgentProfileHero-BFwNJo_N.js +0 -1
  318. package/dist/client/assets/ProjectsInbox-GhVMxOhw.js +0 -2
  319. package/dist/client/assets/ProjectsScreen-eNUBy4YU.js +0 -1
  320. package/dist/client/assets/ProjectsThreadAside-CoBgnHmr.js +0 -1
  321. package/dist/client/assets/Provider-C7UKGHQy.js +0 -1
  322. package/dist/client/assets/RawSessionsTable-DL8y_eEy.js +0 -1
  323. package/dist/client/assets/RealtimeVoiceScreen-ffS-39zy.js +0 -1
  324. package/dist/client/assets/RepoDiffViewer-D_exm6xK.js +0 -7
  325. package/dist/client/assets/RepoDiffViewerLazy-BPgF92Bg.js +0 -2
  326. package/dist/client/assets/SessionEmbedScreen-BVC7yvWF.js +0 -1
  327. package/dist/client/assets/SessionObserve-BpggNO_M.css +0 -1
  328. package/dist/client/assets/SessionObserve-yfXFafp8.js +0 -12
  329. package/dist/client/assets/SessionRefScreen-DRgJu7Jo.js +0 -1
  330. package/dist/client/assets/SessionsScreen-D6XUsZfA.js +0 -1
  331. package/dist/client/assets/SettingsDrawer-CmJt72ww.css +0 -1
  332. package/dist/client/assets/SettingsScreen-Cy8z-EuR.js +0 -1
  333. package/dist/client/assets/SpriteAvatar-DyaGuhik.js +0 -1
  334. package/dist/client/assets/Terminal-CqvGbjXU.js +0 -1
  335. package/dist/client/assets/TerminalEmbedScreen-DuZZFFzW.js +0 -1
  336. package/dist/client/assets/agent-lane-card-Dm7YWoew.css +0 -1
  337. package/dist/client/assets/content-BDt9VBPk.js +0 -1
  338. package/dist/client/assets/content-BIXf4cKR.js +0 -1
  339. package/dist/client/assets/content-BLm0NBJM.js +0 -1
  340. package/dist/client/assets/content-C5UbLsDF.js +0 -1
  341. package/dist/client/assets/content-CR3vdrYY.js +0 -1
  342. package/dist/client/assets/content-CSPVmo2s.js +0 -1
  343. package/dist/client/assets/content-C_FGqx1X.js +0 -1
  344. package/dist/client/assets/content-CvlVUOG8.js +0 -1
  345. package/dist/client/assets/content-DTpQsomG.js +0 -1
  346. package/dist/client/assets/content-DikVsqLf.js +0 -1
  347. package/dist/client/assets/content-DlUe5Ono.js +0 -1
  348. package/dist/client/assets/content-GIBv_55n.js +0 -1
  349. package/dist/client/assets/content-Q2oclDzi.js +0 -1
  350. package/dist/client/assets/conversation-model-B47vYmWN.js +0 -1
  351. package/dist/client/assets/conversation-motion-features-BdAONVls.js +0 -1
  352. package/dist/client/assets/discover-C1YwpBDE.js +0 -2
  353. package/dist/client/assets/embed-entry-BAcGL3g9.js +0 -2
  354. package/dist/client/assets/home-now-card-BgvNWuea.js +0 -1
  355. package/dist/client/assets/hooks-B6y_O2FB.js +0 -2
  356. package/dist/client/assets/inbox-thread-redesign-Bz4FjWzr.css +0 -1
  357. package/dist/client/assets/index-BcuhqXLe.js +0 -1
  358. package/dist/client/assets/index-CJXzfjo9.js +0 -1
  359. package/dist/client/assets/index-DQPvraRS.js +0 -1
  360. package/dist/client/assets/index-DxGoC5l5.css +0 -1
  361. package/dist/client/assets/knowledge-search-CVxQwxPn.js +0 -1
  362. package/dist/client/assets/knowledge-search-DjrQdiiW.css +0 -1
  363. package/dist/client/assets/left-C--GiIh8.js +0 -2
  364. package/dist/client/assets/left-Cj7Rt89X.js +0 -1
  365. package/dist/client/assets/left-CpNEtFEg.js +0 -1
  366. package/dist/client/assets/left-CzXAuK_t.js +0 -2
  367. package/dist/client/assets/left-agents-Bo9sO1by.js +0 -1
  368. package/dist/client/assets/left-bN4PCAXa.js +0 -1
  369. package/dist/client/assets/left-default-DV9GdvYi.js +0 -1
  370. package/dist/client/assets/left-jYYGAOYD.js +0 -1
  371. package/dist/client/assets/left-lanes-D0l_Co7V.js +0 -1
  372. package/dist/client/assets/left-mission-Ci7zREkQ.js +0 -1
  373. package/dist/client/assets/left-plan-D4U1uflW.js +0 -2
  374. package/dist/client/assets/library-D-RxGiCw.js +0 -1
  375. package/dist/client/assets/profile-CVRziEDA.js +0 -1
  376. package/dist/client/assets/repo-diff-C9Qs-bEn.css +0 -1
  377. package/dist/client/assets/resolve-panes-r9B3mpW7.js +0 -1
  378. package/dist/client/assets/resolve-sidebar-context-DcG8xGaB.js +0 -1
  379. package/dist/client/assets/right-BHeiIaty.js +0 -1
  380. package/dist/client/assets/right-BkgKo9VT.js +0 -1
  381. package/dist/client/assets/right-BpEU5jWE.js +0 -1
  382. package/dist/client/assets/right-CRZXoy-X.js +0 -1
  383. package/dist/client/assets/right-ChF_pbPy.js +0 -1
  384. package/dist/client/assets/right-DMoUT3KN.js +0 -1
  385. package/dist/client/assets/right-T4Ue6EqM.js +0 -1
  386. package/dist/client/assets/right-wzrLXKur.js +0 -1
  387. package/dist/client/assets/router-Bq5dwf78.js +0 -1
  388. package/dist/client/assets/secondaryNavConfig-DqUIp0Es.js +0 -1
  389. package/dist/client/assets/sparkles-ClfRJQ6w.js +0 -1
  390. package/dist/client/assets/useContentSecondaryNav-DMl1WNm7.js +0 -1
  391. package/dist/client/assets/usePierreRuntime-wC-yMtBb.js +0 -50
@@ -1 +0,0 @@
1
- import{j as t}from"./index-DMiGbrBt.js";import{u as h}from"./Provider-C7UKGHQy.js";import{o as j}from"./openAgent-Bjt57GdM.js";import{n as v,i as u,c as d}from"./colors-BtO5_zlx.js";import{A as b}from"./AgentAvatar-D90c1Rzk.js";import{t as g}from"./time-DltNTpLl.js";import"./router-Bq5dwf78.js";import"./terminal-sessions-D5CIR2OL.js";import"./api-h5zurxmi.js";import"./sse-CjIkKo46.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-bARZqTzD.js";import"./DocumentFocusViewer-BeVwwl26.js";import"./createLucideIcon-OpA4Amw5.js";import"./TextDocumentSurface-BpAw4eQS.js";/* empty css */import"./file-text-BODxCjcz.js";import"./x-D3GElQbe.js";import"./chevron-right-XiIHsk4m.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-2kv_tGUS.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./NewChatComposer-Cs6OsxK6.js";import"./runtime-picker-Bcl5iIX5.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-CbHjZsz1.js";import"./index-CJXzfjo9.js";import"./HarnessMark-Cbv3Ib0c.js";import"./conversation-model-B47vYmWN.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-BGk5qoEw.js";import"./search-CWfZtOt2.js";import"./openContent-C6XO6kr5.js";import"./SpriteAvatar-DyaGuhik.js";function mt(){const{agents:r,agentsLoaded:s,apiConnection:o,navigate:a,route:f}=h(),n=e=>j(a,e,{returnTo:f});if(!s)return t.jsx("div",{className:"flex h-full flex-col justify-center","aria-busy":"true",children:t.jsxs("div",{className:"base-rail-loading",role:"status","aria-label":"Loading agent roster",children:[t.jsx("span",{"aria-hidden":"true"}),t.jsx("span",{"aria-hidden":"true"}),t.jsx("span",{"aria-hidden":"true"}),t.jsx("span",{"aria-hidden":"true"})]})});if(r.length===0)return t.jsxs("div",{className:"flex h-full flex-col items-center justify-center px-4 text-center font-mono text-sm leading-relaxed text-[var(--scout-chrome-ink-faint)]",children:[t.jsx("div",{className:"mb-1 uppercase tracking-[0.15em]",children:o.status==="offline"?"Roster unavailable":"No agents"}),t.jsx("div",{children:o.status==="offline"?o.message:"Connect an agent to see your roster here."})]});const i=r.filter(e=>{const x=v(e.state,e);return x==="in_turn"||x==="in_flight"}),l=r.filter(e=>u(e.state,e)&&!i.includes(e)),m=r.filter(e=>!u(e.state,e));return t.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-sm",children:[i.length>0&&t.jsx(c,{label:"In progress",count:i.length,children:i.map(e=>t.jsx(p,{agent:e,onOpen:n,subLabel:d(e.state,e)},e.id))}),l.length>0&&t.jsx(c,{label:"Callable",count:l.length,children:l.map(e=>t.jsx(p,{agent:e,onOpen:n},e.id))}),m.length>0&&t.jsx(c,{label:"Blocked",count:m.length,children:m.map(e=>t.jsx(p,{agent:e,onOpen:n,subLabel:d(e.state,e),dim:!0},e.id))})]})}function c({label:r,count:s,children:o}){return t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("div",{className:"flex items-baseline justify-between mb-1.5",children:[t.jsx("span",{className:"text-2xs font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:r}),t.jsx("span",{className:"text-2xs font-mono tabular-nums text-[var(--scout-chrome-ink-ghost)]",children:s})]}),t.jsx("div",{className:"flex flex-col gap-0.5",children:o})]})}function p({agent:r,onOpen:s,subLabel:o,dim:a}){return t.jsxs("button",{onClick:()=>s(r),className:`group flex items-center gap-2.5 px-2 py-1.5 rounded-sm text-left transition-colors ${a?"opacity-60 hover:opacity-100 hover:bg-[var(--scout-chrome-hover)]":"hover:bg-[var(--scout-chrome-hover)]"}`,children:[t.jsx(b,{agent:r,placement:"row"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"truncate font-medium text-[var(--scout-chrome-ink)]",children:r.name}),o?t.jsx("span",{className:"truncate text-xs text-[var(--scout-chrome-ink-faint)]",children:o}):r.updatedAt?t.jsx("span",{className:"truncate text-xs text-[var(--scout-chrome-ink-ghost)]",children:g(r.updatedAt)}):null]})]})}export{mt as HomeRight};
@@ -1 +0,0 @@
1
- import{j as t,r as h}from"./index-DMiGbrBt.js";import{u as Z}from"./Provider-C7UKGHQy.js";import{o as ee}from"./openAgent-Bjt57GdM.js";import{o as F}from"./openContent-C6XO6kr5.js";import{i as pe,s as te,c as se,n as D,d as X}from"./colors-BtO5_zlx.js";import{t as O,c as ne}from"./time-DltNTpLl.js";import{f as oe}from"./text-DsBWV_4k.js";import{a as R}from"./api-h5zurxmi.js";import{u as L}from"./sse-CjIkKo46.js";import{r as E}from"./terminal-relay-CWbJ1RCW.js";import{q as re}from"./terminal-takeover-B8UeD9OX.js";import{r as fe,s as ve,a as be,b as je,c as ke}from"./session-catalog-BmoyVTJ_.js";import{p as ae}from"./model-Co0zkMIc.js";import{u as ge}from"./ContextMenu-bARZqTzD.js";import{A as Ne}from"./AgentAvatar-D90c1Rzk.js";import{A as we}from"./AgentLiveActions-DBtnD0qE.js";import{T as H}from"./TmuxPeek-m1osv33Q.js";import"./router-Bq5dwf78.js";import"./terminal-sessions-D5CIR2OL.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./DocumentFocusViewer-BeVwwl26.js";import"./createLucideIcon-OpA4Amw5.js";import"./TextDocumentSurface-BpAw4eQS.js";/* empty css */import"./file-text-BODxCjcz.js";import"./x-D3GElQbe.js";import"./chevron-right-XiIHsk4m.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-2kv_tGUS.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./NewChatComposer-Cs6OsxK6.js";import"./runtime-picker-Bcl5iIX5.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-CbHjZsz1.js";import"./index-CJXzfjo9.js";import"./HarnessMark-Cbv3Ib0c.js";import"./conversation-model-B47vYmWN.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./chevron-down-BGk5qoEw.js";import"./search-CWfZtOt2.js";import"./index-BWHgHrtv.js";import"./SpriteAvatar-DyaGuhik.js";import"./eye-0PvebX_a.js";import"./terminal-B9AOZQKR.js";/* empty css */import"./refresh-cw-BBmAnCB7.js";const ye=new Intl.NumberFormat("en-US"),Ce=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1});function M(e){return typeof e!="number"||!Number.isFinite(e)?"-":Math.abs(e)<1e3?ye.format(e):Ce.format(e).toLowerCase()}function Se(e){if(!Number.isFinite(e)||e<=0)return"0s";if(e<60)return`${Math.round(e)}s`;const s=Math.round(e),a=Math.floor(s/3600),r=Math.floor(s%3600/60),i=s%60;return a>0?`${a}h ${r}m`:r>=10||i===0?`${r}m`:`${r}m ${i}s`}function Ie(e){return e.replace(/\.local$/i,"").replace(/-local-openscout$/i,"")}function z(e){const s=e?.trim();return s?s.toLowerCase()==="a2a"?"A2A":s:null}function Y(e){const s=e?.trim();return s?s==="claude_stream_json"?"Claude stream-json worker":s==="codex_app_server"?"Codex app server":s==="pi_rpc"?"Pi RPC":s==="tmux"?"tmux terminal":s:null}function ie(e){return!!(e.providerName||z(e.protocol)||(e.skills?.length??0)>0)}async function Ae(e){await R("/api/local-path/reveal",{method:"POST",body:JSON.stringify({path:e.path,agentId:e.agentId,...e.basePath?{basePath:e.basePath}:{},...e.sessionId?{sessionId:e.sessionId}:{}})})}function ce(e){Ae(e).catch(s=>{console.warn("Failed to reveal local path",s)})}function Ot(){const{route:e,agents:s,navigate:a}=Z();if(e.view==="agent-info")return t.jsx(Re,{conversationId:e.conversationId,agents:s,navigate:a,route:e});if(e.view==="agents-v2"){if(!e.agentId)return null;const r=s.find(i=>i.id===e.agentId)??null;return r?t.jsx(le,{agent:r,agents:s,navigate:a,route:e,observeMode:e.tab==="observe",showStaticIdentity:!1}):null}return null}function Re({conversationId:e,agents:s,navigate:a,route:r}){const[i,m]=h.useState(null),[x,v]=h.useState(null),[p,f]=h.useState(!1),n=h.useCallback(async()=>{const o=await R(`/api/session/${encodeURIComponent(e)}`).catch(()=>null);m(o),f(!0)},[e]);h.useEffect(()=>{f(!1),n()},[n]),L(()=>{n()});const l=i?.agentId??null;h.useEffect(()=>{if(!l||s.some(c=>c.id===l)){v(null);return}let o=!1;return R(`/api/agents/${encodeURIComponent(l)}`).then(c=>{o||v(c)}).catch(()=>{o||v(null)}),()=>{o=!0}},[s,l]);const u=h.useMemo(()=>l?s.find(o=>o.id===l)??(x?.id===l?x:null):null,[x,s,l]);return p?u?t.jsx(le,{agent:u,agents:s,navigate:a,route:r,observeMode:!1}):t.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-sm",children:[t.jsx(w,{label:"Conversation",value:e}),t.jsx("div",{className:"mt-2 text-xs font-mono uppercase tracking-[0.15em] leading-relaxed text-[var(--scout-chrome-ink-ghost)]",children:"No live agent registration matches this profile."})]}):t.jsx("div",{className:"flex h-full items-center justify-center p-4 text-center text-sm italic text-[var(--scout-chrome-ink-faint)]",children:"Loading agent context..."})}function le({agent:e,agents:s,navigate:a,route:r,observeMode:i,showStaticIdentity:m=!0}){const x=pe(e.state),[v,p]=h.useState(null),[f,n]=h.useState(null),[l,u]=h.useState(null),o=e.skills??[],c=z(e.protocol),j=ie(e),y=h.useCallback(async()=>{const[k,xe,he]=await Promise.all([R("/api/fleet").catch(()=>null),R(`/api/agents/${encodeURIComponent(e.id)}/session-catalog`).catch(()=>null),R(`/api/agents/${encodeURIComponent(e.id)}/observe`).catch(()=>null)]);k&&p(k),n(xe),u(he)},[e.id]);h.useEffect(()=>{y()},[y]),h.useEffect(()=>{n(null),u(null)},[e.id]),L(()=>{y()});const{focusedSession:d,focusSession:C}=Z(),N=fe(e,f),S=h.useMemo(()=>ve(f?.sessions??[],N),[f?.sessions,N]),$=r.view==="agents-v2"&&r.agentId===e.id?r.sessionId:null,I=be(e.id,d,N,S,$),P=je($,S);h.useEffect(()=>{P&&(d?.agentId===e.id&&d.sessionId===P||C(e.id,P))},[e.id,d?.agentId,d?.sessionId,C,P]);const b=S.find(k=>k.id===I)??null,_=!!(b&&N&&b.id===N),G=l?.sessionId?.trim()||l?.data.metadata?.session?.externalSessionId?.trim()||l?.data.metadata?.session?.threadId?.trim()||null,T=b&&_&&G?G:b?.id??null,U=b&&T&&T!==b.id?b.id:null,W=b?ke(e,f,b,_):{canObserve:!1,canTakeover:!1},me=()=>F(a,{view:"terminal",agentId:e.id,mode:"observe"},{returnTo:r}),B=()=>F(a,{view:"terminal",agentId:e.id,mode:"takeover"},{returnTo:r}),ue=()=>{if(E(e)){B();return}const k=f?.resumeCommand;if(k){re({command:k,cwd:f?.resumeCwd,agentId:e.id}).then(()=>B());return}B()};return m?t.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-sm",children:[t.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--scout-chrome-border-soft)] pb-3",children:[t.jsx(Ne,{agent:e,placement:"inspector"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"truncate text-lg text-[var(--scout-chrome-ink-strong)]",children:e.name}),e.handle&&t.jsxs("span",{className:"text-xs font-mono text-[var(--scout-chrome-ink-faint)]",children:["@",e.handle]})]})]}),t.jsx(we,{agent:e,catalog:f,navigate:a,returnTo:r,variant:"compact"}),E(e)?.backend==="tmux"&&t.jsx(H,{agentId:e.id,lines:44,columns:132}),t.jsxs(g,{label:"State",children:[t.jsxs("div",{className:"flex items-baseline gap-2",children:[t.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:te(e.state),opacity:x?1:.4}}),t.jsx("span",{className:"text-md capitalize text-[var(--scout-chrome-ink)]",children:se(e.state)})]}),e.updatedAt&&t.jsxs("div",{className:"mt-1 text-xs font-mono text-[var(--scout-chrome-ink-faint)]",children:["Updated ",O(e.updatedAt)]})]}),t.jsx(g,{label:"Presence",children:t.jsx(_e,{focusAgent:e,agents:s,onOpenAgent:k=>ee(a,k,{returnTo:r})})}),i&&t.jsx(J,{agentId:e.id}),v&&t.jsx(V,{asks:v.activeAsks,agentId:e.id,navigate:a}),t.jsxs(g,{label:"Identity",children:[e.providerName&&t.jsx(w,{label:"Provider",value:e.providerName}),c&&t.jsx(w,{label:"Protocol",value:c}),!j&&t.jsx(w,{label:"Class",value:e.agentClass}),!j&&e.role&&t.jsx(w,{label:"Role",value:oe(e.role)??e.role}),!j&&e.harness&&t.jsx(w,{label:"Harness",value:e.harness}),!j&&e.transport&&t.jsx(w,{label:"Transport",value:Y(e.transport)??e.transport}),(e.homeNodeName||e.homeNodeId)&&t.jsx(w,{label:"Host",value:Ie(e.homeNodeName??e.homeNodeId??"")})]}),o.length>0&&t.jsx(g,{label:`Skills · ${o.length}`,children:t.jsx("div",{className:"flex flex-wrap gap-1",children:o.map(k=>t.jsx("span",{className:"rounded-sm bg-[var(--scout-chrome-hover)] px-1.5 py-0.5 text-xs font-mono text-[var(--scout-chrome-ink-soft)]",children:k},k))})}),(e.project||e.branch||e.cwd)&&t.jsxs(g,{label:"Project",children:[e.project&&t.jsx(w,{label:"Name",value:e.project}),e.branch&&t.jsx(w,{label:"Branch",value:e.branch}),e.cwd&&t.jsx(w,{label:"Cwd",value:e.cwd})]}),e.capabilities.length>0&&t.jsx(g,{label:`Capabilities · ${e.capabilities.length}`,children:t.jsx("div",{className:"flex flex-wrap gap-1",children:e.capabilities.map(k=>t.jsx("span",{className:"rounded-sm bg-[var(--scout-chrome-hover)] px-1.5 py-0.5 text-xs font-mono text-[var(--scout-chrome-ink-soft)]",children:k},k))})}),t.jsx(Me,{agent:e,catalog:f,navigate:a,returnTo:r})]}):t.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-sm",children:[b&&t.jsxs(g,{label:"Session",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[t.jsx("span",{className:"truncate font-mono text-md text-[var(--scout-chrome-ink)]",title:T??b.id,children:de(T??b.id)}),t.jsx("span",{className:"shrink-0 font-mono text-2xs uppercase tracking-[0.12em]",style:{color:_?"var(--accent)":"var(--scout-chrome-ink-faint)"},children:_?"now":b.endedAt?`ended · ${O(b.endedAt)||"recent"}`:O(b.startedAt)||"recent"})]}),b.cwd&&t.jsx("div",{className:"mt-1 truncate font-mono text-2xs text-[var(--scout-chrome-ink-ghost)]",title:b.cwd,children:b.cwd}),T&&t.jsxs("div",{className:"mt-1 break-all font-mono text-2xs leading-snug text-[var(--scout-chrome-ink-faint)]",title:T,children:[t.jsx("span",{className:"uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-ghost)]",children:"id"})," ",T]}),U&&t.jsxs("div",{className:"mt-0.5 truncate font-mono text-2xs text-[var(--scout-chrome-ink-ghost)]",title:U,children:["profile ",U]}),t.jsx("div",{className:"mt-2.5 flex flex-col gap-1.5",children:t.jsxs(Te,{label:"Terminal",children:[t.jsx(q,{onClick:me,disabled:!W.canObserve,title:W.canObserve?"Watch the live terminal, read-only":"No live terminal to observe",children:"Observe"}),t.jsx(q,{onClick:ue,disabled:!W.canTakeover,title:W.canTakeover?"Grab the keyboard and drive it":"Can't take over this session",children:"Take over"})]})})]}),!i&&b&&t.jsx(Ee,{agentId:e.id,navigate:a,cwd:b.cwd??e.cwd,route:r}),E(e)?.backend==="tmux"&&t.jsx(H,{agentId:e.id,lines:44,columns:132}),t.jsx(g,{label:"Runtime",children:t.jsx($e,{agent:e})}),i&&t.jsx(J,{agentId:e.id}),v&&t.jsx(V,{asks:v.activeAsks,agentId:e.id,navigate:a})]})}function $e({agent:e}){const s=[],a=(m,x)=>{x&&x.trim()&&s.push({label:m,value:x.trim()})},r=z(e.protocol);return ie(e)?a("Protocol",r):(a("Role",oe(e.role)),a("Class",e.agentClass)),s.length===0?null:t.jsx("div",{className:"grid grid-cols-2 gap-x-3 gap-y-2",children:s.map(m=>t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-mono text-3xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:m.label}),t.jsx("div",{className:"truncate font-mono text-sm text-[var(--scout-chrome-ink)]",children:m.value})]},m.label))})}function Te({label:e,children:s}){return t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"w-[56px] shrink-0 font-mono text-3xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:e}),t.jsx("div",{className:"flex gap-1.5",children:s})]})}function q({onClick:e,disabled:s,title:a,children:r}){return t.jsx("button",{type:"button",onClick:e,disabled:s,title:a,className:"rounded-[4px] border border-[var(--scout-chrome-border-soft)] px-2.5 py-1 font-mono text-3xs uppercase tracking-[0.08em] text-[var(--scout-chrome-ink-soft)] transition-colors hover:bg-[var(--scout-chrome-active)] hover:text-[var(--scout-chrome-ink)] disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-[var(--scout-chrome-ink-soft)]",children:r})}function Me({agent:e,catalog:s,navigate:a,returnTo:r}){const i=ge(),m=E(e),x=s?.activeSessionId??(m?e.harnessSessionId??m.sessionName:null),p=h.useMemo(()=>Pe(e,s,x),[e,s,x]).filter(c=>c.id===x||!c.endedAt),f=p.slice(0,5);if(f.length===0)return null;const n=c=>F(a,{view:"terminal",agentId:e.id,mode:c},{returnTo:r}),l=()=>{if(m){n("takeover");return}s?.resumeCommand&&re({command:s.resumeCommand,cwd:s.resumeCwd,agentId:e.id}).then(()=>n("takeover"))},u=c=>F(a,{view:"sessions",sessionId:c},{returnTo:r}),o=(c,j,y)=>{const d=[];return j&&d.push({kind:"action",label:"Observe in terminal",onSelect:()=>n("observe")}),y&&d.push({kind:"action",label:"Takeover terminal",onSelect:l}),d.length>0&&d.push({kind:"separator"}),d.push({kind:"action",label:"Open session detail",onSelect:()=>u(c.id)}),d.push({kind:"action",label:"Open agent profile",onSelect:()=>ee(a,e,{returnTo:r})}),d};return t.jsx(g,{label:`Running sessions · ${p.length}`,children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.map(c=>{const j=c.id===x,y=j&&!!m,d=j&&(!!m||!!s?.resumeCommand),C=O(c.startedAt)||"recent",N=Y(c.transport)??c.harness??Y(e.transport)??e.harness??"session",S=j?C:c.endedAt?`${O(c.endedAt)||C} ended`:N,$=o(c,y,d);return t.jsxs("div",{onContextMenu:I=>i(I,$),className:`rounded border px-2 py-1.5 transition-colors ${j?"border-[color-mix(in_srgb,var(--accent)_40%,transparent)] bg-[color-mix(in_srgb,var(--accent)_8%,transparent)]":"border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)]"}`,children:[t.jsxs("button",{type:"button",title:y?`Observe terminal ${c.id}`:`Open session ${c.id}`,onClick:()=>y?n("observe"):u(c.id),className:"flex w-full items-center justify-between gap-2 bg-transparent p-0 text-left",children:[t.jsxs("span",{className:"flex min-w-0 flex-col",children:[t.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[j&&t.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--accent)]"}),t.jsx("span",{className:"truncate font-mono text-xs text-[var(--scout-chrome-ink)]",children:de(c.id)}),t.jsx("span",{className:"shrink-0 rounded-sm bg-[var(--scout-chrome-hover)] px-1 py-0.5 font-mono text-3xs uppercase tracking-[0.08em] text-[var(--scout-chrome-ink-faint)]",children:N})]}),t.jsx("span",{className:"mt-0.5 truncate font-mono text-2xs text-[var(--scout-chrome-ink-faint)]",children:c.cwd?ae(c.cwd):"workspace"})]}),t.jsxs("span",{className:"flex shrink-0 flex-col items-end",children:[t.jsx("span",{className:"font-mono text-2xs uppercase tracking-[0.12em] text-[var(--accent)]",children:j?"active":"running"}),t.jsx("span",{className:"mt-0.5 max-w-[78px] truncate font-mono text-2xs text-[var(--scout-chrome-ink-ghost)]",children:S})]})]}),t.jsx("button",{type:"button",title:"Session actions",onClick:I=>i(I,$),className:"mt-1.5 h-5 rounded border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] px-1.5 font-mono text-3xs uppercase tracking-[0.08em] text-[var(--scout-chrome-ink-faint)] hover:bg-[var(--scout-chrome-active)] hover:text-[var(--scout-chrome-ink)]",children:"..."})]},c.id)}),p.length>f.length&&t.jsxs("div",{className:"px-1 pt-0.5 font-mono text-2xs text-[var(--scout-chrome-ink-ghost)]",children:[p.length-f.length," more running"]})]})})}function Pe(e,s,a){const r=[...s?.sessions??[]],i=E(e);return i&&a&&!r.some(m=>m.id===a)&&r.unshift({id:a,startedAt:e.createdAt??e.updatedAt??Date.now(),cwd:e.cwd??e.projectRoot??".",...e.harness?{harness:e.harness}:{},transport:i.backend,model:e.model}),r.sort((m,x)=>{const v=m.endedAt??m.startedAt,p=x.endedAt??x.startedAt;return ne(v,p)})}function de(e){const s=e.replace(/^session[_:-]?/i,"");return s.length>10?s.slice(0,8):s}function J({agentId:e}){const[s,a]=h.useState(null),r=h.useCallback(async()=>{const i=await R(`/api/agents/${encodeURIComponent(e)}/observe`).catch(()=>null);a(i)},[e]);return h.useEffect(()=>{r()},[r]),L(()=>{r()}),s?.data?t.jsx(Oe,{agentId:e,data:s.data,sessionId:s.sessionId}):t.jsx(g,{label:"Trace",children:t.jsx("div",{className:"text-xs leading-relaxed text-[var(--scout-chrome-ink-faint)]",children:"Resolving session trace."})})}function Oe({agentId:e,data:s,sessionId:a}){const r=s.metadata?.session,i=s.events,m=s.files,x=i.filter(o=>o.kind==="tool").length,v=i.filter(o=>o.kind==="think").length,p=i.filter(o=>o.kind==="ask").length,f=i.filter(o=>o.kind==="tool"&&o.tool==="read").length,n=i.filter(o=>o.kind==="tool"&&(o.tool==="edit"||o.tool==="write")).length,l=i.length>0?i[i.length-1].t:0,u=r?.threadPath;return t.jsxs(t.Fragment,{children:[t.jsxs(g,{label:"Session",children:[a&&t.jsx(w,{label:"Active",value:a}),u&&t.jsx(Q,{label:"Source",path:u,basePath:r?.cwd??null,value:ae(u),agentId:e,sessionId:a}),r?.cwd&&t.jsx(Q,{label:"Workspace",path:r.cwd,value:r.cwd,agentId:e,sessionId:a})]}),t.jsx(g,{label:"Trace stats",children:t.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[t.jsx(A,{label:"Turns",value:M(r?.turnCount)}),t.jsx(A,{label:"Tools",value:M(x)}),t.jsx(A,{label:"Thinks",value:M(v)}),t.jsx(A,{label:"Requests",value:M(p)}),t.jsx(A,{label:"Reads",value:M(f)}),t.jsx(A,{label:"Edits",value:M(n)}),t.jsx(A,{label:"Files",value:M(m.length)}),t.jsx(A,{label:"Window",value:Se(l)})]})}),m.length>0&&t.jsx(g,{label:`Files touched · ${m.length}`,children:t.jsx("div",{className:"flex flex-col gap-1",children:m.slice(0,8).map(o=>t.jsxs("button",{type:"button",title:o.path,onClick:()=>ce({path:o.path,basePath:r?.cwd??null,agentId:e,sessionId:a}),className:"flex items-center justify-between gap-2 rounded border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] px-2 py-1 text-left hover:border-[var(--accent)]",children:[t.jsx("span",{className:"min-w-0 truncate font-mono text-xs text-[var(--scout-chrome-ink-soft)]",children:o.path}),t.jsxs("span",{className:"shrink-0 font-mono text-2xs text-[var(--scout-chrome-ink-faint)]",children:["x",o.touches]})]},o.path))})})]})}function K(e,s){return e?.view==="agents-v2"?{...e,view:"agents-v2",agentId:s,tab:"observe"}:{view:"agents-v2",agentId:s,tab:"observe"}}function Ee({agentId:e,navigate:s,cwd:a,route:r}){const[i,m]=h.useState(null),x=h.useCallback(async()=>{const d=await R(`/api/agents/${encodeURIComponent(e)}/observe`).catch(()=>null);m(d)},[e]);h.useEffect(()=>{x()},[x]),L(()=>{x()});const v=i?.data;if(!v||v.files.length===0)return null;const p=v.files,n=[...p].sort((d,C)=>{const N=d.state==="read"?0:1,S=C.state==="read"?0:1;return N!==S?S-N:C.touches-d.touches}).slice(0,6),l=p.length-n.length,u=p.filter(d=>d.state!=="read").length,o=v.metadata?.session?.cwd??a??null,c=i.sessionId??v.metadata?.session?.externalSessionId??void 0,j=()=>s(o?{view:"repo-diff",path:o,agentId:e,include:"changed",...c?{sessionId:c}:{}}:K(r,e)),y=()=>s(o?{view:"repo-diff",path:o}:K(r,e));return t.jsxs(g,{label:"Files changed",children:[t.jsxs("div",{className:"mb-1.5 flex items-baseline justify-between font-mono text-3xs uppercase tracking-[0.14em] text-[var(--scout-chrome-ink-faint)]",children:[t.jsx("span",{children:u>0?`${u} changed`:"touched"}),t.jsx("span",{className:"tabular-nums",children:p.length})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[n.map(d=>{const C=d.path.replace(/\/+$/,"").split("/"),N=C.pop()??d.path,S=C.pop(),$=S?`${S}/`:"",I=d.state!=="read",P=d.state==="created"?"+":d.state==="modified"?"~":"·";return t.jsxs("div",{className:"flex items-baseline justify-between gap-2 font-mono text-xs leading-tight",title:`${d.path} · ${d.state}`,children:[t.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[t.jsx("span",{className:"flex-none tabular-nums",style:{color:I?"var(--accent)":"var(--scout-chrome-ink-ghost)"},children:P}),t.jsxs("span",{className:"flex min-w-0 items-baseline",children:[t.jsx("span",{className:"truncate text-[var(--scout-chrome-ink-ghost)]",children:$}),t.jsx("span",{className:"flex-none",style:{color:I?"var(--scout-chrome-ink-soft)":"var(--scout-chrome-ink-faint)"},children:N})]})]}),t.jsxs("span",{className:"shrink-0 tabular-nums text-2xs text-[var(--scout-chrome-ink-faint)]",children:["×",d.touches]})]},d.path)}),t.jsxs("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1",children:[t.jsxs("button",{type:"button",onClick:j,className:"w-fit cursor-pointer font-mono text-2xs uppercase tracking-[0.1em] text-[var(--accent)] hover:underline",children:["Session diff",l>0?` · +${l}`:""," →"]}),t.jsx("button",{type:"button",onClick:y,className:"w-fit cursor-pointer font-mono text-2xs uppercase tracking-[0.1em] text-[var(--scout-chrome-ink-faint)] hover:text-[var(--accent)] hover:underline",children:"Worktree diff →"})]})]})]})}function Q({label:e,path:s,basePath:a,value:r,agentId:i,sessionId:m}){return t.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[t.jsx("span",{className:"shrink-0 text-xs font-mono uppercase tracking-wider text-[var(--scout-chrome-ink-faint)]",children:e}),t.jsx("button",{type:"button",title:`Reveal ${s}`,onClick:()=>ce({path:s,basePath:a,agentId:i,sessionId:m}),className:"min-w-0 truncate bg-transparent p-0 text-right font-mono text-sm text-[var(--accent)] hover:text-[var(--scout-chrome-ink)] hover:underline",children:r})]})}function A({label:e,value:s}){return t.jsxs("div",{className:"rounded border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] px-2 py-1.5",children:[t.jsx("div",{className:"font-mono text-3xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:e}),t.jsx("div",{className:"mt-0.5 font-mono text-md text-[var(--scout-chrome-ink)]",children:s})]})}function _e({focusAgent:e,agents:s,onOpenAgent:a}){const p=h.useMemo(()=>{const n=s.filter(u=>u.id!==e.id),l=u=>{const o=D(u);return o==="in_turn"?0:o==="in_flight"?1:2};return n.slice().sort((u,o)=>{const c=l(u.state??""),j=l(o.state??"");return c!==j?c-j:ne(u.updatedAt,o.updatedAt)}).slice(0,8)},[s,e.id]),f=h.useMemo(()=>{const n=[{agent:e,x:120,y:90,focused:!0}];return p.forEach((l,u)=>{const o=2*Math.PI*u/Math.max(p.length,1)-Math.PI/2;n.push({agent:l,x:120+68*Math.cos(o),y:90+68*Math.sin(o),focused:!1})}),n},[e,p,120,90,68]);return t.jsxs("div",{className:"@container flex flex-wrap items-start gap-3",children:[t.jsxs("svg",{viewBox:"0 0 240 180",className:"block mx-auto shrink-0 w-full",style:{maxWidth:240},xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("defs",{children:t.jsxs("radialGradient",{id:"inspMeshGlow",cx:"50%",cy:"50%",r:"50%",children:[t.jsx("stop",{offset:"0%",stopColor:"var(--accent)",stopOpacity:"0.06"}),t.jsx("stop",{offset:"100%",stopColor:"var(--accent)",stopOpacity:"0"})]})}),t.jsx("circle",{cx:120,cy:90,r:82,fill:"url(#inspMeshGlow)"}),t.jsx("circle",{cx:120,cy:90,r:68,fill:"none",stroke:"var(--border)",strokeDasharray:"2 4"}),f.slice(1).map((n,l)=>t.jsxs("g",{children:[t.jsx("line",{x1:120,y1:90,x2:n.x,y2:n.y,stroke:"var(--accent)",strokeWidth:1,opacity:.6}),t.jsx("circle",{r:2,fill:"var(--accent)",children:t.jsx("animateMotion",{dur:`${2+l*.3}s`,repeatCount:"indefinite",path:`M 120,90 L ${n.x},${n.y}`})})]},`e-${n.agent.id}`)),f.map(n=>{const l=D(n.agent.state),u=l==="in_turn"||l==="in_flight"||l==="callable",o=n.focused?14:9;return t.jsxs("g",{style:{cursor:"pointer"},onClick:()=>a(n.agent),children:[u&&t.jsxs("circle",{cx:n.x,cy:n.y,r:o+5,fill:"none",stroke:X(n.agent.name),strokeWidth:.8,opacity:.3,children:[t.jsx("animate",{attributeName:"r",values:`${o};${o+8};${o}`,dur:"2.5s",repeatCount:"indefinite"}),t.jsx("animate",{attributeName:"opacity",values:"0.3;0;0.3",dur:"2.5s",repeatCount:"indefinite"})]}),t.jsx("circle",{cx:n.x,cy:n.y,r:o,fill:X(n.agent.name),stroke:n.focused?"var(--accent)":"var(--surface)",strokeWidth:n.focused?1.5:1}),t.jsx("text",{x:n.x,y:n.y,dy:"0.35em",textAnchor:"middle",fontFamily:"var(--font-mono)",fontSize:n.focused?10:8,fontWeight:600,fill:"var(--scout-chrome-avatar-ink)",children:n.agent.name[0].toUpperCase()}),t.jsx("text",{x:n.x,y:n.y+o+10,textAnchor:"middle",fontFamily:"var(--font-mono)",fontSize:8,fill:"var(--dim)",letterSpacing:"0.04em",children:n.agent.name.length>9?n.agent.name.slice(0,8)+"...":n.agent.name})]},n.agent.id)})]}),p.length>0&&t.jsx("ul",{className:"@max-[380px]:hidden flex-1 min-w-[120px] flex flex-col gap-1 m-0 p-0 list-none",children:p.map(n=>{const l=D(n.state);return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>a(n),className:"w-full flex items-center gap-2 py-1 px-1.5 rounded hover:bg-[var(--surface-hover)] text-left",children:[t.jsx("span",{"aria-hidden":!0,className:"shrink-0 w-2 h-2 rounded-full",style:{background:X(n.name)}}),t.jsx("span",{className:"flex-1 truncate text-sm font-mono text-[var(--scout-chrome-ink)]",children:n.name}),t.jsx("span",{"aria-hidden":!0,title:se(n.state),className:"shrink-0 w-1.5 h-1.5 rounded-full",style:{background:te(l)}})]})},n.id)})})]})}function V({asks:e,agentId:s,navigate:a}){const r=e.filter(i=>i.agentId===s&&(i.status==="needs_attention"||i.status==="queued"));return r.length===0?null:t.jsx(g,{label:`Incoming requests · ${r.length}`,children:t.jsx("div",{className:"flex flex-col gap-2",children:r.map(i=>t.jsxs("div",{className:"p-2.5 rounded-md border border-amber-500/30 bg-amber-500/[0.04] cursor-pointer hover:bg-amber-500/[0.08] transition-colors",onClick:()=>{i.conversationId&&a({view:"agents-v2",agentId:s,conversationId:i.conversationId})},children:[t.jsx("div",{className:"text-2xs font-mono uppercase tracking-[0.12em] text-amber-500/80 mb-1",children:"awaiting"}),t.jsx("div",{className:"line-clamp-2 text-sm leading-relaxed text-[var(--scout-chrome-ink)]",children:i.summary??i.task}),t.jsxs("div",{className:"mt-1.5 text-2xs font-mono text-[var(--scout-chrome-ink-ghost)]",children:[i.harness??"operator"," → ",i.agentName??"agent"]})]},i.invocationId))})})}function g({label:e,children:s}){return t.jsxs("div",{className:"flex flex-col",children:[t.jsx("div",{className:"mb-1.5 text-2xs font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:e}),s]})}function w({label:e,value:s}){return t.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[t.jsx("span",{className:"shrink-0 text-xs font-mono uppercase tracking-wider text-[var(--scout-chrome-ink-faint)]",children:e}),t.jsx("span",{className:"truncate text-sm font-mono text-[var(--scout-chrome-ink)]",title:s,children:s})]})}export{Ot as AgentsInspector};
@@ -1 +0,0 @@
1
- import{r as p,j as s}from"./index-DMiGbrBt.js";import{u as R,s as v,a as b}from"./mesh-view-store-CWidRbTE.js";import{u as E}from"./local-agents--00gLMqr.js";import{n as _,b as B,a as P}from"./colors-BtO5_zlx.js";import{a as g}from"./api-h5zurxmi.js";import{t as U}from"./time-DltNTpLl.js";/* empty css *//* empty css */import"./Provider-C7UKGHQy.js";import"./router-Bq5dwf78.js";import"./terminal-sessions-D5CIR2OL.js";import"./sse-CjIkKo46.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-bARZqTzD.js";import"./DocumentFocusViewer-BeVwwl26.js";import"./createLucideIcon-OpA4Amw5.js";import"./TextDocumentSurface-BpAw4eQS.js";/* empty css */import"./file-text-BODxCjcz.js";import"./x-D3GElQbe.js";import"./chevron-right-XiIHsk4m.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-2kv_tGUS.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./NewChatComposer-Cs6OsxK6.js";import"./runtime-picker-Bcl5iIX5.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-CbHjZsz1.js";import"./index-CJXzfjo9.js";import"./HarnessMark-Cbv3Ib0c.js";import"./conversation-model-B47vYmWN.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-BGk5qoEw.js";import"./search-CWfZtOt2.js";function D(e){return e.issues.some(t=>t.code==="mesh_loopback")?"loopback":e.identity.discoverable?"discoverable":e.tailscale.available?e.tailscale.running?"local-only":"tailnet-stopped":"unavailable"}function F(e){const t=new Map;for(const i of e){const r=(i.harness??i.agentClass??"agent").toLowerCase(),c=t.get(r)??{total:0,working:0};c.total+=1,P(i.state)&&(c.working+=1),t.set(r,c)}return Array.from(t.entries()).map(([i,r])=>({label:i,total:r.total,working:r.working})).sort((i,r)=>r.total-i.total).slice(0,6)}function S(e){return e?e.replace(/^https?:\/\//,"").split("/")[0]??e:"Unavailable"}function z(e){return e.split("/")[0]}function H(e){return new Promise(t=>window.setTimeout(t,e))}async function T(e,t){let i=null,r=null;for(let c=0;c<=t.attempts;c+=1){try{if(i=await g("/api/mesh"),v(i),e(i))return i}catch(u){r=u}c<t.attempts&&await H(t.intervalMs)}if(i)return i;throw r instanceof Error?r:new Error("Mesh status is temporarily unavailable.")}function W(e){return e.issues.find(t=>t.code==="local_only"||t.code==="mesh_loopback"||t.code==="tailscale_stopped")?.summary??null}function Rs(){const{meshSnapshot:e,selectedId:t,selectedType:i,probeCache:r}=R(),{agents:c}=E(),[u,f]=p.useState(!1),[C,k]=p.useState(!1),[x,h]=p.useState(null),A=p.useCallback(async()=>{f(!0),h({tone:"info",text:"Restarting broker with mesh discovery enabled..."});try{const l=await g("/api/mesh/announce",{method:"POST",body:"{}"});v(l);const a=l.identity.discoverable?l:await T(n=>n.identity.discoverable,{attempts:6,intervalMs:750});a.identity.discoverable?h({tone:"success",text:`Discoverable at ${S(a.identity.announceUrl??a.brokerUrl)}.`}):h({tone:"warning",text:W(a)??"Scout restarted the broker, but it is not discoverable yet."})}catch(l){h({tone:"error",text:l instanceof Error?l.message:String(l)})}finally{f(!1)}},[]),M=p.useCallback(async()=>{k(!0),h({tone:"info",text:"Opening Tailscale and waiting for the backend..."});try{const l=await g("/api/mesh/tailscale",{method:"POST",body:JSON.stringify({action:"open_app"})});v(l);const a=l.tailscale.running?l:await T(n=>n.tailscale.running,{attempts:12,intervalMs:1e3});a.tailscale.running?h({tone:"success",text:`Tailscale is running with ${a.tailscale.onlineCount} online peer${a.tailscale.onlineCount===1?"":"s"}.`}):h({tone:"warning",text:`Tailscale opened, but the backend is still ${a.tailscale.backendState??"not running"}. Finish startup or sign-in in Tailscale.app.`})}catch(l){h({tone:"error",text:l instanceof Error?l.message:String(l)})}finally{k(!1)}},[]),y=p.useMemo(()=>{const l={total:c.length,working:0,ready:0,notReady:0};for(const a of c){const n=_(a.state);n==="in_turn"||n==="in_flight"?l.working+=1:n==="callable"?l.ready+=1:l.notReady+=1}return l},[c]),w=p.useMemo(()=>F(c),[c]);if(!e)return s.jsx("div",{className:"sys-inspector-empty",children:s.jsx("p",{children:"Loading mesh…"})});if(t?.startsWith("tailnet:")&&i==="node"){const l=t.slice(8),a=e.tailscale.peers.find(m=>m.id===l),n=r[t]??null,d=a?.addresses?.[0]?z(a.addresses[0]):null,N=a?.hostName?.split(".")[0]??a?.hostName??"Tailnet peer";return s.jsxs("div",{className:"sys-inspector-content",children:[s.jsxs("div",{className:"sys-inspector-head",children:[s.jsx("h3",{className:"sys-inspector-title",children:N}),s.jsx("span",{className:`sys-chip sys-chip-${a?.online?"success":"failed"}`,children:a?.online?"Online":"Offline"})]}),s.jsxs("div",{className:"sys-detail-grid",children:[d&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Address"}),s.jsx("code",{className:"sys-detail-value",children:d})]}),a?.os&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Platform"}),s.jsx("span",{className:"sys-detail-value",children:a.os})]}),n?.result?.node?.meshId&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Mesh ID"}),s.jsxs("code",{className:"sys-detail-value",children:[n.result.node.meshId.slice(0,14),"…"]})]}),n?.result?.node?.name&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Node name"}),s.jsx("span",{className:"sys-detail-value",children:n.result.node.name})]})]}),(!n||n.status==="loading")&&s.jsx("div",{className:"sys-banner sys-banner-muted",style:{marginTop:8},children:s.jsx("span",{children:"Connecting to Scout broker…"})}),n?.status==="error"&&s.jsxs("div",{className:"sys-banner sys-banner-warning",style:{marginTop:8},children:[s.jsx("strong",{children:"Broker unreachable."}),s.jsx("span",{children:n.result?.error??"Could not reach the remote broker."})]}),n?.status==="done"&&n.result?.node?.capabilities?.length&&s.jsxs("div",{style:{marginTop:10},children:[s.jsx("div",{className:"sys-inspector-section-label",children:"Capabilities"}),s.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:n.result.node.capabilities.map(m=>s.jsx("span",{className:"sys-chip sys-chip-neutral",children:m},m))})]}),n?.status==="done"&&n.result?.home&&s.jsxs("div",{style:{marginTop:14},children:[s.jsxs("div",{className:"sys-inspector-section-label",children:["Agents — ",n.result.home.agents.length," registered"]}),n.result.home.agents.length===0?s.jsx("div",{className:"sys-list-empty",style:{marginTop:4},children:s.jsx("p",{children:"No agents registered on this broker."})}):s.jsx("div",{className:"mesh-agent-table",style:{marginTop:4},children:n.result.home.agents.map(m=>{const j=B(m.state);return s.jsxs("div",{className:"mesh-detail-agent",style:{padding:"4px 0"},children:[s.jsx("span",{className:`mesh-detail-dot mesh-detail-dot--${j}`}),s.jsxs("div",{className:"mesh-detail-agent-body",children:[s.jsx("span",{className:"mesh-detail-agent-name",style:{fontSize:12},children:m.title}),m.activeTask&&s.jsx("span",{className:"mesh-detail-agent-task",children:m.activeTask})]}),s.jsx("span",{className:`mesh-detail-agent-state mesh-detail-agent-state--${j}`,children:m.statusLabel||j})]},m.id)})})]}),s.jsx("button",{type:"button",className:"s-btn",style:{marginTop:14},onClick:()=>b(null,null),children:"Clear selection"})]})}if(t&&i==="node"){const a=Object.values(e.nodes).find(d=>d.id===t)??(e.localNode?.id===t?e.localNode:null),n=e.localNode?.id===t;return a?s.jsxs("div",{className:"sys-inspector-content",children:[s.jsxs("div",{className:"sys-inspector-head",children:[s.jsx("h3",{className:"sys-inspector-title",children:a.hostName?.split(".")[0]??a.name??"Node"}),n&&s.jsx("span",{className:"sys-chip sys-chip-neutral",children:"this broker"})]}),s.jsxs("div",{className:"sys-detail-grid",children:[s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Node ID"}),s.jsxs("code",{className:"sys-detail-value",children:[a.id.slice(0,16),"…"]})]}),a.brokerUrl&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Broker URL"}),s.jsx("code",{className:"sys-detail-value",children:S(a.brokerUrl)})]}),a.hostName&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Host"}),s.jsx("span",{className:"sys-detail-value",children:a.hostName})]}),!n&&"lastSeenAt"in a&&typeof a.lastSeenAt=="number"&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Last seen"}),s.jsx("span",{className:"sys-detail-value",children:U(a.lastSeenAt)})]}),!n&&s.jsxs("div",{className:"sys-detail-card",children:[s.jsx("span",{className:"sys-detail-label",children:"Scope"}),s.jsx("span",{className:"sys-detail-value",children:a.advertiseScope==="mesh"?"Announced to mesh":"Local only"})]})]}),n&&e.issues.length>0&&s.jsx("div",{className:"sys-issue-grid",style:{marginTop:12},children:e.issues.map((d,N)=>s.jsxs("article",{className:`sys-issue-card sys-issue-card-${d.severity==="error"?"error":"warning"}`,children:[s.jsx("div",{className:"sys-issue-head",children:s.jsx("h3",{className:"sys-issue-title",children:d.title})}),s.jsx("p",{className:"sys-issue-body",children:d.summary}),d.actionCommand&&s.jsx("div",{className:"sys-issue-action",children:s.jsx("code",{className:"sys-code-inline",children:d.actionCommand})})]},N))}),s.jsx("button",{type:"button",className:"s-btn",style:{marginTop:12},onClick:()=>b(null,null),children:"Clear selection"})]}):s.jsxs("div",{className:"sys-inspector-empty",children:[s.jsx("p",{children:"Node not found."}),s.jsx("button",{type:"button",className:"s-btn",onClick:()=>b(null,null),children:"Clear"})]})}const o=e,L=D(o),$=Object.values(o.nodes).filter(l=>l.id!==o.localNode?.id).length,I=o.tailscale.onlineCount??0,O=o.localNode?.hostName?.split(".")[0]??o.localNode?.name??o.identity.name??"this broker";return s.jsxs("div",{className:"sys-inspector-content mesh-summary",children:[s.jsxs("div",{className:"sys-inspector-head",children:[s.jsx("h3",{className:"sys-inspector-title",children:O}),s.jsx("span",{className:"mesh-summary-mode",children:o.identity.modeLabel})]}),s.jsx("section",{className:"mesh-summary-section",children:s.jsxs("div",{className:"mesh-summary-counts",children:[s.jsxs("div",{className:"mesh-summary-count",children:[s.jsx("span",{className:"mesh-summary-count-value",children:y.total}),s.jsx("span",{className:"mesh-summary-count-label",children:"agents"})]}),s.jsxs("div",{className:"mesh-summary-count mesh-summary-count--working",children:[s.jsx("span",{className:"mesh-summary-count-value",children:y.working}),s.jsx("span",{className:"mesh-summary-count-label",children:"working"})]}),s.jsxs("div",{className:"mesh-summary-count",children:[s.jsx("span",{className:"mesh-summary-count-value",children:y.ready}),s.jsx("span",{className:"mesh-summary-count-label",children:"ready"})]}),s.jsxs("div",{className:"mesh-summary-count mesh-summary-count--offline",children:[s.jsx("span",{className:"mesh-summary-count-value",children:y.notReady}),s.jsx("span",{className:"mesh-summary-count-label",children:"not ready"})]})]})}),w.length>0&&s.jsxs("section",{className:"mesh-summary-section",children:[s.jsx("div",{className:"sys-inspector-section-label",children:"By harness"}),s.jsx("div",{className:"mesh-summary-harness",children:w.map(l=>s.jsxs("div",{className:"mesh-summary-harness-row",children:[s.jsx("span",{className:"mesh-summary-harness-name",children:l.label}),s.jsx("span",{className:"mesh-summary-harness-count",children:l.total}),l.working>0&&s.jsxs("span",{className:"mesh-summary-harness-working",children:[l.working," working"]})]},l.label))})]}),s.jsxs("section",{className:"mesh-summary-section",children:[s.jsx("div",{className:"sys-inspector-section-label",children:"Peers"}),s.jsxs("div",{className:"mesh-summary-peers",children:[s.jsxs("div",{className:"mesh-summary-peer-row",children:[s.jsx("span",{className:"mesh-summary-peer-label",children:"Mesh"}),s.jsx("span",{className:"mesh-summary-peer-value",children:$})]}),o.tailscale.available&&s.jsxs("div",{className:"mesh-summary-peer-row",children:[s.jsx("span",{className:"mesh-summary-peer-label",children:"Tailnet"}),s.jsx("span",{className:`mesh-summary-peer-value${o.tailscale.running?"":" mesh-summary-peer-value--dim"}`,children:o.tailscale.running?`${I} online`:"stopped"})]})]})]}),s.jsxs("section",{className:"mesh-summary-section mesh-summary-reach",children:[s.jsx("div",{className:"sys-inspector-section-label",children:"Reach"}),s.jsx(J,{state:L,tailscaleAvailable:o.tailscale.available,announcing:u,tailscaleBusy:C,onAnnounce:()=>{A()},onStartTailscale:()=>{M()}}),x&&s.jsx("div",{className:`sys-banner mesh-action-message sys-banner-${x.tone}`,children:s.jsx("span",{children:x.text})})]})]})}function J({state:e,tailscaleAvailable:t,announcing:i,tailscaleBusy:r,onAnnounce:c,onStartTailscale:u}){return e==="discoverable"?s.jsxs("div",{className:"mesh-reach mesh-reach--on",children:[s.jsx("span",{className:"mesh-reach-dot"}),s.jsx("span",{className:"mesh-reach-label",children:"Discoverable on mesh"})]}):e==="tailnet-stopped"?s.jsxs("div",{className:"mesh-reach",children:[s.jsxs("div",{className:"mesh-reach-row",children:[s.jsx("span",{className:"mesh-reach-dot mesh-reach-dot--off"}),s.jsx("span",{className:"mesh-reach-label",children:"Tailscale stopped"})]}),s.jsx("button",{type:"button",className:"s-btn mesh-reach-action",disabled:r,onClick:u,children:r?"Opening…":"Start Tailscale"})]}):e==="loopback"?s.jsxs("div",{className:"mesh-reach",children:[s.jsxs("div",{className:"mesh-reach-row",children:[s.jsx("span",{className:"mesh-reach-dot mesh-reach-dot--off"}),s.jsx("span",{className:"mesh-reach-label",children:"Announcement broken"})]}),s.jsx("button",{type:"button",className:"s-btn mesh-reach-action",disabled:i,onClick:c,children:i?"Fixing…":"Fix announcement"})]}):e==="unavailable"?s.jsxs("div",{className:"mesh-reach mesh-reach--neutral",children:[s.jsx("span",{className:"mesh-reach-dot mesh-reach-dot--off"}),s.jsx("span",{className:"mesh-reach-label",children:"Local only — no tailnet on this host"})]}):s.jsxs("div",{className:"mesh-reach",children:[s.jsxs("div",{className:"mesh-reach-row",children:[s.jsx("span",{className:"mesh-reach-dot mesh-reach-dot--off"}),s.jsx("span",{className:"mesh-reach-label",children:"Local only"})]}),s.jsx("button",{type:"button",className:"s-btn s-btn-primary mesh-reach-action",disabled:i||!t,onClick:c,children:i?"Announcing…":"Make discoverable"})]})}export{Rs as MeshInspectorPanel};
@@ -1 +0,0 @@
1
- import{r as u,j as e}from"./index-DMiGbrBt.js";import{u as j}from"./Provider-C7UKGHQy.js";import{o as b}from"./openContent-C6XO6kr5.js";import{a as N}from"./api-h5zurxmi.js";import{u as w}from"./sse-CjIkKo46.js";import{t as g,a as p}from"./time-DltNTpLl.js";import{C as y}from"./chevron-down-BGk5qoEw.js";import{C as I}from"./chevron-right-XiIHsk4m.js";import{M as C}from"./message-square-DSaGpjFU.js";import"./router-Bq5dwf78.js";import"./terminal-sessions-D5CIR2OL.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-bARZqTzD.js";import"./DocumentFocusViewer-BeVwwl26.js";import"./createLucideIcon-OpA4Amw5.js";import"./TextDocumentSurface-BpAw4eQS.js";/* empty css */import"./file-text-BODxCjcz.js";import"./x-D3GElQbe.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-2kv_tGUS.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./NewChatComposer-Cs6OsxK6.js";import"./runtime-picker-Bcl5iIX5.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-CbHjZsz1.js";import"./index-CJXzfjo9.js";import"./HarnessMark-Cbv3Ib0c.js";import"./conversation-model-B47vYmWN.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./search-CWfZtOt2.js";import"./index-BWHgHrtv.js";const M=5;function ke(){const{route:t,navigate:s}=j(),a=t.view==="work"?t.workId:null,[r,o]=u.useState(null),i=u.useCallback(async()=>{if(!a){o(null);return}try{o(await N(`/api/work/${encodeURIComponent(a)}`))}catch{o(null)}},[a]);if(u.useEffect(()=>{i()},[i]),w(()=>{a&&i()}),t.view!=="work")return null;if(!r)return e.jsx("div",{className:"flex h-full items-center justify-center px-4 text-center text-sm font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-ghost)]",children:"Loading work item…"});const d=O(r.state),m=T(r.attention),f=r.ownerName??r.ownerId??"Unassigned",l=r.nextMoveOwnerName??r.nextMoveOwnerId??null,h=l!==null&&(r.ownerId??null)!==(r.nextMoveOwnerId??null)&&l!==f,k=1+(h?1:0)+(r.priority?1:0)+2+(r.parentId?1:0)+(r.conversationId?1:0);return e.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar text-sm",children:[e.jsx("div",{className:"sticky top-0 z-10 border-b border-[var(--scout-chrome-border-soft)] bg-black/55 px-4 py-2 backdrop-blur",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${d.dot}`}),e.jsx("span",{className:`font-mono text-xs uppercase tracking-[0.15em] ${d.text}`,children:L(r.state)}),e.jsxs("span",{className:"min-w-0 flex-1 truncate text-xs text-[var(--scout-chrome-ink-faint)]",children:[e.jsx("span",{className:"text-[var(--scout-chrome-ink)]",children:f}),h&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"px-1 text-[var(--scout-chrome-ink-ghost)]",children:"→"}),e.jsx("span",{className:"text-[var(--scout-chrome-ink)]",children:l})]})]}),m&&e.jsx("span",{className:"shrink-0 rounded border border-amber-400/30 bg-amber-400/10 px-1.5 py-0.5 font-mono text-2xs uppercase tracking-[0.12em] text-amber-300/90",children:m})]})}),e.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[e.jsxs(c,{label:"Case facts",children:[e.jsx(n,{label:"Phase",value:r.currentPhase}),e.jsx(n,{label:"Acceptance",value:r.acceptanceState.replace(/_/g," ")}),r.priority&&e.jsx(n,{label:"Priority",value:r.priority})]}),e.jsx(c,{label:"Timeline",children:r.timeline.length===0?e.jsx("div",{className:"text-xs text-[var(--scout-chrome-ink-faint)]",children:"No activity yet."}):e.jsx("div",{className:"flex flex-col gap-1.5",children:r.timeline.slice(0,M).map(x=>e.jsx(W,{item:x,onOpen:x.conversationId?()=>b(s,{view:"conversation",conversationId:x.conversationId},{returnTo:t}):void 0},x.id))})}),e.jsxs(c,{label:"Routing",collapsible:!0,defaultOpen:!1,count:k,children:[e.jsx(n,{label:"Owner",value:f}),h&&l&&e.jsx(n,{label:"Next move",value:l}),r.priority&&e.jsx(n,{label:"Priority",value:r.priority}),e.jsx(n,{label:"Children",value:`${r.activeChildWorkCount}`}),e.jsx(n,{label:"Flights",value:`${r.activeFlightCount}`}),r.lastMeaningfulAt&&e.jsx(n,{label:"Last update",value:g(r.lastMeaningfulAt)}),(r.conversationId||r.parentId)&&e.jsxs("div",{className:"mt-2 flex flex-col gap-1.5",children:[r.conversationId&&e.jsx(v,{label:"Open thread",onClick:()=>b(s,{view:"conversation",conversationId:r.conversationId},{returnTo:t})}),r.parentId&&r.parentTitle&&e.jsx(v,{label:r.parentTitle,eyebrow:"Parent",onClick:()=>b(s,{view:"work",workId:r.parentId},{returnTo:t})})]})]}),e.jsxs(c,{label:"Record",collapsible:!0,defaultOpen:!1,children:[e.jsx(n,{label:"Case ID",value:r.id}),e.jsx(n,{label:"Created",value:p(r.createdAt)}),e.jsx(n,{label:"Updated",value:p(r.updatedAt)}),e.jsx(n,{label:"Last activity",value:p(r.lastMeaningfulAt)})]}),r.lastMeaningfulSummary&&e.jsxs(c,{label:"Hudson context",collapsible:!0,defaultOpen:!1,children:[e.jsx("div",{className:"text-sm italic leading-relaxed text-[var(--scout-chrome-ink-soft)]",children:r.lastMeaningfulSummary}),e.jsxs("div",{className:"mt-2 flex gap-1.5",children:[e.jsx("span",{className:"rounded border border-[var(--scout-chrome-border-soft)] px-1.5 py-0.5 font-mono text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:"Plan"}),e.jsx("span",{className:"rounded border border-[var(--scout-chrome-border-soft)] px-1.5 py-0.5 font-mono text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:"Docs"}),e.jsx("span",{className:"rounded border border-[var(--scout-chrome-border-soft)] px-1.5 py-0.5 font-mono text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:"Code"})]})]})]})]})}function L(t){switch(t){case"review":return"In review";case"waiting":return"Waiting";case"working":return"Working";case"done":return"Done";default:return t.replace(/_/g," ")}}function T(t){switch(t){case"badge":return"Noteworthy";case"interrupt":return"Blocked";default:return null}}function O(t){return/complete|done|finished/i.test(t)?{dot:"bg-emerald-400",text:"text-emerald-300/90"}:/fail|error/i.test(t)?{dot:"bg-red-400",text:"text-red-300/90"}:/block|wait|pause/i.test(t)?{dot:"bg-amber-400",text:"text-amber-300/90"}:/active|working|in[_-]?progress/i.test(t)?{dot:"bg-cyan-400",text:"text-cyan-300/90"}:{dot:"bg-[var(--scout-chrome-ink-faint)]",text:"text-[var(--scout-chrome-ink)]"}}function c({label:t,children:s,collapsible:a=!1,defaultOpen:r=!0,count:o}){const[i,d]=u.useState(r);return a?e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("button",{type:"button",onClick:()=>d(m=>!m),className:"flex items-center gap-1.5 text-left text-2xs font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)] hover:text-[var(--scout-chrome-ink)]",children:[i?e.jsx(y,{"aria-hidden":"true",size:10,strokeWidth:2}):e.jsx(I,{"aria-hidden":"true",size:10,strokeWidth:2}),e.jsx("span",{children:t}),typeof o=="number"&&o>0&&e.jsx("span",{className:"rounded border border-[var(--scout-chrome-border-soft)] px-1 py-0 font-mono text-3xs tracking-[0.1em] text-[var(--scout-chrome-ink-faint)]",children:o})]}),i&&e.jsx("div",{className:"mt-1.5",children:s})]}):e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"mb-1.5 text-2xs font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:t}),s]})}function v({label:t,eyebrow:s,onClick:a}){return e.jsxs("button",{type:"button",onClick:a,className:"flex items-center justify-between gap-2 rounded border border-[var(--scout-chrome-border-soft)] bg-white/[0.025] px-2 py-1.5 text-left hover:border-cyan-400/25 hover:bg-cyan-400/10",children:[e.jsxs("span",{className:"min-w-0",children:[s&&e.jsx("span",{className:"block font-mono text-2xs uppercase tracking-[0.14em] text-[var(--scout-chrome-ink-faint)]",children:s}),e.jsx("span",{className:"block truncate font-mono text-xs text-[var(--scout-chrome-ink)]",children:t})]}),e.jsx(C,{"aria-hidden":"true",size:11,strokeWidth:1.8,className:"shrink-0 text-cyan-300/75"})]})}function W({item:t,onOpen:s}){const a=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`mt-1 h-1.5 w-1.5 shrink-0 rounded-full ${A(t)}`}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-mono text-2xs text-[var(--scout-chrome-ink-faint)]",children:g(t.at)}),e.jsx("span",{className:"shrink-0 rounded border border-[var(--scout-chrome-border-soft)] px-1 py-0.5 font-mono text-3xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:_(t)})]}),e.jsx("span",{className:"mt-0.5 block truncate text-xs font-semibold text-[var(--scout-chrome-ink-strong)]",children:t.actorName??"system"}),t.title&&e.jsx("span",{className:"mt-0.5 block truncate text-xs leading-snug text-[var(--scout-chrome-ink)]",children:t.title}),t.summary&&e.jsx("span",{className:"mt-0.5 block text-xs leading-relaxed text-[var(--scout-chrome-ink-faint)]",style:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden"},children:t.summary})]})]}),r="flex gap-2 border-t border-[var(--scout-chrome-border-soft)] pt-1.5 first:border-t-0 first:pt-0",o=p(t.at);return s?e.jsx("button",{type:"button",onClick:s,title:o,className:`${r} text-left hover:text-cyan-300/90`,children:a}):e.jsx("div",{className:r,title:o,children:a})}function _(t){switch(t.kind){case"flight_started":return"flight started";case"flight_completed":return t.detailKind?`flight ${t.detailKind}`:"flight ended";case"message":return"message";default:return t.title??t.detailKind??"event"}}function A(t){return t.kind==="message"?"bg-cyan-400":t.kind==="flight_started"?"bg-lime-400":t.kind==="flight_completed"?t.detailKind?.includes("fail")?"bg-red-400":"bg-emerald-400":t.detailKind?.includes("interrupt")||t.detailKind?.includes("block")?"bg-amber-400":"bg-[var(--scout-chrome-ink-faint)]"}function n({label:t,value:s}){return e.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[e.jsx("span",{className:"shrink-0 text-xs font-mono uppercase tracking-wider text-[var(--scout-chrome-ink-faint)]",children:t}),e.jsx("span",{className:"truncate text-sm font-mono text-[var(--scout-chrome-ink)]",children:s})]})}export{ke as WorkInspector};
@@ -1 +0,0 @@
1
- import{j as e,r as i}from"./index-DMiGbrBt.js";import{u as w}from"./Provider-C7UKGHQy.js";import{a as C}from"./api-h5zurxmi.js";import{u as B}from"./sse-CjIkKo46.js";import{t as g}from"./time-DltNTpLl.js";import{B as E,b as M}from"./BrokerScreen-7ekklu88.js";import{b as S}from"./broker-display-pp33bLsu.js";import"./router-Bq5dwf78.js";import"./terminal-sessions-D5CIR2OL.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-bARZqTzD.js";import"./DocumentFocusViewer-BeVwwl26.js";import"./createLucideIcon-OpA4Amw5.js";import"./TextDocumentSurface-BpAw4eQS.js";/* empty css */import"./file-text-BODxCjcz.js";import"./x-D3GElQbe.js";import"./chevron-right-XiIHsk4m.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-2kv_tGUS.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./NewChatComposer-Cs6OsxK6.js";import"./runtime-picker-Bcl5iIX5.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-CbHjZsz1.js";import"./index-CJXzfjo9.js";import"./HarnessMark-Cbv3Ib0c.js";import"./conversation-model-B47vYmWN.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-BGk5qoEw.js";import"./search-CWfZtOt2.js";import"./index-BWHgHrtv.js";import"./EmptyState-4F9XDFQm.js";import"./clipboard-e3fSpeo7.js";import"./status-tone-BM_zuRy1.js";import"./openContent-C6XO6kr5.js";import"./BrokerMetadataPanel-7UjcuNjd.js";import"./DispatchAftermath-Dpe88DFX.js";import"./follow-route-BvcGtBIL.js";import"./arrow-up-right-ClxBnsi7.js";import"./ShikiPane-Ap1iPxYb.js";import"./types-B0PlfpKc.js";/* empty css */import"./external-link-CXBytO9o.js";import"./arrow-down-BPLe0am9.js";import"./bot-eu8pBNvI.js";import"./refresh-cw-BBmAnCB7.js";import"./check-DjgFiBxb.js";import"./copy-CQGYbxdu.js";import"./message-square-DSaGpjFU.js";import"./sparkles-ClfRJQ6w.js";import"./plus--b1raV_O.js";import"./send-horizontal-Bg5-QggH.js";import"./radio-Bz8ZePxj.js";function $(r){return`${Math.round(r*100)}%`}function R(r){switch(r){case"success":return"sent";case"failed_query":return"query";case"failed_delivery":return"delivery";default:return"attempt"}}function q(r){switch(r){case"dm":return"direct";case"channel":return"channel";case"broadcast":return"broadcast";case null:return"no route";default:return r}}function A(r){const t=new Map;for(const o of r){const n=q(o.route);t.set(n,(t.get(n)??0)+1)}return[...t.entries()].map(([o,n])=>({label:o,count:n})).sort((o,n)=>n.count-o.count||o.label.localeCompare(n.label)).slice(0,5)}function D(r){const t={sent:0,query:0,delivery:0,failures:0};for(const o of r)o.kind==="success"?t.sent+=1:o.kind==="failed_query"?t.query+=1:(o.kind==="failed_delivery"||o.kind==="delivery_attempt")&&(t.delivery+=1),S(o)&&(t.failures+=1);return t}function L(){const{inspectBrokerAttempt:r}=w(),[t,o]=i.useState(null),[n,f]=i.useState(null),l=i.useCallback(async()=>{try{const s=await C(M());o(s),f(null)}catch(s){f(s instanceof Error?s.message:String(s))}},[]);i.useEffect(()=>{l()},[l]),B(s=>{(s.kind==="message.posted"||s.kind==="delivery.planned"||s.kind==="delivery.attempted"||s.kind==="delivery.state.changed"||s.kind==="scout.dispatched")&&l()});const h=i.useMemo(()=>t?[...t.failedQueries,...t.failedDeliveries].sort((s,m)=>m.ts-s.ts).slice(0,4):[],[t]),v=i.useMemo(()=>t?t.attempts.slice().sort((s,m)=>m.ts-s.ts).slice(0,5):[],[t]),j=i.useMemo(()=>t?A(t.attempts):[],[t]),a=i.useMemo(()=>t?D(t.attempts):null,[t]),b=i.useCallback(s=>{r(s),window.dispatchEvent(new CustomEvent("scout:set-inspector-width",{detail:{width:420}}))},[r]);if(!t&&!n)return e.jsx("div",{className:"flex h-full flex-col overflow-y-auto frame-scrollbar p-4 gap-4 text-sm",children:e.jsx(u,{title:"Dispatch context",status:"Loading broker ledger..."})});if(!t)return e.jsxs("div",{className:"flex h-full flex-col overflow-y-auto frame-scrollbar p-4 gap-4 text-sm",children:[e.jsx(u,{title:"Dispatch context",status:"Broker diagnostics unavailable"}),e.jsx("div",{className:"rounded border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] p-2.5 text-sm leading-relaxed text-[var(--scout-chrome-ink-soft)]",children:n})]});const c=t.attempts.length,y=t.ledger.hasMore.attempts?"+":"",N=c>0&&a?a.failures/c:0;return e.jsxs("div",{className:"flex h-full flex-col overflow-y-auto frame-scrollbar p-4 gap-4 text-sm",children:[e.jsxs(u,{title:"Dispatch context",status:`${c}${y} latest route${c===1?"":"s"}`,children:[e.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-1",children:[e.jsx(d,{label:"Sent",value:`${a?.sent??0}`}),e.jsx(d,{label:"Query",value:`${a?.query??0}`}),e.jsx(d,{label:"Delivery",value:`${a?.delivery??0}`})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 border-t border-[var(--scout-chrome-border-soft)] pt-2 font-mono text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-ghost)]",children:[e.jsxs("span",{children:[$(N)," failed"]}),e.jsx("span",{children:g(t.generatedAt)})]})]}),e.jsx(p,{label:"Route mix",children:e.jsx(_,{items:j,empty:"No route records visible"})}),e.jsx(p,{label:"Needs attention",children:h.length===0?e.jsx(x,{children:"No failed routes in history."}):e.jsx("div",{className:"flex flex-col gap-1.5",children:h.map(s=>e.jsx(k,{attempt:s,onOpen:b},s.id))})}),e.jsx(p,{label:"Recent dispatch",children:v.length===0?e.jsx(x,{children:"No recent dispatch rows."}):e.jsx("div",{className:"flex flex-col gap-1",children:v.map(s=>e.jsx(k,{attempt:s,onOpen:b,compact:!0},s.id))})})]})}function u({title:r,status:t,children:o}){return e.jsxs("div",{className:"rounded border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] p-2.5",children:[e.jsx("div",{className:"text-2xs font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:r}),e.jsx("div",{className:"mt-1 font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-soft)]",children:t}),o]})}function d({label:r,value:t}){return e.jsxs("div",{className:"min-w-0 rounded-sm border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-bg)] px-1.5 py-1",children:[e.jsx("div",{className:"font-mono text-2xs uppercase tracking-[0.1em] text-[var(--scout-chrome-ink-faint)]",children:r}),e.jsx("div",{className:"mt-0.5 truncate font-mono text-lg text-[var(--scout-chrome-ink-strong)]",children:t})]})}function p({label:r,children:t}){return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"mb-1.5 text-2xs font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:r}),t]})}function _({items:r,empty:t}){return r.length===0?e.jsx(x,{children:t}):e.jsx("div",{className:"flex flex-wrap gap-1",children:r.map(o=>e.jsxs("span",{className:"rounded-sm border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] px-1.5 py-0.5 font-mono text-xs text-[var(--scout-chrome-ink-soft)]",title:`${o.count} ${o.label}`,children:[o.label," ",o.count]},o.label))})}function x({children:r}){return e.jsx("div",{className:"text-xs font-mono uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-ghost)]",children:r})}function k({attempt:r,onOpen:t,compact:o=!1}){return e.jsxs("button",{type:"button",className:"rounded border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] px-2 py-1.5 text-left transition-colors hover:border-[var(--scout-chrome-border)]",onClick:()=>t(r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"shrink-0 rounded-sm bg-[var(--scout-chrome-bg)] px-1 py-0.5 font-mono text-3xs uppercase tracking-[0.08em] text-[var(--scout-chrome-ink-faint)]",children:R(r.kind)}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-[var(--scout-chrome-ink)]",children:r.detail}),e.jsx("span",{className:"shrink-0 font-mono text-2xs text-[var(--scout-chrome-ink-faint)]",children:g(r.ts)})]}),!o&&e.jsxs("div",{className:"mt-0.5 flex items-center gap-2 font-mono text-2xs text-[var(--scout-chrome-ink-ghost)]",children:[e.jsx("span",{className:"truncate",children:r.actorName??"unknown"}),e.jsx("span",{className:"shrink-0",children:"->"}),e.jsx("span",{className:"truncate",children:r.target??"none"})]})]})}function ze({selectedAttempt:r,navigate:t,onClose:o}){return r?e.jsx(E,{attempt:r,navigate:t,onClose:o}):e.jsx(L,{})}export{ze as BrokerRight};
@@ -1 +0,0 @@
1
- import{r as l,j as e}from"./index-DMiGbrBt.js";import{u as P}from"./Provider-C7UKGHQy.js";import{a as g}from"./api-h5zurxmi.js";import{u as A}from"./sse-CjIkKo46.js";import{t as b}from"./time-DltNTpLl.js";import{o as k}from"./openContent-C6XO6kr5.js";import"./router-Bq5dwf78.js";import"./terminal-sessions-D5CIR2OL.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-bARZqTzD.js";import"./DocumentFocusViewer-BeVwwl26.js";import"./createLucideIcon-OpA4Amw5.js";import"./TextDocumentSurface-BpAw4eQS.js";/* empty css */import"./file-text-BODxCjcz.js";import"./x-D3GElQbe.js";import"./chevron-right-XiIHsk4m.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-2kv_tGUS.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./NewChatComposer-Cs6OsxK6.js";import"./runtime-picker-Bcl5iIX5.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-CbHjZsz1.js";import"./index-CJXzfjo9.js";import"./HarnessMark-Cbv3Ib0c.js";import"./conversation-model-B47vYmWN.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-BGk5qoEw.js";import"./search-CWfZtOt2.js";import"./index-BWHgHrtv.js";function f(t){const r=t.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean);return r[r.length-1]??t}function N(t){const n=t?.trim();if(!n)return null;const r=f(n);return r.endsWith(".jsonl")?r.slice(0,-6):r}function L(t){return t.workspaceRoot?f(t.workspaceRoot):t.agentName??"unassigned"}function $(t){return t.harness?.trim()||t.kind?.trim()||"scout"}function w(t){return t.project?.trim()||(t.cwd?f(t.cwd):null)||"unknown"}function y(t,n=4){const r=new Map;for(const c of t){const a=c.trim()||"unknown";r.set(a,(r.get(a)??0)+1)}return[...r.entries()].map(([c,a])=>({label:c,count:a})).sort((c,a)=>a.count-c.count||c.label.localeCompare(a.label)).slice(0,n)}function be(){const{route:t,navigate:n}=P(),[r,c]=l.useState([]),[a,h]=l.useState(null),p=l.useCallback(async()=>{const[u,d]=await Promise.allSettled([g("/api/sessions"),g("/api/tail/discover")]);u.status==="fulfilled"&&c(u.value),d.status==="fulfilled"&&h(d.value)},[]);if(l.useEffect(()=>{p()},[p]),A(()=>{p()}),t.view!=="sessions")return null;const s=t.sessionId?r.find(u=>u.id===t.sessionId)??null:null;return s?e.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-sm",children:[e.jsxs("div",{className:"border-b border-[var(--scout-chrome-border-soft)] pb-3",children:[e.jsx("div",{className:"text-lg leading-snug text-[var(--scout-chrome-ink-strong)]",children:s.title}),e.jsx("div",{className:"text-xs font-mono uppercase tracking-wider text-cyan-400/70 mt-1",children:s.kind})]}),s.agentName&&e.jsxs(m,{label:"Agent",children:[e.jsx(x,{label:"Name",value:s.agentName}),s.harness&&e.jsx(x,{label:"Harness",value:s.harness})]}),(s.currentBranch||s.workspaceRoot)&&e.jsxs(m,{label:"Workspace",children:[s.currentBranch&&e.jsx(x,{label:"Branch",value:s.currentBranch}),s.workspaceRoot&&e.jsx(x,{label:"Root",value:s.workspaceRoot})]}),e.jsxs(m,{label:"Activity",children:[e.jsx(x,{label:"Messages",value:`${s.messageCount}`}),s.lastMessageAt&&e.jsx(x,{label:"Last",value:b(s.lastMessageAt)}),s.participantIds.length>0&&e.jsx(x,{label:"Participants",value:`${s.participantIds.length}`})]}),s.preview&&e.jsx(m,{label:"Preview",children:e.jsxs("div",{className:"text-sm italic leading-relaxed text-[var(--scout-chrome-ink-soft)]",children:['"',s.preview,'"']})})]}):e.jsx(I,{sessions:r,discovery:a,navigate:n,route:t})}function I({sessions:t,discovery:n,navigate:r,route:c}){const a=n?.transcripts??[],h=l.useMemo(()=>y([...t.map($),...a.map(o=>o.source||"unknown")],5),[t,a]),p=l.useMemo(()=>y([...t.map(L),...a.map(w)],5),[t,a]),s=l.useMemo(()=>a.slice().sort((o,i)=>i.mtimeMs-o.mtimeMs).slice(0,5),[a]),u=l.useMemo(()=>t.filter(o=>o.lastMessageAt).slice().sort((o,i)=>(i.lastMessageAt??0)-(o.lastMessageAt??0)).slice(0,5),[t]),d=n?.processes?.length??0,S=n?.totals.transcripts??a.length,R=d>0?"Live harness activity":"Quiet session surface";return e.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-sm",children:[e.jsxs("div",{className:"rounded border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] p-2.5",children:[e.jsx("div",{className:"text-2xs font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:"Sessions context"}),e.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-1",children:[e.jsx(v,{label:"Scout",value:`${t.length}`}),e.jsx(v,{label:"Raw",value:`${S}`}),e.jsx(v,{label:"Live",value:`${d}`})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 border-t border-[var(--scout-chrome-border-soft)] pt-2 font-mono text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-ghost)]",children:[e.jsx("span",{children:R}),e.jsxs("span",{children:[h.length," sources"]})]})]}),e.jsx(m,{label:"Sources",children:e.jsx(M,{items:h,empty:"No sources visible"})}),e.jsx(m,{label:"Project mix",children:e.jsx(M,{items:p,empty:"No projects visible"})}),e.jsx(m,{label:"Recent raw",children:s.length===0?e.jsx(j,{children:"No raw transcripts discovered."}):e.jsx("div",{className:"flex flex-col gap-1.5",children:s.map(o=>{const i=N(o.sessionId)??N(o.transcriptPath);return e.jsxs("button",{type:"button",className:"rounded border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] px-2 py-1.5 text-left transition-colors hover:border-[var(--scout-chrome-border)]",onClick:()=>{i&&k(r,{view:"sessions",sessionId:i},{returnTo:c})},disabled:!i,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"shrink-0 rounded-sm bg-[var(--scout-chrome-bg)] px-1 py-0.5 font-mono text-3xs uppercase tracking-[0.08em] text-[var(--scout-chrome-ink-faint)]",children:o.source||"raw"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-[var(--scout-chrome-ink)]",children:w(o)}),e.jsx("span",{className:"shrink-0 font-mono text-2xs text-[var(--scout-chrome-ink-faint)]",children:b(o.mtimeMs)})]}),e.jsx("div",{className:"mt-0.5 truncate font-mono text-2xs text-[var(--scout-chrome-ink-ghost)]",children:i??f(o.transcriptPath)})]},`${o.source}:${o.transcriptPath}`)})})}),e.jsx(m,{label:"Recent Scout sessions",children:u.length===0?e.jsx(j,{children:"No recent Scout session messages."}):e.jsx("div",{className:"flex flex-col gap-1",children:u.map(o=>e.jsxs("button",{type:"button",className:"flex items-center gap-2 bg-transparent px-0 py-0.5 text-left",onClick:()=>k(r,{view:"sessions",sessionId:o.id},{returnTo:c}),children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-[var(--scout-chrome-ink-soft)]",children:o.title}),e.jsx("span",{className:"shrink-0 font-mono text-2xs text-[var(--scout-chrome-ink-faint)]",children:o.lastMessageAt?b(o.lastMessageAt):"-"})]},o.id))})})]})}function v({label:t,value:n}){return e.jsxs("div",{className:"min-w-0 rounded-sm border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-bg)] px-1.5 py-1",children:[e.jsx("div",{className:"font-mono text-2xs uppercase tracking-[0.1em] text-[var(--scout-chrome-ink-faint)]",children:t}),e.jsx("div",{className:"mt-0.5 truncate font-mono text-lg text-[var(--scout-chrome-ink-strong)]",children:n})]})}function M({items:t,empty:n}){return t.length===0?e.jsx(j,{children:n}):e.jsx("div",{className:"flex flex-wrap gap-1",children:t.map(r=>e.jsxs("span",{className:"rounded-sm border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] px-1.5 py-0.5 font-mono text-xs text-[var(--scout-chrome-ink-soft)]",title:`${r.count} ${r.label}`,children:[r.label," ",r.count]},r.label))})}function j({children:t}){return e.jsx("div",{className:"text-xs font-mono uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-ghost)]",children:t})}function m({label:t,children:n}){return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"mb-1.5 text-2xs font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:t}),n]})}function x({label:t,value:n}){return e.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[e.jsx("span",{className:"shrink-0 text-xs font-mono uppercase tracking-wider text-[var(--scout-chrome-ink-faint)]",children:t}),e.jsx("span",{className:"truncate text-sm font-mono text-[var(--scout-chrome-ink)]",children:n})]})}export{be as SessionsInspector};
@@ -1 +0,0 @@
1
- import{r as d,j as e}from"./index-DMiGbrBt.js";import{u as k}from"./Provider-C7UKGHQy.js";import{c as y}from"./colors-BtO5_zlx.js";import{A as S}from"./AgentAvatar-D90c1Rzk.js";import{t as N}from"./time-DltNTpLl.js";import{f as w}from"./text-DsBWV_4k.js";import{c as I}from"./clipboard-e3fSpeo7.js";import{f as T,r as C,t as R}from"./terminal-sessions-D5CIR2OL.js";import"./router-Bq5dwf78.js";import"./api-h5zurxmi.js";import"./sse-CjIkKo46.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-bARZqTzD.js";import"./DocumentFocusViewer-BeVwwl26.js";import"./createLucideIcon-OpA4Amw5.js";import"./TextDocumentSurface-BpAw4eQS.js";/* empty css */import"./file-text-BODxCjcz.js";import"./x-D3GElQbe.js";import"./chevron-right-XiIHsk4m.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-2kv_tGUS.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./NewChatComposer-Cs6OsxK6.js";import"./runtime-picker-Bcl5iIX5.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-CbHjZsz1.js";import"./index-CJXzfjo9.js";import"./HarnessMark-Cbv3Ib0c.js";import"./conversation-model-B47vYmWN.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./chevron-down-BGk5qoEw.js";import"./search-CWfZtOt2.js";import"./SpriteAvatar-DyaGuhik.js";function ke(){const{route:t,agents:o,navigate:s}=k();if(t.view!=="terminal")return null;const r=t.agentId?o.find(i=>i.id===t.agentId)??null:null,l=t.mode??"takeover",[f,p]=d.useState(null);d.useEffect(()=>{if(t.view!=="terminal"||t.agentId||!t.terminalSurfaceKey){p(null);return}let i=!1;return T().then(g=>{i||p(C(g,t.terminalSessionId,t.terminalSurfaceKey))}).catch(()=>{i||p(null)}),()=>{i=!0}},[t.agentId,t.terminalSessionId,t.terminalSurfaceKey,t.view]);const j=f?R(f.surface):null,n=(r?$(r):null)??j,c=d.useMemo(()=>n?A(n):null,[n]);return r?e.jsxs("div",{className:"flex h-full flex-col gap-4 overflow-y-auto p-4 text-sm frame-scrollbar",children:[e.jsx(D,{agent:r}),e.jsxs(u,{label:"Terminal",children:[e.jsx(a,{label:"Mode",value:v(l)}),e.jsx(a,{label:"Backend",value:n?.backend??"pty"}),n&&e.jsx(a,{label:"Session",value:n.sessionName}),n?.paneId&&e.jsx(a,{label:"Pane",value:n.paneId}),e.jsx(a,{label:"State",value:y(r.state)})]}),c&&e.jsx(h,{label:"Open in your own terminal",command:c}),e.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[n&&e.jsx(m,{active:l==="observe",label:"Observe",onClick:()=>s(b(r.id,"observe"))}),e.jsx(m,{active:l==="takeover",label:"Takeover",onClick:()=>s(b(r.id,"takeover"))}),e.jsx(m,{label:"Profile",onClick:()=>s({view:"agents-v2",agentId:r.id,tab:"profile"})}),e.jsx(m,{label:"Trace",onClick:()=>s({view:"agents-v2",agentId:r.id,tab:"observe"})})]}),e.jsxs(u,{label:"Agent",children:[e.jsx(a,{label:"Harness",value:r.harness??"-"}),e.jsx(a,{label:"Transport",value:r.transport??"-"}),r.role&&e.jsx(a,{label:"Role",value:w(r.role)??r.role}),r.handle&&e.jsx(a,{label:"Handle",value:`@${r.handle}`}),r.updatedAt&&e.jsx(a,{label:"Updated",value:N(r.updatedAt)})]}),(r.project||r.branch||r.cwd||r.projectRoot)&&e.jsxs(u,{label:"Workspace",children:[r.project&&e.jsx(a,{label:"Name",value:r.project}),r.branch&&e.jsx(a,{label:"Branch",value:r.branch}),r.cwd&&e.jsx(a,{label:"Cwd",value:r.cwd}),!r.cwd&&r.projectRoot&&e.jsx(a,{label:"Root",value:r.projectRoot})]})]}):e.jsxs("div",{className:"flex h-full flex-col gap-4 overflow-y-auto p-4 text-sm frame-scrollbar",children:[e.jsxs(u,{label:"Terminal",children:[e.jsx(a,{label:"Mode",value:v(l)}),t.agentId&&e.jsx(a,{label:"Agent",value:t.agentId}),n&&e.jsx(a,{label:"Backend",value:n.backend}),n&&e.jsx(a,{label:"Session",value:n.sessionName})]}),c&&e.jsx(h,{label:"Open in your own terminal",command:c})]})}function x(t){return/^[A-Za-z0-9_./:@%+=,-]+$/u.test(t)?t:`'${t.replace(/'/gu,"'\\''")}'`}function A(t){return t.backend==="tmux"?`tmux attach -t ${x(t.sessionName)}`:`${t.socketDir?`ZELLIJ_SOCKET_DIR=${x(t.socketDir)} `:""}zellij attach ${x(t.sessionName)}`}function b(t,o){return{view:"terminal",agentId:t,mode:o}}function $(t){return t.terminalSurface?t.terminalSurface:t.transport==="tmux"&&t.harnessSessionId?{backend:"tmux",sessionName:t.harnessSessionId,paneId:null,socketDir:null}:null}function v(t){return t==="observe"?"Read-only observe":"Interactive takeover"}function D({agent:t}){return e.jsx("div",{className:"border-b border-[var(--scout-chrome-border-soft)] pb-3",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(S,{agent:t,placement:"row",size:32,presence:!1}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-lg leading-snug text-[var(--scout-chrome-ink-strong)]",children:t.name}),t.handle&&e.jsxs("div",{className:"truncate font-mono text-xs text-cyan-400/70",children:["@",t.handle]})]})]})})}function m({active:t,label:o,onClick:s}){return e.jsx("button",{type:"button",onClick:s,className:`h-7 rounded border px-2 font-mono text-2xs uppercase tracking-[0.1em] transition-colors ${t?"border-cyan-400/35 bg-cyan-400/[0.12] text-cyan-200":"border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] text-[var(--scout-chrome-ink-soft)] hover:bg-[var(--scout-chrome-active)] hover:text-[var(--scout-chrome-ink)]"}`,children:o})}function h({label:t,command:o}){const[s,r]=d.useState(!1);return e.jsxs("details",{className:"rounded border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] p-2",children:[e.jsx("summary",{className:"cursor-pointer select-none font-mono text-2xs uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:t}),e.jsx("div",{className:"mb-1.5 mt-2 flex items-center justify-end gap-2",children:e.jsx("button",{type:"button",className:"rounded border border-cyan-400/20 bg-cyan-400/[0.08] px-2 py-1 font-mono text-2xs uppercase tracking-[0.1em] text-cyan-100/80 hover:bg-cyan-400/[0.14]",onClick:()=>{I(o).then(l=>{l&&(r(!0),window.setTimeout(()=>r(!1),1200))})},children:s?"Copied":"Copy"})}),e.jsx("code",{className:"block select-text break-all rounded bg-black/25 p-2 font-mono text-xs leading-relaxed text-[var(--scout-chrome-ink)]",children:o})]})}function u({label:t,children:o}){return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"mb-1.5 text-2xs font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:t}),o]})}function a({label:t,value:o}){return e.jsxs("div",{className:"flex items-baseline justify-between gap-2 py-0.5",children:[e.jsx("span",{className:"shrink-0 text-xs font-mono uppercase tracking-wider text-[var(--scout-chrome-ink-faint)]",children:t}),e.jsx("span",{className:"truncate text-right text-sm font-mono text-[var(--scout-chrome-ink)]",children:o})]})}export{ke as TerminalInspector};
@@ -1 +0,0 @@
1
- import{r as c,j as e}from"./index-DMiGbrBt.js";import{u as st}from"./Provider-C7UKGHQy.js";import{o as Ee}from"./openContent-C6XO6kr5.js";import{a as B}from"./api-h5zurxmi.js";import{u as nt}from"./sse-CjIkKo46.js";import{u as at}from"./tail-events-D19uAGe3.js";import{n as it,a as ct,s as Le,c as Re}from"./colors-BtO5_zlx.js";import{A as rt}from"./AgentLiveActions-DBtnD0qE.js";import{i as lt}from"./message-visibility-kJM8XcSG.js";import{o as ot,m as dt,c as Pe,q as ut}from"./conversation-model-B47vYmWN.js";import{c as mt,e as pt,t as W,f as ce}from"./time-DltNTpLl.js";import{T as ht}from"./TmuxPeek-m1osv33Q.js";import{S as vt}from"./scroll-text-D6Pdnar7.js";import"./router-Bq5dwf78.js";import"./terminal-sessions-D5CIR2OL.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-bARZqTzD.js";import"./DocumentFocusViewer-BeVwwl26.js";import"./createLucideIcon-OpA4Amw5.js";import"./TextDocumentSurface-BpAw4eQS.js";/* empty css */import"./file-text-BODxCjcz.js";import"./x-D3GElQbe.js";import"./chevron-right-XiIHsk4m.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-2kv_tGUS.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./NewChatComposer-Cs6OsxK6.js";import"./runtime-picker-Bcl5iIX5.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-CbHjZsz1.js";import"./index-CJXzfjo9.js";import"./HarnessMark-Cbv3Ib0c.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-BGk5qoEw.js";import"./search-CWfZtOt2.js";import"./index-BWHgHrtv.js";import"./terminal-takeover-B8UeD9OX.js";import"./eye-0PvebX_a.js";import"./terminal-B9AOZQKR.js";/* empty css */import"./refresh-cw-BBmAnCB7.js";const xt=20;function re(t){if(!t)return null;const s=t.replace(/[\\/]+$/,"");return s?s.split(/[\\/]/).filter(Boolean).at(-1)??s:null}function le(t){const s=t?.trim();return s?s.length>18?`${s.slice(0,8)}...${s.slice(-6)}`:s:null}function k(t){const s=new Set,a=[];for(const r of t){const m=r?.trim();if(!m)continue;const o=m.toLowerCase();s.has(o)||(s.add(o),a.push(m))}return a}function _e(t,s){const a=t?.trim().replace(/[\\/]+$/,""),r=s.trim().replace(/[\\/]+$/,"");if(!a||!r)return!1;if(a===r)return!0;if(r.startsWith("~/")){const m=r.slice(1);if(a.endsWith(m)||a.includes(`${m}/`))return!0}if(a.startsWith("~/")){const m=a.slice(1);if(r.endsWith(m)||r.includes(`${m}/`))return!0}return a.startsWith(`${r}/`)||r.startsWith(`${a}/`)}function Be(t,s){const a=t?.trim().toLowerCase(),r=s.trim().toLowerCase();return!a||!r?!1:a.includes(r)||r.includes(a)}function We(t,s){const a=t?.trim().toLowerCase(),r=s.trim().toLowerCase();return!a||!r?!1:a===r}function ft(t){const{activeSessionId:s,agent:a,sessionMeta:r}=t,m=k([s,a?.harnessSessionId]),o=k([a?.cwd,a?.projectRoot,r?.workspaceRoot]),i=k([a?.project,re(a?.cwd),re(a?.projectRoot),re(r?.workspaceRoot)]).filter(I=>I.length>2),j=k([...m.slice(0,2),...i.slice(0,2)]).join("|");return{sessionIds:m,paths:o,projects:i,query:j}}function ue(t,s){return!!(s.sessionIds.some(a=>Be(t.sessionId,a))||s.paths.some(a=>_e(t.cwd,a))||s.projects.some(a=>We(t.project,a)))}function jt(t,s){const a=s.filter(i=>ue(i,t)),r=k(a.filter(i=>t.sessionIds.some(j=>Be(i.sessionId,j))).map(i=>i.sessionId));if(r[0])return r[0];const m=k(a.filter(i=>t.paths.some(j=>_e(i.cwd,j))).map(i=>i.sessionId));if(m[0])return m[0];const o=k(a.filter(i=>t.projects.some(j=>We(i.project,j))).map(i=>i.sessionId));return o[0]?o[0]:t.paths[0]?t.paths[0]:t.sessionIds[0]?t.sessionIds[0]:t.projects[0]?t.projects[0]:t.query}function Y(t,s){const a=new Map;for(const r of[...s,...t])a.set(r.id,r);return[...a.values()].sort((r,m)=>mt(r.ts,m.ts)).slice(0,xt)}function gt(t){return t==="tool-result"?"tool result":t}function Nt(t){const s=t.replace(/\s+/g," ").trim();return s.length<=180?s:`${s.slice(0,177)}...`}const yt={direct:"Conversation",channel:"Conversation",group_direct:"Conversation",thread:"Thread"},wt=1800,It=4800,$e=2,St=120,Tt=650,bt=1800;function oe(t,s){try{return JSON.stringify(t)===JSON.stringify(s)?t:s}catch{return s}}function Me(t){if(!t)return null;const s=t.replace(/[\\/]+$/,"");return s?s.split(/[\\/]/).filter(Boolean).at(-1)??s:null}function kt(t){if(!t)return null;const s=t.replace(/[\\/]+$/,"");return s?s.replace(/^\/Users\/[^/]+(?=\/|$)/,"~"):null}function z(t){switch(t){case"queued":return"Queued";case"waking":return"Waking";case"waiting":return"Thinking";case"running":return"Working";default:return t.replace(/_/g," ")}}function Es(){const{route:t,agents:s,navigate:a,apiConnection:r,reload:m}=st(),o=t.view==="conversation"||t.view==="messages"?t.conversationId??null:null,[i,j]=c.useState(null),[I,me]=c.useState([]),[Z,pe]=c.useState(null),[ze,U]=c.useState(!1),F=c.useCallback(async()=>{if(!o){j(null),me([]),pe(null),U(!0);return}try{const[n,l,f]=await Promise.all([B(`/api/session/${encodeURIComponent(o)}`).catch(()=>null),B(`/api/flights?conversationId=${encodeURIComponent(o)}`).catch(()=>[]),B(`/api/messages?conversationId=${encodeURIComponent(o)}&limit=8`).catch(()=>[])]);j(p=>oe(p,n)),me(p=>oe(p,l??[])),pe(p=>oe(p,f?.filter(_=>!lt(_)).sort((_,tt)=>pt(_.createdAt,tt.createdAt)).at(-1)??null)),U(!0)}catch{U(!0)}},[o]);c.useEffect(()=>{U(!1),F()},[F]);const h=i?.agentId??null,u=c.useMemo(()=>h?s.find(n=>n.id===h)??null:null,[s,h]),[he,ve]=c.useState(null),[L,X]=c.useState([]),[S,G]=c.useState([]),xe=c.useRef([]),T=c.useRef(null),V=c.useRef(null),x=c.useRef([]),g=c.useRef(null),N=c.useRef(null),R=c.useRef(new Set),H=c.useCallback(()=>{T.current!==null&&(window.clearTimeout(T.current),T.current=null),V.current=null},[]),P=c.useCallback(()=>{if(!o)return;const n=Date.now(),l=V.current??n;V.current=l;const p=n-l>=It?0:wt;T.current!==null&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>{T.current=null,V.current=null,F()},p)},[o,F]);c.useEffect(()=>H,[H]),c.useEffect(()=>{if(ve(null),!h)return;let n=!1;return B(`/api/agents/${encodeURIComponent(h)}/session-catalog`).then(l=>{n||ve(l)}).catch(()=>{}),()=>{n=!0}},[h]);const Ue=ot({name:u?.name,agentName:i?.agentName,id:h,title:i?.title}),fe=u?dt(u)??Pe(u.id)??u.id:h?Pe(h)??h:null,d=c.useMemo(()=>I.filter(ut).sort((n,l)=>(l.startedAt??0)-(n.startedAt??0))[0]??null,[I]);c.useEffect(()=>{R.current=new Set(I.map(n=>n.invocationId))},[I]),c.useEffect(()=>{H(),R.current.clear()},[H,o]),nt(n=>{if(o){if(n.kind==="message.posted"){n.payload?.message?.conversationId===o&&P();return}if(n.kind==="conversation.upserted"){n.payload?.conversation?.id===o&&P();return}if(n.kind==="invocation.requested"){const l=n.payload?.invocation;if(l?.conversationId===o){R.current.add(l.id),P();return}!l?.conversationId&&h&&l?.targetAgentId===h&&(R.current.add(l.id),P());return}if(n.kind==="flight.updated"){const l=n.payload?.flight;if(!l)return;(d?.id===l.id||d?.invocationId===l.invocationId||R.current.has(l.invocationId)||I.some(p=>p.id===l.id||p.invocationId===l.invocationId))&&P()}}});const v=he?.activeSessionId??u?.harnessSessionId??i?.harnessSessionId??null,w=u?.harnessSessionId??i?.harnessSessionId??null,A=u?.harnessLogPath??null,y=c.useMemo(()=>ft({activeSessionId:v,agent:u,sessionMeta:i}),[v,u,i]),ee=JSON.stringify({sessionIds:y.sessionIds,paths:y.paths,projects:y.projects}),$=y.sessionIds.length>0||y.paths.length>0||y.projects.length>0,q=c.useCallback(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null),N.current!==null&&(window.clearInterval(N.current),N.current=null),x.current=[]},[]),O=c.useCallback(()=>{q()},[q]),je=c.useCallback(()=>{if(N.current!==null||(g.current!==null&&(window.clearTimeout(g.current),g.current=null),x.current.length===0))return;const l=()=>{const f=x.current.slice(0,$e);x.current=x.current.slice($e),f.length>0&&G(p=>Y(p,f)),!(x.current.length>0)&&N.current!==null&&(window.clearInterval(N.current),N.current=null)};l(),x.current.length>0&&(N.current=window.setInterval(l,St))},[]),ge=c.useCallback(n=>{N.current===null&&g.current===null&&(g.current=window.setTimeout(()=>{g.current=null,je()},n))},[je]);c.useEffect(()=>{xe.current=S},[S]),c.useEffect(()=>q,[q]),c.useEffect(()=>{O(),X([]),G([])},[O,ee]),c.useEffect(()=>{if(!$)return;let n=!1;const l=new URLSearchParams({limit:"180",transcripts:"true"});return B(`/api/tail/recent?${l.toString()}`).then(f=>{if(n)return;const p=(f.events??[]).filter(_=>ue(_,y));X(Y([],p))}).catch(()=>{}),()=>{n=!0}},[$,ee]),at(c.useCallback(n=>{$&&ue(n,y)&&X(l=>Y(l,[n]))},[$,ee])),c.useEffect(()=>{if(L.length===0){O(),G([]);return}const n=xe.current,l=new Set([...n.map(p=>p.id),...x.current.map(p=>p.id)]),f=L.filter(p=>!l.has(p.id));f.length!==0&&(x.current=Y(x.current,f),x.current.length>0&&ge(n.length===0?Tt:bt))},[ge,O,L]);const te=c.useMemo(()=>S.flatMap(Et).slice(0,5),[S]);if(!o)return e.jsx(At,{apiOffline:r.status==="offline",onRetry:()=>{m()}});if(!ze)return e.jsx("div",{className:"ctx-panel ctx-panel--conversation",children:e.jsx("div",{className:"ctx-panel-empty-state",children:e.jsx("div",{className:"ctx-panel-empty-hint",children:"Loading conversation…"})})});const Fe=i?.kind?yt[i.kind]??i.kind:"Conversation",D=i?.workspaceRoot??null,se=Me(D),K=kt(D),Ne=i?.currentBranch??null,ne=u?.harness??i?.harness??null,J=i?.lastMessageAt??Z?.createdAt??null,ye=i?.messageCount??null,we=i?i.participantIds.filter(n=>n!=="operator").length+1:null,C=u?.state??null,Ve=it(C),Ie=Z?.body?.trim()||i?.preview?.trim()||null,Se=Z?.actorName??null,Te=le(v),M=v??w,be=le(M),He=le(w),ke=!!(w&&w!==M),Ae=[ne,u?.transport].filter(Boolean).join(" · "),qe=!!(v||w||A),b=!!(u?.terminalSurface?.backend==="tmux"||u?.transport==="tmux"&&u.harnessSessionId),E=!!(d||ct(C,u)),Oe=E?d?z(d.state):"In motion":"At rest",De=d?.summary?.trim()??(J?`Last update ${W(J)??"recently"}`:"No recent activity recorded"),ae=[Ne?`branch ${Ne}`:null,ne,u?.transport].filter(Boolean),Ke=!!(se||K||ae.length>0),Je=E?"Live activity":b?"Terminal":"Activity",ie=d?.summary?.trim()??(v&&!b?"Terminal session is live.":S.length>0&&!b?"Streaming matching Tail events.":null),Q=jt(y,L),Qe=!!(u&&(d||v||L.length>0||b)),Ye=!b,Ze=v?b?"Terminal session":"Trace session":d?"Session starting":"Session context",Xe=v?be??v:d?z(d.state):"Waiting for a session id",Ce=v?[ne,u?.transport,d?z(d.state):null].filter(Boolean).join(" · "):d?.summary?.trim()??ie??null,Ge=()=>{h&&Ee(a,{view:"agent-info",conversationId:o},{returnTo:t})},et=()=>{Ee(a,{view:"ops",mode:"tail",...Q?{tailQuery:Q}:{}},{returnTo:t})};return e.jsxs("div",{className:"ctx-panel ctx-panel--conversation",children:[e.jsxs("section",{className:"ctx-panel-section ctx-panel-conversation-summary",children:[e.jsx("div",{className:"ctx-panel-section-label",children:Fe}),e.jsxs("div",{className:"ctx-panel-conversation-card",children:[e.jsx("div",{className:"ctx-panel-conversation-title",children:Ue}),fe&&e.jsxs("div",{className:"ctx-panel-conversation-handle",children:["@",fe]}),e.jsxs("div",{className:"ctx-panel-conversation-state",children:[e.jsx("span",{className:"ctx-panel-conversation-state-dot",style:{background:Le(C)}}),e.jsx("span",{children:Re(C)})]})]})]}),d&&e.jsxs("section",{className:"ctx-panel-section",children:[e.jsx("div",{className:"ctx-panel-section-label",children:"Now"}),e.jsxs("div",{className:"ctx-panel-conversation-flight",children:[e.jsxs("div",{className:"ctx-panel-conversation-flight-row",children:[e.jsx("span",{className:"ctx-panel-conversation-flight-label",children:z(d.state)}),d.startedAt&&e.jsx("span",{className:"ctx-panel-conversation-flight-time",children:W(d.startedAt)})]}),d.summary&&e.jsx("div",{className:"ctx-panel-conversation-flight-summary",children:d.summary})]})]}),e.jsxs("section",{className:"ctx-panel-section",children:[e.jsx("div",{className:"ctx-panel-section-label",children:"Workspace"}),Ke?e.jsxs("div",{className:"ctx-panel-workspace-card",children:[e.jsxs("div",{className:"ctx-panel-workspace-head",children:[e.jsx("div",{className:"ctx-panel-workspace-kicker",children:"Project"}),e.jsx("div",{className:"ctx-panel-workspace-title",title:D??se??void 0,children:se??"Unscoped workspace"})]}),K&&e.jsx("div",{className:"ctx-panel-workspace-path",title:D??K,children:K}),ae.length>0&&e.jsx("div",{className:"ctx-panel-workspace-strip",children:ae.map(n=>e.jsx("span",{className:"ctx-panel-workspace-chip",children:n},n))})]}):e.jsx("div",{className:"ctx-panel-empty",children:"No workspace metadata yet"})]}),qe&&e.jsxs("section",{className:"ctx-panel-section",children:[e.jsx("div",{className:"ctx-panel-section-label",children:"Session"}),e.jsxs("div",{className:"ctx-panel-session-card",children:[e.jsx("div",{className:"ctx-panel-session-head",children:e.jsxs("div",{className:"ctx-panel-session-primary",children:[Ae&&e.jsx("div",{className:"ctx-panel-session-kind",children:Ae}),M&&e.jsx("div",{className:"ctx-panel-session-id",title:M,children:be??M})]})}),(ke||A)&&e.jsxs("div",{className:"ctx-panel-session-meta",children:[ke&&w&&e.jsxs("div",{className:"ctx-panel-session-meta-item",children:[e.jsx("span",{children:"Harness session"}),e.jsx("strong",{title:w,children:He??w})]}),A&&e.jsxs("div",{className:"ctx-panel-session-meta-item",children:[e.jsx("span",{children:"Harness log"}),e.jsx("strong",{title:A,children:Me(A)??A})]})]})]})]}),e.jsxs("section",{className:"ctx-panel-section",children:[e.jsx("div",{className:"ctx-panel-section-label",children:"Activity"}),e.jsxs("div",{className:`ctx-panel-activity-card${E?" ctx-panel-activity-card--active":""}`,children:[e.jsxs("div",{className:"ctx-panel-activity-head",children:[e.jsx("span",{className:"ctx-panel-activity-dot",style:{background:E?"var(--green)":Le(C)}}),e.jsxs("div",{className:"ctx-panel-activity-main",children:[e.jsx("div",{className:"ctx-panel-activity-title",children:Oe}),e.jsx("div",{className:"ctx-panel-activity-sub",title:J?ce(J):void 0,children:De})]})]}),d&&e.jsxs("div",{className:"ctx-panel-activity-ledger",children:[e.jsx("span",{className:"ctx-panel-activity-ledger-label",children:z(d.state)}),d.startedAt&&e.jsx("span",{className:"ctx-panel-activity-ledger-time",title:ce(d.startedAt),children:W(d.startedAt)})]}),e.jsxs("div",{className:"ctx-panel-activity-facts",children:[typeof ye=="number"&&e.jsx(de,{label:"Messages",value:`${ye}`}),typeof we=="number"&&e.jsx(de,{label:"People",value:`${we}`}),Ve&&e.jsx(de,{label:"Agent",value:Re(C)})]})]})]}),Ie&&e.jsxs("section",{className:"ctx-panel-section ctx-panel-conversation-preview",children:[e.jsx("div",{className:"ctx-panel-section-label",children:Se?`Latest · ${Se}`:"Latest"}),e.jsx("div",{className:"ctx-panel-conversation-preview-body",children:Ie})]}),Qe&&u&&e.jsxs("section",{className:"ctx-panel-section ctx-panel-conversation-live-section",children:[e.jsxs("div",{className:"ctx-panel-section-label",children:[e.jsx("span",{children:Je}),Te&&e.jsx("span",{className:"ctx-panel-live-session",title:v??void 0,children:Te})]}),e.jsxs("div",{className:`ctx-panel-live-card${E?" ctx-panel-live-card--active":""}`,children:[e.jsxs("div",{className:`ctx-panel-live-session-card${E?" ctx-panel-live-session-card--active":""}`,children:[e.jsxs("div",{className:"ctx-panel-live-session-copy",children:[e.jsx("span",{children:Ze}),e.jsx("strong",{title:v??void 0,children:Xe}),Ce&&e.jsx("small",{children:Ce})]}),e.jsx("div",{className:"ctx-panel-live-session-pulse","aria-hidden":"true",children:e.jsx("span",{})})]}),e.jsx(rt,{agent:u,catalog:he,navigate:a,returnTo:t,variant:"compact",className:"ctx-panel-live-actions"}),ie&&e.jsx("div",{className:"ctx-panel-live-summary",children:ie}),b&&e.jsx(ht,{agentId:u.id,lines:24,columns:132,className:"ctx-panel-tmux-peek--conversation"}),te.length>0&&e.jsxs("div",{className:"ctx-panel-live-files","aria-live":"polite",children:[e.jsxs("div",{className:"ctx-panel-live-files-label",children:[e.jsx("span",{children:"Files"}),e.jsx("strong",{children:te.length})]}),e.jsx("ol",{className:"ctx-panel-live-file-list",children:te.map(n=>e.jsxs("li",{className:`ctx-panel-live-file ctx-panel-live-file--${n.tone}`,title:`${n.path} · ${n.verb}`,children:[e.jsx("span",{className:"ctx-panel-live-file-mark",children:n.mark}),e.jsx("span",{className:"ctx-panel-live-file-path",children:$t(n.path)}),e.jsx("span",{className:"ctx-panel-live-file-time",children:W(n.ts)})]},`${n.eventId}:${n.path}`))})]}),Ye&&e.jsx("div",{className:"ctx-panel-live-stream","aria-live":"polite",children:S.length>0?e.jsx("ol",{className:"ctx-panel-live-events",children:S.map(n=>e.jsxs("li",{className:"ctx-panel-live-event",children:[e.jsx("span",{className:"ctx-panel-live-event-kind",children:gt(n.kind)}),e.jsx("span",{className:"ctx-panel-live-event-summary",children:Nt(n.summary)}),e.jsx("span",{className:"ctx-panel-live-event-time",title:ce(n.ts),children:W(n.ts)})]},n.id))}):e.jsx("div",{className:"ctx-panel-live-stream-empty",children:"Waiting for matching Tail events"})}),$&&e.jsxs("button",{type:"button",className:"ctx-panel-live-tail-button",onClick:et,title:Q?`Tail filter: ${Q}`:"Open Tail",children:[e.jsx(vt,{size:13,strokeWidth:1.9,"aria-hidden":"true"}),e.jsx("span",{children:"Tail"})]})]})]}),h&&e.jsx("section",{className:"ctx-panel-section ctx-panel-conversation-profile-section",children:e.jsxs("button",{type:"button",className:"ctx-panel-roster-button ctx-panel-conversation-profile-button",onClick:Ge,children:[e.jsx("span",{className:"ctx-panel-roster-label",children:"Open agent profile"}),e.jsx("span",{className:"ctx-panel-roster-count",children:e.jsx("span",{children:"→"})})]})})]})}function At({apiOffline:t,onRetry:s}){return e.jsx("div",{className:"ctx-panel ctx-panel--conversation",children:e.jsx("div",{className:"ctx-panel-empty-state",children:e.jsxs("div",{className:"ctx-panel-empty-card","data-tone":t?"error":"neutral",children:[e.jsx("div",{className:"ctx-panel-empty-card-title",children:t?"Context unavailable":"No conversation selected"}),e.jsx("div",{className:"ctx-panel-empty-card-detail",children:t?"Scout context will load after the server reconnects.":"Select a chat to inspect participants, sessions, and recent activity."}),t&&e.jsx("button",{type:"button",className:"ctx-panel-empty-card-action",onClick:s,children:"Retry"})]})})})}function de({label:t,value:s}){return e.jsxs("div",{className:"ctx-panel-fact",children:[e.jsx("span",{className:"ctx-panel-fact-value",children:s}),e.jsx("span",{className:"ctx-panel-fact-label",children:t})]})}const Ct=/(?:["'`])?((?:~|\/|\.{1,2}\/|[A-Za-z0-9_.-]+\/)[^\s"'`),;]+?\.(?:ts|tsx|js|jsx|mjs|cjs|css|scss|swift|md|json|jsonc|yml|yaml|toml|sql|py|rs|go|sh|html|m|mm))(?:["'`])?/gi;function Et(t){const s=new Set,a=[],r=Lt(t.summary);for(const m of t.summary.matchAll(Ct)){const o=m[1]?.trim();if(!o)continue;const i=o.toLowerCase();s.has(i)||(s.add(i),a.push({eventId:t.id,path:o,verb:r,mark:Pt(r),tone:Rt(r),ts:t.ts}))}return a}function Lt(t){return/\b(created|create|wrote|write|edited|edit|modified|modify|updated|update|changed|change|patched|patch)\b/i.test(t)?"changed":/\b(read|opened|viewed|cat|sed)\b/i.test(t)?"read":"touched"}function Rt(t){return t==="changed"?"changed":t==="read"?"read":"touched"}function Pt(t){return t==="changed"?"+":t==="read"?"r":"·"}function $t(t){const s=t.replace(/[\\/]+$/g,""),a=s.split(/[\\/]/).filter(Boolean);return a.length<=2?s:`${a.at(-2)}/${a.at(-1)}`}export{Es as ConversationInspector};
@@ -1 +0,0 @@
1
- import{r as b,j as mn,n as ee,o as pn,p as Le,q as Ee,k as gn,t as hn,s as D,l as p,v as wn,w as K,x as In,y as vn}from"./index-DMiGbrBt.js";import{n as ne,e as Sn,g as Pe,h as bn,j as Ln}from"./terminal-sessions-D5CIR2OL.js";var ye=["local","url","sharedConfig","env"];function Re(e){const n=En(e),t=e.audienceIncludes??Pn(e.audienceOrder),s=new Set;function o(i){!e.warnOnUnknown||s.has(i)||(s.add(i),typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[hudsonkit/flags] Unknown feature flag "${i}" resolved false.`))}const a=e.registry;function d(i){const l=a[i];if(!l)return o(i),{key:i,enabled:!1,value:!1,layer:"default",audience:n,reason:"unknown-flag"};const u=yn(e.layers,i);return u?{key:i,enabled:u.value,value:u.value,layer:u.layer,audience:n,requiredTier:l.tier,reason:"override",definition:l}:l.defaultEnabled?l.tier&&!t(n,l.tier)?{key:i,enabled:!1,value:!1,layer:"default",audience:n,requiredTier:l.tier,reason:"audience-denied",definition:l}:{key:i,enabled:!0,value:!0,layer:"default",audience:n,requiredTier:l.tier,reason:"default",definition:l}:{key:i,enabled:!1,value:!1,layer:"default",audience:n,requiredTier:l.tier,reason:"default",definition:l}}return{registry:e.registry,isEnabled:i=>d(String(i)).enabled,explain:i=>d(String(i)),all:()=>Object.keys(e.registry).sort().map(d),audience:()=>n}}function En(e){let n=e.audience.tier;for(const t of ye.slice().reverse()){const s=e.layers?.[t]?.audience;s&&(n=s)}return{...e.audience,tier:n}}function Pn(e){return(n,t)=>{if(n.tier===t)return!0;if(!e||e.length===0)return!1;const s=e.indexOf(n.tier),o=e.indexOf(t);return s<0||o<0?!1:s>=o}}function yn(e,n){for(const t of ye){const s=Rn(e?.[t]?.flags?.[n]);if(s!==null)return{layer:t,value:s}}return null}function Rn(e){return e===!0||e==="on"?!0:e===!1||e==="off"?!1:null}function $n(e){if(e===!0||e===!1)return e;if(typeof e=="number"){if(e===1)return!0;if(e===0)return!1}if(typeof e!="string")return;const n=e.trim().toLowerCase();if(["1","true","on","yes","enabled","enable"].includes(n))return!0;if(["0","false","off","no","disabled","disable"].includes(n))return!1;if(["default","null","unset","clear"].includes(n))return"default"}function An(e,n={}){const t=n.paramPrefix??"ff.",s=n.audienceParam??"ffAudience",o=typeof e=="string"?new URL(e,"http://hudson.local"):e,a={};let d;for(const[i,l]of o.searchParams.entries()){if(i===s&&l.trim()&&(d=l.trim()),!i.startsWith(t))continue;const u=i.slice(t.length),h=$n(l);u&&h!==void 0&&(a[u]=h)}return{flags:a,audience:d}}var O=1;function $e(e){if(typeof window>"u")return{version:O};try{const n=window.localStorage?.getItem(e);return Un(n)}catch{return{version:O}}}function V(e,n){if(typeof window>"u")return;const t=Ae(n),s=JSON.stringify(t);try{window.localStorage?.setItem(e,s)}catch{}Cn(e,s)}function Un(e){if(!e)return{version:O};try{const n=JSON.parse(e);return!n||typeof n!="object"?{version:O}:Ae(n)}catch{return{version:O}}}function Ae(e){const n={version:O};if(e.audience&&(n.audience=e.audience),e.flags&&typeof e.flags=="object"){n.flags={};for(const[t,s]of Object.entries(e.flags))(s===!0||s===!1)&&(n.flags[t]=s);Object.keys(n.flags).length===0&&delete n.flags}return n}function Cn(e,n){if(!(typeof document>"u"))try{const t=encodeURIComponent(n);document.cookie=`${encodeURIComponent(e)}=${t}; Path=/; SameSite=Lax; Max-Age=31536000`}catch{}}var _n="hudson.flags",Ue=b.createContext(null);function Kt({registry:e,audience:n,audienceOrder:t,audienceIncludes:s,initialLayers:o,storageKey:a=_n,warnOnUnknown:d=!1,children:i}){const[l,u]=b.useState(()=>{const g=o?.local;return{version:1,audience:g?.audience??void 0,flags:Fn(g)}});b.useEffect(()=>{const g=$e(a);(g.audience||Object.keys(g.flags??{}).length>0)&&u(g)},[a]);const h=b.useMemo(()=>({...o,local:{...o?.local,audience:l.audience??o?.local?.audience,flags:{...o?.local?.flags??{},...l.flags??{}}}}),[o,l]),R=b.useMemo(()=>Re({registry:e,audience:n,audienceOrder:t,audienceIncludes:s,layers:h,warnOnUnknown:d}),[e,n,t,s,h,d]),_=b.useMemo(()=>({...R,layers:h,storageKey:a,setLocalOverride:(g,A)=>{u(P=>{const F={...P.flags??{}};A===null?delete F[g]:F[g]=A;const U={...P,version:1,flags:F};return V(a,U),U})},setLocalAudienceOverride:g=>{u(A=>{const P={...A,version:1,audience:g??void 0};return V(a,P),P})},resetLocalOverrides:()=>{const g={version:1};V(a,g),u(g)}}),[R,h,a]);return mn.jsx(Ue.Provider,{value:_,children:i})}function Ce(){return b.useContext(Ue)}function Yt(){const e=Ce();if(!e)throw new Error("useFeatureFlags must be used within FeatureFlagsProvider");return e}function Qt(e,n=!0){return Ce()?.isEnabled(e)??n}function Fn(e){if(!e?.flags)return;const n={};for(const[t,s]of Object.entries(e.flags))(s===!0||s===!1)&&(n[t]=s);return Object.keys(n).length>0?n:void 0}const Dn=["ops.control","ops.mesh","ops.runtime","ops.plans","ops.terminal"],On=["surface.search","surface.sessions","surface.briefings","surface.work","surface.activity","surface.follow","surface.scoutbot","surface.workflows"];function ue(e,n){return Object.fromEntries(e.map(t=>[t,n]))}const _e={label:"Surface · Scope",description:`Scope presentation on Scout infra — lean lanes/tail/sessions/agents at ${pn}/*.`,defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","scope","observability"]},Tn={..._e,label:"Surface · Scope (legacy alias)",description:`Legacy alias for ${ee}. Prefer the primary flag; ${Le} remains for old dev links.`},qt=ee;function kn(){return{audience:"everyone",flags:{"ops.control":!0,"ops.lanes":!0,...ue(Dn,!1),...ue(On,!1)}}}const Fe=["ffBundle","ffVariant","scoutBundle","scoutExperience","ab"],De=["ffGlobal","scoutGlobalBundle"],Oe=["ffPersist","persistBundle"],jn=new Set(["no-ops","ffAudience",...Fe,...De,...Oe]);function Xt(e){for(const n of[...e.searchParams.keys()])(jn.has(n)||n.startsWith("ff."))&&e.searchParams.delete(n);return e}const xn=["everyone","internal","power"],Nn="openscout.flags",Y="openscout.flagBundle",Bn={tier:"power"},fe=["ops.control","ops.mesh","ops.runtime","ops.plans","ops.terminal","ops.lanes"],me=["surface.search","surface.sessions","surface.briefings","surface.work","surface.activity","surface.follow","surface.scoutbot","surface.realtime-voice","surface.workflows"],zn={"nav.sidebar":{label:"Nav · Sidebar",description:"Classic sidebar chrome (8 primary areas + icon rail). Default on since sco-083 soak; opt out with ?ff.nav.sidebar=off. Not included in max-pro.",defaultEnabled:!0,tier:"everyone",owner:"scout-web",tags:["nav","chrome"]},"ops.control":{label:"Ops · Control",description:"Mission control, issues, and the Ops section shell.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops","nav"]},"ops.mesh":{label:"Ops · Mesh",description:"Mesh topology and peer status.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"ops.runtime":{label:"Ops · Runtime",description:"Runtime / atop process telemetry.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"ops.plans":{label:"Ops · Plans",description:"Plan documents and plan-mode review.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"ops.terminal":{label:"Ops · Terminal",description:"Observe / takeover terminal sessions.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"ops.lanes":{label:"Ops · Agent Lanes",description:"One column per local agent — follow live harness work in power-user mode.",defaultEnabled:!0,tier:"power",owner:"scout-web",tags:["ops"]},"surface.search":{label:"Surface · Search",description:"Knowledge + indexer search as a top-level nav entry.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","nav"]},"surface.sessions":{label:"Surface · Sessions",description:"Standalone top-level Sessions entry (still reachable under Agents).",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","nav"]},"surface.briefings":{label:"Surface · Briefings",description:"Briefings list + detail.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface"]},"surface.work":{label:"Surface · Work",description:"Work item detail.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface"]},"surface.activity":{label:"Surface · Activity",description:"Activity stream.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface"]},"surface.follow":{label:"Surface · Follow",description:"Follow view.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface"]},"surface.scoutbot":{label:"Surface · Scoutbot",description:"Scoutbot assistant — the inspector panel, the status-bar broadcast chip, and the Message-Scout command-palette actions.",defaultEnabled:!0,tier:"everyone",owner:"scout-web",tags:["surface","assistant"]},"surface.realtime-voice":{label:"Surface · Realtime voice",description:"Live WebRTC voice conversations with Scoutbot through OpenAI Realtime.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","assistant","voice"]},"surface.workflows":{label:"Surface · Workflows",description:"Observed harness families / workflow topology telemetry on the Agents directory. Off in the lean view — the directory is just the project-grouped agent board.",defaultEnabled:!1,tier:"everyone",owner:"scout-web",tags:["surface","observability"]},[ee]:_e,[Le]:Tn},Mn={a:"light-prod",control:"light-prod",light:"light-prod","light-prod":"light-prod",prod:"light-prod",production:"light-prod",b:"max-pro",max:"max-pro","max-pro":"max-pro",pro:"max-pro",treatment:"max-pro",...hn},pe=new Set(["clear","default","none","reset","unset"]);function B(e,n){return Object.fromEntries(e.map(t=>[t,n]))}function Te(...e){const n={};for(const t of e)t.audience&&(n.audience=t.audience),t.flags&&Object.keys(t.flags).length>0&&(n.flags={...n.flags??{},...t.flags});return n}function te(e){switch(e){case"light-prod":return{audience:"everyone",flags:{...B(fe,!1),...B(me,!1)}};case"max-pro":return{audience:"power",flags:{...B(fe,!0),...B(me,!0)}};case gn:return kn()}}function k(e){return e?Mn[e.trim().toLowerCase()]??null:null}function Q(e,n){for(const t of n){const s=e.get(t);if(s!==null)return s}return null}function ke(e){const n=Q(e,Fe);return k(n)}function Gn(e){const n=Q(e,De);if(n){const d=n.trim().toLowerCase();if(pe.has(d))return{action:"clear"};const i=k(n);return i?{action:"set",bundle:i}:null}const t=Q(e,Oe);if(!t)return null;const s=t.trim().toLowerCase();if(pe.has(s))return{action:"clear"};if(["0","false","no"].includes(s))return null;const o=k(t);if(o)return{action:"set",bundle:o};const a=ke(e);return a?{action:"set",bundle:a}:null}function je(){if(typeof window>"u")return null;try{return k(window.localStorage.getItem(Y))}catch{return null}}function Wn(e){if(!(typeof window>"u"))try{e.action==="clear"?window.localStorage.removeItem(Y):window.localStorage.setItem(Y,e.bundle)}catch{}}function Jt(){return je()??k(Ee())??Ne}function xe(){const e=je();return e?te(e):{}}const Ne="light-prod";function Be(){const e=k(Ee())??Ne;return te(e)}function Vn(e){const n=Gn(e);n&&Wn(n)}function ze(e=new URLSearchParams(window.location.search)){const n=An(window.location.href),t=ke(e),s=t?te(t):{},o={audience:n.audience??s.audience,flags:{...s.flags??{},...n.flags??{}}};return e.has("no-ops")&&(o.flags={...o.flags,"ops.control":!1}),o}function Hn(){const e=$e(Nn);return{flags:e.flags,audience:e.audience??void 0}}function Zt(){if(typeof window>"u")return{};const e=new URLSearchParams(window.location.search);return Vn(e),{sharedConfig:Te(Be(),xe()),url:ze(e)}}function Kn(e){const n=typeof window>"u"?{}:{sharedConfig:Te(Be(),xe()),url:ze(),local:Hn()};return Re({registry:zn,audience:Bn,audienceOrder:xn,layers:n,warnOnUnknown:!1}).isEnabled(e)}function Me(){return Kn("ops.control")}const q={sm:408,md:512,lg:616},Ge=240,We=640,Yn=24,Ve="openscout:lane-deck:v1",Qn=new Set(["web.ops","macos.lanes","hud.tail","web.embed"]),se=new Set(["sm","md","lg"]),He={"web.ops":{defaultLaneWidth:"lg",showAutoLanes:!0},"macos.lanes":{defaultLaneWidth:"md",showAutoLanes:!0},"hud.tail":{defaultLaneWidth:"sm",showAutoLanes:!0,defaultHorizon:"30m"},"web.embed":{defaultLaneWidth:"md",showAutoLanes:!0}},qn=He["web.ops"];function oe(e){return Ke(e)?He[e]:qn}const M={pinned_left:0,main:1,pinned_right:2};function Ke(e){return Qn.has(e)}function es(e=window.location.search,n=window.location.pathname){const t=new URLSearchParams(e),s=t.get("profile")?.trim().toLowerCase();if(s&&Ke(s))return s;const o=t.get("embed")?.trim().toLowerCase();return o==="hud"?"hud.tail":o==="app"?"macos.lanes":n.includes("/lanes/embed")?"web.embed":(n.includes("/ops/lanes"),"web.ops")}function ns(e=window.location.search){const n=new URLSearchParams(e),t=(n.get("lanes")??n.get("size"))?.trim().toLowerCase();return t&&se.has(t)?t:"lg"}function ts(e,n){if(typeof e=="number"&&Number.isFinite(e))return Math.min(We,Math.max(Ge,Math.round(e)));const t=typeof e=="string"&&se.has(e)?e:n;return q[t]}function ss(e){const n=Math.min(We,Math.max(Ge,Math.round(e)));let t=null,s=Number.POSITIVE_INFINITY;for(const[o,a]of Object.entries(q)){const d=Math.abs(a-n);d<s&&(s=d,t=o)}return t&&s<=Yn?{px:q[t],tier:t}:{px:n,tier:null}}function ae(e,n,t){return{version:1,profileId:e,defaultLaneWidth:n??t.defaultLaneWidth,defaultHorizon:t.defaultHorizon,laneWidths:{},laneDefs:[],slots:[],showAutoLanes:t.showAutoLanes,updatedAt:Date.now()}}function ge(e,n){const t=oe(e);return ae(e,n,t)}function X(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="string"&&se.has(e))return e}function Xn(e){if(!e||typeof e!="object")return null;const n=e;return typeof n.id!="string"||!n.id.trim()||n.kind!=="session"&&n.kind!=="harness"&&n.kind!=="project"&&n.kind!=="attention"||typeof n.title!="string"||!n.title.trim()?null:{id:n.id.trim(),kind:n.kind,title:n.title.trim(),sessionId:typeof n.sessionId=="string"?n.sessionId.trim():void 0,harness:typeof n.harness=="string"?n.harness.trim():void 0,projectPath:typeof n.projectPath=="string"?n.projectPath.trim():void 0}}function Jn(e){if(!e||typeof e!="object")return null;const n=e;return typeof n.id!="string"||!n.id.trim()||typeof n.laneDefId!="string"||!n.laneDefId.trim()||n.zone!=="pinned_left"&&n.zone!=="main"&&n.zone!=="pinned_right"||typeof n.position!="number"||!Number.isFinite(n.position)?null:{id:n.id.trim(),laneDefId:n.laneDefId.trim(),zone:n.zone,position:n.position,width:X(n.width)}}function Ye(e,n,t,s){if(!e||typeof e!="object")return ae(n,t,s);const o=e,a=Array.isArray(o.laneDefs)?o.laneDefs.map(Xn).filter(u=>u!==null):[],d=Array.isArray(o.slots)?o.slots.map(Jn).filter(u=>u!==null):[],i={};if(o.laneWidths&&typeof o.laneWidths=="object")for(const[u,h]of Object.entries(o.laneWidths)){const R=X(h);R!==void 0&&(i[u]=R)}const l=X(o.defaultLaneWidth);return{version:1,profileId:n,defaultLaneWidth:(typeof l=="string"?l:void 0)??t??s.defaultLaneWidth,defaultHorizon:typeof o.defaultHorizon=="string"?o.defaultHorizon:s.defaultHorizon,laneWidths:i,laneDefs:a,slots:d,showAutoLanes:typeof o.showAutoLanes=="boolean"?o.showAutoLanes:s.showAutoLanes,updatedAt:typeof o.updatedAt=="number"?o.updatedAt:Date.now()}}function Zn(e,n,t){return Ye(e,n,t,oe(n))}function os(e,n){const t=oe(e),s=n??t.defaultLaneWidth;try{const o=localStorage.getItem(`${Ve}:${e}`);return o?Zn(JSON.parse(o),e,s):ge(e,s)}catch{return ge(e,s)}}function et(e){try{localStorage.setItem(`${Ve}:${e.profileId}`,JSON.stringify({...e,updatedAt:Date.now()}))}catch{}}function as(e){return[...e].sort((n,t)=>{const s=M[n.zone]-M[t.zone];return s!==0?s:n.position-t.position})}function rs(e,n){return M[e]-M[n]}function Qe(){return`slot:${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function re(e){return e.trim().toLowerCase().replace(/['"]/gu,"").replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function W(e){return`session:${e}`}function nt(e){return`harness:${re(e)}`}function tt(e){return`project:${re(e)}`}const st="attention:needs-input";function qe(e,n){const t=e.filter(s=>s.zone===n);return t.length===0?0:Math.max(...t.map(s=>s.position))+1}function Xe(e,n){const t=e.laneDefs.some(s=>s.id===n.id);return{...e,laneDefs:t?e.laneDefs.map(s=>s.id===n.id?n:s):[...e.laneDefs,n]}}function Je(e,n){const t=e.slots.some(s=>s.id===n.id);return{...e,slots:t?e.slots.map(s=>s.id===n.id?n:s):[...e.slots,n]}}function Ze(e,n){return{...e,slots:e.slots.filter(t=>t.laneDefId!==n)}}function ot(e,n){const t=W(n);return{...Ze(e,t),laneDefs:e.laneDefs.filter(s=>s.id!==t)}}function is(e,n){const t=W(n);return e.slots.some(s=>s.laneDefId===t&&s.zone!=="main")}function cs(e,n){const t=W(n),s=e.slots.find(o=>o.laneDefId===t);return!s||s.zone==="main"?null:s.zone}function ds(e,n){const t=n.zone??"pinned_left",s=W(n.laneId),o=ot(e,n.laneId),a=Xe(o,{id:s,kind:"session",title:n.title,sessionId:n.laneId});return Je(a,{id:Qe(),laneDefId:s,zone:t,position:qe(a.slots,t),width:n.width})}function ls(e,n){const t=n.zone??"pinned_left",s=n.kind==="attention"?st:n.kind==="harness"&&n.harness?nt(n.harness):n.kind==="project"&&n.projectPath?tt(n.projectPath):`${n.kind}:${re(n.title)}`,o=Ze(e,s),a=Xe(o,{id:s,kind:n.kind,title:n.title,harness:n.harness,projectPath:n.projectPath});return Je(a,{id:Qe(),laneDefId:s,zone:t,position:qe(a.slots,t),width:n.width})}function us(e,n,t){return{...e,laneWidths:{...e.laneWidths,[n]:t},updatedAt:Date.now()}}function fs(e,n){return{...e,defaultLaneWidth:n,updatedAt:Date.now()}}function ms(e){const n=new Set(e.slots.filter(t=>t.zone!=="main").map(t=>t.laneDefId));return{...e,slots:e.slots.filter(t=>t.zone==="main"),laneDefs:e.laneDefs.filter(t=>!n.has(t.id))}}const G="scope.lanes",J={defaultLaneWidth:"md",showAutoLanes:!0,defaultHorizon:"30m"},at="openscout:lane-deck:v1";function he(e){return ae(G,e,J)}function ps(e){const n=e??J.defaultLaneWidth;try{const t=localStorage.getItem(`${at}:${G}`);return t?Ye(JSON.parse(t),G,n,J):he(n)}catch{return he(n)}}function gs(e){et(e)}const rt=[p.lanes,p.tail,p.sessions,p.agents];function it(e){return rt.includes(e)}function ct(e){return e===In||e===vn}function en(e){return wn(e)}function H(e,n={}){switch(e){case p.tail:{const t=new URLSearchParams;n.tailQuery&&t.set("q",n.tailQuery);const s=t.toString();return D(e,s?`?${s}`:"")}case p.sessions:return n.sessionId?D(e,`/${encodeURIComponent(n.sessionId)}`):D(e);case p.lanes:return D(K);case p.agents:return D(e);default:return D(K)}}function nn(e){switch(e.view){case"ops":return!e.mode||e.mode==="lanes"?p.lanes:e.mode==="tail"?p.tail:null;case"sessions":return e.agentId?null:p.sessions;case"agents-v2":return e.agentId||e.projectSlug||e.sessionId||e.conversationId?null:p.agents;default:return null}}function dt(e){const n=nn(e);return n?n===p.tail&&e.view==="ops"?H(n,{tailQuery:e.tailQuery}):n===p.sessions&&e.view==="sessions"?H(n,{sessionId:e.sessionId}):H(n):null}function lt(e,n,t){if(!ct(e[0]))return null;const s=e[1]??K;if(!it(s))return{view:"ops",mode:"lanes"};switch(s){case p.tail:{const o=n.searchParams.get("q")?.trim();return{view:"ops",mode:"tail",...o?{tailQuery:o}:{}}}case p.sessions:return e[2]?t({view:"sessions",sessionId:decodeURIComponent(e[2])}):t({view:"sessions"});case p.agents:return t({view:"agents-v2"});case p.lanes:default:return{view:"ops",mode:"lanes"}}}const ut=new Set(["no-ops","ffBundle","ffVariant","scoutBundle","scoutExperience","ab","ffGlobal","scoutGlobalBundle","ffPersist","persistBundle","ffAudience","studio","studioInjection","studioMode"]),ft=["ff.","studio.","studioMode."];function mt(e){return ut.has(e)||ft.some(n=>e.startsWith(n))}function tn(e,n=""){const t=new URL(e,"http://scout.local");new URLSearchParams(n).forEach((a,d)=>{mt(d)&&(t.searchParams.has(d)||t.searchParams.set(d,a))});const o=t.searchParams.toString();return`${t.pathname}${o?`?${o}`:""}`}function hs(e){switch(e){case p.tail:return{view:"ops",mode:"tail"};case p.sessions:return{view:"sessions"};case p.agents:return{view:"agents-v2"};case p.lanes:default:return{view:"ops",mode:"lanes"}}}function pt(e=typeof window<"u"?window.location.pathname:""){return en(e)}function ws(){return G}function Is(e=pt()){return e?{"data-scope-presentation":!0}:void 0}function sn(e,n=typeof window<"u"?window.location.pathname:""){return en(n)?dt(e):null}function gt(e,n=typeof window<"u"?window.location.pathname:""){return sn(e,n)!==null}function vs(e,n=typeof window<"u"?window.location.pathname:""){return gt(e,n)?nn(e):null}const on=typeof window<"u"?window.location.href:"http://scout.local/";function ht(e){const n=e.toString();return new URL(n,on)}function wt(e){switch(e){case"profile":case"config":case"definitions":return e==="definitions"?"config":e;case"observe":case"message":return e;default:return}}function It(e){const n=e.trim().replace(/^#/,"");if(!n.startsWith("msg-"))return null;const t=n.slice(4).trim();if(!t)return null;try{return decodeURIComponent(t)}catch{return t}}function vt(e){switch(e){case"control":case"mission":case"command":case"warroom":case"conduct":case"conductor":return"mission";case"plan":return"plan";case"issues":case"errors":case"warnings":return"issues";case"agents":case"tail":case"atop":case"lanes":return e;default:return}}function St(e){return e==="delivered"||e==="failed"||e==="all"?e:void 0}function bt(e){return e==="indexer"||e==="knowledge"?e:void 0}function Lt(e){switch(e){case"pairing":case"agents":case"appearance":case"operator":case"comms":case"credentials":case"voice":case"devices":case"about":return e;case"communications":return"comms";default:return}}function Et(e){switch(e){case"tail":case"session":case"chat":case"work":return e;default:return}}function Pt(e){const n=e?.trim().replace(/\.+$/u,"");return n==="observe"||n==="takeover"?n:void 0}function yt(e){const n=e?.trim().toLowerCase();return n==="pty"||n==="tmux"||n==="zellij"||n==="herdr"?n:void 0}function Rt(e){const n=e?.trim().toLowerCase();return n==="shell"||n==="claude"||n==="codex"||n==="pi"?n:void 0}function $t(e){return e==="all"||e==="touched"?"all":e==="changed"?"changed":void 0}function we(e){if(!e)return;const n=Number.parseInt(e,10);return Number.isSafeInteger(n)&&n>0?n:void 0}function Ie(e){return e==="mission"?"control":e}function At(e){return e.searchParams.has("no-ops")?!1:typeof window>"u"?!0:Me()}function Ut(e){return e==="tail"}function Ct(e){return e==="lanes"}function an(e){return Ut(e)||Ct(e)}const ie="machineId",rn=new Set(["inbox","conversation","agents-v2","messages","sessions","repos","harnesses","mesh","activity","work","follow"]);function _t(e){return e.searchParams.get(ie)?.trim()||void 0}function Ft(e,n){return!n||!rn.has(e.view)?e:{...e,machineId:n}}function ce(e){return rn.has(e.view)}function Dt(e){return"machineId"in e&&e.machineId?e.machineId:null}function ve(e,n){if(!ce(e))return e;const t={...e},s=n?.trim();return s?t.machineId=s:delete t.machineId,t}function Ss(e){return ce(e)?{...e,machineId:""}:e}function Ot(e,n){return ce(e)?"machineId"in e?ve(e,e.machineId??null):ve(e,Dt(n)):e}function C(e,n){"machineId"in n&&n.machineId&&e.set(ie,n.machineId)}function I(e){const n=e.toString();return n?`?${n}`:""}function j(e,n){const t=new URLSearchParams;return C(t,n),`${e}${I(t)}`}function Tt(e){return"machineId"in e&&e.machineId?`:machine:${e.machineId}`:""}function cn(e){const n=ht(e),t=n.pathname.replace(/^\/+/,"").split("/").filter(Boolean),s=_t(n),o=r=>Ft(r,s),a=lt(t,n,o);if(a)return a;const d=It(n.hash),i=wt(n.searchParams.get("tab"))??(d?"message":void 0),l=n.searchParams.get("project")?.trim()||void 0,u=n.searchParams.get("agentId")?.trim()||void 0;if(t[0]==="agent"&&t[1])return{view:"agent-info",conversationId:decodeURIComponent(t[1])};const h=n.searchParams.get("project")?.trim()||void 0,R=n.searchParams.get("harness")?.trim()||void 0,_=n.searchParams.get("node")?.trim()||void 0,g=n.searchParams.get("set")?.trim(),A=g==="live"||g==="ephemeral"||g==="archived"?g:void 0,P=n.searchParams.get("view")?.trim(),F=P==="sessions"||P==="agents"?P:void 0,U=n.searchParams.get("state")?.trim(),de=U==="needs"||U==="live"||U==="idle"?U:void 0,fn=n.searchParams.get("ephemeral")==="1",N=n.searchParams.get("session")?.trim()||void 0,S=n.searchParams.get("select")?.trim()||void 0,E={...R?{harness:R}:{},..._?{node:_}:{},...A?{set:A}:{},...F?{indexView:F}:{},...de?{stateFilter:de}:{},...fn?{showEphemeral:!0}:{}};if(t[0]==="projects"){const r=t[1]?decodeURIComponent(t[1]):void 0;if(!r)return o({view:"agents-v2",...S?{selectedAgentId:S}:{},...E});if(t[2]==="agents"){const c=t[3]?decodeURIComponent(t[3]):void 0;if(c){if(t[4]==="c"&&t[5])return o({view:"agents-v2",projectSlug:r,agentId:c,conversationId:decodeURIComponent(t[5]),tab:i??"message",...E});const f=t[4]==="sessions"&&t[5]?decodeURIComponent(t[5]):N;return o({view:"agents-v2",projectSlug:r,agentId:c,...f?{sessionId:f}:{},...i?{tab:i}:{},...E})}return o({view:"agents-v2",projectSlug:r,indexView:"agents",...S?{selectedAgentId:S}:{},...E})}return t[2]==="sessions"?o({view:"agents-v2",projectSlug:r,indexView:"sessions",...t[3]?{sessionId:decodeURIComponent(t[3])}:{},...S?{selectedAgentId:S}:{},...E}):o({view:"agents-v2",projectSlug:r,...S?{selectedAgentId:S}:{},...E})}if(t[0]==="agents-v2"&&t[1]==="sessions"&&t[2])return o({view:"agents-v2",sessionId:decodeURIComponent(t[2]),...S?{selectedAgentId:S}:{},...h?{projectSlug:h}:{},...E});if(t[0]==="agents-v2"&&t[1]){const r=decodeURIComponent(t[1]);return o({view:"agents-v2",agentId:r,...i?{tab:i}:{},...N?{sessionId:N}:{},...h?{projectSlug:h}:{},...E})}if(t[0]==="agents-v2")return o({view:"agents-v2",...S?{selectedAgentId:S}:{},...h?{projectSlug:h}:{},...E});if(t[0]==="agents"&&t[1]){const r=decodeURIComponent(t[1]),c=t[2]==="sessions"&&t[3]?decodeURIComponent(t[3]):N;return t[2]==="c"&&t[3]?o({view:"agents-v2",agentId:r,conversationId:decodeURIComponent(t[3]),tab:i??"message",...E}):o({view:"agents-v2",agentId:r,...c?{sessionId:c}:{},...i?{tab:i}:{},...E})}if(t[0]==="agents")return o({view:"agents-v2",...S?{selectedAgentId:S}:{},...h?{projectSlug:h}:{},...E});if(t[0]==="agents.deprecated"&&t[1]&&t[2]==="sessions"&&t[3])return o({view:"sessions",agentId:decodeURIComponent(t[1]),sessionId:decodeURIComponent(t[3])});if(t[0]==="agents.deprecated"&&t[1]&&t[2]==="c"&&t[3])return o({view:"agents-v2",agentId:decodeURIComponent(t[1]),conversationId:decodeURIComponent(t[3]),tab:i??"message"});if(t[0]==="agents.deprecated"&&t[1]){const r=decodeURIComponent(t[1]);return o({view:"agents-v2",agentId:r,...i?{tab:i}:{},...!i&&l?{projectSlug:l}:{}})}if(t[0]==="agents.deprecated")return o({view:"agents-v2",...l?{projectSlug:l}:{}});if(t[0]==="fleet")return o({view:"inbox"});if(t[0]==="c"&&t[1])return o({view:"conversation",conversationId:decodeURIComponent(t[1])});if(t[0]==="flights"&&t[1]&&t[2]==="observe"){const r=n.searchParams.get("session")?.trim()||void 0,c=n.searchParams.get("compare")?.trim()||void 0;return o({view:"sessions",flightId:decodeURIComponent(t[1]),...r?{sessionId:r}:{},...c?{compareSessionId:c}:{}})}if(t[0]==="sessions"&&t[1])return o({view:"sessions",sessionId:decodeURIComponent(t[1]),...u?{agentId:u}:{}});if(t[0]==="conversations")return o({view:"messages"});if(t[0]==="messages"){const r={view:"messages",...t[1]?{conversationId:decodeURIComponent(t[1])}:{}};return o(r)}if(t[0]==="sessions")return o({view:"sessions",...u?{agentId:u}:{}});if(t[0]==="repos"){const r=n.searchParams.get("root")?.trim()||void 0;return o({view:"repos",...r?{root:r}:{}})}if(t[0]==="providers"||t[0]==="harnesses")return o({view:"harnesses"});if(t[0]==="repo-diff"){const r=n.searchParams.get("path")?.trim();if(r){const c=n.searchParams.getAll("layer").filter(w=>w==="unstaged"||w==="staged"||w==="branch"),f=n.searchParams.getAll("file").map(w=>w.trim()).filter(Boolean),m=n.searchParams.get("sessionId")?.trim()||void 0,v=n.searchParams.get("agentId")?.trim()||void 0,L=$t(n.searchParams.get("include"));return{view:"repo-diff",path:r,...c.length>0?{layers:c}:{},...f.length>0?{files:f}:{},...m?{sessionId:m}:{},...v?{agentId:v}:{},...L?{include:L}:{}}}}if(t[0]==="search"){const r=bt(t[1]),c=n.searchParams.get("hit")?.trim()||void 0;return{view:"search",...r&&r!=="knowledge"?{mode:r}:{},...c?{hitId:c}:{}}}if(t[0]==="channels"&&t[1])return o({view:"messages",conversationId:decodeURIComponent(t[1])});if(t[0]==="channels")return o({view:"messages"});if(t[0]==="mesh")return o({view:"mesh"});if(t[0]==="dispatch"||t[0]==="broker"){const r=n.searchParams.get("attempt")?.trim()||void 0,c=St(n.searchParams.get("filter"));return{view:"broker",...r?{attemptId:r}:{},...c&&c!=="all"?{filter:c}:{}}}if(t[0]==="code"){const r=n.searchParams.get("wt")?.trim()||void 0,c=n.searchParams.get("fromConversation")?.trim()||void 0,f=we(n.searchParams.get("line")),m=we(n.searchParams.get("endLine")),v=f&&m&&m>=f?m:void 0;if(t[1]){const $=decodeURIComponent(t[1]),y=t.length>2?t.slice(2).map(decodeURIComponent).join("/"):void 0;return{view:"code",project:$,...y?{path:y}:{},...r?{wt:r}:{},...f?{line:f}:{},...v?{endLine:v}:{},...c?{returnConversationId:c}:{}}}const L=n.searchParams.get("root")?.trim()||void 0,w=n.searchParams.get("file")?.trim()||void 0;return{view:"code",...L?{root:L}:{},...w?{file:w}:{},...r?{wt:r}:{},...f?{line:f}:{},...v?{endLine:v}:{},...c?{returnConversationId:c}:{}}}if(t[0]==="briefings"&&t[1])return{view:"briefings",briefingId:decodeURIComponent(t[1])};if(t[0]==="briefings")return{view:"briefings"};if(t[0]==="activity")return o({view:"activity"});if(t[0]==="voice")return{view:"voice"};if(t[0]==="work"&&t[1])return o({view:"work",workId:decodeURIComponent(t[1])});if(t[0]==="follow"){const r=Et(n.searchParams.get("view")),c={view:"follow",...r?{preferredView:r}:{}},f=t[1],m=t[2]?decodeURIComponent(t[2]):"";f==="flight"&&m&&(c.flightId=m),f==="invocation"&&m&&(c.invocationId=m),f==="conversation"&&m&&(c.conversationId=m),f==="work"&&m&&(c.workId=m),f==="session"&&m&&(c.sessionId=m),f==="agent"&&m&&(c.targetAgentId=m);const v=n.searchParams.get("flightId"),L=n.searchParams.get("invocationId"),w=n.searchParams.get("conversationId"),$=n.searchParams.get("workId"),y=n.searchParams.get("sessionId"),le=n.searchParams.get("targetAgentId");return v&&(c.flightId=v),L&&(c.invocationId=L),w&&(c.conversationId=w),$&&(c.workId=$),y&&(c.sessionId=y),le&&(c.targetAgentId=le),o(c)}if(t[0]==="settings"){if(t[1]==="agents")return{view:"settings",section:"agents",...t[2]?{agentId:decodeURIComponent(t[2])}:{}};const r=Lt(t[1]);return{view:"settings",...r?{section:r}:{}}}if(t[0]==="terminal"){const r=Pt(n.searchParams.get("mode")),c=n.searchParams.get("session")?.trim()||void 0,f=Sn(n.searchParams.get("surface"))??void 0;if(t[1]==="new"){const v=yt(n.searchParams.get("backend"))??"pty",L=Rt(n.searchParams.get("agent"))??"shell",w=n.searchParams.get("name")?.trim()||void 0,$=n.searchParams.get("tab")?.trim()||void 0,y=n.searchParams.get("socketDir")?.trim()||void 0;return{view:"terminal",terminalBackend:v,terminalAgent:L,...w?{terminalSessionName:w}:{},...$?{terminalTabId:$}:{},...y?{zellijSocketDir:y}:{}}}const m=t[1]==="s"&&t[2]?Pe(decodeURIComponent(t.slice(2).join("/")))?decodeURIComponent(t.slice(2).join("/")):null:bn(t[1]?decodeURIComponent(t[1]):void 0,t[2]?decodeURIComponent(t.slice(2).join("/")):void 0);return m?{view:"terminal",terminalSurfaceKey:m,...c?{terminalSessionId:c}:{},...r?{mode:r}:{}}:{view:"terminal",...t[1]?{agentId:decodeURIComponent(t[1])}:{},...r?{mode:r}:{},...!t[1]&&c?{terminalSessionId:c}:{},...!t[1]&&f?{terminalSurfaceKey:f}:{}}}if(t[0]==="ops"){const r=vt(t[1])??"mission";if(!an(r)&&!At(n))return o({view:"inbox"});const c=r==="tail"?n.searchParams.get("q")?.trim():"",f=r==="plan"?n.searchParams.get("plan")?.trim():"",m=n.searchParams.get("flightId")?.trim(),v=n.searchParams.get("invocationId")?.trim(),L=n.searchParams.get("conversationId")?.trim(),w=n.searchParams.get("workId")?.trim(),$=n.searchParams.get("sessionId")?.trim(),y=n.searchParams.get("targetAgentId")?.trim()??n.searchParams.get("agentId")?.trim();return{view:"ops",mode:r,...c?{tailQuery:c}:{},...f?{planDocumentId:f}:{},...m?{flightId:m}:{},...v?{invocationId:v}:{},...L?{conversationId:L}:{},...w?{workId:w}:{},...$?{sessionId:$}:{},...y?{targetAgentId:y}:{}}}return o({view:"inbox"})}function dn(e,n){const t=e.view==="sessions"&&e.flightId?null:sn(e,n);if(t)return t;switch(e.view){case"inbox":return j("/",e);case"conversation":{const s=new URLSearchParams;return C(s,e),`/c/${encodeURIComponent(e.conversationId)}${I(s)}`}case"agent-info":return`/agent/${encodeURIComponent(e.conversationId)}`;case"agents-v2":{const s=new URLSearchParams;e.harness&&s.set("harness",e.harness),e.node&&s.set("node",e.node),e.set&&s.set("set",e.set),!e.projectSlug&&e.indexView&&e.indexView!=="agents"&&s.set("view",e.indexView),e.stateFilter&&s.set("state",e.stateFilter),e.showEphemeral&&s.set("ephemeral","1"),e.selectedAgentId&&!e.agentId&&!e.sessionId&&s.set("select",e.selectedAgentId);const o=e.conversationId?"message":"profile";e.agentId&&e.tab&&e.tab!==o&&s.set("tab",e.tab),C(s,e);const a=e.projectSlug?`/projects/${encodeURIComponent(e.projectSlug)}`:null;return`${a?e.agentId?e.conversationId?`${a}/agents/${encodeURIComponent(e.agentId)}/c/${encodeURIComponent(e.conversationId)}`:e.sessionId?`${a}/agents/${encodeURIComponent(e.agentId)}/sessions/${encodeURIComponent(e.sessionId)}`:`${a}/agents/${encodeURIComponent(e.agentId)}`:e.sessionId?`${a}/sessions/${encodeURIComponent(e.sessionId)}`:e.indexView==="sessions"?`${a}/sessions`:e.indexView==="agents"?`${a}/agents`:a:e.agentId?e.conversationId?`/agents/${encodeURIComponent(e.agentId)}/c/${encodeURIComponent(e.conversationId)}`:e.sessionId?`/agents/${encodeURIComponent(e.agentId)}/sessions/${encodeURIComponent(e.sessionId)}`:`/agents/${encodeURIComponent(e.agentId)}`:e.sessionId?`/sessions/${encodeURIComponent(e.sessionId)}`:"/projects"}${I(s)}`}case"messages":{const s=new URLSearchParams;return C(s,e),`${e.conversationId?`/messages/${encodeURIComponent(e.conversationId)}`:"/messages"}${I(s)}`}case"sessions":{const s=new URLSearchParams;return e.agentId&&s.set("agentId",e.agentId),e.flightId?(e.sessionId&&s.set("session",e.sessionId),e.compareSessionId&&s.set("compare",e.compareSessionId),C(s,e),`/flights/${encodeURIComponent(e.flightId)}/observe${I(s)}`):(C(s,e),`${e.sessionId?`/sessions/${encodeURIComponent(e.sessionId)}`:"/sessions"}${I(s)}`)}case"repos":{const s=new URLSearchParams;return e.root&&s.set("root",e.root),C(s,e),`/repos${I(s)}`}case"harnesses":return j("/providers",e);case"repo-diff":{const s=new URLSearchParams;s.set("path",e.path);for(const o of e.layers??[])s.append("layer",o);for(const o of e.files??[])s.append("file",o);return e.sessionId&&s.set("sessionId",e.sessionId),e.agentId&&s.set("agentId",e.agentId),e.include&&s.set("include",e.include),`/repo-diff${I(s)}`}case"search":{const s=e.mode==="indexer"?"/search/indexer":"/search",o=new URLSearchParams;return e.hitId&&o.set("hit",e.hitId),`${s}${I(o)}`}case"mesh":return j("/mesh",e);case"broker":{const s=new URLSearchParams;return e.attemptId&&s.set("attempt",e.attemptId),e.filter&&e.filter!=="all"&&s.set("filter",e.filter),`/dispatch${I(s)}`}case"code":{const s=new URLSearchParams;if(e.wt&&s.set("wt",e.wt),e.line&&s.set("line",String(e.line)),e.line&&e.endLine&&e.endLine>=e.line&&s.set("endLine",String(e.endLine)),e.project){e.returnConversationId&&s.set("fromConversation",e.returnConversationId);const a=[encodeURIComponent(e.project)];return e.path&&a.push(...e.path.split("/").map(encodeURIComponent)),`${`/code/${a.join("/")}`}${I(s)}`}e.root&&s.set("root",e.root),e.file&&s.set("file",e.file),e.returnConversationId&&s.set("fromConversation",e.returnConversationId);const o=s.toString();return o?`/code?${o}`:"/code"}case"briefings":return e.briefingId?`/briefings/${encodeURIComponent(e.briefingId)}`:"/briefings";case"activity":return j("/activity",e);case"voice":return"/voice";case"work":return j(`/work/${encodeURIComponent(e.workId)}`,e);case"settings":return e.section==="agents"?e.agentId?`/settings/agents/${encodeURIComponent(e.agentId)}`:"/settings/agents":e.section?e.section==="pairing"?"/settings/pairing":e.section==="comms"?"/settings/comms":`/settings/${e.section}`:"/settings";case"ops":if(!e.mode)return"/ops";if(e.mode==="tail"||e.mode==="plan"){const s=new URLSearchParams;return e.mode==="tail"&&e.tailQuery&&s.set("q",e.tailQuery),e.mode==="plan"&&e.planDocumentId&&s.set("plan",e.planDocumentId),e.flightId&&s.set("flightId",e.flightId),e.invocationId&&s.set("invocationId",e.invocationId),e.conversationId&&s.set("conversationId",e.conversationId),e.workId&&s.set("workId",e.workId),e.sessionId&&s.set("sessionId",e.sessionId),e.targetAgentId&&s.set("targetAgentId",e.targetAgentId),`/ops/${Ie(e.mode)}${I(s)}`}return`/ops/${Ie(e.mode)}`;case"follow":{const s=new URLSearchParams;e.preferredView&&s.set("view",e.preferredView),e.flightId&&s.set("flightId",e.flightId),e.invocationId&&s.set("invocationId",e.invocationId),e.conversationId&&s.set("conversationId",e.conversationId),e.workId&&s.set("workId",e.workId),e.sessionId&&s.set("sessionId",e.sessionId),e.targetAgentId&&s.set("targetAgentId",e.targetAgentId),e.machineId&&s.set(ie,e.machineId);const o=s.toString();return`/follow${o?`?${o}`:""}`}case"terminal":if(e.agentId){const s=new URLSearchParams;return e.mode&&s.set("mode",e.mode),`/terminal/${encodeURIComponent(e.agentId)}${I(s)}`}{const s=new URLSearchParams;if(e.terminalBackend)return e.terminalBackend!=="pty"&&s.set("backend",e.terminalBackend),e.terminalAgent&&e.terminalAgent!=="shell"&&s.set("agent",e.terminalAgent),e.terminalSessionName&&s.set("name",e.terminalSessionName),e.terminalTabId&&s.set("tab",e.terminalTabId),e.zellijSocketDir&&s.set("socketDir",e.zellijSocketDir),`/terminal/new${I(s)}`;e.mode&&s.set("mode",e.mode);const o=Ln(e.terminalSurfaceKey);return o?`/terminal/${encodeURIComponent(o.backend)}/${encodeURIComponent(o.sessionName)}${I(s)}`:Pe(e.terminalSurfaceKey)?`/terminal/s/${encodeURIComponent(e.terminalSurfaceKey)}${I(s)}`:(e.terminalSessionId&&s.set("session",e.terminalSessionId),e.terminalSurfaceKey&&s.set("surface",e.terminalSurfaceKey),`/terminal${I(s)}`)}}}function x(e){const n=Tt(e);switch(e.view){case"conversation":return`conv:${e.conversationId}${n}`;case"agent-info":return`agent-info:${e.conversationId}`;case"settings":return`settings:${e.section??"pairing"}:${e.agentId??""}`;case"agents-v2":return["agents-v2",e.projectSlug??"",e.harness??"",e.node??"",e.set??"",e.indexView??"agents",e.stateFilter??"",e.showEphemeral?"eph":"",e.agentId??"",e.sessionId??"",n].join(":");case"sessions":return e.flightId?`flight-observe:${e.flightId}:${e.sessionId??""}:${e.compareSessionId??""}${n}`:e.sessionId?`session:${e.agentId??""}:${e.sessionId}${n}`:`sessions${n}`;case"messages":return e.conversationId?`messages:${e.conversationId}${n}`:`messages${n}`;case"work":return`work:${e.workId}${n}`;case"ops":return`ops:${e.mode??"plan"}:${e.tailQuery??""}:${e.planDocumentId??""}:${e.flightId??""}:${e.invocationId??""}:${e.workId??""}:${e.conversationId??""}:${e.sessionId??""}:${e.targetAgentId??""}`;case"search":return`search:${e.mode??"knowledge"}:${e.hitId??""}`;case"broker":return`broker:${e.attemptId??""}`;case"follow":return`follow:${e.flightId??e.invocationId??e.conversationId??e.workId??e.sessionId??e.targetAgentId??""}:${e.preferredView??""}${n}`;case"terminal":return`terminal:${e.agentId??""}:${e.terminalSessionId??""}:${e.terminalSurfaceKey??""}:${e.terminalBackend??""}:${e.terminalAgent??""}:${e.terminalSessionName??""}:${e.terminalTabId??""}:${e.mode??"detail"}`;case"repo-diff":return`repo-diff:${e.path}`;default:return`${e.view}${n}`}}function z(e,n){return ne(cn(`${e}${n}`))}function ln(e){return e?`#${e}`:""}function kt(e){return e.startsWith("/embed/")||e==="/ops/lanes/embed"}function Se(){if(typeof window>"u"){const e=new URL(on);return{pathname:e.pathname,searchStr:e.search,hash:e.hash.replace(/^#/,""),state:null}}return{pathname:window.location.pathname,searchStr:window.location.search,hash:window.location.hash.replace(/^#/,""),state:window.history.state}}function jt(e,n){return e.pathname===n.pathname&&e.searchStr===n.searchStr&&e.hash===n.hash&&Object.is(e.state,n.state)}function xt(e){let n=e.read();const t=new Set;let s=null;const o=()=>{const a=e.read();if(!jt(n,a)){n=a;for(const d of t)d()}};return{getSnapshot:()=>n,subscribe(a){return s||(s=e.observe(o)),t.add(a),()=>{t.delete(a)}},navigateTo(a,d={}){const i=d.state===void 0?n.state:d.state;d.replace?e.replace(a,i):e.push(a,i),o()}}}function Nt(){return typeof window>"u"?{read:Se,push:()=>{},replace:()=>{},observe:()=>()=>{}}:{read:Se,push:(e,n)=>window.history.pushState(n,"",e),replace:(e,n)=>window.history.replaceState(n,"",e),observe:e=>(window.addEventListener("popstate",e),window.addEventListener("hashchange",e),()=>{window.removeEventListener("popstate",e),window.removeEventListener("hashchange",e)})}}const T=xt(Nt());function Bt(){return b.useSyncExternalStore(T.subscribe,T.getSnapshot,T.getSnapshot)}function Z(e,n={}){T.navigateTo(e,n)}function bs(e){if(!e||typeof e!="object")return null;const n=e.returnTo;return!n||typeof n!="object"||typeof n.view!="string"?null:n}function Ls(e){return!e||typeof e!="object"?!1:e.returnUseHistory===!0}function be(e){if(!e||typeof e!="object")return e;const{returnTo:n,returnUseHistory:t,settingsEntry:s,...o}=e;return o}function zt(e,n){if(n.returnTo!==void 0){const t=n.state!==void 0?n.state:be(e),s=t&&typeof t=="object"?{...t}:{};return s.returnTo=n.returnTo,s.returnUseHistory=n.replace!==!0,s}return n.state!==void 0?n.state:n.replace?e:be(e)}function un(e){return e?e.replace(/^#/,""):""}function Mt(e,n,t={}){const s=z(e.pathname,e.searchStr),o=Ot(n,s),a=t.preserveSearch===!1?"":e.searchStr,d=tn(dn(o,e.pathname),a),i=un(t.hash);return{route:o,href:`${d}${i?`#${i}`:""}`}}function Gt(e,n){const t=new URLSearchParams(e.searchStr);for(const[a,d]of Object.entries(n.searchPatch??{}))d===null?t.delete(a):t.set(a,d);const s=t.toString(),o=n.hash===void 0?e.hash:un(n.hash);return`${e.pathname}${s?`?${s}`:""}${o?`#${o}`:""}`}function Es(e){const n=T.getSnapshot(),t=Gt(n,e),s=`${n.pathname}${n.searchStr}${ln(n.hash)}`;t!==s&&Z(t,{replace:e.replace??!0,state:e.state})}function Wt(e,n,t){if(kt(e))return null;const s=`${e}${n}`,o=cn(s),a=ne(o),d=tn(dn(a,e),n);return!(x(o)!==x(a)||a.view==="agents-v2"||s!==d)||s===d?null:`${d}${ln(t)}`}function Ps(){const{pathname:e,searchStr:n,hash:t}=Bt(),s=`${e}${n}`,o=b.useMemo(()=>z(e,n),[e,n]),a=b.useRef({}),d=b.useRef(s);b.useEffect(()=>{const l=Wt(e,n,t);l&&Z(l,{replace:!0})},[e,n,t]),b.useEffect(()=>{if(d.current===s)return;const l=z(e,n);requestAnimationFrame(()=>{window.scrollTo(0,a.current[x(l)]??0)}),d.current=s},[s,e,n]);const i=b.useCallback((l,u={})=>{const h=ne(l.view==="ops"&&!Me()&&!an(l.mode)?{view:"inbox"}:l),R=z(e,n),{route:_,href:g}=Mt({pathname:e,searchStr:n},h,u);a.current[x(R)]=window.scrollY;const A=T.getSnapshot().state,P=zt(A,u);Z(g,{replace:u.replace,state:P}),requestAnimationFrame(()=>{window.scrollTo(0,a.current[x(_)]??0)})},[e,n]);return{route:o,navigate:i}}export{ws as $,st as A,us as B,fs as C,ls as D,ms as E,Kt as F,is as G,cs as H,ss as I,We as J,Ge as K,ce as L,Ss as M,ps as N,gs as O,G as P,q as Q,qt as R,Nn as S,J as T,H as U,dt as V,pt as W,lt as X,tn as Y,gt as Z,kn as _,dn as a,sn as a0,_e as a1,vs as a2,Ps as a3,Yt as a4,je as a5,Jt as a6,te as a7,Wn as a8,Xt as a9,Ce as aa,Rn as ab,Dt as b,es as c,ns as d,Bt as e,bs as f,Ls as g,xn as h,Bn as i,zn as j,Zt as k,Es as l,hs as m,nn as n,en as o,Is as p,as as q,cn as r,ve as s,ts as t,Qt as u,rs as v,os as w,et as x,ds as y,ot as z};
@@ -1 +0,0 @@
1
- import{c as a}from"./createLucideIcon-OpA4Amw5.js";import{M as w}from"./message-square-DSaGpjFU.js";import{F as l}from"./file-text-BODxCjcz.js";import{S as c}from"./search-CWfZtOt2.js";import{T as k}from"./terminal-B9AOZQKR.js";import{C as y}from"./code-xml-B6jOCM4V.js";import{S as g}from"./scroll-text-D6Pdnar7.js";const O=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]],p=a("compass",O);const S=[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]],_=a("folder-kanban",S);const A=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],N=a("git-branch",A);const j=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],v=a("house",j);const E=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],u=a("send",E);const R=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],C=a("settings",R),M=[{id:"home",label:"Home",icon:v,defaultRoute:{view:"inbox"},section:"navigate"},{id:"chat",label:"Messages",icon:w,defaultRoute:{view:"messages"},section:"navigate"},{id:"projects",label:"Projects",icon:_,defaultRoute:{view:"agents-v2"},section:"navigate"},{id:"sessions",label:"Sessions",icon:l,defaultRoute:{view:"sessions"},section:"navigate"},{id:"dispatch",label:"Dispatch",icon:u,defaultRoute:{view:"broker"},section:"navigate"},{id:"search",label:"Search",icon:c,defaultRoute:{view:"search"},section:"navigate"},{id:"ops",label:"Operations",icon:p,defaultRoute:{view:"ops",mode:"mission"},section:"system"},{id:"settings",label:"Settings",icon:C,defaultRoute:{view:"settings",section:"appearance"},section:"system"}],d={inbox:"home",activity:"home",briefings:"home","agents-v2":"projects","agent-info":"projects",repos:"projects","repo-diff":"projects",code:"projects",sessions:"sessions",terminal:"sessions",messages:"chat",conversation:"chat",broker:"dispatch",work:"dispatch",follow:"dispatch",search:"search",ops:"ops",mesh:"ops",harnesses:"ops",settings:"settings",voice:"settings"},T=new Map(M.map(e=>[e.id,e]));function G(e){const i=T.get(e);if(!i)throw new Error(`Unknown primary area: ${e}`);return i}function se(e){if(e.view==="follow"&&e.preferredView)switch(e.preferredView){case"tail":return"ops";case"session":return"sessions";case"chat":return"chat";case"work":return"dispatch"}return d[e.view]}function ae(e,i){const t=G(e);return e==="ops"?i?.opsControlEnabled??!0?{view:"ops",mode:"mission"}:{view:"ops",mode:"tail"}:t.defaultRoute}function P(e){return e.view==="ops"&&(e.mode===void 0||e.mode==="mission"||e.mode==="issues")}const D=[{id:"home",label:"Home",route:{view:"inbox"},active:e=>e.view==="inbox"},{id:"projects",label:"Projects",route:{view:"agents-v2"},active:e=>e.view==="agents-v2"||e.view==="agent-info"},{id:"sessions",label:"Sessions",route:{view:"sessions"},active:e=>e.view==="sessions"},{id:"chat",label:"Messages",route:{view:"messages"},active:e=>e.view==="messages"||e.view==="conversation"},{id:"search",label:"Search",route:{view:"search"},active:e=>e.view==="search"},{id:"terminals",label:"Terminals",route:{view:"terminal"},active:e=>e.view==="terminal"},{id:"tail",label:"Live Activity",route:{view:"ops",mode:"tail"},active:e=>e.view==="ops"&&e.mode==="tail"},{id:"dispatch",label:"Dispatch",route:{view:"broker"},active:e=>e.view==="broker"},{id:"activity",label:"Activity Log",route:{view:"activity"},active:e=>e.view==="activity"},{id:"mesh",label:"Network",route:{view:"mesh"},active:e=>e.view==="mesh"},{id:"mission-control",label:"Mission Control",route:{view:"ops",mode:"mission"},active:P,capability:"ops.control"},{id:"lanes",label:"Agent Lanes",route:{view:"ops",mode:"lanes"},active:e=>e.view==="ops"&&e.mode==="lanes"},{id:"repos",label:"Repositories",route:{view:"repos"},active:e=>e.view==="repos"||e.view==="repo-diff"},{id:"code",label:"Code Browser",route:{view:"code"},active:e=>e.view==="code"},{id:"providers",label:"Agent Providers",route:{view:"harnesses"},active:e=>e.view==="harnesses"},{id:"runtime",label:"Runtime Monitor",route:{view:"ops",mode:"atop"},active:e=>e.view==="ops"&&e.mode==="atop",capability:"ops.control"},{id:"plans",label:"Plans",route:{view:"ops",mode:"plan"},active:e=>e.view==="ops"&&e.mode==="plan"},{id:"agent-config",label:"Agent Configuration",route:{view:"settings",section:"agents"},active:e=>e.view==="settings"&&e.section==="agents"}],x=new Map(D.map(e=>[e.id,e]));function s(e){const i=x.get(e);if(!i)throw new Error(`Unknown nav destination: ${e}`);return i}function n(e,i){const t=s(e);return{id:t.id,label:i?.label??t.label,route:i?.route??t.route,active:i?.active??t.active,capability:t.capability}}const V=[{destinationId:"home",key:"home"},{destinationId:"projects",key:"agents",label:"Projects"},{destinationId:"sessions",key:"sessions"},{destinationId:"chat",key:"chat",label:"Messages"}];function ne(){return V.map(e=>{const i=s(e.destinationId);return{key:e.key,label:e.label??i.label,route:i.route}})}const B=[{destinationId:"search",key:"search"},{destinationId:"terminals",key:"terminals"},{destinationId:"tail",key:"tail"},{destinationId:"dispatch",key:"dispatch"}],J=[{destinationId:"mission-control",key:"control"},{destinationId:"lanes",key:"lanes"},{destinationId:"repos",key:"repos"},{destinationId:"code",key:"code"},{destinationId:"providers",key:"providers"},{destinationId:"mesh",key:"mesh"},{destinationId:"runtime",key:"runtime"},{destinationId:"plans",key:"plans"}];function b(e){const i=n(e.destinationId,{label:e.label});return{key:e.key,label:i.label,route:i.route,active:i.active,destinationId:i.id,capability:i.capability}}function de(){return B.map(b)}function re(){return J.map(b)}function m(e){return{items:e.map(i=>{const t=n(i.destinationId,{label:i.label,route:i.route,active:i.active});return{id:i.id,label:t.label,route:t.route,active:t.active}})}}function U(){return[m([{destinationId:"agent-config",id:"config",label:"Agent Configuration"}])]}function F(){return[m([{destinationId:"lanes",id:"lanes"},{destinationId:"mission-control",id:"control"},{destinationId:"providers",id:"harnesses",label:"Agent Providers"},{destinationId:"mesh",id:"mesh"},{destinationId:"tail",id:"tail"},{destinationId:"runtime",id:"runtime"},{destinationId:"plans",id:"plans"}])]}const L=[{key:"h",label:"Go home",destinationId:"home"},{key:"i",label:"Go to messages",destinationId:"chat"},{key:"c",label:"Go to messages",destinationId:"chat"},{key:"p",label:"Go to projects",destinationId:"projects"},{key:"s",label:"Go to sessions",destinationId:"sessions"},{key:"t",label:"Go to terminals",destinationId:"terminals"},{key:"r",label:"Go to repositories",destinationId:"repos"},{key:"b",label:"Go to code browser",destinationId:"code"},{key:"f",label:"Go to search",destinationId:"search"},{key:"l",label:"Go to live activity",destinationId:"tail"},{key:"o",label:"Go to operations",destinationId:"mission-control",route:{view:"ops"}},{key:"d",label:"Go to dispatch",destinationId:"dispatch"},{key:"m",label:"Go to network",destinationId:"mesh"},{key:"a",label:"Go to activity log",destinationId:"activity"}];function le(){return L.map(e=>{const i=s(e.destinationId);return{key:e.key,label:e.label,route:e.route??i.route,destinationId:e.destinationId}})}const Y=[{destinationId:"sessions",id:"sessions",icon:l},{destinationId:"terminals",id:"terminals",icon:k},{destinationId:"repos",id:"repos",icon:N},{destinationId:"code",id:"code",icon:y},{destinationId:"search",id:"search",icon:c},{destinationId:"tail",id:"tail",icon:g},{destinationId:"mission-control",id:"ops",label:"Operations",icon:p,route:{view:"ops",mode:"mission"},opsGated:!0},{destinationId:"home",id:"home",icon:v},{destinationId:"dispatch",id:"dispatch",icon:u}];function ce(){return Y.map(e=>{const i=s(e.destinationId);return{id:e.id,label:e.label??i.label,icon:e.icon,route:e.route??i.route,destinationId:e.destinationId,opsGated:e.opsGated??i.capability==="ops.control"}})}const H=[{id:"nav:home",label:"Go to Home",destinationId:"home",shortcut:"Cmd+1"},{id:"nav:agents",label:"Go to Projects",destinationId:"projects",shortcut:"Cmd+2"},{id:"nav:messages",label:"Go to Chat",destinationId:"chat",shortcut:"Cmd+3"},{id:"nav:sessions",label:"Open Sessions",destinationId:"sessions"},{id:"nav:terminals",label:"Open Terminals",destinationId:"terminals"},{id:"nav:search",label:"Go to Search",destinationId:"search",shortcut:"Cmd+4"},{id:"nav:activity",label:"Open Activity",destinationId:"activity"},{id:"nav:mesh",label:"Open Mesh",destinationId:"mesh"},{id:"nav:dispatch",label:"Open Dispatch",destinationId:"dispatch"},{id:"nav:repos",label:"Open Repos",destinationId:"repos"},{id:"nav:code",label:"Open Code Browser",destinationId:"code"},{id:"nav:harnesses",label:"Open Providers",destinationId:"providers"},{id:"nav:ops-lanes",label:"Open Agent Lanes",destinationId:"lanes"},{id:"nav:ops",label:"Go to Ops",destinationId:"mission-control",route:{view:"ops"},shortcut:"Cmd+5",capability:"ops.control"},{id:"nav:ops-atop",label:"Open Runtime",destinationId:"runtime",capability:"ops.control"},{id:"nav:agent-config",label:"Open Agent Configuration",destinationId:"agent-config"}];function $(e){const i=e?.opsEnabled??!0;return H.filter(t=>!((t.capability??s(t.destinationId).capability)==="ops.control"&&!i)).map(t=>{const o=s(t.destinationId);return{id:t.id,label:t.label,destinationId:t.destinationId,route:t.route??o.route,shortcut:t.shortcut,capability:t.capability??o.capability}})}function pe(e,i){return $(i).map(t=>({id:t.id,label:t.label,action:()=>e(t.route),shortcut:t.shortcut}))}const h={projects:[{destinationId:"projects",id:"projects",label:"Projects"},{destinationId:"repos",id:"repos"},{destinationId:"code",id:"code"}],sessions:[{destinationId:"sessions",id:"sessions"},{destinationId:"terminals",id:"terminals"}]};function z(e){const i=n(e.destinationId,{label:e.label});return{id:e.id,label:i.label,route:i.route,active:i.active,destinationId:i.id}}function q(e){return h[e].map(z)}function ve(e){const i=d[e.view];if(i!=="projects"&&i!=="sessions")return null;const t=i;return{areaId:t,items:q(t)}}const r={...h,dispatch:[{destinationId:"dispatch",id:"dispatch-all",label:"All Dispatches",route:{view:"broker"},active:e=>e.view==="broker"&&(e.filter===void 0||e.filter==="all")},{destinationId:"dispatch",id:"dispatch-delivered",label:"Delivered",route:{view:"broker",filter:"delivered"},active:e=>e.view==="broker"&&e.filter==="delivered"},{destinationId:"dispatch",id:"dispatch-failed",label:"Failed",route:{view:"broker",filter:"failed"},active:e=>e.view==="broker"&&e.filter==="failed"}],ops:[{destinationId:"lanes",id:"lanes",label:"Lanes"},{destinationId:"mission-control",id:"control"},{destinationId:"providers",id:"harnesses",label:"Providers"},{destinationId:"runtime",id:"runtime",label:"Runtime"},{destinationId:"mesh",id:"mesh"},{destinationId:"tail",id:"tail"},{destinationId:"plans",id:"plans"}]};function K(e){const i=n(e.destinationId,{label:e.label,route:e.route,active:e.active});return{id:e.id,label:i.label,route:i.route,active:i.active,destinationId:i.id}}function ue(e,i){const t=d[e.view];if(!(t in r))return null;const o=t,I=r[o].map(K).filter(f=>s(f.destinationId).capability!=="ops.control"||i?.opsControlEnabled!==!1);return{areaId:o,items:I}}const be=U(),me=F();export{be as A,me as O,M as P,C as S,de as a,re as b,pe as c,ce as d,le as e,se as f,ae as g,G as h,ve as i,ne as p,ue as s};
@@ -1 +0,0 @@
1
- import{c as a}from"./createLucideIcon-OpA4Amw5.js";const c=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],o=a("paperclip",c);const e=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],p=a("sparkles",e);export{o as P,p as S};
@@ -1 +0,0 @@
1
- import{u as e}from"./router-Bq5dwf78.js";function n(){return!e("nav.sidebar",!1)}export{n as u};
@@ -1,50 +0,0 @@
1
- import{j as r,r as f}from"./index-DMiGbrBt.js";function pe({className:e,children:t}){return r.jsx("div",{className:e?`rd-viewer ${e}`:"rd-viewer","data-scout-theme":!0,children:t})}function k({children:e}){return r.jsx("div",{className:"rd-center",children:r.jsx("div",{className:"rd-center-card",children:e})})}const xe=["branch","unstaged","staged"],z={unstaged:"Unstaged",staged:"Staged",branch:"Branch"},we={added:"A",modified:"M",deleted:"D",renamed:"R",copied:"C",typechange:"T",conflict:"!",unknown:"?"};function J(e){return e.newPath??e.oldPath??"(unknown)"}function be(e){const t=e.split("/"),n=t[t.length-1]||e,i=t.slice(0,-1).join("/");return{name:n,dir:i}}function K(e,t){return`${e.oldPath??""}→${e.newPath??""}#${t}`}function ve(e){return e.files.reduce((t,n)=>({add:t.add+(n.additions??0),del:t.del+(n.deletions??0)}),{add:0,del:0})}function je(e,t,n=null){return{fetchedAt:e.fetchedAt,cacheHit:!0,refreshing:t,refreshError:n}}function Pe(e,t){return{fetchedAt:e.fetchedAt,cacheHit:e.cacheHit,refreshing:t,refreshError:null}}function B(e){const t=e.trim();return!t||t==="/dev/null"?null:t.startsWith("a/")||t.startsWith("b/")?t.slice(2):t}function Q(e,t){return[t.newPath,t.oldPath].filter(i=>!!i).includes(e)}function X(e,t){if(!e?.rawPatch)return[];const n=[];let i=null,s=null,c=null,o=null;for(const d of e.rawPatch.split(`
2
- `)){if(d.startsWith("diff --git ")){i=null,s=null,c=null,o=null;continue}if(d.startsWith("--- ")){i=B(d.slice(4));continue}if(d.startsWith("+++ ")){s=B(d.slice(4));continue}const a=/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/.exec(d);if(a){c=Number(a[1]),o=Number(a[2]);continue}if(c==null||o==null)continue;const l=s??i;l&&(t&&!Q(l,t)||(d.startsWith("+")?(n.push({layer:e.kind,filePath:l,side:"add",oldLine:null,newLine:o,text:d.slice(1)}),o+=1):d.startsWith("-")?(n.push({layer:e.kind,filePath:l,side:"del",oldLine:c,newLine:null,text:d.slice(1)}),c+=1):d.startsWith(" ")&&(n.push({layer:e.kind,filePath:l,side:"context",oldLine:c,newLine:o,text:d.slice(1)}),c+=1,o+=1)))}return n}function Z(e){return e.newLine!=null?`L${e.newLine}`:e.oldLine!=null?`old L${e.oldLine}`:"line"}function ee(e,t=160){const n=e.replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function ke(e){const{line:t}=e,n=t.side==="add"?"+":t.side==="del"?"-":" ";return`[Diff line: ${t.layer} · ${t.filePath}:${Z(t)} · ${n} ${ee(t.text)}]`}function ye(e){const{selection:t}=e;return[`[Diff selection: ${[t.layer??"diff",t.filePath].filter(Boolean).join(" · ")||"diff"}]`,t.text.trim(),"[/Diff selection]"].join(`
3
- `)}function U(e){const t=window.getSelection(),n=t?.toString().trim()??"";if(!t||!n||!e.root)return null;const i=t.anchorNode,s=t.focusNode;return i&&!e.root.contains(i)||s&&!e.root.contains(s)?null:{layer:e.activeLayer,filePath:e.selectedFile?J(e.selectedFile):null,text:n}}const te="1.2.7",E=`https://esm.sh/@pierre/diffs@${te}`,M={base:`${E}?external=react,react-dom`,react:`${E}/react?external=react,react-dom`,worker:`${E}/worker/worker.js`},V=["typescript","tsx","javascript","jsx","json","markdown","rust","swift","shellscript","yaml","css","html"];function ne(){return import(M.react)}function re(){return import(M.base)}let y=null;function H(){return y||(y=(async()=>{const e="react",t="react-dom/client",[n,i,s,c]=await Promise.all([ne(),re(),import(e),import(t)]),o=a=>typeof a=="function"||typeof a=="object"&&a!==null;if(!o(n?.CodeView)||!o(n?.WorkerPoolContextProvider)||typeof i?.parsePatchFiles!="function"||typeof s?.createElement!="function"||typeof c?.createRoot!="function")throw new Error(`Pierre loaded from ${E} but the expected exports are missing.`);const d=()=>{const a=`import ${JSON.stringify(M.worker)};`,l=URL.createObjectURL(new Blob([a],{type:"text/javascript"})),h=new Worker(l,{type:"module"});return URL.revokeObjectURL(l),h};return{CodeView:n.CodeView,PatchDiff:n.PatchDiff,WorkerPoolContextProvider:n.WorkerPoolContextProvider,parsePatchFiles:i.parsePatchFiles,preloadHighlighter:i.preloadHighlighter,workerFactory:d,createElement:s.createElement,createRoot:c.createRoot}})(),y.catch(()=>{y=null}),y)}let R=null;function ie(e,t){return R||(R=e.preloadHighlighter({themes:[t],langs:[...V]}).catch(()=>{R=null}),R)}function ae(e,t,n){return e.parsePatchFiles(t,n,!0)}const se=`
4
- [data-line-type="change-addition"]:is(
5
- :where([data-background]) [data-line],
6
- :where([data-background]) [data-no-newline]
7
- ),
8
- [data-line-type="change-deletion"]:is(
9
- :where([data-background]) [data-line],
10
- :where([data-background]) [data-no-newline]
11
- ) {
12
- --mix-light: var(--rd-diff-line-mix-light, 94%);
13
- --mix-dark: var(--rd-diff-line-mix-dark, 92%);
14
- }
15
-
16
- [data-line-type="change-addition"]:is(
17
- :where([data-background]) [data-gutter-buffer],
18
- :where([data-background]) [data-column-number]
19
- ) {
20
- --mix-light: var(--rd-diff-gutter-mix-light, 76%);
21
- --mix-dark: var(--rd-diff-gutter-mix-dark, 72%);
22
- --diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));
23
- }
24
-
25
- [data-line-type="change-deletion"]:is(
26
- :where([data-background]) [data-gutter-buffer],
27
- :where([data-background]) [data-column-number]
28
- ) {
29
- --mix-light: var(--rd-diff-gutter-mix-light, 76%);
30
- --mix-dark: var(--rd-diff-gutter-mix-dark, 72%);
31
- --diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));
32
- }
33
-
34
- [data-column-number]:is(
35
- [data-indicators="bars"] [data-line-type="change-addition"],
36
- [data-indicators="bars"] [data-line-type="change-deletion"]
37
- )::before {
38
- width: var(--rd-diff-spine-width, 6px);
39
- }
40
-
41
- [data-column-number]:is([data-indicators="bars"] [data-line-type="change-addition"])::before {
42
- background-color: var(--diffs-addition-base);
43
- }
44
-
45
- [data-column-number]:is([data-indicators="bars"] [data-line-type="change-deletion"])::before {
46
- background-color: var(--diffs-deletion-base);
47
- background-image: none;
48
- }
49
- `;function A(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function oe(e){const t=e,n=t?.type==="diff"?t.fileDiff:null;return[n?.name,n?.prevName].filter(i=>typeof i=="string"&&i.length>0)}function I(e,t,n){return n==="additions"?e.newLine===t:n==="deletions"?e.oldLine===t:e.newLine===t||e.oldLine===t}function le(e,t,n){return e.findIndex(i=>I(i,t,n))}function ce(e,t,n){for(let i=e.length-1;i>=0;i-=1)if(I(e[i],t,n))return i;return-1}function de(e){return e.map(t=>{const n=t.side==="add"?"+":t.side==="del"?"-":" ",i=t.newLine??t.oldLine,s=i!=null?`${i}: `:"";return`${n} ${s}${t.text}`}).join(`
50
- `)}function ue({range:e,item:t,lineContexts:n}){if(!e)return null;const i=A(e.start),s=A(e.end);if(i==null||s==null)return null;const c=oe(t),o=n.filter(N=>c.length===0||c.includes(N.filePath)),d=le(o,i,e.side),a=ce(o,s,e.endSide??e.side);if(d<0||a<0)return null;const l=Math.min(d,a),h=Math.max(d,a),P=o.slice(l,h+1);return P.length>0?P:null}function fe(e){return{layer:e[0]?.layer??null,filePath:e[0]?.filePath??null,text:de(e)}}function he(e,t){const n=e.createRoot(t);let i=null;const s=c=>{i=c};return{render({items:c,theme:o,layout:d,lineContexts:a=[],onIncludeLineContext:l,onIncludeSelectionContext:h}){n.render(e.createElement(e.WorkerPoolContextProvider,{poolOptions:{workerFactory:e.workerFactory},highlighterOptions:{theme:o,langs:[...V]}},e.createElement(e.CodeView,{className:"rd-codeview",items:c,options:{theme:o,diffStyle:d,diffIndicators:"bars",stickyHeaders:!0,unsafeCSS:se,enableGutterUtility:!!l,enableLineSelection:!!h,lineHoverHighlight:"number",onGutterUtilityClick:(P,N)=>{const w=ue({range:P,item:N,lineContexts:a});if(w){if(w.length===1&&l){l(w[0]);return}h&&h(fe(w))}}},ref:s})))},scrollToItem(c,o="smooth"){i?.scrollTo({type:"item",id:c,align:"start",behavior:o})},unmount(){n.unmount()}}}function Ne({layer:e,patchLayer:t,patchPhase:n,patchError:i,selectedFileKey:s,renderKey:c,theme:o,layout:d,pierre:a,pierrePhase:l,pierreError:h,onRetryPierre:P,onIncludeLineContext:N,onIncludeSelectionContext:w,contextActions:x=!0}){const $=f.useRef(null),[F,L]=f.useState(null),g=f.useMemo(()=>e?e.files.find((u,p)=>K(u,p)===s)??null:null,[e,s]),m=t??e,b=f.useMemo(()=>{if(!a||!m||!m.rawPatch)return null;try{const u=`${c}:${m.kind}:${m.patchOid}`,p=ae(a,m.rawPatch,u),v=[];return p.forEach((W,j)=>{W.files.forEach((S,T)=>{v.push({id:`${u}:${j}:${T}:${S.name}`,type:"diff",fileDiff:S})})}),{ok:!0,items:v,patches:p}}catch(u){return{ok:!1,error:u instanceof Error?u.message:String(u)}}},[a,m,c]),O=f.useMemo(()=>{if(!b||!b.ok||!g)return null;const u=[g.newPath,g.oldPath].filter(p=>!!p);for(const p of b.items){const v=p.fileDiff?.name;if(v&&u.includes(v))return p.id}return null},[b,g]),G=f.useMemo(()=>x?X(m,g):[],[x,m,g]),q=f.useCallback(()=>{if(!x)return;const u=U({activeLayer:e?.kind??null,selectedFile:g,root:$.current});u&&(w(u),window.getSelection()?.removeAllRanges(),L(null))},[x,e?.kind,w,g]),C=f.useCallback(()=>{if(!x){L(null);return}const u=$.current,p=U({activeLayer:e?.kind??null,selectedFile:g,root:u});if(!u||!p){L(null);return}const v=window.getSelection(),j=(v?.rangeCount?v.getRangeAt(0):null)?.getBoundingClientRect();if(!j||j.width===0&&j.height===0){L(null);return}const S=u.getBoundingClientRect(),T=Math.max(8,u.clientWidth-132),Y=Math.max(8,u.clientHeight-36);L({left:Math.min(Math.max(j.right-S.left+8,8),T),top:Math.min(Math.max(j.top-S.top-2,8),Y)})},[x,e?.kind,g]);if(f.useEffect(()=>{if(!x)return;const u=()=>{requestAnimationFrame(C)};return document.addEventListener("selectionchange",u),()=>{document.removeEventListener("selectionchange",u)}},[x,C]),!e)return r.jsx("div",{className:"rd-surface",children:r.jsx(k,{children:r.jsx("div",{className:"rd-center-title",children:"No layer selected"})})});if(e.files.length===0)return r.jsx("div",{className:"rd-surface",children:r.jsxs(k,{children:[r.jsx("div",{className:"rd-center-title",children:"Nothing to diff"}),r.jsxs("div",{className:"rd-center-body",children:["The ",z[e.kind]??e.kind.toLowerCase()," layer is clean."]})]})});if(n==="loading"||n==="idle"&&g)return r.jsx("div",{className:"rd-surface",children:r.jsxs(k,{children:[r.jsx("div",{className:"rd-spinner","aria-hidden":!0}),r.jsx("div",{className:"rd-center-title",children:"Loading selected file…"}),r.jsx("div",{className:"rd-center-body",children:"Fetching a path-filtered patch chunk for this file."})]})});if(n==="error"&&!t)return r.jsx("div",{className:"rd-surface",children:r.jsxs(k,{children:[r.jsx("div",{className:"rd-center-title",children:"Couldn’t load this file"}),r.jsx("div",{className:"rd-center-body",children:i??"The path-filtered patch request failed."})]})});if(l==="loading")return r.jsx("div",{className:"rd-surface",children:r.jsxs(k,{children:[r.jsx("div",{className:"rd-spinner","aria-hidden":!0}),r.jsx("div",{className:"rd-center-title",children:"Loading the diff renderer…"}),r.jsx("div",{className:"rd-center-body",children:"Fetching Pierre Diffs + Shiki (first open only)."})]})});if(l==="error"||!a)return r.jsxs("div",{className:"rd-surface",children:[r.jsxs("div",{className:"rd-banner warning",children:[r.jsx("span",{className:"rd-banner-dot","aria-hidden":!0}),r.jsxs("span",{children:["The diff renderer failed to load",h?`: ${h}`:"."," Showing raw patch text."]})]}),r.jsx("div",{className:"rd-surface-scroll",children:r.jsx(_,{layer:m??e,onRetry:P})})]});if(!m?.rawPatch||!b)return r.jsx("div",{className:"rd-surface",children:r.jsxs(k,{children:[r.jsx("div",{className:"rd-center-title",children:"No patch text available"}),r.jsx("div",{className:"rd-center-body",children:e.truncated?"This layer was truncated by the native diff budget; file summaries are shown in the rail.":"The summary is loaded. Select a file to fetch its patch text."})]})});if(!b.ok)return r.jsxs("div",{className:"rd-surface",children:[r.jsxs("div",{className:"rd-banner warning",children:[r.jsx("span",{className:"rd-banner-dot","aria-hidden":!0}),r.jsxs("span",{children:["Couldn’t parse the patch (",b.error,"). Showing raw text."]})]}),r.jsx("div",{className:"rd-surface-scroll",children:r.jsx(_,{layer:m})})]});const D=m.files.filter(u=>u.truncated).length;return r.jsxs("div",{className:"rd-surface",ref:$,children:[n==="error"&&t?r.jsxs("div",{className:"rd-banner warning",children:[r.jsx("span",{className:"rd-banner-dot","aria-hidden":!0}),r.jsx("span",{children:i??"Couldn’t refresh this file; showing the cached chunk."})]}):null,m.truncated||D>0?r.jsxs("div",{className:"rd-banner warning",children:[r.jsx("span",{className:"rd-banner-dot","aria-hidden":!0}),r.jsx("span",{children:m.truncated?"This layer was truncated; some files or hunks are omitted.":`${D} file${D===1?"":"s"} truncated.`})]}):null,x&&F?r.jsx("button",{type:"button",className:"rd-selection-context-chip",style:{left:F.left,top:F.top},onMouseDown:u=>u.preventDefault(),onClick:q,children:"+ selection"}):null,r.jsx("div",{className:"rd-surface-scroll",onMouseUp:C,onKeyUp:C,children:r.jsx(me,{pierre:a,items:b.items,theme:o,layout:d,scrollToItemId:O,lineContexts:G,onIncludeLineContext:N,onIncludeSelectionContext:w})})]})}function me({pierre:e,items:t,theme:n,layout:i,scrollToItemId:s,lineContexts:c,onIncludeLineContext:o,onIncludeSelectionContext:d}){const a=f.useRef(null),l=f.useRef(null);return f.useEffect(()=>{if(!a.current)return;const h=he(e,a.current);return l.current=h,()=>{l.current=null,setTimeout(()=>h.unmount(),0)}},[e]),f.useEffect(()=>{l.current?.render({items:t,theme:n,layout:i,lineContexts:c,onIncludeLineContext:o,onIncludeSelectionContext:d})},[t,n,i,c,o,d]),f.useEffect(()=>{if(!s)return;const h=requestAnimationFrame(()=>{l.current?.scrollToItem(s)});return()=>cancelAnimationFrame(h)},[s]),r.jsx("div",{ref:a,className:"rd-codeview-host"})}function _({layer:e,onRetry:t}){return r.jsxs("div",{style:{padding:"var(--space-lg)"},children:[t?r.jsx("div",{className:"rd-center-action",style:{marginTop:0,marginBottom:"var(--space-md)"},children:r.jsx("button",{type:"button",className:"rd-btn",onClick:t,children:"Retry renderer"})}):null,r.jsx("pre",{style:{margin:0,whiteSpace:"pre",fontFamily:"var(--rd-mono)",fontSize:"var(--text-xs)",lineHeight:1.5,color:"var(--ink)"},children:e.rawPatch??"(no patch text)"})]})}function Le(e){const[t,n]=f.useState(null),[i,s]=f.useState("loading"),[c,o]=f.useState(null),d=f.useCallback(()=>{s("loading"),o(null),H().then(a=>{n(a),s("ready")},a=>{o(a instanceof Error?a.message:String(a)),s("error")})},[]);return f.useEffect(()=>{let a=!0;return H().then(l=>{a&&(n(l),s("ready"))},l=>{a&&(o(l instanceof Error?l.message:String(l)),s("error"))}),()=>{a=!1}},[]),f.useEffect(()=>{t&&e&&ie(t,e.render.preferredTheme)},[t,e]),{pierre:t,pierrePhase:i,pierreError:c,retryPierre:d}}export{k as C,Ne as D,z as L,we as S,pe as V,J as a,ye as b,je as c,Pe as d,xe as e,K as f,ve as l,ke as r,be as s,Le as u};