@agimon-ai/po-web-dashboard 0.0.0-alpha.2 → 0.0.0-alpha.21

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 (366) hide show
  1. package/LICENSE +149 -29
  2. package/dist/core.cjs +13 -0
  3. package/dist/core.d.mts +8 -7
  4. package/dist/core.mjs +7 -6
  5. package/dist/index.cjs +17 -1
  6. package/dist/index.d.mts +12 -12
  7. package/dist/index.mjs +10 -10
  8. package/dist/types/hub.cjs +9 -100
  9. package/dist/types/hub.cjs.map +1 -1
  10. package/dist/types/hub.d.mts +12 -110
  11. package/dist/types/hub.d.mts.map +1 -1
  12. package/dist/types/hub.mjs +9 -79
  13. package/dist/types/hub.mjs.map +1 -1
  14. package/dist/types/notification.cjs +4 -4
  15. package/dist/types/notification.cjs.map +1 -1
  16. package/dist/types/notification.d.mts +5 -5
  17. package/dist/types/notification.d.mts.map +1 -1
  18. package/dist/types/notification.mjs +5 -5
  19. package/dist/types/notification.mjs.map +1 -1
  20. package/dist/types/settings.cjs.map +1 -1
  21. package/dist/types/settings.d.mts +1 -1
  22. package/dist/types/settings.mjs.map +1 -1
  23. package/dist/types.cjs +2 -23
  24. package/dist/types.d.mts +3 -3
  25. package/dist/types.mjs +3 -3
  26. package/dist/views.cjs +1 -0
  27. package/dist/views.d.mts +2 -2
  28. package/dist/views.mjs +2 -2
  29. package/dist/web/components/SessionMcp.cjs +17 -17
  30. package/dist/web/components/SessionMcp.cjs.map +1 -1
  31. package/dist/web/components/SessionMcp.mjs +17 -17
  32. package/dist/web/components/SessionMcp.mjs.map +1 -1
  33. package/dist/web/components/Story.fixture.cjs +4 -3
  34. package/dist/web/components/Story.fixture.cjs.map +1 -1
  35. package/dist/web/components/Story.fixture.d.mts.map +1 -1
  36. package/dist/web/components/Story.fixture.mjs +4 -3
  37. package/dist/web/components/Story.fixture.mjs.map +1 -1
  38. package/dist/web/components/Template.fixture.cjs +1 -1
  39. package/dist/web/components/Template.fixture.cjs.map +1 -1
  40. package/dist/web/components/Template.fixture.mjs +1 -1
  41. package/dist/web/components/Template.fixture.mjs.map +1 -1
  42. package/dist/web/components/ToolRendererBoundary.d.mts +1 -0
  43. package/dist/web/features/activity/ActivityDock.cjs +68 -47
  44. package/dist/web/features/activity/ActivityDock.cjs.map +1 -1
  45. package/dist/web/features/activity/ActivityDock.d.mts +2 -1
  46. package/dist/web/features/activity/ActivityDock.d.mts.map +1 -1
  47. package/dist/web/features/activity/ActivityDock.mjs +70 -49
  48. package/dist/web/features/activity/ActivityDock.mjs.map +1 -1
  49. package/dist/web/features/activity/ContextItemDialog.cjs +17 -17
  50. package/dist/web/features/activity/ContextItemDialog.cjs.map +1 -1
  51. package/dist/web/features/activity/ContextItemDialog.d.mts +1 -0
  52. package/dist/web/features/activity/ContextItemDialog.mjs +17 -17
  53. package/dist/web/features/activity/ContextItemDialog.mjs.map +1 -1
  54. package/dist/web/features/activity/ContextPanel.cjs +184 -148
  55. package/dist/web/features/activity/ContextPanel.cjs.map +1 -1
  56. package/dist/web/features/activity/ContextPanel.d.mts +23 -0
  57. package/dist/web/features/activity/ContextPanel.d.mts.map +1 -1
  58. package/dist/web/features/activity/ContextPanel.mjs +186 -151
  59. package/dist/web/features/activity/ContextPanel.mjs.map +1 -1
  60. package/dist/web/features/activity/DockTabs.cjs +1 -1
  61. package/dist/web/features/activity/DockTabs.cjs.map +1 -1
  62. package/dist/web/features/activity/DockTabs.mjs +1 -1
  63. package/dist/web/features/activity/DockTabs.mjs.map +1 -1
  64. package/dist/web/features/connection/RefusedCard.cjs +9 -9
  65. package/dist/web/features/connection/RefusedCard.cjs.map +1 -1
  66. package/dist/web/features/connection/RefusedCard.mjs +9 -9
  67. package/dist/web/features/connection/RefusedCard.mjs.map +1 -1
  68. package/dist/web/features/dialogs/DialogOverlay.cjs +9 -9
  69. package/dist/web/features/dialogs/DialogOverlay.cjs.map +1 -1
  70. package/dist/web/features/dialogs/DialogOverlay.mjs +9 -9
  71. package/dist/web/features/dialogs/DialogOverlay.mjs.map +1 -1
  72. package/dist/web/features/leader/CommandPalette.cjs +23 -23
  73. package/dist/web/features/leader/CommandPalette.cjs.map +1 -1
  74. package/dist/web/features/leader/CommandPalette.mjs +23 -23
  75. package/dist/web/features/leader/CommandPalette.mjs.map +1 -1
  76. package/dist/web/features/remote/DevProxyTargets.cjs +6 -6
  77. package/dist/web/features/remote/DevProxyTargets.cjs.map +1 -1
  78. package/dist/web/features/remote/DevProxyTargets.mjs +6 -6
  79. package/dist/web/features/remote/DevProxyTargets.mjs.map +1 -1
  80. package/dist/web/features/remote/HandoverProgress.cjs +2 -2
  81. package/dist/web/features/remote/HandoverProgress.cjs.map +1 -1
  82. package/dist/web/features/remote/HandoverProgress.mjs +2 -2
  83. package/dist/web/features/remote/HandoverProgress.mjs.map +1 -1
  84. package/dist/web/features/remote/PairedDeviceList.cjs +3 -3
  85. package/dist/web/features/remote/PairedDeviceList.cjs.map +1 -1
  86. package/dist/web/features/remote/PairedDeviceList.mjs +3 -3
  87. package/dist/web/features/remote/PairedDeviceList.mjs.map +1 -1
  88. package/dist/web/features/remote/PairingApprovalDialog.cjs +3 -3
  89. package/dist/web/features/remote/PairingApprovalDialog.cjs.map +1 -1
  90. package/dist/web/features/remote/PairingApprovalDialog.mjs +3 -3
  91. package/dist/web/features/remote/PairingApprovalDialog.mjs.map +1 -1
  92. package/dist/web/features/remote/RemoteAccessDialog.cjs +3 -3
  93. package/dist/web/features/remote/RemoteAccessDialog.cjs.map +1 -1
  94. package/dist/web/features/remote/RemoteAccessDialog.mjs +3 -3
  95. package/dist/web/features/remote/RemoteAccessDialog.mjs.map +1 -1
  96. package/dist/web/features/remote/RemoteAccessOptions.cjs +11 -11
  97. package/dist/web/features/remote/RemoteAccessOptions.cjs.map +1 -1
  98. package/dist/web/features/remote/RemoteAccessOptions.mjs +11 -11
  99. package/dist/web/features/remote/RemoteAccessOptions.mjs.map +1 -1
  100. package/dist/web/features/remote/RemoteAccessPairing.cjs +8 -8
  101. package/dist/web/features/remote/RemoteAccessPairing.cjs.map +1 -1
  102. package/dist/web/features/remote/RemoteAccessPairing.mjs +8 -8
  103. package/dist/web/features/remote/RemoteAccessPairing.mjs.map +1 -1
  104. package/dist/web/features/remote/SandboxWorkspaces.cjs +3 -3
  105. package/dist/web/features/remote/SandboxWorkspaces.cjs.map +1 -1
  106. package/dist/web/features/remote/SandboxWorkspaces.mjs +3 -3
  107. package/dist/web/features/remote/SandboxWorkspaces.mjs.map +1 -1
  108. package/dist/web/features/remote/TrustedDeviceList.cjs +4 -4
  109. package/dist/web/features/remote/TrustedDeviceList.cjs.map +1 -1
  110. package/dist/web/features/remote/TrustedDeviceList.mjs +4 -4
  111. package/dist/web/features/remote/TrustedDeviceList.mjs.map +1 -1
  112. package/dist/web/features/selection/SelectionBar.cjs +40 -37
  113. package/dist/web/features/selection/SelectionBar.cjs.map +1 -1
  114. package/dist/web/features/selection/SelectionBar.d.mts.map +1 -1
  115. package/dist/web/features/selection/SelectionBar.mjs +41 -38
  116. package/dist/web/features/selection/SelectionBar.mjs.map +1 -1
  117. package/dist/web/features/session/AgentLockPanel.cjs +3 -3
  118. package/dist/web/features/session/AgentLockPanel.cjs.map +1 -1
  119. package/dist/web/features/session/AgentLockPanel.mjs +3 -3
  120. package/dist/web/features/session/AgentLockPanel.mjs.map +1 -1
  121. package/dist/web/features/session/Composer.cjs +11 -11
  122. package/dist/web/features/session/Composer.cjs.map +1 -1
  123. package/dist/web/features/session/Composer.mjs +11 -11
  124. package/dist/web/features/session/Composer.mjs.map +1 -1
  125. package/dist/web/features/session/DormantPanel.cjs +4 -4
  126. package/dist/web/features/session/DormantPanel.cjs.map +1 -1
  127. package/dist/web/features/session/DormantPanel.mjs +4 -4
  128. package/dist/web/features/session/DormantPanel.mjs.map +1 -1
  129. package/dist/web/features/session/MentionPreviews.cjs +10 -10
  130. package/dist/web/features/session/MentionPreviews.cjs.map +1 -1
  131. package/dist/web/features/session/MentionPreviews.mjs +10 -10
  132. package/dist/web/features/session/MentionPreviews.mjs.map +1 -1
  133. package/dist/web/features/session/QueueSheet.cjs +28 -35
  134. package/dist/web/features/session/QueueSheet.cjs.map +1 -1
  135. package/dist/web/features/session/QueueSheet.mjs +28 -35
  136. package/dist/web/features/session/QueueSheet.mjs.map +1 -1
  137. package/dist/web/features/session/SessionActivity.cjs +8 -4
  138. package/dist/web/features/session/SessionActivity.cjs.map +1 -1
  139. package/dist/web/features/session/SessionActivity.d.mts +1 -1
  140. package/dist/web/features/session/SessionActivity.d.mts.map +1 -1
  141. package/dist/web/features/session/SessionActivity.mjs +8 -4
  142. package/dist/web/features/session/SessionActivity.mjs.map +1 -1
  143. package/dist/web/features/session/ThreadView.cjs +1 -0
  144. package/dist/web/features/session/ThreadView.cjs.map +1 -1
  145. package/dist/web/features/session/ThreadView.mjs +1 -0
  146. package/dist/web/features/session/ThreadView.mjs.map +1 -1
  147. package/dist/web/features/session/Timeline.cjs +173 -69
  148. package/dist/web/features/session/Timeline.cjs.map +1 -1
  149. package/dist/web/features/session/Timeline.d.mts +3 -1
  150. package/dist/web/features/session/Timeline.d.mts.map +1 -1
  151. package/dist/web/features/session/Timeline.mjs +174 -70
  152. package/dist/web/features/session/Timeline.mjs.map +1 -1
  153. package/dist/web/features/session/ToolCard.cjs +6 -6
  154. package/dist/web/features/session/ToolCard.cjs.map +1 -1
  155. package/dist/web/features/session/ToolCard.mjs +6 -6
  156. package/dist/web/features/session/ToolCard.mjs.map +1 -1
  157. package/dist/web/features/sessions/NewSessionDialog.cjs +3 -3
  158. package/dist/web/features/sessions/NewSessionDialog.cjs.map +1 -1
  159. package/dist/web/features/sessions/NewSessionDialog.mjs +3 -3
  160. package/dist/web/features/sessions/NewSessionDialog.mjs.map +1 -1
  161. package/dist/web/features/sessions/ResumeSessionDialog.cjs +11 -8
  162. package/dist/web/features/sessions/ResumeSessionDialog.cjs.map +1 -1
  163. package/dist/web/features/sessions/ResumeSessionDialog.d.mts +1 -0
  164. package/dist/web/features/sessions/ResumeSessionDialog.mjs +11 -8
  165. package/dist/web/features/sessions/ResumeSessionDialog.mjs.map +1 -1
  166. package/dist/web/features/sessions/WelcomePanel.cjs +29 -15
  167. package/dist/web/features/sessions/WelcomePanel.cjs.map +1 -1
  168. package/dist/web/features/sessions/WelcomePanel.d.mts +3 -0
  169. package/dist/web/features/sessions/WelcomePanel.d.mts.map +1 -1
  170. package/dist/web/features/sessions/WelcomePanel.mjs +29 -15
  171. package/dist/web/features/sessions/WelcomePanel.mjs.map +1 -1
  172. package/dist/web/features/sessions/useSessionRail.cjs +14 -16
  173. package/dist/web/features/sessions/useSessionRail.cjs.map +1 -1
  174. package/dist/web/features/sessions/useSessionRail.d.mts.map +1 -1
  175. package/dist/web/features/sessions/useSessionRail.mjs +16 -18
  176. package/dist/web/features/sessions/useSessionRail.mjs.map +1 -1
  177. package/dist/web/features/settings/AppearanceSettings.cjs +3 -3
  178. package/dist/web/features/settings/AppearanceSettings.cjs.map +1 -1
  179. package/dist/web/features/settings/AppearanceSettings.mjs +3 -3
  180. package/dist/web/features/settings/AppearanceSettings.mjs.map +1 -1
  181. package/dist/web/features/settings/ContributedSettings.cjs +9 -9
  182. package/dist/web/features/settings/ContributedSettings.cjs.map +1 -1
  183. package/dist/web/features/settings/ContributedSettings.d.mts +1 -0
  184. package/dist/web/features/settings/ContributedSettings.mjs +9 -9
  185. package/dist/web/features/settings/ContributedSettings.mjs.map +1 -1
  186. package/dist/web/features/settings/ImageSettings.cjs +2 -2
  187. package/dist/web/features/settings/ImageSettings.cjs.map +1 -1
  188. package/dist/web/features/settings/ImageSettings.d.mts +1 -1
  189. package/dist/web/features/settings/ImageSettings.mjs +2 -2
  190. package/dist/web/features/settings/ImageSettings.mjs.map +1 -1
  191. package/dist/web/features/settings/LoginFlowDialog.cjs +18 -18
  192. package/dist/web/features/settings/LoginFlowDialog.cjs.map +1 -1
  193. package/dist/web/features/settings/LoginFlowDialog.mjs +18 -18
  194. package/dist/web/features/settings/LoginFlowDialog.mjs.map +1 -1
  195. package/dist/web/features/settings/PluginSettings.cjs +1 -1
  196. package/dist/web/features/settings/PluginSettings.cjs.map +1 -1
  197. package/dist/web/features/settings/PluginSettings.mjs +1 -1
  198. package/dist/web/features/settings/PluginSettings.mjs.map +1 -1
  199. package/dist/web/features/settings/ProviderSettings.cjs +18 -18
  200. package/dist/web/features/settings/ProviderSettings.cjs.map +1 -1
  201. package/dist/web/features/settings/ProviderSettings.mjs +18 -18
  202. package/dist/web/features/settings/ProviderSettings.mjs.map +1 -1
  203. package/dist/web/features/settings/RepositorySettings.cjs +6 -6
  204. package/dist/web/features/settings/RepositorySettings.cjs.map +1 -1
  205. package/dist/web/features/settings/RepositorySettings.mjs +6 -6
  206. package/dist/web/features/settings/RepositorySettings.mjs.map +1 -1
  207. package/dist/web/features/settings/RepositoryWorkspace.cjs +3 -3
  208. package/dist/web/features/settings/RepositoryWorkspace.cjs.map +1 -1
  209. package/dist/web/features/settings/RepositoryWorkspace.mjs +3 -3
  210. package/dist/web/features/settings/RepositoryWorkspace.mjs.map +1 -1
  211. package/dist/web/features/settings/SessionMcpSettings.cjs +14 -14
  212. package/dist/web/features/settings/SessionMcpSettings.cjs.map +1 -1
  213. package/dist/web/features/settings/SessionMcpSettings.mjs +14 -14
  214. package/dist/web/features/settings/SessionMcpSettings.mjs.map +1 -1
  215. package/dist/web/features/settings/SettingsMenu.cjs +8 -8
  216. package/dist/web/features/settings/SettingsMenu.cjs.map +1 -1
  217. package/dist/web/features/settings/SettingsMenu.mjs +8 -8
  218. package/dist/web/features/settings/SettingsMenu.mjs.map +1 -1
  219. package/dist/web/features/settings/SettingsPanelHost.d.mts +1 -0
  220. package/dist/web/features/settings/TemplateSettings.cjs +8 -8
  221. package/dist/web/features/settings/TemplateSettings.cjs.map +1 -1
  222. package/dist/web/features/settings/TemplateSettings.mjs +8 -8
  223. package/dist/web/features/settings/TemplateSettings.mjs.map +1 -1
  224. package/dist/web/features/settings/TunnelSettings.cjs +6 -6
  225. package/dist/web/features/settings/TunnelSettings.cjs.map +1 -1
  226. package/dist/web/features/settings/TunnelSettings.mjs +6 -6
  227. package/dist/web/features/settings/TunnelSettings.mjs.map +1 -1
  228. package/dist/web/features/status/TopBar.cjs +6 -6
  229. package/dist/web/features/status/TopBar.cjs.map +1 -1
  230. package/dist/web/features/status/TopBar.mjs +6 -6
  231. package/dist/web/features/status/TopBar.mjs.map +1 -1
  232. package/dist/web/lib/browserNotifications.cjs.map +1 -1
  233. package/dist/web/lib/browserNotifications.d.mts +2 -2
  234. package/dist/web/lib/browserNotifications.d.mts.map +1 -1
  235. package/dist/web/lib/browserNotifications.mjs.map +1 -1
  236. package/dist/web/lib/browserTelemetry.cjs.map +1 -1
  237. package/dist/web/lib/browserTelemetry.d.mts +2 -1
  238. package/dist/web/lib/browserTelemetry.d.mts.map +1 -1
  239. package/dist/web/lib/browserTelemetry.mjs.map +1 -1
  240. package/dist/web/lib/commands.d.mts +1 -0
  241. package/dist/web/lib/composerSubmissions.d.mts +1 -0
  242. package/dist/web/lib/composition.cjs +21 -5
  243. package/dist/web/lib/composition.cjs.map +1 -1
  244. package/dist/web/lib/composition.d.mts +15 -0
  245. package/dist/web/lib/composition.d.mts.map +1 -1
  246. package/dist/web/lib/composition.mjs +21 -6
  247. package/dist/web/lib/composition.mjs.map +1 -1
  248. package/dist/web/lib/contextComposition.cjs +1 -1
  249. package/dist/web/lib/contextComposition.cjs.map +1 -1
  250. package/dist/web/lib/contextComposition.mjs +1 -1
  251. package/dist/web/lib/contextComposition.mjs.map +1 -1
  252. package/dist/web/lib/dashboardRoute.d.mts +1 -0
  253. package/dist/web/lib/hubApi.cjs +62 -1
  254. package/dist/web/lib/hubApi.cjs.map +1 -1
  255. package/dist/web/lib/hubApi.d.mts +19 -0
  256. package/dist/web/lib/hubApi.d.mts.map +1 -1
  257. package/dist/web/lib/hubApi.mjs +59 -3
  258. package/dist/web/lib/hubApi.mjs.map +1 -1
  259. package/dist/web/lib/modelContextAdapter.d.mts +1 -0
  260. package/dist/web/lib/piTransport.cjs +34 -53
  261. package/dist/web/lib/piTransport.cjs.map +1 -1
  262. package/dist/web/lib/piTransport.d.mts +3 -3
  263. package/dist/web/lib/piTransport.d.mts.map +1 -1
  264. package/dist/web/lib/piTransport.mjs +34 -53
  265. package/dist/web/lib/piTransport.mjs.map +1 -1
  266. package/dist/web/lib/pluginRegistry.cjs +53 -4
  267. package/dist/web/lib/pluginRegistry.cjs.map +1 -1
  268. package/dist/web/lib/pluginRegistry.d.mts +15 -1
  269. package/dist/web/lib/pluginRegistry.d.mts.map +1 -1
  270. package/dist/web/lib/pluginRegistry.mjs +53 -5
  271. package/dist/web/lib/pluginRegistry.mjs.map +1 -1
  272. package/dist/web/lib/protocolHubSocket.cjs +151 -89
  273. package/dist/web/lib/protocolHubSocket.cjs.map +1 -1
  274. package/dist/web/lib/protocolHubSocket.d.mts +21 -6
  275. package/dist/web/lib/protocolHubSocket.d.mts.map +1 -1
  276. package/dist/web/lib/protocolHubSocket.mjs +152 -90
  277. package/dist/web/lib/protocolHubSocket.mjs.map +1 -1
  278. package/dist/web/lib/sessionActivityRenderer.d.mts +1 -0
  279. package/dist/web/lib/sessionModel.cjs +120 -20
  280. package/dist/web/lib/sessionModel.cjs.map +1 -1
  281. package/dist/web/lib/sessionModel.d.mts +32 -2
  282. package/dist/web/lib/sessionModel.d.mts.map +1 -1
  283. package/dist/web/lib/sessionModel.mjs +120 -22
  284. package/dist/web/lib/sessionModel.mjs.map +1 -1
  285. package/dist/web/lib/sessionProtocolCommands.cjs +33 -34
  286. package/dist/web/lib/sessionProtocolCommands.cjs.map +1 -1
  287. package/dist/web/lib/sessionProtocolCommands.d.mts +3 -2
  288. package/dist/web/lib/sessionProtocolCommands.d.mts.map +1 -1
  289. package/dist/web/lib/sessionProtocolCommands.mjs +33 -34
  290. package/dist/web/lib/sessionProtocolCommands.mjs.map +1 -1
  291. package/dist/web/lib/sessionRailModel.cjs +2 -1
  292. package/dist/web/lib/sessionRailModel.cjs.map +1 -1
  293. package/dist/web/lib/sessionRailModel.d.mts +1 -1
  294. package/dist/web/lib/sessionRailModel.d.mts.map +1 -1
  295. package/dist/web/lib/sessionRailModel.mjs +2 -1
  296. package/dist/web/lib/sessionRailModel.mjs.map +1 -1
  297. package/dist/web/lib/sessionSelectionApi.cjs +72 -0
  298. package/dist/web/lib/sessionSelectionApi.cjs.map +1 -0
  299. package/dist/web/lib/sessionSelectionApi.d.mts +18 -0
  300. package/dist/web/lib/sessionSelectionApi.d.mts.map +1 -0
  301. package/dist/web/lib/sessionSelectionApi.mjs +72 -0
  302. package/dist/web/lib/sessionSelectionApi.mjs.map +1 -0
  303. package/dist/web/lib/sessionSummary.cjs +1 -0
  304. package/dist/web/lib/sessionSummary.cjs.map +1 -1
  305. package/dist/web/lib/sessionSummary.d.mts +1 -1
  306. package/dist/web/lib/sessionSummary.d.mts.map +1 -1
  307. package/dist/web/lib/sessionSummary.mjs +1 -0
  308. package/dist/web/lib/sessionSummary.mjs.map +1 -1
  309. package/dist/web/lib/sessionTranscriptRenderer.d.mts +1 -0
  310. package/dist/web/lib/statusLine.d.mts +1 -0
  311. package/dist/web/lib/stepUp.d.mts.map +1 -1
  312. package/dist/web/lib/threadRenderer.d.mts +1 -0
  313. package/dist/web/lib/toolCompletionTabs.d.mts +1 -0
  314. package/dist/web/lib/transport.cjs +10 -2
  315. package/dist/web/lib/transport.cjs.map +1 -1
  316. package/dist/web/lib/transport.d.mts +6 -2
  317. package/dist/web/lib/transport.d.mts.map +1 -1
  318. package/dist/web/lib/transport.mjs +10 -3
  319. package/dist/web/lib/transport.mjs.map +1 -1
  320. package/dist/web/stores/captureStore.cjs +22 -4
  321. package/dist/web/stores/captureStore.cjs.map +1 -1
  322. package/dist/web/stores/captureStore.d.mts.map +1 -1
  323. package/dist/web/stores/captureStore.mjs +22 -4
  324. package/dist/web/stores/captureStore.mjs.map +1 -1
  325. package/dist/web/stores/fileLinkModesStore.cjs +27 -10
  326. package/dist/web/stores/fileLinkModesStore.cjs.map +1 -1
  327. package/dist/web/stores/fileLinkModesStore.d.mts +5 -0
  328. package/dist/web/stores/fileLinkModesStore.d.mts.map +1 -1
  329. package/dist/web/stores/fileLinkModesStore.mjs +28 -12
  330. package/dist/web/stores/fileLinkModesStore.mjs.map +1 -1
  331. package/dist/web/stores/pagedTranscriptStore.cjs +29 -37
  332. package/dist/web/stores/pagedTranscriptStore.cjs.map +1 -1
  333. package/dist/web/stores/pagedTranscriptStore.d.mts.map +1 -1
  334. package/dist/web/stores/pagedTranscriptStore.mjs +30 -38
  335. package/dist/web/stores/pagedTranscriptStore.mjs.map +1 -1
  336. package/dist/web/stores/sessionStore.cjs +81 -3
  337. package/dist/web/stores/sessionStore.cjs.map +1 -1
  338. package/dist/web/stores/sessionStore.d.mts +13 -2
  339. package/dist/web/stores/sessionStore.d.mts.map +1 -1
  340. package/dist/web/stores/sessionStore.mjs +80 -5
  341. package/dist/web/stores/sessionStore.mjs.map +1 -1
  342. package/dist/web/stores/sessionsStore.cjs +37 -5
  343. package/dist/web/stores/sessionsStore.cjs.map +1 -1
  344. package/dist/web/stores/sessionsStore.d.mts +10 -0
  345. package/dist/web/stores/sessionsStore.d.mts.map +1 -1
  346. package/dist/web/stores/sessionsStore.mjs +36 -6
  347. package/dist/web/stores/sessionsStore.mjs.map +1 -1
  348. package/dist/web/stores/templateStore.cjs +1 -1
  349. package/dist/web/stores/templateStore.cjs.map +1 -1
  350. package/dist/web/stores/templateStore.d.mts +1 -1
  351. package/dist/web/stores/templateStore.mjs +1 -1
  352. package/dist/web/stores/templateStore.mjs.map +1 -1
  353. package/dist/web/stores/threadStore.cjs +12 -9
  354. package/dist/web/stores/threadStore.cjs.map +1 -1
  355. package/dist/web/stores/threadStore.d.mts +7 -3
  356. package/dist/web/stores/threadStore.d.mts.map +1 -1
  357. package/dist/web/stores/threadStore.mjs +13 -10
  358. package/dist/web/stores/threadStore.mjs.map +1 -1
  359. package/dist/web/stores/transientTabsStore.d.mts +1 -0
  360. package/dist/web/stores/useToolPrompt.cjs +18 -9
  361. package/dist/web/stores/useToolPrompt.cjs.map +1 -1
  362. package/dist/web/stores/useToolPrompt.d.mts +3 -2
  363. package/dist/web/stores/useToolPrompt.d.mts.map +1 -1
  364. package/dist/web/stores/useToolPrompt.mjs +18 -9
  365. package/dist/web/stores/useToolPrompt.mjs.map +1 -1
  366. package/package.json +13 -15
