@openscout/scout 0.2.84 → 0.2.86

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 (451) hide show
  1. package/README.md +1 -1
  2. package/bin/scoutd +0 -0
  3. package/dist/build-manifest.json +3 -3
  4. package/dist/client/assets/ActivityScreen-C7AwUogt.js +1 -0
  5. package/dist/client/assets/{AddProjectForm-Czb5uwou.js → AddProjectForm-BNRpRPod.js} +1 -1
  6. package/dist/client/assets/AgentAvatar-B1xvQ7ej.js +1 -0
  7. package/dist/client/assets/AgentConfigurationScreen-BoBQpyz5.js +1 -0
  8. package/dist/client/assets/AgentDefinitionsWorkspace-rw3vh8Lm.js +1 -0
  9. package/dist/client/assets/{AgentDetailCard-Biq8b2gv.js → AgentDetailCard-FelCxQrT.js} +1 -1
  10. package/dist/client/assets/AgentFloorView-Crdw8Uo5.js +1 -0
  11. package/dist/client/assets/AgentInfoScreen-Cge7HHbV.js +1 -0
  12. package/dist/client/assets/{AgentLaneCard-C4DMQR-c.js → AgentLaneCard-CRDG74C1.js} +1 -1
  13. package/dist/client/assets/{AgentLaneChrome-D1xNNf7A.js → AgentLaneChrome-CWFqUdch.js} +1 -1
  14. package/dist/client/assets/AgentLaneDetailSheet-DCIIg3Zp.js +4 -0
  15. package/dist/client/assets/{AgentLaneSummaryResize-C9loK-st.js → AgentLaneSummaryResize-yTM4GQAJ.js} +1 -1
  16. package/dist/client/assets/AgentLanesEmbedScreen-BJLwXSNp.js +1 -0
  17. package/dist/client/assets/{AgentLanesPreflight-M7iDXdP2.js → AgentLanesPreflight-DJeDRTAN.js} +1 -1
  18. package/dist/client/assets/AgentLanesView-CbY9qD0z.js +2 -0
  19. package/dist/client/assets/{AgentLiveActions-0iy8QZ1T.js → AgentLiveActions-Bn3zeZBN.js} +1 -1
  20. package/dist/client/assets/AgentSessions-czl5zT7A.js +6 -0
  21. package/dist/client/assets/AgentsConsole-CoT2crwq.js +1 -0
  22. package/dist/client/assets/{AgentsScreen-Bww6HgFs.js → AgentsScreen-BcPM-z1T.js} +1 -1
  23. package/dist/client/assets/AgentsSubnav-3_vpn2bT.js +1 -0
  24. package/dist/client/assets/AstronautSuit-BADl7m8x.js +1 -0
  25. package/dist/client/assets/{AtopView-h_aFoNkP.js → AtopView-DymBCiXv.js} +1 -1
  26. package/dist/client/assets/{BackToPicker-BXp5E2ck.js → BackToPicker-CqYhOaLB.js} +1 -1
  27. package/dist/client/assets/BriefingDetailScreen-DDfZ8ci1.js +1 -0
  28. package/dist/client/assets/{BriefingsScreen-BTsvr5fv.js → BriefingsScreen-CLvSOJjy.js} +1 -1
  29. package/dist/client/assets/{BrokerMetadataPanel-jg7odHQp.js → BrokerMetadataPanel-DFAH-NO6.js} +1 -1
  30. package/dist/client/assets/BrokerScreen-Bkvu92jk.js +5 -0
  31. package/dist/client/assets/{Canvas-BePL08RR.js → Canvas-KyTsDJlB.js} +1 -1
  32. package/dist/client/assets/ChatCollapsedStrip-Bjjqa30K.js +1 -0
  33. package/dist/client/assets/{CodeDiffPane-86odpBSt.js → CodeDiffPane-C9HT1dCT.js} +1 -1
  34. package/dist/client/assets/{CodeProjectPicker-8svr_S_A.js → CodeProjectPicker-5Y3GvXkM.js} +1 -1
  35. package/dist/client/assets/{CodeScreen-CJ2RgB32.js → CodeScreen-DpN9kQvm.js} +1 -1
  36. package/dist/client/assets/ConversationComposer-Ce7Byw48.js +1 -0
  37. package/dist/client/assets/ConversationFeedRows-DygDfQn_.js +1 -0
  38. package/dist/client/assets/ConversationHeader-C3sg0ULI.js +1 -0
  39. package/dist/client/assets/ConversationPanels-Dg4Y2GgX.js +6 -0
  40. package/dist/client/assets/ConversationScreen-BP5tdz2k.css +1 -0
  41. package/dist/client/assets/ConversationScreen-CjWWmuuh.js +1 -0
  42. package/dist/client/assets/ConversationStatus-BhVIYQza.js +1 -0
  43. package/dist/client/assets/CrewWorkspaces-B6YIyw1z.css +1 -0
  44. package/dist/client/assets/CrewWorkspaces-CDU-wy1Y.js +1 -0
  45. package/dist/client/assets/{DataTable-CGw5CECG.js → DataTable-oJP339bX.js} +1 -1
  46. package/dist/client/assets/{DispatchAftermath-DowTb7uO.js → DispatchAftermath-CH02HAVw.js} +1 -1
  47. package/dist/client/assets/DocumentFocusViewer-DmtFisY9.js +1 -0
  48. package/dist/client/assets/{EmbeddableSurfacesLab-CxfJXS2g.js → EmbeddableSurfacesLab-84b9I3fy.js} +1 -1
  49. package/dist/client/assets/{EmptyState-BUvllvA6.js → EmptyState-BnDda92b.js} +1 -1
  50. package/dist/client/assets/{FileViewerPane-BM4AD_bo.js → FileViewerPane-Dg7_88pv.js} +1 -1
  51. package/dist/client/assets/FlightObserveScreen-DL3Xhl0h.js +1 -0
  52. package/dist/client/assets/{FollowScreen-DG0osbUp.js → FollowScreen-DcFBqr6l.js} +1 -1
  53. package/dist/client/assets/{HarnessMark-MztYnrGK.js → HarnessMark-DGZ6o6Ct.js} +1 -1
  54. package/dist/client/assets/{HarnessesScreen-BWqirBjK.js → HarnessesScreen-DTDL-XaA.js} +1 -1
  55. package/dist/client/assets/{HerdrSession-6sFln7WX.js → HerdrSession-DV2hD6Yh.js} +1 -1
  56. package/dist/client/assets/HomeHero-7JwycwFY.css +1 -0
  57. package/dist/client/assets/HomeHero-CENwVZ45.js +1 -0
  58. package/dist/client/assets/HostAdvisorView-PgiZUkd_.js +1 -0
  59. package/dist/client/assets/{KnowledgeSearchInspector-BOIhFWd2.js → KnowledgeSearchInspector-DNQjeWZO.js} +1 -1
  60. package/dist/client/assets/KnowledgeSearchScreen-Bj80IgR0.js +1 -0
  61. package/dist/client/assets/{LaneToolHoverCard-CcEiQC6B.js → LaneToolHoverCard-197xYmRp.js} +1 -1
  62. package/dist/client/assets/LaneTraceDetailSheet-BztwvOv9.js +1 -0
  63. package/dist/client/assets/{LaneTraceEventFocus-Bl9L0EYb.js → LaneTraceEventFocus-C9cmqxnK.js} +1 -1
  64. package/dist/client/assets/{MeshCanvas-ZjIuMiRo.js → MeshCanvas-C3_2p9B6.js} +2 -2
  65. package/dist/client/assets/{MeshCanvasMinimap-C-LQtiX6.js → MeshCanvasMinimap-ZTjYWXTZ.js} +1 -1
  66. package/dist/client/assets/{MeshScreen-Bs3soujg.js → MeshScreen-lJKaOyGB.js} +1 -1
  67. package/dist/client/assets/{MeshTopologyView-C0LUyT3K.js → MeshTopologyView-CBjHbAZw.js} +2 -2
  68. package/dist/client/assets/MessagesScreen-D6MVLvdg.js +1 -0
  69. package/dist/client/assets/{MissionContextRail-CjGAEGu8.js → MissionContextRail-DXkrbcnZ.js} +1 -1
  70. package/dist/client/assets/MissionControlView-BCH-Zsp4.js +1 -0
  71. package/dist/client/assets/MissionFocusOverlay-DbAliOSF.js +1 -0
  72. package/dist/client/assets/MissionLeftAgentRow-Bx6Pg8_O.js +1 -0
  73. package/dist/client/assets/MissionLogPane-D06c29Y8.js +1 -0
  74. package/dist/client/assets/{NewAgentModal-D5e0YUAo.js → NewAgentModal-C18Ajovd.js} +1 -1
  75. package/dist/client/assets/NewChatComposer-Bgqes0UQ.js +19 -0
  76. package/dist/client/assets/{NewChatOrigin-BEz6jyqf.js → NewChatOrigin-DpHS2Wmt.js} +1 -1
  77. package/dist/client/assets/ObserveEmbedScreen-Cmhwai4X.js +2 -0
  78. package/dist/client/assets/ObserveTextFlow-C1f5oize.js +2 -0
  79. package/dist/client/assets/ObservedTopologyPanel-D85P6RAk.js +2 -0
  80. package/dist/client/assets/OpenScoutAppShell-IDI4fuUE.js +88 -0
  81. package/dist/client/assets/OpsAgentsView-yt0JavoB.js +1 -0
  82. package/dist/client/assets/OpsScreen-C3yNQqJE.js +1 -0
  83. package/dist/client/assets/OpsSubnav-BijKI3yG.js +1 -0
  84. package/dist/client/assets/ProjectAgentProfile-DnIeC16r.js +1 -0
  85. package/dist/client/assets/{ProjectAgentProfileBar-B1VpwzGD.js → ProjectAgentProfileBar-IDEpKZvI.js} +1 -1
  86. package/dist/client/assets/ProjectAgentProfileHero-Bh_aISs-.js +1 -0
  87. package/dist/client/assets/ProjectsInbox-B8Srlklk.js +2 -0
  88. package/dist/client/assets/ProjectsRail-DqAbdvCf.js +1 -0
  89. package/dist/client/assets/ProjectsScreen-DKHQ2iEv.js +1 -0
  90. package/dist/client/assets/ProjectsThreadAside-DpkjYLL2.js +1 -0
  91. package/dist/client/assets/Provider-Ve8yXaWR.js +1 -0
  92. package/dist/client/assets/RailRow-B0sRaJc6.css +1 -0
  93. package/dist/client/assets/RailRow-C4GNGR80.js +1 -0
  94. package/dist/client/assets/RawSessionsTable-Co3vzwsf.js +1 -0
  95. package/dist/client/assets/RealtimeVoiceScreen-DMd1CBAf.js +9 -0
  96. package/dist/client/assets/{RepoDiffEmbedScreen-VLg4caej.js → RepoDiffEmbedScreen-C97Euf4s.js} +1 -1
  97. package/dist/client/assets/{RepoDiffPageScreen-BelnvgnP.js → RepoDiffPageScreen-DUKLzkrW.js} +1 -1
  98. package/dist/client/assets/RepoDiffViewer-CovKjSgb.js +7 -0
  99. package/dist/client/assets/RepoDiffViewerLazy-zIiEmh-e.js +2 -0
  100. package/dist/client/assets/{ReposScreen-IINK-CFn.js → ReposScreen-BR1LqTf1.js} +6 -6
  101. package/dist/client/assets/ScoutDeckSurface-BGsVicc2.js +1 -0
  102. package/dist/client/assets/{ScoutSurface-x_QbcRyk.js → ScoutSurface-BMKW7hSu.js} +1 -1
  103. package/dist/client/assets/{ScoutbotFxLab-7t9JVvZg.js → ScoutbotFxLab-0O2iDRrF.js} +1 -1
  104. package/dist/client/assets/{SecondaryNav-Dj30epYF.js → SecondaryNav-cYTw2p39.js} +1 -1
  105. package/dist/client/assets/{SessionEmbedScreen-s2mJ5Fg9.js → SessionEmbedScreen-mNjT0R6j.js} +1 -1
  106. package/dist/client/assets/{SessionObserve-DaUrJCMq.js → SessionObserve-zAlFbwFn.js} +1 -1
  107. package/dist/client/assets/{SessionObserveEvidence-ClUW8jpV.js → SessionObserveEvidence-BVawzqoE.js} +1 -1
  108. package/dist/client/assets/SessionRefScreen-BmKhf29o.js +1 -0
  109. package/dist/client/assets/SessionsScreen-CsSqjIY2.js +1 -0
  110. package/dist/client/assets/SettingsDrawer-Dsj-On_x.css +1 -0
  111. package/dist/client/assets/SettingsDrawer-DwYQTGi8.js +3 -0
  112. package/dist/client/assets/SettingsScreen-Btaku7YM.js +1 -0
  113. package/dist/client/assets/{ShikiPane-Dkwyx--r.js → ShikiPane-DyEJdcvb.js} +1 -1
  114. package/dist/client/assets/{SlidePanel-CuTeirnk.js → SlidePanel-Dg8_styW.js} +1 -1
  115. package/dist/client/assets/{SpriteAvatar-DQ3PTb8L.js → SpriteAvatar-DMrSssNZ.js} +1 -1
  116. package/dist/client/assets/{StatusPill-BJ1ierIR.js → StatusPill-NFFnphtx.js} +1 -1
  117. package/dist/client/assets/{TailView-CufWcrvf.js → TailView-BfObcZu3.js} +2 -2
  118. package/dist/client/assets/Terminal-Dr-M9U4u.js +1 -0
  119. package/dist/client/assets/TerminalEmbedScreen-BmyZkonh.js +1 -0
  120. package/dist/client/assets/{TerminalRelay-rvUzI9Ek.js → TerminalRelay-lJ2KdMCW.js} +3 -3
  121. package/dist/client/assets/{TextDocumentSurface-Bc-kHPgG.js → TextDocumentSurface-C7fGlzY8.js} +1 -1
  122. package/dist/client/assets/{TmuxPeek-DLyDkq_D.js → TmuxPeek-BSeKIjnX.js} +1 -1
  123. package/dist/client/assets/{VoicePermissionsPanel-CD903y9K.js → VoicePermissionsPanel-BkIGTzgw.js} +1 -1
  124. package/dist/client/assets/{WorkDetailScreen-D51oI0dH.js → WorkDetailScreen-Cwe-KWK4.js} +3 -3
  125. package/dist/client/assets/WorkFilesViewer-BBtKRBPv.js +1 -0
  126. package/dist/client/assets/{activity-BvGruxWG.js → activity-D4W2XZY2.js} +1 -1
  127. package/dist/client/assets/{addon-fit-Cfq4Ayjd.js → addon-fit-Celjj2yn.js} +1 -1
  128. package/dist/client/assets/{addon-webgl-B8sIf9-s.js → addon-webgl-Cu4tJ21-.js} +1 -1
  129. package/dist/client/assets/{ScoutbotBroadcastChip-CxtYZWPZ.css → agent-autocomplete-C7xwIcwd.css} +1 -1
  130. package/dist/client/assets/agent-autocomplete-Dv-_9dAw.js +2 -0
  131. package/dist/client/assets/{agent-essentials-yb4wIJlX.js → agent-essentials-CngjUhQj.js} +1 -1
  132. package/dist/client/assets/agent-identity-DzHGhLdJ.js +1 -0
  133. package/dist/client/assets/{agent-lane-card-model-q4cwzLX4.js → agent-lane-card-model-CSugZCdy.js} +1 -1
  134. package/dist/client/assets/{agent-lane-detail-BNNm6FNu.js → agent-lane-detail-D5EIlX7_.js} +1 -1
  135. package/dist/client/assets/{agent-lane-preview-C33Dwpn7.js → agent-lane-preview-BhplDYGf.js} +1 -1
  136. package/dist/client/assets/{agent-lanes-BDNktFBZ.css → agent-lanes-DlqcEf0l.css} +1 -1
  137. package/dist/client/assets/{agent-lanes-model-VYQ5a68i.js → agent-lanes-model-BKOs_32K.js} +2 -2
  138. package/dist/client/assets/agent-specialization-CNrsRbKA.js +1 -0
  139. package/dist/client/assets/{api-BkjHJfgJ.js → api-BHHEUSS3.js} +1 -1
  140. package/dist/client/assets/api-DEHEgJ9m.js +1 -0
  141. package/dist/client/assets/{arc.es-BBTfhvLE.js → arc.es-DNT50Y-_.js} +1 -1
  142. package/dist/client/assets/archive-DH49QqFG.js +1 -0
  143. package/dist/client/assets/{arrow-left-BOht-YQu.js → arrow-left-i-h6JAgs.js} +1 -1
  144. package/dist/client/assets/arrow-right-B0Yi01Zr.js +1 -0
  145. package/dist/client/assets/{arrow-up-right-hoR8_oUz.js → arrow-up-right-RBC6k8nn.js} +1 -1
  146. package/dist/client/assets/{bot-BUK7dOPS.js → bot-r2IuAuJd.js} +1 -1
  147. package/dist/client/assets/broker-display-Q75fupqG.js +2 -0
  148. package/dist/client/assets/{cache-Dr0why2k.js → cache-BO2Bd_LV.js} +1 -1
  149. package/dist/client/assets/{check--esHw52j.js → check-Bfs7hMb1.js} +1 -1
  150. package/dist/client/assets/{chevron-down-NAhBUkFd.js → chevron-down-Da5tV19_.js} +1 -1
  151. package/dist/client/assets/{chevron-right-C10o7t_X.js → chevron-right-BMqtBds_.js} +1 -1
  152. package/dist/client/assets/{chunk-HRAB3GC3-DF8R9rPv.js → chunk-HRAB3GC3-BUVYXXAp.js} +1 -1
  153. package/dist/client/assets/{clock-of01sAB6.js → clock-DaKLp6Xd.js} +1 -1
  154. package/dist/client/assets/{code-xml-CLn3TDWF.js → code-xml-ByQsfOI_.js} +1 -1
  155. package/dist/client/assets/collapsed-strip-raJWthAH.css +1 -0
  156. package/dist/client/assets/compass-BepM5iWH.js +1 -0
  157. package/dist/client/assets/{content-Cgj5AWqT.js → content-5hnDC9WE.js} +1 -1
  158. package/dist/client/assets/content-BRFZ-a6m.js +1 -0
  159. package/dist/client/assets/content-BYykncDo.js +1 -0
  160. package/dist/client/assets/content-Be6yyWbJ.js +1 -0
  161. package/dist/client/assets/content-Bgl_X3ao.js +1 -0
  162. package/dist/client/assets/content-BopJW1Zx.js +1 -0
  163. package/dist/client/assets/content-Bv2sfg0w.js +1 -0
  164. package/dist/client/assets/content-CMBiIZTg.js +1 -0
  165. package/dist/client/assets/content-CPVqvf5o.js +1 -0
  166. package/dist/client/assets/content-CbwyFqdI.js +1 -0
  167. package/dist/client/assets/content-ClQjAWYi.js +1 -0
  168. package/dist/client/assets/content-Cv2tSAbv.js +1 -0
  169. package/dist/client/assets/content-DFFe3-Ot.js +1 -0
  170. package/dist/client/assets/content-DY5hwBmm.js +1 -0
  171. package/dist/client/assets/content-_IXoxGno.js +1 -0
  172. package/dist/client/assets/content-j_tewJdE.js +1 -0
  173. package/dist/client/assets/{conversation-icons-ClBJi21l.js → conversation-icons-C4amK8Sa.js} +1 -1
  174. package/dist/client/assets/conversation-model-CigSPlKA.js +1 -0
  175. package/dist/client/assets/conversation-motion-features-_95aZx_1.js +1 -0
  176. package/dist/client/assets/{copy-Dty8ZYsM.js → copy-De4s38o2.js} +1 -1
  177. package/dist/client/assets/cpu-Bc268H9Q.js +1 -0
  178. package/dist/client/assets/{createLucideIcon-Bt67PWH-.js → createLucideIcon-DLlxGjKt.js} +1 -1
  179. package/dist/client/assets/credentials-qwds23lv.js +1 -0
  180. package/dist/client/assets/ctx-panel-D_HJ3nhb.css +1 -0
  181. package/dist/client/assets/discover-DOlk1hG7.js +2 -0
  182. package/dist/client/assets/embed-entry-BqDJfa87.js +2 -0
  183. package/dist/client/assets/{external-link-Dem738OJ.js → external-link-BGHC_naA.js} +1 -1
  184. package/dist/client/assets/{eye-B3lBIwJZ.js → eye-BeCSqJn1.js} +1 -1
  185. package/dist/client/assets/file-code-corner-CX53Cd9y.js +1 -0
  186. package/dist/client/assets/{file-text-iF0hyVyU.js → file-text-BVhkMWyC.js} +1 -1
  187. package/dist/client/assets/gauge-CPcEPmNt.js +1 -0
  188. package/dist/client/assets/gestures-BXIGYk_p.js +1 -0
  189. package/dist/client/assets/git-branch-q8Ayc8py.js +1 -0
  190. package/dist/client/assets/home-moving-signal-DMguaRWR.css +1 -0
  191. package/dist/client/assets/home-moving-signal-Dm2Z2x0p.js +1 -0
  192. package/dist/client/assets/{home-now-card-nano-hZl9klbP.js → home-now-card-nano-Djhy6ax0.js} +1 -1
  193. package/dist/client/assets/home-now-card-xU5LGP7q.js +1 -0
  194. package/dist/client/assets/hooks-CdKx1CxP.js +2 -0
  195. package/dist/client/assets/host-advisor-B2Fqs5Dd.css +1 -0
  196. package/dist/client/assets/index-Bli6bTLU.js +10 -0
  197. package/dist/client/assets/index-D7UEHxaY.js +1 -0
  198. package/dist/client/assets/index-DFdlQs_c.js +1 -0
  199. package/dist/client/assets/index-DhfOMK0D.js +1 -0
  200. package/dist/client/assets/index-DzlEgstl.css +1 -0
  201. package/dist/client/assets/index-wLwc74Pu.css +1 -0
  202. package/dist/client/assets/inspector-panel-B8pigRsg.js +2 -0
  203. package/dist/client/assets/{keyboard-nav-Chf51dns.js → keyboard-nav-7iEtvu9P.js} +1 -1
  204. package/dist/client/assets/{lane-observe-BA3g9aVd.js → lane-observe-vfyACHi0.js} +1 -1
  205. package/dist/client/assets/{lane-roster-store-BiIVlYmG.js → lane-roster-store-pHT3TAVs.js} +1 -1
  206. package/dist/client/assets/layers-BiZA-Clc.js +1 -0
  207. package/dist/client/assets/layout-grid-DMpv9CZM.js +1 -0
  208. package/dist/client/assets/left-BayK4ocL.js +1 -0
  209. package/dist/client/assets/left-BhZhSrS2.js +1 -0
  210. package/dist/client/assets/left-BhgU6NOA.js +1 -0
  211. package/dist/client/assets/left-CY_FGnN7.js +1 -0
  212. package/dist/client/assets/left-Cq8mjamr.js +1 -0
  213. package/dist/client/assets/left-DH44V4I_.css +1 -0
  214. package/dist/client/assets/left-Dnqla0b5.js +2 -0
  215. package/dist/client/assets/left-Dy403II2.js +2 -0
  216. package/dist/client/assets/left-R2OOE7VG.css +1 -0
  217. package/dist/client/assets/left-advisor-oOAtJ9YE.js +1 -0
  218. package/dist/client/assets/left-agents-TIKe8vW8.js +1 -0
  219. package/dist/client/assets/left-default-owH0Lwxo.js +1 -0
  220. package/dist/client/assets/left-lanes-BE_co2lP.js +1 -0
  221. package/dist/client/assets/left-mission-C_nWUtfA.js +1 -0
  222. package/dist/client/assets/library-BSVrjn_m.js +1 -0
  223. package/dist/client/assets/{loader-circle-4LDsy4Ke.js → loader-circle-DoT8gpw6.js} +1 -1
  224. package/dist/client/assets/{local-agents-DIi2EacM.js → local-agents-BMadXuP1.js} +1 -1
  225. package/dist/client/assets/mentions-Cd6XticV.js +1 -0
  226. package/dist/client/assets/{mesh-ops-JZwGuAPn.js → mesh-ops-C0zCLTR8.js} +1 -1
  227. package/dist/client/assets/{mesh-view-store-Du7VqIT_.js → mesh-view-store-Cpqil_2D.js} +1 -1
  228. package/dist/client/assets/{message-circle-BM3XgevU.js → message-circle-44KSmbvQ.js} +1 -1
  229. package/dist/client/assets/{message-markup-BcY1lShv.js → message-markup-DAnnGpWr.js} +1 -1
  230. package/dist/client/assets/{message-square-ER1_q2pe.js → message-square-DlY4EneU.js} +1 -1
  231. package/dist/client/assets/mission-control-CnU7dNt1.css +1 -0
  232. package/dist/client/assets/{mission-control-store-C6w5iVfg.js → mission-control-store-DtjtRs9Z.js} +1 -1
  233. package/dist/client/assets/{observe-3-jn4SXb.js → observe-DL5_8-Zj.js} +1 -1
  234. package/dist/client/assets/{operator-attention-BwSPeheT.js → operator-attention-BqoWAlhp.js} +1 -1
  235. package/dist/client/assets/{page-status-0LPfBC8S.js → page-status-CW8co39E.js} +1 -1
  236. package/dist/client/assets/persistent-state-DYjP8lqN.js +1 -0
  237. package/dist/client/assets/{plus-C-2gTcPK.js → plus-64n9qucr.js} +1 -1
  238. package/dist/client/assets/profile-BkmuseW7.js +1 -0
  239. package/dist/client/assets/projects-inbox-C0umZMSY.js +1 -0
  240. package/dist/client/assets/{provider-BvAxRQfE.js → provider-CX9EWecp.js} +1 -1
  241. package/dist/client/assets/proxy-C35W-YHZ.js +1 -0
  242. package/dist/client/assets/{radio-v7UAMZGh.js → radio-BjpQTKT0.js} +1 -1
  243. package/dist/client/assets/{refresh-cw-B5To7b6B.js → refresh-cw-IgN2fZLM.js} +1 -1
  244. package/dist/client/assets/resolve-panes-CCqRkQdM.js +1 -0
  245. package/dist/client/assets/resolve-sidebar-context-JkxY8qsV.js +1 -0
  246. package/dist/client/assets/right-B3PQUHd5.js +1 -0
  247. package/dist/client/assets/right-B96CBzrV.js +1 -0
  248. package/dist/client/assets/right-BPirlFC8.js +1 -0
  249. package/dist/client/assets/right-BUP2Ro_M.js +1 -0
  250. package/dist/client/assets/right-BVWYPIFX.js +1 -0
  251. package/dist/client/assets/right-BoAJxwA3.js +1 -0
  252. package/dist/client/assets/right-C2aOC2li.js +1 -0
  253. package/dist/client/assets/right-CtPJjgOV.js +1 -0
  254. package/dist/client/assets/{right-BvoGOUKH.js → right-DqiVyo8v.js} +1 -1
  255. package/dist/client/assets/right-SfSu0zHC.js +1 -0
  256. package/dist/client/assets/{rocket-BQQQv2L5.js → rocket-DnmN_YOD.js} +1 -1
  257. package/dist/client/assets/{router-C65cZYPn.js → router-B0YclXYg.js} +1 -1
  258. package/dist/client/assets/{scope-views-BOOmgmwx.js → scope-views-Z8aoAmtU.js} +1 -1
  259. package/dist/client/assets/scout-voice-DvG_3stJ.js +1 -0
  260. package/dist/client/assets/{scoutbot-BTIErYHo.js → scoutbot-D4vuKzOL.js} +2 -2
  261. package/dist/client/assets/scoutbot-markdown-BJJyaPu2.js +6 -0
  262. package/dist/client/assets/{scroll-text-BuneRiAD.js → scroll-text-DRidbcse.js} +1 -1
  263. package/dist/client/assets/{search-7_n7CxWl.js → search-BbgsEMXa.js} +1 -1
  264. package/dist/client/assets/secondaryNavConfig-DyC_P9Wx.js +1 -0
  265. package/dist/client/assets/{selection-bridge-SlGsgHw2.js → selection-bridge-CpzFGx3-.js} +1 -1
  266. package/dist/client/assets/{send-horizontal-DP16OOIW.js → send-horizontal-BXo2uz3Z.js} +1 -1
  267. package/dist/client/assets/{server-pYOMFjrT.js → server-Dt3tpiBj.js} +1 -1
  268. package/dist/client/assets/{session-catalog-_QfQ7fhZ.js → session-catalog-CUQ8LUJY.js} +1 -1
  269. package/dist/client/assets/{session-table-CYN8e4s3.js → session-table-B4JOKevn.js} +1 -1
  270. package/dist/client/assets/settings-BzWCF3NF.js +1 -0
  271. package/dist/client/assets/{sliders-horizontal-D2Z8gz6J.js → sliders-horizontal-7V8B3xsf.js} +1 -1
  272. package/dist/client/assets/{sparkles-Bth2iK7t.js → sparkles-ytTwpCbZ.js} +1 -1
  273. package/dist/client/assets/{sse-CL6gctHY.js → sse-CSozY6mp.js} +1 -1
  274. package/dist/client/assets/system-surfaces-redesign-QVXNeGYw.css +1 -0
  275. package/dist/client/assets/{tail-display-BRcJltQa.js → tail-display-DcliDVkW.js} +1 -1
  276. package/dist/client/assets/{tail-events-NLIWLq27.js → tail-events-CrN-Rmxj.js} +1 -1
  277. package/dist/client/assets/{terminal-By1Lw2i2.js → terminal-BiNIXhna.js} +1 -1
  278. package/dist/client/assets/{terminal-relay-CjkI5aUy.js → terminal-relay-pSm7_An6.js} +1 -1
  279. package/dist/client/assets/{terminal-sessions-AmSgHklm.js → terminal-sessions-D4dHTRkt.js} +1 -1
  280. package/dist/client/assets/{terminal-takeover-7AvNpnkC.js → terminal-takeover-CtA3wcXh.js} +1 -1
  281. package/dist/client/assets/{runtime-picker-eDEvx2Mz.js → text-BR9Bap0E.js} +1 -1
  282. package/dist/client/assets/text-rLpBg4_z.css +1 -0
  283. package/dist/client/assets/{use-conversation-list-BCzY032j.js → use-conversation-list-C0bEXFeH.js} +1 -1
  284. package/dist/client/assets/{use-fleet-active-asks-CJ6-oj5k.js → use-fleet-active-asks-CK4aw-3G.js} +1 -1
  285. package/dist/client/assets/{use-mesh-ops-items-D5L-CKe_.js → use-mesh-ops-items-QixBijmT.js} +1 -1
  286. package/dist/client/assets/use-reduced-motion-BLn59zLn.js +1 -0
  287. package/dist/client/assets/{use-scout-dev-flags-BohC8seq.js → use-scout-dev-flags-JKb1EhFh.js} +1 -1
  288. package/dist/client/assets/{useAgentHoverCard-RsLUYyeh.js → useAgentHoverCard-6N8b7qsU.js} +1 -1
  289. package/dist/client/assets/useContentSecondaryNav-D-hVKzM9.js +1 -0
  290. package/dist/client/assets/{usePersistentState-D3M4m2Ou.js → usePersistentState-DOEahRlt.js} +1 -1
  291. package/dist/client/assets/{usePierreRuntime-B4hbNWTz.js → usePierreRuntime-Bq6mXrgd.js} +1 -1
  292. package/dist/client/assets/{wrench-M4G7WtYB.js → wrench-CQvdf7KT.js} +1 -1
  293. package/dist/client/assets/{x-ynOfVadO.js → x-BJyPzFnn.js} +1 -1
  294. package/dist/client/assets/{xterm-DZHyijPp.js → xterm-D6dE_wMr.js} +1 -1
  295. package/dist/client/assets/zap-rw7uwZht.js +1 -0
  296. package/dist/client/index.html +2 -2
  297. package/dist/main.mjs +629 -167
  298. package/dist/node/main.mjs +454 -270
  299. package/dist/pairing-runtime-controller.mjs +607 -357
  300. package/dist/runtime/base-daemon.mjs +384 -21
  301. package/dist/runtime/broker-daemon.mjs +11024 -10023
  302. package/dist/runtime/broker-process-manager.mjs +9 -3
  303. package/dist/runtime/mesh-discover.mjs +9 -3
  304. package/dist/scout-control-plane-web.mjs +1590 -984
  305. package/dist/scout-web-server.mjs +1590 -984
  306. package/package.json +4 -4
  307. package/dist/client/assets/ActivityScreen-aewI4Ul1.js +0 -1
  308. package/dist/client/assets/AgentAvatar-DMov24_o.js +0 -1
  309. package/dist/client/assets/AgentConfigurationScreen-BjG6ECjl.js +0 -1
  310. package/dist/client/assets/AgentDefinitionsWorkspace-D4MbSMXp.js +0 -1
  311. package/dist/client/assets/AgentFloorView-h9KDJdw0.js +0 -1
  312. package/dist/client/assets/AgentInfoScreen-SjhK_SBh.js +0 -1
  313. package/dist/client/assets/AgentLaneDetailSheet-DnAKe4e3.js +0 -4
  314. package/dist/client/assets/AgentLanesEmbedScreen-BNOYF16R.js +0 -1
  315. package/dist/client/assets/AgentLanesView-Ct-Gz5WD.js +0 -2
  316. package/dist/client/assets/AgentSessions-CDfSfNiE.js +0 -6
  317. package/dist/client/assets/AgentsConsole-BVxhBqRa.js +0 -1
  318. package/dist/client/assets/AgentsSubnav-CiIuzxnZ.js +0 -1
  319. package/dist/client/assets/BriefingDetailScreen-C83o2YfN.js +0 -6
  320. package/dist/client/assets/BrokerScreen-DplF8d_X.js +0 -5
  321. package/dist/client/assets/ChatCollapsedStrip-BRljIymi.js +0 -1
  322. package/dist/client/assets/ContextMenu-CxkmFQcN.js +0 -1
  323. package/dist/client/assets/ConversationComposer-CWohCCmn.js +0 -1
  324. package/dist/client/assets/ConversationFeedRows-IWh0JSIL.js +0 -1
  325. package/dist/client/assets/ConversationHeader-BxTzXl8e.js +0 -1
  326. package/dist/client/assets/ConversationPanels-D9UCwNkS.js +0 -2
  327. package/dist/client/assets/ConversationScreen-oZSitVtX.js +0 -1
  328. package/dist/client/assets/ConversationScreen-yIKEsm-8.css +0 -1
  329. package/dist/client/assets/ConversationStatus-B6pAbo2w.js +0 -1
  330. package/dist/client/assets/DocumentFocusViewer-DRKjNG9s.js +0 -1
  331. package/dist/client/assets/FleetSearch-CYeWn85V.js +0 -1
  332. package/dist/client/assets/FleetSearch-EXOe8ulE.css +0 -1
  333. package/dist/client/assets/FlightObserveScreen-DYJJ3Z2B.js +0 -1
  334. package/dist/client/assets/HomeHero-BPBArHXa.js +0 -1
  335. package/dist/client/assets/HomeHero-DEl-WBsT.css +0 -1
  336. package/dist/client/assets/KnowledgeSearchScreen-BP8tD-Bh.js +0 -1
  337. package/dist/client/assets/LaneTraceDetailSheet-B4i1Ut4R.js +0 -1
  338. package/dist/client/assets/MessageComposerSuggestions-Dfc3PH2y.js +0 -1
  339. package/dist/client/assets/MessagesScreen-TgSL5KMc.js +0 -1
  340. package/dist/client/assets/MissionControlView-D629w2A8.js +0 -1
  341. package/dist/client/assets/MissionFocusOverlay-Bubrr8Gc.js +0 -1
  342. package/dist/client/assets/MissionLeftAgentRow-DokImu4Y.js +0 -1
  343. package/dist/client/assets/MissionLogPane-Cs0LuIkn.js +0 -1
  344. package/dist/client/assets/NewChatComposer-S08F6_La.js +0 -19
  345. package/dist/client/assets/ObserveEmbedScreen-CHx2sEAA.js +0 -2
  346. package/dist/client/assets/ObserveTextFlow-_ApDwRCO.js +0 -2
  347. package/dist/client/assets/ObservedTopologyPanel-ByW7Ar7p.js +0 -2
  348. package/dist/client/assets/OpenScoutAppShell-DTmnbG-h.js +0 -88
  349. package/dist/client/assets/OpsAgentsView-DiFuHcJs.js +0 -1
  350. package/dist/client/assets/OpsScreen-CCR3U_9P.js +0 -1
  351. package/dist/client/assets/OpsSubnav-CZs_OL2N.js +0 -1
  352. package/dist/client/assets/PlanView-C54eAzig.js +0 -1
  353. package/dist/client/assets/ProjectAgentProfile-BEfYOaxc.js +0 -1
  354. package/dist/client/assets/ProjectAgentProfileHero-B4f_AoCr.js +0 -1
  355. package/dist/client/assets/ProjectsInbox-DoPZ17FC.js +0 -2
  356. package/dist/client/assets/ProjectsRail-CWOkZjsY.js +0 -1
  357. package/dist/client/assets/ProjectsScreen-Dse0Q6p6.js +0 -1
  358. package/dist/client/assets/ProjectsThreadAside-DMnfyPLE.js +0 -1
  359. package/dist/client/assets/Provider-DKZWuzSR.js +0 -1
  360. package/dist/client/assets/RailRow-Cf9LOiEj.css +0 -1
  361. package/dist/client/assets/RailRow-DIGd3MMM.js +0 -1
  362. package/dist/client/assets/RawSessionsTable-Zkl4YDvz.js +0 -1
  363. package/dist/client/assets/RealtimeVoiceScreen-B_PMJxY_.js +0 -1
  364. package/dist/client/assets/RepoDiffViewer-VrUJw33u.js +0 -7
  365. package/dist/client/assets/RepoDiffViewerLazy-BPg_JkYW.js +0 -2
  366. package/dist/client/assets/ScoutDeckSurface-MbwGp6Ab.js +0 -1
  367. package/dist/client/assets/ScoutbotBroadcastChip-DAKQKB25.js +0 -2
  368. package/dist/client/assets/ScoutbotRealtimeVoiceCall-Br4bYVAx.js +0 -1
  369. package/dist/client/assets/SessionRefScreen-DLZNFZFK.js +0 -1
  370. package/dist/client/assets/SessionsScreen-D-hN1n4k.js +0 -1
  371. package/dist/client/assets/SettingsDrawer-BFsnww-k.js +0 -3
  372. package/dist/client/assets/SettingsDrawer-UX7pFJU_.css +0 -1
  373. package/dist/client/assets/SettingsScreen-Bc3Xtv5V.js +0 -1
  374. package/dist/client/assets/Terminal-D_OmdFmr.js +0 -1
  375. package/dist/client/assets/TerminalEmbedScreen-D21ytNXW.js +0 -1
  376. package/dist/client/assets/WorkFilesViewer-BDMNbxE4.js +0 -1
  377. package/dist/client/assets/agent-identity-BxCsXnDp.js +0 -1
  378. package/dist/client/assets/api-h5zurxmi.js +0 -1
  379. package/dist/client/assets/broker-display-pp33bLsu.js +0 -2
  380. package/dist/client/assets/collapsed-strip-Dz-of2SM.css +0 -1
  381. package/dist/client/assets/content-B-SUUhXj.js +0 -1
  382. package/dist/client/assets/content-BRY2vo1_.js +0 -1
  383. package/dist/client/assets/content-BTm0mVyD.js +0 -1
  384. package/dist/client/assets/content-BTqvyb5E.js +0 -1
  385. package/dist/client/assets/content-BjDaXmSD.js +0 -1
  386. package/dist/client/assets/content-BrR6deGh.js +0 -1
  387. package/dist/client/assets/content-C5yvBEMy.js +0 -1
  388. package/dist/client/assets/content-CkhG__-v.js +0 -1
  389. package/dist/client/assets/content-CudIBsiP.js +0 -1
  390. package/dist/client/assets/content-DBb7ppd5.js +0 -1
  391. package/dist/client/assets/content-DEw_kGyK.js +0 -1
  392. package/dist/client/assets/content-DIy0DCzK.js +0 -1
  393. package/dist/client/assets/content-THl9hRAo.js +0 -1
  394. package/dist/client/assets/content-vi9FbmV9.js +0 -1
  395. package/dist/client/assets/content-wcgPMGVf.js +0 -1
  396. package/dist/client/assets/conversation-model-CHwHZNw-.js +0 -1
  397. package/dist/client/assets/conversation-motion-features-zU0k3Agz.js +0 -1
  398. package/dist/client/assets/ctx-panel-B4s49N9e.css +0 -1
  399. package/dist/client/assets/discover-NDAqNvKt.js +0 -2
  400. package/dist/client/assets/embed-entry-BVR09F6e.js +0 -2
  401. package/dist/client/assets/home-moving-signal-C8dTXieA.js +0 -1
  402. package/dist/client/assets/home-moving-signal-CAa0V91u.css +0 -1
  403. package/dist/client/assets/home-now-card-BgvVcE83.js +0 -1
  404. package/dist/client/assets/hooks-DBIezYS2.js +0 -2
  405. package/dist/client/assets/index-BMwKgdz_.js +0 -1
  406. package/dist/client/assets/index-Bu-fckyR.css +0 -1
  407. package/dist/client/assets/index-BxoufAPA.js +0 -1
  408. package/dist/client/assets/index-Cj7NnSxI.js +0 -1
  409. package/dist/client/assets/index-CvF09yvf.css +0 -1
  410. package/dist/client/assets/index-o4FKpU7Z.js +0 -10
  411. package/dist/client/assets/inspector-panel-Dy2cVTCi.js +0 -2
  412. package/dist/client/assets/left-BC7p5QbT.js +0 -1
  413. package/dist/client/assets/left-BCSGqccQ.js +0 -1
  414. package/dist/client/assets/left-BSyj8PuJ.js +0 -2
  415. package/dist/client/assets/left-Bk3XnxPD.css +0 -1
  416. package/dist/client/assets/left-CCoobxPS.css +0 -1
  417. package/dist/client/assets/left-DDnxNUxd.js +0 -1
  418. package/dist/client/assets/left-DLoDKxT5.js +0 -2
  419. package/dist/client/assets/left-O-TBH7JB.js +0 -1
  420. package/dist/client/assets/left-agents-Dk9Y89lb.js +0 -1
  421. package/dist/client/assets/left-default-B3JBRQNJ.js +0 -1
  422. package/dist/client/assets/left-lanes-30Oe_3RM.js +0 -1
  423. package/dist/client/assets/left-mission-DEl4-7xu.js +0 -1
  424. package/dist/client/assets/left-plan-B4qdm4Gn.js +0 -2
  425. package/dist/client/assets/left-rvUOB14X.js +0 -1
  426. package/dist/client/assets/library-DDKSLFJ_.js +0 -1
  427. package/dist/client/assets/mentions-CvDaviLJ.js +0 -1
  428. package/dist/client/assets/mission-control-m3BTDQ9l.css +0 -1
  429. package/dist/client/assets/model-Co0zkMIc.js +0 -1
  430. package/dist/client/assets/plan-view-D56fneVF.css +0 -1
  431. package/dist/client/assets/profile-DW80Gn5k.js +0 -1
  432. package/dist/client/assets/projects-inbox-DCeD3FfV.js +0 -1
  433. package/dist/client/assets/resolve-panes-BDi9Qx4R.js +0 -1
  434. package/dist/client/assets/resolve-sidebar-context-HE-5eZYa.js +0 -1
  435. package/dist/client/assets/right-BDf_yTv6.js +0 -1
  436. package/dist/client/assets/right-C-bgjYg-.js +0 -1
  437. package/dist/client/assets/right-C3JdEfYQ.js +0 -1
  438. package/dist/client/assets/right-CYIs2tEe.js +0 -1
  439. package/dist/client/assets/right-CyRCv6Up.js +0 -1
  440. package/dist/client/assets/right-DBYGtoRv.js +0 -1
  441. package/dist/client/assets/right-o3LHMiKa.js +0 -1
  442. package/dist/client/assets/right-oPrcx9MX.js +0 -1
  443. package/dist/client/assets/right-sSvBUK-j.js +0 -1
  444. package/dist/client/assets/runtime-picker-vhm0gtLs.css +0 -1
  445. package/dist/client/assets/scout-voice-B7kXlkcl.js +0 -1
  446. package/dist/client/assets/secondaryNavConfig-CSFDCQAf.js +0 -1
  447. package/dist/client/assets/system-surfaces-redesign-B7GQhfpw.css +0 -1
  448. package/dist/client/assets/text-DsBWV_4k.js +0 -1
  449. package/dist/client/assets/use-reduced-motion-CqXpVXv-.js +0 -1
  450. package/dist/client/assets/useContentSecondaryNav-DOr5yHbT.js +0 -1
  451. /package/dist/client/assets/{document-focus-viewer-BSC_JwVE.css → DocumentFocusViewer-BSC_JwVE.css} +0 -0
