@openscout/scout 0.2.92 → 0.2.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (508) hide show
  1. package/NOTICE +14 -0
  2. package/README.md +164 -348
  3. package/bin/scoutd +0 -0
  4. package/dist/build-manifest.json +3 -3
  5. package/dist/client/apple-touch-icon.png +0 -0
  6. package/dist/client/assets/ActivityScreen--eANwuxa.js +1 -0
  7. package/dist/client/assets/{AddProjectForm-CpyytDf2.js → AddProjectForm-CcD6qvV8.js} +1 -1
  8. package/dist/client/assets/AgentAvatar-CYhf6twS.js +1 -0
  9. package/dist/client/assets/AgentConfigurationScreen-BTI24HQX.js +1 -0
  10. package/dist/client/assets/AgentDefinitionsWorkspace-srmN6-vj.js +1 -0
  11. package/dist/client/assets/{AgentDetailCard-BTiOmh-a.js → AgentDetailCard-UqPNpcvB.js} +1 -1
  12. package/dist/client/assets/AgentFloorView-XXNgI5Cj.js +1 -0
  13. package/dist/client/assets/AgentInfoScreen-CimdOnZ9.js +1 -0
  14. package/dist/client/assets/{AgentLaneCard-lfRNb7JD.js → AgentLaneCard-Z-aOBR3W.js} +1 -1
  15. package/dist/client/assets/{AgentLaneChrome-Dlwrbq3g.js → AgentLaneChrome-CyhA1reW.js} +1 -1
  16. package/dist/client/assets/AgentLaneDetailSheet-BNzjMjIH.js +4 -0
  17. package/dist/client/assets/{AgentLaneSummaryResize-6SOEWUnr.js → AgentLaneSummaryResize-Box8-_rS.js} +1 -1
  18. package/dist/client/assets/AgentLanesEmbedScreen-BmLnN4on.js +1 -0
  19. package/dist/client/assets/{AgentLanesPreflight-C3uOiOzd.js → AgentLanesPreflight-5B6sXvRB.js} +1 -1
  20. package/dist/client/assets/AgentLanesView-DHyzVBk6.js +2 -0
  21. package/dist/client/assets/{AgentLiveActions-BJ5dIfL3.js → AgentLiveActions-BwuzOE8h.js} +1 -1
  22. package/dist/client/assets/AgentSessions-CsZwoukw.js +6 -0
  23. package/dist/client/assets/AgentsConsole-KCao4XmX.js +1 -0
  24. package/dist/client/assets/AgentsScreen-CtPAmwRX.js +1 -0
  25. package/dist/client/assets/AgentsSubnav-CDMjKeYC.js +1 -0
  26. package/dist/client/assets/AstronautSuit-Ckx7lu7G.js +1 -0
  27. package/dist/client/assets/AtopView-DYlpgEHf.js +1 -0
  28. package/dist/client/assets/{BackToPicker-D1LV6Cqp.js → BackToPicker-4JaeRvDm.js} +1 -1
  29. package/dist/client/assets/BriefingDetailScreen-D6-xqrpo.js +1 -0
  30. package/dist/client/assets/BriefingsScreen-DKxSDEmk.js +1 -0
  31. package/dist/client/assets/{BrokerMetadataPanel-BhjECqOK.js → BrokerMetadataPanel-BbREmsbK.js} +1 -1
  32. package/dist/client/assets/BrokerScreen-fbPIouMw.js +5 -0
  33. package/dist/client/assets/CastPicker-BcA2vDDV.js +1 -0
  34. package/dist/client/assets/CastPicker-zXsnkTIy.css +1 -0
  35. package/dist/client/assets/ChatCollapsedStrip-Ycm0ecaX.js +1 -0
  36. package/dist/client/assets/{CodeDiffPane-Bx_2VAzv.js → CodeDiffPane-Cn8Y9hAt.js} +1 -1
  37. package/dist/client/assets/{CodeProjectPicker-C1yOJKvs.js → CodeProjectPicker-nPFktrco.js} +1 -1
  38. package/dist/client/assets/CodeScreen-BlAxtxE5.js +1 -0
  39. package/dist/client/assets/ConversationComposer-2HjbGPL9.js +1 -0
  40. package/dist/client/assets/ConversationFeedRows-C6wUqJrx.js +1 -0
  41. package/dist/client/assets/ConversationHeader-C8vfXaTF.js +1 -0
  42. package/dist/client/assets/ConversationPanels-CNCIbpqU.js +6 -0
  43. package/dist/client/assets/ConversationScreen-BNULZAp2.js +2 -0
  44. package/dist/client/assets/ConversationScreen-CkWnKXt6.css +1 -0
  45. package/dist/client/assets/ConversationStatus-DZuyKsWN.js +1 -0
  46. package/dist/client/assets/CrewAvatar-CTIuxp4G.js +1 -0
  47. package/dist/client/assets/CrewAvatar-D0c9z5Qr.css +1 -0
  48. package/dist/client/assets/CrewWorkspaces-CJhBKVoZ.css +1 -0
  49. package/dist/client/assets/CrewWorkspaces-CkPYIA46.js +1 -0
  50. package/dist/client/assets/{DataTable-CJbbgBdA.js → DataTable-6IDhanr5.js} +1 -1
  51. package/dist/client/assets/DispatchAftermath-DC1u9itO.js +1 -0
  52. package/dist/client/assets/DocumentFocusViewer-DZVhS7as.js +1 -0
  53. package/dist/client/assets/{EmbeddableSurfacesLab-BdsYRDky.js → EmbeddableSurfacesLab-BKUFJMCV.js} +1 -1
  54. package/dist/client/assets/{EmptyState-BRY5jTpz.js → EmptyState-CeBl0iGd.js} +1 -1
  55. package/dist/client/assets/{FileViewerPane-9Bveqm9c.js → FileViewerPane-DQlpNt2S.js} +2 -2
  56. package/dist/client/assets/FlightObserveScreen-CDWGSKZg.js +1 -0
  57. package/dist/client/assets/FollowScreen-BXHOp3gb.js +1 -0
  58. package/dist/client/assets/{HarnessMark-BPAphNjx.js → HarnessMark-D5CA5uSp.js} +1 -1
  59. package/dist/client/assets/HarnessesScreen-DhFXq1qz.js +1 -0
  60. package/dist/client/assets/{HerdrSession-BujfGzrP.js → HerdrSession-BRhs5LIR.js} +1 -1
  61. package/dist/client/assets/HomeHero-7JwycwFY.css +1 -0
  62. package/dist/client/assets/HomeHero-DMABJuze.js +1 -0
  63. package/dist/client/assets/HostAdvisorView-RAociATV.js +1 -0
  64. package/dist/client/assets/{KnowledgeSearchInspector-B4ZY24xE.js → KnowledgeSearchInspector-CZPyVNSw.js} +1 -1
  65. package/dist/client/assets/KnowledgeSearchScreen-mGTKIg00.js +1 -0
  66. package/dist/client/assets/{LaneToolHoverCard-B7KdvQvf.js → LaneToolHoverCard-D_DMlBeT.js} +1 -1
  67. package/dist/client/assets/LaneTraceDetailSheet-BEHg3LmH.js +1 -0
  68. package/dist/client/assets/{LaneTraceEventFocus-mkMw2wJU.js → LaneTraceEventFocus-DVimcizS.js} +1 -1
  69. package/dist/client/assets/{MeshCanvas-CpKcWxKy.js → MeshCanvas-BOuZx4AM.js} +2 -2
  70. package/dist/client/assets/{MeshCanvasMinimap-C9IoGHbe.js → MeshCanvasMinimap-wL-1N94e.js} +1 -1
  71. package/dist/client/assets/MeshScreen-DMY9Bmh5.js +1 -0
  72. package/dist/client/assets/{MeshTopologyView-DFzr0IZM.js → MeshTopologyView-DiDcX5f4.js} +2 -2
  73. package/dist/client/assets/MessagesScreen-Eulveud3.js +1 -0
  74. package/dist/client/assets/{MissionContextRail-Y8QxUZGE.js → MissionContextRail-DrNKXG5u.js} +1 -1
  75. package/dist/client/assets/MissionControlView-ByBlHVN8.js +1 -0
  76. package/dist/client/assets/MissionFocusOverlay-D1i6R6Zt.js +1 -0
  77. package/dist/client/assets/MissionLeftAgentRow-DN9NcCML.js +1 -0
  78. package/dist/client/assets/MissionLogPane-DSeIv3Xo.js +1 -0
  79. package/dist/client/assets/NewAgentModal-V7yK6J6j.js +1 -0
  80. package/dist/client/assets/NewChatComposer-hlWT-nbR.js +19 -0
  81. package/dist/client/assets/{NewChatOrigin-DmuJ32wa.js → NewChatOrigin-DdpzE4kz.js} +1 -1
  82. package/dist/client/assets/ObserveEmbedScreen-l_Q3ts2q.js +2 -0
  83. package/dist/client/assets/ObserveTextFlow-BSEtYTxU.js +2 -0
  84. package/dist/client/assets/ObservedTopologyPanel-CdGUXxGR.js +2 -0
  85. package/dist/client/assets/OpenScoutAppShell-DN8dOSK4.js +79 -0
  86. package/dist/client/assets/OpsAgentsView-ntGr4pz4.js +1 -0
  87. package/dist/client/assets/OpsScreen-Ppen_Lmj.js +1 -0
  88. package/dist/client/assets/OpsSubnav-GAKsoSor.js +1 -0
  89. package/dist/client/assets/ProjectAgentProfile-BLlp2e6t.js +1 -0
  90. package/dist/client/assets/{ProjectAgentProfileBar-BLVg5EeA.js → ProjectAgentProfileBar-BQET-qrY.js} +1 -1
  91. package/dist/client/assets/ProjectAgentProfileHero-Ck8mThtx.js +1 -0
  92. package/dist/client/assets/ProjectsInbox-Dlt8OQ8O.js +2 -0
  93. package/dist/client/assets/ProjectsRail-DCfNMmnW.js +1 -0
  94. package/dist/client/assets/ProjectsScreen-BP-hmI1m.js +1 -0
  95. package/dist/client/assets/ProjectsThreadAside-CWpMjGIH.js +1 -0
  96. package/dist/client/assets/Provider-B2xuo3rf.js +1 -0
  97. package/dist/client/assets/RailRow-B-GycCBx.js +1 -0
  98. package/dist/client/assets/RailRow-B0sRaJc6.css +1 -0
  99. package/dist/client/assets/RawSessionsTable-AQThi6sm.js +1 -0
  100. package/dist/client/assets/RealtimeVoiceScreen-D7zZHK_t.js +1 -0
  101. package/dist/client/assets/{RepoDiffEmbedScreen-BCDXFE3D.js → RepoDiffEmbedScreen-DXWoRF_c.js} +1 -1
  102. package/dist/client/assets/{RepoDiffPageScreen-m62FiWXC.js → RepoDiffPageScreen-D_274ExO.js} +1 -1
  103. package/dist/client/assets/RepoDiffViewer-DbedmHDX.js +7 -0
  104. package/dist/client/assets/RepoDiffViewerLazy-C0--fPtk.js +2 -0
  105. package/dist/client/assets/ReposScreen-D39_YG4H.js +6 -0
  106. package/dist/client/assets/ScoutDeckSurface-CKT3qdqY.js +1 -0
  107. package/dist/client/assets/{ScoutSurface-CkgT7A-c.js → ScoutSurface-UsRy0t-I.js} +1 -1
  108. package/dist/client/assets/{ScoutbotFxLab-D-kV5j4T.js → ScoutbotFxLab-Fmdfboxs.js} +1 -1
  109. package/dist/client/assets/{SecondaryNav-_wyKjwNf.js → SecondaryNav-o2RL9H8H.js} +1 -1
  110. package/dist/client/assets/{SessionEmbedScreen-CJZmIBV7.js → SessionEmbedScreen-RD5XOx7R.js} +1 -1
  111. package/dist/client/assets/{SessionObserve-yYA8Gy5s.js → SessionObserve-Dsd0j05N.js} +9 -9
  112. package/dist/client/assets/{SessionObserveEvidence-cHdjYOJe.js → SessionObserveEvidence-DopQYDkD.js} +1 -1
  113. package/dist/client/assets/SessionRefScreen-B_cTv47v.js +1 -0
  114. package/dist/client/assets/SessionsScreen-Bq0Z77On.js +1 -0
  115. package/dist/client/assets/SettingsDrawer-R8a0TlJD.css +1 -0
  116. package/dist/client/assets/SettingsDrawer-_AwuopMS.js +3 -0
  117. package/dist/client/assets/SettingsScreen-Cw4DDfJP.js +1 -0
  118. package/dist/client/assets/{ShikiPane-dBS9hD-z.js → ShikiPane-BfHc_3pM.js} +1 -1
  119. package/dist/client/assets/{SlidePanel-CH-3-8_2.js → SlidePanel-C-q7XwTa.js} +1 -1
  120. package/dist/client/assets/SpriteAvatar-Bs68ZENy.js +1 -0
  121. package/dist/client/assets/{StatusPill-C8m9ZymF.js → StatusPill-ZZQwxB1a.js} +1 -1
  122. package/dist/client/assets/{TailView-B0BSopPs.js → TailView-Q4FVMsUH.js} +2 -2
  123. package/dist/client/assets/Terminal-D7zqHwHV.js +1 -0
  124. package/dist/client/assets/TerminalEmbedScreen-CXIJ7qv6.js +1 -0
  125. package/dist/client/assets/TerminalHeaderMount-BnBLOPbb.js +1 -0
  126. package/dist/client/assets/{TextDocumentSurface-BWJCGBZf.js → TextDocumentSurface-CKQP-cBT.js} +1 -1
  127. package/dist/client/assets/{TmuxPeek-B4QdHbGm.js → TmuxPeek-V9dGESfO.js} +1 -1
  128. package/dist/client/assets/{VoicePermissionsPanel-Dd4ITJy_.js → VoicePermissionsPanel-k7sbLXx2.js} +1 -1
  129. package/dist/client/assets/WorkDetailScreen-60p9litn.js +5 -0
  130. package/dist/client/assets/WorkFilesViewer-BjJS7GyM.js +1 -0
  131. package/dist/client/assets/{activity-CC8JzJNH.js → activity-Bj3Hnbj3.js} +1 -1
  132. package/dist/client/assets/{addon-fit-CaZ-uLrg.js → addon-fit-BL-NTWRU.js} +1 -1
  133. package/dist/client/assets/{addon-webgl-B8utL3bM.js → addon-webgl-CIMgmNjg.js} +1 -1
  134. package/dist/client/assets/{ScoutbotBroadcastChip-CxtYZWPZ.css → agent-autocomplete-C7xwIcwd.css} +1 -1
  135. package/dist/client/assets/agent-autocomplete-DXlvdc4b.js +10 -0
  136. package/dist/client/assets/{agent-essentials-B3wcxg_v.js → agent-essentials-BOMHR0_U.js} +1 -1
  137. package/dist/client/assets/{agent-lane-card-model-q4cwzLX4.js → agent-lane-card-model-CTLxf3R4.js} +1 -1
  138. package/dist/client/assets/agent-lane-detail-ppJId6Jc.js +2 -0
  139. package/dist/client/assets/{agent-lane-preview-C33Dwpn7.js → agent-lane-preview-BhplDYGf.js} +1 -1
  140. package/dist/client/assets/{agent-lanes-BDNktFBZ.css → agent-lanes-DlqcEf0l.css} +1 -1
  141. package/dist/client/assets/{agent-lanes-model-VYQ5a68i.js → agent-lanes-model-AfrjRNK5.js} +2 -2
  142. package/dist/client/assets/agent-specialization-BIPIBW8u.js +1 -0
  143. package/dist/client/assets/api-Co9aQ2Jw.js +1 -0
  144. package/dist/client/assets/{api-BkjHJfgJ.js → api-HFH8wFyb.js} +1 -1
  145. package/dist/client/assets/{arc.es-uFv9UrHn.js → arc.es-IR5r6sj_.js} +1 -1
  146. package/dist/client/assets/archive-BjcGiAy8.js +1 -0
  147. package/dist/client/assets/{arrow-down-w1HPzDSE.js → arrow-down-BydciYFZ.js} +1 -1
  148. package/dist/client/assets/{arrow-left-B-3GJ7ct.js → arrow-left-CghA0kTw.js} +1 -1
  149. package/dist/client/assets/arrow-right-iJFv3jNh.js +1 -0
  150. package/dist/client/assets/{arrow-up-right-G6bJXxhK.js → arrow-up-right-CCfZXPqD.js} +1 -1
  151. package/dist/client/assets/{bot-DzCOGKi6.js → bot-B5sub1-i.js} +1 -1
  152. package/dist/client/assets/broker-display-Q75fupqG.js +2 -0
  153. package/dist/client/assets/{cache-Dr0why2k.js → cache-CeWH_KzJ.js} +1 -1
  154. package/dist/client/assets/{check-BX8nRgop.js → check-C18YQC90.js} +1 -1
  155. package/dist/client/assets/{chevron-down-B3VVRJcV.js → chevron-down-Mp9mu_yd.js} +1 -1
  156. package/dist/client/assets/{chevron-right-BYMV1511.js → chevron-right-CzH-TaSF.js} +1 -1
  157. package/dist/client/assets/{chunk-HRAB3GC3-dRd2eQMJ.js → chunk-HRAB3GC3-swV8PA2k.js} +1 -1
  158. package/dist/client/assets/{chunk-JTPDIGGW-BjX67kHU.js → chunk-JTPDIGGW-BKXqcLKw.js} +3 -3
  159. package/dist/client/assets/{chunk-T65CQEWV-kP6nJjkU.js → chunk-T65CQEWV-vYbNJ8E6.js} +1 -1
  160. package/dist/client/assets/{chunk-YOZR3KYS-C13bZPVd.js → chunk-YOZR3KYS-U65yUmqt.js} +1 -1
  161. package/dist/client/assets/{clock-B9ukVaVn.js → clock-B4PTFi5m.js} +1 -1
  162. package/dist/client/assets/{code-xml-BFc3TMSm.js → code-xml-Jtxsp5d1.js} +1 -1
  163. package/dist/client/assets/collapsed-strip-raJWthAH.css +1 -0
  164. package/dist/client/assets/compass-0_54-vz3.js +1 -0
  165. package/dist/client/assets/content-6RvWTrtk.js +1 -0
  166. package/dist/client/assets/content-BCgwMUqz.js +1 -0
  167. package/dist/client/assets/content-Bf2VLhx0.js +1 -0
  168. package/dist/client/assets/content-BrU_38-m.js +1 -0
  169. package/dist/client/assets/content-BvvJN8rN.js +1 -0
  170. package/dist/client/assets/content-CAeEqYPw.js +1 -0
  171. package/dist/client/assets/content-CHghn-rT.js +1 -0
  172. package/dist/client/assets/{content-Uqt8AG-s.css → content-CINHz-rZ.css} +1 -1
  173. package/dist/client/assets/content-CI_Z9DXk.js +1 -0
  174. package/dist/client/assets/content-CbyKONhW.js +1 -0
  175. package/dist/client/assets/content-Czogvp43.js +1 -0
  176. package/dist/client/assets/content-DFk0zNzX.js +1 -0
  177. package/dist/client/assets/content-DHe4DgkA.js +1 -0
  178. package/dist/client/assets/content-DMbawvqU.js +1 -0
  179. package/dist/client/assets/content-DTz7cKjo.js +1 -0
  180. package/dist/client/assets/content-E3kudY-W.js +1 -0
  181. package/dist/client/assets/content-LpO0aO_U.js +1 -0
  182. package/dist/client/assets/{conversation-icons-gpsv650H.js → conversation-icons-BV10B2Me.js} +1 -1
  183. package/dist/client/assets/conversation-model-CwF6Y9gx.js +1 -0
  184. package/dist/client/assets/conversation-motion-features-BKkCRaWR.js +1 -0
  185. package/dist/client/assets/{copy-BFmOcWof.js → copy-Dtpx4FOE.js} +1 -1
  186. package/dist/client/assets/cpu-BjVis9mc.js +1 -0
  187. package/dist/client/assets/{createLucideIcon-CFBn0Sdk.js → createLucideIcon-DXpqZP7I.js} +1 -1
  188. package/dist/client/assets/credentials-BTce3VP1.js +1 -0
  189. package/dist/client/assets/ctx-panel-D_HJ3nhb.css +1 -0
  190. package/dist/client/assets/discover-CHbrEItO.js +2 -0
  191. package/dist/client/assets/embed-entry-vil28MyU.js +2 -0
  192. package/dist/client/assets/{external-link-B1TI5yIt.js → external-link-Ckiyzjwo.js} +1 -1
  193. package/dist/client/assets/{eye-1J4yOUoG.js → eye-CpfyvdLq.js} +1 -1
  194. package/dist/client/assets/file-code-corner-7mo7EviR.js +1 -0
  195. package/dist/client/assets/{file-text-DcYSrI4v.js → file-text-KijGBnME.js} +1 -1
  196. package/dist/client/assets/gauge-y-Xg8Mrv.js +1 -0
  197. package/dist/client/assets/gestures-Bq9XnSqY.js +1 -0
  198. package/dist/client/assets/git-branch-BQ_x8KZL.js +1 -0
  199. package/dist/client/assets/harnesses-screen-2z36fJKE.css +1 -0
  200. package/dist/client/assets/home-moving-signal-DMguaRWR.css +1 -0
  201. package/dist/client/assets/home-moving-signal-DtRpiNa0.js +1 -0
  202. package/dist/client/assets/home-now-card-DFb4GOgM.js +1 -0
  203. package/dist/client/assets/{home-now-card-nano-y1EhBvVL.js → home-now-card-nano-D--m9jpq.js} +1 -1
  204. package/dist/client/assets/hooks-9d1SoaQA.js +2 -0
  205. package/dist/client/assets/host-advisor-B2Fqs5Dd.css +1 -0
  206. package/dist/client/assets/index-BVlMw8x_.js +1 -0
  207. package/dist/client/assets/index-CZ-05hKz.js +10 -0
  208. package/dist/client/assets/index-Cn0GR-q1.js +1 -0
  209. package/dist/client/assets/index-DosI4AG9.js +1 -0
  210. package/dist/client/assets/index-i7TMxlwW.css +1 -0
  211. package/dist/client/assets/index-wLwc74Pu.css +1 -0
  212. package/dist/client/assets/inspector-panel-C-EhEDYy.js +2 -0
  213. package/dist/client/assets/{keyboard-nav-h1IdakpD.js → keyboard-nav-DFhAJkW3.js} +1 -1
  214. package/dist/client/assets/{lane-observe-BA3g9aVd.js → lane-observe-vfyACHi0.js} +1 -1
  215. package/dist/client/assets/{lane-roster-store-71vFgAem.js → lane-roster-store-gUBsydNf.js} +1 -1
  216. package/dist/client/assets/layers-CGou-LwV.js +1 -0
  217. package/dist/client/assets/layout-grid-BrZt31QH.js +1 -0
  218. package/dist/client/assets/left-B_o51JV6.js +1 -0
  219. package/dist/client/assets/left-BpgWnaah.js +1 -0
  220. package/dist/client/assets/left-CwHZCGO3.js +2 -0
  221. package/dist/client/assets/left-CwLs0okF.js +1 -0
  222. package/dist/client/assets/left-Cx0kv6pe.js +1 -0
  223. package/dist/client/assets/left-DA0amyfu.js +1 -0
  224. package/dist/client/assets/left-DH44V4I_.css +1 -0
  225. package/dist/client/assets/left-R2OOE7VG.css +1 -0
  226. package/dist/client/assets/left-advisor-DU3s01gk.js +1 -0
  227. package/dist/client/assets/left-agents-qL5PpUY-.js +1 -0
  228. package/dist/client/assets/left-default-uvuvDmt0.js +1 -0
  229. package/dist/client/assets/left-lanes-DnNLgec8.js +1 -0
  230. package/dist/client/assets/left-mission-DN3-NLPC.js +1 -0
  231. package/dist/client/assets/left-z-6CkuBe.js +2 -0
  232. package/dist/client/assets/library-DIo5NiGP.js +1 -0
  233. package/dist/client/assets/{loader-circle-d6PKL_KD.js → loader-circle-BiohlpM3.js} +1 -1
  234. package/dist/client/assets/{local-agents-B5pq17tZ.js → local-agents-wUIaBcEr.js} +1 -1
  235. package/dist/client/assets/{mentions-agCGDgyA.js → mentions-CcPFMbmZ.js} +1 -1
  236. package/dist/client/assets/mesh-buckets-ByyFXdKT.js +1 -0
  237. package/dist/client/assets/{mesh-ops-5pZCYptW.js → mesh-ops-CvGyjK84.js} +1 -1
  238. package/dist/client/assets/mesh-roster-n2nDpEmA.js +1 -0
  239. package/dist/client/assets/{mesh-screen-BSDUjrnV.css → mesh-screen-D1Yvo8fU.css} +1 -1
  240. package/dist/client/assets/{mesh-view-store-KJzABIkN.js → mesh-view-store-BpxGm71b.js} +1 -1
  241. package/dist/client/assets/{message-circle-CJO-pi7b.js → message-circle-B2ddzBrX.js} +1 -1
  242. package/dist/client/assets/{message-markup-CyRDLdOn.js → message-markup-RkfmDfME.js} +1 -1
  243. package/dist/client/assets/{message-square-D1hMsMj_.js → message-square-D9YYWE0x.js} +1 -1
  244. package/dist/client/assets/message-visibility-DwxgcgYK.js +1 -0
  245. package/dist/client/assets/mission-control-CnU7dNt1.css +1 -0
  246. package/dist/client/assets/{mission-control-store-Ce6dOvnZ.js → mission-control-store-Bf4b54MV.js} +1 -1
  247. package/dist/client/assets/{observe-BSWVM8YA.js → observe-CJRIvOCn.js} +1 -1
  248. package/dist/client/assets/{operator-attention-BwSPeheT.js → operator-attention-RqieiSY8.js} +1 -1
  249. package/dist/client/assets/{page-status-D2FQLJOX.js → page-status-BptpTdQ-.js} +1 -1
  250. package/dist/client/assets/{paperclip-iZmDMOS5.js → paperclip-B1UNGl5d.js} +1 -1
  251. package/dist/client/assets/perf-PX8Rx0EP.js +1 -0
  252. package/dist/client/assets/persistent-state-YI-WHSCF.js +1 -0
  253. package/dist/client/assets/{plus-gZ0T0eBI.js → plus-CuU_X0-8.js} +1 -1
  254. package/dist/client/assets/profile-rY8jO38P.js +1 -0
  255. package/dist/client/assets/projects-inbox-BBs1hG13.css +1 -0
  256. package/dist/client/assets/projects-inbox-D-zAb9Gp.js +1 -0
  257. package/dist/client/assets/proxy-DnLpZIi9.js +1 -0
  258. package/dist/client/assets/{radio-RMLfV4EO.js → radio-Dm1ItnA4.js} +1 -1
  259. package/dist/client/assets/{refresh-cw-C4x1x6b_.js → refresh-cw-BRn9Oxxl.js} +1 -1
  260. package/dist/client/assets/resolve-panes-DO6LkwhQ.js +1 -0
  261. package/dist/client/assets/resolve-sidebar-context-CIF288wY.js +1 -0
  262. package/dist/client/assets/right-BJltPRnd.js +1 -0
  263. package/dist/client/assets/right-BbyYdzHn.js +1 -0
  264. package/dist/client/assets/right-Beh3nCUB.js +1 -0
  265. package/dist/client/assets/right-C1yumXNx.js +1 -0
  266. package/dist/client/assets/{right-D-k9Z1Fe.js → right-CJnB_Bg7.js} +2 -2
  267. package/dist/client/assets/right-CPP7GyOm.js +1 -0
  268. package/dist/client/assets/right-D3aTKf1F.js +1 -0
  269. package/dist/client/assets/right-DI1B79nR.js +1 -0
  270. package/dist/client/assets/right-DtsRNX5b.js +1 -0
  271. package/dist/client/assets/right-Shpw_xDy.js +1 -0
  272. package/dist/client/assets/{rocket-CMM-IdLy.js → rocket-DOwXHKWA.js} +1 -1
  273. package/dist/client/assets/router-DJj2WbDg.js +1 -0
  274. package/dist/client/assets/{scope-views-BIfMTXU4.js → scope-views-A4_vP97W.js} +1 -1
  275. package/dist/client/assets/scout-voice-BhPzrc6P.js +1 -0
  276. package/dist/client/assets/{scoutbot-BTIErYHo.js → scoutbot-BJIamJOH.js} +2 -2
  277. package/dist/client/assets/scoutbot-markdown-jh7tzFB1.js +6 -0
  278. package/dist/client/assets/{scroll-text-DPPYrqB9.js → scroll-text-DO0GQzvN.js} +1 -1
  279. package/dist/client/assets/{search-DAyagUtF.js → search-D1tJSAWe.js} +1 -1
  280. package/dist/client/assets/secondaryNavConfig-B9IF8wXl.js +1 -0
  281. package/dist/client/assets/{selection-bridge-BXw09aRF.js → selection-bridge-i2S9zpf8.js} +1 -1
  282. package/dist/client/assets/{send-horizontal-IcG46D2M.js → send-horizontal-CgLppsIC.js} +1 -1
  283. package/dist/client/assets/{server-BySujhDV.js → server-Dymv5Emh.js} +1 -1
  284. package/dist/client/assets/{session-catalog-ClS9xf6i.js → session-catalog-DNaOEzoQ.js} +1 -1
  285. package/dist/client/assets/{session-table-BdpHs1GN.js → session-table-PTQVoTyc.js} +1 -1
  286. package/dist/client/assets/settings-2fC_G9nX.js +1 -0
  287. package/dist/client/assets/{sliders-horizontal-R5pWUUcH.js → sliders-horizontal-BPSMHhbm.js} +1 -1
  288. package/dist/client/assets/{sparkles-DJOBD_8l.js → sparkles-Dy8p5xN8.js} +1 -1
  289. package/dist/client/assets/sse-CiOSzE5n.js +1 -0
  290. package/dist/client/assets/system-surfaces-redesign-QVXNeGYw.css +1 -0
  291. package/dist/client/assets/{tail-display-BRcJltQa.js → tail-display-DcliDVkW.js} +1 -1
  292. package/dist/client/assets/{tail-events-BdvqZHLr.js → tail-events-BMQmSx1n.js} +1 -1
  293. package/dist/client/assets/{terminal-relay-TffuSPGs.js → terminal-relay-9lhzEp2V.js} +1 -1
  294. package/dist/client/assets/terminal-screen-BLk4PAYt.css +1 -0
  295. package/dist/client/assets/terminal-sessions-BQ6t92tJ.js +1 -0
  296. package/dist/client/assets/{terminal-takeover-BOFPRPjR.js → terminal-takeover-DANQfTcy.js} +1 -1
  297. package/dist/client/assets/{terminal-DJPUp_Qn.js → terminal-yN9xN-h9.js} +1 -1
  298. package/dist/client/assets/{runtime-picker--IW3cRry.js → text-CnZ0e1-V.js} +1 -1
  299. package/dist/client/assets/text-rLpBg4_z.css +1 -0
  300. package/dist/client/assets/use-conversation-list-D9BNLfnW.js +1 -0
  301. package/dist/client/assets/{use-fleet-active-asks-BHzeBZSW.js → use-fleet-active-asks-BeAdcl09.js} +1 -1
  302. package/dist/client/assets/{use-mesh-ops-items-KmaauBr_.js → use-mesh-ops-items-BIvIHlqe.js} +1 -1
  303. package/dist/client/assets/use-reduced-motion-CKkhq9c5.js +1 -0
  304. package/dist/client/assets/{use-scout-dev-flags-BJbw87PK.js → use-scout-dev-flags-B2KCzPxn.js} +1 -1
  305. package/dist/client/assets/{useAgentHoverCard-C6o0tlat.js → useAgentHoverCard-CHBsxcbp.js} +1 -1
  306. package/dist/client/assets/useContentSecondaryNav-D0mUhxTF.js +1 -0
  307. package/dist/client/assets/{usePierreRuntime-Cm7-qdm0.js → usePierreRuntime-DUuXH5yp.js} +1 -1
  308. package/dist/client/assets/{wrench-CvRjjByE.js → wrench-YcXMlsh2.js} +1 -1
  309. package/dist/client/assets/{x-C8ayPBtj.js → x-e3h2hDsp.js} +1 -1
  310. package/dist/client/assets/{xterm-B0ci4Q9a.js → xterm-Byp1Hep_.js} +1 -1
  311. package/dist/client/assets/zap-nMcjPoWB.js +1 -0
  312. package/dist/client/favicon-16.png +0 -0
  313. package/dist/client/favicon-32.png +0 -0
  314. package/dist/client/favicon.ico +0 -0
  315. package/dist/client/favicon.svg +20 -47
  316. package/dist/client/index.html +5 -5
  317. package/dist/client/openscout-icon.png +0 -0
  318. package/dist/client/site.webmanifest +2 -2
  319. package/dist/client/web-app-icon-192.png +0 -0
  320. package/dist/client/web-app-icon-512.png +0 -0
  321. package/dist/main.mjs +20095 -78203
  322. package/dist/node/main.mjs +322 -252
  323. package/dist/pairing-runtime-controller.mjs +1032 -804
  324. package/dist/runtime/base-daemon.mjs +49 -121
  325. package/dist/runtime/broker-daemon.mjs +1105 -281
  326. package/dist/runtime/broker-process-manager.mjs +6 -0
  327. package/dist/runtime/mesh-discover.mjs +6 -0
  328. package/dist/scout-control-plane-web.mjs +3326 -1912
  329. package/package.json +27 -5
  330. package/dist/client/assets/ActivityScreen-DkUP7V7M.js +0 -1
  331. package/dist/client/assets/AgentAvatar-D8ZtMluU.js +0 -1
  332. package/dist/client/assets/AgentConfigurationScreen-BlGI6fuM.js +0 -1
  333. package/dist/client/assets/AgentDefinitionsWorkspace-CfaDVCVt.js +0 -1
  334. package/dist/client/assets/AgentFloorView-DjNLILLt.js +0 -1
  335. package/dist/client/assets/AgentInfoScreen-DG5dlHb_.js +0 -1
  336. package/dist/client/assets/AgentLaneDetailSheet-BzYzBfcW.js +0 -4
  337. package/dist/client/assets/AgentLanesEmbedScreen-Crxx1srt.js +0 -1
  338. package/dist/client/assets/AgentLanesView-ChNlmY-F.js +0 -2
  339. package/dist/client/assets/AgentSessions-DpY0htZV.js +0 -6
  340. package/dist/client/assets/AgentsConsole-CHyXrjhm.js +0 -1
  341. package/dist/client/assets/AgentsScreen-BhCjX2lD.js +0 -1
  342. package/dist/client/assets/AgentsSubnav-az_VDkri.js +0 -1
  343. package/dist/client/assets/AtopView-BjjPM8OX.js +0 -1
  344. package/dist/client/assets/BriefingDetailScreen-B7qJ90Np.js +0 -6
  345. package/dist/client/assets/BriefingsScreen-CW6N829d.js +0 -1
  346. package/dist/client/assets/BrokerScreen-X3z50712.js +0 -5
  347. package/dist/client/assets/ChatCollapsedStrip-DNR9osDy.js +0 -1
  348. package/dist/client/assets/CodeScreen-CIKK1LcZ.js +0 -1
  349. package/dist/client/assets/ContextMenu-CHIuVKz7.js +0 -1
  350. package/dist/client/assets/ConversationComposer-Bf7Ga_49.js +0 -1
  351. package/dist/client/assets/ConversationFeedRows-Cm1Lgo43.js +0 -1
  352. package/dist/client/assets/ConversationHeader-B_GXrKR0.js +0 -1
  353. package/dist/client/assets/ConversationPanels-BTBbEvrP.js +0 -2
  354. package/dist/client/assets/ConversationScreen-B3l2m3JI.js +0 -1
  355. package/dist/client/assets/ConversationScreen-yIKEsm-8.css +0 -1
  356. package/dist/client/assets/ConversationStatus-BqhUHD85.js +0 -1
  357. package/dist/client/assets/DispatchAftermath-BDA9CrOd.js +0 -1
  358. package/dist/client/assets/DocumentFocusViewer-B9vodVmG.js +0 -1
  359. package/dist/client/assets/FleetSearch-Bj9SCl2f.js +0 -1
  360. package/dist/client/assets/FleetSearch-EXOe8ulE.css +0 -1
  361. package/dist/client/assets/FlightObserveScreen-BVMdsiCC.js +0 -1
  362. package/dist/client/assets/FollowScreen-BifwHWOV.js +0 -1
  363. package/dist/client/assets/HarnessesScreen-fMnbnrD4.js +0 -1
  364. package/dist/client/assets/HomeHero-BgM6S39l.js +0 -1
  365. package/dist/client/assets/HomeHero-DEl-WBsT.css +0 -1
  366. package/dist/client/assets/KnowledgeSearchScreen-Ch_WENUC.js +0 -1
  367. package/dist/client/assets/LaneTraceDetailSheet-H3AnN-vN.js +0 -1
  368. package/dist/client/assets/MeshScreen-48QkJSDI.js +0 -1
  369. package/dist/client/assets/MessageComposerSuggestions-FdVHnT_q.js +0 -1
  370. package/dist/client/assets/MessagesScreen-BMOOfbWX.js +0 -1
  371. package/dist/client/assets/MissionControlView-BpsHKu1F.js +0 -1
  372. package/dist/client/assets/MissionFocusOverlay-BPnAEA3F.js +0 -1
  373. package/dist/client/assets/MissionLeftAgentRow-iOZ6ds9L.js +0 -1
  374. package/dist/client/assets/MissionLogPane-B0csI89E.js +0 -1
  375. package/dist/client/assets/NewAgentModal-DBHJR9Qm.js +0 -1
  376. package/dist/client/assets/NewChatComposer-Hd7pI5Ac.js +0 -19
  377. package/dist/client/assets/ObserveEmbedScreen-DyArn7Id.js +0 -2
  378. package/dist/client/assets/ObserveTextFlow-CkMrtT8s.js +0 -2
  379. package/dist/client/assets/ObservedTopologyPanel-CaSZZP05.js +0 -2
  380. package/dist/client/assets/OpenScoutAppShell-BtlKkiuF.js +0 -87
  381. package/dist/client/assets/OpsAgentsView-CnqrwbC2.js +0 -1
  382. package/dist/client/assets/OpsScreen-DOlmlVkP.js +0 -1
  383. package/dist/client/assets/OpsSubnav-Dj3ShAKv.js +0 -1
  384. package/dist/client/assets/PlanView-BLGdWDx6.js +0 -1
  385. package/dist/client/assets/ProjectAgentProfile-Dv1sVnQl.js +0 -1
  386. package/dist/client/assets/ProjectAgentProfileHero-0-GDhsPT.js +0 -1
  387. package/dist/client/assets/ProjectsInbox-B3DpAI5b.js +0 -2
  388. package/dist/client/assets/ProjectsRail-BDl7U9Jq.js +0 -1
  389. package/dist/client/assets/ProjectsScreen-Dl2FcGrR.js +0 -1
  390. package/dist/client/assets/ProjectsThreadAside-BcGC5mHE.js +0 -1
  391. package/dist/client/assets/Provider-cJCdHAxu.js +0 -1
  392. package/dist/client/assets/RailRow-CLcVmywd.js +0 -1
  393. package/dist/client/assets/RailRow-Cf9LOiEj.css +0 -1
  394. package/dist/client/assets/RawSessionsTable-DBto4Ts-.js +0 -1
  395. package/dist/client/assets/RealtimeVoiceScreen-DXEU5v3g.js +0 -1
  396. package/dist/client/assets/RepoDiffViewer-PaNeZMhJ.js +0 -7
  397. package/dist/client/assets/RepoDiffViewerLazy-CWE5GxMP.js +0 -2
  398. package/dist/client/assets/ReposScreen-Cksv1cAD.js +0 -6
  399. package/dist/client/assets/ScoutDeckSurface-BCjPl7C4.js +0 -1
  400. package/dist/client/assets/ScoutbotBroadcastChip-DkiRCHuK.js +0 -2
  401. package/dist/client/assets/ScoutbotRealtimeVoiceCall-1ixiEn1L.js +0 -1
  402. package/dist/client/assets/SessionRefScreen-OkTY7Szg.js +0 -1
  403. package/dist/client/assets/SessionsScreen-B-GFjxIA.js +0 -1
  404. package/dist/client/assets/SettingsDrawer-Co11RFX0.js +0 -3
  405. package/dist/client/assets/SettingsDrawer-UX7pFJU_.css +0 -1
  406. package/dist/client/assets/SettingsScreen-Cn09nq5_.js +0 -1
  407. package/dist/client/assets/SpriteAvatar-DS6Tmyua.js +0 -1
  408. package/dist/client/assets/Terminal-U8gjIdm3.js +0 -1
  409. package/dist/client/assets/TerminalEmbedScreen-CTmdE7us.js +0 -1
  410. package/dist/client/assets/WorkDetailScreen-mJs0mb99.js +0 -5
  411. package/dist/client/assets/WorkFilesViewer-ODzLXKxj.js +0 -1
  412. package/dist/client/assets/agent-identity-BxCsXnDp.js +0 -1
  413. package/dist/client/assets/agent-lane-detail-BNNm6FNu.js +0 -2
  414. package/dist/client/assets/api-h5zurxmi.js +0 -1
  415. package/dist/client/assets/broker-display-pp33bLsu.js +0 -2
  416. package/dist/client/assets/collapsed-strip-Dz-of2SM.css +0 -1
  417. package/dist/client/assets/content-B8gahuBy.js +0 -1
  418. package/dist/client/assets/content-BIqX06OQ.js +0 -1
  419. package/dist/client/assets/content-BKDZ6Fxe.js +0 -1
  420. package/dist/client/assets/content-C15Ya-iu.js +0 -1
  421. package/dist/client/assets/content-CDE9tJDF.js +0 -1
  422. package/dist/client/assets/content-CSAfI-PX.js +0 -1
  423. package/dist/client/assets/content-CTF9D60D.js +0 -1
  424. package/dist/client/assets/content-CbAGkYQO.js +0 -1
  425. package/dist/client/assets/content-CtqLJOVp.js +0 -1
  426. package/dist/client/assets/content-Dvs1KRfo.js +0 -1
  427. package/dist/client/assets/content-DyJdVZjI.js +0 -1
  428. package/dist/client/assets/content-Ji7ATaf7.js +0 -1
  429. package/dist/client/assets/content-eqZXKWcP.js +0 -1
  430. package/dist/client/assets/content-iyyQKwvA.js +0 -1
  431. package/dist/client/assets/content-pDE7Fpb9.js +0 -1
  432. package/dist/client/assets/content-pPSd2dua.js +0 -1
  433. package/dist/client/assets/conversation-model-CHwHZNw-.js +0 -1
  434. package/dist/client/assets/conversation-motion-features-DXtKlmuM.js +0 -1
  435. package/dist/client/assets/ctx-panel-B4s49N9e.css +0 -1
  436. package/dist/client/assets/discover-DKf0aTr_.js +0 -2
  437. package/dist/client/assets/embed-entry-RlQUTtc4.js +0 -2
  438. package/dist/client/assets/gestures-CcEOV6Sr.js +0 -1
  439. package/dist/client/assets/harnesses-screen-DBZoTZz8.css +0 -1
  440. package/dist/client/assets/home-moving-signal-Bh2FugbH.js +0 -1
  441. package/dist/client/assets/home-moving-signal-CAa0V91u.css +0 -1
  442. package/dist/client/assets/home-now-card-ByRH5fFx.js +0 -1
  443. package/dist/client/assets/hooks-DUZwL3Aq.js +0 -2
  444. package/dist/client/assets/index-BBznYVWk.css +0 -1
  445. package/dist/client/assets/index-BTuq-8Iv.js +0 -1
  446. package/dist/client/assets/index-CmwGCxUk.js +0 -1
  447. package/dist/client/assets/index-CvF09yvf.css +0 -1
  448. package/dist/client/assets/index-DmFAhGPj.js +0 -10
  449. package/dist/client/assets/index-Dtaswdsh.js +0 -1
  450. package/dist/client/assets/inspector-panel-DzgS5_Mv.js +0 -2
  451. package/dist/client/assets/left-8NITBvFX.js +0 -1
  452. package/dist/client/assets/left-B2HEqrTM.js +0 -2
  453. package/dist/client/assets/left-Bk3XnxPD.css +0 -1
  454. package/dist/client/assets/left-CCoobxPS.css +0 -1
  455. package/dist/client/assets/left-CTYUvXbe.js +0 -1
  456. package/dist/client/assets/left-CwDRT50z.js +0 -2
  457. package/dist/client/assets/left-CxlDLJlw.js +0 -1
  458. package/dist/client/assets/left-XFXxNd4g.js +0 -1
  459. package/dist/client/assets/left-agents-Ck4Xn-R8.js +0 -1
  460. package/dist/client/assets/left-default-BeOyS0bR.js +0 -1
  461. package/dist/client/assets/left-lanes-DZp3jJMo.js +0 -1
  462. package/dist/client/assets/left-mission-CuKFQ5xL.js +0 -1
  463. package/dist/client/assets/left-p1hkO6P0.js +0 -1
  464. package/dist/client/assets/left-plan-3rrFENhp.js +0 -2
  465. package/dist/client/assets/library-E--gKzEZ.js +0 -1
  466. package/dist/client/assets/mesh-buckets-CfAukILK.js +0 -1
  467. package/dist/client/assets/message-visibility-kJM8XcSG.js +0 -1
  468. package/dist/client/assets/mission-control-m3BTDQ9l.css +0 -1
  469. package/dist/client/assets/model-Co0zkMIc.js +0 -1
  470. package/dist/client/assets/plan-view-D56fneVF.css +0 -1
  471. package/dist/client/assets/profile-Dxj3VVOM.js +0 -1
  472. package/dist/client/assets/projects-inbox-COZ23dLR.css +0 -1
  473. package/dist/client/assets/projects-inbox-Dzt_GQDv.js +0 -1
  474. package/dist/client/assets/resolve-panes-C9gF0w4e.js +0 -1
  475. package/dist/client/assets/resolve-sidebar-context-DxbY5RCH.js +0 -1
  476. package/dist/client/assets/right-5L7Tn0zG.js +0 -1
  477. package/dist/client/assets/right-CYtkMmRu.js +0 -1
  478. package/dist/client/assets/right-CreoQzPP.js +0 -1
  479. package/dist/client/assets/right-D9xFfy2b.js +0 -1
  480. package/dist/client/assets/right-DI7zHADe.js +0 -1
  481. package/dist/client/assets/right-DUbJ3WVc.js +0 -1
  482. package/dist/client/assets/right-DiybhsiK.js +0 -1
  483. package/dist/client/assets/right-Jh_1Q88s.js +0 -1
  484. package/dist/client/assets/right-udr1qTJG.js +0 -1
  485. package/dist/client/assets/router-Cn_s9IGH.js +0 -1
  486. package/dist/client/assets/runtime-picker-vhm0gtLs.css +0 -1
  487. package/dist/client/assets/scout-voice-CwbOz6EN.js +0 -1
  488. package/dist/client/assets/secondaryNavConfig-Dw3gS1jR.js +0 -1
  489. package/dist/client/assets/sse-CxXt4tqI.js +0 -1
  490. package/dist/client/assets/system-surfaces-redesign-B7GQhfpw.css +0 -1
  491. package/dist/client/assets/terminal-screen-BqVnCwl0.css +0 -1
  492. package/dist/client/assets/terminal-sessions-AmSgHklm.js +0 -1
  493. package/dist/client/assets/text-DsBWV_4k.js +0 -1
  494. package/dist/client/assets/use-conversation-list-C-dPcjQe.js +0 -1
  495. package/dist/client/assets/use-reduced-motion-CYqhYqHO.js +0 -1
  496. package/dist/client/assets/useContentSecondaryNav-DjHBrgnS.js +0 -1
  497. package/dist/highlights-eq9cgrbb.scm +0 -604
  498. package/dist/highlights-ghv9g403.scm +0 -205
  499. package/dist/highlights-hk7bwhj4.scm +0 -284
  500. package/dist/highlights-r812a2qc.scm +0 -150
  501. package/dist/highlights-x6tmsnaa.scm +0 -115
  502. package/dist/injections-73j83es3.scm +0 -27
  503. package/dist/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
  504. package/dist/tree-sitter-markdown-411r6y9b.wasm +0 -0
  505. package/dist/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
  506. package/dist/tree-sitter-typescript-zxjzwt75.wasm +0 -0
  507. package/dist/tree-sitter-zig-e78zbjpm.wasm +0 -0
  508. /package/dist/client/assets/{document-focus-viewer-BSC_JwVE.css → DocumentFocusViewer-BSC_JwVE.css} +0 -0
