@openscout/scout 0.2.105 → 0.2.107

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 (575) hide show
  1. package/README.md +26 -0
  2. package/bin/scoutd +0 -0
  3. package/dist/build-manifest.json +3 -3
  4. package/dist/chat.mjs +23 -1
  5. package/dist/client/assets/ActivityScreen-CZmGwQ2U.js +1 -0
  6. package/dist/client/assets/{AddProjectForm-CHNJ4NnS.js → AddProjectForm-CusDRiVO.js} +1 -1
  7. package/dist/client/assets/{AdventureEvidence-B4mEvXeD.js → AdventureEvidence-CyegKk1V.js} +1 -1
  8. package/dist/client/assets/{AdventureReader-ZsBDQITY.js → AdventureReader-X-hbTOi0.js} +1 -1
  9. package/dist/client/assets/{AdventureScenery-DSxDlqG1.js → AdventureScenery-LPXSVP67.js} +1 -1
  10. package/dist/client/assets/AgentAdventures-BAgxdOF8.js +1 -0
  11. package/dist/client/assets/AgentAvatar-CrP1eXxk.js +1 -0
  12. package/dist/client/assets/AgentConfigurationScreen-1L0IQm2w.js +1 -0
  13. package/dist/client/assets/AgentDefinitionsWorkspace-DguGs7jZ.js +1 -0
  14. package/dist/client/assets/{AgentDetailCard-MIEBKw_S.js → AgentDetailCard-DtHT3sCo.js} +1 -1
  15. package/dist/client/assets/AgentFloorView-DH4jiDgw.js +1 -0
  16. package/dist/client/assets/{AgentFloorWorld-BTqwmK5G.js → AgentFloorWorld-CjoIa6jA.js} +1 -1
  17. package/dist/client/assets/AgentInfoScreen-DYtmKkeE.js +1 -0
  18. package/dist/client/assets/{AgentLaneCard-C4rKLLdT.js → AgentLaneCard-BaZ2g-f8.js} +1 -1
  19. package/dist/client/assets/{AgentLaneChrome-fGC-ZrJS.js → AgentLaneChrome-TF1SlJSc.js} +1 -1
  20. package/dist/client/assets/{AgentLaneDetailSheet-BTF4_th9.js → AgentLaneDetailSheet-EzEPsn3g.js} +1 -1
  21. package/dist/client/assets/{AgentLaneSummaryResize-DgSeA_vS.js → AgentLaneSummaryResize-dpp7YvrX.js} +1 -1
  22. package/dist/client/assets/AgentLanesEmbedScreen-BlSof_6S.js +1 -0
  23. package/dist/client/assets/{AgentLanesPreflight-CcS23wij.js → AgentLanesPreflight-Ry-aqDTr.js} +1 -1
  24. package/dist/client/assets/AgentLanesView-BJi9xXz6.js +2 -0
  25. package/dist/client/assets/{AgentLiveActions-6Kfr1uOT.js → AgentLiveActions-CfTupTEl.js} +1 -1
  26. package/dist/client/assets/AgentMasterScreen-EJhmuKgl.js +1 -0
  27. package/dist/client/assets/AgentSessions-B1gOhDBf.js +6 -0
  28. package/dist/client/assets/AgentsConsole-RXGqRvcb.js +1 -0
  29. package/dist/client/assets/AgentsScreen-ChwMBs11.js +1 -0
  30. package/dist/client/assets/AgentsSubnav-DwNX4yy0.js +1 -0
  31. package/dist/client/assets/{AstronautSuit-D67fIBdR.js → AstronautSuit-Cchnc4Ug.js} +1 -1
  32. package/dist/client/assets/{AtopView-Ck30FbzG.js → AtopView-gkEp4y__.js} +1 -1
  33. package/dist/client/assets/{BackToPicker-CkBhGRlD.js → BackToPicker-CUkjnoVk.js} +1 -1
  34. package/dist/client/assets/BriefingDetailScreen-DrlC3qkm.js +1 -0
  35. package/dist/client/assets/{BriefingsScreen-DTxYMr3a.js → BriefingsScreen-B1HlBMGZ.js} +1 -1
  36. package/dist/client/assets/{BrokerMetadataPanel-crirZCdo.js → BrokerMetadataPanel-Dk242Yh_.js} +1 -1
  37. package/dist/client/assets/BrokerScreen-DwOF6bMA.js +8 -0
  38. package/dist/client/assets/{Canvas-CRP0KjKb.js → Canvas-X9pVSkw3.js} +1 -1
  39. package/dist/client/assets/{CastPicker-ZPomvOf-.js → CastPicker-BXUtPAGC.js} +1 -1
  40. package/dist/client/assets/ChannelComposer-DoK7IDGa.js +1 -0
  41. package/dist/client/assets/ChannelSidebar-e9DOPulb.js +1 -0
  42. package/dist/client/assets/{CharacterFamilyPreview-ckVkecDO.js → CharacterFamilyPreview-DMfw7UM_.js} +1 -1
  43. package/dist/client/assets/{ChatAvatar-DKBsbOqk.js → ChatAvatar-C3a_o5Hj.js} +1 -1
  44. package/dist/client/assets/ChatBits-CsvxbToF.js +1 -0
  45. package/dist/client/assets/{ChatCollapsedStrip-Co0NmqOO.js → ChatCollapsedStrip-FEmQ_G9J.js} +1 -1
  46. package/dist/client/assets/ChatRichInput-DhtwFxQE.js +31 -0
  47. package/dist/client/assets/ChatRightPanel-C1h_aIkn.js +1 -0
  48. package/dist/client/assets/ChatSpaceSurface-BXyLYKHn.js +1 -0
  49. package/dist/client/assets/ChatSpaceTheme-3wLZGsvT.css +1 -0
  50. package/dist/client/assets/ChatSpaceTheme-CUH8bTZc.js +1 -0
  51. package/dist/client/assets/{CodeDiffPane-D-iv28LJ.js → CodeDiffPane-DuQRwpgK.js} +1 -1
  52. package/dist/client/assets/{CodeProjectPicker-CZ3gDdiT.js → CodeProjectPicker-ZQ6gSBpg.js} +1 -1
  53. package/dist/client/assets/{CodeScreen-CSC-zbP9.js → CodeScreen-BXyKeL5T.js} +1 -1
  54. package/dist/client/assets/{CommsCanvas-DdNAwjGW.js → CommsCanvas-THp0r_U8.js} +1 -1
  55. package/dist/client/assets/{CommsDeck-mGWY7Ivi.js → CommsDeck-BVmSMV2V.js} +1 -1
  56. package/dist/client/assets/{CommsFlowGraph-voDD9M5R.js → CommsFlowGraph-DxoOaLF_.js} +1 -1
  57. package/dist/client/assets/{CommsFlowMap-C33sgD48.js → CommsFlowMap-Vi8ziCPg.js} +1 -1
  58. package/dist/client/assets/{CommsSelection-BL8aYD7z.js → CommsSelection-BUoRbu9o.js} +1 -1
  59. package/dist/client/assets/ComposerAttachments-DW0AIb8k.js +1 -0
  60. package/dist/client/assets/ConversationComposer-CUQyArlk.js +1 -0
  61. package/dist/client/assets/ConversationFeedRows-DWiOfT-y.js +1 -0
  62. package/dist/client/assets/ConversationHeader-C-ZWscKj.js +1 -0
  63. package/dist/client/assets/{ConversationPanels-6pprBpmq.js → ConversationPanels-D9oC0xG5.js} +2 -2
  64. package/dist/client/assets/ConversationScreen-9MlMnEo4.css +1 -0
  65. package/dist/client/assets/ConversationScreen-CUfsQ4MR.js +2 -0
  66. package/dist/client/assets/ConversationStatus--IPm2nGh.js +1 -0
  67. package/dist/client/assets/{CrewAvatar-D0c9z5Qr.css → CrewAvatar-BnIPIn_Z.css} +1 -1
  68. package/dist/client/assets/CrewAvatar-kTznzqcO.js +1 -0
  69. package/dist/client/assets/{CrewSprite-Dp9KBBGY.js → CrewSprite-Dhryjx2c.js} +1 -1
  70. package/dist/client/assets/CrewStage-vdO0qm3D.js +1 -0
  71. package/dist/client/assets/CrewWorkspaces-DCBzAAS4.js +1 -0
  72. package/dist/client/assets/{DataTable-av71ehJV.js → DataTable-aH-jCyDq.js} +1 -1
  73. package/dist/client/assets/{DispatchAftermath-CcYGUB10.js → DispatchAftermath-66uQAorV.js} +1 -1
  74. package/dist/client/assets/{DocumentFocusViewer-DlMiEALb.js → DocumentFocusViewer-DJr0v0D_.js} +1 -1
  75. package/dist/client/assets/{EmbeddableSurfacesLab-CTkO_tQR.js → EmbeddableSurfacesLab-BBa70EhJ.js} +1 -1
  76. package/dist/client/assets/{EmptyState-CYUwYyAW.js → EmptyState-CZlrHXy-.js} +1 -1
  77. package/dist/client/assets/{FileViewerPane-Cxhixtks.js → FileViewerPane-BAO6mtjD.js} +1 -1
  78. package/dist/client/assets/FleetRollCallHud-C5q2567n.js +1 -0
  79. package/dist/client/assets/FlightObserveScreen-DZ2mrw91.js +1 -0
  80. package/dist/client/assets/{FloorContextSheet-Vj_wVZq1.js → FloorContextSheet-2_NVPQor.js} +1 -1
  81. package/dist/client/assets/{FloorExchangePanel-CjHSDXad.js → FloorExchangePanel-BU1pPu8K.js} +1 -1
  82. package/dist/client/assets/{FloorMessagePasses-BG4ebnX5.js → FloorMessagePasses-cLW2UGNP.js} +1 -1
  83. package/dist/client/assets/{FloorReplay-BoYaGY9t.js → FloorReplay-VFzA6Kxc.js} +1 -1
  84. package/dist/client/assets/FloorResourcesSheet-C-kQ6Ren.js +1 -0
  85. package/dist/client/assets/{FloorSavedWork-jbtRs-YE.js → FloorSavedWork-BeHDejWz.js} +1 -1
  86. package/dist/client/assets/FloorTacticalHUD-CO-iiFpb.js +1 -0
  87. package/dist/client/assets/{FollowScreen-CupyOgt4.js → FollowScreen-CFfkIbc6.js} +1 -1
  88. package/dist/client/assets/HarnessMark-C4naWc16.js +1 -0
  89. package/dist/client/assets/HarnessesScreen-DX3NLcDG.js +1 -0
  90. package/dist/client/assets/{HerdrSession-Dcm3vf9U.js → HerdrSession-_t7yM8vX.js} +2 -2
  91. package/dist/client/assets/{HomeHero-pIZtE1cC.js → HomeHero-DouPyNmz.js} +1 -1
  92. package/dist/client/assets/{HostAdvisorView-Dv5meXo2.js → HostAdvisorView-CnM1i8hW.js} +1 -1
  93. package/dist/client/assets/InviteLandingScreen-CEjG2E34.js +1 -0
  94. package/dist/client/assets/InviteSheet-CwxZtWCl.js +1 -0
  95. package/dist/client/assets/{JumpPalette-BmiSOEmp.js → JumpPalette-O1aJE9gR.js} +1 -1
  96. package/dist/client/assets/{KnowledgeSearchInspector-B8yiM524.js → KnowledgeSearchInspector-32n9baT-.js} +1 -1
  97. package/dist/client/assets/KnowledgeSearchScreen-Dd6jrQ0A.js +1 -0
  98. package/dist/client/assets/{LaneToolHoverCard-D2cnTeUd.js → LaneToolHoverCard-CJa110yk.js} +1 -1
  99. package/dist/client/assets/LaneTraceDetailSheet-DYrd0BIf.js +1 -0
  100. package/dist/client/assets/{LaneTraceEventFocus-BLhVHwff.js → LaneTraceEventFocus-TbrNHRj_.js} +1 -1
  101. package/dist/client/assets/{MeshCanvas-BR25OBTJ.js → MeshCanvas-DWZHYh1A.js} +2 -2
  102. package/dist/client/assets/{MeshCanvasMinimap-ClVolr4-.js → MeshCanvasMinimap-iswYFpIb.js} +1 -1
  103. package/dist/client/assets/MeshScreen-8nAzQVbm.js +1 -0
  104. package/dist/client/assets/{MeshTopologyView-BT3ke2D1.js → MeshTopologyView-BVvtqI8q.js} +2 -2
  105. package/dist/client/assets/MessageEmbeds-ksPazAKH.js +1 -0
  106. package/dist/client/assets/MessagesScreen-C3WB4T21.js +1 -0
  107. package/dist/client/assets/{MissionContextRail-CafjuseK.js → MissionContextRail-D62-Wis8.js} +1 -1
  108. package/dist/client/assets/MissionControlView-B9cNPXvl.js +1 -0
  109. package/dist/client/assets/{MissionFocusOverlay-nhy3hkxQ.js → MissionFocusOverlay-C1zys3Jv.js} +1 -1
  110. package/dist/client/assets/MissionLeftAgentRow-vycMV77n.js +1 -0
  111. package/dist/client/assets/{MissionLogPane-DiUf3vWW.js → MissionLogPane-B19lYSY9.js} +1 -1
  112. package/dist/client/assets/NativeAreaScreen-B1RLa85C.js +1 -0
  113. package/dist/client/assets/NativeAreaScreen-CV0OhGra.js +1 -0
  114. package/dist/client/assets/NativeAreaScreen-CzuZt6o1.js +1 -0
  115. package/dist/client/assets/{NewAgentModal-BQ2wQ5gp.js → NewAgentModal-Bh-L-emz.js} +1 -1
  116. package/dist/client/assets/NewChatComposer-C97-iTMK.js +19 -0
  117. package/dist/client/assets/{NewChatOrigin-C8ROO4ps.js → NewChatOrigin-DFbF_XvR.js} +1 -1
  118. package/dist/client/assets/{NodeDetailPanel-BNTqYC7m.js → NodeDetailPanel-CElOEpCh.js} +1 -1
  119. package/dist/client/assets/{NodeMenu-CcOeFRCB.js → NodeMenu-B-jjHf1c.js} +1 -1
  120. package/dist/client/assets/ObserveEmbedScreen-B7Qt69Ms.js +2 -0
  121. package/dist/client/assets/{ObserveTextFlow-CC5mnngm.js → ObserveTextFlow-PFnG_10h.js} +2 -2
  122. package/dist/client/assets/{ObservedTopologyPanel-DF6tRZL_.js → ObservedTopologyPanel-CUTIoLZJ.js} +1 -1
  123. package/dist/client/assets/OpenScoutAppShell-37PDFfA4.js +31 -0
  124. package/dist/client/assets/OpsAgentsView-DajlX8LO.js +1 -0
  125. package/dist/client/assets/OpsScreen-jVcaBKGi.js +1 -0
  126. package/dist/client/assets/OpsSubnav-BOOYShHE.js +1 -0
  127. package/dist/client/assets/ProjectAgentProfile-D_wlW4sQ.js +1 -0
  128. package/dist/client/assets/{ProjectAgentProfileBar-C8z22pJ2.js → ProjectAgentProfileBar-DHuMKJj-.js} +1 -1
  129. package/dist/client/assets/ProjectAgentProfileHero-Dbebtug1.js +1 -0
  130. package/dist/client/assets/ProjectsInbox-B8zYE4vP.css +1 -0
  131. package/dist/client/assets/ProjectsInbox-Cgu7B4--.js +2 -0
  132. package/dist/client/assets/ProjectsRail-CDWocin_.js +1 -0
  133. package/dist/client/assets/ProjectsScreen-B_CJycqW.js +1 -0
  134. package/dist/client/assets/ProjectsThreadAside-1MMl_qUD.js +1 -0
  135. package/dist/client/assets/Provider-C35yu29I.js +5 -0
  136. package/dist/client/assets/{RailRow-DUPqXMZh.js → RailRow-BjmWK420.js} +1 -1
  137. package/dist/client/assets/RawSessionsTable-DzT90hWu.js +1 -0
  138. package/dist/client/assets/RealtimeVoiceScreen-B6ylX3WQ.js +16 -0
  139. package/dist/client/assets/{RenderedWorkerSprite-C8fxndAh.js → RenderedWorkerSprite-Dhlyg89J.js} +1 -1
  140. package/dist/client/assets/{ReplayClock-DUVJjrIu.js → ReplayClock-348f17bW.js} +1 -1
  141. package/dist/client/assets/{ReplayLog-Bek1Vc4W.js → ReplayLog-CBnAM3ui.js} +1 -1
  142. package/dist/client/assets/{ReplayOutpost-DlRg3172.js → ReplayOutpost-DyRPfNFx.js} +1 -1
  143. package/dist/client/assets/{RepoDiffEmbedScreen-CVUMnt6A.js → RepoDiffEmbedScreen-BWxvRDrS.js} +1 -1
  144. package/dist/client/assets/{RepoDiffPageScreen-D9-s5PyB.js → RepoDiffPageScreen-DN94irmY.js} +1 -1
  145. package/dist/client/assets/{RepoDiffViewer-D7FN-oyY.js → RepoDiffViewer-_4JVXBIW.js} +1 -1
  146. package/dist/client/assets/RepoDiffViewerLazy-XGVC3WXv.js +2 -0
  147. package/dist/client/assets/{ReposScreen-BQ7HO1om.js → ReposScreen-uMCpt0e9.js} +2 -2
  148. package/dist/client/assets/{RiggedWorkerCharacter-CJMWlvV-.js → RiggedWorkerCharacter-q6QRc7_o.js} +1 -1
  149. package/dist/client/assets/{SageModelStudio-B526NSnw.js → SageModelStudio-CNDhZhgD.js} +1 -1
  150. package/dist/client/assets/{ScoutDeckSurface-ChkvGyEW.js → ScoutDeckSurface-CUaU4R6T.js} +1 -1
  151. package/dist/client/assets/{ScoutSurface-6g1f5chk.js → ScoutSurface-3_25USO_.js} +1 -1
  152. package/dist/client/assets/{ScoutbotFxLab-BuwBdnPf.js → ScoutbotFxLab-CRqhYe0a.js} +1 -1
  153. package/dist/client/assets/{SecondaryNav-Bs-_VwTC.js → SecondaryNav-D7dbV2qo.js} +1 -1
  154. package/dist/client/assets/SessionContextStrip-CXfs9hUD.js +1 -0
  155. package/dist/client/assets/SessionContextStrip-DAIXwtHd.css +1 -0
  156. package/dist/client/assets/{SessionEmbedScreen-C2wf35-P.js → SessionEmbedScreen-D0zFmou-.js} +1 -1
  157. package/dist/client/assets/SessionHopMenu-E6VJZrE0.js +1 -0
  158. package/dist/client/assets/{SessionObserve-B64YsYhy.js → SessionObserve-DXxBvejJ.js} +9 -9
  159. package/dist/client/assets/SessionObserveEvidence-Cuj_KHxR.js +1 -0
  160. package/dist/client/assets/SessionRefScreen-DqLSUlCE.js +1 -0
  161. package/dist/client/assets/SessionsScreen-BLIRkohT.js +1 -0
  162. package/dist/client/assets/SettingsDrawer-juCpnbH6.js +3 -0
  163. package/dist/client/assets/SettingsScreen-BtGzE2-O.js +1 -0
  164. package/dist/client/assets/{SharedFloorCharacter-V04kD5T9.js → SharedFloorCharacter-DNEiaOUh.js} +1 -1
  165. package/dist/client/assets/SharedWorkFloor-0rqtdF-n.css +1 -0
  166. package/dist/client/assets/SharedWorkFloor-D9mf9KSg.js +2 -0
  167. package/dist/client/assets/{ShikiPane-XwFI-pCp.js → ShikiPane-CRtTYkMj.js} +1 -1
  168. package/dist/client/assets/{SlidePanel-BMpkXai_.js → SlidePanel-_CHAQdOa.js} +1 -1
  169. package/dist/client/assets/SpaceSwitcher-BLgSCf_T.js +1 -0
  170. package/dist/client/assets/{SpriteAvatar-aHeF4ZQZ.js → SpriteAvatar-CpZWf54-.js} +1 -1
  171. package/dist/client/assets/{SproutActionSprite-DI5N3gOj.js → SproutActionSprite-BSiTS4en.js} +1 -1
  172. package/dist/client/assets/{StatusPill-Dw4LP7wu.js → StatusPill-2gCP6H7A.js} +1 -1
  173. package/dist/client/assets/{TailView-BofjmUMJ.js → TailView-CYSijNTy.js} +2 -2
  174. package/dist/client/assets/Terminal-Bi97yb5s.js +4 -0
  175. package/dist/client/assets/TerminalEmbedScreen-Bqop67Bq.js +1 -0
  176. package/dist/client/assets/{TerminalHeaderMount-CwbQhXcI.js → TerminalHeaderMount-Cq4OD_xN.js} +1 -1
  177. package/dist/client/assets/{TerminalRelay--qOBwnbR.js → TerminalRelay-DrikpUSJ.js} +3 -3
  178. package/dist/client/assets/{TextDocumentSurface-BK6Qy41F.js → TextDocumentSurface-D52m7Vd8.js} +1 -1
  179. package/dist/client/assets/{TmuxPeek-DpUT9Tpc.js → TmuxPeek-CXFeweMg.js} +1 -1
  180. package/dist/client/assets/VoiceControlWell-DF3bjcYA.js +1 -0
  181. package/dist/client/assets/VoicePathDiagram-CmpHWfO-.js +1 -0
  182. package/dist/client/assets/{VoicePermissionsPanel-D35fOnQj.js → VoicePermissionsPanel-Ok2nfxHw.js} +1 -1
  183. package/dist/client/assets/VoiceTurnDetails-wAByRaNB.js +8 -0
  184. package/dist/client/assets/VoiceTurnStage-edoJalLV.js +1 -0
  185. package/dist/client/assets/VoiceTurnView-D-8g5E4r.js +1 -0
  186. package/dist/client/assets/WorkDetailScreen-zQkNVy2F.js +5 -0
  187. package/dist/client/assets/{WorkFilesViewer-t8AEyx3Q.js → WorkFilesViewer-vNt01sDd.js} +1 -1
  188. package/dist/client/assets/{WorkRunView-_mhG_FR2.js → WorkRunView-BDkR7Edq.js} +1 -1
  189. package/dist/client/assets/WorldActorTalk-BvSg_b1y.js +1 -0
  190. package/dist/client/assets/{WorldCharacter-BRrj3MQN.js → WorldCharacter-CIIlutQq.js} +1 -1
  191. package/dist/client/assets/WorldMinimap-B6HNgcDe.js +1 -0
  192. package/dist/client/assets/{WorldSky-D-RJzSa6.js → WorldSky-Jm2Z6dfW.js} +1 -1
  193. package/dist/client/assets/{activity-BJqFrZyB.js → activity-CIlFrfPJ.js} +1 -1
  194. package/dist/client/assets/{addon-fit-CHohcvS3.js → addon-fit-dFpj9Kfq.js} +1 -1
  195. package/dist/client/assets/{addon-webgl-CaRy2x2b.js → addon-webgl-BFCGRtGh.js} +1 -1
  196. package/dist/client/assets/{agent-essentials-bKWYOZaH.js → agent-essentials-BGGvT5G6.js} +1 -1
  197. package/dist/client/assets/{agent-master-model-C-KdOFDK.js → agent-master-model-Bk_yuUXJ.js} +1 -1
  198. package/dist/client/assets/{agent-specialization-BplZUa_0.js → agent-specialization-DDc7mLCW.js} +1 -1
  199. package/dist/client/assets/agents-screen-BYakbO50.css +1 -0
  200. package/dist/client/assets/{arc.es-CubLvQ4W.js → arc.es-C1SQHJ3k.js} +1 -1
  201. package/dist/client/assets/{arrow-left-DFfKAq0d.js → arrow-left-MVUKauwQ.js} +1 -1
  202. package/dist/client/assets/{arrow-right-DmAWnyAH.js → arrow-right-Bp-FpE5V.js} +1 -1
  203. package/dist/client/assets/{arrow-up-right-B0aLKiyF.js → arrow-up-right-BPedAgxO.js} +1 -1
  204. package/dist/client/assets/{book-open-BL9qvhEI.js → book-open-CV98WMSp.js} +1 -1
  205. package/dist/client/assets/{bot-BhAVbcCA.js → bot-B4zLQ4IN.js} +1 -1
  206. package/dist/client/assets/chat-api-DSJMBYoT.js +2 -0
  207. package/dist/client/assets/chat-message-markup-91DIry6R.js +1 -0
  208. package/dist/client/assets/chat-space-model-aW3Fd8_U.js +4 -0
  209. package/dist/client/assets/chat-transport-DNS5CB2I.js +1 -0
  210. package/dist/client/assets/{check-g7D7-c1J.js → check-lrJ3a73a.js} +1 -1
  211. package/dist/client/assets/{chevron-down-CDzRQQGl.js → chevron-down-l1mrh5S9.js} +1 -1
  212. package/dist/client/assets/{chevron-right-DKGTLiqc.js → chevron-right-DrfqcerI.js} +1 -1
  213. package/dist/client/assets/{chevron-up-DX7R6KY2.js → chevron-up-CETZJzjV.js} +1 -1
  214. package/dist/client/assets/{chunk-HRAB3GC3-Dvk_QpRq.js → chunk-HRAB3GC3-DbVLgbWX.js} +1 -1
  215. package/dist/client/assets/{clock-CQb4FeMf.js → clock-BV1aqPkK.js} +1 -1
  216. package/dist/client/assets/{code-xml-Cmadr3pQ.js → code-xml-BhcNbLWU.js} +1 -1
  217. package/dist/client/assets/{coffee-ljG1_krY.js → coffee-D7EAOdCk.js} +1 -1
  218. package/dist/client/assets/{compass-CvzkzkIh.js → compass-63TUaz5_.js} +1 -1
  219. package/dist/client/assets/content-B1lgE8qr.js +1 -0
  220. package/dist/client/assets/content-B5l11YyQ.js +1 -0
  221. package/dist/client/assets/content-BNZOZEpX.js +1 -0
  222. package/dist/client/assets/content-BRIxP155.js +1 -0
  223. package/dist/client/assets/content-BWd8gt8L.js +1 -0
  224. package/dist/client/assets/content-BfwS2jAK.js +1 -0
  225. package/dist/client/assets/content-C4p43_eT.js +1 -0
  226. package/dist/client/assets/content-CdYfaoDV.js +1 -0
  227. package/dist/client/assets/content-CzldLxw0.js +1 -0
  228. package/dist/client/assets/content-D-olnc4U.js +1 -0
  229. package/dist/client/assets/content-DTioimq4.js +1 -0
  230. package/dist/client/assets/content-LOebm3_d.js +1 -0
  231. package/dist/client/assets/{content-CKJ9zb7Z.js → content-nGlEZhUI.js} +1 -1
  232. package/dist/client/assets/{content-D1Ze_FG9.js → content-oyzDM-LK.js} +1 -1
  233. package/dist/client/assets/content-x1PHxED7.js +1 -0
  234. package/dist/client/assets/content-zX3ZY3T9.js +1 -0
  235. package/dist/client/assets/{conversation-icons-CIRaxmid.js → conversation-icons-Tqba2d56.js} +1 -1
  236. package/dist/client/assets/conversation-model-FxDeWlle.js +1 -0
  237. package/dist/client/assets/conversation-motion-features-C5zjuNwE.js +1 -0
  238. package/dist/client/assets/conversations-DoAAO6kA.js +1 -0
  239. package/dist/client/assets/{copy-BGOC1tJB.js → copy-xKeM5ZtU.js} +1 -1
  240. package/dist/client/assets/{cpu-Q6nrHFTN.js → cpu-BOTa_WLr.js} +1 -1
  241. package/dist/client/assets/{createLucideIcon-ChvMq-zl.js → createLucideIcon-zZ8Hx7er.js} +1 -1
  242. package/dist/client/assets/ctx-panel-BC8fpcWJ.css +1 -0
  243. package/dist/client/assets/direct-voice-BbLPuJ04.js +2 -0
  244. package/dist/client/assets/direct-voice-DbO7CSv_.css +1 -0
  245. package/dist/client/assets/discover-DJFxyV1k.js +2 -0
  246. package/dist/client/assets/embed-entry-Lyvu0Kfc.js +2 -0
  247. package/dist/client/assets/{external-link-BVccgH0n.js → external-link-CUObqmgX.js} +1 -1
  248. package/dist/client/assets/{eye-CsGfEVR6.js → eye-LrO-cXQt.js} +1 -1
  249. package/dist/client/assets/{file-code-corner-Be6da5l3.js → file-code-corner-CsU7jJpu.js} +1 -1
  250. package/dist/client/assets/{file-text-DP6txVW-.js → file-text-CnISiiw6.js} +1 -1
  251. package/dist/client/assets/{flag-DAFE2wZ5.js → flag-C4wl8z2-.js} +1 -1
  252. package/dist/client/assets/fleet-roll-call-BUgf7w-V.css +1 -0
  253. package/dist/client/assets/{folder-B_S7gBVr.js → folder-D5prSkzz.js} +1 -1
  254. package/dist/client/assets/{gauge-DQCGlE3o.js → gauge-D9_5iJEm.js} +1 -1
  255. package/dist/client/assets/{gestures-CofqY4Km.js → gestures-QZub3Ot9.js} +1 -1
  256. package/dist/client/assets/{git-branch-DcUCsWdJ.js → git-branch-B0_fPLO7.js} +1 -1
  257. package/dist/client/assets/{go-shortcuts-KQy-ZOpV.js → go-shortcuts-DicR7sUf.js} +1 -1
  258. package/dist/client/assets/home-moving-signal-rpMhsOJB.js +1 -0
  259. package/dist/client/assets/home-now-card-ByE6Umcx.js +1 -0
  260. package/dist/client/assets/{home-now-card-nano-CvU8B61b.js → home-now-card-nano-B5Dv3-pb.js} +1 -1
  261. package/dist/client/assets/hooks-_eCZZPsR.js +2 -0
  262. package/dist/client/assets/index-724SdE6r.js +1 -0
  263. package/dist/client/assets/{index-kkXUq-zf.js → index-CHD0qcfL.js} +1 -1
  264. package/dist/client/assets/index-CN4rBB_s.css +1 -0
  265. package/dist/client/assets/index-D1d98iYf.js +1 -0
  266. package/dist/client/assets/{index-DReVb7jZ.js → index-EsrkGBcv.js} +8 -8
  267. package/dist/client/assets/index-gGHPA-By.js +1 -0
  268. package/dist/client/assets/{inspector-panel-CLU7wjnT.js → inspector-panel-BkgUDn6G.js} +2 -2
  269. package/dist/client/assets/{keyboard-nav-CJXPaHXj.js → keyboard-nav-DDHegDbx.js} +1 -1
  270. package/dist/client/assets/{lane-roster-store-Ch9t6lb0.js → lane-roster-store-D-RSWjb-.js} +1 -1
  271. package/dist/client/assets/{layers-BOwyWodP.js → layers-C8PDiMul.js} +1 -1
  272. package/dist/client/assets/{layout-grid-B36Qsh0y.js → layout-grid-Cor2frzj.js} +1 -1
  273. package/dist/client/assets/left-Bn5X7x2o.js +2 -0
  274. package/dist/client/assets/left-BqS0fYX1.js +1 -0
  275. package/dist/client/assets/left-CTCeeeD3.js +1 -0
  276. package/dist/client/assets/left-DhtVPVux.js +1 -0
  277. package/dist/client/assets/left-K39b-Wvx.js +2 -0
  278. package/dist/client/assets/left-KGmueNPt.js +1 -0
  279. package/dist/client/assets/left-P_GOYB-s.js +1 -0
  280. package/dist/client/assets/left-advisor-B0N47De2.js +1 -0
  281. package/dist/client/assets/left-agents-CsSNc51Y.js +1 -0
  282. package/dist/client/assets/left-default-BlO5LP2T.js +1 -0
  283. package/dist/client/assets/left-lanes-C4PhaJE6.js +1 -0
  284. package/dist/client/assets/left-mission-BjTE5vPa.js +1 -0
  285. package/dist/client/assets/library-CkWNPHRp.js +1 -0
  286. package/dist/client/assets/{loader-circle-DNUsuPWz.js → loader-circle-OvccU82H.js} +1 -1
  287. package/dist/client/assets/{local-agents-I40PawYA.js → local-agents-BqnoxJrq.js} +1 -1
  288. package/dist/client/assets/log-in-7SnYqW5w.js +1 -0
  289. package/dist/client/assets/{machine-children-CdhNzDF0.js → machine-children-DxcqCLmd.js} +1 -1
  290. package/dist/client/assets/media-blobs-Bi8pxr1u.js +1 -0
  291. package/dist/client/assets/{mentions-Ck_Vjnyp.js → mentions-ByUvhS-v.js} +1 -1
  292. package/dist/client/assets/{mesh-ops-DSlvHp-D.js → mesh-ops-CiZ8xSAx.js} +1 -1
  293. package/dist/client/assets/{mesh-view-store-C1-mdP3P.js → mesh-view-store-DZvJC4KU.js} +1 -1
  294. package/dist/client/assets/{message-circle-cI5_A5mj.js → message-circle-CxRVKNE-.js} +1 -1
  295. package/dist/client/assets/message-markup-BQW5jdJw.js +15 -0
  296. package/dist/client/assets/message-markup-Zwo3t4cI.js +1 -0
  297. package/dist/client/assets/{message-square-CJW4WRlo.js → message-square-BxesYglW.js} +1 -1
  298. package/dist/client/assets/mission-control-model-BpJHDV5D.js +1 -0
  299. package/dist/client/assets/{mission-control-store-p_cboAm4.js → mission-control-store-elEEsIvb.js} +1 -1
  300. package/dist/client/assets/{mission-wall-DOuGOxQy.js → mission-wall-CAo4BKfa.js} +1 -1
  301. package/dist/client/assets/{monitor-C7_cHlkC.js → monitor-DTTYEb73.js} +1 -1
  302. package/dist/client/assets/{nav-destinations-CU_euC-Q.js → nav-destinations-uorRqFxf.js} +1 -1
  303. package/dist/client/assets/{observe-CtS0l3zu.js → observe-BJqERJVj.js} +1 -1
  304. package/dist/client/assets/{page-status-DwFR4wSw.js → page-status-BswZLqvA.js} +1 -1
  305. package/dist/client/assets/{panel-right-qP17MwMl.js → panel-right-Bv7sP_fc.js} +1 -1
  306. package/dist/client/assets/paperclip-BjcuP_Hx.js +1 -0
  307. package/dist/client/assets/{pause-B_hliKuR.js → pause-C2XTlkjs.js} +1 -1
  308. package/dist/client/assets/{persistent-state-BUsTTZFE.js → persistent-state-KRk_yb0q.js} +1 -1
  309. package/dist/client/assets/{pin-Oi4qHR6M.js → pin-C2mFOV1l.js} +1 -1
  310. package/dist/client/assets/{play-CVeRmqLH.js → play-FT6K3It1.js} +1 -1
  311. package/dist/client/assets/{plus-D5NLH_fM.js → plus-DFDDeGKu.js} +1 -1
  312. package/dist/client/assets/profile-DTmzN16I.js +1 -0
  313. package/dist/client/assets/{projects-inbox-CfwxCTdN.js → projects-inbox-C0FUCv_p.js} +1 -1
  314. package/dist/client/assets/projects-inbox-ColX6lpx.css +1 -0
  315. package/dist/client/assets/{provider-DwmCoSlc.js → provider-Dojd8quC.js} +1 -1
  316. package/dist/client/assets/{proxy-DgzP27W8.js → proxy-AJsmwA6h.js} +1 -1
  317. package/dist/client/assets/{radio-Cas2qg1D.js → radio-DRoOZsws.js} +1 -1
  318. package/dist/client/assets/{refresh-cw-IcD2lPoT.js → refresh-cw-BmVr7sCD.js} +1 -1
  319. package/dist/client/assets/resolve-panes-pbY1fCWi.js +1 -0
  320. package/dist/client/assets/resolve-sidebar-context-YWkZTq1t.js +1 -0
  321. package/dist/client/assets/right-49kO-6nD.js +1 -0
  322. package/dist/client/assets/right-APtItA8A.js +1 -0
  323. package/dist/client/assets/right-BJwhPqtn.js +1 -0
  324. package/dist/client/assets/right-BPqrf4ek.js +1 -0
  325. package/dist/client/assets/right-D7djOy6K.js +1 -0
  326. package/dist/client/assets/right-DKOUCRob.js +1 -0
  327. package/dist/client/assets/right-DMNrVzg7.js +1 -0
  328. package/dist/client/assets/{right-cjPTwPXS.js → right-DWPVB-nK.js} +1 -1
  329. package/dist/client/assets/right-DppeMCy4.js +1 -0
  330. package/dist/client/assets/right-GAL5Mw1v.js +1 -0
  331. package/dist/client/assets/{rocket-DAqYvu8I.js → rocket-CGl4RTV7.js} +1 -1
  332. package/dist/client/assets/router-DCtl8wqb.js +1 -0
  333. package/dist/client/assets/runtime-picker-DXu2bOTh.js +1 -0
  334. package/dist/client/assets/{scope-views-Dl3ml9OZ.js → scope-views-RUWwCVAr.js} +1 -1
  335. package/dist/client/assets/scout-voice-CZx60X6E.js +1 -0
  336. package/dist/client/assets/{scoutbot-markdown-DwvGQOWo.js → scoutbot-markdown-BKEBSbG0.js} +1 -1
  337. package/dist/client/assets/{scroll-text-B0tKI9Sg.js → scroll-text-DNjxhyO2.js} +1 -1
  338. package/dist/client/assets/{search-UsM-9-_W.js → search-DT42oyRW.js} +1 -1
  339. package/dist/client/assets/secondaryNavConfig-CS1svh6n.js +1 -0
  340. package/dist/client/assets/{selection-bridge-OTS2iFkt.js → selection-bridge-x3wFUjxj.js} +1 -1
  341. package/dist/client/assets/{send-horizontal-BlQsRK6C.js → send-horizontal-CH0-fbZE.js} +1 -1
  342. package/dist/client/assets/{send-to-agent-session-C1mgqdow.js → send-to-agent-session-DoKCDBJ4.js} +1 -1
  343. package/dist/client/assets/{server-DBlPW0Mp.js → server-QfsgMLk1.js} +1 -1
  344. package/dist/client/assets/{session-catalog-CnpZMB7C.js → session-catalog-CvSdPHPe.js} +1 -1
  345. package/dist/client/assets/session-recap-lanes-D-eVJnpY.js +1 -0
  346. package/dist/client/assets/session-recap-queue-41l2XVkI.js +1 -0
  347. package/dist/client/assets/{session-table-CGkfG5Yd.js → session-table-L-pns6Zl.js} +1 -1
  348. package/dist/client/assets/{sessions-view-Bge4XZ4I.js → sessions-view-Dc-QAa7O.js} +1 -1
  349. package/dist/client/assets/{settings-C69Zjrpq.js → settings-BVh7kldq.js} +1 -1
  350. package/dist/client/assets/{sliders-horizontal-6bzeod7c.js → sliders-horizontal-782VC_yy.js} +1 -1
  351. package/dist/client/assets/{sparkles-Cc5lPZRv.js → sparkles-BjHq_DNK.js} +1 -1
  352. package/dist/client/assets/{sse-A8AyLH0g.js → sse-BCPRocpq.js} +1 -1
  353. package/dist/client/assets/system-surfaces-redesign-q2BmCB7e.css +1 -0
  354. package/dist/client/assets/{tail-events-C4WdhVeK.js → tail-events-d0yAYxR0.js} +1 -1
  355. package/dist/client/assets/{terminal-DMZjX1es.js → terminal-hQKQygcf.js} +1 -1
  356. package/dist/client/assets/{terminal-relay-mO89dX-Y.js → terminal-relay-Bxs1hp-j.js} +1 -1
  357. package/dist/client/assets/{terminal-takeover-CZZsnPzj.js → terminal-takeover-Ay5C2c-M.js} +1 -1
  358. package/dist/client/assets/theme-vars-DNK0nn3k.js +1 -0
  359. package/dist/client/assets/triangle-alert-CHoRGdVO.js +1 -0
  360. package/dist/client/assets/{use-beside-D3cJpA5p.js → use-beside-DoRC1nt0.js} +1 -1
  361. package/dist/client/assets/{use-conversation-list-D5EnpVba.js → use-conversation-list-CY4JciOV.js} +1 -1
  362. package/dist/client/assets/{use-fleet-active-asks-D_QOmjg5.js → use-fleet-active-asks-CymmXWH4.js} +1 -1
  363. package/dist/client/assets/{use-mesh-node-state-3V3ADQ-G.js → use-mesh-node-state-BvaqtODo.js} +1 -1
  364. package/dist/client/assets/{use-mesh-ops-items-DI9GKWlF.js → use-mesh-ops-items-BSYaqH_0.js} +1 -1
  365. package/dist/client/assets/{use-reduced-motion-CiaZHMnk.js → use-reduced-motion-3gMYZNIp.js} +1 -1
  366. package/dist/client/assets/{use-scout-dev-flags-CkdAHlDR.js → use-scout-dev-flags-DS_pYYQd.js} +1 -1
  367. package/dist/client/assets/{useAgentHoverCard-A3QGXqIy.js → useAgentHoverCard-BANmpjMh.js} +1 -1
  368. package/dist/client/assets/useContentSecondaryNav-C6OBu-3_.js +1 -0
  369. package/dist/client/assets/{useEmbedHeadline-atkQVfGw.js → useEmbedHeadline-D6pJRxUg.js} +1 -1
  370. package/dist/client/assets/usePersistentState-B8lP7TRb.js +1 -0
  371. package/dist/client/assets/{usePierreRuntime-DTvcwISe.js → usePierreRuntime-BAQdiN0L.js} +1 -1
  372. package/dist/client/assets/useSidebarCollapse-OL_8J5cL.js +1 -0
  373. package/dist/client/assets/{users-RLK3P5U4.js → users-BUjx36gx.js} +1 -1
  374. package/dist/client/assets/voice-paths-CJUuBPh3.css +1 -0
  375. package/dist/client/assets/voice-turn-DftA0iIb.css +1 -0
  376. package/dist/client/assets/voice-turn-ledger-BMZxlSjg.js +1 -0
  377. package/dist/client/assets/{wrench-B4maQJai.js → wrench-DR0i5BU7.js} +1 -1
  378. package/dist/client/assets/{x-rlMdRqJF.js → x-DAehov0E.js} +1 -1
  379. package/dist/client/assets/{xterm-B1zHHOLQ.js → xterm-BXQiLVnI.js} +1 -1
  380. package/dist/client/assets/{zap-B4X0OrEw.js → zap-CEjZNZbI.js} +1 -1
  381. package/dist/client/crew/sheets/eye-plate-v1/look-down-left.webp +0 -0
  382. package/dist/client/crew/sheets/eye-plate-v1/look-down-right.webp +0 -0
  383. package/dist/client/crew/sheets/eye-plate-v1/look-down.webp +0 -0
  384. package/dist/client/crew/sheets/eye-plate-v1/look-up-left.webp +0 -0
  385. package/dist/client/crew/sheets/eye-plate-v1/look-up-right.webp +0 -0
  386. package/dist/client/crew/sheets/eye-plate-v1/look-up.webp +0 -0
  387. package/dist/client/crew/sheets/sprout/blink-half.webp +0 -0
  388. package/dist/client/crew/sheets/sprout/blink-shut.webp +0 -0
  389. package/dist/client/crew/sheets/sprout/look-down-left.webp +0 -0
  390. package/dist/client/crew/sheets/sprout/look-down-right.webp +0 -0
  391. package/dist/client/crew/sheets/sprout/look-down.webp +0 -0
  392. package/dist/client/crew/sheets/sprout/look-left.webp +0 -0
  393. package/dist/client/crew/sheets/sprout/look-right.webp +0 -0
  394. package/dist/client/crew/sheets/sprout/look-up-left.webp +0 -0
  395. package/dist/client/crew/sheets/sprout/look-up-right.webp +0 -0
  396. package/dist/client/crew/sheets/sprout/look-up.webp +0 -0
  397. package/dist/client/index.html +2 -2
  398. package/dist/drizzle/0020_message_reactions.sql +11 -0
  399. package/dist/drizzle/meta/_journal.json +7 -0
  400. package/dist/main.mjs +542 -150
  401. package/dist/node/main.mjs +131 -17
  402. package/dist/pairing-runtime-controller.mjs +375 -78
  403. package/dist/runtime/base-daemon.mjs +98 -5
  404. package/dist/runtime/broker-daemon.mjs +1879 -1198
  405. package/dist/runtime/broker-process-manager.mjs +96 -3
  406. package/dist/runtime/mesh-discover.mjs +96 -3
  407. package/dist/scout-control-plane-web.mjs +4817 -1616
  408. package/dist/update-helper.mjs +211 -39
  409. package/package.json +5 -3
  410. package/server.json +31 -0
  411. package/dist/client/assets/ActivityScreen-CcDdQTBK.js +0 -1
  412. package/dist/client/assets/AgentAdventures-BxrYq_2v.js +0 -1
  413. package/dist/client/assets/AgentAvatar-NZOqcsB2.js +0 -1
  414. package/dist/client/assets/AgentConfigurationScreen-BhD1PEAM.js +0 -1
  415. package/dist/client/assets/AgentDefinitionsWorkspace-BqS6MXqF.js +0 -1
  416. package/dist/client/assets/AgentFloorView-A0dDRlRV.js +0 -1
  417. package/dist/client/assets/AgentInfoScreen-DuaN0sgE.js +0 -1
  418. package/dist/client/assets/AgentLanesEmbedScreen-CeNiaZ9_.js +0 -1
  419. package/dist/client/assets/AgentLanesView-WZhEDBFE.js +0 -2
  420. package/dist/client/assets/AgentMasterScreen-DUDUTAnU.js +0 -1
  421. package/dist/client/assets/AgentSessions-CO1WGa8Z.js +0 -6
  422. package/dist/client/assets/AgentsConsole-BQOWkj35.js +0 -1
  423. package/dist/client/assets/AgentsScreen-BMNAj1PH.js +0 -1
  424. package/dist/client/assets/AgentsSubnav-CeHhuzyM.js +0 -1
  425. package/dist/client/assets/BriefingDetailScreen-yZG8_m4h.js +0 -1
  426. package/dist/client/assets/BrokerScreen-CT37VQiL.js +0 -8
  427. package/dist/client/assets/ChannelComposer-BVItWlEz.js +0 -1
  428. package/dist/client/assets/ChannelSidebar-B-2spawY.js +0 -1
  429. package/dist/client/assets/ChatBits-CLJ71hTY.js +0 -1
  430. package/dist/client/assets/ChatRightPanel-pKQtkAgl.js +0 -1
  431. package/dist/client/assets/ChatSpaceSurface-NrLwdPkE.js +0 -1
  432. package/dist/client/assets/ChatSpaceTheme-BPMgPdVK.css +0 -1
  433. package/dist/client/assets/ChatSpaceTheme-D37Jk7bl.js +0 -1
  434. package/dist/client/assets/ConversationComposer-DNcn5U6D.js +0 -1
  435. package/dist/client/assets/ConversationFeedRows-RnYSa7Io.js +0 -1
  436. package/dist/client/assets/ConversationHeader-Y9TEJxP_.js +0 -1
  437. package/dist/client/assets/ConversationScreen-Brfas2y0.css +0 -1
  438. package/dist/client/assets/ConversationScreen-tpj4cqWs.js +0 -2
  439. package/dist/client/assets/ConversationStatus-Cv-7hErW.js +0 -1
  440. package/dist/client/assets/CrewAvatar-zgzC3cbU.js +0 -1
  441. package/dist/client/assets/CrewWorkspaces-K2jcyLec.js +0 -1
  442. package/dist/client/assets/FlightObserveScreen-CvzhzuWc.js +0 -1
  443. package/dist/client/assets/FloorResourcesSheet-_Iy5UqgY.js +0 -1
  444. package/dist/client/assets/FloorTacticalHUD-BhyOqlL5.js +0 -1
  445. package/dist/client/assets/HarnessMark-DSvM_H7H.js +0 -1
  446. package/dist/client/assets/HarnessesScreen-DyjqbZ4k.js +0 -1
  447. package/dist/client/assets/InviteLandingScreen-xZQ2na1z.js +0 -1
  448. package/dist/client/assets/InviteSheet--5Zjct25.js +0 -1
  449. package/dist/client/assets/KnowledgeSearchScreen-BPqAjHnH.js +0 -1
  450. package/dist/client/assets/LaneTraceDetailSheet-jl4XQmEx.js +0 -1
  451. package/dist/client/assets/MeshScreen-BW1dMFWF.js +0 -1
  452. package/dist/client/assets/MessagesScreen-CtNMfIvC.js +0 -1
  453. package/dist/client/assets/MissionControlView-BjPOViGY.js +0 -1
  454. package/dist/client/assets/MissionLeftAgentRow-Dms0DBjO.js +0 -1
  455. package/dist/client/assets/NativeAreaScreen-BQSTo8As.js +0 -1
  456. package/dist/client/assets/NativeAreaScreen-Brix6xDB.js +0 -1
  457. package/dist/client/assets/NativeAreaScreen-D7HyQNlM.js +0 -1
  458. package/dist/client/assets/NewChatComposer-BEXS8vV6.js +0 -19
  459. package/dist/client/assets/ObserveEmbedScreen-Dh30EjAQ.js +0 -2
  460. package/dist/client/assets/OpenScoutAppShell-D9pgw36i.js +0 -31
  461. package/dist/client/assets/OpsAgentsView-D3rM0udq.js +0 -1
  462. package/dist/client/assets/OpsScreen-DySeNQ1V.js +0 -1
  463. package/dist/client/assets/OpsSubnav-C9E0r3GZ.js +0 -1
  464. package/dist/client/assets/ProjectAgentProfile-FUav75j2.js +0 -1
  465. package/dist/client/assets/ProjectAgentProfileHero-BLK0EwMg.js +0 -1
  466. package/dist/client/assets/ProjectsInbox-DfCXReZK.js +0 -2
  467. package/dist/client/assets/ProjectsRail-CELVubfJ.js +0 -1
  468. package/dist/client/assets/ProjectsScreen-DMw4TLKy.js +0 -1
  469. package/dist/client/assets/ProjectsThreadAside-D1Sh4fnX.js +0 -1
  470. package/dist/client/assets/Provider-CNZluAZb.js +0 -5
  471. package/dist/client/assets/RailToggle-BwmY70B8.js +0 -1
  472. package/dist/client/assets/RawSessionsTable-6OVJq0JZ.js +0 -1
  473. package/dist/client/assets/RealtimeVoiceScreen-D41TYY0x.js +0 -9
  474. package/dist/client/assets/RepoDiffViewerLazy-BpMR7tlx.js +0 -2
  475. package/dist/client/assets/SessionObserveEvidence-CS1aQBpQ.js +0 -1
  476. package/dist/client/assets/SessionRefScreen-DURV0MpF.js +0 -1
  477. package/dist/client/assets/SessionsScreen-D71ZR-8t.js +0 -1
  478. package/dist/client/assets/SettingsDrawer-Nz98oBVl.js +0 -3
  479. package/dist/client/assets/SettingsScreen-CYBHal6y.js +0 -1
  480. package/dist/client/assets/SharedWorkFloor-BCmdeb3Q.css +0 -1
  481. package/dist/client/assets/SharedWorkFloor-C0xxW4SN.js +0 -2
  482. package/dist/client/assets/SpaceSwitcher-BfeIf-ad.js +0 -1
  483. package/dist/client/assets/Terminal-jIqnIZZ6.js +0 -4
  484. package/dist/client/assets/TerminalEmbedScreen-3XsjuySR.js +0 -1
  485. package/dist/client/assets/WorkDetailScreen-Bcf_yHhU.js +0 -5
  486. package/dist/client/assets/WorldActorTalk-CKerDikx.js +0 -1
  487. package/dist/client/assets/WorldMinimap-DOptgrc4.js +0 -1
  488. package/dist/client/assets/agent-autocomplete-C7xwIcwd.css +0 -1
  489. package/dist/client/assets/agent-autocomplete-_u9o5EZu.js +0 -2
  490. package/dist/client/assets/agents-screen-BMu6PpRY.css +0 -1
  491. package/dist/client/assets/at-sign-DM7xeppo.js +0 -1
  492. package/dist/client/assets/chat-api-BPVC0asu.js +0 -1
  493. package/dist/client/assets/chat-space-model-B6Jg2CY4.js +0 -4
  494. package/dist/client/assets/content-0AXa0klu.js +0 -1
  495. package/dist/client/assets/content-BEyJ19Lx.js +0 -1
  496. package/dist/client/assets/content-BN5weWKW.js +0 -1
  497. package/dist/client/assets/content-BNokkm7C.js +0 -1
  498. package/dist/client/assets/content-BV4PUM9q.js +0 -1
  499. package/dist/client/assets/content-BxUPlcx5.js +0 -1
  500. package/dist/client/assets/content-CIC5sku8.js +0 -1
  501. package/dist/client/assets/content-CdkTyxqk.js +0 -1
  502. package/dist/client/assets/content-CnhhSCZq.js +0 -1
  503. package/dist/client/assets/content-DY3F9Vfr.js +0 -1
  504. package/dist/client/assets/content-DrKBYpcb.js +0 -1
  505. package/dist/client/assets/content-LSStQYj5.js +0 -1
  506. package/dist/client/assets/content-YvU-D0hF.js +0 -1
  507. package/dist/client/assets/content-oKQMyVnH.js +0 -1
  508. package/dist/client/assets/conversation-model-m8HhzroS.js +0 -1
  509. package/dist/client/assets/conversation-motion-features-D9PxLoDt.js +0 -1
  510. package/dist/client/assets/conversations-Cbg9h_Af.js +0 -1
  511. package/dist/client/assets/ctx-panel-F05jXK4Q.css +0 -1
  512. package/dist/client/assets/discover-DlwbftpC.js +0 -2
  513. package/dist/client/assets/embed-entry-c0lwtjBG.js +0 -2
  514. package/dist/client/assets/home-moving-signal-BIHUGNfI.js +0 -1
  515. package/dist/client/assets/home-now-card-CaLgZze2.js +0 -1
  516. package/dist/client/assets/hooks-DaUOREpP.js +0 -2
  517. package/dist/client/assets/index-CGbs0SBm.css +0 -1
  518. package/dist/client/assets/index-CbqBwfIW.js +0 -1
  519. package/dist/client/assets/index-CyPMl7Up.js +0 -1
  520. package/dist/client/assets/index-PQpJveGO.js +0 -1
  521. package/dist/client/assets/left-0vBrvrBG.js +0 -2
  522. package/dist/client/assets/left-C6SyaqlJ.js +0 -1
  523. package/dist/client/assets/left-CTuXysZR.js +0 -2
  524. package/dist/client/assets/left-Cc6s4DT2.js +0 -1
  525. package/dist/client/assets/left-DF5caiyh.js +0 -1
  526. package/dist/client/assets/left-DgT4tWCx.js +0 -1
  527. package/dist/client/assets/left-R0wppTTr.js +0 -1
  528. package/dist/client/assets/left-advisor-C-kt8V28.js +0 -1
  529. package/dist/client/assets/left-agents-thnBO156.js +0 -1
  530. package/dist/client/assets/left-default-CT42fnpF.js +0 -1
  531. package/dist/client/assets/left-lanes-CSmZgciK.js +0 -1
  532. package/dist/client/assets/left-mission-C86x6i9h.js +0 -1
  533. package/dist/client/assets/library-DdhYL_9v.js +0 -1
  534. package/dist/client/assets/message-markup-6Tgo4qFJ.js +0 -15
  535. package/dist/client/assets/mission-control-model-C30vU1Fe.js +0 -1
  536. package/dist/client/assets/profile-BegEUmB7.js +0 -1
  537. package/dist/client/assets/projects-inbox-CKPLZN8s.css +0 -1
  538. package/dist/client/assets/resolve-panes-pfZTezKo.js +0 -1
  539. package/dist/client/assets/resolve-sidebar-context-D5ksvrb_.js +0 -1
  540. package/dist/client/assets/right-BDaCJ0CF.js +0 -1
  541. package/dist/client/assets/right-BP6lXRFS.js +0 -1
  542. package/dist/client/assets/right-Cb1VCrdj.js +0 -1
  543. package/dist/client/assets/right-CeFaxfBo.js +0 -1
  544. package/dist/client/assets/right-Ck2SrYCj.js +0 -1
  545. package/dist/client/assets/right-D-uv5YfF.js +0 -1
  546. package/dist/client/assets/right-DJMSICky.js +0 -1
  547. package/dist/client/assets/right-Dnljs8ah.js +0 -1
  548. package/dist/client/assets/right-SdCSF8PP.js +0 -1
  549. package/dist/client/assets/router-C-MF5-mb.js +0 -1
  550. package/dist/client/assets/runtime-picker-C_AVYF63.js +0 -1
  551. package/dist/client/assets/scout-voice-CqAyfblr.js +0 -1
  552. package/dist/client/assets/secondaryNavConfig-DzNHk6IH.js +0 -1
  553. package/dist/client/assets/system-surfaces-redesign-DKFg4GB5.css +0 -1
  554. package/dist/client/assets/useContentSecondaryNav-DrL_nkCZ.js +0 -1
  555. package/dist/client/assets/usePersistentState-Y8XwSTg-.js +0 -1
  556. package/dist/drizzle/meta/0000_snapshot.json +0 -4575
  557. package/dist/drizzle/meta/0001_snapshot.json +0 -4624
  558. package/dist/drizzle/meta/0002_snapshot.json +0 -4631
  559. package/dist/drizzle/meta/0003_snapshot.json +0 -4952
  560. package/dist/drizzle/meta/0004_snapshot.json +0 -5235
  561. package/dist/drizzle/meta/0005_snapshot.json +0 -5599
  562. package/dist/drizzle/meta/0006_snapshot.json +0 -5606
  563. package/dist/drizzle/meta/0007_snapshot.json +0 -5767
  564. package/dist/drizzle/meta/0008_snapshot.json +0 -5774
  565. package/dist/drizzle/meta/0009_snapshot.json +0 -6262
  566. package/dist/drizzle/meta/0010_snapshot.json +0 -6286
  567. package/dist/drizzle/meta/0011_snapshot.json +0 -6337
  568. package/dist/drizzle/meta/0012_snapshot.json +0 -6458
  569. package/dist/drizzle/meta/0013_snapshot.json +0 -6465
  570. package/dist/drizzle/meta/0014_snapshot.json +0 -6503
  571. package/dist/drizzle/meta/0015_snapshot.json +0 -6596
  572. package/dist/drizzle/meta/0016_snapshot.json +0 -6611
  573. package/dist/drizzle/meta/0017_snapshot.json +0 -6785
  574. package/dist/drizzle/meta/0018_snapshot.json +0 -6804
  575. package/dist/drizzle/meta/0019_snapshot.json +0 -6804
