@openscout/scout 0.2.106 → 0.2.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (473) hide show
  1. package/README.md +79 -16
  2. package/bin/scoutd +0 -0
  3. package/dist/build-manifest.json +3 -3
  4. package/dist/client/assets/ActivityScreen-C1H-vL0L.js +1 -0
  5. package/dist/client/assets/{AddProjectForm-CusDRiVO.js → AddProjectForm-4sVXmjfN.js} +1 -1
  6. package/dist/client/assets/{AdventureEvidence-CyegKk1V.js → AdventureEvidence-D5wq1vu8.js} +1 -1
  7. package/dist/client/assets/{AdventureReader-X-hbTOi0.js → AdventureReader-BICypcDY.js} +1 -1
  8. package/dist/client/assets/{AdventureScenery-LPXSVP67.js → AdventureScenery-CGEcG0zV.js} +1 -1
  9. package/dist/client/assets/AgentAdventures-5yBt-Zl3.js +1 -0
  10. package/dist/client/assets/{AgentAvatar-CrP1eXxk.js → AgentAvatar-Dn8TUv5W.js} +1 -1
  11. package/dist/client/assets/AgentConfigurationScreen-C0D9WNyL.js +1 -0
  12. package/dist/client/assets/AgentDefinitionsWorkspace-BzcBdC_s.js +1 -0
  13. package/dist/client/assets/{AgentDetailCard-DtHT3sCo.js → AgentDetailCard-CI-ufaEP.js} +1 -1
  14. package/dist/client/assets/AgentFloorView-D8tlGlgy.js +1 -0
  15. package/dist/client/assets/{AgentFloorWorld-CjoIa6jA.js → AgentFloorWorld-DqmnQexg.js} +1 -1
  16. package/dist/client/assets/AgentInfoScreen-BnRhfcFy.js +1 -0
  17. package/dist/client/assets/{AgentLaneCard-BaZ2g-f8.js → AgentLaneCard-pppHFROz.js} +1 -1
  18. package/dist/client/assets/{AgentLaneChrome-TF1SlJSc.js → AgentLaneChrome-RptImDFc.js} +1 -1
  19. package/dist/client/assets/{AgentLaneDetailSheet-EzEPsn3g.js → AgentLaneDetailSheet-BqbwGskh.js} +1 -1
  20. package/dist/client/assets/{AgentLaneSummaryResize-dpp7YvrX.js → AgentLaneSummaryResize-DaIgwyVh.js} +1 -1
  21. package/dist/client/assets/AgentLanesEmbedScreen-De6C4ZOw.js +1 -0
  22. package/dist/client/assets/{AgentLanesPreflight-Ry-aqDTr.js → AgentLanesPreflight-BQfj2twF.js} +1 -1
  23. package/dist/client/assets/{AgentLanesView-BJi9xXz6.js → AgentLanesView-CiISx7pu.js} +1 -1
  24. package/dist/client/assets/{AgentLiveActions-CfTupTEl.js → AgentLiveActions-CkRGkv13.js} +1 -1
  25. package/dist/client/assets/AgentMasterScreen-CijN_4tN.js +1 -0
  26. package/dist/client/assets/{AgentSessions-B1gOhDBf.js → AgentSessions-ghjQcSrh.js} +2 -2
  27. package/dist/client/assets/AgentsConsole-D8upjDpn.js +1 -0
  28. package/dist/client/assets/AgentsScreen-C17BFqjf.js +1 -0
  29. package/dist/client/assets/AgentsSubnav-_1GVC4hj.js +1 -0
  30. package/dist/client/assets/{AstronautSuit-Cchnc4Ug.js → AstronautSuit-Dzu4GOMR.js} +1 -1
  31. package/dist/client/assets/{AtopView-gkEp4y__.js → AtopView-DJK5b3lZ.js} +1 -1
  32. package/dist/client/assets/{BackToPicker-CUkjnoVk.js → BackToPicker-BPU7kbXq.js} +1 -1
  33. package/dist/client/assets/BriefingDetailScreen-CTvFw523.js +1 -0
  34. package/dist/client/assets/{BriefingsScreen-B1HlBMGZ.js → BriefingsScreen-DpVC3OUk.js} +1 -1
  35. package/dist/client/assets/{BrokerMetadataPanel-Dk242Yh_.js → BrokerMetadataPanel-glRVdwkU.js} +1 -1
  36. package/dist/client/assets/BrokerScreen-CqKsBwEx.js +8 -0
  37. package/dist/client/assets/{CastPicker-BXUtPAGC.js → CastPicker-Y29K5kKk.js} +1 -1
  38. package/dist/client/assets/ChannelComposer-D4EY9jVW.js +1 -0
  39. package/dist/client/assets/{ChannelSidebar-e9DOPulb.js → ChannelSidebar-CVmykV4d.js} +1 -1
  40. package/dist/client/assets/{CharacterFamilyPreview-DMfw7UM_.js → CharacterFamilyPreview-Bj8oMD-5.js} +1 -1
  41. package/dist/client/assets/{ChatAvatar-C3a_o5Hj.js → ChatAvatar-BsAOShUr.js} +1 -1
  42. package/dist/client/assets/{ChatBits-CsvxbToF.js → ChatBits-Cq54CmyB.js} +1 -1
  43. package/dist/client/assets/{ChatCollapsedStrip-FEmQ_G9J.js → ChatCollapsedStrip-B0DdrOo2.js} +1 -1
  44. package/dist/client/assets/{ChatRichInput-DhtwFxQE.js → ChatRichInput-DYJRhGTP.js} +1 -1
  45. package/dist/client/assets/ChatRightPanel-D94Lw7ud.js +1 -0
  46. package/dist/client/assets/ChatSpaceSurface-Cp532VmZ.js +1 -0
  47. package/dist/client/assets/{ChatSpaceTheme-CUH8bTZc.js → ChatSpaceTheme-DPzYpw-v.js} +1 -1
  48. package/dist/client/assets/{CodeDiffPane-DuQRwpgK.js → CodeDiffPane-DCgMUi39.js} +1 -1
  49. package/dist/client/assets/{CodeProjectPicker-ZQ6gSBpg.js → CodeProjectPicker-Dq787L77.js} +1 -1
  50. package/dist/client/assets/{CodeScreen-BXyKeL5T.js → CodeScreen-BN4TkiR0.js} +1 -1
  51. package/dist/client/assets/{CommsCanvas-THp0r_U8.js → CommsCanvas-Dh056d91.js} +1 -1
  52. package/dist/client/assets/{CommsDeck-BVmSMV2V.js → CommsDeck-CRXKIerH.js} +1 -1
  53. package/dist/client/assets/{CommsFlowGraph-DxoOaLF_.js → CommsFlowGraph-Cc48o9u_.js} +1 -1
  54. package/dist/client/assets/{CommsFlowMap-Vi8ziCPg.js → CommsFlowMap-Ckasql5e.js} +1 -1
  55. package/dist/client/assets/{CommsSelection-BUoRbu9o.js → CommsSelection-CuphnUny.js} +1 -1
  56. package/dist/client/assets/{ComposerAttachments-DW0AIb8k.js → ComposerAttachments-9uYp_Lh5.js} +1 -1
  57. package/dist/client/assets/ConversationComposer-hYtLurqy.js +1 -0
  58. package/dist/client/assets/ConversationFeedRows-Bu0ZJcy8.js +1 -0
  59. package/dist/client/assets/ConversationHeader-L9738YVP.js +1 -0
  60. package/dist/client/assets/{ConversationPanels-D9oC0xG5.js → ConversationPanels-D6KuqvGu.js} +2 -2
  61. package/dist/client/assets/ConversationScreen-Pzxy9x4m.js +2 -0
  62. package/dist/client/assets/ConversationStatus-BEefIbXq.js +1 -0
  63. package/dist/client/assets/{CrewAvatar-kTznzqcO.js → CrewAvatar-a_C_F9r_.js} +1 -1
  64. package/dist/client/assets/{CrewSprite-Dhryjx2c.js → CrewSprite-CguHb2Ny.js} +1 -1
  65. package/dist/client/assets/{CrewStage-vdO0qm3D.js → CrewStage-IPpS3Oja.js} +1 -1
  66. package/dist/client/assets/{CrewWorkspaces-DCBzAAS4.js → CrewWorkspaces-BTPtcEcx.js} +1 -1
  67. package/dist/client/assets/{DataTable-aH-jCyDq.js → DataTable-DnL_8SAu.js} +1 -1
  68. package/dist/client/assets/{DispatchAftermath-66uQAorV.js → DispatchAftermath-CoAYaL3B.js} +1 -1
  69. package/dist/client/assets/{DocumentFocusViewer-DJr0v0D_.js → DocumentFocusViewer-mxzPxQQW.js} +1 -1
  70. package/dist/client/assets/{EmbeddableSurfacesLab-BBa70EhJ.js → EmbeddableSurfacesLab-BAZ_eRMc.js} +1 -1
  71. package/dist/client/assets/{EmptyState-CZlrHXy-.js → EmptyState-DLiLgtPK.js} +1 -1
  72. package/dist/client/assets/{FileViewerPane-BAO6mtjD.js → FileViewerPane-Dc7AoVod.js} +1 -1
  73. package/dist/client/assets/{FleetRollCallHud-C5q2567n.js → FleetRollCallHud-VhpxVcGO.js} +1 -1
  74. package/dist/client/assets/FlightObserveScreen-C1kASP3J.js +1 -0
  75. package/dist/client/assets/{FloorContextSheet-2_NVPQor.js → FloorContextSheet-BfrXNoBn.js} +1 -1
  76. package/dist/client/assets/{FloorExchangePanel-BU1pPu8K.js → FloorExchangePanel-DsG1cRzu.js} +1 -1
  77. package/dist/client/assets/{FloorMessagePasses-cLW2UGNP.js → FloorMessagePasses-Cm3LbkHd.js} +1 -1
  78. package/dist/client/assets/{FloorReplay-VFzA6Kxc.js → FloorReplay-Bg7kA-tR.js} +1 -1
  79. package/dist/client/assets/FloorResourcesSheet-Ba9HubO2.js +1 -0
  80. package/dist/client/assets/{FloorSavedWork-BeHDejWz.js → FloorSavedWork-BDOvV3mA.js} +1 -1
  81. package/dist/client/assets/{FloorTacticalHUD-CO-iiFpb.js → FloorTacticalHUD-4d-Hr-YL.js} +1 -1
  82. package/dist/client/assets/{FollowScreen-CFfkIbc6.js → FollowScreen-DFVSlsQV.js} +1 -1
  83. package/dist/client/assets/{HarnessMark-C4naWc16.js → HarnessMark-CP-PWk2W.js} +1 -1
  84. package/dist/client/assets/HarnessesScreen-j-91IoOo.js +1 -0
  85. package/dist/client/assets/{HerdrSession-_t7yM8vX.js → HerdrSession-H2mmxeTK.js} +1 -1
  86. package/dist/client/assets/{HomeHero-DouPyNmz.js → HomeHero-g4H3Ctxg.js} +1 -1
  87. package/dist/client/assets/{HostAdvisorView-CnM1i8hW.js → HostAdvisorView-Cyt3b5Fq.js} +1 -1
  88. package/dist/client/assets/{InviteLandingScreen-CEjG2E34.js → InviteLandingScreen-C3DtAGD4.js} +1 -1
  89. package/dist/client/assets/{InviteSheet-CwxZtWCl.js → InviteSheet-BiGMNpsE.js} +1 -1
  90. package/dist/client/assets/{JumpPalette-O1aJE9gR.js → JumpPalette-goXAVByA.js} +1 -1
  91. package/dist/client/assets/{KnowledgeSearchInspector-32n9baT-.js → KnowledgeSearchInspector-BbOQIqdF.js} +1 -1
  92. package/dist/client/assets/KnowledgeSearchScreen-DC8yX-kA.js +1 -0
  93. package/dist/client/assets/{LaneToolHoverCard-CJa110yk.js → LaneToolHoverCard-B8Am_1DC.js} +1 -1
  94. package/dist/client/assets/LaneTraceDetailSheet-CngYIxdI.js +1 -0
  95. package/dist/client/assets/{LaneTraceEventFocus-TbrNHRj_.js → LaneTraceEventFocus-BRR_jcl9.js} +1 -1
  96. package/dist/client/assets/{MeshCanvas-DWZHYh1A.js → MeshCanvas-DzkuY_XI.js} +1 -1
  97. package/dist/client/assets/{MeshCanvasMinimap-iswYFpIb.js → MeshCanvasMinimap-BrscEPAH.js} +1 -1
  98. package/dist/client/assets/MeshScreen-CAtRB8K6.js +1 -0
  99. package/dist/client/assets/{MeshTopologyView-BVvtqI8q.js → MeshTopologyView-B1I2dAhu.js} +2 -2
  100. package/dist/client/assets/{MessageEmbeds-ksPazAKH.js → MessageEmbeds-B-FbWI7a.js} +1 -1
  101. package/dist/client/assets/MessagesScreen-hq7D3Lfi.js +1 -0
  102. package/dist/client/assets/{MissionContextRail-D62-Wis8.js → MissionContextRail-ClR8amG1.js} +1 -1
  103. package/dist/client/assets/MissionControlView-D6gbMrgx.js +1 -0
  104. package/dist/client/assets/{MissionFocusOverlay-C1zys3Jv.js → MissionFocusOverlay-CzeNgI9Q.js} +1 -1
  105. package/dist/client/assets/MissionLeftAgentRow-CB3cgeYr.js +1 -0
  106. package/dist/client/assets/{MissionLogPane-B19lYSY9.js → MissionLogPane-2PMEoG44.js} +1 -1
  107. package/dist/client/assets/NativeAreaScreen-BnlrAWT8.js +1 -0
  108. package/dist/client/assets/NativeAreaScreen-DSR5Tf6F.js +1 -0
  109. package/dist/client/assets/NativeAreaScreen-fGsxyeC3.js +1 -0
  110. package/dist/client/assets/{NewAgentModal-Bh-L-emz.js → NewAgentModal-4b_3aoZE.js} +1 -1
  111. package/dist/client/assets/{NewChatComposer-C97-iTMK.js → NewChatComposer-D-VB5vdt.js} +1 -1
  112. package/dist/client/assets/{NewChatOrigin-DFbF_XvR.js → NewChatOrigin-BYsEu9dZ.js} +1 -1
  113. package/dist/client/assets/{NodeDetailPanel-CElOEpCh.js → NodeDetailPanel-9NaEnZAQ.js} +1 -1
  114. package/dist/client/assets/{NodeMenu-B-jjHf1c.js → NodeMenu-BgJMmffZ.js} +1 -1
  115. package/dist/client/assets/{ObserveEmbedScreen-B7Qt69Ms.js → ObserveEmbedScreen-W7Q5HbXP.js} +2 -2
  116. package/dist/client/assets/{ObserveTextFlow-PFnG_10h.js → ObserveTextFlow-C0oQEerY.js} +2 -2
  117. package/dist/client/assets/{ObservedTopologyPanel-CUTIoLZJ.js → ObservedTopologyPanel-Ci7emnnj.js} +1 -1
  118. package/dist/client/assets/OpenScoutAppShell-Di9qdmI0.js +22 -0
  119. package/dist/client/assets/OpsAgentsView-DVotOMg2.js +1 -0
  120. package/dist/client/assets/OpsScreen-C955zgr3.js +1 -0
  121. package/dist/client/assets/OpsSubnav-CjMVj7Sk.js +1 -0
  122. package/dist/client/assets/ProjectAgentProfile-B1VqGSmu.js +1 -0
  123. package/dist/client/assets/{ProjectAgentProfileBar-DHuMKJj-.js → ProjectAgentProfileBar-DhVU7zew.js} +1 -1
  124. package/dist/client/assets/ProjectAgentProfileHero-CJk-Dx4t.js +1 -0
  125. package/dist/client/assets/ProjectsInbox-B7kap8nR.js +2 -0
  126. package/dist/client/assets/ProjectsRail-BhSaqbv0.js +1 -0
  127. package/dist/client/assets/ProjectsScreen-CSb7nwjb.js +1 -0
  128. package/dist/client/assets/ProjectsThreadAside-pEJutIO8.js +1 -0
  129. package/dist/client/assets/{Provider-C35yu29I.js → Provider-BEXAZWd9.js} +2 -2
  130. package/dist/client/assets/{RailRow-BjmWK420.js → RailRow-Ddz90weI.js} +1 -1
  131. package/dist/client/assets/RawSessionsTable-TdKlJIPl.js +1 -0
  132. package/dist/client/assets/RealtimeVoiceScreen-BU5KmlNo.js +8 -0
  133. package/dist/client/assets/{RenderedWorkerSprite-Dhlyg89J.js → RenderedWorkerSprite-BNhFXMIo.js} +1 -1
  134. package/dist/client/assets/{ReplayClock-348f17bW.js → ReplayClock-wLpb4VqN.js} +1 -1
  135. package/dist/client/assets/{ReplayLog-CBnAM3ui.js → ReplayLog-IUyQdklN.js} +1 -1
  136. package/dist/client/assets/{ReplayOutpost-DyRPfNFx.js → ReplayOutpost-C4djhjZJ.js} +1 -1
  137. package/dist/client/assets/{RepoDiffEmbedScreen-BWxvRDrS.js → RepoDiffEmbedScreen-BmQX_8E-.js} +1 -1
  138. package/dist/client/assets/{RepoDiffPageScreen-DN94irmY.js → RepoDiffPageScreen-B9oAjrC6.js} +1 -1
  139. package/dist/client/assets/{RepoDiffViewer-_4JVXBIW.js → RepoDiffViewer-Ch_lIMt-.js} +1 -1
  140. package/dist/client/assets/RepoDiffViewerLazy-DL6A2o_z.js +2 -0
  141. package/dist/client/assets/{ReposScreen-uMCpt0e9.js → ReposScreen-D-E7fSAB.js} +2 -2
  142. package/dist/client/assets/{RiggedWorkerCharacter-q6QRc7_o.js → RiggedWorkerCharacter-CF6fhzGd.js} +1 -1
  143. package/dist/client/assets/{SageModelStudio-CNDhZhgD.js → SageModelStudio-CSet_ITs.js} +1 -1
  144. package/dist/client/assets/{ScoutDeckSurface-CUaU4R6T.js → ScoutDeckSurface-BJ-fl8AX.js} +1 -1
  145. package/dist/client/assets/{ScoutSurface-3_25USO_.js → ScoutSurface-BvFRdce6.js} +1 -1
  146. package/dist/client/assets/{ScoutbotFxLab-CRqhYe0a.js → ScoutbotFxLab-CfPzycZ7.js} +1 -1
  147. package/dist/client/assets/{SecondaryNav-D7dbV2qo.js → SecondaryNav-1FjBDWuY.js} +1 -1
  148. package/dist/client/assets/{SessionContextStrip-CXfs9hUD.js → SessionContextStrip-BoiIxXvS.js} +1 -1
  149. package/dist/client/assets/{SessionEmbedScreen-D0zFmou-.js → SessionEmbedScreen-BizGNGOz.js} +1 -1
  150. package/dist/client/assets/{SessionHopMenu-E6VJZrE0.js → SessionHopMenu-DX6PJPNk.js} +1 -1
  151. package/dist/client/assets/{SessionObserve-DXxBvejJ.js → SessionObserve-Dw3bVQYF.js} +1 -1
  152. package/dist/client/assets/{SessionObserveEvidence-Cuj_KHxR.js → SessionObserveEvidence-uD1OX-R5.js} +1 -1
  153. package/dist/client/assets/SessionRefScreen-Ch9H-qVk.js +1 -0
  154. package/dist/client/assets/SessionsScreen-DUeP23Xy.js +1 -0
  155. package/dist/client/assets/{SettingsDrawer-juCpnbH6.js → SettingsDrawer-BVrP6J52.js} +3 -3
  156. package/dist/client/assets/SettingsScreen-BcJ05LE5.js +1 -0
  157. package/dist/client/assets/{SharedFloorCharacter-DNEiaOUh.js → SharedFloorCharacter-dnamlt1p.js} +1 -1
  158. package/dist/client/assets/SharedWorkFloor-H-e2TVj9.js +2 -0
  159. package/dist/client/assets/{ShikiPane-CRtTYkMj.js → ShikiPane-CDiIT_qn.js} +1 -1
  160. package/dist/client/assets/{SlidePanel-_CHAQdOa.js → SlidePanel-D5oPQocF.js} +1 -1
  161. package/dist/client/assets/{SpaceSwitcher-BLgSCf_T.js → SpaceSwitcher-WccPJ0fS.js} +1 -1
  162. package/dist/client/assets/{SpriteAvatar-CpZWf54-.js → SpriteAvatar-D53GaaK3.js} +1 -1
  163. package/dist/client/assets/{SproutActionSprite-BSiTS4en.js → SproutActionSprite-BrFCmgWS.js} +1 -1
  164. package/dist/client/assets/{StatusPill-2gCP6H7A.js → StatusPill-jT--OXbn.js} +1 -1
  165. package/dist/client/assets/{TailView-CYSijNTy.js → TailView-B44cSuyl.js} +2 -2
  166. package/dist/client/assets/Terminal-D0PanmIk.js +4 -0
  167. package/dist/client/assets/TerminalEmbedScreen-Eddi4sts.js +1 -0
  168. package/dist/client/assets/{TerminalHeaderMount-Cq4OD_xN.js → TerminalHeaderMount-CYYcKxQ-.js} +1 -1
  169. package/dist/client/assets/{TextDocumentSurface-D52m7Vd8.js → TextDocumentSurface-DBslUq9k.js} +1 -1
  170. package/dist/client/assets/{TmuxPeek-CXFeweMg.js → TmuxPeek-Ctw5yYO5.js} +1 -1
  171. package/dist/client/assets/{VoiceControlWell-DF3bjcYA.js → VoiceControlWell-BkjuWjYu.js} +1 -1
  172. package/dist/client/assets/{VoicePathDiagram-CmpHWfO-.js → VoicePathDiagram-u0i6ntbx.js} +1 -1
  173. package/dist/client/assets/{VoicePermissionsPanel-Ok2nfxHw.js → VoicePermissionsPanel-9Nuw-xCr.js} +1 -1
  174. package/dist/client/assets/{VoiceTurnDetails-wAByRaNB.js → VoiceTurnDetails-kS7lfbmt.js} +1 -1
  175. package/dist/client/assets/{VoiceTurnStage-edoJalLV.js → VoiceTurnStage-DLY6aYDg.js} +1 -1
  176. package/dist/client/assets/{VoiceTurnView-D-8g5E4r.js → VoiceTurnView-CF4tIldB.js} +1 -1
  177. package/dist/client/assets/{WorkDetailScreen-zQkNVy2F.js → WorkDetailScreen-BrrkENYq.js} +2 -2
  178. package/dist/client/assets/{WorkFilesViewer-vNt01sDd.js → WorkFilesViewer-B63sKRYZ.js} +1 -1
  179. package/dist/client/assets/{WorkRunView-BDkR7Edq.js → WorkRunView-DLIzAsc3.js} +1 -1
  180. package/dist/client/assets/WorldActorTalk-CHhFTiQV.js +1 -0
  181. package/dist/client/assets/{WorldCharacter-CIIlutQq.js → WorldCharacter-CJGx2DVy.js} +1 -1
  182. package/dist/client/assets/{WorldMinimap-B6HNgcDe.js → WorldMinimap-DL12pBw3.js} +1 -1
  183. package/dist/client/assets/{WorldSky-Jm2Z6dfW.js → WorldSky-BlPNvGLo.js} +1 -1
  184. package/dist/client/assets/{activity-CIlFrfPJ.js → activity-CXkZ620t.js} +1 -1
  185. package/dist/client/assets/{addon-fit-dFpj9Kfq.js → addon-fit-G3qi01sy.js} +1 -1
  186. package/dist/client/assets/{addon-webgl-BFCGRtGh.js → addon-webgl-Bo7kSgOB.js} +1 -1
  187. package/dist/client/assets/{agent-essentials-BGGvT5G6.js → agent-essentials-DnfdGmIX.js} +1 -1
  188. package/dist/client/assets/{agent-specialization-DDc7mLCW.js → agent-specialization-DYX_DSlY.js} +1 -1
  189. package/dist/client/assets/{arc.es-C1SQHJ3k.js → arc.es-CLA3XI14.js} +1 -1
  190. package/dist/client/assets/arrow-down--OUDFWIq.js +1 -0
  191. package/dist/client/assets/{arrow-left-MVUKauwQ.js → arrow-left-DNjQHf4C.js} +1 -1
  192. package/dist/client/assets/{arrow-right-Bp-FpE5V.js → arrow-right-A_yyXwoH.js} +1 -1
  193. package/dist/client/assets/arrow-up-DFy-9ghF.js +1 -0
  194. package/dist/client/assets/{arrow-up-right-BPedAgxO.js → arrow-up-right-DUW1A1Hb.js} +1 -1
  195. package/dist/client/assets/{book-open-CV98WMSp.js → book-open-B_idZgTF.js} +1 -1
  196. package/dist/client/assets/{bot-B4zLQ4IN.js → bot-BNv_ZJzi.js} +1 -1
  197. package/dist/client/assets/{chat-api-DSJMBYoT.js → chat-api-BHGHALv2.js} +1 -1
  198. package/dist/client/assets/{chat-message-markup-91DIry6R.js → chat-message-markup-esR-YLtN.js} +1 -1
  199. package/dist/client/assets/{chat-transport-DNS5CB2I.js → chat-transport-CtxnPLMU.js} +1 -1
  200. package/dist/client/assets/{check-lrJ3a73a.js → check-BM6QtbB7.js} +1 -1
  201. package/dist/client/assets/{chevron-down-l1mrh5S9.js → chevron-down-DEDSNJNY.js} +1 -1
  202. package/dist/client/assets/{chevron-right-DrfqcerI.js → chevron-right-B02kAw12.js} +1 -1
  203. package/dist/client/assets/{chevron-up-CETZJzjV.js → chevron-up-CzveykKG.js} +1 -1
  204. package/dist/client/assets/{chunk-HRAB3GC3-DbVLgbWX.js → chunk-HRAB3GC3-DVhUsgOw.js} +1 -1
  205. package/dist/client/assets/chunk-JTPDIGGW-hdpdYwXb.js +46 -0
  206. package/dist/client/assets/chunk-T65CQEWV-G_Z0lqtn.js +1 -0
  207. package/dist/client/assets/chunk-YOZR3KYS-apgUnfXh.js +2 -0
  208. package/dist/client/assets/{clock-BV1aqPkK.js → clock-8tb9t2t9.js} +1 -1
  209. package/dist/client/assets/{code-xml-BhcNbLWU.js → code-xml-E9gBuiVs.js} +1 -1
  210. package/dist/client/assets/{coffee-D7EAOdCk.js → coffee-D0YEK6-l.js} +1 -1
  211. package/dist/client/assets/{compass-63TUaz5_.js → compass-EmGkpxIe.js} +1 -1
  212. package/dist/client/assets/content-B-rn1rka.js +1 -0
  213. package/dist/client/assets/content-BHV-ZU8_.js +1 -0
  214. package/dist/client/assets/content-BI9yWpWC.js +1 -0
  215. package/dist/client/assets/content-BLVuukzF.js +1 -0
  216. package/dist/client/assets/content-BP3cQkAj.js +1 -0
  217. package/dist/client/assets/content-BRY-UTkP.js +1 -0
  218. package/dist/client/assets/content-BXTmYOPB.js +1 -0
  219. package/dist/client/assets/content-C3DZ77HZ.js +1 -0
  220. package/dist/client/assets/content-CPchclaV.js +1 -0
  221. package/dist/client/assets/{content-nGlEZhUI.js → content-CVqPTQnr.js} +1 -1
  222. package/dist/client/assets/content-CjAERU44.js +1 -0
  223. package/dist/client/assets/content-CoYG0nWL.js +1 -0
  224. package/dist/client/assets/content-DK1KeRPw.js +1 -0
  225. package/dist/client/assets/content-iWBSSXa6.js +1 -0
  226. package/dist/client/assets/content-ryJeaQk8.js +1 -0
  227. package/dist/client/assets/content-srNyLgDt.js +1 -0
  228. package/dist/client/assets/{conversation-icons-Tqba2d56.js → conversation-icons-Dxn9N1Kx.js} +1 -1
  229. package/dist/client/assets/conversation-motion-features-BfmPlONx.js +1 -0
  230. package/dist/client/assets/{copy-xKeM5ZtU.js → copy-C1XrY27_.js} +1 -1
  231. package/dist/client/assets/{cpu-BOTa_WLr.js → cpu-DVZ_LhPn.js} +1 -1
  232. package/dist/client/assets/{createLucideIcon-zZ8Hx7er.js → createLucideIcon-CKbjXlwv.js} +1 -1
  233. package/dist/client/assets/direct-voice-DAOUU-kc.js +10 -0
  234. package/dist/client/assets/discover-BNa3BPr_.js +2 -0
  235. package/dist/client/assets/embed-entry-gK3z8Yxi.js +2 -0
  236. package/dist/client/assets/{external-link-CUObqmgX.js → external-link-Df1R34rX.js} +1 -1
  237. package/dist/client/assets/{eye-LrO-cXQt.js → eye-CD-_aphP.js} +1 -1
  238. package/dist/client/assets/{file-code-corner-CsU7jJpu.js → file-code-corner-DtMWHBN3.js} +1 -1
  239. package/dist/client/assets/{file-text-CnISiiw6.js → file-text-BOJQiS8p.js} +1 -1
  240. package/dist/client/assets/{flag-C4wl8z2-.js → flag-CeKO8NoD.js} +1 -1
  241. package/dist/client/assets/{folder-D5prSkzz.js → folder-C2emmTHq.js} +1 -1
  242. package/dist/client/assets/{gauge-D9_5iJEm.js → gauge-BR5CrhRM.js} +1 -1
  243. package/dist/client/assets/{gestures-QZub3Ot9.js → gestures-Dh8szhcU.js} +1 -1
  244. package/dist/client/assets/{git-branch-B0_fPLO7.js → git-branch-C45vy8qT.js} +1 -1
  245. package/dist/client/assets/{go-shortcuts-DicR7sUf.js → go-shortcuts--25Qg0lD.js} +1 -1
  246. package/dist/client/assets/{home-moving-signal-rpMhsOJB.js → home-moving-signal-BiiyEKEb.js} +1 -1
  247. package/dist/client/assets/home-now-card-DaCpqUZe.js +1 -0
  248. package/dist/client/assets/{home-now-card-nano-B5Dv3-pb.js → home-now-card-nano-wbxgyY4q.js} +1 -1
  249. package/dist/client/assets/hooks-JNwYSH18.js +2 -0
  250. package/dist/client/assets/{index-EsrkGBcv.js → index-BFbLvCJn.js} +2 -2
  251. package/dist/client/assets/index-BRNHY2fp.css +1 -0
  252. package/dist/client/assets/index-BrXaMEdK.js +1 -0
  253. package/dist/client/assets/index-CXzJ_hGx.js +1 -0
  254. package/dist/client/assets/{index-CHD0qcfL.js → index-V8FYEUpD.js} +1 -1
  255. package/dist/client/assets/index-mYtyYeAe.js +1 -0
  256. package/dist/client/assets/{inspector-panel-BkgUDn6G.js → inspector-panel-BgU5xUln.js} +2 -2
  257. package/dist/client/assets/{keyboard-nav-DDHegDbx.js → keyboard-nav-CEe-ApvZ.js} +1 -1
  258. package/dist/client/assets/{lane-roster-store-D-RSWjb-.js → lane-roster-store-MraynTHP.js} +1 -1
  259. package/dist/client/assets/{layers-C8PDiMul.js → layers-ClmyjwpB.js} +1 -1
  260. package/dist/client/assets/{layout-grid-Cor2frzj.js → layout-grid-DG2-JaPn.js} +1 -1
  261. package/dist/client/assets/left-B66YR0c5.js +1 -0
  262. package/dist/client/assets/left-BP5P8lzw.js +2 -0
  263. package/dist/client/assets/left-BbCKRDbW.js +1 -0
  264. package/dist/client/assets/left-CaY5FK2k.js +1 -0
  265. package/dist/client/assets/left-CemrfeSs.js +1 -0
  266. package/dist/client/assets/left-DcYA26sH.js +1 -0
  267. package/dist/client/assets/left-DdMMaqFT.js +2 -0
  268. package/dist/client/assets/left-advisor-DBml48M5.js +1 -0
  269. package/dist/client/assets/left-agents-DowYF2ag.js +1 -0
  270. package/dist/client/assets/left-default-Bifaeg_V.js +1 -0
  271. package/dist/client/assets/left-lanes-BGhjdqpD.js +1 -0
  272. package/dist/client/assets/left-mission-CvXPUovR.js +1 -0
  273. package/dist/client/assets/library-CnC8uzJt.js +1 -0
  274. package/dist/client/assets/{loader-circle-OvccU82H.js → loader-circle-CCG7hG7z.js} +1 -1
  275. package/dist/client/assets/{local-agents-BqnoxJrq.js → local-agents-BMcFlY_x.js} +1 -1
  276. package/dist/client/assets/{log-in-7SnYqW5w.js → log-in-VL9mdgeE.js} +1 -1
  277. package/dist/client/assets/{machine-children-DxcqCLmd.js → machine-children-DvCiQxwA.js} +1 -1
  278. package/dist/client/assets/{mentions-ByUvhS-v.js → mentions-s5oW4aQU.js} +1 -1
  279. package/dist/client/assets/{mesh-ops-CiZ8xSAx.js → mesh-ops-9SzD3sPw.js} +1 -1
  280. package/dist/client/assets/{mesh-view-store-DZvJC4KU.js → mesh-view-store-CVqzYz4K.js} +1 -1
  281. package/dist/client/assets/{message-circle-CxRVKNE-.js → message-circle-BB3rFCVD.js} +1 -1
  282. package/dist/client/assets/{message-markup-Zwo3t4cI.js → message-markup-D1C7GzHo.js} +1 -1
  283. package/dist/client/assets/{message-square-BxesYglW.js → message-square-BwqBIfv5.js} +1 -1
  284. package/dist/client/assets/{mission-control-store-elEEsIvb.js → mission-control-store-e8F85JhP.js} +1 -1
  285. package/dist/client/assets/{monitor-DTTYEb73.js → monitor-M0VSmHQ-.js} +1 -1
  286. package/dist/client/assets/{nav-destinations-uorRqFxf.js → nav-destinations-B3R5zxFX.js} +1 -1
  287. package/dist/client/assets/{observe-BJqERJVj.js → observe-M3rLosT5.js} +1 -1
  288. package/dist/client/assets/{page-status-BswZLqvA.js → page-status-BIuh3C5p.js} +1 -1
  289. package/dist/client/assets/{panel-right-Bv7sP_fc.js → panel-right-WKLdPm0F.js} +1 -1
  290. package/dist/client/assets/{paperclip-BjcuP_Hx.js → paperclip-DLf_ABSv.js} +1 -1
  291. package/dist/client/assets/{pause-C2XTlkjs.js → pause-7mmEEvVx.js} +1 -1
  292. package/dist/client/assets/{persistent-state-KRk_yb0q.js → persistent-state-3mbBFRDO.js} +1 -1
  293. package/dist/client/assets/{pin-C2mFOV1l.js → pin-q_0gAA6i.js} +1 -1
  294. package/dist/client/assets/{play-FT6K3It1.js → play-N5-hnPCV.js} +1 -1
  295. package/dist/client/assets/{plus-DFDDeGKu.js → plus-B0hdY0fF.js} +1 -1
  296. package/dist/client/assets/profile-B7ZGToTo.js +1 -0
  297. package/dist/client/assets/{projects-inbox-C0FUCv_p.js → projects-inbox-CMFBjQt0.js} +1 -1
  298. package/dist/client/assets/{proxy-AJsmwA6h.js → proxy-k0ILOVkK.js} +1 -1
  299. package/dist/client/assets/{radio-DRoOZsws.js → radio-Bjqmv997.js} +1 -1
  300. package/dist/client/assets/{refresh-cw-BmVr7sCD.js → refresh-cw-BcqctLqo.js} +1 -1
  301. package/dist/client/assets/resolve-panes-wzGu9d8o.js +1 -0
  302. package/dist/client/assets/resolve-sidebar-context-C8SOo5oZ.js +1 -0
  303. package/dist/client/assets/right-9rMRZN_r.js +1 -0
  304. package/dist/client/assets/right-BHZq648O.js +1 -0
  305. package/dist/client/assets/{right-DWPVB-nK.js → right-BNJzCaH9.js} +1 -1
  306. package/dist/client/assets/right-CAd7lTvY.js +1 -0
  307. package/dist/client/assets/right-Cc57bCTW.js +1 -0
  308. package/dist/client/assets/right-DY49Prjj.js +1 -0
  309. package/dist/client/assets/right-DfU47xKY.js +1 -0
  310. package/dist/client/assets/right-Dr7vxdZl.js +1 -0
  311. package/dist/client/assets/right-DsE4aR3A.js +1 -0
  312. package/dist/client/assets/right-zlkRjnkv.js +1 -0
  313. package/dist/client/assets/{rocket-CGl4RTV7.js → rocket-BahsdUe6.js} +1 -1
  314. package/dist/client/assets/router-CJIx83Ia.js +1 -0
  315. package/dist/client/assets/runtime-picker-IRcTkMZ5.js +1 -0
  316. package/dist/client/assets/{scope-views-RUWwCVAr.js → scope-views-KDtZoLUC.js} +1 -1
  317. package/dist/client/assets/{scout-voice-CZx60X6E.js → scout-voice-Cdh6pCsb.js} +1 -1
  318. package/dist/client/assets/{scoutbot-markdown-BKEBSbG0.js → scoutbot-markdown-7PRQHaAc.js} +1 -1
  319. package/dist/client/assets/{scroll-text-DNjxhyO2.js → scroll-text-CA0QxBHu.js} +1 -1
  320. package/dist/client/assets/{search-DT42oyRW.js → search-Bv2IONmc.js} +1 -1
  321. package/dist/client/assets/secondaryNavConfig-Bmb-oRvD.js +1 -0
  322. package/dist/client/assets/{selection-bridge-x3wFUjxj.js → selection-bridge-CthAuPRw.js} +1 -1
  323. package/dist/client/assets/{send-horizontal-CH0-fbZE.js → send-horizontal-_Tf_It04.js} +1 -1
  324. package/dist/client/assets/{send-to-agent-session-DoKCDBJ4.js → send-to-agent-session-CWDHHgFB.js} +1 -1
  325. package/dist/client/assets/{server-QfsgMLk1.js → server-U_l8A83n.js} +1 -1
  326. package/dist/client/assets/{session-catalog-CvSdPHPe.js → session-catalog-Dx4tl3sx.js} +1 -1
  327. package/dist/client/assets/{session-recap-queue-41l2XVkI.js → session-recap-queue-GeicPLsQ.js} +1 -1
  328. package/dist/client/assets/{session-table-L-pns6Zl.js → session-table-BI62J4NP.js} +1 -1
  329. package/dist/client/assets/{sessions-view-Dc-QAa7O.js → sessions-view-lGMwwZY7.js} +1 -1
  330. package/dist/client/assets/{settings-BVh7kldq.js → settings-bo9X410k.js} +1 -1
  331. package/dist/client/assets/{sliders-horizontal-782VC_yy.js → sliders-horizontal-CPSx6wd2.js} +1 -1
  332. package/dist/client/assets/{sparkles-BjHq_DNK.js → sparkles-Br-bA2aZ.js} +1 -1
  333. package/dist/client/assets/{sse-BCPRocpq.js → sse-BVxO0zNp.js} +1 -1
  334. package/dist/client/assets/{tail-events-d0yAYxR0.js → tail-events-C6NWFB1N.js} +1 -1
  335. package/dist/client/assets/{terminal-hQKQygcf.js → terminal-DMBAZjPP.js} +1 -1
  336. package/dist/client/assets/{terminal-relay-Bxs1hp-j.js → terminal-relay-CpGHpDa8.js} +1 -1
  337. package/dist/client/assets/{terminal-takeover-Ay5C2c-M.js → terminal-takeover-CXwdoZ5j.js} +1 -1
  338. package/dist/client/assets/{triangle-alert-CHoRGdVO.js → triangle-alert-BZikHKuT.js} +1 -1
  339. package/dist/client/assets/use-beside-DopIbJwf.js +1 -0
  340. package/dist/client/assets/{use-conversation-list-CY4JciOV.js → use-conversation-list-CGtcpdPd.js} +1 -1
  341. package/dist/client/assets/{use-fleet-active-asks-CymmXWH4.js → use-fleet-active-asks-DAHOPYPV.js} +1 -1
  342. package/dist/client/assets/{use-mesh-node-state-BvaqtODo.js → use-mesh-node-state-BlWIPTc4.js} +1 -1
  343. package/dist/client/assets/{use-mesh-ops-items-BSYaqH_0.js → use-mesh-ops-items-pKWBro7o.js} +1 -1
  344. package/dist/client/assets/{use-reduced-motion-3gMYZNIp.js → use-reduced-motion-DkdIQBwh.js} +1 -1
  345. package/dist/client/assets/use-scout-dev-flags-CduUFb7l.js +1 -0
  346. package/dist/client/assets/{useAgentHoverCard-BANmpjMh.js → useAgentHoverCard-DNlXPYQf.js} +1 -1
  347. package/dist/client/assets/useContentSecondaryNav-LJGNYG3U.js +1 -0
  348. package/dist/client/assets/{useEmbedHeadline-D6pJRxUg.js → useEmbedHeadline-BeeBDb7E.js} +1 -1
  349. package/dist/client/assets/{usePierreRuntime-BAQdiN0L.js → usePierreRuntime-DUXZ-DTK.js} +1 -1
  350. package/dist/client/assets/useSidebarCollapse-DoMvU_2R.js +1 -0
  351. package/dist/client/assets/{users-BUjx36gx.js → users-BQPEIUfd.js} +1 -1
  352. package/dist/client/assets/{wrench-DR0i5BU7.js → wrench-C-wjicn5.js} +1 -1
  353. package/dist/client/assets/{x-DAehov0E.js → x-BcfhXYiF.js} +1 -1
  354. package/dist/client/assets/{xterm-BXQiLVnI.js → xterm-qXD45dc0.js} +1 -1
  355. package/dist/client/assets/{zap-CEjZNZbI.js → zap-BqL8ttGz.js} +1 -1
  356. package/dist/client/index.html +2 -2
  357. package/dist/main.mjs +1 -1
  358. package/package.json +29 -5
  359. package/server.json +31 -0
  360. package/dist/client/assets/ActivityScreen-CZmGwQ2U.js +0 -1
  361. package/dist/client/assets/AgentAdventures-BAgxdOF8.js +0 -1
  362. package/dist/client/assets/AgentConfigurationScreen-1L0IQm2w.js +0 -1
  363. package/dist/client/assets/AgentDefinitionsWorkspace-DguGs7jZ.js +0 -1
  364. package/dist/client/assets/AgentFloorView-DH4jiDgw.js +0 -1
  365. package/dist/client/assets/AgentInfoScreen-DYtmKkeE.js +0 -1
  366. package/dist/client/assets/AgentLanesEmbedScreen-BlSof_6S.js +0 -1
  367. package/dist/client/assets/AgentMasterScreen-EJhmuKgl.js +0 -1
  368. package/dist/client/assets/AgentsConsole-RXGqRvcb.js +0 -1
  369. package/dist/client/assets/AgentsScreen-ChwMBs11.js +0 -1
  370. package/dist/client/assets/AgentsSubnav-DwNX4yy0.js +0 -1
  371. package/dist/client/assets/BriefingDetailScreen-DrlC3qkm.js +0 -1
  372. package/dist/client/assets/BrokerScreen-DwOF6bMA.js +0 -8
  373. package/dist/client/assets/Canvas-X9pVSkw3.js +0 -1
  374. package/dist/client/assets/ChannelComposer-DoK7IDGa.js +0 -1
  375. package/dist/client/assets/ChatRightPanel-C1h_aIkn.js +0 -1
  376. package/dist/client/assets/ChatSpaceSurface-BXyLYKHn.js +0 -1
  377. package/dist/client/assets/ConversationComposer-CUQyArlk.js +0 -1
  378. package/dist/client/assets/ConversationFeedRows-DWiOfT-y.js +0 -1
  379. package/dist/client/assets/ConversationHeader-C-ZWscKj.js +0 -1
  380. package/dist/client/assets/ConversationScreen-CUfsQ4MR.js +0 -2
  381. package/dist/client/assets/ConversationStatus--IPm2nGh.js +0 -1
  382. package/dist/client/assets/FlightObserveScreen-DZ2mrw91.js +0 -1
  383. package/dist/client/assets/FloorResourcesSheet-C-kQ6Ren.js +0 -1
  384. package/dist/client/assets/HarnessesScreen-DX3NLcDG.js +0 -1
  385. package/dist/client/assets/KnowledgeSearchScreen-Dd6jrQ0A.js +0 -1
  386. package/dist/client/assets/LaneTraceDetailSheet-DYrd0BIf.js +0 -1
  387. package/dist/client/assets/MeshScreen-8nAzQVbm.js +0 -1
  388. package/dist/client/assets/MessagesScreen-C3WB4T21.js +0 -1
  389. package/dist/client/assets/MissionControlView-B9cNPXvl.js +0 -1
  390. package/dist/client/assets/MissionLeftAgentRow-vycMV77n.js +0 -1
  391. package/dist/client/assets/NativeAreaScreen-B1RLa85C.js +0 -1
  392. package/dist/client/assets/NativeAreaScreen-CV0OhGra.js +0 -1
  393. package/dist/client/assets/NativeAreaScreen-CzuZt6o1.js +0 -1
  394. package/dist/client/assets/OpenScoutAppShell-37PDFfA4.js +0 -31
  395. package/dist/client/assets/OpsAgentsView-DajlX8LO.js +0 -1
  396. package/dist/client/assets/OpsScreen-jVcaBKGi.js +0 -1
  397. package/dist/client/assets/OpsSubnav-BOOYShHE.js +0 -1
  398. package/dist/client/assets/ProjectAgentProfile-D_wlW4sQ.js +0 -1
  399. package/dist/client/assets/ProjectAgentProfileHero-Dbebtug1.js +0 -1
  400. package/dist/client/assets/ProjectsInbox-Cgu7B4--.js +0 -2
  401. package/dist/client/assets/ProjectsRail-CDWocin_.js +0 -1
  402. package/dist/client/assets/ProjectsScreen-B_CJycqW.js +0 -1
  403. package/dist/client/assets/ProjectsThreadAside-1MMl_qUD.js +0 -1
  404. package/dist/client/assets/RawSessionsTable-DzT90hWu.js +0 -1
  405. package/dist/client/assets/RealtimeVoiceScreen-B6ylX3WQ.js +0 -16
  406. package/dist/client/assets/RepoDiffViewerLazy-XGVC3WXv.js +0 -2
  407. package/dist/client/assets/SessionRefScreen-DqLSUlCE.js +0 -1
  408. package/dist/client/assets/SessionsScreen-BLIRkohT.js +0 -1
  409. package/dist/client/assets/SettingsScreen-BtGzE2-O.js +0 -1
  410. package/dist/client/assets/SharedWorkFloor-D9mf9KSg.js +0 -2
  411. package/dist/client/assets/Terminal-Bi97yb5s.js +0 -4
  412. package/dist/client/assets/TerminalEmbedScreen-Bqop67Bq.js +0 -1
  413. package/dist/client/assets/TerminalRelay-DrikpUSJ.js +0 -46
  414. package/dist/client/assets/WorldActorTalk-BvSg_b1y.js +0 -1
  415. package/dist/client/assets/content-B1lgE8qr.js +0 -1
  416. package/dist/client/assets/content-B5l11YyQ.js +0 -1
  417. package/dist/client/assets/content-BNZOZEpX.js +0 -1
  418. package/dist/client/assets/content-BRIxP155.js +0 -1
  419. package/dist/client/assets/content-BWd8gt8L.js +0 -1
  420. package/dist/client/assets/content-BfwS2jAK.js +0 -1
  421. package/dist/client/assets/content-C4p43_eT.js +0 -1
  422. package/dist/client/assets/content-CdYfaoDV.js +0 -1
  423. package/dist/client/assets/content-CzldLxw0.js +0 -1
  424. package/dist/client/assets/content-D-olnc4U.js +0 -1
  425. package/dist/client/assets/content-DTioimq4.js +0 -1
  426. package/dist/client/assets/content-LOebm3_d.js +0 -1
  427. package/dist/client/assets/content-oyzDM-LK.js +0 -1
  428. package/dist/client/assets/content-x1PHxED7.js +0 -1
  429. package/dist/client/assets/content-zX3ZY3T9.js +0 -1
  430. package/dist/client/assets/conversation-motion-features-C5zjuNwE.js +0 -1
  431. package/dist/client/assets/direct-voice-BbLPuJ04.js +0 -2
  432. package/dist/client/assets/discover-DJFxyV1k.js +0 -2
  433. package/dist/client/assets/embed-entry-Lyvu0Kfc.js +0 -2
  434. package/dist/client/assets/home-now-card-ByE6Umcx.js +0 -1
  435. package/dist/client/assets/hooks-_eCZZPsR.js +0 -2
  436. package/dist/client/assets/index-724SdE6r.js +0 -1
  437. package/dist/client/assets/index-CN4rBB_s.css +0 -1
  438. package/dist/client/assets/index-D1d98iYf.js +0 -1
  439. package/dist/client/assets/index-gGHPA-By.js +0 -1
  440. package/dist/client/assets/left-Bn5X7x2o.js +0 -2
  441. package/dist/client/assets/left-BqS0fYX1.js +0 -1
  442. package/dist/client/assets/left-CTCeeeD3.js +0 -1
  443. package/dist/client/assets/left-DhtVPVux.js +0 -1
  444. package/dist/client/assets/left-K39b-Wvx.js +0 -2
  445. package/dist/client/assets/left-KGmueNPt.js +0 -1
  446. package/dist/client/assets/left-P_GOYB-s.js +0 -1
  447. package/dist/client/assets/left-advisor-B0N47De2.js +0 -1
  448. package/dist/client/assets/left-agents-CsSNc51Y.js +0 -1
  449. package/dist/client/assets/left-default-BlO5LP2T.js +0 -1
  450. package/dist/client/assets/left-lanes-C4PhaJE6.js +0 -1
  451. package/dist/client/assets/left-mission-BjTE5vPa.js +0 -1
  452. package/dist/client/assets/library-CkWNPHRp.js +0 -1
  453. package/dist/client/assets/profile-DTmzN16I.js +0 -1
  454. package/dist/client/assets/provider-Dojd8quC.js +0 -1
  455. package/dist/client/assets/resolve-panes-pbY1fCWi.js +0 -1
  456. package/dist/client/assets/resolve-sidebar-context-YWkZTq1t.js +0 -1
  457. package/dist/client/assets/right-49kO-6nD.js +0 -1
  458. package/dist/client/assets/right-APtItA8A.js +0 -1
  459. package/dist/client/assets/right-BJwhPqtn.js +0 -1
  460. package/dist/client/assets/right-BPqrf4ek.js +0 -1
  461. package/dist/client/assets/right-D7djOy6K.js +0 -1
  462. package/dist/client/assets/right-DKOUCRob.js +0 -1
  463. package/dist/client/assets/right-DMNrVzg7.js +0 -1
  464. package/dist/client/assets/right-DppeMCy4.js +0 -1
  465. package/dist/client/assets/right-GAL5Mw1v.js +0 -1
  466. package/dist/client/assets/router-DCtl8wqb.js +0 -1
  467. package/dist/client/assets/runtime-picker-DXu2bOTh.js +0 -1
  468. package/dist/client/assets/secondaryNavConfig-CS1svh6n.js +0 -1
  469. package/dist/client/assets/use-beside-DoRC1nt0.js +0 -1
  470. package/dist/client/assets/use-scout-dev-flags-DS_pYYQd.js +0 -1
  471. package/dist/client/assets/useContentSecondaryNav-C6OBu-3_.js +0 -1
  472. package/dist/client/assets/usePersistentState-B8lP7TRb.js +0 -1
  473. package/dist/client/assets/useSidebarCollapse-OL_8J5cL.js +0 -1