@@ -1 +1 @@
1
- {"version":3,"file":"browserTelemetry.cjs","names":["sealedHttpSession"],"sources":["../../../src/web/lib/browserTelemetry.ts"],"sourcesContent":["import { sealedHttpSession } from './sealedSession';\n\nconst ROUTE = '/api/telemetry/browser';\nconst MAX_QUEUE = 32;\nconst MAX_BATCH = 10;\nconst SEND_DELAY_MS = 1000;\nconst MAX_RETRY_DELAY_MS = 30_000;\n\nconst MAX_ERROR_NAME_LENGTH = 120;\nconst MAX_ERROR_MESSAGE_LENGTH = 300;\nconst MAX_ERROR_STACK_LENGTH = 800;\nconst MAX_SESSION_ID_LENGTH = 64;\n\nexport type BrowserPerformanceEventName =\n | 'web.browser.ready'\n | 'web.browser.protocol_ready'\n | 'web.browser.session_socket_ready'\n | 'web.browser.reconnect'\n | 'web.browser.backlog'\n | 'web.browser.transcript_page'\n | 'web.browser.transcript_render'\n | 'web.browser.telemetry_drop';\n\nconst BROWSER_ERROR_EVENT = 'web.browser.error';\n\ntype BrowserErrorSource = 'window_error' | 'unhandled_rejection' | 'session_socket';\n\nexport interface BrowserPerformanceEvent {\n name: BrowserPerformanceEventName;\n duration_ms?: number;\n count?: number;\n}\n\ninterface BrowserErrorEvent {\n name: typeof BROWSER_ERROR_EVENT;\n source: BrowserErrorSource;\n error_name: string;\n message: string;\n stack?: string;\n session_id?: string;\n}\n\ntype BrowserTelemetryEvent = BrowserPerformanceEvent | BrowserErrorEvent;\n\nconst queue: BrowserTelemetryEvent[] = [];\nlet dropped = 0;\nlet timer: ReturnType<typeof setTimeout> | undefined;\nlet sending = false;\nlet retryDelayMs = SEND_DELAY_MS;\nconst startedAt = performance.now();\n\nfunction schedule(delayMs = SEND_DELAY_MS): void {\n if (timer !== undefined || sending || queue.length === 0) return;\n timer = setTimeout(() => {\n timer = undefined;\n void flushBrowserTelemetry();\n }, delayMs);\n}\n\nexport function browserReadyDuration(): number {\n return Math.max(0, performance.now() - startedAt);\n}\n\nfunction enqueue(event: BrowserTelemetryEvent): void {\n if (queue.length >= MAX_QUEUE) {\n queue.shift();\n dropped += 1;\n }\n queue.push(event);\n schedule();\n}\n\nexport function recordBrowserPerformance(event: BrowserPerformanceEvent): void {\n enqueue({\n name: event.name,\n ...(event.duration_ms === undefined\n ? {}\n : { duration_ms: Math.max(0, Math.min(600_000, Math.round(event.duration_ms))) }),\n ...(event.count === undefined ? {} : { count: Math.max(0, Math.min(10_000, Math.round(event.count))) }),\n });\n}\n\n/**\n * Describes a thrown value the way the server route accepts it.\n *\n * Every field is length-capped here rather than only on the server, because the\n * route rejects a whole batch on one oversized field and a page that trips that\n * loses the report it was trying to make.\n */\nfunction describeThrown(thrown: unknown): { error_name: string; message: string; stack?: string } {\n if (thrown instanceof Error) {\n return {\n error_name: (thrown.name || 'Error').slice(0, MAX_ERROR_NAME_LENGTH),\n message: (thrown.message || 'Unknown error').slice(0, MAX_ERROR_MESSAGE_LENGTH),\n ...(typeof thrown.stack === 'string' && thrown.stack.length > 0\n ? { stack: thrown.stack.slice(0, MAX_ERROR_STACK_LENGTH) }\n : {}),\n };\n }\n const text = typeof thrown === 'string' ? thrown : safeText(thrown);\n return {\n error_name: typeof thrown === 'string' ? 'StringError' : 'ObjectError',\n message: (text || 'Unknown error').slice(0, MAX_ERROR_MESSAGE_LENGTH),\n };\n}\n\nfunction safeText(value: unknown): string {\n try {\n return JSON.stringify(value) ?? String(value);\n } catch {\n return 'Unserializable error';\n }\n}\n\nexport function recordBrowserError(source: BrowserErrorSource, thrown: unknown, sessionId?: string | null): void {\n const described = describeThrown(thrown);\n const session =\n typeof sessionId === 'string' && sessionId.length > 0 && sessionId.length <= MAX_SESSION_ID_LENGTH\n ? sessionId\n : undefined;\n enqueue({\n name: BROWSER_ERROR_EVENT,\n source,\n ...described,\n ...(session === undefined ? {} : { session_id: session }),\n });\n}\n\ninterface ErrorReportingOptions {\n target?: EventTarget;\n sessionId?: () => string | null;\n}\n\n/**\n * Reports what the cockpit throws, so a view that dies stops dying silently.\n *\n * React re-throws an uncaught render failure through `reportError`, so the\n * window listener covers the timeline going blank as well as ordinary async\n * throws. The reports are queued through the same batch, backoff, and drop\n * counter as performance events; a page that is failing repeatedly must not\n * turn into a request loop.\n */\nexport function installBrowserErrorReporting(options: ErrorReportingOptions = {}): () => void {\n const target = options.target ?? window;\n const sessionId = options.sessionId ?? (() => null);\n\n const onError = (event: Event): void => {\n const thrown = 'error' in event ? (event as ErrorEvent).error : undefined;\n const message = 'message' in event ? (event as ErrorEvent).message : undefined;\n recordBrowserError('window_error', thrown ?? message ?? 'Unknown error', sessionId());\n };\n const onRejection = (event: Event): void => {\n const reason = 'reason' in event ? (event as PromiseRejectionEvent).reason : undefined;\n recordBrowserError('unhandled_rejection', reason, sessionId());\n };\n\n target.addEventListener('error', onError);\n target.addEventListener('unhandledrejection', onRejection);\n return () => {\n target.removeEventListener('error', onError);\n target.removeEventListener('unhandledrejection', onRejection);\n };\n}\n\nexport async function flushBrowserTelemetry(): Promise<void> {\n if (sending || queue.length === 0) return;\n sending = true;\n if (dropped > 0) {\n queue.unshift({ name: 'web.browser.telemetry_drop', count: Math.min(dropped, 10_000) });\n dropped = 0;\n if (queue.length > MAX_QUEUE) queue.pop();\n }\n const events = queue.splice(0, MAX_BATCH);\n let retry = false;\n try {\n const response = await sealedHttpSession.fetch(ROUTE, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ v: 1, events }),\n });\n retry = response.status === 429 || response.status >= 500;\n } catch {\n retry = true;\n } finally {\n if (retry) {\n for (const event of events.reverse()) queue.unshift(event);\n while (queue.length > MAX_QUEUE) {\n queue.pop();\n dropped += 1;\n }\n }\n sending = false;\n if (retry) {\n const delay = retryDelayMs;\n retryDelayMs = Math.min(MAX_RETRY_DELAY_MS, retryDelayMs * 2);\n schedule(delay);\n } else {\n retryDelayMs = SEND_DELAY_MS;\n schedule();\n }\n }\n}\n"],"mappings":";;AAEA,MAAM,QAAQ;AACd,MAAM,YAAY;AAClB,MAAM,YAAY;AAClB,MAAM,gBAAgB;AACtB,MAAM,qBAAqB;AAE3B,MAAM,wBAAwB;AAC9B,MAAM,2BAA2B;AACjC,MAAM,yBAAyB;AAC/B,MAAM,wBAAwB;AAY9B,MAAM,sBAAsB;AAqB5B,MAAM,QAAiC,CAAC;AACxC,IAAI,UAAU;AACd,IAAI;AACJ,IAAI,UAAU;AACd,IAAI,eAAe;AACnB,MAAM,YAAY,YAAY,IAAI;AAElC,SAAS,SAAS,UAAU,eAAqB;CAC/C,IAAI,UAAU,KAAA,KAAa,WAAW,MAAM,WAAW,GAAG;CAC1D,QAAQ,iBAAiB;EACvB,QAAQ,KAAA;EACR,sBAA2B;CAC7B,GAAG,OAAO;AACZ;AAEA,SAAgB,uBAA+B;CAC7C,OAAO,KAAK,IAAI,GAAG,YAAY,IAAI,IAAI,SAAS;AAClD;AAEA,SAAS,QAAQ,OAAoC;CACnD,IAAI,MAAM,UAAU,WAAW;EAC7B,MAAM,MAAM;EACZ,WAAW;CACb;CACA,MAAM,KAAK,KAAK;CAChB,SAAS;AACX;AAEA,SAAgB,yBAAyB,OAAsC;CAC7E,QAAQ;EACN,MAAM,MAAM;EACZ,GAAI,MAAM,gBAAgB,KAAA,IACtB,CAAC,IACD,EAAE,aAAa,KAAK,IAAI,GAAG,KAAK,IAAI,KAAS,KAAK,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE;EACjF,GAAI,MAAM,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,KAAQ,KAAK,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE;CACvG,CAAC;AACH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,QAAS,MAAgC,SAAS,KAAA,GAC3B,UAAU,CAAC;CAC/D;CAEA,OAAO,iBAAiB,SAAS,OAAO;CACxC,OAAO,iBAAiB,sBAAsB,WAAW;CACzD,aAAa;EACX,OAAO,oBAAoB,SAAS,OAAO;EAC3C,OAAO,oBAAoB,sBAAsB,WAAW;CAC9D;AACF;AAEA,eAAsB,wBAAuC;CAC3D,IAAI,WAAW,MAAM,WAAW,GAAG;CACnC,UAAU;CACV,IAAI,UAAU,GAAG;EACf,MAAM,QAAQ;GAAE,MAAM;GAA8B,OAAO,KAAK,IAAI,SAAS,GAAM;EAAE,CAAC;EACtF,UAAU;EACV,IAAI,MAAM,SAAS,WAAW,MAAM,IAAI;CAC1C;CACA,MAAM,SAAS,MAAM,OAAO,GAAG,SAAS;CACxC,IAAI,QAAQ;CACZ,IAAI;EACF,MAAM,WAAW,MAAMA,sBAAAA,kBAAkB,MAAM,OAAO;GACpD,QAAQ;GACR,SAAS,EAAE,gBAAgB,mBAAmB;GAC9C,MAAM,KAAK,UAAU;IAAE,GAAG;IAAG;GAAO,CAAC;EACvC,CAAC;EACD,QAAQ,SAAS,WAAW,OAAO,SAAS,UAAU;CACxD,QAAQ;EACN,QAAQ;CACV,UAAU;EACR,IAAI,OAAO;GACT,KAAK,MAAM,SAAS,OAAO,QAAQ,GAAG,MAAM,QAAQ,KAAK;GACzD,OAAO,MAAM,SAAS,WAAW;IAC/B,MAAM,IAAI;IACV,WAAW;GACb;EACF;EACA,UAAU;EACV,IAAI,OAAO;GACT,MAAM,QAAQ;GACd,eAAe,KAAK,IAAI,oBAAoB,eAAe,CAAC;GAC5D,SAAS,KAAK;EAChB,OAAO;GACL,eAAe;GACf,SAAS;EACX;CACF;AACF"}
1
+ {"version":3,"file":"browserTelemetry.cjs","names":["sealedHttpSession"],"sources":["../../../src/web/lib/browserTelemetry.ts"],"sourcesContent":["import { sealedHttpSession } from './sealedSession';\n\nconst ROUTE = '/api/telemetry/browser';\nconst MAX_QUEUE = 32;\nconst MAX_BATCH = 10;\nconst SEND_DELAY_MS = 1000;\nconst MAX_RETRY_DELAY_MS = 30_000;\n\nconst MAX_ERROR_NAME_LENGTH = 120;\nconst MAX_ERROR_MESSAGE_LENGTH = 300;\nconst MAX_ERROR_STACK_LENGTH = 800;\nconst MAX_SESSION_ID_LENGTH = 64;\n\nexport type BrowserPerformanceEventName =\n | 'web.browser.ready'\n | 'web.browser.protocol_ready'\n | 'web.browser.session_socket_ready'\n | 'web.browser.reconnect'\n | 'web.browser.update_required'\n | 'web.browser.backlog'\n | 'web.browser.transcript_page'\n | 'web.browser.transcript_render'\n | 'web.browser.telemetry_drop';\n\nconst BROWSER_ERROR_EVENT = 'web.browser.error';\n\ntype BrowserErrorSource = 'window_error' | 'unhandled_rejection' | 'session_socket';\n\nexport interface BrowserPerformanceEvent {\n name: BrowserPerformanceEventName;\n duration_ms?: number;\n count?: number;\n}\n\ninterface BrowserErrorEvent {\n name: typeof BROWSER_ERROR_EVENT;\n source: BrowserErrorSource;\n error_name: string;\n message: string;\n stack?: string;\n session_id?: string;\n}\n\ntype BrowserTelemetryEvent = BrowserPerformanceEvent | BrowserErrorEvent;\n\nconst queue: BrowserTelemetryEvent[] = [];\nlet dropped = 0;\nlet timer: ReturnType<typeof setTimeout> | undefined;\nlet sending = false;\nlet retryDelayMs = SEND_DELAY_MS;\nconst startedAt = performance.now();\n\nfunction schedule(delayMs = SEND_DELAY_MS): void {\n if (timer !== undefined || sending || queue.length === 0) return;\n timer = setTimeout(() => {\n timer = undefined;\n void flushBrowserTelemetry();\n }, delayMs);\n}\n\nexport function browserReadyDuration(): number {\n return Math.max(0, performance.now() - startedAt);\n}\n\nfunction enqueue(event: BrowserTelemetryEvent): void {\n if (queue.length >= MAX_QUEUE) {\n queue.shift();\n dropped += 1;\n }\n queue.push(event);\n schedule();\n}\n\nexport function recordBrowserPerformance(event: BrowserPerformanceEvent): void {\n enqueue({\n name: event.name,\n ...(event.duration_ms === undefined\n ? {}\n : { duration_ms: Math.max(0, Math.min(600_000, Math.round(event.duration_ms))) }),\n ...(event.count === undefined ? {} : { count: Math.max(0, Math.min(10_000, Math.round(event.count))) }),\n });\n}\n\n/**\n * Describes a thrown value the way the server route accepts it.\n *\n * Every field is length-capped here rather than only on the server, because the\n * route rejects a whole batch on one oversized field and a page that trips that\n * loses the report it was trying to make.\n */\nfunction describeThrown(thrown: unknown): { error_name: string; message: string; stack?: string } {\n if (thrown instanceof Error) {\n return {\n error_name: (thrown.name || 'Error').slice(0, MAX_ERROR_NAME_LENGTH),\n message: (thrown.message || 'Unknown error').slice(0, MAX_ERROR_MESSAGE_LENGTH),\n ...(typeof thrown.stack === 'string' && thrown.stack.length > 0\n ? { stack: thrown.stack.slice(0, MAX_ERROR_STACK_LENGTH) }\n : {}),\n };\n }\n const text = typeof thrown === 'string' ? thrown : safeText(thrown);\n return {\n error_name: typeof thrown === 'string' ? 'StringError' : 'ObjectError',\n message: (text || 'Unknown error').slice(0, MAX_ERROR_MESSAGE_LENGTH),\n };\n}\n\nfunction safeText(value: unknown): string {\n try {\n return JSON.stringify(value) ?? String(value);\n } catch {\n return 'Unserializable error';\n }\n}\n\nexport function recordBrowserError(source: BrowserErrorSource, thrown: unknown, sessionId?: string | null): void {\n const described = describeThrown(thrown);\n const session =\n typeof sessionId === 'string' && sessionId.length > 0 && sessionId.length <= MAX_SESSION_ID_LENGTH\n ? sessionId\n : undefined;\n enqueue({\n name: BROWSER_ERROR_EVENT,\n source,\n ...described,\n ...(session === undefined ? {} : { session_id: session }),\n });\n}\n\ninterface ErrorReportingOptions {\n target?: EventTarget;\n sessionId?: () => string | null;\n}\n\n/**\n * Reports what the cockpit throws, so a view that dies stops dying silently.\n *\n * React re-throws an uncaught render failure through `reportError`, so the\n * window listener covers the timeline going blank as well as ordinary async\n * throws. The reports are queued through the same batch, backoff, and drop\n * counter as performance events; a page that is failing repeatedly must not\n * turn into a request loop.\n */\nexport function installBrowserErrorReporting(options: ErrorReportingOptions = {}): () => void {\n const target = options.target ?? window;\n const sessionId = options.sessionId ?? (() => null);\n\n const onError = (event: Event): void => {\n const thrown = 'error' in event ? (event as ErrorEvent).error : undefined;\n const message = 'message' in event ? (event as ErrorEvent).message : undefined;\n recordBrowserError('window_error', thrown ?? message ?? 'Unknown error', sessionId());\n };\n const onRejection = (event: Event): void => {\n const reason = 'reason' in event ? (event as PromiseRejectionEvent).reason : undefined;\n recordBrowserError('unhandled_rejection', reason, sessionId());\n };\n\n target.addEventListener('error', onError);\n target.addEventListener('unhandledrejection', onRejection);\n return () => {\n target.removeEventListener('error', onError);\n target.removeEventListener('unhandledrejection', onRejection);\n };\n}\n\nexport async function flushBrowserTelemetry(): Promise<void> {\n if (sending || queue.length === 0) return;\n sending = true;\n if (dropped > 0) {\n queue.unshift({ name: 'web.browser.telemetry_drop', count: Math.min(dropped, 10_000) });\n dropped = 0;\n if (queue.length > MAX_QUEUE) queue.pop();\n }\n const events = queue.splice(0, MAX_BATCH);\n let retry = false;\n try {\n const response = await sealedHttpSession.fetch(ROUTE, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ v: 1, events }),\n });\n retry = response.status === 429 || response.status >= 500;\n } catch {\n retry = true;\n } finally {\n if (retry) {\n for (const event of events.reverse()) queue.unshift(event);\n while (queue.length > MAX_QUEUE) {\n queue.pop();\n dropped += 1;\n }\n }\n sending = false;\n if (retry) {\n const delay = retryDelayMs;\n retryDelayMs = Math.min(MAX_RETRY_DELAY_MS, retryDelayMs * 2);\n schedule(delay);\n } else {\n retryDelayMs = SEND_DELAY_MS;\n schedule();\n }\n }\n}\n"],"mappings":";;AAEA,MAAM,QAAQ;AACd,MAAM,YAAY;AAClB,MAAM,YAAY;AAClB,MAAM,gBAAgB;AACtB,MAAM,qBAAqB;AAE3B,MAAM,wBAAwB;AAC9B,MAAM,2BAA2B;AACjC,MAAM,yBAAyB;AAC/B,MAAM,wBAAwB;AAa9B,MAAM,sBAAsB;AAqB5B,MAAM,QAAiC,CAAC;AACx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AI,MAAM,SAAS,WAAW,MAAM,IAAI;CAC1C;CACA,MAAM,SAAS,MAAM,OAAO,GAAG,SAAS;CACxC,IAAI,QAAQ;CACZ,IAAI;EACF,MAAM,WAAW,MAAMA,sBAAAA,kBAAkB,MAAM,OAAO;GACpD,QAAQ;GACR,SAAS,EAAE,gBAAgB,mBAAmB;GAC9C,MAAM,KAAK,UAAU;IAAE,GAAG;IAAG;GAAO,CAAC;EACvC,CAAC;EACD,QAAQ,SAAS,WAAW,OAAO,SAAS,UAAU;CACxD,QAAQ;EACN,QAAQ;CACV,UAAU;EACR,IAAI,OAAO;GACT,KAAK,MAAM,SAAS,OAAO,QAAQ,GAAG,MAAM,QAAQ,KAAK;GACzD,OAAO,MAAM,SAAS,WAAW;IAC/B,MAAM,IAAI;IACV,WAAW;GACb;EACF;EACA,UAAU;EACV,IAAI,OAAO;GACT,MAAM,QAAQ;GACd,eAAe,KAAK,IAAI,oBAAoB,eAAe,CAAC;GAC5D,SAAS,KAAK;EAChB,OAAO;GACL,eAAe;GACf,SAAS;EACX;CACF;AACF"}
@@ -1,5 +1,5 @@
1
1
  //#region src/web/lib/browserTelemetry.d.ts
