@openscout/scout 0.2.76 → 0.2.78
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 +41 -2
- package/bin/openscout-runtime.mjs +48 -30
- package/bin/scout.mjs +2 -2
- package/bin/scoutd +0 -0
- package/dist/build-manifest.json +3 -3
- package/dist/client/assets/ActivityScreen-Cu_1V4bq.js +1 -0
- package/dist/client/assets/AddProjectForm-DMnobKch.js +1 -0
- package/dist/client/assets/AgentAvatar-D90c1Rzk.js +1 -0
- package/dist/client/assets/AgentConfigurationScreen-BqfOz90D.js +1 -0
- package/dist/client/assets/AgentDefinitionsWorkspace-CUpUrY57.js +1 -0
- package/dist/client/assets/AgentDetailCard-BcRBRp88.js +1 -0
- package/dist/client/assets/AgentDetailCard-C4WVeJvJ.css +1 -0
- package/dist/client/assets/AgentFloorView-8LoAEBwS.js +1 -0
- package/dist/client/assets/AgentInfoScreen-DZs2_ibL.js +1 -0
- package/dist/client/assets/AgentLaneCard-RrNnDZu8.js +1 -0
- package/dist/client/assets/AgentLaneChrome-D9ZwUKrl.js +1 -0
- package/dist/client/assets/AgentLaneDetailSheet-BXbPls9N.js +5 -0
- package/dist/client/assets/AgentLaneSummaryResize-BhFmGNzT.js +1 -0
- package/dist/client/assets/AgentLanesEmbedScreen-W3qs022h.js +1 -0
- package/dist/client/assets/AgentLanesPreflight-eSAoDsPi.js +1 -0
- package/dist/client/assets/AgentLanesView-B9vuEEmZ.js +2 -0
- package/dist/client/assets/AgentLiveActions-CGS-Bxb7.css +1 -0
- package/dist/client/assets/AgentLiveActions-DBtnD0qE.js +1 -0
- package/dist/client/assets/AgentSessions-DyqOf4nG.js +6 -0
- package/dist/client/assets/AgentsConsole-BgiYP2wR.js +1 -0
- package/dist/client/assets/AgentsConsole-BjSTs-TV.css +1 -0
- package/dist/client/assets/AgentsScreen-DBi8x4MB.js +1 -0
- package/dist/client/assets/AgentsSubnav-DIEO4NPx.js +1 -0
- package/dist/client/assets/AtopView-BCkae3e1.js +1 -0
- package/dist/client/assets/BackToPicker-BRvfostO.js +1 -0
- package/dist/client/assets/BackToPicker-CdgVu-to.css +1 -0
- package/dist/client/assets/BriefingDetailScreen-BwFyysT8.js +6 -0
- package/dist/client/assets/BriefingsScreen-BQEevztH.js +1 -0
- package/dist/client/assets/BrokerMetadataPanel-7UjcuNjd.js +1 -0
- package/dist/client/assets/BrokerScreen-7ekklu88.js +5 -0
- package/dist/client/assets/ChatCollapsedStrip-CQSYSd8s.js +1 -0
- package/dist/client/assets/CodeDiffPane-DDPt6KPh.js +1 -0
- package/dist/client/assets/CodeProjectPicker-DqKFCpLU.js +2 -0
- package/dist/client/assets/CodeScreen-BxCrpRHd.js +1 -0
- package/dist/client/assets/ContextMenu-bARZqTzD.js +1 -0
- package/dist/client/assets/ConversationComposer-Bla3DDvM.js +1 -0
- package/dist/client/assets/ConversationFeedRows-B_gPxcqA.js +1 -0
- package/dist/client/assets/ConversationHeader-DE3FC0m-.js +1 -0
- package/dist/client/assets/ConversationPanels-DLek4H6A.js +2 -0
- package/dist/client/assets/ConversationScreen-BDRhx-RU.js +1 -0
- package/dist/client/assets/ConversationScreen-C9yMAMYF.css +1 -0
- package/dist/client/assets/ConversationStatus-BwVLiiO4.js +1 -0
- package/dist/client/assets/DataTable-E8s_MmoA.js +1 -0
- package/dist/client/assets/DispatchAftermath-Dpe88DFX.js +1 -0
- package/dist/client/assets/DocumentFocusViewer-BeVwwl26.js +1 -0
- package/dist/client/assets/EmbeddableSurfacesLab-BQqFQVnI.js +1 -0
- package/dist/client/assets/EmptyState-4F9XDFQm.js +1 -0
- package/dist/client/assets/FileViewerPane-CLgUhSm4.js +3 -0
- package/dist/client/assets/FleetSearch-Dz5euQJe.js +1 -0
- package/dist/client/assets/FleetSearch-EXOe8ulE.css +1 -0
- package/dist/client/assets/FlightObserveScreen-6RpZYwVz.js +1 -0
- package/dist/client/assets/FollowScreen-DZ4qfYOY.js +1 -0
- package/dist/client/assets/HarnessMark-Cbv3Ib0c.js +1 -0
- package/dist/client/assets/HarnessesScreen-CznAImej.js +1 -0
- package/dist/client/assets/HomeHero-B3uYd-pP.js +1 -0
- package/dist/client/assets/HomeHero-DEl-WBsT.css +1 -0
- package/dist/client/assets/KnowledgeSearchInspector-Dgdkfvvz.js +1 -0
- package/dist/client/assets/KnowledgeSearchScreen-DJDGGaqC.js +1 -0
- package/dist/client/assets/LaneToolHoverCard-Bla0gBdm.js +1 -0
- package/dist/client/assets/LaneTraceDetailSheet-D1CspRbl.js +1 -0
- package/dist/client/assets/LaneTraceEventFocus-BF9ERP5O.js +1 -0
- package/dist/client/assets/MeshCanvas-DFEPkpqY.js +3 -0
- package/dist/client/assets/MeshCanvasMinimap-CyVFYixr.js +1 -0
- package/dist/client/assets/MeshCanvasMinimap-Dv7nMbl5.css +1 -0
- package/dist/client/assets/MeshScreen-DFgevn8N.js +1 -0
- package/dist/client/assets/MeshTopologyView-CalkZghg.js +2 -0
- package/dist/client/assets/MessageComposerSuggestions-DpxN9WiB.js +1 -0
- package/dist/client/assets/MessagesScreen-C8YKW10Y.js +1 -0
- package/dist/client/assets/MissionControlView-lUeAiSVg.js +1 -0
- package/dist/client/assets/MissionFocusOverlay-wlCmWDCT.js +1 -0
- package/dist/client/assets/MissionLeftAgentRow-BpZWntfl.js +1 -0
- package/dist/client/assets/MissionLogPane-__MVtEl9.js +1 -0
- package/dist/client/assets/NewAgentModal-Bg-eWHpY.js +1 -0
- package/dist/client/assets/NewAgentModal-ru8u5YdJ.css +1 -0
- package/dist/client/assets/NewChatComposer-Cs6OsxK6.js +19 -0
- package/dist/client/assets/NewChatComposer-W-t-L4oV.css +1 -0
- package/dist/client/assets/NewChatOrigin-Bk2OyVjI.js +1 -0
- package/dist/client/assets/ObserveEmbedScreen-y2EpuqRZ.js +2 -0
- package/dist/client/assets/ObserveTextFlow-rsFj_rVo.js +2 -0
- package/dist/client/assets/ObservedTopologyPanel-BsBsvVPL.css +1 -0
- package/dist/client/assets/ObservedTopologyPanel-DyUeV98H.js +2 -0
- package/dist/client/assets/OpenScoutAppShell-Bh6FnEJO.css +1 -0
- package/dist/client/assets/OpenScoutAppShell-C_URc8sV.js +87 -0
- package/dist/client/assets/OpsAgentsView-UN7iOscs.js +1 -0
- package/dist/client/assets/OpsScreen-Buf3LKjb.js +1 -0
- package/dist/client/assets/OpsSubnav-DsuXzHah.js +1 -0
- package/dist/client/assets/PlanView-C1CjH3PG.js +1 -0
- package/dist/client/assets/ProjectAgentProfile-DJusrAV-.js +1 -0
- package/dist/client/assets/ProjectAgentProfileBar-CtTpj6fU.js +1 -0
- package/dist/client/assets/ProjectAgentProfileHero-BFwNJo_N.js +1 -0
- package/dist/client/assets/ProjectsInbox-GhVMxOhw.js +2 -0
- package/dist/client/assets/ProjectsRail-BgiuV4LR.js +1 -0
- package/dist/client/assets/ProjectsScreen-eNUBy4YU.js +1 -0
- package/dist/client/assets/ProjectsThreadAside-CoBgnHmr.js +1 -0
- package/dist/client/assets/Provider-C7UKGHQy.js +1 -0
- package/dist/client/assets/Provider-CCzjtkda.css +1 -0
- package/dist/client/assets/RailRow-BoGxAHNF.js +1 -0
- package/dist/client/assets/RailRow-Cf9LOiEj.css +1 -0
- package/dist/client/assets/RawSessionsTable-DL8y_eEy.js +1 -0
- package/dist/client/assets/RealtimeVoiceScreen-ffS-39zy.js +1 -0
- package/dist/client/assets/RepoDiffEmbedScreen-C0rumUME.js +1 -0
- package/dist/client/assets/RepoDiffPageScreen-DMv6DioL.js +1 -0
- package/dist/client/assets/RepoDiffViewer-D_exm6xK.js +7 -0
- package/dist/client/assets/RepoDiffViewerLazy-BPgF92Bg.js +2 -0
- package/dist/client/assets/ReposScreen-CB_YBWYf.js +6 -0
- package/dist/client/assets/ScoutDeckSurface-CxIYFyWx.js +1 -0
- package/dist/client/assets/ScoutDeckSurface-uhmuZRzC.css +1 -0
- package/dist/client/assets/ScoutSurface-CYz_TcWC.js +1 -0
- package/dist/client/assets/ScoutbotBroadcastChip-CxtYZWPZ.css +1 -0
- package/dist/client/assets/ScoutbotBroadcastChip-L_R9atj0.js +2 -0
- package/dist/client/assets/ScoutbotFxLab-CgiZMDMW.js +4 -0
- package/dist/client/assets/ScoutbotRealtimeVoiceCall-FMQOr1Np.js +1 -0
- package/dist/client/assets/SecondaryNav-B3-nh5dM.js +1 -0
- package/dist/client/assets/SessionEmbedScreen-BVC7yvWF.js +1 -0
- package/dist/client/assets/SessionObserve-BpggNO_M.css +1 -0
- package/dist/client/assets/SessionObserve-yfXFafp8.js +12 -0
- package/dist/client/assets/SessionRefScreen-DRgJu7Jo.js +1 -0
- package/dist/client/assets/SessionsScreen-D6XUsZfA.js +1 -0
- package/dist/client/assets/SettingsDrawer-CmJt72ww.css +1 -0
- package/dist/client/assets/SettingsDrawer-XfdAa_nD.js +3 -0
- package/dist/client/assets/SettingsScreen-Cy8z-EuR.js +1 -0
- package/dist/client/assets/ShikiPane-Ap1iPxYb.js +15 -0
- package/dist/client/assets/SlidePanel-Bg5dVaIa.css +1 -0
- package/dist/client/assets/SlidePanel-COwtoJqR.js +1 -0
- package/dist/client/assets/SpriteAvatar-DyaGuhik.js +1 -0
- package/dist/client/assets/StatusPill-DhBL__p8.js +1 -0
- package/dist/client/assets/TailView-DGj_5HA9.js +2 -0
- package/dist/client/assets/TailView-Mj3AU2u0.css +1 -0
- package/dist/client/assets/Terminal-CqvGbjXU.js +1 -0
- package/dist/client/assets/TerminalEmbedScreen-DuZZFFzW.js +1 -0
- package/dist/client/assets/TextDocumentSurface-BpAw4eQS.js +4 -0
- package/dist/client/assets/TmuxPeek-m1osv33Q.js +1 -0
- package/dist/client/assets/VoicePermissionsPanel-DsK53ar4.js +1 -0
- package/dist/client/assets/VoicePermissionsPanel-RijAZ1gP.css +1 -0
- package/dist/client/assets/WorkDetailScreen-Bx0JimPC.js +5 -0
- package/dist/client/assets/WorkFilesViewer-Btl6C2Q1.js +1 -0
- package/dist/client/assets/activity-CA8qS6PI.js +1 -0
- package/dist/client/assets/{addon-fit-BOSszMLK.js → addon-fit-BZ-kXjeN.js} +1 -1
- package/dist/client/assets/{addon-webgl-WE840gr0.js → addon-webgl-D9-EQVEK.js} +1 -1
- package/dist/client/assets/agent-chat-Bfjd9y6c.js +1 -0
- package/dist/client/assets/agent-definitions-CymTYqvo.css +1 -0
- package/dist/client/assets/agent-directory-studio-injection-Bc8590z5.css +1 -0
- package/dist/client/assets/agent-essentials-BSY1o46q.js +1 -0
- package/dist/client/assets/agent-floor-CuJr1iK1.css +1 -0
- package/dist/client/assets/agent-lane-card-Dm7YWoew.css +1 -0
- package/dist/client/assets/agent-lane-card-model-r2frk57c.js +1 -0
- package/dist/client/assets/agent-lane-detail-Djm3YJEa.js +1 -0
- package/dist/client/assets/agent-lane-preview-CmHVe3dU.js +4 -0
- package/dist/client/assets/agent-lanes-BDNktFBZ.css +1 -0
- package/dist/client/assets/agent-lanes-model-B4YTt4OF.js +2 -0
- package/dist/client/assets/agents-detail-redesign-h34ROjOW.css +1 -0
- package/dist/client/assets/agents-project-COzHxZAF.css +1 -0
- package/dist/client/assets/agents-project-model-UYiamtrU.js +1 -0
- package/dist/client/assets/agents-screen-BMu6PpRY.css +1 -0
- package/dist/client/assets/api-BkjHJfgJ.js +1 -0
- package/dist/client/assets/api-h5zurxmi.js +1 -0
- package/dist/client/assets/{arc.es-KGqGKGIy.js → arc.es-CQBb-dVu.js} +1 -1
- package/dist/client/assets/arrow-down-BPLe0am9.js +1 -0
- package/dist/client/assets/arrow-left-DEZzHiPS.js +1 -0
- package/dist/client/assets/arrow-up-right-ClxBnsi7.js +1 -0
- package/dist/client/assets/bash-format-BRV5C6Gv.js +1 -0
- package/dist/client/assets/bot-eu8pBNvI.js +1 -0
- package/dist/client/assets/briefings-BwuAFQK6.css +1 -0
- package/dist/client/assets/broker-display-pp33bLsu.js +2 -0
- package/dist/client/assets/cache-Dr0why2k.js +2 -0
- package/dist/client/assets/check-DjgFiBxb.js +1 -0
- package/dist/client/assets/chevron-down-BGk5qoEw.js +1 -0
- package/dist/client/assets/chevron-right-XiIHsk4m.js +1 -0
- package/dist/client/assets/chunk-T65CQEWV-CrzwSeEt.js +1 -0
- package/dist/client/assets/chunk-YOZR3KYS-Bet8khjg.js +47 -0
- package/dist/client/assets/clipboard-e3fSpeo7.js +1 -0
- package/dist/client/assets/code-screen-DrKinCyh.css +1 -0
- package/dist/client/assets/code-xml-B6jOCM4V.js +1 -0
- package/dist/client/assets/collapsed-strip-Dz-of2SM.css +1 -0
- package/dist/client/assets/colors-BtO5_zlx.js +1 -0
- package/dist/client/assets/console-B1IBqLI_.css +1 -0
- package/dist/client/assets/content-BDt9VBPk.js +1 -0
- package/dist/client/assets/content-BIXf4cKR.js +1 -0
- package/dist/client/assets/content-BLm0NBJM.js +1 -0
- package/dist/client/assets/content-C2EwTb2y.js +1 -0
- package/dist/client/assets/content-C5UbLsDF.js +1 -0
- package/dist/client/assets/content-CHU0wwA3.css +1 -0
- package/dist/client/assets/content-CR3vdrYY.js +1 -0
- package/dist/client/assets/content-CSPVmo2s.js +1 -0
- package/dist/client/assets/content-C_FGqx1X.js +1 -0
- package/dist/client/assets/content-CvlVUOG8.js +1 -0
- package/dist/client/assets/content-D5kJmfgl.js +1 -0
- package/dist/client/assets/content-DTpQsomG.js +1 -0
- package/dist/client/assets/content-DikVsqLf.js +1 -0
- package/dist/client/assets/content-DlUe5Ono.js +1 -0
- package/dist/client/assets/content-GIBv_55n.js +1 -0
- package/dist/client/assets/content-Q2oclDzi.js +1 -0
- package/dist/client/assets/context-budget-CbB4BDcO.js +1 -0
- package/dist/client/assets/conversation-icons-IIG5ha6D.js +1 -0
- package/dist/client/assets/conversation-model-B47vYmWN.js +1 -0
- package/dist/client/assets/conversation-motion-features-BdAONVls.js +1 -0
- package/dist/client/assets/conversation-prefs-DNre-Lcx.js +1 -0
- package/dist/client/assets/copy-CQGYbxdu.js +1 -0
- package/dist/client/assets/createLucideIcon-OpA4Amw5.js +1 -0
- package/dist/client/assets/ctx-panel-B4s49N9e.css +1 -0
- package/dist/client/assets/discover-C1YwpBDE.js +2 -0
- package/dist/client/assets/document-focus-viewer-BSC_JwVE.css +1 -0
- package/dist/client/assets/embed-entry-BAcGL3g9.js +2 -0
- package/dist/client/assets/external-link-CXBytO9o.js +1 -0
- package/dist/client/assets/eye-0PvebX_a.js +1 -0
- package/dist/client/assets/file-text-BODxCjcz.js +1 -0
- package/dist/client/assets/flight-observe-GFg9L8ft.css +1 -0
- package/dist/client/assets/follow-route-BvcGtBIL.js +1 -0
- package/dist/client/assets/fx-z37u1o2z.js +1 -0
- package/dist/client/assets/gestures-CcwOTu8C.js +1 -0
- package/dist/client/assets/harnesses-screen-DBZoTZz8.css +1 -0
- package/dist/client/assets/home-live-action-B22u89j7.js +1 -0
- package/dist/client/assets/home-moving-signal-CAa0V91u.css +1 -0
- package/dist/client/assets/home-moving-signal-CK147hxn.js +1 -0
- package/dist/client/assets/home-now-card-BgvNWuea.js +1 -0
- package/dist/client/assets/home-now-card-nano-BcjnOU9H.js +1 -0
- package/dist/client/assets/hooks-B6y_O2FB.js +2 -0
- package/dist/client/assets/hooks-D6NI15f6.css +1 -0
- package/dist/client/assets/inbox-thread-redesign-Bz4FjWzr.css +1 -0
- package/dist/client/assets/index-BWHgHrtv.js +1 -0
- package/dist/client/assets/index-BcuhqXLe.js +1 -0
- package/dist/client/assets/index-CJXzfjo9.js +1 -0
- package/dist/client/assets/index-CvF09yvf.css +1 -0
- package/dist/client/assets/index-DMiGbrBt.js +10 -0
- package/dist/client/assets/index-DQPvraRS.js +1 -0
- package/dist/client/assets/index-DxGoC5l5.css +1 -0
- package/dist/client/assets/inspector-panel-DPoCWxKs.js +2 -0
- package/dist/client/assets/keyboard-nav-2kv_tGUS.js +1 -0
- package/dist/client/assets/knowledge-search-CVxQwxPn.js +1 -0
- package/dist/client/assets/knowledge-search-DjrQdiiW.css +1 -0
- package/dist/client/assets/lane-ask-display-B6iCAVcd.js +18 -0
- package/dist/client/assets/lane-edit-display-C_Aujldz.js +9 -0
- package/dist/client/assets/lane-observe-D0rfKDnU.js +7 -0
- package/dist/client/assets/lane-roster-store-D8x1jac2.js +1 -0
- package/dist/client/assets/lane-tool-detail-0WhMf4Vj.js +9 -0
- package/dist/client/assets/left-Bk3XnxPD.css +1 -0
- package/dist/client/assets/left-C--GiIh8.js +2 -0
- package/dist/client/assets/left-CAaRBK9S.css +1 -0
- package/dist/client/assets/left-CCoobxPS.css +1 -0
- package/dist/client/assets/left-Cj7Rt89X.js +1 -0
- package/dist/client/assets/left-CpNEtFEg.js +1 -0
- package/dist/client/assets/left-CzXAuK_t.js +2 -0
- package/dist/client/assets/left-agents-Bo9sO1by.js +1 -0
- package/dist/client/assets/left-bN4PCAXa.js +1 -0
- package/dist/client/assets/left-default-DV9GdvYi.js +1 -0
- package/dist/client/assets/left-jYYGAOYD.js +1 -0
- package/dist/client/assets/left-lanes-D0l_Co7V.js +1 -0
- package/dist/client/assets/left-mission-Ci7zREkQ.js +1 -0
- package/dist/client/assets/left-mission-DSenPIyb.css +1 -0
- package/dist/client/assets/left-plan-D4U1uflW.js +2 -0
- package/dist/client/assets/library-D-RxGiCw.js +1 -0
- package/dist/client/assets/loader-circle-CbHjZsz1.js +1 -0
- package/dist/client/assets/local-agents--00gLMqr.js +1 -0
- package/dist/client/assets/mentions-jSuTGeet.js +1 -0
- package/dist/client/assets/mesh-buckets-CfAukILK.js +1 -0
- package/dist/client/assets/mesh-screen-BSDUjrnV.css +1 -0
- package/dist/client/assets/mesh-view-store-CWidRbTE.js +1 -0
- package/dist/client/assets/message-circle-CG-96zts.js +1 -0
- package/dist/client/assets/message-markup-3J9pi3nx.js +15 -0
- package/dist/client/assets/message-square-DSaGpjFU.js +1 -0
- package/dist/client/assets/message-visibility-kJM8XcSG.js +1 -0
- package/dist/client/assets/mission-control-D3ikEPND.css +1 -0
- package/dist/client/assets/mission-control-model-C0fByIjm.js +1 -0
- package/dist/client/assets/mission-control-store-BlnEhiCq.js +1 -0
- package/dist/client/assets/model-Co0zkMIc.js +1 -0
- package/dist/client/assets/model-CpAxGuis.js +1 -0
- package/dist/client/assets/observe-CuLGD9Zp.js +1 -0
- package/dist/client/assets/openAgent-Bjt57GdM.js +1 -0
- package/dist/client/assets/openContent-C6XO6kr5.js +1 -0
- package/dist/client/assets/operator-attention-BwSPeheT.js +1 -0
- package/dist/client/assets/ops-agents-BOYxzPTm.css +1 -0
- package/dist/client/assets/ops-atop-BB4B4JdE.css +1 -0
- package/dist/client/assets/ops-screen-giu3If_N.css +1 -0
- package/dist/client/assets/page-status-DpkedE1F.js +1 -0
- package/dist/client/assets/page-status-bar-ByUD7VPM.css +1 -0
- package/dist/client/assets/plan-view-D56fneVF.css +1 -0
- package/dist/client/assets/plus--b1raV_O.js +1 -0
- package/dist/client/assets/profile-CVRziEDA.js +1 -0
- package/dist/client/assets/project-overview-helpers-BQTc_Ous.js +1 -0
- package/dist/client/assets/projects-inbox-CHyUFQ6w.js +1 -0
- package/dist/client/assets/projects-inbox-COZ23dLR.css +1 -0
- package/dist/client/assets/radio-Bz8ZePxj.js +1 -0
- package/dist/client/assets/refresh-cw-BBmAnCB7.js +1 -0
- package/dist/client/assets/repo-diff-C9Qs-bEn.css +1 -0
- package/dist/client/assets/resizable-columns-C7ygvLt8.css +1 -0
- package/dist/client/assets/resolve-panes-r9B3mpW7.js +1 -0
- package/dist/client/assets/resolve-sidebar-context-DcG8xGaB.js +1 -0
- package/dist/client/assets/right-BHeiIaty.js +1 -0
- package/dist/client/assets/right-BkgKo9VT.js +1 -0
- package/dist/client/assets/right-BpEU5jWE.js +1 -0
- package/dist/client/assets/right-CRZXoy-X.js +1 -0
- package/dist/client/assets/right-ChF_pbPy.js +1 -0
- package/dist/client/assets/right-DMoUT3KN.js +1 -0
- package/dist/client/assets/right-DjRXbnRP.js +2 -0
- package/dist/client/assets/right-T4Ue6EqM.js +1 -0
- package/dist/client/assets/right-wzrLXKur.js +1 -0
- package/dist/client/assets/rocket-BSNS_rLs.js +1 -0
- package/dist/client/assets/router-Bq5dwf78.js +1 -0
- package/dist/client/assets/runtime-picker-Bcl5iIX5.js +1 -0
- package/dist/client/assets/runtime-picker-vhm0gtLs.css +1 -0
- package/dist/client/assets/scope-views-4khCg2_z.css +1 -0
- package/dist/client/assets/scope-views-U-ucT9m0.js +1 -0
- package/dist/client/assets/scout-voice-CU5c0LGi.js +1 -0
- package/dist/client/assets/scoutbot-BTIErYHo.js +3 -0
- package/dist/client/assets/scroll-text-D6Pdnar7.js +1 -0
- package/dist/client/assets/search-CWfZtOt2.js +1 -0
- package/dist/client/assets/secondaryNavConfig-DqUIp0Es.js +1 -0
- package/dist/client/assets/secondaryNavConfig-xssF_ubT.css +1 -0
- package/dist/client/assets/selection-bridge-16pk1qyG.js +1 -0
- package/dist/client/assets/send-horizontal-Bg5-QggH.js +1 -0
- package/dist/client/assets/server-CPp4ZJhZ.js +1 -0
- package/dist/client/assets/session-catalog-BmoyVTJ_.js +1 -0
- package/dist/client/assets/session-table-DZcrKoIH.js +1 -0
- package/dist/client/assets/sessionRead-CvFz2RHv.js +1 -0
- package/dist/client/assets/sliders-horizontal-1oW76Xc9.js +1 -0
- package/dist/client/assets/sparkles-ClfRJQ6w.js +1 -0
- package/dist/client/assets/sse-CjIkKo46.js +1 -0
- package/dist/client/assets/status-tone-BM_zuRy1.js +1 -0
- package/dist/client/assets/surface-activity-B1rgWB1i.js +1 -0
- package/dist/client/assets/system-surfaces-redesign-CD26LFc0.css +1 -0
- package/dist/client/assets/tail-display-BdyoLvzY.js +2 -0
- package/dist/client/assets/tail-events-D19uAGe3.js +1 -0
- package/dist/client/assets/terminal-B9AOZQKR.js +1 -0
- package/dist/client/assets/terminal-relay-CWbJ1RCW.js +1 -0
- package/dist/client/assets/terminal-screen-19jAI0Cw.css +1 -0
- package/dist/client/assets/terminal-sessions-D5CIR2OL.js +1 -0
- package/dist/client/assets/terminal-takeover-B8UeD9OX.js +1 -0
- package/dist/client/assets/text-DsBWV_4k.js +1 -0
- package/dist/client/assets/time-DltNTpLl.js +1 -0
- package/dist/client/assets/types-B0PlfpKc.js +1 -0
- package/dist/client/assets/ui-LM8pS8qE.js +1 -0
- package/dist/client/assets/use-conversation-list-Byab41G6.js +1 -0
- package/dist/client/assets/use-fleet-active-asks-BIbQx5AS.js +1 -0
- package/dist/client/assets/use-reduced-motion-RRBkmVkk.js +1 -0
- package/dist/client/assets/useAgentHoverCard-DMrbBif0.js +1 -0
- package/dist/client/assets/useContentSecondaryNav-DMl1WNm7.js +1 -0
- package/dist/client/assets/usePierreRuntime-wC-yMtBb.js +50 -0
- package/dist/client/assets/voice-levels-Dcr3jglk.js +1 -0
- package/dist/client/assets/wrench-Bkc_0lKF.js +1 -0
- package/dist/client/assets/x-D3GElQbe.js +1 -0
- package/dist/client/assets/{xterm-6eL7V7pF.js → xterm-BKR8oAkR.js} +1 -1
- package/dist/client/index.html +6 -3
- package/dist/drizzle/0003_harsh_meltdown.sql +45 -0
- package/dist/drizzle/0004_medical_aaron_stack.sql +40 -0
- package/dist/drizzle/0005_wet_shriek.sql +57 -0
- package/dist/drizzle/0006_woozy_dark_beast.sql +1 -0
- package/dist/drizzle/README.md +7 -0
- package/dist/drizzle/meta/0003_snapshot.json +4952 -0
- package/dist/drizzle/meta/0004_snapshot.json +5235 -0
- package/dist/drizzle/meta/0005_snapshot.json +5599 -0
- package/dist/drizzle/meta/0006_snapshot.json +5606 -0
- package/dist/drizzle/meta/_journal.json +28 -0
- package/dist/main.mjs +24907 -12910
- package/dist/node/main.mjs +10212 -195
- package/dist/openscout-terminal-relay.mjs +507 -64
- package/dist/pairing-runtime-controller.mjs +10793 -5165
- package/dist/runtime/base-daemon.mjs +627 -159
- package/dist/runtime/broker-daemon.mjs +65039 -30990
- package/dist/runtime/broker-process-manager.mjs +247 -54
- package/dist/runtime/mesh-discover.mjs +246 -54
- package/dist/scout-control-plane-web.mjs +56699 -47427
- package/dist/scout-web-server.mjs +56699 -47427
- package/package.json +1 -1
- package/dist/client/assets/RepoDiffViewer-DLVleMPW.js +0 -56
- package/dist/client/assets/embed-entry-BdmREZuc.js +0 -1
- package/dist/client/assets/index-DPFmfHm5.js +0 -271
- package/dist/client/assets/index-jpYnsyHM.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,j as n}from"./index-DMiGbrBt.js";/* empty css */import{D as O}from"./DataTable-E8s_MmoA.js";import{p as W,a as L}from"./api-h5zurxmi.js";import{t as U,n as R,f as Y}from"./time-DltNTpLl.js";import{u as G}from"./tail-events-D19uAGe3.js";import{o as Q}from"./openContent-C6XO6kr5.js";import{u as X}from"./Provider-C7UKGHQy.js";/* empty css */import"./index-BWHgHrtv.js";import"./router-Bq5dwf78.js";import"./terminal-sessions-D5CIR2OL.js";import"./sse-CjIkKo46.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-bARZqTzD.js";import"./DocumentFocusViewer-BeVwwl26.js";import"./createLucideIcon-OpA4Amw5.js";import"./TextDocumentSurface-BpAw4eQS.js";/* empty css */import"./file-text-BODxCjcz.js";import"./x-D3GElQbe.js";import"./chevron-right-XiIHsk4m.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-2kv_tGUS.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./NewChatComposer-Cs6OsxK6.js";import"./runtime-picker-Bcl5iIX5.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-CbHjZsz1.js";import"./index-CJXzfjo9.js";import"./HarnessMark-Cbv3Ib0c.js";import"./conversation-model-B47vYmWN.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-BGk5qoEw.js";import"./search-CWfZtOt2.js";const q=1e4,J=500,$=1e3,Z=6e4,D="/api/tail/discover",_=`/api/tail/recent?limit=${J}`,P=3e4,tt=[{key:"status",label:"status",cls:"s-atop-col-status",kind:"text",sortable:!1,defaultWidth:96,minWidth:70,render:t=>n.jsxs("span",{className:`s-atop-status s-atop-status--${t.status}`,children:[n.jsx("span",{className:"s-atop-status-dot","aria-hidden":"true"}),t.statusLabel]})},{key:"session",label:"session",cls:"s-atop-col-agent",kind:"text",sortable:!1,defaultWidth:168,minWidth:110,maxWidth:280,render:t=>n.jsxs("div",{className:"s-atop-agent-cell",title:t.sessionId??t.refId,children:[n.jsx("span",{className:`s-atop-chip s-atop-chip--harness s-atop-chip--harness-${st(t.source)}`,children:t.source}),n.jsx("span",{className:"s-atop-agent-id",children:t.refId.slice(0,8)})]})},{key:"project",label:"project",cls:"s-atop-col-project",kind:"text",sortable:!1,defaultWidth:200,minWidth:96,maxWidth:360,render:t=>n.jsx("span",{title:t.cwd??t.project,children:t.project})},{key:"updated",label:"updated",cls:"s-atop-col-last",kind:"time",sortable:!1,defaultWidth:86,minWidth:64,render:t=>n.jsx("span",{title:Y(t.mtimeMs),children:U(Math.max(R(t.mtimeMs)??0,R(t.lastEvent?.ts)??0))||"-"})},{key:"size",label:"size",cls:"s-atop-col-runtime",kind:"number",sortable:!1,defaultWidth:80,minWidth:64,render:t=>nt(t.size)},{key:"path",label:"path",kind:"text",sortable:!1,defaultWidth:360,minWidth:160,maxWidth:800,render:t=>n.jsx("span",{title:t.transcriptPath,children:t.cwd??t.transcriptPath})}];function z(t){const i=t?.trim();if(!i)return null;const r=F(i);return r.endsWith(".jsonl")?r.slice(0,-6):r}function F(t){const i=t.replace(/[\\/]+$/,"");return i.split(/[\\/]/).filter(Boolean).at(-1)??i}function et(t){const r=t.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean);return r.pop(),r.at(-1)??""}function st(t){return t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function nt(t){if(!Number.isFinite(t)||t<0)return"-";if(t<1024)return`${t} B`;const i=t/1024;if(i<1024)return`${i.toFixed(i>=10?0:1)} KiB`;const r=i/1024;return`${r.toFixed(r>=10?0:1)} MiB`}function at(t,i){return i?[t.refId,t.sessionId??"",t.source,t.project,t.cwd??"",t.transcriptPath,t.lastEvent?.summary??"",t.process?.command??""].join(" ").toLowerCase().includes(i.toLowerCase()):!0}function B(t){return`${t.source}\0${t.cwd??""}`}function ot(t){return`${t.source}\0${t.cwd??""}`}function it(t,i,r){if(!t?.transcripts?.length)return[];const d=new Map;for(const s of i){const l=d.get(s.sessionId);(!l||s.ts>l.ts)&&d.set(s.sessionId,s)}const h=new Map;for(const s of t.processes){if(!s.cwd)continue;const l=h.get(B(s));(!l||s.pid<l.pid)&&h.set(B(s),s)}return t.transcripts.map(s=>{const l=z(s.sessionId)??z(s.transcriptPath);if(!l)return null;const u=s.sessionId?d.get(s.sessionId)??null:null,x=h.get(ot(s))??null,m=Math.max(s.mtimeMs,u?.ts??0),j=!!x||r-m<=Z,p=s.project?.trim()||(s.cwd?F(s.cwd):et(s.transcriptPath))||"unknown";return{refId:l,source:s.source||"unknown",project:p,cwd:s.cwd,transcriptPath:s.transcriptPath,sessionId:s.sessionId,mtimeMs:s.mtimeMs,size:s.size,status:j?"run":"idle",statusLabel:j?"active":"idle",lastEvent:u,process:x}}).filter(s=>s!==null).sort((s,l)=>{const u=Math.max(s.mtimeMs,s.lastEvent?.ts??0);return Math.max(l.mtimeMs,l.lastEvent?.ts??0)-u||s.project.localeCompare(l.project)})}function Xt({navigate:t}){const{route:i}=X(),[r]=o.useState(()=>W(D,P)),[d,h]=o.useState(r),[s,l]=o.useState(()=>W(_,P)?.events??[]),[u,x]=o.useState(r===null),[m,j]=o.useState(""),[p,S]=o.useState("all"),[y,k]=o.useState(0),[N,C]=o.useState(null),[T,V]=o.useState(Date.now()),b=o.useRef(null),I=o.useCallback(async()=>{C(null);try{h(await L(D))}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);o.useEffect(()=>{I();const e=setInterval(()=>{I()},q);return()=>clearInterval(e)},[I]),o.useEffect(()=>{let e=!1;return(async()=>{try{const a=await L(_);e||l(a.events??[])}catch{}})(),()=>{e=!0}},[]),G(e=>{l(a=>a.length>=$?[...a.slice(a.length-$+1),e]:[...a,e])}),o.useEffect(()=>{const e=setInterval(()=>V(Date.now()),15e3);return()=>clearInterval(e)},[]);const f=o.useMemo(()=>it(d,s,T),[d,s,T]),H=o.useMemo(()=>[...new Set(f.map(e=>e.source))].sort(),[f]),c=o.useMemo(()=>f.filter(e=>(p==="all"||e.source===p)&&at(e,m.trim())),[f,p,m]);o.useEffect(()=>{y>=c.length&&k(Math.max(0,c.length-1))},[c.length,y]);const M=o.useCallback(e=>{e&&Q(t,{view:"sessions",sessionId:e.refId},{returnTo:i})},[t,i]);o.useEffect(()=>{const e=a=>{const E=a.target,A=E instanceof HTMLInputElement||E instanceof HTMLTextAreaElement||(E?.isContentEditable??!1);if(a.key==="/"&&!A){a.preventDefault(),b.current?.focus();return}if(A){a.key==="Escape"&&E===b.current&&(j(""),b.current?.blur());return}if(a.key==="ArrowDown"||a.key==="j"){a.preventDefault(),k(w=>c.length===0?0:Math.min(c.length-1,w+1));return}if(a.key==="ArrowUp"||a.key==="k"){a.preventDefault(),k(w=>Math.max(0,w-1));return}(a.key==="Enter"||a.key==="o")&&(a.preventDefault(),M(c[y]))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[c,y,M]);const K=N?[]:c,g=o.useCallback(e=>`${e.source}:${e.transcriptPath}`,[]),v=o.useMemo(()=>new Map(c.map((e,a)=>[g(e),a])),[c,g]);return n.jsxs("div",{className:"s-atop s-atop--sessions",children:[n.jsxs("div",{className:"s-atop-fbar",children:[n.jsxs("label",{className:"s-atop-search",children:[n.jsx("span",{className:"s-atop-search-prompt",children:"/"}),n.jsx("input",{ref:b,className:"s-atop-search-input",placeholder:"filter sessions",value:m,onChange:e=>j(e.target.value)}),n.jsx("kbd",{className:"s-atop-search-kbd",children:"/"})]}),n.jsx("span",{className:"s-atop-fbar-label",children:"source"}),n.jsxs("button",{type:"button",className:`s-atop-pill${p==="all"?" s-atop-pill--on":""}`,onClick:()=>S("all"),children:["all",n.jsx("span",{className:"s-atop-pill-ct",children:f.length})]}),H.map(e=>n.jsxs("button",{type:"button",className:`s-atop-pill${p===e?" s-atop-pill--on":""}`,onClick:()=>S(e),children:[e,n.jsx("span",{className:"s-atop-pill-ct",children:f.filter(a=>a.source===e).length})]},e)),n.jsx("div",{className:"s-atop-fbar-spacer"})]}),n.jsx(O,{rows:K,columns:tt,rowId:g,storageKey:"openscout.sessions.cols",rowBindings:e=>({onMouseEnter:()=>{const a=v.get(e);a!=null&&k(a)},onFocus:()=>{const a=v.get(e);a!=null&&k(a)}}),onRowClick:e=>M(e),rowClassName:e=>v.get(g(e))===y?"s-atop-row--selected":void 0,empty:N?{title:"Discovery failed",body:N}:{title:"No raw sessions",body:m?"No sessions match the current filter.":"No transcript sessions were discovered."},loading:u,density:"compact",className:"s-atop-data-table",ariaLabel:"Raw sessions"}),n.jsxs("div",{className:"s-atop-keys",children:[n.jsxs("span",{children:[n.jsx("kbd",{children:"/"}),"filter"]}),n.jsxs("span",{children:[n.jsx("kbd",{children:"j/k"}),"select"]}),n.jsxs("span",{children:[n.jsx("kbd",{children:"enter"}),"open"]}),n.jsx("span",{className:"s-atop-keys-spacer"}),n.jsxs("span",{className:"s-atop-keys-count",children:[n.jsx("strong",{children:c.length})," sessions"]})]})]})}export{Xt as RawSessionsTable};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,r}from"./index-DMiGbrBt.js";import{u as w}from"./router-Bq5dwf78.js";import{a as p,b,c as g}from"./Provider-C7UKGHQy.js";import{S as j,a as E}from"./ScoutbotRealtimeVoiceCall-FMQOr1Np.js";import{d as _}from"./types-B0PlfpKc.js";import"./terminal-sessions-D5CIR2OL.js";import"./api-h5zurxmi.js";import"./sse-CjIkKo46.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-bARZqTzD.js";import"./DocumentFocusViewer-BeVwwl26.js";import"./createLucideIcon-OpA4Amw5.js";import"./TextDocumentSurface-BpAw4eQS.js";/* empty css */import"./file-text-BODxCjcz.js";import"./x-D3GElQbe.js";import"./chevron-right-XiIHsk4m.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-2kv_tGUS.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./NewChatComposer-Cs6OsxK6.js";import"./runtime-picker-Bcl5iIX5.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-CbHjZsz1.js";import"./index-CJXzfjo9.js";import"./HarnessMark-Cbv3Ib0c.js";import"./conversation-model-B47vYmWN.js";import"./time-DltNTpLl.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-BGk5qoEw.js";import"./search-CWfZtOt2.js";import"./radio-Bz8ZePxj.js";import"./plus--b1raV_O.js";function N({dictationActive:t=!1,autoStart:c=!1}){const a=w(p,!1),{enabled:l,state:i,leaseId:u,startCall:f,endCall:x}=b(),h=r.useRef(!1),n=r.useRef(null),[m,S]=r.useState(()=>window.innerWidth>=720&&window.innerHeight>=520?"page":"compact"),s=window.webkit?.messageHandlers?.scoutRealtimeVoice;return r.useEffect(()=>{const o=()=>{S(window.innerWidth>=720&&window.innerHeight>=520?"page":"compact")};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),r.useEffect(()=>{s?.postMessage({kind:"session-state",state:i,leaseId:u})},[u,s,i]),r.useEffect(()=>{const o=()=>{if(n.current)return n.current;const d=x().finally(()=>{n.current===d&&(n.current=null)});return n.current=d,d},v=()=>{o()};return window.__scoutRealtimeVoiceStop=o,window.addEventListener(g,v),window.__scoutRealtimeVoiceStopRequested&&o(),()=>{window.removeEventListener(g,v),window.__scoutRealtimeVoiceStop===o&&delete window.__scoutRealtimeVoiceStop}},[x]),r.useEffect(()=>{!c||t||!a||!l||h.current||i!=="idle"&&i!=="ended"&&i!=="error"||(h.current=!0,f())},[c,t,a,l,f,i]),a?l?e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(j,{state:i,onMinimize:s?()=>s.postMessage("minimize"):void 0,onExpand:s?()=>s.postMessage(m==="page"?"restore":"expand"):void 0,layout:m}),e.jsx(E,{dictationActive:t,layout:m})]}):e.jsxs("div",{className:"flex h-full flex-col justify-center gap-2 p-4",children:[e.jsx("p",{className:"font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:"Live voice is disabled"}),e.jsx("p",{className:"text-sm leading-snug text-[var(--scout-chrome-ink-faint)]",children:"Enable realtime voice in Settings → Voice. The footer Voice control starts and manages calls."})]}):e.jsxs("div",{className:"flex h-full flex-col justify-center gap-2 p-4",children:[e.jsx("p",{className:"font-mono text-xs uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)]",children:"Live voice is off"}),e.jsxs("p",{className:"text-sm leading-snug text-[var(--scout-chrome-ink-faint)]",children:["Turn on the ",e.jsx("span",{className:"font-mono",children:p})," flag to hold live conversations with Scoutbot. Calls use the configured OpenAI API account."]})]})}function fe(){const t=w(p,!1),{enabled:c,state:a}=b();return!t||!c?e.jsx(N,{}):e.jsxs("main",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-[var(--scout-chrome-bg)]",children:[e.jsxs("div",{className:"border-b border-[var(--scout-chrome-border-soft)] px-6 py-5",children:[e.jsx("p",{className:"font-mono text-xs uppercase tracking-[0.14em] text-[var(--scout-chrome-ink-faint)]",children:"Scoutbot"}),e.jsx("h1",{className:"mt-1 text-3xl font-medium text-[var(--scout-chrome-ink-strong)]",children:"Live voice"}),e.jsx("p",{className:"mt-1 max-w-2xl text-xs leading-relaxed text-[var(--scout-chrome-ink-faint)]",children:"Hold a live conversation, inspect navigation attempts, and audit what Scoutbot tried without leaving the call."})]}),e.jsx("div",{className:"min-h-0 flex-1 p-5",children:e.jsxs("section",{className:"mx-auto flex h-full min-h-[26rem] w-full max-w-5xl flex-col overflow-hidden rounded-xl border border-[color-mix(in_srgb,var(--hud-ink)_11%,transparent)] bg-[color-mix(in_srgb,var(--scout-chrome-bg)_96%,black)] shadow-[0_18px_48px_rgba(0,0,0,0.24)]",children:[e.jsx(j,{state:a,layout:"page"}),e.jsx(E,{dictationActive:!1,layout:"page"})]})})]})}const xe=_({id:"voice",label:"Live voice",route:{view:"voice"},webPath:"/voice",screen:"RealtimeVoiceScreen",embed:{path:"/embed/voice",profile:"macos.voice",rootClassName:"s-voice-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},hosts:{macos:!0},resolveEmbedProps:t=>({dictationActive:t.get("dictationActive")==="1",autoStart:t.get("autoStart")==="1"})}});export{fe as RealtimeVoicePage,N as RealtimeVoiceScreen,xe as scoutSurface};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s}from"./index-DMiGbrBt.js";import{R as c}from"./RepoDiffViewerLazy-BPgF92Bg.js";/* empty css */const l=["unstaged","staged","branch"];function o(e){const t=e.getAll("layer").filter(r=>l.includes(r));return t.length>0?t:void 0}function p(){const e=typeof window>"u"?new URLSearchParams:new URLSearchParams(window.location.search),t=e.get("path")?.trim()??"",r=e.getAll("file").map(i=>i.trim()).filter(Boolean),a=e.get("sessionId")?.trim()||void 0,n=e.get("agentId")?.trim()||void 0,d=e.get("include")==="all"||e.get("include")==="touched"?"all":"changed";return t?s.jsx(c,{path:t,layers:o(e),files:r,session:a||n?{sessionId:a,agentId:n,include:d}:null,className:"rd-embed"}):s.jsx("div",{className:"rd-viewer rd-embed","data-scout-theme":!0,children:s.jsx("div",{className:"rd-center",children:s.jsxs("div",{className:"rd-center-card",children:[s.jsx("div",{className:"rd-center-title",children:"No worktree path"}),s.jsxs("div",{className:"rd-center-body",children:["This embed needs a ",s.jsx("code",{children:"?path=<absolute-path>"})," query parameter."]})]})})})}export{p as RepoDiffEmbedScreen,p as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./index-DMiGbrBt.js";import{R as l}from"./RepoDiffViewerLazy-BPgF92Bg.js";/* empty css */const f=1;function m(t=typeof performance>"u"?void 0:performance){const r=(t?.getEntriesByType?.("navigation")??[]).find(i=>typeof i.type=="string");return r?r.type==="reload":t?.navigation?.type===f}function u({path:t,layers:n,files:r,sessionId:i,agentId:o,include:s,navigate:c}){const a=t.trim();if(!a)return e.jsx("div",{className:"rd-viewer",children:e.jsx("div",{className:"rd-center",children:e.jsxs("div",{className:"rd-center-card",children:[e.jsx("div",{className:"rd-center-title",children:"No worktree path"}),e.jsxs("div",{className:"rd-center-body",children:["This page needs a ",e.jsx("code",{children:"?path=<absolute-path>"})," query parameter."]})]})})});const d=[a,n?.join(",")??"",r?.join("\0")??"",i??"",o??"",s??""].join(""),p=m();return e.jsx(l,{path:a,layers:n,files:r,session:i||o?{sessionId:i,agentId:o,include:s}:null,forceInitialLoad:p,onClose:()=>c({view:"repos"})},d)}export{u as RepoDiffPageScreen,u as default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{r as l,j as n}from"./index-DMiGbrBt.js";import{a as X,p as Z}from"./ui-LM8pS8qE.js";/* empty css */import{a as T,s as q,l as ee,L as te,f as K,S as ne,r as se,b as re,c as _,d as ie,u as ae,V as A,C as H,D as le,e as oe}from"./usePierreRuntime-wC-yMtBb.js";import{C as ce}from"./chevron-down-BGk5qoEw.js";import{C as de}from"./check-DjgFiBxb.js";import{L as ue}from"./loader-circle-CbHjZsz1.js";import{S as fe}from"./send-horizontal-Bg5-QggH.js";import{c as he}from"./createLucideIcon-OpA4Amw5.js";import{C as me}from"./code-xml-B6jOCM4V.js";import{X as pe}from"./x-D3GElQbe.js";import{r as O,a as V,f as Y}from"./cache-Dr0why2k.js";import{M as xe}from"./message-square-DSaGpjFU.js";import{R as ge}from"./refresh-cw-BBmAnCB7.js";import{P as be}from"./plus--b1raV_O.js";import{a as B}from"./api-h5zurxmi.js";const ye=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],je=he("file-code-corner",ye);function ke({snapshot:e,selectedFile:t,targets:r,targetId:s,onTargetId:i,draft:c,onDraft:h,contextItems:o,onRemoveContextItem:x,pending:a,status:d,error:g,textareaRef:C,onSubmit:$}){const[u,y]=l.useState(!1),b=l.useRef(null),w=r.find(m=>m.id===s)??null,p=w?.label??"Scout",j=r[0]?.id??null,S=t?T(t):null,v=(c.trim().length>0||o.length>0)&&!a,P=l.useMemo(()=>[...r.map(m=>({id:m.id,label:m.label,suffix:m.id===j?"best context":null})),{id:"scout",label:"Scout",suffix:null}],[j,r]);return l.useEffect(()=>{if(!u)return;const m=k=>{const D=b.current;D&&k.target instanceof Node&&D.contains(k.target)||y(!1)};return document.addEventListener("pointerdown",m),()=>document.removeEventListener("pointerdown",m)},[u]),n.jsxs("div",{className:"rd-comment",children:[o.length>0?n.jsx("div",{className:"rd-comment-context","aria-label":"Included diff context",children:o.map(m=>n.jsx(Ce,{item:m,disabled:a,onRemove:x},m.id))}):null,n.jsxs("div",{className:"rd-comment-main",children:[n.jsxs("div",{className:"rd-target-picker",ref:b,children:[n.jsxs("button",{type:"button",className:"rd-target-button",onClick:()=>y(m=>!m),onKeyDown:m=>{m.stopPropagation(),m.key==="Escape"&&y(!1)},disabled:a,"aria-label":"Diff comment target","aria-haspopup":"listbox","aria-expanded":u,title:"Diff comment target",children:[n.jsx("span",{children:p}),n.jsx(ce,{size:13,strokeWidth:2,"aria-hidden":!0})]}),u?n.jsx("div",{className:"rd-target-menu",role:"listbox","aria-label":"Diff comment target",children:P.map(m=>{const k=m.id===(w?.id??"scout");return n.jsxs("button",{type:"button",className:"rd-target-option",role:"option","aria-selected":k,onClick:()=>{i(m.id),y(!1)},children:[n.jsx("span",{className:"rd-target-option-label",children:m.label}),m.suffix?n.jsx("span",{className:"rd-target-option-suffix",children:m.suffix}):null,n.jsx("span",{className:"rd-target-option-check","aria-hidden":!0,children:k?n.jsx(de,{size:12,strokeWidth:2.2}):null})]},m.id)})}):null]}),n.jsx("textarea",{ref:C,value:c,onChange:m=>h(m.currentTarget.value),onKeyDown:m=>{m.stopPropagation(),(m.metaKey||m.ctrlKey)&&m.key==="Enter"&&(m.preventDefault(),$())},rows:1,disabled:a,placeholder:o.length>0?`Send to ${p} with included context`:"Leave a note on this diff…","aria-label":"Diff comment"}),n.jsxs("button",{type:"button",className:"rd-comment-send",disabled:!v,onClick:$,title:"Send diff comment","aria-label":"Send diff comment",children:[a?n.jsx(ue,{size:13,className:"rd-comment-spin","aria-hidden":!0}):n.jsx(fe,{size:13,"aria-hidden":!0}),n.jsx("span",{children:a?"Sending":"Send"})]})]}),n.jsx("div",{className:"rd-comment-meta",children:g?n.jsx("span",{className:"err",children:g}):d?n.jsx("span",{className:"ok",children:d}):n.jsxs("span",{children:[e.scope?.kind==="session"?"Session diff":"Worktree diff",S?` · ${S}`:""]})})]})}function Ce({item:e,disabled:t,onRemove:r}){const s=e.kind==="file"?je:me;return n.jsxs("div",{className:`rd-context-item ${e.kind}`,children:[n.jsxs("div",{className:"rd-context-head",children:[n.jsx("span",{className:"rd-context-icon","aria-hidden":!0,children:n.jsx(s,{size:12,strokeWidth:2})}),n.jsx("span",{className:"rd-context-label",title:e.label,children:e.label}),n.jsx("span",{className:"rd-context-detail",children:e.detail}),n.jsx("button",{type:"button",className:"rd-context-remove",onClick:()=>r(e.id),disabled:t,title:"Remove included context","aria-label":"Remove included context",children:n.jsx(pe,{size:11,strokeWidth:2.2,"aria-hidden":!0})})]}),e.preview?n.jsx("pre",{className:"rd-context-preview",children:e.preview}):null]})}function $e({heading:e,worktreePath:t,snapshot:r,freshness:s,activeLayer:i,onLayer:c,layout:h,onLayout:o,refreshing:x,onRefresh:a,onFocusComment:d,onClose:g,onOpenAsPage:C}){const{dir:$}=q(t);return n.jsxs("div",{className:"rd-header",children:[n.jsxs("div",{className:"rd-header-id",children:[n.jsxs("div",{className:"rd-header-title",children:[n.jsx("span",{className:"rd-header-name",title:t,children:e}),r.scope?n.jsx(Ne,{snapshot:r}):null,$?n.jsx("span",{className:"rd-header-dir",children:$}):null]}),n.jsx("div",{className:"rd-header-sub",children:n.jsx(ve,{layers:r.layers,activeLayer:i,onLayer:c})}),n.jsx(we,{freshness:s,generatedAt:r.generatedAt})]}),n.jsxs("div",{className:"rd-header-actions",children:[n.jsx("button",{type:"button",className:"rd-close","aria-label":"Comment on diff",title:"Comment on diff",onClick:d,children:n.jsx(xe,{size:14,strokeWidth:2,"aria-hidden":!0})}),n.jsxs("div",{className:"rd-segmented",role:"group","aria-label":"Diff layout",children:[n.jsx("button",{type:"button",className:h==="unified"?"on":"","aria-pressed":h==="unified",onClick:()=>o("unified"),children:"Unified"}),n.jsx("button",{type:"button",className:h==="split"?"on":"","aria-pressed":h==="split",onClick:()=>o("split"),children:"Split"})]}),n.jsx("button",{type:"button",className:`rd-close${x?" spinning":""}`,"aria-label":"Refresh diff",title:"Fetch fresh diff",onClick:a,disabled:x,children:n.jsx(ge,{size:14,strokeWidth:2,"aria-hidden":!0})}),C?n.jsx("button",{type:"button",className:"rd-close","aria-label":"Open diff as page",title:"Open as full page",onClick:C,children:"↗"}):null,g?n.jsx("button",{type:"button",className:"rd-close","aria-label":"Close",onClick:g,children:"✕"}):null]})]})}function Se({snapshot:e}){const t=[];e.coverage.truncatedLayers>0&&t.push({level:"warning",text:`${e.coverage.truncatedLayers} layer${e.coverage.truncatedLayers===1?"":"s"} truncated — the native diff hit a size budget; some files or hunks are omitted.`}),e.coverage.scanBudgetReached&&t.push({level:"warning",text:"Scan budget reached — this diff is partial."});for(const r of e.diagnostics)t.push({level:r.level,text:r.path?`${r.message} (${r.path})`:r.message});return t.length===0?null:n.jsx(n.Fragment,{children:t.map((r,s)=>n.jsxs("div",{className:`rd-banner ${r.level}`,children:[n.jsx("span",{className:"rd-banner-dot","aria-hidden":!0}),n.jsx("span",{children:r.text})]},s))})}function Ne({snapshot:e}){const t=e.scope;if(!t)return null;const r=t.kind==="session"?`Session · ${t.filteredPaths.length} files`:t.filteredPaths.length>0?`Filtered · ${t.filteredPaths.length} files`:"Worktree",s=t.kind==="session"?`${t.label}: path-filtered diff from ${t.changedFiles} changed / ${t.touchedFiles} touched session files`:t.label;return n.jsx("span",{className:`rd-scope-pill ${t.kind}`,title:s,children:r})}function we({freshness:e,generatedAt:t}){const r=e?.fetchedAt??t,s=Math.max(0,Date.now()-r),i=e?.cacheHit?`Prefetched ${O(s)}`:`Updated ${O(s)}`;return n.jsxs("div",{className:"rd-freshness",title:new Date(r).toLocaleString(),children:[n.jsx("span",{children:i}),e?.refreshing?n.jsx("span",{children:"Refreshing…"}):null,e?.refreshError?n.jsx("span",{children:"Refresh failed"}):null]})}function ve({layers:e,activeLayer:t,onLayer:r}){return n.jsx("div",{className:"rd-layers",role:"tablist","aria-label":"Diff layers",children:e.map(s=>{const i=ee(s);return n.jsxs("button",{type:"button",role:"tab","aria-selected":s.kind===t,className:"rd-layer-tab"+(s.kind===t?" on":""),onClick:()=>r(s.kind),title:s.shortstat??void 0,children:[n.jsx("span",{children:te[s.kind]??s.kind}),n.jsx("span",{className:"rd-layer-stat",children:s.files.length===0?"clean":n.jsxs(n.Fragment,{children:[s.files.length,"f"," ",n.jsxs("span",{style:{color:"var(--rd-add)"},children:["+",i.add]})," ",n.jsxs("span",{style:{color:"var(--rd-del)"},children:["−",i.del]}),s.truncated?" ⚠":""]})})]},s.kind)})})}const G="openscout.repo-diff.files-rail-width",U=268,Ie=196,De=520;function Re(e,t){if(e.length<=t)return e;const r=e.lastIndexOf(".");if(r<=0){const x=Math.max(1,Math.floor((t-1)/2)),a=t-x-1;return e.slice(0,x)+"…"+e.slice(-Math.max(1,a))}const s=e.slice(0,r),i=e.slice(r),c=t-i.length-1;if(c<2){const x=Math.max(1,t-i.length-1);return s.slice(0,x)+"…"+i}const h=Math.max(1,Math.floor(c/2)),o=Math.max(1,c-h);return s.slice(0,h)+"…"+s.slice(-o)+i}function Le(e,t){return Math.max(8,Math.floor((e-178-t*14)/6.7))}function W(e){return Math.max(Ie,Math.min(De,Math.round(e)))}function Pe(){if(typeof window>"u")return U;const e=Number(window.localStorage.getItem(G));return Number.isFinite(e)?W(e):U}function Me(e){const t={name:"",path:"",firstIndex:Number.MAX_SAFE_INTEGER,children:new Map,files:[]};for(const r of e){t.firstIndex=Math.min(t.firstIndex,r.index);const s=r.dir?r.dir.split("/").filter(Boolean):[];let i=t;for(const c of s){const h=i.path?`${i.path}/${c}`:c;let o=i.children.get(c);o||(o={name:c,path:h,firstIndex:r.index,children:new Map,files:[]},i.children.set(c,o)),o.firstIndex=Math.min(o.firstIndex,r.index),i=o}i.files.push(r)}return t}function J(e){let t=e.files.length;for(const r of e.children.values())t+=J(r);return t}function Ee({layer:e,selectedFileKey:t,onSelect:r,onIncludeFile:s}){const[i,c]=l.useState(Pe),[h,o]=l.useState(()=>new Set),x=l.useMemo(()=>(e?.files??[]).map((u,y)=>{const b=K(u,y),w=T(u),{name:p,dir:j}=q(w),S=(u.status==="renamed"||u.status==="copied")&&u.oldPath&&u.newPath&&u.oldPath!==u.newPath;return{file:u,index:y,key:b,display:w,name:p,dir:j,renamed:!!S}}),[e]),a=l.useMemo(()=>Me(x),[x]),d=l.useCallback(u=>{o(y=>{const b=new Set(y);return b.has(u)?b.delete(u):b.add(u),b})},[]),g=l.useCallback(u=>{u.preventDefault();const y=u.clientX,b=i,w=j=>{c(W(b+j.clientX-y))},p=()=>{window.removeEventListener("pointermove",w),window.removeEventListener("pointerup",p),c(j=>{const S=W(j);return window.localStorage.setItem(G,String(S)),S})};window.addEventListener("pointermove",w),window.addEventListener("pointerup",p,{once:!0})},[i]),C=(u,y)=>n.jsx(Fe,{entry:u,depth:y,railWidth:i,selected:u.key===t,onSelect:r,onIncludeFile:s},u.key),$=(u,y)=>{const b=[],w=[...u.children.values()].sort((p,j)=>p.firstIndex!==j.firstIndex?p.firstIndex-j.firstIndex:p.name.localeCompare(j.name));for(const p of w){const j=h.has(p.path);b.push(n.jsxs("button",{type:"button",className:"rd-dir-row",style:{paddingLeft:12+y*14},onClick:()=>d(p.path),title:p.path,children:[n.jsx("span",{className:"rd-dir-caret",children:j?"›":"⌄"}),n.jsx("span",{className:"rd-dir-name",children:p.name}),n.jsx("span",{className:"rd-dir-count",children:J(p)})]},`dir:${p.path}`)),j||b.push(...$(p,y+1))}for(const p of u.files)b.push(C(p,y));return b};return n.jsxs("div",{className:"rd-rail",style:{width:i},children:[n.jsx("div",{className:"rd-rail-head",children:e?`Changed files · ${e.files.length}`:"Changed files"}),n.jsx("div",{className:"rd-rail-list",children:$(a,0)}),n.jsx("div",{className:"rd-rail-resizer",role:"separator","aria-orientation":"vertical","aria-label":"Resize file navigation",onPointerDown:g})]})}function Fe({entry:e,depth:t,railWidth:r,selected:s,onSelect:i,onIncludeFile:c}){const{file:h,key:o,display:x,name:a,dir:d,renamed:g}=e,C=Le(r,t),$=Re(a,C);return n.jsxs("div",{className:"rd-file-row"+(s?" on":""),title:g?`${h.oldPath} → ${h.newPath}`:x,children:[n.jsxs("button",{type:"button",className:"rd-file-pick",style:{paddingLeft:18+t*14},onClick:()=>i(o),children:[n.jsx("span",{className:`rd-file-glyph ${h.status}`,children:ne[h.status]}),n.jsxs("span",{className:"rd-file-id",children:[n.jsx("span",{className:"rd-file-name",children:$}),n.jsx("span",{className:"rd-file-dir",children:g?`${h.oldPath} → ${d||a}`:d}),n.jsx(Te,{file:h})]})]}),n.jsx("span",{className:"rd-file-churn",children:h.binary?n.jsx("span",{className:"add",style:{color:"var(--muted)"},children:"bin"}):n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"add",children:["+",h.additions??0]}),n.jsxs("span",{className:"del",children:["−",h.deletions??0]})]})}),n.jsx("button",{type:"button",className:"rd-file-include",onClick:u=>{u.stopPropagation(),c(h,o)},"aria-label":`Include ${x} in comment`,title:"Include in comment",children:n.jsx(be,{size:12,strokeWidth:2,"aria-hidden":!0})})]})}function Te({file:e}){const t=[];return e.binary&&t.push("BINARY"),e.truncated&&t.push("TRUNCATED"),e.status==="conflict"&&t.push("CONFLICT"),t.length===0?null:n.jsx("span",{className:"rd-file-tags",children:t.map(r=>n.jsx("span",{className:"rd-file-tag",children:r},r))})}function Ae(e){switch(e?.trim().toLowerCase()){case"active":case"working":case"running":case"in_turn":return 80;case"queued":case"waiting":case"waking":case"in_flight":return 50;case"idle":case"available":return 25;case"offline":case"retired":case"stale":return-40;default:return 0}}function Ke(e){return e.newPath??e.oldPath??"(unknown)"}function Q(e){const t=e.scope?.kind==="session"?e.scope.agentId:null,r=new Map;for(const s of e.scout.hints)s.agentId&&r.set(s.agentId,(r.get(s.agentId)??0)+1);return e.scout.agents.map(s=>({id:s.id,label:X(s),score:Ae(s.state)+(s.id===t?1e3:0)+(r.get(s.id)??0)*10})).sort((s,i)=>{const c=i.score-s.score;return c!==0?c:s.label.localeCompare(i.label)})}function We(e){return Q(e)[0]??null}function ze(e){const t=e.files.reduce((r,s)=>({add:r.add+(s.additions??0),del:r.del+(s.deletions??0)}),{add:0,del:0});return`${e.kind}: ${e.files.length} file${e.files.length===1?"":"s"}, +${t.add} -${t.del}${e.truncated?", truncated":""}`}function z(e){const t=e.binary?"binary":`+${e.additions??0} -${e.deletions??0}`;return`${e.status}: ${Ke(e)} (${t}${e.truncated?", truncated":""})`}function _e(e){const t=e.scope;return t?t.kind==="session"?`session ${t.sessionId??t.refId??"(unknown)"} (${t.changedFiles} changed / ${t.touchedFiles} touched files, ${t.include})`:t.filteredPaths.length>0?`filtered worktree (${t.filteredPaths.length} paths)`:"worktree":"worktree"}function He(e){const{comment:t,includedContext:r=[],snapshot:s,activeLayer:i,selectedFile:c}=e,o=((i?s.layers.find(d=>d.kind===i)??null:null)?.files??s.layers.flatMap(d=>d.files)).slice(0,12).map(z),x=s.scout.agents.map(d=>X(d)).slice(0,8),a=["Operator comment on repo diff:",t,"","Repo Diff context:",`- Worktree: ${s.worktreePath}`,`- Scope: ${_e(s)}`,`- Active layer: ${i??"none"}`];return r.length>0&&a.splice(3,0,"Included diff context:",...r.map(d=>d.trim()).filter(Boolean),""),c&&a.push(`- Selected file: ${z(c)}`),a.push(`- Layers: ${s.layers.map(ze).join("; ")}`),x.length>0&&a.push(`- Attached agents: ${x.join(", ")}`),s.scout.sessions.length>0&&a.push(`- Sessions: ${s.scout.sessions.map(d=>d.id).slice(0,8).join(", ")}`),o.length>0&&a.push(`- Changed files: ${o.join(", ")}`),s.diagnostics.length>0&&a.push(`- Diagnostics: ${s.diagnostics.map(d=>d.message).join("; ")}`),a.join(`
|
|
2
|
+
`)}function Oe(e){const{snapshot:t,activeLayer:r,file:s}=e,i=[r??"diff",z(s)];return t.scope?.kind==="session"&&i.push(`session ${t.scope.sessionId??t.scope.refId??"scope"}`),`[Diff context: ${i.join(" · ")}]`}function Be(e,t,r){return!e||!t?null:e.files.find((s,i)=>r(s,i)===t)??null}function Ue(e,t=120){const r=e.replace(/\s+/g," ").trim();return r.length>t?`${r.slice(0,t-3)}...`:r}function Xe(e,t=7){const r=e.trimEnd().split(`
|
|
3
|
+
`),s=r.slice(0,t),i=r.length-s.length;return i>0?`${s.join(`
|
|
4
|
+
`)}
|
|
5
|
+
... ${i} more line${i===1?"":"s"}`:s.join(`
|
|
6
|
+
`)}function qe(e){return e.newLine!=null?`L${e.newLine}`:e.oldLine!=null?`old L${e.oldLine}`:"line"}function Ve(e){return e.side==="add"?"+":e.side==="del"?"-":" "}function Ye(e){const{snapshot:t,activeLayer:r,file:s}=e,i=T(s),c=s.binary?"binary":`+${s.additions??0} -${s.deletions??0}`;return{id:`file:${r??"diff"}:${i}`,kind:"file",label:i,detail:`${r??"diff"} · ${s.status} · ${c}`,preview:null,snippet:Oe({snapshot:t,activeLayer:r,file:s})}}function Ge(e){const{line:t}=e,r=Ve(t);return{id:`line:${t.layer}:${t.filePath}:${t.side}:${t.oldLine??""}:${t.newLine??""}`,kind:"line",label:`${t.filePath}:${qe(t)}`,detail:`${t.layer} · ${r}`,preview:`${r} ${Ue(t.text,180)}`,snippet:se({line:t})}}function Je(e){const{selection:t}=e,r=t.filePath??"diff selection",s=t.text.trim().split(`
|
|
7
|
+
`).filter(Boolean).length;return{id:`selection:${t.layer??"diff"}:${r}:${t.text}`,kind:"selection",label:r,detail:`${t.layer??"diff"} · ${s} line${s===1?"":"s"}`,preview:Xe(t.text),snippet:re({selection:t})}}function Qe({snapshot:e,activeLayer:t,selectedFile:r,setSelectedFileKey:s,resetKey:i}){const[c,h]=l.useState(""),[o,x]=l.useState([]),[a,d]=l.useState("scout"),[g,C]=l.useState(!1),[$,u]=l.useState(!1),[y,b]=l.useState(null),[w,p]=l.useState(null),j=l.useRef(null),S=l.useMemo(()=>e?Q(e):[],[e]),v=l.useMemo(()=>e?We(e):null,[e]);l.useEffect(()=>{h(""),x([]),C(!1),b(null),p(null)},[i]),l.useEffect(()=>{d(f=>g&&f==="scout"||S.some(N=>N.id===f)?f:v?.id??"scout")},[g,S,v?.id]);const P=l.useCallback(f=>{h(f),b(null),p(null)},[]),m=l.useCallback(f=>{C(!0),d(f)},[]),k=l.useCallback(f=>{x(N=>N.some(F=>F.id===f.id)?N:[...N,f]),b(null),p(null),queueMicrotask(()=>j.current?.focus())},[]),D=l.useCallback(f=>{x(N=>N.filter(F=>F.id!==f)),b(null),p(null)},[]),L=l.useCallback(async()=>{const f=c.trim();if(!f&&o.length===0||$||!e)return;const N=S.find(E=>E.id===a)??null,F=He({comment:f||"Please review the included diff context.",includedContext:o.map(E=>E.snippet),snapshot:e,activeLayer:t,selectedFile:r});u(!0),b(null),p(null);try{N?(await B("/api/ask",{method:"POST",body:JSON.stringify({body:F,targetAgentId:N.id,targetLabel:N.label,metadata:{source:"repo-diff",originSurface:"repo-diff",handoffKind:"repo-diff-comment",targetAgentId:N.id,worktreePath:e.worktreePath,activeLayer:t,selectedFile:r?T(r):null,scopeKind:e.scope?.kind??"worktree"}})}),b(`Sent to ${N.label}`)):(await B("/api/send",{method:"POST",body:JSON.stringify({body:F})}),b("Sent to Scout")),h(""),x([])}catch(E){p(E instanceof Error?E.message:String(E))}finally{u(!1)}},[t,o,c,$,a,S,r,e]),I=l.useCallback((f,N)=>{e&&(s(N),k(Ye({snapshot:e,activeLayer:t,file:f})))},[t,k,s,e]),M=l.useCallback(f=>{e&&k(Ge({line:f}))},[k,e]),R=l.useCallback(f=>{e&&k(Je({selection:f}))},[k,e]);return{targets:S,targetId:a,setTargetId:m,draft:c,setDraft:P,contextItems:o,removeContextItem:D,pending:$,status:y,error:w,textareaRef:j,submit:L,includeFileInComment:I,includeLineInComment:M,includeSelectionInComment:R}}function Ze({path:e,activeLayer:t,selectedFile:r,snapshotKey:s}){const i=r?T(r):null,c=`${e}\0${t??""}\0${i??""}\0${s}`,[h,o]=l.useState({layer:null,phase:"idle",error:null}),x=l.useRef(c),a=l.useMemo(()=>!t||!i?null:V(e,[t],{files:[i],tier:"patch",cacheScope:s}),[t,i,e,s]);return l.useEffect(()=>{if(x.current=c,!t||!i){o({layer:null,phase:"idle",error:null});return}if(a?.fresh){o({layer:a.snapshot.layers[0]??null,phase:"ready",error:null});return}o({layer:null,phase:"loading",error:null}),Y(e,[t],{files:[i],tier:"patch",cacheScope:s}).then(d=>{x.current===c&&o({layer:d.snapshot.layers[0]??null,phase:"ready",error:null})},d=>{x.current===c&&o(g=>({layer:g.layer,phase:"error",error:d instanceof Error?d.message:String(d)}))})},[t,a,i,e,c]),h}function et(e){const[t,r]=l.useState(null),[s,i]=l.useState(null),[c,h]=l.useState("split");l.useEffect(()=>{e&&h(e.render.preferredLayout==="stacked"?"unified":"split")},[e]),l.useEffect(()=>{if(!e)return;const d=e.layers.filter(g=>g.files.length>0)[0]??e.layers[0]??null;r(g=>g&&e.layers.some(C=>C.kind===g)?g:d?d.kind:null)},[e]);const o=l.useMemo(()=>!e||!t?null:e.layers.find(a=>a.kind===t)??null,[e,t]),x=l.useMemo(()=>Be(o,s,K),[o,s]);return l.useEffect(()=>{if(!o){i(null);return}i(a=>{const d=o.files.map((g,C)=>K(g,C));return a&&d.includes(a)?a:d[0]??null})},[o]),{activeLayer:t,setActiveLayer:r,layer:o,selectedFileKey:s,setSelectedFileKey:i,selectedFile:x,layout:c,setLayout:h}}function tt({path:e,layers:t,files:r,session:s,tier:i="summary",forceInitialLoad:c}){const h=t.join(","),o=l.useMemo(()=>h.split(","),[h]),x=(r??[]).join("\0"),a=s?`${s.sessionId??""}\0${s.agentId??""}\0${s.include??"changed"}`:"",d=l.useMemo(()=>({files:x?x.split("\0").filter(Boolean):void 0,tier:i,session:a?{sessionId:s?.sessionId??null,agentId:s?.agentId??null,include:s?.include??"changed"}:null}),[x,s?.agentId,s?.include,s?.sessionId,a,i]),[g,C]=l.useState(null),[$,u]=l.useState("loading"),[y,b]=l.useState(null),[w,p]=l.useState(null),j=l.useRef(null),S=l.useRef(!1);l.useEffect(()=>{j.current=g},[g]);const v=l.useCallback(async(m={})=>{const k=V(e,o,d),D=m.force===!0||c&&!S.current,L=m.preserveCurrent===!0&&j.current!=null;b(null),k&&!D?(C(k.snapshot),p(_(k,!0)),u("ready")):L?(p(I=>({fetchedAt:I?.fetchedAt??Date.now(),cacheHit:I?.cacheHit??!1,refreshing:!0,refreshError:null})),u("ready")):(u("loading"),p(null));try{const I=await Y(e,o,{force:D||k!=null,...d});D&&(S.current=!0),C(I.snapshot),p(ie(I,!1)),u("ready")}catch(I){const M=I instanceof Error?I.message:String(I);k?(p(_(k,!1,M)),u("ready")):L?(p(R=>R&&{...R,refreshing:!1,refreshError:M}),u("ready")):(b(M),u("error"))}},[c,e,o,d]);l.useEffect(()=>{v()},[v]);const P=l.useCallback(()=>{v({force:!0,preserveCurrent:!0})},[v]);return{snapshot:g,fetchPhase:$,fetchError:y,freshness:w,filesKey:x,sessionKey:a,requestedLayers:o,loadSnapshot:v,refreshSnapshot:P}}function bt({path:e,layers:t=oe,files:r,session:s,forceInitialLoad:i=!1,onClose:c,onOpenAsPage:h,className:o,title:x}){const{snapshot:a,fetchPhase:d,fetchError:g,freshness:C,filesKey:$,sessionKey:u,loadSnapshot:y,refreshSnapshot:b}=tt({path:e,layers:t,files:r,session:s,tier:"summary",forceInitialLoad:i}),{pierre:w,pierrePhase:p,pierreError:j,retryPierre:S}=ae(a),{activeLayer:v,setActiveLayer:P,layer:m,selectedFileKey:k,setSelectedFileKey:D,selectedFile:L,layout:I,setLayout:M}=et(a),R=Ze({path:e,activeLayer:v,selectedFile:L,snapshotKey:a?.render.renderKey??""}),f=Qe({snapshot:a,activeLayer:v,selectedFile:L,setSelectedFileKey:D,resetKey:`${e}\0${$}\0${u}`});if(d==="loading"&&!a)return n.jsx(A,{className:o,children:n.jsxs(H,{children:[n.jsx("div",{className:"rd-spinner","aria-hidden":!0}),n.jsxs("div",{className:"rd-center-title",children:["Reading ",s?"session":"worktree"," diff…"]}),n.jsx("div",{className:"rd-center-body",children:e})]})});if(d==="error"&&!a)return n.jsx(A,{className:o,children:n.jsxs(H,{children:[n.jsx("div",{className:"rd-center-title",children:"Couldn’t load the diff"}),n.jsx("div",{className:"rd-center-body",children:g??"The broker did not return a diff snapshot."}),n.jsx("div",{className:"rd-center-action",children:n.jsx("button",{type:"button",className:"rd-btn",onClick:()=>{y()},children:"Retry"})})]})});if(!a)return n.jsx(A,{className:o});const N=x??Z(a.worktreePath);return n.jsxs(A,{className:o,children:[n.jsx($e,{heading:N,worktreePath:a.worktreePath,snapshot:a,freshness:C,activeLayer:v,onLayer:P,layout:I,onLayout:M,refreshing:C?.refreshing===!0,onRefresh:b,onFocusComment:()=>{f.textareaRef.current?.scrollIntoView({block:"nearest"}),f.textareaRef.current?.focus()},onClose:c,onOpenAsPage:h}),n.jsx(Se,{snapshot:a}),n.jsxs("div",{className:"rd-body",children:[n.jsx(Ee,{layer:m,selectedFileKey:k,onSelect:D,onIncludeFile:f.includeFileInComment}),n.jsx(ke,{snapshot:a,selectedFile:L,targets:f.targets,targetId:f.targetId,onTargetId:f.setTargetId,draft:f.draft,onDraft:f.setDraft,contextItems:f.contextItems,onRemoveContextItem:f.removeContextItem,pending:f.pending,status:f.status,error:f.error,textareaRef:f.textareaRef,onSubmit:f.submit}),n.jsx(le,{layer:m,patchLayer:R.layer,patchPhase:R.phase,patchError:R.error,selectedFileKey:k,renderKey:a.render.renderKey,theme:a.render.preferredTheme,layout:I,pierre:w,pierrePhase:p,pierreError:j,onRetryPierre:S,onIncludeLineContext:f.includeLineInComment,onIncludeSelectionContext:f.includeSelectionInComment})]})]})}export{bt as RepoDiffViewer,bt as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RepoDiffViewer-D_exm6xK.js","assets/index-DMiGbrBt.js","assets/index-DxGoC5l5.css","assets/ui-LM8pS8qE.js","assets/usePierreRuntime-wC-yMtBb.js","assets/chevron-down-BGk5qoEw.js","assets/createLucideIcon-OpA4Amw5.js","assets/check-DjgFiBxb.js","assets/loader-circle-CbHjZsz1.js","assets/send-horizontal-Bg5-QggH.js","assets/code-xml-B6jOCM4V.js","assets/x-D3GElQbe.js","assets/cache-Dr0why2k.js","assets/api-h5zurxmi.js","assets/message-square-DSaGpjFU.js","assets/refresh-cw-BBmAnCB7.js","assets/plus--b1raV_O.js","assets/repo-diff-C9Qs-bEn.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as e,r as i,_ as s}from"./index-DMiGbrBt.js";/* empty css */const a=i.lazy(()=>s(()=>import("./RepoDiffViewer-D_exm6xK.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])).then(r=>({default:r.RepoDiffViewer})));function t(){return e.jsx("div",{className:"rd-viewer","data-scout-theme":!0,children:e.jsx("div",{className:"rd-center",children:e.jsxs("div",{className:"rd-center-card",children:[e.jsx("div",{className:"rd-spinner","aria-hidden":!0}),e.jsx("div",{className:"rd-center-title",children:"Opening diff viewer…"})]})})})}function c(r){return e.jsx(i.Suspense,{fallback:e.jsx(t,{}),children:e.jsx(a,{...r})})}export{c as R};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{r as u,j as e}from"./index-DMiGbrBt.js";import{E as se}from"./EmptyState-4F9XDFQm.js";import{u as We}from"./ContextMenu-bARZqTzD.js";import{f as he,b as qe}from"./api-BkjHJfgJ.js";import{a as _e}from"./api-h5zurxmi.js";import{c as te}from"./clipboard-e3fSpeo7.js";import{u as Be}from"./keyboard-nav-2kv_tGUS.js";/* empty css */import{f as w,c as He,b as Ce,r as Ee,u as Pe,i as ie,w as Ae,k as Ie,l as Ue,m as G,a as X,s as Ke,h as Ve}from"./ui-LM8pS8qE.js";import{B as Me,p as ze,c as Ge}from"./selection-bridge-16pk1qyG.js";import{S as Xe}from"./SlidePanel-COwtoJqR.js";import{R as Ye}from"./RepoDiffViewerLazy-BPgF92Bg.js";import{p as Je}from"./cache-Dr0why2k.js";import{u as Qe}from"./Provider-C7UKGHQy.js";import{R as Ze}from"./refresh-cw-BBmAnCB7.js";import{S as es}from"./sliders-horizontal-1oW76Xc9.js";/* empty css */import"./router-Bq5dwf78.js";import"./terminal-sessions-D5CIR2OL.js";import"./sse-CjIkKo46.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BTIErYHo.js";import"./DocumentFocusViewer-BeVwwl26.js";import"./createLucideIcon-OpA4Amw5.js";import"./TextDocumentSurface-BpAw4eQS.js";/* empty css */import"./file-text-BODxCjcz.js";import"./x-D3GElQbe.js";import"./chevron-right-XiIHsk4m.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./NewChatComposer-Cs6OsxK6.js";import"./runtime-picker-Bcl5iIX5.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-CbHjZsz1.js";import"./index-CJXzfjo9.js";import"./HarnessMark-Cbv3Ib0c.js";import"./conversation-model-B47vYmWN.js";import"./time-DltNTpLl.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-BGk5qoEw.js";import"./search-CWfZtOt2.js";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 _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 ${Ke(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 Ue(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)?Ve(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}=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 nn({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{nn as ReposScreen,nn as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as d,j as t}from"./index-DMiGbrBt.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-CU5c0LGi.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};
|