@openscout/scout 0.2.78 → 0.2.79

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 (391) hide show
  1. package/README.md +19 -0
  2. package/bin/scoutd +0 -0
  3. package/dist/build-manifest.json +3 -3
  4. package/dist/client/assets/ActivityScreen-DnqqRSlS.js +1 -0
  5. package/dist/client/assets/{AddProjectForm-DMnobKch.js → AddProjectForm-BoVtelSP.js} +1 -1
  6. package/dist/client/assets/{AgentAvatar-D90c1Rzk.js → AgentAvatar-CufDA4A-.js} +1 -1
  7. package/dist/client/assets/AgentConfigurationScreen-CJqoMA0J.js +1 -0
  8. package/dist/client/assets/AgentDefinitionsWorkspace-FpEkb-tu.js +1 -0
  9. package/dist/client/assets/{AgentDetailCard-BcRBRp88.js → AgentDetailCard-DxxVkgT1.js} +1 -1
  10. package/dist/client/assets/AgentFloorView-CycUn0Lv.js +1 -0
  11. package/dist/client/assets/AgentInfoScreen-CAQAxpAK.js +1 -0
  12. package/dist/client/assets/{AgentLaneCard-RrNnDZu8.js → AgentLaneCard-DTUvE96I.js} +1 -1
  13. package/dist/client/assets/{AgentLaneChrome-D9ZwUKrl.js → AgentLaneChrome-BfVygkgL.js} +1 -1
  14. package/dist/client/assets/{AgentLaneDetailSheet-BXbPls9N.js → AgentLaneDetailSheet-CWs9wKWk.js} +1 -1
  15. package/dist/client/assets/{AgentLaneSummaryResize-BhFmGNzT.js → AgentLaneSummaryResize-CMgzYvAA.js} +1 -1
  16. package/dist/client/assets/AgentLanesEmbedScreen-BUCW4nUj.js +1 -0
  17. package/dist/client/assets/{AgentLanesPreflight-eSAoDsPi.js → AgentLanesPreflight-KWfLcaNB.js} +1 -1
  18. package/dist/client/assets/AgentLanesView-CxfbV8Kd.js +2 -0
  19. package/dist/client/assets/{AgentLiveActions-DBtnD0qE.js → AgentLiveActions-CZdAInEu.js} +1 -1
  20. package/dist/client/assets/{AgentSessions-DyqOf4nG.js → AgentSessions-Bkr0lyry.js} +2 -2
  21. package/dist/client/assets/AgentsConsole-WtFVqaPJ.js +1 -0
  22. package/dist/client/assets/AgentsScreen-BMXvuiA2.js +1 -0
  23. package/dist/client/assets/AgentsSubnav-BTNjPYoA.js +1 -0
  24. package/dist/client/assets/{AtopView-BCkae3e1.js → AtopView-_OKDlZ1h.js} +1 -1
  25. package/dist/client/assets/BackToPicker-CkUmHuuo.js +1 -0
  26. package/dist/client/assets/{BriefingDetailScreen-BwFyysT8.js → BriefingDetailScreen-i54EtZKW.js} +1 -1
  27. package/dist/client/assets/{BriefingsScreen-BQEevztH.js → BriefingsScreen-CBrHojlQ.js} +1 -1
  28. package/dist/client/assets/{BrokerMetadataPanel-7UjcuNjd.js → BrokerMetadataPanel-opTLuZU6.js} +1 -1
  29. package/dist/client/assets/{BrokerScreen-7ekklu88.js → BrokerScreen-CObCQvoy.js} +2 -2
  30. package/dist/client/assets/{ChatCollapsedStrip-CQSYSd8s.js → ChatCollapsedStrip-Dr2vmKXQ.js} +1 -1
  31. package/dist/client/assets/CodeDiffPane-CLOGjwul.js +1 -0
  32. package/dist/client/assets/{CodeProjectPicker-DqKFCpLU.js → CodeProjectPicker-DTV8hR6A.js} +1 -1
  33. package/dist/client/assets/CodeScreen-BXqi72NK.js +1 -0
  34. package/dist/client/assets/{ContextMenu-bARZqTzD.js → ContextMenu-BlBQhpax.js} +1 -1
  35. package/dist/client/assets/{ConversationComposer-Bla3DDvM.js → ConversationComposer-BBNPa5S9.js} +1 -1
  36. package/dist/client/assets/ConversationFeedRows-BuejHMCY.js +1 -0
  37. package/dist/client/assets/ConversationHeader-DXMT-YXv.js +1 -0
  38. package/dist/client/assets/ConversationPanels-DHCtilQF.js +2 -0
  39. package/dist/client/assets/ConversationScreen-DSxIt9pq.css +1 -0
  40. package/dist/client/assets/ConversationScreen-Dz2d_Z_F.js +1 -0
  41. package/dist/client/assets/ConversationStatus-DSgdVofa.js +1 -0
  42. package/dist/client/assets/{DataTable-E8s_MmoA.js → DataTable-0DwuXyvW.js} +1 -1
  43. package/dist/client/assets/{DispatchAftermath-Dpe88DFX.js → DispatchAftermath-BrreQifA.js} +1 -1
  44. package/dist/client/assets/{DocumentFocusViewer-BeVwwl26.js → DocumentFocusViewer-DU_9BHsD.js} +1 -1
  45. package/dist/client/assets/{EmbeddableSurfacesLab-BQqFQVnI.js → EmbeddableSurfacesLab-DdaswbfI.js} +1 -1
  46. package/dist/client/assets/{EmptyState-4F9XDFQm.js → EmptyState-CoL-QuUO.js} +1 -1
  47. package/dist/client/assets/{FileViewerPane-CLgUhSm4.js → FileViewerPane-C9Ly01Ef.js} +1 -1
  48. package/dist/client/assets/{FleetSearch-Dz5euQJe.js → FleetSearch-DlWTLl-v.js} +1 -1
  49. package/dist/client/assets/FlightObserveScreen-C-9S0nA5.js +1 -0
  50. package/dist/client/assets/{FollowScreen-DZ4qfYOY.js → FollowScreen--Q04xSSE.js} +1 -1
  51. package/dist/client/assets/{HarnessMark-Cbv3Ib0c.js → HarnessMark-Dm_qm1Ku.js} +1 -1
  52. package/dist/client/assets/HarnessesScreen-Y54viPX8.js +1 -0
  53. package/dist/client/assets/{HomeHero-B3uYd-pP.js → HomeHero-Cfsow7qL.js} +1 -1
  54. package/dist/client/assets/KnowledgeSearchInspector-DKashKoH.js +1 -0
  55. package/dist/client/assets/KnowledgeSearchScreen-DsdDz8wY.js +1 -0
  56. package/dist/client/assets/{LaneToolHoverCard-Bla0gBdm.js → LaneToolHoverCard-BzehBmdi.js} +1 -1
  57. package/dist/client/assets/LaneTraceDetailSheet-CBf_aNZx.js +1 -0
  58. package/dist/client/assets/{LaneTraceEventFocus-BF9ERP5O.js → LaneTraceEventFocus-DYvHfs_3.js} +1 -1
  59. package/dist/client/assets/{MeshCanvas-DFEPkpqY.js → MeshCanvas-DIjlrMPU.js} +2 -2
  60. package/dist/client/assets/{MeshCanvasMinimap-CyVFYixr.js → MeshCanvasMinimap-DEq-PkF0.js} +1 -1
  61. package/dist/client/assets/MeshScreen-TgDtz-1l.js +1 -0
  62. package/dist/client/assets/{MeshTopologyView-CalkZghg.js → MeshTopologyView-BMHpH5BU.js} +2 -2
  63. package/dist/client/assets/{MessageComposerSuggestions-DpxN9WiB.js → MessageComposerSuggestions-zAUUcLOv.js} +1 -1
  64. package/dist/client/assets/MessagesScreen-BTQL0UcE.js +1 -0
  65. package/dist/client/assets/{MissionControlView-lUeAiSVg.js → MissionControlView-D59SPnAm.js} +1 -1
  66. package/dist/client/assets/{MissionFocusOverlay-wlCmWDCT.js → MissionFocusOverlay-C7cPt6eU.js} +1 -1
  67. package/dist/client/assets/MissionLeftAgentRow-CxlH3dON.js +1 -0
  68. package/dist/client/assets/{MissionLogPane-__MVtEl9.js → MissionLogPane-Ye3YlF9s.js} +1 -1
  69. package/dist/client/assets/{NewAgentModal-Bg-eWHpY.js → NewAgentModal-DprvD4EK.js} +1 -1
  70. package/dist/client/assets/NewChatComposer-B5FnPyzS.js +19 -0
  71. package/dist/client/assets/{NewChatOrigin-Bk2OyVjI.js → NewChatOrigin--pHWUb4V.js} +1 -1
  72. package/dist/client/assets/ObserveEmbedScreen-CfvrnOiZ.js +2 -0
  73. package/dist/client/assets/{ObserveTextFlow-rsFj_rVo.js → ObserveTextFlow-CBitljxi.js} +2 -2
  74. package/dist/client/assets/{ObservedTopologyPanel-DyUeV98H.js → ObservedTopologyPanel-Dv6fbHzW.js} +1 -1
  75. package/dist/client/assets/OpenScoutAppShell-BIp0WitK.js +87 -0
  76. package/dist/client/assets/OpsAgentsView-CoBfAigH.js +1 -0
  77. package/dist/client/assets/OpsScreen-Bbo0W64T.js +1 -0
  78. package/dist/client/assets/OpsSubnav-CoN8utF8.js +1 -0
  79. package/dist/client/assets/{PlanView-C1CjH3PG.js → PlanView-DYtt8H37.js} +1 -1
  80. package/dist/client/assets/ProjectAgentProfile-FiiIcB5R.js +1 -0
  81. package/dist/client/assets/{ProjectAgentProfileBar-CtTpj6fU.js → ProjectAgentProfileBar-B3IvVbqS.js} +1 -1
  82. package/dist/client/assets/ProjectAgentProfileHero-D5E8yvDj.js +1 -0
  83. package/dist/client/assets/ProjectsInbox-BWiXjGi7.js +2 -0
  84. package/dist/client/assets/{ProjectsRail-BgiuV4LR.js → ProjectsRail-DEDS-M1c.js} +1 -1
  85. package/dist/client/assets/ProjectsScreen-Cxk4CuYn.js +1 -0
  86. package/dist/client/assets/ProjectsThreadAside-BF66ugT5.js +1 -0
  87. package/dist/client/assets/Provider-tFc3jqZ4.js +1 -0
  88. package/dist/client/assets/{RailRow-BoGxAHNF.js → RailRow-BTlVAnHS.js} +1 -1
  89. package/dist/client/assets/RawSessionsTable-BsGVgZB3.js +1 -0
  90. package/dist/client/assets/RealtimeVoiceScreen-B0Bem5Rc.js +1 -0
  91. package/dist/client/assets/{RepoDiffEmbedScreen-C0rumUME.js → RepoDiffEmbedScreen-CtTdlQ2A.js} +1 -1
  92. package/dist/client/assets/{RepoDiffPageScreen-DMv6DioL.js → RepoDiffPageScreen-BRvaVYoC.js} +1 -1
  93. package/dist/client/assets/RepoDiffViewer-Bo0gREMj.js +7 -0
  94. package/dist/client/assets/RepoDiffViewerLazy-C8UPk4oo.js +2 -0
  95. package/dist/client/assets/{ReposScreen-CB_YBWYf.js → ReposScreen-BBkJf8xT.js} +2 -2
  96. package/dist/client/assets/{ScoutDeckSurface-CxIYFyWx.js → ScoutDeckSurface-Bi9ov9Bm.js} +1 -1
  97. package/dist/client/assets/{ScoutSurface-CYz_TcWC.js → ScoutSurface-DEQg_7Io.js} +1 -1
  98. package/dist/client/assets/{ScoutbotBroadcastChip-L_R9atj0.js → ScoutbotBroadcastChip-DJXuyn73.js} +1 -1
  99. package/dist/client/assets/{ScoutbotFxLab-CgiZMDMW.js → ScoutbotFxLab-BgsuLDjo.js} +1 -1
  100. package/dist/client/assets/{ScoutbotRealtimeVoiceCall-FMQOr1Np.js → ScoutbotRealtimeVoiceCall-Bzyl0BCS.js} +1 -1
  101. package/dist/client/assets/{SecondaryNav-B3-nh5dM.js → SecondaryNav-Bks0CO2h.js} +1 -1
  102. package/dist/client/assets/SessionEmbedScreen-b0Zgmfx5.js +1 -0
  103. package/dist/client/assets/SessionObserve-CLrHfAKZ.css +1 -0
  104. package/dist/client/assets/SessionObserve-Dlx5vDaV.js +12 -0
  105. package/dist/client/assets/SessionObserveEvidence-ChBD1d4c.js +1 -0
  106. package/dist/client/assets/SessionRefScreen-D7TfPYPN.js +1 -0
  107. package/dist/client/assets/SessionsScreen-BlknOWAd.js +1 -0
  108. package/dist/client/assets/{SettingsDrawer-XfdAa_nD.js → SettingsDrawer-C587L1i1.js} +3 -3
  109. package/dist/client/assets/SettingsDrawer-UX7pFJU_.css +1 -0
  110. package/dist/client/assets/SettingsScreen-BIlYxv_a.js +1 -0
  111. package/dist/client/assets/{ShikiPane-Ap1iPxYb.js → ShikiPane-I_OTW5NO.js} +1 -1
  112. package/dist/client/assets/{SlidePanel-COwtoJqR.js → SlidePanel-FCqT1zO3.js} +1 -1
  113. package/dist/client/assets/SpriteAvatar-CQs-jC-v.js +1 -0
  114. package/dist/client/assets/{StatusPill-DhBL__p8.js → StatusPill-CbABggnQ.js} +1 -1
  115. package/dist/client/assets/{TailView-DGj_5HA9.js → TailView-C_MXVSum.js} +2 -2
  116. package/dist/client/assets/Terminal-DwZyo8kA.js +1 -0
  117. package/dist/client/assets/TerminalEmbedScreen-Czp3tQyd.js +1 -0
  118. package/dist/client/assets/{TextDocumentSurface-BpAw4eQS.js → TextDocumentSurface-C-9EtYqt.js} +1 -1
  119. package/dist/client/assets/{TmuxPeek-m1osv33Q.js → TmuxPeek-Dz1gJ2pU.js} +1 -1
  120. package/dist/client/assets/{VoicePermissionsPanel-DsK53ar4.js → VoicePermissionsPanel-MfICy9kk.js} +1 -1
  121. package/dist/client/assets/{WorkDetailScreen-Bx0JimPC.js → WorkDetailScreen-Cs7kdllj.js} +3 -3
  122. package/dist/client/assets/{WorkFilesViewer-Btl6C2Q1.js → WorkFilesViewer-CF-nhtZ4.js} +1 -1
  123. package/dist/client/assets/{activity-CA8qS6PI.js → activity-WhBf3FXP.js} +1 -1
  124. package/dist/client/assets/{addon-fit-BZ-kXjeN.js → addon-fit-q-x_HytU.js} +1 -1
  125. package/dist/client/assets/{addon-webgl-D9-EQVEK.js → addon-webgl-fhhvEA9h.js} +1 -1
  126. package/dist/client/assets/{agent-essentials-BSY1o46q.js → agent-essentials-DyJiUGpZ.js} +1 -1
  127. package/dist/client/assets/agent-identity-xQHedtLl.js +1 -0
  128. package/dist/client/assets/agent-lane-card-BkWVDYM8.css +1 -0
  129. package/dist/client/assets/{agent-lane-card-model-r2frk57c.js → agent-lane-card-model-BCIwPjEh.js} +1 -1
  130. package/dist/client/assets/{agent-lane-detail-Djm3YJEa.js → agent-lane-detail-Cw4QVAgH.js} +1 -1
  131. package/dist/client/assets/{agent-lane-preview-CmHVe3dU.js → agent-lane-preview-BtnfNyFR.js} +1 -1
  132. package/dist/client/assets/{agent-lanes-model-B4YTt4OF.js → agent-lanes-model-Bl6xfviL.js} +1 -1
  133. package/dist/client/assets/{arc.es-CQBb-dVu.js → arc.es-DPJ0xRV6.js} +1 -1
  134. package/dist/client/assets/{arrow-down-BPLe0am9.js → arrow-down-DsD-dYj-.js} +1 -1
  135. package/dist/client/assets/{arrow-left-DEZzHiPS.js → arrow-left-WjQIN9J6.js} +1 -1
  136. package/dist/client/assets/{arrow-up-right-ClxBnsi7.js → arrow-up-right-CtTDrZJr.js} +1 -1
  137. package/dist/client/assets/{bot-eu8pBNvI.js → bot-B_Uzf4_O.js} +1 -1
  138. package/dist/client/assets/{check-DjgFiBxb.js → check-BbgHJX8u.js} +1 -1
  139. package/dist/client/assets/{chevron-down-BGk5qoEw.js → chevron-down-BFai6ZfE.js} +1 -1
  140. package/dist/client/assets/{chevron-right-XiIHsk4m.js → chevron-right-CyUa1zXx.js} +1 -1
  141. package/dist/client/assets/chunk-HRAB3GC3-CvwpNg-G.js +1 -0
  142. package/dist/client/assets/{chunk-T65CQEWV-CrzwSeEt.js → chunk-T65CQEWV-DI4NKdNq.js} +1 -1
  143. package/dist/client/assets/{chunk-YOZR3KYS-Bet8khjg.js → chunk-YOZR3KYS-BW85tiCr.js} +3 -3
  144. package/dist/client/assets/clock-DviOalxA.js +1 -0
  145. package/dist/client/assets/{code-xml-B6jOCM4V.js → code-xml-05TD3uOC.js} +1 -1
  146. package/dist/client/assets/content-2u_eV3fX.js +1 -0
  147. package/dist/client/assets/content-5irOghrY.js +1 -0
  148. package/dist/client/assets/content-8Z_0CwtD.js +1 -0
  149. package/dist/client/assets/content-B38YRDBu.js +1 -0
  150. package/dist/client/assets/content-BE3uK0LB.js +1 -0
  151. package/dist/client/assets/{content-C2EwTb2y.js → content-BtIxSqVY.js} +1 -1
  152. package/dist/client/assets/content-CFsPAihU.js +1 -0
  153. package/dist/client/assets/content-CKj5g5tu.js +1 -0
  154. package/dist/client/assets/{content-D5kJmfgl.js → content-CLDWXf9Z.js} +1 -1
  155. package/dist/client/assets/content-CRr73E0r.js +1 -0
  156. package/dist/client/assets/content-CVR75_Uj.js +1 -0
  157. package/dist/client/assets/content-Czdp7_JQ.js +1 -0
  158. package/dist/client/assets/content-D0_EJ6nP.js +1 -0
  159. package/dist/client/assets/content-DNmxpNhD.js +1 -0
  160. package/dist/client/assets/content-XpbI9uxd.js +1 -0
  161. package/dist/client/assets/content-cyxWdgKQ.js +1 -0
  162. package/dist/client/assets/{context-budget-CbB4BDcO.js → context-budget-DX_fwUs3.js} +1 -1
  163. package/dist/client/assets/{conversation-icons-IIG5ha6D.js → conversation-icons-DohQL6GI.js} +1 -1
  164. package/dist/client/assets/conversation-model-C4yb6_FA.js +1 -0
  165. package/dist/client/assets/conversation-motion-features-CifSdJtm.js +1 -0
  166. package/dist/client/assets/{copy-CQGYbxdu.js → copy-CwCAivnc.js} +1 -1
  167. package/dist/client/assets/{createLucideIcon-OpA4Amw5.js → createLucideIcon-DlxlBfLC.js} +1 -1
  168. package/dist/client/assets/discover-DoiAJo4Z.js +2 -0
  169. package/dist/client/assets/embed-entry-D1Or9S4d.js +2 -0
  170. package/dist/client/assets/{external-link-CXBytO9o.js → external-link-CnjcXf32.js} +1 -1
  171. package/dist/client/assets/{eye-0PvebX_a.js → eye-So8tNNK6.js} +1 -1
  172. package/dist/client/assets/{file-text-BODxCjcz.js → file-text-i3xTDUjJ.js} +1 -1
  173. package/dist/client/assets/{gestures-CcwOTu8C.js → gestures-CgvAMd6F.js} +1 -1
  174. package/dist/client/assets/{home-moving-signal-CK147hxn.js → home-moving-signal-BdkERL6B.js} +1 -1
  175. package/dist/client/assets/home-now-card-lLkv6nQs.js +1 -0
  176. package/dist/client/assets/{home-now-card-nano-BcjnOU9H.js → home-now-card-nano-CkLHUQ4J.js} +1 -1
  177. package/dist/client/assets/hooks-BPLDD9yu.js +2 -0
  178. package/dist/client/assets/inbox-thread-redesign-B_1ocqaX.css +1 -0
  179. package/dist/client/assets/index-DGoLx89y.js +1 -0
  180. package/dist/client/assets/index-DITWsjFb.css +1 -0
  181. package/dist/client/assets/index-m6dFtY5f.js +1 -0
  182. package/dist/client/assets/index-pY8-Mz7y.js +1 -0
  183. package/dist/client/assets/{index-DMiGbrBt.js → index-sUomXsrf.js} +6 -6
  184. package/dist/client/assets/{inspector-panel-DPoCWxKs.js → inspector-panel-DhXd-YbT.js} +2 -2
  185. package/dist/client/assets/{keyboard-nav-2kv_tGUS.js → keyboard-nav-BhZZ5HEq.js} +1 -1
  186. package/dist/client/assets/knowledge-search-D_bLoYtC.css +1 -0
  187. package/dist/client/assets/{lane-observe-D0rfKDnU.js → lane-observe-DrhKkQ3A.js} +1 -1
  188. package/dist/client/assets/{lane-roster-store-D8x1jac2.js → lane-roster-store-NE15Oe6M.js} +1 -1
  189. package/dist/client/assets/left-B6eawimv.js +1 -0
  190. package/dist/client/assets/left-BL2uBHe0.js +2 -0
  191. package/dist/client/assets/left-BNJguPDG.js +1 -0
  192. package/dist/client/assets/left-BvCtvN0f.js +1 -0
  193. package/dist/client/assets/left-CfBb6bxM.js +1 -0
  194. package/dist/client/assets/left-DTrlBF0h.js +2 -0
  195. package/dist/client/assets/left-agents-DsOHgDCY.js +1 -0
  196. package/dist/client/assets/left-d4hlBBxY.js +1 -0
  197. package/dist/client/assets/left-default-BRCwoCJr.js +1 -0
  198. package/dist/client/assets/left-lanes-DNtoRzoV.js +1 -0
  199. package/dist/client/assets/left-mission-DsTu2X5Y.js +1 -0
  200. package/dist/client/assets/left-plan-CtySjsXC.js +2 -0
  201. package/dist/client/assets/library-CLpgWNJO.js +1 -0
  202. package/dist/client/assets/{loader-circle-CbHjZsz1.js → loader-circle-lWOOKezu.js} +1 -1
  203. package/dist/client/assets/{local-agents--00gLMqr.js → local-agents-C7fDHLVC.js} +1 -1
  204. package/dist/client/assets/{mentions-jSuTGeet.js → mentions-CY_wPZc5.js} +1 -1
  205. package/dist/client/assets/mesh-ops-B1kDjizF.css +1 -0
  206. package/dist/client/assets/mesh-ops-Kn8pCtyJ.js +1 -0
  207. package/dist/client/assets/{mesh-view-store-CWidRbTE.js → mesh-view-store-D14ihwkF.js} +1 -1
  208. package/dist/client/assets/{message-circle-CG-96zts.js → message-circle-C5UZ6fO7.js} +1 -1
  209. package/dist/client/assets/{message-markup-3J9pi3nx.js → message-markup-C8Nx04sP.js} +1 -1
  210. package/dist/client/assets/{message-square-DSaGpjFU.js → message-square-BD-4UUdc.js} +1 -1
  211. package/dist/client/assets/{mission-control-store-BlnEhiCq.js → mission-control-store-xQHVQdm8.js} +1 -1
  212. package/dist/client/assets/{model-CpAxGuis.js → model-IGCUEsMy.js} +1 -1
  213. package/dist/client/assets/{observe-CuLGD9Zp.js → observe-uJfIlIUV.js} +1 -1
  214. package/dist/client/assets/{page-status-DpkedE1F.js → page-status-BymFEFai.js} +1 -1
  215. package/dist/client/assets/paperclip-DL9BXPp2.js +1 -0
  216. package/dist/client/assets/{plus--b1raV_O.js → plus-C9lTjsgd.js} +1 -1
  217. package/dist/client/assets/profile-BqY5tesX.js +1 -0
  218. package/dist/client/assets/{projects-inbox-CHyUFQ6w.js → projects-inbox-DfVmGFFk.js} +1 -1
  219. package/dist/client/assets/{radio-Bz8ZePxj.js → radio-DedMyP8J.js} +1 -1
  220. package/dist/client/assets/{refresh-cw-BBmAnCB7.js → refresh-cw-D8PFyhUa.js} +1 -1
  221. package/dist/client/assets/repo-diff-DyYmQMSA.css +1 -0
  222. package/dist/client/assets/resolve-panes-1xeZMuaw.js +1 -0
  223. package/dist/client/assets/resolve-sidebar-context-PLr32WHN.js +1 -0
  224. package/dist/client/assets/right-1x7HzabC.js +1 -0
  225. package/dist/client/assets/{right-DjRXbnRP.js → right-C1sIsSHR.js} +1 -1
  226. package/dist/client/assets/right-CFzPUzlF.js +1 -0
  227. package/dist/client/assets/right-CRKyeJDk.js +1 -0
  228. package/dist/client/assets/right-CagzkLWg.js +1 -0
  229. package/dist/client/assets/right-CsV149pN.js +1 -0
  230. package/dist/client/assets/right-DITNyG2s.js +1 -0
  231. package/dist/client/assets/right-E3nNcLE3.js +1 -0
  232. package/dist/client/assets/right-eUQvSjd7.js +1 -0
  233. package/dist/client/assets/right-ozp4nM44.js +1 -0
  234. package/dist/client/assets/{rocket-BSNS_rLs.js → rocket-CriBwkHM.js} +1 -1
  235. package/dist/client/assets/router-Dja9_ygK.js +1 -0
  236. package/dist/client/assets/{runtime-picker-Bcl5iIX5.js → runtime-picker-DOZpZOlt.js} +1 -1
  237. package/dist/client/assets/{scope-views-U-ucT9m0.js → scope-views-BF_RvGKU.js} +1 -1
  238. package/dist/client/assets/{scout-voice-CU5c0LGi.js → scout-voice-BZ4KqADJ.js} +1 -1
  239. package/dist/client/assets/{scroll-text-D6Pdnar7.js → scroll-text-BIYf6g6N.js} +1 -1
  240. package/dist/client/assets/{search-CWfZtOt2.js → search-DCT_EvPr.js} +1 -1
  241. package/dist/client/assets/secondaryNavConfig-Drb7wPG4.js +1 -0
  242. package/dist/client/assets/{selection-bridge-16pk1qyG.js → selection-bridge-CJOTyYQs.js} +1 -1
  243. package/dist/client/assets/{send-horizontal-Bg5-QggH.js → send-horizontal-DDwOgEs3.js} +1 -1
  244. package/dist/client/assets/{server-CPp4ZJhZ.js → server-CHZCp3cF.js} +1 -1
  245. package/dist/client/assets/{session-catalog-BmoyVTJ_.js → session-catalog-XhGxCtP-.js} +1 -1
  246. package/dist/client/assets/{session-table-DZcrKoIH.js → session-table-sAVe44a4.js} +1 -1
  247. package/dist/client/assets/{sliders-horizontal-1oW76Xc9.js → sliders-horizontal-B9Nj-Y4J.js} +1 -1
  248. package/dist/client/assets/sparkles-up7pVlX-.js +1 -0
  249. package/dist/client/assets/{sse-CjIkKo46.js → sse-CVoGDiKW.js} +1 -1
  250. package/dist/client/assets/{tail-events-D19uAGe3.js → tail-events-CTipUIli.js} +1 -1
  251. package/dist/client/assets/{terminal-B9AOZQKR.js → terminal-DXQISjZn.js} +1 -1
  252. package/dist/client/assets/{terminal-relay-CWbJ1RCW.js → terminal-relay-B5Sma7fK.js} +1 -1
  253. package/dist/client/assets/{terminal-takeover-B8UeD9OX.js → terminal-takeover-X97KCSJk.js} +1 -1
  254. package/dist/client/assets/{time-DltNTpLl.js → time-Dhsh_2EG.js} +1 -1
  255. package/dist/client/assets/{use-conversation-list-Byab41G6.js → use-conversation-list-B1T6J_qE.js} +1 -1
  256. package/dist/client/assets/{use-fleet-active-asks-BIbQx5AS.js → use-fleet-active-asks-DLofGhhK.js} +1 -1
  257. package/dist/client/assets/use-mesh-ops-items-ByGZk8rU.js +1 -0
  258. package/dist/client/assets/{use-reduced-motion-RRBkmVkk.js → use-reduced-motion-Cvk-HRKg.js} +1 -1
  259. package/dist/client/assets/use-scout-dev-flags-BHvg3G2c.js +1 -0
  260. package/dist/client/assets/{useAgentHoverCard-DMrbBif0.js → useAgentHoverCard-D5e8Qg1z.js} +1 -1
  261. package/dist/client/assets/useContentSecondaryNav-ZfBNi3d4.js +1 -0
  262. package/dist/client/assets/usePierreRuntime-DIVunfX0.js +50 -0
  263. package/dist/client/assets/{wrench-Bkc_0lKF.js → wrench-pEVd8JnN.js} +1 -1
  264. package/dist/client/assets/{x-D3GElQbe.js → x-0XjXwGqq.js} +1 -1
  265. package/dist/client/assets/{xterm-BKR8oAkR.js → xterm-CRLlV1Xp.js} +1 -1
  266. package/dist/client/index.html +2 -2
  267. package/dist/drizzle/0007_lean_venus.sql +26 -0
  268. package/dist/drizzle/0008_luxuriant_ted_forrester.sql +1 -0
  269. package/dist/drizzle/meta/0007_snapshot.json +5767 -0
  270. package/dist/drizzle/meta/0008_snapshot.json +5774 -0
  271. package/dist/drizzle/meta/_journal.json +14 -0
  272. package/dist/main.mjs +27836 -4437
  273. package/dist/node/main.mjs +31770 -12098
  274. package/dist/pairing-runtime-controller.mjs +37653 -16847
  275. package/dist/runtime/base-daemon.mjs +109 -18
  276. package/dist/runtime/broker-daemon.mjs +22018 -2739
  277. package/dist/runtime/broker-process-manager.mjs +122 -12
  278. package/dist/runtime/mesh-discover.mjs +90 -13
  279. package/dist/scout-control-plane-web.mjs +22453 -3299
  280. package/dist/scout-web-server.mjs +22453 -3299
  281. package/dist/statusline.mjs +2 -0
  282. package/package.json +3 -1
  283. package/dist/client/assets/ActivityScreen-Cu_1V4bq.js +0 -1
  284. package/dist/client/assets/AgentConfigurationScreen-BqfOz90D.js +0 -1
  285. package/dist/client/assets/AgentDefinitionsWorkspace-CUpUrY57.js +0 -1
  286. package/dist/client/assets/AgentFloorView-8LoAEBwS.js +0 -1
  287. package/dist/client/assets/AgentInfoScreen-DZs2_ibL.js +0 -1
  288. package/dist/client/assets/AgentLanesEmbedScreen-W3qs022h.js +0 -1
  289. package/dist/client/assets/AgentLanesView-B9vuEEmZ.js +0 -2
  290. package/dist/client/assets/AgentsConsole-BgiYP2wR.js +0 -1
  291. package/dist/client/assets/AgentsScreen-DBi8x4MB.js +0 -1
  292. package/dist/client/assets/AgentsSubnav-DIEO4NPx.js +0 -1
  293. package/dist/client/assets/BackToPicker-BRvfostO.js +0 -1
  294. package/dist/client/assets/CodeDiffPane-DDPt6KPh.js +0 -1
  295. package/dist/client/assets/CodeScreen-BxCrpRHd.js +0 -1
  296. package/dist/client/assets/ConversationFeedRows-B_gPxcqA.js +0 -1
  297. package/dist/client/assets/ConversationHeader-DE3FC0m-.js +0 -1
  298. package/dist/client/assets/ConversationPanels-DLek4H6A.js +0 -2
  299. package/dist/client/assets/ConversationScreen-BDRhx-RU.js +0 -1
  300. package/dist/client/assets/ConversationScreen-C9yMAMYF.css +0 -1
  301. package/dist/client/assets/ConversationStatus-BwVLiiO4.js +0 -1
  302. package/dist/client/assets/FlightObserveScreen-6RpZYwVz.js +0 -1
  303. package/dist/client/assets/HarnessesScreen-CznAImej.js +0 -1
  304. package/dist/client/assets/KnowledgeSearchInspector-Dgdkfvvz.js +0 -1
  305. package/dist/client/assets/KnowledgeSearchScreen-DJDGGaqC.js +0 -1
  306. package/dist/client/assets/LaneTraceDetailSheet-D1CspRbl.js +0 -1
  307. package/dist/client/assets/MeshScreen-DFgevn8N.js +0 -1
  308. package/dist/client/assets/MessagesScreen-C8YKW10Y.js +0 -1
  309. package/dist/client/assets/MissionLeftAgentRow-BpZWntfl.js +0 -1
  310. package/dist/client/assets/NewChatComposer-Cs6OsxK6.js +0 -19
  311. package/dist/client/assets/ObserveEmbedScreen-y2EpuqRZ.js +0 -2
  312. package/dist/client/assets/OpenScoutAppShell-C_URc8sV.js +0 -87
  313. package/dist/client/assets/OpsAgentsView-UN7iOscs.js +0 -1
  314. package/dist/client/assets/OpsScreen-Buf3LKjb.js +0 -1
  315. package/dist/client/assets/OpsSubnav-DsuXzHah.js +0 -1
  316. package/dist/client/assets/ProjectAgentProfile-DJusrAV-.js +0 -1
  317. package/dist/client/assets/ProjectAgentProfileHero-BFwNJo_N.js +0 -1
  318. package/dist/client/assets/ProjectsInbox-GhVMxOhw.js +0 -2
  319. package/dist/client/assets/ProjectsScreen-eNUBy4YU.js +0 -1
  320. package/dist/client/assets/ProjectsThreadAside-CoBgnHmr.js +0 -1
  321. package/dist/client/assets/Provider-C7UKGHQy.js +0 -1
  322. package/dist/client/assets/RawSessionsTable-DL8y_eEy.js +0 -1
  323. package/dist/client/assets/RealtimeVoiceScreen-ffS-39zy.js +0 -1
  324. package/dist/client/assets/RepoDiffViewer-D_exm6xK.js +0 -7
  325. package/dist/client/assets/RepoDiffViewerLazy-BPgF92Bg.js +0 -2
  326. package/dist/client/assets/SessionEmbedScreen-BVC7yvWF.js +0 -1
  327. package/dist/client/assets/SessionObserve-BpggNO_M.css +0 -1
  328. package/dist/client/assets/SessionObserve-yfXFafp8.js +0 -12
  329. package/dist/client/assets/SessionRefScreen-DRgJu7Jo.js +0 -1
  330. package/dist/client/assets/SessionsScreen-D6XUsZfA.js +0 -1
  331. package/dist/client/assets/SettingsDrawer-CmJt72ww.css +0 -1
  332. package/dist/client/assets/SettingsScreen-Cy8z-EuR.js +0 -1
  333. package/dist/client/assets/SpriteAvatar-DyaGuhik.js +0 -1
  334. package/dist/client/assets/Terminal-CqvGbjXU.js +0 -1
  335. package/dist/client/assets/TerminalEmbedScreen-DuZZFFzW.js +0 -1
  336. package/dist/client/assets/agent-lane-card-Dm7YWoew.css +0 -1
  337. package/dist/client/assets/content-BDt9VBPk.js +0 -1
  338. package/dist/client/assets/content-BIXf4cKR.js +0 -1
  339. package/dist/client/assets/content-BLm0NBJM.js +0 -1
  340. package/dist/client/assets/content-C5UbLsDF.js +0 -1
  341. package/dist/client/assets/content-CR3vdrYY.js +0 -1
  342. package/dist/client/assets/content-CSPVmo2s.js +0 -1
  343. package/dist/client/assets/content-C_FGqx1X.js +0 -1
  344. package/dist/client/assets/content-CvlVUOG8.js +0 -1
  345. package/dist/client/assets/content-DTpQsomG.js +0 -1
  346. package/dist/client/assets/content-DikVsqLf.js +0 -1
  347. package/dist/client/assets/content-DlUe5Ono.js +0 -1
  348. package/dist/client/assets/content-GIBv_55n.js +0 -1
  349. package/dist/client/assets/content-Q2oclDzi.js +0 -1
  350. package/dist/client/assets/conversation-model-B47vYmWN.js +0 -1
  351. package/dist/client/assets/conversation-motion-features-BdAONVls.js +0 -1
  352. package/dist/client/assets/discover-C1YwpBDE.js +0 -2
  353. package/dist/client/assets/embed-entry-BAcGL3g9.js +0 -2
  354. package/dist/client/assets/home-now-card-BgvNWuea.js +0 -1
  355. package/dist/client/assets/hooks-B6y_O2FB.js +0 -2
  356. package/dist/client/assets/inbox-thread-redesign-Bz4FjWzr.css +0 -1
  357. package/dist/client/assets/index-BcuhqXLe.js +0 -1
  358. package/dist/client/assets/index-CJXzfjo9.js +0 -1
  359. package/dist/client/assets/index-DQPvraRS.js +0 -1
  360. package/dist/client/assets/index-DxGoC5l5.css +0 -1
  361. package/dist/client/assets/knowledge-search-CVxQwxPn.js +0 -1
  362. package/dist/client/assets/knowledge-search-DjrQdiiW.css +0 -1
  363. package/dist/client/assets/left-C--GiIh8.js +0 -2
  364. package/dist/client/assets/left-Cj7Rt89X.js +0 -1
  365. package/dist/client/assets/left-CpNEtFEg.js +0 -1
  366. package/dist/client/assets/left-CzXAuK_t.js +0 -2
  367. package/dist/client/assets/left-agents-Bo9sO1by.js +0 -1
  368. package/dist/client/assets/left-bN4PCAXa.js +0 -1
  369. package/dist/client/assets/left-default-DV9GdvYi.js +0 -1
  370. package/dist/client/assets/left-jYYGAOYD.js +0 -1
  371. package/dist/client/assets/left-lanes-D0l_Co7V.js +0 -1
  372. package/dist/client/assets/left-mission-Ci7zREkQ.js +0 -1
  373. package/dist/client/assets/left-plan-D4U1uflW.js +0 -2
  374. package/dist/client/assets/library-D-RxGiCw.js +0 -1
  375. package/dist/client/assets/profile-CVRziEDA.js +0 -1
  376. package/dist/client/assets/repo-diff-C9Qs-bEn.css +0 -1
  377. package/dist/client/assets/resolve-panes-r9B3mpW7.js +0 -1
  378. package/dist/client/assets/resolve-sidebar-context-DcG8xGaB.js +0 -1
  379. package/dist/client/assets/right-BHeiIaty.js +0 -1
  380. package/dist/client/assets/right-BkgKo9VT.js +0 -1
  381. package/dist/client/assets/right-BpEU5jWE.js +0 -1
  382. package/dist/client/assets/right-CRZXoy-X.js +0 -1
  383. package/dist/client/assets/right-ChF_pbPy.js +0 -1
  384. package/dist/client/assets/right-DMoUT3KN.js +0 -1
  385. package/dist/client/assets/right-T4Ue6EqM.js +0 -1
  386. package/dist/client/assets/right-wzrLXKur.js +0 -1
  387. package/dist/client/assets/router-Bq5dwf78.js +0 -1
  388. package/dist/client/assets/secondaryNavConfig-DqUIp0Es.js +0 -1
  389. package/dist/client/assets/sparkles-ClfRJQ6w.js +0 -1
  390. package/dist/client/assets/useContentSecondaryNav-DMl1WNm7.js +0 -1
  391. package/dist/client/assets/usePierreRuntime-wC-yMtBb.js +0 -50