2
- export type BrowserPerformanceEventName = 'web.browser.ready' | 'web.browser.protocol_ready' | 'web.browser.session_socket_ready' | 'web.browser.reconnect' | 'web.browser.backlog' | 'web.browser.transcript_page' | 'web.browser.transcript_render' | 'web.browser.telemetry_drop';
2
+ export type BrowserPerformanceEventName = 'web.browser.ready' | 'web.browser.protocol_ready' | 'web.browser.session_socket_ready' | 'web.browser.reconnect' | 'web.browser.update_required' | 'web.browser.backlog' | 'web.browser.transcript_page' | 'web.browser.transcript_render' | 'web.browser.telemetry_drop';
3
3
  type BrowserErrorSource = 'window_error' | 'unhandled_rejection' | 'session_socket';
4
4
  export interface BrowserPerformanceEvent {
5
5
  name: BrowserPerformanceEventName;
@@ -25,4 +25,5 @@ interface ErrorReportingOptions {
25
25
  export declare function installBrowserErrorReporting(options?: ErrorReportingOptions): () => void;
26
26
  export declare function flushBrowserTelemetry(): Promise<void>;
27
27
  //#endregion
28
+ export {};
28
29
  //# sourceMappingURL=browserTelemetry.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browserTelemetry.d.mts","names":[],"sources":["../../../src/web/lib/browserTelemetry.ts"],"mappings":";YAaY;KAYP;iBAEY;EACf,MAAM;EACN;EACA;;wBA6Bc;wBAaA,yBAAyB,OAAO;wBA0ChC,mBAAmB,QAAQ,oBAAoB,iBAAiB;UActE;EACR,SAAS;EACT;;;;;;;;;;;wBAYc,6BAA6B,UAAS;wBAsBhC,yBAAyB"}
1
+ {"version":3,"file":"browserTelemetry.d.mts","names":[],"sources":["../../../src/web/lib/browserTelemetry.ts"],"mappings":";YAaY;KAaP;iBAEY;EACf,MAAM;EACN;EACA;;wBA6Bc;wBAaA,yBAAyB,OAAO;wBA0ChC,mBAAmB,QAAQ,oBAAoB,iBAAiB;UActE;EACR,SAAS;EACT;;;;;;;;;;;wBAYc,6BAA6B,UAAS;wBAsBhC,yBAAyB"}
@@ -1 +1 @@
1
- {"version":3,"file":"browserTelemetry.mjs","names":[],"sources":["../../../src/web/lib/browserTelemetry.ts"],"sourcesContent":["import { sealedHttpSession } from './sealedSession';\n\nconst ROUTE = '/api/telemetry/browser';\nconst MAX_QUEUE = 32;\nconst MAX_BATCH = 10;\nconst SEND_DELAY_MS = 1000;\nconst MAX_RETRY_DELAY_MS = 30_000;\n\nconst MAX_ERROR_NAME_LENGTH = 120;\nconst MAX_ERROR_MESSAGE_LENGTH = 300;\nconst MAX_ERROR_STACK_LENGTH = 800;\nconst MAX_SESSION_ID_LENGTH = 64;\n\nexport type BrowserPerformanceEventName =\n | 'web.browser.ready'\n | 'web.browser.protocol_ready'\n | 'web.browser.session_socket_ready'\n | 'web.browser.reconnect'\n | 'web.browser.backlog'\n | 'web.browser.transcript_page'\n | 'web.browser.transcript_render'\n | 'web.browser.telemetry_drop';\n\nconst BROWSER_ERROR_EVENT = 'web.browser.error';\n\ntype BrowserErrorSource = 'window_error' | 'unhandled_rejection' | 'session_socket';\n\nexport interface BrowserPerformanceEvent {\n name: BrowserPerformanceEventName;\n duration_ms?: number;\n count?: number;\n}\n\ninterface BrowserErrorEvent {\n name: typeof BROWSER_ERROR_EVENT;\n source: BrowserErrorSource;\n error_name: string;\n message: string;\n stack?: string;\n session_id?: string;\n}\n\ntype BrowserTelemetryEvent = BrowserPerformanceEvent | BrowserErrorEvent;\n\nconst queue: BrowserTelemetryEvent[] = [];\nlet dropped = 0;\nlet timer: ReturnType<typeof setTimeout> | undefined;\nlet sending = false;\nlet retryDelayMs = SEND_DELAY_MS;\nconst startedAt = performance.now();\n\nfunction schedule(delayMs = SEND_DELAY_MS): void {\n if (timer !== undefined || sending || queue.length === 0) return;\n timer = setTimeout(() => {\n timer = undefined;\n void flushBrowserTelemetry();\n }, delayMs);\n}\n\nexport function browserReadyDuration(): number {\n return Math.max(0, performance.now() - startedAt);\n}\n\nfunction enqueue(event: BrowserTelemetryEvent): void {\n if (queue.length >= MAX_QUEUE) {\n queue.shift();\n dropped += 1;\n }\n queue.push(event);\n schedule();\n}\n\nexport function recordBrowserPerformance(event: BrowserPerformanceEvent): void {\n enqueue({\n name: event.name,\n ...(event.duration_ms === undefined\n ? {}\n : { duration_ms: Math.max(0, Math.min(600_000, Math.round(event.duration_ms))) }),\n ...(event.count === undefined ? {} : { count: Math.max(0, Math.min(10_000, Math.round(event.count))) }),\n });\n}\n\n/**\n * Describes a thrown value the way the server route accepts it.\n *\n * Every field is length-capped here rather than only on the server, because the\n * route rejects a whole batch on one oversized field and a page that trips that\n * loses the report it was trying to make.\n */\nfunction describeThrown(thrown: unknown): { error_name: string; message: string; stack?: string } {\n if (thrown instanceof Error) {\n return {\n error_name: (thrown.name || 'Error').slice(0, MAX_ERROR_NAME_LENGTH),\n message: (thrown.message || 'Unknown error').slice(0, MAX_ERROR_MESSAGE_LENGTH),\n ...(typeof thrown.stack === 'string' && thrown.stack.length > 0\n ? { stack: thrown.stack.slice(0, MAX_ERROR_STACK_LENGTH) }\n : {}),\n };\n }\n const text = typeof thrown === 'string' ? thrown : safeText(thrown);\n return {\n error_name: typeof thrown === 'string' ? 'StringError' : 'ObjectError',\n message: (text || 'Unknown error').slice(0, MAX_ERROR_MESSAGE_LENGTH),\n };\n}\n\nfunction safeText(value: unknown): string {\n try {\n return JSON.stringify(value) ?? String(value);\n } catch {\n return 'Unserializable error';\n }\n}\n\nexport function recordBrowserError(source: BrowserErrorSource, thrown: unknown, sessionId?: string | null): void {\n const described = describeThrown(thrown);\n const session =\n typeof sessionId === 'string' && sessionId.length > 0 && sessionId.length <= MAX_SESSION_ID_LENGTH\n ? sessionId\n : undefined;\n enqueue({\n name: BROWSER_ERROR_EVENT,\n source,\n ...described,\n ...(session === undefined ? {} : { session_id: session }),\n });\n}\n\ninterface ErrorReportingOptions {\n target?: EventTarget;\n sessionId?: () => string | null;\n}\n\n/**\n * Reports what the cockpit throws, so a view that dies stops dying silently.\n *\n * React re-throws an uncaught render failure through `reportError`, so the\n * window listener covers the timeline going blank as well as ordinary async\n * throws. The reports are queued through the same batch, backoff, and drop\n * counter as performance events; a page that is failing repeatedly must not\n * turn into a request loop.\n */\nexport function installBrowserErrorReporting(options: ErrorReportingOptions = {}): () => void {\n const target = options.target ?? window;\n const sessionId = options.sessionId ?? (() => null);\n\n const onError = (event: Event): void => {\n const thrown = 'error' in event ? (event as ErrorEvent).error : undefined;\n const message = 'message' in event ? (event as ErrorEvent).message : undefined;\n recordBrowserError('window_error', thrown ?? message ?? 'Unknown error', sessionId());\n };\n const onRejection = (event: Event): void => {\n const reason = 'reason' in event ? (event as PromiseRejectionEvent).reason : undefined;\n recordBrowserError('unhandled_rejection', reason, sessionId());\n };\n\n target.addEventListener('error', onError);\n target.addEventListener('unhandledrejection', onRejection);\n return () => {\n target.removeEventListener('error', onError);\n target.removeEventListener('unhandledrejection', onRejection);\n };\n}\n\nexport async function flushBrowserTelemetry(): Promise<void> {\n if (sending || queue.length === 0) return;\n sending = true;\n if (dropped > 0) {\n queue.unshift({ name: 'web.browser.telemetry_drop', count: Math.min(dropped, 10_000) });\n dropped = 0;\n if (queue.length > MAX_QUEUE) queue.pop();\n }\n const events = queue.splice(0, MAX_BATCH);\n let retry = false;\n try {\n const response = await sealedHttpSession.fetch(ROUTE, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ v: 1, events }),\n });\n retry = response.status === 429 || response.status >= 500;\n } catch {\n retry = true;\n } finally {\n if (retry) {\n for (const event of events.reverse()) queue.unshift(event);\n while (queue.length > MAX_QUEUE) {\n queue.pop();\n dropped += 1;\n }\n }\n sending = false;\n if (retry) {\n const delay = retryDelayMs;\n retryDelayMs = Math.min(MAX_RETRY_DELAY_MS, retryDelayMs * 2);\n schedule(delay);\n } else {\n retryDelayMs = SEND_DELAY_MS;\n schedule();\n }\n }\n}\n"],"mappings":";;AAEA,MAAM,QAAQ;AACd,MAAM,YAAY;AAClB,MAAM,YAAY;AAClB,MAAM,gBAAgB;AACtB,MAAM,qBAAqB;AAE3B,MAAM,wBAAwB;AAC9B,MAAM,2BAA2B;AACjC,MAAM,yBAAyB;AAC/B,MAAM,wBAAwB;AAY9B,MAAM,sBAAsB;AAqB5B,MAAM,QAAiC,CAAC;AACxC,IAAI,UAAU;AACd,IAAI;AACJ,IAAI,UAAU;AACd,IAAI,eAAe;AACnB,MAAM,YAAY,YAAY,IAAI;AAElC,SAAS,SAAS,UAAU,eAAqB;CAC/C,IAAI,UAAU,KAAA,KAAa,WAAW,MAAM,WAAW,GAAG;CAC1D,QAAQ,iBAAiB;EACvB,QAAQ,KAAA;EACR,sBAA2B;CAC7B,GAAG,OAAO;AACZ;AAEA,SAAgB,uBAA+B;CAC7C,OAAO,KAAK,IAAI,GAAG,YAAY,IAAI,IAAI,SAAS;AAClD;AAEA,SAAS,QAAQ,OAAoC;CACnD,IAAI,MAAM,UAAU,WAAW;EAC7B,MAAM,MAAM;EACZ,WAAW;CACb;CACA,MAAM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M,SAAS,WAAW;IAC/B,MAAM,IAAI;IACV,WAAW;GACb;EACF;EACA,UAAU;EACV,IAAI,OAAO;GACT,MAAM,QAAQ;GACd,eAAe,KAAK,IAAI,oBAAoB,eAAe,CAAC;GAC5D,SAAS,KAAK;EAChB,OAAO;GACL,eAAe;GACf,SAAS;EACX;CACF;AACF"}
1
+ {"version":3,"file":"browserTelemetry.mjs","names":[],"sources":["../../../src/web/lib/browserTelemetry.ts"],"sourcesContent":["import { sealedHttpSession } from './sealedSession';\n\nconst ROUTE = '/api/telemetry/browser';\nconst MAX_QUEUE = 32;\nconst MAX_BATCH = 10;\nconst SEND_DELAY_MS = 1000;\nconst MAX_RETRY_DELAY_MS = 30_000;\n\nconst MAX_ERROR_NAME_LENGTH = 120;\nconst MAX_ERROR_MESSAGE_LENGTH = 300;\nconst MAX_ERROR_STACK_LENGTH = 800;\nconst MAX_SESSION_ID_LENGTH = 64;\n\nexport type BrowserPerformanceEventName =\n | 'web.browser.ready'\n | 'web.browser.protocol_ready'\n | 'web.browser.session_socket_ready'\n | 'web.browser.reconnect'\n | 'web.browser.update_required'\n | 'web.browser.backlog'\n | 'web.browser.transcript_page'\n | 'web.browser.transcript_render'\n | 'web.browser.telemetry_drop';\n\nconst BROWSER_ERROR_EVENT = 'web.browser.error';\n\ntype BrowserErrorSource = 'window_error' | 'unhandled_rejection' | 'session_socket';\n\nexport interface BrowserPerformanceEvent {\n name: BrowserPerformanceEventName;\n duration_ms?: number;\n count?: number;\n}\n\ninterface BrowserErrorEvent {\n name: typeof BROWSER_ERROR_EVENT;\n source: BrowserErrorSource;\n error_name: string;\n message: string;\n stack?: string;\n session_id?: string;\n}\n\ntype BrowserTelemetryEvent = BrowserPerformanceEvent | BrowserErrorEvent;\n\nconst queue: BrowserTelemetryEvent[] = [];\nlet dropped = 0;\nlet timer: ReturnType<typeof setTimeout> | undefined;\nlet sending = false;\nlet retryDelayMs = SEND_DELAY_MS;\nconst startedAt = performance.now();\n\nfunction schedule(delayMs = SEND_DELAY_MS): void {\n if (timer !== undefined || sending || queue.length === 0) return;\n timer = setTimeout(() => {\n timer = undefined;\n void flushBrowserTelemetry();\n }, delayMs);\n}\n\nexport function browserReadyDuration(): number {\n return Math.max(0, performance.now() - startedAt);\n}\n\nfunction enqueue(event: BrowserTelemetryEvent): void {\n if (queue.length >= MAX_QUEUE) {\n queue.shift();\n dropped += 1;\n }\n queue.push(event);\n schedule();\n}\n\nexport function recordBrowserPerformance(event: BrowserPerformanceEvent): void {\n enqueue({\n name: event.name,\n ...(event.duration_ms === undefined\n ? {}\n : { duration_ms: Math.max(0, Math.min(600_000, Math.round(event.duration_ms))) }),\n ...(event.count === undefined ? {} : { count: Math.max(0, Math.min(10_000, Math.round(event.count))) }),\n });\n}\n\n/**\n * Describes a thrown value the way the server route accepts it.\n *\n * Every field is length-capped here rather than only on the server, because the\n * route rejects a whole batch on one oversized field and a page that trips that\n * loses the report it was trying to make.\n */\nfunction describeThrown(thrown: unknown): { error_name: string; message: string; stack?: string } {\n if (thrown instanceof Error) {\n return {\n error_name: (thrown.name || 'Error').slice(0, MAX_ERROR_NAME_LENGTH),\n message: (thrown.message || 'Unknown error').slice(0, MAX_ERROR_MESSAGE_LENGTH),\n ...(typeof thrown.stack === 'string' && thrown.stack.length > 0\n ? { stack: thrown.stack.slice(0, MAX_ERROR_STACK_LENGTH) }\n : {}),\n };\n }\n const text = typeof thrown === 'string' ? thrown : safeText(thrown);\n return {\n error_name: typeof thrown === 'string' ? 'StringError' : 'ObjectError',\n message: (text || 'Unknown error').slice(0, MAX_ERROR_MESSAGE_LENGTH),\n };\n}\n\nfunction safeText(value: unknown): string {\n try {\n return JSON.stringify(value) ?? String(value);\n } catch {\n return 'Unserializable error';\n }\n}\n\nexport function recordBrowserError(source: BrowserErrorSource, thrown: unknown, sessionId?: string | null): void {\n const described = describeThrown(thrown);\n const session =\n typeof sessionId === 'string' && sessionId.length > 0 && sessionId.length <= MAX_SESSION_ID_LENGTH\n ? sessionId\n : undefined;\n enqueue({\n name: BROWSER_ERROR_EVENT,\n source,\n ...described,\n ...(session === undefined ? {} : { session_id: session }),\n });\n}\n\ninterface ErrorReportingOptions {\n target?: EventTarget;\n sessionId?: () => string | null;\n}\n\n/**\n * Reports what the cockpit throws, so a view that dies stops dying silently.\n *\n * React re-throws an uncaught render failure through `reportError`, so the\n * window listener covers the timeline going blank as well as ordinary async\n * throws. The reports are queued through the same batch, backoff, and drop\n * counter as performance events; a page that is failing repeatedly must not\n * turn into a request loop.\n */\nexport function installBrowserErrorReporting(options: ErrorReportingOptions = {}): () => void {\n const target = options.target ?? window;\n const sessionId = options.sessionId ?? (() => null);\n\n const onError = (event: Event): void => {\n const thrown = 'error' in event ? (event as ErrorEvent).error : undefined;\n const message = 'message' in event ? (event as ErrorEvent).message : undefined;\n recordBrowserError('window_error', thrown ?? message ?? 'Unknown error', sessionId());\n };\n const onRejection = (event: Event): void => {\n const reason = 'reason' in event ? (event as PromiseRejectionEvent).reason : undefined;\n recordBrowserError('unhandled_rejection', reason, sessionId());\n };\n\n target.addEventListener('error', onError);\n target.addEventListener('unhandledrejection', onRejection);\n return () => {\n target.removeEventListener('error', onError);\n target.removeEventListener('unhandledrejection', onRejection);\n };\n}\n\nexport async function flushBrowserTelemetry(): Promise<void> {\n if (sending || queue.length === 0) return;\n sending = true;\n if (dropped > 0) {\n queue.unshift({ name: 'web.browser.telemetry_drop', count: Math.min(dropped, 10_000) });\n dropped = 0;\n if (queue.length > MAX_QUEUE) queue.pop();\n }\n const events = queue.splice(0, MAX_BATCH);\n let retry = false;\n try {\n const response = await sealedHttpSession.fetch(ROUTE, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ v: 1, events }),\n });\n retry = response.status === 429 || response.status >= 500;\n } catch {\n retry = true;\n } finally {\n if (retry) {\n for (const event of events.reverse()) queue.unshift(event);\n while (queue.length > MAX_QUEUE) {\n queue.pop();\n dropped += 1;\n }\n }\n sending = false;\n if (retry) {\n const delay = retryDel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CAAC;CAC/D;CAEA,OAAO,iBAAiB,SAAS,OAAO;CACxC,OAAO,iBAAiB,sBAAsB,WAAW;CACzD,aAAa;EACX,OAAO,oBAAoB,SAAS,OAAO;EAC3C,OAAO,oBAAoB,sBAAsB,WAAW;CAC9D;AACF;AAEA,eAAsB,wBAAuC;CAC3D,IAAI,WAAW,MAAM,WAAW,GAAG;CACnC,UAAU;CACV,IAAI,UAAU,GAAG;EACf,MAAM,QAAQ;GAAE,MAAM;GAA8B,OAAO,KAAK,IAAI,SAAS,GAAM;EAAE,CAAC;EACtF,UAAU;EACV,IAAI,MAAM,SAAS,WAAW,MAAM,IAAI;CAC1C;CACA,MAAM,SAAS,MAAM,OAAO,GAAG,SAAS;CACxC,IAAI,QAAQ;CACZ,IAAI;EACF,MAAM,WAAW,MAAM,kBAAkB,MAAM,OAAO;GACpD,QAAQ;GACR,SAAS,EAAE,gBAAgB,mBAAmB;GAC9C,MAAM,KAAK,UAAU;IAAE,GAAG;IAAG;GAAO,CAAC;EACvC,CAAC;EACD,QAAQ,SAAS,WAAW,OAAO,SAAS,UAAU;CACxD,QAAQ;EACN,QAAQ;CACV,UAAU;EACR,IAAI,OAAO;GACT,KAAK,MAAM,SAAS,OAAO,QAAQ,GAAG,MAAM,QAAQ,KAAK;GACzD,OAAO,MAAM,SAAS,WAAW;IAC/B,MAAM,IAAI;IACV,WAAW;GACb;EACF;EACA,UAAU;EACV,IAAI,OAAO;GACT,MAAM,QAAQ;GACd,eAAe,KAAK,IAAI,oBAAoB,eAAe,CAAC;GAC5D,SAAS,KAAK;EAChB,OAAO;GACL,eAAe;GACf,SAAS;EACX;CACF;AACF"}
@@ -50,4 +50,5 @@ export declare function dialogValue(id: string, value: string): Frame;
50
50
  export declare function dialogConfirmed(id: string, confirmed: boolean): Frame;
51
51
  export declare function dialogCancelled(id: string): Frame;
52
52
  //#endregion
53
+ export {};
53
54
  //# sourceMappingURL=commands.d.mts.map
@@ -4,4 +4,5 @@ type ComposerSubmissionListener = (submission: ComposerSubmission) => void;
4
4
  export declare function onComposerSubmitted(listener: ComposerSubmissionListener): () => void;
5
5
  export declare function publishComposerSubmission(submission: ComposerSubmission): void;
6
6
  //#endregion
7
+ export {};
7
8
  //# sourceMappingURL=composerSubmissions.d.mts.map
@@ -12,13 +12,13 @@ const AXIS_LIST_SEPARATOR = ",";
12
12
  const PACKAGED_SELECTION_AXES = [{
13
13
  name: "profile",
14
14
  command: "profile",
15
- statusKey: "doom-profile",
15
+ statusKey: "po-profile",
16
16
  emptyLabel: "no profile",
17
17
  order: 10
18
18
  }, {
19
19
  name: "domains",
20
20
  command: "domains",
21
- statusKey: "doom-domain",
21
+ statusKey: "po-domain",
22
22
  emptyLabel: "no domains",
23
23
  multi: true,
24
24
  order: 20
@@ -67,7 +67,7 @@ const PACKAGED_MINOR_MODES = [
67
67
  {
68
68
  name: "loop",
69
69
  keys: "l l",
70
- statusKey: "doom-loop"
70
+ statusKey: "po-loop"
71
71
  },
72
72
  {
73
73
  name: "goal",
@@ -87,13 +87,13 @@ const PACKAGED_MINOR_MODES = [
87
87
  name: "voice",
88
88
  modeId: "voice-auto",
89
89
  keys: "v e",
90
- statusKey: "doom-voice"
90
+ statusKey: "po-voice"
91
91
  },
92
92
  {
93
93
  name: "computer use",
94
94
  modeId: "computer-use",
95
95
  keys: "c e",
96
- statusKey: "doom-computer-use-mode",
96
+ statusKey: "po-computer-use-mode",
97
97
  hideWhenMissing: true,
98
98
  desktopOnly: true
99
99
  }
@@ -294,6 +294,21 @@ function useDockFaces(sessionId) {
294
294
  (0, react.useSyncExternalStore)(subscribe, snapshot, snapshot);
295
295
  return require_pluginRegistry.pluginDockFaces().filter((face) => face.visibility?.isVisible(sessionId) !== false);
296
296
  }
297
+ /** Chooses the first newly eligible tab face, then the first session face not yet chosen. */
298
+ function autoSelectedDockFace(faces, context, previous) {
299
+ const sessionFace = faces.find((face) => face.autoSelect === true);
300
+ const tabFace = faces.find((face) => typeof face.autoSelect === "function" && face.autoSelect(context));
301
+ const sessionKey = sessionFace === void 0 ? "" : `${context.sessionId}:${sessionFace.id}`;
302
+ const freshSession = sessionKey !== "" && !previous.sessions.includes(sessionKey);
303
+ const keys = {
304
+ sessions: freshSession ? [...previous.sessions, sessionKey] : previous.sessions,
305
+ tab: tabFace === void 0 ? "" : `${context.sessionId}:${context.tabId}:${tabFace.id}`
306
+ };
307
+ return {
308
+ face: tabFace !== void 0 && keys.tab !== previous.tab ? tabFace : freshSession ? sessionFace : void 0,
309
+ keys
310
+ };
311
+ }
297
312
  /** Activity groups that update when either host signals or a plugin's session store changes. */
298
313
  function useActivityGroups(statuses, widgets, sessionId) {
299
314
  (0, react.useSyncExternalStore)(subscribeActivitySources, () => activitySourceFingerprint(sessionId), () => activitySourceFingerprint(sessionId));
@@ -390,6 +405,7 @@ function useFileLinks(sessionId) {
390
405
  exports.PACKAGED_MINOR_MODES = PACKAGED_MINOR_MODES;
391
406
  exports.PACKAGED_SELECTION_AXES = PACKAGED_SELECTION_AXES;
392
407
  exports.activityGroups = activityGroups;
408
+ exports.autoSelectedDockFace = autoSelectedDockFace;
393
409
  exports.bindFileLinkModes = bindFileLinkModes;
394
410
  exports.fileLinkFor = fileLinkFor;
395
411
  exports.fileTabForPath = fileTabForPath;
@@ -1 +1 @@
1
- {"version":3,"file":"composition.cjs","names":["pluginSelectionAxes","stripAnsi","isDesktopClient","pluginMinorModes","pluginActivityGroups","subscribeWebPluginRegistry","webPluginRegistryRevision","pluginDockFaces","pluginFileLinks","useSyncExternalStore","useCallback"],"sources":["../../../src/web/lib/composition.ts"],"sourcesContent":["import type {\n ActivityGroupContribution,\n DockFaceContribution,\n SelectionAxisContribution,\n TransientTab,\n} from '@agimon-ai/po-core/web';\nimport { useCallback, useSyncExternalStore } from 'react';\n\nimport type { MinorModeProjection, MinorModeRecordProjection } from '../../types/hub';\nimport {\n isDesktopClient,\n pluginActivityGroups,\n pluginDockFaces,\n pluginFileLinks,\n pluginMinorModes,\n pluginSelectionAxes,\n subscribeWebPluginRegistry,\n webPluginRegistryRevision,\n} from './pluginRegistry';\nimport { stripAnsi } from './statusLine';\n\nexport interface SelectionAxis {\n name: string;\n command: string;\n /** The current selections, empty while the session reports none; one at most unless multi. */\n values: string[];\n emptyLabel: string;\n multi: boolean;\n}\n\nconst AXIS_LIST_SEPARATOR = ',';\n\n/**\n * The fallback axis table for the packaged bundle; a synced bundle carries\n * each axis as its owning package's plugin declaration, and the registry\n * list wins whenever any plugin declares one. Exported only so the workspace\n * composition test can hold it equal to what the packages declare.\n */\nexport const PACKAGED_SELECTION_AXES: readonly SelectionAxisContribution[] = [\n { name: 'profile', command: 'profile', statusKey: 'doom-profile', emptyLabel: 'no profile', order: 10 },\n { name: 'domains', command: 'domains', statusKey: 'doom-domain', emptyLabel: 'no domains', multi: true, order: 20 },\n];\n\n/**\n * The declared axes the session actually offers: an axis whose status key\n * the session never published stays off the bar entirely, which is how a\n * package withholds its axis when there is nothing to select.\n */\nexport function selectionAxes(statuses: Record<string, string>): SelectionAxis[] {\n const declared = pluginSelectionAxes();\n const sources: readonly SelectionAxisContribution[] = declared.length > 0 ? declared : PACKAGED_SELECTION_AXES;\n return sources.flatMap((source) => {\n const raw = statuses[source.statusKey];\n if (raw === undefined) return [];\n const multi = source.multi === true;\n const values = (multi ? stripAnsi(raw).split(AXIS_LIST_SEPARATOR) : [stripAnsi(raw)])\n .map((value) => value.trim())\n .filter(Boolean);\n return [{ name: source.name, command: source.command, values, emptyLabel: source.emptyLabel, multi }];\n });\n}\n\nexport type MinorModeAvailability = 'unavailable' | 'off' | 'on';\n\nexport interface MinorMode {\n name: string;\n /** The catalog id /minor accepts; the display name until the catalog reports. */\n id: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n availability: MinorModeAvailability;\n /** What the mode itself is reporting while on. */\n detail: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n /**\n * Why the mode cannot be driven from here, in the words of the mode itself.\n * Empty when it can. A mode may be installed and still refuse a cockpit:\n * autonomous voice captures from the terminal's own microphone, which a\n * browser talking to a headless agent does not have.\n */\n unavailableReason: string;\n}\n\nexport interface MinorModeSource {\n name: string;\n /** The catalog mode this row drives, when the runtime registers it under another id. */\n modeId?: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n statusKey?: string;\n widgetKey?: string;\n hideWhenMissing?: boolean;\n desktopOnly?: boolean;\n}\n\n/**\n * The fallback minor-mode table for the packaged bundle.\n *\n * A synced bundle carries each mode as its package's own web plugin\n * contribution, and the registry list wins whenever any plugin declares one.\n * This literal survives only so the built-in-only bundle keeps rendering the\n * modes Po ships; help is listed without a signal on purpose: it\n * registers no footer entry, so the cockpit reports it as unavailable rather\n * than guessing it is off. Exported only for the workspace composition test.\n */\nexport const PACKAGED_MINOR_MODES: readonly MinorModeSource[] = [\n { name: 'help', keys: 'h e' },\n { name: 'plan', keys: 'p e', statusKey: 'plan-mode' },\n { name: 'loop', keys: 'l l', statusKey: 'doom-loop' },\n { name: 'goal', keys: 'g e', statusKey: 'goal' },\n { name: 'author', keys: 'o a' },\n { name: 'workflow', keys: 'w e', widgetKey: 'workflow-mcp-progress' },\n // `v e` drives autonomous capture, which the runtime registers as 'voice-auto'.\n { name: 'voice', modeId: 'voice-auto', keys: 'v e', statusKey: 'doom-voice' },\n {\n name: 'computer use',\n modeId: 'computer-use',\n keys: 'c e',\n statusKey: 'doom-computer-use-mode',\n hideWhenMissing: true,\n desktopOnly: true,\n },\n];\n\n/** The declared source a catalog mode corresponds to, by id, id stem, or label. */\nfunction sourceFor(sources: readonly MinorModeSource[], mode: MinorModeRecordProjection): MinorModeSource | undefined {\n const candidates = new Set([mode.id.toLowerCase(), mode.id.toLowerCase().split('.')[0], mode.label.toLowerCase()]);\n return sources.find((source) =>\n [source.name, source.modeId].some((identity) => identity !== undefined && candidates.has(identity.toLowerCase())),\n );\n}\n\n/**\n * Catalog-backed rows: the runtime's own activation state per mode, with the\n * declared leader keys attached where a plugin documents them. Declared modes\n * the catalog does not know are still listed, as unavailable, so a mode that\n * is missing from a composition stays visible rather than silently gone.\n */\nfunction catalogMinorModes(sources: readonly MinorModeSource[], projection: MinorModeProjection): MinorMode[] {\n const rows: MinorMode[] = projection.modes\n .filter((mode) => !sourceFor(sources, mode)?.desktopOnly || isDesktopClient())\n .map((mode) => {\n const source = sourceFor(sources, mode);\n const on = mode.activation === 'active' || mode.activation === 'deactivating';\n // The catalog says per action whether it can run here and why not. A mode\n // with nothing runnable is offered as a row that cannot be clicked rather\n // than one that answers \"no actions available\" after the fact.\n const blocked = mode.actions.length > 0 && mode.actions.every((action) => !action.enabled);\n const reason = blocked ? (mode.actions.find((action) => action.disabledReason)?.disabledReason ?? '') : '';\n return {\n name: source?.name ?? mode.label.toLowerCase(),\n id: mode.id,\n keys: source?.keys ?? '',\n availability: blocked && !on ? 'unavailable' : on ? 'on' : 'off',\n ...(source?.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: mode.detail ?? (mode.activation === 'activating' ? 'activating' : ''),\n unavailableReason: reason,\n };\n });\n const seen = new Set(rows.map((row) => row.name));\n for (const source of sources) {\n if (source.hideWhenMissing === true || (source.desktopOnly && !isDesktopClient())) continue;\n if (!seen.has(source.name)) {\n rows.push({\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable',\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: 'No package in this session registers this mode.',\n });\n }\n }\n return rows;\n}\n\nexport function minorModes(\n statuses: Record<string, string>,\n widgets: readonly string[],\n projection: MinorModeProjection | null = null,\n): MinorMode[] {\n const declared = pluginMinorModes();\n const sources: readonly MinorModeSource[] = declared.length > 0 ? declared : PACKAGED_MINOR_MODES;\n if (projection) return catalogMinorModes(sources, projection);\n return sources.flatMap((source) => {\n if (source.desktopOnly && !isDesktopClient()) return [];\n if (source.statusKey !== undefined) {\n const raw = statuses[source.statusKey];\n if (raw === undefined) {\n if (source.hideWhenMissing === true) return [];\n return [\n {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n },\n ];\n }\n const detail = stripAnsi(raw).trim();\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: detail ? ('on' as const) : ('off' as const),\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail,\n unavailableReason: '',\n };\n }\n if (source.widgetKey !== undefined && widgets.includes(source.widgetKey)) {\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'off' as const,\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: '',\n };\n }\n return {\n name: source.name,\n id: source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n };\n });\n}\n\nexport interface ActivityGroup {\n name: string;\n keys: string;\n /** The heading visual its package declares; the dock draws a generic one without it. */\n icon?: ActivityGroupContribution['icon'];\n /** What the publishing extension is reporting, empty when it reports nothing. */\n summary: string;\n active: boolean;\n marksBackgroundWork?: boolean;\n /** The temporary tab the group's name opens, when its package declares one. */\n transientTab?: () => TransientTab;\n /** Keeps the group visible below the dock's scrolling ordinary groups. */\n placement?: 'bottom';\n}\n\n/** Subscribe to package-owned activity sources, rewiring when the focused composition changes. */\nexport function subscribeActivitySources(listener: () => void): () => void {\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginActivityGroups().flatMap((source) =>\n source.activeSource === undefined ? [] : [source.activeSource.subscribe(listener)],\n );\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activitySourceFingerprint(sessionId: string | null): string {\n const activeSources = pluginActivityGroups()\n .map((source) => (source.activeSource?.isActive(sessionId) === true ? '1' : '0'))\n .join('');\n return `${webPluginRegistryRevision()}:${activeSources}`;\n}\n\n/**\n * The groups available in this plugin composition. Status and widget signals\n * reveal legacy groups. A package-owned active source also reveals its group,\n * including while idle, so the section can remain a stable launcher unless it\n * opts into `hideWhenEmpty`.\n *\n * A group that declared `hideWhenEmpty` goes away once its session stops\n * reporting. Clearing a status reaches the page as an empty string rather than\n * an absent key, because the same map tells the selection bar which minor modes\n * exist and an absent key means \"not reported\" there. Emptiness is read here,\n * where only the dock is looking.\n */\nexport function activityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null = null,\n): ActivityGroup[] {\n const groups: ActivityGroup[] = [];\n for (const source of pluginActivityGroups()) {\n const tab = source.transientTab === undefined ? {} : { transientTab: source.transientTab };\n const placement = {\n ...(source.placement === undefined ? {} : { placement: source.placement }),\n ...(source.marksBackgroundWork === false ? { marksBackgroundWork: false } : {}),\n ...(source.icon === undefined ? {} : { icon: source.icon }),\n };\n if (source.statusKey !== undefined && statuses[source.statusKey] !== undefined) {\n const summary = stripAnsi(statuses[source.statusKey] ?? '').trim();\n const active =\n source.activeSource?.isActive(sessionId) ?? (source.marksBackgroundWork !== false && summary.length > 0);\n if (summary.length === 0 && source.hideWhenEmpty === true && !active) continue;\n groups.push({ name: source.name, keys: source.keys, summary, active, ...tab, ...placement });\n continue;\n }\n if (source.widgetKeys !== undefined && source.widgetKeys.some((key) => widgets.includes(key))) {\n const activeKeys = source.activeWidgetKeys ?? source.widgetKeys;\n const active =\n source.activeSource?.isActive(sessionId) ??\n (source.marksBackgroundWork !== false && activeKeys.some((key) => widgets.includes(key)));\n groups.push({ name: source.name, keys: source.keys, summary: '', active, ...tab, ...placement });\n continue;\n }\n if (source.activeSource !== undefined) {\n const active = source.activeSource.isActive(sessionId);\n if (source.hideWhenEmpty === true && !active) continue;\n groups.push({\n name: source.name,\n keys: source.keys,\n summary: '',\n active,\n ...tab,\n ...placement,\n });\n }\n }\n return groups;\n}\n\n/** Dock faces update when the active session composition changes. */\nexport function useDockFaces(sessionId: string | null): readonly DockFaceContribution[] {\n useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision, webPluginRegistryRevision);\n const subscribe = (listener: () => void) => {\n const releases = pluginDockFaces().flatMap((face) =>\n face.visibility ? [face.visibility.subscribe(listener)] : [],\n );\n return () => releases.forEach((release) => release());\n };\n const snapshot = () =>\n pluginDockFaces()\n .map((face) => (face.visibility?.isVisible(sessionId) !== false ? '1' : '0'))\n .join('');\n useSyncExternalStore(subscribe, snapshot, snapshot);\n return pluginDockFaces().filter((face) => face.visibility?.isVisible(sessionId) !== false);\n}\n\n/** Activity groups that update when either host signals or a plugin's session store changes. */\nexport function useActivityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null,\n): ActivityGroup[] {\n useSyncExternalStore(\n subscribeActivitySources,\n () => activitySourceFingerprint(sessionId),\n () => activitySourceFingerprint(sessionId),\n );\n return activityGroups(statuses, widgets, sessionId);\n}\n\n/** The tab one path opens, or undefined when no installed plugin recognises it. */\nexport type FileLinkResolver = (path: string) => TransientTab | undefined;\n\ninterface FileLinkModes {\n active(sessionId: string | null): readonly string[];\n subscribe(sessionId: string | null, listener: () => void): () => void;\n}\nlet fileLinkModes: FileLinkModes | undefined;\nconst modeBindings = new Set<() => void>();\n\n/** Binds host session facts without making the composition library own session state. */\nexport function bindFileLinkModes(source: FileLinkModes): () => void {\n fileLinkModes = source;\n modeBindings.forEach((listener) => listener());\n return () => {\n if (fileLinkModes !== source) return;\n fileLinkModes = undefined;\n modeBindings.forEach((listener) => listener());\n };\n}\nfunction subscribeFileLinks(sessionId: string | null, listener: () => void): () => void {\n let unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n const rebindModes = () => {\n unsubscribeModes?.();\n unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n listener();\n };\n modeBindings.add(rebindModes);\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginFileLinks().map((source) => source.subscribe(listener));\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n modeBindings.delete(rebindModes);\n unsubscribeModes?.();\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activeFileLinkSources(sessionId: string | null) {\n const enabled = new Set(fileLinkModes?.active(sessionId) ?? []);\n return pluginFileLinks(sessionId).filter(\n (source) => source.requiredMinorMode === undefined || enabled.has(source.requiredMinorMode),\n );\n}\n\nfunction fileLinkFingerprint(sessionId: string | null): string {\n const sourceFingerprints = activeFileLinkSources(sessionId)\n .map((source) => `${source.requiredMinorMode ?? ''}:${source.fingerprint(sessionId)}`)\n .join('\\n');\n return `${webPluginRegistryRevision()}:${sourceFingerprints}`;\n}\n\n/**\n * The tab a path opens, from the first source that claims it.\n *\n * A path no source claims is not a link. The host cannot tell a file name from\n * a class name, and the plugin that tracks the session's files can, so the\n * decision belongs there rather than in a heuristic here.\n */\nexport function fileLinkFor(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n\n/**\n * The tab a path the caller is sure about opens: a tool call's path argument,\n * not a token spotted in prose.\n *\n * A source that offers `openPath` answers here, and it may claim a file the\n * session never changed, which `resolve` deliberately will not. Sources\n * without it fall back to the same guess prose gets.\n */\nexport function fileTabForPath(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.openPath?.(sessionId, path) ?? source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n/**\n * Resolves the paths a message names against the plugins that track them.\n *\n * The resolver's identity is stable while the linkable set is, so a component\n * that hands it to a renderer does not rebuild that renderer on every frame of\n * a streaming reply.\n */\nexport function useFileLinks(sessionId: string | null): FileLinkResolver {\n const fingerprint = useSyncExternalStore(\n useCallback((listener: () => void) => subscribeFileLinks(sessionId, listener), [sessionId]),\n () => fileLinkFingerprint(sessionId),\n () => fileLinkFingerprint(sessionId),\n );\n return useCallback(\n (path: string) => fileLinkFor(sessionId, path),\n // The fingerprint is the dependency: the same path resolves differently\n // once the session's set of tracked files changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps -- fingerprint is a deliberate identity buster, not a value the callback reads.\n [sessionId, fingerprint],\n );\n}\n"],"mappings":";;;;AA8BA,MAAM,sBAAsB;;;;;;;AAQ5B,MAAa,0BAAgE,CAC3E;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAgB,YAAY;CAAc,OAAO;AAAG,GACtG;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAe,YAAY;CAAc,OAAO;CAAM,OAAO;AAAG,CACpH;;;;;;AAOA,SAAgB,cAAc,UAAmD;CAC/E,MAAM,WAAWA,uBAAAA,oBAAoB;CAErC,QADsD,SAAS,SAAS,IAAI,WAAW,wBAAA,CACxE,SAAS,WAAW;EACjC,MAAM,MAAM,SAAS,OAAO;EAC5B,IAAI,QAAQ,KAAA,GAAW,OAAO,CAAC;EAC/B,MAAM,QAAQ,OAAO,UAAU;EAC/B,MAAM,UAAU,QAAQC,mBAAAA,UAAU,GAAG,CAAC,CAAC,MAAM,mBAAmB,IAAI,CAACA,mBAAAA,UAAU,GAAG,CAAC,EAAA,CAChF,KAAK,UAAU,MAAM,KAAK,CAAC,CAAC,CAC5B,OAAO,OAAO;EACjB,OAAO,CAAC;GAAE,MAAM,OAAO;GAAM,S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AkC;CAC7D,MAAM,qBAAqB,sBAAsB,SAAS,CAAC,CACxD,KAAK,WAAW,GAAG,OAAO,qBAAqB,GAAG,GAAG,OAAO,YAAY,SAAS,GAAG,CAAC,CACrF,KAAK,IAAI;CACZ,OAAO,GAAGF,uBAAAA,0BAA0B,EAAE,GAAG;AAC3C;;;;;;;;AASA,SAAgB,YAAY,WAA0B,MAAwC;CAC5F,KAAK,MAAM,UAAU,sBAAsB,SAAS,GAAG;EACrD,MAAM,MAAM,OAAO,QAAQ,WAAW,IAAI;EAC1C,IAAI,QAAQ,KAAA,GAAW,OAAO;CAChC;AAEF;;;;;;;;;AAUA,SAAgB,eAAe,WAA0B,MAAwC;CAC/F,KAAK,MAAM,UAAU,sBAAsB,SAAS,GAAG;EACrD,MAAM,MAAM,OAAO,WAAW,WAAW,IAAI,KAAK,OAAO,QAAQ,WAAW,IAAI;EAChF,IAAI,QAAQ,KAAA,GAAW,OAAO;CAChC;AAEF;;;;;;;;AAQA,SAAgB,aAAa,WAA4C;CACvE,MAAM,eAAA,GAAcG,MAAAA,qBAAAA,EAAAA,GAClBC,MAAAA,YAAAA,EAAa,aAAyB,mBAAmB,WAAW,QAAQ,GAAG,CAAC,SAAS,CAAC,SACpF,oBAAoB,SAAS,SAC7B,oBAAoB,SAAS,CACrC;CACA,QAAA,GAAOA,MAAAA,YAAAA,EACJ,SAAiB,YAAY,WAAW,IAAI,GAI7C,CAAC,WAAW,WAAW,CACzB;AACF"}
1
+ {"version":3,"file":"composition.cjs","names":["pluginSelectionAxes","stripAnsi","isDesktopClient","pluginMinorModes","pluginActivityGroups","subscribeWebPluginRegistry","webPluginRegistryRevision","pluginDockFaces","pluginFileLinks","useSyncExternalStore","useCallback"],"sources":["../../../src/web/lib/composition.ts"],"sourcesContent":["import type {\n ActivityGroupContribution,\n DockFaceContribution,\n SelectionAxisContribution,\n TransientTab,\n} from '@agimon-ai/po-core/web';\nimport { useCallback, useSyncExternalStore } from 'react';\n\nimport type { MinorModeProjection, MinorModeRecordProjection } from '../../types/hub';\nimport {\n isDesktopClient,\n pluginActivityGroups,\n pluginDockFaces,\n pluginFileLinks,\n pluginMinorModes,\n pluginSelectionAxes,\n subscribeWebPluginRegistry,\n webPluginRegistryRevision,\n} from './pluginRegistry';\nimport { stripAnsi } from './statusLine';\n\nexport interface SelectionAxis {\n name: string;\n command: string;\n /** The current selections, empty while the session reports none; one at most unless multi. */\n values: string[];\n emptyLabel: string;\n multi: boolean;\n}\n\nconst AXIS_LIST_SEPARATOR = ',';\n\n/**\n * The fallback axis table for the packaged bundle; a synced bundle carries\n * each axis as its owning package's plugin declaration, and the registry\n * list wins whenever any plugin declares one. Exported only so the workspace\n * composition test can hold it equal to what the packages declare.\n */\nexport const PACKAGED_SELECTION_AXES: readonly SelectionAxisContribution[] = [\n { name: 'profile', command: 'profile', statusKey: 'po-profile', emptyLabel: 'no profile', order: 10 },\n { name: 'domains', command: 'domains', statusKey: 'po-domain', emptyLabel: 'no domains', multi: true, order: 20 },\n];\n\n/**\n * The declared axes the session actually offers: an axis whose status key\n * the session never published stays off the bar entirely, which is how a\n * package withholds its axis when there is nothing to select.\n */\nexport function selectionAxes(statuses: Record<string, string>): SelectionAxis[] {\n const declared = pluginSelectionAxes();\n const sources: readonly SelectionAxisContribution[] = declared.length > 0 ? declared : PACKAGED_SELECTION_AXES;\n return sources.flatMap((source) => {\n const raw = statuses[source.statusKey];\n if (raw === undefined) return [];\n const multi = source.multi === true;\n const values = (multi ? stripAnsi(raw).split(AXIS_LIST_SEPARATOR) : [stripAnsi(raw)])\n .map((value) => value.trim())\n .filter(Boolean);\n return [{ name: source.name, command: source.command, values, emptyLabel: source.emptyLabel, multi }];\n });\n}\n\nexport type MinorModeAvailability = 'unavailable' | 'off' | 'on';\n\nexport interface MinorMode {\n name: string;\n /** The catalog id /minor accepts; the display name until the catalog reports. */\n id: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n availability: MinorModeAvailability;\n /** What the mode itself is reporting while on. */\n detail: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n /**\n * Why the mode cannot be driven from here, in the words of the mode itself.\n * Empty when it can. A mode may be installed and still refuse a cockpit:\n * autonomous voice captures from the terminal's own microphone, which a\n * browser talking to a headless agent does not have.\n */\n unavailableReason: string;\n}\n\nexport interface MinorModeSource {\n name: string;\n /** The catalog mode this row drives, when the runtime registers it under another id. */\n modeId?: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n statusKey?: string;\n widgetKey?: string;\n hideWhenMissing?: boolean;\n desktopOnly?: boolean;\n}\n\n/**\n * The fallback minor-mode table for the packaged bundle.\n *\n * A synced bundle carries each mode as its package's own web plugin\n * contribution, and the registry list wins whenever any plugin declares one.\n * This literal survives only so the built-in-only bundle keeps rendering the\n * modes Po ships; help is listed without a signal on purpose: it\n * registers no footer entry, so the cockpit reports it as unavailable rather\n * than guessing it is off. Exported only for the workspace composition test.\n */\nexport const PACKAGED_MINOR_MODES: readonly MinorModeSource[] = [\n { name: 'help', keys: 'h e' },\n { name: 'plan', keys: 'p e', statusKey: 'plan-mode' },\n { name: 'loop', keys: 'l l', statusKey: 'po-loop' },\n { name: 'goal', keys: 'g e', statusKey: 'goal' },\n { name: 'author', keys: 'o a' },\n { name: 'workflow', keys: 'w e', widgetKey: 'workflow-mcp-progress' },\n // `v e` drives autonomous capture, which the runtime registers as 'voice-auto'.\n { name: 'voice', modeId: 'voice-auto', keys: 'v e', statusKey: 'po-voice' },\n {\n name: 'computer use',\n modeId: 'computer-use',\n keys: 'c e',\n statusKey: 'po-computer-use-mode',\n hideWhenMissing: true,\n desktopOnly: true,\n },\n];\n\n/** The declared source a catalog mode corresponds to, by id, id stem, or label. */\nfunction sourceFor(sources: readonly MinorModeSource[], mode: MinorModeRecordProjection): MinorModeSource | undefined {\n const candidates = new Set([mode.id.toLowerCase(), mode.id.toLowerCase().split('.')[0], mode.label.toLowerCase()]);\n return sources.find((source) =>\n [source.name, source.modeId].some((identity) => identity !== undefined && candidates.has(identity.toLowerCase())),\n );\n}\n\n/**\n * Catalog-backed rows: the runtime's own activation state per mode, with the\n * declared leader keys attached where a plugin documents them. Declared modes\n * the catalog does not know are still listed, as unavailable, so a mode that\n * is missing from a composition stays visible rather than silently gone.\n */\nfunction catalogMinorModes(sources: readonly MinorModeSource[], projection: MinorModeProjection): MinorMode[] {\n const rows: MinorMode[] = projection.modes\n .filter((mode) => !sourceFor(sources, mode)?.desktopOnly || isDesktopClient())\n .map((mode) => {\n const source = sourceFor(sources, mode);\n const on = mode.activation === 'active' || mode.activation === 'deactivating';\n // The catalog says per action whether it can run here and why not. A mode\n // with nothing runnable is offered as a row that cannot be clicked rather\n // than one that answers \"no actions available\" after the fact.\n const blocked = mode.actions.length > 0 && mode.actions.every((action) => !action.enabled);\n const reason = blocked ? (mode.actions.find((action) => action.disabledReason)?.disabledReason ?? '') : '';\n return {\n name: source?.name ?? mode.label.toLowerCase(),\n id: mode.id,\n keys: source?.keys ?? '',\n availability: blocked && !on ? 'unavailable' : on ? 'on' : 'off',\n ...(source?.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: mode.detail ?? (mode.activation === 'activating' ? 'activating' : ''),\n unavailableReason: reason,\n };\n });\n const seen = new Set(rows.map((row) => row.name));\n for (const source of sources) {\n if (source.hideWhenMissing === true || (source.desktopOnly && !isDesktopClient())) continue;\n if (!seen.has(source.name)) {\n rows.push({\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable',\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: 'No package in this session registers this mode.',\n });\n }\n }\n return rows;\n}\n\nexport function minorModes(\n statuses: Record<string, string>,\n widgets: readonly string[],\n projection: MinorModeProjection | null = null,\n): MinorMode[] {\n const declared = pluginMinorModes();\n const sources: readonly MinorModeSource[] = declared.length > 0 ? declared : PACKAGED_MINOR_MODES;\n if (projection) return catalogMinorModes(sources, projection);\n return sources.flatMap((source) => {\n if (source.desktopOnly && !isDesktopClient()) return [];\n if (source.statusKey !== undefined) {\n const raw = statuses[source.statusKey];\n if (raw === undefined) {\n if (source.hideWhenMissing === true) return [];\n return [\n {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n },\n ];\n }\n const detail = stripAnsi(raw).trim();\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: detail ? ('on' as const) : ('off' as const),\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail,\n unavailableReason: '',\n };\n }\n if (source.widgetKey !== undefined && widgets.includes(source.widgetKey)) {\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'off' as const,\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: '',\n };\n }\n return {\n name: source.name,\n id: source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n };\n });\n}\n\nexport interface ActivityGroup {\n name: string;\n keys: string;\n /** The heading visual its package declares; the dock draws a generic one without it. */\n icon?: ActivityGroupContribution['icon'];\n /** What the publishing extension is reporting, empty when it reports nothing. */\n summary: string;\n active: boolean;\n marksBackgroundWork?: boolean;\n /** The temporary tab the group's name opens, when its package declares one. */\n transientTab?: () => TransientTab;\n /** Keeps the group visible below the dock's scrolling ordinary groups. */\n placement?: 'bottom';\n}\n\n/** Subscribe to package-owned activity sources, rewiring when the focused composition changes. */\nexport function subscribeActivitySources(listener: () => void): () => void {\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginActivityGroups().flatMap((source) =>\n source.activeSource === undefined ? [] : [source.activeSource.subscribe(listener)],\n );\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activitySourceFingerprint(sessionId: string | null): string {\n const activeSources = pluginActivityGroups()\n .map((source) => (source.activeSource?.isActive(sessionId) === true ? '1' : '0'))\n .join('');\n return `${webPluginRegistryRevision()}:${activeSources}`;\n}\n\n/**\n * The groups available in this plugin composition. Status and widget signals\n * reveal legacy groups. A package-owned active source also reveals its group,\n * including while idle, so the section can remain a stable launcher unless it\n * opts into `hideWhenEmpty`.\n *\n * A group that declared `hideWhenEmpty` goes away once its session stops\n * reporting. Clearing a status reaches the page as an empty string rather than\n * an absent key, because the same map tells the selection bar which minor modes\n * exist and an absent key means \"not reported\" there. Emptiness is read here,\n * where only the dock is looking.\n */\nexport function activityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null = null,\n): ActivityGroup[] {\n const groups: ActivityGroup[] = [];\n for (const source of pluginActivityGroups()) {\n const tab = source.transientTab === undefined ? {} : { transientTab: source.transientTab };\n const placement = {\n ...(source.placement === undefined ? {} : { placement: source.placement }),\n ...(source.marksBackgroundWork === false ? { marksBackgroundWork: false } : {}),\n ...(source.icon === undefined ? {} : { icon: source.icon }),\n };\n if (source.statusKey !== undefined && statuses[source.statusKey] !== undefined) {\n const summary = stripAnsi(statuses[source.statusKey] ?? '').trim();\n const active =\n source.activeSource?.isActive(sessionId) ?? (source.marksBackgroundWork !== false && summary.length > 0);\n if (summary.length === 0 && source.hideWhenEmpty === true && !active) continue;\n groups.push({ name: source.name, keys: source.keys, summary, active, ...tab, ...placement });\n continue;\n }\n if (source.widgetKeys !== undefined && source.widgetKeys.some((key) => widgets.includes(key))) {\n const activeKeys = source.activeWidgetKeys ?? source.widgetKeys;\n const active =\n source.activeSource?.isActive(sessionId) ??\n (source.marksBackgroundWork !== false && activeKeys.some((key) => widgets.includes(key)));\n groups.push({ name: source.name, keys: source.keys, summary: '', active, ...tab, ...placement });\n continue;\n }\n if (source.activeSource !== undefined) {\n const active = source.activeSource.isActive(sessionId);\n if (source.hideWhenEmpty === true && !active) continue;\n groups.push({\n name: source.name,\n keys: source.keys,\n summary: '',\n active,\n ...tab,\n ...placement,\n });\n }\n }\n return groups;\n}\n\n/** Dock faces update when the active session composition changes. */\nexport function useDockFaces(sessionId: string | null): readonly DockFaceContribution[] {\n useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision, webPluginRegistryRevision);\n const subscribe = (listener: () => void) => {\n const releases = pluginDockFaces().flatMap((face) =>\n face.visibility ? [face.visibility.subscribe(listener)] : [],\n );\n return () => releases.forEach((release) => release());\n };\n const snapshot = () =>\n pluginDockFaces()\n .map((face) => (face.visibility?.isVisible(sessionId) !== false ? '1' : '0'))\n .join('');\n useSyncExternalStore(subscribe, snapshot, snapshot);\n return pluginDockFaces().filter((face) => face.visibility?.isVisible(sessionId) !== false);\n}\n\nexport interface DockAutoSelectKeys {\n /** Every session face already chosen, so returning to a session leaves the user's pick alone. */\n sessions: readonly string[];\n /** The last tab face chosen, so only entering a matching tab selects it again. */\n tab: string;\n}\n\n/** Chooses the first newly eligible tab face, then the first session face not yet chosen. */\nexport function autoSelectedDockFace(\n faces: readonly DockFaceContribution[],\n context: { sessionId: string | null; tabId: string | null },\n previous: DockAutoSelectKeys,\n): { face: DockFaceContribution | undefined; keys: DockAutoSelectKeys } {\n const sessionFace = faces.find((face) => face.autoSelect === true);\n const tabFace = faces.find((face) => typeof face.autoSelect === 'function' && face.autoSelect(context));\n const sessionKey = sessionFace === undefined ? '' : `${context.sessionId}:${sessionFace.id}`;\n const freshSession = sessionKey !== '' && !previous.sessions.includes(sessionKey);\n const keys = {\n sessions: freshSession ? [...previous.sessions, sessionKey] : previous.sessions,\n tab: tabFace === undefined ? '' : `${context.sessionId}:${context.tabId}:${tabFace.id}`,\n };\n const face = tabFace !== undefined && keys.tab !== previous.tab ? tabFace : freshSession ? sessionFace : undefined;\n return { face, keys };\n}\n\n/** Activity groups that update when either host signals or a plugin's session store changes. */\nexport function useActivityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null,\n): ActivityGroup[] {\n useSyncExternalStore(\n subscribeActivitySources,\n () => activitySourceFingerprint(sessionId),\n () => activitySourceFingerprint(sessionId),\n );\n return activityGroups(statuses, widgets, sessionId);\n}\n\n/** The tab one path opens, or undefined when no installed plugin recognises it. */\nexport type FileLinkResolver = (path: string) => TransientTab | undefined;\n\ninterface FileLinkModes {\n active(sessionId: string | null): readonly string[];\n subscribe(sessionId: string | null, listener: () => void): () => void;\n}\nlet fileLinkModes: FileLinkModes | undefined;\nconst modeBindings = new Set<() => void>();\n\n/** Binds host session facts without making the composition library own session state. */\nexport function bindFileLinkModes(source: FileLinkModes): () => void {\n fileLinkModes = source;\n modeBindings.forEach((listener) => listener());\n return () => {\n if (fileLinkModes !== source) return;\n fileLinkModes = undefined;\n modeBindings.forEach((listener) => listener());\n };\n}\nfunction subscribeFileLinks(sessionId: string | null, listener: () => void): () => void {\n let unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n const rebindModes = () => {\n unsubscribeModes?.();\n unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n listener();\n };\n modeBindings.add(rebindModes);\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginFileLinks().map((source) => source.subscribe(listener));\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n modeBindings.delete(rebindModes);\n unsubscribeModes?.();\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activeFileLinkSources(sessionId: string | null) {\n const enabled = new Set(fileLinkModes?.active(sessionId) ?? []);\n return pluginFileLinks(sessionId).filter(\n (source) => source.requiredMinorMode === undefined || enabled.has(source.requiredMinorMode),\n );\n}\n\nfunction fileLinkFingerprint(sessionId: string | null): string {\n const sourceFingerprints = activeFileLinkSources(sessionId)\n .map((source) => `${source.requiredMinorMode ?? ''}:${source.fingerprint(sessionId)}`)\n .join('\\n');\n return `${webPluginRegistryRevision()}:${sourceFingerprints}`;\n}\n\n/**\n * The tab a path opens, from the first source that claims it.\n *\n * A path no source claims is not a link. The host cannot tell a file name from\n * a class name, and the plugin that tracks the session's files can, so the\n * decision belongs there rather than in a heuristic here.\n */\nexport function fileLinkFor(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n\n/**\n * The tab a path the caller is sure about opens: a tool call's path argument,\n * not a token spotted in prose.\n *\n * A source that offers `openPath` answers here, and it may claim a file the\n * session never changed, which `resolve` deliberately will not. Sources\n * without it fall back to the same guess prose gets.\n */\nexport function fileTabForPath(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.openPath?.(sessionId, path) ?? source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n/**\n * Resolves the paths a message names against the plugins that track them.\n *\n * The resolver's identity is stable while the linkable set is, so a component\n * that hands it to a renderer does not rebuild that renderer on every frame of\n * a streaming reply.\n */\nexport function useFileLinks(sessionId: string | null): FileLinkResolver {\n const fingerprint = useSyncExternalStore(\n useCallback((listener: () => void) => subscribeFileLinks(sessionId, listener), [sessionId]),\n () => fileLinkFingerprint(sessionId),\n () => fileLinkFingerprint(sessionId),\n );\n return useCallback(\n (path: string) => fileLinkFor(sessionId, path),\n // The fingerprint is the dependency: the same path resolves differently\n // once the session's set of tracked files changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps -- fingerprint is a deliberate identity buster, not a value the callback reads.\n [sessionId, fingerprint],\n );\n}\n"],"mappings":";;;;AA8BA,MAAM,sBAAsB;;;;;;;AAQ5B,MAAa,0BAAgE,CAC3E;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAc,YAAY;CAAc,OAAO;AAAG,GACpG;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAa,YAAY;CAAc,OAAO;CAAM,OAAO;AAAG,CAClH;;;;;;AAOA,SAAgB,cAAc,UAAmD;CAC/E,MAAM,WAAWA,uBAAAA,oBAAoB;CAErC,QADsD,SAAS,SAAS,IAAI,WAAW,wBAAA,CACxE,SAAS,WAAW;EACjC,MAAM,MAAM,SAAS,OAAO;EAC5B,IAAI,QAAQ,KAAA,GAAW,OAAO,CAAC;EAC/B,MAAM,QAAQ,OAAO,UAAU;EAC/B,MAAM,UAAU,QAAQC,mBAAAA,UAAU,GAAG,CAAC,CAAC,MAAM,mBAAmB,IAAI,CAACA,mBAAAA,UAAU,GAAG,CAAC,EAAA,CAChF,KAAK,UAAU,MAAM,KAAK,CAAC,CAAC,CAC5B,OAAO,OAAO;EACjB,OAAO,CAAC;GAAE,MAAM,OAAO;GAAM,SAAS,OAAO;GAAS;GAAQ,YAAY,OAAO;GAAY;EAAM,CAAC;CACtG,CAAC;AACH;;;;;;;;;;;AAgDA,MAAa,uBAAmD;CAC9D;EAAE,MAAM;EAAQ,MAAM;CAAM;CAC5B;EAAE,MAAM;EAAQ,MAAM;EAAO,WAAW;CAAY;CACpD;EAAE,MAAM;EAAQ,MAAM;EAAO,WAAW;CAAU;CAClD;EAAE,MAAM;EAAQ,MAAM;EAAO,WAAW;CAAO;CAC/C;EAAE,MAAM;EAAU,MAAM;CAAM;CAC9B;EAAE,MAAM;EAAY,MAAM;EAAO,WAAW;CAAwB;CAEpE;EAAE,MAAM;EAAS,QAAQ;EAAc,MAAM;EAAO,WAAW;CAAW;CAC1E;EACE,MAAM;EAC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BAAgB,SAAS,CAAC,CAAC,QAC/B,WAAW,OAAO,sBAAsB,KAAA,KAAa,QAAQ,IAAI,OAAO,iBAAiB,CAC5F;AACF;AAEA,SAAS,oBAAoB,WAAkC;CAC7D,MAAM,qBAAqB,sBAAsB,SAAS,CAAC,CACxD,KAAK,WAAW,GAAG,OAAO,qBAAqB,GAAG,GAAG,OAAO,YAAY,SAAS,GAAG,CAAC,CACrF,KAAK,IAAI;CACZ,OAAO,GAAGF,uBAAAA,0BAA0B,EAAE,GAAG;AAC3C;;;;;;;;AASA,SAAgB,YAAY,WAA0B,MAAwC;CAC5F,KAAK,MAAM,UAAU,sBAAsB,SAAS,GAAG;EACrD,MAAM,MAAM,OAAO,QAAQ,WAAW,IAAI;EAC1C,IAAI,QAAQ,KAAA,GAAW,OAAO;CAChC;AAEF;;;;;;;;;AAUA,SAAgB,eAAe,WAA0B,MAAwC;CAC/F,KAAK,MAAM,UAAU,sBAAsB,SAAS,GAAG;EACrD,MAAM,MAAM,OAAO,WAAW,WAAW,IAAI,KAAK,OAAO,QAAQ,WAAW,IAAI;EAChF,IAAI,QAAQ,KAAA,GAAW,OAAO;CAChC;AAEF;;;;;;;;AAQA,SAAgB,aAAa,WAA4C;CACvE,MAAM,eAAA,GAAcG,MAAAA,qBAAAA,EAAAA,GAClBC,MAAAA,YAAAA,EAAa,aAAyB,mBAAmB,WAAW,QAAQ,GAAG,CAAC,SAAS,CAAC,SACpF,oBAAoB,SAAS,SAC7B,oBAAoB,SAAS,CACrC;CACA,QAAA,GAAOA,MAAAA,YAAAA,EACJ,SAAiB,YAAY,WAAW,IAAI,GAI7C,CAAC,WAAW,WAAW,CACzB;AACF"}
@@ -98,6 +98,20 @@ export declare function subscribeActivitySources(listener: () => void): () => vo
98
98
  export declare function activityGroups(statuses: Record<string, string>, widgets: readonly string[], sessionId?: string | null): ActivityGroup[];
99
99
  /** Dock faces update when the active session composition changes. */
100
100
  export declare function useDockFaces(sessionId: string | null): readonly DockFaceContribution[];
101
+ export interface DockAutoSelectKeys {
102
+ /** Every session face already chosen, so returning to a session leaves the user's pick alone. */
103
+ sessions: readonly string[];
104
+ /** The last tab face chosen, so only entering a matching tab selects it again. */
105
+ tab: string;
106
+ }
107
+ /** Chooses the first newly eligible tab face, then the first session face not yet chosen. */
108
+ export declare function autoSelectedDockFace(faces: readonly DockFaceContribution[], context: {
109
+ sessionId: string | null;
110
+ tabId: string | null;
111
+ }, previous: DockAutoSelectKeys): {
112
+ face: DockFaceContribution | undefined;
113
+ keys: DockAutoSelectKeys;
114
+ };
101
115
  /** Activity groups that update when either host signals or a plugin's session store changes. */
102
116
  export declare function useActivityGroups(statuses: Record<string, string>, widgets: readonly string[], sessionId: string | null): ActivityGroup[];
103
117
  /** The tab one path opens, or undefined when no installed plugin recognises it. */
@@ -134,4 +148,5 @@ export declare function fileTabForPath(sessionId: string | null, path: string):
134
148
  */
135
149
  export declare function useFileLinks(sessionId: string | null): FileLinkResolver;
136
150
  //#endregion
151
+ export {};
137
152
  //# sourceMappingURL=composition.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"composition.d.mts","names":[],"sources":["../../../src/web/lib/composition.ts"],"mappings":";;;iBAqBiB;EACf;EACA;;EAEA;EACA;EACA;;;;;;;;qBAWW,kCAAkC;;;;;;wBAU/B,cAAc,UAAU,yBAAyB;YAcrD;iBAEK;EACf;;EAEA;;EAEA;EACA,cAAc;;EAEd;;EAEA;;;;;;;EAOA;;iBAGe;EACf;;EAEA;;EAEA;;EAEA;EACA;EACA;EACA;EACA;;;;;;;;;;;;qBAaW,+BAA+B;wBAwE5B,WACd,UAAU,wBACV,4BACA,aAAY,6BACX;iBAwDc;EACf;EACA;;EAEA,OAAO;;EAEP;EACA;EACA;;EAEA,qBAAqB;;EAErB;;;wBAIc,yBAAyB;;;;;;;;;;;;;wBA0CzB,eACd,UAAU,wBACV,4BACA,4BACC;;wBA0Ca,aAAa,oCAAoC;;wBAiBjD,kBACd,UAAU,wBACV,4BACA,2BACC;;YAUS,oBAAoB,iBAAiB;UAEvC;EACR,OAAO;EACP,UAAU,0BAA0B;;;wBAMtB,kBAAkB,QAAQ;;;;;;;;wBA4D1B,YAAY,0BAA0B,eAAe;;;;;;;;;wBAgBrD,eAAe,0BAA0B,eAAe;;;;;;;;wBAcxD,aAAa,2BAA2B"}
1
+ {"version":3,"file":"composition.d.mts","names":[],"sources":["../../../src/web/lib/composition.ts"],"mappings":";;;iBAqBiB;EACf;EACA;;EAEA;EACA;EACA;;;;;;;;qBAWW,kCAAkC;;;;;;wBAU/B,cAAc,UAAU,yBAAyB;YAcrD;iBAEK;EACf;;EAEA;;EAEA;EACA,cAAc;;EAEd;;EAEA;;;;;;;EAOA;;iBAGe;EACf;;EAEA;;EAEA;;EAEA;EACA;EACA;EACA;EACA;;;;;;;;;;;;qBAaW,+BAA+B;wBAwE5B,WACd,UAAU,wBACV,4BACA,aAAY,6BACX;iBAwDc;EACf;EACA;;EAEA,OAAO;;EAEP;EACA;EACA;;EAEA,qBAAqB;;EAErB;;;wBAIc,yBAAyB;;;;;;;;;;;;;wBA0CzB,eACd,UAAU,wBACV,4BACA,4BACC;;wBA0Ca,aAAa,oCAAoC;iBAgBhD;;EAEf;;EAEA;;;wBAIc,qBACd,gBAAgB,wBAChB;EAAW;EAA0B;GACrC,UAAU;EACP,MAAM;EAAkC,MAAM;;;wBAcnC,kBACd,UAAU,wBACV,4BACA,2BACC;;YAUS,oBAAoB,iBAAiB;UAEvC;EACR,OAAO;EACP,UAAU,0BAA0B;;;wBAMtB,kBAAkB,QAAQ;;;;;;;;wBA4D1B,YAAY,0BAA0B,eAAe;;;;;;;;;wBAgBrD,eAAe,0BAA0B,eAAe;;;;;;;;wBAcxD,aAAa,2BAA2B"}
@@ -12,13 +12,13 @@ const AXIS_LIST_SEPARATOR = ",";
12
12
  const PACKAGED_SELECTION_AXES = [{
13
13
  name: "profile",
14
14
  command: "profile",
15
- statusKey: "doom-profile",
15
+ statusKey: "po-profile",
16
16
  emptyLabel: "no profile",
17
17
  order: 10
18
18
  }, {
19
19
  name: "domains",
20
20
  command: "domains",
21
- statusKey: "doom-domain",
21
+ statusKey: "po-domain",
22
22
  emptyLabel: "no domains",
23
23
  multi: true,
24
24
  order: 20
@@ -67,7 +67,7 @@ const PACKAGED_MINOR_MODES = [
67
67
  {
68
68
  name: "loop",
69
69
  keys: "l l",
70
- statusKey: "doom-loop"
70
+ statusKey: "po-loop"
71
71
  },
72
72
  {
73
73
  name: "goal",
@@ -87,13 +87,13 @@ const PACKAGED_MINOR_MODES = [
87
87
  name: "voice",
88
88
  modeId: "voice-auto",
89
89
  keys: "v e",
90
- statusKey: "doom-voice"
90
+ statusKey: "po-voice"
91
91
  },
92
92
  {
93
93
  name: "computer use",
94
94
  modeId: "computer-use",
95
95
  keys: "c e",
96
- statusKey: "doom-computer-use-mode",
96
+ statusKey: "po-computer-use-mode",
97
97
  hideWhenMissing: true,
98
98
  desktopOnly: true
99
99
  }
@@ -294,6 +294,21 @@ function useDockFaces(sessionId) {
294
294
  useSyncExternalStore(subscribe, snapshot, snapshot);
295
295
  return pluginDockFaces().filter((face) => face.visibility?.isVisible(sessionId) !== false);
296
296
  }
297
+ /** Chooses the first newly eligible tab face, then the first session face not yet chosen. */
298
+ function autoSelectedDockFace(faces, context, previous) {
299
+ const sessionFace = faces.find((face) => face.autoSelect === true);
300
+ const tabFace = faces.find((face) => typeof face.autoSelect === "function" && face.autoSelect(context));
301
+ const sessionKey = sessionFace === void 0 ? "" : `${context.sessionId}:${sessionFace.id}`;
302
+ const freshSession = sessionKey !== "" && !previous.sessions.includes(sessionKey);
303
+ const keys = {
304
+ sessions: freshSession ? [...previous.sessions, sessionKey] : previous.sessions,
305
+ tab: tabFace === void 0 ? "" : `${context.sessionId}:${context.tabId}:${tabFace.id}`
306
+ };
307
+ return {
308
+ face: tabFace !== void 0 && keys.tab !== previous.tab ? tabFace : freshSession ? sessionFace : void 0,
309
+ keys
310
+ };
311
+ }
297
312
  /** Activity groups that update when either host signals or a plugin's session store changes. */
298
313
  function useActivityGroups(statuses, widgets, sessionId) {
299
314
  useSyncExternalStore(subscribeActivitySources, () => activitySourceFingerprint(sessionId), () => activitySourceFingerprint(sessionId));
@@ -387,6 +402,6 @@ function useFileLinks(sessionId) {
387
402
  return useCallback((path) => fileLinkFor(sessionId, path), [sessionId, fingerprint]);
388
403
  }
389
404
  //#endregion
390
- export { PACKAGED_MINOR_MODES, PACKAGED_SELECTION_AXES, activityGroups, bindFileLinkModes, fileLinkFor, fileTabForPath, minorModes, selectionAxes, subscribeActivitySources, useActivityGroups, useDockFaces, useFileLinks };
405
+ export { PACKAGED_MINOR_MODES, PACKAGED_SELECTION_AXES, activityGroups, autoSelectedDockFace, bindFileLinkModes, fileLinkFor, fileTabForPath, minorModes, selectionAxes, subscribeActivitySources, useActivityGroups, useDockFaces, useFileLinks };
391
406
 
392
407
  //# sourceMappingURL=composition.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"composition.mjs","names":[],"sources":["../../../src/web/lib/composition.ts"],"sourcesContent":["import type {\n ActivityGroupContribution,\n DockFaceContribution,\n SelectionAxisContribution,\n TransientTab,\n} from '@agimon-ai/po-core/web';\nimport { useCallback, useSyncExternalStore } from 'react';\n\nimport type { MinorModeProjection, MinorModeRecordProjection } from '../../types/hub';\nimport {\n isDesktopClient,\n pluginActivityGroups,\n pluginDockFaces,\n pluginFileLinks,\n pluginMinorModes,\n pluginSelectionAxes,\n subscribeWebPluginRegistry,\n webPluginRegistryRevision,\n} from './pluginRegistry';\nimport { stripAnsi } from './statusLine';\n\nexport interface SelectionAxis {\n name: string;\n command: string;\n /** The current selections, empty while the session reports none; one at most unless multi. */\n values: string[];\n emptyLabel: string;\n multi: boolean;\n}\n\nconst AXIS_LIST_SEPARATOR = ',';\n\n/**\n * The fallback axis table for the packaged bundle; a synced bundle carries\n * each axis as its owning package's plugin declaration, and the registry\n * list wins whenever any plugin declares one. Exported only so the workspace\n * composition test can hold it equal to what the packages declare.\n */\nexport const PACKAGED_SELECTION_AXES: readonly SelectionAxisContribution[] = [\n { name: 'profile', command: 'profile', statusKey: 'doom-profile', emptyLabel: 'no profile', order: 10 },\n { name: 'domains', command: 'domains', statusKey: 'doom-domain', emptyLabel: 'no domains', multi: true, order: 20 },\n];\n\n/**\n * The declared axes the session actually offers: an axis whose status key\n * the session never published stays off the bar entirely, which is how a\n * package withholds its axis when there is nothing to select.\n */\nexport function selectionAxes(statuses: Record<string, string>): SelectionAxis[] {\n const declared = pluginSelectionAxes();\n const sources: readonly SelectionAxisContribution[] = declared.length > 0 ? declared : PACKAGED_SELECTION_AXES;\n return sources.flatMap((source) => {\n const raw = statuses[source.statusKey];\n if (raw === undefined) return [];\n const multi = source.multi === true;\n const values = (multi ? stripAnsi(raw).split(AXIS_LIST_SEPARATOR) : [stripAnsi(raw)])\n .map((value) => value.trim())\n .filter(Boolean);\n return [{ name: source.name, command: source.command, values, emptyLabel: source.emptyLabel, multi }];\n });\n}\n\nexport type MinorModeAvailability = 'unavailable' | 'off' | 'on';\n\nexport interface MinorMode {\n name: string;\n /** The catalog id /minor accepts; the display name until the catalog reports. */\n id: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n availability: MinorModeAvailability;\n /** What the mode itself is reporting while on. */\n detail: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n /**\n * Why the mode cannot be driven from here, in the words of the mode itself.\n * Empty when it can. A mode may be installed and still refuse a cockpit:\n * autonomous voice captures from the terminal's own microphone, which a\n * browser talking to a headless agent does not have.\n */\n unavailableReason: string;\n}\n\nexport interface MinorModeSource {\n name: string;\n /** The catalog mode this row drives, when the runtime registers it under another id. */\n modeId?: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n statusKey?: string;\n widgetKey?: string;\n hideWhenMissing?: boolean;\n desktopOnly?: boolean;\n}\n\n/**\n * The fallback minor-mode table for the packaged bundle.\n *\n * A synced bundle carries each mode as its package's own web plugin\n * contribution, and the registry list wins whenever any plugin declares one.\n * This literal survives only so the built-in-only bundle keeps rendering the\n * modes Po ships; help is listed without a signal on purpose: it\n * registers no footer entry, so the cockpit reports it as unavailable rather\n * than guessing it is off. Exported only for the workspace composition test.\n */\nexport const PACKAGED_MINOR_MODES: readonly MinorModeSource[] = [\n { name: 'help', keys: 'h e' },\n { name: 'plan', keys: 'p e', statusKey: 'plan-mode' },\n { name: 'loop', keys: 'l l', statusKey: 'doom-loop' },\n { name: 'goal', keys: 'g e', statusKey: 'goal' },\n { name: 'author', keys: 'o a' },\n { name: 'workflow', keys: 'w e', widgetKey: 'workflow-mcp-progress' },\n // `v e` drives autonomous capture, which the runtime registers as 'voice-auto'.\n { name: 'voice', modeId: 'voice-auto', keys: 'v e', statusKey: 'doom-voice' },\n {\n name: 'computer use',\n modeId: 'computer-use',\n keys: 'c e',\n statusKey: 'doom-computer-use-mode',\n hideWhenMissing: true,\n desktopOnly: true,\n },\n];\n\n/** The declared source a catalog mode corresponds to, by id, id stem, or label. */\nfunction sourceFor(sources: readonly MinorModeSource[], mode: MinorModeRecordProjection): MinorModeSource | undefined {\n const candidates = new Set([mode.id.toLowerCase(), mode.id.toLowerCase().split('.')[0], mode.label.toLowerCase()]);\n return sources.find((source) =>\n [source.name, source.modeId].some((identity) => identity !== undefined && candidates.has(identity.toLowerCase())),\n );\n}\n\n/**\n * Catalog-backed rows: the runtime's own activation state per mode, with the\n * declared leader keys attached where a plugin documents them. Declared modes\n * the catalog does not know are still listed, as unavailable, so a mode that\n * is missing from a composition stays visible rather than silently gone.\n */\nfunction catalogMinorModes(sources: readonly MinorModeSource[], projection: MinorModeProjection): MinorMode[] {\n const rows: MinorMode[] = projection.modes\n .filter((mode) => !sourceFor(sources, mode)?.desktopOnly || isDesktopClient())\n .map((mode) => {\n const source = sourceFor(sources, mode);\n const on = mode.activation === 'active' || mode.activation === 'deactivating';\n // The catalog says per action whether it can run here and why not. A mode\n // with nothing runnable is offered as a row that cannot be clicked rather\n // than one that answers \"no actions available\" after the fact.\n const blocked = mode.actions.length > 0 && mode.actions.every((action) => !action.enabled);\n const reason = blocked ? (mode.actions.find((action) => action.disabledReason)?.disabledReason ?? '') : '';\n return {\n name: source?.name ?? mode.label.toLowerCase(),\n id: mode.id,\n keys: source?.keys ?? '',\n availability: blocked && !on ? 'unavailable' : on ? 'on' : 'off',\n ...(source?.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: mode.detail ?? (mode.activation === 'activating' ? 'activating' : ''),\n unavailableReason: reason,\n };\n });\n const seen = new Set(rows.map((row) => row.name));\n for (const source of sources) {\n if (source.hideWhenMissing === true || (source.desktopOnly && !isDesktopClient())) continue;\n if (!seen.has(source.name)) {\n rows.push({\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable',\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: 'No package in this session registers this mode.',\n });\n }\n }\n return rows;\n}\n\nexport function minorModes(\n statuses: Record<string, string>,\n widgets: readonly string[],\n projection: MinorModeProjection | null = null,\n): MinorMode[] {\n const declared = pluginMinorModes();\n const sources: readonly MinorModeSource[] = declared.length > 0 ? declared : PACKAGED_MINOR_MODES;\n if (projection) return catalogMinorModes(sources, projection);\n return sources.flatMap((source) => {\n if (source.desktopOnly && !isDesktopClient()) return [];\n if (source.statusKey !== undefined) {\n const raw = statuses[source.statusKey];\n if (raw === undefined) {\n if (source.hideWhenMissing === true) return [];\n return [\n {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n },\n ];\n }\n const detail = stripAnsi(raw).trim();\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: detail ? ('on' as const) : ('off' as const),\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail,\n unavailableReason: '',\n };\n }\n if (source.widgetKey !== undefined && widgets.includes(source.widgetKey)) {\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'off' as const,\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: '',\n };\n }\n return {\n name: source.name,\n id: source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n };\n });\n}\n\nexport interface ActivityGroup {\n name: string;\n keys: string;\n /** The heading visual its package declares; the dock draws a generic one without it. */\n icon?: ActivityGroupContribution['icon'];\n /** What the publishing extension is reporting, empty when it reports nothing. */\n summary: string;\n active: boolean;\n marksBackgroundWork?: boolean;\n /** The temporary tab the group's name opens, when its package declares one. */\n transientTab?: () => TransientTab;\n /** Keeps the group visible below the dock's scrolling ordinary groups. */\n placement?: 'bottom';\n}\n\n/** Subscribe to package-owned activity sources, rewiring when the focused composition changes. */\nexport function subscribeActivitySources(listener: () => void): () => void {\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginActivityGroups().flatMap((source) =>\n source.activeSource === undefined ? [] : [source.activeSource.subscribe(listener)],\n );\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activitySourceFingerprint(sessionId: string | null): string {\n const activeSources = pluginActivityGroups()\n .map((source) => (source.activeSource?.isActive(sessionId) === true ? '1' : '0'))\n .join('');\n return `${webPluginRegistryRevision()}:${activeSources}`;\n}\n\n/**\n * The groups available in this plugin composition. Status and widget signals\n * reveal legacy groups. A package-owned active source also reveals its group,\n * including while idle, so the section can remain a stable launcher unless it\n * opts into `hideWhenEmpty`.\n *\n * A group that declared `hideWhenEmpty` goes away once its session stops\n * reporting. Clearing a status reaches the page as an empty string rather than\n * an absent key, because the same map tells the selection bar which minor modes\n * exist and an absent key means \"not reported\" there. Emptiness is read here,\n * where only the dock is looking.\n */\nexport function activityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null = null,\n): ActivityGroup[] {\n const groups: ActivityGroup[] = [];\n for (const source of pluginActivityGroups()) {\n const tab = source.transientTab === undefined ? {} : { transientTab: source.transientTab };\n const placement = {\n ...(source.placement === undefined ? {} : { placement: source.placement }),\n ...(source.marksBackgroundWork === false ? { marksBackgroundWork: false } : {}),\n ...(source.icon === undefined ? {} : { icon: source.icon }),\n };\n if (source.statusKey !== undefined && statuses[source.statusKey] !== undefined) {\n const summary = stripAnsi(statuses[source.statusKey] ?? '').trim();\n const active =\n source.activeSource?.isActive(sessionId) ?? (source.marksBackgroundWork !== false && summary.length > 0);\n if (summary.length === 0 && source.hideWhenEmpty === true && !active) continue;\n groups.push({ name: source.name, keys: source.keys, summary, active, ...tab, ...placement });\n continue;\n }\n if (source.widgetKeys !== undefined && source.widgetKeys.some((key) => widgets.includes(key))) {\n const activeKeys = source.activeWidgetKeys ?? source.widgetKeys;\n const active =\n source.activeSource?.isActive(sessionId) ??\n (source.marksBackgroundWork !== false && activeKeys.some((key) => widgets.includes(key)));\n groups.push({ name: source.name, keys: source.keys, summary: '', active, ...tab, ...placement });\n continue;\n }\n if (source.activeSource !== undefined) {\n const active = source.activeSource.isActive(sessionId);\n if (source.hideWhenEmpty === true && !active) continue;\n groups.push({\n name: source.name,\n keys: source.keys,\n summary: '',\n active,\n ...tab,\n ...placement,\n });\n }\n }\n return groups;\n}\n\n/** Dock faces update when the active session composition changes. */\nexport function useDockFaces(sessionId: string | null): readonly DockFaceContribution[] {\n useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision, webPluginRegistryRevision);\n const subscribe = (listener: () => void) => {\n const releases = pluginDockFaces().flatMap((face) =>\n face.visibility ? [face.visibility.subscribe(listener)] : [],\n );\n return () => releases.forEach((release) => release());\n };\n const snapshot = () =>\n pluginDockFaces()\n .map((face) => (face.visibility?.isVisible(sessionId) !== false ? '1' : '0'))\n .join('');\n useSyncExternalStore(subscribe, snapshot, snapshot);\n return pluginDockFaces().filter((face) => face.visibility?.isVisible(sessionId) !== false);\n}\n\n/** Activity groups that update when either host signals or a plugin's session store changes. */\nexport function useActivityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null,\n): ActivityGroup[] {\n useSyncExternalStore(\n subscribeActivitySources,\n () => activitySourceFingerprint(sessionId),\n () => activitySourceFingerprint(sessionId),\n );\n return activityGroups(statuses, widgets, sessionId);\n}\n\n/** The tab one path opens, or undefined when no installed plugin recognises it. */\nexport type FileLinkResolver = (path: string) => TransientTab | undefined;\n\ninterface FileLinkModes {\n active(sessionId: string | null): readonly string[];\n subscribe(sessionId: string | null, listener: () => void): () => void;\n}\nlet fileLinkModes: FileLinkModes | undefined;\nconst modeBindings = new Set<() => void>();\n\n/** Binds host session facts without making the composition library own session state. */\nexport function bindFileLinkModes(source: FileLinkModes): () => void {\n fileLinkModes = source;\n modeBindings.forEach((listener) => listener());\n return () => {\n if (fileLinkModes !== source) return;\n fileLinkModes = undefined;\n modeBindings.forEach((listener) => listener());\n };\n}\nfunction subscribeFileLinks(sessionId: string | null, listener: () => void): () => void {\n let unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n const rebindModes = () => {\n unsubscribeModes?.();\n unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n listener();\n };\n modeBindings.add(rebindModes);\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginFileLinks().map((source) => source.subscribe(listener));\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n modeBindings.delete(rebindModes);\n unsubscribeModes?.();\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activeFileLinkSources(sessionId: string | null) {\n const enabled = new Set(fileLinkModes?.active(sessionId) ?? []);\n return pluginFileLinks(sessionId).filter(\n (source) => source.requiredMinorMode === undefined || enabled.has(source.requiredMinorMode),\n );\n}\n\nfunction fileLinkFingerprint(sessionId: string | null): string {\n const sourceFingerprints = activeFileLinkSources(sessionId)\n .map((source) => `${source.requiredMinorMode ?? ''}:${source.fingerprint(sessionId)}`)\n .join('\\n');\n return `${webPluginRegistryRevision()}:${sourceFingerprints}`;\n}\n\n/**\n * The tab a path opens, from the first source that claims it.\n *\n * A path no source claims is not a link. The host cannot tell a file name from\n * a class name, and the plugin that tracks the session's files can, so the\n * decision belongs there rather than in a heuristic here.\n */\nexport function fileLinkFor(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n\n/**\n * The tab a path the caller is sure about opens: a tool call's path argument,\n * not a token spotted in prose.\n *\n * A source that offers `openPath` answers here, and it may claim a file the\n * session never changed, which `resolve` deliberately will not. Sources\n * without it fall back to the same guess prose gets.\n */\nexport function fileTabForPath(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.openPath?.(sessionId, path) ?? source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n/**\n * Resolves the paths a message names against the plugins that track them.\n *\n * The resolver's identity is stable while the linkable set is, so a component\n * that hands it to a renderer does not rebuild that renderer on every frame of\n * a streaming reply.\n */\nexport function useFileLinks(sessionId: string | null): FileLinkResolver {\n const fingerprint = useSyncExternalStore(\n useCallback((listener: () => void) => subscribeFileLinks(sessionId, listener), [sessionId]),\n () => fileLinkFingerprint(sessionId),\n () => fileLinkFingerprint(sessionId),\n );\n return useCallback(\n (path: string) => fileLinkFor(sessionId, path),\n // The fingerprint is the dependency: the same path resolves differently\n // once the session's set of tracked files changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps -- fingerprint is a deliberate identity buster, not a value the callback reads.\n [sessionId, fingerprint],\n );\n}\n"],"mappings":";;;;AA8BA,MAAM,sBAAsB;;;;;;;AAQ5B,MAAa,0BAAgE,CAC3E;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAgB,YAAY;CAAc,OAAO;AAAG,GACtG;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAe,YAAY;CAAc,OAAO;CAAM,OAAO;AAAG,CACpH;;;;;;AAOA,SAAgB,cAAc,UAAmD;CAC/E,MAAM,WAAW,oBAAoB;CAErC,QADsD,SAAS,SAAS,IAAI,WAAW,wBAAA,CACxE,SAAS,WAAW;EACjC,MAAM,MAAM,SAAS,OAAO;EAC5B,IAAI,QAAQ,KAAA,GAAW,OAAO,CAAC;EAC/B,MAAM,QAAQ,OAAO,UAAU;EAC/B,MAAM,UAAU,QAAQ,UAAU,GAAG,CAAC,CAAC,MAAM,mBAAmB,IAAI,CAAC,UAAU,GAAG,CAAC,EAAA,CAChF,KAAK,UAAU,MAAM,KAAK,CAAC,CAAC,CAC5B,OAAO,OAAO;EACjB,OAAO,CAAC;GAAE,MAAM,OAAO;GAAM,SAAS,OAAO;GAAS;GAAQ,YAAY,OAAO;GAAY;EAAM,CAAC;CACtG,CAAC;AACH;;;;;;;;;;;AAgDA,MAAa,uBAAmD;CAC9D;EAAE,MAAM;EAAQ,MAAM;CAAM;CAC5B;EAAE,MAAM;EAAQ,MAAM;EAAO,WAAW;CAAY;CACpD;EAAE,MAAM;EAAQ,MAAM;EAAO,WAAW;CAAY;CACpD;EAAE,MAAM;EAAQ,MAAM;EAAO,WAAW;CAAO;CAC/C;EAAE,MAAM;EAAU,MAAM;CAAM;CAC9B;EAAE,MAAM;EAAY,MAAM;E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E,MAAM,cAAc,qBAClB,aAAa,aAAyB,mBAAmB,WAAW,QAAQ,GAAG,CAAC,SAAS,CAAC,SACpF,oBAAoB,SAAS,SAC7B,oBAAoB,SAAS,CACrC;CACA,OAAO,aACJ,SAAiB,YAAY,WAAW,IAAI,GAI7C,CAAC,WAAW,WAAW,CACzB;AACF"}
1
+ {"version":3,"file":"composition.mjs","names":[],"sources":["../../../src/web/lib/composition.ts"],"sourcesContent":["import type {\n ActivityGroupContribution,\n DockFaceContribution,\n SelectionAxisContribution,\n TransientTab,\n} from '@agimon-ai/po-core/web';\nimport { useCallback, useSyncExternalStore } from 'react';\n\nimport type { MinorModeProjection, MinorModeRecordProjection } from '../../types/hub';\nimport {\n isDesktopClient,\n pluginActivityGroups,\n pluginDockFaces,\n pluginFileLinks,\n pluginMinorModes,\n pluginSelectionAxes,\n subscribeWebPluginRegistry,\n webPluginRegistryRevision,\n} from './pluginRegistry';\nimport { stripAnsi } from './statusLine';\n\nexport interface SelectionAxis {\n name: string;\n command: string;\n /** The current selections, empty while the session reports none; one at most unless multi. */\n values: string[];\n emptyLabel: string;\n multi: boolean;\n}\n\nconst AXIS_LIST_SEPARATOR = ',';\n\n/**\n * The fallback axis table for the packaged bundle; a synced bundle carries\n * each axis as its owning package's plugin declaration, and the registry\n * list wins whenever any plugin declares one. Exported only so the workspace\n * composition test can hold it equal to what the packages declare.\n */\nexport const PACKAGED_SELECTION_AXES: readonly SelectionAxisContribution[] = [\n { name: 'profile', command: 'profile', statusKey: 'po-profile', emptyLabel: 'no profile', order: 10 },\n { name: 'domains', command: 'domains', statusKey: 'po-domain', emptyLabel: 'no domains', multi: true, order: 20 },\n];\n\n/**\n * The declared axes the session actually offers: an axis whose status key\n * the session never published stays off the bar entirely, which is how a\n * package withholds its axis when there is nothing to select.\n */\nexport function selectionAxes(statuses: Record<string, string>): SelectionAxis[] {\n const declared = pluginSelectionAxes();\n const sources: readonly SelectionAxisContribution[] = declared.length > 0 ? declared : PACKAGED_SELECTION_AXES;\n return sources.flatMap((source) => {\n const raw = statuses[source.statusKey];\n if (raw === undefined) return [];\n const multi = source.multi === true;\n const values = (multi ? stripAnsi(raw).split(AXIS_LIST_SEPARATOR) : [stripAnsi(raw)])\n .map((value) => value.trim())\n .filter(Boolean);\n return [{ name: source.name, command: source.command, values, emptyLabel: source.emptyLabel, multi }];\n });\n}\n\nexport type MinorModeAvailability = 'unavailable' | 'off' | 'on';\n\nexport interface MinorMode {\n name: string;\n /** The catalog id /minor accepts; the display name until the catalog reports. */\n id: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n availability: MinorModeAvailability;\n /** What the mode itself is reporting while on. */\n detail: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n /**\n * Why the mode cannot be driven from here, in the words of the mode itself.\n * Empty when it can. A mode may be installed and still refuse a cockpit:\n * autonomous voice captures from the terminal's own microphone, which a\n * browser talking to a headless agent does not have.\n */\n unavailableReason: string;\n}\n\nexport interface MinorModeSource {\n name: string;\n /** The catalog mode this row drives, when the runtime registers it under another id. */\n modeId?: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n statusKey?: string;\n widgetKey?: string;\n hideWhenMissing?: boolean;\n desktopOnly?: boolean;\n}\n\n/**\n * The fallback minor-mode table for the packaged bundle.\n *\n * A synced bundle carries each mode as its package's own web plugin\n * contribution, and the registry list wins whenever any plugin declares one.\n * This literal survives only so the built-in-only bundle keeps rendering the\n * modes Po ships; help is listed without a signal on purpose: it\n * registers no footer entry, so the cockpit reports it as unavailable rather\n * than guessing it is off. Exported only for the workspace composition test.\n */\nexport const PACKAGED_MINOR_MODES: readonly MinorModeSource[] = [\n { name: 'help', keys: 'h e' },\n { name: 'plan', keys: 'p e', statusKey: 'plan-mode' },\n { name: 'loop', keys: 'l l', statusKey: 'po-loop' },\n { name: 'goal', keys: 'g e', statusKey: 'goal' },\n { name: 'author', keys: 'o a' },\n { name: 'workflow', keys: 'w e', widgetKey: 'workflow-mcp-progress' },\n // `v e` drives autonomous capture, which the runtime registers as 'voice-auto'.\n { name: 'voice', modeId: 'voice-auto', keys: 'v e', statusKey: 'po-voice' },\n {\n name: 'computer use',\n modeId: 'computer-use',\n keys: 'c e',\n statusKey: 'po-computer-use-mode',\n hideWhenMissing: true,\n desktopOnly: true,\n },\n];\n\n/** The declared source a catalog mode corresponds to, by id, id stem, or label. */\nfunction sourceFor(sources: readonly MinorModeSource[], mode: MinorModeRecordProjection): MinorModeSource | undefined {\n const candidates = new Set([mode.id.toLowerCase(), mode.id.toLowerCase().split('.')[0], mode.label.toLowerCase()]);\n return sources.find((source) =>\n [source.name, source.modeId].some((identity) => identity !== undefined && candidates.has(identity.toLowerCase())),\n );\n}\n\n/**\n * Catalog-backed rows: the runtime's own activation state per mode, with the\n * declared leader keys attached where a plugin documents them. Declared modes\n * the catalog does not know are still listed, as unavailable, so a mode that\n * is missing from a composition stays visible rather than silently gone.\n */\nfunction catalogMinorModes(sources: readonly MinorModeSource[], projection: MinorModeProjection): MinorMode[] {\n const rows: MinorMode[] = projection.modes\n .filter((mode) => !sourceFor(sources, mode)?.desktopOnly || isDesktopClient())\n .map((mode) => {\n const source = sourceFor(sources, mode);\n const on = mode.activation === 'active' || mode.activation === 'deactivating';\n // The catalog says per action whether it can run here and why not. A mode\n // with nothing runnable is offered as a row that cannot be clicked rather\n // than one that answers \"no actions available\" after the fact.\n const blocked = mode.actions.length > 0 && mode.actions.every((action) => !action.enabled);\n const reason = blocked ? (mode.actions.find((action) => action.disabledReason)?.disabledReason ?? '') : '';\n return {\n name: source?.name ?? mode.label.toLowerCase(),\n id: mode.id,\n keys: source?.keys ?? '',\n availability: blocked && !on ? 'unavailable' : on ? 'on' : 'off',\n ...(source?.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: mode.detail ?? (mode.activation === 'activating' ? 'activating' : ''),\n unavailableReason: reason,\n };\n });\n const seen = new Set(rows.map((row) => row.name));\n for (const source of sources) {\n if (source.hideWhenMissing === true || (source.desktopOnly && !isDesktopClient())) continue;\n if (!seen.has(source.name)) {\n rows.push({\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable',\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: 'No package in this session registers this mode.',\n });\n }\n }\n return rows;\n}\n\nexport function minorModes(\n statuses: Record<string, string>,\n widgets: readonly string[],\n projection: MinorModeProjection | null = null,\n): MinorMode[] {\n const declared = pluginMinorModes();\n const sources: readonly MinorModeSource[] = declared.length > 0 ? declared : PACKAGED_MINOR_MODES;\n if (projection) return catalogMinorModes(sources, projection);\n return sources.flatMap((source) => {\n if (source.desktopOnly && !isDesktopClient()) return [];\n if (source.statusKey !== undefined) {\n const raw = statuses[source.statusKey];\n if (raw === undefined) {\n if (source.hideWhenMissing === true) return [];\n return [\n {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n },\n ];\n }\n const detail = stripAnsi(raw).trim();\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: detail ? ('on' as const) : ('off' as const),\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail,\n unavailableReason: '',\n };\n }\n if (source.widgetKey !== undefined && widgets.includes(source.widgetKey)) {\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'off' as const,\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: '',\n };\n }\n return {\n name: source.name,\n id: source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...(source.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n };\n });\n}\n\nexport interface ActivityGroup {\n name: string;\n keys: string;\n /** The heading visual its package declares; the dock draws a generic one without it. */\n icon?: ActivityGroupContribution['icon'];\n /** What the publishing extension is reporting, empty when it reports nothing. */\n summary: string;\n active: boolean;\n marksBackgroundWork?: boolean;\n /** The temporary tab the group's name opens, when its package declares one. */\n transientTab?: () => TransientTab;\n /** Keeps the group visible below the dock's scrolling ordinary groups. */\n placement?: 'bottom';\n}\n\n/** Subscribe to package-owned activity sources, rewiring when the focused composition changes. */\nexport function subscribeActivitySources(listener: () => void): () => void {\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginActivityGroups().flatMap((source) =>\n source.activeSource === undefined ? [] : [source.activeSource.subscribe(listener)],\n );\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activitySourceFingerprint(sessionId: string | null): string {\n const activeSources = pluginActivityGroups()\n .map((source) => (source.activeSource?.isActive(sessionId) === true ? '1' : '0'))\n .join('');\n return `${webPluginRegistryRevision()}:${activeSources}`;\n}\n\n/**\n * The groups available in this plugin composition. Status and widget signals\n * reveal legacy groups. A package-owned active source also reveals its group,\n * including while idle, so the section can remain a stable launcher unless it\n * opts into `hideWhenEmpty`.\n *\n * A group that declared `hideWhenEmpty` goes away once its session stops\n * reporting. Clearing a status reaches the page as an empty string rather than\n * an absent key, because the same map tells the selection bar which minor modes\n * exist and an absent key means \"not reported\" there. Emptiness is read here,\n * where only the dock is looking.\n */\nexport function activityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null = null,\n): ActivityGroup[] {\n const groups: ActivityGroup[] = [];\n for (const source of pluginActivityGroups()) {\n const tab = source.transientTab === undefined ? {} : { transientTab: source.transientTab };\n const placement = {\n ...(source.placement === undefined ? {} : { placement: source.placement }),\n ...(source.marksBackgroundWork === false ? { marksBackgroundWork: false } : {}),\n ...(source.icon === undefined ? {} : { icon: source.icon }),\n };\n if (source.statusKey !== undefined && statuses[source.statusKey] !== undefined) {\n const summary = stripAnsi(statuses[source.statusKey] ?? '').trim();\n const active =\n source.activeSource?.isActive(sessionId) ?? (source.marksBackgroundWork !== false && summary.length > 0);\n if (summary.length === 0 && source.hideWhenEmpty === true && !active) continue;\n groups.push({ name: source.name, keys: source.keys, summary, active, ...tab, ...placement });\n continue;\n }\n if (source.widgetKeys !== undefined && source.widgetKeys.some((key) => widgets.includes(key))) {\n const activeKeys = source.activeWidgetKeys ?? source.widgetKeys;\n const active =\n source.activeSource?.isActive(sessionId) ??\n (source.marksBackgroundWork !== false && activeKeys.some((key) => widgets.includes(key)));\n groups.push({ name: source.name, keys: source.keys, summary: '', active, ...tab, ...placement });\n continue;\n }\n if (source.activeSource !== undefined) {\n const active = source.activeSource.isActive(sessionId);\n if (source.hideWhenEmpty === true && !active) continue;\n groups.push({\n name: source.name,\n keys: source.keys,\n summary: '',\n active,\n ...tab,\n ...placement,\n });\n }\n }\n return groups;\n}\n\n/** Dock faces update when the active session composition changes. */\nexport function useDockFaces(sessionId: string | null): readonly DockFaceContribution[] {\n useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision, webPluginRegistryRevision);\n const subscribe = (listener: () => void) => {\n const releases = pluginDockFaces().flatMap((face) =>\n face.visibility ? [face.visibility.subscribe(listener)] : [],\n );\n return () => releases.forEach((release) => release());\n };\n const snapshot = () =>\n pluginDockFaces()\n .map((face) => (face.visibility?.isVisible(sessionId) !== false ? '1' : '0'))\n .join('');\n useSyncExternalStore(subscribe, snapshot, snapshot);\n return pluginDockFaces().filter((face) => face.visibility?.isVisible(sessionId) !== false);\n}\n\nexport interface DockAutoSelectKeys {\n /** Every session face already chosen, so returning to a session leaves the user's pick alone. */\n sessions: readonly string[];\n /** The last tab face chosen, so only entering a matching tab selects it again. */\n tab: string;\n}\n\n/** Chooses the first newly eligible tab face, then the first session face not yet chosen. */\nexport function autoSelectedDockFace(\n faces: readonly DockFaceContribution[],\n context: { sessionId: string | null; tabId: string | null },\n previous: DockAutoSelectKeys,\n): { face: DockFaceContribution | undefined; keys: DockAutoSelectKeys } {\n const sessionFace = faces.find((face) => face.autoSelect === true);\n const tabFace = faces.find((face) => typeof face.autoSelect === 'function' && face.autoSelect(context));\n const sessionKey = sessionFace === undefined ? '' : `${context.sessionId}:${sessionFace.id}`;\n const freshSession = sessionKey !== '' && !previous.sessions.includes(sessionKey);\n const keys = {\n sessions: freshSession ? [...previous.sessions, sessionKey] : previous.sessions,\n tab: tabFace === undefined ? '' : `${context.sessionId}:${context.tabId}:${tabFace.id}`,\n };\n const face = tabFace !== undefined && keys.tab !== previous.tab ? tabFace : freshSession ? sessionFace : undefined;\n return { face, keys };\n}\n\n/** Activity groups that update when either host signals or a plugin's session store changes. */\nexport function useActivityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null,\n): ActivityGroup[] {\n useSyncExternalStore(\n subscribeActivitySources,\n () => activitySourceFingerprint(sessionId),\n () => activitySourceFingerprint(sessionId),\n );\n return activityGroups(statuses, widgets, sessionId);\n}\n\n/** The tab one path opens, or undefined when no installed plugin recognises it. */\nexport type FileLinkResolver = (path: string) => TransientTab | undefined;\n\ninterface FileLinkModes {\n active(sessionId: string | null): readonly string[];\n subscribe(sessionId: string | null, listener: () => void): () => void;\n}\nlet fileLinkModes: FileLinkModes | undefined;\nconst modeBindings = new Set<() => void>();\n\n/** Binds host session facts without making the composition library own session state. */\nexport function bindFileLinkModes(source: FileLinkModes): () => void {\n fileLinkModes = source;\n modeBindings.forEach((listener) => listener());\n return () => {\n if (fileLinkModes !== source) return;\n fileLinkModes = undefined;\n modeBindings.forEach((listener) => listener());\n };\n}\nfunction subscribeFileLinks(sessionId: string | null, listener: () => void): () => void {\n let unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n const rebindModes = () => {\n unsubscribeModes?.();\n unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n listener();\n };\n modeBindings.add(rebindModes);\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginFileLinks().map((source) => source.subscribe(listener));\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n modeBindings.delete(rebindModes);\n unsubscribeModes?.();\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activeFileLinkSources(sessionId: string | null) {\n const enabled = new Set(fileLinkModes?.active(sessionId) ?? []);\n return pluginFileLinks(sessionId).filter(\n (source) => source.requiredMinorMode === undefined || enabled.has(source.requiredMinorMode),\n );\n}\n\nfunction fileLinkFingerprint(sessionId: string | null): string {\n const sourceFingerprints = activeFileLinkSources(sessionId)\n .map((source) => `${source.requiredMinorMode ?? ''}:${source.fingerprint(sessionId)}`)\n .join('\\n');\n return `${webPluginRegistryRevision()}:${sourceFingerprints}`;\n}\n\n/**\n * The tab a path opens, from the first source that claims it.\n *\n * A path no source claims is not a link. The host cannot tell a file name from\n * a class name, and the plugin that tracks the session's files can, so the\n * decision belongs there rather than in a heuristic here.\n */\nexport function fileLinkFor(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n\n/**\n * The tab a path the caller is sure about opens: a tool call's path argument,\n * not a token spotted in prose.\n *\n * A source that offers `openPath` answers here, and it may claim a file the\n * session never changed, which `resolve` deliberately will not. Sources\n * without it fall back to the same guess prose gets.\n */\nexport function fileTabForPath(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.openPath?.(sessionId, path) ?? source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n/**\n * Resolves the paths a message names against the plugins that track them.\n *\n * The resolver's identity is stable while the linkable set is, so a component\n * that hands it to a renderer does not rebuild that renderer on every frame of\n * a streaming reply.\n */\nexport function useFileLinks(sessionId: string | null): FileLinkResolver {\n const fingerprint = useSyncExternalStore(\n useCallback((listener: () => void) => subscribeFileLinks(sessionId, listener), [sessionId]),\n () => fileLinkFingerprint(sessionId),\n () => fileLinkFingerprint(sessionId),\n );\n return useCallback(\n (path: string) => fileLinkFor(sessionId, path),\n // The fingerprint is the dependency: the same path resolves differently\n // once the session's set of tracked files changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps -- fingerprint is a deliberate identity buster, not a value the callback reads.\n [sessionId, fingerprint],\n );\n}\n"],"mappings":";;;;AA8BA,MAAM,sBAAsB;;;;;;;AAQ5B,MAAa,0BAAgE,CAC3E;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAc,YAAY;CAAc,OAAO;AAAG,GACpG;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAa,YAAY;CAAc,OAAO;CAAM,OAAO;AAAG,CAClH;;;;;;AAOA,SAAgB,cAAc,UAAmD;CAC/E,MAAM,WAAW,oBAAoB;CAErC,QADsD,SAAS,SAAS,IAAI,WAAW,wBAAA,CACxE,SAAS,WAAW;EACjC,MAAM,MAAM,SAAS,OAAO;EAC5B,IAAI,QAAQ,KAAA,GAAW,OAAO,CAAC;EAC/B,MAAM,QAAQ,OAAO,UAAU;EAC/B,MAAM,UAAU,QAAQ,UAAU,GAAG,CAAC,CAAC,MAAM,mBAAmB,IAAI,CAAC,UAAU,GAAG,CAAC,EAAA,CAChF,KAAK,UAAU,MAAM,KAAK,CAAC,CAAC,CAC5B,OAAO,OAAO;EACjB,OAAO,CAAC;GAAE,MAAM,OAAO;GAAM,SAAS,OAAO;GAAS;GAAQ,YAAY,OAAO;GAAY;EAAM,CAAC;CACtG,CAAC;AACH;;;;;;;;;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mB;CACrB;AACF;AAEA,SAAS,sBAAsB,WAA0B;CACvD,MAAM,UAAU,IAAI,IAAI,eAAe,OAAO,SAAS,KAAK,CAAC,CAAC;CAC9D,OAAO,gBAAgB,SAAS,CAAC,CAAC,QAC/B,WAAW,OAAO,sBAAsB,KAAA,KAAa,QAAQ,IAAI,OAAO,iBAAiB,CAC5F;AACF;AAEA,SAAS,oBAAoB,WAAkC;CAC7D,MAAM,qBAAqB,sBAAsB,SAAS,CAAC,CACxD,KAAK,WAAW,GAAG,OAAO,qBAAqB,GAAG,GAAG,OAAO,YAAY,SAAS,GAAG,CAAC,CACrF,KAAK,IAAI;CACZ,OAAO,GAAG,0BAA0B,EAAE,GAAG;AAC3C;;;;;;;;AASA,SAAgB,YAAY,WAA0B,MAAwC;CAC5F,KAAK,MAAM,UAAU,sBAAsB,SAAS,GAAG;EACrD,MAAM,MAAM,OAAO,QAAQ,WAAW,IAAI;EAC1C,IAAI,QAAQ,KAAA,GAAW,OAAO;CAChC;AAEF;;;;;;;;;AAUA,SAAgB,eAAe,WAA0B,MAAwC;CAC/F,KAAK,MAAM,UAAU,sBAAsB,SAAS,GAAG;EACrD,MAAM,MAAM,OAAO,WAAW,WAAW,IAAI,KAAK,OAAO,QAAQ,WAAW,IAAI;EAChF,IAAI,QAAQ,KAAA,GAAW,OAAO;CAChC;AAEF;;;;;;;;AAQA,SAAgB,aAAa,WAA4C;CACvE,MAAM,cAAc,qBAClB,aAAa,aAAyB,mBAAmB,WAAW,QAAQ,GAAG,CAAC,SAAS,CAAC,SACpF,oBAAoB,SAAS,SAC7B,oBAAoB,SAAS,CACrC;CACA,OAAO,aACJ,SAAiB,YAAY,WAAW,IAAI,GAI7C,CAAC,WAAW,WAAW,CACzB;AACF"}
@@ -42,7 +42,7 @@ function group(id, label, kind, detail, items) {
42
42
  * publishes, the tools they brought are not.
43
43
  */
44
44
  function contextGroups(statuses, widgets, projection = null, items = [], attribution = {}) {
45
- const selection = require_statusLine.parseSelection(statuses["doom-major-mode"] ?? "");
45
+ const selection = require_statusLine.parseSelection(statuses["po-major-mode"] ?? "");
46
46
  const byGroup = /* @__PURE__ */ new Map();
47
47
  for (const item of items) {
48
48
  const key = attribution[item.name] ?? "core";