@@ -0,0 +1,4 @@
1
+ import{r as i,j as s,T as Ps,U as zs}from"./index-EsrkGBcv.js";/* empty css */import{a as _s,u as Lt}from"./Provider-C35yu29I.js";import{a as Le}from"./api-DSqpVKC7.js";import{c as ls}from"./clipboard-e3fSpeo7.js";import{a as Dt}from"./colors-CFlbwC25.js";import{r as Ce,S as Fs,a as Ks,w as os,s as Kn,b as Bn,d as Un,c as Hn,e as Wt,f as ns,g as qn}from"./terminal-relay-Bxs1hp-j.js";import{p as $t,m as Ot,f as Pt,a as zt,n as _t,s as Z,d as As,o as Ls,r as Ft,i as Kt,t as Bs,q as Yn,u as Vn,j as Jn,e as Bt}from"./terminal-sessions-3RfJpen8.js";import{f as Gn,H as Xn,u as Us,a as Qn,c as Zn,h as er,b as sr,A as tr}from"./HerdrSession-_t7yM8vX.js";import{a as Ut,t as nr,D as rr,c as ar,P as ir,d as Hs,s as vs,T as lr}from"./session-table-L-pns6Zl.js";import{i as or,c as Ht}from"./agent-state-DDhnFEEP.js";import{b as cr}from"./keyboard-nav-DDHegDbx.js";import{T as dr}from"./TerminalRelay-DrikpUSJ.js";import{u as rs}from"./usePersistentState-B8lP7TRb.js";import{q as ur}from"./terminal-takeover-Ay5C2c-M.js";import{t as mr}from"./time-Dhsh_2EG.js";import{B as Ge}from"./BackToPicker-CUkjnoVk.js";import{T as qt}from"./TmuxPeek-CXFeweMg.js";import{TerminalHeaderMount as Ts}from"./TerminalHeaderMount-Cq4OD_xN.js";import{R as Yt}from"./refresh-cw-BmVr7sCD.js";import{P as _e}from"./plus-DFDDeGKu.js";import{c as qs}from"./createLucideIcon-zZ8Hx7er.js";import{T as ue}from"./terminal-hQKQygcf.js";import{L as Ys}from"./log-in-7SnYqW5w.js";import{Z as Vt}from"./zap-CEjZNZbI.js";import{S as pr}from"./runtime-picker-DXu2bOTh.js";import{S as hr}from"./search-DT42oyRW.js";import{X as Xe}from"./x-DAehov0E.js";import{E as fr}from"./eye-LrO-cXQt.js";import{E as Jt}from"./external-link-CUObqmgX.js";const mt=["terminal:ack"];function Vs(e={}){const{url:t="ws://localhost:3600",healthUrl:n,token:a,systemPrompt:c,cwd:o,workspaceFiles:u,autoConnect:m=!1,sessionKey:l,orphanTTL:p,backend:k,controlMode:y="owner",tmuxSession:j,zellijSession:C,zellijSocketDir:E,agent:g,provider:N,model:b,flowControl:_}=e,L=l?`hudson.relay.${l}`:null,v=()=>{if(!L)return null;try{const S=localStorage.getItem(L);if(!S)return null;if(S.startsWith("{")){const W=JSON.parse(S);return typeof W.id!="string"?null:{id:W.id,reconnectToken:typeof W.reconnectToken=="string"?W.reconnectToken:null}}return{id:S,reconnectToken:null}}catch{return null}},T=i.useCallback((S,W=null)=>{if(L)try{S?localStorage.setItem(L,JSON.stringify({id:S,reconnectToken:W})):localStorage.removeItem(L)}catch{}},[L]),[A,D]=i.useState("disconnected"),[x,I]=i.useState(null),[M,V]=i.useState(null),[oe,ce]=i.useState(null),[me,pe]=i.useState(o||"~"),q=i.useRef(null),ee=i.useRef(null),K=i.useRef({cols:80,rows:24}),X=i.useRef(!1),J=i.useRef([]),ne=i.useRef(0),ae=i.useRef(0),de=i.useRef(0),xe=i.useRef(me);xe.current=me;const ye=i.useRef(!1),ge=i.useRef(null);ye.current||(ye.current=!0,ge.current=v());const se=i.useRef(ge.current?.id??null),U=i.useRef(ge.current?.reconnectToken??null),w=i.useRef(null),F=i.useRef(new Set),z=_?.maxBufferedBytes??512*1024,O=i.useCallback(S=>{const W=q.current;W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify(S))},[]),H=i.useCallback((S,W)=>{typeof S=="number"&&W===de.current&&O({type:"terminal:ack",seq:S})},[O]),he=i.useCallback(()=>{de.current+=1,J.current=[],ne.current=0},[]),De=i.useCallback((S,W=null)=>{const re=de.current;if(!S){H(W,re);return}let Q=!1;const ie=()=>{Q||(Q=!0,H(W,re))};if(w.current)try{w.current(S,ie)}catch{ie()}else for(J.current.push({data:S,seq:W,ack:ie}),ne.current+=S.length;ne.current>z&&J.current.length>0;){const G=J.current.shift();if(!G)break;ne.current-=G.data.length,G.ack()}if(F.current.size>0)for(const G of F.current)try{G(S)}catch{}},[H,z]),Ne=i.useCallback(()=>{const S=q.current;S&&(S.close(),q.current=null)},[]),we=i.useCallback(()=>{ae.current+=1,ee.current&&(clearTimeout(ee.current),ee.current=null),Ne(),X.current=!1,D("disconnected")},[Ne]),je=i.useCallback(()=>{const S=xe.current;return{type:"session:init",cols:K.current.cols,rows:K.current.rows,clientCapabilities:[...mt],...c?{systemPrompt:c}:{},...S?{cwd:S}:{},...u?{workspaceFiles:u}:{},...p?{orphanTTL:p}:{},...k?{backend:k}:{},...y!=="owner"?{controlMode:y}:{},...j?{tmuxSession:j}:{},...C?{zellijSession:C}:{},...E?{zellijSocketDir:E}:{},...g?{agent:g}:{},...N?{provider:N}:{},...b?{model:b}:{}}},[g,k,y,b,p,N,c,j,u,C,E]),ve=i.useCallback(()=>{X.current||(X.current=!0,se.current?O({type:"session:reconnect",sessionId:se.current,...U.current?{reconnectToken:U.current}:{},cols:K.current.cols,rows:K.current.rows,clientCapabilities:[...mt],...y!=="owner"?{controlMode:y}:{}}):O(je()))},[O,je,y]),Se=i.useCallback(async()=>{const S=ae.current+1;ae.current=S,Ne(),de.current+=1,X.current=!1,D("connecting"),V(null),ce(null);const W=n||`${t.replace(/^ws(s?):\/\//,"http$1://")}/health`;try{const G=await fetch(W,{signal:AbortSignal.timeout(2e3)});if(!G.ok)throw new Error(`Relay health check failed: ${G.status}`)}catch{if(ae.current!==S)return;D("error"),V("Relay service is not running");return}if(ae.current!==S)return;Ne();const re=a?`${t}${t.includes("?")?"&":"?"}token=${encodeURIComponent(a)}`:t,Q=new WebSocket(re);q.current=Q;const ie=()=>ae.current===S&&q.current===Q;Q.onopen=()=>{if(!ie()){Q.close();return}ve()},Q.onmessage=G=>{if(ie())try{const B=JSON.parse(G.data);switch(B.type){case"session:ready":se.current=B.sessionId,U.current=typeof B.reconnectToken=="string"?B.reconnectToken:null,T(B.sessionId,U.current),I(B.sessionId),D("connected"),V(null),ce(null);break;case"session:expired":{se.current=null,U.current=null,T(null),X.current=!1,he(),De("\x1B[2J\x1B[H",null),O(je()),X.current=!0;break}case"session:error":D("error"),V(B.error||"Session failed to start");break;case"terminal:data":De(B.data||"",typeof B.seq=="number"?B.seq:null);break;case"session:exit":se.current=null,U.current=null,T(null),he(),I(null),ce(B.exitCode??null),B.exitCode!==0?(D("error"),V(B.reason||`Process exited with code ${B.exitCode}`)):D("disconnected");break;case"session:detached":se.current=null,U.current=null,T(null),I(null);break}}catch{}},Q.onclose=()=>{ie()&&(q.current=null,X.current=!1,D(G=>G==="error"?G:"disconnected"))},Q.onerror=()=>{ie()&&(D("error"),V("Could not connect to relay"))}},[t,n,a,ve,Ne,O,De,je,T,he]),We=i.useCallback(S=>{y!=="observe"&&O({type:"terminal:input",data:S})},[y,O]),$e=i.useCallback(S=>{y!=="observe"&&O({type:"terminal:input",data:S+"\r"})},[y,O]),Fe=i.useCallback((S,W)=>{K.current={cols:S,rows:W},X.current&&O({type:"terminal:resize",cols:S,rows:W})},[O]),fe=i.useCallback(S=>{if(w.current=S,!S||J.current.length===0)return;const W=J.current;J.current=[],ne.current=0;for(const re of W)try{S(re.data,re.ack)}catch{re.ack()}},[]),Qe=i.useCallback(S=>(F.current.add(S),()=>{F.current.delete(S)}),[]);i.useEffect(()=>(m&&Se(),()=>{we()}),[]);const Y=i.useCallback(()=>{we(),se.current=null,U.current=null,I(null),T(null),he(),V(null),ce(null),ee.current=setTimeout(()=>{ee.current=null,Se()},200)},[we,Se,T,he]);return{status:A,sessionId:x,error:M,exitCode:oe,cwd:me,controlMode:y,setCwd:pe,onData:fe,subscribeData:Qe,sendInput:We,sendLine:$e,resize:Fe,connect:Se,disconnect:we,restart:Y}}const kr=[["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"}]],Ds=qs("ellipsis",kr);const br=[["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"}]],Gt=qs("grid-2x2",br);const xr=[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]],yr=qs("grip-horizontal",xr),Xt=6,Qt=2;function cs(e){if(e.layout?.mode)return{mode:e.layout.mode,...e.layout.columns===void 0?{}:{columns:gr(e.layout.columns)}};const t=e.cellCount??0,n=us(e.columns??Qt);return t<=1?{mode:"solo"}:n>=t?{mode:"lanes",columns:n}:{mode:"grid",columns:n}}function ds(e,t){const n=Math.max(1,Math.floor(t.tileCount)||1);if(e.mode==="solo")return 1;if(e.columns===void 0||e.columns==="dynamic"){const a=e.mode==="lanes"?n:Math.ceil(Math.sqrt(n));return Math.max(1,Math.min(Xt,a))}return us(e.columns)}function gr(e){return e==="dynamic"?"dynamic":us(e)}function jr(e){if(e.mode==="solo")return"Solo";const t=e.mode==="lanes"?"Lanes":"Grid";return e.columns===void 0||e.columns==="dynamic"?`${t} · dynamic`:`${t} · ${e.columns} column${e.columns===1?"":"s"}`}function us(e){return typeof e!="number"||!Number.isFinite(e)?Qt:Math.max(1,Math.min(Xt,Math.floor(e)))}const Js=6;function Sr(e="main",t="Main"){return{version:1,activeWorkspaceId:e,workspaces:[{id:e,name:t,tiles:[]}]}}function Gs(){return{version:1,activeWorkspaceId:"",workspaces:[]}}function pt(e,t,n={}){const a=()=>n.allowEmpty?Gs():Sr();if(!e||typeof e!="object")return a();const c=e;if(!Array.isArray(c.workspaces))return a();const o=[],u=new Set;for(const l of c.workspaces){if(!l||typeof l!="object")continue;const p=typeof l.id=="string"?l.id.trim():"",k=typeof l.name=="string"?l.name.trim():"";if(!p||!k||u.has(p)||!Array.isArray(l.tiles))continue;u.add(p);const y=typeof l.purpose=="string"?l.purpose.trim():"",j=Cr(l.columns),C=wr(l.layout),E=typeof l.updatedAt=="number"&&Number.isFinite(l.updatedAt)&&l.updatedAt>=0?l.updatedAt:null;o.push({id:p,name:k,tiles:l.tiles.filter(t),...y?{purpose:y}:{},...j?{columns:j}:{},...C?{layout:C}:{},...E===null?{}:{updatedAt:E}})}return o.length===0?a():{version:1,activeWorkspaceId:typeof c.activeWorkspaceId=="string"&&u.has(c.activeWorkspaceId)?c.activeWorkspaceId:o[0].id,workspaces:o}}function wr(e){if(!e||typeof e!="object")return null;const t=e;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 n=us(t.columns);return{mode:t.mode,columns:n}}function Cr(e){if(typeof e!="number"||!Number.isFinite(e))return null;const t=Math.floor(e);return t<1?null:Math.min(t,Js)}function ht(e,t){const n=t.id.trim();if(!n)return e;const a={...t,id:n},o=e.workspaces.some(u=>u.id===n)?e.workspaces.map(u=>u.id===n?a:u):[a,...e.workspaces];return{...e,activeWorkspaceId:n,workspaces:o}}function ft(e,t,n){const a=e.workspaces.findIndex(m=>m.id===t);if(a<0)return e;const c=e.workspaces[a],o={...c,...n};return Object.keys(n).every(m=>c[m]===o[m])?e:{...e,workspaces:e.workspaces.map((m,l)=>l===a?o:m)}}function Nr(e,t){return t===e.activeWorkspaceId||!e.workspaces.some(n=>n.id===t)?e:{...e,activeWorkspaceId:t}}function vr(e,t,n={}){if(e.workspaces.length<=1)return n.allowEmpty&&e.workspaces[0]?.id===t?Gs():e;const a=e.workspaces.findIndex(u=>u.id===t);if(a<0)return e;const c=e.workspaces.filter(u=>u.id!==t),o=e.activeWorkspaceId===t?c[Math.min(a,c.length-1)].id:e.activeWorkspaceId;return{...e,activeWorkspaceId:o,workspaces:c}}function Tr(e,t,n){return n>1?{axis:"horizontal",edge:e.x<t.left+t.width/2?"before":"after"}:{axis:"vertical",edge:e.y<t.top+t.height/2?"before":"after"}}function Ir(e,t,n,a){if(t===n)return[...e];const c=e.findIndex(k=>k.id===t),o=e.findIndex(k=>k.id===n);if(c<0||o<0)return[...e];const u=[...e],[m]=u.splice(c,1);if(!m)return[...e];const l=u.findIndex(k=>k.id===n),p=a==="after"?l+1:l;return u.splice(Math.max(0,p),0,m),u}const Rr="openscout.terminal.workspaces.v1",Er=2,Mr="openscout.terminal.workspace-view.v1",Is=2;function is(e){const t=typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);return`${e}-${Date.now().toString(36)}-${t}`}const Ar=24;function Zt(e,t,n){const a=t.replace(/[^A-Za-z0-9_-]+/gu,"-").replace(/^[^A-Za-z0-9_]+/u,"").slice(0,Ar).replace(/-+$/u,""),c=Lr(JSON.stringify([n,t,e]));return`scout-${e}-${a||"cell"}-${c}`}function Lr(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}function qe(e,t="shell"){return{id:is("cell"),kind:"fresh",backend:e,agent:t}}function kt(e){if(!e||typeof e!="object")return!1;const t=e;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 bt(e){return{id:e.id,name:e.name,...e.purpose?{purpose:e.purpose}:{},columns:e.columns,...e.layout?{layout:e.layout}:{},updatedAt:e.updatedAt,tiles:e.cells.map(t=>t.surfaceId&&t.terminalSessionId?{id:t.id,kind:"registered",terminalSessionId:t.terminalSessionId,terminalSurfaceKey:t.surfaceId}:{id:t.id,kind:"fresh",backend:Wr(t.intent.hostId)?t.intent.hostId:"pty",agent:"shell"})}}function Rs(e,t={}){return{id:e.id,name:e.name,purpose:e.purpose??"",columns:ds(cs({layout:e.layout,columns:e.columns,cellCount:e.tiles.length}),{tileCount:e.tiles.length}),layout:cs({layout:e.layout,columns:e.columns,cellCount:e.tiles.length}),cells:e.tiles.map(n=>n.kind==="registered"?{id:n.id,surfaceId:n.terminalSurfaceKey,terminalSessionId:n.terminalSessionId,intent:Dr(n,t.sessions??[])}:{id:n.id,intent:{hostId:n.backend,sessionName:n.backend==="pty"?null:Zt(n.backend,n.id,e.id)}})}}function Dr(e,t){const n=$t(e.terminalSurfaceKey),a=t.find(c=>c.id===e.terminalSessionId||c.surfaces.some(o=>Ot(o,e.terminalSurfaceKey)));return{...n?{hostId:n.backend,sessionName:n.hostSession}:{},...a?.cwd?{cwd:a.cwd}:{},...a?.harness?{harness:a.harness}:{},...a?.resumeCommand?{resumeCommand:a.resumeCommand}:{}}}function Wr(e){return e==="pty"||e==="tmux"||e==="zellij"||e==="herdr"}function $r(e){if(!Array.isArray(e))return pt(e,kt,{allowEmpty:!0});const t=e.flatMap(n=>{if(!n||typeof n!="object")return[];const a=n;if(typeof a.id!="string"||!a.id.trim())return[];const c=Array.isArray(a.cells)?a.cells:[];return[{id:a.id,name:typeof a.name=="string"&&a.name.trim()?a.name:a.id,purpose:a.purpose,columns:a.columns,updatedAt:a.updatedAt,tiles:c.map((o,u)=>({...o,id:`${a.id}-${u}`}))}]});return pt({activeWorkspaceId:t[0]?.id??"",workspaces:t},kt,{allowEmpty:!0})}function Or(e,t,n){const a=e.find(c=>c.id===t);return a?a.capabilities.control.includes(n)||a.capabilities.harnessControl.includes(n):!1}function Pr(e,t){return e.find(n=>n.id===t)??null}function zr(e){return[{value:"pty",label:"Shell",detail:"Disposable local shell",relayAttach:!0},...e.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,n)=>Number(n.relayAttach)-Number(t.relayAttach)||t.value.localeCompare(n.value))]}const xt={name:"name",session:"name",title:"name",project:"project",repo:"project",in:"project",cwd:"cwd",path:"cwd",dir:"cwd",harness:"harness",agent:"harness",owner:"owner",by:"owner",backend:"backend",host:"backend",mux:"backend",multiplexer:"backend",branch:"branch",model:"model",role:"role",node:"node",machine:"node",delivery:"delivery",msg:"delivery",message:"delivery",cmd:"command",command:"command",run:"command",screen:"screen",output:"screen",pane:"panes",panes:"panes",inside:"panes",is:"is",state:"is"},_r={name:100,owner:80,command:60,panes:55,screen:50,delivery:45,project:40,harness:34,branch:30,model:26,role:26,backend:24,condition:20,node:20,cwd:18},en=new Set(["screen","panes","delivery"]),Fr=["name","owner","command","panes","screen","delivery","project","harness","branch","model","role","backend","condition","cwd"];function sn(e){const t=[],n=/(-?)(?:([a-z]+):)?(?:"([^"]*)"|(\S+))/gi;for(const a of e.matchAll(n)){const[,c,o,u,m]=a,l=(u??m??"").trim().toLowerCase(),p=o?xt[o.toLowerCase()]??null:null;if(l&&!(!o&&l.endsWith(":")&&xt[l.slice(0,-1)])){if(o&&p===null){t.push({field:null,value:`${o.toLowerCase()}:${l}`,negated:c==="-"});continue}t.push({field:p,value:l,negated:c==="-"})}}return t}function Kr(e){return e.some(t=>t.field==="screen")}function Br(e){return e.some(t=>t.field==="delivery")}function Ur(e){return e.some(t=>t.field==="panes")}function yt(e,t){switch(t){case"name":return e.name;case"owner":return e.owner??"";case"project":return e.project;case"cwd":return e.cwd;case"harness":return e.harness;case"backend":return e.backend;case"branch":return e.branch??"";case"model":return e.model??"";case"role":return e.role??"";case"node":return e.node??"";case"delivery":return e.delivery??"";case"command":return e.command;case"condition":return e.condition;case"screen":return e.screen??"";case"panes":return e.panes??"";default:return""}}function Hr(e,t){if(!e||!t)return 0;const n=e.toLowerCase(),a=n.indexOf(t);if(a<0)return 0;if(n===t)return 1;const c=a===0?"":n[a-1];return a===0||!/[a-z0-9]/.test(c)?.75:.4}function qr(e,t){switch(t){case"live":case"running":case"active":return e.live;case"idle":case"inactive":case"dead":case"exited":return!e.live;case"agent":return e.kind==="agent"||!!e.owner;case"multiplexer":case"multi":return e.kind==="multiplexer";case"herdr":case"tmux":case"zellij":return e.backend.toLowerCase()===t;case"session":case"plain":return e.kind==="session";default:return e.condition.toLowerCase().includes(t)}}function tn(e,t){return e===null||e<=0?1:1+.5/(1+Math.max(0,t-e)/36e5)}function Yr(e,t,n){if(t.length===0)return{score:Vr(e,n),matchedOn:[],excerpt:null,excerptField:null};let a=0;const c=new Map;let o=null,u=null;for(const m of t){if(m.field==="is"){const y=qr(e,m.value);if(y===m.negated)return null;y&&(a+=30);continue}const l=m.field?[m.field]:Fr;let p=0,k="";for(const y of l){const j=Hr(yt(e,y),m.value);if(j<=0)continue;const C=j*(_r[y]??10);C>p&&(p=C,k=y)}if(m.negated){if(p>0)return null;continue}if(p<=0)return null;a+=p,c.set(k,Math.max(c.get(k)??0,p)),en.has(k)&&!o&&(o=Jr(yt(e,k),m.value),o&&(u=k))}return{score:a*tn(e.activityAt,n)+(e.live?12:0),matchedOn:[...c.entries()].sort((m,l)=>l[1]-m[1]).map(([m])=>m),excerpt:o,excerptField:u}}function Vr(e,t){return(e.live?1e3:0)+tn(e.activityAt,t)*10}function Jr(e,t,n=120){if(!e||!t)return null;for(const a of e.split(`
2
+ `)){const c=a.toLowerCase().indexOf(t);if(c<0)continue;const o=a.trim();if(o.length<=n)return o;const u=Math.max(0,c-Math.floor(n/3));return`${u>0?"…":""}${a.slice(u,u+n).trim()}${u+n<a.length?"…":""}`}return null}function Gr(e,t,n=Date.now()){const a=sn(t),c=[];for(const o of e){const u=Yr(o.target,a,n);u&&c.push({target:o.target,item:o.item,score:u.score,matchedOn:u.matchedOn,excerpt:u.excerpt,excerptField:u.excerptField})}return c.sort((o,u)=>u.score-o.score||(u.target.activityAt??0)-(o.target.activityAt??0)||o.target.name.localeCompare(u.target.name))}function Xr(e,t){const n=e?.[t];return typeof n=="string"?n:""}function gt(e,t={}){return{id:e.id,name:e.title||e.surface.sessionName,owner:t.owner??"",branch:t.branch??"",model:t.model??"",role:t.role??"",node:t.node??"",delivery:t.delivery??"",project:e.project,cwd:e.session.cwd||e.cwdLabel,harness:e.session.harness,backend:e.surface.backend,command:Xr(e.session.metadata,"currentCommand"),condition:e.condition,kind:t.kind??(e.origin==="backend"?"multiplexer":"session"),live:nr(e)>0,activityAt:Ut(e),...t.screen===void 0?{}:{screen:t.screen},...t.panes===void 0?{}:{panes:t.panes}}}function Qr(e){return[e.name,e.handle?`@${e.handle}`:""].filter(Boolean).join(" ")}function nn(e){return{owner:Qr(e),branch:e.branch??"",model:e.model??"",role:e.role??e.agentClass??"",node:[e.homeNodeName,e.authorityNodeName].filter(t=>!!t).filter((t,n,a)=>a.indexOf(t)===n).join(" "),delivery:rn(e)}}function rn(e){return(e.brokerActivity??[]).map(t=>[t.kind,t.state??"",t.summary].filter(Boolean).join(" ")).join(`
3
+ `)}function Zr(e,t={}){return{id:`agent:${e.id}`,name:e.name,...nn(e),project:e.project??e.projectRoot??"",cwd:e.cwd??e.projectRoot??"",harness:e.harness??"",backend:t.backend??e.transport??"",command:"",condition:Ht(e.state,e),kind:"agent",live:t.live??or(e.state,e),activityAt:e.updatedAt}}function ea(e){const t=[],n=[];for(const a of e)a.negated||!a.value||(a.field===null?t.push(a.value):en.has(a.field)&&n.push(a.value));return{text:t,screen:n}}function sa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ta(e,t){const n=t.filter(c=>c.length>0);if(!e||n.length===0)return[{text:e,match:!1}];const a=new RegExp(`(${n.map(sa).join("|")})`,"ig");return e.split(a).map((c,o)=>({text:c,match:o%2===1})).filter(c=>c.text.length>0)}const na=2e4,ra=100;let as=null;async function aa(){const e=await Le(`/api/agents?limit=${ra}`),t=new Map;for(const n of e){const a=rn(n);a&&t.set(n.id,a)}return t}function ia(e){const[t,n]=i.useState(new Map),[a,c]=i.useState(!1),o=i.useRef(0);return i.useEffect(()=>{if(!e){c(!1);return}const u=as&&Date.now()-as.at<na?as.deliveries:null;if(u){n(u),c(!1);return}const m=++o.current;return c(!0),aa().then(l=>{as={deliveries:l,at:Date.now()},o.current===m&&n(l)}).catch(()=>{}).finally(()=>{o.current===m&&c(!1)}),()=>{o.current+=1}},[e]),{deliveries:t,reading:a}}function la(e,t){const n=e?.trim()??"";return n&&t!=null&&n!==String(t)?`${n} ${t}`:n||(t!=null?String(t):"")}function oa(e,t){const n=e?.trim()??"";return n&&n!==String(t)?n:t!=null?String(t):n}function ca(e){const t=[];for(const n of e.workspaces){const a=la(n.label,n.number);for(const c of n.tabs){const o=oa(c.label,c.number);for(const u of c.panes){const m=[a,o,u.label?.trim()??"",u.agent??""].map(l=>l.trim()).filter(Boolean);!u.label?.trim()&&!u.agent&&m.push("shell"),u.agent&&u.agentStatus!=="unknown"&&m.push(u.agentStatus),t.push(m.join(" › "))}}}return t.join(`
4
+ `)}const da=2e4,Ws=12,ua=3,jt=new Map;async function ma(e){try{const t=await Gn(e.surface.sessionName),n=ca(t);return n.length>0?n:null}catch{return null}}async function pa(e,t,n){let a=0;const c=async()=>{for(;a<e.length&&!n();){const o=e[a++];await t(o)}};await Promise.all(Array.from({length:Math.min(ua,e.length)},c))}function ha(e){return e.filter(t=>t.surface.backend==="herdr")}function fa(e,t){const[n,a]=i.useState(new Map),[c,o]=i.useState(!1),u=e.map(l=>l.id).join("|"),m=i.useRef(0);return i.useEffect(()=>{if(!t){o(!1);return}const l=++m.current,p=()=>m.current!==l,k=[...e].sort((E,g)=>(g.session.updatedAt??0)-(E.session.updatedAt??0)).slice(0,Ws),y=Date.now(),j=new Map,C=[];for(const E of k){const g=jt.get(E.id);g&&y-g.at<da?j.set(E.id,g.body):C.push(E)}if(a(j),C.length===0){o(!1);return}return o(!0),pa(C,async E=>{const g=await ma(E);p()||g!==null&&(jt.set(E.id,{body:g,at:Date.now()}),a(N=>new Map(N).set(E.id,g)))},p).finally(()=>{p()||o(!1)}),()=>{m.current+=1}},[t,u]),{panes:n,reading:c}}const ka=2e4,ba=200,$s=24,xa=4,St=new Map;async function ya(e){const t=new URLSearchParams({backend:e.surface.backend,sessionName:e.surface.sessionName,lines:String(ba)});e.surface.paneId&&t.set("paneId",e.surface.paneId);try{const n=await Le(`/api/terminal-sessions/peek?${t.toString()}`);return n.available&&n.body?n.body:null}catch{return null}}async function ga(e,t,n){let a=0;const c=async()=>{for(;a<e.length&&!n();){const o=e[a++];await t(o)}};await Promise.all(Array.from({length:Math.min(xa,e.length)},c))}function ja(e,t){const[n,a]=i.useState(new Map),[c,o]=i.useState(!1),u=e.map(l=>l.id).join("|"),m=i.useRef(0);return i.useEffect(()=>{if(!t){o(!1);return}const l=++m.current,p=()=>m.current!==l,k=[...e].sort((E,g)=>(g.session.updatedAt??0)-(E.session.updatedAt??0)).slice(0,$s),y=Date.now(),j=new Map,C=[];for(const E of k){const g=St.get(E.id);g&&y-g.at<ka?j.set(E.id,g.body):C.push(E)}if(a(j),C.length===0){o(!1);return}return o(!0),ga(C,async E=>{const g=await ya(E);p()||g!==null&&(St.set(E.id,{body:g,at:Date.now()}),a(N=>new Map(N).set(E.id,g)))},p).finally(()=>{p()||o(!1)}),()=>{m.current+=1}},[t,u]),{screens:n,capturing:c}}async function Sa(){return Le("/api/terminal-workspaces")}async function wt(e){return(await Le(`/api/terminal-workspaces/${encodeURIComponent(e.id)}`,{method:"PUT",body:JSON.stringify(e)})).workspace}async function wa(e,t){return Le(`/api/terminal-workspaces/${encodeURIComponent(e)}/cells/${encodeURIComponent(t)}/revive`,{method:"POST",body:"{}"})}async function Ca(e){return(await Le(`/api/terminal-workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})).deleted}function Na(e){const t=new Map;for(const n of e?.cells??[])t.set(n.cellId,n);return t}const Ct="scout:terminal-send-line";function va(e){const t=e.detail;if(!t||typeof t!="object"||!("line"in t))return null;const n=t.line;return typeof n=="string"&&n.trim().length>0?n:null}function Ta(e){const t=e?.modes?.mouseTrackingMode;return typeof t=="string"&&t!=="none"}function an(){const e=i.useRef(null),t=i.useCallback(l=>{e.current=l??null},[]),n=i.useCallback(()=>{try{return e.current?.getSelection?.()??""}catch{return""}},[]),a=i.useCallback(()=>{const l=n();l&&ls(l)},[n]),c=i.useCallback((l,p)=>{const k=e.current;if(typeof k?.paste=="function"){k.paste(l);return}p(l)},[]),o=i.useCallback(l=>{navigator.clipboard?.readText&&navigator.clipboard.readText().then(p=>{p&&c(p,l)}).catch(()=>{})},[c]),u=i.useCallback(l=>!l.shiftKey&&Ta(e.current),[]),m=i.useCallback(l=>{if(l.key.toLowerCase()!=="c"||!(l.metaKey&&!l.ctrlKey&&!l.altKey||l.ctrlKey&&l.shiftKey&&!l.metaKey&&!l.altKey))return;const k=n();k&&(l.preventDefault(),l.stopPropagation(),ls(k))},[n]);return{copySelection:a,handleCopyShortcut:m,handleTerminalReady:t,pasteClipboardText:o,pasteText:c,readSelection:n,rightClickBelongsToApp:u}}function ln(e){const{focusTerminal:t,readOnly:n=!1,sendInput:a}=e,c=an(),o=_s(),{copySelection:u,pasteClipboardText:m,readSelection:l,rightClickBelongsToApp:p}=c,k=i.useCallback(y=>{if(y.preventDefault(),p(y))return;const j=l(),C=[];j.trim()&&C.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:u}),n||C.push({kind:"action",label:"Paste",shortcut:"⌘V",onSelect:()=>m(a)}),C.length>0&&C.push({kind:"separator"}),C.push({kind:"action",label:"Focus Terminal",onSelect:t}),o(y,C)},[u,t,m,n,l,p,a,o]);return i.useMemo(()=>({handleContextMenu:k,handleCopyShortcut:c.handleCopyShortcut,handleTerminalReady:c.handleTerminalReady}),[k,c.handleCopyShortcut,c.handleTerminalReady])}const Me=["multiplexer","agent","session"];function Ia(e,t){if(t==="Home")return Me[0];if(t==="End")return Me[Me.length-1];const n=t==="ArrowRight"||t==="ArrowDown"?1:t==="ArrowLeft"||t==="ArrowUp"?-1:0;if(n===0)return null;const c=(Me.indexOf(e)+n+Me.length)%Me.length;return Me[c]??null}function Es(e){return`terminal-picker-tab-${e}`}function Nt(){return"terminal-picker-panel"}const Ye=typeof window>"u"?i.useEffect:i.useLayoutEffect,Ra=[["all","All"],["running","Running"],["exited","Exited"]],Ea="openscout.terminal.picker-view.v1",Ma="openscout.terminal.picker-source.v1",vt={mode:"grid",columns:"dynamic"},Tt=[{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}],on=[{value:"shell",label:"Shell"},{value:"codex",label:"Codex"},{value:"claude",label:"Claude"},{value:"pi",label:"Pi"}],Ms="'JetBrainsMono Nerd Font', 'JetBrainsMonoNL Nerd Font', 'MesloLGS Nerd Font Mono', 'Hack Nerd Font Mono', 'JetBrains Mono', monospace",It=e=>{},Aa=()=>{};function La(){if(typeof window>"u")return{fontFamily:Ms,fontSize:13};const e=new URLSearchParams(window.location.search),t=e.get("terminalFontFamily")?.trim(),n=Number(e.get("terminalFontSize"));return{fontFamily:t?`'${t.replaceAll("'","\\'")}', ${Ms}`:Ms,fontSize:Number.isFinite(n)&&n>=9&&n<=32?n:13}}function Xs(e){const t=La();return s.jsx(dr,{...e,renderer:e.renderer??"auto",fontFamily:t.fontFamily,fontSize:t.fontSize})}function Da(e,t){const[n,a]=i.useState({state:"loading",sessions:[]}),c=i.useCallback(()=>{a(u=>({state:"loading",sessions:u.sessions})),Pt({includeDiscovered:!0}).then(u=>{a({state:"ready",sessions:u})}).catch(u=>{a(m=>({state:"failed",sessions:m.sessions,error:u instanceof Error?u.message:String(u)}))})},[]);return i.useEffect(()=>{c()},[c]),{target:i.useMemo(()=>Ft(n.sessions,e,t),[n.sessions,e,t]),loadState:n.state,loadSessions:c,hasSessionHint:!!e}}function Wa(e,t,n){const a=Kn(t,n),[c,o]=i.useState(a?{state:"preparing"}:{state:"ready"}),[u,m]=i.useState(0);return i.useEffect(()=>{if(!a||!e){o({state:"ready"});return}let l=!1;return o({state:"preparing"}),Le(`/api/agents/${encodeURIComponent(e)}/session-catalog`).then(p=>{if(p.resumeCommand)return ur({command:p.resumeCommand,cwd:p.resumeCwd,agentId:e})}).then(()=>{l||o({state:"ready"})}).catch(p=>{l||o({state:"failed",error:p instanceof Error?p.message:String(p)})}),()=>{l=!0}},[e,a,u]),{ready:c.state==="ready",label:c.state==="failed"?"TAKEOVER FAILED":"PREPARING TAKEOVER",status:c.state==="failed"?c.error:"Resolving live session...",onRetry:c.state==="failed"?()=>m(l=>l+1):void 0}}function $a(e){const{agentId:t,agent:n,mode:a,navigate:c,registeredTarget:o,showContextMenu:u}=e,{hosts:m}=Us(),l=n?Dt(n.name):"var(--accent)",p=i.useRef(null),{handleCopyShortcut:k,handleTerminalReady:y,pasteClipboardText:j,readSelection:C,rightClickBelongsToApp:E}=an(),g=o?Bs(o.surface):Ce(n),N=a==="observe",b=o?.session.cwd??n?.cwd??n?.projectRoot??void 0,_=Ps(),L=zs(),v=Bn({agentId:t,agent:n,registeredTarget:o,terminalSurface:g,relayUrl:_,harness:o?.session.harness??n?.harness,cwd:b,mode:a}),T=Vs({url:v.scopedRelayUrl,healthUrl:L,autoConnect:!0,...N?{}:{sessionKey:v.relayStorageSessionKey},...v.surfaceOptions??{},...v.orphanTTL?{orphanTTL:v.orphanTTL}:{},...v.cwd?{cwd:v.cwd}:{},...v.relayAgent?{agent:v.relayAgent}:{},controlMode:v.controlMode});Ye(()=>{T.resize(Fs,Ks)},[T.resize]);const A=i.useMemo(()=>N?{...T,sendInput:It,sendLine:It,restart:Aa}:T,[N,T]),D=Un({agentId:t,registeredTarget:o}),x=os(D,a),I=i.useCallback(()=>{const w=p.current;w?.querySelector(".xterm-helper-textarea")?.focus(),w?.querySelector(".xterm")?.focus()},[]);i.useEffect(()=>{const w=O=>{const H=O.detail?.line;return typeof H=="string"&&H.length>0?H:null},F=O=>{const H=w(O);!H||N||(A.sendInput(H),I())},z=O=>{const H=w(O);!H||N||(A.sendLine(H),I())};return window.addEventListener("scout:terminal-send-input",F),window.addEventListener("scout:terminal-send-line",z),()=>{window.removeEventListener("scout:terminal-send-input",F),window.removeEventListener("scout:terminal-send-line",z)}},[I,N,A]);const M=i.useCallback(w=>g?Hn(g,w):null,[g]),V=i.useCallback(()=>{ls(Wt(x))},[x]),oe=i.useCallback(()=>{N||j(A.sendInput)},[j,N,A]),ce=i.useCallback(()=>{ns(v.relayStorageSessionKey);const w=M("detach");if(w){w.finally(()=>T.disconnect());return}T.disconnect()},[v.relayStorageSessionKey,T,M]),me=i.useCallback(()=>{ns(v.relayStorageSessionKey);const w=M("force-quit-bridge");if(w){w.finally(()=>{T.connect(),window.setTimeout(I,250)});return}T.connect(),window.setTimeout(I,250)},[v.relayStorageSessionKey,I,T,M]),pe=i.useCallback(()=>{if(N)return;const w=M("interrupt");w?w.catch(()=>A.sendInput("")):A.sendInput(""),I()},[I,N,M,A]),q=i.useCallback(()=>{if(N)return;const w=M("quit");w?w.catch(()=>A.sendInput("")):A.sendInput(""),I()},[I,N,M,A]),ee=i.useCallback(()=>{if(N)return;const w=M("stop-job");if(w){w.finally(I);return}I()},[I,N,M]),K=i.useCallback(()=>{if(ns(v.relayStorageSessionKey),g&&!window.confirm(`Force quit Claude in ${Ls(g.sessionName)}?`))return;const w=M("force-quit");if(w){w.finally(()=>T.disconnect());return}const F=T.sessionId;if(!F){T.disconnect();return}qn(F).catch(()=>{}).finally(()=>T.disconnect())},[v.relayStorageSessionKey,T,M,g]),X=i.useCallback(()=>{if(!g||!window.confirm(`Restart Claude in ${Ls(g.sessionName)} and resume its latest session?`))return;ns(v.relayStorageSessionKey);const w=M("restart-resume");w&&w.finally(()=>{T.disconnect(),window.setTimeout(()=>{T.connect(),window.setTimeout(I,250)},600)})},[v.relayStorageSessionKey,I,T,M,g]),J=i.useCallback(w=>{c(os(D,w))},[c,D]),ne=i.useCallback(()=>{c(D)},[c,D]),ae=!!(o||g),de=!N&&!!(g||T.status==="connected"),xe=!N&&!!g,ye=i.useMemo(()=>{const w=g?.backend??null,F=H=>Or(m,w,H),z=[];(!w||F("detach"))&&z.push({kind:"action",label:"Leave this session running",onSelect:ce}),z.push({kind:"action",label:"Reconnect",onSelect:me});const O=[];return F("restart-resume")&&O.push({kind:"action",label:"Restart Claude and resume",onSelect:X}),F("force-quit")&&O.push({kind:"action",label:"Force quit Claude",onSelect:K}),O.length>0&&z.push({kind:"separator"},...O),z},[ce,K,me,X,m,g?.backend]),ge=i.useMemo(()=>{const w=[...ye],F=[];de&&F.push({kind:"action",label:"Send Ctrl-C",shortcut:"⌃C",onSelect:pe},{kind:"action",label:"Quit With Ctrl-D",shortcut:"⌃D",onSelect:q}),xe&&F.push({kind:"action",label:"Stop Running Job",onSelect:ee}),F.length>0&&w.push({kind:"separator"},...F);const z=[];return g&&z.push({kind:"action",label:N?"Open Takeover":"Open Observe",onSelect:()=>J(N?"takeover":"observe")}),o&&z.push({kind:"action",label:"Open Summary",onSelect:ne}),z.length>0&&w.push({kind:"separator"},...z),w},[de,xe,pe,J,ne,q,N,o,ye,ee,g]),se=i.useCallback(w=>{u(w,ge)},[ge,u]),U=i.useCallback(w=>{if(w.preventDefault(),E(w))return;const F=C(),z=[];F.trim()&&z.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>{ls(F)}}),N||z.push({kind:"action",label:"Paste",shortcut:"⌘V",onSelect:oe},{kind:"action",label:"Send Ctrl-C",shortcut:"⌃C",onSelect:pe},{kind:"action",label:"Quit With Ctrl-D",shortcut:"⌃D",onSelect:q},{kind:"action",label:"Stop Running Job",onSelect:ee}),z.length>0&&z.push({kind:"separator"}),z.push({kind:"action",label:"Focus Terminal",onSelect:I},...ye,{kind:"separator"},{kind:"action",label:N?"Open Takeover":"Open Observe",onSelect:()=>J(N?"takeover":"observe")},{kind:"action",label:"Open Summary",onSelect:ne},{kind:"action",label:"Copy Terminal Link",onSelect:V}),u(w,z)},[V,I,pe,J,ne,oe,q,N,C,ye,E,u,ee]);return{color:l,terminalBodyRef:p,terminalSurface:g,readOnly:N,relay:T,terminalRelay:A,healthUrl:L,scopedRelayUrl:v.scopedRelayUrl,hasViewActions:ae,canSignalTerminal:de,canStopTerminalJob:xe,handleCopyShortcut:k,handleSessionMenu:se,handleTerminalContextMenu:U,handleTerminalReady:y,openMode:J,openSummary:ne,interruptTerminal:pe,quitTerminal:q,stopTerminalJob:ee,terminalRouteBase:D}}function Oa({agent:e,agentId:t,color:n,navigate:a,label:c,status:o,onRetry:u}){return s.jsxs("div",{className:"s-term",children:[s.jsxs("div",{className:"s-term-bar",children:[s.jsx(Ge,{slot:"terminal",fallback:{view:"terminal"},navigate:a,className:"s-term-back"}),e&&s.jsxs("div",{className:"s-term-agent",children:[s.jsx("div",{className:"s-ops-avatar",style:{"--size":"18px",background:n},children:e.name[0]?.toUpperCase()}),s.jsx("span",{className:"s-term-agent-name",children:e.name}),e.handle&&s.jsxs("span",{className:"s-term-agent-handle",children:["@",e.handle]})]}),s.jsx("span",{className:"s-term-label",children:c}),s.jsx("div",{className:"s-term-status",children:u?"OFFLINE":"CONNECTING"})]}),s.jsx("div",{className:"s-term-body s-term-body--placeholder",children:s.jsxs("div",{className:"s-term-placeholder",children:[s.jsx("span",{children:o}),u&&s.jsx("button",{type:"button",onClick:u,children:"Retry"})]})})]})}function Pa({target:e,navigate:t}){const n=i.useMemo(()=>zt([e.session]).find(u=>Z(u.surface)===Z(e.surface)),[e]),a={view:"terminal",terminalSessionId:e.session.id,terminalSurfaceKey:Z(e.surface)},c=Yn(e.session,e.surface),o=Vn(e);return s.jsx("div",{className:"s-term s-term--summary",children:s.jsxs("div",{className:"s-term-summary",children:[s.jsxs("div",{className:"s-term-summary-main",children:[s.jsx(Ge,{slot:"terminal",fallback:{view:"terminal"},navigate:t,className:"s-term-back"}),s.jsxs("div",{className:"s-term-summary-mark",children:[s.jsx(ue,{size:18,strokeWidth:1.7}),s.jsx("span",{children:"Terminal"})]}),s.jsxs("div",{className:"s-term-summary-heading",children:[s.jsx("h1",{children:n?.title??e.surface.sessionName}),s.jsxs("p",{children:[e.surface.backend," · ",c]})]}),s.jsxs("div",{className:"s-term-summary-actions",children:[s.jsxs("button",{type:"button",className:"s-term-summary-action s-term-summary-action--primary",onClick:()=>t(os(a,"takeover")),children:[s.jsx(Ys,{size:14,strokeWidth:1.8}),s.jsx("span",{children:"Enter"})]}),s.jsxs("button",{type:"button",className:"s-term-summary-action",onClick:()=>t(os(a,"observe")),children:[s.jsx(fr,{size:14,strokeWidth:1.8}),s.jsx("span",{children:"Observe"})]})]})]}),s.jsx("div",{className:"s-term-summary-preview",children:s.jsx(qt,{surface:Bs(e.surface),lines:26,columns:112,pollMs:3e4,idlePollMs:3e4,className:"s-term-preview-peek"})}),s.jsx("dl",{className:"s-term-summary-details",children:o.map(([u,m])=>s.jsxs("div",{className:"s-term-summary-detail",children:[s.jsx("dt",{children:u}),s.jsx("dd",{title:m,children:m})]},u))})]})})}function Qs({agentId:e,agent:t,mode:n,navigate:a,registeredTarget:c,embedded:o=!1,tileActions:u}){const m=_s(),l=$a({agentId:e,agent:t,mode:n,navigate:a,registeredTarget:c,showContextMenu:m}),p=l.relay.status==="connected"?"LIVE":l.relay.status==="connecting"?"CONNECTING":"OFFLINE",k=l.relay.status==="connected"?"live":l.relay.status==="connecting"?"connecting":"offline";return s.jsxs("div",{className:`s-term${o?" s-term--embedded":""}`,children:[!o&&s.jsxs("div",{className:"s-term-bar s-term-bar--takeover",children:[s.jsxs("div",{className:"s-term-bar-left",children:[s.jsx(Ge,{slot:"terminal",fallback:{view:"terminal"},navigate:a,className:"s-term-back"}),t&&s.jsxs("div",{className:"s-term-agent",children:[s.jsx("div",{className:"s-ops-avatar",style:{"--size":"18px",background:l.color},children:t.name[0]?.toUpperCase()}),s.jsx("span",{className:"s-term-agent-name",children:t.name}),t.handle&&s.jsxs("span",{className:"s-term-agent-handle",children:["@",t.handle]})]}),c&&s.jsxs("div",{className:"s-term-registered-chip",children:[s.jsx(ue,{size:14,strokeWidth:1.8}),s.jsx("span",{children:c.session.harness}),s.jsx("span",{children:c.session.sourceSessionId})]})]}),s.jsxs("div",{className:"s-term-bar-meta",children:[s.jsx("span",{className:"s-term-label",children:l.terminalSurface?l.readOnly?"TERMINAL OBSERVE":"TERMINAL TAKEOVER":"TAKEOVER"}),l.terminalSurface&&s.jsx("span",{className:"s-term-session",title:l.terminalSurface.sessionName,children:Ls(l.terminalSurface.sessionName)})]}),s.jsxs("div",{className:"s-term-bar-actions",children:[l.hasViewActions&&s.jsxs("div",{className:"s-term-action-cluster s-term-action-cluster--view","aria-label":"Terminal view actions",children:[c&&s.jsx("button",{type:"button",className:"s-term-action",onClick:l.openSummary,title:"Leave the terminal canvas and show the session summary",children:"Summary"}),l.terminalSurface&&s.jsx("button",{type:"button",className:"s-term-action",onClick:()=>l.openMode(l.readOnly?"takeover":"observe"),title:l.readOnly?"Switch to interactive takeover":"Switch to read-only terminal observe",children:l.readOnly?"Takeover":"Observe"})]}),(l.canSignalTerminal||l.canStopTerminalJob)&&s.jsxs("div",{className:"s-term-action-cluster s-term-action-cluster--signals","aria-label":"Terminal signal actions",children:[l.canSignalTerminal&&s.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:l.interruptTerminal,title:"Send Ctrl-C to the terminal",children:[s.jsx(Vt,{size:13,strokeWidth:1.8}),s.jsx("span",{children:"Ctrl-C"})]}),l.canSignalTerminal&&s.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:l.quitTerminal,title:"Send Ctrl-D / EOF to the terminal",children:[s.jsx(ir,{size:13,strokeWidth:1.8}),s.jsx("span",{children:"Quit"})]}),l.canStopTerminalJob&&s.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:l.stopTerminalJob,title:"Stop Claude's current shell/tool job without quitting Claude",children:[s.jsx(pr,{size:12,strokeWidth:2}),s.jsx("span",{children:"Stop Job"})]})]}),s.jsxs("button",{type:"button",className:"s-term-action s-term-session-menu",onClick:l.handleSessionMenu,title:"Open session, recovery, and external handoff actions",children:[s.jsx(Ds,{size:14,strokeWidth:1.8}),s.jsx("span",{children:"Session"})]}),s.jsx("div",{className:"s-term-status",children:p}),u]})]}),s.jsxs("div",{ref:l.terminalBodyRef,className:"s-term-body",onContextMenuCapture:l.handleTerminalContextMenu,onKeyDownCapture:l.handleCopyShortcut,children:[o&&s.jsxs("div",{className:"s-term-float","aria-label":"Terminal tile actions",children:[s.jsx("span",{className:"s-term-float-grip",title:"Drag to move","aria-hidden":"true",onPointerDown:y=>y.preventDefault(),children:s.jsx(yr,{size:14,strokeWidth:1.8})}),c&&s.jsxs("span",{className:"s-term-float-identity",title:`${c.session.harness} ${c.session.sourceSessionId}`,children:[s.jsx("span",{children:c.session.harness}),s.jsx("span",{children:c.session.sourceSessionId})]}),s.jsx("span",{className:`s-term-float-mark s-term-float-mark--${k}`,role:"status",title:p,"aria-label":`Relay ${p.toLowerCase()}`}),s.jsx("button",{type:"button",className:"s-term-icon-button",onClick:l.handleSessionMenu,title:"Session actions","aria-label":"Session actions",children:s.jsx(Ds,{size:14,strokeWidth:1.8})}),u]}),s.jsx(Xs,{relay:l.terminalRelay,readOnly:l.readOnly,onReady:l.handleTerminalReady,quiet:!0,configItems:[...l.terminalSurface?[{label:"backend",value:l.terminalSurface.backend},{label:"session",value:l.terminalSurface.sessionName},...l.terminalSurface.paneId?[{label:"pane",value:l.terminalSurface.paneId}]:[],...l.terminalSurface.socketDir?[{label:"socket",value:l.terminalSurface.socketDir}]:[],{label:"mode",value:l.readOnly?"read-only":"takeover"}]:[],{label:"ws",value:l.scopedRelayUrl},{label:"health",value:l.healthUrl}]})]})]})}function za({terminalSessionId:e,terminalSurfaceKey:t,mode:n,navigate:a}){const{target:c,loadState:o,loadSessions:u,hasSessionHint:m}=Da(e,t);return c&&n?s.jsx(Qs,{agent:null,mode:n,navigate:a,registeredTarget:c},`${Z(c.surface)}:${n}`):c?s.jsx(Pa,{target:c,navigate:a}):s.jsx("div",{className:"s-term s-term--empty-main",children:s.jsxs("div",{className:"s-term-empty-main-mark",children:[s.jsx(ue,{size:18,strokeWidth:1.6}),s.jsx("span",{children:o==="loading"?"Loading terminal":o==="failed"?"Terminal list unavailable":m?"Terminal unavailable":"Select a terminal"}),o==="failed"&&s.jsx("button",{type:"button",className:"s-term-empty-action",onClick:u,children:"Retry"})]})})}function _a(e,t){return e.kind!=="fresh"||!e.sessionName?!1:t.some(n=>n.surfaces.some(a=>a.backend===e.backend&&a.sessionName===e.sessionName&&a.state!=="exited"))}function Ae(e){return`${e.session.id}:${Z(e.surface)}`}function Fa(e,t,n){if(e.kind==="fresh")return{id:e.id,kind:"fresh",backend:e.backend,agent:e.agent,...e.backend==="pty"?{}:{sessionName:Zt(e.backend,e.id,n)}};const a=Ft(t,e.terminalSessionId,e.terminalSurfaceKey);return a?{id:e.id,kind:"registered",target:a}:{id:e.id,kind:"unavailable",terminalSessionId:e.terminalSessionId,terminalSurfaceKey:e.terminalSurfaceKey}}function be(e){return{session:e.session,surface:e.surface}}function Ka(e){const t=e.backend;return t!=="pty"&&!Kt(t)?null:{view:"terminal",terminalBackend:t,terminalAgent:e.agent,terminalTabId:e.id,...e.sessionName?{terminalSessionName:e.sessionName}:{},...e.zellijSocketDir?{zellijSocketDir:e.zellijSocketDir}:{}}}function Ba(e,t="takeover"){return{view:"terminal",terminalSessionId:e.session.id,terminalSurfaceKey:Z(e.surface),mode:t}}function cn(e,t){if(typeof window>"u"){t(e);return}window.open(Wt(e),"_blank","noopener,noreferrer")}function Ua({navigate:e}){const{agents:t}=Lt(),n=_s(),{hosts:a}=Us(),c=i.useMemo(()=>zr(a),[a]),[o,u]=rs(Rr,Gs(),{version:Er,migrate:$r}),[m,l]=rs(Mr,"library"),p=i.useRef(new Map),[k,y]=i.useState(null),[j,C]=i.useState(""),[E,g]=i.useState(""),[N,b]=i.useState(vt),[_,L]=i.useState(()=>Array.from({length:4},()=>qe("pty"))),[v,T]=i.useState(0),[A,D]=i.useState({state:"loading",sessions:[]}),[x,I]=i.useState(0),[M,V]=i.useState(""),[oe,ce]=i.useState("all"),me=i.useRef(null),pe=i.useCallback(()=>{V(""),ce("all")},[]);cr(i.useCallback(()=>me.current,[]));const[q,ee]=rs(Ea,"list"),[K,X]=rs(Ma,"multiplexer"),[J,ne]=i.useState(rr),[ae,de]=i.useState(null),[xe,ye]=i.useState([]),[ge,se]=i.useState(null),[U,w]=i.useState(null),[F,z]=i.useState(null),[O,H]=i.useState(!1),[he,De]=i.useState(null),[Ne,we]=i.useState(null),je=i.useRef(null),ve=i.useRef(null),Se=i.useRef("after"),We=i.useRef(null),$e=i.useRef(null),Fe=i.useRef(!1),fe=i.useCallback((r={})=>{r.silent||D(d=>({state:"loading",sessions:d.sessions})),Pt({includeDiscovered:!0}).then(d=>D({state:"ready",sessions:d})).catch(d=>{r.silent||D(h=>({state:"failed",sessions:h.sessions,error:d instanceof Error?d.message:String(d)}))})},[]);i.useEffect(()=>{fe()},[fe]),i.useEffect(()=>{const r=()=>{document.visibilityState==="visible"&&fe({silent:!0})},d=window.setInterval(r,8e3);return window.addEventListener("focus",r),document.addEventListener("visibilitychange",r),()=>{window.clearInterval(d),window.removeEventListener("focus",r),document.removeEventListener("visibilitychange",r)}},[fe]),i.useEffect(()=>{let r=!1;return Sa().then(d=>{if(!r){ye(d.resolutions);for(const h of d.workspaces)p.current.set(h.id,JSON.stringify(Rs(bt(h),{sessions:A.sessions})));d.workspaces.length!==0&&u(h=>{let f=h;for(const R of d.workspaces)f=ht(f,bt(R));return{...f,activeWorkspaceId:h.activeWorkspaceId||f.activeWorkspaceId}})}}).catch(()=>{}),()=>{r=!0}},[u]);const Qe=i.useMemo(()=>zt(A.sessions),[A.sessions]),Y=i.useMemo(()=>Qe.filter(r=>r.surface.state!=="exited"),[Qe]),{managed:S}=i.useMemo(()=>_t(Y),[Y]),W=i.useMemo(()=>Y.filter(r=>r.origin==="scout"),[Y]),re=i.useMemo(()=>Et(t).filter(r=>!!Ce(r)&&Y.some(d=>Ve(d,[r])?.id===r.id)),[t,Y]),Q=S.find(r=>r.id===ae)??S[0]??null;i.useEffect(()=>{Q?.id!==ae&&de(Q?.id??null)},[Q?.id,ae]);const ie=i.useMemo(()=>{if(K==="multiplexer")return S;if(K==="session")return W;const r=new Set;return re.flatMap(d=>{const h=Y.find(f=>Ve(f,[d])?.id===d.id);return!h||r.has(h.id)?[]:(r.add(h.id),[h])})},[W,Y,S,K,re]),G=i.useMemo(()=>Et(t),[t]),B=i.useMemo(()=>{const r=new Map,d=(h,f)=>{r.has(h.id)||r.set(h.id,{id:h.id,item:h,agent:null,kind:f})};for(const h of S)d(h,"multiplexer");for(const h of W)d(h,"session");for(const h of G){const f=Y.find($=>Ve($,[h])?.id===h.id)??null;if(!f){r.set(`agent:${h.id}`,{id:`agent:${h.id}`,item:null,agent:h,kind:"agent"});continue}const R=r.get(f.id);R?R.agent??=h:r.set(f.id,{id:f.id,item:f,agent:h,kind:"agent"})}return[...r.values()]},[W,Y,S,G]),le=M.trim().length>0,Ke=i.useMemo(()=>sn(M.trim().toLowerCase()),[M]),ms=le&&Kr(Ke),ps=i.useMemo(()=>B.flatMap(r=>r.item&&gt(r.item).live?[r.item]:[]),[B]),{screens:Be,capturing:hn}=ja(ps,ms),hs=le&&Ur(Ke),fs=i.useMemo(()=>ha(B.flatMap(r=>r.item?[r.item]:[])),[B]),{panes:Ue,reading:fn}=fa(fs,hs),ks=le&&Br(Ke),{deliveries:bs,reading:kn}=ia(ks),xs=hn?`Reading screens · ${Be.size} of ${Math.min(ps.length,$s)}`:fn?`Reading panes · ${Ue.size} of ${Math.min(fs.length,Ws)}`:kn?"Reading what the broker delivered":null,ys=xs!==null,gs=i.useMemo(()=>B.map(r=>{const d=r.item?gt(r.item,{kind:r.kind,screen:Be.get(r.item.id),panes:Ue.get(r.item.id),...r.agent?nn(r.agent):{}}):Zr(r.agent,Qa(r.agent)),h=r.agent?bs.get(r.agent.id):void 0;return{target:h===void 0?d:{...d,delivery:h},item:r}}),[bs,Ue,Be,B]),ke=i.useMemo(()=>le?Gr(gs,M):[],[M,gs,le]),bn=i.useMemo(()=>{const r=ke.filter(d=>d.target.live).length;return{all:ke.length,running:r,exited:ke.length-r}},[ke]),Te=i.useMemo(()=>oe==="all"?ke:ke.filter(r=>r.target.live===(oe==="running")),[ke,oe]),xn=i.useMemo(()=>ea(Ke),[Ke]),st=A.state==="failed"?A.error:null,tt=o.workspaces,P=o.workspaces.find(r=>r.id===o.activeWorkspaceId)??null,Oe=cs({layout:P?.layout,columns:P?.columns,cellCount:P?.tiles.length??0}),Ie=i.useMemo(()=>(P?.tiles??[]).map(r=>Fa(r,A.sessions,P?.id??"")),[P?.id,P?.tiles,A.sessions]),js=ds(Oe,{tileCount:Ie.length});i.useEffect(()=>{if(!P||!p.current.has(P.id))return;const r=Rs(P,{sessions:A.sessions}),d=JSON.stringify(r);p.current.get(P.id)!==d&&(p.current.set(P.id,d),wt(r).catch(h=>se(h instanceof Error?h.message:String(h))))},[P,A.sessions]);const Pe=m==="workspace"&&!P?"library":m,te=i.useCallback(r=>{u(d=>{const h=d.workspaces.find(R=>R.id===d.activeWorkspaceId);if(!h)return d;const f=r(h.tiles);return f===h.tiles?d:ft(d,h.id,{tiles:f,updatedAt:Date.now()})})},[u]),Ze=i.useCallback(r=>{u(d=>d.activeWorkspaceId?ft(d,d.activeWorkspaceId,{layout:r,updatedAt:Date.now()}):d)},[u]),nt=i.useCallback(r=>{u(d=>Nr(d,r.id)),l("workspace")},[u,l]),Ss=i.useCallback(()=>{l("library")},[l]),Re=i.useCallback(r=>{y(r?.id??null),C(r?.name??""),g(r?.purpose??""),b(r?cs({layout:r.layout,columns:r.columns,cellCount:r.tiles.length}):vt),L(r?.tiles??Array.from({length:4},()=>qe("pty"))),T(0),l("builder")},[l]),yn=i.useCallback(r=>{b(d=>r.mode==="solo"?{mode:"solo"}:{mode:r.mode,columns:d.columns??"dynamic"}),L(d=>d.length>=r.minimumCells?d:[...d,...Array.from({length:r.minimumCells-d.length},()=>qe("pty"))]),T(d=>Math.max(0,Math.min(d,r.minimumCells-1)))},[]),gn=i.useCallback(r=>{b(d=>d.mode==="solo"?{mode:"lanes",columns:r}:{...d,columns:r})},[]),jn=i.useCallback(()=>{L(r=>{const d=[...r,qe("pty")];return T(d.length-1),d})},[]),Sn=i.useCallback(r=>{L(d=>{if(d.length<=1)return d;const h=d.filter((f,R)=>R!==r);return T(f=>Math.min(f,h.length-1)),h})},[]),wn=i.useCallback(()=>{const r=j.trim();if(!r)return;const d={id:k??is("workspace"),name:r,purpose:E.trim(),columns:ds(N,{tileCount:_.length}),layout:N,tiles:_,updatedAt:Date.now()};u(f=>ht(f,d));const h=Rs(d,{sessions:A.sessions});p.current.set(d.id,JSON.stringify(h)),wt(h).catch(f=>se(f instanceof Error?f.message:String(f))),l("workspace")},[k,u,l,A.sessions,_,N,j,E]),Cn=i.useCallback(r=>{u(d=>vr(d,r,{allowEmpty:!0})),Ca(r).catch(()=>{})},[u]),rt=i.useCallback((r,d="shell")=>{te(h=>[...h,qe(r,d)])},[te]),He=i.useCallback((r,d)=>{const h={kind:"registered",terminalSessionId:r.session.id,terminalSurfaceKey:Z(r.surface)};te(f=>{const R=f.some($=>$.kind==="registered"&&$.terminalSessionId===h.terminalSessionId&&As($.terminalSurfaceKey,h.terminalSurfaceKey));return d?f.some($=>$.id===d)?f.map($=>$.id===d?{...h,id:$.id}:$):f:R?f:[...f,{...h,id:is("cell")}]})},[te]),es=i.useCallback(r=>{He(r)},[He]),ss=i.useMemo(()=>new Set(Ie.filter(r=>r.kind==="registered").map(r=>Ae(r.target))),[Ie]),ts=i.useCallback(r=>{r?.currentTarget.hasPointerCapture(r.pointerId)&&r.currentTarget.releasePointerCapture(r.pointerId),We.current=null,$e.current=null,Fe.current=!1,w(null),z(null),H(!1)},[]),Nn=i.useCallback((r,d)=>{const h=r.target;r.button!==0||h instanceof Element&&h.closest("button, a")||(We.current={pointerId:r.pointerId,target:be(d),targetId:Ae(be(d)),startX:r.clientX,startY:r.clientY},r.currentTarget.setPointerCapture(r.pointerId))},[]),vn=i.useCallback(r=>{const d=We.current;if(!d||d.pointerId!==r.pointerId||Math.hypot(r.clientX-d.startX,r.clientY-d.startY)<6&&!U)return;U||w(d.targetId);const f=document.querySelector(".s-term--workspace");if(f){const ut=f.getBoundingClientRect();r.clientY<ut.top+72&&(f.scrollTop-=28),r.clientY>ut.bottom-72&&(f.scrollTop+=28)}const R=document.elementFromPoint(r.clientX,r.clientY),$=R?.closest(".s-term-workspace-cell"),Ee=!!(R?.closest(".s-term-workspace-add-cell")||!$&&R?.closest(".s-term--workspace")&&!R?.closest(".s-term-picker")),dt=Ee?null:$?.dataset.terminalTileId??null;$e.current=dt,Fe.current=Ee,z(dt),H(Ee)},[U]),Tn=i.useCallback(r=>{const d=We.current;!d||d.pointerId!==r.pointerId||(Fe.current?He(d.target):$e.current&&He(d.target,$e.current),ts(r))},[ts,He]),In=i.useCallback(r=>{ts(r)},[ts]),Rn=i.useCallback(()=>{const r=ie.map(be);r.length!==0&&te(d=>{const h=d.filter(R=>R.kind==="registered"),f=r.filter(R=>!h.some($=>$.kind==="registered"&&$.terminalSessionId===R.session.id&&As($.terminalSurfaceKey,Z(R.surface)))).map(R=>({id:is("cell"),kind:"registered",terminalSessionId:R.session.id,terminalSurfaceKey:Z(R.surface)}));return f.length===0?d:[...d,...f]})},[ie,te]),ws=i.useCallback(r=>{te(d=>{const h=d.filter(f=>f.id!==r);return h.length===d.length?d:h})},[te]),at=i.useCallback((r,d,h)=>{r!==d&&te(f=>Ir(f,r,d,h))},[te]),Cs=i.useCallback((r,d)=>{te(h=>{const f=h.findIndex(Ee=>Ee.id===r),R=f+d;if(f<0||R<0||R>=h.length)return h;const $=[...h];return[$[f],$[R]]=[$[R],$[f]],$})},[te]),it=i.useCallback((r,d)=>{te(h=>h.map(f=>f.id===r?{id:f.id,kind:"fresh",backend:d,agent:"shell"}:f))},[te]),ze=i.useCallback(()=>[...Tt.map(r=>({kind:"action",label:r.label,onSelect:()=>Ze(r.mode==="solo"?{mode:"solo"}:{mode:r.mode,columns:Oe.columns??"dynamic"})})),...Oe.mode==="solo"?[]:[{kind:"separator"},{kind:"action",label:"Dynamic columns",onSelect:()=>Ze({...Oe,columns:"dynamic"})},...Array.from({length:Js},(r,d)=>({kind:"action",label:d===0?"One column":`${d+1} columns`,onSelect:()=>Ze({...Oe,columns:d+1})}))],{kind:"separator"},{kind:"action",label:"Edit workspace…",onSelect:()=>P&&Re(P)}],[P,Ze,Re,Oe]),En=i.useCallback(r=>{n(r,ze())},[ze,n]),Mn=i.useCallback(r=>{n(r,on.map(d=>({kind:"action",label:d.value==="shell"?"New shell":`New ${d.label} terminal`,onSelect:()=>rt("pty",d.value)})))},[rt,n]),An=i.useCallback((r,d)=>{const h=Ie.findIndex(R=>R.id===d.id),f=[];h>0&&f.push({kind:"action",label:"Move left",onSelect:()=>Cs(d.id,-1)}),h>=0&&h<Ie.length-1&&f.push({kind:"action",label:"Move right",onSelect:()=>Cs(d.id,1)}),f.length>0&&f.push({kind:"separator"}),f.push(...c.map(R=>({kind:"action",label:R.value==="pty"?"Replace with a disposable shell":`Replace with a session that survives (${R.label})`,onSelect:()=>it(d.id,R.value)})),{kind:"separator"},{kind:"action",label:"Remove cell",onSelect:()=>ws(d.id)},{kind:"separator"},...ze()),n(r,f)},[ws,ze,Cs,it,n,c,Ie]),Ln=i.useCallback((r,d)=>{const h=r.target;r.button===0&&h instanceof Element&&h.closest(".s-term-bar, .s-term-float-grip")&&!h.closest("button, a")&&(je.current={pointerId:r.pointerId,tileId:d,startX:r.clientX,startY:r.clientY},r.currentTarget.setPointerCapture(r.pointerId))},[]),Dn=i.useCallback(r=>{const d=je.current;if(!d||d.pointerId!==r.pointerId||Math.hypot(r.clientX-d.startX,r.clientY-d.startY)<6&&!he)return;he||De(d.tileId);const f=document.elementFromPoint(r.clientX,r.clientY)?.closest(".s-term-workspace-cell"),R=f?.dataset.terminalTileId??null;if(!f||!R||R===d.tileId){ve.current=null,Se.current="after",we(null);return}const $=f.getBoundingClientRect(),Ee=Tr({x:r.clientX,y:r.clientY},{left:$.left,top:$.top,width:$.width,height:$.height},js);ve.current=R,Se.current=Ee.edge,we(R)},[he,js]),lt=i.useCallback(r=>{const d=je.current;if(!d||d.pointerId!==r.pointerId)return;const h=ve.current;h&&at(d.tileId,h,Se.current),r.currentTarget.hasPointerCapture(r.pointerId)&&r.currentTarget.releasePointerCapture(r.pointerId),je.current=null,ve.current=null,Se.current="after",De(null),we(null)},[at]),Wn=i.useMemo(()=>Na(xe.find(r=>r.workspaceId===P?.id)),[P?.id,xe]),ot=i.useCallback(r=>{ne(d=>ar(d,r))},[]),$n=i.useCallback((r,d)=>{const h=Ia(d,r.key);h&&(r.preventDefault(),X(h),document.getElementById(Es(h))?.focus())},[X]),ct=i.useCallback(()=>{fe(),I(r=>r+1)},[fe]),On=i.useCallback(r=>{P&&wa(P.id,r).then(()=>{se(null),fe()}).catch(d=>se(d instanceof Error?d.message:String(d)))},[P,fe]),Pn=i.useCallback(()=>{l(P?"workspace":"library")},[P,l]),zn=i.useCallback(r=>{n(r,[...ze(),{kind:"separator"},{kind:"action",label:"Workspaces…",onSelect:Ss},{kind:"action",label:"Reload terminals",onSelect:ct},{kind:"action",label:"Focus terminal (⌘⇧B)",onSelect:()=>window.dispatchEvent(new Event("scout:terminal-focus-toggle"))},{kind:"separator"},{kind:"action",label:"Open in Scout",onSelect:()=>{window.location.href="scout://terminal"}}])},[ze,ct,n,Ss]),_n=s.jsx(Ts,{slot:"crumb",children:s.jsxs("div",{className:"s-term-desks",role:"tablist","aria-label":"Workspaces",children:[tt.map(r=>{const d=Pe==="workspace"&&r.id===P?.id;return s.jsx("button",{type:"button",role:"tab","aria-selected":d,className:`s-term-desk${d?" is-selected":""}`,title:r.purpose?.trim()||r.name,onClick:()=>nt(r),onContextMenu:h=>{h.preventDefault(),n(h,[{kind:"action",label:"Edit workspace…",onSelect:()=>Re(r)},{kind:"action",label:"All workspaces…",onSelect:Ss}])},children:r.name},r.id)}),s.jsx("button",{type:"button",className:"s-term-desk s-term-desk--new",title:"New workspace","aria-label":"New workspace",onClick:()=>Re(),children:s.jsx(_e,{size:12,strokeWidth:1.9})})]})}),Fn=Pe==="workspace"?s.jsx(Ts,{slot:"search",children:s.jsxs("label",{className:"s-term-picker-search s-term-topfind",children:[s.jsx(hr,{size:14,strokeWidth:1.8,"aria-hidden":"true"}),s.jsx("input",{ref:me,"data-terminal-find":"",type:"search",value:M,onChange:r=>{V(r.target.value),r.target.value.trim()||ce("all")},onKeyDown:r=>{r.key==="Escape"&&M&&(r.preventDefault(),pe())},placeholder:"Search terminals, agents, panes and screens","aria-label":"Search terminals",title:"Narrow with name: in: harness: mux: branch: model: role: node: owner: cmd: msg: is: pane: screen: — quote values with spaces, prefix with - to exclude"}),le?ys?s.jsxs("span",{className:"s-term-picker-find-trail","aria-live":"polite",children:[s.jsx("i",{className:"s-term-picker-find-dot","aria-hidden":"true"}),xs]}):s.jsx("button",{type:"button",className:"s-term-picker-find-clear",onClick:pe,title:"Esc",children:"Clear"}):s.jsx("kbd",{className:"s-term-picker-find-key","aria-hidden":"true",children:"/"})]})}):null,Ns=s.jsxs(s.Fragment,{children:[_n,Fn,s.jsx(Ts,{children:s.jsx("div",{className:"s-term-topline","aria-label":"Terminal workspace controls",children:s.jsx("div",{className:"s-term-topline-actions",children:Pe==="library"?s.jsxs("button",{type:"button",className:"s-term-topline-button is-primary",onClick:()=>Re(),children:[s.jsx(_e,{size:13,strokeWidth:1.9}),s.jsx("span",{children:"New workspace"})]}):Pe==="builder"?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"s-term-topline-button",onClick:Pn,children:"Cancel"}),s.jsx("button",{type:"button",className:"s-term-topline-button is-primary",onClick:wn,disabled:!j.trim(),children:k?"Save":"Create"})]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"s-term-topline-button is-primary",onClick:Mn,children:[s.jsx(_e,{size:13,strokeWidth:1.9}),s.jsx("span",{children:"New"})]}),s.jsx("button",{type:"button",className:"s-term-topline-icon",onClick:zn,title:"Layout, columns, focus and more","aria-label":"Workspace menu",children:s.jsx(Ds,{size:14,strokeWidth:1.8})})]})})})})]});return Pe==="library"?s.jsx(Ha,{header:Ns,workspaces:tt,sessionsReady:A.state!=="loading",onOpen:nt,onCreate:()=>Re(),onEdit:Re,onDelete:Cn}):Pe==="builder"?s.jsx(Ya,{header:Ns,editing:!!k,name:j,purpose:E,modes:Tt,layout:N,startOptions:c,cells:_,selectedSlot:v,terminalItems:Y,onNameChange:C,onPurposeChange:g,onApplyMode:yn,onColumnsChange:gn,onSelectSlot:T,onAddCell:jn,onRemoveCell:Sn,pickerView:q,pickerSort:J,onPickerView:ee,onPickerSort:ot,onAssignFresh:(r,d="shell")=>L(h=>h.map((f,R)=>R===v?{id:f.id,kind:"fresh",backend:r,agent:d}:f)),onAssignRegistered:r=>L(d=>d.map((h,f)=>f===v?{id:h.id,kind:"registered",terminalSessionId:r.session.id,terminalSurfaceKey:Z(r.surface)}:h))}):s.jsxs("div",{className:"s-term s-term--workspace",children:[Ns,s.jsxs("div",{className:"s-term-workspace",children:[s.jsx("h1",{className:"s-term-visually-hidden",children:P?.name??"Terminal workspace"}),st&&s.jsxs("div",{className:"s-term-home-error",children:[s.jsx("span",{children:"Terminal registry unavailable"}),s.jsx("code",{children:st})]}),ge&&s.jsxs("div",{className:"s-term-home-error",children:[s.jsx("span",{children:"This workspace is not saved to Scout — it will not follow you to another device"}),s.jsx("code",{children:ge})]}),!le&&s.jsxs("div",{className:"s-term-workspace-grid","aria-label":"Terminal tiles",style:{"--terminal-grid-columns":js},onContextMenu:En,children:[Ie.map(r=>s.jsx("div",{className:`s-term-workspace-cell${he===r.id?" s-term-workspace-cell--dragging":""}${Ne===r.id||F===r.id?" s-term-workspace-cell--drop-target":""}`,"data-terminal-tile-id":r.id,onPointerDownCapture:d=>Ln(d,r.id),onPointerMove:Dn,onPointerUp:lt,onPointerCancel:lt,onContextMenu:d=>An(d,r),children:s.jsx(Za,{tile:r,navigate:e,onClose:ws,resolution:Wn.get(r.id)??null,onRevive:On,live:_a(r,A.sessions)})},`${r.id}:${x}`)),s.jsxs("button",{type:"button",className:`s-term-workspace-add-cell${O?" s-term-workspace-add-cell--target":""}`,onClick:()=>me.current?.focus(),children:[s.jsx(_e,{size:20,strokeWidth:1.7}),s.jsx("strong",{children:"New slot"}),s.jsx("span",{children:U?"Drop to add":"Drag a terminal here"})]})]}),s.jsxs("section",{className:`s-term-picker${le?" s-term-picker--results":""}`,...le?{"aria-label":"Search results"}:{"aria-labelledby":"terminal-picker-title"},onPointerDownCapture:r=>{const d=r.target;if(!(d instanceof Element))return;const h=d.closest("[data-picker-item-id]")?.dataset.pickerItemId,f=Y.find(R=>R.id===h);f&&Nn(r,f)},onPointerMove:vn,onPointerUp:Tn,onPointerCancel:In,children:[!le&&s.jsxs("header",{className:"s-term-picker-head",children:[s.jsxs("div",{className:"s-term-picker-title",children:[s.jsx(ue,{size:14,strokeWidth:1.8}),s.jsx("h2",{id:"terminal-picker-title",children:"Add to workspace"}),s.jsxs("span",{className:"s-term-picker-head-count",children:[Y.length," terminal",Y.length===1?"":"s"," on this host"]})]}),s.jsxs("div",{className:"s-term-picker-actions",children:[K==="session"&&s.jsx("div",{className:"s-term-picker-views",role:"group","aria-label":"Picker view",children:["list","table"].map(r=>s.jsx("button",{type:"button",className:q===r?"is-selected":"",onClick:()=>ee(r),"aria-pressed":q===r,children:r==="list"?"List":"Table"},r))}),s.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:Rn,disabled:ie.length===0,children:[s.jsx(Ys,{size:13,strokeWidth:1.8}),s.jsx("span",{children:"Add all"})]})]})]}),s.jsxs(s.Fragment,{children:[le?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"s-term-picker-facets",role:"group","aria-label":"Narrow results",children:[Ra.map(([r,d])=>s.jsxs("button",{type:"button",className:oe===r?"is-selected":"","aria-pressed":oe===r,onClick:()=>ce(r),children:[d,s.jsx("em",{children:bn[r]})]},r)),s.jsx("span",{className:"s-term-picker-count",children:ys?`${Te.length} so far`:ms?`${Te.length} of ${Be.size} screens match`:hs?`${Te.length} of ${Ue.size} sessions' panes match`:ks?`${Te.length} of ${bs.size} agents' deliveries match`:`${Te.length} of ${gs.length} match`})]}),s.jsxs("p",{className:"s-term-picker-hint s-term-picker-find-hint",children:["Every setup, agent surface and session · ",s.jsx("code",{children:"in:"})," ",s.jsx("code",{children:"harness:"})," ",s.jsx("code",{children:"mux:"})," ",s.jsx("code",{children:"branch:"})," ",s.jsx("code",{children:"model:"})," ",s.jsx("code",{children:"role:"})," ",s.jsx("code",{children:"node:"})," ",s.jsx("code",{children:"cmd:"})," ",s.jsx("code",{children:"is:live"})," · ",s.jsx("code",{children:"msg:"})," searches what the broker delivered ·"," ",s.jsx("code",{children:"pane:"})," searches inside a multiplexer session · ",s.jsx("code",{children:"screen:"})," searches what a terminal is printing"]})]}):s.jsx("div",{className:"s-term-picker-sources",role:"tablist","aria-label":"Ways to find a terminal",children:[{source:"multiplexer",label:"Multiplexer setups",detail:"Multi-pane · Herdr, tmux, Zellij",count:S.length,icon:Gt},{source:"agent",label:"Agent sessions",detail:"Agent-owned · managed terminals",count:re.length,icon:Vt},{source:"session",label:"Recent sessions",detail:"Individual · previously opened by Scout",count:W.length,icon:ue}].map(({source:r,label:d,detail:h,count:f,icon:R})=>s.jsxs("button",{type:"button",role:"tab",id:Es(r),"aria-controls":Nt(),className:K===r?"is-selected":"","aria-selected":K===r,tabIndex:K===r?0:-1,onClick:()=>X(r),onKeyDown:$=>$n($,r),children:[s.jsx(R,{size:16,strokeWidth:1.7,"aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("strong",{children:d}),s.jsx("small",{children:h})]}),s.jsx("em",{"aria-label":`${A.state==="loading"?"Loading":f} ${d.toLowerCase()}`,children:A.state==="loading"?"·":f})]},r))}),le?s.jsx("div",{className:"s-term-picker-panel","aria-label":"Search results",children:Te.length===0?s.jsx("div",{className:"s-term-picker-empty s-term-picker-empty--explained",children:ys?s.jsxs("strong",{children:[xs,"…"]}):ke.length>0?s.jsxs(s.Fragment,{children:[s.jsxs("strong",{children:["No ",oe," terminal matches “",M.trim(),"”"]}),s.jsxs("span",{children:[ke.length," ",ke.length===1?"match is":"matches are"," in the other tier."]})]}):ms?s.jsxs(s.Fragment,{children:[s.jsxs("strong",{children:["Nothing on screen matches “",M.trim(),"”"]}),s.jsxs("span",{children:[Be.size," of ",Math.min(ps.length,$s)," live screens read. A host that cannot capture its panes does not answer ",s.jsx("code",{children:"screen:"})," queries."]})]}):ks?s.jsxs(s.Fragment,{children:[s.jsxs("strong",{children:["Nothing the broker carried matches “",M.trim(),"”"]}),s.jsxs("span",{children:[s.jsx("code",{children:"msg:"})," searches the asks, replies and invocations the broker has delivered for each agent lately — not a terminal's own output, which is ",s.jsx("code",{children:"screen:"}),"."]})]}):hs?s.jsxs(s.Fragment,{children:[s.jsxs("strong",{children:["No pane matches “",M.trim(),"”"]}),s.jsxs("span",{children:[Ue.size," of ",Math.min(fs.length,Ws)," herdr sessions read. ",s.jsx("code",{children:"pane:"})," asks herdr what is inside a session; tmux and zellij rows do not answer it."]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("strong",{children:["No terminal matches “",M.trim(),"”"]}),s.jsxs("span",{children:["Search spans every setup, agent surface and session. Try a directory, a harness, or"," ",s.jsx("code",{children:"is:live"}),"."]})]})}):s.jsx(Ja,{hits:Te,highlight:xn,attachedIds:ss,draggedTargetId:U,onAttach:es,navigate:e})}):s.jsxs("div",{className:"s-term-picker-panel",role:"tabpanel",id:Nt(),"aria-labelledby":Es(K),children:[s.jsx("p",{className:"s-term-picker-hint",children:K==="multiplexer"?"Preview a complete multiplexer setup, then open it or add the host-owned layout to this workspace.":K==="agent"?"Start from ownership: open the terminal associated with a managed agent, or add that surface here.":"Return to individual terminal sessions Scout has already opened or registered."}),K==="multiplexer"?s.jsx(Ga,{items:S,selectedId:Q?.id??null,attachedIds:ss,draggedTargetId:U,onSelect:de,onAttach:es,navigate:e}):K==="agent"?s.jsx(Xa,{agents:re,items:Y,attachedIds:ss,onAttach:es,navigate:e}):W.length===0&&A.state!=="loading"?s.jsxs("div",{className:"s-term-picker-empty s-term-picker-empty--explained",children:[s.jsx("strong",{children:"No recent sessions yet"}),s.jsx("span",{children:"Open or register a terminal session and it will appear here."})]}):s.jsx(mn,{items:W,view:q,sort:J,attachedIds:ss,draggedTargetId:U,onSort:ot,onAttach:es,navigate:e,groupManaged:!1})]})]})]})]})]})}function Ha({header:e,workspaces:t,sessionsReady:n,onOpen:a,onCreate:c,onEdit:o,onDelete:u}){return s.jsxs("div",{className:"s-term s-term--workspace-library",children:[e,s.jsxs("main",{className:"s-term-workspace-library",children:[s.jsx("h1",{className:"s-term-visually-hidden",children:"Terminal workspaces"}),t.length===0?s.jsxs("section",{className:"s-term-workspace-library-empty",children:[s.jsx(Gt,{size:24,strokeWidth:1.5}),s.jsx("h2",{children:"Create your first terminal workspace"}),s.jsx("p",{children:"Choose a layout, give it a purpose, place sessions, then enter the grid."}),s.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:c,children:[s.jsx(_e,{size:14,strokeWidth:1.9}),s.jsx("span",{children:"Create workspace"})]})]}):s.jsx("div",{className:"s-term-workspace-library-grid",children:t.map(m=>s.jsxs("article",{className:"s-term-workspace-card",children:[s.jsx("div",{className:"s-term-workspace-card-preview",style:{"--terminal-grid-columns":m.columns??Is},children:m.tiles.map(l=>s.jsx("span",{className:l.kind==="registered"?"is-session":"is-shell"},l.id))}),s.jsxs("div",{className:"s-term-workspace-card-copy",children:[s.jsxs("span",{children:[m.columns??Is," column",(m.columns??Is)===1?"":"s"," · ",m.tiles.length," cells"]}),s.jsx("h2",{children:m.name}),s.jsx("p",{children:m.purpose||"No purpose added yet."})]}),s.jsxs("div",{className:"s-term-workspace-card-actions",children:[s.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:()=>o(m),children:"Edit"}),s.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:()=>u(m.id),children:"Delete"}),s.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>a(m),disabled:!n,children:"Enter workspace"})]})]},m.id))})]})]})}function Os(e,t){return e==="solo"?1:e==="lanes"?Math.max(2,Math.min(4,t)):Math.max(2,Math.min(3,t))}function qa(e,t){return e==="solo"?1:e==="lanes"?Os(e,t):Os(e,t)*2}function Ya({header:e,editing:t,name:n,purpose:a,modes:c,layout:o,startOptions:u,cells:m,selectedSlot:l,terminalItems:p,onNameChange:k,onPurposeChange:y,onApplyMode:j,onColumnsChange:C,onSelectSlot:E,onAddCell:g,onRemoveCell:N,pickerView:b,pickerSort:_,onPickerView:L,onPickerSort:v,onAssignFresh:T,onAssignRegistered:A}){const D=ds(o,{tileCount:m.length});return s.jsxs("div",{className:"s-term s-term--workspace-builder",children:[e,s.jsxs("main",{className:"s-term-workspace-builder",children:[s.jsx("h1",{className:"s-term-visually-hidden",children:t?"Edit terminal workspace":"Create terminal workspace"}),s.jsxs("section",{className:"s-term-workspace-builder-identity","aria-label":"Workspace identity",children:[s.jsxs("label",{children:[s.jsx("span",{children:"Name"}),s.jsx("input",{value:n,onChange:x=>k(x.target.value),placeholder:"Release desk",autoFocus:!0})]}),s.jsxs("label",{children:[s.jsx("span",{children:"Purpose"}),s.jsx("input",{value:a,onChange:x=>y(x.target.value),placeholder:"Cross-project release monitoring"})]})]}),s.jsxs("section",{className:"s-term-workspace-builder-layout","aria-labelledby":"workspace-layout-title",children:[s.jsxs("div",{className:"s-term-workspace-builder-section-head",children:[s.jsxs("div",{children:[s.jsx("span",{children:"Step 1"}),s.jsx("h2",{id:"workspace-layout-title",children:"Choose the layout"})]}),s.jsxs("p",{children:[jr(o)," · ",m.length," cell",m.length===1?"":"s"]})]}),s.jsx("div",{className:"s-term-grid-presets","aria-label":"Workspace layout",children:c.map(x=>s.jsxs("button",{type:"button",className:`s-term-grid-preset${x.mode===o.mode?" s-term-grid-preset--selected":""}`,onClick:()=>j(x),"aria-pressed":x.mode===o.mode,children:[s.jsx("span",{className:"s-term-grid-preset-map",style:{"--terminal-preset-columns":Os(x.mode,D)},"aria-hidden":"true",children:Array.from({length:qa(x.mode,D)},(I,M)=>s.jsx("i",{},M))}),s.jsx("span",{className:"s-term-grid-preset-label",children:x.label}),s.jsx("span",{className:"s-term-grid-preset-detail",children:x.detail})]},x.mode))}),o.mode!=="solo"&&s.jsxs("div",{className:"s-term-workspace-builder-columns",role:"group","aria-label":"Columns",children:[s.jsx("span",{children:"Columns"}),s.jsx("button",{type:"button",className:o.columns==="dynamic"||o.columns===void 0?"is-selected":"",onClick:()=>C("dynamic"),"aria-pressed":o.columns==="dynamic"||o.columns===void 0,title:"Fit the columns to the number of tiles",children:"Dynamic"}),Array.from({length:Js},(x,I)=>s.jsx("button",{type:"button",className:o.columns===I+1?"is-selected":"",onClick:()=>C(I+1),"aria-pressed":o.columns===I+1,children:I+1},I)),(o.columns==="dynamic"||o.columns===void 0)&&s.jsxs("em",{children:[D," right now"]})]})]}),s.jsxs("section",{className:"s-term-workspace-builder-placement","aria-labelledby":"workspace-placement-title",children:[s.jsxs("div",{className:"s-term-workspace-builder-section-head",children:[s.jsxs("div",{children:[s.jsx("span",{children:"Step 2"}),s.jsx("h2",{id:"workspace-placement-title",children:"Place terminals"})]}),s.jsx("p",{children:"Select a cell, then choose a session or shell. Add as many cells as the work needs."})]}),s.jsxs("div",{className:"s-term-workspace-builder-canvas",children:[s.jsxs("div",{className:"s-term-workspace-builder-grid",style:{"--terminal-grid-columns":D},children:[m.map((x,I)=>{const M=x.kind==="registered"?p.find(V=>V.session.id===x.terminalSessionId&&As(Z(V.surface),x.terminalSurfaceKey)):null;return s.jsxs("div",{className:`s-term-workspace-builder-cell${l===I?" is-selected":""}`,children:[s.jsxs("button",{type:"button",className:"s-term-workspace-builder-cell-select",onClick:()=>E(I),"aria-pressed":l===I,children:[s.jsx("span",{children:String(I+1).padStart(2,"0")}),s.jsx(ue,{size:17,strokeWidth:1.7}),s.jsx("strong",{children:x.kind==="registered"?M?.title??"Unavailable session":et(x.backend,x.agent).title}),s.jsx("small",{children:x.kind==="registered"?M?.cwdLabel||M?.detail:x.backend})]}),m.length>1&&s.jsx("button",{type:"button",className:"s-term-workspace-builder-cell-remove",onClick:()=>N(I),title:"Remove this cell","aria-label":`Remove cell ${I+1}`,children:s.jsx(Xe,{size:13,strokeWidth:1.9})})]},x.id)}),s.jsxs("button",{type:"button",className:"s-term-workspace-builder-cell s-term-workspace-builder-cell--add",onClick:g,children:[s.jsx(_e,{size:18,strokeWidth:1.7}),s.jsx("strong",{children:"Add cell"})]})]}),s.jsxs("aside",{className:"s-term-workspace-builder-source",children:[s.jsxs("span",{children:["Cell ",String(l+1).padStart(2,"0")]}),s.jsx("h3",{children:"Start something new"}),s.jsxs("div",{className:"s-term-workspace-builder-source-actions",children:[on.map(x=>s.jsx("button",{type:"button",onClick:()=>T("pty",x.value),children:x.label},x.value)),u.filter(x=>x.value!=="pty").map(x=>s.jsxs("button",{type:"button",onClick:()=>T(x.value,"shell"),title:x.relayAttach?x.detail:`${x.detail} — Scout starts it; open it in ${x.label} to use it`,children:[x.label,!x.relayAttach&&s.jsx("sup",{"aria-label":"opens outside Scout",children:" ↗"})]},x.value))]}),s.jsxs("div",{className:"s-term-workspace-builder-source-head",children:[s.jsx("h3",{children:"Or use a live session"}),s.jsx("div",{className:"s-term-picker-views",role:"group","aria-label":"Session picker view",children:["list","table"].map(x=>s.jsx("button",{type:"button",className:b===x?"is-selected":"",onClick:()=>L(x),"aria-pressed":b===x,children:x==="list"?"List":"Table"},x))})]}),s.jsx("div",{className:"s-term-workspace-builder-sessions",children:p.length===0?s.jsx("span",{className:"s-term-workspace-builder-no-sessions",children:"No live sessions"}):s.jsx(mn,{items:p,view:b,sort:_,attachedIds:new Set,draggedTargetId:null,onSort:v,onAttach:x=>{const I=p.find(M=>M.session.id===x.session.id&&M.surface.sessionName===x.surface.sessionName);I&&A(I)}})})]})]})]})]})]})}function Je({text:e,needles:t}){return t.length===0?s.jsx(s.Fragment,{children:e}):s.jsx(s.Fragment,{children:ta(e,t).map((n,a)=>n.match?s.jsx("mark",{children:n.text},a):s.jsx(i.Fragment,{children:n.text},a))})}const Va={screen:"screen",panes:"pane",delivery:"message"};function dn({hit:e,highlight:t}){if(!e)return null;if(e.excerpt){const a=Va[e.excerptField??""]??"screen";return s.jsxs("span",{className:"s-term-picker-item-because s-term-picker-item-because--screen",children:[s.jsx("em",{children:a}),s.jsx("code",{children:s.jsx(Je,{text:e.excerpt,needles:t?.screen??[]})})]})}const n=e.matchedOn[0];return!n||n==="name"?null:s.jsxs("span",{className:"s-term-picker-item-because",children:["matched ",n]})}function Ja({hits:e,highlight:t,attachedIds:n,draggedTargetId:a,onAttach:c,navigate:o}){return s.jsx("div",{className:"s-term-picker-list s-term-picker-list--ranked","aria-label":"Ranked terminals",children:e.map(u=>{const m=u.item;if(!m.item)return s.jsx(un,{agent:m.agent,item:null,attachedIds:n,onAttach:c,navigate:o,hit:u,highlight:t},m.id);const{item:l,agent:p}=m,k=Ae(be(l));return s.jsx(Zs,{item:l,attached:n.has(k),dragging:a===k,onAttach:c,onOpen:()=>o(p?{view:"terminal",agentId:p.id,mode:"takeover"}:{view:"terminal",terminalSessionId:l.session.id,terminalSurfaceKey:Z(l.surface)}),hit:u,highlight:t},m.id)})})}function Zs({item:e,attached:t,dragging:n,selected:a=!1,onSelect:c,onAttach:o,onOpen:u,hit:m,highlight:l}){const p=l?.text??[],k=s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"s-term-picker-grip","aria-hidden":"true",children:"⠿"}),s.jsxs("div",{className:"s-term-picker-item-main",children:[s.jsx("strong",{title:e.surface.sessionName,children:s.jsx(Je,{text:e.title,needles:p})}),s.jsx("span",{title:e.session.cwd??e.detail,children:s.jsx(Je,{text:e.cwdLabel||e.detail,needles:p})}),s.jsx(dn,{hit:m,highlight:l})]}),s.jsxs("div",{className:"s-term-picker-item-meta",children:[s.jsx("span",{children:e.surface.backend}),s.jsx("span",{children:Hs(e)}),s.jsx("span",{title:e.session.cwd??void 0,children:e.project})]})]});return s.jsxs("article",{className:`s-term-picker-item${t?" s-term-picker-item--attached":""}${n?" s-term-picker-item--dragging":""}${a?" s-term-picker-item--selected":""}${c?" s-term-picker-item--selectable":""}`,"data-picker-item-id":e.id,role:c?"listitem":void 0,children:[c?s.jsx("button",{type:"button",className:"s-term-picker-item-summary s-term-picker-item-select","aria-pressed":a,onClick:c,children:k}):s.jsx("div",{className:"s-term-picker-item-summary",children:k}),u&&s.jsx("button",{type:"button",className:"s-term-picker-add",onClick:u,children:"Open"}),s.jsx("button",{type:"button",className:"s-term-picker-add",onClick:()=>o(be(e)),disabled:t,children:t?"In grid":"Add"})]})}function Ga({items:e,selectedId:t,attachedIds:n,draggedTargetId:a,onSelect:c,onAttach:o,navigate:u}){const m=e.find(p=>p.id===t)??e[0]??null;if(!m)return s.jsx("div",{className:"s-term-picker-empty",children:"No multiplexers discovered"});const l=Bs(m.surface);return s.jsxs("div",{className:"s-term-picker-explorer",children:[s.jsx("div",{className:"s-term-picker-list s-term-picker-list--explorer",role:"list","aria-label":"Managed multiplexers",children:e.map(p=>{const k=be(p),y=Ae(k);return s.jsx(Zs,{item:p,attached:n.has(y),dragging:a===y,selected:p.id===m.id,onSelect:()=>c(p.id),onAttach:o,onOpen:()=>u({view:"terminal",terminalSessionId:p.session.id,terminalSurfaceKey:Z(p.surface)})},p.id)})}),s.jsxs("section",{className:"s-term-picker-preview","aria-label":`${m.title} live preview`,children:[s.jsxs("div",{className:"s-term-picker-preview-title",children:[s.jsxs("div",{children:[s.jsx("strong",{children:m.title}),s.jsxs("span",{children:[m.surface.backend," · ",m.project," · ",Hs(m)]})]}),s.jsx("span",{children:ti(m,Ve(m,[]))})]}),l?s.jsx(qt,{surface:l,lines:28,columns:112,className:"s-term-multiplexer-peek"}):s.jsx("div",{className:"s-term-picker-empty",children:"This host does not expose a web preview"})]})]})}function Xa({agents:e,items:t,attachedIds:n,onAttach:a,navigate:c}){return e.length===0?s.jsxs("div",{className:"s-term-picker-empty s-term-picker-empty--explained",children:[s.jsx("strong",{children:"No agent owns a terminal on this host right now"}),s.jsx("span",{children:"Agents whose terminal has exited still turn up in search, under Exited."})]}):s.jsx("div",{className:"s-term-picker-list","aria-label":"Terminal-backed agents",children:e.map(o=>s.jsx(un,{agent:o,item:t.find(u=>Ve(u,[o])?.id===o.id)??null,attachedIds:n,onAttach:a,navigate:c},o.id))})}function Qa(e){const t=Ce(e);return t?{backend:t.backend,live:!1}:{}}function un({agent:e,item:t,attachedIds:n,onAttach:a,navigate:c,hit:o,highlight:u}){const m=Ce(e),l=t?be(t):null,p=l?n.has(Ae(l)):!1,k=u?.text??[];return s.jsxs("article",{className:`s-term-picker-item${p?" s-term-picker-item--attached":""}`,"data-picker-item-id":t?.id,children:[s.jsxs("div",{className:"s-term-picker-item-summary",children:[s.jsx("span",{className:"s-term-picker-grip","aria-hidden":"true",children:s.jsx("span",{className:"s-term-picker-agent-dot","data-state":e.state})}),s.jsxs("div",{className:"s-term-picker-item-main",children:[s.jsx("strong",{title:e.name,children:s.jsx(Je,{text:e.name,needles:k})}),s.jsx("span",{title:e.cwd??e.projectRoot??void 0,children:s.jsx(Je,{text:e.handle?`@${e.handle}`:Bt(e.cwd??e.projectRoot),needles:k})}),s.jsx(dn,{hit:o,highlight:u})]}),s.jsxs("div",{className:"s-term-picker-item-meta",children:[s.jsx("span",{children:m?.backend??e.harness}),s.jsx("span",{children:Ht(e.state)}),s.jsx("span",{children:ri(e)})]})]}),s.jsx("button",{type:"button",className:"s-term-picker-add",onClick:()=>c({view:"terminal",agentId:e.id,mode:"takeover"}),children:"Open"}),s.jsx("button",{type:"button",className:"s-term-picker-add",onClick:()=>l&&a(l),disabled:!l||p,title:l?void 0:"This agent has no registered terminal surface to add",children:p?"In grid":"Add"})]})}function mn({items:e,view:t,sort:n,attachedIds:a,draggedTargetId:c,onSort:o,onAttach:u,navigate:m,groupManaged:l=!0,ranked:p=!1}){const k=i.useMemo(()=>p?e:vs(e,n),[e,p,n]),{managed:y,regular:j}=i.useMemo(()=>l&&!p?_t(e):{managed:[],regular:e},[l,e,p]),C=i.useMemo(()=>vs(y,n),[y,n]),E=i.useMemo(()=>p?j:vs(j,n),[p,j,n]),g=b=>{m?.({view:"terminal",terminalSessionId:b.session.id,terminalSurfaceKey:Z(b.surface)})},N=(b,_)=>{const L=Ae(be(b));return s.jsx(Zs,{item:b,attached:a.has(L),dragging:c===L,onAttach:u,onOpen:_&&m?()=>g(b):void 0},b.id)};return t==="table"?s.jsx("div",{className:"s-term-picker-table-wrap",children:s.jsxs("table",{className:"s-term-picker-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[lr.map(b=>s.jsx("th",{scope:"col","aria-sort":n.column===b.id?n.direction==="asc"?"ascending":"descending":"none",children:s.jsxs("button",{type:"button",onClick:()=>o(b.id),children:[s.jsx("span",{children:b.label}),s.jsx("em",{"aria-hidden":"true",children:n.column===b.id?n.direction==="asc"?"▲":"▼":"·"})]})},b.id)),s.jsx("th",{scope:"col","aria-label":"Place"})]})}),s.jsx("tbody",{children:k.map(b=>{const _=Ae(be(b)),L=Ut(b);return s.jsxs("tr",{"data-picker-item-id":b.id,className:a.has(_)?"is-attached":void 0,children:[s.jsx("td",{title:b.surface.sessionName,children:b.title}),s.jsx("td",{children:b.surface.backend}),s.jsx("td",{children:Hs(b)}),s.jsx("td",{title:b.session.cwd??void 0,children:b.project}),s.jsx("td",{children:L?mr(L):"—"}),s.jsx("td",{children:s.jsx("button",{type:"button",className:"s-term-picker-add",onClick:()=>u(be(b)),disabled:a.has(_),children:a.has(_)?"In grid":"Add"})})]},b.id)})})]})}):s.jsxs("div",{className:"s-term-picker-list","aria-label":"Available terminals",children:[C.length>0&&s.jsxs("section",{className:"s-term-picker-group","aria-label":"Managed sessions",children:[s.jsx("h3",{className:"s-term-picker-group-title",children:"Managed sessions"}),C.map(b=>N(b,!0))]}),C.length>0&&E.length>0?s.jsxs("section",{className:"s-term-picker-group","aria-label":"Terminals",children:[s.jsx("h3",{className:"s-term-picker-group-title",children:"Terminals"}),E.map(b=>N(b,!1))]}):E.map(b=>N(b,!1))]})}function Za({tile:e,navigate:t,onClose:n,resolution:a,onRevive:c,live:o=!1}){if(e.kind==="registered")return e.target.surface.backend==="herdr"?s.jsx(Rt,{tileId:e.id,backend:"herdr",sessionName:e.target.surface.sessionName,live:e.target.surface.state==="live",onClose:n,navigate:t}):s.jsx(si,{tile:e,navigate:t,onClose:n});if(e.kind==="unavailable"){const u=a?.status==="revivable"&&!!c;return s.jsxs("section",{className:"s-term-workspace-tile s-term-workspace-tile--unavailable","aria-label":"Unavailable terminal session",children:[s.jsxs("div",{className:"s-term-bar",children:[s.jsxs("div",{className:"s-term-bar-left",children:[s.jsx("span",{className:"s-term-workspace-tile-mark",children:s.jsx(ue,{size:14,strokeWidth:1.8})}),s.jsx("span",{className:"s-term-workspace-tile-name",children:"Not running"})]}),s.jsx("div",{className:"s-term-bar-actions",children:s.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>n(e.id),title:"Remove cell","aria-label":"Remove cell",children:s.jsx(Xe,{size:14,strokeWidth:1.8})})})]}),s.jsxs("div",{className:"s-term-workspace-unavailable-body",children:[s.jsx(ue,{size:22,strokeWidth:1.5}),s.jsx("strong",{children:u?"This tile is not running.":"This saved session is not currently live."}),s.jsx("span",{children:a?.detail??"Show the terminal picker to replace it, or wait for the session to reconnect."}),u&&s.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>c?.(e.id),children:"Start it again"})]})]})}return!Kt(e.backend)&&e.backend!=="pty"?s.jsx(Rt,{tileId:e.id,backend:e.backend,sessionName:e.sessionName,live:o,onClose:n,navigate:t}):s.jsx(ei,{tile:e,navigate:t,onClose:n})}function Rt({tileId:e,backend:t,sessionName:n,live:a,onClose:c,navigate:o}){const{hosts:u}=Us(),m=Pr(u,t),[l,p]=i.useState("idle"),[k,y]=i.useState(null),j=t==="herdr",{topology:C}=Qn(j?n??null:null,{enabled:j&&a}),E=i.useCallback(()=>{n&&(p("starting"),y(null),Zn(t,{sessionName:n}).then(()=>p("idle")).catch(v=>{p("failed"),y(v instanceof Error?v.message:String(v))}))},[t,n]),g=i.useCallback(()=>{if(!o||!n)return;const v=Jn(t,n);v&&o({view:"terminal",terminalSurfaceKey:v})},[o,t,n]),N=i.useCallback(()=>{!o||!n||o(er(n))},[o,n]),b=j&&C?.running?C.workspaces.flatMap(v=>v.tabs.map(T=>({workspace:v,tab:T}))):[],_=b.flatMap(({tab:v})=>v.panes),L=new Set(_.map(v=>v.agent).filter(v=>!!v)).size;return s.jsxs("section",{className:"s-term-workspace-tile s-term-workspace-tile--hosted","aria-label":`${m?.label??t} session`,children:[s.jsxs("div",{className:"s-term-bar",children:[s.jsxs("div",{className:"s-term-bar-left",children:[s.jsx("span",{className:"s-term-workspace-tile-mark",children:s.jsx(ue,{size:14,strokeWidth:1.8})}),s.jsx("span",{className:"s-term-workspace-tile-name",children:m?.label??t})]}),s.jsxs("div",{className:"s-term-bar-meta",children:[s.jsx("span",{className:"s-term-label",children:a?"running":"not running"}),n&&s.jsx("span",{className:"s-term-session",title:n,children:n})]}),s.jsxs("div",{className:"s-term-bar-actions",children:[j&&a&&n&&o&&s.jsx("button",{type:"button",className:"s-term-icon-button",onClick:N,title:"Enter — open a live web terminal attached to this session","aria-label":"Enter — open a live web terminal attached to this session",children:s.jsx(Ys,{size:14,strokeWidth:1.8})}),s.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>c(e),title:"Remove cell","aria-label":"Remove cell",children:s.jsx(Xe,{size:14,strokeWidth:1.8})})]})]}),b.length>0?s.jsxs("button",{type:"button",className:"s-term-workspace-hosted-body s-term-workspace-hosted-body--link",onClick:g,children:[s.jsxs("span",{className:"s-term-workspace-hosted-stat",children:[b.length," ",b.length===1?"workspace":"workspaces"," · ",_.length," ",_.length===1?"pane":"panes",L>0&&s.jsxs(s.Fragment,{children:[" · ",L," ",L===1?"agent":"agents"]})]}),b.map(({workspace:v,tab:T})=>{const A=sr(v,T),D=T.panes.find(I=>I.focused)??T.panes[0]??null,x=D?.label??(D?.agent?null:"shell");return s.jsxs("span",{className:"s-term-workspace-hosted-tab",title:[A.label,D?.agent,x].filter(Boolean).join(" · "),children:[s.jsx("span",{className:"s-term-workspace-hosted-tab-dots",children:A.statuses.map((I,M)=>s.jsx(tr,{status:I},`${T.tabId}:${M}`))}),s.jsx("span",{className:"s-term-workspace-hosted-tab-label",children:A.label}),D?.agent&&s.jsx("span",{className:"s-term-workspace-hosted-tab-agent",children:D.agent}),s.jsx("span",{className:"s-term-workspace-hosted-tab-subject",children:x}),s.jsx("span",{className:"s-term-workspace-hosted-tab-count",children:A.statuses.length})]},T.tabId)}),s.jsx("span",{className:"s-term-workspace-hosted-hint",children:"Open the session"})]}):s.jsxs("div",{className:"s-term-workspace-unavailable-body",children:[s.jsx(ue,{size:22,strokeWidth:1.5}),s.jsx("strong",{children:a?`Running in ${m?.label??t}`:"Not running yet"}),s.jsx("span",{children:a?`Scout keeps this session for you. Open it in ${m?.label??t} to use it.`:`Scout can start a ${m?.label??t} session and keep it for you.`}),!a&&s.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:E,disabled:l==="starting"||!n,children:l==="starting"?"Starting…":"Start it"}),k&&s.jsx("code",{children:k})]})]})}function ei({tile:e,navigate:t,onClose:n}){const a=i.useRef(null),c=Ps(),o=zs(),u=et(e.backend,e.agent),m=Ka(e),l=["scout-terminal-workspace",e.id,e.backend,e.agent,e.sessionName??"pty"].join("-"),p=Vs({url:c,healthUrl:o,autoConnect:!0,sessionKey:l,backend:e.backend,...e.sessionName?{terminalSession:e.sessionName}:{},...e.backend==="tmux"&&e.sessionName?{tmuxSession:e.sessionName}:{},...e.backend==="zellij"&&e.sessionName?{zellijSession:e.sessionName}:{},...e.backend==="zellij"&&e.zellijSocketDir?{zellijSocketDir:e.zellijSocketDir}:{},...e.backend==="herdr"&&e.sessionName?{tmuxSession:e.sessionName}:{},agent:e.agent,controlMode:"takeover"});Ye(()=>{p.resize(Fs,Ks)},[p.resize]);const k=i.useCallback(()=>{const C=a.current;C?.querySelector(".xterm-helper-textarea")?.focus(),C?.querySelector(".xterm")?.focus()},[]),y=ln({focusTerminal:k,sendInput:p.sendInput}),j=i.useCallback(()=>{m&&cn(m,t)},[t,m]);return s.jsx("section",{className:"s-term-workspace-tile","aria-label":u.title,children:s.jsxs("div",{className:"s-term s-term--embedded",children:[s.jsxs("div",{className:"s-term-bar s-term-bar--fresh",children:[s.jsxs("div",{className:"s-term-bar-left",children:[s.jsx("span",{className:"s-term-workspace-tile-mark",children:s.jsx(ue,{size:14,strokeWidth:1.8})}),s.jsx("span",{className:"s-term-workspace-tile-name",children:u.title})]}),s.jsxs("div",{className:"s-term-bar-meta",children:[s.jsx("span",{className:"s-term-label",children:e.backend}),s.jsx("span",{className:"s-term-session",children:u.detail})]}),s.jsxs("div",{className:"s-term-bar-actions",children:[s.jsx("button",{type:"button",className:"s-term-icon-button",onClick:()=>p.restart(),title:"Restart terminal","aria-label":"Restart terminal",children:s.jsx(Yt,{size:14,strokeWidth:1.8})}),s.jsx("button",{type:"button",className:"s-term-icon-button",onClick:j,title:"Open terminal in a new window","aria-label":"Open terminal in a new window",children:s.jsx(Jt,{size:14,strokeWidth:1.8})}),s.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>n(e.id),title:"Close tile","aria-label":"Close tile",children:s.jsx(Xe,{size:14,strokeWidth:1.8})})]})]}),s.jsx("div",{ref:a,className:"s-term-body",onMouseDown:k,onContextMenuCapture:y.handleContextMenu,onKeyDownCapture:y.handleCopyShortcut,children:s.jsx(Xs,{relay:p,onReady:y.handleTerminalReady,quiet:!0,configItems:[{label:"backend",value:e.backend},{label:"agent",value:e.agent},...e.sessionName?[{label:"session",value:e.sessionName}]:[],...e.zellijSocketDir?[{label:"socket",value:e.zellijSocketDir}]:[],{label:"ws",value:c},{label:"health",value:o}]})})]})})}function si({tile:e,navigate:t,onClose:n}){const a=i.useCallback(()=>{cn(Ba(e.target),t)},[t,e.target]);return s.jsx("section",{className:"s-term-workspace-tile","aria-label":e.target.surface.sessionName,children:s.jsx(Qs,{agent:null,mode:"takeover",navigate:t,registeredTarget:e.target,embedded:!0,tileActions:s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"s-term-icon-button",onClick:a,title:"Open terminal in a new window","aria-label":"Open terminal in a new window",children:s.jsx(Jt,{size:14,strokeWidth:1.8})}),s.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>n(e.id),title:"Close tile","aria-label":"Close tile",children:s.jsx(Xe,{size:14,strokeWidth:1.8})})]})})})}function Et(e){return[...e].filter(t=>!t.retiredFromFleet).sort((t,n)=>{const a=+!!Ce(n)-+!!Ce(t);if(a!==0)return a;const c=(n.updatedAt??0)-(t.updatedAt??0);return c!==0?c:t.name.localeCompare(n.name)})}function Ve(e,t){const n=Z(e.surface),a=t.find(o=>{const u=Ce(o);return u?Ot(u,n):!1});if(a)return a;const c=new Set([e.session.id,e.session.sourceSessionId,e.surface.sessionName].map(o=>o.trim()).filter(Boolean));return t.find(o=>[o.harnessSessionId,o.conversationId,o.terminalSurface?.sessionName].some(u=>u&&c.has(u)))??null}function ti(e,t){const n=Mt(e.session.metadata,"currentCommand"),a=Bt(Mt(e.session.metadata,"currentPath"));if(n&&a)return`${n} in ${a}`;if(n)return`running ${n}`;if(t?.handle)return`owned by @${t.handle}`;if(t)return`owned by ${t.name}`;if(e.surface.paneId)return`pane ${e.surface.paneId}`;const c=ni(e.session.metadata,"windows");return c!==null?`${c} window${c===1?"":"s"}`:`${e.surface.backend} surface`}function Mt(e,t){const n=e?.[t];return typeof n=="string"&&n.trim()?n.trim():null}function ni(e,t){const n=e?.[t];return typeof n=="number"&&Number.isFinite(n)?n:null}function ri(e){return e.project??At(e.projectRoot)??At(e.cwd)??e.workspaceQualifier??e.definitionId}function At(e){const t=e?.trim().replace(/\/+$/u,"");return t?t.split("/").pop()||t:null}function ai({route:e,navigate:t}){const n=i.useRef(null),a=e.terminalBackend??"pty",c=e.terminalAgent??"shell",o=e.terminalTabId??"adhoc",u=a==="pty"?void 0:`scout-${a}-${o}`,m=e.terminalSessionName??u,l=Ps(),p=zs(),k=et(a,c),y=["scout-terminal-new",a,c,m??o].join("-"),j=Vs({url:l,healthUrl:p,autoConnect:!0,sessionKey:y,backend:a,...m?{terminalSession:m}:{},...a==="tmux"&&m?{tmuxSession:m}:{},...a==="zellij"&&m?{zellijSession:m}:{},...a==="zellij"&&e.zellijSocketDir?{zellijSocketDir:e.zellijSocketDir}:{},...a==="herdr"&&m?{tmuxSession:m}:{},agent:c,controlMode:"takeover"}),C=i.useRef([]),E=i.useRef({status:j.status,sendLine:j.sendLine});E.current={status:j.status,sendLine:j.sendLine},Ye(()=>{const b=_=>{const L=va(_);if(!L)return;const v=E.current;if(v.status==="connected"){v.sendLine(L);return}C.current=[...C.current.slice(-15),L]};return window.addEventListener(Ct,b),()=>window.removeEventListener(Ct,b)},[]),Ye(()=>{if(j.status!=="connected"||C.current.length===0)return;const b=C.current;C.current=[];for(const _ of b)j.sendLine(_)},[j.sendLine,j.status]);const g=i.useCallback(()=>{const b=n.current;b?.querySelector(".xterm-helper-textarea")?.focus(),b?.querySelector(".xterm")?.focus()},[]),N=ln({focusTerminal:g,sendInput:j.sendInput});return Ye(()=>{j.resize(Fs,Ks)},[j.resize]),s.jsxs("div",{className:"s-term",children:[s.jsxs("div",{className:"s-term-bar",children:[s.jsx(Ge,{slot:"terminal",fallback:{view:"terminal"},navigate:t,className:"s-term-back"}),s.jsx("span",{className:"s-term-label",children:k.title}),s.jsx("div",{className:"s-term-status",children:k.detail}),s.jsx("div",{className:"s-term-actions",children:s.jsx("button",{type:"button",className:"s-term-icon-button",onClick:()=>j.restart(),title:"Restart terminal","aria-label":"Restart terminal",children:s.jsx(Yt,{size:14,strokeWidth:1.8})})})]}),s.jsx("div",{ref:n,className:"s-term-body",onMouseDown:g,onContextMenuCapture:N.handleContextMenu,onKeyDownCapture:N.handleCopyShortcut,children:s.jsx(Xs,{relay:j,onReady:N.handleTerminalReady,quiet:!0,configItems:[{label:"backend",value:a},{label:"agent",value:c},...m?[{label:"session",value:m}]:[],...e.zellijSocketDir?[{label:"socket",value:e.zellijSocketDir}]:[],{label:"ws",value:l},{label:"health",value:p}]})})]})}function et(e,t){const n=t==="shell"?"Shell":t==="codex"?"Codex":t==="pi"?"Pi":"Claude";return e==="pty"?{title:n,detail:"fresh PTY tab"}:{title:`${n} ${e}`,detail:`fresh ${e} backed tab`}}function ii({agentId:e,agent:t,mode:n,navigate:a,children:c}){const o=Wa(e,t,n);return o.ready?s.jsx(s.Fragment,{children:c}):s.jsx(Oa,{agent:t,agentId:e,color:Dt(t.name),navigate:a,label:o.label,status:o.status,onRetry:o.onRetry})}function li({navigate:e}){return s.jsx("div",{className:"s-term",children:s.jsxs("div",{className:"s-term-bar",children:[s.jsx(Ge,{slot:"terminal",fallback:{view:"terminal"},navigate:e,className:"s-term-back"}),s.jsx("span",{className:"s-term-label",children:"Terminal"}),s.jsx("div",{className:"s-term-status",children:"Resolving agent..."})]})})}function pn({route:e,navigate:t}){const{agentId:n,mode:a,terminalSessionId:c,terminalSurfaceKey:o}=e,{agents:u}=Lt();if(e.terminalBackend)return s.jsx(ai,{route:e,navigate:t});const m=e.terminalSurfaceKey?$t(e.terminalSurfaceKey):null;if(!n&&m?.backend==="herdr")return s.jsx(Xn,{sessionName:m.hostSession,navigate:t});if(!n)return!c&&!o?s.jsx(Ua,{navigate:t}):s.jsx(za,{terminalSessionId:c,terminalSurfaceKey:o,mode:a,navigate:t});const l=u.find(y=>y.id===n)??null;if(!l)return s.jsx(li,{navigate:t});const p=Ce(l),k=p?`${p.backend}:${l.id}:${p.sessionName}:${a??"takeover"}`:`takeover:${n}:${a??"takeover"}`;return s.jsx(ii,{agentId:n,agent:l,mode:a,navigate:t,children:s.jsx(Qs,{agentId:n,agent:l,mode:a,navigate:t})},k)}function oi({agentId:e,mode:t,terminalSessionId:n,terminalSurfaceKey:a,navigate:c}){const o={view:"terminal",agentId:e,mode:t,terminalSessionId:n,terminalSurfaceKey:a};return s.jsx(pn,{route:o,navigate:c})}const zi=Object.freeze(Object.defineProperty({__proto__:null,TerminalContent:pn,TerminalScreen:oi},Symbol.toStringTag,{value:"Module"}));export{pn as T,zi as a,Vs as u};
@@ -0,0 +1 @@
1
+ import{r as t,j as l,a as A,b as C,S as k}from"./index-EsrkGBcv.js";import{S as y,C as T}from"./Provider-C35yu29I.js";import{a as L}from"./api-DSqpVKC7.js";import{f as x}from"./machine-scope-DJt9RZ2w.js";import{i as R}from"./agent-state-DDhnFEEP.js";import{r as P,a as I}from"./router-DCtl8wqb.js";import{T as j}from"./Terminal-Bi97yb5s.js";import{L as D,D as H}from"./theme-vars-DNK0nn3k.js";import"./provider-Dojd8quC.js";import"./sse-BCPRocpq.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-Bk3nyrkj.js";import"./NewChatComposer-C97-iTMK.js";import"./runtime-picker-DXu2bOTh.js";import"./scout-voice-CZx60X6E.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-OvccU82H.js";import"./createLucideIcon-zZ8Hx7er.js";import"./media-blobs-Bi8pxr1u.js";import"./index-724SdE6r.js";import"./HarnessMark-C4naWc16.js";import"./conversation-model-FxDeWlle.js";import"./time-Dhsh_2EG.js";import"./conversations-DoAAO6kA.js";import"./colors-CFlbwC25.js";import"./NewChatOrigin-DFbF_XvR.js";import"./keyboard-nav-DDHegDbx.js";import"./x-DAehov0E.js";import"./chevron-down-l1mrh5S9.js";import"./search-DT42oyRW.js";import"./file-text-CnISiiw6.js";import"./model-CBkMvT1w.js";import"./DocumentFocusViewer-DJr0v0D_.js";import"./TextDocumentSurface-D52m7Vd8.js";import"./index-CHD0qcfL.js";import"./chevron-right-DrfqcerI.js";import"./folder-D5prSkzz.js";import"./chevron-up-CETZJzjV.js";import"./code-xml-BhcNbLWU.js";import"./arrow-left-MVUKauwQ.js";import"./arrow-right-Bp-FpE5V.js";import"./voice-turn-ledger-BMZxlSjg.js";import"./chunk-HRAB3GC3-DbVLgbWX.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-3RfJpen8.js";/* empty css */import"./clipboard-e3fSpeo7.js";import"./terminal-relay-Bxs1hp-j.js";import"./HerdrSession-_t7yM8vX.js";import"./usePersistentState-B8lP7TRb.js";import"./terminal-hQKQygcf.js";import"./log-in-7SnYqW5w.js";import"./refresh-cw-BmVr7sCD.js";import"./check-lrJ3a73a.js";import"./copy-xKeM5ZtU.js";import"./eye-LrO-cXQt.js";import"./session-table-L-pns6Zl.js";import"./TerminalRelay-DrikpUSJ.js";import"./terminal-takeover-Ay5C2c-M.js";import"./BackToPicker-CUkjnoVk.js";import"./TmuxPeek-CXFeweMg.js";/* empty css */import"./TerminalHeaderMount-Cq4OD_xN.js";import"./plus-DFDDeGKu.js";import"./zap-CEjZNZbI.js";import"./external-link-CUObqmgX.js";function g(){const e=new URLSearchParams(window.location.search).get("route")?.trim()||"/terminal",s=P(e);return s.view==="terminal"?s:{view:"terminal"}}function S(o){const e=new URLSearchParams(window.location.search);return e.set("route",I(o)),e.has("profile")||e.set("profile","macos.terminal"),`${window.location.pathname}?${e.toString()}${window.location.hash}`}function Wt(){const[o,e]=t.useState(()=>g()),s=!!(o.terminalBackend||o.agentId||o.terminalSessionId||o.terminalSurfaceKey);t.useEffect(()=>{const i=()=>e(g());return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const n=t.useCallback(i=>{if(i.view!=="terminal"){const c={view:"terminal"},a=S(c);window.history.pushState(null,"",a),e(c);return}const p=S(i);window.history.pushState(null,"",p),e(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(j,{route:o,navigate:n})})})}function M({route:o,navigate:e,children:s}){const[n,i]=t.useState([]),[p,c]=t.useState({status:"checking",message:null,lastCheckedAt:null}),a=t.useRef(null),u=t.useMemo(()=>A(),[]),f=t.useMemo(()=>C(),[]),b=t.useMemo(()=>({...u==="light"?D:H,...f??{}}),[u,f]),w=t.useCallback(()=>{c({status:"online",message:null,lastCheckedAt:Date.now()})},[]),h=t.useCallback(r=>{c({status:"offline",message:x(r),lastCheckedAt:Date.now()})},[]),m=t.useCallback(async()=>{if(a.current)return a.current;const r=(async()=>{try{i(await L("/api/agents")),w()}catch(d){h(d)}})();a.current=r;try{await r}finally{a.current=null}},[h,w]);t.useEffect(()=>{m()},[m]),t.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=t.useMemo(()=>n.filter(r=>R(r.state)).length,[n]),E=t.useMemo(()=>({route:o,navigate:e,navigateBack:()=>{typeof window<"u"&&window.history.back()},canNavigateBack:typeof window<"u"&&window.history.length>1,agents:n,agentsLoaded:p.status!=="checking",onlineCount:v,apiConnection:p,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,p,e,v,m,o]);return l.jsx(y.Provider,{value:E,children:l.jsx("div",{"data-scout-theme":u,"data-scout-theme-mode":u,style:b,children:l.jsx(T,{children:s})})})}export{Wt as TerminalEmbedScreen};
@@ -1 +1 @@
1
- import{r as t,j as c}from"./index-DReVb7jZ.js";import{r as u}from"./index-CbqBwfIW.js";const i="scout-terminal-header-slot",d={crumb:"scout-terminal-header-crumb-slot",search:"scout-terminal-header-search-slot",actions:i},m=typeof window>"u"?t.useEffect:t.useLayoutEffect;function s(e){return typeof document>"u"?null:document.getElementById(d[e])}function E({slot:e="actions",children:n}){const[r,a]=t.useState(()=>s(e));m(()=>{a(s(e))},[e]);const o=r?.isConnected?r:null;return o?u.createPortal(n,o):c.jsx("div",{className:`s-term-inline-header s-term-inline-header--${e}`,"data-scout-terminal-header-fallback":e,children:n})}export{i as SCOUT_TERMINAL_HEADER_SLOT_ID,d as SCOUT_TERMINAL_HEADER_SLOT_IDS,E as TerminalHeaderMount};
1
+ import{r as t,j as c}from"./index-EsrkGBcv.js";import{r as u}from"./index-724SdE6r.js";const i="scout-terminal-header-slot",d={crumb:"scout-terminal-header-crumb-slot",search:"scout-terminal-header-search-slot",actions:i},m=typeof window>"u"?t.useEffect:t.useLayoutEffect;function s(e){return typeof document>"u"?null:document.getElementById(d[e])}function E({slot:e="actions",children:n}){const[r,a]=t.useState(()=>s(e));m(()=>{a(s(e))},[e]);const o=r?.isConnected?r:null;return o?u.createPortal(n,o):c.jsx("div",{className:`s-term-inline-header s-term-inline-header--${e}`,"data-scout-terminal-header-fallback":e,children:n})}export{i as SCOUT_TERMINAL_HEADER_SLOT_ID,d as SCOUT_TERMINAL_HEADER_SLOT_IDS,E as TerminalHeaderMount};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/xterm-B1zHHOLQ.js","assets/index-DReVb7jZ.js","assets/index-CGbs0SBm.css","assets/addon-fit-CHohcvS3.js","assets/addon-webgl-CaRy2x2b.js"])))=>i.map(i=>d[i]);
2
- import{r as t,j as n,_ as Q}from"./index-DReVb7jZ.js";const We={titleBarInset:0,dragRegionProps:{},onInteractiveMouseDown:void 0,isSSR:!0,apiBaseUrl:"",serviceApiUrl:""},Ke=t.createContext(We);function Ue(){return t.useContext(Ke)}const $e=t.createContext(null);function Xe(){return t.useContext($e)}const we="hudson:terminal:voice-transcript",Ee="hudson:terminal:voice-submit",ot='[data-hudson-terminal-drawer-content="true"]',Ge=t.createContext(void 0),Je={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"},Ye={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"},qe=`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/xterm-BXQiLVnI.js","assets/index-EsrkGBcv.js","assets/index-CN4rBB_s.css","assets/addon-fit-dFpj9Kfq.js","assets/addon-webgl-BFCGRtGh.js"])))=>i.map(i=>d[i]);
2
+ import{r as t,j as n,_ as Q}from"./index-EsrkGBcv.js";const We=t.createContext(null);function Ke(){return t.useContext(We)}const Ue={titleBarInset:0,dragRegionProps:{},onInteractiveMouseDown:void 0,isSSR:!0,apiBaseUrl:"",serviceApiUrl:""},$e=t.createContext(Ue);function Xe(){return t.useContext($e)}const we="hudson:terminal:voice-transcript",Ee="hudson:terminal:voice-submit",ot='[data-hudson-terminal-drawer-content="true"]',Ge=t.createContext(void 0),Je={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"},Ye={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"},qe=`
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 t,j as n,_ as Q}from"./index-DReVb7jZ.js";const We={titleBarInset:0,
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 l=document.createElement("style");l.setAttribute("data-xterm-css",""),l.textContent=qe,document.head.appendChild(l)}function Z(l,d){if(typeof l!="object"||l===null)return;const f=l,u=f[d];if(u)return u;const y=f.default;if(!(typeof y!="object"||y===null))return y[d]}function Re(l,d){if(!l||d&&!l.closest(d))return!1;const f=l.getBoundingClientRect();if(f.width<=0||f.height<=0)return!1;const u=window.getComputedStyle(l);return u.display!=="none"&&u.visibility!=="hidden"}const Ze="\x1B[13;2u",Ce="\r";function et(l){return new Promise((d,f)=>{const u=new FileReader;u.onload=()=>{const y=u.result;d(y.split(",")[1])},u.onerror=f,u.readAsDataURL(l)})}function tt({relay:l,fontSize:d=12,fontFamily:f="'JetBrains Mono', 'Hack Nerd Font', monospace",scrollback:u=5e3,renderer:y="auto",readOnly:Ne=!1,ariaLabel:ee="Terminal",className:te,style:ke,colorScheme:re="auto",configItems:z,onOpenSettings:S,onStartService:T,quiet:ne=!1,voiceVisibilityScope:oe,imageUploadUrl:se,onReady:V,onDispose:H,onResize:W,onRendererChange:K},Te){const{status:i,error:U,exitCode:$,cwd:je,setCwd:_e,sendInput:ie,resize:le,onData:X,connect:p,disconnect:De,controlMode:Ae="owner"}=l,C=Ne||Ae==="observe",Se=t.useContext(Ge),L=oe===!1?void 0:oe??Se,[ae,ce]=t.useState(!1),{apiBaseUrl:Le}=Ue(),Ie=Xe(),ue=re==="auto"?Ie?.resolvedTheme==="light"?"light":"dark":re,N=ue==="light"?Ye:Je,G=ue==="light"?4.5:3,j=t.useRef(null),I=t.useRef(null),a=t.useRef(null),J=t.useRef(null),_=t.useRef(null),O=t.useRef(!1),[M,Y]=t.useState(!1),[Oe,k]=t.useState(!1),w=t.useRef(0),b=t.useRef(C),de=t.useRef(null),h=t.useRef(null),E=t.useRef(null),fe=t.useRef(V),me=t.useRef(H),xe=t.useRef(W),q=t.useRef(K);t.useEffect(()=>{b.current=C,C&&(_.current=null,O.current=!1,w.current=0,k(!1))},[C]),t.useEffect(()=>{fe.current=V},[V]),t.useEffect(()=>{me.current=H},[H]),t.useEffect(()=>{xe.current=W},[W]),t.useEffect(()=>{q.current=K},[K]),t.useEffect(()=>{const e=j.current;if(!e)return;const r=o=>{o.key===" "&&!o.metaKey&&!o.ctrlKey&&!o.altKey&&o.stopPropagation()};return e.addEventListener("keydown",r),()=>e.removeEventListener("keydown",r)},[]);const m=se===void 0?`${Le}/api/relay/upload`:se,x=t.useCallback(e=>{b.current||ie(e)},[ie]),pe=t.useCallback((e,r)=>{if(!Number.isFinite(e)||!Number.isFinite(r)||e<=0||r<=0)return;const o=de.current;o&&o.cols===e&&o.rows===r||(de.current={cols:e,rows:r},le(e,r),xe.current?.(e,r))},[le]),v=t.useCallback(()=>{const e=J.current,r=a.current;if(!e||!r)return null;try{e.fit()}catch{return null}const o={cols:r.cols,rows:r.rows};return pe(o.cols,o.rows),o},[pe]),be=t.useCallback(()=>{h.current===null&&(h.current=window.requestAnimationFrame(()=>{h.current=null,v()}))},[v]);t.useImperativeHandle(Te,()=>({focus:()=>{a.current?.focus()},fit:v,clear:()=>{a.current?.clear()},getDimensions:()=>{const e=a.current;return e?{cols:e.cols,rows:e.rows}:null},getTerminal:()=>a.current}),[v]);const P=t.useCallback(e=>{const r=e.transcript.replace(/\s+/g," ").trim();r&&x(e.submit?`${r}${Ce}`:r)},[x]),F=t.useCallback(()=>{x(Ce)},[x]);t.useEffect(()=>{const e=r=>{if(b.current||!Re(j.current,L))return;const o=r.detail;if(!(!o||typeof o.transcript!="string")){if(i==="connected"){P(o);return}_.current=o,i!=="connecting"&&p()}};return window.addEventListener(we,e),()=>window.removeEventListener(we,e)},[p,P,i,L]),t.useEffect(()=>{if(i!=="connected"||!_.current)return;const e=_.current;_.current=null,P(e)},[P,i]),t.useEffect(()=>{const e=()=>{if(!b.current&&Re(j.current,L)){if(i==="connected"){F();return}O.current=!0,i!=="connecting"&&p()}};return window.addEventListener(Ee,e),()=>window.removeEventListener(Ee,e)},[p,F,i,L]),t.useEffect(()=>{i!=="connected"||!O.current||(O.current=!1,F())},[F,i]);const B=t.useCallback(async e=>{if(!m)return null;try{const r=await et(e),o=await fetch(m,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,data:r})}),{path:c}=await o.json();return c||null}catch(r){return console.error("File upload failed:",r),null}},[m]);t.useEffect(()=>{const e=j.current;if(!e)return;const r=async o=>{if(!o.clipboardData||!m)return;const c=Array.from(o.clipboardData.items).filter(g=>g.type.startsWith("image/"));if(c.length!==0&&(o.preventDefault(),o.stopPropagation(),!b.current))for(const g of c){const D=g.getAsFile();if(!D)continue;const A=await B(D);A&&x(A)}};return e.addEventListener("paste",r),()=>e.removeEventListener("paste",r)},[x,B,m]);const Me=t.useCallback(e=>{if(e.preventDefault(),b.current||!m){e.dataTransfer.dropEffect="none";return}e.dataTransfer.dropEffect="copy"},[m]),Pe=t.useCallback(e=>{if(e.preventDefault(),b.current||!m){w.current=0,k(!1);return}w.current++,e.dataTransfer.types.includes("Files")&&k(!0)},[m]),Fe=t.useCallback(e=>{if(e.preventDefault(),b.current){w.current=0,k(!1);return}w.current--,w.current===0&&k(!1)},[]),Be=t.useCallback(async e=>{if(e.preventDefault(),w.current=0,k(!1),b.current||!m)return;const r=Array.from(e.dataTransfer.files).filter(o=>o.type.startsWith("image/"));if(r.length!==0)for(const o of r){const c=await B(o);c&&x(c)}},[x,B,m]);t.useEffect(()=>{let e=!1,r=null;Y(!1);async function o(){const[c,g,D]=await Promise.all([Q(()=>import("./xterm-B1zHHOLQ.js").then(s=>s.x),__vite__mapDeps([0,1,2])),Q(()=>import("./addon-fit-CHohcvS3.js").then(s=>s.a),__vite__mapDeps([3,1,2])),Q(()=>import("./addon-webgl-CaRy2x2b.js").then(s=>s.a),__vite__mapDeps([4,1,2])).catch(()=>null)]),A=Z(c,"Terminal"),he=Z(g,"FitAddon"),ge=D?Z(D,"WebglAddon"):void 0;if(!A||!he){console.error("[TerminalRelay] @xterm/xterm or @xterm/addon-fit missing constructors",{xtermMod:c,fitMod:g});return}if(Qe(),e||!I.current)return;r=new A({fontSize:d,fontFamily:f,theme:N,minimumContrastRatio:G,cursorBlink:!0,cursorStyle:"bar",allowTransparency:!0,scrollback:u,convertEol:!1,allowProposedApi:!0});const ye=new he;r.loadAddon(ye),r.open(I.current),a.current=r,J.current=ye;let ve="dom";if(y!=="dom"&&ge)try{const s=new ge;s.onContextLoss(()=>{s.dispose(),q.current?.("dom")}),r.loadAddon(s),ve="webgl"}catch{}q.current?.(ve),v(),r.attachCustomKeyEventHandler(s=>s.type==="keydown"&&s.key==="Enter"&&s.shiftKey&&!s.ctrlKey&&!s.altKey&&!s.metaKey?(s.preventDefault(),s.stopPropagation(),x(Ze),!1):!0),r.onData(s=>{x(s)}),Y(!0),fe.current?.(r)}return o(),()=>{e=!0,Y(!1),h.current!==null&&(window.cancelAnimationFrame(h.current),h.current=null),r&&(r.dispose(),a.current=null,J.current=null),me.current?.()}},[v,y,u,x]),t.useEffect(()=>{const e=a.current;e&&(e.options.fontSize=d,e.options.fontFamily=f,v())},[v,d,f]),t.useEffect(()=>{const e=a.current;e&&(e.options.theme=N,e.options.minimumContrastRatio=G)},[G,N]),t.useEffect(()=>{if(M)return X((e,r)=>{let o=!1;const c=()=>{o||(o=!0,r())},g=a.current;if(!g){c();return}try{g.write(e,c)}catch{c()}}),()=>{X(null)}},[M,X]),t.useEffect(()=>{const e=I.current;if(!e||!M)return;const r=new ResizeObserver(()=>{be()});return r.observe(e),()=>{r.disconnect(),h.current!==null&&(window.cancelAnimationFrame(h.current),h.current=null)}},[M,be]),t.useEffect(()=>{i==="connected"&&a.current&&a.current.focus()},[i]);const ze=t.useCallback(()=>{i==="connected"&&a.current&&a.current.focus()},[i]),Ve=i==="error"&&U==="Relay service is not running",He=t.useCallback(async()=>{if(T){ce(!0);try{await T()&&(E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{E.current=null,p()},500))}finally{ce(!1)}}},[T,p]);t.useEffect(()=>()=>{E.current&&(clearTimeout(E.current),E.current=null)},[]);let R=null;return Ve?R=n.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[n.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/10 border border-amber-500/20 flex items-center justify-center",children:n.jsx("span",{className:"text-amber-400 text-[14px]",children:"!"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[12px] text-foreground font-medium mb-1",children:"Relay service not running"}),n.jsx("div",{className:"text-[11px] text-muted-foreground/80 leading-relaxed",children:T?"Start the relay service to open a terminal session.":"Start the relay service from the Workspace Manager."})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[T&&n.jsx("button",{type:"button",onClick:He,disabled:ae,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:ae?"Starting":"Start Service"}),n.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:"Retry"}),S&&n.jsx("button",{type:"button",onClick:S,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"})]})]}):i==="error"&&U?R=n.jsxs("div",{className:"flex flex-col items-center gap-3 max-w-md text-center px-4",children:[n.jsx("div",{className:"w-8 h-8 rounded-full bg-red-500/10 flex items-center justify-center",children:n.jsx("span",{className:"text-red-400 text-sm",children:"!"})}),n.jsx("span",{className:"text-red-400 text-[12px] font-medium",children:"Session failed"}),n.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:U}),$!==null&&$!==0&&n.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["Exit code ",$]}),n.jsx("button",{type:"button",onClick:()=>p(),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"})]}):i==="disconnected"&&!ne?R=n.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[n.jsx("div",{className:"w-8 h-8 rounded-full bg-muted border border-border flex items-center justify-center",children:n.jsx("span",{className:"text-muted-foreground/80 text-[14px]",children:"▷"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[12px] text-foreground font-medium mb-1",children:"Terminal relay disconnected"}),n.jsx("div",{className:"text-[11px] text-muted-foreground/80 leading-relaxed",children:"Set working directory and connect."})]}),n.jsxs("form",{className:"w-full",onSubmit:e=>{e.preventDefault(),p()},children:[n.jsx("label",{className:"text-[10px] font-mono text-muted-foreground/80 uppercase tracking-wider mb-1 block text-left",children:"Working Directory"}),n.jsx("input",{type:"text",value:je,onChange:e=>_e(e.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"})]}),z&&z.length>0&&n.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:z.map(e=>n.jsxs("div",{className:"contents",children:[n.jsx("span",{className:"text-muted-foreground/80",children:e.label}),n.jsx("span",{className:"text-muted-foreground truncate text-left",children:e.value})]},e.label))}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{type:"button",onClick:()=>p(),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"}),S&&n.jsx("button",{type:"button",onClick:S,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"})]})]}):i==="connecting"&&!ne&&(R=n.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[n.jsx("div",{className:"w-6 h-6 border-2 border-muted-foreground/30 border-t-cyan-500 rounded-full animate-spin"}),n.jsx("span",{className:"text-[12px] text-muted-foreground",children:"Connecting to relay"}),n.jsx("button",{type:"button",onClick:()=>{De()},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"})]})),n.jsxs("div",{ref:j,className:te?`relative flex flex-col h-full overflow-hidden ${te}`:"relative flex flex-col h-full overflow-hidden",style:ke,role:"application","aria-label":C?`${ee} (read only)`:ee,"data-readonly":C?"true":void 0,onClick:ze,onDragOver:Me,onDragEnter:Pe,onDragLeave:Fe,onDrop:Be,children:[R&&n.jsx("div",{className:"flex items-center justify-center h-full font-mono text-[12px] absolute inset-0 z-10 bg-background/95",children:R}),Oe&&n.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:n.jsx("span",{className:"text-cyan-400 font-mono text-sm",children:"Drop image to get path"})}),n.jsx("div",{ref:I,className:"flex-1 min-h-0 min-w-0 overflow-hidden",style:{visibility:R?"hidden":"visible",backgroundColor:N.background,"--hud-terminal-bg":N.background,"--hud-terminal-fg":N.foreground}})]})}const rt=t.forwardRef(tt);rt.displayName="TerminalRelay";export{ot as H,rt as T,Ge as a,Ue as u};
46
+ `;function Qe(){if(typeof document>"u"||document.querySelector("[data-xterm-css]"))return;const l=document.createElement("style");l.setAttribute("data-xterm-css",""),l.textContent=qe,document.head.appendChild(l)}function Z(l,d){if(typeof l!="object"||l===null)return;const f=l,u=f[d];if(u)return u;const y=f.default;if(!(typeof y!="object"||y===null))return y[d]}function Re(l,d){if(!l||d&&!l.closest(d))return!1;const f=l.getBoundingClientRect();if(f.width<=0||f.height<=0)return!1;const u=window.getComputedStyle(l);return u.display!=="none"&&u.visibility!=="hidden"}const Ze="\x1B[13;2u",Ce="\r";function et(l){return new Promise((d,f)=>{const u=new FileReader;u.onload=()=>{const y=u.result;d(y.split(",")[1])},u.onerror=f,u.readAsDataURL(l)})}function tt({relay:l,fontSize:d=12,fontFamily:f="'JetBrains Mono', 'Hack Nerd Font', monospace",scrollback:u=5e3,renderer:y="auto",readOnly:Ne=!1,ariaLabel:ee="Terminal",className:te,style:ke,colorScheme:re="auto",configItems:z,onOpenSettings:S,onStartService:T,quiet:ne=!1,voiceVisibilityScope:oe,imageUploadUrl:se,onReady:V,onDispose:H,onResize:W,onRendererChange:K},Te){const{status:i,error:U,exitCode:$,cwd:je,setCwd:_e,sendInput:ie,resize:le,onData:X,connect:p,disconnect:De,controlMode:Ae="owner"}=l,C=Ne||Ae==="observe",Se=t.useContext(Ge),L=oe===!1?void 0:oe??Se,[ae,ce]=t.useState(!1),{apiBaseUrl:Le}=Xe(),Ie=Ke(),ue=re==="auto"?Ie?.resolvedTheme==="light"?"light":"dark":re,N=ue==="light"?Ye:Je,G=ue==="light"?4.5:3,j=t.useRef(null),I=t.useRef(null),a=t.useRef(null),J=t.useRef(null),_=t.useRef(null),O=t.useRef(!1),[M,Y]=t.useState(!1),[Oe,k]=t.useState(!1),w=t.useRef(0),b=t.useRef(C),de=t.useRef(null),h=t.useRef(null),E=t.useRef(null),fe=t.useRef(V),me=t.useRef(H),xe=t.useRef(W),q=t.useRef(K);t.useEffect(()=>{b.current=C,C&&(_.current=null,O.current=!1,w.current=0,k(!1))},[C]),t.useEffect(()=>{fe.current=V},[V]),t.useEffect(()=>{me.current=H},[H]),t.useEffect(()=>{xe.current=W},[W]),t.useEffect(()=>{q.current=K},[K]),t.useEffect(()=>{const e=j.current;if(!e)return;const r=o=>{o.key===" "&&!o.metaKey&&!o.ctrlKey&&!o.altKey&&o.stopPropagation()};return e.addEventListener("keydown",r),()=>e.removeEventListener("keydown",r)},[]);const m=se===void 0?`${Le}/api/relay/upload`:se,x=t.useCallback(e=>{b.current||ie(e)},[ie]),pe=t.useCallback((e,r)=>{if(!Number.isFinite(e)||!Number.isFinite(r)||e<=0||r<=0)return;const o=de.current;o&&o.cols===e&&o.rows===r||(de.current={cols:e,rows:r},le(e,r),xe.current?.(e,r))},[le]),v=t.useCallback(()=>{const e=J.current,r=a.current;if(!e||!r)return null;try{e.fit()}catch{return null}const o={cols:r.cols,rows:r.rows};return pe(o.cols,o.rows),o},[pe]),be=t.useCallback(()=>{h.current===null&&(h.current=window.requestAnimationFrame(()=>{h.current=null,v()}))},[v]);t.useImperativeHandle(Te,()=>({focus:()=>{a.current?.focus()},fit:v,clear:()=>{a.current?.clear()},getDimensions:()=>{const e=a.current;return e?{cols:e.cols,rows:e.rows}:null},getTerminal:()=>a.current}),[v]);const P=t.useCallback(e=>{const r=e.transcript.replace(/\s+/g," ").trim();r&&x(e.submit?`${r}${Ce}`:r)},[x]),F=t.useCallback(()=>{x(Ce)},[x]);t.useEffect(()=>{const e=r=>{if(b.current||!Re(j.current,L))return;const o=r.detail;if(!(!o||typeof o.transcript!="string")){if(i==="connected"){P(o);return}_.current=o,i!=="connecting"&&p()}};return window.addEventListener(we,e),()=>window.removeEventListener(we,e)},[p,P,i,L]),t.useEffect(()=>{if(i!=="connected"||!_.current)return;const e=_.current;_.current=null,P(e)},[P,i]),t.useEffect(()=>{const e=()=>{if(!b.current&&Re(j.current,L)){if(i==="connected"){F();return}O.current=!0,i!=="connecting"&&p()}};return window.addEventListener(Ee,e),()=>window.removeEventListener(Ee,e)},[p,F,i,L]),t.useEffect(()=>{i!=="connected"||!O.current||(O.current=!1,F())},[F,i]);const B=t.useCallback(async e=>{if(!m)return null;try{const r=await et(e),o=await fetch(m,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,data:r})}),{path:c}=await o.json();return c||null}catch(r){return console.error("File upload failed:",r),null}},[m]);t.useEffect(()=>{const e=j.current;if(!e)return;const r=async o=>{if(!o.clipboardData||!m)return;const c=Array.from(o.clipboardData.items).filter(g=>g.type.startsWith("image/"));if(c.length!==0&&(o.preventDefault(),o.stopPropagation(),!b.current))for(const g of c){const D=g.getAsFile();if(!D)continue;const A=await B(D);A&&x(A)}};return e.addEventListener("paste",r),()=>e.removeEventListener("paste",r)},[x,B,m]);const Me=t.useCallback(e=>{if(e.preventDefault(),b.current||!m){e.dataTransfer.dropEffect="none";return}e.dataTransfer.dropEffect="copy"},[m]),Pe=t.useCallback(e=>{if(e.preventDefault(),b.current||!m){w.current=0,k(!1);return}w.current++,e.dataTransfer.types.includes("Files")&&k(!0)},[m]),Fe=t.useCallback(e=>{if(e.preventDefault(),b.current){w.current=0,k(!1);return}w.current--,w.current===0&&k(!1)},[]),Be=t.useCallback(async e=>{if(e.preventDefault(),w.current=0,k(!1),b.current||!m)return;const r=Array.from(e.dataTransfer.files).filter(o=>o.type.startsWith("image/"));if(r.length!==0)for(const o of r){const c=await B(o);c&&x(c)}},[x,B,m]);t.useEffect(()=>{let e=!1,r=null;Y(!1);async function o(){const[c,g,D]=await Promise.all([Q(()=>import("./xterm-BXQiLVnI.js").then(s=>s.x),__vite__mapDeps([0,1,2])),Q(()=>import("./addon-fit-dFpj9Kfq.js").then(s=>s.a),__vite__mapDeps([3,1,2])),Q(()=>import("./addon-webgl-BFCGRtGh.js").then(s=>s.a),__vite__mapDeps([4,1,2])).catch(()=>null)]),A=Z(c,"Terminal"),he=Z(g,"FitAddon"),ge=D?Z(D,"WebglAddon"):void 0;if(!A||!he){console.error("[TerminalRelay] @xterm/xterm or @xterm/addon-fit missing constructors",{xtermMod:c,fitMod:g});return}if(Qe(),e||!I.current)return;r=new A({fontSize:d,fontFamily:f,theme:N,minimumContrastRatio:G,cursorBlink:!0,cursorStyle:"bar",allowTransparency:!0,scrollback:u,convertEol:!1,allowProposedApi:!0});const ye=new he;r.loadAddon(ye),r.open(I.current),a.current=r,J.current=ye;let ve="dom";if(y!=="dom"&&ge)try{const s=new ge;s.onContextLoss(()=>{s.dispose(),q.current?.("dom")}),r.loadAddon(s),ve="webgl"}catch{}q.current?.(ve),v(),r.attachCustomKeyEventHandler(s=>s.type==="keydown"&&s.key==="Enter"&&s.shiftKey&&!s.ctrlKey&&!s.altKey&&!s.metaKey?(s.preventDefault(),s.stopPropagation(),x(Ze),!1):!0),r.onData(s=>{x(s)}),Y(!0),fe.current?.(r)}return o(),()=>{e=!0,Y(!1),h.current!==null&&(window.cancelAnimationFrame(h.current),h.current=null),r&&(r.dispose(),a.current=null,J.current=null),me.current?.()}},[v,y,u,x]),t.useEffect(()=>{const e=a.current;e&&(e.options.fontSize=d,e.options.fontFamily=f,v())},[v,d,f]),t.useEffect(()=>{const e=a.current;e&&(e.options.theme=N,e.options.minimumContrastRatio=G)},[G,N]),t.useEffect(()=>{if(M)return X((e,r)=>{let o=!1;const c=()=>{o||(o=!0,r())},g=a.current;if(!g){c();return}try{g.write(e,c)}catch{c()}}),()=>{X(null)}},[M,X]),t.useEffect(()=>{const e=I.current;if(!e||!M)return;const r=new ResizeObserver(()=>{be()});return r.observe(e),()=>{r.disconnect(),h.current!==null&&(window.cancelAnimationFrame(h.current),h.current=null)}},[M,be]),t.useEffect(()=>{i==="connected"&&a.current&&a.current.focus()},[i]);const ze=t.useCallback(()=>{i==="connected"&&a.current&&a.current.focus()},[i]),Ve=i==="error"&&U==="Relay service is not running",He=t.useCallback(async()=>{if(T){ce(!0);try{await T()&&(E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{E.current=null,p()},500))}finally{ce(!1)}}},[T,p]);t.useEffect(()=>()=>{E.current&&(clearTimeout(E.current),E.current=null)},[]);let R=null;return Ve?R=n.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[n.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/10 border border-amber-500/20 flex items-center justify-center",children:n.jsx("span",{className:"text-amber-400 text-[14px]",children:"!"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[12px] text-foreground font-medium mb-1",children:"Relay service not running"}),n.jsx("div",{className:"text-[11px] text-muted-foreground/80 leading-relaxed",children:T?"Start the relay service to open a terminal session.":"Start the relay service from the Workspace Manager."})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[T&&n.jsx("button",{type:"button",onClick:He,disabled:ae,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:ae?"Starting":"Start Service"}),n.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:"Retry"}),S&&n.jsx("button",{type:"button",onClick:S,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"})]})]}):i==="error"&&U?R=n.jsxs("div",{className:"flex flex-col items-center gap-3 max-w-md text-center px-4",children:[n.jsx("div",{className:"w-8 h-8 rounded-full bg-red-500/10 flex items-center justify-center",children:n.jsx("span",{className:"text-red-400 text-sm",children:"!"})}),n.jsx("span",{className:"text-red-400 text-[12px] font-medium",children:"Session failed"}),n.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:U}),$!==null&&$!==0&&n.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["Exit code ",$]}),n.jsx("button",{type:"button",onClick:()=>p(),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"})]}):i==="disconnected"&&!ne?R=n.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[n.jsx("div",{className:"w-8 h-8 rounded-full bg-muted border border-border flex items-center justify-center",children:n.jsx("span",{className:"text-muted-foreground/80 text-[14px]",children:"▷"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[12px] text-foreground font-medium mb-1",children:"Terminal relay disconnected"}),n.jsx("div",{className:"text-[11px] text-muted-foreground/80 leading-relaxed",children:"Set working directory and connect."})]}),n.jsxs("form",{className:"w-full",onSubmit:e=>{e.preventDefault(),p()},children:[n.jsx("label",{className:"text-[10px] font-mono text-muted-foreground/80 uppercase tracking-wider mb-1 block text-left",children:"Working Directory"}),n.jsx("input",{type:"text",value:je,onChange:e=>_e(e.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"})]}),z&&z.length>0&&n.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:z.map(e=>n.jsxs("div",{className:"contents",children:[n.jsx("span",{className:"text-muted-foreground/80",children:e.label}),n.jsx("span",{className:"text-muted-foreground truncate text-left",children:e.value})]},e.label))}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{type:"button",onClick:()=>p(),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"}),S&&n.jsx("button",{type:"button",onClick:S,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"})]})]}):i==="connecting"&&!ne&&(R=n.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[n.jsx("div",{className:"w-6 h-6 border-2 border-muted-foreground/30 border-t-cyan-500 rounded-full animate-spin"}),n.jsx("span",{className:"text-[12px] text-muted-foreground",children:"Connecting to relay"}),n.jsx("button",{type:"button",onClick:()=>{De()},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"})]})),n.jsxs("div",{ref:j,className:te?`relative flex flex-col h-full overflow-hidden ${te}`:"relative flex flex-col h-full overflow-hidden",style:ke,role:"application","aria-label":C?`${ee} (read only)`:ee,"data-readonly":C?"true":void 0,onClick:ze,onDragOver:Me,onDragEnter:Pe,onDragLeave:Fe,onDrop:Be,children:[R&&n.jsx("div",{className:"flex items-center justify-center h-full font-mono text-[12px] absolute inset-0 z-10 bg-background/95",children:R}),Oe&&n.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:n.jsx("span",{className:"text-cyan-400 font-mono text-sm",children:"Drop image to get path"})}),n.jsx("div",{ref:I,className:"flex-1 min-h-0 min-w-0 overflow-hidden",style:{visibility:R?"hidden":"visible",backgroundColor:N.background,"--hud-terminal-bg":N.background,"--hud-terminal-fg":N.foreground}})]})}const rt=t.forwardRef(tt);rt.displayName="TerminalRelay";export{ot as H,rt as T,Ge as a,Xe as u};
@@ -1,4 +1,4 @@
1
- import{j as i,r as I}from"./index-DReVb7jZ.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-EsrkGBcv.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-DReVb7jZ.js";import{a as D}from"./api-DSqpVKC7.js";import{f as v}from"./time-Dhsh_2EG.js";/* empty css */import{R as F}from"./refresh-cw-IcD2lPoT.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-EsrkGBcv.js";import{a as D}from"./api-DSqpVKC7.js";import{f as v}from"./time-Dhsh_2EG.js";/* empty css */import{R as F}from"./refresh-cw-BmVr7sCD.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};
@@ -0,0 +1 @@
1
+ import{j as t}from"./index-EsrkGBcv.js";function h({enabled:e,state:r,error:b,clock:u,meterLine:o,inputLabel:s,micMuted:v,playbackMuted:d,dictationActive:c=!1,newChatBusy:a=!1}){let n;c?n={label:"Start live voice",disabled:!0}:r==="connecting"?n={label:"Cancel connection",busy:!0}:r==="live"?n={label:"End live voice",tone:"end",clock:u}:e?n={label:"Start live voice",tone:"start"}:n={label:"Open voice settings",tone:"end"};let i,l=!1;return b?(i=b,l=!0):c?i="Dictation owns the microphone — live voice waits.":r==="connecting"?i="mic consent → SDP answer → Live readiness":r==="live"?i="the meter is running · billed per second":e?i="the meter starts on connect → clock · $ · metered":i="live voice is off · flip it on in Voice settings",{title:"Live conversation",sub:o,cta:n,note:i,noteError:l,flags:[{key:"mic",label:"Mute mic",on:v,title:"the mic stays hot until End"},{key:"speaker",label:"Quiet",on:d,title:"playback keeps flowing"}],flagNote:r==="live"?"the meter runs while the call is live":v||d?"armed now · applies on connect":void 0,input:`input · ${s}`,newChatBusy:a}}function m({phase:e,voiceReplies:r,inputLabel:b,inputWarn:u,speechIdentity:o,assistantModel:s,recordingClock:v}){const d=o?`${[o.providerLabel,o.modelId].filter(Boolean).join(" ")} · voice ${o.voiceLabel} · ${o.metered?"metered per reply":"unmetered"}`:"voice host resolving…",c=s?.trim();let a;switch(e){case"listening":a={label:"Send turn",tone:"start",clock:v};break;case"speaking":a={label:"Stop spoken reply",tone:"end"};break;case"unavailable":a={label:"Retry voice connection",tone:"end"};break;case"checking":a={label:"Checking voice…",busy:!0,disabled:!0};break;case"processing":a={label:"Cancel turn",tone:"end"};break;case"thinking":a={label:"Cancel turn",tone:"end"};break;case"ready":a={label:"Start voice turn",tone:"start"};break}let n;switch(e){case"ready":n=`audio stays on this Mac${c?` · reply text still hits ${c}`:""}`;break;case"checking":n="checking microphone and speech services";break;case"unavailable":n="voice is offline · nothing can record";break;case"listening":n="recording · nothing is sent until Send";break;case"processing":n="turning speech into text";break;case"thinking":n=c?`your turn is in · ${c} is replying`:"your turn is in";break;case"speaking":n=o?.metered?"spoken reply · metered":"spoken reply · unmetered";break}const i=[];e==="listening"&&i.push({key:"mic",label:"Discard",momentary:!0,title:"drop this take — nothing is sent"}),i.push({key:"speaker",label:"Spoken replies",on:r,disabled:e!=="ready"&&e!=="listening",title:"the reply voice speaks, or the reply lands as text"});let l;switch(e){case"ready":l=r?`TTS is prepared per reply · ${o?.metered?"metered":"unmetered"}`:"reply lands as text · nothing metered";break;case"listening":l="the mic closes on Send or Discard";break;case"processing":l="the take is in · the meter is Scout's reply";break;case"thinking":l="the reply is paid, not the take";break;case"speaking":l=o?.metered?"speech is a paid reply":"speech is on this Mac";break;case"checking":l="device permission resolves the flag row";break;case"unavailable":l="resolve the input, then turn-taking works";break}return{title:"Turn-based conversation",sub:d,cta:a,note:n,flags:i,flagNote:l,input:`input · ${b}`,inputWarn:u}}function p({spec:e,onCta:r,onFlag:b,onTail:u,layout:o="card"}){const{cta:s}=e,v=s.tone==="start"?"start":s.busy||/^(cancel|stop)\b/i.test(s.label)?"ghost":"end",d=l=>t.jsxs("button",{type:"button",className:`voice-well-cta voice-well-cta--${l}`,disabled:s.disabled,"aria-busy":s.busy||void 0,onClick:r,children:[t.jsx("span",{children:s.label}),s.clock&&t.jsx("span",{className:"voice-well-cta-clock",children:s.clock})]}),c=e.flags.map(l=>t.jsx("button",{type:"button",className:`voice-well-flag${l.on?" voice-well-flag--on":""}`,disabled:l.disabled,"aria-pressed":l.momentary?void 0:!!l.on,title:l.title,onClick:()=>b(l.key,l),children:l.label},l.key)),a=e.note?t.jsx("p",{className:`voice-well-note${e.noteError?" voice-well-note--error":""}`,role:e.noteError?"alert":void 0,children:e.note}):null,n=t.jsx("span",{className:`voice-well-input${e.inputWarn?" voice-well-input--warn":""}`,children:e.input}),i=t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",className:"voice-well-tail-action",disabled:e.newChatBusy,onClick:()=>u("new-chat"),children:"New chat"}),t.jsx("button",{type:"button",className:"voice-well-tail-action",onClick:()=>u("settings"),children:"Voice settings"})]});return o==="row"?t.jsxs("section",{className:"voice-well voice-well--row","aria-label":e.title,children:[n,t.jsxs("div",{className:"voice-well-flags",children:[c,e.flagNote&&t.jsx("span",{className:"voice-well-flag-note",children:e.flagNote}),a,i]}),d(v)]}):t.jsxs("section",{className:"voice-well","aria-label":e.title,children:[t.jsx("div",{className:"voice-well-title",children:e.title}),t.jsx("div",{className:"voice-well-sub",children:e.sub}),d(s.tone==="end"?"end":"start"),a,t.jsxs("div",{className:"voice-well-flags",children:[c,e.flagNote&&t.jsx("span",{className:"voice-well-flag-note",children:e.flagNote})]}),t.jsxs("div",{className:"voice-well-tail",children:[n,i]})]})}export{p as VoiceControlWell,h as gptLiveWellSpec,m as localLiveWellSpec};
@@ -0,0 +1 @@
1
+ import{j as e}from"./index-EsrkGBcv.js";/* empty css */const k=3;function c({node:r}){const s=r.x+14,a=r.y+r.h/2;return e.jsxs("g",{className:`vpd-node vpd-node--${r.state}${r.tone?` vpd-node--${r.tone}`:""}`,children:[e.jsx("rect",{x:r.x,y:r.y,width:r.w,height:r.h,rx:r.rx,className:"vpd-node-plate"}),e.jsx("circle",{cx:s,cy:a,r:3,className:"vpd-node-dot"}),e.jsx("text",{x:r.x+24,y:a+k,className:"vpd-node-label",children:r.label})]})}function p(){return e.jsxs("defs",{children:[e.jsx("marker",{id:"vpd-arrow-ink",viewBox:"0 0 8 8",refX:7,refY:4,markerWidth:7,markerHeight:7,orient:"auto-start-reverse",children:e.jsx("path",{d:"M 0 0.5 L 8 4 L 0 7.5 Z",className:"vpd-arrow vpd-arrow--ink"})}),e.jsx("marker",{id:"vpd-arrow-sky",viewBox:"0 0 8 8",refX:7,refY:4,markerWidth:7,markerHeight:7,orient:"auto-start-reverse",children:e.jsx("path",{d:"M 0 0.5 L 8 4 L 0 7.5 Z",className:"vpd-arrow vpd-arrow--sky"})}),e.jsx("marker",{id:"vpd-arrow-sky-dim",viewBox:"0 0 8 8",refX:7,refY:4,markerWidth:7,markerHeight:7,orient:"auto-start-reverse",children:e.jsx("path",{d:"M 0 0.5 L 8 4 L 0 7.5 Z",className:"vpd-arrow vpd-arrow--sky-dim"})})]})}function x({label:r}){return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:24,y:96,width:672,height:72,rx:8,className:"vpd-frame"}),e.jsx("text",{x:38,y:111,className:"vpd-frame-label",children:r})]})}function h(r){const s=r==="live",a=r==="connecting",i=r==="error",t=i?"error":s?"ok":a?"working":"dim";return[{id:"mic",label:"MIC",x:44,y:122,w:64,h:32,rx:16,state:t},{id:"webrtc",label:"WEBRTC",x:148,y:122,w:88,h:32,rx:16,state:t},{id:"openai",label:"OPENAI REALTIME",x:288,y:8,w:176,h:32,rx:16,state:i?"error":s?"ok":a?"working":"dim",tone:"sky"},{id:"scoutbot",label:"SCOUTBOT",x:560,y:122,w:112,h:32,rx:16,state:t}]}function y({state:r}){const s=r==="live",a=s?"Call live.":r==="connecting"?"Call connecting.":r==="error"?"Call in error.":"No call; idle.";return e.jsxs("svg",{viewBox:"0 0 720 176",className:"vpd",role:"img","aria-live":"polite","aria-label":`GPT Live path: microphone and WebRTC on this machine, audio arches out to OpenAI Realtime in the cloud and back to Scoutbot. ${a}`,children:[e.jsx(p,{}),e.jsx(x,{label:"THIS MACHINE"}),e.jsx("text",{x:476,y:27,className:"vpd-cloud-label",children:"CLOUD"}),e.jsx("line",{x1:108,y1:138,x2:148,y2:138,className:`vpd-link${s?" vpd-flow":""}`,markerStart:"url(#vpd-arrow-ink)",markerEnd:"url(#vpd-arrow-ink)"}),e.jsx("path",{d:"M 192 122 C 192 80, 300 66, 334 40",className:`vpd-link vpd-link--sky${s?" vpd-flow":""}`,markerEnd:s?"url(#vpd-arrow-sky)":"url(#vpd-arrow-sky-dim)"}),e.jsx("path",{d:"M 418 42 C 452 66, 616 80, 616 122",className:`vpd-link vpd-link--sky${s?" vpd-flow":""}`,markerEnd:s?"url(#vpd-arrow-sky)":"url(#vpd-arrow-sky-dim)"}),e.jsx("circle",{cx:209,cy:96,r:2.5,className:"vpd-crossing"}),e.jsx("circle",{cx:590,cy:96,r:2.5,className:"vpd-crossing"}),h(r).map(i=>e.jsx(c,{node:i},i.id))]})}function w(r,s,a){const i=r?.hostReachable===!0,t=r?r.microphoneGranted===!0?"ready":"warn":"dim",l=r?i?"ready":"warn":"dim",n=[{id:"mic",label:"MIC",x:44,y:122,w:60,h:32,rx:6,state:t},{id:"stt",label:"STT",x:140,y:122,w:64,h:32,rx:6,state:l},{id:"turn",label:"TURN ENGINE",x:244,y:122,w:128,h:32,rx:6,state:"pending"},{id:"scoutbot",label:"SCOUTBOT",x:416,y:122,w:104,h:32,rx:6,state:s?"ready":"dim"},{id:"tts",label:"TTS",x:560,y:122,w:60,h:32,rx:6,state:l}];return a==="listening"?(n[0].state="working",n[1].state="working"):a==="processing"?n[1].state="working":a==="thinking"?n[3].state="working":a==="speaking"&&(n[4].state="working"),n}function g({probe:r,replyModel:s,phase:a,ttsProviderLabel:i,ttsMetered:t}){const l=a==="listening",n=a==="processing"||a==="thinking",d=a==="speaking",v=!a||a==="ready"?"Idle.":a==="listening"?"Listening to a turn.":n?"Transcribing or thinking.":a==="speaking"?"Speaking a reply.":"Checking the voice host.",m=t&&i?` Spoken replies send reply text to ${i} TTS.`:" Spoken replies are synthesized on-device.";return e.jsxs("svg",{viewBox:"0 88 720 116",className:"vpd",role:"img","aria-live":"polite","aria-label":`Local Live path: microphone, speech-to-text, turn engine, Scoutbot, and text-to-speech as one chain inside this machine, ending at the speaker. The turn engine is not wired yet. Reply text leaves the chain to the configured reply model.${m} ${v}`,children:[e.jsx(p,{}),e.jsx(x,{label:"THIS MACHINE — AUDIO NEVER LEAVES"}),e.jsx("line",{x1:104,y1:138,x2:140,y2:138,className:`vpd-link${l?" vpd-flow":""}`,markerEnd:"url(#vpd-arrow-ink)"}),e.jsx("line",{x1:204,y1:138,x2:244,y2:138,className:`vpd-link vpd-link--pending${n?" vpd-flow":""}`,markerEnd:"url(#vpd-arrow-ink)"}),e.jsx("line",{x1:372,y1:138,x2:416,y2:138,className:`vpd-link vpd-link--pending${n?" vpd-flow":""}`,markerEnd:"url(#vpd-arrow-ink)"}),e.jsx("line",{x1:520,y1:138,x2:560,y2:138,className:`vpd-link${d?" vpd-flow":""}`,markerEnd:"url(#vpd-arrow-ink)"}),e.jsx("line",{x1:620,y1:138,x2:648,y2:138,className:`vpd-link${d?" vpd-flow":""}`,markerEnd:"url(#vpd-arrow-ink)"}),e.jsxs("g",{className:d?"vpd-speaker-live":void 0,children:[e.jsx("path",{d:"M 652 135 L 657 135 L 663 130 L 663 146 L 657 141 L 652 141 Z",className:"vpd-speaker"}),e.jsx("path",{d:"M 666 133 Q 669 138 666 143",className:"vpd-speaker-arc"}),e.jsx("path",{d:"M 669 131 Q 673 138 669 145",className:"vpd-speaker-arc"})]}),e.jsx("line",{x1:468,y1:154,x2:468,y2:182,className:`vpd-stub${n?" vpd-flow":""}`}),e.jsx("text",{x:478,y:185,className:"vpd-stub-label",children:"TEXT TO REPLY MODEL"}),t&&i&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:590,y1:154,x2:590,y2:196,className:`vpd-stub${d?" vpd-flow":""}`}),e.jsx("text",{x:598,y:199,className:"vpd-stub-label",children:`TEXT TO ${i.toUpperCase()} TTS`})]}),w(r,s,a).map(o=>e.jsx(c,{node:o},o.id))]})}function N({mode:r,liveState:s,probe:a,replyModel:i,localPhase:t=null,ttsProviderLabel:l=null,ttsMetered:n=!1}){return e.jsx("div",{className:"vpd-wrap","data-mode":r,children:r==="gpt-live"?e.jsx(y,{state:s}):e.jsx(g,{probe:a,replyModel:i,phase:t,ttsProviderLabel:l,ttsMetered:n})})}export{N as VoicePathDiagram};
@@ -1 +1 @@
1
- import{j as n,r as h}from"./index-DReVb7jZ.js";import{r as w,o as g}from"./scout-voice-CqAyfblr.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-EsrkGBcv.js";import{r as w,o as g}from"./scout-voice-CZx60X6E.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};
@@ -0,0 +1,8 @@
1
+ import{r as x,j as s}from"./index-EsrkGBcv.js";import{a as C}from"./api-DSqpVKC7.js";import{t as _}from"./voice-turn-ledger-BMZxlSjg.js";const $=t=>`${Math.round(t).toLocaleString("en-US")} ms`,F=t=>`${t.toFixed(3)}s`,K=t=>new Date(t).toLocaleTimeString([],{hour:"numeric",minute:"2-digit",second:"2-digit"}),H=(t,n)=>`${t>=n?"+":"−"}${(Math.abs(t-n)/1e3).toFixed(3)}s`;async function Q(t,n){const l=[],a=await fetch(`/api/voice/session/${encodeURIComponent(t)}/events`,{headers:{accept:"text/event-stream"},signal:n});if(!a.ok||!a.body)return l;const o=a.body.getReader(),i=new TextDecoder;let d="";const f=Date.now()+1600,r=()=>{d=d.replace(/\r\n/g,`
2
+ `);let h=d.indexOf(`
3
+
4
+ `);for(;h>=0;){const w=d.slice(0,h);d=d.slice(h+2);let p="message";const T=[];for(const j of w.split(`
5
+ `))j.startsWith("event:")?p=j.slice(6).trim():j.startsWith("data:")&&T.push(j.slice(5).replace(/^ /,""));if(T.length!==0){try{const j=JSON.parse(T.join(`
6
+ `)),{ts:q,sessionId:R,...D}=j;l.push({event:p,ts:typeof q=="number"?q:0,data:D})}catch{}h=d.indexOf(`
7
+
8
+ `)}}};try{for(;Date.now()<f;){const h=await Promise.race([o.read(),new Promise(w=>setTimeout(()=>w({done:!0}),Math.max(0,f-Date.now())))]);if(h.done)break;d+=i.decode(h.value,{stream:!0}),r()}r()}finally{o.cancel().catch(()=>{})}return l}const X=new Set(["/api/pairing/requests","/api/operator-signals","/api/comms","/api/health","/api/mesh","/api/notifications","/api/agents","/api/machines","/api/user","/api/tail/discover","/api/perf/recent","/api/voice/history","/api/scoutbot/session"]);function Y(t,n,l){return t.filter(a=>{if(X.has(a.path)||a.path.startsWith("/api/voice/host")||a.method==="GET"&&a.path.endsWith("/events"))return!1;const o=a.at-a.ms;return o>=n-8e3&&o<=l+6e4}).sort((a,o)=>a.at-a.ms-(o.at-o.ms))}function Z(t,n){const l=_(n),a=[],o=[];for(const i of t)i.surface==="direct-voice"||i.sessionId.startsWith("scout-voice:")?i.createdAt>=n.origin-4e3&&i.createdAt<=n.origin+(l+15)*1e3&&a.push(i):(i.surface==="speech"||i.sessionId.startsWith("scout-speech:"))&&i.createdAt>=n.origin-1e3&&i.createdAt<=n.origin+(l+30)*1e3&&o.push(i);return a.sort((i,d)=>i.createdAt-d.createdAt),o.sort((i,d)=>i.createdAt-d.createdAt),{dictation:a,speech:o}}function G(t){const n=[],l=t.data.text;typeof l=="string"&&l&&n.push(`“${l.slice(0,80)}”`);const a=t.data.durationMs;typeof a=="number"&&n.push(`duration ${$(a)}`);const o=t.data.reason;typeof o=="string"&&n.push(`reason ${o}`);const i=t.data.state;typeof i=="string"&&n.push(i);const d=t.data.message;typeof d=="string"&&d&&n.push(d);const f=t.data.audioBytes;typeof f=="number"&&f>0&&n.push(`${f.toLocaleString("en-US")} B audio`),t.data.playedOnHost===!0&&n.push("played on host");const r=t.data.metrics;if(r&&typeof r=="object"){const h=r.provider;typeof h=="string"&&n.push(h)}return n.join(" · ")}function V({summary:t,turn:n}){const[l,a]=x.useState(null),[o,i]=x.useState(!1),d=x.useRef(null);x.useEffect(()=>()=>d.current?.abort(),[]);const f=()=>{if(l!==null||o)return;d.current?.abort();const r=new AbortController;d.current=r,Q(t.sessionId,r.signal).then(h=>{r.signal.aborted||a(h)}).catch(()=>{r.signal.aborted||i(!0)})};return s.jsxs("div",{className:"vtd-session",children:[s.jsxs("button",{type:"button",className:"vtd-session-head",onClick:f,children:[s.jsx("code",{title:t.sessionId,children:t.sessionId}),s.jsxs("span",{className:"vtd-dim",children:[t.status," · ",t.eventCount," events · last ",t.lastEvent??"—"]}),t.lastTranscript&&s.jsxs("span",{className:"vtd-dim",children:["“",t.lastTranscript,"”"]}),l===null&&!o&&s.jsx("span",{className:"vtd-open",children:"events"}),o&&s.jsx("span",{className:"vtd-dim",children:"record expired"})]}),l&&s.jsxs("ol",{className:"vtd-events",children:[l.map((r,h)=>s.jsxs("li",{children:[s.jsx("code",{children:r.event}),s.jsx("span",{className:"vtd-dim",children:r.ts?H(r.ts,n.origin):""}),G(r)&&s.jsx("span",{children:G(r)})]},`${r.ts}-${h}`)),l.length===0&&s.jsx("li",{className:"vtd-dim",children:"no events retained"})]})]})}function ns({turn:t,now:n,startOpen:l}){const[a,o]=x.useState(!!l),[i,d]=x.useState(!!l),[f,r]=x.useState(null),[h,w]=x.useState(!1),[p,T]=x.useState(null),[j,q]=x.useState(!1),[R,D]=x.useState(null),[L,J]=x.useState(!1);x.useEffect(()=>{if(!i)return;let e=!1;return C("/api/voice/history?limit=14").then(c=>{e||r(c.sessions??[])}).catch(()=>{e||w(!0)}),C("/api/scoutbot/session").then(c=>{e||T(c)}).catch(()=>{e||q(!0)}),C("/api/perf/recent?limit=500").then(c=>{e||D(c.recent??[])}).catch(()=>{e||J(!0)}),()=>{e=!0}},[i,t.id]);const P=_(t,n),N=t.origin,b=f?Z(f,t):null,W=N+P*1e3,I=(()=>{if(!p)return null;const e=p.session.messages,c=e.find(m=>m.role==="user"&&m.createdAt>=N-2e3&&m.createdAt<=W+15e3);if(!c)return null;const k=e.find(m=>m.role==="assistant"&&m.createdAt>=c.createdAt);return{user:c,assistant:k??null}})(),U=!!(p?.session.updatedAt&&p.session.updatedAt>=N-1e4&&(p.session.createdAt??0)<=W+6e4),S=R?Y(R,N,W):null,O=(()=>{const e=[],c=u=>u==null?null:N+u*1e3,k=u=>{const g=t.spans.find(y=>u.includes(y.lane));return c(g?.start)},m=u=>{const g=t.spans.filter(y=>u.includes(y.lane)&&y.end!==null).map(y=>y.end);return g.length>0?c(Math.max(...g)):null},A=(u,g)=>{typeof g=="number"&&e.push({label:u,ts:g})},E=b?.dictation[0];A("transcript",m(["host"])??(E&&(E.lastEvent==="session.final"||E.status==="done")?E.updatedAt:null));const B=S?.find(u=>u.path==="/api/scoutbot/chat");A("llm call",k(["scoutbot"])??(B?B.at-B.ms:null)),A("reply",m(["scoutbot"])??B?.at??I?.assistant?.createdAt);const M=S?.filter(u=>u.path==="/api/voice/speak")??[],v=b?.speech??[];A("tts call",k(["voice","live"])??(M[0]?M[0].at-M[0].ms:v[0]?.createdAt)),A("tts done",m(["voice","live"])??M[M.length-1]?.at??(v[v.length-1]?.lastEvent==="speech.result"?v[v.length-1].updatedAt:null));const z=E?.lastEvent==="session.cancelled"?E.updatedAt:v[v.length-1]?.lastEvent==="session.cancelled"?v[v.length-1].updatedAt:null;return A("cancelled",z),e.sort((u,g)=>u.ts-g.ts)})();return s.jsxs("details",{className:"vtd",open:a,onToggle:e=>{const c=e.currentTarget.open;o(c),c&&d(!0)},children:[s.jsxs("summary",{className:"vtd-summary",children:["technical details",s.jsxs("span",{className:"vtd-dim",children:[" · ",t.id," · ",$(P*1e3)]})]}),s.jsxs("dl",{className:"vtd-facts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"turn"}),s.jsx("dd",{children:s.jsx("code",{children:t.id})})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"origin"}),s.jsx("dd",{children:K(N)})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"total"}),s.jsx("dd",{children:$(P*1e3)})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"quote"}),s.jsx("dd",{children:t.quote?`“${t.quote}”`:"—"})]})]}),s.jsxs("table",{className:"vtd-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"lane"}),s.jsx("th",{children:"tone"}),s.jsx("th",{children:"label"}),s.jsx("th",{children:"start"}),s.jsx("th",{children:"end"}),s.jsx("th",{children:"duration"})]})}),s.jsxs("tbody",{children:[t.spans.map(e=>{const c=e.end===null,k=e.end??n??null;return s.jsxs("tr",{className:c?"is-open":void 0,children:[s.jsx("td",{children:e.lane}),s.jsx("td",{children:e.tone}),s.jsx("td",{children:e.label??"—"}),s.jsx("td",{children:F(e.start)}),s.jsx("td",{children:e.end!==null?F(e.end):c?"open":"—"}),s.jsxs("td",{children:[k!==null?$(Math.max(0,k-e.start)*1e3):"—",c&&n!==void 0?" (running)":""]})]},e.id)}),t.ticks.map(e=>s.jsxs("tr",{className:"vtd-tick",children:[s.jsx("td",{children:"scout"}),s.jsx("td",{children:"tick"}),s.jsx("td",{children:e.label}),s.jsx("td",{children:F(e.at)}),s.jsx("td",{colSpan:2,children:"—"})]},e.id))]})]}),O.length>0&&s.jsxs("div",{className:"vtd-block",children:[s.jsx("p",{className:"vtd-kicker",children:"key moments"}),s.jsx("ol",{className:"vtd-events",children:O.map((e,c)=>s.jsxs("li",{children:[s.jsx("code",{children:e.label}),s.jsx("span",{className:"vtd-dim",children:H(e.ts,N)}),s.jsx("span",{children:c>0?`+${$(e.ts-O[c-1].ts)}`:"—"})]},e.label))})]}),i&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"vtd-block",children:[s.jsx("p",{className:"vtd-kicker",children:"scoutbot session"}),j&&s.jsx("p",{className:"vtd-dim",children:"session fetch failed"}),!p&&!j&&s.jsx("p",{className:"vtd-dim",children:"loading…"}),p&&!U&&s.jsxs("p",{className:"vtd-dim",children:["current scoutbot session ",s.jsx("code",{children:p.session.id})," is outside this turn's window — its messages may belong to a later turn"]}),p&&U&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"vtd-line",children:[s.jsx("code",{children:p.session.id}),s.jsxs("span",{className:"vtd-dim",children:[" · ",p.session.model??p.config?.model??"model unknown"]}),p.config?.reasoningEffort&&s.jsxs("span",{className:"vtd-dim",children:[" · effort ",p.config.reasoningEffort]})]}),I?s.jsxs("div",{className:"vtd-pair",children:[s.jsxs("p",{children:[s.jsx("b",{children:"prompt"})," “",I.user.body,"”"]}),s.jsxs("p",{children:[s.jsx("b",{children:"reply"})," ",I.assistant?`“${I.assistant.body}”`:"—"]})]}):s.jsx("p",{className:"vtd-dim",children:"no message pair inside this turn's window"})]})]}),s.jsxs("div",{className:"vtd-block",children:[s.jsx("p",{className:"vtd-kicker",children:"server requests"}),L&&s.jsx("p",{className:"vtd-dim",children:"request log fetch failed"}),!S&&!L&&s.jsx("p",{className:"vtd-dim",children:"loading…"}),S&&S.length===0&&s.jsx("p",{className:"vtd-dim",children:"no request records inside this turn's window — the perf ring holds the last 500 calls and rolls under host polling"}),S&&S.length>0&&s.jsxs("table",{className:"vtd-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"request"}),s.jsx("th",{children:"started"}),s.jsx("th",{children:"took"})]})}),s.jsx("tbody",{children:S.map((e,c)=>s.jsxs("tr",{children:[s.jsxs("td",{children:[s.jsxs("code",{children:[e.method," ",e.path]}),e.status!==void 0&&e.status!==200&&s.jsxs("span",{className:"vtd-dim",children:[" · ",e.status]})]}),s.jsx("td",{children:H(e.at-e.ms,N)}),s.jsx("td",{children:$(e.ms)})]},`${e.at}-${c}`))})]})]}),s.jsxs("div",{className:"vtd-block",children:[s.jsx("p",{className:"vtd-kicker",children:"host voice sessions"}),h&&s.jsx("p",{className:"vtd-dim",children:"history fetch failed"}),!b&&!h&&s.jsx("p",{className:"vtd-dim",children:"loading…"}),b&&b.dictation.length===0&&b.speech.length===0&&s.jsx("p",{className:"vtd-dim",children:"no host sessions inside this turn's window — they may have expired"}),b?.dictation.map(e=>s.jsx(V,{summary:e,turn:t},e.sessionId)),b?.speech.map(e=>s.jsx(V,{summary:e,turn:t},e.sessionId))]})]})]})}export{ns as VoiceTurnDetails};