@@ -0,0 +1 @@
1
+ import{r as n,j as e}from"./index-CZ-05hKz.js";import{h as ot}from"./router-DJj2WbDg.js";import{k as fs,u as Rt,l as bs,n as nt,o as rt,a as gs,p as be,q as Vt,s as vs,r as Mt}from"./Provider-B2xuo3rf.js";import{H as Ss,A as ks,V as Gt,a as Yt,S as ws,b as ys,m as qt,o as js,c as Ns,d as Jt,e as Qt}from"./agent-autocomplete-DXlvdc4b.js";import{a as H}from"./api-Co9aQ2Jw.js";import{c as $e}from"./clipboard-e3fSpeo7.js";import{e as Cs}from"./credentials-BTce3VP1.js";import{b as Lt,u as Es,a as ge}from"./persistent-state-YI-WHSCF.js";import{s as ue,e as Ts,S as At}from"./scoutbot-BJIamJOH.js";import{g as Is,b as _s,c as Rs,i as Vs,e as Ms,s as Ls}from"./scout-voice-BhPzrc6P.js";import{d as As,f as Pt,n as Se}from"./time-Dhsh_2EG.js";import{S as Ps}from"./scoutbot-markdown-jh7tzFB1.js";import{L as K}from"./loader-circle-BiohlpM3.js";import{P as Xt}from"./plus-CuU_X0-8.js";import{C as Ke}from"./chevron-down-Mp9mu_yd.js";import{A as Os}from"./archive-BjcGiAy8.js";import{S as Kt,a as Zt}from"./text-CnZ0e1-V.js";import{S as zs}from"./send-horizontal-CgLppsIC.js";import{c as Ds}from"./createLucideIcon-DXpqZP7I.js";import{C as $s}from"./copy-Dtpx4FOE.js";import{u as es}from"./use-reduced-motion-CKkhq9c5.js";import{R as Ot}from"./rocket-DOwXHKWA.js";import{X as Bs}from"./x-e3h2hDsp.js";import{R as Us}from"./refresh-cw-BRn9Oxxl.js";import{S as Fs}from"./settings-2fC_G9nX.js";import{V as zt}from"./fx-z37u1o2z.js";import{B as Hs}from"./bot-B5sub1-i.js";import{d as Ws}from"./types-B0PlfpKc.js";const Gs=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ys=Ds("circle-check",Gs),qs=new Set(["air-local","local","mini","node"]),Js=new Set(["main","master","trunk"]);function Qs(t){return t.replace(/```[\s\S]*?```/g," code omitted ").replace(/\*\*([^*\n]+)\*\*/g,"$1").replace(/(^|[\s(])\*([^\s*][^*\n]*?[^\s*]|[^\s*])\*(?=[\s)\].,!?;:]|$)/g,"$1$2").replace(/(^|[\s(])_([^\s_][^_\n]*?[^\s_]|[^\s_])_(?=[\s)\].,!?;:]|$)/g,"$1$2").replace(/^\s*[-*]\s+/gm,"").replace(/\bhttps?:\/\/[^\s)]+/gi,o=>Xs(o)).replace(/\b(session|conversation|message|flight|invocation|work)(?:\s+(?:id|ref))?\s*[:#]?\s+([a-z0-9][a-z0-9._:-]{9,})\b/gi,(o,a,i)=>`${a.toLowerCase()} ending in ${Ze(i)}`).replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,o=>`ID ending in ${Ze(o)}`).replace(/@?([a-z][a-z0-9-]*(?:\.[a-z0-9][a-z0-9-]*){2,})\b/gi,(o,a)=>Ks(o)?o:Zs(a)).replace(/`([^`]+)`/g,(o,a)=>eo(a)).replace(/\s+/g," ").trim()}function Xs(t){try{return new URL(t).hostname.replace(/^www\./,"").replace(/\./g," dot ")}catch{return"link"}}function Ks(t){const o=t.replace(/^@/,"").toLowerCase();return/\.(com|app|dev|org|net|io|local)(?:\b|\/)/.test(o)&&!o.endsWith(".air-local")}function Zs(t){const o=t.split(".").filter(Boolean);if(o.length<2)return t;const a=[...o];for(;a.length>1&&qs.has(a.at(-1).toLowerCase());)a.pop();const[i,...c]=a,d=c.filter(p=>!Js.has(p.toLowerCase())).map(et).filter(Boolean);return[et(i),...d].filter(Boolean).join(", ")}function eo(t){return/^[a-z0-9][a-z0-9._:-]{12,}$/i.test(t)?`ID ending in ${Ze(t)}`:et(t)}function Ze(t){return(t.replace(/[^a-z0-9]/gi,"").slice(-4)||t.slice(-4)).split("").join(" ")}function et(t){return t.replace(/^@/,"").replace(/[_./:-]+/g," ").replace(/\s+/g," ").trim()}function to({state:t,chatExpanded:o,onToggleExpanded:a,sessionPickerOpen:i,onToggleSessionPicker:c,onStartNewChat:d,startingNewChat:p,onSwitchSession:j,switchingSessionId:N,sending:g,briefing:M,pendingAsk:C,onArchiveSession:f,archivingSessionId:b,onAssistantContextMenu:h,suggestedPrompts:_,onSelectPrompt:y}){const I=t.session.messages,E=o?I:I.slice(-4),k=o?0:Math.max(0,I.length-E.length),w=I.length,S=t.sessions.length,u=t.retention,T=I.length===0&&!C&&!g&&!M,P=p||g||M||!!N||!!b,W=t.session.createdAt?As(t.session.createdAt):null,R=T?"Scout conversation":t.session.title&&t.session.title!=="New Scout Session"?t.session.title:`Session ${t.session.id.slice(0,8)}`,O=n.useRef(null),G=I[I.length-1]?.id??null,Y=I[I.length-1]?.body??"";return n.useEffect(()=>{const x=O.current;x&&(x.scrollTop=x.scrollHeight)},[G,Y,C,g,o,t.session.id]),e.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-hidden rounded border border-[var(--scout-chrome-border-soft)] bg-black/10 font-mono text-xs text-[var(--scout-chrome-ink-faint)]",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-[var(--scout-chrome-border-soft)] px-2.5 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"min-w-0 truncate text-[var(--scout-chrome-ink)]",title:t.session.id,children:R}),W&&!T&&e.jsxs("span",{className:"shrink-0 text-[var(--scout-chrome-ink-ghost)]",children:["· ",W]}),!T&&e.jsxs("span",{className:"shrink-0 text-[var(--scout-chrome-ink-ghost)]",children:["· ",w," msg",w===1?"":"s"]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsxs("button",{type:"button",title:"Start a new chat (keeps this chat in Chats)","aria-label":"Start new chat",onClick:d,disabled:P,className:"flex items-center gap-1 rounded border border-lime-300/30 bg-lime-300/[0.06] px-1.5 py-0.5 text-2xs uppercase tracking-[0.1em] text-lime-100 transition-colors hover:border-lime-300/50 hover:bg-lime-300/10 disabled:cursor-not-allowed disabled:opacity-40",children:[p?e.jsx(K,{size:10,className:"animate-spin"}):e.jsx(Xt,{size:10}),e.jsx("span",{children:p?"Starting":"New chat"})]}),e.jsxs("button",{type:"button",title:`Switch chat (${S} total)`,"aria-label":"Switch chat",onClick:c,className:`flex items-center gap-1 rounded border px-1.5 py-0.5 text-2xs uppercase tracking-[0.1em] transition-colors ${i?"border-lime-300/40 bg-lime-300/10 text-lime-100":"border-[var(--scout-chrome-border-soft)] text-[var(--scout-chrome-ink-faint)] hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]"}`,children:[e.jsx(Ss,{size:10}),e.jsx("span",{children:"Chats"}),e.jsx("span",{className:"text-[var(--scout-chrome-ink-ghost)]",children:S}),e.jsx(Ke,{size:9,className:i?"rotate-180 transition-transform":"transition-transform"})]}),w>4&&e.jsxs("button",{type:"button",title:o?"Collapse chat":"View full session","aria-label":o?"Collapse chat":"View full session",onClick:a,className:"flex items-center gap-1 rounded border border-[var(--scout-chrome-border-soft)] px-1.5 py-0.5 text-2xs uppercase tracking-[0.1em] text-[var(--scout-chrome-ink-faint)] transition-colors hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]",children:[e.jsx("span",{children:o?"Collapse":"Full"}),o?e.jsx(fs,{size:9}):e.jsx(Ke,{size:9})]})]})]}),i&&e.jsxs("div",{className:"shrink-0 border-b border-[var(--scout-chrome-border-soft)] px-2 py-1.5",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2 px-0.5 text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-ghost)]",children:[e.jsx("span",{children:"Recent chats"}),u&&u.archivedCount>0&&e.jsxs("span",{children:[u.archivedCount," archived"]})]}),e.jsx("div",{className:"flex max-h-40 flex-col gap-0.5 overflow-y-auto pr-0.5",children:t.sessions.map(x=>{const U=x.id===t.session.id,Z=N===x.id,F=b===x.id,L=Pt(x.updatedAt)||"unknown",z=x.title&&x.title!=="New Scout Session"?x.title:`Session ${x.id.slice(0,8)}`;return e.jsxs("div",{className:`flex items-center gap-2 rounded border px-2 py-1 text-left transition-colors ${U?"border-lime-300/40 bg-lime-300/[0.06] text-lime-100":"border-transparent text-[var(--scout-chrome-ink-faint)] hover:border-[var(--scout-chrome-border-soft)] hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]"}`,children:[e.jsxs("button",{type:"button",onClick:()=>{U||j(x.id)},disabled:U||!!N||!!b,className:"flex min-w-0 flex-1 items-center gap-2 text-left disabled:cursor-not-allowed disabled:opacity-40",children:[e.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${U?"bg-lime-300":"bg-[var(--scout-chrome-ink-ghost)]"}`}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-[var(--scout-chrome-ink)]",children:z}),e.jsxs("span",{className:"shrink-0 text-2xs text-[var(--scout-chrome-ink-ghost)]",children:[x.messageCount," msg"]}),e.jsx("span",{className:"shrink-0 text-2xs text-[var(--scout-chrome-ink-ghost)]",children:L}),Z&&e.jsx(K,{size:10,className:"shrink-0 animate-spin text-lime-200"})]}),e.jsx("button",{type:"button",title:"Archive chat","aria-label":`Archive chat ${z}`,onClick:()=>f(x.id),disabled:!!N||!!b,className:"flex h-5 w-5 shrink-0 items-center justify-center rounded border border-transparent text-[var(--scout-chrome-ink-ghost)] transition-colors hover:border-[var(--scout-chrome-border-soft)] hover:bg-black/20 hover:text-[var(--scout-chrome-ink)] disabled:cursor-not-allowed disabled:opacity-30",children:F?e.jsx(K,{size:10,className:"animate-spin"}):e.jsx(Os,{size:10})})]},x.id)})})]}),e.jsxs("div",{ref:O,className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto px-2.5 py-2",children:[k>0&&e.jsxs("button",{type:"button",onClick:a,className:"self-start text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-ghost)] hover:text-[var(--scout-chrome-ink)]",children:["↑ ",k," earlier message",k===1?"":"s"]}),T&&e.jsx(so,{suggestedPrompts:_,onSelectPrompt:y}),E.map((x,U)=>{const Z=ro(E[U-1],x),F=ao(x.createdAt);return e.jsxs("div",{className:"flex flex-col gap-1",children:[Z&&e.jsx("div",{className:"self-center rounded-full bg-white/[0.06] px-2.5 py-0.5 font-mono text-2xs font-medium text-[var(--scout-chrome-ink-ghost)]",title:Pt(x.createdAt),"aria-label":F,children:F}),e.jsx(Dt,{role:x.role,body:x.body,onContextMenu:x.role==="assistant"&&h?L=>h(L,x.body):void 0})]},x.id)}),C&&e.jsx(Dt,{role:"user",body:C,pending:!0}),g&&!C&&e.jsx("p",{className:"text-[var(--scout-chrome-ink-ghost)]",children:"Reading the control plane…"}),M&&e.jsxs("div",{className:"flex items-center gap-2 rounded border border-lime-300/30 bg-lime-300/[0.06] px-2.5 py-2 font-mono text-xs leading-relaxed text-lime-100",children:[e.jsx(K,{size:12,className:"shrink-0 animate-spin text-lime-300","aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0 flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-xs uppercase tracking-[0.14em] text-lime-300",children:"Briefing"}),e.jsx("span",{className:"text-[var(--scout-chrome-ink)]",children:"Codex is reviewing the control-plane snapshot. Voice will pick up when it lands."})]})]})]})]})}function so({suggestedPrompts:t=[],onSelectPrompt:o}){return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col justify-start gap-2 px-1 py-2.5",children:[t.length>0?e.jsx("div",{className:"grid gap-1",children:t.slice(0,3).map(a=>e.jsx("button",{type:"button",onClick:()=>o?.(a),className:"min-h-7 truncate rounded border border-[var(--scout-chrome-border-soft)] bg-black/10 px-2.5 text-left font-mono text-xs leading-snug text-[var(--scout-chrome-ink-faint)] transition-colors hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]",children:a},a))}):null,e.jsxs("div",{className:"max-w-[30rem]",children:[e.jsx("div",{className:"font-sans text-lg font-semibold leading-tight text-[var(--scout-chrome-ink)]",children:"Start with a question."}),e.jsx("p",{className:"mt-0.5 font-sans text-xs leading-snug text-[var(--scout-chrome-ink-faint)]",children:"Paste a failed result or ask about what you are seeing. Scout replies when you ask."})]})]})}function oo({agents:t,draft:o,onDraftChange:a,onSubmit:i,sending:c,recording:d,voiceLabel:p,voiceBusy:j,voiceUnavailable:N,voiceHeld:g=!1,onMicClick:M,prominent:C=!1,autoFocus:f,focusSignal:b}){const h=n.useRef(null),_=n.useCallback(()=>{const E=h.current;E&&(E.textarea?E.textarea.focus({preventScroll:!0}):E.focus())},[]);n.useEffect(()=>{f&&_()},[f,_]),n.useEffect(()=>{b&&_()},[b,_]);let y="Start talking";N&&(y="Set up Scout voice"),d&&(y="Stop talking"),(j||g)&&(y=p);const v=j||d||g,I=["w-full resize-none rounded border font-mono text-sm leading-relaxed text-[var(--scout-chrome-ink)] placeholder:text-[var(--scout-chrome-ink-ghost)]",C?"min-h-[88px] max-h-[170px] border-lime-300/30 bg-black/25 px-3 py-2 text-md":"min-h-[44px] max-h-[124px] border-[var(--scout-chrome-border-soft)] bg-black/20 px-2 py-1.5"].join(" ");return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:E=>{E.preventDefault(),i()},children:[e.jsx(ks,{ref:h,agents:t,value:o,onChange:a,onSubmit:()=>{o.trim()&&!c&&i()},placeholder:g?"Type while live voice is on…":C?"Ask Scout about what you are seeing…":"Ask Scout…",rows:C?4:2,disabled:c,submitOnEnter:!0,className:"min-w-0",textareaClassName:I}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("button",{type:"button",title:y,"aria-label":y,onClick:M,disabled:c||j||g,className:`flex h-8 items-center justify-center rounded border transition-colors disabled:cursor-not-allowed disabled:opacity-40 ${d?"border-lime-300/50 bg-lime-300/10 text-lime-200":g?"border-lime-300/25 bg-lime-300/[0.05] text-lime-100/70":"border-[var(--scout-chrome-border-soft)] text-[var(--scout-chrome-ink-faint)] hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]"} ${v?"gap-1.5 px-3 font-mono text-xs uppercase tracking-[0.12em]":"w-9"}`,children:[j?e.jsx(K,{size:13,className:"animate-spin"}):d?e.jsx(Kt,{size:12,className:"fill-current"}):e.jsx(Zt,{size:13}),v&&e.jsx("span",{className:"truncate",children:p})]}),e.jsx("button",{type:"submit",title:"Send","aria-label":"Send",disabled:!o.trim()||c,className:"flex h-8 w-9 items-center justify-center rounded bg-lime-300/90 text-black transition-opacity disabled:cursor-not-allowed disabled:opacity-40",children:c?e.jsx(K,{size:13,className:"animate-spin"}):e.jsx(zs,{size:13})})]})]})}function Dt({role:t,body:o,pending:a=!1,onContextMenu:i}){const c=t==="user",d=c?o:ue(o),[p,j]=n.useState(!1),N=n.useCallback(()=>{$e(d).then(()=>{j(!0),window.setTimeout(()=>j(!1),1200)}).catch(()=>{})},[d]);return e.jsxs("div",{className:"group flex flex-col gap-0.5",onContextMenu:i,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("span",{className:`text-2xs uppercase tracking-[0.12em] ${c?"text-[var(--scout-chrome-ink-ghost)]":"text-lime-300"}`,children:[c?"You":"Reply",a&&" · sending"]}),e.jsx("button",{type:"button",title:p?"Copied":"Copy message","aria-label":p?"Copied message":"Copy message",disabled:a||!d.trim(),onClick:N,className:"flex h-5 w-5 shrink-0 items-center justify-center rounded border border-[var(--scout-chrome-border-soft)] text-[var(--scout-chrome-ink-ghost)] opacity-70 transition hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)] disabled:cursor-not-allowed disabled:opacity-20 group-hover:opacity-100",children:p?e.jsx(Ys,{size:11}):e.jsx($s,{size:11})})]}),c?e.jsx("p",{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-[var(--scout-chrome-ink)] ${a?"opacity-60":""}`,children:d}):e.jsx("div",{className:a?"opacity-60":"",children:e.jsx(Ps,{text:d})})]})}const no=5*6e4;function ro(t,o){if(!t||!tt(t.createdAt,o.createdAt))return!0;const a=Se(t.createdAt),i=Se(o.createdAt);return a===null||i===null?!0:Math.abs(i-a)>=no}function tt(t,o){const a=Se(t),i=Se(o);if(a===null||i===null)return!1;const c=new Date(a),d=new Date(i);return c.getFullYear()===d.getFullYear()&&c.getMonth()===d.getMonth()&&c.getDate()===d.getDate()}function ao(t){const o=Se(t);if(o===null)return"";const a=new Date(o),i=new Date,c=new Date(i);c.setDate(i.getDate()-1);const d=a.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return tt(o,i.getTime())?`Today ${d}`:tt(o,c.getTime())?`Yesterday ${d}`:a.getFullYear()===i.getFullYear()?`${a.toLocaleDateString([],{month:"short",day:"numeric"})} ${d}`:`${a.toLocaleDateString([],{month:"short",day:"numeric",year:"numeric"})} ${d}`}const io={"--scout-chrome-bg":"#f3f0e9","--scout-chrome-ink":"#2a2d2f","--scout-chrome-ink-strong":"#171a1c","--scout-chrome-ink-faint":"#6f716e","--scout-chrome-ink-ghost":"#9b9a94","--scout-chrome-border-soft":"#d9d4ca","--scout-chrome-hover":"#e9e5dc","--scout-chrome-active":"#ded8cc","--scout-accent":"#b58a3f"},$t=[2,4,7,5,3,6,9,5,3,4,8,6,3,5,9,6,3,5,7,4,2,4,6,3],co=$t.map((t,o)=>{const a=o/$t.length*Math.PI*2-Math.PI/2,i=24-t/2,c=24+t/2;return{x1:36+Math.cos(a)*i,y1:36+Math.sin(a)*i,x2:36+Math.cos(a)*c,y2:36+Math.sin(a)*c}});function lo({recording:t,sending:o,speaking:a,voiceAvailable:i,voiceProbeState:c,voiceState:d}){return a?"speaking":o?"thinking":t&&d==="processing"?"processing":t?"listening":c!=="idle"||d==="starting"||i===null?"checking":i===!1?"unavailable":"ready"}const uo={checking:{label:"Getting voice ready",helper:"Checking your microphone and speech services"},unavailable:{label:"Voice is offline",helper:"Tap to reconnect"},listening:{label:"Listening",helper:"Tap to finish your turn"},processing:{label:"Transcribing",helper:"Turning speech into text"},thinking:{label:"Scout is thinking",helper:"Your turn is in"},speaking:{label:"Scout is speaking",helper:"Tap to interrupt"},ready:{label:"Ready to listen",helper:"Tap to speak"}};function mo(t){switch(t){case"listening":return"Finish and send voice turn";case"speaking":return"Stop spoken reply";case"unavailable":return"Retry voice connection";case"checking":return"Checking voice";case"processing":return"Transcribing voice turn";case"thinking":return"Scout is thinking";case"ready":return"Start voice turn"}}function ho(t){return t==="listening"||t==="processing"?"listen":t==="thinking"?"think":t==="speaking"?"speak":null}function po({phase:t,disabled:o,onClick:a}){const i=es(),c=t==="listening"||t==="speaking",d=mo(t);return e.jsx(qt.div,{animate:c&&!i?{scale:[1,1.025,1]}:{scale:1},transition:c&&!i?{duration:2.2,ease:"easeInOut",repeat:1/0}:{duration:.18},children:e.jsx("button",{type:"button",onClick:a,disabled:o,"aria-label":d,title:d,className:"group grid h-28 w-28 place-items-center rounded-full border border-[#d4cfc5] bg-white text-[#232729] shadow-[0_14px_34px_rgba(55,48,38,0.12)] outline-none transition-[border-color,box-shadow,transform] duration-200 hover:border-[#b9b2a6] hover:shadow-[0_17px_38px_rgba(55,48,38,0.16)] focus-visible:ring-2 focus-visible:ring-[#9c7736] focus-visible:ring-offset-4 focus-visible:ring-offset-[#f3f0e9] active:scale-[0.98] disabled:cursor-wait disabled:opacity-65",children:e.jsxs("svg",{viewBox:"0 0 72 72",className:"h-[72px] w-[72px]","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"24",fill:"none",stroke:"#d2cec6",strokeWidth:"0.8"}),co.map((p,j)=>e.jsx("line",{x1:p.x1,y1:p.y1,x2:p.x2,y2:p.y2,stroke:c?"#817b71":"#a5a198",strokeWidth:"1.15",strokeLinecap:"round"},j)),e.jsx("circle",{cx:"36",cy:"36",r:"7.5",fill:c?"#b98a3b":"#d3b16d"})]})})})}const xo=[{id:"listen",label:"Listen"},{id:"think",label:"Think"},{id:"speak",label:"Speak"}];function fo({messages:t,pendingAsk:o,partial:a,error:i,status:c,recording:d,sending:p,speaking:j,voiceAvailable:N,voiceInputSource:g,voiceProbeState:M,voiceState:C,voiceReplies:f,settingsOpen:b,setupPanel:h,settingsPanel:_,assistantModel:y,onPrimaryAction:v,onToggleVoiceReplies:I,onToggleSettings:E,onNewChat:k,onOpenLive:w}){const S=es(),u=n.useRef(null),T=lo({recording:d,sending:p,speaking:j,voiceAvailable:N,voiceProbeState:M,voiceState:C}),P=uo[T],W=T==="checking"||T==="processing"||T==="thinking",R=g??(N===!0?"Default input from Scout Menu":"Checking microphone…"),O=t.slice(-12),G=a||(p&&O.at(-1)?.body!==o?o:null),Y=O.length===0&&!G,x=ho(T),U=y?.trim()||"Turn-based voice",Z=N===!1?"Mic offline":N===null?"Checking mic":"Mic active",F=T==="unavailable"?"bg-[#a25549]":T==="ready"||T==="checking"?"bg-[#a7a49d]":"bg-[#b58a3f]";return n.useEffect(()=>{u.current?.scrollIntoView({block:"nearest"})},[t.length,o]),e.jsxs("section",{className:"relative flex h-full min-h-0 w-full flex-col overflow-hidden bg-[#f3f0e9] text-[#2a2d2f]",style:io,"aria-label":"Direct voice conversation",children:[e.jsxs("header",{className:"flex min-h-14 shrink-0 items-center justify-between gap-2 border-b border-[#d9d4ca] px-3 py-2.5 sm:gap-4 sm:px-7",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("h1",{className:"truncate font-[var(--font-accent-title)] text-[15px] font-semibold tracking-[-0.018em] text-[#171a1c] sm:text-[17px]",children:"Direct Voice"}),e.jsx("span",{className:"hidden h-4 w-px bg-[#d6d1c7] sm:block","aria-hidden":"true"}),e.jsxs("div",{className:"hidden min-w-0 items-center gap-2 sm:flex","aria-live":"polite",children:[e.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${F}`,"aria-hidden":"true"}),e.jsx("span",{className:"truncate text-xs text-[#6f716e]",children:P.label})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 sm:gap-2",children:[e.jsxs("div",{className:"flex rounded-md border border-[#cbc5ba] bg-[#e8e3da] p-0.5",role:"tablist","aria-label":"Voice mode",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":"true",className:"rounded-[4px] bg-[#202426] px-2 py-1.5 text-[11px] font-medium text-white shadow-[0_1px_2px_rgba(0,0,0,0.14)] sm:px-3",children:"Direct"}),e.jsx("button",{type:"button",role:"tab","aria-selected":"false",onClick:w,disabled:!w,className:"rounded-[4px] px-2 py-1.5 text-[11px] font-medium text-[#6a6c69] transition-colors hover:bg-white/65 hover:text-[#232628] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#9c7736] disabled:cursor-default disabled:opacity-45 sm:px-3",children:"Live"})]}),e.jsxs("button",{type:"button",onClick:k,className:"hidden h-8 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-[#4f5352] transition-colors hover:bg-[#e7e2d9] hover:text-[#191c1e] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#9c7736] min-[430px]:flex sm:px-2.5","aria-label":"Start a new voice conversation",title:"New conversation",children:[e.jsx(Xt,{size:14,"aria-hidden":"true"}),e.jsx("span",{className:"hidden md:inline",children:"New chat"})]}),e.jsx("button",{type:"button",onClick:I,className:`grid h-8 w-8 place-items-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#9c7736] ${f?"bg-[#e1d5bd] text-[#765923]":"text-[#6e706d] hover:bg-[#e7e2d9] hover:text-[#191c1e]"}`,"aria-pressed":f,"aria-label":f?"Mute spoken replies":"Enable spoken replies",title:f?"Spoken replies on":"Spoken replies off",children:f?e.jsx(Gt,{size:15}):e.jsx(Yt,{size:15})}),e.jsx("button",{type:"button",onClick:E,className:`grid h-8 w-8 place-items-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#9c7736] ${b?"bg-[#e1d5bd] text-[#765923]":"text-[#6e706d] hover:bg-[#e7e2d9] hover:text-[#191c1e]"}`,"aria-expanded":b,"aria-label":"Voice and Scoutbot settings",title:"Voice and Scoutbot settings",children:e.jsx(ws,{size:15})})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"mx-auto flex min-h-full w-full max-w-[880px] flex-col px-6 py-8 sm:px-10 sm:py-10 lg:px-14",children:e.jsxs("div",{className:"w-full max-w-[720px]",children:[Y?e.jsxs("div",{className:"pt-1",children:[e.jsx("p",{className:"font-mono text-[10px] font-semibold uppercase tracking-[0.12em] text-[#8b8983]",children:"Conversation"}),e.jsx("p",{className:"mt-2 max-w-[38ch] text-sm leading-6 text-[#737570]",children:"Your voice turns and Scout’s replies will appear here."})]}):e.jsxs("div",{className:"space-y-8 sm:space-y-9",children:[O.map(L=>{const z=L.role==="assistant";return e.jsxs("article",{className:"max-w-[68ch]",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.jsx("span",{className:"font-mono text-[10px] font-semibold uppercase tracking-[0.12em] text-[#575a59]",children:z?"Scout":"You"}),z&&e.jsx("span",{className:"text-[10px] text-[#8a8983]",children:U})]}),e.jsx("p",{className:"mt-1.5 whitespace-pre-wrap text-[15px] leading-6 text-[#25292a] sm:text-base sm:leading-7",children:z?ue(L.body):L.body})]},L.id)}),G&&e.jsxs("article",{className:"max-w-[68ch]","aria-live":"polite",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[10px] font-semibold uppercase tracking-[0.12em] text-[#765923]",children:"You"}),e.jsx("span",{className:"text-[10px] text-[#9a7a40]",children:a?"Listening":"Sending"})]}),e.jsx("p",{className:"mt-1.5 whitespace-pre-wrap text-[15px] leading-6 text-[#25292a] sm:text-base sm:leading-7",children:G})]})]}),e.jsx("div",{ref:u})]})})}),e.jsx(ys,{initial:!1,children:(h||b||i)&&e.jsx(qt.div,{initial:S?!1:{opacity:0,y:6},animate:{opacity:1,y:0},exit:S?void 0:{opacity:0,y:6},className:"max-h-[34vh] shrink-0 overflow-y-auto border-y border-[#d9d4ca] bg-[#eeeae2]",children:e.jsxs("div",{className:"mx-auto w-full max-w-[880px] px-6 py-4 sm:px-10 lg:px-14",children:[i&&e.jsx("p",{className:"mb-3 text-sm leading-6 text-[#93483f]",children:i}),h,b&&_]})})}),e.jsxs("div",{className:"shrink-0 px-5 pb-4 pt-3 sm:px-8 sm:pb-5",children:[e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx(po,{phase:T,disabled:W,onClick:v}),e.jsxs("div",{className:"mt-3","aria-live":"polite",children:[e.jsx("p",{className:"text-sm font-semibold text-[#24282a]",children:P.label}),e.jsx("p",{className:"mt-0.5 text-xs text-[#7a7b76]",children:P.helper})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-[#7b6a49]",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[#b58a3f]","aria-hidden":"true"}),e.jsx("span",{children:Z})]})]}),e.jsxs("footer",{className:"mx-auto mt-4 flex w-full max-w-[880px] flex-col items-stretch justify-between gap-2 border-t border-[#d9d4ca] pt-3 text-[11px] text-[#747570] sm:flex-row sm:items-center sm:gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(Zt,{size:12,className:"shrink-0 text-[#8b7350]","aria-hidden":"true"}),e.jsxs("span",{className:"truncate",children:["Input: ",R]})]}),e.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 sm:justify-start","aria-label":`Voice turn state: ${P.label}`,children:xo.map(L=>{const z=x===L.id;return e.jsx("span",{className:z?"font-medium text-[#5e4821]":"text-[#96948e]",children:L.label},L.id)})}),c&&!p&&T!=="listening"&&e.jsx("span",{className:"hidden max-w-48 truncate text-right text-[#96948e] lg:block",children:c})]})]})]})}function Bt({icon:t,title:o,onClick:a,disabled:i,active:c,badge:d}){return e.jsxs("button",{type:"button",title:o,"aria-label":o,onClick:a,disabled:i,className:`flex shrink-0 items-center gap-1 rounded border p-1 text-xs transition-colors disabled:cursor-not-allowed disabled:opacity-40 ${c?"border-lime-300/50 bg-lime-300/10 text-lime-200":"border-[var(--scout-chrome-border-soft)] text-[var(--scout-chrome-ink-faint)] hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]"}`,children:[t,d&&e.jsx("span",{className:"font-mono text-3xs tracking-tight",children:d})]})}function Ut({issue:t,probeState:o,onLaunch:a,onRetry:i,onSettings:c,onDismiss:d}){const p=o==="probing"||o==="launching";return e.jsxs("div",{className:"rounded border border-[var(--scout-chrome-border-soft)] bg-black/15 px-2.5 py-2 font-mono text-xs text-[var(--scout-chrome-ink)]",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ot,{size:13,className:"mt-0.5 shrink-0 text-[var(--scout-chrome-ink-faint)]"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"uppercase tracking-[0.14em] text-[var(--scout-chrome-ink-faint)]",children:"Scout Voice"}),e.jsx("p",{className:"mt-1 leading-relaxed text-[var(--scout-chrome-ink-ghost)]",children:"Open Scout Menu to use speech."}),t&&e.jsx("p",{className:"mt-2 break-words leading-relaxed text-[var(--scout-chrome-ink-ghost)]",children:t})]}),d?e.jsx("button",{type:"button",title:"Hide voice setup","aria-label":"Hide voice setup",onClick:d,className:"shrink-0 rounded border border-transparent p-1 text-[var(--scout-chrome-ink-ghost)] transition-colors hover:border-[var(--scout-chrome-border-soft)] hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)]",children:e.jsx(Bs,{size:11})}):null]}),e.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-1.5",children:[e.jsx(Xe,{icon:o==="launching"?e.jsx(K,{size:12,className:"animate-spin"}):e.jsx(Ot,{size:12}),label:o==="launching"?"Opening":"Open",onClick:a,disabled:o==="probing",title:"Open Scout services"}),e.jsx(Xe,{icon:o==="probing"?e.jsx(K,{size:12,className:"animate-spin"}):e.jsx(Us,{size:12}),label:"Retry",onClick:i,disabled:p,title:"Check Scout voice again"}),e.jsx(Xe,{icon:e.jsx(Fs,{size:12}),label:"Voice",onClick:c,disabled:o==="probing",title:"Open Scoutbot voice settings"})]})]})}function Xe({icon:t,label:o,onClick:a,disabled:i,title:c}){return e.jsxs("button",{type:"button",title:c,onClick:a,disabled:i,className:"flex min-h-7 items-center justify-center gap-1.5 rounded border border-[var(--scout-chrome-border-soft)] px-2 text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)] transition-colors hover:bg-[var(--scout-chrome-hover)] hover:text-[var(--scout-chrome-ink)] disabled:cursor-not-allowed disabled:opacity-45",children:[t,o]})}const ve="gpt-4o-mini-tts",st="us-woman",Be=[{id:"us-woman",label:"US Woman",locale:"US English",presentation:"Woman",voiceName:"Marin",description:"Warm, clear, and conversational.",speech:{modelId:ve,voiceId:"marin",instructions:"Speak in clear, natural American English with a warm, grounded feminine presentation. Keep the delivery conversational and responsive."}},{id:"us-man",label:"US Man",locale:"US English",presentation:"Man",voiceName:"Cedar",description:"Grounded, calm, and direct.",speech:{modelId:ve,voiceId:"cedar",instructions:"Speak in clear, natural American English with a warm, grounded masculine presentation. Keep the delivery conversational and responsive."}},{id:"british-woman",label:"British Woman",locale:"British English",presentation:"Woman",voiceName:"Marin",description:"Warm with a subtle British cadence.",speech:{modelId:ve,voiceId:"marin",instructions:"Speak in natural British English with a subtle contemporary British accent and a warm, grounded feminine presentation. Avoid theatrical or exaggerated delivery."}},{id:"british-man",label:"British Man",locale:"British English",presentation:"Man",voiceName:"Cedar",description:"Calm with a subtle British cadence.",speech:{modelId:ve,voiceId:"cedar",instructions:"Speak in natural British English with a subtle contemporary British accent and a calm, grounded masculine presentation. Avoid theatrical or exaggerated delivery."}}],me={modelId:ve,voiceId:"marin",instructions:"Speak naturally, clearly, and conversationally."};function bo(t){return t==="custom"||Be.some(o=>o.id===t)}function go(t,o={}){return t==="custom"?{modelId:o.modelId?.trim()||me.modelId,voiceId:o.voiceId?.trim()||me.voiceId,instructions:o.instructions?.trim()||me.instructions}:Be.find(a=>a.id===t)?.speech??Be.find(a=>a.id===st).speech}function Ft({presentation:t,voicePresetId:o,onVoicePresetId:a,speechSelectionId:i,onSpeechSelectionId:c,customSpeechModelId:d,onCustomSpeechModelId:p,customSpeechVoiceId:j,onCustomSpeechVoiceId:N,customSpeechInstructions:g,onCustomSpeechInstructions:M,voiceDefaults:C,modelDraft:f,onModelDraft:b,promptDraft:h,onPromptDraft:_,configLoading:y,configSaving:v,configError:I,configStatus:E,onSave:k,onReload:w}){const S=t==="direct-voice";return e.jsx("div",{className:`rounded border border-[var(--scout-chrome-border-soft)] p-3 ${S?"bg-[#f8f5ef]":"bg-black/10"}`,children:e.jsxs("div",{className:"flex flex-col gap-3",children:[S?e.jsxs("fieldset",{className:"flex flex-col gap-2",children:[e.jsx("legend",{className:"mb-1 font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:"Scout voice"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",role:"radiogroup","aria-label":"Scout voice",children:Be.map(u=>{const T=i===u.id;return e.jsxs("button",{type:"button",role:"radio","aria-checked":T,onClick:()=>c(u.id),className:`min-h-20 rounded border p-2.5 text-left transition ${T?S?"border-[#b89a5f] bg-[#efe5d0] text-[var(--scout-chrome-ink)]":"border-lime-300/60 bg-lime-300/10 text-[var(--scout-chrome-ink)]":S?"border-[var(--scout-chrome-border-soft)] bg-white/55 text-[var(--scout-chrome-ink-faint)] hover:bg-white":"border-[var(--scout-chrome-border-soft)] bg-black/20 text-[var(--scout-chrome-ink-faint)] hover:bg-[var(--scout-chrome-hover)]"}`,children:[e.jsx("span",{className:"block font-mono text-xs font-bold uppercase tracking-[0.1em]",children:u.label}),e.jsxs("span",{className:"mt-1 block font-mono text-2xs leading-relaxed text-[var(--scout-chrome-ink-ghost)]",children:[u.voiceName," · ",u.description]})]},u.id)})}),e.jsxs("button",{type:"button",role:"radio","aria-checked":i==="custom",onClick:()=>c("custom"),className:`rounded border px-2.5 py-2 text-left font-mono text-xs transition ${i==="custom"?S?"border-[#b89a5f] bg-[#efe5d0] text-[var(--scout-chrome-ink)]":"border-lime-300/60 bg-lime-300/10 text-[var(--scout-chrome-ink)]":S?"border-[var(--scout-chrome-border-soft)] bg-white/55 text-[var(--scout-chrome-ink-faint)] hover:bg-white":"border-[var(--scout-chrome-border-soft)] bg-black/20 text-[var(--scout-chrome-ink-faint)] hover:bg-[var(--scout-chrome-hover)]"}`,children:[e.jsx("span",{className:"font-bold uppercase tracking-[0.1em]",children:"Custom voice"}),e.jsx("span",{className:"ml-2 text-[var(--scout-chrome-ink-ghost)]",children:"Use any supported model, voice, and style."})]}),i==="custom"&&e.jsxs("div",{className:`grid gap-2 rounded border border-[var(--scout-chrome-border-soft)] p-2.5 ${S?"bg-white/55":"bg-black/20"}`,children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("label",{className:"flex flex-col gap-1 font-mono text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:["Speech model",e.jsx("input",{value:d,onChange:u=>p(u.target.value),placeholder:"gpt-4o-mini-tts",className:`rounded border border-[var(--scout-chrome-border-soft)] px-2 py-1.5 font-mono text-xs normal-case tracking-normal text-[var(--scout-chrome-ink)] placeholder:text-[var(--scout-chrome-ink-ghost)] ${S?"bg-white/75":"bg-black/25"}`})]}),e.jsxs("label",{className:"flex flex-col gap-1 font-mono text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:["Voice ID",e.jsx("input",{value:j,onChange:u=>N(u.target.value),placeholder:"marin",className:`rounded border border-[var(--scout-chrome-border-soft)] px-2 py-1.5 font-mono text-xs normal-case tracking-normal text-[var(--scout-chrome-ink)] placeholder:text-[var(--scout-chrome-ink-ghost)] ${S?"bg-white/75":"bg-black/25"}`})]})]}),e.jsxs("label",{className:"flex flex-col gap-1 font-mono text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:["Speaking style",e.jsx("textarea",{value:g,onChange:u=>M(u.target.value),rows:3,placeholder:"Speak naturally, clearly, and conversationally.",className:`w-full resize-y rounded border border-[var(--scout-chrome-border-soft)] px-2 py-1.5 font-mono text-xs normal-case leading-relaxed tracking-normal text-[var(--scout-chrome-ink)] placeholder:text-[var(--scout-chrome-ink-ghost)] ${S?"bg-white/75":"bg-black/25"}`})]})]}),e.jsx("p",{className:"font-mono text-2xs normal-case leading-relaxed text-[var(--scout-chrome-ink-ghost)]",children:"Request-based TTS, separate from GPT Live. Replies are AI-generated speech."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"flex flex-col gap-1 font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:["Voice FX",e.jsx("select",{value:o,onChange:u=>a(u.target.value),className:"rounded border border-[var(--scout-chrome-border-soft)] bg-black/20 px-2 py-1.5 font-mono text-sm normal-case tracking-normal text-[var(--scout-chrome-ink)]",children:zt.map(u=>e.jsxs("option",{value:u.id,children:[u.label," — ",u.family]},u.id))}),e.jsx("span",{className:"font-mono text-2xs normal-case leading-relaxed tracking-normal text-[var(--scout-chrome-ink-ghost)]",children:zt.find(u=>u.id===o)?.description??"Custom voice mood for spoken replies."})]}),e.jsxs("div",{className:"flex flex-col gap-1 font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:["Scout Voice",e.jsx("div",{className:"rounded border border-[var(--scout-chrome-border-soft)] bg-black/20 px-2 py-1.5 font-mono text-sm normal-case tracking-normal text-[var(--scout-chrome-ink)]",children:C?`${C.modelId}${C.voiceId?` / ${C.voiceId}`:""}`:"Unavailable"})]})]}),e.jsxs("label",{className:"flex flex-col gap-1 font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:["Preferred model",e.jsx("input",{value:f,onChange:u=>b(u.target.value),placeholder:"gpt-4.1-mini",className:`rounded border border-[var(--scout-chrome-border-soft)] px-2 py-1.5 font-mono text-sm normal-case tracking-normal text-[var(--scout-chrome-ink)] placeholder:text-[var(--scout-chrome-ink-ghost)] ${S?"bg-white/75":"bg-black/20"}`,disabled:y||v})]}),e.jsxs("label",{className:"flex flex-col gap-1 font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:["System Prompt",e.jsx("textarea",{value:h,onChange:u=>_(u.target.value),rows:6,className:`w-full resize-y rounded border border-[var(--scout-chrome-border-soft)] px-2 py-1.5 font-mono text-xs normal-case leading-relaxed tracking-normal text-[var(--scout-chrome-ink)] ${S?"bg-white/75":"bg-black/20"}`,disabled:y||v})]}),I&&e.jsx("div",{className:`font-mono text-xs leading-relaxed ${S?"text-[#93483f]":"text-red-300"}`,children:I}),E&&e.jsx("div",{className:`font-mono text-xs leading-relaxed ${S?"text-[#765923]":"text-lime-200"}`,children:E}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:k,disabled:y||v||!h.trim(),className:`flex items-center justify-center gap-2 rounded px-2.5 py-2 font-mono text-xs font-bold uppercase tracking-[0.12em] transition-opacity disabled:cursor-not-allowed disabled:opacity-40 ${S?"bg-[#282c2d] text-white hover:bg-[#151819]":"bg-lime-300/90 text-black"}`,children:[(y||v)&&e.jsx(K,{size:13,className:"animate-spin"}),v?"Saving":"Save"]}),e.jsx("button",{type:"button",onClick:w,disabled:y||v,className:"rounded border border-[var(--scout-chrome-border-soft)] px-2.5 py-2 font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)] hover:bg-[var(--scout-chrome-hover)] disabled:cursor-not-allowed disabled:opacity-40",children:"Reload"})]})]})})}const vo="chill-dispatcher",So=6e4,ko=2500,wo=1.2,yo={lowCutHz:160,highCutHz:5200,bandQ:.35,saturationAmount:.035,bitcrushAmount:0,hissGain:0,hissCutoffHz:1800,presencePeakDb:1.5,presenceCenterHz:1500,presenceQ:.65,compressorThresholdDb:-15,compressorRatio:2.2,clickEnabled:!0,clickGain:.24,clickDurationMs:45,squelchTailEnabled:!0,squelchTailGain:.018,squelchTailDurationMs:95,outputGain:1,wetMix:.38};function jo(t){const o=Math.min(1,t/8);return{saturationAmount:.035+o*.025,presencePeakDb:1.5+o*1.5}}function No(t,o){return{...t==="chill-dispatcher"?yo:{},...jo(o)}}function ts(t,o,a){return new Promise((i,c)=>{const d=window.setTimeout(()=>c(new Error(a)),o);t.then(i,c).finally(()=>window.clearTimeout(d))})}async function De(t,o={}){!t.sessionId&&!o.allowCurrentSession||await ts(t.cancel(),ko,"Timed out releasing Scout voice session.").catch(()=>{})}function Co(t){const o=t instanceof Error?t.message:String(t);return/session_cancelled|was cancelled|cancelled/i.test(o)}const Ht=new RegExp("(?:^|(?<=[\\s(`'\"<>]))(?:~\\/|\\/(?:Users|home|opt|var|etc|tmp|private)\\/)[^\\s)`'\"<>]+\\.[A-Za-z0-9]{1,8}\\b","g");function Eo(t){const o=[],a=new Set;Ht.lastIndex=0;let i;for(;(i=Ht.exec(t))!==null;)a.has(i[0])||(a.add(i[0]),o.push(i[0]));return o}function Wt(t){const o=t.split("/").filter(Boolean);return o.length<=2?t:`…/${o.slice(-2).join("/")}`}function To(){return{requesterName:"OpenScout",productName:"Scout Voice",headline:"Turn on local voice",body:"Scout voice handles local speech capture and spoken replies. Start Scout services, then return here to talk with your workspace.",actionLabel:"Return to OpenScout",logo:{url:new URL("/openscout-icon.png",window.location.href).toString(),symbolName:"sparkles"}}}const Io=["Explain what went wrong here.","Help me rewrite this message.","What should I try next?"];function _o({height:t,forceExpanded:o=!1,fill:a=!1,presentation:i="chat",onOpenLive:c}={}){const{applyScoutbotUiAction:d,agents:p,route:j,onlineCount:N}=Rt(),g=bs(),M=ot(nt,!0),C=rt(),f=M&&(C.state==="connecting"||C.state==="live"),[b,h]=Lt("openscout.scoutbot.collapsed",!0),[_,y]=n.useState(""),[v,I]=n.useState(!1),[E,k]=n.useState(null),[w,S]=n.useState(null),[u,T]=n.useState(null),[P,W]=n.useState("idle"),[R,O]=Lt("openscout.scoutbot.voiceReplies",!1),[G]=Es("openscout.scoutbot.voiceSpeed",wo),[Y,x]=ge("openscout.scoutbot.voicePresetId",vo),[U,Z]=ge("openscout.scoutbot.speechProfileId",st),[F,L]=ge("openscout.scoutbot.customSpeechModelId",me.modelId),[z,at]=ge("openscout.scoutbot.customSpeechVoiceId",me.voiceId),[ke,it]=ge("openscout.scoutbot.customSpeechInstructions",me.instructions),[q,we]=n.useState(!1),[Ue,te]=n.useState(null),[Fe,he]=n.useState(""),[J,He]=n.useState(!1),[os,ct]=n.useState(null),[lt,We]=n.useState(null),[Mo,ye]=n.useState(null),[Ge,D]=n.useState(null),[oe,pe]=n.useState(!1),[ns,je]=n.useState(!1),[B,ne]=n.useState(null),[re,dt]=n.useState(!1),[Ye,ut]=n.useState(null),[mt,ht]=n.useState(!1),[pt,xt]=n.useState(!1),[ft,Ne]=n.useState(null),[bt,qe]=n.useState(null),[Ce,Ee]=n.useState(""),[Te,Ie]=n.useState(""),[gt,vt]=n.useState(null),[rs,ae]=n.useState(!1),[as,ie]=n.useState(0),[is,_e]=n.useState(!1),[Je,St]=n.useState(null),Re=bo(U)?U:st,Ve=n.useMemo(()=>go(Re,{modelId:F,voiceId:z,instructions:ke}),[ke,F,z,Re]),Me=n.useRef(Is()),ce=n.useRef(!1),Q=n.useRef(null),le=n.useRef(null),se=n.useRef(null),Le=n.useRef(R);Le.current=R,n.useEffect(()=>{i==="direct-voice"&&(Le.current=!0,O(!0))},[i,O]),n.useEffect(()=>(ce.current=!0,()=>{ce.current=!1,le.current="discard";const s=Q.current;Q.current=null,s&&De(s,{allowCurrentSession:!0}),se.current?.stop(),se.current=null}),[]);const V=n.useCallback(()=>{se.current?.stop(),se.current=null,He(!1)},[]),Ae=n.useCallback(s=>{if(!s)return;V();const r=Qs(s),l=i==="direct-voice"?_s(r,{speed:G,modelId:Ve.modelId,voiceId:Ve.voiceId,instructions:Ve.instructions}):Rs(r,{speed:G,presetId:Y,params:No(Y,N)});se.current=l,He(!0),l.promise.catch(m=>{Vs(m)||k(m instanceof Error?m.message:"Scout voice speech failed.")}).finally(()=>{se.current===l&&(se.current=null,He(!1))})},[V,G,Ve,N,i,Y]),kt=n.useCallback(s=>{Le.current&&Ae(s)},[Ae]),wt=n.useCallback(s=>{Ae(ue(s))},[Ae]),{openFilePreview:yt}=Rt(),jt=gs(),cs=n.useCallback((s,r)=>{const l=window.getSelection()?.toString().trim(),m=ue(r),A=Eo(m),$=[];if(l&&($.push({kind:"action",label:"Copy selection",shortcut:"⌘C",onSelect:()=>{$e(l)}}),$.push({kind:"separator"})),$.push({kind:"action",label:"Copy message",onSelect:()=>{$e(m)}}),A.length>0){$.push({kind:"separator"});for(const ee of A.slice(0,5)){const Qe=Wt(ee);$.push({kind:"action",label:`Preview ${Qe}`,onSelect:()=>yt(ee)})}for(const ee of A.slice(0,5)){const Qe=Wt(ee);$.push({kind:"action",label:`Open ${Qe} in OS`,onSelect:()=>{H("/api/file/reveal",{method:"POST",body:JSON.stringify({path:ee})}).catch(()=>{})}})}$.push({kind:"action",label:A.length===1?"Copy path":"Copy first path",onSelect:()=>{$e(A[0])}})}$.push({kind:"separator"}),$.push({kind:"action",label:J?"Say again (stop current)":"Say",onSelect:()=>wt(r)}),jt(s,$)},[yt,wt,jt,J]);n.useEffect(()=>()=>{V()},[V]);const ls=Io,de=n.useCallback(s=>{const r=[...s.messages].reverse().find(m=>m.role==="user"),l=[...s.messages].reverse().find(m=>m.role==="assistant");We(r?.body??null),ye(l?ue(l.body):null)},[]),xe=n.useCallback(async()=>{try{const s=await H("/api/scoutbot/session");ne(s),de(s.session)}catch{ne(null)}},[de]);n.useEffect(()=>{xe()},[xe]);const Pe=n.useCallback(async()=>{ht(!0),Ne(null);try{const s=await H("/api/scoutbot/config");Ee(s.model),Ie(s.systemPrompt),qe(null)}catch(s){Ne(s instanceof Error?s.message:"Could not load settings.")}finally{ht(!1)}},[]);n.useEffect(()=>{oe&&Pe()},[Pe,oe]),n.useEffect(()=>{if(!oe)return;let s=!1;return H("/api/voice/defaults").then(r=>{s||vt(r)}).catch(()=>{s||vt(null)}),()=>{s=!0}},[oe]);const Nt=n.useCallback(async()=>{xt(!0),Ne(null),qe(null);try{const s=await H("/api/scoutbot/config",{method:"POST",body:JSON.stringify({model:Ce,systemPrompt:Te})});Ee(s.config.model),Ie(s.config.systemPrompt),qe("Saved")}catch(s){Ne(s instanceof Error?s.message:"Could not save settings.")}finally{xt(!1)}},[Ce,Te]),ds=n.useCallback(async s=>{if(!(!s||Je)){St(s),k(null),V();try{const r=await H("/api/scoutbot/session/switch",{method:"POST",body:JSON.stringify({id:s})});ne(r),de(r.session),_e(!1),ae(!1),window.dispatchEvent(new CustomEvent(be,{detail:{id:r.session.id}}))}catch(r){k(r instanceof Error?r.message:"Could not switch session.")}finally{St(null)}}},[V,Je,de]),Oe=n.useCallback(async()=>{if(!(re||v)){if(B?.session.messages.length===0){y(""),k(null),ae(!1),_e(!1),D("New chat ready"),ie(s=>s+1);return}dt(!0),k(null),D("Starting new chat"),V();try{const s=await H("/api/scoutbot/session/reset",{method:"POST"});ne(s),y(""),We(null),ye(null),ae(!1),_e(!1),D("New chat ready"),ie(r=>r+1),window.dispatchEvent(new CustomEvent(be,{detail:{id:s.session.id}}))}catch(s){D(null),k(s instanceof Error?s.message:"Could not start a new chat.")}finally{dt(!1)}}},[re,v,B,V]),us=n.useCallback(async s=>{if(!(!s||Ye)){ut(s),k(null),V();try{const r=await H("/api/scoutbot/session/archive",{method:"POST",body:JSON.stringify({id:s})});ne(r),de(r.session),ae(!1),D("session archived"),window.dispatchEvent(new CustomEvent(be,{detail:{id:r.session.id}}))}catch(r){k(r instanceof Error?r.message:"Could not archive session.")}finally{ut(null)}}},[Ye,V,de]),ze=n.useCallback((s,r)=>{S(r),ct(s.activeInputDeviceName),T(r?null:s.lastUnavailableReason??"Scout voice service is not reachable."),W("idle")},[]),X=n.useCallback(async(s=!1)=>{const r=Me.current;W(m=>m==="launching"?m:"probing");const l=await r.probe(s?{force:!0}:void 0);return ze(r,l),l},[ze]);n.useEffect(()=>{Ms();const s=Me.current,r=Ls(l=>{S(l.ok),ct(l.inputDeviceName),T(l.ok?null:l.reason),W("idle")});return s.connectionState==="unknown"?X():ze(s,s.connectionState==="connected"),r},[ze,X]);const Ct=n.useCallback(()=>{const s=Me.current;k(null),W("launching"),s.launch({source:"openscout",context:To()}),window.setTimeout(()=>{X(!0)},2400)},[X]),Et=n.useCallback(s=>{const r=ue(s);ye(r);for(const l of Ts(s))l.type==="ask-agent"?(D(`Sending to ${l.targetLabel}`),H("/api/scoutbot/actions/ask",{method:"POST",body:JSON.stringify({targetLabel:l.targetLabel,targetAgentId:l.targetAgentId,body:l.body,channel:l.channel})}).then(m=>{D(m.flightId?`Sent to ${m.targetAgentId??m.targetLabel} · run ${m.flightId}`:`Sent to ${m.targetAgentId??m.targetLabel}`)}).catch(m=>{D(null),k(m instanceof Error?m.message:"Could not send to agent.")})):l.type!=="reminder"&&d(l);kt(r)},[d,kt]);n.useEffect(()=>{const s=()=>{D("Scoutbot replied by voice"),xe()},r=()=>{D("Scoutbot chat changed"),xe()};return window.addEventListener(Vt,s),window.addEventListener(be,r),()=>{window.removeEventListener(Vt,s),window.removeEventListener(be,r)}},[xe]);const fe=n.useCallback(async s=>{const r=s.trim();if(!(!r||v)){I(!0),k(null),We(r),ye(null),D("Sending"),y(l=>l.trim()===r?"":l);try{await Cs().catch(()=>null);const l=await H("/api/scoutbot/chat",{method:"POST",body:JSON.stringify({body:r,route:j,uiContext:vs("web")})});ne({session:l.session,sessions:l.sessions,config:l.config}),D("Reply received"),Et(l.reply.body)}catch(l){D(null),k(l instanceof Error?l.message:"Could not send.")}finally{I(!1)}}},[Et,j,v]),Tt=n.useCallback(async()=>{if(q)return;const s=Me.current;if(le.current=null,k(null),he(""),te("starting"),w!==!0&&!await X(!0)){te(null);return}let r=null,l=!1;const m=async()=>{!r||l||(l=!0,await De(r,{allowCurrentSession:Q.current===r}),Q.current===r&&(Q.current=null))};try{if(r=await s.startLive({onState:te,onPartial:he},{surface:i==="direct-voice"?"direct-voice":"chat-composer"}),!ce.current){await De(r,{allowCurrentSession:!0});return}Q.current=r,we(!0);const A=await r.result;if(await m(),!ce.current||(we(!1),he(""),le.current))return;te("done"),A.text&&await fe(A.text)}catch(A){const $=le.current;if(!ce.current)return;const ee=!!$||Co(A);if(await m(),we(!1),he(""),$==="stop-failed")return;te(ee?null:"error"),ee||k(A instanceof Error?A.message:"Scout voice recording failed.")}finally{ce.current&&await m(),le.current=null}},[fe,i,X,q,w]),It=n.useCallback(async()=>{const s=Q.current;if(s){te("processing");try{await ts(s.stop(),So,"Scout voice did not finish processing the recording.")}catch(r){le.current="stop-failed",await De(s,{allowCurrentSession:!0}),Q.current===s&&(Q.current=null,we(!1),he(""),te("error")),k(r instanceof Error?`Scout voice recording did not finish: ${r.message}`:"Scout voice recording did not finish.")}}},[]);n.useEffect(()=>{const s=()=>h(!1);return window.addEventListener("scout:scoutbot-panel-open",s),()=>window.removeEventListener("scout:scoutbot-panel-open",s)},[h]),n.useEffect(()=>js(()=>h(!b)),[b,h]),n.useEffect(()=>{const s=r=>{const l=r.detail,m=l&&typeof l=="object"&&"body"in l?l.body:null;typeof m=="string"&&m.trim()&&(h(!1),fe(m))};return window.addEventListener(At,s),()=>window.removeEventListener(At,s)},[fe,h]),n.useEffect(()=>{const s=r=>{const l=r.detail,m=l&&typeof l=="object"&&"body"in l?l.body:null;typeof m=="string"&&m.trim()&&(h(!1),y(m),ie(A=>A+1))};return window.addEventListener("scout:scoutbot-compose",s),()=>window.removeEventListener("scout:scoutbot-compose",s)},[h]);const _t=n.useMemo(()=>{const s=J?"speaking":v?"thinking":q?"listening":"idle",r=B?.session??null,l=r&&r.messages.length>0?r.messages[r.messages.length-1]:null;return{activity:s,brief:{lastDeliveredAt:null},reminders:{dueCount:0,upcomingCount:0,due:[],next:null},voice:{available:w,setupBlocked:w===!1,replies:R},error:E,session:{title:r?.title??null,lastActivityAt:l?.createdAt??r?.updatedAt??null},conversation:{messageCount:r?.messages.length??0,loading:B===null}}},[J,v,q,w,R,E,B]);n.useEffect(()=>{g?.publishState(_t)},[g,_t]),n.useEffect(()=>{if(!g)return;const s={focusScoutbot:()=>h(!1),triggerBrief:()=>{h(!1),ie(r=>r+1)},triggerAskState:()=>{h(!1),ie(r=>r+1)},toggleVoiceReplies:()=>{const r=!R;O(r),r||V()},openScoutbotSettings:()=>{h(!1),pe(!0)},startNewChat:()=>{h(!1),re||Oe()},dismissReminder:()=>{},askReminderStatus:()=>{h(!1),ie(r=>r+1)}};g.registerActions(s)},[g,h,R,O,V,pe,re,Oe]),n.useEffect(()=>{w===!0&&je(!1)},[w]);const ms=f?"Live call":q?Ue==="processing"?"Sending":"Stop":P==="probing"?"Checking Voice":P==="launching"?"Opening Scout":w===!1?"Open Scout":"Start Talking",hs=B!==null&&B.session.messages.length===0&&!v;if(i==="direct-voice")return e.jsx(fo,{messages:B?.session.messages??[],pendingAsk:v?lt:null,partial:Fe,error:E,status:Ge,recording:q,sending:v,speaking:J,voiceAvailable:w,voiceInputSource:os,voiceProbeState:P,voiceState:Ue,voiceReplies:R,settingsOpen:oe,assistantModel:B?.session.model??B?.config.model??null,setupPanel:w===!1?e.jsx(Ut,{issue:u,probeState:P,onLaunch:Ct,onRetry:()=>{X(!0)},onSettings:()=>pe(!0),onDismiss:()=>je(!1)}):null,settingsPanel:e.jsx(Ft,{presentation:"direct-voice",voicePresetId:Y,onVoicePresetId:x,speechSelectionId:Re,onSpeechSelectionId:Z,customSpeechModelId:F,onCustomSpeechModelId:L,customSpeechVoiceId:z,onCustomSpeechVoiceId:at,customSpeechInstructions:ke,onCustomSpeechInstructions:it,voiceDefaults:gt,modelDraft:Ce,onModelDraft:Ee,promptDraft:Te,onPromptDraft:Ie,configLoading:mt,configSaving:pt,configError:ft,configStatus:bt,onSave:()=>{Nt()},onReload:()=>{Pe()}}),onPrimaryAction:()=>{J?V():q?It():w===!1?X(!0):Tt()},onToggleVoiceReplies:()=>{const s=!R;Le.current=s,O(s),s||V()},onToggleSettings:()=>pe(s=>!s),onNewChat:()=>{re||Oe()},onOpenLive:c});if(b&&!o)return e.jsx("div",{className:"flex shrink-0 items-center border-t border-[var(--scout-chrome-border-soft)] px-3 py-1.5",children:e.jsx(Ns,{})});const ps=a?"flex h-full min-h-0 flex-col overflow-hidden border-t border-[var(--scout-chrome-border-soft)]":t===void 0?"flex max-h-[60vh] shrink-0 flex-col overflow-hidden border-t border-[var(--scout-chrome-border-soft)]":"flex shrink-0 flex-col overflow-hidden border-t border-[var(--scout-chrome-border-soft)]",xs=t===void 0||a?void 0:{height:`${t}px`};return e.jsxs("section",{className:ps,style:xs,children:[e.jsxs("div",{className:"flex shrink-0 flex-col gap-2 px-3 pt-2.5 pb-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-2",children:e.jsx(Hs,{size:20,className:"shrink-0 text-lime-300","aria-hidden":"true"})}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx(Bt,{icon:R?e.jsx(Gt,{size:11}):e.jsx(Yt,{size:11}),title:f?R?"Voice replies on for typed chat (live call has its own audio)":"Voice replies off for typed chat (live call has its own audio)":R?"Voice replies on (click to mute)":"Voice replies off (click to enable)",onClick:()=>{const s=!R;O(s),s||V()},active:R}),!o&&e.jsx(Bt,{icon:e.jsx(Ke,{size:11}),title:"Minimize",onClick:()=>h(!0)})]})]}),oe&&e.jsx(Ft,{presentation:"chat",voicePresetId:Y,onVoicePresetId:x,speechSelectionId:Re,onSpeechSelectionId:Z,customSpeechModelId:F,onCustomSpeechModelId:L,customSpeechVoiceId:z,onCustomSpeechVoiceId:at,customSpeechInstructions:ke,onCustomSpeechInstructions:it,voiceDefaults:gt,modelDraft:Ce,onModelDraft:Ee,promptDraft:Te,onPromptDraft:Ie,configLoading:mt,configSaving:pt,configError:ft,configStatus:bt,onSave:()=>{Nt()},onReload:()=>{Pe()}})]}),e.jsx("div",{className:"flex min-h-0 flex-1 flex-col px-3 pb-1.5",children:B&&e.jsx(to,{state:B,chatExpanded:rs,onToggleExpanded:()=>ae(s=>!s),sessionPickerOpen:is,onToggleSessionPicker:()=>_e(s=>!s),onStartNewChat:()=>{Oe()},startingNewChat:re,onSwitchSession:s=>{ds(s)},switchingSessionId:Je,sending:v,briefing:!1,pendingAsk:v?lt:null,onArchiveSession:s=>{us(s)},archivingSessionId:Ye,onAssistantContextMenu:cs,suggestedPrompts:ls,onSelectPrompt:s=>{y(s),ae(!1)}})}),e.jsxs("div",{className:"flex shrink-0 flex-col gap-1.5 border-t border-[var(--scout-chrome-border-soft)] bg-black/10 px-3 pt-2 pb-2.5",children:[w===!1&&ns&&!f&&e.jsx(Ut,{issue:u,probeState:P,onLaunch:Ct,onRetry:()=>{X(!0)},onSettings:()=>pe(!0),onDismiss:()=>je(!1)}),(Fe||J)&&!f&&e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded border border-[var(--scout-chrome-border-soft)] bg-black/10 px-2.5 py-2 font-mono text-xs leading-relaxed text-[var(--scout-chrome-ink-faint)]",children:[e.jsx("span",{className:"min-w-0 truncate",children:J?"Speaking reply…":Fe}),J&&e.jsx("button",{type:"button",title:"Stop spoken reply",onClick:V,className:"shrink-0 rounded border border-[var(--scout-chrome-border-soft)] p-1 text-[var(--scout-chrome-ink)] hover:bg-[var(--scout-chrome-hover)]",children:e.jsx(Kt,{size:11,className:"fill-current"})})]}),Ge&&!v&&e.jsx("div",{className:"font-mono text-2xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-ghost)]",children:Ge}),e.jsx(oo,{agents:p,draft:_,onDraftChange:y,onSubmit:()=>{fe(_)},sending:v,recording:q,voiceLabel:ms,voiceBusy:Ue==="processing"||P==="probing"||P==="launching",voiceUnavailable:w===!1,voiceHeld:f,onMicClick:()=>{if(!f){if(w===!1){je(!0);return}q?It():Tt()}},prominent:hs&&!f,autoFocus:o,focusSignal:as}),E&&e.jsx("div",{className:"rounded border border-red-400/30 bg-red-400/10 px-2.5 py-2 font-mono text-xs leading-relaxed text-red-200",children:E})]})]})}function ss({dictationActive:t=!1,autoStart:o=!1}){const a=ot(nt,!0),{enabled:i,state:c,leaseId:d,startCall:p,endCall:j}=rt(),N=n.useRef(!1),g=n.useRef(null),[M,C]=n.useState(()=>window.innerWidth>=720&&window.innerHeight>=520?"page":"compact"),f=window.webkit?.messageHandlers?.scoutRealtimeVoice;return n.useEffect(()=>{const b=()=>{C(window.innerWidth>=720&&window.innerHeight>=520?"page":"compact")};return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[]),n.useEffect(()=>{f?.postMessage({kind:"session-state",state:c,leaseId:d})},[d,f,c]),n.useEffect(()=>{const b=()=>{if(g.current)return g.current;const _=j().finally(()=>{g.current===_&&(g.current=null)});return g.current=_,_},h=()=>{b()};return window.__scoutRealtimeVoiceStop=b,window.addEventListener(Mt,h),window.__scoutRealtimeVoiceStopRequested&&b(),()=>{window.removeEventListener(Mt,h),window.__scoutRealtimeVoiceStop===b&&delete window.__scoutRealtimeVoiceStop}},[j]),n.useEffect(()=>{!o||t||!a||!i||N.current||c!=="idle"&&c!=="ended"&&c!=="error"||(N.current=!0,p())},[o,t,a,i,p,c]),a?i?e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(Jt,{state:c,onMinimize:f?()=>f.postMessage("minimize"):void 0,onExpand:f?()=>f.postMessage(M==="page"?"restore":"expand"):void 0,layout:M}),e.jsx(Qt,{dictationActive:t,layout:M})]}):e.jsxs("div",{className:"flex h-full flex-col justify-center gap-2 p-4",children:[e.jsx("p",{className:"font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:"Live voice is disabled"}),e.jsx("p",{className:"text-sm leading-snug text-[var(--scout-chrome-ink-faint)]",children:"Enable realtime voice in Settings → Voice. The footer Voice control starts and manages calls."})]}):e.jsxs("div",{className:"flex h-full flex-col justify-center gap-2 p-4",children:[e.jsx("p",{className:"font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:"Live voice is off"}),e.jsx("p",{className:"text-sm leading-snug text-[var(--scout-chrome-ink-faint)]",children:"This Scout build has live conversations disabled. Calls use the configured OpenAI API account when the feature is available."})]})}function Ro(){const t=ot(nt,!0),{enabled:o,state:a}=rt(),[i,c]=n.useState("direct"),d=t&&o;return i==="direct"?e.jsx("main",{className:"h-full min-h-0 overflow-hidden bg-[#f3f0e9]",children:e.jsx(_o,{forceExpanded:!0,fill:!0,presentation:"direct-voice",onOpenLive:()=>c("realtime")})}):e.jsxs("main",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-[var(--scout-chrome-bg)]",children:[e.jsxs("header",{className:"flex min-h-14 shrink-0 items-center justify-between gap-4 border-b border-[var(--scout-chrome-border-soft)] px-4 py-2.5 sm:px-7",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("h1",{className:"truncate font-[var(--font-accent-title)] text-[17px] font-semibold tracking-[-0.018em] text-[var(--scout-chrome-ink-strong)]",children:"GPT Live"}),e.jsx("span",{className:"hidden h-4 w-px bg-[var(--scout-chrome-border-soft)] sm:block","aria-hidden":"true"}),e.jsxs("span",{className:"hidden items-center gap-2 text-xs text-[var(--scout-chrome-ink-faint)] sm:flex",children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${d?"bg-[var(--scout-accent)]":"bg-[var(--scout-chrome-ink-ghost)]"}`,"aria-hidden":"true"}),d?"Ready for a live call":"Live voice unavailable"]})]}),e.jsxs("div",{className:"flex rounded-md border border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] p-0.5",role:"tablist","aria-label":"Voice mode",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":"false",onClick:()=>c("direct"),className:"rounded-[4px] px-3 py-1.5 text-[11px] font-medium text-[var(--scout-chrome-ink-faint)] transition-colors hover:text-[var(--scout-chrome-ink-strong)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--scout-accent)]",children:"Direct"}),e.jsx("button",{type:"button",role:"tab","aria-selected":"true",className:"rounded-[4px] bg-[var(--scout-chrome-ink-strong)] px-3 py-1.5 text-[11px] font-medium text-[var(--scout-chrome-bg)] shadow-[0_1px_2px_rgba(0,0,0,0.14)]",children:"Live"})]})]}),e.jsx("section",{className:"min-h-0 flex-1 overflow-hidden",children:d?e.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[e.jsx(Jt,{state:a,layout:"page"}),e.jsx(Qt,{dictationActive:!1,layout:"page"})]}):e.jsx(ss,{})})]})}const Vo=Ws({id:"voice",label:"Voice",route:{view:"voice"},webPath:"/voice",screen:"RealtimeVoiceScreen",embed:{path:"/embed/voice",profile:"macos.voice",rootClassName:"s-voice-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},hosts:{macos:!0},resolveEmbedProps:t=>({dictationActive:t.get("dictationActive")==="1",autoStart:t.get("autoStart")==="1"})}}),ln=Object.freeze(Object.defineProperty({__proto__:null,RealtimeVoicePage:Ro,RealtimeVoiceScreen:ss,scoutSurface:Vo},Symbol.toStringTag,{value:"Module"}));export{Ro as R,_o as S,ln as a};
@@ -1 +1 @@
1
- import{j as s}from"./index-DmFAhGPj.js";import{R as c}from"./RepoDiffViewerLazy-CWE5GxMP.js";/* empty css */const l=["unstaged","staged","branch"];function o(e){const t=e.getAll("layer").filter(r=>l.includes(r));return t.length>0?t:void 0}function p(){const e=typeof window>"u"?new URLSearchParams:new URLSearchParams(window.location.search),t=e.get("path")?.trim()??"",r=e.getAll("file").map(i=>i.trim()).filter(Boolean),a=e.get("sessionId")?.trim()||void 0,n=e.get("agentId")?.trim()||void 0,d=e.get("include")==="all"||e.get("include")==="touched"?"all":"changed";return t?s.jsx(c,{path:t,layers:o(e),files:r,session:a||n?{sessionId:a,agentId:n,include:d}:null,className:"rd-embed"}):s.jsx("div",{className:"rd-viewer rd-embed","data-scout-theme":!0,children:s.jsx("div",{className:"rd-center",children:s.jsxs("div",{className:"rd-center-card",children:[s.jsx("div",{className:"rd-center-title",children:"No worktree path"}),s.jsxs("div",{className:"rd-center-body",children:["This embed needs a ",s.jsx("code",{children:"?path=<absolute-path>"})," query parameter."]})]})})})}export{p as RepoDiffEmbedScreen,p as default};
1
+ import{j as s}from"./index-CZ-05hKz.js";import{R as c}from"./RepoDiffViewerLazy-C0--fPtk.js";/* empty css */const l=["unstaged","staged","branch"];function o(e){const t=e.getAll("layer").filter(r=>l.includes(r));return t.length>0?t:void 0}function p(){const e=typeof window>"u"?new URLSearchParams:new URLSearchParams(window.location.search),t=e.get("path")?.trim()??"",r=e.getAll("file").map(i=>i.trim()).filter(Boolean),a=e.get("sessionId")?.trim()||void 0,n=e.get("agentId")?.trim()||void 0,d=e.get("include")==="all"||e.get("include")==="touched"?"all":"changed";return t?s.jsx(c,{path:t,layers:o(e),files:r,session:a||n?{sessionId:a,agentId:n,include:d}:null,className:"rd-embed"}):s.jsx("div",{className:"rd-viewer rd-embed","data-scout-theme":!0,children:s.jsx("div",{className:"rd-center",children:s.jsxs("div",{className:"rd-center-card",children:[s.jsx("div",{className:"rd-center-title",children:"No worktree path"}),s.jsxs("div",{className:"rd-center-body",children:["This embed needs a ",s.jsx("code",{children:"?path=<absolute-path>"})," query parameter."]})]})})})}export{p as RepoDiffEmbedScreen,p as default};
@@ -1 +1 @@
1
- import{j as e}from"./index-DmFAhGPj.js";import{R as l}from"./RepoDiffViewerLazy-CWE5GxMP.js";/* empty css */const f=1;function m(t=typeof performance>"u"?void 0:performance){const r=(t?.getEntriesByType?.("navigation")??[]).find(i=>typeof i.type=="string");return r?r.type==="reload":t?.navigation?.type===f}function u({path:t,layers:n,files:r,sessionId:i,agentId:o,include:s,navigate:c}){const a=t.trim();if(!a)return e.jsx("div",{className:"rd-viewer",children:e.jsx("div",{className:"rd-center",children:e.jsxs("div",{className:"rd-center-card",children:[e.jsx("div",{className:"rd-center-title",children:"No worktree path"}),e.jsxs("div",{className:"rd-center-body",children:["This page needs a ",e.jsx("code",{children:"?path=<absolute-path>"})," query parameter."]})]})})});const d=[a,n?.join(",")??"",r?.join("\0")??"",i??"",o??"",s??""].join(""),p=m();return e.jsx(l,{path:a,layers:n,files:r,session:i||o?{sessionId:i,agentId:o,include:s}:null,forceInitialLoad:p,onClose:()=>c({view:"repos"})},d)}export{u as RepoDiffPageScreen,u as default};
1
+ import{j as e}from"./index-CZ-05hKz.js";import{R as l}from"./RepoDiffViewerLazy-C0--fPtk.js";/* empty css */const f=1;function m(t=typeof performance>"u"?void 0:performance){const r=(t?.getEntriesByType?.("navigation")??[]).find(i=>typeof i.type=="string");return r?r.type==="reload":t?.navigation?.type===f}function u({path:t,layers:n,files:r,sessionId:i,agentId:o,include:s,navigate:c}){const a=t.trim();if(!a)return e.jsx("div",{className:"rd-viewer",children:e.jsx("div",{className:"rd-center",children:e.jsxs("div",{className:"rd-center-card",children:[e.jsx("div",{className:"rd-center-title",children:"No worktree path"}),e.jsxs("div",{className:"rd-center-body",children:["This page needs a ",e.jsx("code",{children:"?path=<absolute-path>"})," query parameter."]})]})})});const d=[a,n?.join(",")??"",r?.join("\0")??"",i??"",o??"",s??""].join(""),p=m();return e.jsx(l,{path:a,layers:n,files:r,session:i||o?{sessionId:i,agentId:o,include:s}:null,forceInitialLoad:p,onClose:()=>c({view:"repos"})},d)}export{u as RepoDiffPageScreen,u as default};
@@ -0,0 +1,7 @@
1
+ import{r as l,j as n}from"./index-CZ-05hKz.js";import{a as X,p as Z}from"./ui-LM8pS8qE.js";/* empty css */import{a as T,s as q,l as ee,L as te,f as K,S as ne,r as se,b as re,c as _,d as ie,u as ae,V as A,C as H,D as le,e as oe}from"./usePierreRuntime-DUuXH5yp.js";import{C as ce}from"./chevron-down-Mp9mu_yd.js";import{C as de}from"./check-C18YQC90.js";import{L as ue}from"./loader-circle-BiohlpM3.js";import{S as fe}from"./send-horizontal-CgLppsIC.js";import{F as he}from"./file-code-corner-7mo7EviR.js";import{C as me}from"./code-xml-Jtxsp5d1.js";import{X as pe}from"./x-e3h2hDsp.js";import{r as O,a as Y,f as V}from"./cache-CeWH_KzJ.js";import{M as xe}from"./message-square-D9YYWE0x.js";import{R as ge}from"./refresh-cw-BRn9Oxxl.js";import{P as be}from"./plus-CuU_X0-8.js";import{a as B}from"./api-Co9aQ2Jw.js";import"./chunk-HRAB3GC3-swV8PA2k.js";import"./createLucideIcon-DXpqZP7I.js";import"./perf-PX8Rx0EP.js";function je({snapshot:e,selectedFile:t,targets:r,targetId:s,onTargetId:i,draft:c,onDraft:f,contextItems:o,onRemoveContextItem:p,pending:a,status:d,error:g,textareaRef:k,onSubmit:S}){const[u,y]=l.useState(!1),b=l.useRef(null),w=r.find(h=>h.id===s)??null,m=w?.label??"Scout",C=r[0]?.id??null,N=t?T(t):null,I=(c.trim().length>0||o.length>0)&&!a,R=l.useMemo(()=>[...r.map(h=>({id:h.id,label:h.label,suffix:h.id===C?"best context":null})),{id:"scout",label:"Scout",suffix:null}],[C,r]);return l.useEffect(()=>{if(!u)return;const h=$=>{const D=b.current;D&&$.target instanceof Node&&D.contains($.target)||y(!1)};return document.addEventListener("pointerdown",h),()=>document.removeEventListener("pointerdown",h)},[u]),n.jsxs("div",{className:"rd-comment",children:[o.length>0?n.jsx("div",{className:"rd-comment-context","aria-label":"Included diff context",children:o.map(h=>n.jsx(ye,{item:h,disabled:a,onRemove:p},h.id))}):null,n.jsxs("div",{className:"rd-comment-main",children:[n.jsxs("div",{className:"rd-target-picker",ref:b,children:[n.jsxs("button",{type:"button",className:"rd-target-button",onClick:()=>y(h=>!h),onKeyDown:h=>{h.stopPropagation(),h.key==="Escape"&&y(!1)},disabled:a,"aria-label":"Diff comment target","aria-haspopup":"listbox","aria-expanded":u,title:"Diff comment target",children:[n.jsx("span",{children:m}),n.jsx(ce,{size:13,strokeWidth:2,"aria-hidden":!0})]}),u?n.jsx("div",{className:"rd-target-menu",role:"listbox","aria-label":"Diff comment target",children:R.map(h=>{const $=h.id===(w?.id??"scout");return n.jsxs("button",{type:"button",className:"rd-target-option",role:"option","aria-selected":$,onClick:()=>{i(h.id),y(!1)},children:[n.jsx("span",{className:"rd-target-option-label",children:h.label}),h.suffix?n.jsx("span",{className:"rd-target-option-suffix",children:h.suffix}):null,n.jsx("span",{className:"rd-target-option-check","aria-hidden":!0,children:$?n.jsx(de,{size:12,strokeWidth:2.2}):null})]},h.id)})}):null]}),n.jsx("textarea",{ref:k,value:c,onChange:h=>f(h.currentTarget.value),onKeyDown:h=>{h.stopPropagation(),(h.metaKey||h.ctrlKey)&&h.key==="Enter"&&(h.preventDefault(),S())},rows:1,disabled:a,placeholder:o.length>0?`Send to ${m} with included context`:"Leave a note on this diff…","aria-label":"Diff comment"}),n.jsxs("button",{type:"button",className:"rd-comment-send",disabled:!I,onClick:S,title:"Send diff comment","aria-label":"Send diff comment",children:[a?n.jsx(ue,{size:13,className:"rd-comment-spin","aria-hidden":!0}):n.jsx(fe,{size:13,"aria-hidden":!0}),n.jsx("span",{children:a?"Sending":"Send"})]})]}),n.jsx("div",{className:"rd-comment-meta",children:g?n.jsx("span",{className:"err",children:g}):d?n.jsx("span",{className:"ok",children:d}):n.jsxs("span",{children:[e.scope?.kind==="session"?"Session diff":"Worktree diff",N?` · ${N}`:""]})})]})}function ye({item:e,disabled:t,onRemove:r}){const s=e.kind==="file"?he:me;return n.jsxs("div",{className:`rd-context-item ${e.kind}`,children:[n.jsxs("div",{className:"rd-context-head",children:[n.jsx("span",{className:"rd-context-icon","aria-hidden":!0,children:n.jsx(s,{size:12,strokeWidth:2})}),n.jsx("span",{className:"rd-context-label",title:e.label,children:e.label}),n.jsx("span",{className:"rd-context-detail",children:e.detail}),n.jsx("button",{type:"button",className:"rd-context-remove",onClick:()=>r(e.id),disabled:t,title:"Remove included context","aria-label":"Remove included context",children:n.jsx(pe,{size:11,strokeWidth:2.2,"aria-hidden":!0})})]}),e.preview?n.jsx("pre",{className:"rd-context-preview",children:e.preview}):null]})}function Ce({heading:e,worktreePath:t,snapshot:r,freshness:s,activeLayer:i,onLayer:c,layout:f,onLayout:o,refreshing:p,onRefresh:a,onFocusComment:d,onClose:g,onOpenAsPage:k}){const{dir:S}=q(t);return n.jsxs("div",{className:"rd-header",children:[n.jsxs("div",{className:"rd-header-id",children:[n.jsxs("div",{className:"rd-header-title",children:[n.jsx("span",{className:"rd-header-name",title:t,children:e}),r.scope?n.jsx(ke,{snapshot:r}):null,S?n.jsx("span",{className:"rd-header-dir",children:S}):null]}),n.jsx("div",{className:"rd-header-sub",children:n.jsx(Ne,{layers:r.layers,activeLayer:i,onLayer:c})}),n.jsx(Se,{freshness:s,generatedAt:r.generatedAt})]}),n.jsxs("div",{className:"rd-header-actions",children:[n.jsx("button",{type:"button",className:"rd-close","aria-label":"Comment on diff",title:"Comment on diff",onClick:d,children:n.jsx(xe,{size:14,strokeWidth:2,"aria-hidden":!0})}),n.jsxs("div",{className:"rd-segmented",role:"group","aria-label":"Diff layout",children:[n.jsx("button",{type:"button",className:f==="unified"?"on":"","aria-pressed":f==="unified",onClick:()=>o("unified"),children:"Unified"}),n.jsx("button",{type:"button",className:f==="split"?"on":"","aria-pressed":f==="split",onClick:()=>o("split"),children:"Split"})]}),n.jsx("button",{type:"button",className:`rd-close${p?" spinning":""}`,"aria-label":"Refresh diff",title:"Fetch fresh diff",onClick:a,disabled:p,children:n.jsx(ge,{size:14,strokeWidth:2,"aria-hidden":!0})}),k?n.jsx("button",{type:"button",className:"rd-close","aria-label":"Open diff as page",title:"Open as full page",onClick:k,children:"↗"}):null,g?n.jsx("button",{type:"button",className:"rd-close","aria-label":"Close",onClick:g,children:"✕"}):null]})]})}function $e({snapshot:e}){const t=[];e.coverage.truncatedLayers>0&&t.push({level:"warning",text:`${e.coverage.truncatedLayers} layer${e.coverage.truncatedLayers===1?"":"s"} truncated — the native diff hit a size budget; some files or hunks are omitted.`}),e.coverage.scanBudgetReached&&t.push({level:"warning",text:"Scan budget reached — this diff is partial."});for(const r of e.diagnostics)t.push({level:r.level,text:r.path?`${r.message} (${r.path})`:r.message});return t.length===0?null:n.jsx(n.Fragment,{children:t.map((r,s)=>n.jsxs("div",{className:`rd-banner ${r.level}`,children:[n.jsx("span",{className:"rd-banner-dot","aria-hidden":!0}),n.jsx("span",{children:r.text})]},s))})}function ke({snapshot:e}){const t=e.scope;if(!t)return null;const r=t.kind==="session"?`Session · ${t.filteredPaths.length} files`:t.filteredPaths.length>0?`Filtered · ${t.filteredPaths.length} files`:"Worktree",s=t.kind==="session"?`${t.label}: path-filtered diff from ${t.changedFiles} changed / ${t.touchedFiles} touched session files`:t.label;return n.jsx("span",{className:`rd-scope-pill ${t.kind}`,title:s,children:r})}function Se({freshness:e,generatedAt:t}){const r=e?.fetchedAt??t,s=Math.max(0,Date.now()-r),i=e?.cacheHit?`Prefetched ${O(s)}`:`Updated ${O(s)}`;return n.jsxs("div",{className:"rd-freshness",title:new Date(r).toLocaleString(),children:[n.jsx("span",{children:i}),e?.refreshing?n.jsx("span",{children:"Refreshing…"}):null,e?.refreshError?n.jsx("span",{children:"Refresh failed"}):null]})}function Ne({layers:e,activeLayer:t,onLayer:r}){return n.jsx("div",{className:"rd-layers",role:"tablist","aria-label":"Diff layers",children:e.map(s=>{const i=ee(s);return n.jsxs("button",{type:"button",role:"tab","aria-selected":s.kind===t,className:"rd-layer-tab"+(s.kind===t?" on":""),onClick:()=>r(s.kind),title:s.shortstat??void 0,children:[n.jsx("span",{children:te[s.kind]??s.kind}),n.jsx("span",{className:"rd-layer-stat",children:s.files.length===0?"clean":n.jsxs(n.Fragment,{children:[s.files.length,"f"," ",n.jsxs("span",{style:{color:"var(--rd-add)"},children:["+",i.add]})," ",n.jsxs("span",{style:{color:"var(--rd-del)"},children:["−",i.del]}),s.truncated?" ⚠":""]})})]},s.kind)})})}const G="openscout.repo-diff.files-rail-width",U=268,we=196,ve=520;function Ie(e,t){if(e.length<=t)return e;const r=e.lastIndexOf(".");if(r<=0){const p=Math.max(1,Math.floor((t-1)/2)),a=t-p-1;return e.slice(0,p)+"…"+e.slice(-Math.max(1,a))}const s=e.slice(0,r),i=e.slice(r),c=t-i.length-1;if(c<2){const p=Math.max(1,t-i.length-1);return s.slice(0,p)+"…"+i}const f=Math.max(1,Math.floor(c/2)),o=Math.max(1,c-f);return s.slice(0,f)+"…"+s.slice(-o)+i}function De(e,t){return Math.max(8,Math.floor((e-178-t*14)/6.7))}function W(e){return Math.max(we,Math.min(ve,Math.round(e)))}function Re(){if(typeof window>"u")return U;const e=Number(window.localStorage.getItem(G));return Number.isFinite(e)?W(e):U}function Le(e){const t={name:"",path:"",firstIndex:Number.MAX_SAFE_INTEGER,children:new Map,files:[]};for(const r of e){t.firstIndex=Math.min(t.firstIndex,r.index);const s=r.dir?r.dir.split("/").filter(Boolean):[];let i=t;for(const c of s){const f=i.path?`${i.path}/${c}`:c;let o=i.children.get(c);o||(o={name:c,path:f,firstIndex:r.index,children:new Map,files:[]},i.children.set(c,o)),o.firstIndex=Math.min(o.firstIndex,r.index),i=o}i.files.push(r)}return t}function J(e){let t=e.files.length;for(const r of e.children.values())t+=J(r);return t}function Pe({layer:e,selectedFileKey:t,onSelect:r,onIncludeFile:s}){const[i,c]=l.useState(Re),[f,o]=l.useState(()=>new Set),p=l.useMemo(()=>(e?.files??[]).map((u,y)=>{const b=K(u,y),w=T(u),{name:m,dir:C}=q(w),N=(u.status==="renamed"||u.status==="copied")&&u.oldPath&&u.newPath&&u.oldPath!==u.newPath;return{file:u,index:y,key:b,display:w,name:m,dir:C,renamed:!!N}}),[e]),a=l.useMemo(()=>Le(p),[p]),d=l.useCallback(u=>{o(y=>{const b=new Set(y);return b.has(u)?b.delete(u):b.add(u),b})},[]),g=l.useCallback(u=>{u.preventDefault();const y=u.clientX,b=i,w=C=>{c(W(b+C.clientX-y))},m=()=>{window.removeEventListener("pointermove",w),window.removeEventListener("pointerup",m),c(C=>{const N=W(C);return window.localStorage.setItem(G,String(N)),N})};window.addEventListener("pointermove",w),window.addEventListener("pointerup",m,{once:!0})},[i]),k=(u,y)=>n.jsx(Fe,{entry:u,depth:y,railWidth:i,selected:u.key===t,onSelect:r,onIncludeFile:s},u.key),S=(u,y)=>{const b=[],w=[...u.children.values()].sort((m,C)=>m.firstIndex!==C.firstIndex?m.firstIndex-C.firstIndex:m.name.localeCompare(C.name));for(const m of w){const C=f.has(m.path);b.push(n.jsxs("button",{type:"button",className:"rd-dir-row",style:{paddingLeft:12+y*14},onClick:()=>d(m.path),title:m.path,children:[n.jsx("span",{className:"rd-dir-caret",children:C?"›":"⌄"}),n.jsx("span",{className:"rd-dir-name",children:m.name}),n.jsx("span",{className:"rd-dir-count",children:J(m)})]},`dir:${m.path}`)),C||b.push(...S(m,y+1))}for(const m of u.files)b.push(k(m,y));return b};return n.jsxs("div",{className:"rd-rail",style:{width:i},children:[n.jsx("div",{className:"rd-rail-head",children:e?`Changed files · ${e.files.length}`:"Changed files"}),n.jsx("div",{className:"rd-rail-list",children:S(a,0)}),n.jsx("div",{className:"rd-rail-resizer",role:"separator","aria-orientation":"vertical","aria-label":"Resize file navigation",onPointerDown:g})]})}function Fe({entry:e,depth:t,railWidth:r,selected:s,onSelect:i,onIncludeFile:c}){const{file:f,key:o,display:p,name:a,dir:d,renamed:g}=e,k=De(r,t),S=Ie(a,k);return n.jsxs("div",{className:"rd-file-row"+(s?" on":""),title:g?`${f.oldPath} → ${f.newPath}`:p,children:[n.jsxs("button",{type:"button",className:"rd-file-pick",style:{paddingLeft:18+t*14},onClick:()=>i(o),children:[n.jsx("span",{className:`rd-file-glyph ${f.status}`,children:ne[f.status]}),n.jsxs("span",{className:"rd-file-id",children:[n.jsx("span",{className:"rd-file-name",children:S}),n.jsx("span",{className:"rd-file-dir",children:g?`${f.oldPath} → ${d||a}`:d}),n.jsx(Ee,{file:f})]})]}),n.jsx("span",{className:"rd-file-churn",children:f.binary?n.jsx("span",{className:"add",style:{color:"var(--muted)"},children:"bin"}):n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"add",children:["+",f.additions??0]}),n.jsxs("span",{className:"del",children:["−",f.deletions??0]})]})}),n.jsx("button",{type:"button",className:"rd-file-include",onClick:u=>{u.stopPropagation(),c(f,o)},"aria-label":`Include ${p} in comment`,title:"Include in comment",children:n.jsx(be,{size:12,strokeWidth:2,"aria-hidden":!0})})]})}function Ee({file:e}){const t=[];return e.binary&&t.push("BINARY"),e.truncated&&t.push("TRUNCATED"),e.status==="conflict"&&t.push("CONFLICT"),t.length===0?null:n.jsx("span",{className:"rd-file-tags",children:t.map(r=>n.jsx("span",{className:"rd-file-tag",children:r},r))})}function Me(e){switch(e?.trim().toLowerCase()){case"active":case"working":case"running":case"in_turn":return 80;case"queued":case"waiting":case"waking":case"in_flight":return 50;case"idle":case"available":return 25;case"offline":case"retired":case"stale":return-40;default:return 0}}function Te(e){return e.newPath??e.oldPath??"(unknown)"}function Q(e){const t=e.scope?.kind==="session"?e.scope.agentId:null,r=new Map;for(const s of e.scout.hints)s.agentId&&r.set(s.agentId,(r.get(s.agentId)??0)+1);return e.scout.agents.map(s=>({id:s.id,label:X(s),score:Me(s.state)+(s.id===t?1e3:0)+(r.get(s.id)??0)*10})).sort((s,i)=>{const c=i.score-s.score;return c!==0?c:s.label.localeCompare(i.label)})}function Ae(e){return Q(e)[0]??null}function Ke(e){const t=e.files.reduce((r,s)=>({add:r.add+(s.additions??0),del:r.del+(s.deletions??0)}),{add:0,del:0});return`${e.kind}: ${e.files.length} file${e.files.length===1?"":"s"}, +${t.add} -${t.del}${e.truncated?", truncated":""}`}function z(e){const t=e.binary?"binary":`+${e.additions??0} -${e.deletions??0}`;return`${e.status}: ${Te(e)} (${t}${e.truncated?", truncated":""})`}function We(e){const t=e.scope;return t?t.kind==="session"?`session ${t.sessionId??t.refId??"(unknown)"} (${t.changedFiles} changed / ${t.touchedFiles} touched files, ${t.include})`:t.filteredPaths.length>0?`filtered worktree (${t.filteredPaths.length} paths)`:"worktree":"worktree"}function ze(e){const{comment:t,includedContext:r=[],snapshot:s,activeLayer:i,selectedFile:c}=e,o=((i?s.layers.find(d=>d.kind===i)??null:null)?.files??s.layers.flatMap(d=>d.files)).slice(0,12).map(z),p=s.scout.agents.map(d=>X(d)).slice(0,8),a=["Operator comment on repo diff:",t,"","Repo Diff context:",`- Worktree: ${s.worktreePath}`,`- Scope: ${We(s)}`,`- Active layer: ${i??"none"}`];return r.length>0&&a.splice(3,0,"Included diff context:",...r.map(d=>d.trim()).filter(Boolean),""),c&&a.push(`- Selected file: ${z(c)}`),a.push(`- Layers: ${s.layers.map(Ke).join("; ")}`),p.length>0&&a.push(`- Attached agents: ${p.join(", ")}`),s.scout.sessions.length>0&&a.push(`- Sessions: ${s.scout.sessions.map(d=>d.id).slice(0,8).join(", ")}`),o.length>0&&a.push(`- Changed files: ${o.join(", ")}`),s.diagnostics.length>0&&a.push(`- Diagnostics: ${s.diagnostics.map(d=>d.message).join("; ")}`),a.join(`
2
+ `)}function _e(e){const{snapshot:t,activeLayer:r,file:s}=e,i=[r??"diff",z(s)];return t.scope?.kind==="session"&&i.push(`session ${t.scope.sessionId??t.scope.refId??"scope"}`),`[Diff context: ${i.join(" · ")}]`}function He(e,t,r){return!e||!t?null:e.files.find((s,i)=>r(s,i)===t)??null}function Oe(e,t=120){const r=e.replace(/\s+/g," ").trim();return r.length>t?`${r.slice(0,t-3)}...`:r}function Be(e,t=7){const r=e.trimEnd().split(`
3
+ `),s=r.slice(0,t),i=r.length-s.length;return i>0?`${s.join(`
4
+ `)}
5
+ ... ${i} more line${i===1?"":"s"}`:s.join(`
6
+ `)}function Ue(e){return e.newLine!=null?`L${e.newLine}`:e.oldLine!=null?`old L${e.oldLine}`:"line"}function Xe(e){return e.side==="add"?"+":e.side==="del"?"-":" "}function qe(e){const{snapshot:t,activeLayer:r,file:s}=e,i=T(s),c=s.binary?"binary":`+${s.additions??0} -${s.deletions??0}`;return{id:`file:${r??"diff"}:${i}`,kind:"file",label:i,detail:`${r??"diff"} · ${s.status} · ${c}`,preview:null,snippet:_e({snapshot:t,activeLayer:r,file:s})}}function Ye(e){const{line:t}=e,r=Xe(t);return{id:`line:${t.layer}:${t.filePath}:${t.side}:${t.oldLine??""}:${t.newLine??""}`,kind:"line",label:`${t.filePath}:${Ue(t)}`,detail:`${t.layer} · ${r}`,preview:`${r} ${Oe(t.text,180)}`,snippet:se({line:t})}}function Ve(e){const{selection:t}=e,r=t.filePath??"diff selection",s=t.text.trim().split(`
7
+ `).filter(Boolean).length;return{id:`selection:${t.layer??"diff"}:${r}:${t.text}`,kind:"selection",label:r,detail:`${t.layer??"diff"} · ${s} line${s===1?"":"s"}`,preview:Be(t.text),snippet:re({selection:t})}}function Ge({snapshot:e,activeLayer:t,selectedFile:r,setSelectedFileKey:s,resetKey:i}){const[c,f]=l.useState(""),[o,p]=l.useState([]),[a,d]=l.useState("scout"),[g,k]=l.useState(!1),[S,u]=l.useState(!1),[y,b]=l.useState(null),[w,m]=l.useState(null),C=l.useRef(null),N=l.useMemo(()=>e?Q(e):[],[e]),I=l.useMemo(()=>e?Ae(e):null,[e]);l.useEffect(()=>{f(""),p([]),k(!1),b(null),m(null)},[i]),l.useEffect(()=>{d(j=>g&&j==="scout"||N.some(x=>x.id===j)?j:I?.id??"scout")},[g,N,I?.id]);const R=l.useCallback(j=>{f(j),b(null),m(null)},[]),h=l.useCallback(j=>{k(!0),d(j)},[]),$=l.useCallback(j=>{p(x=>x.some(P=>P.id===j.id)?x:[...x,j]),b(null),m(null),queueMicrotask(()=>C.current?.focus())},[]),D=l.useCallback(j=>{p(x=>x.filter(P=>P.id!==j)),b(null),m(null)},[]),F=l.useCallback(async()=>{const j=c.trim();if(!j&&o.length===0||S||!e)return;const x=N.find(M=>M.id===a)??null,P=ze({comment:j||"Please review the included diff context.",includedContext:o.map(M=>M.snippet),snapshot:e,activeLayer:t,selectedFile:r});u(!0),b(null),m(null);try{x?(await B("/api/ask",{method:"POST",body:JSON.stringify({body:P,targetAgentId:x.id,targetLabel:x.label,metadata:{source:"repo-diff",originSurface:"repo-diff",handoffKind:"repo-diff-comment",targetAgentId:x.id,worktreePath:e.worktreePath,activeLayer:t,selectedFile:r?T(r):null,scopeKind:e.scope?.kind??"worktree"}})}),b(`Sent to ${x.label}`)):(await B("/api/send",{method:"POST",body:JSON.stringify({body:P})}),b("Sent to Scout")),f(""),p([])}catch(M){m(M instanceof Error?M.message:String(M))}finally{u(!1)}},[t,o,c,S,a,N,r,e]),v=l.useCallback((j,x)=>{e&&(s(x),$(qe({snapshot:e,activeLayer:t,file:j})))},[t,$,s,e]),L=l.useCallback(j=>{e&&$(Ye({line:j}))},[$,e]),E=l.useCallback(j=>{e&&$(Ve({selection:j}))},[$,e]);return{targets:N,targetId:a,setTargetId:h,draft:c,setDraft:R,contextItems:o,removeContextItem:D,pending:S,status:y,error:w,textareaRef:C,submit:F,includeFileInComment:v,includeLineInComment:L,includeSelectionInComment:E}}function Je({path:e,activeLayer:t,selectedFile:r,snapshotKey:s}){const i=r?T(r):null,c=`${e}\0${t??""}\0${i??""}\0${s}`,[f,o]=l.useState({layer:null,phase:"idle",error:null}),p=l.useRef(c),a=l.useMemo(()=>!t||!i?null:Y(e,[t],{files:[i],tier:"patch",cacheScope:s}),[t,i,e,s]);return l.useEffect(()=>{if(p.current=c,!t||!i){o({layer:null,phase:"idle",error:null});return}if(a?.fresh){o({layer:a.snapshot.layers[0]??null,phase:"ready",error:null});return}o({layer:null,phase:"loading",error:null}),V(e,[t],{files:[i],tier:"patch",cacheScope:s}).then(d=>{p.current===c&&o({layer:d.snapshot.layers[0]??null,phase:"ready",error:null})},d=>{p.current===c&&o(g=>({layer:g.layer,phase:"error",error:d instanceof Error?d.message:String(d)}))})},[t,a,i,e,c]),f}function Qe(e){const[t,r]=l.useState(null),[s,i]=l.useState(null),[c,f]=l.useState("split");l.useEffect(()=>{e&&f(e.render.preferredLayout==="stacked"?"unified":"split")},[e]),l.useEffect(()=>{if(!e)return;const d=e.layers.filter(g=>g.files.length>0)[0]??e.layers[0]??null;r(g=>g&&e.layers.some(k=>k.kind===g)?g:d?d.kind:null)},[e]);const o=l.useMemo(()=>!e||!t?null:e.layers.find(a=>a.kind===t)??null,[e,t]),p=l.useMemo(()=>He(o,s,K),[o,s]);return l.useEffect(()=>{if(!o){i(null);return}i(a=>{const d=o.files.map((g,k)=>K(g,k));return a&&d.includes(a)?a:d[0]??null})},[o]),{activeLayer:t,setActiveLayer:r,layer:o,selectedFileKey:s,setSelectedFileKey:i,selectedFile:p,layout:c,setLayout:f}}function Ze({path:e,layers:t,files:r,session:s,tier:i="summary",forceInitialLoad:c}){const f=t.join(","),o=l.useMemo(()=>f.split(","),[f]),p=(r??[]).join("\0"),a=s?`${s.sessionId??""}\0${s.agentId??""}\0${s.include??"changed"}`:"",d=l.useMemo(()=>({files:p?p.split("\0").filter(Boolean):void 0,tier:i,session:a?{sessionId:s?.sessionId??null,agentId:s?.agentId??null,include:s?.include??"changed"}:null}),[p,s?.agentId,s?.include,s?.sessionId,a,i]),[g,k]=l.useState(null),[S,u]=l.useState("loading"),[y,b]=l.useState(null),[w,m]=l.useState(null),C=l.useRef(null),N=l.useRef(!1);l.useEffect(()=>{C.current=g},[g]);const I=l.useCallback(async(h={})=>{const $=Y(e,o,d),D=h.force===!0||c&&!N.current,F=h.preserveCurrent===!0&&C.current!=null;b(null),$&&!D?(k($.snapshot),m(_($,!0)),u("ready")):F?(m(v=>({fetchedAt:v?.fetchedAt??Date.now(),cacheHit:v?.cacheHit??!1,refreshing:!0,refreshError:null})),u("ready")):(u("loading"),m(null));try{const v=await V(e,o,{force:D||$!=null,...d});D&&(N.current=!0),k(v.snapshot),m(ie(v,!1)),u("ready")}catch(v){const L=v instanceof Error?v.message:String(v);$?(m(_($,!1,L)),u("ready")):F?(m(E=>E&&{...E,refreshing:!1,refreshError:L}),u("ready")):(b(L),u("error"))}},[c,e,o,d]);l.useEffect(()=>{I()},[I]);const R=l.useCallback(()=>{I({force:!0,preserveCurrent:!0})},[I]);return{snapshot:g,fetchPhase:S,fetchError:y,freshness:w,filesKey:p,sessionKey:a,requestedLayers:o,loadSnapshot:I,refreshSnapshot:R}}function jt({path:e,layers:t=oe,files:r,session:s,forceInitialLoad:i=!1,onClose:c,onOpenAsPage:f,className:o,title:p}){const{snapshot:a,fetchPhase:d,fetchError:g,freshness:k,filesKey:S,sessionKey:u,loadSnapshot:y,refreshSnapshot:b}=Ze({path:e,layers:t,files:r,session:s,tier:"summary",forceInitialLoad:i}),{pierre:w,pierrePhase:m,pierreError:C,pierreTheme:N,retryPierre:I}=ae(a),{activeLayer:R,setActiveLayer:h,layer:$,selectedFileKey:D,setSelectedFileKey:F,selectedFile:v,layout:L,setLayout:E}=Qe(a),j=Je({path:e,activeLayer:R,selectedFile:v,snapshotKey:a?.render.renderKey??""}),x=Ge({snapshot:a,activeLayer:R,selectedFile:v,setSelectedFileKey:F,resetKey:`${e}\0${S}\0${u}`});if(d==="loading"&&!a)return n.jsx(A,{className:o,children:n.jsxs(H,{children:[n.jsx("div",{className:"rd-spinner","aria-hidden":!0}),n.jsxs("div",{className:"rd-center-title",children:["Reading ",s?"session":"worktree"," diff…"]}),n.jsx("div",{className:"rd-center-body",children:e})]})});if(d==="error"&&!a)return n.jsx(A,{className:o,children:n.jsxs(H,{children:[n.jsx("div",{className:"rd-center-title",children:"Couldn’t load the diff"}),n.jsx("div",{className:"rd-center-body",children:g??"The broker did not return a diff snapshot."}),n.jsx("div",{className:"rd-center-action",children:n.jsx("button",{type:"button",className:"rd-btn",onClick:()=>{y()},children:"Retry"})})]})});if(!a)return n.jsx(A,{className:o});const P=p??Z(a.worktreePath);return n.jsxs(A,{className:o,children:[n.jsx(Ce,{heading:P,worktreePath:a.worktreePath,snapshot:a,freshness:k,activeLayer:R,onLayer:h,layout:L,onLayout:E,refreshing:k?.refreshing===!0,onRefresh:b,onFocusComment:()=>{x.textareaRef.current?.scrollIntoView({block:"nearest"}),x.textareaRef.current?.focus()},onClose:c,onOpenAsPage:f}),n.jsx($e,{snapshot:a}),n.jsxs("div",{className:"rd-body",children:[n.jsx(Pe,{layer:$,selectedFileKey:D,onSelect:F,onIncludeFile:x.includeFileInComment}),n.jsx(je,{snapshot:a,selectedFile:v,targets:x.targets,targetId:x.targetId,onTargetId:x.setTargetId,draft:x.draft,onDraft:x.setDraft,contextItems:x.contextItems,onRemoveContextItem:x.removeContextItem,pending:x.pending,status:x.status,error:x.error,textareaRef:x.textareaRef,onSubmit:x.submit}),n.jsx(le,{layer:$,patchLayer:j.layer,patchPhase:j.phase,patchError:j.error,selectedFileKey:D,renderKey:a.render.renderKey,theme:N,layout:L,pierre:w,pierrePhase:m,pierreError:C,onRetryPierre:I,onIncludeLineContext:x.includeLineInComment,onIncludeSelectionContext:x.includeSelectionInComment})]})]})}export{jt as RepoDiffViewer,jt as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RepoDiffViewer-DbedmHDX.js","assets/index-CZ-05hKz.js","assets/index-i7TMxlwW.css","assets/ui-LM8pS8qE.js","assets/usePierreRuntime-DUuXH5yp.js","assets/chunk-HRAB3GC3-swV8PA2k.js","assets/chevron-down-Mp9mu_yd.js","assets/createLucideIcon-DXpqZP7I.js","assets/check-C18YQC90.js","assets/loader-circle-BiohlpM3.js","assets/send-horizontal-CgLppsIC.js","assets/file-code-corner-7mo7EviR.js","assets/code-xml-Jtxsp5d1.js","assets/x-e3h2hDsp.js","assets/cache-CeWH_KzJ.js","assets/api-Co9aQ2Jw.js","assets/perf-PX8Rx0EP.js","assets/message-square-D9YYWE0x.js","assets/refresh-cw-BRn9Oxxl.js","assets/plus-CuU_X0-8.js","assets/repo-diff-DyYmQMSA.css"])))=>i.map(i=>d[i]);
2
+ import{j as e,r as i,_ as s}from"./index-CZ-05hKz.js";/* empty css */const a=i.lazy(()=>s(()=>import("./RepoDiffViewer-DbedmHDX.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])).then(r=>({default:r.RepoDiffViewer})));function t(){return e.jsx("div",{className:"rd-viewer","data-scout-theme":!0,children:e.jsx("div",{className:"rd-center",children:e.jsxs("div",{className:"rd-center-card",children:[e.jsx("div",{className:"rd-spinner","aria-hidden":!0}),e.jsx("div",{className:"rd-center-title",children:"Opening diff viewer…"})]})})})}function c(r){return e.jsx(i.Suspense,{fallback:e.jsx(t,{}),children:e.jsx(a,{...r})})}export{c as R};
@@ -0,0 +1,6 @@
1
+ import{r as d,j as e}from"./index-CZ-05hKz.js";import{E as te}from"./EmptyState-CeBl0iGd.js";import{u as qe,a as _e}from"./Provider-B2xuo3rf.js";import{g as Be,f as pe,b as He}from"./api-HFH8wFyb.js";import{a as Ue}from"./api-Co9aQ2Jw.js";import{c as ne}from"./clipboard-e3fSpeo7.js";import{u as Ke}from"./keyboard-nav-DFhAJkW3.js";/* empty css */import{f as v,c as Ve,b as Ee,r as Pe,u as Ae,i as le,w as Ie,k as Me,l as ze,m as G,a as X,s as Ge,h as Xe}from"./ui-LM8pS8qE.js";import{B as Te,p as Ye,c as Je}from"./selection-bridge-i2S9zpf8.js";import{S as Qe}from"./SlidePanel-C-q7XwTa.js";import{R as Ze}from"./RepoDiffViewerLazy-C0--fPtk.js";import{p as es}from"./cache-CeWH_KzJ.js";import{R as ss}from"./refresh-cw-BRn9Oxxl.js";import{S as ts}from"./sliders-horizontal-BPSMHhbm.js";import"./router-DJj2WbDg.js";import"./perf-PX8Rx0EP.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-BQ6t92tJ.js";import"./sse-CiOSzE5n.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BJIamJOH.js";import"./DocumentFocusViewer-DZVhS7as.js";import"./createLucideIcon-DXpqZP7I.js";import"./TextDocumentSurface-CKQP-cBT.js";import"./file-text-KijGBnME.js";import"./x-e3h2hDsp.js";import"./chevron-right-CzH-TaSF.js";import"./code-xml-Jtxsp5d1.js";import"./arrow-left-CghA0kTw.js";import"./arrow-right-iJFv3jNh.js";import"./scout-voice-BhPzrc6P.js";import"./fx-z37u1o2z.js";import"./NewChatComposer-hlWT-nbR.js";import"./text-CnZ0e1-V.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-BiohlpM3.js";import"./conversation-model-CwF6Y9gx.js";import"./time-Dhsh_2EG.js";import"./index-BVlMw8x_.js";import"./HarnessMark-D5CA5uSp.js";import"./NewChatOrigin-DdpzE4kz.js";import"./chevron-down-Mp9mu_yd.js";import"./search-D1tJSAWe.js";import"./chunk-HRAB3GC3-swV8PA2k.js";/* empty css */const me=[{value:"claude",label:"Claude"},{value:"codex",label:"Codex"},{value:"pi",label:"Grok"}],ns=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"XHigh"}],rs=[{value:"new",label:"New session",hint:"Start a fresh harness session for this agent"},{value:"existing",label:"Continue session",hint:"Resume this agent’s current harness session"}];function fe(s){return`gh pr checkout ${s.number}`}function as(s){return[`Please review pull request #${s.number}: ${s.title}`,"",`URL: ${s.url}`,`Repo: ${s.repo}`,`Branch: ${s.headRefName||"head"} → ${s.baseRefName||"base"}`,s.path?`Local path: ${s.path}`:null,s.author?`Author: @${s.author}`:null,s.isDraft?"Status: draft":"Status: open","","Read the diff, summarize the change, call out risks or test gaps, and recommend ship / revise / hold."].filter(t=>t!=null).join(`
2
+ `)}function Q(s){return s.handle?.trim()||s.name?.trim()||s.id}function ge(s,t){const r=s?.trim(),n=t?.trim();return!r||!n?!1:r===n||r.startsWith(`${n}/`)||n.startsWith(`${r}/`)}function is(s){switch(s?.trim().toLowerCase()){case"available":case"idle":case"callable":return 40;case"active":case"working":case"running":case"in_turn":case"in_flight":return 20;case"queued":case"waiting":case"waking":return 10;case"offline":case"retired":case"stale":case"blocked":return-50;default:return 0}}function ls(s,t,r){const n=r?.trim()||s.path?.trim()||null,a=s.repo.split("/").pop()?.toLowerCase()??"",l=s.headRefName?.trim()??"";return t.filter(o=>!o.retiredFromFleet).map(o=>{let c=is(o.state);return(ge(o.projectRoot,n)||ge(o.cwd,n))&&(c+=1e3),a&&o.project?.trim().toLowerCase()===a&&(c+=400),l&&o.branch?.trim()===l&&(c+=200),{agent:o,score:c}}).sort((o,c)=>c.score!==o.score?c.score-o.score:Q(o.agent).localeCompare(Q(c.agent))).map(o=>o.agent)}function je(s,t){const r=new Map,n=s.path?.trim();if(n){const a=n.split("/").filter(Boolean).at(-1)??n;r.set(n,s.repo||a)}for(const a of t){const l=a.root?.trim();l&&(r.has(l)||r.set(l,a.name?.trim()||l.split("/").filter(Boolean).at(-1)||l))}return[...r.entries()].map(([a,l])=>({path:a,label:l}))}function re(s,t){return s?.harness?.trim()||t?.trim()||"claude"}function os(s){return s?.model?.trim()||""}function cs(s,t){const r=new Set,n=t?.model?.trim();n&&r.add(n);for(const a of s){const l=a.model?.trim();l&&r.add(l)}return[...r]}function ds(s){const t=s.harness?.trim()||void 0,r=s.model?.trim()||void 0,n=s.reasoningEffort?.trim()||void 0;return{...t?{harness:t}:{},...r?{model:r}:{},...n?{reasoningEffort:n}:{}}}async function us(s,t){const r=as(s),n=t.projectPath.trim();if(!n)throw new Error("Pick a project path for the review.");const a=ds(t),l=t.agent??null,o=l&&t.sessionMode==="existing"?"existing":"new";if(l&&o==="existing"&&!l.harnessSessionId?.trim())throw new Error(`@${Q(l)} has no live harness session to continue. Pick “New session” instead.`);const c=await Ue("/api/sessions",{method:"POST",body:JSON.stringify({target:l?{agentId:l.id,projectPath:n}:{projectPath:n},execution:{session:o,...o==="existing"&&l?.harnessSessionId?.trim()?{targetSessionId:l.harnessSessionId.trim()}:{},...a},agent:{persistence:l?"sticky":"one_time",...l?.handle?.trim()?{handle:l.handle.trim()}:{}},seed:{instructions:r}})}),h=c.flightId??c.flight?.id??null,p=c.targetAgentId??c.flight?.targetAgentId??c.agentId??l?.id??null,u=c.targetLabel?.trim()||(l?Q(l):null)||p||"one-time reviewer",m=l?o==="existing"?"continue":"new session":"one-time";return{message:[`Assigned #${s.number} for review → ${u.startsWith("@")?u:`@${u}`}`,`· ${m}`,a.harness?`· ${a.harness}`:null,a.model?`· ${a.model}`:null,a.reasoningEffort?`· ${a.reasoningEffort}`:null,h?`· ${h}`:null].filter(Boolean).join(" "),flightId:h,conversationId:c.conversationId??null,targetAgentId:p,targetLabel:u}}function hs(s){window.open(s.url,"_blank","noopener,noreferrer")}function ps(s,t={}){const{matchingWorktree:r,onBeginAssign:n,onSelectWorktreeId:a,onOpenDiff:l,onStatus:o}=t,c=[];return n&&c.push({kind:"action",label:"Assign for review…",onSelect:()=>n(s)}),c.push({kind:"action",label:"Open on GitHub",onSelect:()=>hs(s)}),r&&a&&c.push({kind:"action",label:`Select worktree · ${r.branch}`,onSelect:()=>a(r.id)}),r&&l&&c.push({kind:"action",label:"Open local diff",onSelect:()=>l(r.path)}),c.push({kind:"separator"},{kind:"action",label:"Copy link",onSelect:()=>{ne(s.url).then(h=>{o?.(h?`Copied link for #${s.number}`:`Could not copy link for #${s.number}`)})}},{kind:"action",label:"Copy checkout command",onSelect:()=>{ne(fe(s)).then(h=>{o?.(h?`Copied: ${fe(s)}`:`Could not copy checkout command for #${s.number}`)})}},{kind:"action",label:"Copy title",onSelect:()=>{ne(`#${s.number} ${s.title}`).then(h=>{o?.(h?`Copied title for #${s.number}`:`Could not copy title for #${s.number}`)})}}),c}function ms(s){return s.startsWith("/Users/")?`~/${s.split("/").slice(3).join("/")}`:s}function fs(s){const t=s.handle?.trim()||s.name?.trim()||s.id,r=[s.harness?.trim(),s.model?.trim(),s.state?.trim(),s.harnessSessionId?.trim()?"session":null].filter(Boolean);return r.length>0?`@${t} · ${r.join(" · ")}`:`@${t}`}function Y(s){const t=s?.trim();return t?t.length>18?`${t.slice(0,10)}…${t.slice(-4)}`:t:null}function gs({pr:s,agents:t,projects:r,pending:n,error:a,onClose:l,onPendingChange:o,onError:c,onAssigned:h}){const p=Ke(),u=d.useMemo(()=>je(s,r),[s,r]),[m,N]=d.useState(()=>u[0]?.path??s.path?.trim()??""),[b,T]=d.useState(""),C=d.useMemo(()=>ls(s,t,m),[t,s,m]),g=C.find(i=>i.id===b)??null,j=!!g?.harnessSessionId?.trim(),[$,P]=d.useState(()=>re(null)),[M,A]=d.useState(""),[x,k]=d.useState("medium"),[R,y]=d.useState("new");d.useEffect(()=>{const w=je(s,r)[0]?.path??s.path?.trim()??"";N(w),T(""),P(re(null)),A(""),k("medium"),y("new"),c(null)},[s.id]),d.useEffect(()=>{m&&u.some(i=>i.path===m)||N(u[0]?.path??s.path?.trim()??"")},[s.path,u,m]),d.useEffect(()=>{if(!g){y("new");return}P(re(g)),A(os(g)),y(g.harnessSessionId?.trim()?"existing":"new")},[g?.id]),d.useEffect(()=>{b&&(C.some(i=>i.id===b)||T(""))},[b,C]),d.useEffect(()=>{R==="existing"&&g&&!j&&y("new")},[j,g,R]);const L=d.useMemo(()=>cs(C,g),[C,g]),I=!!m.trim()&&!n&&!(g&&R==="existing"&&!j),W=async()=>{if(I){o(!0),c(null);try{const i=await us(s,{projectPath:m.trim(),harness:$,model:M,reasoningEffort:x,agent:g,sessionMode:g?R:"new"});h(i)}catch(i){c(i instanceof Error?i.message:String(i))}finally{o(!1)}}},F=n?"Assigning…":g?R==="existing"?"Continue session · review":"New session · review":"Start review",D=g?R==="existing"?`Continues @${g.handle?.trim()||g.name}'s current session${Y(g.harnessSessionId)?` (${Y(g.harnessSessionId)})`:""}.`:`Starts a fresh harness session for @${g.handle?.trim()||g.name}.`:"Starts a disposable one-time reviewer on the project with the runtime above.";return e.jsx("div",{className:"rw-pr-assign-backdrop",role:"presentation",onMouseDown:i=>{i.target===i.currentTarget&&!n&&l()},children:e.jsxs("div",{ref:p.ref,className:"rw-pr-assign-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"rw-pr-assign-title",tabIndex:-1,onKeyDown:i=>{p.onKeyDown(i),i.key==="Escape"&&!n&&(i.stopPropagation(),l())},children:[e.jsxs("div",{className:"rw-pr-assign-head",children:[e.jsxs("div",{children:[e.jsx("div",{className:"rw-pr-assign-eyebrow",children:"Assign for review"}),e.jsxs("h2",{id:"rw-pr-assign-title",className:"rw-pr-assign-title",children:["#",s.number," · launch review"]}),e.jsx("p",{className:"rw-pr-assign-copy",title:s.title,children:s.title}),e.jsxs("p",{className:"rw-pr-assign-meta",children:[s.repo," · ",s.headRefName||"head"," → ",s.baseRefName||"base"]})]}),e.jsx("button",{type:"button",className:"rw-pr-assign-close",onClick:l,disabled:n,children:"Cancel"})]}),e.jsxs("div",{className:"rw-pr-assign-body",children:[e.jsxs("div",{className:"rw-pr-assign-fields",children:[e.jsxs("label",{className:"rw-pr-assign-field",children:[e.jsx("span",{children:"Project"}),e.jsx("select",{value:m,disabled:n||u.length===0,onChange:i=>N(i.target.value),"aria-label":"Project path",children:u.length===0?e.jsx("option",{value:"",children:"No local project"}):u.map(i=>e.jsxs("option",{value:i.path,children:[i.label," · ",ms(i.path)]},i.path))})]}),e.jsxs("label",{className:"rw-pr-assign-field",children:[e.jsx("span",{children:"Harness"}),e.jsxs("select",{value:$,disabled:n,onChange:i=>P(i.target.value),"aria-label":"Harness",children:[me.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value)),$&&!me.some(i=>i.value===$)?e.jsx("option",{value:$,children:$}):null]})]}),e.jsxs("label",{className:"rw-pr-assign-field",children:[e.jsx("span",{children:"Model"}),e.jsx("input",{list:"rw-pr-assign-models",value:M,disabled:n,placeholder:"Default for harness",onChange:i=>A(i.target.value),"aria-label":"Model"}),e.jsx("datalist",{id:"rw-pr-assign-models",children:L.map(i=>e.jsx("option",{value:i},i))})]}),e.jsxs("label",{className:"rw-pr-assign-field",children:[e.jsx("span",{children:"Effort"}),e.jsx("select",{value:x,disabled:n,onChange:i=>k(i.target.value),"aria-label":"Reasoning effort",children:ns.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))})]}),e.jsxs("label",{className:"rw-pr-assign-field rw-pr-assign-field--wide",children:[e.jsxs("span",{children:["Agent ",e.jsx("em",{children:"(optional)"})]}),e.jsxs("select",{value:b,disabled:n,onChange:i=>T(i.target.value),"aria-label":"Existing agent (optional)",children:[e.jsx("option",{value:"",children:"New one-time reviewer on project"}),C.map(i=>e.jsx("option",{value:i.id,children:fs(i)},i.id))]})]}),g?e.jsxs("fieldset",{className:"rw-pr-assign-session",disabled:n,children:[e.jsx("legend",{children:"Session"}),e.jsx("div",{className:"rw-pr-assign-session-choices",role:"radiogroup","aria-label":"Session mode",children:rs.map(i=>{const w=i.value==="existing"&&!j,O=R===i.value;return e.jsxs("button",{type:"button",role:"radio","aria-checked":O,className:"rw-pr-assign-session-choice","data-active":O||void 0,disabled:w,title:w?"This agent has no live harness session to continue":i.hint,onClick:()=>y(i.value),children:[e.jsx("span",{className:"rw-pr-assign-session-title",children:i.label}),e.jsx("span",{className:"rw-pr-assign-session-sub",children:w?"No live session on this agent":i.value==="existing"&&Y(g.harnessSessionId)?Y(g.harnessSessionId):i.hint})]},i.value)})})]}):null]}),e.jsx("p",{className:"rw-pr-assign-hint",children:D}),a?e.jsx("div",{className:"rw-pr-assign-error",role:"alert",children:a}):null,e.jsx("div",{className:"rw-pr-assign-actions",children:e.jsx("button",{type:"button",className:"rw-pr-assign-submit",disabled:!I,onClick:()=>{W()},children:F})})]})]})})}const js=/^Skipped missing repo-watch path:\s*(.+)$/i,xs=4;function bs(s){const t=s.trim().replace(/\/+$/,"")||s.trim();if(!t)return"unknown paths";if(t==="~"||t.startsWith("~/"))return"~/*";if(!t.startsWith("/")){const[n]=t.split(/[\\/]/).filter(Boolean);return n?`${n}/*`:t}const r=t.split("/").filter(Boolean);return r[0]==="Users"&&r[1]?`/Users/${r[1]}/*`:r[0]==="Volumes"&&r[1]?`/Volumes/${r[1]}/*`:r.length>=2?`/${r[0]}/${r[1]}/*`:`/${r[0]??""}`}function ws(s,t){const r=[...new Set(s)];if(r.length===1)return{message:`Skipped missing repo-watch path: ${r[0]}`,examples:[],rawCount:1};const n=r.slice(0,xs),a=r.length-n.length;return a>0&&n.push(`+${a} more`),{message:`Skipped ${r.length} missing repo-watch paths under ${t}. These look like stale broker hints.`,examples:n,rawCount:r.length}}function xe(s,t){if(s.length===0)return;const r=new Map;for(const n of s){const a=bs(n),l=r.get(a);l?l.push(n):r.set(a,[n])}for(const[n,a]of r)t.push(ws(a,n));s.length=0}function vs(s){const t=[],r=[];for(const n of s){const a=js.exec(n);if(a){r.push(a[1].trim());continue}xe(r,t),t.push({message:n,examples:[],rawCount:1})}return xe(r,t),t}const be={attention:"desc",name:"asc",churn:"desc",files:"desc",drift:"desc",attached:"desc"},we="attention";function Ns(s){return!s.status.clean||s.branch.ahead>0||s.branch.behind>0||s.agents.some(le)||s.sessions.length>0||s.error!=null}function Ss(s,t){const r=Ve(s),n=Ee(s),{add:a,del:l,total:o}=Pe(s),c=Ae(s);return{wt:s,project:t,state:Ie(s),add:a,del:l,churn:o,files:n.files+Math.max(r.files,s.status.changedFiles),live:c.filter(le).length,agentsUnique:c}}function De(s){return s.status.conflicts>0||s.error!=null}function ks(s){const t=s.flatMap(l=>l.worktrees.filter(De).map(o=>{const c=o.branch.name??o.name;return o.status.conflicts>0?`${l.name}/${c}: ${v(o.status.conflicts)} conflict${o.status.conflicts===1?"":"s"}`:`${l.name}/${c}: scan error`})),r="Worktrees blocked by conflicts or scan errors.";if(t.length===0)return r;const n=t.slice(0,8),a=t.length-n.length;return[r,...n,a>0?`+${a} more`:null].filter(l=>!!l).join(`
3
+ `)}function ys({snapshot:s,selectedId:t,onSelect:r,onViewDiff:n,scanDepth:a,scanMorePending:l,onScanMore:o,openPullRequestCount:c,openPullRequestTitle:h}){const[p,u]=d.useState(we),[m,N]=d.useState(be[we]),[b,T]=d.useState(!1),{liveRows:C,cleanRows:g,stats:j,blockedTitle:$}=d.useMemo(()=>{const x=[],k=[];let R=0,y=0,L=0;for(const F of s.projects)for(const D of F.worktrees){const i=Ss(D,F);L+=i.files,i.live>0&&R++,De(D)&&y++,(Ns(D)?x:k).push(i)}const I=s.totals,W={repos:I.projects,worktrees:I.worktrees,dirtyWorktrees:I.dirtyWorktrees,changedFiles:L,live:R,blocked:y};return{liveRows:x,cleanRows:k,stats:W,blockedTitle:ks(s.projects)}},[s.projects,s.totals]),P=d.useMemo(()=>{const x=Ds(C,p,m),k=new Map;for(const R of x){const y=k.get(R.project.id);y?y.push(R):k.set(R.project.id,[R])}return[...k.values()]},[C,p,m]);function M(x){x===p?N(k=>k==="asc"?"desc":"asc"):(u(x),N(be[x]))}const A=C.length===0&&g.length===0;return e.jsxs("section",{className:"rw-table",children:[e.jsxs("div",{className:"rw-head",children:[e.jsxs("div",{className:"rw-head-top",children:[e.jsx("span",{className:"rw-eyebrow",children:"STATE OF REPOS"}),g.length>0?e.jsxs("button",{type:"button",className:"rw-clean",style:{marginLeft:"auto"},onClick:()=>T(x=>!x),"aria-pressed":b,children:[b?"hide":"show"," clean & idle (",g.length,")"]}):null]}),e.jsxs("div",{className:"stats",children:[e.jsx(U,{v:j.repos,k:"REPOS"}),j.worktrees>j.repos?e.jsx(U,{v:j.worktrees,k:"WORKTREES",title:`${v(j.worktrees)} worktrees across ${v(j.repos)} repos.`}):null,e.jsx(U,{v:j.changedFiles,k:"CHANGED",title:`${v(j.changedFiles)} changed files across ${v(j.dirtyWorktrees)} dirty worktree${j.dirtyWorktrees===1?"":"s"}.`}),j.live>0?e.jsx(U,{v:j.live,k:"WORKING",tone:"mint"}):null,(c??0)>0?e.jsx(U,{v:c??0,k:"OPEN PRS",tone:"amber",title:h??void 0}):null,j.blocked>0?e.jsx(U,{v:j.blocked,k:"BLOCKED",tone:"coral",title:$}):null]})]}),e.jsxs("div",{className:"tbl-wrap",children:[e.jsxs("div",{className:"tbl-head",children:[e.jsx(V,{label:"REPO / BRANCH · WORKTREE",k:"name",sortKey:p,dir:m,onSort:M}),e.jsx(V,{label:"CHURN",k:"churn",sortKey:p,dir:m,onSort:M,align:"r"}),e.jsx(V,{label:"FILES",k:"files",sortKey:p,dir:m,onSort:M,align:"c"}),e.jsx(V,{label:"DRIFT",k:"drift",sortKey:p,dir:m,onSort:M,align:"c"}),e.jsx(V,{label:"ATTACHED",k:"attached",sortKey:p,dir:m,onSort:M})]}),A?e.jsx("div",{className:"rw-empty",children:"No repositories discovered yet."}):P.map(x=>x.length>1?e.jsx(Cs,{group:x,selectedId:t,onSelect:r,onViewDiff:n},x[0].project.id):e.jsx(ie,{row:x[0],top:!0,selected:t===x[0].wt.id,onSelect:()=>r(x[0].wt.id),onViewDiff:n},x[0].wt.id)),b&&g.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"tbl-head",style:{position:"static"},children:e.jsxs("span",{children:["CLEAN & IDLE · ",g.length]})}),g.map(x=>e.jsx(ie,{row:x,top:!0,clean:!0,selected:t===x.wt.id,onSelect:()=>r(x.wt.id),onViewDiff:n},x.wt.id))]}):null,e.jsx(Rs,{snapshot:s,scanDepth:a,scanMorePending:l,onScanMore:o})]})]})}function Rs({snapshot:s,scanDepth:t,scanMorePending:r,onScanMore:n}){const a=$s(s),l=vs(s.warnings),o=l.reduce((c,h)=>c+h.rawCount,0);return e.jsxs("div",{className:"scan-coverage",children:[e.jsxs("div",{className:"scan-coverage-row",children:[e.jsx("b",{children:"SCAN"}),e.jsx("span",{className:"scan-main",children:a.summary}),a.canScanMore&&t==="standard"?e.jsx("button",{type:"button",onClick:n,disabled:r,children:r?"Scanning":"Scan more"}):e.jsx("span",{className:"scan-chip",children:t==="expanded"?"expanded":"standard"})]}),l.length>0?e.jsxs("details",{className:"scan-details",children:[e.jsxs("summary",{children:[v(l.length)," diagnostic group",l.length===1?"":"s",o!==l.length?` (${v(o)} raw)`:""]}),e.jsx("ul",{children:l.map((c,h)=>e.jsxs("li",{children:[e.jsx("span",{children:c.message}),c.examples.length>0?e.jsx("span",{className:"scan-detail-examples",children:c.examples.join(" · ")}):null]},`${h}:${c.message}`))})]}):null]})}function $s(s){let t=null,r=0,n=0,a=0,l=0,o=0,c=0;for(const p of s.warnings){const u=/limited discovery to (\d+) repositories/i.exec(p);if(u){t=`discovery capped at ${u[1]}`;continue}if(/limited .* to \d+ worktrees/i.test(p)){r++;continue}if(/skipped unreadable worktree/i.test(p)){n++;continue}if(/skipped missing repo-watch path/i.test(p)){a++;continue}if(/scan budget|stopped discovery|stopped scanning/i.test(p)){l++;continue}if(/could not resolve git common directory/i.test(p)){o++;continue}c++}const h=[`${v(s.totals.projects)} repo${s.totals.projects===1?"":"s"}`,`${v(s.totals.worktrees)} worktree${s.totals.worktrees===1?"":"s"}`];return t&&h.push(t),r&&h.push(`${v(r)} repo${r===1?"":"s"} at worktree cap`),n&&h.push(`${v(n)} unreadable worktree${n===1?"":"s"} skipped`),a&&h.push(`${v(a)} missing path${a===1?"":"s"}`),o&&h.push(`${v(o)} unresolved git dir${o===1?"":"s"}`),l&&h.push("scan budget reached"),c&&h.push(`${v(c)} other diagnostic${c===1?"":"s"}`),{summary:h.join(" · "),canScanMore:t!==null||r>0||l>0}}function Cs({group:s,selectedId:t,onSelect:r,onViewDiff:n}){const a=s[0].project,l=s.some(p=>p.state==="error"),o=s.reduce((p,u)=>p+u.add,0),c=s.reduce((p,u)=>p+u.del,0),h=s.reduce((p,u)=>p+(u.live?1:0),0);return e.jsxs("div",{children:[e.jsxs("div",{className:"repo-grp"+(l?" attn":""),children:[e.jsxs("div",{className:"rg-name",children:[e.jsx("span",{className:"rg-tw","aria-hidden":!0,children:e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",style:{transform:"rotate(90deg)"},children:e.jsx("path",{d:"M3 2l4 3.5L3 9",stroke:"currentColor",strokeWidth:"1.3",fill:"none"})})}),e.jsx("span",{className:"dot "+Ts(s)}),e.jsx("span",{className:"rg-nm",children:a.name}),e.jsx("span",{className:"rg-path",children:Me(a.root,3)}),e.jsxs("span",{className:"rg-badge",children:[a.worktrees.length," worktrees"]})]}),e.jsx("div",{className:"rg-agg",children:o||c?e.jsxs("span",{children:[e.jsxs("span",{style:{color:"var(--mint-dim)"},children:["+",v(o)]})," ",e.jsxs("span",{style:{color:"var(--coral-dim)"},children:["−",v(c)]})]}):"—"}),e.jsx("div",{}),e.jsx("div",{}),e.jsx("div",{className:"rg-agg",style:{textAlign:"left"},children:h?`${h} working`:""})]}),s.map((p,u)=>e.jsx(ie,{row:p,guide:!0,last:u===s.length-1,selected:t===p.wt.id,onSelect:()=>r(p.wt.id),onViewDiff:n},p.wt.id))]})}function ie({row:s,top:t,guide:r,last:n,clean:a,selected:l,onSelect:o,onViewDiff:c}){const{wt:h,project:p}=s,u=h.branch,m=Ee(h),N=!!c&&(s.files>0||m.has||h.branch.ahead>0);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:["wt",l?"sel":"",s.state==="error"?"attn":""].join(" "),style:t&&!a?{borderTop:"1px solid var(--line)"}:void 0,onClick:o,role:"button",tabIndex:0,onKeyDown:o?b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),o())}:void 0,children:[e.jsxs("div",{className:"wt-name",children:[r?e.jsx("span",{className:"tw-guide"+(n?" last":"")}):null,e.jsxs("div",{className:"inner",children:[e.jsx("span",{className:"dot "+s.state}),e.jsxs("span",{className:"br",children:[t&&!r?e.jsxs("span",{className:"lead",children:[p.name,"  "]}):null,e.jsx(Te,{branch:h.branch,fallback:h.name})]}),e.jsx(Ms,{wt:h})]})]}),e.jsx(Es,{add:s.add,del:s.del}),e.jsx("div",{className:"files",children:s.files>0?e.jsxs("span",{children:[s.files,h.status.conflicts>0?e.jsxs("span",{className:"conf",children:[" ⚠",h.status.conflicts]}):null]}):e.jsx("span",{className:"dash",children:"—"})}),e.jsx(Ps,{ahead:u.ahead,behind:u.behind}),e.jsxs("div",{className:"agents-cell",children:[e.jsx(Is,{row:s}),N?e.jsx("button",{type:"button",className:"wt-diff",title:`View diff · ${s.files} changed file${s.files===1?"":"s"}`,"aria-label":"View diff",onClick:b=>{b.stopPropagation(),c?.(h.path)},children:"diff"}):null]})]})})}function U({v:s,k:t,tone:r,title:n}){return e.jsxs("div",{className:"stat",title:n,"aria-label":n?`${v(s)} ${t}. ${n}`:void 0,children:[e.jsx("span",{className:"v"+(r?" "+r:""),children:v(s)}),e.jsx("span",{className:"k",children:t})]})}function V({label:s,k:t,sortKey:r,dir:n,onSort:a,align:l}){const o=r===t;return e.jsx("div",{className:l==="r"?"r":l==="c"?"c":"",children:e.jsxs("button",{type:"button",className:o?"on":"",onClick:()=>a(t),children:[e.jsx("span",{children:s}),e.jsx("span",{className:"caret","aria-hidden":!0,children:n==="asc"?"▲":"▼"})]})})}function Es({add:s,del:t}){if(!s&&!t)return e.jsx("div",{className:"churn",children:e.jsx("span",{className:"dash",children:"—"})});const r=s+t||1;return e.jsxs("div",{className:"churn",children:[e.jsxs("span",{className:"nums",children:[e.jsxs("span",{className:"add",children:["+",v(s)]}),e.jsx("span",{className:"sl",children:"/"}),e.jsxs("span",{className:"del",children:["−",v(t)]})]}),e.jsxs("span",{className:"cbar",title:`+${v(s)} −${v(t)}`,children:[e.jsx("span",{className:"g",style:{width:s/r*100+"%"}}),e.jsx("span",{className:"r",style:{width:t/r*100+"%"}})]})]})}function Ps({ahead:s,behind:t}){return!s&&!t?e.jsx("div",{className:"drift",children:e.jsx("span",{className:"dash",children:"—"})}):e.jsxs("div",{className:"drift",children:[s?e.jsxs("span",{className:"dp ahead",children:["↑",s]}):null,t?e.jsxs("span",{className:"dp behind",children:["↓",t]}):null]})}const As=2;function Is({row:s}){const t=s.agentsUnique,r=s.wt.sessions,n=[...t.map(o=>`${X(o)} (${o.state??"—"})`),...r.map(o=>`session ${Ge(o)}`)].join(`
4
+ `);if(t.length===0)return e.jsx("div",{className:"agents",title:n,children:r.length>0?e.jsxs("span",{className:"ahandle",children:[r.length," session",r.length===1?"":"s"]}):e.jsx("span",{className:"dash",children:"—"})});const a=t.slice(0,As),l=t.length-a.length;return e.jsxs("div",{className:"agents",title:n,children:[s.live>0?e.jsxs("span",{className:"alive",children:[e.jsx("span",{className:"d"}),s.live]}):null,e.jsx("span",{className:"ahandle",children:a.map(o=>X(o)).join(" ")}),l>0?e.jsxs("span",{className:"amore",children:["+",l]}):null]})}function Ms({wt:s}){const t=[];return s.branch.detached?t.push({label:"DETACHED",cls:""}):s.branch.upstream||t.push({label:"LOCAL",cls:""}),s.error!=null&&t.push({label:"SCAN ERR",cls:"err"}),s.isBare&&t.push({label:"BARE",cls:""}),e.jsx(e.Fragment,{children:t.map(r=>e.jsx("span",{className:"tag "+r.cls,children:r.label},r.label))})}const ve={error:3,live:2,dirty:1,clean:0};function Ts(s){return s.reduce((t,r)=>ve[r.state]>ve[t]?r.state:t,"clean")}function Ds(s,t,r){const n=r==="asc"?1:-1,a=u=>{switch(t){case"attention":return-G(u.wt.attention);case"churn":return u.churn;case"files":return u.files;case"drift":return u.wt.branch.ahead+u.wt.branch.behind;case"attached":return u.live*1e6+u.agentsUnique.length*1e3+u.wt.sessions.length;default:return 0}},l=new Map;for(const u of s){const m=l.get(u.project.id);m?m.push(u):l.set(u.project.id,[u])}const o=(u,m)=>{if(t==="name")return ze(u,m,n);const N=(a(u)-a(m))*n;if(N!==0)return N;const b=G(u.wt.attention)-G(m.wt.attention);return b!==0?b:u.wt.path.localeCompare(m.wt.path)},c=u=>u.reduce((m,N)=>Math.max(m,a(N)),-1/0),h=[...l.values()].sort((u,m)=>{if(t==="name")return u[0].project.name.localeCompare(m[0].project.name)*n;const N=(c(u)-c(m))*n;return N!==0?N:u[0].project.name.localeCompare(m[0].project.name)}),p=[];for(const u of h)p.push(...[...u].sort(o));return p}const J=8;function Ne(s){if(s.error!=null)return 0;const{ahead:t,behind:r}=s.branch;return t>0&&r>0?1:r>0||t>0?2:3}function Ls(s){const t=(s.name??"").trim();if(t){const a=t.split(/[\s_\-/]+/).filter(Boolean);if(a.length>=2)return(a[0][0]+a[1][0]).toUpperCase();if(a.length===1)return a[0].slice(0,2).toUpperCase()}return(X(s).replace(/^@/,"").replace(/[^a-z0-9]/gi,"").slice(0,2)||"··").toUpperCase()}function Os({snapshot:s,selectedId:t,onSelect:r}){return e.jsxs("section",{className:"bd",children:[e.jsx("div",{className:"bd-head",children:"BRANCH DRIFT — distance from each worktree's base · behind ← origin → ahead · flags call out what needs a rebase"}),e.jsxs("div",{className:"bd-axis",children:[e.jsx("div",{}),e.jsxs("div",{className:"bd-axis-track",children:[e.jsx("span",{className:"bd-axis-lbl",style:{left:"0%"},children:"−8"}),e.jsx("span",{className:"bd-axis-lbl",style:{left:"25%"},children:"−4"}),e.jsx("span",{className:"bd-axis-lbl bd-origin-lbl",style:{left:"50%"},children:"origin"}),e.jsx("span",{className:"bd-axis-lbl",style:{left:"75%"},children:"+4"}),e.jsx("span",{className:"bd-axis-lbl",style:{left:"100%"},children:"+8"}),e.jsx("span",{className:"bd-axis-cap",children:"COMMITS ←"})]}),e.jsx("div",{}),e.jsx("div",{}),e.jsx("div",{})]}),s.projects.map(n=>e.jsx(Ws,{project:n,selectedId:t,onSelect:r},n.id))]})}function Ws({project:s,selectedId:t,onSelect:r}){const n=[...s.worktrees].sort((a,l)=>Ne(a)-Ne(l));return e.jsxs("div",{className:"bd-grp",children:[e.jsxs("div",{className:"bd-grp-h",children:[e.jsx("span",{className:"bd-grp-nm",children:s.name}),e.jsx("span",{className:"bd-grp-path",children:Me(s.root,3)})]}),n.map(a=>e.jsx(Fs,{wt:a,selected:t===a.id,onSelect:()=>r(a.id)},a.id))]})}function Fs({wt:s,selected:t,onSelect:r}){const n=Ie(s),{ahead:a,behind:l}=s.branch,o=s.error!=null,c=Ae(s);return e.jsxs("div",{className:["bd-row",t?"sel":""].join(" "),role:"button",tabIndex:0,onClick:r,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),r())},children:[e.jsxs("div",{className:"bd-id",children:[e.jsx("span",{className:"dot "+n}),e.jsx("span",{className:"bd-br",children:e.jsx(Te,{branch:s.branch,fallback:s.name})})]}),e.jsx(qs,{ahead:a,behind:l,hasError:o}),e.jsx(_s,{wt:s,hasError:o}),e.jsx(Hs,{agents:c}),e.jsx(Us,{ahead:a,behind:l,hasError:o})]})}function qs({ahead:s,behind:t,hasError:r}){const n=s===0&&t===0;return e.jsxs("div",{className:"bd-track",children:[e.jsx("span",{className:"bd-tick",style:{left:"0%"}}),e.jsx("span",{className:"bd-tick",style:{left:"25%"}}),e.jsx("span",{className:"bd-tick bd-tick-origin",style:{left:"50%"}}),e.jsx("span",{className:"bd-tick",style:{left:"75%"}}),e.jsx("span",{className:"bd-tick",style:{left:"100%"}}),r||n?e.jsx("span",{className:"bd-origin-ring"}):e.jsxs(e.Fragment,{children:[t>0?e.jsxs("span",{className:"bd-bar bd-behind",style:{right:"50%",width:Math.min(t,J)/J*50+"%"},children:[e.jsx("span",{className:"bd-cap bd-cap-l"}),e.jsxs("span",{className:"bd-lbl bd-lbl-l",children:["↓",t]})]}):null,s>0?e.jsxs("span",{className:"bd-bar bd-ahead",style:{left:"50%",width:Math.min(s,J)/J*50+"%"},children:[e.jsx("span",{className:"bd-cap bd-cap-r"}),e.jsxs("span",{className:"bd-lbl bd-lbl-r",children:["↑",s]})]}):null]})]})}function _s({wt:s,hasError:t}){const{add:r,del:n,has:a}=Pe(s);if(t||!a)return e.jsx("div",{className:"bd-churn",children:e.jsx("span",{className:"dash",children:"—"})});const l=r+n||1;return e.jsxs("div",{className:"bd-churn",children:[e.jsxs("span",{className:"bd-churn-nums",children:[e.jsxs("span",{className:"add",children:["+",v(r)]}),e.jsx("span",{className:"sl",children:"/"}),e.jsxs("span",{className:"del",children:["−",v(n)]})]}),e.jsxs("span",{className:"bd-cbar",title:`+${v(r)} −${v(n)}`,children:[e.jsx("span",{className:"g",style:{width:r/l*100+"%"}}),e.jsx("span",{className:"r",style:{width:n/l*100+"%"}})]})]})}const Bs=2;function Hs({agents:s}){if(s.length===0)return e.jsx("div",{className:"bd-agents",children:e.jsx("span",{className:"dash",children:"—"})});const t=s.slice(0,Bs),r=s.length-t.length;return e.jsxs("div",{className:"bd-agents",title:s.map(n=>`${X(n)} (${n.state??"—"})`).join(`
5
+ `),children:[t.map(n=>e.jsx("span",{className:"bd-av"+(le(n)?" live":""),children:Ls(n)},X(n))),r>0?e.jsxs("span",{className:"bd-av-more",children:["+",r]}):null]})}function Us({ahead:s,behind:t,hasError:r}){return r?e.jsx("div",{className:"bd-flag err",children:"SCAN ERR"}):s>0&&t>0?e.jsx("div",{className:"bd-flag rebase",children:"DIVERGED ▸"}):t>0?e.jsx("div",{className:"bd-flag rebase",children:"REBASE ▸"}):s>0?e.jsxs("div",{className:"bd-flag ahead",children:["AHEAD ",s]}):e.jsx("div",{className:"bd-flag sync",children:"IN SYNC"})}const Ks=1e4,Vs=15e3,zs=45e3,Gs=45e3,Xs="openscout.repos.tone",Se=["warm","cool","mono"],Ys="openscout.repos.view",ke=["table","drift"],Js=12;function Qs(s){return s.warnings.some(t=>/scan budget|stopped discovery|stopped scanning/i.test(t))}function Zs(s,t){return s.totals.worktrees<t.totals.worktrees||s.totals.projects<t.totals.projects}function et(s){return s&&typeof s=="object"&&"name"in s&&s.name==="AbortError"?"Repo Watch scan timed out; keeping the last available snapshot.":s instanceof Error?s.message:String(s)}function ye(s,t,r){const[n,a]=d.useState(()=>{if(typeof window>"u")return r;try{const o=window.localStorage.getItem(s);return o&&t.includes(o)?o:r}catch{return r}}),l=d.useCallback(o=>{a(o);try{window.localStorage.setItem(s,o)}catch{}},[s]);return[n,l]}function Re(s){let t=null,r=-1/0;for(const n of s)for(const a of n.worktrees){const l=a.agents.filter(c=>(c.state??"").toLowerCase()==="active").length,o=(4-G(a.attention))*1e6+l*1e4+a.status.changedFiles;o>r&&(r=o,t=a)}return t}function st(s,t){if(!s||!t)return{worktree:null,project:null};for(const r of s.projects)for(const n of r.worktrees)if(n.id===t)return{worktree:n,project:r};return{worktree:null,project:null}}function ae(s){if(!s)return 0;const t=/(\d+)\s+files?\s+changed/.exec(s);return t?Number(t[1]):0}function tt(s){const t=new Set,r=[];for(const n of s.projects){const a=n.worktrees[0]?.path??n.root;!a||t.has(a)||(t.add(a),r.push(a))}return r}function nt(s,t){if(!s)return"updated";const r=Date.parse(s);return Number.isFinite(r)?Xe(r,t):"updated"}function rt(s){const t=s?.pullRequests??[];if(t.length===0)return null;const r=t.slice(0,8).map(a=>`${a.repo}#${a.number}: ${a.title}`),n=t.length-r.length;return["Open pull requests from gh.",...r,n>0?`+${n} more`:null].filter(a=>!!a).join(`
6
+ `)}function $e(s,t){return t?s.path===t.root||t.worktrees.some(n=>n.path===s.path)?!0:s.repo.split("/").pop()?.toLowerCase()===t.name.toLowerCase():!1}function Ce(s,t){const r=t?.branch.name?.trim();return!!(r&&s.headRefName===r)}function at(s,t){if(!t)return null;const r=s.headRefName?.trim();if(!r)return null;const n=[];for(const a of t.projects)for(const l of a.worktrees)l.branch.name?.trim()===r&&n.push({id:l.id,path:l.path,branch:r});if(n.length===0)return null;if(s.path){const a=n.find(l=>l.path===s.path);if(a)return a}return n[0]??null}function it(s,t){const r=[];for(const n of s.projects)for(const a of n.worktrees){const l=a.status.staged+a.status.unstaged+a.status.untracked+a.status.conflicts,o=a.agents.filter(m=>(m.state??"").toLowerCase()==="active").length,c=ae(a.diff.branchShortstat),h=Math.max(a.status.changedFiles,ae(a.diff.stagedShortstat)+ae(a.diff.unstagedShortstat)),p=a.branch.ahead+a.branch.behind,u=o+a.sessions.length;l===0&&u===0&&c===0&&p===0||r.push({path:a.path,score:(a.id===t?1e7:0)+(4-G(a.attention))*1e5+o*1e4+a.sessions.length*5e3+p*1e3+c*250+l*100+h})}return r.sort((n,a)=>a.score-n.score).map(n=>n.path)}function z({children:s}){return e.jsx("div",{className:"s-ops",children:e.jsx("div",{className:"s-ops-body",style:{overflowY:"auto"},children:s})})}function lt({error:s}){return e.jsxs("div",{className:"rw-empty-next",children:[e.jsx("p",{className:"rw-empty-copy",children:"Repos is waiting on the local Scout Services layer. Restart the broker from the menu bar app, then rescan."}),e.jsxs("ol",{className:"rw-empty-steps",children:[e.jsxs("li",{children:["Click ",e.jsx("span",{className:"rw-empty-action-name",children:"Restart broker"})," to hand off to the menu bar app."]}),e.jsx("li",{children:"Wait for Scout Services to report the broker online."}),e.jsxs("li",{children:["If nothing opens, run ",e.jsx("code",{children:"scout doctor"})," and follow the repair command it prints."]})]}),s?e.jsx("p",{className:"rw-empty-error",children:s}):null]})}function ot({snapshot:s,loading:t,error:r,selectedProject:n,selectedWorktree:a,repoSnapshot:l,onSelectWorktree:o,onOpenDiff:c,navigate:h}){const{agents:p}=qe(),u=_e(),[m,N]=d.useState(null),[b,T]=d.useState(null),[C,g]=d.useState(!1),[j,$]=d.useState(null),P=d.useRef(null),M=d.useCallback(i=>{N(i),P.current!=null&&window.clearTimeout(P.current),i&&(P.current=window.setTimeout(()=>N(null),6e3))},[]);d.useEffect(()=>()=>{P.current!=null&&window.clearTimeout(P.current)},[]);const A=d.useCallback(()=>{C||(T(null),$(null))},[C]),x=d.useMemo(()=>(l?.projects??[]).map(i=>({root:i.root,name:i.name})),[l]),k=s?.pullRequests??[],R=a?.branch.name??null,y=k.filter(i=>$e(i,n)),L=y.filter(i=>Ce(i,a)),I=y.filter(i=>!Ce(i,a)),W=k.filter(i=>!$e(i,n)),F=[L.length>0?{key:"branch",label:R?`Selected branch · ${R}`:"Selected branch",items:L}:null,I.length>0?{key:"project",label:n?`${n.name} PRs`:"Selected project",items:I}:null,W.length>0?{key:"other",label:y.length>0?"Other open PRs":"Open PRs",items:W}:null].filter(i=>!!i);if(!t&&!r&&k.length===0)return null;const D=(i,w)=>{i.preventDefault(),u(i,ps(w,{matchingWorktree:at(w,l),onBeginAssign:O=>{$(null),T(O)},onSelectWorktreeId:o,onOpenDiff:c,onStatus:M}))};return e.jsxs("section",{className:"rw-open-prs","aria-label":"Open pull requests",children:[e.jsxs("div",{className:"rw-open-prs-head",children:[e.jsxs("div",{children:[e.jsx("div",{className:"rw-open-prs-eyebrow",children:"Open PRs"}),e.jsx("div",{className:"rw-open-prs-title",children:t&&k.length===0?"Checking GitHub":`${k.length} open`}),m?e.jsx("div",{className:"rw-open-prs-status",role:"status",children:m}):null]}),s?e.jsx("span",{className:"rw-open-prs-meta",children:"gh"}):null]}),k.length>0?e.jsx("div",{className:"rw-open-prs-list",children:F.map(i=>e.jsxs("div",{className:"rw-open-pr-group",children:[F.length>1?e.jsx("div",{className:"rw-open-pr-group-label",children:i.label}):null,i.items.map(w=>e.jsxs("button",{type:"button",className:"rw-open-pr",title:`${w.title} — click for actions`,onClick:O=>D(O,w),onContextMenu:O=>D(O,w),children:[e.jsxs("span",{className:"rw-open-pr-main",children:[e.jsxs("span",{className:"rw-open-pr-number",children:["#",w.number]}),e.jsx("span",{className:"rw-open-pr-title",title:w.title,children:w.title})]}),e.jsxs("span",{className:"rw-open-pr-detail",children:[e.jsx("span",{children:w.repo}),e.jsxs("span",{children:[w.headRefName||"head"," → ",w.baseRefName||"base"]}),w.isDraft?e.jsx("span",{children:"draft"}):e.jsx("span",{children:"open"}),w.author?e.jsxs("span",{children:["@",w.author]}):null,e.jsx("span",{children:nt(w.updatedAt,s?.generatedAt??Date.now())})]})]},w.id))]},i.key))}):e.jsx("div",{className:"rw-open-prs-empty",children:r??"No open pull requests returned."}),b?e.jsx(gs,{pr:b,agents:p,projects:x,pending:C,error:j,onClose:A,onPendingChange:g,onError:$,onAssigned:i=>{T(null),$(null),M(i.message),(i.flightId||i.conversationId||i.targetAgentId)&&h({view:"follow",...i.flightId?{flightId:i.flightId}:{},...i.conversationId?{conversationId:i.conversationId}:{},...i.targetAgentId?{targetAgentId:i.targetAgentId}:{}})}}):null]})}function nn({navigate:s,focusRoot:t=null}){const[r]=d.useState(()=>Be()),[n,a]=d.useState(r),[l,o]=d.useState(r?"ready":"loading"),[c,h]=d.useState(null),p=d.useRef(r!==null),u=d.useRef(0),m=d.useRef(r),N=d.useRef(!1),[b,T]=ye(Xs,Se,"warm"),[C,g]=ye(Ys,ke,"table"),[j,$]=d.useState(null),[P,M]=d.useState("standard"),[A,x]=d.useState(!1),[k,R]=d.useState(null),[y,L]=d.useState(!1),[I,W]=d.useState(!1),[F,D]=d.useState(null),[i,w]=d.useState(null),[O,Z]=d.useState(!1),[Le,ee]=d.useState(null),[B,K]=d.useState(null),q=d.useCallback(async(f={})=>{if(N.current&&!f.force)return;N.current=!0;const S=f.depth??P;f.scanMore&&L(!0),f.force&&!f.scanMore&&x(!0);try{let E=await pe(S,f.force??!1,S==="expanded"?zs:Vs),_=S;if(!p.current&&S==="standard"&&!f.force&&E.projects.length===0)try{const he=await pe("expanded",!0,Gs);he.projects.length>0&&(E=he,_="expanded")}catch{}const ue=m.current;if(ue&&Qs(E)&&(E.projects.length===0||Zs(E,ue))){h("Scan budget was reached; keeping the last fuller Repo Watch snapshot."),o("ready");return}if(!f.force&&E.projects.length===0&&p.current&&u.current<3){u.current+=1,o("ready");return}u.current=0,p.current=!0,m.current=E,a(E),h(null),o("ready"),(f.scanMore||_!==S)&&M(_),f.force&&!f.scanMore&&R(`Fresh ${new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}`)}catch(E){const _=et(E);h(_),p.current||o("error")}finally{f.scanMore&&L(!1),f.force&&!f.scanMore&&x(!1),N.current=!1}},[P]);d.useEffect(()=>{m.current=n},[n]),d.useEffect(()=>{q();const f=setInterval(()=>{q()},Ks);return()=>clearInterval(f)},[q]);const oe=d.useRef(null);d.useEffect(()=>{if(!n)return;if(t&&oe.current!==t){const S=n.projects.find(E=>E.root===t||E.worktrees.some(_=>_.path===t));if(!S)return;if(oe.current=t,!S.worktrees.some(E=>E.id===j)){$(Re([S])?.id??null);return}}n.projects.some(S=>S.worktrees.some(E=>E.id===j))||$(Re(n.projects)?.id??null)},[n,j,t]),d.useEffect(()=>{!n||n.projects.length===0||es(it(n,j),void 0,{limit:Js})},[n,j]);const se=d.useMemo(()=>n?tt(n):[],[n]),Oe=se.join("\0");d.useEffect(()=>{if(se.length===0){w(null),ee(null),Z(!1);return}let f=!1;return Z(!0),ee(null),He(se).then(S=>{f||w(S)}).catch(S=>{f||ee(S instanceof Error?S.message:String(S))}).finally(()=>{f||Z(!1)}),()=>{f=!0}},[Oe]);const H=d.useMemo(()=>st(n,j),[n,j]),We=d.useMemo(()=>rt(i),[i]);d.useEffect(()=>{Ye({worktree:H.worktree,project:H.project,generatedAt:n?.generatedAt??0,tone:b})},[H.worktree,H.project,n?.generatedAt,b]),d.useEffect(()=>Je,[]);const ce=d.useCallback(()=>{q({depth:"expanded",force:!0,scanMore:!0})},[q]),de=d.useCallback(()=>{q({force:!0})},[q]),Fe=d.useCallback(async()=>{if(!I){W(!0),D(null);try{const f=await fetch("/api/scout-services/restart-link",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({target:"broker"})});if(!f.ok)throw new Error(`Scout Services link failed (${f.status})`);const S=await f.json();if(!S.url?.startsWith("scout://services/restart/"))throw new Error("Scout Services link was not returned.");window.location.assign(S.url)}catch(f){const S=f instanceof Error?f.message:String(f);D(`${S} Run scout doctor if the menu app did not open.`)}finally{W(!1)}}},[I]);return l==="loading"?e.jsx(z,{navigate:s,children:e.jsx("div",{className:"repo-watch-scope",style:{padding:"24px"},children:e.jsx(te,{title:"Scanning repositories…",body:"Reading worktree state from the broker."})})}):l==="error"&&!n?e.jsx(z,{navigate:s,children:e.jsx("div",{className:"repo-watch-scope",style:{padding:"24px"},children:e.jsx(te,{className:"sys-state-card-error",title:"Couldn’t load Repo Watch",body:c??"The broker did not return a snapshot.",action:e.jsx("button",{type:"button",className:"s-btn",onClick:()=>{o("loading"),q()},children:"Retry"})})})}):n&&n.projects.length===0?e.jsx(z,{navigate:s,children:e.jsx("div",{className:"repo-watch-scope",style:{padding:"24px"},children:e.jsx(te,{title:"Scout Services need attention",body:e.jsx(lt,{error:F}),action:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"s-btn s-btn-primary",onClick:()=>{Fe()},disabled:I,children:I?"Opening…":"Restart broker"}),e.jsx("button",{type:"button",className:"s-btn",onClick:de,disabled:A||y,children:A?"Scanning…":"Scan again"}),e.jsx("button",{type:"button",className:"s-btn",onClick:ce,disabled:A||y,children:y?"Scanning…":"Scan more"})]})})})}):n?e.jsx(z,{navigate:s,children:e.jsxs("div",{className:"repo-watch-scope",children:[e.jsx("div",{className:"rw-scope tone-"+b,children:e.jsxs("div",{className:"rw-page-shell",children:[e.jsxs("div",{className:"rw-toolbar",children:[e.jsxs("button",{type:"button",className:"rw-refresh-main",onClick:de,disabled:A||y,children:[e.jsx(ss,{size:14,"aria-hidden":"true",className:A?"rw-refresh-spin":void 0}),e.jsx("span",{children:A?"Scanning":"Refresh"})]}),k?e.jsx("span",{className:"rw-refresh-receipt",children:k}):null,e.jsxs("details",{className:"rw-display-menu",children:[e.jsxs("summary",{"aria-label":"Display options",children:[e.jsx(ts,{size:14,"aria-hidden":"true"}),e.jsx("span",{children:"Display"})]}),e.jsxs("div",{className:"rw-display-panel",children:[e.jsxs("div",{className:"rw-display-row",children:[e.jsx("span",{className:"rw-display-label",children:"View"}),e.jsx("div",{className:"rw-tone",role:"group","aria-label":"View",children:ke.map(f=>e.jsx("button",{type:"button",className:f===C?"on":"","aria-pressed":f===C,onClick:()=>g(f),children:f},f))})]}),e.jsxs("div",{className:"rw-display-row",children:[e.jsx("span",{className:"rw-display-label",children:"Tone"}),e.jsx("div",{className:"rw-tone",role:"group","aria-label":"Console tone",children:Se.map(f=>e.jsx("button",{type:"button",className:f===b?"on":"","aria-pressed":f===b,onClick:()=>T(f),children:f},f))})]})]})]})]}),e.jsx("div",{className:"min-w-0",children:C==="drift"?e.jsx(Os,{snapshot:n,selectedId:j,onSelect:$}):e.jsxs(e.Fragment,{children:[e.jsx(ys,{snapshot:n,selectedId:j,onSelect:$,onViewDiff:K,scanDepth:P,scanMorePending:y,onScanMore:ce,openPullRequestCount:i?.pullRequests.length??null,openPullRequestTitle:We}),e.jsx(ot,{snapshot:i,loading:O,error:Le,selectedProject:H.project,selectedWorktree:H.worktree,repoSnapshot:n,onSelectWorktree:$,onOpenDiff:K,navigate:s})]})})]})}),e.jsx(Qe,{open:B!=null,onClose:()=>K(null),side:"right",owner:"openscout.repos-diff-viewer",resizable:!0,defaultSize:840,maxSize:1280,minSize:420,ariaLabel:"Worktree diff",children:B!=null?e.jsx(Ze,{path:B,onClose:()=>K(null),onOpenAsPage:()=>{B&&(s({view:"repo-diff",path:B}),K(null))}},B):null})]})}):e.jsx(z,{navigate:s})}export{nn as ReposScreen,nn as default};