@@ -0,0 +1 @@
1
+ import{j as e,r as o,n as Ve,o as Ye}from"./index-Bli6bTLU.js";/* empty css */import{u as Rs,a as Es}from"./Provider-Ve8yXaWR.js";import{a as me}from"./api-DEHEgJ9m.js";import{c as bs}from"./clipboard-e3fSpeo7.js";import{d as Ws}from"./colors-BtO5_zlx.js";import{r as Te,S as Ge,a as Je,w as Ie,s as bt,b as xt,d as yt,c as jt,e as As,f as Ce,g as gt}from"./terminal-relay-pSm7_An6.js";import{p as Ms,g as St,f as Ls,b as Ds,s as F,d as Be,h as He,r as zs,i as Os,j as wt,k as Nt,m as Ct,t as Ps,n as vt}from"./terminal-sessions-D4dHTRkt.js";import{H as Tt,u as Xe,a as It,c as Rt,h as Et,b as Wt,A as At}from"./HerdrSession-DV2hD6Yh.js";import{D as Mt,c as Lt,P as Dt,s as _e,T as zt,a as Ot,d as _s}from"./session-table-B4JOKevn.js";import{u as Ze,T as Pt}from"./TerminalRelay-lJ2KdMCW.js";import{u as $e,L as Qe}from"./usePersistentState-DOEahRlt.js";import{q as _t}from"./terminal-takeover-CtA3wcXh.js";import{t as $t}from"./time-Dhsh_2EG.js";import{B as ue}from"./BackToPicker-CqYhOaLB.js";import{T as Ft}from"./TmuxPeek-BSeKIjnX.js";import{R as es}from"./refresh-cw-IgN2fZLM.js";import{c as $s}from"./createLucideIcon-DLlxGjKt.js";import{P as Z}from"./plus-64n9qucr.js";import{T as U}from"./terminal-BiNIXhna.js";import{Z as Kt}from"./zap-rw7uwZht.js";import{S as Ut}from"./text-BR9Bap0E.js";import{X as pe}from"./x-BJyPzFnn.js";import{E as Bt}from"./eye-BeCSqJn1.js";import{E as Fs}from"./external-link-BGHC_naA.js";import"./provider-CX9EWecp.js";import"./router-B0YclXYg.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./sse-CSozY6mp.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-D4vuKzOL.js";import"./DocumentFocusViewer-DmtFisY9.js";import"./TextDocumentSurface-C7fGlzY8.js";import"./file-text-BVhkMWyC.js";import"./chevron-right-BMqtBds_.js";import"./code-xml-ByQsfOI_.js";import"./arrow-left-i-h6JAgs.js";import"./arrow-right-B0Yi01Zr.js";import"./scout-voice-DvG_3stJ.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-7iEtvu9P.js";import"./NewChatComposer-Bgqes0UQ.js";import"./conversation-model-CigSPlKA.js";import"./index-DFdlQs_c.js";import"./HarnessMark-DGZ6o6Ct.js";import"./NewChatOrigin-DpHS2Wmt.js";import"./chevron-down-Da5tV19_.js";import"./search-BbgsEMXa.js";import"./loader-circle-DoT8gpw6.js";import"./chunk-HRAB3GC3-BUVYXXAp.js";import"./check-Bfs7hMb1.js";import"./copy-De4s38o2.js";/* empty css */import"./voice-levels-Dcr3jglk.js";const Ks=6,Us=2;function Re(s){if(s.layout?.mode)return{mode:s.layout.mode,...s.layout.columns===void 0?{}:{columns:Ht(s.layout.columns)}};const t=s.cellCount??0,r=We(s.columns??Us);return t<=1?{mode:"solo"}:r>=t?{mode:"lanes",columns:r}:{mode:"grid",columns:r}}function Ee(s,t){const r=Math.max(1,Math.floor(t.tileCount)||1);if(s.mode==="solo")return 1;if(s.columns===void 0||s.columns==="dynamic"){const i=s.mode==="lanes"?r:Math.ceil(Math.sqrt(r));return Math.max(1,Math.min(Ks,i))}return We(s.columns)}function Ht(s){return s==="dynamic"?"dynamic":We(s)}function qt(s){if(s.mode==="solo")return"Solo";const t=s.mode==="lanes"?"Lanes":"Grid";return s.columns===void 0||s.columns==="dynamic"?`${t} · dynamic`:`${t} · ${s.columns} column${s.columns===1?"":"s"}`}function We(s){return typeof s!="number"||!Number.isFinite(s)?Us:Math.max(1,Math.min(Ks,Math.floor(s)))}const Vt=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Yt=$s("ellipsis",Vt);const Gt=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],de=$s("grid-2x2",Gt),ss=6;function Jt(s="main",t="Main"){return{version:1,activeWorkspaceId:s,workspaces:[{id:s,name:t,tiles:[]}]}}function ts(){return{version:1,activeWorkspaceId:"",workspaces:[]}}function xs(s,t,r={}){const i=()=>r.allowEmpty?ts():Jt();if(!s||typeof s!="object")return i();const l=s;if(!Array.isArray(l.workspaces))return i();const m=[],d=new Set;for(const c of l.workspaces){if(!c||typeof c!="object")continue;const x=typeof c.id=="string"?c.id.trim():"",y=typeof c.name=="string"?c.name.trim():"";if(!x||!y||d.has(x)||!Array.isArray(c.tiles))continue;d.add(x);const S=typeof c.purpose=="string"?c.purpose.trim():"",w=Zt(c.columns),A=Xt(c.layout),M=typeof c.updatedAt=="number"&&Number.isFinite(c.updatedAt)&&c.updatedAt>=0?c.updatedAt:null;m.push({id:x,name:y,tiles:c.tiles.filter(t),...S?{purpose:S}:{},...w?{columns:w}:{},...A?{layout:A}:{},...M===null?{}:{updatedAt:M}})}return m.length===0?i():{version:1,activeWorkspaceId:typeof l.activeWorkspaceId=="string"&&d.has(l.activeWorkspaceId)?l.activeWorkspaceId:m[0].id,workspaces:m}}function Xt(s){if(!s||typeof s!="object")return null;const t=s;if(t.mode!=="solo"&&t.mode!=="lanes"&&t.mode!=="grid")return null;if(t.columns===void 0)return{mode:t.mode};if(t.columns==="dynamic")return{mode:t.mode,columns:"dynamic"};const r=We(t.columns);return{mode:t.mode,columns:r}}function Zt(s){if(typeof s!="number"||!Number.isFinite(s))return null;const t=Math.floor(s);return t<1?null:Math.min(t,ss)}function ys(s,t){const r=t.id.trim();if(!r)return s;const i={...t,id:r},m=s.workspaces.some(d=>d.id===r)?s.workspaces.map(d=>d.id===r?i:d):[i,...s.workspaces];return{...s,activeWorkspaceId:r,workspaces:m}}function js(s,t,r){const i=s.workspaces.findIndex(f=>f.id===t);if(i<0)return s;const l=s.workspaces[i],m={...l,...r};return Object.keys(r).every(f=>l[f]===m[f])?s:{...s,workspaces:s.workspaces.map((f,c)=>c===i?m:f)}}function Qt(s,t){return t===s.activeWorkspaceId||!s.workspaces.some(r=>r.id===t)?s:{...s,activeWorkspaceId:t}}function en(s,t,r={}){if(s.workspaces.length<=1)return r.allowEmpty&&s.workspaces[0]?.id===t?ts():s;const i=s.workspaces.findIndex(d=>d.id===t);if(i<0)return s;const l=s.workspaces.filter(d=>d.id!==t),m=s.activeWorkspaceId===t?l[Math.min(i,l.length-1)].id:s.activeWorkspaceId;return{...s,activeWorkspaceId:m,workspaces:l}}function sn(s,t,r){return r>1?{axis:"horizontal",edge:s.x<t.left+t.width/2?"before":"after"}:{axis:"vertical",edge:s.y<t.top+t.height/2?"before":"after"}}function tn(s,t,r,i){if(t===r)return[...s];const l=s.findIndex(y=>y.id===t),m=s.findIndex(y=>y.id===r);if(l<0||m<0)return[...s];const d=[...s],[f]=d.splice(l,1);if(!f)return[...s];const c=d.findIndex(y=>y.id===r),x=i==="after"?c+1:c;return d.splice(Math.max(0,x),0,f),d}const nn="openscout.terminal.workspaces.v1",rn=2,an="openscout.terminal.workspace-view.v1",Fe=2;function ve(s){const t=typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);return`${s}-${Date.now().toString(36)}-${t}`}const on=24;function Bs(s,t,r){const i=t.replace(/[^A-Za-z0-9_-]+/gu,"-").replace(/^[^A-Za-z0-9_]+/u,"").slice(0,on).replace(/-+$/u,""),l=ln(JSON.stringify([r,t,s]));return`scout-${s}-${i||"cell"}-${l}`}function ln(s){let t=2166136261;for(let r=0;r<s.length;r+=1)t^=s.charCodeAt(r),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}function oe(s,t="shell"){return{id:ve("cell"),kind:"fresh",backend:s,agent:t}}function gs(s){if(!s||typeof s!="object")return!1;const t=s;return typeof t.id!="string"||!t.id.trim()?!1:t.kind==="fresh"?typeof t.backend=="string"&&typeof t.agent=="string":t.kind==="registered"?typeof t.terminalSessionId=="string"&&typeof t.terminalSurfaceKey=="string":!1}function Ss(s){return{id:s.id,name:s.name,...s.purpose?{purpose:s.purpose}:{},columns:s.columns,...s.layout?{layout:s.layout}:{},updatedAt:s.updatedAt,tiles:s.cells.map(t=>t.surfaceId&&t.terminalSessionId?{id:t.id,kind:"registered",terminalSessionId:t.terminalSessionId,terminalSurfaceKey:t.surfaceId}:{id:t.id,kind:"fresh",backend:dn(t.intent.hostId)?t.intent.hostId:"pty",agent:"shell"})}}function Ke(s,t={}){return{id:s.id,name:s.name,purpose:s.purpose??"",columns:Ee(Re({layout:s.layout,columns:s.columns,cellCount:s.tiles.length}),{tileCount:s.tiles.length}),layout:Re({layout:s.layout,columns:s.columns,cellCount:s.tiles.length}),cells:s.tiles.map(r=>r.kind==="registered"?{id:r.id,surfaceId:r.terminalSurfaceKey,terminalSessionId:r.terminalSessionId,intent:cn(r,t.sessions??[])}:{id:r.id,intent:{hostId:r.backend,sessionName:r.backend==="pty"?null:Bs(r.backend,r.id,s.id)}})}}function cn(s,t){const r=Ms(s.terminalSurfaceKey),i=t.find(l=>l.id===s.terminalSessionId||l.surfaces.some(m=>St(m,s.terminalSurfaceKey)));return{...r?{hostId:r.backend,sessionName:r.hostSession}:{},...i?.cwd?{cwd:i.cwd}:{},...i?.harness?{harness:i.harness}:{},...i?.resumeCommand?{resumeCommand:i.resumeCommand}:{}}}function dn(s){return s==="pty"||s==="tmux"||s==="zellij"||s==="herdr"}function mn(s){if(!Array.isArray(s))return xs(s,gs,{allowEmpty:!0});const t=s.flatMap(r=>{if(!r||typeof r!="object")return[];const i=r;if(typeof i.id!="string"||!i.id.trim())return[];const l=Array.isArray(i.cells)?i.cells:[];return[{id:i.id,name:typeof i.name=="string"&&i.name.trim()?i.name:i.id,purpose:i.purpose,columns:i.columns,updatedAt:i.updatedAt,tiles:l.map((m,d)=>({...m,id:`${i.id}-${d}`}))}]});return xs({activeWorkspaceId:t[0]?.id??"",workspaces:t},gs,{allowEmpty:!0})}function un(s,t,r){const i=s.find(l=>l.id===t);return i?i.capabilities.control.includes(r)||i.capabilities.harnessControl.includes(r):!1}function pn(s,t){return s.find(r=>r.id===t)??null}function hn(s){return[{value:"pty",label:"Shell",detail:"Disposable local shell",relayAttach:!0},...s.filter(t=>t.availability.installed&&t.capabilities.create).map(t=>({value:t.id,label:t.label,detail:t.description,relayAttach:t.capabilities.relayAttach})).sort((t,r)=>Number(r.relayAttach)-Number(t.relayAttach)||t.value.localeCompare(r.value))]}async function fn(){return me("/api/terminal-workspaces")}async function ws(s){return(await me(`/api/terminal-workspaces/${encodeURIComponent(s.id)}`,{method:"PUT",body:JSON.stringify(s)})).workspace}async function kn(s,t){return me(`/api/terminal-workspaces/${encodeURIComponent(s)}/cells/${encodeURIComponent(t)}/revive`,{method:"POST",body:"{}"})}async function bn(s){return(await me(`/api/terminal-workspaces/${encodeURIComponent(s)}`,{method:"DELETE"})).deleted}function xn(s){const t=new Map;for(const r of s?.cells??[])t.set(r.cellId,r);return t}const Ns="scout:terminal-send-line";function yn(s){const t=s.detail;if(!t||typeof t!="object"||!("line"in t))return null;const r=t.line;return typeof r=="string"&&r.trim().length>0?r:null}const le=typeof window>"u"?o.useEffect:o.useLayoutEffect,jn="openscout.terminal.picker-view.v1",Cs={mode:"grid",columns:"dynamic"},vs=[{mode:"solo",label:"Solo",detail:"One terminal, full width",minimumCells:1},{mode:"lanes",label:"Lanes",detail:"Side by side, one row",minimumCells:2},{mode:"grid",label:"Grid",detail:"Rows and columns",minimumCells:4}],gn=[{value:"shell",label:"Shell"},{value:"codex",label:"Codex"},{value:"claude",label:"Claude"},{value:"pi",label:"Pi"}],Ue="'JetBrainsMono Nerd Font', 'JetBrainsMonoNL Nerd Font', 'MesloLGS Nerd Font Mono', 'Hack Nerd Font Mono', 'JetBrains Mono', monospace",Ts=s=>{},Sn=()=>{};function wn(){if(typeof window>"u")return{fontFamily:Ue,fontSize:13};const s=new URLSearchParams(window.location.search),t=s.get("terminalFontFamily")?.trim(),r=Number(s.get("terminalFontSize"));return{fontFamily:t?`'${t.replaceAll("'","\\'")}', ${Ue}`:Ue,fontSize:Number.isFinite(r)&&r>=9&&r<=32?r:13}}function ns(s){const t=wn();return e.jsx(Pt,{...s,renderer:s.renderer??"dom",fontFamily:t.fontFamily,fontSize:t.fontSize})}function Nn(s,t){const[r,i]=o.useState({state:"loading",sessions:[]}),l=o.useCallback(()=>{i(d=>({state:"loading",sessions:d.sessions})),Ls({includeDiscovered:!0}).then(d=>{i({state:"ready",sessions:d})}).catch(d=>{i(f=>({state:"failed",sessions:f.sessions,error:d instanceof Error?d.message:String(d)}))})},[]);return o.useEffect(()=>{l()},[l]),{target:o.useMemo(()=>zs(r.sessions,s,t),[r.sessions,s,t]),loadState:r.state,loadSessions:l,hasSessionHint:!!s}}function Cn(s,t,r){const i=bt(t,r),[l,m]=o.useState(i?{state:"preparing"}:{state:"ready"}),[d,f]=o.useState(0);return o.useEffect(()=>{if(!i||!s){m({state:"ready"});return}let c=!1;return m({state:"preparing"}),me(`/api/agents/${encodeURIComponent(s)}/session-catalog`).then(x=>{if(x.resumeCommand)return _t({command:x.resumeCommand,cwd:x.resumeCwd,agentId:s})}).then(()=>{c||m({state:"ready"})}).catch(x=>{c||m({state:"failed",error:x instanceof Error?x.message:String(x)})}),()=>{c=!0}},[s,i,d]),{ready:l.state==="ready",label:l.state==="failed"?"TAKEOVER FAILED":"PREPARING TAKEOVER",status:l.state==="failed"?l.error:"Resolving live session...",onRetry:l.state==="failed"?()=>f(c=>c+1):void 0}}function vn(s){const{agentId:t,agent:r,mode:i,navigate:l,registeredTarget:m,showContextMenu:d}=s,{hosts:f}=Xe(),c=r?Ws(r.name):"var(--accent)",x=o.useRef(null),y=m?Ps(m.surface):Te(r),S=i==="observe",w=m?.session.cwd??r?.cwd??r?.projectRoot??void 0,A=Ve(),M=Ye(),h=xt({agentId:t,agent:r,registeredTarget:m,terminalSurface:y,relayUrl:A,harness:m?.session.harness??r?.harness,cwd:w,mode:i}),j=Ze({url:h.scopedRelayUrl,healthUrl:M,autoConnect:!0,...S?{}:{sessionKey:h.relayStorageSessionKey},...h.surfaceOptions??{},...h.orphanTTL?{orphanTTL:h.orphanTTL}:{},...h.cwd?{cwd:h.cwd}:{},...h.relayAgent?{agent:h.relayAgent}:{},controlMode:h.controlMode});le(()=>{j.resize(Ge,Je)},[j.resize]);const C=o.useMemo(()=>S?{...j,sendInput:Ts,sendLine:Ts,restart:Sn}:j,[S,j]),v=yt({agentId:t,registeredTarget:m}),z=Ie(v,i),R=o.useCallback(()=>{const b=x.current;b?.querySelector(".xterm-helper-textarea")?.focus(),b?.querySelector(".xterm")?.focus()},[]);o.useEffect(()=>{const b=_=>{const $=_.detail?.line;return typeof $=="string"&&$.length>0?$:null},O=_=>{const $=b(_);!$||S||(C.sendInput($),R())},D=_=>{const $=b(_);!$||S||(C.sendLine($),R())};return window.addEventListener("scout:terminal-send-input",O),window.addEventListener("scout:terminal-send-line",D),()=>{window.removeEventListener("scout:terminal-send-input",O),window.removeEventListener("scout:terminal-send-line",D)}},[R,S,C]);const E=o.useCallback(b=>y?jt(y,b):null,[y]),W=o.useCallback(()=>{bs(As(z))},[z]),H=o.useCallback(()=>{S||!navigator.clipboard?.readText||navigator.clipboard.readText().then(b=>{b&&C.sendInput(b)}).catch(()=>{})},[S,C]),B=o.useCallback(()=>{Ce(h.relayStorageSessionKey);const b=E("detach");if(b){b.finally(()=>j.disconnect());return}j.disconnect()},[h.relayStorageSessionKey,j,E]),k=o.useCallback(()=>{Ce(h.relayStorageSessionKey);const b=E("force-quit-bridge");if(b){b.finally(()=>{j.connect(),window.setTimeout(R,250)});return}j.connect(),window.setTimeout(R,250)},[h.relayStorageSessionKey,R,j,E]),N=o.useCallback(()=>{if(S)return;const b=E("interrupt");b?b.catch(()=>C.sendInput("")):C.sendInput(""),R()},[R,S,E,C]),L=o.useCallback(()=>{if(S)return;const b=E("quit");b?b.catch(()=>C.sendInput("")):C.sendInput(""),R()},[R,S,E,C]),K=o.useCallback(()=>{if(S)return;const b=E("stop-job");if(b){b.finally(R);return}R()},[R,S,E]),ne=o.useCallback(()=>{if(Ce(h.relayStorageSessionKey),y&&!window.confirm(`Force quit Claude in ${He(y.sessionName)}?`))return;const b=E("force-quit");if(b){b.finally(()=>j.disconnect());return}const O=j.sessionId;if(!O){j.disconnect();return}gt(O).catch(()=>{}).finally(()=>j.disconnect())},[h.relayStorageSessionKey,j,E,y]),re=o.useCallback(()=>{if(!y||!window.confirm(`Restart Claude in ${He(y.sessionName)} and resume its latest session?`))return;Ce(h.relayStorageSessionKey);const b=E("restart-resume");b&&b.finally(()=>{j.disconnect(),window.setTimeout(()=>{j.connect(),window.setTimeout(R,250)},600)})},[h.relayStorageSessionKey,R,j,E,y]),ae=o.useCallback(b=>{l(Ie(v,b))},[l,v]),Q=o.useCallback(()=>{l(v)},[l,v]),ee=o.useMemo(()=>{const b=y?.backend??null,O=$=>un(f,b,$),D=[];(!b||O("detach"))&&D.push({kind:"action",label:"Leave this session running",onSelect:B}),D.push({kind:"action",label:"Reconnect",onSelect:k});const _=[];return O("restart-resume")&&_.push({kind:"action",label:"Restart Claude and resume",onSelect:re}),O("force-quit")&&_.push({kind:"action",label:"Force quit Claude",onSelect:ne}),_.length>0&&D.push({kind:"separator"},..._),D},[B,ne,k,re,f,y?.backend]),he=o.useCallback(b=>{d(b,ee)},[ee,d]),se=o.useCallback(b=>{const O=typeof window>"u"?"":window.getSelection()?.toString()??"",D=[];O.trim()&&D.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>{bs(O)}}),S||D.push({kind:"action",label:"Paste",shortcut:"⌘V",onSelect:H},{kind:"action",label:"Send Ctrl-C",shortcut:"⌃C",onSelect:N},{kind:"action",label:"Quit With Ctrl-D",shortcut:"⌃D",onSelect:L},{kind:"action",label:"Stop Running Job",onSelect:K}),D.length>0&&D.push({kind:"separator"}),D.push({kind:"action",label:"Focus Terminal",onSelect:R},...ee,{kind:"separator"},{kind:"action",label:S?"Open Takeover":"Open Observe",onSelect:()=>ae(S?"takeover":"observe")},{kind:"action",label:"Open Summary",onSelect:Q},{kind:"action",label:"Copy Terminal Link",onSelect:W}),d(b,D)},[W,R,N,ae,Q,H,L,S,ee,d,K]);return{color:c,terminalBodyRef:x,terminalSurface:y,readOnly:S,relay:j,terminalRelay:C,healthUrl:M,scopedRelayUrl:h.scopedRelayUrl,hasViewActions:!!(m||y),canSignalTerminal:!S&&!!(y||j.status==="connected"),canStopTerminalJob:!S&&!!y,handleSessionMenu:he,handleTerminalContextMenu:se,openMode:ae,openSummary:Q,interruptTerminal:N,quitTerminal:L,stopTerminalJob:K,terminalRouteBase:v}}function Tn({agent:s,agentId:t,color:r,navigate:i,label:l,status:m,onRetry:d}){return e.jsxs("div",{className:"s-term",children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:i,className:"s-term-back"}),s&&e.jsxs("div",{className:"s-term-agent",children:[e.jsx("div",{className:"s-ops-avatar",style:{"--size":"18px",background:r},children:s.name[0]?.toUpperCase()}),e.jsx("span",{className:"s-term-agent-name",children:s.name}),s.handle&&e.jsxs("span",{className:"s-term-agent-handle",children:["@",s.handle]})]}),e.jsx("span",{className:"s-term-label",children:l}),e.jsx("div",{className:"s-term-status",children:d?"OFFLINE":"CONNECTING"})]}),e.jsx("div",{className:"s-term-body s-term-body--placeholder",children:e.jsxs("div",{className:"s-term-placeholder",children:[e.jsx("span",{children:m}),d&&e.jsx("button",{type:"button",onClick:d,children:"Retry"})]})})]})}function In({target:s,navigate:t}){const r=o.useMemo(()=>Ds([s.session]).find(d=>F(d.surface)===F(s.surface)),[s]),i={view:"terminal",terminalSessionId:s.session.id,terminalSurfaceKey:F(s.surface)},l=Nt(s.session,s.surface),m=Ct(s);return e.jsx("div",{className:"s-term s-term--summary",children:e.jsxs("div",{className:"s-term-summary",children:[e.jsxs("div",{className:"s-term-summary-main",children:[e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:t,className:"s-term-back"}),e.jsxs("div",{className:"s-term-summary-mark",children:[e.jsx(U,{size:18,strokeWidth:1.7}),e.jsx("span",{children:"Terminal"})]}),e.jsxs("div",{className:"s-term-summary-heading",children:[e.jsx("h1",{children:r?.title??s.surface.sessionName}),e.jsxs("p",{children:[s.surface.backend," · ",l]})]}),e.jsxs("div",{className:"s-term-summary-actions",children:[e.jsxs("button",{type:"button",className:"s-term-summary-action s-term-summary-action--primary",onClick:()=>t(Ie(i,"takeover")),children:[e.jsx(Qe,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Enter"})]}),e.jsxs("button",{type:"button",className:"s-term-summary-action",onClick:()=>t(Ie(i,"observe")),children:[e.jsx(Bt,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Observe"})]})]})]}),e.jsx("div",{className:"s-term-summary-preview",children:e.jsx(Ft,{surface:Ps(s.surface),lines:26,columns:112,pollMs:3e4,idlePollMs:3e4,className:"s-term-preview-peek"})}),e.jsx("dl",{className:"s-term-summary-details",children:m.map(([d,f])=>e.jsxs("div",{className:"s-term-summary-detail",children:[e.jsx("dt",{children:d}),e.jsx("dd",{title:f,children:f})]},d))})]})})}function rs({agentId:s,agent:t,mode:r,navigate:i,registeredTarget:l,embedded:m=!1,tileActions:d}){const f=Es(),c=vn({agentId:s,agent:t,mode:r,navigate:i,registeredTarget:l,showContextMenu:f});return e.jsxs("div",{className:`s-term${m?" s-term--embedded":""}`,children:[e.jsxs("div",{className:"s-term-bar s-term-bar--takeover",children:[e.jsxs("div",{className:"s-term-bar-left",children:[!m&&e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:i,className:"s-term-back"}),t&&e.jsxs("div",{className:"s-term-agent",children:[e.jsx("div",{className:"s-ops-avatar",style:{"--size":"18px",background:c.color},children:t.name[0]?.toUpperCase()}),e.jsx("span",{className:"s-term-agent-name",children:t.name}),t.handle&&e.jsxs("span",{className:"s-term-agent-handle",children:["@",t.handle]})]}),l&&e.jsxs("div",{className:"s-term-registered-chip",children:[e.jsx(U,{size:14,strokeWidth:1.8}),e.jsx("span",{children:l.session.harness}),e.jsx("span",{children:l.session.sourceSessionId})]})]}),e.jsxs("div",{className:"s-term-bar-meta",children:[e.jsx("span",{className:"s-term-label",children:c.terminalSurface?c.readOnly?"TERMINAL OBSERVE":"TERMINAL TAKEOVER":"TAKEOVER"}),c.terminalSurface&&e.jsx("span",{className:"s-term-session",title:c.terminalSurface.sessionName,children:He(c.terminalSurface.sessionName)})]}),e.jsxs("div",{className:"s-term-bar-actions",children:[c.hasViewActions&&e.jsxs("div",{className:"s-term-action-cluster s-term-action-cluster--view","aria-label":"Terminal view actions",children:[l&&e.jsx("button",{type:"button",className:"s-term-action",onClick:c.openSummary,title:"Leave the terminal canvas and show the session summary",children:"Summary"}),c.terminalSurface&&e.jsx("button",{type:"button",className:"s-term-action",onClick:()=>c.openMode(c.readOnly?"takeover":"observe"),title:c.readOnly?"Switch to interactive takeover":"Switch to read-only terminal observe",children:c.readOnly?"Takeover":"Observe"})]}),(c.canSignalTerminal||c.canStopTerminalJob)&&e.jsxs("div",{className:"s-term-action-cluster s-term-action-cluster--signals","aria-label":"Terminal signal actions",children:[c.canSignalTerminal&&e.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:c.interruptTerminal,title:"Send Ctrl-C to the terminal",children:[e.jsx(Kt,{size:13,strokeWidth:1.8}),e.jsx("span",{children:"Ctrl-C"})]}),c.canSignalTerminal&&e.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:c.quitTerminal,title:"Send Ctrl-D / EOF to the terminal",children:[e.jsx(Dt,{size:13,strokeWidth:1.8}),e.jsx("span",{children:"Quit"})]}),c.canStopTerminalJob&&e.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:c.stopTerminalJob,title:"Stop Claude's current shell/tool job without quitting Claude",children:[e.jsx(Ut,{size:12,strokeWidth:2}),e.jsx("span",{children:"Stop Job"})]})]}),e.jsxs("button",{type:"button",className:"s-term-action s-term-session-menu",onClick:c.handleSessionMenu,title:"Open session, recovery, and external handoff actions",children:[e.jsx(Yt,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Session"})]}),e.jsx("div",{className:"s-term-status",children:c.relay.status==="connected"?"LIVE":c.relay.status==="connecting"?"CONNECTING":"OFFLINE"}),d]})]}),e.jsx("div",{ref:c.terminalBodyRef,className:"s-term-body",onContextMenuCapture:c.handleTerminalContextMenu,children:e.jsx(ns,{relay:c.terminalRelay,readOnly:c.readOnly,quiet:!0,configItems:[...c.terminalSurface?[{label:"backend",value:c.terminalSurface.backend},{label:"session",value:c.terminalSurface.sessionName},...c.terminalSurface.paneId?[{label:"pane",value:c.terminalSurface.paneId}]:[],...c.terminalSurface.socketDir?[{label:"socket",value:c.terminalSurface.socketDir}]:[],{label:"mode",value:c.readOnly?"read-only":"takeover"}]:[],{label:"ws",value:c.scopedRelayUrl},{label:"health",value:c.healthUrl}]})})]})}function Rn({terminalSessionId:s,terminalSurfaceKey:t,mode:r,navigate:i}){const{target:l,loadState:m,loadSessions:d,hasSessionHint:f}=Nn(s,t);return l&&r?e.jsx(rs,{agent:null,mode:r,navigate:i,registeredTarget:l},`${F(l.surface)}:${r}`):l?e.jsx(In,{target:l,navigate:i}):e.jsx("div",{className:"s-term s-term--empty-main",children:e.jsxs("div",{className:"s-term-empty-main-mark",children:[e.jsx(U,{size:18,strokeWidth:1.6}),e.jsx("span",{children:m==="loading"?"Loading terminal":m==="failed"?"Terminal list unavailable":f?"Terminal unavailable":"Select a terminal"}),m==="failed"&&e.jsx("button",{type:"button",className:"s-term-empty-action",onClick:d,children:"Retry"})]})})}function En(s,t){return s.kind!=="fresh"||!s.sessionName?!1:t.some(r=>r.surfaces.some(i=>i.backend===s.backend&&i.sessionName===s.sessionName&&i.state!=="exited"))}function ce(s){return`${s.session.id}:${F(s.surface)}`}function Wn(s,t,r){if(s.kind==="fresh")return{id:s.id,kind:"fresh",backend:s.backend,agent:s.agent,...s.backend==="pty"?{}:{sessionName:Bs(s.backend,s.id,r)}};const i=zs(t,s.terminalSessionId,s.terminalSurfaceKey);return i?{id:s.id,kind:"registered",target:i}:{id:s.id,kind:"unavailable",terminalSessionId:s.terminalSessionId,terminalSurfaceKey:s.terminalSurfaceKey}}function G(s){return{session:s.session,surface:s.surface}}function An(s){const t=s.backend;return t!=="pty"&&!Os(t)?null:{view:"terminal",terminalBackend:t,terminalAgent:s.agent,terminalTabId:s.id,...s.sessionName?{terminalSessionName:s.sessionName}:{},...s.zellijSocketDir?{zellijSocketDir:s.zellijSocketDir}:{}}}function Mn(s,t="takeover"){return{view:"terminal",terminalSessionId:s.session.id,terminalSurfaceKey:F(s.surface),mode:t}}function Hs(s,t){if(typeof window>"u"){t(s);return}window.open(As(s),"_blank","noopener,noreferrer")}function Ln({navigate:s}){const{agents:t}=Rs(),r=Es(),{hosts:i}=Xe(),l=o.useMemo(()=>hn(i),[i]),[m,d]=$e(nn,ts(),{version:rn,migrate:mn}),[f,c]=$e(an,"library"),x=o.useRef(new Map),[y,S]=o.useState(null),[w,A]=o.useState(""),[M,h]=o.useState(""),[j,C]=o.useState(Cs),[v,z]=o.useState(()=>Array.from({length:4},()=>oe("pty"))),[R,E]=o.useState(0),[W,H]=o.useState({state:"loading",sessions:[]}),[B,k]=o.useState(0),[N,L]=o.useState(!0),[K,ne]=$e(jn,"list"),[re,ae]=o.useState(Mt),[Q,ee]=o.useState([]),[he,se]=o.useState(null),[b,O]=o.useState(null),[D,_]=o.useState(null),[$,is]=o.useState(!1),[fe,os]=o.useState(null),[Vs,Ae]=o.useState(null),ke=o.useRef(null),be=o.useRef(null),xe=o.useRef("after"),ye=o.useRef(null),je=o.useRef(null),Me=o.useRef(!1),q=o.useCallback((n={})=>{n.silent||H(a=>({state:"loading",sessions:a.sessions})),Ls({includeDiscovered:!0}).then(a=>H({state:"ready",sessions:a})).catch(a=>{n.silent||H(u=>({state:"failed",sessions:u.sessions,error:a instanceof Error?a.message:String(a)}))})},[]);o.useEffect(()=>{q()},[q]),o.useEffect(()=>{const n=()=>{document.visibilityState==="visible"&&q({silent:!0})},a=window.setInterval(n,8e3);return window.addEventListener("focus",n),document.addEventListener("visibilitychange",n),()=>{window.clearInterval(a),window.removeEventListener("focus",n),document.removeEventListener("visibilitychange",n)}},[q]),o.useEffect(()=>{let n=!1;return fn().then(a=>{if(!n){ee(a.resolutions);for(const u of a.workspaces)x.current.set(u.id,JSON.stringify(Ke(Ss(u),{sessions:W.sessions})));a.workspaces.length!==0&&d(u=>{let p=u;for(const g of a.workspaces)p=ys(p,Ss(g));return{...p,activeWorkspaceId:u.activeWorkspaceId||p.activeWorkspaceId}})}}).catch(()=>{}),()=>{n=!0}},[d]);const ge=o.useMemo(()=>Ds(W.sessions),[W.sessions]),V=o.useMemo(()=>ge.filter(n=>n.surface.state!=="exited"),[ge]),Le=o.useMemo(()=>{const n=new Set,a=[];for(const u of ge)u.surface.backend!=="herdr"||n.has(u.surface.sessionName)||(n.add(u.surface.sessionName),a.push(G(u)));return a},[ge]);o.useMemo(()=>Kn(t),[t]);const ls=W.state==="failed"?W.error:null,Ys=m.workspaces,T=m.workspaces.find(n=>n.id===m.activeWorkspaceId)??null,te=Re({layout:T?.layout,columns:T?.columns,cellCount:T?.tiles.length??0}),Y=o.useMemo(()=>(T?.tiles??[]).map(n=>Wn(n,W.sessions,T?.id??"")),[T?.id,T?.tiles,W.sessions]),De=Ee(te,{tileCount:Y.length});o.useEffect(()=>{if(!T||!x.current.has(T.id))return;const n=Ke(T,{sessions:W.sessions}),a=JSON.stringify(n);x.current.get(T.id)!==a&&(x.current.set(T.id,a),ws(n).catch(u=>se(u instanceof Error?u.message:String(u))))},[T,W.sessions]);const cs=f==="workspace"&&!T?"library":f,P=o.useCallback(n=>{d(a=>{const u=a.workspaces.find(g=>g.id===a.activeWorkspaceId);if(!u)return a;const p=n(u.tiles);return p===u.tiles?a:js(a,u.id,{tiles:p,updatedAt:Date.now()})})},[d]),Se=o.useCallback(n=>{d(a=>a.activeWorkspaceId?js(a,a.activeWorkspaceId,{layout:n,updatedAt:Date.now()}):a)},[d]),Gs=o.useCallback(n=>{d(a=>Qt(a,n.id)),L(!1),c("workspace")},[d,c]),Js=o.useCallback(()=>{c("library")},[c]),ie=o.useCallback(n=>{S(n?.id??null),A(n?.name??""),h(n?.purpose??""),C(n?Re({layout:n.layout,columns:n.columns,cellCount:n.tiles.length}):Cs),z(n?.tiles??Array.from({length:4},()=>oe("pty"))),E(0),c("builder")},[c]),Xs=o.useCallback(n=>{C(a=>n.mode==="solo"?{mode:"solo"}:{mode:n.mode,columns:a.columns??"dynamic"}),z(a=>a.length>=n.minimumCells?a:[...a,...Array.from({length:n.minimumCells-a.length},()=>oe("pty"))]),E(a=>Math.max(0,Math.min(a,n.minimumCells-1)))},[]),Zs=o.useCallback(n=>{C(a=>a.mode==="solo"?{mode:"lanes",columns:n}:{...a,columns:n})},[]),Qs=o.useCallback(()=>{z(n=>{const a=[...n,oe("pty")];return E(a.length-1),a})},[]),et=o.useCallback(n=>{z(a=>{if(a.length<=1)return a;const u=a.filter((p,g)=>g!==n);return E(p=>Math.min(p,u.length-1)),u})},[]),st=o.useCallback(()=>{const n=w.trim();if(!n)return;const a={id:y??ve("workspace"),name:n,purpose:M.trim(),columns:Ee(j,{tileCount:v.length}),layout:j,tiles:v,updatedAt:Date.now()};d(p=>ys(p,a));const u=Ke(a,{sessions:W.sessions});x.current.set(a.id,JSON.stringify(u)),ws(u).catch(p=>se(p instanceof Error?p.message:String(p))),L(!1),c("workspace")},[y,d,c,W.sessions,v,j,w,M]),tt=o.useCallback(n=>{d(a=>en(a,n,{allowEmpty:!0})),bn(n).catch(()=>{})},[d]),ds=o.useCallback((n,a="shell")=>{P(u=>[...u,oe(n,a)])},[P]),J=o.useCallback((n,a)=>{const u={kind:"registered",terminalSessionId:n.session.id,terminalSurfaceKey:F(n.surface)};P(p=>{const g=p.some(I=>I.kind==="registered"&&I.terminalSessionId===u.terminalSessionId&&Be(I.terminalSurfaceKey,u.terminalSurfaceKey));return a?p.some(I=>I.id===a)?p.map(I=>I.id===a?{...u,id:I.id}:I):p:g?p:[...p,{...u,id:ve("cell")}]})},[P]),nt=o.useCallback(n=>{J(n)},[J]),ze=o.useMemo(()=>new Set(Y.filter(n=>n.kind==="registered").map(n=>ce(n.target))),[Y]),rt=o.useCallback(n=>{const a=Le.length>0?Le.map(u=>{const p=ze.has(ce(u)),g=u.surface.state==="live"?"running":"detached";return{kind:"action",label:`${u.surface.sessionName} · ${g}${p?" · in grid":""}`,onSelect:()=>J(u)}}):[{kind:"action",label:"No herdr sessions discovered",onSelect:()=>{}}];r(n,a)},[Le,ze,J,r]),we=o.useCallback(n=>{n?.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId),ye.current=null,je.current=null,Me.current=!1,O(null),_(null),is(!1)},[]),at=o.useCallback((n,a)=>{const u=n.target;n.button!==0||u instanceof Element&&u.closest("button, a")||(ye.current={pointerId:n.pointerId,target:G(a),targetId:ce(G(a)),startX:n.clientX,startY:n.clientY},n.currentTarget.setPointerCapture(n.pointerId))},[]),it=o.useCallback(n=>{const a=ye.current;if(!a||a.pointerId!==n.pointerId||Math.hypot(n.clientX-a.startX,n.clientY-a.startY)<6&&!b)return;b||O(a.targetId);const p=document.querySelector(".s-term--workspace");if(p){const ks=p.getBoundingClientRect();n.clientY<ks.top+72&&(p.scrollTop-=28),n.clientY>ks.bottom-72&&(p.scrollTop+=28)}const g=document.elementFromPoint(n.clientX,n.clientY),I=g?.closest(".s-term-workspace-cell"),X=!!(g?.closest(".s-term-workspace-add-cell")||!I&&g?.closest(".s-term--workspace")&&!g?.closest(".s-term-picker")),fs=X?null:I?.dataset.terminalTileId??null;je.current=fs,Me.current=X,_(fs),is(X)},[b]),ot=o.useCallback(n=>{const a=ye.current;!a||a.pointerId!==n.pointerId||(Me.current?J(a.target):je.current&&J(a.target,je.current),we(n))},[we,J]),lt=o.useCallback(n=>{we(n)},[we]),ct=o.useCallback(()=>{const n=V.map(G);n.length!==0&&P(a=>{const u=a.filter(g=>g.kind==="registered"),p=n.filter(g=>!u.some(I=>I.kind==="registered"&&I.terminalSessionId===g.session.id&&Be(I.terminalSurfaceKey,F(g.surface)))).map(g=>({id:ve("cell"),kind:"registered",terminalSessionId:g.session.id,terminalSurfaceKey:F(g.surface)}));return p.length===0?a:[...a,...p]})},[V,P]),Oe=o.useCallback(n=>{P(a=>{const u=a.filter(p=>p.id!==n);return u.length===a.length?a:u})},[P]),ms=o.useCallback((n,a,u)=>{n!==a&&P(p=>tn(p,n,a,u))},[P]),Pe=o.useCallback((n,a)=>{P(u=>{const p=u.findIndex(X=>X.id===n),g=p+a;if(p<0||g<0||g>=u.length)return u;const I=[...u];return[I[p],I[g]]=[I[g],I[p]],I})},[P]),us=o.useCallback((n,a)=>{P(u=>u.map(p=>p.id===n?{id:p.id,kind:"fresh",backend:a,agent:"shell"}:p))},[P]),Ne=o.useCallback(()=>[...vs.map(n=>({kind:"action",label:n.label,onSelect:()=>Se(n.mode==="solo"?{mode:"solo"}:{mode:n.mode,columns:te.columns??"dynamic"})})),...te.mode==="solo"?[]:[{kind:"separator"},{kind:"action",label:"Dynamic columns",onSelect:()=>Se({...te,columns:"dynamic"})},...Array.from({length:ss},(n,a)=>({kind:"action",label:a===0?"One column":`${a+1} columns`,onSelect:()=>Se({...te,columns:a+1})}))],{kind:"separator"},{kind:"action",label:"Edit workspace…",onSelect:()=>T&&ie(T)}],[T,Se,ie,te]),dt=o.useCallback(n=>{r(n,Ne())},[Ne,r]),mt=o.useCallback((n,a)=>{const u=Y.findIndex(g=>g.id===a.id),p=[];u>0&&p.push({kind:"action",label:"Move left",onSelect:()=>Pe(a.id,-1)}),u>=0&&u<Y.length-1&&p.push({kind:"action",label:"Move right",onSelect:()=>Pe(a.id,1)}),p.length>0&&p.push({kind:"separator"}),p.push(...l.map(g=>({kind:"action",label:g.value==="pty"?"Replace with a disposable shell":`Replace with a session that survives (${g.label})`,onSelect:()=>us(a.id,g.value)})),{kind:"separator"},{kind:"action",label:"Remove cell",onSelect:()=>Oe(a.id)},{kind:"separator"},...Ne()),r(n,p)},[Oe,Ne,Pe,us,r,l,Y]),ut=o.useCallback((n,a)=>{const u=n.target;n.button===0&&u instanceof Element&&u.closest(".s-term-bar")&&!u.closest("button, a")&&(ke.current={pointerId:n.pointerId,tileId:a,startX:n.clientX,startY:n.clientY},n.currentTarget.setPointerCapture(n.pointerId))},[]),pt=o.useCallback(n=>{const a=ke.current;if(!a||a.pointerId!==n.pointerId||Math.hypot(n.clientX-a.startX,n.clientY-a.startY)<6&&!fe)return;fe||os(a.tileId);const p=document.elementFromPoint(n.clientX,n.clientY)?.closest(".s-term-workspace-cell"),g=p?.dataset.terminalTileId??null;if(!p||!g||g===a.tileId){be.current=null,xe.current="after",Ae(null);return}const I=p.getBoundingClientRect(),X=sn({x:n.clientX,y:n.clientY},{left:I.left,top:I.top,width:I.width,height:I.height},De);be.current=g,xe.current=X.edge,Ae(g)},[fe,De]),ps=o.useCallback(n=>{const a=ke.current;if(!a||a.pointerId!==n.pointerId)return;const u=be.current;u&&ms(a.tileId,u,xe.current),n.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId),ke.current=null,be.current=null,xe.current="after",os(null),Ae(null)},[ms]),ht=o.useMemo(()=>xn(Q.find(n=>n.workspaceId===T?.id)),[T?.id,Q]),hs=o.useCallback(n=>{ae(a=>Lt(a,n))},[]),ft=o.useCallback(()=>{q(),k(n=>n+1)},[q]),kt=o.useCallback(n=>{T&&kn(T.id,n).then(()=>{se(null),q()}).catch(a=>se(a instanceof Error?a.message:String(a)))},[T,q]);return cs==="library"?e.jsx(Dn,{workspaces:Ys,sessionsReady:W.state!=="loading",onOpen:Gs,onCreate:()=>ie(),onEdit:ie,onDelete:tt}):cs==="builder"?e.jsx(On,{editing:!!y,name:w,purpose:M,modes:vs,layout:j,startOptions:l,cells:v,selectedSlot:R,terminalItems:V,onNameChange:A,onPurposeChange:h,onApplyMode:Xs,onColumnsChange:Zs,onSelectSlot:E,onAddCell:Qs,onRemoveCell:et,pickerView:K,pickerSort:re,onPickerView:ne,onPickerSort:hs,onAssignFresh:(n,a="shell")=>z(u=>u.map((p,g)=>g===R?{id:p.id,kind:"fresh",backend:n,agent:a}:p)),onAssignRegistered:n=>z(a=>a.map((u,p)=>p===R?{id:u.id,kind:"registered",terminalSessionId:n.session.id,terminalSurfaceKey:F(n.surface)}:u)),onCancel:()=>{c(T?"workspace":"library")},onSave:st}):e.jsx("div",{className:"s-term s-term--workspace",children:e.jsxs("div",{className:"s-term-workspace",children:[e.jsxs("header",{className:"s-term-workspace-head",children:[e.jsxs("div",{className:"s-term-workspace-title",children:[e.jsxs("span",{className:"s-term-summary-mark",children:[e.jsx(de,{size:18,strokeWidth:1.7}),e.jsxs("span",{children:["Workspaces / ",T?.name??"Workspace"]})]}),e.jsx("h1",{children:T?.name??"Workspace"}),T?.purpose&&e.jsx("p",{children:T.purpose})]}),e.jsxs("div",{className:"s-term-workspace-actions","aria-label":"Terminal workspace actions",children:[e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:Js,children:e.jsx("span",{children:"All workspaces"})}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>T&&ie(T),children:[e.jsx(de,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Edit workspace"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:()=>ds("pty"),title:"Add a shell tile",children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Shell"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>ds("pty","codex"),title:"Add a Codex TUI tile",children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Codex"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:rt,title:"Add a herdr session's layout as a tile",children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Herdr"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:()=>L(n=>!n),title:N?"Hide terminal picker":"Show terminal picker","aria-pressed":N,children:[e.jsx(U,{size:14,strokeWidth:1.8}),e.jsx("span",{children:N?"Hide picker":"Show picker"})]}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:ft,disabled:W.state==="loading",title:"Reload all terminal tiles","aria-label":"Reload all terminal tiles",children:e.jsx(es,{size:14,strokeWidth:1.8})})]})]}),ls&&e.jsxs("div",{className:"s-term-home-error",children:[e.jsx("span",{children:"Terminal registry unavailable"}),e.jsx("code",{children:ls})]}),he&&e.jsxs("div",{className:"s-term-home-error",children:[e.jsx("span",{children:"This workspace is not saved to Scout — it will not follow you to another device"}),e.jsx("code",{children:he})]}),(Y.length>0||N)&&e.jsxs("div",{className:"s-term-workspace-grid","aria-label":"Terminal tiles",style:{"--terminal-grid-columns":De},onContextMenu:dt,children:[Y.map(n=>e.jsx("div",{className:`s-term-workspace-cell${fe===n.id?" s-term-workspace-cell--dragging":""}${Vs===n.id||D===n.id?" s-term-workspace-cell--drop-target":""}`,"data-terminal-tile-id":n.id,onPointerDownCapture:a=>ut(a,n.id),onPointerMove:pt,onPointerUp:ps,onPointerCancel:ps,onContextMenu:a=>mt(a,n),children:e.jsx(_n,{tile:n,navigate:s,onClose:Oe,resolution:ht.get(n.id)??null,onRevive:kt,live:En(n,W.sessions)})},`${n.id}:${B}`)),N&&e.jsxs("button",{type:"button",className:`s-term-workspace-add-cell${$?" s-term-workspace-add-cell--target":""}`,onClick:()=>L(!0),children:[e.jsx(Z,{size:20,strokeWidth:1.7}),e.jsx("strong",{children:"New slot"}),e.jsx("span",{children:b?"Drop to add":"Drag a terminal here"})]})]}),e.jsxs("section",{className:`s-term-picker${N?"":" s-term-picker--collapsed"}`,"aria-labelledby":"terminal-picker-title",onPointerDownCapture:n=>{const a=n.target;if(!(a instanceof Element))return;const u=a.closest("[data-picker-item-id]")?.dataset.pickerItemId,p=V.find(g=>g.id===u);p&&at(n,p)},onPointerMove:it,onPointerUp:ot,onPointerCancel:lt,children:[e.jsxs("header",{className:"s-term-picker-head",children:[e.jsxs("div",{className:"s-term-picker-title",children:[e.jsx(U,{size:14,strokeWidth:1.8}),e.jsx("h2",{id:"terminal-picker-title",children:"Terminal picker"}),e.jsx("span",{children:W.state==="loading"?"syncing":V.length})]}),e.jsxs("div",{className:"s-term-picker-actions",children:[N&&e.jsx("div",{className:"s-term-picker-views",role:"group","aria-label":"Picker view",children:["list","table"].map(n=>e.jsx("button",{type:"button",className:K===n?"is-selected":"",onClick:()=>ne(n),"aria-pressed":K===n,children:n==="list"?"List":"Table"},n))}),N&&e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:ct,disabled:V.length===0,children:[e.jsx(Qe,{size:13,strokeWidth:1.8}),e.jsx("span",{children:"Attach all"})]}),e.jsxs("button",{type:"button",className:"s-term-picker-toggle",onClick:()=>L(n=>!n),"aria-expanded":N,children:[e.jsx("span",{children:N?"Hide":"Show terminal picker"}),e.jsx("span",{"aria-hidden":"true",children:N?"⌄":"⌃"})]})]})]}),N&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"s-term-picker-hint",children:"Drag a terminal onto a cell to place it, or onto New slot to grow the grid."}),V.length===0&&W.state!=="loading"?e.jsx("div",{className:"s-term-picker-empty",children:"No live terminals"}):e.jsx(qs,{items:V,view:K,sort:re,attachedIds:ze,draggedTargetId:b,onSort:hs,onAttach:nt,navigate:s})]})]})]})})}function Dn({workspaces:s,sessionsReady:t,onOpen:r,onCreate:i,onEdit:l,onDelete:m}){return e.jsx("div",{className:"s-term s-term--workspace-library",children:e.jsxs("main",{className:"s-term-workspace-library",children:[e.jsxs("header",{className:"s-term-workspace-library-head",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"s-term-summary-mark",children:[e.jsx(de,{size:18,strokeWidth:1.7}),e.jsx("span",{children:"Terminals"})]}),e.jsx("h1",{children:"Workspaces"}),e.jsx("p",{children:"Saved terminal layouts for projects, roles, and cross-project operations."})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:i,children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"New workspace"})]})]}),s.length===0?e.jsxs("section",{className:"s-term-workspace-library-empty",children:[e.jsx(de,{size:24,strokeWidth:1.5}),e.jsx("h2",{children:"Create your first terminal workspace"}),e.jsx("p",{children:"Choose a layout, give it a purpose, place sessions, then enter the grid."}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:i,children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Create workspace"})]})]}):e.jsx("div",{className:"s-term-workspace-library-grid",children:s.map(d=>e.jsxs("article",{className:"s-term-workspace-card",children:[e.jsx("div",{className:"s-term-workspace-card-preview",style:{"--terminal-grid-columns":d.columns??Fe},children:d.tiles.map(f=>e.jsx("span",{className:f.kind==="registered"?"is-session":"is-shell"},f.id))}),e.jsxs("div",{className:"s-term-workspace-card-copy",children:[e.jsxs("span",{children:[d.columns??Fe," column",(d.columns??Fe)===1?"":"s"," · ",d.tiles.length," cells"]}),e.jsx("h2",{children:d.name}),e.jsx("p",{children:d.purpose||"No purpose added yet."})]}),e.jsxs("div",{className:"s-term-workspace-card-actions",children:[e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:()=>l(d),children:"Edit"}),e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:()=>m(d.id),children:"Delete"}),e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>r(d),disabled:!t,children:"Enter workspace"})]})]},d.id))})]})})}function qe(s,t){return s==="solo"?1:s==="lanes"?Math.max(2,Math.min(4,t)):Math.max(2,Math.min(3,t))}function zn(s,t){return s==="solo"?1:s==="lanes"?qe(s,t):qe(s,t)*2}function On({editing:s,name:t,purpose:r,modes:i,layout:l,startOptions:m,cells:d,selectedSlot:f,terminalItems:c,onNameChange:x,onPurposeChange:y,onApplyMode:S,onColumnsChange:w,onSelectSlot:A,onAddCell:M,onRemoveCell:h,pickerView:j,pickerSort:C,onPickerView:v,onPickerSort:z,onAssignFresh:R,onAssignRegistered:E,onCancel:W,onSave:H}){const B=Ee(l,{tileCount:d.length});return e.jsx("div",{className:"s-term s-term--workspace-builder",children:e.jsxs("main",{className:"s-term-workspace-builder",children:[e.jsxs("header",{className:"s-term-workspace-builder-head",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"s-term-summary-mark",children:[e.jsx(de,{size:18,strokeWidth:1.7}),e.jsx("span",{children:"Workspace builder"})]}),e.jsx("h1",{children:s?"Edit workspace":"Create a workspace"}),e.jsx("p",{children:"Define the job, choose the grid, and place the sessions before entering."})]}),e.jsxs("div",{className:"s-term-workspace-builder-actions",children:[e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:W,children:"Cancel"}),e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:H,disabled:!t.trim(),children:s?"Save and enter":"Create and enter"})]})]}),e.jsxs("section",{className:"s-term-workspace-builder-identity","aria-label":"Workspace identity",children:[e.jsxs("label",{children:[e.jsx("span",{children:"Name"}),e.jsx("input",{value:t,onChange:k=>x(k.target.value),placeholder:"Release desk",autoFocus:!0})]}),e.jsxs("label",{children:[e.jsx("span",{children:"Purpose"}),e.jsx("input",{value:r,onChange:k=>y(k.target.value),placeholder:"Cross-project release monitoring"})]})]}),e.jsxs("section",{className:"s-term-workspace-builder-layout","aria-labelledby":"workspace-layout-title",children:[e.jsxs("div",{className:"s-term-workspace-builder-section-head",children:[e.jsxs("div",{children:[e.jsx("span",{children:"Step 1"}),e.jsx("h2",{id:"workspace-layout-title",children:"Choose the layout"})]}),e.jsxs("p",{children:[qt(l)," · ",d.length," cell",d.length===1?"":"s"]})]}),e.jsx("div",{className:"s-term-grid-presets","aria-label":"Workspace layout",children:i.map(k=>e.jsxs("button",{type:"button",className:`s-term-grid-preset${k.mode===l.mode?" s-term-grid-preset--selected":""}`,onClick:()=>S(k),"aria-pressed":k.mode===l.mode,children:[e.jsx("span",{className:"s-term-grid-preset-map",style:{"--terminal-preset-columns":qe(k.mode,B)},"aria-hidden":"true",children:Array.from({length:zn(k.mode,B)},(N,L)=>e.jsx("i",{},L))}),e.jsx("span",{className:"s-term-grid-preset-label",children:k.label}),e.jsx("span",{className:"s-term-grid-preset-detail",children:k.detail})]},k.mode))}),l.mode!=="solo"&&e.jsxs("div",{className:"s-term-workspace-builder-columns",role:"group","aria-label":"Columns",children:[e.jsx("span",{children:"Columns"}),e.jsx("button",{type:"button",className:l.columns==="dynamic"||l.columns===void 0?"is-selected":"",onClick:()=>w("dynamic"),"aria-pressed":l.columns==="dynamic"||l.columns===void 0,title:"Fit the columns to the number of tiles",children:"Dynamic"}),Array.from({length:ss},(k,N)=>e.jsx("button",{type:"button",className:l.columns===N+1?"is-selected":"",onClick:()=>w(N+1),"aria-pressed":l.columns===N+1,children:N+1},N)),(l.columns==="dynamic"||l.columns===void 0)&&e.jsxs("em",{children:[B," right now"]})]})]}),e.jsxs("section",{className:"s-term-workspace-builder-placement","aria-labelledby":"workspace-placement-title",children:[e.jsxs("div",{className:"s-term-workspace-builder-section-head",children:[e.jsxs("div",{children:[e.jsx("span",{children:"Step 2"}),e.jsx("h2",{id:"workspace-placement-title",children:"Place terminals"})]}),e.jsx("p",{children:"Select a cell, then choose a session or shell. Add as many cells as the work needs."})]}),e.jsxs("div",{className:"s-term-workspace-builder-canvas",children:[e.jsxs("div",{className:"s-term-workspace-builder-grid",style:{"--terminal-grid-columns":B},children:[d.map((k,N)=>{const L=k.kind==="registered"?c.find(K=>K.session.id===k.terminalSessionId&&Be(F(K.surface),k.terminalSurfaceKey)):null;return e.jsxs("div",{className:`s-term-workspace-builder-cell${f===N?" is-selected":""}`,children:[e.jsxs("button",{type:"button",className:"s-term-workspace-builder-cell-select",onClick:()=>A(N),"aria-pressed":f===N,children:[e.jsx("span",{children:String(N+1).padStart(2,"0")}),e.jsx(U,{size:17,strokeWidth:1.7}),e.jsx("strong",{children:k.kind==="registered"?L?.title??"Unavailable session":as(k.backend,k.agent).title}),e.jsx("small",{children:k.kind==="registered"?L?.cwdLabel||L?.detail:k.backend})]}),d.length>1&&e.jsx("button",{type:"button",className:"s-term-workspace-builder-cell-remove",onClick:()=>h(N),title:"Remove this cell","aria-label":`Remove cell ${N+1}`,children:e.jsx(pe,{size:13,strokeWidth:1.9})})]},k.id)}),e.jsxs("button",{type:"button",className:"s-term-workspace-builder-cell s-term-workspace-builder-cell--add",onClick:M,children:[e.jsx(Z,{size:18,strokeWidth:1.7}),e.jsx("strong",{children:"Add cell"})]})]}),e.jsxs("aside",{className:"s-term-workspace-builder-source",children:[e.jsxs("span",{children:["Cell ",String(f+1).padStart(2,"0")]}),e.jsx("h3",{children:"Start something new"}),e.jsxs("div",{className:"s-term-workspace-builder-source-actions",children:[gn.map(k=>e.jsx("button",{type:"button",onClick:()=>R("pty",k.value),children:k.label},k.value)),m.filter(k=>k.value!=="pty").map(k=>e.jsxs("button",{type:"button",onClick:()=>R(k.value,"shell"),title:k.relayAttach?k.detail:`${k.detail} — Scout starts it; open it in ${k.label} to use it`,children:[k.label,!k.relayAttach&&e.jsx("sup",{"aria-label":"opens outside Scout",children:" ↗"})]},k.value))]}),e.jsxs("div",{className:"s-term-workspace-builder-source-head",children:[e.jsx("h3",{children:"Or use a live session"}),e.jsx("div",{className:"s-term-picker-views",role:"group","aria-label":"Session picker view",children:["list","table"].map(k=>e.jsx("button",{type:"button",className:j===k?"is-selected":"",onClick:()=>v(k),"aria-pressed":j===k,children:k==="list"?"List":"Table"},k))})]}),e.jsx("div",{className:"s-term-workspace-builder-sessions",children:c.length===0?e.jsx("span",{className:"s-term-workspace-builder-no-sessions",children:"No live sessions"}):e.jsx(qs,{items:c,view:j,sort:C,attachedIds:new Set,draggedTargetId:null,onSort:z,onAttach:k=>{const N=c.find(L=>L.session.id===k.session.id&&L.surface.sessionName===k.surface.sessionName);N&&E(N)}})})]})]})]})]})})}function Pn({item:s,attached:t,dragging:r,onAttach:i,onOpen:l}){return e.jsxs("article",{className:`s-term-picker-item${t?" s-term-picker-item--attached":""}${r?" s-term-picker-item--dragging":""}`,"data-picker-item-id":s.id,children:[e.jsx("span",{className:"s-term-picker-grip","aria-hidden":"true",children:"⠿"}),e.jsxs("div",{className:"s-term-picker-item-main",children:[e.jsx("strong",{title:s.surface.sessionName,children:s.title}),e.jsx("span",{title:s.session.cwd??s.detail,children:s.cwdLabel||s.detail})]}),e.jsxs("div",{className:"s-term-picker-item-meta",children:[e.jsx("span",{children:s.surface.backend}),e.jsx("span",{children:_s(s)}),e.jsx("span",{title:s.session.cwd??void 0,children:s.project})]}),l&&e.jsx("button",{type:"button",className:"s-term-picker-add",onClick:l,children:"Open"}),e.jsx("button",{type:"button",className:"s-term-picker-add",onClick:()=>i(G(s)),disabled:t,children:t?"In grid":"Add"})]})}function qs({items:s,view:t,sort:r,attachedIds:i,draggedTargetId:l,onSort:m,onAttach:d,navigate:f}){const c=o.useMemo(()=>_e(s,r),[s,r]),{managed:x,regular:y}=o.useMemo(()=>wt(s),[s]),S=o.useMemo(()=>_e(x,r),[x,r]),w=o.useMemo(()=>_e(y,r),[y,r]),A=h=>{f?.({view:"terminal",terminalSessionId:h.session.id,terminalSurfaceKey:F(h.surface)})},M=(h,j)=>{const C=ce(G(h));return e.jsx(Pn,{item:h,attached:i.has(C),dragging:l===C,onAttach:d,onOpen:j&&f?()=>A(h):void 0},h.id)};return t==="table"?e.jsx("div",{className:"s-term-picker-table-wrap",children:e.jsxs("table",{className:"s-term-picker-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[zt.map(h=>e.jsx("th",{scope:"col","aria-sort":r.column===h.id?r.direction==="asc"?"ascending":"descending":"none",children:e.jsxs("button",{type:"button",onClick:()=>m(h.id),children:[e.jsx("span",{children:h.label}),e.jsx("em",{"aria-hidden":"true",children:r.column===h.id?r.direction==="asc"?"▲":"▼":"·"})]})},h.id)),e.jsx("th",{scope:"col","aria-label":"Place"})]})}),e.jsx("tbody",{children:c.map(h=>{const j=ce(G(h)),C=Ot(h);return e.jsxs("tr",{"data-picker-item-id":h.id,className:i.has(j)?"is-attached":void 0,children:[e.jsx("td",{title:h.surface.sessionName,children:h.title}),e.jsx("td",{children:h.surface.backend}),e.jsx("td",{children:_s(h)}),e.jsx("td",{title:h.session.cwd??void 0,children:h.project}),e.jsx("td",{children:C?$t(C):"—"}),e.jsx("td",{children:e.jsx("button",{type:"button",className:"s-term-picker-add",onClick:()=>d(G(h)),disabled:i.has(j),children:i.has(j)?"In grid":"Add"})})]},h.id)})})]})}):e.jsxs("div",{className:"s-term-picker-list","aria-label":"Available terminals",children:[S.length>0&&e.jsxs("section",{className:"s-term-picker-group","aria-label":"Managed sessions",children:[e.jsx("h3",{className:"s-term-picker-group-title",children:"Managed sessions"}),S.map(h=>M(h,!0))]}),S.length>0&&w.length>0?e.jsxs("section",{className:"s-term-picker-group","aria-label":"Terminals",children:[e.jsx("h3",{className:"s-term-picker-group-title",children:"Terminals"}),w.map(h=>M(h,!1))]}):w.map(h=>M(h,!1))]})}function _n({tile:s,navigate:t,onClose:r,resolution:i,onRevive:l,live:m=!1}){if(s.kind==="registered")return s.target.surface.backend==="herdr"?e.jsx(Is,{tileId:s.id,backend:"herdr",sessionName:s.target.surface.sessionName,live:s.target.surface.state==="live",onClose:r,navigate:t}):e.jsx(Fn,{tile:s,navigate:t,onClose:r});if(s.kind==="unavailable"){const d=i?.status==="revivable"&&!!l;return e.jsxs("section",{className:"s-term-workspace-tile s-term-workspace-tile--unavailable","aria-label":"Unavailable terminal session",children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsxs("div",{className:"s-term-bar-left",children:[e.jsx("span",{className:"s-term-workspace-tile-mark",children:e.jsx(U,{size:14,strokeWidth:1.8})}),e.jsx("span",{className:"s-term-workspace-tile-name",children:"Not running"})]}),e.jsx("div",{className:"s-term-bar-actions",children:e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>r(s.id),title:"Remove cell","aria-label":"Remove cell",children:e.jsx(pe,{size:14,strokeWidth:1.8})})})]}),e.jsxs("div",{className:"s-term-workspace-unavailable-body",children:[e.jsx(U,{size:22,strokeWidth:1.5}),e.jsx("strong",{children:d?"This tile is not running.":"This saved session is not currently live."}),e.jsx("span",{children:i?.detail??"Show the terminal picker to replace it, or wait for the session to reconnect."}),d&&e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>l?.(s.id),children:"Start it again"})]})]})}return!Os(s.backend)&&s.backend!=="pty"?e.jsx(Is,{tileId:s.id,backend:s.backend,sessionName:s.sessionName,live:m,onClose:r,navigate:t}):e.jsx($n,{tile:s,navigate:t,onClose:r})}function Is({tileId:s,backend:t,sessionName:r,live:i,onClose:l,navigate:m}){const{hosts:d}=Xe(),f=pn(d,t),[c,x]=o.useState("idle"),[y,S]=o.useState(null),w=t==="herdr",{topology:A}=It(w?r??null:null,{enabled:w&&i}),M=o.useCallback(()=>{r&&(x("starting"),S(null),Rt(t,{sessionName:r}).then(()=>x("idle")).catch(v=>{x("failed"),S(v instanceof Error?v.message:String(v))}))},[t,r]),h=o.useCallback(()=>{if(!m||!r)return;const v=vt(t,r);v&&m({view:"terminal",terminalSurfaceKey:v})},[m,t,r]),j=o.useCallback(()=>{!m||!r||m(Et(r))},[m,r]),C=w&&A?.running?A.workspaces.flatMap(v=>v.tabs):[];return e.jsxs("section",{className:"s-term-workspace-tile s-term-workspace-tile--hosted","aria-label":`${f?.label??t} session`,children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsxs("div",{className:"s-term-bar-left",children:[e.jsx("span",{className:"s-term-workspace-tile-mark",children:e.jsx(U,{size:14,strokeWidth:1.8})}),e.jsx("span",{className:"s-term-workspace-tile-name",children:f?.label??t})]}),e.jsxs("div",{className:"s-term-bar-meta",children:[e.jsx("span",{className:"s-term-label",children:i?"running":"not running"}),r&&e.jsx("span",{className:"s-term-session",title:r,children:r})]}),e.jsxs("div",{className:"s-term-bar-actions",children:[w&&i&&r&&m&&e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:j,title:"Enter — open a live web terminal attached to this session","aria-label":"Enter — open a live web terminal attached to this session",children:e.jsx(Qe,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>l(s),title:"Remove cell","aria-label":"Remove cell",children:e.jsx(pe,{size:14,strokeWidth:1.8})})]})]}),C.length>0?e.jsx("button",{type:"button",className:"s-term-workspace-hosted-body s-term-workspace-hosted-body--link",onClick:h,children:C.map(v=>{const z=Wt(v);return e.jsxs("span",{className:"s-term-workspace-hosted-tab",children:[e.jsx("span",{className:"s-term-workspace-hosted-tab-dots",children:z.statuses.map((R,E)=>e.jsx(At,{status:R},`${v.tabId}:${E}`))}),e.jsx("span",{className:"s-term-workspace-hosted-tab-label",children:z.label}),e.jsx("span",{className:"s-term-workspace-hosted-tab-count",children:z.statuses.length})]},v.tabId)})}):e.jsxs("div",{className:"s-term-workspace-unavailable-body",children:[e.jsx(U,{size:22,strokeWidth:1.5}),e.jsx("strong",{children:i?`Running in ${f?.label??t}`:"Not running yet"}),e.jsx("span",{children:i?`Scout keeps this session for you. Open it in ${f?.label??t} to use it.`:`Scout can start a ${f?.label??t} session and keep it for you.`}),!i&&e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:M,disabled:c==="starting"||!r,children:c==="starting"?"Starting…":"Start it"}),y&&e.jsx("code",{children:y})]})]})}function $n({tile:s,navigate:t,onClose:r}){const i=o.useRef(null),l=Ve(),m=Ye(),d=as(s.backend,s.agent),f=An(s),c=["scout-terminal-workspace",s.id,s.backend,s.agent,s.sessionName??"pty"].join("-"),x=Ze({url:l,healthUrl:m,autoConnect:!0,sessionKey:c,backend:s.backend,...s.sessionName?{terminalSession:s.sessionName}:{},...s.backend==="tmux"&&s.sessionName?{tmuxSession:s.sessionName}:{},...s.backend==="zellij"&&s.sessionName?{zellijSession:s.sessionName}:{},...s.backend==="zellij"&&s.zellijSocketDir?{zellijSocketDir:s.zellijSocketDir}:{},...s.backend==="herdr"&&s.sessionName?{tmuxSession:s.sessionName}:{},agent:s.agent,controlMode:"takeover"});le(()=>{x.resize(Ge,Je)},[x.resize]);const y=o.useCallback(()=>{f&&Hs(f,t)},[t,f]);return e.jsx("section",{className:"s-term-workspace-tile","aria-label":d.title,children:e.jsxs("div",{className:"s-term s-term--embedded",children:[e.jsxs("div",{className:"s-term-bar s-term-bar--fresh",children:[e.jsxs("div",{className:"s-term-bar-left",children:[e.jsx("span",{className:"s-term-workspace-tile-mark",children:e.jsx(U,{size:14,strokeWidth:1.8})}),e.jsx("span",{className:"s-term-workspace-tile-name",children:d.title})]}),e.jsxs("div",{className:"s-term-bar-meta",children:[e.jsx("span",{className:"s-term-label",children:s.backend}),e.jsx("span",{className:"s-term-session",children:d.detail})]}),e.jsxs("div",{className:"s-term-bar-actions",children:[e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:()=>x.restart(),title:"Restart terminal","aria-label":"Restart terminal",children:e.jsx(es,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:y,title:"Open terminal in a new window","aria-label":"Open terminal in a new window",children:e.jsx(Fs,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>r(s.id),title:"Close tile","aria-label":"Close tile",children:e.jsx(pe,{size:14,strokeWidth:1.8})})]})]}),e.jsx("div",{ref:i,className:"s-term-body",onMouseDown:()=>{i.current?.querySelector(".xterm-helper-textarea")?.focus(),i.current?.querySelector(".xterm")?.focus()},children:e.jsx(ns,{relay:x,quiet:!0,configItems:[{label:"backend",value:s.backend},{label:"agent",value:s.agent},...s.sessionName?[{label:"session",value:s.sessionName}]:[],...s.zellijSocketDir?[{label:"socket",value:s.zellijSocketDir}]:[],{label:"ws",value:l},{label:"health",value:m}]})})]})})}function Fn({tile:s,navigate:t,onClose:r}){const i=o.useCallback(()=>{Hs(Mn(s.target),t)},[t,s.target]);return e.jsx("section",{className:"s-term-workspace-tile","aria-label":s.target.surface.sessionName,children:e.jsx(rs,{agent:null,mode:"takeover",navigate:t,registeredTarget:s.target,embedded:!0,tileActions:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:i,title:"Open terminal in a new window","aria-label":"Open terminal in a new window",children:e.jsx(Fs,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>r(s.id),title:"Close tile","aria-label":"Close tile",children:e.jsx(pe,{size:14,strokeWidth:1.8})})]})})})}function Kn(s){return[...s].filter(t=>!t.retiredFromFleet).sort((t,r)=>{const i=+!!Te(r)-+!!Te(t);if(i!==0)return i;const l=(r.updatedAt??0)-(t.updatedAt??0);return l!==0?l:t.name.localeCompare(r.name)})}function Un({route:s,navigate:t}){const r=o.useRef(null),i=s.terminalBackend??"pty",l=s.terminalAgent??"shell",m=s.terminalTabId??"adhoc",d=i==="pty"?void 0:`scout-${i}-${m}`,f=s.terminalSessionName??d,c=Ve(),x=Ye(),y=as(i,l),S=["scout-terminal-new",i,l,f??m].join("-"),w=Ze({url:c,healthUrl:x,autoConnect:!0,sessionKey:S,backend:i,...f?{terminalSession:f}:{},...i==="tmux"&&f?{tmuxSession:f}:{},...i==="zellij"&&f?{zellijSession:f}:{},...i==="zellij"&&s.zellijSocketDir?{zellijSocketDir:s.zellijSocketDir}:{},...i==="herdr"&&f?{tmuxSession:f}:{},agent:l,controlMode:"takeover"}),A=o.useRef([]),M=o.useRef({status:w.status,sendLine:w.sendLine});return M.current={status:w.status,sendLine:w.sendLine},le(()=>{const h=j=>{const C=yn(j);if(!C)return;const v=M.current;if(v.status==="connected"){v.sendLine(C);return}A.current=[...A.current.slice(-15),C]};return window.addEventListener(Ns,h),()=>window.removeEventListener(Ns,h)},[]),le(()=>{if(w.status!=="connected"||A.current.length===0)return;const h=A.current;A.current=[];for(const j of h)w.sendLine(j)},[w.sendLine,w.status]),le(()=>{w.resize(Ge,Je)},[w.resize]),e.jsxs("div",{className:"s-term",children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:t,className:"s-term-back"}),e.jsx("span",{className:"s-term-label",children:y.title}),e.jsx("div",{className:"s-term-status",children:y.detail}),e.jsx("div",{className:"s-term-actions",children:e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:()=>w.restart(),title:"Restart terminal","aria-label":"Restart terminal",children:e.jsx(es,{size:14,strokeWidth:1.8})})})]}),e.jsx("div",{ref:r,className:"s-term-body",onMouseDown:()=>{r.current?.querySelector(".xterm-helper-textarea")?.focus(),r.current?.querySelector(".xterm")?.focus()},children:e.jsx(ns,{relay:w,quiet:!0,configItems:[{label:"backend",value:i},{label:"agent",value:l},...f?[{label:"session",value:f}]:[],...s.zellijSocketDir?[{label:"socket",value:s.zellijSocketDir}]:[],{label:"ws",value:c},{label:"health",value:x}]})})]})}function as(s,t){const r=t==="shell"?"Shell":t==="codex"?"Codex":t==="pi"?"Pi":"Claude";return s==="pty"?{title:r,detail:"fresh PTY tab"}:{title:`${r} ${s}`,detail:`fresh ${s} backed tab`}}function Bn({agentId:s,agent:t,mode:r,navigate:i,children:l}){const m=Cn(s,t,r);return m.ready?e.jsx(e.Fragment,{children:l}):e.jsx(Tn,{agent:t,agentId:s,color:Ws(t.name),navigate:i,label:m.label,status:m.status,onRetry:m.onRetry})}function Hn({navigate:s}){return e.jsx("div",{className:"s-term",children:e.jsxs("div",{className:"s-term-bar",children:[e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:s,className:"s-term-back"}),e.jsx("span",{className:"s-term-label",children:"Terminal"}),e.jsx("div",{className:"s-term-status",children:"Resolving agent..."})]})})}function qn({route:s,navigate:t}){const{agentId:r,mode:i,terminalSessionId:l,terminalSurfaceKey:m}=s,{agents:d}=Rs();if(s.terminalBackend)return e.jsx(Un,{route:s,navigate:t});const f=s.terminalSurfaceKey?Ms(s.terminalSurfaceKey):null;if(!r&&f?.backend==="herdr")return e.jsx(Tt,{sessionName:f.hostSession,navigate:t});if(!r)return!l&&!m?e.jsx(Ln,{navigate:t}):e.jsx(Rn,{terminalSessionId:l,terminalSurfaceKey:m,mode:i,navigate:t});const c=d.find(S=>S.id===r)??null;if(!c)return e.jsx(Hn,{navigate:t});const x=Te(c),y=x?`${x.backend}:${c.id}:${x.sessionName}:${i??"takeover"}`:`takeover:${r}:${i??"takeover"}`;return e.jsx(Bn,{agentId:r,agent:c,mode:i,navigate:t,children:e.jsx(rs,{agentId:r,agent:c,mode:i,navigate:t})},y)}function Yr({agentId:s,mode:t,terminalSessionId:r,terminalSurfaceKey:i,navigate:l}){const m={view:"terminal",agentId:s,mode:t,terminalSessionId:r,terminalSurfaceKey:i};return e.jsx(qn,{route:m,navigate:l})}export{qn as TerminalContent,Yr as TerminalScreen};
@@ -0,0 +1 @@
1
+ import{r as e,j as l,a as A,b as C,S as k}from"./index-Bli6bTLU.js";import{L as y,D as T,f as L,S as x,C as R}from"./Provider-Ve8yXaWR.js";import{a as P}from"./api-DEHEgJ9m.js";import{i as I}from"./colors-BtO5_zlx.js";import{r as j,a as D}from"./router-B0YclXYg.js";import{TerminalContent as H}from"./Terminal-Dr-M9U4u.js";import"./provider-CX9EWecp.js";import"./sse-CSozY6mp.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-D4vuKzOL.js";import"./DocumentFocusViewer-DmtFisY9.js";import"./createLucideIcon-DLlxGjKt.js";import"./TextDocumentSurface-C7fGlzY8.js";import"./file-text-BVhkMWyC.js";import"./x-BJyPzFnn.js";import"./chevron-right-BMqtBds_.js";import"./code-xml-ByQsfOI_.js";import"./arrow-left-i-h6JAgs.js";import"./arrow-right-B0Yi01Zr.js";import"./scout-voice-DvG_3stJ.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-7iEtvu9P.js";import"./NewChatComposer-Bgqes0UQ.js";import"./text-BR9Bap0E.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-DoT8gpw6.js";import"./conversation-model-CigSPlKA.js";import"./time-Dhsh_2EG.js";import"./index-DFdlQs_c.js";import"./HarnessMark-DGZ6o6Ct.js";import"./NewChatOrigin-DpHS2Wmt.js";import"./chevron-down-Da5tV19_.js";import"./search-BbgsEMXa.js";import"./chunk-HRAB3GC3-BUVYXXAp.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-D4dHTRkt.js";/* empty css */import"./clipboard-e3fSpeo7.js";import"./terminal-relay-pSm7_An6.js";import"./HerdrSession-DV2hD6Yh.js";import"./usePersistentState-DOEahRlt.js";import"./terminal-BiNIXhna.js";import"./refresh-cw-IgN2fZLM.js";import"./check-Bfs7hMb1.js";import"./copy-De4s38o2.js";import"./eye-BeCSqJn1.js";import"./session-table-B4JOKevn.js";import"./TerminalRelay-lJ2KdMCW.js";import"./terminal-takeover-CtA3wcXh.js";import"./BackToPicker-CqYhOaLB.js";import"./TmuxPeek-BSeKIjnX.js";/* empty css */import"./plus-64n9qucr.js";import"./zap-rw7uwZht.js";import"./external-link-BGHC_naA.js";function g(){const t=new URLSearchParams(window.location.search).get("route")?.trim()||"/terminal",s=j(t);return s.view==="terminal"?s:{view:"terminal"}}function S(o){const t=new URLSearchParams(window.location.search);return t.set("route",D(o)),t.has("profile")||t.set("profile","macos.terminal"),`${window.location.pathname}?${t.toString()}${window.location.hash}`}function Oe(){const[o,t]=e.useState(()=>g()),s=!!(o.terminalBackend||o.agentId||o.terminalSessionId||o.terminalSurfaceKey);e.useEffect(()=>{const i=()=>t(g());return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const n=e.useCallback(i=>{if(i.view!=="terminal"){const p={view:"terminal"},a=S(p);window.history.pushState(null,"",a),t(p);return}const c=S(i);window.history.pushState(null,"",c),t(i)},[]);return l.jsx(M,{route:o,navigate:n,children:l.jsx("div",{className:`s-terminal-embed${s?" s-terminal-embed--surface":""}`,children:l.jsx(H,{route:o,navigate:n})})})}function M({route:o,navigate:t,children:s}){const[n,i]=e.useState([]),[c,p]=e.useState({status:"checking",message:null,lastCheckedAt:null}),a=e.useRef(null),u=e.useMemo(()=>A(),[]),f=e.useMemo(()=>C(),[]),b=e.useMemo(()=>({...u==="light"?y:T,...f??{}}),[u,f]),w=e.useCallback(()=>{p({status:"online",message:null,lastCheckedAt:Date.now()})},[]),h=e.useCallback(r=>{p({status:"offline",message:L(r),lastCheckedAt:Date.now()})},[]),m=e.useCallback(async()=>{if(a.current)return a.current;const r=(async()=>{try{i(await P("/api/agents")),w()}catch(d){h(d)}})();a.current=r;try{await r}finally{a.current=null}},[h,w]);e.useEffect(()=>{m()},[m]),e.useEffect(()=>{const r=()=>{document.visibilityState!=="hidden"&&m()},d=window.setInterval(r,15e3);return window.addEventListener("focus",r),document.addEventListener("visibilitychange",r),()=>{window.clearInterval(d),window.removeEventListener("focus",r),document.removeEventListener("visibilitychange",r)}},[m]);const v=e.useMemo(()=>n.filter(r=>I(r.state)).length,[n]),E=e.useMemo(()=>({route:o,navigate:t,navigateBack:()=>{typeof window<"u"&&window.history.back()},canNavigateBack:typeof window<"u"&&window.history.length>1,agents:n,agentsLoaded:c.status!=="checking",onlineCount:v,apiConnection:c,appearanceDetails:k,updateAppearanceDetails:()=>{},reload:m,onboarding:null,operatorName:null,refreshOnboarding:async()=>{},onboardingSkipped:!0,skipOnboarding:()=>{},settingsOpen:!1,openSettings:()=>{},closeSettings:()=>{},scoutbotAgentId:"scoutbot",scoutbotConversationId:null,applyScoutbotUiAction:()=>{},selectedBrokerAttempt:null,inspectBrokerAttempt:()=>{},clearBrokerAttempt:()=>{},selectedKnowledgeHit:null,selectedKnowledgeQuery:"",inspectKnowledgeHit:()=>{},clearKnowledgeHit:()=>{},focusedSession:null,focusSession:()=>{},openFilePreview:()=>{},closeFilePreview:()=>{},openContextCapture:()=>{},closeContextCapture:()=>{}}),[n,c,t,v,m,o]);return l.jsx(x.Provider,{value:E,children:l.jsx("div",{"data-scout-theme":u,"data-scout-theme-mode":u,style:b,children:l.jsx(R,{children:s})})})}export{Oe as TerminalEmbedScreen};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/xterm-DZHyijPp.js","assets/index-o4FKpU7Z.js","assets/index-Bu-fckyR.css","assets/addon-fit-Cfq4Ayjd.js","assets/addon-webgl-B8sIf9-s.js"])))=>i.map(i=>d[i]);
2
- import{r as e,j as o,_ as Ne}from"./index-o4FKpU7Z.js";const Ae=["terminal:ack"];function st(u={}){const{url:m="ws://localhost:3600",healthUrl:y,token:x,systemPrompt:S,cwd:Re,workspaceFiles:ne,autoConnect:he=!1,sessionKey:ge,orphanTTL:oe,backend:$,controlMode:p="owner",tmuxSession:F,zellijSession:se,zellijSocketDir:ce,agent:le,provider:K,model:J,flowControl:ue}=u,O=ge?`hudson.relay.${ge}`:null,Ce=()=>{if(!O)return null;try{const r=localStorage.getItem(O);if(!r)return null;if(r.startsWith("{")){const c=JSON.parse(r);return typeof c.id!="string"?null:{id:c.id,reconnectToken:typeof c.reconnectToken=="string"?c.reconnectToken:null}}return{id:r,reconnectToken:null}}catch{return null}},l=e.useCallback((r,c=null)=>{if(O)try{r?localStorage.setItem(O,JSON.stringify({id:r,reconnectToken:c})):localStorage.removeItem(O)}catch{}},[O]),[de,k]=e.useState("disconnected"),[Ee,ie]=e.useState(null),[ye,L]=e.useState(null),[fe,h]=e.useState(null),[me,Te]=e.useState(Re||"~"),R=e.useRef(null),X=e.useRef(null),P=e.useRef({cols:80,rows:24}),I=e.useRef(!1),M=e.useRef([]),G=e.useRef(0),W=e.useRef(0),Y=e.useRef(0),V=e.useRef(me);V.current=me;const ae=e.useRef(!1),H=e.useRef(null);ae.current||(ae.current=!0,H.current=Ce());const j=e.useRef(H.current?.id??null),i=e.useRef(H.current?.reconnectToken??null),Q=e.useRef(null),B=e.useRef(new Set),Z=ue?.maxBufferedBytes??512*1024,d=e.useCallback(r=>{const c=R.current;c&&c.readyState===WebSocket.OPEN&&c.send(JSON.stringify(r))},[]),q=e.useCallback((r,c)=>{typeof r=="number"&&c===Y.current&&d({type:"terminal:ack",seq:r})},[d]),ee=e.useCallback(()=>{Y.current+=1,M.current=[],G.current=0},[]),z=e.useCallback((r,c=null)=>{const A=Y.current;if(!r){q(c,A);return}let g=!1;const N=()=>{g||(g=!0,q(c,A))};if(Q.current)try{Q.current(r,N)}catch{N()}else for(M.current.push({data:r,seq:c,ack:N}),G.current+=r.length;G.current>Z&&M.current.length>0;){const f=M.current.shift();if(!f)break;G.current-=f.data.length,f.ack()}if(B.current.size>0)for(const f of B.current)try{f(r)}catch{}},[q,Z]),C=e.useCallback(()=>{const r=R.current;r&&(r.close(),R.current=null)},[]),v=e.useCallback(()=>{W.current+=1,X.current&&(clearTimeout(X.current),X.current=null),C(),I.current=!1,k("disconnected")},[C]),te=e.useCallback(()=>{const r=V.current;return{type:"session:init",cols:P.current.cols,rows:P.current.rows,clientCapabilities:[...Ae],...S?{systemPrompt:S}:{},...r?{cwd:r}:{},...ne?{workspaceFiles:ne}:{},...oe?{orphanTTL:oe}:{},...$?{backend:$}:{},...p!=="owner"?{controlMode:p}:{},...F?{tmuxSession:F}:{},...se?{zellijSession:se}:{},...ce?{zellijSocketDir:ce}:{},...le?{agent:le}:{},...K?{provider:K}:{},...J?{model:J}:{}}},[le,$,p,J,oe,K,S,F,ne,se,ce]),_=e.useCallback(()=>{I.current||(I.current=!0,j.current?d({type:"session:reconnect",sessionId:j.current,...i.current?{reconnectToken:i.current}:{},cols:P.current.cols,rows:P.current.rows,clientCapabilities:[...Ae],...p!=="owner"?{controlMode:p}:{}}):d(te()))},[d,te,p]),D=e.useCallback(async()=>{const r=W.current+1;W.current=r,C(),Y.current+=1,I.current=!1,k("connecting"),L(null),h(null);const c=y||`${m.replace(/^ws(s?):\/\//,"http$1://")}/health`;try{const f=await fetch(c,{signal:AbortSignal.timeout(2e3)});if(!f.ok)throw new Error(`Relay health check failed: ${f.status}`)}catch{if(W.current!==r)return;k("error"),L("Relay service is not running");return}if(W.current!==r)return;C();const A=x?`${m}${m.includes("?")?"&":"?"}token=${encodeURIComponent(x)}`:m,g=new WebSocket(A);R.current=g;const N=()=>W.current===r&&R.current===g;g.onopen=()=>{if(!N()){g.close();return}_()},g.onmessage=f=>{if(N())try{const b=JSON.parse(f.data);switch(b.type){case"session:ready":j.current=b.sessionId,i.current=typeof b.reconnectToken=="string"?b.reconnectToken:null,l(b.sessionId,i.current),ie(b.sessionId),k("connected"),L(null),h(null);break;case"session:expired":{j.current=null,i.current=null,l(null),I.current=!1,ee(),z("\x1B[2J\x1B[H",null),d(te()),I.current=!0;break}case"session:error":k("error"),L(b.error||"Session failed to start");break;case"terminal:data":z(b.data||"",typeof b.seq=="number"?b.seq:null);break;case"session:exit":j.current=null,i.current=null,l(null),ee(),ie(null),h(b.exitCode??null),b.exitCode!==0?(k("error"),L(b.reason||`Process exited with code ${b.exitCode}`)):k("disconnected");break;case"session:detached":j.current=null,i.current=null,l(null),ie(null);break}}catch{}},g.onclose=()=>{N()&&(R.current=null,I.current=!1,k(f=>f==="error"?f:"disconnected"))},g.onerror=()=>{N()&&(k("error"),L("Could not connect to relay"))}},[m,y,x,_,C,d,z,te,l,ee]),ve=e.useCallback(r=>{p!=="observe"&&d({type:"terminal:input",data:r})},[p,d]),we=e.useCallback(r=>{p!=="observe"&&d({type:"terminal:input",data:r+"\r"})},[p,d]),ke=e.useCallback((r,c)=>{P.current={cols:r,rows:c},I.current&&d({type:"terminal:resize",cols:r,rows:c})},[d]),xe=e.useCallback(r=>{if(Q.current=r,!r||M.current.length===0)return;const c=M.current;M.current=[],G.current=0;for(const A of c)try{r(A.data,A.ack)}catch{A.ack()}},[]),E=e.useCallback(r=>(B.current.add(r),()=>{B.current.delete(r)}),[]);e.useEffect(()=>(he&&D(),()=>{v()}),[]);const T=e.useCallback(()=>{v(),j.current=null,i.current=null,ie(null),l(null),ee(),L(null),h(null),X.current=setTimeout(()=>{X.current=null,D()},200)},[v,D,l,ee]);return{status:de,sessionId:Ee,error:ye,exitCode:fe,cwd:me,controlMode:p,setCwd:Te,onData:xe,subscribeData:E,sendInput:ve,sendLine:we,resize:ke,connect:D,disconnect:v,restart:T}}const We={titleBarInset:0,dragRegionProps:{},onInteractiveMouseDown:void 0,isSSR:!0,apiBaseUrl:"",serviceApiUrl:""},$e=e.createContext(We);function Ke(){return e.useContext($e)}const Je=e.createContext(null);function Xe(){return e.useContext(Je)}const Oe="hudson:terminal:voice-transcript",Le="hudson:terminal:voice-submit",ct='[data-hudson-terminal-drawer-content="true"]',Ge=e.createContext(void 0),Ye={background:"#091112",foreground:"#d7e5e2",cursor:"#35d7d0",cursorAccent:"#091112",selectionBackground:"#173739",selectionForeground:"#f3fbf9",black:"#091112",red:"#ff6b6b",green:"#35d07f",yellow:"#f5c451",blue:"#62b4ff",magenta:"#ff7ab6",cyan:"#32d5ca",white:"#d7e5e2",brightBlack:"#667777",brightRed:"#ff8f8f",brightGreen:"#5ee79f",brightYellow:"#ffd36e",brightBlue:"#8dccff",brightMagenta:"#ff9fca",brightCyan:"#67eee3",brightWhite:"#ffffff"},Qe={background:"#f7faf9",foreground:"#111a19",cursor:"#006f6a",cursorAccent:"#f7faf9",selectionBackground:"#c0e7e2",selectionForeground:"#0d1716",black:"#111a19",red:"#9f1f18",green:"#006c46",yellow:"#704600",blue:"#075985",magenta:"#9d174d",cyan:"#006f6a",white:"#dbe5e2",brightBlack:"#52635f",brightRed:"#c2271f",brightGreen:"#007f55",brightYellow:"#865b00",brightBlue:"#0369a1",brightMagenta:"#be185d",brightCyan:"#007f89",brightWhite:"#ffffff"},Ze=`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/xterm-D6dE_wMr.js","assets/index-Bli6bTLU.js","assets/index-DzlEgstl.css","assets/addon-fit-Celjj2yn.js","assets/addon-webgl-Cu4tJ21-.js"])))=>i.map(i=>d[i]);
2
+ import{r as e,j as o,_ as Ne}from"./index-Bli6bTLU.js";const Ae=["terminal:ack"];function st(u={}){const{url:m="ws://localhost:3600",healthUrl:y,token:x,systemPrompt:S,cwd:Re,workspaceFiles:ne,autoConnect:he=!1,sessionKey:ge,orphanTTL:oe,backend:$,controlMode:p="owner",tmuxSession:F,zellijSession:se,zellijSocketDir:ce,agent:le,provider:K,model:J,flowControl:ue}=u,O=ge?`hudson.relay.${ge}`:null,Ce=()=>{if(!O)return null;try{const r=localStorage.getItem(O);if(!r)return null;if(r.startsWith("{")){const c=JSON.parse(r);return typeof c.id!="string"?null:{id:c.id,reconnectToken:typeof c.reconnectToken=="string"?c.reconnectToken:null}}return{id:r,reconnectToken:null}}catch{return null}},l=e.useCallback((r,c=null)=>{if(O)try{r?localStorage.setItem(O,JSON.stringify({id:r,reconnectToken:c})):localStorage.removeItem(O)}catch{}},[O]),[de,k]=e.useState("disconnected"),[Ee,ie]=e.useState(null),[ye,L]=e.useState(null),[fe,h]=e.useState(null),[me,Te]=e.useState(Re||"~"),R=e.useRef(null),X=e.useRef(null),P=e.useRef({cols:80,rows:24}),I=e.useRef(!1),M=e.useRef([]),G=e.useRef(0),W=e.useRef(0),Y=e.useRef(0),V=e.useRef(me);V.current=me;const ae=e.useRef(!1),H=e.useRef(null);ae.current||(ae.current=!0,H.current=Ce());const j=e.useRef(H.current?.id??null),i=e.useRef(H.current?.reconnectToken??null),Q=e.useRef(null),B=e.useRef(new Set),Z=ue?.maxBufferedBytes??512*1024,d=e.useCallback(r=>{const c=R.current;c&&c.readyState===WebSocket.OPEN&&c.send(JSON.stringify(r))},[]),q=e.useCallback((r,c)=>{typeof r=="number"&&c===Y.current&&d({type:"terminal:ack",seq:r})},[d]),ee=e.useCallback(()=>{Y.current+=1,M.current=[],G.current=0},[]),z=e.useCallback((r,c=null)=>{const A=Y.current;if(!r){q(c,A);return}let g=!1;const N=()=>{g||(g=!0,q(c,A))};if(Q.current)try{Q.current(r,N)}catch{N()}else for(M.current.push({data:r,seq:c,ack:N}),G.current+=r.length;G.current>Z&&M.current.length>0;){const f=M.current.shift();if(!f)break;G.current-=f.data.length,f.ack()}if(B.current.size>0)for(const f of B.current)try{f(r)}catch{}},[q,Z]),C=e.useCallback(()=>{const r=R.current;r&&(r.close(),R.current=null)},[]),v=e.useCallback(()=>{W.current+=1,X.current&&(clearTimeout(X.current),X.current=null),C(),I.current=!1,k("disconnected")},[C]),te=e.useCallback(()=>{const r=V.current;return{type:"session:init",cols:P.current.cols,rows:P.current.rows,clientCapabilities:[...Ae],...S?{systemPrompt:S}:{},...r?{cwd:r}:{},...ne?{workspaceFiles:ne}:{},...oe?{orphanTTL:oe}:{},...$?{backend:$}:{},...p!=="owner"?{controlMode:p}:{},...F?{tmuxSession:F}:{},...se?{zellijSession:se}:{},...ce?{zellijSocketDir:ce}:{},...le?{agent:le}:{},...K?{provider:K}:{},...J?{model:J}:{}}},[le,$,p,J,oe,K,S,F,ne,se,ce]),_=e.useCallback(()=>{I.current||(I.current=!0,j.current?d({type:"session:reconnect",sessionId:j.current,...i.current?{reconnectToken:i.current}:{},cols:P.current.cols,rows:P.current.rows,clientCapabilities:[...Ae],...p!=="owner"?{controlMode:p}:{}}):d(te()))},[d,te,p]),D=e.useCallback(async()=>{const r=W.current+1;W.current=r,C(),Y.current+=1,I.current=!1,k("connecting"),L(null),h(null);const c=y||`${m.replace(/^ws(s?):\/\//,"http$1://")}/health`;try{const f=await fetch(c,{signal:AbortSignal.timeout(2e3)});if(!f.ok)throw new Error(`Relay health check failed: ${f.status}`)}catch{if(W.current!==r)return;k("error"),L("Relay service is not running");return}if(W.current!==r)return;C();const A=x?`${m}${m.includes("?")?"&":"?"}token=${encodeURIComponent(x)}`:m,g=new WebSocket(A);R.current=g;const N=()=>W.current===r&&R.current===g;g.onopen=()=>{if(!N()){g.close();return}_()},g.onmessage=f=>{if(N())try{const b=JSON.parse(f.data);switch(b.type){case"session:ready":j.current=b.sessionId,i.current=typeof b.reconnectToken=="string"?b.reconnectToken:null,l(b.sessionId,i.current),ie(b.sessionId),k("connected"),L(null),h(null);break;case"session:expired":{j.current=null,i.current=null,l(null),I.current=!1,ee(),z("\x1B[2J\x1B[H",null),d(te()),I.current=!0;break}case"session:error":k("error"),L(b.error||"Session failed to start");break;case"terminal:data":z(b.data||"",typeof b.seq=="number"?b.seq:null);break;case"session:exit":j.current=null,i.current=null,l(null),ee(),ie(null),h(b.exitCode??null),b.exitCode!==0?(k("error"),L(b.reason||`Process exited with code ${b.exitCode}`)):k("disconnected");break;case"session:detached":j.current=null,i.current=null,l(null),ie(null);break}}catch{}},g.onclose=()=>{N()&&(R.current=null,I.current=!1,k(f=>f==="error"?f:"disconnected"))},g.onerror=()=>{N()&&(k("error"),L("Could not connect to relay"))}},[m,y,x,_,C,d,z,te,l,ee]),ve=e.useCallback(r=>{p!=="observe"&&d({type:"terminal:input",data:r})},[p,d]),we=e.useCallback(r=>{p!=="observe"&&d({type:"terminal:input",data:r+"\r"})},[p,d]),ke=e.useCallback((r,c)=>{P.current={cols:r,rows:c},I.current&&d({type:"terminal:resize",cols:r,rows:c})},[d]),xe=e.useCallback(r=>{if(Q.current=r,!r||M.current.length===0)return;const c=M.current;M.current=[],G.current=0;for(const A of c)try{r(A.data,A.ack)}catch{A.ack()}},[]),E=e.useCallback(r=>(B.current.add(r),()=>{B.current.delete(r)}),[]);e.useEffect(()=>(he&&D(),()=>{v()}),[]);const T=e.useCallback(()=>{v(),j.current=null,i.current=null,ie(null),l(null),ee(),L(null),h(null),X.current=setTimeout(()=>{X.current=null,D()},200)},[v,D,l,ee]);return{status:de,sessionId:Ee,error:ye,exitCode:fe,cwd:me,controlMode:p,setCwd:Te,onData:xe,subscribeData:E,sendInput:ve,sendLine:we,resize:ke,connect:D,disconnect:v,restart:T}}const We={titleBarInset:0,dragRegionProps:{},onInteractiveMouseDown:void 0,isSSR:!0,apiBaseUrl:"",serviceApiUrl:""},$e=e.createContext(We);function Ke(){return e.useContext($e)}const Je=e.createContext(null);function Xe(){return e.useContext(Je)}const Oe="hudson:terminal:voice-transcript",Le="hudson:terminal:voice-submit",ct='[data-hudson-terminal-drawer-content="true"]',Ge=e.createContext(void 0),Ye={background:"#091112",foreground:"#d7e5e2",cursor:"#35d7d0",cursorAccent:"#091112",selectionBackground:"#173739",selectionForeground:"#f3fbf9",black:"#091112",red:"#ff6b6b",green:"#35d07f",yellow:"#f5c451",blue:"#62b4ff",magenta:"#ff7ab6",cyan:"#32d5ca",white:"#d7e5e2",brightBlack:"#667777",brightRed:"#ff8f8f",brightGreen:"#5ee79f",brightYellow:"#ffd36e",brightBlue:"#8dccff",brightMagenta:"#ff9fca",brightCyan:"#67eee3",brightWhite:"#ffffff"},Qe={background:"#f7faf9",foreground:"#111a19",cursor:"#006f6a",cursorAccent:"#f7faf9",selectionBackground:"#c0e7e2",selectionForeground:"#0d1716",black:"#111a19",red:"#9f1f18",green:"#006c46",yellow:"#704600",blue:"#075985",magenta:"#9d174d",cyan:"#006f6a",white:"#dbe5e2",brightBlack:"#52635f",brightRed:"#c2271f",brightGreen:"#007f55",brightYellow:"#865b00",brightBlue:"#0369a1",brightMagenta:"#be185d",brightCyan:"#007f89",brightWhite:"#ffffff"},Ze=`
3
3
  .xterm { cursor: text; position: relative; user-select: none; -ms-user-select: none; -webkit-user-select: none; }
4
4
  .xterm.focus, .xterm:focus { outline: none; }
5
5
  .xterm .xterm-helpers { position: absolute; top: 0; z-index: 5; }
@@ -43,4 +43,4 @@ import{r as e,j as o,_ as Ne}from"./index-o4FKpU7Z.js";const Ae=["terminal:ack"]
43
43
  .xterm .xterm-scrollable-element > .shadow { position: absolute; display: none; }
44
44
  .xterm .xterm-scrollable-element > .shadow.top { display: block; top: 0; left: 3px; height: 3px; width: 100%; }
45
45
  .xterm .xterm-scrollable-element > .shadow.left { display: block; top: 3px; left: 0; height: 100%; width: 3px; }
46
- `;function qe(){if(typeof document>"u"||document.querySelector("[data-xterm-css]"))return;const u=document.createElement("style");u.setAttribute("data-xterm-css",""),u.textContent=Ze,document.head.appendChild(u)}function Se(u,m){if(typeof u!="object"||u===null)return;const y=u,x=y[m];if(x)return x;const S=y.default;if(!(typeof S!="object"||S===null))return S[m]}function Pe(u,m){if(!u||m&&!u.closest(m))return!1;const y=u.getBoundingClientRect();if(y.width<=0||y.height<=0)return!1;const x=window.getComputedStyle(u);return x.display!=="none"&&x.visibility!=="hidden"}const et="\x1B[13;2u",Me="\r";function tt(u){return new Promise((m,y)=>{const x=new FileReader;x.onload=()=>{const S=x.result;m(S.split(",")[1])},x.onerror=y,x.readAsDataURL(u)})}function rt({relay:u,fontSize:m=12,fontFamily:y="'JetBrains Mono', 'Hack Nerd Font', monospace",scrollback:x=5e3,renderer:S="auto",readOnly:Re=!1,ariaLabel:ne="Terminal",className:he,style:ge,colorScheme:oe="auto",configItems:$,onOpenSettings:p,onStartService:F,quiet:se=!1,voiceVisibilityScope:ce,imageUploadUrl:le,onReady:K,onDispose:J,onResize:ue,onRendererChange:O},Ce){const{status:l,error:de,exitCode:k,cwd:Ee,setCwd:ie,sendInput:ye,resize:L,onData:fe,connect:h,disconnect:me,controlMode:Te="owner"}=u,R=Re||Te==="observe",X=e.useContext(Ge),P=ce===!1?void 0:ce??X,[I,M]=e.useState(!1),{apiBaseUrl:G}=Ke(),W=Xe(),Y=oe==="auto"?W?.resolvedTheme==="light"?"light":"dark":oe,V=Y==="light"?Qe:Ye,ae=Y==="light"?4.5:3,H=e.useRef(null),j=e.useRef(null),i=e.useRef(null),Q=e.useRef(null),B=e.useRef(null),Z=e.useRef(!1),[d,q]=e.useState(!1),[ee,z]=e.useState(!1),C=e.useRef(0),v=e.useRef(R),te=e.useRef(null),_=e.useRef(null),D=e.useRef(null),ve=e.useRef(K),we=e.useRef(J),ke=e.useRef(ue),xe=e.useRef(O);e.useEffect(()=>{v.current=R,R&&(B.current=null,Z.current=!1,C.current=0,z(!1))},[R]),e.useEffect(()=>{ve.current=K},[K]),e.useEffect(()=>{we.current=J},[J]),e.useEffect(()=>{ke.current=ue},[ue]),e.useEffect(()=>{xe.current=O},[O]),e.useEffect(()=>{const t=H.current;if(!t)return;const n=s=>{s.key===" "&&!s.metaKey&&!s.ctrlKey&&!s.altKey&&s.stopPropagation()};return t.addEventListener("keydown",n),()=>t.removeEventListener("keydown",n)},[]);const E=le===void 0?`${G}/api/relay/upload`:le,T=e.useCallback(t=>{v.current||ye(t)},[ye]),r=e.useCallback((t,n)=>{if(!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0)return;const s=te.current;s&&s.cols===t&&s.rows===n||(te.current={cols:t,rows:n},L(t,n),ke.current?.(t,n))},[L]),c=e.useCallback(()=>{const t=Q.current,n=i.current;if(!t||!n)return null;try{t.fit()}catch{return null}const s={cols:n.cols,rows:n.rows};return r(s.cols,s.rows),s},[r]),A=e.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,c()}))},[c]);e.useImperativeHandle(Ce,()=>({focus:()=>{i.current?.focus()},fit:c,clear:()=>{i.current?.clear()},getDimensions:()=>{const t=i.current;return t?{cols:t.cols,rows:t.rows}:null},getTerminal:()=>i.current}),[c]);const g=e.useCallback(t=>{const n=t.transcript.replace(/\s+/g," ").trim();n&&T(t.submit?`${n}${Me}`:n)},[T]),N=e.useCallback(()=>{T(Me)},[T]);e.useEffect(()=>{const t=n=>{if(v.current||!Pe(H.current,P))return;const s=n.detail;if(!(!s||typeof s.transcript!="string")){if(l==="connected"){g(s);return}B.current=s,l!=="connecting"&&h()}};return window.addEventListener(Oe,t),()=>window.removeEventListener(Oe,t)},[h,g,l,P]),e.useEffect(()=>{if(l!=="connected"||!B.current)return;const t=B.current;B.current=null,g(t)},[g,l]),e.useEffect(()=>{const t=()=>{if(!v.current&&Pe(H.current,P)){if(l==="connected"){N();return}Z.current=!0,l!=="connecting"&&h()}};return window.addEventListener(Le,t),()=>window.removeEventListener(Le,t)},[h,N,l,P]),e.useEffect(()=>{l!=="connected"||!Z.current||(Z.current=!1,N())},[N,l]);const f=e.useCallback(async t=>{if(!E)return null;try{const n=await tt(t),s=await fetch(E,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t.name,data:n})}),{path:w}=await s.json();return w||null}catch(n){return console.error("File upload failed:",n),null}},[E]);e.useEffect(()=>{const t=H.current;if(!t)return;const n=async s=>{if(!s.clipboardData||!E)return;const w=Array.from(s.clipboardData.items).filter(U=>U.type.startsWith("image/"));if(w.length!==0&&(s.preventDefault(),s.stopPropagation(),!v.current))for(const U of w){const pe=U.getAsFile();if(!pe)continue;const be=await f(pe);be&&T(be)}};return t.addEventListener("paste",n),()=>t.removeEventListener("paste",n)},[T,f,E]);const b=e.useCallback(t=>{if(t.preventDefault(),v.current||!E){t.dataTransfer.dropEffect="none";return}t.dataTransfer.dropEffect="copy"},[E]),Be=e.useCallback(t=>{if(t.preventDefault(),v.current||!E){C.current=0,z(!1);return}C.current++,t.dataTransfer.types.includes("Files")&&z(!0)},[E]),ze=e.useCallback(t=>{if(t.preventDefault(),v.current){C.current=0,z(!1);return}C.current--,C.current===0&&z(!1)},[]),Fe=e.useCallback(async t=>{if(t.preventDefault(),C.current=0,z(!1),v.current||!E)return;const n=Array.from(t.dataTransfer.files).filter(s=>s.type.startsWith("image/"));if(n.length!==0)for(const s of n){const w=await f(s);w&&T(w)}},[T,f,E]);e.useEffect(()=>{let t=!1,n=null;q(!1);async function s(){const[w,U,pe]=await Promise.all([Ne(()=>import("./xterm-DZHyijPp.js").then(a=>a.x),__vite__mapDeps([0,1,2])),Ne(()=>import("./addon-fit-Cfq4Ayjd.js").then(a=>a.a),__vite__mapDeps([3,1,2])),Ne(()=>import("./addon-webgl-B8sIf9-s.js").then(a=>a.a),__vite__mapDeps([4,1,2])).catch(()=>null)]),be=Se(w,"Terminal"),je=Se(U,"FitAddon"),_e=pe?Se(pe,"WebglAddon"):void 0;if(!be||!je){console.error("[TerminalRelay] @xterm/xterm or @xterm/addon-fit missing constructors",{xtermMod:w,fitMod:U});return}if(qe(),t||!j.current)return;n=new be({fontSize:m,fontFamily:y,theme:V,minimumContrastRatio:ae,cursorBlink:!0,cursorStyle:"bar",allowTransparency:!0,scrollback:x,convertEol:!1,allowProposedApi:!0});const De=new je;n.loadAddon(De),n.open(j.current),i.current=n,Q.current=De;let Ie="dom";if(S!=="dom"&&_e)try{const a=new _e;a.onContextLoss(()=>{a.dispose(),xe.current?.("dom")}),n.loadAddon(a),Ie="webgl"}catch{}xe.current?.(Ie),c(),n.attachCustomKeyEventHandler(a=>a.type==="keydown"&&a.key==="Enter"&&a.shiftKey&&!a.ctrlKey&&!a.altKey&&!a.metaKey?(a.preventDefault(),a.stopPropagation(),T(et),!1):!0),n.onData(a=>{T(a)}),q(!0),ve.current?.(n)}return s(),()=>{t=!0,q(!1),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),n&&(n.dispose(),i.current=null,Q.current=null),we.current?.()}},[c,S,x,T]),e.useEffect(()=>{const t=i.current;t&&(t.options.fontSize=m,t.options.fontFamily=y,c())},[c,m,y]),e.useEffect(()=>{const t=i.current;t&&(t.options.theme=V,t.options.minimumContrastRatio=ae)},[ae,V]),e.useEffect(()=>{if(d)return fe((t,n)=>{let s=!1;const w=()=>{s||(s=!0,n())},U=i.current;if(!U){w();return}try{U.write(t,w)}catch{w()}}),()=>{fe(null)}},[d,fe]),e.useEffect(()=>{const t=j.current;if(!t||!d)return;const n=new ResizeObserver(()=>{A()});return n.observe(t),()=>{n.disconnect(),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null)}},[d,A]),e.useEffect(()=>{l==="connected"&&i.current&&i.current.focus()},[l]);const Ve=e.useCallback(()=>{l==="connected"&&i.current&&i.current.focus()},[l]),He=l==="error"&&de==="Relay service is not running",Ue=e.useCallback(async()=>{if(F){M(!0);try{await F()&&(D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{D.current=null,h()},500))}finally{M(!1)}}},[F,h]);e.useEffect(()=>()=>{D.current&&(clearTimeout(D.current),D.current=null)},[]);let re=null;return He?re=o.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/10 border border-amber-500/20 flex items-center justify-center",children:o.jsx("span",{className:"text-amber-400 text-[14px]",children:"!"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[12px] text-foreground font-medium mb-1",children:"Relay service not running"}),o.jsx("div",{className:"text-[11px] text-muted-foreground/80 leading-relaxed",children:F?"Start the relay service to open a terminal session.":"Start the relay service from the Workspace Manager."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[F&&o.jsx("button",{type:"button",onClick:Ue,disabled:I,className:"text-[11px] px-4 py-1.5 rounded-full border border-accent/30 text-accent hover:bg-accent/10 transition-colors font-medium disabled:opacity-50",children:I?"Starting":"Start Service"}),o.jsx("button",{type:"button",onClick:()=>h(),className:"text-[11px] px-3 py-1.5 rounded-full border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Retry"}),p&&o.jsx("button",{type:"button",onClick:p,className:"text-[11px] px-3 py-1.5 rounded-full border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Settings"})]})]}):l==="error"&&de?re=o.jsxs("div",{className:"flex flex-col items-center gap-3 max-w-md text-center px-4",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-red-500/10 flex items-center justify-center",children:o.jsx("span",{className:"text-red-400 text-sm",children:"!"})}),o.jsx("span",{className:"text-red-400 text-[12px] font-medium",children:"Session failed"}),o.jsx("code",{className:"text-[11px] text-muted-foreground bg-muted/80 px-3 py-2 rounded-md whitespace-pre-wrap leading-relaxed max-h-32 overflow-y-auto w-full text-left",children:de}),k!==null&&k!==0&&o.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["Exit code ",k]}),o.jsx("button",{type:"button",onClick:()=>h(),className:"text-[11px] px-3 py-1 rounded-full border border-cyan-500/30 text-cyan-400 hover:bg-cyan-500/10 transition-colors",children:"Retry"})]}):l==="disconnected"&&!se?re=o.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-muted border border-border flex items-center justify-center",children:o.jsx("span",{className:"text-muted-foreground/80 text-[14px]",children:"▷"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[12px] text-foreground font-medium mb-1",children:"Terminal relay disconnected"}),o.jsx("div",{className:"text-[11px] text-muted-foreground/80 leading-relaxed",children:"Set working directory and connect."})]}),o.jsxs("form",{className:"w-full",onSubmit:t=>{t.preventDefault(),h()},children:[o.jsx("label",{className:"text-[10px] font-mono text-muted-foreground/80 uppercase tracking-wider mb-1 block text-left",children:"Working Directory"}),o.jsx("input",{type:"text",value:Ee,onChange:t=>ie(t.target.value),placeholder:"~/dev/my-project",className:"w-full bg-muted/80 border border-border/50 rounded px-3 py-1.5 text-[11px] font-mono text-foreground placeholder:text-muted-foreground/60 outline-none focus:border-accent/40 transition-colors",spellCheck:!1,autoComplete:"off"})]}),$&&$.length>0&&o.jsx("div",{className:"w-full grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[10px] font-mono bg-muted/60 border border-border/40 rounded-md px-3 py-2",children:$.map(t=>o.jsxs("div",{className:"contents",children:[o.jsx("span",{className:"text-muted-foreground/80",children:t.label}),o.jsx("span",{className:"text-muted-foreground truncate text-left",children:t.value})]},t.label))}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{type:"button",onClick:()=>h(),className:"text-[11px] px-4 py-1.5 rounded-full border border-cyan-500/30 text-cyan-400 hover:bg-cyan-500/10 transition-colors font-medium",children:"Connect"}),p&&o.jsx("button",{type:"button",onClick:p,className:"text-[11px] px-3 py-1.5 rounded-full border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Settings"})]})]}):l==="connecting"&&!se&&(re=o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx("div",{className:"w-6 h-6 border-2 border-muted-foreground/30 border-t-cyan-500 rounded-full animate-spin"}),o.jsx("span",{className:"text-[12px] text-muted-foreground",children:"Connecting to relay"}),o.jsx("button",{type:"button",onClick:()=>{me()},className:"text-[10px] px-3 py-1 rounded-full border border-border text-muted-foreground/80 hover:text-foreground hover:bg-muted transition-colors",children:"Cancel"})]})),o.jsxs("div",{ref:H,className:he?`relative flex flex-col h-full overflow-hidden ${he}`:"relative flex flex-col h-full overflow-hidden",style:ge,role:"application","aria-label":R?`${ne} (read only)`:ne,"data-readonly":R?"true":void 0,onClick:Ve,onDragOver:b,onDragEnter:Be,onDragLeave:ze,onDrop:Fe,children:[re&&o.jsx("div",{className:"flex items-center justify-center h-full font-mono text-[12px] absolute inset-0 z-10 bg-background/95",children:re}),ee&&o.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-cyan-500/10 border-2 border-dashed border-cyan-500/50 rounded pointer-events-none",children:o.jsx("span",{className:"text-cyan-400 font-mono text-sm",children:"Drop image to get path"})}),o.jsx("div",{ref:j,className:"flex-1 min-h-0 min-w-0 overflow-hidden",style:{visibility:re?"hidden":"visible",backgroundColor:V.background,"--hud-terminal-bg":V.background,"--hud-terminal-fg":V.foreground}})]})}const nt=e.forwardRef(rt);nt.displayName="TerminalRelay";export{ct as H,nt as T,Ke as a,Ge as b,st as u};
46
+ `;function qe(){if(typeof document>"u"||document.querySelector("[data-xterm-css]"))return;const u=document.createElement("style");u.setAttribute("data-xterm-css",""),u.textContent=Ze,document.head.appendChild(u)}function Se(u,m){if(typeof u!="object"||u===null)return;const y=u,x=y[m];if(x)return x;const S=y.default;if(!(typeof S!="object"||S===null))return S[m]}function Pe(u,m){if(!u||m&&!u.closest(m))return!1;const y=u.getBoundingClientRect();if(y.width<=0||y.height<=0)return!1;const x=window.getComputedStyle(u);return x.display!=="none"&&x.visibility!=="hidden"}const et="\x1B[13;2u",Me="\r";function tt(u){return new Promise((m,y)=>{const x=new FileReader;x.onload=()=>{const S=x.result;m(S.split(",")[1])},x.onerror=y,x.readAsDataURL(u)})}function rt({relay:u,fontSize:m=12,fontFamily:y="'JetBrains Mono', 'Hack Nerd Font', monospace",scrollback:x=5e3,renderer:S="auto",readOnly:Re=!1,ariaLabel:ne="Terminal",className:he,style:ge,colorScheme:oe="auto",configItems:$,onOpenSettings:p,onStartService:F,quiet:se=!1,voiceVisibilityScope:ce,imageUploadUrl:le,onReady:K,onDispose:J,onResize:ue,onRendererChange:O},Ce){const{status:l,error:de,exitCode:k,cwd:Ee,setCwd:ie,sendInput:ye,resize:L,onData:fe,connect:h,disconnect:me,controlMode:Te="owner"}=u,R=Re||Te==="observe",X=e.useContext(Ge),P=ce===!1?void 0:ce??X,[I,M]=e.useState(!1),{apiBaseUrl:G}=Ke(),W=Xe(),Y=oe==="auto"?W?.resolvedTheme==="light"?"light":"dark":oe,V=Y==="light"?Qe:Ye,ae=Y==="light"?4.5:3,H=e.useRef(null),j=e.useRef(null),i=e.useRef(null),Q=e.useRef(null),B=e.useRef(null),Z=e.useRef(!1),[d,q]=e.useState(!1),[ee,z]=e.useState(!1),C=e.useRef(0),v=e.useRef(R),te=e.useRef(null),_=e.useRef(null),D=e.useRef(null),ve=e.useRef(K),we=e.useRef(J),ke=e.useRef(ue),xe=e.useRef(O);e.useEffect(()=>{v.current=R,R&&(B.current=null,Z.current=!1,C.current=0,z(!1))},[R]),e.useEffect(()=>{ve.current=K},[K]),e.useEffect(()=>{we.current=J},[J]),e.useEffect(()=>{ke.current=ue},[ue]),e.useEffect(()=>{xe.current=O},[O]),e.useEffect(()=>{const t=H.current;if(!t)return;const n=s=>{s.key===" "&&!s.metaKey&&!s.ctrlKey&&!s.altKey&&s.stopPropagation()};return t.addEventListener("keydown",n),()=>t.removeEventListener("keydown",n)},[]);const E=le===void 0?`${G}/api/relay/upload`:le,T=e.useCallback(t=>{v.current||ye(t)},[ye]),r=e.useCallback((t,n)=>{if(!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0)return;const s=te.current;s&&s.cols===t&&s.rows===n||(te.current={cols:t,rows:n},L(t,n),ke.current?.(t,n))},[L]),c=e.useCallback(()=>{const t=Q.current,n=i.current;if(!t||!n)return null;try{t.fit()}catch{return null}const s={cols:n.cols,rows:n.rows};return r(s.cols,s.rows),s},[r]),A=e.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,c()}))},[c]);e.useImperativeHandle(Ce,()=>({focus:()=>{i.current?.focus()},fit:c,clear:()=>{i.current?.clear()},getDimensions:()=>{const t=i.current;return t?{cols:t.cols,rows:t.rows}:null},getTerminal:()=>i.current}),[c]);const g=e.useCallback(t=>{const n=t.transcript.replace(/\s+/g," ").trim();n&&T(t.submit?`${n}${Me}`:n)},[T]),N=e.useCallback(()=>{T(Me)},[T]);e.useEffect(()=>{const t=n=>{if(v.current||!Pe(H.current,P))return;const s=n.detail;if(!(!s||typeof s.transcript!="string")){if(l==="connected"){g(s);return}B.current=s,l!=="connecting"&&h()}};return window.addEventListener(Oe,t),()=>window.removeEventListener(Oe,t)},[h,g,l,P]),e.useEffect(()=>{if(l!=="connected"||!B.current)return;const t=B.current;B.current=null,g(t)},[g,l]),e.useEffect(()=>{const t=()=>{if(!v.current&&Pe(H.current,P)){if(l==="connected"){N();return}Z.current=!0,l!=="connecting"&&h()}};return window.addEventListener(Le,t),()=>window.removeEventListener(Le,t)},[h,N,l,P]),e.useEffect(()=>{l!=="connected"||!Z.current||(Z.current=!1,N())},[N,l]);const f=e.useCallback(async t=>{if(!E)return null;try{const n=await tt(t),s=await fetch(E,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t.name,data:n})}),{path:w}=await s.json();return w||null}catch(n){return console.error("File upload failed:",n),null}},[E]);e.useEffect(()=>{const t=H.current;if(!t)return;const n=async s=>{if(!s.clipboardData||!E)return;const w=Array.from(s.clipboardData.items).filter(U=>U.type.startsWith("image/"));if(w.length!==0&&(s.preventDefault(),s.stopPropagation(),!v.current))for(const U of w){const pe=U.getAsFile();if(!pe)continue;const be=await f(pe);be&&T(be)}};return t.addEventListener("paste",n),()=>t.removeEventListener("paste",n)},[T,f,E]);const b=e.useCallback(t=>{if(t.preventDefault(),v.current||!E){t.dataTransfer.dropEffect="none";return}t.dataTransfer.dropEffect="copy"},[E]),Be=e.useCallback(t=>{if(t.preventDefault(),v.current||!E){C.current=0,z(!1);return}C.current++,t.dataTransfer.types.includes("Files")&&z(!0)},[E]),ze=e.useCallback(t=>{if(t.preventDefault(),v.current){C.current=0,z(!1);return}C.current--,C.current===0&&z(!1)},[]),Fe=e.useCallback(async t=>{if(t.preventDefault(),C.current=0,z(!1),v.current||!E)return;const n=Array.from(t.dataTransfer.files).filter(s=>s.type.startsWith("image/"));if(n.length!==0)for(const s of n){const w=await f(s);w&&T(w)}},[T,f,E]);e.useEffect(()=>{let t=!1,n=null;q(!1);async function s(){const[w,U,pe]=await Promise.all([Ne(()=>import("./xterm-D6dE_wMr.js").then(a=>a.x),__vite__mapDeps([0,1,2])),Ne(()=>import("./addon-fit-Celjj2yn.js").then(a=>a.a),__vite__mapDeps([3,1,2])),Ne(()=>import("./addon-webgl-Cu4tJ21-.js").then(a=>a.a),__vite__mapDeps([4,1,2])).catch(()=>null)]),be=Se(w,"Terminal"),je=Se(U,"FitAddon"),_e=pe?Se(pe,"WebglAddon"):void 0;if(!be||!je){console.error("[TerminalRelay] @xterm/xterm or @xterm/addon-fit missing constructors",{xtermMod:w,fitMod:U});return}if(qe(),t||!j.current)return;n=new be({fontSize:m,fontFamily:y,theme:V,minimumContrastRatio:ae,cursorBlink:!0,cursorStyle:"bar",allowTransparency:!0,scrollback:x,convertEol:!1,allowProposedApi:!0});const De=new je;n.loadAddon(De),n.open(j.current),i.current=n,Q.current=De;let Ie="dom";if(S!=="dom"&&_e)try{const a=new _e;a.onContextLoss(()=>{a.dispose(),xe.current?.("dom")}),n.loadAddon(a),Ie="webgl"}catch{}xe.current?.(Ie),c(),n.attachCustomKeyEventHandler(a=>a.type==="keydown"&&a.key==="Enter"&&a.shiftKey&&!a.ctrlKey&&!a.altKey&&!a.metaKey?(a.preventDefault(),a.stopPropagation(),T(et),!1):!0),n.onData(a=>{T(a)}),q(!0),ve.current?.(n)}return s(),()=>{t=!0,q(!1),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),n&&(n.dispose(),i.current=null,Q.current=null),we.current?.()}},[c,S,x,T]),e.useEffect(()=>{const t=i.current;t&&(t.options.fontSize=m,t.options.fontFamily=y,c())},[c,m,y]),e.useEffect(()=>{const t=i.current;t&&(t.options.theme=V,t.options.minimumContrastRatio=ae)},[ae,V]),e.useEffect(()=>{if(d)return fe((t,n)=>{let s=!1;const w=()=>{s||(s=!0,n())},U=i.current;if(!U){w();return}try{U.write(t,w)}catch{w()}}),()=>{fe(null)}},[d,fe]),e.useEffect(()=>{const t=j.current;if(!t||!d)return;const n=new ResizeObserver(()=>{A()});return n.observe(t),()=>{n.disconnect(),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null)}},[d,A]),e.useEffect(()=>{l==="connected"&&i.current&&i.current.focus()},[l]);const Ve=e.useCallback(()=>{l==="connected"&&i.current&&i.current.focus()},[l]),He=l==="error"&&de==="Relay service is not running",Ue=e.useCallback(async()=>{if(F){M(!0);try{await F()&&(D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{D.current=null,h()},500))}finally{M(!1)}}},[F,h]);e.useEffect(()=>()=>{D.current&&(clearTimeout(D.current),D.current=null)},[]);let re=null;return He?re=o.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/10 border border-amber-500/20 flex items-center justify-center",children:o.jsx("span",{className:"text-amber-400 text-[14px]",children:"!"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[12px] text-foreground font-medium mb-1",children:"Relay service not running"}),o.jsx("div",{className:"text-[11px] text-muted-foreground/80 leading-relaxed",children:F?"Start the relay service to open a terminal session.":"Start the relay service from the Workspace Manager."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[F&&o.jsx("button",{type:"button",onClick:Ue,disabled:I,className:"text-[11px] px-4 py-1.5 rounded-full border border-accent/30 text-accent hover:bg-accent/10 transition-colors font-medium disabled:opacity-50",children:I?"Starting":"Start Service"}),o.jsx("button",{type:"button",onClick:()=>h(),className:"text-[11px] px-3 py-1.5 rounded-full border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Retry"}),p&&o.jsx("button",{type:"button",onClick:p,className:"text-[11px] px-3 py-1.5 rounded-full border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Settings"})]})]}):l==="error"&&de?re=o.jsxs("div",{className:"flex flex-col items-center gap-3 max-w-md text-center px-4",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-red-500/10 flex items-center justify-center",children:o.jsx("span",{className:"text-red-400 text-sm",children:"!"})}),o.jsx("span",{className:"text-red-400 text-[12px] font-medium",children:"Session failed"}),o.jsx("code",{className:"text-[11px] text-muted-foreground bg-muted/80 px-3 py-2 rounded-md whitespace-pre-wrap leading-relaxed max-h-32 overflow-y-auto w-full text-left",children:de}),k!==null&&k!==0&&o.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["Exit code ",k]}),o.jsx("button",{type:"button",onClick:()=>h(),className:"text-[11px] px-3 py-1 rounded-full border border-cyan-500/30 text-cyan-400 hover:bg-cyan-500/10 transition-colors",children:"Retry"})]}):l==="disconnected"&&!se?re=o.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-muted border border-border flex items-center justify-center",children:o.jsx("span",{className:"text-muted-foreground/80 text-[14px]",children:"▷"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[12px] text-foreground font-medium mb-1",children:"Terminal relay disconnected"}),o.jsx("div",{className:"text-[11px] text-muted-foreground/80 leading-relaxed",children:"Set working directory and connect."})]}),o.jsxs("form",{className:"w-full",onSubmit:t=>{t.preventDefault(),h()},children:[o.jsx("label",{className:"text-[10px] font-mono text-muted-foreground/80 uppercase tracking-wider mb-1 block text-left",children:"Working Directory"}),o.jsx("input",{type:"text",value:Ee,onChange:t=>ie(t.target.value),placeholder:"~/dev/my-project",className:"w-full bg-muted/80 border border-border/50 rounded px-3 py-1.5 text-[11px] font-mono text-foreground placeholder:text-muted-foreground/60 outline-none focus:border-accent/40 transition-colors",spellCheck:!1,autoComplete:"off"})]}),$&&$.length>0&&o.jsx("div",{className:"w-full grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[10px] font-mono bg-muted/60 border border-border/40 rounded-md px-3 py-2",children:$.map(t=>o.jsxs("div",{className:"contents",children:[o.jsx("span",{className:"text-muted-foreground/80",children:t.label}),o.jsx("span",{className:"text-muted-foreground truncate text-left",children:t.value})]},t.label))}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{type:"button",onClick:()=>h(),className:"text-[11px] px-4 py-1.5 rounded-full border border-cyan-500/30 text-cyan-400 hover:bg-cyan-500/10 transition-colors font-medium",children:"Connect"}),p&&o.jsx("button",{type:"button",onClick:p,className:"text-[11px] px-3 py-1.5 rounded-full border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Settings"})]})]}):l==="connecting"&&!se&&(re=o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx("div",{className:"w-6 h-6 border-2 border-muted-foreground/30 border-t-cyan-500 rounded-full animate-spin"}),o.jsx("span",{className:"text-[12px] text-muted-foreground",children:"Connecting to relay"}),o.jsx("button",{type:"button",onClick:()=>{me()},className:"text-[10px] px-3 py-1 rounded-full border border-border text-muted-foreground/80 hover:text-foreground hover:bg-muted transition-colors",children:"Cancel"})]})),o.jsxs("div",{ref:H,className:he?`relative flex flex-col h-full overflow-hidden ${he}`:"relative flex flex-col h-full overflow-hidden",style:ge,role:"application","aria-label":R?`${ne} (read only)`:ne,"data-readonly":R?"true":void 0,onClick:Ve,onDragOver:b,onDragEnter:Be,onDragLeave:ze,onDrop:Fe,children:[re&&o.jsx("div",{className:"flex items-center justify-center h-full font-mono text-[12px] absolute inset-0 z-10 bg-background/95",children:re}),ee&&o.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-cyan-500/10 border-2 border-dashed border-cyan-500/50 rounded pointer-events-none",children:o.jsx("span",{className:"text-cyan-400 font-mono text-sm",children:"Drop image to get path"})}),o.jsx("div",{ref:j,className:"flex-1 min-h-0 min-w-0 overflow-hidden",style:{visibility:re?"hidden":"visible",backgroundColor:V.background,"--hud-terminal-bg":V.background,"--hud-terminal-fg":V.foreground}})]})}const nt=e.forwardRef(rt);nt.displayName="TerminalRelay";export{ct as H,nt as T,Ke as a,Ge as b,st as u};
@@ -1,4 +1,4 @@
1
- import{j as i,r as I}from"./index-o4FKpU7Z.js";const N={cjs:"javascript",css:"css",htm:"html",html:"html",js:"javascript",jsx:"javascript",json:"json",mjs:"javascript",md:"markdown",mdx:"markdown",sh:"shell",ts:"typescript",tsx:"typescript",txt:"plain"},L=new Set(["cjs","css","htm","html","js","jsx","json","mjs","sh","ts","tsx"]);function b(t){const s=(t.filename??t.title??t.uri??"").split(/[?#]/)[0],n=s.split("/").pop()??s,r=n.lastIndexOf(".");return r>=0?n.slice(r+1).toLowerCase():""}function S(t){const e=t.mediaType?.toLowerCase()??"";return e.includes("json")?"json":e.includes("markdown")?"markdown":e.includes("javascript")?"javascript":e.includes("typescript")?"typescript":e.includes("html")?"html":e.includes("css")?"css":e.includes("shell")||e.includes("x-sh")?"shell":N[b(t)]??"plain"}function E(t){const e=t.mediaType?.toLowerCase()??"",s=b(t);if(e.includes("markdown")||s==="md"||s==="mdx")return"markdown";if(e.includes("json")||e.includes("javascript")||e.includes("typescript")||e.includes("html")||e.includes("xml")||e.includes("css")||L.has(s))return"code";if(e.startsWith("text/")||s==="txt")return"text";const n=t.value.trim();return/^#{1,6}\s+/m.test(n)||/```[\s\S]*```/.test(n)?"markdown":"text"}function it(t){const e=t.title??t.filename??t.uri?.split("/").pop()??"Untitled",s=t.language??S(t);return{id:t.id??t.uri??e,title:e,uri:t.uri,mediaType:t.mediaType,language:s,kind:t.kind??E(t),value:t.value,readOnly:t.readOnly}}function ct({document:t,mode:e,className:s}){const n=e??(t.kind==="markdown"?"preview":"read"),r=t.kind==="markdown"&&n==="preview"?i.jsx(k,{markdown:t.value}):i.jsx(W,{document:t});return i.jsx("div",{className:`s-text-document-surface s-text-document-surface-${t.kind}${s?` ${s}`:""}`,children:r})}function W({document:t}){const e=I.useMemo(()=>_(t.value,t.language??t.kind),[t.language,t.kind,t.value]);return i.jsx("pre",{className:"s-text-document-code","data-language":t.language??t.kind,children:i.jsx("code",{children:e})})}function k({markdown:t}){const e=A(t);return i.jsx("div",{className:"s-text-document-markdown",children:e.length>0?e:i.jsx("p",{})})}function A(t){const e=t.replace(/\r\n/g,`
1
+ import{j as i,r as I}from"./index-Bli6bTLU.js";const N={cjs:"javascript",css:"css",htm:"html",html:"html",js:"javascript",jsx:"javascript",json:"json",mjs:"javascript",md:"markdown",mdx:"markdown",sh:"shell",ts:"typescript",tsx:"typescript",txt:"plain"},L=new Set(["cjs","css","htm","html","js","jsx","json","mjs","sh","ts","tsx"]);function b(t){const s=(t.filename??t.title??t.uri??"").split(/[?#]/)[0],n=s.split("/").pop()??s,r=n.lastIndexOf(".");return r>=0?n.slice(r+1).toLowerCase():""}function S(t){const e=t.mediaType?.toLowerCase()??"";return e.includes("json")?"json":e.includes("markdown")?"markdown":e.includes("javascript")?"javascript":e.includes("typescript")?"typescript":e.includes("html")?"html":e.includes("css")?"css":e.includes("shell")||e.includes("x-sh")?"shell":N[b(t)]??"plain"}function E(t){const e=t.mediaType?.toLowerCase()??"",s=b(t);if(e.includes("markdown")||s==="md"||s==="mdx")return"markdown";if(e.includes("json")||e.includes("javascript")||e.includes("typescript")||e.includes("html")||e.includes("xml")||e.includes("css")||L.has(s))return"code";if(e.startsWith("text/")||s==="txt")return"text";const n=t.value.trim();return/^#{1,6}\s+/m.test(n)||/```[\s\S]*```/.test(n)?"markdown":"text"}function it(t){const e=t.title??t.filename??t.uri?.split("/").pop()??"Untitled",s=t.language??S(t);return{id:t.id??t.uri??e,title:e,uri:t.uri,mediaType:t.mediaType,language:s,kind:t.kind??E(t),value:t.value,readOnly:t.readOnly}}function ct({document:t,mode:e,className:s}){const n=e??(t.kind==="markdown"?"preview":"read"),r=t.kind==="markdown"&&n==="preview"?i.jsx(k,{markdown:t.value}):i.jsx(W,{document:t});return i.jsx("div",{className:`s-text-document-surface s-text-document-surface-${t.kind}${s?` ${s}`:""}`,children:r})}function W({document:t}){const e=I.useMemo(()=>_(t.value,t.language??t.kind),[t.language,t.kind,t.value]);return i.jsx("pre",{className:"s-text-document-code","data-language":t.language??t.kind,children:i.jsx("code",{children:e})})}function k({markdown:t}){const e=A(t);return i.jsx("div",{className:"s-text-document-markdown",children:e.length>0?e:i.jsx("p",{})})}function A(t){const e=t.replace(/\r\n/g,`
2
2
  `).split(`
3
3
  `),s=[];let n=0;for(;n<e.length;){const r=e[n]??"";if(!r.trim()){n+=1;continue}const c=/^```(\S*)\s*$/.exec(r);if(c){const l=[];for(n+=1;n<e.length&&!/^```\s*$/.test(e[n]??"");)l.push(e[n]??""),n+=1;n<e.length&&(n+=1),s.push({kind:"code",content:l.join(`
4
4
  `),language:c[1]||void 0});continue}const a=/^(#{1,6})\s+(.+)$/.exec(r);if(a){s.push({kind:"heading",depth:z(a[1].length),content:a[2].trim()}),n+=1;continue}if(/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(r)){s.push({kind:"hr"}),n+=1;continue}if(/^>\s?/.test(r)){const l=[];for(;n<e.length&&/^>\s?/.test(e[n]??"");)l.push((e[n]??"").replace(/^>\s?/,"")),n+=1;s.push({kind:"blockquote",content:l.join(" ")});continue}const o=/^(\s*)([-*+]|\d+[.)])\s+(.+)$/.exec(r);if(o){const l=/\d/.test(o[2]),m=[];for(;n<e.length;){const f=/^(\s*)([-*+]|\d+[.)])\s+(.+)$/.exec(e[n]??"");if(!f||/\d/.test(f[2])!==l)break;m.push(f[3]),n+=1}s.push({kind:"list",ordered:l,items:m});continue}const u=y(e,n);if(u){s.push(u.block),n=u.nextIndex;continue}const p=[];for(;n<e.length;){const l=e[n]??"";if(!l.trim()||/^```/.test(l)||/^(#{1,6})\s+/.test(l)||/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(l)||/^>\s?/.test(l)||/^(\s*)([-*+]|\d+[.)])\s+/.test(l)||y(e,n))break;p.push(l.trim()),n+=1}s.push({kind:"paragraph",content:p.join(" ")})}return s.map((r,c)=>C(r,c))}function z(t){return t<=1?1:t===2?2:t===3?3:t===4?4:t===5?5:6}function C(t,e){switch(t.kind){case"heading":{const n=`h${t.depth}`;return i.jsx(n,{children:d(t.content)},e)}case"paragraph":return i.jsx("p",{children:d(t.content)},e);case"blockquote":return i.jsx("blockquote",{children:d(t.content)},e);case"list":{const n=t.ordered?"ol":"ul";return i.jsx(n,{children:t.items.map((r,c)=>i.jsx("li",{children:d(r)},`${e}:${c}`))},e)}case"code":const s=$(t.language);return i.jsx("pre",{className:"s-text-document-fenced-code","data-language":s,children:i.jsx("code",{children:_(t.content,s)})},e);case"hr":return i.jsx("hr",{},e);case"table":return i.jsx("div",{className:"s-text-document-table-wrap",children:i.jsxs("table",{className:"s-text-document-table",children:[i.jsx("thead",{children:i.jsx("tr",{children:t.headers.map((n,r)=>i.jsx("th",{"data-align":t.alignments[r]??void 0,children:d(n)},`${e}:h:${r}`))})}),i.jsx("tbody",{children:t.rows.map((n,r)=>i.jsx("tr",{children:n.map((c,a)=>i.jsx("td",{"data-align":t.alignments[a]??void 0,children:d(c)},`${e}:r:${r}:${a}`))},`${e}:r:${r}`))})]})},e)}}function y(t,e){const s=w(t[e]??""),n=R(t[e+1]??"");if(!s||!n||s.length!==n.length)return null;const r=s.length,c=[];let a=e+2;for(;a<t.length;){const o=w(t[a]??"");if(!o||o.length<2)break;c.push(T(o,r)),a+=1}return{block:{kind:"table",alignments:n,headers:T(s,r),rows:c},nextIndex:a}}function w(t){const e=t.trim();if(!e.includes("|"))return null;let s=e;s.startsWith("|")&&(s=s.slice(1)),s.endsWith("|")&&!s.endsWith("\\|")&&(s=s.slice(0,-1));const n=[];let r="";for(let c=0;c<s.length;c+=1){const a=s[c];if(a==="\\"&&s[c+1]==="|"){r+="|",c+=1;continue}if(a==="|"){n.push(r.trim()),r="";continue}r+=a}return n.push(r.trim()),n.length>=2?n:null}function R(t){const e=w(t);if(!e||e.length<2)return null;const s=[];for(const n of e){const r=n.replace(/\s/g,"");if(!/^:?-{3,}:?$/u.test(r))return null;r.startsWith(":")&&r.endsWith(":")?s.push("center"):r.endsWith(":")?s.push("right"):r.startsWith(":")?s.push("left"):s.push(null)}return s}function T(t,e){const s=t.slice(0,e);for(;s.length<e;)s.push("");return s}const M=/\/\/[^\n]*|\/\*[\s\S]*?\*\/|`(?:\\[\s\S]|[^`\\])*`|'(?:\\.|[^'\\\n])*'|"(?:\\.|[^"\\\n])*"|\b\d+(?:\.\d+)?(?:e[+-]?\d+)?n?\b|\b[A-Za-z_$][\w$]*\b|=>|[{}()[\].,;:?]|[-+*/%=&|!<>~^]+/giu,D=/"(?:\\.|[^"\\])*"|-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b|\b(?:true|false|null)\b|[{}\[\]:,]/giu,O=/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|#[0-9a-f]{3,8}\b|@[a-z-]+|--[a-z0-9-]+|[a-z-]+(?=\s*:)|\b\d+(?:\.\d+)?(?:%|px|r?em|vh|vw|vmin|vmax|s|ms|deg|fr)?\b|[{}():;,]|\.[a-z_][\w-]*|#[a-z_][\w-]*|[a-z_][\w-]*/giu,v=/<!--[\s\S]*?-->|<!doctype[^>]*>|<\/?[a-z][\w:-]*|\/?>|[a-z_:][\w:.-]*(?==)|=|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|&[a-z0-9#]+;/giu,P=/#[^\n]*|"(?:\\.|[^"\\])*"|'[^']*'|\$\{?[\w?@#$!-]+\}?|--?[A-Za-z0-9][\w-]*(?:=[^\s]+)?|\b(?:case|cd|do|done|echo|elif|else|esac|exit|export|fi|for|function|if|in|local|return|set|source|test|then|unset|while)\b|\b\d+\b|[|&;(){}<>]/giu,H=new Set(["abstract","as","async","await","break","case","catch","class","const","continue","declare","default","delete","do","else","enum","export","extends","finally","for","from","function","get","if","implements","import","in","infer","interface","is","keyof","let","new","of","private","protected","public","readonly","return","satisfies","set","static","switch","throw","try","type","typeof","var","void","while","with","yield"]),B=new Set(["false","null","super","this","true","undefined"]);function _(t,e){switch($(e)){case"css":return g(t,O,Z);case"html":return g(t,v,U);case"javascript":case"typescript":return g(t,M,K);case"json":return g(t,D,q);case"shell":return g(t,P,Y);default:return[t]}}function g(t,e,s){const n=[];let r=0,c=0;e.lastIndex=0;let a;for(;(a=e.exec(t))!==null;){const o=a[0];if(!o){e.lastIndex+=1;continue}a.index>r&&n.push(t.slice(r,a.index));const u=s(o,a.index,a.index+o.length,t);n.push(u?i.jsx("span",{className:`s-syntax s-syntax-${u}`,children:o},`syntax-${c++}`):o),r=a.index+o.length}return r<t.length&&n.push(t.slice(r)),n.length>0?n:[t]}function $(t){const e=String(t??"").toLowerCase().replace(/^\./,"");return e==="bash"||e==="sh"||e==="shell"||e==="zsh"?"shell":e==="css"||e==="scss"?"css":e==="html"||e==="htm"||e==="xml"||e==="svg"?"html":e==="js"||e==="jsx"||e==="javascript"||e==="mjs"||e==="cjs"?"javascript":e==="json"||e==="jsonc"?"json":e==="markdown"||e==="md"||e==="mdx"?"markdown":e==="ts"||e==="tsx"||e==="typescript"?"typescript":"plain"}function K(t,e,s,n){return t.startsWith("//")||t.startsWith("/*")?"comment":x(t)?"string":/^\d/u.test(t)?"number":H.has(t)?"keyword":B.has(t)?"literal":/^[A-Z][\w$]*$/u.test(t)?"type":/^[A-Za-z_$][\w$]*$/u.test(t)&&n.slice(s).trimStart().startsWith("(")?"function":/^[{}()[\].,;:?]$/u.test(t)?"punctuation":/^(?:=>|[-+*/%=&|!<>~^]+)$/u.test(t)?"operator":null}function q(t,e,s,n){return x(t)?n.slice(s).trimStart().startsWith(":")?"property":"string":/^-?\d/u.test(t)?"number":t==="true"||t==="false"||t==="null"?"literal":"punctuation"}function Z(t,e,s,n){return t.startsWith("/*")?"comment":x(t)?"string":t.startsWith("@")?"keyword":t.startsWith("#")&&/^#[0-9a-f]/iu.test(t)||/^\d/u.test(t)?"number":t.startsWith(".")||t.startsWith("#")?"tag":/^--/u.test(t)||n.slice(s).trimStart().startsWith(":")?"property":/^[{}():;,]$/u.test(t)?"punctuation":null}function U(t){return t.startsWith("<!--")?"comment":/^<!doctype/iu.test(t)||t.startsWith("&")?"meta":t.startsWith("<")?"tag":x(t)?"string":t==="="?"operator":t===">"||t==="/>"?"punctuation":"attribute"}function Y(t){return t.startsWith("#")?"comment":x(t)?"string":t.startsWith("$")?"property":t.startsWith("-")?"attribute":/^\d/u.test(t)?"number":/^[|&;(){}<>]$/u.test(t)?"operator":G.has(t)?"keyword":null}const G=new Set(["case","cd","do","done","echo","elif","else","esac","exit","export","fi","for","function","if","in","local","return","set","source","test","then","unset","while"]);function x(t){return t.startsWith('"')||t.startsWith("'")||t.startsWith("`")}const J=/`([^`]+)`/y,X=/\[([^\]]+)\]\(([^)\s]+)\)/y,F=/\*\*\*(.+?)\*\*\*/y,Q=/\*\*(.+?)\*\*/y,V=/__(.+?)__(?!\w)/y,tt=/~~(.+?)~~/y,et=/\*(?!\s)([^*]+?)\*/y,nt=/_(?!\s)([^_]+?)_(?!\w)/y;function h(t,e,s){t.lastIndex=s;const n=t.exec(e);return n&&n.index===s?n:null}function d(t){const e=[];let s="",n=0,r=0;const c=()=>{s&&(e.push(s),s="")};for(;n<t.length;){const a=n===0||/[^\w]/.test(t[n-1]??""),o=h(J,t,n);if(o){c(),e.push(i.jsx("code",{children:o[1]},r++)),n+=o[0].length;continue}const u=h(X,t,n);if(u){c();const j=st(u[2]);e.push(j?i.jsx("a",{href:j,target:"_blank",rel:"noreferrer",children:d(u[1])},r++):i.jsx("span",{children:d(u[1])},r++)),n+=u[0].length;continue}const p=h(F,t,n);if(p){c(),e.push(i.jsx("strong",{children:i.jsx("em",{children:d(p[1])})},r++)),n+=p[0].length;continue}const l=h(Q,t,n)??(a?h(V,t,n):null);if(l){c(),e.push(i.jsx("strong",{children:d(l[1])},r++)),n+=l[0].length;continue}const m=h(tt,t,n);if(m){c(),e.push(i.jsx("del",{children:d(m[1])},r++)),n+=m[0].length;continue}const f=h(et,t,n)??(a?h(nt,t,n):null);if(f){c(),e.push(i.jsx("em",{children:d(f[1])},r++)),n+=f[0].length;continue}s+=t[n],n+=1}return c(),e}function st(t){if(!t)return null;try{const e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"||e.protocol==="mailto:"?t:null}catch{return null}}export{ct as T,it as c};
@@ -1 +1 @@
1
- import{r as l,j as a}from"./index-o4FKpU7Z.js";import{a as D}from"./api-h5zurxmi.js";import{f as v}from"./time-Dhsh_2EG.js";/* empty css */import{R as F}from"./refresh-cw-B5To7b6B.js";const M=44,B=132,H=3500,V=7e3;function W(e,t){return!!(e&&e.available===t.available&&e.sessionId===t.sessionId&&e.body===t.body&&e.lineCount===t.lineCount&&e.columnCount===t.columnCount&&e.truncated===t.truncated&&e.reason===t.reason)}function q(e){const t=new URLSearchParams({lines:String(e.lines),cols:String(e.columns)});return e.agentId?`/api/agents/${encodeURIComponent(e.agentId)}/tmux-peek?${t.toString()}`:e.surface?(t.set("backend",e.surface.backend),t.set("sessionName",e.surface.sessionName),`/api/terminal-sessions/peek?${t.toString()}`):null}function ee({agentId:e,surface:t,enabled:x=!0,lines:E=M,columns:L=B,pollMs:h=H,idlePollMs:u=V,className:N}){const[n,T]=l.useState(null),[k,m]=l.useState(!1),[A,b]=l.useState(null),[U,K]=l.useState(0),c=q({agentId:e,surface:t,lines:E,columns:L});if(l.useEffect(()=>{T(null),b(null),m(!1)},[c]),l.useEffect(()=>{if(!x||!c){m(!1);return}let r=!1,f,y=!0;const R=d=>{window.clearTimeout(f),f=window.setTimeout(()=>{S()},d)},S=async()=>{if(r)return;if(document.visibilityState!=="visible"){R(u);return}y&&m(!0);let d=h;try{const i=await D(c);if(r)return;b(null),T(o=>o&&W(o.payload,i)?o.steady?o:{...o,steady:!0}:{payload:i,observedAt:o?.observedAt??i.capturedAt,changedAt:o?i.capturedAt:null,steady:!1}),d=i.available?h:u}catch(i){if(r)return;b(i instanceof Error?i.message:String(i)),d=u}finally{r||(y&&m(!1),y=!1,R(d))}},$=()=>{document.visibilityState==="visible"&&(window.clearTimeout(f),S())};return S(),document.addEventListener("visibilitychange",$),()=>{r=!0,window.clearTimeout(f),document.removeEventListener("visibilitychange",$)}},[x,u,c,h,U]),!x||!c)return null;const s=n?.payload??null,g=s?.body??"",p=s?.lineCount??E,j=s?.columnCount??L,w=6,I=1.32,O={"--tmux-peek-columns":String(j),"--tmux-peek-rows":String(p),"--tmux-peek-font-size":`${w}px`,"--tmux-peek-line-height":String(I),"--tmux-peek-height":`${Math.ceil(p*w*I+18)}px`},C=!!(s?.available&&g),X=A||(k&&!n?"Loading terminal peek...":s?.available===!1?s.reason??"No tmux pane is available.":C?null:s?.available?"Pane is empty.":"Loading terminal peek..."),_=n?n.changedAt&&!n.steady?"Changed":n.steady?"At rest":"Peeked":null,P=n?.changedAt??n?.observedAt??null,z=n?n.changedAt?n.steady?`No terminal content change since ${v(n.changedAt)}`:`Terminal content changed ${v(n.changedAt)}`:`First terminal peek observed ${v(n.observedAt)}`:void 0;return a.jsxs("div",{className:`ctx-panel-tmux-peek${N?` ${N}`:""}`,style:O,children:[a.jsxs("div",{className:"ctx-panel-tmux-peek-head",children:[a.jsx("span",{children:"Terminal peek"}),a.jsxs("span",{className:"ctx-panel-tmux-peek-grid",children:[j,"x",p]}),s?.sessionId&&a.jsx("span",{className:"ctx-panel-tmux-peek-session",title:s.sessionId,children:s.sessionId.length>12?s.sessionId.slice(0,10):s.sessionId}),_&&P&&a.jsx("time",{className:"ctx-panel-tmux-peek-state",dateTime:new Date(P).toISOString(),title:z,children:_}),a.jsxs("button",{type:"button",className:"ctx-panel-tmux-peek-refresh",onClick:()=>K(r=>r+1),disabled:k,title:"Refresh terminal peek","aria-label":"Refresh terminal peek",children:[a.jsx(F,{size:12,strokeWidth:1.8}),a.jsx("span",{children:k?"Refreshing":"Refresh"})]})]}),C?a.jsx("pre",{className:"ctx-panel-tmux-peek-screen",children:g}):a.jsx("div",{className:"ctx-panel-tmux-peek-empty",children:X}),s?.truncated&&g&&a.jsxs("div",{className:"ctx-panel-tmux-peek-foot",children:["Last ",p," rows from tmux pane"]})]})}export{ee as T};
1
+ import{r as l,j as a}from"./index-Bli6bTLU.js";import{a as D}from"./api-DEHEgJ9m.js";import{f as v}from"./time-Dhsh_2EG.js";/* empty css */import{R as F}from"./refresh-cw-IgN2fZLM.js";const M=44,B=132,H=3500,V=7e3;function W(e,t){return!!(e&&e.available===t.available&&e.sessionId===t.sessionId&&e.body===t.body&&e.lineCount===t.lineCount&&e.columnCount===t.columnCount&&e.truncated===t.truncated&&e.reason===t.reason)}function q(e){const t=new URLSearchParams({lines:String(e.lines),cols:String(e.columns)});return e.agentId?`/api/agents/${encodeURIComponent(e.agentId)}/tmux-peek?${t.toString()}`:e.surface?(t.set("backend",e.surface.backend),t.set("sessionName",e.surface.sessionName),`/api/terminal-sessions/peek?${t.toString()}`):null}function ee({agentId:e,surface:t,enabled:x=!0,lines:E=M,columns:L=B,pollMs:h=H,idlePollMs:u=V,className:N}){const[n,T]=l.useState(null),[k,m]=l.useState(!1),[A,b]=l.useState(null),[U,K]=l.useState(0),c=q({agentId:e,surface:t,lines:E,columns:L});if(l.useEffect(()=>{T(null),b(null),m(!1)},[c]),l.useEffect(()=>{if(!x||!c){m(!1);return}let r=!1,f,y=!0;const R=d=>{window.clearTimeout(f),f=window.setTimeout(()=>{S()},d)},S=async()=>{if(r)return;if(document.visibilityState!=="visible"){R(u);return}y&&m(!0);let d=h;try{const i=await D(c);if(r)return;b(null),T(o=>o&&W(o.payload,i)?o.steady?o:{...o,steady:!0}:{payload:i,observedAt:o?.observedAt??i.capturedAt,changedAt:o?i.capturedAt:null,steady:!1}),d=i.available?h:u}catch(i){if(r)return;b(i instanceof Error?i.message:String(i)),d=u}finally{r||(y&&m(!1),y=!1,R(d))}},$=()=>{document.visibilityState==="visible"&&(window.clearTimeout(f),S())};return S(),document.addEventListener("visibilitychange",$),()=>{r=!0,window.clearTimeout(f),document.removeEventListener("visibilitychange",$)}},[x,u,c,h,U]),!x||!c)return null;const s=n?.payload??null,g=s?.body??"",p=s?.lineCount??E,j=s?.columnCount??L,w=6,I=1.32,O={"--tmux-peek-columns":String(j),"--tmux-peek-rows":String(p),"--tmux-peek-font-size":`${w}px`,"--tmux-peek-line-height":String(I),"--tmux-peek-height":`${Math.ceil(p*w*I+18)}px`},C=!!(s?.available&&g),X=A||(k&&!n?"Loading terminal peek...":s?.available===!1?s.reason??"No tmux pane is available.":C?null:s?.available?"Pane is empty.":"Loading terminal peek..."),_=n?n.changedAt&&!n.steady?"Changed":n.steady?"At rest":"Peeked":null,P=n?.changedAt??n?.observedAt??null,z=n?n.changedAt?n.steady?`No terminal content change since ${v(n.changedAt)}`:`Terminal content changed ${v(n.changedAt)}`:`First terminal peek observed ${v(n.observedAt)}`:void 0;return a.jsxs("div",{className:`ctx-panel-tmux-peek${N?` ${N}`:""}`,style:O,children:[a.jsxs("div",{className:"ctx-panel-tmux-peek-head",children:[a.jsx("span",{children:"Terminal peek"}),a.jsxs("span",{className:"ctx-panel-tmux-peek-grid",children:[j,"x",p]}),s?.sessionId&&a.jsx("span",{className:"ctx-panel-tmux-peek-session",title:s.sessionId,children:s.sessionId.length>12?s.sessionId.slice(0,10):s.sessionId}),_&&P&&a.jsx("time",{className:"ctx-panel-tmux-peek-state",dateTime:new Date(P).toISOString(),title:z,children:_}),a.jsxs("button",{type:"button",className:"ctx-panel-tmux-peek-refresh",onClick:()=>K(r=>r+1),disabled:k,title:"Refresh terminal peek","aria-label":"Refresh terminal peek",children:[a.jsx(F,{size:12,strokeWidth:1.8}),a.jsx("span",{children:k?"Refreshing":"Refresh"})]})]}),C?a.jsx("pre",{className:"ctx-panel-tmux-peek-screen",children:g}):a.jsx("div",{className:"ctx-panel-tmux-peek-empty",children:X}),s?.truncated&&g&&a.jsxs("div",{className:"ctx-panel-tmux-peek-foot",children:["Last ",p," rows from tmux pane"]})]})}export{ee as T};
@@ -1 +1 @@
1
- import{j as n,r as h}from"./index-o4FKpU7Z.js";import{r as w,o as g}from"./scout-voice-B7kXlkcl.js";import"./fx-z37u1o2z.js";const p={microphone:{label:"Microphone",privacyPane:"Microphone",hint:"Scout Menu captures audio for web dictation. The browser never records.",appLabel:"Scout Menu"},speechRecognition:{label:"Speech recognition",privacyPane:"Speech Recognition",hint:"Live partials and Apple Speech fallback while Parakeet warms.",appLabel:"Scout Menu"}};function x(e){return e?e.granted?"ok":e.canRequest?"warn":e.status==="denied"||e.status==="restricted"?"fail":"warn":"idle"}function y(e){if(!e)return"Unknown";if(e.granted)return"Granted";switch(e.status){case"notDetermined":return"Not requested";case"denied":return"Denied";case"restricted":return"Restricted";case"authorized":return"Granted";default:return e.status}}function M(e,s){return e?e.granted?`${p[s].appLabel} is allowed to use ${p[s].label.toLowerCase()}.`:e.canRequest?`Click Request to show the macOS permission dialog for ${p[s].appLabel}.`:e.status==="denied"?`Choose Retry access. Scout Menu will open macOS ${p[s].privacyPane} settings and detect the change automatically.`:e.status==="restricted"?`${p[s].label} access is restricted on this Mac.`:`${p[s].appLabel} needs ${p[s].label.toLowerCase()} access before dictation works.`:"Launch Scout Menu on this Mac, then refresh."}function j(e){return!!(e&&!e.granted&&!e.canRequest&&e.status!=="unknown")}function R(e){return!!(e&&!e.granted&&e.status!=="restricted"&&e.status!=="unknown")}function L({hostOnline:e,micPermission:s,speechPermission:r,modelReady:l}){const c=s?.granted??!1,d=r?.granted??!1,u=e&&c&&d;let i="fail",t="Scout Menu not connected",a="Launch Scout Menu on this Mac. Web dictation uses the Scout voice host — not the browser microphone.";return e&&!c&&(s?.status==="denied"||s?.status==="restricted")?(i="fail",t="Microphone blocked for Scout Menu",a=s?.status==="restricted"?"Microphone access is restricted on this Mac.":"Choose Retry access below. Scout will open the right macOS pane and detect the change."):e&&!c&&s?.canRequest?(i="warn",t="Microphone access needed",a="Request permission below or tap the mic in chat. Scout Menu will show the macOS prompt."):e&&c&&!d&&(r?.status==="denied"||r?.status==="restricted")?(i="warn",t="Speech recognition blocked for Scout Menu",a=r?.status==="restricted"?"Speech recognition is restricted on this Mac.":"Open Privacy & Security → Speech Recognition to change it."):e&&c&&!d?(i="warn",t="Speech recognition needed",a="Request access below or tap the mic in chat. Scout Menu will show the macOS prompt."):e&&u?(i="ok",t=l?"Dictation ready":"Dictation ready · model warming",a="Scout Menu is running as the voice host. The browser does not capture audio."):e&&(i="warn",t="Voice host connected",a="Finish permissions below to enable dictation."),n.jsxs("div",{className:`s-voice-host-banner s-voice-host-banner--${i}`,children:[n.jsx("div",{className:"s-voice-host-banner-dot","aria-hidden":!0}),n.jsxs("div",{className:"s-voice-host-banner-copy",children:[n.jsx("div",{className:"s-voice-host-banner-title",children:t}),n.jsx("div",{className:"s-voice-host-banner-detail",children:a}),n.jsxs("div",{className:"s-voice-host-banner-meta",children:[n.jsx("span",{children:"Voice host · Scout Menu"}),n.jsx("span",{children:e?"Connected":"Offline"}),n.jsx("span",{children:"Capture · native"})]})]})]})}function f({kind:e,status:s,disabled:r,onActionError:l,onRefresh:c}){const[d,u]=h.useState(!1),i=h.useRef(s),t=p[e],a=x(s);h.useEffect(()=>{i.current=s},[s]);const m=h.useCallback(async()=>{for(let o=0;o<30;o+=1)if(await new Promise(S=>window.setTimeout(S,1e3)),await c(),i.current?.granted)return},[c]),v=h.useCallback(async()=>{u(!0);try{await w(e),await m()}catch(o){l(o instanceof Error?o.message:String(o))}finally{u(!1)}},[e,l,m]),b=h.useCallback(async()=>{u(!0);try{await g(e)}catch(o){l(o instanceof Error?o.message:String(o))}finally{u(!1)}},[e,l]);return n.jsxs("div",{className:`s-voice-permission-card s-voice-permission-card--${a}`,children:[n.jsxs("div",{className:"s-voice-permission-card-head",children:[n.jsx("span",{className:"s-voice-permission-card-dot","aria-hidden":!0}),n.jsxs("div",{children:[n.jsx("div",{className:"s-voice-permission-card-label",children:t.label}),n.jsxs("div",{className:"s-voice-permission-card-app",children:["via ",t.appLabel]})]}),n.jsx("span",{className:`s-voice-permission-card-status s-voice-permission-card-status--${a}`,children:y(s)})]}),n.jsx("p",{className:"s-voice-permission-card-hint",children:t.hint}),n.jsx("p",{className:"s-voice-permission-card-detail",children:M(s,e)}),n.jsxs("div",{className:"s-voice-permission-card-actions",children:[R(s)?n.jsx("button",{type:"button",className:"s-voice-permission-btn s-voice-permission-btn--primary",disabled:r||d,onClick:()=>{v()},children:d?s?.canRequest?"Requesting…":"Waiting for macOS…":s?.canRequest?"Request access":"Retry access"}):null,j(s)?n.jsxs("button",{type:"button",className:"s-voice-permission-btn",disabled:r||d,onClick:()=>{b()},children:["Open Privacy & Security → ",t.privacyPane]}):null]})]})}function P({permissions:e,hostOnline:s,disabled:r,onError:l,onRefresh:c}){const d=e?.find(i=>i.kind==="microphone")??null,u=e?.find(i=>i.kind==="speechRecognition")??null;return n.jsxs("div",{className:"s-voice-permissions-panel",children:[n.jsx(f,{kind:"microphone",status:s?d:null,disabled:r||!s,onActionError:l,onRefresh:c}),n.jsx(f,{kind:"speechRecognition",status:s?u:null,disabled:r||!s,onActionError:l,onRefresh:c}),s?null:n.jsx("p",{className:"s-voice-permissions-offline",children:"Scout Menu is not reporting to this web server. Permissions are managed on the Mac where Scout Menu runs."})]})}export{L as VoiceHostStatusBanner,P as VoicePermissionsPanel};
1
+ import{j as n,r as h}from"./index-Bli6bTLU.js";import{r as w,o as g}from"./scout-voice-DvG_3stJ.js";import"./fx-z37u1o2z.js";const p={microphone:{label:"Microphone",privacyPane:"Microphone",hint:"Scout Menu captures audio for web dictation. The browser never records.",appLabel:"Scout Menu"},speechRecognition:{label:"Speech recognition",privacyPane:"Speech Recognition",hint:"Live partials and Apple Speech fallback while Parakeet warms.",appLabel:"Scout Menu"}};function x(e){return e?e.granted?"ok":e.canRequest?"warn":e.status==="denied"||e.status==="restricted"?"fail":"warn":"idle"}function y(e){if(!e)return"Unknown";if(e.granted)return"Granted";switch(e.status){case"notDetermined":return"Not requested";case"denied":return"Denied";case"restricted":return"Restricted";case"authorized":return"Granted";default:return e.status}}function M(e,s){return e?e.granted?`${p[s].appLabel} is allowed to use ${p[s].label.toLowerCase()}.`:e.canRequest?`Click Request to show the macOS permission dialog for ${p[s].appLabel}.`:e.status==="denied"?`Choose Retry access. Scout Menu will open macOS ${p[s].privacyPane} settings and detect the change automatically.`:e.status==="restricted"?`${p[s].label} access is restricted on this Mac.`:`${p[s].appLabel} needs ${p[s].label.toLowerCase()} access before dictation works.`:"Launch Scout Menu on this Mac, then refresh."}function j(e){return!!(e&&!e.granted&&!e.canRequest&&e.status!=="unknown")}function R(e){return!!(e&&!e.granted&&e.status!=="restricted"&&e.status!=="unknown")}function L({hostOnline:e,micPermission:s,speechPermission:r,modelReady:l}){const c=s?.granted??!1,d=r?.granted??!1,u=e&&c&&d;let i="fail",t="Scout Menu not connected",a="Launch Scout Menu on this Mac. Web dictation uses the Scout voice host — not the browser microphone.";return e&&!c&&(s?.status==="denied"||s?.status==="restricted")?(i="fail",t="Microphone blocked for Scout Menu",a=s?.status==="restricted"?"Microphone access is restricted on this Mac.":"Choose Retry access below. Scout will open the right macOS pane and detect the change."):e&&!c&&s?.canRequest?(i="warn",t="Microphone access needed",a="Request permission below or tap the mic in chat. Scout Menu will show the macOS prompt."):e&&c&&!d&&(r?.status==="denied"||r?.status==="restricted")?(i="warn",t="Speech recognition blocked for Scout Menu",a=r?.status==="restricted"?"Speech recognition is restricted on this Mac.":"Open Privacy & Security → Speech Recognition to change it."):e&&c&&!d?(i="warn",t="Speech recognition needed",a="Request access below or tap the mic in chat. Scout Menu will show the macOS prompt."):e&&u?(i="ok",t=l?"Dictation ready":"Dictation ready · model warming",a="Scout Menu is running as the voice host. The browser does not capture audio."):e&&(i="warn",t="Voice host connected",a="Finish permissions below to enable dictation."),n.jsxs("div",{className:`s-voice-host-banner s-voice-host-banner--${i}`,children:[n.jsx("div",{className:"s-voice-host-banner-dot","aria-hidden":!0}),n.jsxs("div",{className:"s-voice-host-banner-copy",children:[n.jsx("div",{className:"s-voice-host-banner-title",children:t}),n.jsx("div",{className:"s-voice-host-banner-detail",children:a}),n.jsxs("div",{className:"s-voice-host-banner-meta",children:[n.jsx("span",{children:"Voice host · Scout Menu"}),n.jsx("span",{children:e?"Connected":"Offline"}),n.jsx("span",{children:"Capture · native"})]})]})]})}function f({kind:e,status:s,disabled:r,onActionError:l,onRefresh:c}){const[d,u]=h.useState(!1),i=h.useRef(s),t=p[e],a=x(s);h.useEffect(()=>{i.current=s},[s]);const m=h.useCallback(async()=>{for(let o=0;o<30;o+=1)if(await new Promise(S=>window.setTimeout(S,1e3)),await c(),i.current?.granted)return},[c]),v=h.useCallback(async()=>{u(!0);try{await w(e),await m()}catch(o){l(o instanceof Error?o.message:String(o))}finally{u(!1)}},[e,l,m]),b=h.useCallback(async()=>{u(!0);try{await g(e)}catch(o){l(o instanceof Error?o.message:String(o))}finally{u(!1)}},[e,l]);return n.jsxs("div",{className:`s-voice-permission-card s-voice-permission-card--${a}`,children:[n.jsxs("div",{className:"s-voice-permission-card-head",children:[n.jsx("span",{className:"s-voice-permission-card-dot","aria-hidden":!0}),n.jsxs("div",{children:[n.jsx("div",{className:"s-voice-permission-card-label",children:t.label}),n.jsxs("div",{className:"s-voice-permission-card-app",children:["via ",t.appLabel]})]}),n.jsx("span",{className:`s-voice-permission-card-status s-voice-permission-card-status--${a}`,children:y(s)})]}),n.jsx("p",{className:"s-voice-permission-card-hint",children:t.hint}),n.jsx("p",{className:"s-voice-permission-card-detail",children:M(s,e)}),n.jsxs("div",{className:"s-voice-permission-card-actions",children:[R(s)?n.jsx("button",{type:"button",className:"s-voice-permission-btn s-voice-permission-btn--primary",disabled:r||d,onClick:()=>{v()},children:d?s?.canRequest?"Requesting…":"Waiting for macOS…":s?.canRequest?"Request access":"Retry access"}):null,j(s)?n.jsxs("button",{type:"button",className:"s-voice-permission-btn",disabled:r||d,onClick:()=>{b()},children:["Open Privacy & Security → ",t.privacyPane]}):null]})]})}function P({permissions:e,hostOnline:s,disabled:r,onError:l,onRefresh:c}){const d=e?.find(i=>i.kind==="microphone")??null,u=e?.find(i=>i.kind==="speechRecognition")??null;return n.jsxs("div",{className:"s-voice-permissions-panel",children:[n.jsx(f,{kind:"microphone",status:s?d:null,disabled:r||!s,onActionError:l,onRefresh:c}),n.jsx(f,{kind:"speechRecognition",status:s?u:null,disabled:r||!s,onActionError:l,onRefresh:c}),s?null:n.jsx("p",{className:"s-voice-permissions-offline",children:"Scout Menu is not reporting to this web server. Permissions are managed on the Mac where Scout Menu runs."})]})}export{L as VoiceHostStatusBanner,P as VoicePermissionsPanel};