@openscout/scout 0.2.84 → 0.2.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/scoutd +0 -0
- package/dist/build-manifest.json +3 -3
- package/dist/client/assets/ActivityScreen-C7AwUogt.js +1 -0
- package/dist/client/assets/{AddProjectForm-Czb5uwou.js → AddProjectForm-BNRpRPod.js} +1 -1
- package/dist/client/assets/AgentAvatar-B1xvQ7ej.js +1 -0
- package/dist/client/assets/AgentConfigurationScreen-BoBQpyz5.js +1 -0
- package/dist/client/assets/AgentDefinitionsWorkspace-rw3vh8Lm.js +1 -0
- package/dist/client/assets/{AgentDetailCard-Biq8b2gv.js → AgentDetailCard-FelCxQrT.js} +1 -1
- package/dist/client/assets/AgentFloorView-Crdw8Uo5.js +1 -0
- package/dist/client/assets/AgentInfoScreen-Cge7HHbV.js +1 -0
- package/dist/client/assets/{AgentLaneCard-C4DMQR-c.js → AgentLaneCard-CRDG74C1.js} +1 -1
- package/dist/client/assets/{AgentLaneChrome-D1xNNf7A.js → AgentLaneChrome-CWFqUdch.js} +1 -1
- package/dist/client/assets/AgentLaneDetailSheet-DCIIg3Zp.js +4 -0
- package/dist/client/assets/{AgentLaneSummaryResize-C9loK-st.js → AgentLaneSummaryResize-yTM4GQAJ.js} +1 -1
- package/dist/client/assets/AgentLanesEmbedScreen-BJLwXSNp.js +1 -0
- package/dist/client/assets/{AgentLanesPreflight-M7iDXdP2.js → AgentLanesPreflight-DJeDRTAN.js} +1 -1
- package/dist/client/assets/AgentLanesView-CbY9qD0z.js +2 -0
- package/dist/client/assets/{AgentLiveActions-0iy8QZ1T.js → AgentLiveActions-Bn3zeZBN.js} +1 -1
- package/dist/client/assets/AgentSessions-czl5zT7A.js +6 -0
- package/dist/client/assets/AgentsConsole-CoT2crwq.js +1 -0
- package/dist/client/assets/{AgentsScreen-Bww6HgFs.js → AgentsScreen-BcPM-z1T.js} +1 -1
- package/dist/client/assets/AgentsSubnav-3_vpn2bT.js +1 -0
- package/dist/client/assets/AstronautSuit-BADl7m8x.js +1 -0
- package/dist/client/assets/{AtopView-h_aFoNkP.js → AtopView-DymBCiXv.js} +1 -1
- package/dist/client/assets/{BackToPicker-BXp5E2ck.js → BackToPicker-CqYhOaLB.js} +1 -1
- package/dist/client/assets/BriefingDetailScreen-DDfZ8ci1.js +1 -0
- package/dist/client/assets/{BriefingsScreen-BTsvr5fv.js → BriefingsScreen-CLvSOJjy.js} +1 -1
- package/dist/client/assets/{BrokerMetadataPanel-jg7odHQp.js → BrokerMetadataPanel-DFAH-NO6.js} +1 -1
- package/dist/client/assets/BrokerScreen-Bkvu92jk.js +5 -0
- package/dist/client/assets/{Canvas-BePL08RR.js → Canvas-KyTsDJlB.js} +1 -1
- package/dist/client/assets/ChatCollapsedStrip-Bjjqa30K.js +1 -0
- package/dist/client/assets/{CodeDiffPane-86odpBSt.js → CodeDiffPane-C9HT1dCT.js} +1 -1
- package/dist/client/assets/{CodeProjectPicker-8svr_S_A.js → CodeProjectPicker-5Y3GvXkM.js} +1 -1
- package/dist/client/assets/{CodeScreen-CJ2RgB32.js → CodeScreen-DpN9kQvm.js} +1 -1
- package/dist/client/assets/ConversationComposer-Ce7Byw48.js +1 -0
- package/dist/client/assets/ConversationFeedRows-DygDfQn_.js +1 -0
- package/dist/client/assets/ConversationHeader-C3sg0ULI.js +1 -0
- package/dist/client/assets/ConversationPanels-Dg4Y2GgX.js +6 -0
- package/dist/client/assets/ConversationScreen-BP5tdz2k.css +1 -0
- package/dist/client/assets/ConversationScreen-CjWWmuuh.js +1 -0
- package/dist/client/assets/ConversationStatus-BhVIYQza.js +1 -0
- package/dist/client/assets/CrewWorkspaces-B6YIyw1z.css +1 -0
- package/dist/client/assets/CrewWorkspaces-CDU-wy1Y.js +1 -0
- package/dist/client/assets/{DataTable-CGw5CECG.js → DataTable-oJP339bX.js} +1 -1
- package/dist/client/assets/{DispatchAftermath-DowTb7uO.js → DispatchAftermath-CH02HAVw.js} +1 -1
- package/dist/client/assets/DocumentFocusViewer-DmtFisY9.js +1 -0
- package/dist/client/assets/{EmbeddableSurfacesLab-CxfJXS2g.js → EmbeddableSurfacesLab-84b9I3fy.js} +1 -1
- package/dist/client/assets/{EmptyState-BUvllvA6.js → EmptyState-BnDda92b.js} +1 -1
- package/dist/client/assets/{FileViewerPane-BM4AD_bo.js → FileViewerPane-Dg7_88pv.js} +1 -1
- package/dist/client/assets/FlightObserveScreen-DL3Xhl0h.js +1 -0
- package/dist/client/assets/{FollowScreen-DG0osbUp.js → FollowScreen-DcFBqr6l.js} +1 -1
- package/dist/client/assets/{HarnessMark-MztYnrGK.js → HarnessMark-DGZ6o6Ct.js} +1 -1
- package/dist/client/assets/{HarnessesScreen-BWqirBjK.js → HarnessesScreen-DTDL-XaA.js} +1 -1
- package/dist/client/assets/{HerdrSession-6sFln7WX.js → HerdrSession-DV2hD6Yh.js} +1 -1
- package/dist/client/assets/HomeHero-7JwycwFY.css +1 -0
- package/dist/client/assets/HomeHero-CENwVZ45.js +1 -0
- package/dist/client/assets/HostAdvisorView-PgiZUkd_.js +1 -0
- package/dist/client/assets/{KnowledgeSearchInspector-BOIhFWd2.js → KnowledgeSearchInspector-DNQjeWZO.js} +1 -1
- package/dist/client/assets/KnowledgeSearchScreen-Bj80IgR0.js +1 -0
- package/dist/client/assets/{LaneToolHoverCard-CcEiQC6B.js → LaneToolHoverCard-197xYmRp.js} +1 -1
- package/dist/client/assets/LaneTraceDetailSheet-BztwvOv9.js +1 -0
- package/dist/client/assets/{LaneTraceEventFocus-Bl9L0EYb.js → LaneTraceEventFocus-C9cmqxnK.js} +1 -1
- package/dist/client/assets/{MeshCanvas-ZjIuMiRo.js → MeshCanvas-C3_2p9B6.js} +2 -2
- package/dist/client/assets/{MeshCanvasMinimap-C-LQtiX6.js → MeshCanvasMinimap-ZTjYWXTZ.js} +1 -1
- package/dist/client/assets/{MeshScreen-Bs3soujg.js → MeshScreen-lJKaOyGB.js} +1 -1
- package/dist/client/assets/{MeshTopologyView-C0LUyT3K.js → MeshTopologyView-CBjHbAZw.js} +2 -2
- package/dist/client/assets/MessagesScreen-D6MVLvdg.js +1 -0
- package/dist/client/assets/{MissionContextRail-CjGAEGu8.js → MissionContextRail-DXkrbcnZ.js} +1 -1
- package/dist/client/assets/MissionControlView-BCH-Zsp4.js +1 -0
- package/dist/client/assets/MissionFocusOverlay-DbAliOSF.js +1 -0
- package/dist/client/assets/MissionLeftAgentRow-Bx6Pg8_O.js +1 -0
- package/dist/client/assets/MissionLogPane-D06c29Y8.js +1 -0
- package/dist/client/assets/{NewAgentModal-D5e0YUAo.js → NewAgentModal-C18Ajovd.js} +1 -1
- package/dist/client/assets/NewChatComposer-Bgqes0UQ.js +19 -0
- package/dist/client/assets/{NewChatOrigin-BEz6jyqf.js → NewChatOrigin-DpHS2Wmt.js} +1 -1
- package/dist/client/assets/ObserveEmbedScreen-Cmhwai4X.js +2 -0
- package/dist/client/assets/ObserveTextFlow-C1f5oize.js +2 -0
- package/dist/client/assets/ObservedTopologyPanel-D85P6RAk.js +2 -0
- package/dist/client/assets/OpenScoutAppShell-IDI4fuUE.js +88 -0
- package/dist/client/assets/OpsAgentsView-yt0JavoB.js +1 -0
- package/dist/client/assets/OpsScreen-C3yNQqJE.js +1 -0
- package/dist/client/assets/OpsSubnav-BijKI3yG.js +1 -0
- package/dist/client/assets/ProjectAgentProfile-DnIeC16r.js +1 -0
- package/dist/client/assets/{ProjectAgentProfileBar-B1VpwzGD.js → ProjectAgentProfileBar-IDEpKZvI.js} +1 -1
- package/dist/client/assets/ProjectAgentProfileHero-Bh_aISs-.js +1 -0
- package/dist/client/assets/ProjectsInbox-B8Srlklk.js +2 -0
- package/dist/client/assets/ProjectsRail-DqAbdvCf.js +1 -0
- package/dist/client/assets/ProjectsScreen-DKHQ2iEv.js +1 -0
- package/dist/client/assets/ProjectsThreadAside-DpkjYLL2.js +1 -0
- package/dist/client/assets/Provider-Ve8yXaWR.js +1 -0
- package/dist/client/assets/RailRow-B0sRaJc6.css +1 -0
- package/dist/client/assets/RailRow-C4GNGR80.js +1 -0
- package/dist/client/assets/RawSessionsTable-Co3vzwsf.js +1 -0
- package/dist/client/assets/RealtimeVoiceScreen-DMd1CBAf.js +9 -0
- package/dist/client/assets/{RepoDiffEmbedScreen-VLg4caej.js → RepoDiffEmbedScreen-C97Euf4s.js} +1 -1
- package/dist/client/assets/{RepoDiffPageScreen-BelnvgnP.js → RepoDiffPageScreen-DUKLzkrW.js} +1 -1
- package/dist/client/assets/RepoDiffViewer-CovKjSgb.js +7 -0
- package/dist/client/assets/RepoDiffViewerLazy-zIiEmh-e.js +2 -0
- package/dist/client/assets/{ReposScreen-IINK-CFn.js → ReposScreen-BR1LqTf1.js} +6 -6
- package/dist/client/assets/ScoutDeckSurface-BGsVicc2.js +1 -0
- package/dist/client/assets/{ScoutSurface-x_QbcRyk.js → ScoutSurface-BMKW7hSu.js} +1 -1
- package/dist/client/assets/{ScoutbotFxLab-7t9JVvZg.js → ScoutbotFxLab-0O2iDRrF.js} +1 -1
- package/dist/client/assets/{SecondaryNav-Dj30epYF.js → SecondaryNav-cYTw2p39.js} +1 -1
- package/dist/client/assets/{SessionEmbedScreen-s2mJ5Fg9.js → SessionEmbedScreen-mNjT0R6j.js} +1 -1
- package/dist/client/assets/{SessionObserve-DaUrJCMq.js → SessionObserve-zAlFbwFn.js} +1 -1
- package/dist/client/assets/{SessionObserveEvidence-ClUW8jpV.js → SessionObserveEvidence-BVawzqoE.js} +1 -1
- package/dist/client/assets/SessionRefScreen-BmKhf29o.js +1 -0
- package/dist/client/assets/SessionsScreen-CsSqjIY2.js +1 -0
- package/dist/client/assets/SettingsDrawer-Dsj-On_x.css +1 -0
- package/dist/client/assets/SettingsDrawer-DwYQTGi8.js +3 -0
- package/dist/client/assets/SettingsScreen-Btaku7YM.js +1 -0
- package/dist/client/assets/{ShikiPane-Dkwyx--r.js → ShikiPane-DyEJdcvb.js} +1 -1
- package/dist/client/assets/{SlidePanel-CuTeirnk.js → SlidePanel-Dg8_styW.js} +1 -1
- package/dist/client/assets/{SpriteAvatar-DQ3PTb8L.js → SpriteAvatar-DMrSssNZ.js} +1 -1
- package/dist/client/assets/{StatusPill-BJ1ierIR.js → StatusPill-NFFnphtx.js} +1 -1
- package/dist/client/assets/{TailView-CufWcrvf.js → TailView-BfObcZu3.js} +2 -2
- package/dist/client/assets/Terminal-Dr-M9U4u.js +1 -0
- package/dist/client/assets/TerminalEmbedScreen-BmyZkonh.js +1 -0
- package/dist/client/assets/{TerminalRelay-rvUzI9Ek.js → TerminalRelay-lJ2KdMCW.js} +3 -3
- package/dist/client/assets/{TextDocumentSurface-Bc-kHPgG.js → TextDocumentSurface-C7fGlzY8.js} +1 -1
- package/dist/client/assets/{TmuxPeek-DLyDkq_D.js → TmuxPeek-BSeKIjnX.js} +1 -1
- package/dist/client/assets/{VoicePermissionsPanel-CD903y9K.js → VoicePermissionsPanel-BkIGTzgw.js} +1 -1
- package/dist/client/assets/{WorkDetailScreen-D51oI0dH.js → WorkDetailScreen-Cwe-KWK4.js} +3 -3
- package/dist/client/assets/WorkFilesViewer-BBtKRBPv.js +1 -0
- package/dist/client/assets/{activity-BvGruxWG.js → activity-D4W2XZY2.js} +1 -1
- package/dist/client/assets/{addon-fit-Cfq4Ayjd.js → addon-fit-Celjj2yn.js} +1 -1
- package/dist/client/assets/{addon-webgl-B8sIf9-s.js → addon-webgl-Cu4tJ21-.js} +1 -1
- package/dist/client/assets/{ScoutbotBroadcastChip-CxtYZWPZ.css → agent-autocomplete-C7xwIcwd.css} +1 -1
- package/dist/client/assets/agent-autocomplete-Dv-_9dAw.js +2 -0
- package/dist/client/assets/{agent-essentials-yb4wIJlX.js → agent-essentials-CngjUhQj.js} +1 -1
- package/dist/client/assets/agent-identity-DzHGhLdJ.js +1 -0
- package/dist/client/assets/{agent-lane-card-model-q4cwzLX4.js → agent-lane-card-model-CSugZCdy.js} +1 -1
- package/dist/client/assets/{agent-lane-detail-BNNm6FNu.js → agent-lane-detail-D5EIlX7_.js} +1 -1
- package/dist/client/assets/{agent-lane-preview-C33Dwpn7.js → agent-lane-preview-BhplDYGf.js} +1 -1
- package/dist/client/assets/{agent-lanes-BDNktFBZ.css → agent-lanes-DlqcEf0l.css} +1 -1
- package/dist/client/assets/{agent-lanes-model-VYQ5a68i.js → agent-lanes-model-BKOs_32K.js} +2 -2
- package/dist/client/assets/agent-specialization-CNrsRbKA.js +1 -0
- package/dist/client/assets/{api-BkjHJfgJ.js → api-BHHEUSS3.js} +1 -1
- package/dist/client/assets/api-DEHEgJ9m.js +1 -0
- package/dist/client/assets/{arc.es-BBTfhvLE.js → arc.es-DNT50Y-_.js} +1 -1
- package/dist/client/assets/archive-DH49QqFG.js +1 -0
- package/dist/client/assets/{arrow-left-BOht-YQu.js → arrow-left-i-h6JAgs.js} +1 -1
- package/dist/client/assets/arrow-right-B0Yi01Zr.js +1 -0
- package/dist/client/assets/{arrow-up-right-hoR8_oUz.js → arrow-up-right-RBC6k8nn.js} +1 -1
- package/dist/client/assets/{bot-BUK7dOPS.js → bot-r2IuAuJd.js} +1 -1
- package/dist/client/assets/broker-display-Q75fupqG.js +2 -0
- package/dist/client/assets/{cache-Dr0why2k.js → cache-BO2Bd_LV.js} +1 -1
- package/dist/client/assets/{check--esHw52j.js → check-Bfs7hMb1.js} +1 -1
- package/dist/client/assets/{chevron-down-NAhBUkFd.js → chevron-down-Da5tV19_.js} +1 -1
- package/dist/client/assets/{chevron-right-C10o7t_X.js → chevron-right-BMqtBds_.js} +1 -1
- package/dist/client/assets/{chunk-HRAB3GC3-DF8R9rPv.js → chunk-HRAB3GC3-BUVYXXAp.js} +1 -1
- package/dist/client/assets/{clock-of01sAB6.js → clock-DaKLp6Xd.js} +1 -1
- package/dist/client/assets/{code-xml-CLn3TDWF.js → code-xml-ByQsfOI_.js} +1 -1
- package/dist/client/assets/collapsed-strip-raJWthAH.css +1 -0
- package/dist/client/assets/compass-BepM5iWH.js +1 -0
- package/dist/client/assets/{content-Cgj5AWqT.js → content-5hnDC9WE.js} +1 -1
- package/dist/client/assets/content-BRFZ-a6m.js +1 -0
- package/dist/client/assets/content-BYykncDo.js +1 -0
- package/dist/client/assets/content-Be6yyWbJ.js +1 -0
- package/dist/client/assets/content-Bgl_X3ao.js +1 -0
- package/dist/client/assets/content-BopJW1Zx.js +1 -0
- package/dist/client/assets/content-Bv2sfg0w.js +1 -0
- package/dist/client/assets/content-CMBiIZTg.js +1 -0
- package/dist/client/assets/content-CPVqvf5o.js +1 -0
- package/dist/client/assets/content-CbwyFqdI.js +1 -0
- package/dist/client/assets/content-ClQjAWYi.js +1 -0
- package/dist/client/assets/content-Cv2tSAbv.js +1 -0
- package/dist/client/assets/content-DFFe3-Ot.js +1 -0
- package/dist/client/assets/content-DY5hwBmm.js +1 -0
- package/dist/client/assets/content-_IXoxGno.js +1 -0
- package/dist/client/assets/content-j_tewJdE.js +1 -0
- package/dist/client/assets/{conversation-icons-ClBJi21l.js → conversation-icons-C4amK8Sa.js} +1 -1
- package/dist/client/assets/conversation-model-CigSPlKA.js +1 -0
- package/dist/client/assets/conversation-motion-features-_95aZx_1.js +1 -0
- package/dist/client/assets/{copy-Dty8ZYsM.js → copy-De4s38o2.js} +1 -1
- package/dist/client/assets/cpu-Bc268H9Q.js +1 -0
- package/dist/client/assets/{createLucideIcon-Bt67PWH-.js → createLucideIcon-DLlxGjKt.js} +1 -1
- package/dist/client/assets/credentials-qwds23lv.js +1 -0
- package/dist/client/assets/ctx-panel-D_HJ3nhb.css +1 -0
- package/dist/client/assets/discover-DOlk1hG7.js +2 -0
- package/dist/client/assets/embed-entry-BqDJfa87.js +2 -0
- package/dist/client/assets/{external-link-Dem738OJ.js → external-link-BGHC_naA.js} +1 -1
- package/dist/client/assets/{eye-B3lBIwJZ.js → eye-BeCSqJn1.js} +1 -1
- package/dist/client/assets/file-code-corner-CX53Cd9y.js +1 -0
- package/dist/client/assets/{file-text-iF0hyVyU.js → file-text-BVhkMWyC.js} +1 -1
- package/dist/client/assets/gauge-CPcEPmNt.js +1 -0
- package/dist/client/assets/gestures-BXIGYk_p.js +1 -0
- package/dist/client/assets/git-branch-q8Ayc8py.js +1 -0
- package/dist/client/assets/home-moving-signal-DMguaRWR.css +1 -0
- package/dist/client/assets/home-moving-signal-Dm2Z2x0p.js +1 -0
- package/dist/client/assets/{home-now-card-nano-hZl9klbP.js → home-now-card-nano-Djhy6ax0.js} +1 -1
- package/dist/client/assets/home-now-card-xU5LGP7q.js +1 -0
- package/dist/client/assets/hooks-CdKx1CxP.js +2 -0
- package/dist/client/assets/host-advisor-B2Fqs5Dd.css +1 -0
- package/dist/client/assets/index-Bli6bTLU.js +10 -0
- package/dist/client/assets/index-D7UEHxaY.js +1 -0
- package/dist/client/assets/index-DFdlQs_c.js +1 -0
- package/dist/client/assets/index-DhfOMK0D.js +1 -0
- package/dist/client/assets/index-DzlEgstl.css +1 -0
- package/dist/client/assets/index-wLwc74Pu.css +1 -0
- package/dist/client/assets/inspector-panel-B8pigRsg.js +2 -0
- package/dist/client/assets/{keyboard-nav-Chf51dns.js → keyboard-nav-7iEtvu9P.js} +1 -1
- package/dist/client/assets/{lane-observe-BA3g9aVd.js → lane-observe-vfyACHi0.js} +1 -1
- package/dist/client/assets/{lane-roster-store-BiIVlYmG.js → lane-roster-store-pHT3TAVs.js} +1 -1
- package/dist/client/assets/layers-BiZA-Clc.js +1 -0
- package/dist/client/assets/layout-grid-DMpv9CZM.js +1 -0
- package/dist/client/assets/left-BayK4ocL.js +1 -0
- package/dist/client/assets/left-BhZhSrS2.js +1 -0
- package/dist/client/assets/left-BhgU6NOA.js +1 -0
- package/dist/client/assets/left-CY_FGnN7.js +1 -0
- package/dist/client/assets/left-Cq8mjamr.js +1 -0
- package/dist/client/assets/left-DH44V4I_.css +1 -0
- package/dist/client/assets/left-Dnqla0b5.js +2 -0
- package/dist/client/assets/left-Dy403II2.js +2 -0
- package/dist/client/assets/left-R2OOE7VG.css +1 -0
- package/dist/client/assets/left-advisor-oOAtJ9YE.js +1 -0
- package/dist/client/assets/left-agents-TIKe8vW8.js +1 -0
- package/dist/client/assets/left-default-owH0Lwxo.js +1 -0
- package/dist/client/assets/left-lanes-BE_co2lP.js +1 -0
- package/dist/client/assets/left-mission-C_nWUtfA.js +1 -0
- package/dist/client/assets/library-BSVrjn_m.js +1 -0
- package/dist/client/assets/{loader-circle-4LDsy4Ke.js → loader-circle-DoT8gpw6.js} +1 -1
- package/dist/client/assets/{local-agents-DIi2EacM.js → local-agents-BMadXuP1.js} +1 -1
- package/dist/client/assets/mentions-Cd6XticV.js +1 -0
- package/dist/client/assets/{mesh-ops-JZwGuAPn.js → mesh-ops-C0zCLTR8.js} +1 -1
- package/dist/client/assets/{mesh-view-store-Du7VqIT_.js → mesh-view-store-Cpqil_2D.js} +1 -1
- package/dist/client/assets/{message-circle-BM3XgevU.js → message-circle-44KSmbvQ.js} +1 -1
- package/dist/client/assets/{message-markup-BcY1lShv.js → message-markup-DAnnGpWr.js} +1 -1
- package/dist/client/assets/{message-square-ER1_q2pe.js → message-square-DlY4EneU.js} +1 -1
- package/dist/client/assets/mission-control-CnU7dNt1.css +1 -0
- package/dist/client/assets/{mission-control-store-C6w5iVfg.js → mission-control-store-DtjtRs9Z.js} +1 -1
- package/dist/client/assets/{observe-3-jn4SXb.js → observe-DL5_8-Zj.js} +1 -1
- package/dist/client/assets/{operator-attention-BwSPeheT.js → operator-attention-BqoWAlhp.js} +1 -1
- package/dist/client/assets/{page-status-0LPfBC8S.js → page-status-CW8co39E.js} +1 -1
- package/dist/client/assets/persistent-state-DYjP8lqN.js +1 -0
- package/dist/client/assets/{plus-C-2gTcPK.js → plus-64n9qucr.js} +1 -1
- package/dist/client/assets/profile-BkmuseW7.js +1 -0
- package/dist/client/assets/projects-inbox-C0umZMSY.js +1 -0
- package/dist/client/assets/{provider-BvAxRQfE.js → provider-CX9EWecp.js} +1 -1
- package/dist/client/assets/proxy-C35W-YHZ.js +1 -0
- package/dist/client/assets/{radio-v7UAMZGh.js → radio-BjpQTKT0.js} +1 -1
- package/dist/client/assets/{refresh-cw-B5To7b6B.js → refresh-cw-IgN2fZLM.js} +1 -1
- package/dist/client/assets/resolve-panes-CCqRkQdM.js +1 -0
- package/dist/client/assets/resolve-sidebar-context-JkxY8qsV.js +1 -0
- package/dist/client/assets/right-B3PQUHd5.js +1 -0
- package/dist/client/assets/right-B96CBzrV.js +1 -0
- package/dist/client/assets/right-BPirlFC8.js +1 -0
- package/dist/client/assets/right-BUP2Ro_M.js +1 -0
- package/dist/client/assets/right-BVWYPIFX.js +1 -0
- package/dist/client/assets/right-BoAJxwA3.js +1 -0
- package/dist/client/assets/right-C2aOC2li.js +1 -0
- package/dist/client/assets/right-CtPJjgOV.js +1 -0
- package/dist/client/assets/{right-BvoGOUKH.js → right-DqiVyo8v.js} +1 -1
- package/dist/client/assets/right-SfSu0zHC.js +1 -0
- package/dist/client/assets/{rocket-BQQQv2L5.js → rocket-DnmN_YOD.js} +1 -1
- package/dist/client/assets/{router-C65cZYPn.js → router-B0YclXYg.js} +1 -1
- package/dist/client/assets/{scope-views-BOOmgmwx.js → scope-views-Z8aoAmtU.js} +1 -1
- package/dist/client/assets/scout-voice-DvG_3stJ.js +1 -0
- package/dist/client/assets/{scoutbot-BTIErYHo.js → scoutbot-D4vuKzOL.js} +2 -2
- package/dist/client/assets/scoutbot-markdown-BJJyaPu2.js +6 -0
- package/dist/client/assets/{scroll-text-BuneRiAD.js → scroll-text-DRidbcse.js} +1 -1
- package/dist/client/assets/{search-7_n7CxWl.js → search-BbgsEMXa.js} +1 -1
- package/dist/client/assets/secondaryNavConfig-DyC_P9Wx.js +1 -0
- package/dist/client/assets/{selection-bridge-SlGsgHw2.js → selection-bridge-CpzFGx3-.js} +1 -1
- package/dist/client/assets/{send-horizontal-DP16OOIW.js → send-horizontal-BXo2uz3Z.js} +1 -1
- package/dist/client/assets/{server-pYOMFjrT.js → server-Dt3tpiBj.js} +1 -1
- package/dist/client/assets/{session-catalog-_QfQ7fhZ.js → session-catalog-CUQ8LUJY.js} +1 -1
- package/dist/client/assets/{session-table-CYN8e4s3.js → session-table-B4JOKevn.js} +1 -1
- package/dist/client/assets/settings-BzWCF3NF.js +1 -0
- package/dist/client/assets/{sliders-horizontal-D2Z8gz6J.js → sliders-horizontal-7V8B3xsf.js} +1 -1
- package/dist/client/assets/{sparkles-Bth2iK7t.js → sparkles-ytTwpCbZ.js} +1 -1
- package/dist/client/assets/{sse-CL6gctHY.js → sse-CSozY6mp.js} +1 -1
- package/dist/client/assets/system-surfaces-redesign-QVXNeGYw.css +1 -0
- package/dist/client/assets/{tail-display-BRcJltQa.js → tail-display-DcliDVkW.js} +1 -1
- package/dist/client/assets/{tail-events-NLIWLq27.js → tail-events-CrN-Rmxj.js} +1 -1
- package/dist/client/assets/{terminal-By1Lw2i2.js → terminal-BiNIXhna.js} +1 -1
- package/dist/client/assets/{terminal-relay-CjkI5aUy.js → terminal-relay-pSm7_An6.js} +1 -1
- package/dist/client/assets/{terminal-sessions-AmSgHklm.js → terminal-sessions-D4dHTRkt.js} +1 -1
- package/dist/client/assets/{terminal-takeover-7AvNpnkC.js → terminal-takeover-CtA3wcXh.js} +1 -1
- package/dist/client/assets/{runtime-picker-eDEvx2Mz.js → text-BR9Bap0E.js} +1 -1
- package/dist/client/assets/text-rLpBg4_z.css +1 -0
- package/dist/client/assets/{use-conversation-list-BCzY032j.js → use-conversation-list-C0bEXFeH.js} +1 -1
- package/dist/client/assets/{use-fleet-active-asks-CJ6-oj5k.js → use-fleet-active-asks-CK4aw-3G.js} +1 -1
- package/dist/client/assets/{use-mesh-ops-items-D5L-CKe_.js → use-mesh-ops-items-QixBijmT.js} +1 -1
- package/dist/client/assets/use-reduced-motion-BLn59zLn.js +1 -0
- package/dist/client/assets/{use-scout-dev-flags-BohC8seq.js → use-scout-dev-flags-JKb1EhFh.js} +1 -1
- package/dist/client/assets/{useAgentHoverCard-RsLUYyeh.js → useAgentHoverCard-6N8b7qsU.js} +1 -1
- package/dist/client/assets/useContentSecondaryNav-D-hVKzM9.js +1 -0
- package/dist/client/assets/{usePersistentState-D3M4m2Ou.js → usePersistentState-DOEahRlt.js} +1 -1
- package/dist/client/assets/{usePierreRuntime-B4hbNWTz.js → usePierreRuntime-Bq6mXrgd.js} +1 -1
- package/dist/client/assets/{wrench-M4G7WtYB.js → wrench-CQvdf7KT.js} +1 -1
- package/dist/client/assets/{x-ynOfVadO.js → x-BJyPzFnn.js} +1 -1
- package/dist/client/assets/{xterm-DZHyijPp.js → xterm-D6dE_wMr.js} +1 -1
- package/dist/client/assets/zap-rw7uwZht.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/main.mjs +629 -167
- package/dist/node/main.mjs +454 -270
- package/dist/pairing-runtime-controller.mjs +607 -357
- package/dist/runtime/base-daemon.mjs +384 -21
- package/dist/runtime/broker-daemon.mjs +11024 -10023
- package/dist/runtime/broker-process-manager.mjs +9 -3
- package/dist/runtime/mesh-discover.mjs +9 -3
- package/dist/scout-control-plane-web.mjs +1590 -984
- package/dist/scout-web-server.mjs +1590 -984
- package/package.json +4 -4
- package/dist/client/assets/ActivityScreen-aewI4Ul1.js +0 -1
- package/dist/client/assets/AgentAvatar-DMov24_o.js +0 -1
- package/dist/client/assets/AgentConfigurationScreen-BjG6ECjl.js +0 -1
- package/dist/client/assets/AgentDefinitionsWorkspace-D4MbSMXp.js +0 -1
- package/dist/client/assets/AgentFloorView-h9KDJdw0.js +0 -1
- package/dist/client/assets/AgentInfoScreen-SjhK_SBh.js +0 -1
- package/dist/client/assets/AgentLaneDetailSheet-DnAKe4e3.js +0 -4
- package/dist/client/assets/AgentLanesEmbedScreen-BNOYF16R.js +0 -1
- package/dist/client/assets/AgentLanesView-Ct-Gz5WD.js +0 -2
- package/dist/client/assets/AgentSessions-CDfSfNiE.js +0 -6
- package/dist/client/assets/AgentsConsole-BVxhBqRa.js +0 -1
- package/dist/client/assets/AgentsSubnav-CiIuzxnZ.js +0 -1
- package/dist/client/assets/BriefingDetailScreen-C83o2YfN.js +0 -6
- package/dist/client/assets/BrokerScreen-DplF8d_X.js +0 -5
- package/dist/client/assets/ChatCollapsedStrip-BRljIymi.js +0 -1
- package/dist/client/assets/ContextMenu-CxkmFQcN.js +0 -1
- package/dist/client/assets/ConversationComposer-CWohCCmn.js +0 -1
- package/dist/client/assets/ConversationFeedRows-IWh0JSIL.js +0 -1
- package/dist/client/assets/ConversationHeader-BxTzXl8e.js +0 -1
- package/dist/client/assets/ConversationPanels-D9UCwNkS.js +0 -2
- package/dist/client/assets/ConversationScreen-oZSitVtX.js +0 -1
- package/dist/client/assets/ConversationScreen-yIKEsm-8.css +0 -1
- package/dist/client/assets/ConversationStatus-B6pAbo2w.js +0 -1
- package/dist/client/assets/DocumentFocusViewer-DRKjNG9s.js +0 -1
- package/dist/client/assets/FleetSearch-CYeWn85V.js +0 -1
- package/dist/client/assets/FleetSearch-EXOe8ulE.css +0 -1
- package/dist/client/assets/FlightObserveScreen-DYJJ3Z2B.js +0 -1
- package/dist/client/assets/HomeHero-BPBArHXa.js +0 -1
- package/dist/client/assets/HomeHero-DEl-WBsT.css +0 -1
- package/dist/client/assets/KnowledgeSearchScreen-BP8tD-Bh.js +0 -1
- package/dist/client/assets/LaneTraceDetailSheet-B4i1Ut4R.js +0 -1
- package/dist/client/assets/MessageComposerSuggestions-Dfc3PH2y.js +0 -1
- package/dist/client/assets/MessagesScreen-TgSL5KMc.js +0 -1
- package/dist/client/assets/MissionControlView-D629w2A8.js +0 -1
- package/dist/client/assets/MissionFocusOverlay-Bubrr8Gc.js +0 -1
- package/dist/client/assets/MissionLeftAgentRow-DokImu4Y.js +0 -1
- package/dist/client/assets/MissionLogPane-Cs0LuIkn.js +0 -1
- package/dist/client/assets/NewChatComposer-S08F6_La.js +0 -19
- package/dist/client/assets/ObserveEmbedScreen-CHx2sEAA.js +0 -2
- package/dist/client/assets/ObserveTextFlow-_ApDwRCO.js +0 -2
- package/dist/client/assets/ObservedTopologyPanel-ByW7Ar7p.js +0 -2
- package/dist/client/assets/OpenScoutAppShell-DTmnbG-h.js +0 -88
- package/dist/client/assets/OpsAgentsView-DiFuHcJs.js +0 -1
- package/dist/client/assets/OpsScreen-CCR3U_9P.js +0 -1
- package/dist/client/assets/OpsSubnav-CZs_OL2N.js +0 -1
- package/dist/client/assets/PlanView-C54eAzig.js +0 -1
- package/dist/client/assets/ProjectAgentProfile-BEfYOaxc.js +0 -1
- package/dist/client/assets/ProjectAgentProfileHero-B4f_AoCr.js +0 -1
- package/dist/client/assets/ProjectsInbox-DoPZ17FC.js +0 -2
- package/dist/client/assets/ProjectsRail-CWOkZjsY.js +0 -1
- package/dist/client/assets/ProjectsScreen-Dse0Q6p6.js +0 -1
- package/dist/client/assets/ProjectsThreadAside-DMnfyPLE.js +0 -1
- package/dist/client/assets/Provider-DKZWuzSR.js +0 -1
- package/dist/client/assets/RailRow-Cf9LOiEj.css +0 -1
- package/dist/client/assets/RailRow-DIGd3MMM.js +0 -1
- package/dist/client/assets/RawSessionsTable-Zkl4YDvz.js +0 -1
- package/dist/client/assets/RealtimeVoiceScreen-B_PMJxY_.js +0 -1
- package/dist/client/assets/RepoDiffViewer-VrUJw33u.js +0 -7
- package/dist/client/assets/RepoDiffViewerLazy-BPg_JkYW.js +0 -2
- package/dist/client/assets/ScoutDeckSurface-MbwGp6Ab.js +0 -1
- package/dist/client/assets/ScoutbotBroadcastChip-DAKQKB25.js +0 -2
- package/dist/client/assets/ScoutbotRealtimeVoiceCall-Br4bYVAx.js +0 -1
- package/dist/client/assets/SessionRefScreen-DLZNFZFK.js +0 -1
- package/dist/client/assets/SessionsScreen-D-hN1n4k.js +0 -1
- package/dist/client/assets/SettingsDrawer-BFsnww-k.js +0 -3
- package/dist/client/assets/SettingsDrawer-UX7pFJU_.css +0 -1
- package/dist/client/assets/SettingsScreen-Bc3Xtv5V.js +0 -1
- package/dist/client/assets/Terminal-D_OmdFmr.js +0 -1
- package/dist/client/assets/TerminalEmbedScreen-D21ytNXW.js +0 -1
- package/dist/client/assets/WorkFilesViewer-BDMNbxE4.js +0 -1
- package/dist/client/assets/agent-identity-BxCsXnDp.js +0 -1
- package/dist/client/assets/api-h5zurxmi.js +0 -1
- package/dist/client/assets/broker-display-pp33bLsu.js +0 -2
- package/dist/client/assets/collapsed-strip-Dz-of2SM.css +0 -1
- package/dist/client/assets/content-B-SUUhXj.js +0 -1
- package/dist/client/assets/content-BRY2vo1_.js +0 -1
- package/dist/client/assets/content-BTm0mVyD.js +0 -1
- package/dist/client/assets/content-BTqvyb5E.js +0 -1
- package/dist/client/assets/content-BjDaXmSD.js +0 -1
- package/dist/client/assets/content-BrR6deGh.js +0 -1
- package/dist/client/assets/content-C5yvBEMy.js +0 -1
- package/dist/client/assets/content-CkhG__-v.js +0 -1
- package/dist/client/assets/content-CudIBsiP.js +0 -1
- package/dist/client/assets/content-DBb7ppd5.js +0 -1
- package/dist/client/assets/content-DEw_kGyK.js +0 -1
- package/dist/client/assets/content-DIy0DCzK.js +0 -1
- package/dist/client/assets/content-THl9hRAo.js +0 -1
- package/dist/client/assets/content-vi9FbmV9.js +0 -1
- package/dist/client/assets/content-wcgPMGVf.js +0 -1
- package/dist/client/assets/conversation-model-CHwHZNw-.js +0 -1
- package/dist/client/assets/conversation-motion-features-zU0k3Agz.js +0 -1
- package/dist/client/assets/ctx-panel-B4s49N9e.css +0 -1
- package/dist/client/assets/discover-NDAqNvKt.js +0 -2
- package/dist/client/assets/embed-entry-BVR09F6e.js +0 -2
- package/dist/client/assets/home-moving-signal-C8dTXieA.js +0 -1
- package/dist/client/assets/home-moving-signal-CAa0V91u.css +0 -1
- package/dist/client/assets/home-now-card-BgvVcE83.js +0 -1
- package/dist/client/assets/hooks-DBIezYS2.js +0 -2
- package/dist/client/assets/index-BMwKgdz_.js +0 -1
- package/dist/client/assets/index-Bu-fckyR.css +0 -1
- package/dist/client/assets/index-BxoufAPA.js +0 -1
- package/dist/client/assets/index-Cj7NnSxI.js +0 -1
- package/dist/client/assets/index-CvF09yvf.css +0 -1
- package/dist/client/assets/index-o4FKpU7Z.js +0 -10
- package/dist/client/assets/inspector-panel-Dy2cVTCi.js +0 -2
- package/dist/client/assets/left-BC7p5QbT.js +0 -1
- package/dist/client/assets/left-BCSGqccQ.js +0 -1
- package/dist/client/assets/left-BSyj8PuJ.js +0 -2
- package/dist/client/assets/left-Bk3XnxPD.css +0 -1
- package/dist/client/assets/left-CCoobxPS.css +0 -1
- package/dist/client/assets/left-DDnxNUxd.js +0 -1
- package/dist/client/assets/left-DLoDKxT5.js +0 -2
- package/dist/client/assets/left-O-TBH7JB.js +0 -1
- package/dist/client/assets/left-agents-Dk9Y89lb.js +0 -1
- package/dist/client/assets/left-default-B3JBRQNJ.js +0 -1
- package/dist/client/assets/left-lanes-30Oe_3RM.js +0 -1
- package/dist/client/assets/left-mission-DEl4-7xu.js +0 -1
- package/dist/client/assets/left-plan-B4qdm4Gn.js +0 -2
- package/dist/client/assets/left-rvUOB14X.js +0 -1
- package/dist/client/assets/library-DDKSLFJ_.js +0 -1
- package/dist/client/assets/mentions-CvDaviLJ.js +0 -1
- package/dist/client/assets/mission-control-m3BTDQ9l.css +0 -1
- package/dist/client/assets/model-Co0zkMIc.js +0 -1
- package/dist/client/assets/plan-view-D56fneVF.css +0 -1
- package/dist/client/assets/profile-DW80Gn5k.js +0 -1
- package/dist/client/assets/projects-inbox-DCeD3FfV.js +0 -1
- package/dist/client/assets/resolve-panes-BDi9Qx4R.js +0 -1
- package/dist/client/assets/resolve-sidebar-context-HE-5eZYa.js +0 -1
- package/dist/client/assets/right-BDf_yTv6.js +0 -1
- package/dist/client/assets/right-C-bgjYg-.js +0 -1
- package/dist/client/assets/right-C3JdEfYQ.js +0 -1
- package/dist/client/assets/right-CYIs2tEe.js +0 -1
- package/dist/client/assets/right-CyRCv6Up.js +0 -1
- package/dist/client/assets/right-DBYGtoRv.js +0 -1
- package/dist/client/assets/right-o3LHMiKa.js +0 -1
- package/dist/client/assets/right-oPrcx9MX.js +0 -1
- package/dist/client/assets/right-sSvBUK-j.js +0 -1
- package/dist/client/assets/runtime-picker-vhm0gtLs.css +0 -1
- package/dist/client/assets/scout-voice-B7kXlkcl.js +0 -1
- package/dist/client/assets/secondaryNavConfig-CSFDCQAf.js +0 -1
- package/dist/client/assets/system-surfaces-redesign-B7GQhfpw.css +0 -1
- package/dist/client/assets/text-DsBWV_4k.js +0 -1
- package/dist/client/assets/use-reduced-motion-CqXpVXv-.js +0 -1
- package/dist/client/assets/useContentSecondaryNav-DOr5yHbT.js +0 -1
- /package/dist/client/assets/{document-focus-viewer-BSC_JwVE.css → DocumentFocusViewer-BSC_JwVE.css} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{r as u,j as e}from"./index-
|
|
2
|
-
`)}function Q(s){return s.handle?.trim()||s.name?.trim()||s.id}function fe(s,n){const t=s?.trim(),r=n?.trim();return!t||!r?!1:t===r||t.startsWith(`${r}/`)||r.startsWith(`${t}/`)}function rs(s){switch(s?.trim().toLowerCase()){case"available":case"idle":case"callable":return 40;case"active":case"working":case"running":case"in_turn":case"in_flight":return 20;case"queued":case"waiting":case"waking":return 10;case"offline":case"retired":case"stale":case"blocked":return-50;default:return 0}}function as(s,n,t){const r=t?.trim()||s.path?.trim()||null,a=s.repo.split("/").pop()?.toLowerCase()??"",i=s.headRefName?.trim()??"";return n.filter(o=>!o.retiredFromFleet).map(o=>{let c=rs(o.state);return(fe(o.projectRoot,r)||fe(o.cwd,r))&&(c+=1e3),a&&o.project?.trim().toLowerCase()===a&&(c+=400),i&&o.branch?.trim()===i&&(c+=200),{agent:o,score:c}}).sort((o,c)=>c.score!==o.score?c.score-o.score:Q(o.agent).localeCompare(Q(c.agent))).map(o=>o.agent)}function ge(s,n){const t=new Map,r=s.path?.trim();if(r){const a=r.split("/").filter(Boolean).at(-1)??r;t.set(r,s.repo||a)}for(const a of n){const i=a.root?.trim();i&&(t.has(i)||t.set(i,a.name?.trim()||i.split("/").filter(Boolean).at(-1)||i))}return[...t.entries()].map(([a,i])=>({path:a,label:i}))}function ne(s,n){return s?.harness?.trim()||n?.trim()||"claude"}function is(s){return s?.model?.trim()||""}function ls(s,n){const t=new Set,r=n?.model?.trim();r&&t.add(r);for(const a of s){const i=a.model?.trim();i&&t.add(i)}return[...t]}function os(s){const n=s.harness?.trim()||void 0,t=s.model?.trim()||void 0,r=s.reasoningEffort?.trim()||void 0;return{...n?{harness:n}:{},...t?{model:t}:{},...r?{reasoningEffort:r}:{}}}async function cs(s,n){const t=ns(s),r=n.projectPath.trim();if(!r)throw new Error("Pick a project path for the review.");const a=os(n),i=n.agent??null,o=i&&n.sessionMode==="existing"?"existing":"new";if(i&&o==="existing"&&!i.harnessSessionId?.trim())throw new Error(`@${Q(i)} has no live harness session to continue. Pick “New session” instead.`);const c=await _e("/api/sessions",{method:"POST",body:JSON.stringify({target:i?{agentId:i.id,projectPath:r}:{projectPath:r},execution:{session:o,...o==="existing"&&i?.harnessSessionId?.trim()?{targetSessionId:i.harnessSessionId.trim()}:{},...a},agent:{persistence:i?"sticky":"one_time",...i?.handle?.trim()?{handle:i.handle.trim()}:{}},seed:{instructions:t}})}),h=c.flightId??c.flight?.id??null,p=c.targetAgentId??c.flight?.targetAgentId??c.agentId??i?.id??null,d=c.targetLabel?.trim()||(i?Q(i):null)||p||"one-time reviewer",m=i?o==="existing"?"continue":"new session":"one-time";return{message:[`Assigned #${s.number} for review → ${d.startsWith("@")?d:`@${d}`}`,`· ${m}`,a.harness?`· ${a.harness}`:null,a.model?`· ${a.model}`:null,a.reasoningEffort?`· ${a.reasoningEffort}`:null,h?`· ${h}`:null].filter(Boolean).join(" "),flightId:h,conversationId:c.conversationId??null,targetAgentId:p,targetLabel:d}}function ds(s){window.open(s.url,"_blank","noopener,noreferrer")}function us(s,n={}){const{matchingWorktree:t,onBeginAssign:r,onSelectWorktreeId:a,onOpenDiff:i,onStatus:o}=n,c=[];return r&&c.push({kind:"action",label:"Assign for review…",onSelect:()=>r(s)}),c.push({kind:"action",label:"Open on GitHub",onSelect:()=>ds(s)}),t&&a&&c.push({kind:"action",label:`Select worktree · ${t.branch}`,onSelect:()=>a(t.id)}),t&&i&&c.push({kind:"action",label:"Open local diff",onSelect:()=>i(t.path)}),c.push({kind:"separator"},{kind:"action",label:"Copy link",onSelect:()=>{te(s.url).then(h=>{o?.(h?`Copied link for #${s.number}`:`Could not copy link for #${s.number}`)})}},{kind:"action",label:"Copy checkout command",onSelect:()=>{te(me(s)).then(h=>{o?.(h?`Copied: ${me(s)}`:`Could not copy checkout command for #${s.number}`)})}},{kind:"action",label:"Copy title",onSelect:()=>{te(`#${s.number} ${s.title}`).then(h=>{o?.(h?`Copied title for #${s.number}`:`Could not copy title for #${s.number}`)})}}),c}function hs(s){return s.startsWith("/Users/")?`~/${s.split("/").slice(3).join("/")}`:s}function ps(s){const n=s.handle?.trim()||s.name?.trim()||s.id,t=[s.harness?.trim(),s.model?.trim(),s.state?.trim(),s.harnessSessionId?.trim()?"session":null].filter(Boolean);return t.length>0?`@${n} · ${t.join(" · ")}`:`@${n}`}function Y(s){const n=s?.trim();return n?n.length>18?`${n.slice(0,10)}…${n.slice(-4)}`:n:null}function ms({pr:s,agents:n,projects:t,pending:r,error:a,onClose:i,onPendingChange:o,onError:c,onAssigned:h}){const p=Be(),d=u.useMemo(()=>ge(s,t),[s,t]),[m,b]=u.useState(()=>d[0]?.path??s.path?.trim()??""),[S,A]=u.useState(""),P=u.useMemo(()=>as(s,n,m),[n,s,m]),f=P.find(l=>l.id===S)??null,x=!!f?.harnessSessionId?.trim(),[C,I]=u.useState(()=>ne(null)),[R,O]=u.useState(""),[j,y]=u.useState("medium"),[N,$]=u.useState("new");u.useEffect(()=>{const v=ge(s,t)[0]?.path??s.path?.trim()??"";b(v),A(""),I(ne(null)),O(""),y("medium"),$("new"),c(null)},[s.id]),u.useEffect(()=>{m&&d.some(l=>l.path===m)||b(d[0]?.path??s.path?.trim()??"")},[s.path,d,m]),u.useEffect(()=>{if(!f){$("new");return}I(ne(f)),O(is(f)),$(f.harnessSessionId?.trim()?"existing":"new")},[f?.id]),u.useEffect(()=>{S&&(P.some(l=>l.id===S)||A(""))},[S,P]),u.useEffect(()=>{N==="existing"&&f&&!x&&$("new")},[x,f,N]);const T=u.useMemo(()=>ls(P,f),[P,f]),D=!!m.trim()&&!r&&!(f&&N==="existing"&&!x),W=async()=>{if(D){o(!0),c(null);try{const l=await cs(s,{projectPath:m.trim(),harness:C,model:R,reasoningEffort:j,agent:f,sessionMode:f?N:"new"});h(l)}catch(l){c(l instanceof Error?l.message:String(l))}finally{o(!1)}}},F=r?"Assigning…":f?N==="existing"?"Continue session · review":"New session · review":"Start review",M=f?N==="existing"?`Continues @${f.handle?.trim()||f.name}'s current session${Y(f.harnessSessionId)?` (${Y(f.harnessSessionId)})`:""}.`:`Starts a fresh harness session for @${f.handle?.trim()||f.name}.`:"Starts a disposable one-time reviewer on the project with the runtime above.";return e.jsx("div",{className:"rw-pr-assign-backdrop",role:"presentation",onMouseDown:l=>{l.target===l.currentTarget&&!r&&i()},children:e.jsxs("div",{ref:p.ref,className:"rw-pr-assign-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"rw-pr-assign-title",tabIndex:-1,onKeyDown:l=>{p.onKeyDown(l),l.key==="Escape"&&!r&&(l.stopPropagation(),i())},children:[e.jsxs("div",{className:"rw-pr-assign-head",children:[e.jsxs("div",{children:[e.jsx("div",{className:"rw-pr-assign-eyebrow",children:"Assign for review"}),e.jsxs("h2",{id:"rw-pr-assign-title",className:"rw-pr-assign-title",children:["#",s.number," · launch review"]}),e.jsx("p",{className:"rw-pr-assign-copy",title:s.title,children:s.title}),e.jsxs("p",{className:"rw-pr-assign-meta",children:[s.repo," · ",s.headRefName||"head"," → ",s.baseRefName||"base"]})]}),e.jsx("button",{type:"button",className:"rw-pr-assign-close",onClick:i,disabled:r,children:"Cancel"})]}),e.jsxs("div",{className:"rw-pr-assign-body",children:[e.jsxs("div",{className:"rw-pr-assign-fields",children:[e.jsxs("label",{className:"rw-pr-assign-field",children:[e.jsx("span",{children:"Project"}),e.jsx("select",{value:m,disabled:r||d.length===0,onChange:l=>b(l.target.value),"aria-label":"Project path",children:d.length===0?e.jsx("option",{value:"",children:"No local project"}):d.map(l=>e.jsxs("option",{value:l.path,children:[l.label," · ",hs(l.path)]},l.path))})]}),e.jsxs("label",{className:"rw-pr-assign-field",children:[e.jsx("span",{children:"Harness"}),e.jsxs("select",{value:C,disabled:r,onChange:l=>I(l.target.value),"aria-label":"Harness",children:[pe.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value)),C&&!pe.some(l=>l.value===C)?e.jsx("option",{value:C,children:C}):null]})]}),e.jsxs("label",{className:"rw-pr-assign-field",children:[e.jsx("span",{children:"Model"}),e.jsx("input",{list:"rw-pr-assign-models",value:R,disabled:r,placeholder:"Default for harness",onChange:l=>O(l.target.value),"aria-label":"Model"}),e.jsx("datalist",{id:"rw-pr-assign-models",children:T.map(l=>e.jsx("option",{value:l},l))})]}),e.jsxs("label",{className:"rw-pr-assign-field",children:[e.jsx("span",{children:"Effort"}),e.jsx("select",{value:j,disabled:r,onChange:l=>y(l.target.value),"aria-label":"Reasoning effort",children:ss.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))})]}),e.jsxs("label",{className:"rw-pr-assign-field rw-pr-assign-field--wide",children:[e.jsxs("span",{children:["Agent ",e.jsx("em",{children:"(optional)"})]}),e.jsxs("select",{value:S,disabled:r,onChange:l=>A(l.target.value),"aria-label":"Existing agent (optional)",children:[e.jsx("option",{value:"",children:"New one-time reviewer on project"}),P.map(l=>e.jsx("option",{value:l.id,children:ps(l)},l.id))]})]}),f?e.jsxs("fieldset",{className:"rw-pr-assign-session",disabled:r,children:[e.jsx("legend",{children:"Session"}),e.jsx("div",{className:"rw-pr-assign-session-choices",role:"radiogroup","aria-label":"Session mode",children:ts.map(l=>{const v=l.value==="existing"&&!x,L=N===l.value;return e.jsxs("button",{type:"button",role:"radio","aria-checked":L,className:"rw-pr-assign-session-choice","data-active":L||void 0,disabled:v,title:v?"This agent has no live harness session to continue":l.hint,onClick:()=>$(l.value),children:[e.jsx("span",{className:"rw-pr-assign-session-title",children:l.label}),e.jsx("span",{className:"rw-pr-assign-session-sub",children:v?"No live session on this agent":l.value==="existing"&&Y(f.harnessSessionId)?Y(f.harnessSessionId):l.hint})]},l.value)})})]}):null]}),e.jsx("p",{className:"rw-pr-assign-hint",children:M}),a?e.jsx("div",{className:"rw-pr-assign-error",role:"alert",children:a}):null,e.jsx("div",{className:"rw-pr-assign-actions",children:e.jsx("button",{type:"button",className:"rw-pr-assign-submit",disabled:!D,onClick:()=>{W()},children:F})})]})]})})}const fs=/^Skipped missing repo-watch path:\s*(.+)$/i,gs=4;function js(s){const n=s.trim().replace(/\/+$/,"")||s.trim();if(!n)return"unknown paths";if(n==="~"||n.startsWith("~/"))return"~/*";if(!n.startsWith("/")){const[r]=n.split(/[\\/]/).filter(Boolean);return r?`${r}/*`:n}const t=n.split("/").filter(Boolean);return t[0]==="Users"&&t[1]?`/Users/${t[1]}/*`:t[0]==="Volumes"&&t[1]?`/Volumes/${t[1]}/*`:t.length>=2?`/${t[0]}/${t[1]}/*`:`/${t[0]??""}`}function xs(s,n){const t=[...new Set(s)];if(t.length===1)return{message:`Skipped missing repo-watch path: ${t[0]}`,examples:[],rawCount:1};const r=t.slice(0,gs),a=t.length-r.length;return a>0&&r.push(`+${a} more`),{message:`Skipped ${t.length} missing repo-watch paths under ${n}. These look like stale broker hints.`,examples:r,rawCount:t.length}}function je(s,n){if(s.length===0)return;const t=new Map;for(const r of s){const a=js(r),i=t.get(a);i?i.push(r):t.set(a,[r])}for(const[r,a]of t)n.push(xs(a,r));s.length=0}function bs(s){const n=[],t=[];for(const r of s){const a=fs.exec(r);if(a){t.push(a[1].trim());continue}je(t,n),n.push({message:r,examples:[],rawCount:1})}return je(t,n),n}const xe={attention:"desc",name:"asc",churn:"desc",files:"desc",drift:"desc",attached:"desc"},be="attention";function ws(s){return!s.status.clean||s.branch.ahead>0||s.branch.behind>0||s.agents.some(ie)||s.sessions.length>0||s.error!=null}function vs(s,n){const t=He(s),r=Ce(s),{add:a,del:i,total:o}=Ee(s),c=Pe(s);return{wt:s,project:n,state:Ae(s),add:a,del:i,churn:o,files:r.files+Math.max(t.files,s.status.changedFiles),live:c.filter(ie).length,agentsUnique:c}}function Te(s){return s.status.conflicts>0||s.error!=null}function Ns(s){const n=s.flatMap(i=>i.worktrees.filter(Te).map(o=>{const c=o.branch.name??o.name;return o.status.conflicts>0?`${i.name}/${c}: ${w(o.status.conflicts)} conflict${o.status.conflicts===1?"":"s"}`:`${i.name}/${c}: scan error`})),t="Worktrees blocked by conflicts or scan errors.";if(n.length===0)return t;const r=n.slice(0,8),a=n.length-r.length;return[t,...r,a>0?`+${a} more`:null].filter(i=>!!i).join(`
|
|
3
|
-
`)}function Ss({snapshot:s,selectedId:n,onSelect:t,onViewDiff:r,scanDepth:a,scanMorePending:i,onScanMore:o,openPullRequestCount:c,openPullRequestTitle:h}){const[p,d]=u.useState(be),[m,b]=u.useState(xe[be]),[S,A]=u.useState(!1),{liveRows:P,cleanRows:f,stats:x,blockedTitle:C}=u.useMemo(()=>{const j=[],y=[];let N=0,$=0,T=0;for(const F of s.projects)for(const M of F.worktrees){const l=vs(M,F);T+=l.files,l.live>0&&N++,Te(M)&&$++,(ws(M)?j:y).push(l)}const D=s.totals,W={repos:D.projects,worktrees:D.worktrees,dirtyWorktrees:D.dirtyWorktrees,changedFiles:T,live:N,blocked:$};return{liveRows:j,cleanRows:y,stats:W,blockedTitle:Ns(s.projects)}},[s.projects,s.totals]),I=u.useMemo(()=>{const j=Ms(P,p,m),y=new Map;for(const N of j){const $=y.get(N.project.id);$?$.push(N):y.set(N.project.id,[N])}return[...y.values()]},[P,p,m]);function R(j){j===p?b(y=>y==="asc"?"desc":"asc"):(d(j),b(xe[j]))}const O=P.length===0&&f.length===0;return e.jsxs("section",{className:"rw-table",children:[e.jsxs("div",{className:"rw-head",children:[e.jsxs("div",{className:"rw-head-top",children:[e.jsx("span",{className:"rw-eyebrow",children:"STATE OF REPOS"}),f.length>0?e.jsxs("button",{type:"button",className:"rw-clean",style:{marginLeft:"auto"},onClick:()=>A(j=>!j),"aria-pressed":S,children:[S?"hide":"show"," clean & idle (",f.length,")"]}):null]}),e.jsxs("div",{className:"stats",children:[e.jsx(U,{v:x.repos,k:"REPOS"}),x.worktrees>x.repos?e.jsx(U,{v:x.worktrees,k:"WORKTREES",title:`${w(x.worktrees)} worktrees across ${w(x.repos)} repos.`}):null,e.jsx(U,{v:x.changedFiles,k:"CHANGED",title:`${w(x.changedFiles)} changed files across ${w(x.dirtyWorktrees)} dirty worktree${x.dirtyWorktrees===1?"":"s"}.`}),x.live>0?e.jsx(U,{v:x.live,k:"WORKING",tone:"mint"}):null,(c??0)>0?e.jsx(U,{v:c??0,k:"OPEN PRS",tone:"amber",title:h??void 0}):null,x.blocked>0?e.jsx(U,{v:x.blocked,k:"BLOCKED",tone:"coral",title:C}):null]})]}),e.jsxs("div",{className:"tbl-wrap",children:[e.jsxs("div",{className:"tbl-head",children:[e.jsx(V,{label:"REPO / BRANCH · WORKTREE",k:"name",sortKey:p,dir:m,onSort:R}),e.jsx(V,{label:"CHURN",k:"churn",sortKey:p,dir:m,onSort:R,align:"r"}),e.jsx(V,{label:"FILES",k:"files",sortKey:p,dir:m,onSort:R,align:"c"}),e.jsx(V,{label:"DRIFT",k:"drift",sortKey:p,dir:m,onSort:R,align:"c"}),e.jsx(V,{label:"ATTACHED",k:"attached",sortKey:p,dir:m,onSort:R})]}),O?e.jsx("div",{className:"rw-empty",children:"No repositories discovered yet."}):I.map(j=>j.length>1?e.jsx(Rs,{group:j,selectedId:n,onSelect:t,onViewDiff:r},j[0].project.id):e.jsx(ae,{row:j[0],top:!0,selected:n===j[0].wt.id,onSelect:()=>t(j[0].wt.id),onViewDiff:r},j[0].wt.id)),S&&f.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"tbl-head",style:{position:"static"},children:e.jsxs("span",{children:["CLEAN & IDLE · ",f.length]})}),f.map(j=>e.jsx(ae,{row:j,top:!0,clean:!0,selected:n===j.wt.id,onSelect:()=>t(j.wt.id),onViewDiff:r},j.wt.id))]}):null,e.jsx(ks,{snapshot:s,scanDepth:a,scanMorePending:i,onScanMore:o})]})]})}function ks({snapshot:s,scanDepth:n,scanMorePending:t,onScanMore:r}){const a=ys(s),i=bs(s.warnings),o=i.reduce((c,h)=>c+h.rawCount,0);return e.jsxs("div",{className:"scan-coverage",children:[e.jsxs("div",{className:"scan-coverage-row",children:[e.jsx("b",{children:"SCAN"}),e.jsx("span",{className:"scan-main",children:a.summary}),a.canScanMore&&n==="standard"?e.jsx("button",{type:"button",onClick:r,disabled:t,children:t?"Scanning":"Scan more"}):e.jsx("span",{className:"scan-chip",children:n==="expanded"?"expanded":"standard"})]}),i.length>0?e.jsxs("details",{className:"scan-details",children:[e.jsxs("summary",{children:[w(i.length)," diagnostic group",i.length===1?"":"s",o!==i.length?` (${w(o)} raw)`:""]}),e.jsx("ul",{children:i.map((c,h)=>e.jsxs("li",{children:[e.jsx("span",{children:c.message}),c.examples.length>0?e.jsx("span",{className:"scan-detail-examples",children:c.examples.join(" · ")}):null]},`${h}:${c.message}`))})]}):null]})}function ys(s){let n=null,t=0,r=0,a=0,i=0,o=0,c=0;for(const p of s.warnings){const d=/limited discovery to (\d+) repositories/i.exec(p);if(d){n=`discovery capped at ${d[1]}`;continue}if(/limited .* to \d+ worktrees/i.test(p)){t++;continue}if(/skipped unreadable worktree/i.test(p)){r++;continue}if(/skipped missing repo-watch path/i.test(p)){a++;continue}if(/scan budget|stopped discovery|stopped scanning/i.test(p)){i++;continue}if(/could not resolve git common directory/i.test(p)){o++;continue}c++}const h=[`${w(s.totals.projects)} repo${s.totals.projects===1?"":"s"}`,`${w(s.totals.worktrees)} worktree${s.totals.worktrees===1?"":"s"}`];return n&&h.push(n),t&&h.push(`${w(t)} repo${t===1?"":"s"} at worktree cap`),r&&h.push(`${w(r)} unreadable worktree${r===1?"":"s"} skipped`),a&&h.push(`${w(a)} missing path${a===1?"":"s"}`),o&&h.push(`${w(o)} unresolved git dir${o===1?"":"s"}`),i&&h.push("scan budget reached"),c&&h.push(`${w(c)} other diagnostic${c===1?"":"s"}`),{summary:h.join(" · "),canScanMore:n!==null||t>0||i>0}}function Rs({group:s,selectedId:n,onSelect:t,onViewDiff:r}){const a=s[0].project,i=s.some(p=>p.state==="error"),o=s.reduce((p,d)=>p+d.add,0),c=s.reduce((p,d)=>p+d.del,0),h=s.reduce((p,d)=>p+(d.live?1:0),0);return e.jsxs("div",{children:[e.jsxs("div",{className:"repo-grp"+(i?" attn":""),children:[e.jsxs("div",{className:"rg-name",children:[e.jsx("span",{className:"rg-tw","aria-hidden":!0,children:e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",style:{transform:"rotate(90deg)"},children:e.jsx("path",{d:"M3 2l4 3.5L3 9",stroke:"currentColor",strokeWidth:"1.3",fill:"none"})})}),e.jsx("span",{className:"dot "+Is(s)}),e.jsx("span",{className:"rg-nm",children:a.name}),e.jsx("span",{className:"rg-path",children:Ie(a.root,3)}),e.jsxs("span",{className:"rg-badge",children:[a.worktrees.length," worktrees"]})]}),e.jsx("div",{className:"rg-agg",children:o||c?e.jsxs("span",{children:[e.jsxs("span",{style:{color:"var(--mint-dim)"},children:["+",w(o)]})," ",e.jsxs("span",{style:{color:"var(--coral-dim)"},children:["−",w(c)]})]}):"—"}),e.jsx("div",{}),e.jsx("div",{}),e.jsx("div",{className:"rg-agg",style:{textAlign:"left"},children:h?`${h} working`:""})]}),s.map((p,d)=>e.jsx(ae,{row:p,guide:!0,last:d===s.length-1,selected:n===p.wt.id,onSelect:()=>t(p.wt.id),onViewDiff:r},p.wt.id))]})}function ae({row:s,top:n,guide:t,last:r,clean:a,selected:i,onSelect:o,onViewDiff:c}){const{wt:h,project:p}=s,d=h.branch,m=Ce(h),b=!!c&&(s.files>0||m.has||h.branch.ahead>0);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:["wt",i?"sel":"",s.state==="error"?"attn":""].join(" "),style:n&&!a?{borderTop:"1px solid var(--line)"}:void 0,onClick:o,role:"button",tabIndex:0,onKeyDown:o?S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),o())}:void 0,children:[e.jsxs("div",{className:"wt-name",children:[t?e.jsx("span",{className:"tw-guide"+(r?" last":"")}):null,e.jsxs("div",{className:"inner",children:[e.jsx("span",{className:"dot "+s.state}),e.jsxs("span",{className:"br",children:[n&&!t?e.jsxs("span",{className:"lead",children:[p.name," "]}):null,e.jsx(Me,{branch:h.branch,fallback:h.name})]}),e.jsx(As,{wt:h})]})]}),e.jsx($s,{add:s.add,del:s.del}),e.jsx("div",{className:"files",children:s.files>0?e.jsxs("span",{children:[s.files,h.status.conflicts>0?e.jsxs("span",{className:"conf",children:[" ⚠",h.status.conflicts]}):null]}):e.jsx("span",{className:"dash",children:"—"})}),e.jsx(Cs,{ahead:d.ahead,behind:d.behind}),e.jsxs("div",{className:"agents-cell",children:[e.jsx(Ps,{row:s}),b?e.jsx("button",{type:"button",className:"wt-diff",title:`View diff · ${s.files} changed file${s.files===1?"":"s"}`,"aria-label":"View diff",onClick:S=>{S.stopPropagation(),c?.(h.path)},children:"diff"}):null]})]})})}function U({v:s,k:n,tone:t,title:r}){return e.jsxs("div",{className:"stat",title:r,"aria-label":r?`${w(s)} ${n}. ${r}`:void 0,children:[e.jsx("span",{className:"v"+(t?" "+t:""),children:w(s)}),e.jsx("span",{className:"k",children:n})]})}function V({label:s,k:n,sortKey:t,dir:r,onSort:a,align:i}){const o=t===n;return e.jsx("div",{className:i==="r"?"r":i==="c"?"c":"",children:e.jsxs("button",{type:"button",className:o?"on":"",onClick:()=>a(n),children:[e.jsx("span",{children:s}),e.jsx("span",{className:"caret","aria-hidden":!0,children:r==="asc"?"▲":"▼"})]})})}function $s({add:s,del:n}){if(!s&&!n)return e.jsx("div",{className:"churn",children:e.jsx("span",{className:"dash",children:"—"})});const t=s+n||1;return e.jsxs("div",{className:"churn",children:[e.jsxs("span",{className:"nums",children:[e.jsxs("span",{className:"add",children:["+",w(s)]}),e.jsx("span",{className:"sl",children:"/"}),e.jsxs("span",{className:"del",children:["−",w(n)]})]}),e.jsxs("span",{className:"cbar",title:`+${w(s)} −${w(n)}`,children:[e.jsx("span",{className:"g",style:{width:s/t*100+"%"}}),e.jsx("span",{className:"r",style:{width:n/t*100+"%"}})]})]})}function Cs({ahead:s,behind:n}){return!s&&!n?e.jsx("div",{className:"drift",children:e.jsx("span",{className:"dash",children:"—"})}):e.jsxs("div",{className:"drift",children:[s?e.jsxs("span",{className:"dp ahead",children:["↑",s]}):null,n?e.jsxs("span",{className:"dp behind",children:["↓",n]}):null]})}const Es=2;function Ps({row:s}){const n=s.agentsUnique,t=s.wt.sessions,r=[...n.map(o=>`${X(o)} (${o.state??"—"})`),...t.map(o=>`session ${
|
|
4
|
-
`);if(n.length===0)return e.jsx("div",{className:"agents",title:r,children:t.length>0?e.jsxs("span",{className:"ahandle",children:[t.length," session",t.length===1?"":"s"]}):e.jsx("span",{className:"dash",children:"—"})});const a=n.slice(0,Es),i=n.length-a.length;return e.jsxs("div",{className:"agents",title:r,children:[s.live>0?e.jsxs("span",{className:"alive",children:[e.jsx("span",{className:"d"}),s.live]}):null,e.jsx("span",{className:"ahandle",children:a.map(o=>X(o)).join(" ")}),i>0?e.jsxs("span",{className:"amore",children:["+",i]}):null]})}function As({wt:s}){const n=[];return s.branch.detached?n.push({label:"DETACHED",cls:""}):s.branch.upstream||n.push({label:"LOCAL",cls:""}),s.error!=null&&n.push({label:"SCAN ERR",cls:"err"}),s.isBare&&n.push({label:"BARE",cls:""}),e.jsx(e.Fragment,{children:n.map(t=>e.jsx("span",{className:"tag "+t.cls,children:t.label},t.label))})}const we={error:3,live:2,dirty:1,clean:0};function Is(s){return s.reduce((n,t)=>we[t.state]>we[n]?t.state:n,"clean")}function Ms(s,n,t){const r=t==="asc"?1:-1,a=d=>{switch(n){case"attention":return-G(d.wt.attention);case"churn":return d.churn;case"files":return d.files;case"drift":return d.wt.branch.ahead+d.wt.branch.behind;case"attached":return d.live*1e6+d.agentsUnique.length*1e3+d.wt.sessions.length;default:return 0}},i=new Map;for(const d of s){const m=i.get(d.project.id);m?m.push(d):i.set(d.project.id,[d])}const o=(d,m)=>{if(n==="name")return
|
|
5
|
-
`),children:[n.map(r=>e.jsx("span",{className:"bd-av"+(ie(r)?" live":""),children:Ts(r)},X(r))),t>0?e.jsxs("span",{className:"bd-av-more",children:["+",t]}):null]})}function Bs({ahead:s,behind:n,hasError:t}){return t?e.jsx("div",{className:"bd-flag err",children:"SCAN ERR"}):s>0&&n>0?e.jsx("div",{className:"bd-flag rebase",children:"DIVERGED ▸"}):n>0?e.jsx("div",{className:"bd-flag rebase",children:"REBASE ▸"}):s>0?e.jsxs("div",{className:"bd-flag ahead",children:["AHEAD ",s]}):e.jsx("div",{className:"bd-flag sync",children:"IN SYNC"})}const Hs=1e4,Us=15e3,Ks=45e3,Vs=45e3,zs="openscout.repos.tone",Ne=["warm","cool","mono"],Gs="openscout.repos.view",Se=["table","drift"],Xs=12;function Ys(s){return s.warnings.some(n=>/scan budget|stopped discovery|stopped scanning/i.test(n))}function Js(s,n){return s.totals.worktrees<n.totals.worktrees||s.totals.projects<n.totals.projects}function Qs(s){return s&&typeof s=="object"&&"name"in s&&s.name==="AbortError"?"Repo Watch scan timed out; keeping the last available snapshot.":s instanceof Error?s.message:String(s)}function ke(s,n,t){const[r,a]=u.useState(()=>{if(typeof window>"u")return t;try{const o=window.localStorage.getItem(s);return o&&n.includes(o)?o:t}catch{return t}}),i=u.useCallback(o=>{a(o);try{window.localStorage.setItem(s,o)}catch{}},[s]);return[r,i]}function ye(s){let n=null,t=-1/0;for(const r of s)for(const a of r.worktrees){const i=a.agents.filter(c=>(c.state??"").toLowerCase()==="active").length,o=(4-G(a.attention))*1e6+i*1e4+a.status.changedFiles;o>t&&(t=o,n=a)}return n}function Zs(s,n){if(!s||!n)return{worktree:null,project:null};for(const t of s.projects)for(const r of t.worktrees)if(r.id===n)return{worktree:r,project:t};return{worktree:null,project:null}}function re(s){if(!s)return 0;const n=/(\d+)\s+files?\s+changed/.exec(s);return n?Number(n[1]):0}function et(s){const n=new Set,t=[];for(const r of s.projects){const a=r.worktrees[0]?.path??r.root;!a||n.has(a)||(n.add(a),t.push(a))}return t}function st(s,n){if(!s)return"updated";const t=Date.parse(s);return Number.isFinite(t)?
|
|
6
|
-
`)}function Re(s,n){return n?s.path===n.root||n.worktrees.some(r=>r.path===s.path)?!0:s.repo.split("/").pop()?.toLowerCase()===n.name.toLowerCase():!1}function $e(s,n){const t=n?.branch.name?.trim();return!!(t&&s.headRefName===t)}function nt(s,n){if(!n)return null;const t=s.headRefName?.trim();if(!t)return null;const r=[];for(const a of n.projects)for(const i of a.worktrees)i.branch.name?.trim()===t&&r.push({id:i.id,path:i.path,branch:t});if(r.length===0)return null;if(s.path){const a=r.find(i=>i.path===s.path);if(a)return a}return r[0]??null}function rt(s,n){const t=[];for(const r of s.projects)for(const a of r.worktrees){const i=a.status.staged+a.status.unstaged+a.status.untracked+a.status.conflicts,o=a.agents.filter(m=>(m.state??"").toLowerCase()==="active").length,c=re(a.diff.branchShortstat),h=Math.max(a.status.changedFiles,re(a.diff.stagedShortstat)+re(a.diff.unstagedShortstat)),p=a.branch.ahead+a.branch.behind,d=o+a.sessions.length;i===0&&d===0&&c===0&&p===0||t.push({path:a.path,score:(a.id===n?1e7:0)+(4-G(a.attention))*1e5+o*1e4+a.sessions.length*5e3+p*1e3+c*250+i*100+h})}return t.sort((r,a)=>a.score-r.score).map(r=>r.path)}function z({children:s}){return e.jsx("div",{className:"s-ops",children:e.jsx("div",{className:"s-ops-body",style:{overflowY:"auto"},children:s})})}function at({error:s}){return e.jsxs("div",{className:"rw-empty-next",children:[e.jsx("p",{className:"rw-empty-copy",children:"Repos is waiting on the local Scout Services layer. Restart the broker from the menu bar app, then rescan."}),e.jsxs("ol",{className:"rw-empty-steps",children:[e.jsxs("li",{children:["Click ",e.jsx("span",{className:"rw-empty-action-name",children:"Restart broker"})," to hand off to the menu bar app."]}),e.jsx("li",{children:"Wait for Scout Services to report the broker online."}),e.jsxs("li",{children:["If nothing opens, run ",e.jsx("code",{children:"scout doctor"})," and follow the repair command it prints."]})]}),s?e.jsx("p",{className:"rw-empty-error",children:s}):null]})}function it({snapshot:s,loading:n,error:t,selectedProject:r,selectedWorktree:a,repoSnapshot:i,onSelectWorktree:o,onOpenDiff:c,navigate:h}){const{agents:p}=Qe(),d=We(),[m,b]=u.useState(null),[S,A]=u.useState(null),[P,f]=u.useState(!1),[x,C]=u.useState(null),I=u.useRef(null),R=u.useCallback(l=>{b(l),I.current!=null&&window.clearTimeout(I.current),l&&(I.current=window.setTimeout(()=>b(null),6e3))},[]);u.useEffect(()=>()=>{I.current!=null&&window.clearTimeout(I.current)},[]);const O=u.useCallback(()=>{P||(A(null),C(null))},[P]),j=u.useMemo(()=>(i?.projects??[]).map(l=>({root:l.root,name:l.name})),[i]),y=s?.pullRequests??[],N=a?.branch.name??null,$=y.filter(l=>Re(l,r)),T=$.filter(l=>$e(l,a)),D=$.filter(l=>!$e(l,a)),W=y.filter(l=>!Re(l,r)),F=[T.length>0?{key:"branch",label:N?`Selected branch · ${N}`:"Selected branch",items:T}:null,D.length>0?{key:"project",label:r?`${r.name} PRs`:"Selected project",items:D}:null,W.length>0?{key:"other",label:$.length>0?"Other open PRs":"Open PRs",items:W}:null].filter(l=>!!l);if(!n&&!t&&y.length===0)return null;const M=(l,v)=>{l.preventDefault(),d(l,us(v,{matchingWorktree:nt(v,i),onBeginAssign:L=>{C(null),A(L)},onSelectWorktreeId:o,onOpenDiff:c,onStatus:R}))};return e.jsxs("section",{className:"rw-open-prs","aria-label":"Open pull requests",children:[e.jsxs("div",{className:"rw-open-prs-head",children:[e.jsxs("div",{children:[e.jsx("div",{className:"rw-open-prs-eyebrow",children:"Open PRs"}),e.jsx("div",{className:"rw-open-prs-title",children:n&&y.length===0?"Checking GitHub":`${y.length} open`}),m?e.jsx("div",{className:"rw-open-prs-status",role:"status",children:m}):null]}),s?e.jsx("span",{className:"rw-open-prs-meta",children:"gh"}):null]}),y.length>0?e.jsx("div",{className:"rw-open-prs-list",children:F.map(l=>e.jsxs("div",{className:"rw-open-pr-group",children:[F.length>1?e.jsx("div",{className:"rw-open-pr-group-label",children:l.label}):null,l.items.map(v=>e.jsxs("button",{type:"button",className:"rw-open-pr",title:`${v.title} — click for actions`,onClick:L=>M(L,v),onContextMenu:L=>M(L,v),children:[e.jsxs("span",{className:"rw-open-pr-main",children:[e.jsxs("span",{className:"rw-open-pr-number",children:["#",v.number]}),e.jsx("span",{className:"rw-open-pr-title",title:v.title,children:v.title})]}),e.jsxs("span",{className:"rw-open-pr-detail",children:[e.jsx("span",{children:v.repo}),e.jsxs("span",{children:[v.headRefName||"head"," → ",v.baseRefName||"base"]}),v.isDraft?e.jsx("span",{children:"draft"}):e.jsx("span",{children:"open"}),v.author?e.jsxs("span",{children:["@",v.author]}):null,e.jsx("span",{children:st(v.updatedAt,s?.generatedAt??Date.now())})]})]},v.id))]},l.key))}):e.jsx("div",{className:"rw-open-prs-empty",children:t??"No open pull requests returned."}),S?e.jsx(ms,{pr:S,agents:p,projects:j,pending:P,error:x,onClose:O,onPendingChange:f,onError:C,onAssigned:l=>{A(null),C(null),R(l.message),(l.flightId||l.conversationId||l.targetAgentId)&&h({view:"follow",...l.flightId?{flightId:l.flightId}:{},...l.conversationId?{conversationId:l.conversationId}:{},...l.targetAgentId?{targetAgentId:l.targetAgentId}:{}})}}):null]})}function an({navigate:s,focusRoot:n=null}){const[t,r]=u.useState(null),[a,i]=u.useState("loading"),[o,c]=u.useState(null),h=u.useRef(!1),p=u.useRef(0),d=u.useRef(null),m=u.useRef(!1),[b,S]=ke(zs,Ne,"warm"),[A,P]=ke(Gs,Se,"table"),[f,x]=u.useState(null),[C,I]=u.useState("standard"),[R,O]=u.useState(!1),[j,y]=u.useState(null),[N,$]=u.useState(!1),[T,D]=u.useState(!1),[W,F]=u.useState(null),[M,l]=u.useState(null),[v,L]=u.useState(!1),[De,Z]=u.useState(null),[B,K]=u.useState(null),q=u.useCallback(async(g={})=>{if(m.current&&!g.force)return;m.current=!0;const k=g.depth??C;g.scanMore&&$(!0),g.force&&!g.scanMore&&O(!0);try{let E=await he(k,g.force??!1,k==="expanded"?Ks:Us),_=k;if(!h.current&&k==="standard"&&!g.force&&E.projects.length===0)try{const ue=await he("expanded",!0,Vs);ue.projects.length>0&&(E=ue,_="expanded")}catch{}const de=d.current;if(de&&Ys(E)&&(E.projects.length===0||Js(E,de))){c("Scan budget was reached; keeping the last fuller Repo Watch snapshot."),i("ready");return}if(!g.force&&E.projects.length===0&&h.current&&p.current<3){p.current+=1,i("ready");return}p.current=0,h.current=!0,d.current=E,r(E),c(null),i("ready"),(g.scanMore||_!==k)&&I(_),g.force&&!g.scanMore&&y(`Fresh ${new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}`)}catch(E){const _=Qs(E);c(_),h.current||i("error")}finally{g.scanMore&&$(!1),g.force&&!g.scanMore&&O(!1),m.current=!1}},[C]);u.useEffect(()=>{d.current=t},[t]),u.useEffect(()=>{q();const g=setInterval(()=>{q()},Hs);return()=>clearInterval(g)},[q]);const le=u.useRef(null);u.useEffect(()=>{if(!t)return;if(n&&le.current!==n){const k=t.projects.find(E=>E.root===n||E.worktrees.some(_=>_.path===n));if(!k)return;if(le.current=n,!k.worktrees.some(E=>E.id===f)){x(ye([k])?.id??null);return}}t.projects.some(k=>k.worktrees.some(E=>E.id===f))||x(ye(t.projects)?.id??null)},[t,f,n]),u.useEffect(()=>{!t||t.projects.length===0||Je(rt(t,f),void 0,{limit:Xs})},[t,f]);const ee=u.useMemo(()=>t?et(t):[],[t]),Le=ee.join("\0");u.useEffect(()=>{if(ee.length===0){l(null),Z(null),L(!1);return}let g=!1;return L(!0),Z(null),qe(ee).then(k=>{g||l(k)}).catch(k=>{g||Z(k instanceof Error?k.message:String(k))}).finally(()=>{g||L(!1)}),()=>{g=!0}},[Le]);const H=u.useMemo(()=>Zs(t,f),[t,f]),Oe=u.useMemo(()=>tt(M),[M]);u.useEffect(()=>{ze({worktree:H.worktree,project:H.project,generatedAt:t?.generatedAt??0,tone:b})},[H.worktree,H.project,t?.generatedAt,b]),u.useEffect(()=>Ge,[]);const oe=u.useCallback(()=>{q({depth:"expanded",force:!0,scanMore:!0})},[q]),ce=u.useCallback(()=>{q({force:!0})},[q]),Fe=u.useCallback(async()=>{if(!T){D(!0),F(null);try{const g=await fetch("/api/scout-services/restart-link",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({target:"broker"})});if(!g.ok)throw new Error(`Scout Services link failed (${g.status})`);const k=await g.json();if(!k.url?.startsWith("scout://services/restart/"))throw new Error("Scout Services link was not returned.");window.location.assign(k.url)}catch(g){const k=g instanceof Error?g.message:String(g);F(`${k} Run scout doctor if the menu app did not open.`)}finally{D(!1)}}},[T]);return a==="loading"?e.jsx(z,{navigate:s,children:e.jsx("div",{className:"repo-watch-scope",style:{padding:"24px"},children:e.jsx(se,{title:"Scanning repositories…",body:"Reading worktree state from the broker."})})}):a==="error"&&!t?e.jsx(z,{navigate:s,children:e.jsx("div",{className:"repo-watch-scope",style:{padding:"24px"},children:e.jsx(se,{className:"sys-state-card-error",title:"Couldn’t load Repo Watch",body:o??"The broker did not return a snapshot.",action:e.jsx("button",{type:"button",className:"s-btn",onClick:()=>{i("loading"),q()},children:"Retry"})})})}):t&&t.projects.length===0?e.jsx(z,{navigate:s,children:e.jsx("div",{className:"repo-watch-scope",style:{padding:"24px"},children:e.jsx(se,{title:"Scout Services need attention",body:e.jsx(at,{error:W}),action:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"s-btn s-btn-primary",onClick:()=>{Fe()},disabled:T,children:T?"Opening…":"Restart broker"}),e.jsx("button",{type:"button",className:"s-btn",onClick:ce,disabled:R||N,children:R?"Scanning…":"Scan again"}),e.jsx("button",{type:"button",className:"s-btn",onClick:oe,disabled:R||N,children:N?"Scanning…":"Scan more"})]})})})}):t?e.jsx(z,{navigate:s,children:e.jsxs("div",{className:"repo-watch-scope",children:[e.jsx("div",{className:"rw-scope tone-"+b,children:e.jsxs("div",{className:"rw-page-shell",children:[e.jsxs("div",{className:"rw-toolbar",children:[e.jsxs("button",{type:"button",className:"rw-refresh-main",onClick:ce,disabled:R||N,children:[e.jsx(Ze,{size:14,"aria-hidden":"true",className:R?"rw-refresh-spin":void 0}),e.jsx("span",{children:R?"Scanning":"Refresh"})]}),j?e.jsx("span",{className:"rw-refresh-receipt",children:j}):null,e.jsxs("details",{className:"rw-display-menu",children:[e.jsxs("summary",{"aria-label":"Display options",children:[e.jsx(es,{size:14,"aria-hidden":"true"}),e.jsx("span",{children:"Display"})]}),e.jsxs("div",{className:"rw-display-panel",children:[e.jsxs("div",{className:"rw-display-row",children:[e.jsx("span",{className:"rw-display-label",children:"View"}),e.jsx("div",{className:"rw-tone",role:"group","aria-label":"View",children:Se.map(g=>e.jsx("button",{type:"button",className:g===A?"on":"","aria-pressed":g===A,onClick:()=>P(g),children:g},g))})]}),e.jsxs("div",{className:"rw-display-row",children:[e.jsx("span",{className:"rw-display-label",children:"Tone"}),e.jsx("div",{className:"rw-tone",role:"group","aria-label":"Console tone",children:Ne.map(g=>e.jsx("button",{type:"button",className:g===b?"on":"","aria-pressed":g===b,onClick:()=>S(g),children:g},g))})]})]})]})]}),e.jsx("div",{className:"min-w-0",children:A==="drift"?e.jsx(Ds,{snapshot:t,selectedId:f,onSelect:x}):e.jsxs(e.Fragment,{children:[e.jsx(Ss,{snapshot:t,selectedId:f,onSelect:x,onViewDiff:K,scanDepth:C,scanMorePending:N,onScanMore:oe,openPullRequestCount:M?.pullRequests.length??null,openPullRequestTitle:Oe}),e.jsx(it,{snapshot:M,loading:v,error:De,selectedProject:H.project,selectedWorktree:H.worktree,repoSnapshot:t,onSelectWorktree:x,onOpenDiff:K,navigate:s})]})})]})}),e.jsx(Xe,{open:B!=null,onClose:()=>K(null),side:"right",owner:"openscout.repos-diff-viewer",resizable:!0,defaultSize:840,maxSize:1280,minSize:420,ariaLabel:"Worktree diff",children:B!=null?e.jsx(Ye,{path:B,onClose:()=>K(null),onOpenAsPage:()=>{B&&(s({view:"repo-diff",path:B}),K(null))}},B):null})]})}):e.jsx(z,{navigate:s})}export{an as ReposScreen,an as default};
|
|
1
|
+
import{r as u,j as e}from"./index-Bli6bTLU.js";import{E as se}from"./EmptyState-BnDda92b.js";import{u as We,a as qe}from"./Provider-Ve8yXaWR.js";import{f as he,b as _e}from"./api-BHHEUSS3.js";import{a as Be}from"./api-DEHEgJ9m.js";import{c as te}from"./clipboard-e3fSpeo7.js";import{u as He}from"./keyboard-nav-7iEtvu9P.js";/* empty css */import{f as w,c as Ue,b as Ce,r as Ee,u as Pe,i as ie,w as Ae,k as Ie,l as Ke,m as G,a as X,s as Ve,h as ze}from"./ui-LM8pS8qE.js";import{B as Me,p as Ge,c as Xe}from"./selection-bridge-CpzFGx3-.js";import{S as Ye}from"./SlidePanel-Dg8_styW.js";import{R as Je}from"./RepoDiffViewerLazy-zIiEmh-e.js";import{p as Qe}from"./cache-BO2Bd_LV.js";import{R as Ze}from"./refresh-cw-IgN2fZLM.js";import{S as es}from"./sliders-horizontal-7V8B3xsf.js";import"./provider-CX9EWecp.js";import"./router-B0YclXYg.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-D4dHTRkt.js";import"./sse-CSozY6mp.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-D4vuKzOL.js";import"./DocumentFocusViewer-DmtFisY9.js";import"./createLucideIcon-DLlxGjKt.js";import"./TextDocumentSurface-C7fGlzY8.js";import"./file-text-BVhkMWyC.js";import"./x-BJyPzFnn.js";import"./chevron-right-BMqtBds_.js";import"./code-xml-ByQsfOI_.js";import"./arrow-left-i-h6JAgs.js";import"./arrow-right-B0Yi01Zr.js";import"./scout-voice-DvG_3stJ.js";import"./fx-z37u1o2z.js";import"./NewChatComposer-Bgqes0UQ.js";import"./text-BR9Bap0E.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-DoT8gpw6.js";import"./conversation-model-CigSPlKA.js";import"./time-Dhsh_2EG.js";import"./index-DFdlQs_c.js";import"./HarnessMark-DGZ6o6Ct.js";import"./NewChatOrigin-DpHS2Wmt.js";import"./chevron-down-Da5tV19_.js";import"./search-BbgsEMXa.js";import"./chunk-HRAB3GC3-BUVYXXAp.js";/* empty css */const pe=[{value:"claude",label:"Claude"},{value:"codex",label:"Codex"},{value:"pi",label:"Grok"}],ss=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"XHigh"}],ts=[{value:"new",label:"New session",hint:"Start a fresh harness session for this agent"},{value:"existing",label:"Continue session",hint:"Resume this agent’s current harness session"}];function me(s){return`gh pr checkout ${s.number}`}function ns(s){return[`Please review pull request #${s.number}: ${s.title}`,"",`URL: ${s.url}`,`Repo: ${s.repo}`,`Branch: ${s.headRefName||"head"} → ${s.baseRefName||"base"}`,s.path?`Local path: ${s.path}`:null,s.author?`Author: @${s.author}`:null,s.isDraft?"Status: draft":"Status: open","","Read the diff, summarize the change, call out risks or test gaps, and recommend ship / revise / hold."].filter(n=>n!=null).join(`
|
|
2
|
+
`)}function Q(s){return s.handle?.trim()||s.name?.trim()||s.id}function fe(s,n){const t=s?.trim(),r=n?.trim();return!t||!r?!1:t===r||t.startsWith(`${r}/`)||r.startsWith(`${t}/`)}function rs(s){switch(s?.trim().toLowerCase()){case"available":case"idle":case"callable":return 40;case"active":case"working":case"running":case"in_turn":case"in_flight":return 20;case"queued":case"waiting":case"waking":return 10;case"offline":case"retired":case"stale":case"blocked":return-50;default:return 0}}function as(s,n,t){const r=t?.trim()||s.path?.trim()||null,a=s.repo.split("/").pop()?.toLowerCase()??"",i=s.headRefName?.trim()??"";return n.filter(o=>!o.retiredFromFleet).map(o=>{let c=rs(o.state);return(fe(o.projectRoot,r)||fe(o.cwd,r))&&(c+=1e3),a&&o.project?.trim().toLowerCase()===a&&(c+=400),i&&o.branch?.trim()===i&&(c+=200),{agent:o,score:c}}).sort((o,c)=>c.score!==o.score?c.score-o.score:Q(o.agent).localeCompare(Q(c.agent))).map(o=>o.agent)}function ge(s,n){const t=new Map,r=s.path?.trim();if(r){const a=r.split("/").filter(Boolean).at(-1)??r;t.set(r,s.repo||a)}for(const a of n){const i=a.root?.trim();i&&(t.has(i)||t.set(i,a.name?.trim()||i.split("/").filter(Boolean).at(-1)||i))}return[...t.entries()].map(([a,i])=>({path:a,label:i}))}function ne(s,n){return s?.harness?.trim()||n?.trim()||"claude"}function is(s){return s?.model?.trim()||""}function ls(s,n){const t=new Set,r=n?.model?.trim();r&&t.add(r);for(const a of s){const i=a.model?.trim();i&&t.add(i)}return[...t]}function os(s){const n=s.harness?.trim()||void 0,t=s.model?.trim()||void 0,r=s.reasoningEffort?.trim()||void 0;return{...n?{harness:n}:{},...t?{model:t}:{},...r?{reasoningEffort:r}:{}}}async function cs(s,n){const t=ns(s),r=n.projectPath.trim();if(!r)throw new Error("Pick a project path for the review.");const a=os(n),i=n.agent??null,o=i&&n.sessionMode==="existing"?"existing":"new";if(i&&o==="existing"&&!i.harnessSessionId?.trim())throw new Error(`@${Q(i)} has no live harness session to continue. Pick “New session” instead.`);const c=await Be("/api/sessions",{method:"POST",body:JSON.stringify({target:i?{agentId:i.id,projectPath:r}:{projectPath:r},execution:{session:o,...o==="existing"&&i?.harnessSessionId?.trim()?{targetSessionId:i.harnessSessionId.trim()}:{},...a},agent:{persistence:i?"sticky":"one_time",...i?.handle?.trim()?{handle:i.handle.trim()}:{}},seed:{instructions:t}})}),h=c.flightId??c.flight?.id??null,p=c.targetAgentId??c.flight?.targetAgentId??c.agentId??i?.id??null,d=c.targetLabel?.trim()||(i?Q(i):null)||p||"one-time reviewer",m=i?o==="existing"?"continue":"new session":"one-time";return{message:[`Assigned #${s.number} for review → ${d.startsWith("@")?d:`@${d}`}`,`· ${m}`,a.harness?`· ${a.harness}`:null,a.model?`· ${a.model}`:null,a.reasoningEffort?`· ${a.reasoningEffort}`:null,h?`· ${h}`:null].filter(Boolean).join(" "),flightId:h,conversationId:c.conversationId??null,targetAgentId:p,targetLabel:d}}function ds(s){window.open(s.url,"_blank","noopener,noreferrer")}function us(s,n={}){const{matchingWorktree:t,onBeginAssign:r,onSelectWorktreeId:a,onOpenDiff:i,onStatus:o}=n,c=[];return r&&c.push({kind:"action",label:"Assign for review…",onSelect:()=>r(s)}),c.push({kind:"action",label:"Open on GitHub",onSelect:()=>ds(s)}),t&&a&&c.push({kind:"action",label:`Select worktree · ${t.branch}`,onSelect:()=>a(t.id)}),t&&i&&c.push({kind:"action",label:"Open local diff",onSelect:()=>i(t.path)}),c.push({kind:"separator"},{kind:"action",label:"Copy link",onSelect:()=>{te(s.url).then(h=>{o?.(h?`Copied link for #${s.number}`:`Could not copy link for #${s.number}`)})}},{kind:"action",label:"Copy checkout command",onSelect:()=>{te(me(s)).then(h=>{o?.(h?`Copied: ${me(s)}`:`Could not copy checkout command for #${s.number}`)})}},{kind:"action",label:"Copy title",onSelect:()=>{te(`#${s.number} ${s.title}`).then(h=>{o?.(h?`Copied title for #${s.number}`:`Could not copy title for #${s.number}`)})}}),c}function hs(s){return s.startsWith("/Users/")?`~/${s.split("/").slice(3).join("/")}`:s}function ps(s){const n=s.handle?.trim()||s.name?.trim()||s.id,t=[s.harness?.trim(),s.model?.trim(),s.state?.trim(),s.harnessSessionId?.trim()?"session":null].filter(Boolean);return t.length>0?`@${n} · ${t.join(" · ")}`:`@${n}`}function Y(s){const n=s?.trim();return n?n.length>18?`${n.slice(0,10)}…${n.slice(-4)}`:n:null}function ms({pr:s,agents:n,projects:t,pending:r,error:a,onClose:i,onPendingChange:o,onError:c,onAssigned:h}){const p=He(),d=u.useMemo(()=>ge(s,t),[s,t]),[m,b]=u.useState(()=>d[0]?.path??s.path?.trim()??""),[S,A]=u.useState(""),P=u.useMemo(()=>as(s,n,m),[n,s,m]),f=P.find(l=>l.id===S)??null,x=!!f?.harnessSessionId?.trim(),[C,I]=u.useState(()=>ne(null)),[R,O]=u.useState(""),[j,y]=u.useState("medium"),[N,$]=u.useState("new");u.useEffect(()=>{const v=ge(s,t)[0]?.path??s.path?.trim()??"";b(v),A(""),I(ne(null)),O(""),y("medium"),$("new"),c(null)},[s.id]),u.useEffect(()=>{m&&d.some(l=>l.path===m)||b(d[0]?.path??s.path?.trim()??"")},[s.path,d,m]),u.useEffect(()=>{if(!f){$("new");return}I(ne(f)),O(is(f)),$(f.harnessSessionId?.trim()?"existing":"new")},[f?.id]),u.useEffect(()=>{S&&(P.some(l=>l.id===S)||A(""))},[S,P]),u.useEffect(()=>{N==="existing"&&f&&!x&&$("new")},[x,f,N]);const T=u.useMemo(()=>ls(P,f),[P,f]),D=!!m.trim()&&!r&&!(f&&N==="existing"&&!x),W=async()=>{if(D){o(!0),c(null);try{const l=await cs(s,{projectPath:m.trim(),harness:C,model:R,reasoningEffort:j,agent:f,sessionMode:f?N:"new"});h(l)}catch(l){c(l instanceof Error?l.message:String(l))}finally{o(!1)}}},F=r?"Assigning…":f?N==="existing"?"Continue session · review":"New session · review":"Start review",M=f?N==="existing"?`Continues @${f.handle?.trim()||f.name}'s current session${Y(f.harnessSessionId)?` (${Y(f.harnessSessionId)})`:""}.`:`Starts a fresh harness session for @${f.handle?.trim()||f.name}.`:"Starts a disposable one-time reviewer on the project with the runtime above.";return e.jsx("div",{className:"rw-pr-assign-backdrop",role:"presentation",onMouseDown:l=>{l.target===l.currentTarget&&!r&&i()},children:e.jsxs("div",{ref:p.ref,className:"rw-pr-assign-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"rw-pr-assign-title",tabIndex:-1,onKeyDown:l=>{p.onKeyDown(l),l.key==="Escape"&&!r&&(l.stopPropagation(),i())},children:[e.jsxs("div",{className:"rw-pr-assign-head",children:[e.jsxs("div",{children:[e.jsx("div",{className:"rw-pr-assign-eyebrow",children:"Assign for review"}),e.jsxs("h2",{id:"rw-pr-assign-title",className:"rw-pr-assign-title",children:["#",s.number," · launch review"]}),e.jsx("p",{className:"rw-pr-assign-copy",title:s.title,children:s.title}),e.jsxs("p",{className:"rw-pr-assign-meta",children:[s.repo," · ",s.headRefName||"head"," → ",s.baseRefName||"base"]})]}),e.jsx("button",{type:"button",className:"rw-pr-assign-close",onClick:i,disabled:r,children:"Cancel"})]}),e.jsxs("div",{className:"rw-pr-assign-body",children:[e.jsxs("div",{className:"rw-pr-assign-fields",children:[e.jsxs("label",{className:"rw-pr-assign-field",children:[e.jsx("span",{children:"Project"}),e.jsx("select",{value:m,disabled:r||d.length===0,onChange:l=>b(l.target.value),"aria-label":"Project path",children:d.length===0?e.jsx("option",{value:"",children:"No local project"}):d.map(l=>e.jsxs("option",{value:l.path,children:[l.label," · ",hs(l.path)]},l.path))})]}),e.jsxs("label",{className:"rw-pr-assign-field",children:[e.jsx("span",{children:"Harness"}),e.jsxs("select",{value:C,disabled:r,onChange:l=>I(l.target.value),"aria-label":"Harness",children:[pe.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value)),C&&!pe.some(l=>l.value===C)?e.jsx("option",{value:C,children:C}):null]})]}),e.jsxs("label",{className:"rw-pr-assign-field",children:[e.jsx("span",{children:"Model"}),e.jsx("input",{list:"rw-pr-assign-models",value:R,disabled:r,placeholder:"Default for harness",onChange:l=>O(l.target.value),"aria-label":"Model"}),e.jsx("datalist",{id:"rw-pr-assign-models",children:T.map(l=>e.jsx("option",{value:l},l))})]}),e.jsxs("label",{className:"rw-pr-assign-field",children:[e.jsx("span",{children:"Effort"}),e.jsx("select",{value:j,disabled:r,onChange:l=>y(l.target.value),"aria-label":"Reasoning effort",children:ss.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))})]}),e.jsxs("label",{className:"rw-pr-assign-field rw-pr-assign-field--wide",children:[e.jsxs("span",{children:["Agent ",e.jsx("em",{children:"(optional)"})]}),e.jsxs("select",{value:S,disabled:r,onChange:l=>A(l.target.value),"aria-label":"Existing agent (optional)",children:[e.jsx("option",{value:"",children:"New one-time reviewer on project"}),P.map(l=>e.jsx("option",{value:l.id,children:ps(l)},l.id))]})]}),f?e.jsxs("fieldset",{className:"rw-pr-assign-session",disabled:r,children:[e.jsx("legend",{children:"Session"}),e.jsx("div",{className:"rw-pr-assign-session-choices",role:"radiogroup","aria-label":"Session mode",children:ts.map(l=>{const v=l.value==="existing"&&!x,L=N===l.value;return e.jsxs("button",{type:"button",role:"radio","aria-checked":L,className:"rw-pr-assign-session-choice","data-active":L||void 0,disabled:v,title:v?"This agent has no live harness session to continue":l.hint,onClick:()=>$(l.value),children:[e.jsx("span",{className:"rw-pr-assign-session-title",children:l.label}),e.jsx("span",{className:"rw-pr-assign-session-sub",children:v?"No live session on this agent":l.value==="existing"&&Y(f.harnessSessionId)?Y(f.harnessSessionId):l.hint})]},l.value)})})]}):null]}),e.jsx("p",{className:"rw-pr-assign-hint",children:M}),a?e.jsx("div",{className:"rw-pr-assign-error",role:"alert",children:a}):null,e.jsx("div",{className:"rw-pr-assign-actions",children:e.jsx("button",{type:"button",className:"rw-pr-assign-submit",disabled:!D,onClick:()=>{W()},children:F})})]})]})})}const fs=/^Skipped missing repo-watch path:\s*(.+)$/i,gs=4;function js(s){const n=s.trim().replace(/\/+$/,"")||s.trim();if(!n)return"unknown paths";if(n==="~"||n.startsWith("~/"))return"~/*";if(!n.startsWith("/")){const[r]=n.split(/[\\/]/).filter(Boolean);return r?`${r}/*`:n}const t=n.split("/").filter(Boolean);return t[0]==="Users"&&t[1]?`/Users/${t[1]}/*`:t[0]==="Volumes"&&t[1]?`/Volumes/${t[1]}/*`:t.length>=2?`/${t[0]}/${t[1]}/*`:`/${t[0]??""}`}function xs(s,n){const t=[...new Set(s)];if(t.length===1)return{message:`Skipped missing repo-watch path: ${t[0]}`,examples:[],rawCount:1};const r=t.slice(0,gs),a=t.length-r.length;return a>0&&r.push(`+${a} more`),{message:`Skipped ${t.length} missing repo-watch paths under ${n}. These look like stale broker hints.`,examples:r,rawCount:t.length}}function je(s,n){if(s.length===0)return;const t=new Map;for(const r of s){const a=js(r),i=t.get(a);i?i.push(r):t.set(a,[r])}for(const[r,a]of t)n.push(xs(a,r));s.length=0}function bs(s){const n=[],t=[];for(const r of s){const a=fs.exec(r);if(a){t.push(a[1].trim());continue}je(t,n),n.push({message:r,examples:[],rawCount:1})}return je(t,n),n}const xe={attention:"desc",name:"asc",churn:"desc",files:"desc",drift:"desc",attached:"desc"},be="attention";function ws(s){return!s.status.clean||s.branch.ahead>0||s.branch.behind>0||s.agents.some(ie)||s.sessions.length>0||s.error!=null}function vs(s,n){const t=Ue(s),r=Ce(s),{add:a,del:i,total:o}=Ee(s),c=Pe(s);return{wt:s,project:n,state:Ae(s),add:a,del:i,churn:o,files:r.files+Math.max(t.files,s.status.changedFiles),live:c.filter(ie).length,agentsUnique:c}}function Te(s){return s.status.conflicts>0||s.error!=null}function Ns(s){const n=s.flatMap(i=>i.worktrees.filter(Te).map(o=>{const c=o.branch.name??o.name;return o.status.conflicts>0?`${i.name}/${c}: ${w(o.status.conflicts)} conflict${o.status.conflicts===1?"":"s"}`:`${i.name}/${c}: scan error`})),t="Worktrees blocked by conflicts or scan errors.";if(n.length===0)return t;const r=n.slice(0,8),a=n.length-r.length;return[t,...r,a>0?`+${a} more`:null].filter(i=>!!i).join(`
|
|
3
|
+
`)}function Ss({snapshot:s,selectedId:n,onSelect:t,onViewDiff:r,scanDepth:a,scanMorePending:i,onScanMore:o,openPullRequestCount:c,openPullRequestTitle:h}){const[p,d]=u.useState(be),[m,b]=u.useState(xe[be]),[S,A]=u.useState(!1),{liveRows:P,cleanRows:f,stats:x,blockedTitle:C}=u.useMemo(()=>{const j=[],y=[];let N=0,$=0,T=0;for(const F of s.projects)for(const M of F.worktrees){const l=vs(M,F);T+=l.files,l.live>0&&N++,Te(M)&&$++,(ws(M)?j:y).push(l)}const D=s.totals,W={repos:D.projects,worktrees:D.worktrees,dirtyWorktrees:D.dirtyWorktrees,changedFiles:T,live:N,blocked:$};return{liveRows:j,cleanRows:y,stats:W,blockedTitle:Ns(s.projects)}},[s.projects,s.totals]),I=u.useMemo(()=>{const j=Ms(P,p,m),y=new Map;for(const N of j){const $=y.get(N.project.id);$?$.push(N):y.set(N.project.id,[N])}return[...y.values()]},[P,p,m]);function R(j){j===p?b(y=>y==="asc"?"desc":"asc"):(d(j),b(xe[j]))}const O=P.length===0&&f.length===0;return e.jsxs("section",{className:"rw-table",children:[e.jsxs("div",{className:"rw-head",children:[e.jsxs("div",{className:"rw-head-top",children:[e.jsx("span",{className:"rw-eyebrow",children:"STATE OF REPOS"}),f.length>0?e.jsxs("button",{type:"button",className:"rw-clean",style:{marginLeft:"auto"},onClick:()=>A(j=>!j),"aria-pressed":S,children:[S?"hide":"show"," clean & idle (",f.length,")"]}):null]}),e.jsxs("div",{className:"stats",children:[e.jsx(U,{v:x.repos,k:"REPOS"}),x.worktrees>x.repos?e.jsx(U,{v:x.worktrees,k:"WORKTREES",title:`${w(x.worktrees)} worktrees across ${w(x.repos)} repos.`}):null,e.jsx(U,{v:x.changedFiles,k:"CHANGED",title:`${w(x.changedFiles)} changed files across ${w(x.dirtyWorktrees)} dirty worktree${x.dirtyWorktrees===1?"":"s"}.`}),x.live>0?e.jsx(U,{v:x.live,k:"WORKING",tone:"mint"}):null,(c??0)>0?e.jsx(U,{v:c??0,k:"OPEN PRS",tone:"amber",title:h??void 0}):null,x.blocked>0?e.jsx(U,{v:x.blocked,k:"BLOCKED",tone:"coral",title:C}):null]})]}),e.jsxs("div",{className:"tbl-wrap",children:[e.jsxs("div",{className:"tbl-head",children:[e.jsx(V,{label:"REPO / BRANCH · WORKTREE",k:"name",sortKey:p,dir:m,onSort:R}),e.jsx(V,{label:"CHURN",k:"churn",sortKey:p,dir:m,onSort:R,align:"r"}),e.jsx(V,{label:"FILES",k:"files",sortKey:p,dir:m,onSort:R,align:"c"}),e.jsx(V,{label:"DRIFT",k:"drift",sortKey:p,dir:m,onSort:R,align:"c"}),e.jsx(V,{label:"ATTACHED",k:"attached",sortKey:p,dir:m,onSort:R})]}),O?e.jsx("div",{className:"rw-empty",children:"No repositories discovered yet."}):I.map(j=>j.length>1?e.jsx(Rs,{group:j,selectedId:n,onSelect:t,onViewDiff:r},j[0].project.id):e.jsx(ae,{row:j[0],top:!0,selected:n===j[0].wt.id,onSelect:()=>t(j[0].wt.id),onViewDiff:r},j[0].wt.id)),S&&f.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"tbl-head",style:{position:"static"},children:e.jsxs("span",{children:["CLEAN & IDLE · ",f.length]})}),f.map(j=>e.jsx(ae,{row:j,top:!0,clean:!0,selected:n===j.wt.id,onSelect:()=>t(j.wt.id),onViewDiff:r},j.wt.id))]}):null,e.jsx(ks,{snapshot:s,scanDepth:a,scanMorePending:i,onScanMore:o})]})]})}function ks({snapshot:s,scanDepth:n,scanMorePending:t,onScanMore:r}){const a=ys(s),i=bs(s.warnings),o=i.reduce((c,h)=>c+h.rawCount,0);return e.jsxs("div",{className:"scan-coverage",children:[e.jsxs("div",{className:"scan-coverage-row",children:[e.jsx("b",{children:"SCAN"}),e.jsx("span",{className:"scan-main",children:a.summary}),a.canScanMore&&n==="standard"?e.jsx("button",{type:"button",onClick:r,disabled:t,children:t?"Scanning":"Scan more"}):e.jsx("span",{className:"scan-chip",children:n==="expanded"?"expanded":"standard"})]}),i.length>0?e.jsxs("details",{className:"scan-details",children:[e.jsxs("summary",{children:[w(i.length)," diagnostic group",i.length===1?"":"s",o!==i.length?` (${w(o)} raw)`:""]}),e.jsx("ul",{children:i.map((c,h)=>e.jsxs("li",{children:[e.jsx("span",{children:c.message}),c.examples.length>0?e.jsx("span",{className:"scan-detail-examples",children:c.examples.join(" · ")}):null]},`${h}:${c.message}`))})]}):null]})}function ys(s){let n=null,t=0,r=0,a=0,i=0,o=0,c=0;for(const p of s.warnings){const d=/limited discovery to (\d+) repositories/i.exec(p);if(d){n=`discovery capped at ${d[1]}`;continue}if(/limited .* to \d+ worktrees/i.test(p)){t++;continue}if(/skipped unreadable worktree/i.test(p)){r++;continue}if(/skipped missing repo-watch path/i.test(p)){a++;continue}if(/scan budget|stopped discovery|stopped scanning/i.test(p)){i++;continue}if(/could not resolve git common directory/i.test(p)){o++;continue}c++}const h=[`${w(s.totals.projects)} repo${s.totals.projects===1?"":"s"}`,`${w(s.totals.worktrees)} worktree${s.totals.worktrees===1?"":"s"}`];return n&&h.push(n),t&&h.push(`${w(t)} repo${t===1?"":"s"} at worktree cap`),r&&h.push(`${w(r)} unreadable worktree${r===1?"":"s"} skipped`),a&&h.push(`${w(a)} missing path${a===1?"":"s"}`),o&&h.push(`${w(o)} unresolved git dir${o===1?"":"s"}`),i&&h.push("scan budget reached"),c&&h.push(`${w(c)} other diagnostic${c===1?"":"s"}`),{summary:h.join(" · "),canScanMore:n!==null||t>0||i>0}}function Rs({group:s,selectedId:n,onSelect:t,onViewDiff:r}){const a=s[0].project,i=s.some(p=>p.state==="error"),o=s.reduce((p,d)=>p+d.add,0),c=s.reduce((p,d)=>p+d.del,0),h=s.reduce((p,d)=>p+(d.live?1:0),0);return e.jsxs("div",{children:[e.jsxs("div",{className:"repo-grp"+(i?" attn":""),children:[e.jsxs("div",{className:"rg-name",children:[e.jsx("span",{className:"rg-tw","aria-hidden":!0,children:e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",style:{transform:"rotate(90deg)"},children:e.jsx("path",{d:"M3 2l4 3.5L3 9",stroke:"currentColor",strokeWidth:"1.3",fill:"none"})})}),e.jsx("span",{className:"dot "+Is(s)}),e.jsx("span",{className:"rg-nm",children:a.name}),e.jsx("span",{className:"rg-path",children:Ie(a.root,3)}),e.jsxs("span",{className:"rg-badge",children:[a.worktrees.length," worktrees"]})]}),e.jsx("div",{className:"rg-agg",children:o||c?e.jsxs("span",{children:[e.jsxs("span",{style:{color:"var(--mint-dim)"},children:["+",w(o)]})," ",e.jsxs("span",{style:{color:"var(--coral-dim)"},children:["−",w(c)]})]}):"—"}),e.jsx("div",{}),e.jsx("div",{}),e.jsx("div",{className:"rg-agg",style:{textAlign:"left"},children:h?`${h} working`:""})]}),s.map((p,d)=>e.jsx(ae,{row:p,guide:!0,last:d===s.length-1,selected:n===p.wt.id,onSelect:()=>t(p.wt.id),onViewDiff:r},p.wt.id))]})}function ae({row:s,top:n,guide:t,last:r,clean:a,selected:i,onSelect:o,onViewDiff:c}){const{wt:h,project:p}=s,d=h.branch,m=Ce(h),b=!!c&&(s.files>0||m.has||h.branch.ahead>0);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:["wt",i?"sel":"",s.state==="error"?"attn":""].join(" "),style:n&&!a?{borderTop:"1px solid var(--line)"}:void 0,onClick:o,role:"button",tabIndex:0,onKeyDown:o?S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),o())}:void 0,children:[e.jsxs("div",{className:"wt-name",children:[t?e.jsx("span",{className:"tw-guide"+(r?" last":"")}):null,e.jsxs("div",{className:"inner",children:[e.jsx("span",{className:"dot "+s.state}),e.jsxs("span",{className:"br",children:[n&&!t?e.jsxs("span",{className:"lead",children:[p.name," "]}):null,e.jsx(Me,{branch:h.branch,fallback:h.name})]}),e.jsx(As,{wt:h})]})]}),e.jsx($s,{add:s.add,del:s.del}),e.jsx("div",{className:"files",children:s.files>0?e.jsxs("span",{children:[s.files,h.status.conflicts>0?e.jsxs("span",{className:"conf",children:[" ⚠",h.status.conflicts]}):null]}):e.jsx("span",{className:"dash",children:"—"})}),e.jsx(Cs,{ahead:d.ahead,behind:d.behind}),e.jsxs("div",{className:"agents-cell",children:[e.jsx(Ps,{row:s}),b?e.jsx("button",{type:"button",className:"wt-diff",title:`View diff · ${s.files} changed file${s.files===1?"":"s"}`,"aria-label":"View diff",onClick:S=>{S.stopPropagation(),c?.(h.path)},children:"diff"}):null]})]})})}function U({v:s,k:n,tone:t,title:r}){return e.jsxs("div",{className:"stat",title:r,"aria-label":r?`${w(s)} ${n}. ${r}`:void 0,children:[e.jsx("span",{className:"v"+(t?" "+t:""),children:w(s)}),e.jsx("span",{className:"k",children:n})]})}function V({label:s,k:n,sortKey:t,dir:r,onSort:a,align:i}){const o=t===n;return e.jsx("div",{className:i==="r"?"r":i==="c"?"c":"",children:e.jsxs("button",{type:"button",className:o?"on":"",onClick:()=>a(n),children:[e.jsx("span",{children:s}),e.jsx("span",{className:"caret","aria-hidden":!0,children:r==="asc"?"▲":"▼"})]})})}function $s({add:s,del:n}){if(!s&&!n)return e.jsx("div",{className:"churn",children:e.jsx("span",{className:"dash",children:"—"})});const t=s+n||1;return e.jsxs("div",{className:"churn",children:[e.jsxs("span",{className:"nums",children:[e.jsxs("span",{className:"add",children:["+",w(s)]}),e.jsx("span",{className:"sl",children:"/"}),e.jsxs("span",{className:"del",children:["−",w(n)]})]}),e.jsxs("span",{className:"cbar",title:`+${w(s)} −${w(n)}`,children:[e.jsx("span",{className:"g",style:{width:s/t*100+"%"}}),e.jsx("span",{className:"r",style:{width:n/t*100+"%"}})]})]})}function Cs({ahead:s,behind:n}){return!s&&!n?e.jsx("div",{className:"drift",children:e.jsx("span",{className:"dash",children:"—"})}):e.jsxs("div",{className:"drift",children:[s?e.jsxs("span",{className:"dp ahead",children:["↑",s]}):null,n?e.jsxs("span",{className:"dp behind",children:["↓",n]}):null]})}const Es=2;function Ps({row:s}){const n=s.agentsUnique,t=s.wt.sessions,r=[...n.map(o=>`${X(o)} (${o.state??"—"})`),...t.map(o=>`session ${Ve(o)}`)].join(`
|
|
4
|
+
`);if(n.length===0)return e.jsx("div",{className:"agents",title:r,children:t.length>0?e.jsxs("span",{className:"ahandle",children:[t.length," session",t.length===1?"":"s"]}):e.jsx("span",{className:"dash",children:"—"})});const a=n.slice(0,Es),i=n.length-a.length;return e.jsxs("div",{className:"agents",title:r,children:[s.live>0?e.jsxs("span",{className:"alive",children:[e.jsx("span",{className:"d"}),s.live]}):null,e.jsx("span",{className:"ahandle",children:a.map(o=>X(o)).join(" ")}),i>0?e.jsxs("span",{className:"amore",children:["+",i]}):null]})}function As({wt:s}){const n=[];return s.branch.detached?n.push({label:"DETACHED",cls:""}):s.branch.upstream||n.push({label:"LOCAL",cls:""}),s.error!=null&&n.push({label:"SCAN ERR",cls:"err"}),s.isBare&&n.push({label:"BARE",cls:""}),e.jsx(e.Fragment,{children:n.map(t=>e.jsx("span",{className:"tag "+t.cls,children:t.label},t.label))})}const we={error:3,live:2,dirty:1,clean:0};function Is(s){return s.reduce((n,t)=>we[t.state]>we[n]?t.state:n,"clean")}function Ms(s,n,t){const r=t==="asc"?1:-1,a=d=>{switch(n){case"attention":return-G(d.wt.attention);case"churn":return d.churn;case"files":return d.files;case"drift":return d.wt.branch.ahead+d.wt.branch.behind;case"attached":return d.live*1e6+d.agentsUnique.length*1e3+d.wt.sessions.length;default:return 0}},i=new Map;for(const d of s){const m=i.get(d.project.id);m?m.push(d):i.set(d.project.id,[d])}const o=(d,m)=>{if(n==="name")return Ke(d,m,r);const b=(a(d)-a(m))*r;if(b!==0)return b;const S=G(d.wt.attention)-G(m.wt.attention);return S!==0?S:d.wt.path.localeCompare(m.wt.path)},c=d=>d.reduce((m,b)=>Math.max(m,a(b)),-1/0),h=[...i.values()].sort((d,m)=>{if(n==="name")return d[0].project.name.localeCompare(m[0].project.name)*r;const b=(c(d)-c(m))*r;return b!==0?b:d[0].project.name.localeCompare(m[0].project.name)}),p=[];for(const d of h)p.push(...[...d].sort(o));return p}const J=8;function ve(s){if(s.error!=null)return 0;const{ahead:n,behind:t}=s.branch;return n>0&&t>0?1:t>0||n>0?2:3}function Ts(s){const n=(s.name??"").trim();if(n){const a=n.split(/[\s_\-/]+/).filter(Boolean);if(a.length>=2)return(a[0][0]+a[1][0]).toUpperCase();if(a.length===1)return a[0].slice(0,2).toUpperCase()}return(X(s).replace(/^@/,"").replace(/[^a-z0-9]/gi,"").slice(0,2)||"··").toUpperCase()}function Ds({snapshot:s,selectedId:n,onSelect:t}){return e.jsxs("section",{className:"bd",children:[e.jsx("div",{className:"bd-head",children:"BRANCH DRIFT — distance from each worktree's base · behind ← origin → ahead · flags call out what needs a rebase"}),e.jsxs("div",{className:"bd-axis",children:[e.jsx("div",{}),e.jsxs("div",{className:"bd-axis-track",children:[e.jsx("span",{className:"bd-axis-lbl",style:{left:"0%"},children:"−8"}),e.jsx("span",{className:"bd-axis-lbl",style:{left:"25%"},children:"−4"}),e.jsx("span",{className:"bd-axis-lbl bd-origin-lbl",style:{left:"50%"},children:"origin"}),e.jsx("span",{className:"bd-axis-lbl",style:{left:"75%"},children:"+4"}),e.jsx("span",{className:"bd-axis-lbl",style:{left:"100%"},children:"+8"}),e.jsx("span",{className:"bd-axis-cap",children:"COMMITS ←"})]}),e.jsx("div",{}),e.jsx("div",{}),e.jsx("div",{})]}),s.projects.map(r=>e.jsx(Ls,{project:r,selectedId:n,onSelect:t},r.id))]})}function Ls({project:s,selectedId:n,onSelect:t}){const r=[...s.worktrees].sort((a,i)=>ve(a)-ve(i));return e.jsxs("div",{className:"bd-grp",children:[e.jsxs("div",{className:"bd-grp-h",children:[e.jsx("span",{className:"bd-grp-nm",children:s.name}),e.jsx("span",{className:"bd-grp-path",children:Ie(s.root,3)})]}),r.map(a=>e.jsx(Os,{wt:a,selected:n===a.id,onSelect:()=>t(a.id)},a.id))]})}function Os({wt:s,selected:n,onSelect:t}){const r=Ae(s),{ahead:a,behind:i}=s.branch,o=s.error!=null,c=Pe(s);return e.jsxs("div",{className:["bd-row",n?"sel":""].join(" "),role:"button",tabIndex:0,onClick:t,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),t())},children:[e.jsxs("div",{className:"bd-id",children:[e.jsx("span",{className:"dot "+r}),e.jsx("span",{className:"bd-br",children:e.jsx(Me,{branch:s.branch,fallback:s.name})})]}),e.jsx(Fs,{ahead:a,behind:i,hasError:o}),e.jsx(Ws,{wt:s,hasError:o}),e.jsx(_s,{agents:c}),e.jsx(Bs,{ahead:a,behind:i,hasError:o})]})}function Fs({ahead:s,behind:n,hasError:t}){const r=s===0&&n===0;return e.jsxs("div",{className:"bd-track",children:[e.jsx("span",{className:"bd-tick",style:{left:"0%"}}),e.jsx("span",{className:"bd-tick",style:{left:"25%"}}),e.jsx("span",{className:"bd-tick bd-tick-origin",style:{left:"50%"}}),e.jsx("span",{className:"bd-tick",style:{left:"75%"}}),e.jsx("span",{className:"bd-tick",style:{left:"100%"}}),t||r?e.jsx("span",{className:"bd-origin-ring"}):e.jsxs(e.Fragment,{children:[n>0?e.jsxs("span",{className:"bd-bar bd-behind",style:{right:"50%",width:Math.min(n,J)/J*50+"%"},children:[e.jsx("span",{className:"bd-cap bd-cap-l"}),e.jsxs("span",{className:"bd-lbl bd-lbl-l",children:["↓",n]})]}):null,s>0?e.jsxs("span",{className:"bd-bar bd-ahead",style:{left:"50%",width:Math.min(s,J)/J*50+"%"},children:[e.jsx("span",{className:"bd-cap bd-cap-r"}),e.jsxs("span",{className:"bd-lbl bd-lbl-r",children:["↑",s]})]}):null]})]})}function Ws({wt:s,hasError:n}){const{add:t,del:r,has:a}=Ee(s);if(n||!a)return e.jsx("div",{className:"bd-churn",children:e.jsx("span",{className:"dash",children:"—"})});const i=t+r||1;return e.jsxs("div",{className:"bd-churn",children:[e.jsxs("span",{className:"bd-churn-nums",children:[e.jsxs("span",{className:"add",children:["+",w(t)]}),e.jsx("span",{className:"sl",children:"/"}),e.jsxs("span",{className:"del",children:["−",w(r)]})]}),e.jsxs("span",{className:"bd-cbar",title:`+${w(t)} −${w(r)}`,children:[e.jsx("span",{className:"g",style:{width:t/i*100+"%"}}),e.jsx("span",{className:"r",style:{width:r/i*100+"%"}})]})]})}const qs=2;function _s({agents:s}){if(s.length===0)return e.jsx("div",{className:"bd-agents",children:e.jsx("span",{className:"dash",children:"—"})});const n=s.slice(0,qs),t=s.length-n.length;return e.jsxs("div",{className:"bd-agents",title:s.map(r=>`${X(r)} (${r.state??"—"})`).join(`
|
|
5
|
+
`),children:[n.map(r=>e.jsx("span",{className:"bd-av"+(ie(r)?" live":""),children:Ts(r)},X(r))),t>0?e.jsxs("span",{className:"bd-av-more",children:["+",t]}):null]})}function Bs({ahead:s,behind:n,hasError:t}){return t?e.jsx("div",{className:"bd-flag err",children:"SCAN ERR"}):s>0&&n>0?e.jsx("div",{className:"bd-flag rebase",children:"DIVERGED ▸"}):n>0?e.jsx("div",{className:"bd-flag rebase",children:"REBASE ▸"}):s>0?e.jsxs("div",{className:"bd-flag ahead",children:["AHEAD ",s]}):e.jsx("div",{className:"bd-flag sync",children:"IN SYNC"})}const Hs=1e4,Us=15e3,Ks=45e3,Vs=45e3,zs="openscout.repos.tone",Ne=["warm","cool","mono"],Gs="openscout.repos.view",Se=["table","drift"],Xs=12;function Ys(s){return s.warnings.some(n=>/scan budget|stopped discovery|stopped scanning/i.test(n))}function Js(s,n){return s.totals.worktrees<n.totals.worktrees||s.totals.projects<n.totals.projects}function Qs(s){return s&&typeof s=="object"&&"name"in s&&s.name==="AbortError"?"Repo Watch scan timed out; keeping the last available snapshot.":s instanceof Error?s.message:String(s)}function ke(s,n,t){const[r,a]=u.useState(()=>{if(typeof window>"u")return t;try{const o=window.localStorage.getItem(s);return o&&n.includes(o)?o:t}catch{return t}}),i=u.useCallback(o=>{a(o);try{window.localStorage.setItem(s,o)}catch{}},[s]);return[r,i]}function ye(s){let n=null,t=-1/0;for(const r of s)for(const a of r.worktrees){const i=a.agents.filter(c=>(c.state??"").toLowerCase()==="active").length,o=(4-G(a.attention))*1e6+i*1e4+a.status.changedFiles;o>t&&(t=o,n=a)}return n}function Zs(s,n){if(!s||!n)return{worktree:null,project:null};for(const t of s.projects)for(const r of t.worktrees)if(r.id===n)return{worktree:r,project:t};return{worktree:null,project:null}}function re(s){if(!s)return 0;const n=/(\d+)\s+files?\s+changed/.exec(s);return n?Number(n[1]):0}function et(s){const n=new Set,t=[];for(const r of s.projects){const a=r.worktrees[0]?.path??r.root;!a||n.has(a)||(n.add(a),t.push(a))}return t}function st(s,n){if(!s)return"updated";const t=Date.parse(s);return Number.isFinite(t)?ze(t,n):"updated"}function tt(s){const n=s?.pullRequests??[];if(n.length===0)return null;const t=n.slice(0,8).map(a=>`${a.repo}#${a.number}: ${a.title}`),r=n.length-t.length;return["Open pull requests from gh.",...t,r>0?`+${r} more`:null].filter(a=>!!a).join(`
|
|
6
|
+
`)}function Re(s,n){return n?s.path===n.root||n.worktrees.some(r=>r.path===s.path)?!0:s.repo.split("/").pop()?.toLowerCase()===n.name.toLowerCase():!1}function $e(s,n){const t=n?.branch.name?.trim();return!!(t&&s.headRefName===t)}function nt(s,n){if(!n)return null;const t=s.headRefName?.trim();if(!t)return null;const r=[];for(const a of n.projects)for(const i of a.worktrees)i.branch.name?.trim()===t&&r.push({id:i.id,path:i.path,branch:t});if(r.length===0)return null;if(s.path){const a=r.find(i=>i.path===s.path);if(a)return a}return r[0]??null}function rt(s,n){const t=[];for(const r of s.projects)for(const a of r.worktrees){const i=a.status.staged+a.status.unstaged+a.status.untracked+a.status.conflicts,o=a.agents.filter(m=>(m.state??"").toLowerCase()==="active").length,c=re(a.diff.branchShortstat),h=Math.max(a.status.changedFiles,re(a.diff.stagedShortstat)+re(a.diff.unstagedShortstat)),p=a.branch.ahead+a.branch.behind,d=o+a.sessions.length;i===0&&d===0&&c===0&&p===0||t.push({path:a.path,score:(a.id===n?1e7:0)+(4-G(a.attention))*1e5+o*1e4+a.sessions.length*5e3+p*1e3+c*250+i*100+h})}return t.sort((r,a)=>a.score-r.score).map(r=>r.path)}function z({children:s}){return e.jsx("div",{className:"s-ops",children:e.jsx("div",{className:"s-ops-body",style:{overflowY:"auto"},children:s})})}function at({error:s}){return e.jsxs("div",{className:"rw-empty-next",children:[e.jsx("p",{className:"rw-empty-copy",children:"Repos is waiting on the local Scout Services layer. Restart the broker from the menu bar app, then rescan."}),e.jsxs("ol",{className:"rw-empty-steps",children:[e.jsxs("li",{children:["Click ",e.jsx("span",{className:"rw-empty-action-name",children:"Restart broker"})," to hand off to the menu bar app."]}),e.jsx("li",{children:"Wait for Scout Services to report the broker online."}),e.jsxs("li",{children:["If nothing opens, run ",e.jsx("code",{children:"scout doctor"})," and follow the repair command it prints."]})]}),s?e.jsx("p",{className:"rw-empty-error",children:s}):null]})}function it({snapshot:s,loading:n,error:t,selectedProject:r,selectedWorktree:a,repoSnapshot:i,onSelectWorktree:o,onOpenDiff:c,navigate:h}){const{agents:p}=We(),d=qe(),[m,b]=u.useState(null),[S,A]=u.useState(null),[P,f]=u.useState(!1),[x,C]=u.useState(null),I=u.useRef(null),R=u.useCallback(l=>{b(l),I.current!=null&&window.clearTimeout(I.current),l&&(I.current=window.setTimeout(()=>b(null),6e3))},[]);u.useEffect(()=>()=>{I.current!=null&&window.clearTimeout(I.current)},[]);const O=u.useCallback(()=>{P||(A(null),C(null))},[P]),j=u.useMemo(()=>(i?.projects??[]).map(l=>({root:l.root,name:l.name})),[i]),y=s?.pullRequests??[],N=a?.branch.name??null,$=y.filter(l=>Re(l,r)),T=$.filter(l=>$e(l,a)),D=$.filter(l=>!$e(l,a)),W=y.filter(l=>!Re(l,r)),F=[T.length>0?{key:"branch",label:N?`Selected branch · ${N}`:"Selected branch",items:T}:null,D.length>0?{key:"project",label:r?`${r.name} PRs`:"Selected project",items:D}:null,W.length>0?{key:"other",label:$.length>0?"Other open PRs":"Open PRs",items:W}:null].filter(l=>!!l);if(!n&&!t&&y.length===0)return null;const M=(l,v)=>{l.preventDefault(),d(l,us(v,{matchingWorktree:nt(v,i),onBeginAssign:L=>{C(null),A(L)},onSelectWorktreeId:o,onOpenDiff:c,onStatus:R}))};return e.jsxs("section",{className:"rw-open-prs","aria-label":"Open pull requests",children:[e.jsxs("div",{className:"rw-open-prs-head",children:[e.jsxs("div",{children:[e.jsx("div",{className:"rw-open-prs-eyebrow",children:"Open PRs"}),e.jsx("div",{className:"rw-open-prs-title",children:n&&y.length===0?"Checking GitHub":`${y.length} open`}),m?e.jsx("div",{className:"rw-open-prs-status",role:"status",children:m}):null]}),s?e.jsx("span",{className:"rw-open-prs-meta",children:"gh"}):null]}),y.length>0?e.jsx("div",{className:"rw-open-prs-list",children:F.map(l=>e.jsxs("div",{className:"rw-open-pr-group",children:[F.length>1?e.jsx("div",{className:"rw-open-pr-group-label",children:l.label}):null,l.items.map(v=>e.jsxs("button",{type:"button",className:"rw-open-pr",title:`${v.title} — click for actions`,onClick:L=>M(L,v),onContextMenu:L=>M(L,v),children:[e.jsxs("span",{className:"rw-open-pr-main",children:[e.jsxs("span",{className:"rw-open-pr-number",children:["#",v.number]}),e.jsx("span",{className:"rw-open-pr-title",title:v.title,children:v.title})]}),e.jsxs("span",{className:"rw-open-pr-detail",children:[e.jsx("span",{children:v.repo}),e.jsxs("span",{children:[v.headRefName||"head"," → ",v.baseRefName||"base"]}),v.isDraft?e.jsx("span",{children:"draft"}):e.jsx("span",{children:"open"}),v.author?e.jsxs("span",{children:["@",v.author]}):null,e.jsx("span",{children:st(v.updatedAt,s?.generatedAt??Date.now())})]})]},v.id))]},l.key))}):e.jsx("div",{className:"rw-open-prs-empty",children:t??"No open pull requests returned."}),S?e.jsx(ms,{pr:S,agents:p,projects:j,pending:P,error:x,onClose:O,onPendingChange:f,onError:C,onAssigned:l=>{A(null),C(null),R(l.message),(l.flightId||l.conversationId||l.targetAgentId)&&h({view:"follow",...l.flightId?{flightId:l.flightId}:{},...l.conversationId?{conversationId:l.conversationId}:{},...l.targetAgentId?{targetAgentId:l.targetAgentId}:{}})}}):null]})}function sn({navigate:s,focusRoot:n=null}){const[t,r]=u.useState(null),[a,i]=u.useState("loading"),[o,c]=u.useState(null),h=u.useRef(!1),p=u.useRef(0),d=u.useRef(null),m=u.useRef(!1),[b,S]=ke(zs,Ne,"warm"),[A,P]=ke(Gs,Se,"table"),[f,x]=u.useState(null),[C,I]=u.useState("standard"),[R,O]=u.useState(!1),[j,y]=u.useState(null),[N,$]=u.useState(!1),[T,D]=u.useState(!1),[W,F]=u.useState(null),[M,l]=u.useState(null),[v,L]=u.useState(!1),[De,Z]=u.useState(null),[B,K]=u.useState(null),q=u.useCallback(async(g={})=>{if(m.current&&!g.force)return;m.current=!0;const k=g.depth??C;g.scanMore&&$(!0),g.force&&!g.scanMore&&O(!0);try{let E=await he(k,g.force??!1,k==="expanded"?Ks:Us),_=k;if(!h.current&&k==="standard"&&!g.force&&E.projects.length===0)try{const ue=await he("expanded",!0,Vs);ue.projects.length>0&&(E=ue,_="expanded")}catch{}const de=d.current;if(de&&Ys(E)&&(E.projects.length===0||Js(E,de))){c("Scan budget was reached; keeping the last fuller Repo Watch snapshot."),i("ready");return}if(!g.force&&E.projects.length===0&&h.current&&p.current<3){p.current+=1,i("ready");return}p.current=0,h.current=!0,d.current=E,r(E),c(null),i("ready"),(g.scanMore||_!==k)&&I(_),g.force&&!g.scanMore&&y(`Fresh ${new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}`)}catch(E){const _=Qs(E);c(_),h.current||i("error")}finally{g.scanMore&&$(!1),g.force&&!g.scanMore&&O(!1),m.current=!1}},[C]);u.useEffect(()=>{d.current=t},[t]),u.useEffect(()=>{q();const g=setInterval(()=>{q()},Hs);return()=>clearInterval(g)},[q]);const le=u.useRef(null);u.useEffect(()=>{if(!t)return;if(n&&le.current!==n){const k=t.projects.find(E=>E.root===n||E.worktrees.some(_=>_.path===n));if(!k)return;if(le.current=n,!k.worktrees.some(E=>E.id===f)){x(ye([k])?.id??null);return}}t.projects.some(k=>k.worktrees.some(E=>E.id===f))||x(ye(t.projects)?.id??null)},[t,f,n]),u.useEffect(()=>{!t||t.projects.length===0||Qe(rt(t,f),void 0,{limit:Xs})},[t,f]);const ee=u.useMemo(()=>t?et(t):[],[t]),Le=ee.join("\0");u.useEffect(()=>{if(ee.length===0){l(null),Z(null),L(!1);return}let g=!1;return L(!0),Z(null),_e(ee).then(k=>{g||l(k)}).catch(k=>{g||Z(k instanceof Error?k.message:String(k))}).finally(()=>{g||L(!1)}),()=>{g=!0}},[Le]);const H=u.useMemo(()=>Zs(t,f),[t,f]),Oe=u.useMemo(()=>tt(M),[M]);u.useEffect(()=>{Ge({worktree:H.worktree,project:H.project,generatedAt:t?.generatedAt??0,tone:b})},[H.worktree,H.project,t?.generatedAt,b]),u.useEffect(()=>Xe,[]);const oe=u.useCallback(()=>{q({depth:"expanded",force:!0,scanMore:!0})},[q]),ce=u.useCallback(()=>{q({force:!0})},[q]),Fe=u.useCallback(async()=>{if(!T){D(!0),F(null);try{const g=await fetch("/api/scout-services/restart-link",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({target:"broker"})});if(!g.ok)throw new Error(`Scout Services link failed (${g.status})`);const k=await g.json();if(!k.url?.startsWith("scout://services/restart/"))throw new Error("Scout Services link was not returned.");window.location.assign(k.url)}catch(g){const k=g instanceof Error?g.message:String(g);F(`${k} Run scout doctor if the menu app did not open.`)}finally{D(!1)}}},[T]);return a==="loading"?e.jsx(z,{navigate:s,children:e.jsx("div",{className:"repo-watch-scope",style:{padding:"24px"},children:e.jsx(se,{title:"Scanning repositories…",body:"Reading worktree state from the broker."})})}):a==="error"&&!t?e.jsx(z,{navigate:s,children:e.jsx("div",{className:"repo-watch-scope",style:{padding:"24px"},children:e.jsx(se,{className:"sys-state-card-error",title:"Couldn’t load Repo Watch",body:o??"The broker did not return a snapshot.",action:e.jsx("button",{type:"button",className:"s-btn",onClick:()=>{i("loading"),q()},children:"Retry"})})})}):t&&t.projects.length===0?e.jsx(z,{navigate:s,children:e.jsx("div",{className:"repo-watch-scope",style:{padding:"24px"},children:e.jsx(se,{title:"Scout Services need attention",body:e.jsx(at,{error:W}),action:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"s-btn s-btn-primary",onClick:()=>{Fe()},disabled:T,children:T?"Opening…":"Restart broker"}),e.jsx("button",{type:"button",className:"s-btn",onClick:ce,disabled:R||N,children:R?"Scanning…":"Scan again"}),e.jsx("button",{type:"button",className:"s-btn",onClick:oe,disabled:R||N,children:N?"Scanning…":"Scan more"})]})})})}):t?e.jsx(z,{navigate:s,children:e.jsxs("div",{className:"repo-watch-scope",children:[e.jsx("div",{className:"rw-scope tone-"+b,children:e.jsxs("div",{className:"rw-page-shell",children:[e.jsxs("div",{className:"rw-toolbar",children:[e.jsxs("button",{type:"button",className:"rw-refresh-main",onClick:ce,disabled:R||N,children:[e.jsx(Ze,{size:14,"aria-hidden":"true",className:R?"rw-refresh-spin":void 0}),e.jsx("span",{children:R?"Scanning":"Refresh"})]}),j?e.jsx("span",{className:"rw-refresh-receipt",children:j}):null,e.jsxs("details",{className:"rw-display-menu",children:[e.jsxs("summary",{"aria-label":"Display options",children:[e.jsx(es,{size:14,"aria-hidden":"true"}),e.jsx("span",{children:"Display"})]}),e.jsxs("div",{className:"rw-display-panel",children:[e.jsxs("div",{className:"rw-display-row",children:[e.jsx("span",{className:"rw-display-label",children:"View"}),e.jsx("div",{className:"rw-tone",role:"group","aria-label":"View",children:Se.map(g=>e.jsx("button",{type:"button",className:g===A?"on":"","aria-pressed":g===A,onClick:()=>P(g),children:g},g))})]}),e.jsxs("div",{className:"rw-display-row",children:[e.jsx("span",{className:"rw-display-label",children:"Tone"}),e.jsx("div",{className:"rw-tone",role:"group","aria-label":"Console tone",children:Ne.map(g=>e.jsx("button",{type:"button",className:g===b?"on":"","aria-pressed":g===b,onClick:()=>S(g),children:g},g))})]})]})]})]}),e.jsx("div",{className:"min-w-0",children:A==="drift"?e.jsx(Ds,{snapshot:t,selectedId:f,onSelect:x}):e.jsxs(e.Fragment,{children:[e.jsx(Ss,{snapshot:t,selectedId:f,onSelect:x,onViewDiff:K,scanDepth:C,scanMorePending:N,onScanMore:oe,openPullRequestCount:M?.pullRequests.length??null,openPullRequestTitle:Oe}),e.jsx(it,{snapshot:M,loading:v,error:De,selectedProject:H.project,selectedWorktree:H.worktree,repoSnapshot:t,onSelectWorktree:x,onOpenDiff:K,navigate:s})]})})]})}),e.jsx(Ye,{open:B!=null,onClose:()=>K(null),side:"right",owner:"openscout.repos-diff-viewer",resizable:!0,defaultSize:840,maxSize:1280,minSize:420,ariaLabel:"Worktree diff",children:B!=null?e.jsx(Je,{path:B,onClose:()=>K(null),onOpenAsPage:()=>{B&&(s({view:"repo-diff",path:B}),K(null))}},B):null})]})}):e.jsx(z,{navigate:s})}export{sn as ReposScreen,sn as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as d,j as t}from"./index-Bli6bTLU.js";import{a as Xt,f as fs,g as xs,b as gs,p as vs,c as ks,i as bs}from"./scout-voice-DvG_3stJ.js";import"./fx-z37u1o2z.js";const Ae=1,rt="scout:surface-push";class js{constructor(n,s,a=Ss()){this.surface=n,this.currentScope=s,this.handler=a}surface;currentScope;handler;bootstrap(){return this.request("bootstrap",{})}agents={list:n=>this.request("agents.list",{},n),observe:(n,s)=>this.request("agents.observe",{agentIds:s},n)};tail={recent:(n,s)=>this.request("tail.recent",{...s?{cursor:s}:{}},n),subscribe:(n,s)=>{const a=Qt("tail.delta",s);return this.request("tail.subscribe",{},n).catch(()=>a()),a}};codex={startSession:n=>this.request("codex.session.start",{route:n}),snapshot:n=>this.request("codex.thread.snapshot",{route:n}),connect:n=>this.request("codex.thread.connect",{route:n}),start:(n,s)=>this.request("codex.turn.start",{route:n,text:s}),steer:(n,s)=>this.request("codex.turn.steer",{route:n,text:s}),interrupt:n=>this.request("codex.turn.interrupt",{route:n})};dispatch={diagnostics:(n,s)=>this.request("dispatch.diagnostics",{...s?{cursor:s}:{}},n),ask:n=>this.request("dispatch.ask",n),review:n=>this.request("dispatch.review",n),subscribe:(n,s)=>{const a=Qt("dispatch.delta",s);return this.request("dispatch.subscribe",{},n).catch(()=>a()),a}};native={setLaneSelection:async n=>{await this.request("native.setLaneSelection",{selection:n})},openExternalURL:async n=>{await this.request("native.openExternalURL",{url:n})},getPreferences:n=>this.request("native.getPreferences",{keys:n}),setPreferences:async n=>{await this.request("native.setPreferences",n)},cancel:async n=>{await this.request("native.cancel",{requestId:n})},voice:{snapshot:()=>this.request("native.voice.snapshot",{}),toggleInput:()=>this.request("native.voice.toggleInput",{}),speak:n=>this.request("native.voice.speak",{text:n}),stopOutput:()=>this.request("native.voice.stopOutput",{})}};selectedScope(){return this.currentScope()}async request(n,s,a){const r=ys(),l={v:Ae,id:r,surface:this.surface,method:n,params:s,...a?{hostIds:a.hostIds}:{}},u=await this.handler.postMessage(l);if(u.v!==Ae||u.id!==r||u.method!==n)throw new Error("Scout native surface returned a mismatched reply");if("error"in u)throw new Error(`${u.error.code}: ${u.error.message}`);return u.result}}function Ss(){const e=window.webkit?.messageHandlers?.scoutSurface;if(!e)throw new Error("Scout native surface bridge is unavailable");return e}function ys(){return globalThis.crypto?.randomUUID?.()??`surface-${Date.now()}-${Math.random().toString(16).slice(2)}`}function Qt(e,n){const s=a=>{const r=a.detail;r?.stream!==e||!("payload"in r)||n({hostId:r.hostId,cursor:{epoch:r.epoch,sequence:r.sequence,connectionRevision:r.connectionRevision},...e==="tail.delta"?{events:r.payload.events}:{records:r.payload.records}})};return window.addEventListener(rt,s),()=>window.removeEventListener(rt,s)}function _s(){window.__scoutSurface={onPush(e){window.dispatchEvent(new CustomEvent(rt,{detail:e}))}}}const ms="/api/surfaces/deck",ln="scout.surface.preferences.v1";function ws(e,n){return window.webkit?.messageHandlers?.scoutSurface?new js(e,n):new Ns(e,n)}class Ns{constructor(n,s,a=ms){this.surface=n,this.currentScope=s,this.endpoint=a}surface;currentScope;endpoint;pending=new Map;voice=new Is;async bootstrap(){const n=await this.request("bootstrap",{});if(!this.voice.inputAvailable)return n;const s=new Set(n.capabilities);return s.add("native.voice.snapshot"),s.add("native.voice.toggleInput"),this.voice.outputAvailable&&(s.add("native.voice.speak"),s.add("native.voice.stopOutput")),{...n,capabilities:[...s],device:{platform:"web",formFactor:Cs()}}}agents={list:n=>this.request("agents.list",{},n),observe:(n,s)=>this.request("agents.observe",{agentIds:s},n)};tail={recent:(n,s)=>this.request("tail.recent",{...s?{cursor:s}:{}},n),subscribe:(n,s)=>{let a=new Set;const r=async()=>{try{const u=await this.tail.recent(n);for(const p of u.hosts){if(!p.ready)continue;const k=p.value.events.filter(y=>!a.has(y.id));a=new Set(p.value.events.map(y=>y.id)),k.length>0&&s({hostId:p.hostId,cursor:p.value.cursor,events:k})}}catch{}};r();const l=window.setInterval(()=>{r()},2e3);return()=>{window.clearInterval(l)}}};codex={startSession:n=>this.request("codex.session.start",{route:n}),snapshot:n=>this.request("codex.thread.snapshot",{route:n}),connect:n=>this.request("codex.thread.connect",{route:n}),start:(n,s)=>this.request("codex.turn.start",{route:n,text:s}),steer:(n,s)=>this.request("codex.turn.steer",{route:n,text:s}),interrupt:n=>this.request("codex.turn.interrupt",{route:n})};dispatch={diagnostics:()=>Promise.reject(new Error("Dispatch is unavailable on the Deck surface.")),ask:n=>Promise.reject(new Error("Dispatch is unavailable on the Deck surface.")),review:n=>Promise.reject(new Error("Dispatch is unavailable on the Deck surface.")),subscribe:(n,s)=>()=>{}};native={setLaneSelection:async n=>{await this.request("native.setLaneSelection",{selection:n})},openExternalURL:async n=>{const s=new URL(n);if(s.protocol!=="https:")throw new Error("Only https URLs can be opened from the Deck.");window.open(s,"_blank","noopener,noreferrer")},getPreferences:async n=>({entries:Zt().filter(a=>n.includes(a.key))}),setPreferences:async n=>{const s=new Map(Zt().map(a=>[a.key,a]));for(const a of n.entries)s.set(a.key,a);localStorage.setItem(ln,JSON.stringify([...s.values()]))},cancel:async n=>{this.pending.get(n)?.abort(),this.pending.delete(n)},voice:{snapshot:()=>Promise.resolve(this.voice.snapshot()),toggleInput:()=>this.voice.toggleInput(),speak:n=>this.voice.speak(n),stopOutput:()=>this.voice.stopOutput()}};selectedScope(){return this.currentScope()}async request(n,s,a){if(this.surface!=="deck")throw new Error("The web surface transport currently supports Scout Deck only.");const r=Ts(),l=new AbortController;this.pending.set(r,l);const u={v:Ae,id:r,surface:this.surface,method:n,params:s,...a?{hostIds:a.hostIds}:{}};try{const p=await fetch(this.endpoint,{method:"POST",credentials:"same-origin",cache:"no-store",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(u),signal:l.signal});if(!p.ok){const y=await p.json().catch(()=>null);throw new Error(y?.error||`Scout Deck web bridge returned HTTP ${p.status}.`)}const k=await p.json();if(k.v!==Ae||k.id!==r||k.method!==n)throw new Error("Scout Deck web bridge returned a mismatched reply.");if("error"in k)throw new Error(`${k.error.code}: ${k.error.message}`);return k.result}finally{this.pending.delete(r)}}}class Is{live=null;inputRun=0;state={input:{state:"idle",partialText:"",finalText:"",finalCount:0,engine:"parakeet",modelReady:!0,unavailableReason:null},output:{speaking:!1}};get inputAvailable(){return typeof fetch=="function"}get outputAvailable(){return"speechSynthesis"in window&&"SpeechSynthesisUtterance"in window}snapshot(){return{input:{...this.state.input},output:{...this.state.output}}}async toggleInput(){if(this.state.input.state==="listening"){const n=this.live;if(this.state={...this.state,input:{...this.state.input,state:"transcribing"}},n)try{await n.stop()}catch(s){this.failInput(s,this.inputRun)}return this.snapshot()}if(this.state.input.state==="preparing"||this.state.input.state==="transcribing"){const n=this.live;return this.inputRun+=1,this.live=null,await n?.cancel().catch(()=>{}),this.state={...this.state,input:{...this.state.input,state:"idle",partialText:"",unavailableReason:null}},this.snapshot()}return this.stopOutput(),this.startInput(),this.snapshot()}async speak(n){const s=n.trim();if(!s||!this.outputAvailable)return this.snapshot();window.speechSynthesis.cancel();const a=new SpeechSynthesisUtterance(s);return a.onstart=()=>{this.state={...this.state,output:{speaking:!0}}},a.onend=a.onerror=()=>{this.state={...this.state,output:{speaking:!1}}},window.speechSynthesis.speak(a),this.state={...this.state,output:{speaking:!0}},this.snapshot()}async stopOutput(){return this.outputAvailable&&window.speechSynthesis.cancel(),this.state={...this.state,output:{speaking:!1}},this.snapshot()}async startInput(){const n=++this.inputRun;this.state={...this.state,input:{...this.state.input,state:"preparing",partialText:"",unavailableReason:null}};try{let s=await Xt({surface:"scout-deck",requestPermissions:!0});if(n!==this.inputRun)return;if(!s.ready&&s.issue?.code==="microphone_not_requested"){if(await Es(1800),n!==this.inputRun)return;s=await Xt({surface:"scout-deck"})}if(!(s.ready||s.issue?.code==="microphone_not_requested")){this.state={...this.state,input:{...this.state.input,state:"unavailable",engine:s.settings.preference==="apple"?"apple":"parakeet",modelReady:!!s.settings.modelReady,unavailableReason:fs(s.issue)}};return}const r=xs();if(await r.probe({force:!0}).catch(()=>!1),n!==this.inputRun)return;const l=await r.startLive({onState:u=>this.applyInputState(u,n),onPartial:u=>{n===this.inputRun&&(this.state={...this.state,input:{...this.state.input,partialText:u}})}},{surface:"scout-deck"});if(n!==this.inputRun){await l.cancel().catch(()=>{});return}this.live=l,this.state={...this.state,input:{...this.state.input,state:"listening",engine:s.settings.preference==="apple"?"apple":"parakeet",modelReady:!!s.settings.modelReady,unavailableReason:null}},l.result.then(u=>this.finishInput(u.text,n)).catch(u=>this.failInput(u,n))}catch(s){this.failInput(s,n)}}applyInputState(n,s){if(s!==this.inputRun)return;const a=n==="recording"?"listening":n==="processing"||n==="done"?"transcribing":n==="cancelled"?"idle":n==="error"?"unavailable":"preparing";this.state={...this.state,input:{...this.state.input,state:a}}}finishInput(n,s){if(s!==this.inputRun)return;this.live=null;const a=n.trim();this.state={...this.state,input:{...this.state.input,state:a?"idle":"unavailable",partialText:"",finalText:a||this.state.input.finalText,finalCount:a?this.state.input.finalCount+1:this.state.input.finalCount,unavailableReason:a?null:"No speech was detected. Tap to try again."}}}failInput(n,s){if(s!==this.inputRun)return;this.live=null;const a=n instanceof Error?n.message:String(n),r=n instanceof Error&&n.name==="AbortError";this.state={...this.state,input:{...this.state.input,state:r?"idle":"unavailable",partialText:"",unavailableReason:r?null:a}}}}function Zt(){try{const e=JSON.parse(localStorage.getItem(ln)??"[]");return Array.isArray(e)?e:[]}catch{return[]}}function Cs(){const e=Math.min(window.screen.width,window.screen.height);return/iPad/i.test(navigator.userAgent)?"ipad":/Mobi|iPhone|Android/i.test(navigator.userAgent)&&e<700?"phone":e<1100?"tablet":"desktop"}function Es(e){return new Promise(n=>window.setTimeout(n,e))}function Ts(){return globalThis.crypto?.randomUUID?.()??`surface-${Date.now()}-${Math.random().toString(16).slice(2)}`}function st(e,n){const s=e.find(a=>a.key===n);return s?[s,...e.filter(a=>a.key!==n)]:[...e]}async function As(e,n){const s=e.filter(l=>l.transport==="codex_app_server"),r=(await Promise.allSettled(s.map(async l=>({lane:l,snapshot:await n({hostId:l.hostId,agentId:l.id})})))).flatMap(l=>l.status==="fulfilled"?[l.value]:[]);return r.find(({snapshot:l})=>l.state==="running")?.lane.key??r.find(({snapshot:l})=>l.state==="idle")?.lane.key??null}const dn=["ops","yoke","console","brief"],ct={ops:{label:"Ops",tagline:"Agent operations · routed control"},yoke:{label:"Yoke",tagline:"Two-grip cockpit · thumb-anchored"},console:{label:"Console",tagline:"Fleet board · one command bar"},brief:{label:"Brief",tagline:"Single column · command palette"}},Rs=9e3,en="scout.deck.hostScope",ce="scout.deck.lane.v1",un="scout.deck.treatment.v2",tn="scout.deck.autoSend",nn="scout.deck.voiceOut",at="scout.deck.voiceModel",Ee="scout.deck.voiceId",sn="scout.deck.voiceSpeed",ne="gpt-4o-mini-tts",ot="alloy",Os=1,an=44,Ls=160,Ds=[{id:"air",name:"MacBook Air",state:"connected"},{id:"studio",name:"Studio",state:"connected"}],se=Date.now(),Se=[Te("air","MacBook Air","01","OpenScout","codex","gpt-5.6","active","~/dev/openscout",[["tool","Verifying the native surface bundle","bun run build:native-surfaces"],["think","Mapping Deck to Scout's Codex session","Session state stays binary-native and host-scoped."],["message","Controller contract is live.","Start, steer, and interrupt map directly to the selected thread."]]),Te("studio","Studio","02","SpeakEasy","claude","opus-5","active","~/dev/SpeakEasy",[["message","Control deck reference review","Channel bank, focused stage, and restrained signal color."],["tool","Captured iPad landscape states","Connected, partial, and offline."],["think","Keep harness semantics explicit","A future Claude adapter can earn its own control vocabulary."]]),Te("air","MacBook Air","03","Hudson","claude","sonnet-5","waiting","~/dev/hudson",[["message","Waiting for operator review","One navigation decision needs attention."],["note","Candidate build is ready","No active tool call."]]),Te("studio","Studio","04","Release","codex","gpt-5.4","idle","~/dev/openscout",[["system","Last run completed","Checks passed 18 minutes ago."]])],ae={adapter:"codex_app_server",agentId:"01",threadId:"019fa45a-scout-deck",turnId:"turn_8d17",state:"running",capabilities:{connect:!0,start:!0,steer:!0,interrupt:!0,queue:!1,approvals:!1},capabilityNotes:{queue:"A Scout-managed Codex session runs one active turn at a time; Deck does not invent a client-side queue.",approvals:"Approval prompts remain runtime-owned and are not actionable from Deck yet."},snapshot:{session:{id:"019fa45a-scout-deck",name:"Rework the Deck turn flow",adapterType:"codex",status:"active",cwd:"/Users/arach/dev/openscout",model:"gpt-5.6",providerMeta:{threadId:"019fa45a-scout-deck"}},currentTurnId:"turn_8d17",turns:[{id:"turn_8d11",status:"completed",startedAt:se-214e3,endedAt:se-176e3,isUserTurn:!0,blocks:[{status:"completed",block:{id:"input_8d11",turnId:"turn_8d11",type:"text",status:"completed",index:0,text:"Make Deck operate on the selected Scout-managed Codex session directly."}}]},{id:"turn_8d15",status:"completed",startedAt:se-164e3,endedAt:se-71e3,isUserTurn:!1,blocks:[{status:"completed",block:{id:"reason_8d15",turnId:"turn_8d15",type:"reasoning",status:"completed",index:0,text:"Tracing the trusted bridge to Scout's broker-managed Codex session."}},{status:"completed",block:{id:"tool_8d15",turnId:"turn_8d15",type:"action",status:"completed",index:1,action:{kind:"command",status:"completed",command:"bun run build:native-surfaces",output:"native surfaces validated"}}},{status:"completed",block:{id:"text_8d15",turnId:"turn_8d15",type:"text",status:"completed",index:2,text:"The control path is separated from Scout messaging and keeps Codex semantics visible."}}]},{id:"turn_8d17",status:"streaming",startedAt:se-43e3,isUserTurn:!1,blocks:[{status:"streaming",block:{id:"reason_8d17",turnId:"turn_8d17",type:"reasoning",status:"streaming",index:0,text:"Refining the controller hierarchy for iPad landscape."}},{status:"streaming",block:{id:"tool_8d17",turnId:"turn_8d17",type:"action",status:"streaming",index:1,action:{kind:"command",status:"running",command:"bun test scout-surface-contract",output:"running focused contract checks…"}}}]}]}},it={input:{state:"idle",partialText:"",finalText:"",finalCount:0,engine:"parakeet",modelReady:!0,unavailableReason:null},output:{speaking:!1}},Ms={defaultModelId:ne,defaultVoiceId:ot,source:"vox",models:[{id:ne,name:"GPT-4o mini TTS",provider:"openai",available:!0},{id:"eleven_multilingual_v2",name:"Eleven Multilingual v2",provider:"elevenlabs",available:!0}],voices:[{id:"alloy",name:"Alloy",provider:"openai",modelId:ne,available:!0,isDefault:!0},{id:"coral",name:"Coral",provider:"openai",modelId:ne,available:!0,isDefault:!1},{id:"fable",name:"Fable",provider:"openai",modelId:ne,available:!0,isDefault:!1},{id:"nova",name:"Nova",provider:"openai",modelId:ne,available:!0,isDefault:!1},{id:"9BWtsMINqrJLrRacOk9x",name:"Aria",provider:"elevenlabs",modelId:"eleven_multilingual_v2",available:!0,isDefault:!0}]};function $s(e){const n=e.get("treatment");if(rn(n))return n;const s=localStorage.getItem(un);return rn(s)?s:"ops"}function rn(e){return e!=null&&dn.includes(e)}function Ps(e){const n=Number(e.get("lane"));return Number.isInteger(n)?Math.min(Math.max(n-1,0),Se.length-1):0}function Vs(){const e=new URLSearchParams(window.location.search),n=e.get("preview")==="1",s=e.get("agent")?.trim()||null,a=n&&e.get("voice")==="listening"?{...it,input:{...it.input,state:"listening",partialText:"Make voice the fastest path into this active turn."}}:it,[r,l]=d.useState(()=>window.__scoutSurfaceBootstrap??null),[u,p]=d.useState(()=>$s(e)),[k,y]=d.useState(n?Se:[]),[m,U]=d.useState("all"),[E,f]=d.useState(n?Se[Ps(e)]?.key??Se[0]?.key??null:localStorage.getItem(ce)),[c,g]=d.useState(n?"ready":"waiting"),[J,Ue]=d.useState(null),[w,R]=d.useState(n?ae:null),[H,K]=d.useState(!1),[_t,T]=d.useState(null),[he,mn]=d.useState(null),[fe,xe]=d.useState(""),[wn,O]=d.useState(null),[X,V]=d.useState(null),[mt,He]=d.useState(()=>Date.now()),[Nn,Ke]=d.useState("thread"),[S,A]=d.useState(a),[wt,In]=d.useState(n),[_e,Cn]=d.useState(()=>localStorage.getItem(nn)!=="off"),[En,Nt]=d.useState(n?Ms:null),[Q,It]=d.useState(()=>localStorage.getItem(at)||ne),[me,Fe]=d.useState(()=>localStorage.getItem(Ee)||ot),[We,Tn]=d.useState(()=>{const i=Number(localStorage.getItem(sn));return Number.isFinite(i)&&i>=.5&&i<=2?i:Os}),[Ct,Z]=d.useState("idle"),[An,Rn]=d.useState(null),[Ge,On]=d.useState(()=>localStorage.getItem(tn)!=="off"),[Ln,M]=d.useState(null),[Dn,Et]=d.useState(n&&e.get("audio")==="open"),[Mn,Tt]=d.useState(()=>Array.from({length:an},()=>0)),_=d.useRef(null),At=d.useRef(s),F=d.useRef(E),Ye=d.useRef(!1),Rt=d.useRef(!1),we=d.useRef(n?0:null),ie=d.useRef(null),I=d.useRef(null),B=d.useRef(null),Ot=d.useRef(null),re=d.useRef(!1),ze=d.useRef(null),Lt=d.useRef(async()=>{}),Je=d.useRef(S);Je.current=S,F.current=E;const ge=i=>{Ot.current=i,mn(i)};d.useEffect(()=>{if(_s(),n)return;const i=ws("deck",()=>({hostIds:window.__scoutSurfaceBootstrap?.selectedHostIds??[]}));_.current=i;let o=!1,h=null,j=!1;return i.bootstrap().then(async x=>{if(o)return;window.__scoutSurfaceBootstrap=x,l(x);const b=x.selectedHostIds;if(b.length===0){g("offline"),y([]);return}const te=new Set(x.hosts.filter(P=>P.state==="connected").map(P=>P.id)),Ce=localStorage.getItem(en),us=Ce==="all"||Ce&&te.has(Ce)?Ce:x.focusedHostId&&te.has(x.focusedHostId)?x.focusedHostId:b[0]??"all";U(us);const Gt={hostIds:b},Yt=async()=>{if(!j){j=!0;try{const[P,zt]=await Promise.all([i.agents.list(Gt),i.tail.recent(Gt)]);if(o)return;const W=Bs(x.hosts,P,zt),nt=Ot.current,ke=nt?.receipt?W.find(D=>D.hostId===nt.receipt?.hostId&&D.id===nt.receipt?.agentId):null;if(ke){const D=st(W,ke.key);y(D),f(ke.key),F.current=ke.key,Ye.current=!0,localStorage.setItem(ce,ke.key),Ke("thread"),ge(null)}else{const D=At.current;At.current=null;const Jt=(D?W.find(q=>q.id===D):null)?.key??F.current??localStorage.getItem(ce),be=Jt?W.find(q=>q.key===Jt):null;if(be){const q=st(W,be.key);y(q),f(be.key),F.current=be.key,localStorage.setItem(ce,be.key)}else y(W),f(null),F.current=null,Rt.current||(Rt.current=!0,As(W,q=>i.codex.connect(q)).then(q=>{if(o||Ye.current)return;const je=q??W[0]?.key??null;je&&(y(hs=>st(hs,je)),f(je),F.current=je,localStorage.setItem(ce,je))}))}const ps=P.hosts.filter(D=>!D.ready).length+zt.hosts.filter(D=>!D.ready).length;Ue(null),g(ps>0?"partial":"ready")}catch(P){if(o)return;Ue(P instanceof Error?P.message:String(P)),g("partial")}finally{j=!1}}};await Yt(),o||(h=setInterval(()=>{Yt()},3e3))}).catch(x=>{o||(Ue(x instanceof Error?x.message:String(x)),g("error"))}),()=>{o=!0,h&&clearInterval(h),_.current=null}},[n]);const $n=n?Ds:r?.hosts??[],$=m==="all"?k:k.filter(i=>i.hostId===m),v=$.find(i=>i.key===E)??null,Xe=v?$.indexOf(v):-1,C=v?{hostId:v.hostId,agentId:v.id}:null,L=!!(v?.transport==="codex_app_server"&&(n||r?.capabilities?.includes("codex.thread.snapshot"))),ve=n||!!r?.capabilities?.includes("native.voice.snapshot"),ee=n||r?.device?.platform==="web",Pn=ee||!!r?.capabilities?.includes("native.voice.speak");d.useEffect(()=>{if(!ee||n)return;let i=!1;return gs(Q).then(o=>{if(i)return;if(Nt(o),!o.models.find(b=>b.id===Q)?.available){const b=o.models.find(te=>te.id===o.defaultModelId&&te.available)??o.models.find(te=>te.available);if(b&&b.id!==Q){It(b.id),localStorage.setItem(at,b.id);return}}if(o.voices.find(b=>b.id===me&&b.available))return;const x=o.voices.find(b=>b.isDefault&&b.available)??o.voices.find(b=>b.available);x&&(Fe(x.id),localStorage.setItem(Ee,x.id))}).catch(o=>{i||M(o instanceof Error?o.message:String(o))}),()=>{i=!0}},[ee,n,Q]),d.useEffect(()=>{if(!v){R(null);return}if(xe(""),T(null),O(null),V(null),re.current=!1,Ke(v.transport==="codex_app_server"?"thread":"signal"),ie.current=null,n){R(cn(v));return}const i=_.current;if(!i)return;R(null);let o=!1,h=null;return(async()=>{if(await i.native.setLaneSelection({hostId:v.hostId,agentId:v.id,...v.conversationId?{conversationId:v.conversationId}:{},...v.sessionId?{sessionId:v.sessionId}:{}}),o)return;if(!L){R(null);return}const j=async(x=!1)=>{try{let b=await i.codex.snapshot({hostId:v.hostId,agentId:v.id});if(x&&b.state==="disconnected"&&(V({kind:"connecting",at:Date.now()}),b=await i.codex.connect({hostId:v.hostId,agentId:v.id})),o)return;R(b),T(null)}catch(b){if(o)return;T(b instanceof Error?b.message:String(b))}};await j(!0),o||(h=setInterval(()=>{j()},2e3))})().catch(j=>{o||T(j instanceof Error?j.message:String(j))}),()=>{o=!0,h&&clearInterval(h)}},[v?.key,L,n]),d.useEffect(()=>{if(n||!ve)return;const i=_.current;if(!i)return;let o=!1;const h=async()=>{try{const x=await i.native.voice.snapshot();o||(A(x),In(!0),M(null))}catch(x){o||M(x instanceof Error?x.message:String(x))}};h();const j=setInterval(()=>{h()},320);return()=>{o=!0,clearInterval(j)}},[n,ve]),d.useEffect(()=>{if(!wt)return;const i=S.input.finalCount;if(we.current==null){we.current=i;return}if(i<=we.current)return;we.current=i;const o=S.input.finalText.trim(),h=re.current;if(re.current=!1,!o){h&&O("Nothing was transcribed — the turn was not sent.");return}const j=Js(fe,o);xe(j),h&&Lt.current(j)},[S.input.finalCount,S.input.finalText,wt,fe]),d.useEffect(()=>{const i=Xs(w);if(i){if(ie.current==null){ie.current=i.id;return}if(ie.current!==i.id){if(!_e){ie.current=i.id;return}if(!(S.input.state==="listening"||S.input.state==="transcribing")){if(ie.current=i.id,n){A(o=>({...o,output:{speaking:!0}})),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{A(o=>({...o,output:{speaking:!1}}))},1600);return}if(ee){Ft(i.text);return}_.current?.native.voice.speak(i.text).then(A).catch(o=>M(o instanceof Error?o.message:String(o)))}}}},[w,S.input.state,_e,n,ee,Q,me,We]),d.useEffect(()=>()=>{I.current&&clearTimeout(I.current),B.current?.abort()},[]);const Vn=d.useMemo(()=>$.filter(i=>i.state==="waiting"||i.state==="blocked"||i.state==="error"),[$]),Bn=$.filter(i=>ft(i.state)).length,qn=ta(v?.events??[]),Dt=S.input.state==="listening"||S.input.state==="transcribing";d.useEffect(()=>{if(S.input.state!=="listening"){Tt(Array.from({length:an},()=>0));return}let i=Je.current.input.partialText.length,o=.45;const h=setInterval(()=>{let j;if(n)o=Math.min(1,Math.max(.08,o+(Math.random()-.48)*.42)),j=o;else{const x=Je.current.input.partialText.length;j=Math.min(1,Math.max(0,x-i)/5),i=x}Tt(x=>[...x.slice(1),j])},Ls);return()=>clearInterval(h)},[S.input.state,n]);const Mt=X&&mt-X.at<Rs?X:null,Ne=he?.sourceKey===v?.key?he:null,Qe=!!(Ne&&!Ne.error),Un=Ne?.error??null,$t=!!Ne?.receipt,N=Hs({adapterAvailable:L,startingSession:Qe,thread:w,threadError:_t,pending:Mt}),Hn=Ks(N),Kn=Gs(w),Fn=!!(ve&&!H&&(N==="ready"||N==="running")),Wn=!!(L&&w&&w.state!=="disconnected"&&!H),Gn=!!(L&&(N==="running"||N==="stopping")),Yn=!!(L&&(N==="cold"||N==="failed")),zn=!!(L&&!H),Pt=!!(he&&!he.error),Vt=L||!v?null:Qe?$t?"Codex started; Scout is locating its lane.":"Scout is starting Codex for this workspace.":Pt?`Scout is finishing the Codex launch for ${he?.sourceName??"another workspace"}.`:v.projectRoot?c!=="ready"&&c!=="partial"?"Reconnect the Scout host to start Codex.":!n&&!r?.capabilities?.includes("codex.session.start")?"This Scout host cannot start Codex from Deck.":null:"Scout does not know this lane's workspace.",Bt=!!(!L&&v&&!Vt);d.useEffect(()=>{if(!X)return;(X.kind==="sending"?w?.state==="running":X.kind==="stopping"?w?.state==="idle":w?.state==="idle"||w?.state==="running")&&V(null)},[X,w?.state]);const qt=N==="running"||N==="sending"||N==="stopping"||N==="linking"||N==="starting"||Dt;d.useEffect(()=>{if(!qt)return;const i=setInterval(()=>He(Date.now()),1e3);return He(Date.now()),()=>clearInterval(i)},[qt]);const Jn=i=>{p(i),Et(!1),localStorage.setItem(un,i)},Ze=i=>{Ye.current=!0,F.current=i.key,f(i.key),localStorage.setItem(ce,i.key)},Xn=i=>{if($.length===0)return;const h=((Xe<0?0:Xe)+i+$.length)%$.length,j=$[h];j&&Ze(j)},Qn=i=>{U(i),f(null),localStorage.setItem(en,i)},et=async()=>{n||!C||!_.current||R(await _.current.codex.snapshot(C))},Zn=async()=>{if(!(!C||H)){if(O(null),n){R(v?cn(v):null);return}K(!0);try{await et(),T(null)}catch(i){T(i instanceof Error?i.message:String(i))}finally{K(!1)}}},Ut=async()=>{if(!(!C||H)){K(!0),T(null),O(null),V({kind:"connecting",at:Date.now()});try{n?R({...ae,agentId:C.agentId,state:"idle",turnId:null}):_.current&&R(await _.current.codex.connect(C))}catch(i){V(null),T(i instanceof Error?i.message:String(i))}finally{K(!1)}}},Ht=async()=>{if(!C||!v||Pt||!Bt)return;const i={sourceKey:v.key,sourceName:v.name,receipt:null,error:null};ge(i),O(null);try{if(n){const x=Se.find(b=>b.transport==="codex_app_server");x&&Ze(x),ge(null);return}const o=_.current,h=r?.selectedHostIds;if(!o||!h?.length)throw new Error("No connected Scout host can start Codex.");const j=await o.codex.startSession(C);ge({...i,receipt:j})}catch(o){const h=o instanceof Error?o.message:String(o);ge({...i,error:h}),F.current===i.sourceKey&&O(h)}},Ie=async i=>{const o=i.trim();if(o){if(!C||!w){O("No Codex session is connected — the transcript is still in the composer.");return}if(H){O("A turn is already being sent — the transcript is still in the composer.");return}K(!0),T(null),O(null),V({kind:"sending",at:Date.now()});try{const h=w.state==="running"?"steer":"start";n?R(qs(w,o,h)):_.current&&(h==="steer"?await _.current.codex.steer(C,o):await _.current.codex.start(C,o),await new Promise(j=>setTimeout(j,180)),await et()),xe("")}catch(h){V(null),xe(o),T(h instanceof Error?h.message:String(h))}finally{K(!1)}}};Lt.current=Ie;const es=i=>{i?.preventDefault(),Ie(fe)},ts=async()=>{if(!(!C||!w||H)){K(!0),T(null),O(null),V({kind:"stopping",at:Date.now()});try{n?R(Us(w)):_.current&&(await _.current.codex.interrupt(C),await new Promise(i=>setTimeout(i,180)),await et())}catch(i){V(null),T(i instanceof Error?i.message:String(i))}finally{K(!1)}}},Kt=async()=>{if(ve){if(M(null),O(null),S.input.state!=="listening"&&S.input.state!=="transcribing"&&(B.current?.abort(),B.current=null,Z("idle")),S.input.state==="listening"?(re.current=Ge,ze.current=null):S.input.state==="transcribing"?re.current=!1:(re.current=!1,ze.current=Date.now(),He(Date.now())),n){if(I.current&&clearTimeout(I.current),S.input.state==="listening"){const i=S.input.partialText||"Make the voice loop feel immediate and obvious.";A(o=>({...o,input:{...o.input,state:"transcribing",partialText:""},output:{speaking:!1}})),I.current=setTimeout(()=>{A(o=>({...o,input:{...o.input,state:"idle",finalText:i,finalCount:o.input.finalCount+1}}))},520)}else S.input.state==="transcribing"?A(i=>({...i,input:{...i.input,state:"idle",partialText:""}})):A(i=>({...i,input:{...i.input,state:"listening",partialText:"Make the voice loop feel immediate and obvious.",unavailableReason:null},output:{speaking:!1}}));return}try{const i=await _.current?.native.voice.toggleInput();i&&A(i)}catch(i){M(i instanceof Error?i.message:String(i))}}};async function Ft(i){B.current?.abort();const o=new AbortController;B.current=o,Z("preparing"),M(null);try{const h=await vs(i,{modelId:Q,voiceId:me,speed:We,originAppId:"openscout-deck",utteranceId:`deck-${Date.now()}`,signal:o.signal});if(o.signal.aborted)return;Rn({modelId:h.modelId,voiceId:h.voiceId}),Z("speaking"),await ks(h,{signal:o.signal})}catch(h){bs(h)||M(h instanceof Error?h.message:String(h))}finally{B.current===o&&(B.current=null,Z("idle"))}}const Wt=async()=>{if(I.current&&clearTimeout(I.current),B.current?.abort(),B.current=null,Z("idle"),A(i=>({...i,output:{speaking:!1}})),!n)try{const i=await _.current?.native.voice.stopOutput();i&&A(i)}catch(i){M(i instanceof Error?i.message:String(i))}},ns=async()=>{const i=!_e;Cn(i),localStorage.setItem(nn,i?"on":"off"),i||await Wt()},ss=i=>{if(It(i),Nt(o=>n||o?.defaultModelId===i?o:null),n){const o=i==="eleven_multilingual_v2"?"9BWtsMINqrJLrRacOk9x":ot;Fe(o),localStorage.setItem(Ee,o)}localStorage.setItem(at,i)},as=i=>{Fe(i),localStorage.setItem(Ee,i)},is=i=>{const o=Math.min(2,Math.max(.5,i));Tn(o),localStorage.setItem(sn,String(o))},rs=()=>{if(n){Z("speaking"),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>Z("idle"),1400);return}if(ee){Ft("Scout voice out is ready on this Deck.");return}_.current?.native.voice.speak("Scout voice out is ready on this Deck.").then(A).catch(i=>M(i instanceof Error?i.message:String(i)))},cs=()=>{const i=!Ge;On(i),localStorage.setItem(tn,i?"on":"off")},os=i=>{i.key==="Enter"&&(i.metaKey||i.ctrlKey)&&(i.preventDefault(),Ie(fe))},tt=L?N==="cold"||N==="failed"?"connect":"talk":"start_codex",ls=()=>{if(tt==="start_codex")return void Ht();if(tt==="connect")return void Ut();Kt()},ds=Ct==="idle"?S:{...S,output:{speaking:!0}};return{preview:n,treatment:u,setTreatment:Jn,hosts:$n,hostScope:m,selectHostScope:Qn,connection:c,error:J,lanes:k,scopedLanes:$,selected:v,selectedIndex:Xe,selectLane:Ze,stepLane:Xn,attention:Vn,activeCount:Bn,laneActivity:qn,thread:w,threadBusy:H,threadError:_t,sessionBusy:Qe,sessionError:Un,sessionLaunchAccepted:$t,sessionStartUnavailableReason:Vt,notice:wn,adapterAvailable:L,voiceAvailable:ve,phase:N,phaseTone:Hn,turnStartedAt:Kn,clock:mt,livePending:Mt,listeningSince:ze.current,canTalk:Fn,canCompose:Wn,canInterrupt:Gn,canRebind:Yn,canRefresh:zn,canStartCodexSession:Bt,primaryAction:tt,onPrimary:ls,command:fe,setCommand:xe,submitTurn:Ie,onComposerSubmit:es,onComposerKeyDown:os,connectThread:Ut,startCodexSession:Ht,refreshSnapshot:Zn,interruptThread:ts,voice:ds,voiceError:Ln,voiceOutEnabled:_e,voiceOutputAvailable:Pn,cloudSpeechAvailable:ee,speechCatalog:En,speechModelId:Q,speechVoiceId:me,speechSpeed:We,speechOutputPhase:Ct,speechRoute:An,selectSpeechModel:ss,selectSpeechVoice:as,selectSpeechSpeed:is,previewSpeechVoice:rs,toggleVoiceInput:Kt,toggleVoiceOutput:ns,stopSpeaking:Wt,autoSendOnStop:Ge,toggleAutoSend:cs,inputTrace:Mn,voiceInputActive:Dt,settingsOpen:Dn,setSettingsOpen:Et,view:Nn,setView:Ke}}function Bs(e,n,s){const a=new Map(e.map(l=>[l.id,l.name])),r=new Map;for(const l of s.hosts)if(l.ready)for(const u of l.value.events){if(!u.agentId)continue;const p=`${l.hostId}:${u.agentId}`;r.set(p,[...r.get(p)??[],u])}return n.hosts.flatMap(l=>l.ready?l.value.agents.map(u=>({...u,key:`${l.hostId}:${u.id}`,hostId:l.hostId,hostName:a.get(l.hostId)??l.hostId,events:(r.get(`${l.hostId}:${u.id}`)??[]).sort((p,k)=>k.at-p.at)})):[])}function Te(e,n,s,a,r,l,u,p,k){return{key:`${e}:${s}`,hostId:e,hostName:n,id:s,name:a,handle:a.toLowerCase(),harness:r,transport:r==="codex"?"codex_app_server":"claude_stream_json",model:l,state:u,projectRoot:p,conversationId:`conversation-${s}`,sessionId:`session-${s}`,updatedAt:se-Number(s)*43e3,events:k.map(([y,m,U],E)=>({id:`${s}-${E}`,at:se-E*68e3-Number(s)*12e3,agentId:s,sessionId:`session-${s}`,kind:y,text:m,detail:U}))}}function cn(e){return e.transport!=="codex_app_server"?null:e.id==="04"?{...ae,agentId:e.id,threadId:"019fa45a-release",turnId:null,state:"idle",snapshot:ae.snapshot?{...ae.snapshot,currentTurnId:null,turns:ae.snapshot.turns.slice(0,2)}:null}:ae}function qs(e,n,s){const a=s==="steer"?e.turnId??`turn_${Date.now()}`:`turn_${Date.now()}`,r=e.snapshot;if(!r)return e;const l={id:`${s}_${Date.now()}`,turnId:a,type:s==="steer"?"reasoning":"text",status:"streaming",index:99,text:s==="steer"?`Steer received: ${n}`:n},u=s==="steer"?r.turns.map(p=>p.id===a?{...p,blocks:[...p.blocks,{status:"streaming",block:l}]}:p):[...r.turns,{id:a,status:"streaming",blocks:[{status:"streaming",block:l}],startedAt:Date.now(),isUserTurn:!0}];return{...e,state:"running",turnId:a,snapshot:{...r,currentTurnId:a,turns:u}}}function Us(e){if(!e.snapshot||!e.turnId)return{...e,state:"idle",turnId:null};const n=e.snapshot.turns.map(s=>s.id===e.turnId?{...s,status:"interrupted",endedAt:Date.now(),blocks:s.blocks.map(a=>({...a,status:"completed",block:{...a.block,status:a.block.status==="streaming"?"completed":a.block.status}}))}:s);return{...e,state:"idle",turnId:null,snapshot:{...e.snapshot,currentTurnId:null,turns:n}}}function Hs({adapterAvailable:e,startingSession:n,thread:s,threadError:a,pending:r}){return!e&&n?"starting":e?a?"failed":r?.kind==="sending"?"sending":r?.kind==="stopping"?"stopping":r?.kind==="connecting"||!s?"linking":s.state==="disconnected"?"cold":s.state==="running"?"running":"ready":"unavailable"}function Ks(e){return e==="running"||e==="sending"||e==="starting"?"live":e==="ready"?"ready":e==="cold"||e==="failed"?"attention":"quiet"}function pt(e,n){return e==="unavailable"?Y(n):e==="starting"?"Starting Codex":e==="cold"?"Session offline":e==="linking"?"Linking":e==="failed"?"Connection failed":e==="sending"?"Sending":e==="stopping"?"Stopping":e==="running"?"Turn running":"Ready"}function Fs(e,n,s,a,r,l=null){if(a)return a;if(e==="unavailable")return l??"Scout sees this lane · Codex not started";if(e==="starting")return l??"Scout is starting a Codex session for this workspace…";if(e==="failed")return s??"The host did not answer.";if(e==="cold")return"Connect restores Scout's managed Codex session.";if(e==="linking")return"Connecting to Scout's managed Codex session…";if(e==="sending")return"Waiting for Codex to accept the turn…";if(e==="stopping")return"Interrupt sent; waiting for the turn to end…";if(e==="running")return Ws(n);const u=Ys(n);return u?`Idle · last turn ended ${de(u)} ago`:"Idle · no turns yet in this session"}function Ws(e){const n=pn(e);if(!n)return"Streaming…";for(let s=n.blocks.length-1;s>=0;s-=1){const a=n.blocks[s];if(!(!a||a.status!=="streaming")){if(a.block.type==="action"){const r=a.block.action?.command??a.block.action?.toolName??a.block.action?.path;return r?`Running ${r}`:"Running an action"}if(a.block.type==="reasoning")return"Thinking";if(a.block.type==="text")return"Writing a reply"}}return"Streaming…"}function pn(e){return(e?.snapshot?.turns??[]).find(s=>s.id===e?.turnId)??null}function Gs(e){return pn(e)?.startedAt??null}function Ys(e){const n=e?.snapshot?.turns??[];for(let s=n.length-1;s>=0;s-=1){const a=n[s]?.endedAt;if(a)return a}return null}function zs(e){const{phase:n,turnStartedAt:s,livePending:a,clock:r}=e;return n==="sending"&&a?lt(r-a.at):(n==="running"||n==="stopping")&&s?lt(r-s):""}function lt(e){const n=Math.max(0,Math.floor(e/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function Js(e,n){const s=n.trim();return s?e.trim()?`${e}${/\s$/.test(e)?"":" "}${s}`:s:e}function Xs(e){const n=e?.snapshot?.turns??[];for(let s=n.length-1;s>=0;s-=1){const a=n[s];if(!(!a||a.isUserTurn||a.status!=="completed"))for(let r=a.blocks.length-1;r>=0;r-=1){const l=a.blocks[r],u=l?.block.type==="text"?Oe(l.block):"";if(l?.status==="completed"&&u)return{id:l.block.id,text:u}}}return null}function hn(e,n=9){return(e.snapshot?.turns??[]).flatMap(s=>s.blocks.map(a=>({role:s.isUserTurn?"operator":"codex",at:s.startedAt,status:a.status,block:a.block}))).filter(s=>!!Oe(s.block)).slice(-n)}function Oe(e){return e.type==="action"?e.action?.command??e.action?.toolName??e.action?.path??e.action?.agentName??"Codex action":e.text?.trim()||e.message?.trim()||""}function dt(e){return e.type!=="action"?"":e.action?.output?.trim()||(e.action?.kind?`${e.action.kind.replaceAll("_"," ")} · ${e.action.status}`:"")}function Qs(e){return e==="ready"?"Host connected":e==="partial"?"Host degraded":e==="error"?"Host unavailable":e==="offline"?"Host disconnected":"Connecting to host"}function pe(e){return e?e==="codex_app_server"?"Scout app-server":e:"transport unreported"}function Zs(e){return e?e==="codex_app_server"?"App server":e:"unreported"}function ht(e){const n=e?.snapshot?.session?.name?.trim();return n||null}function ea(e){return e==="ready"?"online":e==="partial"?"degraded":e==="error"?"error":e==="offline"?"offline":"connecting"}function le(e){return e.state==="waiting"||e.state==="blocked"||e.state==="error"?"attention":ft(e.state)?"live":"quiet"}function Y(e){return ft(e)?"Agent active":e==="waiting"||e==="blocked"?"Needs attention":e==="error"?"Agent error":e==="idle"||e==="available"?"Idle":e?e.replaceAll("_"," "):"Standing by"}function ft(e){return e==="live"||e==="working"||e==="active"||e==="running"||e==="in_flight"}function de(e){if(!e)return"—";const n=Math.max(0,Math.floor((Date.now()-e)/1e3));if(n<60)return`${n}s`;const s=Math.floor(n/60);return s<60?`${s}m`:`${Math.floor(s/60)}h`}function z(e){return e.length<=12?e:`${e.slice(0,5)}…${e.slice(-5)}`}function ta(e,n=28,s=5*6e4){const a=Date.now(),r=a-s,l=Array.from({length:n},()=>0);for(const u of e){if(u.at<r||u.at>a)continue;const p=Math.min(n-1,Math.floor((u.at-r)/s*n));l[p]+=u.kind==="message"||u.kind==="ask"?2:1}return l.map(u=>Math.min(6,u))}function na(e,n,s){return e==="start_codex"?n==="starting"?"starting":"start codex":e==="connect"?n==="failed"?"retry":"connect":s==="listening"?"send":s==="transcribing"?"…":s==="preparing"?"warming":s==="unavailable"?"voice off":n==="linking"?"linking":n==="sending"?"sending":n==="stopping"?"stopping":n==="running"?"steer":"talk"}function fn(e,n,s,a=null){return e==="start_codex"?n==="starting"?a??"Scout is starting a Codex session for this workspace":a??"Start a Scout-managed Codex session for this workspace":e==="connect"?"Reconnect Scout's managed Codex session":s==="listening"?"Stop dictation and send the turn":s==="transcribing"?"Transcribing dictation":n==="running"?"Speak to steer the active turn":"Speak to start a turn"}function sa(e){const{voice:n,voiceAvailable:s,phase:a,listeningSince:r,clock:l,sessionError:u}=e;if(!s)return"Native voice becomes available inside the Scout iPad app.";if(n.input.state==="listening"){const p=r?` · ${lt(l-r)}`:"";return`${n.input.partialText||"Listening — speak naturally."}${p}`}return n.input.state==="transcribing"?"Transcribing on device, then sending…":n.input.state==="preparing"?"Warming Parakeet; Apple Speech remains available as fallback.":n.input.state==="unavailable"?n.input.unavailableReason||"Microphone access is unavailable.":u||(a==="starting"?e.sessionLaunchAccepted?"Codex started; waiting for its Scout lane.":"Scout is starting Codex.":a==="unavailable"?e.canStartCodexSession?"Voice becomes available with the Codex session.":e.sessionStartUnavailableReason??"Codex launch is unavailable for this lane.":a==="cold"||a==="failed"?"Reconnect the Codex session before talking to it.":a==="running"?"Tap to talk, tap again to steer the running turn.":"Tap to talk, tap again to send.")}function xt(e){return e==="listening"?"listening":e==="transcribing"?"processing":e==="preparing"?"warming":e==="unavailable"?"blocked":"ready"}function xn(e,n){return e==="starting"?"Composer unlocks when the Codex lane appears.":e==="unavailable"?"Composer unlocks with a Codex session.":e==="cold"||e==="failed"?"Reconnect the Codex session to enable typing.":n==="listening"?"Speaking… the transcript sends when you tap send.":n==="transcribing"?"Finishing your transcript…":e==="running"?"Or type a redirect for this active turn…":"Or type what this session should do next…"}function gn(){return t.jsxs("svg",{className:"deck-glyph deck-glyph--mic",viewBox:"0 0 32 32","aria-hidden":"true",children:[t.jsx("rect",{x:"11",y:"4",width:"10",height:"16",rx:"5"}),t.jsx("path",{d:"M7.5 15.5v.8a8.5 8.5 0 0 0 17 0v-.8M16 24.8V29M11.5 29h9"})]})}function ue(){return t.jsx("svg",{className:"deck-glyph deck-glyph--mic",viewBox:"0 0 32 32","aria-hidden":"true",children:t.jsx("path",{d:"M13 19l6-6M11.5 14.5 9 17a4.6 4.6 0 0 0 6.5 6.5l2.5-2.5M20.5 17.5 23 15a4.6 4.6 0 0 0-6.5-6.5L14 11"})})}function gt(){return t.jsx("svg",{className:"deck-glyph",viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M3.5 8h3l4-3.2v10.4L6.5 12h-3zM13.3 7.2a4 4 0 0 1 0 5.6M15.6 5a7 7 0 0 1 0 10"})})}function Le(){return t.jsx("svg",{className:"deck-glyph",viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("rect",{x:"5.5",y:"5.5",width:"9",height:"9",rx:"1.6"})})}function vn(){return t.jsxs("svg",{className:"deck-glyph",viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("path",{d:"M3 6h6M13 6h4M3 14h4M11 14h6"}),t.jsx("circle",{cx:"11",cy:"6",r:"2.1"}),t.jsx("circle",{cx:"9",cy:"14",r:"2.1"})]})}function ut(){return t.jsxs("svg",{className:"deck-glyph",viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("path",{d:"M16.5 8.2A6.6 6.6 0 0 0 4.6 6.4M3.5 11.8a6.6 6.6 0 0 0 11.9 1.8"}),t.jsx("path",{d:"M16.8 4.2v4h-4M3.2 15.8v-4h4"})]})}function Re({dir:e}){const n={up:180,down:0,left:90,right:-90}[e];return t.jsx("svg",{className:"deck-glyph",viewBox:"0 0 20 20","aria-hidden":"true",style:{transform:`rotate(${n}deg)`},children:t.jsx("path",{d:"M5 8l5 5 5-5"})})}function aa({model:e}){return t.jsx("div",{className:"deck-switch",role:"group","aria-label":"Controller treatment",children:dn.map(n=>t.jsxs("button",{type:"button",className:"deck-switch__key","data-active":e.treatment===n||void 0,onClick:()=>e.setTreatment(n),"aria-pressed":e.treatment===n,title:ct[n].tagline,children:[ct[n].label,n==="ops"?t.jsx("em",{children:"default"}):null]},n))})}function kn({model:e,size:n="md"}){const s=ht(e.thread),a=!!e.thread?.threadId;return e.adapterAvailable?t.jsxs("div",{className:"deck-binding","data-size":n,"data-bound":a||void 0,children:[t.jsx("span",{className:"deck-binding__label",children:"Scout Codex session"}),t.jsx("strong",{title:s??void 0,children:a?s??"Untitled session":"No session connected"}),t.jsxs("span",{className:"deck-binding__id",children:[e.thread?.threadId?`id ${z(e.thread.threadId)}`:"id —",e.thread?.turnId?` · turn ${z(e.thread.turnId)}`:""]})]}):t.jsxs("div",{className:"deck-binding","data-size":n,children:[t.jsx("span",{className:"deck-binding__label",children:"Selected workspace"}),t.jsx("strong",{children:e.selected?.name??"No lane selected"}),t.jsx("span",{className:"deck-binding__id",children:e.selected?.projectRoot??e.sessionStartUnavailableReason??`${pe(e.selected?.transport)} · view only`})]})}function De({model:e,compact:n=!1}){const s=e.selected;if(!s)return null;const a=zs(e);return t.jsxs("div",{className:"deck-phase","data-tone":e.phaseTone,"data-phase":e.phase,"data-compact":n||void 0,"aria-live":"polite","aria-atomic":"true",children:[t.jsxs("span",{className:"deck-phase__state",children:[t.jsx("i",{className:"deck-lamp"}),pt(e.phase,s.state)]}),t.jsx("span",{className:"deck-phase__detail",children:Fs(e.phase,e.thread,e.threadError,e.notice,s,e.sessionStartUnavailableReason)}),a?t.jsx("span",{className:"deck-phase__clock","data-live":e.phase==="running"||void 0,children:a}):null]})}function Me({model:e,size:n="lg"}){const s=e.primaryAction==="start_codex"?e.sessionBusy?"starting":"start":e.primaryAction==="connect"?"connect":e.voice.input.state,a=fn(e.primaryAction,e.phase,e.voice.input.state,e.sessionStartUnavailableReason),r=e.primaryAction==="start_codex"?!e.canStartCodexSession:e.primaryAction==="connect"?e.threadBusy:!e.canTalk;return t.jsxs("button",{type:"button",className:"deck-primary","data-size":n,"data-action":e.primaryAction,"data-state":s,onClick:e.onPrimary,disabled:r,"aria-label":a,"aria-pressed":e.primaryAction==="talk"?e.voice.input.state==="listening":void 0,"aria-busy":e.primaryAction==="start_codex"&&e.sessionBusy?!0:void 0,title:a,children:[e.primaryAction==="talk"?t.jsx(gn,{}):t.jsx(ue,{}),t.jsx("small",{children:na(e.primaryAction,e.phase,e.voice.input.state)})]})}function bn({model:e,block:n=!1}){return e.canInterrupt?t.jsxs("button",{type:"button",className:"deck-stop","data-block":n||void 0,onClick:e.interruptThread,disabled:e.threadBusy||e.phase==="stopping",children:[t.jsx(Le,{}),t.jsx("span",{children:e.phase==="stopping"?"Stopping":"Stop turn"})]}):null}function $e({model:e}){const n=e.voice.input.state==="listening";return t.jsxs("div",{className:"deck-trace-wrap","data-live":n||void 0,children:[t.jsx("span",{className:"deck-trace__label",title:"The surface contract reports no microphone level, so the Deck plots transcript cadence instead.",children:n?"Listening · cadence":"Input cadence"}),t.jsx("div",{className:"deck-trace","data-live":n||void 0,"aria-hidden":"true",children:e.inputTrace.map((s,a)=>t.jsx("i",{style:{"--level":s}},a))})]})}function ia({model:e}){return t.jsxs("div",{className:"deck-activity","aria-label":"Lane activity over the last five minutes",children:[t.jsx("small",{children:"5m"}),t.jsx("div",{"aria-hidden":"true",children:e.laneActivity.map((n,s)=>t.jsx("i",{style:{"--level":n}},s))}),t.jsx("small",{children:"now"})]})}function Pe({model:e}){return t.jsxs("p",{className:"deck-caption","data-active":e.voiceInputActive||void 0,"data-error":!!e.voiceError||void 0,"aria-live":"polite",children:[t.jsx("i",{"aria-hidden":"true"}),t.jsx("span",{children:e.voiceError??sa(e)})]})}function vt({model:e,rows:n=2}){return t.jsxs("form",{className:"deck-composer",onSubmit:e.onComposerSubmit,"aria-busy":e.threadBusy||void 0,children:[t.jsx("textarea",{value:e.command,onChange:s=>e.setCommand(s.target.value),onKeyDown:e.onComposerKeyDown,placeholder:xn(e.phase,e.voice.input.state),disabled:!e.canCompose,rows:n,"aria-label":e.phase==="running"?"Steer the active Codex turn":"Start a Codex turn"}),t.jsxs("button",{type:"submit",className:"deck-send",disabled:!e.canCompose||!e.command.trim(),children:[e.phase==="running"?"Steer":"Send",t.jsx("em",{children:"⌘↵"})]})]})}function ye(e,n){return`${e} — ${n}`}function kt({model:e,label:n=!0}){const s=e.voice.output.speaking?"Speaking":e.voiceOutEnabled?"Voice out":"Muted",a=e.voiceOutputAvailable?e.voice.output.speaking?"spoken replies are on and playing now":e.voiceOutEnabled?"spoken replies are on":"spoken replies are off":"spoken replies unavailable on this host";return t.jsxs("button",{type:"button",className:Ve("deck-chip deck-chip--voice",n),"data-active":e.voiceOutEnabled||void 0,"data-speaking":e.voice.output.speaking||void 0,onClick:e.toggleVoiceOutput,disabled:!e.voiceOutputAvailable,"aria-pressed":e.voiceOutEnabled,"aria-label":ye(s,a),title:ye(s,a),children:[t.jsx(gt,{}),n?t.jsx("span",{children:s}):null]})}function jn({model:e,label:n=!0}){const s=ye("Audio",e.settingsOpen?"dictation and playback settings, open":"dictation and playback settings");return t.jsxs("button",{type:"button",className:Ve("deck-chip",n),"data-active":e.settingsOpen||void 0,onClick:()=>e.setSettingsOpen(!e.settingsOpen),"aria-expanded":e.settingsOpen,"aria-label":s,title:s,children:[t.jsx(vn,{}),n?t.jsx("span",{children:"Audio"}):null]})}function Sn({model:e,label:n=!0}){const s=ye("Re-read",e.canRefresh?"pull the connected session snapshot from the host again":"unavailable until a session is connected");return t.jsxs("button",{type:"button",className:Ve("deck-chip",n),onClick:e.refreshSnapshot,disabled:!e.canRefresh,"aria-label":s,title:s,children:[t.jsx(ut,{}),n?t.jsx("span",{children:"Re-read"}):null]})}function yn({model:e,label:n=!0}){if(!e.canRebind)return null;const s=e.phase==="failed"?"Retry link":"Reconnect",a=ye(s,e.phase==="failed"?"the last connection failed; reconnect Scout's managed Codex session":"connect Scout's managed Codex session");return t.jsxs("button",{type:"button",className:Ve("deck-chip deck-chip--warn",n),onClick:e.connectThread,disabled:e.threadBusy,"aria-label":a,title:a,children:[t.jsx(ue,{}),n?t.jsx("span",{children:s}):null]})}function Ve(e,n){return n?e:`${e} deck-chip--icon`}function Be({model:e}){if(!e.settingsOpen)return null;const n=e.speechCatalog?.models.find(r=>r.id===e.speechModelId),s=e.speechCatalog?.voices.find(r=>r.id===e.speechVoiceId&&r.modelId===e.speechModelId),a=e.speechOutputPhase==="preparing"?"Synthesizing through Scout…":e.voice.output.speaking?"A reply is being spoken now.":"Ready for the next completed reply.";return t.jsxs("div",{className:"deck-sheet",role:"dialog","aria-label":"Audio and dictation settings",children:[t.jsxs("header",{children:[t.jsx("strong",{children:"Audio & dictation"}),t.jsx("button",{type:"button",className:"deck-chip",onClick:()=>e.setSettingsOpen(!1),children:"Close"})]}),t.jsxs("div",{className:"deck-sheet__row",children:[t.jsxs("div",{children:[t.jsx("strong",{children:"Spoken replies"}),t.jsx("small",{children:"Speak each completed Codex reply aloud."})]}),t.jsxs("button",{type:"button",className:"deck-toggle","data-on":e.voiceOutEnabled||void 0,onClick:e.toggleVoiceOutput,disabled:!e.voiceOutputAvailable,"aria-pressed":e.voiceOutEnabled,children:[t.jsx("i",{}),e.voiceOutEnabled?"On":"Off"]})]}),t.jsxs("div",{className:"deck-sheet__voice-grid","aria-label":"Scout speech provider and voice",children:[t.jsxs("label",{children:[t.jsx("span",{children:"Provider & model"}),t.jsx("select",{className:"deck-sheet__select",value:e.speechModelId,onChange:r=>e.selectSpeechModel(r.currentTarget.value),disabled:!e.cloudSpeechAvailable||!e.speechCatalog,children:e.speechCatalog?.models.filter(r=>ra(r.provider)).map(r=>t.jsxs("option",{value:r.id,disabled:!r.available,children:[on(r.provider)," · ",r.name,r.available?"":" · unavailable"]},r.id))??t.jsx("option",{children:e.speechCatalog?"No API models":"Loading Scout voices…"})})]}),t.jsxs("label",{children:[t.jsx("span",{children:"Voice"}),t.jsx("select",{className:"deck-sheet__select",value:e.speechVoiceId,onChange:r=>e.selectSpeechVoice(r.currentTarget.value),disabled:!e.cloudSpeechAvailable||!e.speechCatalog||e.speechCatalog.voices.length===0,children:e.speechCatalog?.voices.filter(r=>r.modelId===e.speechModelId&&r.available).map(r=>t.jsxs("option",{value:r.id,children:[r.name,r.language?` · ${r.language}`:""]},r.id))??t.jsx("option",{children:"Loading…"})})]})]}),t.jsxs("div",{className:"deck-sheet__pace",children:[t.jsxs("div",{children:[t.jsx("strong",{children:"Speaking pace"}),t.jsx("small",{children:"Applied by the selected Scout TTS provider."})]}),t.jsx("div",{className:"deck-segment",role:"group","aria-label":"Speaking pace",children:[[.85,"Calm"],[1,"Natural"],[1.15,"Brisk"]].map(([r,l])=>t.jsx("button",{type:"button","data-active":e.speechSpeed===r||void 0,"aria-pressed":e.speechSpeed===r,onClick:()=>e.selectSpeechSpeed(r),disabled:!e.cloudSpeechAvailable,children:l},l))})]}),t.jsxs("div",{className:"deck-sheet__row",children:[t.jsxs("div",{children:[t.jsx("strong",{children:"Stopping dictation sends"}),t.jsx("small",{children:"Off keeps the transcript in the composer for editing."})]}),t.jsxs("button",{type:"button",className:"deck-toggle","data-on":e.autoSendOnStop||void 0,onClick:e.toggleAutoSend,"aria-pressed":e.autoSendOnStop,children:[t.jsx("i",{}),e.autoSendOnStop?"On":"Off"]})]}),t.jsxs("div",{className:"deck-sheet__row",children:[t.jsxs("div",{children:[t.jsx("strong",{children:"Playback"}),t.jsx("small",{children:a})]}),t.jsxs("div",{className:"deck-sheet__playback",children:[t.jsxs("button",{type:"button",className:"deck-chip",onClick:e.previewSpeechVoice,disabled:!e.voiceOutputAvailable||e.speechOutputPhase!=="idle",children:[t.jsx(gt,{}),t.jsx("span",{children:"Hear voice"})]}),t.jsxs("button",{type:"button",className:"deck-chip deck-chip--warn",onClick:e.stopSpeaking,disabled:!e.voice.output.speaking,children:[t.jsx(Le,{}),t.jsx("span",{children:"Stop"})]})]})]}),t.jsxs("dl",{className:"deck-sheet__facts",children:[t.jsxs("div",{children:[t.jsx("dt",{children:"Voice in"}),t.jsx("dd",{children:e.voiceAvailable?e.voice.input.engine:"—"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Input"}),t.jsx("dd",{children:e.voiceAvailable?xt(e.voice.input.state):"—"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Voice out"}),t.jsx("dd",{children:n?on(n.provider):"Scout API"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Route"}),t.jsx("dd",{children:e.speechRoute?.voiceId??s?.name??e.speechVoiceId})]})]}),t.jsx("p",{className:"deck-sheet__note",children:"Scout owns both directions: Scout dictation in; OpenAI or ElevenLabs synthesis out through the paired host API."})]})}function on(e){return e.toLowerCase()==="openai"?"OpenAI":e.toLowerCase()==="elevenlabs"?"ElevenLabs":e.replace(/(^|[-_])([a-z])/g,(n,s,a)=>`${s?" ":""}${a.toUpperCase()}`)}function ra(e){const n=e.toLowerCase();return n==="openai"||n==="elevenlabs"}function ca({lane:e,index:n,model:s,onSelect:a}){const r=e.key===s.selected?.key;return t.jsxs("button",{type:"button",className:"deck-lane","data-active":r||void 0,"data-tone":r&&s.phaseTone!=="quiet"?s.phaseTone:le(e),onClick:()=>{s.selectLane(e),a?.()},"aria-pressed":r,children:[t.jsx("span",{className:"deck-lane__index",children:String(n+1).padStart(2,"0")}),t.jsxs("span",{className:"deck-lane__body",children:[t.jsx("strong",{children:e.name}),t.jsxs("small",{children:[e.hostName," · ",e.harness??"agent"," · ",Y(e.state).toLowerCase()]})]}),t.jsx("i",{className:"deck-lane__signal","aria-hidden":"true"})]})}function bt({model:e}){const{hosts:n}=e;return n.length===0?null:t.jsxs("div",{className:"deck-scope",role:"group","aria-label":"Agent lane scope",children:[n.length>1?t.jsxs("button",{type:"button",className:"deck-scope__key","data-active":e.hostScope==="all"||void 0,onClick:()=>e.selectHostScope("all"),"aria-pressed":e.hostScope==="all",children:[t.jsx("i",{"data-all":"true"}),"All hosts"]}):null,n.map(s=>t.jsxs("button",{type:"button",className:"deck-scope__key","data-state":s.state,"data-active":e.hostScope===s.id||void 0,onClick:()=>e.selectHostScope(s.id),disabled:s.state!=="connected","aria-pressed":e.hostScope===s.id,children:[t.jsx("i",{}),s.name]},s.id))]})}function _n({model:e,onPick:n}){return e.attention.length===0?t.jsx("p",{className:"deck-empty-note",children:"No lanes need intervention."}):t.jsx("div",{className:"deck-attention",children:e.attention.map(s=>t.jsxs("button",{type:"button",className:"deck-attention__row",onClick:()=>{e.selectLane(s),n?.()},children:[t.jsx("i",{"aria-hidden":"true"}),t.jsxs("span",{children:[t.jsx("strong",{children:s.name}),t.jsx("small",{children:s.events[0]?.text??"Needs review"})]})]},s.key))})}function oa({model:e,limit:n=9}){const{thread:s,adapterAvailable:a,threadBusy:r,threadError:l}=e;if(!a)return t.jsx(oe,{glyph:e.sessionBusy?"···":"CX",title:e.sessionError?"Codex did not start":e.sessionBusy?"Starting Codex":"Workspace is view-only",tone:e.sessionError?"error":void 0,children:e.sessionError??(e.sessionBusy?e.sessionLaunchAccepted?"Codex accepted the launch. Scout will switch Deck when its lane appears.":"Scout is launching a broker-managed Codex session.":e.canStartCodexSession?"This lane remains intact when Scout opens its controllable Codex session.":e.sessionStartUnavailableReason??"This workspace remains view-only.")});if(l)return t.jsxs(oe,{glyph:"!",title:"Session connection failed",tone:"error",children:[l,t.jsxs("button",{type:"button",className:"deck-chip deck-chip--warn",onClick:e.connectThread,disabled:r,children:[t.jsx(ue,{}),t.jsx("span",{children:"Retry controller"})]})]});if(!s)return t.jsx(oe,{glyph:"···",title:"Reading the Codex session",children:"Nothing is shown until the host returns a snapshot."});if(s.state==="disconnected")return t.jsxs(oe,{glyph:"CX",title:"Session is disconnected",children:["No turns are readable until Deck reconnects Scout's managed Codex session on the host.",t.jsxs("button",{type:"button",className:"deck-chip deck-chip--warn",onClick:e.connectThread,disabled:r,children:[t.jsx(ue,{}),t.jsx("span",{children:"Reconnect"})]})]});const u=hn(s,n);return u.length===0?t.jsx(oe,{glyph:"●",title:"Codex ready",tone:"connected",children:s.threadId?`Session ${z(s.threadId)} is ready. Start its first turn from the console.`:"The session is connected. Start its first turn from the console."}):t.jsx("div",{className:"deck-stream",children:u.map(p=>t.jsxs("article",{className:"deck-stream__row","data-role":p.role,"data-type":p.block.type,children:[t.jsxs("div",{className:"deck-stream__meta",children:[t.jsx("span",{children:p.role==="operator"?"YOU":p.block.type==="action"?"RUN":p.block.type==="reasoning"?"THINK":"CX"}),t.jsx("time",{children:de(p.at)})]}),t.jsxs("div",{className:"deck-stream__content",children:[t.jsx("strong",{children:Oe(p.block)}),dt(p.block)?t.jsx("p",{children:dt(p.block)}):null]}),t.jsx("span",{className:"deck-stream__status","data-live":p.status==="streaming"||void 0,children:p.status==="streaming"?"live":p.status})]},p.block.id))})}function la({lane:e}){return e.events.length===0?t.jsx(oe,{glyph:"·",title:"No recent activity",children:"Nothing has been observed on this lane recently."}):t.jsx("div",{className:"deck-stream",children:e.events.slice(0,8).map(n=>t.jsxs("article",{className:"deck-stream__row","data-kind":n.kind,children:[t.jsxs("div",{className:"deck-stream__meta",children:[t.jsx("span",{children:n.kind.toUpperCase()}),t.jsx("time",{children:de(n.at)})]}),t.jsxs("div",{className:"deck-stream__content",children:[t.jsx("strong",{children:n.text}),n.detail?t.jsx("p",{children:n.detail}):null]})]},n.id))})}function oe({glyph:e,title:n,tone:s,children:a}){return t.jsxs("div",{className:"deck-stream-empty","data-tone":s,children:[t.jsx("span",{className:"deck-stream-empty__glyph",children:e}),t.jsx("strong",{children:n}),t.jsx("p",{children:a})]})}function jt({model:e}){return t.jsxs("div",{className:"deck-tabs",role:"tablist","aria-label":"Lane view",children:[t.jsx("button",{type:"button",role:"tab","aria-selected":e.view==="thread",onClick:()=>e.setView("thread"),disabled:!e.adapterAvailable,children:"Session turns"}),t.jsx("button",{type:"button",role:"tab","aria-selected":e.view==="signal",onClick:()=>e.setView("signal"),children:"Lane signal"})]})}function St({model:e,limit:n}){return e.view==="signal"&&e.selected?t.jsx(la,{lane:e.selected}):t.jsx(oa,{model:e,limit:n})}function qe({model:e}){return t.jsxs("span",{className:"deck-connection","data-connection":e.connection,children:[t.jsx("i",{className:"deck-lamp"}),Qs(e.connection)]})}function da({model:e}){const n=e.selected;return n?t.jsxs("div",{className:"deck-identity",children:[t.jsx("h2",{children:n.name}),t.jsxs("p",{children:[t.jsx("span",{children:n.projectRoot??"Project unavailable"}),t.jsxs("em",{children:[n.hostName," · ",n.model??"default model"," · ",pe(n.transport)]})]})]}):null}function yt({model:e}){return t.jsxs("div",{className:"deck-standby",children:[t.jsx("i",{className:"deck-lamp"}),t.jsx("span",{className:"deck-kicker",children:"Deck standing by"}),t.jsx("h2",{children:e.connection==="error"?"Host unavailable":"Waiting for a connected host"}),t.jsx("p",{children:e.error??"Connect a trusted Scout host to populate live lanes and enable controls."}),t.jsx(bt,{model:e})]})}function ua({model:e}){const[n,s]=d.useState(()=>e.preview&&new URLSearchParams(window.location.search).get("palette")==="open"),[a,r]=d.useState(""),[l,u]=d.useState(0),p=d.useRef(null),k=e.selected,y=d.useMemo(()=>{const f=[{id:"start-codex",group:"Session",label:e.sessionBusy?"Starting Codex for this workspace":"Start Codex for this workspace",disabled:!e.canStartCodexSession,run:()=>{e.startCodexSession()}},{id:"talk",group:"Turn",label:e.voice.input.state==="listening"?"Stop dictation and send":"Talk to this session",hint:e.phase==="running"?"steers the running turn":"starts a turn",disabled:!e.canTalk,run:()=>{e.toggleVoiceInput()}},{id:"send",group:"Turn",label:e.phase==="running"?"Steer with composer text":"Send composer text",hint:"⌘↵",disabled:!e.canCompose||!e.command.trim(),run:()=>{e.submitTurn(e.command)}},{id:"stop",group:"Turn",label:"Interrupt the running turn",disabled:!e.canInterrupt||e.threadBusy,run:()=>{e.interruptThread()}},{id:"bind",group:"Session",label:e.phase==="failed"?"Retry the Codex connection":"Reconnect the Codex session",disabled:!e.canRebind||e.threadBusy,run:()=>{e.connectThread()}},{id:"refresh",group:"Session",label:"Re-read the session snapshot",disabled:!e.canRefresh,run:()=>{e.refreshSnapshot()}},{id:"view",group:"Session",label:e.view==="thread"?"Show lane signal":"Show session turns",run:()=>e.setView(e.view==="thread"?"signal":"thread")},{id:"voice-out",group:"Audio",label:e.voiceOutEnabled?"Mute spoken replies":"Speak replies aloud",disabled:!e.voiceOutputAvailable,run:()=>{e.toggleVoiceOutput()}},{id:"stop-speaking",group:"Audio",label:"Stop speaking now",disabled:!e.voice.output.speaking,run:()=>{e.stopSpeaking()}},{id:"auto-send",group:"Audio",label:e.autoSendOnStop?"Keep transcript in composer instead of sending":"Send when dictation stops",run:e.toggleAutoSend},{id:"audio",group:"Audio",label:"Open audio and dictation settings",run:()=>e.setSettingsOpen(!0)},{id:"ops",group:"Layout",label:"Switch to Ops (routed agent controller)",run:()=>e.setTreatment("ops")},{id:"yoke",group:"Layout",label:"Switch to Yoke (two-grip cockpit)",run:()=>e.setTreatment("yoke")},{id:"console",group:"Layout",label:"Switch to Console (fleet board)",run:()=>e.setTreatment("console")}];for(const[c,g]of e.scopedLanes.entries())f.push({id:`lane-${g.key}`,group:"Lanes",label:`${String(c+1).padStart(2,"0")} · ${g.name}`,hint:`${g.hostName} · ${Y(g.state).toLowerCase()}`,run:()=>e.selectLane(g)});for(const c of e.hosts)f.push({id:`scope-${c.id}`,group:"Lanes",label:`Scope to ${c.name}`,hint:c.state,disabled:c.state!=="connected",run:()=>e.selectHostScope(c.id)});return e.hosts.length>1&&f.push({id:"scope-all",group:"Lanes",label:"Scope to all hosts",run:()=>e.selectHostScope("all")}),f},[e]),m=d.useMemo(()=>{const f=a.trim().toLowerCase(),c=y.filter(g=>!g.disabled);return f?c.filter(g=>`${g.group} ${g.label} ${g.hint??""}`.toLowerCase().includes(f)):c},[y,a]);if(d.useEffect(()=>{u(0)},[a,n]),d.useEffect(()=>{n&&p.current?.focus()},[n]),d.useEffect(()=>{const f=c=>{if((c.metaKey||c.ctrlKey)&&c.key.toLowerCase()==="k"){c.preventDefault(),r(""),s(g=>!g);return}if(n){if(c.key==="Escape"){c.preventDefault(),s(!1);return}if(c.key==="ArrowDown"||c.key==="ArrowUp"){c.preventDefault(),u(g=>m.length===0?0:(g+(c.key==="ArrowDown"?1:-1)+m.length)%m.length);return}if(c.key==="Enter"){c.preventDefault();const g=m[l];if(!g)return;g.run(),s(!1)}}};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n,m,l]),!k)return t.jsx("div",{className:"brief brief--standby",children:t.jsx(yt,{model:e})});const U=ht(e.thread),E=!!e.thread?.threadId;return t.jsxs("div",{className:"brief",children:[t.jsxs("div",{className:"brief__column",children:[t.jsxs("header",{className:"brief__head",children:[t.jsxs("div",{className:"brief__head-top",children:[t.jsx(qe,{model:e}),t.jsxs("div",{className:"brief__head-keys",children:[t.jsx(kt,{model:e}),t.jsxs("button",{type:"button",className:"brief__jump",onClick:()=>{r(""),s(!0)},children:[t.jsxs("span",{children:[String(e.selectedIndex+1).padStart(2,"0")," / ",String(e.scopedLanes.length).padStart(2,"0")," lanes"]}),t.jsx(Re,{dir:"down"})]})]})]}),t.jsxs("span",{className:"deck-kicker brief__kicker","data-bound":E||void 0,children:[e.adapterAvailable?E?"Scout Codex session":"No session connected":e.sessionBusy?"Starting Codex":"Codex session not started"," · ",k.name," · ",k.hostName]}),t.jsx("h2",{children:E?U??"Untitled session":k.name}),t.jsxs("p",{className:"brief__meta",children:[e.thread?.threadId?`id ${z(e.thread.threadId)}`:"id —",e.thread?.turnId?` · turn ${z(e.thread.turnId)}`:""," · ",k.projectRoot??"project unavailable"," · ",k.model??"default model"," · ",pe(k.transport)]}),t.jsx(De,{model:e})]}),t.jsxs("div",{className:"brief__viewport",children:[t.jsxs("div",{className:"brief__viewport-head",children:[t.jsx(jt,{model:e}),e.canInterrupt?t.jsxs("button",{type:"button",className:"deck-stop",onClick:e.interruptThread,disabled:e.threadBusy||e.phase==="stopping",children:[t.jsx(Le,{}),t.jsx("span",{children:e.phase==="stopping"?"Stopping":"Stop turn"})]}):null]}),t.jsx("div",{className:"brief__viewport-body",children:t.jsx(St,{model:e,limit:14})})]}),t.jsxs("div",{className:"brief__dock",children:[t.jsxs("div",{className:"brief__dock-voice",children:[t.jsx(Me,{model:e,size:"lg"}),t.jsxs("div",{className:"brief__dock-trace",children:[t.jsx($e,{model:e}),t.jsx(Pe,{model:e})]}),t.jsxs("button",{type:"button",className:"brief__commands",onClick:()=>{r(""),s(!0)},"aria-haspopup":"dialog",children:["Commands",t.jsx("em",{children:"⌘K"})]})]}),t.jsx(vt,{model:e,rows:2})]})]}),n?t.jsx("div",{className:"brief__palette-scrim",onClick:()=>s(!1),children:t.jsxs("div",{className:"brief__palette",role:"dialog","aria-label":"Deck commands",onClick:f=>f.stopPropagation(),children:[t.jsx("input",{ref:p,value:a,onChange:f=>r(f.target.value),placeholder:"Run a command or jump to a lane…","aria-label":"Filter commands"}),t.jsxs("div",{className:"brief__palette-list",children:[m.length===0?t.jsx("p",{className:"deck-empty-note",children:"Nothing matches, and nothing was run."}):null,m.map((f,c)=>t.jsxs("button",{type:"button","data-active":c===l||void 0,onMouseEnter:()=>u(c),onClick:()=>{f.run(),s(!1)},children:[t.jsx("span",{className:"brief__palette-group","data-tone":f.group==="Lanes"?pa(e,f.id):void 0,children:f.group}),t.jsx("strong",{children:f.label}),f.hint?t.jsx("em",{children:f.hint}):null]},f.id))]}),t.jsx("footer",{children:"↑↓ move · ↵ run · esc close"})]})}):null,t.jsx(Be,{model:e})]})}function pa(e,n){const s=n.replace(/^lane-/,""),a=e.scopedLanes.find(r=>r.key===s);return a?le(a):void 0}function ha({model:e}){const n=e.selected;return t.jsxs("div",{className:"console",children:[t.jsxs("header",{className:"console__bar",children:[t.jsxs("div",{className:"console__bar-status",children:[t.jsx(qe,{model:e}),t.jsx(kn,{model:e,size:"md"})]}),t.jsx(De,{model:e,compact:!0}),t.jsxs("div",{className:"console__bar-controls",children:[t.jsx(bn,{model:e}),t.jsx(yn,{model:e}),t.jsx(Sn,{model:e}),t.jsx(kt,{model:e}),t.jsx(jn,{model:e}),t.jsx(Me,{model:e,size:"md"})]})]}),t.jsxs("div",{className:"console__body",children:[t.jsxs("aside",{className:"console__bank","aria-label":"Agent lanes",children:[t.jsxs("div",{className:"console__panel-head",children:[t.jsx("span",{className:"deck-kicker",children:"Lanes"}),t.jsxs("span",{className:"deck-kicker",children:[e.activeCount," live / ",e.scopedLanes.length]})]}),t.jsxs("div",{className:"console__lanes",children:[e.scopedLanes.map((s,a)=>t.jsx(ca,{lane:s,index:a,model:e},s.key)),e.scopedLanes.length===0?t.jsx("p",{className:"deck-empty-note",children:"No lanes in this scope."}):null]}),t.jsx(bt,{model:e})]}),t.jsx("section",{className:"console__stage",children:n?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"console__stage-head",children:[t.jsx(da,{model:e}),t.jsxs("div",{className:"console__meter","aria-label":"Lane activity over the last five minutes",children:[t.jsx("small",{children:"5m"}),t.jsx("div",{"aria-hidden":"true",children:e.laneActivity.map((s,a)=>t.jsx("i",{style:{"--level":s}},a))}),t.jsx("small",{children:"now"})]})]}),t.jsxs("div",{className:"console__viewport",children:[t.jsxs("div",{className:"console__panel-head",children:[t.jsx(jt,{model:e}),t.jsxs("span",{className:"deck-kicker",children:[n.hostName," / ",n.id]})]}),t.jsx("div",{className:"console__viewport-body",children:t.jsx(St,{model:e,limit:12})})]}),t.jsxs("div",{className:"console__dock",children:[t.jsx($e,{model:e}),t.jsx(Pe,{model:e}),t.jsx(vt,{model:e,rows:2})]})]}):t.jsx(yt,{model:e})}),t.jsxs("aside",{className:"console__rail","aria-label":"Session readout",children:[t.jsxs("div",{className:"console__panel-head",children:[t.jsx("span",{className:"deck-kicker",children:"Readout"}),t.jsx("span",{className:"deck-kicker",children:e.preview?"Sample":e.adapterAvailable?"Native":"—"})]}),t.jsxs("dl",{className:"console__readout",children:[t.jsxs("div",{children:[t.jsx("dt",{children:"Source"}),t.jsx("dd",{children:e.preview?"sample data":"paired host"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Bridge"}),t.jsx("dd",{children:ea(e.connection)})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Session"}),t.jsx("dd",{children:e.thread?.threadId?z(e.thread.threadId):e.sessionBusy?"starting":e.adapterAvailable?"disconnected":"—"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Turn"}),t.jsx("dd",{children:e.thread?.turnId?z(e.thread.turnId):"none"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Voice in"}),t.jsx("dd",{children:e.voiceAvailable?xt(e.voice.input.state):"—"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Voice out"}),t.jsx("dd",{children:e.voiceOutputAvailable?e.voice.output.speaking?"speaking":e.voiceOutEnabled?"armed":"off":"—"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Queue"}),t.jsx("dd",{title:e.thread?.capabilityNotes.queue,children:e.adapterAvailable?"off":"—"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Approval"}),t.jsx("dd",{title:e.thread?.capabilityNotes.approvals,children:e.adapterAvailable?"off":"—"})]})]}),t.jsxs("div",{className:"console__panel-head",children:[t.jsx("span",{className:"deck-kicker",children:"Attention"}),t.jsx("span",{className:"deck-kicker",children:String(e.attention.length).padStart(2,"0")})]}),t.jsx(_n,{model:e}),t.jsxs("div",{className:"console__panel-head",children:[t.jsx("span",{className:"deck-kicker",children:"Fleet"}),t.jsx("span",{className:"deck-kicker",children:String(e.hosts.length).padStart(2,"0")})]}),t.jsx("div",{className:"console__fleet",children:e.hosts.map(s=>t.jsxs("div",{className:"console__fleet-row",children:[t.jsx("i",{"data-state":s.state}),t.jsxs("span",{children:[t.jsx("strong",{children:s.name}),t.jsxs("small",{children:[e.lanes.filter(a=>a.hostId===s.id).length," lanes"]})]}),t.jsx("em",{children:s.state})]},s.id))})]})]}),t.jsx(Be,{model:e})]})}function fa({model:e}){const n=e.selected,s=n?e.scopedLanes.findIndex(c=>c.key===n.key)+1:0,a=d.useMemo(()=>e.scopedLanes.flatMap((c,g)=>c.events.map(J=>({id:`${c.key}:${J.id}`,at:J.at,channel:g+1,lane:c,text:J.text,detail:J.detail??""}))).sort((c,g)=>g.at-c.at).slice(0,16),[e.scopedLanes]),r=d.useMemo(()=>n?e.view==="signal"||!e.thread?n.events.slice(0,5).reverse().map(c=>({id:c.id,label:c.kind.toUpperCase(),text:c.text,detail:c.detail??"",at:c.at,live:le(n)==="live"&&c.id===n.events[0]?.id})):hn(e.thread,5).map(c=>({id:c.block.id,label:c.role==="operator"?"YOU":c.block.type==="action"?"RUN":c.block.type==="reasoning"?"THINK":"CX",text:Oe(c.block),detail:dt(c.block),at:c.at,live:c.status==="streaming"})):[],[n,e.thread,e.view]),u=["all",...e.hosts.filter(c=>c.state==="connected").map(c=>c.id)],p=Math.max(0,u.indexOf(e.hostScope)),k=u[(p+1)%Math.max(1,u.length)]??"all",y=e.hostScope==="all"?"All hosts":e.hosts.find(c=>c.id===e.hostScope)?.name??e.hostScope;if(!n)return t.jsx("div",{className:"ops ops--standby",children:t.jsxs("div",{className:"ops__standby",children:[t.jsx(qe,{model:e}),t.jsx("strong",{children:"No agent channels are available"}),t.jsx("p",{children:e.error??"Waiting for a connected host to publish its Scout lanes."})]})});const m=ht(e.thread),U=e.connection==="ready"?"ONLINE":e.connection==="partial"?"DEGRADED":e.connection.toUpperCase(),E=e.preview?"SIMULATED":e.sessionBusy?"STARTING CODEX":e.adapterAvailable?e.thread?.threadId&&(e.connection==="ready"||e.connection==="partial")?"LIVE":e.connection==="ready"||e.connection==="partial"?"SESSION OFFLINE":"OFFLINE":e.canStartCodexSession?"READY TO START":"VIEW ONLY",f=e.preview?"8 SIMULATED CONTROLS":e.connection==="ready"||e.connection==="partial"?"8 HOST CONTROLS":"CONTROLS OFFLINE";return t.jsxs("div",{className:"ops",children:[t.jsx("section",{className:"ops__channels","aria-label":"Agent channels",children:e.scopedLanes.map((c,g)=>t.jsx(xa,{lane:c,index:g,active:c.key===n.key,model:e},c.key))}),t.jsxs("section",{className:"ops__voice","aria-label":"Routed voice control",children:[t.jsx(Me,{model:e,size:"md"}),t.jsx($e,{model:e}),t.jsxs("div",{className:"ops__voice-copy",children:[t.jsx("strong",{children:fn(e.primaryAction,e.phase,e.voice.input.state,e.sessionStartUnavailableReason).toUpperCase()}),t.jsx(Pe,{model:e})]}),t.jsxs("div",{className:"ops__routes",role:"group","aria-label":"Route dictation to agent channel",children:[t.jsx("span",{children:"ROUTE TO"}),t.jsx("div",{children:e.scopedLanes.map((c,g)=>t.jsxs("button",{type:"button","data-active":c.key===n.key||void 0,onClick:()=>e.selectLane(c),"aria-pressed":c.key===n.key,children:["CH ",g+1]},c.key))})]})]}),t.jsxs("section",{className:"ops__enclosure",children:[t.jsxs("header",{className:"ops__enclosure-head",children:[t.jsxs("span",{className:"ops__host",children:[t.jsx("i",{"data-tone":e.phaseTone}),n.hostName]}),t.jsxs("span",{className:"ops__binding",children:[e.adapterAvailable?"SCOUT APP-SERVER":pe(n.transport).toUpperCase(),t.jsx("i",{children:"·"}),m??n.projectRoot??"NO SESSION"]})]}),t.jsxs("div",{className:"ops__workspace",children:[t.jsxs("article",{className:"ops__console",children:[t.jsxs("header",{children:[t.jsx("span",{children:"agent console"}),t.jsx("strong",{"data-tone":e.phaseTone,children:pt(e.phase,n.state)})]}),t.jsxs("div",{className:"ops__agent-line",children:[t.jsx("h2",{children:n.name}),t.jsxs("span",{children:["CH ",String(s).padStart(2,"0")," · ",n.hostName.toUpperCase()]})]}),t.jsx("p",{className:"ops__task",title:m??void 0,children:m??(e.adapterAvailable?"No Codex session connected":e.sessionBusy?"Starting Codex for this workspace…":"Start Codex to control this workspace")}),t.jsx(De,{model:e,compact:!0}),t.jsx("div",{className:"ops__console-rows","data-view":e.view,children:r.length>0?r.map(c=>t.jsxs("div",{className:"ops__console-row","data-live":c.live||void 0,children:[t.jsx("i",{}),t.jsx("span",{children:c.label}),t.jsxs("p",{children:[t.jsx("strong",{children:c.text}),c.detail?t.jsx("small",{children:c.detail}):null]}),t.jsx("time",{children:de(c.at)})]},c.id)):t.jsxs("p",{className:"ops__empty",children:["No ",e.view==="thread"?"session turns":"lane signal"," reported yet."]})}),t.jsxs("form",{className:"ops__composer",onSubmit:e.onComposerSubmit,children:[t.jsx("span",{"aria-hidden":"true",children:"›"}),t.jsx("input",{value:e.command,onChange:c=>e.setCommand(c.target.value),placeholder:xn(e.phase,e.voice.input.state),disabled:!e.canCompose,"aria-label":e.phase==="running"?"Steer the active Codex turn":"Start a Codex turn"}),t.jsx("button",{type:"submit",disabled:!e.canCompose||!e.command.trim(),children:e.phase==="running"?"Steer":"Send"})]}),t.jsxs("div",{className:"ops__console-actions",children:[e.canRebind?t.jsxs("button",{type:"button",onClick:e.connectThread,disabled:e.threadBusy,children:[t.jsx(ue,{}),e.phase==="failed"?"Retry link":"Reconnect"]}):null,t.jsxs("button",{type:"button",onClick:e.refreshSnapshot,disabled:!e.canRefresh,children:[t.jsx(ut,{}),"Re-read"]}),e.canInterrupt?t.jsxs("button",{type:"button",className:"ops__danger",onClick:e.interruptThread,disabled:e.threadBusy,children:[t.jsx(Le,{}),e.phase==="stopping"?"Stopping":"Stop turn"]}):null]}),t.jsxs("footer",{children:[t.jsxs("span",{children:["MODEL ",t.jsx("strong",{children:n.model??"DEFAULT"})]}),t.jsxs("span",{children:["CONTROL ",t.jsx("strong",{children:E})]}),t.jsxs("span",{title:e.thread?.threadId??void 0,children:["SESSION ",t.jsx("strong",{children:e.thread?.threadId?z(e.thread.threadId):"—"})]})]})]}),t.jsxs("aside",{className:"ops__feed",children:[t.jsxs("header",{children:[t.jsx("span",{children:"fleet feed"}),t.jsxs("strong",{children:[e.hostScope==="all"?"ALL HOSTS":y.toUpperCase()," · ",a.length," EVENTS"]})]}),t.jsx("div",{className:"ops__feed-rows",children:a.length>0?a.map(c=>t.jsxs("button",{type:"button","data-active":c.lane.key===n.key||void 0,"data-tone":le(c.lane),onClick:()=>e.selectLane(c.lane),"aria-label":`Channel ${c.channel}, ${c.lane.name}: ${c.text}`,children:[t.jsx("time",{children:de(c.at)}),t.jsxs("span",{children:["CH ",c.channel]}),t.jsx("strong",{children:c.lane.name.toUpperCase()}),t.jsxs("p",{children:[c.text,c.detail?t.jsx("small",{children:c.detail}):null]})]},c.id)):t.jsx("p",{className:"ops__empty",children:"No fleet activity reported yet."})})]})]})]}),t.jsxs("section",{className:"ops__commands","aria-label":"Deck commands",children:[t.jsxs("header",{children:[t.jsx("span",{children:"COMMANDS"}),t.jsx("strong",{children:f})]}),t.jsxs("div",{className:"ops__command-grid",children:[t.jsx(G,{ordinal:"01",label:e.primaryAction==="start_codex"?"Start Codex":"Voice",meta:e.primaryAction==="start_codex"?e.sessionBusy?"Starting":"Workspace":xt(e.voice.input.state),icon:e.primaryAction==="start_codex"?t.jsx(ue,{}):t.jsx(gn,{}),active:e.voiceInputActive,disabled:e.primaryAction==="start_codex"?!e.canStartCodexSession:e.primaryAction==="connect"?e.threadBusy:!e.canTalk,onClick:e.onPrimary}),t.jsx(G,{ordinal:"02",label:"Session turns",meta:"Codex session",glyph:"◎",active:e.view==="thread",disabled:!e.adapterAvailable,onClick:()=>e.setView("thread")}),t.jsx(G,{ordinal:"03",label:"Lane signal",meta:"Scout tail",glyph:"≋",active:e.view==="signal",onClick:()=>e.setView("signal")}),t.jsx(G,{ordinal:"04",label:"Re-read",meta:"Session snapshot",icon:t.jsx(ut,{}),disabled:!e.canRefresh,onClick:()=>{e.refreshSnapshot()}}),t.jsx(G,{ordinal:"05",label:e.voiceOutEnabled?"Voice out":"Muted",meta:e.voice.output.speaking?"Speaking":e.voiceOutEnabled?"Armed":"Off",icon:t.jsx(gt,{}),active:e.voiceOutEnabled,disabled:!e.voiceOutputAvailable,onClick:()=>{e.toggleVoiceOutput()}}),t.jsx(G,{ordinal:"06",label:"Audio",meta:"Dictation",icon:t.jsx(vn,{}),active:e.settingsOpen,onClick:()=>e.setSettingsOpen(!e.settingsOpen)}),t.jsx(G,{ordinal:"07",label:"Host scope",meta:y,glyph:"⌾",disabled:u.length<2,onClick:()=>e.selectHostScope(k)}),t.jsx(G,{ordinal:"08",label:"Next lane",meta:`${s} / ${e.scopedLanes.length}`,icon:t.jsx(Re,{dir:"right"}),disabled:e.scopedLanes.length<2,onClick:()=>e.stepLane(1)})]})]}),t.jsxs("footer",{className:"ops__status",children:[t.jsxs("span",{className:"ops__status-online","data-connection":e.connection,children:[t.jsx("i",{}),U]}),t.jsx("span",{children:n.hostName}),t.jsxs("span",{children:["ROUTE ",t.jsxs("strong",{children:["CH ",s]})]}),e.attention.length>0?t.jsxs("span",{className:"ops__status-attn",children:["ATTN ",e.attention.length]}):null,t.jsxs("span",{children:["HOSTS ",t.jsx("strong",{children:e.hosts.length})]}),t.jsxs("span",{children:["LIVE ",t.jsx("strong",{children:e.activeCount})]}),t.jsxs("span",{children:["VIEW · ",t.jsx("strong",{children:"OPS"})]})]}),t.jsx(Be,{model:e})]})}function xa({lane:e,index:n,active:s,model:a}){const r=e.events[0],l=s&&a.phaseTone!=="quiet"?a.phaseTone:le(e);return t.jsxs("button",{type:"button",className:"ops-channel","data-active":s||void 0,"data-tone":l,onClick:()=>a.selectLane(e),"aria-pressed":s,"aria-label":`Channel ${n+1}, ${e.name}, ${Y(e.state)}`,children:[t.jsxs("span",{className:"ops-channel__head",children:[t.jsxs("small",{children:["CH ",String(n+1).padStart(2,"0")]}),t.jsx("em",{"aria-hidden":"true",children:"▰"}),t.jsx("strong",{children:e.hostName}),t.jsx("i",{}),t.jsx("small",{children:s?pt(a.phase,e.state):Y(e.state)})]}),t.jsx("span",{className:"ops-channel__rule"}),t.jsxs("span",{className:"ops-channel__identity",children:[t.jsx("strong",{children:e.name}),t.jsxs("small",{children:[e.harness??"agent"," · ",e.model??"default"]})]}),t.jsx("span",{className:"ops-channel__task",children:r?.text??e.projectRoot??"No recent activity"}),t.jsxs("span",{className:"ops-channel__signal",children:[t.jsx("i",{}),t.jsx("small",{children:r?.detail||(s?"controller selected":"tap to put on deck")}),t.jsx("time",{children:de(r?.at??e.updatedAt)})]}),t.jsxs("span",{className:"ops-channel__foot",children:[t.jsxs("strong",{children:[t.jsx("i",{}),s?"ON DECK":"TAP TO SWITCH"]}),t.jsx("small",{children:pe(e.transport).toUpperCase()})]})]})}function G({ordinal:e,label:n,meta:s,glyph:a,icon:r,active:l,disabled:u=!1,onClick:p}){return t.jsxs("button",{type:"button",className:"ops-command","data-active":l||void 0,disabled:u,onClick:p,"aria-pressed":l??void 0,title:`${n} · ${s}`,children:[t.jsx("span",{className:"ops-command__icon",children:r??a}),t.jsxs("span",{children:[t.jsx("strong",{children:n}),t.jsxs("small",{children:[e," · ",s.toUpperCase()]})]})]})}function ga({model:e}){const n=e.selected;if(!n)return t.jsx("div",{className:"yoke yoke--standby",children:t.jsx(yt,{model:e})});const s=e.scopedLanes.length,a=Math.max(1,e.selectedIndex+1);return t.jsxs("div",{className:"yoke",children:[t.jsxs("div",{className:"yoke__grip yoke__grip--left",children:[t.jsx(Me,{model:e,size:"xl"}),t.jsx($e,{model:e}),t.jsx(bn,{model:e,block:!0}),t.jsxs("div",{className:"yoke__stepper",role:"group","aria-label":"Lane navigation",children:[t.jsx("button",{type:"button",onClick:()=>e.stepLane(-1),disabled:s<2,"aria-label":"Previous lane",children:t.jsx(Re,{dir:"left"})}),t.jsxs("span",{children:[t.jsx("strong",{children:String(a).padStart(2,"0")}),t.jsxs("small",{children:["of ",String(s).padStart(2,"0")]})]}),t.jsx("button",{type:"button",onClick:()=>e.stepLane(1),disabled:s<2,"aria-label":"Next lane",children:t.jsx(Re,{dir:"right"})})]}),t.jsx("div",{className:"yoke__ladder",role:"group","aria-label":"Lane ladder",children:e.scopedLanes.map((r,l)=>t.jsxs("button",{type:"button","data-active":r.key===n.key||void 0,"data-tone":le(r),onClick:()=>e.selectLane(r),"aria-pressed":r.key===n.key,"aria-label":`${r.name} on ${r.hostName} — ${Y(r.state)}`,title:`${r.name} · ${r.hostName} · ${Y(r.state)}`,children:[t.jsx("span",{children:String(l+1).padStart(2,"0")}),t.jsx("i",{"aria-hidden":"true"})]},r.key))}),t.jsxs("div",{className:"yoke__grip-keys",children:[t.jsx(kt,{model:e}),t.jsx(jn,{model:e})]}),t.jsxs("div",{className:"yoke__grip-foot",children:[t.jsx("span",{className:"deck-kicker",children:"Lane traffic"}),t.jsx(ia,{model:e})]})]}),t.jsxs("section",{className:"yoke__stage",children:[t.jsxs("header",{className:"yoke__head",children:[t.jsx("div",{className:"yoke__head-task",children:t.jsx(kn,{model:e,size:"lg"})}),t.jsxs("div",{className:"yoke__head-lane",children:[t.jsx("h2",{children:n.name}),t.jsx("p",{children:n.projectRoot??"Project unavailable"})]})]}),t.jsx(De,{model:e}),t.jsxs("div",{className:"yoke__viewport",children:[t.jsxs("div",{className:"yoke__viewport-head",children:[t.jsx(jt,{model:e}),t.jsxs("span",{className:"deck-kicker",children:[n.hostName," / ",n.id]})]}),t.jsx("div",{className:"yoke__viewport-body",children:t.jsx(St,{model:e,limit:10})})]}),t.jsxs("div",{className:"yoke__dock",children:[t.jsx(Pe,{model:e}),t.jsx(vt,{model:e,rows:2})]})]}),t.jsxs("aside",{className:"yoke__grip yoke__grip--right","aria-label":"Session status",children:[t.jsxs("div",{className:"yoke__status",children:[t.jsx(qe,{model:e}),t.jsxs("dl",{children:[t.jsxs("div",{children:[t.jsx("dt",{children:"Lane state"}),t.jsx("dd",{children:Y(n.state)})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Harness"}),t.jsx("dd",{children:n.harness??"unknown"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Model"}),t.jsx("dd",{children:n.model??"default"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Transport"}),t.jsx("dd",{title:pe(n.transport),children:Zs(n.transport)})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Live lanes"}),t.jsxs("dd",{children:[e.activeCount," of ",s]})]})]})]}),t.jsxs("div",{className:"yoke__grip-keys",children:[t.jsx(Sn,{model:e}),t.jsx(yn,{model:e})]}),t.jsxs("div",{className:"yoke__attention",children:[t.jsxs("span",{className:"deck-kicker",children:["Needs you · ",String(e.attention.length).padStart(2,"0")]}),t.jsx(_n,{model:e})]}),t.jsxs("div",{className:"yoke__scope",children:[t.jsx("span",{className:"deck-kicker",children:"Host scope"}),t.jsx(bt,{model:e})]})]}),t.jsx(Be,{model:e})]})}function Sa(){const e=Vs(),n=e.hosts.find(a=>a.state==="connected"),s=e.preview?{state:"preview",label:"PREVIEW",detail:"sample lanes · controls simulate locally"}:e.connection==="ready"||e.connection==="partial"?{state:e.connection==="ready"?"live":"partial",label:e.connection==="ready"?"LIVE":"DEGRADED",detail:`${n?.name??"host"} · Scout-managed Codex control`}:{state:"offline",label:"OFFLINE",detail:"no host connected"};return t.jsxs("main",{className:"scout-deck","data-connection":e.connection,"data-treatment":e.treatment,"data-preview":e.preview||void 0,children:[t.jsxs("header",{className:"scout-deck__strip",children:[t.jsxs("div",{className:"scout-deck__brand",children:[e.treatment==="ops"?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"scout-deck__ops-brand",children:[t.jsx("strong",{children:"SCOUT"}),t.jsx("i",{children:"·"}),t.jsx("small",{children:"OPS"})]}),t.jsxs("span",{className:"scout-deck__ops-mode",children:[t.jsx("i",{}),"AGENT DECK"]})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"scout-deck__mark","aria-hidden":"true",children:"S"}),t.jsxs("span",{className:"scout-deck__wordmark",children:[t.jsx("strong",{children:"Deck"}),t.jsx("small",{children:ct[e.treatment].tagline})]})]}),t.jsxs("span",{className:"scout-deck__source","data-state":s.state,title:e.preview?"Every lane, thread, and turn on screen is local sample data. No host is attached.":s.detail,children:[t.jsx("strong",{children:s.label}),t.jsx("small",{children:s.detail})]})]}),e.treatment==="ops"?t.jsxs("span",{className:"scout-deck__ops-count",children:[e.hosts.length," HOST",e.hosts.length===1?"":"S"," · ",e.scopedLanes.length," AGENT",e.scopedLanes.length===1?"":"S"]}):null,t.jsx(aa,{model:e})]}),e.treatment==="ops"?t.jsx(fa,{model:e}):e.treatment==="console"?t.jsx(ha,{model:e}):e.treatment==="brief"?t.jsx(ua,{model:e}):t.jsx(ga,{model:e})]})}export{Sa as ScoutDeckSurface,Bs as buildDeckLanes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r}from"./index-
|
|
1
|
+
import{j as r}from"./index-Bli6bTLU.js";function o({children:e}){return r.jsx("div",{style:{background:"var(--bg)",color:"var(--ink)",minHeight:"100%",height:"100%",display:"flex",flexDirection:"column"},children:r.jsx("div",{className:"scout-surface-body",children:e})})}export{o as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as t}from"./index-
|
|
1
|
+
import{r as l,j as t}from"./index-Bli6bTLU.js";import{D as O,d as le,V as G,p as ne,a as ae}from"./fx-z37u1o2z.js";const re=[{title:"Tone (band-pass)",sliders:[{key:"lowCutHz",label:"Low cut",min:80,max:1200,step:10,format:s=>`${s.toFixed(0)} Hz`},{key:"highCutHz",label:"High cut",min:1500,max:6e3,step:50,format:s=>`${s.toFixed(0)} Hz`},{key:"bandQ",label:"Filter Q",min:.2,max:2,step:.05,format:s=>s.toFixed(2)}]},{title:"Grit (saturation + bit-crush)",sliders:[{key:"saturationAmount",label:"Saturation",min:0,max:1,step:.01,format:s=>s.toFixed(2)},{key:"bitcrushAmount",label:"Bit-crush",min:0,max:1,step:.01,format:s=>s.toFixed(2)}]},{title:"Carrier hiss",sliders:[{key:"hissGain",label:"Hiss level",min:0,max:.25,step:.005,format:s=>s.toFixed(3)},{key:"hissCutoffHz",label:"Hiss high-pass",min:300,max:4e3,step:50,format:s=>`${s.toFixed(0)} Hz`}]},{title:"Presence (mid-band peak — comm intelligibility)",sliders:[{key:"presencePeakDb",label:"Boost",min:0,max:12,step:.5,format:s=>`${s.toFixed(1)} dB`},{key:"presenceCenterHz",label:"Center",min:600,max:3e3,step:50,format:s=>`${s.toFixed(0)} Hz`},{key:"presenceQ",label:"Q (narrowness)",min:.3,max:3,step:.1,format:s=>s.toFixed(1)}]},{title:"Squelch tail (channel-drop noise)",sliders:[{key:"squelchTailGain",label:"Tail gain",min:0,max:.3,step:.005,format:s=>s.toFixed(3)},{key:"squelchTailDurationMs",label:"Tail length",min:40,max:500,step:10,format:s=>`${s.toFixed(0)} ms`}]},{title:"Compressor",sliders:[{key:"compressorThresholdDb",label:"Threshold",min:-60,max:0,step:1,format:s=>`${s.toFixed(0)} dB`},{key:"compressorRatio",label:"Ratio",min:1,max:12,step:.5,format:s=>`${s.toFixed(1)} : 1`}]},{title:"Delivery",sliders:[{key:"playbackRate",label:"Speed (pitch-shifts)",min:.75,max:1.35,step:.01,format:s=>`${s.toFixed(2)}×`}]},{title:"Kerchunk / output",sliders:[{key:"clickGain",label:"Click gain",min:0,max:1,step:.01,format:s=>s.toFixed(2)},{key:"clickDurationMs",label:"Click length",min:20,max:200,step:5,format:s=>`${s.toFixed(0)} ms`},{key:"outputGain",label:"Output gain",min:0,max:2,step:.05,format:s=>s.toFixed(2)},{key:"wetMix",label:"Wet mix",min:0,max:1,step:.01,format:s=>s.toFixed(2)}]}],B=.12,ie=s=>Math.max(.7,Math.min(1.45,s)),ce=220,w={...O,lowCutHz:160,highCutHz:5200,bandQ:.35,saturationAmount:.035,bitcrushAmount:0,hissGain:0,hissCutoffHz:1800,presencePeakDb:1.5,presenceCenterHz:1500,presenceQ:.65,compressorThresholdDb:-15,compressorRatio:2.2,clickEnabled:!0,clickGain:.24,clickDurationMs:45,squelchTailEnabled:!0,squelchTailGain:.018,squelchTailDurationMs:95,playbackRate:1,outputGain:1,wetMix:.38},de={...w,lowCutHz:190,highCutHz:5e3,saturationAmount:.055,bitcrushAmount:.01,hissGain:.006,presencePeakDb:2.5,compressorThresholdDb:-17,compressorRatio:2.8,clickGain:.28,squelchTailGain:.024,squelchTailDurationMs:105,wetMix:.44};function ue(s){return`const SCOUTBOT_VOICE_FX: Partial<VoiceFxParams> = {
|
|
2
2
|
${Object.entries(s).map(([x,u])=>` ${x}: ${typeof u=="number"?Number(u.toFixed(3)):String(u)},`).join(`
|
|
3
3
|
`)}
|
|
4
4
|
};`}function Xe(){const[s,D]=l.useState(null),[x,u]=l.useState(null),[j,X]=l.useState({}),[a,i]=l.useState(w),[U,c]=l.useState(null),[E,C]=l.useState(null),[N,F]=l.useState(null),[p,Q]=l.useState(!1),[f,K]=l.useState(!1),b=l.useRef(null),d=l.useRef(null),m=l.useRef(a),P=l.useRef(p),A=l.useRef(f);l.useEffect(()=>{m.current=a},[a]),l.useEffect(()=>{P.current=p},[p]),l.useEffect(()=>{A.current=f},[f]),l.useEffect(()=>{let e=!1;return(async()=>{try{const o=await fetch("/api/dev/scoutbot-fx/fixtures");if(!o.ok)throw new Error(`HTTP ${o.status}`);const n=await o.json();e||D(n)}catch(o){e||u(o instanceof Error?o.message:String(o))}})(),()=>{e=!0}},[]);const H=l.useCallback(async e=>{if(j[e.slug])return j[e.slug].buffer;const o=await le(`/api/dev/scoutbot-fx/audio/${encodeURIComponent(e.file)}`);return X(n=>({...n,[e.slug]:{fixture:e,buffer:o}})),o},[j]),h=l.useCallback(()=>{d.current=null,b.current?.stop(),b.current=null,C(null)},[]),Y=l.useCallback(e=>{const o=G.find(n=>n.id===e);o&&(i(o.params),c(e))},[]),J=l.useCallback(async()=>{try{await navigator.clipboard.writeText(ue(a)),F("Copied"),window.setTimeout(()=>F(null),1600)}catch(e){F(e instanceof Error?e.message:"Copy failed")}},[a]),g=l.useCallback(async(e,o)=>{h();const n=Symbol(`${o}:${e.slug}`);d.current=n;const S=`${o}:${e.slug}`;try{const r=await H(e);for(;d.current===n;){const v=A.current?{...m.current,playbackRate:ie(m.current.playbackRate+(Math.random()*2-1)*B)}:m.current,I=o==="fx"?ne(r,{params:v}):ae(r);if(b.current=I,C(S),await I.promise,d.current!==n||!P.current)break;await new Promise(M=>{const se=setTimeout(M,ce),oe=setInterval(()=>{d.current!==n&&(clearTimeout(se),clearInterval(oe),M())},40)})}}catch(r){console.error(`[scoutbot-fx] ${o} playback failed`,r)}finally{d.current===n&&(d.current=null),b.current=null,C(r=>r===S?null:r)}},[H,h]),Z=l.useCallback(e=>g(e,"fx"),[g]),ee=l.useCallback(e=>g(e,"dry"),[g]),te=l.useMemo(()=>re.map(e=>({title:e.title,rows:e.sliders.map(o=>({spec:o,value:a[o.key]}))})),[a]),$=s?.fixtures??[];return t.jsxs("div",{style:pe,children:[t.jsxs("header",{style:ye,children:[t.jsxs("div",{children:[t.jsx("h1",{style:xe,children:"Scoutbot FX Lab"}),t.jsxs("p",{style:fe,children:["Dispatcher-radio FX prototyping. Generate fixtures with"," ",t.jsx("code",{style:L,children:"node packages/web/scripts/generate-scoutbot-fx-fixtures.mjs"}),"."]})]}),t.jsxs("div",{style:be,children:[s?.generatedAt?t.jsxs("span",{children:["Fixtures generated ",new Date(s.generatedAt).toLocaleString()]}):null,s?.note?t.jsx("span",{style:me,children:s.note}):null,x?t.jsxs("span",{style:he,children:["Could not load fixtures: ",x]}):null]})]}),t.jsxs("section",{style:ge,children:[t.jsxs("div",{style:T,children:[t.jsx("h2",{style:R,children:"Presets"}),t.jsx("div",{style:Se,children:"Click to load. Tweaking any slider clears the active preset."})]}),t.jsx("div",{style:ke,children:G.map(e=>{const o=U===e.id;return t.jsxs("button",{type:"button",style:o?je:q,onClick:n=>{Y(e.id),n.currentTarget.blur()},title:e.description,children:[t.jsxs("div",{style:o?Ce:V,children:[e.label,t.jsx("span",{style:ve,children:e.family})]}),t.jsx("div",{style:o?Fe:W,children:e.description})]},e.id)})})]}),t.jsxs("section",{style:Te,children:[t.jsxs("div",{style:T,children:[t.jsx("h2",{style:R,children:"FX chain"}),t.jsxs("div",{style:{display:"flex",gap:8},children:[t.jsxs("label",{style:k,children:[t.jsx("input",{type:"checkbox",checked:a.clickEnabled,onChange:e=>{const o=e.target.checked;c(null),i(n=>({...n,clickEnabled:o}))}}),"Kerchunk click"]}),t.jsxs("label",{style:k,children:[t.jsx("input",{type:"checkbox",checked:a.squelchTailEnabled,onChange:e=>{const o=e.target.checked;c(null),i(n=>({...n,squelchTailEnabled:o}))}}),"Squelch tail"]}),t.jsx("button",{type:"button",style:y,onClick:()=>{c("scoutbot-clean-dispatch"),i(w)},children:"Scoutbot default"}),t.jsx("button",{type:"button",style:y,onClick:()=>{c("codex-clean-dispatch"),i(de)},children:"Codex take"}),t.jsx("button",{type:"button",style:y,onClick:()=>{c(null),i(O)},children:"Raw default"}),t.jsx("button",{type:"button",style:z,onClick:()=>{J()},children:N??"Copy params"})]})]}),t.jsx("div",{style:Re,children:te.map(e=>t.jsxs("div",{style:we,children:[t.jsx("div",{style:ze,children:e.title}),t.jsx("div",{style:De,children:e.rows.map(({spec:o,value:n})=>t.jsxs("label",{style:Ee,children:[t.jsxs("div",{style:Pe,children:[t.jsx("span",{children:o.label}),t.jsx("span",{style:Ae,children:o.format(n)})]}),t.jsx("input",{type:"range",min:o.min,max:o.max,step:o.step,value:n,onChange:S=>{const r=Number(S.target.value);c(null),i(v=>({...v,[o.key]:r}))}})]},o.key))})]},e.title))})]}),t.jsxs("section",{style:He,children:[t.jsxs("div",{style:T,children:[t.jsx("h2",{style:R,children:"Fixtures"}),t.jsxs("div",{style:{display:"flex",gap:16},children:[t.jsxs("label",{style:k,children:[t.jsx("input",{type:"checkbox",checked:p,onChange:e=>Q(e.target.checked)}),"Loop playback",p?" (tweaks apply next iteration)":""]}),t.jsxs("label",{style:k,children:[t.jsx("input",{type:"checkbox",checked:f,onChange:e=>K(e.target.checked)}),"Vary speed ±",Math.round(B*100),"%"]})]})]}),s?$.length===0?t.jsxs("p",{style:_,children:["No fixtures yet. Run"," ",t.jsx("code",{style:L,children:"node packages/web/scripts/generate-scoutbot-fx-fixtures.mjs"})," ","(Vox must be running) and reload."]}):t.jsx("ul",{style:$e,children:$.map(e=>{const o=E===`dry:${e.slug}`,n=E===`fx:${e.slug}`;return t.jsxs("li",{style:Ie,children:[t.jsxs("div",{style:Me,children:[t.jsx("div",{style:Ge,children:e.slug}),t.jsx("div",{style:Be,children:e.text}),t.jsxs("div",{style:Le,children:[e.voiceId?`voice ${e.voiceId}`:null,e.voiceId&&e.bytes?" · ":null,e.bytes?`${Math.round(e.bytes/1024)} KB`:null]})]}),t.jsxs("div",{style:_e,children:[t.jsx("button",{type:"button",style:o?Oe:y,onClick:()=>o?h():ee(e),children:o?"Stop":"Play dry"}),t.jsx("button",{type:"button",style:n?qe:z,onClick:()=>n?h():Z(e),children:n?"Stop":"Play with FX"})]})]},e.slug)})}):t.jsx("p",{style:_,children:"Loading…"})]})]})}const pe={minHeight:"100vh",background:"#0b0d10",color:"#e6e8eb",padding:"32px 40px 64px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"},ye={display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:24,marginBottom:28},xe={fontSize:22,fontWeight:600,margin:0},fe={color:"#9aa1ab",fontSize:13,marginTop:6,marginBottom:0},be={display:"flex",flexDirection:"column",gap:4,fontSize:12,color:"#9aa1ab",alignItems:"flex-end"},me={color:"#f5b342"},he={color:"#ef6b6b"},L={fontFamily:"ui-monospace, SFMono-Regular, monospace",background:"#181b20",padding:"1px 6px",borderRadius:4,fontSize:12},ge={background:"#121519",border:"1px solid #1f242b",borderRadius:10,padding:20,marginBottom:18},Se={fontSize:11,color:"#6b727d"},ke={display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:10,marginTop:12},q={textAlign:"left",background:"#0f1216",borderWidth:1,borderStyle:"solid",borderColor:"#1f242b",borderRadius:8,padding:"12px 14px",color:"#c5cad2",cursor:"pointer",display:"flex",flexDirection:"column",gap:6,fontFamily:"inherit",outline:"none",WebkitAppearance:"none",appearance:"none",transition:"border-color 80ms ease, background 80ms ease, color 80ms ease"},je={...q,background:"#1a1f26",borderColor:"#f1f3f5",color:"#ffffff",boxShadow:"0 0 0 1px rgba(241,243,245,0.18)"},V={fontSize:13,fontWeight:600,display:"flex",alignItems:"center",gap:8},Ce={...V,color:"#ffffff"},W={fontSize:11,color:"#9aa1ab",lineHeight:1.4},Fe={...W,color:"#c5cad2"},ve={fontSize:9,fontWeight:500,letterSpacing:.6,textTransform:"uppercase",padding:"2px 6px",borderRadius:4,background:"rgba(255,255,255,0.06)",color:"#9aa1ab"},Te={background:"#121519",border:"1px solid #1f242b",borderRadius:10,padding:20,marginBottom:28},T={display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},R={fontSize:14,textTransform:"uppercase",letterSpacing:.6,color:"#9aa1ab",margin:0},Re={display:"flex",flexDirection:"column",gap:18},we={display:"flex",flexDirection:"column",gap:10},ze={fontSize:11,textTransform:"uppercase",letterSpacing:.8,color:"#6b727d",fontWeight:600},De={display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:16},Ee={display:"flex",flexDirection:"column",gap:6,fontSize:12},Pe={display:"flex",justifyContent:"space-between",color:"#c5cad2"},Ae={color:"#7f8693",fontFamily:"ui-monospace, SFMono-Regular, monospace"},He={background:"#121519",border:"1px solid #1f242b",borderRadius:10,padding:20},$e={listStyle:"none",padding:0,margin:"16px 0 0",display:"flex",flexDirection:"column",gap:12},Ie={display:"flex",alignItems:"center",gap:16,background:"#0f1216",border:"1px solid #1f242b",borderRadius:8,padding:"14px 16px"},Me={flex:1,display:"flex",flexDirection:"column",gap:4},Ge={fontFamily:"ui-monospace, SFMono-Regular, monospace",color:"#9aa1ab",fontSize:12},Be={color:"#e6e8eb",fontSize:14},Le={color:"#6b727d",fontSize:11},_e={display:"flex",gap:8},y={background:"#1c2128",color:"#e6e8eb",borderWidth:1,borderStyle:"solid",borderColor:"#2a3038",padding:"6px 12px",borderRadius:6,fontSize:12,cursor:"pointer"},Oe={...y,background:"#2a3038",borderColor:"#3c4350"},z={background:"#2e6cdf",color:"#fff",borderWidth:1,borderStyle:"solid",borderColor:"#2e6cdf",padding:"6px 12px",borderRadius:6,fontSize:12,cursor:"pointer"},qe={...z,background:"#1f57bf",borderColor:"#1f57bf"},k={display:"flex",alignItems:"center",gap:6,fontSize:12,color:"#c5cad2",cursor:"pointer"},_={color:"#9aa1ab",fontSize:13,margin:"12px 0 0"};export{Xe as ScoutbotFxLab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a}from"./index-
|
|
1
|
+
import{j as a}from"./index-Bli6bTLU.js";import"./secondaryNavConfig-DyC_P9Wx.js";function b({ariaLabel:r,activeRoute:l,groups:t,navigate:o,className:n=""}){return a.jsx("nav",{className:`s-secondary-nav${n?` ${n}`:""}`,"aria-label":r,children:t.map((s,i)=>a.jsxs("div",{className:"s-secondary-nav-group",children:[s.label&&a.jsx("span",{className:"s-secondary-nav-label",children:s.label}),a.jsx("div",{className:"s-secondary-nav-switch",children:s.items.map(e=>{const c=e.active(l);return a.jsx("button",{type:"button","aria-pressed":c,className:`s-secondary-nav-button${c?" s-secondary-nav-button--active":""}`,onClick:()=>o(e.route),children:e.label},e.id)})})]},s.label??i))})}export{b as S};
|