@@ -1 +1 @@
1
- import{r,j as e}from"./index-EsrkGBcv.js";import{u as $}from"./chat-transport-DNS5CB2I.js";import{MemberCoin as E}from"./ChatAvatar-C3a_o5Hj.js";import{SpaceSwitcher as _}from"./SpaceSwitcher-BLgSCf_T.js";import{c as I}from"./chat-space-model-aW3Fd8_U.js";import"./chat-api-DSJMBYoT.js";import"./api-DSqpVKC7.js";import"./SpriteAvatar-CpZWf54-.js";import"./agent-state-DDhnFEEP.js";import"./colors-CFlbwC25.js";const J=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"system",label:"System"}];function M(s,c,i){if(!s)return;const l=Array.from(s.querySelectorAll("[data-side-row]")),u=l.indexOf(c);if(u<0)return;l[(u+i+l.length)%l.length]?.focus()}function P(s){return s.replace(/^#/u,"").trim().slice(0,1).toLowerCase()||"?"}function Q({viewerName:s,viewerIsHost:c,railed:i,themePreference:l,onOpenProfile:u,onThemePreference:x,onSignOut:d}){const w=$(),[o,n]=r.useState(!1),m=r.useRef(null);r.useEffect(()=>{if(!o)return;m.current?.querySelector(".chat-you-menu button")?.focus();const t=y=>{const j=y.target;j instanceof Node&&m.current?.contains(j)||n(!1)};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[o]);const f=r.useCallback(t=>{n(!1),t()},[]);return e.jsxs("div",{className:"chat-sidebar-identity",ref:m,onKeyDown:t=>{t.key==="Escape"&&o&&(t.preventDefault(),t.stopPropagation(),n(!1),m.current?.querySelector(".chat-you")?.focus())},children:[o?e.jsxs("div",{className:"chat-you-menu",role:"group","aria-label":`${s} menu`,children:[e.jsxs("div",{className:"chat-you-menu-head",children:[e.jsx(E,{name:s,size:28,title:s}),e.jsx("span",{className:"chat-you-menu-name",children:s})]}),e.jsx("div",{className:"chat-you-menu-rule"}),u?e.jsx("button",{type:"button",className:"chat-you-menu-item",onClick:()=>f(u),children:"Your member card"}):null,e.jsxs("div",{className:"chat-you-menu-group",role:"group","aria-label":"Appearance",children:[e.jsx("span",{className:"label-sm",children:"Appearance"}),e.jsx("div",{className:"chat-you-themes",children:J.map(t=>e.jsx("button",{type:"button",className:"btn btn--sm","aria-pressed":l===t.value,"data-active":l===t.value,onClick:()=>x(t.value),children:t.label},t.value))})]}),w.signOut?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"chat-you-menu-rule"}),e.jsx("button",{type:"button",className:"chat-you-menu-item",onClick:()=>f(d),children:"Sign out"})]}):null]}):null,e.jsxs("button",{type:"button",className:"chat-you","aria-expanded":o,"aria-label":i?`${s} — account menu`:void 0,onClick:()=>n(t=>!t),children:[e.jsx(E,{name:s,size:24,title:s}),i?null:e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"chat-you-who",children:[e.jsx("span",{className:"chat-you-name",children:s}),c?e.jsx("span",{className:"label-sm chat-you-role",children:"Host"}):null]}),e.jsx("span",{className:"chat-you-caret","aria-hidden":"true",children:o?"⌄":"⌃"})]})]})]})}function re({channels:s,directs:c,spaces:i,activeSpace:l,selectedId:u,addressedChannelIds:x,canCreate:d,viewerName:w,viewerIsHost:o,railed:n,themePreference:m,onSelect:f,onSelectSpace:t,onCreate:y,onCreateSpace:j,onDeleteSpace:Y,onInvite:A,onExpandRail:F,onOpenProfile:B,onThemePreference:G,onSignOut:U}){const T=$(),g=r.useRef(null),[L,N]=r.useState(!1),[C,O]=r.useState(""),[D,K]=r.useState(""),[k,R]=r.useState(!1),S=r.useCallback(async()=>{const a=C.trim();if(!(!a||k)){R(!0);try{await y({title:a,topic:D.trim()}),O(""),K(""),N(!1)}finally{R(!1)}}},[k,y,C,D]),v=(a,p)=>{const H=x.has(a.id),b=p?a.title.replace(/^#/u,""):a.title;return e.jsxs("button",{type:"button","data-side-row":!0,className:n?"chat-rail-row":"chat-side-row","aria-label":p?I(a.title):b,"aria-current":a.id===u,"data-addressed":H,title:n?p?I(a.title):b:void 0,onClick:()=>f(a.id),onKeyDown:h=>{h.key==="ArrowDown"?(h.preventDefault(),M(g.current,h.currentTarget,1)):h.key==="ArrowUp"&&(h.preventDefault(),M(g.current,h.currentTarget,-1))},children:[n?p?e.jsxs("span",{className:"chat-rail-glyph",children:[e.jsx("span",{className:"chat-hash",children:"#"}),P(a.title)]}):e.jsx(E,{name:b,size:22,title:b}):e.jsxs(e.Fragment,{children:[p?e.jsx("span",{className:"chat-hash",children:"#"}):null,e.jsx("span",{className:"chat-row-name",children:b})]}),H?e.jsx("span",{className:"dot dot--accent dot--sm","aria-label":"Addressed to you, unanswered"}):null]},a.id)},q=i.length>0?e.jsx(_,{spaces:i,activeSlug:l,canCreate:d&&T.spaceCreate,railed:n,onSelect:t,onCreate:j,onDelete:d?Y:null,onExpandRail:F}):null,z=e.jsx(Q,{viewerName:w,viewerIsHost:o,railed:n,themePreference:m,onOpenProfile:B,onThemePreference:G,onSignOut:U});return n?e.jsxs("nav",{className:"chat-sidebar","data-railed":"true",ref:g,"aria-label":"Channels and direct messages",onDoubleClick:a=>{a.target.closest("button, a, [role='button']")||F()},children:[q,e.jsxs("div",{className:"chat-side-list",children:[s.map(a=>v(a,!0)),c.length>0?e.jsx("div",{className:"chat-rail-rule"}):null,c.map(a=>v(a,!1))]}),e.jsx("div",{className:"chat-sidebar-foot",children:e.jsx("button",{type:"button",className:"chat-rail-row","aria-label":"Invite someone",onClick:A,children:e.jsx("span",{className:"chat-rail-glyph",children:"+"})})}),z]}):e.jsxs("nav",{className:"chat-sidebar",ref:g,"aria-label":"Channels and direct messages",children:[q,e.jsxs("div",{className:"chat-side-list",children:[e.jsxs("div",{className:"chat-side-section",children:[e.jsx("span",{className:"label-md",children:"Channels"}),d&&T.channelCreate?e.jsx("button",{type:"button",className:"chat-side-add","aria-label":"Create a channel","aria-expanded":L,onClick:()=>N(a=>!a),children:"+"}):null]}),L?e.jsxs("div",{className:"chat-create-form",children:[e.jsx("input",{className:"chat-input",value:C,autoFocus:!0,placeholder:"channel-name","aria-label":"Channel name",onChange:a=>O(a.target.value),onKeyDown:a=>{a.key==="Enter"?(a.preventDefault(),S()):a.key==="Escape"&&(a.preventDefault(),N(!1))}}),e.jsx("input",{className:"chat-input",value:D,placeholder:"Topic (optional)","aria-label":"Channel topic",onChange:a=>K(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),S())}}),e.jsxs("div",{className:"chat-create-actions",children:[e.jsx("button",{type:"button",className:"btn btn--sm",disabled:k||!C.trim(),onClick:()=>{S()},children:k?"Creating…":"Create"}),e.jsx("button",{type:"button",className:"btn btn--ghost btn--sm",onClick:()=>N(!1),children:"Cancel"})]})]}):null,s.length===0?e.jsx("p",{className:"chat-side-empty",children:d?`No channels in ${i.find(a=>a.slug===l)?.title??"this space"} yet. Create one to get started.`:"You are not in any channel yet. Open the invitation you were sent."}):s.map(a=>v(a,!0)),c.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"chat-side-section",children:e.jsx("span",{className:"label-md",children:"Direct messages"})}),c.map(a=>v(a,!1))]}):null]}),e.jsx("div",{className:"chat-sidebar-foot",children:e.jsx("button",{type:"button",className:"btn btn--ghost btn--sm",onClick:A,children:"+ Invite"})}),z]})}export{re as ChannelSidebar};
1
+ import{r,j as e}from"./index-BFbLvCJn.js";import{u as $}from"./chat-transport-CtxnPLMU.js";import{MemberCoin as E}from"./ChatAvatar-BsAOShUr.js";import{SpaceSwitcher as _}from"./SpaceSwitcher-WccPJ0fS.js";import{c as I}from"./chat-space-model-aW3Fd8_U.js";import"./chat-api-BHGHALv2.js";import"./api-DSqpVKC7.js";import"./SpriteAvatar-D53GaaK3.js";import"./agent-state-DDhnFEEP.js";import"./colors-CFlbwC25.js";const J=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"system",label:"System"}];function M(s,c,i){if(!s)return;const l=Array.from(s.querySelectorAll("[data-side-row]")),u=l.indexOf(c);if(u<0)return;l[(u+i+l.length)%l.length]?.focus()}function P(s){return s.replace(/^#/u,"").trim().slice(0,1).toLowerCase()||"?"}function Q({viewerName:s,viewerIsHost:c,railed:i,themePreference:l,onOpenProfile:u,onThemePreference:x,onSignOut:d}){const w=$(),[o,n]=r.useState(!1),m=r.useRef(null);r.useEffect(()=>{if(!o)return;m.current?.querySelector(".chat-you-menu button")?.focus();const t=y=>{const j=y.target;j instanceof Node&&m.current?.contains(j)||n(!1)};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[o]);const f=r.useCallback(t=>{n(!1),t()},[]);return e.jsxs("div",{className:"chat-sidebar-identity",ref:m,onKeyDown:t=>{t.key==="Escape"&&o&&(t.preventDefault(),t.stopPropagation(),n(!1),m.current?.querySelector(".chat-you")?.focus())},children:[o?e.jsxs("div",{className:"chat-you-menu",role:"group","aria-label":`${s} menu`,children:[e.jsxs("div",{className:"chat-you-menu-head",children:[e.jsx(E,{name:s,size:28,title:s}),e.jsx("span",{className:"chat-you-menu-name",children:s})]}),e.jsx("div",{className:"chat-you-menu-rule"}),u?e.jsx("button",{type:"button",className:"chat-you-menu-item",onClick:()=>f(u),children:"Your member card"}):null,e.jsxs("div",{className:"chat-you-menu-group",role:"group","aria-label":"Appearance",children:[e.jsx("span",{className:"label-sm",children:"Appearance"}),e.jsx("div",{className:"chat-you-themes",children:J.map(t=>e.jsx("button",{type:"button",className:"btn btn--sm","aria-pressed":l===t.value,"data-active":l===t.value,onClick:()=>x(t.value),children:t.label},t.value))})]}),w.signOut?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"chat-you-menu-rule"}),e.jsx("button",{type:"button",className:"chat-you-menu-item",onClick:()=>f(d),children:"Sign out"})]}):null]}):null,e.jsxs("button",{type:"button",className:"chat-you","aria-expanded":o,"aria-label":i?`${s} — account menu`:void 0,onClick:()=>n(t=>!t),children:[e.jsx(E,{name:s,size:24,title:s}),i?null:e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"chat-you-who",children:[e.jsx("span",{className:"chat-you-name",children:s}),c?e.jsx("span",{className:"label-sm chat-you-role",children:"Host"}):null]}),e.jsx("span",{className:"chat-you-caret","aria-hidden":"true",children:o?"⌄":"⌃"})]})]})]})}function re({channels:s,directs:c,spaces:i,activeSpace:l,selectedId:u,addressedChannelIds:x,canCreate:d,viewerName:w,viewerIsHost:o,railed:n,themePreference:m,onSelect:f,onSelectSpace:t,onCreate:y,onCreateSpace:j,onDeleteSpace:Y,onInvite:A,onExpandRail:F,onOpenProfile:B,onThemePreference:G,onSignOut:U}){const T=$(),g=r.useRef(null),[L,N]=r.useState(!1),[C,O]=r.useState(""),[D,K]=r.useState(""),[k,R]=r.useState(!1),S=r.useCallback(async()=>{const a=C.trim();if(!(!a||k)){R(!0);try{await y({title:a,topic:D.trim()}),O(""),K(""),N(!1)}finally{R(!1)}}},[k,y,C,D]),v=(a,p)=>{const H=x.has(a.id),b=p?a.title.replace(/^#/u,""):a.title;return e.jsxs("button",{type:"button","data-side-row":!0,className:n?"chat-rail-row":"chat-side-row","aria-label":p?I(a.title):b,"aria-current":a.id===u,"data-addressed":H,title:n?p?I(a.title):b:void 0,onClick:()=>f(a.id),onKeyDown:h=>{h.key==="ArrowDown"?(h.preventDefault(),M(g.current,h.currentTarget,1)):h.key==="ArrowUp"&&(h.preventDefault(),M(g.current,h.currentTarget,-1))},children:[n?p?e.jsxs("span",{className:"chat-rail-glyph",children:[e.jsx("span",{className:"chat-hash",children:"#"}),P(a.title)]}):e.jsx(E,{name:b,size:22,title:b}):e.jsxs(e.Fragment,{children:[p?e.jsx("span",{className:"chat-hash",children:"#"}):null,e.jsx("span",{className:"chat-row-name",children:b})]}),H?e.jsx("span",{className:"dot dot--accent dot--sm","aria-label":"Addressed to you, unanswered"}):null]},a.id)},q=i.length>0?e.jsx(_,{spaces:i,activeSlug:l,canCreate:d&&T.spaceCreate,railed:n,onSelect:t,onCreate:j,onDelete:d?Y:null,onExpandRail:F}):null,z=e.jsx(Q,{viewerName:w,viewerIsHost:o,railed:n,themePreference:m,onOpenProfile:B,onThemePreference:G,onSignOut:U});return n?e.jsxs("nav",{className:"chat-sidebar","data-railed":"true",ref:g,"aria-label":"Channels and direct messages",onDoubleClick:a=>{a.target.closest("button, a, [role='button']")||F()},children:[q,e.jsxs("div",{className:"chat-side-list",children:[s.map(a=>v(a,!0)),c.length>0?e.jsx("div",{className:"chat-rail-rule"}):null,c.map(a=>v(a,!1))]}),e.jsx("div",{className:"chat-sidebar-foot",children:e.jsx("button",{type:"button",className:"chat-rail-row","aria-label":"Invite someone",onClick:A,children:e.jsx("span",{className:"chat-rail-glyph",children:"+"})})}),z]}):e.jsxs("nav",{className:"chat-sidebar",ref:g,"aria-label":"Channels and direct messages",children:[q,e.jsxs("div",{className:"chat-side-list",children:[e.jsxs("div",{className:"chat-side-section",children:[e.jsx("span",{className:"label-md",children:"Channels"}),d&&T.channelCreate?e.jsx("button",{type:"button",className:"chat-side-add","aria-label":"Create a channel","aria-expanded":L,onClick:()=>N(a=>!a),children:"+"}):null]}),L?e.jsxs("div",{className:"chat-create-form",children:[e.jsx("input",{className:"chat-input",value:C,autoFocus:!0,placeholder:"channel-name","aria-label":"Channel name",onChange:a=>O(a.target.value),onKeyDown:a=>{a.key==="Enter"?(a.preventDefault(),S()):a.key==="Escape"&&(a.preventDefault(),N(!1))}}),e.jsx("input",{className:"chat-input",value:D,placeholder:"Topic (optional)","aria-label":"Channel topic",onChange:a=>K(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),S())}}),e.jsxs("div",{className:"chat-create-actions",children:[e.jsx("button",{type:"button",className:"btn btn--sm",disabled:k||!C.trim(),onClick:()=>{S()},children:k?"Creating…":"Create"}),e.jsx("button",{type:"button",className:"btn btn--ghost btn--sm",onClick:()=>N(!1),children:"Cancel"})]})]}):null,s.length===0?e.jsx("p",{className:"chat-side-empty",children:d?`No channels in ${i.find(a=>a.slug===l)?.title??"this space"} yet. Create one to get started.`:"You are not in any channel yet. Open the invitation you were sent."}):s.map(a=>v(a,!0)),c.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"chat-side-section",children:e.jsx("span",{className:"label-md",children:"Direct messages"})}),c.map(a=>v(a,!1))]}):null]}),e.jsx("div",{className:"chat-sidebar-foot",children:e.jsx("button",{type:"button",className:"btn btn--ghost btn--sm",onClick:A,children:"+ Invite"})}),z]})}export{re as ChannelSidebar};
@@ -1 +1 @@
1
- import{r as u,j as e,k as w,h as E,l as N}from"./index-EsrkGBcv.js";import{C as _}from"./CrewSprite-Dhryjx2c.js";const y=16,M=.05,k=.01,P=.01;function v(t,i,s,a){const x=t-s,l=i+y*x,c=Math.exp(-y*a),r=s+(x+l*a)*c,o=(i-y*l*a)*c;return Math.abs(r-s)<k&&Math.abs(o)<P?[s,0]:[r,o]}function g(t,i,s){if(!Number.isFinite(s)||s<=0)return{...t};if(!Number.isFinite(i.x)||!Number.isFinite(i.y))return{...t};if(![t.x,t.y,t.vx,t.vy].every(Number.isFinite))return{...i,vx:0,vy:0};const a=Math.min(s,M),[x,l]=v(t.x,t.vx,i.x,a),[c,r]=v(t.y,t.vy,i.y,a);return{x,y:c,vx:l,vy:r}}function S({slug:t,name:i,pixel:s,paused:a,expression:x}){const l=u.useRef(null),c=u.useRef(null),r=u.useRef({x:0,y:0,vx:0,vy:0}),o=u.useRef(null),m=u.useRef(a);m.current=a,u.useEffect(()=>{const n=window.matchMedia("(prefers-reduced-motion: reduce)");let p=0,d=performance.now();const b=j=>{const C=Math.min(.05,(j-d)/1e3);if(d=j,!document.hidden&&!o.current&&!m.current){r.current=n.matches?{x:0,y:0,vx:0,vy:0}:g(r.current,{x:0,y:0},C);const f=r.current;c.current&&(c.current.style.transform=`translate(${f.x}px, ${f.y}px) rotate(${Math.max(-6,Math.min(6,f.vx*.018))}deg)`)}p=requestAnimationFrame(b)};return p=requestAnimationFrame(b),()=>cancelAnimationFrame(p)},[]);const h=!s||E(t);return e.jsxs("figure",{children:[e.jsx("div",{className:"character-family-preview__stage",ref:l,role:"button",tabIndex:h?0:-1,"aria-label":`Nudge ${i}`,"aria-disabled":!h||a,onKeyDown:n=>{h&&!a&&(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),r.current={x:12,y:-22,vx:0,vy:0})},onPointerDown:n=>{!h||m.current||n.button!==0||(o.current={id:n.pointerId,x:n.clientX-r.current.x,y:n.clientY-r.current.y},n.currentTarget.setPointerCapture(n.pointerId))},onPointerMove:n=>{if(o.current?.id!==n.pointerId)return;const p=Math.max(-35,Math.min(35,n.clientX-o.current.x)),d=Math.max(-45,Math.min(12,n.clientY-o.current.y));r.current={x:p,y:d,vx:0,vy:0},c.current&&(c.current.style.transform=`translate(${p}px, ${d}px)`)},onPointerUp:n=>{o.current?.id===n.pointerId&&(o.current=null,n.currentTarget.releasePointerCapture(n.pointerId))},onPointerCancel:()=>{o.current=null},children:h?e.jsx("span",{ref:c,className:"character-family-preview__moving",children:e.jsx(_,{slug:t,pixel:s,size:s?88:155,paused:a,expression:x})}):e.jsx("span",{className:"character-family-preview__missing",children:"No chip artwork yet"})}),e.jsx("figcaption",{children:i}),!s&&N[t]?e.jsx("small",{children:"Eye expressions available"}):null]})}function R({onClose:t}){const[i,s]=u.useState(!1),[a,x]=u.useState(!1),[l,c]=u.useState("rest");return e.jsxs("section",{className:"character-family-preview","aria-label":"Character family preview",children:[e.jsxs("header",{children:[e.jsxs("div",{children:[e.jsx("strong",{children:"The crew"}),e.jsx("p",{children:"Original identities · expressions · shared movement"})]}),e.jsx("button",{type:"button",onClick:t,"aria-label":"Close character preview",children:"×"})]}),e.jsxs("div",{className:"character-family-preview__poses",role:"group","aria-label":"Character artwork",children:[e.jsx("button",{type:"button","aria-pressed":!i,onClick:()=>s(!1),children:"Crew"}),e.jsx("button",{type:"button","aria-pressed":i,onClick:()=>s(!0),children:"Pixel Chip"}),e.jsx("button",{type:"button",onClick:()=>x(!a),children:a?"Resume motion":"Pause motion"})]}),i?null:e.jsx("div",{className:"character-family-preview__poses",role:"group","aria-label":"Eye expression",children:["rest","look-left","look-up","look-right"].map(r=>e.jsx("button",{type:"button","aria-pressed":r===l,onClick:()=>c(r),children:r.replace("look-","Look ")},r))}),e.jsx("div",{className:"character-family-preview__cast",children:w.map(r=>e.jsx(S,{slug:r.slug,name:r.name,pixel:i,paused:a,expression:l},r.slug))}),e.jsx("p",{children:"Drag a character gently and release. This tests shared spring motion; full-body action sprites and accessories come next."})]})}export{R as CharacterFamilyPreview};
1
+ import{r as u,j as e,k as w,h as E,l as N}from"./index-BFbLvCJn.js";import{C as _}from"./CrewSprite-CguHb2Ny.js";const y=16,M=.05,k=.01,P=.01;function v(t,i,s,a){const x=t-s,l=i+y*x,c=Math.exp(-y*a),r=s+(x+l*a)*c,o=(i-y*l*a)*c;return Math.abs(r-s)<k&&Math.abs(o)<P?[s,0]:[r,o]}function g(t,i,s){if(!Number.isFinite(s)||s<=0)return{...t};if(!Number.isFinite(i.x)||!Number.isFinite(i.y))return{...t};if(![t.x,t.y,t.vx,t.vy].every(Number.isFinite))return{...i,vx:0,vy:0};const a=Math.min(s,M),[x,l]=v(t.x,t.vx,i.x,a),[c,r]=v(t.y,t.vy,i.y,a);return{x,y:c,vx:l,vy:r}}function S({slug:t,name:i,pixel:s,paused:a,expression:x}){const l=u.useRef(null),c=u.useRef(null),r=u.useRef({x:0,y:0,vx:0,vy:0}),o=u.useRef(null),m=u.useRef(a);m.current=a,u.useEffect(()=>{const n=window.matchMedia("(prefers-reduced-motion: reduce)");let p=0,d=performance.now();const b=j=>{const C=Math.min(.05,(j-d)/1e3);if(d=j,!document.hidden&&!o.current&&!m.current){r.current=n.matches?{x:0,y:0,vx:0,vy:0}:g(r.current,{x:0,y:0},C);const f=r.current;c.current&&(c.current.style.transform=`translate(${f.x}px, ${f.y}px) rotate(${Math.max(-6,Math.min(6,f.vx*.018))}deg)`)}p=requestAnimationFrame(b)};return p=requestAnimationFrame(b),()=>cancelAnimationFrame(p)},[]);const h=!s||E(t);return e.jsxs("figure",{children:[e.jsx("div",{className:"character-family-preview__stage",ref:l,role:"button",tabIndex:h?0:-1,"aria-label":`Nudge ${i}`,"aria-disabled":!h||a,onKeyDown:n=>{h&&!a&&(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),r.current={x:12,y:-22,vx:0,vy:0})},onPointerDown:n=>{!h||m.current||n.button!==0||(o.current={id:n.pointerId,x:n.clientX-r.current.x,y:n.clientY-r.current.y},n.currentTarget.setPointerCapture(n.pointerId))},onPointerMove:n=>{if(o.current?.id!==n.pointerId)return;const p=Math.max(-35,Math.min(35,n.clientX-o.current.x)),d=Math.max(-45,Math.min(12,n.clientY-o.current.y));r.current={x:p,y:d,vx:0,vy:0},c.current&&(c.current.style.transform=`translate(${p}px, ${d}px)`)},onPointerUp:n=>{o.current?.id===n.pointerId&&(o.current=null,n.currentTarget.releasePointerCapture(n.pointerId))},onPointerCancel:()=>{o.current=null},children:h?e.jsx("span",{ref:c,className:"character-family-preview__moving",children:e.jsx(_,{slug:t,pixel:s,size:s?88:155,paused:a,expression:x})}):e.jsx("span",{className:"character-family-preview__missing",children:"No chip artwork yet"})}),e.jsx("figcaption",{children:i}),!s&&N[t]?e.jsx("small",{children:"Eye expressions available"}):null]})}function R({onClose:t}){const[i,s]=u.useState(!1),[a,x]=u.useState(!1),[l,c]=u.useState("rest");return e.jsxs("section",{className:"character-family-preview","aria-label":"Character family preview",children:[e.jsxs("header",{children:[e.jsxs("div",{children:[e.jsx("strong",{children:"The crew"}),e.jsx("p",{children:"Original identities · expressions · shared movement"})]}),e.jsx("button",{type:"button",onClick:t,"aria-label":"Close character preview",children:"×"})]}),e.jsxs("div",{className:"character-family-preview__poses",role:"group","aria-label":"Character artwork",children:[e.jsx("button",{type:"button","aria-pressed":!i,onClick:()=>s(!1),children:"Crew"}),e.jsx("button",{type:"button","aria-pressed":i,onClick:()=>s(!0),children:"Pixel Chip"}),e.jsx("button",{type:"button",onClick:()=>x(!a),children:a?"Resume motion":"Pause motion"})]}),i?null:e.jsx("div",{className:"character-family-preview__poses",role:"group","aria-label":"Eye expression",children:["rest","look-left","look-up","look-right"].map(r=>e.jsx("button",{type:"button","aria-pressed":r===l,onClick:()=>c(r),children:r.replace("look-","Look ")},r))}),e.jsx("div",{className:"character-family-preview__cast",children:w.map(r=>e.jsx(S,{slug:r.slug,name:r.name,pixel:i,paused:a,expression:l},r.slug))}),e.jsx("p",{children:"Drag a character gently and release. This tests shared spring motion; full-body action sprites and accessories come next."})]})}export{R as CharacterFamilyPreview};
@@ -1 +1 @@
1
- import{j as i}from"./index-EsrkGBcv.js";import{a as o,S as c}from"./SpriteAvatar-CpZWf54-.js";import{a as l}from"./colors-CFlbwC25.js";import{a as h,n as p,b as u}from"./chat-space-model-aW3Fd8_U.js";import"./agent-state-DDhnFEEP.js";function s(t){return`color-mix(in srgb, var(--muted) 82%, ${l(t)})`}function d({name:t,size:a=24,className:n,title:e}){const r={width:a,height:a,background:s(t),fontSize:Math.max(7,Math.round(a*.38))};return i.jsx("span",{className:`chat-coin${n?` ${n}`:""}`,style:r,title:e,children:p(t)})}function x({member:t,size:a=24,className:n}){const e=o({harness:t.harness??null,state:t.activity?.status??null}),r=t.owner?.displayName?.trim()||null;return i.jsxs("span",{className:`chat-sprite${n?` ${n}`:""}`,style:{width:a,height:a},title:u(t),children:[i.jsx(c,{name:t.displayName||t.actorId,size:a,...e.hue===void 0?{}:{hue:e.hue},tone:e.tone,tile:!0}),r?i.jsx("span",{className:"chat-sprite-owner",style:{background:s(r),width:Math.max(10,Math.round(a*.46)),height:Math.max(10,Math.round(a*.46)),fontSize:Math.max(5,Math.round(a*.24))},"aria-hidden":"true",children:r.slice(0,1).toUpperCase()}):null]})}function f({member:t,size:a=24,className:n}){return h(t)?i.jsx(x,{member:t,size:a,...n?{className:n}:{}}):i.jsx(d,{name:t.displayName||t.actorId,size:a,...n?{className:n}:{},title:t.displayName})}function N({members:t,countLabel:a,onOpen:n}){const e=t.slice(0,4);return i.jsxs("button",{type:"button",className:"chat-facepile",onClick:n,"aria-label":`Members: ${a}`,children:[i.jsx("span",{className:"chat-facepile-faces",children:e.map(r=>i.jsx(f,{member:r,size:20,className:"chat-facepile-face"},r.actorId))}),i.jsx("span",{className:"chat-pile-count",children:a})]})}export{x as AgentSprite,N as Facepile,f as MemberAvatar,d as MemberCoin,s as coinFill};
1
+ import{j as i}from"./index-BFbLvCJn.js";import{a as o,S as c}from"./SpriteAvatar-D53GaaK3.js";import{a as l}from"./colors-CFlbwC25.js";import{a as h,n as p,b as u}from"./chat-space-model-aW3Fd8_U.js";import"./agent-state-DDhnFEEP.js";function s(t){return`color-mix(in srgb, var(--muted) 82%, ${l(t)})`}function d({name:t,size:a=24,className:n,title:e}){const r={width:a,height:a,background:s(t),fontSize:Math.max(7,Math.round(a*.38))};return i.jsx("span",{className:`chat-coin${n?` ${n}`:""}`,style:r,title:e,children:p(t)})}function x({member:t,size:a=24,className:n}){const e=o({harness:t.harness??null,state:t.activity?.status??null}),r=t.owner?.displayName?.trim()||null;return i.jsxs("span",{className:`chat-sprite${n?` ${n}`:""}`,style:{width:a,height:a},title:u(t),children:[i.jsx(c,{name:t.displayName||t.actorId,size:a,...e.hue===void 0?{}:{hue:e.hue},tone:e.tone,tile:!0}),r?i.jsx("span",{className:"chat-sprite-owner",style:{background:s(r),width:Math.max(10,Math.round(a*.46)),height:Math.max(10,Math.round(a*.46)),fontSize:Math.max(5,Math.round(a*.24))},"aria-hidden":"true",children:r.slice(0,1).toUpperCase()}):null]})}function f({member:t,size:a=24,className:n}){return h(t)?i.jsx(x,{member:t,size:a,...n?{className:n}:{}}):i.jsx(d,{name:t.displayName||t.actorId,size:a,...n?{className:n}:{},title:t.displayName})}function N({members:t,countLabel:a,onOpen:n}){const e=t.slice(0,4);return i.jsxs("button",{type:"button",className:"chat-facepile",onClick:n,"aria-label":`Members: ${a}`,children:[i.jsx("span",{className:"chat-facepile-faces",children:e.map(r=>i.jsx(f,{member:r,size:20,className:"chat-facepile-face"},r.actorId))}),i.jsx("span",{className:"chat-pile-count",children:a})]})}export{x as AgentSprite,N as Facepile,f as MemberAvatar,d as MemberCoin,s as coinFill};
@@ -1 +1 @@
1
- import{r as o,j as e}from"./index-EsrkGBcv.js";import{c as M}from"./clipboard-e3fSpeo7.js";import{s as D}from"./MessageEmbeds-ksPazAKH.js";import{a as U}from"./chat-api-DSJMBYoT.js";import{ChatMessageMarkup as W}from"./chat-message-markup-91DIry6R.js";import{u as z}from"./chat-transport-DNS5CB2I.js";import{MemberAvatar as P}from"./ChatAvatar-C3a_o5Hj.js";import{m as B,b as O,y as S,z as L,A as F,C as K,e as H}from"./chat-space-model-aW3Fd8_U.js";import"./api-DSqpVKC7.js";import"./message-markup-BQW5jdJw.js";import"./SpriteAvatar-CpZWf54-.js";import"./agent-state-DDhnFEEP.js";import"./colors-CFlbwC25.js";const I=["👍","❤️","😂","👀","🎉"],A=["🔥","🙏","👏","😢","😮","🚀","✅","💯","🤔","💡","🙌","✨"],J=[...I,...A];new Set(J);function xe({value:t,label:a,className:r="btn btn--sm",copiedLabel:n="Copied",onCopyFailed:i}){const[d,c]=o.useState(!1),[h,u]=o.useState(!1),m=o.useRef(null);o.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const b=o.useCallback(()=>{const p=f=>{c(f),u(!f),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{c(!1),u(!1)},1500)};M(t).then(f=>{p(f),f||i?.()}).catch(()=>{p(!1),i?.()})},[t,i]);return e.jsx("button",{type:"button",className:r,onClick:b,"aria-live":"polite",children:h?"Copy failed — select the text":d?n:a})}function Y({request:t,target:a,withTarget:r,onStop:n}){const i=F(t,a?{label:O(a),reception:a.reception}:null);return e.jsxs("div",{className:"chat-ask-card","data-tone":i.tone,children:[e.jsx("span",{className:"label-sm",children:"Tracked request"}),e.jsx("span",{className:"chip chip--sm chip--mono chip--ghost chat-ask-chip","data-tone":i.tone,"aria-label":i.ariaLabel,children:r?i.textWithTarget:i.text}),i.canStop&&n?e.jsx("button",{type:"button",className:"chat-ask-stop",onClick:()=>n(t.flightId),children:"Stop"}):null]})}const V=/\bhttps?:\/\/[^\s<>"')\]]+/giu;function X(t){const a=new Set,r=[];for(const n of t.matchAll(V)){const i=n[0]?.replace(/[.,;:!?)]+$/u,"")??"";if(!(!i.startsWith("http")||i.includes("/api/blobs/")||a.has(i))&&(a.add(i),r.push(i),r.length>=3))break}return r}function Q({message:t,fallbackLabels:a}){const r=X(t.body);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"chat-turn-body",children:e.jsx(W,{message:t,fallbackLabels:a})}),r.map(n=>e.jsx(Z,{url:n},n))]})}const C=new Map,R=new Map;function G(t){if(C.has(t))return Promise.resolve(C.get(t)??null);const a=R.get(t);if(a)return a;const r=fetch(`${U}?url=${encodeURIComponent(t)}`,{credentials:"include"}).then(async n=>n.ok?(await n.json()).preview??null:null).catch(()=>null).then(n=>(C.set(t,n),R.delete(t),n));return R.set(t,r),r}function Z({url:t}){const[a,r]=o.useState(()=>C.get(t)??null),[n,i]=o.useState(!1);return o.useEffect(()=>{if(a)return;let d=!1;return G(t).then(c=>{d||r(c)}),()=>{d=!0}},[a,t]),a?e.jsxs("a",{className:"chat-link-card",href:a.url,target:"_blank",rel:"noreferrer",children:[a.imageUrl&&!n?e.jsx("img",{className:"chat-link-card-image",src:a.imageUrl,alt:"",loading:"lazy",decoding:"async",onError:()=>i(!0)}):null,e.jsxs("span",{className:"chat-link-card-copy",children:[a.siteName?e.jsx("span",{className:"chat-link-card-site",children:a.siteName}):null,e.jsx("span",{className:"chat-link-card-title",children:a.title}),a.description?e.jsx("span",{className:"chat-link-card-desc",children:a.description}):null]})]}):null}function je({message:t,members:a,nowMs:r,request:n,replyCount:i,lastReplyAt:d,onOpenThread:c,onOpenMember:h,onReact:u,onCopyLink:m,onStopAsk:b,focused:p=!1,withTargetOnChip:f=!0}){const k=z(),[g,s]=o.useState(!1),l=o.useRef(null),x=B(a,t.actorId),_=n?a.get(n.targetActorId)??null:null,T=O(x),N=k.reactions&&!!u,w=()=>{l.current&&(window.clearTimeout(l.current.timer),l.current=null)};return e.jsxs("article",{className:"chat-turn","data-message-id":t.id,"data-focused":p?"true":void 0,"data-reacting":g?"true":void 0,onPointerDown:j=>{if(!N||j.pointerType==="mouse"||j.target?.closest("button"))return;w();const y=j.clientX,v=j.clientY;l.current={x:y,y:v,timer:window.setTimeout(()=>{l.current=null,s(!0)},450)}},onPointerUp:w,onPointerCancel:w,onPointerMove:j=>{if(!l.current)return;const y=j.clientX-l.current.x,v=j.clientY-l.current.y;y*y+v*v>64&&w()},onContextMenu:j=>{N&&g&&j.preventDefault()},children:[h?e.jsx("button",{type:"button",onClick:()=>h(x.actorId),"aria-label":`Open ${T}'s member card`,children:e.jsx(P,{member:x,size:32})}):e.jsx(P,{member:x,size:32}),e.jsxs("div",{children:[e.jsxs("div",{className:"chat-turn-meta",children:[e.jsx("span",{className:"chat-who",children:T}),m?e.jsx("button",{type:"button",className:"chat-when-link",title:"Copy link to this message","aria-label":"Copy link to this message",onClick:()=>m(t.id),children:e.jsx("time",{className:"chat-when",dateTime:new Date(t.createdAt).toISOString(),children:S(t.createdAt)})}):e.jsx("time",{className:"chat-when",dateTime:new Date(t.createdAt).toISOString(),children:S(t.createdAt)}),N?e.jsx(ae,{message:t,onReact:u,pinned:g,onDismiss:()=>s(!1)}):null]}),e.jsx(Q,{message:t}),e.jsx(ee,{attachments:t.attachments??[]}),n?e.jsx(Y,{request:n,target:_,withTarget:f,onStop:b}):null,k.reactions?e.jsx(te,{message:t,onReact:N?u:void 0}):null,c?e.jsx("button",{type:"button",className:"chat-thread-stub","data-empty":i&&i>0?void 0:"true",onClick:c,"aria-label":i&&i>0?`Open thread, ${L(i,d??null,r)}`:`Reply in thread to ${T}`,children:i&&i>0?`⌵ ${L(i,d??null,r)}`:"⌵ Reply in thread"}):null]})]})}const $=new Map;function q({href:t,name:a}){const[r,n]=o.useState(()=>$.get(t)??null);return e.jsx("a",{className:"chat-attach-image",href:t,target:"_blank",rel:"noreferrer",children:e.jsx("img",{src:t,alt:a,loading:"lazy",decoding:"async",fetchPriority:"low",style:r?{aspectRatio:String(r)}:void 0,onLoad:i=>{const{naturalWidth:d,naturalHeight:c}=i.currentTarget;if(!d||!c)return;const h=d/c;$.set(t,h),n(u=>u===h?u:h)}})})}function ee({attachments:t}){return t.length===0?null:e.jsx("div",{className:"chat-attach",children:t.map(a=>{const r=a.url?D(a.url):null,n=a.fileName?.trim()||"Attachment",i=a.mediaType.toLowerCase(),d=n.toLowerCase(),c=r&&(i.startsWith("video/")||/\.(mp4|webm|mov|m4v)$/u.test(d));return r&&i.startsWith("image/")&&i!=="image/svg+xml"&&!c?e.jsx(q,{href:r,name:n},a.id):c?e.jsx("video",{className:"chat-attach-video",src:r,controls:!0,playsInline:!0,preload:"metadata",children:n},a.id):r&&(i.startsWith("audio/")||/\.(mp3|wav|m4a|aac|ogg|oga)$/u.test(d))?e.jsx("audio",{className:"chat-attach-audio",src:r,controls:!0,preload:"metadata",children:n},a.id):r&&(i==="text/html"||i==="application/xhtml+xml")?e.jsx("iframe",{className:"chat-attach-html",title:n,src:r,sandbox:"",referrerPolicy:"no-referrer",loading:"lazy"},a.id):r?e.jsx("a",{className:"chat-attach-file",href:r,target:"_blank",rel:"noreferrer",children:n},a.id):e.jsx("span",{className:"chat-attach-file",children:n},a.id)})})}function E(t,a,r){const n=t.reactions?.find(i=>i.emoji===a)?.me===!0;r(t.id,a,n)}function te({message:t,onReact:a}){const r=t.reactions??[];return r.length===0?null:e.jsx("div",{className:"chat-reaction-row",children:r.map(n=>{const i=n.me?`${n.emoji} ${n.count}, including you. Remove your reaction.`:`${n.emoji} ${n.count}. React with ${n.emoji}.`;return e.jsxs("button",{type:"button",className:"chat-reaction","data-me":n.me?"true":void 0,"aria-pressed":n.me,"aria-label":i,onClick:()=>a&&E(t,n.emoji,a),children:[e.jsx("span",{"aria-hidden":"true",children:n.emoji}),e.jsx("span",{children:n.count})]},n.emoji)})})}function ae({message:t,onReact:a,pinned:r,onDismiss:n}){const[i,d]=o.useState(0),[c,h]=o.useState(!1),u=o.useRef(null),m=[...I],b=c?[...m,...A]:m,p=o.useCallback(()=>{h(!1),d(s=>Math.min(s,I.length-1))},[]),f=o.useCallback(()=>{p(),n()},[p,n]);o.useEffect(()=>{if(!r&&!c)return;const s=l=>{u.current?.contains(l.target)||f()};return window.addEventListener("pointerdown",s),()=>window.removeEventListener("pointerdown",s)},[r,c,f]);const k=s=>{if(s.key==="Escape"){s.preventDefault(),c?p():n();return}if(s.key==="ArrowRight"||s.key==="ArrowLeft"){s.preventDefault();const l=s.key==="ArrowRight"?1:-1;d(x=>(x+l+b.length)%b.length)}if(s.key==="Enter"||s.key===" "){s.preventDefault();const l=b[i];l&&(E(t,l,a),f())}},g=(s,l)=>e.jsx("button",{type:"button",role:"option",tabIndex:l===i?0:-1,"aria-label":`React with ${s}`,"aria-selected":l===i,"aria-pressed":t.reactions?.some(x=>x.emoji===s&&x.me)===!0,onClick:()=>{E(t,s,a),f()},children:s},s);return e.jsxs("div",{ref:u,className:"chat-reaction-picker","data-expanded":c?"true":void 0,role:"listbox","aria-label":"React to this message",onKeyDown:k,children:[m.map(g),e.jsx("button",{type:"button",className:"chat-reaction-more","aria-expanded":c,"aria-label":c?"Fewer emoji":"More emoji",onClick:()=>c?p():h(!0),children:c?"‹":"›"}),c?e.jsx("div",{className:"chat-reaction-sheet",role:"presentation",children:A.map((s,l)=>g(s,m.length+l))}):null]})}function be({member:t,nowMs:a}){const r=K(t,a);return r?e.jsxs("div",{className:"chat-conn","aria-label":r.ariaLabel,children:[e.jsxs("span",{className:"chat-conn-state",children:[r.showDot?e.jsx("span",{className:"dot dot--neutral","aria-hidden":"true"}):null,r.summary]}),e.jsx("span",{className:"chat-conn-detail",children:r.detail}),r.routeNote?e.jsx("span",{className:"chat-conn-detail",children:r.routeNote}):null,r.evidence?e.jsx("span",{className:"chat-conn-evidence",children:r.evidence}):null]}):null}function ge({label:t,children:a}){return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"chat-k",children:t}),e.jsx("span",{className:"chat-v",children:a})]})}function ke({at:t,nowMs:a}){return e.jsx("time",{className:"chat-when",dateTime:new Date(t).toISOString(),children:H(t,a)})}export{xe as CopyAction,ge as Field,Q as MessageBody,be as ReceptionBlock,ke as TimeAgo,Y as TrackedAskCard,je as Turn};
1
+ import{r as o,j as e}from"./index-BFbLvCJn.js";import{c as M}from"./clipboard-e3fSpeo7.js";import{s as D}from"./MessageEmbeds-B-FbWI7a.js";import{a as U}from"./chat-api-BHGHALv2.js";import{ChatMessageMarkup as W}from"./chat-message-markup-esR-YLtN.js";import{u as z}from"./chat-transport-CtxnPLMU.js";import{MemberAvatar as P}from"./ChatAvatar-BsAOShUr.js";import{m as B,b as O,y as S,z as L,A as F,C as K,e as H}from"./chat-space-model-aW3Fd8_U.js";import"./api-DSqpVKC7.js";import"./message-markup-BQW5jdJw.js";import"./SpriteAvatar-D53GaaK3.js";import"./agent-state-DDhnFEEP.js";import"./colors-CFlbwC25.js";const I=["👍","❤️","😂","👀","🎉"],A=["🔥","🙏","👏","😢","😮","🚀","✅","💯","🤔","💡","🙌","✨"],J=[...I,...A];new Set(J);function xe({value:t,label:a,className:r="btn btn--sm",copiedLabel:n="Copied",onCopyFailed:i}){const[d,c]=o.useState(!1),[h,u]=o.useState(!1),m=o.useRef(null);o.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const b=o.useCallback(()=>{const p=f=>{c(f),u(!f),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{c(!1),u(!1)},1500)};M(t).then(f=>{p(f),f||i?.()}).catch(()=>{p(!1),i?.()})},[t,i]);return e.jsx("button",{type:"button",className:r,onClick:b,"aria-live":"polite",children:h?"Copy failed — select the text":d?n:a})}function Y({request:t,target:a,withTarget:r,onStop:n}){const i=F(t,a?{label:O(a),reception:a.reception}:null);return e.jsxs("div",{className:"chat-ask-card","data-tone":i.tone,children:[e.jsx("span",{className:"label-sm",children:"Tracked request"}),e.jsx("span",{className:"chip chip--sm chip--mono chip--ghost chat-ask-chip","data-tone":i.tone,"aria-label":i.ariaLabel,children:r?i.textWithTarget:i.text}),i.canStop&&n?e.jsx("button",{type:"button",className:"chat-ask-stop",onClick:()=>n(t.flightId),children:"Stop"}):null]})}const V=/\bhttps?:\/\/[^\s<>"')\]]+/giu;function X(t){const a=new Set,r=[];for(const n of t.matchAll(V)){const i=n[0]?.replace(/[.,;:!?)]+$/u,"")??"";if(!(!i.startsWith("http")||i.includes("/api/blobs/")||a.has(i))&&(a.add(i),r.push(i),r.length>=3))break}return r}function Q({message:t,fallbackLabels:a}){const r=X(t.body);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"chat-turn-body",children:e.jsx(W,{message:t,fallbackLabels:a})}),r.map(n=>e.jsx(Z,{url:n},n))]})}const C=new Map,R=new Map;function G(t){if(C.has(t))return Promise.resolve(C.get(t)??null);const a=R.get(t);if(a)return a;const r=fetch(`${U}?url=${encodeURIComponent(t)}`,{credentials:"include"}).then(async n=>n.ok?(await n.json()).preview??null:null).catch(()=>null).then(n=>(C.set(t,n),R.delete(t),n));return R.set(t,r),r}function Z({url:t}){const[a,r]=o.useState(()=>C.get(t)??null),[n,i]=o.useState(!1);return o.useEffect(()=>{if(a)return;let d=!1;return G(t).then(c=>{d||r(c)}),()=>{d=!0}},[a,t]),a?e.jsxs("a",{className:"chat-link-card",href:a.url,target:"_blank",rel:"noreferrer",children:[a.imageUrl&&!n?e.jsx("img",{className:"chat-link-card-image",src:a.imageUrl,alt:"",loading:"lazy",decoding:"async",onError:()=>i(!0)}):null,e.jsxs("span",{className:"chat-link-card-copy",children:[a.siteName?e.jsx("span",{className:"chat-link-card-site",children:a.siteName}):null,e.jsx("span",{className:"chat-link-card-title",children:a.title}),a.description?e.jsx("span",{className:"chat-link-card-desc",children:a.description}):null]})]}):null}function je({message:t,members:a,nowMs:r,request:n,replyCount:i,lastReplyAt:d,onOpenThread:c,onOpenMember:h,onReact:u,onCopyLink:m,onStopAsk:b,focused:p=!1,withTargetOnChip:f=!0}){const k=z(),[g,s]=o.useState(!1),l=o.useRef(null),x=B(a,t.actorId),_=n?a.get(n.targetActorId)??null:null,T=O(x),N=k.reactions&&!!u,w=()=>{l.current&&(window.clearTimeout(l.current.timer),l.current=null)};return e.jsxs("article",{className:"chat-turn","data-message-id":t.id,"data-focused":p?"true":void 0,"data-reacting":g?"true":void 0,onPointerDown:j=>{if(!N||j.pointerType==="mouse"||j.target?.closest("button"))return;w();const y=j.clientX,v=j.clientY;l.current={x:y,y:v,timer:window.setTimeout(()=>{l.current=null,s(!0)},450)}},onPointerUp:w,onPointerCancel:w,onPointerMove:j=>{if(!l.current)return;const y=j.clientX-l.current.x,v=j.clientY-l.current.y;y*y+v*v>64&&w()},onContextMenu:j=>{N&&g&&j.preventDefault()},children:[h?e.jsx("button",{type:"button",onClick:()=>h(x.actorId),"aria-label":`Open ${T}'s member card`,children:e.jsx(P,{member:x,size:32})}):e.jsx(P,{member:x,size:32}),e.jsxs("div",{children:[e.jsxs("div",{className:"chat-turn-meta",children:[e.jsx("span",{className:"chat-who",children:T}),m?e.jsx("button",{type:"button",className:"chat-when-link",title:"Copy link to this message","aria-label":"Copy link to this message",onClick:()=>m(t.id),children:e.jsx("time",{className:"chat-when",dateTime:new Date(t.createdAt).toISOString(),children:S(t.createdAt)})}):e.jsx("time",{className:"chat-when",dateTime:new Date(t.createdAt).toISOString(),children:S(t.createdAt)}),N?e.jsx(ae,{message:t,onReact:u,pinned:g,onDismiss:()=>s(!1)}):null]}),e.jsx(Q,{message:t}),e.jsx(ee,{attachments:t.attachments??[]}),n?e.jsx(Y,{request:n,target:_,withTarget:f,onStop:b}):null,k.reactions?e.jsx(te,{message:t,onReact:N?u:void 0}):null,c?e.jsx("button",{type:"button",className:"chat-thread-stub","data-empty":i&&i>0?void 0:"true",onClick:c,"aria-label":i&&i>0?`Open thread, ${L(i,d??null,r)}`:`Reply in thread to ${T}`,children:i&&i>0?`⌵ ${L(i,d??null,r)}`:"⌵ Reply in thread"}):null]})]})}const $=new Map;function q({href:t,name:a}){const[r,n]=o.useState(()=>$.get(t)??null);return e.jsx("a",{className:"chat-attach-image",href:t,target:"_blank",rel:"noreferrer",children:e.jsx("img",{src:t,alt:a,loading:"lazy",decoding:"async",fetchPriority:"low",style:r?{aspectRatio:String(r)}:void 0,onLoad:i=>{const{naturalWidth:d,naturalHeight:c}=i.currentTarget;if(!d||!c)return;const h=d/c;$.set(t,h),n(u=>u===h?u:h)}})})}function ee({attachments:t}){return t.length===0?null:e.jsx("div",{className:"chat-attach",children:t.map(a=>{const r=a.url?D(a.url):null,n=a.fileName?.trim()||"Attachment",i=a.mediaType.toLowerCase(),d=n.toLowerCase(),c=r&&(i.startsWith("video/")||/\.(mp4|webm|mov|m4v)$/u.test(d));return r&&i.startsWith("image/")&&i!=="image/svg+xml"&&!c?e.jsx(q,{href:r,name:n},a.id):c?e.jsx("video",{className:"chat-attach-video",src:r,controls:!0,playsInline:!0,preload:"metadata",children:n},a.id):r&&(i.startsWith("audio/")||/\.(mp3|wav|m4a|aac|ogg|oga)$/u.test(d))?e.jsx("audio",{className:"chat-attach-audio",src:r,controls:!0,preload:"metadata",children:n},a.id):r&&(i==="text/html"||i==="application/xhtml+xml")?e.jsx("iframe",{className:"chat-attach-html",title:n,src:r,sandbox:"",referrerPolicy:"no-referrer",loading:"lazy"},a.id):r?e.jsx("a",{className:"chat-attach-file",href:r,target:"_blank",rel:"noreferrer",children:n},a.id):e.jsx("span",{className:"chat-attach-file",children:n},a.id)})})}function E(t,a,r){const n=t.reactions?.find(i=>i.emoji===a)?.me===!0;r(t.id,a,n)}function te({message:t,onReact:a}){const r=t.reactions??[];return r.length===0?null:e.jsx("div",{className:"chat-reaction-row",children:r.map(n=>{const i=n.me?`${n.emoji} ${n.count}, including you. Remove your reaction.`:`${n.emoji} ${n.count}. React with ${n.emoji}.`;return e.jsxs("button",{type:"button",className:"chat-reaction","data-me":n.me?"true":void 0,"aria-pressed":n.me,"aria-label":i,onClick:()=>a&&E(t,n.emoji,a),children:[e.jsx("span",{"aria-hidden":"true",children:n.emoji}),e.jsx("span",{children:n.count})]},n.emoji)})})}function ae({message:t,onReact:a,pinned:r,onDismiss:n}){const[i,d]=o.useState(0),[c,h]=o.useState(!1),u=o.useRef(null),m=[...I],b=c?[...m,...A]:m,p=o.useCallback(()=>{h(!1),d(s=>Math.min(s,I.length-1))},[]),f=o.useCallback(()=>{p(),n()},[p,n]);o.useEffect(()=>{if(!r&&!c)return;const s=l=>{u.current?.contains(l.target)||f()};return window.addEventListener("pointerdown",s),()=>window.removeEventListener("pointerdown",s)},[r,c,f]);const k=s=>{if(s.key==="Escape"){s.preventDefault(),c?p():n();return}if(s.key==="ArrowRight"||s.key==="ArrowLeft"){s.preventDefault();const l=s.key==="ArrowRight"?1:-1;d(x=>(x+l+b.length)%b.length)}if(s.key==="Enter"||s.key===" "){s.preventDefault();const l=b[i];l&&(E(t,l,a),f())}},g=(s,l)=>e.jsx("button",{type:"button",role:"option",tabIndex:l===i?0:-1,"aria-label":`React with ${s}`,"aria-selected":l===i,"aria-pressed":t.reactions?.some(x=>x.emoji===s&&x.me)===!0,onClick:()=>{E(t,s,a),f()},children:s},s);return e.jsxs("div",{ref:u,className:"chat-reaction-picker","data-expanded":c?"true":void 0,role:"listbox","aria-label":"React to this message",onKeyDown:k,children:[m.map(g),e.jsx("button",{type:"button",className:"chat-reaction-more","aria-expanded":c,"aria-label":c?"Fewer emoji":"More emoji",onClick:()=>c?p():h(!0),children:c?"‹":"›"}),c?e.jsx("div",{className:"chat-reaction-sheet",role:"presentation",children:A.map((s,l)=>g(s,m.length+l))}):null]})}function be({member:t,nowMs:a}){const r=K(t,a);return r?e.jsxs("div",{className:"chat-conn","aria-label":r.ariaLabel,children:[e.jsxs("span",{className:"chat-conn-state",children:[r.showDot?e.jsx("span",{className:"dot dot--neutral","aria-hidden":"true"}):null,r.summary]}),e.jsx("span",{className:"chat-conn-detail",children:r.detail}),r.routeNote?e.jsx("span",{className:"chat-conn-detail",children:r.routeNote}):null,r.evidence?e.jsx("span",{className:"chat-conn-evidence",children:r.evidence}):null]}):null}function ge({label:t,children:a}){return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"chat-k",children:t}),e.jsx("span",{className:"chat-v",children:a})]})}function ke({at:t,nowMs:a}){return e.jsx("time",{className:"chat-when",dateTime:new Date(t).toISOString(),children:H(t,a)})}export{xe as CopyAction,ge as Field,Q as MessageBody,be as ReceptionBlock,ke as TimeAgo,Y as TrackedAskCard,je as Turn};
@@ -1 +1 @@
1
- import{j as e,r as j}from"./index-EsrkGBcv.js";import{a as $,i as O,d as w,c as W}from"./conversations-DoAAO6kA.js";import{l as B,i as q,a as E,p as T}from"./conversation-prefs-DNre-Lcx.js";import{m as G,c as J}from"./machine-scope-DJt9RZ2w.js";import{u as K,f as Q}from"./use-fleet-active-asks-CymmXWH4.js";import{d as X}from"./router-DCtl8wqb.js";import{l as D,i as C,s as Y}from"./sessionRead-CvFz2RHv.js";import{u as Z}from"./use-conversation-list-CY4JciOV.js";import{u as ee}from"./Provider-C35yu29I.js";import{i as se}from"./agent-state-DDhnFEEP.js";import{A as te}from"./AgentAvatar-CrP1eXxk.js";/* empty css */function ae({children:n,count:t,tone:a="default",title:l,onClick:i}){const d=["collapsed-strip-label",a!=="default"&&`collapsed-strip-label--${a}`,t!=null&&"collapsed-strip-label--has-count",i&&"collapsed-strip-label--button"].filter(Boolean).join(" "),o=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"collapsed-strip-label-mark","aria-hidden":!0}),i?e.jsx("span",{className:"collapsed-strip-label-expand","aria-hidden":!0,children:"›"}):null,e.jsx("span",{className:"collapsed-strip-label-text",children:n}),t!=null?e.jsx("span",{className:"collapsed-strip-label-count",children:t}):null]});return i?e.jsx("button",{type:"button",className:d,title:l??n,"aria-label":l??n,onClick:i,children:o}):e.jsx("div",{className:d,title:l??n,children:o})}function ne({label:n,emptyMark:t="·",showLabel:a=!0,labelTone:l="default",labelCount:i,onLabelClick:d,children:o}){const v=!o||Array.isArray(o)&&o.length===0,p=a?e.jsx(ae,{tone:l,count:i,onClick:d,title:d?`Expand ${n}`:void 0,children:n}):null;return v?e.jsxs("div",{className:"collapsed-strip collapsed-strip--empty","aria-hidden":!0,children:[p,e.jsx("span",{className:"collapsed-strip-empty-mark",children:t})]}):e.jsxs("div",{className:"collapsed-strip",role:"list","aria-label":n,children:[p,o]})}function Ie(){return e.jsx("div",{className:"collapsed-strip-rule","aria-hidden":!0})}function le({title:n,active:t,tone:a="default",ava:l,avaColor:i,glyph:d,avatarNode:o,dot:v,pinned:p,onClick:b}){const m=["collapsed-chip",a==="channel"&&"collapsed-chip--channel",a==="neutral"&&"collapsed-chip--neutral",a==="attention"&&"collapsed-chip--attention",a==="unread"&&"collapsed-chip--unread",t&&"collapsed-chip--active",p&&"collapsed-chip--pinned"].filter(Boolean).join(" ");return e.jsxs("button",{type:"button",role:"listitem",className:m,title:n,"aria-label":n,"aria-current":t?"page":void 0,onClick:b,children:[o?e.jsx("span",{className:"collapsed-chip-avatar-wrap",children:o}):l?e.jsx("span",{className:"collapsed-chip-ava",style:i?{"--ava-color":i}:void 0,children:l}):e.jsx("span",{className:`collapsed-chip-glyph${typeof d=="string"&&d.length>1?" collapsed-chip-glyph--long":""}`,children:d}),v?e.jsx("span",{className:["collapsed-chip-dot",v==="attention"&&"collapsed-chip-dot--attention",v==="live"&&"collapsed-chip-dot--live"].filter(Boolean).join(" "),"aria-hidden":!0}):null,p?e.jsx("span",{className:"collapsed-chip-pin","aria-hidden":!0}):null]})}function we(n){const t=n.trim(),a=t.split(/[\s/_-]+/).filter(Boolean);if(a.length>=2){const l=a[a.length-1];return/^\d+$/.test(l)&&a.length>=3?(a[a.length-2][0]??"?").toUpperCase():(l[0]??"?").toUpperCase()}return(t[0]??"?").toUpperCase()}const ie=3,oe=3,re=4,ce=3;function S(n,t){return[...n].sort((a,l)=>{const i=C(a.lastMessageAt,a.id,t)?0:1,d=C(l.lastMessageAt,l.id,t)?0:1;return i!==d?i-d:(l.lastMessageAt??0)-(a.lastMessageAt??0)})}function de({onExpand:n}){const{route:t,navigate:a,agents:l}=ee(),{sessions:i}=Z(),d=K(),[o,v]=j.useState(()=>B()),[p,b]=j.useState(()=>D()),m=X(t),y=j.useMemo(()=>G(l,m),[l,m]),P=j.useMemo(()=>{const s=new Map;for(const f of l)s.set(f.id,f);return s},[l]),R=t.view==="messages"||t.view==="conversation"?t.conversationId:void 0;j.useEffect(()=>{v(B()),b(D())},[]);const r=j.useMemo(()=>{const s=J(i,y,m).filter(c=>!q(c.id,o)),f=s.filter(c=>E(c.id,o)).sort((c,x)=>T(x.id,o)-T(c.id,o)||(x.lastMessageAt??0)-(c.lastMessageAt??0)).slice(0,ie),g=new Set(f.map(c=>c.id)),h=s.filter(c=>!g.has(c.id));return{pinned:f,channels:S(h.filter(w),p).slice(0,oe),dms:S(h.filter(O),p).slice(0,re),observed:S(h.filter($),p).slice(0,ce),totals:{channels:h.filter(w).length,dms:h.filter(O).length,observed:h.filter($).length,pinned:s.filter(c=>E(c.id,o)).length}}},[i,y,m,o,p]),U=s=>{b(Y(s.id)),a({view:"messages",conversationId:s.id,...m?{machineId:m}:{}})},k=[...r.pinned,...r.channels,...r.dms,...r.observed],A=k.filter(s=>C(s.lastMessageAt,s.id,p)).length,M=(s,f=!1)=>{const g=W(s),h=w(s),c=C(s.lastMessageAt,s.id,p),x=h?void 0:he(s,g),V=x??g,I=s.agentId?P.get(s.agentId):void 0,L=Q(d,s),_=L?.status==="needs_attention",z=L?.status==="working",F=I?se(I.state):!1,H=_?"attention":c?"unread":z||F?"live":null;return e.jsx(le,{title:f?`${g} · pinned`:x?`${g} · ${x}`:g,active:s.id===R,tone:h?"channel":_?"attention":c?"unread":"default",avatarNode:h?void 0:e.jsx(te,{agent:I,name:V,size:28,tile:!0,presence:!1}),glyph:h?pe(g):void 0,dot:H,pinned:f,onClick:()=>U(s)},s.id)},u=[];return r.pinned.length&&u.push(e.jsx(N,{mark:"Pin",count:r.totals.pinned,showMark:u.length>0,children:r.pinned.map(s=>M(s,!0))},"pin")),r.channels.length&&u.push(e.jsx(N,{mark:"#",count:r.totals.channels,showMark:u.length>0,children:r.channels.map(s=>M(s))},"ch")),r.dms.length&&u.push(e.jsx(N,{mark:"DM",count:r.totals.dms,showMark:u.length>0,children:r.dms.map(s=>M(s))},"dm")),r.observed.length&&u.push(e.jsx(N,{mark:"Obs",count:r.totals.observed,showMark:u.length>0,children:r.observed.map(s=>M(s))},"obs")),e.jsx(ne,{label:"Chat",emptyMark:"#",labelTone:A>0?"accent":"default",labelCount:A>0?A:k.length||void 0,onLabelClick:n,children:u})}function pe(n){const a=n.replace(/^#+/,"").match(/[a-z0-9]/i)?.[0]?.toLowerCase()??"?";return e.jsxs("span",{className:"collapsed-chip-channel-badge",children:[e.jsx("span",{className:"collapsed-chip-channel-hash","aria-hidden":!0,children:"#"}),e.jsx("span",{className:"collapsed-chip-channel-text",children:a})]})}function he(n,t){const a=t.toLowerCase();for(const l of n.participants??[]){const i=l.displayName||l.label;if(i&&i.toLowerCase()!==a)return i}}function N({mark:n,count:t,showMark:a=!0,children:l}){return e.jsxs("div",{className:"collapsed-strip-section",role:"group","aria-label":n,children:[a?e.jsxs("div",{className:"collapsed-strip-section-mark",title:t!=null?`${n} · ${t}`:n,children:[e.jsx("span",{className:"collapsed-strip-section-mark-text",children:n}),t!=null&&t>0?e.jsx("span",{className:"collapsed-strip-section-mark-count",children:t>99?"99+":t}):null]}):null,l]})}const Se=Object.freeze(Object.defineProperty({__proto__:null,ChatCollapsedStrip:de},Symbol.toStringTag,{value:"Module"}));export{ne as C,de as a,le as b,we as c,Ie as d,Se as e};
1
+ import{j as e,r as j}from"./index-BFbLvCJn.js";import{a as $,i as O,d as w,c as W}from"./conversations-DoAAO6kA.js";import{l as B,i as q,a as E,p as T}from"./conversation-prefs-DNre-Lcx.js";import{m as G,c as J}from"./machine-scope-DJt9RZ2w.js";import{u as K,f as Q}from"./use-fleet-active-asks-DAHOPYPV.js";import{b as X}from"./router-CJIx83Ia.js";import{l as D,i as C,s as Y}from"./sessionRead-CvFz2RHv.js";import{u as Z}from"./use-conversation-list-CGtcpdPd.js";import{u as ee}from"./Provider-BEXAZWd9.js";import{i as se}from"./agent-state-DDhnFEEP.js";import{A as te}from"./AgentAvatar-Dn8TUv5W.js";/* empty css */function ae({children:n,count:t,tone:a="default",title:l,onClick:i}){const d=["collapsed-strip-label",a!=="default"&&`collapsed-strip-label--${a}`,t!=null&&"collapsed-strip-label--has-count",i&&"collapsed-strip-label--button"].filter(Boolean).join(" "),o=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"collapsed-strip-label-mark","aria-hidden":!0}),i?e.jsx("span",{className:"collapsed-strip-label-expand","aria-hidden":!0,children:"›"}):null,e.jsx("span",{className:"collapsed-strip-label-text",children:n}),t!=null?e.jsx("span",{className:"collapsed-strip-label-count",children:t}):null]});return i?e.jsx("button",{type:"button",className:d,title:l??n,"aria-label":l??n,onClick:i,children:o}):e.jsx("div",{className:d,title:l??n,children:o})}function ne({label:n,emptyMark:t="·",showLabel:a=!0,labelTone:l="default",labelCount:i,onLabelClick:d,children:o}){const v=!o||Array.isArray(o)&&o.length===0,p=a?e.jsx(ae,{tone:l,count:i,onClick:d,title:d?`Expand ${n}`:void 0,children:n}):null;return v?e.jsxs("div",{className:"collapsed-strip collapsed-strip--empty","aria-hidden":!0,children:[p,e.jsx("span",{className:"collapsed-strip-empty-mark",children:t})]}):e.jsxs("div",{className:"collapsed-strip",role:"list","aria-label":n,children:[p,o]})}function Ie(){return e.jsx("div",{className:"collapsed-strip-rule","aria-hidden":!0})}function le({title:n,active:t,tone:a="default",ava:l,avaColor:i,glyph:d,avatarNode:o,dot:v,pinned:p,onClick:b}){const m=["collapsed-chip",a==="channel"&&"collapsed-chip--channel",a==="neutral"&&"collapsed-chip--neutral",a==="attention"&&"collapsed-chip--attention",a==="unread"&&"collapsed-chip--unread",t&&"collapsed-chip--active",p&&"collapsed-chip--pinned"].filter(Boolean).join(" ");return e.jsxs("button",{type:"button",role:"listitem",className:m,title:n,"aria-label":n,"aria-current":t?"page":void 0,onClick:b,children:[o?e.jsx("span",{className:"collapsed-chip-avatar-wrap",children:o}):l?e.jsx("span",{className:"collapsed-chip-ava",style:i?{"--ava-color":i}:void 0,children:l}):e.jsx("span",{className:`collapsed-chip-glyph${typeof d=="string"&&d.length>1?" collapsed-chip-glyph--long":""}`,children:d}),v?e.jsx("span",{className:["collapsed-chip-dot",v==="attention"&&"collapsed-chip-dot--attention",v==="live"&&"collapsed-chip-dot--live"].filter(Boolean).join(" "),"aria-hidden":!0}):null,p?e.jsx("span",{className:"collapsed-chip-pin","aria-hidden":!0}):null]})}function we(n){const t=n.trim(),a=t.split(/[\s/_-]+/).filter(Boolean);if(a.length>=2){const l=a[a.length-1];return/^\d+$/.test(l)&&a.length>=3?(a[a.length-2][0]??"?").toUpperCase():(l[0]??"?").toUpperCase()}return(t[0]??"?").toUpperCase()}const ie=3,oe=3,re=4,ce=3;function S(n,t){return[...n].sort((a,l)=>{const i=C(a.lastMessageAt,a.id,t)?0:1,d=C(l.lastMessageAt,l.id,t)?0:1;return i!==d?i-d:(l.lastMessageAt??0)-(a.lastMessageAt??0)})}function de({onExpand:n}){const{route:t,navigate:a,agents:l}=ee(),{sessions:i}=Z(),d=K(),[o,v]=j.useState(()=>B()),[p,b]=j.useState(()=>D()),m=X(t),y=j.useMemo(()=>G(l,m),[l,m]),P=j.useMemo(()=>{const s=new Map;for(const f of l)s.set(f.id,f);return s},[l]),R=t.view==="messages"||t.view==="conversation"?t.conversationId:void 0;j.useEffect(()=>{v(B()),b(D())},[]);const r=j.useMemo(()=>{const s=J(i,y,m).filter(c=>!q(c.id,o)),f=s.filter(c=>E(c.id,o)).sort((c,x)=>T(x.id,o)-T(c.id,o)||(x.lastMessageAt??0)-(c.lastMessageAt??0)).slice(0,ie),g=new Set(f.map(c=>c.id)),h=s.filter(c=>!g.has(c.id));return{pinned:f,channels:S(h.filter(w),p).slice(0,oe),dms:S(h.filter(O),p).slice(0,re),observed:S(h.filter($),p).slice(0,ce),totals:{channels:h.filter(w).length,dms:h.filter(O).length,observed:h.filter($).length,pinned:s.filter(c=>E(c.id,o)).length}}},[i,y,m,o,p]),U=s=>{b(Y(s.id)),a({view:"messages",conversationId:s.id,...m?{machineId:m}:{}})},k=[...r.pinned,...r.channels,...r.dms,...r.observed],A=k.filter(s=>C(s.lastMessageAt,s.id,p)).length,M=(s,f=!1)=>{const g=W(s),h=w(s),c=C(s.lastMessageAt,s.id,p),x=h?void 0:he(s,g),V=x??g,I=s.agentId?P.get(s.agentId):void 0,L=Q(d,s),_=L?.status==="needs_attention",z=L?.status==="working",F=I?se(I.state):!1,H=_?"attention":c?"unread":z||F?"live":null;return e.jsx(le,{title:f?`${g} · pinned`:x?`${g} · ${x}`:g,active:s.id===R,tone:h?"channel":_?"attention":c?"unread":"default",avatarNode:h?void 0:e.jsx(te,{agent:I,name:V,size:28,tile:!0,presence:!1}),glyph:h?pe(g):void 0,dot:H,pinned:f,onClick:()=>U(s)},s.id)},u=[];return r.pinned.length&&u.push(e.jsx(N,{mark:"Pin",count:r.totals.pinned,showMark:u.length>0,children:r.pinned.map(s=>M(s,!0))},"pin")),r.channels.length&&u.push(e.jsx(N,{mark:"#",count:r.totals.channels,showMark:u.length>0,children:r.channels.map(s=>M(s))},"ch")),r.dms.length&&u.push(e.jsx(N,{mark:"DM",count:r.totals.dms,showMark:u.length>0,children:r.dms.map(s=>M(s))},"dm")),r.observed.length&&u.push(e.jsx(N,{mark:"Obs",count:r.totals.observed,showMark:u.length>0,children:r.observed.map(s=>M(s))},"obs")),e.jsx(ne,{label:"Chat",emptyMark:"#",labelTone:A>0?"accent":"default",labelCount:A>0?A:k.length||void 0,onLabelClick:n,children:u})}function pe(n){const a=n.replace(/^#+/,"").match(/[a-z0-9]/i)?.[0]?.toLowerCase()??"?";return e.jsxs("span",{className:"collapsed-chip-channel-badge",children:[e.jsx("span",{className:"collapsed-chip-channel-hash","aria-hidden":!0,children:"#"}),e.jsx("span",{className:"collapsed-chip-channel-text",children:a})]})}function he(n,t){const a=t.toLowerCase();for(const l of n.participants??[]){const i=l.displayName||l.label;if(i&&i.toLowerCase()!==a)return i}}function N({mark:n,count:t,showMark:a=!0,children:l}){return e.jsxs("div",{className:"collapsed-strip-section",role:"group","aria-label":n,children:[a?e.jsxs("div",{className:"collapsed-strip-section-mark",title:t!=null?`${n} · ${t}`:n,children:[e.jsx("span",{className:"collapsed-strip-section-mark-text",children:n}),t!=null&&t>0?e.jsx("span",{className:"collapsed-strip-section-mark-count",children:t>99?"99+":t}):null]}):null,l]})}const Se=Object.freeze(Object.defineProperty({__proto__:null,ChatCollapsedStrip:de},Symbol.toStringTag,{value:"Module"}));export{ne as C,de as a,le as b,we as c,Ie as d,Se as e};
@@ -1,4 +1,4 @@
1
- import{r as d,j}from"./index-EsrkGBcv.js";import{p as v}from"./message-markup-BQW5jdJw.js";const y=/`([^`\n]+)`|\*\*(.+?)\*\*|\*([^*\s][^*]*?)\*|\[([^\]\n]+)\]\(([^)\s]+)\)/gu;function l(n){return n.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;")}function M(n){return n.replace(/&nbsp;/giu," ").replace(/&amp;/gu,"&").replace(/&lt;/gu,"<").replace(/&gt;/gu,">").replace(/&quot;/gu,'"')}function f(n){const t=[];let r=0;for(const e of n.matchAll(y)){const a=e.index??0;a>r&&t.push(l(n.slice(r,a))),e[1]!==void 0?t.push(`<code class="chat-md-code">${l(e[1])}</code>`):e[2]!==void 0?t.push(`<strong>${l(e[2])}</strong>`):e[3]!==void 0?t.push(`<em>${l(e[3])}</em>`):e[4]!==void 0&&e[5]!==void 0?t.push(`<a class="chat-url" href="${l(e[5])}">${l(e[4])}</a>`):t.push(l(e[0]??"")),r=a+e[0].length}return r<n.length&&t.push(l(n.slice(r))),t.join("")}function L(n){const t=v(n);return t.length===0?n.trim()?`<p>${f(n)}</p>`:"":t.map(r=>{switch(r.type){case"paragraph":return`<p>${f(r.text)}</p>`;case"heading":{const e=Math.min(3,Math.max(1,r.depth));return`<div class="chat-md-h chat-md-h${e}" role="heading" aria-level="${e+1}">${f(r.text)}</div>`}case"hr":return'<hr class="chat-md-hr">';case"list":{const e=r.ordered?"ol":"ul",a=r.items.map(u=>`<li>${f(u)}</li>`).join("");return`<${e} class="chat-md-list">${a}</${e}>`}case"blockquote":return`<blockquote class="chat-md-quote">${f(r.text)}</blockquote>`;case"code":return`<pre class="chat-md-pre"><code>${l(r.text)}</code></pre>`;case"table":{const e=r.headers.map(u=>`<th>${f(u)}</th>`).join(""),a=r.rows.map(u=>`<tr>${r.headers.map((T,$)=>`<td>${f(u[$]??"")}</td>`).join("")}</tr>`).join("");return`<table class="chat-md-table"><thead><tr>${e}</tr></thead><tbody>${a}</tbody></table>`}}}).join("")}function N(n,t){return!t.trim()||t.startsWith(n)&&t.endsWith(n)?t:`${n}${t}${n}`}function R(n){if(n.nodeType===Node.TEXT_NODE)return M(n.textContent??"");if(n.nodeType!==Node.ELEMENT_NODE)return"";const t=n,r=t.tagName;if(r==="BR")return`
1
+ import{r as d,j}from"./index-BFbLvCJn.js";import{p as v}from"./message-markup-BQW5jdJw.js";const y=/`([^`\n]+)`|\*\*(.+?)\*\*|\*([^*\s][^*]*?)\*|\[([^\]\n]+)\]\(([^)\s]+)\)/gu;function l(n){return n.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;")}function M(n){return n.replace(/&nbsp;/giu," ").replace(/&amp;/gu,"&").replace(/&lt;/gu,"<").replace(/&gt;/gu,">").replace(/&quot;/gu,'"')}function f(n){const t=[];let r=0;for(const e of n.matchAll(y)){const a=e.index??0;a>r&&t.push(l(n.slice(r,a))),e[1]!==void 0?t.push(`<code class="chat-md-code">${l(e[1])}</code>`):e[2]!==void 0?t.push(`<strong>${l(e[2])}</strong>`):e[3]!==void 0?t.push(`<em>${l(e[3])}</em>`):e[4]!==void 0&&e[5]!==void 0?t.push(`<a class="chat-url" href="${l(e[5])}">${l(e[4])}</a>`):t.push(l(e[0]??"")),r=a+e[0].length}return r<n.length&&t.push(l(n.slice(r))),t.join("")}function L(n){const t=v(n);return t.length===0?n.trim()?`<p>${f(n)}</p>`:"":t.map(r=>{switch(r.type){case"paragraph":return`<p>${f(r.text)}</p>`;case"heading":{const e=Math.min(3,Math.max(1,r.depth));return`<div class="chat-md-h chat-md-h${e}" role="heading" aria-level="${e+1}">${f(r.text)}</div>`}case"hr":return'<hr class="chat-md-hr">';case"list":{const e=r.ordered?"ol":"ul",a=r.items.map(u=>`<li>${f(u)}</li>`).join("");return`<${e} class="chat-md-list">${a}</${e}>`}case"blockquote":return`<blockquote class="chat-md-quote">${f(r.text)}</blockquote>`;case"code":return`<pre class="chat-md-pre"><code>${l(r.text)}</code></pre>`;case"table":{const e=r.headers.map(u=>`<th>${f(u)}</th>`).join(""),a=r.rows.map(u=>`<tr>${r.headers.map((T,$)=>`<td>${f(u[$]??"")}</td>`).join("")}</tr>`).join("");return`<table class="chat-md-table"><thead><tr>${e}</tr></thead><tbody>${a}</tbody></table>`}}}).join("")}function N(n,t){return!t.trim()||t.startsWith(n)&&t.endsWith(n)?t:`${n}${t}${n}`}function R(n){if(n.nodeType===Node.TEXT_NODE)return M(n.textContent??"");if(n.nodeType!==Node.ELEMENT_NODE)return"";const t=n,r=t.tagName;if(r==="BR")return`
2
2
  `;if(r==="PRE")return`
