@openscout/scout 0.2.86 → 0.2.87
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.
- package/bin/scoutd +0 -0
- package/dist/build-manifest.json +3 -3
- package/dist/client/assets/{ActivityScreen-C7AwUogt.js → ActivityScreen-DRHTQIxu.js} +1 -1
- package/dist/client/assets/{AddProjectForm-BNRpRPod.js → AddProjectForm-Dw2oyCcz.js} +1 -1
- package/dist/client/assets/AgentAvatar-CQqJcwOQ.js +1 -0
- package/dist/client/assets/AgentAvatar-CUZZARWG.css +1 -0
- package/dist/client/assets/{AgentConfigurationScreen-BoBQpyz5.js → AgentConfigurationScreen-C3OI6JmZ.js} +1 -1
- package/dist/client/assets/{AgentDefinitionsWorkspace-rw3vh8Lm.js → AgentDefinitionsWorkspace-D0LDEqfl.js} +1 -1
- package/dist/client/assets/{AgentDetailCard-FelCxQrT.js → AgentDetailCard-2DZQahiN.js} +1 -1
- package/dist/client/assets/{AgentFloorView-Crdw8Uo5.js → AgentFloorView-CoGh2q5f.js} +1 -1
- package/dist/client/assets/{AgentInfoScreen-Cge7HHbV.js → AgentInfoScreen-5ybfIL9p.js} +1 -1
- package/dist/client/assets/{AgentLaneCard-CRDG74C1.js → AgentLaneCard-CeSjWWwh.js} +1 -1
- package/dist/client/assets/{AgentLaneChrome-CWFqUdch.js → AgentLaneChrome-Do7CXwin.js} +1 -1
- package/dist/client/assets/{AgentLaneDetailSheet-DCIIg3Zp.js → AgentLaneDetailSheet-BD8B51ka.js} +1 -1
- package/dist/client/assets/{AgentLaneSummaryResize-yTM4GQAJ.js → AgentLaneSummaryResize--lHgnncr.js} +1 -1
- package/dist/client/assets/AgentLanesEmbedScreen-FRTVASPw.js +1 -0
- package/dist/client/assets/{AgentLanesPreflight-DJeDRTAN.js → AgentLanesPreflight-BwkGk8JH.js} +1 -1
- package/dist/client/assets/{AgentLanesView-CbY9qD0z.js → AgentLanesView-Bm85ittm.js} +1 -1
- package/dist/client/assets/{AgentLiveActions-Bn3zeZBN.js → AgentLiveActions-BmXDRxER.js} +1 -1
- package/dist/client/assets/{AgentSessions-czl5zT7A.js → AgentSessions-C_tAfGN2.js} +1 -1
- package/dist/client/assets/{AgentsConsole-CoT2crwq.js → AgentsConsole-DsHWsaOJ.js} +1 -1
- package/dist/client/assets/{AgentsScreen-BcPM-z1T.js → AgentsScreen-Bod6AHlA.js} +1 -1
- package/dist/client/assets/AgentsSubnav-CsvYzzQ-.js +1 -0
- package/dist/client/assets/{AstronautSuit-BADl7m8x.js → AstronautSuit-C05Ezxl9.js} +1 -1
- package/dist/client/assets/{AtopView-DymBCiXv.js → AtopView-DOKJbiJL.js} +1 -1
- package/dist/client/assets/{BackToPicker-CqYhOaLB.js → BackToPicker-CXsbxbHM.js} +1 -1
- package/dist/client/assets/{BriefingDetailScreen-DDfZ8ci1.js → BriefingDetailScreen-Uvnk3t0v.js} +1 -1
- package/dist/client/assets/{BriefingsScreen-CLvSOJjy.js → BriefingsScreen-DLIJ8eYj.js} +1 -1
- package/dist/client/assets/{BrokerMetadataPanel-DFAH-NO6.js → BrokerMetadataPanel-C8WERmHF.js} +1 -1
- package/dist/client/assets/{BrokerScreen-Bkvu92jk.js → BrokerScreen-LZ3T7hGG.js} +1 -1
- package/dist/client/assets/{Canvas-KyTsDJlB.js → Canvas-BO9mx5_P.js} +1 -1
- package/dist/client/assets/{ChatCollapsedStrip-Bjjqa30K.js → ChatCollapsedStrip-CtLPTLTY.js} +1 -1
- package/dist/client/assets/{CodeDiffPane-C9HT1dCT.js → CodeDiffPane-CtgqIuS0.js} +1 -1
- package/dist/client/assets/{CodeProjectPicker-5Y3GvXkM.js → CodeProjectPicker-C4W_udc7.js} +1 -1
- package/dist/client/assets/{CodeScreen-DpN9kQvm.js → CodeScreen-WhTvVUKY.js} +1 -1
- package/dist/client/assets/{ConversationComposer-Ce7Byw48.js → ConversationComposer-DPWu3HvK.js} +1 -1
- package/dist/client/assets/{ConversationFeedRows-DygDfQn_.js → ConversationFeedRows-MhcPfxUr.js} +1 -1
- package/dist/client/assets/{ConversationHeader-C3sg0ULI.js → ConversationHeader-Ce7TENb9.js} +1 -1
- package/dist/client/assets/{ConversationPanels-Dg4Y2GgX.js → ConversationPanels-D-b5SLO-.js} +2 -2
- package/dist/client/assets/ConversationScreen-C5HnXd5w.css +1 -0
- package/dist/client/assets/{ConversationScreen-CjWWmuuh.js → ConversationScreen-D77SoLos.js} +1 -1
- package/dist/client/assets/{ConversationStatus-BhVIYQza.js → ConversationStatus-lIvSKRic.js} +1 -1
- package/dist/client/assets/CrewWorkspaces-CJhBKVoZ.css +1 -0
- package/dist/client/assets/CrewWorkspaces-CdojnRMG.js +1 -0
- package/dist/client/assets/{DataTable-oJP339bX.js → DataTable-DFacT2uu.js} +1 -1
- package/dist/client/assets/{DispatchAftermath-CH02HAVw.js → DispatchAftermath-D797PbCe.js} +1 -1
- package/dist/client/assets/{DocumentFocusViewer-DmtFisY9.js → DocumentFocusViewer-CetjnYut.js} +1 -1
- package/dist/client/assets/{EmbeddableSurfacesLab-84b9I3fy.js → EmbeddableSurfacesLab-JczLmmF-.js} +1 -1
- package/dist/client/assets/{EmptyState-BnDda92b.js → EmptyState-uQbB-bvP.js} +1 -1
- package/dist/client/assets/{FileViewerPane-Dg7_88pv.js → FileViewerPane-ebbCtnHE.js} +1 -1
- package/dist/client/assets/{FlightObserveScreen-DL3Xhl0h.js → FlightObserveScreen-sqvt7HUO.js} +1 -1
- package/dist/client/assets/{FollowScreen-DcFBqr6l.js → FollowScreen-Bfu2_KtU.js} +1 -1
- package/dist/client/assets/{HarnessMark-DGZ6o6Ct.js → HarnessMark-CEzmPFHC.js} +1 -1
- package/dist/client/assets/{HarnessesScreen-DTDL-XaA.js → HarnessesScreen-CGhRsqD5.js} +1 -1
- package/dist/client/assets/{HerdrSession-DV2hD6Yh.js → HerdrSession-BDLa_rrK.js} +1 -1
- package/dist/client/assets/{HomeHero-CENwVZ45.js → HomeHero-DdxTQ-6a.js} +1 -1
- package/dist/client/assets/{HostAdvisorView-PgiZUkd_.js → HostAdvisorView-BAUi5ZxX.js} +1 -1
- package/dist/client/assets/{KnowledgeSearchInspector-DNQjeWZO.js → KnowledgeSearchInspector-GjmxYBi_.js} +1 -1
- package/dist/client/assets/{KnowledgeSearchScreen-Bj80IgR0.js → KnowledgeSearchScreen-CRei9pyl.js} +1 -1
- package/dist/client/assets/{LaneToolHoverCard-197xYmRp.js → LaneToolHoverCard-DCY-m0JK.js} +1 -1
- package/dist/client/assets/{LaneTraceDetailSheet-BztwvOv9.js → LaneTraceDetailSheet-CFsCvKa3.js} +1 -1
- package/dist/client/assets/{LaneTraceEventFocus-C9cmqxnK.js → LaneTraceEventFocus-BfKZ7G5c.js} +1 -1
- package/dist/client/assets/{MeshCanvas-C3_2p9B6.js → MeshCanvas-CZYHLTvw.js} +1 -1
- package/dist/client/assets/{MeshCanvasMinimap-ZTjYWXTZ.js → MeshCanvasMinimap-D3mJ78CM.js} +1 -1
- package/dist/client/assets/{MeshScreen-lJKaOyGB.js → MeshScreen-dxNxRtKm.js} +1 -1
- package/dist/client/assets/{MeshTopologyView-CBjHbAZw.js → MeshTopologyView-A-wh0Ad1.js} +2 -2
- package/dist/client/assets/{MessagesScreen-D6MVLvdg.js → MessagesScreen-CR5v-WIE.js} +1 -1
- package/dist/client/assets/{MissionContextRail-DXkrbcnZ.js → MissionContextRail-MTL2EAnr.js} +1 -1
- package/dist/client/assets/{MissionControlView-BCH-Zsp4.js → MissionControlView-BGj1qnI2.js} +1 -1
- package/dist/client/assets/{MissionFocusOverlay-DbAliOSF.js → MissionFocusOverlay-hWi6y87j.js} +1 -1
- package/dist/client/assets/{MissionLeftAgentRow-Bx6Pg8_O.js → MissionLeftAgentRow-BSRRiiig.js} +1 -1
- package/dist/client/assets/{MissionLogPane-D06c29Y8.js → MissionLogPane-bbG_pM9B.js} +1 -1
- package/dist/client/assets/{NewAgentModal-C18Ajovd.js → NewAgentModal-Ctixol4_.js} +1 -1
- package/dist/client/assets/{NewChatComposer-Bgqes0UQ.js → NewChatComposer-BPsg8shF.js} +1 -1
- package/dist/client/assets/{NewChatOrigin-DpHS2Wmt.js → NewChatOrigin-CCiPg_WR.js} +1 -1
- package/dist/client/assets/{ObserveEmbedScreen-Cmhwai4X.js → ObserveEmbedScreen-Be87Chod.js} +1 -1
- package/dist/client/assets/{ObserveTextFlow-C1f5oize.js → ObserveTextFlow-CKYltTPJ.js} +2 -2
- package/dist/client/assets/{ObservedTopologyPanel-D85P6RAk.js → ObservedTopologyPanel-CfHYu-4Z.js} +1 -1
- package/dist/client/assets/{OpenScoutAppShell-IDI4fuUE.js → OpenScoutAppShell-DPeP1vtK.js} +2 -2
- package/dist/client/assets/{OpsAgentsView-yt0JavoB.js → OpsAgentsView-dEtw9yt-.js} +1 -1
- package/dist/client/assets/OpsScreen-QXRJY8Vf.js +1 -0
- package/dist/client/assets/OpsSubnav-BK9Fj3gU.js +1 -0
- package/dist/client/assets/ProjectAgentProfile-BjykZ2Xd.js +1 -0
- package/dist/client/assets/{ProjectAgentProfileBar-IDEpKZvI.js → ProjectAgentProfileBar-B4RqrI0Q.js} +1 -1
- package/dist/client/assets/{ProjectAgentProfileHero-Bh_aISs-.js → ProjectAgentProfileHero-Bc0g8rhW.js} +1 -1
- package/dist/client/assets/{ProjectsInbox-B8Srlklk.js → ProjectsInbox--ZIqo-IE.js} +1 -1
- package/dist/client/assets/{ProjectsRail-DqAbdvCf.js → ProjectsRail-CzS0qTCI.js} +1 -1
- package/dist/client/assets/ProjectsScreen-0gx7f30h.js +1 -0
- package/dist/client/assets/{ProjectsThreadAside-DpkjYLL2.js → ProjectsThreadAside-BsQRFbdy.js} +1 -1
- package/dist/client/assets/{Provider-Ve8yXaWR.js → Provider-Cd-QZltN.js} +1 -1
- package/dist/client/assets/{RailRow-C4GNGR80.js → RailRow-BY6fxePa.js} +1 -1
- package/dist/client/assets/{RawSessionsTable-Co3vzwsf.js → RawSessionsTable-CbopOF34.js} +1 -1
- package/dist/client/assets/{RealtimeVoiceScreen-DMd1CBAf.js → RealtimeVoiceScreen-CU4uXz4C.js} +1 -1
- package/dist/client/assets/{RepoDiffEmbedScreen-C97Euf4s.js → RepoDiffEmbedScreen-Cr1SL5ht.js} +1 -1
- package/dist/client/assets/{RepoDiffPageScreen-DUKLzkrW.js → RepoDiffPageScreen-DeC8fsh_.js} +1 -1
- package/dist/client/assets/{RepoDiffViewer-CovKjSgb.js → RepoDiffViewer-CiTOWK_Z.js} +1 -1
- package/dist/client/assets/{RepoDiffViewerLazy-zIiEmh-e.js → RepoDiffViewerLazy-BU3V7Kwq.js} +2 -2
- package/dist/client/assets/{ReposScreen-BR1LqTf1.js → ReposScreen-BQwIShXf.js} +1 -1
- package/dist/client/assets/{ScoutDeckSurface-BGsVicc2.js → ScoutDeckSurface-BncYKicb.js} +1 -1
- package/dist/client/assets/{ScoutSurface-BMKW7hSu.js → ScoutSurface-DdVzN3DA.js} +1 -1
- package/dist/client/assets/{ScoutbotFxLab-0O2iDRrF.js → ScoutbotFxLab-sLjfSKtS.js} +1 -1
- package/dist/client/assets/{SecondaryNav-cYTw2p39.js → SecondaryNav-CCQqTT3e.js} +1 -1
- package/dist/client/assets/{SessionEmbedScreen-mNjT0R6j.js → SessionEmbedScreen-BrLMZJ3N.js} +1 -1
- package/dist/client/assets/{SessionObserve-zAlFbwFn.js → SessionObserve-pbozyqVv.js} +1 -1
- package/dist/client/assets/{SessionObserveEvidence-BVawzqoE.js → SessionObserveEvidence-C54Xvbps.js} +1 -1
- package/dist/client/assets/{SessionRefScreen-BmKhf29o.js → SessionRefScreen-UVNVrwAf.js} +1 -1
- package/dist/client/assets/SessionsScreen-KeDb5gz4.js +1 -0
- package/dist/client/assets/SettingsDrawer-CWdj0VvN.js +3 -0
- package/dist/client/assets/SettingsDrawer-J-8x1eII.css +1 -0
- package/dist/client/assets/SettingsScreen-C7zJgZzj.js +1 -0
- package/dist/client/assets/{ShikiPane-DyEJdcvb.js → ShikiPane-CiVH-45m.js} +1 -1
- package/dist/client/assets/{SlidePanel-Dg8_styW.js → SlidePanel-BLrLF9dt.js} +1 -1
- package/dist/client/assets/{SpriteAvatar-DMrSssNZ.js → SpriteAvatar-vpHO-rXs.js} +1 -1
- package/dist/client/assets/{StatusPill-NFFnphtx.js → StatusPill-a3XBw1GG.js} +1 -1
- package/dist/client/assets/{TailView-BfObcZu3.js → TailView-C3rjOV7i.js} +1 -1
- package/dist/client/assets/{Terminal-Dr-M9U4u.js → Terminal-CMQFmHnn.js} +1 -1
- package/dist/client/assets/{TerminalEmbedScreen-BmyZkonh.js → TerminalEmbedScreen-GvpoGERN.js} +1 -1
- package/dist/client/assets/{TerminalRelay-lJ2KdMCW.js → TerminalRelay-CIHlLVf1.js} +3 -3
- package/dist/client/assets/{TextDocumentSurface-C7fGlzY8.js → TextDocumentSurface-B29xZNlI.js} +1 -1
- package/dist/client/assets/{TmuxPeek-BSeKIjnX.js → TmuxPeek-eVfqPB4m.js} +1 -1
- package/dist/client/assets/{VoicePermissionsPanel-BkIGTzgw.js → VoicePermissionsPanel-DpInOlVq.js} +1 -1
- package/dist/client/assets/{WorkDetailScreen-Cwe-KWK4.js → WorkDetailScreen-DYwgGaJs.js} +1 -1
- package/dist/client/assets/{WorkFilesViewer-BBtKRBPv.js → WorkFilesViewer-C7H5fXaZ.js} +1 -1
- package/dist/client/assets/{activity-D4W2XZY2.js → activity-DTqqWiyV.js} +1 -1
- package/dist/client/assets/{addon-fit-Celjj2yn.js → addon-fit-CcaylYTX.js} +1 -1
- package/dist/client/assets/{addon-webgl-Cu4tJ21-.js → addon-webgl-B37iuzOG.js} +1 -1
- package/dist/client/assets/{agent-autocomplete-Dv-_9dAw.js → agent-autocomplete-cOPLtuhM.js} +1 -1
- package/dist/client/assets/{agent-essentials-CngjUhQj.js → agent-essentials-DbbJm3ne.js} +1 -1
- package/dist/client/assets/{agent-identity-DzHGhLdJ.js → agent-identity-CIMT7oV6.js} +1 -1
- package/dist/client/assets/{agent-specialization-CNrsRbKA.js → agent-specialization-D3-sqwhU.js} +1 -1
- package/dist/client/assets/{arc.es-DNT50Y-_.js → arc.es-BRPqOKIx.js} +1 -1
- package/dist/client/assets/{archive-DH49QqFG.js → archive-DPMdoW_D.js} +1 -1
- package/dist/client/assets/{arrow-left-i-h6JAgs.js → arrow-left-B0CdJdAC.js} +1 -1
- package/dist/client/assets/{arrow-right-B0Yi01Zr.js → arrow-right-YRBoTTyf.js} +1 -1
- package/dist/client/assets/{arrow-up-right-RBC6k8nn.js → arrow-up-right-CilNLf4t.js} +1 -1
- package/dist/client/assets/{bot-r2IuAuJd.js → bot-Ba3gcRVa.js} +1 -1
- package/dist/client/assets/{check-Bfs7hMb1.js → check-BdovFDz8.js} +1 -1
- package/dist/client/assets/{chevron-down-Da5tV19_.js → chevron-down-Jh540uf3.js} +1 -1
- package/dist/client/assets/{chevron-right-BMqtBds_.js → chevron-right-CV7sEVBS.js} +1 -1
- package/dist/client/assets/{chunk-HRAB3GC3-BUVYXXAp.js → chunk-HRAB3GC3-BYQZ1LOn.js} +1 -1
- package/dist/client/assets/{clock-DaKLp6Xd.js → clock-DpfYdWcr.js} +1 -1
- package/dist/client/assets/{code-xml-ByQsfOI_.js → code-xml-CPzpZkhu.js} +1 -1
- package/dist/client/assets/{compass-BepM5iWH.js → compass-D5Io6BIV.js} +1 -1
- package/dist/client/assets/{content-Bgl_X3ao.js → content-3b_jmxEx.js} +1 -1
- package/dist/client/assets/content-B-i0XY-t.js +1 -0
- package/dist/client/assets/content-BD-DNFmb.js +1 -0
- package/dist/client/assets/content-BGeo5tgd.js +1 -0
- package/dist/client/assets/content-BMvXPLiQ.js +1 -0
- package/dist/client/assets/content-BWTbfMDg.js +1 -0
- package/dist/client/assets/content-BwCmeUmF.js +1 -0
- package/dist/client/assets/content-C1K3NcZa.js +1 -0
- package/dist/client/assets/{content-Cv2tSAbv.js → content-C34J5_Af.js} +1 -1
- package/dist/client/assets/content-CGRtIS2m.js +1 -0
- package/dist/client/assets/content-CIJo_-JS.js +1 -0
- package/dist/client/assets/content-CvqIqVAV.js +1 -0
- package/dist/client/assets/content-DRnwm-Vu.js +1 -0
- package/dist/client/assets/{content-5hnDC9WE.js → content-Dh39SSvP.js} +1 -1
- package/dist/client/assets/content-DoypqDj5.js +1 -0
- package/dist/client/assets/content-n3mvc6NQ.js +1 -0
- package/dist/client/assets/{conversation-icons-C4amK8Sa.js → conversation-icons-bHIIZ9z3.js} +1 -1
- package/dist/client/assets/{conversation-model-CigSPlKA.js → conversation-model-CIzM7aXT.js} +1 -1
- package/dist/client/assets/conversation-motion-features-CrP5K-dk.js +1 -0
- package/dist/client/assets/{copy-De4s38o2.js → copy-DQAM0eSY.js} +1 -1
- package/dist/client/assets/{cpu-Bc268H9Q.js → cpu-CtQc0Z9D.js} +1 -1
- package/dist/client/assets/{createLucideIcon-DLlxGjKt.js → createLucideIcon-Da0lq809.js} +1 -1
- package/dist/client/assets/discover-DdkMhTAV.js +2 -0
- package/dist/client/assets/embed-entry-DoSM1GZB.js +2 -0
- package/dist/client/assets/{external-link-BGHC_naA.js → external-link-BheHazeW.js} +1 -1
- package/dist/client/assets/{eye-BeCSqJn1.js → eye-B908WSFH.js} +1 -1
- package/dist/client/assets/{file-code-corner-CX53Cd9y.js → file-code-corner-C5Pc6znt.js} +1 -1
- package/dist/client/assets/{file-text-BVhkMWyC.js → file-text-BGVkHS4_.js} +1 -1
- package/dist/client/assets/{gauge-CPcEPmNt.js → gauge-sc_gb5Zw.js} +1 -1
- package/dist/client/assets/{gestures-BXIGYk_p.js → gestures-AzPBSf20.js} +1 -1
- package/dist/client/assets/{git-branch-q8Ayc8py.js → git-branch-CdJU49Af.js} +1 -1
- package/dist/client/assets/{home-moving-signal-Dm2Z2x0p.js → home-moving-signal-CZo2bYBi.js} +1 -1
- package/dist/client/assets/{home-now-card-xU5LGP7q.js → home-now-card-DgxfZHcR.js} +1 -1
- package/dist/client/assets/{home-now-card-nano-Djhy6ax0.js → home-now-card-nano-iwd10r9G.js} +1 -1
- package/dist/client/assets/{hooks-CdKx1CxP.js → hooks-CeCCO6Yg.js} +1 -1
- package/dist/client/assets/{index-DhfOMK0D.js → index-BIiI9gfa.js} +1 -1
- package/dist/client/assets/index-CD2foMB8.js +1 -0
- package/dist/client/assets/{index-D7UEHxaY.js → index-DReHD_4U.js} +1 -1
- package/dist/client/assets/{index-Bli6bTLU.js → index-NRbRrZw-.js} +6 -6
- package/dist/client/assets/{inspector-panel-B8pigRsg.js → inspector-panel-CBf8pW7s.js} +1 -1
- package/dist/client/assets/{keyboard-nav-7iEtvu9P.js → keyboard-nav-feLCB3Zm.js} +1 -1
- package/dist/client/assets/{lane-roster-store-pHT3TAVs.js → lane-roster-store-BAmj273z.js} +1 -1
- package/dist/client/assets/{layers-BiZA-Clc.js → layers-D9fblkql.js} +1 -1
- package/dist/client/assets/{layout-grid-DMpv9CZM.js → layout-grid-Vd1chalc.js} +1 -1
- package/dist/client/assets/left-41_3QKk1.js +1 -0
- package/dist/client/assets/{left-Dy403II2.js → left-B3ofA1Pr.js} +2 -2
- package/dist/client/assets/{left-BhgU6NOA.js → left-BWBZQhxQ.js} +1 -1
- package/dist/client/assets/{left-CY_FGnN7.js → left-BhA6essi.js} +1 -1
- package/dist/client/assets/{left-Cq8mjamr.js → left-BmTKCv4f.js} +1 -1
- package/dist/client/assets/{left-Dnqla0b5.js → left-CCGR6tIF.js} +1 -1
- package/dist/client/assets/{left-BhZhSrS2.js → left-Dfwzkwh_.js} +1 -1
- package/dist/client/assets/{left-advisor-oOAtJ9YE.js → left-advisor-yrzW1Kwz.js} +1 -1
- package/dist/client/assets/{left-agents-TIKe8vW8.js → left-agents-Bgahk0FF.js} +1 -1
- package/dist/client/assets/{left-default-owH0Lwxo.js → left-default-CtkfAquc.js} +1 -1
- package/dist/client/assets/{left-lanes-BE_co2lP.js → left-lanes-CpujaVN3.js} +1 -1
- package/dist/client/assets/{left-mission-C_nWUtfA.js → left-mission-Bbd-fW6W.js} +1 -1
- package/dist/client/assets/{library-BSVrjn_m.js → library-Dx14WNGd.js} +1 -1
- package/dist/client/assets/{loader-circle-DoT8gpw6.js → loader-circle-Be0T8xv2.js} +1 -1
- package/dist/client/assets/{local-agents-BMadXuP1.js → local-agents-Q6KQ12B9.js} +1 -1
- package/dist/client/assets/{mentions-Cd6XticV.js → mentions-KNASbAjG.js} +1 -1
- package/dist/client/assets/{mesh-ops-C0zCLTR8.js → mesh-ops-C-i8OMiM.js} +1 -1
- package/dist/client/assets/{mesh-view-store-Cpqil_2D.js → mesh-view-store-B0lqpw8M.js} +1 -1
- package/dist/client/assets/{message-circle-44KSmbvQ.js → message-circle-2v9Udia0.js} +1 -1
- package/dist/client/assets/{message-markup-DAnnGpWr.js → message-markup-BP2nH9kQ.js} +1 -1
- package/dist/client/assets/{message-square-DlY4EneU.js → message-square-DURSOrUr.js} +1 -1
- package/dist/client/assets/{mission-control-store-DtjtRs9Z.js → mission-control-store-HeCy97KT.js} +1 -1
- package/dist/client/assets/{observe-DL5_8-Zj.js → observe-DkAhvkfn.js} +1 -1
- package/dist/client/assets/{page-status-CW8co39E.js → page-status-CEP5pGf3.js} +1 -1
- package/dist/client/assets/{persistent-state-DYjP8lqN.js → persistent-state-Bm_0TmZL.js} +1 -1
- package/dist/client/assets/{plus-64n9qucr.js → plus-ZReaTFF-.js} +1 -1
- package/dist/client/assets/{profile-BkmuseW7.js → profile-Y0X7HZHc.js} +1 -1
- package/dist/client/assets/{projects-inbox-C0umZMSY.js → projects-inbox-Cbfj4Hx7.js} +1 -1
- package/dist/client/assets/{provider-CX9EWecp.js → provider-Bq0ScH3v.js} +1 -1
- package/dist/client/assets/{proxy-C35W-YHZ.js → proxy-DtC2iXnT.js} +1 -1
- package/dist/client/assets/{radio-BjpQTKT0.js → radio-BC9TO5Pl.js} +1 -1
- package/dist/client/assets/{refresh-cw-IgN2fZLM.js → refresh-cw-C4E58VJK.js} +1 -1
- package/dist/client/assets/resolve-panes-BI3WdDS-.js +1 -0
- package/dist/client/assets/resolve-sidebar-context-_g0pIxOr.js +1 -0
- package/dist/client/assets/{right-B3PQUHd5.js → right-BA0F8fPI.js} +1 -1
- package/dist/client/assets/{right-B96CBzrV.js → right-BarpRgcv.js} +1 -1
- package/dist/client/assets/{right-BPirlFC8.js → right-C4GXB45w.js} +1 -1
- package/dist/client/assets/{right-DqiVyo8v.js → right-CIzaNH58.js} +1 -1
- package/dist/client/assets/{right-C2aOC2li.js → right-CXetlD8X.js} +1 -1
- package/dist/client/assets/{right-CtPJjgOV.js → right-CnRcQS_I.js} +1 -1
- package/dist/client/assets/{right-BVWYPIFX.js → right-D2_rmbAH.js} +1 -1
- package/dist/client/assets/{right-SfSu0zHC.js → right-Dqp--KwX.js} +1 -1
- package/dist/client/assets/{right-BUP2Ro_M.js → right-HJJzRuGD.js} +1 -1
- package/dist/client/assets/{right-BoAJxwA3.js → right-WCMb8YXJ.js} +1 -1
- package/dist/client/assets/{rocket-DnmN_YOD.js → rocket-BahfIwFz.js} +1 -1
- package/dist/client/assets/{router-B0YclXYg.js → router-Bx1tiwVe.js} +1 -1
- package/dist/client/assets/{scope-views-Z8aoAmtU.js → scope-views-CmG2X_S0.js} +1 -1
- package/dist/client/assets/{scout-voice-DvG_3stJ.js → scout-voice-BT3gYDhU.js} +1 -1
- package/dist/client/assets/{scoutbot-markdown-BJJyaPu2.js → scoutbot-markdown-DIhLsYxz.js} +1 -1
- package/dist/client/assets/{scroll-text-DRidbcse.js → scroll-text-uulNqrf7.js} +1 -1
- package/dist/client/assets/{search-BbgsEMXa.js → search-HmdKXdtR.js} +1 -1
- package/dist/client/assets/{secondaryNavConfig-DyC_P9Wx.js → secondaryNavConfig-BVQiyAXu.js} +1 -1
- package/dist/client/assets/{selection-bridge-CpzFGx3-.js → selection-bridge-n4wNTm1B.js} +1 -1
- package/dist/client/assets/{send-horizontal-BXo2uz3Z.js → send-horizontal-DOjHkZCD.js} +1 -1
- package/dist/client/assets/{server-Dt3tpiBj.js → server-CX-xQjJA.js} +1 -1
- package/dist/client/assets/{session-catalog-CUQ8LUJY.js → session-catalog-b7B1Sof1.js} +1 -1
- package/dist/client/assets/{session-table-B4JOKevn.js → session-table-Djain1Qr.js} +1 -1
- package/dist/client/assets/{settings-BzWCF3NF.js → settings-BpKRzxOD.js} +1 -1
- package/dist/client/assets/{sliders-horizontal-7V8B3xsf.js → sliders-horizontal-D2O6QiDN.js} +1 -1
- package/dist/client/assets/{sparkles-ytTwpCbZ.js → sparkles-CgTby-ap.js} +1 -1
- package/dist/client/assets/{sse-CSozY6mp.js → sse-QSbhyq9A.js} +1 -1
- package/dist/client/assets/{tail-events-CrN-Rmxj.js → tail-events-B7BrDaFi.js} +1 -1
- package/dist/client/assets/{terminal-BiNIXhna.js → terminal-DNZTCr6a.js} +1 -1
- package/dist/client/assets/{terminal-relay-pSm7_An6.js → terminal-relay-C2TUIuh1.js} +1 -1
- package/dist/client/assets/{terminal-takeover-CtA3wcXh.js → terminal-takeover-BArLfNtd.js} +1 -1
- package/dist/client/assets/{text-BR9Bap0E.js → text-B2UZi3l9.js} +1 -1
- package/dist/client/assets/{use-conversation-list-C0bEXFeH.js → use-conversation-list-htp0Ui63.js} +1 -1
- package/dist/client/assets/{use-fleet-active-asks-CK4aw-3G.js → use-fleet-active-asks-BhuTn5mV.js} +1 -1
- package/dist/client/assets/{use-mesh-ops-items-QixBijmT.js → use-mesh-ops-items-CD-qsvNX.js} +1 -1
- package/dist/client/assets/{use-reduced-motion-BLn59zLn.js → use-reduced-motion-0fAsybdo.js} +1 -1
- package/dist/client/assets/{use-scout-dev-flags-JKb1EhFh.js → use-scout-dev-flags-DV_I6URU.js} +1 -1
- package/dist/client/assets/{useAgentHoverCard-6N8b7qsU.js → useAgentHoverCard-BIrm8esH.js} +1 -1
- package/dist/client/assets/useContentSecondaryNav-4atpGgFw.js +1 -0
- package/dist/client/assets/{usePersistentState-DOEahRlt.js → usePersistentState-InmPXIN4.js} +1 -1
- package/dist/client/assets/{usePierreRuntime-Bq6mXrgd.js → usePierreRuntime-CVTMzChM.js} +1 -1
- package/dist/client/assets/{wrench-CQvdf7KT.js → wrench-DwFKomxg.js} +1 -1
- package/dist/client/assets/{x-BJyPzFnn.js → x-DuzAbpk5.js} +1 -1
- package/dist/client/assets/{xterm-D6dE_wMr.js → xterm-xQGYNyB-.js} +1 -1
- package/dist/client/assets/{zap-rw7uwZht.js → zap-CocRNtyr.js} +1 -1
- package/dist/client/crew/brik-bust.webp +0 -0
- package/dist/client/crew/brik-chip-id.webp +0 -0
- package/dist/client/crew/lulu-bust.webp +0 -0
- package/dist/client/crew/milo-bust.webp +0 -0
- package/dist/client/crew/milo-chip-id.webp +0 -0
- package/dist/client/crew/nori-bust.webp +0 -0
- package/dist/client/crew/sheets/eye-plate-v1/blink-half.webp +0 -0
- package/dist/client/crew/sheets/eye-plate-v1/blink-shut.webp +0 -0
- package/dist/client/crew/sheets/eye-plate-v1/look-left.webp +0 -0
- package/dist/client/crew/sheets/eye-plate-v1/look-right.webp +0 -0
- package/dist/client/crew/sheets/eye-plate-v1/look-up.webp +0 -0
- package/dist/client/crew/sheets/eye-plate-v1/rest.webp +0 -0
- package/dist/client/crew/sheets/sprout/blink-half.webp +0 -0
- package/dist/client/crew/sheets/sprout/blink-shut.webp +0 -0
- package/dist/client/crew/sheets/sprout/look-left.webp +0 -0
- package/dist/client/crew/sheets/sprout/look-right.webp +0 -0
- package/dist/client/crew/sheets/sprout/look-up.webp +0 -0
- package/dist/client/crew/sprout-bust.webp +0 -0
- package/dist/client/crew/sprout-chip-id.webp +0 -0
- package/dist/client/crew/vex-bust.webp +0 -0
- package/dist/client/crew/vex-chip-id.webp +0 -0
- package/dist/client/crew/wrench-bust.webp +0 -0
- package/dist/client/crew/wrench-chip-id.webp +0 -0
- package/dist/client/index.html +1 -1
- package/dist/main.mjs +1 -1
- package/package.json +1 -1
- package/dist/client/assets/AgentAvatar-B1xvQ7ej.js +0 -1
- package/dist/client/assets/AgentLanesEmbedScreen-BJLwXSNp.js +0 -1
- package/dist/client/assets/AgentsSubnav-3_vpn2bT.js +0 -1
- package/dist/client/assets/ConversationScreen-BP5tdz2k.css +0 -1
- package/dist/client/assets/CrewWorkspaces-B6YIyw1z.css +0 -1
- package/dist/client/assets/CrewWorkspaces-CDU-wy1Y.js +0 -1
- package/dist/client/assets/OpsScreen-C3yNQqJE.js +0 -1
- package/dist/client/assets/OpsSubnav-BijKI3yG.js +0 -1
- package/dist/client/assets/ProjectAgentProfile-DnIeC16r.js +0 -1
- package/dist/client/assets/ProjectsScreen-DKHQ2iEv.js +0 -1
- package/dist/client/assets/SessionsScreen-CsSqjIY2.js +0 -1
- package/dist/client/assets/SettingsDrawer-Dsj-On_x.css +0 -1
- package/dist/client/assets/SettingsDrawer-DwYQTGi8.js +0 -3
- package/dist/client/assets/SettingsScreen-Btaku7YM.js +0 -1
- package/dist/client/assets/content-BRFZ-a6m.js +0 -1
- package/dist/client/assets/content-BYykncDo.js +0 -1
- package/dist/client/assets/content-Be6yyWbJ.js +0 -1
- package/dist/client/assets/content-BopJW1Zx.js +0 -1
- package/dist/client/assets/content-Bv2sfg0w.js +0 -1
- package/dist/client/assets/content-CMBiIZTg.js +0 -1
- package/dist/client/assets/content-CPVqvf5o.js +0 -1
- package/dist/client/assets/content-CbwyFqdI.js +0 -1
- package/dist/client/assets/content-ClQjAWYi.js +0 -1
- package/dist/client/assets/content-DFFe3-Ot.js +0 -1
- package/dist/client/assets/content-DY5hwBmm.js +0 -1
- package/dist/client/assets/content-_IXoxGno.js +0 -1
- package/dist/client/assets/content-j_tewJdE.js +0 -1
- package/dist/client/assets/conversation-motion-features-_95aZx_1.js +0 -1
- package/dist/client/assets/discover-DOlk1hG7.js +0 -2
- package/dist/client/assets/embed-entry-BqDJfa87.js +0 -2
- package/dist/client/assets/index-DFdlQs_c.js +0 -1
- package/dist/client/assets/left-BayK4ocL.js +0 -1
- package/dist/client/assets/resolve-panes-CCqRkQdM.js +0 -1
- package/dist/client/assets/resolve-sidebar-context-JkxY8qsV.js +0 -1
- package/dist/client/assets/useContentSecondaryNav-D-hVKzM9.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,r as o,n as Ve,o as Ye}from"./index-Bli6bTLU.js";/* empty css */import{u as Rs,a as Es}from"./Provider-Ve8yXaWR.js";import{a as me}from"./api-DEHEgJ9m.js";import{c as bs}from"./clipboard-e3fSpeo7.js";import{d as Ws}from"./colors-BtO5_zlx.js";import{r as Te,S as Ge,a as Je,w as Ie,s as bt,b as xt,d as yt,c as jt,e as As,f as Ce,g as gt}from"./terminal-relay-pSm7_An6.js";import{p as Ms,g as St,f as Ls,b as Ds,s as F,d as Be,h as He,r as zs,i as Os,j as wt,k as Nt,m as Ct,t as Ps,n as vt}from"./terminal-sessions-D4dHTRkt.js";import{H as Tt,u as Xe,a as It,c as Rt,h as Et,b as Wt,A as At}from"./HerdrSession-DV2hD6Yh.js";import{D as Mt,c as Lt,P as Dt,s as _e,T as zt,a as Ot,d as _s}from"./session-table-B4JOKevn.js";import{u as Ze,T as Pt}from"./TerminalRelay-lJ2KdMCW.js";import{u as $e,L as Qe}from"./usePersistentState-DOEahRlt.js";import{q as _t}from"./terminal-takeover-CtA3wcXh.js";import{t as $t}from"./time-Dhsh_2EG.js";import{B as ue}from"./BackToPicker-CqYhOaLB.js";import{T as Ft}from"./TmuxPeek-BSeKIjnX.js";import{R as es}from"./refresh-cw-IgN2fZLM.js";import{c as $s}from"./createLucideIcon-DLlxGjKt.js";import{P as Z}from"./plus-64n9qucr.js";import{T as U}from"./terminal-BiNIXhna.js";import{Z as Kt}from"./zap-rw7uwZht.js";import{S as Ut}from"./text-BR9Bap0E.js";import{X as pe}from"./x-BJyPzFnn.js";import{E as Bt}from"./eye-BeCSqJn1.js";import{E as Fs}from"./external-link-BGHC_naA.js";import"./provider-CX9EWecp.js";import"./router-B0YclXYg.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./sse-CSozY6mp.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-D4vuKzOL.js";import"./DocumentFocusViewer-DmtFisY9.js";import"./TextDocumentSurface-C7fGlzY8.js";import"./file-text-BVhkMWyC.js";import"./chevron-right-BMqtBds_.js";import"./code-xml-ByQsfOI_.js";import"./arrow-left-i-h6JAgs.js";import"./arrow-right-B0Yi01Zr.js";import"./scout-voice-DvG_3stJ.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-7iEtvu9P.js";import"./NewChatComposer-Bgqes0UQ.js";import"./conversation-model-CigSPlKA.js";import"./index-DFdlQs_c.js";import"./HarnessMark-DGZ6o6Ct.js";import"./NewChatOrigin-DpHS2Wmt.js";import"./chevron-down-Da5tV19_.js";import"./search-BbgsEMXa.js";import"./loader-circle-DoT8gpw6.js";import"./chunk-HRAB3GC3-BUVYXXAp.js";import"./check-Bfs7hMb1.js";import"./copy-De4s38o2.js";/* empty css */import"./voice-levels-Dcr3jglk.js";const Ks=6,Us=2;function Re(s){if(s.layout?.mode)return{mode:s.layout.mode,...s.layout.columns===void 0?{}:{columns:Ht(s.layout.columns)}};const t=s.cellCount??0,r=We(s.columns??Us);return t<=1?{mode:"solo"}:r>=t?{mode:"lanes",columns:r}:{mode:"grid",columns:r}}function Ee(s,t){const r=Math.max(1,Math.floor(t.tileCount)||1);if(s.mode==="solo")return 1;if(s.columns===void 0||s.columns==="dynamic"){const i=s.mode==="lanes"?r:Math.ceil(Math.sqrt(r));return Math.max(1,Math.min(Ks,i))}return We(s.columns)}function Ht(s){return s==="dynamic"?"dynamic":We(s)}function qt(s){if(s.mode==="solo")return"Solo";const t=s.mode==="lanes"?"Lanes":"Grid";return s.columns===void 0||s.columns==="dynamic"?`${t} · dynamic`:`${t} · ${s.columns} column${s.columns===1?"":"s"}`}function We(s){return typeof s!="number"||!Number.isFinite(s)?Us:Math.max(1,Math.min(Ks,Math.floor(s)))}const Vt=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Yt=$s("ellipsis",Vt);const Gt=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],de=$s("grid-2x2",Gt),ss=6;function Jt(s="main",t="Main"){return{version:1,activeWorkspaceId:s,workspaces:[{id:s,name:t,tiles:[]}]}}function ts(){return{version:1,activeWorkspaceId:"",workspaces:[]}}function xs(s,t,r={}){const i=()=>r.allowEmpty?ts():Jt();if(!s||typeof s!="object")return i();const l=s;if(!Array.isArray(l.workspaces))return i();const m=[],d=new Set;for(const c of l.workspaces){if(!c||typeof c!="object")continue;const x=typeof c.id=="string"?c.id.trim():"",y=typeof c.name=="string"?c.name.trim():"";if(!x||!y||d.has(x)||!Array.isArray(c.tiles))continue;d.add(x);const S=typeof c.purpose=="string"?c.purpose.trim():"",w=Zt(c.columns),A=Xt(c.layout),M=typeof c.updatedAt=="number"&&Number.isFinite(c.updatedAt)&&c.updatedAt>=0?c.updatedAt:null;m.push({id:x,name:y,tiles:c.tiles.filter(t),...S?{purpose:S}:{},...w?{columns:w}:{},...A?{layout:A}:{},...M===null?{}:{updatedAt:M}})}return m.length===0?i():{version:1,activeWorkspaceId:typeof l.activeWorkspaceId=="string"&&d.has(l.activeWorkspaceId)?l.activeWorkspaceId:m[0].id,workspaces:m}}function Xt(s){if(!s||typeof s!="object")return null;const t=s;if(t.mode!=="solo"&&t.mode!=="lanes"&&t.mode!=="grid")return null;if(t.columns===void 0)return{mode:t.mode};if(t.columns==="dynamic")return{mode:t.mode,columns:"dynamic"};const r=We(t.columns);return{mode:t.mode,columns:r}}function Zt(s){if(typeof s!="number"||!Number.isFinite(s))return null;const t=Math.floor(s);return t<1?null:Math.min(t,ss)}function ys(s,t){const r=t.id.trim();if(!r)return s;const i={...t,id:r},m=s.workspaces.some(d=>d.id===r)?s.workspaces.map(d=>d.id===r?i:d):[i,...s.workspaces];return{...s,activeWorkspaceId:r,workspaces:m}}function js(s,t,r){const i=s.workspaces.findIndex(f=>f.id===t);if(i<0)return s;const l=s.workspaces[i],m={...l,...r};return Object.keys(r).every(f=>l[f]===m[f])?s:{...s,workspaces:s.workspaces.map((f,c)=>c===i?m:f)}}function Qt(s,t){return t===s.activeWorkspaceId||!s.workspaces.some(r=>r.id===t)?s:{...s,activeWorkspaceId:t}}function en(s,t,r={}){if(s.workspaces.length<=1)return r.allowEmpty&&s.workspaces[0]?.id===t?ts():s;const i=s.workspaces.findIndex(d=>d.id===t);if(i<0)return s;const l=s.workspaces.filter(d=>d.id!==t),m=s.activeWorkspaceId===t?l[Math.min(i,l.length-1)].id:s.activeWorkspaceId;return{...s,activeWorkspaceId:m,workspaces:l}}function sn(s,t,r){return r>1?{axis:"horizontal",edge:s.x<t.left+t.width/2?"before":"after"}:{axis:"vertical",edge:s.y<t.top+t.height/2?"before":"after"}}function tn(s,t,r,i){if(t===r)return[...s];const l=s.findIndex(y=>y.id===t),m=s.findIndex(y=>y.id===r);if(l<0||m<0)return[...s];const d=[...s],[f]=d.splice(l,1);if(!f)return[...s];const c=d.findIndex(y=>y.id===r),x=i==="after"?c+1:c;return d.splice(Math.max(0,x),0,f),d}const nn="openscout.terminal.workspaces.v1",rn=2,an="openscout.terminal.workspace-view.v1",Fe=2;function ve(s){const t=typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);return`${s}-${Date.now().toString(36)}-${t}`}const on=24;function Bs(s,t,r){const i=t.replace(/[^A-Za-z0-9_-]+/gu,"-").replace(/^[^A-Za-z0-9_]+/u,"").slice(0,on).replace(/-+$/u,""),l=ln(JSON.stringify([r,t,s]));return`scout-${s}-${i||"cell"}-${l}`}function ln(s){let t=2166136261;for(let r=0;r<s.length;r+=1)t^=s.charCodeAt(r),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}function oe(s,t="shell"){return{id:ve("cell"),kind:"fresh",backend:s,agent:t}}function gs(s){if(!s||typeof s!="object")return!1;const t=s;return typeof t.id!="string"||!t.id.trim()?!1:t.kind==="fresh"?typeof t.backend=="string"&&typeof t.agent=="string":t.kind==="registered"?typeof t.terminalSessionId=="string"&&typeof t.terminalSurfaceKey=="string":!1}function Ss(s){return{id:s.id,name:s.name,...s.purpose?{purpose:s.purpose}:{},columns:s.columns,...s.layout?{layout:s.layout}:{},updatedAt:s.updatedAt,tiles:s.cells.map(t=>t.surfaceId&&t.terminalSessionId?{id:t.id,kind:"registered",terminalSessionId:t.terminalSessionId,terminalSurfaceKey:t.surfaceId}:{id:t.id,kind:"fresh",backend:dn(t.intent.hostId)?t.intent.hostId:"pty",agent:"shell"})}}function Ke(s,t={}){return{id:s.id,name:s.name,purpose:s.purpose??"",columns:Ee(Re({layout:s.layout,columns:s.columns,cellCount:s.tiles.length}),{tileCount:s.tiles.length}),layout:Re({layout:s.layout,columns:s.columns,cellCount:s.tiles.length}),cells:s.tiles.map(r=>r.kind==="registered"?{id:r.id,surfaceId:r.terminalSurfaceKey,terminalSessionId:r.terminalSessionId,intent:cn(r,t.sessions??[])}:{id:r.id,intent:{hostId:r.backend,sessionName:r.backend==="pty"?null:Bs(r.backend,r.id,s.id)}})}}function cn(s,t){const r=Ms(s.terminalSurfaceKey),i=t.find(l=>l.id===s.terminalSessionId||l.surfaces.some(m=>St(m,s.terminalSurfaceKey)));return{...r?{hostId:r.backend,sessionName:r.hostSession}:{},...i?.cwd?{cwd:i.cwd}:{},...i?.harness?{harness:i.harness}:{},...i?.resumeCommand?{resumeCommand:i.resumeCommand}:{}}}function dn(s){return s==="pty"||s==="tmux"||s==="zellij"||s==="herdr"}function mn(s){if(!Array.isArray(s))return xs(s,gs,{allowEmpty:!0});const t=s.flatMap(r=>{if(!r||typeof r!="object")return[];const i=r;if(typeof i.id!="string"||!i.id.trim())return[];const l=Array.isArray(i.cells)?i.cells:[];return[{id:i.id,name:typeof i.name=="string"&&i.name.trim()?i.name:i.id,purpose:i.purpose,columns:i.columns,updatedAt:i.updatedAt,tiles:l.map((m,d)=>({...m,id:`${i.id}-${d}`}))}]});return xs({activeWorkspaceId:t[0]?.id??"",workspaces:t},gs,{allowEmpty:!0})}function un(s,t,r){const i=s.find(l=>l.id===t);return i?i.capabilities.control.includes(r)||i.capabilities.harnessControl.includes(r):!1}function pn(s,t){return s.find(r=>r.id===t)??null}function hn(s){return[{value:"pty",label:"Shell",detail:"Disposable local shell",relayAttach:!0},...s.filter(t=>t.availability.installed&&t.capabilities.create).map(t=>({value:t.id,label:t.label,detail:t.description,relayAttach:t.capabilities.relayAttach})).sort((t,r)=>Number(r.relayAttach)-Number(t.relayAttach)||t.value.localeCompare(r.value))]}async function fn(){return me("/api/terminal-workspaces")}async function ws(s){return(await me(`/api/terminal-workspaces/${encodeURIComponent(s.id)}`,{method:"PUT",body:JSON.stringify(s)})).workspace}async function kn(s,t){return me(`/api/terminal-workspaces/${encodeURIComponent(s)}/cells/${encodeURIComponent(t)}/revive`,{method:"POST",body:"{}"})}async function bn(s){return(await me(`/api/terminal-workspaces/${encodeURIComponent(s)}`,{method:"DELETE"})).deleted}function xn(s){const t=new Map;for(const r of s?.cells??[])t.set(r.cellId,r);return t}const Ns="scout:terminal-send-line";function yn(s){const t=s.detail;if(!t||typeof t!="object"||!("line"in t))return null;const r=t.line;return typeof r=="string"&&r.trim().length>0?r:null}const le=typeof window>"u"?o.useEffect:o.useLayoutEffect,jn="openscout.terminal.picker-view.v1",Cs={mode:"grid",columns:"dynamic"},vs=[{mode:"solo",label:"Solo",detail:"One terminal, full width",minimumCells:1},{mode:"lanes",label:"Lanes",detail:"Side by side, one row",minimumCells:2},{mode:"grid",label:"Grid",detail:"Rows and columns",minimumCells:4}],gn=[{value:"shell",label:"Shell"},{value:"codex",label:"Codex"},{value:"claude",label:"Claude"},{value:"pi",label:"Pi"}],Ue="'JetBrainsMono Nerd Font', 'JetBrainsMonoNL Nerd Font', 'MesloLGS Nerd Font Mono', 'Hack Nerd Font Mono', 'JetBrains Mono', monospace",Ts=s=>{},Sn=()=>{};function wn(){if(typeof window>"u")return{fontFamily:Ue,fontSize:13};const s=new URLSearchParams(window.location.search),t=s.get("terminalFontFamily")?.trim(),r=Number(s.get("terminalFontSize"));return{fontFamily:t?`'${t.replaceAll("'","\\'")}', ${Ue}`:Ue,fontSize:Number.isFinite(r)&&r>=9&&r<=32?r:13}}function ns(s){const t=wn();return e.jsx(Pt,{...s,renderer:s.renderer??"dom",fontFamily:t.fontFamily,fontSize:t.fontSize})}function Nn(s,t){const[r,i]=o.useState({state:"loading",sessions:[]}),l=o.useCallback(()=>{i(d=>({state:"loading",sessions:d.sessions})),Ls({includeDiscovered:!0}).then(d=>{i({state:"ready",sessions:d})}).catch(d=>{i(f=>({state:"failed",sessions:f.sessions,error:d instanceof Error?d.message:String(d)}))})},[]);return o.useEffect(()=>{l()},[l]),{target:o.useMemo(()=>zs(r.sessions,s,t),[r.sessions,s,t]),loadState:r.state,loadSessions:l,hasSessionHint:!!s}}function Cn(s,t,r){const i=bt(t,r),[l,m]=o.useState(i?{state:"preparing"}:{state:"ready"}),[d,f]=o.useState(0);return o.useEffect(()=>{if(!i||!s){m({state:"ready"});return}let c=!1;return m({state:"preparing"}),me(`/api/agents/${encodeURIComponent(s)}/session-catalog`).then(x=>{if(x.resumeCommand)return _t({command:x.resumeCommand,cwd:x.resumeCwd,agentId:s})}).then(()=>{c||m({state:"ready"})}).catch(x=>{c||m({state:"failed",error:x instanceof Error?x.message:String(x)})}),()=>{c=!0}},[s,i,d]),{ready:l.state==="ready",label:l.state==="failed"?"TAKEOVER FAILED":"PREPARING TAKEOVER",status:l.state==="failed"?l.error:"Resolving live session...",onRetry:l.state==="failed"?()=>f(c=>c+1):void 0}}function vn(s){const{agentId:t,agent:r,mode:i,navigate:l,registeredTarget:m,showContextMenu:d}=s,{hosts:f}=Xe(),c=r?Ws(r.name):"var(--accent)",x=o.useRef(null),y=m?Ps(m.surface):Te(r),S=i==="observe",w=m?.session.cwd??r?.cwd??r?.projectRoot??void 0,A=Ve(),M=Ye(),h=xt({agentId:t,agent:r,registeredTarget:m,terminalSurface:y,relayUrl:A,harness:m?.session.harness??r?.harness,cwd:w,mode:i}),j=Ze({url:h.scopedRelayUrl,healthUrl:M,autoConnect:!0,...S?{}:{sessionKey:h.relayStorageSessionKey},...h.surfaceOptions??{},...h.orphanTTL?{orphanTTL:h.orphanTTL}:{},...h.cwd?{cwd:h.cwd}:{},...h.relayAgent?{agent:h.relayAgent}:{},controlMode:h.controlMode});le(()=>{j.resize(Ge,Je)},[j.resize]);const C=o.useMemo(()=>S?{...j,sendInput:Ts,sendLine:Ts,restart:Sn}:j,[S,j]),v=yt({agentId:t,registeredTarget:m}),z=Ie(v,i),R=o.useCallback(()=>{const b=x.current;b?.querySelector(".xterm-helper-textarea")?.focus(),b?.querySelector(".xterm")?.focus()},[]);o.useEffect(()=>{const b=_=>{const $=_.detail?.line;return typeof $=="string"&&$.length>0?$:null},O=_=>{const $=b(_);!$||S||(C.sendInput($),R())},D=_=>{const $=b(_);!$||S||(C.sendLine($),R())};return window.addEventListener("scout:terminal-send-input",O),window.addEventListener("scout:terminal-send-line",D),()=>{window.removeEventListener("scout:terminal-send-input",O),window.removeEventListener("scout:terminal-send-line",D)}},[R,S,C]);const E=o.useCallback(b=>y?jt(y,b):null,[y]),W=o.useCallback(()=>{bs(As(z))},[z]),H=o.useCallback(()=>{S||!navigator.clipboard?.readText||navigator.clipboard.readText().then(b=>{b&&C.sendInput(b)}).catch(()=>{})},[S,C]),B=o.useCallback(()=>{Ce(h.relayStorageSessionKey);const b=E("detach");if(b){b.finally(()=>j.disconnect());return}j.disconnect()},[h.relayStorageSessionKey,j,E]),k=o.useCallback(()=>{Ce(h.relayStorageSessionKey);const b=E("force-quit-bridge");if(b){b.finally(()=>{j.connect(),window.setTimeout(R,250)});return}j.connect(),window.setTimeout(R,250)},[h.relayStorageSessionKey,R,j,E]),N=o.useCallback(()=>{if(S)return;const b=E("interrupt");b?b.catch(()=>C.sendInput("")):C.sendInput(""),R()},[R,S,E,C]),L=o.useCallback(()=>{if(S)return;const b=E("quit");b?b.catch(()=>C.sendInput("")):C.sendInput(""),R()},[R,S,E,C]),K=o.useCallback(()=>{if(S)return;const b=E("stop-job");if(b){b.finally(R);return}R()},[R,S,E]),ne=o.useCallback(()=>{if(Ce(h.relayStorageSessionKey),y&&!window.confirm(`Force quit Claude in ${He(y.sessionName)}?`))return;const b=E("force-quit");if(b){b.finally(()=>j.disconnect());return}const O=j.sessionId;if(!O){j.disconnect();return}gt(O).catch(()=>{}).finally(()=>j.disconnect())},[h.relayStorageSessionKey,j,E,y]),re=o.useCallback(()=>{if(!y||!window.confirm(`Restart Claude in ${He(y.sessionName)} and resume its latest session?`))return;Ce(h.relayStorageSessionKey);const b=E("restart-resume");b&&b.finally(()=>{j.disconnect(),window.setTimeout(()=>{j.connect(),window.setTimeout(R,250)},600)})},[h.relayStorageSessionKey,R,j,E,y]),ae=o.useCallback(b=>{l(Ie(v,b))},[l,v]),Q=o.useCallback(()=>{l(v)},[l,v]),ee=o.useMemo(()=>{const b=y?.backend??null,O=$=>un(f,b,$),D=[];(!b||O("detach"))&&D.push({kind:"action",label:"Leave this session running",onSelect:B}),D.push({kind:"action",label:"Reconnect",onSelect:k});const _=[];return O("restart-resume")&&_.push({kind:"action",label:"Restart Claude and resume",onSelect:re}),O("force-quit")&&_.push({kind:"action",label:"Force quit Claude",onSelect:ne}),_.length>0&&D.push({kind:"separator"},..._),D},[B,ne,k,re,f,y?.backend]),he=o.useCallback(b=>{d(b,ee)},[ee,d]),se=o.useCallback(b=>{const O=typeof window>"u"?"":window.getSelection()?.toString()??"",D=[];O.trim()&&D.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>{bs(O)}}),S||D.push({kind:"action",label:"Paste",shortcut:"⌘V",onSelect:H},{kind:"action",label:"Send Ctrl-C",shortcut:"⌃C",onSelect:N},{kind:"action",label:"Quit With Ctrl-D",shortcut:"⌃D",onSelect:L},{kind:"action",label:"Stop Running Job",onSelect:K}),D.length>0&&D.push({kind:"separator"}),D.push({kind:"action",label:"Focus Terminal",onSelect:R},...ee,{kind:"separator"},{kind:"action",label:S?"Open Takeover":"Open Observe",onSelect:()=>ae(S?"takeover":"observe")},{kind:"action",label:"Open Summary",onSelect:Q},{kind:"action",label:"Copy Terminal Link",onSelect:W}),d(b,D)},[W,R,N,ae,Q,H,L,S,ee,d,K]);return{color:c,terminalBodyRef:x,terminalSurface:y,readOnly:S,relay:j,terminalRelay:C,healthUrl:M,scopedRelayUrl:h.scopedRelayUrl,hasViewActions:!!(m||y),canSignalTerminal:!S&&!!(y||j.status==="connected"),canStopTerminalJob:!S&&!!y,handleSessionMenu:he,handleTerminalContextMenu:se,openMode:ae,openSummary:Q,interruptTerminal:N,quitTerminal:L,stopTerminalJob:K,terminalRouteBase:v}}function Tn({agent:s,agentId:t,color:r,navigate:i,label:l,status:m,onRetry:d}){return e.jsxs("div",{className:"s-term",children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:i,className:"s-term-back"}),s&&e.jsxs("div",{className:"s-term-agent",children:[e.jsx("div",{className:"s-ops-avatar",style:{"--size":"18px",background:r},children:s.name[0]?.toUpperCase()}),e.jsx("span",{className:"s-term-agent-name",children:s.name}),s.handle&&e.jsxs("span",{className:"s-term-agent-handle",children:["@",s.handle]})]}),e.jsx("span",{className:"s-term-label",children:l}),e.jsx("div",{className:"s-term-status",children:d?"OFFLINE":"CONNECTING"})]}),e.jsx("div",{className:"s-term-body s-term-body--placeholder",children:e.jsxs("div",{className:"s-term-placeholder",children:[e.jsx("span",{children:m}),d&&e.jsx("button",{type:"button",onClick:d,children:"Retry"})]})})]})}function In({target:s,navigate:t}){const r=o.useMemo(()=>Ds([s.session]).find(d=>F(d.surface)===F(s.surface)),[s]),i={view:"terminal",terminalSessionId:s.session.id,terminalSurfaceKey:F(s.surface)},l=Nt(s.session,s.surface),m=Ct(s);return e.jsx("div",{className:"s-term s-term--summary",children:e.jsxs("div",{className:"s-term-summary",children:[e.jsxs("div",{className:"s-term-summary-main",children:[e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:t,className:"s-term-back"}),e.jsxs("div",{className:"s-term-summary-mark",children:[e.jsx(U,{size:18,strokeWidth:1.7}),e.jsx("span",{children:"Terminal"})]}),e.jsxs("div",{className:"s-term-summary-heading",children:[e.jsx("h1",{children:r?.title??s.surface.sessionName}),e.jsxs("p",{children:[s.surface.backend," · ",l]})]}),e.jsxs("div",{className:"s-term-summary-actions",children:[e.jsxs("button",{type:"button",className:"s-term-summary-action s-term-summary-action--primary",onClick:()=>t(Ie(i,"takeover")),children:[e.jsx(Qe,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Enter"})]}),e.jsxs("button",{type:"button",className:"s-term-summary-action",onClick:()=>t(Ie(i,"observe")),children:[e.jsx(Bt,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Observe"})]})]})]}),e.jsx("div",{className:"s-term-summary-preview",children:e.jsx(Ft,{surface:Ps(s.surface),lines:26,columns:112,pollMs:3e4,idlePollMs:3e4,className:"s-term-preview-peek"})}),e.jsx("dl",{className:"s-term-summary-details",children:m.map(([d,f])=>e.jsxs("div",{className:"s-term-summary-detail",children:[e.jsx("dt",{children:d}),e.jsx("dd",{title:f,children:f})]},d))})]})})}function rs({agentId:s,agent:t,mode:r,navigate:i,registeredTarget:l,embedded:m=!1,tileActions:d}){const f=Es(),c=vn({agentId:s,agent:t,mode:r,navigate:i,registeredTarget:l,showContextMenu:f});return e.jsxs("div",{className:`s-term${m?" s-term--embedded":""}`,children:[e.jsxs("div",{className:"s-term-bar s-term-bar--takeover",children:[e.jsxs("div",{className:"s-term-bar-left",children:[!m&&e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:i,className:"s-term-back"}),t&&e.jsxs("div",{className:"s-term-agent",children:[e.jsx("div",{className:"s-ops-avatar",style:{"--size":"18px",background:c.color},children:t.name[0]?.toUpperCase()}),e.jsx("span",{className:"s-term-agent-name",children:t.name}),t.handle&&e.jsxs("span",{className:"s-term-agent-handle",children:["@",t.handle]})]}),l&&e.jsxs("div",{className:"s-term-registered-chip",children:[e.jsx(U,{size:14,strokeWidth:1.8}),e.jsx("span",{children:l.session.harness}),e.jsx("span",{children:l.session.sourceSessionId})]})]}),e.jsxs("div",{className:"s-term-bar-meta",children:[e.jsx("span",{className:"s-term-label",children:c.terminalSurface?c.readOnly?"TERMINAL OBSERVE":"TERMINAL TAKEOVER":"TAKEOVER"}),c.terminalSurface&&e.jsx("span",{className:"s-term-session",title:c.terminalSurface.sessionName,children:He(c.terminalSurface.sessionName)})]}),e.jsxs("div",{className:"s-term-bar-actions",children:[c.hasViewActions&&e.jsxs("div",{className:"s-term-action-cluster s-term-action-cluster--view","aria-label":"Terminal view actions",children:[l&&e.jsx("button",{type:"button",className:"s-term-action",onClick:c.openSummary,title:"Leave the terminal canvas and show the session summary",children:"Summary"}),c.terminalSurface&&e.jsx("button",{type:"button",className:"s-term-action",onClick:()=>c.openMode(c.readOnly?"takeover":"observe"),title:c.readOnly?"Switch to interactive takeover":"Switch to read-only terminal observe",children:c.readOnly?"Takeover":"Observe"})]}),(c.canSignalTerminal||c.canStopTerminalJob)&&e.jsxs("div",{className:"s-term-action-cluster s-term-action-cluster--signals","aria-label":"Terminal signal actions",children:[c.canSignalTerminal&&e.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:c.interruptTerminal,title:"Send Ctrl-C to the terminal",children:[e.jsx(Kt,{size:13,strokeWidth:1.8}),e.jsx("span",{children:"Ctrl-C"})]}),c.canSignalTerminal&&e.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:c.quitTerminal,title:"Send Ctrl-D / EOF to the terminal",children:[e.jsx(Dt,{size:13,strokeWidth:1.8}),e.jsx("span",{children:"Quit"})]}),c.canStopTerminalJob&&e.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:c.stopTerminalJob,title:"Stop Claude's current shell/tool job without quitting Claude",children:[e.jsx(Ut,{size:12,strokeWidth:2}),e.jsx("span",{children:"Stop Job"})]})]}),e.jsxs("button",{type:"button",className:"s-term-action s-term-session-menu",onClick:c.handleSessionMenu,title:"Open session, recovery, and external handoff actions",children:[e.jsx(Yt,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Session"})]}),e.jsx("div",{className:"s-term-status",children:c.relay.status==="connected"?"LIVE":c.relay.status==="connecting"?"CONNECTING":"OFFLINE"}),d]})]}),e.jsx("div",{ref:c.terminalBodyRef,className:"s-term-body",onContextMenuCapture:c.handleTerminalContextMenu,children:e.jsx(ns,{relay:c.terminalRelay,readOnly:c.readOnly,quiet:!0,configItems:[...c.terminalSurface?[{label:"backend",value:c.terminalSurface.backend},{label:"session",value:c.terminalSurface.sessionName},...c.terminalSurface.paneId?[{label:"pane",value:c.terminalSurface.paneId}]:[],...c.terminalSurface.socketDir?[{label:"socket",value:c.terminalSurface.socketDir}]:[],{label:"mode",value:c.readOnly?"read-only":"takeover"}]:[],{label:"ws",value:c.scopedRelayUrl},{label:"health",value:c.healthUrl}]})})]})}function Rn({terminalSessionId:s,terminalSurfaceKey:t,mode:r,navigate:i}){const{target:l,loadState:m,loadSessions:d,hasSessionHint:f}=Nn(s,t);return l&&r?e.jsx(rs,{agent:null,mode:r,navigate:i,registeredTarget:l},`${F(l.surface)}:${r}`):l?e.jsx(In,{target:l,navigate:i}):e.jsx("div",{className:"s-term s-term--empty-main",children:e.jsxs("div",{className:"s-term-empty-main-mark",children:[e.jsx(U,{size:18,strokeWidth:1.6}),e.jsx("span",{children:m==="loading"?"Loading terminal":m==="failed"?"Terminal list unavailable":f?"Terminal unavailable":"Select a terminal"}),m==="failed"&&e.jsx("button",{type:"button",className:"s-term-empty-action",onClick:d,children:"Retry"})]})})}function En(s,t){return s.kind!=="fresh"||!s.sessionName?!1:t.some(r=>r.surfaces.some(i=>i.backend===s.backend&&i.sessionName===s.sessionName&&i.state!=="exited"))}function ce(s){return`${s.session.id}:${F(s.surface)}`}function Wn(s,t,r){if(s.kind==="fresh")return{id:s.id,kind:"fresh",backend:s.backend,agent:s.agent,...s.backend==="pty"?{}:{sessionName:Bs(s.backend,s.id,r)}};const i=zs(t,s.terminalSessionId,s.terminalSurfaceKey);return i?{id:s.id,kind:"registered",target:i}:{id:s.id,kind:"unavailable",terminalSessionId:s.terminalSessionId,terminalSurfaceKey:s.terminalSurfaceKey}}function G(s){return{session:s.session,surface:s.surface}}function An(s){const t=s.backend;return t!=="pty"&&!Os(t)?null:{view:"terminal",terminalBackend:t,terminalAgent:s.agent,terminalTabId:s.id,...s.sessionName?{terminalSessionName:s.sessionName}:{},...s.zellijSocketDir?{zellijSocketDir:s.zellijSocketDir}:{}}}function Mn(s,t="takeover"){return{view:"terminal",terminalSessionId:s.session.id,terminalSurfaceKey:F(s.surface),mode:t}}function Hs(s,t){if(typeof window>"u"){t(s);return}window.open(As(s),"_blank","noopener,noreferrer")}function Ln({navigate:s}){const{agents:t}=Rs(),r=Es(),{hosts:i}=Xe(),l=o.useMemo(()=>hn(i),[i]),[m,d]=$e(nn,ts(),{version:rn,migrate:mn}),[f,c]=$e(an,"library"),x=o.useRef(new Map),[y,S]=o.useState(null),[w,A]=o.useState(""),[M,h]=o.useState(""),[j,C]=o.useState(Cs),[v,z]=o.useState(()=>Array.from({length:4},()=>oe("pty"))),[R,E]=o.useState(0),[W,H]=o.useState({state:"loading",sessions:[]}),[B,k]=o.useState(0),[N,L]=o.useState(!0),[K,ne]=$e(jn,"list"),[re,ae]=o.useState(Mt),[Q,ee]=o.useState([]),[he,se]=o.useState(null),[b,O]=o.useState(null),[D,_]=o.useState(null),[$,is]=o.useState(!1),[fe,os]=o.useState(null),[Vs,Ae]=o.useState(null),ke=o.useRef(null),be=o.useRef(null),xe=o.useRef("after"),ye=o.useRef(null),je=o.useRef(null),Me=o.useRef(!1),q=o.useCallback((n={})=>{n.silent||H(a=>({state:"loading",sessions:a.sessions})),Ls({includeDiscovered:!0}).then(a=>H({state:"ready",sessions:a})).catch(a=>{n.silent||H(u=>({state:"failed",sessions:u.sessions,error:a instanceof Error?a.message:String(a)}))})},[]);o.useEffect(()=>{q()},[q]),o.useEffect(()=>{const n=()=>{document.visibilityState==="visible"&&q({silent:!0})},a=window.setInterval(n,8e3);return window.addEventListener("focus",n),document.addEventListener("visibilitychange",n),()=>{window.clearInterval(a),window.removeEventListener("focus",n),document.removeEventListener("visibilitychange",n)}},[q]),o.useEffect(()=>{let n=!1;return fn().then(a=>{if(!n){ee(a.resolutions);for(const u of a.workspaces)x.current.set(u.id,JSON.stringify(Ke(Ss(u),{sessions:W.sessions})));a.workspaces.length!==0&&d(u=>{let p=u;for(const g of a.workspaces)p=ys(p,Ss(g));return{...p,activeWorkspaceId:u.activeWorkspaceId||p.activeWorkspaceId}})}}).catch(()=>{}),()=>{n=!0}},[d]);const ge=o.useMemo(()=>Ds(W.sessions),[W.sessions]),V=o.useMemo(()=>ge.filter(n=>n.surface.state!=="exited"),[ge]),Le=o.useMemo(()=>{const n=new Set,a=[];for(const u of ge)u.surface.backend!=="herdr"||n.has(u.surface.sessionName)||(n.add(u.surface.sessionName),a.push(G(u)));return a},[ge]);o.useMemo(()=>Kn(t),[t]);const ls=W.state==="failed"?W.error:null,Ys=m.workspaces,T=m.workspaces.find(n=>n.id===m.activeWorkspaceId)??null,te=Re({layout:T?.layout,columns:T?.columns,cellCount:T?.tiles.length??0}),Y=o.useMemo(()=>(T?.tiles??[]).map(n=>Wn(n,W.sessions,T?.id??"")),[T?.id,T?.tiles,W.sessions]),De=Ee(te,{tileCount:Y.length});o.useEffect(()=>{if(!T||!x.current.has(T.id))return;const n=Ke(T,{sessions:W.sessions}),a=JSON.stringify(n);x.current.get(T.id)!==a&&(x.current.set(T.id,a),ws(n).catch(u=>se(u instanceof Error?u.message:String(u))))},[T,W.sessions]);const cs=f==="workspace"&&!T?"library":f,P=o.useCallback(n=>{d(a=>{const u=a.workspaces.find(g=>g.id===a.activeWorkspaceId);if(!u)return a;const p=n(u.tiles);return p===u.tiles?a:js(a,u.id,{tiles:p,updatedAt:Date.now()})})},[d]),Se=o.useCallback(n=>{d(a=>a.activeWorkspaceId?js(a,a.activeWorkspaceId,{layout:n,updatedAt:Date.now()}):a)},[d]),Gs=o.useCallback(n=>{d(a=>Qt(a,n.id)),L(!1),c("workspace")},[d,c]),Js=o.useCallback(()=>{c("library")},[c]),ie=o.useCallback(n=>{S(n?.id??null),A(n?.name??""),h(n?.purpose??""),C(n?Re({layout:n.layout,columns:n.columns,cellCount:n.tiles.length}):Cs),z(n?.tiles??Array.from({length:4},()=>oe("pty"))),E(0),c("builder")},[c]),Xs=o.useCallback(n=>{C(a=>n.mode==="solo"?{mode:"solo"}:{mode:n.mode,columns:a.columns??"dynamic"}),z(a=>a.length>=n.minimumCells?a:[...a,...Array.from({length:n.minimumCells-a.length},()=>oe("pty"))]),E(a=>Math.max(0,Math.min(a,n.minimumCells-1)))},[]),Zs=o.useCallback(n=>{C(a=>a.mode==="solo"?{mode:"lanes",columns:n}:{...a,columns:n})},[]),Qs=o.useCallback(()=>{z(n=>{const a=[...n,oe("pty")];return E(a.length-1),a})},[]),et=o.useCallback(n=>{z(a=>{if(a.length<=1)return a;const u=a.filter((p,g)=>g!==n);return E(p=>Math.min(p,u.length-1)),u})},[]),st=o.useCallback(()=>{const n=w.trim();if(!n)return;const a={id:y??ve("workspace"),name:n,purpose:M.trim(),columns:Ee(j,{tileCount:v.length}),layout:j,tiles:v,updatedAt:Date.now()};d(p=>ys(p,a));const u=Ke(a,{sessions:W.sessions});x.current.set(a.id,JSON.stringify(u)),ws(u).catch(p=>se(p instanceof Error?p.message:String(p))),L(!1),c("workspace")},[y,d,c,W.sessions,v,j,w,M]),tt=o.useCallback(n=>{d(a=>en(a,n,{allowEmpty:!0})),bn(n).catch(()=>{})},[d]),ds=o.useCallback((n,a="shell")=>{P(u=>[...u,oe(n,a)])},[P]),J=o.useCallback((n,a)=>{const u={kind:"registered",terminalSessionId:n.session.id,terminalSurfaceKey:F(n.surface)};P(p=>{const g=p.some(I=>I.kind==="registered"&&I.terminalSessionId===u.terminalSessionId&&Be(I.terminalSurfaceKey,u.terminalSurfaceKey));return a?p.some(I=>I.id===a)?p.map(I=>I.id===a?{...u,id:I.id}:I):p:g?p:[...p,{...u,id:ve("cell")}]})},[P]),nt=o.useCallback(n=>{J(n)},[J]),ze=o.useMemo(()=>new Set(Y.filter(n=>n.kind==="registered").map(n=>ce(n.target))),[Y]),rt=o.useCallback(n=>{const a=Le.length>0?Le.map(u=>{const p=ze.has(ce(u)),g=u.surface.state==="live"?"running":"detached";return{kind:"action",label:`${u.surface.sessionName} · ${g}${p?" · in grid":""}`,onSelect:()=>J(u)}}):[{kind:"action",label:"No herdr sessions discovered",onSelect:()=>{}}];r(n,a)},[Le,ze,J,r]),we=o.useCallback(n=>{n?.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId),ye.current=null,je.current=null,Me.current=!1,O(null),_(null),is(!1)},[]),at=o.useCallback((n,a)=>{const u=n.target;n.button!==0||u instanceof Element&&u.closest("button, a")||(ye.current={pointerId:n.pointerId,target:G(a),targetId:ce(G(a)),startX:n.clientX,startY:n.clientY},n.currentTarget.setPointerCapture(n.pointerId))},[]),it=o.useCallback(n=>{const a=ye.current;if(!a||a.pointerId!==n.pointerId||Math.hypot(n.clientX-a.startX,n.clientY-a.startY)<6&&!b)return;b||O(a.targetId);const p=document.querySelector(".s-term--workspace");if(p){const ks=p.getBoundingClientRect();n.clientY<ks.top+72&&(p.scrollTop-=28),n.clientY>ks.bottom-72&&(p.scrollTop+=28)}const g=document.elementFromPoint(n.clientX,n.clientY),I=g?.closest(".s-term-workspace-cell"),X=!!(g?.closest(".s-term-workspace-add-cell")||!I&&g?.closest(".s-term--workspace")&&!g?.closest(".s-term-picker")),fs=X?null:I?.dataset.terminalTileId??null;je.current=fs,Me.current=X,_(fs),is(X)},[b]),ot=o.useCallback(n=>{const a=ye.current;!a||a.pointerId!==n.pointerId||(Me.current?J(a.target):je.current&&J(a.target,je.current),we(n))},[we,J]),lt=o.useCallback(n=>{we(n)},[we]),ct=o.useCallback(()=>{const n=V.map(G);n.length!==0&&P(a=>{const u=a.filter(g=>g.kind==="registered"),p=n.filter(g=>!u.some(I=>I.kind==="registered"&&I.terminalSessionId===g.session.id&&Be(I.terminalSurfaceKey,F(g.surface)))).map(g=>({id:ve("cell"),kind:"registered",terminalSessionId:g.session.id,terminalSurfaceKey:F(g.surface)}));return p.length===0?a:[...a,...p]})},[V,P]),Oe=o.useCallback(n=>{P(a=>{const u=a.filter(p=>p.id!==n);return u.length===a.length?a:u})},[P]),ms=o.useCallback((n,a,u)=>{n!==a&&P(p=>tn(p,n,a,u))},[P]),Pe=o.useCallback((n,a)=>{P(u=>{const p=u.findIndex(X=>X.id===n),g=p+a;if(p<0||g<0||g>=u.length)return u;const I=[...u];return[I[p],I[g]]=[I[g],I[p]],I})},[P]),us=o.useCallback((n,a)=>{P(u=>u.map(p=>p.id===n?{id:p.id,kind:"fresh",backend:a,agent:"shell"}:p))},[P]),Ne=o.useCallback(()=>[...vs.map(n=>({kind:"action",label:n.label,onSelect:()=>Se(n.mode==="solo"?{mode:"solo"}:{mode:n.mode,columns:te.columns??"dynamic"})})),...te.mode==="solo"?[]:[{kind:"separator"},{kind:"action",label:"Dynamic columns",onSelect:()=>Se({...te,columns:"dynamic"})},...Array.from({length:ss},(n,a)=>({kind:"action",label:a===0?"One column":`${a+1} columns`,onSelect:()=>Se({...te,columns:a+1})}))],{kind:"separator"},{kind:"action",label:"Edit workspace…",onSelect:()=>T&&ie(T)}],[T,Se,ie,te]),dt=o.useCallback(n=>{r(n,Ne())},[Ne,r]),mt=o.useCallback((n,a)=>{const u=Y.findIndex(g=>g.id===a.id),p=[];u>0&&p.push({kind:"action",label:"Move left",onSelect:()=>Pe(a.id,-1)}),u>=0&&u<Y.length-1&&p.push({kind:"action",label:"Move right",onSelect:()=>Pe(a.id,1)}),p.length>0&&p.push({kind:"separator"}),p.push(...l.map(g=>({kind:"action",label:g.value==="pty"?"Replace with a disposable shell":`Replace with a session that survives (${g.label})`,onSelect:()=>us(a.id,g.value)})),{kind:"separator"},{kind:"action",label:"Remove cell",onSelect:()=>Oe(a.id)},{kind:"separator"},...Ne()),r(n,p)},[Oe,Ne,Pe,us,r,l,Y]),ut=o.useCallback((n,a)=>{const u=n.target;n.button===0&&u instanceof Element&&u.closest(".s-term-bar")&&!u.closest("button, a")&&(ke.current={pointerId:n.pointerId,tileId:a,startX:n.clientX,startY:n.clientY},n.currentTarget.setPointerCapture(n.pointerId))},[]),pt=o.useCallback(n=>{const a=ke.current;if(!a||a.pointerId!==n.pointerId||Math.hypot(n.clientX-a.startX,n.clientY-a.startY)<6&&!fe)return;fe||os(a.tileId);const p=document.elementFromPoint(n.clientX,n.clientY)?.closest(".s-term-workspace-cell"),g=p?.dataset.terminalTileId??null;if(!p||!g||g===a.tileId){be.current=null,xe.current="after",Ae(null);return}const I=p.getBoundingClientRect(),X=sn({x:n.clientX,y:n.clientY},{left:I.left,top:I.top,width:I.width,height:I.height},De);be.current=g,xe.current=X.edge,Ae(g)},[fe,De]),ps=o.useCallback(n=>{const a=ke.current;if(!a||a.pointerId!==n.pointerId)return;const u=be.current;u&&ms(a.tileId,u,xe.current),n.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId),ke.current=null,be.current=null,xe.current="after",os(null),Ae(null)},[ms]),ht=o.useMemo(()=>xn(Q.find(n=>n.workspaceId===T?.id)),[T?.id,Q]),hs=o.useCallback(n=>{ae(a=>Lt(a,n))},[]),ft=o.useCallback(()=>{q(),k(n=>n+1)},[q]),kt=o.useCallback(n=>{T&&kn(T.id,n).then(()=>{se(null),q()}).catch(a=>se(a instanceof Error?a.message:String(a)))},[T,q]);return cs==="library"?e.jsx(Dn,{workspaces:Ys,sessionsReady:W.state!=="loading",onOpen:Gs,onCreate:()=>ie(),onEdit:ie,onDelete:tt}):cs==="builder"?e.jsx(On,{editing:!!y,name:w,purpose:M,modes:vs,layout:j,startOptions:l,cells:v,selectedSlot:R,terminalItems:V,onNameChange:A,onPurposeChange:h,onApplyMode:Xs,onColumnsChange:Zs,onSelectSlot:E,onAddCell:Qs,onRemoveCell:et,pickerView:K,pickerSort:re,onPickerView:ne,onPickerSort:hs,onAssignFresh:(n,a="shell")=>z(u=>u.map((p,g)=>g===R?{id:p.id,kind:"fresh",backend:n,agent:a}:p)),onAssignRegistered:n=>z(a=>a.map((u,p)=>p===R?{id:u.id,kind:"registered",terminalSessionId:n.session.id,terminalSurfaceKey:F(n.surface)}:u)),onCancel:()=>{c(T?"workspace":"library")},onSave:st}):e.jsx("div",{className:"s-term s-term--workspace",children:e.jsxs("div",{className:"s-term-workspace",children:[e.jsxs("header",{className:"s-term-workspace-head",children:[e.jsxs("div",{className:"s-term-workspace-title",children:[e.jsxs("span",{className:"s-term-summary-mark",children:[e.jsx(de,{size:18,strokeWidth:1.7}),e.jsxs("span",{children:["Workspaces / ",T?.name??"Workspace"]})]}),e.jsx("h1",{children:T?.name??"Workspace"}),T?.purpose&&e.jsx("p",{children:T.purpose})]}),e.jsxs("div",{className:"s-term-workspace-actions","aria-label":"Terminal workspace actions",children:[e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:Js,children:e.jsx("span",{children:"All workspaces"})}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>T&&ie(T),children:[e.jsx(de,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Edit workspace"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:()=>ds("pty"),title:"Add a shell tile",children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Shell"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>ds("pty","codex"),title:"Add a Codex TUI tile",children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Codex"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:rt,title:"Add a herdr session's layout as a tile",children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Herdr"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:()=>L(n=>!n),title:N?"Hide terminal picker":"Show terminal picker","aria-pressed":N,children:[e.jsx(U,{size:14,strokeWidth:1.8}),e.jsx("span",{children:N?"Hide picker":"Show picker"})]}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:ft,disabled:W.state==="loading",title:"Reload all terminal tiles","aria-label":"Reload all terminal tiles",children:e.jsx(es,{size:14,strokeWidth:1.8})})]})]}),ls&&e.jsxs("div",{className:"s-term-home-error",children:[e.jsx("span",{children:"Terminal registry unavailable"}),e.jsx("code",{children:ls})]}),he&&e.jsxs("div",{className:"s-term-home-error",children:[e.jsx("span",{children:"This workspace is not saved to Scout — it will not follow you to another device"}),e.jsx("code",{children:he})]}),(Y.length>0||N)&&e.jsxs("div",{className:"s-term-workspace-grid","aria-label":"Terminal tiles",style:{"--terminal-grid-columns":De},onContextMenu:dt,children:[Y.map(n=>e.jsx("div",{className:`s-term-workspace-cell${fe===n.id?" s-term-workspace-cell--dragging":""}${Vs===n.id||D===n.id?" s-term-workspace-cell--drop-target":""}`,"data-terminal-tile-id":n.id,onPointerDownCapture:a=>ut(a,n.id),onPointerMove:pt,onPointerUp:ps,onPointerCancel:ps,onContextMenu:a=>mt(a,n),children:e.jsx(_n,{tile:n,navigate:s,onClose:Oe,resolution:ht.get(n.id)??null,onRevive:kt,live:En(n,W.sessions)})},`${n.id}:${B}`)),N&&e.jsxs("button",{type:"button",className:`s-term-workspace-add-cell${$?" s-term-workspace-add-cell--target":""}`,onClick:()=>L(!0),children:[e.jsx(Z,{size:20,strokeWidth:1.7}),e.jsx("strong",{children:"New slot"}),e.jsx("span",{children:b?"Drop to add":"Drag a terminal here"})]})]}),e.jsxs("section",{className:`s-term-picker${N?"":" s-term-picker--collapsed"}`,"aria-labelledby":"terminal-picker-title",onPointerDownCapture:n=>{const a=n.target;if(!(a instanceof Element))return;const u=a.closest("[data-picker-item-id]")?.dataset.pickerItemId,p=V.find(g=>g.id===u);p&&at(n,p)},onPointerMove:it,onPointerUp:ot,onPointerCancel:lt,children:[e.jsxs("header",{className:"s-term-picker-head",children:[e.jsxs("div",{className:"s-term-picker-title",children:[e.jsx(U,{size:14,strokeWidth:1.8}),e.jsx("h2",{id:"terminal-picker-title",children:"Terminal picker"}),e.jsx("span",{children:W.state==="loading"?"syncing":V.length})]}),e.jsxs("div",{className:"s-term-picker-actions",children:[N&&e.jsx("div",{className:"s-term-picker-views",role:"group","aria-label":"Picker view",children:["list","table"].map(n=>e.jsx("button",{type:"button",className:K===n?"is-selected":"",onClick:()=>ne(n),"aria-pressed":K===n,children:n==="list"?"List":"Table"},n))}),N&&e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:ct,disabled:V.length===0,children:[e.jsx(Qe,{size:13,strokeWidth:1.8}),e.jsx("span",{children:"Attach all"})]}),e.jsxs("button",{type:"button",className:"s-term-picker-toggle",onClick:()=>L(n=>!n),"aria-expanded":N,children:[e.jsx("span",{children:N?"Hide":"Show terminal picker"}),e.jsx("span",{"aria-hidden":"true",children:N?"⌄":"⌃"})]})]})]}),N&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"s-term-picker-hint",children:"Drag a terminal onto a cell to place it, or onto New slot to grow the grid."}),V.length===0&&W.state!=="loading"?e.jsx("div",{className:"s-term-picker-empty",children:"No live terminals"}):e.jsx(qs,{items:V,view:K,sort:re,attachedIds:ze,draggedTargetId:b,onSort:hs,onAttach:nt,navigate:s})]})]})]})})}function Dn({workspaces:s,sessionsReady:t,onOpen:r,onCreate:i,onEdit:l,onDelete:m}){return e.jsx("div",{className:"s-term s-term--workspace-library",children:e.jsxs("main",{className:"s-term-workspace-library",children:[e.jsxs("header",{className:"s-term-workspace-library-head",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"s-term-summary-mark",children:[e.jsx(de,{size:18,strokeWidth:1.7}),e.jsx("span",{children:"Terminals"})]}),e.jsx("h1",{children:"Workspaces"}),e.jsx("p",{children:"Saved terminal layouts for projects, roles, and cross-project operations."})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:i,children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"New workspace"})]})]}),s.length===0?e.jsxs("section",{className:"s-term-workspace-library-empty",children:[e.jsx(de,{size:24,strokeWidth:1.5}),e.jsx("h2",{children:"Create your first terminal workspace"}),e.jsx("p",{children:"Choose a layout, give it a purpose, place sessions, then enter the grid."}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:i,children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Create workspace"})]})]}):e.jsx("div",{className:"s-term-workspace-library-grid",children:s.map(d=>e.jsxs("article",{className:"s-term-workspace-card",children:[e.jsx("div",{className:"s-term-workspace-card-preview",style:{"--terminal-grid-columns":d.columns??Fe},children:d.tiles.map(f=>e.jsx("span",{className:f.kind==="registered"?"is-session":"is-shell"},f.id))}),e.jsxs("div",{className:"s-term-workspace-card-copy",children:[e.jsxs("span",{children:[d.columns??Fe," column",(d.columns??Fe)===1?"":"s"," · ",d.tiles.length," cells"]}),e.jsx("h2",{children:d.name}),e.jsx("p",{children:d.purpose||"No purpose added yet."})]}),e.jsxs("div",{className:"s-term-workspace-card-actions",children:[e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:()=>l(d),children:"Edit"}),e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:()=>m(d.id),children:"Delete"}),e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>r(d),disabled:!t,children:"Enter workspace"})]})]},d.id))})]})})}function qe(s,t){return s==="solo"?1:s==="lanes"?Math.max(2,Math.min(4,t)):Math.max(2,Math.min(3,t))}function zn(s,t){return s==="solo"?1:s==="lanes"?qe(s,t):qe(s,t)*2}function On({editing:s,name:t,purpose:r,modes:i,layout:l,startOptions:m,cells:d,selectedSlot:f,terminalItems:c,onNameChange:x,onPurposeChange:y,onApplyMode:S,onColumnsChange:w,onSelectSlot:A,onAddCell:M,onRemoveCell:h,pickerView:j,pickerSort:C,onPickerView:v,onPickerSort:z,onAssignFresh:R,onAssignRegistered:E,onCancel:W,onSave:H}){const B=Ee(l,{tileCount:d.length});return e.jsx("div",{className:"s-term s-term--workspace-builder",children:e.jsxs("main",{className:"s-term-workspace-builder",children:[e.jsxs("header",{className:"s-term-workspace-builder-head",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"s-term-summary-mark",children:[e.jsx(de,{size:18,strokeWidth:1.7}),e.jsx("span",{children:"Workspace builder"})]}),e.jsx("h1",{children:s?"Edit workspace":"Create a workspace"}),e.jsx("p",{children:"Define the job, choose the grid, and place the sessions before entering."})]}),e.jsxs("div",{className:"s-term-workspace-builder-actions",children:[e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:W,children:"Cancel"}),e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:H,disabled:!t.trim(),children:s?"Save and enter":"Create and enter"})]})]}),e.jsxs("section",{className:"s-term-workspace-builder-identity","aria-label":"Workspace identity",children:[e.jsxs("label",{children:[e.jsx("span",{children:"Name"}),e.jsx("input",{value:t,onChange:k=>x(k.target.value),placeholder:"Release desk",autoFocus:!0})]}),e.jsxs("label",{children:[e.jsx("span",{children:"Purpose"}),e.jsx("input",{value:r,onChange:k=>y(k.target.value),placeholder:"Cross-project release monitoring"})]})]}),e.jsxs("section",{className:"s-term-workspace-builder-layout","aria-labelledby":"workspace-layout-title",children:[e.jsxs("div",{className:"s-term-workspace-builder-section-head",children:[e.jsxs("div",{children:[e.jsx("span",{children:"Step 1"}),e.jsx("h2",{id:"workspace-layout-title",children:"Choose the layout"})]}),e.jsxs("p",{children:[qt(l)," · ",d.length," cell",d.length===1?"":"s"]})]}),e.jsx("div",{className:"s-term-grid-presets","aria-label":"Workspace layout",children:i.map(k=>e.jsxs("button",{type:"button",className:`s-term-grid-preset${k.mode===l.mode?" s-term-grid-preset--selected":""}`,onClick:()=>S(k),"aria-pressed":k.mode===l.mode,children:[e.jsx("span",{className:"s-term-grid-preset-map",style:{"--terminal-preset-columns":qe(k.mode,B)},"aria-hidden":"true",children:Array.from({length:zn(k.mode,B)},(N,L)=>e.jsx("i",{},L))}),e.jsx("span",{className:"s-term-grid-preset-label",children:k.label}),e.jsx("span",{className:"s-term-grid-preset-detail",children:k.detail})]},k.mode))}),l.mode!=="solo"&&e.jsxs("div",{className:"s-term-workspace-builder-columns",role:"group","aria-label":"Columns",children:[e.jsx("span",{children:"Columns"}),e.jsx("button",{type:"button",className:l.columns==="dynamic"||l.columns===void 0?"is-selected":"",onClick:()=>w("dynamic"),"aria-pressed":l.columns==="dynamic"||l.columns===void 0,title:"Fit the columns to the number of tiles",children:"Dynamic"}),Array.from({length:ss},(k,N)=>e.jsx("button",{type:"button",className:l.columns===N+1?"is-selected":"",onClick:()=>w(N+1),"aria-pressed":l.columns===N+1,children:N+1},N)),(l.columns==="dynamic"||l.columns===void 0)&&e.jsxs("em",{children:[B," right now"]})]})]}),e.jsxs("section",{className:"s-term-workspace-builder-placement","aria-labelledby":"workspace-placement-title",children:[e.jsxs("div",{className:"s-term-workspace-builder-section-head",children:[e.jsxs("div",{children:[e.jsx("span",{children:"Step 2"}),e.jsx("h2",{id:"workspace-placement-title",children:"Place terminals"})]}),e.jsx("p",{children:"Select a cell, then choose a session or shell. Add as many cells as the work needs."})]}),e.jsxs("div",{className:"s-term-workspace-builder-canvas",children:[e.jsxs("div",{className:"s-term-workspace-builder-grid",style:{"--terminal-grid-columns":B},children:[d.map((k,N)=>{const L=k.kind==="registered"?c.find(K=>K.session.id===k.terminalSessionId&&Be(F(K.surface),k.terminalSurfaceKey)):null;return e.jsxs("div",{className:`s-term-workspace-builder-cell${f===N?" is-selected":""}`,children:[e.jsxs("button",{type:"button",className:"s-term-workspace-builder-cell-select",onClick:()=>A(N),"aria-pressed":f===N,children:[e.jsx("span",{children:String(N+1).padStart(2,"0")}),e.jsx(U,{size:17,strokeWidth:1.7}),e.jsx("strong",{children:k.kind==="registered"?L?.title??"Unavailable session":as(k.backend,k.agent).title}),e.jsx("small",{children:k.kind==="registered"?L?.cwdLabel||L?.detail:k.backend})]}),d.length>1&&e.jsx("button",{type:"button",className:"s-term-workspace-builder-cell-remove",onClick:()=>h(N),title:"Remove this cell","aria-label":`Remove cell ${N+1}`,children:e.jsx(pe,{size:13,strokeWidth:1.9})})]},k.id)}),e.jsxs("button",{type:"button",className:"s-term-workspace-builder-cell s-term-workspace-builder-cell--add",onClick:M,children:[e.jsx(Z,{size:18,strokeWidth:1.7}),e.jsx("strong",{children:"Add cell"})]})]}),e.jsxs("aside",{className:"s-term-workspace-builder-source",children:[e.jsxs("span",{children:["Cell ",String(f+1).padStart(2,"0")]}),e.jsx("h3",{children:"Start something new"}),e.jsxs("div",{className:"s-term-workspace-builder-source-actions",children:[gn.map(k=>e.jsx("button",{type:"button",onClick:()=>R("pty",k.value),children:k.label},k.value)),m.filter(k=>k.value!=="pty").map(k=>e.jsxs("button",{type:"button",onClick:()=>R(k.value,"shell"),title:k.relayAttach?k.detail:`${k.detail} — Scout starts it; open it in ${k.label} to use it`,children:[k.label,!k.relayAttach&&e.jsx("sup",{"aria-label":"opens outside Scout",children:" ↗"})]},k.value))]}),e.jsxs("div",{className:"s-term-workspace-builder-source-head",children:[e.jsx("h3",{children:"Or use a live session"}),e.jsx("div",{className:"s-term-picker-views",role:"group","aria-label":"Session picker view",children:["list","table"].map(k=>e.jsx("button",{type:"button",className:j===k?"is-selected":"",onClick:()=>v(k),"aria-pressed":j===k,children:k==="list"?"List":"Table"},k))})]}),e.jsx("div",{className:"s-term-workspace-builder-sessions",children:c.length===0?e.jsx("span",{className:"s-term-workspace-builder-no-sessions",children:"No live sessions"}):e.jsx(qs,{items:c,view:j,sort:C,attachedIds:new Set,draggedTargetId:null,onSort:z,onAttach:k=>{const N=c.find(L=>L.session.id===k.session.id&&L.surface.sessionName===k.surface.sessionName);N&&E(N)}})})]})]})]})]})})}function Pn({item:s,attached:t,dragging:r,onAttach:i,onOpen:l}){return e.jsxs("article",{className:`s-term-picker-item${t?" s-term-picker-item--attached":""}${r?" s-term-picker-item--dragging":""}`,"data-picker-item-id":s.id,children:[e.jsx("span",{className:"s-term-picker-grip","aria-hidden":"true",children:"⠿"}),e.jsxs("div",{className:"s-term-picker-item-main",children:[e.jsx("strong",{title:s.surface.sessionName,children:s.title}),e.jsx("span",{title:s.session.cwd??s.detail,children:s.cwdLabel||s.detail})]}),e.jsxs("div",{className:"s-term-picker-item-meta",children:[e.jsx("span",{children:s.surface.backend}),e.jsx("span",{children:_s(s)}),e.jsx("span",{title:s.session.cwd??void 0,children:s.project})]}),l&&e.jsx("button",{type:"button",className:"s-term-picker-add",onClick:l,children:"Open"}),e.jsx("button",{type:"button",className:"s-term-picker-add",onClick:()=>i(G(s)),disabled:t,children:t?"In grid":"Add"})]})}function qs({items:s,view:t,sort:r,attachedIds:i,draggedTargetId:l,onSort:m,onAttach:d,navigate:f}){const c=o.useMemo(()=>_e(s,r),[s,r]),{managed:x,regular:y}=o.useMemo(()=>wt(s),[s]),S=o.useMemo(()=>_e(x,r),[x,r]),w=o.useMemo(()=>_e(y,r),[y,r]),A=h=>{f?.({view:"terminal",terminalSessionId:h.session.id,terminalSurfaceKey:F(h.surface)})},M=(h,j)=>{const C=ce(G(h));return e.jsx(Pn,{item:h,attached:i.has(C),dragging:l===C,onAttach:d,onOpen:j&&f?()=>A(h):void 0},h.id)};return t==="table"?e.jsx("div",{className:"s-term-picker-table-wrap",children:e.jsxs("table",{className:"s-term-picker-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[zt.map(h=>e.jsx("th",{scope:"col","aria-sort":r.column===h.id?r.direction==="asc"?"ascending":"descending":"none",children:e.jsxs("button",{type:"button",onClick:()=>m(h.id),children:[e.jsx("span",{children:h.label}),e.jsx("em",{"aria-hidden":"true",children:r.column===h.id?r.direction==="asc"?"▲":"▼":"·"})]})},h.id)),e.jsx("th",{scope:"col","aria-label":"Place"})]})}),e.jsx("tbody",{children:c.map(h=>{const j=ce(G(h)),C=Ot(h);return e.jsxs("tr",{"data-picker-item-id":h.id,className:i.has(j)?"is-attached":void 0,children:[e.jsx("td",{title:h.surface.sessionName,children:h.title}),e.jsx("td",{children:h.surface.backend}),e.jsx("td",{children:_s(h)}),e.jsx("td",{title:h.session.cwd??void 0,children:h.project}),e.jsx("td",{children:C?$t(C):"—"}),e.jsx("td",{children:e.jsx("button",{type:"button",className:"s-term-picker-add",onClick:()=>d(G(h)),disabled:i.has(j),children:i.has(j)?"In grid":"Add"})})]},h.id)})})]})}):e.jsxs("div",{className:"s-term-picker-list","aria-label":"Available terminals",children:[S.length>0&&e.jsxs("section",{className:"s-term-picker-group","aria-label":"Managed sessions",children:[e.jsx("h3",{className:"s-term-picker-group-title",children:"Managed sessions"}),S.map(h=>M(h,!0))]}),S.length>0&&w.length>0?e.jsxs("section",{className:"s-term-picker-group","aria-label":"Terminals",children:[e.jsx("h3",{className:"s-term-picker-group-title",children:"Terminals"}),w.map(h=>M(h,!1))]}):w.map(h=>M(h,!1))]})}function _n({tile:s,navigate:t,onClose:r,resolution:i,onRevive:l,live:m=!1}){if(s.kind==="registered")return s.target.surface.backend==="herdr"?e.jsx(Is,{tileId:s.id,backend:"herdr",sessionName:s.target.surface.sessionName,live:s.target.surface.state==="live",onClose:r,navigate:t}):e.jsx(Fn,{tile:s,navigate:t,onClose:r});if(s.kind==="unavailable"){const d=i?.status==="revivable"&&!!l;return e.jsxs("section",{className:"s-term-workspace-tile s-term-workspace-tile--unavailable","aria-label":"Unavailable terminal session",children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsxs("div",{className:"s-term-bar-left",children:[e.jsx("span",{className:"s-term-workspace-tile-mark",children:e.jsx(U,{size:14,strokeWidth:1.8})}),e.jsx("span",{className:"s-term-workspace-tile-name",children:"Not running"})]}),e.jsx("div",{className:"s-term-bar-actions",children:e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>r(s.id),title:"Remove cell","aria-label":"Remove cell",children:e.jsx(pe,{size:14,strokeWidth:1.8})})})]}),e.jsxs("div",{className:"s-term-workspace-unavailable-body",children:[e.jsx(U,{size:22,strokeWidth:1.5}),e.jsx("strong",{children:d?"This tile is not running.":"This saved session is not currently live."}),e.jsx("span",{children:i?.detail??"Show the terminal picker to replace it, or wait for the session to reconnect."}),d&&e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>l?.(s.id),children:"Start it again"})]})]})}return!Os(s.backend)&&s.backend!=="pty"?e.jsx(Is,{tileId:s.id,backend:s.backend,sessionName:s.sessionName,live:m,onClose:r,navigate:t}):e.jsx($n,{tile:s,navigate:t,onClose:r})}function Is({tileId:s,backend:t,sessionName:r,live:i,onClose:l,navigate:m}){const{hosts:d}=Xe(),f=pn(d,t),[c,x]=o.useState("idle"),[y,S]=o.useState(null),w=t==="herdr",{topology:A}=It(w?r??null:null,{enabled:w&&i}),M=o.useCallback(()=>{r&&(x("starting"),S(null),Rt(t,{sessionName:r}).then(()=>x("idle")).catch(v=>{x("failed"),S(v instanceof Error?v.message:String(v))}))},[t,r]),h=o.useCallback(()=>{if(!m||!r)return;const v=vt(t,r);v&&m({view:"terminal",terminalSurfaceKey:v})},[m,t,r]),j=o.useCallback(()=>{!m||!r||m(Et(r))},[m,r]),C=w&&A?.running?A.workspaces.flatMap(v=>v.tabs):[];return e.jsxs("section",{className:"s-term-workspace-tile s-term-workspace-tile--hosted","aria-label":`${f?.label??t} session`,children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsxs("div",{className:"s-term-bar-left",children:[e.jsx("span",{className:"s-term-workspace-tile-mark",children:e.jsx(U,{size:14,strokeWidth:1.8})}),e.jsx("span",{className:"s-term-workspace-tile-name",children:f?.label??t})]}),e.jsxs("div",{className:"s-term-bar-meta",children:[e.jsx("span",{className:"s-term-label",children:i?"running":"not running"}),r&&e.jsx("span",{className:"s-term-session",title:r,children:r})]}),e.jsxs("div",{className:"s-term-bar-actions",children:[w&&i&&r&&m&&e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:j,title:"Enter — open a live web terminal attached to this session","aria-label":"Enter — open a live web terminal attached to this session",children:e.jsx(Qe,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>l(s),title:"Remove cell","aria-label":"Remove cell",children:e.jsx(pe,{size:14,strokeWidth:1.8})})]})]}),C.length>0?e.jsx("button",{type:"button",className:"s-term-workspace-hosted-body s-term-workspace-hosted-body--link",onClick:h,children:C.map(v=>{const z=Wt(v);return e.jsxs("span",{className:"s-term-workspace-hosted-tab",children:[e.jsx("span",{className:"s-term-workspace-hosted-tab-dots",children:z.statuses.map((R,E)=>e.jsx(At,{status:R},`${v.tabId}:${E}`))}),e.jsx("span",{className:"s-term-workspace-hosted-tab-label",children:z.label}),e.jsx("span",{className:"s-term-workspace-hosted-tab-count",children:z.statuses.length})]},v.tabId)})}):e.jsxs("div",{className:"s-term-workspace-unavailable-body",children:[e.jsx(U,{size:22,strokeWidth:1.5}),e.jsx("strong",{children:i?`Running in ${f?.label??t}`:"Not running yet"}),e.jsx("span",{children:i?`Scout keeps this session for you. Open it in ${f?.label??t} to use it.`:`Scout can start a ${f?.label??t} session and keep it for you.`}),!i&&e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:M,disabled:c==="starting"||!r,children:c==="starting"?"Starting…":"Start it"}),y&&e.jsx("code",{children:y})]})]})}function $n({tile:s,navigate:t,onClose:r}){const i=o.useRef(null),l=Ve(),m=Ye(),d=as(s.backend,s.agent),f=An(s),c=["scout-terminal-workspace",s.id,s.backend,s.agent,s.sessionName??"pty"].join("-"),x=Ze({url:l,healthUrl:m,autoConnect:!0,sessionKey:c,backend:s.backend,...s.sessionName?{terminalSession:s.sessionName}:{},...s.backend==="tmux"&&s.sessionName?{tmuxSession:s.sessionName}:{},...s.backend==="zellij"&&s.sessionName?{zellijSession:s.sessionName}:{},...s.backend==="zellij"&&s.zellijSocketDir?{zellijSocketDir:s.zellijSocketDir}:{},...s.backend==="herdr"&&s.sessionName?{tmuxSession:s.sessionName}:{},agent:s.agent,controlMode:"takeover"});le(()=>{x.resize(Ge,Je)},[x.resize]);const y=o.useCallback(()=>{f&&Hs(f,t)},[t,f]);return e.jsx("section",{className:"s-term-workspace-tile","aria-label":d.title,children:e.jsxs("div",{className:"s-term s-term--embedded",children:[e.jsxs("div",{className:"s-term-bar s-term-bar--fresh",children:[e.jsxs("div",{className:"s-term-bar-left",children:[e.jsx("span",{className:"s-term-workspace-tile-mark",children:e.jsx(U,{size:14,strokeWidth:1.8})}),e.jsx("span",{className:"s-term-workspace-tile-name",children:d.title})]}),e.jsxs("div",{className:"s-term-bar-meta",children:[e.jsx("span",{className:"s-term-label",children:s.backend}),e.jsx("span",{className:"s-term-session",children:d.detail})]}),e.jsxs("div",{className:"s-term-bar-actions",children:[e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:()=>x.restart(),title:"Restart terminal","aria-label":"Restart terminal",children:e.jsx(es,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:y,title:"Open terminal in a new window","aria-label":"Open terminal in a new window",children:e.jsx(Fs,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>r(s.id),title:"Close tile","aria-label":"Close tile",children:e.jsx(pe,{size:14,strokeWidth:1.8})})]})]}),e.jsx("div",{ref:i,className:"s-term-body",onMouseDown:()=>{i.current?.querySelector(".xterm-helper-textarea")?.focus(),i.current?.querySelector(".xterm")?.focus()},children:e.jsx(ns,{relay:x,quiet:!0,configItems:[{label:"backend",value:s.backend},{label:"agent",value:s.agent},...s.sessionName?[{label:"session",value:s.sessionName}]:[],...s.zellijSocketDir?[{label:"socket",value:s.zellijSocketDir}]:[],{label:"ws",value:l},{label:"health",value:m}]})})]})})}function Fn({tile:s,navigate:t,onClose:r}){const i=o.useCallback(()=>{Hs(Mn(s.target),t)},[t,s.target]);return e.jsx("section",{className:"s-term-workspace-tile","aria-label":s.target.surface.sessionName,children:e.jsx(rs,{agent:null,mode:"takeover",navigate:t,registeredTarget:s.target,embedded:!0,tileActions:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:i,title:"Open terminal in a new window","aria-label":"Open terminal in a new window",children:e.jsx(Fs,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>r(s.id),title:"Close tile","aria-label":"Close tile",children:e.jsx(pe,{size:14,strokeWidth:1.8})})]})})})}function Kn(s){return[...s].filter(t=>!t.retiredFromFleet).sort((t,r)=>{const i=+!!Te(r)-+!!Te(t);if(i!==0)return i;const l=(r.updatedAt??0)-(t.updatedAt??0);return l!==0?l:t.name.localeCompare(r.name)})}function Un({route:s,navigate:t}){const r=o.useRef(null),i=s.terminalBackend??"pty",l=s.terminalAgent??"shell",m=s.terminalTabId??"adhoc",d=i==="pty"?void 0:`scout-${i}-${m}`,f=s.terminalSessionName??d,c=Ve(),x=Ye(),y=as(i,l),S=["scout-terminal-new",i,l,f??m].join("-"),w=Ze({url:c,healthUrl:x,autoConnect:!0,sessionKey:S,backend:i,...f?{terminalSession:f}:{},...i==="tmux"&&f?{tmuxSession:f}:{},...i==="zellij"&&f?{zellijSession:f}:{},...i==="zellij"&&s.zellijSocketDir?{zellijSocketDir:s.zellijSocketDir}:{},...i==="herdr"&&f?{tmuxSession:f}:{},agent:l,controlMode:"takeover"}),A=o.useRef([]),M=o.useRef({status:w.status,sendLine:w.sendLine});return M.current={status:w.status,sendLine:w.sendLine},le(()=>{const h=j=>{const C=yn(j);if(!C)return;const v=M.current;if(v.status==="connected"){v.sendLine(C);return}A.current=[...A.current.slice(-15),C]};return window.addEventListener(Ns,h),()=>window.removeEventListener(Ns,h)},[]),le(()=>{if(w.status!=="connected"||A.current.length===0)return;const h=A.current;A.current=[];for(const j of h)w.sendLine(j)},[w.sendLine,w.status]),le(()=>{w.resize(Ge,Je)},[w.resize]),e.jsxs("div",{className:"s-term",children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:t,className:"s-term-back"}),e.jsx("span",{className:"s-term-label",children:y.title}),e.jsx("div",{className:"s-term-status",children:y.detail}),e.jsx("div",{className:"s-term-actions",children:e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:()=>w.restart(),title:"Restart terminal","aria-label":"Restart terminal",children:e.jsx(es,{size:14,strokeWidth:1.8})})})]}),e.jsx("div",{ref:r,className:"s-term-body",onMouseDown:()=>{r.current?.querySelector(".xterm-helper-textarea")?.focus(),r.current?.querySelector(".xterm")?.focus()},children:e.jsx(ns,{relay:w,quiet:!0,configItems:[{label:"backend",value:i},{label:"agent",value:l},...f?[{label:"session",value:f}]:[],...s.zellijSocketDir?[{label:"socket",value:s.zellijSocketDir}]:[],{label:"ws",value:c},{label:"health",value:x}]})})]})}function as(s,t){const r=t==="shell"?"Shell":t==="codex"?"Codex":t==="pi"?"Pi":"Claude";return s==="pty"?{title:r,detail:"fresh PTY tab"}:{title:`${r} ${s}`,detail:`fresh ${s} backed tab`}}function Bn({agentId:s,agent:t,mode:r,navigate:i,children:l}){const m=Cn(s,t,r);return m.ready?e.jsx(e.Fragment,{children:l}):e.jsx(Tn,{agent:t,agentId:s,color:Ws(t.name),navigate:i,label:m.label,status:m.status,onRetry:m.onRetry})}function Hn({navigate:s}){return e.jsx("div",{className:"s-term",children:e.jsxs("div",{className:"s-term-bar",children:[e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:s,className:"s-term-back"}),e.jsx("span",{className:"s-term-label",children:"Terminal"}),e.jsx("div",{className:"s-term-status",children:"Resolving agent..."})]})})}function qn({route:s,navigate:t}){const{agentId:r,mode:i,terminalSessionId:l,terminalSurfaceKey:m}=s,{agents:d}=Rs();if(s.terminalBackend)return e.jsx(Un,{route:s,navigate:t});const f=s.terminalSurfaceKey?Ms(s.terminalSurfaceKey):null;if(!r&&f?.backend==="herdr")return e.jsx(Tt,{sessionName:f.hostSession,navigate:t});if(!r)return!l&&!m?e.jsx(Ln,{navigate:t}):e.jsx(Rn,{terminalSessionId:l,terminalSurfaceKey:m,mode:i,navigate:t});const c=d.find(S=>S.id===r)??null;if(!c)return e.jsx(Hn,{navigate:t});const x=Te(c),y=x?`${x.backend}:${c.id}:${x.sessionName}:${i??"takeover"}`:`takeover:${r}:${i??"takeover"}`;return e.jsx(Bn,{agentId:r,agent:c,mode:i,navigate:t,children:e.jsx(rs,{agentId:r,agent:c,mode:i,navigate:t})},y)}function Yr({agentId:s,mode:t,terminalSessionId:r,terminalSurfaceKey:i,navigate:l}){const m={view:"terminal",agentId:s,mode:t,terminalSessionId:r,terminalSurfaceKey:i};return e.jsx(qn,{route:m,navigate:l})}export{qn as TerminalContent,Yr as TerminalScreen};
|
|
1
|
+
import{j as e,r as o,n as Ve,o as Ye}from"./index-NRbRrZw-.js";/* empty css */import{u as Rs,a as Es}from"./Provider-Cd-QZltN.js";import{a as me}from"./api-DEHEgJ9m.js";import{c as bs}from"./clipboard-e3fSpeo7.js";import{d as Ws}from"./colors-BtO5_zlx.js";import{r as Te,S as Ge,a as Je,w as Ie,s as bt,b as xt,d as yt,c as jt,e as As,f as Ce,g as gt}from"./terminal-relay-C2TUIuh1.js";import{p as Ms,g as St,f as Ls,b as Ds,s as F,d as Be,h as He,r as zs,i as Os,j as wt,k as Nt,m as Ct,t as Ps,n as vt}from"./terminal-sessions-D4dHTRkt.js";import{H as Tt,u as Xe,a as It,c as Rt,h as Et,b as Wt,A as At}from"./HerdrSession-BDLa_rrK.js";import{D as Mt,c as Lt,P as Dt,s as _e,T as zt,a as Ot,d as _s}from"./session-table-Djain1Qr.js";import{u as Ze,T as Pt}from"./TerminalRelay-CIHlLVf1.js";import{u as $e,L as Qe}from"./usePersistentState-InmPXIN4.js";import{q as _t}from"./terminal-takeover-BArLfNtd.js";import{t as $t}from"./time-Dhsh_2EG.js";import{B as ue}from"./BackToPicker-CXsbxbHM.js";import{T as Ft}from"./TmuxPeek-eVfqPB4m.js";import{R as es}from"./refresh-cw-C4E58VJK.js";import{c as $s}from"./createLucideIcon-Da0lq809.js";import{P as Z}from"./plus-ZReaTFF-.js";import{T as U}from"./terminal-DNZTCr6a.js";import{Z as Kt}from"./zap-CocRNtyr.js";import{S as Ut}from"./text-B2UZi3l9.js";import{X as pe}from"./x-DuzAbpk5.js";import{E as Bt}from"./eye-B908WSFH.js";import{E as Fs}from"./external-link-BheHazeW.js";import"./provider-Bq0ScH3v.js";import"./router-Bx1tiwVe.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./sse-QSbhyq9A.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-D4vuKzOL.js";import"./DocumentFocusViewer-CetjnYut.js";import"./TextDocumentSurface-B29xZNlI.js";import"./file-text-BGVkHS4_.js";import"./chevron-right-CV7sEVBS.js";import"./code-xml-CPzpZkhu.js";import"./arrow-left-B0CdJdAC.js";import"./arrow-right-YRBoTTyf.js";import"./scout-voice-BT3gYDhU.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-feLCB3Zm.js";import"./NewChatComposer-BPsg8shF.js";import"./conversation-model-CIzM7aXT.js";import"./index-CD2foMB8.js";import"./HarnessMark-CEzmPFHC.js";import"./NewChatOrigin-CCiPg_WR.js";import"./chevron-down-Jh540uf3.js";import"./search-HmdKXdtR.js";import"./loader-circle-Be0T8xv2.js";import"./chunk-HRAB3GC3-BYQZ1LOn.js";import"./check-BdovFDz8.js";import"./copy-DQAM0eSY.js";/* empty css */import"./voice-levels-Dcr3jglk.js";const Ks=6,Us=2;function Re(s){if(s.layout?.mode)return{mode:s.layout.mode,...s.layout.columns===void 0?{}:{columns:Ht(s.layout.columns)}};const t=s.cellCount??0,r=We(s.columns??Us);return t<=1?{mode:"solo"}:r>=t?{mode:"lanes",columns:r}:{mode:"grid",columns:r}}function Ee(s,t){const r=Math.max(1,Math.floor(t.tileCount)||1);if(s.mode==="solo")return 1;if(s.columns===void 0||s.columns==="dynamic"){const i=s.mode==="lanes"?r:Math.ceil(Math.sqrt(r));return Math.max(1,Math.min(Ks,i))}return We(s.columns)}function Ht(s){return s==="dynamic"?"dynamic":We(s)}function qt(s){if(s.mode==="solo")return"Solo";const t=s.mode==="lanes"?"Lanes":"Grid";return s.columns===void 0||s.columns==="dynamic"?`${t} · dynamic`:`${t} · ${s.columns} column${s.columns===1?"":"s"}`}function We(s){return typeof s!="number"||!Number.isFinite(s)?Us:Math.max(1,Math.min(Ks,Math.floor(s)))}const Vt=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Yt=$s("ellipsis",Vt);const Gt=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],de=$s("grid-2x2",Gt),ss=6;function Jt(s="main",t="Main"){return{version:1,activeWorkspaceId:s,workspaces:[{id:s,name:t,tiles:[]}]}}function ts(){return{version:1,activeWorkspaceId:"",workspaces:[]}}function xs(s,t,r={}){const i=()=>r.allowEmpty?ts():Jt();if(!s||typeof s!="object")return i();const l=s;if(!Array.isArray(l.workspaces))return i();const m=[],d=new Set;for(const c of l.workspaces){if(!c||typeof c!="object")continue;const x=typeof c.id=="string"?c.id.trim():"",y=typeof c.name=="string"?c.name.trim():"";if(!x||!y||d.has(x)||!Array.isArray(c.tiles))continue;d.add(x);const S=typeof c.purpose=="string"?c.purpose.trim():"",w=Zt(c.columns),A=Xt(c.layout),M=typeof c.updatedAt=="number"&&Number.isFinite(c.updatedAt)&&c.updatedAt>=0?c.updatedAt:null;m.push({id:x,name:y,tiles:c.tiles.filter(t),...S?{purpose:S}:{},...w?{columns:w}:{},...A?{layout:A}:{},...M===null?{}:{updatedAt:M}})}return m.length===0?i():{version:1,activeWorkspaceId:typeof l.activeWorkspaceId=="string"&&d.has(l.activeWorkspaceId)?l.activeWorkspaceId:m[0].id,workspaces:m}}function Xt(s){if(!s||typeof s!="object")return null;const t=s;if(t.mode!=="solo"&&t.mode!=="lanes"&&t.mode!=="grid")return null;if(t.columns===void 0)return{mode:t.mode};if(t.columns==="dynamic")return{mode:t.mode,columns:"dynamic"};const r=We(t.columns);return{mode:t.mode,columns:r}}function Zt(s){if(typeof s!="number"||!Number.isFinite(s))return null;const t=Math.floor(s);return t<1?null:Math.min(t,ss)}function ys(s,t){const r=t.id.trim();if(!r)return s;const i={...t,id:r},m=s.workspaces.some(d=>d.id===r)?s.workspaces.map(d=>d.id===r?i:d):[i,...s.workspaces];return{...s,activeWorkspaceId:r,workspaces:m}}function js(s,t,r){const i=s.workspaces.findIndex(f=>f.id===t);if(i<0)return s;const l=s.workspaces[i],m={...l,...r};return Object.keys(r).every(f=>l[f]===m[f])?s:{...s,workspaces:s.workspaces.map((f,c)=>c===i?m:f)}}function Qt(s,t){return t===s.activeWorkspaceId||!s.workspaces.some(r=>r.id===t)?s:{...s,activeWorkspaceId:t}}function en(s,t,r={}){if(s.workspaces.length<=1)return r.allowEmpty&&s.workspaces[0]?.id===t?ts():s;const i=s.workspaces.findIndex(d=>d.id===t);if(i<0)return s;const l=s.workspaces.filter(d=>d.id!==t),m=s.activeWorkspaceId===t?l[Math.min(i,l.length-1)].id:s.activeWorkspaceId;return{...s,activeWorkspaceId:m,workspaces:l}}function sn(s,t,r){return r>1?{axis:"horizontal",edge:s.x<t.left+t.width/2?"before":"after"}:{axis:"vertical",edge:s.y<t.top+t.height/2?"before":"after"}}function tn(s,t,r,i){if(t===r)return[...s];const l=s.findIndex(y=>y.id===t),m=s.findIndex(y=>y.id===r);if(l<0||m<0)return[...s];const d=[...s],[f]=d.splice(l,1);if(!f)return[...s];const c=d.findIndex(y=>y.id===r),x=i==="after"?c+1:c;return d.splice(Math.max(0,x),0,f),d}const nn="openscout.terminal.workspaces.v1",rn=2,an="openscout.terminal.workspace-view.v1",Fe=2;function ve(s){const t=typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);return`${s}-${Date.now().toString(36)}-${t}`}const on=24;function Bs(s,t,r){const i=t.replace(/[^A-Za-z0-9_-]+/gu,"-").replace(/^[^A-Za-z0-9_]+/u,"").slice(0,on).replace(/-+$/u,""),l=ln(JSON.stringify([r,t,s]));return`scout-${s}-${i||"cell"}-${l}`}function ln(s){let t=2166136261;for(let r=0;r<s.length;r+=1)t^=s.charCodeAt(r),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}function oe(s,t="shell"){return{id:ve("cell"),kind:"fresh",backend:s,agent:t}}function gs(s){if(!s||typeof s!="object")return!1;const t=s;return typeof t.id!="string"||!t.id.trim()?!1:t.kind==="fresh"?typeof t.backend=="string"&&typeof t.agent=="string":t.kind==="registered"?typeof t.terminalSessionId=="string"&&typeof t.terminalSurfaceKey=="string":!1}function Ss(s){return{id:s.id,name:s.name,...s.purpose?{purpose:s.purpose}:{},columns:s.columns,...s.layout?{layout:s.layout}:{},updatedAt:s.updatedAt,tiles:s.cells.map(t=>t.surfaceId&&t.terminalSessionId?{id:t.id,kind:"registered",terminalSessionId:t.terminalSessionId,terminalSurfaceKey:t.surfaceId}:{id:t.id,kind:"fresh",backend:dn(t.intent.hostId)?t.intent.hostId:"pty",agent:"shell"})}}function Ke(s,t={}){return{id:s.id,name:s.name,purpose:s.purpose??"",columns:Ee(Re({layout:s.layout,columns:s.columns,cellCount:s.tiles.length}),{tileCount:s.tiles.length}),layout:Re({layout:s.layout,columns:s.columns,cellCount:s.tiles.length}),cells:s.tiles.map(r=>r.kind==="registered"?{id:r.id,surfaceId:r.terminalSurfaceKey,terminalSessionId:r.terminalSessionId,intent:cn(r,t.sessions??[])}:{id:r.id,intent:{hostId:r.backend,sessionName:r.backend==="pty"?null:Bs(r.backend,r.id,s.id)}})}}function cn(s,t){const r=Ms(s.terminalSurfaceKey),i=t.find(l=>l.id===s.terminalSessionId||l.surfaces.some(m=>St(m,s.terminalSurfaceKey)));return{...r?{hostId:r.backend,sessionName:r.hostSession}:{},...i?.cwd?{cwd:i.cwd}:{},...i?.harness?{harness:i.harness}:{},...i?.resumeCommand?{resumeCommand:i.resumeCommand}:{}}}function dn(s){return s==="pty"||s==="tmux"||s==="zellij"||s==="herdr"}function mn(s){if(!Array.isArray(s))return xs(s,gs,{allowEmpty:!0});const t=s.flatMap(r=>{if(!r||typeof r!="object")return[];const i=r;if(typeof i.id!="string"||!i.id.trim())return[];const l=Array.isArray(i.cells)?i.cells:[];return[{id:i.id,name:typeof i.name=="string"&&i.name.trim()?i.name:i.id,purpose:i.purpose,columns:i.columns,updatedAt:i.updatedAt,tiles:l.map((m,d)=>({...m,id:`${i.id}-${d}`}))}]});return xs({activeWorkspaceId:t[0]?.id??"",workspaces:t},gs,{allowEmpty:!0})}function un(s,t,r){const i=s.find(l=>l.id===t);return i?i.capabilities.control.includes(r)||i.capabilities.harnessControl.includes(r):!1}function pn(s,t){return s.find(r=>r.id===t)??null}function hn(s){return[{value:"pty",label:"Shell",detail:"Disposable local shell",relayAttach:!0},...s.filter(t=>t.availability.installed&&t.capabilities.create).map(t=>({value:t.id,label:t.label,detail:t.description,relayAttach:t.capabilities.relayAttach})).sort((t,r)=>Number(r.relayAttach)-Number(t.relayAttach)||t.value.localeCompare(r.value))]}async function fn(){return me("/api/terminal-workspaces")}async function ws(s){return(await me(`/api/terminal-workspaces/${encodeURIComponent(s.id)}`,{method:"PUT",body:JSON.stringify(s)})).workspace}async function kn(s,t){return me(`/api/terminal-workspaces/${encodeURIComponent(s)}/cells/${encodeURIComponent(t)}/revive`,{method:"POST",body:"{}"})}async function bn(s){return(await me(`/api/terminal-workspaces/${encodeURIComponent(s)}`,{method:"DELETE"})).deleted}function xn(s){const t=new Map;for(const r of s?.cells??[])t.set(r.cellId,r);return t}const Ns="scout:terminal-send-line";function yn(s){const t=s.detail;if(!t||typeof t!="object"||!("line"in t))return null;const r=t.line;return typeof r=="string"&&r.trim().length>0?r:null}const le=typeof window>"u"?o.useEffect:o.useLayoutEffect,jn="openscout.terminal.picker-view.v1",Cs={mode:"grid",columns:"dynamic"},vs=[{mode:"solo",label:"Solo",detail:"One terminal, full width",minimumCells:1},{mode:"lanes",label:"Lanes",detail:"Side by side, one row",minimumCells:2},{mode:"grid",label:"Grid",detail:"Rows and columns",minimumCells:4}],gn=[{value:"shell",label:"Shell"},{value:"codex",label:"Codex"},{value:"claude",label:"Claude"},{value:"pi",label:"Pi"}],Ue="'JetBrainsMono Nerd Font', 'JetBrainsMonoNL Nerd Font', 'MesloLGS Nerd Font Mono', 'Hack Nerd Font Mono', 'JetBrains Mono', monospace",Ts=s=>{},Sn=()=>{};function wn(){if(typeof window>"u")return{fontFamily:Ue,fontSize:13};const s=new URLSearchParams(window.location.search),t=s.get("terminalFontFamily")?.trim(),r=Number(s.get("terminalFontSize"));return{fontFamily:t?`'${t.replaceAll("'","\\'")}', ${Ue}`:Ue,fontSize:Number.isFinite(r)&&r>=9&&r<=32?r:13}}function ns(s){const t=wn();return e.jsx(Pt,{...s,renderer:s.renderer??"dom",fontFamily:t.fontFamily,fontSize:t.fontSize})}function Nn(s,t){const[r,i]=o.useState({state:"loading",sessions:[]}),l=o.useCallback(()=>{i(d=>({state:"loading",sessions:d.sessions})),Ls({includeDiscovered:!0}).then(d=>{i({state:"ready",sessions:d})}).catch(d=>{i(f=>({state:"failed",sessions:f.sessions,error:d instanceof Error?d.message:String(d)}))})},[]);return o.useEffect(()=>{l()},[l]),{target:o.useMemo(()=>zs(r.sessions,s,t),[r.sessions,s,t]),loadState:r.state,loadSessions:l,hasSessionHint:!!s}}function Cn(s,t,r){const i=bt(t,r),[l,m]=o.useState(i?{state:"preparing"}:{state:"ready"}),[d,f]=o.useState(0);return o.useEffect(()=>{if(!i||!s){m({state:"ready"});return}let c=!1;return m({state:"preparing"}),me(`/api/agents/${encodeURIComponent(s)}/session-catalog`).then(x=>{if(x.resumeCommand)return _t({command:x.resumeCommand,cwd:x.resumeCwd,agentId:s})}).then(()=>{c||m({state:"ready"})}).catch(x=>{c||m({state:"failed",error:x instanceof Error?x.message:String(x)})}),()=>{c=!0}},[s,i,d]),{ready:l.state==="ready",label:l.state==="failed"?"TAKEOVER FAILED":"PREPARING TAKEOVER",status:l.state==="failed"?l.error:"Resolving live session...",onRetry:l.state==="failed"?()=>f(c=>c+1):void 0}}function vn(s){const{agentId:t,agent:r,mode:i,navigate:l,registeredTarget:m,showContextMenu:d}=s,{hosts:f}=Xe(),c=r?Ws(r.name):"var(--accent)",x=o.useRef(null),y=m?Ps(m.surface):Te(r),S=i==="observe",w=m?.session.cwd??r?.cwd??r?.projectRoot??void 0,A=Ve(),M=Ye(),h=xt({agentId:t,agent:r,registeredTarget:m,terminalSurface:y,relayUrl:A,harness:m?.session.harness??r?.harness,cwd:w,mode:i}),j=Ze({url:h.scopedRelayUrl,healthUrl:M,autoConnect:!0,...S?{}:{sessionKey:h.relayStorageSessionKey},...h.surfaceOptions??{},...h.orphanTTL?{orphanTTL:h.orphanTTL}:{},...h.cwd?{cwd:h.cwd}:{},...h.relayAgent?{agent:h.relayAgent}:{},controlMode:h.controlMode});le(()=>{j.resize(Ge,Je)},[j.resize]);const C=o.useMemo(()=>S?{...j,sendInput:Ts,sendLine:Ts,restart:Sn}:j,[S,j]),v=yt({agentId:t,registeredTarget:m}),z=Ie(v,i),R=o.useCallback(()=>{const b=x.current;b?.querySelector(".xterm-helper-textarea")?.focus(),b?.querySelector(".xterm")?.focus()},[]);o.useEffect(()=>{const b=_=>{const $=_.detail?.line;return typeof $=="string"&&$.length>0?$:null},O=_=>{const $=b(_);!$||S||(C.sendInput($),R())},D=_=>{const $=b(_);!$||S||(C.sendLine($),R())};return window.addEventListener("scout:terminal-send-input",O),window.addEventListener("scout:terminal-send-line",D),()=>{window.removeEventListener("scout:terminal-send-input",O),window.removeEventListener("scout:terminal-send-line",D)}},[R,S,C]);const E=o.useCallback(b=>y?jt(y,b):null,[y]),W=o.useCallback(()=>{bs(As(z))},[z]),H=o.useCallback(()=>{S||!navigator.clipboard?.readText||navigator.clipboard.readText().then(b=>{b&&C.sendInput(b)}).catch(()=>{})},[S,C]),B=o.useCallback(()=>{Ce(h.relayStorageSessionKey);const b=E("detach");if(b){b.finally(()=>j.disconnect());return}j.disconnect()},[h.relayStorageSessionKey,j,E]),k=o.useCallback(()=>{Ce(h.relayStorageSessionKey);const b=E("force-quit-bridge");if(b){b.finally(()=>{j.connect(),window.setTimeout(R,250)});return}j.connect(),window.setTimeout(R,250)},[h.relayStorageSessionKey,R,j,E]),N=o.useCallback(()=>{if(S)return;const b=E("interrupt");b?b.catch(()=>C.sendInput("")):C.sendInput(""),R()},[R,S,E,C]),L=o.useCallback(()=>{if(S)return;const b=E("quit");b?b.catch(()=>C.sendInput("")):C.sendInput(""),R()},[R,S,E,C]),K=o.useCallback(()=>{if(S)return;const b=E("stop-job");if(b){b.finally(R);return}R()},[R,S,E]),ne=o.useCallback(()=>{if(Ce(h.relayStorageSessionKey),y&&!window.confirm(`Force quit Claude in ${He(y.sessionName)}?`))return;const b=E("force-quit");if(b){b.finally(()=>j.disconnect());return}const O=j.sessionId;if(!O){j.disconnect();return}gt(O).catch(()=>{}).finally(()=>j.disconnect())},[h.relayStorageSessionKey,j,E,y]),re=o.useCallback(()=>{if(!y||!window.confirm(`Restart Claude in ${He(y.sessionName)} and resume its latest session?`))return;Ce(h.relayStorageSessionKey);const b=E("restart-resume");b&&b.finally(()=>{j.disconnect(),window.setTimeout(()=>{j.connect(),window.setTimeout(R,250)},600)})},[h.relayStorageSessionKey,R,j,E,y]),ae=o.useCallback(b=>{l(Ie(v,b))},[l,v]),Q=o.useCallback(()=>{l(v)},[l,v]),ee=o.useMemo(()=>{const b=y?.backend??null,O=$=>un(f,b,$),D=[];(!b||O("detach"))&&D.push({kind:"action",label:"Leave this session running",onSelect:B}),D.push({kind:"action",label:"Reconnect",onSelect:k});const _=[];return O("restart-resume")&&_.push({kind:"action",label:"Restart Claude and resume",onSelect:re}),O("force-quit")&&_.push({kind:"action",label:"Force quit Claude",onSelect:ne}),_.length>0&&D.push({kind:"separator"},..._),D},[B,ne,k,re,f,y?.backend]),he=o.useCallback(b=>{d(b,ee)},[ee,d]),se=o.useCallback(b=>{const O=typeof window>"u"?"":window.getSelection()?.toString()??"",D=[];O.trim()&&D.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>{bs(O)}}),S||D.push({kind:"action",label:"Paste",shortcut:"⌘V",onSelect:H},{kind:"action",label:"Send Ctrl-C",shortcut:"⌃C",onSelect:N},{kind:"action",label:"Quit With Ctrl-D",shortcut:"⌃D",onSelect:L},{kind:"action",label:"Stop Running Job",onSelect:K}),D.length>0&&D.push({kind:"separator"}),D.push({kind:"action",label:"Focus Terminal",onSelect:R},...ee,{kind:"separator"},{kind:"action",label:S?"Open Takeover":"Open Observe",onSelect:()=>ae(S?"takeover":"observe")},{kind:"action",label:"Open Summary",onSelect:Q},{kind:"action",label:"Copy Terminal Link",onSelect:W}),d(b,D)},[W,R,N,ae,Q,H,L,S,ee,d,K]);return{color:c,terminalBodyRef:x,terminalSurface:y,readOnly:S,relay:j,terminalRelay:C,healthUrl:M,scopedRelayUrl:h.scopedRelayUrl,hasViewActions:!!(m||y),canSignalTerminal:!S&&!!(y||j.status==="connected"),canStopTerminalJob:!S&&!!y,handleSessionMenu:he,handleTerminalContextMenu:se,openMode:ae,openSummary:Q,interruptTerminal:N,quitTerminal:L,stopTerminalJob:K,terminalRouteBase:v}}function Tn({agent:s,agentId:t,color:r,navigate:i,label:l,status:m,onRetry:d}){return e.jsxs("div",{className:"s-term",children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:i,className:"s-term-back"}),s&&e.jsxs("div",{className:"s-term-agent",children:[e.jsx("div",{className:"s-ops-avatar",style:{"--size":"18px",background:r},children:s.name[0]?.toUpperCase()}),e.jsx("span",{className:"s-term-agent-name",children:s.name}),s.handle&&e.jsxs("span",{className:"s-term-agent-handle",children:["@",s.handle]})]}),e.jsx("span",{className:"s-term-label",children:l}),e.jsx("div",{className:"s-term-status",children:d?"OFFLINE":"CONNECTING"})]}),e.jsx("div",{className:"s-term-body s-term-body--placeholder",children:e.jsxs("div",{className:"s-term-placeholder",children:[e.jsx("span",{children:m}),d&&e.jsx("button",{type:"button",onClick:d,children:"Retry"})]})})]})}function In({target:s,navigate:t}){const r=o.useMemo(()=>Ds([s.session]).find(d=>F(d.surface)===F(s.surface)),[s]),i={view:"terminal",terminalSessionId:s.session.id,terminalSurfaceKey:F(s.surface)},l=Nt(s.session,s.surface),m=Ct(s);return e.jsx("div",{className:"s-term s-term--summary",children:e.jsxs("div",{className:"s-term-summary",children:[e.jsxs("div",{className:"s-term-summary-main",children:[e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:t,className:"s-term-back"}),e.jsxs("div",{className:"s-term-summary-mark",children:[e.jsx(U,{size:18,strokeWidth:1.7}),e.jsx("span",{children:"Terminal"})]}),e.jsxs("div",{className:"s-term-summary-heading",children:[e.jsx("h1",{children:r?.title??s.surface.sessionName}),e.jsxs("p",{children:[s.surface.backend," · ",l]})]}),e.jsxs("div",{className:"s-term-summary-actions",children:[e.jsxs("button",{type:"button",className:"s-term-summary-action s-term-summary-action--primary",onClick:()=>t(Ie(i,"takeover")),children:[e.jsx(Qe,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Enter"})]}),e.jsxs("button",{type:"button",className:"s-term-summary-action",onClick:()=>t(Ie(i,"observe")),children:[e.jsx(Bt,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Observe"})]})]})]}),e.jsx("div",{className:"s-term-summary-preview",children:e.jsx(Ft,{surface:Ps(s.surface),lines:26,columns:112,pollMs:3e4,idlePollMs:3e4,className:"s-term-preview-peek"})}),e.jsx("dl",{className:"s-term-summary-details",children:m.map(([d,f])=>e.jsxs("div",{className:"s-term-summary-detail",children:[e.jsx("dt",{children:d}),e.jsx("dd",{title:f,children:f})]},d))})]})})}function rs({agentId:s,agent:t,mode:r,navigate:i,registeredTarget:l,embedded:m=!1,tileActions:d}){const f=Es(),c=vn({agentId:s,agent:t,mode:r,navigate:i,registeredTarget:l,showContextMenu:f});return e.jsxs("div",{className:`s-term${m?" s-term--embedded":""}`,children:[e.jsxs("div",{className:"s-term-bar s-term-bar--takeover",children:[e.jsxs("div",{className:"s-term-bar-left",children:[!m&&e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:i,className:"s-term-back"}),t&&e.jsxs("div",{className:"s-term-agent",children:[e.jsx("div",{className:"s-ops-avatar",style:{"--size":"18px",background:c.color},children:t.name[0]?.toUpperCase()}),e.jsx("span",{className:"s-term-agent-name",children:t.name}),t.handle&&e.jsxs("span",{className:"s-term-agent-handle",children:["@",t.handle]})]}),l&&e.jsxs("div",{className:"s-term-registered-chip",children:[e.jsx(U,{size:14,strokeWidth:1.8}),e.jsx("span",{children:l.session.harness}),e.jsx("span",{children:l.session.sourceSessionId})]})]}),e.jsxs("div",{className:"s-term-bar-meta",children:[e.jsx("span",{className:"s-term-label",children:c.terminalSurface?c.readOnly?"TERMINAL OBSERVE":"TERMINAL TAKEOVER":"TAKEOVER"}),c.terminalSurface&&e.jsx("span",{className:"s-term-session",title:c.terminalSurface.sessionName,children:He(c.terminalSurface.sessionName)})]}),e.jsxs("div",{className:"s-term-bar-actions",children:[c.hasViewActions&&e.jsxs("div",{className:"s-term-action-cluster s-term-action-cluster--view","aria-label":"Terminal view actions",children:[l&&e.jsx("button",{type:"button",className:"s-term-action",onClick:c.openSummary,title:"Leave the terminal canvas and show the session summary",children:"Summary"}),c.terminalSurface&&e.jsx("button",{type:"button",className:"s-term-action",onClick:()=>c.openMode(c.readOnly?"takeover":"observe"),title:c.readOnly?"Switch to interactive takeover":"Switch to read-only terminal observe",children:c.readOnly?"Takeover":"Observe"})]}),(c.canSignalTerminal||c.canStopTerminalJob)&&e.jsxs("div",{className:"s-term-action-cluster s-term-action-cluster--signals","aria-label":"Terminal signal actions",children:[c.canSignalTerminal&&e.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:c.interruptTerminal,title:"Send Ctrl-C to the terminal",children:[e.jsx(Kt,{size:13,strokeWidth:1.8}),e.jsx("span",{children:"Ctrl-C"})]}),c.canSignalTerminal&&e.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:c.quitTerminal,title:"Send Ctrl-D / EOF to the terminal",children:[e.jsx(Dt,{size:13,strokeWidth:1.8}),e.jsx("span",{children:"Quit"})]}),c.canStopTerminalJob&&e.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:c.stopTerminalJob,title:"Stop Claude's current shell/tool job without quitting Claude",children:[e.jsx(Ut,{size:12,strokeWidth:2}),e.jsx("span",{children:"Stop Job"})]})]}),e.jsxs("button",{type:"button",className:"s-term-action s-term-session-menu",onClick:c.handleSessionMenu,title:"Open session, recovery, and external handoff actions",children:[e.jsx(Yt,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Session"})]}),e.jsx("div",{className:"s-term-status",children:c.relay.status==="connected"?"LIVE":c.relay.status==="connecting"?"CONNECTING":"OFFLINE"}),d]})]}),e.jsx("div",{ref:c.terminalBodyRef,className:"s-term-body",onContextMenuCapture:c.handleTerminalContextMenu,children:e.jsx(ns,{relay:c.terminalRelay,readOnly:c.readOnly,quiet:!0,configItems:[...c.terminalSurface?[{label:"backend",value:c.terminalSurface.backend},{label:"session",value:c.terminalSurface.sessionName},...c.terminalSurface.paneId?[{label:"pane",value:c.terminalSurface.paneId}]:[],...c.terminalSurface.socketDir?[{label:"socket",value:c.terminalSurface.socketDir}]:[],{label:"mode",value:c.readOnly?"read-only":"takeover"}]:[],{label:"ws",value:c.scopedRelayUrl},{label:"health",value:c.healthUrl}]})})]})}function Rn({terminalSessionId:s,terminalSurfaceKey:t,mode:r,navigate:i}){const{target:l,loadState:m,loadSessions:d,hasSessionHint:f}=Nn(s,t);return l&&r?e.jsx(rs,{agent:null,mode:r,navigate:i,registeredTarget:l},`${F(l.surface)}:${r}`):l?e.jsx(In,{target:l,navigate:i}):e.jsx("div",{className:"s-term s-term--empty-main",children:e.jsxs("div",{className:"s-term-empty-main-mark",children:[e.jsx(U,{size:18,strokeWidth:1.6}),e.jsx("span",{children:m==="loading"?"Loading terminal":m==="failed"?"Terminal list unavailable":f?"Terminal unavailable":"Select a terminal"}),m==="failed"&&e.jsx("button",{type:"button",className:"s-term-empty-action",onClick:d,children:"Retry"})]})})}function En(s,t){return s.kind!=="fresh"||!s.sessionName?!1:t.some(r=>r.surfaces.some(i=>i.backend===s.backend&&i.sessionName===s.sessionName&&i.state!=="exited"))}function ce(s){return`${s.session.id}:${F(s.surface)}`}function Wn(s,t,r){if(s.kind==="fresh")return{id:s.id,kind:"fresh",backend:s.backend,agent:s.agent,...s.backend==="pty"?{}:{sessionName:Bs(s.backend,s.id,r)}};const i=zs(t,s.terminalSessionId,s.terminalSurfaceKey);return i?{id:s.id,kind:"registered",target:i}:{id:s.id,kind:"unavailable",terminalSessionId:s.terminalSessionId,terminalSurfaceKey:s.terminalSurfaceKey}}function G(s){return{session:s.session,surface:s.surface}}function An(s){const t=s.backend;return t!=="pty"&&!Os(t)?null:{view:"terminal",terminalBackend:t,terminalAgent:s.agent,terminalTabId:s.id,...s.sessionName?{terminalSessionName:s.sessionName}:{},...s.zellijSocketDir?{zellijSocketDir:s.zellijSocketDir}:{}}}function Mn(s,t="takeover"){return{view:"terminal",terminalSessionId:s.session.id,terminalSurfaceKey:F(s.surface),mode:t}}function Hs(s,t){if(typeof window>"u"){t(s);return}window.open(As(s),"_blank","noopener,noreferrer")}function Ln({navigate:s}){const{agents:t}=Rs(),r=Es(),{hosts:i}=Xe(),l=o.useMemo(()=>hn(i),[i]),[m,d]=$e(nn,ts(),{version:rn,migrate:mn}),[f,c]=$e(an,"library"),x=o.useRef(new Map),[y,S]=o.useState(null),[w,A]=o.useState(""),[M,h]=o.useState(""),[j,C]=o.useState(Cs),[v,z]=o.useState(()=>Array.from({length:4},()=>oe("pty"))),[R,E]=o.useState(0),[W,H]=o.useState({state:"loading",sessions:[]}),[B,k]=o.useState(0),[N,L]=o.useState(!0),[K,ne]=$e(jn,"list"),[re,ae]=o.useState(Mt),[Q,ee]=o.useState([]),[he,se]=o.useState(null),[b,O]=o.useState(null),[D,_]=o.useState(null),[$,is]=o.useState(!1),[fe,os]=o.useState(null),[Vs,Ae]=o.useState(null),ke=o.useRef(null),be=o.useRef(null),xe=o.useRef("after"),ye=o.useRef(null),je=o.useRef(null),Me=o.useRef(!1),q=o.useCallback((n={})=>{n.silent||H(a=>({state:"loading",sessions:a.sessions})),Ls({includeDiscovered:!0}).then(a=>H({state:"ready",sessions:a})).catch(a=>{n.silent||H(u=>({state:"failed",sessions:u.sessions,error:a instanceof Error?a.message:String(a)}))})},[]);o.useEffect(()=>{q()},[q]),o.useEffect(()=>{const n=()=>{document.visibilityState==="visible"&&q({silent:!0})},a=window.setInterval(n,8e3);return window.addEventListener("focus",n),document.addEventListener("visibilitychange",n),()=>{window.clearInterval(a),window.removeEventListener("focus",n),document.removeEventListener("visibilitychange",n)}},[q]),o.useEffect(()=>{let n=!1;return fn().then(a=>{if(!n){ee(a.resolutions);for(const u of a.workspaces)x.current.set(u.id,JSON.stringify(Ke(Ss(u),{sessions:W.sessions})));a.workspaces.length!==0&&d(u=>{let p=u;for(const g of a.workspaces)p=ys(p,Ss(g));return{...p,activeWorkspaceId:u.activeWorkspaceId||p.activeWorkspaceId}})}}).catch(()=>{}),()=>{n=!0}},[d]);const ge=o.useMemo(()=>Ds(W.sessions),[W.sessions]),V=o.useMemo(()=>ge.filter(n=>n.surface.state!=="exited"),[ge]),Le=o.useMemo(()=>{const n=new Set,a=[];for(const u of ge)u.surface.backend!=="herdr"||n.has(u.surface.sessionName)||(n.add(u.surface.sessionName),a.push(G(u)));return a},[ge]);o.useMemo(()=>Kn(t),[t]);const ls=W.state==="failed"?W.error:null,Ys=m.workspaces,T=m.workspaces.find(n=>n.id===m.activeWorkspaceId)??null,te=Re({layout:T?.layout,columns:T?.columns,cellCount:T?.tiles.length??0}),Y=o.useMemo(()=>(T?.tiles??[]).map(n=>Wn(n,W.sessions,T?.id??"")),[T?.id,T?.tiles,W.sessions]),De=Ee(te,{tileCount:Y.length});o.useEffect(()=>{if(!T||!x.current.has(T.id))return;const n=Ke(T,{sessions:W.sessions}),a=JSON.stringify(n);x.current.get(T.id)!==a&&(x.current.set(T.id,a),ws(n).catch(u=>se(u instanceof Error?u.message:String(u))))},[T,W.sessions]);const cs=f==="workspace"&&!T?"library":f,P=o.useCallback(n=>{d(a=>{const u=a.workspaces.find(g=>g.id===a.activeWorkspaceId);if(!u)return a;const p=n(u.tiles);return p===u.tiles?a:js(a,u.id,{tiles:p,updatedAt:Date.now()})})},[d]),Se=o.useCallback(n=>{d(a=>a.activeWorkspaceId?js(a,a.activeWorkspaceId,{layout:n,updatedAt:Date.now()}):a)},[d]),Gs=o.useCallback(n=>{d(a=>Qt(a,n.id)),L(!1),c("workspace")},[d,c]),Js=o.useCallback(()=>{c("library")},[c]),ie=o.useCallback(n=>{S(n?.id??null),A(n?.name??""),h(n?.purpose??""),C(n?Re({layout:n.layout,columns:n.columns,cellCount:n.tiles.length}):Cs),z(n?.tiles??Array.from({length:4},()=>oe("pty"))),E(0),c("builder")},[c]),Xs=o.useCallback(n=>{C(a=>n.mode==="solo"?{mode:"solo"}:{mode:n.mode,columns:a.columns??"dynamic"}),z(a=>a.length>=n.minimumCells?a:[...a,...Array.from({length:n.minimumCells-a.length},()=>oe("pty"))]),E(a=>Math.max(0,Math.min(a,n.minimumCells-1)))},[]),Zs=o.useCallback(n=>{C(a=>a.mode==="solo"?{mode:"lanes",columns:n}:{...a,columns:n})},[]),Qs=o.useCallback(()=>{z(n=>{const a=[...n,oe("pty")];return E(a.length-1),a})},[]),et=o.useCallback(n=>{z(a=>{if(a.length<=1)return a;const u=a.filter((p,g)=>g!==n);return E(p=>Math.min(p,u.length-1)),u})},[]),st=o.useCallback(()=>{const n=w.trim();if(!n)return;const a={id:y??ve("workspace"),name:n,purpose:M.trim(),columns:Ee(j,{tileCount:v.length}),layout:j,tiles:v,updatedAt:Date.now()};d(p=>ys(p,a));const u=Ke(a,{sessions:W.sessions});x.current.set(a.id,JSON.stringify(u)),ws(u).catch(p=>se(p instanceof Error?p.message:String(p))),L(!1),c("workspace")},[y,d,c,W.sessions,v,j,w,M]),tt=o.useCallback(n=>{d(a=>en(a,n,{allowEmpty:!0})),bn(n).catch(()=>{})},[d]),ds=o.useCallback((n,a="shell")=>{P(u=>[...u,oe(n,a)])},[P]),J=o.useCallback((n,a)=>{const u={kind:"registered",terminalSessionId:n.session.id,terminalSurfaceKey:F(n.surface)};P(p=>{const g=p.some(I=>I.kind==="registered"&&I.terminalSessionId===u.terminalSessionId&&Be(I.terminalSurfaceKey,u.terminalSurfaceKey));return a?p.some(I=>I.id===a)?p.map(I=>I.id===a?{...u,id:I.id}:I):p:g?p:[...p,{...u,id:ve("cell")}]})},[P]),nt=o.useCallback(n=>{J(n)},[J]),ze=o.useMemo(()=>new Set(Y.filter(n=>n.kind==="registered").map(n=>ce(n.target))),[Y]),rt=o.useCallback(n=>{const a=Le.length>0?Le.map(u=>{const p=ze.has(ce(u)),g=u.surface.state==="live"?"running":"detached";return{kind:"action",label:`${u.surface.sessionName} · ${g}${p?" · in grid":""}`,onSelect:()=>J(u)}}):[{kind:"action",label:"No herdr sessions discovered",onSelect:()=>{}}];r(n,a)},[Le,ze,J,r]),we=o.useCallback(n=>{n?.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId),ye.current=null,je.current=null,Me.current=!1,O(null),_(null),is(!1)},[]),at=o.useCallback((n,a)=>{const u=n.target;n.button!==0||u instanceof Element&&u.closest("button, a")||(ye.current={pointerId:n.pointerId,target:G(a),targetId:ce(G(a)),startX:n.clientX,startY:n.clientY},n.currentTarget.setPointerCapture(n.pointerId))},[]),it=o.useCallback(n=>{const a=ye.current;if(!a||a.pointerId!==n.pointerId||Math.hypot(n.clientX-a.startX,n.clientY-a.startY)<6&&!b)return;b||O(a.targetId);const p=document.querySelector(".s-term--workspace");if(p){const ks=p.getBoundingClientRect();n.clientY<ks.top+72&&(p.scrollTop-=28),n.clientY>ks.bottom-72&&(p.scrollTop+=28)}const g=document.elementFromPoint(n.clientX,n.clientY),I=g?.closest(".s-term-workspace-cell"),X=!!(g?.closest(".s-term-workspace-add-cell")||!I&&g?.closest(".s-term--workspace")&&!g?.closest(".s-term-picker")),fs=X?null:I?.dataset.terminalTileId??null;je.current=fs,Me.current=X,_(fs),is(X)},[b]),ot=o.useCallback(n=>{const a=ye.current;!a||a.pointerId!==n.pointerId||(Me.current?J(a.target):je.current&&J(a.target,je.current),we(n))},[we,J]),lt=o.useCallback(n=>{we(n)},[we]),ct=o.useCallback(()=>{const n=V.map(G);n.length!==0&&P(a=>{const u=a.filter(g=>g.kind==="registered"),p=n.filter(g=>!u.some(I=>I.kind==="registered"&&I.terminalSessionId===g.session.id&&Be(I.terminalSurfaceKey,F(g.surface)))).map(g=>({id:ve("cell"),kind:"registered",terminalSessionId:g.session.id,terminalSurfaceKey:F(g.surface)}));return p.length===0?a:[...a,...p]})},[V,P]),Oe=o.useCallback(n=>{P(a=>{const u=a.filter(p=>p.id!==n);return u.length===a.length?a:u})},[P]),ms=o.useCallback((n,a,u)=>{n!==a&&P(p=>tn(p,n,a,u))},[P]),Pe=o.useCallback((n,a)=>{P(u=>{const p=u.findIndex(X=>X.id===n),g=p+a;if(p<0||g<0||g>=u.length)return u;const I=[...u];return[I[p],I[g]]=[I[g],I[p]],I})},[P]),us=o.useCallback((n,a)=>{P(u=>u.map(p=>p.id===n?{id:p.id,kind:"fresh",backend:a,agent:"shell"}:p))},[P]),Ne=o.useCallback(()=>[...vs.map(n=>({kind:"action",label:n.label,onSelect:()=>Se(n.mode==="solo"?{mode:"solo"}:{mode:n.mode,columns:te.columns??"dynamic"})})),...te.mode==="solo"?[]:[{kind:"separator"},{kind:"action",label:"Dynamic columns",onSelect:()=>Se({...te,columns:"dynamic"})},...Array.from({length:ss},(n,a)=>({kind:"action",label:a===0?"One column":`${a+1} columns`,onSelect:()=>Se({...te,columns:a+1})}))],{kind:"separator"},{kind:"action",label:"Edit workspace…",onSelect:()=>T&&ie(T)}],[T,Se,ie,te]),dt=o.useCallback(n=>{r(n,Ne())},[Ne,r]),mt=o.useCallback((n,a)=>{const u=Y.findIndex(g=>g.id===a.id),p=[];u>0&&p.push({kind:"action",label:"Move left",onSelect:()=>Pe(a.id,-1)}),u>=0&&u<Y.length-1&&p.push({kind:"action",label:"Move right",onSelect:()=>Pe(a.id,1)}),p.length>0&&p.push({kind:"separator"}),p.push(...l.map(g=>({kind:"action",label:g.value==="pty"?"Replace with a disposable shell":`Replace with a session that survives (${g.label})`,onSelect:()=>us(a.id,g.value)})),{kind:"separator"},{kind:"action",label:"Remove cell",onSelect:()=>Oe(a.id)},{kind:"separator"},...Ne()),r(n,p)},[Oe,Ne,Pe,us,r,l,Y]),ut=o.useCallback((n,a)=>{const u=n.target;n.button===0&&u instanceof Element&&u.closest(".s-term-bar")&&!u.closest("button, a")&&(ke.current={pointerId:n.pointerId,tileId:a,startX:n.clientX,startY:n.clientY},n.currentTarget.setPointerCapture(n.pointerId))},[]),pt=o.useCallback(n=>{const a=ke.current;if(!a||a.pointerId!==n.pointerId||Math.hypot(n.clientX-a.startX,n.clientY-a.startY)<6&&!fe)return;fe||os(a.tileId);const p=document.elementFromPoint(n.clientX,n.clientY)?.closest(".s-term-workspace-cell"),g=p?.dataset.terminalTileId??null;if(!p||!g||g===a.tileId){be.current=null,xe.current="after",Ae(null);return}const I=p.getBoundingClientRect(),X=sn({x:n.clientX,y:n.clientY},{left:I.left,top:I.top,width:I.width,height:I.height},De);be.current=g,xe.current=X.edge,Ae(g)},[fe,De]),ps=o.useCallback(n=>{const a=ke.current;if(!a||a.pointerId!==n.pointerId)return;const u=be.current;u&&ms(a.tileId,u,xe.current),n.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId),ke.current=null,be.current=null,xe.current="after",os(null),Ae(null)},[ms]),ht=o.useMemo(()=>xn(Q.find(n=>n.workspaceId===T?.id)),[T?.id,Q]),hs=o.useCallback(n=>{ae(a=>Lt(a,n))},[]),ft=o.useCallback(()=>{q(),k(n=>n+1)},[q]),kt=o.useCallback(n=>{T&&kn(T.id,n).then(()=>{se(null),q()}).catch(a=>se(a instanceof Error?a.message:String(a)))},[T,q]);return cs==="library"?e.jsx(Dn,{workspaces:Ys,sessionsReady:W.state!=="loading",onOpen:Gs,onCreate:()=>ie(),onEdit:ie,onDelete:tt}):cs==="builder"?e.jsx(On,{editing:!!y,name:w,purpose:M,modes:vs,layout:j,startOptions:l,cells:v,selectedSlot:R,terminalItems:V,onNameChange:A,onPurposeChange:h,onApplyMode:Xs,onColumnsChange:Zs,onSelectSlot:E,onAddCell:Qs,onRemoveCell:et,pickerView:K,pickerSort:re,onPickerView:ne,onPickerSort:hs,onAssignFresh:(n,a="shell")=>z(u=>u.map((p,g)=>g===R?{id:p.id,kind:"fresh",backend:n,agent:a}:p)),onAssignRegistered:n=>z(a=>a.map((u,p)=>p===R?{id:u.id,kind:"registered",terminalSessionId:n.session.id,terminalSurfaceKey:F(n.surface)}:u)),onCancel:()=>{c(T?"workspace":"library")},onSave:st}):e.jsx("div",{className:"s-term s-term--workspace",children:e.jsxs("div",{className:"s-term-workspace",children:[e.jsxs("header",{className:"s-term-workspace-head",children:[e.jsxs("div",{className:"s-term-workspace-title",children:[e.jsxs("span",{className:"s-term-summary-mark",children:[e.jsx(de,{size:18,strokeWidth:1.7}),e.jsxs("span",{children:["Workspaces / ",T?.name??"Workspace"]})]}),e.jsx("h1",{children:T?.name??"Workspace"}),T?.purpose&&e.jsx("p",{children:T.purpose})]}),e.jsxs("div",{className:"s-term-workspace-actions","aria-label":"Terminal workspace actions",children:[e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:Js,children:e.jsx("span",{children:"All workspaces"})}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>T&&ie(T),children:[e.jsx(de,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Edit workspace"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:()=>ds("pty"),title:"Add a shell tile",children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Shell"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>ds("pty","codex"),title:"Add a Codex TUI tile",children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Codex"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:rt,title:"Add a herdr session's layout as a tile",children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Herdr"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:()=>L(n=>!n),title:N?"Hide terminal picker":"Show terminal picker","aria-pressed":N,children:[e.jsx(U,{size:14,strokeWidth:1.8}),e.jsx("span",{children:N?"Hide picker":"Show picker"})]}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:ft,disabled:W.state==="loading",title:"Reload all terminal tiles","aria-label":"Reload all terminal tiles",children:e.jsx(es,{size:14,strokeWidth:1.8})})]})]}),ls&&e.jsxs("div",{className:"s-term-home-error",children:[e.jsx("span",{children:"Terminal registry unavailable"}),e.jsx("code",{children:ls})]}),he&&e.jsxs("div",{className:"s-term-home-error",children:[e.jsx("span",{children:"This workspace is not saved to Scout — it will not follow you to another device"}),e.jsx("code",{children:he})]}),(Y.length>0||N)&&e.jsxs("div",{className:"s-term-workspace-grid","aria-label":"Terminal tiles",style:{"--terminal-grid-columns":De},onContextMenu:dt,children:[Y.map(n=>e.jsx("div",{className:`s-term-workspace-cell${fe===n.id?" s-term-workspace-cell--dragging":""}${Vs===n.id||D===n.id?" s-term-workspace-cell--drop-target":""}`,"data-terminal-tile-id":n.id,onPointerDownCapture:a=>ut(a,n.id),onPointerMove:pt,onPointerUp:ps,onPointerCancel:ps,onContextMenu:a=>mt(a,n),children:e.jsx(_n,{tile:n,navigate:s,onClose:Oe,resolution:ht.get(n.id)??null,onRevive:kt,live:En(n,W.sessions)})},`${n.id}:${B}`)),N&&e.jsxs("button",{type:"button",className:`s-term-workspace-add-cell${$?" s-term-workspace-add-cell--target":""}`,onClick:()=>L(!0),children:[e.jsx(Z,{size:20,strokeWidth:1.7}),e.jsx("strong",{children:"New slot"}),e.jsx("span",{children:b?"Drop to add":"Drag a terminal here"})]})]}),e.jsxs("section",{className:`s-term-picker${N?"":" s-term-picker--collapsed"}`,"aria-labelledby":"terminal-picker-title",onPointerDownCapture:n=>{const a=n.target;if(!(a instanceof Element))return;const u=a.closest("[data-picker-item-id]")?.dataset.pickerItemId,p=V.find(g=>g.id===u);p&&at(n,p)},onPointerMove:it,onPointerUp:ot,onPointerCancel:lt,children:[e.jsxs("header",{className:"s-term-picker-head",children:[e.jsxs("div",{className:"s-term-picker-title",children:[e.jsx(U,{size:14,strokeWidth:1.8}),e.jsx("h2",{id:"terminal-picker-title",children:"Terminal picker"}),e.jsx("span",{children:W.state==="loading"?"syncing":V.length})]}),e.jsxs("div",{className:"s-term-picker-actions",children:[N&&e.jsx("div",{className:"s-term-picker-views",role:"group","aria-label":"Picker view",children:["list","table"].map(n=>e.jsx("button",{type:"button",className:K===n?"is-selected":"",onClick:()=>ne(n),"aria-pressed":K===n,children:n==="list"?"List":"Table"},n))}),N&&e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:ct,disabled:V.length===0,children:[e.jsx(Qe,{size:13,strokeWidth:1.8}),e.jsx("span",{children:"Attach all"})]}),e.jsxs("button",{type:"button",className:"s-term-picker-toggle",onClick:()=>L(n=>!n),"aria-expanded":N,children:[e.jsx("span",{children:N?"Hide":"Show terminal picker"}),e.jsx("span",{"aria-hidden":"true",children:N?"⌄":"⌃"})]})]})]}),N&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"s-term-picker-hint",children:"Drag a terminal onto a cell to place it, or onto New slot to grow the grid."}),V.length===0&&W.state!=="loading"?e.jsx("div",{className:"s-term-picker-empty",children:"No live terminals"}):e.jsx(qs,{items:V,view:K,sort:re,attachedIds:ze,draggedTargetId:b,onSort:hs,onAttach:nt,navigate:s})]})]})]})})}function Dn({workspaces:s,sessionsReady:t,onOpen:r,onCreate:i,onEdit:l,onDelete:m}){return e.jsx("div",{className:"s-term s-term--workspace-library",children:e.jsxs("main",{className:"s-term-workspace-library",children:[e.jsxs("header",{className:"s-term-workspace-library-head",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"s-term-summary-mark",children:[e.jsx(de,{size:18,strokeWidth:1.7}),e.jsx("span",{children:"Terminals"})]}),e.jsx("h1",{children:"Workspaces"}),e.jsx("p",{children:"Saved terminal layouts for projects, roles, and cross-project operations."})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:i,children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"New workspace"})]})]}),s.length===0?e.jsxs("section",{className:"s-term-workspace-library-empty",children:[e.jsx(de,{size:24,strokeWidth:1.5}),e.jsx("h2",{children:"Create your first terminal workspace"}),e.jsx("p",{children:"Choose a layout, give it a purpose, place sessions, then enter the grid."}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:i,children:[e.jsx(Z,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Create workspace"})]})]}):e.jsx("div",{className:"s-term-workspace-library-grid",children:s.map(d=>e.jsxs("article",{className:"s-term-workspace-card",children:[e.jsx("div",{className:"s-term-workspace-card-preview",style:{"--terminal-grid-columns":d.columns??Fe},children:d.tiles.map(f=>e.jsx("span",{className:f.kind==="registered"?"is-session":"is-shell"},f.id))}),e.jsxs("div",{className:"s-term-workspace-card-copy",children:[e.jsxs("span",{children:[d.columns??Fe," column",(d.columns??Fe)===1?"":"s"," · ",d.tiles.length," cells"]}),e.jsx("h2",{children:d.name}),e.jsx("p",{children:d.purpose||"No purpose added yet."})]}),e.jsxs("div",{className:"s-term-workspace-card-actions",children:[e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:()=>l(d),children:"Edit"}),e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:()=>m(d.id),children:"Delete"}),e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>r(d),disabled:!t,children:"Enter workspace"})]})]},d.id))})]})})}function qe(s,t){return s==="solo"?1:s==="lanes"?Math.max(2,Math.min(4,t)):Math.max(2,Math.min(3,t))}function zn(s,t){return s==="solo"?1:s==="lanes"?qe(s,t):qe(s,t)*2}function On({editing:s,name:t,purpose:r,modes:i,layout:l,startOptions:m,cells:d,selectedSlot:f,terminalItems:c,onNameChange:x,onPurposeChange:y,onApplyMode:S,onColumnsChange:w,onSelectSlot:A,onAddCell:M,onRemoveCell:h,pickerView:j,pickerSort:C,onPickerView:v,onPickerSort:z,onAssignFresh:R,onAssignRegistered:E,onCancel:W,onSave:H}){const B=Ee(l,{tileCount:d.length});return e.jsx("div",{className:"s-term s-term--workspace-builder",children:e.jsxs("main",{className:"s-term-workspace-builder",children:[e.jsxs("header",{className:"s-term-workspace-builder-head",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"s-term-summary-mark",children:[e.jsx(de,{size:18,strokeWidth:1.7}),e.jsx("span",{children:"Workspace builder"})]}),e.jsx("h1",{children:s?"Edit workspace":"Create a workspace"}),e.jsx("p",{children:"Define the job, choose the grid, and place the sessions before entering."})]}),e.jsxs("div",{className:"s-term-workspace-builder-actions",children:[e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:W,children:"Cancel"}),e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:H,disabled:!t.trim(),children:s?"Save and enter":"Create and enter"})]})]}),e.jsxs("section",{className:"s-term-workspace-builder-identity","aria-label":"Workspace identity",children:[e.jsxs("label",{children:[e.jsx("span",{children:"Name"}),e.jsx("input",{value:t,onChange:k=>x(k.target.value),placeholder:"Release desk",autoFocus:!0})]}),e.jsxs("label",{children:[e.jsx("span",{children:"Purpose"}),e.jsx("input",{value:r,onChange:k=>y(k.target.value),placeholder:"Cross-project release monitoring"})]})]}),e.jsxs("section",{className:"s-term-workspace-builder-layout","aria-labelledby":"workspace-layout-title",children:[e.jsxs("div",{className:"s-term-workspace-builder-section-head",children:[e.jsxs("div",{children:[e.jsx("span",{children:"Step 1"}),e.jsx("h2",{id:"workspace-layout-title",children:"Choose the layout"})]}),e.jsxs("p",{children:[qt(l)," · ",d.length," cell",d.length===1?"":"s"]})]}),e.jsx("div",{className:"s-term-grid-presets","aria-label":"Workspace layout",children:i.map(k=>e.jsxs("button",{type:"button",className:`s-term-grid-preset${k.mode===l.mode?" s-term-grid-preset--selected":""}`,onClick:()=>S(k),"aria-pressed":k.mode===l.mode,children:[e.jsx("span",{className:"s-term-grid-preset-map",style:{"--terminal-preset-columns":qe(k.mode,B)},"aria-hidden":"true",children:Array.from({length:zn(k.mode,B)},(N,L)=>e.jsx("i",{},L))}),e.jsx("span",{className:"s-term-grid-preset-label",children:k.label}),e.jsx("span",{className:"s-term-grid-preset-detail",children:k.detail})]},k.mode))}),l.mode!=="solo"&&e.jsxs("div",{className:"s-term-workspace-builder-columns",role:"group","aria-label":"Columns",children:[e.jsx("span",{children:"Columns"}),e.jsx("button",{type:"button",className:l.columns==="dynamic"||l.columns===void 0?"is-selected":"",onClick:()=>w("dynamic"),"aria-pressed":l.columns==="dynamic"||l.columns===void 0,title:"Fit the columns to the number of tiles",children:"Dynamic"}),Array.from({length:ss},(k,N)=>e.jsx("button",{type:"button",className:l.columns===N+1?"is-selected":"",onClick:()=>w(N+1),"aria-pressed":l.columns===N+1,children:N+1},N)),(l.columns==="dynamic"||l.columns===void 0)&&e.jsxs("em",{children:[B," right now"]})]})]}),e.jsxs("section",{className:"s-term-workspace-builder-placement","aria-labelledby":"workspace-placement-title",children:[e.jsxs("div",{className:"s-term-workspace-builder-section-head",children:[e.jsxs("div",{children:[e.jsx("span",{children:"Step 2"}),e.jsx("h2",{id:"workspace-placement-title",children:"Place terminals"})]}),e.jsx("p",{children:"Select a cell, then choose a session or shell. Add as many cells as the work needs."})]}),e.jsxs("div",{className:"s-term-workspace-builder-canvas",children:[e.jsxs("div",{className:"s-term-workspace-builder-grid",style:{"--terminal-grid-columns":B},children:[d.map((k,N)=>{const L=k.kind==="registered"?c.find(K=>K.session.id===k.terminalSessionId&&Be(F(K.surface),k.terminalSurfaceKey)):null;return e.jsxs("div",{className:`s-term-workspace-builder-cell${f===N?" is-selected":""}`,children:[e.jsxs("button",{type:"button",className:"s-term-workspace-builder-cell-select",onClick:()=>A(N),"aria-pressed":f===N,children:[e.jsx("span",{children:String(N+1).padStart(2,"0")}),e.jsx(U,{size:17,strokeWidth:1.7}),e.jsx("strong",{children:k.kind==="registered"?L?.title??"Unavailable session":as(k.backend,k.agent).title}),e.jsx("small",{children:k.kind==="registered"?L?.cwdLabel||L?.detail:k.backend})]}),d.length>1&&e.jsx("button",{type:"button",className:"s-term-workspace-builder-cell-remove",onClick:()=>h(N),title:"Remove this cell","aria-label":`Remove cell ${N+1}`,children:e.jsx(pe,{size:13,strokeWidth:1.9})})]},k.id)}),e.jsxs("button",{type:"button",className:"s-term-workspace-builder-cell s-term-workspace-builder-cell--add",onClick:M,children:[e.jsx(Z,{size:18,strokeWidth:1.7}),e.jsx("strong",{children:"Add cell"})]})]}),e.jsxs("aside",{className:"s-term-workspace-builder-source",children:[e.jsxs("span",{children:["Cell ",String(f+1).padStart(2,"0")]}),e.jsx("h3",{children:"Start something new"}),e.jsxs("div",{className:"s-term-workspace-builder-source-actions",children:[gn.map(k=>e.jsx("button",{type:"button",onClick:()=>R("pty",k.value),children:k.label},k.value)),m.filter(k=>k.value!=="pty").map(k=>e.jsxs("button",{type:"button",onClick:()=>R(k.value,"shell"),title:k.relayAttach?k.detail:`${k.detail} — Scout starts it; open it in ${k.label} to use it`,children:[k.label,!k.relayAttach&&e.jsx("sup",{"aria-label":"opens outside Scout",children:" ↗"})]},k.value))]}),e.jsxs("div",{className:"s-term-workspace-builder-source-head",children:[e.jsx("h3",{children:"Or use a live session"}),e.jsx("div",{className:"s-term-picker-views",role:"group","aria-label":"Session picker view",children:["list","table"].map(k=>e.jsx("button",{type:"button",className:j===k?"is-selected":"",onClick:()=>v(k),"aria-pressed":j===k,children:k==="list"?"List":"Table"},k))})]}),e.jsx("div",{className:"s-term-workspace-builder-sessions",children:c.length===0?e.jsx("span",{className:"s-term-workspace-builder-no-sessions",children:"No live sessions"}):e.jsx(qs,{items:c,view:j,sort:C,attachedIds:new Set,draggedTargetId:null,onSort:z,onAttach:k=>{const N=c.find(L=>L.session.id===k.session.id&&L.surface.sessionName===k.surface.sessionName);N&&E(N)}})})]})]})]})]})})}function Pn({item:s,attached:t,dragging:r,onAttach:i,onOpen:l}){return e.jsxs("article",{className:`s-term-picker-item${t?" s-term-picker-item--attached":""}${r?" s-term-picker-item--dragging":""}`,"data-picker-item-id":s.id,children:[e.jsx("span",{className:"s-term-picker-grip","aria-hidden":"true",children:"⠿"}),e.jsxs("div",{className:"s-term-picker-item-main",children:[e.jsx("strong",{title:s.surface.sessionName,children:s.title}),e.jsx("span",{title:s.session.cwd??s.detail,children:s.cwdLabel||s.detail})]}),e.jsxs("div",{className:"s-term-picker-item-meta",children:[e.jsx("span",{children:s.surface.backend}),e.jsx("span",{children:_s(s)}),e.jsx("span",{title:s.session.cwd??void 0,children:s.project})]}),l&&e.jsx("button",{type:"button",className:"s-term-picker-add",onClick:l,children:"Open"}),e.jsx("button",{type:"button",className:"s-term-picker-add",onClick:()=>i(G(s)),disabled:t,children:t?"In grid":"Add"})]})}function qs({items:s,view:t,sort:r,attachedIds:i,draggedTargetId:l,onSort:m,onAttach:d,navigate:f}){const c=o.useMemo(()=>_e(s,r),[s,r]),{managed:x,regular:y}=o.useMemo(()=>wt(s),[s]),S=o.useMemo(()=>_e(x,r),[x,r]),w=o.useMemo(()=>_e(y,r),[y,r]),A=h=>{f?.({view:"terminal",terminalSessionId:h.session.id,terminalSurfaceKey:F(h.surface)})},M=(h,j)=>{const C=ce(G(h));return e.jsx(Pn,{item:h,attached:i.has(C),dragging:l===C,onAttach:d,onOpen:j&&f?()=>A(h):void 0},h.id)};return t==="table"?e.jsx("div",{className:"s-term-picker-table-wrap",children:e.jsxs("table",{className:"s-term-picker-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[zt.map(h=>e.jsx("th",{scope:"col","aria-sort":r.column===h.id?r.direction==="asc"?"ascending":"descending":"none",children:e.jsxs("button",{type:"button",onClick:()=>m(h.id),children:[e.jsx("span",{children:h.label}),e.jsx("em",{"aria-hidden":"true",children:r.column===h.id?r.direction==="asc"?"▲":"▼":"·"})]})},h.id)),e.jsx("th",{scope:"col","aria-label":"Place"})]})}),e.jsx("tbody",{children:c.map(h=>{const j=ce(G(h)),C=Ot(h);return e.jsxs("tr",{"data-picker-item-id":h.id,className:i.has(j)?"is-attached":void 0,children:[e.jsx("td",{title:h.surface.sessionName,children:h.title}),e.jsx("td",{children:h.surface.backend}),e.jsx("td",{children:_s(h)}),e.jsx("td",{title:h.session.cwd??void 0,children:h.project}),e.jsx("td",{children:C?$t(C):"—"}),e.jsx("td",{children:e.jsx("button",{type:"button",className:"s-term-picker-add",onClick:()=>d(G(h)),disabled:i.has(j),children:i.has(j)?"In grid":"Add"})})]},h.id)})})]})}):e.jsxs("div",{className:"s-term-picker-list","aria-label":"Available terminals",children:[S.length>0&&e.jsxs("section",{className:"s-term-picker-group","aria-label":"Managed sessions",children:[e.jsx("h3",{className:"s-term-picker-group-title",children:"Managed sessions"}),S.map(h=>M(h,!0))]}),S.length>0&&w.length>0?e.jsxs("section",{className:"s-term-picker-group","aria-label":"Terminals",children:[e.jsx("h3",{className:"s-term-picker-group-title",children:"Terminals"}),w.map(h=>M(h,!1))]}):w.map(h=>M(h,!1))]})}function _n({tile:s,navigate:t,onClose:r,resolution:i,onRevive:l,live:m=!1}){if(s.kind==="registered")return s.target.surface.backend==="herdr"?e.jsx(Is,{tileId:s.id,backend:"herdr",sessionName:s.target.surface.sessionName,live:s.target.surface.state==="live",onClose:r,navigate:t}):e.jsx(Fn,{tile:s,navigate:t,onClose:r});if(s.kind==="unavailable"){const d=i?.status==="revivable"&&!!l;return e.jsxs("section",{className:"s-term-workspace-tile s-term-workspace-tile--unavailable","aria-label":"Unavailable terminal session",children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsxs("div",{className:"s-term-bar-left",children:[e.jsx("span",{className:"s-term-workspace-tile-mark",children:e.jsx(U,{size:14,strokeWidth:1.8})}),e.jsx("span",{className:"s-term-workspace-tile-name",children:"Not running"})]}),e.jsx("div",{className:"s-term-bar-actions",children:e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>r(s.id),title:"Remove cell","aria-label":"Remove cell",children:e.jsx(pe,{size:14,strokeWidth:1.8})})})]}),e.jsxs("div",{className:"s-term-workspace-unavailable-body",children:[e.jsx(U,{size:22,strokeWidth:1.5}),e.jsx("strong",{children:d?"This tile is not running.":"This saved session is not currently live."}),e.jsx("span",{children:i?.detail??"Show the terminal picker to replace it, or wait for the session to reconnect."}),d&&e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>l?.(s.id),children:"Start it again"})]})]})}return!Os(s.backend)&&s.backend!=="pty"?e.jsx(Is,{tileId:s.id,backend:s.backend,sessionName:s.sessionName,live:m,onClose:r,navigate:t}):e.jsx($n,{tile:s,navigate:t,onClose:r})}function Is({tileId:s,backend:t,sessionName:r,live:i,onClose:l,navigate:m}){const{hosts:d}=Xe(),f=pn(d,t),[c,x]=o.useState("idle"),[y,S]=o.useState(null),w=t==="herdr",{topology:A}=It(w?r??null:null,{enabled:w&&i}),M=o.useCallback(()=>{r&&(x("starting"),S(null),Rt(t,{sessionName:r}).then(()=>x("idle")).catch(v=>{x("failed"),S(v instanceof Error?v.message:String(v))}))},[t,r]),h=o.useCallback(()=>{if(!m||!r)return;const v=vt(t,r);v&&m({view:"terminal",terminalSurfaceKey:v})},[m,t,r]),j=o.useCallback(()=>{!m||!r||m(Et(r))},[m,r]),C=w&&A?.running?A.workspaces.flatMap(v=>v.tabs):[];return e.jsxs("section",{className:"s-term-workspace-tile s-term-workspace-tile--hosted","aria-label":`${f?.label??t} session`,children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsxs("div",{className:"s-term-bar-left",children:[e.jsx("span",{className:"s-term-workspace-tile-mark",children:e.jsx(U,{size:14,strokeWidth:1.8})}),e.jsx("span",{className:"s-term-workspace-tile-name",children:f?.label??t})]}),e.jsxs("div",{className:"s-term-bar-meta",children:[e.jsx("span",{className:"s-term-label",children:i?"running":"not running"}),r&&e.jsx("span",{className:"s-term-session",title:r,children:r})]}),e.jsxs("div",{className:"s-term-bar-actions",children:[w&&i&&r&&m&&e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:j,title:"Enter — open a live web terminal attached to this session","aria-label":"Enter — open a live web terminal attached to this session",children:e.jsx(Qe,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>l(s),title:"Remove cell","aria-label":"Remove cell",children:e.jsx(pe,{size:14,strokeWidth:1.8})})]})]}),C.length>0?e.jsx("button",{type:"button",className:"s-term-workspace-hosted-body s-term-workspace-hosted-body--link",onClick:h,children:C.map(v=>{const z=Wt(v);return e.jsxs("span",{className:"s-term-workspace-hosted-tab",children:[e.jsx("span",{className:"s-term-workspace-hosted-tab-dots",children:z.statuses.map((R,E)=>e.jsx(At,{status:R},`${v.tabId}:${E}`))}),e.jsx("span",{className:"s-term-workspace-hosted-tab-label",children:z.label}),e.jsx("span",{className:"s-term-workspace-hosted-tab-count",children:z.statuses.length})]},v.tabId)})}):e.jsxs("div",{className:"s-term-workspace-unavailable-body",children:[e.jsx(U,{size:22,strokeWidth:1.5}),e.jsx("strong",{children:i?`Running in ${f?.label??t}`:"Not running yet"}),e.jsx("span",{children:i?`Scout keeps this session for you. Open it in ${f?.label??t} to use it.`:`Scout can start a ${f?.label??t} session and keep it for you.`}),!i&&e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:M,disabled:c==="starting"||!r,children:c==="starting"?"Starting…":"Start it"}),y&&e.jsx("code",{children:y})]})]})}function $n({tile:s,navigate:t,onClose:r}){const i=o.useRef(null),l=Ve(),m=Ye(),d=as(s.backend,s.agent),f=An(s),c=["scout-terminal-workspace",s.id,s.backend,s.agent,s.sessionName??"pty"].join("-"),x=Ze({url:l,healthUrl:m,autoConnect:!0,sessionKey:c,backend:s.backend,...s.sessionName?{terminalSession:s.sessionName}:{},...s.backend==="tmux"&&s.sessionName?{tmuxSession:s.sessionName}:{},...s.backend==="zellij"&&s.sessionName?{zellijSession:s.sessionName}:{},...s.backend==="zellij"&&s.zellijSocketDir?{zellijSocketDir:s.zellijSocketDir}:{},...s.backend==="herdr"&&s.sessionName?{tmuxSession:s.sessionName}:{},agent:s.agent,controlMode:"takeover"});le(()=>{x.resize(Ge,Je)},[x.resize]);const y=o.useCallback(()=>{f&&Hs(f,t)},[t,f]);return e.jsx("section",{className:"s-term-workspace-tile","aria-label":d.title,children:e.jsxs("div",{className:"s-term s-term--embedded",children:[e.jsxs("div",{className:"s-term-bar s-term-bar--fresh",children:[e.jsxs("div",{className:"s-term-bar-left",children:[e.jsx("span",{className:"s-term-workspace-tile-mark",children:e.jsx(U,{size:14,strokeWidth:1.8})}),e.jsx("span",{className:"s-term-workspace-tile-name",children:d.title})]}),e.jsxs("div",{className:"s-term-bar-meta",children:[e.jsx("span",{className:"s-term-label",children:s.backend}),e.jsx("span",{className:"s-term-session",children:d.detail})]}),e.jsxs("div",{className:"s-term-bar-actions",children:[e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:()=>x.restart(),title:"Restart terminal","aria-label":"Restart terminal",children:e.jsx(es,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:y,title:"Open terminal in a new window","aria-label":"Open terminal in a new window",children:e.jsx(Fs,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>r(s.id),title:"Close tile","aria-label":"Close tile",children:e.jsx(pe,{size:14,strokeWidth:1.8})})]})]}),e.jsx("div",{ref:i,className:"s-term-body",onMouseDown:()=>{i.current?.querySelector(".xterm-helper-textarea")?.focus(),i.current?.querySelector(".xterm")?.focus()},children:e.jsx(ns,{relay:x,quiet:!0,configItems:[{label:"backend",value:s.backend},{label:"agent",value:s.agent},...s.sessionName?[{label:"session",value:s.sessionName}]:[],...s.zellijSocketDir?[{label:"socket",value:s.zellijSocketDir}]:[],{label:"ws",value:l},{label:"health",value:m}]})})]})})}function Fn({tile:s,navigate:t,onClose:r}){const i=o.useCallback(()=>{Hs(Mn(s.target),t)},[t,s.target]);return e.jsx("section",{className:"s-term-workspace-tile","aria-label":s.target.surface.sessionName,children:e.jsx(rs,{agent:null,mode:"takeover",navigate:t,registeredTarget:s.target,embedded:!0,tileActions:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:i,title:"Open terminal in a new window","aria-label":"Open terminal in a new window",children:e.jsx(Fs,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>r(s.id),title:"Close tile","aria-label":"Close tile",children:e.jsx(pe,{size:14,strokeWidth:1.8})})]})})})}function Kn(s){return[...s].filter(t=>!t.retiredFromFleet).sort((t,r)=>{const i=+!!Te(r)-+!!Te(t);if(i!==0)return i;const l=(r.updatedAt??0)-(t.updatedAt??0);return l!==0?l:t.name.localeCompare(r.name)})}function Un({route:s,navigate:t}){const r=o.useRef(null),i=s.terminalBackend??"pty",l=s.terminalAgent??"shell",m=s.terminalTabId??"adhoc",d=i==="pty"?void 0:`scout-${i}-${m}`,f=s.terminalSessionName??d,c=Ve(),x=Ye(),y=as(i,l),S=["scout-terminal-new",i,l,f??m].join("-"),w=Ze({url:c,healthUrl:x,autoConnect:!0,sessionKey:S,backend:i,...f?{terminalSession:f}:{},...i==="tmux"&&f?{tmuxSession:f}:{},...i==="zellij"&&f?{zellijSession:f}:{},...i==="zellij"&&s.zellijSocketDir?{zellijSocketDir:s.zellijSocketDir}:{},...i==="herdr"&&f?{tmuxSession:f}:{},agent:l,controlMode:"takeover"}),A=o.useRef([]),M=o.useRef({status:w.status,sendLine:w.sendLine});return M.current={status:w.status,sendLine:w.sendLine},le(()=>{const h=j=>{const C=yn(j);if(!C)return;const v=M.current;if(v.status==="connected"){v.sendLine(C);return}A.current=[...A.current.slice(-15),C]};return window.addEventListener(Ns,h),()=>window.removeEventListener(Ns,h)},[]),le(()=>{if(w.status!=="connected"||A.current.length===0)return;const h=A.current;A.current=[];for(const j of h)w.sendLine(j)},[w.sendLine,w.status]),le(()=>{w.resize(Ge,Je)},[w.resize]),e.jsxs("div",{className:"s-term",children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:t,className:"s-term-back"}),e.jsx("span",{className:"s-term-label",children:y.title}),e.jsx("div",{className:"s-term-status",children:y.detail}),e.jsx("div",{className:"s-term-actions",children:e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:()=>w.restart(),title:"Restart terminal","aria-label":"Restart terminal",children:e.jsx(es,{size:14,strokeWidth:1.8})})})]}),e.jsx("div",{ref:r,className:"s-term-body",onMouseDown:()=>{r.current?.querySelector(".xterm-helper-textarea")?.focus(),r.current?.querySelector(".xterm")?.focus()},children:e.jsx(ns,{relay:w,quiet:!0,configItems:[{label:"backend",value:i},{label:"agent",value:l},...f?[{label:"session",value:f}]:[],...s.zellijSocketDir?[{label:"socket",value:s.zellijSocketDir}]:[],{label:"ws",value:c},{label:"health",value:x}]})})]})}function as(s,t){const r=t==="shell"?"Shell":t==="codex"?"Codex":t==="pi"?"Pi":"Claude";return s==="pty"?{title:r,detail:"fresh PTY tab"}:{title:`${r} ${s}`,detail:`fresh ${s} backed tab`}}function Bn({agentId:s,agent:t,mode:r,navigate:i,children:l}){const m=Cn(s,t,r);return m.ready?e.jsx(e.Fragment,{children:l}):e.jsx(Tn,{agent:t,agentId:s,color:Ws(t.name),navigate:i,label:m.label,status:m.status,onRetry:m.onRetry})}function Hn({navigate:s}){return e.jsx("div",{className:"s-term",children:e.jsxs("div",{className:"s-term-bar",children:[e.jsx(ue,{slot:"terminal",fallback:{view:"terminal"},navigate:s,className:"s-term-back"}),e.jsx("span",{className:"s-term-label",children:"Terminal"}),e.jsx("div",{className:"s-term-status",children:"Resolving agent..."})]})})}function qn({route:s,navigate:t}){const{agentId:r,mode:i,terminalSessionId:l,terminalSurfaceKey:m}=s,{agents:d}=Rs();if(s.terminalBackend)return e.jsx(Un,{route:s,navigate:t});const f=s.terminalSurfaceKey?Ms(s.terminalSurfaceKey):null;if(!r&&f?.backend==="herdr")return e.jsx(Tt,{sessionName:f.hostSession,navigate:t});if(!r)return!l&&!m?e.jsx(Ln,{navigate:t}):e.jsx(Rn,{terminalSessionId:l,terminalSurfaceKey:m,mode:i,navigate:t});const c=d.find(S=>S.id===r)??null;if(!c)return e.jsx(Hn,{navigate:t});const x=Te(c),y=x?`${x.backend}:${c.id}:${x.sessionName}:${i??"takeover"}`:`takeover:${r}:${i??"takeover"}`;return e.jsx(Bn,{agentId:r,agent:c,mode:i,navigate:t,children:e.jsx(rs,{agentId:r,agent:c,mode:i,navigate:t})},y)}function Yr({agentId:s,mode:t,terminalSessionId:r,terminalSurfaceKey:i,navigate:l}){const m={view:"terminal",agentId:s,mode:t,terminalSessionId:r,terminalSurfaceKey:i};return e.jsx(qn,{route:m,navigate:l})}export{qn as TerminalContent,Yr as TerminalScreen};
|
package/dist/client/assets/{TerminalEmbedScreen-BmyZkonh.js → TerminalEmbedScreen-GvpoGERN.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,j as l,a as A,b as C,S as k}from"./index-
|
|
1
|
+
import{r as e,j as l,a as A,b as C,S as k}from"./index-NRbRrZw-.js";import{L as y,D as T,f as L,S as x,C as R}from"./Provider-Cd-QZltN.js";import{a as P}from"./api-DEHEgJ9m.js";import{i as I}from"./colors-BtO5_zlx.js";import{r as j,a as D}from"./router-Bx1tiwVe.js";import{TerminalContent as H}from"./Terminal-CMQFmHnn.js";import"./provider-Bq0ScH3v.js";import"./sse-QSbhyq9A.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-D4vuKzOL.js";import"./DocumentFocusViewer-CetjnYut.js";import"./createLucideIcon-Da0lq809.js";import"./TextDocumentSurface-B29xZNlI.js";import"./file-text-BGVkHS4_.js";import"./x-DuzAbpk5.js";import"./chevron-right-CV7sEVBS.js";import"./code-xml-CPzpZkhu.js";import"./arrow-left-B0CdJdAC.js";import"./arrow-right-YRBoTTyf.js";import"./scout-voice-BT3gYDhU.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-feLCB3Zm.js";import"./NewChatComposer-BPsg8shF.js";import"./text-B2UZi3l9.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-Be0T8xv2.js";import"./conversation-model-CIzM7aXT.js";import"./time-Dhsh_2EG.js";import"./index-CD2foMB8.js";import"./HarnessMark-CEzmPFHC.js";import"./NewChatOrigin-CCiPg_WR.js";import"./chevron-down-Jh540uf3.js";import"./search-HmdKXdtR.js";import"./chunk-HRAB3GC3-BYQZ1LOn.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-D4dHTRkt.js";/* empty css */import"./clipboard-e3fSpeo7.js";import"./terminal-relay-C2TUIuh1.js";import"./HerdrSession-BDLa_rrK.js";import"./usePersistentState-InmPXIN4.js";import"./terminal-DNZTCr6a.js";import"./refresh-cw-C4E58VJK.js";import"./check-BdovFDz8.js";import"./copy-DQAM0eSY.js";import"./eye-B908WSFH.js";import"./session-table-Djain1Qr.js";import"./TerminalRelay-CIHlLVf1.js";import"./terminal-takeover-BArLfNtd.js";import"./BackToPicker-CXsbxbHM.js";import"./TmuxPeek-eVfqPB4m.js";/* empty css */import"./plus-ZReaTFF-.js";import"./zap-CocRNtyr.js";import"./external-link-BheHazeW.js";function g(){const t=new URLSearchParams(window.location.search).get("route")?.trim()||"/terminal",s=j(t);return s.view==="terminal"?s:{view:"terminal"}}function S(o){const t=new URLSearchParams(window.location.search);return t.set("route",D(o)),t.has("profile")||t.set("profile","macos.terminal"),`${window.location.pathname}?${t.toString()}${window.location.hash}`}function Oe(){const[o,t]=e.useState(()=>g()),s=!!(o.terminalBackend||o.agentId||o.terminalSessionId||o.terminalSurfaceKey);e.useEffect(()=>{const i=()=>t(g());return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const n=e.useCallback(i=>{if(i.view!=="terminal"){const p={view:"terminal"},a=S(p);window.history.pushState(null,"",a),t(p);return}const c=S(i);window.history.pushState(null,"",c),t(i)},[]);return l.jsx(M,{route:o,navigate:n,children:l.jsx("div",{className:`s-terminal-embed${s?" s-terminal-embed--surface":""}`,children:l.jsx(H,{route:o,navigate:n})})})}function M({route:o,navigate:t,children:s}){const[n,i]=e.useState([]),[c,p]=e.useState({status:"checking",message:null,lastCheckedAt:null}),a=e.useRef(null),u=e.useMemo(()=>A(),[]),f=e.useMemo(()=>C(),[]),b=e.useMemo(()=>({...u==="light"?y:T,...f??{}}),[u,f]),w=e.useCallback(()=>{p({status:"online",message:null,lastCheckedAt:Date.now()})},[]),h=e.useCallback(r=>{p({status:"offline",message:L(r),lastCheckedAt:Date.now()})},[]),m=e.useCallback(async()=>{if(a.current)return a.current;const r=(async()=>{try{i(await P("/api/agents")),w()}catch(d){h(d)}})();a.current=r;try{await r}finally{a.current=null}},[h,w]);e.useEffect(()=>{m()},[m]),e.useEffect(()=>{const r=()=>{document.visibilityState!=="hidden"&&m()},d=window.setInterval(r,15e3);return window.addEventListener("focus",r),document.addEventListener("visibilitychange",r),()=>{window.clearInterval(d),window.removeEventListener("focus",r),document.removeEventListener("visibilitychange",r)}},[m]);const v=e.useMemo(()=>n.filter(r=>I(r.state)).length,[n]),E=e.useMemo(()=>({route:o,navigate:t,navigateBack:()=>{typeof window<"u"&&window.history.back()},canNavigateBack:typeof window<"u"&&window.history.length>1,agents:n,agentsLoaded:c.status!=="checking",onlineCount:v,apiConnection:c,appearanceDetails:k,updateAppearanceDetails:()=>{},reload:m,onboarding:null,operatorName:null,refreshOnboarding:async()=>{},onboardingSkipped:!0,skipOnboarding:()=>{},settingsOpen:!1,openSettings:()=>{},closeSettings:()=>{},scoutbotAgentId:"scoutbot",scoutbotConversationId:null,applyScoutbotUiAction:()=>{},selectedBrokerAttempt:null,inspectBrokerAttempt:()=>{},clearBrokerAttempt:()=>{},selectedKnowledgeHit:null,selectedKnowledgeQuery:"",inspectKnowledgeHit:()=>{},clearKnowledgeHit:()=>{},focusedSession:null,focusSession:()=>{},openFilePreview:()=>{},closeFilePreview:()=>{},openContextCapture:()=>{},closeContextCapture:()=>{}}),[n,c,t,v,m,o]);return l.jsx(x.Provider,{value:E,children:l.jsx("div",{"data-scout-theme":u,"data-scout-theme-mode":u,style:b,children:l.jsx(R,{children:s})})})}export{Oe as TerminalEmbedScreen};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/xterm-
|
|
2
|
-
import{r as e,j as o,_ as Ne}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/xterm-xQGYNyB-.js","assets/index-NRbRrZw-.js","assets/index-DzlEgstl.css","assets/addon-fit-CcaylYTX.js","assets/addon-webgl-B37iuzOG.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e,j as o,_ as Ne}from"./index-NRbRrZw-.js";const Ae=["terminal:ack"];function st(u={}){const{url:m="ws://localhost:3600",healthUrl:y,token:x,systemPrompt:S,cwd:Re,workspaceFiles:ne,autoConnect:he=!1,sessionKey:ge,orphanTTL:oe,backend:$,controlMode:p="owner",tmuxSession:F,zellijSession:se,zellijSocketDir:ce,agent:le,provider:K,model:J,flowControl:ue}=u,O=ge?`hudson.relay.${ge}`:null,Ce=()=>{if(!O)return null;try{const r=localStorage.getItem(O);if(!r)return null;if(r.startsWith("{")){const c=JSON.parse(r);return typeof c.id!="string"?null:{id:c.id,reconnectToken:typeof c.reconnectToken=="string"?c.reconnectToken:null}}return{id:r,reconnectToken:null}}catch{return null}},l=e.useCallback((r,c=null)=>{if(O)try{r?localStorage.setItem(O,JSON.stringify({id:r,reconnectToken:c})):localStorage.removeItem(O)}catch{}},[O]),[de,k]=e.useState("disconnected"),[Ee,ie]=e.useState(null),[ye,L]=e.useState(null),[fe,h]=e.useState(null),[me,Te]=e.useState(Re||"~"),R=e.useRef(null),X=e.useRef(null),P=e.useRef({cols:80,rows:24}),I=e.useRef(!1),M=e.useRef([]),G=e.useRef(0),W=e.useRef(0),Y=e.useRef(0),V=e.useRef(me);V.current=me;const ae=e.useRef(!1),H=e.useRef(null);ae.current||(ae.current=!0,H.current=Ce());const j=e.useRef(H.current?.id??null),i=e.useRef(H.current?.reconnectToken??null),Q=e.useRef(null),B=e.useRef(new Set),Z=ue?.maxBufferedBytes??512*1024,d=e.useCallback(r=>{const c=R.current;c&&c.readyState===WebSocket.OPEN&&c.send(JSON.stringify(r))},[]),q=e.useCallback((r,c)=>{typeof r=="number"&&c===Y.current&&d({type:"terminal:ack",seq:r})},[d]),ee=e.useCallback(()=>{Y.current+=1,M.current=[],G.current=0},[]),z=e.useCallback((r,c=null)=>{const A=Y.current;if(!r){q(c,A);return}let g=!1;const N=()=>{g||(g=!0,q(c,A))};if(Q.current)try{Q.current(r,N)}catch{N()}else for(M.current.push({data:r,seq:c,ack:N}),G.current+=r.length;G.current>Z&&M.current.length>0;){const f=M.current.shift();if(!f)break;G.current-=f.data.length,f.ack()}if(B.current.size>0)for(const f of B.current)try{f(r)}catch{}},[q,Z]),C=e.useCallback(()=>{const r=R.current;r&&(r.close(),R.current=null)},[]),v=e.useCallback(()=>{W.current+=1,X.current&&(clearTimeout(X.current),X.current=null),C(),I.current=!1,k("disconnected")},[C]),te=e.useCallback(()=>{const r=V.current;return{type:"session:init",cols:P.current.cols,rows:P.current.rows,clientCapabilities:[...Ae],...S?{systemPrompt:S}:{},...r?{cwd:r}:{},...ne?{workspaceFiles:ne}:{},...oe?{orphanTTL:oe}:{},...$?{backend:$}:{},...p!=="owner"?{controlMode:p}:{},...F?{tmuxSession:F}:{},...se?{zellijSession:se}:{},...ce?{zellijSocketDir:ce}:{},...le?{agent:le}:{},...K?{provider:K}:{},...J?{model:J}:{}}},[le,$,p,J,oe,K,S,F,ne,se,ce]),_=e.useCallback(()=>{I.current||(I.current=!0,j.current?d({type:"session:reconnect",sessionId:j.current,...i.current?{reconnectToken:i.current}:{},cols:P.current.cols,rows:P.current.rows,clientCapabilities:[...Ae],...p!=="owner"?{controlMode:p}:{}}):d(te()))},[d,te,p]),D=e.useCallback(async()=>{const r=W.current+1;W.current=r,C(),Y.current+=1,I.current=!1,k("connecting"),L(null),h(null);const c=y||`${m.replace(/^ws(s?):\/\//,"http$1://")}/health`;try{const f=await fetch(c,{signal:AbortSignal.timeout(2e3)});if(!f.ok)throw new Error(`Relay health check failed: ${f.status}`)}catch{if(W.current!==r)return;k("error"),L("Relay service is not running");return}if(W.current!==r)return;C();const A=x?`${m}${m.includes("?")?"&":"?"}token=${encodeURIComponent(x)}`:m,g=new WebSocket(A);R.current=g;const N=()=>W.current===r&&R.current===g;g.onopen=()=>{if(!N()){g.close();return}_()},g.onmessage=f=>{if(N())try{const b=JSON.parse(f.data);switch(b.type){case"session:ready":j.current=b.sessionId,i.current=typeof b.reconnectToken=="string"?b.reconnectToken:null,l(b.sessionId,i.current),ie(b.sessionId),k("connected"),L(null),h(null);break;case"session:expired":{j.current=null,i.current=null,l(null),I.current=!1,ee(),z("\x1B[2J\x1B[H",null),d(te()),I.current=!0;break}case"session:error":k("error"),L(b.error||"Session failed to start");break;case"terminal:data":z(b.data||"",typeof b.seq=="number"?b.seq:null);break;case"session:exit":j.current=null,i.current=null,l(null),ee(),ie(null),h(b.exitCode??null),b.exitCode!==0?(k("error"),L(b.reason||`Process exited with code ${b.exitCode}`)):k("disconnected");break;case"session:detached":j.current=null,i.current=null,l(null),ie(null);break}}catch{}},g.onclose=()=>{N()&&(R.current=null,I.current=!1,k(f=>f==="error"?f:"disconnected"))},g.onerror=()=>{N()&&(k("error"),L("Could not connect to relay"))}},[m,y,x,_,C,d,z,te,l,ee]),ve=e.useCallback(r=>{p!=="observe"&&d({type:"terminal:input",data:r})},[p,d]),we=e.useCallback(r=>{p!=="observe"&&d({type:"terminal:input",data:r+"\r"})},[p,d]),ke=e.useCallback((r,c)=>{P.current={cols:r,rows:c},I.current&&d({type:"terminal:resize",cols:r,rows:c})},[d]),xe=e.useCallback(r=>{if(Q.current=r,!r||M.current.length===0)return;const c=M.current;M.current=[],G.current=0;for(const A of c)try{r(A.data,A.ack)}catch{A.ack()}},[]),E=e.useCallback(r=>(B.current.add(r),()=>{B.current.delete(r)}),[]);e.useEffect(()=>(he&&D(),()=>{v()}),[]);const T=e.useCallback(()=>{v(),j.current=null,i.current=null,ie(null),l(null),ee(),L(null),h(null),X.current=setTimeout(()=>{X.current=null,D()},200)},[v,D,l,ee]);return{status:de,sessionId:Ee,error:ye,exitCode:fe,cwd:me,controlMode:p,setCwd:Te,onData:xe,subscribeData:E,sendInput:ve,sendLine:we,resize:ke,connect:D,disconnect:v,restart:T}}const We={titleBarInset:0,dragRegionProps:{},onInteractiveMouseDown:void 0,isSSR:!0,apiBaseUrl:"",serviceApiUrl:""},$e=e.createContext(We);function Ke(){return e.useContext($e)}const Je=e.createContext(null);function Xe(){return e.useContext(Je)}const Oe="hudson:terminal:voice-transcript",Le="hudson:terminal:voice-submit",ct='[data-hudson-terminal-drawer-content="true"]',Ge=e.createContext(void 0),Ye={background:"#091112",foreground:"#d7e5e2",cursor:"#35d7d0",cursorAccent:"#091112",selectionBackground:"#173739",selectionForeground:"#f3fbf9",black:"#091112",red:"#ff6b6b",green:"#35d07f",yellow:"#f5c451",blue:"#62b4ff",magenta:"#ff7ab6",cyan:"#32d5ca",white:"#d7e5e2",brightBlack:"#667777",brightRed:"#ff8f8f",brightGreen:"#5ee79f",brightYellow:"#ffd36e",brightBlue:"#8dccff",brightMagenta:"#ff9fca",brightCyan:"#67eee3",brightWhite:"#ffffff"},Qe={background:"#f7faf9",foreground:"#111a19",cursor:"#006f6a",cursorAccent:"#f7faf9",selectionBackground:"#c0e7e2",selectionForeground:"#0d1716",black:"#111a19",red:"#9f1f18",green:"#006c46",yellow:"#704600",blue:"#075985",magenta:"#9d174d",cyan:"#006f6a",white:"#dbe5e2",brightBlack:"#52635f",brightRed:"#c2271f",brightGreen:"#007f55",brightYellow:"#865b00",brightBlue:"#0369a1",brightMagenta:"#be185d",brightCyan:"#007f89",brightWhite:"#ffffff"},Ze=`
|
|
3
3
|
.xterm { cursor: text; position: relative; user-select: none; -ms-user-select: none; -webkit-user-select: none; }
|
|
4
4
|
.xterm.focus, .xterm:focus { outline: none; }
|
|
5
5
|
.xterm .xterm-helpers { position: absolute; top: 0; z-index: 5; }
|
|
@@ -43,4 +43,4 @@ import{r as e,j as o,_ as Ne}from"./index-Bli6bTLU.js";const Ae=["terminal:ack"]
|
|
|
43
43
|
.xterm .xterm-scrollable-element > .shadow { position: absolute; display: none; }
|
|
44
44
|
.xterm .xterm-scrollable-element > .shadow.top { display: block; top: 0; left: 3px; height: 3px; width: 100%; }
|
|
45
45
|
.xterm .xterm-scrollable-element > .shadow.left { display: block; top: 3px; left: 0; height: 100%; width: 3px; }
|
|
46
|
-
`;function qe(){if(typeof document>"u"||document.querySelector("[data-xterm-css]"))return;const u=document.createElement("style");u.setAttribute("data-xterm-css",""),u.textContent=Ze,document.head.appendChild(u)}function Se(u,m){if(typeof u!="object"||u===null)return;const y=u,x=y[m];if(x)return x;const S=y.default;if(!(typeof S!="object"||S===null))return S[m]}function Pe(u,m){if(!u||m&&!u.closest(m))return!1;const y=u.getBoundingClientRect();if(y.width<=0||y.height<=0)return!1;const x=window.getComputedStyle(u);return x.display!=="none"&&x.visibility!=="hidden"}const et="\x1B[13;2u",Me="\r";function tt(u){return new Promise((m,y)=>{const x=new FileReader;x.onload=()=>{const S=x.result;m(S.split(",")[1])},x.onerror=y,x.readAsDataURL(u)})}function rt({relay:u,fontSize:m=12,fontFamily:y="'JetBrains Mono', 'Hack Nerd Font', monospace",scrollback:x=5e3,renderer:S="auto",readOnly:Re=!1,ariaLabel:ne="Terminal",className:he,style:ge,colorScheme:oe="auto",configItems:$,onOpenSettings:p,onStartService:F,quiet:se=!1,voiceVisibilityScope:ce,imageUploadUrl:le,onReady:K,onDispose:J,onResize:ue,onRendererChange:O},Ce){const{status:l,error:de,exitCode:k,cwd:Ee,setCwd:ie,sendInput:ye,resize:L,onData:fe,connect:h,disconnect:me,controlMode:Te="owner"}=u,R=Re||Te==="observe",X=e.useContext(Ge),P=ce===!1?void 0:ce??X,[I,M]=e.useState(!1),{apiBaseUrl:G}=Ke(),W=Xe(),Y=oe==="auto"?W?.resolvedTheme==="light"?"light":"dark":oe,V=Y==="light"?Qe:Ye,ae=Y==="light"?4.5:3,H=e.useRef(null),j=e.useRef(null),i=e.useRef(null),Q=e.useRef(null),B=e.useRef(null),Z=e.useRef(!1),[d,q]=e.useState(!1),[ee,z]=e.useState(!1),C=e.useRef(0),v=e.useRef(R),te=e.useRef(null),_=e.useRef(null),D=e.useRef(null),ve=e.useRef(K),we=e.useRef(J),ke=e.useRef(ue),xe=e.useRef(O);e.useEffect(()=>{v.current=R,R&&(B.current=null,Z.current=!1,C.current=0,z(!1))},[R]),e.useEffect(()=>{ve.current=K},[K]),e.useEffect(()=>{we.current=J},[J]),e.useEffect(()=>{ke.current=ue},[ue]),e.useEffect(()=>{xe.current=O},[O]),e.useEffect(()=>{const t=H.current;if(!t)return;const n=s=>{s.key===" "&&!s.metaKey&&!s.ctrlKey&&!s.altKey&&s.stopPropagation()};return t.addEventListener("keydown",n),()=>t.removeEventListener("keydown",n)},[]);const E=le===void 0?`${G}/api/relay/upload`:le,T=e.useCallback(t=>{v.current||ye(t)},[ye]),r=e.useCallback((t,n)=>{if(!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0)return;const s=te.current;s&&s.cols===t&&s.rows===n||(te.current={cols:t,rows:n},L(t,n),ke.current?.(t,n))},[L]),c=e.useCallback(()=>{const t=Q.current,n=i.current;if(!t||!n)return null;try{t.fit()}catch{return null}const s={cols:n.cols,rows:n.rows};return r(s.cols,s.rows),s},[r]),A=e.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,c()}))},[c]);e.useImperativeHandle(Ce,()=>({focus:()=>{i.current?.focus()},fit:c,clear:()=>{i.current?.clear()},getDimensions:()=>{const t=i.current;return t?{cols:t.cols,rows:t.rows}:null},getTerminal:()=>i.current}),[c]);const g=e.useCallback(t=>{const n=t.transcript.replace(/\s+/g," ").trim();n&&T(t.submit?`${n}${Me}`:n)},[T]),N=e.useCallback(()=>{T(Me)},[T]);e.useEffect(()=>{const t=n=>{if(v.current||!Pe(H.current,P))return;const s=n.detail;if(!(!s||typeof s.transcript!="string")){if(l==="connected"){g(s);return}B.current=s,l!=="connecting"&&h()}};return window.addEventListener(Oe,t),()=>window.removeEventListener(Oe,t)},[h,g,l,P]),e.useEffect(()=>{if(l!=="connected"||!B.current)return;const t=B.current;B.current=null,g(t)},[g,l]),e.useEffect(()=>{const t=()=>{if(!v.current&&Pe(H.current,P)){if(l==="connected"){N();return}Z.current=!0,l!=="connecting"&&h()}};return window.addEventListener(Le,t),()=>window.removeEventListener(Le,t)},[h,N,l,P]),e.useEffect(()=>{l!=="connected"||!Z.current||(Z.current=!1,N())},[N,l]);const f=e.useCallback(async t=>{if(!E)return null;try{const n=await tt(t),s=await fetch(E,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t.name,data:n})}),{path:w}=await s.json();return w||null}catch(n){return console.error("File upload failed:",n),null}},[E]);e.useEffect(()=>{const t=H.current;if(!t)return;const n=async s=>{if(!s.clipboardData||!E)return;const w=Array.from(s.clipboardData.items).filter(U=>U.type.startsWith("image/"));if(w.length!==0&&(s.preventDefault(),s.stopPropagation(),!v.current))for(const U of w){const pe=U.getAsFile();if(!pe)continue;const be=await f(pe);be&&T(be)}};return t.addEventListener("paste",n),()=>t.removeEventListener("paste",n)},[T,f,E]);const b=e.useCallback(t=>{if(t.preventDefault(),v.current||!E){t.dataTransfer.dropEffect="none";return}t.dataTransfer.dropEffect="copy"},[E]),Be=e.useCallback(t=>{if(t.preventDefault(),v.current||!E){C.current=0,z(!1);return}C.current++,t.dataTransfer.types.includes("Files")&&z(!0)},[E]),ze=e.useCallback(t=>{if(t.preventDefault(),v.current){C.current=0,z(!1);return}C.current--,C.current===0&&z(!1)},[]),Fe=e.useCallback(async t=>{if(t.preventDefault(),C.current=0,z(!1),v.current||!E)return;const n=Array.from(t.dataTransfer.files).filter(s=>s.type.startsWith("image/"));if(n.length!==0)for(const s of n){const w=await f(s);w&&T(w)}},[T,f,E]);e.useEffect(()=>{let t=!1,n=null;q(!1);async function s(){const[w,U,pe]=await Promise.all([Ne(()=>import("./xterm-D6dE_wMr.js").then(a=>a.x),__vite__mapDeps([0,1,2])),Ne(()=>import("./addon-fit-Celjj2yn.js").then(a=>a.a),__vite__mapDeps([3,1,2])),Ne(()=>import("./addon-webgl-Cu4tJ21-.js").then(a=>a.a),__vite__mapDeps([4,1,2])).catch(()=>null)]),be=Se(w,"Terminal"),je=Se(U,"FitAddon"),_e=pe?Se(pe,"WebglAddon"):void 0;if(!be||!je){console.error("[TerminalRelay] @xterm/xterm or @xterm/addon-fit missing constructors",{xtermMod:w,fitMod:U});return}if(qe(),t||!j.current)return;n=new be({fontSize:m,fontFamily:y,theme:V,minimumContrastRatio:ae,cursorBlink:!0,cursorStyle:"bar",allowTransparency:!0,scrollback:x,convertEol:!1,allowProposedApi:!0});const De=new je;n.loadAddon(De),n.open(j.current),i.current=n,Q.current=De;let Ie="dom";if(S!=="dom"&&_e)try{const a=new _e;a.onContextLoss(()=>{a.dispose(),xe.current?.("dom")}),n.loadAddon(a),Ie="webgl"}catch{}xe.current?.(Ie),c(),n.attachCustomKeyEventHandler(a=>a.type==="keydown"&&a.key==="Enter"&&a.shiftKey&&!a.ctrlKey&&!a.altKey&&!a.metaKey?(a.preventDefault(),a.stopPropagation(),T(et),!1):!0),n.onData(a=>{T(a)}),q(!0),ve.current?.(n)}return s(),()=>{t=!0,q(!1),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),n&&(n.dispose(),i.current=null,Q.current=null),we.current?.()}},[c,S,x,T]),e.useEffect(()=>{const t=i.current;t&&(t.options.fontSize=m,t.options.fontFamily=y,c())},[c,m,y]),e.useEffect(()=>{const t=i.current;t&&(t.options.theme=V,t.options.minimumContrastRatio=ae)},[ae,V]),e.useEffect(()=>{if(d)return fe((t,n)=>{let s=!1;const w=()=>{s||(s=!0,n())},U=i.current;if(!U){w();return}try{U.write(t,w)}catch{w()}}),()=>{fe(null)}},[d,fe]),e.useEffect(()=>{const t=j.current;if(!t||!d)return;const n=new ResizeObserver(()=>{A()});return n.observe(t),()=>{n.disconnect(),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null)}},[d,A]),e.useEffect(()=>{l==="connected"&&i.current&&i.current.focus()},[l]);const Ve=e.useCallback(()=>{l==="connected"&&i.current&&i.current.focus()},[l]),He=l==="error"&&de==="Relay service is not running",Ue=e.useCallback(async()=>{if(F){M(!0);try{await F()&&(D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{D.current=null,h()},500))}finally{M(!1)}}},[F,h]);e.useEffect(()=>()=>{D.current&&(clearTimeout(D.current),D.current=null)},[]);let re=null;return He?re=o.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/10 border border-amber-500/20 flex items-center justify-center",children:o.jsx("span",{className:"text-amber-400 text-[14px]",children:"!"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[12px] text-foreground font-medium mb-1",children:"Relay service not running"}),o.jsx("div",{className:"text-[11px] text-muted-foreground/80 leading-relaxed",children:F?"Start the relay service to open a terminal session.":"Start the relay service from the Workspace Manager."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[F&&o.jsx("button",{type:"button",onClick:Ue,disabled:I,className:"text-[11px] px-4 py-1.5 rounded-full border border-accent/30 text-accent hover:bg-accent/10 transition-colors font-medium disabled:opacity-50",children:I?"Starting":"Start Service"}),o.jsx("button",{type:"button",onClick:()=>h(),className:"text-[11px] px-3 py-1.5 rounded-full border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Retry"}),p&&o.jsx("button",{type:"button",onClick:p,className:"text-[11px] px-3 py-1.5 rounded-full border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Settings"})]})]}):l==="error"&&de?re=o.jsxs("div",{className:"flex flex-col items-center gap-3 max-w-md text-center px-4",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-red-500/10 flex items-center justify-center",children:o.jsx("span",{className:"text-red-400 text-sm",children:"!"})}),o.jsx("span",{className:"text-red-400 text-[12px] font-medium",children:"Session failed"}),o.jsx("code",{className:"text-[11px] text-muted-foreground bg-muted/80 px-3 py-2 rounded-md whitespace-pre-wrap leading-relaxed max-h-32 overflow-y-auto w-full text-left",children:de}),k!==null&&k!==0&&o.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["Exit code ",k]}),o.jsx("button",{type:"button",onClick:()=>h(),className:"text-[11px] px-3 py-1 rounded-full border border-cyan-500/30 text-cyan-400 hover:bg-cyan-500/10 transition-colors",children:"Retry"})]}):l==="disconnected"&&!se?re=o.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-muted border border-border flex items-center justify-center",children:o.jsx("span",{className:"text-muted-foreground/80 text-[14px]",children:"▷"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[12px] text-foreground font-medium mb-1",children:"Terminal relay disconnected"}),o.jsx("div",{className:"text-[11px] text-muted-foreground/80 leading-relaxed",children:"Set working directory and connect."})]}),o.jsxs("form",{className:"w-full",onSubmit:t=>{t.preventDefault(),h()},children:[o.jsx("label",{className:"text-[10px] font-mono text-muted-foreground/80 uppercase tracking-wider mb-1 block text-left",children:"Working Directory"}),o.jsx("input",{type:"text",value:Ee,onChange:t=>ie(t.target.value),placeholder:"~/dev/my-project",className:"w-full bg-muted/80 border border-border/50 rounded px-3 py-1.5 text-[11px] font-mono text-foreground placeholder:text-muted-foreground/60 outline-none focus:border-accent/40 transition-colors",spellCheck:!1,autoComplete:"off"})]}),$&&$.length>0&&o.jsx("div",{className:"w-full grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[10px] font-mono bg-muted/60 border border-border/40 rounded-md px-3 py-2",children:$.map(t=>o.jsxs("div",{className:"contents",children:[o.jsx("span",{className:"text-muted-foreground/80",children:t.label}),o.jsx("span",{className:"text-muted-foreground truncate text-left",children:t.value})]},t.label))}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{type:"button",onClick:()=>h(),className:"text-[11px] px-4 py-1.5 rounded-full border border-cyan-500/30 text-cyan-400 hover:bg-cyan-500/10 transition-colors font-medium",children:"Connect"}),p&&o.jsx("button",{type:"button",onClick:p,className:"text-[11px] px-3 py-1.5 rounded-full border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Settings"})]})]}):l==="connecting"&&!se&&(re=o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx("div",{className:"w-6 h-6 border-2 border-muted-foreground/30 border-t-cyan-500 rounded-full animate-spin"}),o.jsx("span",{className:"text-[12px] text-muted-foreground",children:"Connecting to relay"}),o.jsx("button",{type:"button",onClick:()=>{me()},className:"text-[10px] px-3 py-1 rounded-full border border-border text-muted-foreground/80 hover:text-foreground hover:bg-muted transition-colors",children:"Cancel"})]})),o.jsxs("div",{ref:H,className:he?`relative flex flex-col h-full overflow-hidden ${he}`:"relative flex flex-col h-full overflow-hidden",style:ge,role:"application","aria-label":R?`${ne} (read only)`:ne,"data-readonly":R?"true":void 0,onClick:Ve,onDragOver:b,onDragEnter:Be,onDragLeave:ze,onDrop:Fe,children:[re&&o.jsx("div",{className:"flex items-center justify-center h-full font-mono text-[12px] absolute inset-0 z-10 bg-background/95",children:re}),ee&&o.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-cyan-500/10 border-2 border-dashed border-cyan-500/50 rounded pointer-events-none",children:o.jsx("span",{className:"text-cyan-400 font-mono text-sm",children:"Drop image to get path"})}),o.jsx("div",{ref:j,className:"flex-1 min-h-0 min-w-0 overflow-hidden",style:{visibility:re?"hidden":"visible",backgroundColor:V.background,"--hud-terminal-bg":V.background,"--hud-terminal-fg":V.foreground}})]})}const nt=e.forwardRef(rt);nt.displayName="TerminalRelay";export{ct as H,nt as T,Ke as a,Ge as b,st as u};
|
|
46
|
+
`;function qe(){if(typeof document>"u"||document.querySelector("[data-xterm-css]"))return;const u=document.createElement("style");u.setAttribute("data-xterm-css",""),u.textContent=Ze,document.head.appendChild(u)}function Se(u,m){if(typeof u!="object"||u===null)return;const y=u,x=y[m];if(x)return x;const S=y.default;if(!(typeof S!="object"||S===null))return S[m]}function Pe(u,m){if(!u||m&&!u.closest(m))return!1;const y=u.getBoundingClientRect();if(y.width<=0||y.height<=0)return!1;const x=window.getComputedStyle(u);return x.display!=="none"&&x.visibility!=="hidden"}const et="\x1B[13;2u",Me="\r";function tt(u){return new Promise((m,y)=>{const x=new FileReader;x.onload=()=>{const S=x.result;m(S.split(",")[1])},x.onerror=y,x.readAsDataURL(u)})}function rt({relay:u,fontSize:m=12,fontFamily:y="'JetBrains Mono', 'Hack Nerd Font', monospace",scrollback:x=5e3,renderer:S="auto",readOnly:Re=!1,ariaLabel:ne="Terminal",className:he,style:ge,colorScheme:oe="auto",configItems:$,onOpenSettings:p,onStartService:F,quiet:se=!1,voiceVisibilityScope:ce,imageUploadUrl:le,onReady:K,onDispose:J,onResize:ue,onRendererChange:O},Ce){const{status:l,error:de,exitCode:k,cwd:Ee,setCwd:ie,sendInput:ye,resize:L,onData:fe,connect:h,disconnect:me,controlMode:Te="owner"}=u,R=Re||Te==="observe",X=e.useContext(Ge),P=ce===!1?void 0:ce??X,[I,M]=e.useState(!1),{apiBaseUrl:G}=Ke(),W=Xe(),Y=oe==="auto"?W?.resolvedTheme==="light"?"light":"dark":oe,V=Y==="light"?Qe:Ye,ae=Y==="light"?4.5:3,H=e.useRef(null),j=e.useRef(null),i=e.useRef(null),Q=e.useRef(null),B=e.useRef(null),Z=e.useRef(!1),[d,q]=e.useState(!1),[ee,z]=e.useState(!1),C=e.useRef(0),v=e.useRef(R),te=e.useRef(null),_=e.useRef(null),D=e.useRef(null),ve=e.useRef(K),we=e.useRef(J),ke=e.useRef(ue),xe=e.useRef(O);e.useEffect(()=>{v.current=R,R&&(B.current=null,Z.current=!1,C.current=0,z(!1))},[R]),e.useEffect(()=>{ve.current=K},[K]),e.useEffect(()=>{we.current=J},[J]),e.useEffect(()=>{ke.current=ue},[ue]),e.useEffect(()=>{xe.current=O},[O]),e.useEffect(()=>{const t=H.current;if(!t)return;const n=s=>{s.key===" "&&!s.metaKey&&!s.ctrlKey&&!s.altKey&&s.stopPropagation()};return t.addEventListener("keydown",n),()=>t.removeEventListener("keydown",n)},[]);const E=le===void 0?`${G}/api/relay/upload`:le,T=e.useCallback(t=>{v.current||ye(t)},[ye]),r=e.useCallback((t,n)=>{if(!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0)return;const s=te.current;s&&s.cols===t&&s.rows===n||(te.current={cols:t,rows:n},L(t,n),ke.current?.(t,n))},[L]),c=e.useCallback(()=>{const t=Q.current,n=i.current;if(!t||!n)return null;try{t.fit()}catch{return null}const s={cols:n.cols,rows:n.rows};return r(s.cols,s.rows),s},[r]),A=e.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,c()}))},[c]);e.useImperativeHandle(Ce,()=>({focus:()=>{i.current?.focus()},fit:c,clear:()=>{i.current?.clear()},getDimensions:()=>{const t=i.current;return t?{cols:t.cols,rows:t.rows}:null},getTerminal:()=>i.current}),[c]);const g=e.useCallback(t=>{const n=t.transcript.replace(/\s+/g," ").trim();n&&T(t.submit?`${n}${Me}`:n)},[T]),N=e.useCallback(()=>{T(Me)},[T]);e.useEffect(()=>{const t=n=>{if(v.current||!Pe(H.current,P))return;const s=n.detail;if(!(!s||typeof s.transcript!="string")){if(l==="connected"){g(s);return}B.current=s,l!=="connecting"&&h()}};return window.addEventListener(Oe,t),()=>window.removeEventListener(Oe,t)},[h,g,l,P]),e.useEffect(()=>{if(l!=="connected"||!B.current)return;const t=B.current;B.current=null,g(t)},[g,l]),e.useEffect(()=>{const t=()=>{if(!v.current&&Pe(H.current,P)){if(l==="connected"){N();return}Z.current=!0,l!=="connecting"&&h()}};return window.addEventListener(Le,t),()=>window.removeEventListener(Le,t)},[h,N,l,P]),e.useEffect(()=>{l!=="connected"||!Z.current||(Z.current=!1,N())},[N,l]);const f=e.useCallback(async t=>{if(!E)return null;try{const n=await tt(t),s=await fetch(E,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t.name,data:n})}),{path:w}=await s.json();return w||null}catch(n){return console.error("File upload failed:",n),null}},[E]);e.useEffect(()=>{const t=H.current;if(!t)return;const n=async s=>{if(!s.clipboardData||!E)return;const w=Array.from(s.clipboardData.items).filter(U=>U.type.startsWith("image/"));if(w.length!==0&&(s.preventDefault(),s.stopPropagation(),!v.current))for(const U of w){const pe=U.getAsFile();if(!pe)continue;const be=await f(pe);be&&T(be)}};return t.addEventListener("paste",n),()=>t.removeEventListener("paste",n)},[T,f,E]);const b=e.useCallback(t=>{if(t.preventDefault(),v.current||!E){t.dataTransfer.dropEffect="none";return}t.dataTransfer.dropEffect="copy"},[E]),Be=e.useCallback(t=>{if(t.preventDefault(),v.current||!E){C.current=0,z(!1);return}C.current++,t.dataTransfer.types.includes("Files")&&z(!0)},[E]),ze=e.useCallback(t=>{if(t.preventDefault(),v.current){C.current=0,z(!1);return}C.current--,C.current===0&&z(!1)},[]),Fe=e.useCallback(async t=>{if(t.preventDefault(),C.current=0,z(!1),v.current||!E)return;const n=Array.from(t.dataTransfer.files).filter(s=>s.type.startsWith("image/"));if(n.length!==0)for(const s of n){const w=await f(s);w&&T(w)}},[T,f,E]);e.useEffect(()=>{let t=!1,n=null;q(!1);async function s(){const[w,U,pe]=await Promise.all([Ne(()=>import("./xterm-xQGYNyB-.js").then(a=>a.x),__vite__mapDeps([0,1,2])),Ne(()=>import("./addon-fit-CcaylYTX.js").then(a=>a.a),__vite__mapDeps([3,1,2])),Ne(()=>import("./addon-webgl-B37iuzOG.js").then(a=>a.a),__vite__mapDeps([4,1,2])).catch(()=>null)]),be=Se(w,"Terminal"),je=Se(U,"FitAddon"),_e=pe?Se(pe,"WebglAddon"):void 0;if(!be||!je){console.error("[TerminalRelay] @xterm/xterm or @xterm/addon-fit missing constructors",{xtermMod:w,fitMod:U});return}if(qe(),t||!j.current)return;n=new be({fontSize:m,fontFamily:y,theme:V,minimumContrastRatio:ae,cursorBlink:!0,cursorStyle:"bar",allowTransparency:!0,scrollback:x,convertEol:!1,allowProposedApi:!0});const De=new je;n.loadAddon(De),n.open(j.current),i.current=n,Q.current=De;let Ie="dom";if(S!=="dom"&&_e)try{const a=new _e;a.onContextLoss(()=>{a.dispose(),xe.current?.("dom")}),n.loadAddon(a),Ie="webgl"}catch{}xe.current?.(Ie),c(),n.attachCustomKeyEventHandler(a=>a.type==="keydown"&&a.key==="Enter"&&a.shiftKey&&!a.ctrlKey&&!a.altKey&&!a.metaKey?(a.preventDefault(),a.stopPropagation(),T(et),!1):!0),n.onData(a=>{T(a)}),q(!0),ve.current?.(n)}return s(),()=>{t=!0,q(!1),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),n&&(n.dispose(),i.current=null,Q.current=null),we.current?.()}},[c,S,x,T]),e.useEffect(()=>{const t=i.current;t&&(t.options.fontSize=m,t.options.fontFamily=y,c())},[c,m,y]),e.useEffect(()=>{const t=i.current;t&&(t.options.theme=V,t.options.minimumContrastRatio=ae)},[ae,V]),e.useEffect(()=>{if(d)return fe((t,n)=>{let s=!1;const w=()=>{s||(s=!0,n())},U=i.current;if(!U){w();return}try{U.write(t,w)}catch{w()}}),()=>{fe(null)}},[d,fe]),e.useEffect(()=>{const t=j.current;if(!t||!d)return;const n=new ResizeObserver(()=>{A()});return n.observe(t),()=>{n.disconnect(),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null)}},[d,A]),e.useEffect(()=>{l==="connected"&&i.current&&i.current.focus()},[l]);const Ve=e.useCallback(()=>{l==="connected"&&i.current&&i.current.focus()},[l]),He=l==="error"&&de==="Relay service is not running",Ue=e.useCallback(async()=>{if(F){M(!0);try{await F()&&(D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{D.current=null,h()},500))}finally{M(!1)}}},[F,h]);e.useEffect(()=>()=>{D.current&&(clearTimeout(D.current),D.current=null)},[]);let re=null;return He?re=o.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/10 border border-amber-500/20 flex items-center justify-center",children:o.jsx("span",{className:"text-amber-400 text-[14px]",children:"!"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[12px] text-foreground font-medium mb-1",children:"Relay service not running"}),o.jsx("div",{className:"text-[11px] text-muted-foreground/80 leading-relaxed",children:F?"Start the relay service to open a terminal session.":"Start the relay service from the Workspace Manager."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[F&&o.jsx("button",{type:"button",onClick:Ue,disabled:I,className:"text-[11px] px-4 py-1.5 rounded-full border border-accent/30 text-accent hover:bg-accent/10 transition-colors font-medium disabled:opacity-50",children:I?"Starting":"Start Service"}),o.jsx("button",{type:"button",onClick:()=>h(),className:"text-[11px] px-3 py-1.5 rounded-full border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Retry"}),p&&o.jsx("button",{type:"button",onClick:p,className:"text-[11px] px-3 py-1.5 rounded-full border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Settings"})]})]}):l==="error"&&de?re=o.jsxs("div",{className:"flex flex-col items-center gap-3 max-w-md text-center px-4",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-red-500/10 flex items-center justify-center",children:o.jsx("span",{className:"text-red-400 text-sm",children:"!"})}),o.jsx("span",{className:"text-red-400 text-[12px] font-medium",children:"Session failed"}),o.jsx("code",{className:"text-[11px] text-muted-foreground bg-muted/80 px-3 py-2 rounded-md whitespace-pre-wrap leading-relaxed max-h-32 overflow-y-auto w-full text-left",children:de}),k!==null&&k!==0&&o.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["Exit code ",k]}),o.jsx("button",{type:"button",onClick:()=>h(),className:"text-[11px] px-3 py-1 rounded-full border border-cyan-500/30 text-cyan-400 hover:bg-cyan-500/10 transition-colors",children:"Retry"})]}):l==="disconnected"&&!se?re=o.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-muted border border-border flex items-center justify-center",children:o.jsx("span",{className:"text-muted-foreground/80 text-[14px]",children:"▷"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[12px] text-foreground font-medium mb-1",children:"Terminal relay disconnected"}),o.jsx("div",{className:"text-[11px] text-muted-foreground/80 leading-relaxed",children:"Set working directory and connect."})]}),o.jsxs("form",{className:"w-full",onSubmit:t=>{t.preventDefault(),h()},children:[o.jsx("label",{className:"text-[10px] font-mono text-muted-foreground/80 uppercase tracking-wider mb-1 block text-left",children:"Working Directory"}),o.jsx("input",{type:"text",value:Ee,onChange:t=>ie(t.target.value),placeholder:"~/dev/my-project",className:"w-full bg-muted/80 border border-border/50 rounded px-3 py-1.5 text-[11px] font-mono text-foreground placeholder:text-muted-foreground/60 outline-none focus:border-accent/40 transition-colors",spellCheck:!1,autoComplete:"off"})]}),$&&$.length>0&&o.jsx("div",{className:"w-full grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[10px] font-mono bg-muted/60 border border-border/40 rounded-md px-3 py-2",children:$.map(t=>o.jsxs("div",{className:"contents",children:[o.jsx("span",{className:"text-muted-foreground/80",children:t.label}),o.jsx("span",{className:"text-muted-foreground truncate text-left",children:t.value})]},t.label))}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{type:"button",onClick:()=>h(),className:"text-[11px] px-4 py-1.5 rounded-full border border-cyan-500/30 text-cyan-400 hover:bg-cyan-500/10 transition-colors font-medium",children:"Connect"}),p&&o.jsx("button",{type:"button",onClick:p,className:"text-[11px] px-3 py-1.5 rounded-full border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Settings"})]})]}):l==="connecting"&&!se&&(re=o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx("div",{className:"w-6 h-6 border-2 border-muted-foreground/30 border-t-cyan-500 rounded-full animate-spin"}),o.jsx("span",{className:"text-[12px] text-muted-foreground",children:"Connecting to relay"}),o.jsx("button",{type:"button",onClick:()=>{me()},className:"text-[10px] px-3 py-1 rounded-full border border-border text-muted-foreground/80 hover:text-foreground hover:bg-muted transition-colors",children:"Cancel"})]})),o.jsxs("div",{ref:H,className:he?`relative flex flex-col h-full overflow-hidden ${he}`:"relative flex flex-col h-full overflow-hidden",style:ge,role:"application","aria-label":R?`${ne} (read only)`:ne,"data-readonly":R?"true":void 0,onClick:Ve,onDragOver:b,onDragEnter:Be,onDragLeave:ze,onDrop:Fe,children:[re&&o.jsx("div",{className:"flex items-center justify-center h-full font-mono text-[12px] absolute inset-0 z-10 bg-background/95",children:re}),ee&&o.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-cyan-500/10 border-2 border-dashed border-cyan-500/50 rounded pointer-events-none",children:o.jsx("span",{className:"text-cyan-400 font-mono text-sm",children:"Drop image to get path"})}),o.jsx("div",{ref:j,className:"flex-1 min-h-0 min-w-0 overflow-hidden",style:{visibility:re?"hidden":"visible",backgroundColor:V.background,"--hud-terminal-bg":V.background,"--hud-terminal-fg":V.foreground}})]})}const nt=e.forwardRef(rt);nt.displayName="TerminalRelay";export{ct as H,nt as T,Ke as a,Ge as b,st as u};
|
package/dist/client/assets/{TextDocumentSurface-C7fGlzY8.js → TextDocumentSurface-B29xZNlI.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as i,r as I}from"./index-
|
|
1
|
+
import{j as i,r as I}from"./index-NRbRrZw-.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};
|