@@ -0,0 +1 @@
1
+ import{r as l,j as e,z as qe,A as He}from"./index-sUomXsrf.js";/* empty css */import{u as Ts}from"./ContextMenu-BlBQhpax.js";import{a as X}from"./api-h5zurxmi.js";import{c as ks}from"./clipboard-e3fSpeo7.js";import{d as Is}from"./colors-BtO5_zlx.js";import{r as Ce,S as Ve,a as Ye,w as Te,s as ht,b as ft,d as kt,c as bt,e as Rs,f as Ne,g as xt}from"./terminal-relay-B5Sma7fK.js";import{p as yt,k as jt,f as Es,b as Ws,s as U,c as Ue,m as Ke,r as As,d as Ms,o as gt,q as St,t as Ls}from"./terminal-sessions-D5CIR2OL.js";import{D as Nt,a as wt,L as Ds,P as vt,s as Ct,T as Tt,b as It,c as zs}from"./session-table-sAVe44a4.js";import{u as Je,a as Oe,T as Rt}from"./chunk-YOZR3KYS-BW85tiCr.js";import{q as Et}from"./terminal-takeover-X97KCSJk.js";import{t as Wt}from"./time-Dhsh_2EG.js";import{u as Os}from"./Provider-tFc3jqZ4.js";import{B as me}from"./BackToPicker-CkUmHuuo.js";import{T as At}from"./TmuxPeek-Dz1gJ2pU.js";import{R as Ge}from"./refresh-cw-D8PFyhUa.js";import{c as Xe}from"./createLucideIcon-DlxlBfLC.js";import{P as te}from"./plus-C9lTjsgd.js";import{T as K}from"./terminal-DXQISjZn.js";import{S as Mt}from"./runtime-picker-DOZpZOlt.js";import{X as ue}from"./x-0XjXwGqq.js";import{E as Lt}from"./eye-So8tNNK6.js";import{E as Ps}from"./external-link-CnjcXf32.js";import"./router-Dja9_ygK.js";import"./chunk-HRAB3GC3-CvwpNg-G.js";import"./arrow-down-DsD-dYj-.js";import"./sse-CVoGDiKW.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./DocumentFocusViewer-DU_9BHsD.js";import"./TextDocumentSurface-C-9EtYqt.js";/* empty css */import"./file-text-i3xTDUjJ.js";import"./chevron-right-CyUa1zXx.js";import"./code-xml-05TD3uOC.js";import"./arrow-left-WjQIN9J6.js";import"./scout-voice-BZ4KqADJ.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-BhZZ5HEq.js";import"./MessageComposerSuggestions-zAUUcLOv.js";import"./NewChatComposer-B5FnPyzS.js";import"./index-m6dFtY5f.js";import"./HarnessMark-Dm_qm1Ku.js";import"./conversation-model-C4yb6_FA.js";import"./NewChatOrigin--pHWUb4V.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-BFai6ZfE.js";import"./search-DCT_EvPr.js";import"./loader-circle-lWOOKezu.js";/* empty css */import"./voice-levels-Dcr3jglk.js";const _s=6,$s=2;function Ie(s){if(s.layout?.mode)return{mode:s.layout.mode,...s.layout.columns===void 0?{}:{columns:Dt(s.layout.columns)}};const t=s.cellCount??0,r=We(s.columns??$s);return t<=1?{mode:"solo"}:r>=t?{mode:"lanes",columns:r}:{mode:"grid",columns:r}}function Re(s,t){const r=Math.max(1,Math.floor(t.tileCount)||1);if(s.mode==="solo")return 1;if(s.columns===void 0||s.columns==="dynamic"){const i=s.mode==="lanes"?r:Math.ceil(Math.sqrt(r));return Math.max(1,Math.min(_s,i))}return We(s.columns)}function Dt(s){return s==="dynamic"?"dynamic":We(s)}function zt(s){if(s.mode==="solo")return"Solo";const t=s.mode==="lanes"?"Lanes":"Grid";return s.columns===void 0||s.columns==="dynamic"?`${t} · dynamic`:`${t} · ${s.columns} column${s.columns===1?"":"s"}`}function We(s){return typeof s!="number"||!Number.isFinite(s)?$s:Math.max(1,Math.min(_s,Math.floor(s)))}const Ot=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Pt=Xe("ellipsis",Ot);const _t=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],de=Xe("grid-2x2",_t);const $t=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ft=Xe("zap",$t),Qe=6;function Ut(s="main",t="Main"){return{version:1,activeWorkspaceId:s,workspaces:[{id:s,name:t,tiles:[]}]}}function Ze(){return{version:1,activeWorkspaceId:"",workspaces:[]}}function bs(s,t,r={}){const i=()=>r.allowEmpty?Ze():Ut();if(!s||typeof s!="object")return i();const c=s;if(!Array.isArray(c.workspaces))return i();const m=[],d=new Set;for(const o of c.workspaces){if(!o||typeof o!="object")continue;const x=typeof o.id=="string"?o.id.trim():"",b=typeof o.name=="string"?o.name.trim():"";if(!x||!b||d.has(x)||!Array.isArray(o.tiles))continue;d.add(x);const S=typeof o.purpose=="string"?o.purpose.trim():"",C=Bt(o.columns),L=Kt(o.layout),z=typeof o.updatedAt=="number"&&Number.isFinite(o.updatedAt)&&o.updatedAt>=0?o.updatedAt:null;m.push({id:x,name:b,tiles:o.tiles.filter(t),...S?{purpose:S}:{},...C?{columns:C}:{},...L?{layout:L}:{},...z===null?{}:{updatedAt:z}})}return m.length===0?i():{version:1,activeWorkspaceId:typeof c.activeWorkspaceId=="string"&&d.has(c.activeWorkspaceId)?c.activeWorkspaceId:m[0].id,workspaces:m}}function Kt(s){if(!s||typeof s!="object")return null;const t=s;if(t.mode!=="solo"&&t.mode!=="lanes"&&t.mode!=="grid")return null;if(t.columns===void 0)return{mode:t.mode};if(t.columns==="dynamic")return{mode:t.mode,columns:"dynamic"};const r=We(t.columns);return{mode:t.mode,columns:r}}function Bt(s){if(typeof s!="number"||!Number.isFinite(s))return null;const t=Math.floor(s);return t<1?null:Math.min(t,Qe)}function xs(s,t){const r=t.id.trim();if(!r)return s;const i={...t,id:r},m=s.workspaces.some(d=>d.id===r)?s.workspaces.map(d=>d.id===r?i:d):[i,...s.workspaces];return{...s,activeWorkspaceId:r,workspaces:m}}function ys(s,t,r){const i=s.workspaces.findIndex(h=>h.id===t);if(i<0)return s;const c=s.workspaces[i],m={...c,...r};return Object.keys(r).every(h=>c[h]===m[h])?s:{...s,workspaces:s.workspaces.map((h,o)=>o===i?m:h)}}function qt(s,t){return t===s.activeWorkspaceId||!s.workspaces.some(r=>r.id===t)?s:{...s,activeWorkspaceId:t}}function Ht(s,t,r={}){if(s.workspaces.length<=1)return r.allowEmpty&&s.workspaces[0]?.id===t?Ze():s;const i=s.workspaces.findIndex(d=>d.id===t);if(i<0)return s;const c=s.workspaces.filter(d=>d.id!==t),m=s.activeWorkspaceId===t?c[Math.min(i,c.length-1)].id:s.activeWorkspaceId;return{...s,activeWorkspaceId:m,workspaces:c}}function Vt(s,t,r){return r>1?{axis:"horizontal",edge:s.x<t.left+t.width/2?"before":"after"}:{axis:"vertical",edge:s.y<t.top+t.height/2?"before":"after"}}function Yt(s,t,r,i){if(t===r)return[...s];const c=s.findIndex(b=>b.id===t),m=s.findIndex(b=>b.id===r);if(c<0||m<0)return[...s];const d=[...s],[h]=d.splice(c,1);if(!h)return[...s];const o=d.findIndex(b=>b.id===r),x=i==="after"?o+1:o;return d.splice(Math.max(0,x),0,h),d}const Jt="openscout.terminal.workspaces.v1",Gt=2,Xt="openscout.terminal.workspace-view.v1",Pe=2;function we(s){const t=typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);return`${s}-${Date.now().toString(36)}-${t}`}const Qt=24;function Fs(s,t,r){const i=t.replace(/[^A-Za-z0-9_-]+/gu,"-").replace(/^[^A-Za-z0-9_]+/u,"").slice(0,Qt).replace(/-+$/u,""),c=Zt(JSON.stringify([r,t,s]));return`scout-${s}-${i||"cell"}-${c}`}function Zt(s){let t=2166136261;for(let r=0;r<s.length;r+=1)t^=s.charCodeAt(r),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}function le(s,t="shell"){return{id:we("cell"),kind:"fresh",backend:s,agent:t}}function js(s){if(!s||typeof s!="object")return!1;const t=s;return typeof t.id!="string"||!t.id.trim()?!1:t.kind==="fresh"?typeof t.backend=="string"&&typeof t.agent=="string":t.kind==="registered"?typeof t.terminalSessionId=="string"&&typeof t.terminalSurfaceKey=="string":!1}function gs(s){return{id:s.id,name:s.name,...s.purpose?{purpose:s.purpose}:{},columns:s.columns,...s.layout?{layout:s.layout}:{},updatedAt:s.updatedAt,tiles:s.cells.map(t=>t.surfaceId&&t.terminalSessionId?{id:t.id,kind:"registered",terminalSessionId:t.terminalSessionId,terminalSurfaceKey:t.surfaceId}:{id:t.id,kind:"fresh",backend:sn(t.intent.hostId)?t.intent.hostId:"pty",agent:"shell"})}}function _e(s,t={}){return{id:s.id,name:s.name,purpose:s.purpose??"",columns:Re(Ie({layout:s.layout,columns:s.columns,cellCount:s.tiles.length}),{tileCount:s.tiles.length}),layout:Ie({layout:s.layout,columns:s.columns,cellCount:s.tiles.length}),cells:s.tiles.map(r=>r.kind==="registered"?{id:r.id,surfaceId:r.terminalSurfaceKey,terminalSessionId:r.terminalSessionId,intent:en(r,t.sessions??[])}:{id:r.id,intent:{hostId:r.backend,sessionName:r.backend==="pty"?null:Fs(r.backend,r.id,s.id)}})}}function en(s,t){const r=yt(s.terminalSurfaceKey),i=t.find(c=>c.id===s.terminalSessionId||c.surfaces.some(m=>jt(m,s.terminalSurfaceKey)));return{...r?{hostId:r.backend,sessionName:r.hostSession}:{},...i?.cwd?{cwd:i.cwd}:{},...i?.harness?{harness:i.harness}:{},...i?.resumeCommand?{resumeCommand:i.resumeCommand}:{}}}function sn(s){return s==="pty"||s==="tmux"||s==="zellij"||s==="herdr"}function tn(s){if(!Array.isArray(s))return bs(s,js,{allowEmpty:!0});const t=s.flatMap(r=>{if(!r||typeof r!="object")return[];const i=r;if(typeof i.id!="string"||!i.id.trim())return[];const c=Array.isArray(i.cells)?i.cells:[];return[{id:i.id,name:typeof i.name=="string"&&i.name.trim()?i.name:i.id,purpose:i.purpose,columns:i.columns,updatedAt:i.updatedAt,tiles:c.map((m,d)=>({...m,id:`${i.id}-${d}`}))}]});return bs({activeWorkspaceId:t[0]?.id??"",workspaces:t},js,{allowEmpty:!0})}function nn(s,t,r){const i=s.find(c=>c.id===t);return i?i.capabilities.control.includes(r)||i.capabilities.harnessControl.includes(r):!1}function rn(s,t){return s.find(r=>r.id===t)??null}function an(s){return[{value:"pty",label:"Shell",detail:"Disposable local shell",relayAttach:!0},...s.filter(t=>t.availability.installed&&t.capabilities.create).map(t=>({value:t.id,label:t.label,detail:t.description,relayAttach:t.capabilities.relayAttach})).sort((t,r)=>Number(r.relayAttach)-Number(t.relayAttach)||t.value.localeCompare(r.value))]}async function on(){return X("/api/terminal-hosts")}async function ln(s,t){return X(`/api/terminal-hosts/${encodeURIComponent(s)}/sessions`,{method:"POST",body:JSON.stringify(t)})}let ve=null,$e=null;function cn(){return ve?Promise.resolve(ve):($e??=on().then(s=>(ve=s,s)).finally(()=>{$e=null}),$e)}function es(){const[s,t]=l.useState(ve);return l.useEffect(()=>{if(s)return;let r=!1;return cn().then(i=>{r||t(i)}).catch(()=>{}),()=>{r=!0}},[s]),{hosts:s?.hosts??[],preferredHostId:s?.preferredHostId??null,loaded:s!==null}}async function dn(){return X("/api/terminal-workspaces")}async function Ss(s){return(await X(`/api/terminal-workspaces/${encodeURIComponent(s.id)}`,{method:"PUT",body:JSON.stringify(s)})).workspace}async function mn(s,t){return X(`/api/terminal-workspaces/${encodeURIComponent(s)}/cells/${encodeURIComponent(t)}/revive`,{method:"POST",body:"{}"})}async function un(s){return(await X(`/api/terminal-workspaces/${encodeURIComponent(s)}`,{method:"DELETE"})).deleted}function pn(s){const t=new Map;for(const r of s?.cells??[])t.set(r.cellId,r);return t}const Ns="scout:terminal-send-line";function hn(s){const t=s.detail;if(!t||typeof t!="object"||!("line"in t))return null;const r=t.line;return typeof r=="string"&&r.trim().length>0?r:null}const ce=typeof window>"u"?l.useEffect:l.useLayoutEffect,fn="openscout.terminal.picker-view.v1",ws={mode:"grid",columns:"dynamic"},vs=[{mode:"solo",label:"Solo",detail:"One terminal, full width",minimumCells:1},{mode:"lanes",label:"Lanes",detail:"Side by side, one row",minimumCells:2},{mode:"grid",label:"Grid",detail:"Rows and columns",minimumCells:4}],kn=[{value:"shell",label:"Shell"},{value:"codex",label:"Codex"},{value:"claude",label:"Claude"},{value:"pi",label:"Pi"}],Fe="'JetBrainsMono Nerd Font', 'JetBrainsMonoNL Nerd Font', 'MesloLGS Nerd Font Mono', 'Hack Nerd Font Mono', 'JetBrains Mono', monospace",Cs=s=>{},bn=()=>{};function xn(){if(typeof window>"u")return{fontFamily:Fe,fontSize:13};const s=new URLSearchParams(window.location.search),t=s.get("terminalFontFamily")?.trim(),r=Number(s.get("terminalFontSize"));return{fontFamily:t?`'${t.replaceAll("'","\\'")}', ${Fe}`:Fe,fontSize:Number.isFinite(r)&&r>=9&&r<=32?r:13}}function ss(s){const t=xn();return e.jsx(Rt,{...s,renderer:s.renderer??"dom",fontFamily:t.fontFamily,fontSize:t.fontSize})}function yn(s,t){const[r,i]=l.useState({state:"loading",sessions:[]}),c=l.useCallback(()=>{i(d=>({state:"loading",sessions:d.sessions})),Es({includeDiscovered:!0}).then(d=>{i({state:"ready",sessions:d})}).catch(d=>{i(h=>({state:"failed",sessions:h.sessions,error:d instanceof Error?d.message:String(d)}))})},[]);return l.useEffect(()=>{c()},[c]),{target:l.useMemo(()=>As(r.sessions,s,t),[r.sessions,s,t]),loadState:r.state,loadSessions:c,hasSessionHint:!!s}}function jn(s,t,r){const i=ht(t,r),[c,m]=l.useState(i?{state:"preparing"}:{state:"ready"}),[d,h]=l.useState(0);return l.useEffect(()=>{if(!i||!s){m({state:"ready"});return}let o=!1;return m({state:"preparing"}),X(`/api/agents/${encodeURIComponent(s)}/session-catalog`).then(x=>{if(x.resumeCommand)return Et({command:x.resumeCommand,cwd:x.resumeCwd,agentId:s})}).then(()=>{o||m({state:"ready"})}).catch(x=>{o||m({state:"failed",error:x instanceof Error?x.message:String(x)})}),()=>{o=!0}},[s,i,d]),{ready:c.state==="ready",label:c.state==="failed"?"TAKEOVER FAILED":"PREPARING TAKEOVER",status:c.state==="failed"?c.error:"Resolving live session...",onRetry:c.state==="failed"?()=>h(o=>o+1):void 0}}function gn(s){const{agentId:t,agent:r,mode:i,navigate:c,registeredTarget:m,showContextMenu:d}=s,{hosts:h}=es(),o=r?Is(r.name):"var(--accent)",x=l.useRef(null),b=m?Ls(m.surface):Ce(r),S=i==="observe",C=m?.session.cwd??r?.cwd??r?.projectRoot??void 0,L=qe(),z=He(),N=ft({agentId:t,agent:r,registeredTarget:m,terminalSurface:b,relayUrl:L,harness:m?.session.harness??r?.harness,cwd:C,mode:i}),j=Je({url:N.scopedRelayUrl,healthUrl:z,autoConnect:!0,...S?{}:{sessionKey:N.relayStorageSessionKey},...N.surfaceOptions??{},...N.orphanTTL?{orphanTTL:N.orphanTTL}:{},...N.cwd?{cwd:N.cwd}:{},...N.relayAgent?{agent:N.relayAgent}:{},controlMode:N.controlMode});ce(()=>{j.resize(Ve,Ye)},[j.resize]);const I=l.useMemo(()=>S?{...j,sendInput:Cs,sendLine:Cs,restart:bn}:j,[S,j]),A=kt({agentId:t,registeredTarget:m}),$=Te(A,i),T=l.useCallback(()=>{const k=x.current;k?.querySelector(".xterm-helper-textarea")?.focus(),k?.querySelector(".xterm")?.focus()},[]);l.useEffect(()=>{const k=P=>{const _=P.detail?.line;return typeof _=="string"&&_.length>0?_:null},D=P=>{const _=k(P);!_||S||(I.sendInput(_),T())},M=P=>{const _=k(P);!_||S||(I.sendLine(_),T())};return window.addEventListener("scout:terminal-send-input",D),window.addEventListener("scout:terminal-send-line",M),()=>{window.removeEventListener("scout:terminal-send-input",D),window.removeEventListener("scout:terminal-send-line",M)}},[T,S,I]);const R=l.useCallback(k=>b?bt(b,k):null,[b]),E=l.useCallback(()=>{ks(Rs($))},[$]),q=l.useCallback(()=>{S||!navigator.clipboard?.readText||navigator.clipboard.readText().then(k=>{k&&I.sendInput(k)}).catch(()=>{})},[S,I]),B=l.useCallback(()=>{Ne(N.relayStorageSessionKey);const k=R("detach");if(k){k.finally(()=>j.disconnect());return}j.disconnect()},[N.relayStorageSessionKey,j,R]),f=l.useCallback(()=>{Ne(N.relayStorageSessionKey);const k=R("force-quit-bridge");if(k){k.finally(()=>{j.connect(),window.setTimeout(T,250)});return}j.connect(),window.setTimeout(T,250)},[N.relayStorageSessionKey,T,j,R]),g=l.useCallback(()=>{if(S)return;const k=R("interrupt");k?k.catch(()=>I.sendInput("")):I.sendInput(""),T()},[T,S,R,I]),W=l.useCallback(()=>{if(S)return;const k=R("quit");k?k.catch(()=>I.sendInput("")):I.sendInput(""),T()},[T,S,R,I]),F=l.useCallback(()=>{if(S)return;const k=R("stop-job");if(k){k.finally(T);return}T()},[T,S,R]),ne=l.useCallback(()=>{if(Ne(N.relayStorageSessionKey),b&&!window.confirm(`Force quit Claude in ${Ke(b.sessionName)}?`))return;const k=R("force-quit");if(k){k.finally(()=>j.disconnect());return}const D=j.sessionId;if(!D){j.disconnect();return}xt(D).catch(()=>{}).finally(()=>j.disconnect())},[N.relayStorageSessionKey,j,R,b]),re=l.useCallback(()=>{if(!b||!window.confirm(`Restart Claude in ${Ke(b.sessionName)} and resume its latest session?`))return;Ne(N.relayStorageSessionKey);const k=R("restart-resume");k&&k.finally(()=>{j.disconnect(),window.setTimeout(()=>{j.connect(),window.setTimeout(T,250)},600)})},[N.relayStorageSessionKey,T,j,R,b]),ae=l.useCallback(k=>{c(Te(A,k))},[c,A]),Q=l.useCallback(()=>{c(A)},[c,A]),Z=l.useMemo(()=>{const k=b?.backend??null,D=_=>nn(h,k,_),M=[];(!k||D("detach"))&&M.push({kind:"action",label:"Leave this session running",onSelect:B}),M.push({kind:"action",label:"Reconnect",onSelect:f});const P=[];return D("restart-resume")&&P.push({kind:"action",label:"Restart Claude and resume",onSelect:re}),D("force-quit")&&P.push({kind:"action",label:"Force quit Claude",onSelect:ne}),P.length>0&&M.push({kind:"separator"},...P),M},[B,ne,f,re,h,b?.backend]),pe=l.useCallback(k=>{d(k,Z)},[Z,d]),ee=l.useCallback(k=>{const D=typeof window>"u"?"":window.getSelection()?.toString()??"",M=[];D.trim()&&M.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>{ks(D)}}),S||M.push({kind:"action",label:"Paste",shortcut:"⌘V",onSelect:q},{kind:"action",label:"Send Ctrl-C",shortcut:"⌃C",onSelect:g},{kind:"action",label:"Quit With Ctrl-D",shortcut:"⌃D",onSelect:W},{kind:"action",label:"Stop Running Job",onSelect:F}),M.length>0&&M.push({kind:"separator"}),M.push({kind:"action",label:"Focus Terminal",onSelect:T},...Z,{kind:"separator"},{kind:"action",label:S?"Open Takeover":"Open Observe",onSelect:()=>ae(S?"takeover":"observe")},{kind:"action",label:"Open Summary",onSelect:Q},{kind:"action",label:"Copy Terminal Link",onSelect:E}),d(k,M)},[E,T,g,ae,Q,q,W,S,Z,d,F]);return{color:o,terminalBodyRef:x,terminalSurface:b,readOnly:S,relay:j,terminalRelay:I,healthUrl:z,scopedRelayUrl:N.scopedRelayUrl,hasViewActions:!!(m||b),canSignalTerminal:!S&&!!(b||j.status==="connected"),canStopTerminalJob:!S&&!!b,handleSessionMenu:pe,handleTerminalContextMenu:ee,openMode:ae,openSummary:Q,interruptTerminal:g,quitTerminal:W,stopTerminalJob:F,terminalRouteBase:A}}function Sn({agent:s,agentId:t,color:r,navigate:i,label:c,status:m,onRetry:d}){return e.jsxs("div",{className:"s-term",children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsx(me,{slot:"terminal",fallback:{view:"terminal"},navigate:i,className:"s-term-back"}),s&&e.jsxs("div",{className:"s-term-agent",children:[e.jsx("div",{className:"s-ops-avatar",style:{"--size":"18px",background:r},children:s.name[0]?.toUpperCase()}),e.jsx("span",{className:"s-term-agent-name",children:s.name}),s.handle&&e.jsxs("span",{className:"s-term-agent-handle",children:["@",s.handle]})]}),e.jsx("span",{className:"s-term-label",children:c}),e.jsx("div",{className:"s-term-status",children:d?"OFFLINE":"CONNECTING"})]}),e.jsx("div",{className:"s-term-body s-term-body--placeholder",children:e.jsxs("div",{className:"s-term-placeholder",children:[e.jsx("span",{children:m}),d&&e.jsx("button",{type:"button",onClick:d,children:"Retry"})]})})]})}function Nn({target:s,navigate:t}){const r=l.useMemo(()=>Ws([s.session]).find(d=>U(d.surface)===U(s.surface)),[s]),i={view:"terminal",terminalSessionId:s.session.id,terminalSurfaceKey:U(s.surface)},c=gt(s.session,s.surface),m=St(s);return e.jsx("div",{className:"s-term s-term--summary",children:e.jsxs("div",{className:"s-term-summary",children:[e.jsxs("div",{className:"s-term-summary-main",children:[e.jsx(me,{slot:"terminal",fallback:{view:"terminal"},navigate:t,className:"s-term-back"}),e.jsxs("div",{className:"s-term-summary-mark",children:[e.jsx(K,{size:18,strokeWidth:1.7}),e.jsx("span",{children:"Terminal"})]}),e.jsxs("div",{className:"s-term-summary-heading",children:[e.jsx("h1",{children:r?.title??s.surface.sessionName}),e.jsxs("p",{children:[s.surface.backend," · ",c]})]}),e.jsxs("div",{className:"s-term-summary-actions",children:[e.jsxs("button",{type:"button",className:"s-term-summary-action s-term-summary-action--primary",onClick:()=>t(Te(i,"takeover")),children:[e.jsx(Ds,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Enter"})]}),e.jsxs("button",{type:"button",className:"s-term-summary-action",onClick:()=>t(Te(i,"observe")),children:[e.jsx(Lt,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Observe"})]})]})]}),e.jsx("div",{className:"s-term-summary-preview",children:e.jsx(At,{surface:Ls(s.surface),lines:26,columns:112,pollMs:3e4,idlePollMs:3e4,className:"s-term-preview-peek"})}),e.jsx("dl",{className:"s-term-summary-details",children:m.map(([d,h])=>e.jsxs("div",{className:"s-term-summary-detail",children:[e.jsx("dt",{children:d}),e.jsx("dd",{title:h,children:h})]},d))})]})})}function ts({agentId:s,agent:t,mode:r,navigate:i,registeredTarget:c,embedded:m=!1,tileActions:d}){const h=Ts(),o=gn({agentId:s,agent:t,mode:r,navigate:i,registeredTarget:c,showContextMenu:h});return e.jsxs("div",{className:`s-term${m?" s-term--embedded":""}`,children:[e.jsxs("div",{className:"s-term-bar s-term-bar--takeover",children:[e.jsxs("div",{className:"s-term-bar-left",children:[!m&&e.jsx(me,{slot:"terminal",fallback:{view:"terminal"},navigate:i,className:"s-term-back"}),t&&e.jsxs("div",{className:"s-term-agent",children:[e.jsx("div",{className:"s-ops-avatar",style:{"--size":"18px",background:o.color},children:t.name[0]?.toUpperCase()}),e.jsx("span",{className:"s-term-agent-name",children:t.name}),t.handle&&e.jsxs("span",{className:"s-term-agent-handle",children:["@",t.handle]})]}),c&&e.jsxs("div",{className:"s-term-registered-chip",children:[e.jsx(K,{size:14,strokeWidth:1.8}),e.jsx("span",{children:c.session.harness}),e.jsx("span",{children:c.session.sourceSessionId})]})]}),e.jsxs("div",{className:"s-term-bar-meta",children:[e.jsx("span",{className:"s-term-label",children:o.terminalSurface?o.readOnly?"TERMINAL OBSERVE":"TERMINAL TAKEOVER":"TAKEOVER"}),o.terminalSurface&&e.jsx("span",{className:"s-term-session",title:o.terminalSurface.sessionName,children:Ke(o.terminalSurface.sessionName)})]}),e.jsxs("div",{className:"s-term-bar-actions",children:[o.hasViewActions&&e.jsxs("div",{className:"s-term-action-cluster s-term-action-cluster--view","aria-label":"Terminal view actions",children:[c&&e.jsx("button",{type:"button",className:"s-term-action",onClick:o.openSummary,title:"Leave the terminal canvas and show the session summary",children:"Summary"}),o.terminalSurface&&e.jsx("button",{type:"button",className:"s-term-action",onClick:()=>o.openMode(o.readOnly?"takeover":"observe"),title:o.readOnly?"Switch to interactive takeover":"Switch to read-only terminal observe",children:o.readOnly?"Takeover":"Observe"})]}),(o.canSignalTerminal||o.canStopTerminalJob)&&e.jsxs("div",{className:"s-term-action-cluster s-term-action-cluster--signals","aria-label":"Terminal signal actions",children:[o.canSignalTerminal&&e.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:o.interruptTerminal,title:"Send Ctrl-C to the terminal",children:[e.jsx(Ft,{size:13,strokeWidth:1.8}),e.jsx("span",{children:"Ctrl-C"})]}),o.canSignalTerminal&&e.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:o.quitTerminal,title:"Send Ctrl-D / EOF to the terminal",children:[e.jsx(vt,{size:13,strokeWidth:1.8}),e.jsx("span",{children:"Quit"})]}),o.canStopTerminalJob&&e.jsxs("button",{type:"button",className:"s-term-action s-term-action--warn",onClick:o.stopTerminalJob,title:"Stop Claude's current shell/tool job without quitting Claude",children:[e.jsx(Mt,{size:12,strokeWidth:2}),e.jsx("span",{children:"Stop Job"})]})]}),e.jsxs("button",{type:"button",className:"s-term-action s-term-session-menu",onClick:o.handleSessionMenu,title:"Open session, recovery, and external handoff actions",children:[e.jsx(Pt,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Session"})]}),e.jsx("div",{className:"s-term-status",children:o.relay.status==="connected"?"LIVE":o.relay.status==="connecting"?"CONNECTING":"OFFLINE"}),d]})]}),e.jsx("div",{ref:o.terminalBodyRef,className:"s-term-body",onContextMenuCapture:o.handleTerminalContextMenu,children:e.jsx(ss,{relay:o.terminalRelay,readOnly:o.readOnly,quiet:!0,configItems:[...o.terminalSurface?[{label:"backend",value:o.terminalSurface.backend},{label:"session",value:o.terminalSurface.sessionName},...o.terminalSurface.paneId?[{label:"pane",value:o.terminalSurface.paneId}]:[],...o.terminalSurface.socketDir?[{label:"socket",value:o.terminalSurface.socketDir}]:[],{label:"mode",value:o.readOnly?"read-only":"takeover"}]:[],{label:"ws",value:o.scopedRelayUrl},{label:"health",value:o.healthUrl}]})})]})}function wn({terminalSessionId:s,terminalSurfaceKey:t,mode:r,navigate:i}){const{target:c,loadState:m,loadSessions:d,hasSessionHint:h}=yn(s,t);return c&&r?e.jsx(ts,{agent:null,mode:r,navigate:i,registeredTarget:c},`${U(c.surface)}:${r}`):c?e.jsx(Nn,{target:c,navigate:i}):e.jsx("div",{className:"s-term s-term--empty-main",children:e.jsxs("div",{className:"s-term-empty-main-mark",children:[e.jsx(K,{size:18,strokeWidth:1.6}),e.jsx("span",{children:m==="loading"?"Loading terminal":m==="failed"?"Terminal list unavailable":h?"Terminal unavailable":"Select a terminal"}),m==="failed"&&e.jsx("button",{type:"button",className:"s-term-empty-action",onClick:d,children:"Retry"})]})})}function vn(s,t){return s.kind!=="fresh"||!s.sessionName?!1:t.some(r=>r.surfaces.some(i=>i.backend===s.backend&&i.sessionName===s.sessionName&&i.state!=="exited"))}function Ee(s){return`${s.session.id}:${U(s.surface)}`}function Cn(s,t,r){if(s.kind==="fresh")return{id:s.id,kind:"fresh",backend:s.backend,agent:s.agent,...s.backend==="pty"?{}:{sessionName:Fs(s.backend,s.id,r)}};const i=As(t,s.terminalSessionId,s.terminalSurfaceKey);return i?{id:s.id,kind:"registered",target:i}:{id:s.id,kind:"unavailable",terminalSessionId:s.terminalSessionId,terminalSurfaceKey:s.terminalSurfaceKey}}function G(s){return{session:s.session,surface:s.surface}}function Tn(s){const t=s.backend;return t!=="pty"&&!Ms(t)?null:{view:"terminal",terminalBackend:t,terminalAgent:s.agent,terminalTabId:s.id,...s.sessionName?{terminalSessionName:s.sessionName}:{},...s.zellijSocketDir?{zellijSocketDir:s.zellijSocketDir}:{}}}function In(s,t="takeover"){return{view:"terminal",terminalSessionId:s.session.id,terminalSurfaceKey:U(s.surface),mode:t}}function Us(s,t){if(typeof window>"u"){t(s);return}window.open(Rs(s),"_blank","noopener,noreferrer")}function Rn({navigate:s}){const{agents:t}=Os(),r=Ts(),{hosts:i}=es(),c=l.useMemo(()=>an(i),[i]),[m,d]=Oe(Jt,Ze(),{version:Gt,migrate:tn}),[h,o]=Oe(Xt,"library"),x=l.useRef(new Map),[b,S]=l.useState(null),[C,L]=l.useState(""),[z,N]=l.useState(""),[j,I]=l.useState(ws),[A,$]=l.useState(()=>Array.from({length:4},()=>le("pty"))),[T,R]=l.useState(0),[E,q]=l.useState({state:"loading",sessions:[]}),[B,f]=l.useState(0),[g,W]=l.useState(!0),[F,ne]=Oe(fn,"list"),[re,ae]=l.useState(Nt),[Q,Z]=l.useState([]),[pe,ee]=l.useState(null),[k,D]=l.useState(null),[M,P]=l.useState(null),[_,rs]=l.useState(!1),[he,as]=l.useState(null),[Bs,Ae]=l.useState(null),fe=l.useRef(null),ke=l.useRef(null),be=l.useRef("after"),xe=l.useRef(null),ye=l.useRef(null),Me=l.useRef(!1),H=l.useCallback((n={})=>{n.silent||q(a=>({state:"loading",sessions:a.sessions})),Es({includeDiscovered:!0}).then(a=>q({state:"ready",sessions:a})).catch(a=>{n.silent||q(u=>({state:"failed",sessions:u.sessions,error:a instanceof Error?a.message:String(a)}))})},[]);l.useEffect(()=>{H()},[H]),l.useEffect(()=>{const n=()=>{document.visibilityState==="visible"&&H({silent:!0})},a=window.setInterval(n,8e3);return window.addEventListener("focus",n),document.addEventListener("visibilitychange",n),()=>{window.clearInterval(a),window.removeEventListener("focus",n),document.removeEventListener("visibilitychange",n)}},[H]),l.useEffect(()=>{let n=!1;return dn().then(a=>{if(!n){Z(a.resolutions);for(const u of a.workspaces)x.current.set(u.id,JSON.stringify(_e(gs(u),{sessions:E.sessions})));a.workspaces.length!==0&&d(u=>{let p=u;for(const y of a.workspaces)p=xs(p,gs(y));return{...p,activeWorkspaceId:u.activeWorkspaceId||p.activeWorkspaceId}})}}).catch(()=>{}),()=>{n=!0}},[d]);const is=l.useMemo(()=>Ws(E.sessions),[E.sessions]),V=l.useMemo(()=>is.filter(n=>n.surface.state!=="exited"),[is]);l.useMemo(()=>Pn(t),[t]);const os=E.state==="failed"?E.error:null,qs=m.workspaces,w=m.workspaces.find(n=>n.id===m.activeWorkspaceId)??null,se=Ie({layout:w?.layout,columns:w?.columns,cellCount:w?.tiles.length??0}),Y=l.useMemo(()=>(w?.tiles??[]).map(n=>Cn(n,E.sessions,w?.id??"")),[w?.id,w?.tiles,E.sessions]),Le=Re(se,{tileCount:Y.length});l.useEffect(()=>{if(!w||!x.current.has(w.id))return;const n=_e(w,{sessions:E.sessions}),a=JSON.stringify(n);x.current.get(w.id)!==a&&(x.current.set(w.id,a),Ss(n).catch(u=>ee(u instanceof Error?u.message:String(u))))},[w,E.sessions]);const ls=h==="workspace"&&!w?"library":h,O=l.useCallback(n=>{d(a=>{const u=a.workspaces.find(y=>y.id===a.activeWorkspaceId);if(!u)return a;const p=n(u.tiles);return p===u.tiles?a:ys(a,u.id,{tiles:p,updatedAt:Date.now()})})},[d]),je=l.useCallback(n=>{d(a=>a.activeWorkspaceId?ys(a,a.activeWorkspaceId,{layout:n,updatedAt:Date.now()}):a)},[d]),Hs=l.useCallback(n=>{d(a=>qt(a,n.id)),W(!1),o("workspace")},[d,o]),Vs=l.useCallback(()=>{o("library")},[o]),ie=l.useCallback(n=>{S(n?.id??null),L(n?.name??""),N(n?.purpose??""),I(n?Ie({layout:n.layout,columns:n.columns,cellCount:n.tiles.length}):ws),$(n?.tiles??Array.from({length:4},()=>le("pty"))),R(0),o("builder")},[o]),Ys=l.useCallback(n=>{I(a=>n.mode==="solo"?{mode:"solo"}:{mode:n.mode,columns:a.columns??"dynamic"}),$(a=>a.length>=n.minimumCells?a:[...a,...Array.from({length:n.minimumCells-a.length},()=>le("pty"))]),R(a=>Math.max(0,Math.min(a,n.minimumCells-1)))},[]),Js=l.useCallback(n=>{I(a=>a.mode==="solo"?{mode:"lanes",columns:n}:{...a,columns:n})},[]),Gs=l.useCallback(()=>{$(n=>{const a=[...n,le("pty")];return R(a.length-1),a})},[]),Xs=l.useCallback(n=>{$(a=>{if(a.length<=1)return a;const u=a.filter((p,y)=>y!==n);return R(p=>Math.min(p,u.length-1)),u})},[]),Qs=l.useCallback(()=>{const n=C.trim();if(!n)return;const a={id:b??we("workspace"),name:n,purpose:z.trim(),columns:Re(j,{tileCount:A.length}),layout:j,tiles:A,updatedAt:Date.now()};d(p=>xs(p,a));const u=_e(a,{sessions:E.sessions});x.current.set(a.id,JSON.stringify(u)),Ss(u).catch(p=>ee(p instanceof Error?p.message:String(p))),W(!1),o("workspace")},[b,d,o,E.sessions,A,j,C,z]),Zs=l.useCallback(n=>{d(a=>Ht(a,n,{allowEmpty:!0})),un(n).catch(()=>{})},[d]),cs=l.useCallback((n,a="shell")=>{O(u=>[...u,le(n,a)])},[O]),oe=l.useCallback((n,a)=>{const u={kind:"registered",terminalSessionId:n.session.id,terminalSurfaceKey:U(n.surface)};O(p=>{const y=p.some(v=>v.kind==="registered"&&v.terminalSessionId===u.terminalSessionId&&Ue(v.terminalSurfaceKey,u.terminalSurfaceKey));return a?p.some(v=>v.id===a)?p.map(v=>v.id===a?{...u,id:v.id}:v):p:y?p:[...p,{...u,id:we("cell")}]})},[O]),et=l.useCallback(n=>{oe(n)},[oe]),st=l.useMemo(()=>new Set(Y.filter(n=>n.kind==="registered").map(n=>Ee(n.target))),[Y]),ge=l.useCallback(n=>{n?.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId),xe.current=null,ye.current=null,Me.current=!1,D(null),P(null),rs(!1)},[]),tt=l.useCallback((n,a)=>{const u=n.target;n.button!==0||u instanceof Element&&u.closest("button, a")||(xe.current={pointerId:n.pointerId,target:G(a),targetId:Ee(G(a)),startX:n.clientX,startY:n.clientY},n.currentTarget.setPointerCapture(n.pointerId))},[]),nt=l.useCallback(n=>{const a=xe.current;if(!a||a.pointerId!==n.pointerId||Math.hypot(n.clientX-a.startX,n.clientY-a.startY)<6&&!k)return;k||D(a.targetId);const p=document.querySelector(".s-term--workspace");if(p){const fs=p.getBoundingClientRect();n.clientY<fs.top+72&&(p.scrollTop-=28),n.clientY>fs.bottom-72&&(p.scrollTop+=28)}const y=document.elementFromPoint(n.clientX,n.clientY),v=y?.closest(".s-term-workspace-cell"),J=!!(y?.closest(".s-term-workspace-add-cell")||!v&&y?.closest(".s-term--workspace")&&!y?.closest(".s-term-picker")),hs=J?null:v?.dataset.terminalTileId??null;ye.current=hs,Me.current=J,P(hs),rs(J)},[k]),rt=l.useCallback(n=>{const a=xe.current;!a||a.pointerId!==n.pointerId||(Me.current?oe(a.target):ye.current&&oe(a.target,ye.current),ge(n))},[ge,oe]),at=l.useCallback(n=>{ge(n)},[ge]),it=l.useCallback(()=>{const n=V.map(G);n.length!==0&&O(a=>{const u=a.filter(y=>y.kind==="registered"),p=n.filter(y=>!u.some(v=>v.kind==="registered"&&v.terminalSessionId===y.session.id&&Ue(v.terminalSurfaceKey,U(y.surface)))).map(y=>({id:we("cell"),kind:"registered",terminalSessionId:y.session.id,terminalSurfaceKey:U(y.surface)}));return p.length===0?a:[...a,...p]})},[V,O]),De=l.useCallback(n=>{O(a=>{const u=a.filter(p=>p.id!==n);return u.length===a.length?a:u})},[O]),ds=l.useCallback((n,a,u)=>{n!==a&&O(p=>Yt(p,n,a,u))},[O]),ze=l.useCallback((n,a)=>{O(u=>{const p=u.findIndex(J=>J.id===n),y=p+a;if(p<0||y<0||y>=u.length)return u;const v=[...u];return[v[p],v[y]]=[v[y],v[p]],v})},[O]),ms=l.useCallback((n,a)=>{O(u=>u.map(p=>p.id===n?{id:p.id,kind:"fresh",backend:a,agent:"shell"}:p))},[O]),Se=l.useCallback(()=>[...vs.map(n=>({kind:"action",label:n.label,onSelect:()=>je(n.mode==="solo"?{mode:"solo"}:{mode:n.mode,columns:se.columns??"dynamic"})})),...se.mode==="solo"?[]:[{kind:"separator"},{kind:"action",label:"Dynamic columns",onSelect:()=>je({...se,columns:"dynamic"})},...Array.from({length:Qe},(n,a)=>({kind:"action",label:a===0?"One column":`${a+1} columns`,onSelect:()=>je({...se,columns:a+1})}))],{kind:"separator"},{kind:"action",label:"Edit workspace…",onSelect:()=>w&&ie(w)}],[w,je,ie,se]),ot=l.useCallback(n=>{r(n,Se())},[Se,r]),lt=l.useCallback((n,a)=>{const u=Y.findIndex(y=>y.id===a.id),p=[];u>0&&p.push({kind:"action",label:"Move left",onSelect:()=>ze(a.id,-1)}),u>=0&&u<Y.length-1&&p.push({kind:"action",label:"Move right",onSelect:()=>ze(a.id,1)}),p.length>0&&p.push({kind:"separator"}),p.push(...c.map(y=>({kind:"action",label:y.value==="pty"?"Replace with a disposable shell":`Replace with a session that survives (${y.label})`,onSelect:()=>ms(a.id,y.value)})),{kind:"separator"},{kind:"action",label:"Remove cell",onSelect:()=>De(a.id)},{kind:"separator"},...Se()),r(n,p)},[De,Se,ze,ms,r,c,Y]),ct=l.useCallback((n,a)=>{const u=n.target;n.button===0&&u instanceof Element&&u.closest(".s-term-bar")&&!u.closest("button, a")&&(fe.current={pointerId:n.pointerId,tileId:a,startX:n.clientX,startY:n.clientY},n.currentTarget.setPointerCapture(n.pointerId))},[]),dt=l.useCallback(n=>{const a=fe.current;if(!a||a.pointerId!==n.pointerId||Math.hypot(n.clientX-a.startX,n.clientY-a.startY)<6&&!he)return;he||as(a.tileId);const p=document.elementFromPoint(n.clientX,n.clientY)?.closest(".s-term-workspace-cell"),y=p?.dataset.terminalTileId??null;if(!p||!y||y===a.tileId){ke.current=null,be.current="after",Ae(null);return}const v=p.getBoundingClientRect(),J=Vt({x:n.clientX,y:n.clientY},{left:v.left,top:v.top,width:v.width,height:v.height},Le);ke.current=y,be.current=J.edge,Ae(y)},[he,Le]),us=l.useCallback(n=>{const a=fe.current;if(!a||a.pointerId!==n.pointerId)return;const u=ke.current;u&&ds(a.tileId,u,be.current),n.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId),fe.current=null,ke.current=null,be.current="after",as(null),Ae(null)},[ds]),mt=l.useMemo(()=>pn(Q.find(n=>n.workspaceId===w?.id)),[w?.id,Q]),ps=l.useCallback(n=>{ae(a=>wt(a,n))},[]),ut=l.useCallback(()=>{H(),f(n=>n+1)},[H]),pt=l.useCallback(n=>{w&&mn(w.id,n).then(()=>{ee(null),H()}).catch(a=>ee(a instanceof Error?a.message:String(a)))},[w,H]);return ls==="library"?e.jsx(En,{workspaces:qs,sessionsReady:E.state!=="loading",onOpen:Hs,onCreate:()=>ie(),onEdit:ie,onDelete:Zs}):ls==="builder"?e.jsx(An,{editing:!!b,name:C,purpose:z,modes:vs,layout:j,startOptions:c,cells:A,selectedSlot:T,terminalItems:V,onNameChange:L,onPurposeChange:N,onApplyMode:Ys,onColumnsChange:Js,onSelectSlot:R,onAddCell:Gs,onRemoveCell:Xs,pickerView:F,pickerSort:re,onPickerView:ne,onPickerSort:ps,onAssignFresh:(n,a="shell")=>$(u=>u.map((p,y)=>y===T?{id:p.id,kind:"fresh",backend:n,agent:a}:p)),onAssignRegistered:n=>$(a=>a.map((u,p)=>p===T?{id:u.id,kind:"registered",terminalSessionId:n.session.id,terminalSurfaceKey:U(n.surface)}:u)),onCancel:()=>{o(w?"workspace":"library")},onSave:Qs}):e.jsx("div",{className:"s-term s-term--workspace",children:e.jsxs("div",{className:"s-term-workspace",children:[e.jsxs("header",{className:"s-term-workspace-head",children:[e.jsxs("div",{className:"s-term-workspace-title",children:[e.jsxs("span",{className:"s-term-summary-mark",children:[e.jsx(de,{size:18,strokeWidth:1.7}),e.jsxs("span",{children:["Workspaces / ",w?.name??"Workspace"]})]}),e.jsx("h1",{children:w?.name??"Workspace"}),w?.purpose&&e.jsx("p",{children:w.purpose})]}),e.jsxs("div",{className:"s-term-workspace-actions","aria-label":"Terminal workspace actions",children:[e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:Vs,children:e.jsx("span",{children:"All workspaces"})}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>w&&ie(w),children:[e.jsx(de,{size:14,strokeWidth:1.8}),e.jsx("span",{children:"Edit workspace"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:()=>cs("pty"),title:"Add a shell tile",children:[e.jsx(te,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Shell"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>cs("pty","codex"),title:"Add a Codex TUI tile",children:[e.jsx(te,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Codex"})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:()=>W(n=>!n),title:g?"Hide terminal picker":"Show terminal picker","aria-pressed":g,children:[e.jsx(K,{size:14,strokeWidth:1.8}),e.jsx("span",{children:g?"Hide picker":"Show picker"})]}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:ut,disabled:E.state==="loading",title:"Reload all terminal tiles","aria-label":"Reload all terminal tiles",children:e.jsx(Ge,{size:14,strokeWidth:1.8})})]})]}),os&&e.jsxs("div",{className:"s-term-home-error",children:[e.jsx("span",{children:"Terminal registry unavailable"}),e.jsx("code",{children:os})]}),pe&&e.jsxs("div",{className:"s-term-home-error",children:[e.jsx("span",{children:"This workspace is not saved to Scout — it will not follow you to another device"}),e.jsx("code",{children:pe})]}),(Y.length>0||g)&&e.jsxs("div",{className:"s-term-workspace-grid","aria-label":"Terminal tiles",style:{"--terminal-grid-columns":Le},onContextMenu:ot,children:[Y.map(n=>e.jsx("div",{className:`s-term-workspace-cell${he===n.id?" s-term-workspace-cell--dragging":""}${Bs===n.id||M===n.id?" s-term-workspace-cell--drop-target":""}`,"data-terminal-tile-id":n.id,onPointerDownCapture:a=>ct(a,n.id),onPointerMove:dt,onPointerUp:us,onPointerCancel:us,onContextMenu:a=>lt(a,n),children:e.jsx(Ln,{tile:n,navigate:s,onClose:De,resolution:mt.get(n.id)??null,onRevive:pt,live:vn(n,E.sessions)})},`${n.id}:${B}`)),g&&e.jsxs("button",{type:"button",className:`s-term-workspace-add-cell${_?" s-term-workspace-add-cell--target":""}`,onClick:()=>W(!0),children:[e.jsx(te,{size:20,strokeWidth:1.7}),e.jsx("strong",{children:"New slot"}),e.jsx("span",{children:k?"Drop to add":"Drag a terminal here"})]})]}),e.jsxs("section",{className:`s-term-picker${g?"":" s-term-picker--collapsed"}`,"aria-labelledby":"terminal-picker-title",onPointerDownCapture:n=>{const a=n.target;if(!(a instanceof Element))return;const u=a.closest("[data-picker-item-id]")?.dataset.pickerItemId,p=V.find(y=>y.id===u);p&&tt(n,p)},onPointerMove:nt,onPointerUp:rt,onPointerCancel:at,children:[e.jsxs("header",{className:"s-term-picker-head",children:[e.jsxs("div",{className:"s-term-picker-title",children:[e.jsx(K,{size:14,strokeWidth:1.8}),e.jsx("h2",{id:"terminal-picker-title",children:"Terminal picker"}),e.jsx("span",{children:E.state==="loading"?"syncing":V.length})]}),e.jsxs("div",{className:"s-term-picker-actions",children:[g&&e.jsx("div",{className:"s-term-picker-views",role:"group","aria-label":"Picker view",children:["list","table"].map(n=>e.jsx("button",{type:"button",className:F===n?"is-selected":"",onClick:()=>ne(n),"aria-pressed":F===n,children:n==="list"?"List":"Table"},n))}),g&&e.jsxs("button",{type:"button",className:"s-term-workspace-action",onClick:it,disabled:V.length===0,children:[e.jsx(Ds,{size:13,strokeWidth:1.8}),e.jsx("span",{children:"Attach all"})]}),e.jsxs("button",{type:"button",className:"s-term-picker-toggle",onClick:()=>W(n=>!n),"aria-expanded":g,children:[e.jsx("span",{children:g?"Hide":"Show terminal picker"}),e.jsx("span",{"aria-hidden":"true",children:g?"⌄":"⌃"})]})]})]}),g&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"s-term-picker-hint",children:"Drag a terminal onto a cell to place it, or onto New slot to grow the grid."}),V.length===0&&E.state!=="loading"?e.jsx("div",{className:"s-term-picker-empty",children:"No live terminals"}):e.jsx(Ks,{items:V,view:F,sort:re,attachedIds:st,draggedTargetId:k,onSort:ps,onAttach:et})]})]})]})})}function En({workspaces:s,sessionsReady:t,onOpen:r,onCreate:i,onEdit:c,onDelete:m}){return e.jsx("div",{className:"s-term s-term--workspace-library",children:e.jsxs("main",{className:"s-term-workspace-library",children:[e.jsxs("header",{className:"s-term-workspace-library-head",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"s-term-summary-mark",children:[e.jsx(de,{size:18,strokeWidth:1.7}),e.jsx("span",{children:"Terminals"})]}),e.jsx("h1",{children:"Workspaces"}),e.jsx("p",{children:"Saved terminal layouts for projects, roles, and cross-project operations."})]}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:i,children:[e.jsx(te,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"New workspace"})]})]}),s.length===0?e.jsxs("section",{className:"s-term-workspace-library-empty",children:[e.jsx(de,{size:24,strokeWidth:1.5}),e.jsx("h2",{children:"Create your first terminal workspace"}),e.jsx("p",{children:"Choose a layout, give it a purpose, place sessions, then enter the grid."}),e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:i,children:[e.jsx(te,{size:14,strokeWidth:1.9}),e.jsx("span",{children:"Create workspace"})]})]}):e.jsx("div",{className:"s-term-workspace-library-grid",children:s.map(d=>e.jsxs("article",{className:"s-term-workspace-card",children:[e.jsx("div",{className:"s-term-workspace-card-preview",style:{"--terminal-grid-columns":d.columns??Pe},children:d.tiles.map(h=>e.jsx("span",{className:h.kind==="registered"?"is-session":"is-shell"},h.id))}),e.jsxs("div",{className:"s-term-workspace-card-copy",children:[e.jsxs("span",{children:[d.columns??Pe," column",(d.columns??Pe)===1?"":"s"," · ",d.tiles.length," cells"]}),e.jsx("h2",{children:d.name}),e.jsx("p",{children:d.purpose||"No purpose added yet."})]}),e.jsxs("div",{className:"s-term-workspace-card-actions",children:[e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:()=>c(d),children:"Edit"}),e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:()=>m(d.id),children:"Delete"}),e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>r(d),disabled:!t,children:"Enter workspace"})]})]},d.id))})]})})}function Be(s,t){return s==="solo"?1:s==="lanes"?Math.max(2,Math.min(4,t)):Math.max(2,Math.min(3,t))}function Wn(s,t){return s==="solo"?1:s==="lanes"?Be(s,t):Be(s,t)*2}function An({editing:s,name:t,purpose:r,modes:i,layout:c,startOptions:m,cells:d,selectedSlot:h,terminalItems:o,onNameChange:x,onPurposeChange:b,onApplyMode:S,onColumnsChange:C,onSelectSlot:L,onAddCell:z,onRemoveCell:N,pickerView:j,pickerSort:I,onPickerView:A,onPickerSort:$,onAssignFresh:T,onAssignRegistered:R,onCancel:E,onSave:q}){const B=Re(c,{tileCount:d.length});return e.jsx("div",{className:"s-term s-term--workspace-builder",children:e.jsxs("main",{className:"s-term-workspace-builder",children:[e.jsxs("header",{className:"s-term-workspace-builder-head",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"s-term-summary-mark",children:[e.jsx(de,{size:18,strokeWidth:1.7}),e.jsx("span",{children:"Workspace builder"})]}),e.jsx("h1",{children:s?"Edit workspace":"Create a workspace"}),e.jsx("p",{children:"Define the job, choose the grid, and place the sessions before entering."})]}),e.jsxs("div",{className:"s-term-workspace-builder-actions",children:[e.jsx("button",{type:"button",className:"s-term-workspace-action",onClick:E,children:"Cancel"}),e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:q,disabled:!t.trim(),children:s?"Save and enter":"Create and enter"})]})]}),e.jsxs("section",{className:"s-term-workspace-builder-identity","aria-label":"Workspace identity",children:[e.jsxs("label",{children:[e.jsx("span",{children:"Name"}),e.jsx("input",{value:t,onChange:f=>x(f.target.value),placeholder:"Release desk",autoFocus:!0})]}),e.jsxs("label",{children:[e.jsx("span",{children:"Purpose"}),e.jsx("input",{value:r,onChange:f=>b(f.target.value),placeholder:"Cross-project release monitoring"})]})]}),e.jsxs("section",{className:"s-term-workspace-builder-layout","aria-labelledby":"workspace-layout-title",children:[e.jsxs("div",{className:"s-term-workspace-builder-section-head",children:[e.jsxs("div",{children:[e.jsx("span",{children:"Step 1"}),e.jsx("h2",{id:"workspace-layout-title",children:"Choose the layout"})]}),e.jsxs("p",{children:[zt(c)," · ",d.length," cell",d.length===1?"":"s"]})]}),e.jsx("div",{className:"s-term-grid-presets","aria-label":"Workspace layout",children:i.map(f=>e.jsxs("button",{type:"button",className:`s-term-grid-preset${f.mode===c.mode?" s-term-grid-preset--selected":""}`,onClick:()=>S(f),"aria-pressed":f.mode===c.mode,children:[e.jsx("span",{className:"s-term-grid-preset-map",style:{"--terminal-preset-columns":Be(f.mode,B)},"aria-hidden":"true",children:Array.from({length:Wn(f.mode,B)},(g,W)=>e.jsx("i",{},W))}),e.jsx("span",{className:"s-term-grid-preset-label",children:f.label}),e.jsx("span",{className:"s-term-grid-preset-detail",children:f.detail})]},f.mode))}),c.mode!=="solo"&&e.jsxs("div",{className:"s-term-workspace-builder-columns",role:"group","aria-label":"Columns",children:[e.jsx("span",{children:"Columns"}),e.jsx("button",{type:"button",className:c.columns==="dynamic"||c.columns===void 0?"is-selected":"",onClick:()=>C("dynamic"),"aria-pressed":c.columns==="dynamic"||c.columns===void 0,title:"Fit the columns to the number of tiles",children:"Dynamic"}),Array.from({length:Qe},(f,g)=>e.jsx("button",{type:"button",className:c.columns===g+1?"is-selected":"",onClick:()=>C(g+1),"aria-pressed":c.columns===g+1,children:g+1},g)),(c.columns==="dynamic"||c.columns===void 0)&&e.jsxs("em",{children:[B," right now"]})]})]}),e.jsxs("section",{className:"s-term-workspace-builder-placement","aria-labelledby":"workspace-placement-title",children:[e.jsxs("div",{className:"s-term-workspace-builder-section-head",children:[e.jsxs("div",{children:[e.jsx("span",{children:"Step 2"}),e.jsx("h2",{id:"workspace-placement-title",children:"Place terminals"})]}),e.jsx("p",{children:"Select a cell, then choose a session or shell. Add as many cells as the work needs."})]}),e.jsxs("div",{className:"s-term-workspace-builder-canvas",children:[e.jsxs("div",{className:"s-term-workspace-builder-grid",style:{"--terminal-grid-columns":B},children:[d.map((f,g)=>{const W=f.kind==="registered"?o.find(F=>F.session.id===f.terminalSessionId&&Ue(U(F.surface),f.terminalSurfaceKey)):null;return e.jsxs("div",{className:`s-term-workspace-builder-cell${h===g?" is-selected":""}`,children:[e.jsxs("button",{type:"button",className:"s-term-workspace-builder-cell-select",onClick:()=>L(g),"aria-pressed":h===g,children:[e.jsx("span",{children:String(g+1).padStart(2,"0")}),e.jsx(K,{size:17,strokeWidth:1.7}),e.jsx("strong",{children:f.kind==="registered"?W?.title??"Unavailable session":ns(f.backend,f.agent).title}),e.jsx("small",{children:f.kind==="registered"?W?.cwdLabel||W?.detail:f.backend})]}),d.length>1&&e.jsx("button",{type:"button",className:"s-term-workspace-builder-cell-remove",onClick:()=>N(g),title:"Remove this cell","aria-label":`Remove cell ${g+1}`,children:e.jsx(ue,{size:13,strokeWidth:1.9})})]},f.id)}),e.jsxs("button",{type:"button",className:"s-term-workspace-builder-cell s-term-workspace-builder-cell--add",onClick:z,children:[e.jsx(te,{size:18,strokeWidth:1.7}),e.jsx("strong",{children:"Add cell"})]})]}),e.jsxs("aside",{className:"s-term-workspace-builder-source",children:[e.jsxs("span",{children:["Cell ",String(h+1).padStart(2,"0")]}),e.jsx("h3",{children:"Start something new"}),e.jsxs("div",{className:"s-term-workspace-builder-source-actions",children:[kn.map(f=>e.jsx("button",{type:"button",onClick:()=>T("pty",f.value),children:f.label},f.value)),m.filter(f=>f.value!=="pty").map(f=>e.jsxs("button",{type:"button",onClick:()=>T(f.value,"shell"),title:f.relayAttach?f.detail:`${f.detail} — Scout starts it; open it in ${f.label} to use it`,children:[f.label,!f.relayAttach&&e.jsx("sup",{"aria-label":"opens outside Scout",children:" ↗"})]},f.value))]}),e.jsxs("div",{className:"s-term-workspace-builder-source-head",children:[e.jsx("h3",{children:"Or use a live session"}),e.jsx("div",{className:"s-term-picker-views",role:"group","aria-label":"Session picker view",children:["list","table"].map(f=>e.jsx("button",{type:"button",className:j===f?"is-selected":"",onClick:()=>A(f),"aria-pressed":j===f,children:f==="list"?"List":"Table"},f))})]}),e.jsx("div",{className:"s-term-workspace-builder-sessions",children:o.length===0?e.jsx("span",{className:"s-term-workspace-builder-no-sessions",children:"No live sessions"}):e.jsx(Ks,{items:o,view:j,sort:I,attachedIds:new Set,draggedTargetId:null,onSort:$,onAttach:f=>{const g=o.find(W=>W.session.id===f.session.id&&W.surface.sessionName===f.surface.sessionName);g&&R(g)}})})]})]})]})]})})}function Mn({item:s,attached:t,dragging:r,onAttach:i}){return e.jsxs("article",{className:`s-term-picker-item${t?" s-term-picker-item--attached":""}${r?" s-term-picker-item--dragging":""}`,"data-picker-item-id":s.id,children:[e.jsx("span",{className:"s-term-picker-grip","aria-hidden":"true",children:"⠿"}),e.jsxs("div",{className:"s-term-picker-item-main",children:[e.jsx("strong",{title:s.surface.sessionName,children:s.title}),e.jsx("span",{title:s.session.cwd??s.detail,children:s.cwdLabel||s.detail})]}),e.jsxs("div",{className:"s-term-picker-item-meta",children:[e.jsx("span",{children:s.surface.backend}),e.jsx("span",{children:zs(s)}),e.jsx("span",{title:s.session.cwd??void 0,children:s.project})]}),e.jsx("button",{type:"button",className:"s-term-picker-add",onClick:()=>i(G(s)),disabled:t,children:t?"In grid":"Add"})]})}function Ks({items:s,view:t,sort:r,attachedIds:i,draggedTargetId:c,onSort:m,onAttach:d}){const h=l.useMemo(()=>Ct(s,r),[s,r]);return t==="table"?e.jsx("div",{className:"s-term-picker-table-wrap",children:e.jsxs("table",{className:"s-term-picker-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[Tt.map(o=>e.jsx("th",{scope:"col","aria-sort":r.column===o.id?r.direction==="asc"?"ascending":"descending":"none",children:e.jsxs("button",{type:"button",onClick:()=>m(o.id),children:[e.jsx("span",{children:o.label}),e.jsx("em",{"aria-hidden":"true",children:r.column===o.id?r.direction==="asc"?"▲":"▼":"·"})]})},o.id)),e.jsx("th",{scope:"col","aria-label":"Place"})]})}),e.jsx("tbody",{children:h.map(o=>{const x=Ee(G(o)),b=It(o);return e.jsxs("tr",{"data-picker-item-id":o.id,className:i.has(x)?"is-attached":void 0,children:[e.jsx("td",{title:o.surface.sessionName,children:o.title}),e.jsx("td",{children:o.surface.backend}),e.jsx("td",{children:zs(o)}),e.jsx("td",{title:o.session.cwd??void 0,children:o.project}),e.jsx("td",{children:b?Wt(b):"—"}),e.jsx("td",{children:e.jsx("button",{type:"button",className:"s-term-picker-add",onClick:()=>d(G(o)),disabled:i.has(x),children:i.has(x)?"In grid":"Add"})})]},o.id)})})]})}):e.jsx("div",{className:"s-term-picker-list","aria-label":"Available terminals",children:h.map(o=>{const x=Ee(G(o));return e.jsx(Mn,{item:o,attached:i.has(x),dragging:c===x,onAttach:d},o.id)})})}function Ln({tile:s,navigate:t,onClose:r,resolution:i,onRevive:c,live:m=!1}){if(s.kind==="registered")return e.jsx(On,{tile:s,navigate:t,onClose:r});if(s.kind==="unavailable"){const d=i?.status==="revivable"&&!!c;return e.jsxs("section",{className:"s-term-workspace-tile s-term-workspace-tile--unavailable","aria-label":"Unavailable terminal session",children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsxs("div",{className:"s-term-bar-left",children:[e.jsx("span",{className:"s-term-workspace-tile-mark",children:e.jsx(K,{size:14,strokeWidth:1.8})}),e.jsx("span",{className:"s-term-workspace-tile-name",children:"Not running"})]}),e.jsx("div",{className:"s-term-bar-actions",children:e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>r(s.id),title:"Remove cell","aria-label":"Remove cell",children:e.jsx(ue,{size:14,strokeWidth:1.8})})})]}),e.jsxs("div",{className:"s-term-workspace-unavailable-body",children:[e.jsx(K,{size:22,strokeWidth:1.5}),e.jsx("strong",{children:d?"This tile is not running.":"This saved session is not currently live."}),e.jsx("span",{children:i?.detail??"Show the terminal picker to replace it, or wait for the session to reconnect."}),d&&e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:()=>c?.(s.id),children:"Start it again"})]})]})}return!Ms(s.backend)&&s.backend!=="pty"?e.jsx(Dn,{tile:s,onClose:r,live:m}):e.jsx(zn,{tile:s,navigate:t,onClose:r})}function Dn({tile:s,onClose:t,live:r}){const{hosts:i}=es(),c=rn(i,s.backend),[m,d]=l.useState("idle"),[h,o]=l.useState(null),x=l.useCallback(()=>{s.sessionName&&(d("starting"),o(null),ln(s.backend,{sessionName:s.sessionName}).then(()=>d("idle")).catch(b=>{d("failed"),o(b instanceof Error?b.message:String(b))}))},[s.backend,s.sessionName]);return e.jsxs("section",{className:"s-term-workspace-tile s-term-workspace-tile--hosted","aria-label":`${c?.label??s.backend} session`,children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsxs("div",{className:"s-term-bar-left",children:[e.jsx("span",{className:"s-term-workspace-tile-mark",children:e.jsx(K,{size:14,strokeWidth:1.8})}),e.jsx("span",{className:"s-term-workspace-tile-name",children:c?.label??s.backend})]}),e.jsx("div",{className:"s-term-bar-meta",children:e.jsx("span",{className:"s-term-label",children:r?"running":"not running"})}),e.jsx("div",{className:"s-term-bar-actions",children:e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>t(s.id),title:"Remove cell","aria-label":"Remove cell",children:e.jsx(ue,{size:14,strokeWidth:1.8})})})]}),e.jsxs("div",{className:"s-term-workspace-unavailable-body",children:[e.jsx(K,{size:22,strokeWidth:1.5}),e.jsx("strong",{children:r?`Running in ${c?.label??s.backend}`:"Not running yet"}),e.jsx("span",{children:r?`Scout keeps this session for you. Open it in ${c?.label??s.backend} to use it.`:`Scout can start a ${c?.label??s.backend} session and keep it for you.`}),!r&&e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:x,disabled:m==="starting"||!s.sessionName,children:m==="starting"?"Starting…":"Start it"}),h&&e.jsx("code",{children:h})]})]})}function zn({tile:s,navigate:t,onClose:r}){const i=l.useRef(null),c=qe(),m=He(),d=ns(s.backend,s.agent),h=Tn(s),o=["scout-terminal-workspace",s.id,s.backend,s.agent,s.sessionName??"pty"].join("-"),x=Je({url:c,healthUrl:m,autoConnect:!0,sessionKey:o,backend:s.backend,...s.sessionName?{terminalSession:s.sessionName}:{},...s.backend==="tmux"&&s.sessionName?{tmuxSession:s.sessionName}:{},...s.backend==="zellij"&&s.sessionName?{zellijSession:s.sessionName}:{},...s.backend==="zellij"&&s.zellijSocketDir?{zellijSocketDir:s.zellijSocketDir}:{},agent:s.agent,controlMode:"takeover"});ce(()=>{x.resize(Ve,Ye)},[x.resize]);const b=l.useCallback(()=>{h&&Us(h,t)},[t,h]);return e.jsx("section",{className:"s-term-workspace-tile","aria-label":d.title,children:e.jsxs("div",{className:"s-term s-term--embedded",children:[e.jsxs("div",{className:"s-term-bar s-term-bar--fresh",children:[e.jsxs("div",{className:"s-term-bar-left",children:[e.jsx("span",{className:"s-term-workspace-tile-mark",children:e.jsx(K,{size:14,strokeWidth:1.8})}),e.jsx("span",{className:"s-term-workspace-tile-name",children:d.title})]}),e.jsxs("div",{className:"s-term-bar-meta",children:[e.jsx("span",{className:"s-term-label",children:s.backend}),e.jsx("span",{className:"s-term-session",children:d.detail})]}),e.jsxs("div",{className:"s-term-bar-actions",children:[e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:()=>x.restart(),title:"Restart terminal","aria-label":"Restart terminal",children:e.jsx(Ge,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:b,title:"Open terminal in a new window","aria-label":"Open terminal in a new window",children:e.jsx(Ps,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>r(s.id),title:"Close tile","aria-label":"Close tile",children:e.jsx(ue,{size:14,strokeWidth:1.8})})]})]}),e.jsx("div",{ref:i,className:"s-term-body",onMouseDown:()=>{i.current?.querySelector(".xterm-helper-textarea")?.focus(),i.current?.querySelector(".xterm")?.focus()},children:e.jsx(ss,{relay:x,quiet:!0,configItems:[{label:"backend",value:s.backend},{label:"agent",value:s.agent},...s.sessionName?[{label:"session",value:s.sessionName}]:[],...s.zellijSocketDir?[{label:"socket",value:s.zellijSocketDir}]:[],{label:"ws",value:c},{label:"health",value:m}]})})]})})}function On({tile:s,navigate:t,onClose:r}){const i=l.useCallback(()=>{Us(In(s.target),t)},[t,s.target]);return e.jsx("section",{className:"s-term-workspace-tile","aria-label":s.target.surface.sessionName,children:e.jsx(ts,{agent:null,mode:"takeover",navigate:t,registeredTarget:s.target,embedded:!0,tileActions:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:i,title:"Open terminal in a new window","aria-label":"Open terminal in a new window",children:e.jsx(Ps,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:()=>r(s.id),title:"Close tile","aria-label":"Close tile",children:e.jsx(ue,{size:14,strokeWidth:1.8})})]})})})}function Pn(s){return[...s].filter(t=>!t.retiredFromFleet).sort((t,r)=>{const i=+!!Ce(r)-+!!Ce(t);if(i!==0)return i;const c=(r.updatedAt??0)-(t.updatedAt??0);return c!==0?c:t.name.localeCompare(r.name)})}function _n({route:s,navigate:t}){const r=l.useRef(null),i=s.terminalBackend??"pty",c=s.terminalAgent??"shell",m=s.terminalTabId??"adhoc",d=i==="pty"?void 0:`scout-${i}-${m}`,h=s.terminalSessionName??d,o=qe(),x=He(),b=ns(i,c),S=["scout-terminal-new",i,c,h??m].join("-"),C=Je({url:o,healthUrl:x,autoConnect:!0,sessionKey:S,backend:i,...h?{terminalSession:h}:{},...i==="tmux"&&h?{tmuxSession:h}:{},...i==="zellij"&&h?{zellijSession:h}:{},...i==="zellij"&&s.zellijSocketDir?{zellijSocketDir:s.zellijSocketDir}:{},agent:c,controlMode:"takeover"}),L=l.useRef([]),z=l.useRef({status:C.status,sendLine:C.sendLine});return z.current={status:C.status,sendLine:C.sendLine},ce(()=>{const N=j=>{const I=hn(j);if(!I)return;const A=z.current;if(A.status==="connected"){A.sendLine(I);return}L.current=[...L.current.slice(-15),I]};return window.addEventListener(Ns,N),()=>window.removeEventListener(Ns,N)},[]),ce(()=>{if(C.status!=="connected"||L.current.length===0)return;const N=L.current;L.current=[];for(const j of N)C.sendLine(j)},[C.sendLine,C.status]),ce(()=>{C.resize(Ve,Ye)},[C.resize]),e.jsxs("div",{className:"s-term",children:[e.jsxs("div",{className:"s-term-bar",children:[e.jsx(me,{slot:"terminal",fallback:{view:"terminal"},navigate:t,className:"s-term-back"}),e.jsx("span",{className:"s-term-label",children:b.title}),e.jsx("div",{className:"s-term-status",children:b.detail}),e.jsx("div",{className:"s-term-actions",children:e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:()=>C.restart(),title:"Restart terminal","aria-label":"Restart terminal",children:e.jsx(Ge,{size:14,strokeWidth:1.8})})})]}),e.jsx("div",{ref:r,className:"s-term-body",onMouseDown:()=>{r.current?.querySelector(".xterm-helper-textarea")?.focus(),r.current?.querySelector(".xterm")?.focus()},children:e.jsx(ss,{relay:C,quiet:!0,configItems:[{label:"backend",value:i},{label:"agent",value:c},...h?[{label:"session",value:h}]:[],...s.zellijSocketDir?[{label:"socket",value:s.zellijSocketDir}]:[],{label:"ws",value:o},{label:"health",value:x}]})})]})}function ns(s,t){const r=t==="shell"?"Shell":t==="codex"?"Codex":t==="pi"?"Pi":"Claude";return s==="pty"?{title:r,detail:"fresh PTY tab"}:{title:`${r} ${s}`,detail:`fresh ${s} backed tab`}}function $n({agentId:s,agent:t,mode:r,navigate:i,children:c}){const m=jn(s,t,r);return m.ready?e.jsx(e.Fragment,{children:c}):e.jsx(Sn,{agent:t,agentId:s,color:Is(t.name),navigate:i,label:m.label,status:m.status,onRetry:m.onRetry})}function Fn({navigate:s}){return e.jsx("div",{className:"s-term",children:e.jsxs("div",{className:"s-term-bar",children:[e.jsx(me,{slot:"terminal",fallback:{view:"terminal"},navigate:s,className:"s-term-back"}),e.jsx("span",{className:"s-term-label",children:"Terminal"}),e.jsx("div",{className:"s-term-status",children:"Resolving agent..."})]})})}function Un({route:s,navigate:t}){const{agentId:r,mode:i,terminalSessionId:c,terminalSurfaceKey:m}=s,{agents:d}=Os();if(s.terminalBackend)return e.jsx(_n,{route:s,navigate:t});if(!r)return!c&&!m?e.jsx(Rn,{navigate:t}):e.jsx(wn,{terminalSessionId:c,terminalSurfaceKey:m,mode:i,navigate:t});const h=d.find(b=>b.id===r)??null;if(!h)return e.jsx(Fn,{navigate:t});const o=Ce(h),x=o?`${o.backend}:${h.id}:${o.sessionName}:${i??"takeover"}`:`takeover:${r}:${i??"takeover"}`;return e.jsx($n,{agentId:r,agent:h,mode:i,navigate:t,children:e.jsx(ts,{agentId:r,agent:h,mode:i,navigate:t})},x)}function Kr({agentId:s,mode:t,terminalSessionId:r,terminalSurfaceKey:i,navigate:c}){const m={view:"terminal",agentId:s,mode:t,terminalSessionId:r,terminalSurfaceKey:i};return e.jsx(Un,{route:m,navigate:c})}export{Un as TerminalContent,Kr as TerminalScreen};
@@ -0,0 +1 @@
1
+ import{r as e,j as l,a as A,b as C,S as k}from"./index-sUomXsrf.js";import{C as y}from"./ContextMenu-BlBQhpax.js";import{a as T}from"./api-h5zurxmi.js";import{L,D as x,f as R,S as P}from"./Provider-tFc3jqZ4.js";import{i as I}from"./colors-BtO5_zlx.js";import{r as j,a as D}from"./router-Dja9_ygK.js";import{TerminalContent as H}from"./Terminal-DwZyo8kA.js";import"./sse-CVoGDiKW.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./DocumentFocusViewer-DU_9BHsD.js";import"./createLucideIcon-DlxlBfLC.js";import"./TextDocumentSurface-C-9EtYqt.js";/* empty css */import"./file-text-i3xTDUjJ.js";import"./x-0XjXwGqq.js";import"./chevron-right-CyUa1zXx.js";import"./code-xml-05TD3uOC.js";import"./arrow-left-WjQIN9J6.js";import"./scout-voice-BZ4KqADJ.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-BhZZ5HEq.js";import"./MessageComposerSuggestions-zAUUcLOv.js";import"./NewChatComposer-B5FnPyzS.js";import"./runtime-picker-DOZpZOlt.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-lWOOKezu.js";import"./index-m6dFtY5f.js";import"./HarnessMark-Dm_qm1Ku.js";import"./conversation-model-C4yb6_FA.js";import"./time-Dhsh_2EG.js";import"./NewChatOrigin--pHWUb4V.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./chevron-down-BFai6ZfE.js";import"./search-DCT_EvPr.js";import"./chunk-HRAB3GC3-CvwpNg-G.js";import"./terminal-sessions-D5CIR2OL.js";/* empty css */import"./clipboard-e3fSpeo7.js";import"./terminal-relay-B5Sma7fK.js";import"./session-table-sAVe44a4.js";import"./chunk-YOZR3KYS-BW85tiCr.js";import"./arrow-down-DsD-dYj-.js";import"./terminal-takeover-X97KCSJk.js";import"./BackToPicker-CkUmHuuo.js";import"./TmuxPeek-Dz1gJ2pU.js";/* empty css */import"./refresh-cw-D8PFyhUa.js";import"./plus-C9lTjsgd.js";import"./terminal-DXQISjZn.js";import"./eye-So8tNNK6.js";import"./external-link-CnjcXf32.js";function g(){const t=new URLSearchParams(window.location.search).get("route")?.trim()||"/terminal",s=j(t);return s.view==="terminal"?s:{view:"terminal"}}function S(o){const t=new URLSearchParams(window.location.search);return t.set("route",D(o)),t.has("profile")||t.set("profile","macos.terminal"),`${window.location.pathname}?${t.toString()}${window.location.hash}`}function Oe(){const[o,t]=e.useState(()=>g()),s=!!(o.terminalBackend||o.agentId||o.terminalSessionId||o.terminalSurfaceKey);e.useEffect(()=>{const i=()=>t(g());return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const n=e.useCallback(i=>{if(i.view!=="terminal"){const p={view:"terminal"},a=S(p);window.history.pushState(null,"",a),t(p);return}const c=S(i);window.history.pushState(null,"",c),t(i)},[]);return l.jsx(M,{route:o,navigate:n,children:l.jsx("div",{className:`s-terminal-embed${s?" s-terminal-embed--surface":""}`,children:l.jsx(H,{route:o,navigate:n})})})}function M({route:o,navigate:t,children:s}){const[n,i]=e.useState([]),[c,p]=e.useState({status:"checking",message:null,lastCheckedAt:null}),a=e.useRef(null),u=e.useMemo(()=>A(),[]),f=e.useMemo(()=>C(),[]),b=e.useMemo(()=>({...u==="light"?L:x,...f??{}}),[u,f]),h=e.useCallback(()=>{p({status:"online",message:null,lastCheckedAt:Date.now()})},[]),w=e.useCallback(r=>{p({status:"offline",message:R(r),lastCheckedAt:Date.now()})},[]),m=e.useCallback(async()=>{if(a.current)return a.current;const r=(async()=>{try{i(await T("/api/agents")),h()}catch(d){w(d)}})();a.current=r;try{await r}finally{a.current=null}},[w,h]);e.useEffect(()=>{m()},[m]),e.useEffect(()=>{const r=()=>{document.visibilityState!=="hidden"&&m()},d=window.setInterval(r,15e3);return window.addEventListener("focus",r),document.addEventListener("visibilitychange",r),()=>{window.clearInterval(d),window.removeEventListener("focus",r),document.removeEventListener("visibilitychange",r)}},[m]);const v=e.useMemo(()=>n.filter(r=>I(r.state)).length,[n]),E=e.useMemo(()=>({route:o,navigate:t,agents:n,agentsLoaded:c.status!=="checking",onlineCount:v,apiConnection:c,appearanceDetails:k,updateAppearanceDetails:()=>{},reload:m,onboarding:null,refreshOnboarding:async()=>{},onboardingSkipped:!0,skipOnboarding:()=>{},settingsOpen:!1,openSettings:()=>{},closeSettings:()=>{},scoutbotAgentId:"scoutbot",scoutbotConversationId:null,applyScoutbotUiAction:()=>{},selectedBrokerAttempt:null,inspectBrokerAttempt:()=>{},clearBrokerAttempt:()=>{},selectedKnowledgeHit:null,selectedKnowledgeQuery:"",inspectKnowledgeHit:()=>{},clearKnowledgeHit:()=>{},focusedSession:null,focusSession:()=>{},openFilePreview:()=>{},closeFilePreview:()=>{},openContextCapture:()=>{},closeContextCapture:()=>{}}),[n,c,t,v,m,o]);return l.jsx(P.Provider,{value:E,children:l.jsx("div",{"data-scout-theme":u,"data-scout-theme-mode":u,style:b,children:l.jsx(y,{children:s})})})}export{Oe as TerminalEmbedScreen};
@@ -1,4 +1,4 @@
1
- import{j as i,r as I}from"./index-DMiGbrBt.js";const N={cjs:"javascript",css:"css",htm:"html",html:"html",js:"javascript",jsx:"javascript",json:"json",mjs:"javascript",md:"markdown",mdx:"markdown",sh:"shell",ts:"typescript",tsx:"typescript",txt:"plain"},L=new Set(["cjs","css","htm","html","js","jsx","json","mjs","sh","ts","tsx"]);function b(t){const s=(t.filename??t.title??t.uri??"").split(/[?#]/)[0],n=s.split("/").pop()??s,r=n.lastIndexOf(".");return r>=0?n.slice(r+1).toLowerCase():""}function S(t){const e=t.mediaType?.toLowerCase()??"";return e.includes("json")?"json":e.includes("markdown")?"markdown":e.includes("javascript")?"javascript":e.includes("typescript")?"typescript":e.includes("html")?"html":e.includes("css")?"css":e.includes("shell")||e.includes("x-sh")?"shell":N[b(t)]??"plain"}function E(t){const e=t.mediaType?.toLowerCase()??"",s=b(t);if(e.includes("markdown")||s==="md"||s==="mdx")return"markdown";if(e.includes("json")||e.includes("javascript")||e.includes("typescript")||e.includes("html")||e.includes("xml")||e.includes("css")||L.has(s))return"code";if(e.startsWith("text/")||s==="txt")return"text";const n=t.value.trim();return/^#{1,6}\s+/m.test(n)||/```[\s\S]*```/.test(n)?"markdown":"text"}function it(t){const e=t.title??t.filename??t.uri?.split("/").pop()??"Untitled",s=t.language??S(t);return{id:t.id??t.uri??e,title:e,uri:t.uri,mediaType:t.mediaType,language:s,kind:t.kind??E(t),value:t.value,readOnly:t.readOnly}}function ct({document:t,mode:e,className:s}){const n=e??(t.kind==="markdown"?"preview":"read"),r=t.kind==="markdown"&&n==="preview"?i.jsx(k,{markdown:t.value}):i.jsx(W,{document:t});return i.jsx("div",{className:`s-text-document-surface s-text-document-surface-${t.kind}${s?` ${s}`:""}`,children:r})}function W({document:t}){const e=I.useMemo(()=>_(t.value,t.language??t.kind),[t.language,t.kind,t.value]);return i.jsx("pre",{className:"s-text-document-code","data-language":t.language??t.kind,children:i.jsx("code",{children:e})})}function k({markdown:t}){const e=A(t);return i.jsx("div",{className:"s-text-document-markdown",children:e.length>0?e:i.jsx("p",{})})}function A(t){const e=t.replace(/\r\n/g,`
1
+ import{j as i,r as I}from"./index-sUomXsrf.js";const N={cjs:"javascript",css:"css",htm:"html",html:"html",js:"javascript",jsx:"javascript",json:"json",mjs:"javascript",md:"markdown",mdx:"markdown",sh:"shell",ts:"typescript",tsx:"typescript",txt:"plain"},L=new Set(["cjs","css","htm","html","js","jsx","json","mjs","sh","ts","tsx"]);function b(t){const s=(t.filename??t.title??t.uri??"").split(/[?#]/)[0],n=s.split("/").pop()??s,r=n.lastIndexOf(".");return r>=0?n.slice(r+1).toLowerCase():""}function S(t){const e=t.mediaType?.toLowerCase()??"";return e.includes("json")?"json":e.includes("markdown")?"markdown":e.includes("javascript")?"javascript":e.includes("typescript")?"typescript":e.includes("html")?"html":e.includes("css")?"css":e.includes("shell")||e.includes("x-sh")?"shell":N[b(t)]??"plain"}function E(t){const e=t.mediaType?.toLowerCase()??"",s=b(t);if(e.includes("markdown")||s==="md"||s==="mdx")return"markdown";if(e.includes("json")||e.includes("javascript")||e.includes("typescript")||e.includes("html")||e.includes("xml")||e.includes("css")||L.has(s))return"code";if(e.startsWith("text/")||s==="txt")return"text";const n=t.value.trim();return/^#{1,6}\s+/m.test(n)||/```[\s\S]*```/.test(n)?"markdown":"text"}function it(t){const e=t.title??t.filename??t.uri?.split("/").pop()??"Untitled",s=t.language??S(t);return{id:t.id??t.uri??e,title:e,uri:t.uri,mediaType:t.mediaType,language:s,kind:t.kind??E(t),value:t.value,readOnly:t.readOnly}}function ct({document:t,mode:e,className:s}){const n=e??(t.kind==="markdown"?"preview":"read"),r=t.kind==="markdown"&&n==="preview"?i.jsx(k,{markdown:t.value}):i.jsx(W,{document:t});return i.jsx("div",{className:`s-text-document-surface s-text-document-surface-${t.kind}${s?` ${s}`:""}`,children:r})}function W({document:t}){const e=I.useMemo(()=>_(t.value,t.language??t.kind),[t.language,t.kind,t.value]);return i.jsx("pre",{className:"s-text-document-code","data-language":t.language??t.kind,children:i.jsx("code",{children:e})})}function k({markdown:t}){const e=A(t);return i.jsx("div",{className:"s-text-document-markdown",children:e.length>0?e:i.jsx("p",{})})}function A(t){const e=t.replace(/\r\n/g,`
2
2
  `).split(`
3
3
  `),s=[];let n=0;for(;n<e.length;){const r=e[n]??"";if(!r.trim()){n+=1;continue}const c=/^```(\S*)\s*$/.exec(r);if(c){const l=[];for(n+=1;n<e.length&&!/^```\s*$/.test(e[n]??"");)l.push(e[n]??""),n+=1;n<e.length&&(n+=1),s.push({kind:"code",content:l.join(`
4
4
  `),language:c[1]||void 0});continue}const a=/^(#{1,6})\s+(.+)$/.exec(r);if(a){s.push({kind:"heading",depth:z(a[1].length),content:a[2].trim()}),n+=1;continue}if(/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(r)){s.push({kind:"hr"}),n+=1;continue}if(/^>\s?/.test(r)){const l=[];for(;n<e.length&&/^>\s?/.test(e[n]??"");)l.push((e[n]??"").replace(/^>\s?/,"")),n+=1;s.push({kind:"blockquote",content:l.join(" ")});continue}const o=/^(\s*)([-*+]|\d+[.)])\s+(.+)$/.exec(r);if(o){const l=/\d/.test(o[2]),m=[];for(;n<e.length;){const f=/^(\s*)([-*+]|\d+[.)])\s+(.+)$/.exec(e[n]??"");if(!f||/\d/.test(f[2])!==l)break;m.push(f[3]),n+=1}s.push({kind:"list",ordered:l,items:m});continue}const u=y(e,n);if(u){s.push(u.block),n=u.nextIndex;continue}const p=[];for(;n<e.length;){const l=e[n]??"";if(!l.trim()||/^```/.test(l)||/^(#{1,6})\s+/.test(l)||/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(l)||/^>\s?/.test(l)||/^(\s*)([-*+]|\d+[.)])\s+/.test(l)||y(e,n))break;p.push(l.trim()),n+=1}s.push({kind:"paragraph",content:p.join(" ")})}return s.map((r,c)=>C(r,c))}function z(t){return t<=1?1:t===2?2:t===3?3:t===4?4:t===5?5:6}function C(t,e){switch(t.kind){case"heading":{const n=`h${t.depth}`;return i.jsx(n,{children:d(t.content)},e)}case"paragraph":return i.jsx("p",{children:d(t.content)},e);case"blockquote":return i.jsx("blockquote",{children:d(t.content)},e);case"list":{const n=t.ordered?"ol":"ul";return i.jsx(n,{children:t.items.map((r,c)=>i.jsx("li",{children:d(r)},`${e}:${c}`))},e)}case"code":const s=$(t.language);return i.jsx("pre",{className:"s-text-document-fenced-code","data-language":s,children:i.jsx("code",{children:_(t.content,s)})},e);case"hr":return i.jsx("hr",{},e);case"table":return i.jsx("div",{className:"s-text-document-table-wrap",children:i.jsxs("table",{className:"s-text-document-table",children:[i.jsx("thead",{children:i.jsx("tr",{children:t.headers.map((n,r)=>i.jsx("th",{"data-align":t.alignments[r]??void 0,children:d(n)},`${e}:h:${r}`))})}),i.jsx("tbody",{children:t.rows.map((n,r)=>i.jsx("tr",{children:n.map((c,a)=>i.jsx("td",{"data-align":t.alignments[a]??void 0,children:d(c)},`${e}:r:${r}:${a}`))},`${e}:r:${r}`))})]})},e)}}function y(t,e){const s=w(t[e]??""),n=R(t[e+1]??"");if(!s||!n||s.length!==n.length)return null;const r=s.length,c=[];let a=e+2;for(;a<t.length;){const o=w(t[a]??"");if(!o||o.length<2)break;c.push(T(o,r)),a+=1}return{block:{kind:"table",alignments:n,headers:T(s,r),rows:c},nextIndex:a}}function w(t){const e=t.trim();if(!e.includes("|"))return null;let s=e;s.startsWith("|")&&(s=s.slice(1)),s.endsWith("|")&&!s.endsWith("\\|")&&(s=s.slice(0,-1));const n=[];let r="";for(let c=0;c<s.length;c+=1){const a=s[c];if(a==="\\"&&s[c+1]==="|"){r+="|",c+=1;continue}if(a==="|"){n.push(r.trim()),r="";continue}r+=a}return n.push(r.trim()),n.length>=2?n:null}function R(t){const e=w(t);if(!e||e.length<2)return null;const s=[];for(const n of e){const r=n.replace(/\s/g,"");if(!/^:?-{3,}:?$/u.test(r))return null;r.startsWith(":")&&r.endsWith(":")?s.push("center"):r.endsWith(":")?s.push("right"):r.startsWith(":")?s.push("left"):s.push(null)}return s}function T(t,e){const s=t.slice(0,e);for(;s.length<e;)s.push("");return s}const M=/\/\/[^\n]*|\/\*[\s\S]*?\*\/|`(?:\\[\s\S]|[^`\\])*`|'(?:\\.|[^'\\\n])*'|"(?:\\.|[^"\\\n])*"|\b\d+(?:\.\d+)?(?:e[+-]?\d+)?n?\b|\b[A-Za-z_$][\w$]*\b|=>|[{}()[\].,;:?]|[-+*/%=&|!<>~^]+/giu,D=/"(?:\\.|[^"\\])*"|-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b|\b(?:true|false|null)\b|[{}\[\]:,]/giu,O=/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|#[0-9a-f]{3,8}\b|@[a-z-]+|--[a-z0-9-]+|[a-z-]+(?=\s*:)|\b\d+(?:\.\d+)?(?:%|px|r?em|vh|vw|vmin|vmax|s|ms|deg|fr)?\b|[{}():;,]|\.[a-z_][\w-]*|#[a-z_][\w-]*|[a-z_][\w-]*/giu,v=/<!--[\s\S]*?-->|<!doctype[^>]*>|<\/?[a-z][\w:-]*|\/?>|[a-z_:][\w:.-]*(?==)|=|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|&[a-z0-9#]+;/giu,P=/#[^\n]*|"(?:\\.|[^"\\])*"|'[^']*'|\$\{?[\w?@#$!-]+\}?|--?[A-Za-z0-9][\w-]*(?:=[^\s]+)?|\b(?:case|cd|do|done|echo|elif|else|esac|exit|export|fi|for|function|if|in|local|return|set|source|test|then|unset|while)\b|\b\d+\b|[|&;(){}<>]/giu,H=new Set(["abstract","as","async","await","break","case","catch","class","const","continue","declare","default","delete","do","else","enum","export","extends","finally","for","from","function","get","if","implements","import","in","infer","interface","is","keyof","let","new","of","private","protected","public","readonly","return","satisfies","set","static","switch","throw","try","type","typeof","var","void","while","with","yield"]),B=new Set(["false","null","super","this","true","undefined"]);function _(t,e){switch($(e)){case"css":return g(t,O,Z);case"html":return g(t,v,U);case"javascript":case"typescript":return g(t,M,K);case"json":return g(t,D,q);case"shell":return g(t,P,Y);default:return[t]}}function g(t,e,s){const n=[];let r=0,c=0;e.lastIndex=0;let a;for(;(a=e.exec(t))!==null;){const o=a[0];if(!o){e.lastIndex+=1;continue}a.index>r&&n.push(t.slice(r,a.index));const u=s(o,a.index,a.index+o.length,t);n.push(u?i.jsx("span",{className:`s-syntax s-syntax-${u}`,children:o},`syntax-${c++}`):o),r=a.index+o.length}return r<t.length&&n.push(t.slice(r)),n.length>0?n:[t]}function $(t){const e=String(t??"").toLowerCase().replace(/^\./,"");return e==="bash"||e==="sh"||e==="shell"||e==="zsh"?"shell":e==="css"||e==="scss"?"css":e==="html"||e==="htm"||e==="xml"||e==="svg"?"html":e==="js"||e==="jsx"||e==="javascript"||e==="mjs"||e==="cjs"?"javascript":e==="json"||e==="jsonc"?"json":e==="markdown"||e==="md"||e==="mdx"?"markdown":e==="ts"||e==="tsx"||e==="typescript"?"typescript":"plain"}function K(t,e,s,n){return t.startsWith("//")||t.startsWith("/*")?"comment":x(t)?"string":/^\d/u.test(t)?"number":H.has(t)?"keyword":B.has(t)?"literal":/^[A-Z][\w$]*$/u.test(t)?"type":/^[A-Za-z_$][\w$]*$/u.test(t)&&n.slice(s).trimStart().startsWith("(")?"function":/^[{}()[\].,;:?]$/u.test(t)?"punctuation":/^(?:=>|[-+*/%=&|!<>~^]+)$/u.test(t)?"operator":null}function q(t,e,s,n){return x(t)?n.slice(s).trimStart().startsWith(":")?"property":"string":/^-?\d/u.test(t)?"number":t==="true"||t==="false"||t==="null"?"literal":"punctuation"}function Z(t,e,s,n){return t.startsWith("/*")?"comment":x(t)?"string":t.startsWith("@")?"keyword":t.startsWith("#")&&/^#[0-9a-f]/iu.test(t)||/^\d/u.test(t)?"number":t.startsWith(".")||t.startsWith("#")?"tag":/^--/u.test(t)||n.slice(s).trimStart().startsWith(":")?"property":/^[{}():;,]$/u.test(t)?"punctuation":null}function U(t){return t.startsWith("<!--")?"comment":/^<!doctype/iu.test(t)||t.startsWith("&")?"meta":t.startsWith("<")?"tag":x(t)?"string":t==="="?"operator":t===">"||t==="/>"?"punctuation":"attribute"}function Y(t){return t.startsWith("#")?"comment":x(t)?"string":t.startsWith("$")?"property":t.startsWith("-")?"attribute":/^\d/u.test(t)?"number":/^[|&;(){}<>]$/u.test(t)?"operator":G.has(t)?"keyword":null}const G=new Set(["case","cd","do","done","echo","elif","else","esac","exit","export","fi","for","function","if","in","local","return","set","source","test","then","unset","while"]);function x(t){return t.startsWith('"')||t.startsWith("'")||t.startsWith("`")}const J=/`([^`]+)`/y,X=/\[([^\]]+)\]\(([^)\s]+)\)/y,F=/\*\*\*(.+?)\*\*\*/y,Q=/\*\*(.+?)\*\*/y,V=/__(.+?)__(?!\w)/y,tt=/~~(.+?)~~/y,et=/\*(?!\s)([^*]+?)\*/y,nt=/_(?!\s)([^_]+?)_(?!\w)/y;function h(t,e,s){t.lastIndex=s;const n=t.exec(e);return n&&n.index===s?n:null}function d(t){const e=[];let s="",n=0,r=0;const c=()=>{s&&(e.push(s),s="")};for(;n<t.length;){const a=n===0||/[^\w]/.test(t[n-1]??""),o=h(J,t,n);if(o){c(),e.push(i.jsx("code",{children:o[1]},r++)),n+=o[0].length;continue}const u=h(X,t,n);if(u){c();const j=st(u[2]);e.push(j?i.jsx("a",{href:j,target:"_blank",rel:"noreferrer",children:d(u[1])},r++):i.jsx("span",{children:d(u[1])},r++)),n+=u[0].length;continue}const p=h(F,t,n);if(p){c(),e.push(i.jsx("strong",{children:i.jsx("em",{children:d(p[1])})},r++)),n+=p[0].length;continue}const l=h(Q,t,n)??(a?h(V,t,n):null);if(l){c(),e.push(i.jsx("strong",{children:d(l[1])},r++)),n+=l[0].length;continue}const m=h(tt,t,n);if(m){c(),e.push(i.jsx("del",{children:d(m[1])},r++)),n+=m[0].length;continue}const f=h(et,t,n)??(a?h(nt,t,n):null);if(f){c(),e.push(i.jsx("em",{children:d(f[1])},r++)),n+=f[0].length;continue}s+=t[n],n+=1}return c(),e}function st(t){if(!t)return null;try{const e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"||e.protocol==="mailto:"?t:null}catch{return null}}export{ct as T,it as c};
@@ -1 +1 @@
1
- import{r as l,j as a}from"./index-DMiGbrBt.js";import{a as D}from"./api-h5zurxmi.js";import{f as v}from"./time-DltNTpLl.js";/* empty css */import{R as F}from"./refresh-cw-BBmAnCB7.js";const M=44,B=132,H=3500,V=7e3;function W(e,t){return!!(e&&e.available===t.available&&e.sessionId===t.sessionId&&e.body===t.body&&e.lineCount===t.lineCount&&e.columnCount===t.columnCount&&e.truncated===t.truncated&&e.reason===t.reason)}function q(e){const t=new URLSearchParams({lines:String(e.lines),cols:String(e.columns)});return e.agentId?`/api/agents/${encodeURIComponent(e.agentId)}/tmux-peek?${t.toString()}`:e.surface?(t.set("backend",e.surface.backend),t.set("sessionName",e.surface.sessionName),`/api/terminal-sessions/peek?${t.toString()}`):null}function ee({agentId:e,surface:t,enabled:x=!0,lines:E=M,columns:L=B,pollMs:h=H,idlePollMs:u=V,className:N}){const[n,T]=l.useState(null),[k,m]=l.useState(!1),[A,b]=l.useState(null),[U,K]=l.useState(0),c=q({agentId:e,surface:t,lines:E,columns:L});if(l.useEffect(()=>{T(null),b(null),m(!1)},[c]),l.useEffect(()=>{if(!x||!c){m(!1);return}let r=!1,f,y=!0;const R=d=>{window.clearTimeout(f),f=window.setTimeout(()=>{S()},d)},S=async()=>{if(r)return;if(document.visibilityState!=="visible"){R(u);return}y&&m(!0);let d=h;try{const i=await D(c);if(r)return;b(null),T(o=>o&&W(o.payload,i)?o.steady?o:{...o,steady:!0}:{payload:i,observedAt:o?.observedAt??i.capturedAt,changedAt:o?i.capturedAt:null,steady:!1}),d=i.available?h:u}catch(i){if(r)return;b(i instanceof Error?i.message:String(i)),d=u}finally{r||(y&&m(!1),y=!1,R(d))}},$=()=>{document.visibilityState==="visible"&&(window.clearTimeout(f),S())};return S(),document.addEventListener("visibilitychange",$),()=>{r=!0,window.clearTimeout(f),document.removeEventListener("visibilitychange",$)}},[x,u,c,h,U]),!x||!c)return null;const s=n?.payload??null,g=s?.body??"",p=s?.lineCount??E,j=s?.columnCount??L,w=6,I=1.32,O={"--tmux-peek-columns":String(j),"--tmux-peek-rows":String(p),"--tmux-peek-font-size":`${w}px`,"--tmux-peek-line-height":String(I),"--tmux-peek-height":`${Math.ceil(p*w*I+18)}px`},C=!!(s?.available&&g),X=A||(k&&!n?"Loading terminal peek...":s?.available===!1?s.reason??"No tmux pane is available.":C?null:s?.available?"Pane is empty.":"Loading terminal peek..."),_=n?n.changedAt&&!n.steady?"Changed":n.steady?"At rest":"Peeked":null,P=n?.changedAt??n?.observedAt??null,z=n?n.changedAt?n.steady?`No terminal content change since ${v(n.changedAt)}`:`Terminal content changed ${v(n.changedAt)}`:`First terminal peek observed ${v(n.observedAt)}`:void 0;return a.jsxs("div",{className:`ctx-panel-tmux-peek${N?` ${N}`:""}`,style:O,children:[a.jsxs("div",{className:"ctx-panel-tmux-peek-head",children:[a.jsx("span",{children:"Terminal peek"}),a.jsxs("span",{className:"ctx-panel-tmux-peek-grid",children:[j,"x",p]}),s?.sessionId&&a.jsx("span",{className:"ctx-panel-tmux-peek-session",title:s.sessionId,children:s.sessionId.length>12?s.sessionId.slice(0,10):s.sessionId}),_&&P&&a.jsx("time",{className:"ctx-panel-tmux-peek-state",dateTime:new Date(P).toISOString(),title:z,children:_}),a.jsxs("button",{type:"button",className:"ctx-panel-tmux-peek-refresh",onClick:()=>K(r=>r+1),disabled:k,title:"Refresh terminal peek","aria-label":"Refresh terminal peek",children:[a.jsx(F,{size:12,strokeWidth:1.8}),a.jsx("span",{children:k?"Refreshing":"Refresh"})]})]}),C?a.jsx("pre",{className:"ctx-panel-tmux-peek-screen",children:g}):a.jsx("div",{className:"ctx-panel-tmux-peek-empty",children:X}),s?.truncated&&g&&a.jsxs("div",{className:"ctx-panel-tmux-peek-foot",children:["Last ",p," rows from tmux pane"]})]})}export{ee as T};
1
+ import{r as l,j as a}from"./index-sUomXsrf.js";import{a as D}from"./api-h5zurxmi.js";import{f as v}from"./time-Dhsh_2EG.js";/* empty css */import{R as F}from"./refresh-cw-D8PFyhUa.js";const M=44,B=132,H=3500,V=7e3;function W(e,t){return!!(e&&e.available===t.available&&e.sessionId===t.sessionId&&e.body===t.body&&e.lineCount===t.lineCount&&e.columnCount===t.columnCount&&e.truncated===t.truncated&&e.reason===t.reason)}function q(e){const t=new URLSearchParams({lines:String(e.lines),cols:String(e.columns)});return e.agentId?`/api/agents/${encodeURIComponent(e.agentId)}/tmux-peek?${t.toString()}`:e.surface?(t.set("backend",e.surface.backend),t.set("sessionName",e.surface.sessionName),`/api/terminal-sessions/peek?${t.toString()}`):null}function ee({agentId:e,surface:t,enabled:x=!0,lines:E=M,columns:L=B,pollMs:h=H,idlePollMs:u=V,className:N}){const[n,T]=l.useState(null),[k,m]=l.useState(!1),[A,b]=l.useState(null),[U,K]=l.useState(0),c=q({agentId:e,surface:t,lines:E,columns:L});if(l.useEffect(()=>{T(null),b(null),m(!1)},[c]),l.useEffect(()=>{if(!x||!c){m(!1);return}let r=!1,f,y=!0;const R=d=>{window.clearTimeout(f),f=window.setTimeout(()=>{S()},d)},S=async()=>{if(r)return;if(document.visibilityState!=="visible"){R(u);return}y&&m(!0);let d=h;try{const i=await D(c);if(r)return;b(null),T(o=>o&&W(o.payload,i)?o.steady?o:{...o,steady:!0}:{payload:i,observedAt:o?.observedAt??i.capturedAt,changedAt:o?i.capturedAt:null,steady:!1}),d=i.available?h:u}catch(i){if(r)return;b(i instanceof Error?i.message:String(i)),d=u}finally{r||(y&&m(!1),y=!1,R(d))}},$=()=>{document.visibilityState==="visible"&&(window.clearTimeout(f),S())};return S(),document.addEventListener("visibilitychange",$),()=>{r=!0,window.clearTimeout(f),document.removeEventListener("visibilitychange",$)}},[x,u,c,h,U]),!x||!c)return null;const s=n?.payload??null,g=s?.body??"",p=s?.lineCount??E,j=s?.columnCount??L,w=6,I=1.32,O={"--tmux-peek-columns":String(j),"--tmux-peek-rows":String(p),"--tmux-peek-font-size":`${w}px`,"--tmux-peek-line-height":String(I),"--tmux-peek-height":`${Math.ceil(p*w*I+18)}px`},C=!!(s?.available&&g),X=A||(k&&!n?"Loading terminal peek...":s?.available===!1?s.reason??"No tmux pane is available.":C?null:s?.available?"Pane is empty.":"Loading terminal peek..."),_=n?n.changedAt&&!n.steady?"Changed":n.steady?"At rest":"Peeked":null,P=n?.changedAt??n?.observedAt??null,z=n?n.changedAt?n.steady?`No terminal content change since ${v(n.changedAt)}`:`Terminal content changed ${v(n.changedAt)}`:`First terminal peek observed ${v(n.observedAt)}`:void 0;return a.jsxs("div",{className:`ctx-panel-tmux-peek${N?` ${N}`:""}`,style:O,children:[a.jsxs("div",{className:"ctx-panel-tmux-peek-head",children:[a.jsx("span",{children:"Terminal peek"}),a.jsxs("span",{className:"ctx-panel-tmux-peek-grid",children:[j,"x",p]}),s?.sessionId&&a.jsx("span",{className:"ctx-panel-tmux-peek-session",title:s.sessionId,children:s.sessionId.length>12?s.sessionId.slice(0,10):s.sessionId}),_&&P&&a.jsx("time",{className:"ctx-panel-tmux-peek-state",dateTime:new Date(P).toISOString(),title:z,children:_}),a.jsxs("button",{type:"button",className:"ctx-panel-tmux-peek-refresh",onClick:()=>K(r=>r+1),disabled:k,title:"Refresh terminal peek","aria-label":"Refresh terminal peek",children:[a.jsx(F,{size:12,strokeWidth:1.8}),a.jsx("span",{children:k?"Refreshing":"Refresh"})]})]}),C?a.jsx("pre",{className:"ctx-panel-tmux-peek-screen",children:g}):a.jsx("div",{className:"ctx-panel-tmux-peek-empty",children:X}),s?.truncated&&g&&a.jsxs("div",{className:"ctx-panel-tmux-peek-foot",children:["Last ",p," rows from tmux pane"]})]})}export{ee as T};
@@ -1 +1 @@
1
- import{j as n,r as h}from"./index-DMiGbrBt.js";import{r as w,o as g}from"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";const p={microphone:{label:"Microphone",privacyPane:"Microphone",hint:"Scout Menu captures audio for web dictation. The browser never records.",appLabel:"Scout Menu"},speechRecognition:{label:"Speech recognition",privacyPane:"Speech Recognition",hint:"Live partials and Apple Speech fallback while Parakeet warms.",appLabel:"Scout Menu"}};function x(e){return e?e.granted?"ok":e.canRequest?"warn":e.status==="denied"||e.status==="restricted"?"fail":"warn":"idle"}function y(e){if(!e)return"Unknown";if(e.granted)return"Granted";switch(e.status){case"notDetermined":return"Not requested";case"denied":return"Denied";case"restricted":return"Restricted";case"authorized":return"Granted";default:return e.status}}function M(e,s){return e?e.granted?`${p[s].appLabel} is allowed to use ${p[s].label.toLowerCase()}.`:e.canRequest?`Click Request to show the macOS permission dialog for ${p[s].appLabel}.`:e.status==="denied"?`Choose Retry access. Scout Menu will open macOS ${p[s].privacyPane} settings and detect the change automatically.`:e.status==="restricted"?`${p[s].label} access is restricted on this Mac.`:`${p[s].appLabel} needs ${p[s].label.toLowerCase()} access before dictation works.`:"Launch Scout Menu on this Mac, then refresh."}function j(e){return!!(e&&!e.granted&&!e.canRequest&&e.status!=="unknown")}function R(e){return!!(e&&!e.granted&&e.status!=="restricted"&&e.status!=="unknown")}function L({hostOnline:e,micPermission:s,speechPermission:r,modelReady:l}){const c=s?.granted??!1,d=r?.granted??!1,u=e&&c&&d;let i="fail",t="Scout Menu not connected",a="Launch Scout Menu on this Mac. Web dictation uses the Scout voice host — not the browser microphone.";return e&&!c&&(s?.status==="denied"||s?.status==="restricted")?(i="fail",t="Microphone blocked for Scout Menu",a=s?.status==="restricted"?"Microphone access is restricted on this Mac.":"Choose Retry access below. Scout will open the right macOS pane and detect the change."):e&&!c&&s?.canRequest?(i="warn",t="Microphone access needed",a="Request permission below or tap the mic in chat. Scout Menu will show the macOS prompt."):e&&c&&!d&&(r?.status==="denied"||r?.status==="restricted")?(i="warn",t="Speech recognition blocked for Scout Menu",a=r?.status==="restricted"?"Speech recognition is restricted on this Mac.":"Open Privacy & Security → Speech Recognition to change it."):e&&c&&!d?(i="warn",t="Speech recognition needed",a="Request access below or tap the mic in chat. Scout Menu will show the macOS prompt."):e&&u?(i="ok",t=l?"Dictation ready":"Dictation ready · model warming",a="Scout Menu is running as the voice host. The browser does not capture audio."):e&&(i="warn",t="Voice host connected",a="Finish permissions below to enable dictation."),n.jsxs("div",{className:`s-voice-host-banner s-voice-host-banner--${i}`,children:[n.jsx("div",{className:"s-voice-host-banner-dot","aria-hidden":!0}),n.jsxs("div",{className:"s-voice-host-banner-copy",children:[n.jsx("div",{className:"s-voice-host-banner-title",children:t}),n.jsx("div",{className:"s-voice-host-banner-detail",children:a}),n.jsxs("div",{className:"s-voice-host-banner-meta",children:[n.jsx("span",{children:"Voice host · Scout Menu"}),n.jsx("span",{children:e?"Connected":"Offline"}),n.jsx("span",{children:"Capture · native"})]})]})]})}function f({kind:e,status:s,disabled:r,onActionError:l,onRefresh:c}){const[d,u]=h.useState(!1),i=h.useRef(s),t=p[e],a=x(s);h.useEffect(()=>{i.current=s},[s]);const m=h.useCallback(async()=>{for(let o=0;o<30;o+=1)if(await new Promise(S=>window.setTimeout(S,1e3)),await c(),i.current?.granted)return},[c]),v=h.useCallback(async()=>{u(!0);try{await w(e),await m()}catch(o){l(o instanceof Error?o.message:String(o))}finally{u(!1)}},[e,l,m]),b=h.useCallback(async()=>{u(!0);try{await g(e)}catch(o){l(o instanceof Error?o.message:String(o))}finally{u(!1)}},[e,l]);return n.jsxs("div",{className:`s-voice-permission-card s-voice-permission-card--${a}`,children:[n.jsxs("div",{className:"s-voice-permission-card-head",children:[n.jsx("span",{className:"s-voice-permission-card-dot","aria-hidden":!0}),n.jsxs("div",{children:[n.jsx("div",{className:"s-voice-permission-card-label",children:t.label}),n.jsxs("div",{className:"s-voice-permission-card-app",children:["via ",t.appLabel]})]}),n.jsx("span",{className:`s-voice-permission-card-status s-voice-permission-card-status--${a}`,children:y(s)})]}),n.jsx("p",{className:"s-voice-permission-card-hint",children:t.hint}),n.jsx("p",{className:"s-voice-permission-card-detail",children:M(s,e)}),n.jsxs("div",{className:"s-voice-permission-card-actions",children:[R(s)?n.jsx("button",{type:"button",className:"s-voice-permission-btn s-voice-permission-btn--primary",disabled:r||d,onClick:()=>{v()},children:d?s?.canRequest?"Requesting…":"Waiting for macOS…":s?.canRequest?"Request access":"Retry access"}):null,j(s)?n.jsxs("button",{type:"button",className:"s-voice-permission-btn",disabled:r||d,onClick:()=>{b()},children:["Open Privacy & Security → ",t.privacyPane]}):null]})]})}function P({permissions:e,hostOnline:s,disabled:r,onError:l,onRefresh:c}){const d=e?.find(i=>i.kind==="microphone")??null,u=e?.find(i=>i.kind==="speechRecognition")??null;return n.jsxs("div",{className:"s-voice-permissions-panel",children:[n.jsx(f,{kind:"microphone",status:s?d:null,disabled:r||!s,onActionError:l,onRefresh:c}),n.jsx(f,{kind:"speechRecognition",status:s?u:null,disabled:r||!s,onActionError:l,onRefresh:c}),s?null:n.jsx("p",{className:"s-voice-permissions-offline",children:"Scout Menu is not reporting to this web server. Permissions are managed on the Mac where Scout Menu runs."})]})}export{L as VoiceHostStatusBanner,P as VoicePermissionsPanel};
1
+ import{j as n,r as h}from"./index-sUomXsrf.js";import{r as w,o as g}from"./scout-voice-BZ4KqADJ.js";import"./fx-z37u1o2z.js";const p={microphone:{label:"Microphone",privacyPane:"Microphone",hint:"Scout Menu captures audio for web dictation. The browser never records.",appLabel:"Scout Menu"},speechRecognition:{label:"Speech recognition",privacyPane:"Speech Recognition",hint:"Live partials and Apple Speech fallback while Parakeet warms.",appLabel:"Scout Menu"}};function x(e){return e?e.granted?"ok":e.canRequest?"warn":e.status==="denied"||e.status==="restricted"?"fail":"warn":"idle"}function y(e){if(!e)return"Unknown";if(e.granted)return"Granted";switch(e.status){case"notDetermined":return"Not requested";case"denied":return"Denied";case"restricted":return"Restricted";case"authorized":return"Granted";default:return e.status}}function M(e,s){return e?e.granted?`${p[s].appLabel} is allowed to use ${p[s].label.toLowerCase()}.`:e.canRequest?`Click Request to show the macOS permission dialog for ${p[s].appLabel}.`:e.status==="denied"?`Choose Retry access. Scout Menu will open macOS ${p[s].privacyPane} settings and detect the change automatically.`:e.status==="restricted"?`${p[s].label} access is restricted on this Mac.`:`${p[s].appLabel} needs ${p[s].label.toLowerCase()} access before dictation works.`:"Launch Scout Menu on this Mac, then refresh."}function j(e){return!!(e&&!e.granted&&!e.canRequest&&e.status!=="unknown")}function R(e){return!!(e&&!e.granted&&e.status!=="restricted"&&e.status!=="unknown")}function L({hostOnline:e,micPermission:s,speechPermission:r,modelReady:l}){const c=s?.granted??!1,d=r?.granted??!1,u=e&&c&&d;let i="fail",t="Scout Menu not connected",a="Launch Scout Menu on this Mac. Web dictation uses the Scout voice host — not the browser microphone.";return e&&!c&&(s?.status==="denied"||s?.status==="restricted")?(i="fail",t="Microphone blocked for Scout Menu",a=s?.status==="restricted"?"Microphone access is restricted on this Mac.":"Choose Retry access below. Scout will open the right macOS pane and detect the change."):e&&!c&&s?.canRequest?(i="warn",t="Microphone access needed",a="Request permission below or tap the mic in chat. Scout Menu will show the macOS prompt."):e&&c&&!d&&(r?.status==="denied"||r?.status==="restricted")?(i="warn",t="Speech recognition blocked for Scout Menu",a=r?.status==="restricted"?"Speech recognition is restricted on this Mac.":"Open Privacy & Security → Speech Recognition to change it."):e&&c&&!d?(i="warn",t="Speech recognition needed",a="Request access below or tap the mic in chat. Scout Menu will show the macOS prompt."):e&&u?(i="ok",t=l?"Dictation ready":"Dictation ready · model warming",a="Scout Menu is running as the voice host. The browser does not capture audio."):e&&(i="warn",t="Voice host connected",a="Finish permissions below to enable dictation."),n.jsxs("div",{className:`s-voice-host-banner s-voice-host-banner--${i}`,children:[n.jsx("div",{className:"s-voice-host-banner-dot","aria-hidden":!0}),n.jsxs("div",{className:"s-voice-host-banner-copy",children:[n.jsx("div",{className:"s-voice-host-banner-title",children:t}),n.jsx("div",{className:"s-voice-host-banner-detail",children:a}),n.jsxs("div",{className:"s-voice-host-banner-meta",children:[n.jsx("span",{children:"Voice host · Scout Menu"}),n.jsx("span",{children:e?"Connected":"Offline"}),n.jsx("span",{children:"Capture · native"})]})]})]})}function f({kind:e,status:s,disabled:r,onActionError:l,onRefresh:c}){const[d,u]=h.useState(!1),i=h.useRef(s),t=p[e],a=x(s);h.useEffect(()=>{i.current=s},[s]);const m=h.useCallback(async()=>{for(let o=0;o<30;o+=1)if(await new Promise(S=>window.setTimeout(S,1e3)),await c(),i.current?.granted)return},[c]),v=h.useCallback(async()=>{u(!0);try{await w(e),await m()}catch(o){l(o instanceof Error?o.message:String(o))}finally{u(!1)}},[e,l,m]),b=h.useCallback(async()=>{u(!0);try{await g(e)}catch(o){l(o instanceof Error?o.message:String(o))}finally{u(!1)}},[e,l]);return n.jsxs("div",{className:`s-voice-permission-card s-voice-permission-card--${a}`,children:[n.jsxs("div",{className:"s-voice-permission-card-head",children:[n.jsx("span",{className:"s-voice-permission-card-dot","aria-hidden":!0}),n.jsxs("div",{children:[n.jsx("div",{className:"s-voice-permission-card-label",children:t.label}),n.jsxs("div",{className:"s-voice-permission-card-app",children:["via ",t.appLabel]})]}),n.jsx("span",{className:`s-voice-permission-card-status s-voice-permission-card-status--${a}`,children:y(s)})]}),n.jsx("p",{className:"s-voice-permission-card-hint",children:t.hint}),n.jsx("p",{className:"s-voice-permission-card-detail",children:M(s,e)}),n.jsxs("div",{className:"s-voice-permission-card-actions",children:[R(s)?n.jsx("button",{type:"button",className:"s-voice-permission-btn s-voice-permission-btn--primary",disabled:r||d,onClick:()=>{v()},children:d?s?.canRequest?"Requesting…":"Waiting for macOS…":s?.canRequest?"Request access":"Retry access"}):null,j(s)?n.jsxs("button",{type:"button",className:"s-voice-permission-btn",disabled:r||d,onClick:()=>{b()},children:["Open Privacy & Security → ",t.privacyPane]}):null]})]})}function P({permissions:e,hostOnline:s,disabled:r,onError:l,onRefresh:c}){const d=e?.find(i=>i.kind==="microphone")??null,u=e?.find(i=>i.kind==="speechRecognition")??null;return n.jsxs("div",{className:"s-voice-permissions-panel",children:[n.jsx(f,{kind:"microphone",status:s?d:null,disabled:r||!s,onActionError:l,onRefresh:c}),n.jsx(f,{kind:"speechRecognition",status:s?u:null,disabled:r||!s,onActionError:l,onRefresh:c}),s?null:n.jsx("p",{className:"s-voice-permissions-offline",children:"Scout Menu is not reporting to this web server. Permissions are managed on the Mac where Scout Menu runs."})]})}export{L as VoiceHostStatusBanner,P as VoicePermissionsPanel};
@@ -1,5 +1,5 @@
1
- import{r as h,j as e}from"./index-DMiGbrBt.js";import{D as Q}from"./DocumentFocusViewer-BeVwwl26.js";import{S as O}from"./StatusPill-DhBL__p8.js";import{c as Z}from"./TextDocumentSurface-BpAw4eQS.js";import{WorkFilesViewer as de}from"./WorkFilesViewer-Btl6C2Q1.js";import{r as M}from"./mentions-jSuTGeet.js";import{a as X}from"./api-h5zurxmi.js";import{u as T,m as le,k as ce}from"./Provider-C7UKGHQy.js";import{b as he}from"./router-Bq5dwf78.js";import{u as ue}from"./sse-CjIkKo46.js";import{w as me,c as ke}from"./status-tone-BM_zuRy1.js";import{t as $}from"./time-DltNTpLl.js";import{B as z}from"./BackToPicker-BRvfostO.js";import{o as m}from"./openContent-C6XO6kr5.js";import{TailView as fe}from"./TailView-DGj_5HA9.js";import{M as W}from"./message-square-DSaGpjFU.js";import{R as V}from"./radio-Bz8ZePxj.js";import{c as L}from"./createLucideIcon-OpA4Amw5.js";import{E as G}from"./external-link-CXBytO9o.js";import{A as J}from"./activity-CA8qS6PI.js";import{F as D}from"./file-text-BODxCjcz.js";import{C as pe}from"./code-xml-B6jOCM4V.js";/* empty css */import"./x-D3GElQbe.js";import"./chevron-right-XiIHsk4m.js";import"./chevron-down-BGk5qoEw.js";import"./colors-BtO5_zlx.js";import"./index-CJXzfjo9.js";import"./AgentDetailCard-BcRBRp88.js";import"./AgentLiveActions-DBtnD0qE.js";import"./terminal-takeover-B8UeD9OX.js";import"./eye-0PvebX_a.js";import"./terminal-B9AOZQKR.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-bARZqTzD.js";import"./arrow-left-DEZzHiPS.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-2kv_tGUS.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./NewChatComposer-Cs6OsxK6.js";import"./runtime-picker-Bcl5iIX5.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-CbHjZsz1.js";import"./HarnessMark-Cbv3Ib0c.js";import"./conversation-model-B47vYmWN.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./search-CWfZtOt2.js";import"./terminal-sessions-D5CIR2OL.js";import"./index-BWHgHrtv.js";import"./SlidePanel-COwtoJqR.js";import"./tail-display-BdyoLvzY.js";import"./lane-edit-display-C_Aujldz.js";import"./tail-events-D19uAGe3.js";const ve=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],xe=L("book-open",ve);const we=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],_=L("clipboard",we);const je=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],B=L("folder-tree",je);function K(s){switch(s){case"review":return"In review";case"waiting":return"Waiting";case"working":return"Working";case"done":return"Done";default:return s.replace(/_/g," ")}}function ge(s){switch(s){case"badge":return"Noteworthy";case"interrupt":return"Blocked signal";default:return null}}function Ie({detail:s,signal:t,ownerLabel:r,nextMoveLabel:n}){const i=n==="—"?r:n;return s.attention==="interrupt"?{eyebrow:"Network signal",title:`Blocker surfaced for ${i}`,body:s.conversationId?"Open the thread if you want the blocking context.":"No thread is attached; the record and timeline hold the current context.",tone:"blocked"}:t?{eyebrow:"Network signal",title:`Plan activity from ${i}`,body:s.conversationId?"A plan or spec discussion is active in the agent network. Open the thread only if you want context.":"A plan or spec discussion is active in the agent network, but no thread is attached yet.",tone:"attention"}:s.activeFlights.length>0||s.state==="in_turn"||s.state==="in_flight"?{eyebrow:"Next move",title:`${r} is working`,body:s.conversationId?"The thread has the freshest working context.":"Watch the flight list and timeline for the next update.",tone:"active"}:s.state==="waiting"||s.state==="review"?{eyebrow:"Next move",title:`Waiting on ${n}`,body:s.conversationId?"The thread has the current unblock context.":"No thread is attached; ownership and timeline are the best context.",tone:"quiet"}:s.state==="done"?{eyebrow:"Outcome",title:"Work is done",body:s.conversationId?"The thread keeps the handoff and final context.":"The record and timeline are preserved here.",tone:"quiet"}:{eyebrow:"Next move",title:n==="—"?"No next owner set":`Next move: ${n}`,body:s.conversationId?"The thread has the latest context.":"Use the record and timeline to decide where this should go next.",tone:"quiet"}}function f({children:s,icon:t,onClick:r,primary:n=!1,disabled:i=!1}){return e.jsxs("button",{type:"button",className:`s-work-action-button${n?" s-work-action-button-primary":""}`,onClick:r,disabled:i,children:[t,e.jsx("span",{children:s})]})}function Y(s){const t=s?.toLowerCase()??"";return t.includes("mcp")?"MCP request":t.includes("cli")?"CLI request":t?`${s} request`:"Scout request"}function ee(s){const t=s.primaryInvocation,r=t?.targetAgentName??t?.targetAgentId??s.ownerName??s.ownerId??"The agent";switch(t?.state??s.activeFlights[0]?.state??s.state){case"running":return`${r} is running in background. Synchronous wait may have expired, but the Run is still active.`;case"waking":return`${r} is waking up for this Run.`;case"queued":return`${r} has the Run queued.`;case"waiting":case"review":return`${r} paused and is waiting for the next move.`;case"completed":case"done":return`${r} completed this Run.`;case"failed":return`${r} reported a failure for this Run.`;case"cancelled":return"This Run was cancelled.";default:return`${r} is attached to this work item.`}}function Ne(s){const t=s.primaryInvocation;return[`Work: ${s.id}`,`State: ${s.currentPhase}`,t?`Source: ${Y(t.source)}`:null,t?.targetAgentName||t?.targetAgentId?`Resolved agent: ${t.targetAgentName??t.targetAgentId}`:null,t?.requestedHarness?`Requested harness: ${t.requestedHarness}`:null,t?.requestedModel?`Requested model: ${t.requestedModel}`:null,t?.requestedReasoningEffort?`Requested effort: ${t.requestedReasoningEffort}`:null,t?.resolvedHarness?`Resolved harness: ${t.resolvedHarness}`:null,t?.resolvedModel?`Resolved model: ${t.resolvedModel}`:null,t?.resolvedReasoningEffort?`Resolved effort: ${t.resolvedReasoningEffort}`:null,t?.observedModel?`Observed model: ${t.observedModel}`:null,t?.observedReasoningEffort?`Observed effort: ${t.observedReasoningEffort}`:null,t?.resolvedSessionId?`Session: ${t.resolvedSessionId}`:null,t?.flightId?`Flight: ${t.flightId}`:null,t?.invocationId?`Invocation: ${t.invocationId}`:null,s.conversationId?`Conversation: ${s.conversationId}`:null,ee(s)].filter(Boolean).join(`
1
+ import{r as h,j as e}from"./index-sUomXsrf.js";import{D as Q}from"./DocumentFocusViewer-DU_9BHsD.js";import{S as O}from"./StatusPill-CbABggnQ.js";import{c as Z}from"./TextDocumentSurface-C-9EtYqt.js";import{WorkFilesViewer as de}from"./WorkFilesViewer-CF-nhtZ4.js";import{r as M}from"./mentions-CY_wPZc5.js";import{a as X}from"./api-h5zurxmi.js";import{u as T,m as le,k as ce}from"./Provider-tFc3jqZ4.js";import{b as he}from"./router-Dja9_ygK.js";import{u as ue}from"./sse-CVoGDiKW.js";import{w as me,c as ke}from"./status-tone-BM_zuRy1.js";import{t as $}from"./time-Dhsh_2EG.js";import{B as z}from"./BackToPicker-CkUmHuuo.js";import{o as m}from"./openContent-C6XO6kr5.js";import{TailView as pe}from"./TailView-C_MXVSum.js";import{M as W}from"./message-square-BD-4UUdc.js";import{R as V}from"./radio-DedMyP8J.js";import{c as L}from"./createLucideIcon-DlxlBfLC.js";import{E as G}from"./external-link-CnjcXf32.js";import{A as J}from"./activity-WhBf3FXP.js";import{F as D}from"./file-text-i3xTDUjJ.js";import{C as fe}from"./code-xml-05TD3uOC.js";/* empty css */import"./x-0XjXwGqq.js";import"./chevron-right-CyUa1zXx.js";import"./chevron-down-BFai6ZfE.js";import"./colors-BtO5_zlx.js";import"./index-m6dFtY5f.js";import"./AgentDetailCard-DxxVkgT1.js";import"./AgentLiveActions-CZdAInEu.js";import"./terminal-takeover-X97KCSJk.js";import"./eye-So8tNNK6.js";import"./terminal-DXQISjZn.js";import"./surface-activity-B1rgWB1i.js";import"./scoutbot-BTIErYHo.js";import"./ContextMenu-BlBQhpax.js";import"./arrow-left-WjQIN9J6.js";import"./scout-voice-BZ4KqADJ.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-BhZZ5HEq.js";import"./MessageComposerSuggestions-zAUUcLOv.js";import"./NewChatComposer-B5FnPyzS.js";import"./runtime-picker-DOZpZOlt.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-lWOOKezu.js";import"./HarnessMark-Dm_qm1Ku.js";import"./conversation-model-C4yb6_FA.js";import"./NewChatOrigin--pHWUb4V.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./search-DCT_EvPr.js";import"./chunk-HRAB3GC3-CvwpNg-G.js";import"./terminal-sessions-D5CIR2OL.js";import"./index-BWHgHrtv.js";import"./SlidePanel-FCqT1zO3.js";import"./tail-display-BdyoLvzY.js";import"./lane-edit-display-C_Aujldz.js";import"./tail-events-CTipUIli.js";const ve=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],xe=L("book-open",ve);const we=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],_=L("clipboard",we);const je=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],B=L("folder-tree",je);function K(s){switch(s){case"review":return"In review";case"waiting":return"Waiting";case"working":return"Working";case"done":return"Done";default:return s.replace(/_/g," ")}}function ge(s){switch(s){case"badge":return"Noteworthy";case"interrupt":return"Blocked signal";default:return null}}function Ie({detail:s,signal:t,ownerLabel:r,nextMoveLabel:n}){const i=n==="—"?r:n;return s.attention==="interrupt"?{eyebrow:"Network signal",title:`Blocker surfaced for ${i}`,body:s.conversationId?"Open the thread if you want the blocking context.":"No thread is attached; the record and timeline hold the current context.",tone:"blocked"}:t?{eyebrow:"Network signal",title:`Plan activity from ${i}`,body:s.conversationId?"A plan or spec discussion is active in the agent network. Open the thread only if you want context.":"A plan or spec discussion is active in the agent network, but no thread is attached yet.",tone:"attention"}:s.activeFlights.length>0||s.state==="in_turn"||s.state==="in_flight"?{eyebrow:"Next move",title:`${r} is working`,body:s.conversationId?"The thread has the freshest working context.":"Watch the flight list and timeline for the next update.",tone:"active"}:s.state==="waiting"||s.state==="review"?{eyebrow:"Next move",title:`Waiting on ${n}`,body:s.conversationId?"The thread has the current unblock context.":"No thread is attached; ownership and timeline are the best context.",tone:"quiet"}:s.state==="done"?{eyebrow:"Outcome",title:"Work is done",body:s.conversationId?"The thread keeps the handoff and final context.":"The record and timeline are preserved here.",tone:"quiet"}:{eyebrow:"Next move",title:n==="—"?"No next owner set":`Next move: ${n}`,body:s.conversationId?"The thread has the latest context.":"Use the record and timeline to decide where this should go next.",tone:"quiet"}}function p({children:s,icon:t,onClick:r,primary:n=!1,disabled:i=!1}){return e.jsxs("button",{type:"button",className:`s-work-action-button${n?" s-work-action-button-primary":""}`,onClick:r,disabled:i,children:[t,e.jsx("span",{children:s})]})}function Y(s){const t=s?.toLowerCase()??"";return t.includes("mcp")?"MCP request":t.includes("cli")?"CLI request":t?`${s} request`:"Scout request"}function ee(s){const t=s.primaryInvocation,r=t?.targetAgentName??t?.targetAgentId??s.ownerName??s.ownerId??"The agent";switch(t?.state??s.activeFlights[0]?.state??s.state){case"running":return`${r} is running in background. Synchronous wait may have expired, but the Run is still active.`;case"waking":return`${r} is waking up for this Run.`;case"queued":return`${r} has the Run queued.`;case"waiting":case"review":return`${r} paused and is waiting for the next move.`;case"completed":case"done":return`${r} completed this Run.`;case"failed":return`${r} reported a failure for this Run.`;case"cancelled":return"This Run was cancelled.";default:return`${r} is attached to this work item.`}}function Ne(s){const t=s.primaryInvocation;return[`Work: ${s.id}`,`State: ${s.currentPhase}`,t?`Source: ${Y(t.source)}`:null,t?.targetAgentName||t?.targetAgentId?`Resolved agent: ${t.targetAgentName??t.targetAgentId}`:null,t?.requestedHarness?`Requested harness: ${t.requestedHarness}`:null,t?.requestedModel?`Requested model: ${t.requestedModel}`:null,t?.requestedReasoningEffort?`Requested effort: ${t.requestedReasoningEffort}`:null,t?.resolvedHarness?`Resolved harness: ${t.resolvedHarness}`:null,t?.resolvedModel?`Resolved model: ${t.resolvedModel}`:null,t?.resolvedReasoningEffort?`Resolved effort: ${t.resolvedReasoningEffort}`:null,t?.observedModel?`Observed model: ${t.observedModel}`:null,t?.observedReasoningEffort?`Observed effort: ${t.observedReasoningEffort}`:null,t?.resolvedSessionId?`Session: ${t.resolvedSessionId}`:null,t?.flightId?`Flight: ${t.flightId}`:null,t?.invocationId?`Invocation: ${t.invocationId}`:null,s.conversationId?`Conversation: ${s.conversationId}`:null,ee(s)].filter(Boolean).join(`
2
2
  `)}function ye(s){const t=s.primaryInvocation;return[`workId=${s.id}`,t?.flightId?`flightId=${t.flightId}`:null,t?.invocationId?`invocationId=${t.invocationId}`:null,s.conversationId?`conversationId=${s.conversationId}`:null,t?.targetAgentId?`agentId=${t.targetAgentId}`:null,t?.resolvedSessionId?`sessionId=${t.resolvedSessionId}`:null].filter(Boolean).join(`
3
- `)}function U(s){navigator.clipboard?.writeText(s)}function be({detail:s,navigate:t}){const{route:r}=T(),n=s.primaryInvocation,i=ne(s).query,o=ye(s),u=Y(n?.source),p=n?.targetAgentName??n?.targetAgentId??s.ownerName??s.ownerId??"—",g=n?.task??se(s)??s.summary??"No original prompt captured.",k=n?.resolvedSessionId?{view:"sessions",sessionId:n.resolvedSessionId,...n.targetAgentId?{agentId:n.targetAgentId}:{}}:n?.targetAgentId?{view:"agents-v2",agentId:n.targetAgentId,tab:"observe"}:null,w=n?.resolvedSessionId?"Observe session":"Observe agent",v={view:"ops",mode:"tail",...i?{tailQuery:i}:{},workId:s.id,...n?.flightId?{flightId:n.flightId}:{},...n?.invocationId?{invocationId:n.invocationId}:{},...s.conversationId?{conversationId:s.conversationId}:{},...n?.resolvedSessionId?{sessionId:n.resolvedSessionId}:{},...n?.targetAgentId?{targetAgentId:n.targetAgentId}:{}};return e.jsxs("section",{className:"s-work-casefile-section s-work-ask-overview","data-kind":"ask","data-work-id":s.id,"data-flight-id":n?.flightId??void 0,"data-invocation-id":n?.invocationId??void 0,"data-agent-id":n?.targetAgentId??void 0,children:[e.jsx("div",{className:"s-work-ask-head",children:e.jsxs("div",{children:[e.jsxs("div",{className:"s-work-ask-badges",children:[e.jsx("span",{className:"s-work-ask-badge s-work-ask-badge-primary",children:"RUN created"}),e.jsx("span",{className:"s-work-ask-badge",children:u}),n?.state&&e.jsx("span",{className:"s-work-ask-badge",children:n.state})]}),e.jsx("h2",{className:"s-agent-section-title s-work-ask-title",children:"Message / work source of truth"}),e.jsx("p",{className:"s-work-ask-lifecycle",children:ee(s)})]})}),e.jsxs("div",{className:"s-work-ask-grid",children:[e.jsxs("div",{className:"s-work-ask-prompt",children:[e.jsx("span",{className:"s-work-ask-label",children:"Original prompt"}),e.jsx("p",{children:M(g)})]}),e.jsxs("dl",{className:"s-work-ask-facts",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Requested harness"}),e.jsx("dd",{children:n?.requestedHarness??"default"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Requested model"}),e.jsx("dd",{children:n?.requestedModel??"default"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Requested effort"}),e.jsx("dd",{children:n?.requestedReasoningEffort??"default"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Resolved agent"}),e.jsx("dd",{children:p})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Resolved harness"}),e.jsx("dd",{children:n?.resolvedHarness??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Resolved model"}),e.jsx("dd",{children:n?.resolvedModel??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Resolved effort"}),e.jsx("dd",{children:n?.resolvedReasoningEffort??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Observed model"}),e.jsx("dd",{children:n?.observedModel??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Observed effort"}),e.jsx("dd",{children:n?.observedReasoningEffort??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Session"}),e.jsx("dd",{children:n?.resolvedSessionId??n?.targetSessionId??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Flight"}),e.jsx("dd",{children:n?.flightId??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Invocation"}),e.jsx("dd",{children:n?.invocationId??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Work"}),e.jsx("dd",{children:s.id})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Conversation"}),e.jsx("dd",{children:s.conversationId??"—"})]})]})]}),e.jsxs("div",{className:"s-work-ask-actions",children:[k&&e.jsx(f,{primary:!0,icon:e.jsx(V,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(t,k,{returnTo:r}),children:w}),e.jsx(f,{icon:e.jsx(_,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>U(Ne(s)),children:"Copy status"}),s.conversationId&&e.jsx(f,{icon:e.jsx(W,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(t,{view:"conversation",conversationId:s.conversationId},{returnTo:r}),children:"Open chat"}),e.jsx(f,{icon:e.jsx(G,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(t,{view:"work",workId:s.id},{returnTo:r}),children:"Open work"}),n?.resolvedSessionId&&e.jsx(f,{icon:e.jsx(V,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(t,{view:"sessions",sessionId:n.resolvedSessionId},{returnTo:r}),children:"Open session"}),e.jsx(f,{icon:e.jsx(J,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(t,v,{returnTo:r}),children:"Scout tail"}),o&&e.jsx(f,{icon:e.jsx(_,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>U(o),children:"Copy MCP ids"}),s.conversationId&&e.jsx(f,{icon:e.jsx(W,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(t,{view:"conversation",conversationId:s.conversationId},{returnTo:r}),children:"Nudge agent"})]})]})}function Se({detail:s,navigate:t}){const r=!!s.conversationId,n=s.inventory??Ce(s),i=n.materials.filter(l=>l.kind==="plan"||l.kind==="spec"),o=n.materials.filter(l=>l.kind==="doc"),u=n.materials.filter(l=>l.kind==="code"||l.kind==="test"||l.kind==="config"||l.kind==="asset"||l.kind==="other"),p=i.length>0,g=o.length>0,k=se(s),w=i[0]?We(i[0]):k??"No plan or spec file detected yet.",v=[...i,...o,...u].filter(l=>l.status!=="deleted"),[N,j]=h.useState(!1),[a,x]=h.useState(null),[C,y]=h.useState(null),[I,b]=h.useState(null),[d,R]=h.useState(null),[re,P]=h.useState(!1),[ie,oe]=h.useState("all"),A=h.useCallback(l=>{j(!1),x(l)},[]),ae=h.useCallback(()=>{x(null),j(!0)},[]),q=h.useCallback(l=>{j(!1),x(null),oe(l),P(!0)},[]);return h.useEffect(()=>{a&&!v.some(l=>l.id===a)&&x(null)},[a,v]),h.useEffect(()=>{if(!a){y(null),b(null),R(null);return}let l=!1;return R(a),b(null),X(`/api/work/${encodeURIComponent(s.id)}/material?materialId=${encodeURIComponent(a)}`).then(S=>{l||y(S)}).catch(S=>{l||(y(null),b(S instanceof Error?S.message:String(S)))}).finally(()=>{l||R(null)}),()=>{l=!0}},[s.id,a]),e.jsxs("section",{className:"s-work-casefile-section s-work-materials-section",children:[e.jsxs("div",{className:"s-agent-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"s-agent-section-title",children:"Work materials"}),e.jsxs("p",{className:"s-work-section-note",children:[Me(n.mode)," · ",n.source," evidence · ",n.confidence," confidence"]})]}),e.jsxs("div",{className:"s-work-inventory-meta","aria-label":"Inventory totals",children:[e.jsxs("span",{children:[n.totals.materials," files"]}),e.jsxs("span",{children:[n.totals.agents," agents"]}),e.jsxs("span",{children:[n.totals.sessions," sessions"]})]})]}),e.jsxs("div",{className:"s-work-material-grid",children:[e.jsxs("article",{className:"s-work-material-card s-work-material-card-primary",children:[e.jsxs("div",{className:"s-work-material-head",children:[e.jsx("span",{className:"s-work-material-icon","aria-hidden":"true",children:e.jsx(D,{size:15,strokeWidth:1.8})}),e.jsxs("div",{children:[e.jsx("div",{className:"s-work-material-kicker",children:p?"Plans & specs":"Brief"}),e.jsx("div",{className:"s-work-material-title",children:p?`${i.length} surfaced`:k?"Original request":"No plan file yet"})]})]}),e.jsx("p",{className:"s-work-material-copy",children:w}),e.jsx(E,{materials:i.slice(0,3),empty:"No plan or spec files detected yet.",selectedId:a,onOpen:A}),e.jsxs("div",{className:"s-work-material-card-actions",children:[k&&e.jsxs("button",{type:"button",className:`s-work-material-link${N?" s-work-material-link-active":""}`,onClick:ae,children:[e.jsx(D,{"aria-hidden":"true",size:13,strokeWidth:1.8}),"View request"]}),i.length>3&&e.jsxs("button",{type:"button",className:"s-work-material-link",onClick:()=>q("plan"),children:[e.jsx(B,{"aria-hidden":"true",size:13,strokeWidth:1.8}),"View all ",i.length]})]})]}),e.jsxs("div",{className:`s-work-material-evidence-stack${g?"":" s-work-material-evidence-stack-single"}`,children:[g&&e.jsxs("article",{className:"s-work-material-card s-work-material-card-docs",children:[e.jsxs("div",{className:"s-work-material-head",children:[e.jsx("span",{className:"s-work-material-icon","aria-hidden":"true",children:e.jsx(xe,{size:15,strokeWidth:1.8})}),e.jsxs("div",{children:[e.jsx("div",{className:"s-work-material-kicker",children:"Docs"}),e.jsxs("div",{className:"s-work-material-title",children:[o.length," documents"]})]})]}),e.jsx(E,{materials:o.slice(0,3),empty:"Docs from git or trace evidence will appear here.",selectedId:a,onOpen:A}),o.length>3&&e.jsx("div",{className:"s-work-material-card-actions",children:e.jsxs("button",{type:"button",className:"s-work-material-link",onClick:()=>q("doc"),children:[e.jsx(B,{"aria-hidden":"true",size:13,strokeWidth:1.8}),"View all ",o.length]})})]}),e.jsxs("article",{className:"s-work-material-card s-work-material-card-code",children:[e.jsxs("div",{className:"s-work-material-head",children:[e.jsx("span",{className:"s-work-material-icon","aria-hidden":"true",children:e.jsx(pe,{size:15,strokeWidth:1.8})}),e.jsxs("div",{children:[e.jsx("div",{className:"s-work-material-kicker",children:"Code"}),e.jsx("div",{className:"s-work-material-title",children:u.length>0?`${u.length} related files`:"No code yet"})]})]}),e.jsx(E,{materials:u.slice(0,5),empty:"Changed code from git or session traces will appear here.",selectedId:a,onOpen:A}),u.length>5&&e.jsx("div",{className:"s-work-material-card-actions",children:e.jsxs("button",{type:"button",className:"s-work-material-link",onClick:()=>q("code"),children:[e.jsx(B,{"aria-hidden":"true",size:13,strokeWidth:1.8}),"View all ",u.length]})})]})]})]}),e.jsx($e,{detail:s,summary:k,open:N,hasThread:r,navigate:t,onClose:()=>j(!1)}),e.jsx(Te,{material:v.find(l=>l.id===a)??null,content:C,loading:!!d,error:I,onClose:()=>x(null)}),e.jsx(de,{workId:s.id,workTitle:s.title,materials:v,open:re,initialKind:ie,onClose:()=>P(!1)}),n.limitations.length>0&&e.jsx("div",{className:"s-work-inventory-note",children:n.limitations[0]})]})}function $e({detail:s,summary:t,open:r,hasThread:n,navigate:i,onClose:o}){const{route:u}=T();if(!r||!t)return null;const p=Z({id:`${s.id}:brief`,title:"Original request",uri:`scout://work/${s.id}/brief`,mediaType:"text/markdown",value:`# Original request
3
+ `)}function U(s){navigator.clipboard?.writeText(s)}function be({detail:s,navigate:t}){const{route:r}=T(),n=s.primaryInvocation,i=ne(s).query,o=ye(s),u=Y(n?.source),f=n?.targetAgentName??n?.targetAgentId??s.ownerName??s.ownerId??"—",g=n?.task??se(s)??s.summary??"No original prompt captured.",k=n?.resolvedSessionId?{view:"sessions",sessionId:n.resolvedSessionId,...n.targetAgentId?{agentId:n.targetAgentId}:{}}:n?.targetAgentId?{view:"agents-v2",agentId:n.targetAgentId,tab:"observe"}:null,w=n?.resolvedSessionId?"Observe session":"Observe agent",v={view:"ops",mode:"tail",...i?{tailQuery:i}:{},workId:s.id,...n?.flightId?{flightId:n.flightId}:{},...n?.invocationId?{invocationId:n.invocationId}:{},...s.conversationId?{conversationId:s.conversationId}:{},...n?.resolvedSessionId?{sessionId:n.resolvedSessionId}:{},...n?.targetAgentId?{targetAgentId:n.targetAgentId}:{}};return e.jsxs("section",{className:"s-work-casefile-section s-work-ask-overview","data-kind":"ask","data-work-id":s.id,"data-flight-id":n?.flightId??void 0,"data-invocation-id":n?.invocationId??void 0,"data-agent-id":n?.targetAgentId??void 0,children:[e.jsx("div",{className:"s-work-ask-head",children:e.jsxs("div",{children:[e.jsxs("div",{className:"s-work-ask-badges",children:[e.jsx("span",{className:"s-work-ask-badge s-work-ask-badge-primary",children:"RUN created"}),e.jsx("span",{className:"s-work-ask-badge",children:u}),n?.state&&e.jsx("span",{className:"s-work-ask-badge",children:n.state})]}),e.jsx("h2",{className:"s-agent-section-title s-work-ask-title",children:"Message / work source of truth"}),e.jsx("p",{className:"s-work-ask-lifecycle",children:ee(s)})]})}),e.jsxs("div",{className:"s-work-ask-grid",children:[e.jsxs("div",{className:"s-work-ask-prompt",children:[e.jsx("span",{className:"s-work-ask-label",children:"Original prompt"}),e.jsx("p",{children:M(g)})]}),e.jsxs("dl",{className:"s-work-ask-facts",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Requested harness"}),e.jsx("dd",{children:n?.requestedHarness??"default"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Requested model"}),e.jsx("dd",{children:n?.requestedModel??"default"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Requested effort"}),e.jsx("dd",{children:n?.requestedReasoningEffort??"default"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Resolved agent"}),e.jsx("dd",{children:f})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Resolved harness"}),e.jsx("dd",{children:n?.resolvedHarness??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Resolved model"}),e.jsx("dd",{children:n?.resolvedModel??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Resolved effort"}),e.jsx("dd",{children:n?.resolvedReasoningEffort??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Observed model"}),e.jsx("dd",{children:n?.observedModel??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Observed effort"}),e.jsx("dd",{children:n?.observedReasoningEffort??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Session"}),e.jsx("dd",{children:n?.resolvedSessionId??n?.targetSessionId??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Flight"}),e.jsx("dd",{children:n?.flightId??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Invocation"}),e.jsx("dd",{children:n?.invocationId??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Work"}),e.jsx("dd",{children:s.id})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Conversation"}),e.jsx("dd",{children:s.conversationId??"—"})]})]})]}),e.jsxs("div",{className:"s-work-ask-actions",children:[k&&e.jsx(p,{primary:!0,icon:e.jsx(V,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(t,k,{returnTo:r}),children:w}),e.jsx(p,{icon:e.jsx(_,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>U(Ne(s)),children:"Copy status"}),s.conversationId&&e.jsx(p,{icon:e.jsx(W,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(t,{view:"conversation",conversationId:s.conversationId},{returnTo:r}),children:"Open chat"}),e.jsx(p,{icon:e.jsx(G,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(t,{view:"work",workId:s.id},{returnTo:r}),children:"Open work"}),n?.resolvedSessionId&&e.jsx(p,{icon:e.jsx(V,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(t,{view:"sessions",sessionId:n.resolvedSessionId},{returnTo:r}),children:"Open session"}),e.jsx(p,{icon:e.jsx(J,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(t,v,{returnTo:r}),children:"Scout tail"}),o&&e.jsx(p,{icon:e.jsx(_,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>U(o),children:"Copy MCP ids"}),s.conversationId&&e.jsx(p,{icon:e.jsx(W,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(t,{view:"conversation",conversationId:s.conversationId},{returnTo:r}),children:"Nudge agent"})]})]})}function Se({detail:s,navigate:t}){const r=!!s.conversationId,n=s.inventory??Ce(s),i=n.materials.filter(l=>l.kind==="plan"||l.kind==="spec"),o=n.materials.filter(l=>l.kind==="doc"),u=n.materials.filter(l=>l.kind==="code"||l.kind==="test"||l.kind==="config"||l.kind==="asset"||l.kind==="other"),f=i.length>0,g=o.length>0,k=se(s),w=i[0]?We(i[0]):k??"No plan or spec file detected yet.",v=[...i,...o,...u].filter(l=>l.status!=="deleted"),[N,j]=h.useState(!1),[a,x]=h.useState(null),[C,y]=h.useState(null),[I,b]=h.useState(null),[d,R]=h.useState(null),[re,P]=h.useState(!1),[ie,oe]=h.useState("all"),A=h.useCallback(l=>{j(!1),x(l)},[]),ae=h.useCallback(()=>{x(null),j(!0)},[]),q=h.useCallback(l=>{j(!1),x(null),oe(l),P(!0)},[]);return h.useEffect(()=>{a&&!v.some(l=>l.id===a)&&x(null)},[a,v]),h.useEffect(()=>{if(!a){y(null),b(null),R(null);return}let l=!1;return R(a),b(null),X(`/api/work/${encodeURIComponent(s.id)}/material?materialId=${encodeURIComponent(a)}`).then(S=>{l||y(S)}).catch(S=>{l||(y(null),b(S instanceof Error?S.message:String(S)))}).finally(()=>{l||R(null)}),()=>{l=!0}},[s.id,a]),e.jsxs("section",{className:"s-work-casefile-section s-work-materials-section",children:[e.jsxs("div",{className:"s-agent-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"s-agent-section-title",children:"Work materials"}),e.jsxs("p",{className:"s-work-section-note",children:[Me(n.mode)," · ",n.source," evidence · ",n.confidence," confidence"]})]}),e.jsxs("div",{className:"s-work-inventory-meta","aria-label":"Inventory totals",children:[e.jsxs("span",{children:[n.totals.materials," files"]}),e.jsxs("span",{children:[n.totals.agents," agents"]}),e.jsxs("span",{children:[n.totals.sessions," sessions"]})]})]}),e.jsxs("div",{className:"s-work-material-grid",children:[e.jsxs("article",{className:"s-work-material-card s-work-material-card-primary",children:[e.jsxs("div",{className:"s-work-material-head",children:[e.jsx("span",{className:"s-work-material-icon","aria-hidden":"true",children:e.jsx(D,{size:15,strokeWidth:1.8})}),e.jsxs("div",{children:[e.jsx("div",{className:"s-work-material-kicker",children:f?"Plans & specs":"Brief"}),e.jsx("div",{className:"s-work-material-title",children:f?`${i.length} surfaced`:k?"Original request":"No plan file yet"})]})]}),e.jsx("p",{className:"s-work-material-copy",children:w}),e.jsx(E,{materials:i.slice(0,3),empty:"No plan or spec files detected yet.",selectedId:a,onOpen:A}),e.jsxs("div",{className:"s-work-material-card-actions",children:[k&&e.jsxs("button",{type:"button",className:`s-work-material-link${N?" s-work-material-link-active":""}`,onClick:ae,children:[e.jsx(D,{"aria-hidden":"true",size:13,strokeWidth:1.8}),"View request"]}),i.length>3&&e.jsxs("button",{type:"button",className:"s-work-material-link",onClick:()=>q("plan"),children:[e.jsx(B,{"aria-hidden":"true",size:13,strokeWidth:1.8}),"View all ",i.length]})]})]}),e.jsxs("div",{className:`s-work-material-evidence-stack${g?"":" s-work-material-evidence-stack-single"}`,children:[g&&e.jsxs("article",{className:"s-work-material-card s-work-material-card-docs",children:[e.jsxs("div",{className:"s-work-material-head",children:[e.jsx("span",{className:"s-work-material-icon","aria-hidden":"true",children:e.jsx(xe,{size:15,strokeWidth:1.8})}),e.jsxs("div",{children:[e.jsx("div",{className:"s-work-material-kicker",children:"Docs"}),e.jsxs("div",{className:"s-work-material-title",children:[o.length," documents"]})]})]}),e.jsx(E,{materials:o.slice(0,3),empty:"Docs from git or trace evidence will appear here.",selectedId:a,onOpen:A}),o.length>3&&e.jsx("div",{className:"s-work-material-card-actions",children:e.jsxs("button",{type:"button",className:"s-work-material-link",onClick:()=>q("doc"),children:[e.jsx(B,{"aria-hidden":"true",size:13,strokeWidth:1.8}),"View all ",o.length]})})]}),e.jsxs("article",{className:"s-work-material-card s-work-material-card-code",children:[e.jsxs("div",{className:"s-work-material-head",children:[e.jsx("span",{className:"s-work-material-icon","aria-hidden":"true",children:e.jsx(fe,{size:15,strokeWidth:1.8})}),e.jsxs("div",{children:[e.jsx("div",{className:"s-work-material-kicker",children:"Code"}),e.jsx("div",{className:"s-work-material-title",children:u.length>0?`${u.length} related files`:"No code yet"})]})]}),e.jsx(E,{materials:u.slice(0,5),empty:"Changed code from git or session traces will appear here.",selectedId:a,onOpen:A}),u.length>5&&e.jsx("div",{className:"s-work-material-card-actions",children:e.jsxs("button",{type:"button",className:"s-work-material-link",onClick:()=>q("code"),children:[e.jsx(B,{"aria-hidden":"true",size:13,strokeWidth:1.8}),"View all ",u.length]})})]})]})]}),e.jsx($e,{detail:s,summary:k,open:N,hasThread:r,navigate:t,onClose:()=>j(!1)}),e.jsx(Te,{material:v.find(l=>l.id===a)??null,content:C,loading:!!d,error:I,onClose:()=>x(null)}),e.jsx(de,{workId:s.id,workTitle:s.title,materials:v,open:re,initialKind:ie,onClose:()=>P(!1)}),n.limitations.length>0&&e.jsx("div",{className:"s-work-inventory-note",children:n.limitations[0]})]})}function $e({detail:s,summary:t,open:r,hasThread:n,navigate:i,onClose:o}){const{route:u}=T();if(!r||!t)return null;const f=Z({id:`${s.id}:brief`,title:"Original request",uri:`scout://work/${s.id}/brief`,mediaType:"text/markdown",value:`# Original request
4
4
 
5
- ${t}`,readOnly:!0});return e.jsx(Q,{kind:"ask",document:p,title:"Original request",eyebrow:"Brief",subtitle:s.title,meta:["request",n?"thread linked":"threadless"],mode:"preview",actions:n&&s.conversationId?[{label:"Thread",icon:e.jsx(W,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(i,{view:"conversation",conversationId:s.conversationId},{returnTo:u}),title:"Open source thread"}]:[],onClose:o})}function se(s){const t=[...s.timeline].sort((i,o)=>i.at-o.at),r=t.find(i=>i.kind==="collaboration_event"&&i.detailKind==="created"&&i.summary),n=t.find(i=>i.kind==="message"&&i.summary);return r?.summary??n?.summary??null}function Ce(s){return{workId:s.id,generatedAt:Date.now(),mode:"trace-only",source:"broker",confidence:"low",agents:[],sessions:[],materials:[],totals:{materials:0,plans:0,specs:0,docs:0,code:0,tests:0,config:0,assets:0,agents:0,sessions:0},limitations:["Inventory is not available from this server yet."]}}function Me(s){switch(s){case"isolated-git-worktree":return"Isolated git worktree";case"shared-git-repo":return"Shared git repo";case"explicit-artifacts":return"Explicit artifacts";default:return"Trace-only"}}function We(s){const t=s.diffStat?`+${s.diffStat.additions} / -${s.diffStat.deletions}`:s.status;return`${s.path} · ${t} · ${s.confidence} confidence`}function E({materials:s,empty:t,selectedId:r,onOpen:n}){return s.length===0?e.jsx("div",{className:"s-work-material-empty",children:t}):e.jsx("div",{className:"s-work-material-list",children:s.map(i=>e.jsxs("button",{type:"button",className:`s-work-material-row${r===i.id?" s-work-material-row-active":""}`,title:i.path,onClick:()=>n?.(i.id),disabled:!n||i.status==="deleted",children:[e.jsx("div",{className:"s-work-material-path",children:i.path}),e.jsxs("div",{className:"s-work-material-row-meta",children:[e.jsx("span",{children:i.status}),i.diffStat&&e.jsxs("span",{children:["+",i.diffStat.additions," -",i.diffStat.deletions]}),e.jsx("span",{children:i.confidence})]})]},i.id))})}function Te({material:s,content:t,loading:r,error:n,onClose:i}){if(!s)return null;const o=t?Z({id:t.materialId,title:t.title,uri:t.uri,mediaType:t.mediaType,value:t.content,readOnly:!0}):null;return e.jsx(Q,{kind:Re(s),document:o,title:s.path,eyebrow:s.kind==="spec"?"Spec":s.kind,subtitle:t?.uri??s.worktreeRoot??void 0,meta:[s.status,s.confidence,...t?[H(t.sizeBytes)]:[]],mode:o?.kind==="markdown"?"preview":"read",state:r||!t&&!n?"Loading file...":null,error:r?null:n,notice:t?.truncated?`Preview truncated at ${H(t.content.length)}.`:null,onClose:i})}function Re(s){return s.kind==="plan"||s.kind==="spec"?"plan":s.kind==="doc"?"doc":"code"}function H(s){return s<1024?`${s} B`:s<1024*1024?`${Math.round(s/1024)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function te(s){const t=s.split(".");return t[t.length-1]||s}function c(s,t){const r=t?.trim();!r||r.length<3||s.add(r)}function F(s,t){c(s,t);const n=t?.trim().replace(/\/+$/,"")?.split("/").filter(Boolean).at(-1);n&&n.length>=3&&s.add(n)}function Ae(s){return s.replace(/^\/Users\/[^/]+/,"~")}function ne(s){const t=new Set,r=[],n=s.ownerName??s.ownerId??s.nextMoveOwnerName??s.nextMoveOwnerId;c(t,s.id),c(t,s.conversationId),c(t,s.ownerId),c(t,s.nextMoveOwnerId),c(t,s.ownerName),c(t,s.nextMoveOwnerName);for(const o of s.activeFlights)c(t,o.id),c(t,o.invocationId),c(t,o.agentId),c(t,o.agentName),c(t,o.conversationId),c(t,o.collaborationRecordId);for(const o of s.inventory?.agents??[])c(t,o.id),c(t,o.name),c(t,o.sessionId),F(t,o.cwd),F(t,o.projectRoot);const i=s.inventory?.sessions.find(o=>o.cwd)??s.inventory?.sessions[0]??null;for(const o of s.inventory?.sessions??[])c(t,o.id),c(t,o.conversationId),c(t,o.agentId),c(t,o.agentName),F(t,o.cwd);return n&&r.push(n),i?.cwd&&r.push(Ae(i.cwd)),{query:[...t].slice(0,20).join("|"),label:r.length>0?r.join(" · "):`Case ${te(s.id)}`}}function qe(s){return s.kind==="message"?s.title||(s.detailKind==="agent"?"reply":"thread update"):s.kind==="flight_started"?"agent output":s.kind==="flight_completed"?s.detailKind==="completed"?"reply":s.detailKind??"flight":s.detailKind==="created"?"request created":s.title??s.kind.replace(/_/g," ")}function Oe({detail:s}){const t=s.timeline.slice(0,18);return t.length===0?null:e.jsxs("section",{className:"s-work-casefile-section s-work-timeline-panel",children:[e.jsx("div",{className:"s-agent-section-heading",children:e.jsxs("div",{children:[e.jsx("h2",{className:"s-agent-section-title",children:"Timeline"}),e.jsx("p",{className:"s-work-section-note",children:"Run lifecycle, follow-up requirements, flight state, and replies attached to this work item."})]})}),e.jsx("div",{className:"s-work-timeline-list",children:t.map(r=>e.jsxs("article",{className:`s-work-timeline-row s-work-timeline-row-${r.kind}`,"data-kind":r.kind,"data-flight-id":r.flightId??void 0,"data-work-id":s.id,"data-conversation-id":r.conversationId??s.conversationId??void 0,children:[e.jsx("span",{className:"s-work-timeline-badge",children:qe(r)}),e.jsxs("div",{className:"s-work-timeline-body",children:[e.jsxs("div",{className:"s-work-timeline-meta",children:[e.jsx("span",{children:r.actorName??r.actorId??"system"}),e.jsx("span",{children:$(r.at)})]}),r.summary&&e.jsx("p",{children:M(r.summary)})]})]},r.id))})]})}function ze({detail:s,navigate:t}){const{route:r}=T(),n=ne(s);return e.jsxs("section",{className:"s-work-casefile-section s-work-tail-section",children:[e.jsxs("div",{className:"s-agent-section-heading s-work-tail-heading",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"s-agent-section-title s-work-tail-title",children:[e.jsx(J,{"aria-hidden":"true",size:15,strokeWidth:1.8}),"Live tail"]}),e.jsxs("p",{className:"s-work-section-note",children:["Filtered to ",n.label]})]}),e.jsx(f,{icon:e.jsx(G,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(t,{view:"ops",mode:"tail",tailQuery:n.query||void 0},{returnTo:r}),children:"Scout tail"})]}),e.jsx("div",{className:"s-work-tail-frame",children:e.jsx(fe,{navigate:t,initialFilter:n.query,filterLabel:n.label,filterScope:"context",chrome:"embedded"})})]})}function Ps({workId:s,navigate:t}){const{agents:r,route:n}=T(),[i,o]=h.useState(null),[u,p]=h.useState(null),[g,k]=h.useState(!1),w=h.useCallback(async()=>{p(null);try{const d=await X(`/api/work/${encodeURIComponent(s)}`);o(d)}catch(d){p(d instanceof Error?d.message:String(d)),o(null)}finally{k(!0)}},[s]);h.useEffect(()=>{k(!1),w()},[w]),ue(()=>{w()});const v=he(n),N=h.useMemo(()=>le(r,v),[r,v]),j=h.useMemo(()=>i?ce(i,N):null,[i,N]);if(!g)return e.jsxs("div",{children:[e.jsx(z,{slot:"work",fallback:{view:"inbox"},navigate:t}),e.jsx("div",{className:"s-empty",children:e.jsx("p",{children:"Loading…"})})]});if(!i||!j)return e.jsxs("div",{className:"s-work-not-found",children:[e.jsx(z,{slot:"work",fallback:{view:"inbox"},navigate:t}),e.jsxs("div",{className:"s-work-not-found-body",children:[e.jsx("div",{className:"s-work-not-found-glyph","aria-hidden":"true",children:"□"}),e.jsx("h2",{className:"s-work-not-found-title",children:i?"Work item outside this machine scope":"Work item not found"}),e.jsx("p",{className:"s-work-not-found-sub",children:i?"Clear the machine scope or switch machines to inspect this work item.":"This work item may have been removed or does not exist on this broker."}),u&&e.jsx("p",{className:"s-work-not-found-detail",children:u})]})]});const a=j,x=ge(a.attention),C=a.ownerName??a.ownerId??"Unassigned",y=a.nextMoveOwnerName??a.nextMoveOwnerId??"—",I=Ie({detail:a,signal:x,ownerLabel:C,nextMoveLabel:y}),b=a.activeFlights.length>0||a.childWork.length>0;return e.jsxs("div",{className:"s-work-detail s-work-casefile",children:[e.jsxs("div",{className:"s-work-casefile-topbar",children:[e.jsx(z,{slot:"work",fallback:{view:"inbox"},navigate:t}),e.jsxs("span",{className:"s-work-casefile-record",children:["Case ",te(a.id)]})]}),u&&e.jsx("p",{className:"s-error",children:u}),e.jsxs("section",{className:"s-work-casefile-hero",children:[e.jsxs("div",{className:"s-work-casefile-hero-main",children:[e.jsxs("div",{className:"s-work-casefile-title-row",children:[e.jsx("h1",{className:"s-work-casefile-title",children:a.title}),e.jsx(O,{tone:me(a),variant:"pill",children:a.currentPhase})]}),a.lastMeaningfulSummary&&e.jsx("div",{className:"s-work-casefile-summary",children:M(a.lastMeaningfulSummary)}),e.jsxs("div",{className:"s-work-casefile-meta",children:[e.jsxs("span",{children:["Updated ",$(a.updatedAt)]}),e.jsx("span",{children:C}),e.jsx("span",{children:K(a.state)}),x&&e.jsx("span",{children:x}),a.priority&&e.jsxs("span",{children:["Priority ",a.priority]})]})]}),e.jsxs("aside",{className:`s-work-next-move s-work-next-move-${I.tone}`,children:[e.jsx("div",{className:"s-work-next-move-kicker",children:I.eyebrow}),e.jsx("div",{className:"s-work-next-move-title",children:I.title}),e.jsx("p",{className:"s-work-next-move-copy",children:I.body}),e.jsx("div",{className:"s-work-next-move-actions",children:a.conversationId&&e.jsx(f,{primary:!0,icon:e.jsx(W,{"aria-hidden":"true",size:14,strokeWidth:1.8}),onClick:()=>m(t,{view:"conversation",conversationId:a.conversationId},{returnTo:n}),children:"Open thread"})})]})]}),e.jsxs("div",{className:"s-work-casefile-layout s-work-casefile-layout-main",children:[e.jsxs("div",{className:"s-work-casefile-main s-work-casefile-main-materials",children:[e.jsx(be,{detail:a,navigate:t}),e.jsx(Se,{detail:a,navigate:t}),e.jsx(Oe,{detail:a})]}),e.jsx(ze,{detail:a,navigate:t}),b&&e.jsxs("div",{className:"s-work-casefile-main s-work-casefile-main-lower",children:[a.activeFlights.length>0&&e.jsxs("section",{className:"s-work-casefile-section",children:[e.jsx("div",{className:"s-agent-section-heading",children:e.jsx("h2",{className:"s-agent-section-title",children:"Flights"})}),e.jsx("div",{className:"s-work-flight-list",children:a.activeFlights.map(d=>e.jsxs("button",{type:"button",className:"s-work-flight-card",onClick:d.conversationId?()=>m(t,{view:"conversation",conversationId:d.conversationId},{returnTo:n}):void 0,disabled:!d.conversationId,children:[e.jsxs("div",{className:"s-work-flight-card-header",children:[e.jsx("span",{className:"s-work-flight-card-title",children:d.agentName??d.agentId}),e.jsx(O,{tone:"working",variant:"pill",children:d.state})]}),e.jsxs("div",{className:"s-work-flight-card-meta",children:[e.jsx("span",{children:d.startedAt?`Started ${$(d.startedAt)}`:"Start time unavailable"}),d.completedAt&&e.jsxs("span",{children:["Completed ",$(d.completedAt)]})]}),d.summary&&e.jsx("div",{className:"s-work-flight-card-copy",children:d.summary})]},d.id))})]}),a.childWork.length>0&&e.jsxs("section",{className:"s-work-casefile-section",children:[e.jsx("div",{className:"s-agent-section-heading",children:e.jsx("h2",{className:"s-agent-section-title",children:"Child work"})}),e.jsx("div",{className:"s-work-related-list",children:a.childWork.map(d=>e.jsxs("button",{type:"button",className:"s-work-related-card",onClick:()=>m(t,{view:"work",workId:d.id},{returnTo:n}),children:[e.jsxs("div",{className:"s-work-related-card-header",children:[e.jsx("span",{className:"s-work-related-card-title",children:d.title}),e.jsx(O,{tone:ke(d),variant:"pill",children:d.currentPhase})]}),e.jsxs("div",{className:"s-work-related-card-meta",children:[e.jsx("span",{children:d.ownerName??d.ownerId??"Unassigned"}),e.jsx("span",{children:K(d.state)}),e.jsx("span",{children:$(d.lastMeaningfulAt)})]}),d.lastMeaningfulSummary&&e.jsx("div",{className:"s-work-related-card-copy",children:M(d.lastMeaningfulSummary)})]},d.id))})]})]})]})]})}export{Ps as WorkDetailScreen};
5
+ ${t}`,readOnly:!0});return e.jsx(Q,{kind:"ask",document:f,title:"Original request",eyebrow:"Brief",subtitle:s.title,meta:["request",n?"thread linked":"threadless"],mode:"preview",actions:n&&s.conversationId?[{label:"Thread",icon:e.jsx(W,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(i,{view:"conversation",conversationId:s.conversationId},{returnTo:u}),title:"Open source thread"}]:[],onClose:o})}function se(s){const t=[...s.timeline].sort((i,o)=>i.at-o.at),r=t.find(i=>i.kind==="collaboration_event"&&i.detailKind==="created"&&i.summary),n=t.find(i=>i.kind==="message"&&i.summary);return r?.summary??n?.summary??null}function Ce(s){return{workId:s.id,generatedAt:Date.now(),mode:"trace-only",source:"broker",confidence:"low",agents:[],sessions:[],materials:[],totals:{materials:0,plans:0,specs:0,docs:0,code:0,tests:0,config:0,assets:0,agents:0,sessions:0},limitations:["Inventory is not available from this server yet."]}}function Me(s){switch(s){case"isolated-git-worktree":return"Isolated git worktree";case"shared-git-repo":return"Shared git repo";case"explicit-artifacts":return"Explicit artifacts";default:return"Trace-only"}}function We(s){const t=s.diffStat?`+${s.diffStat.additions} / -${s.diffStat.deletions}`:s.status;return`${s.path} · ${t} · ${s.confidence} confidence`}function E({materials:s,empty:t,selectedId:r,onOpen:n}){return s.length===0?e.jsx("div",{className:"s-work-material-empty",children:t}):e.jsx("div",{className:"s-work-material-list",children:s.map(i=>e.jsxs("button",{type:"button",className:`s-work-material-row${r===i.id?" s-work-material-row-active":""}`,title:i.path,onClick:()=>n?.(i.id),disabled:!n||i.status==="deleted",children:[e.jsx("div",{className:"s-work-material-path",children:i.path}),e.jsxs("div",{className:"s-work-material-row-meta",children:[e.jsx("span",{children:i.status}),i.diffStat&&e.jsxs("span",{children:["+",i.diffStat.additions," -",i.diffStat.deletions]}),e.jsx("span",{children:i.confidence})]})]},i.id))})}function Te({material:s,content:t,loading:r,error:n,onClose:i}){if(!s)return null;const o=t?Z({id:t.materialId,title:t.title,uri:t.uri,mediaType:t.mediaType,value:t.content,readOnly:!0}):null;return e.jsx(Q,{kind:Re(s),document:o,title:s.path,eyebrow:s.kind==="spec"?"Spec":s.kind,subtitle:t?.uri??s.worktreeRoot??void 0,meta:[s.status,s.confidence,...t?[H(t.sizeBytes)]:[]],mode:o?.kind==="markdown"?"preview":"read",state:r||!t&&!n?"Loading file...":null,error:r?null:n,notice:t?.truncated?`Preview truncated at ${H(t.content.length)}.`:null,onClose:i})}function Re(s){return s.kind==="plan"||s.kind==="spec"?"plan":s.kind==="doc"?"doc":"code"}function H(s){return s<1024?`${s} B`:s<1024*1024?`${Math.round(s/1024)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function te(s){const t=s.split(".");return t[t.length-1]||s}function c(s,t){const r=t?.trim();!r||r.length<3||s.add(r)}function F(s,t){c(s,t);const n=t?.trim().replace(/\/+$/,"")?.split("/").filter(Boolean).at(-1);n&&n.length>=3&&s.add(n)}function Ae(s){return s.replace(/^\/Users\/[^/]+/,"~")}function ne(s){const t=new Set,r=[],n=s.ownerName??s.ownerId??s.nextMoveOwnerName??s.nextMoveOwnerId;c(t,s.id),c(t,s.conversationId),c(t,s.ownerId),c(t,s.nextMoveOwnerId),c(t,s.ownerName),c(t,s.nextMoveOwnerName);for(const o of s.activeFlights)c(t,o.id),c(t,o.invocationId),c(t,o.agentId),c(t,o.agentName),c(t,o.conversationId),c(t,o.collaborationRecordId);for(const o of s.inventory?.agents??[])c(t,o.id),c(t,o.name),c(t,o.sessionId),F(t,o.cwd),F(t,o.projectRoot);const i=s.inventory?.sessions.find(o=>o.cwd)??s.inventory?.sessions[0]??null;for(const o of s.inventory?.sessions??[])c(t,o.id),c(t,o.conversationId),c(t,o.agentId),c(t,o.agentName),F(t,o.cwd);return n&&r.push(n),i?.cwd&&r.push(Ae(i.cwd)),{query:[...t].slice(0,20).join("|"),label:r.length>0?r.join(" · "):`Case ${te(s.id)}`}}function qe(s){return s.kind==="message"?s.title||(s.detailKind==="agent"?"reply":"thread update"):s.kind==="flight_started"?"agent output":s.kind==="flight_completed"?s.detailKind==="completed"?"reply":s.detailKind??"flight":s.detailKind==="created"?"request created":s.title??s.kind.replace(/_/g," ")}function Oe({detail:s}){const t=s.timeline.slice(0,18);return t.length===0?null:e.jsxs("section",{className:"s-work-casefile-section s-work-timeline-panel",children:[e.jsx("div",{className:"s-agent-section-heading",children:e.jsxs("div",{children:[e.jsx("h2",{className:"s-agent-section-title",children:"Timeline"}),e.jsx("p",{className:"s-work-section-note",children:"Run lifecycle, follow-up requirements, flight state, and replies attached to this work item."})]})}),e.jsx("div",{className:"s-work-timeline-list",children:t.map(r=>e.jsxs("article",{className:`s-work-timeline-row s-work-timeline-row-${r.kind}`,"data-kind":r.kind,"data-flight-id":r.flightId??void 0,"data-work-id":s.id,"data-conversation-id":r.conversationId??s.conversationId??void 0,children:[e.jsx("span",{className:"s-work-timeline-badge",children:qe(r)}),e.jsxs("div",{className:"s-work-timeline-body",children:[e.jsxs("div",{className:"s-work-timeline-meta",children:[e.jsx("span",{children:r.actorName??r.actorId??"system"}),e.jsx("span",{children:$(r.at)})]}),r.summary&&e.jsx("p",{children:M(r.summary)})]})]},r.id))})]})}function ze({detail:s,navigate:t}){const{route:r}=T(),n=ne(s);return e.jsxs("section",{className:"s-work-casefile-section s-work-tail-section",children:[e.jsxs("div",{className:"s-agent-section-heading s-work-tail-heading",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"s-agent-section-title s-work-tail-title",children:[e.jsx(J,{"aria-hidden":"true",size:15,strokeWidth:1.8}),"Live tail"]}),e.jsxs("p",{className:"s-work-section-note",children:["Filtered to ",n.label]})]}),e.jsx(p,{icon:e.jsx(G,{"aria-hidden":"true",size:13,strokeWidth:1.8}),onClick:()=>m(t,{view:"ops",mode:"tail",tailQuery:n.query||void 0},{returnTo:r}),children:"Scout tail"})]}),e.jsx("div",{className:"s-work-tail-frame",children:e.jsx(pe,{navigate:t,initialFilter:n.query,filterLabel:n.label,filterScope:"context",chrome:"embedded"})})]})}function Vs({workId:s,navigate:t}){const{agents:r,route:n}=T(),[i,o]=h.useState(null),[u,f]=h.useState(null),[g,k]=h.useState(!1),w=h.useCallback(async()=>{f(null);try{const d=await X(`/api/work/${encodeURIComponent(s)}`);o(d)}catch(d){f(d instanceof Error?d.message:String(d)),o(null)}finally{k(!0)}},[s]);h.useEffect(()=>{k(!1),w()},[w]),ue(()=>{w()});const v=he(n),N=h.useMemo(()=>le(r,v),[r,v]),j=h.useMemo(()=>i?ce(i,N):null,[i,N]);if(!g)return e.jsxs("div",{children:[e.jsx(z,{slot:"work",fallback:{view:"inbox"},navigate:t}),e.jsx("div",{className:"s-empty",children:e.jsx("p",{children:"Loading…"})})]});if(!i||!j)return e.jsxs("div",{className:"s-work-not-found",children:[e.jsx(z,{slot:"work",fallback:{view:"inbox"},navigate:t}),e.jsxs("div",{className:"s-work-not-found-body",children:[e.jsx("div",{className:"s-work-not-found-glyph","aria-hidden":"true",children:"□"}),e.jsx("h2",{className:"s-work-not-found-title",children:i?"Work item outside this machine scope":"Work item not found"}),e.jsx("p",{className:"s-work-not-found-sub",children:i?"Clear the machine scope or switch machines to inspect this work item.":"This work item may have been removed or does not exist on this broker."}),u&&e.jsx("p",{className:"s-work-not-found-detail",children:u})]})]});const a=j,x=ge(a.attention),C=a.ownerName??a.ownerId??"Unassigned",y=a.nextMoveOwnerName??a.nextMoveOwnerId??"—",I=Ie({detail:a,signal:x,ownerLabel:C,nextMoveLabel:y}),b=a.activeFlights.length>0||a.childWork.length>0;return e.jsxs("div",{className:"s-work-detail s-work-casefile",children:[e.jsxs("div",{className:"s-work-casefile-topbar",children:[e.jsx(z,{slot:"work",fallback:{view:"inbox"},navigate:t}),e.jsxs("span",{className:"s-work-casefile-record",children:["Case ",te(a.id)]})]}),u&&e.jsx("p",{className:"s-error",children:u}),e.jsxs("section",{className:"s-work-casefile-hero",children:[e.jsxs("div",{className:"s-work-casefile-hero-main",children:[e.jsxs("div",{className:"s-work-casefile-title-row",children:[e.jsx("h1",{className:"s-work-casefile-title",children:a.title}),e.jsx(O,{tone:me(a),variant:"pill",children:a.currentPhase})]}),a.lastMeaningfulSummary&&e.jsx("div",{className:"s-work-casefile-summary",children:M(a.lastMeaningfulSummary)}),e.jsxs("div",{className:"s-work-casefile-meta",children:[e.jsxs("span",{children:["Updated ",$(a.updatedAt)]}),e.jsx("span",{children:C}),e.jsx("span",{children:K(a.state)}),x&&e.jsx("span",{children:x}),a.priority&&e.jsxs("span",{children:["Priority ",a.priority]})]})]}),e.jsxs("aside",{className:`s-work-next-move s-work-next-move-${I.tone}`,children:[e.jsx("div",{className:"s-work-next-move-kicker",children:I.eyebrow}),e.jsx("div",{className:"s-work-next-move-title",children:I.title}),e.jsx("p",{className:"s-work-next-move-copy",children:I.body}),e.jsx("div",{className:"s-work-next-move-actions",children:a.conversationId&&e.jsx(p,{primary:!0,icon:e.jsx(W,{"aria-hidden":"true",size:14,strokeWidth:1.8}),onClick:()=>m(t,{view:"conversation",conversationId:a.conversationId},{returnTo:n}),children:"Open thread"})})]})]}),e.jsxs("div",{className:"s-work-casefile-layout s-work-casefile-layout-main",children:[e.jsxs("div",{className:"s-work-casefile-main s-work-casefile-main-materials",children:[e.jsx(be,{detail:a,navigate:t}),e.jsx(Se,{detail:a,navigate:t}),e.jsx(Oe,{detail:a})]}),e.jsx(ze,{detail:a,navigate:t}),b&&e.jsxs("div",{className:"s-work-casefile-main s-work-casefile-main-lower",children:[a.activeFlights.length>0&&e.jsxs("section",{className:"s-work-casefile-section",children:[e.jsx("div",{className:"s-agent-section-heading",children:e.jsx("h2",{className:"s-agent-section-title",children:"Flights"})}),e.jsx("div",{className:"s-work-flight-list",children:a.activeFlights.map(d=>e.jsxs("button",{type:"button",className:"s-work-flight-card",onClick:d.conversationId?()=>m(t,{view:"conversation",conversationId:d.conversationId},{returnTo:n}):void 0,disabled:!d.conversationId,children:[e.jsxs("div",{className:"s-work-flight-card-header",children:[e.jsx("span",{className:"s-work-flight-card-title",children:d.agentName??d.agentId}),e.jsx(O,{tone:"working",variant:"pill",children:d.state})]}),e.jsxs("div",{className:"s-work-flight-card-meta",children:[e.jsx("span",{children:d.startedAt?`Started ${$(d.startedAt)}`:"Start time unavailable"}),d.completedAt&&e.jsxs("span",{children:["Completed ",$(d.completedAt)]})]}),d.summary&&e.jsx("div",{className:"s-work-flight-card-copy",children:d.summary})]},d.id))})]}),a.childWork.length>0&&e.jsxs("section",{className:"s-work-casefile-section",children:[e.jsx("div",{className:"s-agent-section-heading",children:e.jsx("h2",{className:"s-agent-section-title",children:"Child work"})}),e.jsx("div",{className:"s-work-related-list",children:a.childWork.map(d=>e.jsxs("button",{type:"button",className:"s-work-related-card",onClick:()=>m(t,{view:"work",workId:d.id},{returnTo:n}),children:[e.jsxs("div",{className:"s-work-related-card-header",children:[e.jsx("span",{className:"s-work-related-card-title",children:d.title}),e.jsx(O,{tone:ke(d),variant:"pill",children:d.currentPhase})]}),e.jsxs("div",{className:"s-work-related-card-meta",children:[e.jsx("span",{children:d.ownerName??d.ownerId??"Unassigned"}),e.jsx("span",{children:K(d.state)}),e.jsx("span",{children:$(d.lastMeaningfulAt)})]}),d.lastMeaningfulSummary&&e.jsx("div",{className:"s-work-related-card-copy",children:M(d.lastMeaningfulSummary)})]},d.id))})]})]})]})]})}export{Vs as WorkDetailScreen};
@@ -1 +1 @@
1
- import{r as c,j as e}from"./index-DMiGbrBt.js";import{D as F,F as T,a as E}from"./DocumentFocusViewer-BeVwwl26.js";import{c as D,T as M}from"./TextDocumentSurface-BpAw4eQS.js";import{a as R}from"./api-h5zurxmi.js";import{C as L}from"./chevron-right-XiIHsk4m.js";import{C as W}from"./chevron-down-BGk5qoEw.js";import{c as z}from"./createLucideIcon-OpA4Amw5.js";import{F as B}from"./file-text-BODxCjcz.js";/* empty css */import"./x-D3GElQbe.js";const A=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],O=z("image",A),P=new Set(["png","jpg","jpeg","gif","webp","avif","svg"]),g=[{value:"all",label:"All"},{value:"plan",label:"Plans"},{value:"doc",label:"Docs"},{value:"code",label:"Code"},{value:"test",label:"Tests"},{value:"config",label:"Config"},{value:"asset",label:"Assets"}];function U(s){const t=s.split("/").pop()??s,l=t.lastIndexOf(".");return l>=0?t.slice(l+1).toLowerCase():""}function v(s){return P.has(U(s.path))}function _(s){const t={type:"dir",children:[]};for(const l of s){const a=l.path.split("/").filter(Boolean);if(a.length===0)continue;let n=t;for(let f=0;f<a.length-1;f+=1){const i=a[f],p=a.slice(0,f+1).join("/");let o=n.children.find(d=>d.type==="dir"&&d.name===i);o||(o={type:"dir",name:i,path:p,children:[]},n.children.push(o)),n=o}n.children.push({type:"file",name:a[a.length-1],path:l.path,material:l})}return b(t),N(t.children)}function b(s){if(s.type==="dir"){s.children.sort((t,l)=>t.type!==l.type?t.type==="dir"?-1:1:t.name.localeCompare(l.name));for(const t of s.children)b(t)}}function N(s){return s.map(t=>{if(t.type!=="dir")return t;let l=t;for(;l.children.length===1&&l.children[0].type==="dir";){const a=l.children[0];l={type:"dir",name:`${l.name}/${a.name}`,path:a.path,children:a.children}}return{...l,children:N(l.children)}})}function G(s){switch(s){case"added":return"A";case"modified":return"M";case"deleted":return"D";case"renamed":return"R";case"untracked":return"?";case"observed":return null}}function y({node:s,depth:t,selectedId:l,collapsed:a,onToggle:n,onSelect:f}){if(s.type==="dir"){const u=a.has(s.path);return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"s-work-files-tree-row s-work-files-tree-dir",style:{paddingLeft:`${8+t*12}px`},onClick:()=>n(s.path),children:[e.jsx("span",{className:"s-work-files-tree-chevron","aria-hidden":"true",children:u?e.jsx(L,{size:12,strokeWidth:1.8}):e.jsx(W,{size:12,strokeWidth:1.8})}),e.jsx("span",{className:"s-work-files-tree-icon","aria-hidden":"true",children:u?e.jsx(T,{size:12,strokeWidth:1.8}):e.jsx(E,{size:12,strokeWidth:1.8})}),e.jsx("span",{className:"s-work-files-tree-name",children:s.name||"/"})]}),!u&&s.children.map(m=>e.jsx(y,{node:m,depth:t+1,selectedId:l,collapsed:a,onToggle:n,onSelect:f},m.type==="dir"?`d:${m.path}`:`f:${m.material.id}`))]})}const i=s.material.id===l,p=v(s.material),o=G(s.material.status),d=s.material.status==="deleted";return e.jsxs("button",{type:"button",className:`s-work-files-tree-row s-work-files-tree-file${i?" s-work-files-tree-file-selected":""}`,style:{paddingLeft:`${8+t*12}px`},onClick:()=>f(s.material),disabled:d,title:s.path,children:[e.jsx("span",{className:"s-work-files-tree-chevron","aria-hidden":"true"}),e.jsx("span",{className:"s-work-files-tree-icon","aria-hidden":"true",children:p?e.jsx(O,{size:12,strokeWidth:1.8}):e.jsx(B,{size:12,strokeWidth:1.8})}),e.jsx("span",{className:"s-work-files-tree-name",children:s.name}),o&&e.jsx("span",{className:`s-work-files-tree-status s-work-files-tree-status-${s.material.status}`,"aria-label":s.material.status,children:o})]})}function V({path:s}){const t=s.split("/").filter(Boolean);if(t.length===0)return e.jsx("span",{className:"s-work-files-breadcrumb",children:s});const l=t[t.length-1],a=t.slice(0,-1).join("/");return e.jsxs("span",{className:"s-work-files-breadcrumb",children:[a&&e.jsxs("span",{className:"s-work-files-breadcrumb-folder",children:[a,"/"]}),e.jsx("span",{className:"s-work-files-breadcrumb-name",children:l})]})}function K({workId:s,material:t}){const l=v(t),[a,n]=c.useState(null),[f,i]=c.useState(null),[p,o]=c.useState(!1);if(c.useEffect(()=>{if(l){n(null),i(null),o(!1);return}let u=!1;return o(!0),i(null),n(null),R(`/api/work/${encodeURIComponent(s)}/material?materialId=${encodeURIComponent(t.id)}`).then(m=>{u||n(m)}).catch(m=>{u||i(m instanceof Error?m.message:String(m))}).finally(()=>{u||o(!1)}),()=>{u=!0}},[l,t.id,s]),l){const u=`/api/work/${encodeURIComponent(s)}/material/raw?materialId=${encodeURIComponent(t.id)}`;return e.jsx("div",{className:"s-work-files-pane s-work-files-pane-image",children:e.jsx("img",{src:u,alt:t.path,className:"s-work-files-image"})})}if(p&&!a)return e.jsx("div",{className:"s-work-files-pane-state",children:"Loading file…"});if(f)return e.jsx("div",{className:"s-work-files-pane-state s-work-files-pane-error",children:f});if(!a)return e.jsx("div",{className:"s-work-files-pane-state",children:"No content."});const d=D({id:a.materialId,title:a.title,uri:a.uri,mediaType:a.mediaType,value:a.content,readOnly:!0});return e.jsxs("div",{className:"s-work-files-pane",children:[e.jsx(M,{document:d,mode:d.kind==="markdown"?"preview":"read"}),a.truncated&&e.jsxs("div",{className:"s-work-files-pane-notice",children:["Preview truncated at ",Math.round(a.content.length/1024)," KB."]})]})}function re({workId:s,workTitle:t,materials:l,open:a,initialKind:n="all",onClose:f}){const i=c.useMemo(()=>l.filter(r=>r.status!=="deleted"),[l]),[p,o]=c.useState(n),[d,u]=c.useState(null),[m,C]=c.useState(()=>new Set);c.useEffect(()=>{a&&o(n)},[n,a]);const x=c.useMemo(()=>p==="all"?i:p==="plan"?i.filter(r=>r.kind==="plan"||r.kind==="spec"):i.filter(r=>r.kind===p),[i,p]),j=c.useMemo(()=>_(x),[x]);c.useEffect(()=>{if(!d&&x.length>0){u(x[0].id);return}d&&!x.some(r=>r.id===d)&&u(x[0]?.id??null)},[x,d]);const S=c.useCallback(r=>{u(r.id)},[]),I=c.useCallback(r=>{C(k=>{const h=new Set(k);return h.has(r)?h.delete(r):h.add(r),h})},[]),w=x.find(r=>r.id===d)??null,$=c.useMemo(()=>{const r={all:i.length};for(const k of g)k.value!=="all"&&(r[k.value]=i.filter(h=>k.value==="plan"?h.kind==="plan"||h.kind==="spec":h.kind===k.value).length);return r},[i]);return e.jsx(F,{open:a,kind:"code",document:null,title:`Files · ${i.length}`,eyebrow:"Work materials",subtitle:t,focusable:!0,onClose:f,body:e.jsxs("div",{className:"s-work-files-layout",children:[e.jsxs("aside",{className:"s-work-files-tree","aria-label":"File tree",children:[e.jsx("div",{className:"s-work-files-tree-filters",role:"tablist",children:g.map(r=>{const k=$[r.value]??0;if(r.value!=="all"&&k===0)return null;const h=r.value===p;return e.jsxs("button",{type:"button",role:"tab","aria-selected":h,className:`s-work-files-tree-filter${h?" s-work-files-tree-filter-active":""}`,onClick:()=>o(r.value),children:[e.jsx("span",{children:r.label}),e.jsx("span",{className:"s-work-files-tree-filter-count",children:k})]},r.value)})}),e.jsx("div",{className:"s-work-files-tree-list",children:j.length===0?e.jsx("div",{className:"s-work-files-tree-empty",children:"No files match this filter."}):j.map(r=>e.jsx(y,{node:r,depth:0,selectedId:d,collapsed:m,onToggle:I,onSelect:S},r.type==="dir"?`d:${r.path}`:`f:${r.material.id}`))})]}),e.jsx("section",{className:"s-work-files-content","aria-label":"File preview",children:w?e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"s-work-files-content-head",children:[e.jsx(V,{path:w.path}),e.jsxs("div",{className:"s-work-files-content-meta",children:[e.jsx("span",{children:w.kind}),e.jsx("span",{children:w.status}),w.diffStat&&e.jsxs("span",{children:["+",w.diffStat.additions," -",w.diffStat.deletions]})]})]}),e.jsx(K,{workId:s,material:w})]}):e.jsx("div",{className:"s-work-files-pane-state",children:"Select a file to preview."})})]})})}export{re as WorkFilesViewer};
1
+ import{r as c,j as e}from"./index-sUomXsrf.js";import{D as F,F as T,a as E}from"./DocumentFocusViewer-DU_9BHsD.js";import{c as D,T as M}from"./TextDocumentSurface-C-9EtYqt.js";import{a as R}from"./api-h5zurxmi.js";import{C as L}from"./chevron-right-CyUa1zXx.js";import{C as W}from"./chevron-down-BFai6ZfE.js";import{c as z}from"./createLucideIcon-DlxlBfLC.js";import{F as B}from"./file-text-i3xTDUjJ.js";/* empty css */import"./x-0XjXwGqq.js";const A=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],O=z("image",A),P=new Set(["png","jpg","jpeg","gif","webp","avif","svg"]),g=[{value:"all",label:"All"},{value:"plan",label:"Plans"},{value:"doc",label:"Docs"},{value:"code",label:"Code"},{value:"test",label:"Tests"},{value:"config",label:"Config"},{value:"asset",label:"Assets"}];function U(s){const t=s.split("/").pop()??s,l=t.lastIndexOf(".");return l>=0?t.slice(l+1).toLowerCase():""}function v(s){return P.has(U(s.path))}function _(s){const t={type:"dir",children:[]};for(const l of s){const a=l.path.split("/").filter(Boolean);if(a.length===0)continue;let n=t;for(let f=0;f<a.length-1;f+=1){const i=a[f],p=a.slice(0,f+1).join("/");let o=n.children.find(d=>d.type==="dir"&&d.name===i);o||(o={type:"dir",name:i,path:p,children:[]},n.children.push(o)),n=o}n.children.push({type:"file",name:a[a.length-1],path:l.path,material:l})}return b(t),N(t.children)}function b(s){if(s.type==="dir"){s.children.sort((t,l)=>t.type!==l.type?t.type==="dir"?-1:1:t.name.localeCompare(l.name));for(const t of s.children)b(t)}}function N(s){return s.map(t=>{if(t.type!=="dir")return t;let l=t;for(;l.children.length===1&&l.children[0].type==="dir";){const a=l.children[0];l={type:"dir",name:`${l.name}/${a.name}`,path:a.path,children:a.children}}return{...l,children:N(l.children)}})}function G(s){switch(s){case"added":return"A";case"modified":return"M";case"deleted":return"D";case"renamed":return"R";case"untracked":return"?";case"observed":return null}}function y({node:s,depth:t,selectedId:l,collapsed:a,onToggle:n,onSelect:f}){if(s.type==="dir"){const u=a.has(s.path);return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"s-work-files-tree-row s-work-files-tree-dir",style:{paddingLeft:`${8+t*12}px`},onClick:()=>n(s.path),children:[e.jsx("span",{className:"s-work-files-tree-chevron","aria-hidden":"true",children:u?e.jsx(L,{size:12,strokeWidth:1.8}):e.jsx(W,{size:12,strokeWidth:1.8})}),e.jsx("span",{className:"s-work-files-tree-icon","aria-hidden":"true",children:u?e.jsx(T,{size:12,strokeWidth:1.8}):e.jsx(E,{size:12,strokeWidth:1.8})}),e.jsx("span",{className:"s-work-files-tree-name",children:s.name||"/"})]}),!u&&s.children.map(m=>e.jsx(y,{node:m,depth:t+1,selectedId:l,collapsed:a,onToggle:n,onSelect:f},m.type==="dir"?`d:${m.path}`:`f:${m.material.id}`))]})}const i=s.material.id===l,p=v(s.material),o=G(s.material.status),d=s.material.status==="deleted";return e.jsxs("button",{type:"button",className:`s-work-files-tree-row s-work-files-tree-file${i?" s-work-files-tree-file-selected":""}`,style:{paddingLeft:`${8+t*12}px`},onClick:()=>f(s.material),disabled:d,title:s.path,children:[e.jsx("span",{className:"s-work-files-tree-chevron","aria-hidden":"true"}),e.jsx("span",{className:"s-work-files-tree-icon","aria-hidden":"true",children:p?e.jsx(O,{size:12,strokeWidth:1.8}):e.jsx(B,{size:12,strokeWidth:1.8})}),e.jsx("span",{className:"s-work-files-tree-name",children:s.name}),o&&e.jsx("span",{className:`s-work-files-tree-status s-work-files-tree-status-${s.material.status}`,"aria-label":s.material.status,children:o})]})}function V({path:s}){const t=s.split("/").filter(Boolean);if(t.length===0)return e.jsx("span",{className:"s-work-files-breadcrumb",children:s});const l=t[t.length-1],a=t.slice(0,-1).join("/");return e.jsxs("span",{className:"s-work-files-breadcrumb",children:[a&&e.jsxs("span",{className:"s-work-files-breadcrumb-folder",children:[a,"/"]}),e.jsx("span",{className:"s-work-files-breadcrumb-name",children:l})]})}function K({workId:s,material:t}){const l=v(t),[a,n]=c.useState(null),[f,i]=c.useState(null),[p,o]=c.useState(!1);if(c.useEffect(()=>{if(l){n(null),i(null),o(!1);return}let u=!1;return o(!0),i(null),n(null),R(`/api/work/${encodeURIComponent(s)}/material?materialId=${encodeURIComponent(t.id)}`).then(m=>{u||n(m)}).catch(m=>{u||i(m instanceof Error?m.message:String(m))}).finally(()=>{u||o(!1)}),()=>{u=!0}},[l,t.id,s]),l){const u=`/api/work/${encodeURIComponent(s)}/material/raw?materialId=${encodeURIComponent(t.id)}`;return e.jsx("div",{className:"s-work-files-pane s-work-files-pane-image",children:e.jsx("img",{src:u,alt:t.path,className:"s-work-files-image"})})}if(p&&!a)return e.jsx("div",{className:"s-work-files-pane-state",children:"Loading file…"});if(f)return e.jsx("div",{className:"s-work-files-pane-state s-work-files-pane-error",children:f});if(!a)return e.jsx("div",{className:"s-work-files-pane-state",children:"No content."});const d=D({id:a.materialId,title:a.title,uri:a.uri,mediaType:a.mediaType,value:a.content,readOnly:!0});return e.jsxs("div",{className:"s-work-files-pane",children:[e.jsx(M,{document:d,mode:d.kind==="markdown"?"preview":"read"}),a.truncated&&e.jsxs("div",{className:"s-work-files-pane-notice",children:["Preview truncated at ",Math.round(a.content.length/1024)," KB."]})]})}function re({workId:s,workTitle:t,materials:l,open:a,initialKind:n="all",onClose:f}){const i=c.useMemo(()=>l.filter(r=>r.status!=="deleted"),[l]),[p,o]=c.useState(n),[d,u]=c.useState(null),[m,C]=c.useState(()=>new Set);c.useEffect(()=>{a&&o(n)},[n,a]);const x=c.useMemo(()=>p==="all"?i:p==="plan"?i.filter(r=>r.kind==="plan"||r.kind==="spec"):i.filter(r=>r.kind===p),[i,p]),j=c.useMemo(()=>_(x),[x]);c.useEffect(()=>{if(!d&&x.length>0){u(x[0].id);return}d&&!x.some(r=>r.id===d)&&u(x[0]?.id??null)},[x,d]);const S=c.useCallback(r=>{u(r.id)},[]),I=c.useCallback(r=>{C(k=>{const h=new Set(k);return h.has(r)?h.delete(r):h.add(r),h})},[]),w=x.find(r=>r.id===d)??null,$=c.useMemo(()=>{const r={all:i.length};for(const k of g)k.value!=="all"&&(r[k.value]=i.filter(h=>k.value==="plan"?h.kind==="plan"||h.kind==="spec":h.kind===k.value).length);return r},[i]);return e.jsx(F,{open:a,kind:"code",document:null,title:`Files · ${i.length}`,eyebrow:"Work materials",subtitle:t,focusable:!0,onClose:f,body:e.jsxs("div",{className:"s-work-files-layout",children:[e.jsxs("aside",{className:"s-work-files-tree","aria-label":"File tree",children:[e.jsx("div",{className:"s-work-files-tree-filters",role:"tablist",children:g.map(r=>{const k=$[r.value]??0;if(r.value!=="all"&&k===0)return null;const h=r.value===p;return e.jsxs("button",{type:"button",role:"tab","aria-selected":h,className:`s-work-files-tree-filter${h?" s-work-files-tree-filter-active":""}`,onClick:()=>o(r.value),children:[e.jsx("span",{children:r.label}),e.jsx("span",{className:"s-work-files-tree-filter-count",children:k})]},r.value)})}),e.jsx("div",{className:"s-work-files-tree-list",children:j.length===0?e.jsx("div",{className:"s-work-files-tree-empty",children:"No files match this filter."}):j.map(r=>e.jsx(y,{node:r,depth:0,selectedId:d,collapsed:m,onToggle:I,onSelect:S},r.type==="dir"?`d:${r.path}`:`f:${r.material.id}`))})]}),e.jsx("section",{className:"s-work-files-content","aria-label":"File preview",children:w?e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"s-work-files-content-head",children:[e.jsx(V,{path:w.path}),e.jsxs("div",{className:"s-work-files-content-meta",children:[e.jsx("span",{children:w.kind}),e.jsx("span",{children:w.status}),w.diffStat&&e.jsxs("span",{children:["+",w.diffStat.additions," -",w.diffStat.deletions]})]})]}),e.jsx(K,{workId:s,material:w})]}):e.jsx("div",{className:"s-work-files-pane-state",children:"Select a file to preview."})})]})})}export{re as WorkFilesViewer};
@@ -1 +1 @@
1
- import{c as t}from"./createLucideIcon-OpA4Amw5.js";const c=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],o=t("activity",c);export{o as A};
1
+ import{c as t}from"./createLucideIcon-DlxlBfLC.js";const c=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],o=t("activity",c);export{o as A};
@@ -1 +1 @@
1
- import{i as f}from"./index-DMiGbrBt.js";function g(o,s){for(var r=0;r<s.length;r++){const t=s[r];if(typeof t!="string"&&!Array.isArray(t)){for(const e in t)if(e!=="default"&&!(e in o)){const i=Object.getOwnPropertyDescriptor(t,e);i&&Object.defineProperty(o,e,i.get?i:{enumerable:!0,get:()=>t[e]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}var a={exports:{}},d;function _(){return d||(d=1,(function(o,s){(function(r,t){o.exports=t()})(globalThis,(()=>(()=>{var r={};return(()=>{var t=r;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const i=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(i._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;const i=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,l=window.getComputedStyle(this._terminal.element.parentElement),c=parseInt(l.getPropertyValue("height")),m=Math.max(0,parseInt(l.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),u=c-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),h=m-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-i;return{cols:Math.max(2,Math.floor(h/e.css.cell.width)),rows:Math.max(1,Math.floor(u/e.css.cell.height))}}}})(),r})()))})(a)),a.exports}var p=_();const y=f(p),v=g({__proto__:null,default:y},[p]);export{v as a};
1
+ import{i as f}from"./index-sUomXsrf.js";function g(o,s){for(var r=0;r<s.length;r++){const t=s[r];if(typeof t!="string"&&!Array.isArray(t)){for(const e in t)if(e!=="default"&&!(e in o)){const i=Object.getOwnPropertyDescriptor(t,e);i&&Object.defineProperty(o,e,i.get?i:{enumerable:!0,get:()=>t[e]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}var a={exports:{}},d;function _(){return d||(d=1,(function(o,s){(function(r,t){o.exports=t()})(globalThis,(()=>(()=>{var r={};return(()=>{var t=r;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const i=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(i._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;const i=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,l=window.getComputedStyle(this._terminal.element.parentElement),c=parseInt(l.getPropertyValue("height")),m=Math.max(0,parseInt(l.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),u=c-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),h=m-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-i;return{cols:Math.max(2,Math.floor(h/e.css.cell.width)),rows:Math.max(1,Math.floor(u/e.css.cell.height))}}}})(),r})()))})(a)),a.exports}var p=_();const y=f(p),v=g({__proto__:null,default:y},[p]);export{v as a};