3
3
  \`\`\`
4
4
  ${(t.textContent??"").replace(/\n$/u,"")}
@@ -0,0 +1 @@
1
+ import{j as e}from"./index-BFbLvCJn.js";import{u as G}from"./chat-transport-CtxnPLMU.js";import{MemberAvatar as F}from"./ChatAvatar-BsAOShUr.js";import{ChannelComposer as J}from"./ChannelComposer-D4EY9jVW.js";import{Turn as O,Field as x,CopyAction as Q,ReceptionBlock as U}from"./ChatBits-Cq54CmyB.js";import{c as V,m as X,a as f,b,d as Y,e as Z,f as _,g as E,h as ee,j as ae,k as se,l as ne}from"./chat-space-model-aW3Fd8_U.js";import"./chat-api-BHGHALv2.js";import"./api-DSqpVKC7.js";import"./SpriteAvatar-D53GaaK3.js";import"./agent-state-DDhnFEEP.js";import"./colors-CFlbwC25.js";import"./ComposerAttachments-9uYp_Lh5.js";import"./media-blobs-Bi8pxr1u.js";import"./file-text-BOJQiS8p.js";import"./createLucideIcon-CKbjXlwv.js";import"./ChatRichInput-DYJRhGTP.js";import"./message-markup-BQW5jdJw.js";import"./x-BcfhXYiF.js";import"./paperclip-DLf_ABSv.js";import"./chevron-down-DEDSNJNY.js";import"./loader-circle-CCG7hG7z.js";import"./arrow-up-DFy-9ghF.js";import"./clipboard-e3fSpeo7.js";import"./MessageEmbeds-B-FbWI7a.js";import"./chat-message-markup-esR-YLtN.js";function te(s){return s.length>12?`…${s.slice(-8)}`:s}function le({member:s,viewerActorId:r,onOpen:c}){const n=E(s,r),o=s.reception.state==="disconnected"||s.reception.state==="unavailable";return e.jsxs("button",{type:"button",className:"chat-member-row",onClick:()=>c(s.actorId),children:[e.jsx(F,{member:s,size:24}),e.jsx("span",{className:"chat-member-name",children:b(s)}),n?e.jsx("span",{className:"chat-member-fact","data-stranded":o&&n!=="you",children:n}):null]})}function ce({invite:s,nowMs:r,onRevoke:c,busy:n,canRevoke:o}){const d=ee(s),p=s.invitee?.displayName?.trim(),t=ae(s.expiresAt,r);return e.jsxs("div",{className:"chat-invite-row",children:[e.jsx("span",{className:"chat-token-hint",children:se(s.tokenHint)}),e.jsx("span",{children:[ne(d),p?`for ${p}`:null,t].filter(Boolean).join(" · ")}),o?e.jsx("button",{type:"button",className:"chat-invite-revoke",disabled:n,onClick:()=>c(s.id),children:"Revoke"}):s.state==="active"?e.jsx("span",{}):e.jsx("span",{className:"chat-invite-revoke","aria-hidden":"false",children:s.state})]})}function Pe({view:s,channel:r,members:c,membersById:n,invites:o,inviteError:d,revokingInviteId:p,viewerActorId:t,viewerIsOperator:L,nowMs:h,threadRoot:j,threadReplies:k,threadRequest:P,threadDraft:$,onThreadDraftChange:w,onSendThreadReply:B,onReact:v,onCopyLink:g,onStopAsk:H,focusMessageId:y,threadSending:M,threadError:S,onClose:u,onBack:z,onOpenMember:D,onMention:K,onRevokeInvite:q,onInvite:C,overlay:N}){const I=G();if(s.kind==="none")return null;const T=V(r.title);if(s.kind==="thread")return e.jsxs("aside",{className:"chat-rpanel","data-overlay":N,"aria-label":"Thread",children:[e.jsxs("header",{className:"chat-rpanel-head",children:[e.jsx("span",{className:"chat-rpanel-title",children:"Thread"}),e.jsx("span",{className:"chat-rpanel-scope",children:T}),e.jsx("button",{type:"button",className:"chat-rpanel-close",onClick:u,"aria-label":"Close panel",children:"×"})]}),e.jsxs("div",{className:"chat-rpanel-body",children:[j?e.jsx("div",{className:"chat-anchor-msg",children:e.jsx(O,{message:j,members:n,nowMs:h,request:P,withTargetOnChip:!1,onReact:v,onCopyLink:g,onStopAsk:H,focused:y===j.id})}):e.jsx("p",{className:"chat-feed-notice",children:"This thread's anchor message is no longer in the channel feed."}),k.map(a=>e.jsx(O,{message:a,members:n,nowMs:h,onReact:v,onCopyLink:g,focused:y===a.id},a.id)),k.length===0&&j?e.jsx("p",{className:"chat-feed-notice",children:"No replies yet."}):null,e.jsx("div",{className:"chat-thread-composer",children:e.jsx(J,{members:c,draft:$,onDraftChange:w,askTargetId:null,onAskTargetChange:()=>{},onSend:B,sending:M,error:S,placeholder:"Reply in thread…",variant:"thread"})})]})]});if(s.kind==="member"){const a=X(n,s.actorId),i=f(a),m=a.owner?.displayName?.trim()??null,l=a.reception.attachedSessionId,W=i&&a.owner?.actorId===t;return e.jsxs("aside",{className:"chat-rpanel","data-overlay":N,"aria-label":"Member",children:[e.jsxs("header",{className:"chat-rpanel-head",children:[e.jsx("button",{type:"button",className:"chat-rpanel-back",onClick:z,"aria-label":"Back to members",children:"‹"}),e.jsx("span",{className:"chat-rpanel-title",children:"Member"}),e.jsx("button",{type:"button",className:"chat-rpanel-close",onClick:u,"aria-label":"Close panel",children:"×"})]}),e.jsxs("div",{className:"chat-rpanel-body",children:[e.jsxs("div",{className:"chat-mcard-head",children:[e.jsx(F,{member:a,size:32}),e.jsxs("div",{children:[e.jsx("div",{className:"chat-mcard-name",children:b(a)}),e.jsx("div",{className:"chat-mcard-sub",children:[i?"agent":a.kind==="unknown"?"former member":"person",Y(a)?"via API":null,m?`owned by ${m}`:null,a.actorId===t?"you":null].filter(Boolean).join(" · ")})]})]}),a.harness||a.projectRoot||l||a.nodeId?e.jsxs("div",{className:"chat-psec chat-kv",children:[a.harness?e.jsx(x,{label:"Harness",children:[a.harness,a.model].filter(Boolean).join(" · ")}):null,a.projectRoot?e.jsx(x,{label:"Project",children:a.projectRoot}):null,l?e.jsxs(x,{label:"Session",children:[te(l),e.jsx(Q,{value:l,label:"copy",className:"chat-copy-inline",copiedLabel:"ok"})]}):null,a.nodeId?e.jsx(x,{label:"Node",children:a.nodeId}):null]}):null,i?e.jsxs("div",{className:"chat-psec",children:[e.jsx(U,{member:a,nowMs:h}),a.reception.redeemedAt?e.jsx("span",{className:"chat-conn-evidence",children:`joined ${Z(a.reception.redeemedAt,h)}`}):null]}):null,e.jsxs("div",{className:"chat-psec",style:{display:"flex",gap:"var(--space-sm)",flexWrap:"wrap"},children:[e.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>K(a.actorId),children:"Mention"}),W||a.actorId===t?e.jsx("button",{type:"button",className:"btn btn--sm",onClick:C,children:"Copy agent invitation"}):null]})]})]})}const A=[...c].sort((a,i)=>{const m=Number(f(a)),l=Number(f(i));return m!==l?m-l:b(a).localeCompare(b(i))}),R=o.filter(a=>a.state==="active");return e.jsxs("aside",{className:"chat-rpanel","data-overlay":N,"aria-label":"Members",children:[e.jsxs("header",{className:"chat-rpanel-head",children:[e.jsx("span",{className:"chat-rpanel-title",children:"Members"}),e.jsx("span",{className:"chat-rpanel-scope",children:T}),e.jsx("button",{type:"button",className:"chat-rpanel-close",onClick:u,"aria-label":"Close panel",children:"×"})]}),e.jsxs("div",{className:"chat-rpanel-body",children:[e.jsxs("div",{className:"chat-psec",children:[e.jsx("span",{className:"label-sm",children:"In this channel"}),A.length===0?e.jsx("p",{className:"chat-feed-notice",children:"The roster is empty."}):A.map(a=>e.jsx(le,{member:a,viewerActorId:t,onOpen:D},a.actorId))]}),e.jsxs("div",{className:"chat-psec",children:[e.jsx("span",{className:"label-sm",children:"Invited"}),d?e.jsx("p",{className:"chat-sheet-error",children:d}):null,I.inviteList?R.length===0&&!d?e.jsx("p",{className:"chat-feed-notice",children:"No outstanding invitations."}):R.map(a=>e.jsx(ce,{invite:a,nowMs:h,onRevoke:q,busy:p===a.id,canRevoke:I.inviteRevoke&&_(a,{actorId:t,isOperator:L})},a.id)):e.jsx("p",{className:"chat-feed-notice",children:"This server does not list outstanding invitations. A link is shown once, when you create it."}),e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx("button",{type:"button",className:"btn btn--sm",onClick:C,children:"Invite"})})]})]})]})}export{Pe as ChatRightPanel,le as MemberRow};
@@ -0,0 +1 @@
1
+ import{r as n,j as a}from"./index-BFbLvCJn.js";import{D as ee,C as te}from"./chat-api-BHGHALv2.js";import{a as Ht,u as $t,b as Bt,c as Ut}from"./chat-transport-CtxnPLMU.js";import{u as qt,S as Oe,R as Vt,a as Xt}from"./useSidebarCollapse-DoMvU_2R.js";import{useScoutStandaloneAppearance as Kt,ChatSpaceTheme as Fe}from"./ChatSpaceTheme-DPzYpw-v.js";import{ChannelSidebar as Gt}from"./ChannelSidebar-CVmykV4d.js";import{ChannelComposer as Yt}from"./ChannelComposer-D4EY9jVW.js";import{ChatRightPanel as Jt}from"./ChatRightPanel-D94Lw7ud.js";import{Facepile as Qt}from"./ChatAvatar-BsAOShUr.js";import{Turn as Zt}from"./ChatBits-Cq54CmyB.js";import{InviteSheet as en}from"./InviteSheet-BiGMNpsE.js";import{JumpPalette as tn}from"./JumpPalette-goXAVByA.js";import{s as nn,p as sn,q as an,t as rn,u as nt,v as on,b as cn,w as ln,x as dn,c as st,B as un,F as hn,R as mn}from"./chat-space-model-aW3Fd8_U.js";import{uploadMediaFiles as pn}from"./media-blobs-Bi8pxr1u.js";import{c as fn}from"./clipboard-e3fSpeo7.js";import"./api-DSqpVKC7.js";import"./chunk-YOZR3KYS-apgUnfXh.js";import"./createLucideIcon-CKbjXlwv.js";import"./arrow-up-DFy-9ghF.js";import"./arrow-down--OUDFWIq.js";import"./theme-vars-DNK0nn3k.js";import"./SpaceSwitcher-WccPJ0fS.js";import"./SpriteAvatar-D53GaaK3.js";import"./agent-state-DDhnFEEP.js";import"./colors-CFlbwC25.js";import"./ComposerAttachments-9uYp_Lh5.js";import"./file-text-BOJQiS8p.js";import"./ChatRichInput-DYJRhGTP.js";import"./message-markup-BQW5jdJw.js";import"./x-BcfhXYiF.js";import"./paperclip-DLf_ABSv.js";import"./chevron-down-DEDSNJNY.js";import"./loader-circle-CCG7hG7z.js";import"./MessageEmbeds-B-FbWI7a.js";import"./chat-message-markup-esR-YLtN.js";import"./keyboard-nav-CEe-ApvZ.js";import"./users-BQPEIUfd.js";import"./bot-BNv_ZJzi.js";import"./monitor-M0VSmHQ-.js";function at(){let c=0;return{begin(){const r=c;return()=>r===c},reset(){c+=1}}}const gn=["ready","channel.changed"],wn=350,bn=2e3,vn=3e4,In=3;function Cn(c,r){const l=`/api/channels/${encodeURIComponent(c)}/events`;return r&&r!=="home"?`${l}?space=${encodeURIComponent(r)}`:l}const Sn={now:()=>Date.now(),setTimer:(c,r)=>setTimeout(c,r),clearTimer:c=>clearTimeout(c)};function En(c){const r=globalThis.EventSource;return typeof r!="function"?null:new r(c,{withCredentials:!0})}function yn(c){const{channelId:r,space:l,onInvalidate:d,createEventSource:m=En,onStatus:q,minRefreshMs:Y=wn,clock:h=Sn}=c;let b=!1,M=null,A=null,C=null,z=!1,s=!1,P=Number.NEGATIVE_INFINITY,x=!1,_=0,i=0;const N=I=>{b||q?.(I)},y=()=>{A!==null&&(h.clearTimer(A),A=null)},R=()=>{C!==null&&(h.clearTimer(C),C=null)},k=()=>{A=null,!b&&(z=!0,s=!1,P=h.now(),Promise.resolve().then(()=>b?void 0:d()).catch(()=>{}).then(()=>{z=!1,s&&!b&&V()}))},V=()=>{if(b)return;if(z){s=!0;return}if(A!==null)return;const I=Math.max(0,Y-(h.now()-P));if(I===0){k();return}A=h.setTimer(k,I)},le=()=>{const L=Math.min(bn*2**Math.max(0,(x?i:_)-1),vn);N("retrying"),R(),C=h.setTimer(()=>{C=null,O()},L)};function O(){if(b||M!==null)return;N("connecting");let I=null;try{I=m(Cn(r,l))}catch{I=null}if(!I){N("unsupported");return}M=I;const L=I,ne=()=>!b&&M===L;L.addEventListener("open",()=>{ne()&&(x=!0,_=0,i=0,N("live"))});for(const de of gn)L.addEventListener(de,()=>{ne()&&V()});L.addEventListener("error",()=>{if(ne()){if(M=null,L.close(),x){i+=1,le();return}if(_+=1,_>=In){N("unavailable");return}le()}})}return O(),()=>{if(b)return;b=!0,y(),R(),s=!1;const I=M;M=null,I?.close()}}const rt="appshell.chat.sidebar.manualCollapsed",ct="openscout.chat.panel.width",ce=360,lt=280,dt=520;function kn(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(rt)!=null)return;const c=window.localStorage.getItem("openscout.chat.rail")==="1";window.localStorage.setItem(rt,JSON.stringify(c))}catch{}}function xn(){if(typeof window>"u")return ce;try{const c=Number(window.localStorage.getItem(ct));return!Number.isFinite(c)||c<=0?ce:Math.max(lt,Math.min(dt,Math.round(c)))}catch{return ce}}function ot(c){if(!(typeof window>"u"))try{window.localStorage.setItem(ct,String(c))}catch{}}function Tn(){const[c,r]=n.useState(()=>typeof window<"u"?window.innerWidth:1280);return n.useEffect(()=>{const l=()=>r(window.innerWidth);return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),c}function it(c){const[r,l]=n.useState(()=>typeof window<"u"&&window.matchMedia?window.matchMedia(c).matches:!1);return n.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const d=window.matchMedia(c),m=()=>l(d.matches);return m(),d.addEventListener("change",m),()=>d.removeEventListener("change",m)},[c]),r}function We(c,r,l){const d=n.useRef(c);d.current=c,n.useEffect(()=>{if(!l)return;let m=!1,q=!1;const Y=()=>{m||q||typeof document<"u"&&document.hidden||(q=!0,d.current().finally(()=>{q=!1}))},h=setInterval(Y,r),b=()=>{typeof document<"u"&&!document.hidden&&Y()};return document.addEventListener("visibilitychange",b),()=>{m=!0,clearInterval(h),document.removeEventListener("visibilitychange",b)}},[l,r])}function Mn(c,r,l,d){const m=n.useRef(l);m.current=l,n.useEffect(()=>{if(!(!r||!c))return yn({channelId:c,space:d,onInvalidate:()=>m.current()})},[c,r,d])}async function Nn(c,r){return c.length===0?[]:r(c)}function gs({signedOut:c}={}){const r=Ht(),l=$t(),d=Bt(),{theme:m,preference:q,setPreference:Y}=Kt(),[h,b]=n.useState("loading"),[M,A]=n.useState(null),[C,z]=n.useState(null),[s,P]=n.useState(()=>d.read().channelId),[x,_]=n.useState(()=>d.read().messageId),[i,N]=n.useState(()=>d.read().space??ee),[y,R]=n.useState(null),[k,V]=n.useState([]),[le,O]=n.useState([]),[I,L]=n.useState(null),[ne,de]=n.useState(null),[Se,se]=n.useState(null),[ut,ae]=n.useState(!1),[ht,Ee]=n.useState({}),[mt,ze]=n.useState({}),[pt,He]=n.useState({}),[J,F]=n.useState({kind:"none"}),[ye,ue]=n.useState(!1),[ke,he]=n.useState(!1),[xe,$e]=n.useState(!1),[ft,Be]=n.useState(null),[Te,Ue]=n.useState(!1),[gt,qe]=n.useState(null),[me,wt]=n.useState(()=>Date.now()),[bt,W]=n.useState(()=>d.read().channelId?"channel":"list");kn();const vt=Tn(),Q=it("(max-width: 899px)"),pe=it("(max-width: 1199px)"),p=qt("chat",Q?1600:vt,Oe),Me=n.useRef(p.width),[fe,Ve]=n.useState(xn),Ne=n.useRef(fe),[It,ge]=n.useState(null),Re=n.useRef(null),Xe=n.useRef(null),we=n.useRef(null),[H]=n.useState(at),[Le]=n.useState(at),Ke=n.useRef(i);Ke.current!==i&&(Ke.current=i,Le.reset());const $=n.useCallback(async e=>{const t=Le.begin();try{const o=await r.bootstrap({recoverSession:!new URLSearchParams(window.location.search).has("signedOut"),space:i});if(!t())return;z(o),o.space&&o.space!==i&&N(o.space),b("ready"),A(null)}catch(o){if(!t())return;if(o instanceof te&&o.isUnauthenticated){if(!e&&h==="ready"){ae(!0);return}b("gate"),A(o.message);return}e?(b("error"),A(o instanceof Error?o.message:"Scout Chat could not be reached.")):ae(!0)}},[Le,r,h,i]);n.useEffect(()=>{$(!0)},[$]),We(()=>$(!1),un,h==="ready");const j=n.useMemo(()=>nn((C?.channels??[]).filter(e=>e.kind==="channel")),[C]),B=n.useMemo(()=>(C?.channels??[]).filter(e=>e.kind==="direct"||e.kind==="group_direct"),[C]),Ge=n.useMemo(()=>new Set([...j,...B].map(e=>e.id)),[j,B]),Ct=n.useMemo(()=>C?.spaces?.length?C.spaces:[{slug:i,title:i===ee?"Home":i,conversationId:null,isDefault:i===ee,channelCount:j.length}],[C,j.length,i]);n.useEffect(()=>{if(h!=="ready"||s&&Ge.has(s))return;const e=j[0]?.id??B[0]?.id??null;e!==s&&(P(e),d.write({channelId:e,space:i,messageId:null},!0))},[d,s,j,B,h,Ge,i]),n.useEffect(()=>{const e=()=>{const t=d.read();P(t.channelId),N(t.space??ee),_(t.messageId),F({kind:"none"}),W(t.channelId?"channel":"list")};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[d]);const v=n.useMemo(()=>[...j,...B].find(e=>e.id===s)??null,[j,s,B]),D=n.useCallback(async()=>{if(!s)return;const e=H.begin();try{const t=await r.feed(s,i);if(!e())return;R(t),se(null),ae(!1)}catch(t){if(!e())return;if(t instanceof te&&t.isUnauthenticated){se(t.message);return}ae(!0)}},[s,r,H,i]),re=n.useCallback(async()=>{if(!s)return;const e=H.begin();try{const t=await r.members(s,i);if(!e())return;V(o=>{const u=t.members??[];return u.length===0?o:we.current!==s?(we.current=s,u):sn(o,u)})}catch{if(!e())return;ae(!0)}},[s,r,H,i]),oe=n.useCallback(async()=>{if(!s||!l.inviteList)return;const e=H.begin();try{const t=await r.invites(s,i);if(!e())return;O(t.invites??[]),L(null)}catch(t){if(!e())return;O([]),L(t instanceof te&&t.isUnauthenticated?"Only members of this channel can manage its invitations.":t instanceof Error?t.message:"Invitations could not be read.")}},[l.inviteList,s,r,H,i]);n.useEffect(()=>{H.reset(),R(null),O([]),se(null),F({kind:"none"}),we.current!==s&&(we.current=null)},[s,H]),n.useEffect(()=>{s&&(D(),re(),oe())},[s,D,oe,re]),We(D,hn,h==="ready"&&!!s),We(re,mn,h==="ready"&&!!s),Mn(s,h==="ready"&&l.liveStream,D,i),n.useEffect(()=>{const e=setInterval(()=>wt(Date.now()),3e4);return()=>clearInterval(e)},[]);const be=n.useMemo(()=>{const e=new Map;for(const t of k)e.set(t.actorId,t);return e},[k]),X=n.useMemo(()=>an({messages:y?.messages??[],requests:y?.requests??[],nowMs:me}),[y,me]),f=C?.viewer??null,St=n.useMemo(()=>{const e=new Set;return!s||!f||rn({projection:X,viewerActorId:f.actorId,members:k})&&e.add(s),e},[s,k,X,f]);n.useEffect(()=>{const e=Xe.current;if(!e)return;e.scrollHeight-e.scrollTop-e.clientHeight<160&&(e.scrollTop=e.scrollHeight)},[X.lastMessageAt]);const Ae=s?ht[s]??"":"",je=s?pt[s]??null:null,Et=n.useCallback(e=>{s&&Ee(t=>({...t,[s]:e}))},[s]),De=n.useCallback(e=>{s&&He(t=>({...t,[s]:e}))},[s]),ve=n.useCallback(async e=>{if(!s)return!1;const t=e.body.trim(),o=e.files??[];if(!t&&o.length===0)return!1;const u=Re.current,E=u&&u.channelId===s&&u.body===t&&u.replyToMessageId===e.replyToMessageId&&u.targetActorId===e.targetActorId,T=E?u.requestId:nt(),g=E&&u?.attachments?u.attachments:o.length>0?await Nn(o,w=>r.uploadAttachments?r.uploadAttachments(s,w,i):pn(w)):void 0;return Re.current={channelId:s,body:t,replyToMessageId:e.replyToMessageId,targetActorId:e.targetActorId,requestId:T,attachments:g},e.targetActorId?await r.postAsk(s,{requestId:T,body:t,targetActorId:e.targetActorId,space:i,...e.replyToMessageId?{replyToMessageId:e.replyToMessageId}:{}}):await r.postMessage(s,{requestId:T,body:t,space:i,...e.replyToMessageId?{replyToMessageId:e.replyToMessageId}:{},...g&&g.length>0?{attachments:g}:{}}),Re.current=null,await D(),re(),!0},[s,r,D,re,i]),Ye=n.useCallback((e,t,o)=>{if(!s)return;const u=y;R(g=>g&&{...g,messages:g.messages.map(w=>w.id===e?{...w,reactions:on(w.reactions,t,o)}:w)});const E=nt();(o?r.removeReaction:r.addReaction)(s,{messageId:e,emoji:t,requestId:E,space:i}).then(()=>{D()}).catch(g=>{R(u),se(g instanceof te?g.message:"That reaction did not save.")})},[s,r,y,D,i]),Je=n.useCallback(e=>{s&&r.cancelAsk(s,e,i).then(t=>{R(o=>o&&{...o,requests:o.requests.map(u=>u.flightId===e?{...u,state:t.request.state}:u)})}).catch(()=>{D()})},[s,r,D,i]),yt=n.useCallback((e=[])=>!s||xe?Promise.resolve(!1):(Be(null),$e(!0),ve({body:Ae,replyToMessageId:null,targetActorId:je,files:e}).then(t=>(t&&(Ee(o=>({...o,[s]:""})),He(o=>({...o,[s]:null}))),t)).catch(t=>(Be(t instanceof te?t.message:"That did not send. The text is still here — try again."),!1)).finally(()=>$e(!1))),[je,s,Ae,ve,xe]),S=J.kind==="thread"?J.rootMessageId:null,Pe=S?mt[S]??"":"",kt=n.useCallback((e=[])=>!S||Te?Promise.resolve(!1):(qe(null),Ue(!0),ve({body:Pe,replyToMessageId:S,targetActorId:null,files:e}).then(t=>(t&&ze(o=>({...o,[S]:""})),t)).catch(t=>(qe(t instanceof te?t.message:"That reply did not send."),!1)).finally(()=>Ue(!1))),[ve,Pe,S,Te]),Ie=n.useCallback(e=>{P(e),d.write({channelId:e,space:i,messageId:null},!1),_(null),F({kind:"none"}),W("channel")},[d,i]),xt=n.useCallback(e=>{e!==i&&(N(e),P(null),z(null),R(null),V([]),O([]),F({kind:"none"}),W("list"),d.write({channelId:null,space:e,messageId:null},!1),_(null))},[d,i]),Qe=n.useCallback(e=>{if(!s)return;const t=Ut(window.location.href,{channelId:s,messageId:e,space:i});d.write({channelId:s,space:i,messageId:e},!0),_(e),fn(t)},[d,s,i]),K=n.useCallback(e=>{F(e),W(e.kind==="none"?"channel":"panel")},[]),Ze=n.useRef(null);n.useEffect(()=>{if(!x||!y)return;const e=y.messages.find(o=>o.id===x);if(!e||(e.replyToMessageId&&(F({kind:"thread",rootMessageId:e.replyToMessageId}),W("panel")),Ze.current===x))return;Ze.current=x;const t=window.requestAnimationFrame(()=>{document.querySelector(`[data-message-id="${CSS.escape(x)}"]`)?.scrollIntoView({block:"center",behavior:"smooth"})});return()=>window.cancelAnimationFrame(t)},[y,x]);const Z=n.useCallback(()=>{F({kind:"none"}),W("channel")},[]),Ce=n.useCallback(()=>{p.toggleCollapsed()},[p]),Tt=n.useCallback(e=>{e.preventDefault(),e.stopPropagation();const t=p.effectiveCollapsed,o=e.clientX,u=t?Oe:p.expandedWidth;Me.current=u,p.beginResize(u,t);const E=()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",g),document.removeEventListener("pointercancel",w),window.removeEventListener("blur",w)},T=U=>{const ie=u+(U.clientX-o);Me.current=ie,p.updateResize(ie)},g=()=>{p.commitDrag(Me.current??u,t),E()},w=()=>{p.clearDrag(),E()};document.addEventListener("pointermove",T),document.addEventListener("pointerup",g),document.addEventListener("pointercancel",w),window.addEventListener("blur",w)},[p]),Mt=n.useCallback(e=>{e.preventDefault(),e.stopPropagation();const t=e.clientX,o=fe;Ne.current=o,ge(o);const u=()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",g),document.removeEventListener("pointercancel",w),window.removeEventListener("blur",w)},E=U=>Math.max(lt,Math.min(dt,Math.round(U))),T=U=>{const ie=E(o-(U.clientX-t));Ne.current=ie,ge(ie)},g=()=>{const U=E(Ne.current??o);Ve(U),ot(U),ge(null),u()},w=()=>{ge(null),u()};document.addEventListener("pointermove",T),document.addEventListener("pointerup",g),document.addEventListener("pointercancel",w),window.addEventListener("blur",w)},[fe]),Nt=n.useCallback(()=>{(async()=>{try{await r.signOut();const e=new URL(window.location.href);e.searchParams.set("signedOut","1"),window.location.assign(e.pathname+e.search)}catch(e){se(e instanceof Error?e.message:"Could not sign out. Try again.")}})()},[r]),Rt=n.useCallback(async e=>{const t=await r.createChannel({title:e.title,...e.topic?{topic:e.topic}:{},space:i});await $(!1),Ie(t.conversation.id)},[r,$,Ie,i]),Lt=n.useCallback(async e=>{const t=await r.createSpace({title:e.title,...e.channel?{channel:e.channel}:{}});N(t.space.slug),z(null),R(null),V([]),O([]),P(t.channel?.id??null),F({kind:"none"}),W(t.channel?"channel":"list"),d.write({channelId:t.channel?.id??null,space:t.space.slug,messageId:null},!1)},[d,r]),At=n.useMemo(()=>l.spaceDelete&&r.deleteSpace?async e=>{await r.deleteSpace(e),z(null),R(null),V([]),O([]),P(null),F({kind:"none"}),W("list"),N(ee),d.write({channelId:null,space:ee,messageId:null},!1),await $(!0)}:null,[d,l.spaceDelete,r,$]),jt=n.useCallback(async e=>{if(!(!s||!f)){de(e);try{await r.revokeInvite(s,e,f.actorId,i),await oe()}catch(t){L(t instanceof Error?t.message:"That invitation could not be revoked.")}finally{de(null)}}},[s,r,oe,i,f]),Dt=n.useCallback(e=>{const t=be.get(e);if(!t||!s)return;const o=cn(t);Ee(u=>{const E=u[s]??"",T=E.length===0||E.endsWith(" ")?"":" ";return{...u,[s]:`${E}${T}@${o} `}}),l.asks&&ln(t)&&De(e),Z()},[l.asks,s,Z,be,De]);if(n.useEffect(()=>{const e=t=>{if((t.metaKey||t.ctrlKey)&&t.key.toLowerCase()==="k"){t.preventDefault(),he(o=>!o);return}if((t.metaKey||t.ctrlKey)&&t.key.toLowerCase()==="b"){const o=document.activeElement;if(o instanceof HTMLElement&&(o.tagName==="TEXTAREA"||o.tagName==="INPUT"||o.isContentEditable))return;t.preventDefault(),Ce();return}if(t.key==="Escape"){if(ke||ye)return;if(J.kind!=="none"){t.preventDefault(),Z();return}const o=document.activeElement;o instanceof HTMLElement&&o.tagName==="TEXTAREA"&&o.blur()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[Z,J.kind,ke,ye,Ce]),h==="loading")return a.jsx(Fe,{theme:m,className:"chat-centered",children:a.jsx("p",{className:"chat-card-meta",children:"Loading Scout Chat…"})});if(h==="gate"&&c)return c({signInHref:`${l.signIn.startPath}?${l.signIn.returnToParam}=${encodeURIComponent(window.location.pathname+window.location.search)}`,signInLabel:l.signIn.label,note:l.signIn.note??null,message:M});if(h==="gate"||h==="error"){const e=h==="gate";return a.jsx(Fe,{theme:m,className:"chat-centered",children:a.jsxs("div",{className:"chat-card",children:[a.jsx("span",{className:"chat-card-eyebrow",children:"Scout Chat"}),a.jsx("h1",{children:e?"You are not signed in":"Scout Chat is unavailable"}),a.jsx("p",{children:e?l.signIn.prompt:M??"The chat service did not answer."}),e?a.jsxs(a.Fragment,{children:[a.jsx("a",{className:"btn btn--accent",href:`${l.signIn.startPath}?${l.signIn.returnToParam}=${encodeURIComponent(window.location.pathname+window.location.search)}`,children:l.signIn.label}),l.signIn.note?a.jsx("p",{className:"chat-card-note",children:l.signIn.note}):null]}):a.jsx("button",{type:"button",className:"btn",onClick:()=>{$(!0)},children:"Try again"}),e&&M?a.jsx("p",{className:"chat-card-note",children:M}):null]})})}const Pt=f?.displayName??"you",_t=k.length>0?dn(k):"reading…",G=p.effectiveCollapsed&&!Q,et=G?Oe:p.width,tt=It??fe,Ot={"--sidebar-w":`${et}px`,"--panel-w":`${tt}px`},_e=J.kind!=="none",Ft=S?(y?.messages??[]).find(e=>e.id===S)??null:null,Wt=S?X.repliesByRoot.get(S)??[]:[],zt=S?X.requestsByMessage.get(S)??null:null;return a.jsxs(Fe,{theme:m,className:"chat-space",compactView:bt,railed:G,style:Ot,children:[a.jsxs("header",{className:"chat-topbar",children:[a.jsxs("div",{className:"chat-topbar-band",children:[a.jsxs("div",{className:"chat-space-name",children:[a.jsx("b",{children:"Scout Chat"}),v?a.jsx("span",{children:v.authorityNodeId}):null]}),Q?null:a.jsx(Vt,{side:"left",collapsed:G,label:"Sidebar",onToggle:Ce,className:"chat-band-toggle"})]}),a.jsxs("button",{type:"button",className:"chat-jump",onClick:()=>he(!0),children:["⌕ Jump to a channel or person",a.jsx("span",{className:"chat-kbd",children:"⌘K"})]})]}),a.jsxs("div",{className:"chat-body","data-panel":_e&&!pe?"open":"closed",children:[a.jsx(Gt,{channels:j,directs:B,spaces:Ct,activeSpace:i,selectedId:s,addressedChannelIds:St,canCreate:f?.isOperator===!0,viewerName:Pt,viewerIsHost:f?.isOperator===!0,railed:G,themePreference:q,onSelect:Ie,onSelectSpace:xt,onCreate:Rt,onCreateSpace:Lt,onDeleteSpace:At,onInvite:()=>ue(!0),onExpandRail:Ce,onOpenProfile:v&&f?()=>K({kind:"member",actorId:f.actorId}):null,onThemePreference:Y,onSignOut:Nt}),v?a.jsxs("main",{className:"chat-channel","aria-label":st(v.title),children:[a.jsxs("header",{className:"chat-chan-head",children:[a.jsx("button",{type:"button",className:"chat-compact-back",onClick:()=>W("list"),"aria-label":"Back to channels",children:"‹"}),a.jsxs("span",{className:"chat-chan-name",children:[a.jsx("span",{className:"chat-hash",children:"#"}),v.title.replace(/^#/u,"")]}),a.jsx("span",{className:`chat-topic${v.topic?"":" chat-topic--empty"}`,children:v.topic??"No topic set"}),a.jsx(Qt,{members:k,countLabel:_t,onOpen:()=>K({kind:"members"})}),a.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>ue(!0),children:"Invite"})]}),a.jsxs("div",{className:"chat-feed",ref:Xe,role:"log","aria-label":"Channel messages",children:[ut?a.jsx("p",{className:"chat-feed-notice",children:"Reconnecting — this is the last reading that came back."}):null,Se?a.jsx("p",{className:"chat-feed-notice","data-tone":"error",children:Se}):null,!y&&!Se?a.jsx("p",{className:"chat-feed-notice",children:"Loading messages…"}):null,y&&X.entries.length===0?a.jsx("p",{className:"chat-feed-empty",children:"Nothing has been posted here yet. Say something, or invite the people and agents who belong in this room."}):null,X.entries.map(e=>e.kind==="day"?a.jsx("div",{className:"chat-day",children:a.jsx("span",{className:"label-sm",children:e.label})},e.id):e.kind==="status"?a.jsx("div",{className:"chat-status-line",children:e.message.body},e.id):e.kind==="status-fold"?a.jsx(Rn,{label:e.label,messages:e.messages},e.id):a.jsx(Zt,{message:e.message,members:be,nowMs:me,request:e.request,replyCount:e.replyCount,lastReplyAt:e.lastReplyAt,onOpenThread:()=>K({kind:"thread",rootMessageId:e.message.id}),onOpenMember:t=>K({kind:"member",actorId:t}),onReact:Ye,onCopyLink:Qe,onStopAsk:Je,focused:x===e.message.id},e.id))]}),a.jsx("div",{className:"chat-composer-wrap",children:a.jsx(Yt,{members:k,draft:Ae,onDraftChange:Et,askTargetId:je,onAskTargetChange:De,onSend:yt,sending:xe,error:ft,placeholder:`Message ${st(v.title)}`})})]}):a.jsx("main",{className:"chat-channel",children:a.jsx("div",{className:"chat-feed",children:a.jsx("p",{className:"chat-feed-empty",children:f?.isOperator?"Create a channel to start.":"You are not in a channel yet. Open the invitation you were sent."})})}),v&&_e&&pe&&!Q?a.jsx("div",{className:"chat-panel-scrim",role:"presentation",onClick:Z}):null,Q?null:a.jsx("div",{"data-scout-sidebar-resize-handle":"",role:"separator","aria-orientation":"vertical","aria-label":G?"Expand sidebar (drag out)":"Resize or collapse sidebar",title:G?"Drag out to expand · double-click to expand":"Drag to resize · drag in to collapse · double-click to reset",onPointerDown:Tt,onDoubleClick:e=>{e.preventDefault(),G?(p.setExpandedWidth(Xt),p.setCollapsed(!1)):p.resetExpandedWidth()},style:{position:"absolute",left:Math.max(0,et-3),top:0,bottom:0,width:6,zIndex:50,cursor:"ew-resize",touchAction:"none"}}),p.isSidebarResizing&&p.dragGhostWidth!=null?a.jsx("div",{"data-scout-sidebar-resize-ghost":"","aria-hidden":"true",className:"scout-sidebar-resize-ghost",style:{position:"absolute",left:p.dragGhostWidth,top:0,bottom:0,width:2,transform:"translateX(-50%)",zIndex:55,pointerEvents:"none"}}):null,v&&f?a.jsx(Jt,{view:J,channel:v,members:k,membersById:be,invites:le,inviteError:I,revokingInviteId:ne,viewerActorId:f.actorId,viewerIsOperator:f.isOperator,nowMs:me,threadRoot:Ft,threadReplies:Wt,threadRequest:zt,threadDraft:Pe,onThreadDraftChange:e=>{S&&ze(t=>({...t,[S]:e}))},onSendThreadReply:kt,onReact:Ye,onCopyLink:Qe,onStopAsk:Je,focusMessageId:x,threadSending:Te,threadError:gt,onClose:Z,onBack:()=>K({kind:"members"}),onOpenMember:e=>K({kind:"member",actorId:e}),onMention:Dt,onRevokeInvite:e=>{jt(e)},onInvite:()=>ue(!0),overlay:pe}):null,v&&_e&&!pe&&!Q?a.jsx("div",{"data-scout-sidebar-resize-handle":"",role:"separator","aria-orientation":"vertical","aria-label":"Resize inspector",title:"Drag to resize · double-click to reset",onPointerDown:Mt,onDoubleClick:e=>{e.preventDefault(),Ve(ce),ot(ce)},style:{position:"absolute",right:Math.max(0,tt-3),top:0,bottom:0,width:6,zIndex:50,cursor:"ew-resize",touchAction:"none"}}):null]}),ye&&v&&f?a.jsx(en,{space:i,channel:v,viewerActorId:f.actorId,viewerName:f.displayName,onClose:()=>ue(!1),onInvitesChanged:()=>{oe()}},`${i}:${v.id}`):null,ke?a.jsx(tn,{channels:[...j,...B],members:k,onClose:()=>he(!1),onPick:e=>{he(!1),e.kind==="channel"?Ie(e.id):K({kind:"member",actorId:e.id})}}):null]})}function Rn({label:c,messages:r}){const[l,d]=n.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"chat-status-line",children:[a.jsx("button",{type:"button",className:"chat-fold",onClick:()=>d(m=>!m),children:`${l?"⌃":"⌵"} ${c}`}),a.jsx("span",{className:"chip chip--sm chip--mono chip--ghost chip--neutral",children:r.length})]}),l?r.map(m=>a.jsx("div",{className:"chat-status-line",children:m.body},m.id)):null]})}export{gs as ChatSpaceSurface};
@@ -1 +1 @@
1
- import{r as a,v as i,a as S,w as p,x as f,y as h,z as d,A as u,b as l,j as v}from"./index-EsrkGBcv.js";import{L as T,D as E}from"./theme-vars-DNK0nn3k.js";function w(){const[e,c]=a.useState(()=>i()),[r,o]=a.useState(()=>S());a.useEffect(()=>{p(r,h(),f())},[r]),a.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const t=window.matchMedia("(prefers-color-scheme: light)"),s=()=>o(u(e));return t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[e]);const n=a.useCallback(t=>{d(t),c(t),o(u(t))},[]);return{theme:r,preference:e,setPreference:n}}function g(){return w().theme}function y({theme:e,className:c,compactView:r,railed:o,style:n,children:t}){const s=a.useMemo(()=>l(),[]),m=a.useMemo(()=>({...e==="light"?T:E,...s??{},...n}),[e,s,n]);return v.jsx("div",{className:c,"data-scout-theme":e,"data-scout-theme-mode":e,...r?{"data-compact-view":r}:{},...o?{"data-rail":"true"}:{},style:m,children:t})}export{y as ChatSpaceTheme,w as useScoutStandaloneAppearance,g as useScoutStandaloneTheme};
1
+ import{r as a,v as i,a as S,w as p,x as f,y as h,z as d,A as u,b as l,j as v}from"./index-BFbLvCJn.js";import{L as T,D as E}from"./theme-vars-DNK0nn3k.js";function w(){const[e,c]=a.useState(()=>i()),[r,o]=a.useState(()=>S());a.useEffect(()=>{p(r,h(),f())},[r]),a.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const t=window.matchMedia("(prefers-color-scheme: light)"),s=()=>o(u(e));return t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[e]);const n=a.useCallback(t=>{d(t),c(t),o(u(t))},[]);return{theme:r,preference:e,setPreference:n}}function g(){return w().theme}function y({theme:e,className:c,compactView:r,railed:o,style:n,children:t}){const s=a.useMemo(()=>l(),[]),m=a.useMemo(()=>({...e==="light"?T:E,...s??{},...n}),[e,s,n]);return v.jsx("div",{className:c,"data-scout-theme":e,"data-scout-theme-mode":e,...r?{"data-compact-view":r}:{},...o?{"data-rail":"true"}:{},style:m,children:t})}export{y as ChatSpaceTheme,w as useScoutStandaloneAppearance,g as useScoutStandaloneTheme};
@@ -1 +1 @@
1
- import{r as o,j as a}from"./index-EsrkGBcv.js";import{f as k}from"./cache-DGBo3vIf.js";import{u as F,f as I,l as N,L as _,D}from"./usePierreRuntime-BAQdiN0L.js";/* empty css */const R=["unstaged","staged","branch"];function L(n){if(!n.startsWith("/"))return null;const t=[];for(const e of n.split("/"))if(!(!e||e==="."))if(e===".."){if(t.length===0)return null;t.pop()}else t.push(e);return t}function A(n,t){const e=L(n),s=L(t);return!e||!s||s.length<=e.length||e.some((c,u)=>s[u]!==c)?null:s.slice(e.length).join("/")}function y(n,t){return n.files.findIndex(e=>e.newPath===t||e.oldPath===t)}function K(n,t){return n.find(e=>y(e,t)>=0)?.kind??null}const M=()=>{},T=()=>{};function O({root:n,file:t}){const e=o.useMemo(()=>A(n,t),[t,n]),[s,c]=o.useState(null),[u,d]=o.useState("loading"),[P,m]=o.useState(null),[S,h]=o.useState(null),{pierre:j,pierrePhase:v,pierreError:C,pierreTheme:b,retryPierre:E}=F(s);o.useEffect(()=>{let r=!1;if(c(null),d("loading"),m(null),h(null),!e){d("ready");return}return k(n,R,{files:[e],tier:"patch"}).then(i=>{r||(c(i.snapshot),h(K(i.snapshot.layers,e)),d("ready"))},i=>{r||(m(i instanceof Error?i.message:String(i)),d("error"))}),()=>{r=!0}},[e,n]);const f=o.useMemo(()=>e?s?.layers.filter(r=>y(r,e)>=0)??[]:[],[e,s]),l=f.find(r=>r.kind===S)??f[0]??null,p=l&&e?y(l,e):-1,g=l&&p>=0?I(l.files[p],p):null;return u==="loading"?a.jsx("div",{className:"s-code-empty",children:"Loading file changes…"}):u==="error"?a.jsx("div",{className:"s-code-empty",children:P??"Couldn’t load this file’s changes."}):!s||!l||!g?a.jsx("div",{className:"s-code-empty",children:"No tracked patch is available. The file is clean, or it is untracked and has no Git baseline yet."}):a.jsxs("div",{className:"s-code-diff",children:[f.length>1?a.jsx("div",{className:"s-code-diffLayers",role:"tablist","aria-label":"Change layer",children:f.map(r=>{const i=N(r),x=r.kind===l.kind;return a.jsxs("button",{type:"button",role:"tab","aria-selected":x,className:"s-code-diffLayer","data-selected":x||void 0,onClick:()=>h(r.kind),children:[_[r.kind],a.jsxs("span",{children:["+",i.add," −",i.del]})]},r.kind)})}):null,a.jsx(D,{layer:l,patchLayer:l,patchPhase:"ready",patchError:null,selectedFileKey:g,renderKey:s.render.renderKey,theme:b,layout:"split",pierre:j,pierrePhase:v,pierreError:C,onRetryPierre:E,onIncludeLineContext:M,onIncludeSelectionContext:T,contextActions:!1})]})}const G=Object.freeze(Object.defineProperty({__proto__:null,CodeDiffPane:O},Symbol.toStringTag,{value:"Module"}));export{O as C,G as a,A as r};
1
+ import{r as o,j as a}from"./index-BFbLvCJn.js";import{f as k}from"./cache-DGBo3vIf.js";import{u as F,f as I,l as N,L as _,D}from"./usePierreRuntime-DUXZ-DTK.js";/* empty css */const R=["unstaged","staged","branch"];function L(n){if(!n.startsWith("/"))return null;const t=[];for(const e of n.split("/"))if(!(!e||e==="."))if(e===".."){if(t.length===0)return null;t.pop()}else t.push(e);return t}function A(n,t){const e=L(n),s=L(t);return!e||!s||s.length<=e.length||e.some((c,u)=>s[u]!==c)?null:s.slice(e.length).join("/")}function y(n,t){return n.files.findIndex(e=>e.newPath===t||e.oldPath===t)}function K(n,t){return n.find(e=>y(e,t)>=0)?.kind??null}const M=()=>{},T=()=>{};function O({root:n,file:t}){const e=o.useMemo(()=>A(n,t),[t,n]),[s,c]=o.useState(null),[u,d]=o.useState("loading"),[P,m]=o.useState(null),[S,h]=o.useState(null),{pierre:j,pierrePhase:v,pierreError:C,pierreTheme:b,retryPierre:E}=F(s);o.useEffect(()=>{let r=!1;if(c(null),d("loading"),m(null),h(null),!e){d("ready");return}return k(n,R,{files:[e],tier:"patch"}).then(i=>{r||(c(i.snapshot),h(K(i.snapshot.layers,e)),d("ready"))},i=>{r||(m(i instanceof Error?i.message:String(i)),d("error"))}),()=>{r=!0}},[e,n]);const f=o.useMemo(()=>e?s?.layers.filter(r=>y(r,e)>=0)??[]:[],[e,s]),l=f.find(r=>r.kind===S)??f[0]??null,p=l&&e?y(l,e):-1,g=l&&p>=0?I(l.files[p],p):null;return u==="loading"?a.jsx("div",{className:"s-code-empty",children:"Loading file changes…"}):u==="error"?a.jsx("div",{className:"s-code-empty",children:P??"Couldn’t load this file’s changes."}):!s||!l||!g?a.jsx("div",{className:"s-code-empty",children:"No tracked patch is available. The file is clean, or it is untracked and has no Git baseline yet."}):a.jsxs("div",{className:"s-code-diff",children:[f.length>1?a.jsx("div",{className:"s-code-diffLayers",role:"tablist","aria-label":"Change layer",children:f.map(r=>{const i=N(r),x=r.kind===l.kind;return a.jsxs("button",{type:"button",role:"tab","aria-selected":x,className:"s-code-diffLayer","data-selected":x||void 0,onClick:()=>h(r.kind),children:[_[r.kind],a.jsxs("span",{children:["+",i.add," −",i.del]})]},r.kind)})}):null,a.jsx(D,{layer:l,patchLayer:l,patchPhase:"ready",patchError:null,selectedFileKey:g,renderKey:s.render.renderKey,theme:b,layout:"split",pierre:j,pierrePhase:v,pierreError:C,onRetryPierre:E,onIncludeLineContext:M,onIncludeSelectionContext:T,contextActions:!1})]})}const G=Object.freeze(Object.defineProperty({__proto__:null,CodeDiffPane:O},Symbol.toStringTag,{value:"Module"}));export{O as C,G as a,A as r};
@@ -1,2 +1,2 @@
1
- import{r as h,j as i}from"./index-EsrkGBcv.js";import{C as ne}from"./chevron-down-l1mrh5S9.js";import{S as oe}from"./search-DT42oyRW.js";const se=new Set(["hud","tail","terminal","services","pair","osn-auth","notification","code","file"]);function L(e){const t=e?.trim();return t||void 0}function q(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isSafeInteger(t)&&t>0?t:void 0}function ce(e){return e.split("/").filter(t=>t.length>0).map(encodeURIComponent).join("/")}function R(e){return e.map(t=>{try{return decodeURIComponent(t)}catch{return t}}).join("/")}function ie(e){const t=q(e.get("line")),n=q(e.get("endLine")),r=t&&n&&n>=t?n:void 0;return{...L(e.get("wt"))?{wt:L(e.get("wt"))}:{},...t?{line:t}:{},...r?{endLine:r}:{}}}function G(e){const t=e.trim();if(!t)return null;if(t.startsWith("/")||t.startsWith("~/")){const u=t.replace(/^~/,""),d=t.startsWith("~")?t:u;return{root:d,file:d}}if(!/^scout:/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol.toLowerCase()!=="scout:")return null;const r=(n.hostname||n.host||"").toLowerCase(),c=n.pathname.split("/").filter(u=>u.length>0),s=ie(n.searchParams);if(!r||r==="file"){const u=c;if(u.length===0)return null;const d=`/${R(u)}`,m=L(n.searchParams.get("root")),j=L(n.searchParams.get("file"));return{root:m??d,file:j??d,...s}}if(r==="code"){if(c.length===0){const m=L(n.searchParams.get("root")),j=L(n.searchParams.get("file")),b=L(n.searchParams.get("project")),y=L(n.searchParams.get("path"));return!m&&!j&&!b?{...s}:{...m?{root:m}:{},...j?{file:j}:{},...b?{project:b}:{},...y?{path:y}:{},...s}}const u=R([c[0]]),d=c.length>1?R(c.slice(1)):void 0;return{project:u,...d?{path:d}:{},...s}}if(se.has(r))return null;const a=decodeURIComponent(r),l=c.length>0?R(c):void 0;return{project:a,...l?{path:l}:{},...s}}function ae(e){const t=new URLSearchParams;e.wt&&t.set("wt",e.wt),e.line&&e.line>0&&t.set("line",String(e.line)),e.line&&e.endLine&&e.endLine>=e.line&&t.set("endLine",String(e.endLine));const n=t.toString(),r=n?`?${n}`:"";if(e.project)return`scout://${e.path?`${encodeURIComponent(e.project)}/${ce(e.path)}`:encodeURIComponent(e.project)}${r}`;const c=e.file??e.root;return c?`scout://${c.startsWith("/")?c:`/${c}`}${r}`:`scout://code${r}`}function le(e,t){const n=e.trim();if(!n)return null;let r=null;for(const c of t)(n===c||n.startsWith(`${c}/`))&&(!r||c.length>r.length)&&(r=c);return r?{root:r,file:n===r?null:n}:null}function ue(e){const t=e.trim();return t?!!(t.startsWith("/")||t.startsWith("~/")||/^scout:/i.test(t)):!1}function B(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function de(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function fe(e){return e.branch.detached?"detached":e.branch.name??"no branch"}function pe(e){return e.status.clean?"":`${e.status.changedFiles} changed`}function he(e){const t=[];for(const n of e)for(const[r,c]of n.worktrees.entries())t.push({root:c.path,projectId:n.id,projectName:n.name,projectSlug:B(n.name)||B(de(n.name)),worktreeName:c.name,branchLabel:fe(c),dirtyLabel:pe(c),isPrimary:r===0,changedFiles:c.status.changedFiles});return t}function v(e){return e.toLocaleLowerCase().replace(/[\s/_-]+/g," ").trim()}function me(e,t,n=0){const r=v(t);if(!r)return n;const c=r.split(" ").filter(Boolean),s=v(e.projectName),a=v(e.root),l=v(e.branchLabel),u=v(e.worktreeName),d=`${s} ${a} ${l} ${u} ${e.projectSlug}`;if(!c.every(j=>d.includes(j)))return-1;let m=n/100;return s===r||e.projectSlug===r.replace(/\s+/g,"-")?m+=120:s.startsWith(r)||e.projectSlug.startsWith(r.replace(/\s+/g,"-"))?m+=80:s.includes(r)&&(m+=48),(l.startsWith(r)||l.includes(r))&&(m+=34),u.includes(r)&&(m+=24),a.includes(r)&&(m+=20),m+=c.reduce((j,b)=>j+(s.startsWith(b)?12:0),0),m}function ge(e,t,n,r=12){const c=new Map(n.map((a,l)=>[a,n.length-l])),s=e.map(a=>({option:a,score:me(a,t,c.get(a.root)??0)})).filter(a=>a.score>=0);return t.trim()?s.sort((a,l)=>l.score-a.score||a.option.projectName.localeCompare(l.option.projectName)):s.sort((a,l)=>{const u=c.get(a.option.root)??-1,d=c.get(l.option.root)??-1;return u!==d?d-u:a.option.projectName.localeCompare(l.option.projectName)||a.option.branchLabel.localeCompare(l.option.branchLabel)}),s.slice(0,r).map(a=>a.option)}function Y(e){return e.isPrimary?e.projectName:`${e.projectName} · ${e.branchLabel}`}function D(e){return e.dirtyLabel?`${e.branchLabel} · ${e.dirtyLabel}`:e.branchLabel}function O(e){const t=typeof window<"u"?window.__OPEN_SCOUT_HOME:void 0;if(t&&e.startsWith(`${t}/`))return`~/${e.slice(t.length+1)}`;if(e.startsWith("/Users/")){const n=e.slice(7),r=n.indexOf("/");if(r>0)return`~${n.slice(r)}`}if(e.startsWith("/home/")){const n=e.slice(6),r=n.indexOf("/");if(r>0)return`~${n.slice(r)}`}return e}const Q="openscout.code.tree:",_="openscout.code.lastRoot",V="openscout.code.recentRoots",je=8;function Ce(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(Q+e);if(!t)return null;const n=JSON.parse(t);return!n||typeof n.entries!="object"||!Array.isArray(n.expanded)?null:n}catch{return null}}function Re(e,t){if(typeof window>"u")return;const n={};for(const r of[e,...t.expanded]){const c=t.entries.get(r);c&&(n[r]=c)}try{window.localStorage.setItem(Q+e,JSON.stringify({entries:n,expanded:[...t.expanded],selectedFile:t.selectedFile,savedAt:Date.now()}))}catch{}}function Oe(){if(typeof window>"u")return null;try{return window.localStorage.getItem(_)}catch{return null}}function M(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(V);if(!e){const n=window.localStorage.getItem(_);return n?[n]:[]}const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"&&n.length>0):[]}catch{return[]}}function Pe(e){if(!(typeof window>"u"))try{window.localStorage.setItem(_,e);const t=M().filter(r=>r!==e),n=[e,...t].slice(0,je);window.localStorage.setItem(V,JSON.stringify(n))}catch{}}const we=6,be=12;function k(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function W(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function X(e,t,n){const r=G(e);if(!r)return null;if(r.root||r.file){const c=t.map(u=>u.root),s=xe(r.file??r.root,c),a=le(s,c);if(a)return{root:a.root,file:a.file,line:r.line,endLine:r.endLine};const l=W(s).includes(".");return{root:l?Le(s):s,file:l?s:null,line:r.line,endLine:r.endLine}}if(r.project){const c=ke(n,r.project,r.wt??null,t);if(!c)return null;const s=r.path?`${c.root}/${r.path}`:null;return{root:c.root,file:s,project:r.project,path:r.path,wt:r.wt,line:r.line,endLine:r.endLine}}return null}function xe(e,t){if(!e.startsWith("~/")&&e!=="~")return e;for(const n of t){const r=n.match(/^(\/Users\/[^/]+)/)??n.match(/^(\/home\/[^/]+)/);if(r)return`${r[1]}${e.slice(1)}`}return e}function Le(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):e}function ke(e,t,n,r){if(e){const a=k(t),l=e.projects.find(u=>k(u.name)===a||k(W(u.root))===a);if(l)return{root:(n?l.worktrees.find(d=>d.name===n||d.branch.name===n||k(d.name)===k(n)):l.worktrees[0])?.path??l.root}}const c=k(t),s=r.find(a=>a.projectSlug===c);return s?{root:s.root}:null}function ye(e){if(e.project)return ae({project:e.project,path:e.path,wt:e.wt,line:e.line,endLine:e.endLine});const t=e.file??e.root;return t?O(t):"Deep link"}function Ne({snapshot:e,root:t,onSelect:n}){const[r,c]=h.useState(!1),[s,a]=h.useState(""),[l,u]=h.useState(0),[d,m]=h.useState(()=>M()),j=h.useRef(null),b=h.useRef(null),y=h.useRef(null),N=h.useId().replaceAll(":",""),P=`code-project-results-${N}`,x=h.useMemo(()=>he(e?.projects??[]),[e]),I=h.useMemo(()=>{const o=new Map;for(const f of x)o.set(f.root,f);return o},[x]),C=t?I.get(t)??null:null;h.useEffect(()=>{m(M())},[t,r]);const U=h.useMemo(()=>{const o=[];for(const f of d){const $=I.get(f);if($&&o.push($),o.length>=we)break}return o},[d,I]),w=ue(s),A=w?G(s):null,p=w?X(s,x,e):null,g=h.useMemo(()=>w?[]:ge(x,s,d,be),[x,s,d,w]),Z=(p?1:0)+g.length,S=h.useMemo(()=>{if(!s.trim()||w)return"";const o=g.find(f=>f.projectName.toLocaleLowerCase().startsWith(s.toLocaleLowerCase()));return o&&o.projectName.length>s.length?o.projectName:""},[s,g,w]);h.useEffect(()=>u(0),[s,r]),h.useEffect(()=>{if(!r)return;const o=window.setTimeout(()=>b.current?.focus(),20);return()=>window.clearTimeout(o)},[r]),h.useEffect(()=>{if(!r)return;function o(f){j.current?.contains(f.target)||(c(!1),a(""))}return document.addEventListener("pointerdown",o),()=>document.removeEventListener("pointerdown",o)},[r]);const E=()=>{a(""),c(!1),window.setTimeout(()=>y.current?.focus(),0)},T=o=>{n({root:o}),E()},F=()=>{p&&(n(p),E())},ee=o=>{if(o.key==="ArrowDown")o.preventDefault(),u(f=>Math.min(f+1,Math.max(Z-1,0)));else if(o.key==="ArrowUp")o.preventDefault(),u(f=>Math.max(f-1,0));else if(o.key==="Enter"){if(o.preventDefault(),p&&(l===0||g.length===0)){F();return}const f=p?l-1:l;g[f]&&T(g[f].root)}else o.key==="ArrowRight"&&S&&o.currentTarget.selectionStart===s.length?(o.preventDefault(),a(S)):o.key==="Escape"&&(o.preventDefault(),E())},te=C?Y(C):t?O(t):"Pick a project…",z=C?D(C):null,H=!!p&&l===0,re=p&&l===0?`${N}-deeplink`:g[p?l-1:l]?`${N}-opt-${g[p?l-1:l].root}`:void 0;return i.jsxs("div",{className:"s-code-picker",ref:j,children:[i.jsxs("button",{ref:y,type:"button",className:"s-code-pickerTrigger","aria-haspopup":"listbox","aria-expanded":r,"aria-controls":r?P:void 0,"aria-label":"Project or worktree",onClick:()=>c(o=>!o),children:[i.jsx("span",{className:"s-code-pickerTriggerName",children:te}),z?i.jsx("span",{className:"s-code-pickerTriggerDetail",children:z}):null,i.jsx(ne,{size:13,"aria-hidden":!0,className:"s-code-pickerChevron","data-open":r||void 0})]}),r?i.jsxs("div",{className:"s-code-pickerPanel",role:"dialog","aria-label":"Choose a project",children:[U.length>0&&!w?i.jsx("div",{className:"s-code-pickerRecents","aria-label":"Recent projects",children:U.map(o=>i.jsx("button",{type:"button",className:"s-code-pickerChip","data-active":o.root===t||void 0,title:`${o.projectName} · ${D(o)}
1
+ import{r as h,j as i}from"./index-BFbLvCJn.js";import{C as ne}from"./chevron-down-DEDSNJNY.js";import{S as oe}from"./search-Bv2IONmc.js";const se=new Set(["hud","tail","terminal","services","pair","osn-auth","notification","code","file"]);function L(e){const t=e?.trim();return t||void 0}function q(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isSafeInteger(t)&&t>0?t:void 0}function ce(e){return e.split("/").filter(t=>t.length>0).map(encodeURIComponent).join("/")}function R(e){return e.map(t=>{try{return decodeURIComponent(t)}catch{return t}}).join("/")}function ie(e){const t=q(e.get("line")),n=q(e.get("endLine")),r=t&&n&&n>=t?n:void 0;return{...L(e.get("wt"))?{wt:L(e.get("wt"))}:{},...t?{line:t}:{},...r?{endLine:r}:{}}}function G(e){const t=e.trim();if(!t)return null;if(t.startsWith("/")||t.startsWith("~/")){const u=t.replace(/^~/,""),d=t.startsWith("~")?t:u;return{root:d,file:d}}if(!/^scout:/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol.toLowerCase()!=="scout:")return null;const r=(n.hostname||n.host||"").toLowerCase(),c=n.pathname.split("/").filter(u=>u.length>0),s=ie(n.searchParams);if(!r||r==="file"){const u=c;if(u.length===0)return null;const d=`/${R(u)}`,m=L(n.searchParams.get("root")),j=L(n.searchParams.get("file"));return{root:m??d,file:j??d,...s}}if(r==="code"){if(c.length===0){const m=L(n.searchParams.get("root")),j=L(n.searchParams.get("file")),b=L(n.searchParams.get("project")),y=L(n.searchParams.get("path"));return!m&&!j&&!b?{...s}:{...m?{root:m}:{},...j?{file:j}:{},...b?{project:b}:{},...y?{path:y}:{},...s}}const u=R([c[0]]),d=c.length>1?R(c.slice(1)):void 0;return{project:u,...d?{path:d}:{},...s}}if(se.has(r))return null;const a=decodeURIComponent(r),l=c.length>0?R(c):void 0;return{project:a,...l?{path:l}:{},...s}}function ae(e){const t=new URLSearchParams;e.wt&&t.set("wt",e.wt),e.line&&e.line>0&&t.set("line",String(e.line)),e.line&&e.endLine&&e.endLine>=e.line&&t.set("endLine",String(e.endLine));const n=t.toString(),r=n?`?${n}`:"";if(e.project)return`scout://${e.path?`${encodeURIComponent(e.project)}/${ce(e.path)}`:encodeURIComponent(e.project)}${r}`;const c=e.file??e.root;return c?`scout://${c.startsWith("/")?c:`/${c}`}${r}`:`scout://code${r}`}function le(e,t){const n=e.trim();if(!n)return null;let r=null;for(const c of t)(n===c||n.startsWith(`${c}/`))&&(!r||c.length>r.length)&&(r=c);return r?{root:r,file:n===r?null:n}:null}function ue(e){const t=e.trim();return t?!!(t.startsWith("/")||t.startsWith("~/")||/^scout:/i.test(t)):!1}function B(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function de(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function fe(e){return e.branch.detached?"detached":e.branch.name??"no branch"}function pe(e){return e.status.clean?"":`${e.status.changedFiles} changed`}function he(e){const t=[];for(const n of e)for(const[r,c]of n.worktrees.entries())t.push({root:c.path,projectId:n.id,projectName:n.name,projectSlug:B(n.name)||B(de(n.name)),worktreeName:c.name,branchLabel:fe(c),dirtyLabel:pe(c),isPrimary:r===0,changedFiles:c.status.changedFiles});return t}function v(e){return e.toLocaleLowerCase().replace(/[\s/_-]+/g," ").trim()}function me(e,t,n=0){const r=v(t);if(!r)return n;const c=r.split(" ").filter(Boolean),s=v(e.projectName),a=v(e.root),l=v(e.branchLabel),u=v(e.worktreeName),d=`${s} ${a} ${l} ${u} ${e.projectSlug}`;if(!c.every(j=>d.includes(j)))return-1;let m=n/100;return s===r||e.projectSlug===r.replace(/\s+/g,"-")?m+=120:s.startsWith(r)||e.projectSlug.startsWith(r.replace(/\s+/g,"-"))?m+=80:s.includes(r)&&(m+=48),(l.startsWith(r)||l.includes(r))&&(m+=34),u.includes(r)&&(m+=24),a.includes(r)&&(m+=20),m+=c.reduce((j,b)=>j+(s.startsWith(b)?12:0),0),m}function ge(e,t,n,r=12){const c=new Map(n.map((a,l)=>[a,n.length-l])),s=e.map(a=>({option:a,score:me(a,t,c.get(a.root)??0)})).filter(a=>a.score>=0);return t.trim()?s.sort((a,l)=>l.score-a.score||a.option.projectName.localeCompare(l.option.projectName)):s.sort((a,l)=>{const u=c.get(a.option.root)??-1,d=c.get(l.option.root)??-1;return u!==d?d-u:a.option.projectName.localeCompare(l.option.projectName)||a.option.branchLabel.localeCompare(l.option.branchLabel)}),s.slice(0,r).map(a=>a.option)}function Y(e){return e.isPrimary?e.projectName:`${e.projectName} · ${e.branchLabel}`}function D(e){return e.dirtyLabel?`${e.branchLabel} · ${e.dirtyLabel}`:e.branchLabel}function O(e){const t=typeof window<"u"?window.__OPEN_SCOUT_HOME:void 0;if(t&&e.startsWith(`${t}/`))return`~/${e.slice(t.length+1)}`;if(e.startsWith("/Users/")){const n=e.slice(7),r=n.indexOf("/");if(r>0)return`~${n.slice(r)}`}if(e.startsWith("/home/")){const n=e.slice(6),r=n.indexOf("/");if(r>0)return`~${n.slice(r)}`}return e}const Q="openscout.code.tree:",_="openscout.code.lastRoot",V="openscout.code.recentRoots",je=8;function Ce(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(Q+e);if(!t)return null;const n=JSON.parse(t);return!n||typeof n.entries!="object"||!Array.isArray(n.expanded)?null:n}catch{return null}}function Re(e,t){if(typeof window>"u")return;const n={};for(const r of[e,...t.expanded]){const c=t.entries.get(r);c&&(n[r]=c)}try{window.localStorage.setItem(Q+e,JSON.stringify({entries:n,expanded:[...t.expanded],selectedFile:t.selectedFile,savedAt:Date.now()}))}catch{}}function Oe(){if(typeof window>"u")return null;try{return window.localStorage.getItem(_)}catch{return null}}function M(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(V);if(!e){const n=window.localStorage.getItem(_);return n?[n]:[]}const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"&&n.length>0):[]}catch{return[]}}function Pe(e){if(!(typeof window>"u"))try{window.localStorage.setItem(_,e);const t=M().filter(r=>r!==e),n=[e,...t].slice(0,je);window.localStorage.setItem(V,JSON.stringify(n))}catch{}}const we=6,be=12;function k(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function W(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function X(e,t,n){const r=G(e);if(!r)return null;if(r.root||r.file){const c=t.map(u=>u.root),s=xe(r.file??r.root,c),a=le(s,c);if(a)return{root:a.root,file:a.file,line:r.line,endLine:r.endLine};const l=W(s).includes(".");return{root:l?Le(s):s,file:l?s:null,line:r.line,endLine:r.endLine}}if(r.project){const c=ke(n,r.project,r.wt??null,t);if(!c)return null;const s=r.path?`${c.root}/${r.path}`:null;return{root:c.root,file:s,project:r.project,path:r.path,wt:r.wt,line:r.line,endLine:r.endLine}}return null}function xe(e,t){if(!e.startsWith("~/")&&e!=="~")return e;for(const n of t){const r=n.match(/^(\/Users\/[^/]+)/)??n.match(/^(\/home\/[^/]+)/);if(r)return`${r[1]}${e.slice(1)}`}return e}function Le(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):e}function ke(e,t,n,r){if(e){const a=k(t),l=e.projects.find(u=>k(u.name)===a||k(W(u.root))===a);if(l)return{root:(n?l.worktrees.find(d=>d.name===n||d.branch.name===n||k(d.name)===k(n)):l.worktrees[0])?.path??l.root}}const c=k(t),s=r.find(a=>a.projectSlug===c);return s?{root:s.root}:null}function ye(e){if(e.project)return ae({project:e.project,path:e.path,wt:e.wt,line:e.line,endLine:e.endLine});const t=e.file??e.root;return t?O(t):"Deep link"}function Ne({snapshot:e,root:t,onSelect:n}){const[r,c]=h.useState(!1),[s,a]=h.useState(""),[l,u]=h.useState(0),[d,m]=h.useState(()=>M()),j=h.useRef(null),b=h.useRef(null),y=h.useRef(null),N=h.useId().replaceAll(":",""),P=`code-project-results-${N}`,x=h.useMemo(()=>he(e?.projects??[]),[e]),I=h.useMemo(()=>{const o=new Map;for(const f of x)o.set(f.root,f);return o},[x]),C=t?I.get(t)??null:null;h.useEffect(()=>{m(M())},[t,r]);const U=h.useMemo(()=>{const o=[];for(const f of d){const $=I.get(f);if($&&o.push($),o.length>=we)break}return o},[d,I]),w=ue(s),A=w?G(s):null,p=w?X(s,x,e):null,g=h.useMemo(()=>w?[]:ge(x,s,d,be),[x,s,d,w]),Z=(p?1:0)+g.length,S=h.useMemo(()=>{if(!s.trim()||w)return"";const o=g.find(f=>f.projectName.toLocaleLowerCase().startsWith(s.toLocaleLowerCase()));return o&&o.projectName.length>s.length?o.projectName:""},[s,g,w]);h.useEffect(()=>u(0),[s,r]),h.useEffect(()=>{if(!r)return;const o=window.setTimeout(()=>b.current?.focus(),20);return()=>window.clearTimeout(o)},[r]),h.useEffect(()=>{if(!r)return;function o(f){j.current?.contains(f.target)||(c(!1),a(""))}return document.addEventListener("pointerdown",o),()=>document.removeEventListener("pointerdown",o)},[r]);const E=()=>{a(""),c(!1),window.setTimeout(()=>y.current?.focus(),0)},T=o=>{n({root:o}),E()},F=()=>{p&&(n(p),E())},ee=o=>{if(o.key==="ArrowDown")o.preventDefault(),u(f=>Math.min(f+1,Math.max(Z-1,0)));else if(o.key==="ArrowUp")o.preventDefault(),u(f=>Math.max(f-1,0));else if(o.key==="Enter"){if(o.preventDefault(),p&&(l===0||g.length===0)){F();return}const f=p?l-1:l;g[f]&&T(g[f].root)}else o.key==="ArrowRight"&&S&&o.currentTarget.selectionStart===s.length?(o.preventDefault(),a(S)):o.key==="Escape"&&(o.preventDefault(),E())},te=C?Y(C):t?O(t):"Pick a project…",z=C?D(C):null,H=!!p&&l===0,re=p&&l===0?`${N}-deeplink`:g[p?l-1:l]?`${N}-opt-${g[p?l-1:l].root}`:void 0;return i.jsxs("div",{className:"s-code-picker",ref:j,children:[i.jsxs("button",{ref:y,type:"button",className:"s-code-pickerTrigger","aria-haspopup":"listbox","aria-expanded":r,"aria-controls":r?P:void 0,"aria-label":"Project or worktree",onClick:()=>c(o=>!o),children:[i.jsx("span",{className:"s-code-pickerTriggerName",children:te}),z?i.jsx("span",{className:"s-code-pickerTriggerDetail",children:z}):null,i.jsx(ne,{size:13,"aria-hidden":!0,className:"s-code-pickerChevron","data-open":r||void 0})]}),r?i.jsxs("div",{className:"s-code-pickerPanel",role:"dialog","aria-label":"Choose a project",children:[U.length>0&&!w?i.jsx("div",{className:"s-code-pickerRecents","aria-label":"Recent projects",children:U.map(o=>i.jsx("button",{type:"button",className:"s-code-pickerChip","data-active":o.root===t||void 0,title:`${o.projectName} · ${D(o)}
2
2
  ${o.root}`,onClick:()=>T(o.root),children:Y(o)},o.root))}):null,i.jsxs("div",{className:"s-code-pickerSearch",children:[i.jsx(oe,{size:13,"aria-hidden":!0,className:"s-code-pickerSearchIcon"}),i.jsxs("div",{className:"s-code-pickerInputStack",children:[S?i.jsxs("div",{className:"s-code-pickerGhost","aria-hidden":!0,children:[i.jsx("span",{children:s}),S.slice(s.length)]}):null,i.jsx("input",{ref:b,className:"s-code-pickerInput",type:"search",role:"combobox",value:s,onChange:o=>a(o.currentTarget.value),onKeyDown:ee,placeholder:"Project, scout:// path, or branch…","aria-label":"Find a project","aria-autocomplete":"both","aria-expanded":"true","aria-controls":P,"aria-activedescendant":re,autoComplete:"off",spellCheck:!1})]}),S?i.jsx("kbd",{className:"s-code-pickerHint",children:"→"}):null]}),i.jsxs("div",{className:"s-code-pickerHeading",children:[i.jsx("span",{children:w?p?"Deep link":"Unrecognized link":s.trim()?g.length?"Matches":"No matches":"All projects"}),i.jsx("span",{children:w?p?"open with ↵":"no match":s.trim()?`${g.length} shown`:x.length?`${Math.min(g.length,x.length)} of ${x.length}`:e?"No repos yet":"Loading…"})]}),i.jsxs("div",{id:P,className:"s-code-pickerResults",role:"listbox","aria-label":"Projects",children:[p?i.jsxs("button",{id:`${N}-deeplink`,type:"button",role:"option","aria-selected":H,tabIndex:-1,className:"s-code-pickerOption s-code-pickerOption--deep","data-active":H||void 0,onMouseEnter:()=>u(0),onClick:F,children:[i.jsx("span",{className:"s-code-pickerOptionMain",children:i.jsx("strong",{children:"Open deep link"})}),i.jsx("span",{className:"s-code-pickerOptionPath",title:s.trim(),children:A?ye(A):s.trim()}),i.jsxs("span",{className:"s-code-pickerOptionMeta",children:[O(p.root),p.file?` · ${W(p.file)}`:""]})]}):null,g.map((o,f)=>{const $=p?f+1:f,J=$===l,K=o.root===t;return i.jsxs("button",{id:`${N}-opt-${o.root}`,type:"button",role:"option","aria-selected":J,"aria-current":K||void 0,tabIndex:-1,className:"s-code-pickerOption","data-active":J||void 0,"data-selected":K||void 0,onMouseEnter:()=>u($),onClick:()=>T(o.root),children:[i.jsxs("span",{className:"s-code-pickerOptionMain",children:[i.jsx("strong",{children:o.projectName}),o.isPrimary?null:i.jsx("span",{className:"s-code-pickerWorktree",children:"worktree"})]}),i.jsx("span",{className:"s-code-pickerOptionPath",title:o.root,children:O(o.root)}),i.jsx("span",{className:"s-code-pickerOptionMeta",children:D(o)})]},o.root)})]}),g.length===0&&s.trim()&&!p?i.jsx("div",{className:"s-code-pickerEmpty",role:"status",children:w?"Could not resolve that scout:// link. Try a project slug or absolute path.":`No project matches “${s}”. Try a folder name, branch, path, or scout:// link.`}):null,i.jsxs("div",{className:"s-code-pickerGuide",children:[i.jsxs("span",{children:[i.jsx("kbd",{children:"↑"}),i.jsx("kbd",{children:"↓"})," move"]}),i.jsxs("span",{children:[i.jsx("kbd",{children:"↵"})," open"]}),i.jsxs("span",{children:[i.jsx("kbd",{children:"esc"})," close"]})]})]}):null]})}const Ie=Object.freeze(Object.defineProperty({__proto__:null,CodeProjectPicker:Ne,resolvePickerDeepLink:X},Symbol.toStringTag,{value:"Module"}));export{Ne as C,Ce as a,Pe as b,Ie as c,ae as f,Oe as r,O as s,Re as w};
@@ -1 +1 @@
1
- import{r as s,j as r}from"./index-EsrkGBcv.js";import{a as V}from"./api-DSqpVKC7.js";import{c as je}from"./clipboard-e3fSpeo7.js";import{f as ze}from"./scoutbot-Bk3nyrkj.js";import{g as Ae,f as Ce}from"./api-BQYTwoz6.js";import{d as Ke}from"./types-B0PlfpKc.js";import{u as Oe}from"./useEmbedHeadline-D6pJRxUg.js";import{r as He,C as qe}from"./CodeDiffPane-DuQRwpgK.js";import{r as Ge,a as Ve,w as Xe,b as Je,f as xe,C as Qe,s as Ye}from"./CodeProjectPicker-ZQ6gSBpg.js";import{ShikiPane as Ze}from"./ShikiPane-CRtTYkMj.js";/* empty css */import{A as et}from"./arrow-left-MVUKauwQ.js";import{C as tt}from"./chevron-right-DrfqcerI.js";import{C as nt}from"./check-lrJ3a73a.js";import{C as st}from"./copy-xKeM5ZtU.js";import"./cache-DGBo3vIf.js";import"./usePierreRuntime-BAQdiN0L.js";import"./chunk-HRAB3GC3-DbVLgbWX.js";/* empty css */import"./chevron-down-l1mrh5S9.js";import"./createLucideIcon-zZ8Hx7er.js";import"./search-DT42oyRW.js";const rt=new Set(["node_modules",".git","dist",".next",".build","DerivedData","__pycache__",".venv","target"]);function we(i){const l=i.lastIndexOf("/");return l>0?i.slice(0,l):"/"}function ce(i){const l=i.lastIndexOf("/");return l>=0?i.slice(l+1):i}function X(i){return i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/(1024*1024)).toFixed(1)} MB`}function S(i){return i.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function it(i,l,k){const g=S(l),f=i.projects.find(u=>S(u.name)===g||S(ce(u.root))===g);if(!f)return null;const x=k?f.worktrees.find(u=>u.name===k||u.branch.name===k||S(u.name)===S(k)):f.worktrees[0];return{projectName:f.name,root:x?.path??f.root}}function ye(i,l){if(!l.startsWith(`${i}/`))return[];const k=l.slice(i.length+1).split("/"),g=[];let f=i;for(const x of k.slice(0,-1))f=`${f}/${x}`,g.push(f);return g}function ot(i){switch(i){case"untracked":return"U";case"conflicted":return"C";case"staged":return"S";case"unstaged":return"M";case"staged+unstaged":return"SM";default:return i.charAt(0).toUpperCase()}}function be(i,l,k,g,f){const x=k.get(i);if(!x){f.push({path:`${i}#loading`,name:"Loading…",kind:"file",depth:l,loading:!0});return}for(const u of x)u.kind==="directory"&&rt.has(u.name)||(f.push({path:u.path,name:u.name,kind:u.kind,depth:l}),u.kind==="directory"&&g.has(u.path)&&be(u.path,l+1,k,g,f))}function Et({route:i,navigate:l,root:k,file:g,project:f,path:x,wt:u,line:Le,endLine:Ne,returnConversationId:Re,embedded:I=!1}){Oe("Code",I);const B=k??i?.root??null,P=g??i?.file??null,p=f??i?.project??null,b=x??i?.path??null,U=u??i?.wt??null,j=Le??i?.line,w=Ne??i?.endLine,C=Re??i?.returnConversationId??null,[h,le]=s.useState(()=>Ae()),[o,J]=s.useState(()=>B??(p?null:Ge())),[y,Q]=s.useState(()=>new Map),[L,W]=s.useState(()=>new Set),[de,ue]=s.useState(null),[a,_]=s.useState(P),[c,z]=s.useState(null),[Ee,Y]=s.useState(!1),[fe,A]=s.useState(null),[pe,Z]=s.useState("idle"),[M,ee]=s.useState("source"),[m,te]=s.useState(()=>j&&j>0?{line:j,...w&&w>=j?{endLine:w}:{}}:null),[N,K]=s.useState(()=>p?{phase:"resolving"}:{phase:"idle"}),ne=p?`${p}\0${b??""}\0${U??""}`:null,R=s.useRef(null),se=s.useRef(null),T=s.useRef(ne);T.current!==ne&&(T.current=ne,R.current=null,se.current=null),s.useEffect(()=>{te(j&&j>0?{line:j,...w&&w>=j?{endLine:w}:{}}:null)},[w,j]),s.useEffect(()=>{if(h)return;let e=!1;return Ce("quick",!1,2e4).then(t=>{e||le(t)}).catch(()=>{}),()=>{e=!0}},[h]);const E=s.useCallback(async e=>{try{const t=await V(`/api/file/preview?path=${encodeURIComponent(e)}`);if(t.kind!=="directory")return;const n=t.entries.map(d=>({name:d.name,path:d.path,kind:d.kind}));Q(d=>new Map(d).set(e,n))}catch(t){ue(t instanceof Error?t.message:String(t))}},[]),$=s.useCallback((e,t)=>{if(!t)return;const n=ye(e,t);if(n.length!==0){W(d=>new Set([...d,...n]));for(const d of n)E(d)}},[E]);s.useEffect(()=>{if(!p)return;const e=`${p}\0${b??""}\0${U??""}`;if(R.current===e)return;const t=n=>{R.current=e;const d=b?`${n}/${b}`:null;K({phase:"idle"}),J(n),_(d),$(n,d)};if(h){const n=it(h,p,U);if(n){t(n.root);return}}se.current!==e&&(K({phase:"resolving"}),V(`/api/code/resolve-project?slug=${encodeURIComponent(p)}`).then(n=>{R.current===e||T.current!==e||t(n.root)}).catch(n=>{if(R.current===e||T.current!==e)return;se.current=e;const d=n instanceof Error?n.message:String(n);K({phase:"failed",message:d.includes(p)?d:`Can't resolve project "${p}": ${d}`})}))},[p,b,U,h,$]),s.useEffect(()=>{if(o||p||!h)return;const e=h.projects[0];e&&J(e.worktrees[0]?.path??e.root)},[o,p,h]);const he=s.useRef(a);he.current=a,s.useEffect(()=>{if(!o)return;ue(null);const e=Ve(o),t=he.current,n=t?ye(o,t):[];e?(Q(new Map(Object.entries(e.entries))),W(new Set([...e.expanded,...n])),!t&&e.selectedFile&&_(e.selectedFile)):(Q(new Map),W(new Set(n)));const d=new Set([o,...e?.expanded??[],...n]);for(const ae of d)E(ae);Ce("quick",!1,2e4).then(le).catch(()=>{})},[o,E]),s.useEffect(()=>{!o||y.size===0||(Xe(o,{entries:y,expanded:L,selectedFile:a}),Je(o))},[o,y,L,a]),s.useEffect(()=>{!B||!P||$(B,P)},[B,P,$]);const re=s.useRef(new Map),ie=s.useRef(new Set),$e=3e4,O=s.useCallback(e=>{const t=re.current.get(e);return t?Date.now()-t.at>$e?(re.current.delete(e),null):t.preview:null},[]),H=s.useCallback((e,t)=>{const n=re.current;if(n.set(e,{at:Date.now(),preview:t}),n.size>80){const d=n.keys().next().value;d&&n.delete(d)}},[]),Fe=s.useCallback(e=>{O(e)||ie.current.has(e)||(ie.current.add(e),V(`/api/file/preview?path=${encodeURIComponent(e)}`).then(t=>H(e,t)).catch(()=>{}).finally(()=>ie.current.delete(e)))},[O,H]);s.useEffect(()=>{if(Z("idle"),!a){z(null),A(null);return}const e=O(a);if(e){z(e.kind==="file"?e:null),A(null),Y(!1);return}let t=!1;return Y(!0),A(null),V(`/api/file/preview?path=${encodeURIComponent(a)}`).then(n=>{t||(H(a,n),z(n.kind==="file"?n:null))}).catch(n=>{t||(z(null),A(n instanceof Error?n.message:String(n)))}).finally(()=>{t||Y(!1)}),()=>{t=!0}},[a,O,H]);const Me=s.useMemo(()=>{if(!o)return[];const e=[];return be(o,0,y,L,e),e},[o,y,L]),me=s.useCallback((e,t)=>{const n=C?{returnConversationId:C}:{};if(h){for(const d of h.projects)for(const[ae,ge]of d.worktrees.entries())if(ge.path===e){const ve=t&&t.startsWith(`${e}/`)?t.slice(e.length+1):void 0;return{view:"code",project:S(d.name),...ve?{path:ve}:{},...ae>0?{wt:ge.name}:{},...n}}}return{view:"code",root:e,...t?{file:t}:{},...n}},[C,h]),oe=s.useCallback(()=>{if(!C)return;const e={view:"conversation",conversationId:C};ze({type:"navigate",route:e})||l?.(e)},[l,C]);s.useEffect(()=>{if(!C)return;const e=t=>{if(!t.defaultPrevented&&!(!t.metaKey||t.key!=="[")){if(t.target instanceof HTMLElement){const n=t.target.tagName;if(n==="INPUT"||n==="TEXTAREA"||t.target.isContentEditable)return}t.preventDefault(),oe()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[C,oe]);const q=s.useCallback((e,t)=>{I||!l||l(me(e,t))},[I,l,me]),Te=s.useCallback(e=>{W(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),y.has(e)||E(e)},[y,E]),De=s.useCallback(e=>{te(null),_(e),o&&q(o,e)},[o,q]),v=s.useMemo(()=>{if(!h||!o)return null;for(const e of h.projects)for(const t of e.worktrees)if(t.path===o)return{project:e,worktree:t};return null},[h,o]),F=s.useMemo(()=>{const e=new Map;if(!o||!v)return e;for(const t of v.worktree.status.files)e.set(`${o}/${t.path}`,t.status);return e},[o,v]),Ie=s.useMemo(()=>{const e=new Set;if(!o)return e;for(const t of F.keys()){let n=we(t);for(;n.startsWith(o)&&(e.add(n),n!==o);)n=we(n)}return e},[o,F]),G=!!(o&&a&&He(o,a));s.useEffect(()=>{G||ee("source")},[G]);const Be=a&&o&&a.startsWith(`${o}/`)?a.slice(o.length+1):c?.kind==="file"?c.title:a?ce(a):null,Pe=s.useCallback(async()=>{if(!c||c.kind!=="file"||!c.previewable)return;await je(c.content)&&(Z("copied"),window.setTimeout(()=>Z("idle"),1500))},[c]),[Ue,ke]=s.useState("idle"),D=s.useMemo(()=>{if(!o)return null;if(v){const e=a&&a.startsWith(`${o}/`)?a.slice(o.length+1):void 0,t=v.project.worktrees[0]?.path;return xe({project:S(v.project.name),...e?{path:e}:{},...t&&t!==o?{wt:v.worktree.name}:{},...m?.line?{line:m.line}:{},...m?.endLine?{endLine:m.endLine}:{}})}return xe({...a?{file:a}:{root:o},...m?.line?{line:m.line}:{},...m?.endLine?{endLine:m.endLine}:{}})},[o,a,v,m]),We=s.useCallback(async()=>{if(!D)return;await je(D)&&(ke("copied"),window.setTimeout(()=>ke("idle"),1500))},[D]),_e=s.useCallback(e=>{R.current=T.current,K({phase:"idle"}),te(e.line&&e.line>0?{line:e.line,...e.endLine&&e.endLine>=e.line?{endLine:e.endLine}:{}}:null),_(e.file??null),J(e.root),e.file&&$(e.root,e.file),q(e.root,e.file??null)},[$,q]);return r.jsxs("div",{className:"s-code-screen","data-embedded":I||void 0,children:[r.jsxs("div",{className:"s-code-head",children:[C?r.jsxs("button",{type:"button",className:"s-code-returnThread",onClick:oe,title:"Back to thread (⌘[)",children:[r.jsx(et,{size:13,strokeWidth:1.9,"aria-hidden":!0}),r.jsx("span",{children:"Back to thread"})]}):null,r.jsx(Qe,{snapshot:h,root:o,onSelect:_e}),v?.worktree.diff.branchShortstat?r.jsx("span",{className:"s-code-headStat",children:v.worktree.diff.branchShortstat}):null,o?r.jsx("span",{className:"s-code-headPath",title:o,children:Ye(o)}):null,D?r.jsx("button",{type:"button",className:"s-code-copyLink",title:D,onClick:()=>{We()},children:Ue==="copied"?"Copied scout://":"Copy scout://"}):null]}),r.jsxs("div",{className:"s-code-body",children:[r.jsx("div",{className:"s-code-tree",role:"tree","aria-label":"Files",children:de?r.jsx("div",{className:"s-code-treeNote",children:de}):o?Me.map(e=>e.loading?r.jsx("div",{className:"s-code-node s-code-node--loading",style:{paddingLeft:10+e.depth*14},children:e.name},e.path):r.jsxs("button",{type:"button",role:"treeitem",className:"s-code-node","data-selected":e.path===a||void 0,"data-diff":e.kind==="file"?F.get(e.path):void 0,"aria-expanded":e.kind==="directory"?L.has(e.path):void 0,style:{paddingLeft:10+e.depth*14},onClick:()=>e.kind==="directory"?Te(e.path):De(e.path),onMouseEnter:e.kind==="file"?()=>Fe(e.path):void 0,children:[e.kind==="directory"?r.jsx(tt,{size:11,strokeWidth:2,className:"s-code-nodeChevron","data-open":L.has(e.path)||void 0,"aria-hidden":!0}):r.jsx("span",{className:"s-code-nodeSpacer","aria-hidden":!0}),r.jsx("span",{className:"s-code-nodeName",children:e.name}),e.kind==="file"&&F.has(e.path)?r.jsx("span",{className:"s-code-nodeBadge","data-diff":F.get(e.path),children:ot(F.get(e.path)??"")}):null,e.kind==="directory"&&Ie.has(e.path)?r.jsx("span",{className:"s-code-nodeDot","aria-label":"Contains changes"}):null]},e.path)):N.phase==="resolving"?r.jsxs("div",{className:"s-code-treeNote",children:["Resolving “",p,"”…"]}):N.phase==="failed"?r.jsx("div",{className:"s-code-treeNote",children:N.message}):r.jsx("div",{className:"s-code-treeNote",children:"No repo selected."})}),r.jsxs("div",{className:"s-code-main",children:[a?r.jsxs("div",{className:"s-code-fileHead",children:[r.jsx("span",{className:"s-code-filePath",children:Be}),G?r.jsxs("div",{className:"s-code-fileMode",role:"tablist","aria-label":"File view",children:[r.jsx("button",{type:"button",role:"tab","aria-selected":M==="source","data-selected":M==="source"||void 0,onClick:()=>ee("source"),children:"Source"}),r.jsx("button",{type:"button",role:"tab","aria-selected":M==="changes","data-selected":M==="changes"||void 0,onClick:()=>ee("changes"),children:"Changes"})]}):null,c?.kind==="file"?r.jsxs("span",{className:"s-code-fileMeta",children:[X(c.sizeBytes),c.previewable&&c.truncated?" · truncated":"",m?` · L${m.line}${m.endLine?`–${m.endLine}`:""}`:""]}):null,c?.kind==="file"&&c.previewable?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"s-code-fileAction",onClick:()=>{Pe()},title:"Copy file contents",children:[pe==="copied"?r.jsx(nt,{size:12,"aria-hidden":!0}):r.jsx(st,{size:12,"aria-hidden":!0}),pe==="copied"?"Copied":"Copy"]}),r.jsx("a",{className:"s-code-fileAction",href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"Raw"})]}):null]}):null,M==="changes"&&G&&o&&a?r.jsx(qe,{root:o,file:a},`${o}\0${a}`):Ee?r.jsxs("div",{className:"s-code-empty",children:["Loading ",a?ce(a):"file","…"]}):fe?r.jsx("div",{className:"s-code-empty",children:fe}):c&&c.kind==="file"&&c.previewable?r.jsxs(r.Fragment,{children:[c.truncated?r.jsxs("div",{className:"s-code-fileNote",children:["Showing the first ",X(256*1024)," of ",X(c.sizeBytes)," ·"," ",r.jsx("a",{href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"open raw"})]}):null,r.jsx(Ze,{code:c.content,path:c.path,focusLine:m?.line,endLine:m?.endLine})]}):c&&c.kind==="file"?r.jsxs("div",{className:"s-code-empty",children:[c.previewReason," · ",X(c.sizeBytes)," ·"," ",r.jsx("a",{href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"open raw"})]}):N.phase==="resolving"?r.jsxs("div",{className:"s-code-empty",children:["Opening ",b??`“${p}”`,"…"]}):N.phase==="failed"?r.jsx("div",{className:"s-code-empty",children:N.message}):r.jsx("div",{className:"s-code-empty",children:"Pick a file to read."})]})]})]})}const $t=Ke({id:"code",label:"Code Browser",route:{view:"code"},webPath:"/code",screen:"CodeContent",embed:{path:"/embed/code",profile:"macos.code",rootClassName:"s-code-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},hosts:{macos:!0},resolveEmbedProps:i=>({root:i.get("root")?.trim()||void 0,file:i.get("file")?.trim()||void 0,project:i.get("project")?.trim()||void 0,path:i.get("path")?.trim()||void 0,wt:i.get("wt")?.trim()||void 0,line:Se(i.get("line")),endLine:Se(i.get("endLine")),returnConversationId:i.get("fromConversation")?.trim()||void 0})}});function Se(i){if(!i)return;const l=Number.parseInt(i,10);return Number.isSafeInteger(l)&&l>0?l:void 0}export{Et as CodeContent,$t as scoutSurface};
1
+ import{r as s,j as r}from"./index-BFbLvCJn.js";import{a as V}from"./api-DSqpVKC7.js";import{c as je}from"./clipboard-e3fSpeo7.js";import{f as ze}from"./scoutbot-Bk3nyrkj.js";import{g as Ae,f as Ce}from"./api-BQYTwoz6.js";import{d as Ke}from"./types-B0PlfpKc.js";import{u as Oe}from"./useEmbedHeadline-BeeBDb7E.js";import{r as He,C as qe}from"./CodeDiffPane-DCgMUi39.js";import{r as Ge,a as Ve,w as Xe,b as Je,f as xe,C as Qe,s as Ye}from"./CodeProjectPicker-Dq787L77.js";import{ShikiPane as Ze}from"./ShikiPane-CDiIT_qn.js";/* empty css */import{A as et}from"./arrow-left-DNjQHf4C.js";import{C as tt}from"./chevron-right-B02kAw12.js";import{C as nt}from"./check-BM6QtbB7.js";import{C as st}from"./copy-C1XrY27_.js";import"./cache-DGBo3vIf.js";import"./usePierreRuntime-DUXZ-DTK.js";import"./chunk-HRAB3GC3-DVhUsgOw.js";/* empty css */import"./chevron-down-DEDSNJNY.js";import"./createLucideIcon-CKbjXlwv.js";import"./search-Bv2IONmc.js";const rt=new Set(["node_modules",".git","dist",".next",".build","DerivedData","__pycache__",".venv","target"]);function we(i){const l=i.lastIndexOf("/");return l>0?i.slice(0,l):"/"}function ce(i){const l=i.lastIndexOf("/");return l>=0?i.slice(l+1):i}function X(i){return i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/(1024*1024)).toFixed(1)} MB`}function S(i){return i.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"")}function it(i,l,k){const g=S(l),f=i.projects.find(u=>S(u.name)===g||S(ce(u.root))===g);if(!f)return null;const x=k?f.worktrees.find(u=>u.name===k||u.branch.name===k||S(u.name)===S(k)):f.worktrees[0];return{projectName:f.name,root:x?.path??f.root}}function ye(i,l){if(!l.startsWith(`${i}/`))return[];const k=l.slice(i.length+1).split("/"),g=[];let f=i;for(const x of k.slice(0,-1))f=`${f}/${x}`,g.push(f);return g}function ot(i){switch(i){case"untracked":return"U";case"conflicted":return"C";case"staged":return"S";case"unstaged":return"M";case"staged+unstaged":return"SM";default:return i.charAt(0).toUpperCase()}}function be(i,l,k,g,f){const x=k.get(i);if(!x){f.push({path:`${i}#loading`,name:"Loading…",kind:"file",depth:l,loading:!0});return}for(const u of x)u.kind==="directory"&&rt.has(u.name)||(f.push({path:u.path,name:u.name,kind:u.kind,depth:l}),u.kind==="directory"&&g.has(u.path)&&be(u.path,l+1,k,g,f))}function Et({route:i,navigate:l,root:k,file:g,project:f,path:x,wt:u,line:Le,endLine:Ne,returnConversationId:Re,embedded:I=!1}){Oe("Code",I);const B=k??i?.root??null,P=g??i?.file??null,p=f??i?.project??null,b=x??i?.path??null,U=u??i?.wt??null,j=Le??i?.line,w=Ne??i?.endLine,C=Re??i?.returnConversationId??null,[h,le]=s.useState(()=>Ae()),[o,J]=s.useState(()=>B??(p?null:Ge())),[y,Q]=s.useState(()=>new Map),[L,W]=s.useState(()=>new Set),[de,ue]=s.useState(null),[a,_]=s.useState(P),[c,z]=s.useState(null),[Ee,Y]=s.useState(!1),[fe,A]=s.useState(null),[pe,Z]=s.useState("idle"),[M,ee]=s.useState("source"),[m,te]=s.useState(()=>j&&j>0?{line:j,...w&&w>=j?{endLine:w}:{}}:null),[N,K]=s.useState(()=>p?{phase:"resolving"}:{phase:"idle"}),ne=p?`${p}\0${b??""}\0${U??""}`:null,R=s.useRef(null),se=s.useRef(null),T=s.useRef(ne);T.current!==ne&&(T.current=ne,R.current=null,se.current=null),s.useEffect(()=>{te(j&&j>0?{line:j,...w&&w>=j?{endLine:w}:{}}:null)},[w,j]),s.useEffect(()=>{if(h)return;let e=!1;return Ce("quick",!1,2e4).then(t=>{e||le(t)}).catch(()=>{}),()=>{e=!0}},[h]);const E=s.useCallback(async e=>{try{const t=await V(`/api/file/preview?path=${encodeURIComponent(e)}`);if(t.kind!=="directory")return;const n=t.entries.map(d=>({name:d.name,path:d.path,kind:d.kind}));Q(d=>new Map(d).set(e,n))}catch(t){ue(t instanceof Error?t.message:String(t))}},[]),$=s.useCallback((e,t)=>{if(!t)return;const n=ye(e,t);if(n.length!==0){W(d=>new Set([...d,...n]));for(const d of n)E(d)}},[E]);s.useEffect(()=>{if(!p)return;const e=`${p}\0${b??""}\0${U??""}`;if(R.current===e)return;const t=n=>{R.current=e;const d=b?`${n}/${b}`:null;K({phase:"idle"}),J(n),_(d),$(n,d)};if(h){const n=it(h,p,U);if(n){t(n.root);return}}se.current!==e&&(K({phase:"resolving"}),V(`/api/code/resolve-project?slug=${encodeURIComponent(p)}`).then(n=>{R.current===e||T.current!==e||t(n.root)}).catch(n=>{if(R.current===e||T.current!==e)return;se.current=e;const d=n instanceof Error?n.message:String(n);K({phase:"failed",message:d.includes(p)?d:`Can't resolve project "${p}": ${d}`})}))},[p,b,U,h,$]),s.useEffect(()=>{if(o||p||!h)return;const e=h.projects[0];e&&J(e.worktrees[0]?.path??e.root)},[o,p,h]);const he=s.useRef(a);he.current=a,s.useEffect(()=>{if(!o)return;ue(null);const e=Ve(o),t=he.current,n=t?ye(o,t):[];e?(Q(new Map(Object.entries(e.entries))),W(new Set([...e.expanded,...n])),!t&&e.selectedFile&&_(e.selectedFile)):(Q(new Map),W(new Set(n)));const d=new Set([o,...e?.expanded??[],...n]);for(const ae of d)E(ae);Ce("quick",!1,2e4).then(le).catch(()=>{})},[o,E]),s.useEffect(()=>{!o||y.size===0||(Xe(o,{entries:y,expanded:L,selectedFile:a}),Je(o))},[o,y,L,a]),s.useEffect(()=>{!B||!P||$(B,P)},[B,P,$]);const re=s.useRef(new Map),ie=s.useRef(new Set),$e=3e4,O=s.useCallback(e=>{const t=re.current.get(e);return t?Date.now()-t.at>$e?(re.current.delete(e),null):t.preview:null},[]),H=s.useCallback((e,t)=>{const n=re.current;if(n.set(e,{at:Date.now(),preview:t}),n.size>80){const d=n.keys().next().value;d&&n.delete(d)}},[]),Fe=s.useCallback(e=>{O(e)||ie.current.has(e)||(ie.current.add(e),V(`/api/file/preview?path=${encodeURIComponent(e)}`).then(t=>H(e,t)).catch(()=>{}).finally(()=>ie.current.delete(e)))},[O,H]);s.useEffect(()=>{if(Z("idle"),!a){z(null),A(null);return}const e=O(a);if(e){z(e.kind==="file"?e:null),A(null),Y(!1);return}let t=!1;return Y(!0),A(null),V(`/api/file/preview?path=${encodeURIComponent(a)}`).then(n=>{t||(H(a,n),z(n.kind==="file"?n:null))}).catch(n=>{t||(z(null),A(n instanceof Error?n.message:String(n)))}).finally(()=>{t||Y(!1)}),()=>{t=!0}},[a,O,H]);const Me=s.useMemo(()=>{if(!o)return[];const e=[];return be(o,0,y,L,e),e},[o,y,L]),me=s.useCallback((e,t)=>{const n=C?{returnConversationId:C}:{};if(h){for(const d of h.projects)for(const[ae,ge]of d.worktrees.entries())if(ge.path===e){const ve=t&&t.startsWith(`${e}/`)?t.slice(e.length+1):void 0;return{view:"code",project:S(d.name),...ve?{path:ve}:{},...ae>0?{wt:ge.name}:{},...n}}}return{view:"code",root:e,...t?{file:t}:{},...n}},[C,h]),oe=s.useCallback(()=>{if(!C)return;const e={view:"conversation",conversationId:C};ze({type:"navigate",route:e})||l?.(e)},[l,C]);s.useEffect(()=>{if(!C)return;const e=t=>{if(!t.defaultPrevented&&!(!t.metaKey||t.key!=="[")){if(t.target instanceof HTMLElement){const n=t.target.tagName;if(n==="INPUT"||n==="TEXTAREA"||t.target.isContentEditable)return}t.preventDefault(),oe()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[C,oe]);const q=s.useCallback((e,t)=>{I||!l||l(me(e,t))},[I,l,me]),Te=s.useCallback(e=>{W(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),y.has(e)||E(e)},[y,E]),De=s.useCallback(e=>{te(null),_(e),o&&q(o,e)},[o,q]),v=s.useMemo(()=>{if(!h||!o)return null;for(const e of h.projects)for(const t of e.worktrees)if(t.path===o)return{project:e,worktree:t};return null},[h,o]),F=s.useMemo(()=>{const e=new Map;if(!o||!v)return e;for(const t of v.worktree.status.files)e.set(`${o}/${t.path}`,t.status);return e},[o,v]),Ie=s.useMemo(()=>{const e=new Set;if(!o)return e;for(const t of F.keys()){let n=we(t);for(;n.startsWith(o)&&(e.add(n),n!==o);)n=we(n)}return e},[o,F]),G=!!(o&&a&&He(o,a));s.useEffect(()=>{G||ee("source")},[G]);const Be=a&&o&&a.startsWith(`${o}/`)?a.slice(o.length+1):c?.kind==="file"?c.title:a?ce(a):null,Pe=s.useCallback(async()=>{if(!c||c.kind!=="file"||!c.previewable)return;await je(c.content)&&(Z("copied"),window.setTimeout(()=>Z("idle"),1500))},[c]),[Ue,ke]=s.useState("idle"),D=s.useMemo(()=>{if(!o)return null;if(v){const e=a&&a.startsWith(`${o}/`)?a.slice(o.length+1):void 0,t=v.project.worktrees[0]?.path;return xe({project:S(v.project.name),...e?{path:e}:{},...t&&t!==o?{wt:v.worktree.name}:{},...m?.line?{line:m.line}:{},...m?.endLine?{endLine:m.endLine}:{}})}return xe({...a?{file:a}:{root:o},...m?.line?{line:m.line}:{},...m?.endLine?{endLine:m.endLine}:{}})},[o,a,v,m]),We=s.useCallback(async()=>{if(!D)return;await je(D)&&(ke("copied"),window.setTimeout(()=>ke("idle"),1500))},[D]),_e=s.useCallback(e=>{R.current=T.current,K({phase:"idle"}),te(e.line&&e.line>0?{line:e.line,...e.endLine&&e.endLine>=e.line?{endLine:e.endLine}:{}}:null),_(e.file??null),J(e.root),e.file&&$(e.root,e.file),q(e.root,e.file??null)},[$,q]);return r.jsxs("div",{className:"s-code-screen","data-embedded":I||void 0,children:[r.jsxs("div",{className:"s-code-head",children:[C?r.jsxs("button",{type:"button",className:"s-code-returnThread",onClick:oe,title:"Back to thread (⌘[)",children:[r.jsx(et,{size:13,strokeWidth:1.9,"aria-hidden":!0}),r.jsx("span",{children:"Back to thread"})]}):null,r.jsx(Qe,{snapshot:h,root:o,onSelect:_e}),v?.worktree.diff.branchShortstat?r.jsx("span",{className:"s-code-headStat",children:v.worktree.diff.branchShortstat}):null,o?r.jsx("span",{className:"s-code-headPath",title:o,children:Ye(o)}):null,D?r.jsx("button",{type:"button",className:"s-code-copyLink",title:D,onClick:()=>{We()},children:Ue==="copied"?"Copied scout://":"Copy scout://"}):null]}),r.jsxs("div",{className:"s-code-body",children:[r.jsx("div",{className:"s-code-tree",role:"tree","aria-label":"Files",children:de?r.jsx("div",{className:"s-code-treeNote",children:de}):o?Me.map(e=>e.loading?r.jsx("div",{className:"s-code-node s-code-node--loading",style:{paddingLeft:10+e.depth*14},children:e.name},e.path):r.jsxs("button",{type:"button",role:"treeitem",className:"s-code-node","data-selected":e.path===a||void 0,"data-diff":e.kind==="file"?F.get(e.path):void 0,"aria-expanded":e.kind==="directory"?L.has(e.path):void 0,style:{paddingLeft:10+e.depth*14},onClick:()=>e.kind==="directory"?Te(e.path):De(e.path),onMouseEnter:e.kind==="file"?()=>Fe(e.path):void 0,children:[e.kind==="directory"?r.jsx(tt,{size:11,strokeWidth:2,className:"s-code-nodeChevron","data-open":L.has(e.path)||void 0,"aria-hidden":!0}):r.jsx("span",{className:"s-code-nodeSpacer","aria-hidden":!0}),r.jsx("span",{className:"s-code-nodeName",children:e.name}),e.kind==="file"&&F.has(e.path)?r.jsx("span",{className:"s-code-nodeBadge","data-diff":F.get(e.path),children:ot(F.get(e.path)??"")}):null,e.kind==="directory"&&Ie.has(e.path)?r.jsx("span",{className:"s-code-nodeDot","aria-label":"Contains changes"}):null]},e.path)):N.phase==="resolving"?r.jsxs("div",{className:"s-code-treeNote",children:["Resolving “",p,"”…"]}):N.phase==="failed"?r.jsx("div",{className:"s-code-treeNote",children:N.message}):r.jsx("div",{className:"s-code-treeNote",children:"No repo selected."})}),r.jsxs("div",{className:"s-code-main",children:[a?r.jsxs("div",{className:"s-code-fileHead",children:[r.jsx("span",{className:"s-code-filePath",children:Be}),G?r.jsxs("div",{className:"s-code-fileMode",role:"tablist","aria-label":"File view",children:[r.jsx("button",{type:"button",role:"tab","aria-selected":M==="source","data-selected":M==="source"||void 0,onClick:()=>ee("source"),children:"Source"}),r.jsx("button",{type:"button",role:"tab","aria-selected":M==="changes","data-selected":M==="changes"||void 0,onClick:()=>ee("changes"),children:"Changes"})]}):null,c?.kind==="file"?r.jsxs("span",{className:"s-code-fileMeta",children:[X(c.sizeBytes),c.previewable&&c.truncated?" · truncated":"",m?` · L${m.line}${m.endLine?`–${m.endLine}`:""}`:""]}):null,c?.kind==="file"&&c.previewable?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"s-code-fileAction",onClick:()=>{Pe()},title:"Copy file contents",children:[pe==="copied"?r.jsx(nt,{size:12,"aria-hidden":!0}):r.jsx(st,{size:12,"aria-hidden":!0}),pe==="copied"?"Copied":"Copy"]}),r.jsx("a",{className:"s-code-fileAction",href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"Raw"})]}):null]}):null,M==="changes"&&G&&o&&a?r.jsx(qe,{root:o,file:a},`${o}\0${a}`):Ee?r.jsxs("div",{className:"s-code-empty",children:["Loading ",a?ce(a):"file","…"]}):fe?r.jsx("div",{className:"s-code-empty",children:fe}):c&&c.kind==="file"&&c.previewable?r.jsxs(r.Fragment,{children:[c.truncated?r.jsxs("div",{className:"s-code-fileNote",children:["Showing the first ",X(256*1024)," of ",X(c.sizeBytes)," ·"," ",r.jsx("a",{href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"open raw"})]}):null,r.jsx(Ze,{code:c.content,path:c.path,focusLine:m?.line,endLine:m?.endLine})]}):c&&c.kind==="file"?r.jsxs("div",{className:"s-code-empty",children:[c.previewReason," · ",X(c.sizeBytes)," ·"," ",r.jsx("a",{href:c.rawUrl,target:"_blank",rel:"noreferrer",children:"open raw"})]}):N.phase==="resolving"?r.jsxs("div",{className:"s-code-empty",children:["Opening ",b??`“${p}”`,"…"]}):N.phase==="failed"?r.jsx("div",{className:"s-code-empty",children:N.message}):r.jsx("div",{className:"s-code-empty",children:"Pick a file to read."})]})]})]})}const $t=Ke({id:"code",label:"Code Browser",route:{view:"code"},webPath:"/code",screen:"CodeContent",embed:{path:"/embed/code",profile:"macos.code",rootClassName:"s-code-embed",chrome:{showSecondaryNav:!1,showPageStatusBar:!1},hosts:{macos:!0},resolveEmbedProps:i=>({root:i.get("root")?.trim()||void 0,file:i.get("file")?.trim()||void 0,project:i.get("project")?.trim()||void 0,path:i.get("path")?.trim()||void 0,wt:i.get("wt")?.trim()||void 0,line:Se(i.get("line")),endLine:Se(i.get("endLine")),returnConversationId:i.get("fromConversation")?.trim()||void 0})}});function Se(i){if(!i)return;const l=Number.parseInt(i,10);return Number.isSafeInteger(l)&&l>0?l:void 0}export{Et as CodeContent,$t as scoutSurface};
@@ -1 +1 @@
1
- import{r as I,j as a}from"./index-EsrkGBcv.js";import{a as Z,h as _,d as q,p as J}from"./comms-gesture-_aGFo6g3.js";import{f as Q}from"./comms-deck-CBhsXnY-.js";const U={nodeW:178,nodeH:42,rowGap:9,laneGap:124,padX:26,padY:46,shelfRows:9,colGap:20};function ee(t,x,p=new Map){const w=new Map,r=new Map;let f=0;const g=new Map,i=n=>{w.has(n.id)||w.set(n.id,n)};for(const n of t){if(i(n.from),n.from.kind==="operator"){const v=g.get(n.from.id)??{own:0,agent:0};n.message.class==="agent"?v.agent+=n.count:v.own+=n.count,g.set(n.from.id,v)}if(n.kind==="channel"){f+=n.count;for(const v of n.audience)i(v);continue}for(const v of n.audience){if(i(v),v.id===n.from.id)continue;const M=`${n.from.id}->${v.id}`,$=r.get(M);$?$.count+=n.count:r.set(M,{from:n.from.id,to:v.id,count:n.count})}}const d=new Set([...g].filter(([,n])=>n.own===0&&n.agent>0).map(([n])=>n)),b=[...g].filter(([n])=>d.has(n)).reduce((n,[,v])=>n+v.agent,0),o=[...w.values()].map(n=>({id:n.id,short:n.short,kind:n.kind,model:p.get(n.id)?.model??null,harness:p.get(n.id)?.harness??null,disputed:d.has(n.id)})),m=Z(t,x).map(n=>({id:n.id,title:n.title,ms:n.ms,abandoned:n.abandoned,waiterId:n.waiter.id,workerId:n.worker.id}));return{actors:o,tasks:m,pairs:[...r.values()],broadcasts:f,misattributed:b}}function se(t,x,p,w){const r=new Set([w]),f=new Map,g=new Map;for(const i of x)(f.get(i.waiterId)??f.set(i.waiterId,[]).get(i.waiterId)).push(i.workerId),(g.get(i.workerId)??g.set(i.workerId,[]).get(i.workerId)).push(i.waiterId);for(const i of[f,g]){const d=[w];for(let b=0;b<d.length;b+=1)for(const o of i.get(d[b])??[])r.has(o)||(r.add(o),d.push(o))}return r.size<2?{actors:[...t],tasks:[...x],pairs:[...p],setAside:0}:{actors:t.filter(i=>r.has(i.id)),tasks:x.filter(i=>r.has(i.waiterId)&&r.has(i.workerId)),pairs:p.filter(i=>r.has(i.from)&&r.has(i.to)),setAside:t.length-r.size}}function te(t,x){const p=new Map,w=new Map,r=new Map(t.map(d=>[d,0]));for(const d of x)d.from!==d.to&&((p.get(d.from)??p.set(d.from,[]).get(d.from)).push(d.to),(w.get(d.to)??w.set(d.to,[]).get(d.to)).push(d.from),r.set(d.to,(r.get(d.to)??0)+1));const f=new Map,g=t.filter(d=>(r.get(d)??0)===0);for(const d of g)f.set(d,0);const i=new Map(r);for(let d=0;d<g.length;d+=1){const b=g[d];for(const o of p.get(b)??[]){f.set(o,Math.max(f.get(o)??0,(f.get(b)??0)+1));const m=(i.get(o)??0)-1;i.set(o,m),m===0&&g.push(o)}}for(const d of t){if(f.has(d))continue;const b=(w.get(d)??[]).map(o=>f.get(o)).filter(o=>o!==void 0);f.set(d,b.length>0?Math.max(...b)+1:0)}return f}function ne(t,x){return x===0?"In this window":t===0?"Opened the work":t===x?"Did the work":"Passed it on"}function ae(t,x,p,w){const r=U,f=new Map(t.map(s=>[s.id,s])),g=new Map,i=s=>{let c=g.get(s);return c||(c={asked:0,did:0,ms:0,abandoned:0,sent:0,received:0},g.set(s,c)),c};for(const s of t)i(s.id);for(const s of x){i(s.waiterId).asked+=1;const c=i(s.workerId);c.did+=1,c.ms=Math.max(c.ms,s.ms),s.abandoned&&(c.abandoned+=1)}for(const s of p)i(s.from).sent+=s.count,i(s.to).received+=s.count;const d=x.map(s=>({from:s.waiterId,to:s.workerId})),b=t.map(s=>s.id),o=te(b,d),m=new Set;for(const s of d)m.add(s.from),m.add(s.to);const n=new Map;for(const s of p)for(const[c,l]of[[s.from,s.to],[s.to,s.from]]){const u=n.get(c);(!u||s.count>u.count)&&n.set(c,{id:l,count:s.count})}for(const s of b){if(m.has(s))continue;const c=n.get(s);o.set(s,c&&m.has(c.id)?(o.get(c.id)??0)+1:o.get(s)??0)}const v=Math.max(0,...b.map(s=>o.get(s)??0)),M=s=>{const c=i(s);switch(w.order){case"duration":return-c.ms;case"outcome":return-(c.abandoned*1e12+c.ms);case"volume":return-(c.sent+c.received);case"name":return 0}},$=new Map;for(const s of b){const c=o.get(s)??0;($.get(c)??$.set(c,[]).get(c)).push(s)}for(const[,s]of $)s.sort((c,l)=>{const u=M(c)-M(l);return u!==0?u:(f.get(c)?.short??c).localeCompare(f.get(l)?.short??l)});const E=w.mode==="shelf"?Math.max(2,w.shelfRows??r.shelfRows):Number.POSITIVE_INFINITY,A=new Map,H=new Map;let W=r.padX;for(let s=0;s<=v;s+=1){const c=$.get(s)??[],l=Math.max(1,Math.ceil(c.length/E));A.set(s,l),H.set(s,W),W+=l*r.nodeW+(l-1)*r.colGap+r.laneGap}const K=Math.max(W-r.laneGap+r.padX,640),j=[];for(let s=0;s<=v;s+=1){const c=$.get(s)??[],l=A.get(s)??1,u=Math.ceil(c.length/l);c.forEach((e,h)=>{const y=l===1?0:Math.floor(h/u),S=l===1?h:h%u,R=i(e),L=f.get(e);j.push({id:e,short:L?.short??e,kind:L?.kind??"agent",lane:s,col:y,x:(H.get(s)??r.padX)+y*(r.nodeW+r.colGap),y:r.padY+S*(r.nodeH+r.rowGap),w:r.nodeW,h:r.nodeH,asked:R.asked,did:R.did,ms:R.ms,abandoned:R.abandoned,sent:R.sent,received:R.received,model:L?.model??null,harness:L?.harness??null,disputed:L?.disputed??!1,inferred:!m.has(e)})})}const C=new Map(j.map(s=>[s.id,s])),D=Math.max(1,...[...$.entries()].map(([s,c])=>Math.ceil(c.length/(A.get(s)??1)))),N=r.padY*2+D*r.nodeH+(D-1)*r.rowGap,k=new Map;for(const s of x){const c=`${s.waiterId}>${s.workerId}`,l=k.get(c)??{tasks:0,abandoned:0};l.tasks+=1,s.abandoned&&(l.abandoned+=1),k.set(c,l)}const P=Math.max(1,...p.map(s=>s.count)),O=[],T=[],X=(s,c)=>{const l=s.x+s.w,u=s.y+s.h/2,e=c.x,h=c.y+c.h/2,y=Math.max(28,(e-l)/2);return{d:`M ${l} ${u} C ${l+y} ${u}, ${e-y} ${h}, ${e} ${h}`,tip:{x:e,y:h,angle:0}}};if(w.mode==="ladder")for(const s of p){const c=C.get(s.from),l=C.get(s.to);if(!c||!l||c.lane>=l.lane)continue;const u=k.get(`${s.from}>${s.to}`),{d:e,tip:h}=X(c,l);O.push({key:`${s.from}>${s.to}`,from:s.from,to:s.to,count:s.count,tasks:u?.tasks??0,abandoned:u?.abandoned??0,weight:1+Math.round(s.count/P*3),d:e,tip:h})}else{const s=new Map,c=(l,u)=>{const e=`${l}>L${u}`,h=s.get(e)??{from:l,lane:u,count:0,tasks:0,abandoned:0};return s.set(e,h),h};for(const l of x){const u=C.get(l.waiterId),e=C.get(l.workerId);if(!u||!e||u.lane>=e.lane)continue;const h=c(l.waiterId,e.lane);h.tasks+=1,l.abandoned&&(h.abandoned+=1)}for(const l of p){const u=C.get(l.from),e=C.get(l.to);!u||!e||u.lane>=e.lane||(c(l.from,e.lane).count+=l.count)}for(const[l,u]of s){const e=C.get(u.from);if(!e)continue;const h=j.filter(G=>G.lane===u.lane);if(h.length===0)continue;const y=Math.min(...h.map(G=>G.x))-14,S=Math.min(...h.map(G=>G.y))+r.nodeH/2,R=Math.max(...h.map(G=>G.y))+r.nodeH/2,L=e.x+e.w,Y=e.y+e.h/2,B=(S+R)/2,V=Math.max(28,(y-L)/2);T.push({key:l,from:u.from,lane:u.lane,count:u.count,tasks:u.tasks,abandoned:u.abandoned,d:`M ${L} ${Y} C ${L+V} ${Y}, ${y-V} ${B}, ${y} ${B}`,label:{x:L+9,y:Y-7+(u.lane-e.lane-1)*12},bar:{x:y,y1:S,y2:R}})}}return{nodes:j,modelsKnown:j.filter(s=>s.model).length,disputedCount:j.filter(s=>s.disputed).length,edges:O,trunks:T,lanes:[...Array(v+1).keys()].map(s=>({index:s,label:ne(s,v),x:H.get(s)??r.padX,count:($.get(s)??[]).length})),width:K,height:N}}function oe(t,x,p){if(t.length===0)return null;const w=t.find(o=>o.id===x);if(!w)return t.reduce((o,m)=>m.x<o.x||m.x===o.x&&m.y<o.y?m:o).id;const r=o=>`${o.lane}:${o.col}`,f=t.filter(o=>r(o)===r(w)).sort((o,m)=>o.y-m.y);if(p==="first")return f[0]?.id??null;if(p==="last")return f[f.length-1]?.id??null;if(p==="up"||p==="down"){const o=f.findIndex(m=>m.id===w.id);return f[o+(p==="down"?1:-1)]?.id??null}const g=new Map;for(const o of t){const m=r(o),n=g.get(m);n?(n.nodes.push(o),n.x=Math.min(n.x,o.x)):g.set(m,{x:o.x,nodes:[o]})}const i=[...g.values()].sort((o,m)=>o.x-m.x),d=i.findIndex(o=>o.nodes.some(m=>m.id===w.id)),b=i[d+(p==="right"?1:-1)];return b?b.nodes.reduce((o,m)=>Math.abs(m.y-w.y)<Math.abs(o.y-w.y)?m:o).id:null}const re=[{id:"shelf",label:"Shelf",hint:"Wrap the last lane into as many columns as fit, and bundle its edges"},{id:"ladder",label:"Ladder",hint:"One card per row, every edge drawn on its own"}],ce=[{id:"duration",label:"Longest first"},{id:"outcome",label:"Never came back"},{id:"volume",label:"Most said"},{id:"name",label:"By name"}];function ie(t){return(t.includes("/")?t.slice(t.lastIndexOf("/")+1):t).replace(/^(claude|openai|anthropic)-/i,"")}function F(t){return t.model?.trim()?ie(t.model.trim()):t.harness?.trim()||null}function z(t,x){return t.length<=x?t:`${t.slice(0,x-1).trimEnd()}…`}const de={ArrowUp:"up",ArrowDown:"down",ArrowLeft:"left",ArrowRight:"right",Home:"first",End:"last"};function le({node:t,dim:x,on:p,cursor:w,bind:r,onHover:f,onOpen:g,onNav:i,onFocus:d}){const b=_(g),o=F(t),m=`${t.sent+t.received} msgs`,n=t.asked>0?`${t.asked} handed out`:t.ms>0?q(t.ms):null,v=n?`${n} · ${m}`:m,M=o?n??m:v,$=t.disputed?`${t.short} — ${v} — attribution disputed`:`${t.short} — ${v}`;return a.jsxs("g",{className:["cvs-node",t.asked>0?"cvs-node--hub":"",x?"cvs-node--dim":"",p?"cvs-node--on":"",t.disputed?"cvs-node--disputed":""].filter(Boolean).join(" "),transform:`translate(${t.x} ${t.y})`,onMouseEnter:()=>f(t.id),onMouseLeave:()=>f(null),"aria-label":$,"aria-current":p?"true":void 0,ref:r,...b,tabIndex:w?0:-1,onFocus:d,onKeyDown:E=>{const A=de[E.key];if(!A){b.onKeyDown(E);return}E.preventDefault(),i(A)},children:[a.jsx("title",{children:t.disputed?`${t.short} — ${v} — every message under this name is classed as an agent's, so the name is the record's, not a person's`:$}),a.jsx("rect",{className:"cvs-box",x:0,y:0,width:t.w,height:t.h,rx:5}),t.abandoned>0?a.jsx("rect",{className:"cvs-late-mark",x:0,y:0,width:2,height:t.h}):null,a.jsx("text",{className:"cvs-name",x:11,y:17,children:z(t.short,24)}),a.jsx("text",{className:"cvs-meta",x:11,y:31,children:z(M,o?17:30)}),o?a.jsx("text",{className:"cvs-meta cvs-ran",x:t.w-11,y:31,textAnchor:"end",children:z(o,11)}):null,t.inferred?a.jsx("circle",{className:"cvs-inferred",cx:t.w-10,cy:11,r:2.5}):null]})}function fe({passes:t,flights:x,identities:p,rootId:w,focus:r,selectedId:f,onOpen:g}){const[i,d]=I.useState(null),[b,o]=I.useState(null),m=I.useRef(new Map),[n,v]=I.useState("shelf"),[M,$]=I.useState(!1),[E,A]=I.useState("duration"),H=I.useRef(null),[W,K]=I.useState(0);I.useEffect(()=>{const e=H.current;if(!e||typeof ResizeObserver>"u")return;const h=new ResizeObserver(([y])=>K(y?.contentRect.height??0));return h.observe(e),()=>h.disconnect()},[]);const j=I.useMemo(()=>ee(t,x,p),[t,x,p]),C=I.useMemo(()=>w?se(j.actors,j.tasks,j.pairs,w):null,[j,w]),D=C?.setAside??0,N=I.useMemo(()=>C&&!M?{...j,...C}:j,[j,C,M]),k=I.useMemo(()=>{const e=U,h=W>0?Math.max(2,Math.floor((W-e.padY*2+e.rowGap)/(e.nodeH+e.rowGap))):void 0;return ae(N.actors,N.tasks,N.pairs,{mode:n,order:E,shelfRows:h})},[N,n,E,W]);if(k.nodes.length===0)return a.jsx("p",{className:"cf-graph-empty",children:"Nothing has been exchanged in this window yet."});const P=e=>r?r.has(e):!1,O=e=>i!==null?i===e:r?r.has(e):!0,T=(e,h)=>i!==null?i===e||i===h:r?r.has(e)&&r.has(h):!0,X=e=>f===Q(e),s=(e,h)=>{const y=oe(k.nodes,e,h);if(!y||y===e)return;o(y);const S=m.current.get(y);S?.focus(),S?.scrollIntoView({block:"nearest",inline:"nearest"})},c=k.nodes.some(e=>e.id===b)?b:k.nodes[0]?.id??null,l=k.nodes.length-k.modelsKnown,u=N.tasks.filter(e=>e.abandoned).length;return a.jsxs("div",{className:"cvs",children:[a.jsxs("div",{className:"cvs-controls",children:[a.jsx("span",{className:"cvs-ctl-label",children:"Layout"}),a.jsx("div",{className:"cvs-seg",role:"group","aria-label":"Layout",children:re.map(e=>a.jsx("button",{type:"button",className:`cvs-seg-btn${n===e.id?" is-active":""}`,onClick:()=>v(e.id),"aria-pressed":n===e.id,title:e.hint,children:e.label},e.id))}),D>0?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"cvs-ctl-label",children:"Show"}),a.jsxs("div",{className:"cvs-seg",role:"group","aria-label":"Scope",children:[a.jsx("button",{type:"button",className:`cvs-seg-btn${M?"":" is-active"}`,onClick:()=>$(!1),"aria-pressed":!M,title:"Who asked this agent, and everyone it asked, all the way down",children:"This branch"}),a.jsx("button",{type:"button",className:`cvs-seg-btn${M?" is-active":""}`,onClick:()=>$(!0),"aria-pressed":M,title:"Every participant in this agent's window, whoever they were working for",children:"Everything"})]})]}):null,a.jsx("span",{className:"cvs-ctl-label",children:"Down the lane"}),a.jsx("div",{className:"cvs-seg",role:"group","aria-label":"Order",children:ce.map(e=>a.jsx("button",{type:"button",className:`cvs-seg-btn${E===e.id?" is-active":""}`,onClick:()=>A(e.id),"aria-pressed":E===e.id,children:e.label},e.id))}),g?a.jsx("p",{className:"cvs-hint",children:"Click to select · arrows to move · Esc to clear"}):null]}),a.jsx("div",{className:"cvs-stage",ref:H,children:a.jsxs("svg",{className:"cvs-svg",width:k.width,height:k.height,viewBox:`0 0 ${k.width} ${k.height}`,role:"img","aria-label":"Who asked whom, laid out from who opened the work to who did it",children:[k.lanes.map(e=>a.jsxs("g",{children:[a.jsx("text",{className:"cvs-lane-label",x:e.x,y:20,children:e.label.toUpperCase()}),a.jsx("text",{className:"cvs-lane-count",x:e.x,y:34,children:e.count})]},e.index)),k.edges.map(e=>a.jsxs("g",{className:`cvs-edge${T(e.from,e.to)?"":" cvs-edge--dim"}`,children:[a.jsx("path",{className:"cvs-edge-line",d:e.d,strokeWidth:e.weight}),a.jsx("path",{className:"cvs-edge-tip",d:"M 0 0 L -7 -3.2 L -7 3.2 Z",transform:`translate(${e.tip.x} ${e.tip.y}) rotate(${e.tip.angle})`}),e.abandoned>0?a.jsx("path",{className:"cvs-edge-late",d:e.d,strokeWidth:e.weight}):null,g?a.jsx("path",{className:"cvs-edge-hit",d:e.d,"aria-label":`${e.count} message${e.count===1?"":"s"} — open`,..._(()=>g({kind:"pair",from:e.from,to:e.to})),children:a.jsx("title",{children:`${e.count} message${e.count===1?"":"s"} — open`})}):null]},e.key)),k.trunks.map(e=>a.jsxs("g",{className:`cvs-trunk${O(e.from)?"":" cvs-edge--dim"}`,children:[a.jsxs("title",{children:[`${e.tasks} ask${e.tasks===1?"":"s"} · ${e.count} message${e.count===1?"":"s"}`,e.abandoned>0?` · ${e.abandoned} never came back`:""]}),a.jsx("path",{className:"cvs-edge-line",d:e.d,strokeWidth:2}),e.abandoned>0?a.jsx("path",{className:"cvs-edge-late",d:e.d,strokeWidth:2}):null,a.jsx("path",{className:"cvs-bracket",d:`M ${e.bar.x} ${e.bar.y1} L ${e.bar.x} ${e.bar.y2}`}),a.jsxs("text",{className:"cvs-trunk-label",x:e.label.x,y:e.label.y,children:[e.tasks," ask",e.tasks===1?"":"s"]})]},e.key)),k.nodes.map(e=>a.jsx(le,{node:e,dim:!O(e.id),on:P(e.id),cursor:e.id===c,bind:h=>{h?m.current.set(e.id,h):m.current.delete(e.id)},onHover:d,onOpen:()=>g?.({kind:"actor",actorId:e.id}),onNav:h=>s(e.id,h),onFocus:()=>o(e.id)},e.id))]})}),a.jsxs("div",{className:"cf-legend",children:[a.jsxs("span",{children:[a.jsx("i",{className:"cf-swatch"})," exchange, thicker with volume"]}),u>0&&a.jsxs("span",{children:[a.jsx("i",{className:"cf-swatch cf-swatch--late"})," ",u," ask",u===1?"":"s"," never came back"]}),N.broadcasts>0&&a.jsxs("span",{className:"cf-dim",children:[N.broadcasts," to the whole conversation, which is not a pair"]}),!M&&D>0&&a.jsxs("span",{className:"cf-dim",children:[D," more in this window, on work this agent is not part of"]}),k.disputedCount>0&&a.jsxs("span",{className:"cf-dim",children:[N.misattributed," message",N.misattributed===1?"":"s"," name an operator but are recorded as an agent’s — drawn with a dashed edge, because the name is the record’s and not a person’s"]}),a.jsx("span",{className:"cf-dim",children:l===0?`all ${k.nodes.length} name a model`:`${k.modelsKnown} of ${k.nodes.length} name a model; the rest show the harness that ran them`})]}),N.tasks.length>0&&a.jsx("ol",{className:"cvs-tasks",children:N.tasks.map(e=>{const h={kind:"task",askId:e.id},y=k.nodes.find(S=>S.id===e.workerId);return a.jsx("li",{children:a.jsxs("button",{type:"button",className:`cvs-task${X(h)?" cvs-task--on":""}`,...J(()=>g?.(h)),"aria-current":X(h)?"true":void 0,title:e.title,onMouseEnter:()=>d(e.workerId),onMouseLeave:()=>d(null),children:[a.jsx("span",{className:"cvs-task-title",children:e.title}),a.jsxs("span",{className:"cvs-task-who",children:[k.nodes.find(S=>S.id===e.waiterId)?.short??e.waiterId,a.jsx("i",{className:"cvs-arrow",children:"→"}),y?.short??e.workerId,y&&F(y)?a.jsx("i",{className:"cvs-task-ran",children:F(y)}):null]}),a.jsx("span",{className:`cvs-task-ms${e.abandoned?" cvs-task-ms--late":""}`,children:q(e.ms)})]})},e.id)})})]})}export{fe as CommsCanvas};
1
+ import{r as I,j as a}from"./index-BFbLvCJn.js";import{a as Z,h as _,d as q,p as J}from"./comms-gesture-_aGFo6g3.js";import{f as Q}from"./comms-deck-CBhsXnY-.js";const U={nodeW:178,nodeH:42,rowGap:9,laneGap:124,padX:26,padY:46,shelfRows:9,colGap:20};function ee(t,x,p=new Map){const w=new Map,r=new Map;let f=0;const g=new Map,i=n=>{w.has(n.id)||w.set(n.id,n)};for(const n of t){if(i(n.from),n.from.kind==="operator"){const v=g.get(n.from.id)??{own:0,agent:0};n.message.class==="agent"?v.agent+=n.count:v.own+=n.count,g.set(n.from.id,v)}if(n.kind==="channel"){f+=n.count;for(const v of n.audience)i(v);continue}for(const v of n.audience){if(i(v),v.id===n.from.id)continue;const M=`${n.from.id}->${v.id}`,$=r.get(M);$?$.count+=n.count:r.set(M,{from:n.from.id,to:v.id,count:n.count})}}const d=new Set([...g].filter(([,n])=>n.own===0&&n.agent>0).map(([n])=>n)),b=[...g].filter(([n])=>d.has(n)).reduce((n,[,v])=>n+v.agent,0),o=[...w.values()].map(n=>({id:n.id,short:n.short,kind:n.kind,model:p.get(n.id)?.model??null,harness:p.get(n.id)?.harness??null,disputed:d.has(n.id)})),m=Z(t,x).map(n=>({id:n.id,title:n.title,ms:n.ms,abandoned:n.abandoned,waiterId:n.waiter.id,workerId:n.worker.id}));return{actors:o,tasks:m,pairs:[...r.values()],broadcasts:f,misattributed:b}}function se(t,x,p,w){const r=new Set([w]),f=new Map,g=new Map;for(const i of x)(f.get(i.waiterId)??f.set(i.waiterId,[]).get(i.waiterId)).push(i.workerId),(g.get(i.workerId)??g.set(i.workerId,[]).get(i.workerId)).push(i.waiterId);for(const i of[f,g]){const d=[w];for(let b=0;b<d.length;b+=1)for(const o of i.get(d[b])??[])r.has(o)||(r.add(o),d.push(o))}return r.size<2?{actors:[...t],tasks:[...x],pairs:[...p],setAside:0}:{actors:t.filter(i=>r.has(i.id)),tasks:x.filter(i=>r.has(i.waiterId)&&r.has(i.workerId)),pairs:p.filter(i=>r.has(i.from)&&r.has(i.to)),setAside:t.length-r.size}}function te(t,x){const p=new Map,w=new Map,r=new Map(t.map(d=>[d,0]));for(const d of x)d.from!==d.to&&((p.get(d.from)??p.set(d.from,[]).get(d.from)).push(d.to),(w.get(d.to)??w.set(d.to,[]).get(d.to)).push(d.from),r.set(d.to,(r.get(d.to)??0)+1));const f=new Map,g=t.filter(d=>(r.get(d)??0)===0);for(const d of g)f.set(d,0);const i=new Map(r);for(let d=0;d<g.length;d+=1){const b=g[d];for(const o of p.get(b)??[]){f.set(o,Math.max(f.get(o)??0,(f.get(b)??0)+1));const m=(i.get(o)??0)-1;i.set(o,m),m===0&&g.push(o)}}for(const d of t){if(f.has(d))continue;const b=(w.get(d)??[]).map(o=>f.get(o)).filter(o=>o!==void 0);f.set(d,b.length>0?Math.max(...b)+1:0)}return f}function ne(t,x){return x===0?"In this window":t===0?"Opened the work":t===x?"Did the work":"Passed it on"}function ae(t,x,p,w){const r=U,f=new Map(t.map(s=>[s.id,s])),g=new Map,i=s=>{let c=g.get(s);return c||(c={asked:0,did:0,ms:0,abandoned:0,sent:0,received:0},g.set(s,c)),c};for(const s of t)i(s.id);for(const s of x){i(s.waiterId).asked+=1;const c=i(s.workerId);c.did+=1,c.ms=Math.max(c.ms,s.ms),s.abandoned&&(c.abandoned+=1)}for(const s of p)i(s.from).sent+=s.count,i(s.to).received+=s.count;const d=x.map(s=>({from:s.waiterId,to:s.workerId})),b=t.map(s=>s.id),o=te(b,d),m=new Set;for(const s of d)m.add(s.from),m.add(s.to);const n=new Map;for(const s of p)for(const[c,l]of[[s.from,s.to],[s.to,s.from]]){const u=n.get(c);(!u||s.count>u.count)&&n.set(c,{id:l,count:s.count})}for(const s of b){if(m.has(s))continue;const c=n.get(s);o.set(s,c&&m.has(c.id)?(o.get(c.id)??0)+1:o.get(s)??0)}const v=Math.max(0,...b.map(s=>o.get(s)??0)),M=s=>{const c=i(s);switch(w.order){case"duration":return-c.ms;case"outcome":return-(c.abandoned*1e12+c.ms);case"volume":return-(c.sent+c.received);case"name":return 0}},$=new Map;for(const s of b){const c=o.get(s)??0;($.get(c)??$.set(c,[]).get(c)).push(s)}for(const[,s]of $)s.sort((c,l)=>{const u=M(c)-M(l);return u!==0?u:(f.get(c)?.short??c).localeCompare(f.get(l)?.short??l)});const E=w.mode==="shelf"?Math.max(2,w.shelfRows??r.shelfRows):Number.POSITIVE_INFINITY,A=new Map,H=new Map;let W=r.padX;for(let s=0;s<=v;s+=1){const c=$.get(s)??[],l=Math.max(1,Math.ceil(c.length/E));A.set(s,l),H.set(s,W),W+=l*r.nodeW+(l-1)*r.colGap+r.laneGap}const K=Math.max(W-r.laneGap+r.padX,640),j=[];for(let s=0;s<=v;s+=1){const c=$.get(s)??[],l=A.get(s)??1,u=Math.ceil(c.length/l);c.forEach((e,h)=>{const y=l===1?0:Math.floor(h/u),S=l===1?h:h%u,R=i(e),L=f.get(e);j.push({id:e,short:L?.short??e,kind:L?.kind??"agent",lane:s,col:y,x:(H.get(s)??r.padX)+y*(r.nodeW+r.colGap),y:r.padY+S*(r.nodeH+r.rowGap),w:r.nodeW,h:r.nodeH,asked:R.asked,did:R.did,ms:R.ms,abandoned:R.abandoned,sent:R.sent,received:R.received,model:L?.model??null,harness:L?.harness??null,disputed:L?.disputed??!1,inferred:!m.has(e)})})}const C=new Map(j.map(s=>[s.id,s])),D=Math.max(1,...[...$.entries()].map(([s,c])=>Math.ceil(c.length/(A.get(s)??1)))),N=r.padY*2+D*r.nodeH+(D-1)*r.rowGap,k=new Map;for(const s of x){const c=`${s.waiterId}>${s.workerId}`,l=k.get(c)??{tasks:0,abandoned:0};l.tasks+=1,s.abandoned&&(l.abandoned+=1),k.set(c,l)}const P=Math.max(1,...p.map(s=>s.count)),O=[],T=[],X=(s,c)=>{const l=s.x+s.w,u=s.y+s.h/2,e=c.x,h=c.y+c.h/2,y=Math.max(28,(e-l)/2);return{d:`M ${l} ${u} C ${l+y} ${u}, ${e-y} ${h}, ${e} ${h}`,tip:{x:e,y:h,angle:0}}};if(w.mode==="ladder")for(const s of p){const c=C.get(s.from),l=C.get(s.to);if(!c||!l||c.lane>=l.lane)continue;const u=k.get(`${s.from}>${s.to}`),{d:e,tip:h}=X(c,l);O.push({key:`${s.from}>${s.to}`,from:s.from,to:s.to,count:s.count,tasks:u?.tasks??0,abandoned:u?.abandoned??0,weight:1+Math.round(s.count/P*3),d:e,tip:h})}else{const s=new Map,c=(l,u)=>{const e=`${l}>L${u}`,h=s.get(e)??{from:l,lane:u,count:0,tasks:0,abandoned:0};return s.set(e,h),h};for(const l of x){const u=C.get(l.waiterId),e=C.get(l.workerId);if(!u||!e||u.lane>=e.lane)continue;const h=c(l.waiterId,e.lane);h.tasks+=1,l.abandoned&&(h.abandoned+=1)}for(const l of p){const u=C.get(l.from),e=C.get(l.to);!u||!e||u.lane>=e.lane||(c(l.from,e.lane).count+=l.count)}for(const[l,u]of s){const e=C.get(u.from);if(!e)continue;const h=j.filter(G=>G.lane===u.lane);if(h.length===0)continue;const y=Math.min(...h.map(G=>G.x))-14,S=Math.min(...h.map(G=>G.y))+r.nodeH/2,R=Math.max(...h.map(G=>G.y))+r.nodeH/2,L=e.x+e.w,Y=e.y+e.h/2,B=(S+R)/2,V=Math.max(28,(y-L)/2);T.push({key:l,from:u.from,lane:u.lane,count:u.count,tasks:u.tasks,abandoned:u.abandoned,d:`M ${L} ${Y} C ${L+V} ${Y}, ${y-V} ${B}, ${y} ${B}`,label:{x:L+9,y:Y-7+(u.lane-e.lane-1)*12},bar:{x:y,y1:S,y2:R}})}}return{nodes:j,modelsKnown:j.filter(s=>s.model).length,disputedCount:j.filter(s=>s.disputed).length,edges:O,trunks:T,lanes:[...Array(v+1).keys()].map(s=>({index:s,label:ne(s,v),x:H.get(s)??r.padX,count:($.get(s)??[]).length})),width:K,height:N}}function oe(t,x,p){if(t.length===0)return null;const w=t.find(o=>o.id===x);if(!w)return t.reduce((o,m)=>m.x<o.x||m.x===o.x&&m.y<o.y?m:o).id;const r=o=>`${o.lane}:${o.col}`,f=t.filter(o=>r(o)===r(w)).sort((o,m)=>o.y-m.y);if(p==="first")return f[0]?.id??null;if(p==="last")return f[f.length-1]?.id??null;if(p==="up"||p==="down"){const o=f.findIndex(m=>m.id===w.id);return f[o+(p==="down"?1:-1)]?.id??null}const g=new Map;for(const o of t){const m=r(o),n=g.get(m);n?(n.nodes.push(o),n.x=Math.min(n.x,o.x)):g.set(m,{x:o.x,nodes:[o]})}const i=[...g.values()].sort((o,m)=>o.x-m.x),d=i.findIndex(o=>o.nodes.some(m=>m.id===w.id)),b=i[d+(p==="right"?1:-1)];return b?b.nodes.reduce((o,m)=>Math.abs(m.y-w.y)<Math.abs(o.y-w.y)?m:o).id:null}const re=[{id:"shelf",label:"Shelf",hint:"Wrap the last lane into as many columns as fit, and bundle its edges"},{id:"ladder",label:"Ladder",hint:"One card per row, every edge drawn on its own"}],ce=[{id:"duration",label:"Longest first"},{id:"outcome",label:"Never came back"},{id:"volume",label:"Most said"},{id:"name",label:"By name"}];function ie(t){return(t.includes("/")?t.slice(t.lastIndexOf("/")+1):t).replace(/^(claude|openai|anthropic)-/i,"")}function F(t){return t.model?.trim()?ie(t.model.trim()):t.harness?.trim()||null}function z(t,x){return t.length<=x?t:`${t.slice(0,x-1).trimEnd()}…`}const de={ArrowUp:"up",ArrowDown:"down",ArrowLeft:"left",ArrowRight:"right",Home:"first",End:"last"};function le({node:t,dim:x,on:p,cursor:w,bind:r,onHover:f,onOpen:g,onNav:i,onFocus:d}){const b=_(g),o=F(t),m=`${t.sent+t.received} msgs`,n=t.asked>0?`${t.asked} handed out`:t.ms>0?q(t.ms):null,v=n?`${n} · ${m}`:m,M=o?n??m:v,$=t.disputed?`${t.short} — ${v} — attribution disputed`:`${t.short} — ${v}`;return a.jsxs("g",{className:["cvs-node",t.asked>0?"cvs-node--hub":"",x?"cvs-node--dim":"",p?"cvs-node--on":"",t.disputed?"cvs-node--disputed":""].filter(Boolean).join(" "),transform:`translate(${t.x} ${t.y})`,onMouseEnter:()=>f(t.id),onMouseLeave:()=>f(null),"aria-label":$,"aria-current":p?"true":void 0,ref:r,...b,tabIndex:w?0:-1,onFocus:d,onKeyDown:E=>{const A=de[E.key];if(!A){b.onKeyDown(E);return}E.preventDefault(),i(A)},children:[a.jsx("title",{children:t.disputed?`${t.short} — ${v} — every message under this name is classed as an agent's, so the name is the record's, not a person's`:$}),a.jsx("rect",{className:"cvs-box",x:0,y:0,width:t.w,height:t.h,rx:5}),t.abandoned>0?a.jsx("rect",{className:"cvs-late-mark",x:0,y:0,width:2,height:t.h}):null,a.jsx("text",{className:"cvs-name",x:11,y:17,children:z(t.short,24)}),a.jsx("text",{className:"cvs-meta",x:11,y:31,children:z(M,o?17:30)}),o?a.jsx("text",{className:"cvs-meta cvs-ran",x:t.w-11,y:31,textAnchor:"end",children:z(o,11)}):null,t.inferred?a.jsx("circle",{className:"cvs-inferred",cx:t.w-10,cy:11,r:2.5}):null]})}function fe({passes:t,flights:x,identities:p,rootId:w,focus:r,selectedId:f,onOpen:g}){const[i,d]=I.useState(null),[b,o]=I.useState(null),m=I.useRef(new Map),[n,v]=I.useState("shelf"),[M,$]=I.useState(!1),[E,A]=I.useState("duration"),H=I.useRef(null),[W,K]=I.useState(0);I.useEffect(()=>{const e=H.current;if(!e||typeof ResizeObserver>"u")return;const h=new ResizeObserver(([y])=>K(y?.contentRect.height??0));return h.observe(e),()=>h.disconnect()},[]);const j=I.useMemo(()=>ee(t,x,p),[t,x,p]),C=I.useMemo(()=>w?se(j.actors,j.tasks,j.pairs,w):null,[j,w]),D=C?.setAside??0,N=I.useMemo(()=>C&&!M?{...j,...C}:j,[j,C,M]),k=I.useMemo(()=>{const e=U,h=W>0?Math.max(2,Math.floor((W-e.padY*2+e.rowGap)/(e.nodeH+e.rowGap))):void 0;return ae(N.actors,N.tasks,N.pairs,{mode:n,order:E,shelfRows:h})},[N,n,E,W]);if(k.nodes.length===0)return a.jsx("p",{className:"cf-graph-empty",children:"Nothing has been exchanged in this window yet."});const P=e=>r?r.has(e):!1,O=e=>i!==null?i===e:r?r.has(e):!0,T=(e,h)=>i!==null?i===e||i===h:r?r.has(e)&&r.has(h):!0,X=e=>f===Q(e),s=(e,h)=>{const y=oe(k.nodes,e,h);if(!y||y===e)return;o(y);const S=m.current.get(y);S?.focus(),S?.scrollIntoView({block:"nearest",inline:"nearest"})},c=k.nodes.some(e=>e.id===b)?b:k.nodes[0]?.id??null,l=k.nodes.length-k.modelsKnown,u=N.tasks.filter(e=>e.abandoned).length;return a.jsxs("div",{className:"cvs",children:[a.jsxs("div",{className:"cvs-controls",children:[a.jsx("span",{className:"cvs-ctl-label",children:"Layout"}),a.jsx("div",{className:"cvs-seg",role:"group","aria-label":"Layout",children:re.map(e=>a.jsx("button",{type:"button",className:`cvs-seg-btn${n===e.id?" is-active":""}`,onClick:()=>v(e.id),"aria-pressed":n===e.id,title:e.hint,children:e.label},e.id))}),D>0?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"cvs-ctl-label",children:"Show"}),a.jsxs("div",{className:"cvs-seg",role:"group","aria-label":"Scope",children:[a.jsx("button",{type:"button",className:`cvs-seg-btn${M?"":" is-active"}`,onClick:()=>$(!1),"aria-pressed":!M,title:"Who asked this agent, and everyone it asked, all the way down",children:"This branch"}),a.jsx("button",{type:"button",className:`cvs-seg-btn${M?" is-active":""}`,onClick:()=>$(!0),"aria-pressed":M,title:"Every participant in this agent's window, whoever they were working for",children:"Everything"})]})]}):null,a.jsx("span",{className:"cvs-ctl-label",children:"Down the lane"}),a.jsx("div",{className:"cvs-seg",role:"group","aria-label":"Order",children:ce.map(e=>a.jsx("button",{type:"button",className:`cvs-seg-btn${E===e.id?" is-active":""}`,onClick:()=>A(e.id),"aria-pressed":E===e.id,children:e.label},e.id))}),g?a.jsx("p",{className:"cvs-hint",children:"Click to select · arrows to move · Esc to clear"}):null]}),a.jsx("div",{className:"cvs-stage",ref:H,children:a.jsxs("svg",{className:"cvs-svg",width:k.width,height:k.height,viewBox:`0 0 ${k.width} ${k.height}`,role:"img","aria-label":"Who asked whom, laid out from who opened the work to who did it",children:[k.lanes.map(e=>a.jsxs("g",{children:[a.jsx("text",{className:"cvs-lane-label",x:e.x,y:20,children:e.label.toUpperCase()}),a.jsx("text",{className:"cvs-lane-count",x:e.x,y:34,children:e.count})]},e.index)),k.edges.map(e=>a.jsxs("g",{className:`cvs-edge${T(e.from,e.to)?"":" cvs-edge--dim"}`,children:[a.jsx("path",{className:"cvs-edge-line",d:e.d,strokeWidth:e.weight}),a.jsx("path",{className:"cvs-edge-tip",d:"M 0 0 L -7 -3.2 L -7 3.2 Z",transform:`translate(${e.tip.x} ${e.tip.y}) rotate(${e.tip.angle})`}),e.abandoned>0?a.jsx("path",{className:"cvs-edge-late",d:e.d,strokeWidth:e.weight}):null,g?a.jsx("path",{className:"cvs-edge-hit",d:e.d,"aria-label":`${e.count} message${e.count===1?"":"s"} — open`,..._(()=>g({kind:"pair",from:e.from,to:e.to})),children:a.jsx("title",{children:`${e.count} message${e.count===1?"":"s"} — open`})}):null]},e.key)),k.trunks.map(e=>a.jsxs("g",{className:`cvs-trunk${O(e.from)?"":" cvs-edge--dim"}`,children:[a.jsxs("title",{children:[`${e.tasks} ask${e.tasks===1?"":"s"} · ${e.count} message${e.count===1?"":"s"}`,e.abandoned>0?` · ${e.abandoned} never came back`:""]}),a.jsx("path",{className:"cvs-edge-line",d:e.d,strokeWidth:2}),e.abandoned>0?a.jsx("path",{className:"cvs-edge-late",d:e.d,strokeWidth:2}):null,a.jsx("path",{className:"cvs-bracket",d:`M ${e.bar.x} ${e.bar.y1} L ${e.bar.x} ${e.bar.y2}`}),a.jsxs("text",{className:"cvs-trunk-label",x:e.label.x,y:e.label.y,children:[e.tasks," ask",e.tasks===1?"":"s"]})]},e.key)),k.nodes.map(e=>a.jsx(le,{node:e,dim:!O(e.id),on:P(e.id),cursor:e.id===c,bind:h=>{h?m.current.set(e.id,h):m.current.delete(e.id)},onHover:d,onOpen:()=>g?.({kind:"actor",actorId:e.id}),onNav:h=>s(e.id,h),onFocus:()=>o(e.id)},e.id))]})}),a.jsxs("div",{className:"cf-legend",children:[a.jsxs("span",{children:[a.jsx("i",{className:"cf-swatch"})," exchange, thicker with volume"]}),u>0&&a.jsxs("span",{children:[a.jsx("i",{className:"cf-swatch cf-swatch--late"})," ",u," ask",u===1?"":"s"," never came back"]}),N.broadcasts>0&&a.jsxs("span",{className:"cf-dim",children:[N.broadcasts," to the whole conversation, which is not a pair"]}),!M&&D>0&&a.jsxs("span",{className:"cf-dim",children:[D," more in this window, on work this agent is not part of"]}),k.disputedCount>0&&a.jsxs("span",{className:"cf-dim",children:[N.misattributed," message",N.misattributed===1?"":"s"," name an operator but are recorded as an agent’s — drawn with a dashed edge, because the name is the record’s and not a person’s"]}),a.jsx("span",{className:"cf-dim",children:l===0?`all ${k.nodes.length} name a model`:`${k.modelsKnown} of ${k.nodes.length} name a model; the rest show the harness that ran them`})]}),N.tasks.length>0&&a.jsx("ol",{className:"cvs-tasks",children:N.tasks.map(e=>{const h={kind:"task",askId:e.id},y=k.nodes.find(S=>S.id===e.workerId);return a.jsx("li",{children:a.jsxs("button",{type:"button",className:`cvs-task${X(h)?" cvs-task--on":""}`,...J(()=>g?.(h)),"aria-current":X(h)?"true":void 0,title:e.title,onMouseEnter:()=>d(e.workerId),onMouseLeave:()=>d(null),children:[a.jsx("span",{className:"cvs-task-title",children:e.title}),a.jsxs("span",{className:"cvs-task-who",children:[k.nodes.find(S=>S.id===e.waiterId)?.short??e.waiterId,a.jsx("i",{className:"cvs-arrow",children:"→"}),y?.short??e.workerId,y&&F(y)?a.jsx("i",{className:"cvs-task-ran",children:F(y)}):null]}),a.jsx("span",{className:`cvs-task-ms${e.abandoned?" cvs-task-ms--late":""}`,children:q(e.ms)})]})},e.id)})})]})}export{fe as CommsCanvas};